@salesforce/plugin-org 2.2.23 → 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.
Files changed (103) hide show
  1. package/README.md +4 -0
  2. package/lib/commands/force/org/clone.d.ts +21 -9
  3. package/lib/commands/force/org/clone.js +50 -82
  4. package/lib/commands/force/org/clone.js.map +1 -1
  5. package/lib/commands/force/org/create.d.ts +27 -12
  6. package/lib/commands/force/org/create.js +85 -105
  7. package/lib/commands/force/org/create.js.map +1 -1
  8. package/lib/commands/force/org/delete.d.ts +14 -7
  9. package/lib/commands/force/org/delete.js +26 -16
  10. package/lib/commands/force/org/delete.js.map +1 -1
  11. package/lib/commands/force/org/status.d.ts +18 -6
  12. package/lib/commands/force/org/status.js +43 -37
  13. package/lib/commands/force/org/status.js.map +1 -1
  14. package/lib/commands/org/create/sandbox.d.ts +40 -0
  15. package/lib/commands/org/create/sandbox.js +244 -0
  16. package/lib/commands/org/create/sandbox.js.map +1 -0
  17. package/lib/commands/org/create/scratch.d.ts +30 -0
  18. package/lib/commands/org/create/scratch.js +183 -0
  19. package/lib/commands/org/create/scratch.js.map +1 -0
  20. package/lib/commands/org/delete/sandbox.d.ts +18 -0
  21. package/lib/commands/org/delete/sandbox.js +59 -0
  22. package/lib/commands/org/delete/sandbox.js.map +1 -0
  23. package/lib/commands/org/delete/scratch.d.ts +18 -0
  24. package/lib/commands/org/delete/scratch.js +52 -0
  25. package/lib/commands/org/delete/scratch.js.map +1 -0
  26. package/lib/commands/org/display.d.ts +20 -0
  27. package/lib/commands/{force/org → org}/display.js +38 -27
  28. package/lib/commands/org/display.js.map +1 -0
  29. package/lib/commands/org/list.d.ts +26 -0
  30. package/lib/commands/org/list.js +192 -0
  31. package/lib/commands/org/list.js.map +1 -0
  32. package/lib/commands/org/open.d.ts +25 -0
  33. package/lib/commands/{force/org → org}/open.js +47 -33
  34. package/lib/commands/org/open.js.map +1 -0
  35. package/lib/commands/org/resume/sandbox.d.ts +26 -0
  36. package/lib/commands/org/resume/sandbox.js +199 -0
  37. package/lib/commands/org/resume/sandbox.js.map +1 -0
  38. package/lib/commands/org/resume/scratch.d.ts +14 -0
  39. package/lib/commands/org/resume/scratch.js +61 -0
  40. package/lib/commands/org/resume/scratch.js.map +1 -0
  41. package/lib/shared/orgHighlighter.d.ts +2 -2
  42. package/lib/shared/orgHighlighter.js +7 -5
  43. package/lib/shared/orgHighlighter.js.map +1 -1
  44. package/lib/shared/orgHooks.d.ts +24 -0
  45. package/lib/shared/orgHooks.js +9 -0
  46. package/lib/shared/orgHooks.js.map +1 -0
  47. package/lib/shared/orgListUtil.d.ts +15 -25
  48. package/lib/shared/orgListUtil.js +71 -81
  49. package/lib/shared/orgListUtil.js.map +1 -1
  50. package/lib/shared/orgTypes.d.ts +39 -11
  51. package/lib/shared/sandboxCommandBase.d.ts +33 -0
  52. package/lib/shared/sandboxCommandBase.js +168 -0
  53. package/lib/shared/sandboxCommandBase.js.map +1 -0
  54. package/lib/shared/sandboxProgress.d.ts +28 -0
  55. package/lib/shared/sandboxProgress.js +104 -0
  56. package/lib/shared/sandboxProgress.js.map +1 -0
  57. package/lib/shared/sandboxReporter.d.ts +1 -1
  58. package/lib/shared/sandboxRequest.d.ts +9 -0
  59. package/lib/shared/sandboxRequest.js +58 -0
  60. package/lib/shared/sandboxRequest.js.map +1 -0
  61. package/lib/shared/scratchOrgOutput.d.ts +9 -0
  62. package/lib/shared/scratchOrgOutput.js +47 -0
  63. package/lib/shared/scratchOrgOutput.js.map +1 -0
  64. package/lib/shared/stagedProgress.d.ts +33 -0
  65. package/lib/shared/stagedProgress.js +98 -0
  66. package/lib/shared/stagedProgress.js.map +1 -0
  67. package/lib/shared/timeUtils.d.ts +10 -0
  68. package/lib/shared/timeUtils.js +37 -0
  69. package/lib/shared/timeUtils.js.map +1 -0
  70. package/lib/shared/utils.d.ts +1 -1
  71. package/lib/shared/utils.js.map +1 -1
  72. package/messages/clone.md +67 -0
  73. package/messages/create.md +125 -0
  74. package/messages/create.sandbox.md +123 -0
  75. package/messages/create_scratch.md +109 -0
  76. package/messages/delete.md +47 -0
  77. package/messages/delete_sandbox.md +46 -0
  78. package/messages/delete_scratch.md +42 -0
  79. package/messages/display.md +33 -0
  80. package/messages/list.md +65 -0
  81. package/messages/messages.md +81 -0
  82. package/messages/open.md +63 -0
  83. package/messages/resume.sandbox.md +71 -0
  84. package/messages/resume_scratch.md +41 -0
  85. package/messages/sandboxbase.md +17 -0
  86. package/messages/status.md +33 -0
  87. package/oclif.manifest.json +1194 -1
  88. package/package.json +138 -28
  89. package/lib/commands/force/org/display.d.ts +0 -11
  90. package/lib/commands/force/org/display.js.map +0 -1
  91. package/lib/commands/force/org/list.d.ts +0 -15
  92. package/lib/commands/force/org/list.js +0 -191
  93. package/lib/commands/force/org/list.js.map +0 -1
  94. package/lib/commands/force/org/open.d.ts +0 -15
  95. package/lib/commands/force/org/open.js.map +0 -1
  96. package/messages/clone.json +0 -24
  97. package/messages/create.json +0 -37
  98. package/messages/delete.json +0 -13
  99. package/messages/display.json +0 -11
  100. package/messages/list.json +0 -19
  101. package/messages/messages.json +0 -24
  102. package/messages/open.json +0 -19
  103. package/messages/status.json +0 -13
