sf-plugin-cms 0.2.0 → 0.3.1

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.
Files changed (70) hide show
  1. package/README.md +117 -14
  2. package/lib/{commands/cms/command-base.d.ts → command-base.d.ts} +6 -1
  3. package/lib/{commands/cms/command-base.js → command-base.js} +37 -0
  4. package/lib/command-base.js.map +1 -0
  5. package/lib/commands/cms/export/workspace.d.ts +12 -5
  6. package/lib/commands/cms/export/workspace.js +97 -12
  7. package/lib/commands/cms/export/workspace.js.map +1 -1
  8. package/lib/commands/cms/get/channel.d.ts +1 -1
  9. package/lib/commands/cms/get/channel.js +1 -1
  10. package/lib/commands/cms/get/channel.js.map +1 -1
  11. package/lib/commands/cms/get/content.d.ts +1 -1
  12. package/lib/commands/cms/get/content.js +1 -1
  13. package/lib/commands/cms/get/content.js.map +1 -1
  14. package/lib/commands/cms/get/variant.d.ts +1 -1
  15. package/lib/commands/cms/get/variant.js +1 -1
  16. package/lib/commands/cms/get/variant.js.map +1 -1
  17. package/lib/commands/cms/get/workspace.d.ts +1 -1
  18. package/lib/commands/cms/get/workspace.js +1 -1
  19. package/lib/commands/cms/get/workspace.js.map +1 -1
  20. package/lib/commands/cms/import/workspace.d.ts +7 -4
  21. package/lib/commands/cms/import/workspace.js +115 -36
  22. package/lib/commands/cms/import/workspace.js.map +1 -1
  23. package/lib/commands/cms/info.d.ts +11 -10
  24. package/lib/commands/cms/info.js +122 -9
  25. package/lib/commands/cms/info.js.map +1 -1
  26. package/lib/commands/cms/list/channel.d.ts +1 -1
  27. package/lib/commands/cms/list/channel.js +1 -1
  28. package/lib/commands/cms/list/channel.js.map +1 -1
  29. package/lib/commands/cms/list/workspace.d.ts +1 -1
  30. package/lib/commands/cms/list/workspace.js +1 -1
  31. package/lib/commands/cms/list/workspace.js.map +1 -1
  32. package/lib/contracts/info.d.ts +43 -0
  33. package/lib/contracts/info.js +69 -0
  34. package/lib/contracts/info.js.map +1 -0
  35. package/lib/contracts/shared.d.ts +81 -0
  36. package/lib/contracts/shared.js +218 -0
  37. package/lib/contracts/shared.js.map +1 -0
  38. package/lib/contracts/workspace-export.d.ts +91 -0
  39. package/lib/contracts/workspace-export.js +324 -0
  40. package/lib/contracts/workspace-export.js.map +1 -0
  41. package/lib/contracts/workspace-import.d.ts +46 -0
  42. package/lib/contracts/workspace-import.js +108 -0
  43. package/lib/contracts/workspace-import.js.map +1 -0
  44. package/lib/index.d.ts +1 -1
  45. package/lib/runtime-version.d.ts +2 -0
  46. package/lib/runtime-version.js +18 -0
  47. package/lib/runtime-version.js.map +1 -0
  48. package/lib/services/atomic-publish.d.ts +15 -0
  49. package/lib/services/atomic-publish.js +109 -0
  50. package/lib/services/atomic-publish.js.map +1 -0
  51. package/lib/services/bulk-export-workspaces.d.ts +25 -0
  52. package/lib/services/bulk-export-workspaces.js +273 -0
  53. package/lib/services/bulk-export-workspaces.js.map +1 -0
  54. package/lib/services/export-references.d.ts +21 -0
  55. package/lib/services/export-references.js +150 -0
  56. package/lib/services/export-references.js.map +1 -0
  57. package/lib/services/export-workspace.d.ts +15 -22
  58. package/lib/services/export-workspace.js +73 -7
  59. package/lib/services/export-workspace.js.map +1 -1
  60. package/lib/services/import-workspace.d.ts +10 -3
  61. package/lib/services/import-workspace.js +229 -101
  62. package/lib/services/import-workspace.js.map +1 -1
  63. package/lib/services/resolve-workspace.d.ts +5 -0
  64. package/lib/services/resolve-workspace.js +56 -47
  65. package/lib/services/resolve-workspace.js.map +1 -1
  66. package/messages/cms.export.workspace.md +22 -4
  67. package/messages/cms.import.workspace.md +8 -2
  68. package/messages/cms.info.md +21 -0
  69. package/package.json +16 -5
  70. package/lib/commands/cms/command-base.js.map +0 -1
