@prismicio/types-internal 3.16.0 → 3.16.1-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 (235) hide show
  1. package/lib/content/fields/RepeatableContent.d.ts +51 -123
  2. package/lib/content/fields/RepeatableContent.js +10 -14
  3. package/lib/content/fields/nestable/RichTextContent/Block.d.ts +1036 -0
  4. package/lib/content/fields/nestable/RichTextContent/Block.js +31 -0
  5. package/lib/content/fields/nestable/RichTextContent/EmbedBlock.d.ts +60 -0
  6. package/lib/content/fields/nestable/RichTextContent/EmbedBlock.js +53 -0
  7. package/lib/content/fields/nestable/RichTextContent/ImageBlock.d.ts +203 -0
  8. package/lib/content/fields/nestable/RichTextContent/ImageBlock.js +36 -0
  9. package/lib/content/fields/nestable/RichTextContent/TableBlock.d.ts +500 -0
  10. package/lib/content/fields/nestable/RichTextContent/TableBlock.js +21 -0
  11. package/lib/content/fields/nestable/RichTextContent/TextBlock.d.ts +590 -0
  12. package/lib/content/fields/nestable/RichTextContent/TextBlock.js +80 -0
  13. package/lib/scripts/release.d.ts +1 -0
  14. package/lib/scripts/release.js +34 -0
  15. package/lib/src/_internal/utils.d.ts +36 -0
  16. package/lib/src/_internal/utils.js +20 -0
  17. package/lib/src/common/Asset.d.ts +16 -0
  18. package/lib/src/common/Asset.js +11 -0
  19. package/lib/src/common/Embed.d.ts +15 -0
  20. package/lib/src/common/Embed.js +10 -0
  21. package/lib/src/common/HexaColorCode.d.ts +4 -0
  22. package/lib/src/common/HexaColorCode.js +7 -0
  23. package/lib/src/common/UUID.d.ts +6 -0
  24. package/lib/src/common/UUID.js +8 -0
  25. package/lib/src/common/WidgetKey.d.ts +3 -0
  26. package/lib/src/common/WidgetKey.js +8 -0
  27. package/lib/src/common/index.d.ts +3 -0
  28. package/lib/src/common/index.js +6 -0
  29. package/lib/src/content/Document.d.ts +11803 -0
  30. package/lib/src/content/Document.js +266 -0
  31. package/lib/src/content/LegacyContentCtx.d.ts +64 -0
  32. package/lib/src/content/LegacyContentCtx.js +130 -0
  33. package/lib/src/content/fields/EmptyContent.d.ts +16 -0
  34. package/lib/src/content/fields/EmptyContent.js +30 -0
  35. package/lib/src/content/fields/GroupContent.d.ts +42 -0
  36. package/lib/src/content/fields/GroupContent.js +208 -0
  37. package/lib/src/content/fields/UIDContent.d.ts +16 -0
  38. package/lib/src/content/fields/UIDContent.js +25 -0
  39. package/lib/src/content/fields/WidgetContent.d.ts +11749 -0
  40. package/lib/src/content/fields/WidgetContent.js +57 -0
  41. package/lib/src/content/fields/index.d.ts +6 -0
  42. package/lib/src/content/fields/index.js +9 -0
  43. package/lib/src/content/fields/nestable/BooleanContent.d.ts +18 -0
  44. package/lib/src/content/fields/nestable/BooleanContent.js +35 -0
  45. package/lib/src/content/fields/nestable/EmbedContent.d.ts +78 -0
  46. package/lib/src/content/fields/nestable/EmbedContent.js +56 -0
  47. package/lib/src/content/fields/nestable/FieldContent/ColorContent.d.ts +18 -0
  48. package/lib/src/content/fields/nestable/FieldContent/ColorContent.js +35 -0
  49. package/lib/src/content/fields/nestable/FieldContent/DateContent.d.ts +18 -0
  50. package/lib/src/content/fields/nestable/FieldContent/DateContent.js +35 -0
  51. package/lib/src/content/fields/nestable/FieldContent/NumberContent.d.ts +18 -0
  52. package/lib/src/content/fields/nestable/FieldContent/NumberContent.js +35 -0
  53. package/lib/src/content/fields/nestable/FieldContent/RangeContent.d.ts +18 -0
  54. package/lib/src/content/fields/nestable/FieldContent/RangeContent.js +35 -0
  55. package/lib/src/content/fields/nestable/FieldContent/SelectContent.d.ts +20 -0
  56. package/lib/src/content/fields/nestable/FieldContent/SelectContent.js +46 -0
  57. package/lib/src/content/fields/nestable/FieldContent/TextContent.d.ts +18 -0
  58. package/lib/src/content/fields/nestable/FieldContent/TextContent.js +35 -0
  59. package/lib/src/content/fields/nestable/FieldContent/TimestampContent.d.ts +18 -0
  60. package/lib/src/content/fields/nestable/FieldContent/TimestampContent.js +35 -0
  61. package/lib/src/content/fields/nestable/FieldContent/common.d.ts +1 -0
  62. package/lib/src/content/fields/nestable/FieldContent/common.js +4 -0
  63. package/lib/src/content/fields/nestable/FieldContent/index.d.ts +49 -0
  64. package/lib/src/content/fields/nestable/FieldContent/index.js +38 -0
  65. package/lib/src/content/fields/nestable/GeoPointContent.d.ts +33 -0
  66. package/lib/src/content/fields/nestable/GeoPointContent.js +31 -0
  67. package/lib/src/content/fields/nestable/ImageContent.d.ts +227 -0
  68. package/lib/src/content/fields/nestable/ImageContent.js +73 -0
  69. package/lib/src/content/fields/nestable/IntegrationFieldContent.d.ts +16 -0
  70. package/lib/src/content/fields/nestable/IntegrationFieldContent.js +28 -0
  71. package/lib/src/content/fields/nestable/LinkContent.d.ts +919 -0
  72. package/lib/src/content/fields/nestable/LinkContent.js +399 -0
  73. package/lib/src/content/fields/nestable/NestableContent.d.ts +1953 -0
  74. package/lib/src/content/fields/nestable/NestableContent.js +167 -0
  75. package/lib/src/content/fields/nestable/RepeatableContent.d.ts +176 -0
  76. package/lib/src/content/fields/nestable/RepeatableContent.js +104 -0
  77. package/lib/src/content/fields/nestable/RichTextContent/Blocks.d.ts +1261 -0
  78. package/lib/src/content/fields/nestable/RichTextContent/Blocks.js +170 -0
  79. package/lib/src/content/fields/nestable/RichTextContent/index.d.ts +1004 -0
  80. package/lib/src/content/fields/nestable/RichTextContent/index.js +28 -0
  81. package/lib/src/content/fields/nestable/SeparatorContent.d.ts +13 -0
  82. package/lib/src/content/fields/nestable/SeparatorContent.js +22 -0
  83. package/lib/src/content/fields/nestable/TableContent.d.ts +770 -0
  84. package/lib/src/content/fields/nestable/TableContent.js +121 -0
  85. package/lib/src/content/fields/nestable/index.d.ts +12 -0
  86. package/lib/src/content/fields/nestable/index.js +15 -0
  87. package/lib/src/content/fields/slices/Slice/CompositeSliceContent.d.ts +3934 -0
  88. package/lib/src/content/fields/slices/Slice/CompositeSliceContent.js +195 -0
  89. package/lib/src/content/fields/slices/Slice/RepeatableContent.d.ts +774 -0
  90. package/lib/src/content/fields/slices/Slice/RepeatableContent.js +21 -0
  91. package/lib/src/content/fields/slices/Slice/SharedSliceContent.d.ts +3937 -0
  92. package/lib/src/content/fields/slices/Slice/SharedSliceContent.js +215 -0
  93. package/lib/src/content/fields/slices/Slice/SimpleSliceContent.d.ts +1962 -0
  94. package/lib/src/content/fields/slices/Slice/SimpleSliceContent.js +130 -0
  95. package/lib/src/content/fields/slices/Slice/SlicePrimaryContent.d.ts +1952 -0
  96. package/lib/src/content/fields/slices/Slice/SlicePrimaryContent.js +30 -0
  97. package/lib/src/content/fields/slices/Slice/index.d.ts +6810 -0
  98. package/lib/src/content/fields/slices/Slice/index.js +45 -0
  99. package/lib/src/content/fields/slices/SliceItem.d.ts +6846 -0
  100. package/lib/src/content/fields/slices/SliceItem.js +116 -0
  101. package/lib/src/content/fields/slices/SlicesContent.d.ts +9809 -0
  102. package/lib/src/content/fields/slices/SlicesContent.js +187 -0
  103. package/lib/src/content/fields/slices/index.d.ts +3 -0
  104. package/lib/src/content/fields/slices/index.js +6 -0
  105. package/lib/src/content/fields/withDefaultValues.d.ts +9 -0
  106. package/lib/src/content/fields/withDefaultValues.js +79 -0
  107. package/lib/src/content/index.d.ts +3 -0
  108. package/lib/src/content/index.js +6 -0
  109. package/lib/src/content/utils.d.ts +14 -0
  110. package/lib/src/content/utils.js +33 -0
  111. package/lib/src/customtypes/CustomType.d.ts +3680 -0
  112. package/lib/src/customtypes/CustomType.js +184 -0
  113. package/lib/src/customtypes/Section.d.ts +3635 -0
  114. package/lib/src/customtypes/Section.js +66 -0
  115. package/lib/src/customtypes/diff/Changes.d.ts +17 -0
  116. package/lib/src/customtypes/diff/Changes.js +9 -0
  117. package/lib/src/customtypes/diff/SharedSlice.d.ts +1624 -0
  118. package/lib/src/customtypes/diff/SharedSlice.js +55 -0
  119. package/lib/src/customtypes/diff/Variation.d.ts +1605 -0
  120. package/lib/src/customtypes/diff/Variation.js +113 -0
  121. package/lib/src/customtypes/diff/Widgets.d.ts +11 -0
  122. package/lib/src/customtypes/diff/Widgets.js +2 -0
  123. package/lib/src/customtypes/diff/index.d.ts +4 -0
  124. package/lib/src/customtypes/diff/index.js +7 -0
  125. package/lib/src/customtypes/index.d.ts +4 -0
  126. package/lib/src/customtypes/index.js +7 -0
  127. package/lib/src/customtypes/widgets/Group.d.ts +1352 -0
  128. package/lib/src/customtypes/widgets/Group.js +92 -0
  129. package/lib/src/customtypes/widgets/UID.d.ts +19 -0
  130. package/lib/src/customtypes/widgets/UID.js +21 -0
  131. package/lib/src/customtypes/widgets/Widget.d.ts +4457 -0
  132. package/lib/src/customtypes/widgets/Widget.js +49 -0
  133. package/lib/src/customtypes/widgets/index.d.ts +6 -0
  134. package/lib/src/customtypes/widgets/index.js +9 -0
  135. package/lib/src/customtypes/widgets/nestable/BooleanField.d.ts +20 -0
  136. package/lib/src/customtypes/widgets/nestable/BooleanField.js +21 -0
  137. package/lib/src/customtypes/widgets/nestable/Color.d.ts +17 -0
  138. package/lib/src/customtypes/widgets/nestable/Color.js +20 -0
  139. package/lib/src/customtypes/widgets/nestable/Date.d.ts +19 -0
  140. package/lib/src/customtypes/widgets/nestable/Date.js +21 -0
  141. package/lib/src/customtypes/widgets/nestable/Embed.d.ts +19 -0
  142. package/lib/src/customtypes/widgets/nestable/Embed.js +21 -0
  143. package/lib/src/customtypes/widgets/nestable/GeoPoint.d.ts +15 -0
  144. package/lib/src/customtypes/widgets/nestable/GeoPoint.js +19 -0
  145. package/lib/src/customtypes/widgets/nestable/Image.d.ts +44 -0
  146. package/lib/src/customtypes/widgets/nestable/Image.js +29 -0
  147. package/lib/src/customtypes/widgets/nestable/IntegrationField.d.ts +19 -0
  148. package/lib/src/customtypes/widgets/nestable/IntegrationField.js +21 -0
  149. package/lib/src/customtypes/widgets/nestable/Link.d.ts +196 -0
  150. package/lib/src/customtypes/widgets/nestable/Link.js +167 -0
  151. package/lib/src/customtypes/widgets/nestable/NestableWidget.d.ts +217 -0
  152. package/lib/src/customtypes/widgets/nestable/NestableWidget.js +39 -0
  153. package/lib/src/customtypes/widgets/nestable/Number.d.ts +23 -0
  154. package/lib/src/customtypes/widgets/nestable/Number.js +24 -0
  155. package/lib/src/customtypes/widgets/nestable/Range.d.ts +23 -0
  156. package/lib/src/customtypes/widgets/nestable/Range.js +24 -0
  157. package/lib/src/customtypes/widgets/nestable/RichText.d.ts +73 -0
  158. package/lib/src/customtypes/widgets/nestable/RichText.js +131 -0
  159. package/lib/src/customtypes/widgets/nestable/Select.d.ts +21 -0
  160. package/lib/src/customtypes/widgets/nestable/Select.js +22 -0
  161. package/lib/src/customtypes/widgets/nestable/Separator.d.ts +14 -0
  162. package/lib/src/customtypes/widgets/nestable/Separator.js +18 -0
  163. package/lib/src/customtypes/widgets/nestable/Table.d.ts +21 -0
  164. package/lib/src/customtypes/widgets/nestable/Table.js +30 -0
  165. package/lib/src/customtypes/widgets/nestable/Text.d.ts +19 -0
  166. package/lib/src/customtypes/widgets/nestable/Text.js +21 -0
  167. package/lib/src/customtypes/widgets/nestable/Timestamp.d.ts +19 -0
  168. package/lib/src/customtypes/widgets/nestable/Timestamp.js +21 -0
  169. package/lib/src/customtypes/widgets/nestable/index.d.ts +17 -0
  170. package/lib/src/customtypes/widgets/nestable/index.js +20 -0
  171. package/lib/src/customtypes/widgets/shared/ImageConstraint.d.ts +7 -0
  172. package/lib/src/customtypes/widgets/shared/ImageConstraint.js +31 -0
  173. package/lib/src/customtypes/widgets/shared/index.d.ts +1 -0
  174. package/lib/src/customtypes/widgets/shared/index.js +8 -0
  175. package/lib/src/customtypes/widgets/slices/CompositeSlice.d.ts +455 -0
  176. package/lib/src/customtypes/widgets/slices/CompositeSlice.js +63 -0
  177. package/lib/src/customtypes/widgets/slices/LegacySlice.d.ts +442 -0
  178. package/lib/src/customtypes/widgets/slices/LegacySlice.js +12 -0
  179. package/lib/src/customtypes/widgets/slices/SharedSlice.d.ts +1807 -0
  180. package/lib/src/customtypes/widgets/slices/SharedSlice.js +118 -0
  181. package/lib/src/customtypes/widgets/slices/SharedSliceRef.d.ts +5 -0
  182. package/lib/src/customtypes/widgets/slices/SharedSliceRef.js +9 -0
  183. package/lib/src/customtypes/widgets/slices/Slice.d.ts +6 -0
  184. package/lib/src/customtypes/widgets/slices/Slice.js +2 -0
  185. package/lib/src/customtypes/widgets/slices/SlicePrimaryWidget.d.ts +1259 -0
  186. package/lib/src/customtypes/widgets/slices/SlicePrimaryWidget.js +10 -0
  187. package/lib/src/customtypes/widgets/slices/Slices.d.ts +5917 -0
  188. package/lib/src/customtypes/widgets/slices/Slices.js +146 -0
  189. package/lib/src/customtypes/widgets/slices/SlicesTypes.d.ts +6 -0
  190. package/lib/src/customtypes/widgets/slices/SlicesTypes.js +11 -0
  191. package/lib/src/customtypes/widgets/slices/index.d.ts +8 -0
  192. package/lib/src/customtypes/widgets/slices/index.js +11 -0
  193. package/lib/src/utils/Arrays.d.ts +1 -0
  194. package/lib/src/utils/Arrays.js +13 -0
  195. package/lib/src/utils/DocumentId.d.ts +2 -0
  196. package/lib/src/utils/DocumentId.js +7 -0
  197. package/lib/src/utils/Objects.d.ts +8 -0
  198. package/lib/src/utils/Objects.js +42 -0
  199. package/lib/src/utils/index.d.ts +3 -0
  200. package/lib/src/utils/index.js +7 -0
  201. package/lib/src/validators/BasicTypes.d.ts +10 -0
  202. package/lib/src/validators/BasicTypes.js +25 -0
  203. package/lib/src/validators/DateFromString.d.ts +3 -0
  204. package/lib/src/validators/DateFromString.js +11 -0
  205. package/lib/src/validators/DateFromStringOrNumber.d.ts +3 -0
  206. package/lib/src/validators/DateFromStringOrNumber.js +10 -0
  207. package/lib/src/validators/DateFromTsMs.d.ts +3 -0
  208. package/lib/src/validators/DateFromTsMs.js +10 -0
  209. package/lib/src/validators/DefaultOrElse.d.ts +5 -0
  210. package/lib/src/validators/DefaultOrElse.js +21 -0
  211. package/lib/src/validators/IntFromNumber.d.ts +5 -0
  212. package/lib/src/validators/IntFromNumber.js +14 -0
  213. package/lib/src/validators/IntFromPixels.d.ts +8 -0
  214. package/lib/src/validators/IntFromPixels.js +24 -0
  215. package/lib/src/validators/NonEmptyString.d.ts +3 -0
  216. package/lib/src/validators/NonEmptyString.js +6 -0
  217. package/lib/src/validators/NonEmptyStringOrNull.d.ts +3 -0
  218. package/lib/src/validators/NonEmptyStringOrNull.js +15 -0
  219. package/lib/src/validators/NumberOrNull.d.ts +3 -0
  220. package/lib/src/validators/NumberOrNull.js +6 -0
  221. package/lib/src/validators/NumberRange.d.ts +32 -0
  222. package/lib/src/validators/NumberRange.js +40 -0
  223. package/lib/src/validators/StringFromBoolean.d.ts +5 -0
  224. package/lib/src/validators/StringFromBoolean.js +10 -0
  225. package/lib/src/validators/StringFromNumber.d.ts +5 -0
  226. package/lib/src/validators/StringFromNumber.js +10 -0
  227. package/lib/src/validators/StringOrNull.d.ts +3 -0
  228. package/lib/src/validators/StringOrNull.js +6 -0
  229. package/lib/src/validators/TrimmedString.d.ts +5 -0
  230. package/lib/src/validators/TrimmedString.js +23 -0
  231. package/lib/src/validators/function.d.ts +34 -0
  232. package/lib/src/validators/function.js +100 -0
  233. package/lib/src/validators/index.d.ts +15 -0
  234. package/lib/src/validators/index.js +31 -0
  235. package/package.json +1 -1
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WidgetLegacy = exports.isWidgetContent = exports.WidgetContent = void 0;
4
+ 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
+ exports.WidgetContent = t.union([
11
+ GroupContent_1.GroupContent,
12
+ nestable_1.NestableContent,
13
+ UIDContent_1.UIDContent,
14
+ slices_1.SlicesContent,
15
+ ]);
16
+ const isWidgetContent = (u) => (0, GroupContent_1.isGroupContent)(u) ||
17
+ (0, nestable_1.isNestableContent)(u) ||
18
+ (0, UIDContent_1.isUIDContent)(u) ||
19
+ (0, slices_1.isSlicesContent)(u);
20
+ exports.isWidgetContent = isWidgetContent;
21
+ const WidgetLegacy = (ctx) => {
22
+ return {
23
+ decode(value) {
24
+ if (!ctx.fieldType)
25
+ return;
26
+ const codec = (() => {
27
+ switch (ctx.fieldType) {
28
+ case "UID":
29
+ return (0, UIDContent_1.UIDLegacy)(ctx);
30
+ case "Group":
31
+ return (0, GroupContent_1.GroupLegacy)(ctx);
32
+ case "Choice":
33
+ case "Slices":
34
+ return (0, slices_1.SlicesLegacy)(ctx);
35
+ default:
36
+ return (0, nestable_1.NestableLegacy)(ctx);
37
+ }
38
+ })();
39
+ if (!codec)
40
+ return;
41
+ return codec.decode(value);
42
+ },
43
+ encode(value) {
44
+ switch (value.__TYPE__) {
45
+ case UIDContent_1.UIDContentType:
46
+ return (0, UIDContent_1.UIDLegacy)(ctx).encode(value);
47
+ case GroupContent_1.GroupContentType:
48
+ return (0, GroupContent_1.GroupLegacy)(ctx).encode(value);
49
+ case slices_1.SlicesContentType:
50
+ return (0, slices_1.SlicesLegacy)(ctx).encode(value);
51
+ default:
52
+ return (0, nestable_1.NestableLegacy)(ctx).encode(value);
53
+ }
54
+ },
55
+ };
56
+ };
57
+ exports.WidgetLegacy = WidgetLegacy;
@@ -0,0 +1,6 @@
1
+ export * from "./EmptyContent";
2
+ export * from "./GroupContent";
3
+ export * from "./nestable";
4
+ export * from "./slices";
5
+ export * from "./UIDContent";
6
+ export * from "./WidgetContent";
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ (0, tslib_1.__exportStar)(require("./EmptyContent"), exports);
5
+ (0, tslib_1.__exportStar)(require("./GroupContent"), exports);
6
+ (0, tslib_1.__exportStar)(require("./nestable"), exports);
7
+ (0, tslib_1.__exportStar)(require("./slices"), exports);
8
+ (0, tslib_1.__exportStar)(require("./UIDContent"), exports);
9
+ (0, tslib_1.__exportStar)(require("./WidgetContent"), exports);
@@ -0,0 +1,18 @@
1
+ import * as t from "io-ts";
2
+ import type { BooleanField } from "../../../customtypes";
3
+ import type { LegacyContentCtx, WithTypes } from "../../LegacyContentCtx";
4
+ export declare const BooleanContentType = "BooleanContent";
5
+ export declare const isBooleanContent: (u: unknown) => u is {
6
+ __TYPE__: "BooleanContent";
7
+ value: boolean;
8
+ };
9
+ export declare const BooleanLegacy: (ctx: LegacyContentCtx) => t.Type<{
10
+ __TYPE__: "BooleanContent";
11
+ value: boolean;
12
+ }, WithTypes<boolean>, unknown>;
13
+ export declare const BooleanContent: t.ExactC<t.TypeC<{
14
+ __TYPE__: t.LiteralC<"BooleanContent">;
15
+ value: t.BooleanC;
16
+ }>>;
17
+ export declare type BooleanContent = t.TypeOf<typeof BooleanContent>;
18
+ export declare const BooleanContentDefaultValue: (field: BooleanField) => BooleanContent | undefined;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BooleanContentDefaultValue = exports.BooleanContent = exports.BooleanLegacy = exports.isBooleanContent = exports.BooleanContentType = 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 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
+ keys: {},
19
+ };
20
+ });
21
+ exports.BooleanLegacy = BooleanLegacy;
22
+ exports.BooleanContent = t.strict({
23
+ __TYPE__: t.literal(exports.BooleanContentType),
24
+ value: t.boolean,
25
+ });
26
+ const BooleanContentDefaultValue = (field) => {
27
+ var _a;
28
+ return ((_a = field.config) === null || _a === void 0 ? void 0 : _a.default_value) !== undefined
29
+ ? {
30
+ __TYPE__: exports.BooleanContentType,
31
+ value: field.config.default_value || false,
32
+ }
33
+ : undefined;
34
+ };
35
+ exports.BooleanContentDefaultValue = BooleanContentDefaultValue;
@@ -0,0 +1,78 @@
1
+ import * as t from "io-ts";
2
+ import type { LegacyContentCtx, WithTypes } from "../../LegacyContentCtx";
3
+ export declare const EmbedContentType = "EmbedContent";
4
+ export declare const isEmbedContent: (u: unknown) => u is {
5
+ embed_url: string;
6
+ type: string;
7
+ } & {
8
+ version?: string | number | null;
9
+ title?: string | null | undefined;
10
+ author_name?: string | null | undefined;
11
+ author_url?: string | null | undefined;
12
+ provider_name?: string | null | undefined;
13
+ provider_url?: string | null | undefined;
14
+ cache_age?: string | number | null;
15
+ thumbnail_url?: string | null | undefined;
16
+ thumbnail_width?: number | null | undefined;
17
+ thumbnail_height?: number | null | undefined;
18
+ html?: string | null | undefined;
19
+ } & {
20
+ __TYPE__: "EmbedContent";
21
+ all: unknown;
22
+ };
23
+ export declare const EmbedContentLegacy: t.ExactC<t.IntersectionC<[t.TypeC<{
24
+ embed_url: t.StringC;
25
+ type: t.StringC;
26
+ }>, t.PartialC<{
27
+ version: t.UnionC<[t.StringC, t.NumberC, t.NullC]>;
28
+ title: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
29
+ author_name: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
30
+ author_url: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
31
+ provider_name: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
32
+ provider_url: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
33
+ cache_age: t.UnionC<[t.StringC, t.NumberC, t.NullC]>;
34
+ thumbnail_url: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
35
+ thumbnail_width: t.UnionC<[t.Type<number, number, unknown>, t.NullC, t.UndefinedC]>;
36
+ thumbnail_height: t.UnionC<[t.Type<number, number, unknown>, t.NullC, t.UndefinedC]>;
37
+ html: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
38
+ }>]>>;
39
+ export declare type EmbedLegacy = t.TypeOf<typeof EmbedContentLegacy>;
40
+ export declare const EmbedLegacy: (ctx: LegacyContentCtx) => t.Type<{
41
+ embed_url: string;
42
+ type: string;
43
+ } & {
44
+ version?: string | number | null;
45
+ title?: string | null | undefined;
46
+ author_name?: string | null | undefined;
47
+ author_url?: string | null | undefined;
48
+ provider_name?: string | null | undefined;
49
+ provider_url?: string | null | undefined;
50
+ cache_age?: string | number | null;
51
+ thumbnail_url?: string | null | undefined;
52
+ thumbnail_width?: number | null | undefined;
53
+ thumbnail_height?: number | null | undefined;
54
+ html?: string | null | undefined;
55
+ } & {
56
+ __TYPE__: "EmbedContent";
57
+ all: unknown;
58
+ }, WithTypes<unknown>, unknown>;
59
+ export declare const EmbedContent: t.IntersectionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
60
+ embed_url: t.StringC;
61
+ type: t.StringC;
62
+ }>, t.PartialC<{
63
+ version: t.UnionC<[t.StringC, t.NumberC, t.NullC]>;
64
+ title: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
65
+ author_name: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
66
+ author_url: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
67
+ provider_name: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
68
+ provider_url: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
69
+ cache_age: t.UnionC<[t.StringC, t.NumberC, t.NullC]>;
70
+ thumbnail_url: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
71
+ thumbnail_width: t.UnionC<[t.Type<number, number, unknown>, t.NullC, t.UndefinedC]>;
72
+ thumbnail_height: t.UnionC<[t.Type<number, number, unknown>, t.NullC, t.UndefinedC]>;
73
+ html: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
74
+ }>]>>, t.ExactC<t.TypeC<{
75
+ __TYPE__: t.LiteralC<"EmbedContent">;
76
+ all: t.UnknownC;
77
+ }>>]>;
78
+ export declare type EmbedContent = t.TypeOf<typeof EmbedContent>;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EmbedContent = exports.EmbedLegacy = exports.EmbedContentLegacy = exports.isEmbedContent = exports.EmbedContentType = 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 validators_1 = require("../../../validators");
9
+ const utils_1 = require("../../utils");
10
+ exports.EmbedContentType = "EmbedContent";
11
+ const isEmbedContent = (u) => (0, utils_1.hasContentType)(u) && u.__TYPE__ === exports.EmbedContentType;
12
+ exports.isEmbedContent = isEmbedContent;
13
+ exports.EmbedContentLegacy = t.exact(t.intersection([
14
+ t.type({
15
+ embed_url: t.string,
16
+ type: t.string,
17
+ }),
18
+ t.partial({
19
+ version: t.union([t.string, t.number, t.null]),
20
+ title: validators_1.StringOrNull,
21
+ author_name: validators_1.StringOrNull,
22
+ author_url: validators_1.StringOrNull,
23
+ provider_name: validators_1.StringOrNull,
24
+ provider_url: validators_1.StringOrNull,
25
+ cache_age: t.union([t.string, t.number, t.null]),
26
+ thumbnail_url: validators_1.StringOrNull,
27
+ thumbnail_width: validators_1.NumberOrNull,
28
+ thumbnail_height: validators_1.NumberOrNull,
29
+ html: validators_1.StringOrNull,
30
+ }),
31
+ ]));
32
+ const EmbedLegacy = (ctx) => new t.Type("EmbedLegacy", exports.isEmbedContent, (u) => {
33
+ return (0, function_1.pipe)(exports.EmbedContentLegacy.decode(u), fp_ts_1.either.map((embed) => ({
34
+ ...embed,
35
+ all: u,
36
+ __TYPE__: exports.EmbedContentType,
37
+ })));
38
+ }, (embed) => {
39
+ return {
40
+ /**
41
+ * we cast here because actually in the all property
42
+ * we can have extra keys that are never parsed and we don't want to loose them.
43
+ **/
44
+ content: embed.all,
45
+ types: { [ctx.keyOfType]: "Embed" },
46
+ keys: {},
47
+ };
48
+ });
49
+ exports.EmbedLegacy = EmbedLegacy;
50
+ exports.EmbedContent = t.intersection([
51
+ exports.EmbedContentLegacy,
52
+ t.strict({
53
+ __TYPE__: t.literal(exports.EmbedContentType),
54
+ all: t.unknown,
55
+ }),
56
+ ]);
@@ -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,35 @@
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
+ keys: {},
28
+ };
29
+ });
30
+ exports.ColorLegacy = ColorLegacy;
31
+ exports.ColorContent = t.strict({
32
+ type: t.literal(widgets_1.ColorFieldType),
33
+ value: TrimmedString_1.default,
34
+ __TYPE__: t.literal(common_1.FieldContentType),
35
+ });
@@ -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,35 @@
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
+ keys: {},
28
+ };
29
+ });
30
+ exports.DateLegacy = DateLegacy;
31
+ exports.DateContent = t.strict({
32
+ type: t.literal(widgets_1.DateFieldType),
33
+ value: TrimmedString_1.default,
34
+ __TYPE__: t.literal(common_1.FieldContentType),
35
+ });
@@ -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,35 @@
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
+ keys: {},
28
+ };
29
+ });
30
+ exports.NumberLegacy = NumberLegacy;
31
+ exports.NumberContent = t.strict({
32
+ type: t.literal(widgets_1.NumberFieldType),
33
+ value: TrimmedString_1.default,
34
+ __TYPE__: t.literal(common_1.FieldContentType),
35
+ });
@@ -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,35 @@
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
+ keys: {},
28
+ };
29
+ });
30
+ exports.RangeLegacy = RangeLegacy;
31
+ exports.RangeContent = t.strict({
32
+ type: t.literal(widgets_1.RangeFieldType),
33
+ value: TrimmedString_1.default,
34
+ __TYPE__: t.literal(common_1.FieldContentType),
35
+ });
@@ -0,0 +1,20 @@
1
+ import * as t from "io-ts";
2
+ import { Select } from "../../../../customtypes/widgets";
3
+ import type { LegacyContentCtx, WithTypes } from "../../../LegacyContentCtx";
4
+ export declare const isSelectContent: (u: unknown) => u is {
5
+ type: "Select";
6
+ value: string;
7
+ __TYPE__: "FieldContent";
8
+ };
9
+ export declare const SelectLegacy: (ctx: LegacyContentCtx) => t.Type<{
10
+ type: "Select";
11
+ value: string;
12
+ __TYPE__: "FieldContent";
13
+ }, WithTypes<string>, unknown>;
14
+ export declare const SelectContent: t.ExactC<t.TypeC<{
15
+ type: t.LiteralC<"Select">;
16
+ value: t.Type<string, string, unknown>;
17
+ __TYPE__: t.LiteralC<"FieldContent">;
18
+ }>>;
19
+ export declare type SelectContent = t.TypeOf<typeof SelectContent>;
20
+ export declare const SelectContentDefaultValue: (field: Select) => SelectContent | undefined;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SelectContentDefaultValue = 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
+ keys: {},
28
+ };
29
+ });
30
+ exports.SelectLegacy = SelectLegacy;
31
+ exports.SelectContent = t.strict({
32
+ type: t.literal(widgets_1.SelectFieldType),
33
+ value: TrimmedString_1.default,
34
+ __TYPE__: t.literal(common_1.FieldContentType),
35
+ });
36
+ const SelectContentDefaultValue = (field) => {
37
+ var _a;
38
+ return ((_a = field.config) === null || _a === void 0 ? void 0 : _a.default_value)
39
+ ? {
40
+ __TYPE__: common_1.FieldContentType,
41
+ type: widgets_1.SelectFieldType,
42
+ value: field.config.default_value || "",
43
+ }
44
+ : undefined;
45
+ };
46
+ exports.SelectContentDefaultValue = SelectContentDefaultValue;
@@ -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,35 @@
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
+ keys: {},
28
+ };
29
+ });
30
+ exports.TextLegacy = TextLegacy;
31
+ exports.TextContent = t.strict({
32
+ type: t.literal(widgets_1.TextFieldType),
33
+ value: TrimmedString_1.default,
34
+ __TYPE__: t.literal(common_1.FieldContentType),
35
+ });
@@ -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>;