@prismicio/types-internal 2.2.1-alpha.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 (250) hide show
  1. package/lib/common/UUID.d.ts +1 -2
  2. package/lib/content/fields/slices/Slice/CompositeSliceContent.js +1 -2
  3. package/lib/content/fields/slices/Slice/SimpleSliceContent.js +2 -4
  4. package/package.json +1 -1
  5. package/src/common/UUID.ts +1 -1
  6. package/src/content/fields/slices/Slice/CompositeSliceContent.ts +1 -2
  7. package/src/content/fields/slices/Slice/SimpleSliceContent.ts +2 -5
  8. package/lib/import/converters/Document.d.ts +0 -4
  9. package/lib/import/converters/Document.js +0 -21
  10. package/lib/import/converters/fields/Group.d.ts +0 -4
  11. package/lib/import/converters/fields/Group.js +0 -14
  12. package/lib/import/converters/fields/RepeatableZone.d.ts +0 -317
  13. package/lib/import/converters/fields/RepeatableZone.js +0 -15
  14. package/lib/import/converters/fields/RepeatableZoneItem.d.ts +0 -11
  15. package/lib/import/converters/fields/RepeatableZoneItem.js +0 -19
  16. package/lib/import/converters/fields/Slices/SharedSlice.d.ts +0 -4
  17. package/lib/import/converters/fields/Slices/SharedSlice.js +0 -19
  18. package/lib/import/converters/fields/Slices/SharedSliceContent.d.ts +0 -10
  19. package/lib/import/converters/fields/Slices/SharedSliceContent.js +0 -23
  20. package/lib/import/converters/fields/Slices/Slices.d.ts +0 -4
  21. package/lib/import/converters/fields/Slices/Slices.js +0 -16
  22. package/lib/import/converters/fields/Slices/index.d.ts +0 -1
  23. package/lib/import/converters/fields/Slices/index.js +0 -4
  24. package/lib/import/converters/fields/UID.d.ts +0 -3
  25. package/lib/import/converters/fields/UID.js +0 -10
  26. package/lib/import/converters/fields/index.d.ts +0 -4
  27. package/lib/import/converters/fields/index.js +0 -7
  28. package/lib/import/converters/fields/nestable/Boolean.d.ts +0 -3
  29. package/lib/import/converters/fields/nestable/Boolean.js +0 -12
  30. package/lib/import/converters/fields/nestable/Color.d.ts +0 -3
  31. package/lib/import/converters/fields/nestable/Color.js +0 -13
  32. package/lib/import/converters/fields/nestable/Date.d.ts +0 -3
  33. package/lib/import/converters/fields/nestable/Date.js +0 -15
  34. package/lib/import/converters/fields/nestable/Embed.d.ts +0 -4
  35. package/lib/import/converters/fields/nestable/Embed.js +0 -32
  36. package/lib/import/converters/fields/nestable/GeoPoint.d.ts +0 -3
  37. package/lib/import/converters/fields/nestable/GeoPoint.js +0 -15
  38. package/lib/import/converters/fields/nestable/Image.d.ts +0 -28
  39. package/lib/import/converters/fields/nestable/Image.js +0 -67
  40. package/lib/import/converters/fields/nestable/Link.d.ts +0 -4
  41. package/lib/import/converters/fields/nestable/Link.js +0 -70
  42. package/lib/import/converters/fields/nestable/Nestable.d.ts +0 -5
  43. package/lib/import/converters/fields/nestable/Nestable.js +0 -35
  44. package/lib/import/converters/fields/nestable/Number.d.ts +0 -3
  45. package/lib/import/converters/fields/nestable/Number.js +0 -13
  46. package/lib/import/converters/fields/nestable/RichText/embedBlock.d.ts +0 -4
  47. package/lib/import/converters/fields/nestable/RichText/embedBlock.js +0 -14
  48. package/lib/import/converters/fields/nestable/RichText/imageBlock.d.ts +0 -4
  49. package/lib/import/converters/fields/nestable/RichText/imageBlock.js +0 -12
  50. package/lib/import/converters/fields/nestable/RichText/index.d.ts +0 -4
  51. package/lib/import/converters/fields/nestable/RichText/index.js +0 -22
  52. package/lib/import/converters/fields/nestable/RichText/textBlock.d.ts +0 -4
  53. package/lib/import/converters/fields/nestable/RichText/textBlock.js +0 -54
  54. package/lib/import/converters/fields/nestable/Select.d.ts +0 -3
  55. package/lib/import/converters/fields/nestable/Select.js +0 -13
  56. package/lib/import/converters/fields/nestable/Text.d.ts +0 -3
  57. package/lib/import/converters/fields/nestable/Text.js +0 -13
  58. package/lib/import/converters/fields/nestable/Timestamp.d.ts +0 -3
  59. package/lib/import/converters/fields/nestable/Timestamp.js +0 -13
  60. package/lib/import/converters/fields/nestable/index.d.ts +0 -13
  61. package/lib/import/converters/fields/nestable/index.js +0 -16
  62. package/lib/import/converters/index.d.ts +0 -2
  63. package/lib/import/converters/index.js +0 -5
  64. package/lib/import/index.d.ts +0 -2
  65. package/lib/import/index.js +0 -5
  66. package/lib/import/validators/Document.d.ts +0 -6
  67. package/lib/import/validators/Document.js +0 -64
  68. package/lib/import/validators/fields/ImportContent.d.ts +0 -5
  69. package/lib/import/validators/fields/ImportContent.js +0 -21
  70. package/lib/import/validators/fields/ImportField.d.ts +0 -141
  71. package/lib/import/validators/fields/ImportField.js +0 -33
  72. package/lib/import/validators/fields/ImportGroup.d.ts +0 -345
  73. package/lib/import/validators/fields/ImportGroup.js +0 -27
  74. package/lib/import/validators/fields/ImportSlices/ImportSlices.d.ts +0 -8
  75. package/lib/import/validators/fields/ImportSlices/ImportSlices.js +0 -30
  76. package/lib/import/validators/fields/ImportSlices/SharedSlice/SharedSlice.d.ts +0 -16
  77. package/lib/import/validators/fields/ImportSlices/SharedSlice/SharedSlice.js +0 -61
  78. package/lib/import/validators/fields/ImportSlices/SharedSlice/errors.d.ts +0 -4
  79. package/lib/import/validators/fields/ImportSlices/SharedSlice/errors.js +0 -7
  80. package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/OptionalSharedSliceId.d.ts +0 -2
  81. package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/OptionalSharedSliceId.js +0 -15
  82. package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceId.d.ts +0 -9
  83. package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceId.js +0 -39
  84. package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceType.d.ts +0 -11
  85. package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceType.js +0 -24
  86. package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceVariation.d.ts +0 -11
  87. package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceVariation.js +0 -24
  88. package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/index.d.ts +0 -4
  89. package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/index.js +0 -7
  90. package/lib/import/validators/fields/ImportSlices/SharedSlice/index.d.ts +0 -3
  91. package/lib/import/validators/fields/ImportSlices/SharedSlice/index.js +0 -6
  92. package/lib/import/validators/fields/ImportSlices/SharedSlice/utils.d.ts +0 -342
  93. package/lib/import/validators/fields/ImportSlices/SharedSlice/utils.js +0 -11
  94. package/lib/import/validators/fields/ImportSlices/index.d.ts +0 -1
  95. package/lib/import/validators/fields/ImportSlices/index.js +0 -4
  96. package/lib/import/validators/fields/ImportSlices/utils.d.ts +0 -4
  97. package/lib/import/validators/fields/ImportSlices/utils.js +0 -35
  98. package/lib/import/validators/fields/RepeatableZone.d.ts +0 -11
  99. package/lib/import/validators/fields/RepeatableZone.js +0 -14
  100. package/lib/import/validators/fields/RepeatableZoneItem.d.ts +0 -11
  101. package/lib/import/validators/fields/RepeatableZoneItem.js +0 -39
  102. package/lib/import/validators/fields/UID.d.ts +0 -6
  103. package/lib/import/validators/fields/UID.js +0 -15
  104. package/lib/import/validators/fields/index.d.ts +0 -4
  105. package/lib/import/validators/fields/index.js +0 -7
  106. package/lib/import/validators/fields/nestable/Boolean.d.ts +0 -6
  107. package/lib/import/validators/fields/nestable/Boolean.js +0 -6
  108. package/lib/import/validators/fields/nestable/Color.d.ts +0 -6
  109. package/lib/import/validators/fields/nestable/Color.js +0 -15
  110. package/lib/import/validators/fields/nestable/Date.d.ts +0 -6
  111. package/lib/import/validators/fields/nestable/Date.js +0 -19
  112. package/lib/import/validators/fields/nestable/Embed.d.ts +0 -13
  113. package/lib/import/validators/fields/nestable/Embed.js +0 -31
  114. package/lib/import/validators/fields/nestable/GeoPoint.d.ts +0 -13
  115. package/lib/import/validators/fields/nestable/GeoPoint.js +0 -13
  116. package/lib/import/validators/fields/nestable/Image/default.d.ts +0 -22
  117. package/lib/import/validators/fields/nestable/Image/default.js +0 -19
  118. package/lib/import/validators/fields/nestable/Image/index.d.ts +0 -26
  119. package/lib/import/validators/fields/nestable/Image/index.js +0 -32
  120. package/lib/import/validators/fields/nestable/Image/merge.d.ts +0 -23
  121. package/lib/import/validators/fields/nestable/Image/merge.js +0 -44
  122. package/lib/import/validators/fields/nestable/Image/model.d.ts +0 -18
  123. package/lib/import/validators/fields/nestable/Image/model.js +0 -2
  124. package/lib/import/validators/fields/nestable/Image/validators.d.ts +0 -132
  125. package/lib/import/validators/fields/nestable/Image/validators.js +0 -43
  126. package/lib/import/validators/fields/nestable/ImportRichText/ImportBlock.d.ts +0 -6
  127. package/lib/import/validators/fields/nestable/ImportRichText/ImportBlock.js +0 -25
  128. package/lib/import/validators/fields/nestable/ImportRichText/ImportRichText.d.ts +0 -24
  129. package/lib/import/validators/fields/nestable/ImportRichText/ImportRichText.js +0 -32
  130. package/lib/import/validators/fields/nestable/ImportRichText/blocks/ImportBlockType.d.ts +0 -6
  131. package/lib/import/validators/fields/nestable/ImportRichText/blocks/ImportBlockType.js +0 -18
  132. package/lib/import/validators/fields/nestable/ImportRichText/blocks/ImportEmbedBlock.d.ts +0 -10
  133. package/lib/import/validators/fields/nestable/ImportRichText/blocks/ImportEmbedBlock.js +0 -11
  134. package/lib/import/validators/fields/nestable/ImportRichText/blocks/ImportImageBlock.d.ts +0 -22
  135. package/lib/import/validators/fields/nestable/ImportRichText/blocks/ImportImageBlock.js +0 -13
  136. package/lib/import/validators/fields/nestable/ImportRichText/blocks/ImportTextBlock.d.ts +0 -78
  137. package/lib/import/validators/fields/nestable/ImportRichText/blocks/ImportTextBlock.js +0 -43
  138. package/lib/import/validators/fields/nestable/ImportRichText/blocks/Span.d.ts +0 -79
  139. package/lib/import/validators/fields/nestable/ImportRichText/blocks/Span.js +0 -27
  140. package/lib/import/validators/fields/nestable/ImportRichText/blocks/index.d.ts +0 -4
  141. package/lib/import/validators/fields/nestable/ImportRichText/blocks/index.js +0 -7
  142. package/lib/import/validators/fields/nestable/ImportRichText/blocks/spans/HyperlinkSpan.d.ts +0 -24
  143. package/lib/import/validators/fields/nestable/ImportRichText/blocks/spans/HyperlinkSpan.js +0 -18
  144. package/lib/import/validators/fields/nestable/ImportRichText/blocks/spans/LabelSpan.d.ts +0 -12
  145. package/lib/import/validators/fields/nestable/ImportRichText/blocks/spans/LabelSpan.js +0 -16
  146. package/lib/import/validators/fields/nestable/ImportRichText/blocks/spans/SpanLocation.d.ts +0 -5
  147. package/lib/import/validators/fields/nestable/ImportRichText/blocks/spans/SpanLocation.js +0 -10
  148. package/lib/import/validators/fields/nestable/ImportRichText/blocks/spans/TextSpan.d.ts +0 -15
  149. package/lib/import/validators/fields/nestable/ImportRichText/blocks/spans/TextSpan.js +0 -20
  150. package/lib/import/validators/fields/nestable/ImportRichText/blocks/spans/index.d.ts +0 -2
  151. package/lib/import/validators/fields/nestable/ImportRichText/blocks/spans/index.js +0 -5
  152. package/lib/import/validators/fields/nestable/ImportRichText/index.d.ts +0 -2
  153. package/lib/import/validators/fields/nestable/ImportRichText/index.js +0 -7
  154. package/lib/import/validators/fields/nestable/Link.d.ts +0 -53
  155. package/lib/import/validators/fields/nestable/Link.js +0 -35
  156. package/lib/import/validators/fields/nestable/Nestable.d.ts +0 -192
  157. package/lib/import/validators/fields/nestable/Nestable.js +0 -71
  158. package/lib/import/validators/fields/nestable/Number.d.ts +0 -17
  159. package/lib/import/validators/fields/nestable/Number.js +0 -17
  160. package/lib/import/validators/fields/nestable/Select.d.ts +0 -16
  161. package/lib/import/validators/fields/nestable/Select.js +0 -19
  162. package/lib/import/validators/fields/nestable/Text.d.ts +0 -6
  163. package/lib/import/validators/fields/nestable/Text.js +0 -6
  164. package/lib/import/validators/fields/nestable/Timestamp.d.ts +0 -7
  165. package/lib/import/validators/fields/nestable/Timestamp.js +0 -19
  166. package/lib/import/validators/fields/nestable/index.d.ts +0 -14
  167. package/lib/import/validators/fields/nestable/index.js +0 -19
  168. package/lib/import/validators/index.d.ts +0 -2
  169. package/lib/import/validators/index.js +0 -5
  170. package/src/import/converters/Document.ts +0 -38
  171. package/src/import/converters/fields/Group.ts +0 -18
  172. package/src/import/converters/fields/RepeatableZone.ts +0 -19
  173. package/src/import/converters/fields/RepeatableZoneItem.ts +0 -32
  174. package/src/import/converters/fields/Slices/SharedSlice.ts +0 -24
  175. package/src/import/converters/fields/Slices/SharedSliceContent.ts +0 -27
  176. package/src/import/converters/fields/Slices/Slices.ts +0 -20
  177. package/src/import/converters/fields/Slices/index.ts +0 -1
  178. package/src/import/converters/fields/UID.ts +0 -9
  179. package/src/import/converters/fields/index.ts +0 -4
  180. package/src/import/converters/fields/nestable/Boolean.ts +0 -13
  181. package/src/import/converters/fields/nestable/Color.ts +0 -14
  182. package/src/import/converters/fields/nestable/Date.ts +0 -17
  183. package/src/import/converters/fields/nestable/Embed.ts +0 -37
  184. package/src/import/converters/fields/nestable/GeoPoint.ts +0 -16
  185. package/src/import/converters/fields/nestable/Image.ts +0 -91
  186. package/src/import/converters/fields/nestable/Link.ts +0 -77
  187. package/src/import/converters/fields/nestable/Nestable.ts +0 -55
  188. package/src/import/converters/fields/nestable/Number.ts +0 -14
  189. package/src/import/converters/fields/nestable/RichText/embedBlock.ts +0 -17
  190. package/src/import/converters/fields/nestable/RichText/imageBlock.ts +0 -17
  191. package/src/import/converters/fields/nestable/RichText/index.ts +0 -23
  192. package/src/import/converters/fields/nestable/RichText/textBlock.ts +0 -62
  193. package/src/import/converters/fields/nestable/Select.ts +0 -14
  194. package/src/import/converters/fields/nestable/Text.ts +0 -14
  195. package/src/import/converters/fields/nestable/Timestamp.ts +0 -14
  196. package/src/import/converters/fields/nestable/index.ts +0 -13
  197. package/src/import/converters/index.ts +0 -2
  198. package/src/import/index.ts +0 -2
  199. package/src/import/validators/Document.ts +0 -103
  200. package/src/import/validators/fields/ImportContent.ts +0 -30
  201. package/src/import/validators/fields/ImportField.ts +0 -36
  202. package/src/import/validators/fields/ImportGroup.ts +0 -45
  203. package/src/import/validators/fields/ImportSlices/ImportSlices.ts +0 -56
  204. package/src/import/validators/fields/ImportSlices/SharedSlice/SharedSlice.ts +0 -104
  205. package/src/import/validators/fields/ImportSlices/SharedSlice/errors.ts +0 -6
  206. package/src/import/validators/fields/ImportSlices/SharedSlice/fields/OptionalSharedSliceId.ts +0 -20
  207. package/src/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceId.ts +0 -65
  208. package/src/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceType.ts +0 -45
  209. package/src/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceVariation.ts +0 -45
  210. package/src/import/validators/fields/ImportSlices/SharedSlice/fields/index.ts +0 -4
  211. package/src/import/validators/fields/ImportSlices/SharedSlice/index.ts +0 -3
  212. package/src/import/validators/fields/ImportSlices/SharedSlice/utils.ts +0 -21
  213. package/src/import/validators/fields/ImportSlices/index.ts +0 -1
  214. package/src/import/validators/fields/ImportSlices/utils.ts +0 -43
  215. package/src/import/validators/fields/RepeatableZone.ts +0 -21
  216. package/src/import/validators/fields/RepeatableZoneItem.ts +0 -64
  217. package/src/import/validators/fields/UID.ts +0 -27
  218. package/src/import/validators/fields/index.ts +0 -4
  219. package/src/import/validators/fields/nestable/Boolean.ts +0 -7
  220. package/src/import/validators/fields/nestable/Color.ts +0 -28
  221. package/src/import/validators/fields/nestable/Date.ts +0 -34
  222. package/src/import/validators/fields/nestable/Embed.ts +0 -41
  223. package/src/import/validators/fields/nestable/GeoPoint.ts +0 -21
  224. package/src/import/validators/fields/nestable/Image/default.ts +0 -22
  225. package/src/import/validators/fields/nestable/Image/index.ts +0 -66
  226. package/src/import/validators/fields/nestable/Image/merge.ts +0 -64
  227. package/src/import/validators/fields/nestable/Image/model.ts +0 -18
  228. package/src/import/validators/fields/nestable/Image/validators.ts +0 -70
  229. package/src/import/validators/fields/nestable/ImportRichText/ImportBlock.ts +0 -39
  230. package/src/import/validators/fields/nestable/ImportRichText/ImportRichText.ts +0 -54
  231. package/src/import/validators/fields/nestable/ImportRichText/blocks/ImportBlockType.ts +0 -44
  232. package/src/import/validators/fields/nestable/ImportRichText/blocks/ImportEmbedBlock.ts +0 -13
  233. package/src/import/validators/fields/nestable/ImportRichText/blocks/ImportImageBlock.ts +0 -17
  234. package/src/import/validators/fields/nestable/ImportRichText/blocks/ImportTextBlock.ts +0 -56
  235. package/src/import/validators/fields/nestable/ImportRichText/blocks/Span.ts +0 -48
  236. package/src/import/validators/fields/nestable/ImportRichText/blocks/index.ts +0 -4
  237. package/src/import/validators/fields/nestable/ImportRichText/blocks/spans/HyperlinkSpan.ts +0 -24
  238. package/src/import/validators/fields/nestable/ImportRichText/blocks/spans/LabelSpan.ts +0 -19
  239. package/src/import/validators/fields/nestable/ImportRichText/blocks/spans/SpanLocation.ts +0 -8
  240. package/src/import/validators/fields/nestable/ImportRichText/blocks/spans/TextSpan.ts +0 -24
  241. package/src/import/validators/fields/nestable/ImportRichText/blocks/spans/index.ts +0 -2
  242. package/src/import/validators/fields/nestable/ImportRichText/index.ts +0 -2
  243. package/src/import/validators/fields/nestable/Link.ts +0 -59
  244. package/src/import/validators/fields/nestable/Nestable.ts +0 -88
  245. package/src/import/validators/fields/nestable/Number.ts +0 -38
  246. package/src/import/validators/fields/nestable/Select.ts +0 -38
  247. package/src/import/validators/fields/nestable/Text.ts +0 -7
  248. package/src/import/validators/fields/nestable/Timestamp.ts +0 -39
  249. package/src/import/validators/fields/nestable/index.ts +0 -14
  250. package/src/import/validators/index.ts +0 -2
