@salesforce/b2c-cli 0.0.0-nightly.20260119053920
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 +222 -0
- package/bin/dev.cmd +3 -0
- package/bin/dev.js +17 -0
- package/bin/run.cmd +3 -0
- package/bin/run.js +17 -0
- package/dist/commands/_test/index.d.ts +6 -0
- package/dist/commands/_test/index.js +39 -0
- package/dist/commands/_test/index.js.map +1 -0
- package/dist/commands/auth/token.d.ts +16 -0
- package/dist/commands/auth/token.js +35 -0
- package/dist/commands/auth/token.js.map +1 -0
- package/dist/commands/code/activate.d.ts +33 -0
- package/dist/commands/code/activate.js +83 -0
- package/dist/commands/code/activate.js.map +1 -0
- package/dist/commands/code/delete.d.ts +33 -0
- package/dist/commands/code/delete.js +67 -0
- package/dist/commands/code/delete.js.map +1 -0
- package/dist/commands/code/deploy.d.ts +38 -0
- package/dist/commands/code/deploy.js +141 -0
- package/dist/commands/code/deploy.js.map +1 -0
- package/dist/commands/code/list.d.ts +8 -0
- package/dist/commands/code/list.js +64 -0
- package/dist/commands/code/list.js.map +1 -0
- package/dist/commands/code/watch.d.ts +34 -0
- package/dist/commands/code/watch.js +70 -0
- package/dist/commands/code/watch.js.map +1 -0
- package/dist/commands/docs/download.d.ts +35 -0
- package/dist/commands/docs/download.js +58 -0
- package/dist/commands/docs/download.js.map +1 -0
- package/dist/commands/docs/read.d.ts +29 -0
- package/dist/commands/docs/read.js +70 -0
- package/dist/commands/docs/read.js.map +1 -0
- package/dist/commands/docs/schema.d.ts +32 -0
- package/dist/commands/docs/schema.js +68 -0
- package/dist/commands/docs/schema.js.map +1 -0
- package/dist/commands/docs/search.d.ts +33 -0
- package/dist/commands/docs/search.js +102 -0
- package/dist/commands/docs/search.js.map +1 -0
- package/dist/commands/job/export.d.ts +50 -0
- package/dist/commands/job/export.js +270 -0
- package/dist/commands/job/export.js.map +1 -0
- package/dist/commands/job/import.d.ts +38 -0
- package/dist/commands/job/import.js +143 -0
- package/dist/commands/job/import.js.map +1 -0
- package/dist/commands/job/run.d.ts +45 -0
- package/dist/commands/job/run.js +205 -0
- package/dist/commands/job/run.js.map +1 -0
- package/dist/commands/job/search.d.ts +37 -0
- package/dist/commands/job/search.js +102 -0
- package/dist/commands/job/search.js.map +1 -0
- package/dist/commands/job/wait.d.ts +38 -0
- package/dist/commands/job/wait.js +85 -0
- package/dist/commands/job/wait.js.map +1 -0
- package/dist/commands/mrt/env/create.d.ts +41 -0
- package/dist/commands/mrt/env/create.js +226 -0
- package/dist/commands/mrt/env/create.js.map +1 -0
- package/dist/commands/mrt/env/delete.d.ts +34 -0
- package/dist/commands/mrt/env/delete.js +94 -0
- package/dist/commands/mrt/env/delete.js.map +1 -0
- package/dist/commands/mrt/env/var/delete.d.ts +34 -0
- package/dist/commands/mrt/env/var/delete.js +53 -0
- package/dist/commands/mrt/env/var/delete.js.map +1 -0
- package/dist/commands/mrt/env/var/list.d.ts +28 -0
- package/dist/commands/mrt/env/var/list.js +71 -0
- package/dist/commands/mrt/env/var/list.js.map +1 -0
- package/dist/commands/mrt/env/var/set.d.ts +35 -0
- package/dist/commands/mrt/env/var/set.js +84 -0
- package/dist/commands/mrt/env/var/set.js.map +1 -0
- package/dist/commands/mrt/push.d.ts +37 -0
- package/dist/commands/mrt/push.js +122 -0
- package/dist/commands/mrt/push.js.map +1 -0
- package/dist/commands/ods/create.d.ts +42 -0
- package/dist/commands/ods/create.js +255 -0
- package/dist/commands/ods/create.js.map +1 -0
- package/dist/commands/ods/delete.d.ts +15 -0
- package/dist/commands/ods/delete.js +86 -0
- package/dist/commands/ods/delete.js.map +1 -0
- package/dist/commands/ods/get.d.ts +17 -0
- package/dist/commands/ods/get.js +99 -0
- package/dist/commands/ods/get.js.map +1 -0
- package/dist/commands/ods/info.d.ts +27 -0
- package/dist/commands/ods/info.js +109 -0
- package/dist/commands/ods/info.js.map +1 -0
- package/dist/commands/ods/list.d.ts +31 -0
- package/dist/commands/ods/list.js +166 -0
- package/dist/commands/ods/list.js.map +1 -0
- package/dist/commands/ods/restart.d.ts +16 -0
- package/dist/commands/ods/restart.js +51 -0
- package/dist/commands/ods/restart.js.map +1 -0
- package/dist/commands/ods/start.d.ts +16 -0
- package/dist/commands/ods/start.js +51 -0
- package/dist/commands/ods/start.js.map +1 -0
- package/dist/commands/ods/stop.d.ts +16 -0
- package/dist/commands/ods/stop.js +51 -0
- package/dist/commands/ods/stop.js.map +1 -0
- package/dist/commands/scapi/custom/status.d.ts +81 -0
- package/dist/commands/scapi/custom/status.js +321 -0
- package/dist/commands/scapi/custom/status.js.map +1 -0
- package/dist/commands/scapi/schemas/get.d.ts +86 -0
- package/dist/commands/scapi/schemas/get.js +317 -0
- package/dist/commands/scapi/schemas/get.js.map +1 -0
- package/dist/commands/scapi/schemas/list.d.ts +48 -0
- package/dist/commands/scapi/schemas/list.js +148 -0
- package/dist/commands/scapi/schemas/list.js.map +1 -0
- package/dist/commands/sites/list.d.ts +10 -0
- package/dist/commands/sites/list.js +56 -0
- package/dist/commands/sites/list.js.map +1 -0
- package/dist/commands/slas/client/create.d.ts +38 -0
- package/dist/commands/slas/client/create.js +168 -0
- package/dist/commands/slas/client/create.js.map +1 -0
- package/dist/commands/slas/client/delete.d.ts +34 -0
- package/dist/commands/slas/client/delete.js +54 -0
- package/dist/commands/slas/client/delete.js.map +1 -0
- package/dist/commands/slas/client/get.d.ts +29 -0
- package/dist/commands/slas/client/get.js +51 -0
- package/dist/commands/slas/client/get.js.map +1 -0
- package/dist/commands/slas/client/list.d.ts +30 -0
- package/dist/commands/slas/client/list.js +64 -0
- package/dist/commands/slas/client/list.js.map +1 -0
- package/dist/commands/slas/client/open.d.ts +25 -0
- package/dist/commands/slas/client/open.js +56 -0
- package/dist/commands/slas/client/open.js.map +1 -0
- package/dist/commands/slas/client/update.d.ts +60 -0
- package/dist/commands/slas/client/update.js +183 -0
- package/dist/commands/slas/client/update.js.map +1 -0
- package/dist/commands/webdav/get.d.ts +41 -0
- package/dist/commands/webdav/get.js +61 -0
- package/dist/commands/webdav/get.js.map +1 -0
- package/dist/commands/webdav/ls.d.ts +17 -0
- package/dist/commands/webdav/ls.js +101 -0
- package/dist/commands/webdav/ls.js.map +1 -0
- package/dist/commands/webdav/mkdir.d.ts +19 -0
- package/dist/commands/webdav/mkdir.js +48 -0
- package/dist/commands/webdav/mkdir.js.map +1 -0
- package/dist/commands/webdav/put.d.ts +23 -0
- package/dist/commands/webdav/put.js +107 -0
- package/dist/commands/webdav/put.js.map +1 -0
- package/dist/commands/webdav/rm.d.ts +40 -0
- package/dist/commands/webdav/rm.js +67 -0
- package/dist/commands/webdav/rm.js.map +1 -0
- package/dist/commands/webdav/unzip.d.ts +15 -0
- package/dist/commands/webdav/unzip.js +48 -0
- package/dist/commands/webdav/unzip.js.map +1 -0
- package/dist/commands/webdav/zip.d.ts +15 -0
- package/dist/commands/webdav/zip.js +47 -0
- package/dist/commands/webdav/zip.js.map +1 -0
- package/dist/i18n/index.d.ts +29 -0
- package/dist/i18n/index.js +43 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/locales/de.d.ts +51 -0
- package/dist/i18n/locales/de.js +57 -0
- package/dist/i18n/locales/de.js.map +1 -0
- package/dist/i18n/locales/en.d.ts +118 -0
- package/dist/i18n/locales/en.js +124 -0
- package/dist/i18n/locales/en.js.map +1 -0
- package/dist/i18n/locales/index.d.ts +177 -0
- package/dist/i18n/locales/index.js +26 -0
- package/dist/i18n/locales/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/scapi/schemas.d.ts +40 -0
- package/dist/utils/scapi/schemas.js +49 -0
- package/dist/utils/scapi/schemas.js.map +1 -0
- package/dist/utils/slas/client.d.ts +65 -0
- package/dist/utils/slas/client.js +146 -0
- package/dist/utils/slas/client.js.map +1 -0
- package/oclif.manifest.json +10942 -0
- package/package.json +154 -0
package/README.md
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
# Salesforce Commerce Cloud B2C CLI
|
|
2
|
+
|
|
3
|
+
[](https://oclif.io)
|
|
4
|
+
|
|
5
|
+
> [!NOTE]
|
|
6
|
+
> This project is currently in **Developer Preview**. Not all features are implemented, and the API may change in future releases. Please provide feedback via GitHub issues.
|
|
7
|
+
|
|
8
|
+
A command-line interface for Salesforce Commerce Cloud B2C instances and platform services.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
### npm (Recommended)
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
npm install -g @salesforce/b2c-cli
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Homebrew (macOS/Linux)
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
brew tap SalesforceCommerceCloud/tooling
|
|
22
|
+
brew install b2c-cli
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### GitHub Release Tarball
|
|
26
|
+
|
|
27
|
+
For pre-release versions not yet published to npm, download the tarball from [GitHub Releases](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/releases) and install:
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
npm install -g ./salesforce-b2c-cli-<version>.tgz
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
b2c COMMAND
|
|
37
|
+
b2c --help [COMMAND]
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Configuration
|
|
41
|
+
|
|
42
|
+
The CLI can be configured via command-line flags or environment variables:
|
|
43
|
+
|
|
44
|
+
See the documentation for full configuration options: [https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/configuration.html](https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/configuration.html)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
| Environment Variable | Description |
|
|
48
|
+
|---------------------|-------------|
|
|
49
|
+
| `SFCC_SERVER` | B2C instance hostname |
|
|
50
|
+
| `SFCC_CODE_VERSION` | Code version |
|
|
51
|
+
| `SFCC_CLIENT_ID` | OAuth client ID |
|
|
52
|
+
| `SFCC_CLIENT_SECRET` | OAuth client secret |
|
|
53
|
+
| `SFCC_USERNAME` | Username for WebDAV |
|
|
54
|
+
| `SFCC_PASSWORD` | Password/access key for WebDAV |
|
|
55
|
+
|
|
56
|
+
## Commands
|
|
57
|
+
|
|
58
|
+
### Code Management
|
|
59
|
+
|
|
60
|
+
Deploy and manage code versions on B2C Commerce instances.
|
|
61
|
+
|
|
62
|
+
```sh
|
|
63
|
+
# List code versions
|
|
64
|
+
b2c code list
|
|
65
|
+
|
|
66
|
+
# Deploy cartridges
|
|
67
|
+
b2c code deploy --server my-sandbox.demandware.net --code-version v1
|
|
68
|
+
|
|
69
|
+
# Watch and sync changes during development
|
|
70
|
+
b2c code watch
|
|
71
|
+
|
|
72
|
+
# Activate a code version
|
|
73
|
+
b2c code activate v1
|
|
74
|
+
|
|
75
|
+
# Delete a code version
|
|
76
|
+
b2c code delete old-version
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Jobs and Site Import/Export
|
|
80
|
+
|
|
81
|
+
Execute jobs and manage site archives.
|
|
82
|
+
|
|
83
|
+
```sh
|
|
84
|
+
# Run a job
|
|
85
|
+
b2c job run my-job --wait
|
|
86
|
+
|
|
87
|
+
# Import a site archive
|
|
88
|
+
b2c job import ./site-data.zip
|
|
89
|
+
|
|
90
|
+
# Export site data
|
|
91
|
+
b2c job export --global-data meta_data
|
|
92
|
+
|
|
93
|
+
# Search job executions
|
|
94
|
+
b2c job search --status RUNNING
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### On-Demand Sandboxes (ODS)
|
|
98
|
+
|
|
99
|
+
Create and manage on-demand sandboxes.
|
|
100
|
+
|
|
101
|
+
```sh
|
|
102
|
+
# List sandboxes
|
|
103
|
+
b2c ods list
|
|
104
|
+
|
|
105
|
+
# Create a new sandbox
|
|
106
|
+
b2c ods create
|
|
107
|
+
|
|
108
|
+
# Get sandbox details
|
|
109
|
+
b2c ods get <sandbox-id>
|
|
110
|
+
|
|
111
|
+
# Start/stop/restart a sandbox
|
|
112
|
+
b2c ods start <sandbox-id>
|
|
113
|
+
b2c ods stop <sandbox-id>
|
|
114
|
+
b2c ods restart <sandbox-id>
|
|
115
|
+
|
|
116
|
+
# Delete a sandbox
|
|
117
|
+
b2c ods delete <sandbox-id>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Managed Runtime (MRT)
|
|
121
|
+
|
|
122
|
+
Manage MRT projects, environments, and deployments.
|
|
123
|
+
|
|
124
|
+
```sh
|
|
125
|
+
# Push a bundle
|
|
126
|
+
b2c mrt push --project my-storefront --environment staging
|
|
127
|
+
|
|
128
|
+
# Create an environment
|
|
129
|
+
b2c mrt env create staging --project my-storefront --name "Staging"
|
|
130
|
+
|
|
131
|
+
# Manage environment variables
|
|
132
|
+
b2c mrt env var list -p my-project -e staging
|
|
133
|
+
b2c mrt env var set API_KEY=secret -p my-project -e staging
|
|
134
|
+
b2c mrt env var delete OLD_KEY -p my-project -e staging
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### SLAS Client Management
|
|
138
|
+
|
|
139
|
+
Manage Shopper Login and API Security (SLAS) clients.
|
|
140
|
+
|
|
141
|
+
```sh
|
|
142
|
+
# List SLAS clients
|
|
143
|
+
b2c slas client list
|
|
144
|
+
|
|
145
|
+
# Create a client
|
|
146
|
+
b2c slas client create --name "My App"
|
|
147
|
+
|
|
148
|
+
# Get client details
|
|
149
|
+
b2c slas client get <client-id>
|
|
150
|
+
|
|
151
|
+
# Update a client
|
|
152
|
+
b2c slas client update <client-id>
|
|
153
|
+
|
|
154
|
+
# Delete a client
|
|
155
|
+
b2c slas client delete <client-id>
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### WebDAV Operations
|
|
159
|
+
|
|
160
|
+
File operations on instance WebDAV.
|
|
161
|
+
|
|
162
|
+
```sh
|
|
163
|
+
# List files
|
|
164
|
+
b2c webdav ls /cartridges
|
|
165
|
+
|
|
166
|
+
# Upload/download files
|
|
167
|
+
b2c webdav put local-file.txt /remote/path/
|
|
168
|
+
b2c webdav get /remote/path/file.txt
|
|
169
|
+
|
|
170
|
+
# Create directory
|
|
171
|
+
b2c webdav mkdir /remote/new-dir
|
|
172
|
+
|
|
173
|
+
# Delete files
|
|
174
|
+
b2c webdav rm /remote/path/file.txt
|
|
175
|
+
|
|
176
|
+
# Archive operations
|
|
177
|
+
b2c webdav zip /remote/dir archive.zip
|
|
178
|
+
b2c webdav unzip /remote/archive.zip
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Sites
|
|
182
|
+
|
|
183
|
+
List and inspect storefront sites.
|
|
184
|
+
|
|
185
|
+
```sh
|
|
186
|
+
b2c sites list
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Authentication
|
|
190
|
+
|
|
191
|
+
Get OAuth tokens for scripting.
|
|
192
|
+
|
|
193
|
+
```sh
|
|
194
|
+
b2c auth token
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Logging
|
|
198
|
+
|
|
199
|
+
Control log output with flags or environment variables:
|
|
200
|
+
|
|
201
|
+
```sh
|
|
202
|
+
# Debug logging
|
|
203
|
+
b2c code deploy --log-level debug
|
|
204
|
+
b2c code deploy -D # shorthand
|
|
205
|
+
|
|
206
|
+
# JSON output for scripting
|
|
207
|
+
b2c code deploy --json
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
See the [documentation](https://salesforcecommercecloud.github.io/b2c-developer-tooling/cli/logging) for more logging options.
|
|
211
|
+
|
|
212
|
+
## Documentation
|
|
213
|
+
|
|
214
|
+
Full documentation is available at: https://salesforcecommercecloud.github.io/b2c-developer-tooling/
|
|
215
|
+
|
|
216
|
+
## License
|
|
217
|
+
|
|
218
|
+
This project is licensed under the Apache License 2.0. See [LICENSE.txt](../../LICENSE.txt) for full details.
|
|
219
|
+
|
|
220
|
+
## Disclaimer
|
|
221
|
+
|
|
222
|
+
This project is currently in **Developer Preview** and is provided "as-is" without warranty of any kind. It is not yet generally available (GA) and should not be used in production environments. Features, APIs, and functionality may change without notice in future releases.
|
package/bin/dev.cmd
ADDED
package/bin/dev.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env -S node --conditions development
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2025, Salesforce, Inc.
|
|
4
|
+
* SPDX-License-Identifier: Apache-2
|
|
5
|
+
* For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// Load .env file if present (Node.js native support)
|
|
9
|
+
try {
|
|
10
|
+
process.loadEnvFile();
|
|
11
|
+
} catch {
|
|
12
|
+
// .env file not found or not readable, continue without it
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
import {execute} from '@oclif/core';
|
|
16
|
+
|
|
17
|
+
await execute({development: true, dir: import.meta.url});
|
package/bin/run.cmd
ADDED
package/bin/run.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2025, Salesforce, Inc.
|
|
4
|
+
* SPDX-License-Identifier: Apache-2
|
|
5
|
+
* For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// Load .env file if present (Node.js native support)
|
|
9
|
+
try {
|
|
10
|
+
process.loadEnvFile();
|
|
11
|
+
} catch {
|
|
12
|
+
// .env file not found or not readable, continue without it
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
import {execute} from '@oclif/core';
|
|
16
|
+
|
|
17
|
+
await execute({dir: import.meta.url});
|
|
@@ -0,0 +1,39 @@
|
|
|
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 { BaseCommand } from '@salesforce/b2c-tooling-sdk/cli';
|
|
7
|
+
export default class Test extends BaseCommand {
|
|
8
|
+
static description = 'Test logging output';
|
|
9
|
+
static hidden = true;
|
|
10
|
+
async run() {
|
|
11
|
+
// Test this.log() which now uses pino
|
|
12
|
+
this.baseCommandTest();
|
|
13
|
+
this.log('Using this.log() - goes through pino');
|
|
14
|
+
this.warn('Using this.warn() - goes through pino');
|
|
15
|
+
// Test logger directly at different levels
|
|
16
|
+
this.logger.trace('Trace level message');
|
|
17
|
+
this.logger.debug('Debug level message');
|
|
18
|
+
this.logger.info('Info level message');
|
|
19
|
+
this.logger.error('Error level message');
|
|
20
|
+
// Context (visible in debug mode)
|
|
21
|
+
this.logger.info({ operation: 'test', duration: 123 }, 'Message with context');
|
|
22
|
+
this.logger.debug({
|
|
23
|
+
file: 'cartridge.zip',
|
|
24
|
+
bytes: 45_678,
|
|
25
|
+
instance: 'dev01.sandbox.us01.dx.commercecloud.salesforce.com',
|
|
26
|
+
}, 'Debug with multiple context fields');
|
|
27
|
+
// Test redaction
|
|
28
|
+
this.logger.info({
|
|
29
|
+
username: 'testuser',
|
|
30
|
+
password: 'secret123',
|
|
31
|
+
client_secret: 'abc123xyz',
|
|
32
|
+
accessToken: 'eyJhbGciOiJIUzI1NiJ9.test',
|
|
33
|
+
}, 'This should have redacted fields');
|
|
34
|
+
// Child logger
|
|
35
|
+
const childLogger = this.logger.child({ operation: 'upload' });
|
|
36
|
+
childLogger.info('Message from child logger');
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/_test/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,WAAW,EAAC,MAAM,iCAAiC,CA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CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { OAuthCommand } from '@salesforce/b2c-tooling-sdk/cli';
|
|
2
|
+
/**
|
|
3
|
+
* JSON output structure for the token command
|
|
4
|
+
*/
|
|
5
|
+
interface TokenJsonOutput {
|
|
6
|
+
accessToken: string;
|
|
7
|
+
expires: string;
|
|
8
|
+
scopes: string[];
|
|
9
|
+
}
|
|
10
|
+
export default class AuthToken extends OAuthCommand<typeof AuthToken> {
|
|
11
|
+
static description: string;
|
|
12
|
+
static enableJsonFlag: boolean;
|
|
13
|
+
static examples: string[];
|
|
14
|
+
run(): Promise<TokenJsonOutput>;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
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 { ux } from '@oclif/core';
|
|
7
|
+
import { OAuthCommand } from '@salesforce/b2c-tooling-sdk/cli';
|
|
8
|
+
import { t } from '../../i18n/index.js';
|
|
9
|
+
export default class AuthToken extends OAuthCommand {
|
|
10
|
+
static description = t('commands.auth.token.description', 'Get an OAuth access token');
|
|
11
|
+
static enableJsonFlag = true;
|
|
12
|
+
static examples = [
|
|
13
|
+
'<%= config.bin %> <%= command.id %>',
|
|
14
|
+
'<%= config.bin %> <%= command.id %> --scope sfcc.orders --scope sfcc.products',
|
|
15
|
+
'<%= config.bin %> <%= command.id %> --json',
|
|
16
|
+
];
|
|
17
|
+
async run() {
|
|
18
|
+
this.requireOAuthCredentials();
|
|
19
|
+
const strategy = this.getOAuthStrategy();
|
|
20
|
+
const tokenResponse = await strategy.getTokenResponse();
|
|
21
|
+
const output = {
|
|
22
|
+
accessToken: tokenResponse.accessToken,
|
|
23
|
+
expires: tokenResponse.expires.toISOString(),
|
|
24
|
+
scopes: tokenResponse.scopes,
|
|
25
|
+
};
|
|
26
|
+
// In JSON mode, return the full token response
|
|
27
|
+
if (this.jsonEnabled()) {
|
|
28
|
+
return output;
|
|
29
|
+
}
|
|
30
|
+
// In normal mode, output just the raw token to stdout
|
|
31
|
+
ux.stdout(tokenResponse.accessToken);
|
|
32
|
+
return output;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=token.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token.js","sourceRoot":"","sources":["../../../src/commands/auth/token.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,EAAE,EAAC,MAAM,aAAa,CAAC;AAC/B,OAAO,EAAC,YAAY,EAAC,MAAM,iCAAiC,CAAC;AAE7D,OAAO,EAAC,CAAC,EAAC,MAAM,qBAAqB,CAAC;AAWtC,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,YAA8B;IACnE,MAAM,CAAC,WAAW,GAAG,CAAC,CAAC,iCAAiC,EAAE,2BAA2B,CAAC,CAAC;IAEvF,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC;IAE7B,MAAM,CAAC,QAAQ,GAAG;QAChB,qCAAqC;QACrC,+EAA+E;QAC/E,4CAA4C;KAC7C,CAAC;IAEF,KAAK,CAAC,GAAG;QACP,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAE/B,MAAM,QAAQ,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACzC,MAAM,aAAa,GAAwB,MAAM,QAAQ,CAAC,gBAAgB,EAAE,CAAC;QAE7E,MAAM,MAAM,GAAoB;YAC9B,WAAW,EAAE,aAAa,CAAC,WAAW;YACtC,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,WAAW,EAAE;YAC5C,MAAM,EAAE,aAAa,CAAC,MAAM;SAC7B,CAAC;QAEF,+CAA+C;QAC/C,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACvB,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,sDAAsD;QACtD,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;QAErC,OAAO,MAAM,CAAC;IAChB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { InstanceCommand } from '@salesforce/b2c-tooling-sdk/cli';
|
|
2
|
+
export default class CodeActivate extends InstanceCommand<typeof CodeActivate> {
|
|
3
|
+
static args: {
|
|
4
|
+
codeVersion: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static examples: string[];
|
|
8
|
+
static flags: {
|
|
9
|
+
reload: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
server: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
'webdav-server': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
'code-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
username: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
password: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
'client-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
'client-secret': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
scope: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
'short-code': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
'auth-methods': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
'account-manager-host': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
'log-level': import("@oclif/core/interfaces").OptionFlag<"trace" | "debug" | "info" | "warn" | "error" | "silent" | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
|
+
debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
23
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
24
|
+
lang: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
25
|
+
config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
26
|
+
instance: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
27
|
+
'working-directory': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
28
|
+
'extra-query': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
29
|
+
'extra-body': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
30
|
+
'extra-headers': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
31
|
+
};
|
|
32
|
+
run(): Promise<void>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
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 { InstanceCommand } from '@salesforce/b2c-tooling-sdk/cli';
|
|
8
|
+
import { activateCodeVersion, reloadCodeVersion } from '@salesforce/b2c-tooling-sdk/operations/code';
|
|
9
|
+
import { t } from '../../i18n/index.js';
|
|
10
|
+
export default class CodeActivate extends InstanceCommand {
|
|
11
|
+
static args = {
|
|
12
|
+
codeVersion: Args.string({
|
|
13
|
+
description: 'Code version ID to activate',
|
|
14
|
+
required: false,
|
|
15
|
+
}),
|
|
16
|
+
};
|
|
17
|
+
static description = t('commands.code.activate.description', 'Activate or reload a code version');
|
|
18
|
+
static examples = [
|
|
19
|
+
'<%= config.bin %> <%= command.id %> v1',
|
|
20
|
+
'<%= config.bin %> <%= command.id %> v1 --server my-sandbox.demandware.net',
|
|
21
|
+
'<%= config.bin %> <%= command.id %> --reload',
|
|
22
|
+
'<%= config.bin %> <%= command.id %> v1 --reload',
|
|
23
|
+
];
|
|
24
|
+
static flags = {
|
|
25
|
+
...InstanceCommand.baseFlags,
|
|
26
|
+
reload: Flags.boolean({
|
|
27
|
+
char: 'r',
|
|
28
|
+
description: 'Reload the code version (toggle activation to force reload)',
|
|
29
|
+
default: false,
|
|
30
|
+
}),
|
|
31
|
+
};
|
|
32
|
+
async run() {
|
|
33
|
+
this.requireOAuthCredentials();
|
|
34
|
+
const codeVersionArg = this.args.codeVersion;
|
|
35
|
+
const hostname = this.resolvedConfig.values.hostname;
|
|
36
|
+
// Get code version from arg, flag, or config
|
|
37
|
+
const codeVersion = codeVersionArg ?? this.resolvedConfig.values.codeVersion;
|
|
38
|
+
if (this.flags.reload) {
|
|
39
|
+
// Reload mode - re-activate the code version
|
|
40
|
+
this.log(t('commands.code.activate.reloading', 'Reloading code version{{version}} on {{hostname}}...', {
|
|
41
|
+
hostname,
|
|
42
|
+
version: codeVersion ? ` ${codeVersion}` : '',
|
|
43
|
+
}));
|
|
44
|
+
try {
|
|
45
|
+
await reloadCodeVersion(this.instance, codeVersion);
|
|
46
|
+
this.log(t('commands.code.activate.reloaded', 'Code version{{version}} reloaded successfully', {
|
|
47
|
+
version: codeVersion ? ` ${codeVersion}` : '',
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
if (error instanceof Error) {
|
|
52
|
+
this.error(t('commands.code.activate.reloadFailed', 'Failed to reload code version: {{message}}', {
|
|
53
|
+
message: error.message,
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
// Activate mode - just activate the code version
|
|
61
|
+
if (!codeVersion) {
|
|
62
|
+
this.error(t('commands.code.activate.versionRequired', 'Code version is required. Provide as argument or use --code-version flag.'));
|
|
63
|
+
}
|
|
64
|
+
this.log(t('commands.code.activate.activating', 'Activating code version {{codeVersion}} on {{hostname}}...', {
|
|
65
|
+
hostname,
|
|
66
|
+
codeVersion,
|
|
67
|
+
}));
|
|
68
|
+
try {
|
|
69
|
+
await activateCodeVersion(this.instance, codeVersion);
|
|
70
|
+
this.log(t('commands.code.activate.activated', 'Code version {{codeVersion}} activated successfully', { codeVersion }));
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
if (error instanceof Error) {
|
|
74
|
+
this.error(t('commands.code.activate.failed', 'Failed to activate code version: {{message}}', {
|
|
75
|
+
message: error.message,
|
|
76
|
+
}));
|
|
77
|
+
}
|
|
78
|
+
throw error;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=activate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activate.js","sourceRoot":"","sources":["../../../src/commands/code/activate.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,IAAI,EAAE,KAAK,EAAC,MAAM,aAAa,CAAC;AACxC,OAAO,EAAC,eAAe,EAAC,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAC,mBAAmB,EAAE,iBAAiB,EAAC,MAAM,6CAA6C,CAAC;AACnG,OAAO,EAAC,CAAC,EAAC,MAAM,qBAAq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 -0,0 +1,33 @@
|
|
|
1
|
+
import { InstanceCommand } from '@salesforce/b2c-tooling-sdk/cli';
|
|
2
|
+
export default class CodeDelete extends InstanceCommand<typeof CodeDelete> {
|
|
3
|
+
static args: {
|
|
4
|
+
codeVersion: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static examples: string[];
|
|
8
|
+
static flags: {
|
|
9
|
+
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
server: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
'webdav-server': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
'code-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
username: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
password: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
'client-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
'client-secret': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
scope: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
'short-code': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
'auth-methods': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
'account-manager-host': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
'log-level': import("@oclif/core/interfaces").OptionFlag<"trace" | "debug" | "info" | "warn" | "error" | "silent" | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
|
+
debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
23
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
24
|
+
lang: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
25
|
+
config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
26
|
+
instance: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
27
|
+
'working-directory': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
28
|
+
'extra-query': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
29
|
+
'extra-body': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
30
|
+
'extra-headers': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
31
|
+
};
|
|
32
|
+
run(): Promise<void>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
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 * as readline from 'node:readline';
|
|
7
|
+
import { Args, Flags } from '@oclif/core';
|
|
8
|
+
import { InstanceCommand } from '@salesforce/b2c-tooling-sdk/cli';
|
|
9
|
+
import { deleteCodeVersion } from '@salesforce/b2c-tooling-sdk/operations/code';
|
|
10
|
+
import { t } from '../../i18n/index.js';
|
|
11
|
+
/**
|
|
12
|
+
* Simple confirmation prompt.
|
|
13
|
+
*/
|
|
14
|
+
async function confirm(message) {
|
|
15
|
+
const rl = readline.createInterface({
|
|
16
|
+
input: process.stdin,
|
|
17
|
+
output: process.stderr,
|
|
18
|
+
});
|
|
19
|
+
return new Promise((resolve) => {
|
|
20
|
+
rl.question(`${message} `, (answer) => {
|
|
21
|
+
rl.close();
|
|
22
|
+
resolve(answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes');
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
export default class CodeDelete extends InstanceCommand {
|
|
27
|
+
static args = {
|
|
28
|
+
codeVersion: Args.string({
|
|
29
|
+
description: 'Code version ID to delete',
|
|
30
|
+
required: true,
|
|
31
|
+
}),
|
|
32
|
+
};
|
|
33
|
+
static description = t('commands.code.delete.description', 'Delete a code version');
|
|
34
|
+
static examples = [
|
|
35
|
+
'<%= config.bin %> <%= command.id %> old-version',
|
|
36
|
+
'<%= config.bin %> <%= command.id %> old-version --force',
|
|
37
|
+
'<%= config.bin %> <%= command.id %> old-version --server my-sandbox.demandware.net',
|
|
38
|
+
];
|
|
39
|
+
static flags = {
|
|
40
|
+
...InstanceCommand.baseFlags,
|
|
41
|
+
force: Flags.boolean({
|
|
42
|
+
char: 'f',
|
|
43
|
+
description: 'Skip confirmation prompt',
|
|
44
|
+
default: false,
|
|
45
|
+
}),
|
|
46
|
+
};
|
|
47
|
+
async run() {
|
|
48
|
+
this.requireOAuthCredentials();
|
|
49
|
+
const codeVersion = this.args.codeVersion;
|
|
50
|
+
const hostname = this.resolvedConfig.values.hostname;
|
|
51
|
+
// Confirm deletion unless --force is used
|
|
52
|
+
if (!this.flags.force) {
|
|
53
|
+
const confirmed = await confirm(t('commands.code.delete.confirm', 'Are you sure you want to delete code version "{{codeVersion}}" on {{hostname}}? (y/n)', { codeVersion, hostname }));
|
|
54
|
+
if (!confirmed) {
|
|
55
|
+
this.log(t('commands.code.delete.cancelled', 'Deletion cancelled'));
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
this.log(t('commands.code.delete.deleting', 'Deleting code version {{codeVersion}} from {{hostname}}...', {
|
|
60
|
+
hostname,
|
|
61
|
+
codeVersion,
|
|
62
|
+
}));
|
|
63
|
+
await deleteCodeVersion(this.instance, codeVersion);
|
|
64
|
+
this.log(t('commands.code.delete.deleted', 'Code version {{codeVersion}} deleted successfully', { codeVersion }));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../src/commands/code/delete.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,IAAI,EAAE,KAAK,EAAC,MAAM,aAAa,CAAC;AACxC,OAAO,EAAC,eAAe,EAAC,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAC,iBAAiB,EAAC,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAC,CAAC,EAAC,MAAM,qBAAqB,CAAC;AAEtC;;GAEG;AACH,KAAK,UAAU,OAAO,CAAC,OAAe;IACpC,MAAM,EAAE,GAAG,QAAQ,CAAC,eAAe,CAAC;QAClC,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC,CAAC;IAEH,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,EAAE,CAAC,QAAQ,CAAC,GAAG,OAAO,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE;YACpC,EAAE,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,GAAG,IAAI,MAAM,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC,CAAC;QAC1E,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ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QAAQ,EAAE,WAAW,CAAC,CAAC;QACpD,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,8BAA8B,EAAE,mDAAmD,EAAE,EAAC,WAAW,EAAC,CAAC,CAAC,CAAC;IAClH,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type DeployResult } from '@salesforce/b2c-tooling-sdk/operations/code';
|
|
2
|
+
import { CartridgeCommand } from '@salesforce/b2c-tooling-sdk/cli';
|
|
3
|
+
export default class CodeDeploy extends CartridgeCommand<typeof CodeDeploy> {
|
|
4
|
+
static args: {
|
|
5
|
+
cartridgePath: 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
|
+
reload: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
delete: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
cartridge: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
'exclude-cartridge': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
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
|
+
'client-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
'client-secret': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
|
+
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
|
+
'auth-methods': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
25
|
+
'account-manager-host': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
26
|
+
'log-level': import("@oclif/core/interfaces").OptionFlag<"trace" | "debug" | "info" | "warn" | "error" | "silent" | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
27
|
+
debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
28
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
29
|
+
lang: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
30
|
+
config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
31
|
+
instance: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
32
|
+
'working-directory': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
33
|
+
'extra-query': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
34
|
+
'extra-body': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
35
|
+
'extra-headers': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
36
|
+
};
|
|
37
|
+
run(): Promise<DeployResult>;
|
|
38
|
+
}
|