@@ -0,0 +1,324 @@
1
+ import { assertDiagnostics, assertExactKeys, assertIdentifier, assertNonemptyString, assertOpaqueCmsReference, assertRelativePosixPath, assertSha256, } from './shared.js';
2
+ export const WORKSPACE_EXPORT_SET_CONTRACT = 'sf-cms-workspace-export-set';
3
+ export const WORKSPACE_EXPORT_MANIFEST_CONTRACT = 'sf-cms-workspace-export';
4
+ export const EXTERNAL_REFERENCE_CORRELATIONS_CONTRACT = 'sf-cms-external-reference-correlations@1';
5
+ export function assertWorkspaceExportManifest(value) {
6
+ assertExactKeys(value, [
7
+ 'schemaVersion',
8
+ 'mode',
9
+ 'workspaceId',
10
+ 'search',
11
+ 'expectedCount',
12
+ 'foundCount',
13
+ 'exportedCount',
14
+ 'pagesRequested',
15
+ 'entries',
16
+ 'rejectedVariantIds',
17
+ 'failedVariantIds',
18
+ 'warnings',
19
+ 'contract',
20
+ 'contractVersion',
21
+ 'provenance',
22
+ 'completeness',
23
+ 'dependencies',
24
+ 'externalReferences',
25
+ 'items',
26
+ ], 'manifest');
27
+ if (value.schemaVersion !== 1 || value.mode !== 'experimental-best-effort') {
28
+ throw new TypeError('manifest schemaVersion/mode is unsupported');
29
+ }
30
+ assertIdentifier(value.workspaceId, 'manifest.workspaceId');
31
+ assertExactKeys(value.search, ['contentSpaceOrFolderIds', 'languages', 'pageSize', 'queryTerm'], 'manifest.search');
32
+ if (!Array.isArray(value.search.contentSpaceOrFolderIds) ||
33
+ value.search.contentSpaceOrFolderIds.length !== 1 ||
34
+ value.search.contentSpaceOrFolderIds[0] !== value.workspaceId ||
35
+ !Array.isArray(value.search.languages) ||
36
+ value.search.languages.length !== 1 ||
37
+ value.search.languages[0] !== 'All' ||
38
+ value.search.pageSize !== 250 ||
39
+ value.search.queryTerm !== '*') {
40
+ throw new TypeError('manifest.search is invalid');
41
+ }
42
+ for (const key of ['expectedCount', 'foundCount', 'exportedCount', 'pagesRequested']) {
43
+ assertCount(value[key], `manifest.${key}`);
44
+ }
45
+ assertLegacyManifestArrays(value);
46
+ if (value.contract !== WORKSPACE_EXPORT_MANIFEST_CONTRACT || value.contractVersion !== '1.0.0') {
47
+ throw new TypeError('manifest contract/version is unsupported');
48
+ }
49
+ assertExactKeys(value.provenance, ['producer', 'sourceOrgId', 'sourceWorkspaceId', 'pluginVersion', 'generatedAt'], 'manifest.provenance');
50
+ if (value.provenance.producer !== 'sf-plugin-cms')
51
+ throw new TypeError('manifest producer is invalid');
52
+ assertIdentifier(value.provenance.sourceOrgId, 'manifest.provenance.sourceOrgId');
53
+ assertIdentifier(value.provenance.sourceWorkspaceId, 'manifest.provenance.sourceWorkspaceId');
54
+ if (value.provenance.sourceWorkspaceId !== value.workspaceId) {
55
+ throw new TypeError('manifest provenance sourceWorkspaceId must match workspaceId');
56
+ }
57
+ assertNonemptyString(value.provenance.pluginVersion, 'manifest.provenance.pluginVersion');
58
+ assertNonemptyString(value.provenance.generatedAt, 'manifest.provenance.generatedAt');
59
+ if (value.completeness !== 'complete' && value.completeness !== 'partial') {
60
+ throw new TypeError('manifest.completeness is invalid');
61
+ }
62
+ if (!Array.isArray(value.dependencies) ||
63
+ !Array.isArray(value.externalReferences) ||
64
+ !Array.isArray(value.items)) {
65
+ throw new TypeError('manifest arrays are required');
66
+ }
67
+ if (value.dependencies.length > 0) {
68
+ throw new TypeError('manifest.dependencies must be empty while dependency discovery is unavailable');
69
+ }
70
+ let previousReference = '';
71
+ const referenceIds = new Set();
72
+ for (const [index, reference] of value.externalReferences.entries()) {
73
+ assertOpaqueCmsReference(reference, `manifest.externalReferences[${index}]`);
74
+ if (reference.source.workspaceId !== value.workspaceId) {
75
+ throw new TypeError(`manifest.externalReferences[${index}] workspaceId must match manifest`);
76
+ }
77
+ const sortKey = [reference.kind, reference.referenceId, reference.portableKey.value].join('\u0000');
78
+ if (sortKey.localeCompare(previousReference) < 0) {
79
+ throw new TypeError('manifest.externalReferences must be sorted');
80
+ }
81
+ previousReference = sortKey;
82
+ if (referenceIds.has(reference.referenceId)) {
83
+ throw new TypeError(`duplicate manifest reference ID: ${reference.referenceId}`);
84
+ }
85
+ referenceIds.add(reference.referenceId);
86
+ }
87
+ const paths = new Set();
88
+ for (const [index, item] of value.items.entries()) {
89
+ if (typeof item !== 'object' || item === null || Array.isArray(item)) {
90
+ throw new TypeError(`manifest.items[${index}] must be an object`);
91
+ }
92
+ const keys = Object.keys(item).toSorted();
93
+ if (JSON.stringify(keys) !==
94
+ JSON.stringify(['kind', 'path', 'referenceId', 'sha256'].filter((key) => key in item).toSorted())) {
95
+ throw new TypeError(`manifest.items[${index}] has invalid keys`);
96
+ }
97
+ assertRelativePosixPath(item.path, `manifest.items[${index}].path`);
98
+ if (item.path === 'manifest.json')
99
+ throw new TypeError('manifest.json must not be listed as an item');
100
+ if (paths.has(item.path))
101
+ throw new TypeError(`duplicate manifest item path: ${item.path}`);
102
+ paths.add(item.path);
103
+ assertSha256(item.sha256, `manifest.items[${index}].sha256`);
104
+ assertIdentifier(item.kind, `manifest.items[${index}].kind`);
105
+ if (item.referenceId !== undefined && !referenceIds.has(item.referenceId)) {
106
+ throw new TypeError(`manifest item has no reference descriptor: ${item.referenceId}`);
107
+ }
108
+ }
109
+ if (value.completeness === 'complete' && hasAuthoritativeIncompleteness(value)) {
110
+ throw new TypeError('manifest.completeness contradicts authoritative incompleteness evidence');
111
+ }
112
+ }
113
+ function hasAuthoritativeIncompleteness(manifest) {
114
+ const warnings = manifest.warnings;
115
+ const externalReferences = manifest.externalReferences;
116
+ return (manifest.rejectedVariantIds.length > 0 ||
117
+ manifest.failedVariantIds.length > 0 ||
118
+ manifest.expectedCount !== manifest.foundCount ||
119
+ manifest.foundCount !== manifest.exportedCount ||
120
+ manifest.exportedCount !== manifest.entries.length ||
121
+ manifest.exportedCount !== manifest.items.length ||
122
+ warnings.some(({ code }) => code !== 'UNSUPPORTED_WILDCARD') ||
123
+ externalReferences.some(({ resolution }) => resolution === 'unresolved' || resolution === 'unsupported'));
124
+ }
125
+ function assertLegacyManifestArrays(value) {
126
+ if (!Array.isArray(value.entries) ||
127
+ !Array.isArray(value.rejectedVariantIds) ||
128
+ !Array.isArray(value.failedVariantIds) ||
129
+ !Array.isArray(value.warnings)) {
130
+ throw new TypeError('manifest legacy arrays are required');
131
+ }
132
+ const entryFiles = new Set();
133
+ for (const [index, entry] of value.entries.entries()) {
134
+ const label = `manifest.entries[${index}]`;
135
+ assertExactKeys(entry, ['file', 'variantId'], label);
136
+ assertRelativePosixPath(entry.file, `${label}.file`);
137
+ assertIdentifier(entry.variantId, `${label}.variantId`);
138
+ if (entryFiles.has(entry.file))
139
+ throw new TypeError(`duplicate manifest entry file: ${entry.file}`);
140
+ entryFiles.add(entry.file);
141
+ }
142
+ for (const key of ['rejectedVariantIds', 'failedVariantIds']) {
143
+ const identifiers = value[key];
144
+ for (const [index, identifier] of identifiers.entries()) {
145
+ assertIdentifier(identifier, `manifest.${key}[${index}]`);
146
+ }
147
+ }
148
+ for (const [index, warning] of value.warnings.entries()) {
149
+ const label = `manifest.warnings[${index}]`;
150
+ if (typeof warning !== 'object' || warning === null || Array.isArray(warning)) {
151
+ throw new TypeError(`${label} must be an object`);
152
+ }
153
+ const keys = Object.keys(warning).toSorted();
154
+ const expected = [
155
+ 'code',
156
+ 'message',
157
+ ...(warning.variantIds === undefined ? [] : ['variantIds']),
158
+ ].toSorted();
159
+ if (JSON.stringify(keys) !== JSON.stringify(expected)) {
160
+ throw new TypeError(`${label} has invalid keys`);
161
+ }
162
+ assertIdentifier(warning.code, `${label}.code`);
163
+ assertNonemptyString(warning.message, `${label}.message`);
164
+ if (warning.variantIds !== undefined) {
165
+ if (!Array.isArray(warning.variantIds))
166
+ throw new TypeError(`${label}.variantIds must be an array`);
167
+ for (const [variantIndex, identifier] of warning.variantIds.entries()) {
168
+ assertIdentifier(identifier, `${label}.variantIds[${variantIndex}]`);
169
+ }
170
+ }
171
+ }
172
+ }
173
+ export function assertWorkspaceExportSetResult(value, provenance, status) {
174
+ assertExactKeys(value, [
175
+ 'workspaceType',
176
+ 'outputDirectory',
177
+ 'selection',
178
+ 'summary',
179
+ 'externalReferenceCorrelations',
180
+ 'workspaces',
181
+ ], 'result');
182
+ if (value.workspaceType !== 'Marketing' && value.workspaceType !== 'Content') {
183
+ throw new TypeError('result.workspaceType is invalid');
184
+ }
185
+ assertRelativePosixPath(value.outputDirectory, 'result.outputDirectory');
186
+ assertExactKeys(value.selection, ['mode', 'discoveredCount', 'selectedCount'], 'result.selection');
187
+ if (value.selection.mode !== 'all')
188
+ throw new TypeError('result.selection.mode must be all');
189
+ assertCount(value.selection.discoveredCount, 'result.selection.discoveredCount');
190
+ assertCount(value.selection.selectedCount, 'result.selection.selectedCount');
191
+ assertExactKeys(value.summary, ['succeededCount', 'partialCount', 'failedCount'], 'result.summary');
192
+ for (const key of ['succeededCount', 'partialCount', 'failedCount']) {
193
+ assertCount(value.summary[key], `result.summary.${key}`);
194
+ }
195
+ if (!Array.isArray(value.workspaces) || !Array.isArray(value.externalReferenceCorrelations)) {
196
+ throw new TypeError('result arrays are required');
197
+ }
198
+ const workspaceHashes = new Map();
199
+ let previousWorkspaceId = '';
200
+ for (const [index, workspace] of value.workspaces.entries()) {
201
+ assertWorkspaceEntry(workspace, index);
202
+ if (workspace.source.sourceId.localeCompare(previousWorkspaceId) < 0) {
203
+ throw new TypeError('result.workspaces must be sorted by source ID');
204
+ }
205
+ previousWorkspaceId = workspace.source.sourceId;
206
+ if (workspace.artifact !== null)
207
+ workspaceHashes.set(workspace.source.sourceId, workspace.artifact.manifestSha256);
208
+ }
209
+ const actualSummary = {
210
+ succeededCount: value.workspaces.filter(({ status: workspaceStatus }) => workspaceStatus === 'success').length,
211
+ partialCount: value.workspaces.filter(({ status: workspaceStatus }) => workspaceStatus === 'partial').length,
212
+ failedCount: value.workspaces.filter(({ status: workspaceStatus }) => workspaceStatus === 'failed').length,
213
+ };
214
+ if (value.selection.selectedCount !== value.workspaces.length) {
215
+ throw new TypeError('result.selection.selectedCount must match workspace rows');
216
+ }
217
+ for (const key of ['succeededCount', 'partialCount', 'failedCount']) {
218
+ if (value.summary[key] !== actualSummary[key]) {
219
+ throw new TypeError(`result.summary.${key} must match workspace rows`);
220
+ }
221
+ }
222
+ let expectedStatus = 'success';
223
+ if (actualSummary.failedCount === value.workspaces.length && value.workspaces.length > 0) {
224
+ expectedStatus = 'failed';
225
+ }
226
+ else if (actualSummary.failedCount > 0 || actualSummary.partialCount > 0) {
227
+ expectedStatus = 'partial';
228
+ }
229
+ if (status !== undefined && status !== expectedStatus) {
230
+ throw new TypeError('envelope status must match workspace rows');
231
+ }
232
+ assertCorrelations(value.externalReferenceCorrelations, workspaceHashes);
233
+ if (value.externalReferenceCorrelations.length > 0) {
234
+ if (provenance === undefined)
235
+ throw new TypeError('export correlations require envelope provenance');
236
+ if (provenance.producer !== 'sf-plugin-cms' || provenance.exportSetId === undefined) {
237
+ throw new TypeError('export correlation provenance binding is incomplete');
238
+ }
239
+ }
240
+ }
241
+ function assertWorkspaceEntry(value, index) {
242
+ const label = `result.workspaces[${index}]`;
243
+ assertExactKeys(value, ['source', 'status', 'artifact', 'diagnostics'], label);
244
+ assertExactKeys(value.source, ['kind', 'sourceId', 'name', 'workspaceType'], `${label}.source`);
245
+ if (value.source.kind !== 'cms.workspace')
246
+ throw new TypeError(`${label}.source.kind is invalid`);
247
+ assertIdentifier(value.source.sourceId, `${label}.source.sourceId`);
248
+ assertNonemptyString(value.source.name, `${label}.source.name`);
249
+ if (value.source.workspaceType !== 'Marketing' && value.source.workspaceType !== 'Content') {
250
+ throw new TypeError(`${label}.source.workspaceType is invalid`);
251
+ }
252
+ if (!['success', 'partial', 'failed'].includes(value.status))
253
+ throw new TypeError(`${label}.status is invalid`);
254
+ assertDiagnostics(value.diagnostics, `${label}.diagnostics`);
255
+ if (value.artifact === null) {
256
+ if (value.status !== 'failed')
257
+ throw new TypeError(`${label}.artifact is required`);
258
+ return;
259
+ }
260
+ assertExactKeys(value.artifact, ['path', 'manifestPath', 'manifestContract', 'manifestContractVersion', 'manifestSha256'], `${label}.artifact`);
261
+ assertRelativePosixPath(value.artifact.path, `${label}.artifact.path`);
262
+ assertRelativePosixPath(value.artifact.manifestPath, `${label}.artifact.manifestPath`);
263
+ if (value.artifact.manifestPath !== `${value.artifact.path}/manifest.json`) {
264
+ throw new TypeError(`${label}.artifact.manifestPath is inconsistent`);
265
+ }
266
+ if (value.artifact.manifestContract !== WORKSPACE_EXPORT_MANIFEST_CONTRACT ||
267
+ value.artifact.manifestContractVersion !== '1.0.0') {
268
+ throw new TypeError(`${label}.artifact manifest contract/version is invalid`);
269
+ }
270
+ assertSha256(value.artifact.manifestSha256, `${label}.artifact.manifestSha256`);
271
+ }
272
+ function assertCorrelations(rows, workspaceHashes) {
273
+ let previous = '';
274
+ const sourceKeys = new Map();
275
+ const referenceIds = new Map();
276
+ for (const [index, row] of rows.entries()) {
277
+ const label = `result.externalReferenceCorrelations[${index}]`;
278
+ assertExactKeys(row, [
279
+ 'sourceWorkspaceId',
280
+ 'sourceReference',
281
+ 'referenceKind',
282
+ 'referenceId',
283
+ 'packageManifestSha256',
284
+ ], label);
285
+ assertIdentifier(row.sourceWorkspaceId, `${label}.sourceWorkspaceId`);
286
+ assertNonemptyString(row.sourceReference, `${label}.sourceReference`);
287
+ assertIdentifier(row.referenceKind, `${label}.referenceKind`);
288
+ if (row.referenceKind !== 'cms.content')
289
+ throw new TypeError(`${label}.referenceKind is unsupported`);
290
+ if (typeof row.referenceId !== 'string' || !/^ref:[a-f\d]{64}$/u.test(row.referenceId)) {
291
+ throw new TypeError(`${label}.referenceId is invalid`);
292
+ }
293
+ assertSha256(row.packageManifestSha256, `${label}.packageManifestSha256`);
294
+ if (workspaceHashes.get(row.sourceWorkspaceId) !== row.packageManifestSha256) {
295
+ throw new TypeError(`${label} is not bound to its workspace package`);
296
+ }
297
+ const sortKey = [
298
+ row.sourceWorkspaceId,
299
+ row.sourceReference,
300
+ row.referenceKind,
301
+ row.referenceId,
302
+ row.packageManifestSha256,
303
+ ].join('\u0000');
304
+ if (sortKey.localeCompare(previous) < 0)
305
+ throw new TypeError('correlation rows must be sorted');
306
+ previous = sortKey;
307
+ const sourceKey = `${row.sourceWorkspaceId}\u0000${row.sourceReference}`;
308
+ const sourceValue = `${row.referenceKind}\u0000${row.referenceId}\u0000${row.packageManifestSha256}`;
309
+ if (sourceKeys.has(sourceKey))
310
+ throw new TypeError(`duplicate or conflicting correlation source: ${sourceKey}`);
311
+ sourceKeys.set(sourceKey, sourceValue);
312
+ const referenceValue = `${row.sourceWorkspaceId}\u0000${row.sourceReference}\u0000${row.referenceKind}\u0000${row.packageManifestSha256}`;
313
+ const prior = referenceIds.get(row.referenceId);
314
+ if (prior !== undefined && prior !== referenceValue)
315
+ throw new TypeError(`conflicting reference ID: ${row.referenceId}`);
316
+ referenceIds.set(row.referenceId, referenceValue);
317
+ }
318
+ }
319
+ function assertCount(value, label) {
320
+ if (typeof value !== 'number' || !Number.isInteger(value) || value < 0) {
321
+ throw new TypeError(`${label} must be a nonnegative integer`);
322
+ }
323
+ }
324
+ //# sourceMappingURL=workspace-export.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-export.js","sourceRoot":"","sources":["../../src/contracts/workspace-export.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,EACxB,uBAAuB,EACvB,YAAY,GAIb,MAAM,aAAa,CAAC;AAErB,MAAM,CAAC,MAAM,6BAA6B,GAAG,6BAAsC,CAAC;AACpF,MAAM,CAAC,MAAM,kCAAkC,GAAG,yBAAkC,CAAC;AACrF,MAAM,CAAC,MAAM,wCAAwC,GACnD,0CAAmD,CAAC;AAiGtD,MAAM,UAAU,6BAA6B,CAC3C,KAAc;IAEd,eAAe,CACb,KAAK,EACL;QACE,eAAe;QACf,MAAM;QACN,aAAa;QACb,QAAQ;QACR,eAAe;QACf,YAAY;QACZ,eAAe;QACf,gBAAgB;QAChB,SAAS;QACT,oBAAoB;QACpB,kBAAkB;QAClB,UAAU;QACV,UAAU;QACV,iBAAiB;QACjB,YAAY;QACZ,cAAc;QACd,cAAc;QACd,oBAAoB;QACpB,OAAO;KACR,EACD,UAAU,CACX,CAAC;IACF,IAAI,KAA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AS,GAAG,CAAC,qBAAqB,EAAE,CAAC;QACrG,IAAI,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC;YAC3B,MAAM,IAAI,SAAS,CAAC,gDAAgD,SAAS,EAAE,CAAC,CAAC;QACnF,UAAU,CAAC,GAAG,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QACvC,MAAM,cAAc,GAAG,GAAG,GAAG,CAAC,iBAAiB,SAAS,GAAG,CAAC,eAAe,SAAS,GAAG,CAAC,aAAa,SAAS,GAAG,CAAC,qBAAqB,EAAE,CAAC;QAC1I,MAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QAChD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,cAAc;YACjD,MAAM,IAAI,SAAS,CAAC,6BAA6B,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;QACtE,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;IACpD,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,KAAc,EAAE,KAAa;IAChD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QACvE,MAAM,IAAI,SAAS,CAAC,GAAG,KAAK,gCAAgC,CAAC,CAAC;IAChE,CAAC;AACH,CAAC"}
@@ -0,0 +1,46 @@
1
+ export declare const WORKSPACE_IMPORT_CONTRACT: "sf-cms-workspace-import";
2
+ export declare const WORKSPACE_IMPORT_OPERATIONS: readonly ["created", "matched", "updated", "unchanged"];
3
+ export declare const WORKSPACE_IMPORT_MAPPING_STATUSES: readonly ["resolved", "unresolved", "ambiguous", "failed"];
4
+ export declare const WORKSPACE_IMPORT_REFERENCE_STATUSES: readonly ["resolved", "unresolved", "ambiguous", "failed", "unsupported"];
5
+ export type WorkspaceImportMapping = {
6
+ referenceId: string;
7
+ kind: string;
8
+ source: {
9
+ sourceId: string;
10
+ portableKey: {
11
+ scheme: 'cms-opaque-v1';
12
+ value: string;
13
+ };
14
+ };
15
+ target: {
16
+ targetId: string;
17
+ targetReference: string;
18
+ };
19
+ operation: (typeof WORKSPACE_IMPORT_OPERATIONS)[number];
20
+ status: (typeof WORKSPACE_IMPORT_MAPPING_STATUSES)[number];
21
+ cmsReferencesRewritten: boolean;
22
+ };
23
+ export type WorkspaceImportReference = {
24
+ referenceId: string;
25
+ kind: string;
26
+ status: (typeof WORKSPACE_IMPORT_REFERENCE_STATUSES)[number];
27
+ };
28
+ export type WorkspaceImportResult = {
29
+ sourcePackage: {
30
+ manifestSha256: string;
31
+ workspaceId: string;
32
+ };
33
+ target: {
34
+ orgId: string;
35
+ workspaceId: string;
36
+ };
37
+ integrity: {
38
+ listedItemCount: number;
39
+ verifiedItemCount: number;
40
+ unlistedFileCount: number;
41
+ verified: boolean;
42
+ };
43
+ mappings: WorkspaceImportMapping[];
44
+ references: WorkspaceImportReference[];
45
+ };
46
+ export declare function assertWorkspaceImportResult(value: unknown): asserts value is WorkspaceImportResult;
@@ -0,0 +1,108 @@
1
+ import { assertExactKeys, assertIdentifier, assertNonemptyString, assertReferenceId, assertSha256, } from './shared.js';
2
+ export const WORKSPACE_IMPORT_CONTRACT = 'sf-cms-workspace-import';
3
+ export const WORKSPACE_IMPORT_OPERATIONS = ['created', 'matched', 'updated', 'unchanged'];
4
+ export const WORKSPACE_IMPORT_MAPPING_STATUSES = [
5
+ 'resolved',
6
+ 'unresolved',
7
+ 'ambiguous',
8
+ 'failed',
9
+ ];
10
+ export const WORKSPACE_IMPORT_REFERENCE_STATUSES = [
11
+ ...WORKSPACE_IMPORT_MAPPING_STATUSES,
12
+ 'unsupported',
13
+ ];
14
+ export function assertWorkspaceImportResult(value) {
15
+ assertExactKeys(value, ['sourcePackage', 'target', 'integrity', 'mappings', 'references'], 'result');
16
+ assertExactKeys(value.sourcePackage, ['manifestSha256', 'workspaceId'], 'result.sourcePackage');
17
+ assertSha256(value.sourcePackage.manifestSha256, 'result.sourcePackage.manifestSha256');
18
+ assertIdentifier(value.sourcePackage.workspaceId, 'result.sourcePackage.workspaceId');
19
+ assertExactKeys(value.target, ['orgId', 'workspaceId'], 'result.target');
20
+ assertIdentifier(value.target.orgId, 'result.target.orgId');
21
+ assertIdentifier(value.target.workspaceId, 'result.target.workspaceId');
22
+ assertExactKeys(value.integrity, ['listedItemCount', 'verifiedItemCount', 'unlistedFileCount', 'verified'], 'result.integrity');
23
+ for (const key of ['listedItemCount', 'verifiedItemCount', 'unlistedFileCount']) {
24
+ assertCount(value.integrity[key], `result.integrity.${key}`);
25
+ }
26
+ if (typeof value.integrity.verified !== 'boolean')
27
+ throw new TypeError('result.integrity.verified must be boolean');
28
+ if (value.integrity.verified &&
29
+ value.integrity.listedItemCount !== value.integrity.verifiedItemCount) {
30
+ throw new TypeError('verified integrity requires all listed items to be verified');
31
+ }
32
+ if (!Array.isArray(value.mappings) || !Array.isArray(value.references)) {
33
+ throw new TypeError('result mappings/references arrays are required');
34
+ }
35
+ assertMappings(value.mappings);
36
+ assertReferences(value.references);
37
+ }
38
+ function assertMappings(values) {
39
+ const references = new Map();
40
+ const targets = new Map();
41
+ let previous = '';
42
+ for (const [index, value] of values.entries()) {
43
+ const label = `result.mappings[${index}]`;
44
+ assertExactKeys(value, ['referenceId', 'kind', 'source', 'target', 'operation', 'status', 'cmsReferencesRewritten'], label);
45
+ assertReferenceId(value.referenceId, `${label}.referenceId`);
46
+ assertIdentifier(value.kind, `${label}.kind`);
47
+ assertExactKeys(value.source, ['sourceId', 'portableKey'], `${label}.source`);
48
+ assertIdentifier(value.source.sourceId, `${label}.source.sourceId`);
49
+ assertExactKeys(value.source.portableKey, ['scheme', 'value'], `${label}.source.portableKey`);
50
+ if (value.source.portableKey.scheme !== 'cms-opaque-v1')
51
+ throw new TypeError(`${label}.source.portableKey.scheme is unsupported`);
52
+ assertNonemptyString(value.source.portableKey.value, `${label}.source.portableKey.value`);
53
+ assertExactKeys(value.target, ['targetId', 'targetReference'], `${label}.target`);
54
+ assertIdentifier(value.target.targetId, `${label}.target.targetId`);
55
+ assertNonemptyString(value.target.targetReference, `${label}.target.targetReference`);
56
+ if (!WORKSPACE_IMPORT_OPERATIONS.includes(value.operation)) {
57
+ throw new TypeError(`${label}.operation is unsupported`);
58
+ }
59
+ if (!WORKSPACE_IMPORT_MAPPING_STATUSES.includes(value.status)) {
60
+ throw new TypeError(`${label}.status is unsupported`);
61
+ }
62
+ if (typeof value.cmsReferencesRewritten !== 'boolean')
63
+ throw new TypeError(`${label}.cmsReferencesRewritten must be boolean`);
64
+ if (value.status === 'resolved' && value.cmsReferencesRewritten !== true) {
65
+ throw new TypeError(`${label} cannot be resolved before CMS references are rewritten`);
66
+ }
67
+ const sortKey = `${value.kind}\u0000${value.referenceId}`;
68
+ if (sortKey.localeCompare(previous) < 0)
69
+ throw new TypeError('result.mappings must be sorted');
70
+ previous = sortKey;
71
+ const mappingValue = `${value.kind}\u0000${value.source.sourceId}\u0000${value.source.portableKey.value}\u0000${value.target.targetId}\u0000${value.target.targetReference}`;
72
+ if (references.has(value.referenceId))
73
+ throw new TypeError(`duplicate mapping reference: ${value.referenceId}`);
74
+ references.set(value.referenceId, mappingValue);
75
+ const targetKey = `${value.kind}\u0000${value.target.targetReference}`;
76
+ const priorTarget = targets.get(targetKey);
77
+ if (priorTarget !== undefined && priorTarget !== value.referenceId) {
78
+ throw new TypeError(`conflicting target reference: ${value.target.targetReference}`);
79
+ }
80
+ targets.set(targetKey, value.referenceId);
81
+ }
82
+ }
83
+ function assertReferences(values) {
84
+ const seen = new Set();
85
+ let previous = '';
86
+ for (const [index, value] of values.entries()) {
87
+ const label = `result.references[${index}]`;
88
+ assertExactKeys(value, ['referenceId', 'kind', 'status'], label);
89
+ assertReferenceId(value.referenceId, `${label}.referenceId`);
90
+ assertIdentifier(value.kind, `${label}.kind`);
91
+ if (!WORKSPACE_IMPORT_REFERENCE_STATUSES.includes(value.status)) {
92
+ throw new TypeError(`${label}.status is unsupported`);
93
+ }
94
+ const key = `${value.kind}\u0000${value.referenceId}`;
95
+ if (key.localeCompare(previous) < 0)
96
+ throw new TypeError('result.references must be sorted');
97
+ if (seen.has(key))
98
+ throw new TypeError(`duplicate reference: ${key}`);
99
+ seen.add(key);
100
+ previous = key;
101
+ }
102
+ }
103
+ function assertCount(value, label) {
104
+ if (typeof value !== 'number' || !Number.isInteger(value) || value < 0) {
105
+ throw new TypeError(`${label} must be a nonnegative integer`);
106
+ }
107
+ }
108
+ //# sourceMappingURL=workspace-import.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-import.js","sourceRoot":"","sources":["../../src/contracts/workspace-import.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,GACb,MAAM,aAAa,CAAC;AAErB,MAAM,CAAC,MAAM,yBAAyB,GAAG,yBAAkC,CAAC;AAC5E,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,CAAU,CAAC;AACnG,MAAM,CAAC,MAAM,iCAAiC,GAAG;IAC/C,UAAU;IACV,YAAY;IACZ,WAAW;IACX,QAAQ;CACA,CAAC;AACX,MAAM,CAAC,MAAM,mCAAmC,GAAG;IACjD,GAAG,iCAAiC;IACpC,aAAa;CACL,CAAC;AA8CX,MAAM,UAAU,2BAA2B,CACzC,KAAc;IAEd,eAAe,CACb,KAAK,EACL,CAAC,eAAe,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,CAAC,EAClE,QAAQ,CACT,CAAC;IACF,eAAe,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC,gBAAgB,EAAE,aAAa,CAAC,EAAE,sBAAsB,CAAC,CAAC;IAChG,YAAY,CAAC,KAAK,CAAC,aAAa,CAAC,cAAc,EAAE,qCAAqC,CAAC,CA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,IACE,CAAC,mCAAmC,CAAC,QAAQ,CAC3C,KAAK,CAAC,MAA4C,CACnD,EACD,CAAC;YACD,MAAM,IAAI,SAAS,CAAC,GAAG,KAAK,wBAAwB,CAAC,CAAC;QACxD,CAAC;QACD,MAAM,GAAG,GAAG,GAAG,KAAK,CAAC,IAAI,SAAS,KAAK,CAAC,WAAW,EAAE,CAAC;QACtD,IAAI,GAAG,CAAC,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC;YAAE,MAAM,IAAI,SAAS,CAAC,kCAAkC,CAAC,CAAC;QAC7F,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,MAAM,IAAI,SAAS,CAAC,wBAAwB,GAAG,EAAE,CAAC,CAAC;QACtE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACd,QAAQ,GAAG,GAAG,CAAC;IACjB,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,KAAc,EAAE,KAAa;IAChD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QACvE,MAAM,IAAI,SAAS,CAAC,GAAG,KAAK,gCAAgC,CAAC,CAAC;IAChE,CAAC;AACH,CAAC"}
package/lib/index.d.ts CHANGED
@@ -5,4 +5,4 @@ export { default as GetWorkspace } from './commands/cms/get/workspace.js';
5
5
  export { default as Info } from './commands/cms/info.js';
