@prismicio/types-internal 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. package/README.md +13 -13
  2. package/{dist → lib}/customtypes/CustomType.d.ts +699 -699
  3. package/{dist → lib}/customtypes/CustomType.js +28 -28
  4. package/{dist → lib}/customtypes/Format.d.ts +0 -0
  5. package/{dist → lib}/customtypes/Format.js +0 -0
  6. package/{dist → lib}/customtypes/Section.d.ts +1038 -1038
  7. package/{dist → lib}/customtypes/Section.js +2 -3
  8. package/lib/customtypes/index.d.ts +4 -0
  9. package/{dist → lib}/customtypes/index.js +4 -4
  10. package/{dist → lib}/customtypes/widgets/Group.d.ts +45 -45
  11. package/{dist → lib}/customtypes/widgets/Group.js +8 -8
  12. package/{dist → lib}/customtypes/widgets/UID.d.ts +4 -4
  13. package/{dist → lib}/customtypes/widgets/UID.js +7 -7
  14. package/{dist → lib}/customtypes/widgets/Widget.d.ts +1039 -1039
  15. package/{dist → lib}/customtypes/widgets/Widget.js +9 -12
  16. package/{dist → lib}/customtypes/widgets/WidgetTypes.d.ts +0 -0
  17. package/{dist → lib}/customtypes/widgets/WidgetTypes.js +0 -0
  18. package/lib/customtypes/widgets/index.d.ts +7 -0
  19. package/{dist → lib}/customtypes/widgets/index.js +4 -4
  20. package/{dist → lib}/customtypes/widgets/nestable/BooleanField.d.ts +3 -3
  21. package/{dist → lib}/customtypes/widgets/nestable/BooleanField.js +6 -6
  22. package/{dist → lib}/customtypes/widgets/nestable/Color.d.ts +4 -4
  23. package/{dist → lib}/customtypes/widgets/nestable/Color.js +6 -6
  24. package/{dist → lib}/customtypes/widgets/nestable/Date.d.ts +4 -4
  25. package/{dist → lib}/customtypes/widgets/nestable/Date.js +7 -7
  26. package/{dist → lib}/customtypes/widgets/nestable/Embed.d.ts +4 -4
  27. package/{dist → lib}/customtypes/widgets/nestable/Embed.js +7 -7
  28. package/{dist → lib}/customtypes/widgets/nestable/GeoPoint.d.ts +4 -4
  29. package/{dist → lib}/customtypes/widgets/nestable/GeoPoint.js +6 -6
  30. package/lib/customtypes/widgets/nestable/Image.d.ts +23 -0
  31. package/{dist → lib}/customtypes/widgets/nestable/Image.js +10 -10
  32. package/{dist → lib}/customtypes/widgets/nestable/IntegrationField.d.ts +4 -4
  33. package/{dist → lib}/customtypes/widgets/nestable/IntegrationField.js +7 -7
  34. package/{dist → lib}/customtypes/widgets/nestable/Link.d.ts +4 -4
  35. package/{dist → lib}/customtypes/widgets/nestable/Link.js +18 -23
  36. package/{dist → lib}/customtypes/widgets/nestable/NestableWidget.d.ts +42 -42
  37. package/{dist → lib}/customtypes/widgets/nestable/NestableWidget.js +5 -5
  38. package/{dist → lib}/customtypes/widgets/nestable/Number.d.ts +4 -4
  39. package/{dist → lib}/customtypes/widgets/nestable/Number.js +8 -8
  40. package/{dist → lib}/customtypes/widgets/nestable/Range.d.ts +4 -4
  41. package/{dist → lib}/customtypes/widgets/nestable/Range.js +7 -7
  42. package/{dist → lib}/customtypes/widgets/nestable/RichText.d.ts +6 -6
  43. package/{dist → lib}/customtypes/widgets/nestable/RichText.js +42 -48
  44. package/lib/customtypes/widgets/nestable/Select.d.ts +15 -0
  45. package/{dist → lib}/customtypes/widgets/nestable/Select.js +7 -9
  46. package/{dist → lib}/customtypes/widgets/nestable/Separator.d.ts +3 -3
  47. package/{dist → lib}/customtypes/widgets/nestable/Separator.js +5 -5
  48. package/{dist → lib}/customtypes/widgets/nestable/Text.d.ts +4 -4
  49. package/{dist → lib}/customtypes/widgets/nestable/Text.js +7 -7
  50. package/{dist → lib}/customtypes/widgets/nestable/Timestamp.d.ts +4 -4
  51. package/{dist → lib}/customtypes/widgets/nestable/Timestamp.js +7 -7
  52. package/lib/customtypes/widgets/nestable/index.d.ts +15 -0
  53. package/{dist → lib}/customtypes/widgets/nestable/index.js +0 -0
  54. package/{dist → lib}/customtypes/widgets/shared/ImageConstraint.d.ts +3 -3
  55. package/{dist → lib}/customtypes/widgets/shared/ImageConstraint.js +16 -15
  56. package/lib/customtypes/widgets/shared/index.d.ts +1 -0
  57. package/{dist → lib}/customtypes/widgets/shared/index.js +0 -0
  58. package/{dist → lib}/customtypes/widgets/slices/CompositeSlice.d.ts +87 -87
  59. package/{dist → lib}/customtypes/widgets/slices/CompositeSlice.js +8 -8
  60. package/{dist → lib}/customtypes/widgets/slices/LegacySlice.d.ts +87 -87
  61. package/{dist → lib}/customtypes/widgets/slices/LegacySlice.js +3 -7
  62. package/{dist → lib}/customtypes/widgets/slices/SharedSlice.d.ts +84 -84
  63. package/{dist → lib}/customtypes/widgets/slices/SharedSlice.js +7 -7
  64. package/{dist → lib}/customtypes/widgets/slices/SharedSliceRef.d.ts +2 -2
  65. package/{dist → lib}/customtypes/widgets/slices/SharedSliceRef.js +1 -1
  66. package/{dist → lib}/customtypes/widgets/slices/Slice.d.ts +1 -1
  67. package/{dist → lib}/customtypes/widgets/slices/Slice.js +0 -0
  68. package/{dist → lib}/customtypes/widgets/slices/Slices.d.ts +1556 -1556
  69. package/{dist → lib}/customtypes/widgets/slices/Slices.js +31 -23
  70. package/{dist → lib}/customtypes/widgets/slices/SlicesTypes.d.ts +0 -0
  71. package/{dist → lib}/customtypes/widgets/slices/SlicesTypes.js +0 -0
  72. package/lib/customtypes/widgets/slices/index.d.ts +7 -0
  73. package/{dist → lib}/customtypes/widgets/slices/index.js +3 -3
  74. package/lib/documents/DocumentData.d.ts +8 -0
  75. package/lib/documents/DocumentData.js +46 -0
  76. package/lib/documents/index.d.ts +2 -0
  77. package/lib/documents/index.js +28 -0
  78. package/lib/documents/widgets/EmptyContent.d.ts +8 -0
  79. package/lib/documents/widgets/EmptyContent.js +9 -0
  80. package/lib/documents/widgets/GroupContent.d.ts +16 -0
  81. package/lib/documents/widgets/GroupContent.js +77 -0
  82. package/lib/documents/widgets/SimpleWidgetContent.d.ts +20 -0
  83. package/lib/documents/widgets/SimpleWidgetContent.js +96 -0
  84. package/lib/documents/widgets/StaticWidgetContent.d.ts +10 -0
  85. package/lib/documents/widgets/StaticWidgetContent.js +44 -0
  86. package/lib/documents/widgets/UIDContent.d.ts +7 -0
  87. package/lib/documents/widgets/UIDContent.js +28 -0
  88. package/lib/documents/widgets/Widget.d.ts +0 -0
  89. package/lib/documents/widgets/Widget.js +1 -0
  90. package/lib/documents/widgets/index.d.ts +35 -0
  91. package/lib/documents/widgets/index.js +60 -0
  92. package/lib/documents/widgets/nestable/BooleanContent.d.ts +8 -0
  93. package/lib/documents/widgets/nestable/BooleanContent.js +29 -0
  94. package/lib/documents/widgets/nestable/EmbedContent.d.ts +40 -0
  95. package/lib/documents/widgets/nestable/EmbedContent.js +54 -0
  96. package/lib/documents/widgets/nestable/FieldContent.d.ts +12 -0
  97. package/lib/documents/widgets/nestable/FieldContent.js +53 -0
  98. package/lib/documents/widgets/nestable/GeoPointContent.d.ts +17 -0
  99. package/lib/documents/widgets/nestable/GeoPointContent.js +31 -0
  100. package/lib/documents/widgets/nestable/ImageContent.d.ts +127 -0
  101. package/lib/documents/widgets/nestable/ImageContent.js +59 -0
  102. package/lib/documents/widgets/nestable/IntegrationFieldsContent.d.ts +8 -0
  103. package/lib/documents/widgets/nestable/IntegrationFieldsContent.js +34 -0
  104. package/lib/documents/widgets/nestable/Link/DocumentLink.d.ts +12 -0
  105. package/lib/documents/widgets/nestable/Link/DocumentLink.js +31 -0
  106. package/lib/documents/widgets/nestable/Link/ExternalLink.d.ts +24 -0
  107. package/lib/documents/widgets/nestable/Link/ExternalLink.js +42 -0
  108. package/lib/documents/widgets/nestable/Link/FileLink.d.ts +22 -0
  109. package/lib/documents/widgets/nestable/Link/FileLink.js +42 -0
  110. package/lib/documents/widgets/nestable/Link/ImageLink.d.ts +28 -0
  111. package/lib/documents/widgets/nestable/Link/ImageLink.js +44 -0
  112. package/lib/documents/widgets/nestable/Link/LinkContent.d.ts +36 -0
  113. package/lib/documents/widgets/nestable/Link/LinkContent.js +31 -0
  114. package/lib/documents/widgets/nestable/Link/index.d.ts +89 -0
  115. package/lib/documents/widgets/nestable/Link/index.js +53 -0
  116. package/lib/documents/widgets/nestable/SeparatorContent.d.ts +7 -0
  117. package/lib/documents/widgets/nestable/SeparatorContent.js +10 -0
  118. package/lib/documents/widgets/nestable/StructuredTextContent/Block.d.ts +274 -0
  119. package/lib/documents/widgets/nestable/StructuredTextContent/Block.js +118 -0
  120. package/lib/documents/widgets/nestable/StructuredTextContent/index.d.ts +9 -0
  121. package/lib/documents/widgets/nestable/StructuredTextContent/index.js +32 -0
  122. package/lib/documents/widgets/nestable/index.d.ts +26 -0
  123. package/lib/documents/widgets/nestable/index.js +64 -0
  124. package/lib/documents/widgets/slices/CompositeSliceContent.d.ts +14 -0
  125. package/lib/documents/widgets/slices/CompositeSliceContent.js +68 -0
  126. package/lib/documents/widgets/slices/SharedSliceContent.d.ts +15 -0
  127. package/lib/documents/widgets/slices/SharedSliceContent.js +80 -0
  128. package/lib/documents/widgets/slices/SimpleSliceContent.d.ts +6 -0
  129. package/lib/documents/widgets/slices/SimpleSliceContent.js +8 -0
  130. package/lib/documents/widgets/slices/SliceWidgetContent.d.ts +8 -0
  131. package/lib/documents/widgets/slices/SliceWidgetContent.js +47 -0
  132. package/lib/documents/widgets/slices/SlicesContent.d.ts +17 -0
  133. package/lib/documents/widgets/slices/SlicesContent.js +69 -0
  134. package/lib/documents/widgets/slices/index.d.ts +5 -0
  135. package/lib/documents/widgets/slices/index.js +17 -0
  136. package/lib/index.d.ts +3 -0
  137. package/lib/index.js +25 -0
  138. package/lib/validators/DateFromString.d.ts +3 -0
  139. package/lib/validators/DateFromString.js +28 -0
  140. package/lib/validators/DateFromStringOrNumber.d.ts +3 -0
  141. package/lib/validators/DateFromStringOrNumber.js +28 -0
  142. package/lib/validators/DateFromTsMs.d.ts +3 -0
  143. package/lib/validators/DateFromTsMs.js +28 -0
  144. package/lib/validators/IntFromNumber.d.ts +5 -0
  145. package/{dist → lib}/validators/IntFromNumber.js +4 -7
  146. package/lib/validators/IntFromPixels.d.ts +8 -0
  147. package/{dist → lib}/validators/IntFromPixels.js +5 -5
  148. package/lib/validators/NonEmptyString.d.ts +3 -0
  149. package/lib/validators/NonEmptyString.js +24 -0
  150. package/lib/validators/NonEmptyStringOrNull.d.ts +3 -0
  151. package/lib/validators/NonEmptyStringOrNull.js +17 -0
  152. package/lib/validators/NumberOrNull.d.ts +3 -0
  153. package/{dist/index.js → lib/validators/NumberOrNull.js} +3 -2
  154. package/lib/validators/StringFromBoolean.d.ts +5 -0
  155. package/{dist → lib}/validators/StringFromBoolean.js +5 -8
  156. package/lib/validators/StringFromNumber.d.ts +5 -0
  157. package/{dist → lib}/validators/StringFromNumber.js +5 -8
  158. package/lib/validators/StringOrNull.d.ts +3 -0
  159. package/{dist → lib}/validators/StringOrNull.js +2 -2
  160. package/lib/validators/function.d.ts +14 -0
  161. package/lib/validators/function.js +77 -0
  162. package/lib/validators/index.d.ts +12 -0
  163. package/lib/validators/index.js +48 -0
  164. package/package.json +30 -18
  165. package/src/customtypes/CustomType.ts +173 -116
  166. package/src/customtypes/Format.ts +3 -3
  167. package/src/customtypes/Section.ts +26 -13
  168. package/src/customtypes/index.ts +4 -4
  169. package/src/customtypes/widgets/Group.ts +21 -20
  170. package/src/customtypes/widgets/UID.ts +18 -17
  171. package/src/customtypes/widgets/Widget.ts +22 -23
  172. package/src/customtypes/widgets/WidgetTypes.ts +21 -21
  173. package/src/customtypes/widgets/index.ts +7 -7
  174. package/src/customtypes/widgets/nestable/BooleanField.ts +19 -19
  175. package/src/customtypes/widgets/nestable/Color.ts +17 -16
  176. package/src/customtypes/widgets/nestable/Date.ts +19 -18
  177. package/src/customtypes/widgets/nestable/Embed.ts +19 -18
  178. package/src/customtypes/widgets/nestable/GeoPoint.ts +17 -16
  179. package/src/customtypes/widgets/nestable/Image.ts +26 -26
  180. package/src/customtypes/widgets/nestable/IntegrationField.ts +18 -17
  181. package/src/customtypes/widgets/nestable/Link.ts +80 -68
  182. package/src/customtypes/widgets/nestable/NestableWidget.ts +32 -32
  183. package/src/customtypes/widgets/nestable/Number.ts +22 -21
  184. package/src/customtypes/widgets/nestable/Range.ts +22 -21
  185. package/src/customtypes/widgets/nestable/RichText.ts +164 -134
  186. package/src/customtypes/widgets/nestable/Select.ts +22 -21
  187. package/src/customtypes/widgets/nestable/Separator.ts +15 -14
  188. package/src/customtypes/widgets/nestable/Text.ts +18 -17
  189. package/src/customtypes/widgets/nestable/Timestamp.ts +19 -18
  190. package/src/customtypes/widgets/nestable/index.ts +15 -15
  191. package/src/customtypes/widgets/shared/ImageConstraint.ts +31 -29
  192. package/src/customtypes/widgets/shared/index.ts +1 -1
  193. package/src/customtypes/widgets/slices/CompositeSlice.ts +21 -21
  194. package/src/customtypes/widgets/slices/LegacySlice.ts +6 -10
  195. package/src/customtypes/widgets/slices/SharedSlice.ts +33 -31
  196. package/src/customtypes/widgets/slices/SharedSliceRef.ts +6 -6
  197. package/src/customtypes/widgets/slices/Slice.ts +4 -4
  198. package/src/customtypes/widgets/slices/Slices.ts +95 -73
  199. package/src/customtypes/widgets/slices/SlicesTypes.ts +3 -3
  200. package/src/customtypes/widgets/slices/index.ts +7 -7
  201. package/src/documents/DocumentData.ts +54 -0
  202. package/src/documents/index.ts +2 -0
  203. package/src/documents/widgets/EmptyContent.ts +8 -0
  204. package/src/documents/widgets/GroupContent.ts +91 -0
  205. package/src/documents/widgets/SimpleWidgetContent.ts +96 -0
  206. package/src/documents/widgets/StaticWidgetContent.ts +46 -0
  207. package/src/documents/widgets/UIDContent.ts +18 -0
  208. package/src/documents/widgets/index.ts +56 -0
  209. package/src/documents/widgets/nestable/BooleanContent.ts +21 -0
  210. package/src/documents/widgets/nestable/EmbedContent.ts +54 -0
  211. package/src/documents/widgets/nestable/FieldContent.ts +45 -0
  212. package/src/documents/widgets/nestable/GeoPointContent.ts +18 -0
  213. package/src/documents/widgets/nestable/ImageContent.ts +51 -0
  214. package/src/documents/widgets/nestable/IntegrationFieldsContent.ts +26 -0
  215. package/src/documents/widgets/nestable/Link/DocumentLink.ts +18 -0
  216. package/src/documents/widgets/nestable/Link/ExternalLink.ts +31 -0
  217. package/src/documents/widgets/nestable/Link/FileLink.ts +29 -0
  218. package/src/documents/widgets/nestable/Link/ImageLink.ts +31 -0
  219. package/src/documents/widgets/nestable/Link/LinkContent.ts +22 -0
  220. package/src/documents/widgets/nestable/Link/index.ts +33 -0
  221. package/src/documents/widgets/nestable/SeparatorContent.ts +8 -0
  222. package/src/documents/widgets/nestable/StructuredTextContent/Block.ts +122 -0
  223. package/src/documents/widgets/nestable/StructuredTextContent/index.ts +25 -0
  224. package/src/documents/widgets/nestable/index.ts +35 -0
  225. package/src/documents/widgets/slices/CompositeSliceContent.ts +77 -0
  226. package/src/documents/widgets/slices/SharedSliceContent.ts +94 -0
  227. package/src/documents/widgets/slices/SimpleSliceContent.ts +4 -0
  228. package/src/documents/widgets/slices/SliceWidgetContent.ts +51 -0
  229. package/src/documents/widgets/slices/SlicesContent.ts +91 -0
  230. package/src/documents/widgets/slices/index.ts +5 -0
  231. package/src/index.ts +3 -1
  232. package/src/validators/DateFromString.ts +17 -0
  233. package/src/validators/DateFromStringOrNumber.ts +17 -0
  234. package/src/validators/DateFromTsMs.ts +17 -0
  235. package/src/validators/IntFromNumber.ts +22 -24
  236. package/src/validators/IntFromPixels.ts +27 -26
  237. package/src/validators/NonEmptyString.ts +9 -0
  238. package/src/validators/NonEmptyStringOrNull.ts +22 -0
  239. package/src/validators/NumberOrNull.ts +5 -0
  240. package/src/validators/StringFromBoolean.ts +17 -19
  241. package/src/validators/StringFromNumber.ts +17 -19
  242. package/src/validators/StringOrNull.ts +4 -2
  243. package/src/validators/function.ts +71 -0
  244. package/src/validators/index.ts +12 -0
  245. package/dist/customtypes/index.d.ts +0 -4
  246. package/dist/customtypes/widgets/index.d.ts +0 -7
  247. package/dist/customtypes/widgets/nestable/Image.d.ts +0 -23
  248. package/dist/customtypes/widgets/nestable/Select.d.ts +0 -15
  249. package/dist/customtypes/widgets/nestable/index.d.ts +0 -15
  250. package/dist/customtypes/widgets/shared/index.d.ts +0 -1
  251. package/dist/customtypes/widgets/slices/index.d.ts +0 -7
  252. package/dist/index.d.ts +0 -1
  253. package/dist/index.js.map +0 -1
  254. package/dist/validators/IntFromNumber.d.ts +0 -7
  255. package/dist/validators/IntFromPixels.d.ts +0 -7
  256. package/dist/validators/StringFromBoolean.d.ts +0 -7
  257. package/dist/validators/StringFromNumber.d.ts +0 -7
  258. package/dist/validators/StringOrNull.d.ts +0 -2
