@jsforce/jsforce-node 0.0.1 → 3.0.0-next.1
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 +444 -0
- package/lib/api/bulk.js +1372 -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 +355 -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 +257 -0
- package/lib/index.d.ts +12 -0
- package/lib/index.js +31 -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 +246 -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/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 +260 -6
- package/typings/faye/index.d.ts +16 -0
- package/typings/index.d.ts +1 -0
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
/// <reference types="node" />
|
|
4
|
+
/**
|
|
5
|
+
* @file Manages Salesforce Bulk API related operations
|
|
6
|
+
* @author Shinichi Tomita <shinichi.tomita@gmail.com>
|
|
7
|
+
*/
|
|
8
|
+
import { EventEmitter } from 'events';
|
|
9
|
+
import { Duplex, Readable, Writable } from 'stream';
|
|
10
|
+
import Connection from '../connection';
|
|
11
|
+
import { Serializable, Parsable } from '../record-stream';
|
|
12
|
+
import { StreamPromise } from '../util/promise';
|
|
13
|
+
import { Logger } from '../util/logger';
|
|
14
|
+
import { HttpMethods, Record, Schema, Optional } from '../types';
|
|
15
|
+
export type BulkOperation = 'insert' | 'update' | 'upsert' | 'delete' | 'hardDelete' | 'query' | 'queryAll';
|
|
16
|
+
export type IngestOperation = Exclude<BulkOperation, 'query' | 'queryAll'>;
|
|
17
|
+
export type QueryOperation = Extract<BulkOperation, 'query' | 'queryAll'>;
|
|
18
|
+
export type BulkOptions = {
|
|
19
|
+
extIdField?: string;
|
|
20
|
+
concurrencyMode?: 'Serial' | 'Parallel';
|
|
21
|
+
assignmentRuleId?: string;
|
|
22
|
+
};
|
|
23
|
+
export type JobState = 'Open' | 'Closed' | 'Aborted' | 'Failed' | 'Unknown';
|
|
24
|
+
export type JobStateV2 = Exclude<JobState, 'Closed' | 'Unknown'> | 'UploadComplete' | 'InProgress' | 'JobComplete';
|
|
25
|
+
export type JobInfo = {
|
|
26
|
+
id: string;
|
|
27
|
+
object: string;
|
|
28
|
+
operation: BulkOperation;
|
|
29
|
+
state: JobState;
|
|
30
|
+
};
|
|
31
|
+
export type JobInfoV2 = {
|
|
32
|
+
apiVersion: string;
|
|
33
|
+
assignmentRuleId?: string;
|
|
34
|
+
columnDelimiter: 'BACKQUOTE' | 'CARET' | 'COMMA' | 'PIPE' | 'SEMICOLON' | 'TAB';
|
|
35
|
+
concurrencyMode: 'Parallel';
|
|
36
|
+
contentType: 'CSV';
|
|
37
|
+
contentUrl: string;
|
|
38
|
+
createdById: string;
|
|
39
|
+
createdDate: string;
|
|
40
|
+
externalIdFieldName?: string;
|
|
41
|
+
id: string;
|
|
42
|
+
jobType: 'BigObjectIngest' | 'Classic' | 'V2Ingest';
|
|
43
|
+
lineEnding: 'LF' | 'CRLF';
|
|
44
|
+
object: string;
|
|
45
|
+
operation: BulkOperation;
|
|
46
|
+
state: JobStateV2;
|
|
47
|
+
systemModstamp: string;
|
|
48
|
+
numberRecordsProcessed?: number;
|
|
49
|
+
numberRecordsFailed?: number;
|
|
50
|
+
};
|
|
51
|
+
export type BatchState = 'Queued' | 'InProgress' | 'Completed' | 'Failed' | 'NotProcessed';
|
|
52
|
+
export type BatchInfo = {
|
|
53
|
+
id: string;
|
|
54
|
+
jobId: string;
|
|
55
|
+
state: BatchState;
|
|
56
|
+
stateMessage: string;
|
|
57
|
+
numberRecordsProcessed: string;
|
|
58
|
+
numberRecordsFailed: string;
|
|
59
|
+
totalProcessingTime: string;
|
|
60
|
+
};
|
|
61
|
+
export type BulkQueryBatchResult = Array<{
|
|
62
|
+
id: string;
|
|
63
|
+
batchId: string;
|
|
64
|
+
jobId: string;
|
|
65
|
+
}>;
|
|
66
|
+
export type BulkIngestBatchResult = Array<{
|
|
67
|
+
id: string | null;
|
|
68
|
+
success: boolean;
|
|
69
|
+
errors: string[];
|
|
70
|
+
}>;
|
|
71
|
+
export type BatchResult<Opr extends BulkOperation> = Opr extends 'query' | 'queryAll' ? BulkQueryBatchResult : BulkIngestBatchResult;
|
|
72
|
+
type BulkRequest = {
|
|
73
|
+
method: HttpMethods;
|
|
74
|
+
path: string;
|
|
75
|
+
body?: string;
|
|
76
|
+
headers?: {
|
|
77
|
+
[name: string]: string;
|
|
78
|
+
};
|
|
79
|
+
responseType?: string;
|
|
80
|
+
};
|
|
81
|
+
export type IngestJobV2SuccessfulResults<S extends Schema> = Array<{
|
|
82
|
+
sf__Created: 'true' | 'false';
|
|
83
|
+
sf__Id: string;
|
|
84
|
+
} & S>;
|
|
85
|
+
export type IngestJobV2FailedResults<S extends Schema> = Array<{
|
|
86
|
+
sf__Error: string;
|
|
87
|
+
sf__Id: string;
|
|
88
|
+
} & S>;
|
|
89
|
+
export type IngestJobV2UnprocessedRecords<S extends Schema> = Array<S>;
|
|
90
|
+
export type IngestJobV2Results<S extends Schema> = {
|
|
91
|
+
successfulResults: IngestJobV2SuccessfulResults<S>;
|
|
92
|
+
failedResults: IngestJobV2FailedResults<S>;
|
|
93
|
+
unprocessedRecords: IngestJobV2UnprocessedRecords<S>;
|
|
94
|
+
};
|
|
95
|
+
type NewIngestJobOptions = Required<Pick<JobInfoV2, 'object' | 'operation'>> & Partial<Pick<JobInfoV2, 'assignmentRuleId' | 'externalIdFieldName' | 'lineEnding'>>;
|
|
96
|
+
type ExistingIngestJobOptions = Pick<JobInfoV2, 'id'>;
|
|
97
|
+
type CreateIngestJobV2Options<S extends Schema> = {
|
|
98
|
+
connection: Connection<S>;
|
|
99
|
+
jobInfo: NewIngestJobOptions | ExistingIngestJobOptions;
|
|
100
|
+
pollingOptions: BulkV2PollingOptions;
|
|
101
|
+
};
|
|
102
|
+
type CreateQueryJobV2Options<S extends Schema> = {
|
|
103
|
+
connection: Connection<S>;
|
|
104
|
+
operation: QueryOperation;
|
|
105
|
+
query: string;
|
|
106
|
+
pollingOptions: BulkV2PollingOptions;
|
|
107
|
+
};
|
|
108
|
+
type BulkV2PollingOptions = {
|
|
109
|
+
pollInterval: number;
|
|
110
|
+
pollTimeout: number;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Class for Bulk API Job
|
|
114
|
+
*/
|
|
115
|
+
export declare class Job<S extends Schema, Opr extends BulkOperation> extends EventEmitter {
|
|
116
|
+
type: string | null;
|
|
117
|
+
operation: Opr | null;
|
|
118
|
+
options: BulkOptions;
|
|
119
|
+
id: string | null;
|
|
120
|
+
state: JobState;
|
|
121
|
+
_bulk: Bulk<S>;
|
|
122
|
+
_batches: {
|
|
123
|
+
[id: string]: Batch<S, Opr>;
|
|
124
|
+
};
|
|
125
|
+
_jobInfo: Promise<JobInfo> | undefined;
|
|
126
|
+
_error: Error | undefined;
|
|
127
|
+
/**
|
|
128
|
+
*
|
|
129
|
+
*/
|
|
130
|
+
constructor(bulk: Bulk<S>, type: string | null, operation: Opr | null, options: BulkOptions | null, jobId?: string);
|
|
131
|
+
/**
|
|
132
|
+
* Return latest jobInfo from cache
|
|
133
|
+
*/
|
|
134
|
+
info(): Promise<JobInfo>;
|
|
135
|
+
/**
|
|
136
|
+
* Open new job and get jobinfo
|
|
137
|
+
*/
|
|
138
|
+
open(): Promise<JobInfo>;
|
|
139
|
+
/**
|
|
140
|
+
* Create a new batch instance in the job
|
|
141
|
+
*/
|
|
142
|
+
createBatch(): Batch<S, Opr>;
|
|
143
|
+
/**
|
|
144
|
+
* Get a batch instance specified by given batch ID
|
|
145
|
+
*/
|
|
146
|
+
batch(batchId: string): Batch<S, Opr>;
|
|
147
|
+
/**
|
|
148
|
+
* Check the latest job status from server
|
|
149
|
+
*/
|
|
150
|
+
check(): Promise<JobInfo>;
|
|
151
|
+
/**
|
|
152
|
+
* Wait till the job is assigned to server
|
|
153
|
+
*/
|
|
154
|
+
ready(): Promise<string>;
|
|
155
|
+
/**
|
|
156
|
+
* List all registered batch info in job
|
|
157
|
+
*/
|
|
158
|
+
list(): Promise<BatchInfo[]>;
|
|
159
|
+
/**
|
|
160
|
+
* Close opened job
|
|
161
|
+
*/
|
|
162
|
+
close(): Promise<JobInfo | undefined>;
|
|
163
|
+
/**
|
|
164
|
+
* Set the status to abort
|
|
165
|
+
*/
|
|
166
|
+
abort(): Promise<JobInfo | undefined>;
|
|
167
|
+
/**
|
|
168
|
+
* @private
|
|
169
|
+
*/
|
|
170
|
+
_changeState(state: JobState): Promise<JobInfo>;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Batch (extends Writable)
|
|
174
|
+
*/
|
|
175
|
+
export declare class Batch<S extends Schema, Opr extends BulkOperation> extends Writable {
|
|
176
|
+
job: Job<S, Opr>;
|
|
177
|
+
id: string | undefined;
|
|
178
|
+
_bulk: Bulk<S>;
|
|
179
|
+
_uploadStream: Serializable;
|
|
180
|
+
_downloadStream: Parsable;
|
|
181
|
+
_dataStream: Duplex;
|
|
182
|
+
_result: Promise<BatchResult<Opr>> | undefined;
|
|
183
|
+
_error: Error | undefined;
|
|
184
|
+
/**
|
|
185
|
+
*
|
|
186
|
+
*/
|
|
187
|
+
constructor(job: Job<S, Opr>, id?: string);
|
|
188
|
+
/**
|
|
189
|
+
* Connect batch API and create stream instance of request/response
|
|
190
|
+
*
|
|
191
|
+
* @private
|
|
192
|
+
*/
|
|
193
|
+
_createRequestStream(): Duplex;
|
|
194
|
+
/**
|
|
195
|
+
* Implementation of Writable
|
|
196
|
+
*/
|
|
197
|
+
_write(record_: Record, enc: BufferEncoding, cb: () => void): void;
|
|
198
|
+
/**
|
|
199
|
+
* Returns duplex stream which accepts CSV data input and batch result output
|
|
200
|
+
*/
|
|
201
|
+
stream(): Duplex;
|
|
202
|
+
/**
|
|
203
|
+
* Execute batch operation
|
|
204
|
+
*/
|
|
205
|
+
execute(input?: string | Record[] | Readable): this;
|
|
206
|
+
run: (input?: string | Record[] | Readable) => this;
|
|
207
|
+
exec: (input?: string | Record[] | Readable) => this;
|
|
208
|
+
/**
|
|
209
|
+
* Promise/A+ interface
|
|
210
|
+
* Delegate to promise, return promise instance for batch result
|
|
211
|
+
*/
|
|
212
|
+
then(onResolved: (res: BatchResult<Opr>) => void, onReject: (err: any) => void): Promise<void>;
|
|
213
|
+
/**
|
|
214
|
+
* Check the latest batch status in server
|
|
215
|
+
*/
|
|
216
|
+
check(): Promise<BatchInfo>;
|
|
217
|
+
/**
|
|
218
|
+
* Polling the batch result and retrieve
|
|
219
|
+
*/
|
|
220
|
+
poll(interval: number, timeout: number): void;
|
|
221
|
+
/**
|
|
222
|
+
* Retrieve batch result
|
|
223
|
+
*/
|
|
224
|
+
retrieve(): Promise<BulkQueryBatchResult | BulkIngestBatchResult>;
|
|
225
|
+
/**
|
|
226
|
+
* Fetch query result as a record stream
|
|
227
|
+
* @param {String} resultId - Result id
|
|
228
|
+
* @returns {RecordStream} - Record stream, convertible to CSV data stream
|
|
229
|
+
*/
|
|
230
|
+
result(resultId: string): Parsable<Record>;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Class for Bulk API
|
|
234
|
+
*
|
|
235
|
+
* @class
|
|
236
|
+
*/
|
|
237
|
+
export declare class Bulk<S extends Schema> {
|
|
238
|
+
_conn: Connection<S>;
|
|
239
|
+
_logger: Logger;
|
|
240
|
+
/**
|
|
241
|
+
* Polling interval in milliseconds
|
|
242
|
+
*/
|
|
243
|
+
pollInterval: number;
|
|
244
|
+
/**
|
|
245
|
+
* Polling timeout in milliseconds
|
|
246
|
+
* @type {Number}
|
|
247
|
+
*/
|
|
248
|
+
pollTimeout: number;
|
|
249
|
+
/**
|
|
250
|
+
*
|
|
251
|
+
*/
|
|
252
|
+
constructor(conn: Connection<S>);
|
|
253
|
+
/**
|
|
254
|
+
*
|
|
255
|
+
*/
|
|
256
|
+
_request<T>(request_: BulkRequest): StreamPromise<T>;
|
|
257
|
+
/**
|
|
258
|
+
* Create and start bulkload job and batch
|
|
259
|
+
*/
|
|
260
|
+
load<Opr extends BulkOperation>(type: string, operation: Opr, input?: Record[] | Readable | string): Batch<S, Opr>;
|
|
261
|
+
load<Opr extends BulkOperation>(type: string, operation: Opr, optionsOrInput?: BulkOptions | Record[] | Readable | string, input?: Record[] | Readable | string): Batch<S, Opr>;
|
|
262
|
+
/**
|
|
263
|
+
* Execute bulk query and get record stream
|
|
264
|
+
*/
|
|
265
|
+
query(soql: string): Parsable<Record>;
|
|
266
|
+
/**
|
|
267
|
+
* Create a new job instance
|
|
268
|
+
*/
|
|
269
|
+
createJob<Opr extends BulkOperation>(type: string, operation: Opr, options?: BulkOptions): Job<S, Opr>;
|
|
270
|
+
/**
|
|
271
|
+
* Get a job instance specified by given job ID
|
|
272
|
+
*
|
|
273
|
+
* @param {String} jobId - Job ID
|
|
274
|
+
* @returns {Bulk~Job}
|
|
275
|
+
*/
|
|
276
|
+
job<Opr extends BulkOperation>(jobId: string): Job<S, Opr>;
|
|
277
|
+
}
|
|
278
|
+
export declare class BulkV2<S extends Schema> {
|
|
279
|
+
#private;
|
|
280
|
+
/**
|
|
281
|
+
* Polling interval in milliseconds
|
|
282
|
+
*/
|
|
283
|
+
pollInterval: number;
|
|
284
|
+
/**
|
|
285
|
+
* Polling timeout in milliseconds
|
|
286
|
+
* @type {Number}
|
|
287
|
+
*/
|
|
288
|
+
pollTimeout: number;
|
|
289
|
+
constructor(connection: Connection<S>);
|
|
290
|
+
/**
|
|
291
|
+
* Create an instance of an ingest job object.
|
|
292
|
+
*
|
|
293
|
+
* @params {NewIngestJobOptions} options object
|
|
294
|
+
* @returns {IngestJobV2} An ingest job instance
|
|
295
|
+
* @example
|
|
296
|
+
* // Upsert records to the Account object.
|
|
297
|
+
*
|
|
298
|
+
* const job = connection.bulk2.createJob({
|
|
299
|
+
* operation: 'insert'
|
|
300
|
+
* object: 'Account',
|
|
301
|
+
* });
|
|
302
|
+
*
|
|
303
|
+
* // create the job in the org
|
|
304
|
+
* await job.open()
|
|
305
|
+
*
|
|
306
|
+
* // upload data
|
|
307
|
+
* await job.uploadData(csvFile)
|
|
308
|
+
*
|
|
309
|
+
* // finished uploading data, mark it as ready for processing
|
|
310
|
+
* await job.close()
|
|
311
|
+
*/
|
|
312
|
+
createJob<Opr extends IngestOperation>(options: NewIngestJobOptions): IngestJobV2<S, Opr>;
|
|
313
|
+
/**
|
|
314
|
+
* Get a ingest job instance specified by a given job ID
|
|
315
|
+
*
|
|
316
|
+
* @param options Options object with a job ID
|
|
317
|
+
* @returns IngestJobV2 An ingest job
|
|
318
|
+
*/
|
|
319
|
+
job<Opr extends IngestOperation>(options: ExistingIngestJobOptions): IngestJobV2<S, Opr>;
|
|
320
|
+
/**
|
|
321
|
+
* Create, upload, and start bulkload job
|
|
322
|
+
*/
|
|
323
|
+
loadAndWaitForResults(options: NewIngestJobOptions & Partial<BulkV2PollingOptions> & {
|
|
324
|
+
input: Record[] | Readable | string;
|
|
325
|
+
}): Promise<IngestJobV2Results<S>>;
|
|
326
|
+
/**
|
|
327
|
+
* Execute bulk query and get records
|
|
328
|
+
*
|
|
329
|
+
* Default timeout: 10000ms
|
|
330
|
+
*
|
|
331
|
+
* @param soql SOQL query
|
|
332
|
+
* @param BulkV2PollingOptions options object
|
|
333
|
+
*
|
|
334
|
+
* @returns Record[]
|
|
335
|
+
*/
|
|
336
|
+
query(soql: string, options?: Partial<BulkV2PollingOptions> & {
|
|
337
|
+
scanAll?: boolean;
|
|
338
|
+
}): Promise<Record[]>;
|
|
339
|
+
}
|
|
340
|
+
export declare class QueryJobV2<S extends Schema> extends EventEmitter {
|
|
341
|
+
#private;
|
|
342
|
+
jobInfo: Partial<JobInfoV2> | undefined;
|
|
343
|
+
locator: Optional<string>;
|
|
344
|
+
finished: boolean;
|
|
345
|
+
constructor(options: CreateQueryJobV2Options<S>);
|
|
346
|
+
/**
|
|
347
|
+
* Creates a query job
|
|
348
|
+
*/
|
|
349
|
+
open(): Promise<void>;
|
|
350
|
+
/**
|
|
351
|
+
* Set the status to abort
|
|
352
|
+
*/
|
|
353
|
+
abort(): Promise<void>;
|
|
354
|
+
/**
|
|
355
|
+
* Poll for the state of the processing for the job.
|
|
356
|
+
*
|
|
357
|
+
* This method will only throw after a timeout. To capture a
|
|
358
|
+
* job failure while polling you must set a listener for the
|
|
359
|
+
* `failed` event before calling it:
|
|
360
|
+
*
|
|
361
|
+
* job.on('failed', (err) => console.error(err))
|
|
362
|
+
* await job.poll()
|
|
363
|
+
*
|
|
364
|
+
* @param interval Polling interval in milliseconds
|
|
365
|
+
* @param timeout Polling timeout in milliseconds
|
|
366
|
+
* @returns {Promise<Record[]>} A promise that resolves to an array of records
|
|
367
|
+
*/
|
|
368
|
+
poll(interval?: number, timeout?: number): Promise<void>;
|
|
369
|
+
/**
|
|
370
|
+
* Check the latest batch status in server
|
|
371
|
+
*/
|
|
372
|
+
check(): Promise<JobInfoV2>;
|
|
373
|
+
private request;
|
|
374
|
+
private getResultsUrl;
|
|
375
|
+
/**
|
|
376
|
+
* Get the results for a query job.
|
|
377
|
+
*
|
|
378
|
+
* @returns {Promise<Record[]>} A promise that resolves to an array of records
|
|
379
|
+
*/
|
|
380
|
+
getResults(): Promise<Record[]>;
|
|
381
|
+
/**
|
|
382
|
+
* Deletes a query job.
|
|
383
|
+
*/
|
|
384
|
+
delete(): Promise<void>;
|
|
385
|
+
private createQueryRequest;
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Class for Bulk API V2 Ingest Job
|
|
389
|
+
*/
|
|
390
|
+
export declare class IngestJobV2<S extends Schema, Opr extends IngestOperation> extends EventEmitter {
|
|
391
|
+
#private;
|
|
392
|
+
jobInfo: Partial<JobInfoV2>;
|
|
393
|
+
/**
|
|
394
|
+
*
|
|
395
|
+
*/
|
|
396
|
+
constructor(options: CreateIngestJobV2Options<S>);
|
|
397
|
+
get id(): string | undefined;
|
|
398
|
+
/**
|
|
399
|
+
* Create a job representing a bulk operation in the org
|
|
400
|
+
*/
|
|
401
|
+
open(): Promise<void>;
|
|
402
|
+
/** Upload data for a job in CSV format
|
|
403
|
+
*
|
|
404
|
+
* @param input CSV as a string, or array of records or readable stream
|
|
405
|
+
*/
|
|
406
|
+
uploadData(input: string | Record[] | Readable): Promise<void>;
|
|
407
|
+
getAllResults(): Promise<IngestJobV2Results<S>>;
|
|
408
|
+
/**
|
|
409
|
+
* Close opened job
|
|
410
|
+
*/
|
|
411
|
+
close(): Promise<void>;
|
|
412
|
+
/**
|
|
413
|
+
* Set the status to abort
|
|
414
|
+
*/
|
|
415
|
+
abort(): Promise<void>;
|
|
416
|
+
/**
|
|
417
|
+
* Poll for the state of the processing for the job.
|
|
418
|
+
*
|
|
419
|
+
* This method will only throw after a timeout. To capture a
|
|
420
|
+
* job failure while polling you must set a listener for the
|
|
421
|
+
* `failed` event before calling it:
|
|
422
|
+
*
|
|
423
|
+
* job.on('failed', (err) => console.error(err))
|
|
424
|
+
* await job.poll()
|
|
425
|
+
*
|
|
426
|
+
* @param interval Polling interval in milliseconds
|
|
427
|
+
* @param timeout Polling timeout in milliseconds
|
|
428
|
+
* @returns {Promise<void>} A promise that resolves when the job finishes successfully
|
|
429
|
+
*/
|
|
430
|
+
poll(interval?: number, timeout?: number): Promise<void>;
|
|
431
|
+
/**
|
|
432
|
+
* Check the latest batch status in server
|
|
433
|
+
*/
|
|
434
|
+
check(): Promise<JobInfoV2>;
|
|
435
|
+
getSuccessfulResults(): Promise<IngestJobV2SuccessfulResults<S>>;
|
|
436
|
+
getFailedResults(): Promise<IngestJobV2FailedResults<S>>;
|
|
437
|
+
getUnprocessedRecords(): Promise<IngestJobV2UnprocessedRecords<S>>;
|
|
438
|
+
/**
|
|
439
|
+
* Deletes an ingest job.
|
|
440
|
+
*/
|
|
441
|
+
delete(): Promise<void>;
|
|
442
|
+
private createIngestRequest;
|
|
443
|
+
}
|
|
444
|
+
export default Bulk;
|