6
6
  export { default as ListChannel } from './commands/cms/list/channel.js';
7
7
  export { default as ListWorkspace } from './commands/cms/list/workspace.js';
8
- export { executeWorkspaceImport, loadWorkspaceExport, planWorkspaceImport, type CreatedParentRecord, type DestinationWorkspace, type ExecuteWorkspaceImportOptions, type LoadedWorkspaceExport, type WorkspaceImportGroupPlan, type WorkspaceImportItem, type WorkspaceImportPlan, type WorkspaceImportResult, type WorkspaceImportRunReport, } from './services/import-workspace.js';
8
+ export { executeWorkspaceImport, loadWorkspaceExport, planWorkspaceImport, type CreatedParentRecord, type DestinationWorkspace, type ExecuteWorkspaceImportOptions, type LoadedWorkspaceExport, type WorkspaceImportGroupPlan, type WorkspaceImportItem, type WorkspaceImportPlan, type WorkspaceImportExecutionResult, type WorkspaceImportRunReport, } from './services/import-workspace.js';
@@ -0,0 +1,2 @@
1
+ import type { Config } from '@oclif/core';
2
+ export declare function getPluginVersion(config?: Config): string;
@@ -0,0 +1,18 @@
1
+ import { readFileSync } from 'node:fs';
2
+ const PLUGIN_NAME = 'sf-plugin-cms';
3
+ let packageVersion;
4
+ export function getPluginVersion(config) {
5
+ const configuredVersion = config?.plugins.get(PLUGIN_NAME)?.version;
6
+ if (configuredVersion !== undefined && configuredVersion.length > 0)
7
+ return configuredVersion;
8
+ packageVersion ??= readPackageVersion();
9
+ return packageVersion;
10
+ }
11
+ function readPackageVersion() {
12
+ const packageJson = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
13
+ if (packageJson.name !== PLUGIN_NAME || typeof packageJson.version !== 'string') {
14
+ throw new Error(`${PLUGIN_NAME} runtime package metadata is invalid.`);
15
+ }
16
+ return packageJson.version;
17
+ }
18
+ //# sourceMappingURL=runtime-version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-version.js","sourceRoot":"","sources":["../src/runtime-version.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,WAAW,GAAG,eAAe,CAAC;AACpC,IAAI,cAAkC,CAAC;AAEvC,MAAM,UAAU,gBAAgB,CAAC,MAAe;IAC9C,MAAM,iBAAiB,GAAG,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IACpE,IAAI,iBAAiB,KAAK,SAAS,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,iBAAiB,CAAC;IAE9F,cAAc,KAAK,kBAAkB,EAAE,CAAC;IACxC,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,SAAS,kBAAkB;IACzB,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAC5B,YAAY,CAAC,IAAI,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CACzB,CAAC;IAC3C,IAAI,WAAW,CAAC,IAAI,KAAK,WAAW,IAAI,OAAO,WAAW,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChF,MAAM,IAAI,KAAK,CAAC,GAAG,WAAW,uCAAuC,CAAC,CAAC;IACzE,CAAC;IACD,OAAO,WAAW,CAAC,OAAO,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { rename, rm } from 'node:fs/promises';
2
+ export type AtomicPublishOptions = {
3
+ readonly delay?: (milliseconds: number) => Promise<void>;
4
+ readonly platform?: NodeJS.Platform;
5
+ readonly renamePath?: typeof rename;
6
+ };
7
+ export type CleanupOptions = {
8
+ readonly removePath?: typeof rm;
9
+ };
10
+ export type DirectoryPublishOptions = AtomicPublishOptions & {
11
+ readonly publishPath?: (temporary: string, destination: string) => Promise<void>;
12
+ };
13
+ export declare function replaceFileByAtomicRename(temporary: string, destination: string, options?: AtomicPublishOptions): Promise<void>;
14
+ export declare function publishDirectoryNoClobber(temporary: string, destination: string, options?: DirectoryPublishOptions): Promise<void>;
15
+ export declare function cleanupOwnedPath(ownedPath: string, primaryError: unknown, options?: CleanupOptions): Promise<never>;