@@ -1,25 +1,26 @@
1
- import * as t from 'io-ts'
2
- import { StringOrNull } from '../../../validators/StringOrNull'
3
- import WidgetTypes from '../WidgetTypes'
1
+ import * as t from "io-ts"
2
+
3
+ import { StringOrNull } from "../../../validators"
4
+ import WidgetTypes from "../WidgetTypes"
4
5
 
5
6
  const ColorConfig = t.exact(
6
- t.partial({
7
- label: StringOrNull,
8
- placeholder: t.string,
9
- })
7
+ t.partial({
8
+ label: StringOrNull,
9
+ placeholder: t.string,
10
+ }),
10
11
  )
11
12
  type ColorConfig = t.TypeOf<typeof ColorConfig>
12
13
 
13
14
  const Color = t.exact(
14
- t.intersection([
15
- t.type({
16
- type: t.literal(WidgetTypes.Color)
17
- }),
18
- t.partial({
19
- fieldset: StringOrNull,
20
- config: ColorConfig
21
- })
22
- ])
15
+ t.intersection([
16
+ t.type({
17
+ type: t.literal(WidgetTypes.Color),
18
+ }),
19
+ t.partial({
20
+ fieldset: StringOrNull,
21
+ config: ColorConfig,
22
+ }),
23
+ ]),
23
24
  )
