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