@salesforce/core 3.33.5 → 3.33.7

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/lib/org/org.d.ts CHANGED
@@ -44,6 +44,7 @@ export interface SandboxUserAuthResponse {
44
44
  instanceUrl: string;
45
45
  loginUrl: string;
46
46
  }
47
+ export declare function sandboxIsResumable(value: string): boolean;
47
48
  export type SandboxProcessObject = {
48
49
  Id: string;
49
50
  Status: string;
package/lib/org/org.js CHANGED
@@ -7,7 +7,7 @@
7
7
  */
8
8
  /* eslint-disable class-methods-use-this */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.Org = exports.SandboxEvents = exports.OrgTypes = void 0;
10
+ exports.Org = exports.sandboxIsResumable = exports.SandboxEvents = exports.OrgTypes = void 0;
11
11
  const path_1 = require("path");
12
12
  const fs = require("fs");
13
13
  const kit_1 = require("@salesforce/kit");
@@ -28,7 +28,7 @@ const connection_1 = require("./connection");
28
28
  const authInfo_1 = require("./authInfo");
29
29
  const scratchOrgCreate_1 = require("./scratchOrgCreate");
30
30
  const orgConfigProperties_1 = require("./orgConfigProperties");
31
- const messages = new messages_1.Messages('@salesforce/core', 'org', new Map([["notADevHub", "The provided dev hub username %s is not a valid dev hub."], ["noUsernameFound", "No username found."], ["noDevHubFound", "Unable to associate this scratch org with a DevHub."], ["deleteOrgHubError", "The Dev Hub org cannot be deleted."], ["insufficientAccessToDelete", "You do not have the appropriate permissions to delete a scratch org. Please contact your Salesforce admin."], ["scratchOrgNotFound", "Attempting to delete an expired or deleted org"], ["sandboxDeleteFailed", "The sandbox org deletion failed with a result of %s."], ["sandboxNotFound", "We can't find a SandboxProcess for the sandbox %s."], ["sandboxInfoCreateFailed", "The sandbox org creation failed with a result of %s."], ["missingAuthUsername", "The sandbox %s does not have an authorized username."], ["orgPollingTimeout", "Sandbox status is %s; timed out waiting for completion."], ["NotFoundOnDevHub", "The scratch org does not belong to the dev hub username %s."], ["AuthInfoOrgIdUndefined", "AuthInfo orgId is undefined."], ["sandboxCreateNotComplete", "The sandbox creation has not completed."], ["SandboxProcessNotFoundBySandboxName", "We can't find a SandboxProcess with the SandboxName %s."], ["MultiSandboxProcessNotFoundBySandboxName", "We found more than one SandboxProcess with the SandboxName %s."]]));
31
+ const messages = new messages_1.Messages('@salesforce/core', 'org', new Map([["notADevHub", "The provided dev hub username %s is not a valid dev hub."], ["noUsernameFound", "No username found."], ["noDevHubFound", "Unable to associate this scratch org with a DevHub."], ["deleteOrgHubError", "The Dev Hub org cannot be deleted."], ["insufficientAccessToDelete", "You do not have the appropriate permissions to delete a scratch org. Please contact your Salesforce admin."], ["scratchOrgNotFound", "Attempting to delete an expired or deleted org"], ["sandboxDeleteFailed", "The sandbox org deletion failed with a result of %s."], ["sandboxNotFound", "We can't find a SandboxProcess for the sandbox %s."], ["sandboxInfoCreateFailed", "The sandbox org creation failed with a result of %s."], ["missingAuthUsername", "The sandbox %s does not have an authorized username."], ["orgPollingTimeout", "Sandbox status is %s; timed out waiting for completion."], ["NotFoundOnDevHub", "The scratch org does not belong to the dev hub username %s."], ["AuthInfoOrgIdUndefined", "AuthInfo orgId is undefined."], ["sandboxCreateNotComplete", "The sandbox creation has not completed."], ["SandboxProcessNotFoundBySandboxName", "We can't find a SandboxProcess with the SandboxName %s."], ["MultiSandboxProcessNotFoundBySandboxName", "We found more than one SandboxProcess with the SandboxName %s."], ["sandboxNotResumable", "The sandbox %s cannot resume with status of %s."]]));
32
32
  var OrgTypes;
33
33
  (function (OrgTypes) {
34
34
  OrgTypes["Scratch"] = "scratch";
@@ -42,6 +42,11 @@ var SandboxEvents;
42
42
  SandboxEvents["EVENT_AUTH"] = "auth";
43
43
  SandboxEvents["EVENT_RESUME"] = "resume";
44
44
  })(SandboxEvents = exports.SandboxEvents || (exports.SandboxEvents = {}));
45
+ const resumableSandboxStatus = ['Activating', 'Pending', 'Pending Activation', 'Processing', 'Sampling'];
46
+ function sandboxIsResumable(value) {
47
+ return resumableSandboxStatus.includes(value);
48
+ }
49
+ exports.sandboxIsResumable = sandboxIsResumable;
45
50
  /**
46
51
  * Provides a way to manage a locally authenticated Org.
47
52
  *
@@ -173,6 +178,12 @@ class Org extends kit_1.AsyncOptionalCreatable {
173
178
  await lifecycleEvents_1.Lifecycle.getInstance().emit(SandboxEvents.EVENT_ASYNC_RESULT, sandboxCreationProgress);
174
179
  throw messages.createError('sandboxCreateNotComplete');
175
180
  }
181
+ if (!sandboxIsResumable(sandboxCreationProgress.Status)) {
182
+ throw messages.createError('sandboxNotResumable', [
183
+ sandboxCreationProgress.SandboxName,
184
+ sandboxCreationProgress.Status,
185
+ ]);
186
+ }
176
187
  this.logger.debug(`resume - pollStatusAndAuth sandboxProcessObj ${JSON.stringify(sandboxCreationProgress, undefined, 2)}, max wait time of ${wait.minutes} minutes`);
177
188
  return this.pollStatusAndAuth({
178
189
  sandboxProcessObj: sandboxCreationProgress,
package/lib/testSetup.js CHANGED
@@ -399,7 +399,7 @@ const stubContext = (testContext) => {
399
399
  // init calls read calls getPath which sets the path on the config file the first time.
400
400
  // Since read is now stubbed, make sure to call getPath to initialize it.
401
401
  configFile.getPath();
402
- // @ts-ignore set this to true to avoid an infinite loop in tests when reading config files.
402
+ // @ts-expect-error: set this to true to avoid an infinite loop in tests when reading config files.
403
403
  configFile.hasRead = true;
404
404
  return stub;
405
405
  };
@@ -421,9 +421,9 @@ const stubContext = (testContext) => {
421
421
  }
422
422
  };
423
423
  // Mock out all config file IO for all tests. They can restore individually if they need original functionality.
424
- // @ts-ignore
425
- stubs.configRead = testContext.SANDBOXES.CONFIG.stub(configFile_1.ConfigFile.prototype, 'readSync').callsFake(readSync);
426
- stubs.configReadSync = testContext.SANDBOXES.CONFIG.stub(configFile_1.ConfigFile.prototype, 'read').callsFake(read);
424
+ stubs.configRead = testContext.SANDBOXES.CONFIG.stub(configFile_1.ConfigFile.prototype, 'read').callsFake(read);
425
+ // @ts-expect-error: muting exact type match for stub readSync
426
+ stubs.configReadSync = testContext.SANDBOXES.CONFIG.stub(configFile_1.ConfigFile.prototype, 'readSync').callsFake(readSync);
427
427
  const writeSync = function (newContents) {
428
428
  if (!testContext.configStubs[this.constructor.name]) {
429
429
  testContext.configStubs[this.constructor.name] = {};
package/messages/org.md CHANGED
@@ -61,3 +61,7 @@ We can't find a SandboxProcess with the SandboxName %s.
61
61
  # MultiSandboxProcessNotFoundBySandboxName
62
62
 
63
63
  We found more than one SandboxProcess with the SandboxName %s.
64
+
65
+ # sandboxNotResumable
66
+
67
+ The sandbox %s cannot resume with status of %s.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/core",
3
- "version": "3.33.5",
3
+ "version": "3.33.7",
4
4
  "description": "Core libraries to interact with SFDX projects, orgs, and APIs.",
5
5
  "main": "lib/exported",
6
6
  "types": "lib/exported.d.ts",
@@ -63,11 +63,11 @@
63
63
  "@types/chai-string": "^1.4.2",
64
64
  "@types/debug": "0.0.31",
65
65
  "@types/jsen": "0.0.21",
66
- "@types/jsonwebtoken": "8.5.9",
66
+ "@types/jsonwebtoken": "9.0.1",
67
67
  "@types/lodash": "^4.14.191",
68
68
  "@types/shelljs": "0.8.11",
69
69
  "@typescript-eslint/eslint-plugin": "^5.53.0",
70
- "@typescript-eslint/parser": "^5.53.0",
70
+ "@typescript-eslint/parser": "^5.54.1",
71
71
  "chai": "^4.3.7",
72
72
  "chai-string": "^1.5.0",
73
73
  "commitizen": "^3.1.2",