sf-plugin-cms 0.4.0 → 0.5.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 +241 -20
- package/lib/commands/cms/export/workspace.d.ts +5 -1
- package/lib/commands/cms/export/workspace.js +60 -2
- package/lib/commands/cms/export/workspace.js.map +1 -1
- package/lib/commands/cms/import/workspace.d.ts +12 -4
- package/lib/commands/cms/import/workspace.js +167 -20
- package/lib/commands/cms/import/workspace.js.map +1 -1
- package/lib/commands/cms/info.js +21 -2
- package/lib/commands/cms/info.js.map +1 -1
- package/lib/contracts/info.d.ts +7 -4
- package/lib/contracts/info.js +17 -8
- package/lib/contracts/info.js.map +1 -1
- package/lib/contracts/shared.d.ts +2 -1
- package/lib/contracts/shared.js +11 -3
- package/lib/contracts/shared.js.map +1 -1
- package/lib/contracts/workspace-export.d.ts +23 -3
- package/lib/contracts/workspace-export.js +118 -5
- package/lib/contracts/workspace-export.js.map +1 -1
- package/lib/contracts/workspace-import.d.ts +64 -0
- package/lib/contracts/workspace-import.js +119 -0
- package/lib/contracts/workspace-import.js.map +1 -1
- package/lib/index.d.ts +3 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/services/email-fragment.d.ts +15 -0
- package/lib/services/email-fragment.js +199 -0
- package/lib/services/email-fragment.js.map +1 -0
- package/lib/services/export-workspace.d.ts +13 -1
- package/lib/services/export-workspace.js +183 -7
- package/lib/services/export-workspace.js.map +1 -1
- package/lib/services/image-import.d.ts +91 -0
- package/lib/services/image-import.js +579 -0
- package/lib/services/image-import.js.map +1 -0
- package/lib/services/import-workspace.d.ts +16 -3
- package/lib/services/import-workspace.js +142 -14
- package/lib/services/import-workspace.js.map +1 -1
- package/lib/services/landing-page-template.d.ts +52 -0
- package/lib/services/landing-page-template.js +421 -0
- package/lib/services/landing-page-template.js.map +1 -0
- package/lib/services/landing-page.d.ts +43 -0
- package/lib/services/landing-page.js +117 -0
- package/lib/services/landing-page.js.map +1 -0
- package/lib/services/web-fragment.d.ts +41 -0
- package/lib/services/web-fragment.js +245 -0
- package/lib/services/web-fragment.js.map +1 -0
- package/lib/transport/experimental-media.d.ts +30 -0
- package/lib/transport/experimental-media.js +224 -0
- package/lib/transport/experimental-media.js.map +1 -0
- package/lib/transport/json-request.d.ts +9 -1
- package/lib/transport/json-request.js +30 -3
- package/lib/transport/json-request.js.map +1 -1
- package/lib/transport/multipart-image-create.d.ts +28 -0
- package/lib/transport/multipart-image-create.js +189 -0
- package/lib/transport/multipart-image-create.js.map +1 -0
- package/messages/cms.import.workspace.md +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Connection } from '@salesforce/core';
|
|
2
|
+
import { type JsonRequestOptions } from '../transport/json-request.js';
|
|
3
|
+
import type { LoadedWorkspaceExport, WorkspaceImportItem } from './import-workspace.js';
|
|
4
|
+
import type { PlannedImportIdentities } from './import-identities.js';
|
|
5
|
+
import { type WebFragmentDataGraphPrerequisite } from './web-fragment.js';
|
|
6
|
+
type RequestConnection = Pick<Connection, 'request'>;
|
|
7
|
+
type QueryConnection = {
|
|
8
|
+
readonly query?: Connection['query'];
|
|
9
|
+
};
|
|
10
|
+
export type LandingPageTemplateCmsPrerequisite = {
|
|
11
|
+
readonly sourceContentKey: string;
|
|
12
|
+
readonly sourceType: 'image' | 'webFragment';
|
|
13
|
+
readonly targetApiName: string;
|
|
14
|
+
readonly targetTitle?: string;
|
|
15
|
+
readonly targetContentType: string;
|
|
16
|
+
resolution: 'api-name' | 'title-fallback' | 'pending';
|
|
17
|
+
targetContentKey?: string;
|
|
18
|
+
validationStatus: 'failed' | 'passed' | 'pending';
|
|
19
|
+
};
|
|
20
|
+
export type PlannedLandingPageTemplateCopies = PlannedImportIdentities & {
|
|
21
|
+
readonly cmsPrerequisites: LandingPageTemplateCmsPrerequisite[];
|
|
22
|
+
readonly dataGraphs: WebFragmentDataGraphPrerequisite[];
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Validate the captured landing-page-template authoring shape.
|
|
26
|
+
* @param {WorkspaceImportItem} item - Captured workspace item to validate.
|
|
27
|
+
* @returns {object} Extracted prerequisite identities.
|
|
28
|
+
*/
|
|
29
|
+
export declare function assertLandingPageTemplateItem(item: WorkspaceImportItem): {
|
|
30
|
+
cmsContentKeys: readonly string[];
|
|
31
|
+
dataGraphs: readonly {
|
|
32
|
+
developerName: string;
|
|
33
|
+
dataSpace: string;
|
|
34
|
+
}[];
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Plan exact type-qualified template creates and their explicit prerequisites.
|
|
38
|
+
* @param {LoadedWorkspaceExport} source - Verified source workspace package.
|
|
39
|
+
* @param {unknown} input - User-supplied template mapping JSON.
|
|
40
|
+
* @returns {PlannedLandingPageTemplateCopies} Validated create proposal.
|
|
41
|
+
*/
|
|
42
|
+
export declare function planLandingPageTemplateCopies(source: LoadedWorkspaceExport, input: unknown): PlannedLandingPageTemplateCopies;
|
|
43
|
+
/**
|
|
44
|
+
* Resolve exact typed CMS dependencies, with title fallback only after zero API-name matches.
|
|
45
|
+
* @param {RequestConnection & QueryConnection} connection - Destination org connection.
|
|
46
|
+
* @param {string} workspaceId - Exact destination workspace ID.
|
|
47
|
+
* @param {PlannedLandingPageTemplateCopies} proposal - Template create proposal to validate.
|
|
48
|
+
* @param {JsonRequestOptions} options - Optional request metadata and signal.
|
|
49
|
+
* @returns {Promise<void>} Resolves after every prerequisite is validated and rewritten.
|
|
50
|
+
*/
|
|
51
|
+
export declare function validateLandingPageTemplatePrerequisites(connection: RequestConnection & QueryConnection, workspaceId: string, proposal: PlannedLandingPageTemplateCopies, options?: JsonRequestOptions): Promise<void>;
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
import { isDeepStrictEqual } from 'node:util';
|
|
2
|
+
import { getSelectedOperation, requestJson, } from '../transport/json-request.js';
|
|
3
|
+
import { getVariant } from './read.js';
|
|
4
|
+
import { validateDataGraphPrerequisites, } from './web-fragment.js';
|
|
5
|
+
const TEMPLATE_TYPE = 'sfdc_cms__landingPageTemplate';
|
|
6
|
+
const DATA_GRAPH_PROVIDER = 'sfdc_cms__dataGraphDataProvider';
|
|
7
|
+
const BODY_KEYS = [
|
|
8
|
+
'lightning:backgroundImage',
|
|
9
|
+
'lightning:brandSource',
|
|
10
|
+
'lightning:dataProviders',
|
|
11
|
+
'lightning:expressions',
|
|
12
|
+
'sfdc_cms:block',
|
|
13
|
+
'sfdc_cms:description',
|
|
14
|
+
'sfdc_cms:seoProperties',
|
|
15
|
+
'sfdc_cms:title',
|
|
16
|
+
'sfdc_cms:variants',
|
|
17
|
+
];
|
|
18
|
+
const OPTIONAL_BODY_KEYS = ['sfdc_cms:urlName'];
|
|
19
|
+
const CMS_DEPENDENCY_TYPES = new Map([
|
|
20
|
+
['image', 'sfdc_cms__image'],
|
|
21
|
+
['webFragment', 'sfdc_cms__webFragment'],
|
|
22
|
+
]);
|
|
23
|
+
const PAGE_SIZE = 250;
|
|
24
|
+
const PAGE_CAP = 1000;
|
|
25
|
+
function record(value) {
|
|
26
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
27
|
+
}
|
|
28
|
+
function nonempty(value, label) {
|
|
29
|
+
if (typeof value !== 'string' || value.trim().length === 0) {
|
|
30
|
+
throw new TypeError(`${label} must be a nonempty string`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function identifier(value, label) {
|
|
34
|
+
nonempty(value, label);
|
|
35
|
+
if (!/^[A-Za-z][A-Za-z\d_]*$/u.test(value)) {
|
|
36
|
+
throw new TypeError(`${label} must be an exact developer/API name`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function exactKeys(value, required, optional, label) {
|
|
40
|
+
const keys = Object.keys(value);
|
|
41
|
+
if (required.some((key) => !keys.includes(key)) ||
|
|
42
|
+
keys.some((key) => !required.includes(key) && !optional.includes(key))) {
|
|
43
|
+
throw new TypeError(`${label} contains unsupported or missing fields`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function dataGraphProvider(value, label) {
|
|
47
|
+
if (!record(value))
|
|
48
|
+
throw new TypeError(`${label} must be an object`);
|
|
49
|
+
if (Object.keys(value).toSorted().join('\0') !==
|
|
50
|
+
['attributes', 'definition', 'sfdcExpressionKey'].toSorted().join('\0') ||
|
|
51
|
+
value.definition !== DATA_GRAPH_PROVIDER ||
|
|
52
|
+
value.sfdcExpressionKey !== '$dataGraph' ||
|
|
53
|
+
!record(value.attributes)) {
|
|
54
|
+
throw new TypeError(`${label} must use the exact Data Graph provider shape`);
|
|
55
|
+
}
|
|
56
|
+
if (Object.keys(value.attributes).toSorted().join('\0') !==
|
|
57
|
+
['dataGraphApiName', 'dataspace'].toSorted().join('\0')) {
|
|
58
|
+
throw new TypeError(`${label}.attributes is unsupported`);
|
|
59
|
+
}
|
|
60
|
+
identifier(value.attributes.dataGraphApiName, `${label}.attributes.dataGraphApiName`);
|
|
61
|
+
identifier(value.attributes.dataspace, `${label}.attributes.dataspace`);
|
|
62
|
+
return {
|
|
63
|
+
developerName: value.attributes.dataGraphApiName,
|
|
64
|
+
dataSpace: value.attributes.dataspace,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function collectCmsReferences(value, references) {
|
|
68
|
+
if (Array.isArray(value)) {
|
|
69
|
+
for (const child of value)
|
|
70
|
+
collectCmsReferences(child, references);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (!record(value))
|
|
74
|
+
return;
|
|
75
|
+
if ('ref' in value || (typeof value.type === 'string' && value.type.endsWith('Reference'))) {
|
|
76
|
+
if (value.type !== 'imageReference' ||
|
|
77
|
+
!record(value.ref) ||
|
|
78
|
+
Object.keys(value.ref).length !== 1 ||
|
|
79
|
+
typeof value.ref.contentKey !== 'string' ||
|
|
80
|
+
value.ref.contentKey.length === 0) {
|
|
81
|
+
throw new TypeError('Landing-page template contains an unsupported CMS dependency shape');
|
|
82
|
+
}
|
|
83
|
+
references.add(value.ref.contentKey);
|
|
84
|
+
}
|
|
85
|
+
for (const child of Object.values(value))
|
|
86
|
+
collectCmsReferences(child, references);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Validate the captured landing-page-template authoring shape.
|
|
90
|
+
* @param {WorkspaceImportItem} item - Captured workspace item to validate.
|
|
91
|
+
* @returns {object} Extracted prerequisite identities.
|
|
92
|
+
*/
|
|
93
|
+
export function assertLandingPageTemplateItem(item) {
|
|
94
|
+
if (item.contentType !== TEMPLATE_TYPE) {
|
|
95
|
+
throw new TypeError(`Landing-page-template profile requires exact content type ${TEMPLATE_TYPE}`);
|
|
96
|
+
}
|
|
97
|
+
identifier(item.apiName, 'Landing-page template apiName');
|
|
98
|
+
nonempty(item.title, 'Landing-page template title');
|
|
99
|
+
exactKeys(item.contentBody, BODY_KEYS, OPTIONAL_BODY_KEYS, 'Landing-page template body');
|
|
100
|
+
if (item.contentBody['sfdc_cms:title'] !== item.title) {
|
|
101
|
+
throw new TypeError('Landing-page template body title must match the top-level title');
|
|
102
|
+
}
|
|
103
|
+
if (item.contentBody['sfdc_cms:urlName'] !== undefined &&
|
|
104
|
+
item.contentBody['sfdc_cms:urlName'] !== item.urlName) {
|
|
105
|
+
throw new TypeError('Landing-page template body URL name must match the top-level URL name');
|
|
106
|
+
}
|
|
107
|
+
if (!isDeepStrictEqual(item.contentBody['lightning:brandSource'], {
|
|
108
|
+
defaultBrandOption: 'sfdcBrand',
|
|
109
|
+
})) {
|
|
110
|
+
throw new TypeError('Landing-page template brand source is unsupported');
|
|
111
|
+
}
|
|
112
|
+
for (const key of ['lightning:expressions', 'sfdc_cms:variants']) {
|
|
113
|
+
if (!Array.isArray(item.contentBody[key]))
|
|
114
|
+
throw new TypeError(`${key} must be an array`);
|
|
115
|
+
}
|
|
116
|
+
if (!record(item.contentBody['sfdc_cms:block'])) {
|
|
117
|
+
throw new TypeError('Landing-page template root block must be an object');
|
|
118
|
+
}
|
|
119
|
+
const providers = item.contentBody['lightning:dataProviders'];
|
|
120
|
+
if (!Array.isArray(providers))
|
|
121
|
+
throw new TypeError('Landing-page template data providers must be an array');
|
|
122
|
+
const dataGraphs = providers.map((value, index) => dataGraphProvider(value, `Data Graph provider ${index}`));
|
|
123
|
+
if (new Set(dataGraphs.map((value) => `${value.developerName}\0${value.dataSpace}`)).size !==
|
|
124
|
+
dataGraphs.length) {
|
|
125
|
+
throw new TypeError('Landing-page template Data Graph providers must be unique');
|
|
126
|
+
}
|
|
127
|
+
const references = new Set();
|
|
128
|
+
collectCmsReferences(item.contentBody, references);
|
|
129
|
+
return { cmsContentKeys: [...references].toSorted(), dataGraphs };
|
|
130
|
+
}
|
|
131
|
+
function rows(value) {
|
|
132
|
+
if (!Array.isArray(value) || value.length === 0 || value.some((row) => !record(row))) {
|
|
133
|
+
throw new TypeError('Landing-page template mappings must be a nonempty array of objects');
|
|
134
|
+
}
|
|
135
|
+
return value;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Plan exact type-qualified template creates and their explicit prerequisites.
|
|
139
|
+
* @param {LoadedWorkspaceExport} source - Verified source workspace package.
|
|
140
|
+
* @param {unknown} input - User-supplied template mapping JSON.
|
|
141
|
+
* @returns {PlannedLandingPageTemplateCopies} Validated create proposal.
|
|
142
|
+
*/
|
|
143
|
+
export function planLandingPageTemplateCopies(source, input) {
|
|
144
|
+
if (!source.integrity.verified)
|
|
145
|
+
throw new TypeError('Source integrity must be verified first');
|
|
146
|
+
const sourceKeys = new Set(source.items.map((item) => item.contentKey));
|
|
147
|
+
const sourceNames = new Set(source.items.flatMap((item) => (item.apiName === undefined ? [] : [item.apiName])));
|
|
148
|
+
const targetKeys = new Set();
|
|
149
|
+
const targetNames = new Set();
|
|
150
|
+
const selected = new Set();
|
|
151
|
+
const items = [];
|
|
152
|
+
const cmsPrerequisites = [];
|
|
153
|
+
const dataGraphs = [];
|
|
154
|
+
for (const [index, row] of rows(input).entries()) {
|
|
155
|
+
exactKeys(row, ['source', 'target', 'cmsDependencies', 'dataGraphs'], [], `Template mapping ${index}`);
|
|
156
|
+
if (!record(row.source))
|
|
157
|
+
throw new TypeError(`Template mapping ${index}.source must be an object`);
|
|
158
|
+
exactKeys(row.source, ['family', 'type', 'apiName'], [], `Template mapping ${index}.source`);
|
|
159
|
+
if (row.source.family !== 'cms' || row.source.type !== 'landingPageTemplate') {
|
|
160
|
+
throw new TypeError(`Template mapping ${index}.source must select cms/landingPageTemplate`);
|
|
161
|
+
}
|
|
162
|
+
identifier(row.source.apiName, `Template mapping ${index}.source.apiName`);
|
|
163
|
+
const sourceApiName = row.source.apiName;
|
|
164
|
+
if (selected.has(sourceApiName))
|
|
165
|
+
throw new TypeError(`Duplicate template selection: ${sourceApiName}`);
|
|
166
|
+
const matches = source.items.filter((item) => item.contentType === TEMPLATE_TYPE && item.apiName === sourceApiName);
|
|
167
|
+
if (matches.length !== 1) {
|
|
168
|
+
throw new TypeError(`Typed source API name must match exactly one landing-page template: ${sourceApiName}`);
|
|
169
|
+
}
|
|
170
|
+
const item = matches[0];
|
|
171
|
+
const prerequisites = assertLandingPageTemplateItem(item);
|
|
172
|
+
if (!record(row.target))
|
|
173
|
+
throw new TypeError(`Template mapping ${index}.target must be an object`);
|
|
174
|
+
exactKeys(row.target, ['contentKey', 'apiName'], [], `Template mapping ${index}.target`);
|
|
175
|
+
identifier(row.target.contentKey, `Template mapping ${index}.target.contentKey`);
|
|
176
|
+
identifier(row.target.apiName, `Template mapping ${index}.target.apiName`);
|
|
177
|
+
if (sourceKeys.has(row.target.contentKey) || targetKeys.has(row.target.contentKey)) {
|
|
178
|
+
throw new TypeError('Target template content keys must be fresh and unique');
|
|
179
|
+
}
|
|
180
|
+
if (sourceNames.has(row.target.apiName) || targetNames.has(row.target.apiName)) {
|
|
181
|
+
throw new TypeError('Target template API names must be fresh and unique');
|
|
182
|
+
}
|
|
183
|
+
if (!Array.isArray(row.cmsDependencies) ||
|
|
184
|
+
row.cmsDependencies.length !== prerequisites.cmsContentKeys.length) {
|
|
185
|
+
throw new TypeError('Each CMS content prerequisite requires exactly one mapping row');
|
|
186
|
+
}
|
|
187
|
+
const dependencyMap = new Map();
|
|
188
|
+
for (const [dependencyIndex, raw] of row.cmsDependencies.entries()) {
|
|
189
|
+
if (!record(raw))
|
|
190
|
+
throw new TypeError(`Template dependency ${dependencyIndex} must be an object`);
|
|
191
|
+
exactKeys(raw, ['sourceContentKey', 'sourceType', 'targetApiName'], ['targetTitle'], `Template dependency ${dependencyIndex}`);
|
|
192
|
+
nonempty(raw.sourceContentKey, 'sourceContentKey');
|
|
193
|
+
identifier(raw.targetApiName, 'targetApiName');
|
|
194
|
+
if (raw.targetTitle !== undefined)
|
|
195
|
+
nonempty(raw.targetTitle, 'targetTitle');
|
|
196
|
+
const targetContentType = CMS_DEPENDENCY_TYPES.get(String(raw.sourceType));
|
|
197
|
+
if (targetContentType === undefined)
|
|
198
|
+
throw new TypeError('Template CMS dependency type is unsupported');
|
|
199
|
+
if (dependencyMap.has(raw.sourceContentKey))
|
|
200
|
+
throw new TypeError('Duplicate template CMS dependency mapping');
|
|
201
|
+
dependencyMap.set(raw.sourceContentKey, {
|
|
202
|
+
sourceContentKey: raw.sourceContentKey,
|
|
203
|
+
sourceType: raw.sourceType,
|
|
204
|
+
targetApiName: raw.targetApiName,
|
|
205
|
+
...(raw.targetTitle === undefined ? {} : { targetTitle: raw.targetTitle }),
|
|
206
|
+
targetContentType,
|
|
207
|
+
resolution: 'pending',
|
|
208
|
+
validationStatus: 'pending',
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
for (const contentKey of prerequisites.cmsContentKeys) {
|
|
212
|
+
if (!dependencyMap.has(contentKey))
|
|
213
|
+
throw new TypeError(`Missing exact CMS dependency mapping for ${contentKey}`);
|
|
214
|
+
}
|
|
215
|
+
if (!Array.isArray(row.dataGraphs) ||
|
|
216
|
+
row.dataGraphs.length !== prerequisites.dataGraphs.length) {
|
|
217
|
+
throw new TypeError('Each Data Graph prerequisite requires exactly one mapping row');
|
|
218
|
+
}
|
|
219
|
+
const graphMap = new Map();
|
|
220
|
+
for (const raw of row.dataGraphs) {
|
|
221
|
+
if (!record(raw))
|
|
222
|
+
throw new TypeError('Template Data Graph mapping must be an object');
|
|
223
|
+
exactKeys(raw, ['sourceDeveloperName', 'sourceDataSpace', 'targetDeveloperName', 'targetDataSpace'], [], 'Template Data Graph mapping');
|
|
224
|
+
for (const key of [
|
|
225
|
+
'sourceDeveloperName',
|
|
226
|
+
'sourceDataSpace',
|
|
227
|
+
'targetDeveloperName',
|
|
228
|
+
'targetDataSpace',
|
|
229
|
+
])
|
|
230
|
+
identifier(raw[key], key);
|
|
231
|
+
const sourceDeveloperName = raw.sourceDeveloperName;
|
|
232
|
+
const sourceDataSpace = raw.sourceDataSpace;
|
|
233
|
+
const targetDeveloperName = raw.targetDeveloperName;
|
|
234
|
+
const targetDataSpace = raw.targetDataSpace;
|
|
235
|
+
const key = `${sourceDeveloperName}\0${sourceDataSpace}`;
|
|
236
|
+
if (graphMap.has(key))
|
|
237
|
+
throw new TypeError('Duplicate template Data Graph source mapping');
|
|
238
|
+
graphMap.set(key, {
|
|
239
|
+
sourceDeveloperName,
|
|
240
|
+
sourceDataSpace,
|
|
241
|
+
targetDeveloperName,
|
|
242
|
+
targetDataSpace,
|
|
243
|
+
resolution: sourceDeveloperName === targetDeveloperName && sourceDataSpace === targetDataSpace
|
|
244
|
+
? 'preserved'
|
|
245
|
+
: 'explicit-map',
|
|
246
|
+
validationStatus: 'pending',
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
for (const prerequisite of prerequisites.dataGraphs) {
|
|
250
|
+
if (!graphMap.has(`${prerequisite.developerName}\0${prerequisite.dataSpace}`)) {
|
|
251
|
+
throw new TypeError(`Missing exact Data Graph mapping for ${prerequisite.developerName}/${prerequisite.dataSpace}`);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
const providers = item.contentBody['lightning:dataProviders'].map((value) => {
|
|
255
|
+
const identity = dataGraphProvider(value, 'Data Graph provider');
|
|
256
|
+
const target = graphMap.get(`${identity.developerName}\0${identity.dataSpace}`);
|
|
257
|
+
return {
|
|
258
|
+
...value,
|
|
259
|
+
attributes: {
|
|
260
|
+
dataGraphApiName: target.targetDeveloperName,
|
|
261
|
+
dataspace: target.targetDataSpace,
|
|
262
|
+
},
|
|
263
|
+
};
|
|
264
|
+
});
|
|
265
|
+
selected.add(sourceApiName);
|
|
266
|
+
targetKeys.add(row.target.contentKey);
|
|
267
|
+
targetNames.add(row.target.apiName);
|
|
268
|
+
cmsPrerequisites.push(...dependencyMap.values());
|
|
269
|
+
dataGraphs.push(...graphMap.values());
|
|
270
|
+
items.push({
|
|
271
|
+
...item,
|
|
272
|
+
apiName: row.target.apiName,
|
|
273
|
+
contentKey: row.target.contentKey,
|
|
274
|
+
contentBody: { ...item.contentBody, 'lightning:dataProviders': providers },
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
return {
|
|
278
|
+
items: items.toSorted((left, right) => left.apiName.localeCompare(right.apiName)),
|
|
279
|
+
targetContentKeys: [...targetKeys].toSorted(),
|
|
280
|
+
cmsPrerequisites,
|
|
281
|
+
dataGraphs,
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
function responseItems(value) {
|
|
285
|
+
if (!record(value) || !Array.isArray(value.items))
|
|
286
|
+
throw new TypeError('CMS prerequisite search must return items');
|
|
287
|
+
return value.items;
|
|
288
|
+
}
|
|
289
|
+
function responseCount(value) {
|
|
290
|
+
if (record(value)) {
|
|
291
|
+
for (const key of ['total', 'totalCount', 'count']) {
|
|
292
|
+
if (typeof value[key] === 'number' && Number.isInteger(value[key]) && value[key] >= 0)
|
|
293
|
+
return value[key];
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
throw new TypeError('CMS prerequisite search must return a count');
|
|
297
|
+
}
|
|
298
|
+
async function exactMatches(connection, workspaceId, contentType, queryTerm, predicate, options) {
|
|
299
|
+
const candidates = new Map();
|
|
300
|
+
let expected;
|
|
301
|
+
for (let page = 0; page < PAGE_CAP; page += 1) {
|
|
302
|
+
const response = await requestJson(connection, getSelectedOperation('workspace.variant.search'), {
|
|
303
|
+
query: {
|
|
304
|
+
contentSpaceOrFolderIds: [workspaceId],
|
|
305
|
+
contentTypeFQN: contentType,
|
|
306
|
+
languages: ['All'],
|
|
307
|
+
page,
|
|
308
|
+
pageSize: PAGE_SIZE,
|
|
309
|
+
queryTerm,
|
|
310
|
+
},
|
|
311
|
+
}, options);
|
|
312
|
+
const items = responseItems(response.data);
|
|
313
|
+
const count = responseCount(response.data);
|
|
314
|
+
if (expected === undefined)
|
|
315
|
+
expected = count;
|
|
316
|
+
else if (expected !== count)
|
|
317
|
+
throw new TypeError('CMS prerequisite search count changed');
|
|
318
|
+
for (const item of items) {
|
|
319
|
+
if (!record(item) ||
|
|
320
|
+
item.type !== 'ManagedContentVariantSearchResultRepresentation' ||
|
|
321
|
+
typeof item.id !== 'string' ||
|
|
322
|
+
item.managedContentSpaceId !== workspaceId ||
|
|
323
|
+
candidates.has(item.id)) {
|
|
324
|
+
throw new TypeError('CMS prerequisite search returned ambiguous scope evidence');
|
|
325
|
+
}
|
|
326
|
+
candidates.set(item.id, true);
|
|
327
|
+
}
|
|
328
|
+
if (items.length === 0 || candidates.size >= count)
|
|
329
|
+
break;
|
|
330
|
+
if (page === PAGE_CAP - 1)
|
|
331
|
+
throw new TypeError('CMS prerequisite search exceeded page cap');
|
|
332
|
+
}
|
|
333
|
+
if (expected === undefined || candidates.size !== expected)
|
|
334
|
+
throw new TypeError('CMS prerequisite search count was not satisfied');
|
|
335
|
+
const matches = [];
|
|
336
|
+
for (const id of candidates.keys()) {
|
|
337
|
+
const detail = await getVariant(connection, id, options);
|
|
338
|
+
const type = record(detail.contentType)
|
|
339
|
+
? detail.contentType.fullyQualifiedName
|
|
340
|
+
: detail.contentType;
|
|
341
|
+
if (!record(detail.contentSpace) ||
|
|
342
|
+
detail.contentSpace.id !== workspaceId ||
|
|
343
|
+
type !== contentType) {
|
|
344
|
+
throw new TypeError('CMS prerequisite detail changed workspace or type scope');
|
|
345
|
+
}
|
|
346
|
+
if (predicate(detail))
|
|
347
|
+
matches.push(detail);
|
|
348
|
+
}
|
|
349
|
+
return matches;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Resolve exact typed CMS dependencies, with title fallback only after zero API-name matches.
|
|
353
|
+
* @param {RequestConnection & QueryConnection} connection - Destination org connection.
|
|
354
|
+
* @param {string} workspaceId - Exact destination workspace ID.
|
|
355
|
+
* @param {PlannedLandingPageTemplateCopies} proposal - Template create proposal to validate.
|
|
356
|
+
* @param {JsonRequestOptions} options - Optional request metadata and signal.
|
|
357
|
+
* @returns {Promise<void>} Resolves after every prerequisite is validated and rewritten.
|
|
358
|
+
*/
|
|
359
|
+
export async function validateLandingPageTemplatePrerequisites(connection, workspaceId, proposal, options = {}) {
|
|
360
|
+
await validateDataGraphPrerequisites(connection, proposal.dataGraphs);
|
|
361
|
+
const resolved = new Map();
|
|
362
|
+
for (const prerequisite of proposal.cmsPrerequisites) {
|
|
363
|
+
try {
|
|
364
|
+
const apiMatches = await exactMatches(connection, workspaceId, prerequisite.targetContentType, prerequisite.targetApiName, (detail) => detail.apiName === prerequisite.targetApiName, options);
|
|
365
|
+
let match;
|
|
366
|
+
if (apiMatches.length === 1) {
|
|
367
|
+
match = apiMatches[0];
|
|
368
|
+
prerequisite.resolution = 'api-name';
|
|
369
|
+
}
|
|
370
|
+
else if (apiMatches.length > 1) {
|
|
371
|
+
throw new TypeError(`CMS prerequisite API name is ambiguous: ${prerequisite.targetApiName}`);
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
if (prerequisite.targetTitle === undefined) {
|
|
375
|
+
throw new TypeError(`CMS prerequisite API name was not found and no title fallback was provided: ${prerequisite.targetApiName}`);
|
|
376
|
+
}
|
|
377
|
+
const titleMatches = await exactMatches(connection, workspaceId, prerequisite.targetContentType, prerequisite.targetTitle, (detail) => detail.title === prerequisite.targetTitle, options);
|
|
378
|
+
if (titleMatches.length !== 1) {
|
|
379
|
+
throw new TypeError(`CMS prerequisite title fallback must resolve exactly once: ${prerequisite.targetTitle}`);
|
|
380
|
+
}
|
|
381
|
+
match = titleMatches[0];
|
|
382
|
+
prerequisite.resolution = 'title-fallback';
|
|
383
|
+
}
|
|
384
|
+
nonempty(match.contentKey, 'Resolved CMS prerequisite contentKey');
|
|
385
|
+
prerequisite.targetContentKey = match.contentKey;
|
|
386
|
+
prerequisite.validationStatus = 'passed';
|
|
387
|
+
resolved.set(prerequisite.sourceContentKey, match.contentKey);
|
|
388
|
+
}
|
|
389
|
+
catch (error) {
|
|
390
|
+
prerequisite.validationStatus = 'failed';
|
|
391
|
+
throw error;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
const rewrite = (value) => {
|
|
395
|
+
if (Array.isArray(value))
|
|
396
|
+
return value.map((child) => rewrite(child));
|
|
397
|
+
if (!record(value))
|
|
398
|
+
return value;
|
|
399
|
+
const next = Object.fromEntries(Object.entries(value).map(([key, child]) => [key, rewrite(child)]));
|
|
400
|
+
if (record(next.ref) && typeof next.ref.contentKey === 'string') {
|
|
401
|
+
const target = resolved.get(next.ref.contentKey);
|
|
402
|
+
if (target !== undefined)
|
|
403
|
+
next.ref = { ...next.ref, contentKey: target };
|
|
404
|
+
}
|
|
405
|
+
if (typeof next.url === 'string') {
|
|
406
|
+
let rewrittenUrl = next.url;
|
|
407
|
+
for (const [sourceKey, targetKey] of resolved) {
|
|
408
|
+
rewrittenUrl = rewrittenUrl.replaceAll(sourceKey, targetKey);
|
|
409
|
+
}
|
|
410
|
+
next.url = rewrittenUrl;
|
|
411
|
+
}
|
|
412
|
+
return next;
|
|
413
|
+
};
|
|
414
|
+
for (const [index, item] of proposal.items.entries()) {
|
|
415
|
+
proposal.items[index] = {
|
|
416
|
+
...item,
|
|
417
|
+
contentBody: rewrite(item.contentBody),
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
//# sourceMappingURL=landing-page-template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"landing-page-template.js","sourceRoot":"","sources":["../../src/services/landing-page-template.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EACL,oBAAoB,EACpB,WAAW,GAEZ,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EACL,8BAA8B,GAE/B,MAAM,mBAAmB,CAAC;AAE3B,MAAM,aAAa,GAAG,+BAA+B,CAAC;AACtD,MAAM,mBAAmB,GAAG,iCAAiC,CAAC;AAC9D,MAAM,SAAS,GAAG;IAChB,2BAA2B;IAC3B,uBAAuB;IACvB,yBAAyB;IACzB,uBAAuB;IACvB,gBAAgB;IAChB,sBAAsB;IACtB,wBAAwB;IACxB,gBAAgB;IAChB,mBAAmB;CACX,CAAC;AACX,MAAM,kBAAkB,GAAG,CAAC,kBAAkB,CAAU,CAAC;AACzD,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC;IACnC,CAAC,OAAO,EAAE,iBAAiB,CAAC;IAC5B,CAAC,aAAa,EAAE,uBAAuB,CAAC;CACzC,CAAC,CAAC;AACH,MAAM,SAAS,GAAG,GAAG,CAAC;AACtB,MAAM,QAAQ,GAAG,IAAI,CAAC;AAsBtB,SAAS,MAAM,CAAC,KAAc;IAC5B,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc,EAAE,KAAa;IAC7C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3D,MAAM,I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C,CACnE,CAAC;QACF,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,OAAO,IAAI,CAAC,GAAG,CAAC,UAAU,KAAK,QAAQ,EAAE,CAAC;YAChE,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YACjD,IAAI,MAAM,KAAK,SAAS;gBAAE,IAAI,CAAC,GAAG,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;QAC3E,CAAC;QACD,IAAI,OAAO,IAAI,CAAC,GAAG,KAAK,QAAQ,EAAE,CAAC;YACjC,IAAI,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC;YAC5B,KAAK,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,IAAI,QAAQ,EAAE,CAAC;gBAC9C,YAAY,GAAG,YAAY,CAAC,UAAU,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;YAC/D,CAAC;YACD,IAAI,CAAC,GAAG,GAAG,YAAY,CAAC;QAC1B,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;IACF,KAAK,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;QACpD,QAAQ,CAAC,KAA+B,CAAC,KAAK,CAAC,GAAG;YACjD,GAAG,IAAI;YACP,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW,CAAuC;SAC7E,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Connection } from '@salesforce/core';
|
|
2
|
+
import type { JsonRequestOptions } from '../transport/json-request.js';
|
|
3
|
+
import type { LoadedWorkspaceExport, WorkspaceImportItem } from './import-workspace.js';
|
|
4
|
+
import { type LandingPageTemplateCmsPrerequisite, type PlannedLandingPageTemplateCopies } from './landing-page-template.js';
|
|
5
|
+
type RequestConnection = Pick<Connection, 'request'> & {
|
|
6
|
+
readonly query?: Connection['query'];
|
|
7
|
+
};
|
|
8
|
+
export type LandingPageImagePrerequisite = LandingPageTemplateCmsPrerequisite & {
|
|
9
|
+
readonly sourceType: 'image';
|
|
10
|
+
readonly targetContentType: 'sfdc_cms__image';
|
|
11
|
+
};
|
|
12
|
+
export type PlannedLandingPageCopies = Omit<PlannedLandingPageTemplateCopies, 'cmsPrerequisites'> & {
|
|
13
|
+
readonly cmsPrerequisites: LandingPageImagePrerequisite[];
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Validate the exact captured landing-page authoring shape.
|
|
17
|
+
* @param {WorkspaceImportItem} item - Captured workspace item to validate.
|
|
18
|
+
* @returns {object} Extracted image and Data Graph prerequisites.
|
|
19
|
+
*/
|
|
20
|
+
export declare function assertLandingPageItem(item: WorkspaceImportItem): {
|
|
21
|
+
cmsContentKeys: readonly string[];
|
|
22
|
+
dataGraphs: readonly {
|
|
23
|
+
developerName: string;
|
|
24
|
+
dataSpace: string;
|
|
25
|
+
}[];
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Plan exact type-qualified landing-page creates using only evidenced image references.
|
|
29
|
+
* @param {LoadedWorkspaceExport} source - Verified source workspace package.
|
|
30
|
+
* @param {unknown} input - User-supplied landing-page mapping JSON.
|
|
31
|
+
* @returns {PlannedLandingPageCopies} Validated create proposal.
|
|
32
|
+
*/
|
|
33
|
+
export declare function planLandingPageCopies(source: LoadedWorkspaceExport, input: unknown): PlannedLandingPageCopies;
|
|
34
|
+
/**
|
|
35
|
+
* Resolve exact typed images, validate Data Graph identities, and rewrite evidenced references.
|
|
36
|
+
* @param {RequestConnection} connection - Destination org connection.
|
|
37
|
+
* @param {string} workspaceId - Exact destination workspace ID.
|
|
38
|
+
* @param {PlannedLandingPageCopies} proposal - Landing-page proposal to validate.
|
|
39
|
+
* @param {JsonRequestOptions} options - Optional request metadata and signal.
|
|
40
|
+
* @returns {Promise<void>} Resolves after every prerequisite is validated and rewritten.
|
|
41
|
+
*/
|
|
42
|
+
export declare function validateLandingPagePrerequisites(connection: RequestConnection, workspaceId: string, proposal: PlannedLandingPageCopies, options?: JsonRequestOptions): Promise<void>;
|
|
43
|
+
export {};
|