@prismicio/types-internal 4.0.0-pr.6.eb53f11 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/dist/content/document.d.ts +2 -3019
  2. package/dist/content/document.d.ts.map +1 -1
  3. package/dist/content/field.d.ts +1 -30
  4. package/dist/content/field.d.ts.map +1 -1
  5. package/dist/content/field.js.map +1 -1
  6. package/dist/content/group.d.ts +2 -1
  7. package/dist/content/group.d.ts.map +1 -1
  8. package/dist/content/group.js.map +1 -1
  9. package/dist/content/legacy/group.d.ts +9 -0
  10. package/dist/content/legacy/group.d.ts.map +1 -0
  11. package/dist/content/legacy/group.js.map +1 -1
  12. package/dist/content/legacy/link.d.ts +41 -0
  13. package/dist/content/legacy/link.d.ts.map +1 -0
  14. package/dist/content/legacy/link.js.map +1 -1
  15. package/dist/content/legacy/nestable.js.map +1 -1
  16. package/dist/content/legacy/repeatable.js +2 -8
  17. package/dist/content/legacy/repeatable.js.map +1 -1
  18. package/dist/content/legacy/richText.d.ts +109 -0
  19. package/dist/content/legacy/richText.d.ts.map +1 -0
  20. package/dist/content/legacy/richText.js.map +1 -1
  21. package/dist/content/legacy/slice.js +2 -3
  22. package/dist/content/legacy/slice.js.map +1 -1
  23. package/dist/content/link.d.ts +74 -99
  24. package/dist/content/link.d.ts.map +1 -1
  25. package/dist/content/link.js +2 -2
  26. package/dist/content/link.js.map +1 -1
  27. package/dist/content/nestable.d.ts +13 -749
  28. package/dist/content/nestable.d.ts.map +1 -1
  29. package/dist/content/nestable.js +1 -0
  30. package/dist/content/nestable.js.map +1 -1
  31. package/dist/content/repeatable.d.ts +3 -98
  32. package/dist/content/repeatable.d.ts.map +1 -1
  33. package/dist/content/richText.d.ts +20 -248
  34. package/dist/content/richText.d.ts.map +1 -1
  35. package/dist/content/richText.js.map +1 -1
  36. package/dist/content/slice.d.ts +6 -4509
  37. package/dist/content/slice.d.ts.map +1 -1
  38. package/dist/content/slice.js.map +1 -1
  39. package/dist/content/slices.d.ts +8 -6765
  40. package/dist/content/slices.d.ts.map +1 -1
  41. package/dist/content/table.d.ts +2 -134
  42. package/dist/content/table.d.ts.map +1 -1
  43. package/dist/content/widget.d.ts +5 -3020
  44. package/dist/content/widget.d.ts.map +1 -1
  45. package/dist/content/widget.js.map +1 -1
  46. package/dist/helpers/contentPath.js +1 -1
  47. package/dist/helpers/customTypeModel.d.ts +1 -1
  48. package/dist/helpers/customTypeModel.js +1 -1
  49. package/dist/helpers/documentContent.d.ts +3 -2
  50. package/dist/helpers/documentContent.d.ts.map +1 -1
  51. package/dist/helpers/documentContent.js +14 -1
  52. package/dist/helpers/documentContent.js.map +1 -1
  53. package/dist/helpers/sliceContent.d.ts +12 -0
  54. package/dist/helpers/sliceContent.d.ts.map +1 -0
  55. package/dist/helpers/sliceContent.js +60 -0
  56. package/dist/helpers/sliceContent.js.map +1 -0
  57. package/dist/helpers/traverseContent.d.ts +15 -16
  58. package/dist/helpers/traverseContent.d.ts.map +1 -1
  59. package/dist/helpers/traverseContent.js +51 -19
  60. package/dist/helpers/traverseContent.js.map +1 -1
  61. package/dist/helpers/traverseContentWithModel.d.ts +14 -15
  62. package/dist/helpers/traverseContentWithModel.d.ts.map +1 -1
  63. package/dist/helpers/traverseContentWithModel.js +61 -35
  64. package/dist/helpers/traverseContentWithModel.js.map +1 -1
  65. package/dist/index.d.ts +25 -24
  66. package/dist/index.js +3 -1
  67. package/dist/io-ts.d.ts +3048 -71012
  68. package/dist/io-ts.d.ts.map +1 -1
  69. package/dist/io-ts.js +125 -124
  70. package/dist/io-ts.js.map +1 -1
  71. package/dist/model/customType.d.ts +3 -3329
  72. package/dist/model/customType.d.ts.map +1 -1
  73. package/dist/model/group.d.ts +375 -376
  74. package/dist/model/group.d.ts.map +1 -1
  75. package/dist/model/group.js.map +1 -1
  76. package/dist/model/image.d.ts +4 -4
  77. package/dist/model/image.js.map +1 -1
  78. package/dist/model/link.d.ts +2 -2
  79. package/dist/model/link.js.map +1 -1
  80. package/dist/model/nestable.d.ts +17 -178
  81. package/dist/model/nestable.d.ts.map +1 -1
  82. package/dist/model/nestable.js +3 -3
  83. package/dist/model/nestable.js.map +1 -1
  84. package/dist/model/richText.d.ts +3 -7
  85. package/dist/model/richText.d.ts.map +1 -1
  86. package/dist/model/richText.js +4 -3
  87. package/dist/model/richText.js.map +1 -1
  88. package/dist/model/section.d.ts +3 -3329
  89. package/dist/model/section.d.ts.map +1 -1
  90. package/dist/model/select.d.ts +1 -1
  91. package/dist/model/select.js +1 -1
  92. package/dist/model/select.js.map +1 -1
  93. package/dist/model/slice.d.ts +781 -3720
  94. package/dist/model/slice.d.ts.map +1 -1
  95. package/dist/model/slice.js +7 -2
  96. package/dist/model/slice.js.map +1 -1
  97. package/dist/model/slices.d.ts +3 -2195
  98. package/dist/model/slices.d.ts.map +1 -1
  99. package/dist/model/table.d.ts +2 -1
  100. package/dist/model/table.d.ts.map +1 -1
  101. package/dist/model/table.js +9 -7
  102. package/dist/model/table.js.map +1 -1
  103. package/dist/model/widget.d.ts +6 -3331
  104. package/dist/model/widget.d.ts.map +1 -1
  105. package/dist/model/widget.js.map +1 -1
  106. package/dist/zod4.d.ts +1332 -34960
  107. package/dist/zod4.d.ts.map +1 -1
  108. package/dist/zod4.js +125 -124
  109. package/dist/zod4.js.map +1 -1
  110. package/package.json +3 -2
  111. package/src/content/field.ts +9 -2
  112. package/src/content/group.ts +5 -2
  113. package/src/content/legacy/group.ts +12 -4
  114. package/src/content/legacy/link.ts +32 -9
  115. package/src/content/legacy/nestable.ts +26 -2
  116. package/src/content/legacy/repeatable.ts +3 -16
  117. package/src/content/legacy/richText.ts +37 -5
  118. package/src/content/legacy/slice.ts +8 -7
  119. package/src/content/legacy/widget.ts +6 -2
  120. package/src/content/link.ts +32 -9
  121. package/src/content/nestable.ts +42 -2
  122. package/src/content/richText.ts +19 -7
  123. package/src/content/slice.ts +2 -2
  124. package/src/content/widget.ts +6 -2
  125. package/src/helpers/documentContent.ts +32 -1
  126. package/src/helpers/sliceContent.ts +86 -0
  127. package/src/helpers/traverseContent.ts +93 -32
  128. package/src/helpers/traverseContentWithModel.ts +73 -48
  129. package/src/index.ts +4 -1
  130. package/src/io-ts.ts +164 -144
  131. package/src/model/group.ts +4 -1
  132. package/src/model/image.ts +1 -1
  133. package/src/model/link.ts +1 -1
  134. package/src/model/nestable.ts +33 -1
  135. package/src/model/richText.ts +2 -2
  136. package/src/model/select.ts +2 -2
  137. package/src/model/slice.ts +36 -9
  138. package/src/model/table.ts +11 -2
  139. package/src/model/widget.ts +8 -4
  140. package/src/zod4.ts +164 -144
  141. package/dist/content/legacy/image.d.ts +0 -1
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,125 +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"
58
+ import { GeoPointContentSchema as rawGeoPointContentSchema } from "./content/geopoint"
65
59
  import {
66
- RichTextContentSchema,
67
- RichTextContentBlockSchema,
68
- RichTextContentSpanSchema,
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,
69
72
  } from "./content/richText"
