@contentful/experiences-validators 0.0.1-alpha.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/LICENSE +21 -0
- package/README.md +3 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +149 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas/schemaVersions.d.ts +6 -0
- package/dist/schemas/v2023_09_28/experience.d.ts +408 -0
- package/dist/types.d.ts +2 -0
- package/package.json +44 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Contentful
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { Breakpoint, ComponentPropertyValue, ComponentTreeNode, ExperienceComponentSettings, ExperienceComponentTree, ExperienceDataSource, ExperienceFields, ExperienceUnboundValues, ExperienceUsedComponents, PrimitiveValue, ExperienceFieldsCMAShapeSchema as Schema_2023_09_28, ValuesByBreakpoint } from './schemas/v2023_09_28/experience.js';
|
|
2
|
+
export { SchemaVersions } from './schemas/schemaVersions.js';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
const SchemaVersions = z.union([
|
|
4
|
+
z.literal('2023-09-28'),
|
|
5
|
+
z.literal('2023-08-23'),
|
|
6
|
+
z.literal('2023-07-26'),
|
|
7
|
+
z.literal('2023-06-27'),
|
|
8
|
+
]);
|
|
9
|
+
|
|
10
|
+
const uuidKeySchema = z.string().regex(/^[a-zA-Z0-9-_]{1,21}$/);
|
|
11
|
+
const propertyKeySchema = z.string().regex(/^[a-zA-Z0-9-_]{1,32}$/);
|
|
12
|
+
const DataSourceSchema = z.record(uuidKeySchema, z.object({
|
|
13
|
+
sys: z.object({
|
|
14
|
+
type: z.literal('Link'),
|
|
15
|
+
id: z.string(),
|
|
16
|
+
linkType: z.literal('Entry').or(z.literal('Asset')),
|
|
17
|
+
}),
|
|
18
|
+
}));
|
|
19
|
+
const PrimitiveValueSchema = z.union([
|
|
20
|
+
z.string(),
|
|
21
|
+
z.boolean(),
|
|
22
|
+
z.number(),
|
|
23
|
+
z.record(z.any(), z.any()),
|
|
24
|
+
z.undefined(),
|
|
25
|
+
]);
|
|
26
|
+
const ComponentDefinitionPropertyTypeSchema = z.enum([
|
|
27
|
+
'Text',
|
|
28
|
+
'RichText',
|
|
29
|
+
'Number',
|
|
30
|
+
'Date',
|
|
31
|
+
'Boolean',
|
|
32
|
+
'Location',
|
|
33
|
+
'Media',
|
|
34
|
+
'Object',
|
|
35
|
+
]);
|
|
36
|
+
const ValuesByBreakpointSchema = z.record(z.lazy(() => PrimitiveValueSchema));
|
|
37
|
+
const ComponentPropertyValueSchema = z.union([
|
|
38
|
+
z.object({
|
|
39
|
+
type: z.literal('DesignValue'),
|
|
40
|
+
valuesByBreakpoint: ValuesByBreakpointSchema,
|
|
41
|
+
}),
|
|
42
|
+
z.object({
|
|
43
|
+
type: z.literal('BoundValue'),
|
|
44
|
+
path: z.string(),
|
|
45
|
+
}),
|
|
46
|
+
z.object({
|
|
47
|
+
type: z.literal('UnboundValue'),
|
|
48
|
+
key: z.string(),
|
|
49
|
+
}),
|
|
50
|
+
z.object({
|
|
51
|
+
type: z.literal('ComponentValue'),
|
|
52
|
+
key: z.string(),
|
|
53
|
+
}),
|
|
54
|
+
]);
|
|
55
|
+
const BreakpointSchema = z.object({
|
|
56
|
+
id: propertyKeySchema,
|
|
57
|
+
query: z.string().regex(/^\*$|^<[0-9*]+px$/),
|
|
58
|
+
previewSize: z.string(),
|
|
59
|
+
displayName: z.string(),
|
|
60
|
+
});
|
|
61
|
+
const UnboundValuesSchema = z.record(uuidKeySchema, z.object({
|
|
62
|
+
value: PrimitiveValueSchema,
|
|
63
|
+
}));
|
|
64
|
+
// Use helper schema to define a recursive schema with its type correctly below
|
|
65
|
+
const BaseComponentTreeNodeSchema = z.object({
|
|
66
|
+
definitionId: z.string(),
|
|
67
|
+
variables: z.record(propertyKeySchema, ComponentPropertyValueSchema),
|
|
68
|
+
});
|
|
69
|
+
const ComponentTreeNodeSchema = BaseComponentTreeNodeSchema.extend({
|
|
70
|
+
children: z.lazy(() => ComponentTreeNodeSchema.array()),
|
|
71
|
+
});
|
|
72
|
+
const ComponentSettingsSchema = z.object({
|
|
73
|
+
variableDefinitions: 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
|
|
74
|
+
z.object({
|
|
75
|
+
displayName: z.string(),
|
|
76
|
+
type: ComponentDefinitionPropertyTypeSchema,
|
|
77
|
+
defaultValue: ComponentPropertyValueSchema.optional(),
|
|
78
|
+
description: z.string().optional(),
|
|
79
|
+
group: z.string().optional(),
|
|
80
|
+
validations: z.record(z.string()).optional(),
|
|
81
|
+
})),
|
|
82
|
+
});
|
|
83
|
+
const UsedComponentsSchema = z.array(z.object({
|
|
84
|
+
sys: z.object({
|
|
85
|
+
type: z.literal('Link'),
|
|
86
|
+
id: z.string(),
|
|
87
|
+
linkType: z.literal('Entry'),
|
|
88
|
+
}),
|
|
89
|
+
}));
|
|
90
|
+
const breakpointsRefinement = (value, ctx) => {
|
|
91
|
+
if (!value.length || value[0].id !== 'desktop' || value[0].query !== '*') {
|
|
92
|
+
ctx.addIssue({
|
|
93
|
+
code: z.ZodIssueCode.custom,
|
|
94
|
+
message: `The first breakpoint should include the following attributes: { "id": "desktop", "query": "*" }`,
|
|
95
|
+
path: [...ctx.path, 0],
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
// Extract the queries boundary by removing the special characters around it
|
|
99
|
+
const queries = value.map((bp) => bp.query === '*' ? bp.query : parseInt(bp.query.replace(/px|<|>/, '')));
|
|
100
|
+
// sort updates queries array in place so we need to create a copy
|
|
101
|
+
const originalQueries = [...queries];
|
|
102
|
+
queries.sort((q1, q2) => {
|
|
103
|
+
if (q1 === '*') {
|
|
104
|
+
return -1;
|
|
105
|
+
}
|
|
106
|
+
if (q2 === '*') {
|
|
107
|
+
return 1;
|
|
108
|
+
}
|
|
109
|
+
return q1 > q2 ? -1 : 1;
|
|
110
|
+
});
|
|
111
|
+
if (originalQueries.join('') !== queries.join('')) {
|
|
112
|
+
ctx.addIssue({
|
|
113
|
+
code: z.ZodIssueCode.custom,
|
|
114
|
+
message: `Breakpoints should be ordered from largest to smallest pixel value`,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
const componentSettingsRefinement = (value, ctx) => {
|
|
119
|
+
const { componentSettings, usedComponents } = value;
|
|
120
|
+
if (!componentSettings || !usedComponents) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const localeKey = Object.keys(componentSettings ?? {})[0];
|
|
124
|
+
if (componentSettings[localeKey] !== undefined && usedComponents[localeKey] !== undefined) {
|
|
125
|
+
ctx.addIssue({
|
|
126
|
+
code: z.ZodIssueCode.custom,
|
|
127
|
+
message: `'componentSettings' field cannot be used in conjunction with 'usedComponents' field`,
|
|
128
|
+
path: ['componentSettings', localeKey],
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
const ComponentTreeSchema = z.object({
|
|
133
|
+
breakpoints: z.array(BreakpointSchema).superRefine(breakpointsRefinement),
|
|
134
|
+
children: z.array(ComponentTreeNodeSchema),
|
|
135
|
+
schemaVersion: SchemaVersions,
|
|
136
|
+
});
|
|
137
|
+
const localeWrapper = (fieldSchema) => z.record(z.string(), fieldSchema);
|
|
138
|
+
const ExperienceFieldsCMAShapeSchema = z
|
|
139
|
+
.object({
|
|
140
|
+
componentTree: localeWrapper(ComponentTreeSchema),
|
|
141
|
+
dataSource: localeWrapper(DataSourceSchema),
|
|
142
|
+
unboundValues: localeWrapper(UnboundValuesSchema),
|
|
143
|
+
usedComponents: localeWrapper(UsedComponentsSchema).optional(),
|
|
144
|
+
componentSettings: localeWrapper(ComponentSettingsSchema).optional(),
|
|
145
|
+
})
|
|
146
|
+
.superRefine(componentSettingsRefinement);
|
|
147
|
+
|
|
148
|
+
export { ExperienceFieldsCMAShapeSchema as Schema_2023_09_28 };
|
|
149
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/schemas/schemaVersions.ts","../src/schemas/v2023_09_28/experience.ts"],"sourcesContent":["import { z } from 'zod';\n\nexport const SchemaVersions = z.union([\n z.literal('2023-09-28'),\n z.literal('2023-08-23'),\n z.literal('2023-07-26'),\n z.literal('2023-06-27'),\n]);\nexport type SchemaVersions = z.infer<typeof SchemaVersions>;\n","import { z } from 'zod';\nimport { SchemaVersions } from '../schemaVersions';\n\nconst uuidKeySchema = z.string().regex(/^[a-zA-Z0-9-_]{1,21}$/);\nconst propertyKeySchema = z.string().regex(/^[a-zA-Z0-9-_]{1,32}$/);\n\nconst DataSourceSchema = z.record(\n uuidKeySchema,\n z.object({\n sys: z.object({\n type: z.literal('Link'),\n id: z.string(),\n linkType: z.literal('Entry').or(z.literal('Asset')),\n }),\n }),\n);\n\nconst PrimitiveValueSchema = z.union([\n z.string(),\n z.boolean(),\n z.number(),\n z.record(z.any(), z.any()),\n z.undefined(),\n]);\n\nexport const ComponentDefinitionPropertyTypeSchema = z.enum([\n 'Text',\n 'RichText',\n 'Number',\n 'Date',\n 'Boolean',\n 'Location',\n 'Media',\n 'Object',\n]);\n\nconst ValuesByBreakpointSchema = z.record(z.lazy(() => PrimitiveValueSchema));\n\nconst ComponentPropertyValueSchema = z.union([\n z.object({\n type: z.literal('DesignValue'),\n valuesByBreakpoint: ValuesByBreakpointSchema,\n }),\n z.object({\n type: z.literal('BoundValue'),\n path: z.string(),\n }),\n z.object({\n type: z.literal('UnboundValue'),\n key: z.string(),\n }),\n z.object({\n type: z.literal('ComponentValue'),\n key: z.string(),\n }),\n]);\n\nexport type ComponentPropertyValue = z.infer<typeof ComponentPropertyValueSchema>;\n\nconst BreakpointSchema = z.object({\n id: propertyKeySchema,\n query: z.string().regex(/^\\*$|^<[0-9*]+px$/),\n previewSize: z.string(),\n displayName: z.string(),\n});\n\nconst UnboundValuesSchema = z.record(\n uuidKeySchema,\n z.object({\n value: PrimitiveValueSchema,\n }),\n);\n\n// Use helper schema to define a recursive schema with its type correctly below\nconst BaseComponentTreeNodeSchema = z.object({\n definitionId: z.string(),\n variables: z.record(propertyKeySchema, ComponentPropertyValueSchema),\n});\nexport type ComponentTreeNode = z.infer<typeof BaseComponentTreeNodeSchema> & {\n children: ComponentTreeNode[];\n};\nconst ComponentTreeNodeSchema: z.ZodType<ComponentTreeNode> = BaseComponentTreeNodeSchema.extend({\n children: z.lazy(() => ComponentTreeNodeSchema.array()),\n});\n\nconst ComponentSettingsSchema = z.object({\n variableDefinitions: z.record(\n z.string().regex(/^[a-zA-Z0-9-_]{1,54}$/), // Here the key is <variableName>_<nanoidId> so we need to allow for a longer length\n z.object({\n displayName: z.string(),\n type: ComponentDefinitionPropertyTypeSchema,\n defaultValue: ComponentPropertyValueSchema.optional(),\n description: z.string().optional(),\n group: z.string().optional(),\n validations: z.record(z.string()).optional(),\n }),\n ),\n});\n\nconst UsedComponentsSchema = z.array(\n z.object({\n sys: z.object({\n type: z.literal('Link'),\n id: z.string(),\n linkType: z.literal('Entry'),\n }),\n }),\n);\n\nconst breakpointsRefinement = (value: Breakpoint[], ctx: z.RefinementCtx) => {\n if (!value.length || value[0].id !== 'desktop' || value[0].query !== '*') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `The first breakpoint should include the following attributes: { \"id\": \"desktop\", \"query\": \"*\" }`,\n path: [...ctx.path, 0],\n });\n }\n // Extract the queries boundary by removing the special characters around it\n const queries = value.map((bp) =>\n bp.query === '*' ? bp.query : parseInt(bp.query.replace(/px|<|>/, '')),\n );\n // sort updates queries array in place so we need to create a copy\n const originalQueries = [...queries];\n queries.sort((q1, q2) => {\n if (q1 === '*') {\n return -1;\n }\n if (q2 === '*') {\n return 1;\n }\n return q1 > q2 ? -1 : 1;\n });\n\n if (originalQueries.join('') !== queries.join('')) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Breakpoints should be ordered from largest to smallest pixel value`,\n });\n }\n};\n\nconst componentSettingsRefinement = (value, ctx: z.RefinementCtx) => {\n const { componentSettings, usedComponents } = value as ExperienceFields;\n\n if (!componentSettings || !usedComponents) {\n return;\n }\n const localeKey = Object.keys(componentSettings ?? {})[0];\n\n if (componentSettings[localeKey] !== undefined && usedComponents[localeKey] !== undefined) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `'componentSettings' field cannot be used in conjunction with 'usedComponents' field`,\n path: ['componentSettings', localeKey],\n });\n }\n};\n\nconst ComponentTreeSchema = z.object({\n breakpoints: z.array(BreakpointSchema).superRefine(breakpointsRefinement),\n children: z.array(ComponentTreeNodeSchema),\n schemaVersion: SchemaVersions,\n});\n\nconst localeWrapper = (fieldSchema: any) => z.record(z.string(), fieldSchema);\n\nexport const ExperienceFieldsCMAShapeSchema = z\n .object({\n componentTree: localeWrapper(ComponentTreeSchema),\n dataSource: localeWrapper(DataSourceSchema),\n unboundValues: localeWrapper(UnboundValuesSchema),\n usedComponents: localeWrapper(UsedComponentsSchema).optional(),\n componentSettings: localeWrapper(ComponentSettingsSchema).optional(),\n })\n .superRefine(componentSettingsRefinement);\n\nexport type ExperienceFields = z.infer<typeof ExperienceFieldsCMAShapeSchema>;\nexport type ExperienceDataSource = z.infer<typeof DataSourceSchema>;\nexport type ExperienceUnboundValues = z.infer<typeof UnboundValuesSchema>;\nexport type ExperienceUsedComponents = z.infer<typeof UsedComponentsSchema>;\nexport type ExperienceComponentSettings = z.infer<typeof ComponentSettingsSchema>;\nexport type ExperienceComponentTree = z.infer<typeof ComponentTreeSchema>;\nexport type ValuesByBreakpoint = z.infer<typeof ValuesByBreakpointSchema>;\nexport type Breakpoint = z.infer<typeof BreakpointSchema>;\nexport type PrimitiveValue = z.infer<typeof PrimitiveValueSchema>;\n"],"names":[],"mappings":";;AAEO,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC;AACpC,IAAA,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC;AACvB,IAAA,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC;AACvB,IAAA,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC;AACvB,IAAA,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC;AACxB,CAAA,CAAC;;ACJF,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;AAChE,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAA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1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const SchemaVersions: z.ZodUnion<[z.ZodLiteral<"2023-09-28">, z.ZodLiteral<"2023-08-23">, z.ZodLiteral<"2023-07-26">, z.ZodLiteral<"2023-06-27">]>;
|
|
4
|
+
type SchemaVersions = z.infer<typeof SchemaVersions>;
|
|
5
|
+
|
|
6
|
+
export { SchemaVersions };
|
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const DataSourceSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
4
|
+
sys: z.ZodObject<{
|
|
5
|
+
type: z.ZodLiteral<"Link">;
|
|
6
|
+
id: z.ZodString;
|
|
7
|
+
linkType: z.ZodUnion<[z.ZodLiteral<"Entry">, z.ZodLiteral<"Asset">]>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
type: "Link";
|
|
10
|
+
id: string;
|
|
11
|
+
linkType: "Entry" | "Asset";
|
|
12
|
+
}, {
|
|
13
|
+
type: "Link";
|
|
14
|
+
id: string;
|
|
15
|
+
linkType: "Entry" | "Asset";
|
|
16
|
+
}>;
|
|
17
|
+
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
sys: {
|
|
19
|
+
type: "Link";
|
|
20
|
+
id: string;
|
|
21
|
+
linkType: "Entry" | "Asset";
|
|
22
|
+
};
|
|
23
|
+
}, {
|
|
24
|
+
sys: {
|
|
25
|
+
type: "Link";
|
|
26
|
+
id: string;
|
|
27
|
+
linkType: "Entry" | "Asset";
|
|
28
|
+
};
|
|
29
|
+
}>>;
|
|
30
|
+
declare const PrimitiveValueSchema: z.ZodUnion<[z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodRecord<z.ZodAny, z.ZodAny>, z.ZodUndefined]>;
|
|
31
|
+
declare const ValuesByBreakpointSchema: z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodUnion<[z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodRecord<z.ZodAny, z.ZodAny>, z.ZodUndefined]>>>;
|
|
32
|
+
declare const ComponentPropertyValueSchema: z.ZodUnion<[z.ZodObject<{
|
|
33
|
+
type: z.ZodLiteral<"DesignValue">;
|
|
34
|
+
valuesByBreakpoint: z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodUnion<[z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodRecord<z.ZodAny, z.ZodAny>, z.ZodUndefined]>>>;
|
|
35
|
+
}, "strip", z.ZodTypeAny, {
|
|
36
|
+
type: "DesignValue";
|
|
37
|
+
valuesByBreakpoint: Record<string, string | number | boolean | Record<any, any> | undefined>;
|
|
38
|
+
}, {
|
|
39
|
+
type: "DesignValue";
|
|
40
|
+
valuesByBreakpoint: Record<string, string | number | boolean | Record<any, any> | undefined>;
|
|
41
|
+
}>, z.ZodObject<{
|
|
42
|
+
type: z.ZodLiteral<"BoundValue">;
|
|
43
|
+
path: z.ZodString;
|
|
44
|
+
}, "strip", z.ZodTypeAny, {
|
|
45
|
+
path: string;
|
|
46
|
+
type: "BoundValue";
|
|
47
|
+
}, {
|
|
48
|
+
path: string;
|
|
49
|
+
type: "BoundValue";
|
|
50
|
+
}>, z.ZodObject<{
|
|
51
|
+
type: z.ZodLiteral<"UnboundValue">;
|
|
52
|
+
key: z.ZodString;
|
|
53
|
+
}, "strip", z.ZodTypeAny, {
|
|
54
|
+
type: "UnboundValue";
|
|
55
|
+
key: string;
|
|
56
|
+
}, {
|
|
57
|
+
type: "UnboundValue";
|
|
58
|
+
key: string;
|
|
59
|
+
}>, z.ZodObject<{
|
|
60
|
+
type: z.ZodLiteral<"ComponentValue">;
|
|
61
|
+
key: z.ZodString;
|
|
62
|
+
}, "strip", z.ZodTypeAny, {
|
|
63
|
+
type: "ComponentValue";
|
|
64
|
+
key: string;
|
|
65
|
+
}, {
|
|
66
|
+
type: "ComponentValue";
|
|
67
|
+
key: string;
|
|
68
|
+
}>]>;
|
|
69
|
+
type ComponentPropertyValue = z.infer<typeof ComponentPropertyValueSchema>;
|
|
70
|
+
declare const BreakpointSchema: z.ZodObject<{
|
|
71
|
+
id: z.ZodString;
|
|
72
|
+
query: z.ZodString;
|
|
73
|
+
previewSize: z.ZodString;
|
|
74
|
+
displayName: z.ZodString;
|
|
75
|
+
}, "strip", z.ZodTypeAny, {
|
|
76
|
+
id: string;
|
|
77
|
+
query: string;
|
|
78
|
+
previewSize: string;
|
|
79
|
+
displayName: string;
|
|
80
|
+
}, {
|
|
81
|
+
id: string;
|
|
82
|
+
query: string;
|
|
83
|
+
previewSize: string;
|
|
84
|
+
displayName: string;
|
|
85
|
+
}>;
|
|
86
|
+
declare const UnboundValuesSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
87
|
+
value: z.ZodUnion<[z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodRecord<z.ZodAny, z.ZodAny>, z.ZodUndefined]>;
|
|
88
|
+
}, "strip", z.ZodTypeAny, {
|
|
89
|
+
value?: string | number | boolean | Record<any, any> | undefined;
|
|
90
|
+
}, {
|
|
91
|
+
value?: string | number | boolean | Record<any, any> | undefined;
|
|
92
|
+
}>>;
|
|
93
|
+
declare const BaseComponentTreeNodeSchema: z.ZodObject<{
|
|
94
|
+
definitionId: z.ZodString;
|
|
95
|
+
variables: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
|
|
96
|
+
type: z.ZodLiteral<"DesignValue">;
|
|
97
|
+
valuesByBreakpoint: z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodUnion<[z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodRecord<z.ZodAny, z.ZodAny>, z.ZodUndefined]>>>;
|
|
98
|
+
}, "strip", z.ZodTypeAny, {
|
|
99
|
+
type: "DesignValue";
|
|
100
|
+
valuesByBreakpoint: Record<string, string | number | boolean | Record<any, any> | undefined>;
|
|
101
|
+
}, {
|
|
102
|
+
type: "DesignValue";
|
|
103
|
+
valuesByBreakpoint: Record<string, string | number | boolean | Record<any, any> | undefined>;
|
|
104
|
+
}>, z.ZodObject<{
|
|
105
|
+
type: z.ZodLiteral<"BoundValue">;
|
|
106
|
+
path: z.ZodString;
|
|
107
|
+
}, "strip", z.ZodTypeAny, {
|
|
108
|
+
path: string;
|
|
109
|
+
type: "BoundValue";
|
|
110
|
+
}, {
|
|
111
|
+
path: string;
|
|
112
|
+
type: "BoundValue";
|
|
113
|
+
}>, z.ZodObject<{
|
|
114
|
+
type: z.ZodLiteral<"UnboundValue">;
|
|
115
|
+
key: z.ZodString;
|
|
116
|
+
}, "strip", z.ZodTypeAny, {
|
|
117
|
+
type: "UnboundValue";
|
|
118
|
+
key: string;
|
|
119
|
+
}, {
|
|
120
|
+
type: "UnboundValue";
|
|
121
|
+
key: string;
|
|
122
|
+
}>, z.ZodObject<{
|
|
123
|
+
type: z.ZodLiteral<"ComponentValue">;
|
|
124
|
+
key: z.ZodString;
|
|
125
|
+
}, "strip", z.ZodTypeAny, {
|
|
126
|
+
type: "ComponentValue";
|
|
127
|
+
key: string;
|
|
128
|
+
}, {
|
|
129
|
+
type: "ComponentValue";
|
|
130
|
+
key: string;
|
|
131
|
+
}>]>>;
|
|
132
|
+
}, "strip", z.ZodTypeAny, {
|
|
133
|
+
definitionId: string;
|
|
134
|
+
variables: Record<string, {
|
|
135
|
+
type: "DesignValue";
|
|
136
|
+
valuesByBreakpoint: Record<string, string | number | boolean | Record<any, any> | undefined>;
|
|
137
|
+
} | {
|
|
138
|
+
path: string;
|
|
139
|
+
type: "BoundValue";
|
|
140
|
+
} | {
|
|
141
|
+
type: "UnboundValue";
|
|
142
|
+
key: string;
|
|
143
|
+
} | {
|
|
144
|
+
type: "ComponentValue";
|
|
145
|
+
key: string;
|
|
146
|
+
}>;
|
|
147
|
+
}, {
|
|
148
|
+
definitionId: string;
|
|
149
|
+
variables: Record<string, {
|
|
150
|
+
type: "DesignValue";
|
|
151
|
+
valuesByBreakpoint: Record<string, string | number | boolean | Record<any, any> | undefined>;
|
|
152
|
+
} | {
|
|
153
|
+
path: string;
|
|
154
|
+
type: "BoundValue";
|
|
155
|
+
} | {
|
|
156
|
+
type: "UnboundValue";
|
|
157
|
+
key: string;
|
|
158
|
+
} | {
|
|
159
|
+
type: "ComponentValue";
|
|
160
|
+
key: string;
|
|
161
|
+
}>;
|
|
162
|
+
}>;
|
|
163
|
+
type ComponentTreeNode = z.infer<typeof BaseComponentTreeNodeSchema> & {
|
|
164
|
+
children: ComponentTreeNode[];
|
|
165
|
+
};
|
|
166
|
+
declare const ComponentSettingsSchema: z.ZodObject<{
|
|
167
|
+
variableDefinitions: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
168
|
+
displayName: z.ZodString;
|
|
169
|
+
type: z.ZodEnum<["Text", "RichText", "Number", "Date", "Boolean", "Location", "Media", "Object"]>;
|
|
170
|
+
defaultValue: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
171
|
+
type: z.ZodLiteral<"DesignValue">;
|
|
172
|
+
valuesByBreakpoint: z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodUnion<[z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodRecord<z.ZodAny, z.ZodAny>, z.ZodUndefined]>>>;
|
|
173
|
+
}, "strip", z.ZodTypeAny, {
|
|
174
|
+
type: "DesignValue";
|
|
175
|
+
valuesByBreakpoint: Record<string, string | number | boolean | Record<any, any> | undefined>;
|
|
176
|
+
}, {
|
|
177
|
+
type: "DesignValue";
|
|
178
|
+
valuesByBreakpoint: Record<string, string | number | boolean | Record<any, any> | undefined>;
|
|
179
|
+
}>, z.ZodObject<{
|
|
180
|
+
type: z.ZodLiteral<"BoundValue">;
|
|
181
|
+
path: z.ZodString;
|
|
182
|
+
}, "strip", z.ZodTypeAny, {
|
|
183
|
+
path: string;
|
|
184
|
+
type: "BoundValue";
|
|
185
|
+
}, {
|
|
186
|
+
path: string;
|
|
187
|
+
type: "BoundValue";
|
|
188
|
+
}>, z.ZodObject<{
|
|
189
|
+
type: z.ZodLiteral<"UnboundValue">;
|
|
190
|
+
key: z.ZodString;
|
|
191
|
+
}, "strip", z.ZodTypeAny, {
|
|
192
|
+
type: "UnboundValue";
|
|
193
|
+
key: string;
|
|
194
|
+
}, {
|
|
195
|
+
type: "UnboundValue";
|
|
196
|
+
key: string;
|
|
197
|
+
}>, z.ZodObject<{
|
|
198
|
+
type: z.ZodLiteral<"ComponentValue">;
|
|
199
|
+
key: z.ZodString;
|
|
200
|
+
}, "strip", z.ZodTypeAny, {
|
|
201
|
+
type: "ComponentValue";
|
|
202
|
+
key: string;
|
|
203
|
+
}, {
|
|
204
|
+
type: "ComponentValue";
|
|
205
|
+
key: string;
|
|
206
|
+
}>]>>;
|
|
207
|
+
description: z.ZodOptional<z.ZodString>;
|
|
208
|
+
group: z.ZodOptional<z.ZodString>;
|
|
209
|
+
validations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
210
|
+
}, "strip", z.ZodTypeAny, {
|
|
211
|
+
type: "Text" | "RichText" | "Number" | "Date" | "Boolean" | "Location" | "Media" | "Object";
|
|
212
|
+
displayName: string;
|
|
213
|
+
defaultValue?: {
|
|
214
|
+
type: "DesignValue";
|
|
215
|
+
valuesByBreakpoint: Record<string, string | number | boolean | Record<any, any> | undefined>;
|
|
216
|
+
} | {
|
|
217
|
+
path: string;
|
|
218
|
+
type: "BoundValue";
|
|
219
|
+
} | {
|
|
220
|
+
type: "UnboundValue";
|
|
221
|
+
key: string;
|
|
222
|
+
} | {
|
|
223
|
+
type: "ComponentValue";
|
|
224
|
+
key: string;
|
|
225
|
+
} | undefined;
|
|
226
|
+
description?: string | undefined;
|
|
227
|
+
group?: string | undefined;
|
|
228
|
+
validations?: Record<string, string> | undefined;
|
|
229
|
+
}, {
|
|
230
|
+
type: "Text" | "RichText" | "Number" | "Date" | "Boolean" | "Location" | "Media" | "Object";
|
|
231
|
+
displayName: string;
|
|
232
|
+
defaultValue?: {
|
|
233
|
+
type: "DesignValue";
|
|
234
|
+
valuesByBreakpoint: Record<string, string | number | boolean | Record<any, any> | undefined>;
|
|
235
|
+
} | {
|
|
236
|
+
path: string;
|
|
237
|
+
type: "BoundValue";
|
|
238
|
+
} | {
|
|
239
|
+
type: "UnboundValue";
|
|
240
|
+
key: string;
|
|
241
|
+
} | {
|
|
242
|
+
type: "ComponentValue";
|
|
243
|
+
key: string;
|
|
244
|
+
} | undefined;
|
|
245
|
+
description?: string | undefined;
|
|
246
|
+
group?: string | undefined;
|
|
247
|
+
validations?: Record<string, string> | undefined;
|
|
248
|
+
}>>;
|
|
249
|
+
}, "strip", z.ZodTypeAny, {
|
|
250
|
+
variableDefinitions: Record<string, {
|
|
251
|
+
type: "Text" | "RichText" | "Number" | "Date" | "Boolean" | "Location" | "Media" | "Object";
|
|
252
|
+
displayName: string;
|
|
253
|
+
defaultValue?: {
|
|
254
|
+
type: "DesignValue";
|
|
255
|
+
valuesByBreakpoint: Record<string, string | number | boolean | Record<any, any> | undefined>;
|
|
256
|
+
} | {
|
|
257
|
+
path: string;
|
|
258
|
+
type: "BoundValue";
|
|
259
|
+
} | {
|
|
260
|
+
type: "UnboundValue";
|
|
261
|
+
key: string;
|
|
262
|
+
} | {
|
|
263
|
+
type: "ComponentValue";
|
|
264
|
+
key: string;
|
|
265
|
+
} | undefined;
|
|
266
|
+
description?: string | undefined;
|
|
267
|
+
group?: string | undefined;
|
|
268
|
+
validations?: Record<string, string> | undefined;
|
|
269
|
+
}>;
|
|
270
|
+
}, {
|
|
271
|
+
variableDefinitions: Record<string, {
|
|
272
|
+
type: "Text" | "RichText" | "Number" | "Date" | "Boolean" | "Location" | "Media" | "Object";
|
|
273
|
+
displayName: string;
|
|
274
|
+
defaultValue?: {
|
|
275
|
+
type: "DesignValue";
|
|
276
|
+
valuesByBreakpoint: Record<string, string | number | boolean | Record<any, any> | undefined>;
|
|
277
|
+
} | {
|
|
278
|
+
path: string;
|
|
279
|
+
type: "BoundValue";
|
|
280
|
+
} | {
|
|
281
|
+
type: "UnboundValue";
|
|
282
|
+
key: string;
|
|
283
|
+
} | {
|
|
284
|
+
type: "ComponentValue";
|
|
285
|
+
key: string;
|
|
286
|
+
} | undefined;
|
|
287
|
+
description?: string | undefined;
|
|
288
|
+
group?: string | undefined;
|
|
289
|
+
validations?: Record<string, string> | undefined;
|
|
290
|
+
}>;
|
|
291
|
+
}>;
|
|
292
|
+
declare const UsedComponentsSchema: z.ZodArray<z.ZodObject<{
|
|
293
|
+
sys: z.ZodObject<{
|
|
294
|
+
type: z.ZodLiteral<"Link">;
|
|
295
|
+
id: z.ZodString;
|
|
296
|
+
linkType: z.ZodLiteral<"Entry">;
|
|
297
|
+
}, "strip", z.ZodTypeAny, {
|
|
298
|
+
type: "Link";
|
|
299
|
+
id: string;
|
|
300
|
+
linkType: "Entry";
|
|
301
|
+
}, {
|
|
302
|
+
type: "Link";
|
|
303
|
+
id: string;
|
|
304
|
+
linkType: "Entry";
|
|
305
|
+
}>;
|
|
306
|
+
}, "strip", z.ZodTypeAny, {
|
|
307
|
+
sys: {
|
|
308
|
+
type: "Link";
|
|
309
|
+
id: string;
|
|
310
|
+
linkType: "Entry";
|
|
311
|
+
};
|
|
312
|
+
}, {
|
|
313
|
+
sys: {
|
|
314
|
+
type: "Link";
|
|
315
|
+
id: string;
|
|
316
|
+
linkType: "Entry";
|
|
317
|
+
};
|
|
318
|
+
}>, "many">;
|
|
319
|
+
declare const ComponentTreeSchema: z.ZodObject<{
|
|
320
|
+
breakpoints: z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
321
|
+
id: z.ZodString;
|
|
322
|
+
query: z.ZodString;
|
|
323
|
+
previewSize: z.ZodString;
|
|
324
|
+
displayName: z.ZodString;
|
|
325
|
+
}, "strip", z.ZodTypeAny, {
|
|
326
|
+
id: string;
|
|
327
|
+
query: string;
|
|
328
|
+
previewSize: string;
|
|
329
|
+
displayName: string;
|
|
330
|
+
}, {
|
|
331
|
+
id: string;
|
|
332
|
+
query: string;
|
|
333
|
+
previewSize: string;
|
|
334
|
+
displayName: string;
|
|
335
|
+
}>, "many">, {
|
|
336
|
+
id: string;
|
|
337
|
+
query: string;
|
|
338
|
+
previewSize: string;
|
|
339
|
+
displayName: string;
|
|
340
|
+
}[], {
|
|
341
|
+
id: string;
|
|
342
|
+
query: string;
|
|
343
|
+
previewSize: string;
|
|
344
|
+
displayName: string;
|
|
345
|
+
}[]>;
|
|
346
|
+
children: z.ZodArray<z.ZodType<ComponentTreeNode, z.ZodTypeDef, ComponentTreeNode>, "many">;
|
|
347
|
+
schemaVersion: z.ZodUnion<[z.ZodLiteral<"2023-09-28">, z.ZodLiteral<"2023-08-23">, z.ZodLiteral<"2023-07-26">, z.ZodLiteral<"2023-06-27">]>;
|
|
348
|
+
}, "strip", z.ZodTypeAny, {
|
|
349
|
+
children: ComponentTreeNode[];
|
|
350
|
+
breakpoints: {
|
|
351
|
+
id: string;
|
|
352
|
+
query: string;
|
|
353
|
+
previewSize: string;
|
|
354
|
+
displayName: string;
|
|
355
|
+
}[];
|
|
356
|
+
schemaVersion: "2023-09-28" | "2023-08-23" | "2023-07-26" | "2023-06-27";
|
|
357
|
+
}, {
|
|
358
|
+
children: ComponentTreeNode[];
|
|
359
|
+
breakpoints: {
|
|
360
|
+
id: string;
|
|
361
|
+
query: string;
|
|
362
|
+
previewSize: string;
|
|
363
|
+
displayName: string;
|
|
364
|
+
}[];
|
|
365
|
+
schemaVersion: "2023-09-28" | "2023-08-23" | "2023-07-26" | "2023-06-27";
|
|
366
|
+
}>;
|
|
367
|
+
declare const ExperienceFieldsCMAShapeSchema: z.ZodEffects<z.ZodObject<{
|
|
368
|
+
componentTree: z.ZodRecord<z.ZodString, any>;
|
|
369
|
+
dataSource: z.ZodRecord<z.ZodString, any>;
|
|
370
|
+
unboundValues: z.ZodRecord<z.ZodString, any>;
|
|
371
|
+
usedComponents: z.ZodOptional<z.ZodRecord<z.ZodString, any>>;
|
|
372
|
+
componentSettings: z.ZodOptional<z.ZodRecord<z.ZodString, any>>;
|
|
373
|
+
}, "strip", z.ZodTypeAny, {
|
|
374
|
+
componentTree: Record<string, any>;
|
|
375
|
+
dataSource: Record<string, any>;
|
|
376
|
+
unboundValues: Record<string, any>;
|
|
377
|
+
usedComponents?: Record<string, any> | undefined;
|
|
378
|
+
componentSettings?: Record<string, any> | undefined;
|
|
379
|
+
}, {
|
|
380
|
+
componentTree: Record<string, any>;
|
|
381
|
+
dataSource: Record<string, any>;
|
|
382
|
+
unboundValues: Record<string, any>;
|
|
383
|
+
usedComponents?: Record<string, any> | undefined;
|
|
384
|
+
componentSettings?: Record<string, any> | undefined;
|
|
385
|
+
}>, {
|
|
386
|
+
componentTree: Record<string, any>;
|
|
387
|
+
dataSource: Record<string, any>;
|
|
388
|
+
unboundValues: Record<string, any>;
|
|
389
|
+
usedComponents?: Record<string, any> | undefined;
|
|
390
|
+
componentSettings?: Record<string, any> | undefined;
|
|
391
|
+
}, {
|
|
392
|
+
componentTree: Record<string, any>;
|
|
393
|
+
dataSource: Record<string, any>;
|
|
394
|
+
unboundValues: Record<string, any>;
|
|
395
|
+
usedComponents?: Record<string, any> | undefined;
|
|
396
|
+
componentSettings?: Record<string, any> | undefined;
|
|
397
|
+
}>;
|
|
398
|
+
type ExperienceFields = z.infer<typeof ExperienceFieldsCMAShapeSchema>;
|
|
399
|
+
type ExperienceDataSource = z.infer<typeof DataSourceSchema>;
|
|
400
|
+
type ExperienceUnboundValues = z.infer<typeof UnboundValuesSchema>;
|
|
401
|
+
type ExperienceUsedComponents = z.infer<typeof UsedComponentsSchema>;
|
|
402
|
+
type ExperienceComponentSettings = z.infer<typeof ComponentSettingsSchema>;
|
|
403
|
+
type ExperienceComponentTree = z.infer<typeof ComponentTreeSchema>;
|
|
404
|
+
type ValuesByBreakpoint = z.infer<typeof ValuesByBreakpointSchema>;
|
|
405
|
+
type Breakpoint = z.infer<typeof BreakpointSchema>;
|
|
406
|
+
type PrimitiveValue = z.infer<typeof PrimitiveValueSchema>;
|
|
407
|
+
|
|
408
|
+
export { type Breakpoint, type ComponentPropertyValue, type ComponentTreeNode, type ExperienceComponentSettings, type ExperienceComponentTree, type ExperienceDataSource, type ExperienceFields, ExperienceFieldsCMAShapeSchema, type ExperienceUnboundValues, type ExperienceUsedComponents, type PrimitiveValue, type ValuesByBreakpoint };
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { Breakpoint, ComponentPropertyValue, ComponentTreeNode, ExperienceComponentSettings, ExperienceComponentTree, ExperienceDataSource, ExperienceFields, ExperienceUnboundValues, ExperienceUsedComponents, PrimitiveValue, ValuesByBreakpoint } from './schemas/v2023_09_28/experience.js';
|
|
2
|
+
export { SchemaVersions } from './schemas/schemaVersions.js';
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@contentful/experiences-validators",
|
|
3
|
+
"version": "0.0.1-alpha.0",
|
|
4
|
+
"main": "./dist/index.js",
|
|
5
|
+
"module": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"homepage": "https://github.com/contentful/experience-builder/tree/next/packages/validators#readme",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/contentful/experience-builder.git"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"dev": "vite",
|
|
15
|
+
"clean": "rimraf dist",
|
|
16
|
+
"prebuild": "npm run clean",
|
|
17
|
+
"build": "rollup -c rollup.config.mjs",
|
|
18
|
+
"preview": "vite preview",
|
|
19
|
+
"test": "vitest",
|
|
20
|
+
"test:coverage": "vitest run --coverage"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist/**/*.*"
|
|
24
|
+
],
|
|
25
|
+
"exports": {
|
|
26
|
+
"*": {
|
|
27
|
+
"types": [
|
|
28
|
+
"./dist/index.d.ts"
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"typescript": "^5.2.2",
|
|
34
|
+
"vite": "^5.0.8",
|
|
35
|
+
"vitest": "^1.2.2"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"zod": "^3.22.4"
|
|
39
|
+
},
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"registry": "https://npm.pkg.github.com/"
|
|
42
|
+
},
|
|
43
|
+
"gitHead": "8abedfa96df2f322f0d13958296ccfff5d53587d"
|
|
44
|
+
}
|