@prismicio/types-internal 4.0.0-pr.6.09bccf8 → 4.0.0-pr.6.38cb7de
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/document.js +1 -1
- package/dist/content/codec/legacyContentCtx.d.ts.map +1 -1
- package/dist/content/codec/legacyContentCtx.js.map +1 -1
- package/dist/content/codec/link.js +8 -8
- package/dist/content/codec/link.js.map +1 -1
- package/dist/content/codec/richText.js +2 -2
- package/dist/content/codec/richText.js.map +1 -1
- package/dist/content/codec/slice.js.map +1 -1
- package/dist/content/document.d.ts +2 -3019
- package/dist/content/document.d.ts.map +1 -1
- package/dist/content/field.d.ts +1 -30
- package/dist/content/field.d.ts.map +1 -1
- package/dist/content/field.js.map +1 -1
- package/dist/content/group.d.ts +2 -1
- package/dist/content/group.d.ts.map +1 -1
- package/dist/content/group.js.map +1 -1
- package/dist/content/legacy/boolean.d.ts +1 -0
- package/dist/content/legacy/embed.d.ts +1 -0
- package/dist/content/legacy/empty.d.ts +1 -0
- package/dist/content/legacy/field.d.ts +1 -0
- package/dist/content/legacy/geopoint.d.ts +1 -0
- package/dist/content/legacy/group.d.ts +9 -0
- package/dist/content/legacy/group.d.ts.map +1 -0
- package/dist/content/legacy/group.js.map +1 -1
- package/dist/content/legacy/integrationField.d.ts +1 -0
- package/dist/content/legacy/link.d.ts +41 -0
- package/dist/content/legacy/link.d.ts.map +1 -0
- package/dist/content/legacy/link.js.map +1 -1
- package/dist/content/legacy/nestable.d.ts +1 -0
- package/dist/content/legacy/nestable.js.map +1 -1
- package/dist/content/legacy/repeatable.d.ts +1 -0
- package/dist/content/legacy/richText.d.ts +109 -0
- package/dist/content/legacy/richText.d.ts.map +1 -0
- package/dist/content/legacy/richText.js +3 -3
- package/dist/content/legacy/richText.js.map +1 -1
- package/dist/content/legacy/separator.d.ts +1 -0
- package/dist/content/legacy/slice.js.map +1 -1
- package/dist/content/legacy/table.d.ts +1 -0
- package/dist/content/link.d.ts +74 -99
- package/dist/content/link.d.ts.map +1 -1
- package/dist/content/link.js +2 -2
- package/dist/content/link.js.map +1 -1
- package/dist/content/nestable.d.ts +13 -749
- package/dist/content/nestable.d.ts.map +1 -1
- package/dist/content/nestable.js.map +1 -1
- package/dist/content/repeatable.d.ts +3 -98
- package/dist/content/repeatable.d.ts.map +1 -1
- package/dist/content/richText.d.ts +81 -131
- package/dist/content/richText.d.ts.map +1 -1
- package/dist/content/richText.js +5 -4
- package/dist/content/richText.js.map +1 -1
- package/dist/content/slice.d.ts +6 -4509
- package/dist/content/slice.d.ts.map +1 -1
- package/dist/content/slice.js.map +1 -1
- package/dist/content/slices.d.ts +8 -6765
- package/dist/content/slices.d.ts.map +1 -1
- package/dist/content/slices.js +4 -4
- package/dist/content/slices.js.map +1 -1
- package/dist/content/table.d.ts +2 -134
- package/dist/content/table.d.ts.map +1 -1
- package/dist/content/widget.d.ts +5 -3020
- package/dist/content/widget.d.ts.map +1 -1
- package/dist/content/widget.js.map +1 -1
- package/dist/helpers/customTypeModel.d.ts +1 -1
- package/dist/helpers/customTypeModel.d.ts.map +1 -1
- package/dist/helpers/customTypeModel.js.map +1 -1
- package/dist/helpers/documentContent.d.ts +3 -9
- package/dist/helpers/documentContent.d.ts.map +1 -1
- package/dist/helpers/documentContent.js +5 -5
- package/dist/helpers/documentContent.js.map +1 -1
- package/dist/helpers/traverseContent.d.ts +16 -17
- package/dist/helpers/traverseContent.d.ts.map +1 -1
- package/dist/helpers/traverseContent.js +4 -4
- package/dist/helpers/traverseContent.js.map +1 -1
- package/dist/helpers/traverseContentWithModel.d.ts +16 -17
- package/dist/helpers/traverseContentWithModel.d.ts.map +1 -1
- package/dist/helpers/traverseContentWithModel.js +4 -4
- package/dist/helpers/traverseContentWithModel.js.map +1 -1
- package/dist/index.d.ts +26 -26
- package/dist/index.js +2 -1
- package/dist/io-ts.d.ts +3380 -67677
- package/dist/io-ts.d.ts.map +1 -1
- package/dist/io-ts.js +125 -119
- package/dist/io-ts.js.map +1 -1
- package/dist/model/customType.d.ts +3 -3329
- package/dist/model/customType.d.ts.map +1 -1
- package/dist/model/group.d.ts +391 -392
- package/dist/model/group.d.ts.map +1 -1
- package/dist/model/group.js.map +1 -1
- package/dist/model/image.d.ts +4 -4
- package/dist/model/image.js.map +1 -1
- package/dist/model/link.d.ts +18 -18
- package/dist/model/link.d.ts.map +1 -1
- package/dist/model/link.js +7 -7
- package/dist/model/link.js.map +1 -1
- package/dist/model/nestable.d.ts +17 -178
- package/dist/model/nestable.d.ts.map +1 -1
- package/dist/model/nestable.js +2 -2
- package/dist/model/nestable.js.map +1 -1
- package/dist/model/richText.d.ts +3 -7
- package/dist/model/richText.d.ts.map +1 -1
- package/dist/model/richText.js +4 -3
- package/dist/model/richText.js.map +1 -1
- package/dist/model/section.d.ts +3 -3329
- package/dist/model/section.d.ts.map +1 -1
- package/dist/model/select.d.ts +1 -1
- package/dist/model/select.js +1 -1
- package/dist/model/select.js.map +1 -1
- package/dist/model/slice.d.ts +861 -3800
- package/dist/model/slice.d.ts.map +1 -1
- package/dist/model/slice.js +7 -2
- package/dist/model/slice.js.map +1 -1
- package/dist/model/slices.d.ts +3 -2195
- package/dist/model/slices.d.ts.map +1 -1
- package/dist/model/table.d.ts +2 -1
- package/dist/model/table.d.ts.map +1 -1
- package/dist/model/table.js +9 -7
- package/dist/model/table.js.map +1 -1
- package/dist/model/widget.d.ts +6 -3331
- package/dist/model/widget.d.ts.map +1 -1
- package/dist/model/widget.js.map +1 -1
- package/dist/zod4.d.ts +1345 -32523
- package/dist/zod4.d.ts.map +1 -1
- package/dist/zod4.js +125 -119
- package/dist/zod4.js.map +1 -1
- package/package.json +3 -2
- package/src/content/codec/legacyContentCtx.ts +1 -0
- package/src/content/codec/link.ts +8 -8
- package/src/content/codec/richText.ts +10 -6
- package/src/content/codec/slice.ts +3 -1
- package/src/content/field.ts +9 -2
- package/src/content/group.ts +5 -2
- package/src/content/legacy/group.ts +10 -4
- package/src/content/legacy/link.ts +32 -9
- package/src/content/legacy/nestable.ts +26 -2
- package/src/content/legacy/richText.ts +40 -7
- package/src/content/legacy/slice.ts +2 -2
- package/src/content/legacy/widget.ts +6 -2
- package/src/content/link.ts +32 -9
- package/src/content/nestable.ts +40 -2
- package/src/content/richText.ts +31 -9
- package/src/content/slice.ts +2 -2
- package/src/content/slices.ts +5 -3
- package/src/content/widget.ts +6 -2
- package/src/helpers/customTypeModel.ts +6 -3
- package/src/helpers/documentContent.ts +24 -29
- package/src/helpers/traverseContent.ts +32 -27
- package/src/helpers/traverseContentWithModel.ts +35 -27
- package/src/index.ts +11 -3
- package/src/io-ts.ts +173 -134
- package/src/model/group.ts +4 -1
- package/src/model/image.ts +1 -1
- package/src/model/link.ts +39 -45
- package/src/model/nestable.ts +33 -1
- package/src/model/richText.ts +2 -2
- package/src/model/select.ts +2 -2
- package/src/model/slice.ts +36 -9
- package/src/model/table.ts +10 -2
- package/src/model/widget.ts +10 -9
- package/src/zod4.ts +168 -133
package/src/io-ts.ts
CHANGED
|
@@ -2,13 +2,13 @@ import * as t from "io-ts"
|
|
|
2
2
|
import type { ZodMiniType } from "zod/mini"
|
|
3
3
|
|
|
4
4
|
// Common
|
|
5
|
-
import { AssetSchema } from "./common/asset"
|
|
6
|
-
import { EmbedSchema } from "./common/embed"
|
|
7
|
-
import { HexaColorCodeSchema } from "./common/hexaColorCode"
|
|
8
|
-
import { NonEmptyStringSchema } from "./common/nonEmptyString"
|
|
9
|
-
import { WidgetKeySchema } from "./common/widgetKey"
|
|
5
|
+
import { AssetSchema as rawAssetSchema } from "./common/asset"
|
|
6
|
+
import { EmbedSchema as rawEmbedSchema } from "./common/embed"
|
|
7
|
+
import { HexaColorCodeSchema as rawHexaColorCodeSchema } from "./common/hexaColorCode"
|
|
8
|
+
import { NonEmptyStringSchema as rawNonEmptyStringSchema } from "./common/nonEmptyString"
|
|
9
|
+
import { WidgetKeySchema as rawWidgetKeySchema } from "./common/widgetKey"
|
|
10
10
|
// Content
|
|
11
|
-
import { BooleanContentSchema } from "./content/boolean"
|
|
11
|
+
import { BooleanContentSchema as rawBooleanContentSchema } from "./content/boolean"
|
|
12
12
|
import { BooleanLegacyCodec } from "./content/codec/boolean"
|
|
13
13
|
import { DocumentLegacyCodec } from "./content/codec/document"
|
|
14
14
|
import { EmbedLegacyCodec } from "./content/codec/embed"
|
|
@@ -42,110 +42,144 @@ import { SliceItemLegacyCodec, SlicesLegacyCodec } from "./content/codec/slices"
|
|
|
42
42
|
import { TableLegacyCodec } from "./content/codec/table"
|
|
43
43
|
import { UIDLegacyCodec } from "./content/codec/uid"
|
|
44
44
|
import { WidgetLegacyCodec } from "./content/codec/widget"
|
|
45
|
-
import { DocumentContentSchema } from "./content/document"
|
|
46
|
-
import { EmbedContentSchema } from "./content/embed"
|
|
47
|
-
import { EmptyContentSchema } from "./content/empty"
|
|
45
|
+
import { DocumentContentSchema as rawDocumentContentSchema } from "./content/document"
|
|
46
|
+
import { EmbedContentSchema as rawEmbedContentSchema } from "./content/embed"
|
|
47
|
+
import { EmptyContentSchema as rawEmptyContentSchema } from "./content/empty"
|
|
48
48
|
import {
|
|
49
|
-
ColorContentSchema,
|
|
50
|
-
DateContentSchema,
|
|
51
|
-
NumberContentSchema,
|
|
52
|
-
RangeContentSchema,
|
|
53
|
-
SelectContentSchema,
|
|
54
|
-
TextContentSchema,
|
|
55
|
-
TimestampContentSchema,
|
|
56
|
-
FieldContentSchema,
|
|
49
|
+
ColorContentSchema as rawColorContentSchema,
|
|
50
|
+
DateContentSchema as rawDateContentSchema,
|
|
51
|
+
NumberContentSchema as rawNumberContentSchema,
|
|
52
|
+
RangeContentSchema as rawRangeContentSchema,
|
|
53
|
+
SelectContentSchema as rawSelectContentSchema,
|
|
54
|
+
TextContentSchema as rawTextContentSchema,
|
|
55
|
+
TimestampContentSchema as rawTimestampContentSchema,
|
|
56
|
+
FieldContentSchema as rawFieldContentSchema,
|
|
57
57
|
} from "./content/field"
|
|
58
|
-
import { GeoPointContentSchema } from "./content/geopoint"
|
|
59
|
-
import { GroupContentSchema, GroupItemContentSchema } from "./content/group"
|
|
60
|
-
import { ImageContentSchema } from "./content/image"
|
|
61
|
-
import { IntegrationFieldContentSchema } from "./content/integrationField"
|
|
62
|
-
import { LinkContentSchema } from "./content/link"
|
|
63
|
-
import { NestableContentSchema } from "./content/nestable"
|
|
64
|
-
import { RepeatableContentSchema } from "./content/repeatable"
|
|
65
|
-
import { RichTextContentSchema } from "./content/richText"
|
|
66
|
-
import { SeparatorContentSchema } from "./content/separator"
|
|
58
|
+
import { GeoPointContentSchema as rawGeoPointContentSchema } from "./content/geopoint"
|
|
67
59
|
import {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
60
|
+
GroupContentSchema as rawGroupContentSchema,
|
|
61
|
+
GroupItemContentSchema as rawGroupItemContentSchema,
|
|
62
|
+
} from "./content/group"
|
|
63
|
+
import { ImageContentSchema as rawImageContentSchema } from "./content/image"
|
|
64
|
+
import { IntegrationFieldContentSchema as rawIntegrationFieldContentSchema } from "./content/integrationField"
|
|
65
|
+
import { LinkContentSchema as rawLinkContentSchema } from "./content/link"
|
|
66
|
+
import { NestableContentSchema as rawNestableContentSchema } from "./content/nestable"
|
|
67
|
+
import { RepeatableContentSchema as rawRepeatableContentSchema } from "./content/repeatable"
|
|
68
|
+
import {
|
|
69
|
+
RichTextContentSchema as rawRichTextContentSchema,
|
|
70
|
+
RichTextContentBlockSchema as rawRichTextContentBlockSchema,
|
|
71
|
+
RichTextContentSpanSchema as rawRichTextContentSpanSchema,
|
|
72
|
+
} from "./content/richText"
|
|
73
|
+
import { SeparatorContentSchema as rawSeparatorContentSchema } from "./content/separator"
|
|
74
|
+
import {
|
|
75
|
+
LegacySliceContentSchema as rawLegacySliceContentSchema,
|
|
76
|
+
CompositeSliceContentSchema as rawCompositeSliceContentSchema,
|
|
77
|
+
SharedSliceContentSchema as rawSharedSliceContentSchema,
|
|
78
|
+
SliceContentSchema as rawSliceContentSchema,
|
|
72
79
|
} from "./content/slice"
|
|
73
|
-
import {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
80
|
+
import {
|
|
81
|
+
LegacySliceItemContentSchema as rawLegacySliceItemContentSchema,
|
|
82
|
+
CompositeSliceItemContentSchema as rawCompositeSliceItemContentSchema,
|
|
83
|
+
SharedSliceItemContentSchema as rawSharedSliceItemContentSchema,
|
|
84
|
+
SliceItemContentSchema as rawSliceItemContentSchema,
|
|
85
|
+
SlicesContentSchema as rawSlicesContentSchema,
|
|
86
|
+
} from "./content/slices"
|
|
87
|
+
import { TableContentSchema as rawTableContentSchema } from "./content/table"
|
|
88
|
+
import { UIDContentSchema as rawUIDContentSchema } from "./content/uid"
|
|
89
|
+
import { WidgetContentSchema as rawWidgetContentSchema } from "./content/widget"
|
|
77
90
|
// Model
|
|
78
|
-
import { BooleanModelSchema } from "./model/boolean"
|
|
79
|
-
import { ColorModelSchema } from "./model/color"
|
|
80
|
-
import {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
import {
|
|
85
|
-
import {
|
|
86
|
-
import {
|
|
87
|
-
import { LinkModelSchema } from "./model/link"
|
|
88
|
-
import { NestableModelSchema } from "./model/nestable"
|
|
89
|
-
import { NumberModelSchema } from "./model/number"
|
|
90
|
-
import { RangeModelSchema } from "./model/range"
|
|
91
|
-
import { RichTextModelSchema } from "./model/richText"
|
|
92
|
-
import { StaticSectionModelSchema, DynamicSectionModelSchema } from "./model/section"
|
|
93
|
-
import { SelectModelSchema } from "./model/select"
|
|
94
|
-
import { SeparatorModelSchema } from "./model/separator"
|
|
91
|
+
import { BooleanModelSchema as rawBooleanModelSchema } from "./model/boolean"
|
|
92
|
+
import { ColorModelSchema as rawColorModelSchema } from "./model/color"
|
|
93
|
+
import {
|
|
94
|
+
StaticCustomTypeModelSchema as rawStaticCustomTypeModelSchema,
|
|
95
|
+
CustomTypeModelSchema as rawCustomTypeModelSchema,
|
|
96
|
+
} from "./model/customType"
|
|
97
|
+
import { DateModelSchema as rawDateModelSchema } from "./model/date"
|
|
98
|
+
import { EmbedModelSchema as rawEmbedModelSchema } from "./model/embed"
|
|
99
|
+
import { GeoPointModelSchema as rawGeoPointModelSchema } from "./model/geopoint"
|
|
95
100
|
import {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
GroupModelSchema as rawGroupModelSchema,
|
|
102
|
+
NestedGroupModelSchema as rawNestedGroupModelSchema,
|
|
103
|
+
} from "./model/group"
|
|
104
|
+
import { ImageModelSchema as rawImageModelSchema } from "./model/image"
|
|
105
|
+
import { IntegrationFieldModelSchema as rawIntegrationFieldModelSchema } from "./model/integrationField"
|
|
106
|
+
import { LinkModelSchema as rawLinkModelSchema } from "./model/link"
|
|
107
|
+
import { NestableModelSchema as rawNestableModelSchema } from "./model/nestable"
|
|
108
|
+
import { NumberModelSchema as rawNumberModelSchema } from "./model/number"
|
|
109
|
+
import { RangeModelSchema as rawRangeModelSchema } from "./model/range"
|
|
110
|
+
import { RichTextModelSchema as rawRichTextModelSchema } from "./model/richText"
|
|
111
|
+
import {
|
|
112
|
+
StaticSectionModelSchema as rawStaticSectionModelSchema,
|
|
113
|
+
DynamicSectionModelSchema as rawDynamicSectionModelSchema,
|
|
114
|
+
} from "./model/section"
|
|
115
|
+
import { SelectModelSchema as rawSelectModelSchema } from "./model/select"
|
|
116
|
+
import { SeparatorModelSchema as rawSeparatorModelSchema } from "./model/separator"
|
|
117
|
+
import {
|
|
118
|
+
LegacySliceModelSchema as rawLegacySliceModelSchema,
|
|
119
|
+
CompositeSliceModelSchema as rawCompositeSliceModelSchema,
|
|
120
|
+
SharedSliceModelSchema as rawSharedSliceModelSchema,
|
|
121
|
+
SharedSliceRefModelSchema as rawSharedSliceRefModelSchema,
|
|
122
|
+
StaticSliceModelSchema as rawStaticSliceModelSchema,
|
|
123
|
+
DynamicSliceModelSchema as rawDynamicSliceModelSchema,
|
|
124
|
+
SliceContentModelSchema as rawSliceContentModelSchema,
|
|
102
125
|
} from "./model/slice"
|
|
103
|
-
import {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
import {
|
|
108
|
-
import {
|
|
126
|
+
import {
|
|
127
|
+
DynamicSlicesModelSchema as rawDynamicSlicesModelSchema,
|
|
128
|
+
StaticSlicesModelSchema as rawStaticSlicesModelSchema,
|
|
129
|
+
} from "./model/slices"
|
|
130
|
+
import { TableModelSchema as rawTableModelSchema } from "./model/table"
|
|
131
|
+
import { TextModelSchema as rawTextModelSchema } from "./model/text"
|
|
132
|
+
import { TimestampModelSchema as rawTimestampModelSchema } from "./model/timestamp"
|
|
133
|
+
import { UIDModelSchema as rawUIDModelSchema } from "./model/uid"
|
|
134
|
+
import {
|
|
135
|
+
StaticWidgetModelSchema as rawStaticWidgetModelSchema,
|
|
136
|
+
DynamicWidgetModelSchema as rawDynamicWidgetModelSchema,
|
|
137
|
+
} from "./model/widget"
|
|
109
138
|
|
|
110
139
|
// Common
|
|
111
|
-
export const
|
|
112
|
-
export const
|
|
113
|
-
export const
|
|
114
|
-
export const
|
|
115
|
-
export const
|
|
140
|
+
export const AssetSchema = toIOTS(rawAssetSchema)
|
|
141
|
+
export const EmbedSchema = toIOTS(rawEmbedSchema)
|
|
142
|
+
export const HexaColorCodeSchema = toIOTS(rawHexaColorCodeSchema)
|
|
143
|
+
export const NonEmptyStringSchema = toIOTS(rawNonEmptyStringSchema)
|
|
144
|
+
export const WidgetKeySchema = toIOTS(rawWidgetKeySchema)
|
|
116
145
|
|
|
117
146
|
// Content
|
|
118
|
-
export const
|
|
119
|
-
export const
|
|
120
|
-
export const
|
|
121
|
-
export const
|
|
122
|
-
export const
|
|
123
|
-
export const
|
|
124
|
-
export const
|
|
125
|
-
export const
|
|
126
|
-
export const
|
|
127
|
-
export const
|
|
128
|
-
export const
|
|
129
|
-
export const
|
|
130
|
-
export const
|
|
131
|
-
export const
|
|
132
|
-
export const
|
|
133
|
-
export const
|
|
134
|
-
export const
|
|
135
|
-
export const
|
|
136
|
-
export const
|
|
137
|
-
export const
|
|
138
|
-
export const
|
|
139
|
-
export const
|
|
140
|
-
export const
|
|
141
|
-
export const
|
|
142
|
-
export const
|
|
143
|
-
export const
|
|
144
|
-
export const
|
|
145
|
-
export const
|
|
146
|
-
export const
|
|
147
|
-
export const
|
|
148
|
-
export const
|
|
147
|
+
export const BooleanContentSchema = toIOTS(rawBooleanContentSchema)
|
|
148
|
+
export const ColorContentSchema = toIOTS(rawColorContentSchema)
|
|
149
|
+
export const DateContentSchema = toIOTS(rawDateContentSchema)
|
|
150
|
+
export const EmptyContentSchema = toIOTS(rawEmptyContentSchema)
|
|
151
|
+
export const GeoPointContentSchema = toIOTS(rawGeoPointContentSchema)
|
|
152
|
+
export const LinkContentSchema = toIOTS(rawLinkContentSchema)
|
|
153
|
+
export const NumberContentSchema = toIOTS(rawNumberContentSchema)
|
|
154
|
+
export const RangeContentSchema = toIOTS(rawRangeContentSchema)
|
|
155
|
+
export const SelectContentSchema = toIOTS(rawSelectContentSchema)
|
|
156
|
+
export const SeparatorContentSchema = toIOTS(rawSeparatorContentSchema)
|
|
157
|
+
export const SharedSliceContentSchema = toIOTS(rawSharedSliceContentSchema)
|
|
158
|
+
export const TextContentSchema = toIOTS(rawTextContentSchema)
|
|
159
|
+
export const TimestampContentSchema = toIOTS(rawTimestampContentSchema)
|
|
160
|
+
export const FieldContentSchema = toIOTS(rawFieldContentSchema)
|
|
161
|
+
export const UIDContentSchema = toIOTS(rawUIDContentSchema)
|
|
162
|
+
export const IntegrationFieldContentSchema = toIOTS(rawIntegrationFieldContentSchema)
|
|
163
|
+
export const EmbedContentSchema = toIOTS(rawEmbedContentSchema)
|
|
164
|
+
export const ImageContentSchema = toIOTS(rawImageContentSchema)
|
|
165
|
+
export const RichTextContentSchema = toIOTS(rawRichTextContentSchema)
|
|
166
|
+
export const RichTextContentBlockSchema = toIOTS(rawRichTextContentBlockSchema)
|
|
167
|
+
export const RichTextContentSpanSchema = toIOTS(rawRichTextContentSpanSchema)
|
|
168
|
+
export const TableContentSchema = toIOTS(rawTableContentSchema)
|
|
169
|
+
export const RepeatableContentSchema = toIOTS(rawRepeatableContentSchema)
|
|
170
|
+
export const NestableContentSchema = toIOTS(rawNestableContentSchema)
|
|
171
|
+
export const GroupContentSchema = toIOTS(rawGroupContentSchema)
|
|
172
|
+
export const GroupItemContentSchema = toIOTS(rawGroupItemContentSchema)
|
|
173
|
+
export const CompositeSliceContentSchema = toIOTS(rawCompositeSliceContentSchema)
|
|
174
|
+
export const LegacySliceContentSchema = toIOTS(rawLegacySliceContentSchema)
|
|
175
|
+
export const SliceContentSchema = toIOTS(rawSliceContentSchema)
|
|
176
|
+
export const LegacySliceItemContentSchema = toIOTS(rawLegacySliceItemContentSchema)
|
|
177
|
+
export const CompositeSliceItemContentSchema = toIOTS(rawCompositeSliceItemContentSchema)
|
|
178
|
+
export const SharedSliceItemContentSchema = toIOTS(rawSharedSliceItemContentSchema)
|
|
179
|
+
export const SliceItemContentSchema = toIOTS(rawSliceItemContentSchema)
|
|
180
|
+
export const SlicesContentSchema = toIOTS(rawSlicesContentSchema)
|
|
181
|
+
export const WidgetContentSchema = toIOTS(rawWidgetContentSchema)
|
|
182
|
+
export const DocumentContentSchema = toIOTS(rawDocumentContentSchema)
|
|
149
183
|
|
|
150
184
|
// Content legacy
|
|
151
185
|
export const BooleanLegacy = toIOTSCodec(BooleanLegacyCodec)
|
|
@@ -180,40 +214,41 @@ export const WidgetLegacy = toIOTSCodec(WidgetLegacyCodec)
|
|
|
180
214
|
export const DocumentLegacy = toIOTSCodec(DocumentLegacyCodec)
|
|
181
215
|
|
|
182
216
|
// Model
|
|
183
|
-
export const
|
|
184
|
-
export const
|
|
185
|
-
export const
|
|
186
|
-
export const
|
|
187
|
-
export const
|
|
188
|
-
export const
|
|
189
|
-
export const
|
|
190
|
-
export const
|
|
191
|
-
export const
|
|
192
|
-
export const
|
|
193
|
-
export const
|
|
194
|
-
export const
|
|
195
|
-
export const
|
|
196
|
-
export const
|
|
197
|
-
export const
|
|
198
|
-
export const
|
|
199
|
-
export const
|
|
200
|
-
export const
|
|
201
|
-
export const
|
|
202
|
-
export const
|
|
203
|
-
export const
|
|
204
|
-
export const
|
|
205
|
-
export const
|
|
206
|
-
export const
|
|
207
|
-
export const
|
|
208
|
-
export const
|
|
209
|
-
export const
|
|
210
|
-
export const
|
|
211
|
-
export const
|
|
212
|
-
export const
|
|
213
|
-
export const
|
|
214
|
-
export const
|
|
215
|
-
export const
|
|
216
|
-
export const
|
|
217
|
+
export const BooleanModelSchema = toIOTS(rawBooleanModelSchema)
|
|
218
|
+
export const ColorModelSchema = toIOTS(rawColorModelSchema)
|
|
219
|
+
export const DateModelSchema = toIOTS(rawDateModelSchema)
|
|
220
|
+
export const EmbedModelSchema = toIOTS(rawEmbedModelSchema)
|
|
221
|
+
export const GeoPointModelSchema = toIOTS(rawGeoPointModelSchema)
|
|
222
|
+
export const ImageModelSchema = toIOTS(rawImageModelSchema)
|
|
223
|
+
export const IntegrationFieldModelSchema = toIOTS(rawIntegrationFieldModelSchema)
|
|
224
|
+
export const LinkModelSchema = toIOTS(rawLinkModelSchema)
|
|
225
|
+
export const NestableModelSchema = toIOTS(rawNestableModelSchema)
|
|
226
|
+
export const NumberModelSchema = toIOTS(rawNumberModelSchema)
|
|
227
|
+
export const RangeModelSchema = toIOTS(rawRangeModelSchema)
|
|
228
|
+
export const RichTextModelSchema = toIOTS(rawRichTextModelSchema)
|
|
229
|
+
export const SelectModelSchema = toIOTS(rawSelectModelSchema)
|
|
230
|
+
export const SeparatorModelSchema = toIOTS(rawSeparatorModelSchema)
|
|
231
|
+
export const SharedSliceModelSchema = toIOTS(rawSharedSliceModelSchema)
|
|
232
|
+
export const TableModelSchema = toIOTS(rawTableModelSchema)
|
|
233
|
+
export const TextModelSchema = toIOTS(rawTextModelSchema)
|
|
234
|
+
export const TimestampModelSchema = toIOTS(rawTimestampModelSchema)
|
|
235
|
+
export const UIDModelSchema = toIOTS(rawUIDModelSchema)
|
|
236
|
+
export const GroupModelSchema = toIOTS(rawGroupModelSchema)
|
|
237
|
+
export const NestedGroupModelSchema = toIOTS(rawNestedGroupModelSchema)
|
|
238
|
+
export const SharedSliceRefModelSchema = toIOTS(rawSharedSliceRefModelSchema)
|
|
239
|
+
export const CompositeSliceModelSchema = toIOTS(rawCompositeSliceModelSchema)
|
|
240
|
+
export const LegacySliceModelSchema = toIOTS(rawLegacySliceModelSchema)
|
|
241
|
+
export const DynamicSliceModelSchema = toIOTS(rawDynamicSliceModelSchema)
|
|
242
|
+
export const StaticSliceModelSchema = toIOTS(rawStaticSliceModelSchema)
|
|
243
|
+
export const SliceContentModelSchema = toIOTS(rawSliceContentModelSchema)
|
|
244
|
+
export const DynamicSlicesModelSchema = toIOTS(rawDynamicSlicesModelSchema)
|
|
245
|
+
export const StaticSlicesModelSchema = toIOTS(rawStaticSlicesModelSchema)
|
|
246
|
+
export const StaticWidgetModelSchema = toIOTS(rawStaticWidgetModelSchema)
|
|
247
|
+
export const DynamicWidgetModelSchema = toIOTS(rawDynamicWidgetModelSchema)
|
|
248
|
+
export const StaticSectionModelSchema = toIOTS(rawStaticSectionModelSchema)
|
|
249
|
+
export const DynamicSectionModelSchema = toIOTS(rawDynamicSectionModelSchema)
|
|
250
|
+
export const StaticCustomTypeModelSchema = toIOTS(rawStaticCustomTypeModelSchema)
|
|
251
|
+
export const CustomTypeModelSchema = toIOTS(rawCustomTypeModelSchema)
|
|
217
252
|
|
|
218
253
|
function toIOTS<T>(type: ZodMiniType<T>): t.Type<T> {
|
|
219
254
|
return new t.Type<T>(
|
|
@@ -240,7 +275,11 @@ function toIOTSCodec<TArgs extends unknown[], A, LegacyRaw, AllowUndefined exten
|
|
|
240
275
|
) => t.Type<A, ReturnType<LegacyCodec<A, LegacyRaw, AllowUndefined>["fromContent"]>, unknown> {
|
|
241
276
|
return (...args: TArgs) => {
|
|
242
277
|
const codec = codecFactory(...args)
|
|
243
|
-
return new t.Type<
|
|
278
|
+
return new t.Type<
|
|
279
|
+
A,
|
|
280
|
+
ReturnType<LegacyCodec<A, LegacyRaw, AllowUndefined>["fromContent"]>,
|
|
281
|
+
unknown
|
|
282
|
+
>(
|
|
244
283
|
codec.name,
|
|
245
284
|
codec.is,
|
|
246
285
|
(input, context) => {
|
package/src/model/group.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod/mini"
|
|
2
2
|
|
|
3
3
|
import { WidgetKeySchema } from "../common/widgetKey"
|
|
4
|
+
import type { NestableModel } from "./nestable"
|
|
4
5
|
import { NestableModelSchema } from "./nestable"
|
|
5
6
|
|
|
6
7
|
export const GroupFieldType = "Group"
|
|
@@ -30,7 +31,9 @@ export type NestedGroupModel = z.infer<typeof NestedGroupModelSchema>
|
|
|
30
31
|
|
|
31
32
|
// Group - allows Nestable | NestedGroup in fields (max 2 levels of nesting)
|
|
32
33
|
export const GroupModelSchema = createGroupSchema(
|
|
33
|
-
z.union([NestableModelSchema, NestedGroupModelSchema])
|
|
34
|
+
z.union([NestableModelSchema, NestedGroupModelSchema]) as z.ZodMiniType<
|
|
35
|
+
NestableModel | NestedGroupModel
|
|
36
|
+
>,
|
|
34
37
|
)
|
|
35
38
|
|
|
36
39
|
export type GroupModel = z.infer<typeof GroupModelSchema>
|
package/src/model/image.ts
CHANGED
package/src/model/link.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { z } from "zod/mini"
|
|
|
3
3
|
// Accepts string | string[], normalizes string to [string]
|
|
4
4
|
const MasksArrayStringSchema = z.pipe(
|
|
5
5
|
z.union([z.array(z.string()), z.string()]),
|
|
6
|
-
z.transform((val):
|
|
6
|
+
z.transform((val): string[] => (typeof val === "string" ? [val] : val)),
|
|
7
7
|
)
|
|
8
8
|
|
|
9
9
|
// --- CustomTypes hierarchy (field selection in content relationship fields) ---
|
|
@@ -15,9 +15,7 @@ const noDuplicateStrings = z.refine(
|
|
|
15
15
|
"Fields have duplicates.",
|
|
16
16
|
)
|
|
17
17
|
|
|
18
|
-
const CustomTypeLevel2FieldGroupFieldsSchema = z.
|
|
19
|
-
z.array(z.string()).check(noDuplicateStrings),
|
|
20
|
-
)
|
|
18
|
+
const CustomTypeLevel2FieldGroupFieldsSchema = z.array(z.string()).check(noDuplicateStrings)
|
|
21
19
|
|
|
22
20
|
const CustomTypeLevel2FieldSchema = z.union([
|
|
23
21
|
z.object({ id: z.string(), fields: CustomTypeLevel2FieldGroupFieldsSchema }),
|
|
@@ -30,18 +28,18 @@ const noDuplicateIds = (items: unknown) => {
|
|
|
30
28
|
return ids.size === arr.length
|
|
31
29
|
}
|
|
32
30
|
|
|
33
|
-
const CustomTypeLevel2FieldsSchema = z
|
|
34
|
-
|
|
35
|
-
)
|
|
31
|
+
const CustomTypeLevel2FieldsSchema = z
|
|
32
|
+
.array(CustomTypeLevel2FieldSchema)
|
|
33
|
+
.check(z.refine(noDuplicateIds, "Fields have duplicates."))
|
|
36
34
|
|
|
37
35
|
const CustomTypeLevel2Schema = z.union([
|
|
38
36
|
z.string(),
|
|
39
37
|
z.object({ id: z.string(), fields: CustomTypeLevel2FieldsSchema }),
|
|
40
38
|
])
|
|
41
39
|
|
|
42
|
-
const CustomTypesLevel2Schema = z
|
|
43
|
-
|
|
44
|
-
)
|
|
40
|
+
const CustomTypesLevel2Schema = z
|
|
41
|
+
.array(CustomTypeLevel2Schema)
|
|
42
|
+
.check(z.refine(noDuplicateIds, "Custom types have duplicates."))
|
|
45
43
|
|
|
46
44
|
// Level 1
|
|
47
45
|
|
|
@@ -55,11 +53,9 @@ const CustomTypeLevel1FieldGroupFieldSchema = z.union([
|
|
|
55
53
|
z.string(),
|
|
56
54
|
])
|
|
57
55
|
|
|
58
|
-
const CustomTypeLevel1FieldGroupFieldsSchema = z
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
.check(z.refine(noDuplicateIds, "Fields have duplicates.")),
|
|
62
|
-
)
|
|
56
|
+
const CustomTypeLevel1FieldGroupFieldsSchema = z
|
|
57
|
+
.array(CustomTypeLevel1FieldGroupFieldSchema)
|
|
58
|
+
.check(z.refine(noDuplicateIds, "Fields have duplicates."))
|
|
63
59
|
|
|
64
60
|
const CustomTypeLevel1FieldSchema = z.union([
|
|
65
61
|
z.object({
|
|
@@ -70,45 +66,43 @@ const CustomTypeLevel1FieldSchema = z.union([
|
|
|
70
66
|
z.string(),
|
|
71
67
|
])
|
|
72
68
|
|
|
73
|
-
const CustomTypeLevel1FieldsSchema = z
|
|
74
|
-
|
|
75
|
-
)
|
|
69
|
+
const CustomTypeLevel1FieldsSchema = z
|
|
70
|
+
.array(CustomTypeLevel1FieldSchema)
|
|
71
|
+
.check(z.refine(noDuplicateIds, "Fields have duplicates."))
|
|
76
72
|
|
|
77
73
|
const CustomTypeLevel1Schema = z.union([
|
|
78
74
|
z.string(),
|
|
79
75
|
z.object({ id: z.string(), fields: CustomTypeLevel1FieldsSchema }),
|
|
80
76
|
])
|
|
81
77
|
|
|
82
|
-
const CustomTypesSchema = z.
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
objects.add(id)
|
|
97
|
-
}
|
|
98
|
-
if (failed) {
|
|
99
|
-
push("Custom types have duplicates.")
|
|
100
|
-
return
|
|
101
|
-
}
|
|
78
|
+
const CustomTypesSchema = z.array(CustomTypeLevel1Schema).check(({ value, issues }) => {
|
|
79
|
+
const cts = value as ({ id: string } | string)[]
|
|
80
|
+
const push = (message: string) => issues.push({ code: "custom", input: value, message })
|
|
81
|
+
const strings = new Set<string>()
|
|
82
|
+
const objects = new Set<string>()
|
|
83
|
+
for (const ct of cts) {
|
|
84
|
+
let failed = false
|
|
85
|
+
if (typeof ct === "string") {
|
|
86
|
+
failed = objects.has(ct)
|
|
87
|
+
strings.add(ct)
|
|
88
|
+
} else {
|
|
89
|
+
const { id } = ct
|
|
90
|
+
failed = strings.has(id) || objects.has(id)
|
|
91
|
+
objects.add(id)
|
|
102
92
|
}
|
|
103
|
-
if (
|
|
104
|
-
push("
|
|
93
|
+
if (failed) {
|
|
94
|
+
push("Custom types have duplicates.")
|
|
105
95
|
return
|
|
106
96
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
97
|
+
}
|
|
98
|
+
if (objects.size > 1) {
|
|
99
|
+
push("Cannot have multiple custom types with fields selection.")
|
|
100
|
+
return
|
|
101
|
+
}
|
|
102
|
+
if (strings.size > 0 && objects.size > 0) {
|
|
103
|
+
push("Cannot mix custom types as strings and objects with fields.")
|
|
104
|
+
}
|
|
105
|
+
})
|
|
112
106
|
|
|
113
107
|
// --- Select with fallback to null ---
|
|
114
108
|
|
package/src/model/nestable.ts
CHANGED
|
@@ -1,20 +1,36 @@
|
|
|
1
1
|
import { z } from "zod/mini"
|
|
2
2
|
|
|
3
|
+
import type { BooleanModel } from "./boolean"
|
|
3
4
|
import { BooleanModelSchema } from "./boolean"
|
|
5
|
+
import type { ColorModel } from "./color"
|
|
4
6
|
import { ColorModelSchema } from "./color"
|
|
7
|
+
import type { DateModel } from "./date"
|
|
5
8
|
import { DateModelSchema } from "./date"
|
|
9
|
+
import type { EmbedModel } from "./embed"
|
|
6
10
|
import { EmbedModelSchema } from "./embed"
|
|
11
|
+
import type { GeoPointModel } from "./geopoint"
|
|
7
12
|
import { GeoPointModelSchema } from "./geopoint"
|
|
13
|
+
import type { ImageModel } from "./image"
|
|
8
14
|
import { ImageModelSchema } from "./image"
|
|
15
|
+
import type { IntegrationFieldModel } from "./integrationField"
|
|
9
16
|
import { IntegrationFieldModelSchema } from "./integrationField"
|
|
17
|
+
import type { LinkModel } from "./link"
|
|
10
18
|
import { LinkModelSchema } from "./link"
|
|
19
|
+
import type { NumberModel } from "./number"
|
|
11
20
|
import { NumberModelSchema } from "./number"
|
|
21
|
+
import type { RangeModel } from "./range"
|
|
12
22
|
import { RangeModelSchema } from "./range"
|
|
23
|
+
import type { RichTextModel } from "./richText"
|
|
13
24
|
import { RichTextModelSchema } from "./richText"
|
|
25
|
+
import type { SelectModel } from "./select"
|
|
14
26
|
import { SelectModelSchema } from "./select"
|
|
27
|
+
import type { SeparatorModel } from "./separator"
|
|
15
28
|
import { SeparatorModelSchema } from "./separator"
|
|
29
|
+
import type { TableModel } from "./table"
|
|
16
30
|
import { TableModelSchema } from "./table"
|
|
31
|
+
import type { TextModel } from "./text"
|
|
17
32
|
import { TextModelSchema } from "./text"
|
|
33
|
+
import type { TimestampModel } from "./timestamp"
|
|
18
34
|
import { TimestampModelSchema } from "./timestamp"
|
|
19
35
|
|
|
20
36
|
export const NestableModelSchema = z.union([
|
|
@@ -36,4 +52,20 @@ export const NestableModelSchema = z.union([
|
|
|
36
52
|
TimestampModelSchema,
|
|
37
53
|
])
|
|
38
54
|
|
|
39
|
-
export type NestableModel =
|
|
55
|
+
export type NestableModel =
|
|
56
|
+
| BooleanModel
|
|
57
|
+
| ColorModel
|
|
58
|
+
| DateModel
|
|
59
|
+
| EmbedModel
|
|
60
|
+
| GeoPointModel
|
|
61
|
+
| ImageModel
|
|
62
|
+
| IntegrationFieldModel
|
|
63
|
+
| LinkModel
|
|
64
|
+
| NumberModel
|
|
65
|
+
| RangeModel
|
|
66
|
+
| RichTextModel
|
|
67
|
+
| SelectModel
|
|
68
|
+
| SeparatorModel
|
|
69
|
+
| TableModel
|
|
70
|
+
| TextModel
|
|
71
|
+
| TimestampModel
|
package/src/model/richText.ts
CHANGED
|
@@ -52,7 +52,7 @@ const RichTextOptionsSchema = z.pipe(
|
|
|
52
52
|
*/
|
|
53
53
|
const LegacyLabelsFormat = z.record(z.string(), z.array(z.object({ name: z.string() })))
|
|
54
54
|
|
|
55
|
-
const RichTextLabelsSchema = z.pipe(
|
|
55
|
+
const RichTextLabelsSchema: z.ZodMiniType<string[]> = z.pipe(
|
|
56
56
|
z.union([
|
|
57
57
|
z.pipe(
|
|
58
58
|
z.null(),
|
|
@@ -83,7 +83,7 @@ const RichTextLabelsSchema = z.pipe(
|
|
|
83
83
|
}),
|
|
84
84
|
),
|
|
85
85
|
]),
|
|
86
|
-
z.transform((result: string[]) => result as
|
|
86
|
+
z.transform((result: string[]) => result as string[]),
|
|
87
87
|
)
|
|
88
88
|
|
|
89
89
|
const RichTextConfigSchema = z.object({
|
package/src/model/select.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { z } from "zod/mini"
|
|
|
2
2
|
|
|
3
3
|
// Options can be string, number, or boolean - all coerced to string
|
|
4
4
|
// Matches io-ts behavior: t.union([t.string, StringFromNumber, StringFromBoolean])
|
|
5
|
-
const SelectOptionSchema = z.union([
|
|
5
|
+
const SelectOptionSchema: z.ZodMiniType<string> = z.union([
|
|
6
6
|
z.string(),
|
|
7
7
|
z.pipe(
|
|
8
8
|
z.number(),
|
|
@@ -18,7 +18,7 @@ const SelectConfigSchema = z.object({
|
|
|
18
18
|
label: z.nullish(z.string()),
|
|
19
19
|
placeholder: z.optional(z.string()),
|
|
20
20
|
default_value: z.optional(z.string()),
|
|
21
|
-
options: z.optional(z.
|
|
21
|
+
options: z.optional(z.array(SelectOptionSchema)),
|
|
22
22
|
})
|
|
23
23
|
|
|
24
24
|
export const SelectModelSchema = z.object({
|