Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sm/org-create-with-alias #620

Merged
merged 7 commits into from
Jul 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ jobs:
shx rm -rf node_modules/@salesforce/kit
yarn build
working_directory: node_modules/@salesforce/core
- run:
name: any top-level jsforce1 modules
command: shx rm -rf node_modules/@types/jsforce
- run:
name: remove sf-plugins-core/core
# deletes sf-plugins-core/core to prevent ts conflicts
Expand Down
20 changes: 0 additions & 20 deletions messages/scratchOrgCreate.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,6 @@ Expected 'durationDays' to be an integer number.

Expected 'retry' to be an integer number.

# WaitValidationMaxError

Expected 'wait' greater than or equal to %s but received %s.

# 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.

# CacheMissError

The ScratchOrgInfoId %s was not found in the cache.

# StillInProgressError

The scratch org is not ready yet (Status = %).

# action.StillInProgress

Wait for a few minutes, and then try the <%= config.bin %> <%= command.id %> command again
16 changes: 16 additions & 0 deletions messages/scratchOrgErrorCodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,22 @@ See https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_ob

The request to create a scratch org returned an unexpected status

# StillInProgressError

The scratch org is not ready yet (Status = %).

# action.StillInProgress

Wait for a few minutes, and then try the <%= config.bin %> <%= command.id %> 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.
Expand Down
15 changes: 1 addition & 14 deletions src/org/org.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,20 +132,7 @@ export type ResumeSandboxRequest = {
SandboxProcessObjId?: string;
};

export type ScratchOrgRequest = Pick<
ScratchOrgCreateOptions,
| 'connectedAppConsumerKey'
| 'durationDays'
| 'nonamespace'
| 'noancestors'
| 'wait'
| 'retry'
| 'apiversion'
| 'definitionjson'
| 'definitionfile'
| 'orgConfig'
| 'clientSecret'
>;
export type ScratchOrgRequest = Omit<ScratchOrgCreateOptions, 'hubOrg'>;

export type SandboxFields = {
sandboxOrgId: string;
Expand Down
7 changes: 1 addition & 6 deletions src/org/scratchOrgCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,8 @@ const messages = Messages.load('@salesforce/core', 'scratchOrgCreate', [
'DurationDaysValidationMaxError',
'DurationDaysValidationMinError',
'RetryNotIntError',
'WaitValidationMaxError',
'DurationDaysNotIntError',
'NoScratchOrgInfoError',
'ScratchOrgDeletedError',
'StillInProgressError',
'CacheMissError',
'action.StillInProgress',
]);

export const DEFAULT_STREAM_TIMEOUT_MINUTES = 6;
Expand Down Expand Up @@ -88,7 +83,7 @@ export interface ScratchOrgCreateOptions {
alias?: string;
/** after complete, set the org as the default */
setDefault?: boolean;
/** do not use source tracking for this org */
/** if false, do not use source tracking for this scratch org */
tracksSource?: boolean;
}

Expand Down
10 changes: 7 additions & 3 deletions src/org/scratchOrgErrorCodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ const namedMessages = Messages.load('@salesforce/core', 'scratchOrgErrorCodes',
'SignupFailedUnknownError',
'SignupFailedError',
'SignupUnexpectedError',
'StillInProgressError',
'action.StillInProgress',
'ScratchOrgDeletedError',
'NoScratchOrgInfoError',
]);

// getMessage will throw when the code isn't found
Expand Down Expand Up @@ -56,12 +60,12 @@ export const validateScratchOrgInfoForResume = async ({
cache.unset(jobId);
await cache.write();
throw scratchOrgInfo.Status === 'Deleted'
? messages.createError('ScratchOrgDeletedError')
: messages.createError('NoScratchOrgInfoError');
? namedMessages.createError('ScratchOrgDeletedError')
: namedMessages.createError('NoScratchOrgInfoError');
}
if (['New', 'Creating'].includes(scratchOrgInfo.Status)) {
// 2. scratchOrgInfo exists, still isn't finished. Stays in cache for future attempts
throw messages.createError('StillInProgressError', [scratchOrgInfo.Status], ['action.StillInProgress']);
throw namedMessages.createError('StillInProgressError', [scratchOrgInfo.Status], ['action.StillInProgress']);
}
return checkScratchOrgInfoForErrors(scratchOrgInfo, hubUsername);
};
Expand Down