@salesforce/b2c-cli 1.5.0 → 1.6.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/cap/install.d.ts +49 -0
- package/dist/commands/cap/install.js +138 -0
- package/dist/commands/cap/install.js.map +1 -0
- package/dist/commands/cap/list.d.ts +47 -0
- package/dist/commands/cap/list.js +172 -0
- package/dist/commands/cap/list.js.map +1 -0
- package/dist/commands/cap/package.d.ts +17 -0
- package/dist/commands/cap/package.js +55 -0
- package/dist/commands/cap/package.js.map +1 -0
- package/dist/commands/cap/pull.d.ts +48 -0
- package/dist/commands/cap/pull.js +121 -0
- package/dist/commands/cap/pull.js.map +1 -0
- package/dist/commands/cap/tasks.d.ts +56 -0
- package/dist/commands/cap/tasks.js +90 -0
- package/dist/commands/cap/tasks.js.map +1 -0
- package/dist/commands/cap/uninstall.d.ts +47 -0
- package/dist/commands/cap/uninstall.js +123 -0
- package/dist/commands/cap/uninstall.js.map +1 -0
- package/dist/commands/cap/validate.d.ts +11 -0
- package/dist/commands/cap/validate.js +49 -0
- package/dist/commands/cap/validate.js.map +1 -0
- package/oclif.manifest.json +7187 -5185
- package/package.json +3 -2
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { JobCommand } from '@salesforce/b2c-tooling-sdk/cli';
|
|
2
|
+
import { commerceAppInstall, validateCap, type CommerceAppInstallResult } from '@salesforce/b2c-tooling-sdk/operations/cap';
|
|
3
|
+
export default class CapInstall extends JobCommand<typeof CapInstall> {
|
|
4
|
+
static args: {
|
|
5
|
+
path: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
};
|
|
7
|
+
static description: string;
|
|
8
|
+
static enableJsonFlag: boolean;
|
|
9
|
+
static examples: string[];
|
|
10
|
+
static flags: {
|
|
11
|
+
'site-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
'clean-archive': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
timeout: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
'skip-validate': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
|
+
server: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
'webdav-server': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
'code-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
username: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
password: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
certificate: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
passphrase: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
|
+
selfsigned: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
23
|
+
verify: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
24
|
+
'client-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
25
|
+
'client-secret': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
26
|
+
'auth-scope': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
27
|
+
'short-code': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
28
|
+
'tenant-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
29
|
+
'auth-methods': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
30
|
+
'user-auth': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
31
|
+
'account-manager-host': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
32
|
+
'log-level': import("@oclif/core/interfaces").OptionFlag<"trace" | "debug" | "info" | "warn" | "error" | "silent" | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
33
|
+
debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
34
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
35
|
+
jsonl: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
36
|
+
lang: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
37
|
+
config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
38
|
+
instance: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
39
|
+
'project-directory': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
40
|
+
'extra-query': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
41
|
+
'extra-body': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
42
|
+
'extra-headers': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
43
|
+
};
|
|
44
|
+
protected operations: {
|
|
45
|
+
commerceAppInstall: typeof commerceAppInstall;
|
|
46
|
+
validateCap: typeof validateCap;
|
|
47
|
+
};
|
|
48
|
+
run(): Promise<CommerceAppInstallResult>;
|
|
49
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
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, Flags } from '@oclif/core';
|
|
7
|
+
import { JobCommand } from '@salesforce/b2c-tooling-sdk/cli';
|
|
8
|
+
import { commerceAppInstall, validateCap, JobExecutionError, } from '@salesforce/b2c-tooling-sdk/operations/cap';
|
|
9
|
+
import { t, withDocs } from '../../i18n/index.js';
|
|
10
|
+
export default class CapInstall extends JobCommand {
|
|
11
|
+
static args = {
|
|
12
|
+
path: Args.string({
|
|
13
|
+
description: 'Path to a CAP directory or .zip file',
|
|
14
|
+
required: true,
|
|
15
|
+
}),
|
|
16
|
+
};
|
|
17
|
+
static description = withDocs(t('commands.cap.install.description', 'Install a Commerce App Package (CAP) on a B2C Commerce instance'), '/cli/cap.html#b2c-cap-install');
|
|
18
|
+
static enableJsonFlag = true;
|
|
19
|
+
static examples = [
|
|
20
|
+
'<%= config.bin %> <%= command.id %> ./commerce-avalara-tax-app-v0.2.5 --site RefArch',
|
|
21
|
+
'<%= config.bin %> <%= command.id %> ./commerce-avalara-tax-app-v0.2.5.zip --site RefArch',
|
|
22
|
+
'<%= config.bin %> <%= command.id %> ./commerce-avalara-tax-app-v0.2.5 --site RefArch --skip-validate',
|
|
23
|
+
];
|
|
24
|
+
static flags = {
|
|
25
|
+
...JobCommand.baseFlags,
|
|
26
|
+
'site-id': Flags.string({
|
|
27
|
+
char: 's',
|
|
28
|
+
description: 'Site ID to install the Commerce App on',
|
|
29
|
+
required: true,
|
|
30
|
+
aliases: ['site'],
|
|
31
|
+
}),
|
|
32
|
+
'clean-archive': Flags.boolean({
|
|
33
|
+
description: 'Delete the uploaded zip from the instance after install',
|
|
34
|
+
default: false,
|
|
35
|
+
}),
|
|
36
|
+
timeout: Flags.integer({
|
|
37
|
+
char: 't',
|
|
38
|
+
description: 'Timeout in seconds (default: no timeout)',
|
|
39
|
+
}),
|
|
40
|
+
'skip-validate': Flags.boolean({
|
|
41
|
+
description: 'Skip CAP structure validation before install',
|
|
42
|
+
default: false,
|
|
43
|
+
}),
|
|
44
|
+
};
|
|
45
|
+
operations = {
|
|
46
|
+
commerceAppInstall,
|
|
47
|
+
validateCap,
|
|
48
|
+
};
|
|
49
|
+
async run() {
|
|
50
|
+
this.requireOAuthCredentials();
|
|
51
|
+
this.requireWebDavCredentials();
|
|
52
|
+
const { path } = this.args;
|
|
53
|
+
const { 'site-id': site, 'clean-archive': cleanArchive, timeout, 'skip-validate': skipValidate } = this.flags;
|
|
54
|
+
const hostname = this.resolvedConfig.values.hostname;
|
|
55
|
+
// Validate first unless skipped
|
|
56
|
+
if (!skipValidate) {
|
|
57
|
+
this.log(t('commands.cap.install.validating', 'Validating CAP structure...'));
|
|
58
|
+
const validation = await this.operations.validateCap(path);
|
|
59
|
+
if (!validation.valid) {
|
|
60
|
+
for (const err of validation.errors) {
|
|
61
|
+
this.log(` ✗ ${err}`);
|
|
62
|
+
}
|
|
63
|
+
this.error(t('commands.cap.install.validationFailed', 'CAP validation failed — use --skip-validate to bypass'), { exit: 1 });
|
|
64
|
+
}
|
|
65
|
+
if (validation.warnings.length > 0) {
|
|
66
|
+
for (const warn of validation.warnings) {
|
|
67
|
+
this.log(` ⚠ ${warn}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
this.log(t('commands.cap.install.installing', 'Installing CAP {{path}} to {{hostname}} (site: {{site}})...', {
|
|
72
|
+
path,
|
|
73
|
+
hostname,
|
|
74
|
+
site,
|
|
75
|
+
}));
|
|
76
|
+
const context = this.createContext('cap:install', { path, site, hostname });
|
|
77
|
+
const beforeResult = await this.runBeforeHooks(context);
|
|
78
|
+
if (beforeResult.skip) {
|
|
79
|
+
this.log(t('commands.cap.install.skipped', 'Install skipped: {{reason}}', {
|
|
80
|
+
reason: beforeResult.skipReason || 'skipped by plugin',
|
|
81
|
+
}));
|
|
82
|
+
return {
|
|
83
|
+
execution: { execution_status: 'finished', exit_status: { code: 'skipped' } },
|
|
84
|
+
appName: '',
|
|
85
|
+
appVersion: '',
|
|
86
|
+
archiveFilename: '',
|
|
87
|
+
archiveKept: false,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
try {
|
|
91
|
+
const result = await this.operations.commerceAppInstall(this.instance, path, {
|
|
92
|
+
siteId: site,
|
|
93
|
+
keepArchive: !cleanArchive,
|
|
94
|
+
waitOptions: {
|
|
95
|
+
timeoutSeconds: timeout || undefined,
|
|
96
|
+
onPoll: (info) => {
|
|
97
|
+
if (!this.jsonEnabled()) {
|
|
98
|
+
this.log(t('commands.cap.install.progress', ' Status: {{status}} ({{elapsed}}s elapsed)', {
|
|
99
|
+
status: info.status,
|
|
100
|
+
elapsed: Math.floor(info.elapsedSeconds).toString(),
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
const durationSec = result.execution.duration ? (result.execution.duration / 1000).toFixed(1) : 'N/A';
|
|
107
|
+
this.log(t('commands.cap.install.completed', 'Install completed: {{status}} (duration: {{duration}}s)', {
|
|
108
|
+
status: result.execution.exit_status?.code || result.execution.execution_status,
|
|
109
|
+
duration: durationSec,
|
|
110
|
+
}));
|
|
111
|
+
await this.runAfterHooks(context, {
|
|
112
|
+
success: true,
|
|
113
|
+
duration: Date.now() - context.startTime,
|
|
114
|
+
data: result,
|
|
115
|
+
});
|
|
116
|
+
return result;
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
await this.runAfterHooks(context, {
|
|
120
|
+
success: false,
|
|
121
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
122
|
+
duration: Date.now() - context.startTime,
|
|
123
|
+
data: error instanceof JobExecutionError ? error.execution : undefined,
|
|
124
|
+
});
|
|
125
|
+
if (error instanceof JobExecutionError) {
|
|
126
|
+
await this.showJobLog(error.execution);
|
|
127
|
+
this.error(t('commands.cap.install.failed', 'Install failed: {{status}}', {
|
|
128
|
+
status: error.execution.exit_status?.code || 'ERROR',
|
|
129
|
+
}));
|
|
130
|
+
}
|
|
131
|
+
if (error instanceof Error) {
|
|
132
|
+
this.error(t('commands.cap.install.error', 'Install error: {{message}}', { message: error.message }));
|
|
133
|
+
}
|
|
134
|
+
throw error;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=install.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../../src/commands/cap/install.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,IAAI,EAAE,KAAK,EAAC,MAAM,aAAa,CAAC;AACxC,OAAO,EAAC,UAAU,EAAC,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,iBAAiB,GAElB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAC,CAAC,EAAE,QAAQ,EAAC,MAAM,qBAAqB,CAAC;AAEhD,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,UAA6B;IACnE,MAAM,CAAC,IAAI,GAAG;QACZ,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;YAChB,WAAW,EAAE,sCAAsC;YACnD,QAAQ,EAAE,IAAI;SACf,CAAC;KACH,CAAC;IAEF,MAAM,CAAC,WAAW,GAAG,QAAQ,CAC3B,CAAC,CAAC,kCAAkC,EAAE,iEAAiE,CAAC,EACxG,+BAA+B,CAChC,CAAC;IAEF,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC;IAE7B,MAAM,CAAC,QAAQ,GAAG;QAChB,sFAAsF;QACtF,0FAA0F;QAC1F,sGAAsG;KACvG,CAAC;IAEF,MAAM,CAAC,KAAK,GAAG;QACb,GAAG,UAAU,CAAC,SAAS;QACvB,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC;YACtB,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,wCAAwC;YACr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AC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBAChE,QAAQ,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,SAAS;gBACxC,IAAI,EAAE,KAAK,YAAY,iBAAiB,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;aACvE,CAAC,CAAC;YAEH,IAAI,KAAK,YAAY,iBAAiB,EAAE,CAAC;gBACvC,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;gBACvC,IAAI,CAAC,KAAK,CACR,CAAC,CAAC,6BAA6B,EAAE,4BAA4B,EAAE;oBAC7D,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,IAAI,OAAO;iBACrD,CAAC,CACH,CAAC;YACJ,CAAC;YACD,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;gBAC3B,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,4BAA4B,EAAE,4BAA4B,EAAE,EAAC,OAAO,EAAE,KAAK,CAAC,OAAO,EAAC,CAAC,CAAC,CAAC;YACtG,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { JobCommand } from '@salesforce/b2c-tooling-sdk/cli';
|
|
2
|
+
import { discoverLocalApps, listInstalledApps, type LocalCommerceApp, type ListInstalledAppsResult } from '@salesforce/b2c-tooling-sdk/operations/cap';
|
|
3
|
+
export default class CapList extends JobCommand<typeof CapList> {
|
|
4
|
+
static description: string;
|
|
5
|
+
static enableJsonFlag: boolean;
|
|
6
|
+
static examples: string[];
|
|
7
|
+
static flags: {
|
|
8
|
+
local: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
'site-id': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
timeout: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
server: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
'webdav-server': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
'code-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
username: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
password: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
certificate: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
passphrase: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
selfsigned: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
19
|
+
verify: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
20
|
+
'client-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
'client-secret': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
|
+
'auth-scope': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
23
|
+
'short-code': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
24
|
+
'tenant-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
25
|
+
'auth-methods': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
26
|
+
'user-auth': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
27
|
+
'account-manager-host': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
28
|
+
'log-level': import("@oclif/core/interfaces").OptionFlag<"trace" | "debug" | "info" | "warn" | "error" | "silent" | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
29
|
+
debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
30
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
31
|
+
jsonl: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
32
|
+
lang: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
33
|
+
config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
34
|
+
instance: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
35
|
+
'project-directory': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
36
|
+
'extra-query': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
37
|
+
'extra-body': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
38
|
+
'extra-headers': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
39
|
+
};
|
|
40
|
+
protected operations: {
|
|
41
|
+
discoverLocalApps: typeof discoverLocalApps;
|
|
42
|
+
listInstalledApps: typeof listInstalledApps;
|
|
43
|
+
};
|
|
44
|
+
run(): Promise<ListInstalledAppsResult | LocalCommerceApp[]>;
|
|
45
|
+
private runLocal;
|
|
46
|
+
private runRemote;
|
|
47
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
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 { JobCommand, createTable } from '@salesforce/b2c-tooling-sdk/cli';
|
|
8
|
+
import { discoverLocalApps, listInstalledApps, } from '@salesforce/b2c-tooling-sdk/operations/cap';
|
|
9
|
+
import { t, withDocs } from '../../i18n/index.js';
|
|
10
|
+
const LOCAL_COLUMNS = {
|
|
11
|
+
path: {
|
|
12
|
+
header: 'Path',
|
|
13
|
+
get: (app) => app.path,
|
|
14
|
+
},
|
|
15
|
+
id: {
|
|
16
|
+
header: 'ID',
|
|
17
|
+
get: (app) => app.manifest.id,
|
|
18
|
+
},
|
|
19
|
+
name: {
|
|
20
|
+
header: 'Name',
|
|
21
|
+
get: (app) => app.manifest.name,
|
|
22
|
+
},
|
|
23
|
+
version: {
|
|
24
|
+
header: 'Version',
|
|
25
|
+
get: (app) => app.manifest.version,
|
|
26
|
+
},
|
|
27
|
+
domain: {
|
|
28
|
+
header: 'Domain',
|
|
29
|
+
get: (app) => app.manifest.domain,
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
const LOCAL_DEFAULT_COLUMNS = ['id', 'name', 'version', 'domain', 'path'];
|
|
33
|
+
const REMOTE_COLUMNS = {
|
|
34
|
+
siteId: {
|
|
35
|
+
header: 'Site ID',
|
|
36
|
+
get: (s) => s.siteId,
|
|
37
|
+
},
|
|
38
|
+
featureName: {
|
|
39
|
+
header: 'Name',
|
|
40
|
+
get: (s) => s.featureName,
|
|
41
|
+
},
|
|
42
|
+
featureType: {
|
|
43
|
+
header: 'Type',
|
|
44
|
+
get: (s) => s.featureType,
|
|
45
|
+
},
|
|
46
|
+
featureSource: {
|
|
47
|
+
header: 'Source',
|
|
48
|
+
get: (s) => FEATURE_SOURCE_LABELS[s.featureSource] ?? s.featureSource,
|
|
49
|
+
},
|
|
50
|
+
installStatus: {
|
|
51
|
+
header: 'Install Status',
|
|
52
|
+
get: (s) => s.installStatus,
|
|
53
|
+
},
|
|
54
|
+
configStatus: {
|
|
55
|
+
header: 'Config Status',
|
|
56
|
+
get: (s) => s.configStatus,
|
|
57
|
+
},
|
|
58
|
+
version: {
|
|
59
|
+
header: 'Version',
|
|
60
|
+
get: (s) => s.featureVersionId,
|
|
61
|
+
},
|
|
62
|
+
domain: {
|
|
63
|
+
header: 'Domain',
|
|
64
|
+
get: (s) => s.featureDomain,
|
|
65
|
+
},
|
|
66
|
+
installedAt: {
|
|
67
|
+
header: 'Installed At',
|
|
68
|
+
get: (s) => s.installedAt,
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
const FEATURE_SOURCE_LABELS = {
|
|
72
|
+
WebDAV: 'CUSTOM',
|
|
73
|
+
AppRegistry: 'REGISTRY',
|
|
74
|
+
};
|
|
75
|
+
const REMOTE_DEFAULT_COLUMNS = [
|
|
76
|
+
'siteId',
|
|
77
|
+
'featureName',
|
|
78
|
+
'featureType',
|
|
79
|
+
'featureSource',
|
|
80
|
+
'installStatus',
|
|
81
|
+
'configStatus',
|
|
82
|
+
'version',
|
|
83
|
+
'installedAt',
|
|
84
|
+
];
|
|
85
|
+
export default class CapList extends JobCommand {
|
|
86
|
+
static description = withDocs(t('commands.cap.list.description', 'List Commerce Apps locally or installed on a B2C Commerce instance'), '/cli/cap.html#b2c-cap-list');
|
|
87
|
+
static enableJsonFlag = true;
|
|
88
|
+
static examples = [
|
|
89
|
+
'<%= config.bin %> <%= command.id %> --local',
|
|
90
|
+
'<%= config.bin %> <%= command.id %> --local --project-directory ./my-workspace',
|
|
91
|
+
'<%= config.bin %> <%= command.id %>',
|
|
92
|
+
'<%= config.bin %> <%= command.id %> --site-id RefArch',
|
|
93
|
+
'<%= config.bin %> <%= command.id %> --json',
|
|
94
|
+
];
|
|
95
|
+
static flags = {
|
|
96
|
+
...JobCommand.baseFlags,
|
|
97
|
+
local: Flags.boolean({
|
|
98
|
+
char: 'l',
|
|
99
|
+
description: 'List locally detected Commerce App Packages (no instance required)',
|
|
100
|
+
default: false,
|
|
101
|
+
}),
|
|
102
|
+
'site-id': Flags.string({
|
|
103
|
+
char: 's',
|
|
104
|
+
description: 'Site IDs to query (comma-separated). If omitted, queries all sites.',
|
|
105
|
+
multiple: true,
|
|
106
|
+
multipleNonGreedy: true,
|
|
107
|
+
delimiter: ',',
|
|
108
|
+
aliases: ['site'],
|
|
109
|
+
}),
|
|
110
|
+
timeout: Flags.integer({
|
|
111
|
+
char: 't',
|
|
112
|
+
description: 'Timeout in seconds (default: no timeout)',
|
|
113
|
+
}),
|
|
114
|
+
};
|
|
115
|
+
operations = {
|
|
116
|
+
discoverLocalApps,
|
|
117
|
+
listInstalledApps,
|
|
118
|
+
};
|
|
119
|
+
async run() {
|
|
120
|
+
const { local, 'site-id': siteId, timeout } = this.flags;
|
|
121
|
+
if (local) {
|
|
122
|
+
return this.runLocal();
|
|
123
|
+
}
|
|
124
|
+
return this.runRemote(siteId, timeout);
|
|
125
|
+
}
|
|
126
|
+
async runLocal() {
|
|
127
|
+
const searchPath = this.resolvedConfig.values.projectDirectory || process.cwd();
|
|
128
|
+
this.log(t('commands.cap.list.discovering', 'Discovering Commerce App Packages in {{path}}...', { path: searchPath }));
|
|
129
|
+
const apps = await this.operations.discoverLocalApps(searchPath);
|
|
130
|
+
if (apps.length === 0) {
|
|
131
|
+
this.log(t('commands.cap.list.noLocalApps', 'No Commerce App Packages found.'));
|
|
132
|
+
return apps;
|
|
133
|
+
}
|
|
134
|
+
this.log(t('commands.cap.list.foundLocal', 'Found {{count}} Commerce App Package(s):', { count: apps.length }));
|
|
135
|
+
if (!this.jsonEnabled()) {
|
|
136
|
+
createTable(LOCAL_COLUMNS).render(apps, LOCAL_DEFAULT_COLUMNS);
|
|
137
|
+
}
|
|
138
|
+
return apps;
|
|
139
|
+
}
|
|
140
|
+
async runRemote(site, timeout) {
|
|
141
|
+
this.requireOAuthCredentials();
|
|
142
|
+
this.requireWebDavCredentials();
|
|
143
|
+
const hostname = this.resolvedConfig.values.hostname;
|
|
144
|
+
this.log(t('commands.cap.list.fetching', 'Fetching installed Commerce Apps from {{hostname}}...', { hostname }));
|
|
145
|
+
const result = await this.operations.listInstalledApps(this.instance, {
|
|
146
|
+
sites: site,
|
|
147
|
+
waitOptions: {
|
|
148
|
+
timeoutSeconds: timeout || undefined,
|
|
149
|
+
onPoll: (info) => {
|
|
150
|
+
if (!this.jsonEnabled()) {
|
|
151
|
+
this.log(t('commands.cap.list.progress', ' Status: {{status}} ({{elapsed}}s elapsed)', {
|
|
152
|
+
status: info.status,
|
|
153
|
+
elapsed: Math.floor(info.elapsedSeconds).toString(),
|
|
154
|
+
}));
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
if (result.features.length === 0) {
|
|
160
|
+
this.log(t('commands.cap.list.noInstalledApps', 'No installed Commerce Apps found.'));
|
|
161
|
+
return result;
|
|
162
|
+
}
|
|
163
|
+
this.log(t('commands.cap.list.foundRemote', 'Found {{count}} installed Commerce App(s):', {
|
|
164
|
+
count: result.features.length,
|
|
165
|
+
}));
|
|
166
|
+
if (!this.jsonEnabled()) {
|
|
167
|
+
createTable(REMOTE_COLUMNS).render(result.features, REMOTE_DEFAULT_COLUMNS);
|
|
168
|
+
}
|
|
169
|
+
return result;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/cap/list.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAC;AAClC,OAAO,EAAC,UAAU,EAAE,WAAW,EAAiB,MAAM,iCAAiC,CAAC;AACxF,OAAO,EACL,iBAAiB,EACjB,iBAAiB,GAIlB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAC,CAAC,EAAE,QAAQ,EAAC,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;SACF,CAAC,CAAC;QAEH,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACjC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,mCAAmC,EAAE,mCAAmC,CAAC,CAAC,CAAC;YACtF,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,IAAI,CAAC,GAAG,CACN,CAAC,CAAC,+BAA+B,EAAE,4CAA4C,EAAE;YAC/E,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM;SAC9B,CAAC,CACH,CAAC;QAEF,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACxB,WAAW,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,sBAAsB,CAAC,CAAC;QAC9E,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseCommand } from '@salesforce/b2c-tooling-sdk/cli';
|
|
2
|
+
import { commerceAppPackage, type CommerceAppPackageResult } from '@salesforce/b2c-tooling-sdk/operations/cap';
|
|
3
|
+
export default class CapPackage extends BaseCommand<typeof CapPackage> {
|
|
4
|
+
static args: {
|
|
5
|
+
path: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
};
|
|
7
|
+
static description: string;
|
|
8
|
+
static enableJsonFlag: boolean;
|
|
9
|
+
static examples: string[];
|
|
10
|
+
static flags: {
|
|
11
|
+
output: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
};
|
|
13
|
+
protected operations: {
|
|
14
|
+
commerceAppPackage: typeof commerceAppPackage;
|
|
15
|
+
};
|
|
16
|
+
run(): Promise<CommerceAppPackageResult>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
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, Flags } from '@oclif/core';
|
|
7
|
+
import { BaseCommand } from '@salesforce/b2c-tooling-sdk/cli';
|
|
8
|
+
import { commerceAppPackage } from '@salesforce/b2c-tooling-sdk/operations/cap';
|
|
9
|
+
import { t, withDocs } from '../../i18n/index.js';
|
|
10
|
+
export default class CapPackage extends BaseCommand {
|
|
11
|
+
static args = {
|
|
12
|
+
path: Args.string({
|
|
13
|
+
description: 'Path to the CAP source directory',
|
|
14
|
+
required: true,
|
|
15
|
+
}),
|
|
16
|
+
};
|
|
17
|
+
static description = withDocs(t('commands.cap.package.description', 'Package a Commerce App directory into a distributable .zip file'), '/cli/cap.html#b2c-cap-package');
|
|
18
|
+
static enableJsonFlag = true;
|
|
19
|
+
static examples = [
|
|
20
|
+
'<%= config.bin %> <%= command.id %> ./commerce-avalara-tax-app-v0.2.5',
|
|
21
|
+
'<%= config.bin %> <%= command.id %> ./commerce-avalara-tax-app-v0.2.5 --output ./dist',
|
|
22
|
+
'<%= config.bin %> <%= command.id %> ./commerce-avalara-tax-app-v0.2.5 --output ./dist/my-app.zip',
|
|
23
|
+
];
|
|
24
|
+
static flags = {
|
|
25
|
+
output: Flags.string({
|
|
26
|
+
char: 'o',
|
|
27
|
+
description: 'Output path (directory or .zip filename). Defaults to current directory.',
|
|
28
|
+
}),
|
|
29
|
+
};
|
|
30
|
+
operations = {
|
|
31
|
+
commerceAppPackage,
|
|
32
|
+
};
|
|
33
|
+
async run() {
|
|
34
|
+
const { path } = this.args;
|
|
35
|
+
const { output } = this.flags;
|
|
36
|
+
this.log(t('commands.cap.package.packaging', 'Packaging CAP: {{path}}', { path }));
|
|
37
|
+
let result;
|
|
38
|
+
try {
|
|
39
|
+
result = await this.operations.commerceAppPackage(path, { outputPath: output });
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
if (error instanceof Error) {
|
|
43
|
+
this.error(t('commands.cap.package.error', 'Package error: {{message}}', { message: error.message }));
|
|
44
|
+
}
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
this.log(t('commands.cap.package.completed', 'Packaged {{name}} v{{version}} → {{outputPath}}', {
|
|
48
|
+
name: result.manifest.name,
|
|
49
|
+
version: result.manifest.version,
|
|
50
|
+
outputPath: result.outputPath,
|
|
51
|
+
}));
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=package.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package.js","sourceRoot":"","sources":["../../../src/commands/cap/package.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,IAAI,EAAE,KAAK,EAAC,MAAM,aAAa,CAAC;AACxC,OAAO,EAAC,WAAW,EAAC,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAC,kBAAkB,EAAgC,MAAM,4CAA4C,CAAC;AAC7G,OAAO,EAAC,CAAC,EAAE,QAAQ,EAAC,MAAM,qBAAqB,CAAC;AAEhD,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,WAA8B;IACpE,MAAM,CAAC,IAAI,GAAG;QACZ,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;YAChB,WAAW,EAAE,kCAAkC;YAC/C,QAAQ,EAAE,IAAI;SACf,CAAC;KACH,CAAC;IAEF,MAAM,CAAC,WAAW,GAAG,QAAQ,CAC3B,CAAC,CAAC,kCAAkC,EAAE,iEAAiE,CAAC,EACxG,+BAA+B,CAChC,CAAC;IAEF,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC;IAE7B,MAAM,CAAC,QAAQ,GAAG;QAChB,uEAAuE;QACvE,uFAAuF;QACvF,kGAAkG;KACnG,CAAC;IAEF,MAAM,CAAC,KAAK,GAAG;QACb,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;YACnB,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,0EAA0E;SACxF,CAAC;KACH,CAAC;IAEQ,UAAU,GAAG;QACrB,kBAAkB;KACnB,CAAC;IAEF,KAAK,CAAC,GAAG;QACP,MAAM,EAAC,IAAI,EAAC,GAAG,IAAI,CAAC,IAAI,CAAC;QACzB,MAAM,EAAC,MAAM,EAAC,GAAG,IAAI,CAAC,KAAK,CAAC;QAE5B,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,gCAAgC,EAAE,yBAAyB,EAAE,EAAC,IAAI,EAAC,CAAC,CAAC,CAAC;QAEjF,IAAI,MAAgC,CAAC;QACrC,IAAI,CAAC;YACH,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,IAAI,EAAE,EAAC,UAAU,EAAE,MAAM,EAAC,CAAC,CAAC;QAChF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;gBAC3B,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,4BAA4B,EAAE,4BAA4B,EAAE,EAAC,OAAO,EAAE,KAAK,CAAC,OAAO,EAAC,CAAC,CAAC,CAAC;YACtG,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;QAED,IAAI,CAAC,GAAG,CACN,CAAC,CAAC,gCAAgC,EAAE,iDAAiD,EAAE;YACrF,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI;YAC1B,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,OAAO;YAChC,UAAU,EAAE,MAAM,CAAC,UAAU;SAC9B,CAAC,CACH,CAAC;QAEF,OAAO,MAAM,CAAC;IAChB,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { JobCommand } from '@salesforce/b2c-tooling-sdk/cli';
|
|
2
|
+
import { listInstalledApps, pullCommerceApps, type PullCommerceAppsResult } from '@salesforce/b2c-tooling-sdk/operations/cap';
|
|
3
|
+
export default class CapPull extends JobCommand<typeof CapPull> {
|
|
4
|
+
static description: string;
|
|
5
|
+
static args: {
|
|
6
|
+
appName: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
static enableJsonFlag: boolean;
|
|
9
|
+
static examples: string[];
|
|
10
|
+
static flags: {
|
|
11
|
+
'site-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
timeout: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
server: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
'webdav-server': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
'code-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
username: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
password: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
certificate: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
passphrase: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
selfsigned: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
22
|
+
verify: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
23
|
+
'client-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
24
|
+
'client-secret': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
25
|
+
'auth-scope': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
26
|
+
'short-code': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
27
|
+
'tenant-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
28
|
+
'auth-methods': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
29
|
+
'user-auth': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
30
|
+
'account-manager-host': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
31
|
+
'log-level': import("@oclif/core/interfaces").OptionFlag<"trace" | "debug" | "info" | "warn" | "error" | "silent" | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
32
|
+
debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
33
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
34
|
+
jsonl: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
35
|
+
lang: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
36
|
+
config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
37
|
+
instance: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
38
|
+
'project-directory': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
39
|
+
'extra-query': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
40
|
+
'extra-body': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
41
|
+
'extra-headers': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
42
|
+
};
|
|
43
|
+
protected operations: {
|
|
44
|
+
listInstalledApps: typeof listInstalledApps;
|
|
45
|
+
pullCommerceApps: typeof pullCommerceApps;
|
|
46
|
+
};
|
|
47
|
+
run(): Promise<PullCommerceAppsResult>;
|
|
48
|
+
}
|