@@ -0,0 +1,168 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SandboxCommandBase = void 0;
4
+ /*
5
+ * Copyright (c) 2020, salesforce.com, inc.
6
+ * All rights reserved.
7
+ * Licensed under the BSD 3-Clause license.
8
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
9
+ */
10
+ const os = require("os");
11
+ const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
12
+ const core_1 = require("@salesforce/core");
13
+ const sandboxProgress_1 = require("./sandboxProgress");
14
+ core_1.Messages.importMessagesDirectory(__dirname);
15
+ const messages = core_1.Messages.loadMessages('@salesforce/plugin-org', 'sandboxbase');
16
+ class SandboxCommandBase extends sf_plugins_core_1.SfCommand {
17
+ constructor(argv, config) {
18
+ super(argv, config);
19
+ this.pollingTimeOut = false;
20
+ this.sandboxProgress = new sandboxProgress_1.SandboxProgress();
21
+ }
22
+ async getSandboxRequestConfig() {
23
+ if (!this.sandboxRequestConfig) {
24
+ this.sandboxRequestConfig = await core_1.SandboxRequestCache.create();
25
+ }
26
+ return this.sandboxRequestConfig;
27
+ }
28
+ async calculateTrackingSetting(tracking = true) {
29
+ // sandbox types that don't support tracking
30
+ if (this.sandboxRequestData?.sandboxRequest.LicenseType &&
31
+ ['Partial', 'Full'].includes(this.sandboxRequestData.sandboxRequest.LicenseType)) {
32
+ return false;
33
+ }
34
+ // returns false for a sandbox type that supports it but user has opted out
35
+ if (tracking === false) {
36
+ return false;
37
+ }
38
+ // on a resume, we might not have a prod org...it's optional?
39
+ if (this.prodOrg) {
40
+ // if user hasn't opted out of tracking, and sandbox type supports it, verify that prod org supports tracking-enabled sandboxes
41
+ const sourceTrackingSettings = await this.prodOrg
42
+ .getConnection()
43
+ .metadata.read('SourceTrackingSettings', 'SourceTrackingSettings');
44
+ if (sourceTrackingSettings.enableSourceTrackingSandboxes !== true) {
45
+ return false;
46
+ }
47
+ }
48
+ // default for Dev/DevPro when prod org has feature enabled for sandboxes
49
+ return true;
50
+ }
51
+ registerLifecycleListeners(lifecycle, options) {
52
+ lifecycle.on('POLLING_TIME_OUT', async () => {
53
+ this.pollingTimeOut = true;
54
+ return Promise.resolve(this.updateSandboxRequestData());
55
+ });
56
+ lifecycle.on(core_1.SandboxEvents.EVENT_RESUME, async (results) => {
57
+ this.latestSandboxProgressObj = results;
58
+ this.sandboxProgress.markPreviousStagesAsCompleted(results.Status !== 'Completed' ? results.Status : 'Authenticating');
59
+ return Promise.resolve(this.updateSandboxRequestData());
60
+ });
61
+ lifecycle.on(core_1.SandboxEvents.EVENT_ASYNC_RESULT, async (results) => {
62
+ this.latestSandboxProgressObj = results ?? this.latestSandboxProgressObj;
63
+ this.updateSandboxRequestData();
64
+ if (!options.isAsync) {
65
+ this.spinner.stop();
66
+ }
67
+ // things that require data on latestSandboxProgressObj
68
+ if (this.latestSandboxProgressObj) {
69
+ const progress = this.sandboxProgress.getSandboxProgress({
70
+ sandboxProcessObj: this.latestSandboxProgressObj,
71
+ sandboxRes: undefined,
72
+ });
73
+ const currentStage = progress.status;
74
+ this.sandboxProgress.markPreviousStagesAsCompleted(currentStage);
75
+ this.updateStage(currentStage, 'inProgress');
76
+ this.updateProgress({ sandboxProcessObj: this.latestSandboxProgressObj, sandboxRes: undefined }, options.isAsync);
77
+ }
78
+ if (this.pollingTimeOut) {
79
+ this.warn(messages.getMessage('warning.ClientTimeoutWaitingForSandboxCreate'));
80
+ }
81
+ this.log(this.sandboxProgress.formatProgressStatus(false));
82
+ return Promise.resolve(this.info(messages.getMessage('checkSandboxStatus', this.getCheckSandboxStatusParams())));
83
+ });
84
+ lifecycle.on(core_1.SandboxEvents.EVENT_STATUS, async (results) => {
85
+ this.latestSandboxProgressObj = results.sandboxProcessObj;
86
+ this.updateSandboxRequestData();
87
+ const progress = this.sandboxProgress.getSandboxProgress(results);
88
+ const currentStage = progress.status;
89
+ this.updateStage(currentStage, 'inProgress');
90
+ return Promise.resolve(this.updateProgress(results, options.isAsync));
91
+ });
92
+ lifecycle.on(core_1.SandboxEvents.EVENT_AUTH, async (results) => {
93
+ this.sandboxAuth = results;
94
+ return Promise.resolve();
95
+ });
96
+ lifecycle.on(core_1.SandboxEvents.EVENT_RESULT, async (results) => {
97
+ this.latestSandboxProgressObj = results.sandboxProcessObj;
98
+ this.updateSandboxRequestData();
99
+ this.sandboxProgress.markPreviousStagesAsCompleted();
100
+ this.updateProgress(results, options.isAsync);
101
+ if (!options.isAsync) {
102
+ this.progress.stop();
103
+ }
104
+ if (results.sandboxRes?.authUserName) {
105
+ const authInfo = await core_1.AuthInfo.create({ username: results.sandboxRes?.authUserName });
106
+ await authInfo.handleAliasAndDefaultSettings({
107
+ alias: options.alias,
108
+ setDefault: options.setDefault,
109
+ setDefaultDevHub: false,
110
+ setTracksSource: await this.calculateTrackingSetting(options.tracksSource),
111
+ });
112
+ }
113
+ this.removeSandboxProgressConfig();
114
+ this.updateProgress(results, options.isAsync);
115
+ this.reportResults(results);
116
+ });
117
+ }
118
+ reportResults(results) {
119
+ this.log();
120
+ this.styledHeader('Sandbox Org Creation Status');
121
+ this.log(this.sandboxProgress.formatProgressStatus(false));
122
+ this.logSuccess([
123
+ messages.getMessage('sandboxSuccess'),
124
+ messages.getMessages('sandboxSuccess.actions', [
125
+ this.config.bin,
126
+ results.sandboxRes?.authUserName,
127
+ results.sandboxRes?.authUserName,
128
+ ]),
129
+ ].join(os.EOL));
130
+ }
131
+ updateProgress(event, isAsync) {
132
+ const sandboxProgress = this.sandboxProgress.getSandboxProgress(event);
133
+ const sandboxData = {
134
+ sandboxUsername: event.sandboxRes?.authUserName,
135
+ sandboxProgress,
136
+ sandboxProcessObj: event.sandboxProcessObj,
137
+ };
138
+ this.sandboxProgress.statusData = sandboxData;
139
+ if (!isAsync) {
140
+ this.spinner.status = this.sandboxProgress.formatProgressStatus();
141
+ }
142
+ }
143
+ updateStage(stage, state) {
144
+ if (stage) {
145
+ this.sandboxProgress.transitionStages(stage, state);
146
+ }
147
+ }
148
+ updateSandboxRequestData() {
149
+ if (this.sandboxRequestData && this.latestSandboxProgressObj) {
150
+ this.sandboxRequestData.sandboxProcessObject = this.latestSandboxProgressObj;
151
+ }
152
+ this.saveSandboxProgressConfig();
153
+ }
154
+ saveSandboxProgressConfig() {
155
+ if (this.sandboxRequestData?.sandboxProcessObject.SandboxName && this.sandboxRequestData) {
156
+ this.sandboxRequestConfig.set(this.sandboxRequestData.sandboxProcessObject.SandboxName, this.sandboxRequestData);
157
+ this.sandboxRequestConfig.writeSync();
158
+ }
159
+ }
160
+ removeSandboxProgressConfig() {
161
+ if (this.latestSandboxProgressObj?.SandboxName) {
162
+ this.sandboxRequestConfig.unset(this.latestSandboxProgressObj.SandboxName);
163
+ this.sandboxRequestConfig.writeSync();
164
+ }
165
+ }
166
+ }
167
+ exports.SandboxCommandBase = SandboxCommandBase;
168
+ //# sourceMappingURL=sandboxCommandBase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandboxCommandBase.js","sourceRoot":"","sources":["../../src/shared/sandboxCommandBase.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,yBAAyB;AACzB,iEAAwD;AAExD,2CAY0B;AAC1B,uDAAuE;AAGvE,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,wBAAwB,EAAE,aAAa,CAAC,CAAC;AAChF,MAAsB,kBAAsB,SAAQ,2BAAY;IAS9D,YAAmB,IAAc,EAAE,MAAc;QAC/C,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QALZ,mBAAc,GAAG,KAAK,CAAC;QAM/B,IAAI,CAAC,eAAe,GAAG,IAAI,iCAAe,EAAE,CAAC;IAC/C,CAAC;IACS,KAAK,CAAC,uBAAuB;QACrC,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE;YAC9B,IAAI,CAAC,oBAAoB,GAAG,MAAM,0BAAmB,CAAC,MAAM,EAAE,CAAC;SAChE;QACD,OAAO,IAAI,CAAC,oBAAoB,CAAC;IACnC,CAAC;IAES,KAAK,CAAC,wBAAwB,CAAC,QAAQ,GAAG,IAAI;QACtD,4CAA4C;QAC5C,IACE,IAAI,CAAC,kBAAkB,EAAE,cAAc,CAAC,WAAW;YACnD,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC,WAAW,CAAC,EAChF;YACA,OAAO,KAAK,CAAC;SACd;QACD,2EAA2E;QAC3E,IAAI,QAAQ,KAAK,KAAK,EAAE;YACtB,OAAO,KAAK,CAAC;SACd;QACD,6DAA6D;QAC7D,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,+HAA+H;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CAAC,CAAC;SACrD;IACH,CAAC;IAES,wBAAwB;QAChC,IAAI,IAAI,CAAC,kBAAkB,IAAI,IAAI,CAAC,wBAAwB,EAAE;YAC5D,IAAI,CAAC,kBAAkB,CAAC,oBAAoB,GAAG,IAAI,CAAC,wBAAwB,CAAC;SAC9E;QACD,IAAI,CAAC,yBAAyB,EAAE,CAAC;IACnC,CAAC;IAES,yBAAyB;QACjC,IAAI,IAAI,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,WAAW,IAAI,IAAI,CAAC,kBAAkB,EAAE;YACxF,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,WAAW,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;YACjH,IAAI,CAAC,oBAAoB,CAAC,SAAS,EAAE,CAAC;SACvC;IACH,CAAC;IAEO,2BAA2B;QACjC,IAAI,IAAI,CAAC,wBAAwB,EAAE,WAAW,EAAE;YAC9C,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC,wBAAwB,CAAC,WAAW,CAAC,CAAC;YAC3E,IAAI,CAAC,oBAAoB,CAAC,SAAS,EAAE,CAAC;SACvC;IACH,CAAC;CAGF;AA3LD,gDA2LC"}
@@ -0,0 +1,28 @@
1
+ import { StatusEvent, ResultEvent, SandboxProcessObject } from '@salesforce/core';
2
+ import { StagedProgress } from './stagedProgress';
3
+ export type SandboxProgressData = {
4
+ id: string;
5
+ status: string;
6
+ percentComplete?: number;
7
+ remainingWaitTime: number;
8
+ remainingWaitTimeHuman: string;
9
+ };
10
+ export type SandboxStatusData = {
11
+ sandboxUsername: string;
12
+ sandboxProgress: SandboxProgressData;
13
+ sandboxProcessObj?: SandboxProcessObject | undefined;
14
+ };
15
+ export declare class SandboxProgress extends StagedProgress<SandboxStatusData> {
16
+ constructor(stageNames?: string[]);
17
+ getLogSandboxProcessResult(result: ResultEvent): string;
18
+ getSandboxProgress(event: StatusEvent | (Omit<ResultEvent, 'sandboxRes'> & {
19
+ sandboxRes?: ResultEvent['sandboxRes'];
20
+ })): SandboxProgressData;
21
+ formatProgressStatus(withClock?: boolean): string;
22
+ protected mapCurrentStage(currentStage: string): string;
23
+ }
24
+ export declare const getTableDataFromProcessObj: (sandboxProcessObj: SandboxProcessObject, authUserName?: string | undefined) => Array<{
25
+ key: string;
26
+ value: string | number;
27
+ }>;
28
+ export declare const getSandboxTableAsText: (sandboxUsername?: string, sandboxProgress?: SandboxProcessObject) => string[];
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSandboxTableAsText = exports.getTableDataFromProcessObj = exports.SandboxProgress = void 0;
4
+ /*
5
+ * Copyright (c) 2020, salesforce.com, inc.
6
+ * All rights reserved.
7
+ * Licensed under the BSD 3-Clause license.
8
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
9
+ */
10
+ const os = require("os");
11
+ const core_1 = require("@oclif/core");
12
+ const timeUtils_1 = require("../shared/timeUtils");
13
+ const stagedProgress_1 = require("./stagedProgress");
14
+ const columns = {
15
+ key: { header: 'Field' },
16
+ value: { header: 'Value' },
17
+ };
18
+ class SandboxProgress extends stagedProgress_1.StagedProgress {
19
+ constructor(stageNames = ['Pending', 'Processing', 'Activating', 'Authenticating']) {
20
+ super(stageNames);
21
+ }
22
+ // eslint-disable-next-line class-methods-use-this
23
+ getLogSandboxProcessResult(result) {
24
+ const { sandboxProcessObj } = result;
25
+ const sandboxReadyForUse = `Sandbox ${sandboxProcessObj.SandboxName}(${sandboxProcessObj.Id}) is ready for use.`;
26
+ return sandboxReadyForUse;
27
+ }
28
+ // eslint-disable-next-line class-methods-use-this
29
+ getSandboxProgress(
30
+ // sometimes an undefined sandboxRes is passed in
31
+ event) {
32
+ const waitingOnAuth = 'waitingOnAuth' in event ? event.waitingOnAuth : false;
33
+ const { sandboxProcessObj } = event;
34
+ const waitTimeInSec = 'remainingWait' in event ? event.remainingWait ?? 0 : 0;
35
+ const sandboxIdentifierMsg = `${sandboxProcessObj.SandboxName}(${sandboxProcessObj.Id})`;
36
+ return {
37
+ id: sandboxIdentifierMsg,
38
+ status: waitingOnAuth || sandboxProcessObj.Status === 'Completed' ? 'Authenticating' : sandboxProcessObj.Status,
39
+ percentComplete: sandboxProcessObj.CopyProgress,
40
+ remainingWaitTime: waitTimeInSec,
41
+ remainingWaitTimeHuman: waitTimeInSec === 0 ? '' : `${(0, timeUtils_1.getClockForSeconds)(waitTimeInSec)} until timeout.`,
42
+ };
43
+ }
44
+ formatProgressStatus(withClock = true) {
45
+ const table = (0, exports.getSandboxTableAsText)(undefined, this.statusData?.sandboxProcessObj).join(os.EOL);
46
+ return [
47
+ withClock && this.statusData
48
+ ? `${(0, timeUtils_1.getClockForSeconds)(this.statusData.sandboxProgress.remainingWaitTime)} until timeout. ${this.statusData.sandboxProgress.percentComplete}%`
49
+ : undefined,
50
+ table,
51
+ '---------------------',
52
+ 'Sandbox Create Stages',
53
+ this.formatStages(),
54
+ ]
55
+ .filter((line) => line)
56
+ .join(os.EOL);
57
+ }
58
+ // eslint-disable-next-line class-methods-use-this
59
+ mapCurrentStage(currentStage) {
60
+ switch (currentStage) {
61
+ case 'Pending Remote Creation':
62
+ return 'Pending';
63
+ case 'Remote Sandbox Created':
64
+ return 'Pending';
65
+ case 'Completed':
66
+ return 'Authenticating';
67
+ default:
68
+ return currentStage;
69
+ }
70
+ }
71
+ }
72
+ exports.SandboxProgress = SandboxProgress;
73
+ const getTableDataFromProcessObj = (sandboxProcessObj, authUserName) => [
74
+ { key: 'Id', value: sandboxProcessObj.Id },
75
+ { key: 'SandboxName', value: sandboxProcessObj.SandboxName },
76
+ { key: 'Status', value: sandboxProcessObj.Status },
77
+ { key: 'LicenseType', value: sandboxProcessObj.LicenseType },
78
+ { key: 'SandboxInfoId', value: sandboxProcessObj.SandboxInfoId },
79
+ { key: 'Created Date', value: sandboxProcessObj.CreatedDate },
80
+ { key: 'CopyProgress', value: `${sandboxProcessObj.CopyProgress}%` },
81
+ ...(sandboxProcessObj.SourceId ? [{ key: 'SourceId', value: sandboxProcessObj.SourceId }] : []),
82
+ ...(sandboxProcessObj.Description ? [{ key: 'Description', value: sandboxProcessObj.Description }] : []),
83
+ ...(sandboxProcessObj.SandboxOrganization
84
+ ? [{ key: 'SandboxOrg', value: sandboxProcessObj.SandboxOrganization }]
85
+ : []),
86
+ ...(sandboxProcessObj.ApexClassId ? [{ key: 'ApexClassId', value: sandboxProcessObj.ApexClassId }] : []),
87
+ ...(sandboxProcessObj.Description ? [{ key: 'Description', value: sandboxProcessObj.Description }] : []),
88
+ ...(authUserName ? [{ key: 'Authorized Sandbox Username', value: authUserName }] : []),
89
+ ];
90
+ exports.getTableDataFromProcessObj = getTableDataFromProcessObj;
91
+ const getSandboxTableAsText = (sandboxUsername, sandboxProgress) => {
92
+ if (!sandboxProgress) {
93
+ return [];
94
+ }
95
+ const tableRows = [];
96
+ core_1.CliUx.ux.table((0, exports.getTableDataFromProcessObj)(sandboxProgress, sandboxUsername), columns, {
97
+ printLine: (s) => {
98
+ tableRows.push(s);
99
+ },
100
+ });
101
+ return tableRows;
102
+ };
103
+ exports.getSandboxTableAsText = getSandboxTableAsText;
104
+ //# sourceMappingURL=sandboxProgress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandboxProgress.js","sourceRoot":"","sources":["../../src/shared/sandboxProgress.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,yBAAyB;AAGzB,sCAAoC;AACpC,mDAAyD;AACzD,qDAAkD;AAElD,MAAM,OAAO,GAAqD;IAChE,GAAG,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE;IACxB,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE;CAC3B,CAAC;AAgBF,MAAa,eAAgB,SAAQ,+BAAiC;IACpE,YAAmB,aAAuB,CAAC,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,CAA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E;QACpB,OAAO,EAAE,CAAC;KACX;IACD,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,YAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAA,kCAA0B,EAAC,eAAe,EAAE,eAAe,CAAC,EAAE,OAAO,EAAE;QACpF,SAAS,EAAE,CAAC,CAAS,EAAQ,EAAE;YAC7B,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;KACF,CAAC,CAAC;IACH,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAXW,QAAA,qBAAqB,yBAWhC"}
@@ -5,7 +5,7 @@ export declare class SandboxReporter {
5
5
  sandboxReadyForUse: string;
6
6
  data: Array<{
7
7
  key: string;
8
- value: string | number;
8
+ value: string | number | undefined;
9
9
  }>;
10
10
  };