24
25
  type Color = t.TypeOf<typeof Color>
25
26
 
@@ -1,27 +1,28 @@
1
- import * as t from 'io-ts'
2
- import { StringOrNull } from '../../../validators/StringOrNull'
3
- import WidgetTypes from '../WidgetTypes'
1
+ import * as t from "io-ts"
2
+
3
+ import { StringOrNull } from "../../../validators"
4
+ import WidgetTypes from "../WidgetTypes"
4
5
 
5
6
  const DateConfig = t.exact(
6
- t.partial({
7
- label: StringOrNull,
8
- placeholder: t.string,
9
- default: t.string
10
- })
7
+ t.partial({
8
+ label: StringOrNull,
9
+ placeholder: t.string,
10
+ default: t.string,
11
+ }),
11
12
  )
12
13
  type DateConfig = t.TypeOf<typeof DateConfig>
13
14
 
14
15
  const Date = t.exact(
15
- t.intersection([
16
- t.type({
17
- type: t.literal(WidgetTypes.Date)
18
- }),
19
- t.partial({
20
- fieldset: StringOrNull,
21
- config: DateConfig
22
- })
23
- ])
16
+ t.intersection([
17
+ t.type({
18
+ type: t.literal(WidgetTypes.Date),
19
+ }),
20
+ t.partial({
21
+ fieldset: StringOrNull,
22
+ config: DateConfig,
23
+ }),
24
+ ]),
24
25
  )
