@contentful/experiences-validators 1.42.0-prerelease-20250627T1335-d74dad7.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
@@ -719,148 +719,232 @@ declare const ComponentSettingsSchema: z.ZodObject<{
719
719
  }>>;
720
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"]>>;
721
721
  category: z.ZodOptional<z.ZodString>;
722
- variableMappings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
723
- parameterId: z.ZodString;
724
- type: z.ZodLiteral<"ContentTypeMapping">;
725
- pathsByContentType: z.ZodRecord<z.ZodString, z.ZodObject<{
726
- path: z.ZodString;
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;
729
+ }, "strip", z.ZodTypeAny, {
730
+ path: string;
731
+ }, {
732
+ path: string;
733
+ }>>;
727
734
  }, "strip", z.ZodTypeAny, {
728
- path: string;
735
+ type: "ContentTypeMapping";
736
+ parameterId: string;
737
+ pathsByContentType: Record<string, {
738
+ path: string;
739
+ }>;
729
740
  }, {
730
- path: string;
731
- }>>;
732
- }, "strip", z.ZodTypeAny, {
733
- type: "ContentTypeMapping";
734
- parameterId: string;
735
- pathsByContentType: Record<string, {
736
- path: string;
737
- }>;
738
- }, {
739
- type: "ContentTypeMapping";
740
- parameterId: string;
741
- pathsByContentType: Record<string, {
742
- path: string;
743
- }>;
744
- }>>>;
745
- parameterDefinitions: 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<{
741
+ type: "ContentTypeMapping";
742
+ parameterId: string;
743
+ pathsByContentType: Record<string, {
744
+ path: string;
745
+ }>;
746
+ }>>>;
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<{
750
800
  sys: z.ZodObject<{
751
801
  type: z.ZodLiteral<"Link">;
752
802
  id: z.ZodString;
753
- linkType: z.ZodEnum<["Entry"]>;
754
- }, "strict", z.ZodTypeAny, {
803
+ linkType: z.ZodEnum<["ContentType"]>;
804
+ }, "strip", z.ZodTypeAny, {
755
805
  type: "Link";
756
806
  id: string;
757
- linkType: "Entry";
807
+ linkType: "ContentType";
758
808
  }, {
759
809
  type: "Link";
760
810
  id: string;
761
- linkType: "Entry";
811
+ linkType: "ContentType";
762
812
  }>;
763
- }, "strict", z.ZodTypeAny, {
813
+ }, "strip", z.ZodTypeAny, {
764
814
  sys: {
765
815
  type: "Link";
766
816
  id: string;
767
- linkType: "Entry";
817
+ linkType: "ContentType";
768
818
  };
769
819
  }, {
770
820
  sys: {
771
821
  type: "Link";
772
822
  id: string;
773
- linkType: "Entry";
823
+ linkType: "ContentType";
774
824
  };
775
- }>;
776
- }, "strict", z.ZodTypeAny, {
777
- type: "Entry";
778
- contentTypeId: string;
779
- link: {
825
+ }>>;
826
+ }, "strip", z.ZodTypeAny, {
827
+ contentTypes: Record<string, {
780
828
  sys: {
781
829
  type: "Link";
782
830
  id: string;
783
- linkType: "Entry";
831
+ linkType: "ContentType";
784
832
  };
785
- };
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;
786
845
  }, {
787
- type: "Entry";
788
- contentTypeId: string;
789
- link: {
846
+ contentTypes: Record<string, {
790
847
  sys: {
791
848
  type: "Link";
792
849
  id: string;
793
- linkType: "Entry";
850
+ linkType: "ContentType";
794
851
  };
795
- };
796
- }>>;
797
- contentTypes: z.ZodRecord<z.ZodString, z.ZodObject<{
798
- sys: z.ZodObject<{
799
- type: z.ZodLiteral<"Link">;
800
- id: z.ZodString;
801
- linkType: z.ZodEnum<["ContentType"]>;
802
- }, "strip", z.ZodTypeAny, {
803
- type: "Link";
804
- id: string;
805
- linkType: "ContentType";
806
- }, {
807
- type: "Link";
808
- id: string;
809
- linkType: "ContentType";
810
852
  }>;
811
- }, "strip", z.ZodTypeAny, {
812
- sys: {
813
- type: "Link";
814
- id: string;
815
- linkType: "ContentType";
816
- };
817
- }, {
818
- sys: {
819
- type: "Link";
820
- id: string;
821
- linkType: "ContentType";
822
- };
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;
823
864
  }>>;
824
- }, "strip", z.ZodTypeAny, {
825
- contentTypes: Record<string, {
826
- sys: {
827
- type: "Link";
828
- id: string;
829
- linkType: "ContentType";
830
- };
831
- }>;
832
- defaultSource?: {
833
- type: "Entry";
834
- contentTypeId: string;
835
- link: {
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, {
836
882
  sys: {
837
883
  type: "Link";
838
884
  id: string;
839
- linkType: "Entry";
885
+ linkType: "ContentType";
840
886
  };
841
- };
842
- } | undefined;
843
- }, {
844
- contentTypes: Record<string, {
845
- sys: {
846
- type: "Link";
847
- id: string;
848
- linkType: "ContentType";
849
- };
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;
850
899
  }>;
851
- defaultSource?: {
852
- type: "Entry";
853
- contentTypeId: string;
854
- link: {
900
+ variableMappings?: Record<string, {
901
+ type: "ContentTypeMapping";
902
+ parameterId: string;
903
+ pathsByContentType: Record<string, {
904
+ path: string;
905
+ }>;
906
+ }> | undefined;
907
+ passToNodes?: {
908
+ parameterId: string;
909
+ nodeId: string;
910
+ prebindingId: string;
911
+ }[] | undefined;
912
+ }, {
913
+ id: string;
914
+ parameterDefinitions: Record<string, {
915
+ contentTypes: Record<string, {
855
916
  sys: {
856
917
  type: "Link";
857
918
  id: string;
858
- linkType: "Entry";
919
+ linkType: "ContentType";
859
920
  };
860
- };
861
- } | undefined;
862
- }>>>;
863
- }, "strip", z.ZodTypeAny, {
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;
933
+ }>;
934
+ variableMappings?: Record<string, {
935
+ type: "ContentTypeMapping";
936
+ parameterId: string;
937
+ pathsByContentType: Record<string, {
938
+ path: string;
939
+ }>;
940
+ }> | undefined;
941
+ passToNodes?: {
942
+ parameterId: string;
943
+ nodeId: string;
944
+ prebindingId: string;
945
+ }[] | undefined;
946
+ }>, "many">>;
947
+ }, "strict", z.ZodTypeAny, {
864
948
  variableDefinitions: Record<string, {
865
949
  type: "Text" | "RichText" | "Number" | "Date" | "Boolean" | "Location" | "Media" | "Object" | "Hyperlink" | "Array" | "Link";
866
950
  displayName?: string | undefined;
@@ -897,33 +981,41 @@ declare const ComponentSettingsSchema: z.ZodObject<{
897
981
  }>;
898
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;
899
983
  category?: string | undefined;
900
- variableMappings?: Record<string, {
901
- type: "ContentTypeMapping";
902
- parameterId: string;
903
- pathsByContentType: Record<string, {
904
- path: string;
905
- }>;
906
- }> | undefined;
907
- parameterDefinitions?: Record<string, {
908
- contentTypes: Record<string, {
909
- sys: {
910
- type: "Link";
911
- id: string;
912
- linkType: "ContentType";
913
- };
914
- }>;
915
- defaultSource?: {
916
- type: "Entry";
917
- contentTypeId: string;
918
- link: {
984
+ prebindingDefinitions?: {
985
+ id: string;
986
+ parameterDefinitions: Record<string, {
987
+ contentTypes: Record<string, {
919
988
  sys: {
920
989
  type: "Link";
921
990
  id: string;
922
- linkType: "Entry";
991
+ linkType: "ContentType";
923
992
  };
924
- };
925
- } | undefined;
926
- }> | undefined;
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;
1005
+ }>;
1006
+ variableMappings?: Record<string, {
1007
+ type: "ContentTypeMapping";
1008
+ parameterId: string;
1009
+ pathsByContentType: Record<string, {
1010
+ path: string;
1011
+ }>;
1012
+ }> | undefined;
1013
+ passToNodes?: {
1014
+ parameterId: string;
1015
+ nodeId: string;
1016
+ prebindingId: string;
1017
+ }[] | undefined;
1018
+ }[] | undefined;
927
1019
  }, {
928
1020
  variableDefinitions: Record<string, {
929
1021
  type: "Text" | "RichText" | "Number" | "Date" | "Boolean" | "Location" | "Media" | "Object" | "Hyperlink" | "Array" | "Link";
@@ -961,33 +1053,41 @@ declare const ComponentSettingsSchema: z.ZodObject<{
961
1053
  }>;
962
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;
963
1055
  category?: string | undefined;
964
- variableMappings?: Record<string, {
965
- type: "ContentTypeMapping";
966
- parameterId: string;
967
- pathsByContentType: Record<string, {
968
- path: string;
969
- }>;
970
- }> | undefined;
971
- parameterDefinitions?: Record<string, {
972
- contentTypes: Record<string, {
973
- sys: {
974
- type: "Link";
975
- id: string;
976
- linkType: "ContentType";
977
- };
978
- }>;
979
- defaultSource?: {
980
- type: "Entry";
981
- contentTypeId: string;
982
- link: {
1056
+ prebindingDefinitions?: {
1057
+ id: string;
1058
+ parameterDefinitions: Record<string, {
1059
+ contentTypes: Record<string, {
983
1060
  sys: {
984
1061
  type: "Link";
985
1062
  id: string;
986
- linkType: "Entry";
1063
+ linkType: "ContentType";
987
1064
  };
988
- };
989
- } | undefined;
990
- }> | undefined;
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;
1077
+ }>;
1078
+ variableMappings?: Record<string, {
1079
+ type: "ContentTypeMapping";
1080
+ parameterId: string;
1081
+ pathsByContentType: Record<string, {
1082
+ path: string;
1083
+ }>;
1084
+ }> | undefined;
1085
+ passToNodes?: {
1086
+ parameterId: string;
1087
+ nodeId: string;
1088
+ prebindingId: string;
1089
+ }[] | undefined;
1090
+ }[] | undefined;
991
1091
  }>;
992
1092
  declare const PatternFieldsCMAShapeSchema: z.ZodObject<{
993
1093
  componentTree: z.ZodRecord<z.ZodString, z.ZodTypeAny>;
package/dist/index.js CHANGED
@@ -270,13 +270,29 @@ const ParameterDefinitionsSchema = z.record(propertyKeySchema, ParameterDefiniti
270
270
  const VariableMappingsSchema = z.record(propertyKeySchema, VariableMappingSchema);
271
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
272
272
  ComponentVariableSchema);
273
- 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({
274
290
  variableDefinitions: ComponentVariablesSchema,
275
291
  thumbnailId: z.enum(THUMBNAIL_IDS).optional(),
276
292
  category: z.string().max(50, 'Category must contain at most 50 characters').optional(),
277
- variableMappings: VariableMappingsSchema.optional(),
278
- parameterDefinitions: ParameterDefinitionsSchema.optional(),
279
- });
293
+ prebindingDefinitions: z.array(PrebindingDefinitionSchema).optional(),
294
+ })
295
+ .strict();
280
296
  const PatternFieldsCMAShapeSchema = z.object({
281
297
  componentTree: localeWrapper(ComponentTreeSchema),
282
298
  dataSource: localeWrapper(DataSourceSchema),