@contentful/experiences-validators 1.42.0-prerelease-20250630T1135-a8b68d4.0 → 1.42.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,57 +441,33 @@ declare const VariableMappingSchema: z.ZodObject<{
441
441
  }>;
442
442
  }>;
443
443
  declare const ParameterDefinitionSchema: 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
- };
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 ParameterDefinitionSchema: 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 ParameterDefinitionSchema: 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<{
@@ -719,232 +687,116 @@ declare const ComponentSettingsSchema: z.ZodObject<{
719
687
  }>>;
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
- 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;
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"]>;
729
719
  }, "strip", z.ZodTypeAny, {
730
- path: string;
720
+ type: "Link";
721
+ id: string;
722
+ linkType: "Entry";
731
723
  }, {
732
- path: string;
733
- }>>;
734
- }, "strip", z.ZodTypeAny, {
735
- type: "ContentTypeMapping";
736
- parameterId: string;
737
- pathsByContentType: Record<string, {
738
- path: string;
724
+ type: "Link";
725
+ id: string;
726
+ linkType: "Entry";
739
727
  }>;
728
+ }, "strip", z.ZodTypeAny, {
729
+ sys: {
730
+ type: "Link";
731
+ id: string;
732
+ linkType: "Entry";
733
+ };
740
734
  }, {
741
- type: "ContentTypeMapping";
742
- parameterId: string;
743
- pathsByContentType: Record<string, {
744
- path: string;
745
- }>;
735
+ sys: {
736
+ type: "Link";
737
+ id: string;
738
+ linkType: "Entry";
739
+ };
746
740
  }>>>;
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
- }>;
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"]>;
813
746
  }, "strip", z.ZodTypeAny, {
814
- sys: {
815
- type: "Link";
816
- id: string;
817
- linkType: "ContentType";
818
- };
747
+ type: "Link";
748
+ id: string;
749
+ linkType: "ContentType";
819
750
  }, {
820
- sys: {
821
- type: "Link";
822
- id: string;
823
- linkType: "ContentType";
824
- };
825
- }>>;
826
- }, "strip", z.ZodTypeAny, {
827
- contentTypes: Record<string, {
828
- sys: {
829
- type: "Link";
830
- id: string;
831
- linkType: "ContentType";
832
- };
751
+ type: "Link";
752
+ id: string;
753
+ linkType: "ContentType";
833
754
  }>;
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;
755
+ }, "strip", z.ZodTypeAny, {
756
+ sys: {
757
+ type: "Link";
758
+ id: string;
759
+ linkType: "ContentType";
760
+ };
845
761
  }, {
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;
762
+ sys: {
763
+ type: "Link";
764
+ id: string;
765
+ linkType: "ContentType";
766
+ };
864
767
  }>>;
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;
768
+ }, "strip", z.ZodTypeAny, {
769
+ contentTypes: Record<string, {
770
+ sys: {
771
+ type: "Link";
772
+ id: string;
773
+ linkType: "ContentType";
774
+ };
899
775
  }>;
900
- variableMappings?: Record<string, {
901
- type: "ContentTypeMapping";
902
- parameterId: string;
903
- pathsByContentType: Record<string, {
904
- path: string;
905
- }>;
776
+ defaultValue?: Record<string, {
777
+ sys: {
778
+ type: "Link";
779
+ id: string;
780
+ linkType: "Entry";
781
+ };
906
782
  }> | undefined;
907
- passToNodes?: {
908
- parameterId: string;
909
- nodeId: string;
910
- prebindingId: string;
911
- }[] | undefined;
912
783
  }, {
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;
784
+ contentTypes: Record<string, {
785
+ sys: {
786
+ type: "Link";
787
+ id: string;
788
+ linkType: "ContentType";
789
+ };
933
790
  }>;
934
- variableMappings?: Record<string, {
935
- type: "ContentTypeMapping";
936
- parameterId: string;
937
- pathsByContentType: Record<string, {
938
- path: string;
939
- }>;
791
+ defaultValue?: Record<string, {
792
+ sys: {
793
+ type: "Link";
794
+ id: string;
795
+ linkType: "Entry";
796
+ };
940
797
  }> | undefined;
941
- passToNodes?: {
942
- parameterId: string;
943
- nodeId: string;
944
- prebindingId: string;
945
- }[] | undefined;
946
- }>, "many">>;
947
- }, "strict", z.ZodTypeAny, {
798
+ }>>>;
799
+ }, "strip", z.ZodTypeAny, {
948
800
  variableDefinitions: Record<string, {
949
801
  type: "Text" | "RichText" | "Number" | "Date" | "Boolean" | "Location" | "Media" | "Object" | "Hyperlink" | "Array" | "Link";
950
802
  displayName?: string | undefined;
@@ -981,41 +833,29 @@ declare const ComponentSettingsSchema: z.ZodObject<{
981
833
  }>;
982
834
  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;
983
835
  category?: string | undefined;
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;
836
+ variableMappings?: Record<string, {
837
+ type: "ContentTypeMapping";
838
+ parameterId: string;
839
+ pathsByContentType: Record<string, {
840
+ path: string;
1005
841
  }>;
1006
- variableMappings?: Record<string, {
1007
- type: "ContentTypeMapping";
1008
- parameterId: string;
1009
- pathsByContentType: Record<string, {
1010
- path: string;
1011
- }>;
842
+ }> | undefined;
843
+ parameterDefinitions?: Record<string, {
844
+ contentTypes: Record<string, {
845
+ sys: {
846
+ type: "Link";
847
+ id: string;
848
+ linkType: "ContentType";
849
+ };
850
+ }>;
851
+ defaultValue?: Record<string, {
852
+ sys: {
853
+ type: "Link";
854
+ id: string;
855
+ linkType: "Entry";
856
+ };
1012
857
  }> | undefined;
1013
- passToNodes?: {
1014
- parameterId: string;
1015
- nodeId: string;
1016
- prebindingId: string;
1017
- }[] | undefined;
1018
- }[] | undefined;
858
+ }> | undefined;
1019
859
  }, {
1020
860
  variableDefinitions: Record<string, {
1021
861
  type: "Text" | "RichText" | "Number" | "Date" | "Boolean" | "Location" | "Media" | "Object" | "Hyperlink" | "Array" | "Link";
@@ -1053,41 +893,29 @@ declare const ComponentSettingsSchema: z.ZodObject<{
1053
893
  }>;
1054
894
  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;
1055
895
  category?: string | undefined;
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;
896
+ variableMappings?: Record<string, {
897
+ type: "ContentTypeMapping";
898
+ parameterId: string;
899
+ pathsByContentType: Record<string, {
900
+ path: string;
1077
901
  }>;
1078
- variableMappings?: Record<string, {
1079
- type: "ContentTypeMapping";
1080
- parameterId: string;
1081
- pathsByContentType: Record<string, {
1082
- path: string;
1083
- }>;
902
+ }> | undefined;
903
+ parameterDefinitions?: Record<string, {
904
+ contentTypes: Record<string, {
905
+ sys: {
906
+ type: "Link";
907
+ id: string;
908
+ linkType: "ContentType";
909
+ };
910
+ }>;
911
+ defaultValue?: Record<string, {
912
+ sys: {
913
+ type: "Link";
914
+ id: string;
915
+ linkType: "Entry";
916
+ };
1084
917
  }> | undefined;
1085
- passToNodes?: {
1086
- parameterId: string;
1087
- nodeId: string;
1088
- prebindingId: string;
1089
- }[] | undefined;
1090
- }[] | undefined;
918
+ }> | undefined;
1091
919
  }>;
1092
920
  declare const PatternFieldsCMAShapeSchema: z.ZodObject<{
1093
921
  componentTree: z.ZodRecord<z.ZodString, z.ZodTypeAny>;
package/dist/index.js CHANGED
@@ -245,18 +245,14 @@ 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
- 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
- }),
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({
@@ -270,29 +266,13 @@ const ParameterDefinitionsSchema = z.record(propertyKeySchema, ParameterDefiniti
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);
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({
269
+ const ComponentSettingsSchema = z.object({
290
270
  variableDefinitions: ComponentVariablesSchema,
291
271
  thumbnailId: z.enum(THUMBNAIL_IDS).optional(),
292
272
  category: z.string().max(50, 'Category must contain at most 50 characters').optional(),
293
- prebindingDefinitions: z.array(PrebindingDefinitionSchema).optional(),
294
- })
295
- .strict();
273
+ variableMappings: VariableMappingsSchema.optional(),
274
+ parameterDefinitions: ParameterDefinitionsSchema.optional(),
275
+ });
296
276
  const PatternFieldsCMAShapeSchema = z.object({
297
277
  componentTree: localeWrapper(ComponentTreeSchema),
298
278
  dataSource: localeWrapper(DataSourceSchema),