25
26
  type Date = t.TypeOf<typeof Date>
26
27
 
27
- export default Date
28
+ export default Date
@@ -1,27 +1,28 @@
1
- import * as t from 'io-ts'
2
- import { StringOrNull } from '../../../validators/StringOrNull'
3
- import WidgetTypes from '../WidgetTypes'
1
+ import * as t from "io-ts"
2
+
3
+ import { StringOrNull } from "../../../validators"
4
+ import WidgetTypes from "../WidgetTypes"
4
5
 
5
6
  const EmbedConfig = t.exact(
6
- t.partial({
7
- label: StringOrNull,
8
- placeholder: t.string,
9
- useAsTitle: t.boolean
10
- })
7
+ t.partial({
8
+ label: StringOrNull,
9
+ placeholder: t.string,
10
+ useAsTitle: t.boolean,
11
+ }),
11
12
  )
12
13
  type EmbedConfig = t.TypeOf<typeof EmbedConfig>
13
14
 
14
15
  const Embed = t.exact(
15
- t.intersection([
16
- t.type({
17
- type: t.literal(WidgetTypes.Embed)
18
- }),
19
- t.partial({
20
- fieldset: StringOrNull,
21
- config: EmbedConfig
22
- })
23
- ])
16
+ t.intersection([
17
+ t.type({
18
+ type: t.literal(WidgetTypes.Embed),
19
+ }),
20
+ t.partial({
21
+ fieldset: StringOrNull,
22
+ config: EmbedConfig,
23
+ }),
24
+ ]),
24
25
  )
