@prismicio/types-internal 2.2.0 → 2.2.1-remove-import.alpha-1

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/lib/common/UUID.d.ts +1 -2
  2. package/package.json +1 -1
  3. package/src/common/UUID.ts +1 -1
  4. package/lib/import/converters/Document.d.ts +0 -4
  5. package/lib/import/converters/Document.js +0 -21
  6. package/lib/import/converters/fields/Group.d.ts +0 -4
  7. package/lib/import/converters/fields/Group.js +0 -14
  8. package/lib/import/converters/fields/RepeatableZone.d.ts +0 -317
  9. package/lib/import/converters/fields/RepeatableZone.js +0 -15
  10. package/lib/import/converters/fields/RepeatableZoneItem.d.ts +0 -11
  11. package/lib/import/converters/fields/RepeatableZoneItem.js +0 -19
  12. package/lib/import/converters/fields/Slices/SharedSlice.d.ts +0 -4
  13. package/lib/import/converters/fields/Slices/SharedSlice.js +0 -19
  14. package/lib/import/converters/fields/Slices/SharedSliceContent.d.ts +0 -10
  15. package/lib/import/converters/fields/Slices/SharedSliceContent.js +0 -23
  16. package/lib/import/converters/fields/Slices/Slices.d.ts +0 -4
  17. package/lib/import/converters/fields/Slices/Slices.js +0 -16
  18. package/lib/import/converters/fields/Slices/index.d.ts +0 -1
  19. package/lib/import/converters/fields/Slices/index.js +0 -4
  20. package/lib/import/converters/fields/UID.d.ts +0 -3
  21. package/lib/import/converters/fields/UID.js +0 -10
  22. package/lib/import/converters/fields/index.d.ts +0 -4
  23. package/lib/import/converters/fields/index.js +0 -7
  24. package/lib/import/converters/fields/nestable/Boolean.d.ts +0 -3
  25. package/lib/import/converters/fields/nestable/Boolean.js +0 -12
  26. package/lib/import/converters/fields/nestable/Color.d.ts +0 -3
  27. package/lib/import/converters/fields/nestable/Color.js +0 -13
  28. package/lib/import/converters/fields/nestable/Date.d.ts +0 -3
  29. package/lib/import/converters/fields/nestable/Date.js +0 -15
  30. package/lib/import/converters/fields/nestable/Embed.d.ts +0 -4
  31. package/lib/import/converters/fields/nestable/Embed.js +0 -32
  32. package/lib/import/converters/fields/nestable/GeoPoint.d.ts +0 -3
  33. package/lib/import/converters/fields/nestable/GeoPoint.js +0 -15
  34. package/lib/import/converters/fields/nestable/Image.d.ts +0 -28
  35. package/lib/import/converters/fields/nestable/Image.js +0 -67
  36. package/lib/import/converters/fields/nestable/Link.d.ts +0 -4
  37. package/lib/import/converters/fields/nestable/Link.js +0 -70
  38. package/lib/import/converters/fields/nestable/Nestable.d.ts +0 -5
  39. package/lib/import/converters/fields/nestable/Nestable.js +0 -35
  40. package/lib/import/converters/fields/nestable/Number.d.ts +0 -3
  41. package/lib/import/converters/fields/nestable/Number.js +0 -13
  42. package/lib/import/converters/fields/nestable/RichText/embedBlock.d.ts +0 -4
  43. package/lib/import/converters/fields/nestable/RichText/embedBlock.js +0 -14
  44. package/lib/import/converters/fields/nestable/RichText/imageBlock.d.ts +0 -4
  45. package/lib/import/converters/fields/nestable/RichText/imageBlock.js +0 -12
  46. package/lib/import/converters/fields/nestable/RichText/index.d.ts +0 -4
  47. package/lib/import/converters/fields/nestable/RichText/index.js +0 -22
  48. package/lib/import/converters/fields/nestable/RichText/textBlock.d.ts +0 -4
  49. package/lib/import/converters/fields/nestable/RichText/textBlock.js +0 -54
  50. package/lib/import/converters/fields/nestable/Select.d.ts +0 -3
  51. package/lib/import/converters/fields/nestable/Select.js +0 -13
  52. package/lib/import/converters/fields/nestable/Text.d.ts +0 -3
  53. package/lib/import/converters/fields/nestable/Text.js +0 -13
  54. package/lib/import/converters/fields/nestable/Timestamp.d.ts +0 -3
  55. package/lib/import/converters/fields/nestable/Timestamp.js +0 -13
  56. package/lib/import/converters/fields/nestable/index.d.ts +0 -13
  57. package/lib/import/converters/fields/nestable/index.js +0 -16
  58. package/lib/import/converters/index.d.ts +0 -2
  59. package/lib/import/converters/index.js +0 -5
  60. package/lib/import/index.d.ts +0 -2
  61. package/lib/import/index.js +0 -5
  62. package/lib/import/validators/Document.d.ts +0 -6
  63. package/lib/import/validators/Document.js +0 -64
  64. package/lib/import/validators/fields/ImportContent.d.ts +0 -5
  65. package/lib/import/validators/fields/ImportContent.js +0 -21
  66. package/lib/import/validators/fields/ImportField.d.ts +0 -141
  67. package/lib/import/validators/fields/ImportField.js +0 -33
  68. package/lib/import/validators/fields/ImportGroup.d.ts +0 -345
  69. package/lib/import/validators/fields/ImportGroup.js +0 -27
  70. package/lib/import/validators/fields/ImportSlices/ImportSlices.d.ts +0 -8
  71. package/lib/import/validators/fields/ImportSlices/ImportSlices.js +0 -30
  72. package/lib/import/validators/fields/ImportSlices/SharedSlice/SharedSlice.d.ts +0 -16
  73. package/lib/import/validators/fields/ImportSlices/SharedSlice/SharedSlice.js +0 -61
  74. package/lib/import/validators/fields/ImportSlices/SharedSlice/errors.d.ts +0 -4
  75. package/lib/import/validators/fields/ImportSlices/SharedSlice/errors.js +0 -7
  76. package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/OptionalSharedSliceId.d.ts +0 -2
  77. package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/OptionalSharedSliceId.js +0 -15
  78. package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceContent/SharedSliceContent.d.ts +0 -17
  79. package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceContent/SharedSliceContent.js +0 -30
  80. package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceContent/SharedSliceContentEntry.d.ts +0 -43
  81. package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceContent/SharedSliceContentEntry.js +0 -69
  82. package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceContent/errors.d.ts +0 -4
  83. package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceContent/errors.js +0 -6
  84. package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceContent/index.d.ts +0 -2
  85. package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceContent/index.js +0 -5
  86. package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceContent/types.d.ts +0 -1
  87. package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceContent/types.js +0 -2
  88. package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceId.d.ts +0 -9
  89. package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceId.js +0 -39
  90. package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceType.d.ts +0 -11
  91. package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceType.js +0 -24
  92. package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceVariation.d.ts +0 -11
  93. package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceVariation.js +0 -24
  94. package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/index.d.ts +0 -4
  95. package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/index.js +0 -7
  96. package/lib/import/validators/fields/ImportSlices/SharedSlice/index.d.ts +0 -3
  97. package/lib/import/validators/fields/ImportSlices/SharedSlice/index.js +0 -6
  98. package/lib/import/validators/fields/ImportSlices/SharedSlice/utils.d.ts +0 -342
  99. package/lib/import/validators/fields/ImportSlices/SharedSlice/utils.js +0 -11
  100. package/lib/import/validators/fields/ImportSlices/index.d.ts +0 -1
  101. package/lib/import/validators/fields/ImportSlices/index.js +0 -4
  102. package/lib/import/validators/fields/ImportSlices/utils.d.ts +0 -4
  103. package/lib/import/validators/fields/ImportSlices/utils.js +0 -35
  104. package/lib/import/validators/fields/RepeatableZone.d.ts +0 -11
  105. package/lib/import/validators/fields/RepeatableZone.js +0 -14
  106. package/lib/import/validators/fields/RepeatableZoneItem.d.ts +0 -11
  107. package/lib/import/validators/fields/RepeatableZoneItem.js +0 -39
  108. package/lib/import/validators/fields/UID.d.ts +0 -6
  109. package/lib/import/validators/fields/UID.js +0 -15
  110. package/lib/import/validators/fields/index.d.ts +0 -4
  111. package/lib/import/validators/fields/index.js +0 -7
  112. package/lib/import/validators/fields/nestable/Boolean.d.ts +0 -6
  113. package/lib/import/validators/fields/nestable/Boolean.js +0 -6
  114. package/lib/import/validators/fields/nestable/Color.d.ts +0 -6
  115. package/lib/import/validators/fields/nestable/Color.js +0 -15
  116. package/lib/import/validators/fields/nestable/Date.d.ts +0 -6
  117. package/lib/import/validators/fields/nestable/Date.js +0 -19
  118. package/lib/import/validators/fields/nestable/Embed.d.ts +0 -13
  119. package/lib/import/validators/fields/nestable/Embed.js +0 -31
  120. package/lib/import/validators/fields/nestable/GeoPoint.d.ts +0 -13
  121. package/lib/import/validators/fields/nestable/GeoPoint.js +0 -13
  122. package/lib/import/validators/fields/nestable/Image/default.d.ts +0 -22
  123. package/lib/import/validators/fields/nestable/Image/default.js +0 -19
  124. package/lib/import/validators/fields/nestable/Image/index.d.ts +0 -45
  125. package/lib/import/validators/fields/nestable/Image/index.js +0 -41
  126. package/lib/import/validators/fields/nestable/Image/merge.d.ts +0 -23
  127. package/lib/import/validators/fields/nestable/Image/merge.js +0 -44
  128. package/lib/import/validators/fields/nestable/Image/model.d.ts +0 -18
  129. package/lib/import/validators/fields/nestable/Image/model.js +0 -2
  130. package/lib/import/validators/fields/nestable/Image/validators.d.ts +0 -35
  131. package/lib/import/validators/fields/nestable/Image/validators.js +0 -31
  132. package/lib/import/validators/fields/nestable/ImportRichText/ImportBlock.d.ts +0 -6
  133. package/lib/import/validators/fields/nestable/ImportRichText/ImportBlock.js +0 -25
  134. package/lib/import/validators/fields/nestable/ImportRichText/ImportRichText.d.ts +0 -24
  135. package/lib/import/validators/fields/nestable/ImportRichText/ImportRichText.js +0 -32
  136. package/lib/import/validators/fields/nestable/ImportRichText/blocks/ImportBlockType.d.ts +0 -6
  137. package/lib/import/validators/fields/nestable/ImportRichText/blocks/ImportBlockType.js +0 -18
  138. package/lib/import/validators/fields/nestable/ImportRichText/blocks/ImportEmbedBlock.d.ts +0 -10
  139. package/lib/import/validators/fields/nestable/ImportRichText/blocks/ImportEmbedBlock.js +0 -11
  140. package/lib/import/validators/fields/nestable/ImportRichText/blocks/ImportImageBlock.d.ts +0 -22
  141. package/lib/import/validators/fields/nestable/ImportRichText/blocks/ImportImageBlock.js +0 -13
  142. package/lib/import/validators/fields/nestable/ImportRichText/blocks/ImportTextBlock.d.ts +0 -78
  143. package/lib/import/validators/fields/nestable/ImportRichText/blocks/ImportTextBlock.js +0 -43
  144. package/lib/import/validators/fields/nestable/ImportRichText/blocks/Span.d.ts +0 -79
  145. package/lib/import/validators/fields/nestable/ImportRichText/blocks/Span.js +0 -27
  146. package/lib/import/validators/fields/nestable/ImportRichText/blocks/index.d.ts +0 -4
  147. package/lib/import/validators/fields/nestable/ImportRichText/blocks/index.js +0 -7
  148. package/lib/import/validators/fields/nestable/ImportRichText/blocks/spans/HyperlinkSpan.d.ts +0 -24
  149. package/lib/import/validators/fields/nestable/ImportRichText/blocks/spans/HyperlinkSpan.js +0 -18
  150. package/lib/import/validators/fields/nestable/ImportRichText/blocks/spans/LabelSpan.d.ts +0 -12
  151. package/lib/import/validators/fields/nestable/ImportRichText/blocks/spans/LabelSpan.js +0 -16
  152. package/lib/import/validators/fields/nestable/ImportRichText/blocks/spans/SpanLocation.d.ts +0 -5
  153. package/lib/import/validators/fields/nestable/ImportRichText/blocks/spans/SpanLocation.js +0 -10
  154. package/lib/import/validators/fields/nestable/ImportRichText/blocks/spans/TextSpan.d.ts +0 -15
  155. package/lib/import/validators/fields/nestable/ImportRichText/blocks/spans/TextSpan.js +0 -20
  156. package/lib/import/validators/fields/nestable/ImportRichText/blocks/spans/index.d.ts +0 -2
  157. package/lib/import/validators/fields/nestable/ImportRichText/blocks/spans/index.js +0 -5
  158. package/lib/import/validators/fields/nestable/ImportRichText/index.d.ts +0 -2
  159. package/lib/import/validators/fields/nestable/ImportRichText/index.js +0 -7
  160. package/lib/import/validators/fields/nestable/Link.d.ts +0 -53
  161. package/lib/import/validators/fields/nestable/Link.js +0 -35
  162. package/lib/import/validators/fields/nestable/Nestable.d.ts +0 -192
  163. package/lib/import/validators/fields/nestable/Nestable.js +0 -71
  164. package/lib/import/validators/fields/nestable/Number.d.ts +0 -17
  165. package/lib/import/validators/fields/nestable/Number.js +0 -17
  166. package/lib/import/validators/fields/nestable/Select.d.ts +0 -16
  167. package/lib/import/validators/fields/nestable/Select.js +0 -19
  168. package/lib/import/validators/fields/nestable/Text.d.ts +0 -6
  169. package/lib/import/validators/fields/nestable/Text.js +0 -6
  170. package/lib/import/validators/fields/nestable/Timestamp.d.ts +0 -7
  171. package/lib/import/validators/fields/nestable/Timestamp.js +0 -19
  172. package/lib/import/validators/fields/nestable/index.d.ts +0 -14
  173. package/lib/import/validators/fields/nestable/index.js +0 -19
  174. package/lib/import/validators/index.d.ts +0 -2
  175. package/lib/import/validators/index.js +0 -5
  176. package/lib/utils/io-ts.d.ts +0 -2
  177. package/lib/utils/io-ts.js +0 -22
  178. package/src/import/converters/Document.ts +0 -38
  179. package/src/import/converters/fields/Group.ts +0 -18
  180. package/src/import/converters/fields/RepeatableZone.ts +0 -19
  181. package/src/import/converters/fields/RepeatableZoneItem.ts +0 -32
  182. package/src/import/converters/fields/Slices/SharedSlice.ts +0 -24
  183. package/src/import/converters/fields/Slices/SharedSliceContent.ts +0 -27
  184. package/src/import/converters/fields/Slices/Slices.ts +0 -20
  185. package/src/import/converters/fields/Slices/index.ts +0 -1
  186. package/src/import/converters/fields/UID.ts +0 -9
  187. package/src/import/converters/fields/index.ts +0 -4
  188. package/src/import/converters/fields/nestable/Boolean.ts +0 -13
  189. package/src/import/converters/fields/nestable/Color.ts +0 -14
  190. package/src/import/converters/fields/nestable/Date.ts +0 -17
  191. package/src/import/converters/fields/nestable/Embed.ts +0 -37
  192. package/src/import/converters/fields/nestable/GeoPoint.ts +0 -16
  193. package/src/import/converters/fields/nestable/Image.ts +0 -91
  194. package/src/import/converters/fields/nestable/Link.ts +0 -77
  195. package/src/import/converters/fields/nestable/Nestable.ts +0 -55
  196. package/src/import/converters/fields/nestable/Number.ts +0 -14
  197. package/src/import/converters/fields/nestable/RichText/embedBlock.ts +0 -17
  198. package/src/import/converters/fields/nestable/RichText/imageBlock.ts +0 -17
  199. package/src/import/converters/fields/nestable/RichText/index.ts +0 -23
  200. package/src/import/converters/fields/nestable/RichText/textBlock.ts +0 -62
  201. package/src/import/converters/fields/nestable/Select.ts +0 -14
  202. package/src/import/converters/fields/nestable/Text.ts +0 -14
  203. package/src/import/converters/fields/nestable/Timestamp.ts +0 -14
  204. package/src/import/converters/fields/nestable/index.ts +0 -13
  205. package/src/import/converters/index.ts +0 -2
  206. package/src/import/index.ts +0 -2
  207. package/src/import/validators/Document.ts +0 -103
  208. package/src/import/validators/fields/ImportContent.ts +0 -30
  209. package/src/import/validators/fields/ImportField.ts +0 -36
  210. package/src/import/validators/fields/ImportGroup.ts +0 -45
  211. package/src/import/validators/fields/ImportSlices/ImportSlices.ts +0 -56
  212. package/src/import/validators/fields/ImportSlices/SharedSlice/SharedSlice.ts +0 -104
  213. package/src/import/validators/fields/ImportSlices/SharedSlice/errors.ts +0 -6
  214. package/src/import/validators/fields/ImportSlices/SharedSlice/fields/OptionalSharedSliceId.ts +0 -20
  215. package/src/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceId.ts +0 -65
  216. package/src/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceType.ts +0 -45
  217. package/src/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceVariation.ts +0 -45
  218. package/src/import/validators/fields/ImportSlices/SharedSlice/fields/index.ts +0 -4
  219. package/src/import/validators/fields/ImportSlices/SharedSlice/index.ts +0 -3
  220. package/src/import/validators/fields/ImportSlices/SharedSlice/utils.ts +0 -21
  221. package/src/import/validators/fields/ImportSlices/index.ts +0 -1
  222. package/src/import/validators/fields/ImportSlices/utils.ts +0 -43
  223. package/src/import/validators/fields/RepeatableZone.ts +0 -21
  224. package/src/import/validators/fields/RepeatableZoneItem.ts +0 -64
  225. package/src/import/validators/fields/UID.ts +0 -27
  226. package/src/import/validators/fields/index.ts +0 -4
  227. package/src/import/validators/fields/nestable/Boolean.ts +0 -7
  228. package/src/import/validators/fields/nestable/Color.ts +0 -28
  229. package/src/import/validators/fields/nestable/Date.ts +0 -34
  230. package/src/import/validators/fields/nestable/Embed.ts +0 -41
  231. package/src/import/validators/fields/nestable/GeoPoint.ts +0 -21
  232. package/src/import/validators/fields/nestable/Image/default.ts +0 -25
  233. package/src/import/validators/fields/nestable/Image/index.ts +0 -73
  234. package/src/import/validators/fields/nestable/Image/merge.ts +0 -64
  235. package/src/import/validators/fields/nestable/Image/model.ts +0 -18
  236. package/src/import/validators/fields/nestable/Image/validators.ts +0 -45
  237. package/src/import/validators/fields/nestable/ImportRichText/ImportBlock.ts +0 -39
  238. package/src/import/validators/fields/nestable/ImportRichText/ImportRichText.ts +0 -54
  239. package/src/import/validators/fields/nestable/ImportRichText/blocks/ImportBlockType.ts +0 -44
  240. package/src/import/validators/fields/nestable/ImportRichText/blocks/ImportEmbedBlock.ts +0 -13
  241. package/src/import/validators/fields/nestable/ImportRichText/blocks/ImportImageBlock.ts +0 -17
  242. package/src/import/validators/fields/nestable/ImportRichText/blocks/ImportTextBlock.ts +0 -56
  243. package/src/import/validators/fields/nestable/ImportRichText/blocks/Span.ts +0 -48
  244. package/src/import/validators/fields/nestable/ImportRichText/blocks/index.ts +0 -4
  245. package/src/import/validators/fields/nestable/ImportRichText/blocks/spans/HyperlinkSpan.ts +0 -24
  246. package/src/import/validators/fields/nestable/ImportRichText/blocks/spans/LabelSpan.ts +0 -19
  247. package/src/import/validators/fields/nestable/ImportRichText/blocks/spans/SpanLocation.ts +0 -8
  248. package/src/import/validators/fields/nestable/ImportRichText/blocks/spans/TextSpan.ts +0 -24
  249. package/src/import/validators/fields/nestable/ImportRichText/blocks/spans/index.ts +0 -2
  250. package/src/import/validators/fields/nestable/ImportRichText/index.ts +0 -2
  251. package/src/import/validators/fields/nestable/Link.ts +0 -59
  252. package/src/import/validators/fields/nestable/Nestable.ts +0 -88
  253. package/src/import/validators/fields/nestable/Number.ts +0 -38
  254. package/src/import/validators/fields/nestable/Select.ts +0 -38
  255. package/src/import/validators/fields/nestable/Text.ts +0 -7
  256. package/src/import/validators/fields/nestable/Timestamp.ts +0 -39
  257. package/src/import/validators/fields/nestable/index.ts +0 -14
  258. package/src/import/validators/index.ts +0 -2
