@jsforce/jsforce-node 3.2.2 → 3.2.4

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
@@ -60,6 +60,6 @@ See [DEVELOPING.md](./DEVELOPING.md)
60
60
 
61
61
  Your contributions are welcome: both by reporting issues on [GitHub issues](https://github.com/jsforce/jsforce/issues) or pull-requesting patches.
62
62
 
63
- If you want to implement any additional features, to be added to JSforce to our master branch, which may or may not be merged please first check current [opening issues](https://github.com/jsforce/jsforce/issues?q=is%3Aopen) with milestones and confirm whether the feature is on road map or not.
63
+ If you want to implement any additional features, to be added to JSforce to our main branch, which may or may not be merged please first check current [opening issues](https://github.com/jsforce/jsforce/issues?q=is%3Aopen) with milestones and confirm whether the feature is on road map or not.
64
64
 
65
65
  If your feature implementation is brand-new or fixing unsupposed bugs in the library's test cases, please include additional test codes in the `test/` directory.
package/lib/VERSION.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "3.2.2";
1
+ declare const _default: "3.2.4";
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.2.2';
3
+ exports.default = '3.2.4';
package/lib/http-api.js CHANGED
@@ -247,7 +247,7 @@ class HttpApi extends events_1.EventEmitter {
247
247
  if (errors.Errors) {
248
248
  return errors.Errors.Error;
249
249
  }
250
- return Array.isArray(errors) ? errors[0] : errors;
250
+ return errors;
251
251
  }
252
252
  /**
253
253
  * Get error message in response
@@ -261,6 +261,15 @@ class HttpApi extends events_1.EventEmitter {
261
261
  catch (e) {
262
262
  // eslint-disable no-empty
263
263
  }
264
+ if (Array.isArray(error)) {
265
+ if (error.length === 1) {
266
+ error = error[0];
267
+ }
268
+ else {
269
+ return new HttpApiError(`Multiple errors returned.
270
+ Check \`error.data\` for the error details`, 'MULTIPLE_API_ERRORS', error);
271
+ }
272
+ }
264
273
  error =
265
274
  typeof error === 'object' &&
266
275
  error !== null &&
@@ -274,9 +283,9 @@ class HttpApi extends events_1.EventEmitter {
274
283
  this._logger.debug(`html response.body: ${response.body}`);
275
284
  return new HttpApiError(`HTTP response contains html content.
276
285
  Check that the org exists and can be reached.
277
- See error.content for the full html response.`, error.errorCode, error.message);
286
+ See \`error.data\` for the full html response.`, error.errorCode, error.message);
278
287
  }
279
- return new HttpApiError(error.message, error.errorCode);
288
+ return error instanceof HttpApiError ? error : new HttpApiError(error.message, error.errorCode, error);
280
289
  }
281
290
  }
282
291
  exports.HttpApi = HttpApi;
@@ -284,13 +293,24 @@ exports.HttpApi = HttpApi;
284
293
  *
285
294
  */
286
295
  class HttpApiError extends Error {
296
+ /**
297
+ * This contains error-specific details, usually returned from the API.
298
+ */
299
+ data;
287
300
  errorCode;
288
- content;
289
- constructor(message, errorCode, content) {
301
+ constructor(message, errorCode, data) {
290
302
  super(message);
291
303
  this.name = errorCode || this.name;
292
304
  this.errorCode = this.name;
293
- this.content = content;
305
+ this.data = data;
306
+ }
307
+ /**
308
+ * This will be removed in the next major (v4)
309
+ *
310
+ * @deprecated use `error.data` instead
311
+ */
312
+ get content() {
313
+ return this.data;
294
314
  }
295
315
  }
296
316
  exports.default = HttpApi;
package/lib/oauth2.js CHANGED
@@ -72,10 +72,11 @@ class OAuth2 {
72
72
  revokeServiceUrl || `${this.loginUrl}/services/oauth2/revoke`;
73
73
  }
74
74
  else {
75
- this.loginUrl = loginUrl || defaultOAuth2Config.loginUrl;
76
- this.authzServiceUrl = `${this.loginUrl}/services/oauth2/authorize`;
77
- this.tokenServiceUrl = `${this.loginUrl}/services/oauth2/token`;
78
- this.revokeServiceUrl = `${this.loginUrl}/services/oauth2/revoke`;
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`;
79
80
  }
80
81
  this.clientId = clientId;
81
82
  this.clientSecret = clientSecret;
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.2.2",
13
+ "version": "3.2.4",
14
14
  "repository": {
15
15
  "type": "git",
16
16
  "url": "git://github.com/jsforce/jsforce.git"
@@ -19,7 +19,7 @@
19
19
  "licenses": [
20
20
  {
21
21
  "type": "MIT",
22
- "url": "http://github.com/jsforce/jsforce/raw/master/LICENSE"
22
+ "url": "http://github.com/jsforce/jsforce/raw/main/LICENSE"
23
23
  }
24
24
  ],
25
25
  "main": "./index",