@prismicio/types-internal 4.1.0 → 4.2.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/content/field.js +1 -1
- package/dist/content/field.js.map +1 -1
- package/dist/content/group.d.ts +1 -2
- package/dist/content/group.d.ts.map +1 -1
- package/dist/content/group.js +1 -1
- package/dist/content/group.js.map +1 -1
- package/dist/content/legacy/link.d.ts +4 -4
- package/dist/content/legacy/link.js +4 -4
- package/dist/content/legacy/link.js.map +1 -1
- package/dist/content/legacy/richText.d.ts +23 -12
- package/dist/content/legacy/richText.d.ts.map +1 -1
- package/dist/content/legacy/richText.js +2 -2
- package/dist/content/legacy/richText.js.map +1 -1
- package/dist/content/link.d.ts +4 -4
- package/dist/content/nestable.d.ts +3 -3
- package/dist/content/nestable.d.ts.map +1 -1
- package/dist/content/nestable.js +3 -9
- package/dist/content/nestable.js.map +1 -1
- package/dist/content/richText.d.ts +1 -1
- package/dist/content/richText.d.ts.map +1 -1
- package/dist/content/richText.js +1 -1
- package/dist/content/richText.js.map +1 -1
- package/dist/content/slice.d.ts +507 -5
- package/dist/content/slice.d.ts.map +1 -1
- package/dist/content/slice.js +1 -1
- package/dist/content/slice.js.map +1 -1
- package/dist/content/slices.d.ts +507 -5
- package/dist/content/slices.d.ts.map +1 -1
- package/dist/content/table.d.ts +5 -2
- package/dist/content/table.d.ts.map +1 -1
- package/dist/content/widget.js +1 -1
- package/dist/content/widget.js.map +1 -1
- package/dist/helpers/customTypeModel.d.ts +4 -5
- package/dist/helpers/customTypeModel.d.ts.map +1 -1
- package/dist/helpers/customTypeModel.js.map +1 -1
- package/dist/index.d.ts +6 -7
- package/dist/io-ts.d.ts +5138 -1917
- package/dist/io-ts.d.ts.map +1 -1
- package/dist/io-ts.js +7 -6
- package/dist/io-ts.js.map +1 -1
- package/dist/model/customType.d.ts +9 -3
- package/dist/model/customType.d.ts.map +1 -1
- package/dist/model/customType.js +7 -4
- package/dist/model/customType.js.map +1 -1
- package/dist/model/group.d.ts +2 -2
- package/dist/model/group.js +1 -1
- package/dist/model/group.js.map +1 -1
- package/dist/model/nestable.js +1 -1
- package/dist/model/nestable.js.map +1 -1
- package/dist/model/slice.d.ts +10 -10
- package/dist/model/slice.d.ts.map +1 -1
- package/dist/model/slice.js +5 -5
- package/dist/model/slice.js.map +1 -1
- package/dist/model/widget.d.ts.map +1 -1
- package/dist/model/widget.js +2 -2
- package/dist/model/widget.js.map +1 -1
- package/dist/zod4.d.ts +1814 -249
- package/dist/zod4.d.ts.map +1 -1
- package/dist/zod4.js +7 -6
- package/dist/zod4.js.map +1 -1
- package/package.json +9 -6
- package/src/content/field.ts +1 -1
- package/src/content/group.ts +1 -1
- package/src/content/legacy/link.ts +4 -4
- package/src/content/legacy/richText.ts +14 -21
- package/src/content/nestable.ts +3 -18
- package/src/content/richText.ts +9 -6
- package/src/content/slice.ts +1 -1
- package/src/content/widget.ts +1 -1
- package/src/helpers/customTypeModel.ts +8 -5
- package/src/index.ts +7 -2
- package/src/io-ts.ts +8 -8
- package/src/model/customType.ts +18 -7
- package/src/model/group.ts +1 -1
- package/src/model/nestable.ts +1 -1
- package/src/model/slice.ts +16 -17
- package/src/model/widget.ts +8 -12
- package/src/zod4.ts +8 -8
- package/dist/model/section.d.ts +0 -11
- package/dist/model/section.d.ts.map +0 -1
- package/dist/model/section.js +0 -10
- package/dist/model/section.js.map +0 -1
- package/src/model/section.ts +0 -12
package/src/model/slice.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type { NestableModel } from "./nestable"
|
|
|
7
7
|
import { NestableModelSchema } from "./nestable"
|
|
8
8
|
|
|
9
9
|
// Simple (before 2020)
|
|
10
|
-
export const LegacySliceModelSchema
|
|
10
|
+
export const LegacySliceModelSchema = z.discriminatedUnion("type", [
|
|
11
11
|
NestableModelSchema,
|
|
12
12
|
NestedGroupModelSchema,
|
|
13
13
|
])
|
|
@@ -51,7 +51,9 @@ export const SharedSliceModelVariationSchema = z.object({
|
|
|
51
51
|
primary: z.optional(
|
|
52
52
|
z.record(
|
|
53
53
|
z.string(),
|
|
54
|
-
z.
|
|
54
|
+
z.discriminatedUnion("type", [NestableModelSchema, GroupModelSchema]) as z.ZodMiniType<
|
|
55
|
+
NestableModel | GroupModel
|
|
56
|
+
>,
|
|
55
57
|
),
|
|
56
58
|
),
|
|
57
59
|
items: z.optional(z.record(z.string(), NestableModelSchema)),
|
|
@@ -92,30 +94,27 @@ export type SharedSliceVariationContentModel = z.infer<
|
|
|
92
94
|
// All
|
|
93
95
|
|
|
94
96
|
// Used when slices reference SharedSlice by ref (not full definition)
|
|
95
|
-
export const DynamicSliceModelSchema: z.ZodMiniType<DynamicSliceModel> = z.
|
|
96
|
-
|
|
97
|
-
LegacySliceModelSchema,
|
|
98
|
-
|
|
99
|
-
])
|
|
97
|
+
export const DynamicSliceModelSchema: z.ZodMiniType<DynamicSliceModel> = z.discriminatedUnion(
|
|
98
|
+
"type",
|
|
99
|
+
[CompositeSliceModelSchema, LegacySliceModelSchema, SharedSliceRefModelSchema],
|
|
100
|
+
)
|
|
100
101
|
|
|
101
102
|
export type DynamicSliceModel = CompositeSliceModel | LegacySliceModel | SharedSliceRefModel
|
|
102
103
|
|
|
103
104
|
// Used when slices include full SharedSlice definition
|
|
104
|
-
export const StaticSliceModelSchema: z.ZodMiniType<StaticSliceModel> = z.
|
|
105
|
-
|
|
106
|
-
LegacySliceModelSchema,
|
|
107
|
-
|
|
108
|
-
])
|
|
105
|
+
export const StaticSliceModelSchema: z.ZodMiniType<StaticSliceModel> = z.discriminatedUnion(
|
|
106
|
+
"type",
|
|
107
|
+
[CompositeSliceModelSchema, LegacySliceModelSchema, SharedSliceModelSchema],
|
|
108
|
+
)
|
|
109
109
|
|
|
110
110
|
export type StaticSliceModel = CompositeSliceModel | LegacySliceModel | SharedSliceModel
|
|
111
111
|
|
|
112
112
|
// Used to represent a slice content model as shared slice variations
|
|
113
113
|
// can only be of a given shared slice variation type.
|
|
114
|
-
export const SliceContentModelSchema: z.ZodMiniType<SliceContentModel> = z.
|
|
115
|
-
|
|
116
|
-
LegacySliceModelSchema,
|
|
117
|
-
|
|
118
|
-
])
|
|
114
|
+
export const SliceContentModelSchema: z.ZodMiniType<SliceContentModel> = z.discriminatedUnion(
|
|
115
|
+
"type",
|
|
116
|
+
[CompositeSliceModelSchema, LegacySliceModelSchema, SharedSliceVariationContentModelSchema],
|
|
117
|
+
)
|
|
119
118
|
|
|
120
119
|
export type SliceContentModel =
|
|
121
120
|
| CompositeSliceModel
|
package/src/model/widget.ts
CHANGED
|
@@ -11,22 +11,18 @@ import type { UIDModel } from "./uid"
|
|
|
11
11
|
import { UIDModelSchema } from "./uid"
|
|
12
12
|
|
|
13
13
|
// StaticWidget = UID | Nestable | Group | StaticSlices
|
|
14
|
-
export const StaticWidgetModelSchema: z.ZodMiniType<StaticWidgetModel> = z.
|
|
15
|
-
|
|
16
|
-
NestableModelSchema,
|
|
17
|
-
|
|
18
|
-
StaticSlicesModelSchema,
|
|
19
|
-
])
|
|
14
|
+
export const StaticWidgetModelSchema: z.ZodMiniType<StaticWidgetModel> = z.discriminatedUnion(
|
|
15
|
+
"type",
|
|
16
|
+
[UIDModelSchema, NestableModelSchema, GroupModelSchema, StaticSlicesModelSchema],
|
|
17
|
+
)
|
|
20
18
|
|
|
21
19
|
export type StaticWidgetModel = UIDModel | NestableModel | GroupModel | StaticSlicesModel
|
|
22
20
|
|
|
23
21
|
// DynamicWidget = UID | Nestable | Group | DynamicSlices
|
|
24
|
-
export const DynamicWidgetModelSchema: z.ZodMiniType<DynamicWidgetModel> = z.
|
|
25
|
-
|
|
26
|
-
NestableModelSchema,
|
|
27
|
-
|
|
28
|
-
DynamicSlicesModelSchema,
|
|
29
|
-
])
|
|
22
|
+
export const DynamicWidgetModelSchema: z.ZodMiniType<DynamicWidgetModel> = z.discriminatedUnion(
|
|
23
|
+
"type",
|
|
24
|
+
[UIDModelSchema, NestableModelSchema, GroupModelSchema, DynamicSlicesModelSchema],
|
|
25
|
+
)
|
|
30
26
|
|
|
31
27
|
export type DynamicWidgetModel = UIDModel | NestableModel | GroupModel | DynamicSlicesModel
|
|
32
28
|
|
package/src/zod4.ts
CHANGED
|
@@ -63,7 +63,9 @@ import { BooleanModelSchema as rawBooleanModelSchema } from "./model/boolean"
|
|
|
63
63
|
import { ColorModelSchema as rawColorModelSchema } from "./model/color"
|
|
64
64
|
import {
|
|
65
65
|
StaticCustomTypeModelSchema as rawStaticCustomTypeModelSchema,
|
|
66
|
-
|
|
66
|
+
DynamicCustomTypeModelSchema as rawDynamicCustomTypeModelSchema,
|
|
67
|
+
StaticCustomTypeModelTabSchema as rawStaticCustomTypeModelTabSchema,
|
|
68
|
+
DynamicCustomTypeModelTabSchema as rawDynamicCustomTypeModelTabSchema,
|
|
67
69
|
} from "./model/customType"
|
|
68
70
|
import { DateModelSchema as rawDateModelSchema } from "./model/date"
|
|
69
71
|
import { EmbedModelSchema as rawEmbedModelSchema } from "./model/embed"
|
|
@@ -79,10 +81,6 @@ import { NestableModelSchema as rawNestableModelSchema } from "./model/nestable"
|
|
|
79
81
|
import { NumberModelSchema as rawNumberModelSchema } from "./model/number"
|
|
80
82
|
import { RangeModelSchema as rawRangeModelSchema } from "./model/range"
|
|
81
83
|
import { RichTextModelSchema as rawRichTextModelSchema } from "./model/richText"
|
|
82
|
-
import {
|
|
83
|
-
StaticSectionModelSchema as rawStaticSectionModelSchema,
|
|
84
|
-
DynamicSectionModelSchema as rawDynamicSectionModelSchema,
|
|
85
|
-
} from "./model/section"
|
|
86
84
|
import { SelectModelSchema as rawSelectModelSchema } from "./model/select"
|
|
87
85
|
import { SeparatorModelSchema as rawSeparatorModelSchema } from "./model/separator"
|
|
88
86
|
import {
|
|
@@ -189,10 +187,12 @@ export const DynamicSlicesModelSchema = toZod4(rawDynamicSlicesModelSchema)
|
|
|
189
187
|
export const StaticSlicesModelSchema = toZod4(rawStaticSlicesModelSchema)
|
|
190
188
|
export const StaticWidgetModelSchema = toZod4(rawStaticWidgetModelSchema)
|
|
191
189
|
export const DynamicWidgetModelSchema = toZod4(rawDynamicWidgetModelSchema)
|
|
192
|
-
export const
|
|
193
|
-
export const
|
|
190
|
+
export const StaticCustomTypeModelTabSchema = toZod4(rawStaticCustomTypeModelTabSchema)
|
|
191
|
+
export const DynamicCustomTypeModelTabSchema = toZod4(rawDynamicCustomTypeModelTabSchema)
|
|
194
192
|
export const StaticCustomTypeModelSchema = toZod4(rawStaticCustomTypeModelSchema)
|
|
195
|
-
export const
|
|
193
|
+
export const DynamicCustomTypeModelSchema = toZod4(rawDynamicCustomTypeModelSchema)
|
|
194
|
+
/** @deprecated Use DynamicCustomTypeModelSchema instead */
|
|
195
|
+
export const CustomTypeModelSchema = DynamicCustomTypeModelSchema
|
|
196
196
|
|
|
197
197
|
function toZod4<T>(type: T): T {
|
|
198
198
|
return type
|
package/dist/model/section.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { DynamicWidgetModel, StaticWidgetModel } from "./widget.js";
|
|
2
|
-
import { z } from "zod/mini";
|
|
3
|
-
|
|
4
|
-
//#region src/model/section.d.ts
|
|
5
|
-
declare const StaticSectionModelSchema: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniType<StaticWidgetModel, unknown, z.core.$ZodTypeInternals<StaticWidgetModel, unknown>>>;
|
|
6
|
-
type StaticSectionModel = z.infer<typeof StaticSectionModelSchema>;
|
|
7
|
-
declare const DynamicSectionModelSchema: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniType<DynamicWidgetModel, unknown, z.core.$ZodTypeInternals<DynamicWidgetModel, unknown>>>;
|
|
8
|
-
type DynamicSectionModel = z.infer<typeof DynamicSectionModelSchema>;
|
|
9
|
-
//#endregion
|
|
10
|
-
export { DynamicSectionModel, StaticSectionModel };
|
|
11
|
-
//# sourceMappingURL=section.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"section.d.ts","names":[],"sources":["../../src/model/section.ts"],"mappings":";;;;cAMa,wBAAA,EAAwB,CAAA,CAAA,aAAA,CAAA,CAAA,CAAA,aAAA,UAAA,CAAA,CAAA,WAAA,CAAA,iBAAA,WAAA,CAAA,CAAA,IAAA,CAAA,iBAAA,CAAA,iBAAA;AAAA,KACzB,kBAAA,GAAqB,CAAA,CAAE,KAAA,QAAa,wBAAA;AAAA,cAGnC,yBAAA,EAAyB,CAAA,CAAA,aAAA,CAAA,CAAA,CAAA,aAAA,UAAA,CAAA,CAAA,WAAA,CAAA,kBAAA,WAAA,CAAA,CAAA,IAAA,CAAA,iBAAA,CAAA,kBAAA;AAAA,KAC1B,mBAAA,GAAsB,CAAA,CAAE,KAAA,QAAa,yBAAA"}
|
package/dist/model/section.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { WidgetKeySchema } from "../common/widgetKey.js";
|
|
2
|
-
import { DynamicWidgetModelSchema, StaticWidgetModelSchema } from "./widget.js";
|
|
3
|
-
import { z } from "zod/mini";
|
|
4
|
-
//#region src/model/section.ts
|
|
5
|
-
const StaticSectionModelSchema = z.record(WidgetKeySchema, StaticWidgetModelSchema);
|
|
6
|
-
const DynamicSectionModelSchema = z.record(WidgetKeySchema, DynamicWidgetModelSchema);
|
|
7
|
-
//#endregion
|
|
8
|
-
export { DynamicSectionModelSchema, StaticSectionModelSchema };
|
|
9
|
-
|
|
10
|
-
//# sourceMappingURL=section.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"section.js","names":[],"sources":["../../src/model/section.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { WidgetKeySchema } from \"../common/widgetKey\"\nimport { DynamicWidgetModelSchema, StaticWidgetModelSchema } from \"./widget\"\n\n// StaticSection = Record<WidgetKey, StaticWidget>\nexport const StaticSectionModelSchema = z.record(WidgetKeySchema, StaticWidgetModelSchema)\nexport type StaticSectionModel = z.infer<typeof StaticSectionModelSchema>\n\n// DynamicSection = Record<WidgetKey, DynamicWidget>\nexport const DynamicSectionModelSchema = z.record(WidgetKeySchema, DynamicWidgetModelSchema)\nexport type DynamicSectionModel = z.infer<typeof DynamicSectionModelSchema>\n"],"mappings":";;;;AAMA,MAAa,2BAA2B,EAAE,OAAO,iBAAiB,wBAAwB;AAI1F,MAAa,4BAA4B,EAAE,OAAO,iBAAiB,yBAAyB"}
|
package/src/model/section.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { z } from "zod/mini"
|
|
2
|
-
|
|
3
|
-
import { WidgetKeySchema } from "../common/widgetKey"
|
|
4
|
-
import { DynamicWidgetModelSchema, StaticWidgetModelSchema } from "./widget"
|
|
5
|
-
|
|
6
|
-
// StaticSection = Record<WidgetKey, StaticWidget>
|
|
7
|
-
export const StaticSectionModelSchema = z.record(WidgetKeySchema, StaticWidgetModelSchema)
|
|
8
|
-
export type StaticSectionModel = z.infer<typeof StaticSectionModelSchema>
|
|
9
|
-
|
|
10
|
-
// DynamicSection = Record<WidgetKey, DynamicWidget>
|
|
11
|
-
export const DynamicSectionModelSchema = z.record(WidgetKeySchema, DynamicWidgetModelSchema)
|
|
12
|
-
export type DynamicSectionModel = z.infer<typeof DynamicSectionModelSchema>
|