70
- import { SeparatorContentSchema } from "./content/separator"
73
+ import { SeparatorContentSchema as rawSeparatorContentSchema } from "./content/separator"
71
74
  import {
72
- LegacySliceContentSchema,
73
- CompositeSliceContentSchema,
74
- SharedSliceContentSchema,
75
- SliceContentSchema,
75
+ LegacySliceContentSchema as rawLegacySliceContentSchema,
76
+ CompositeSliceContentSchema as rawCompositeSliceContentSchema,
77
+ SharedSliceContentSchema as rawSharedSliceContentSchema,
78
+ SliceContentSchema as rawSliceContentSchema,
76
79
  } from "./content/slice"
77
80
  import {
78
- LegacySliceItemContentSchema,
79
- CompositeSliceItemContentSchema,
80
- SharedSliceItemContentSchema,
81
- SliceItemContentSchema,
82
- SlicesContentSchema,
81
+ LegacySliceItemContentSchema as rawLegacySliceItemContentSchema,
82
+ CompositeSliceItemContentSchema as rawCompositeSliceItemContentSchema,
83
+ SharedSliceItemContentSchema as rawSharedSliceItemContentSchema,
84
+ SliceItemContentSchema as rawSliceItemContentSchema,
85
+ SlicesContentSchema as rawSlicesContentSchema,
83
86
  } from "./content/slices"
