@salesforce/plugin-org 2.2.24 → 2.2.25
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/README.md +4 -0
- package/lib/commands/force/org/clone.d.ts +21 -9
- package/lib/commands/force/org/clone.js +50 -82
- package/lib/commands/force/org/clone.js.map +1 -1
- package/lib/commands/force/org/create.d.ts +27 -12
- package/lib/commands/force/org/create.js +85 -105
- package/lib/commands/force/org/create.js.map +1 -1
- package/lib/commands/force/org/delete.d.ts +14 -7
- package/lib/commands/force/org/delete.js +26 -16
- package/lib/commands/force/org/delete.js.map +1 -1
- package/lib/commands/force/org/status.d.ts +18 -6
- package/lib/commands/force/org/status.js +43 -37
- package/lib/commands/force/org/status.js.map +1 -1
- package/lib/commands/org/create/sandbox.d.ts +40 -0
- package/lib/commands/org/create/sandbox.js +244 -0
- package/lib/commands/org/create/sandbox.js.map +1 -0
- package/lib/commands/org/create/scratch.d.ts +30 -0
- package/lib/commands/org/create/scratch.js +183 -0
- package/lib/commands/org/create/scratch.js.map +1 -0
- package/lib/commands/org/delete/sandbox.d.ts +18 -0
- package/lib/commands/org/delete/sandbox.js +59 -0
- package/lib/commands/org/delete/sandbox.js.map +1 -0
- package/lib/commands/org/delete/scratch.d.ts +18 -0
- package/lib/commands/org/delete/scratch.js +52 -0
- package/lib/commands/org/delete/scratch.js.map +1 -0
- package/lib/commands/org/display.d.ts +20 -0
- package/lib/commands/{force/org → org}/display.js +38 -27
- package/lib/commands/org/display.js.map +1 -0
- package/lib/commands/org/list.d.ts +26 -0
- package/lib/commands/org/list.js +192 -0
- package/lib/commands/org/list.js.map +1 -0
- package/lib/commands/org/open.d.ts +25 -0
- package/lib/commands/{force/org → org}/open.js +47 -33
- package/lib/commands/org/open.js.map +1 -0
- package/lib/commands/org/resume/sandbox.d.ts +26 -0
- package/lib/commands/org/resume/sandbox.js +199 -0
- package/lib/commands/org/resume/sandbox.js.map +1 -0
- package/lib/commands/org/resume/scratch.d.ts +14 -0
- package/lib/commands/org/resume/scratch.js +61 -0
- package/lib/commands/org/resume/scratch.js.map +1 -0
- package/lib/shared/orgHighlighter.d.ts +2 -2
- package/lib/shared/orgHighlighter.js +7 -5
- package/lib/shared/orgHighlighter.js.map +1 -1
- package/lib/shared/orgHooks.d.ts +24 -0
- package/lib/shared/orgHooks.js +9 -0
- package/lib/shared/orgHooks.js.map +1 -0
- package/lib/shared/orgListUtil.d.ts +15 -25
- package/lib/shared/orgListUtil.js +71 -81
- package/lib/shared/orgListUtil.js.map +1 -1
- package/lib/shared/orgTypes.d.ts +39 -11
- package/lib/shared/sandboxCommandBase.d.ts +33 -0
- package/lib/shared/sandboxCommandBase.js +168 -0
- package/lib/shared/sandboxCommandBase.js.map +1 -0
- package/lib/shared/sandboxProgress.d.ts +28 -0
- package/lib/shared/sandboxProgress.js +104 -0
- package/lib/shared/sandboxProgress.js.map +1 -0
- package/lib/shared/sandboxReporter.d.ts +1 -1
- package/lib/shared/sandboxRequest.d.ts +9 -0
- package/lib/shared/sandboxRequest.js +58 -0
- package/lib/shared/sandboxRequest.js.map +1 -0
- package/lib/shared/scratchOrgOutput.d.ts +9 -0
- package/lib/shared/scratchOrgOutput.js +47 -0
- package/lib/shared/scratchOrgOutput.js.map +1 -0
- package/lib/shared/stagedProgress.d.ts +33 -0
- package/lib/shared/stagedProgress.js +98 -0
- package/lib/shared/stagedProgress.js.map +1 -0
- package/lib/shared/timeUtils.d.ts +10 -0
- package/lib/shared/timeUtils.js +37 -0
- package/lib/shared/timeUtils.js.map +1 -0
- package/lib/shared/utils.d.ts +1 -1
- package/lib/shared/utils.js.map +1 -1
- package/messages/clone.md +67 -0
- package/messages/create.md +125 -0
- package/messages/create.sandbox.md +123 -0
- package/messages/create_scratch.md +109 -0
- package/messages/delete.md +47 -0
- package/messages/delete_sandbox.md +46 -0
- package/messages/delete_scratch.md +42 -0
- package/messages/display.md +33 -0
- package/messages/list.md +65 -0
- package/messages/messages.md +81 -0
- package/messages/open.md +63 -0
- package/messages/resume.sandbox.md +71 -0
- package/messages/resume_scratch.md +41 -0
- package/messages/sandboxbase.md +17 -0
- package/messages/status.md +33 -0
- package/oclif.manifest.json +1194 -1
- package/package.json +136 -26
- package/lib/commands/force/org/display.d.ts +0 -11
- package/lib/commands/force/org/display.js.map +0 -1
- package/lib/commands/force/org/list.d.ts +0 -15
- package/lib/commands/force/org/list.js +0 -191
- package/lib/commands/force/org/list.js.map +0 -1
- package/lib/commands/force/org/open.d.ts +0 -15
- package/lib/commands/force/org/open.js.map +0 -1
- package/messages/clone.json +0 -24
- package/messages/create.json +0 -37
- package/messages/delete.json +0 -13
- package/messages/display.json +0 -11
- package/messages/list.json +0 -19
- package/messages/messages.json +0 -24
- package/messages/open.json +0 -19
- package/messages/status.json +0 -13
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Licensed under the BSD 3-Clause license.
|
|
6
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
const node_assert_1 = require("node:assert");
|
|
10
|
+
const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
|
11
|
+
const core_1 = require("@salesforce/core");
|
|
12
|
+
const scratchOrgOutput_1 = require("../../../shared/scratchOrgOutput");
|
|
13
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
14
|
+
const messages = core_1.Messages.loadMessages('@salesforce/plugin-org', 'resume_scratch');
|
|
15
|
+
class EnvResumeScratch extends sf_plugins_core_1.SfCommand {
|
|
16
|
+
async run() {
|
|
17
|
+
const { flags } = await this.parse(EnvResumeScratch);
|
|
18
|
+
const cache = await core_1.ScratchOrgCache.create();
|
|
19
|
+
const lifecycle = core_1.Lifecycle.getInstance();
|
|
20
|
+
const jobId = flags['use-most-recent'] ? cache.getLatestKey() : flags['job-id'];
|
|
21
|
+
if (!jobId && flags['use-most-recent'])
|
|
22
|
+
throw messages.createError('error.NoRecentJobId');
|
|
23
|
+
// oclif doesn't know that the exactlyOne flag will ensure that one of these is set, and there we definitely have a jobID.
|
|
24
|
+
(0, node_assert_1.strict)(jobId);
|
|
25
|
+
const { hubBaseUrl } = cache.get(jobId);
|
|
26
|
+
let lastStatus;
|
|
27
|
+
lifecycle.on(core_1.scratchOrgLifecycleEventName, async (data) => {
|
|
28
|
+
lastStatus = (0, scratchOrgOutput_1.buildStatus)(data, hubBaseUrl);
|
|
29
|
+
this.spinner.status = lastStatus;
|
|
30
|
+
return Promise.resolve();
|
|
31
|
+
});
|
|
32
|
+
this.log();
|
|
33
|
+
this.spinner.start('Creating Scratch Org');
|
|
34
|
+
const { username, scratchOrgInfo, authFields, warnings } = await (0, core_1.scratchOrgResume)(jobId);
|
|
35
|
+
this.spinner.stop(lastStatus);
|
|
36
|
+
this.log();
|
|
37
|
+
this.logSuccess(messages.getMessage('success'));
|
|
38
|
+
return { username, scratchOrgInfo, authFields, warnings, orgId: scratchOrgInfo?.Id };
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.default = EnvResumeScratch;
|
|
42
|
+
EnvResumeScratch.summary = messages.getMessage('summary');
|
|
43
|
+
EnvResumeScratch.description = messages.getMessage('description');
|
|
44
|
+
EnvResumeScratch.examples = messages.getMessages('examples');
|
|
45
|
+
EnvResumeScratch.aliases = ['env:resume:scratch'];
|
|
46
|
+
EnvResumeScratch.deprecateAliases = true;
|
|
47
|
+
EnvResumeScratch.flags = {
|
|
48
|
+
'job-id': sf_plugins_core_1.Flags.salesforceId({
|
|
49
|
+
char: 'i',
|
|
50
|
+
summary: messages.getMessage('flags.job-id.summary'),
|
|
51
|
+
description: messages.getMessage('flags.job-id.description'),
|
|
52
|
+
exactlyOne: ['use-most-recent', 'job-id'],
|
|
53
|
+
startsWith: '2SR',
|
|
54
|
+
}),
|
|
55
|
+
'use-most-recent': sf_plugins_core_1.Flags.boolean({
|
|
56
|
+
char: 'r',
|
|
57
|
+
summary: messages.getMessage('flags.use-most-recent.summary'),
|
|
58
|
+
exactlyOne: ['use-most-recent', 'job-id'],
|
|
59
|
+
}),
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=scratch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scratch.js","sourceRoot":"","sources":["../../../../src/commands/org/resume/scratch.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,6CAA+C;AAC/C,iEAA+D;AAC/D,2CAO0B;AAE1B,uEAA+D;AAE/D,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,wBAAwB,EAAE,gBAAgB,CAAC,CAAC;AAEnF,MAAqB,gBAAiB,SAAQ,2BAAgC;IAqBrE,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QACrD,MAAM,KAAK,GAAG,MAAM,sBAAe,CAAC,MAAM,EAAE,CAAC;QAC7C,MAAM,SAAS,GAAG,gBAAS,CAAC,WAAW,EAAE,CAAC;QAE1C,MAAM,KAAK,GAAG,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChF,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,iBAAiB,CAAC;YAAE,MAAM,QAAQ,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC;QAE1F,0HAA0H;QAC1H,IAAA,oBAAM,EAAC,KAAK,CAAC,CAAC;QACd,MAAM,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACxC,IAAI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;QACpD,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,0BAA0B,CAAC;QAC5D,UAAU,EAAE,CAAC,iBAAiB,EAAE,QAAQ,CAAC;QACzC,UAAU,EAAE,KAAK;KAClB,CAAC;IACF,iBAAiB,EAAE,uBAAK,CAAC,OAAO,CAAC;QAC/B,IAAI,EAAE,GAAG;QACT,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,+BAA+B,CAAC;QAC7D,UAAU,EAAE,CAAC,iBAAiB,EAAE,QAAQ,CAAC;KAC1C,CAAC;CACH,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ExtendedAuthFields } from './orgTypes';
|
|
1
|
+
import { ExtendedAuthFields, FullyPopulatedScratchOrgFields } from './orgTypes';
|
|
2
2
|
export declare const getStyledValue: (key: string, value: string) => string;
|
|
3
|
-
export declare const getStyledObject: (objectToStyle: ExtendedAuthFields) =>
|
|
3
|
+
export declare const getStyledObject: (objectToStyle: ExtendedAuthFields | FullyPopulatedScratchOrgFields | Record<string, string>) => Record<string, string>;
|
|
@@ -25,12 +25,14 @@ const styledProperties = new Map([
|
|
|
25
25
|
],
|
|
26
26
|
]);
|
|
27
27
|
const getStyledValue = (key, value) => {
|
|
28
|
-
if (!value
|
|
28
|
+
if (!value)
|
|
29
29
|
return value;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
const prop = styledProperties.get(key);
|
|
31
|
+
if (!prop)
|
|
32
|
+
return value;
|
|
33
|
+
// I'm not sure how to type the inner Map so that it knows else is definitely there
|
|
34
|
+
const chalkMethod = prop.get(value) ?? prop.get('else');
|
|
35
|
+
return chalkMethod(value);
|
|
34
36
|
};
|
|
35
37
|
exports.getStyledValue = getStyledValue;
|
|
36
38
|
const getStyledObject = (objectToStyle) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orgHighlighter.js","sourceRoot":"","sources":["../../src/shared/orgHighlighter.ts"],"names":[],"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AK,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,IAAA,sBAAc,EAAC,GAAG,EAAE,KAAe,CAAC,CAAC,CAAC,CAChG,CAAC;AACJ,CAAC,CAAC;AAPW,QAAA,eAAe,mBAO1B"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Optional } from '@salesforce/ts-types';
|
|
2
|
+
import { AuthFields } from '@salesforce/core';
|
|
3
|
+
import { Command, Hook, Hooks } from '@oclif/core/lib/interfaces';
|
|
4
|
+
type HookOpts<T> = {
|
|
5
|
+
options: {
|
|
6
|
+
Command: Command.Class;
|
|
7
|
+
argv: string[];
|
|
8
|
+
commandId: string;
|
|
9
|
+
};
|
|
10
|
+
return: Optional<T>;
|
|
11
|
+
};
|
|
12
|
+
export type OrgCreateResult = Pick<AuthFields, 'accessToken' | 'clientId' | 'created' | 'createdOrgInstance' | 'devHubUsername' | 'expirationDate' | 'instanceUrl' | 'loginUrl' | 'orgId' | 'username'>;
|
|
13
|
+
type PostOrgCreateOpts = HookOpts<OrgCreateResult>;
|
|
14
|
+
/**
|
|
15
|
+
* Extends OCLIF's Hooks interface to add types for hooks that run on org commands
|
|
16
|
+
*/
|
|
17
|
+
export interface OrgHooks extends Hooks {
|
|
18
|
+
postorgcreate: PostOrgCreateOpts;
|
|
19
|
+
}
|
|
20
|
+
export type OrgHook<T> = (this: Hook.Context, options: T extends keyof Hooks ? OrgHooks[T] : T) => any;
|
|
21
|
+
export declare namespace OrgHook {
|
|
22
|
+
type PostOrgCreate = Hook<OrgHooks['postorgcreate']>;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2021, salesforce.com, inc.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Licensed under the BSD 3-Clause license.
|
|
6
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
//# sourceMappingURL=orgHooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orgHooks.js","sourceRoot":"","sources":["../../src/shared/orgHooks.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { AuthInfo,
|
|
2
|
-
import { Dictionary
|
|
1
|
+
import { AuthInfo, Logger } from '@salesforce/core';
|
|
2
|
+
import { Dictionary } from '@salesforce/ts-types';
|
|
3
3
|
import { Record } from 'jsforce';
|
|
4
|
-
import { ScratchOrgInfoSObject, ExtendedAuthFields } from './orgTypes';
|
|
4
|
+
import { ScratchOrgInfoSObject, ExtendedAuthFields, ExtendedAuthFieldsScratch, FullyPopulatedScratchOrgFields } from './orgTypes';
|
|
5
5
|
type OrgGroups = {
|
|
6
6
|
nonScratchOrgs: ExtendedAuthFields[];
|
|
7
|
-
scratchOrgs:
|
|
7
|
+
scratchOrgs: ExtendedAuthFieldsScratch[];
|
|
8
8
|
};
|
|
9
|
-
type
|
|
9
|
+
type OrgGroupsFullyPopulated = {
|
|
10
|
+
nonScratchOrgs: ExtendedAuthFields[];
|
|
11
|
+
scratchOrgs: FullyPopulatedScratchOrgFields[];
|
|
12
|
+
};
|
|
13
|
+
type ExtendedScratchOrgInfo = Record & ScratchOrgInfoSObject & {
|
|
10
14
|
devHubOrgId: string;
|
|
11
|
-
attributes: {
|
|
12
|
-
type: string;
|
|
13
|
-
url: string;
|
|
14
|
-
};
|
|
15
15
|
};
|
|
16
16
|
export declare class OrgListUtil {
|
|
17
17
|
private static logger;
|
|
@@ -24,14 +24,14 @@ export declare class OrgListUtil {
|
|
|
24
24
|
* @param {string[]|null} userFilenames- an array of strings that are validated against the server.
|
|
25
25
|
* @param {object} flags - the result of this.flags on an sfdx command
|
|
26
26
|
*/
|
|
27
|
-
static readLocallyValidatedMetaConfigsGroupedByOrgType(userFilenames: string[], flags: Dictionary<string | boolean>): Promise<
|
|
27
|
+
static readLocallyValidatedMetaConfigsGroupedByOrgType(userFilenames: string[], flags: Dictionary<string | boolean>): Promise<OrgGroupsFullyPopulated>;
|
|
28
28
|
/**
|
|
29
29
|
* Organizes the scratchOrgs by DevHub to optimize calls to retrieveScratchOrgInfoFromDevHub(), then calls reduceScratchOrgInfo()
|
|
30
30
|
*
|
|
31
31
|
* @param {ExtendedAuthFields[]} scratchOrgs- an array of strings that are validated against the server.
|
|
32
32
|
* @returns the same scratch org list, but with updated information from the server.
|
|
33
33
|
*/
|
|
34
|
-
static processScratchOrgs(scratchOrgs:
|
|
34
|
+
static processScratchOrgs(scratchOrgs: ExtendedAuthFieldsScratch[]): Promise<FullyPopulatedScratchOrgFields[]>;
|
|
35
35
|
/**
|
|
36
36
|
* Used to retrieve authInfo of the auth files
|
|
37
37
|
*
|
|
@@ -47,18 +47,8 @@ export declare class OrgListUtil {
|
|
|
47
47
|
* @private
|
|
48
48
|
*/
|
|
49
49
|
static groupOrgs(authInfos: AuthInfo[]): Promise<OrgGroups>;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
*
|
|
53
|
-
* @param {*} config - scratch org auth object.
|
|
54
|
-
* @param {string[]} properties - properties to exclude ex ['refreshToken', 'clientSecret']
|
|
55
|
-
* @returns the config less the sensitive information.
|
|
56
|
-
*/
|
|
57
|
-
static removeRestrictedInfoFromConfig(config: AuthFields, properties?: string[]): AuthFields;
|
|
58
|
-
/** Identify the default orgs */
|
|
59
|
-
static identifyDefaultOrgs(orgInfo: ExtendedAuthFields, config: JsonMap): void;
|
|
60
|
-
static retrieveScratchOrgInfoFromDevHub(devHubUsername: string, orgIdsToQuery: string[]): Promise<Array<Partial<Record> & ExtendedScratchOrgInfo>>;
|
|
61
|
-
static reduceScratchOrgInfo(updatedContents: Array<Partial<Record> & ExtendedScratchOrgInfo>, orgs: ExtendedAuthFields[]): Promise<ExtendedAuthFields[]>;
|
|
50
|
+
static retrieveScratchOrgInfoFromDevHub(devHubUsername: string, orgIdsToQuery: string[]): Promise<ExtendedScratchOrgInfo[]>;
|
|
51
|
+
static reduceScratchOrgInfo(updatedContents: Array<Partial<Record> & ExtendedScratchOrgInfo>, orgs: ExtendedAuthFieldsScratch[]): Promise<FullyPopulatedScratchOrgFields[]>;
|
|
62
52
|
/**
|
|
63
53
|
* Asks the org if it's a devHub. Because the dev hub setting can't be deactivated, only ask orgs that aren't already stored as hubs.
|
|
64
54
|
* This has a number of side effects, including updating the AuthInfo files and
|
|
@@ -73,7 +63,7 @@ export declare class OrgListUtil {
|
|
|
73
63
|
* @param username The username used when the org was authenticated
|
|
74
64
|
* @returns {Promise.<string>}
|
|
75
65
|
*/
|
|
76
|
-
static determineConnectedStatusForNonScratchOrg(username: string): Promise<string>;
|
|
66
|
+
static determineConnectedStatusForNonScratchOrg(username: string): Promise<string | undefined>;
|
|
77
67
|
}
|
|
78
|
-
export declare const identifyActiveOrgByStatus: (org:
|
|
68
|
+
export declare const identifyActiveOrgByStatus: (org: FullyPopulatedScratchOrgFields) => boolean;
|
|
79
69
|
export {};
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.identifyActiveOrgByStatus = exports.OrgListUtil = void 0;
|
|
4
2
|
/*
|
|
5
3
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
6
4
|
* All rights reserved.
|
|
7
5
|
* Licensed under the BSD 3-Clause license.
|
|
8
6
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
9
7
|
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.identifyActiveOrgByStatus = exports.OrgListUtil = void 0;
|
|
10
10
|
const path_1 = require("path");
|
|
11
11
|
const fs = require("fs/promises");
|
|
12
12
|
const core_1 = require("@salesforce/core");
|
|
13
|
+
const ts_types_1 = require("@salesforce/ts-types");
|
|
13
14
|
const lib_1 = require("@salesforce/kit/lib");
|
|
14
15
|
const utils_1 = require("./utils");
|
|
15
16
|
class OrgListUtil {
|
|
@@ -33,7 +34,7 @@ class OrgListUtil {
|
|
|
33
34
|
// parallelize two very independent operations
|
|
34
35
|
const [nonScratchOrgs, scratchOrgs] = await Promise.all([
|
|
35
36
|
Promise.all(orgs.nonScratchOrgs.map(async (fields) => {
|
|
36
|
-
if (!flags.skipconnectionstatus) {
|
|
37
|
+
if (!flags.skipconnectionstatus && fields.username) {
|
|
37
38
|
// skip completely if we're skipping the connection
|
|
38
39
|
fields.connectedStatus = await OrgListUtil.determineConnectedStatusForNonScratchOrg(fields.username);
|
|
39
40
|
if (!fields.isDevHub && fields.connectedStatus === 'Connected') {
|
|
@@ -57,13 +58,11 @@ class OrgListUtil {
|
|
|
57
58
|
* @returns the same scratch org list, but with updated information from the server.
|
|
58
59
|
*/
|
|
59
60
|
static async processScratchOrgs(scratchOrgs) {
|
|
60
|
-
const orgIdsGroupedByDevHub =
|
|
61
|
-
|
|
62
|
-
.
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}, {});
|
|
66
|
-
const updatedContents = (await Promise.all(Object.entries(orgIdsGroupedByDevHub).map(async ([devHubUsername, orgIds]) => OrgListUtil.retrieveScratchOrgInfoFromDevHub(devHubUsername, orgIds)))).reduce((accumulator, iterator) => [...accumulator, ...iterator], []);
|
|
61
|
+
const orgIdsGroupedByDevHub = new Map();
|
|
62
|
+
scratchOrgs.forEach((fields) => {
|
|
63
|
+
orgIdsGroupedByDevHub.set(fields.devHubUsername, (orgIdsGroupedByDevHub.get(fields.devHubUsername) ?? []).concat([(0, core_1.trimTo15)(fields.orgId)]));
|
|
64
|
+
});
|
|
65
|
+
const updatedContents = (await Promise.all(Array.from(orgIdsGroupedByDevHub).map(([devHubUsername, orgIds]) => OrgListUtil.retrieveScratchOrgInfoFromDevHub(devHubUsername, orgIds)))).reduce((accumulator, iterator) => [...accumulator, ...iterator], []);
|
|
67
66
|
return OrgListUtil.reduceScratchOrgInfo(updatedContents, scratchOrgs);
|
|
68
67
|
}
|
|
69
68
|
/**
|
|
@@ -104,7 +103,7 @@ class OrgListUtil {
|
|
|
104
103
|
logger.warn(err.message);
|
|
105
104
|
}
|
|
106
105
|
}));
|
|
107
|
-
return allAuths.filter((
|
|
106
|
+
return allAuths.filter((ts_types_1.isObject));
|
|
108
107
|
}
|
|
109
108
|
/**
|
|
110
109
|
* Helper to group orgs by {scratchOrg, nonScratchOrgs}
|
|
@@ -115,58 +114,33 @@ class OrgListUtil {
|
|
|
115
114
|
* @private
|
|
116
115
|
*/
|
|
117
116
|
static async groupOrgs(authInfos) {
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
};
|
|
122
|
-
const config = (await core_1.SfdxConfigAggregator.create()).getConfig();
|
|
123
|
-
for (const authInfo of authInfos) {
|
|
117
|
+
const configAggregator = await core_1.SfdxConfigAggregator.create();
|
|
118
|
+
const results = await Promise.all(authInfos.map(async (authInfo) => {
|
|
119
|
+
// for (const authInfo of authInfos) {
|
|
124
120
|
let currentValue;
|
|
125
121
|
try {
|
|
126
|
-
|
|
122
|
+
// we're going to assert that these have a username/orgId because they came from the auth files
|
|
123
|
+
currentValue = removeRestrictedInfoFromConfig(authInfo.getFields(true));
|
|
127
124
|
}
|
|
128
125
|
catch (error) {
|
|
129
|
-
// eslint-disable-next-line no-await-in-loop
|
|
130
126
|
const logger = await OrgListUtil.retrieveLogger();
|
|
131
127
|
logger.warn(`Error decrypting ${authInfo.getUsername()}`);
|
|
132
|
-
currentValue =
|
|
128
|
+
currentValue = removeRestrictedInfoFromConfig(authInfo.getFields());
|
|
133
129
|
}
|
|
134
|
-
// eslint-disable-next-line no-await-in-loop
|
|
135
130
|
const [alias, lastUsed] = await Promise.all([
|
|
136
131
|
(0, utils_1.getAliasByUsername)(currentValue.username),
|
|
137
132
|
fs.stat((0, path_1.join)(core_1.Global.SFDX_DIR, `${currentValue.username}.json`)),
|
|
138
133
|
]);
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
return output;
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Helper utility to remove sensitive information from a scratch org auth config. By default refreshTokens and client secrets are removed.
|
|
153
|
-
*
|
|
154
|
-
* @param {*} config - scratch org auth object.
|
|
155
|
-
* @param {string[]} properties - properties to exclude ex ['refreshToken', 'clientSecret']
|
|
156
|
-
* @returns the config less the sensitive information.
|
|
157
|
-
*/
|
|
158
|
-
static removeRestrictedInfoFromConfig(config, properties = ['refreshToken', 'clientSecret']) {
|
|
159
|
-
return (0, lib_1.omit)(config, properties);
|
|
160
|
-
}
|
|
161
|
-
/** Identify the default orgs */
|
|
162
|
-
static identifyDefaultOrgs(orgInfo, config) {
|
|
163
|
-
if (config['target-org'] && (orgInfo.username === config['target-org'] || orgInfo.alias === config['target-org'])) {
|
|
164
|
-
orgInfo.isDefaultUsername = true;
|
|
165
|
-
}
|
|
166
|
-
else if (config['target-dev-hub'] &&
|
|
167
|
-
(orgInfo.username === config['target-dev-hub'] || orgInfo.alias === config['target-dev-hub'])) {
|
|
168
|
-
orgInfo.isDefaultDevHubUsername = true;
|
|
169
|
-
}
|
|
134
|
+
return {
|
|
135
|
+
...identifyDefaultOrgs({ ...currentValue, alias }, configAggregator),
|
|
136
|
+
lastUsed: lastUsed.atime,
|
|
137
|
+
alias,
|
|
138
|
+
};
|
|
139
|
+
}));
|
|
140
|
+
return {
|
|
141
|
+
scratchOrgs: results.filter((result) => 'expirationDate' in result),
|
|
142
|
+
nonScratchOrgs: results.filter((result) => !('expirationDate' in result)),
|
|
143
|
+
};
|
|
170
144
|
}
|
|
171
145
|
static async retrieveScratchOrgInfoFromDevHub(devHubUsername, orgIdsToQuery) {
|
|
172
146
|
const fields = [
|
|
@@ -197,35 +171,33 @@ class OrgListUtil {
|
|
|
197
171
|
}
|
|
198
172
|
}
|
|
199
173
|
static async reduceScratchOrgInfo(updatedContents, orgs) {
|
|
200
|
-
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
scratchOrgInfo.
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
logger.warn(`Can't find ${scratchOrgInfo.username} in the updated contents`);
|
|
226
|
-
}
|
|
174
|
+
const contentMap = new Map(updatedContents.map((org) => [org.SignupUsername, org]));
|
|
175
|
+
const results = orgs.map((scratchOrgInfo) => {
|
|
176
|
+
const updatedOrgInfo = contentMap.get(scratchOrgInfo.username);
|
|
177
|
+
return updatedOrgInfo
|
|
178
|
+
? {
|
|
179
|
+
...scratchOrgInfo,
|
|
180
|
+
signupUsername: updatedOrgInfo.SignupUsername,
|
|
181
|
+
createdBy: updatedOrgInfo.CreatedBy.Username,
|
|
182
|
+
createdDate: updatedOrgInfo.CreatedDate,
|
|
183
|
+
devHubOrgId: updatedOrgInfo.devHubOrgId,
|
|
184
|
+
devHubId: updatedOrgInfo.devHubOrgId,
|
|
185
|
+
attributes: updatedOrgInfo.attributes,
|
|
186
|
+
orgName: updatedOrgInfo.OrgName,
|
|
187
|
+
edition: updatedOrgInfo.Edition,
|
|
188
|
+
status: updatedOrgInfo.Status,
|
|
189
|
+
expirationDate: updatedOrgInfo.ExpirationDate,
|
|
190
|
+
isExpired: updatedOrgInfo.Status === 'Deleted',
|
|
191
|
+
namespace: updatedOrgInfo.Namespace,
|
|
192
|
+
}
|
|
193
|
+
: `Can't find ${scratchOrgInfo.username} in the updated contents`;
|
|
194
|
+
});
|
|
195
|
+
const warnings = results.filter((result) => typeof result === 'string');
|
|
196
|
+
if (warnings.length) {
|
|
197
|
+
const logger = await OrgListUtil.retrieveLogger();
|
|
198
|
+
warnings.forEach((warning) => logger.warn(warning));
|
|
227
199
|
}
|
|
228
|
-
return
|
|
200
|
+
return results.filter((result) => typeof result !== 'string');
|
|
229
201
|
}
|
|
230
202
|
/**
|
|
231
203
|
* Asks the org if it's a devHub. Because the dev hub setting can't be deactivated, only ask orgs that aren't already stored as hubs.
|
|
@@ -278,6 +250,24 @@ class OrgListUtil {
|
|
|
278
250
|
}
|
|
279
251
|
}
|
|
280
252
|
exports.OrgListUtil = OrgListUtil;
|
|
281
|
-
const identifyActiveOrgByStatus = (org) => org.status === 'Active';
|
|
253
|
+
const identifyActiveOrgByStatus = (org) => 'status' in org && org.status === 'Active';
|
|
282
254
|
exports.identifyActiveOrgByStatus = identifyActiveOrgByStatus;
|
|
255
|
+
/** Identify the default orgs */
|
|
256
|
+
const identifyDefaultOrgs = (orgInfo, config) => {
|
|
257
|
+
// remove undefined, since the config might also be undefined
|
|
258
|
+
const possibleDefaults = [orgInfo.alias, orgInfo.username].filter(Boolean);
|
|
259
|
+
return {
|
|
260
|
+
...orgInfo,
|
|
261
|
+
isDefaultDevHubUsername: possibleDefaults.includes(config.getPropertyValue(core_1.OrgConfigProperties.TARGET_DEV_HUB)),
|
|
262
|
+
isDefaultUsername: possibleDefaults.includes(config.getPropertyValue(core_1.OrgConfigProperties.TARGET_ORG)),
|
|
263
|
+
};
|
|
264
|
+
};
|
|
265
|
+
/**
|
|
266
|
+
* Helper utility to remove sensitive information from a scratch org auth config. By default refreshTokens and client secrets are removed.
|
|
267
|
+
*
|
|
268
|
+
* @param {*} config - scratch org auth object.
|
|
269
|
+
* @param {string[]} properties - properties to exclude ex ['refreshToken', 'clientSecret']
|
|
270
|
+
* @returns the config less the sensitive information.
|
|
271
|
+
*/
|
|
272
|
+
const removeRestrictedInfoFromConfig = (config, properties = ['refreshToken', 'clientSecret']) => (0, lib_1.omit)(config, properties);
|
|
283
273
|
//# sourceMappingURL=orgListUtil.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orgListUtil.js","sourceRoot":"","sources":["../../src/shared/orgListUtil.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"orgListUtil.js","sourceRoot":"","sources":["../../src/shared/orgListUtil.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,+BAAsC;AACtC,kCAAkC;AAElC,2CAU0B;AAC1B,mDAA4D;AAE5D,6CAA2C;AAC3C,mCAA6C;AAyB7C,MAAa,WAAW;IAGf,MAAM,CAAC,KAAK,CAAC,cAAc;QAChC,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE;YACvB,WAAW,CAAC,MAAM,GAAG,MAAM,aAAM,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;SACxD;QACD,OAAO,WAAW,CAAC,MAAM,CAAC;IAC5B,CAAC;IAED;;;;;;;OAOG;IACI,MAAM,CAAC,KAAK,CAAC,+CAA+C,CACjE,aAAuB,EACvB,KAAmC;QAEnC,MAAM,QAAQ,GAAe,MAAM,WAAW,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;QAC5E,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAEnD,8CAA8C;QAC9C,MAAM,CAAC,cAAc,EAAE,WAAW,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YACtD,OAAO,CAAC,GAAG,CACT,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;gBACvC,IAAI,CAAC,KAAK,CAAC,oBAAoB,IAAI,MAAM,CAAC,QAAQ,EAAE;oBAClD,mDAAmD;oBACnD,MAAM,CAAC,eAAe,GAAG,MAAM,WAAW,CAAC,wCAAwC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;oBACrG,IAAI,CAAC,MAAM,CAAC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AAmB,CAAC,UAAU,CAAC,CAAC;KACtG,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,8BAA8B,GAAG,CACrC,MAAwB,EACxB,aAAuB,CAAC,cAAc,EAAE,cAAc,CAAC,EACrC,EAAE,CAAC,IAAA,UAAI,EAA0D,MAAM,EAAE,UAAU,CAAC,CAAC"}
|
package/lib/shared/orgTypes.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AuthFields } from '@salesforce/core';
|
|
1
|
+
import { AuthFields, ScratchOrgInfo } from '@salesforce/core';
|
|
2
2
|
import { Dictionary } from '@salesforce/ts-types';
|
|
3
|
-
export
|
|
3
|
+
export type OrgDisplayReturn = Partial<ScratchOrgFields> & {
|
|
4
4
|
username: string;
|
|
5
5
|
id: string;
|
|
6
6
|
accessToken: string;
|
|
@@ -10,14 +10,29 @@ export interface OrgDisplayReturn extends Partial<ScratchOrgFields> {
|
|
|
10
10
|
password?: string;
|
|
11
11
|
connectedStatus?: string;
|
|
12
12
|
sfdxAuthUrl?: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
};
|
|
14
|
+
/** Convenience type for the fields that are in the auth file
|
|
15
|
+
*
|
|
16
|
+
* core's AuthFields has everything as optional.
|
|
17
|
+
*
|
|
18
|
+
* In this case, we have a username because these come from auth files */
|
|
19
|
+
export type AuthFieldsFromFS = Omit<AuthFields, 'expirationDate'> & {
|
|
20
|
+
username: string;
|
|
21
|
+
orgId: string;
|
|
22
|
+
accessToken: string;
|
|
23
|
+
instanceUrl: string;
|
|
24
|
+
clientId: string;
|
|
25
|
+
string: string;
|
|
26
|
+
};
|
|
27
|
+
export type ExtendedAuthFields = AuthFieldsFromFS & OrgListFields;
|
|
28
|
+
export type ExtendedAuthFieldsScratch = ExtendedAuthFields & {
|
|
29
|
+
expirationDate: string;
|
|
30
|
+
devHubUsername: string;
|
|
16
31
|
devHubOrgId?: string;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
32
|
+
};
|
|
33
|
+
export type FullyPopulatedScratchOrgFields = ScratchOrgFields & ExtendedAuthFieldsScratch & {
|
|
34
|
+
isExpired: boolean;
|
|
35
|
+
};
|
|
21
36
|
export interface ScratchOrgInfoSObject {
|
|
22
37
|
Id: string;
|
|
23
38
|
CreatedDate: string;
|
|
@@ -28,23 +43,36 @@ export interface ScratchOrgInfoSObject {
|
|
|
28
43
|
};
|
|
29
44
|
Edition: string;
|
|
30
45
|
Namespace?: string;
|
|
31
|
-
OrgName
|
|
46
|
+
OrgName: string;
|
|
32
47
|
SignupUsername: string;
|
|
33
48
|
}
|
|
49
|
+
/** fields in the */
|
|
34
50
|
export interface ScratchOrgFields {
|
|
35
51
|
createdBy: string;
|
|
36
52
|
createdDate: string;
|
|
37
53
|
expirationDate: string;
|
|
38
54
|
orgName: string;
|
|
39
55
|
status: string;
|
|
40
|
-
devHubId
|
|
56
|
+
devHubId: string;
|
|
41
57
|
edition?: string;
|
|
42
58
|
namespace?: string;
|
|
43
59
|
snapshot?: string;
|
|
44
60
|
lastUsed?: Date;
|
|
61
|
+
signupUsername: string;
|
|
45
62
|
}
|
|
46
63
|
export interface OrgListFields {
|
|
64
|
+
connectedStatus?: string;
|
|
47
65
|
isDefaultUsername?: boolean;
|
|
48
66
|
isDefaultDevHubUsername?: boolean;
|
|
49
67
|
defaultMarker?: '(D)' | '(U)';
|
|
68
|
+
attributes?: Dictionary<unknown>;
|
|
69
|
+
lastUsed?: Date;
|
|
70
|
+
}
|
|
71
|
+
/** If the scratch org is resumed, but doesn't get very far in the process, it won't have much information on it */
|
|
72
|
+
export interface ScratchCreateResponse {
|
|
73
|
+
username?: string;
|
|
74
|
+
scratchOrgInfo?: ScratchOrgInfo;
|
|
75
|
+
authFields?: AuthFields;
|
|
76
|
+
warnings: string[];
|
|
77
|
+
orgId?: string;
|
|
50
78
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
import { Config } from '@oclif/core';
|
|
3
|
+
import { Lifecycle, Org, ResultEvent, SandboxProcessObject, SandboxRequestCache, SandboxRequestCacheEntry, SandboxUserAuthResponse, StatusEvent } from '@salesforce/core';
|
|
4
|
+
import { SandboxProgress } from './sandboxProgress';
|
|
5
|
+
import { State } from './stagedProgress';
|
|
6
|
+
export declare abstract class SandboxCommandBase<T> extends SfCommand<T> {
|
|
7
|
+
protected sandboxProgress: SandboxProgress;
|
|
8
|
+
protected latestSandboxProgressObj?: SandboxProcessObject;
|
|
9
|
+
protected sandboxAuth?: SandboxUserAuthResponse;
|
|
10
|
+
protected prodOrg?: Org;
|
|
11
|
+
protected pollingTimeOut: boolean;
|
|
12
|
+
protected sandboxRequestConfig: SandboxRequestCache;
|
|
13
|
+
protected sandboxRequestData: SandboxRequestCacheEntry | undefined;
|
|
14
|
+
constructor(argv: string[], config: Config);
|
|
15
|
+
protected getSandboxRequestConfig(): Promise<SandboxRequestCache>;
|
|
16
|
+
protected calculateTrackingSetting(tracking?: boolean): Promise<boolean>;
|
|
17
|
+
protected registerLifecycleListeners(lifecycle: Lifecycle, options: {
|
|
18
|
+
isAsync: boolean;
|
|
19
|
+
alias?: string;
|
|
20
|
+
setDefault: boolean;
|
|
21
|
+
prodOrg?: Org;
|
|
22
|
+
tracksSource?: boolean;
|
|
23
|
+
}): void;
|
|
24
|
+
protected reportResults(results: ResultEvent): void;
|
|
25
|
+
protected updateProgress(event: StatusEvent | (Omit<ResultEvent, 'sandboxRes'> & {
|
|
26
|
+
sandboxRes?: ResultEvent['sandboxRes'];
|
|
27
|
+
}), isAsync: boolean): void;
|
|
28
|
+
protected updateStage(stage: string | undefined, state: State): void;
|
|
29
|
+
protected updateSandboxRequestData(): void;
|
|
30
|
+
protected saveSandboxProgressConfig(): void;
|
|
31
|
+
private removeSandboxProgressConfig;
|
|
32
|
+
protected abstract getCheckSandboxStatusParams(): string[];
|
|
33
|
+
}
|