@contentful/experiences-validators 1.42.1-beta.0 → 1.42.2-beta.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
@@ -519,6 +519,19 @@ declare const ParameterDefinitionSchema: z.ZodObject<{
519
519
  linkType: "ContentType";
520
520
  };
521
521
  }>>;
522
+ passToNodes: z.ZodOptional<z.ZodArray<z.ZodObject<{
523
+ nodeId: z.ZodString;
524
+ parameterId: z.ZodString;
525
+ prebindingId: z.ZodString;
526
+ }, "strict", z.ZodTypeAny, {
527
+ parameterId: string;
528
+ nodeId: string;
529
+ prebindingId: string;
530
+ }, {
531
+ parameterId: string;
532
+ nodeId: string;
533
+ prebindingId: string;
534
+ }>, "many">>;
522
535
  }, "strip", z.ZodTypeAny, {
523
536
  contentTypes: Record<string, {
524
537
  sys: {
@@ -538,6 +551,11 @@ declare const ParameterDefinitionSchema: z.ZodObject<{
538
551
  };
539
552
  };
540
553
  } | undefined;
554
+ passToNodes?: {
555
+ parameterId: string;
556
+ nodeId: string;
557
+ prebindingId: string;
558
+ }[] | undefined;
541
559
  }, {
542
560
  contentTypes: Record<string, {
543
561
  sys: {
@@ -557,6 +575,11 @@ declare const ParameterDefinitionSchema: z.ZodObject<{
557
575
  };
558
576
  };
559
577
  } | undefined;
578
+ passToNodes?: {
579
+ parameterId: string;
580
+ nodeId: string;
581
+ prebindingId: string;
582
+ }[] | undefined;
560
583
  }>;
