@contentful/experiences-validators 1.42.0-prerelease-20250620T1340-2128bcf.0 → 1.42.0-prerelease-20250625T0902-d9db401.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
@@ -259,7 +259,7 @@ declare const BaseComponentTreeNodeSchema: z.ZodObject<{
259
259
  }, {
260
260
  type: "NoValue";
261
261
  }>]>>;
262
- parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
262
+ patternProperties: 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
- parameters?: Record<string, {
296
+ patternProperties?: 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
- parameters?: Record<string, {
324
+ patternProperties?: Record<string, {
325
325
  path: string;
326
326
  type: "BoundValue";
327
327
  }> | undefined;
@@ -418,7 +418,7 @@ type BindingSourceTypeEnum = z.infer<typeof BindingSourceTypeEnumSchema>;
418
418
  type PatternProperty = z.infer<typeof PatternPropertySchema>;
419
419
 
420
420
  declare const VariableMappingSchema: z.ZodObject<{
421
- parameterDefinitionId: z.ZodString;
421
+ patternPropertyDefinitionId: z.ZodString;
422
422
  type: z.ZodLiteral<"ContentTypeMapping">;
423
423
  pathsByContentType: z.ZodRecord<z.ZodString, z.ZodObject<{
424
424
  path: z.ZodString;
@@ -429,45 +429,69 @@ declare const VariableMappingSchema: z.ZodObject<{
429
429
  }>>;
430
430
  }, "strip", z.ZodTypeAny, {
431
431
  type: "ContentTypeMapping";
432
- parameterDefinitionId: string;
432
+ patternPropertyDefinitionId: string;
433
433
  pathsByContentType: Record<string, {
434
434
  path: string;
435
435
  }>;
436
436
  }, {
437
437
  type: "ContentTypeMapping";
438
- parameterDefinitionId: string;
438
+ patternPropertyDefinitionId: string;
439
439
  pathsByContentType: Record<string, {
440
440
  path: string;
441
441
  }>;
442
442
  }>;
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";
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
+ };
453
467
  }, {
454
- type: "Link";
455
- id: string;
456
- linkType: "Entry";
468
+ sys: {
469
+ type: "Link";
470
+ id: string;
471
+ linkType: "Entry";
472
+ };
457
473
  }>;
458
- }, "strip", z.ZodTypeAny, {
459
- sys: {
460
- type: "Link";
461
- id: string;
462
- linkType: "Entry";
474
+ }, "strict", z.ZodTypeAny, {
475
+ type: "Entry";
476
+ contentTypeId: string;
477
+ link: {
478
+ sys: {
479
+ type: "Link";
480
+ id: string;
481
+ linkType: "Entry";
482
+ };
463
483
  };
464
484
  }, {
465
- sys: {
466
- type: "Link";
467
- id: string;
468
- linkType: "Entry";
485
+ type: "Entry";
486
+ contentTypeId: string;
487
+ link: {
488
+ sys: {
489
+ type: "Link";
490
+ id: string;
491
+ linkType: "Entry";
492
+ };
469
493
  };
470
- }>>>;
494
+ }>>;
471
495
  contentTypes: z.ZodRecord<z.ZodString, z.ZodObject<{
472
496
  sys: z.ZodObject<{
473
497
  type: z.ZodLiteral<"Link">;
@@ -503,13 +527,17 @@ declare const ParameterDefinitionSchema: z.ZodObject<{
503
527
  linkType: "ContentType";
504
528
  };
505
529
  }>;
506
- defaultValue?: Record<string, {
507
- sys: {
508
- type: "Link";
509
- id: string;
510
- linkType: "Entry";
530
+ defaultSource?: {
531
+ type: "Entry";
532
+ contentTypeId: string;
533
+ link: {
534
+ sys: {
535
+ type: "Link";
536
+ id: string;
537
+ linkType: "Entry";
538
+ };
511
539
  };
512
- }> | undefined;
540
+ } | undefined;
513
541
  }, {
514
542
  contentTypes: Record<string, {
515
543
  sys: {
@@ -518,13 +546,17 @@ declare const ParameterDefinitionSchema: z.ZodObject<{
518
546
  linkType: "ContentType";
519
547
  };
520
548
  }>;
521
- defaultValue?: Record<string, {
522
- sys: {
523
- type: "Link";
524
- id: string;
525
- linkType: "Entry";
549
+ defaultSource?: {
550
+ type: "Entry";
551
+ contentTypeId: string;
552
+ link: {
553
+ sys: {
554
+ type: "Link";
555
+ id: string;
556
+ linkType: "Entry";
557
+ };
526
558
  };
527
- }> | undefined;
559
+ } | undefined;
528
560
  }>;
529
561
  declare const ComponentSettingsSchema: z.ZodObject<{
530
562
  variableDefinitions: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -688,7 +720,7 @@ declare const ComponentSettingsSchema: z.ZodObject<{
688
720
  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"]>>;
689
721
  category: z.ZodOptional<z.ZodString>;
690
722
  variableMappings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
691
- parameterDefinitionId: z.ZodString;
723
+ patternPropertyDefinitionId: z.ZodString;
692
724
  type: z.ZodLiteral<"ContentTypeMapping">;
693
725
  pathsByContentType: z.ZodRecord<z.ZodString, z.ZodObject<{
694
726
  path: z.ZodString;
@@ -699,45 +731,69 @@ declare const ComponentSettingsSchema: z.ZodObject<{
699
731
  }>>;
700
732
  }, "strip", z.ZodTypeAny, {
701
733
  type: "ContentTypeMapping";
702
- parameterDefinitionId: string;
734
+ patternPropertyDefinitionId: string;
703
735
  pathsByContentType: Record<string, {
704
736
  path: string;
705
737
  }>;
706
738
  }, {
707
739
  type: "ContentTypeMapping";
708
- parameterDefinitionId: string;
740
+ patternPropertyDefinitionId: string;
709
741
  pathsByContentType: Record<string, {
710
742
  path: string;
711
743
  }>;
712
744
  }>>>;
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";
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
+ };
723
769
  }, {
724
- type: "Link";
725
- id: string;
726
- linkType: "Entry";
770
+ sys: {
771
+ type: "Link";
772
+ id: string;
773
+ linkType: "Entry";
774
+ };
727
775
  }>;
728
- }, "strip", z.ZodTypeAny, {
729
- sys: {
730
- type: "Link";
731
- id: string;
732
- linkType: "Entry";
776
+ }, "strict", z.ZodTypeAny, {
777
+ type: "Entry";
778
+ contentTypeId: string;
779
+ link: {
780
+ sys: {
781
+ type: "Link";
782
+ id: string;
783
+ linkType: "Entry";
784
+ };
733
785
  };
734
786
  }, {
735
- sys: {
736
- type: "Link";
737
- id: string;
738
- linkType: "Entry";
787
+ type: "Entry";
788
+ contentTypeId: string;
789
+ link: {
790
+ sys: {
791
+ type: "Link";
792
+ id: string;
793
+ linkType: "Entry";
794
+ };
739
795
  };
740
- }>>>;
796
+ }>>;
741
797
  contentTypes: z.ZodRecord<z.ZodString, z.ZodObject<{
742
798
  sys: z.ZodObject<{
743
799
  type: z.ZodLiteral<"Link">;
@@ -773,13 +829,17 @@ declare const ComponentSettingsSchema: z.ZodObject<{
773
829
  linkType: "ContentType";
774
830
  };
775
831
  }>;
776
- defaultValue?: Record<string, {
777
- sys: {
778
- type: "Link";
779
- id: string;
780
- linkType: "Entry";
832
+ defaultSource?: {
833
+ type: "Entry";
834
+ contentTypeId: string;
835
+ link: {
836
+ sys: {
837
+ type: "Link";
838
+ id: string;
839
+ linkType: "Entry";
840
+ };
781
841
  };
782
- }> | undefined;
842
+ } | undefined;
783
843
  }, {
784
844
  contentTypes: Record<string, {
785
845
  sys: {
@@ -788,13 +848,17 @@ declare const ComponentSettingsSchema: z.ZodObject<{
788
848
  linkType: "ContentType";
789
849
  };
790
850
  }>;
791
- defaultValue?: Record<string, {
792
- sys: {
793
- type: "Link";
794
- id: string;
795
- linkType: "Entry";
851
+ defaultSource?: {
852
+ type: "Entry";
853
+ contentTypeId: string;
854
+ link: {
855
+ sys: {
856
+ type: "Link";
857
+ id: string;
858
+ linkType: "Entry";
859
+ };
796
860
  };
797
- }> | undefined;
861
+ } | undefined;
798
862
  }>>>;
799
863
  }, "strip", z.ZodTypeAny, {
800
864
  variableDefinitions: Record<string, {
@@ -835,12 +899,12 @@ declare const ComponentSettingsSchema: z.ZodObject<{
835
899
  category?: string | undefined;
836
900
  variableMappings?: Record<string, {
837
901
  type: "ContentTypeMapping";
838
- parameterDefinitionId: string;
902
+ patternPropertyDefinitionId: string;
839
903
  pathsByContentType: Record<string, {
840
904
  path: string;
841
905
  }>;
842
906
  }> | undefined;
843
- parameterDefinitions?: Record<string, {
907
+ patternPropertyDefinitions?: Record<string, {
844
908
  contentTypes: Record<string, {
845
909
  sys: {
846
910
  type: "Link";
@@ -848,13 +912,17 @@ declare const ComponentSettingsSchema: z.ZodObject<{
848
912
  linkType: "ContentType";
849
913
  };
850
914
  }>;
851
- defaultValue?: Record<string, {
852
- sys: {
853
- type: "Link";
854
- id: string;
855
- linkType: "Entry";
915
+ defaultSource?: {
916
+ type: "Entry";
917
+ contentTypeId: string;
918
+ link: {
919
+ sys: {
920
+ type: "Link";
921
+ id: string;
922
+ linkType: "Entry";
923
+ };
856
924
  };
857
- }> | undefined;
925
+ } | undefined;
858
926
  }> | undefined;
859
927
  }, {
860
928
  variableDefinitions: Record<string, {
@@ -895,12 +963,12 @@ declare const ComponentSettingsSchema: z.ZodObject<{
895
963
  category?: string | undefined;
896
964
  variableMappings?: Record<string, {
897
965
  type: "ContentTypeMapping";
898
- parameterDefinitionId: string;
966
+ patternPropertyDefinitionId: string;
899
967
  pathsByContentType: Record<string, {
900
968
  path: string;
901
969
  }>;
902
970
  }> | undefined;
903
- parameterDefinitions?: Record<string, {
971
+ patternPropertyDefinitions?: Record<string, {
904
972
  contentTypes: Record<string, {
905
973
  sys: {
906
974
  type: "Link";
@@ -908,13 +976,17 @@ declare const ComponentSettingsSchema: z.ZodObject<{
908
976
  linkType: "ContentType";
909
977
  };
910
978
  }>;
911
- defaultValue?: Record<string, {
912
- sys: {
913
- type: "Link";
914
- id: string;
915
- linkType: "Entry";
979
+ defaultSource?: {
980
+ type: "Entry";
981
+ contentTypeId: string;
982
+ link: {
983
+ sys: {
984
+ type: "Link";
985
+ id: string;
986
+ linkType: "Entry";
987
+ };
916
988
  };
917
- }> | undefined;
989
+ } | undefined;
918
990
  }> | undefined;
919
991
  }>;
920
992
  declare const PatternFieldsCMAShapeSchema: z.ZodObject<{
@@ -937,7 +1009,7 @@ declare const PatternFieldsCMAShapeSchema: z.ZodObject<{
937
1009
  usedComponents?: Record<string, any> | undefined;
938
1010
  }>;
939
1011
  type PatternFields = z.infer<typeof PatternFieldsCMAShapeSchema>;
940
- type ParameterDefinition = z.infer<typeof ParameterDefinitionSchema>;
1012
+ type PatternPropertyDefinition = z.infer<typeof PatternPropertyDefinitionSchema>;
941
1013
  type VariableMapping = z.infer<typeof VariableMappingSchema>;
942
1014
  type PatternComponentSettings = z.infer<typeof ComponentSettingsSchema>;
943
1015
 
@@ -1178,4 +1250,4 @@ declare const validateExperienceFields: (experience: {
1178
1250
  fields: Record<string, any>;
1179
1251
  }, schemaVersionOverride?: SchemaVersions) => ValidatorReturnValue;
1180
1252
 
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 ParameterDefinition, type PatternFields, type PatternProperty, PatternFieldsCMAShapeSchema as PatternSchema_2023_09_28, type PrimitiveValue, SchemaVersions, type UnboundValue, type ValuesByBreakpoint, type VariableMapping, validateBreakpointsDefinition, validateComponentDefinition, validateExperienceFields };
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 };
package/dist/index.js CHANGED
@@ -152,7 +152,7 @@ const PatternPropertySchema = z.object({
152
152
  type: z.literal('BoundValue'),
153
153
  path: z.string(),
154
154
  });
155
- const ParametersSchema = z.record(propertyKeySchema, PatternPropertySchema);
155
+ const PatternPropertiesSchema = z.record(propertyKeySchema, PatternPropertySchema);
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
- parameters: ParametersSchema.optional(),
172
+ patternProperties: PatternPropertiesSchema.optional(),
173
173
  });
174
174
  const ComponentVariableSchema = z.object({
175
175
  displayName: z.string().optional(),
@@ -238,21 +238,25 @@ 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
- parameterDefinitionId: propertyKeySchema,
241
+ patternPropertyDefinitionId: 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 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']),
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
+ }),
254
258
  }),
255
- }))
259
+ })
256
260
  .optional(),
257
261
  contentTypes: z.record(z.string(), z.object({
258
262
  sys: z.object({
@@ -262,7 +266,7 @@ const ParameterDefinitionSchema = z.object({
262
266
  }),
263
267
  })),
264
268
  });
265
- const ParameterDefinitionsSchema = z.record(propertyKeySchema, ParameterDefinitionSchema);
269
+ const PatternPropertyDefinitionsSchema = z.record(propertyKeySchema, PatternPropertyDefinitionSchema);
266
270
  const VariableMappingsSchema = z.record(propertyKeySchema, VariableMappingSchema);
267
271
  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
268
272
  ComponentVariableSchema);
@@ -271,7 +275,7 @@ const ComponentSettingsSchema = z.object({
271
275
  thumbnailId: z.enum(THUMBNAIL_IDS).optional(),
272
276
  category: z.string().max(50, 'Category must contain at most 50 characters').optional(),
273
277
  variableMappings: VariableMappingsSchema.optional(),
274
- parameterDefinitions: ParameterDefinitionsSchema.optional(),
278
+ patternPropertyDefinitions: PatternPropertyDefinitionsSchema.optional(),
275
279
  });
276
280
  const PatternFieldsCMAShapeSchema = z.object({
277
281
  componentTree: localeWrapper(ComponentTreeSchema),