@salesforce/b2c-cli 1.0.1 → 1.1.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/dist/commands/code/deploy.js +10 -0
- package/dist/commands/code/deploy.js.map +1 -1
- package/dist/commands/code/watch.js +10 -0
- package/dist/commands/code/watch.js.map +1 -1
- package/dist/commands/job/export.js +20 -0
- package/dist/commands/job/export.js.map +1 -1
- package/dist/commands/job/import.js +19 -0
- package/dist/commands/job/import.js.map +1 -1
- package/dist/commands/job/run.js +9 -0
- package/dist/commands/job/run.js.map +1 -1
- package/dist/commands/sandbox/realm/configuration.d.ts +19 -0
- package/dist/commands/sandbox/realm/configuration.js +86 -0
- package/dist/commands/sandbox/realm/configuration.js.map +1 -0
- package/dist/commands/sandbox/realm/get.js +1 -1
- package/dist/commands/sandbox/realm/get.js.map +1 -1
- package/dist/commands/sandbox/realm/list.d.ts +3 -6
- package/dist/commands/sandbox/realm/list.js +7 -28
- package/dist/commands/sandbox/realm/list.js.map +1 -1
- package/dist/commands/sandbox/realm/update.js +1 -1
- package/dist/commands/sandbox/realm/update.js.map +1 -1
- package/dist/commands/sandbox/realm/usage.js +1 -1
- package/dist/commands/sandbox/realm/usage.js.map +1 -1
- package/dist/commands/sandbox/realm/usages.d.ts +23 -0
- package/dist/commands/sandbox/realm/usages.js +105 -0
- package/dist/commands/sandbox/realm/usages.js.map +1 -0
- package/dist/commands/sandbox/settings.d.ts +19 -0
- package/dist/commands/sandbox/settings.js +76 -0
- package/dist/commands/sandbox/settings.js.map +1 -0
- package/dist/commands/sandbox/storage.d.ts +19 -0
- package/dist/commands/sandbox/storage.js +64 -0
- package/dist/commands/sandbox/storage.js.map +1 -0
- package/oclif.manifest.json +2540 -1546
- package/package.json +2 -2
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { OdsCommand } from '@salesforce/b2c-tooling-sdk/cli';
|
|
2
|
+
import { type OdsComponents } from '@salesforce/b2c-tooling-sdk';
|
|
3
|
+
type MultiRealmUsageModel = OdsComponents['schemas']['MultiRealmUsageModel'];
|
|
4
|
+
type MultiRealmUsageResponse = OdsComponents['schemas']['MultiRealmUsageResponse'];
|
|
5
|
+
/**
|
|
6
|
+
* Show usage information for multiple realms.
|
|
7
|
+
*/
|
|
8
|
+
export default class SandboxRealmUsages extends OdsCommand<typeof SandboxRealmUsages> {
|
|
9
|
+
static aliases: string[];
|
|
10
|
+
static description: string;
|
|
11
|
+
static enableJsonFlag: boolean;
|
|
12
|
+
static examples: string[];
|
|
13
|
+
static flags: {
|
|
14
|
+
readonly realm: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
readonly from: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
readonly to: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
readonly 'detailed-report': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
18
|
+
};
|
|
19
|
+
run(): Promise<MultiRealmUsageModel[] | MultiRealmUsageResponse | undefined>;
|
|
20
|
+
private printUsage;
|
|
21
|
+
private resolveRealms;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025, Salesforce, Inc.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2
|
|
4
|
+
* For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Flags } from '@oclif/core';
|
|
7
|
+
import { OdsCommand } from '@salesforce/b2c-tooling-sdk/cli';
|
|
8
|
+
import { getApiErrorMessage } from '@salesforce/b2c-tooling-sdk';
|
|
9
|
+
import { t, withDocs } from '../../../i18n/index.js';
|
|
10
|
+
/**
|
|
11
|
+
* Show usage information for multiple realms.
|
|
12
|
+
*/
|
|
13
|
+
export default class SandboxRealmUsages extends OdsCommand {
|
|
14
|
+
static aliases = ['ods:realm:usages'];
|
|
15
|
+
static description = withDocs(t('commands.realm.usages.description', 'Show usage information for multiple realms'), '/cli/realm.html#b2c-realm-usages');
|
|
16
|
+
static enableJsonFlag = true;
|
|
17
|
+
static examples = [
|
|
18
|
+
'<%= config.bin %> <%= command.id %>',
|
|
19
|
+
'<%= config.bin %> <%= command.id %> --realm zzzz --realm yyyy',
|
|
20
|
+
'<%= config.bin %> <%= command.id %> --realm zzzz,yyyy --from 2026-02-08 --to 2026-02-11',
|
|
21
|
+
'<%= config.bin %> <%= command.id %> --detailed-report --json',
|
|
22
|
+
];
|
|
23
|
+
static flags = {
|
|
24
|
+
realm: Flags.string({
|
|
25
|
+
description: 'Realm ID(s). Repeat flag or provide comma-separated values',
|
|
26
|
+
multiple: true,
|
|
27
|
+
multipleNonGreedy: true,
|
|
28
|
+
delimiter: ',',
|
|
29
|
+
}),
|
|
30
|
+
from: Flags.string({
|
|
31
|
+
description: 'Earliest date to include in usage (ISO 8601)',
|
|
32
|
+
}),
|
|
33
|
+
to: Flags.string({
|
|
34
|
+
description: 'Latest date to include in usage (ISO 8601)',
|
|
35
|
+
}),
|
|
36
|
+
'detailed-report': Flags.boolean({
|
|
37
|
+
description: 'Include detailed usage information in the response',
|
|
38
|
+
default: false,
|
|
39
|
+
}),
|
|
40
|
+
};
|
|
41
|
+
async run() {
|
|
42
|
+
const { flags } = await this.parse(SandboxRealmUsages);
|
|
43
|
+
const realms = await this.resolveRealms(flags.realm);
|
|
44
|
+
if (realms.length === 0) {
|
|
45
|
+
this.log(t('commands.realm.usages.noRealms', 'No realms found for the current user.'));
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
const result = await this.odsClient.POST('/realms/usages', {
|
|
49
|
+
body: {
|
|
50
|
+
from: flags.from,
|
|
51
|
+
to: flags.to,
|
|
52
|
+
realms,
|
|
53
|
+
detailedReport: flags['detailed-report'],
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
if (result.error) {
|
|
57
|
+
this.error(t('commands.realm.usages.error', 'Failed to fetch multi-realm usage: {{message}}', {
|
|
58
|
+
message: getApiErrorMessage(result.error, result.response),
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
const data = result.data?.data;
|
|
62
|
+
if (!data || data.length === 0) {
|
|
63
|
+
this.log(t('commands.realm.usages.noData', 'No usage data was returned for the requested realms.'));
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
if (this.jsonEnabled()) {
|
|
67
|
+
return result.data;
|
|
68
|
+
}
|
|
69
|
+
this.printUsage(data);
|
|
70
|
+
return data;
|
|
71
|
+
}
|
|
72
|
+
printUsage(items) {
|
|
73
|
+
console.log('Realm Active Created Deleted Minutes Up Minutes Down Sandbox Seconds');
|
|
74
|
+
console.log('───── ────── ─────── ─────── ────────── ──────────── ───────────────');
|
|
75
|
+
for (const item of items) {
|
|
76
|
+
const usage = item.realmUsage;
|
|
77
|
+
const row = [
|
|
78
|
+
String(item.realmName ?? '-').padEnd(5),
|
|
79
|
+
String(usage?.activeSandboxes ?? '-').padStart(6),
|
|
80
|
+
String(usage?.createdSandboxes ?? '-').padStart(7),
|
|
81
|
+
String(usage?.deletedSandboxes ?? '-').padStart(7),
|
|
82
|
+
String(usage?.minutesUp ?? '-').padStart(10),
|
|
83
|
+
String(usage?.minutesDown ?? '-').padStart(12),
|
|
84
|
+
String(usage?.sandboxSeconds ?? '-').padStart(15),
|
|
85
|
+
];
|
|
86
|
+
console.log(row.join(' '));
|
|
87
|
+
if (item.error) {
|
|
88
|
+
console.log(` ! ${item.error}`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
async resolveRealms(inputRealms) {
|
|
93
|
+
if (inputRealms && inputRealms.length > 0) {
|
|
94
|
+
return inputRealms;
|
|
95
|
+
}
|
|
96
|
+
const meResult = await this.odsClient.GET('/me', {});
|
|
97
|
+
if (meResult.error || !meResult.data?.data?.realms) {
|
|
98
|
+
this.error(t('commands.realm.usages.realmsError', 'Failed to resolve realms from current user: {{message}}', {
|
|
99
|
+
message: getApiErrorMessage(meResult.error, meResult.response),
|
|
100
|
+
}));
|
|
101
|
+
}
|
|
102
|
+
return meResult.data.data.realms ?? [];
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=usages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usages.js","sourceRoot":"","sources":["../../../../src/commands/sandbox/realm/usages.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAC;AAClC,OAAO,EAAC,UAAU,EAAC,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAC,kBAAkB,EAAqB,MAAM,6BAA6B,CAAC;AACnF,OAAO,EAAC,CAAC,EAAE,QAAQ,EAAC,MAAM,wBAAwB,CAAC;AAKnD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,UAAqC;IACnF,MAAM,CAAC,OAAO,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAEtC,MAAM,CAAC,WAAW,GAAG,QAAQ,CAC3B,CAAC,CAAC,mCAAmC,EAAE,4CAA4C,CAAC,EACpF,kCAAkC,CACnC,CAAC;IAEF,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC;IAE7B,MAAM,CAAC,QAAQ,GAAG;QAChB,qCAAqC;QACrC,+DAA+D;QAC/D,yFAAyF;QACzF,8DAA8D;KAC/D,CAAC;IAEF,MAAM,CAAC,KAAK,GAAG;QACb,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC;YAClB,WAAW,EAAE,4DAA4D;YACzE,QAAQ,EAAE,IAAI;YACd,iBAAiB,EAAE,IAAI;YACvB,SAAS,EAAE,GAAG;SACf,CAAC;QACF,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE,8CAA8C;SA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C,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;YACnC,CAAC;QACH,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,aAAa,CAAC,WAAiC;QAC3D,IAAI,WAAW,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC1C,OAAO,WAAW,CAAC;QACrB,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACrD,IAAI,QAAQ,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;YACnD,IAAI,CAAC,KAAK,CACR,CAAC,CAAC,mCAAmC,EAAE,yDAAyD,EAAE;gBAChG,OAAO,EAAE,kBAAkB,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC;aAC/D,CAAC,CACH,CAAC;QACJ,CAAC;QAED,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;IACzC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { OdsCommand } from '@salesforce/b2c-tooling-sdk/cli';
|
|
2
|
+
import { type OdsComponents } from '@salesforce/b2c-tooling-sdk';
|
|
3
|
+
type SandboxSettings = OdsComponents['schemas']['SandboxSettings'];
|
|
4
|
+
type SandboxSettingsResponse = OdsComponents['schemas']['SandboxSettingsResponse'];
|
|
5
|
+
/**
|
|
6
|
+
* Show sandbox settings.
|
|
7
|
+
*/
|
|
8
|
+
export default class SandboxSettingsCommand extends OdsCommand<typeof SandboxSettingsCommand> {
|
|
9
|
+
static aliases: string[];
|
|
10
|
+
static args: {
|
|
11
|
+
sandboxId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
12
|
+
};
|
|
13
|
+
static description: string;
|
|
14
|
+
static enableJsonFlag: boolean;
|
|
15
|
+
static examples: string[];
|
|
16
|
+
run(): Promise<SandboxSettings | SandboxSettingsResponse | undefined>;
|
|
17
|
+
private printSettings;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025, Salesforce, Inc.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2
|
|
4
|
+
* For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Args } from '@oclif/core';
|
|
7
|
+
import { OdsCommand } from '@salesforce/b2c-tooling-sdk/cli';
|
|
8
|
+
import { getApiErrorMessage } from '@salesforce/b2c-tooling-sdk';
|
|
9
|
+
import { t, withDocs } from '../../i18n/index.js';
|
|
10
|
+
/**
|
|
11
|
+
* Show sandbox settings.
|
|
12
|
+
*/
|
|
13
|
+
export default class SandboxSettingsCommand extends OdsCommand {
|
|
14
|
+
static aliases = ['ods:settings'];
|
|
15
|
+
static args = {
|
|
16
|
+
sandboxId: Args.string({
|
|
17
|
+
description: 'Sandbox ID (UUID or realm-instance, e.g., zzzz-001)',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
};
|
|
21
|
+
static description = withDocs(t('commands.sandbox.settings.description', 'Show settings for a specific sandbox'), '/cli/sandbox.html#b2c-sandbox-settings');
|
|
22
|
+
static enableJsonFlag = true;
|
|
23
|
+
static examples = [
|
|
24
|
+
'<%= config.bin %> <%= command.id %> zzzz-001',
|
|
25
|
+
'<%= config.bin %> <%= command.id %> zzzz-001 --json',
|
|
26
|
+
];
|
|
27
|
+
async run() {
|
|
28
|
+
const { args } = await this.parse(SandboxSettingsCommand);
|
|
29
|
+
const sandboxId = await this.resolveSandboxId(args.sandboxId);
|
|
30
|
+
const result = await this.odsClient.GET('/sandboxes/{sandboxId}/settings', {
|
|
31
|
+
params: {
|
|
32
|
+
path: { sandboxId },
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
if (result.error) {
|
|
36
|
+
this.error(t('commands.sandbox.settings.error', 'Failed to fetch sandbox settings: {{message}}', {
|
|
37
|
+
message: getApiErrorMessage(result.error, result.response),
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
const data = result.data?.data;
|
|
41
|
+
if (!data) {
|
|
42
|
+
this.log(t('commands.sandbox.settings.noData', 'No settings were returned for this sandbox.'));
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
if (this.jsonEnabled()) {
|
|
46
|
+
return result.data;
|
|
47
|
+
}
|
|
48
|
+
this.printSettings(data);
|
|
49
|
+
return data;
|
|
50
|
+
}
|
|
51
|
+
printSettings(settings) {
|
|
52
|
+
const ocapi = settings.ocapi ?? [];
|
|
53
|
+
const webdav = settings.webdav ?? [];
|
|
54
|
+
console.log('Sandbox Settings');
|
|
55
|
+
console.log('────────────────');
|
|
56
|
+
console.log(`OCAPI client entries: ${ocapi.length}`);
|
|
57
|
+
console.log(`WebDAV client entries: ${webdav.length}`);
|
|
58
|
+
if (ocapi.length > 0) {
|
|
59
|
+
console.log();
|
|
60
|
+
console.log('OCAPI');
|
|
61
|
+
for (const entry of ocapi) {
|
|
62
|
+
const resources = entry.resources?.length ?? 0;
|
|
63
|
+
console.log(` - ${entry.client_id ?? 'unknown-client'} (${resources} resource rules)`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (webdav.length > 0) {
|
|
67
|
+
console.log();
|
|
68
|
+
console.log('WebDAV');
|
|
69
|
+
for (const entry of webdav) {
|
|
70
|
+
const permissions = entry.permissions?.length ?? 0;
|
|
71
|
+
console.log(` - ${entry.client_id ?? 'unknown-client'} (${permissions} permission rules)`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.js","source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AAC,SAAS,IAAI,gBAAgB,KAAK,SAAS,kBAAkB,CAAC,CAAC;YAC1F,CAAC;QACH,CAAC;QAED,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtB,OAAO,CAAC,GAAG,EAAE,CAAC;YACd,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACtB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;gBAC3B,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,EAAE,MAAM,IAAI,CAAC,CAAC;gBACnD,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,CAAC,SAAS,IAAI,gBAAgB,KAAK,WAAW,oBAAoB,CAAC,CAAC;YAC9F,CAAC;QACH,CAAC;IACH,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { OdsCommand } from '@salesforce/b2c-tooling-sdk/cli';
|
|
2
|
+
import { type OdsComponents } from '@salesforce/b2c-tooling-sdk';
|
|
3
|
+
type SandboxStorageModel = OdsComponents['schemas']['SandboxStorageModel'];
|
|
4
|
+
type SandboxStorageResponse = OdsComponents['schemas']['SandboxStorageResponse'];
|
|
5
|
+
/**
|
|
6
|
+
* Show sandbox storage details.
|
|
7
|
+
*/
|
|
8
|
+
export default class SandboxStorage extends OdsCommand<typeof SandboxStorage> {
|
|
9
|
+
static aliases: string[];
|
|
10
|
+
static args: {
|
|
11
|
+
sandboxId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
12
|
+
};
|
|
13
|
+
static description: string;
|
|
14
|
+
static enableJsonFlag: boolean;
|
|
15
|
+
static examples: string[];
|
|
16
|
+
run(): Promise<SandboxStorageModel | SandboxStorageResponse | undefined>;
|
|
17
|
+
private printStorage;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025, Salesforce, Inc.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2
|
|
4
|
+
* For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Args } from '@oclif/core';
|
|
7
|
+
import { OdsCommand } from '@salesforce/b2c-tooling-sdk/cli';
|
|
8
|
+
import { getApiErrorMessage } from '@salesforce/b2c-tooling-sdk';
|
|
9
|
+
import { t, withDocs } from '../../i18n/index.js';
|
|
10
|
+
/**
|
|
11
|
+
* Show sandbox storage details.
|
|
12
|
+
*/
|
|
13
|
+
export default class SandboxStorage extends OdsCommand {
|
|
14
|
+
static aliases = ['ods:storage'];
|
|
15
|
+
static args = {
|
|
16
|
+
sandboxId: Args.string({
|
|
17
|
+
description: 'Sandbox ID (UUID or realm-instance, e.g., zzzz-001)',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
};
|
|
21
|
+
static description = withDocs(t('commands.sandbox.storage.description', 'Show storage details for a specific sandbox'), '/cli/sandbox.html#b2c-sandbox-storage');
|
|
22
|
+
static enableJsonFlag = true;
|
|
23
|
+
static examples = [
|
|
24
|
+
'<%= config.bin %> <%= command.id %> zzzz-001',
|
|
25
|
+
'<%= config.bin %> <%= command.id %> zzzz-001 --json',
|
|
26
|
+
];
|
|
27
|
+
async run() {
|
|
28
|
+
const { args } = await this.parse(SandboxStorage);
|
|
29
|
+
const sandboxId = await this.resolveSandboxId(args.sandboxId);
|
|
30
|
+
const result = await this.odsClient.GET('/sandboxes/{sandboxId}/storage', {
|
|
31
|
+
params: {
|
|
32
|
+
path: { sandboxId },
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
if (result.error) {
|
|
36
|
+
this.error(t('commands.sandbox.storage.error', 'Failed to fetch sandbox storage: {{message}}', {
|
|
37
|
+
message: getApiErrorMessage(result.error, result.response),
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
const data = result.data?.data;
|
|
41
|
+
if (!data || Object.keys(data).length === 0) {
|
|
42
|
+
this.log(t('commands.sandbox.storage.noData', 'No storage data was returned for this sandbox.'));
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
if (this.jsonEnabled()) {
|
|
46
|
+
return result.data;
|
|
47
|
+
}
|
|
48
|
+
this.printStorage(data);
|
|
49
|
+
return data;
|
|
50
|
+
}
|
|
51
|
+
printStorage(storage) {
|
|
52
|
+
console.log('Sandbox Storage');
|
|
53
|
+
console.log('───────────────');
|
|
54
|
+
console.log('Filesystem Total (MB) Used (MB) Used (%)');
|
|
55
|
+
console.log('──────────────────────── ────────── ───────── ────────');
|
|
56
|
+
for (const [name, usage] of Object.entries(storage)) {
|
|
57
|
+
const total = usage?.spaceTotal ?? '-';
|
|
58
|
+
const used = usage?.spaceUsed ?? '-';
|
|
59
|
+
const percentage = usage?.percentageUsed ?? '-';
|
|
60
|
+
console.log(`${name.padEnd(24)} ${String(total).padStart(10)} ${String(used).padStart(9)} ${String(percentage).padStart(8)}`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../../src/commands/sandbox/storage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,IAAI,EAAC,MAAM,aAAa,CAAC;AACjC,OAAO,EAAC,UAAU,EAAC,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAC,kBAAkB,EAAqB,MAAM,6BAA6B,CAAC;AACnF,OAAO,EAAC,CAAC,EAAE,QAAQ,EAAC,MAAM,qBAAqB,CAAC;AAKhD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,UAAiC;IAC3E,MAAM,CAAC,OAAO,GAAG,CAAC,aAAa,CAAC,CAAC;IAEjC,MAAM,CAAC,IAAI,GAAG;QACZ,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC;YACrB,WAAW,EAAE,qDAAqD;YAClE,QAAQ,EAAE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