@jsforce/jsforce-node 0.0.1 → 3.0.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +54 -0
- package/index.d.ts +4 -0
- package/index.js +1 -0
- package/lib/VERSION.d.ts +2 -0
- package/lib/VERSION.js +3 -0
- package/lib/api/analytics/types.d.ts +509 -0
- package/lib/api/analytics/types.js +2 -0
- package/lib/api/analytics.d.ts +163 -0
- package/lib/api/analytics.js +342 -0
- package/lib/api/apex.d.ts +44 -0
- package/lib/api/apex.js +86 -0
- package/lib/api/bulk.d.ts +253 -0
- package/lib/api/bulk.js +678 -0
- package/lib/api/bulk2.d.ts +324 -0
- package/lib/api/bulk2.js +800 -0
- package/lib/api/chatter.d.ts +133 -0
- package/lib/api/chatter.js +248 -0
- package/lib/api/metadata/schema.d.ts +16117 -0
- package/lib/api/metadata/schema.js +9094 -0
- package/lib/api/metadata.d.ts +189 -0
- package/lib/api/metadata.js +406 -0
- package/lib/api/soap/schema.d.ts +3167 -0
- package/lib/api/soap/schema.js +1787 -0
- package/lib/api/soap.d.ts +76 -0
- package/lib/api/soap.js +155 -0
- package/lib/api/streaming/extension.d.ts +94 -0
- package/lib/api/streaming/extension.js +151 -0
- package/lib/api/streaming.d.ts +160 -0
- package/lib/api/streaming.js +252 -0
- package/lib/api/tooling.d.ts +284 -0
- package/lib/api/tooling.js +202 -0
- package/lib/api/wsdl/wsdl2schema.d.ts +1 -0
- package/lib/api/wsdl/wsdl2schema.js +354 -0
- package/lib/browser/canvas.d.ts +12 -0
- package/lib/browser/canvas.js +77 -0
- package/lib/browser/client.d.ts +82 -0
- package/lib/browser/client.js +244 -0
- package/lib/browser/jsonp.d.ts +12 -0
- package/lib/browser/jsonp.js +69 -0
- package/lib/browser/registry.d.ts +3 -0
- package/lib/browser/registry.js +5 -0
- package/lib/browser/request.d.ts +10 -0
- package/lib/browser/request.js +202 -0
- package/lib/cache.d.ts +74 -0
- package/lib/cache.js +159 -0
- package/lib/connection.d.ts +356 -0
- package/lib/connection.js +1153 -0
- package/lib/core.d.ts +17 -0
- package/lib/core.js +55 -0
- package/lib/csv.d.ts +23 -0
- package/lib/csv.js +35 -0
- package/lib/date.d.ts +82 -0
- package/lib/date.js +201 -0
- package/lib/http-api.d.ts +75 -0
- package/lib/http-api.js +295 -0
- package/lib/index.d.ts +13 -0
- package/lib/index.js +32 -0
- package/lib/jsforce.d.ts +26 -0
- package/lib/jsforce.js +67 -0
- package/lib/jwtOAuth2.d.ts +8 -0
- package/lib/jwtOAuth2.js +23 -0
- package/lib/oauth2.d.ts +92 -0
- package/lib/oauth2.js +245 -0
- package/lib/process.d.ts +157 -0
- package/lib/process.js +143 -0
- package/lib/query.d.ts +341 -0
- package/lib/query.js +817 -0
- package/lib/quick-action.d.ts +44 -0
- package/lib/quick-action.js +46 -0
- package/lib/record-reference.d.ts +46 -0
- package/lib/record-reference.js +65 -0
- package/lib/record-stream.d.ts +83 -0
- package/lib/record-stream.js +233 -0
- package/lib/registry/base.d.ts +43 -0
- package/lib/registry/base.js +96 -0
- package/lib/registry/empty.d.ts +7 -0
- package/lib/registry/empty.js +13 -0
- package/lib/registry/file.d.ts +11 -0
- package/lib/registry/file.js +51 -0
- package/lib/registry/index.d.ts +8 -0
- package/lib/registry/index.js +21 -0
- package/lib/registry/sfdx.d.ts +56 -0
- package/lib/registry/sfdx.js +133 -0
- package/lib/registry/types.d.ts +47 -0
- package/lib/registry/types.js +2 -0
- package/lib/request-helper.d.ts +23 -0
- package/lib/request-helper.js +102 -0
- package/lib/request.d.ts +11 -0
- package/lib/request.js +75 -0
- package/lib/session-refresh-delegate.d.ts +31 -0
- package/lib/session-refresh-delegate.js +69 -0
- package/lib/soap.d.ts +60 -0
- package/lib/soap.js +257 -0
- package/lib/sobject.d.ts +258 -0
- package/lib/sobject.js +376 -0
- package/lib/soql-builder.d.ts +25 -0
- package/lib/soql-builder.js +226 -0
- package/lib/transport.d.ts +63 -0
- package/lib/transport.js +175 -0
- package/lib/types/common.d.ts +560 -0
- package/lib/types/common.js +2 -0
- package/lib/types/index.d.ts +7 -0
- package/lib/types/index.js +23 -0
- package/lib/types/projection.d.ts +26 -0
- package/lib/types/projection.js +2 -0
- package/lib/types/record.d.ts +44 -0
- package/lib/types/record.js +2 -0
- package/lib/types/schema.d.ts +50 -0
- package/lib/types/schema.js +2 -0
- package/lib/types/soap.d.ts +43 -0
- package/lib/types/soap.js +2 -0
- package/lib/types/standard-schema.d.ts +16199 -0
- package/lib/types/standard-schema.js +2 -0
- package/lib/types/util.d.ts +7 -0
- package/lib/types/util.js +2 -0
- package/lib/util/formatter.d.ts +8 -0
- package/lib/util/formatter.js +24 -0
- package/lib/util/function.d.ts +32 -0
- package/lib/util/function.js +52 -0
- package/lib/util/get-body-size.d.ts +4 -0
- package/lib/util/get-body-size.js +39 -0
- package/lib/util/logger.d.ts +29 -0
- package/lib/util/logger.js +102 -0
- package/lib/util/promise.d.ts +19 -0
- package/lib/util/promise.js +25 -0
- package/lib/util/stream.d.ts +12 -0
- package/lib/util/stream.js +88 -0
- package/package.json +262 -6
- package/typings/faye/index.d.ts +16 -0
- package/typings/index.d.ts +1 -0
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { EventEmitter } from 'events';
|
|
4
|
+
import { Readable } from 'stream';
|
|
5
|
+
import Connection from '../connection';
|
|
6
|
+
import { Parsable } from '../record-stream';
|
|
7
|
+
import { Record, Schema } from '../types';
|
|
8
|
+
export type IngestOperation = 'insert' | 'update' | 'upsert' | 'delete' | 'hardDelete';
|
|
9
|
+
type BaseJobInfo = {
|
|
10
|
+
id: string;
|
|
11
|
+
object: string;
|
|
12
|
+
createdById: string;
|
|
13
|
+
createdDate: string;
|
|
14
|
+
systemModstamp: string;
|
|
15
|
+
apiVersion: number;
|
|
16
|
+
lineEnding: 'LF' | 'CRLF';
|
|
17
|
+
columnDelimiter: 'BACKQUOTE' | 'CARET' | 'COMMA' | 'PIPE' | 'SEMICOLON' | 'TAB';
|
|
18
|
+
concurrencyMode: 'Parallel';
|
|
19
|
+
contentType: 'CSV';
|
|
20
|
+
numberRecordsProcessed: number;
|
|
21
|
+
retries: number;
|
|
22
|
+
totalProcessingTime: number;
|
|
23
|
+
};
|
|
24
|
+
export type QueryJobInfoV2 = BaseJobInfo & {
|
|
25
|
+
operation: 'query' | 'queryAll';
|
|
26
|
+
state: 'UploadComplete' | 'InProgress' | 'Aborted' | 'JobComplete' | 'Failed';
|
|
27
|
+
jobType: 'V2Query';
|
|
28
|
+
isPkChunkingSupported: boolean;
|
|
29
|
+
};
|
|
30
|
+
export type JobInfoV2 = BaseJobInfo & {
|
|
31
|
+
apexProcessingTime: number;
|
|
32
|
+
apiActiveProcessingTime: number;
|
|
33
|
+
assignmentRuleId?: string;
|
|
34
|
+
contentUrl: string;
|
|
35
|
+
errorMessage?: string;
|
|
36
|
+
externalIdFieldName?: string;
|
|
37
|
+
jobType: 'BigObjectIngest' | 'Classic' | 'V2Ingest';
|
|
38
|
+
operation: IngestOperation;
|
|
39
|
+
state: 'Open' | 'UploadComplete' | 'InProgress' | 'JobComplete' | 'Aborted' | 'Failed';
|
|
40
|
+
numberRecordsFailed: number;
|
|
41
|
+
};
|
|
42
|
+
export type IngestJobV2SuccessfulResults<S extends Schema> = Array<{
|
|
43
|
+
sf__Created: 'true' | 'false';
|
|
44
|
+
sf__Id: string;
|
|
45
|
+
} & S>;
|
|
46
|
+
export type IngestJobV2FailedResults<S extends Schema> = Array<{
|
|
47
|
+
sf__Error: string;
|
|
48
|
+
sf__Id: string;
|
|
49
|
+
} & S>;
|
|
50
|
+
export type IngestJobV2UnprocessedRecords<S extends Schema> = Array<S> | string;
|
|
51
|
+
export type IngestJobV2Results<S extends Schema> = {
|
|
52
|
+
successfulResults: IngestJobV2SuccessfulResults<S>;
|
|
53
|
+
failedResults: IngestJobV2FailedResults<S>;
|
|
54
|
+
unprocessedRecords: IngestJobV2UnprocessedRecords<S>;
|
|
55
|
+
};
|
|
56
|
+
type NewIngestJobOptions = Required<Pick<JobInfoV2, 'object' | 'operation'>> & Partial<Pick<JobInfoV2, 'assignmentRuleId' | 'columnDelimiter' | 'externalIdFieldName' | 'lineEnding' | 'contentType'>>;
|
|
57
|
+
type NewQueryJobOptions = {
|
|
58
|
+
query: string;
|
|
59
|
+
operation: QueryJobInfoV2['operation'];
|
|
60
|
+
} & Partial<Pick<QueryJobInfoV2, 'columnDelimiter' | 'lineEnding'>>;
|
|
61
|
+
type CreateIngestJobV2Options = {
|
|
62
|
+
bodyParams: NewIngestJobOptions;
|
|
63
|
+
pollingOptions: BulkV2PollingOptions;
|
|
64
|
+
};
|
|
65
|
+
type ExistingIngestJobOptions = {
|
|
66
|
+
id: string;
|
|
67
|
+
pollingOptions: BulkV2PollingOptions;
|
|
68
|
+
};
|
|
69
|
+
type CreateQueryJobV2Options = {
|
|
70
|
+
bodyParams: NewQueryJobOptions;
|
|
71
|
+
pollingOptions: BulkV2PollingOptions;
|
|
72
|
+
};
|
|
73
|
+
type ExistingQueryJobV2Options = {
|
|
74
|
+
id: string;
|
|
75
|
+
pollingOptions: BulkV2PollingOptions;
|
|
76
|
+
};
|
|
77
|
+
type BulkV2PollingOptions = {
|
|
78
|
+
pollInterval: number;
|
|
79
|
+
pollTimeout: number;
|
|
80
|
+
};
|
|
81
|
+
export declare class BulkV2<S extends Schema> {
|
|
82
|
+
private connection;
|
|
83
|
+
private logger;
|
|
84
|
+
/**
|
|
85
|
+
* Polling interval in milliseconds
|
|
86
|
+
*
|
|
87
|
+
* Default: 1000 (1 second)
|
|
88
|
+
*/
|
|
89
|
+
pollInterval: number;
|
|
90
|
+
/**
|
|
91
|
+
* Polling timeout in milliseconds
|
|
92
|
+
*
|
|
93
|
+
* Default: 30000 (30 seconds)
|
|
94
|
+
*/
|
|
95
|
+
pollTimeout: number;
|
|
96
|
+
constructor(connection: Connection<S>);
|
|
97
|
+
/**
|
|
98
|
+
* Create an instance of an ingest job object.
|
|
99
|
+
*
|
|
100
|
+
* @params {NewIngestJobOptions} options object
|
|
101
|
+
* @returns {IngestJobV2} An ingest job instance
|
|
102
|
+
* @example
|
|
103
|
+
* // Upsert records to the Account object.
|
|
104
|
+
*
|
|
105
|
+
* const job = connection.bulk2.createJob({
|
|
106
|
+
* operation: 'insert'
|
|
107
|
+
* object: 'Account',
|
|
108
|
+
* });
|
|
109
|
+
*
|
|
110
|
+
* // create the job in the org
|
|
111
|
+
* await job.open()
|
|
112
|
+
*
|
|
113
|
+
* // upload data
|
|
114
|
+
* await job.uploadData(csvFile)
|
|
115
|
+
*
|
|
116
|
+
* // finished uploading data, mark it as ready for processing
|
|
117
|
+
* await job.close()
|
|
118
|
+
*/
|
|
119
|
+
createJob(options: NewIngestJobOptions): IngestJobV2<S>;
|
|
120
|
+
/**
|
|
121
|
+
* Get an ingest or query job instance specified by a given job ID
|
|
122
|
+
*
|
|
123
|
+
* @param options Options object with a job ID
|
|
124
|
+
* @returns IngestJobV2 An ingest job
|
|
125
|
+
*/
|
|
126
|
+
job(type: 'query', options: Pick<ExistingQueryJobV2Options, 'id'>): QueryJobV2<S>;
|
|
127
|
+
job(type: 'ingest', options: Pick<ExistingIngestJobOptions, 'id'>): IngestJobV2<S>;
|
|
128
|
+
/**
|
|
129
|
+
* Create, upload, and start bulkload job
|
|
130
|
+
*/
|
|
131
|
+
loadAndWaitForResults(options: NewIngestJobOptions & Partial<BulkV2PollingOptions> & {
|
|
132
|
+
input: Record[] | Readable | string;
|
|
133
|
+
}): Promise<IngestJobV2Results<S>>;
|
|
134
|
+
/**
|
|
135
|
+
* Execute bulk query and get a record stream.
|
|
136
|
+
*
|
|
137
|
+
* Default timeout: 10000ms
|
|
138
|
+
*
|
|
139
|
+
* @param soql SOQL query
|
|
140
|
+
* @param BulkV2PollingOptions options object
|
|
141
|
+
*
|
|
142
|
+
* @returns {RecordStream} - Record stream, convertible to a CSV data stream
|
|
143
|
+
*/
|
|
144
|
+
query(soql: string, options?: Partial<BulkV2PollingOptions> & {
|
|
145
|
+
scanAll?: boolean;
|
|
146
|
+
columnDelimiter?: QueryJobInfoV2['columnDelimiter'];
|
|
147
|
+
lineEnding?: QueryJobInfoV2['lineEnding'];
|
|
148
|
+
}): Promise<Parsable<Record>>;
|
|
149
|
+
}
|
|
150
|
+
export declare class QueryJobV2<S extends Schema> extends EventEmitter {
|
|
151
|
+
private readonly connection;
|
|
152
|
+
private readonly logger;
|
|
153
|
+
private readonly _id?;
|
|
154
|
+
private readonly bodyParams?;
|
|
155
|
+
private readonly pollingOptions;
|
|
156
|
+
private error;
|
|
157
|
+
private jobInfo?;
|
|
158
|
+
private locator?;
|
|
159
|
+
constructor(conn: Connection<S>, options: ExistingQueryJobV2Options);
|
|
160
|
+
constructor(conn: Connection<S>, options: CreateQueryJobV2Options);
|
|
161
|
+
/**
|
|
162
|
+
* Get the query job ID.
|
|
163
|
+
*
|
|
164
|
+
* @returns {string} query job Id.
|
|
165
|
+
*/
|
|
166
|
+
get id(): string;
|
|
167
|
+
/**
|
|
168
|
+
* Get the query job info.
|
|
169
|
+
*
|
|
170
|
+
* @returns {Promise<QueryJobInfoV2>} query job information.
|
|
171
|
+
*/
|
|
172
|
+
getInfo(): QueryJobInfoV2;
|
|
173
|
+
/**
|
|
174
|
+
* Creates a query job
|
|
175
|
+
*
|
|
176
|
+
* @returns {Promise<QueryJobInfoV2>} job information.
|
|
177
|
+
*/
|
|
178
|
+
open(): Promise<QueryJobInfoV2>;
|
|
179
|
+
/**
|
|
180
|
+
* Abort the job
|
|
181
|
+
*
|
|
182
|
+
* The 'aborted' event is emitted when the job successfully aborts.
|
|
183
|
+
* @returns {Promise<QueryJobInfoV2>} job information.
|
|
184
|
+
*/
|
|
185
|
+
abort(): Promise<QueryJobInfoV2>;
|
|
186
|
+
/**
|
|
187
|
+
* Poll for the state of the processing for the job.
|
|
188
|
+
*
|
|
189
|
+
* @param interval Polling interval in milliseconds
|
|
190
|
+
* @param timeout Polling timeout in milliseconds
|
|
191
|
+
* @returns {Promise<Record[]>} A promise that resolves when the job finished being processed.
|
|
192
|
+
*/
|
|
193
|
+
poll(interval?: number, timeout?: number): Promise<void>;
|
|
194
|
+
/**
|
|
195
|
+
* Check the latest job status
|
|
196
|
+
*
|
|
197
|
+
* @returns {Promise<QueryJobInfoV2>} job information.
|
|
198
|
+
*/
|
|
199
|
+
check(): Promise<QueryJobInfoV2>;
|
|
200
|
+
/**
|
|
201
|
+
* Get the results for a query job as a record stream
|
|
202
|
+
*
|
|
203
|
+
* This method assumes the job finished being processed
|
|
204
|
+
* @returns {RecordStream} - Record stream, convertible to a CSV data stream
|
|
205
|
+
*/
|
|
206
|
+
result(): Promise<Parsable<Record>>;
|
|
207
|
+
/**
|
|
208
|
+
* Deletes a query job.
|
|
209
|
+
*/
|
|
210
|
+
delete(): Promise<void>;
|
|
211
|
+
private createQueryRequest;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Class for Bulk API V2 Ingest Job
|
|
215
|
+
*/
|
|
216
|
+
export declare class IngestJobV2<S extends Schema> extends EventEmitter {
|
|
217
|
+
private readonly connection;
|
|
218
|
+
private readonly logger;
|
|
219
|
+
private readonly _id?;
|
|
220
|
+
private readonly bodyParams?;
|
|
221
|
+
private readonly jobData;
|
|
222
|
+
private pollingOptions;
|
|
223
|
+
private bulkJobSuccessfulResults?;
|
|
224
|
+
private bulkJobFailedResults?;
|
|
225
|
+
private bulkJobUnprocessedRecords?;
|
|
226
|
+
private error;
|
|
227
|
+
private jobInfo?;
|
|
228
|
+
/**
|
|
229
|
+
*
|
|
230
|
+
*/
|
|
231
|
+
constructor(conn: Connection<S>, options: ExistingIngestJobOptions);
|
|
232
|
+
constructor(conn: Connection<S>, options: CreateIngestJobV2Options);
|
|
233
|
+
/**
|
|
234
|
+
* Get the query job ID.
|
|
235
|
+
*
|
|
236
|
+
* @returns {string} query job Id.
|
|
237
|
+
*/
|
|
238
|
+
get id(): string;
|
|
239
|
+
/**
|
|
240
|
+
* Get the query job info.
|
|
241
|
+
*
|
|
242
|
+
* @returns {Promise<QueryJobInfoV2>} ingest job information.
|
|
243
|
+
*/
|
|
244
|
+
getInfo(): JobInfoV2;
|
|
245
|
+
/**
|
|
246
|
+
* Create a job representing a bulk operation in the org
|
|
247
|
+
*
|
|
248
|
+
* @returns {Promise<QueryJobInfoV2>} job information.
|
|
249
|
+
*/
|
|
250
|
+
open(): Promise<Partial<JobInfoV2>>;
|
|
251
|
+
/** Upload data for a job in CSV format
|
|
252
|
+
*
|
|
253
|
+
* @param input CSV as a string, or array of records or readable stream
|
|
254
|
+
*/
|
|
255
|
+
uploadData(input: string | Record[] | Readable): Promise<void>;
|
|
256
|
+
/**
|
|
257
|
+
* Close opened job
|
|
258
|
+
*
|
|
259
|
+
* This method will notify the org that the upload of job data is complete and is ready for processing.
|
|
260
|
+
*/
|
|
261
|
+
close(): Promise<void>;
|
|
262
|
+
/**
|
|
263
|
+
* Set the status to abort
|
|
264
|
+
*/
|
|
265
|
+
abort(): Promise<void>;
|
|
266
|
+
/**
|
|
267
|
+
* Poll for the state of the processing for the job.
|
|
268
|
+
*
|
|
269
|
+
* This method will only throw after a timeout. To capture a
|
|
270
|
+
* job failure while polling you must set a listener for the
|
|
271
|
+
* `failed` event before calling it:
|
|
272
|
+
*
|
|
273
|
+
* job.on('failed', (err) => console.error(err))
|
|
274
|
+
* await job.poll()
|
|
275
|
+
*
|
|
276
|
+
* @param interval Polling interval in milliseconds
|
|
277
|
+
* @param timeout Polling timeout in milliseconds
|
|
278
|
+
* @returns {Promise<void>} A promise that resolves when the job finishes successfully
|
|
279
|
+
*/
|
|
280
|
+
poll(interval?: number, timeout?: number): Promise<void>;
|
|
281
|
+
/**
|
|
282
|
+
* Check the latest batch status in server
|
|
283
|
+
*/
|
|
284
|
+
check(): Promise<JobInfoV2>;
|
|
285
|
+
/** Return all record results
|
|
286
|
+
*
|
|
287
|
+
* This method will return successful, failed and unprocessed records
|
|
288
|
+
*
|
|
289
|
+
* @returns Promise<IngestJobV2Results>
|
|
290
|
+
*/
|
|
291
|
+
getAllResults(): Promise<IngestJobV2Results<S>>;
|
|
292
|
+
/** Return successful results
|
|
293
|
+
*
|
|
294
|
+
* The order of records returned is not guaranteed to match the ordering of the uploaded data.
|
|
295
|
+
*
|
|
296
|
+
* @returns Promise<IngestJobV2SuccessfulResults>
|
|
297
|
+
*/
|
|
298
|
+
getSuccessfulResults(): Promise<IngestJobV2SuccessfulResults<S>>;
|
|
299
|
+
/** Return failed results
|
|
300
|
+
*
|
|
301
|
+
* The order of records in the response is not guaranteed to match the ordering of records in the original job data.
|
|
302
|
+
*
|
|
303
|
+
* @returns Promise<IngestJobV2SuccessfulResults>
|
|
304
|
+
*/
|
|
305
|
+
getFailedResults(): Promise<IngestJobV2FailedResults<S>>;
|
|
306
|
+
/** Return unprocessed results
|
|
307
|
+
*
|
|
308
|
+
* The unprocessed records endpoint returns records as a CSV.
|
|
309
|
+
* If the request helper is able to parse it, you get the records
|
|
310
|
+
* as an array of objects.
|
|
311
|
+
* If unable to parse the it (bad CSV), you get the raw response as a string.
|
|
312
|
+
*
|
|
313
|
+
* The order of records in the response is not guaranteed to match the ordering of records in the original job data.
|
|
314
|
+
*
|
|
315
|
+
* @returns Promise<IngestJobV2UnprocessedRecords>
|
|
316
|
+
*/
|
|
317
|
+
getUnprocessedRecords(): Promise<IngestJobV2UnprocessedRecords<S>>;
|
|
318
|
+
/**
|
|
319
|
+
* Deletes an ingest job.
|
|
320
|
+
*/
|
|
321
|
+
delete(): Promise<void>;
|
|
322
|
+
private createIngestRequest;
|
|
323
|
+
}
|
|
324
|
+
export default BulkV2;
|