@prismicio/types-internal 1.5.3 → 2.0.0-alpha.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 (252) hide show
  1. package/lib/common/WidgetKey.d.ts +3 -0
  2. package/lib/common/WidgetKey.js +8 -0
  3. package/lib/common/index.d.ts +1 -0
  4. package/lib/common/index.js +4 -0
  5. package/lib/content/Document.d.ts +4285 -2573
  6. package/lib/content/Document.js +87 -10
  7. package/lib/content/LegacyContentCtx.d.ts +41 -0
  8. package/lib/content/LegacyContentCtx.js +65 -0
  9. package/lib/content/fields/EmptyContent.d.ts +16 -0
  10. package/lib/content/fields/EmptyContent.js +30 -0
  11. package/lib/content/fields/GroupContent.d.ts +1063 -364
  12. package/lib/content/fields/GroupContent.js +65 -6
  13. package/lib/content/fields/UIDContent.d.ts +10 -1
  14. package/lib/content/fields/UIDContent.js +17 -4
  15. package/lib/content/fields/WidgetContent.d.ts +6820 -0
  16. package/lib/content/fields/WidgetContent.js +57 -0
  17. package/lib/content/fields/index.d.ts +1 -2989
  18. package/lib/content/fields/index.js +1 -18
  19. package/lib/content/fields/nestable/BooleanContent.d.ts +10 -1
  20. package/lib/content/fields/nestable/BooleanContent.js +17 -4
  21. package/lib/content/fields/nestable/EmbedContent.d.ts +56 -5
  22. package/lib/content/fields/nestable/EmbedContent.js +57 -6
  23. package/lib/content/fields/nestable/FieldContent/ColorContent.d.ts +18 -0
  24. package/lib/content/fields/nestable/FieldContent/ColorContent.js +34 -0
  25. package/lib/content/fields/nestable/FieldContent/DateContent.d.ts +18 -0
  26. package/lib/content/fields/nestable/FieldContent/DateContent.js +34 -0
  27. package/lib/content/fields/nestable/FieldContent/NumberContent.d.ts +18 -0
  28. package/lib/content/fields/nestable/FieldContent/NumberContent.js +34 -0
  29. package/lib/content/fields/nestable/FieldContent/RangeContent.d.ts +18 -0
  30. package/lib/content/fields/nestable/FieldContent/RangeContent.js +34 -0
  31. package/lib/content/fields/nestable/FieldContent/SelectContent.d.ts +18 -0
  32. package/lib/content/fields/nestable/FieldContent/SelectContent.js +34 -0
  33. package/lib/content/fields/nestable/FieldContent/TextContent.d.ts +18 -0
  34. package/lib/content/fields/nestable/FieldContent/TextContent.js +34 -0
  35. package/lib/content/fields/nestable/FieldContent/TimestampContent.d.ts +18 -0
  36. package/lib/content/fields/nestable/FieldContent/TimestampContent.js +34 -0
  37. package/lib/content/fields/nestable/FieldContent/common.d.ts +1 -0
  38. package/lib/content/fields/nestable/FieldContent/common.js +4 -0
  39. package/lib/content/fields/nestable/FieldContent/index.d.ts +49 -0
  40. package/lib/content/fields/nestable/FieldContent/index.js +38 -0
  41. package/lib/content/fields/nestable/FieldContent.d.ts +7 -1
  42. package/lib/content/fields/nestable/FieldContent.js +19 -4
  43. package/lib/content/fields/nestable/GeoPointContent.d.ts +19 -4
  44. package/lib/content/fields/nestable/GeoPointContent.js +22 -5
  45. package/lib/content/fields/nestable/ImageContent.d.ts +109 -11
  46. package/lib/content/fields/nestable/ImageContent.js +64 -6
  47. package/lib/content/fields/nestable/IntegrationFieldContent.d.ts +10 -1
  48. package/lib/content/fields/nestable/IntegrationFieldContent.js +20 -4
  49. package/lib/content/fields/nestable/LinkContent.d.ts +240 -87
  50. package/lib/content/fields/nestable/LinkContent.js +133 -36
  51. package/lib/content/fields/nestable/NestableContent.d.ts +711 -251
  52. package/lib/content/fields/nestable/NestableContent.js +116 -13
  53. package/lib/content/fields/nestable/RichTextContent/Blocks.d.ts +594 -0
  54. package/lib/content/fields/nestable/RichTextContent/Blocks.js +151 -0
  55. package/lib/content/fields/nestable/RichTextContent/index.d.ts +489 -0
  56. package/lib/content/fields/nestable/RichTextContent/index.js +27 -0
  57. package/lib/content/fields/nestable/SeparatorContent.d.ts +8 -1
  58. package/lib/content/fields/nestable/SeparatorContent.js +15 -4
  59. package/lib/content/fields/slices/CompositeSliceContent.d.ts +296 -362
  60. package/lib/content/fields/slices/RepeatableContent.d.ts +148 -181
  61. package/lib/content/fields/slices/SharedSliceContent.d.ts +296 -362
  62. package/lib/content/fields/slices/SimpleSliceContent.d.ts +296 -362
  63. package/lib/content/fields/slices/Slice/CompositeSliceContent.d.ts +1709 -0
  64. package/lib/content/fields/slices/Slice/CompositeSliceContent.js +81 -0
  65. package/lib/content/fields/slices/Slice/RepeatableContent.d.ts +582 -0
  66. package/lib/content/fields/slices/Slice/RepeatableContent.js +18 -0
  67. package/lib/content/fields/slices/Slice/SharedSliceContent.d.ts +1713 -0
  68. package/lib/content/fields/slices/Slice/SharedSliceContent.js +98 -0
  69. package/lib/content/fields/slices/Slice/SimpleSliceContent.d.ts +1429 -0
  70. package/lib/content/fields/slices/Slice/SimpleSliceContent.js +24 -0
  71. package/lib/content/fields/slices/Slice/index.d.ts +3216 -0
  72. package/lib/content/fields/slices/Slice/index.js +41 -0
  73. package/lib/content/fields/slices/SliceItem.d.ts +3498 -0
  74. package/lib/content/fields/slices/SliceItem.js +61 -0
  75. package/lib/content/fields/slices/SlicesContent.d.ts +4243 -3576
  76. package/lib/content/fields/slices/SlicesContent.js +28 -18
  77. package/lib/content/fields/slices/index.d.ts +4 -3
  78. package/lib/content/fields/slices/index.js +4 -3
  79. package/lib/content/index.d.ts +1 -0
  80. package/lib/content/index.js +1 -0
  81. package/lib/content/utils.d.ts +10 -0
  82. package/lib/content/utils.js +19 -0
  83. package/lib/customtypes/CustomType.d.ts +366 -366
  84. package/lib/customtypes/CustomType.js +4 -7
  85. package/lib/customtypes/Section.d.ts +366 -366
  86. package/lib/customtypes/Section.js +2 -2
  87. package/lib/customtypes/diff/SharedSlice.d.ts +4 -4
  88. package/lib/customtypes/diff/Variation.d.ts +4 -4
  89. package/lib/customtypes/widgets/Group.d.ts +1 -0
  90. package/lib/customtypes/widgets/Group.js +6 -5
  91. package/lib/customtypes/widgets/UID.d.ts +1 -0
  92. package/lib/customtypes/widgets/UID.js +3 -2
  93. package/lib/customtypes/widgets/Widget.d.ts +384 -362
  94. package/lib/customtypes/widgets/Widget.js +29 -8
  95. package/lib/customtypes/widgets/index.d.ts +6 -7
  96. package/lib/customtypes/widgets/index.js +6 -11
  97. package/lib/customtypes/widgets/nestable/BooleanField.d.ts +10 -3
  98. package/lib/customtypes/widgets/nestable/BooleanField.js +6 -6
  99. package/lib/customtypes/widgets/nestable/Color.d.ts +8 -3
  100. package/lib/customtypes/widgets/nestable/Color.js +6 -6
  101. package/lib/customtypes/widgets/nestable/Date.d.ts +9 -3
  102. package/lib/customtypes/widgets/nestable/Date.js +6 -6
  103. package/lib/customtypes/widgets/nestable/Embed.d.ts +9 -3
  104. package/lib/customtypes/widgets/nestable/Embed.js +6 -6
  105. package/lib/customtypes/widgets/nestable/GeoPoint.d.ts +7 -3
  106. package/lib/customtypes/widgets/nestable/GeoPoint.js +6 -6
  107. package/lib/customtypes/widgets/nestable/Image.d.ts +25 -3
  108. package/lib/customtypes/widgets/nestable/Image.js +8 -8
  109. package/lib/customtypes/widgets/nestable/IntegrationField.d.ts +9 -3
  110. package/lib/customtypes/widgets/nestable/IntegrationField.js +6 -6
  111. package/lib/customtypes/widgets/nestable/Link.d.ts +14 -2
  112. package/lib/customtypes/widgets/nestable/Link.js +7 -6
  113. package/lib/customtypes/widgets/nestable/NestableWidget.d.ts +3 -3
  114. package/lib/customtypes/widgets/nestable/NestableWidget.js +30 -30
  115. package/lib/customtypes/widgets/nestable/Number.d.ts +11 -3
  116. package/lib/customtypes/widgets/nestable/Number.js +6 -6
  117. package/lib/customtypes/widgets/nestable/Range.d.ts +11 -3
  118. package/lib/customtypes/widgets/nestable/Range.js +6 -6
  119. package/lib/customtypes/widgets/nestable/RichText.d.ts +1 -0
  120. package/lib/customtypes/widgets/nestable/RichText.js +3 -3
  121. package/lib/customtypes/widgets/nestable/Select.d.ts +10 -3
  122. package/lib/customtypes/widgets/nestable/Select.js +6 -6
  123. package/lib/customtypes/widgets/nestable/Separator.d.ts +7 -3
  124. package/lib/customtypes/widgets/nestable/Separator.js +6 -6
  125. package/lib/customtypes/widgets/nestable/Text.d.ts +9 -2
  126. package/lib/customtypes/widgets/nestable/Text.js +7 -6
  127. package/lib/customtypes/widgets/nestable/Timestamp.d.ts +9 -3
  128. package/lib/customtypes/widgets/nestable/Timestamp.js +6 -6
  129. package/lib/customtypes/widgets/nestable/index.d.ts +15 -15
  130. package/lib/customtypes/widgets/nestable/index.js +15 -31
  131. package/lib/customtypes/widgets/slices/CompositeSlice.d.ts +1 -0
  132. package/lib/customtypes/widgets/slices/CompositeSlice.js +7 -6
  133. package/lib/customtypes/widgets/slices/LegacySlice.js +2 -2
  134. package/lib/customtypes/widgets/slices/SharedSlice.d.ts +1 -0
  135. package/lib/customtypes/widgets/slices/SharedSlice.js +7 -7
  136. package/lib/customtypes/widgets/slices/SharedSliceRef.js +2 -2
  137. package/lib/customtypes/widgets/slices/Slices.d.ts +364 -362
  138. package/lib/customtypes/widgets/slices/Slices.js +8 -8
  139. package/lib/customtypes/widgets/slices/SlicesTypes.d.ts +6 -5
  140. package/lib/customtypes/widgets/slices/SlicesTypes.js +8 -4
  141. package/lib/documents/DocumentData.d.ts +3 -14
  142. package/lib/documents/DocumentData.js +5 -60
  143. package/lib/documents/widgets/nestable/ImageContent.d.ts +1 -1
  144. package/lib/documents/widgets/nestable/ImageContent.js +2 -2
  145. package/lib/utils/Objects.d.ts +1 -0
  146. package/lib/utils/Objects.js +10 -1
  147. package/package.json +1 -1
  148. package/src/common/WidgetKey.ts +13 -0
  149. package/src/common/index.ts +1 -0
  150. package/src/content/Document.ts +129 -16
  151. package/src/content/LegacyContentCtx.ts +57 -0
  152. package/src/content/fields/EmptyContent.ts +45 -0
  153. package/src/content/fields/GroupContent.ts +103 -8
  154. package/src/content/fields/UIDContent.ts +33 -3
  155. package/src/content/fields/WidgetContent.ts +76 -0
  156. package/src/content/fields/index.ts +1 -23
  157. package/src/content/fields/nestable/BooleanContent.ts +32 -3
  158. package/src/content/fields/nestable/EmbedContent.ts +79 -8
  159. package/src/content/fields/nestable/FieldContent/ColorContent.ts +48 -0
  160. package/src/content/fields/nestable/FieldContent/DateContent.ts +48 -0
  161. package/src/content/fields/nestable/FieldContent/NumberContent.ts +48 -0
  162. package/src/content/fields/nestable/FieldContent/RangeContent.ts +48 -0
  163. package/src/content/fields/nestable/FieldContent/SelectContent.ts +48 -0
  164. package/src/content/fields/nestable/FieldContent/TextContent.ts +48 -0
  165. package/src/content/fields/nestable/FieldContent/TimestampContent.ts +48 -0
  166. package/src/content/fields/nestable/FieldContent/common.ts +1 -0
  167. package/src/content/fields/nestable/FieldContent/index.ts +40 -0
  168. package/src/content/fields/nestable/GeoPointContent.ts +38 -7
  169. package/src/content/fields/nestable/ImageContent.ts +91 -11
  170. package/src/content/fields/nestable/IntegrationFieldContent.ts +42 -3
  171. package/src/content/fields/nestable/LinkContent.ts +208 -47
  172. package/src/content/fields/nestable/NestableContent.ts +180 -24
  173. package/src/content/fields/nestable/RichTextContent/Blocks.ts +205 -0
  174. package/src/content/fields/nestable/RichTextContent/index.ts +43 -0
  175. package/src/content/fields/nestable/SeparatorContent.ts +26 -3
  176. package/src/content/fields/slices/Slice/CompositeSliceContent.ts +118 -0
  177. package/src/content/fields/slices/{RepeatableContent.ts → Slice/RepeatableContent.ts} +7 -4
  178. package/src/content/fields/slices/Slice/SharedSliceContent.ts +129 -0
  179. package/src/content/fields/slices/Slice/SimpleSliceContent.ts +30 -0
  180. package/src/content/fields/slices/Slice/index.ts +47 -0
  181. package/src/content/fields/slices/SliceItem.ts +83 -0
  182. package/src/content/fields/slices/SlicesContent.ts +47 -19
  183. package/src/content/fields/slices/index.ts +4 -3
  184. package/src/content/index.ts +1 -0
  185. package/src/content/utils.ts +20 -0
  186. package/src/customtypes/CustomType.ts +4 -10
  187. package/src/customtypes/Section.ts +1 -1
  188. package/src/customtypes/widgets/Group.ts +4 -4
  189. package/src/customtypes/widgets/UID.ts +3 -2
  190. package/src/customtypes/widgets/Widget.ts +53 -7
  191. package/src/customtypes/widgets/index.ts +6 -7
  192. package/src/customtypes/widgets/nestable/BooleanField.ts +7 -8
  193. package/src/customtypes/widgets/nestable/Color.ts +6 -8
  194. package/src/customtypes/widgets/nestable/Date.ts +7 -8
  195. package/src/customtypes/widgets/nestable/Embed.ts +7 -8
  196. package/src/customtypes/widgets/nestable/GeoPoint.ts +7 -8
  197. package/src/customtypes/widgets/nestable/Image.ts +9 -10
  198. package/src/customtypes/widgets/nestable/IntegrationField.ts +6 -8
  199. package/src/customtypes/widgets/nestable/Link.ts +7 -6
  200. package/src/customtypes/widgets/nestable/NestableWidget.ts +17 -18
  201. package/src/customtypes/widgets/nestable/Number.ts +7 -8
  202. package/src/customtypes/widgets/nestable/Range.ts +7 -8
  203. package/src/customtypes/widgets/nestable/RichText.ts +3 -2
  204. package/src/customtypes/widgets/nestable/Select.ts +7 -8
  205. package/src/customtypes/widgets/nestable/Separator.ts +7 -8
  206. package/src/customtypes/widgets/nestable/Text.ts +7 -6
  207. package/src/customtypes/widgets/nestable/Timestamp.ts +7 -8
  208. package/src/customtypes/widgets/nestable/index.ts +15 -15
  209. package/src/customtypes/widgets/slices/CompositeSlice.ts +5 -4
  210. package/src/customtypes/widgets/slices/LegacySlice.ts +1 -1
  211. package/src/customtypes/widgets/slices/SharedSlice.ts +5 -4
  212. package/src/customtypes/widgets/slices/SharedSliceRef.ts +2 -2
  213. package/src/customtypes/widgets/slices/Slices.ts +7 -6
  214. package/src/customtypes/widgets/slices/SlicesTypes.ts +10 -5
  215. package/src/utils/Objects.ts +12 -0
  216. package/src/content/fields/nestable/FieldContent.ts +0 -25
  217. package/src/content/fields/nestable/RichTextContent.ts +0 -32
  218. package/src/content/fields/slices/CompositeSliceContent.ts +0 -14
  219. package/src/content/fields/slices/SharedSliceContent.ts +0 -14
  220. package/src/content/fields/slices/SimpleSliceContent.ts +0 -7
  221. package/src/customtypes/widgets/WidgetTypes.ts +0 -24
  222. package/src/documents/DocumentData.ts +0 -112
  223. package/src/documents/index.ts +0 -2
  224. package/src/documents/widgets/EmptyContent.ts +0 -8
  225. package/src/documents/widgets/GroupContent.ts +0 -91
  226. package/src/documents/widgets/SimpleWidgetContent.ts +0 -96
  227. package/src/documents/widgets/StaticWidgetContent.ts +0 -46
  228. package/src/documents/widgets/UIDContent.ts +0 -18
  229. package/src/documents/widgets/index.ts +0 -70
  230. package/src/documents/widgets/nestable/BooleanContent.ts +0 -21
  231. package/src/documents/widgets/nestable/EmbedContent.ts +0 -56
  232. package/src/documents/widgets/nestable/FieldContent.ts +0 -53
  233. package/src/documents/widgets/nestable/GeoPointContent.ts +0 -18
  234. package/src/documents/widgets/nestable/ImageContent.ts +0 -51
  235. package/src/documents/widgets/nestable/IntegrationFieldsContent.ts +0 -26
  236. package/src/documents/widgets/nestable/Link/DocumentLink.ts +0 -18
  237. package/src/documents/widgets/nestable/Link/ExternalLink.ts +0 -31
  238. package/src/documents/widgets/nestable/Link/FileLink.ts +0 -30
  239. package/src/documents/widgets/nestable/Link/ImageLink.ts +0 -31
  240. package/src/documents/widgets/nestable/Link/LinkContent.ts +0 -25
  241. package/src/documents/widgets/nestable/Link/index.ts +0 -35
  242. package/src/documents/widgets/nestable/SeparatorContent.ts +0 -13
  243. package/src/documents/widgets/nestable/StructuredTextContent/Block.ts +0 -126
  244. package/src/documents/widgets/nestable/StructuredTextContent/index.ts +0 -25
  245. package/src/documents/widgets/nestable/index.ts +0 -35
  246. package/src/documents/widgets/slices/CompositeSliceContent.ts +0 -77
  247. package/src/documents/widgets/slices/SharedSliceContent.ts +0 -94
  248. package/src/documents/widgets/slices/SimpleSliceContent.ts +0 -4
  249. package/src/documents/widgets/slices/SliceWidgetContent.ts +0 -51
  250. package/src/documents/widgets/slices/SlicesContent.ts +0 -91
  251. package/src/documents/widgets/slices/index.ts +0 -5
  252. package/src/index.ts +0 -3
