@salesforce/core-bundle 8.1.2 → 8.1.3

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.
Files changed (2) hide show
  1. package/lib/index.js +38 -17
  2. package/package.json +2 -2
package/lib/index.js CHANGED
@@ -4611,7 +4611,7 @@ var require_package = __commonJS({
4611
4611
  "package.json"(exports2, module2) {
4612
4612
  module2.exports = {
4613
4613
  name: "@salesforce/core-bundle",
4614
- version: "8.1.2",
4614
+ version: "8.1.3",
4615
4615
  description: "Core libraries to interact with SFDX projects, orgs, and APIs.",
4616
4616
  main: "lib/index",
4617
4617
  types: "lib/index.d.ts",
@@ -4647,7 +4647,7 @@ var require_package = __commonJS({
4647
4647
  "messageTransformer/messageTransformer.ts"
4648
4648
  ],
4649
4649
  dependencies: {
4650
- "@jsforce/jsforce-node": "^3.2.1",
4650
+ "@jsforce/jsforce-node": "^3.2.3",
4651
4651
  "@salesforce/kit": "^3.1.6",
4652
4652
  "@salesforce/schemas": "^1.9.0",
4653
4653
  "@salesforce/ts-types": "^2.0.10",
@@ -31302,7 +31302,7 @@ var require_request = __commonJS({
31302
31302
  const controller = new abort_controller_1.default();
31303
31303
  let retryCount = 0;
31304
31304
  const retryOpts = {
31305
- statusCodes: options.retry?.statusCodes ?? [429, 500, 502, 503, 504],
31305
+ statusCodes: options.retry?.statusCodes ?? [420, 429, 500, 502, 503, 504],
31306
31306
  maxRetries: options.retry?.maxRetries ?? 5,
31307
31307
  minTimeout: options.retry?.minTimeout ?? 500,
31308
31308
  timeoutFactor: options.retry?.timeoutFactor ?? 2,
@@ -31774,7 +31774,7 @@ var require_VERSION = __commonJS({
31774
31774
  "node_modules/@jsforce/jsforce-node/lib/VERSION.js"(exports2) {
31775
31775
  "use strict";
31776
31776
  Object.defineProperty(exports2, "__esModule", { value: true });
31777
- exports2.default = "3.2.1";
31777
+ exports2.default = "3.2.3";
31778
31778
  }
31779
31779
  });
31780
31780
 
@@ -31849,10 +31849,11 @@ var require_oauth2 = __commonJS({
31849
31849
  this.tokenServiceUrl = tokenServiceUrl;
31850
31850
  this.revokeServiceUrl = revokeServiceUrl || `${this.loginUrl}/services/oauth2/revoke`;
31851
31851
  } else {
31852
- this.loginUrl = loginUrl || defaultOAuth2Config.loginUrl;
31853
- this.authzServiceUrl = `${this.loginUrl}/services/oauth2/authorize`;
31854
- this.tokenServiceUrl = `${this.loginUrl}/services/oauth2/token`;
31855
- this.revokeServiceUrl = `${this.loginUrl}/services/oauth2/revoke`;
31852
+ const loginUrlObject = new URL(loginUrl || defaultOAuth2Config.loginUrl);
31853
+ this.loginUrl = loginUrlObject.href;
31854
+ this.authzServiceUrl = `${loginUrlObject.origin}/services/oauth2/authorize`;
31855
+ this.tokenServiceUrl = `${loginUrlObject.origin}/services/oauth2/token`;
31856
+ this.revokeServiceUrl = `${loginUrlObject.origin}/services/oauth2/revoke`;
31856
31857
  }
31857
31858
  this.clientId = clientId;
31858
31859
  this.clientSecret = clientSecret;
@@ -31930,7 +31931,7 @@ var require_oauth2 = __commonJS({
31930
31931
  * OAuth2 Username-Password Flow (Resource Owner Password Credentials)
31931
31932
  */
31932
31933
  async authenticate(username, password) {
31933
- if (!this.clientId || !this.clientSecret || !this.redirectUri) {
31934
+ if (!this.clientId || !this.clientSecret) {
31934
31935
  throw new Error("No valid OAuth2 client configuration set");
31935
31936
  }
31936
31937
  const ret = await this._postParams({
@@ -31938,8 +31939,7 @@ var require_oauth2 = __commonJS({
31938
31939
  username,
31939
31940
  password,
31940
31941
  client_id: this.clientId,
31941
- client_secret: this.clientSecret,
31942
- redirect_uri: this.redirectUri
31942
+ client_secret: this.clientSecret
31943
31943
  });
31944
31944
  return ret;
31945
31945
  }
@@ -42191,7 +42191,7 @@ var require_http_api = __commonJS({
42191
42191
  if (errors.Errors) {
42192
42192
  return errors.Errors.Error;
42193
42193
  }
42194
- return Array.isArray(errors) ? errors[0] : errors;
42194
+ return errors;
42195
42195
  }
42196
42196
  /**
42197
42197
  * Get error message in response
@@ -42203,6 +42203,14 @@ var require_http_api = __commonJS({
42203
42203
  error = this.parseError(body || await this.parseResponseBody(response));
42204
42204
  } catch (e) {
42205
42205
  }
42206
+ if (Array.isArray(error)) {
42207
+ if (error.length === 1) {
42208
+ error = error[0];
42209
+ } else {
42210
+ return new HttpApiError(`Multiple errors returned.
42211
+ Check \`error.data\` for the error details`, "MULTIPLE_API_ERRORS", error);
42212
+ }
42213
+ }
42206
42214
  error = typeof error === "object" && error !== null && typeof error.message === "string" ? error : {
42207
42215
  errorCode: `ERROR_HTTP_${response.statusCode}`,
42208
42216
  message: response.body
@@ -42211,20 +42219,31 @@ var require_http_api = __commonJS({
42211
42219
  this._logger.debug(`html response.body: ${response.body}`);
42212
42220
  return new HttpApiError(`HTTP response contains html content.
42213
42221
  Check that the org exists and can be reached.
42214
- See error.content for the full html response.`, error.errorCode, error.message);
42222
+ See \`error.data\` for the full html response.`, error.errorCode, error.message);
42215
42223
  }
42216
- return new HttpApiError(error.message, error.errorCode);
42224
+ return error instanceof HttpApiError ? error : new HttpApiError(error.message, error.errorCode, error);
42217
42225
  }
42218
42226
  };
42219
42227
  exports2.HttpApi = HttpApi;
42220
42228
  var HttpApiError = class extends Error {
42229
+ /**
42230
+ * This contains error-specific details, usually returned from the API.
42231
+ */
42232
+ data;
42221
42233
  errorCode;
42222
- content;
42223
- constructor(message, errorCode, content) {
42234
+ constructor(message, errorCode, data) {
42224
42235
  super(message);
42225
42236
  this.name = errorCode || this.name;
42226
42237
  this.errorCode = this.name;
42227
- this.content = content;
42238
+ this.data = data;
42239
+ }
42240
+ /**
42241
+ * This will be removed in the next major (v4)
42242
+ *
42243
+ * @deprecated use `error.data` instead
42244
+ */
42245
+ get content() {
42246
+ return this.data;
42228
42247
  }
42229
42248
  };
42230
42249
  exports2.default = HttpApi;
@@ -42278,6 +42297,8 @@ var require_session_refresh_delegate = __commonJS({
42278
42297
  });
42279
42298
  await this._refreshPromise;
42280
42299
  this._logger.info("<refresh complete>");
42300
+ } catch (err) {
42301
+ throw new Error(`Unable to refresh session due to: ${err.message}`);
42281
42302
  } finally {
42282
42303
  this._refreshPromise = void 0;
42283
42304
  this._lastRefreshedAt = Date.now();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/core-bundle",
3
- "version": "8.1.2",
3
+ "version": "8.1.3",
4
4
  "description": "Core libraries to interact with SFDX projects, orgs, and APIs.",
5
5
  "main": "lib/index",
6
6
  "types": "lib/index.d.ts",
@@ -36,7 +36,7 @@
36
36
  "messageTransformer/messageTransformer.ts"
37
37
  ],
38
38
  "dependencies": {
39
- "@jsforce/jsforce-node": "^3.2.1",
39
+ "@jsforce/jsforce-node": "^3.2.3",
40
40
  "@salesforce/kit": "^3.1.6",
41
41
  "@salesforce/schemas": "^1.9.0",
42
42
  "@salesforce/ts-types": "^2.0.10",