@contentful/experiences-validators 1.42.0-prerelease-20250625T0902-d9db401.0 → 1.42.0-prerelease-20250626T1154-6ca57b0.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.d.ts CHANGED
@@ -169,7 +169,7 @@ declare const ComponentPropertyValueSchema: z.ZodDiscriminatedUnion<"type", [z.Z
169
169
  type: "NoValue";
170
170
  }>]>;
171
171
  type ComponentPropertyValue = z.infer<typeof ComponentPropertyValueSchema>;
172
- declare const PatternPropertySchema: z.ZodObject<{
172
+ declare const ParameterSchema: z.ZodObject<{
173
173
  type: z.ZodLiteral<"BoundValue">;
174
174
  path: z.ZodString;
175
175
  }, "strip", z.ZodTypeAny, {
@@ -259,7 +259,7 @@ declare const BaseComponentTreeNodeSchema: z.ZodObject<{
259
259
  }, {
260
260
  type: "NoValue";
261
261
  }>]>>;
262
- patternProperties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
262
+ parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
263
263
  type: z.ZodLiteral<"BoundValue">;
264
264
  path: z.ZodString;
265
265
  }, "strip", z.ZodTypeAny, {
@@ -293,7 +293,7 @@ declare const BaseComponentTreeNodeSchema: z.ZodObject<{
293
293
  id?: string | undefined;
294
294
  displayName?: string | undefined;
295
295
  slotId?: string | undefined;
296
- patternProperties?: Record<string, {
296
+ parameters?: Record<string, {
297
297
  path: string;
298
298
  type: "BoundValue";
299
299
  }> | undefined;
@@ -321,7 +321,7 @@ declare const BaseComponentTreeNodeSchema: z.ZodObject<{
321
321
  id?: string | undefined;
322
322
  displayName?: string | undefined;
323
323
  slotId?: string | undefined;
324
- patternProperties?: Record<string, {
324
+ parameters?: Record<string, {
325
325
  path: string;
326
326
  type: "BoundValue";
327
327
  }> | undefined;
@@ -415,10 +415,10 @@ type NoValue = z.infer<typeof NoValueSchema>;
415
415
  type UnboundValue = z.infer<typeof UnboundValueSchema>;
416
416
  type ComponentValue = z.infer<typeof ComponentValueSchema>;
417
417
  type BindingSourceTypeEnum = z.infer<typeof BindingSourceTypeEnumSchema>;
418
- type PatternProperty = z.infer<typeof PatternPropertySchema>;
418
+ type Parameter = z.infer<typeof ParameterSchema>;
419
419
 
420
420
  declare const VariableMappingSchema: z.ZodObject<{
421
- patternPropertyDefinitionId: z.ZodString;
421
+ parameterId: z.ZodString;
422
422
  type: z.ZodLiteral<"ContentTypeMapping">;
423
423
  pathsByContentType: z.ZodRecord<z.ZodString, z.ZodObject<{
424
424
  path: z.ZodString;
@@ -429,69 +429,45 @@ declare const VariableMappingSchema: z.ZodObject<{
429
429
  }>>;
430
430
  }, "strip", z.ZodTypeAny, {
431
431
  type: "ContentTypeMapping";
432
- patternPropertyDefinitionId: string;
432
+ parameterId: string;
433
433
  pathsByContentType: Record<string, {
434
434
  path: string;
435
435
  }>;
436
436
  }, {
437
437
  type: "ContentTypeMapping";
438
- patternPropertyDefinitionId: string;
438
+ parameterId: string;
439
439
  pathsByContentType: Record<string, {
440
440
  path: string;
441
441
  }>;
442
442
  }>;
443
- declare const PatternPropertyDefinitionSchema: z.ZodObject<{
444
- defaultSource: z.ZodOptional<z.ZodObject<{
445
- type: z.ZodEnum<["Entry"]>;
446
- contentTypeId: z.ZodString;
447
- link: z.ZodObject<{
448
- sys: z.ZodObject<{
449
- type: z.ZodLiteral<"Link">;
450
- id: z.ZodString;
451
- linkType: z.ZodEnum<["Entry"]>;
452
- }, "strict", z.ZodTypeAny, {
453
- type: "Link";
454
- id: string;
455
- linkType: "Entry";
456
- }, {
457
- type: "Link";
458
- id: string;
459
- linkType: "Entry";
460
- }>;
461
- }, "strict", z.ZodTypeAny, {
462
- sys: {
463
- type: "Link";
464
- id: string;
465
- linkType: "Entry";
466
- };
443
+ declare const ParameterDefinitionSchema: z.ZodObject<{
444
+ defaultValue: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
445
+ sys: z.ZodObject<{
446
+ type: z.ZodLiteral<"Link">;
447
+ id: z.ZodString;
448
+ linkType: z.ZodEnum<["Entry"]>;
449
+ }, "strip", z.ZodTypeAny, {
450
+ type: "Link";
451
+ id: string;
452
+ linkType: "Entry";
467
453
  }, {
468
- sys: {
469
- type: "Link";
470
- id: string;
471
- linkType: "Entry";
472
- };
454
+ type: "Link";
455
+ id: string;
456
+ linkType: "Entry";
473
457
  }>;
474
- }, "strict", z.ZodTypeAny, {
475
- type: "Entry";
476
- contentTypeId: string;
477
- link: {
478
- sys: {
479
- type: "Link";
480
- id: string;
481
- linkType: "Entry";
482
- };
458
+ }, "strip", z.ZodTypeAny, {
459
+ sys: {
460
+ type: "Link";
461
+ id: string;
462
+ linkType: "Entry";
483
463
  };
484
464
  }, {
485
- type: "Entry";
486
- contentTypeId: string;
487
- link: {
488
- sys: {
489
- type: "Link";
490
- id: string;
491
- linkType: "Entry";
492
- };
465
+ sys: {
466
+ type: "Link";
467
+ id: string;
468
+ linkType: "Entry";
493
469
  };
494
- }>>;
470
+ }>>>;
495
471
  contentTypes: z.ZodRecord<z.ZodString, z.ZodObject<{
496
472
  sys: z.ZodObject<{
497
473
  type: z.ZodLiteral<"Link">;
@@ -527,17 +503,13 @@ declare const PatternPropertyDefinitionSchema: z.ZodObject<{
527
503
  linkType: "ContentType";
528
504
  };
529
505
  }>;
530
- defaultSource?: {
531
- type: "Entry";
532
- contentTypeId: string;
533
- link: {
534
- sys: {
535
- type: "Link";
536
- id: string;
537
- linkType: "Entry";
538
- };
506
+ defaultValue?: Record<string, {
507
+ sys: {
508
+ type: "Link";
509
+ id: string;
510
+ linkType: "Entry";
539
511
  };
540
- } | undefined;
512
+ }> | undefined;
541
513
  }, {
542
514
  contentTypes: Record<string, {
543
515
  sys: {
@@ -546,17 +518,13 @@ declare const PatternPropertyDefinitionSchema: z.ZodObject<{
546
518
  linkType: "ContentType";
547
519
  };
548
520
  }>;
549
- defaultSource?: {
550
- type: "Entry";
551
- contentTypeId: string;
552
- link: {
553
- sys: {
554
- type: "Link";
555
- id: string;
556
- linkType: "Entry";
557
- };
521
+ defaultValue?: Record<string, {
522
+ sys: {
523
+ type: "Link";
524
+ id: string;
525
+ linkType: "Entry";
558
526
  };
559
- } | undefined;
527
+ }> | undefined;
560
528
  }>;
561
529
  declare const ComponentSettingsSchema: z.ZodObject<{
562
530
  variableDefinitions: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -720,7 +688,7 @@ declare const ComponentSettingsSchema: z.ZodObject<{
720
688
  thumbnailId: z.ZodOptional<z.ZodEnum<["columns", "columnsPlusRight", "imagesSquare", "subtitles", "rowsPlusBottom", "userRectangle", "textbox", "monitorPlay", "article", "table", "star", "heartStraight", "frameCorners", "rows", "dotsThreeOutline", "listDashes", "checkerBoard", "gridFour", "slideshow", "diamondsFour", "cards", "textColumns", "duplex"]>>;
721
689
  category: z.ZodOptional<z.ZodString>;
722
690
  variableMappings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
723
- patternPropertyDefinitionId: z.ZodString;
691
+ parameterId: z.ZodString;
724
692
  type: z.ZodLiteral<"ContentTypeMapping">;
725
693
  pathsByContentType: z.ZodRecord<z.ZodString, z.ZodObject<{
726
694
  path: z.ZodString;
@@ -731,69 +699,45 @@ declare const ComponentSettingsSchema: z.ZodObject<{
731
699
  }>>;
732
700
  }, "strip", z.ZodTypeAny, {
733
701
  type: "ContentTypeMapping";
734
- patternPropertyDefinitionId: string;
702
+ parameterId: string;
735
703
  pathsByContentType: Record<string, {
736
704
  path: string;
737
705
  }>;
738
706
  }, {
739
707
  type: "ContentTypeMapping";
740
- patternPropertyDefinitionId: string;
708
+ parameterId: string;
741
709
  pathsByContentType: Record<string, {
742
710
  path: string;
743
711
  }>;
744
712
  }>>>;
745
- patternPropertyDefinitions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
746
- defaultSource: z.ZodOptional<z.ZodObject<{
747
- type: z.ZodEnum<["Entry"]>;
748
- contentTypeId: z.ZodString;
749
- link: z.ZodObject<{
750
- sys: z.ZodObject<{
751
- type: z.ZodLiteral<"Link">;
752
- id: z.ZodString;
753
- linkType: z.ZodEnum<["Entry"]>;
754
- }, "strict", z.ZodTypeAny, {
755
- type: "Link";
756
- id: string;
757
- linkType: "Entry";
758
- }, {
759
- type: "Link";
760
- id: string;
761
- linkType: "Entry";
762
- }>;
763
- }, "strict", z.ZodTypeAny, {
764
- sys: {
765
- type: "Link";
766
- id: string;
767
- linkType: "Entry";
768
- };
713
+ parameterDefinitions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
714
+ defaultValue: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
715
+ sys: z.ZodObject<{
716
+ type: z.ZodLiteral<"Link">;
717
+ id: z.ZodString;
718
+ linkType: z.ZodEnum<["Entry"]>;
719
+ }, "strip", z.ZodTypeAny, {
720
+ type: "Link";
721
+ id: string;
722
+ linkType: "Entry";
769
723
  }, {
770
- sys: {
771
- type: "Link";
772
- id: string;
773
- linkType: "Entry";
774
- };
724
+ type: "Link";
725
+ id: string;
726
+ linkType: "Entry";
775
727
  }>;
776
- }, "strict", z.ZodTypeAny, {
777
- type: "Entry";
778
- contentTypeId: string;
779
- link: {
780
- sys: {
781
- type: "Link";
782
- id: string;
783
- linkType: "Entry";
784
- };
728
+ }, "strip", z.ZodTypeAny, {
729
+ sys: {
730
+ type: "Link";
731
+ id: string;
732
+ linkType: "Entry";
785
733
  };
786
734
  }, {
787
- type: "Entry";
788
- contentTypeId: string;
789
- link: {
790
- sys: {
791
- type: "Link";
792
- id: string;
793
- linkType: "Entry";
794
- };
735
+ sys: {
736
+ type: "Link";
737
+ id: string;
738
+ linkType: "Entry";
795
739
  };
796
- }>>;
740
+ }>>>;
797
741
  contentTypes: z.ZodRecord<z.ZodString, z.ZodObject<{
798
742
  sys: z.ZodObject<{
799
743
  type: z.ZodLiteral<"Link">;
@@ -829,17 +773,13 @@ declare const ComponentSettingsSchema: z.ZodObject<{
829
773
  linkType: "ContentType";
830
774
  };
831
775
  }>;
832
- defaultSource?: {
833
- type: "Entry";
834
- contentTypeId: string;
835
- link: {
836
- sys: {
837
- type: "Link";
838
- id: string;
839
- linkType: "Entry";
840
- };
776
+ defaultValue?: Record<string, {
777
+ sys: {
778
+ type: "Link";
779
+ id: string;
780
+ linkType: "Entry";
841
781
  };
842
- } | undefined;
782
+ }> | undefined;
843
783
  }, {
844
784
  contentTypes: Record<string, {
845
785
  sys: {
@@ -848,17 +788,13 @@ declare const ComponentSettingsSchema: z.ZodObject<{
848
788
  linkType: "ContentType";
849
789
  };
850
790
  }>;
851
- defaultSource?: {
852
- type: "Entry";
853
- contentTypeId: string;
854
- link: {
855
- sys: {
856
- type: "Link";
857
- id: string;
858
- linkType: "Entry";
859
- };
791
+ defaultValue?: Record<string, {
792
+ sys: {
793
+ type: "Link";
794
+ id: string;
795
+ linkType: "Entry";
860
796
  };
861
- } | undefined;
797
+ }> | undefined;
862
798
  }>>>;
863
799
  }, "strip", z.ZodTypeAny, {
864
800
  variableDefinitions: Record<string, {
@@ -899,12 +835,12 @@ declare const ComponentSettingsSchema: z.ZodObject<{
899
835
  category?: string | undefined;
900
836
  variableMappings?: Record<string, {
901
837
  type: "ContentTypeMapping";
902
- patternPropertyDefinitionId: string;
838
+ parameterId: string;
903
839
  pathsByContentType: Record<string, {
904
840
  path: string;
905
841
  }>;
906
842
  }> | undefined;
907
- patternPropertyDefinitions?: Record<string, {
843
+ parameterDefinitions?: Record<string, {
908
844
  contentTypes: Record<string, {
909
845
  sys: {
910
846
  type: "Link";
@@ -912,17 +848,13 @@ declare const ComponentSettingsSchema: z.ZodObject<{
912
848
  linkType: "ContentType";
913
849
  };
914
850
  }>;
915
- defaultSource?: {
916
- type: "Entry";
917
- contentTypeId: string;
918
- link: {
919
- sys: {
920
- type: "Link";
921
- id: string;
922
- linkType: "Entry";
923
- };
851
+ defaultValue?: Record<string, {
852
+ sys: {
853
+ type: "Link";
854
+ id: string;
855
+ linkType: "Entry";
924
856
  };
925
- } | undefined;
857
+ }> | undefined;
926
858
  }> | undefined;
927
859
  }, {
928
860
  variableDefinitions: Record<string, {
@@ -963,12 +895,12 @@ declare const ComponentSettingsSchema: z.ZodObject<{
963
895
  category?: string | undefined;
964
896
  variableMappings?: Record<string, {
965
897
  type: "ContentTypeMapping";
966
- patternPropertyDefinitionId: string;
898
+ parameterId: string;
967
899
  pathsByContentType: Record<string, {
968
900
  path: string;
969
901
  }>;
970
902
  }> | undefined;
971
- patternPropertyDefinitions?: Record<string, {
903
+ parameterDefinitions?: Record<string, {
972
904
  contentTypes: Record<string, {
973
905
  sys: {
974
906
  type: "Link";
@@ -976,17 +908,13 @@ declare const ComponentSettingsSchema: z.ZodObject<{
976
908
  linkType: "ContentType";
977
909
  };
978
910
  }>;
979
- defaultSource?: {
980
- type: "Entry";
981
- contentTypeId: string;
982
- link: {
983
- sys: {
984
- type: "Link";
985
- id: string;
986
- linkType: "Entry";
987
- };
911
+ defaultValue?: Record<string, {
912
+ sys: {
913
+ type: "Link";
914
+ id: string;
915
+ linkType: "Entry";
988
916
  };
989
- } | undefined;
917
+ }> | undefined;
990
918
  }> | undefined;
991
919
  }>;
992
920
  declare const PatternFieldsCMAShapeSchema: z.ZodObject<{
@@ -1009,7 +937,7 @@ declare const PatternFieldsCMAShapeSchema: z.ZodObject<{
1009
937
  usedComponents?: Record<string, any> | undefined;
1010
938
  }>;
1011
939
  type PatternFields = z.infer<typeof PatternFieldsCMAShapeSchema>;
1012
- type PatternPropertyDefinition = z.infer<typeof PatternPropertyDefinitionSchema>;
940
+ type ParameterDefinition = z.infer<typeof ParameterDefinitionSchema>;
1013
941
  type VariableMapping = z.infer<typeof VariableMappingSchema>;
1014
942
  type PatternComponentSettings = z.infer<typeof ComponentSettingsSchema>;
1015
943
 
@@ -1250,4 +1178,4 @@ declare const validateExperienceFields: (experience: {
1250
1178
  fields: Record<string, any>;
1251
1179
  }, schemaVersionOverride?: SchemaVersions) => ValidatorReturnValue;
1252
1180
 
1253
- export { type BindingSourceTypeEnum, type BoundValue, type Breakpoint, type ComponentDefinitionPropertyType, ComponentDefinitionSchema, type ComponentPropertyValue, type ComponentTreeNode, type ComponentValue, type DesignValue, type PatternComponentSettings as ExperienceComponentSettings, type ExperienceComponentTree, type ExperienceDataSource, type ExperienceFields, ExperienceFieldsCMAShapeSchema as ExperienceSchema_2023_09_28, type ExperienceUnboundValues, type ExperienceUsedComponents, type NoValue, type PatternFields, type PatternProperty, type PatternPropertyDefinition, PatternFieldsCMAShapeSchema as PatternSchema_2023_09_28, type PrimitiveValue, SchemaVersions, type UnboundValue, type ValuesByBreakpoint, type VariableMapping, validateBreakpointsDefinition, validateComponentDefinition, validateExperienceFields };
1181
+ export { type BindingSourceTypeEnum, type BoundValue, type Breakpoint, type ComponentDefinitionPropertyType, ComponentDefinitionSchema, type ComponentPropertyValue, type ComponentTreeNode, type ComponentValue, type DesignValue, type PatternComponentSettings as ExperienceComponentSettings, type ExperienceComponentTree, type ExperienceDataSource, type ExperienceFields, ExperienceFieldsCMAShapeSchema as ExperienceSchema_2023_09_28, type ExperienceUnboundValues, type ExperienceUsedComponents, type NoValue, type Parameter, type ParameterDefinition, type PatternFields, PatternFieldsCMAShapeSchema as PatternSchema_2023_09_28, type PrimitiveValue, SchemaVersions, type UnboundValue, type ValuesByBreakpoint, type VariableMapping, validateBreakpointsDefinition, validateComponentDefinition, validateExperienceFields };
package/dist/index.js CHANGED
@@ -148,11 +148,11 @@ const ComponentPropertyValueSchema = z.discriminatedUnion('type', [
148
148
  ]);
149
149
  // TODO: finalize schema structure before release
150
150
  // https://contentful.atlassian.net/browse/LUMOS-523
151
- const PatternPropertySchema = z.object({
151
+ const ParameterSchema = z.object({
152
152
  type: z.literal('BoundValue'),
153
153
  path: z.string(),
154
154
  });
155
- const PatternPropertiesSchema = z.record(propertyKeySchema, PatternPropertySchema);
155
+ const ParametersSchema = z.record(propertyKeySchema, ParameterSchema);
156
156
  const BreakpointSchema = z
157
157
  .object({
158
158
  id: propertyKeySchema,
@@ -169,7 +169,7 @@ const BaseComponentTreeNodeSchema = z.object({
169
169
  displayName: z.string().optional(),
170
170
  slotId: z.string().optional(),
171
171
  variables: z.record(propertyKeySchema, ComponentPropertyValueSchema),
172
- patternProperties: PatternPropertiesSchema.optional(),
172
+ parameters: ParametersSchema.optional(),
173
173
  });
174
174
  const ComponentVariableSchema = z.object({
175
175
  displayName: z.string().optional(),
@@ -238,25 +238,21 @@ const THUMBNAIL_IDS = [
238
238
  // TODO: finalize schema structure before release
239
239
  // https://contentful.atlassian.net/browse/LUMOS-523
240
240
  const VariableMappingSchema = z.object({
241
- patternPropertyDefinitionId: propertyKeySchema,
241
+ parameterId: propertyKeySchema,
242
242
  type: z.literal('ContentTypeMapping'),
243
243
  pathsByContentType: z.record(z.string(), z.object({ path: z.string() })),
244
244
  });
245
245
  // TODO: finalize schema structure before release
246
246
  // https://contentful.atlassian.net/browse/LUMOS-523
247
- const PatternPropertyDefinitionSchema = z.object({
248
- defaultSource: z
249
- .strictObject({
250
- type: z.enum(['Entry']),
251
- contentTypeId: z.string(),
252
- link: z.strictObject({
253
- sys: z.strictObject({
254
- type: z.literal('Link'),
255
- id: z.string(),
256
- linkType: z.enum(['Entry']),
257
- }),
247
+ const ParameterDefinitionSchema = z.object({
248
+ defaultValue: z
249
+ .record(z.string(), z.object({
250
+ sys: z.object({
251
+ type: z.literal('Link'),
252
+ id: z.string(),
253
+ linkType: z.enum(['Entry']),
258
254
  }),
259
- })
255
+ }))
260
256
  .optional(),
261
257
  contentTypes: z.record(z.string(), z.object({
262
258
  sys: z.object({
@@ -266,7 +262,7 @@ const PatternPropertyDefinitionSchema = z.object({
266
262
  }),
267
263
  })),
268
264
  });
269
- const PatternPropertyDefinitionsSchema = z.record(propertyKeySchema, PatternPropertyDefinitionSchema);
265
+ const ParameterDefinitionsSchema = z.record(propertyKeySchema, ParameterDefinitionSchema);
270
266
  const VariableMappingsSchema = z.record(propertyKeySchema, VariableMappingSchema);
271
267
  const ComponentVariablesSchema = z.record(z.string().regex(/^[a-zA-Z0-9-_]{1,54}$/), // Here the key is <variableName>_<nanoidId> so we need to allow for a longer length
272
268
  ComponentVariableSchema);
@@ -275,7 +271,7 @@ const ComponentSettingsSchema = z.object({
275
271
  thumbnailId: z.enum(THUMBNAIL_IDS).optional(),
276
272
  category: z.string().max(50, 'Category must contain at most 50 characters').optional(),
277
273
  variableMappings: VariableMappingsSchema.optional(),
278
- patternPropertyDefinitions: PatternPropertyDefinitionsSchema.optional(),
274
+ parameterDefinitions: ParameterDefinitionsSchema.optional(),
279
275
  });
280
276
  const PatternFieldsCMAShapeSchema = z.object({
281
277
  componentTree: localeWrapper(ComponentTreeSchema),