@@ -1,25 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WidgetTypes = exports.WidgetContent = void 0;
4
3
  const tslib_1 = require("tslib");
5
- const t = (0, tslib_1.__importStar)(require("io-ts"));
6
- const GroupContent_1 = require("./GroupContent");
7
- const nestable_1 = require("./nestable");
8
- const slices_1 = require("./slices");
9
- const UIDContent_1 = require("./UIDContent");
10
4
  (0, tslib_1.__exportStar)(require("./GroupContent"), exports);
11
5
  (0, tslib_1.__exportStar)(require("./nestable"), exports);
12
6
  (0, tslib_1.__exportStar)(require("./slices"), exports);
13
7
  (0, tslib_1.__exportStar)(require("./UIDContent"), exports);
14
- exports.WidgetContent = t.union([
15
- GroupContent_1.GroupContent,
16
- nestable_1.NestableContent,
17
- UIDContent_1.UIDContent,
18
- slices_1.SlicesContent,
19
- ]);
20
- exports.WidgetTypes = {
21
- ...nestable_1.NestableTypes,
22
- UID: UIDContent_1.UIDContentType,
23
- Group: GroupContent_1.GroupContentType,
24
- slices: slices_1.SlicesContentType,
25
- };
8
+ (0, tslib_1.__exportStar)(require("./WidgetContent"), exports);
@@ -1,7 +1,16 @@
1
1
  import * as t from "io-ts";