@@ -1,2 +0,0 @@
1
- import * as t from "io-ts";
2
- export declare const OptionalSharedSliceId: t.Type<string | null | undefined, string | null | undefined, unknown>;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OptionalSharedSliceId = void 0;
4
- const tslib_1 = require("tslib");
5
- const t = (0, tslib_1.__importStar)(require("io-ts"));
6
- const SharedSliceId_1 = require("./SharedSliceId");
7
- // Wrapping the 'SharedSliceId' codec in an optional codec here for the sake of error reporting.
8
- // When using t.union([t.undefined, t.null, SharedSliceId]) we get a nested error context
9
- // with the actual decoding error at position 2 in the context array.
10
- // To avoid mutating the error context we create this new wrapper codec so that the error context will always have desired depth.
11
- exports.OptionalSharedSliceId = new t.Type("OptionalSharedSliceId", (u) => u === null || u === undefined || SharedSliceId_1.SharedSliceId.is(u), (u, c) => {
12
- if (u === null || u === undefined)
13
- return t.success(u);
14
- return SharedSliceId_1.SharedSliceId.validate(u, c);
15
- }, t.identity);
@@ -1,17 +0,0 @@
1
- import * as t from "io-ts";
2
- import { WidgetKey } from "../../../../../../../common";
3
- import type { NestableWidget } from "../../../../../../../customtypes";
4
- import type { ImportNestable } from "../../../../nestable";
5
- /**
6
- * Represents the object in the 'primary' field or a single item in the 'items' array in the SharedSlice.
7
- */
8
- export declare type SharedSliceContent = Record<WidgetKey, ImportNestable>;
9
- /**
10
- * Builds the decoder for a single entry in the 'primary' field or a single item in the 'items' array in the SharedSlice.
11
- *
12
- * @param sliceName name of the slice - used for error reporting in order to know which slice is being decoded
13
- * @param sliceContentField 'primary' or 'items' - used for error reporting in order to know which field of the slice is being decoded
14
- * @param sliceFieldModels models of the fields of the slice from custom type - used to know which codec to use for decoding each value of the object
15
- * @constructor
16
- */
17
- export declare const SharedSliceContent: (sliceName: string, sliceContentField: "primary" | "items", sliceFieldModels: Record<WidgetKey, NestableWidget>) => t.Type<SharedSliceContent, SharedSliceContent, unknown>;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SharedSliceContent = void 0;
4
- const tslib_1 = require("tslib");
5
- const E = (0, tslib_1.__importStar)(require("fp-ts/Either"));
6
- const function_1 = require("fp-ts/lib/function");
7
- const t = (0, tslib_1.__importStar)(require("io-ts"));
8
- const common_1 = require("../../../../../../../common");
9
- const io_ts_1 = require("../../../../../../../utils/io-ts");
10
- const function_2 = require("../../../../../../../validators/function");
11
- const SharedSliceContentEntry_1 = require("./SharedSliceContentEntry");
12
- /**
13
- * Builds the decoder for a single entry in the 'primary' field or a single item in the 'items' array in the SharedSlice.
14
- *
15
- * @param sliceName name of the slice - used for error reporting in order to know which slice is being decoded
16
- * @param sliceContentField 'primary' or 'items' - used for error reporting in order to know which field of the slice is being decoded
17
- * @param sliceFieldModels models of the fields of the slice from custom type - used to know which codec to use for decoding each value of the object
18
- * @constructor
19
- */
20
- const SharedSliceContent = (sliceName, sliceContentField, sliceFieldModels) => new t.Type("SharedSliceContent", (u) => t.record(common_1.WidgetKey, t.unknown).is(u), (u, c) => (0, function_1.pipe)(
21
- // We first decode the raw content object in the shape of Record<WidgetKey, unknown>
22
- (0, function_2.withCustomError)(t.UnknownRecord, () => "The value must be an object").validate(u, c), E.chain((rawContent) => (0, function_1.pipe)(
23
- // We split the object into entries because there is no easy other way to decode each value with a different codec
24
- Object.entries(rawContent).map((entry) => (0, SharedSliceContentEntry_1.SharedSliceContentEntry)(sliceName, sliceContentField, sliceFieldModels).validate(entry, c)),
25
- // We get a validation result for each entry in the content object (t.Validation<SharedSliceContentEntry>[]),
26
- // however we want to get a single validation result for the whole array of entries (t.Validation<SharedSliceContentEntry[]>).
27
- io_ts_1.combineValidationResults,
28
- // We build the object back from entries if all decoded successfully
29
- E.map((entries) => entries.reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {}))))), t.identity);
30
- exports.SharedSliceContent = SharedSliceContent;
@@ -1,43 +0,0 @@
1
- import * as t from "io-ts";
2
- import { WidgetKey } from "../../../../../../../common";
3
- import type { NestableWidget } from "../../../../../../../customtypes";
4
- import { ImportNestable } from "../../../../nestable";
5
- export declare type SharedSliceContentEntry = [WidgetKey, ImportNestable];
6
- /**
7
- * Represents a single entry in the 'primary' field or a single entry in an item in the 'items' array in the SharedSlice. It is used to build the SharedSliceContent type from entries of the import object.
8
- *
9
- * For example, given the following slice:
10
- * {
11
- * "slice_type": "my_slice",
12
- * "variation": "default",
13
- * "primary": {
14
- * "slice_text": "abc", // This is one entry
15
- * "slice_text2": "def: // This is another entry
16
- * },
17
- * "items": [
18
- * {
19
- * "slice_number1": 0, // This is one entry
20
- * "slice_number2": 1 // And this is yet another entry
21
- * }
22
- * ]
23
- * }
24
- *
25
- * The 'primary' object is converted to following entries to be decoded:
26
- * [
27
- * ["slice_text", "abc"],
28
- * ["slice_text2", "def"]
29
- * ]
30
- * and the first item in the 'items' array is converted to following entries to be decoded:
31
- * [
32
- * ["slice_number1", 0],
33
- * ["slice_number2", 1]
34
- * ]
35
- *
36
- * We decode them as separate entries because each of the values might require a different codec as per what is specified in the SharedSlice custom type.
37
- * In this way we save on the decoding performance in comparison to a scenario where we would decode the whole content object as a record with a union type decoder for each value.
38
- *
39
- * @param sliceName name of the slice - used for error reporting in order to know which slice is being decoded
40
- * @param sliceContentField 'primary' or 'items' - used for error reporting in order to know which field of the slice is being decoded
41
- * @param sliceFieldModels models of the fields of the slice from custom type - used to know which codec to use for decoding each value of the object
42
- */
43
- export declare const SharedSliceContentEntry: (sliceName: string, sliceContentField: "primary" | "items", sliceFieldModels: Record<WidgetKey, NestableWidget>) => t.Type<SharedSliceContentEntry, SharedSliceContentEntry, unknown>;
@@ -1,69 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SharedSliceContentEntry = void 0;
4
- const tslib_1 = require("tslib");
5
- const E = (0, tslib_1.__importStar)(require("fp-ts/Either"));
6
- const function_1 = require("fp-ts/function");
7
- const t = (0, tslib_1.__importStar)(require("io-ts"));
8
- const common_1 = require("../../../../../../../common");
9
- const nestable_1 = require("../../../../nestable");
10
- const errors_1 = require("./errors");
11
- /**
12
- * Represents a single entry in the 'primary' field or a single entry in an item in the 'items' array in the SharedSlice. It is used to build the SharedSliceContent type from entries of the import object.
13
- *
14
- * For example, given the following slice:
15
- * {
16
- * "slice_type": "my_slice",
17
- * "variation": "default",
18
- * "primary": {
19
- * "slice_text": "abc", // This is one entry
20
- * "slice_text2": "def: // This is another entry
21
- * },
22
- * "items": [
23
- * {
24
- * "slice_number1": 0, // This is one entry
25
- * "slice_number2": 1 // And this is yet another entry
26
- * }
27
- * ]
28
- * }
29
- *
30
- * The 'primary' object is converted to following entries to be decoded:
31
- * [
32
- * ["slice_text", "abc"],
33
- * ["slice_text2", "def"]
34
- * ]
35
- * and the first item in the 'items' array is converted to following entries to be decoded:
36
- * [
37
- * ["slice_number1", 0],
38
- * ["slice_number2", 1]
39
- * ]
40
- *
41
- * We decode them as separate entries because each of the values might require a different codec as per what is specified in the SharedSlice custom type.
42
- * In this way we save on the decoding performance in comparison to a scenario where we would decode the whole content object as a record with a union type decoder for each value.
43
- *
44
- * @param sliceName name of the slice - used for error reporting in order to know which slice is being decoded
45
- * @param sliceContentField 'primary' or 'items' - used for error reporting in order to know which field of the slice is being decoded
46
- * @param sliceFieldModels models of the fields of the slice from custom type - used to know which codec to use for decoding each value of the object
47
- */
48
- const SharedSliceContentEntry = (sliceName, sliceContentField, sliceFieldModels) => new t.Type("SharedSliceContentEntry", (u) => t.tuple([common_1.WidgetKey, t.unknown]).is(u) && nestable_1.ImportNestable.is(u[1]), (u, c) => {
49
- return (0, function_1.pipe)(t.tuple([common_1.WidgetKey, t.unknown]).validate(u, c), E.chain(([key, content]) => {
50
- const model = sliceFieldModels[key];
51
- if (!model) {
52
- return t.failure([key, content], [...c, { key, actual: content, type: t.unknown }], errors_1.SharedSliceContentErrors.UnknownField(sliceName, sliceContentField, key));
53
- }
54
- const { codec, result } = nestable_1.ImportNestable.decode(model)(content);
55
- return (0, function_1.pipe)(result, E.map((decodedContent) => [
56
- key,
57
- decodedContent,
58
- ]), E.mapLeft((errors) => errors.map((error) => {
59
- const context = [
60
- ...c,
61
- { key, actual: content, type: codec },
62
- ...error.context.slice(1), // We ignore the first context element with "" key coming from ImportNestable decoder
63
- ];
64
- const updatedError = { ...error, context };
65
- return updatedError;
66
- })));
67
- }));
68
- }, t.identity);
69
- exports.SharedSliceContentEntry = SharedSliceContentEntry;
@@ -1,4 +0,0 @@
1
- import type { SharedSliceContentField } from "./types";
2
- export declare const SharedSliceContentErrors: {
3
- readonly UnknownField: (sliceName: string, contentField: SharedSliceContentField, fieldName: string) => string;
4
- };
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SharedSliceContentErrors = void 0;
4
- exports.SharedSliceContentErrors = {
5
- UnknownField: (sliceName, contentField, fieldName) => `Unsupported field '${fieldName}'for '${contentField}' content in Shared Slice '${sliceName}'`,
6
- };
@@ -1,2 +0,0 @@
1
- export * from "./errors";
2
- export * from "./SharedSliceContent";
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./errors"), exports);
5
- (0, tslib_1.__exportStar)(require("./SharedSliceContent"), exports);
@@ -1 +0,0 @@
1
- export declare type SharedSliceContentField = "primary" | "items";
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,9 +0,0 @@
1
- import * as t from "io-ts";
2
- import { UUID } from "../../../../../../common/UUID";
3
- export declare type SharedSliceId = `${string}$${UUID}`;
4
- export declare const SharedSliceIdValidationError: {
5
- readonly Base: "Slice id must be a non empty string matching the following pattern 'slice_type$uuid'";
6
- readonly IncorrectUUID: (uuid: string | undefined) => string;
7
- readonly IncorrectSliceType: (sliceType: string | undefined) => string;
8
- };
9
- export declare const SharedSliceId: t.Type<string, string, unknown>;
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SharedSliceId = exports.SharedSliceIdValidationError = void 0;
4
- const tslib_1 = require("tslib");
5
- const E = (0, tslib_1.__importStar)(require("fp-ts/Either"));
6
- const function_1 = require("fp-ts/function");
7
- const t = (0, tslib_1.__importStar)(require("io-ts"));
8
- const UUID_1 = require("../../../../../../common/UUID");
9
- const validators_1 = require("../../../../../../validators");
10
- const baseErrorText = "Slice id must be a non empty string matching the following pattern 'slice_type$uuid'";
11
- exports.SharedSliceIdValidationError = {
12
- Base: baseErrorText,
13
- IncorrectUUID: (uuid) => `Incorrect UUID: '${uuid}' - ${baseErrorText}`,
14
- IncorrectSliceType: (sliceType) => `Incorrect slice_type: '${sliceType}' - ${baseErrorText}`,
15
- };
16
- exports.SharedSliceId = new t.Type("SharedSliceId", (u) => {
17
- if (typeof u !== "string") {
18
- return false;
19
- }
20
- const [sliceName, uuid] = u.split("$");
21
- return validators_1.NonEmptyString.is(sliceName) && UUID_1.UUID.is(uuid);
22
- }, (u, c) => (0, function_1.pipe)(validators_1.NonEmptyString.validate(u, c), E.mapLeft((errors) => errors.map((error) => ({
23
- ...error,
24
- message: exports.SharedSliceIdValidationError.Base,
25
- }))), E.chain((sliceId) => {
26
- const [sliceName, uuid] = sliceId.split("$");
27
- return (0, function_1.pipe)(t.tuple([validators_1.NonEmptyString, UUID_1.UUID]).validate([sliceName, uuid], c), E.mapLeft((errors) => errors.map((error) => {
28
- const tupleErrorContext = error.context[error.context.length - 1];
29
- return {
30
- ...error,
31
- context: [
32
- ...error.context.slice(0, -1), // We don't want the tuple decoder error context
33
- ],
34
- message: (tupleErrorContext === null || tupleErrorContext === void 0 ? void 0 : tupleErrorContext.key) === "0"
35
- ? exports.SharedSliceIdValidationError.IncorrectSliceType(sliceName)
36
- : exports.SharedSliceIdValidationError.IncorrectUUID(uuid),
37
- };
38
- })));
39
- }), E.map(([sliceName, uuid]) => `${sliceName}$${uuid}`)), (sliceId) => sliceId);
@@ -1,11 +0,0 @@
1
- import * as t from "io-ts";
2
- import { SharedSlice as SharedSliceCustomType } from "../../../../../../customtypes";
3
- export declare type SharedSliceType = {
4
- slice_type: string;
5
- data: SharedSliceCustomType;
6
- };
7
- /**
8
- * Builds the decoder for the 'slice_type' field in the SharedSlice. Alongside the decoded 'slice_type' it also returns the SharedSlice data matching the slice_type.
9
- * @param slices all the SharedSlices from the custom type
10
- */
11
- export declare const SharedSliceType: (slices: SharedSliceCustomType[]) => t.Type<SharedSliceType, string, unknown>;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SharedSliceType = void 0;
4
- const tslib_1 = require("tslib");
5
- const E = (0, tslib_1.__importStar)(require("fp-ts/Either"));
6
- const function_1 = require("fp-ts/function");
7
- const t = (0, tslib_1.__importStar)(require("io-ts"));
8
- const customtypes_1 = require("../../../../../../customtypes");
9
- const validators_1 = require("../../../../../../validators");
10
- const utils_1 = require("../utils");
11
- /**
12
- * slice_type - the validated slice_type
13
- * slice - SharedSlice custom type data matching the slice_type. We return it alongside the validated slice_type, because it is needed to decode the 'variation' field in the SharedSlice (see SharedSliceVariation.ts)
14
- */
15
- const SharedSliceTypeShape = t.strict({
16
- slice_type: validators_1.NonEmptyString,
17
- slice: customtypes_1.SharedSlice,
18
- });
19
- /**
20
- * Builds the decoder for the 'slice_type' field in the SharedSlice. Alongside the decoded 'slice_type' it also returns the SharedSlice data matching the slice_type.
21
- * @param slices all the SharedSlices from the custom type
22
- */
23
- const SharedSliceType = (slices) => new t.Type("slice_type", (u) => SharedSliceTypeShape.is(u), (u, c) => (0, function_1.pipe)(validators_1.NonEmptyString.validate(u, c), E.chain((slice_type) => (0, function_1.pipe)((0, utils_1.findSlice)(slices)(slice_type), E.fold((err) => t.failure(u, c, err), (data) => t.success({ slice_type, data }))))), ({ slice_type }) => slice_type);
24
- exports.SharedSliceType = SharedSliceType;
@@ -1,11 +0,0 @@
1
- import * as t from "io-ts";
2
- import { SharedSlice, Variation } from "../../../../../../customtypes";
3
- export declare type SharedSliceVariation = {
4
- variation: string;
5
- data: Variation;
6
- };
7
- /**
8
- * Builds the decoder for the 'variation' field in the SharedSlice. Alongside the decoded 'variation' it also returns the Variation data matching the variation custom type.
9
- * @param slice SharedSlice from the custom type
10
- */
11
- export declare const SharedSliceVariation: (slice: SharedSlice) => t.Type<SharedSliceVariation, string, unknown>;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SharedSliceVariation = void 0;
4
- const tslib_1 = require("tslib");
5
- const E = (0, tslib_1.__importStar)(require("fp-ts/Either"));
6
- const function_1 = require("fp-ts/function");
7
- const t = (0, tslib_1.__importStar)(require("io-ts"));
8
- const customtypes_1 = require("../../../../../../customtypes");
9
- const validators_1 = require("../../../../../../validators");
10
- const utils_1 = require("../utils");
11
- /**
12
- * variation - the validated variation of the slice
13
- * data - Variation data matching the variation. We return it alongside the validated variation, because it is needed to decode the 'primary' and 'items' fields in the SharedSlice.
14
- */
15
- const SharedSliceVariationShape = t.strict({
16
- variation: validators_1.NonEmptyString,
17
- data: customtypes_1.Variation,
18
- });
19
- /**
20
- * Builds the decoder for the 'variation' field in the SharedSlice. Alongside the decoded 'variation' it also returns the Variation data matching the variation custom type.
21
- * @param slice SharedSlice from the custom type
22
- */
23
- const SharedSliceVariation = (slice) => new t.Type("variation", (u) => SharedSliceVariationShape.is(u), (u, c) => (0, function_1.pipe)(validators_1.NonEmptyString.validate(u, c), E.chain((variation) => (0, function_1.pipe)((0, utils_1.findSliceVariation)(slice)(variation), E.fold((err) => t.failure(u, c, err), (data) => t.success({ variation, data }))))), ({ variation }) => variation);
24
- exports.SharedSliceVariation = SharedSliceVariation;
@@ -1,4 +0,0 @@
1
- export * from "./OptionalSharedSliceId";
2
- export * from "./SharedSliceId";
3
- export * from "./SharedSliceType";
4
- export * from "./SharedSliceVariation";
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./OptionalSharedSliceId"), exports);
5
- (0, tslib_1.__exportStar)(require("./SharedSliceId"), exports);
6
- (0, tslib_1.__exportStar)(require("./SharedSliceType"), exports);
7
- (0, tslib_1.__exportStar)(require("./SharedSliceVariation"), exports);
@@ -1,3 +0,0 @@
1
- export * from "./errors";
2
- export * from "./fields";
3
- export * from "./SharedSlice";
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./errors"), exports);
5
- (0, tslib_1.__exportStar)(require("./fields"), exports);
6
- (0, tslib_1.__exportStar)(require("./SharedSlice"), exports);