11
11
  private static getSecondsToHuman;
@@ -0,0 +1,9 @@
1
+ import { Logger, SandboxRequest } from '@salesforce/core';
2
+ export declare const generateSboxName: () => Promise<string>;
3
+ export declare function createSandboxRequest(isClone: true, definitionFile: string | undefined, logger?: Logger | undefined, properties?: Record<string, string | undefined>): Promise<{
4
+ sandboxReq: SandboxRequest;
5
+ srcSandboxName: string;
6
+ }>;
7
+ export declare function createSandboxRequest(isClone: false, definitionFile: string | undefined, logger?: Logger | undefined, properties?: Record<string, string | undefined>): Promise<{
8
+ sandboxReq: SandboxRequest;
9
+ }>;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createSandboxRequest = exports.generateSboxName = void 0;
4
+ /*
5
+ * Copyright (c) 2020, salesforce.com, inc.
6
+ * All rights reserved.
7
+ * Licensed under the BSD 3-Clause license.
8
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
9
+ */
10
+ const fs = require("fs");
11
+ const core_1 = require("@salesforce/core");
12
+ const utils_1 = require("./utils");
13
+ core_1.Messages.importMessagesDirectory(__dirname);
14
+ const messages = core_1.Messages.loadMessages('@salesforce/plugin-org', 'create');
15
+ const cloneMessages = core_1.Messages.loadMessages('@salesforce/plugin-org', 'clone');
16
+ const generateSboxName = async () => {
17
+ // sandbox names are 10 chars or less, a radix of 36 = [a-z][0-9]
18
+ // technically without querying the production org, the generated name could already exist, but the chances of that are lower than the perf penalty of querying and verifying
19
+ const generated = `sbx${Date.now().toString(36).slice(-7)}`;
20
+ await core_1.Lifecycle.getInstance().emitWarning(`No SandboxName defined, generating new SandboxName: ${generated}`);
21
+ return generated;
22
+ };
23
+ exports.generateSboxName = generateSboxName;
24
+ async function createSandboxRequest(isClone = false, definitionFile, logger, properties) {
25
+ if (!logger) {
26
+ logger = await core_1.Logger.child('createSandboxRequest');
27
+ }
28
+ logger.debug('Varargs: %s ', properties);
29
+ const sandboxDefFileContents = definitionFile
30
+ ? (0, utils_1.lowerToUpper)(JSON.parse(fs.readFileSync(definitionFile, 'utf-8')))
31
+ : {};
32
+ const capitalizedVarArgs = properties ? (0, utils_1.lowerToUpper)(properties) : {};
33
+ // varargs override file input
34
+ const sandboxReqWithName = {
35
+ ...sandboxDefFileContents,
36
+ ...capitalizedVarArgs,
37
+ SandboxName: capitalizedVarArgs.SandboxName ??
38
+ sandboxDefFileContents.SandboxName ??
39
+ (await (0, exports.generateSboxName)()),
40
+ };
41
+ const { SourceSandboxName, ...sandboxReq } = sandboxReqWithName;
42
+ logger.debug('SandboxRequest after merging DefFile and Varargs: %s ', sandboxReq);
43
+ if (isClone) {
44
+ if (!SourceSandboxName) {
45
+ // error - we need SourceSandboxName to know which sandbox to clone from
46
+ throw new core_1.SfError(cloneMessages.getMessage('missingSourceSandboxName', ['SourceSandboxName']), cloneMessages.getMessage('missingSourceSandboxNameAction', ['SourceSandboxName']));
47
+ }
48
+ return { sandboxReq, srcSandboxName: SourceSandboxName };
49
+ }
50
+ else {
51
+ if (!sandboxReq.LicenseType) {
52
+ throw new core_1.SfError(messages.getMessage('missingLicenseType'));
53
+ }
54
+ return { sandboxReq };
55
+ }
56
+ }
57
+ exports.createSandboxRequest = createSandboxRequest;
58
+ //# sourceMappingURL=sandboxRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandboxRequest.js","sourceRoot":"","sources":["../../src/shared/sandboxRequest.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,yBAAyB;AACzB,2CAAwF;AACxF,mCAAuC;AAEvC,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,wBAAwB,EAAE,QAAQ,CAAC,CAAC;AAC3E,MAAM,aAAa,GAAG,eAAQ,CAAC,YAAY,CAAC,wBAAwB,EAAE,OAAO,CAAC,CAAC;AAExE,MAAM,gBAAgB,GAAG,KAAK,IAAqB,EAAE;IAC1D,iEAAiE;IACjE,6KAA6K;IAC7K,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5D,MAAM,gBAAS,CAAC,WAAW,EAAE,CAAC,WAAW,CAAC,uDAAuD,SAAS,EAAE,CAAC,CAAC;IAC9G,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AANW,QAAA,gBAAgB,oBAM3B;AAcK,KAAK,UAAU,oBAAoB,CACxC,OAAO,GAAG,KAAK,EACf,cAAkC,EAClC,MAA2B,EAC3B,UAA+C;IAE/C,IAAI,CAAC,MAAM,EAAE;QACX,MAAM,GAAG,MAAM,aAAM,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;KACrD;IACD,MAAM,CAAC,KAAK,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;IAEzC,MAAM,sBAAsB,GAAG,cAAc;QAC3C,CAAC,CAAC,IAAA,oBAAY,EAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,cAAc,EAAE,OAAO,CAAC,CAA4B,CAAC;QAC/F,CAAC,CAAC,EAAE,CAAC;IACP,MAAM,kBAAkB,GAAG,UAAU,CAAC,CAAC,CAAC,IAAA,oBAAY,EAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAEtE,8BAA8B;IAC9B,MAAM,kBAAkB,GAAoD;QAC1E,GAAG,sBAAsB;QACzB,GAAG,kBAAkB;QACrB,WAAW,EACR,kBAAkB,CAAC,WAAsB;YACzC,sBAAsB,CAAC,WAAsB;YAC9C,CAAC,MAAM,IAAA,wBAAgB,GAAE,CAAC;KAC7B,CAAC;IAEF,MAAM,EAAE,iBAAiB,EAAE,GAAG,UAAU,EAAE,GAAG,kBAAkB,CAAC;IAChE,MAAM,CAAC,KAAK,CAAC,uDAAuD,EAAE,UAAU,CAAC,CAAC;IAElF,IAAI,OAAO,EAAE;QACX,IAAI,CAAC,iBAAiB,EAAE;YACtB,wEAAwE;YACxE,MAAM,IAAI,cAAO,CACf,aAAa,CAAC,UAAU,CAAC,0BAA0B,EAAE,CAAC,mBAAmB,CAAC,CAAC,EAC3E,aAAa,CAAC,UAAU,CAAC,gCAAgC,EAAE,CAAC,mBAAmB,CAAC,CAAC,CAClF,CAAC;SACH;QACD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,iBAAiB,EAAE,CAAC;KAC1D;SAAM;QACL,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE;YAC3B,MAAM,IAAI,cAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC,CAAC;SAC9D;QACD,OAAO,EAAE,UAAU,EAAE,CAAC;KACvB;AACH,CAAC;AA5CD,oDA4CC"}
@@ -0,0 +1,9 @@
1
+ import { ScratchOrgLifecycleEvent } from '@salesforce/core';
2
+ export declare const buildStatus: (data: ScratchOrgLifecycleEvent, baseUrl: string) => string;
3
+ export declare const formatStage: (currentStage: ScratchOrgLifecycleEvent['stage']) => string;
4
+ export declare const formatRequest: (baseUrl: string, id?: string) => string;
5
+ export declare const formatUsername: (username?: string) => string;
6
+ export declare const formatOrgId: (id?: string) => string;
7
+ export declare const formatCurrentStage: (stage: string) => string;
8
+ export declare const formatCompletedStage: (stage: string) => string;
9
+ export declare const formatFutureStage: (stage: string) => string;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatFutureStage = exports.formatCompletedStage = exports.formatCurrentStage = exports.formatOrgId = exports.formatUsername = exports.formatRequest = exports.formatStage = exports.buildStatus = void 0;
4
+ /*
5
+ * Copyright (c) 2020, salesforce.com, inc.
6
+ * All rights reserved.
7
+ * Licensed under the BSD 3-Clause license.
8
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
9
+ */
10
+ const core_1 = require("@salesforce/core");
11
+ const chalk = require("chalk");
12
+ const change_case_1 = require("change-case");
13
+ const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
14
+ const boldBlue = (input) => chalk.rgb(81, 176, 235).bold(input);
15
+ const boldPurple = (input) => chalk.rgb(157, 129, 221).bold(input);
16
+ const buildStatus = (data, baseUrl) => `
17
+ RequestId: ${(0, exports.formatRequest)(baseUrl, data.scratchOrgInfo?.Id)}
18
+ OrgId: ${(0, exports.formatOrgId)(data.scratchOrgInfo?.ScratchOrg)}
19
+ Username: ${(0, exports.formatUsername)(data.scratchOrgInfo?.SignupUsername)}
20
+ ${(0, exports.formatStage)(data.stage)}`;
21
+ exports.buildStatus = buildStatus;
22
+ const formatStage = (currentStage) => core_1.scratchOrgLifecycleStages
23
+ .map((stage, stageIndex) => {
24
+ // current stage
25
+ if (currentStage === stage)
26
+ return (0, exports.formatCurrentStage)(stage);
27
+ // completed stages
28
+ if (core_1.scratchOrgLifecycleStages.indexOf(currentStage) > stageIndex)
29
+ return (0, exports.formatCompletedStage)(stage);
30
+ // future stage
31
+ return (0, exports.formatFutureStage)(stage);
32
+ })
33
+ .join('\n');
34
+ exports.formatStage = formatStage;
35
+ const formatRequest = (baseUrl, id) => `${id ? `${chalk.bold(id)} (${baseUrl}/${id})` : ''}`;
36
+ exports.formatRequest = formatRequest;
37
+ const formatUsername = (username) => `${username ? `${boldBlue(username)} ` : ''}`;
38
+ exports.formatUsername = formatUsername;
39
+ const formatOrgId = (id) => `${id ? `${boldBlue(id)} ` : ''}`;
40
+ exports.formatOrgId = formatOrgId;
41
+ const formatCurrentStage = (stage) => boldPurple((0, change_case_1.capitalCase)(stage));
42
+ exports.formatCurrentStage = formatCurrentStage;
43
+ const formatCompletedStage = (stage) => sf_plugins_core_1.StandardColors.success.bold(`✓ ${(0, change_case_1.capitalCase)(stage)}`);
44
+ exports.formatCompletedStage = formatCompletedStage;
45
+ const formatFutureStage = (stage) => sf_plugins_core_1.StandardColors.info((0, change_case_1.capitalCase)(stage));
46
+ exports.formatFutureStage = formatFutureStage;
47
+ //# sourceMappingURL=scratchOrgOutput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scratchOrgOutput.js","sourceRoot":"","sources":["../../src/shared/scratchOrgOutput.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,2CAAuF;AACvF,+BAA+B;AAC/B,6CAA0C;AAC1C,iEAA6D;AAE7D,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAChF,MAAM,UAAU,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAE5E,MAAM,WAAW,GAAG,CAAC,IAA8B,EAAE,OAAe,EAAU,EAAE,CAAC;aAC3E,IAAA,qBAAa,EAAC,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;SACnD,IAAA,mBAAW,EAAC,IAAI,CAAC,cAAc,EAAE,UAAU,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AA8D;AAE/E,MAAM,kBAAkB,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,UAAU,CAAC,IAAA,yBAAW,EAAC,KAAK,CAAC,CAAC,CAAC;AAA/E,QAAA,kBAAkB,sBAA6D;AACrF,MAAM,oBAAoB,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,gCAAc,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,IAAA,yBAAW,EAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAAzG,QAAA,oBAAoB,wBAAqF;AAC/G,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,gCAAc,CAAC,IAAI,CAAC,IAAA,yBAAW,EAAC,KAAK,CAAC,CAAC,CAAC;AAAvF,QAAA,iBAAiB,qBAAsE"}
@@ -0,0 +1,33 @@
1
+ import * as chalk from 'chalk';
2
+ export declare const boldPurple: chalk.Chalk;
3
+ export type State = 'inProgress' | 'completed' | 'failed' | 'unknown';
4
+ export type StageAttributes = {
5
+ state: State;
6
+ char: string;
7
+ color: chalk.Chalk;
8
+ index: number;
9
+ visited: boolean;
10
+ };
11
+ export declare const StateConstants: {
12
+ [stage: string]: Omit<StageAttributes, 'index'>;
13
+ };
14
+ export type Stage = {
15
+ [stage: string]: StageAttributes;
16
+ };
17
+ export declare abstract class StagedProgress<T> {
18
+ private dataForTheStatus;
19
+ private theStages;
20
+ private currentStage?;
21
+ private previousStage?;
22
+ constructor(stages: string[]);
23
+ get statusData(): T | undefined;
24
+ set statusData(statusData: T | undefined);
25
+ formatStages(): string;
26
+ transitionStages(currentStage: string, newState: State): void;
27
+ markPreviousStagesAsCompleted(currentStage?: string): void;
28
+ updateCurrentStage(newState: State): void;
29
+ updateStages(currentStage: string, newState?: State): void;
30
+ getStages(): Stage;
31
+ protected mapCurrentStage(currentStage: string): string;
32
+ abstract formatProgressStatus(withClock: boolean): string;
33
+ }
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StagedProgress = exports.StateConstants = exports.boldPurple = void 0;
4
+ /*
5
+ * Copyright (c) 2020, salesforce.com, inc.
6
+ * All rights reserved.
7
+ * Licensed under the BSD 3-Clause license.
8
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
9
+ */
10
+ const os = require("os");
11
+ const chalk = require("chalk");
12
+ const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
13
+ const core_1 = require("@salesforce/core");
14
+ const compareStages = ([, aValue], [, bValue]) => aValue.index - bValue.index;
15
+ exports.boldPurple = chalk.rgb(157, 129, 221).bold;
16
+ exports.StateConstants = {
17
+ inProgress: { color: exports.boldPurple, char: '…', visited: false, state: 'inProgress' },
18
+ completed: { color: sf_plugins_core_1.StandardColors.success, char: '✓', visited: false, state: 'completed' },
19
+ failed: { color: chalk.bold.red, char: '✖', visited: false, state: 'failed' },
20
+ unknown: { color: chalk.dim, char: '…', visited: false, state: 'unknown' },
21
+ };
22
+ class StagedProgress {
23
+ constructor(stages) {
24
+ this.theStages = stages
25
+ .map((stage, index) => ({
26
+ [stage]: { ...exports.StateConstants['unknown'], index: (index + 1) * 10 },
27
+ }))
28
+ .reduce((m, b) => Object.assign(m, b), {});
29
+ }
30
+ get statusData() {
31
+ return this.dataForTheStatus;
32
+ }
33
+ set statusData(statusData) {
34
+ this.dataForTheStatus = statusData;
35
+ }
36
+ formatStages() {
37
+ return Object.entries(this.theStages)
38
+ .sort(compareStages)
39
+ .map(([stage, stageState]) => stageState.color(`${stageState.char} - ${stage}`))
40
+ .join(os.EOL);
41
+ }
42
+ transitionStages(currentStage, newState) {
43
+ currentStage = this.mapCurrentStage(currentStage);
44
+ if (this.previousStage && this.previousStage !== currentStage) {
45
+ this.updateStages(this.previousStage, 'completed');
46
+ }
47
+ // mark all previous stages as visited and completed
48
+ this.markPreviousStagesAsCompleted(currentStage);
49
+ this.previousStage = currentStage;
50
+ this.currentStage = currentStage;
51
+ this.updateStages(currentStage, newState);
52
+ }
53
+ markPreviousStagesAsCompleted(currentStage) {
54
+ if (currentStage) {
55
+ currentStage = this.mapCurrentStage(currentStage);
56
+ }
57
+ Object.entries(this.theStages).forEach(([stage, stageState]) => {
58
+ if (!currentStage || stageState.index < this.theStages[currentStage].index) {
59
+ this.updateStages(stage, 'completed');
60
+ }
61
+ });
62
+ }
63
+ updateCurrentStage(newState) {
64
+ if (!this.currentStage) {
65
+ throw new core_1.SfError('transitionStages must be called before updateCurrentStage');
66
+ }
67
+ this.updateStages(this.currentStage, newState);
68
+ }
69
+ updateStages(currentStage, newState) {
70
+ currentStage = this.mapCurrentStage(currentStage);
71
+ if (!this.theStages[currentStage]) {
72
+ const sortedEntries = Object.entries(this.theStages).sort(compareStages);
73
+ const visitedEntries = sortedEntries.filter(([, stageState]) => stageState.visited);
74
+ const [, lastState] = visitedEntries.length
75
+ ? visitedEntries[visitedEntries.length - 1]
76
+ : ['', { state: exports.StateConstants.unknown.state, index: 0, visited: true }];
77
+ const newEntry = {
78
+ [currentStage]: { state: exports.StateConstants.unknown.state, visited: true, index: lastState.index + 1 },
79
+ };
80
+ this.theStages = Object.assign(this.theStages, newEntry);
81
+ }
82
+ this.theStages[currentStage].visited = true;
83
+ this.theStages[currentStage].state = newState ?? 'inProgress';
84
+ this.theStages[currentStage].char = exports.StateConstants[this.theStages[currentStage].state].char;
85
+ if (newState) {
86
+ this.theStages[currentStage].color = exports.StateConstants[newState.toString()].color;
87
+ }
88
+ }
89
+ getStages() {
90
+ return this.theStages;
91
+ }
92
+ // eslint-disable-next-line class-methods-use-this
93
+ mapCurrentStage(currentStage) {
94
+ return currentStage;
95
+ }
96
+ }
97
+ exports.StagedProgress = StagedProgress;
98
+ //# sourceMappingURL=stagedProgress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stagedProgress.js","sourceRoot":"","sources":["../../src/shared/stagedProgress.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,yBAAyB;AACzB,+BAA+B;AAC/B,iE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E,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,KAAK,GAAG,CAAC,EAAE;aACnG,CAAC;YACF,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;SAC1D;QACD,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC;QAC5C,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,KAAK,GAAG,QAAQ,IAAI,YAAY,CAAC;QAC9D,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,IAAI,GAAG,sBAAc,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;QAC5F,IAAI,QAAQ,EAAE;YACZ,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,KAAK,GAAG,sBAAc,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC;SAChF;IACH,CAAC;IAEM,SAAS;QACd,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,kDAAkD;IACxC,eAAe,CAAC,YAAoB;QAC5C,OAAO,YAAY,CAAC;IACtB,CAAC;CAGF;AA1FD,wCA0FC"}
@@ -0,0 +1,10 @@
1
+ import { Duration } from '@salesforce/kit';
2
+ export type TimeComponents = {
3
+ days: Duration;
4
+ hours: Duration;
5
+ minutes: Duration;
6
+ seconds: Duration;
7
+ };
8
+ export declare const getClockForSeconds: (timeInSec: number) => string;
9
+ export declare const getTimeComponentsFromSeconds: (timeInSec: number) => TimeComponents;
10
+ export declare const getSecondsToHuman: (timeInSec: number) => string;