@contentful/experiences-validators 1.42.0-prerelease-20250626T1154-6ca57b0.0 → 1.42.0-prerelease-20250630T1135-a8b68d4.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
@@ -441,33 +441,57 @@ declare const VariableMappingSchema: z.ZodObject<{
441
441
  }>;
442
442
  }>;
443
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";
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<{
@@ -687,116 +719,232 @@ declare const ComponentSettingsSchema: z.ZodObject<{
687
719
  }>>;
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
- variableMappings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
691
- parameterId: z.ZodString;
692
- type: z.ZodLiteral<"ContentTypeMapping">;
693
- pathsByContentType: z.ZodRecord<z.ZodString, z.ZodObject<{
694
- path: z.ZodString;
695
- }, "strip", z.ZodTypeAny, {
696
- path: string;
697
- }, {
698
- path: string;
699
- }>>;
700
- }, "strip", z.ZodTypeAny, {
701
- type: "ContentTypeMapping";
702
- parameterId: string;
703
- pathsByContentType: Record<string, {
704
- path: string;
705
- }>;
706
- }, {
707
- type: "ContentTypeMapping";
708
- parameterId: string;
709
- pathsByContentType: Record<string, {
710
- path: string;
711
- }>;
712
- }>>>;
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"]>;
722
+ prebindingDefinitions: z.ZodOptional<z.ZodArray<z.ZodObject<{
723
+ id: z.ZodString;
724
+ variableMappings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
725
+ parameterId: z.ZodString;
726
+ type: z.ZodLiteral<"ContentTypeMapping">;
727
+ pathsByContentType: z.ZodRecord<z.ZodString, z.ZodObject<{
728
+ path: z.ZodString;
719
729
  }, "strip", z.ZodTypeAny, {
720
- type: "Link";
721
- id: string;
722
- linkType: "Entry";
730
+ path: string;
723
731
  }, {
724
- type: "Link";
725
- id: string;
726
- linkType: "Entry";
727
- }>;
732
+ path: string;
733
+ }>>;
728
734
  }, "strip", z.ZodTypeAny, {
729
- sys: {
730
- type: "Link";
731
- id: string;
732
- linkType: "Entry";
733
- };
735
+ type: "ContentTypeMapping";
736
+ parameterId: string;
737
+ pathsByContentType: Record<string, {
738
+ path: string;
739
+ }>;
734
740
  }, {
735
- sys: {
736
- type: "Link";
737
- id: string;
738
- linkType: "Entry";
739
- };
741
+ type: "ContentTypeMapping";
742
+ parameterId: string;
743
+ pathsByContentType: Record<string, {
744
+ path: string;
745
+ }>;
740
746
  }>>>;