84
- import { TableContentSchema } from "./content/table"
85
- import { UIDContentSchema } from "./content/uid"
86
- 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"
87
90
  // Model
88
- import { BooleanModelSchema } from "./model/boolean"
89
- import { ColorModelSchema } from "./model/color"
90
- import { StaticCustomTypeModelSchema, CustomTypeModelSchema } from "./model/customType"
91
- import { DateModelSchema } from "./model/date"
92
- import { EmbedModelSchema } from "./model/embed"
93
- import { GeoPointModelSchema } from "./model/geopoint"
94
- import { GroupModelSchema, NestedGroupModelSchema } from "./model/group"
95
- import { ImageModelSchema } from "./model/image"
96
- import { IntegrationFieldModelSchema } from "./model/integrationField"
97
- import { LinkModelSchema } from "./model/link"
98
- import { NestableModelSchema } from "./model/nestable"
99
- import { NumberModelSchema } from "./model/number"
100
- import { RangeModelSchema } from "./model/range"
101
- import { RichTextModelSchema } from "./model/richText"
102
- import { StaticSectionModelSchema, DynamicSectionModelSchema } from "./model/section"
103
- import { SelectModelSchema } from "./model/select"
104
- 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"
105
111
  import {
106
- LegacySliceModelSchema,
107
- CompositeSliceModelSchema,
108
- SharedSliceModelSchema,
109
- SharedSliceRefModelSchema,
110
- StaticSliceModelSchema,
111
- 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,
112
125
  } from "./model/slice"
113
- import { DynamicSlicesModelSchema, StaticSlicesModelSchema } from "./model/slices"
114
- import { TableModelSchema } from "./model/table"
115
- import { TextModelSchema } from "./model/text"
116
- import { TimestampModelSchema } from "./model/timestamp"
117
- import { UIDModelSchema } from "./model/uid"
118
- 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"
119
138
 
120
139
  // Common
121
- export const Asset = toIOTS(AssetSchema)
122
- export const Embed = toIOTS(EmbedSchema)
123
- export const HexaColorCode = toIOTS(HexaColorCodeSchema)
124
- export const NonEmptyString = toIOTS(NonEmptyStringSchema)
125
- 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)
126
145
 
127
146
  // Content