25
26
  type Embed = t.TypeOf<typeof Embed>
26
27
 
27
- export default Embed
28
+ export default Embed
@@ -1,25 +1,26 @@
1
- import * as t from 'io-ts'
2
- import { StringOrNull } from '../../../validators/StringOrNull'
3
- import WidgetTypes from '../WidgetTypes'
1
+ import * as t from "io-ts"
2
+
3
+ import { StringOrNull } from "../../../validators"
4
+ import WidgetTypes from "../WidgetTypes"
4
5
 
5
6
  const GeoPointConfig = t.exact(
6
- t.partial({
7
- label: StringOrNull
8
- })
7
+ t.partial({
8
+ label: StringOrNull,
9
+ }),
9
10
  )
10
11
  type GeoPointConfig = t.TypeOf<typeof GeoPointConfig>
11
12
 
12
13
  const GeoPoint = t.exact(
13
- t.intersection([
14
- t.type({
15
- type: t.literal(WidgetTypes.GeoPoint)
16
- }),
17
- t.partial({
18
- fieldset: StringOrNull,
19
- config: GeoPointConfig
20
- })
21
- ])
14
+ t.intersection([
15
+ t.type({
16
+ type: t.literal(WidgetTypes.GeoPoint),
17
+ }),
18
+ t.partial({
19
+ fieldset: StringOrNull,
20
+ config: GeoPointConfig,
21
+ }),
22
+ ]),
22
23
  )
