@salesforce/core-bundle 8.8.6 → 8.9.0

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/index.d.ts CHANGED
@@ -3841,19 +3841,22 @@ declare module '@salesforce/core-bundle/org/scratchOrgCreate' {
3841
3841
  /** if false, do not use source tracking for this scratch org */
3842
3842
  tracksSource?: boolean;
3843
3843
  };
3844
- export const scratchOrgResume: (jobId: string) => Promise<ScratchOrgCreateResult>;
3844
+ export const scratchOrgResume: (jobId: string, timeout?: Duration) => Promise<ScratchOrgCreateResult>;
3845
3845
  export const scratchOrgCreate: (options: ScratchOrgCreateOptions) => Promise<ScratchOrgCreateResult>;
3846
3846
 
3847
3847
  }
3848
3848
  declare module '@salesforce/core-bundle/org/scratchOrgErrorCodes' {
3849
3849
  import { Optional } from '@salesforce/ts-types';
3850
+ import { Duration } from '@salesforce/kit';
3850
3851
  import { ScratchOrgInfo } from '@salesforce/core-bundle/org/scratchOrgTypes';
3851
3852
  import { ScratchOrgCache } from '@salesforce/core-bundle/org/scratchOrgCache';
3852
- export const validateScratchOrgInfoForResume: ({ jobId, scratchOrgInfo, cache, hubUsername, }: {
3853
+ import { Org } from '@salesforce/core-bundle/org/org';
3854
+ export const validateScratchOrgInfoForResume: ({ jobId, hubOrg, cache, hubUsername, timeout, }: {
3853
3855
  jobId: string;
3854
- scratchOrgInfo: ScratchOrgInfo;
3856
+ hubOrg: Org;
3855
3857
  cache: ScratchOrgCache;
3856
3858
  hubUsername: string;
3859
+ timeout: Duration;
3857
3860
  }) => Promise<ScratchOrgInfo>;
3858
3861
  export const checkScratchOrgInfoForErrors: (orgInfo: Optional<ScratchOrgInfo>, hubUsername: Optional<string>) => Promise<ScratchOrgInfo>;
3859
3862
 
package/lib/index.js CHANGED
@@ -12310,7 +12310,7 @@ var require_package2 = __commonJS({
12310
12310
  "package.json"(exports2, module2) {
12311
12311
  module2.exports = {
12312
12312
  name: "@salesforce/core-bundle",
12313
- version: "8.8.6",
12313
+ version: "8.9.0",
12314
12314
  description: "Core libraries to interact with SFDX projects, orgs, and APIs.",
12315
12315
  main: "lib/index",
12316
12316
  types: "lib/index.d.ts",
@@ -12347,7 +12347,7 @@ var require_package2 = __commonJS({
12347
12347
  "messageTransformer/messageTransformer.ts"
12348
12348
  ],
12349
12349
  dependencies: {
12350
- "@jsforce/jsforce-node": "^3.6.5",
12350
+ "@jsforce/jsforce-node": "^3.7.0",
12351
12351
  "@salesforce/kit": "^3.2.2",
12352
12352
  "@salesforce/schemas": "^1.9.0",
12353
12353
  "@salesforce/ts-types": "^2.0.10",
@@ -32593,9 +32593,7 @@ var require_request = __commonJS({
32593
32593
  if (resOrErr instanceof node_fetch_1.Response) {
32594
32594
  if (retryOpts.statusCodes.includes(resOrErr.status)) {
32595
32595
  if (maxRetry === retryCount) {
32596
- const err = new Error("Request failed");
32597
- err.name = "RequestRetryError";
32598
- throw err;
32596
+ return false;
32599
32597
  } else {
32600
32598
  return true;
32601
32599
  }
@@ -32650,9 +32648,7 @@ var require_request = __commonJS({
32650
32648
  }
32651
32649
  logger.debug("Skipping retry...");
32652
32650
  if (maxRetry === retryCount) {
32653
- const error2 = new Error("Request failed", { cause: err });
32654
- error2.name = "RequestRetryError";
32655
- throw error2;
32651
+ throw err;
32656
32652
  } else {
32657
32653
  throw err;
32658
32654
  }
@@ -33030,7 +33026,7 @@ var require_VERSION = __commonJS({
33030
33026
  "node_modules/@jsforce/jsforce-node/lib/VERSION.js"(exports2) {
33031
33027
  "use strict";
33032
33028
  Object.defineProperty(exports2, "__esModule", { value: true });
33033
- exports2.default = "3.6.5";
33029
+ exports2.default = "3.7.0";
33034
33030
  }
33035
33031
  });
33036
33032
 
@@ -61493,13 +61489,19 @@ var require_metadata = __commonJS({
61493
61489
  return new DeployResultLocator(this, res);
61494
61490
  }
61495
61491
  /**
61496
- * Checks the status of declarative metadata call deploy()
61492
+ * Checks the status of declarative metadata call deploy(), using either
61493
+ * SOAP or REST APIs. SOAP is the default.
61497
61494
  */
61498
- checkDeployStatus(asyncProcessId, includeDetails = false) {
61499
- return this._invoke("checkDeployStatus", {
61500
- asyncProcessId,
61501
- includeDetails
61502
- }, schema_1.ApiSchemas.DeployResult);
61495
+ async checkDeployStatus(asyncProcessId, includeDetails = false, rest = false) {
61496
+ if (rest) {
61497
+ const url = `/metadata/deployRequest/${asyncProcessId}${includeDetails ? "?includeDetails=true" : ""}`;
61498
+ return (await this._conn.requestGet(url)).deployResult;
61499
+ } else {
61500
+ return this._invoke("checkDeployStatus", {
61501
+ asyncProcessId,
61502
+ includeDetails
61503
+ }, schema_1.ApiSchemas.DeployResult);
61504
+ }
61503
61505
  }
61504
61506
  async cancelDeploy(id) {
61505
61507
  return this._invoke("cancelDeploy", { id });
@@ -94355,11 +94357,14 @@ var require_scratchOrgErrorCodes = __commonJS({
94355
94357
  "use strict";
94356
94358
  Object.defineProperty(exports2, "__esModule", { value: true });
94357
94359
  exports2.checkScratchOrgInfoForErrors = exports2.validateScratchOrgInfoForResume = void 0;
94360
+ var kit_1 = require_lib2();
94358
94361
  var messages_12 = require_messages();
94359
94362
  var sfError_12 = require_sfError();
94360
94363
  var logger_12 = require_logger();
94364
+ var pollingClient_12 = require_pollingClient();
94361
94365
  var scratchOrgCache_12 = require_scratchOrgCache();
94362
94366
  var scratchOrgLifecycleEvents_12 = require_scratchOrgLifecycleEvents();
94367
+ var scratchOrgInfoApi_1 = require_scratchOrgInfoApi();
94363
94368
  var WORKSPACE_CONFIG_FILENAME = "sfdx-project.json";
94364
94369
  var messages = new messages_12.Messages("@salesforce/core-bundle", "scratchOrgErrorCodes", /* @__PURE__ */ new Map([["SignupFailedError", "The request to create a scratch org failed with error code: %s."], ["SignupFailedUnknownError", "An unknown server error occurred. Please try again. If you still see this error, contact Salesforce support for assistance. Include the information from 'sfdx force:data:record:get -s ScratchOrgInfo -i %s -u %s'."], ["SignupFailedActionError", "See https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_scratch_orgs_error_codes.htm for information on error code %s."], ["SignupUnexpectedError", "The request to create a scratch org returned an unexpected status"], ["StillInProgressError", "The scratch org is not ready yet (Status = %s)."], ["action.StillInProgress", "Wait for a few minutes, and then try the command again"], ["NoScratchOrgInfoError", "No ScratchOrgInfo object found in the Dev Hub you specified. Check that the ID and the Dev Hub are correct."], ["ScratchOrgDeletedError", "That scratch org has been deleted, so you can't connect to it anymore."], ["INVALID_ID_FIELD", "Provide a valid template ID, in the format 0TTxxxxxxxxxxxx."], ["T-0002", "We couldn\u2019t find a template or snapshot with the ID or name specified in the scratch org definition. If you\u2019re sure the ID is correct, contact Salesforce Support."], ["T-0003", "The template specified in the scratch org definition is unapproved. Contact Salesforce Support to request template approval."], ["T-0004", "The Trialforce Source Organization (TSO) for the template doesn\u2019t exist or has expired."], ["S-1006", "Provide a valid email address in your scratch org definition or your %s file."], ["S-2006", "Provide a valid country code in your scratch org definition or your %s file."], ["S-1017", "Specify a namespace that\u2019s used by a release org associated with your Dev Hub org."], ["S-1018", "Provide a valid My Domain value. This value can\u2019t include double hyphens, end in a hyphen, include restricted words, or be more than 40 characters long."], ["S-1019", "The My Domain value you chose is already in use."], ["S-1026", "Provide a valid namespace value. This value must begin with a letter. It can\u2019t include consecutive underscores, end in an underscore, be more than 15 characters long, or be a restricted or reserved namespace. Only alphanumeric characters and underscores are allowed."], ["S-9999", "A fatal signup error occurred. Please try again. If you still see this error, contact Salesforce Support for assistance."], ["SH-0001", "Can\u2019t create scratch org. Contact the source org admin to add your Dev Hub org ID to Setup > Org Shape. Then try again."], ["SH-0002", "Can\u2019t create scratch org. No org shape exists for the specified sourceOrg. Create an org shape and try again."], ["SH-0003", "Can\u2019t create scratch org from org shape. The org shape version is outdated. Recreate the org shape and try again."], ["C-1007", "The username provided to the org:create command is already in use. Run 'force:org:list --clean' to remove stale org authentications or create the org with a different username."], ["C-1015", "We encountered a problem while registering your My Domain value with the DNS provider. Please try again."], ["C-1016", "We encountered a problem while attempting to configure and approve the Connected App for your org. Verify the Connected App configuration with your Salesforce admin."], ["C-1017", "Provide a valid namespace prefix. This value must begin with a letter. It can\u2019t include consecutive underscores, end in an underscore, be more than 15 characters long, or be a restricted or reserved namespace. Only alphanumeric characters and underscores are allowed."], ["C-1020", "We couldn't find a template with the ID specified in the scratch org definition. If you\u2019re sure the ID is correct, contact Salesforce Support."], ["C-1027", "The template specified in the Scratch Definition isn\u2019t supported. Specify a generic edition (such as Developer or Enterprise), or specify a template ID."], ["C-9999", "A fatal signup error occurred. Please try again. If you still see this error, contact Salesforce Support for assistance"]]));
94365
94370
  var namedMessages = new messages_12.Messages("@salesforce/core-bundle", "scratchOrgErrorCodes", /* @__PURE__ */ new Map([["SignupFailedError", "The request to create a scratch org failed with error code: %s."], ["SignupFailedUnknownError", "An unknown server error occurred. Please try again. If you still see this error, contact Salesforce support for assistance. Include the information from 'sfdx force:data:record:get -s ScratchOrgInfo -i %s -u %s'."], ["SignupFailedActionError", "See https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_scratch_orgs_error_codes.htm for information on error code %s."], ["SignupUnexpectedError", "The request to create a scratch org returned an unexpected status"], ["StillInProgressError", "The scratch org is not ready yet (Status = %s)."], ["action.StillInProgress", "Wait for a few minutes, and then try the command again"], ["NoScratchOrgInfoError", "No ScratchOrgInfo object found in the Dev Hub you specified. Check that the ID and the Dev Hub are correct."], ["ScratchOrgDeletedError", "That scratch org has been deleted, so you can't connect to it anymore."], ["INVALID_ID_FIELD", "Provide a valid template ID, in the format 0TTxxxxxxxxxxxx."], ["T-0002", "We couldn\u2019t find a template or snapshot with the ID or name specified in the scratch org definition. If you\u2019re sure the ID is correct, contact Salesforce Support."], ["T-0003", "The template specified in the scratch org definition is unapproved. Contact Salesforce Support to request template approval."], ["T-0004", "The Trialforce Source Organization (TSO) for the template doesn\u2019t exist or has expired."], ["S-1006", "Provide a valid email address in your scratch org definition or your %s file."], ["S-2006", "Provide a valid country code in your scratch org definition or your %s file."], ["S-1017", "Specify a namespace that\u2019s used by a release org associated with your Dev Hub org."], ["S-1018", "Provide a valid My Domain value. This value can\u2019t include double hyphens, end in a hyphen, include restricted words, or be more than 40 characters long."], ["S-1019", "The My Domain value you chose is already in use."], ["S-1026", "Provide a valid namespace value. This value must begin with a letter. It can\u2019t include consecutive underscores, end in an underscore, be more than 15 characters long, or be a restricted or reserved namespace. Only alphanumeric characters and underscores are allowed."], ["S-9999", "A fatal signup error occurred. Please try again. If you still see this error, contact Salesforce Support for assistance."], ["SH-0001", "Can\u2019t create scratch org. Contact the source org admin to add your Dev Hub org ID to Setup > Org Shape. Then try again."], ["SH-0002", "Can\u2019t create scratch org. No org shape exists for the specified sourceOrg. Create an org shape and try again."], ["SH-0003", "Can\u2019t create scratch org from org shape. The org shape version is outdated. Recreate the org shape and try again."], ["C-1007", "The username provided to the org:create command is already in use. Run 'force:org:list --clean' to remove stale org authentications or create the org with a different username."], ["C-1015", "We encountered a problem while registering your My Domain value with the DNS provider. Please try again."], ["C-1016", "We encountered a problem while attempting to configure and approve the Connected App for your org. Verify the Connected App configuration with your Salesforce admin."], ["C-1017", "Provide a valid namespace prefix. This value must begin with a letter. It can\u2019t include consecutive underscores, end in an underscore, be more than 15 characters long, or be a restricted or reserved namespace. Only alphanumeric characters and underscores are allowed."], ["C-1020", "We couldn't find a template with the ID specified in the scratch org definition. If you\u2019re sure the ID is correct, contact Salesforce Support."], ["C-1027", "The template specified in the Scratch Definition isn\u2019t supported. Specify a generic edition (such as Developer or Enterprise), or specify a template ID."], ["C-9999", "A fatal signup error occurred. Please try again. If you still see this error, contact Salesforce Support for assistance"]]));
@@ -94374,14 +94379,47 @@ var require_scratchOrgErrorCodes = __commonJS({
94374
94379
  return void 0;
94375
94380
  }
94376
94381
  };
94377
- var validateScratchOrgInfoForResume = async ({ jobId, scratchOrgInfo, cache, hubUsername }) => {
94382
+ var validateScratchOrgInfoForResume = async ({ jobId, hubOrg, cache, hubUsername, timeout }) => {
94383
+ const scratchOrgInfo = await (0, scratchOrgInfoApi_1.queryScratchOrgInfo)(hubOrg, jobId);
94378
94384
  if (!scratchOrgInfo?.Id || scratchOrgInfo.Status === "Deleted") {
94379
94385
  cache.unset(jobId);
94380
94386
  await cache.write();
94381
94387
  throw scratchOrgInfo.Status === "Deleted" ? namedMessages.createError("ScratchOrgDeletedError") : namedMessages.createError("NoScratchOrgInfoError");
94382
94388
  }
94383
94389
  if (["New", "Creating"].includes(scratchOrgInfo.Status)) {
94384
- throw namedMessages.createError("StillInProgressError", [scratchOrgInfo.Status], ["action.StillInProgress"]);
94390
+ const logger = await logger_12.Logger.child("scratchOrgResume");
94391
+ logger.debug(`PollingTimeout in minutes: ${timeout.minutes}`);
94392
+ const options = {
94393
+ async poll() {
94394
+ try {
94395
+ const resultInProgress = await (0, scratchOrgInfoApi_1.queryScratchOrgInfo)(hubOrg, jobId);
94396
+ logger.debug(`polling client result: ${JSON.stringify(resultInProgress, null, 4)}`);
94397
+ if (resultInProgress.Status === "Active" || resultInProgress.Status === "Error") {
94398
+ return {
94399
+ completed: true,
94400
+ payload: resultInProgress
94401
+ };
94402
+ }
94403
+ await (0, scratchOrgLifecycleEvents_12.emit)({ stage: "wait for org", scratchOrgInfo: resultInProgress });
94404
+ logger.debug(`Scratch org status is ${resultInProgress.Status}`);
94405
+ return {
94406
+ completed: false
94407
+ };
94408
+ } catch (error) {
94409
+ logger.debug(`Error: ${error.message}`);
94410
+ logger.debug("Re-trying deploy check again....");
94411
+ return {
94412
+ completed: false
94413
+ };
94414
+ }
94415
+ },
94416
+ frequency: kit_1.Duration.seconds(1),
94417
+ timeoutErrorName: "ScratchOrgResumeTimeOutError",
94418
+ timeout
94419
+ };
94420
+ const client = await pollingClient_12.PollingClient.create(options);
94421
+ const result = await client.subscribe();
94422
+ return (0, exports2.checkScratchOrgInfoForErrors)(result, hubUsername);
94385
94423
  }
94386
94424
  return (0, exports2.checkScratchOrgInfoForErrors)(scratchOrgInfo, hubUsername);
94387
94425
  };
@@ -107361,7 +107399,7 @@ var require_scratchOrgCreate = __commonJS({
107361
107399
  throw messages.createError("RetryNotIntError");
107362
107400
  }
107363
107401
  };
107364
- var scratchOrgResume = async (jobId) => {
107402
+ var scratchOrgResume = async (jobId, timeout = kit_1.Duration.minutes(15)) => {
107365
107403
  const [logger, cache] = await Promise.all([
107366
107404
  logger_12.Logger.child("scratchOrgResume"),
107367
107405
  scratchOrgCache_12.ScratchOrgCache.create(),
@@ -107378,8 +107416,7 @@ var require_scratchOrgCreate = __commonJS({
107378
107416
  logger.debug(`resuming org create with LoginUrl override= ${signupTargetLoginUrl}`);
107379
107417
  }
107380
107418
  const hubOrg = await org_12.Org.create({ aliasOrUsername: hubUsername });
107381
- const soi = await (0, scratchOrgInfoApi_1.queryScratchOrgInfo)(hubOrg, jobId);
107382
- await (0, scratchOrgErrorCodes_1.validateScratchOrgInfoForResume)({ jobId, scratchOrgInfo: soi, cache, hubUsername });
107419
+ const soi = await (0, scratchOrgErrorCodes_1.validateScratchOrgInfoForResume)({ jobId, hubOrg, cache, hubUsername, timeout });
107383
107420
  const username = soi.Username ?? soi.SignupUsername;
107384
107421
  const stateAggregator = await stateAggregator_12.StateAggregator.getInstance();
107385
107422
  const scratchOrgAuthInfo = await stateAggregator.orgs.exists(username) ? await authInfo_12.AuthInfo.create({ username }) : await (0, scratchOrgInfoApi_1.authorizeScratchOrg)({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/core-bundle",
3
- "version": "8.8.6",
3
+ "version": "8.9.0",
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",
@@ -37,7 +37,7 @@
37
37
  "messageTransformer/messageTransformer.ts"
38
38
  ],
39
39
  "dependencies": {
40
- "@jsforce/jsforce-node": "^3.6.5",
40
+ "@jsforce/jsforce-node": "^3.7.0",
41
41
  "@salesforce/kit": "^3.2.2",
42
42
  "@salesforce/schemas": "^1.9.0",
43
43
  "@salesforce/ts-types": "^2.0.10",