2
+ import type { LegacyContentCtx, WithTypes } from "../../LegacyContentCtx";
3
+ export declare const BooleanContentType = "BooleanContent";
4
+ export declare const isBooleanContent: (u: unknown) => u is {
5
+ __TYPE__: "BooleanContent";
6
+ value: boolean;
7
+ };
8
+ export declare const BooleanLegacy: (ctx: LegacyContentCtx) => t.Type<{
9
+ __TYPE__: "BooleanContent";
10
+ value: boolean;
11
+ }, WithTypes<boolean>, unknown>;
2
12
  export declare const BooleanContent: t.ExactC<t.TypeC<{
3
13
  __TYPE__: t.LiteralC<"BooleanContent">;
4
14
  value: t.BooleanC;
5
15
  }>>;
6
16
  export declare type BooleanContent = t.TypeOf<typeof BooleanContent>;
7
- export declare const BooleanContentType = "BooleanContent";
@@ -1,11 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BooleanContentType = exports.BooleanContent = void 0;
3
+ exports.BooleanContent = exports.BooleanLegacy = exports.isBooleanContent = exports.BooleanContentType = void 0;
4
4
  const tslib_1 = require("tslib");
5
+ const fp_ts_1 = require("fp-ts");
6
+ const function_1 = require("fp-ts/lib/function");
5
7
  const t = (0, tslib_1.__importStar)(require("io-ts"));
