@prismicio/types-internal 4.0.0-pr.6.e3136c3 → 4.0.0-pr.7.9dec8db

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.
Files changed (164) hide show
  1. package/README.md +5 -5
  2. package/dist/content/codec/link.js +8 -8
  3. package/dist/content/codec/link.js.map +1 -1
  4. package/dist/content/codec/richText.js +2 -2
  5. package/dist/content/codec/richText.js.map +1 -1
  6. package/dist/content/document.d.ts +2 -3019
  7. package/dist/content/document.d.ts.map +1 -1
  8. package/dist/content/field.d.ts +1 -30
  9. package/dist/content/field.d.ts.map +1 -1
  10. package/dist/content/field.js.map +1 -1
  11. package/dist/content/group.d.ts +2 -1
  12. package/dist/content/group.d.ts.map +1 -1
  13. package/dist/content/group.js.map +1 -1
  14. package/dist/content/legacy/boolean.d.ts +1 -0
  15. package/dist/content/legacy/embed.d.ts +1 -0
  16. package/dist/content/legacy/empty.d.ts +1 -0
  17. package/dist/content/legacy/field.d.ts +1 -0
  18. package/dist/content/legacy/geopoint.d.ts +1 -0
  19. package/dist/content/legacy/group.d.ts +9 -0
  20. package/dist/content/legacy/group.d.ts.map +1 -0
  21. package/dist/content/legacy/group.js.map +1 -1
  22. package/dist/content/legacy/integrationField.d.ts +1 -0
  23. package/dist/content/legacy/link.d.ts +41 -0
  24. package/dist/content/legacy/link.d.ts.map +1 -0
  25. package/dist/content/legacy/link.js.map +1 -1
  26. package/dist/content/legacy/nestable.d.ts +1 -0
  27. package/dist/content/legacy/nestable.js.map +1 -1
  28. package/dist/content/legacy/repeatable.d.ts +1 -0
  29. package/dist/content/legacy/repeatable.js +2 -8
  30. package/dist/content/legacy/repeatable.js.map +1 -1
  31. package/dist/content/legacy/richText.d.ts +109 -0
  32. package/dist/content/legacy/richText.d.ts.map +1 -0
  33. package/dist/content/legacy/richText.js +3 -3
  34. package/dist/content/legacy/richText.js.map +1 -1
  35. package/dist/content/legacy/separator.d.ts +1 -0
  36. package/dist/content/legacy/slice.js +2 -3
  37. package/dist/content/legacy/slice.js.map +1 -1
  38. package/dist/content/legacy/table.d.ts +1 -0
  39. package/dist/content/link.d.ts +74 -99
  40. package/dist/content/link.d.ts.map +1 -1
  41. package/dist/content/link.js +2 -2
  42. package/dist/content/link.js.map +1 -1
  43. package/dist/content/nestable.d.ts +13 -749
  44. package/dist/content/nestable.d.ts.map +1 -1
  45. package/dist/content/nestable.js +1 -0
  46. package/dist/content/nestable.js.map +1 -1
  47. package/dist/content/repeatable.d.ts +3 -98
  48. package/dist/content/repeatable.d.ts.map +1 -1
  49. package/dist/content/richText.d.ts +81 -131
  50. package/dist/content/richText.d.ts.map +1 -1
  51. package/dist/content/richText.js +5 -4
  52. package/dist/content/richText.js.map +1 -1
  53. package/dist/content/slice.d.ts +6 -4509
  54. package/dist/content/slice.d.ts.map +1 -1
  55. package/dist/content/slice.js.map +1 -1
  56. package/dist/content/slices.d.ts +8 -6765
  57. package/dist/content/slices.d.ts.map +1 -1
  58. package/dist/content/table.d.ts +2 -134
  59. package/dist/content/table.d.ts.map +1 -1
  60. package/dist/content/widget.d.ts +5 -3020
  61. package/dist/content/widget.d.ts.map +1 -1
  62. package/dist/content/widget.js.map +1 -1
  63. package/dist/helpers/contentPath.js +1 -1
  64. package/dist/helpers/customTypeModel.d.ts +3 -2
  65. package/dist/helpers/customTypeModel.d.ts.map +1 -1
  66. package/dist/helpers/customTypeModel.js +31 -1
  67. package/dist/helpers/customTypeModel.js.map +1 -1
  68. package/dist/helpers/documentContent.d.ts +5 -10
  69. package/dist/helpers/documentContent.d.ts.map +1 -1
  70. package/dist/helpers/documentContent.js +18 -5
  71. package/dist/helpers/documentContent.js.map +1 -1
  72. package/dist/helpers/sliceContent.d.ts +12 -0
  73. package/dist/helpers/sliceContent.d.ts.map +1 -0
  74. package/dist/helpers/sliceContent.js +60 -0
  75. package/dist/helpers/sliceContent.js.map +1 -0
  76. package/dist/helpers/traverseContent.d.ts +21 -22
  77. package/dist/helpers/traverseContent.d.ts.map +1 -1
  78. package/dist/helpers/traverseContent.js +54 -22
  79. package/dist/helpers/traverseContent.js.map +1 -1
  80. package/dist/helpers/traverseContentWithModel.d.ts +20 -21
  81. package/dist/helpers/traverseContentWithModel.d.ts.map +1 -1
  82. package/dist/helpers/traverseContentWithModel.js +64 -38
  83. package/dist/helpers/traverseContentWithModel.js.map +1 -1
  84. package/dist/index.d.ts +26 -25
  85. package/dist/index.js +3 -1
  86. package/dist/io-ts.d.ts +3304 -70918
  87. package/dist/io-ts.d.ts.map +1 -1
  88. package/dist/io-ts.js +125 -122
  89. package/dist/io-ts.js.map +1 -1
  90. package/dist/model/customType.d.ts +3 -3329
  91. package/dist/model/customType.d.ts.map +1 -1
  92. package/dist/model/group.d.ts +391 -392
  93. package/dist/model/group.d.ts.map +1 -1
  94. package/dist/model/group.js.map +1 -1
  95. package/dist/model/image.d.ts +4 -4
  96. package/dist/model/image.js.map +1 -1
  97. package/dist/model/link.d.ts +18 -18
  98. package/dist/model/link.d.ts.map +1 -1
  99. package/dist/model/link.js +7 -7
  100. package/dist/model/link.js.map +1 -1
  101. package/dist/model/nestable.d.ts +17 -178
  102. package/dist/model/nestable.d.ts.map +1 -1
  103. package/dist/model/nestable.js +3 -3
  104. package/dist/model/nestable.js.map +1 -1
  105. package/dist/model/richText.d.ts +3 -7
  106. package/dist/model/richText.d.ts.map +1 -1
  107. package/dist/model/richText.js +4 -3
  108. package/dist/model/richText.js.map +1 -1
  109. package/dist/model/section.d.ts +3 -3329
  110. package/dist/model/section.d.ts.map +1 -1
  111. package/dist/model/select.d.ts +1 -1
  112. package/dist/model/select.js +1 -1
  113. package/dist/model/select.js.map +1 -1
  114. package/dist/model/slice.d.ts +861 -3800
  115. package/dist/model/slice.d.ts.map +1 -1
  116. package/dist/model/slice.js +7 -2
  117. package/dist/model/slice.js.map +1 -1
  118. package/dist/model/slices.d.ts +3 -2195
  119. package/dist/model/slices.d.ts.map +1 -1
  120. package/dist/model/table.d.ts +2 -1
  121. package/dist/model/table.d.ts.map +1 -1
  122. package/dist/model/table.js +9 -7
  123. package/dist/model/table.js.map +1 -1
  124. package/dist/model/widget.d.ts +14 -3339
  125. package/dist/model/widget.d.ts.map +1 -1
  126. package/dist/model/widget.js.map +1 -1
  127. package/dist/zod4.d.ts +1345 -34797
  128. package/dist/zod4.d.ts.map +1 -1
  129. package/dist/zod4.js +125 -122
  130. package/dist/zod4.js.map +1 -1
  131. package/package.json +3 -2
  132. package/src/content/codec/link.ts +8 -8
  133. package/src/content/codec/richText.ts +10 -6
  134. package/src/content/field.ts +9 -2
  135. package/src/content/group.ts +5 -2
  136. package/src/content/legacy/group.ts +12 -4
  137. package/src/content/legacy/link.ts +32 -9
  138. package/src/content/legacy/nestable.ts +26 -2
  139. package/src/content/legacy/repeatable.ts +3 -16
  140. package/src/content/legacy/richText.ts +40 -7
  141. package/src/content/legacy/slice.ts +8 -7
  142. package/src/content/legacy/widget.ts +6 -2
  143. package/src/content/link.ts +32 -9
  144. package/src/content/nestable.ts +42 -2
  145. package/src/content/richText.ts +31 -9
  146. package/src/content/slice.ts +2 -2
  147. package/src/content/widget.ts +6 -2
  148. package/src/helpers/customTypeModel.ts +44 -0
  149. package/src/helpers/documentContent.ts +45 -17
  150. package/src/helpers/sliceContent.ts +86 -0
  151. package/src/helpers/traverseContent.ts +108 -41
  152. package/src/helpers/traverseContentWithModel.ts +91 -60
  153. package/src/index.ts +5 -2
  154. package/src/io-ts.ts +166 -140
  155. package/src/model/group.ts +4 -1
  156. package/src/model/image.ts +1 -1
  157. package/src/model/link.ts +39 -45
  158. package/src/model/nestable.ts +33 -1
  159. package/src/model/richText.ts +2 -2
  160. package/src/model/select.ts +2 -2
  161. package/src/model/slice.ts +36 -9
  162. package/src/model/table.ts +11 -2
  163. package/src/model/widget.ts +8 -4
  164. package/src/zod4.ts +166 -140
