@jsforce/jsforce-node 3.5.2 → 3.6.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/README.md CHANGED
@@ -32,6 +32,11 @@ https://jsforce.github.io/jsforce/
32
32
  v1 API reference:
33
33
  https://jsforce.github.io/jsforce/doc/
34
34
 
35
+ ## Migration
36
+ Migrating from v1 → v3? Find the [migration guide here](./MIGRATING_V1-V3.md)
37
+
38
+ Migrating from v2 → v3? Find the [migration guide here](./MIGRATING_V2-V3.md)
39
+
35
40
  ## Releases
36
41
 
37
42
  See [Releases](https://github.com/jsforce/jsforce/releases).
package/lib/VERSION.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "3.5.2";
1
+ declare const _default: "3.6.1";
2
2
  export default _default;
package/lib/VERSION.js CHANGED
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = '3.5.2';
3
+ exports.default = '3.6.1';
@@ -291,28 +291,60 @@ export declare class IngestJobV2<S extends Schema> extends EventEmitter {
291
291
  *
292
292
  * The order of records returned is not guaranteed to match the ordering of the uploaded data.
293
293
  *
294
+ * @param {boolean} raw Get results as a CSV string
294
295
  * @returns Promise<IngestJobV2SuccessfulResults>
295
296
  */
296
- getSuccessfulResults(): Promise<IngestJobV2SuccessfulResults<S>>;
297
+ getSuccessfulResults(raw?: false): Promise<IngestJobV2SuccessfulResults<S>>;
298
+ /** Return successful results
299
+ *
300
+ * The order of records returned is not guaranteed to match the ordering of the uploaded data.
301
+ *
302
+ * @param {boolean} raw Get results as a CSV string
303
+ * @returns Promise<string>
304
+ */
305
+ getSuccessfulResults(raw: true): Promise<string>;
297
306
  /** Return failed results
298
307
  *
299
308
  * The order of records in the response is not guaranteed to match the ordering of records in the original job data.
300
309
  *
310
+ * @param {boolean} raw Get results as a CSV string
301
311
  * @returns Promise<IngestJobV2SuccessfulResults>
302
312
  */
303
- getFailedResults(): Promise<IngestJobV2FailedResults<S>>;
313
+ getFailedResults(raw?: false): Promise<IngestJobV2FailedResults<S>>;
314
+ /** Return failed results
315
+ *
316
+ * The order of records in the response is not guaranteed to match the ordering of records in the original job data.
317
+ *
318
+ * @param {boolean} raw Get results as a CSV string
319
+ * @returns Promise<string>
320
+ */
321
+ getFailedResults(raw: true): Promise<string>;
304
322
  /** Return unprocessed results
305
323
  *
306
324
  * The unprocessed records endpoint returns records as a CSV.
307
325
  * If the request helper is able to parse it, you get the records
308
326
  * as an array of objects.
309
- * If unable to parse the it (bad CSV), you get the raw response as a string.
327
+ * If unable to parse it (bad CSV), you get the raw response as a string.
310
328
  *
311
329
  * The order of records in the response is not guaranteed to match the ordering of records in the original job data.
312
330
  *
331
+ * @param {boolean} raw Get results as a CSV string
313
332
  * @returns Promise<IngestJobV2UnprocessedRecords>
314
333
  */
315
- getUnprocessedRecords(): Promise<IngestJobV2UnprocessedRecords<S>>;
334
+ getUnprocessedRecords(raw?: false): Promise<IngestJobV2UnprocessedRecords<S>>;
335
+ /** Return unprocessed results
336
+ *
337
+ * The unprocessed records endpoint returns records as a CSV.
338
+ * If the request helper is able to parse it, you get the records
339
+ * as an array of objects.
340
+ * If unable to parse it (bad CSV), you get the raw response as a string.
341
+ *
342
+ * The order of records in the response is not guaranteed to match the ordering of records in the original job data.
343
+ *
344
+ * @param {boolean} raw Get results as a CSV string
345
+ * @returns Promise<string>
346
+ */
347
+ getUnprocessedRecords(raw: true): Promise<string>;
316
348
  /**
317
349
  * Deletes an ingest job.
318
350
  */
package/lib/api/bulk2.js CHANGED
@@ -608,13 +608,17 @@ class IngestJobV2 extends events_1.EventEmitter {
608
608
  ]);
609
609
  return { successfulResults, failedResults, unprocessedRecords };
610
610
  }