128
- export const BooleanContent = toIOTS(BooleanContentSchema)
129
- export const ColorContent = toIOTS(ColorContentSchema)
130
- export const DateContent = toIOTS(DateContentSchema)
131
- export const EmptyContent = toIOTS(EmptyContentSchema)
132
- export const GeoPointContent = toIOTS(GeoPointContentSchema)
133
- export const LinkContent = toIOTS(LinkContentSchema)
134
- export const NumberContent = toIOTS(NumberContentSchema)
135
- export const RangeContent = toIOTS(RangeContentSchema)
136
- export const SelectContent = toIOTS(SelectContentSchema)
137
- export const SeparatorContent = toIOTS(SeparatorContentSchema)
138
- export const SharedSliceContent = toIOTS(SharedSliceContentSchema)
139
- export const TextContent = toIOTS(TextContentSchema)
140
- export const TimestampContent = toIOTS(TimestampContentSchema)
141
- export const FieldContent = toIOTS(FieldContentSchema)
142
- export const UIDContent = toIOTS(UIDContentSchema)
143
- export const IntegrationFieldContent = toIOTS(IntegrationFieldContentSchema)
144
- export const EmbedContent = toIOTS(EmbedContentSchema)
145
- export const ImageContent = toIOTS(ImageContentSchema)
146
- export const RichTextContent = toIOTS(RichTextContentSchema)
147
- export const RichTextContentBlock = toIOTS(RichTextContentBlockSchema)
148
- export const RichTextContentSpan = toIOTS(RichTextContentSpanSchema)
149
- export const TableContent = toIOTS(TableContentSchema)
150
- export const RepeatableContent = toIOTS(RepeatableContentSchema)
151
- export const NestableContent = toIOTS(NestableContentSchema)
152
- export const GroupContent = toIOTS(GroupContentSchema)
153
- export const GroupItemContent = toIOTS(GroupItemContentSchema)
154
- export const CompositeSliceContent = toIOTS(CompositeSliceContentSchema)
155
- export const LegacySliceContent = toIOTS(LegacySliceContentSchema)
156
- export const SliceContent = toIOTS(SliceContentSchema)
157
- export const LegacySliceItemContent = toIOTS(LegacySliceItemContentSchema)
158
- export const CompositeSliceItemContent = toIOTS(CompositeSliceItemContentSchema)
159
- export const SharedSliceItemContent = toIOTS(SharedSliceItemContentSchema)
160
- export const SliceItemContent = toIOTS(SliceItemContentSchema)
161
- export const SlicesContent = toIOTS(SlicesContentSchema)
162
- export const WidgetContent = toIOTS(WidgetContentSchema)
163
- 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)
164
183
 
165
184
  // Content legacy
166
185
  export const BooleanLegacy = toIOTSCodec(BooleanLegacyCodec)
@@ -195,40 +214,41 @@ export const WidgetLegacy = toIOTSCodec(WidgetLegacyCodec)
195
214
  export const DocumentLegacy = toIOTSCodec(DocumentLegacyCodec)
196
215
 
197
216
  // Model
198
- export const BooleanModel = toIOTS(BooleanModelSchema)
199
- export const ColorModel = toIOTS(ColorModelSchema)
200
- export const DateModel = toIOTS(DateModelSchema)
201
- export const EmbedModel = toIOTS(EmbedModelSchema)
202
- export const GeoPointModel = toIOTS(GeoPointModelSchema)
203
- export const ImageModel = toIOTS(ImageModelSchema)
204
- export const IntegrationFieldModel = toIOTS(IntegrationFieldModelSchema)
205
- export const LinkModel = toIOTS(LinkModelSchema)
206
- export const NestableModel = toIOTS(NestableModelSchema)
207
- export const NumberModel = toIOTS(NumberModelSchema)
208
- export const RangeModel = toIOTS(RangeModelSchema)
209
- export const RichTextModel = toIOTS(RichTextModelSchema)
210
- export const SelectModel = toIOTS(SelectModelSchema)
211
- export const SeparatorModel = toIOTS(SeparatorModelSchema)
212
- export const SharedSliceModel = toIOTS(SharedSliceModelSchema)
213
- export const TableModel = toIOTS(TableModelSchema)
214
- export const TextModel = toIOTS(TextModelSchema)
215
- export const TimestampModel = toIOTS(TimestampModelSchema)
216
- export const UIDModel = toIOTS(UIDModelSchema)
217
- export const GroupModel = toIOTS(GroupModelSchema)
218
- export const NestedGroupModel = toIOTS(NestedGroupModelSchema)
219
- export const SharedSliceRefModel = toIOTS(SharedSliceRefModelSchema)
220
- export const CompositeSliceModel = toIOTS(CompositeSliceModelSchema)
221
- export const LegacySliceModel = toIOTS(LegacySliceModelSchema)
222
- export const DynamicSliceModel = toIOTS(DynamicSliceModelSchema)
223
- export const StaticSliceModel = toIOTS(StaticSliceModelSchema)
224
- export const DynamicSlicesModel = toIOTS(DynamicSlicesModelSchema)
225
- export const StaticSlicesModel = toIOTS(StaticSlicesModelSchema)
226
- export const StaticWidgetModel = toIOTS(StaticWidgetModelSchema)
227
- export const DynamicWidgetModel = toIOTS(DynamicWidgetModelSchema)
228
- export const StaticSectionModel = toIOTS(StaticSectionModelSchema)
229
- export const DynamicSectionModel = toIOTS(DynamicSectionModelSchema)
230
- export const StaticCustomTypeModel = toIOTS(StaticCustomTypeModelSchema)
231
- 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)
232
252
 
