@salesforce/plugin-org 5.2.42 → 5.4.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/README.md +55 -27
- package/lib/commands/org/create/sandbox.js +9 -10
- package/lib/commands/org/create/sandbox.js.map +1 -1
- package/lib/commands/org/create/scratch.d.ts +1 -0
- package/lib/commands/org/create/scratch.js +10 -0
- package/lib/commands/org/create/scratch.js.map +1 -1
- package/lib/commands/org/refresh/sandbox.js +8 -5
- package/lib/commands/org/refresh/sandbox.js.map +1 -1
- package/lib/commands/org/resume/sandbox.js +9 -6
- package/lib/commands/org/resume/sandbox.js.map +1 -1
- package/lib/shared/sandboxCommandBase.d.ts +9 -9
- package/lib/shared/sandboxCommandBase.js +38 -58
- package/lib/shared/sandboxCommandBase.js.map +1 -1
- package/lib/shared/sandboxStages.d.ts +17 -0
- package/lib/shared/sandboxStages.js +64 -0
- package/lib/shared/sandboxStages.js.map +1 -0
- package/lib/shared/scratchOrgRequest.js +1 -0
- package/lib/shared/scratchOrgRequest.js.map +1 -1
- package/messages/create_scratch.md +27 -6
- package/messages/sandboxbase.md +2 -3
- package/oclif.manifest.json +578 -554
- package/package.json +3 -3
- package/lib/shared/sandboxProgress.d.ts +0 -33
- package/lib/shared/sandboxProgress.js +0 -98
- package/lib/shared/sandboxProgress.js.map +0 -1
- package/lib/shared/sandboxReporter.d.ts +0 -11
- package/lib/shared/sandboxReporter.js +0 -36
- package/lib/shared/sandboxReporter.js.map +0 -1
- package/lib/shared/stagedProgress.d.ts +0 -33
- package/lib/shared/stagedProgress.js +0 -98
- package/lib/shared/stagedProgress.js.map +0 -1
- package/lib/shared/timeUtils.d.ts +0 -10
- package/lib/shared/timeUtils.js +0 -31
- package/lib/shared/timeUtils.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/plugin-org",
|
|
3
3
|
"description": "Commands to interact with Salesforce orgs",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.4.0",
|
|
5
5
|
"author": "Salesforce",
|
|
6
6
|
"bugs": "https://github.com/forcedotcom/cli/issues",
|
|
7
7
|
"dependencies": {
|
|
@@ -227,7 +227,7 @@
|
|
|
227
227
|
"exports": "./lib/index.js",
|
|
228
228
|
"type": "module",
|
|
229
229
|
"sfdx": {
|
|
230
|
-
"publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-org/5.
|
|
231
|
-
"signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-org/5.
|
|
230
|
+
"publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-org/5.4.0.crt",
|
|
231
|
+
"signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-org/5.4.0.sig"
|
|
232
232
|
}
|
|
233
233
|
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { StatusEvent, ResultEvent, SandboxProcessObject } from '@salesforce/core';
|
|
2
|
-
import { StagedProgress } from './stagedProgress.js';
|
|
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 type SandboxProgressConfig = {
|
|
16
|
-
stageNames?: string[];
|
|
17
|
-
action?: 'Create' | 'Refresh' | 'Create/Refresh';
|
|
18
|
-
};
|
|
19
|
-
export declare class SandboxProgress extends StagedProgress<SandboxStatusData> {
|
|
20
|
-
action: SandboxProgressConfig['action'];
|
|
21
|
-
constructor(config?: SandboxProgressConfig);
|
|
22
|
-
getLogSandboxProcessResult(result: ResultEvent): string;
|
|
23
|
-
getSandboxProgress(event: StatusEvent | (Omit<ResultEvent, 'sandboxRes'> & {
|
|
24
|
-
sandboxRes?: ResultEvent['sandboxRes'];
|
|
25
|
-
})): SandboxProgressData;
|
|
26
|
-
formatProgressStatus(withClock?: boolean): string;
|
|
27
|
-
protected mapCurrentStage(currentStage: string): string;
|
|
28
|
-
}
|
|
29
|
-
export declare const getTableDataFromProcessObj: (sandboxProcessObj: SandboxProcessObject, authUserName?: string | undefined) => Array<{
|
|
30
|
-
key: string;
|
|
31
|
-
value: string | number;
|
|
32
|
-
}>;
|
|
33
|
-
export declare const getSandboxTableAsText: (sandboxUsername?: string, sandboxProgress?: SandboxProcessObject) => string;
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
* Licensed under the BSD 3-Clause license.
|
|
5
|
-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
|
-
*/
|
|
7
|
-
import os from 'node:os';
|
|
8
|
-
import { colorize } from '@oclif/core/ux';
|
|
9
|
-
import { getClockForSeconds } from '../shared/timeUtils.js';
|
|
10
|
-
import { StagedProgress } from './stagedProgress.js';
|
|
11
|
-
import { isDefined } from './utils.js';
|
|
12
|
-
export class SandboxProgress extends StagedProgress {
|
|
13
|
-
action;
|
|
14
|
-
constructor(config) {
|
|
15
|
-
const stageNames = config?.stageNames ?? ['Pending', 'Processing', 'Activating', 'Authenticating'];
|
|
16
|
-
super(stageNames);
|
|
17
|
-
this.action = config?.action ?? 'Create/Refresh';
|
|
18
|
-
}
|
|
19
|
-
// eslint-disable-next-line class-methods-use-this
|
|
20
|
-
getLogSandboxProcessResult(result) {
|
|
21
|
-
const { sandboxProcessObj } = result;
|
|
22
|
-
const sandboxReadyForUse = `Sandbox ${sandboxProcessObj.SandboxName}(${sandboxProcessObj.Id}) is ready for use.`;
|
|
23
|
-
return sandboxReadyForUse;
|
|
24
|
-
}
|
|
25
|
-
// eslint-disable-next-line class-methods-use-this
|
|
26
|
-
getSandboxProgress(
|
|
27
|
-
// sometimes an undefined sandboxRes is passed in
|
|
28
|
-
event) {
|
|
29
|
-
const waitingOnAuth = 'waitingOnAuth' in event ? event.waitingOnAuth : false;
|
|
30
|
-
const { sandboxProcessObj } = event;
|
|
31
|
-
const waitTimeInSec = 'remainingWait' in event ? event.remainingWait ?? 0 : 0;
|
|
32
|
-
const sandboxIdentifierMsg = `${sandboxProcessObj.SandboxName}(${sandboxProcessObj.Id})`;
|
|
33
|
-
return {
|
|
34
|
-
id: sandboxIdentifierMsg,
|
|
35
|
-
status: waitingOnAuth || sandboxProcessObj.Status === 'Completed' ? 'Authenticating' : sandboxProcessObj.Status,
|
|
36
|
-
percentComplete: sandboxProcessObj.CopyProgress,
|
|
37
|
-
remainingWaitTime: waitTimeInSec,
|
|
38
|
-
remainingWaitTimeHuman: waitTimeInSec === 0 ? '' : `${getClockForSeconds(waitTimeInSec)} until timeout.`,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
formatProgressStatus(withClock = true) {
|
|
42
|
-
const table = getSandboxTableAsText(undefined, this.statusData?.sandboxProcessObj);
|
|
43
|
-
return [
|
|
44
|
-
withClock && this.statusData
|
|
45
|
-
? `${getClockForSeconds(this.statusData.sandboxProgress.remainingWaitTime)} until timeout. ${this.statusData.sandboxProgress.percentComplete ?? 0}%`
|
|
46
|
-
: undefined,
|
|
47
|
-
table,
|
|
48
|
-
'---------------------',
|
|
49
|
-
`Sandbox ${this.action ?? ''} Stages`,
|
|
50
|
-
this.formatStages(),
|
|
51
|
-
]
|
|
52
|
-
.filter(isDefined)
|
|
53
|
-
.join(os.EOL);
|
|
54
|
-
}
|
|
55
|
-
// eslint-disable-next-line class-methods-use-this
|
|
56
|
-
mapCurrentStage(currentStage) {
|
|
57
|
-
switch (currentStage) {
|
|
58
|
-
case 'Pending Remote Creation':
|
|
59
|
-
return 'Pending';
|
|
60
|
-
case 'Remote Sandbox Created':
|
|
61
|
-
return 'Pending';
|
|
62
|
-
case 'Completed':
|
|
63
|
-
return 'Authenticating';
|
|
64
|
-
default:
|
|
65
|
-
return currentStage;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
export const getTableDataFromProcessObj = (sandboxProcessObj, authUserName) => [
|
|
70
|
-
{ key: 'Id', value: sandboxProcessObj.Id },
|
|
71
|
-
{ key: 'SandboxName', value: sandboxProcessObj.SandboxName },
|
|
72
|
-
{ key: 'Status', value: sandboxProcessObj.Status },
|
|
73
|
-
{ key: 'LicenseType', value: sandboxProcessObj.LicenseType },
|
|
74
|
-
{ key: 'SandboxInfoId', value: sandboxProcessObj.SandboxInfoId },
|
|
75
|
-
{ key: 'Created Date', value: sandboxProcessObj.CreatedDate },
|
|
76
|
-
{ key: 'CopyProgress', value: `${sandboxProcessObj.CopyProgress ?? 0}%` },
|
|
77
|
-
...(sandboxProcessObj.SourceId ? [{ key: 'SourceId', value: sandboxProcessObj.SourceId }] : []),
|
|
78
|
-
...(sandboxProcessObj.SandboxOrganization
|
|
79
|
-
? [{ key: 'SandboxOrg', value: sandboxProcessObj.SandboxOrganization }]
|
|
80
|
-
: []),
|
|
81
|
-
...(sandboxProcessObj.ApexClassId ? [{ key: 'ApexClassId', value: sandboxProcessObj.ApexClassId }] : []),
|
|
82
|
-
...(sandboxProcessObj.Description ? [{ key: 'Description', value: sandboxProcessObj.Description }] : []),
|
|
83
|
-
...(authUserName ? [{ key: 'Authorized Sandbox Username', value: authUserName }] : []),
|
|
84
|
-
];
|
|
85
|
-
export const getSandboxTableAsText = (sandboxUsername, sandboxProgress) => {
|
|
86
|
-
if (!sandboxProgress) {
|
|
87
|
-
return '';
|
|
88
|
-
}
|
|
89
|
-
const data = getTableDataFromProcessObj(sandboxProgress, sandboxUsername);
|
|
90
|
-
const longestKey = data.reduce((acc, row) => (row.key.length > acc ? row.key.length : acc), 0);
|
|
91
|
-
const longestValue = data.reduce((acc, row) => (row.value.toString().length > acc ? row.value.toString().length : acc), 0);
|
|
92
|
-
return [
|
|
93
|
-
colorize('bold', `${'Field'.padEnd(longestKey)} Value`),
|
|
94
|
-
`${'-'.repeat(longestKey)} ${'-'.repeat(longestValue)}`,
|
|
95
|
-
...data.map((row) => `${row.key.padEnd(longestKey)} ${row.value}`),
|
|
96
|
-
].join(os.EOL);
|
|
97
|
-
};
|
|
98
|
-
//# sourceMappingURL=sandboxProgress.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sandboxProgress.js","sourceRoot":"","sources":["../../src/shared/sandboxProgress.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAqBvC,MAAM,OAAO,eAAgB,SAAQ,cAAiC;IAC7D,MAAM,CAAkC;IAE/C,YAAmB,MAA8B;QAC/C,MAAM,UAAU,GAAG,MAAM,EAAE,UAAU,IAAI,CAAC,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,CAAC,CAAC;QACnG,KAAK,CAAC,UAAU,CAAC,CAAC;QAClB,IAAI,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,IAAI,gBAAgB,CAAC;IACnD,CAAC;IACD,kDAAkD;IAC3C,0BAA0B,CAAC,MAAmB;QACnD,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,CAAC;QACrC,MAAM,kBAAkB,GAAG,WAAW,iBAAiB,CAAC,WAAW,IAAI,iBAAiB,CAAC,EAAE,qBAAqB,CAAC;QACjH,OAAO,kBAAkB,CAA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AC,QAAQ,EAAE,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EACrF,CAAC,CACF,CAAC;IACF,OAAO;QACL,QAAQ,CAAC,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC;QACxD,GAAG,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE;QACxD,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,GAAG,CAAC,KAAK,EAAE,CAAC;KACpE,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;AACjB,CAAC,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { StatusEvent, ResultEvent } from '@salesforce/core';
|
|
2
|
-
export declare class SandboxReporter {
|
|
3
|
-
static sandboxProgress(update: StatusEvent): string;
|
|
4
|
-
static logSandboxProcessResult(result: ResultEvent): {
|
|
5
|
-
sandboxReadyForUse: string;
|
|
6
|
-
data: Array<{
|
|
7
|
-
key: string;
|
|
8
|
-
value: string | number | undefined;
|
|
9
|
-
}>;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { getSecondsToHuman } from './timeUtils.js';
|
|
2
|
-
export class SandboxReporter {
|
|
3
|
-
static sandboxProgress(update) {
|
|
4
|
-
const { remainingWait, interval, sandboxProcessObj, waitingOnAuth } = update;
|
|
5
|
-
const waitTime = getSecondsToHuman(remainingWait);
|
|
6
|
-
const waitTimeMsg = `Sleeping ${interval} seconds. Will wait ${waitTime} more before timing out.`;
|
|
7
|
-
const sandboxIdentifierMsg = `${sandboxProcessObj.SandboxName}(${sandboxProcessObj.Id})`;
|
|
8
|
-
const waitingOnAuthMessage = waitingOnAuth ? ', waiting on JWT auth' : '';
|
|
9
|
-
const completionMessage = sandboxProcessObj.CopyProgress
|
|
10
|
-
? `(${sandboxProcessObj.CopyProgress}% completed${waitingOnAuthMessage})`
|
|
11
|
-
: '';
|
|
12
|
-
return `Sandbox request ${sandboxIdentifierMsg} is ${sandboxProcessObj.Status} ${completionMessage}. ${waitTimeMsg}`;
|
|
13
|
-
}
|
|
14
|
-
static logSandboxProcessResult(result
|
|
15
|
-
// sandboxProcessObj.CopyProgress is a number
|
|
16
|
-
) {
|
|
17
|
-
const { sandboxProcessObj, sandboxRes } = result;
|
|
18
|
-
const sandboxReadyForUse = `Sandbox ${sandboxProcessObj.SandboxName}(${sandboxProcessObj.Id}) is ready for use.`;
|
|
19
|
-
const data = [
|
|
20
|
-
{ key: 'Id', value: sandboxProcessObj.Id },
|
|
21
|
-
{ key: 'SandboxName', value: sandboxProcessObj.SandboxName },
|
|
22
|
-
{ key: 'Status', value: sandboxProcessObj.Status },
|
|
23
|
-
{ key: 'CopyProgress', value: sandboxProcessObj.CopyProgress },
|
|
24
|
-
{ key: 'Description', value: sandboxProcessObj.Description },
|
|
25
|
-
{ key: 'LicenseType', value: sandboxProcessObj.LicenseType },
|
|
26
|
-
{ key: 'SandboxInfoId', value: sandboxProcessObj.SandboxInfoId },
|
|
27
|
-
{ key: 'SourceId', value: sandboxProcessObj.SourceId },
|
|
28
|
-
{ key: 'SandboxOrg', value: sandboxProcessObj.SandboxOrganization },
|
|
29
|
-
{ key: 'Created Date', value: sandboxProcessObj.CreatedDate },
|
|
30
|
-
{ key: 'ApexClassId', value: sandboxProcessObj.ApexClassId },
|
|
31
|
-
{ key: 'Authorized Sandbox Username', value: sandboxRes.authUserName },
|
|
32
|
-
];
|
|
33
|
-
return { sandboxReadyForUse, data };
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=sandboxReporter.js.map
|
|
@@ -1 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AC,WAAW,EAAE;YAC5D,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,iBAAiB,CAAC,MAAM,EAAE;YAClD,EAAE,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,iBAAiB,CAAC,YAAY,EAAE;YAC9D,EAAE,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,iBAAiB,CAAC,WAAW,EAAE;YAC5D,EAAE,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,iBAAiB,CAAC,WAAW,EAAE;YAC5D,EAAE,GAAG,EAAE,eAAe,EAAE,KAAK,EAAE,iBAAiB,CAAC,aAAa,EAAE;YAChE,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,iBAAiB,CAAC,QAAQ,EAAE;YACtD,EAAE,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,iBAAiB,CAAC,mBAAmB,EAAE;YACnE,EAAE,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,iBAAiB,CAAC,WAAW,EAAE;YAC7D,EAAE,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,iBAAiB,CAAC,WAAW,EAAE;YAC5D,EAAE,GAAG,EAAE,6BAA6B,EAAE,KAAK,EAAE,UAAU,CAAC,YAAY,EAAE;SACvE,CAAC;QAEF,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC;IACtC,CAAC;CACF"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import ansis, { type Ansis } from 'ansis';
|
|
2
|
-
export declare const boldPurple: ansis.Ansis;
|
|
3
|
-
export type State = 'inProgress' | 'completed' | 'failed' | 'unknown';
|
|
4
|
-
export type StageAttributes = {
|
|
5
|
-
state: State;
|
|
6
|
-
char: string;
|
|
7
|
-
color: Ansis;
|
|
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
|
-
}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
* Licensed under the BSD 3-Clause license.
|
|
5
|
-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
|
-
*/
|
|
7
|
-
import os from 'node:os';
|
|
8
|
-
import ansis from 'ansis';
|
|
9
|
-
import { StandardColors } from '@salesforce/sf-plugins-core';
|
|
10
|
-
import { SfError } from '@salesforce/core';
|
|
11
|
-
const compareStages = ([, aValue], [, bValue]) => aValue.index - bValue.index;
|
|
12
|
-
export const boldPurple = ansis.rgb(157, 129, 221).bold;
|
|
13
|
-
export const StateConstants = {
|
|
14
|
-
inProgress: { color: boldPurple, char: '…', visited: false, state: 'inProgress' },
|
|
15
|
-
completed: { color: StandardColors.success, char: '✓', visited: false, state: 'completed' },
|
|
16
|
-
failed: { color: ansis.bold.red, char: '✖', visited: false, state: 'failed' },
|
|
17
|
-
unknown: { color: ansis.dim, char: '…', visited: false, state: 'unknown' },
|
|
18
|
-
};
|
|
19
|
-
export class StagedProgress {
|
|
20
|
-
dataForTheStatus;
|
|
21
|
-
theStages;
|
|
22
|
-
currentStage;
|
|
23
|
-
previousStage;
|
|
24
|
-
constructor(stages) {
|
|
25
|
-
this.theStages = stages
|
|
26
|
-
.map((stage, index) => ({
|
|
27
|
-
[stage]: { ...StateConstants['unknown'], index: (index + 1) * 10 },
|
|
28
|
-
}))
|
|
29
|
-
.reduce((m, b) => Object.assign(m, b), {});
|
|
30
|
-
}
|
|
31
|
-
get statusData() {
|
|
32
|
-
return this.dataForTheStatus;
|
|
33
|
-
}
|
|
34
|
-
set statusData(statusData) {
|
|
35
|
-
this.dataForTheStatus = statusData;
|
|
36
|
-
}
|
|
37
|
-
formatStages() {
|
|
38
|
-
return Object.entries(this.theStages)
|
|
39
|
-
.sort(compareStages)
|
|
40
|
-
.map(([stage, stageState]) => stageState.color(`${stageState.char} - ${stage}`))
|
|
41
|
-
.join(os.EOL);
|
|
42
|
-
}
|
|
43
|
-
transitionStages(currentStage, newState) {
|
|
44
|
-
currentStage = this.mapCurrentStage(currentStage);
|
|
45
|
-
if (this.previousStage && this.previousStage !== currentStage) {
|
|
46
|
-
this.updateStages(this.previousStage, 'completed');
|
|
47
|
-
}
|
|
48
|
-
// mark all previous stages as visited and completed
|
|
49
|
-
this.markPreviousStagesAsCompleted(currentStage);
|
|
50
|
-
this.previousStage = currentStage;
|
|
51
|
-
this.currentStage = currentStage;
|
|
52
|
-
this.updateStages(currentStage, newState);
|
|
53
|
-
}
|
|
54
|
-
markPreviousStagesAsCompleted(currentStage) {
|
|
55
|
-
if (currentStage) {
|
|
56
|
-
currentStage = this.mapCurrentStage(currentStage);
|
|
57
|
-
}
|
|
58
|
-
Object.entries(this.theStages).forEach(([stage, stageState]) => {
|
|
59
|
-
if (!currentStage || stageState.index < (this.theStages[currentStage]?.index ?? 0)) {
|
|
60
|
-
this.updateStages(stage, 'completed');
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
updateCurrentStage(newState) {
|
|
65
|
-
if (!this.currentStage) {
|
|
66
|
-
throw new SfError('transitionStages must be called before updateCurrentStage');
|
|
67
|
-
}
|
|
68
|
-
this.updateStages(this.currentStage, newState);
|
|
69
|
-
}
|
|
70
|
-
updateStages(currentStage, newState) {
|
|
71
|
-
currentStage = this.mapCurrentStage(currentStage);
|
|
72
|
-
if (!this.theStages[currentStage]) {
|
|
73
|
-
const sortedEntries = Object.entries(this.theStages).sort(compareStages);
|
|
74
|
-
const visitedEntries = sortedEntries.filter(([, stageState]) => stageState.visited);
|
|
75
|
-
const [, lastState] = visitedEntries.length
|
|
76
|
-
? visitedEntries[visitedEntries.length - 1]
|
|
77
|
-
: ['', { state: StateConstants.unknown.state, index: 0, visited: true }];
|
|
78
|
-
const newEntry = {
|
|
79
|
-
[currentStage]: { state: StateConstants.unknown.state, visited: true, index: lastState.index + 1 },
|
|
80
|
-
};
|
|
81
|
-
this.theStages = Object.assign(this.theStages, newEntry);
|
|
82
|
-
}
|
|
83
|
-
this.theStages[currentStage].visited = true;
|
|
84
|
-
this.theStages[currentStage].state = newState ?? 'inProgress';
|
|
85
|
-
this.theStages[currentStage].char = StateConstants[this.theStages[currentStage].state].char;
|
|
86
|
-
if (newState) {
|
|
87
|
-
this.theStages[currentStage].color = StateConstants[newState.toString()].color;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
getStages() {
|
|
91
|
-
return this.theStages;
|
|
92
|
-
}
|
|
93
|
-
// eslint-disable-next-line class-methods-use-this
|
|
94
|
-
mapCurrentStage(currentStage) {
|
|
95
|
-
return currentStage;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
//# sourceMappingURL=stagedProgress.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stagedProgress.js","sourceRoot":"","sources":["../../src/shared/stagedProgress.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,MAAM,SA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
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;
|
package/lib/shared/timeUtils.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2022, salesforce.com, inc.
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
* Licensed under the BSD 3-Clause license.
|
|
5
|
-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
|
-
*/
|
|
7
|
-
import { Duration } from '@salesforce/kit';
|
|
8
|
-
export const getClockForSeconds = (timeInSec) => {
|
|
9
|
-
const tc = getTimeComponentsFromSeconds(timeInSec);
|
|
10
|
-
const dDisplay = tc.days.days > 0 ? `${tc.days.days.toString()}:` : '';
|
|
11
|
-
const hDisplay = tc.hours.hours.toString().padStart(2, '0');
|
|
12
|
-
const mDisplay = tc.minutes.minutes.toString().padStart(2, '0');
|
|
13
|
-
const sDisplay = tc.seconds.seconds.toString().padStart(2, '0');
|
|
14
|
-
return `${dDisplay}${hDisplay}:${mDisplay}:${sDisplay}`;
|
|
15
|
-
};
|
|
16
|
-
export const getTimeComponentsFromSeconds = (timeInSec) => {
|
|
17
|
-
const days = Duration.days(Math.floor(timeInSec / 86_400));
|
|
18
|
-
const hours = Duration.hours(Math.floor((timeInSec % 86_400) / 3600));
|
|
19
|
-
const minutes = Duration.minutes(Math.floor((timeInSec % 3600) / 60));
|
|
20
|
-
const seconds = Duration.seconds(Math.floor(timeInSec % 60));
|
|
21
|
-
return { days, hours, minutes, seconds };
|
|
22
|
-
};
|
|
23
|
-
export const getSecondsToHuman = (timeInSec) => {
|
|
24
|
-
const tc = getTimeComponentsFromSeconds(timeInSec);
|
|
25
|
-
const dDisplay = tc.days.days > 0 ? tc.days.toString() + ' ' : '';
|
|
26
|
-
const hDisplay = tc.hours.hours > 0 ? tc.hours.toString() + ' ' : '';
|
|
27
|
-
const mDisplay = tc.minutes.minutes > 0 ? tc.minutes.toString() + ' ' : '';
|
|
28
|
-
const sDisplay = tc.seconds.seconds > 0 ? tc.seconds.toString() : '';
|
|
29
|
-
return (dDisplay + hDisplay + mDisplay + sDisplay).trim();
|
|
30
|
-
};
|
|
31
|
-
//# sourceMappingURL=timeUtils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"timeUtils.js","sourceRoot":"","sources":["../../src/shared/timeUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAS3C,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,SAAiB,EAAU,EAAE;IAC9D,MAAM,EAAE,GAAG,4BAA4B,CAAC,SAAS,CAAC,CAAC;IAEnD,MAAM,QAAQ,GAAW,EAAE,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/E,MAAM,QAAQ,GAAW,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACpE,MAAM,QAAQ,GAAW,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACxE,MAAM,QAAQ,GAAW,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAExE,OAAO,GAAG,QAAQ,GAAG,QAAQ,IAAI,QAAQ,IAAI,QAAQ,E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