6
- const BooleanContent_1 = require("../../../documents/widgets/nestable/BooleanContent");
8
+ const utils_1 = require("../../utils");
9
+ exports.BooleanContentType = "BooleanContent";
10
+ const isBooleanContent = (u) => (0, utils_1.hasContentType)(u) && u.__TYPE__ === exports.BooleanContentType;
11
+ exports.isBooleanContent = isBooleanContent;
12
+ const BooleanLegacy = (ctx) => new t.Type("BooleanLegacy", exports.isBooleanContent, (u) => {
13
+ return (0, function_1.pipe)(t.boolean.decode(u), fp_ts_1.either.map((b) => exports.BooleanContent.encode({ value: b, __TYPE__: exports.BooleanContentType })));
14
+ }, (b) => {
15
+ return {
16
+ content: b.value,
17
+ types: { [ctx.keyOfType]: "Boolean" },
18
+ };
19
+ });
20
+ exports.BooleanLegacy = BooleanLegacy;
7
21
  exports.BooleanContent = t.strict({
8
- __TYPE__: t.literal(BooleanContent_1.BooleanContentType),
22
+ __TYPE__: t.literal(exports.BooleanContentType),
9
23
  value: t.boolean,
10
24
  });
11
- exports.BooleanContentType = BooleanContent_1.BooleanContentType;
@@ -1,5 +1,7 @@
1
1
  import * as t from "io-ts";