561
584
  declare const ComponentSettingsSchema: z.ZodObject<{
562
585
  variableDefinitions: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -719,148 +742,245 @@ declare const ComponentSettingsSchema: z.ZodObject<{
719
742
  }>>;
720
743
  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
744
  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;
727
- }, "strip", z.ZodTypeAny, {
728
- path: string;
729
- }, {
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<{
745
+ prebindingDefinitions: z.ZodOptional<z.ZodArray<z.ZodObject<{
746
+ id: z.ZodString;
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
+ passToNodes: z.ZodOptional<z.ZodArray<z.ZodObject<{
827
+ nodeId: z.ZodString;
828
+ parameterId: z.ZodString;
829
+ prebindingId: z.ZodString;
830
+ }, "strict", z.ZodTypeAny, {
831
+ parameterId: string;
832
+ nodeId: string;
833
+ prebindingId: string;
834
+ }, {
835
+ parameterId: string;
836
+ nodeId: string;
837
+ prebindingId: string;
838
+ }>, "many">>;
839
+ }, "strip", z.ZodTypeAny, {
840
+ contentTypes: Record<string, {
780
841
  sys: {
781
842
  type: "Link";
782
843
  id: string;
783
- linkType: "Entry";
844
+ linkType: "ContentType";
784
845
  };
785
- };
846
+ }>;
847
+ defaultSource?: {
848
+ type: "Entry";
849
+ contentTypeId: string;
850
+ link: {
851
+ sys: {
852
+ type: "Link";
853
+ id: string;
854
+ linkType: "Entry";
855
+ };
856
+ };
857
+ } | undefined;
858
+ passToNodes?: {
859
+ parameterId: string;
860
+ nodeId: string;
861
+ prebindingId: string;
862
+ }[] | undefined;
786
863
  }, {
787
- type: "Entry";
788
- contentTypeId: string;
789
- link: {
864
+ contentTypes: Record<string, {
790
865
  sys: {
791
866
  type: "Link";
792
867
  id: string;
793
- linkType: "Entry";
868
+ linkType: "ContentType";
794
869
  };
795
- };
870
+ }>;
871
+ defaultSource?: {
872
+ type: "Entry";
873
+ contentTypeId: string;
874
+ link: {
875
+ sys: {
876
+ type: "Link";
877
+ id: string;
878
+ linkType: "Entry";
879
+ };
880
+ };
881
+ } | undefined;
882
+ passToNodes?: {
883
+ parameterId: string;
884
+ nodeId: string;
885
+ prebindingId: string;
886
+ }[] | undefined;
796
887
  }>>;
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"]>;
888
+ variableMappings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
889
+ parameterId: z.ZodString;
890
+ type: z.ZodLiteral<"ContentTypeMapping">;
891
+ pathsByContentType: z.ZodRecord<z.ZodString, z.ZodObject<{
892
+ path: z.ZodString;
802
893
  }, "strip", z.ZodTypeAny, {
803
- type: "Link";
804
- id: string;
805
- linkType: "ContentType";
894
+ path: string;
806
895
  }, {
807
- type: "Link";
808
- id: string;
809
- linkType: "ContentType";
810
- }>;
896
+ path: string;
897
+ }>>;
811
898
  }, "strip", z.ZodTypeAny, {
812
- sys: {
813
- type: "Link";
814
- id: string;
815
- linkType: "ContentType";
816
- };
899
+ type: "ContentTypeMapping";
900
+ parameterId: string;
901
+ pathsByContentType: Record<string, {
902
+ path: string;
903
+ }>;
817
904
  }, {
818
- sys: {
819
- type: "Link";
820
- id: string;
821
- linkType: "ContentType";
822
- };
823
- }>>;
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: {
905
+ type: "ContentTypeMapping";
906
+ parameterId: string;
907
+ pathsByContentType: Record<string, {
908
+ path: string;
909
+ }>;
910
+ }>>>;
911
+ allowedVariableOverrides: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
912
+ }, "strict", z.ZodTypeAny, {
913
+ id: string;
914
+ parameterDefinitions: Record<string, {
915
+ contentTypes: Record<string, {
836
916
  sys: {
837
917
  type: "Link";
838
918
  id: string;
839
- linkType: "Entry";
919
+ linkType: "ContentType";
840
920
  };
841
- };
842
- } | undefined;
843
- }, {
844
- contentTypes: Record<string, {
845
- sys: {
846
- type: "Link";
847
- id: string;
848
- linkType: "ContentType";
849
- };
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
+ passToNodes?: {
934
+ parameterId: string;
935
+ nodeId: string;
936
+ prebindingId: string;
937
+ }[] | undefined;
850
938
  }>;
851
- defaultSource?: {
852
- type: "Entry";
853
- contentTypeId: string;
854
- link: {
939
+ variableMappings?: Record<string, {
940
+ type: "ContentTypeMapping";
941
+ parameterId: string;
942
+ pathsByContentType: Record<string, {
943
+ path: string;
944
+ }>;
945
+ }> | undefined;
946
+ allowedVariableOverrides?: string[] | undefined;
947
+ }, {
948
+ id: string;
949
+ parameterDefinitions: Record<string, {
950
+ contentTypes: Record<string, {
855
951
  sys: {
856
952
  type: "Link";
857
953
  id: string;
858
- linkType: "Entry";
954
+ linkType: "ContentType";
859
955
  };
860
- };
861
- } | undefined;
862
- }>>>;
863
- }, "strip", z.ZodTypeAny, {
956
+ }>;
957
+ defaultSource?: {
958
+ type: "Entry";
959
+ contentTypeId: string;
960
+ link: {
961
+ sys: {
962
+ type: "Link";
963
+ id: string;
964
+ linkType: "Entry";
965
+ };
966
+ };
967
+ } | undefined;
968
+ passToNodes?: {
969
+ parameterId: string;
970
+ nodeId: string;
971
+ prebindingId: string;
972
+ }[] | undefined;
973
+ }>;
974
+ variableMappings?: Record<string, {
975
+ type: "ContentTypeMapping";
976
+ parameterId: string;
977
+ pathsByContentType: Record<string, {
978
+ path: string;
979
+ }>;
980
+ }> | undefined;
981
+ allowedVariableOverrides?: string[] | undefined;
982
+ }>, "many">>;
983
+ }, "strict", z.ZodTypeAny, {
864
984
  variableDefinitions: Record<string, {
865
985
  type: "Text" | "RichText" | "Number" | "Date" | "Boolean" | "Location" | "Media" | "Object" | "Hyperlink" | "Array" | "Link";
866
986
  displayName?: string | undefined;
@@ -897,33 +1017,42 @@ declare const ComponentSettingsSchema: z.ZodObject<{
897
1017
  }>;
898
1018
  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
1019
  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: {
1020
+ prebindingDefinitions?: {
1021
+ id: string;
1022
+ parameterDefinitions: Record<string, {
1023
+ contentTypes: Record<string, {
919
1024
  sys: {
920
1025
  type: "Link";
921
1026
  id: string;
922
- linkType: "Entry";
1027
+ linkType: "ContentType";
923
1028
  };
924
- };
925
- } | undefined;
926
- }> | undefined;
1029
+ }>;
1030
+ defaultSource?: {
1031
+ type: "Entry";
1032
+ contentTypeId: string;
1033
+ link: {
1034
+ sys: {
1035
+ type: "Link";
1036
+ id: string;
1037
+ linkType: "Entry";
1038
+ };
1039
+ };
1040
+ } | undefined;
1041
+ passToNodes?: {
1042
+ parameterId: string;
1043
+ nodeId: string;
1044
+ prebindingId: string;
1045
+ }[] | undefined;
1046
+ }>;
1047
+ variableMappings?: Record<string, {
1048
+ type: "ContentTypeMapping";
1049
+ parameterId: string;
1050
+ pathsByContentType: Record<string, {
1051
+ path: string;
1052
+ }>;
1053
+ }> | undefined;
1054
+ allowedVariableOverrides?: string[] | undefined;
1055
+ }[] | undefined;
927
1056
  }, {
928
1057
  variableDefinitions: Record<string, {
929
1058
  type: "Text" | "RichText" | "Number" | "Date" | "Boolean" | "Location" | "Media" | "Object" | "Hyperlink" | "Array" | "Link";
@@ -961,33 +1090,42 @@ declare const ComponentSettingsSchema: z.ZodObject<{
961
1090
  }>;
962
1091
  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
1092
  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: {
1093
+ prebindingDefinitions?: {
1094
+ id: string;
1095
+ parameterDefinitions: Record<string, {
1096
+ contentTypes: Record<string, {
983
1097
  sys: {
984
1098
  type: "Link";
985
1099
  id: string;
986
- linkType: "Entry";
1100
+ linkType: "ContentType";
987
1101
  };
988
- };
989
- } | undefined;
990
- }> | undefined;
1102
+ }>;
1103
+ defaultSource?: {
1104
+ type: "Entry";
1105
+ contentTypeId: string;
1106
+ link: {
1107
+ sys: {
1108
+ type: "Link";
1109
+ id: string;
1110
+ linkType: "Entry";
1111
+ };
1112
+ };
1113
+ } | undefined;
1114
+ passToNodes?: {
1115
+ parameterId: string;
1116
+ nodeId: string;
1117
+ prebindingId: string;
1118
+ }[] | undefined;
1119
+ }>;
1120
+ variableMappings?: Record<string, {
1121
+ type: "ContentTypeMapping";
1122
+ parameterId: string;
1123
+ pathsByContentType: Record<string, {
1124
+ path: string;
1125
+ }>;
1126
+ }> | undefined;
1127
+ allowedVariableOverrides?: string[] | undefined;
1128
+ }[] | undefined;
991
1129
  }>;
