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