23
24
  type GeoPoint = t.TypeOf<typeof GeoPoint>
24
25
 
25
- export default GeoPoint
26
+ export default GeoPoint
@@ -1,39 +1,39 @@
1
- import * as t from 'io-ts'
2
- import { StringOrNull } from '../../../validators/StringOrNull'
3
- import WidgetTypes from '../WidgetTypes'
4
- import ImageConstraint from '../shared/ImageConstraint'
1
+ import * as t from "io-ts"
2
+
3
+ import { StringOrNull } from "../../../validators"
4
+ import ImageConstraint from "../shared/ImageConstraint"
5
+ import WidgetTypes from "../WidgetTypes"
5
6
 
6
7
  const Thumbnail = t.exact(
7
- t.intersection([
8
- t.type({
9
- name: t.string
10
- }),
11
- ImageConstraint
12
- ])
8
+ t.intersection([
9
+ t.type({
10
+ name: t.string,
11
+ }),
12
+ ImageConstraint,
13
+ ]),
13
14
  )
14
15
  type Thumbnail = t.TypeOf<typeof Thumbnail>
15
16
 
16
17
  const ImageConfig = t.exact(
17
- t.partial({
18
- label: StringOrNull,
19
- placeholder: t.string,
20
- constraint: ImageConstraint,
21
- thumbnails: t.array(Thumbnail)
22
- })
18
+ t.partial({
19
+ label: StringOrNull,
20
+ placeholder: t.string,
21
+ constraint: ImageConstraint,
22
+ thumbnails: t.array(Thumbnail),
23
+ }),
23
24
  )
24
25
  type ImageConfig = t.TypeOf<typeof ImageConfig>
25
26
 
26
-
27
27
  const Image = t.exact(
28
- t.intersection([
29
- t.type({
30
- type: t.literal(WidgetTypes.Image)
31
- }),
32
- t.partial({
33
- fieldset: StringOrNull,
34
- config: ImageConfig
35
- })
36
- ])
28
+ t.intersection([
29
+ t.type({
30
+ type: t.literal(WidgetTypes.Image),
31
+ }),
32
+ t.partial({
33
+ fieldset: StringOrNull,
34
+ config: ImageConfig,
35
+ }),
36
+ ]),
37
37
  )
38
38
  type Image = t.TypeOf<typeof Image>
39
39
 
@@ -1,26 +1,27 @@
1
- import * as t from 'io-ts'
2
- import { StringOrNull } from '../../../validators/StringOrNull'
3
- import WidgetTypes from '../WidgetTypes'
1
+ import * as t from "io-ts"
2
+
3
+ import { StringOrNull } from "../../../validators"
4
+ import WidgetTypes from "../WidgetTypes"
4
5
 
5
6
  const IntegrationFieldConfig = t.exact(
6
- t.partial({
7
- label: StringOrNull,
8
- placeholder: t.string,
9
- catalog: t.string
10
- })
7
+ t.partial({
8
+ label: StringOrNull,
9
+ placeholder: t.string,
10
+ catalog: t.string,
11
+ }),
11
12
  )
12
13
  type IntegrationFieldConfig = t.TypeOf<typeof IntegrationFieldConfig>
13
14
 
14
15
  const IntegrationField = t.exact(
15
- t.intersection([
16
- t.type({
17
- type: t.literal(WidgetTypes.IntegrationField)
18
- }),
19
- t.partial({
20
- fieldset: StringOrNull,
21
- config: IntegrationFieldConfig
22
- })
23
- ])
16
+ t.intersection([
17
+ t.type({
18
+ type: t.literal(WidgetTypes.IntegrationField),
19
+ }),
20
+ t.partial({
21
+ fieldset: StringOrNull,
22
+ config: IntegrationFieldConfig,
23
+ }),
24
+ ]),
24
25
  )
25
26
  type IntegrationField = t.TypeOf<typeof IntegrationField>
26
27
 
@@ -1,84 +1,96 @@
1
- import * as t from 'io-ts'
2
- import { withFallback } from 'io-ts-types/lib/withFallback'
3
- import { either } from 'fp-ts/lib/Either'
4
- import { StringOrNull } from '../../../validators/StringOrNull'
5
- import WidgetTypes from '../WidgetTypes'
1
+ import { either } from "fp-ts/lib/Either"
2
+ import * as t from "io-ts"
3
+ import { withFallback } from "io-ts-types/lib/withFallback"
6
4
 
