1 |
|
2 | import { AsyncResult, DeployOptions, DeployResultLocator } from 'jsforce/api/metadata';
|
3 | import { JsonCollection, JsonMap, Optional } from '@salesforce/ts-types';
|
4 | import { Connection as JSForceConnection, ConnectionConfig, HttpRequest, QueryOptions, QueryResult, Record, Schema } from 'jsforce';
|
5 | import { Tooling as JSForceTooling } from 'jsforce/lib/api/tooling';
|
6 | import { StreamPromise } from 'jsforce/lib/util/promise';
|
7 | import { ConfigAggregator } from '../config/configAggregator';
|
8 | import { AuthFields, AuthInfo } from './authInfo';
|
9 | export declare const SFDX_HTTP_HEADERS: {
|
10 | 'content-type': string;
|
11 | 'user-agent': string;
|
12 | };
|
13 | export declare const DNS_ERROR_NAME = "DomainNotFoundError";
|
14 | type recentValidationOptions = {
|
15 | id: string;
|
16 | rest?: boolean;
|
17 | };
|
18 | export type DeployOptionsWithRest = Partial<DeployOptions> & {
|
19 | rest?: boolean;
|
20 | };
|
21 | export interface Tooling<S extends Schema = Schema> extends JSForceTooling<S> {
|
22 | _logger: any;
|
23 | }
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 | export declare class Connection<S extends Schema = Schema> extends JSForceConnection<S> {
|
40 | private logger;
|
41 | private options;
|
42 | private username;
|
43 | private hasResolved;
|
44 | private maxApiVersion;
|
45 | |
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 | constructor(options: Connection.Options<S>);
|
53 | /**
|
54 | * Tooling api reference.
|
55 | */
|
56 | get tooling(): Tooling<S>;
|
57 | /**
|
58 | * Creates an instance of a Connection. Performs additional async initializations.
|
59 | *
|
60 | * @param options Constructor options.
|
61 | */
|
62 | static create<S extends Schema>(this: new (options: Connection.Options<S>) => Connection<S>, options: Connection.Options<S>): Promise<Connection<S>>;
|
63 | /**
|
64 | * Async initializer.
|
65 | */
|
66 | init(): Promise<void>;
|
67 | /**
|
68 | * deploy a zipped buffer from the SDRL with REST or SOAP
|
69 | *
|
70 | * @param zipInput data to deploy
|
71 | * @param options JSForce deploy options + a boolean for rest
|
72 | */
|
73 | deploy(zipInput: Buffer, options: DeployOptionsWithRest): Promise<DeployResultLocator<AsyncResult & Schema>>;
|
74 | /**
|
75 | * Send REST API request with given HTTP request info, with connected session information
|
76 | * and SFDX headers.
|
77 | *
|
78 | * @param request HTTP request object or URL to GET request.
|
79 | * @param options HTTP API request options.
|
80 | */
|
81 | request<R = unknown>(request: string | HttpRequest, options?: JsonMap): StreamPromise<R>;
|
82 | /**
|
83 | * The Force API base url for the instance.
|
84 | */
|
85 | baseUrl(): string;
|
86 | /**
|
87 | * Will deploy a recently validated deploy request - directly calling jsforce now that this is supported.
|
88 | * WARNING: will always return a string from jsforce, the type is JsonCollection to support backwards compatibility
|
89 | *
|
90 | * @param options.id = the deploy ID that's been validated already from a previous checkOnly deploy request
|
91 | * @param options.rest = a boolean whether or not to use the REST API
|
92 | * @deprecated use {@link Connection.metadata#deployRecentValidation} instead - the jsforce implementation, instead of this wrapper
|
93 | */
|
94 | deployRecentValidation(options: recentValidationOptions): Promise<JsonCollection>;
|
95 | |
96 |
|
97 |
|
98 | retrieveMaxApiVersion(): Promise<string>;
|
99 | |
100 |
|
101 |
|
102 | useLatestApiVersion(): Promise<void>;
|
103 | |
104 |
|
105 |
|
106 | isResolvable(): Promise<boolean>;
|
107 | |
108 |
|
109 |
|
110 | getApiVersion(): string;
|
111 | |
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 | setApiVersion(version: string): void;
|
119 | |
120 |
|
121 |
|
122 | getAuthInfo(): AuthInfo;
|
123 | |
124 |
|
125 |
|
126 | getAuthInfoFields(): AuthFields;
|
127 | |
128 |
|
129 |
|
130 | getConnectionOptions(): AuthFields;
|
131 | |
132 |
|
133 |
|
134 | getUsername(): Optional<string>;
|
135 | |
136 |
|
137 |
|
138 | isUsingAccessToken(): boolean;
|
139 | |
140 |
|
141 |
|
142 |
|
143 |
|
144 | normalizeUrl(url: string): string;
|
145 | |
146 |
|
147 |
|
148 |
|
149 |
|
150 |
|
151 |
|
152 |
|
153 | autoFetchQuery<T extends Schema = S>(soql: string, queryOptions?: Partial<QueryOptions & {
|
154 | tooling: boolean;
|
155 | }>): Promise<QueryResult<T>>;
|
156 | |
157 |
|
158 |
|
159 |
|
160 |
|
161 |
|
162 |
|
163 | singleRecordQuery<T extends Record>(soql: string, options?: SingleRecordQueryOptions): Promise<T>;
|
164 | |
165 |
|
166 |
|
167 |
|
168 | refreshAuth(): Promise<void>;
|
169 | private getCachedApiVersion;
|
170 | }
|
171 | export declare const SingleRecordQueryErrors: {
|
172 | NoRecords: string;
|
173 | MultipleRecords: string;
|
174 | };
|
175 | export interface SingleRecordQueryOptions {
|
176 | tooling?: boolean;
|
177 | returnChoicesOnMultiple?: boolean;
|
178 | choiceField?: string;
|
179 | }
|
180 | export declare namespace Connection {
|
181 | |
182 |
|
183 |
|
184 | interface Options<S extends Schema> {
|
185 | |
186 |
|
187 |
|
188 | authInfo: AuthInfo;
|
189 | |
190 |
|
191 |
|
192 | configAggregator?: ConfigAggregator;
|
193 | |
194 |
|
195 |
|
196 | connectionOptions?: ConnectionConfig<S>;
|
197 | }
|
198 | }
|
199 | export {};
|