@contentful/experiences-validators 1.42.0-prerelease-20250620T1900-059481b.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.cjs +18 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +171 -99
- package/dist/index.js +18 -14
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +100 -60
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -169,7 +169,7 @@ declare const ComponentPropertyValueSchema: z.ZodDiscriminatedUnion<"type", [z.Z
|
|
|
169
169
|
type: "NoValue";
|
|
170
170
|
}>]>;
|
|
171
171
|
type ComponentPropertyValue = z.infer<typeof ComponentPropertyValueSchema>;
|
|
172
|
-
declare const
|
|
172
|
+
declare const PatternPropertySchema: z.ZodObject<{
|
|
173
173
|
type: z.ZodLiteral<"BoundValue">;
|
|
174
174
|
path: z.ZodString;
|
|
175
175
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -259,7 +259,7 @@ declare const BaseComponentTreeNodeSchema: z.ZodObject<{
|
|
|
259
259
|
}, {
|
|
260
260
|
type: "NoValue";
|
|
261
261
|
}>]>>;
|
|
262
|
-
|
|
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
|
-
|
|
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
|
-
|
|
324
|
+
patternProperties?: Record<string, {
|
|
325
325
|
path: string;
|
|
326
326
|
type: "BoundValue";
|
|
327
327
|
}> | undefined;
|
|
@@ -415,10 +415,10 @@ type NoValue = z.infer<typeof NoValueSchema>;
|
|
|
415
415
|
type UnboundValue = z.infer<typeof UnboundValueSchema>;
|
|
416
416
|
type ComponentValue = z.infer<typeof ComponentValueSchema>;
|
|
417
417
|
type BindingSourceTypeEnum = z.infer<typeof BindingSourceTypeEnumSchema>;
|
|
418
|
-
type
|
|
418
|
+
type PatternProperty = z.infer<typeof PatternPropertySchema>;
|
|
419
419
|
|
|
420
420
|
declare const VariableMappingSchema: z.ZodObject<{
|
|
421
|
-
|
|
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
|
-
|
|
432
|
+
patternPropertyDefinitionId: string;
|
|
433
433
|
pathsByContentType: Record<string, {
|
|
434
434
|
path: string;
|
|
435
435
|
}>;
|
|
436
436
|
}, {
|
|
437
437
|
type: "ContentTypeMapping";
|
|
438
|
-
|
|
438
|
+
patternPropertyDefinitionId: string;
|
|
439
439
|
pathsByContentType: Record<string, {
|
|
440
440
|
path: string;
|
|
441
441
|
}>;
|
|
442
442
|
}>;
|
|
443
|
-
declare const
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
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
|
-
|
|
455
|
-
|
|
456
|
-
|
|
468
|
+
sys: {
|
|
469
|
+
type: "Link";
|
|
470
|
+
id: string;
|
|
471
|
+
linkType: "Entry";
|
|
472
|
+
};
|
|
457
473
|
}>;
|
|
458
|
-
}, "
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
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
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
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
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
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
|
-
}
|
|
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
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
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
|
-
}
|
|
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
|
-
|
|
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
|
-
|
|
734
|
+
patternPropertyDefinitionId: string;
|
|
703
735
|
pathsByContentType: Record<string, {
|
|
704
736
|
path: string;
|
|
705
737
|
}>;
|
|
706
738
|
}, {
|
|
707
739
|
type: "ContentTypeMapping";
|
|
708
|
-
|
|
740
|
+
patternPropertyDefinitionId: string;
|
|
709
741
|
pathsByContentType: Record<string, {
|
|
710
742
|
path: string;
|
|
711
743
|
}>;
|
|
712
744
|
}>>>;
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
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
|
-
|
|
725
|
-
|
|
726
|
-
|
|
770
|
+
sys: {
|
|
771
|
+
type: "Link";
|
|
772
|
+
id: string;
|
|
773
|
+
linkType: "Entry";
|
|
774
|
+
};
|
|
727
775
|
}>;
|
|
728
|
-
}, "
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
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
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
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
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
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
|
-
}
|
|
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
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
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
|
-
}
|
|
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
|
-
|
|
902
|
+
patternPropertyDefinitionId: string;
|
|
839
903
|
pathsByContentType: Record<string, {
|
|
840
904
|
path: string;
|
|
841
905
|
}>;
|
|
842
906
|
}> | undefined;
|
|
843
|
-
|
|
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
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
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
|
-
}
|
|
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
|
-
|
|
966
|
+
patternPropertyDefinitionId: string;
|
|
899
967
|
pathsByContentType: Record<string, {
|
|
900
968
|
path: string;
|
|
901
969
|
}>;
|
|
902
970
|
}> | undefined;
|
|
903
|
-
|
|
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
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
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
|
-
}
|
|
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
|
|
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
|
|
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
|
@@ -148,11 +148,11 @@ const ComponentPropertyValueSchema = z.discriminatedUnion('type', [
|
|
|
148
148
|
]);
|
|
149
149
|
// TODO: finalize schema structure before release
|
|
150
150
|
// https://contentful.atlassian.net/browse/LUMOS-523
|
|
151
|
-
const
|
|
151
|
+
const PatternPropertySchema = z.object({
|
|
152
152
|
type: z.literal('BoundValue'),
|
|
153
153
|
path: z.string(),
|
|
154
154
|
});
|
|
155
|
-
const
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
248
|
-
|
|
249
|
-
.
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
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
|
|
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
|
-
|
|
278
|
+
patternPropertyDefinitions: PatternPropertyDefinitionsSchema.optional(),
|
|
275
279
|
});
|
|
276
280
|
const PatternFieldsCMAShapeSchema = z.object({
|
|
277
281
|
componentTree: localeWrapper(ComponentTreeSchema),
|