@salesforce/core-bundle 8.8.7 → 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 +6 -3
- package/lib/index.js +41 -6
- package/package.json +1 -1
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
|
-
|
3853
|
+
import { Org } from '@salesforce/core-bundle/org/org';
|
3854
|
+
export const validateScratchOrgInfoForResume: ({ jobId, hubOrg, cache, hubUsername, timeout, }: {
|
3853
3855
|
jobId: string;
|
3854
|
-
|
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.
|
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",
|
@@ -94357,11 +94357,14 @@ var require_scratchOrgErrorCodes = __commonJS({
|
|
94357
94357
|
"use strict";
|
94358
94358
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
94359
94359
|
exports2.checkScratchOrgInfoForErrors = exports2.validateScratchOrgInfoForResume = void 0;
|
94360
|
+
var kit_1 = require_lib2();
|
94360
94361
|
var messages_12 = require_messages();
|
94361
94362
|
var sfError_12 = require_sfError();
|
94362
94363
|
var logger_12 = require_logger();
|
94364
|
+
var pollingClient_12 = require_pollingClient();
|
94363
94365
|
var scratchOrgCache_12 = require_scratchOrgCache();
|
94364
94366
|
var scratchOrgLifecycleEvents_12 = require_scratchOrgLifecycleEvents();
|
94367
|
+
var scratchOrgInfoApi_1 = require_scratchOrgInfoApi();
|
94365
94368
|
var WORKSPACE_CONFIG_FILENAME = "sfdx-project.json";
|
94366
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"]]));
|
94367
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"]]));
|
@@ -94376,14 +94379,47 @@ var require_scratchOrgErrorCodes = __commonJS({
|
|
94376
94379
|
return void 0;
|
94377
94380
|
}
|
94378
94381
|
};
|
94379
|
-
var validateScratchOrgInfoForResume = async ({ jobId,
|
94382
|
+
var validateScratchOrgInfoForResume = async ({ jobId, hubOrg, cache, hubUsername, timeout }) => {
|
94383
|
+
const scratchOrgInfo = await (0, scratchOrgInfoApi_1.queryScratchOrgInfo)(hubOrg, jobId);
|
94380
94384
|
if (!scratchOrgInfo?.Id || scratchOrgInfo.Status === "Deleted") {
|
94381
94385
|
cache.unset(jobId);
|
94382
94386
|
await cache.write();
|
94383
94387
|
throw scratchOrgInfo.Status === "Deleted" ? namedMessages.createError("ScratchOrgDeletedError") : namedMessages.createError("NoScratchOrgInfoError");
|
94384
94388
|
}
|
94385
94389
|
if (["New", "Creating"].includes(scratchOrgInfo.Status)) {
|
94386
|
-
|
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);
|
94387
94423
|
}
|
94388
94424
|
return (0, exports2.checkScratchOrgInfoForErrors)(scratchOrgInfo, hubUsername);
|
94389
94425
|
};
|
@@ -107363,7 +107399,7 @@ var require_scratchOrgCreate = __commonJS({
|
|
107363
107399
|
throw messages.createError("RetryNotIntError");
|
107364
107400
|
}
|
107365
107401
|
};
|
107366
|
-
var scratchOrgResume = async (jobId) => {
|
107402
|
+
var scratchOrgResume = async (jobId, timeout = kit_1.Duration.minutes(15)) => {
|
107367
107403
|
const [logger, cache] = await Promise.all([
|
107368
107404
|
logger_12.Logger.child("scratchOrgResume"),
|
107369
107405
|
scratchOrgCache_12.ScratchOrgCache.create(),
|
@@ -107380,8 +107416,7 @@ var require_scratchOrgCreate = __commonJS({
|
|
107380
107416
|
logger.debug(`resuming org create with LoginUrl override= ${signupTargetLoginUrl}`);
|
107381
107417
|
}
|
107382
107418
|
const hubOrg = await org_12.Org.create({ aliasOrUsername: hubUsername });
|
107383
|
-
const soi = await (0,
|
107384
|
-
await (0, scratchOrgErrorCodes_1.validateScratchOrgInfoForResume)({ jobId, scratchOrgInfo: soi, cache, hubUsername });
|
107419
|
+
const soi = await (0, scratchOrgErrorCodes_1.validateScratchOrgInfoForResume)({ jobId, hubOrg, cache, hubUsername, timeout });
|
107385
107420
|
const username = soi.Username ?? soi.SignupUsername;
|
107386
107421
|
const stateAggregator = await stateAggregator_12.StateAggregator.getInstance();
|
107387
107422
|
const scratchOrgAuthInfo = await stateAggregator.orgs.exists(username) ? await authInfo_12.AuthInfo.create({ username }) : await (0, scratchOrgInfoApi_1.authorizeScratchOrg)({
|