@@ -24,7 +24,8 @@ import type { NestableModel } from "../model/nestable"
24
24
  import type {
25
25
  CompositeSliceModel,
26
26
  LegacySliceModel,
27
- SharedSliceVariationModel,
27
+ SharedSliceVariationContentModel,
28
+ SliceContentModel,
28
29
  } from "../model/slice"
29
30
  import type { StaticSlicesModel } from "../model/slices"
30
31
  import { TableCellModel } from "../model/table"
@@ -95,49 +96,70 @@ export function traverseSlicesContentWithModel(
95
96
 
96
97
  const traversed: SlicesContent["value"] = []
97
98
  for (const sliceItemContent of content.value) {
98
- const model = config.model.config?.choices?.[sliceItemContent.name]
99
+ const sliceModel = config.model.config?.choices?.[sliceItemContent.name]
99
100
 
100
101
  let traversedSliceItemContent: SliceItemContent | undefined
101
- if (
102
- model?.type === "SharedSlice" &&
103
- sliceItemContent.widget.__TYPE__ === SharedSliceContentType
104
- ) {
105
- const variationID = sliceItemContent.widget.variation
106
- const variationModel = model.variations.find((variation) => variation.id === variationID)
107
- if (variationModel) {
108
- const sharedSliceVariationModel: SharedSliceVariationModel = {
109
- type: "SharedSlice",
110
- sliceName: model.id,
111
- variationID,
112
- fields: {
113
- primary: variationModel.primary || {},
114
- items: variationModel.items || {},
115
- },
102
+ if (sliceModel?.type === "SharedSlice") {
103
+ if (sliceItemContent.widget.__TYPE__ === SharedSliceContentType) {
104
+ // Happy path, content and model are both shared slices
105
+ const variationID = sliceItemContent.widget.variation
106
+ const variationModel = sliceModel.variations.find(
107
+ (variation) => variation.id === variationID,
108
+ )
109
+ if (variationModel) {
110
+ const model: SharedSliceVariationContentModel = {
111
+ type: "SharedSlice",
112
+ sliceName: sliceModel.id,
113
+ variationID: variationModel.id,
114
+ fields: {
115
+ primary: variationModel.primary || {},
116
+ items: variationModel.items || {},
117
+ },
118
+ }
119
+
120
+ traversedSliceItemContent = traverseSharedSliceContentWithModel(
121
+ path.concat({ key: sliceItemContent.key, type: "SharedSlice" }),
122
+ sliceItemContent.key,
123
+ sliceItemContent.name,
124
+ sliceItemContent as SharedSliceItemContent,
125
+ { model, transformWidget, transformSlice },
126
+ )
116
127
  }
117
-
118
- traversedSliceItemContent = traverseSharedSliceContentWithModel(
119
- path.concat({ key: sliceItemContent.key, type: "SharedSlice" }),
128
+ } else if (sliceItemContent.widget.__TYPE__ === CompositeSliceContentType) {
129
+ // Migrated path, content is composite, model is shared slice
130
+ const variationModel = sliceModel.variations[0]
131
+ if (variationModel) {
132
+ const model: SharedSliceVariationContentModel = {
133
+ type: "SharedSlice",
134
+ sliceName: sliceModel.id,
135
+ variationID: variationModel.id,
136
+ fields: {
137
+ primary: variationModel.primary || {},
138
+ items: variationModel.items || {},
139
+ },
140
+ }
141
+
142
+ traversedSliceItemContent = traverseCompositeSliceContentWithModel(
143
+ path.concat({ key: sliceItemContent.key, type: "Slice" }),
144
+ sliceItemContent.key,
145
+ sliceItemContent.name,
146
+ sliceItemContent as CompositeSliceItemContent,
147
+ { model, transformWidget, transformSlice },
148
+ )
149
+ }
150
+ }
151
+ } else if (sliceModel?.type === "Slice") {
152
+ if (sliceItemContent.widget.__TYPE__ === CompositeSliceContentType) {
153
+ traversedSliceItemContent = traverseCompositeSliceContentWithModel(
154
+ path.concat({ key: sliceItemContent.key, type: "Slice" }),
120
155
  sliceItemContent.key,
121
156
  sliceItemContent.name,
122
- sliceItemContent as SharedSliceItemContent,
123
- { model: sharedSliceVariationModel, transformWidget, transformSlice },
157
+ sliceItemContent as CompositeSliceItemContent,
158
+ { model: sliceModel, transformWidget, transformSlice },
124
159
  )
125
160
  }
126
161
  } else if (
127
- model?.type === "Slice" &&
128
- sliceItemContent.widget.__TYPE__ === CompositeSliceContentType
129
- ) {
130
- traversedSliceItemContent = traverseCompositeSliceContentWithModel(
131
- path.concat({ key: sliceItemContent.key, type: "Slice" }),
132
- sliceItemContent.key,
133
- sliceItemContent.name,
134
- sliceItemContent as CompositeSliceItemContent,
135
- { model, transformWidget, transformSlice },
136
- )
137
- } else if (
138
- model &&
139
- model?.type !== "SharedSlice" &&
140
- model?.type !== "Slice" &&
162
+ sliceModel &&
141
163
  sliceItemContent.widget.__TYPE__ !== SharedSliceContentType &&
142
164
  sliceItemContent.widget.__TYPE__ !== CompositeSliceContentType
143
165
  ) {
@@ -146,7 +168,7 @@ export function traverseSlicesContentWithModel(
146
168
  sliceItemContent.key,
147
169
  sliceItemContent.name,
148
170
  sliceItemContent as LegacySliceItemContent,
149
- { model, transformWidget, transformSlice },
171
+ { model: sliceModel, transformWidget, transformSlice },
150
172
  )
151
173
  }
152
174
 
@@ -165,9 +187,9 @@ export function traverseSlicesContentWithModel(
165
187
  }
166
188
 
167
189
  type TraverseSharedSliceContentWithModelConfig = {
168
- model: SharedSliceVariationModel
169
- transformWidget: TraverseWidgetContentWithModelFunction
170
- transformSlice: TraverseSliceContentWithModelFunction
190
+ model: SharedSliceVariationContentModel
191
+ transformWidget?: TraverseWidgetContentWithModelFunction
192
+ transformSlice?: TraverseSliceContentWithModelFunction
171
193
  }
172
194
 
173
195
  export function traverseSharedSliceContentWithModel(
@@ -177,12 +199,13 @@ export function traverseSharedSliceContentWithModel(
177
199
  content: SharedSliceItemContent | undefined,
178
200
  config: TraverseSharedSliceContentWithModelConfig,
179
201
  ): SharedSliceItemContent | undefined {
180
- const { transformWidget, transformSlice } = config
181
-
182
202
  if (!content) {
183
203
  return
184
204
  }
185
205
 
206
+ const { transformWidget = (args) => args.content, transformSlice = (args) => args.content } =
207
+ config
208
+
186
209
  const traversedPrimary: SharedSliceContent["primary"] = {}
187
210
  for (const [key, model] of Object.entries(config.model.fields.primary ?? {})) {
188
211
  const traversedContent = traverseWidgetContentWithModel(
@@ -220,9 +243,9 @@ export function traverseSharedSliceContentWithModel(
220
243
  }
221
244
 
222
245
  type TraverseCompositeSliceContentWithModelConfig = {
223
- model: CompositeSliceModel
224
- transformWidget: TraverseWidgetContentWithModelFunction
225
- transformSlice: TraverseSliceContentWithModelFunction
246
+ model: CompositeSliceModel | SharedSliceVariationContentModel
247
+ transformWidget?: TraverseWidgetContentWithModelFunction
248
+ transformSlice?: TraverseSliceContentWithModelFunction
226
249
  }
227
250
 
228
251
  export function traverseCompositeSliceContentWithModel(
@@ -231,15 +254,20 @@ export function traverseCompositeSliceContentWithModel(
231
254
  apiID: string,
232
255
  content: CompositeSliceItemContent | undefined,
233
256
  config: TraverseCompositeSliceContentWithModelConfig,
234
- ): CompositeSliceItemContent | undefined {
235
- const { transformWidget, transformSlice } = config
236
-
257
+ ): CompositeSliceItemContent | SharedSliceItemContent | undefined {
237
258
  if (!content) {
238
259
  return
239
260
  }
240
261
 
262
+ const { transformWidget = (args) => args.content, transformSlice = (args) => args.content } =
263
+ config
264
+
265
+ const primaryModel =
266
+ config.model?.type === "SharedSlice"
267
+ ? config.model?.fields.primary
268
+ : config.model?.["non-repeat"]
241
269
  const traversedPrimary: CompositeSliceContent["nonRepeat"] = {}
242
- for (const [key, model] of Object.entries(config.model?.["non-repeat"] ?? {})) {
270
+ for (const [key, model] of Object.entries(primaryModel ?? {})) {
243
271
  const traversedContent = traverseWidgetContentWithModel(
244
272
  path.concat({ key: "non-repeat", type: "primary" }, { key, type: "Widget" }),
245
273
  key,
@@ -253,10 +281,12 @@ export function traverseCompositeSliceContentWithModel(
253
281
  }
254
282
  }
255
283
 
284
+ const itemsModel =
285
+ config.model?.type === "SharedSlice" ? config.model?.fields.items : config.model?.repeat
256
286
  const traversedItems = traverseGroupItemsContentWithModel(
257
287
  path.concat({ key: "repeat", type: "items" }),
258
288
  content.widget.repeat,
259
- { model: config.model.repeat ?? {}, transformWidget },
289
+ { model: itemsModel ?? {}, transformWidget },
260
290
  )
261
291
 
262
292
  return transformSlice({
@@ -273,8 +303,8 @@ export function traverseCompositeSliceContentWithModel(
273
303
 
274
304
  type TraverseLegacySliceContentWithModelConfig = {
275
305
  model: LegacySliceModel
276
- transformWidget: TraverseWidgetContentWithModelFunction
277
- transformSlice: TraverseSliceContentWithModelFunction
306
+ transformWidget?: TraverseWidgetContentWithModelFunction
307
+ transformSlice?: TraverseSliceContentWithModelFunction
278
308
  }
279
309
 
280
310
  export function traverseLegacySliceContentWithModel(
@@ -283,13 +313,17 @@ export function traverseLegacySliceContentWithModel(
283
313
  apiID: string,
284
314
  content: LegacySliceItemContent | undefined,
285
315
  config: TraverseLegacySliceContentWithModelConfig,
286
- ): LegacySliceItemContent | undefined {
287
- const { model, transformWidget, transformSlice } = config
288
-
316
+ ): LegacySliceItemContent | SharedSliceItemContent | undefined {
289
317
  if (!content) {
290
318
  return
291
319
  }
292
320
 
321
+ const {
322
+ model,
323
+ transformWidget = (args) => args.content,
324
+ transformSlice = (args) => args.content,
325
+ } = config
326
+
293
327
  const traversedContent = traverseWidgetContentWithModel(path, key, apiID, content.widget, {
294
328
  model,
295
329
  transformWidget,
@@ -507,16 +541,13 @@ export function traverseTableContentWithModel(
507
541
  }
508
542
 
509
543
  // Internals
510
-
511
- type SliceModel = SharedSliceVariationModel | CompositeSliceModel | LegacySliceModel
512
-
513
544
  export type TraverseSliceContentWithModelFunction = <TContent extends SliceItemContent>(args: {
514
545
  path: contentPath.Path
515
546
  key: string
516
547
  apiID: string
517
548
  content?: TContent
518
- model: SliceModel
519
- }) => TContent | undefined
549
+ model: SliceContentModel
550
+ }) => TContent | SharedSliceItemContent | undefined
520
551
 
521
552
  export type TraverseWidgetContentWithModelFunction<
522
553
  TContentTransformMode extends "preserve" | "widen" = "preserve",
package/src/index.ts CHANGED
@@ -27,7 +27,7 @@ export type { IntegrationFieldContent } from "./content/integrationField"
27
27
  export type { LinkContent } from "./content/link"
28
28
  export type { NestableContent } from "./content/nestable"
29
29
  export type { RepeatableContent } from "./content/repeatable"
30
- export type { RichTextContent } from "./content/richText"
30
+ export type { RichTextContent, RichTextContentBlock, RichTextContentSpan } from "./content/richText"
31
31
  export type { SeparatorContent } from "./content/separator"
32
32
  export type {
33
33
  LegacySliceContent,
@@ -69,13 +69,15 @@ export type {
69
69
  CompositeSliceModel,
70
70
  SharedSliceModel,
71
71
  SharedSliceRefModel,
72
- SharedSliceVariationModel,
72
+ SharedSliceVariationContentModel as SharedSliceVariationModel,
73
73
  StaticSliceModel,
74
74
  DynamicSliceModel,
75
+ SliceContentModel,
75
76
  SliceModelType,
76
77
  } from "./model/slice"
77
78
  export type { DynamicSlicesModel, StaticSlicesModel } from "./model/slices"
78
79
  export type { TableModel } from "./model/table"
80
+ export { TableCellModelNodeTypes } from "./model/table"
79
81
  export type { TextModel } from "./model/text"
80
82
  export type { TimestampModel } from "./model/timestamp"
81
83
  export type { UIDModel } from "./model/uid"
@@ -88,6 +90,7 @@ export { LegacyContentCtx, getFieldCtx, defaultCtx } from "./content/codec/legac
88
90
  export * as contentPath from "./helpers/contentPath"
89
91
  export * as customTypeModel from "./helpers/customTypeModel"
90
92
  export * as documentContent from "./helpers/documentContent"
93
+ export * as sliceContent from "./helpers/sliceContent"
91
94
  export {
92
95
  traverseDocumentContent,
93
96
  traverseSlicesContent,
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,119 +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
- LegacySliceContentSchema,
69
- CompositeSliceContentSchema,
70
- SharedSliceContentSchema,
71
- SliceContentSchema,
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
80
  import {
74
- LegacySliceItemContentSchema,
75
- CompositeSliceItemContentSchema,
76
- SharedSliceItemContentSchema,
77
- SliceItemContentSchema,
78
- SlicesContentSchema,
81
+ LegacySliceItemContentSchema as rawLegacySliceItemContentSchema,
82
+ CompositeSliceItemContentSchema as rawCompositeSliceItemContentSchema,
83
+ SharedSliceItemContentSchema as rawSharedSliceItemContentSchema,
84
+ SliceItemContentSchema as rawSliceItemContentSchema,
85
+ SlicesContentSchema as rawSlicesContentSchema,
79
86
  } from "./content/slices"
80
- import { TableContentSchema } from "./content/table"
81
- import { UIDContentSchema } from "./content/uid"
82
- import { WidgetContentSchema } from "./content/widget"
87
+ import { TableContentSchema as rawTableContentSchema } from "./content/table"
88
+ import { UIDContentSchema as rawUIDContentSchema } from "./content/uid"
89
+ import { WidgetContentSchema as rawWidgetContentSchema } from "./content/widget"
83
90
  // Model
84
- import { BooleanModelSchema } from "./model/boolean"
85
- import { ColorModelSchema } from "./model/color"
86
- import { StaticCustomTypeModelSchema, CustomTypeModelSchema } from "./model/customType"
87
- import { DateModelSchema } from "./model/date"
88
- import { EmbedModelSchema } from "./model/embed"
89
- import { GeoPointModelSchema } from "./model/geopoint"
90
- import { GroupModelSchema, NestedGroupModelSchema } from "./model/group"
91
- import { ImageModelSchema } from "./model/image"
92
- import { IntegrationFieldModelSchema } from "./model/integrationField"
93
- import { LinkModelSchema } from "./model/link"
94
- import { NestableModelSchema } from "./model/nestable"
95
- import { NumberModelSchema } from "./model/number"
96
- import { RangeModelSchema } from "./model/range"
97
- import { RichTextModelSchema } from "./model/richText"
98
- import { StaticSectionModelSchema, DynamicSectionModelSchema } from "./model/section"
99
- import { SelectModelSchema } from "./model/select"
100
- 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"
100
+ import {
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"
101
111
  import {
102
- LegacySliceModelSchema,
103
- CompositeSliceModelSchema,
104
- SharedSliceModelSchema,
105
- SharedSliceRefModelSchema,
106
- StaticSliceModelSchema,
107
- DynamicSliceModelSchema,
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,
108
125
  } from "./model/slice"
109
- import { DynamicSlicesModelSchema, StaticSlicesModelSchema } from "./model/slices"
110
- import { TableModelSchema } from "./model/table"
111
- import { TextModelSchema } from "./model/text"
112
- import { TimestampModelSchema } from "./model/timestamp"
113
- import { UIDModelSchema } from "./model/uid"
114
- import { StaticWidgetModelSchema, DynamicWidgetModelSchema } from "./model/widget"
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"
115
138
 
116
139
  // Common
117
- export const Asset = toIOTS(AssetSchema)
118
- export const Embed = toIOTS(EmbedSchema)
119
- export const HexaColorCode = toIOTS(HexaColorCodeSchema)
120
- export const NonEmptyString = toIOTS(NonEmptyStringSchema)
121
- export const WidgetKey = toIOTS(WidgetKeySchema)
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)
122
145
 
123
146
  // Content
124
- export const BooleanContent = toIOTS(BooleanContentSchema)
125
- export const ColorContent = toIOTS(ColorContentSchema)
126
- export const DateContent = toIOTS(DateContentSchema)
127
- export const EmptyContent = toIOTS(EmptyContentSchema)
128
- export const GeoPointContent = toIOTS(GeoPointContentSchema)
129
- export const LinkContent = toIOTS(LinkContentSchema)
130
- export const NumberContent = toIOTS(NumberContentSchema)
131
- export const RangeContent = toIOTS(RangeContentSchema)
132
- export const SelectContent = toIOTS(SelectContentSchema)
133
- export const SeparatorContent = toIOTS(SeparatorContentSchema)
134
- export const SharedSliceContent = toIOTS(SharedSliceContentSchema)
135
- export const TextContent = toIOTS(TextContentSchema)
136
- export const TimestampContent = toIOTS(TimestampContentSchema)
137
- export const FieldContent = toIOTS(FieldContentSchema)
138
- export const UIDContent = toIOTS(UIDContentSchema)
139
- export const IntegrationFieldContent = toIOTS(IntegrationFieldContentSchema)
140
- export const EmbedContent = toIOTS(EmbedContentSchema)
141
- export const ImageContent = toIOTS(ImageContentSchema)
142
- export const RichTextContent = toIOTS(RichTextContentSchema)
143
- export const TableContent = toIOTS(TableContentSchema)
144
- export const RepeatableContent = toIOTS(RepeatableContentSchema)
145
- export const NestableContent = toIOTS(NestableContentSchema)
146
- export const GroupContent = toIOTS(GroupContentSchema)
147
- export const GroupItemContent = toIOTS(GroupItemContentSchema)
148
- export const CompositeSliceContent = toIOTS(CompositeSliceContentSchema)
149
- export const LegacySliceContent = toIOTS(LegacySliceContentSchema)
150
- export const SliceContent = toIOTS(SliceContentSchema)
151
- export const LegacySliceItemContent = toIOTS(LegacySliceItemContentSchema)
152
- export const CompositeSliceItemContent = toIOTS(CompositeSliceItemContentSchema)
153
- export const SharedSliceItemContent = toIOTS(SharedSliceItemContentSchema)
154
- export const SliceItemContent = toIOTS(SliceItemContentSchema)
155
- export const SlicesContent = toIOTS(SlicesContentSchema)
156
- export const WidgetContent = toIOTS(WidgetContentSchema)
157
- export const DocumentContent = toIOTS(DocumentContentSchema)
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)
158
183
 
159
184
  // Content legacy
160
185
  export const BooleanLegacy = toIOTSCodec(BooleanLegacyCodec)
@@ -189,40 +214,41 @@ export const WidgetLegacy = toIOTSCodec(WidgetLegacyCodec)
189
214
  export const DocumentLegacy = toIOTSCodec(DocumentLegacyCodec)
190
215
 
191
216
  // Model
192
- export const BooleanModel = toIOTS(BooleanModelSchema)
193
- export const ColorModel = toIOTS(ColorModelSchema)
194
- export const DateModel = toIOTS(DateModelSchema)
195
- export const EmbedModel = toIOTS(EmbedModelSchema)
196
- export const GeoPointModel = toIOTS(GeoPointModelSchema)
197
- export const ImageModel = toIOTS(ImageModelSchema)
198
- export const IntegrationFieldModel = toIOTS(IntegrationFieldModelSchema)
199
- export const LinkModel = toIOTS(LinkModelSchema)
200
- export const NestableModel = toIOTS(NestableModelSchema)
201
- export const NumberModel = toIOTS(NumberModelSchema)
202
- export const RangeModel = toIOTS(RangeModelSchema)
203
- export const RichTextModel = toIOTS(RichTextModelSchema)
204
- export const SelectModel = toIOTS(SelectModelSchema)
205
- export const SeparatorModel = toIOTS(SeparatorModelSchema)
206
- export const SharedSliceModel = toIOTS(SharedSliceModelSchema)
207
- export const TableModel = toIOTS(TableModelSchema)
208
- export const TextModel = toIOTS(TextModelSchema)
209
- export const TimestampModel = toIOTS(TimestampModelSchema)
210
- export const UIDModel = toIOTS(UIDModelSchema)
211
- export const GroupModel = toIOTS(GroupModelSchema)
212
- export const NestedGroupModel = toIOTS(NestedGroupModelSchema)
213
- export const SharedSliceRefModel = toIOTS(SharedSliceRefModelSchema)
214
- export const CompositeSliceModel = toIOTS(CompositeSliceModelSchema)
215
- export const LegacySliceModel = toIOTS(LegacySliceModelSchema)
216
- export const DynamicSliceModel = toIOTS(DynamicSliceModelSchema)
217
- export const StaticSliceModel = toIOTS(StaticSliceModelSchema)
218
- export const DynamicSlicesModel = toIOTS(DynamicSlicesModelSchema)
219
- export const StaticSlicesModel = toIOTS(StaticSlicesModelSchema)
220
- export const StaticWidgetModel = toIOTS(StaticWidgetModelSchema)
221
- export const DynamicWidgetModel = toIOTS(DynamicWidgetModelSchema)
222
- export const StaticSectionModel = toIOTS(StaticSectionModelSchema)
223
- export const DynamicSectionModel = toIOTS(DynamicSectionModelSchema)
224
- export const StaticCustomTypeModel = toIOTS(StaticCustomTypeModelSchema)
225
- export const CustomTypeModel = toIOTS(CustomTypeModelSchema)
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)
226
252
 
227
253
  function toIOTS<T>(type: ZodMiniType<T>): t.Type<T> {
228
254
  return new t.Type<T>(