@prismicio/types-internal 0.1.0 → 0.1.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 (100) hide show
  1. package/dist/customtypes/CustomType.d.ts +2703 -0
  2. package/dist/customtypes/CustomType.js +141 -0
  3. package/dist/customtypes/Format.d.ts +4 -0
  4. package/dist/customtypes/Format.js +8 -0
  5. package/dist/customtypes/Section.d.ts +4010 -0
  6. package/dist/customtypes/Section.js +40 -0
  7. package/dist/customtypes/index.d.ts +4 -18433
  8. package/dist/customtypes/index.js +30 -864
  9. package/dist/customtypes/widgets/Group.d.ts +172 -0
  10. package/dist/customtypes/widgets/Group.js +45 -0
  11. package/dist/customtypes/widgets/UID.d.ts +14 -0
  12. package/dist/customtypes/widgets/UID.js +42 -0
  13. package/dist/customtypes/widgets/Widget.d.ts +4011 -0
  14. package/dist/customtypes/widgets/Widget.js +51 -0
  15. package/dist/customtypes/widgets/WidgetTypes.d.ts +22 -0
  16. package/dist/customtypes/widgets/WidgetTypes.js +26 -0
  17. package/dist/customtypes/widgets/index.d.ts +7 -11697
  18. package/dist/customtypes/widgets/index.js +34 -734
  19. package/dist/customtypes/widgets/nestable/BooleanField.d.ts +14 -0
  20. package/dist/customtypes/widgets/nestable/BooleanField.js +42 -0
  21. package/dist/customtypes/widgets/nestable/Color.d.ts +13 -0
  22. package/dist/customtypes/widgets/nestable/Color.js +41 -0
  23. package/dist/customtypes/widgets/nestable/Date.d.ts +14 -0
  24. package/dist/customtypes/widgets/nestable/Date.js +42 -0
  25. package/dist/customtypes/widgets/nestable/Embed.d.ts +14 -0
  26. package/dist/customtypes/widgets/nestable/Embed.js +42 -0
  27. package/dist/customtypes/widgets/nestable/GeoPoint.d.ts +12 -0
  28. package/dist/customtypes/widgets/nestable/GeoPoint.js +40 -0
  29. package/dist/customtypes/widgets/nestable/Image.d.ts +23 -0
  30. package/dist/customtypes/widgets/nestable/Image.js +50 -0
  31. package/dist/customtypes/widgets/nestable/IntegrationField.d.ts +14 -0
  32. package/dist/customtypes/widgets/nestable/IntegrationField.js +42 -0
  33. package/dist/customtypes/widgets/nestable/Link.d.ts +19 -0
  34. package/dist/customtypes/widgets/nestable/Link.js +78 -0
  35. package/dist/customtypes/widgets/nestable/NestableWidget.d.ts +160 -0
  36. package/dist/customtypes/widgets/nestable/NestableWidget.js +58 -0
  37. package/dist/customtypes/widgets/nestable/Number.d.ts +16 -0
  38. package/dist/customtypes/widgets/nestable/Number.js +45 -0
  39. package/dist/customtypes/widgets/nestable/Range.d.ts +16 -0
  40. package/dist/customtypes/widgets/nestable/Range.js +45 -0
  41. package/dist/customtypes/widgets/nestable/RichText.d.ts +22 -0
  42. package/dist/customtypes/widgets/nestable/RichText.js +134 -0
  43. package/dist/customtypes/widgets/nestable/Select.d.ts +15 -0
  44. package/dist/customtypes/widgets/nestable/Select.js +45 -0
  45. package/dist/customtypes/widgets/nestable/Separator.d.ts +11 -0
  46. package/dist/customtypes/widgets/nestable/Separator.js +39 -0
  47. package/dist/customtypes/widgets/nestable/Text.d.ts +14 -0
  48. package/dist/customtypes/widgets/nestable/Text.js +42 -0
  49. package/dist/customtypes/widgets/nestable/Timestamp.d.ts +14 -0
  50. package/dist/customtypes/widgets/nestable/Timestamp.js +42 -0
  51. package/dist/customtypes/widgets/nestable/index.d.ts +15 -0
  52. package/dist/customtypes/widgets/nestable/index.js +36 -0
  53. package/dist/customtypes/widgets/shared/ImageConstraint.d.ts +7 -0
  54. package/dist/customtypes/widgets/shared/ImageConstraint.js +48 -0
  55. package/dist/customtypes/widgets/shared/index.d.ts +1 -0
  56. package/dist/customtypes/widgets/shared/index.js +8 -0
  57. package/dist/customtypes/widgets/slices/CompositeSlice.d.ts +329 -0
  58. package/dist/customtypes/widgets/slices/CompositeSlice.js +46 -0
  59. package/dist/customtypes/widgets/slices/LegacySlice.d.ts +336 -0
  60. package/dist/customtypes/widgets/slices/LegacySlice.js +34 -0
  61. package/dist/customtypes/widgets/slices/SharedSlice.d.ts +335 -0
  62. package/dist/customtypes/widgets/slices/SharedSlice.js +56 -0
  63. package/dist/customtypes/widgets/slices/SharedSliceRef.d.ts +7 -0
  64. package/dist/customtypes/widgets/slices/SharedSliceRef.js +30 -0
  65. package/dist/customtypes/widgets/slices/Slice.d.ts +6 -0
  66. package/dist/customtypes/widgets/slices/Slice.js +2 -0
  67. package/dist/customtypes/widgets/slices/Slices.d.ts +6009 -0
  68. package/dist/customtypes/widgets/slices/Slices.js +106 -0
  69. package/dist/customtypes/widgets/slices/SlicesTypes.d.ts +5 -0
  70. package/dist/customtypes/widgets/slices/SlicesTypes.js +8 -0
  71. package/dist/customtypes/widgets/slices/index.d.ts +7 -7079
  72. package/dist/customtypes/widgets/slices/index.js +36 -670
  73. package/dist/index.d.ts +1 -18455
  74. package/dist/index.js +23 -844
  75. package/dist/index.js.map +1 -1
  76. package/dist/validators/IntFromNumber.d.ts +7 -0
  77. package/dist/validators/IntFromNumber.js +35 -0
  78. package/dist/validators/IntFromPixels.d.ts +7 -0
  79. package/dist/validators/IntFromPixels.js +43 -0
  80. package/dist/validators/StringFromBoolean.d.ts +7 -0
  81. package/dist/validators/StringFromBoolean.js +31 -0
  82. package/dist/validators/StringFromNumber.d.ts +7 -0
  83. package/dist/validators/StringFromNumber.js +31 -0
  84. package/dist/validators/StringOrNull.d.ts +2 -0
  85. package/dist/validators/StringOrNull.js +24 -0
  86. package/package.json +4 -24
  87. package/dist/customtypes/index.cjs +0 -864
  88. package/dist/customtypes/index.cjs.map +0 -1
  89. package/dist/customtypes/index.d.ts.map +0 -1
  90. package/dist/customtypes/index.js.map +0 -1
  91. package/dist/customtypes/widgets/index.cjs +0 -735
  92. package/dist/customtypes/widgets/index.cjs.map +0 -1
  93. package/dist/customtypes/widgets/index.d.ts.map +0 -1
  94. package/dist/customtypes/widgets/index.js.map +0 -1
  95. package/dist/customtypes/widgets/slices/index.cjs +0 -671
  96. package/dist/customtypes/widgets/slices/index.cjs.map +0 -1
  97. package/dist/customtypes/widgets/slices/index.d.ts.map +0 -1
  98. package/dist/customtypes/widgets/slices/index.js.map +0 -1
  99. package/dist/index.cjs +0 -870
  100. package/dist/index.cjs.map +0 -1
