sf-plugin-cms 0.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/LICENSE +21 -0
- package/README.md +277 -0
- package/lib/commands/cms/command-base.d.ts +16 -0
- package/lib/commands/cms/command-base.js +42 -0
- package/lib/commands/cms/command-base.js.map +1 -0
- package/lib/commands/cms/export/workspace.d.ts +14 -0
- package/lib/commands/cms/export/workspace.js +42 -0
- package/lib/commands/cms/export/workspace.js.map +1 -0
- package/lib/commands/cms/get/channel.d.ts +13 -0
- package/lib/commands/cms/get/channel.js +23 -0
- package/lib/commands/cms/get/channel.js.map +1 -0
- package/lib/commands/cms/get/content.d.ts +17 -0
- package/lib/commands/cms/get/content.js +35 -0
- package/lib/commands/cms/get/content.js.map +1 -0
- package/lib/commands/cms/get/variant.d.ts +13 -0
- package/lib/commands/cms/get/variant.js +23 -0
- package/lib/commands/cms/get/variant.js.map +1 -0
- package/lib/commands/cms/get/workspace.d.ts +13 -0
- package/lib/commands/cms/get/workspace.js +23 -0
- package/lib/commands/cms/get/workspace.js.map +1 -0
- package/lib/commands/cms/import/workspace.d.ts +18 -0
- package/lib/commands/cms/import/workspace.js +77 -0
- package/lib/commands/cms/import/workspace.js.map +1 -0
- package/lib/commands/cms/info.d.ts +12 -0
- package/lib/commands/cms/info.js +13 -0
- package/lib/commands/cms/info.js.map +1 -0
- package/lib/commands/cms/list/channel.d.ts +15 -0
- package/lib/commands/cms/list/channel.js +28 -0
- package/lib/commands/cms/list/channel.js.map +1 -0
- package/lib/commands/cms/list/workspace.d.ts +15 -0
- package/lib/commands/cms/list/workspace.js +27 -0
- package/lib/commands/cms/list/workspace.js.map +1 -0
- package/lib/generated/operations.d.ts +233 -0
- package/lib/generated/operations.js +317 -0
- package/lib/generated/operations.js.map +1 -0
- package/lib/index.d.ts +8 -0
- package/lib/index.js +9 -0
- package/lib/index.js.map +1 -0
- package/lib/openapi/generate.d.ts +30 -0
- package/lib/openapi/generate.js +150 -0
- package/lib/openapi/generate.js.map +1 -0
- package/lib/openapi/intake.d.ts +26 -0
- package/lib/openapi/intake.js +176 -0
- package/lib/openapi/intake.js.map +1 -0
- package/lib/openapi/selected.d.ts +11 -0
- package/lib/openapi/selected.js +49 -0
- package/lib/openapi/selected.js.map +1 -0
- package/lib/services/export-workspace.d.ts +37 -0
- package/lib/services/export-workspace.js +214 -0
- package/lib/services/export-workspace.js.map +1 -0
- package/lib/services/import-workspace.d.ts +112 -0
- package/lib/services/import-workspace.js +570 -0
- package/lib/services/import-workspace.js.map +1 -0
- package/lib/services/read.d.ts +20 -0
- package/lib/services/read.js +73 -0
- package/lib/services/read.js.map +1 -0
- package/lib/services/write.d.ts +27 -0
- package/lib/services/write.js +21 -0
- package/lib/services/write.js.map +1 -0
- package/lib/transport/json-mutation.d.ts +15 -0
- package/lib/transport/json-mutation.js +81 -0
- package/lib/transport/json-mutation.js.map +1 -0
- package/lib/transport/json-request.d.ts +26 -0
- package/lib/transport/json-request.js +135 -0
- package/lib/transport/json-request.js.map +1 -0
- package/lib/transport/redact-secrets.d.ts +6 -0
- package/lib/transport/redact-secrets.js +31 -0
- package/lib/transport/redact-secrets.js.map +1 -0
- package/messages/cms.export.workspace.md +29 -0
- package/messages/cms.get.channel.md +25 -0
- package/messages/cms.get.content.md +41 -0
- package/messages/cms.get.variant.md +25 -0
- package/messages/cms.get.workspace.md +25 -0
- package/messages/cms.import.workspace.md +45 -0
- package/messages/cms.list.channel.md +33 -0
- package/messages/cms.list.workspace.md +32 -0
- package/package.json +98 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jörn Berkefeld
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
# sf-plugin-cms
|
|
2
|
+
|
|
3
|
+
Salesforce CLI commands for inspecting Marketing Cloud CMS resources, experimentally exporting a workspace, and safely planning or applying a create-only workspace import through Connect REST API calls. The plugin does not update, overwrite, publish, unpublish, or broadly delete existing CMS content.
|
|
4
|
+
|
|
5
|
+
## Installation and getting started
|
|
6
|
+
|
|
7
|
+
### Prerequisites
|
|
8
|
+
|
|
9
|
+
- Node.js 20 through 24 (`>=20 <25`).
|
|
10
|
+
- The base Salesforce `sf` CLI.
|
|
11
|
+
- A Salesforce org with access to the CMS resources you want to read.
|
|
12
|
+
|
|
13
|
+
A common cross-platform way to install or update Salesforce CLI is with npm:
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npm install --global @salesforce/cli
|
|
17
|
+
sf --version
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Salesforce also provides platform-specific installers if you prefer not to manage the CLI with npm.
|
|
21
|
+
|
|
22
|
+
### Authenticate an org
|
|
23
|
+
|
|
24
|
+
Open the browser login flow and assign an alias that you can reuse in CMS commands:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
sf org login web --alias my-org
|
|
28
|
+
sf org display --target-org my-org
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
For a sandbox or org that uses a custom login host, add `--instance-url <login-url>` to `sf org login web`.
|
|
32
|
+
|
|
33
|
+
### Install the plugin
|
|
34
|
+
|
|
35
|
+
The normal installation command for a published Salesforce CLI plugin will be:
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
sf plugins install sf-plugin-cms
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
This package is not currently documented as published to npm, so do not expect that command to work yet. For the current source-checkout workflow, run these commands from the repository's `sf-plugin-cms` directory:
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
npm install --no-workspaces
|
|
45
|
+
npm run compile
|
|
46
|
+
sf plugins link .
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Linked ESM plugins use the compiled files. Run `npm run compile` again after source changes, or keep `npm run compile -- --watch` running while developing.
|
|
50
|
+
|
|
51
|
+
Confirm that the plugin loads without making an org request:
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
sf cms info
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Command reference
|
|
58
|
+
|
|
59
|
+
All org-backed commands require `--target-org <username-or-alias>` (short form `-o`). They use API version `67.0` by default; pass `--api-version <version>` only when you need to override it. Add `--json` for machine-readable Salesforce CLI output. Without `--json`, list commands print compact tables and get commands print formatted JSON records.
|
|
60
|
+
|
|
61
|
+
### `sf cms info`
|
|
62
|
+
|
|
63
|
+
Checks that the plugin entrypoint loads. This is the safest first command because it does not contact an org.
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
sf cms info
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### `sf cms list workspace`
|
|
70
|
+
|
|
71
|
+
Lists one bounded page of CMS workspaces. Use `--name-fragment` to filter workspace names, and use `--page` with `--page-size` to request a specific page.
|
|
72
|
+
|
|
73
|
+
```sh
|
|
74
|
+
sf cms list workspace --target-org my-org
|
|
75
|
+
sf cms list workspace --target-org my-org --name-fragment Marketing
|
|
76
|
+
sf cms list workspace --target-org my-org --page 0 --page-size 25 --json
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Key flags:
|
|
80
|
+
|
|
81
|
+
- `--name-fragment <text>`: return workspaces whose names contain the value.
|
|
82
|
+
- `--page <number>`: zero-based page number; the first page is `0`.
|
|
83
|
+
- `--page-size <number>`: maximum number of items requested for that page; must be at least `1`.
|
|
84
|
+
|
|
85
|
+
The command requests only the selected page; it does not automatically follow subsequent pages.
|
|
86
|
+
|
|
87
|
+
### `sf cms get workspace`
|
|
88
|
+
|
|
89
|
+
Retrieves one workspace by its CMS content-space ID.
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
sf cms get workspace --target-org my-org --workspace-id 0Zu...
|
|
93
|
+
sf cms get workspace --target-org my-org --workspace-id 0Zu... --json
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Required selector: `--workspace-id <id>`.
|
|
97
|
+
|
|
98
|
+
### `sf cms list channel`
|
|
99
|
+
|
|
100
|
+
Lists one bounded page of channels assigned to a specific workspace.
|
|
101
|
+
|
|
102
|
+
```sh
|
|
103
|
+
sf cms list channel --target-org my-org --workspace-id 0Zu...
|
|
104
|
+
sf cms list channel --target-org my-org --workspace-id 0Zu... --page 0 --page-size 25
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Key flags:
|
|
108
|
+
|
|
109
|
+
- `--workspace-id <id>`: required CMS workspace content-space ID.
|
|
110
|
+
- `--page <number>`: zero-based page number.
|
|
111
|
+
- `--page-size <number>`: maximum number of channels requested; must be at least `1`.
|
|
112
|
+
|
|
113
|
+
The command requests only the selected page; it does not automatically follow subsequent pages.
|
|
114
|
+
|
|
115
|
+
### `sf cms get channel`
|
|
116
|
+
|
|
117
|
+
Retrieves one CMS channel by its identifier.
|
|
118
|
+
|
|
119
|
+
```sh
|
|
120
|
+
sf cms get channel --target-org my-org --channel-id 0ap...
|
|
121
|
+
sf cms get channel --target-org my-org --channel-id 0ap... --json
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Required selector: `--channel-id <id>`.
|
|
125
|
+
|
|
126
|
+
### `sf cms get content`
|
|
127
|
+
|
|
128
|
+
Retrieves a CMS content document by content key or ID. Optional selectors are passed directly to the CMS content request when you need a particular language or version.
|
|
129
|
+
|
|
130
|
+
```sh
|
|
131
|
+
sf cms get content --target-org my-org --content-key-or-id news-banner
|
|
132
|
+
sf cms get content --target-org my-org --content-key-or-id news-banner --language en-US
|
|
133
|
+
sf cms get content --target-org my-org --content-key-or-id news-banner --content-version 3 --variant-version 2 --version 1 --json
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Key flags:
|
|
137
|
+
|
|
138
|
+
- `--content-key-or-id <value>`: required content key or content identifier.
|
|
139
|
+
- `--content-version <value>`: select a content version.
|
|
140
|
+
- `--language <value>`: select a content language.
|
|
141
|
+
- `--variant-version <value>`: select a variant version.
|
|
142
|
+
- `--version <value>`: select a document version.
|
|
143
|
+
|
|
144
|
+
The selector values are strings and are optional except for `--content-key-or-id`. Use only the selectors required by the content record you want.
|
|
145
|
+
|
|
146
|
+
### `sf cms get variant`
|
|
147
|
+
|
|
148
|
+
Retrieves one CMS content variant by its identifier.
|
|
149
|
+
|
|
150
|
+
```sh
|
|
151
|
+
sf cms get variant --target-org my-org --variant-id 0aV...
|
|
152
|
+
sf cms get variant --target-org my-org --variant-id 0aV... --json
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Required selector: `--variant-id <id>`.
|
|
156
|
+
|
|
157
|
+
### `sf cms export workspace`
|
|
158
|
+
|
|
159
|
+
Runs an experimental, read-only, best-effort export of the variants currently observed for one CMS workspace. The destination must not already exist. This output is not a complete or guaranteed backup.
|
|
160
|
+
|
|
161
|
+
```sh
|
|
162
|
+
sf cms export workspace --target-org my-org --workspace-id 0Zu... --output-dir ./cms-export
|
|
163
|
+
sf cms export workspace --target-org my-org --workspace-id 0Zu... --output-dir ./cms-export --json
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Required flags:
|
|
167
|
+
|
|
168
|
+
- `--workspace-id <id>`: CMS workspace content-space ID. The command validates that the returned workspace ID exactly matches this value before export begins.
|
|
169
|
+
- `--output-dir <path>`: new destination directory for `manifest.json` and the exported `items/*.json` files. There is no overwrite option.
|
|
170
|
+
|
|
171
|
+
Every service warning is emitted to stderr. Human output reports the destination and exported-versus-expected counts; `--json` suppresses that human summary and returns one clean structured result.
|
|
172
|
+
|
|
173
|
+
Export layout:
|
|
174
|
+
|
|
175
|
+
```text
|
|
176
|
+
cms-export/
|
|
177
|
+
├── manifest.json
|
|
178
|
+
└── items/
|
|
179
|
+
└── <variant-id>.json
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
`manifest.json` records the source workspace, search provenance, counts, warnings, rejected IDs, failed IDs, and the exact item-file mapping. Each item file contains one observed variant representation. Treat the package as best-effort evidence from that run, not as a guaranteed backup.
|
|
183
|
+
|
|
184
|
+
### `sf cms import workspace`
|
|
185
|
+
|
|
186
|
+
Plans or applies a create-only import from an export package. Dry-run is the default: the command validates the complete local package before authenticating, resolves the destination org and workspace, requires an exact workspace ID plus nonempty `defaultLanguage` and `rootFolderId`, and checks every planned content key for conflicts without sending mutations.
|
|
187
|
+
|
|
188
|
+
Safe dry run:
|
|
189
|
+
|
|
190
|
+
```sh
|
|
191
|
+
sf cms import workspace --target-org my-org --workspace-id 0Zu... --source-dir ./cms-export
|
|
192
|
+
sf cms import workspace --target-org my-org --workspace-id 0Zu... --source-dir ./cms-export --json
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Explicit apply:
|
|
196
|
+
|
|
197
|
+
```sh
|
|
198
|
+
sf cms import workspace --target-org my-org --workspace-id 0Zu... --source-dir ./cms-export --apply --report-dir ./cms-import-report
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Required flags:
|
|
202
|
+
|
|
203
|
+
- `--target-org <username-or-alias>`: explicit destination org; no implicit target is accepted.
|
|
204
|
+
- `--workspace-id <id>`: exact destination CMS workspace content-space ID.
|
|
205
|
+
- `--source-dir <path>`: existing export package containing `manifest.json` and exactly the mapped `items/*.json` files.
|
|
206
|
+
|
|
207
|
+
Safety flags:
|
|
208
|
+
|
|
209
|
+
- `--apply`: opt in to mutations. Without it, the command only validates and preflights.
|
|
210
|
+
- `--report-dir <path>`: required with `--apply`; the destination must not exist. There is no overwrite mode.
|
|
211
|
+
- `--allow-partial`: accept a package whose manifest records omissions or incomplete coverage. Without this flag, partial exports are rejected.
|
|
212
|
+
|
|
213
|
+
A successful apply writes:
|
|
214
|
+
|
|
215
|
+
```text
|
|
216
|
+
cms-import-report/
|
|
217
|
+
└── workspace-import-run.json
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
The run report binds the run ID to the destination org ID, destination workspace ID, canonical source directory, and source-manifest SHA-256. Before each parent or child mutation it atomically records a `pending` operation containing the exact content key, language, operation kind, destination identity, deterministic request identity, and SHA-256. A response is then recorded as `succeeded` with returned IDs, or a thrown mutation is recorded as `failed` when report storage remains available. Immediate created-parent records remain available for recovery. The run itself is marked `applying`, `completed`, `failed`, or `ownership-uncertain`.
|
|
221
|
+
|
|
222
|
+
Filesystem report replacement is atomic, but the remote mutation and local report update are not a single atomic transaction. If a mutation returns successfully and its result cannot be durably written, the command raises a distinct ownership-uncertain error and keeps that operation `pending`; the report must not be interpreted as proving that no remote object was created. An existing report directory is never reused, so unresolved operations cannot be treated as resumable progress.
|
|
223
|
+
|
|
224
|
+
Import limitations and conflicts:
|
|
225
|
+
|
|
226
|
+
- Import is create-only. Any existing destination content key aborts the entire preflight before mutation; there is no overwrite, update, merge, checkpoint/resume, or cleanup command.
|
|
227
|
+
- Every content group must contain exactly one variant matching the destination workspace's `defaultLanguage`. There is no primary-language fallback.
|
|
228
|
+
- Child variants are created sequentially after their primary parent. There is no concurrency.
|
|
229
|
+
- Media-specific migration is not supported.
|
|
230
|
+
- The command does not publish or unpublish content; newly created records are expected to remain draft/unpublished.
|
|
231
|
+
- `--allow-partial` accepts known source omissions but does not make the missing records recoverable.
|
|
232
|
+
|
|
233
|
+
Recovery guidance:
|
|
234
|
+
|
|
235
|
+
1. Preserve `workspace-import-run.json` if an apply fails; it is the authoritative local journal for that run.
|
|
236
|
+
2. Reconcile every unresolved `pending` operation first, using its exact destination org/workspace, content key, language, operation kind, and request hash. A pending entry means the mutation may have happened even when no returned ID is recorded.
|
|
237
|
+
3. Inspect and verify each `succeeded` operation and immediate created-parent record in the exact destination org and workspace before taking action.
|
|
238
|
+
4. Remove only records proven to belong to that run, beginning with recorded variants. Do not infer IDs or delete by broad search, workspace, title, or content-key pattern.
|
|
239
|
+
5. If ownership or deletion is uncertain, stop and record the leftovers for manual review. Never modify workspace/channel configuration or publish content as recovery.
|
|
240
|
+
6. This journal is not a resume mechanism. After reconciliation, correct the source or destination conflict, choose a new nonexisting report directory, and run dry-run again before any new apply attempt.
|
|
241
|
+
|
|
242
|
+
In JSON mode the command returns exactly one structured command result. Human plan lines are suppressed; warnings and failures remain structured Salesforce CLI output, and transport errors redact authorization, cookies, tokens, and signed URL parameters.
|
|
243
|
+
|
|
244
|
+
## Common flags and output
|
|
245
|
+
|
|
246
|
+
- `--target-org <username-or-alias>` / `-o <username-or-alias>` selects the authenticated org. There is no implicit default for org-backed CMS commands.
|
|
247
|
+
- `--api-version <version>` overrides the default CMS request API version, currently `67.0`.
|
|
248
|
+
- `--json` returns the command result in Salesforce CLI JSON mode for scripts and automation.
|
|
249
|
+
- `--page` is zero-based, and `--page-size` controls only the requested page size. Run another command with the next page number to continue paging.
|
|
250
|
+
|
|
251
|
+
Use `sf <command> --help` to inspect the installed command's current flags, for example:
|
|
252
|
+
|
|
253
|
+
```sh
|
|
254
|
+
sf cms get content --help
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
## Development
|
|
258
|
+
|
|
259
|
+
```sh
|
|
260
|
+
npm install --no-workspaces
|
|
261
|
+
npm run lint
|
|
262
|
+
npm run build
|
|
263
|
+
npm run intake:check
|
|
264
|
+
npm test
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
## Contributor notes: experimental workspace export
|
|
268
|
+
|
|
269
|
+
The experimental export uses the v67 `GET /connect/cms/items/search` operation. The API description requires a non-wildcard `queryTerm`; runtime probing found that `queryTerm=*` returned workspace inventories of 6 and 115 variants, including Draft, Published, and Revised records. This behavior is undocumented and must be retested rather than treated as a stable listing contract.
|
|
270
|
+
|
|
271
|
+
String-array query values such as `contentSpaceOrFolderIds` and `languages` are serialized as repeated keys. Pagination reconstructs each request from the original filters instead of trusting `nextPageUri`, which was observed to remain present after an empty page. Delivery responses do not prove workspace ownership and exclude drafts. SOQL omitted a known record that remained readable through Connect REST, and CMS `9Pu` folders exposed no child-enumeration operation, so none of those alternatives establishes a complete inventory.
|
|
272
|
+
|
|
273
|
+
Current shipped export guards are deliberately narrow: one explicit workspace whose lookup ID must match exactly; zero-based paging with `pageSize=250`; at most 1,000 pages and no more than two pages beyond the advertised-count calculation; stop when the advertised count is reached, a page is empty, or a nonempty page adds no new IDs; deduplicate repeated variant IDs; verify `managedContentSpaceId` in search rows and `contentSpace.id` in variant details; record ownership rejections and detail failures; refuse an existing destination; write stable JSON to a temporary sibling directory; remove staging after failure; and rename staging only after all output is written. The command emits all recorded warnings, prints only a compact human summary outside JSON mode, and returns one structured result in JSON mode.
|
|
274
|
+
|
|
275
|
+
For every API-version upgrade, recheck the operation path and required parameters, wildcard behavior, repeated-key serialization, inventory counts and statuses, empty-page/`nextPageUri` behavior, both ownership fields, draft visibility, delivery coverage, SOQL parity, folder enumeration, duplicate-page handling, and all stop conditions before retaining export support.
|
|
276
|
+
|
|
277
|
+
Do not market this experimental output as a complete or guaranteed backup. Counts, statuses, and undocumented wildcard behavior can change, and a successful run proves only what that run observed and wrote.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Org } from '@salesforce/core';
|
|
2
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
3
|
+
import type { CmsPage, CmsRecord } from '../../services/read.js';
|
|
4
|
+
export declare const targetOrgFlag: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
5
|
+
export declare const apiVersionFlag: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
export declare const pageFlag: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
export declare const pageSizeFlag: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
export declare abstract class CmsCommand<T> extends SfCommand<T> {
|
|
9
|
+
protected getConnection(targetOrg: string, apiVersion: string): Promise<ReturnType<Org['getConnection']>>;
|
|
10
|
+
protected getOrgContext(targetOrg: string, apiVersion: string): Promise<{
|
|
11
|
+
connection: ReturnType<Org['getConnection']>;
|
|
12
|
+
orgId: string;
|
|
13
|
+
}>;
|
|
14
|
+
protected showPage(title: string, page: CmsPage): void;
|
|
15
|
+
protected showRecord(record: CmsRecord): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Org } from '@salesforce/core';
|
|
2
|
+
import { Flags, SfCommand } from '@salesforce/sf-plugins-core';
|
|
3
|
+
export const targetOrgFlag = Flags.string({
|
|
4
|
+
char: 'o',
|
|
5
|
+
required: true,
|
|
6
|
+
summary: 'Username or alias of the target Salesforce org.',
|
|
7
|
+
});
|
|
8
|
+
export const apiVersionFlag = Flags.orgApiVersion({
|
|
9
|
+
default: '67.0',
|
|
10
|
+
summary: 'Salesforce API version used for CMS requests.',
|
|
11
|
+
});
|
|
12
|
+
export const pageFlag = Flags.integer({ min: 0, summary: 'Zero-based page number.' });
|
|
13
|
+
export const pageSizeFlag = Flags.integer({ min: 1, summary: 'Maximum items requested per page.' });
|
|
14
|
+
export class CmsCommand extends SfCommand {
|
|
15
|
+
async getConnection(targetOrg, apiVersion) {
|
|
16
|
+
const context = await this.getOrgContext(targetOrg, apiVersion);
|
|
17
|
+
return context.connection;
|
|
18
|
+
}
|
|
19
|
+
async getOrgContext(targetOrg, apiVersion) {
|
|
20
|
+
const org = await Org.create({ aliasOrUsername: targetOrg });
|
|
21
|
+
return { connection: org.getConnection(apiVersion), orgId: org.getOrgId() };
|
|
22
|
+
}
|
|
23
|
+
showPage(title, page) {
|
|
24
|
+
this.table({
|
|
25
|
+
data: page.items.map((item) => ({
|
|
26
|
+
id: stringValue(item, 'id'),
|
|
27
|
+
name: stringValue(item, 'name') || stringValue(item, 'title'),
|
|
28
|
+
type: stringValue(item, 'type'),
|
|
29
|
+
})),
|
|
30
|
+
title,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
showRecord(record) {
|
|
34
|
+
if (!this.jsonEnabled())
|
|
35
|
+
this.styledJSON(record);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function stringValue(record, key) {
|
|
39
|
+
const value = record[key];
|
|
40
|
+
return typeof value === 'string' ? value : '';
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=command-base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-base.js","sourceRoot":"","sources":["../../../src/commands/cms/command-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAG/D,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAAC;IACxC,IAAI,EAAE,GAAG;IACT,QAAQ,EAAE,IAAI;IACd,OAAO,EAAE,iDAAiD;CAC3D,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,CAAC,aAAa,CAAC;IAChD,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,+CAA+C;CACzD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,yBAAyB,EAAE,CAAC,CAAC;AACtF,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,mCAAmC,EAAE,CAAC,CAAC;AAEpG,MAAM,OAAgB,UAAc,SAAQ,SAAY;IAC5C,KAAK,CAAC,aAAa,CAC3B,SAAiB,EACjB,UAAkB;QAElB,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QAChE,OAAO,OAAO,CAAC,UAAU,CAAC;IAC5B,CAAC;IAES,KAAK,CAAC,aAAa,CAC3B,SAAiB,EACjB,UAAkB;QAElB,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC,EAAE,eAAe,EAAE,SAAS,EAAE,CAAC,CAAC;QAC7D,OAAO,EAAE,UAAU,EAAE,GAAG,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC;IAC9E,CAAC;IAES,QAAQ,CAAC,KAAa,EAAE,IAAa;QAC7C,IAAI,CAAC,KAAK,CAAC;YACT,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gBAC9B,EAAE,EAAE,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC;gBAC3B,IAAI,EAAE,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC;gBAC7D,IAAI,EAAE,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC;aAChC,CAAC,CAAC;YACH,KAAK;SACN,CAAC,CAAC;IACL,CAAC;IAES,UAAU,CAAC,MAAiB;QACpC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;CACF;AAED,SAAS,WAAW,CAAC,MAAiB,EAAE,GAAW;IACjD,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC1B,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ExportWorkspaceResult } from '../../../services/export-workspace.js';
|
|
2
|
+
import { CmsCommand } from '../command-base.js';
|
|
3
|
+
export default class ExportWorkspace extends CmsCommand<ExportWorkspaceResult> {
|
|
4
|
+
static readonly summary = "Experimentally export a CMS workspace using a read-only, best-effort process.";
|
|
5
|
+
static readonly description = "Reads a Marketing Cloud CMS workspace and writes the variants observed by an experimental, best-effort search. This is not a complete or guaranteed backup and does not mutate org data.";
|
|
6
|
+
static readonly examples: string[];
|
|
7
|
+
static readonly flags: {
|
|
8
|
+
'target-org': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
'api-version': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
'workspace-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
'output-dir': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<ExportWorkspaceResult>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Flags } from '@salesforce/sf-plugins-core';
|
|
2
|
+
import { exportWorkspace, } from '../../../services/export-workspace.js';
|
|
3
|
+
import { getWorkspace } from '../../../services/read.js';
|
|
4
|
+
import { apiVersionFlag, CmsCommand, targetOrgFlag } from '../command-base.js';
|
|
5
|
+
export default class ExportWorkspace extends CmsCommand {
|
|
6
|
+
static summary = 'Experimentally export a CMS workspace using a read-only, best-effort process.';
|
|
7
|
+
static description = 'Reads a Marketing Cloud CMS workspace and writes the variants observed by an experimental, best-effort search. This is not a complete or guaranteed backup and does not mutate org data.';
|
|
8
|
+
static examples = [
|
|
9
|
+
'<%= config.bin %> cms export workspace --target-org my-org --workspace-id 0Zu... --output-dir ./cms-export',
|
|
10
|
+
];
|
|
11
|
+
static flags = {
|
|
12
|
+
'target-org': targetOrgFlag,
|
|
13
|
+
'api-version': apiVersionFlag,
|
|
14
|
+
'workspace-id': Flags.string({ required: true, summary: 'CMS workspace content-space ID.' }),
|
|
15
|
+
'output-dir': Flags.directory({
|
|
16
|
+
exists: false,
|
|
17
|
+
required: true,
|
|
18
|
+
summary: 'New directory to receive the experimental best-effort export.',
|
|
19
|
+
}),
|
|
20
|
+
};
|
|
21
|
+
async run() {
|
|
22
|
+
const { flags } = await this.parse(ExportWorkspace);
|
|
23
|
+
const connection = await this.getConnection(flags['target-org'], flags['api-version']);
|
|
24
|
+
const workspace = await getWorkspace(connection, flags['workspace-id']);
|
|
25
|
+
if (workspace.id !== flags['workspace-id']) {
|
|
26
|
+
throw new Error(`Workspace validation returned ID ${String(workspace.id)} instead of requested ID ${flags['workspace-id']}.`);
|
|
27
|
+
}
|
|
28
|
+
const result = await exportWorkspace(connection, flags['workspace-id'], flags['output-dir']);
|
|
29
|
+
for (const warning of result.manifest.warnings)
|
|
30
|
+
this.warn(formatWarning(warning));
|
|
31
|
+
if (!this.jsonEnabled()) {
|
|
32
|
+
this.log(`Destination: ${result.destination}`);
|
|
33
|
+
this.log(`Exported variants: ${result.manifest.exportedCount}/${result.manifest.expectedCount} expected`);
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function formatWarning(warning) {
|
|
39
|
+
const variantIds = warning.variantIds?.length ? ` (${warning.variantIds.join(', ')})` : '';
|
|
40
|
+
return `[${warning.code}] ${warning.message}${variantIds}`;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=workspace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../../../src/commands/cms/export/workspace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EACL,eAAe,GAGhB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAE/E,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,UAAiC;IACrE,MAAM,CAAU,OAAO,GAC5B,+EAA+E,CAAC;IAC3E,MAAM,CAAU,WAAW,GAChC,0LAA0L,CAAC;IACtL,MAAM,CAAU,QAAQ,GAAG;QAChC,4GAA4G;KAC7G,CAAC;IACK,MAAM,CAAU,KAAK,GAAG;QAC7B,YAAY,EAAE,aAAa;QAC3B,aAAa,EAAE,cAAc;QAC7B,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,iCAAiC,EAAE,CAAC;QAC5F,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC;YAC5B,MAAM,EAAE,KAAK;YACb,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,+DAA+D;SACzE,CAAC;KACH,CAAC;IAEK,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;QACpD,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;QACvF,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC,UAAU,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;QACxE,IAAI,SAAS,CAAC,EAAE,KAAK,KAAK,CAAC,cAAc,CAAC,EAAE,CAAC;YAC3C,MAAM,IAAI,KAAK,CACb,oCAAoC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,4BAA4B,KAAK,CAAC,cAAc,CAAC,GAAG,CAC7G,CAAC;QACJ,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,UAAU,EAAE,KAAK,CAAC,cAAc,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;QAC7F,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,QAAQ,CAAC,QAAQ;YAAE,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;QAElF,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACxB,IAAI,CAAC,GAAG,CAAC,gBAAgB,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;YAC/C,IAAI,CAAC,GAAG,CACN,sBAAsB,MAAM,CAAC,QAAQ,CAAC,aAAa,IAAI,MAAM,CAAC,QAAQ,CAAC,aAAa,WAAW,CAChG,CAAC;QACJ,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;;AAGH,SAAS,aAAa,CAAC,OAA+B;IACpD,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3F,OAAO,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,OAAO,GAAG,UAAU,EAAE,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type CmsRecord } from '../../../services/read.js';
|
|
2
|
+
import { CmsCommand } from '../command-base.js';
|
|
3
|
+
export default class GetChannel extends CmsCommand<CmsRecord> {
|
|
4
|
+
static readonly summary = "Get a CMS channel.";
|
|
5
|
+
static readonly description = "Retrieves a channel by its identifier.";
|
|
6
|
+
static readonly examples: string[];
|
|
7
|
+
static readonly flags: {
|
|
8
|
+
'target-org': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
'api-version': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
'channel-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
};
|
|
12
|
+
run(): Promise<CmsRecord>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Flags } from '@salesforce/sf-plugins-core';
|
|
2
|
+
import { getChannel } from '../../../services/read.js';
|
|
3
|
+
import { apiVersionFlag, CmsCommand, targetOrgFlag } from '../command-base.js';
|
|
4
|
+
export default class GetChannel extends CmsCommand {
|
|
5
|
+
static summary = 'Get a CMS channel.';
|
|
6
|
+
static description = 'Retrieves a channel by its identifier.';
|
|
7
|
+
static examples = [
|
|
8
|
+
'<%= config.bin %> cms get channel --target-org my-org --channel-id 0ap...',
|
|
9
|
+
];
|
|
10
|
+
static flags = {
|
|
11
|
+
'target-org': targetOrgFlag,
|
|
12
|
+
'api-version': apiVersionFlag,
|
|
13
|
+
'channel-id': Flags.string({ required: true, summary: 'CMS channel identifier.' }),
|
|
14
|
+
};
|
|
15
|
+
async run() {
|
|
16
|
+
const { flags } = await this.parse(GetChannel);
|
|
17
|
+
const connection = await this.getConnection(flags['target-org'], flags['api-version']);
|
|
18
|
+
const result = await getChannel(connection, flags['channel-id']);
|
|
19
|
+
this.showRecord(result);
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=channel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channel.js","sourceRoot":"","sources":["../../../../src/commands/cms/get/channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,UAAU,EAAkB,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAE/E,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,UAAqB;IACpD,MAAM,CAAU,OAAO,GAAG,oBAAoB,CAAC;IAC/C,MAAM,CAAU,WAAW,GAAG,wCAAwC,CAAC;IACvE,MAAM,CAAU,QAAQ,GAAG;QAChC,2EAA2E;KAC5E,CAAC;IACK,MAAM,CAAU,KAAK,GAAG;QAC7B,YAAY,EAAE,aAAa;QAC3B,aAAa,EAAE,cAAc;QAC7B,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,yBAAyB,EAAE,CAAC;KACnF,CAAC;IAEK,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC/C,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;QACvF,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;QACjE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACxB,OAAO,MAAM,CAAC;IAChB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type CmsRecord } from '../../../services/read.js';
|
|
2
|
+
import { CmsCommand } from '../command-base.js';
|
|
3
|
+
export default class GetContent extends CmsCommand<CmsRecord> {
|
|
4
|
+
static readonly summary = "Get CMS content.";
|
|
5
|
+
static readonly description = "Retrieves content by its key or identifier.";
|
|
6
|
+
static readonly examples: string[];
|
|
7
|
+
static readonly flags: {
|
|
8
|
+
'target-org': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
'api-version': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
'content-key-or-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
'content-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
language: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
'variant-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
version: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
};
|
|
16
|
+
run(): Promise<CmsRecord>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Flags } from '@salesforce/sf-plugins-core';
|
|
2
|
+
import { getContent } from '../../../services/read.js';
|
|
3
|
+
import { apiVersionFlag, CmsCommand, targetOrgFlag } from '../command-base.js';
|
|
4
|
+
export default class GetContent extends CmsCommand {
|
|
5
|
+
static summary = 'Get CMS content.';
|
|
6
|
+
static description = 'Retrieves content by its key or identifier.';
|
|
7
|
+
static examples = [
|
|
8
|
+
'<%= config.bin %> cms get content --target-org my-org --content-key-or-id news-banner',
|
|
9
|
+
];
|
|
10
|
+
static flags = {
|
|
11
|
+
'target-org': targetOrgFlag,
|
|
12
|
+
'api-version': apiVersionFlag,
|
|
13
|
+
'content-key-or-id': Flags.string({
|
|
14
|
+
required: true,
|
|
15
|
+
summary: 'CMS content key or identifier.',
|
|
16
|
+
}),
|
|
17
|
+
'content-version': Flags.string({ summary: 'Content version selector.' }),
|
|
18
|
+
language: Flags.string({ summary: 'Content language selector.' }),
|
|
19
|
+
'variant-version': Flags.string({ summary: 'Variant version selector.' }),
|
|
20
|
+
version: Flags.string({ summary: 'Document version selector.' }),
|
|
21
|
+
};
|
|
22
|
+
async run() {
|
|
23
|
+
const { flags } = await this.parse(GetContent);
|
|
24
|
+
const connection = await this.getConnection(flags['target-org'], flags['api-version']);
|
|
25
|
+
const result = await getContent(connection, flags['content-key-or-id'], {
|
|
26
|
+
contentVersion: flags['content-version'],
|
|
27
|
+
language: flags.language,
|
|
28
|
+
variantVersion: flags['variant-version'],
|
|
29
|
+
version: flags.version,
|
|
30
|
+
});
|
|
31
|
+
this.showRecord(result);
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content.js","sourceRoot":"","sources":["../../../../src/commands/cms/get/content.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,UAAU,EAAkB,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAE/E,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,UAAqB;IACpD,MAAM,CAAU,OAAO,GAAG,kBAAkB,CAAC;IAC7C,MAAM,CAAU,WAAW,GAAG,6CAA6C,CAAC;IAC5E,MAAM,CAAU,QAAQ,GAAG;QAChC,uFAAuF;KACxF,CAAC;IACK,MAAM,CAAU,KAAK,GAAG;QAC7B,YAAY,EAAE,aAAa;QAC3B,aAAa,EAAE,cAAc;QAC7B,mBAAmB,EAAE,KAAK,CAAC,MAAM,CAAC;YAChC,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,gCAAgC;SAC1C,CAAC;QACF,iBAAiB,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,2BAA2B,EAAE,CAAC;QACzE,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,4BAA4B,EAAE,CAAC;QACjE,iBAAiB,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,2BAA2B,EAAE,CAAC;QACzE,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,4BAA4B,EAAE,CAAC;KACjE,CAAC;IAEK,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC/C,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;QACvF,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC,mBAAmB,CAAC,EAAE;YACtE,cAAc,EAAE,KAAK,CAAC,iBAAiB,CAAC;YACxC,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,cAAc,EAAE,KAAK,CAAC,iBAAiB,CAAC;YACxC,OAAO,EAAE,KAAK,CAAC,OAAO;SACvB,CAAC,CAAC;QACH,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACxB,OAAO,MAAM,CAAC;IAChB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type CmsRecord } from '../../../services/read.js';
|
|
2
|
+
import { CmsCommand } from '../command-base.js';
|
|
3
|
+
export default class GetVariant extends CmsCommand<CmsRecord> {
|
|
4
|
+
static readonly summary = "Get a CMS content variant.";
|
|
5
|
+
static readonly description = "Retrieves a content variant by its identifier.";
|
|
6
|
+
static readonly examples: string[];
|
|
7
|
+
static readonly flags: {
|
|
8
|
+
'target-org': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
'api-version': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
'variant-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
};
|
|
12
|
+
run(): Promise<CmsRecord>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Flags } from '@salesforce/sf-plugins-core';
|
|
2
|
+
import { getVariant } from '../../../services/read.js';
|
|
3
|
+
import { apiVersionFlag, CmsCommand, targetOrgFlag } from '../command-base.js';
|
|
4
|
+
export default class GetVariant extends CmsCommand {
|
|
5
|
+
static summary = 'Get a CMS content variant.';
|
|
6
|
+
static description = 'Retrieves a content variant by its identifier.';
|
|
7
|
+
static examples = [
|
|
8
|
+
'<%= config.bin %> cms get variant --target-org my-org --variant-id 0ap...',
|
|
9
|
+
];
|
|
10
|
+
static flags = {
|
|
11
|
+
'target-org': targetOrgFlag,
|
|
12
|
+
'api-version': apiVersionFlag,
|
|
13
|
+
'variant-id': Flags.string({ required: true, summary: 'CMS content variant identifier.' }),
|
|
14
|
+
};
|
|
15
|
+
async run() {
|
|
16
|
+
const { flags } = await this.parse(GetVariant);
|
|
17
|
+
const connection = await this.getConnection(flags['target-org'], flags['api-version']);
|
|
18
|
+
const result = await getVariant(connection, flags['variant-id']);
|
|
19
|
+
this.showRecord(result);
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=variant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variant.js","sourceRoot":"","sources":["../../../../src/commands/cms/get/variant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,UAAU,EAAkB,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAE/E,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,UAAqB;IACpD,MAAM,CAAU,OAAO,GAAG,4BAA4B,CAAC;IACvD,MAAM,CAAU,WAAW,GAAG,gDAAgD,CAAC;IAC/E,MAAM,CAAU,QAAQ,GAAG;QAChC,2EAA2E;KAC5E,CAAC;IACK,MAAM,CAAU,KAAK,GAAG;QAC7B,YAAY,EAAE,aAAa;QAC3B,aAAa,EAAE,cAAc;QAC7B,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,iCAAiC,EAAE,CAAC;KAC3F,CAAC;IAEK,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC/C,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;QACvF,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;QACjE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACxB,OAAO,MAAM,CAAC;IAChB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type CmsRecord } from '../../../services/read.js';
|
|
2
|
+
import { CmsCommand } from '../command-base.js';
|
|
3
|
+
export default class GetWorkspace extends CmsCommand<CmsRecord> {
|
|
4
|
+
static readonly summary = "Get a Marketing Cloud CMS workspace.";
|
|
5
|
+
static readonly description = "Retrieves one CMS workspace by its content-space ID.";
|
|
6
|
+
static readonly examples: string[];
|
|
7
|
+
static readonly flags: {
|
|
8
|
+
'target-org': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
'api-version': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
'workspace-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
};
|
|
12
|
+
run(): Promise<CmsRecord>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Flags } from '@salesforce/sf-plugins-core';
|
|
2
|
+
import { getWorkspace } from '../../../services/read.js';
|
|
3
|
+
import { apiVersionFlag, CmsCommand, targetOrgFlag } from '../command-base.js';
|
|
4
|
+
export default class GetWorkspace extends CmsCommand {
|
|
5
|
+
static summary = 'Get a Marketing Cloud CMS workspace.';
|
|
6
|
+
static description = 'Retrieves one CMS workspace by its content-space ID.';
|
|
7
|
+
static examples = [
|
|
8
|
+
'<%= config.bin %> cms get workspace --target-org my-org --workspace-id 0Zu...',
|
|
9
|
+
];
|
|
10
|
+
static flags = {
|
|
11
|
+
'target-org': targetOrgFlag,
|
|
12
|
+
'api-version': apiVersionFlag,
|
|
13
|
+
'workspace-id': Flags.string({ required: true, summary: 'CMS workspace content-space ID.' }),
|
|
14
|
+
};
|
|
15
|
+
async run() {
|
|
16
|
+
const { flags } = await this.parse(GetWorkspace);
|
|
17
|
+
const connection = await this.getConnection(flags['target-org'], flags['api-version']);
|
|
18
|
+
const result = await getWorkspace(connection, flags['workspace-id']);
|
|
19
|
+
this.showRecord(result);
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=workspace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../../../src/commands/cms/get/workspace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,YAAY,EAAkB,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAE/E,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,UAAqB;IACtD,MAAM,CAAU,OAAO,GAAG,sCAAsC,CAAC;IACjE,MAAM,CAAU,WAAW,GAAG,sDAAsD,CAAC;IACrF,MAAM,CAAU,QAAQ,GAAG;QAChC,+EAA+E;KAChF,CAAC;IACK,MAAM,CAAU,KAAK,GAAG;QAC7B,YAAY,EAAE,aAAa;QAC3B,aAAa,EAAE,cAAc;QAC7B,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,iCAAiC,EAAE,CAAC;KAC7F,CAAC;IAEK,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QACjD,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;QACvF,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,UAAU,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;QACrE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACxB,OAAO,MAAM,CAAC;IAChB,CAAC"}
|