@@ -1,16 +0,0 @@
1
- import * as t from "io-ts";
2
- import type { SharedSlice as SharedSliceCustomType } from "../../../../../customtypes";
3
- import { RepeatableZone } from "../../RepeatableZone";
4
- import { RepeatableZoneItem } from "../../RepeatableZoneItem";
5
- import { SharedSliceId } from "./fields";
6
- export declare type SharedSlice = {
7
- id: SharedSliceId | null | undefined;
8
- slice_type: string;
9
- name: string;
10
- variation: string;
11
- primary: RepeatableZoneItem | null | undefined;
12
- items: RepeatableZone | null | undefined;
13
- slice_label: string | null | undefined;
14
- version: string | null | undefined;
15
- };
16
- export declare const SharedSlice: (sharedSlices: SharedSliceCustomType[]) => t.Type<SharedSlice, SharedSlice, unknown>;
@@ -1,61 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SharedSlice = 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 validators_1 = require("../../../../../validators");
9
- const RepeatableZone_1 = require("../../RepeatableZone");
10
- const RepeatableZoneItem_1 = require("../../RepeatableZoneItem");
11
- const fields_1 = require("./fields");
12
- const SharedSliceShape = t.strict({
13
- id: fields_1.OptionalSharedSliceId,
14
- slice_type: validators_1.NonEmptyString,
15
- name: validators_1.String,
16
- variation: validators_1.NonEmptyString,
17
- primary: t.union([t.undefined, t.null, t.record(validators_1.NonEmptyString, t.unknown)]),
18
- items: t.union([
19
- t.undefined,
20
- t.null,
21
- t.array(t.record(validators_1.NonEmptyString, t.unknown)),
22
- ]),
23
- slice_label: t.union([t.undefined, t.null, validators_1.String]),
24
- version: t.union([t.undefined, t.null, validators_1.String]),
25
- });
26
- const SharedSlice = (sharedSlices) => new t.Type("SharedSlice", (u) => SharedSliceShape.is(u), (u, c) => (0, function_1.pipe)(
27
- // We validate the base fields that we can validate directly based on the provided 'sharedSlices'
28
- t
29
- .type({
30
- id: fields_1.OptionalSharedSliceId,
31
- slice_type: (0, fields_1.SharedSliceType)(sharedSlices),
32
- slice_label: t.union([t.undefined, t.null, validators_1.String]),
33
- version: t.union([t.undefined, t.null, validators_1.String]),
34
- })
35
- .validate(u, c), E.chain((decoded) => (0, function_1.pipe)(
36
- // We validate the 'variation' field, for which we need the SharedSlice custom type retrieved in the first step
37
- t
38
- .type({
39
- variation: (0, fields_1.SharedSliceVariation)(decoded.slice_type.data),
40
- })
41
- .validate(u, c), E.map(({ variation }) => ({ ...decoded, variation })))), E.chain((decoded) => {
42
- var _a, _b;
43
- return (0, function_1.pipe)(
44
- // We validate the 'primary' and 'items' content fields, for which we need the Variation custom type retrieved in the previous step
45
- t
46
- .partial({
47
- primary: (0, RepeatableZoneItem_1.RepeatableZoneItem)((_a = decoded.variation.data.primary) !== null && _a !== void 0 ? _a : {}),
48
- items: (0, RepeatableZone_1.RepeatableZone)((_b = decoded.variation.data.items) !== null && _b !== void 0 ? _b : {}),
49
- })
50
- .validate(u, c), E.map(({ primary, items }) => ({ ...decoded, primary, items })));
51
- }), E.map(({ id, slice_type, variation, primary, items, slice_label, version, }) => ({
52
- id,
53
- slice_type: slice_type.slice_type,
54
- name: slice_type.data.name,
55
- variation: variation.variation,
56
- primary,
57
- items,
58
- slice_label,
59
- version: version !== null && version !== void 0 ? version : variation.data.version,
60
- }))), t.identity);
61
- exports.SharedSlice = SharedSlice;
@@ -1,4 +0,0 @@
1
- export declare const SharedSliceErrors: {
2
- readonly SliceTypeNotFound: (slice_type: string) => string;
3
- readonly VariationNotFound: (variation: string, slice_type: string) => string;
4
- };
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SharedSliceErrors = void 0;
4
- exports.SharedSliceErrors = {
5
- SliceTypeNotFound: (slice_type) => `Shared slice '${slice_type}' not found in this slice zone in the document's custom type`,
6
- VariationNotFound: (variation, slice_type) => `Variation '${variation}' not found for Slice '${slice_type}'`,
7
- };
@@ -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,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);
@@ -1,342 +0,0 @@
1
- import * as E from "fp-ts/Either";
2
- import type { SharedSlice as SharedSliceCustomType } from "../../../../../customtypes";
3
- import type { Variation } from "../../../../../customtypes";
4
- export declare const findSlice: (slices: SharedSliceCustomType[]) => (sliceId: string) => E.Either<string, {
5
- id: string;
6
- type: "SharedSlice";
7
- name: string;
8
- variations: readonly ({
9
- id: string;
10
- name: string;
11
- description: string;
12
- imageUrl: string;
13
- docURL: string;
14
- version: string;
15
- } & {
16
- display?: string;
17
- primary?: {
18
- [x: string]: ({
19
- type: "Boolean";
20
- } & {
21
- config?: {
22
- label?: string | null | undefined;
23
- default_value?: boolean;
24
- placeholder_true?: string;
25
- placeholder_false?: string;
26
- };
27
- }) | ({
28
- type: "Color";
29
- } & {
30
- fieldset?: string | null | undefined;
31
- config?: {
32
- label?: string | null | undefined;
33
- placeholder?: string;
34
- };
35
- }) | ({
36
- type: "Date";
37
- } & {
38
- fieldset?: string | null | undefined;
39
- config?: {
40
- label?: string | null | undefined;
41
- placeholder?: string;
42
- default?: string;
43
- };
44
- }) | ({
45
- type: "Embed";
46
- } & {
47
- fieldset?: string | null | undefined;
48
- config?: {
49
- label?: string | null | undefined;
50
- placeholder?: string;
51
- useAsTitle?: boolean;
52
- };
53
- }) | ({
54
- type: "GeoPoint";
55
- } & {
56
- fieldset?: string | null | undefined;
57
- config?: {
58
- label?: string | null | undefined;
59
- };
60
- }) | ({
61
- type: "Image";
62
- } & {
63
- fieldset?: string | null | undefined;
64
- config?: {
65
- label?: string | null | undefined;
66
- placeholder?: string;
67
- constraint?: {
68
- width?: number | null;
69
- height?: number | null;
70
- };
71
- thumbnails?: readonly ({
72
- name: string;
73
- } & {
74
- width?: number | null;
75
- height?: number | null;
76
- })[];
77
- };
78
- }) | ({
79
- type: "IntegrationFields";
80
- } & {
81
- fieldset?: string | null | undefined;
82
- config?: {
83
- label?: string | null | undefined;
84
- placeholder?: string;
85
- catalog?: string;
86
- };
87
- }) | ({
88
- type: "Link";
89
- } & {
90
- fieldset?: string | null | undefined;
91
- config?: {
92
- label?: string | null | undefined;
93
- useAsTitle?: boolean;
94
- placeholder?: string;
95
- select?: "media" | "document" | "web" | null;
96
- customtypes?: readonly string[];
97
- masks?: readonly string[];
98
- tags?: readonly string[];
99
- allowTargetBlank?: boolean;
100
- };
101
- }) | ({
102
- type: "Number";
103
- } & {
104
- fieldset?: string | null | undefined;
105
- config?: {
106
- label?: string | null | undefined;
107
- placeholder?: string;
108
- min?: number;
109
- max?: number;
110
- step?: number;
111
- };
112
- }) | ({
113
- type: "Range";
114
- } & {
115
- fieldset?: string | null | undefined;
116
- config?: {
117
- label?: string | null | undefined;
118
- placeholder?: string;
119
- min?: number;
120
- max?: number;
121
- step?: number;
122
- };
123
- }) | ({
124
- type: "StructuredText";
125
- } & {
126
- fieldset?: string | null | undefined;
127
- config?: {
128
- label?: string | null | undefined;
129
- placeholder?: string;
130
- useAsTitle?: boolean;
131
- single?: string;
132
- multi?: string;
133
- imageConstraint?: {
134
- width?: number | null;
135
- height?: number | null;
136
- };
137
- labels?: readonly string[];
138
- allowTargetBlank?: boolean;
139
- };
140
- }) | ({
141
- type: "Select";
142
- } & {
143
- fieldset?: string | null | undefined;
144
- config?: {
145
- label?: string | null | undefined;
146
- placeholder?: string;
147
- default_value?: string;
148
- options?: readonly string[];
149
- };
150
- }) | ({
151
- type: "Separator";
152
- } & {
153
- config?: {
154
- label?: string | null | undefined;
155
- };
156
- }) | ({
157
- type: "Text";
158
- } & {
159
- fieldset?: string | null | undefined;
160
- config?: {
161
- label?: string | null | undefined;
162
- useAsTitle?: boolean;
163
- placeholder?: string;
164
- };
165
- }) | ({
166
- type: "Timestamp";
167
- } & {
168
- fieldset?: string | null | undefined;
169
- config?: {
170
- label?: string | null | undefined;
171
- placeholder?: string;
172
- default?: string;
173
- };
174
- });
175
- };
176
- items?: {
177
- [x: string]: ({
178
- type: "Boolean";
179
- } & {
180
- config?: {
181
- label?: string | null | undefined;
182
- default_value?: boolean;
183
- placeholder_true?: string;
184
- placeholder_false?: string;
185
- };
186
- }) | ({
187
- type: "Color";
188
- } & {
189
- fieldset?: string | null | undefined;
190
- config?: {
191
- label?: string | null | undefined;
192
- placeholder?: string;
193
- };
194
- }) | ({
195
- type: "Date";
196
- } & {
197
- fieldset?: string | null | undefined;
198
- config?: {
199
- label?: string | null | undefined;
200
- placeholder?: string;
201
- default?: string;
202
- };
203
- }) | ({
204
- type: "Embed";
205
- } & {
206
- fieldset?: string | null | undefined;
207
- config?: {
208
- label?: string | null | undefined;
209
- placeholder?: string;
210
- useAsTitle?: boolean;
211
- };
212
- }) | ({
213
- type: "GeoPoint";
214
- } & {
215
- fieldset?: string | null | undefined;
216
- config?: {
217
- label?: string | null | undefined;
218
- };
219
- }) | ({
220
- type: "Image";
221
- } & {
222
- fieldset?: string | null | undefined;
223
- config?: {
224
- label?: string | null | undefined;
225
- placeholder?: string;
226
- constraint?: {
227
- width?: number | null;
228
- height?: number | null;
229
- };
230
- thumbnails?: readonly ({
231
- name: string;
232
- } & {
233
- width?: number | null;
234
- height?: number | null;
235
- })[];
236
- };
237
- }) | ({
238
- type: "IntegrationFields";
239
- } & {
240
- fieldset?: string | null | undefined;
241
- config?: {
242
- label?: string | null | undefined;
243
- placeholder?: string;
244
- catalog?: string;
245
- };
246
- }) | ({
247
- type: "Link";
248
- } & {
249
- fieldset?: string | null | undefined;
250
- config?: {
251
- label?: string | null | undefined;
252
- useAsTitle?: boolean;
253
- placeholder?: string;
254
- select?: "media" | "document" | "web" | null;
255
- customtypes?: readonly string[];
256
- masks?: readonly string[];
257
- tags?: readonly string[];
258
- allowTargetBlank?: boolean;
259
- };
260
- }) | ({
261
- type: "Number";
262
- } & {
263
- fieldset?: string | null | undefined;
264
- config?: {
265
- label?: string | null | undefined;
266
- placeholder?: string;
267
- min?: number;
268
- max?: number;
269
- step?: number;
270
- };
271
- }) | ({
272
- type: "Range";
273
- } & {
274
- fieldset?: string | null | undefined;
275
- config?: {
276
- label?: string | null | undefined;
277
- placeholder?: string;
278
- min?: number;
279
- max?: number;
280
- step?: number;
281
- };
282
- }) | ({
283
- type: "StructuredText";
284
- } & {
285
- fieldset?: string | null | undefined;
286
- config?: {
287
- label?: string | null | undefined;
288
- placeholder?: string;
289
- useAsTitle?: boolean;
290
- single?: string;
291
- multi?: string;
292
- imageConstraint?: {
293
- width?: number | null;
294
- height?: number | null;
295
- };
296
- labels?: readonly string[];
297
- allowTargetBlank?: boolean;
298
- };
299
- }) | ({
300
- type: "Select";
301
- } & {
302
- fieldset?: string | null | undefined;
303
- config?: {
304
- label?: string | null | undefined;
305
- placeholder?: string;
306
- default_value?: string;
307
- options?: readonly string[];
308
- };
309
- }) | ({
310
- type: "Separator";
311
- } & {
312
- config?: {
313
- label?: string | null | undefined;
314
- };
315
- }) | ({
316
- type: "Text";
317
- } & {
318
- fieldset?: string | null | undefined;
319
- config?: {
320
- label?: string | null | undefined;
321
- useAsTitle?: boolean;
322
- placeholder?: string;
323
- };
324
- }) | ({
325
- type: "Timestamp";
326
- } & {
327
- fieldset?: string | null | undefined;
328
- config?: {
329
- label?: string | null | undefined;
330
- placeholder?: string;
331
- default?: string;
332
- };
333
- });
334
- };
335
- })[];
336
- } & {
337
- description?: string;
338
- legacyPaths?: {
339
- [x: string]: string;
340
- };
341
- }>;
342
- export declare const findSliceVariation: (slice: SharedSliceCustomType) => (variation: string) => E.Either<string, Variation>;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findSliceVariation = exports.findSlice = 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 errors_1 = require("./errors");
8
- const findSlice = (slices) => (sliceId) => (0, function_1.pipe)(slices.find((slice) => slice.id === sliceId), E.fromNullable(errors_1.SharedSliceErrors.SliceTypeNotFound(sliceId)));
9
- exports.findSlice = findSlice;
10
- const findSliceVariation = (slice) => (variation) => (0, function_1.pipe)(slice.variations.find((v) => v.id === variation), E.fromNullable(errors_1.SharedSliceErrors.VariationNotFound(variation, slice.id)));
11
- exports.findSliceVariation = findSliceVariation;
@@ -1 +0,0 @@
1
- export * from "./ImportSlices";
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./ImportSlices"), exports);
@@ -1,4 +0,0 @@
1
- import { SharedSlice as SharedSliceCustomType, StaticSlices } from "../../../../customtypes";
2
- import type { SharedSlice, SharedSliceId } from "./SharedSlice";
3
- export declare const extractSupportedSlices: (staticSlices: StaticSlices) => SharedSliceCustomType[];
4
- export declare const findImportSharedSliceDuplicateIds: (slices: SharedSlice[]) => SharedSliceId[];