sf-plugin-cms 0.3.0 → 0.4.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.
Files changed (50) hide show
  1. package/README.md +99 -14
  2. package/lib/command-base.d.ts +4 -0
  3. package/lib/command-base.js +34 -0
  4. package/lib/command-base.js.map +1 -1
  5. package/lib/commands/cms/export/workspace.d.ts +2 -1
  6. package/lib/commands/cms/export/workspace.js +31 -18
  7. package/lib/commands/cms/export/workspace.js.map +1 -1
  8. package/lib/commands/cms/import/workspace.d.ts +3 -1
  9. package/lib/commands/cms/import/workspace.js +43 -22
  10. package/lib/commands/cms/import/workspace.js.map +1 -1
  11. package/lib/commands/cms/info.d.ts +1 -1
  12. package/lib/commands/cms/info.js +11 -13
  13. package/lib/commands/cms/info.js.map +1 -1
  14. package/lib/runtime-version.d.ts +2 -0
  15. package/lib/runtime-version.js +18 -0
  16. package/lib/runtime-version.js.map +1 -0
  17. package/lib/services/atomic-publish.d.ts +15 -0
  18. package/lib/services/atomic-publish.js +109 -0
  19. package/lib/services/atomic-publish.js.map +1 -0
  20. package/lib/services/bulk-export-workspaces.js +12 -5
  21. package/lib/services/bulk-export-workspaces.js.map +1 -1
  22. package/lib/services/editable-raw-html-export.d.ts +26 -0
  23. package/lib/services/editable-raw-html-export.js +100 -0
  24. package/lib/services/editable-raw-html-export.js.map +1 -0
  25. package/lib/services/editable-raw-html-import.d.ts +25 -0
  26. package/lib/services/editable-raw-html-import.js +107 -0
  27. package/lib/services/editable-raw-html-import.js.map +1 -0
  28. package/lib/services/editable-raw-html.d.ts +34 -0
  29. package/lib/services/editable-raw-html.js +83 -0
  30. package/lib/services/editable-raw-html.js.map +1 -0
  31. package/lib/services/export-references.js +3 -1
  32. package/lib/services/export-references.js.map +1 -1
  33. package/lib/services/export-workspace.d.ts +8 -0
  34. package/lib/services/export-workspace.js +46 -15
  35. package/lib/services/export-workspace.js.map +1 -1
  36. package/lib/services/import-identities.d.ts +33 -0
  37. package/lib/services/import-identities.js +287 -0
  38. package/lib/services/import-identities.js.map +1 -0
  39. package/lib/services/import-workspace.d.ts +39 -0
  40. package/lib/services/import-workspace.js +316 -20
  41. package/lib/services/import-workspace.js.map +1 -1
  42. package/lib/services/resolve-workspace.d.ts +6 -1
  43. package/lib/services/resolve-workspace.js +51 -4
  44. package/lib/services/resolve-workspace.js.map +1 -1
  45. package/lib/services/variant-identity.d.ts +13 -0
  46. package/lib/services/variant-identity.js +34 -0
  47. package/lib/services/variant-identity.js.map +1 -0
  48. package/messages/cms.export.workspace.md +12 -2
  49. package/messages/cms.import.workspace.md +23 -3
  50. package/package.json +15 -5