611
- /** Return successful results
612
- *
613
- * The order of records returned is not guaranteed to match the ordering of the uploaded data.
614
- *
615
- * @returns Promise<IngestJobV2SuccessfulResults>
616
- */
617
- async getSuccessfulResults() {
611
+ async getSuccessfulResults(raw) {
612
+ const reqOpts = {
613
+ method: 'GET',
614
+ path: `/${this.id}/successfulResults`,
615
+ };
616
+ if (raw) {
617
+ return this.createIngestRequest({
618
+ ...reqOpts,
619
+ responseType: 'text/plain',
620
+ });
621
+ }
618
622
  if (this.bulkJobSuccessfulResults) {
619
623
  return this.bulkJobSuccessfulResults;
620
624
  }
@@ -626,42 +630,43 @@ class IngestJobV2 extends events_1.EventEmitter {
626
630
  this.bulkJobSuccessfulResults = results ?? [];
627
631
  return this.bulkJobSuccessfulResults;
628
632
  }
629
- /** Return failed results
630
- *
631
- * The order of records in the response is not guaranteed to match the ordering of records in the original job data.
632
- *
633
- * @returns Promise<IngestJobV2SuccessfulResults>
634
- */
635
- async getFailedResults() {
633
+ async getFailedResults(raw) {
634
+ const reqOpts = {
635
+ method: 'GET',
636
+ path: `/${this.id}/failedResults`,
637
+ };
638
+ if (raw) {
639
+ return this.createIngestRequest({
640
+ ...reqOpts,
641
+ responseType: 'text/plain',
642
+ });
643
+ }
636
644
  if (this.bulkJobFailedResults) {
637
645
  return this.bulkJobFailedResults;
638
646
  }
639
647
  const results = await this.createIngestRequest({
640
- method: 'GET',
641
- path: `/${this.id}/failedResults`,
648
+ ...reqOpts,
642
649
  responseType: 'text/csv',
643
650
  });
644
651
  this.bulkJobFailedResults = results ?? [];
645
652
  return this.bulkJobFailedResults;
646
653
  }
647
- /** Return unprocessed results
648
- *
649
- * The unprocessed records endpoint returns records as a CSV.
650
- * If the request helper is able to parse it, you get the records
651
- * as an array of objects.
652
- * If unable to parse the it (bad CSV), you get the raw response as a string.
653
- *
654
- * The order of records in the response is not guaranteed to match the ordering of records in the original job data.
655
- *
656
- * @returns Promise<IngestJobV2UnprocessedRecords>
657
- */
658
- async getUnprocessedRecords() {
654
+ async getUnprocessedRecords(raw) {
655
+ const reqOpts = {
656
+ method: 'GET',
657
+ path: `/${this.id}/unprocessedrecords`,
658
+ };
659
+ if (raw) {
660
+ return this.createIngestRequest({
661
+ ...reqOpts,
662
+ responseType: 'text/plain',
663
+ });
664
+ }
659
665
  if (this.bulkJobUnprocessedRecords) {
660
666
  return this.bulkJobUnprocessedRecords;
661
667
  }
662
668
  const results = await this.createIngestRequest({
663
- method: 'GET',
664
- path: `/${this.id}/unprocessedrecords`,
669
+ ...reqOpts,
665
670
  responseType: 'text/csv',
666
671
  });
667
672
  this.bulkJobUnprocessedRecords = results ?? [];
package/lib/oauth2.js CHANGED
@@ -72,11 +72,11 @@ class OAuth2 {
72
72
  revokeServiceUrl || `${this.loginUrl}/services/oauth2/revoke`;
73
73
  }
74
74
  else {
75
- const loginUrlObject = new URL(loginUrl || defaultOAuth2Config.loginUrl);
76
- this.loginUrl = loginUrlObject.href;
77
- this.authzServiceUrl = `${loginUrlObject.origin}/services/oauth2/authorize`;
78
- this.tokenServiceUrl = `${loginUrlObject.origin}/services/oauth2/token`;
79
- this.revokeServiceUrl = `${loginUrlObject.origin}/services/oauth2/revoke`;
75
+ this.loginUrl = loginUrl ?? defaultOAuth2Config.loginUrl;
76
+ const maybeSlash = this.loginUrl.endsWith('/') ? '' : '/';
77
+ this.authzServiceUrl = `${this.loginUrl}${maybeSlash}services/oauth2/authorize`;
78
+ this.tokenServiceUrl = `${this.loginUrl}${maybeSlash}services/oauth2/token`;
79
+ this.revokeServiceUrl = `${this.loginUrl}${maybeSlash}services/oauth2/revoke`;
80
80
  }
81
81
  this.clientId = clientId;
82
82
  this.clientSecret = clientSecret;
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.SfdxRegistry = void 0;
7
7
  const child_process_1 = require("child_process");
8
- const strip_ansi_1 = __importDefault(require("strip-ansi"));
8
+ const util_1 = require("util");
9
9
  const connection_1 = __importDefault(require("../connection"));
10
10
  function isNotNullOrUndefined(v) {
11
11
  return v != null;
@@ -38,7 +38,7 @@ class SfdxRegistry {
38
38
  }
39
39
  });
40
40
  });
41
- const body = (0, strip_ansi_1.default)(buf.toString());
41
+ const body = (0, util_1.stripVTControlCharacters)(buf.toString());
42
42
  let ret;
43
43
  try {
44
44
  ret = JSON.parse(body);
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "database.com"
11
11
  ],
12
12
  "homepage": "http://github.com/jsforce/jsforce",
13
- "version": "3.5.2",
13
+ "version": "3.6.1",
14
14
  "repository": {
15
15
  "type": "git",
16
16
  "url": "git://github.com/jsforce/jsforce.git"
@@ -203,7 +203,6 @@
203
203
  "https-proxy-agent": "^5.0.0",
204
204
  "multistream": "^3.1.0",
205
205
  "node-fetch": "^2.6.1",
206
- "strip-ansi": "^6.0.0",
207
206
  "xml2js": "^0.6.2"
208
207
  },
209
208
  "devDependencies": {