2
- export declare const EmbedContent: t.IntersectionC<[t.Type<{
2
+ import type { LegacyContentCtx, WithTypes } from "../../LegacyContentCtx";
3
+ export declare const EmbedContentType = "EmbedContent";
4
+ export declare const isEmbedContent: (u: unknown) => u is {
3
5
  embed_url: string;
4
6
  type: string;
5
7
  } & {
@@ -14,7 +16,27 @@ export declare const EmbedContent: t.IntersectionC<[t.Type<{
14
16
  thumbnail_width?: number | null | undefined;
15
17
  thumbnail_height?: number | null | undefined;
16
18
  html?: string | null | undefined;
17
- }, {
19
+ } & {
20
+ __TYPE__: "EmbedContent";
21
+ };
22
+ export declare const EmbedContentLegacy: t.ExactC<t.IntersectionC<[t.TypeC<{
23
+ embed_url: t.StringC;
24
+ type: t.StringC;
25
+ }>, t.PartialC<{
26
+ version: t.UnionC<[t.StringC, t.NumberC, t.NullC]>;
27
+ title: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
28
+ author_name: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
29
+ author_url: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
30
+ provider_name: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
31
+ provider_url: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
32
+ cache_age: t.UnionC<[t.StringC, t.NumberC, t.NullC]>;
33
+ thumbnail_url: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
34
+ thumbnail_width: t.UnionC<[t.Type<number, number, unknown>, t.NullC, t.UndefinedC]>;
35
+ thumbnail_height: t.UnionC<[t.Type<number, number, unknown>, t.NullC, t.UndefinedC]>;
36
+ html: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
37
+ }>]>>;
38
+ export declare type EmbedLegacy = t.TypeOf<typeof EmbedContentLegacy>;
39
+ export declare const EmbedLegacy: (ctx: LegacyContentCtx) => t.Type<{
18
40
  embed_url: string;
19
41
  type: string;
20
42
  } & {
@@ -31,9 +53,38 @@ export declare const EmbedContent: t.IntersectionC<[t.Type<{
31
53
  html?: string | null | undefined;
32
54
  } & {
33
55
  __TYPE__: "EmbedContent";
34
- }, unknown>, t.ExactC<t.TypeC<{
56
+ }, WithTypes<{
57
+ embed_url: string;
58
+ type: string;
59
+ } & {
60
+ version?: string | number | null;
61
+ title?: string | null | undefined;
62
+ author_name?: string | null | undefined;
63
+ author_url?: string | null | undefined;
64
+ provider_name?: string | null | undefined;
65
+ provider_url?: string | null | undefined;
66
+ cache_age?: string | number | null;
67
+ thumbnail_url?: string | null | undefined;
68
+ thumbnail_width?: number | null | undefined;
69
+ thumbnail_height?: number | null | undefined;
70
+ html?: string | null | undefined;
71
+ }>, unknown>;
72
+ export declare const EmbedContent: t.IntersectionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
73
+ embed_url: t.StringC;
74
+ type: t.StringC;
75
+ }>, t.PartialC<{
76
+ version: t.UnionC<[t.StringC, t.NumberC, t.NullC]>;
77
+ title: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
78
+ author_name: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
79
+ author_url: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
80
+ provider_name: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
81
+ provider_url: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
82
+ cache_age: t.UnionC<[t.StringC, t.NumberC, t.NullC]>;
83
+ thumbnail_url: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
84
+ thumbnail_width: t.UnionC<[t.Type<number, number, unknown>, t.NullC, t.UndefinedC]>;
85
+ thumbnail_height: t.UnionC<[t.Type<number, number, unknown>, t.NullC, t.UndefinedC]>;
86
+ html: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
87
+ }>]>>, t.ExactC<t.TypeC<{
35
88
  __TYPE__: t.LiteralC<"EmbedContent">;
36
- all: t.UnknownC;
37
89
  }>>]>;
38
90
  export declare type EmbedContent = t.TypeOf<typeof EmbedContent>;
39
- export declare const EmbedContentType = "EmbedContent";
@@ -1,14 +1,65 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EmbedContentType = exports.EmbedContent = void 0;
3
+ exports.EmbedContent = exports.EmbedLegacy = exports.EmbedContentLegacy = exports.isEmbedContent = exports.EmbedContentType = void 0;
4
4
  const tslib_1 = require("tslib");
5
+ const fp_ts_1 = require("fp-ts");
6
+ const function_1 = require("fp-ts/lib/function");
5
7
  const t = (0, tslib_1.__importStar)(require("io-ts"));
6
- const EmbedContent_1 = require("../../../documents/widgets/nestable/EmbedContent");
8
+ const Objects_1 = require("../../../utils/Objects");
9
+ const validators_1 = require("../../../validators");
10
+ const utils_1 = require("../../utils");
11
+ exports.EmbedContentType = "EmbedContent";
12
+ const isEmbedContent = (u) => (0, utils_1.hasContentType)(u) && u.__TYPE__ === exports.EmbedContentType;
13
+ exports.isEmbedContent = isEmbedContent;
14
+ exports.EmbedContentLegacy = t.exact(t.intersection([
15
+ t.type({
16
+ embed_url: t.string,
17
+ type: t.string,
18
+ }),
19
+ t.partial({
20
+ version: t.union([t.string, t.number, t.null]),
21
+ title: validators_1.StringOrNull,
22
+ author_name: validators_1.StringOrNull,
23
+ author_url: validators_1.StringOrNull,
24
+ provider_name: validators_1.StringOrNull,
25
+ provider_url: validators_1.StringOrNull,
26
+ cache_age: t.union([t.string, t.number, t.null]),
27
+ thumbnail_url: validators_1.StringOrNull,
28
+ thumbnail_width: validators_1.NumberOrNull,
29
+ thumbnail_height: validators_1.NumberOrNull,
30
+ html: validators_1.StringOrNull,
31
+ }),
32
+ ]));
33
+ const EmbedLegacy = (ctx) => new t.Type("EmbedLegacy", exports.isEmbedContent, (u) => {
34
+ return (0, function_1.pipe)(exports.EmbedContentLegacy.decode(u), fp_ts_1.either.map((embed) => exports.EmbedContent.encode({
35
+ ...embed,
36
+ __TYPE__: exports.EmbedContentType,
37
+ })));
38
+ }, (embed) => {
39
+ return {
40
+ content: (0, Objects_1.withOptionals)({
41
+ embed_url: embed.embed_url,
42
+ type: embed.type,
43
+ }, [
44
+ ["author_name", embed.author_name],
45
+ ["author_url", embed.author_url],
46
+ ["cache_age", embed.cache_age],
47
+ ["html", embed.html],
48
+ ["provider_name", embed.provider_name],
49
+ ["provider_url", embed.provider_url],
50
+ ["thumbnail_height", embed.thumbnail_height],
51
+ ["thumbnail_width", embed.thumbnail_width],
52
+ ["thumbnail_url", embed.thumbnail_url],
53
+ ["title", embed.title],
54
+ ["version", embed.version],
55
+ ]),
56
+ types: { [ctx.keyOfType]: "Embed" },
57
+ };
58
+ });
59
+ exports.EmbedLegacy = EmbedLegacy;
7
60
  exports.EmbedContent = t.intersection([
8
- EmbedContent_1.EmbedContentC,
61
+ exports.EmbedContentLegacy,
9
62
  t.strict({
10
- __TYPE__: t.literal(EmbedContent_1.EmbedContentType),
11
- all: t.unknown,
63
+ __TYPE__: t.literal(exports.EmbedContentType),
12
64
  }),
13
65
  ]);
14
- exports.EmbedContentType = EmbedContent_1.EmbedContentType;
@@ -0,0 +1,18 @@
1
+ import * as t from "io-ts";
2
+ import type { LegacyContentCtx, WithTypes } from "../../../LegacyContentCtx";
3
+ export declare const isColorContent: (u: unknown) => u is {
4
+ type: "Color";
5
+ value: string;
6
+ __TYPE__: "FieldContent";
7
+ };
8
+ export declare const ColorLegacy: (ctx: LegacyContentCtx) => t.Type<{
9
+ type: "Color";
10
+ value: string;
11
+ __TYPE__: "FieldContent";
12
+ }, WithTypes<string>, unknown>;
13
+ export declare const ColorContent: t.ExactC<t.TypeC<{
14
+ type: t.LiteralC<"Color">;
15
+ value: t.Type<string, string, unknown>;
16
+ __TYPE__: t.LiteralC<"FieldContent">;
17
+ }>>;
18
+ export declare type ColorContent = t.TypeOf<typeof ColorContent>;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ColorContent = exports.ColorLegacy = exports.isColorContent = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const fp_ts_1 = require("fp-ts");
6
+ const function_1 = require("fp-ts/lib/function");
7
+ const t = (0, tslib_1.__importStar)(require("io-ts"));
8
+ const widgets_1 = require("../../../../customtypes/widgets");
9
+ const TrimmedString_1 = (0, tslib_1.__importDefault)(require("../../../../validators/TrimmedString"));
10
+ const utils_1 = require("../../../utils");
11
+ const common_1 = require("./common");
12
+ const isColorContent = (u) => (0, utils_1.hasContentType)(u) &&
13
+ u.__TYPE__ === common_1.FieldContentType &&
14
+ (0, utils_1.hasFieldContentType)(u) &&
15
+ u.type === "Color";
16
+ exports.isColorContent = isColorContent;
17
+ const ColorLegacy = (ctx) => new t.Type("ColorLegacy", exports.isColorContent, (u) => {
18
+ return (0, function_1.pipe)(TrimmedString_1.default.decode(u), fp_ts_1.either.map((f) => exports.ColorContent.encode({
19
+ value: f,
20
+ type: widgets_1.ColorFieldType,
21
+ __TYPE__: common_1.FieldContentType,
22
+ })));
23
+ }, (b) => {
24
+ return {
25
+ content: b.value,
26
+ types: { [ctx.keyOfType]: widgets_1.ColorFieldType },
27
+ };
28
+ });
29
+ exports.ColorLegacy = ColorLegacy;
30
+ exports.ColorContent = t.strict({
31
+ type: t.literal(widgets_1.ColorFieldType),
32
+ value: TrimmedString_1.default,
33
+ __TYPE__: t.literal(common_1.FieldContentType),
34
+ });
@@ -0,0 +1,18 @@
1
+ import * as t from "io-ts";
2
+ import type { LegacyContentCtx, WithTypes } from "../../../LegacyContentCtx";
3
+ export declare const isDateContent: (u: unknown) => u is {
4
+ type: "Date";
5
+ value: string;
6
+ __TYPE__: "FieldContent";
7
+ };
8
+ export declare const DateLegacy: (ctx: LegacyContentCtx) => t.Type<{
9
+ type: "Date";
10
+ value: string;
11
+ __TYPE__: "FieldContent";
12
+ }, WithTypes<string>, unknown>;
13
+ export declare const DateContent: t.ExactC<t.TypeC<{
14
+ type: t.LiteralC<"Date">;
15
+ value: t.Type<string, string, unknown>;
16
+ __TYPE__: t.LiteralC<"FieldContent">;
17
+ }>>;
18
+ export declare type DateContent = t.TypeOf<typeof DateContent>;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DateContent = exports.DateLegacy = exports.isDateContent = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const fp_ts_1 = require("fp-ts");
6
+ const function_1 = require("fp-ts/lib/function");
7
+ const t = (0, tslib_1.__importStar)(require("io-ts"));
8
+ const widgets_1 = require("../../../../customtypes/widgets");
9
+ const TrimmedString_1 = (0, tslib_1.__importDefault)(require("../../../../validators/TrimmedString"));
10
+ const utils_1 = require("../../../utils");
11
+ const common_1 = require("./common");
12
+ const isDateContent = (u) => (0, utils_1.hasContentType)(u) &&
13
+ u.__TYPE__ === common_1.FieldContentType &&
14
+ (0, utils_1.hasFieldContentType)(u) &&
15
+ u.type === "Date";
16
+ exports.isDateContent = isDateContent;
17
+ const DateLegacy = (ctx) => new t.Type("DateLegacy", exports.isDateContent, (u) => {
18
+ return (0, function_1.pipe)(TrimmedString_1.default.decode(u), fp_ts_1.either.map((f) => exports.DateContent.encode({
19
+ value: f,
20
+ type: widgets_1.DateFieldType,
21
+ __TYPE__: common_1.FieldContentType,
22
+ })));
23
+ }, (b) => {
24
+ return {
25
+ content: b.value,
26
+ types: { [ctx.keyOfType]: widgets_1.DateFieldType },
27
+ };
28
+ });
29
+ exports.DateLegacy = DateLegacy;
30
+ exports.DateContent = t.strict({
31
+ type: t.literal(widgets_1.DateFieldType),
32
+ value: TrimmedString_1.default,
33
+ __TYPE__: t.literal(common_1.FieldContentType),
34
+ });
@@ -0,0 +1,18 @@
1
+ import * as t from "io-ts";
2
+ import type { LegacyContentCtx, WithTypes } from "../../../LegacyContentCtx";
3
+ export declare const isNumberContent: (u: unknown) => u is {
4
+ type: "Number";
5
+ value: string;
6
+ __TYPE__: "FieldContent";
7
+ };
8
+ export declare const NumberLegacy: (ctx: LegacyContentCtx) => t.Type<{
9
+ type: "Number";
10
+ value: string;
11
+ __TYPE__: "FieldContent";
12
+ }, WithTypes<string>, unknown>;
13
+ export declare const NumberContent: t.ExactC<t.TypeC<{
14
+ type: t.LiteralC<"Number">;
15
+ value: t.Type<string, string, unknown>;
16
+ __TYPE__: t.LiteralC<"FieldContent">;
17
+ }>>;
18
+ export declare type NumberContent = t.TypeOf<typeof NumberContent>;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NumberContent = exports.NumberLegacy = exports.isNumberContent = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const fp_ts_1 = require("fp-ts");
6
+ const function_1 = require("fp-ts/lib/function");
7
+ const t = (0, tslib_1.__importStar)(require("io-ts"));
8
+ const widgets_1 = require("../../../../customtypes/widgets");
9
+ const TrimmedString_1 = (0, tslib_1.__importDefault)(require("../../../../validators/TrimmedString"));
10
+ const utils_1 = require("../../../utils");
11
+ const common_1 = require("./common");
12
+ const isNumberContent = (u) => (0, utils_1.hasContentType)(u) &&
13
+ u.__TYPE__ === common_1.FieldContentType &&
14
+ (0, utils_1.hasFieldContentType)(u) &&
15
+ u.type === "Number";
16
+ exports.isNumberContent = isNumberContent;
17
+ const NumberLegacy = (ctx) => new t.Type("NumberLegacy", exports.isNumberContent, (u) => {
18
+ return (0, function_1.pipe)(TrimmedString_1.default.decode(u), fp_ts_1.either.map((f) => exports.NumberContent.encode({
19
+ value: f,
20
+ type: widgets_1.NumberFieldType,
21
+ __TYPE__: common_1.FieldContentType,
22
+ })));
23
+ }, (b) => {
24
+ return {
25
+ content: b.value,
26
+ types: { [ctx.keyOfType]: widgets_1.NumberFieldType },
27
+ };
28
+ });
29
+ exports.NumberLegacy = NumberLegacy;
30
+ exports.NumberContent = t.strict({
31
+ type: t.literal(widgets_1.NumberFieldType),
32
+ value: TrimmedString_1.default,
33
+ __TYPE__: t.literal(common_1.FieldContentType),
34
+ });
@@ -0,0 +1,18 @@
1
+ import * as t from "io-ts";
2
+ import type { LegacyContentCtx, WithTypes } from "../../../LegacyContentCtx";
3
+ export declare const isRangeContent: (u: unknown) => u is {
4
+ type: "Range";
5
+ value: string;
6
+ __TYPE__: "FieldContent";
7
+ };
8
+ export declare const RangeLegacy: (ctx: LegacyContentCtx) => t.Type<{
9
+ type: "Range";
10
+ value: string;
11
+ __TYPE__: "FieldContent";
12
+ }, WithTypes<string>, unknown>;
13
+ export declare const RangeContent: t.ExactC<t.TypeC<{
14
+ type: t.LiteralC<"Range">;
15
+ value: t.Type<string, string, unknown>;
16
+ __TYPE__: t.LiteralC<"FieldContent">;
17
+ }>>;
18
+ export declare type RangeContent = t.TypeOf<typeof RangeContent>;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RangeContent = exports.RangeLegacy = exports.isRangeContent = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const fp_ts_1 = require("fp-ts");
6
+ const function_1 = require("fp-ts/lib/function");
7
+ const t = (0, tslib_1.__importStar)(require("io-ts"));
8
+ const widgets_1 = require("../../../../customtypes/widgets");
9
+ const TrimmedString_1 = (0, tslib_1.__importDefault)(require("../../../../validators/TrimmedString"));
10
+ const utils_1 = require("../../../utils");
11
+ const common_1 = require("./common");
12
+ const isRangeContent = (u) => (0, utils_1.hasContentType)(u) &&
13
+ u.__TYPE__ === common_1.FieldContentType &&
14
+ (0, utils_1.hasFieldContentType)(u) &&
15
+ u.type === "Range";
16
+ exports.isRangeContent = isRangeContent;
17
+ const RangeLegacy = (ctx) => new t.Type("RangeLegacy", exports.isRangeContent, (u) => {
18
+ return (0, function_1.pipe)(TrimmedString_1.default.decode(u), fp_ts_1.either.map((f) => exports.RangeContent.encode({
19
+ value: f,
20
+ type: widgets_1.RangeFieldType,
21
+ __TYPE__: common_1.FieldContentType,
22
+ })));
23
+ }, (b) => {
24
+ return {
25
+ content: b.value,
26
+ types: { [ctx.keyOfType]: widgets_1.RangeFieldType },
27
+ };
28
+ });
29
+ exports.RangeLegacy = RangeLegacy;
30
+ exports.RangeContent = t.strict({
31
+ type: t.literal(widgets_1.RangeFieldType),
32
+ value: TrimmedString_1.default,
33
+ __TYPE__: t.literal(common_1.FieldContentType),
34
+ });
@@ -0,0 +1,18 @@
1
+ import * as t from "io-ts";
2
+ import type { LegacyContentCtx, WithTypes } from "../../../LegacyContentCtx";
3
+ export declare const isSelectContent: (u: unknown) => u is {
4
+ type: "Select";
5
+ value: string;
6
+ __TYPE__: "FieldContent";
7
+ };
8
+ export declare const SelectLegacy: (ctx: LegacyContentCtx) => t.Type<{
9
+ type: "Select";
10
+ value: string;
11
+ __TYPE__: "FieldContent";
12
+ }, WithTypes<string>, unknown>;
13
+ export declare const SelectContent: t.ExactC<t.TypeC<{
14
+ type: t.LiteralC<"Select">;
15
+ value: t.Type<string, string, unknown>;
16
+ __TYPE__: t.LiteralC<"FieldContent">;
17
+ }>>;
18
+ export declare type SelectContent = t.TypeOf<typeof SelectContent>;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SelectContent = exports.SelectLegacy = exports.isSelectContent = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const fp_ts_1 = require("fp-ts");
6
+ const function_1 = require("fp-ts/lib/function");
7
+ const t = (0, tslib_1.__importStar)(require("io-ts"));
8
+ const widgets_1 = require("../../../../customtypes/widgets");
9
+ const TrimmedString_1 = (0, tslib_1.__importDefault)(require("../../../../validators/TrimmedString"));
10
+ const utils_1 = require("../../../utils");
11
+ const common_1 = require("./common");
12
+ const isSelectContent = (u) => (0, utils_1.hasContentType)(u) &&
13
+ u.__TYPE__ === common_1.FieldContentType &&
14
+ (0, utils_1.hasFieldContentType)(u) &&
15
+ u.type === "Select";
16
+ exports.isSelectContent = isSelectContent;
17
+ const SelectLegacy = (ctx) => new t.Type("SelectLegacy", exports.isSelectContent, (u) => {
18
+ return (0, function_1.pipe)(TrimmedString_1.default.decode(u), fp_ts_1.either.map((f) => exports.SelectContent.encode({
19
+ value: f,
20
+ type: widgets_1.SelectFieldType,
21
+ __TYPE__: common_1.FieldContentType,
22
+ })));
23
+ }, (b) => {
24
+ return {
25
+ content: b.value,
26
+ types: { [ctx.keyOfType]: widgets_1.SelectFieldType },
27
+ };
28
+ });
29
+ exports.SelectLegacy = SelectLegacy;
30
+ exports.SelectContent = t.strict({
31
+ type: t.literal(widgets_1.SelectFieldType),
32
+ value: TrimmedString_1.default,
33
+ __TYPE__: t.literal(common_1.FieldContentType),
34
+ });
@@ -0,0 +1,18 @@
1
+ import * as t from "io-ts";
2
+ import type { LegacyContentCtx, WithTypes } from "../../../LegacyContentCtx";
3
+ export declare const isTextContent: (u: unknown) => u is {
4
+ type: "Text";
5
+ value: string;
6
+ __TYPE__: "FieldContent";
7
+ };
8
+ export declare const TextLegacy: (ctx: LegacyContentCtx) => t.Type<{
9
+ type: "Text";
10
+ value: string;
11
+ __TYPE__: "FieldContent";
12
+ }, WithTypes<string>, unknown>;
13
+ export declare const TextContent: t.ExactC<t.TypeC<{
14
+ type: t.LiteralC<"Text">;
15
+ value: t.Type<string, string, unknown>;
16
+ __TYPE__: t.LiteralC<"FieldContent">;
17
+ }>>;
18
+ export declare type TextContent = t.TypeOf<typeof TextContent>;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TextContent = exports.TextLegacy = exports.isTextContent = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const fp_ts_1 = require("fp-ts");
6
+ const function_1 = require("fp-ts/lib/function");
7
+ const t = (0, tslib_1.__importStar)(require("io-ts"));
8
+ const widgets_1 = require("../../../../customtypes/widgets");
9
+ const TrimmedString_1 = (0, tslib_1.__importDefault)(require("../../../../validators/TrimmedString"));
10
+ const utils_1 = require("../../../utils");
11
+ const common_1 = require("./common");
12
+ const isTextContent = (u) => (0, utils_1.hasContentType)(u) &&
13
+ u.__TYPE__ === common_1.FieldContentType &&
14
+ (0, utils_1.hasFieldContentType)(u) &&
15
+ u.type === "Text";
16
+ exports.isTextContent = isTextContent;
17
+ const TextLegacy = (ctx) => new t.Type("TextLegacy", exports.isTextContent, (u) => {
18
+ return (0, function_1.pipe)(TrimmedString_1.default.decode(u), fp_ts_1.either.map((f) => exports.TextContent.encode({
19
+ value: f,
20
+ type: widgets_1.TextFieldType,
21
+ __TYPE__: common_1.FieldContentType,
22
+ })));
23
+ }, (b) => {
24
+ return {
25
+ content: b.value,
26
+ types: { [ctx.keyOfType]: widgets_1.TextFieldType },
27
+ };
28
+ });
29
+ exports.TextLegacy = TextLegacy;
30
+ exports.TextContent = t.strict({
31
+ type: t.literal(widgets_1.TextFieldType),
32
+ value: TrimmedString_1.default,
33
+ __TYPE__: t.literal(common_1.FieldContentType),
34
+ });
@@ -0,0 +1,18 @@
1
+ import * as t from "io-ts";
2
+ import type { LegacyContentCtx, WithTypes } from "../../../LegacyContentCtx";
3
+ export declare const isTimestampContent: (u: unknown) => u is {
4
+ type: "Timestamp";
5
+ value: string;
6
+ __TYPE__: "FieldContent";
7
+ };
8
+ export declare const TimestampLegacy: (ctx: LegacyContentCtx) => t.Type<{
9
+ type: "Timestamp";
10
+ value: string;
11
+ __TYPE__: "FieldContent";
12
+ }, WithTypes<string>, unknown>;
13
+ export declare const TimestampContent: t.ExactC<t.TypeC<{
14
+ type: t.LiteralC<"Timestamp">;
15
+ value: t.Type<string, string, unknown>;
16
+ __TYPE__: t.LiteralC<"FieldContent">;
17
+ }>>;
18
+ export declare type TimestampContent = t.TypeOf<typeof TimestampContent>;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TimestampContent = exports.TimestampLegacy = exports.isTimestampContent = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const fp_ts_1 = require("fp-ts");
6
+ const function_1 = require("fp-ts/lib/function");
7
+ const t = (0, tslib_1.__importStar)(require("io-ts"));
8
+ const widgets_1 = require("../../../../customtypes/widgets");
9
+ const TrimmedString_1 = (0, tslib_1.__importDefault)(require("../../../../validators/TrimmedString"));
10
+ const utils_1 = require("../../../utils");
11
+ const common_1 = require("./common");
12
+ const isTimestampContent = (u) => (0, utils_1.hasContentType)(u) &&
13
+ u.__TYPE__ === common_1.FieldContentType &&
14
+ (0, utils_1.hasFieldContentType)(u) &&
15
+ u.type === "Timestamp";
16
+ exports.isTimestampContent = isTimestampContent;
17
+ const TimestampLegacy = (ctx) => new t.Type("TimestampLegacy", exports.isTimestampContent, (u) => {
18
+ return (0, function_1.pipe)(TrimmedString_1.default.decode(u), fp_ts_1.either.map((f) => exports.TimestampContent.encode({
19
+ value: f,
20
+ type: widgets_1.TimestampFieldType,
21
+ __TYPE__: common_1.FieldContentType,
22
+ })));
23
+ }, (b) => {
24
+ return {
25
+ content: b.value,
26
+ types: { [ctx.keyOfType]: widgets_1.TimestampFieldType },
27
+ };
28
+ });
29
+ exports.TimestampLegacy = TimestampLegacy;
30
+ exports.TimestampContent = t.strict({
31
+ type: t.literal(widgets_1.TimestampFieldType),
32
+ value: TrimmedString_1.default,
33
+ __TYPE__: t.literal(common_1.FieldContentType),
34
+ });
@@ -0,0 +1 @@
1
+ export declare const FieldContentType = "FieldContent";
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FieldContentType = void 0;
4
+ exports.FieldContentType = "FieldContent";