sf-plugin-cms 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +116 -13
- package/lib/{commands/cms/command-base.d.ts → command-base.d.ts} +2 -1
- package/lib/{commands/cms/command-base.js → command-base.js} +3 -0
- package/lib/command-base.js.map +1 -0
- package/lib/commands/cms/export/workspace.d.ts +12 -5
- package/lib/commands/cms/export/workspace.js +102 -11
- package/lib/commands/cms/export/workspace.js.map +1 -1
- package/lib/commands/cms/get/channel.d.ts +1 -1
- package/lib/commands/cms/get/channel.js +1 -1
- package/lib/commands/cms/get/channel.js.map +1 -1
- package/lib/commands/cms/get/content.d.ts +1 -1
- package/lib/commands/cms/get/content.js +1 -1
- package/lib/commands/cms/get/content.js.map +1 -1
- package/lib/commands/cms/get/variant.d.ts +1 -1
- package/lib/commands/cms/get/variant.js +1 -1
- package/lib/commands/cms/get/variant.js.map +1 -1
- package/lib/commands/cms/get/workspace.d.ts +1 -1
- package/lib/commands/cms/get/workspace.js +1 -1
- package/lib/commands/cms/get/workspace.js.map +1 -1
- package/lib/commands/cms/import/workspace.d.ts +7 -4
- package/lib/commands/cms/import/workspace.js +121 -35
- package/lib/commands/cms/import/workspace.js.map +1 -1
- package/lib/commands/cms/info.d.ts +11 -10
- package/lib/commands/cms/info.js +123 -8
- package/lib/commands/cms/info.js.map +1 -1
- package/lib/commands/cms/list/channel.d.ts +1 -1
- package/lib/commands/cms/list/channel.js +1 -1
- package/lib/commands/cms/list/channel.js.map +1 -1
- package/lib/commands/cms/list/workspace.d.ts +1 -1
- package/lib/commands/cms/list/workspace.js +1 -1
- package/lib/commands/cms/list/workspace.js.map +1 -1
- package/lib/contracts/info.d.ts +43 -0
- package/lib/contracts/info.js +69 -0
- package/lib/contracts/info.js.map +1 -0
- package/lib/contracts/shared.d.ts +81 -0
- package/lib/contracts/shared.js +218 -0
- package/lib/contracts/shared.js.map +1 -0
- package/lib/contracts/workspace-export.d.ts +91 -0
- package/lib/contracts/workspace-export.js +324 -0
- package/lib/contracts/workspace-export.js.map +1 -0
- package/lib/contracts/workspace-import.d.ts +46 -0
- package/lib/contracts/workspace-import.js +108 -0
- package/lib/contracts/workspace-import.js.map +1 -0
- package/lib/index.d.ts +1 -1
- package/lib/services/bulk-export-workspaces.d.ts +25 -0
- package/lib/services/bulk-export-workspaces.js +272 -0
- package/lib/services/bulk-export-workspaces.js.map +1 -0
- package/lib/services/export-references.d.ts +21 -0
- package/lib/services/export-references.js +150 -0
- package/lib/services/export-references.js.map +1 -0
- package/lib/services/export-workspace.d.ts +10 -22
- package/lib/services/export-workspace.js +68 -2
- package/lib/services/export-workspace.js.map +1 -1
- package/lib/services/import-workspace.d.ts +7 -3
- package/lib/services/import-workspace.js +224 -96
- package/lib/services/import-workspace.js.map +1 -1
- package/lib/services/resolve-workspace.d.ts +5 -0
- package/lib/services/resolve-workspace.js +56 -47
- package/lib/services/resolve-workspace.js.map +1 -1
- package/messages/cms.export.workspace.md +22 -4
- package/messages/cms.import.workspace.md +8 -2
- package/messages/cms.info.md +21 -0
- package/package.json +3 -2
- package/lib/commands/cms/command-base.js.map +0 -1
package/README.md
CHANGED
|
@@ -48,12 +48,14 @@ sf plugins link .
|
|
|
48
48
|
|
|
49
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
50
|
|
|
51
|
-
Confirm that the plugin loads without making an org request:
|
|
51
|
+
Confirm that the plugin loads and inspect its frozen machine-contract capabilities without making an org request:
|
|
52
52
|
|
|
53
53
|
```sh
|
|
54
|
-
sf cms info
|
|
54
|
+
sf cms info --json
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
+
Machine consumers should run this command first and select a mutually supported command-result major before invoking an org-backed operation.
|
|
58
|
+
|
|
57
59
|
## Command reference
|
|
58
60
|
|
|
59
61
|
| Command | Details |
|
|
@@ -72,12 +74,17 @@ All org-backed commands require `--target-org <username-or-alias>` (short form `
|
|
|
72
74
|
|
|
73
75
|
### `sf cms info`
|
|
74
76
|
|
|
75
|
-
|
|
77
|
+
Returns the offline `sf-cms-info@1` capability envelope. This is the safest first command because it does not contact an org.
|
|
76
78
|
|
|
77
79
|
```sh
|
|
78
|
-
sf cms info
|
|
80
|
+
sf cms info --json
|
|
81
|
+
sf cms info --contract-version 1 --json
|
|
79
82
|
```
|
|
80
83
|
|
|
84
|
+
The result advertises command-result versions separately from compatible workspace-package manifest majors. It currently reports API `67.0` as both the default and sole tested version. Bulk export is implemented; external-reference correlation and import mapping remain experimental because only evidenced CMS reference kinds can be resolved. Installation alone does not prove org permissions or endpoint availability.
|
|
85
|
+
|
|
86
|
+
`--contract-version <major>` defaults to `1`. Any unsupported major returns a `blocked` `sf-cms-info` envelope with diagnostic code `UNSUPPORTED_CONTRACT_VERSION` and exit `1`, without org access.
|
|
87
|
+
|
|
81
88
|
### `sf cms list workspace`
|
|
82
89
|
|
|
83
90
|
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.
|
|
@@ -168,21 +175,26 @@ Required selector: `--variant-id <id>`.
|
|
|
168
175
|
|
|
169
176
|
### `sf cms export workspace`
|
|
170
177
|
|
|
171
|
-
Runs an experimental, read-only, best-effort export of the variants currently observed for one CMS workspace
|
|
178
|
+
Runs an experimental, read-only, best-effort export of the variants currently observed for one CMS workspace or every workspace. This output is not a complete or guaranteed backup.
|
|
172
179
|
|
|
173
180
|
```sh
|
|
174
181
|
sf cms export workspace --target-org my-org --workspace-name "Main Site"
|
|
175
182
|
sf cms export workspace --target-org my-org --workspace-id 0Zu... --output-dir ./custom-export --json
|
|
183
|
+
sf cms export workspace --target-org my-org --all --workspace-type Marketing --output-dir ./cms --contract-version 1 --json
|
|
176
184
|
```
|
|
177
185
|
|
|
178
|
-
|
|
186
|
+
Choose either single or bulk mode:
|
|
187
|
+
|
|
188
|
+
- Single mode requires exactly one of `--workspace-id <id>` or `--workspace-name <name>`. Name matching is exact but case-insensitive. Case-only or Unicode-normalization-equivalent duplicates are ambiguous. The canonical fetched workspace name is always used for the default folder, preserving its casing.
|
|
189
|
+
- Bulk mode uses `--all`, which is mutually exclusive with both single selectors. Optional `--workspace-type Marketing|Content` is valid only with `--all`; input casing is ignored and output is normalized to `Marketing` or `Content`.
|
|
179
190
|
|
|
180
|
-
|
|
181
|
-
- `--workspace-name <name>`: exact, case-sensitive workspace name. The command scans bounded zero-based pages, rejects distinct-ID ambiguity, then validates the selected workspace by ID.
|
|
191
|
+
In single mode, `--output-dir <path>` remains the exact new destination. When omitted, export writes to `./cms/<safe-canonical-workspace-name>`. In bulk mode, `--output-dir` is the parent directory and defaults to `./cms`; each workspace is written beneath it using the canonical fetched name. Safe segments preserve Unicode and case, replace path/control/Windows-invalid characters, and trim unsafe trailing dots or spaces.
|
|
182
192
|
|
|
183
|
-
|
|
193
|
+
Bulk mode performs a strict global preflight before the first workspace export: it enumerates until an empty page, canonicalizes every workspace by ID, validates IDs, names, and actual types, applies the optional type filter, sorts by canonical ID, checks the output parent and every destination, and rejects collisions after sanitization, Unicode normalization, and case folding. Any preflight failure creates no destinations and makes no export calls.
|
|
184
194
|
|
|
185
|
-
|
|
195
|
+
After preflight, each workspace export remains atomic. Execution continues after individual failures. Manifest warnings count as successful exports. JSON and human modes both return the complete deterministic aggregate with discovered, selected, succeeded, and failed counts plus per-workspace status, manifest, or redacted single-line error. A partial execution sets a nonzero process exit code only after the aggregate is emitted.
|
|
196
|
+
|
|
197
|
+
This bulk command is also the delegation target for tools such as `sf-plugin-mcnext` that need a complete CMS workspace handoff without duplicating CMS export logic; no `sf-plugin-mcnext` changes are required.
|
|
186
198
|
|
|
187
199
|
Export layout:
|
|
188
200
|
|
|
@@ -204,7 +216,7 @@ Safe dry run:
|
|
|
204
216
|
|
|
205
217
|
```sh
|
|
206
218
|
sf cms import workspace --target-org my-org --workspace-name "Destination" --source-dir "./cms/Source"
|
|
207
|
-
sf cms import workspace --target-org my-org --workspace-id 0Zu... --source-dir "./cms/Source" --json
|
|
219
|
+
sf cms import workspace --target-org my-org --workspace-id 0Zu... --source-dir "./cms/Source" --contract-version 1 --json
|
|
208
220
|
```
|
|
209
221
|
|
|
210
222
|
Explicit apply:
|
|
@@ -269,14 +281,103 @@ Use `sf <command> --help` to inspect the installed command's current flags, for
|
|
|
269
281
|
sf cms get content --help
|
|
270
282
|
```
|
|
271
283
|
|
|
284
|
+
## Versioned machine contracts
|
|
285
|
+
|
|
286
|
+
### Integration boundary and ownership
|
|
287
|
+
|
|
288
|
+
The supported v0.3.0 integration boundary is the Salesforce CLI subprocess. A consumer such as an MCN orchestrator should:
|
|
289
|
+
|
|
290
|
+
1. Run `sf cms info --json`, require the needed capability, and choose a mutually supported command-result major.
|
|
291
|
+
2. Run bulk export or workspace import with `--contract-version 1 --json`.
|
|
292
|
+
3. Consume the returned CMS mappings and rewrite only fields owned by that consumer.
|
|
293
|
+
|
|
294
|
+
CMS owns CMS artifact identity, source-to-target CMS mappings, import ordering, and CMS-internal reference rewriting. Dependency discovery and closure are unavailable in v0.3.0: exports preserve only evidenced opaque identity inventory and do not expose dependency edges. Consumers must not inspect package payloads to reconstruct CMS identity, infer dependencies or mappings, or rewrite CMS-owned references. No public JavaScript API is part of v0.3.0; the CLI JSON boundary is sufficient and avoids a second integration surface.
|
|
295
|
+
|
|
296
|
+
### Authoritative envelope
|
|
297
|
+
|
|
298
|
+
`sf cms info --json`, aggregate `sf cms export workspace --all --json`, and `sf cms import workspace --json` return exactly these top-level fields:
|
|
299
|
+
|
|
300
|
+
```json
|
|
301
|
+
{
|
|
302
|
+
"contract": "<operation-contract>",
|
|
303
|
+
"contractVersion": "1.0.0",
|
|
304
|
+
"status": "success",
|
|
305
|
+
"metadata": {
|
|
306
|
+
"operation": "<cms.info|workspace.export.bulk|workspace.import>",
|
|
307
|
+
"plugin": { "name": "sf-plugin-cms", "version": "0.3.0" },
|
|
308
|
+
"apiVersion": "67.0"
|
|
309
|
+
},
|
|
310
|
+
"diagnostics": { "warnings": [], "errors": [] },
|
|
311
|
+
"provenance": {
|
|
312
|
+
"producer": "sf-plugin-cms",
|
|
313
|
+
"sourceOrgId": "<org-id-or-offline>",
|
|
314
|
+
"pluginVersion": "0.3.0",
|
|
315
|
+
"command": "sf cms <operation>",
|
|
316
|
+
"generatedAt": "<ISO-8601>"
|
|
317
|
+
},
|
|
318
|
+
"result": {}
|
|
319
|
+
}
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
Statuses are `success`, `partial`, `failed`, or `blocked`. Diagnostics contain bounded, redacted entries shaped as `{ code, message, scope?, reference?, retryable? }`. `result` is `null` only when a failed or blocked command has no usable operation result. Aggregate export provenance additionally contains deterministic `exportSetId`.
|
|
323
|
+
|
|
324
|
+
The `--contract-version <major>` flag selects the command envelope/result major and defaults to `1`; it does not select the independently declared package-manifest version. Unsupported command-result majors block with `UNSUPPORTED_CONTRACT_VERSION` before org access. Import also validates the package-declared manifest major before org access and blocks unsupported packages with `UNSUPPORTED_PACKAGE_VERSION`.
|
|
325
|
+
|
|
326
|
+
### Exact operation results
|
|
327
|
+
|
|
328
|
+
`sf-cms-info@1` reports plugin/API versions, supported command results, supported package manifests, result-to-manifest compatibility, and these capability IDs:
|
|
329
|
+
|
|
330
|
+
- `workspace.export.bulk` — `implemented`, contract `sf-cms-workspace-export-set@1`.
|
|
331
|
+
- `workspace.export.dependency-closure` — `unavailable`; v0.3.0 does not discover or traverse CMS relationships.
|
|
332
|
+
- `workspace.export.external-reference-correlation` — `experimental`, embedded contract `sf-cms-external-reference-correlations@1`.
|
|
333
|
+
- `workspace.import.mapping` — `experimental`, contract `sf-cms-workspace-import@1`.
|
|
334
|
+
|
|
335
|
+
`sf-cms-workspace-export-set@1` contains `workspaceType`, a portable `outputDirectory`, selection and summary counts, `externalReferenceCorrelations`, and deterministic per-workspace entries. Workspace entries include canonical source identity, `success|partial|failed` status, relative artifact/manifest paths and hashes when finalized, and structured diagnostics. Any finalized omission or unresolved/unsupported reference makes that workspace and aggregate partial.
|
|
336
|
+
|
|
337
|
+
The correlation table exists only at `result.externalReferenceCorrelations`. Each `sf-cms-external-reference-correlations@1` row has exactly five fields:
|
|
338
|
+
|
|
339
|
+
```json
|
|
340
|
+
{
|
|
341
|
+
"sourceWorkspaceId": "0Zu...",
|
|
342
|
+
"sourceReference": "<exact opaque value>",
|
|
343
|
+
"referenceKind": "cms.content",
|
|
344
|
+
"referenceId": "ref:<sha256>",
|
|
345
|
+
"packageManifestSha256": "<64 lowercase hex>"
|
|
346
|
+
}
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
`sourceReference` is serialized unchanged and matched by exact string equality only—no trimming, case folding, decoding, hashing, or fuzzy matching. Rows bind to a canonical CMS reference, source workspace, and verified package manifest. Envelope provenance binds the entire set to its producer, source org, plugin version, and export-set identity. Duplicate or conflicting correlations block the contract. Unresolved and unsupported values appear only as diagnostics/references and never as correlation rows or resolved mappings.
|
|
350
|
+
|
|
351
|
+
`sf-cms-workspace-import@1` contains the verified source package identity, explicit target org/workspace, integrity counts, deterministic mappings, and unresolved/unsupported references. A resolved mapping supplies `target.targetReference`; consumers must use that value rather than derive one from IDs. Rewriting is limited to the evidenced CMS-owned `contentBody.*.ref.contentKey` shape. `cmsReferencesRewritten: true` is reported only when every required target mapping was available before the outgoing mutation and inspection of the exact outgoing parent and variant payloads proves that no relevant source key remains. Forward, self, and unknown references stay unresolved or unsupported. Dry-run remains truthful and does not claim target resolution that requires a mutation.
|
|
352
|
+
|
|
353
|
+
### Package layout and integrity
|
|
354
|
+
|
|
355
|
+
A v1 workspace export package contains `manifest.json` plus regular item files. `manifest.json` is the sole package control file and the sole regular file excluded from `items[]`. Every other regular file must occur exactly once in `items[]`; directories are excluded, while symlinks and other special filesystem entries are rejected. Paths are relative POSIX-style paths.
|
|
356
|
+
|
|
357
|
+
Each item records exactly `{ path, sha256, kind, referenceId? }`, with lowercase SHA-256 calculated over the finalized exact file bytes. Import independently validates the manifest major, enumerates the package, rejects missing, substituted, duplicate-path, or unlisted files, and verifies every item hash. Only after the listed set and hashes are verified does it hash the exact `manifest.json` bytes and use that hash as package identity.
|
|
358
|
+
|
|
359
|
+
Opaque reference descriptors remain CMS-owned identity inventory. Their portable values must not be interpreted by consumers, and `dependencies` remains empty because relationship discovery is unavailable. Only evidenced kinds can be `included` or become resolved mappings; unresolved or unsupported relationship classes are emitted only when the exported payload actually contains that evidence. This experimental export proves only the artifacts observed during that run and is not a complete backup.
|
|
360
|
+
|
|
361
|
+
### Exit codes and automation
|
|
362
|
+
|
|
363
|
+
- Exit `0`: command-owned contract status `success`.
|
|
364
|
+
- Exit `2`: contract status `partial`; usable aggregate/result data is still returned.
|
|
365
|
+
- Exit `1`: command-owned status `failed` or `blocked`.
|
|
366
|
+
- Salesforce CLI framework parse, configuration, or authentication failures can retain the framework's standard JSON/error shape and exit behavior; they are outside the command-result contract.
|
|
367
|
+
|
|
368
|
+
Automation should parse stdout JSON and inspect the process exit code. It must not infer status by scraping stderr. Human and JSON modes report the same status, counts, and artifact paths.
|
|
369
|
+
|
|
272
370
|
## Development
|
|
273
371
|
|
|
274
372
|
```sh
|
|
275
|
-
npm install
|
|
373
|
+
npm install --no-workspaces
|
|
374
|
+
npm run lint:fix
|
|
276
375
|
npm run lint
|
|
277
376
|
npm run build
|
|
278
377
|
npm run intake:check
|
|
378
|
+
npm run generate:check
|
|
279
379
|
npm test
|
|
380
|
+
npm run validate:package
|
|
280
381
|
```
|
|
281
382
|
|
|
282
383
|
## Contributor notes: experimental workspace export
|
|
@@ -285,7 +386,9 @@ The experimental export uses the v67 `GET /connect/cms/items/search` operation.
|
|
|
285
386
|
|
|
286
387
|
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.
|
|
287
388
|
|
|
288
|
-
Current shipped export guards
|
|
389
|
+
Current shipped export guards include an explicit single-workspace mode and a strict bulk preflight. Workspace enumeration is zero-based with `pageSize=250`, deduplicates exact IDs, ignores advertised totals as a termination signal, and continues until an empty page. It fails closed on repeated pages, no progress, malformed IDs, case/Unicode-equivalent IDs, or the 1,000-page cap. Bulk preflight canonicalizes every workspace with a GET, validates canonical ID, name, and `spaceType`, filters by actual type, sorts by canonical ID, and rejects unsafe or colliding destinations before any export starts.
|
|
390
|
+
|
|
391
|
+
Per-workspace variant export remains atomic and best-effort: it verifies `managedContentSpaceId` in search rows and `contentSpace.id` in variant details, records ownership rejections and detail failures, refuses an existing destination, writes stable JSON to a temporary sibling directory, removes staging after failure, and renames staging only after all output is written. Bulk execution continues across workspace failures and emits a deterministic complete aggregate in both human and JSON modes.
|
|
289
392
|
|
|
290
393
|
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.
|
|
291
394
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Org } from '@salesforce/core';
|
|
2
2
|
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
3
|
-
import type { CmsPage, CmsRecord } from '
|
|
3
|
+
import type { CmsPage, CmsRecord } from './services/read.js';
|
|
4
4
|
export declare const targetOrgFlag: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
5
5
|
export declare const apiVersionFlag: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
6
|
export declare const pageFlag: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
7
|
export declare const pageSizeFlag: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
8
|
export declare abstract class CmsCommand<T> extends SfCommand<T> {
|
|
9
|
+
protected toSuccessJson(result: T): SfCommand.Json<T>;
|
|
9
10
|
protected getConnection(targetOrg: string, apiVersion: string): Promise<ReturnType<Org['getConnection']>>;
|
|
10
11
|
protected getOrgContext(targetOrg: string, apiVersion: string): Promise<{
|
|
11
12
|
connection: ReturnType<Org['getConnection']>;
|
|
@@ -12,6 +12,9 @@ export const apiVersionFlag = Flags.orgApiVersion({
|
|
|
12
12
|
export const pageFlag = Flags.integer({ min: 0, summary: 'Zero-based page number.' });
|
|
13
13
|
export const pageSizeFlag = Flags.integer({ min: 1, summary: 'Maximum items requested per page.' });
|
|
14
14
|
export class CmsCommand extends SfCommand {
|
|
15
|
+
toSuccessJson(result) {
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
15
18
|
async getConnection(targetOrg, apiVersion) {
|
|
16
19
|
const context = await this.getOrgContext(targetOrg, apiVersion);
|
|
17
20
|
return context.connection;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-base.js","sourceRoot":"","sources":["../src/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;AACt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C;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"}
|
|
@@ -1,15 +1,22 @@
|
|
|
1
|
+
import { type WorkspaceExportSetResult } from '../../../contracts/workspace-export.js';
|
|
2
|
+
import { type CmsEnvelope } from '../../../contracts/shared.js';
|
|
1
3
|
import { type ExportWorkspaceResult } from '../../../services/export-workspace.js';
|
|
2
|
-
import { CmsCommand } from '
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
static readonly
|
|
4
|
+
import { CmsCommand } from '../../../command-base.js';
|
|
5
|
+
type WorkspaceExportCommandResult = CmsEnvelope<WorkspaceExportSetResult> | ExportWorkspaceResult;
|
|
6
|
+
export default class ExportWorkspace extends CmsCommand<WorkspaceExportCommandResult> {
|
|
7
|
+
static readonly summary = "Experimentally export one or all CMS workspaces using a read-only, best-effort process.";
|
|
8
|
+
static readonly description = "Experimentally exports one Marketing Cloud CMS workspace selected by exact ID or case-insensitive exact name, or preflights and exports all workspaces under a parent directory. Canonical fetched names and casing are preserved. Bulk preflight is global and strict; execution then continues across individual failures and returns a complete aggregate. This is not a complete or guaranteed backup and does not mutate org data.";
|
|
6
9
|
static readonly examples: string[];
|
|
7
10
|
static readonly flags: {
|
|
8
11
|
'target-org': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
12
|
'api-version': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
'contract-version': import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
all: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
15
|
'workspace-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
16
|
'workspace-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
'workspace-type': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
18
|
'output-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
19
|
};
|
|
14
|
-
run(): Promise<
|
|
20
|
+
run(): Promise<WorkspaceExportCommandResult>;
|
|
15
21
|
}
|
|
22
|
+
export {};
|
|
@@ -1,33 +1,94 @@
|
|
|
1
1
|
import { Flags } from '@salesforce/sf-plugins-core';
|
|
2
|
+
import { assertWorkspaceExportSetResult, } from '../../../contracts/workspace-export.js';
|
|
3
|
+
import { assertSupportedMajor } from '../../../contracts/shared.js';
|
|
4
|
+
import { exportAllWorkspaces, normalizeWorkspaceType, } from '../../../services/bulk-export-workspaces.js';
|
|
2
5
|
import { defaultWorkspaceDestination, exportWorkspace, } from '../../../services/export-workspace.js';
|
|
3
6
|
import { assertWorkspaceSelector, resolveWorkspace } from '../../../services/resolve-workspace.js';
|
|
4
|
-
import { apiVersionFlag, CmsCommand, targetOrgFlag } from '
|
|
7
|
+
import { apiVersionFlag, CmsCommand, targetOrgFlag } from '../../../command-base.js';
|
|
5
8
|
export default class ExportWorkspace extends CmsCommand {
|
|
6
|
-
static summary = 'Experimentally export
|
|
7
|
-
static description = '
|
|
9
|
+
static summary = 'Experimentally export one or all CMS workspaces using a read-only, best-effort process.';
|
|
10
|
+
static description = 'Experimentally exports one Marketing Cloud CMS workspace selected by exact ID or case-insensitive exact name, or preflights and exports all workspaces under a parent directory. Canonical fetched names and casing are preserved. Bulk preflight is global and strict; execution then continues across individual failures and returns a complete aggregate. This is not a complete or guaranteed backup and does not mutate org data.';
|
|
8
11
|
static examples = [
|
|
9
12
|
'<%= config.bin %> cms export workspace --target-org my-org --workspace-name "Main Site"',
|
|
10
13
|
'<%= config.bin %> cms export workspace --target-org my-org --workspace-id 0Zu... --output-dir ./cms-export',
|
|
14
|
+
'<%= config.bin %> cms export workspace --target-org my-org --all --workspace-type Marketing --output-dir ./cms --contract-version 1 --json',
|
|
11
15
|
];
|
|
12
16
|
static flags = {
|
|
13
17
|
'target-org': targetOrgFlag,
|
|
14
18
|
'api-version': apiVersionFlag,
|
|
15
|
-
'
|
|
16
|
-
|
|
19
|
+
'contract-version': Flags.integer({
|
|
20
|
+
default: 1,
|
|
21
|
+
min: 1,
|
|
22
|
+
summary: 'Machine contract major version (supported: 1).',
|
|
23
|
+
}),
|
|
24
|
+
all: Flags.boolean({
|
|
25
|
+
exclusive: ['workspace-id', 'workspace-name'],
|
|
26
|
+
summary: 'Export every CMS workspace after a strict global preflight.',
|
|
27
|
+
}),
|
|
28
|
+
'workspace-id': Flags.string({
|
|
29
|
+
exclusive: ['all', 'workspace-name'],
|
|
30
|
+
summary: 'Exact CMS workspace content-space ID.',
|
|
31
|
+
}),
|
|
32
|
+
'workspace-name': Flags.string({
|
|
33
|
+
exclusive: ['all', 'workspace-id'],
|
|
34
|
+
summary: 'Exact case-insensitive CMS workspace name.',
|
|
35
|
+
}),
|
|
36
|
+
'workspace-type': Flags.string({
|
|
37
|
+
dependsOn: ['all'],
|
|
38
|
+
parse: async (input) => normalizeWorkspaceType(input),
|
|
39
|
+
summary: 'Bulk-only workspace type filter: Marketing or Content (case-insensitive).',
|
|
40
|
+
}),
|
|
17
41
|
'output-dir': Flags.directory({
|
|
18
42
|
exists: false,
|
|
19
|
-
summary: '
|
|
43
|
+
summary: 'Single: exact new destination. Bulk: parent directory. Defaults to ./cms/<name> or ./cms.',
|
|
20
44
|
}),
|
|
21
45
|
};
|
|
22
46
|
async run() {
|
|
23
47
|
const { flags } = await this.parse(ExportWorkspace);
|
|
24
|
-
const
|
|
48
|
+
const isBulk = flags.all === true;
|
|
49
|
+
const contractVersion = flags['contract-version'] ?? 1;
|
|
50
|
+
if (contractVersion !== 1) {
|
|
51
|
+
const blocked = blockedEnvelope(contractVersion, flags['api-version']);
|
|
52
|
+
if (!this.jsonEnabled())
|
|
53
|
+
this.styledJSON(blocked);
|
|
54
|
+
process.exitCode = 1;
|
|
55
|
+
return blocked;
|
|
56
|
+
}
|
|
57
|
+
if (isBulk)
|
|
58
|
+
assertSupportedMajor(contractVersion);
|
|
59
|
+
if (!isBulk) {
|
|
60
|
+
assertWorkspaceSelector({
|
|
61
|
+
workspaceId: flags['workspace-id'],
|
|
62
|
+
workspaceName: flags['workspace-name'],
|
|
63
|
+
});
|
|
64
|
+
if (flags['workspace-type'] !== undefined) {
|
|
65
|
+
throw new Error('--workspace-type is valid only with --all.');
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (isBulk) {
|
|
69
|
+
const { connection, orgId } = await this.getOrgContext(flags['target-org'], flags['api-version']);
|
|
70
|
+
const workspaceType = normalizeWorkspaceType(flags['workspace-type'] ?? 'Marketing');
|
|
71
|
+
const result = await exportAllWorkspaces(connection, flags['output-dir'] ?? './cms', workspaceType, {
|
|
72
|
+
apiVersion: flags['api-version'],
|
|
73
|
+
pluginVersion: '0.3.0',
|
|
74
|
+
sourceOrgId: orgId,
|
|
75
|
+
});
|
|
76
|
+
assertWorkspaceExportSetResult(result.result, result.provenance);
|
|
77
|
+
if (!this.jsonEnabled())
|
|
78
|
+
this.styledJSON(result);
|
|
79
|
+
if (result.status === 'success')
|
|
80
|
+
process.exitCode = 0;
|
|
81
|
+
else if (result.status === 'partial')
|
|
82
|
+
process.exitCode = 2;
|
|
83
|
+
else
|
|
84
|
+
process.exitCode = 1;
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
87
|
+
const connection = await this.getConnection(flags['target-org'], flags['api-version']);
|
|
88
|
+
const selected = await resolveWorkspace(connection, {
|
|
25
89
|
workspaceId: flags['workspace-id'],
|
|
26
90
|
workspaceName: flags['workspace-name'],
|
|
27
|
-
};
|
|
28
|
-
assertWorkspaceSelector(selector);
|
|
29
|
-
const connection = await this.getConnection(flags['target-org'], flags['api-version']);
|
|
30
|
-
const selected = await resolveWorkspace(connection, selector);
|
|
91
|
+
});
|
|
31
92
|
let destination = flags['output-dir'];
|
|
32
93
|
if (destination === undefined) {
|
|
33
94
|
const workspaceName = selected.workspace.name;
|
|
@@ -46,6 +107,36 @@ export default class ExportWorkspace extends CmsCommand {
|
|
|
46
107
|
return result;
|
|
47
108
|
}
|
|
48
109
|
}
|
|
110
|
+
function blockedEnvelope(requestedVersion, apiVersion) {
|
|
111
|
+
return {
|
|
112
|
+
contract: 'sf-cms-workspace-export-set',
|
|
113
|
+
contractVersion: '1.0.0',
|
|
114
|
+
status: 'blocked',
|
|
115
|
+
metadata: {
|
|
116
|
+
operation: 'workspace.export.bulk',
|
|
117
|
+
plugin: { name: 'sf-plugin-cms', version: '0.3.0' },
|
|
118
|
+
apiVersion,
|
|
119
|
+
},
|
|
120
|
+
diagnostics: {
|
|
121
|
+
warnings: [],
|
|
122
|
+
errors: [
|
|
123
|
+
{
|
|
124
|
+
code: 'UNSUPPORTED_CONTRACT_VERSION',
|
|
125
|
+
message: `Contract major ${requestedVersion} is unsupported; supported major is 1.`,
|
|
126
|
+
retryable: false,
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
},
|
|
130
|
+
provenance: {
|
|
131
|
+
producer: 'sf-plugin-cms',
|
|
132
|
+
sourceOrgId: 'unresolved-org',
|
|
133
|
+
pluginVersion: '0.3.0',
|
|
134
|
+
command: 'sf cms export workspace',
|
|
135
|
+
generatedAt: new Date().toISOString(),
|
|
136
|
+
},
|
|
137
|
+
result: null,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
49
140
|
function formatWarning(warning) {
|
|
50
141
|
const variantIds = warning.variantIds?.length ? ` (${warning.variantIds.join(', ')})` : '';
|
|
51
142
|
return `[${warning.code}] ${warning.message}${variantIds}`;
|
|
@@ -1 +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,2BAA2B,EAC3B,eAAe,GAGhB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AACnG,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,
|
|
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,8BAA8B,GAE/B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAoB,MAAM,8BAA8B,CAAC;AACtF,OAAO,EACL,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EACL,2BAA2B,EAC3B,eAAe,GAGhB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AACnG,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAIrF,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,UAAwC;IAC5E,MAAM,CAAU,OAAO,GAC5B,yFAAyF,CAAC;IACrF,MAAM,CAAU,WAAW,GAChC,yaAAya,CAAC;IACra,MAAM,CAAU,QAAQ,GAAG;QAChC,yFAAyF;QACzF,4GAA4G;QAC5G,4IAA4I;KAC7I,CAAC;IACK,MAAM,CAAU,KAAK,GAAG;QAC7B,YAAY,EAAE,aAAa;QAC3B,aAAa,EAAE,cAAc;QAC7B,kBAAkB,EAAE,KAAK,CAAC,OAAO,CAAC;YAChC,OAAO,EAAE,CAAC;YACV,GAAG,EAAE,CAAC;YACN,OAAO,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AChB,CAAC;;AAGH,SAAS,eAAe,CACtB,gBAAwB,EACxB,UAAkB;IAElB,OAAO;QACL,QAAQ,EAAE,6BAA6B;QACvC,eAAe,EAAE,OAAO;QACxB,MAAM,EAAE,SAAS;QACjB,QAAQ,EAAE;YACR,SAAS,EAAE,uBAAuB;YAClC,MAAM,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,OAAO,EAAE;YACnD,UAAU;SACX;QACD,WAAW,EAAE;YACX,QAAQ,EAAE,EAAE;YACZ,MAAM,EAAE;gBACN;oBACE,IAAI,EAAE,8BAA8B;oBACpC,OAAO,EAAE,kBAAkB,gBAAgB,wCAAwC;oBACnF,SAAS,EAAE,KAAK;iBACjB;aACF;SACF;QACD,UAAU,EAAE;YACV,QAAQ,EAAE,eAAe;YACzB,WAAW,EAAE,gBAAgB;YAC7B,aAAa,EAAE,OAAO;YACtB,OAAO,EAAE,yBAAyB;YAClC,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACtC;QACD,MAAM,EAAE,IAAI;KACb,CAAC;AACJ,CAAC;AAED,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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CmsRecord } from '../../../services/read.js';
|
|
2
|
-
import { CmsCommand } from '
|
|
2
|
+
import { CmsCommand } from '../../../command-base.js';
|
|
3
3
|
export default class GetChannel extends CmsCommand<CmsRecord> {
|
|
4
4
|
static readonly summary = "Get a CMS channel.";
|
|
5
5
|
static readonly description = "Retrieves a channel by its identifier.";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Flags } from '@salesforce/sf-plugins-core';
|
|
2
2
|
import { getChannel } from '../../../services/read.js';
|
|
3
|
-
import { apiVersionFlag, CmsCommand, targetOrgFlag } from '
|
|
3
|
+
import { apiVersionFlag, CmsCommand, targetOrgFlag } from '../../../command-base.js';
|
|
4
4
|
export default class GetChannel extends CmsCommand {
|
|
5
5
|
static summary = 'Get a CMS channel.';
|
|
6
6
|
static description = 'Retrieves a channel by its identifier.';
|
|
@@ -1 +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,
|
|
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,0BAA0B,CAAC;AAErF,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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CmsRecord } from '../../../services/read.js';
|
|
2
|
-
import { CmsCommand } from '
|
|
2
|
+
import { CmsCommand } from '../../../command-base.js';
|
|
3
3
|
export default class GetContent extends CmsCommand<CmsRecord> {
|
|
4
4
|
static readonly summary = "Get CMS content.";
|
|
5
5
|
static readonly description = "Retrieves content by its key or identifier.";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Flags } from '@salesforce/sf-plugins-core';
|
|
2
2
|
import { getContent } from '../../../services/read.js';
|
|
3
|
-
import { apiVersionFlag, CmsCommand, targetOrgFlag } from '
|
|
3
|
+
import { apiVersionFlag, CmsCommand, targetOrgFlag } from '../../../command-base.js';
|
|
4
4
|
export default class GetContent extends CmsCommand {
|
|
5
5
|
static summary = 'Get CMS content.';
|
|
6
6
|
static description = 'Retrieves content by its key or identifier.';
|
|
@@ -1 +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,
|
|
1
|
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AM,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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CmsRecord } from '../../../services/read.js';
|
|
2
|
-
import { CmsCommand } from '
|
|
2
|
+
import { CmsCommand } from '../../../command-base.js';
|
|
3
3
|
export default class GetVariant extends CmsCommand<CmsRecord> {
|
|
4
4
|
static readonly summary = "Get a CMS content variant.";
|
|
5
5
|
static readonly description = "Retrieves a content variant by its identifier.";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Flags } from '@salesforce/sf-plugins-core';
|
|
2
2
|
import { getVariant } from '../../../services/read.js';
|
|
3
|
-
import { apiVersionFlag, CmsCommand, targetOrgFlag } from '
|
|
3
|
+
import { apiVersionFlag, CmsCommand, targetOrgFlag } from '../../../command-base.js';
|
|
4
4
|
export default class GetVariant extends CmsCommand {
|
|
5
5
|
static summary = 'Get a CMS content variant.';
|
|
6
6
|
static description = 'Retrieves a content variant by its identifier.';
|
|
@@ -1 +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,
|
|
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,0BAA0B,CAAC;AAErF,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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CmsRecord } from '../../../services/read.js';
|
|
2
|
-
import { CmsCommand } from '
|
|
2
|
+
import { CmsCommand } from '../../../command-base.js';
|
|
3
3
|
export default class GetWorkspace extends CmsCommand<CmsRecord> {
|
|
4
4
|
static readonly summary = "Get a Marketing Cloud CMS workspace.";
|
|
5
5
|
static readonly description = "Retrieves one CMS workspace by its content-space ID.";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Flags } from '@salesforce/sf-plugins-core';
|
|
2
2
|
import { getWorkspace } from '../../../services/read.js';
|
|
3
|
-
import { apiVersionFlag, CmsCommand, targetOrgFlag } from '
|
|
3
|
+
import { apiVersionFlag, CmsCommand, targetOrgFlag } from '../../../command-base.js';
|
|
4
4
|
export default class GetWorkspace extends CmsCommand {
|
|
5
5
|
static summary = 'Get a Marketing Cloud CMS workspace.';
|
|
6
6
|
static description = 'Retrieves one CMS workspace by its content-space ID.';
|
|
@@ -1 +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,
|
|
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,0BAA0B,CAAC;AAErF,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"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { type WorkspaceImportResult } from '../../../
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { type WorkspaceImportResult } from '../../../contracts/workspace-import.js';
|
|
2
|
+
import { type CmsEnvelope } from '../../../contracts/shared.js';
|
|
3
|
+
import { CmsCommand } from '../../../command-base.js';
|
|
4
|
+
export default class ImportWorkspace extends CmsCommand<CmsEnvelope<WorkspaceImportResult>> {
|
|
4
5
|
static readonly summary = "Safely plan or apply a create-only import into a CMS workspace.";
|
|
5
6
|
static readonly description = "Validates the source workspace export locally before any org request, selects one destination workspace by exact ID or exact case-sensitive name, checks every content key for conflicts, and defaults to a non-mutating dry run. Pass --apply with a new --report-dir to create content.";
|
|
6
7
|
static readonly examples: string[];
|
|
7
8
|
static readonly flags: {
|
|
8
9
|
'target-org': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
10
|
'api-version': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
'contract-version': import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
12
|
'workspace-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
13
|
'workspace-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
14
|
'source-dir': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -14,6 +16,7 @@ export default class ImportWorkspace extends CmsCommand<WorkspaceImportResult> {
|
|
|
14
16
|
'allow-partial': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
17
|
'report-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
18
|
};
|
|
17
|
-
run(): Promise<WorkspaceImportResult
|
|
19
|
+
run(): Promise<CmsEnvelope<WorkspaceImportResult>>;
|
|
20
|
+
private finish;
|
|
18
21
|
private showPlan;
|
|
19
22
|
}
|