@@ -0,0 +1,33 @@
1
+ import type { LoadedWorkspaceExport, WorkspaceImportItem } from './import-workspace.js';
2
+ /**
3
+ * Build the bounded native raw-HTML copy profile without allocating a content key.
4
+ * @param {LoadedWorkspaceExport} source - Integrity-checked original export.
5
+ * @param {unknown} input - Explicit parent/language selection and fresh names.
6
+ * @param {ReadonlySet<string>} literalHtmlVariantIds - Reconstructed sidecar variants, never GET-decode their literal HTML.
7
+ * @returns {PlannedImportIdentities} Detached selected native copies.
8
+ */
9
+ export declare function planNativeCopies(source: LoadedWorkspaceExport, input: unknown, literalHtmlVariantIds?: ReadonlySet<string>): PlannedImportIdentities;
10
+ /**
11
+ * Decode the single entity layer used by native GET, leaving literal HTML untouched.
12
+ * @param {string} value - Native rawHtml string.
13
+ * @returns {string} Literal HTML with at most one GET encoding layer removed.
14
+ */
15
+ export declare function decodeNativeHtml(value: string): string;
16
+ export declare function safeNativeRawHtml(value: string): boolean;
17
+ export type CreateIdentityMapping = {
18
+ readonly sourceContentKey: string;
19
+ readonly contentKey: string;
20
+ readonly apiName: string;
21
+ readonly urlNames: Readonly<Record<string, string>>;
22
+ };
23
+ export type PlannedImportIdentities = {
24
+ readonly items: readonly WorkspaceImportItem[];
25
+ readonly targetContentKeys: readonly string[];
26
+ };
27
+ /**
28
+ * Build a detached identity proposal, not an executable or destination-validated import plan.
29
+ * @param {LoadedWorkspaceExport} source - Export already loaded through raw-byte integrity validation.
30
+ * @param {unknown} input - Complete explicit CREATE mappings for every selected parent and language.
31
+ * @returns {PlannedImportIdentities} Detached items requiring destination absence checks before mutation.
32
+ */
33
+ export declare function planImportIdentities(source: LoadedWorkspaceExport, input: unknown): PlannedImportIdentities;
@@ -0,0 +1,287 @@
1
+ /**
2
+ * Build the bounded native raw-HTML copy profile without allocating a content key.
3
+ * @param {LoadedWorkspaceExport} source - Integrity-checked original export.
4
+ * @param {unknown} input - Explicit parent/language selection and fresh names.
5
+ * @param {ReadonlySet<string>} literalHtmlVariantIds - Reconstructed sidecar variants, never GET-decode their literal HTML.
6
+ * @returns {PlannedImportIdentities} Detached selected native copies.
7
+ */
8
+ export function planNativeCopies(source, input, literalHtmlVariantIds = new Set()) {
9
+ if (!Array.isArray(input) || input.length === 0)
10
+ throw new TypeError('Native copy mappings must be a nonempty array');
11
+ const selected = [];
12
+ const apiNames = new Set(source.items.map((item) => item.apiName));
13
+ const urls = new Set(source.items.flatMap((item) => [item.urlName, item.contentBody['sfdc_cms:urlName']]));
14
+ const parents = new Set();
15
+ for (const row of input) {
16
+ if (!record(row))
17
+ throw new TypeError('Native copy mapping must be an object');
18
+ exactKeys(row, ['sourceContentKey', 'language', 'apiName', 'urlName'], 'Native copy mapping');
19
+ for (const key of ['sourceContentKey', 'language', 'apiName'])
20
+ identity(row[key], key);
21
+ if (typeof row.urlName !== 'string' || !/^[a-z0-9-]+$/u.test(row.urlName))
22
+ throw new TypeError('Native URL name must use lowercase letters, digits or hyphens');
23
+ const matches = source.items.filter((item) => item.contentKey === row.sourceContentKey && item.language === row.language);
24
+ if (matches.length !== 1 || parents.has(row.sourceContentKey))
25
+ throw new TypeError('Select exactly one language per distinct native parent');
26
+ const item = matches[0];
27
+ if (apiNames.has(row.apiName) || urls.has(row.urlName))
28
+ throw new TypeError('Native API and URL names must be fresh relative to the source and this run');
29
+ assertNativeBody(item);
30
+ parents.add(item.contentKey);
31
+ apiNames.add(row.apiName);
32
+ urls.add(row.urlName);
33
+ selected.push({
34
+ ...item,
35
+ apiName: row.apiName,
36
+ urlName: row.urlName,
37
+ contentBody: {
38
+ ...item.contentBody,
39
+ rawHtml: literalHtmlVariantIds.has(item.id)
40
+ ? item.contentBody.rawHtml
41
+ : decodeNativeHtml(item.contentBody.rawHtml),
42
+ ...(item.contentType === 'sfdc_cms__email' ? { 'sfdc_cms:urlName': row.urlName } : {}),
43
+ },
44
+ });
45
+ }
46
+ return { items: selected, targetContentKeys: [] };
47
+ }
48
+ /**
49
+ * Decode the single entity layer used by native GET, leaving literal HTML untouched.
50
+ * @param {string} value - Native rawHtml string.
51
+ * @returns {string} Literal HTML with at most one GET encoding layer removed.
52
+ */
53
+ export function decodeNativeHtml(value) {
54
+ // Native GET encodes the complete HTML document once; do not decode literal HTML text.
55
+ if (value.includes('<') || !value.includes('&lt;'))
56
+ return value;
57
+ return value
58
+ .replaceAll('&lt;', '<')
59
+ .replaceAll('&gt;', '>')
60
+ .replaceAll('&quot;', '"')
61
+ .replaceAll('&#39;', "'")
62
+ .replaceAll('&amp;', '&');
63
+ }
64
+ function assertNativeBody(item) {
65
+ if (!['sfdc_cms__email', 'sfdc_cms__emailTemplate'].includes(item.contentType))
66
+ throw new TypeError('Native copy supports only raw-HTML email/template content');
67
+ if (item.externalId != null || item.externalSource != null)
68
+ throw new TypeError('External provider content is unsupported');
69
+ const strings = new Set([
70
+ 'sfdc_cms:title',
71
+ 'sfdc_cms:description',
72
+ 'subjectLine',
73
+ 'preheader',
74
+ 'messagePurpose',
75
+ 'rawHtml',
76
+ 'textContent',
77
+ 'backgroundColor',
78
+ ]);
79
+ if (item.contentType === 'sfdc_cms__email')
80
+ strings.add('sfdc_cms:urlName');
81
+ const emptyArrays = new Set([
82
+ 'lightning:dataProviders',
83
+ 'lightning:expressions',
84
+ 'sfdc_cms:attachments',
85
+ 'sfdc_cms:variants',
86
+ ]);
87
+ for (const required of ['sfdc_cms:title', 'subjectLine', 'messagePurpose', 'rawHtml']) {
88
+ if (typeof item.contentBody[required] !== 'string' || !item.contentBody[required])
89
+ throw new TypeError(`Native body requires ${required}`);
90
+ }
91
+ for (const [key, value] of Object.entries(item.contentBody)) {
92
+ if (strings.has(key) &&
93
+ typeof value === 'string' &&
94
+ // Temporary through Phase 7: retain the scanner, but bypass it for opaque rawHtml.
95
+ (key === 'rawHtml' ? TEMPORARILY_BYPASS_RAW_HTML_SCANNER : safeNativeMetadata(value)))
96
+ continue;
97
+ if (emptyArrays.has(key) && Array.isArray(value) && value.length === 0)
98
+ continue;
99
+ if (key === 'lightning:backgroundImage' &&
100
+ record(value) &&
101
+ Object.keys(value).length === 3 &&
102
+ value.repeat === 'no-repeat' &&
103
+ value.position === 'center center' &&
104
+ value.size === 'cover')
105
+ continue;
106
+ if (key === 'lightning:brandSource' &&
107
+ item.contentType === 'sfdc_cms__email' &&
108
+ record(value) &&
109
+ Object.keys(value).length === 1 &&
110
+ value.defaultBrandOption === 'sfdcBrand')
111
+ continue;
112
+ throw new TypeError(`Unsupported native body field or unresolved reference/media: ${key}`);
113
+ }
114
+ }
115
+ const TEMPORARILY_BYPASS_RAW_HTML_SCANNER = true;
116
+ const NATIVE_DANGER = /\{\{|\{!|%%|\$brand|(?:<)\s*(?:img|script|iframe|video|audio|source|object|embed|link|svg)\b|\b(?:src|srcset)\s*=|url\s*\(|cms:\/\/|\/cms\//iu;
117
+ function safeNativeMetadata(value) {
118
+ return !/&(?:#|[a-z])/iu.test(value) && !NATIVE_DANGER.test(value);
119
+ }
120
+ // This is a security inspection vocabulary, not a general HTML entity decoder; list aliases that can compose denied markers.
121
+ const INSPECTABLE_ENTITY = /&(?:(?:amp|lt|gt|quot|apos|colon|sol|lbrace|rbrace|lcub|rcub|percnt|dollar|lpar|rpar|equals|tab|newline);?(?![\da-z=])|#39;?(?!\d)|#x[\da-f]+;?(?![\da-f])|#\d+;?(?!\d))/giu;
122
+ export function safeNativeRawHtml(value) {
123
+ let inspected = value;
124
+ for (let pass = 0; pass < 3; pass += 1) {
125
+ if (NATIVE_DANGER.test(inspected))
126
+ return false;
127
+ const normalized = inspected.replaceAll(INSPECTABLE_ENTITY, (entity) => decodeInspectionEntity(entity));
128
+ if (normalized === inspected)
129
+ return true;
130
+ inspected = normalized;
131
+ }
132
+ INSPECTABLE_ENTITY.lastIndex = 0;
133
+ return !NATIVE_DANGER.test(inspected) && !INSPECTABLE_ENTITY.test(inspected);
134
+ }
135
+ function decodeInspectionEntity(entity) {
136
+ const normalized = entity.toLowerCase();
137
+ const terminated = normalized.endsWith(';');
138
+ const bare = terminated ? normalized.slice(0, -1) : normalized;
139
+ if (bare === '&amp')
140
+ return '&';
141
+ if (bare === '&lt')
142
+ return '<';
143
+ if (bare === '&gt')
144
+ return '>';
145
+ if (bare === '&quot')
146
+ return '"';
147
+ if (bare === '&apos' || bare === '&#39')
148
+ return "'";
149
+ const named = new Map([
150
+ ['&colon', ':'],
151
+ ['&sol', '/'],
152
+ ['&lbrace', '{'],
153
+ ['&rbrace', '}'],
154
+ ['&lcub', '{'],
155
+ ['&rcub', '}'],
156
+ ['&percnt', '%'],
157
+ ['&dollar', '$'],
158
+ ['&lpar', '('],
159
+ ['&rpar', ')'],
160
+ ['&equals', '='],
161
+ ['&tab', '\t'],
162
+ ['&newline', '\n'],
163
+ ]).get(bare);
164
+ if (named !== undefined)
165
+ return named;
166
+ const numeric = bare.startsWith('&#x')
167
+ ? Number.parseInt(bare.slice(3), 16)
168
+ : Number.parseInt(bare.slice(2), 10);
169
+ return Number.isFinite(numeric) && numeric >= 0 && numeric <= 1_114_111
170
+ ? String.fromCodePoint(numeric)
171
+ : entity;
172
+ }
173
+ function record(value) {
174
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
175
+ }
176
+ function exactKeys(value, keys, label) {
177
+ if (Object.keys(value).toSorted().join('\0') !== [...keys].toSorted().join('\0')) {
178
+ throw new TypeError(`${label} must contain exactly ${keys.join(', ')}`);
179
+ }
180
+ }
181
+ function identity(value, label) {
182
+ if (typeof value !== 'string' || !/^[A-Za-z0-9_-]+$/u.test(value)) {
183
+ throw new TypeError(`${label} must be a nonempty identifier without whitespace or separators`);
184
+ }
185
+ }
186
+ function rewriteReferences(value, keys) {
187
+ if (Array.isArray(value))
188
+ return value.map((child) => rewriteReferences(child, keys));
189
+ if (!record(value))
190
+ return value;
191
+ if ('ref' in value) {
192
+ // Only the documented ImageContentReference shape proves this field is a CMS key.
193
+ if (value.type !== 'imageReference' || !record(value.ref)) {
194
+ throw new TypeError('Unsupported or ambiguous content reference; explicit transport required');
195
+ }
196
+ exactKeys(value.ref, ['contentKey'], 'Image reference');
197
+ const key = value.ref.contentKey;
198
+ if (typeof key !== 'string' || !keys.has(key)) {
199
+ throw new TypeError('Image reference has no selected source identity mapping');
200
+ }
201
+ return Object.fromEntries(Object.entries(value).map(([name, child]) => [
202
+ name,
203
+ name === 'ref' ? { contentKey: keys.get(key) } : rewriteReferences(child, keys),
204
+ ]));
205
+ }
206
+ return Object.fromEntries(Object.entries(value).map(([name, child]) => [name, rewriteReferences(child, keys)]));
207
+ }
208
+ /**
209
+ * Build a detached identity proposal, not an executable or destination-validated import plan.
210
+ * @param {LoadedWorkspaceExport} source - Export already loaded through raw-byte integrity validation.
211
+ * @param {unknown} input - Complete explicit CREATE mappings for every selected parent and language.
212
+ * @returns {PlannedImportIdentities} Detached items requiring destination absence checks before mutation.
213
+ */
214
+ export function planImportIdentities(source, input) {
215
+ if (!source.integrity.verified)
216
+ throw new TypeError('Source integrity must be verified first');
217
+ if (!Array.isArray(input))
218
+ throw new TypeError('Identity mappings must be an array');
219
+ const sourceKeys = new Set(source.items.map((item) => item.contentKey));
220
+ const sourceApiNames = new Set(source.items.map((item) => item.apiName));
221
+ const sourceUrls = new Set(source.items.flatMap((item) => [item.urlName, item.contentBody['sfdc_cms:urlName']]));
222
+ const mappings = new Map();
223
+ const targets = new Set();
224
+ const apiNames = new Set();
225
+ const urls = new Set();
226
+ for (const row of input) {
227
+ if (!record(row))
228
+ throw new TypeError('Identity mapping must be an object');
229
+ exactKeys(row, ['sourceContentKey', 'contentKey', 'apiName', 'urlNames'], 'Identity mapping');
230
+ for (const name of ['sourceContentKey', 'contentKey', 'apiName'])
231
+ identity(row[name], name);
232
+ const { sourceContentKey, contentKey, apiName } = row;
233
+ if (!sourceKeys.has(sourceContentKey) || mappings.has(sourceContentKey)) {
234
+ throw new TypeError('Identity mapping has an unknown or duplicate source content key');
235
+ }
236
+ if (sourceKeys.has(contentKey) || targets.has(contentKey)) {
237
+ throw new TypeError('Target content keys must be fresh and unique');
238
+ }
239
+ if (sourceApiNames.has(apiName) || apiNames.has(apiName)) {
240
+ throw new TypeError('Target API names must be fresh and unique');
241
+ }
242
+ const variants = source.items.filter((item) => item.contentKey === sourceContentKey);
243
+ if (new Set(variants.map((item) => item.contentType)).size !== 1) {
244
+ throw new TypeError('Parent variants have conflicting content types');
245
+ }
246
+ if (!record(row.urlNames))
247
+ throw new TypeError('urlNames must be an object');
248
+ exactKeys(row.urlNames, variants.map((item) => item.language), 'urlNames');
249
+ for (const url of Object.values(row.urlNames)) {
250
+ if (typeof url !== 'string' || !/^[a-z0-9-]+$/u.test(url)) {
251
+ throw new TypeError('Target URL names must contain lowercase letters, digits or hyphens');
252
+ }
253
+ if (sourceUrls.has(url) || urls.has(url)) {
254
+ throw new TypeError('Target URL names must be fresh and unique');
255
+ }
256
+ urls.add(url);
257
+ }
258
+ mappings.set(sourceContentKey, row);
259
+ targets.add(contentKey);
260
+ apiNames.add(apiName);
261
+ }
262
+ if (mappings.size !== sourceKeys.size)
263
+ throw new TypeError('Every selected parent needs a mapping');
264
+ const replacements = new Map([...mappings].map(([key, mapping]) => [key, mapping.contentKey]));
265
+ const imageKeys = new Map(source.items
266
+ .filter((item) => item.contentType === 'sfdc_cms__image')
267
+ .map((item) => [item.contentKey, replacements.get(item.contentKey)]));
268
+ const items = source.items.map((item) => {
269
+ const mapping = mappings.get(item.contentKey);
270
+ const contentBody = rewriteReferences(item.contentBody, imageKeys);
271
+ const urlName = mapping.urlNames[item.language];
272
+ // Email CMS metadata lives inside the body; never replace matching strings elsewhere.
273
+ if (item.contentType === 'sfdc_cms__email' ||
274
+ (item.contentType === 'sfdc_cms__emailTemplate' && 'sfdc_cms:urlName' in contentBody)) {
275
+ contentBody['sfdc_cms:urlName'] = urlName;
276
+ }
277
+ return {
278
+ ...item,
279
+ apiName: mapping.apiName,
280
+ contentKey: mapping.contentKey,
281
+ urlName,
282
+ contentBody,
283
+ };
284
+ });
285
+ return { items, targetContentKeys: [...targets].toSorted() };
286
+ }
287
+ //# sourceMappingURL=import-identities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import-identities.js","sourceRoot":"","sources":["../../src/services/import-identities.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAC9B,MAA6B,EAC7B,KAAc,EACd,wBAA6C,IAAI,GAAG,EAAE;IAEtD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAC7C,MAAM,IAAI,SAAS,CAAC,+CAA+C,CAAC,CAAC;IACvE,MAAM,QAAQ,GAA0B,EAAE,CAAC;IAC3C,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IACnE,MAAM,IAAI,GAAG,IAAI,GAAG,CAClB,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAC,CACrF,CAAC;IACF,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAClC,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;QACxB,IAAI,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;IAC3B,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC;AAC/D,CAAC"}
@@ -1,7 +1,10 @@
1
1
  import type { Connection } from '@salesforce/core';
2
+ import type { CmsDiagnostic } from '../contracts/shared.js';
2
3
  import type { JsonRequestOptions } from '../transport/json-request.js';
4
+ import { type AtomicPublishOptions, type CleanupOptions } from './atomic-publish.js';
3
5
  import { type WorkspaceExportManifest } from '../contracts/workspace-export.js';
4
6
  import type { WorkspaceImportResult as WorkspaceImportContractResult } from '../contracts/workspace-import.js';
7
+ import { type EditableHtmlEvidence } from './editable-raw-html-import.js';
5
8
  type RequestConnection = Pick<Connection, 'request'>;
6
9
  type JsonObject = {
7
10
  readonly [key: string]: JsonValue;
@@ -65,12 +68,14 @@ export type WorkspaceImportOperation = {
65
68
  error?: string;
66
69
  result?: {
67
70
  readonly contentId?: string;
71
+ readonly contentKey?: string;
68
72
  readonly primaryVariantId?: string;
69
73
  readonly variantId?: string;
70
74
  };
71
75
  state: 'pending' | 'succeeded' | 'failed';
72
76
  };
73
77
  export type WorkspaceImportRunReport = {
78
+ readonly editableSource?: EditableHtmlEvidence;
74
79
  readonly createdParents: CreatedParentRecord[];
75
80
  readonly destinationOrgId: string;
76
81
  readonly destinationWorkspaceId: string;
@@ -94,7 +99,10 @@ export type ExecuteWorkspaceImportOptions = {
94
99
  readonly destinationOrgId: string;
95
100
  readonly destinationWorkspace: unknown;
96
101
  readonly dryRun?: boolean;
102
+ readonly editableDirectory?: string;
97
103
  readonly loadedSource?: LoadedWorkspaceExport;
104
+ readonly identityMappings?: unknown;
105
+ readonly nativeCopyMappings?: unknown;
98
106
  readonly reportDirectory?: string;
99
107
  readonly reportPersistence?: WorkspaceImportReportPersistence;
100
108
  readonly requestOptions?: JsonRequestOptions;
@@ -102,15 +110,46 @@ export type ExecuteWorkspaceImportOptions = {
102
110
  readonly workspaceId: string;
103
111
  };
104
112
  export type WorkspaceImportExecutionResult = {
113
+ readonly diagnostics: CmsDiagnostic[];
105
114
  readonly contractResult: WorkspaceImportContractResult;
106
115
  readonly dryRun: boolean;
107
116
  readonly plan: WorkspaceImportPlan;
108
117
  readonly report?: WorkspaceImportRunReport;
109
118
  readonly reportFile?: string;
110
119
  };
120
+ /**
121
+ * Read a regular file while detecting observed replacement or modification.
122
+ * @param {string} file - Absolute file path.
123
+ * @param {string} label - Error context.
124
+ * @returns {Promise<Buffer>} Original file bytes.
125
+ */
126
+ export declare function readStableRegularFile(file: string, label: string): Promise<Buffer>;
127
+ /**
128
+ * Enumerate regular package files without following symlinks.
129
+ * @param {string} directory - Directory to inspect.
130
+ * @param {string} packageRoot - Root for relative paths.
131
+ * @returns {Promise<string[]>} Sorted portable relative filenames.
132
+ */
133
+ export declare function enumeratePackageFiles(directory: string, packageRoot: string): Promise<string[]>;
111
134
  export declare function loadWorkspaceExport(sourceDirectory: string, options?: {
112
135
  readonly allowPartial?: boolean;
113
136
  }): Promise<LoadedWorkspaceExport>;
114
137
  export declare function planWorkspaceImport(source: LoadedWorkspaceExport, workspace: unknown, expectedWorkspaceId: string): WorkspaceImportPlan;
138
+ type AtomicRewriteOptions = AtomicPublishOptions & CleanupOptions;
139
+ export declare function rewriteAtomic(file: string, value: unknown, options?: AtomicRewriteOptions): Promise<void>;
140
+ /**
141
+ * Reconstruct editable HTML before native validation, retaining all original identity inventory.
142
+ * @param {LoadedWorkspaceExport} source - Complete verified original package.
143
+ * @param {unknown} mappings - Native copy selections and fresh identities.
144
+ * @param {string} editableDirectory - Optional verified HTML companion.
145
+ * @returns {Promise<object>} Native proposal and optional all-companion evidence.
146
+ */
147
+ export declare function planNativeWorkspaceImport(source: LoadedWorkspaceExport, mappings: unknown, editableDirectory?: string): Promise<{
148
+ proposal: import("./import-identities.js").PlannedImportIdentities;
149
+ editableSource?: undefined;
150
+ } | {
151
+ proposal: import("./import-identities.js").PlannedImportIdentities;
152
+ editableSource: EditableHtmlEvidence;
153
+ }>;
115
154
  export declare function executeWorkspaceImport(options: ExecuteWorkspaceImportOptions): Promise<WorkspaceImportExecutionResult>;
116
155
  export {};