741
- contentTypes: z.ZodRecord<z.ZodString, z.ZodObject<{
742
- sys: z.ZodObject<{
743
- type: z.ZodLiteral<"Link">;
744
- id: z.ZodString;
745
- linkType: z.ZodEnum<["ContentType"]>;
747
+ parameterDefinitions: z.ZodRecord<z.ZodString, z.ZodObject<{
748
+ defaultSource: z.ZodOptional<z.ZodObject<{
749
+ type: z.ZodEnum<["Entry"]>;
750
+ contentTypeId: z.ZodString;
751
+ link: z.ZodObject<{
752
+ sys: z.ZodObject<{
753
+ type: z.ZodLiteral<"Link">;
754
+ id: z.ZodString;
755
+ linkType: z.ZodEnum<["Entry"]>;
756
+ }, "strict", z.ZodTypeAny, {
757
+ type: "Link";
758
+ id: string;
759
+ linkType: "Entry";
760
+ }, {
761
+ type: "Link";
762
+ id: string;
763
+ linkType: "Entry";
764
+ }>;
765
+ }, "strict", z.ZodTypeAny, {
766
+ sys: {
767
+ type: "Link";
768
+ id: string;
769
+ linkType: "Entry";
770
+ };
771
+ }, {
772
+ sys: {
773
+ type: "Link";
774
+ id: string;
775
+ linkType: "Entry";
776
+ };
777
+ }>;
778
+ }, "strict", z.ZodTypeAny, {
779
+ type: "Entry";
780
+ contentTypeId: string;
781
+ link: {
782
+ sys: {
783
+ type: "Link";
784
+ id: string;
785
+ linkType: "Entry";
786
+ };
787
+ };
788
+ }, {
789
+ type: "Entry";
790
+ contentTypeId: string;
791
+ link: {
792
+ sys: {
793
+ type: "Link";
794
+ id: string;
795
+ linkType: "Entry";
796
+ };
797
+ };
798
+ }>>;
799
+ contentTypes: z.ZodRecord<z.ZodString, z.ZodObject<{
800
+ sys: z.ZodObject<{
801
+ type: z.ZodLiteral<"Link">;
802
+ id: z.ZodString;
803
+ linkType: z.ZodEnum<["ContentType"]>;
804
+ }, "strip", z.ZodTypeAny, {
805
+ type: "Link";
806
+ id: string;
807
+ linkType: "ContentType";
808
+ }, {
809
+ type: "Link";
810
+ id: string;
811
+ linkType: "ContentType";
812
+ }>;
746
813
  }, "strip", z.ZodTypeAny, {
747
- type: "Link";
748
- id: string;
749
- linkType: "ContentType";
814
+ sys: {
815
+ type: "Link";
816
+ id: string;
817
+ linkType: "ContentType";
818
+ };
750
819
  }, {
751
- type: "Link";
752
- id: string;
753
- linkType: "ContentType";
754
- }>;
820
+ sys: {
821
+ type: "Link";
822
+ id: string;
823
+ linkType: "ContentType";
824
+ };
825
+ }>>;
755
826
  }, "strip", z.ZodTypeAny, {
756
- sys: {
757
- type: "Link";
758
- id: string;
759
- linkType: "ContentType";
760
- };
827
+ contentTypes: Record<string, {
828
+ sys: {
829
+ type: "Link";
830
+ id: string;
831
+ linkType: "ContentType";
832
+ };
833
+ }>;
834
+ defaultSource?: {
835
+ type: "Entry";
836
+ contentTypeId: string;
837
+ link: {
838
+ sys: {
839
+ type: "Link";
840
+ id: string;
841
+ linkType: "Entry";
842
+ };
843
+ };
844
+ } | undefined;
761
845
  }, {
762
- sys: {
763
- type: "Link";
764
- id: string;
765
- linkType: "ContentType";
766
- };
846
+ contentTypes: Record<string, {
847
+ sys: {
848
+ type: "Link";
849
+ id: string;
850
+ linkType: "ContentType";
851
+ };
852
+ }>;
853
+ defaultSource?: {
854
+ type: "Entry";
855
+ contentTypeId: string;
856
+ link: {
857
+ sys: {
858
+ type: "Link";
859
+ id: string;
860
+ linkType: "Entry";
861
+ };
862
+ };
863
+ } | undefined;
767
864
  }>>;
768
- }, "strip", z.ZodTypeAny, {
769
- contentTypes: Record<string, {
770
- sys: {
771
- type: "Link";
772
- id: string;
773
- linkType: "ContentType";
774
- };
865
+ passToNodes: z.ZodOptional<z.ZodArray<z.ZodObject<{
866
+ nodeId: z.ZodString;
867
+ parameterId: z.ZodString;
868
+ prebindingId: z.ZodString;
869
+ }, "strict", z.ZodTypeAny, {
870
+ parameterId: string;
871
+ nodeId: string;
872
+ prebindingId: string;
873
+ }, {
874
+ parameterId: string;
875
+ nodeId: string;
876
+ prebindingId: string;
877
+ }>, "many">>;
878
+ }, "strict", z.ZodTypeAny, {
879
+ id: string;
880
+ parameterDefinitions: Record<string, {
881
+ contentTypes: Record<string, {
882
+ sys: {
883
+ type: "Link";
884
+ id: string;
885
+ linkType: "ContentType";
886
+ };
887
+ }>;
888
+ defaultSource?: {
889
+ type: "Entry";
890
+ contentTypeId: string;
891
+ link: {
892
+ sys: {
893
+ type: "Link";
894
+ id: string;
895
+ linkType: "Entry";
896
+ };
897
+ };
898
+ } | undefined;
775
899
  }>;
776
- defaultValue?: Record<string, {
777
- sys: {
778
- type: "Link";
779
- id: string;
780
- linkType: "Entry";
781
- };
900
+ variableMappings?: Record<string, {
901
+ type: "ContentTypeMapping";
902
+ parameterId: string;
903
+ pathsByContentType: Record<string, {
904
+ path: string;
905
+ }>;
782
906
  }> | undefined;
907
+ passToNodes?: {
908
+ parameterId: string;
909
+ nodeId: string;
910
+ prebindingId: string;
911
+ }[] | undefined;
783
912
  }, {
784
- contentTypes: Record<string, {
785
- sys: {
786
- type: "Link";
787
- id: string;
788
- linkType: "ContentType";
789
- };
913
+ id: string;
914
+ parameterDefinitions: Record<string, {
915
+ contentTypes: Record<string, {
916
+ sys: {
917
+ type: "Link";
918
+ id: string;
919
+ linkType: "ContentType";
920
+ };
921
+ }>;
922
+ defaultSource?: {
923
+ type: "Entry";
924
+ contentTypeId: string;
925
+ link: {
926
+ sys: {
927
+ type: "Link";
928
+ id: string;
929
+ linkType: "Entry";
930
+ };
931
+ };
932
+ } | undefined;
790
933
  }>;
791
- defaultValue?: Record<string, {
792
- sys: {
793
- type: "Link";
794
- id: string;
795
- linkType: "Entry";
796
- };
934
+ variableMappings?: Record<string, {
935
+ type: "ContentTypeMapping";
936
+ parameterId: string;
937
+ pathsByContentType: Record<string, {
938
+ path: string;
939
+ }>;
797
940
  }> | undefined;
798
- }>>>;
799
- }, "strip", z.ZodTypeAny, {
941
+ passToNodes?: {
942
+ parameterId: string;
943
+ nodeId: string;
944
+ prebindingId: string;
945
+ }[] | undefined;
946
+ }>, "many">>;
947
+ }, "strict", z.ZodTypeAny, {
800
948
  variableDefinitions: Record<string, {
801
949
  type: "Text" | "RichText" | "Number" | "Date" | "Boolean" | "Location" | "Media" | "Object" | "Hyperlink" | "Array" | "Link";
802
950
  displayName?: string | undefined;
@@ -833,29 +981,41 @@ declare const ComponentSettingsSchema: z.ZodObject<{
833
981
  }>;
834
982
  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;
835
983
  category?: string | undefined;
836
- variableMappings?: Record<string, {
837
- type: "ContentTypeMapping";
838
- parameterId: string;
839
- pathsByContentType: Record<string, {
840
- path: string;
841
- }>;
842
- }> | undefined;
843
- parameterDefinitions?: Record<string, {
844
- contentTypes: Record<string, {
845
- sys: {
846
- type: "Link";
847
- id: string;
848
- linkType: "ContentType";
849
- };
984
+ prebindingDefinitions?: {
985
+ id: string;
986
+ parameterDefinitions: Record<string, {
987
+ contentTypes: Record<string, {
988
+ sys: {
989
+ type: "Link";
990
+ id: string;
991
+ linkType: "ContentType";
992
+ };
993
+ }>;
994
+ defaultSource?: {
995
+ type: "Entry";
996
+ contentTypeId: string;
997
+ link: {
998
+ sys: {
999
+ type: "Link";
1000
+ id: string;
1001
+ linkType: "Entry";
1002
+ };
1003
+ };
1004
+ } | undefined;
850
1005
  }>;
851
- defaultValue?: Record<string, {
852
- sys: {
853
- type: "Link";
854
- id: string;
855
- linkType: "Entry";
856
- };
1006
+ variableMappings?: Record<string, {
1007
+ type: "ContentTypeMapping";
1008
+ parameterId: string;
1009
+ pathsByContentType: Record<string, {
1010
+ path: string;
1011
+ }>;
857
1012
  }> | undefined;
858
- }> | undefined;
1013
+ passToNodes?: {
1014
+ parameterId: string;
1015
+ nodeId: string;
1016
+ prebindingId: string;
1017
+ }[] | undefined;
1018
+ }[] | undefined;
859
1019
  }, {
860
1020
  variableDefinitions: Record<string, {
861
1021
  type: "Text" | "RichText" | "Number" | "Date" | "Boolean" | "Location" | "Media" | "Object" | "Hyperlink" | "Array" | "Link";
@@ -893,29 +1053,41 @@ declare const ComponentSettingsSchema: z.ZodObject<{
893
1053
  }>;
894
1054
  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;
895
1055
  category?: string | undefined;
896
- variableMappings?: Record<string, {
897
- type: "ContentTypeMapping";
898
- parameterId: string;
899
- pathsByContentType: Record<string, {
900
- path: string;
901
- }>;
902
- }> | undefined;
903
- parameterDefinitions?: Record<string, {
904
- contentTypes: Record<string, {
905
- sys: {
906
- type: "Link";
907
- id: string;
908
- linkType: "ContentType";
909
- };
1056
+ prebindingDefinitions?: {
1057
+ id: string;
1058
+ parameterDefinitions: Record<string, {
1059
+ contentTypes: Record<string, {
1060
+ sys: {
1061
+ type: "Link";
1062
+ id: string;
1063
+ linkType: "ContentType";
1064
+ };
1065
+ }>;
1066
+ defaultSource?: {
1067
+ type: "Entry";
1068
+ contentTypeId: string;
1069
+ link: {
1070
+ sys: {
1071
+ type: "Link";
1072
+ id: string;
1073
+ linkType: "Entry";
1074
+ };
1075
+ };
1076
+ } | undefined;
910
1077
  }>;
911
- defaultValue?: Record<string, {
912
- sys: {
913
- type: "Link";
914
- id: string;
915
- linkType: "Entry";
916
- };
1078
+ variableMappings?: Record<string, {
1079
+ type: "ContentTypeMapping";
1080
+ parameterId: string;
1081
+ pathsByContentType: Record<string, {
1082
+ path: string;
1083
+ }>;
917
1084
  }> | undefined;
918
- }> | undefined;
1085
+ passToNodes?: {
1086
+ parameterId: string;
1087
+ nodeId: string;
1088
+ prebindingId: string;
1089
+ }[] | undefined;
1090
+ }[] | undefined;
919
1091
  }>;
920
1092
  declare const PatternFieldsCMAShapeSchema: z.ZodObject<{
921
1093
  componentTree: z.ZodRecord<z.ZodString, z.ZodTypeAny>;
package/dist/index.js CHANGED
@@ -245,14 +245,18 @@ const VariableMappingSchema = z.object({
245
245
  // TODO: finalize schema structure before release
246
246
  // https://contentful.atlassian.net/browse/LUMOS-523
247
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']),
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({
@@ -266,13 +270,29 @@ const ParameterDefinitionsSchema = z.record(propertyKeySchema, ParameterDefiniti
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);
269
- const ComponentSettingsSchema = z.object({
273
+ const PassToNodeSchema = z
274
+ .object({
275
+ nodeId: propertyKeySchema,
276
+ parameterId: propertyKeySchema,
277
+ prebindingId: propertyKeySchema,
278
+ })
279
+ .strict();
280
+ const PrebindingDefinitionSchema = z
281
+ .object({
282
+ id: propertyKeySchema,
283
+ variableMappings: VariableMappingsSchema.optional(),
284
+ parameterDefinitions: ParameterDefinitionsSchema,
285
+ passToNodes: z.array(PassToNodeSchema).optional(),
286
+ })
287
+ .strict();
288
+ const ComponentSettingsSchema = z
289
+ .object({
270
290
  variableDefinitions: ComponentVariablesSchema,
271
291
  thumbnailId: z.enum(THUMBNAIL_IDS).optional(),
272
292
  category: z.string().max(50, 'Category must contain at most 50 characters').optional(),
273
- variableMappings: VariableMappingsSchema.optional(),
274
- parameterDefinitions: ParameterDefinitionsSchema.optional(),
275
- });
293
+ prebindingDefinitions: z.array(PrebindingDefinitionSchema).optional(),
294
+ })
295
+ .strict();
276
296
  const PatternFieldsCMAShapeSchema = z.object({
277
297
  componentTree: localeWrapper(ComponentTreeSchema),
278
298
  dataSource: localeWrapper(DataSourceSchema),