@@ -0,0 +1,14 @@
1
+ import * as t from 'io-ts';
2
+ import WidgetTypes from '../WidgetTypes';
3
+ declare const BooleanField: t.ExactC<t.IntersectionC<[t.TypeC<{
4
+ type: t.LiteralC<WidgetTypes.BooleanField>;
5
+ }>, t.PartialC<{
6
+ config: t.ExactC<t.PartialC<{
7
+ label: t.UnionC<[t.StringC, t.NullC, t.UndefinedC]>;
8
+ default_value: t.BooleanC;
9
+ placeholder_true: t.StringC;
10
+ placeholder_false: t.StringC;
11
+ }>>;
12
+ }>]>>;
13
+ declare type BooleanField = t.TypeOf<typeof BooleanField>;
14
+ export default BooleanField;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ const t = __importStar(require("io-ts"));
26
+ const StringOrNull_1 = require("../../../validators/StringOrNull");
27
+ const WidgetTypes_1 = __importDefault(require("../WidgetTypes"));
28
+ const BooleanConfig = t.exact(t.partial({
29
+ label: StringOrNull_1.StringOrNull,
30
+ default_value: t.boolean,
31
+ placeholder_true: t.string,
32
+ placeholder_false: t.string
33
+ }));
34
+ const BooleanField = t.exact(t.intersection([
35
+ t.type({
36
+ type: t.literal(WidgetTypes_1.default.BooleanField)
37
+ }),
38
+ t.partial({
39
+ config: BooleanConfig
40
+ })
41
+ ]));
42
+ exports.default = BooleanField;
@@ -0,0 +1,13 @@
1
+ import * as t from 'io-ts';
2
+ import WidgetTypes from '../WidgetTypes';
3
+ declare const Color: t.ExactC<t.IntersectionC<[t.TypeC<{
4
+ type: t.LiteralC<WidgetTypes.Color>;
5
+ }>, t.PartialC<{
6
+ fieldset: t.UnionC<[t.StringC, t.NullC, t.UndefinedC]>;
7
+ config: t.ExactC<t.PartialC<{
8
+ label: t.UnionC<[t.StringC, t.NullC, t.UndefinedC]>;
9
+ placeholder: t.StringC;
10
+ }>>;
11
+ }>]>>;
12
+ declare type Color = t.TypeOf<typeof Color>;
13
+ export default Color;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ const t = __importStar(require("io-ts"));
26
+ const StringOrNull_1 = require("../../../validators/StringOrNull");
27
+ const WidgetTypes_1 = __importDefault(require("../WidgetTypes"));
28
+ const ColorConfig = t.exact(t.partial({
29
+ label: StringOrNull_1.StringOrNull,
30
+ placeholder: t.string,
31
+ }));
32
+ const Color = t.exact(t.intersection([
33
+ t.type({
34
+ type: t.literal(WidgetTypes_1.default.Color)
35
+ }),
36
+ t.partial({
37
+ fieldset: StringOrNull_1.StringOrNull,
38
+ config: ColorConfig
39
+ })
40
+ ]));
41
+ exports.default = Color;
@@ -0,0 +1,14 @@
1
+ import * as t from 'io-ts';
2
+ import WidgetTypes from '../WidgetTypes';
3
+ declare const Date: t.ExactC<t.IntersectionC<[t.TypeC<{
4
+ type: t.LiteralC<WidgetTypes.Date>;
5
+ }>, t.PartialC<{
6
+ fieldset: t.UnionC<[t.StringC, t.NullC, t.UndefinedC]>;
7
+ config: t.ExactC<t.PartialC<{
8
+ label: t.UnionC<[t.StringC, t.NullC, t.UndefinedC]>;
9
+ placeholder: t.StringC;
10
+ default: t.StringC;
11
+ }>>;
12
+ }>]>>;
13
+ declare type Date = t.TypeOf<typeof Date>;
14
+ export default Date;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ const t = __importStar(require("io-ts"));
26
+ const StringOrNull_1 = require("../../../validators/StringOrNull");
27
+ const WidgetTypes_1 = __importDefault(require("../WidgetTypes"));
28
+ const DateConfig = t.exact(t.partial({
29
+ label: StringOrNull_1.StringOrNull,
30
+ placeholder: t.string,
31
+ default: t.string
32
+ }));
33
+ const Date = t.exact(t.intersection([
34
+ t.type({
35
+ type: t.literal(WidgetTypes_1.default.Date)
36
+ }),
37
+ t.partial({
38
+ fieldset: StringOrNull_1.StringOrNull,
39
+ config: DateConfig
40
+ })
41
+ ]));
42
+ exports.default = Date;
@@ -0,0 +1,14 @@
1
+ import * as t from 'io-ts';
2
+ import WidgetTypes from '../WidgetTypes';
3
+ declare const Embed: t.ExactC<t.IntersectionC<[t.TypeC<{
4
+ type: t.LiteralC<WidgetTypes.Embed>;
5
+ }>, t.PartialC<{
6
+ fieldset: t.UnionC<[t.StringC, t.NullC, t.UndefinedC]>;
7
+ config: t.ExactC<t.PartialC<{
8
+ label: t.UnionC<[t.StringC, t.NullC, t.UndefinedC]>;
9
+ placeholder: t.StringC;
10
+ useAsTitle: t.BooleanC;
11
+ }>>;
12
+ }>]>>;
13
+ declare type Embed = t.TypeOf<typeof Embed>;
14
+ export default Embed;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ const t = __importStar(require("io-ts"));
26
+ const StringOrNull_1 = require("../../../validators/StringOrNull");
27
+ const WidgetTypes_1 = __importDefault(require("../WidgetTypes"));
28
+ const EmbedConfig = t.exact(t.partial({
29
+ label: StringOrNull_1.StringOrNull,
30
+ placeholder: t.string,
31
+ useAsTitle: t.boolean
32
+ }));
33
+ const Embed = t.exact(t.intersection([
34
+ t.type({
35
+ type: t.literal(WidgetTypes_1.default.Embed)
36
+ }),
37
+ t.partial({
38
+ fieldset: StringOrNull_1.StringOrNull,
39
+ config: EmbedConfig
40
+ })
41
+ ]));
42
+ exports.default = Embed;
@@ -0,0 +1,12 @@
1
+ import * as t from 'io-ts';
2
+ import WidgetTypes from '../WidgetTypes';
3
+ declare const GeoPoint: t.ExactC<t.IntersectionC<[t.TypeC<{
4
+ type: t.LiteralC<WidgetTypes.GeoPoint>;
5
+ }>, t.PartialC<{
6
+ fieldset: t.UnionC<[t.StringC, t.NullC, t.UndefinedC]>;
7
+ config: t.ExactC<t.PartialC<{
8
+ label: t.UnionC<[t.StringC, t.NullC, t.UndefinedC]>;
9
+ }>>;
10
+ }>]>>;
11
+ declare type GeoPoint = t.TypeOf<typeof GeoPoint>;
12
+ export default GeoPoint;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ const t = __importStar(require("io-ts"));
26
+ const StringOrNull_1 = require("../../../validators/StringOrNull");
27
+ const WidgetTypes_1 = __importDefault(require("../WidgetTypes"));
28
+ const GeoPointConfig = t.exact(t.partial({
29
+ label: StringOrNull_1.StringOrNull
30
+ }));
31
+ const GeoPoint = t.exact(t.intersection([
32
+ t.type({
33
+ type: t.literal(WidgetTypes_1.default.GeoPoint)
34
+ }),
35
+ t.partial({
36
+ fieldset: StringOrNull_1.StringOrNull,
37
+ config: GeoPointConfig
38
+ })
39
+ ]));
40
+ exports.default = GeoPoint;
@@ -0,0 +1,23 @@
1
+ import * as t from 'io-ts';
2
+ import WidgetTypes from '../WidgetTypes';
3
+ declare const Image: t.ExactC<t.IntersectionC<[t.TypeC<{
4
+ type: t.LiteralC<WidgetTypes.Image>;
5
+ }>, t.PartialC<{
6
+ fieldset: t.UnionC<[t.StringC, t.NullC, t.UndefinedC]>;
7
+ config: t.ExactC<t.PartialC<{
8
+ label: t.UnionC<[t.StringC, t.NullC, t.UndefinedC]>;
9
+ placeholder: t.StringC;
10
+ constraint: t.PartialC<{
11
+ width: t.Type<number | null, any, unknown>;
12
+ height: t.Type<number | null, any, unknown>;
13
+ }>;
14
+ thumbnails: t.ArrayC<t.ExactC<t.IntersectionC<[t.TypeC<{
15
+ name: t.StringC;
16
+ }>, t.PartialC<{
17
+ width: t.Type<number | null, any, unknown>;
18
+ height: t.Type<number | null, any, unknown>;
19
+ }>]>>>;
20
+ }>>;
21
+ }>]>>;
22
+ declare type Image = t.TypeOf<typeof Image>;
23
+ export default Image;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ const t = __importStar(require("io-ts"));
26
+ const StringOrNull_1 = require("../../../validators/StringOrNull");
27
+ const WidgetTypes_1 = __importDefault(require("../WidgetTypes"));
28
+ const ImageConstraint_1 = __importDefault(require("../shared/ImageConstraint"));
29
+ const Thumbnail = t.exact(t.intersection([
30
+ t.type({
31
+ name: t.string
32
+ }),
33
+ ImageConstraint_1.default
34
+ ]));
35
+ const ImageConfig = t.exact(t.partial({
36
+ label: StringOrNull_1.StringOrNull,
37
+ placeholder: t.string,
38
+ constraint: ImageConstraint_1.default,
39
+ thumbnails: t.array(Thumbnail)
40
+ }));
41
+ const Image = t.exact(t.intersection([
42
+ t.type({
43
+ type: t.literal(WidgetTypes_1.default.Image)
44
+ }),
45
+ t.partial({
46
+ fieldset: StringOrNull_1.StringOrNull,
47
+ config: ImageConfig
48
+ })
49
+ ]));
50
+ exports.default = Image;
@@ -0,0 +1,14 @@
1
+ import * as t from 'io-ts';
2
+ import WidgetTypes from '../WidgetTypes';
3
+ declare const IntegrationField: t.ExactC<t.IntersectionC<[t.TypeC<{
4
+ type: t.LiteralC<WidgetTypes.IntegrationField>;
5
+ }>, t.PartialC<{
6
+ fieldset: t.UnionC<[t.StringC, t.NullC, t.UndefinedC]>;
7
+ config: t.ExactC<t.PartialC<{
8
+ label: t.UnionC<[t.StringC, t.NullC, t.UndefinedC]>;
9
+ placeholder: t.StringC;
10
+ catalog: t.StringC;
11
+ }>>;
12
+ }>]>>;
13
+ declare type IntegrationField = t.TypeOf<typeof IntegrationField>;
14
+ export default IntegrationField;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ const t = __importStar(require("io-ts"));
26
+ const StringOrNull_1 = require("../../../validators/StringOrNull");
27
+ const WidgetTypes_1 = __importDefault(require("../WidgetTypes"));
28
+ const IntegrationFieldConfig = t.exact(t.partial({
29
+ label: StringOrNull_1.StringOrNull,
30
+ placeholder: t.string,
31
+ catalog: t.string
32
+ }));
33
+ const IntegrationField = t.exact(t.intersection([
34
+ t.type({
35
+ type: t.literal(WidgetTypes_1.default.IntegrationField)
36
+ }),
37
+ t.partial({
38
+ fieldset: StringOrNull_1.StringOrNull,
39
+ config: IntegrationFieldConfig
40
+ })
41
+ ]));
42
+ exports.default = IntegrationField;
@@ -0,0 +1,19 @@
1
+ import * as t from 'io-ts';
2
+ import WidgetTypes from '../WidgetTypes';
3
+ declare const Link: t.ExactC<t.IntersectionC<[t.TypeC<{
4
+ type: t.LiteralC<WidgetTypes.Link>;
5
+ }>, t.PartialC<{
6
+ fieldset: t.UnionC<[t.StringC, t.NullC, t.UndefinedC]>;
7
+ config: t.ExactC<t.PartialC<{
8
+ label: t.UnionC<[t.StringC, t.NullC, t.UndefinedC]>;
9
+ useAsTitle: t.BooleanC;
10
+ placeholder: t.StringC;
11
+ select: t.UnionC<[t.LiteralC<"media">, t.LiteralC<"document">, t.LiteralC<"web">, t.NullC]>;
12
+ customtypes: t.ArrayC<t.StringC>;
13
+ masks: t.Type<string[], object, unknown>;
14
+ tags: t.Type<string[], object, unknown>;
15
+ allowTargetBlank: t.BooleanC;
16
+ }>>;
17
+ }>]>>;
18
+ declare type Link = t.TypeOf<typeof Link>;
19
+ export default Link;
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ const t = __importStar(require("io-ts"));
26
+ const withFallback_1 = require("io-ts-types/lib/withFallback");
27
+ const Either_1 = require("fp-ts/lib/Either");
28
+ const StringOrNull_1 = require("../../../validators/StringOrNull");
29
+ const WidgetTypes_1 = __importDefault(require("../WidgetTypes"));
30
+ const arrayString = (entries) => {
31
+ if (entries instanceof Array) {
32
+ const isValidEntries = entries.reduce((acc, l) => acc && typeof l === 'string', true);
33
+ if (isValidEntries)
34
+ return t.success(entries);
35
+ }
36
+ };
37
+ const plainString = (entries) => {
38
+ if (typeof entries === 'string') {
39
+ return t.success([entries]);
40
+ }
41
+ };
42
+ const MasksArrayString = new t.Type('MasksArrayString', (u) => {
43
+ return u instanceof Array;
44
+ }, (u, context) => {
45
+ return Either_1.either.chain(t.union([
46
+ t.array(t.string),
47
+ t.string,
48
+ ]).validate(u, context), (masks) => {
49
+ return (arrayString(masks) ||
50
+ plainString(masks) ||
51
+ t.failure(u, context));
52
+ });
53
+ }, res => res);
54
+ const LinkConfig = t.exact(t.partial({
55
+ label: StringOrNull_1.StringOrNull,
56
+ useAsTitle: t.boolean,
57
+ placeholder: t.string,
58
+ select: (0, withFallback_1.withFallback)(t.union([
59
+ t.literal('media'),
60
+ t.literal('document'),
61
+ t.literal('web'),
62
+ t.null
63
+ ]), null),
64
+ customtypes: t.array(t.string),
65
+ masks: MasksArrayString,
66
+ tags: MasksArrayString,
67
+ allowTargetBlank: t.boolean
68
+ }));
69
+ const Link = t.exact(t.intersection([
70
+ t.type({
71
+ type: t.literal(WidgetTypes_1.default.Link)
72
+ }),
73
+ t.partial({
74
+ fieldset: StringOrNull_1.StringOrNull,
75
+ config: LinkConfig
76
+ })
77
+ ]));
78
+ exports.default = Link;