@prismicio/types-internal 4.7.0 → 4.8.0-canary.6451918
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/codec/group.js +3 -2
- package/dist/content/codec/group.js.map +1 -1
- package/dist/content/codec/legacyContentCtx.d.ts.map +1 -1
- package/dist/content/codec/legacyContentCtx.js +5 -1
- package/dist/content/codec/legacyContentCtx.js.map +1 -1
- package/dist/content/embed.d.ts +1 -1
- package/dist/content/embed.js +1 -1
- package/dist/content/embed.js.map +1 -1
- package/dist/content/image.d.ts +4 -4
- package/dist/content/legacy/image.d.ts +2 -2
- package/dist/content/legacy/image.js +2 -2
- package/dist/content/legacy/image.js.map +1 -1
- package/dist/content/legacy/richText.d.ts +3 -3
- package/dist/content/legacy/richText.js +1 -1
- package/dist/content/legacy/richText.js.map +1 -1
- package/dist/content/richText.d.ts +3 -3
- package/dist/content/slice.d.ts +15 -15
- package/dist/content/slices.d.ts +15 -15
- package/dist/helpers/customTypeModel.d.ts +2 -2
- package/dist/helpers/customTypeModel.d.ts.map +1 -1
- package/dist/helpers/customTypeModel.js +1 -1
- package/dist/helpers/customTypeModel.js.map +1 -1
- package/dist/helpers/documentContent.d.ts +4 -3
- package/dist/helpers/documentContent.d.ts.map +1 -1
- package/dist/helpers/documentContent.js +12 -15
- package/dist/helpers/documentContent.js.map +1 -1
- package/dist/helpers/sliceContent.d.ts +4 -2
- package/dist/helpers/sliceContent.d.ts.map +1 -1
- package/dist/helpers/sliceContent.js +11 -2
- package/dist/helpers/sliceContent.js.map +1 -1
- package/dist/helpers/traverseContent.d.ts +2 -2
- package/dist/helpers/traverseContent.d.ts.map +1 -1
- package/dist/helpers/traverseContent.js +6 -3
- package/dist/helpers/traverseContent.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.js +2 -2
- package/dist/io-ts.d.ts +1072 -1022
- package/dist/io-ts.d.ts.map +1 -1
- package/dist/io-ts.js +5 -3
- package/dist/io-ts.js.map +1 -1
- package/dist/model/customType.d.ts +5 -1
- package/dist/model/customType.d.ts.map +1 -1
- package/dist/model/customType.js.map +1 -1
- package/dist/model/group.d.ts +32 -32
- package/dist/model/link.d.ts +27 -1
- package/dist/model/link.d.ts.map +1 -1
- package/dist/model/link.js +3 -3
- package/dist/model/link.js.map +1 -1
- package/dist/model/table.d.ts +3 -2
- package/dist/model/table.d.ts.map +1 -1
- package/dist/zod4.d.ts +90 -43
- package/dist/zod4.d.ts.map +1 -1
- package/dist/zod4.js +5 -3
- package/dist/zod4.js.map +1 -1
- package/package.json +8 -5
- package/src/content/codec/group.ts +1 -1
- package/src/content/codec/legacyContentCtx.ts +7 -1
- package/src/content/embed.ts +1 -1
- package/src/content/legacy/image.ts +2 -2
- package/src/content/legacy/richText.ts +1 -1
- package/src/helpers/customTypeModel.ts +3 -2
- package/src/helpers/documentContent.ts +21 -28
- package/src/helpers/sliceContent.ts +16 -0
- package/src/helpers/traverseContent.ts +8 -5
- package/src/index.ts +9 -3
- package/src/io-ts.ts +7 -1
- package/src/model/customType.ts +5 -0
- package/src/model/link.ts +4 -2
- package/src/zod4.ts +7 -1
|
@@ -63,7 +63,7 @@ export const GroupItemLegacyCodec = (
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
for (const [key, content] of input.value) {
|
|
66
|
-
const itemCtx = getFieldCtx({ fieldKey: key, ctx })
|
|
66
|
+
const itemCtx = getFieldCtx({ fieldKey: key, ctx: groupItemCtx })
|
|
67
67
|
|
|
68
68
|
const result = NestableAndGroupLegacyCodec(itemCtx).fromContent(content)
|
|
69
69
|
if (result) {
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import { v5 as uuidV5 } from "uuid"
|
|
1
2
|
import type { z } from "zod/mini"
|
|
2
3
|
|
|
3
4
|
import type { FieldOrSliceType } from "../../model/widget"
|
|
4
5
|
|
|
6
|
+
function uuidV5ForPath(path: string[]): string {
|
|
7
|
+
return uuidV5(JSON.stringify(path), uuidV5.URL)
|
|
8
|
+
}
|
|
9
|
+
|
|
5
10
|
interface LegacyContentCtxParams {
|
|
6
11
|
fieldKey: string
|
|
7
12
|
contentKey?: string
|
|
@@ -47,7 +52,8 @@ export class LegacyContentCtx {
|
|
|
47
52
|
this.keyOfType = `${prefixedKey}_TYPE`
|
|
48
53
|
this.keyOfKey = `${prefixedContentKey}_KEY`
|
|
49
54
|
this.fieldType = this.allTypes.get(this.prefixedKey)
|
|
50
|
-
this.fieldContentKey =
|
|
55
|
+
this.fieldContentKey =
|
|
56
|
+
this.allKeys.get(prefixedContentKey) ?? uuidV5ForPath([...this.contentPath, this.contentKey])
|
|
51
57
|
}
|
|
52
58
|
|
|
53
59
|
withContentKey(contentKey: string): LegacyContentCtx {
|
package/src/content/embed.ts
CHANGED
|
@@ -6,7 +6,7 @@ export const EmbedContentType = "EmbedContent" as const
|
|
|
6
6
|
|
|
7
7
|
export const EmbedContentSchema = z.extend(EmbedLegacySchema, {
|
|
8
8
|
__TYPE__: z.literal(EmbedContentType),
|
|
9
|
-
all: z.unknown(),
|
|
9
|
+
all: z.optional(z.unknown()),
|
|
10
10
|
})
|
|
11
11
|
|
|
12
12
|
export type EmbedContent = z.infer<typeof EmbedContentSchema>
|
|
@@ -29,8 +29,8 @@ export const ImageLegacyViewSchema = z.object({
|
|
|
29
29
|
height: z.number(),
|
|
30
30
|
edit: EditSchema,
|
|
31
31
|
url: z.optional(z.string()),
|
|
32
|
-
credits: z.optional(NonEmptyStringOrNullSchema),
|
|
33
|
-
alt: z.optional(NonEmptyStringOrNullSchema),
|
|
32
|
+
credits: z.optional(z._default(NonEmptyStringOrNullSchema, null)),
|
|
33
|
+
alt: z.optional(z._default(NonEmptyStringOrNullSchema, null)),
|
|
34
34
|
provider: z.nullish(z.string()),
|
|
35
35
|
})
|
|
36
36
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
DynamicCustomTypeModel,
|
|
3
3
|
DynamicCustomTypeModelTab,
|
|
4
|
+
FlattenedStaticCustomTypeModel,
|
|
4
5
|
StaticCustomTypeModel,
|
|
5
6
|
StaticCustomTypeModelTab,
|
|
6
7
|
} from "../model/customType"
|
|
@@ -92,11 +93,11 @@ export function flatten(
|
|
|
92
93
|
}
|
|
93
94
|
|
|
94
95
|
export function collectSharedSlices(
|
|
95
|
-
customType: StaticCustomTypeModel,
|
|
96
|
+
customType: StaticCustomTypeModel | FlattenedStaticCustomTypeModel,
|
|
96
97
|
): Record<string, SharedSliceModel> {
|
|
97
98
|
const sharedSlices: Record<string, SharedSliceModel> = {}
|
|
98
99
|
|
|
99
|
-
const flattened = flatten(customType)
|
|
100
|
+
const flattened = "fields" in customType ? customType.fields : flatten(customType)
|
|
100
101
|
for (const widget of Object.values(flattened)) {
|
|
101
102
|
if (widget.type === "Slices" || widget.type === "Choice") {
|
|
102
103
|
for (const [id, model] of Object.entries(widget.config?.choices || {})) {
|
|
@@ -5,10 +5,8 @@ import { defaultCtx } from "../content/codec/legacyContentCtx"
|
|
|
5
5
|
import type { DocumentContent } from "../content/document"
|
|
6
6
|
import type { DocumentLegacy } from "../content/legacy/document"
|
|
7
7
|
import { DocumentLegacySchema } from "../content/legacy/document"
|
|
8
|
-
import { isNestableContent } from "../content/nestable"
|
|
9
|
-
import type { CompositeSliceItemContent, LegacySliceItemContent } from "../content/slices"
|
|
10
8
|
import type { WidgetContent } from "../content/widget"
|
|
11
|
-
import type { StaticCustomTypeModel } from "../model/customType"
|
|
9
|
+
import type { FlattenedStaticCustomTypeModel, StaticCustomTypeModel } from "../model/customType"
|
|
12
10
|
import type { FieldOrSliceType } from "../model/widget"
|
|
13
11
|
import { FieldOrSliceTypeSchema } from "../model/widget"
|
|
14
12
|
import * as contentPath from "./contentPath"
|
|
@@ -42,6 +40,24 @@ export function collectWidgets<TWidgetContent extends WidgetContent>(
|
|
|
42
40
|
return collected
|
|
43
41
|
}
|
|
44
42
|
|
|
43
|
+
export function migrateDocument(
|
|
44
|
+
document: DocumentContent,
|
|
45
|
+
model: StaticCustomTypeModel | FlattenedStaticCustomTypeModel,
|
|
46
|
+
): DocumentContent {
|
|
47
|
+
const needsMigration = Object.values(customTypeModel.collectSharedSlices(model)).some((slice) =>
|
|
48
|
+
Boolean(slice.legacyPaths),
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
if (needsMigration) {
|
|
52
|
+
return traverseDocumentContent(document, {
|
|
53
|
+
model,
|
|
54
|
+
transformSlice: sliceContent.migrateSliceItem,
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return document
|
|
59
|
+
}
|
|
60
|
+
|
|
45
61
|
export function fromLegacy(
|
|
46
62
|
legacy: DocumentLegacy,
|
|
47
63
|
model: StaticCustomTypeModel,
|
|
@@ -61,7 +77,7 @@ export function fromLegacy(
|
|
|
61
77
|
types.set(key.substring(0, key.length - 5), parsed.data)
|
|
62
78
|
}
|
|
63
79
|
} else if (key.endsWith("_KEY")) {
|
|
64
|
-
const parsed = z.uuidv4().safeParse(value)
|
|
80
|
+
const parsed = z.union([z.uuidv4(), z.uuid({ version: "v5" })]).safeParse(value)
|
|
65
81
|
if (parsed.success) {
|
|
66
82
|
keys.set(key.substring(0, key.length - 4), parsed.data)
|
|
67
83
|
}
|
|
@@ -75,30 +91,7 @@ export function fromLegacy(
|
|
|
75
91
|
return
|
|
76
92
|
}
|
|
77
93
|
|
|
78
|
-
|
|
79
|
-
Boolean(slice.legacyPaths),
|
|
80
|
-
)
|
|
81
|
-
|
|
82
|
-
if (needsMigration) {
|
|
83
|
-
return traverseDocumentContent(result.data, {
|
|
84
|
-
model,
|
|
85
|
-
transformSlice: ({ content, model }) => {
|
|
86
|
-
if (model?.type === "SharedSlice") {
|
|
87
|
-
if (content.widget.__TYPE__ === "CompositeSliceContent") {
|
|
88
|
-
return sliceContent.compositeToShared(content as CompositeSliceItemContent, model)
|
|
89
|
-
} else if (
|
|
90
|
-
content.widget.__TYPE__ === "GroupContentType" ||
|
|
91
|
-
isNestableContent(content.widget)
|
|
92
|
-
) {
|
|
93
|
-
return sliceContent.legacyToShared(content as LegacySliceItemContent, model)
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return content
|
|
97
|
-
},
|
|
98
|
-
})
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return result.data
|
|
94
|
+
return migrateDocument(result.data, model)
|
|
102
95
|
}
|
|
103
96
|
|
|
104
97
|
export function toLegacy(document: DocumentContent): DocumentLegacy {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { GroupItemContent } from "../content/group"
|
|
2
|
+
import { isNestableContent } from "../content/nestable"
|
|
2
3
|
import type { SharedSliceContent } from "../content/slice"
|
|
3
4
|
import type {
|
|
4
5
|
CompositeSliceItemContent,
|
|
@@ -6,6 +7,21 @@ import type {
|
|
|
6
7
|
SharedSliceItemContent,
|
|
7
8
|
} from "../content/slices"
|
|
8
9
|
import type { SharedSliceVariationContentModel } from "../model/slice"
|
|
10
|
+
import type { TraverseSliceContentFunction } from "./traverseContent"
|
|
11
|
+
|
|
12
|
+
export const migrateSliceItem: TraverseSliceContentFunction = ({ content, model }) => {
|
|
13
|
+
if (model?.type === "SharedSlice") {
|
|
14
|
+
if (content.widget.__TYPE__ === "CompositeSliceContent") {
|
|
15
|
+
return compositeToShared(content as CompositeSliceItemContent, model)
|
|
16
|
+
} else if (
|
|
17
|
+
content.widget.__TYPE__ === "GroupContentType" ||
|
|
18
|
+
isNestableContent(content.widget)
|
|
19
|
+
) {
|
|
20
|
+
return legacyToShared(content as LegacySliceItemContent, model)
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return content
|
|
24
|
+
}
|
|
9
25
|
|
|
10
26
|
export const legacyToShared = (
|
|
11
27
|
content: LegacySliceItemContent,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
} from "../content/slices"
|
|
18
18
|
import { TableContentType, type TableContent } from "../content/table"
|
|
19
19
|
import type { WidgetContent } from "../content/widget"
|
|
20
|
-
import type { StaticCustomTypeModel } from "../model/customType"
|
|
20
|
+
import type { FlattenedStaticCustomTypeModel, StaticCustomTypeModel } from "../model/customType"
|
|
21
21
|
import type { GroupModel, NestedGroupModel } from "../model/group"
|
|
22
22
|
import type { LinkModel } from "../model/link"
|
|
23
23
|
import type { NestableModel } from "../model/nestable"
|
|
@@ -36,7 +36,7 @@ import * as contentPath from "./contentPath"
|
|
|
36
36
|
import * as customTypeModel from "./customTypeModel"
|
|
37
37
|
|
|
38
38
|
type TraverseDocumentContentConfig = {
|
|
39
|
-
model?: StaticCustomTypeModel
|
|
39
|
+
model?: StaticCustomTypeModel | FlattenedStaticCustomTypeModel
|
|
40
40
|
transformWidget?: TraverseWidgetContentFunction
|
|
41
41
|
transformSlice?: TraverseSliceContentFunction
|
|
42
42
|
}
|
|
@@ -48,17 +48,20 @@ export function traverseDocumentContent(
|
|
|
48
48
|
const { model, transformWidget, transformSlice } = config
|
|
49
49
|
|
|
50
50
|
// Remove tabs from custom type model
|
|
51
|
-
const flatModel =
|
|
51
|
+
const flatModel =
|
|
52
|
+
model && !("fields" in model)
|
|
53
|
+
? { customTypeId: model.id, fields: customTypeModel.flatten(model) }
|
|
54
|
+
: model
|
|
52
55
|
|
|
53
56
|
const traversed: DocumentContent = {}
|
|
54
57
|
for (const [key, content] of Object.entries(document)) {
|
|
55
58
|
const path = contentPath.make(
|
|
56
|
-
{ key:
|
|
59
|
+
{ key: flatModel?.customTypeId, type: "CustomType" },
|
|
57
60
|
{ key, type: "Widget" },
|
|
58
61
|
)
|
|
59
62
|
|
|
60
63
|
const traversedContent = traverseWidgetContent(path, key, key, content, {
|
|
61
|
-
model: flatModel[key],
|
|
64
|
+
model: flatModel?.fields[key],
|
|
62
65
|
transformWidget,
|
|
63
66
|
transformSlice,
|
|
64
67
|
})
|
package/src/index.ts
CHANGED
|
@@ -64,6 +64,7 @@ export type {
|
|
|
64
64
|
CustomTypeModel,
|
|
65
65
|
StaticCustomTypeModelTab,
|
|
66
66
|
DynamicCustomTypeModelTab,
|
|
67
|
+
FlattenedStaticCustomTypeModel,
|
|
67
68
|
} from "./model/customType"
|
|
68
69
|
export type { DateModel } from "./model/date"
|
|
69
70
|
export type { AddedDiff, RemovedDiff, UpdatedDiff, Diff } from "./model/diff/changes"
|
|
@@ -83,7 +84,7 @@ export type { GeoPointModel } from "./model/geopoint"
|
|
|
83
84
|
export type { GroupModel, NestedGroupModel } from "./model/group"
|
|
84
85
|
export type { ImageModel } from "./model/image"
|
|
85
86
|
export type { IntegrationFieldModel } from "./model/integrationField"
|
|
86
|
-
export type { LinkModel } from "./model/link"
|
|
87
|
+
export type { LinkModel, LinkConfigCustomtypes } from "./model/link"
|
|
87
88
|
export type { NestableModel } from "./model/nestable"
|
|
88
89
|
export type { NumberModel } from "./model/number"
|
|
89
90
|
export type { RangeModel } from "./model/range"
|
|
@@ -105,11 +106,16 @@ export type {
|
|
|
105
106
|
} from "./model/slice"
|
|
106
107
|
export type { DynamicSlicesModel, StaticSlicesModel } from "./model/slices"
|
|
107
108
|
export type { TableModel } from "./model/table"
|
|
108
|
-
export { TableCellModelNodeTypes } from "./model/table"
|
|
109
|
+
export { TableCellModel, TableCellModelNodeTypes } from "./model/table"
|
|
109
110
|
export type { TextModel } from "./model/text"
|
|
110
111
|
export type { TimestampModel } from "./model/timestamp"
|
|
111
112
|
export type { UIDModel } from "./model/uid"
|
|
112
|
-
export type {
|
|
113
|
+
export type {
|
|
114
|
+
StaticWidgetModel,
|
|
115
|
+
DynamicWidgetModel,
|
|
116
|
+
FieldModelType,
|
|
117
|
+
FieldOrSliceType,
|
|
118
|
+
} from "./model/widget"
|
|
113
119
|
|
|
114
120
|
// Legacy
|
|
115
121
|
export { LegacyContentCtx, getFieldCtx, defaultCtx } from "./content/codec/legacyContentCtx"
|
package/src/io-ts.ts
CHANGED
|
@@ -112,7 +112,10 @@ import {
|
|
|
112
112
|
} from "./model/group"
|
|
113
113
|
import { ImageModelSchema as rawImageModelSchema } from "./model/image"
|
|
114
114
|
import { IntegrationFieldModelSchema as rawIntegrationFieldModelSchema } from "./model/integrationField"
|
|
115
|
-
import {
|
|
115
|
+
import {
|
|
116
|
+
LinkModelSchema as rawLinkModelSchema,
|
|
117
|
+
LinkConfigCustomtypesSchema as rawLinkConfigCustomtypesSchema,
|
|
118
|
+
} from "./model/link"
|
|
116
119
|
import { NestableModelSchema as rawNestableModelSchema } from "./model/nestable"
|
|
117
120
|
import { NumberModelSchema as rawNumberModelSchema } from "./model/number"
|
|
118
121
|
import { RangeModelSchema as rawRangeModelSchema } from "./model/range"
|
|
@@ -140,6 +143,7 @@ import { UIDModelSchema as rawUIDModelSchema } from "./model/uid"
|
|
|
140
143
|
import {
|
|
141
144
|
StaticWidgetModelSchema as rawStaticWidgetModelSchema,
|
|
142
145
|
DynamicWidgetModelSchema as rawDynamicWidgetModelSchema,
|
|
146
|
+
FieldOrSliceTypeSchema as rawFieldOrSliceTypeSchema,
|
|
143
147
|
} from "./model/widget"
|
|
144
148
|
|
|
145
149
|
// Common
|
|
@@ -231,6 +235,7 @@ export const GeoPointModelSchema = toIOTS(rawGeoPointModelSchema)
|
|
|
231
235
|
export const ImageModelSchema = toIOTS(rawImageModelSchema)
|
|
232
236
|
export const IntegrationFieldModelSchema = toIOTS(rawIntegrationFieldModelSchema)
|
|
233
237
|
export const LinkModelSchema = toIOTS(rawLinkModelSchema)
|
|
238
|
+
export const LinkConfigCustomtypesSchema = toIOTS(rawLinkConfigCustomtypesSchema)
|
|
234
239
|
export const NestableModelSchema = toIOTS(rawNestableModelSchema)
|
|
235
240
|
export const NumberModelSchema = toIOTS(rawNumberModelSchema)
|
|
236
241
|
export const RangeModelSchema = toIOTS(rawRangeModelSchema)
|
|
@@ -255,6 +260,7 @@ export const DynamicSlicesModelSchema = toIOTS(rawDynamicSlicesModelSchema)
|
|
|
255
260
|
export const StaticSlicesModelSchema = toIOTS(rawStaticSlicesModelSchema)
|
|
256
261
|
export const StaticWidgetModelSchema = toIOTS(rawStaticWidgetModelSchema)
|
|
257
262
|
export const DynamicWidgetModelSchema = toIOTS(rawDynamicWidgetModelSchema)
|
|
263
|
+
export const FieldOrSliceTypeSchema = toIOTS(rawFieldOrSliceTypeSchema)
|
|
258
264
|
export const StaticCustomTypeModelTabSchema = toIOTS(rawStaticCustomTypeModelTabSchema)
|
|
259
265
|
export const DynamicCustomTypeModelTabSchema = toIOTS(rawDynamicCustomTypeModelTabSchema)
|
|
260
266
|
export const StaticCustomTypeModelSchema = toIOTS(rawStaticCustomTypeModelSchema)
|
package/src/model/customType.ts
CHANGED
|
@@ -78,6 +78,11 @@ const createCustomTypeSchema = <
|
|
|
78
78
|
export const StaticCustomTypeModelSchema = createCustomTypeSchema(StaticCustomTypeModelTabSchema)
|
|
79
79
|
export type StaticCustomTypeModel = z.infer<typeof StaticCustomTypeModelSchema>
|
|
80
80
|
|
|
81
|
+
export type FlattenedStaticCustomTypeModel = {
|
|
82
|
+
customTypeId: string
|
|
83
|
+
fields: StaticCustomTypeModelTab
|
|
84
|
+
}
|
|
85
|
+
|
|
81
86
|
export const DynamicCustomTypeModelSchema = createCustomTypeSchema(DynamicCustomTypeModelTabSchema)
|
|
82
87
|
export type DynamicCustomTypeModel = z.infer<typeof DynamicCustomTypeModelSchema>
|
|
83
88
|
|
package/src/model/link.ts
CHANGED
|
@@ -75,7 +75,7 @@ const CustomTypeLevel1Schema = z.union([
|
|
|
75
75
|
z.object({ id: z.string(), fields: CustomTypeLevel1FieldsSchema }),
|
|
76
76
|
])
|
|
77
77
|
|
|
78
|
-
const
|
|
78
|
+
export const LinkConfigCustomtypesSchema = z.array(CustomTypeLevel1Schema).check(({ value, issues }) => {
|
|
79
79
|
const cts = value as ({ id: string } | string)[]
|
|
80
80
|
const push = (message: string) => issues.push({ code: "custom", input: value, message })
|
|
81
81
|
const strings = new Set<string>()
|
|
@@ -104,6 +104,8 @@ const CustomTypesSchema = z.array(CustomTypeLevel1Schema).check(({ value, issues
|
|
|
104
104
|
}
|
|
105
105
|
})
|
|
106
106
|
|
|
107
|
+
export type LinkConfigCustomtypes = z.infer<typeof LinkConfigCustomtypesSchema>
|
|
108
|
+
|
|
107
109
|
// --- Select with fallback to null ---
|
|
108
110
|
|
|
109
111
|
const SelectWithFallbackSchema = z.pipe(
|
|
@@ -123,7 +125,7 @@ const LinkConfigSchema = z.object({
|
|
|
123
125
|
useAsTitle: z.optional(z.boolean()),
|
|
124
126
|
placeholder: z.optional(z.string()),
|
|
125
127
|
select: z.optional(SelectWithFallbackSchema),
|
|
126
|
-
customtypes: z.optional(
|
|
128
|
+
customtypes: z.optional(LinkConfigCustomtypesSchema),
|
|
127
129
|
masks: z.optional(MasksArrayStringSchema),
|
|
128
130
|
tags: z.optional(MasksArrayStringSchema),
|
|
129
131
|
allowTargetBlank: z.optional(z.boolean()),
|
package/src/zod4.ts
CHANGED
|
@@ -76,7 +76,10 @@ import {
|
|
|
76
76
|
} from "./model/group"
|
|
77
77
|
import { ImageModelSchema as rawImageModelSchema } from "./model/image"
|
|
78
78
|
import { IntegrationFieldModelSchema as rawIntegrationFieldModelSchema } from "./model/integrationField"
|
|
79
|
-
import {
|
|
79
|
+
import {
|
|
80
|
+
LinkModelSchema as rawLinkModelSchema,
|
|
81
|
+
LinkConfigCustomtypesSchema as rawLinkConfigCustomtypesSchema,
|
|
82
|
+
} from "./model/link"
|
|
80
83
|
import { NestableModelSchema as rawNestableModelSchema } from "./model/nestable"
|
|
81
84
|
import { NumberModelSchema as rawNumberModelSchema } from "./model/number"
|
|
82
85
|
import { RangeModelSchema as rawRangeModelSchema } from "./model/range"
|
|
@@ -104,6 +107,7 @@ import { UIDModelSchema as rawUIDModelSchema } from "./model/uid"
|
|
|
104
107
|
import {
|
|
105
108
|
StaticWidgetModelSchema as rawStaticWidgetModelSchema,
|
|
106
109
|
DynamicWidgetModelSchema as rawDynamicWidgetModelSchema,
|
|
110
|
+
FieldOrSliceTypeSchema as rawFieldOrSliceTypeSchema,
|
|
107
111
|
} from "./model/widget"
|
|
108
112
|
|
|
109
113
|
// Common
|
|
@@ -163,6 +167,7 @@ export const GeoPointModelSchema = toZod4(rawGeoPointModelSchema)
|
|
|
163
167
|
export const ImageModelSchema = toZod4(rawImageModelSchema)
|
|
164
168
|
export const IntegrationFieldModelSchema = toZod4(rawIntegrationFieldModelSchema)
|
|
165
169
|
export const LinkModelSchema = toZod4(rawLinkModelSchema)
|
|
170
|
+
export const LinkConfigCustomtypesSchema = toZod4(rawLinkConfigCustomtypesSchema)
|
|
166
171
|
export const NestableModelSchema = toZod4(rawNestableModelSchema)
|
|
167
172
|
export const NumberModelSchema = toZod4(rawNumberModelSchema)
|
|
168
173
|
export const RangeModelSchema = toZod4(rawRangeModelSchema)
|
|
@@ -187,6 +192,7 @@ export const DynamicSlicesModelSchema = toZod4(rawDynamicSlicesModelSchema)
|
|
|
187
192
|
export const StaticSlicesModelSchema = toZod4(rawStaticSlicesModelSchema)
|
|
188
193
|
export const StaticWidgetModelSchema = toZod4(rawStaticWidgetModelSchema)
|
|
189
194
|
export const DynamicWidgetModelSchema = toZod4(rawDynamicWidgetModelSchema)
|
|
195
|
+
export const FieldOrSliceTypeSchema = toZod4(rawFieldOrSliceTypeSchema)
|
|
190
196
|
export const StaticCustomTypeModelTabSchema = toZod4(rawStaticCustomTypeModelTabSchema)
|
|
191
197
|
export const DynamicCustomTypeModelTabSchema = toZod4(rawDynamicCustomTypeModelTabSchema)
|
|
192
198
|
export const StaticCustomTypeModelSchema = toZod4(rawStaticCustomTypeModelSchema)
|