@contentful/experiences-validators 3.7.0-prerelease-20250915T1724-8825648.0 → 3.7.0-prerelease-20250917T1034-42f0486.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/dist/index.cjs +17 -129
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -158
- package/dist/index.js +17 -129
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +3 -153
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -424,16 +424,12 @@ type Parameter = z.infer<typeof ParameterSchema>;
|
|
|
424
424
|
declare const VariableMappingSchema: z.ZodObject<{
|
|
425
425
|
parameterId: z.ZodString;
|
|
426
426
|
type: z.ZodLiteral<"ContentTypeMapping">;
|
|
427
|
-
pathsByContentType: z.
|
|
427
|
+
pathsByContentType: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
428
428
|
path: z.ZodString;
|
|
429
429
|
}, "strip", z.ZodTypeAny, {
|
|
430
430
|
path: string;
|
|
431
431
|
}, {
|
|
432
432
|
path: string;
|
|
433
|
-
}>>, Record<string, {
|
|
434
|
-
path: string;
|
|
435
|
-
}>, Record<string, {
|
|
436
|
-
path: string;
|
|
437
433
|
}>>;
|
|
438
434
|
}, "strip", z.ZodTypeAny, {
|
|
439
435
|
type: "ContentTypeMapping";
|
|
@@ -551,7 +547,7 @@ declare const ParameterDefinitionSchema: z.ZodObject<{
|
|
|
551
547
|
nodeId: string;
|
|
552
548
|
}[] | undefined;
|
|
553
549
|
}>;
|
|
554
|
-
declare const ComponentSettingsSchema: z.
|
|
550
|
+
declare const ComponentSettingsSchema: z.ZodObject<{
|
|
555
551
|
variableDefinitions: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
556
552
|
displayName: z.ZodOptional<z.ZodString>;
|
|
557
553
|
type: z.ZodEnum<["Text", "RichText", "Number", "Date", "Boolean", "Location", "Media", "Object", "Hyperlink", "Array", "Link"]>;
|
|
@@ -820,16 +816,12 @@ declare const ComponentSettingsSchema: z.ZodEffects<z.ZodObject<{
|
|
|
820
816
|
variableMappings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
821
817
|
parameterId: z.ZodString;
|
|
822
818
|
type: z.ZodLiteral<"ContentTypeMapping">;
|
|
823
|
-
pathsByContentType: z.
|
|
819
|
+
pathsByContentType: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
824
820
|
path: z.ZodString;
|
|
825
821
|
}, "strip", z.ZodTypeAny, {
|
|
826
822
|
path: string;
|
|
827
823
|
}, {
|
|
828
824
|
path: string;
|
|
829
|
-
}>>, Record<string, {
|
|
830
|
-
path: string;
|
|
831
|
-
}>, Record<string, {
|
|
832
|
-
path: string;
|
|
833
825
|
}>>;
|
|
834
826
|
}, "strip", z.ZodTypeAny, {
|
|
835
827
|
type: "ContentTypeMapping";
|
|
@@ -1038,142 +1030,8 @@ declare const ComponentSettingsSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1038
1030
|
}> | undefined;
|
|
1039
1031
|
allowedVariableOverrides?: string[] | undefined;
|
|
1040
1032
|
}[] | undefined;
|
|
1041
|
-
}>, {
|
|
1042
|
-
variableDefinitions: Record<string, {
|
|
1043
|
-
type: "Text" | "RichText" | "Number" | "Date" | "Boolean" | "Location" | "Media" | "Object" | "Hyperlink" | "Array" | "Link";
|
|
1044
|
-
displayName?: string | undefined;
|
|
1045
|
-
description?: string | undefined;
|
|
1046
|
-
group?: string | undefined;
|
|
1047
|
-
defaultValue?: string | number | boolean | Record<any, any> | {
|
|
1048
|
-
type: "DesignValue";
|
|
1049
|
-
valuesByBreakpoint: Record<string, string | number | boolean | Record<any, any> | undefined>;
|
|
1050
|
-
} | {
|
|
1051
|
-
path: string;
|
|
1052
|
-
type: "BoundValue";
|
|
1053
|
-
} | {
|
|
1054
|
-
type: "HyperlinkValue";
|
|
1055
|
-
linkTargetKey: string;
|
|
1056
|
-
overrides?: {} | undefined;
|
|
1057
|
-
} | {
|
|
1058
|
-
type: "UnboundValue";
|
|
1059
|
-
key: string;
|
|
1060
|
-
} | {
|
|
1061
|
-
type: "ComponentValue";
|
|
1062
|
-
key: string;
|
|
1063
|
-
} | {
|
|
1064
|
-
type: "NoValue";
|
|
1065
|
-
} | undefined;
|
|
1066
|
-
validations?: {
|
|
1067
|
-
required?: boolean | undefined;
|
|
1068
|
-
bindingSourceType?: ["entry" | "asset" | "manual" | "experience", ...("entry" | "asset" | "manual" | "experience")[]] | undefined;
|
|
1069
|
-
format?: "URL" | undefined;
|
|
1070
|
-
in?: {
|
|
1071
|
-
value: string | number;
|
|
1072
|
-
displayName?: string | undefined;
|
|
1073
|
-
}[] | undefined;
|
|
1074
|
-
} | undefined;
|
|
1075
|
-
}>;
|
|
1076
|
-
thumbnailId?: "columns" | "columnsPlusRight" | "imagesSquare" | "subtitles" | "rowsPlusBottom" | "userRectangle" | "textbox" | "monitorPlay" | "article" | "table" | "star" | "heartStraight" | "frameCorners" | "rows" | "dotsThreeOutline" | "listDashes" | "checkerBoard" | "gridFour" | "slideshow" | "diamondsFour" | "cards" | "textColumns" | "duplex" | undefined;
|
|
1077
|
-
category?: string | undefined;
|
|
1078
|
-
prebindingDefinitions?: {
|
|
1079
|
-
id: string;
|
|
1080
|
-
parameterDefinitions: Record<string, {
|
|
1081
|
-
contentTypes: string[];
|
|
1082
|
-
defaultSource?: {
|
|
1083
|
-
type: "Entry";
|
|
1084
|
-
contentTypeId: string;
|
|
1085
|
-
link: {
|
|
1086
|
-
sys: {
|
|
1087
|
-
type: "Link";
|
|
1088
|
-
id: string;
|
|
1089
|
-
linkType: "Entry";
|
|
1090
|
-
};
|
|
1091
|
-
};
|
|
1092
|
-
} | undefined;
|
|
1093
|
-
passToNodes?: {
|
|
1094
|
-
prebindingId: string;
|
|
1095
|
-
parameterId: string;
|
|
1096
|
-
nodeId: string;
|
|
1097
|
-
}[] | undefined;
|
|
1098
|
-
}>;
|
|
1099
|
-
variableMappings?: Record<string, {
|
|
1100
|
-
type: "ContentTypeMapping";
|
|
1101
|
-
parameterId: string;
|
|
1102
|
-
pathsByContentType: Record<string, {
|
|
1103
|
-
path: string;
|
|
1104
|
-
}>;
|
|
1105
|
-
}> | undefined;
|
|
1106
|
-
allowedVariableOverrides?: string[] | undefined;
|
|
1107
|
-
}[] | undefined;
|
|
1108
|
-
}, {
|
|
1109
|
-
variableDefinitions: Record<string, {
|
|
1110
|
-
type: "Text" | "RichText" | "Number" | "Date" | "Boolean" | "Location" | "Media" | "Object" | "Hyperlink" | "Array" | "Link";
|
|
1111
|
-
displayName?: string | undefined;
|
|
1112
|
-
description?: string | undefined;
|
|
1113
|
-
group?: string | undefined;
|
|
1114
|
-
defaultValue?: string | number | boolean | Record<any, any> | {
|
|
1115
|
-
type: "DesignValue";
|
|
1116
|
-
valuesByBreakpoint: Record<string, string | number | boolean | Record<any, any> | undefined>;
|
|
1117
|
-
} | {
|
|
1118
|
-
path: string;
|
|
1119
|
-
type: "BoundValue";
|
|
1120
|
-
} | {
|
|
1121
|
-
type: "HyperlinkValue";
|
|
1122
|
-
linkTargetKey: string;
|
|
1123
|
-
overrides?: {} | undefined;
|
|
1124
|
-
} | {
|
|
1125
|
-
type: "UnboundValue";
|
|
1126
|
-
key: string;
|
|
1127
|
-
} | {
|
|
1128
|
-
type: "ComponentValue";
|
|
1129
|
-
key: string;
|
|
1130
|
-
} | {
|
|
1131
|
-
type: "NoValue";
|
|
1132
|
-
} | undefined;
|
|
1133
|
-
validations?: {
|
|
1134
|
-
required?: boolean | undefined;
|
|
1135
|
-
bindingSourceType?: ["entry" | "asset" | "manual" | "experience", ...("entry" | "asset" | "manual" | "experience")[]] | undefined;
|
|
1136
|
-
format?: "URL" | undefined;
|
|
1137
|
-
in?: {
|
|
1138
|
-
value: string | number;
|
|
1139
|
-
displayName?: string | undefined;
|
|
1140
|
-
}[] | undefined;
|
|
1141
|
-
} | undefined;
|
|
1142
|
-
}>;
|
|
1143
|
-
thumbnailId?: "columns" | "columnsPlusRight" | "imagesSquare" | "subtitles" | "rowsPlusBottom" | "userRectangle" | "textbox" | "monitorPlay" | "article" | "table" | "star" | "heartStraight" | "frameCorners" | "rows" | "dotsThreeOutline" | "listDashes" | "checkerBoard" | "gridFour" | "slideshow" | "diamondsFour" | "cards" | "textColumns" | "duplex" | undefined;
|
|
1144
|
-
category?: string | undefined;
|
|
1145
|
-
prebindingDefinitions?: {
|
|
1146
|
-
id: string;
|
|
1147
|
-
parameterDefinitions: Record<string, {
|
|
1148
|
-
contentTypes: string[];
|
|
1149
|
-
defaultSource?: {
|
|
1150
|
-
type: "Entry";
|
|
1151
|
-
contentTypeId: string;
|
|
1152
|
-
link: {
|
|
1153
|
-
sys: {
|
|
1154
|
-
type: "Link";
|
|
1155
|
-
id: string;
|
|
1156
|
-
linkType: "Entry";
|
|
1157
|
-
};
|
|
1158
|
-
};
|
|
1159
|
-
} | undefined;
|
|
1160
|
-
passToNodes?: {
|
|
1161
|
-
prebindingId: string;
|
|
1162
|
-
parameterId: string;
|
|
1163
|
-
nodeId: string;
|
|
1164
|
-
}[] | undefined;
|
|
1165
|
-
}>;
|
|
1166
|
-
variableMappings?: Record<string, {
|
|
1167
|
-
type: "ContentTypeMapping";
|
|
1168
|
-
parameterId: string;
|
|
1169
|
-
pathsByContentType: Record<string, {
|
|
1170
|
-
path: string;
|
|
1171
|
-
}>;
|
|
1172
|
-
}> | undefined;
|
|
1173
|
-
allowedVariableOverrides?: string[] | undefined;
|
|
1174
|
-
}[] | undefined;
|
|
1175
1033
|
}>;
|
|
1176
|
-
declare const PatternFieldsCMAShapeSchema: z.
|
|
1034
|
+
declare const PatternFieldsCMAShapeSchema: z.ZodObject<{
|
|
1177
1035
|
componentTree: z.ZodRecord<z.ZodString, z.ZodTypeAny>;
|
|
1178
1036
|
dataSource: z.ZodRecord<z.ZodString, z.ZodTypeAny>;
|
|
1179
1037
|
unboundValues: z.ZodRecord<z.ZodString, z.ZodTypeAny>;
|
|
@@ -1191,18 +1049,6 @@ declare const PatternFieldsCMAShapeSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1191
1049
|
unboundValues: Record<string, any>;
|
|
1192
1050
|
componentSettings: Record<string, any>;
|
|
1193
1051
|
usedComponents?: Record<string, any> | undefined;
|
|
1194
|
-
}>, {
|
|
1195
|
-
componentTree: Record<string, any>;
|
|
1196
|
-
dataSource: Record<string, any>;
|
|
1197
|
-
unboundValues: Record<string, any>;
|
|
1198
|
-
componentSettings: Record<string, any>;
|
|
1199
|
-
usedComponents?: Record<string, any> | undefined;
|
|
1200
|
-
}, {
|
|
1201
|
-
componentTree: Record<string, any>;
|
|
1202
|
-
dataSource: Record<string, any>;
|
|
1203
|
-
unboundValues: Record<string, any>;
|
|
1204
|
-
componentSettings: Record<string, any>;
|
|
1205
|
-
usedComponents?: Record<string, any> | undefined;
|
|
1206
1052
|
}>;
|
|
1207
1053
|
type PatternFields = z.infer<typeof PatternFieldsCMAShapeSchema>;
|
|
1208
1054
|
type ParameterDefinition = z.infer<typeof ParameterDefinitionSchema>;
|
package/dist/index.js
CHANGED
|
@@ -230,6 +230,19 @@ const ComponentVariableSchema = z.object({
|
|
|
230
230
|
});
|
|
231
231
|
const ComponentTreeNodeSchema = BaseComponentTreeNodeSchema.extend({
|
|
232
232
|
children: z.lazy(() => ComponentTreeNodeSchema.array()),
|
|
233
|
+
}).superRefine(({ id, prebindingId, parameters }, ctx) => {
|
|
234
|
+
if (prebindingId && !parameters) {
|
|
235
|
+
ctx.addIssue({
|
|
236
|
+
code: z.ZodIssueCode.custom,
|
|
237
|
+
message: `Found "prebindingId" but no "parameters" for node with id: "${id}"`,
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
if (parameters && !prebindingId) {
|
|
241
|
+
ctx.addIssue({
|
|
242
|
+
code: z.ZodIssueCode.custom,
|
|
243
|
+
message: `Found "parameters" but no "prebindingId" for node with id: "${id}"`,
|
|
244
|
+
});
|
|
245
|
+
}
|
|
233
246
|
});
|
|
234
247
|
const ComponentTreeSchema = z
|
|
235
248
|
.object({
|
|
@@ -247,25 +260,6 @@ const ExperienceFieldsCMAShapeSchema = z.object({
|
|
|
247
260
|
usedComponents: localeWrapper(UsedComponentsSchema).optional(),
|
|
248
261
|
});
|
|
249
262
|
|
|
250
|
-
function treeVisit(initialNode, onNode) {
|
|
251
|
-
const _treeVisit = (currentNode) => {
|
|
252
|
-
const children = [...currentNode.children];
|
|
253
|
-
onNode(currentNode);
|
|
254
|
-
for (const child of children) {
|
|
255
|
-
_treeVisit(child);
|
|
256
|
-
}
|
|
257
|
-
};
|
|
258
|
-
if (Array.isArray(initialNode)) {
|
|
259
|
-
for (const node of initialNode) {
|
|
260
|
-
_treeVisit(node);
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
else {
|
|
264
|
-
_treeVisit(initialNode);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
const MAX_ALLOWED_PATHS = 200;
|
|
269
263
|
const THUMBNAIL_IDS = [
|
|
270
264
|
'columns',
|
|
271
265
|
'columnsPlusRight',
|
|
@@ -296,17 +290,7 @@ const THUMBNAIL_IDS = [
|
|
|
296
290
|
const VariableMappingSchema = z.object({
|
|
297
291
|
parameterId: propertyKeySchema,
|
|
298
292
|
type: z.literal('ContentTypeMapping'),
|
|
299
|
-
pathsByContentType: z
|
|
300
|
-
.record(z.string(), z.object({ path: z.string() }))
|
|
301
|
-
.superRefine((paths, ctx) => {
|
|
302
|
-
const variableId = ctx.path[ctx.path.length - 2];
|
|
303
|
-
if (Object.keys(paths).length > MAX_ALLOWED_PATHS) {
|
|
304
|
-
ctx.addIssue({
|
|
305
|
-
code: z.ZodIssueCode.custom,
|
|
306
|
-
message: `Too many paths defined for variable mapping with id "${variableId}", maximum allowed is ${MAX_ALLOWED_PATHS}`,
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
}),
|
|
293
|
+
pathsByContentType: z.record(z.string(), z.object({ path: z.string() })),
|
|
310
294
|
});
|
|
311
295
|
const PassToNodeSchema = z
|
|
312
296
|
.object({
|
|
@@ -330,10 +314,7 @@ const ParameterDefinitionSchema = z.object({
|
|
|
330
314
|
})
|
|
331
315
|
.optional(),
|
|
332
316
|
contentTypes: z.array(z.string()).min(1),
|
|
333
|
-
passToNodes: z
|
|
334
|
-
.array(PassToNodeSchema)
|
|
335
|
-
.max(1, 'At most one "passToNodes" element is allowed per parameter definition.')
|
|
336
|
-
.optional(), // we might change this to be empty array for native parameter definitions, that's why we don't use .length(1)
|
|
317
|
+
passToNodes: z.array(PassToNodeSchema).optional(),
|
|
337
318
|
});
|
|
338
319
|
const ParameterDefinitionsSchema = z.record(propertyKeySchema, ParameterDefinitionSchema);
|
|
339
320
|
const VariableMappingsSchema = z.record(propertyKeySchema, VariableMappingSchema);
|
|
@@ -354,107 +335,14 @@ const ComponentSettingsSchema = z
|
|
|
354
335
|
category: z.string().max(50, 'Category must contain at most 50 characters').optional(),
|
|
355
336
|
prebindingDefinitions: z.array(PrebindingDefinitionSchema).length(1).optional(),
|
|
356
337
|
})
|
|
357
|
-
.strict()
|
|
358
|
-
|
|
359
|
-
const { variableDefinitions, prebindingDefinitions } = componentSettings;
|
|
360
|
-
if (!prebindingDefinitions || prebindingDefinitions.length === 0) {
|
|
361
|
-
return;
|
|
362
|
-
}
|
|
363
|
-
const { parameterDefinitions, variableMappings, allowedVariableOverrides } = prebindingDefinitions[0];
|
|
364
|
-
validateAtMostOneNativeParameterDefinition(parameterDefinitions, ctx);
|
|
365
|
-
validateNoOverlapBetweenMappingAndOverrides(variableMappings, allowedVariableOverrides, ctx);
|
|
366
|
-
validateMappingsAgainstVariableDefinitions(variableMappings, allowedVariableOverrides, variableDefinitions, ctx);
|
|
367
|
-
validateMappingsAgainstParameterDefinitions(variableMappings, parameterDefinitions, ctx);
|
|
368
|
-
});
|
|
369
|
-
const PatternFieldsCMAShapeSchema = z
|
|
370
|
-
.object({
|
|
338
|
+
.strict();
|
|
339
|
+
const PatternFieldsCMAShapeSchema = z.object({
|
|
371
340
|
componentTree: localeWrapper(ComponentTreeSchema),
|
|
372
341
|
dataSource: localeWrapper(DataSourceSchema),
|
|
373
342
|
unboundValues: localeWrapper(UnboundValuesSchema),
|
|
374
343
|
usedComponents: localeWrapper(UsedComponentsSchema).optional(),
|
|
375
344
|
componentSettings: localeWrapper(ComponentSettingsSchema),
|
|
376
|
-
})
|
|
377
|
-
.superRefine((patternFields, ctx) => {
|
|
378
|
-
const { componentTree, componentSettings } = patternFields;
|
|
379
|
-
// values at this point are wrapped under locale code
|
|
380
|
-
const nonLocalisedComponentTree = Object.values(componentTree)[0];
|
|
381
|
-
const nonLocalisedComponentSettings = Object.values(componentSettings)[0];
|
|
382
|
-
if (!nonLocalisedComponentSettings || !nonLocalisedComponentTree) {
|
|
383
|
-
return;
|
|
384
|
-
}
|
|
385
|
-
validatePassToNodes(nonLocalisedComponentTree.children || [], nonLocalisedComponentSettings || {}, ctx);
|
|
386
345
|
});
|
|
387
|
-
const validateAtMostOneNativeParameterDefinition = (parameterDefinitions, ctx) => {
|
|
388
|
-
const nativeParamDefinitions = Object.values(parameterDefinitions).filter((paramDefinition) => !(paramDefinition.passToNodes && paramDefinition.passToNodes.length > 0));
|
|
389
|
-
if (nativeParamDefinitions.length > 1) {
|
|
390
|
-
ctx.addIssue({
|
|
391
|
-
code: z.ZodIssueCode.custom,
|
|
392
|
-
message: `Only one native parameter definition (parameter definition without passToNodes) is allowed per prebinding definition.`,
|
|
393
|
-
});
|
|
394
|
-
}
|
|
395
|
-
};
|
|
396
|
-
const validateNoOverlapBetweenMappingAndOverrides = (variableMappings, allowedVariableOverrides, ctx) => {
|
|
397
|
-
const variableMappingKeys = Object.keys(variableMappings || {});
|
|
398
|
-
const overlap = variableMappingKeys.filter((key) => allowedVariableOverrides?.includes(key));
|
|
399
|
-
if (overlap.length > 0) {
|
|
400
|
-
ctx.addIssue({
|
|
401
|
-
code: z.ZodIssueCode.custom,
|
|
402
|
-
message: `Found both variable mapping and allowed override for the following keys: ${overlap.map((key) => `"${key}"`).join(', ')}.`,
|
|
403
|
-
});
|
|
404
|
-
}
|
|
405
|
-
};
|
|
406
|
-
const validateMappingsAgainstVariableDefinitions = (variableMappings, allowedVariableOverrides, variableDefinitions, ctx) => {
|
|
407
|
-
const nonDesignVariableDefinitionKeys = Object.entries(variableDefinitions)
|
|
408
|
-
.filter(([_, def]) => def.group !== 'style')
|
|
409
|
-
.map(([key]) => key);
|
|
410
|
-
const variableMappingKeys = Object.keys(variableMappings || {});
|
|
411
|
-
const allKeys = [...variableMappingKeys, ...(allowedVariableOverrides || [])];
|
|
412
|
-
const invalidMappings = allKeys.filter((key) => !nonDesignVariableDefinitionKeys.includes(key));
|
|
413
|
-
if (invalidMappings.length > 0) {
|
|
414
|
-
ctx.addIssue({
|
|
415
|
-
code: z.ZodIssueCode.custom,
|
|
416
|
-
message: `The following variable mappings or overrides are missing from the variable definitions: ${invalidMappings.map((key) => `"${key}"`).join(', ')}.`,
|
|
417
|
-
});
|
|
418
|
-
}
|
|
419
|
-
};
|
|
420
|
-
const validateMappingsAgainstParameterDefinitions = (variableMappings, parameterDefinitions, ctx) => {
|
|
421
|
-
const parameterDefinitionKeys = Object.keys(parameterDefinitions || {});
|
|
422
|
-
for (const [mappingKey, mappingValue] of Object.entries(variableMappings || {})) {
|
|
423
|
-
if (!parameterDefinitionKeys.includes(mappingValue.parameterId)) {
|
|
424
|
-
ctx.addIssue({
|
|
425
|
-
code: z.ZodIssueCode.custom,
|
|
426
|
-
message: `The variable mapping with id "${mappingKey}" references a non-existing parameterId "${mappingValue.parameterId}".`,
|
|
427
|
-
});
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
};
|
|
431
|
-
const validatePassToNodes = (rootChildren, componentSettings, ctx) => {
|
|
432
|
-
if (!componentSettings.prebindingDefinitions ||
|
|
433
|
-
componentSettings.prebindingDefinitions.length === 0) {
|
|
434
|
-
return;
|
|
435
|
-
}
|
|
436
|
-
const { parameterDefinitions } = componentSettings.prebindingDefinitions[0];
|
|
437
|
-
let nodeIds = new Set();
|
|
438
|
-
for (const paramDef of Object.values(parameterDefinitions || {})) {
|
|
439
|
-
paramDef.passToNodes?.forEach((n) => nodeIds.add(n.nodeId));
|
|
440
|
-
}
|
|
441
|
-
treeVisit(rootChildren, (node) => {
|
|
442
|
-
if (!node.id)
|
|
443
|
-
return;
|
|
444
|
-
if (nodeIds.has(node.id)) {
|
|
445
|
-
nodeIds.delete(node.id);
|
|
446
|
-
}
|
|
447
|
-
});
|
|
448
|
-
if (nodeIds.size > 0) {
|
|
449
|
-
const stringifiedNodeIds = Array.from(nodeIds)
|
|
450
|
-
.map((id) => `"${id}"`)
|
|
451
|
-
.join(', ');
|
|
452
|
-
ctx.addIssue({
|
|
453
|
-
code: z.ZodIssueCode.custom,
|
|
454
|
-
message: `The following node IDs referenced in passToNodes are not present in the component tree: ${stringifiedNodeIds}.`,
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
};
|
|
458
346
|
|
|
459
347
|
const ComponentDefinitionSchema = z
|
|
460
348
|
.object({
|