7
- const arrayString = (entries: string | string[] | {
8
- [x: string]: {
9
- name: string;
10
- }[];
11
- } | null) => {
12
- if(entries instanceof Array) {
13
- const isValidEntries = entries.reduce((acc, l) => acc && typeof l === 'string', true)
14
- if(isValidEntries) return t.success(entries)
15
- }
5
+ import { StringOrNull } from "../../../validators"
6
+ import WidgetTypes from "../WidgetTypes"
7
+
8
+ const arrayString = (
9
+ entries:
10
+ | string
11
+ | string[]
12
+ | {
13
+ [x: string]: {
14
+ name: string
15
+ }[]
16
+ }
17
+ | undefined,
18
+ ) => {
19
+ if (entries instanceof Array) {
20
+ const isValidEntries = entries.reduce(
21
+ (acc, l) => acc && typeof l === "string",
22
+ true,
23
+ )
24
+ if (isValidEntries) return t.success(entries)
25
+ }
26
+ return
16
27
  }
17
28
 
18
- const plainString = (entries: string | string[] | {
19
- [x: string]: {
20
- name: string;
21
- }[];
22
- } | null) => {
23
- if(typeof entries === 'string') {
24
- return t.success([entries])
25
- }
29
+ const plainString = (
30
+ entries:
31
+ | string
32
+ | string[]
33
+ | {
34
+ [x: string]: {
35
+ name: string
36
+ }[]
37
+ }
38
+ | undefined,
39
+ ) => {
40
+ if (typeof entries === "string") {
41
+ return t.success([entries])
42
+ }
43
+ return
26
44
  }
27
45
 
28
46
  const MasksArrayString = new t.Type<Array<string>, object, unknown>(
29
- 'MasksArrayString',
30
- (u: unknown): u is any => {
31
- return u instanceof Array
32
- },
33
- (u: unknown, context: t.Context) => {
34
- return either.chain(
35
- t.union([
36
- t.array(t.string),
37
- t.string,
38
- ]).validate(u, context), (masks) => {
39
- return (
40
- arrayString(masks) ||
41
- plainString(masks) ||
42
- t.failure(u, context)
43
- )
44
- }
45
- )
46
- },
47
- res => res
47
+ "MasksArrayString",
48
+ (u: unknown): u is Array<string> => {
49
+ return u instanceof Array
50
+ },
51
+ (u: unknown, context: t.Context) => {
52
+ return either.chain(
53
+ t.union([t.array(t.string), t.string]).validate(u, context),
54
+ (masks) => {
55
+ return arrayString(masks) || plainString(masks) || t.failure(u, context)
56
+ },
57
+ )
58
+ },
59
+ (res) => res,
48
60
  )
49
61
 
50
62
  const LinkConfig = t.exact(
51
- t.partial({
52
- label: StringOrNull,
53
- useAsTitle: t.boolean,
54
- placeholder: t.string,
55
- select: withFallback(
56
- t.union([
57
- t.literal('media'),
58
- t.literal('document'),
59
- t.literal('web'),
60
- t.null
61
- ]),
62
- null
63
- ),
64
- customtypes: t.array(t.string), // `customtypes` and `masks` are alternatives
65
- masks: MasksArrayString,
66
- tags: MasksArrayString,
67
- allowTargetBlank: t.boolean
68
- })
63
+ t.partial({
64
+ label: StringOrNull,
65
+ useAsTitle: t.boolean,
66
+ placeholder: t.string,
67
+ select: withFallback(
68
+ t.union([
69
+ t.literal("media"),
70
+ t.literal("document"),
71
+ t.literal("web"),
72
+ t.null,
73
+ ]),
74
+ null,
75
+ ),
76
+ customtypes: t.array(t.string), // `customtypes` and `masks` are alternatives
77
+ masks: MasksArrayString,
78
+ tags: MasksArrayString,
79
+ allowTargetBlank: t.boolean,
80
+ }),
69
81
  )
70
82
  type LinkConfig = t.TypeOf<typeof LinkConfig>
71
83
 
72
84
  const Link = t.exact(
73
- t.intersection([
74
- t.type({
75
- type: t.literal(WidgetTypes.Link)
76
- }),
77
- t.partial({
78
- fieldset: StringOrNull,
79
- config: LinkConfig
80
- })
81
- ])
85
+ t.intersection([
86
+ t.type({
87
+ type: t.literal(WidgetTypes.Link),
88
+ }),
89
+ t.partial({
90
+ fieldset: StringOrNull,
91
+ config: LinkConfig,
92
+ }),
93
+ ]),
82
94
  )
83
95
  type Link = t.TypeOf<typeof Link>
84
96
 
@@ -1,39 +1,39 @@
1
- import * as t from 'io-ts'
1
+ import * as t from "io-ts"
2
2
 
3
- import Color from './Color'
4
- import BooleanField from './BooleanField'
5
- import Date from './Date'
6
- import Embed from './Embed'
7
- import GeoPoint from './GeoPoint'
8
- import Number from './Number'
9
- import Range from './Range'
10
- import RichText from './RichText'
11
- import Select from './Select'
12
- import Separator from './Separator'
13
- import Text from './Text'
14
- import Timestamp from './Timestamp'
15
- import Link from './Link'
16
- import Image from './Image'
17
- import IntegrationField from './IntegrationField'
3
+ import BooleanField from "./BooleanField"
4
+ import Color from "./Color"
5
+ import Date from "./Date"
6
+ import Embed from "./Embed"
7
+ import GeoPoint from "./GeoPoint"
8
+ import Image from "./Image"
9
+ import IntegrationField from "./IntegrationField"
10
+ import Link from "./Link"
11
+ import Number from "./Number"
12
+ import Range from "./Range"
13
+ import RichText from "./RichText"
14
+ import Select from "./Select"
15
+ import Separator from "./Separator"
16
+ import Text from "./Text"
17
+ import Timestamp from "./Timestamp"
18
18
 
19
19
  const NestableWidget = t.union([
20
- Color,
21
- BooleanField,
22
- Embed,
23
- GeoPoint,
24
- Date,
25
- Number,
26
- Range,
27
- RichText,
28
- Select,
29
- Separator,
30
- Text,
31
- Timestamp,
32
- Link,
33
- Image,
34
- IntegrationField
20
+ Color,
21
+ BooleanField,
22
+ Embed,
23
+ GeoPoint,
24
+ Date,
25
+ Number,
26
+ Range,
27
+ RichText,
28
+ Select,
29
+ Separator,
30
+ Text,
31
+ Timestamp,
32
+ Link,
33
+ Image,
34
+ IntegrationField,
35
35
  ])
36
36
 
37
37
  type NestableWidget = t.TypeOf<typeof NestableWidget>
38
38
 
39
- export default NestableWidget
39
+ export default NestableWidget
@@ -1,30 +1,31 @@
1
- import * as t from 'io-ts'
2
- import { StringOrNull } from '../../../validators/StringOrNull'
3
- import WidgetTypes from '../WidgetTypes'
4
- import { NumberFromString } from 'io-ts-types/lib/NumberFromString'
1
+ import * as t from "io-ts"
2
+ import { NumberFromString } from "io-ts-types/lib/NumberFromString"
3
+
4
+ import { StringOrNull } from "../../../validators"
5
+ import WidgetTypes from "../WidgetTypes"
5
6
 
6
7
  const NumberConfig = t.exact(
7
- t.partial({
8
- label: StringOrNull,
9
- placeholder: t.string,
10
- min: t.union([t.number, NumberFromString]),
11
- max: t.union([t.number, NumberFromString]),
12
- step: t.union([t.number, NumberFromString])
13
- })
8
+ t.partial({
9
+ label: StringOrNull,
10
+ placeholder: t.string,
11
+ min: t.union([t.number, NumberFromString]),
12
+ max: t.union([t.number, NumberFromString]),
13
+ step: t.union([t.number, NumberFromString]),
14
+ }),
14
15
  )
15
16
  type NumberConfig = t.TypeOf<typeof NumberConfig>
16
17
 
17
18
  const Number = t.exact(
18
- t.intersection([
19
- t.type({
20
- type: t.literal(WidgetTypes.Number)
21
- }),
22
- t.partial({
23
- fieldset: StringOrNull,
24
- config: NumberConfig
25
- })
26
- ])
19
+ t.intersection([
20
+ t.type({
21
+ type: t.literal(WidgetTypes.Number),
22
+ }),
23
+ t.partial({
24
+ fieldset: StringOrNull,
25
+ config: NumberConfig,
26
+ }),
27
+ ]),
27
28
  )
28
29
  type Number = t.TypeOf<typeof Number>
29
30
 
30
- export default Number
31
+ export default Number
@@ -1,30 +1,31 @@
1
- import * as t from 'io-ts'
2
- import { StringOrNull } from '../../../validators/StringOrNull'
3
- import WidgetTypes from '../WidgetTypes'
4
- import { NumberFromString } from 'io-ts-types/lib/NumberFromString'
1
+ import * as t from "io-ts"
2
+ import { NumberFromString } from "io-ts-types/lib/NumberFromString"
3
+
4
+ import { StringOrNull } from "../../../validators"
5
+ import WidgetTypes from "../WidgetTypes"
5
6
 
6
7
  const RangeConfig = t.exact(
7
- t.partial({
8
- label: StringOrNull,
9
- placeholder: t.string,
10
- min: t.union([t.number, NumberFromString]),
11
- max: t.union([t.number, NumberFromString]),
12
- step: t.union([t.number, NumberFromString]),
13
- })
8
+ t.partial({
9
+ label: StringOrNull,
10
+ placeholder: t.string,
11
+ min: t.union([t.number, NumberFromString]),
12
+ max: t.union([t.number, NumberFromString]),
13
+ step: t.union([t.number, NumberFromString]),
14
+ }),
14
15
  )
15
16
  type RangeConfig = t.TypeOf<typeof RangeConfig>
16
17
 
17
18
  const Range = t.exact(
18
- t.intersection([
19
- t.type({
20
- type: t.literal(WidgetTypes.Range)
21
- }),
22
- t.partial({
23
- fieldset: StringOrNull,
24
- config: RangeConfig
25
- })
26
- ])
19
+ t.intersection([
20
+ t.type({
21
+ type: t.literal(WidgetTypes.Range),
22
+ }),
23
+ t.partial({
24
+ fieldset: StringOrNull,
25
+ config: RangeConfig,
26
+ }),
27
+ ]),
27
28
  )
28
29
  type Range = t.TypeOf<typeof Range>
29
30
 
30
- export default Range
31
+ export default Range