233
253
  function toIOTS<T>(type: ZodMiniType<T>): t.Type<T> {
234
254
  return new t.Type<T>(
@@ -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>
@@ -8,7 +8,7 @@ import { z } from "zod/mini"
8
8
  * - "auto" or "" → null
9
9
  * - null
10
10
  */
11
- export const SideConstraintSchema = z.union([
11
+ export const SideConstraintSchema: z.ZodMiniType<number | null> = z.union([
12
12
  z.pipe(
13
13
  z.literal("auto"),
14
14
  z.transform(() => null),
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): readonly string[] => (typeof val === "string" ? [val] : 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) ---
@@ -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 = z.infer<typeof NestableModelSchema>
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
@@ -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 readonly string[]),
86
+ z.transform((result: string[]) => result as string[]),
87
87
  )
88
88
 
89
89
  const RichTextConfigSchema = z.object({
@@ -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.readonly(z.array(SelectOptionSchema))),
21
+ options: z.optional(z.array(SelectOptionSchema)),
22
22
  })
23
23
 
24
24
  export const SelectModelSchema = z.object({
@@ -1,13 +1,18 @@
1
1
  import { z } from "zod/mini"
2
2
 
3
3
  import { WidgetKeySchema } from "../common/widgetKey"
4
+ import type { NestedGroupModel } from "./group"
4
5
  import { GroupModelSchema, NestedGroupModelSchema } from "./group"
6
+ import type { NestableModel } from "./nestable"
5
7
  import { NestableModelSchema } from "./nestable"
6
8
 
7
9
  // Simple (before 2020)
8
- export const LegacySliceModelSchema = z.union([NestableModelSchema, NestedGroupModelSchema])
10
+ export const LegacySliceModelSchema: z.ZodMiniType<LegacySliceModel> = z.union([
11
+ NestableModelSchema,
12
+ NestedGroupModelSchema,
13
+ ])
9
14
 
10
- export type LegacySliceModel = z.infer<typeof LegacySliceModelSchema>
15
+ export type LegacySliceModel = NestableModel | NestedGroupModel
11
16
 
12
17
  // Composite (2020 to 2021)
13
18
  export const CompositeSliceType = "Slice" as const
@@ -43,7 +48,14 @@ export const SharedSliceVariationSchema = z.object({
43
48
  docURL: z.string(),
44
49
  version: z.string(),
45
50
  display: z.optional(z.string()),
46
- primary: z.optional(z.record(z.string(), z.union([NestableModelSchema, GroupModelSchema]))),
51
+ primary: z.optional(
52
+ z.record(
53
+ z.string(),
54
+ z.union([NestableModelSchema, GroupModelSchema]) as z.ZodMiniType<
55
+ NestableModel | NestedGroupModel
56
+ >,
57
+ ),
58
+ ),
47
59
  items: z.optional(z.record(z.string(), NestableModelSchema)),
48
60
  })
49
61
 
@@ -68,34 +80,49 @@ export type SharedSliceRefModel = z.infer<typeof SharedSliceRefModelSchema>
68
80
 
69
81
  // Used to represent a shared slice content which can only be
70
82
  // of a given shared slice variation type.
71
- export const SharedSliceVariationModelSchema = z.object({
83
+ export const SharedSliceVariationContentModelSchema = z.object({
72
84
  type: z.literal(SharedSliceType),
73
85
  sliceName: z.string(),
74
86
  variationID: z.string(),
75
87
  fields: z.pick(SharedSliceVariationSchema, { primary: true, items: true }),
76
88
  })
77
89
 
78
- export type SharedSliceVariationModel = z.infer<typeof SharedSliceVariationModelSchema>
90
+ export type SharedSliceVariationContentModel = z.infer<
91
+ typeof SharedSliceVariationContentModelSchema
92
+ >
79
93
 
80
94
  // All
81
95
 
82
96
  // Used when slices reference SharedSlice by ref (not full definition)
83
- export const DynamicSliceModelSchema = z.union([
97
+ export const DynamicSliceModelSchema: z.ZodMiniType<DynamicSliceModel> = z.union([
84
98
  CompositeSliceModelSchema,
85
99
  LegacySliceModelSchema,
86
100
  SharedSliceRefModelSchema,
87
101
  ])
88
102
 
89
- export type DynamicSliceModel = z.infer<typeof DynamicSliceModelSchema>
103
+ export type DynamicSliceModel = CompositeSliceModel | LegacySliceModel | SharedSliceRefModel
90
104
 
91
105
  // Used when slices include full SharedSlice definition
92
- export const StaticSliceModelSchema = z.union([
106
+ export const StaticSliceModelSchema: z.ZodMiniType<StaticSliceModel> = z.union([
93
107
  CompositeSliceModelSchema,
94
108
  LegacySliceModelSchema,
95
109
  SharedSliceModelSchema,
96
110
  ])
97
111
 
98
- export type StaticSliceModel = z.infer<typeof StaticSliceModelSchema>
112
+ export type StaticSliceModel = CompositeSliceModel | LegacySliceModel | SharedSliceModel
113
+
114
+ // Used to represent a slice content model as shared slice variations
115
+ // can only be of a given shared slice variation type.
116
+ export const SliceContentModelSchema: z.ZodMiniType<SliceContentModel> = z.union([
117
+ CompositeSliceModelSchema,
118
+ LegacySliceModelSchema,
119
+ SharedSliceVariationContentModelSchema,
120
+ ])
121
+
122
+ export type SliceContentModel =
123
+ | CompositeSliceModel
124
+ | LegacySliceModel
125
+ | SharedSliceVariationContentModel
99
126
 
100
127
  // Model types
101
128
  export const SliceModelTypeSchema = z.union([
@@ -1,5 +1,7 @@
1
1
  import { z } from "zod/mini"
2
2
 
3
+ import { RichTextNodeType, type RichTextModel } from "./richText"
4
+
3
5
  const TableConfigSchema = z.object({
4
6
  label: z.nullish(z.string()),
5
7
  })
@@ -12,9 +14,16 @@ export const TableModelSchema = z.object({
12
14
  export type TableModel = z.infer<typeof TableModelSchema>
13
15
 
14
16
  // TableCell configuration constant (used for cell rich text configuration)
15
- export const TableCellModel = {
17
+ export const TableCellModelNodeTypes = [
18
+ RichTextNodeType.paragraph,
19
+ RichTextNodeType.strong,
20
+ RichTextNodeType.em,
21
+ RichTextNodeType.hyperlink,
22
+ ]
23
+
24
+ export const TableCellModel: RichTextModel = {
16
25
  type: "StructuredText" as const,
17
26
  config: {
18
- multi: ["paragraph", "strong", "em", "hyperlink"].join(","),
27
+ multi: TableCellModelNodeTypes.join(","),
19
28
  },
20
29
  }
@@ -1,30 +1,34 @@
1
1
  import { z } from "zod/mini"
2
2
 
3
+ import type { GroupModel } from "./group"
3
4
  import { GroupModelSchema } from "./group"
5
+ import type { NestableModel } from "./nestable"
4
6
  import { NestableModelSchema } from "./nestable"
5
7
  import { SliceModelTypeSchema } from "./slice"
8
+ import type { DynamicSlicesModel, StaticSlicesModel } from "./slices"
6
9
  import { DynamicSlicesModelSchema, StaticSlicesModelSchema } from "./slices"
10
+ import type { UIDModel } from "./uid"
7
11
  import { UIDModelSchema } from "./uid"
8
12
 
9
13
  // StaticWidget = UID | Nestable | Group | StaticSlices
10
- export const StaticWidgetModelSchema = z.union([
14
+ export const StaticWidgetModelSchema: z.ZodMiniType<StaticWidgetModel> = z.union([
11
15
  UIDModelSchema,
12
16
  NestableModelSchema,
13
17
  GroupModelSchema,
14
18
  StaticSlicesModelSchema,
15
19
  ])
16
20
 
17
- export type StaticWidgetModel = z.infer<typeof StaticWidgetModelSchema>
21
+ export type StaticWidgetModel = UIDModel | NestableModel | GroupModel | StaticSlicesModel
18
22
 
19
23
  // DynamicWidget = UID | Nestable | Group | DynamicSlices
20
- export const DynamicWidgetModelSchema = z.union([
24
+ export const DynamicWidgetModelSchema: z.ZodMiniType<DynamicWidgetModel> = z.union([
21
25
  UIDModelSchema,
22
26
  NestableModelSchema,
23
27
  GroupModelSchema,
24
28
  DynamicSlicesModelSchema,
25
29
  ])
26
30
 
27
- export type DynamicWidgetModel = z.infer<typeof DynamicWidgetModelSchema>
31
+ export type DynamicWidgetModel = UIDModel | NestableModel | GroupModel | DynamicSlicesModel
28
32
 
29
33
  // FieldModelType - all possible field type strings
30
34
  export const FieldModelTypeSchema = z.enum([