992
1130
  declare const PatternFieldsCMAShapeSchema: z.ZodObject<{
993
1131
  componentTree: z.ZodRecord<z.ZodString, z.ZodTypeAny>;
package/dist/index.js CHANGED
@@ -242,8 +242,13 @@ const VariableMappingSchema = z.object({
242
242
  type: z.literal('ContentTypeMapping'),
243
243
  pathsByContentType: z.record(z.string(), z.object({ path: z.string() })),
244
244
  });
245
- // TODO: finalize schema structure before release
246
- // https://contentful.atlassian.net/browse/LUMOS-523
245
+ const PassToNodeSchema = z
246
+ .object({
247
+ nodeId: propertyKeySchema,
248
+ parameterId: propertyKeySchema,
249
+ prebindingId: propertyKeySchema,
250
+ })
251
+ .strict();
247
252
  const ParameterDefinitionSchema = z.object({
248
253
  defaultSource: z
249
254
  .strictObject({
@@ -265,18 +270,28 @@ const ParameterDefinitionSchema = z.object({
265
270
  linkType: z.enum(['ContentType']),
266
271
  }),
267
272
  })),
273
+ passToNodes: z.array(PassToNodeSchema).optional(),
268
274
  });
269
275
  const ParameterDefinitionsSchema = z.record(propertyKeySchema, ParameterDefinitionSchema);
270
276
  const VariableMappingsSchema = z.record(propertyKeySchema, VariableMappingSchema);
271
277
  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
278
  ComponentVariableSchema);
273
- const ComponentSettingsSchema = z.object({
279
+ const PrebindingDefinitionSchema = z
280
+ .object({
281
+ id: propertyKeySchema,
282
+ parameterDefinitions: ParameterDefinitionsSchema,
283
+ variableMappings: VariableMappingsSchema.optional(),
284
+ allowedVariableOverrides: z.array(z.string()).optional(),
285
+ })
286
+ .strict();
287
+ const ComponentSettingsSchema = z
288
+ .object({
274
289
  variableDefinitions: ComponentVariablesSchema,
275
290
  thumbnailId: z.enum(THUMBNAIL_IDS).optional(),
276
291
  category: z.string().max(50, 'Category must contain at most 50 characters').optional(),
277
- variableMappings: VariableMappingsSchema.optional(),
278
- parameterDefinitions: ParameterDefinitionsSchema.optional(),
279
- });
292
+ prebindingDefinitions: z.array(PrebindingDefinitionSchema).max(1).optional(),
293
+ })
294
+ .strict();
280
295
  const PatternFieldsCMAShapeSchema = z.object({
281
296
  componentTree: localeWrapper(ComponentTreeSchema),
282
297
  dataSource: localeWrapper(DataSourceSchema),