@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.
- package/lib/content/fields/RepeatableContent.d.ts +51 -123
- package/lib/content/fields/RepeatableContent.js +10 -14
- package/lib/content/fields/nestable/RichTextContent/Block.d.ts +1036 -0
- package/lib/content/fields/nestable/RichTextContent/Block.js +31 -0
- package/lib/content/fields/nestable/RichTextContent/EmbedBlock.d.ts +60 -0
- package/lib/content/fields/nestable/RichTextContent/EmbedBlock.js +53 -0
- package/lib/content/fields/nestable/RichTextContent/ImageBlock.d.ts +203 -0
- package/lib/content/fields/nestable/RichTextContent/ImageBlock.js +36 -0
- package/lib/content/fields/nestable/RichTextContent/TableBlock.d.ts +500 -0
- package/lib/content/fields/nestable/RichTextContent/TableBlock.js +21 -0
- package/lib/content/fields/nestable/RichTextContent/TextBlock.d.ts +590 -0
- package/lib/content/fields/nestable/RichTextContent/TextBlock.js +80 -0
- package/lib/scripts/release.d.ts +1 -0
- package/lib/scripts/release.js +34 -0
- package/lib/src/_internal/utils.d.ts +36 -0
- package/lib/src/_internal/utils.js +20 -0
- package/lib/src/common/Asset.d.ts +16 -0
- package/lib/src/common/Asset.js +11 -0
- package/lib/src/common/Embed.d.ts +15 -0
- package/lib/src/common/Embed.js +10 -0
- package/lib/src/common/HexaColorCode.d.ts +4 -0
- package/lib/src/common/HexaColorCode.js +7 -0
- package/lib/src/common/UUID.d.ts +6 -0
- package/lib/src/common/UUID.js +8 -0
- package/lib/src/common/WidgetKey.d.ts +3 -0
- package/lib/src/common/WidgetKey.js +8 -0
- package/lib/src/common/index.d.ts +3 -0
- package/lib/src/common/index.js +6 -0
- package/lib/src/content/Document.d.ts +11803 -0
- package/lib/src/content/Document.js +266 -0
- package/lib/src/content/LegacyContentCtx.d.ts +64 -0
- package/lib/src/content/LegacyContentCtx.js +130 -0
- package/lib/src/content/fields/EmptyContent.d.ts +16 -0
- package/lib/src/content/fields/EmptyContent.js +30 -0
- package/lib/src/content/fields/GroupContent.d.ts +42 -0
- package/lib/src/content/fields/GroupContent.js +208 -0
- package/lib/src/content/fields/UIDContent.d.ts +16 -0
- package/lib/src/content/fields/UIDContent.js +25 -0
- package/lib/src/content/fields/WidgetContent.d.ts +11749 -0
- package/lib/src/content/fields/WidgetContent.js +57 -0
- package/lib/src/content/fields/index.d.ts +6 -0
- package/lib/src/content/fields/index.js +9 -0
- package/lib/src/content/fields/nestable/BooleanContent.d.ts +18 -0
- package/lib/src/content/fields/nestable/BooleanContent.js +35 -0
- package/lib/src/content/fields/nestable/EmbedContent.d.ts +78 -0
- package/lib/src/content/fields/nestable/EmbedContent.js +56 -0
- package/lib/src/content/fields/nestable/FieldContent/ColorContent.d.ts +18 -0
- package/lib/src/content/fields/nestable/FieldContent/ColorContent.js +35 -0
- package/lib/src/content/fields/nestable/FieldContent/DateContent.d.ts +18 -0
- package/lib/src/content/fields/nestable/FieldContent/DateContent.js +35 -0
- package/lib/src/content/fields/nestable/FieldContent/NumberContent.d.ts +18 -0
- package/lib/src/content/fields/nestable/FieldContent/NumberContent.js +35 -0
- package/lib/src/content/fields/nestable/FieldContent/RangeContent.d.ts +18 -0
- package/lib/src/content/fields/nestable/FieldContent/RangeContent.js +35 -0
- package/lib/src/content/fields/nestable/FieldContent/SelectContent.d.ts +20 -0
- package/lib/src/content/fields/nestable/FieldContent/SelectContent.js +46 -0
- package/lib/src/content/fields/nestable/FieldContent/TextContent.d.ts +18 -0
- package/lib/src/content/fields/nestable/FieldContent/TextContent.js +35 -0
- package/lib/src/content/fields/nestable/FieldContent/TimestampContent.d.ts +18 -0
- package/lib/src/content/fields/nestable/FieldContent/TimestampContent.js +35 -0
- package/lib/src/content/fields/nestable/FieldContent/common.d.ts +1 -0
- package/lib/src/content/fields/nestable/FieldContent/common.js +4 -0
- package/lib/src/content/fields/nestable/FieldContent/index.d.ts +49 -0
- package/lib/src/content/fields/nestable/FieldContent/index.js +38 -0
- package/lib/src/content/fields/nestable/GeoPointContent.d.ts +33 -0
- package/lib/src/content/fields/nestable/GeoPointContent.js +31 -0
- package/lib/src/content/fields/nestable/ImageContent.d.ts +227 -0
- package/lib/src/content/fields/nestable/ImageContent.js +73 -0
- package/lib/src/content/fields/nestable/IntegrationFieldContent.d.ts +16 -0
- package/lib/src/content/fields/nestable/IntegrationFieldContent.js +28 -0
- package/lib/src/content/fields/nestable/LinkContent.d.ts +919 -0
- package/lib/src/content/fields/nestable/LinkContent.js +399 -0
- package/lib/src/content/fields/nestable/NestableContent.d.ts +1953 -0
- package/lib/src/content/fields/nestable/NestableContent.js +167 -0
- package/lib/src/content/fields/nestable/RepeatableContent.d.ts +176 -0
- package/lib/src/content/fields/nestable/RepeatableContent.js +104 -0
- package/lib/src/content/fields/nestable/RichTextContent/Blocks.d.ts +1261 -0
- package/lib/src/content/fields/nestable/RichTextContent/Blocks.js +170 -0
- package/lib/src/content/fields/nestable/RichTextContent/index.d.ts +1004 -0
- package/lib/src/content/fields/nestable/RichTextContent/index.js +28 -0
- package/lib/src/content/fields/nestable/SeparatorContent.d.ts +13 -0
- package/lib/src/content/fields/nestable/SeparatorContent.js +22 -0
- package/lib/src/content/fields/nestable/TableContent.d.ts +770 -0
- package/lib/src/content/fields/nestable/TableContent.js +121 -0
- package/lib/src/content/fields/nestable/index.d.ts +12 -0
- package/lib/src/content/fields/nestable/index.js +15 -0
- package/lib/src/content/fields/slices/Slice/CompositeSliceContent.d.ts +3934 -0
- package/lib/src/content/fields/slices/Slice/CompositeSliceContent.js +195 -0
- package/lib/src/content/fields/slices/Slice/RepeatableContent.d.ts +774 -0
- package/lib/src/content/fields/slices/Slice/RepeatableContent.js +21 -0
- package/lib/src/content/fields/slices/Slice/SharedSliceContent.d.ts +3937 -0
- package/lib/src/content/fields/slices/Slice/SharedSliceContent.js +215 -0
- package/lib/src/content/fields/slices/Slice/SimpleSliceContent.d.ts +1962 -0
- package/lib/src/content/fields/slices/Slice/SimpleSliceContent.js +130 -0
- package/lib/src/content/fields/slices/Slice/SlicePrimaryContent.d.ts +1952 -0
- package/lib/src/content/fields/slices/Slice/SlicePrimaryContent.js +30 -0
- package/lib/src/content/fields/slices/Slice/index.d.ts +6810 -0
- package/lib/src/content/fields/slices/Slice/index.js +45 -0
- package/lib/src/content/fields/slices/SliceItem.d.ts +6846 -0
- package/lib/src/content/fields/slices/SliceItem.js +116 -0
- package/lib/src/content/fields/slices/SlicesContent.d.ts +9809 -0
- package/lib/src/content/fields/slices/SlicesContent.js +187 -0
- package/lib/src/content/fields/slices/index.d.ts +3 -0
- package/lib/src/content/fields/slices/index.js +6 -0
- package/lib/src/content/fields/withDefaultValues.d.ts +9 -0
- package/lib/src/content/fields/withDefaultValues.js +79 -0
- package/lib/src/content/index.d.ts +3 -0
- package/lib/src/content/index.js +6 -0
- package/lib/src/content/utils.d.ts +14 -0
- package/lib/src/content/utils.js +33 -0
- package/lib/src/customtypes/CustomType.d.ts +3680 -0
- package/lib/src/customtypes/CustomType.js +184 -0
- package/lib/src/customtypes/Section.d.ts +3635 -0
- package/lib/src/customtypes/Section.js +66 -0
- package/lib/src/customtypes/diff/Changes.d.ts +17 -0
- package/lib/src/customtypes/diff/Changes.js +9 -0
- package/lib/src/customtypes/diff/SharedSlice.d.ts +1624 -0
- package/lib/src/customtypes/diff/SharedSlice.js +55 -0
- package/lib/src/customtypes/diff/Variation.d.ts +1605 -0
- package/lib/src/customtypes/diff/Variation.js +113 -0
- package/lib/src/customtypes/diff/Widgets.d.ts +11 -0
- package/lib/src/customtypes/diff/Widgets.js +2 -0
- package/lib/src/customtypes/diff/index.d.ts +4 -0
- package/lib/src/customtypes/diff/index.js +7 -0
- package/lib/src/customtypes/index.d.ts +4 -0
- package/lib/src/customtypes/index.js +7 -0
- package/lib/src/customtypes/widgets/Group.d.ts +1352 -0
- package/lib/src/customtypes/widgets/Group.js +92 -0
- package/lib/src/customtypes/widgets/UID.d.ts +19 -0
- package/lib/src/customtypes/widgets/UID.js +21 -0
- package/lib/src/customtypes/widgets/Widget.d.ts +4457 -0
- package/lib/src/customtypes/widgets/Widget.js +49 -0
- package/lib/src/customtypes/widgets/index.d.ts +6 -0
- package/lib/src/customtypes/widgets/index.js +9 -0
- package/lib/src/customtypes/widgets/nestable/BooleanField.d.ts +20 -0
- package/lib/src/customtypes/widgets/nestable/BooleanField.js +21 -0
- package/lib/src/customtypes/widgets/nestable/Color.d.ts +17 -0
- package/lib/src/customtypes/widgets/nestable/Color.js +20 -0
- package/lib/src/customtypes/widgets/nestable/Date.d.ts +19 -0
- package/lib/src/customtypes/widgets/nestable/Date.js +21 -0
- package/lib/src/customtypes/widgets/nestable/Embed.d.ts +19 -0
- package/lib/src/customtypes/widgets/nestable/Embed.js +21 -0
- package/lib/src/customtypes/widgets/nestable/GeoPoint.d.ts +15 -0
- package/lib/src/customtypes/widgets/nestable/GeoPoint.js +19 -0
- package/lib/src/customtypes/widgets/nestable/Image.d.ts +44 -0
- package/lib/src/customtypes/widgets/nestable/Image.js +29 -0
- package/lib/src/customtypes/widgets/nestable/IntegrationField.d.ts +19 -0
- package/lib/src/customtypes/widgets/nestable/IntegrationField.js +21 -0
- package/lib/src/customtypes/widgets/nestable/Link.d.ts +196 -0
- package/lib/src/customtypes/widgets/nestable/Link.js +167 -0
- package/lib/src/customtypes/widgets/nestable/NestableWidget.d.ts +217 -0
- package/lib/src/customtypes/widgets/nestable/NestableWidget.js +39 -0
- package/lib/src/customtypes/widgets/nestable/Number.d.ts +23 -0
- package/lib/src/customtypes/widgets/nestable/Number.js +24 -0
- package/lib/src/customtypes/widgets/nestable/Range.d.ts +23 -0
- package/lib/src/customtypes/widgets/nestable/Range.js +24 -0
- package/lib/src/customtypes/widgets/nestable/RichText.d.ts +73 -0
- package/lib/src/customtypes/widgets/nestable/RichText.js +131 -0
- package/lib/src/customtypes/widgets/nestable/Select.d.ts +21 -0
- package/lib/src/customtypes/widgets/nestable/Select.js +22 -0
- package/lib/src/customtypes/widgets/nestable/Separator.d.ts +14 -0
- package/lib/src/customtypes/widgets/nestable/Separator.js +18 -0
- package/lib/src/customtypes/widgets/nestable/Table.d.ts +21 -0
- package/lib/src/customtypes/widgets/nestable/Table.js +30 -0
- package/lib/src/customtypes/widgets/nestable/Text.d.ts +19 -0
- package/lib/src/customtypes/widgets/nestable/Text.js +21 -0
- package/lib/src/customtypes/widgets/nestable/Timestamp.d.ts +19 -0
- package/lib/src/customtypes/widgets/nestable/Timestamp.js +21 -0
- package/lib/src/customtypes/widgets/nestable/index.d.ts +17 -0
- package/lib/src/customtypes/widgets/nestable/index.js +20 -0
- package/lib/src/customtypes/widgets/shared/ImageConstraint.d.ts +7 -0
- package/lib/src/customtypes/widgets/shared/ImageConstraint.js +31 -0
- package/lib/src/customtypes/widgets/shared/index.d.ts +1 -0
- package/lib/src/customtypes/widgets/shared/index.js +8 -0
- package/lib/src/customtypes/widgets/slices/CompositeSlice.d.ts +455 -0
- package/lib/src/customtypes/widgets/slices/CompositeSlice.js +63 -0
- package/lib/src/customtypes/widgets/slices/LegacySlice.d.ts +442 -0
- package/lib/src/customtypes/widgets/slices/LegacySlice.js +12 -0
- package/lib/src/customtypes/widgets/slices/SharedSlice.d.ts +1807 -0
- package/lib/src/customtypes/widgets/slices/SharedSlice.js +118 -0
- package/lib/src/customtypes/widgets/slices/SharedSliceRef.d.ts +5 -0
- package/lib/src/customtypes/widgets/slices/SharedSliceRef.js +9 -0
- package/lib/src/customtypes/widgets/slices/Slice.d.ts +6 -0
- package/lib/src/customtypes/widgets/slices/Slice.js +2 -0
- package/lib/src/customtypes/widgets/slices/SlicePrimaryWidget.d.ts +1259 -0
- package/lib/src/customtypes/widgets/slices/SlicePrimaryWidget.js +10 -0
- package/lib/src/customtypes/widgets/slices/Slices.d.ts +5917 -0
- package/lib/src/customtypes/widgets/slices/Slices.js +146 -0
- package/lib/src/customtypes/widgets/slices/SlicesTypes.d.ts +6 -0
- package/lib/src/customtypes/widgets/slices/SlicesTypes.js +11 -0
- package/lib/src/customtypes/widgets/slices/index.d.ts +8 -0
- package/lib/src/customtypes/widgets/slices/index.js +11 -0
- package/lib/src/utils/Arrays.d.ts +1 -0
- package/lib/src/utils/Arrays.js +13 -0
- package/lib/src/utils/DocumentId.d.ts +2 -0
- package/lib/src/utils/DocumentId.js +7 -0
- package/lib/src/utils/Objects.d.ts +8 -0
- package/lib/src/utils/Objects.js +42 -0
- package/lib/src/utils/index.d.ts +3 -0
- package/lib/src/utils/index.js +7 -0
- package/lib/src/validators/BasicTypes.d.ts +10 -0
- package/lib/src/validators/BasicTypes.js +25 -0
- package/lib/src/validators/DateFromString.d.ts +3 -0
- package/lib/src/validators/DateFromString.js +11 -0
- package/lib/src/validators/DateFromStringOrNumber.d.ts +3 -0
- package/lib/src/validators/DateFromStringOrNumber.js +10 -0
- package/lib/src/validators/DateFromTsMs.d.ts +3 -0
- package/lib/src/validators/DateFromTsMs.js +10 -0
- package/lib/src/validators/DefaultOrElse.d.ts +5 -0
- package/lib/src/validators/DefaultOrElse.js +21 -0
- package/lib/src/validators/IntFromNumber.d.ts +5 -0
- package/lib/src/validators/IntFromNumber.js +14 -0
- package/lib/src/validators/IntFromPixels.d.ts +8 -0
- package/lib/src/validators/IntFromPixels.js +24 -0
- package/lib/src/validators/NonEmptyString.d.ts +3 -0
- package/lib/src/validators/NonEmptyString.js +6 -0
- package/lib/src/validators/NonEmptyStringOrNull.d.ts +3 -0
- package/lib/src/validators/NonEmptyStringOrNull.js +15 -0
- package/lib/src/validators/NumberOrNull.d.ts +3 -0
- package/lib/src/validators/NumberOrNull.js +6 -0
- package/lib/src/validators/NumberRange.d.ts +32 -0
- package/lib/src/validators/NumberRange.js +40 -0
- package/lib/src/validators/StringFromBoolean.d.ts +5 -0
- package/lib/src/validators/StringFromBoolean.js +10 -0
- package/lib/src/validators/StringFromNumber.d.ts +5 -0
- package/lib/src/validators/StringFromNumber.js +10 -0
- package/lib/src/validators/StringOrNull.d.ts +3 -0
- package/lib/src/validators/StringOrNull.js +6 -0
- package/lib/src/validators/TrimmedString.d.ts +5 -0
- package/lib/src/validators/TrimmedString.js +23 -0
- package/lib/src/validators/function.d.ts +34 -0
- package/lib/src/validators/function.js +100 -0
- package/lib/src/validators/index.d.ts +15 -0
- package/lib/src/validators/index.js +31 -0
- package/package.json +1 -1
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Link = exports.LinkConfig = exports.LinkFieldType = exports.CustomTypes = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const Either_1 = require("fp-ts/lib/Either");
|
|
6
|
+
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
7
|
+
const withFallback_1 = require("io-ts-types/lib/withFallback");
|
|
8
|
+
const validators_1 = require("../../../validators");
|
|
9
|
+
const arrayString = (entries) => {
|
|
10
|
+
if (entries instanceof Array) {
|
|
11
|
+
const isValidEntries = entries.reduce((acc, l) => acc && typeof l === "string", true);
|
|
12
|
+
if (isValidEntries)
|
|
13
|
+
return t.success(entries);
|
|
14
|
+
}
|
|
15
|
+
return;
|
|
16
|
+
};
|
|
17
|
+
const plainString = (entries) => {
|
|
18
|
+
if (typeof entries === "string") {
|
|
19
|
+
return t.success([entries]);
|
|
20
|
+
}
|
|
21
|
+
return;
|
|
22
|
+
};
|
|
23
|
+
const MasksArrayString = new t.Type("MasksArrayString", (u) => {
|
|
24
|
+
return u instanceof Array;
|
|
25
|
+
}, (u, context) => {
|
|
26
|
+
return Either_1.either.chain(t.union([t.array(t.string), t.string]).validate(u, context), (masks) => {
|
|
27
|
+
return arrayString(masks) || plainString(masks) || t.failure(u, context);
|
|
28
|
+
});
|
|
29
|
+
}, (res) => res);
|
|
30
|
+
// Field selection in content relationship fields doesn't support nested groups.
|
|
31
|
+
const CustomTypeLevel2FieldGroupFields = new t.Type("CustomTypeLevel2FieldGroupFields", (u) => Array.isArray(u) && u.every((item) => typeof item === "string"), (u, context) => Either_1.either.chain(t.array(t.string).validate(u, context), (fields) => {
|
|
32
|
+
// duplicates not allowed
|
|
33
|
+
const filtered = new Set(fields);
|
|
34
|
+
return filtered.size === fields.length
|
|
35
|
+
? t.success(fields)
|
|
36
|
+
: t.failure(u, context, "Fields have duplicates.");
|
|
37
|
+
}), (a) => a);
|
|
38
|
+
const CustomTypeLevel2Field = t.union([
|
|
39
|
+
t.strict({
|
|
40
|
+
id: t.string,
|
|
41
|
+
fields: CustomTypeLevel2FieldGroupFields,
|
|
42
|
+
}),
|
|
43
|
+
t.string,
|
|
44
|
+
]);
|
|
45
|
+
const CustomTypeLevel2Fields = new t.Type("CustomTypeLevel2Fields", (u) => Array.isArray(u) && u.every((item) => CustomTypeLevel2Field.is(item)), (u, context) => Either_1.either.chain(t.array(CustomTypeLevel2Field).validate(u, context), (fields) => {
|
|
46
|
+
// duplicates not allowed
|
|
47
|
+
const filtered = new Set(fields.map((field) => (typeof field === "string" ? field : field.id)));
|
|
48
|
+
return filtered.size === fields.length
|
|
49
|
+
? t.success(fields)
|
|
50
|
+
: t.failure(u, context, "Fields have duplicates.");
|
|
51
|
+
}), (a) => a);
|
|
52
|
+
const CustomTypeLevel2 = t.union([
|
|
53
|
+
t.string,
|
|
54
|
+
t.strict({
|
|
55
|
+
id: t.string,
|
|
56
|
+
fields: CustomTypeLevel2Fields,
|
|
57
|
+
}),
|
|
58
|
+
]);
|
|
59
|
+
const CustomTypesLevel2 = new t.Type("CustomTypesLevel2", (u) => Array.isArray(u) && u.every((item) => CustomTypeLevel2.is(item)), (u, context) => Either_1.either.chain(t.array(CustomTypeLevel2).validate(u, context), (cts) => {
|
|
60
|
+
// duplicates not allowed
|
|
61
|
+
const filtered = new Set(cts.map((ct) => (typeof ct === "string" ? ct : ct.id)));
|
|
62
|
+
return filtered.size === cts.length
|
|
63
|
+
? t.success(cts)
|
|
64
|
+
: t.failure(u, context, "Custom types have duplicates.");
|
|
65
|
+
}), (a) => a);
|
|
66
|
+
const CustomTypeLevel1FieldCustomTypes = t.strict({
|
|
67
|
+
id: t.string,
|
|
68
|
+
customtypes: CustomTypesLevel2,
|
|
69
|
+
});
|
|
70
|
+
const CustomTypeLevel1FieldGroupField = t.union([
|
|
71
|
+
CustomTypeLevel1FieldCustomTypes,
|
|
72
|
+
t.string,
|
|
73
|
+
]);
|
|
74
|
+
const CustomTypeLevel1FieldGroupFields = new t.Type("CustomTypeLevel1FieldGroupFields", (u) => Array.isArray(u) &&
|
|
75
|
+
u.every((item) => CustomTypeLevel1FieldGroupField.is(item)), (u, context) => Either_1.either.chain(t.array(CustomTypeLevel1FieldGroupField).validate(u, context), (fields) => {
|
|
76
|
+
// duplicates not allowed
|
|
77
|
+
const filtered = new Set(fields.map((field) => (typeof field === "string" ? field : field.id)));
|
|
78
|
+
return filtered.size === fields.length
|
|
79
|
+
? t.success(fields)
|
|
80
|
+
: t.failure(u, context, "Fields have duplicates.");
|
|
81
|
+
}), (a) => a);
|
|
82
|
+
const CustomTypeLevel1Field = t.union([
|
|
83
|
+
t.strict({
|
|
84
|
+
id: t.string,
|
|
85
|
+
fields: CustomTypeLevel1FieldGroupFields,
|
|
86
|
+
}),
|
|
87
|
+
CustomTypeLevel1FieldCustomTypes,
|
|
88
|
+
t.string,
|
|
89
|
+
]);
|
|
90
|
+
const CustomTypeLevel1Fields = new t.Type("CustomTypeLevel1Fields", (u) => Array.isArray(u) && u.every((item) => CustomTypeLevel1Field.is(item)), (u, context) => Either_1.either.chain(t.array(CustomTypeLevel1Field).validate(u, context), (fields) => {
|
|
91
|
+
// duplicates not allowed
|
|
92
|
+
const filtered = new Set(fields.map((field) => (typeof field === "string" ? field : field.id)));
|
|
93
|
+
return filtered.size === fields.length
|
|
94
|
+
? t.success(fields)
|
|
95
|
+
: t.failure(u, context, "Fields have duplicates.");
|
|
96
|
+
}), (a) => a);
|
|
97
|
+
const CustomTypeLevel1 = t.union([
|
|
98
|
+
t.string,
|
|
99
|
+
t.strict({
|
|
100
|
+
id: t.string,
|
|
101
|
+
fields: CustomTypeLevel1Fields,
|
|
102
|
+
}),
|
|
103
|
+
]);
|
|
104
|
+
exports.CustomTypes = new t.Type("CustomTypes", (u) => Array.isArray(u) && u.every((item) => CustomTypeLevel1.is(item)), (u, context) => Either_1.either.chain(t.array(CustomTypeLevel1).validate(u, context), (cts) => {
|
|
105
|
+
// if a ct appears more than once as a string, we allow it (legacy)
|
|
106
|
+
// if a ct appears once as a string and then again via object (or vice versa), we don't allow it
|
|
107
|
+
// if a ct appears more than once as an object, we don't allow it
|
|
108
|
+
const strings = new Set();
|
|
109
|
+
const objects = new Set();
|
|
110
|
+
for (const ct of cts) {
|
|
111
|
+
let failed = false;
|
|
112
|
+
if (typeof ct === "string") {
|
|
113
|
+
failed = objects.has(ct);
|
|
114
|
+
strings.add(ct);
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
const { id } = ct;
|
|
118
|
+
failed = strings.has(id) || objects.has(id);
|
|
119
|
+
objects.add(id);
|
|
120
|
+
}
|
|
121
|
+
if (failed)
|
|
122
|
+
return t.failure(u, context, "Custom types have duplicates.");
|
|
123
|
+
}
|
|
124
|
+
if (objects.size > 1) {
|
|
125
|
+
return t.failure(u, context, "Cannot have multiple custom types with fields selection.");
|
|
126
|
+
}
|
|
127
|
+
if (strings.size > 0 && objects.size > 0) {
|
|
128
|
+
return t.failure(u, context, "Cannot mix custom types as strings and objects with fields.");
|
|
129
|
+
}
|
|
130
|
+
return t.success(cts);
|
|
131
|
+
}), (a) => a);
|
|
132
|
+
exports.LinkFieldType = "Link";
|
|
133
|
+
exports.LinkConfig = t.exact(t.partial({
|
|
134
|
+
label: validators_1.StringOrNull,
|
|
135
|
+
useAsTitle: t.boolean,
|
|
136
|
+
placeholder: t.string,
|
|
137
|
+
select: (0, withFallback_1.withFallback)(t.union([
|
|
138
|
+
t.literal("media"),
|
|
139
|
+
t.literal("document"),
|
|
140
|
+
t.literal("web"),
|
|
141
|
+
t.null,
|
|
142
|
+
]), null),
|
|
143
|
+
customtypes: exports.CustomTypes,
|
|
144
|
+
masks: MasksArrayString,
|
|
145
|
+
tags: MasksArrayString,
|
|
146
|
+
allowTargetBlank: t.boolean,
|
|
147
|
+
allowText: t.boolean,
|
|
148
|
+
/**
|
|
149
|
+
* `repeat` property is used to allow multiple links to be added.
|
|
150
|
+
* `undefined` means that the field is not repeatable (hence repeat = false).
|
|
151
|
+
*/
|
|
152
|
+
repeat: t.boolean,
|
|
153
|
+
/**
|
|
154
|
+
* `variants` allows an option to be picked from a list (e.g. "primary"). To
|
|
155
|
+
* be considered, the list must have at least one item.
|
|
156
|
+
*/
|
|
157
|
+
variants: t.array(t.string),
|
|
158
|
+
}));
|
|
159
|
+
exports.Link = t.exact(t.intersection([
|
|
160
|
+
t.type({
|
|
161
|
+
type: t.literal(exports.LinkFieldType),
|
|
162
|
+
}),
|
|
163
|
+
t.partial({
|
|
164
|
+
fieldset: validators_1.StringOrNull,
|
|
165
|
+
config: exports.LinkConfig,
|
|
166
|
+
}),
|
|
167
|
+
]));
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import * as t from "io-ts";
|
|
2
|
+
export declare const NestableWidget: t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
3
|
+
type: t.LiteralC<"Color">;
|
|
4
|
+
}>, t.PartialC<{
|
|
5
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
6
|
+
config: t.ExactC<t.PartialC<{
|
|
7
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
8
|
+
placeholder: t.StringC;
|
|
9
|
+
}>>;
|
|
10
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
11
|
+
type: t.LiteralC<"Boolean">;
|
|
12
|
+
}>, t.PartialC<{
|
|
13
|
+
config: t.ExactC<t.PartialC<{
|
|
14
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
15
|
+
default_value: t.BooleanC;
|
|
16
|
+
placeholder_true: t.StringC;
|
|
17
|
+
placeholder_false: t.StringC;
|
|
18
|
+
}>>;
|
|
19
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
20
|
+
type: t.LiteralC<"Embed">;
|
|
21
|
+
}>, t.PartialC<{
|
|
22
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
23
|
+
config: t.ExactC<t.PartialC<{
|
|
24
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
25
|
+
placeholder: t.StringC;
|
|
26
|
+
useAsTitle: t.BooleanC;
|
|
27
|
+
}>>;
|
|
28
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
29
|
+
type: t.LiteralC<"GeoPoint">;
|
|
30
|
+
}>, t.PartialC<{
|
|
31
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
32
|
+
config: t.ExactC<t.PartialC<{
|
|
33
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
34
|
+
}>>;
|
|
35
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
36
|
+
type: t.LiteralC<"Date">;
|
|
37
|
+
}>, t.PartialC<{
|
|
38
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
39
|
+
config: t.ExactC<t.PartialC<{
|
|
40
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
41
|
+
placeholder: t.StringC;
|
|
42
|
+
default: t.StringC;
|
|
43
|
+
}>>;
|
|
44
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
45
|
+
type: t.LiteralC<"Number">;
|
|
46
|
+
}>, t.PartialC<{
|
|
47
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
48
|
+
config: t.ExactC<t.PartialC<{
|
|
49
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
50
|
+
placeholder: t.StringC;
|
|
51
|
+
min: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
|
|
52
|
+
max: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
|
|
53
|
+
step: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
|
|
54
|
+
}>>;
|
|
55
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
56
|
+
type: t.LiteralC<"Range">;
|
|
57
|
+
}>, t.PartialC<{
|
|
58
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
59
|
+
config: t.ExactC<t.PartialC<{
|
|
60
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
61
|
+
placeholder: t.StringC;
|
|
62
|
+
min: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
|
|
63
|
+
max: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
|
|
64
|
+
step: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
|
|
65
|
+
}>>;
|
|
66
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
67
|
+
type: t.LiteralC<"StructuredText">;
|
|
68
|
+
}>, t.PartialC<{
|
|
69
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
70
|
+
config: t.ExactC<t.PartialC<{
|
|
71
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
72
|
+
placeholder: t.StringC;
|
|
73
|
+
useAsTitle: t.BooleanC;
|
|
74
|
+
single: t.Type<string, string, unknown>;
|
|
75
|
+
multi: t.Type<string, string, unknown>;
|
|
76
|
+
imageConstraint: t.PartialC<{
|
|
77
|
+
width: t.Type<number | null, unknown, unknown>;
|
|
78
|
+
height: t.Type<number | null, unknown, unknown>;
|
|
79
|
+
}>;
|
|
80
|
+
labels: t.Type<readonly string[], object, unknown>;
|
|
81
|
+
allowTargetBlank: t.BooleanC;
|
|
82
|
+
}>>;
|
|
83
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
84
|
+
type: t.LiteralC<"Select">;
|
|
85
|
+
}>, t.PartialC<{
|
|
86
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
87
|
+
config: t.ExactC<t.PartialC<{
|
|
88
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
89
|
+
placeholder: t.StringC;
|
|
90
|
+
default_value: t.StringC;
|
|
91
|
+
options: t.ReadonlyArrayC<t.UnionC<[t.StringC, t.Type<string, string, unknown>, t.Type<string, string, unknown>]>>;
|
|
92
|
+
}>>;
|
|
93
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
94
|
+
type: t.LiteralC<"Separator">;
|
|
95
|
+
}>, t.PartialC<{
|
|
96
|
+
config: t.ExactC<t.PartialC<{
|
|
97
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
98
|
+
}>>;
|
|
99
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
100
|
+
type: t.LiteralC<"Table">;
|
|
101
|
+
}>, t.PartialC<{
|
|
102
|
+
config: t.ExactC<t.PartialC<{
|
|
103
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
104
|
+
}>>;
|
|
105
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
106
|
+
type: t.LiteralC<"Text">;
|
|
107
|
+
}>, t.PartialC<{
|
|
108
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
109
|
+
config: t.ExactC<t.PartialC<{
|
|
110
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
111
|
+
useAsTitle: t.BooleanC;
|
|
112
|
+
placeholder: t.StringC;
|
|
113
|
+
}>>;
|
|
114
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
115
|
+
type: t.LiteralC<"Timestamp">;
|
|
116
|
+
}>, t.PartialC<{
|
|
117
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
118
|
+
config: t.ExactC<t.PartialC<{
|
|
119
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
120
|
+
placeholder: t.StringC;
|
|
121
|
+
default: t.StringC;
|
|
122
|
+
}>>;
|
|
123
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
124
|
+
type: t.LiteralC<"Link">;
|
|
125
|
+
}>, t.PartialC<{
|
|
126
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
127
|
+
config: t.ExactC<t.PartialC<{
|
|
128
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
129
|
+
useAsTitle: t.BooleanC;
|
|
130
|
+
placeholder: t.StringC;
|
|
131
|
+
select: t.UnionC<[t.LiteralC<"media">, t.LiteralC<"document">, t.LiteralC<"web">, t.NullC]>;
|
|
132
|
+
customtypes: t.Type<readonly (string | {
|
|
133
|
+
id: string;
|
|
134
|
+
fields: readonly (string | {
|
|
135
|
+
id: string;
|
|
136
|
+
customtypes: readonly (string | {
|
|
137
|
+
id: string;
|
|
138
|
+
fields: readonly (string | {
|
|
139
|
+
id: string;
|
|
140
|
+
fields: readonly string[];
|
|
141
|
+
})[];
|
|
142
|
+
})[];
|
|
143
|
+
} | {
|
|
144
|
+
id: string;
|
|
145
|
+
fields: readonly (string | {
|
|
146
|
+
id: string;
|
|
147
|
+
customtypes: readonly (string | {
|
|
148
|
+
id: string;
|
|
149
|
+
fields: readonly (string | {
|
|
150
|
+
id: string;
|
|
151
|
+
fields: readonly string[];
|
|
152
|
+
})[];
|
|
153
|
+
})[];
|
|
154
|
+
})[];
|
|
155
|
+
})[];
|
|
156
|
+
})[], readonly (string | {
|
|
157
|
+
id: string;
|
|
158
|
+
fields: readonly (string | {
|
|
159
|
+
id: string;
|
|
160
|
+
customtypes: readonly (string | {
|
|
161
|
+
id: string;
|
|
162
|
+
fields: readonly (string | {
|
|
163
|
+
id: string;
|
|
164
|
+
fields: readonly string[];
|
|
165
|
+
})[];
|
|
166
|
+
})[];
|
|
167
|
+
} | {
|
|
168
|
+
id: string;
|
|
169
|
+
fields: readonly (string | {
|
|
170
|
+
id: string;
|
|
171
|
+
customtypes: readonly (string | {
|
|
172
|
+
id: string;
|
|
173
|
+
fields: readonly (string | {
|
|
174
|
+
id: string;
|
|
175
|
+
fields: readonly string[];
|
|
176
|
+
})[];
|
|
177
|
+
})[];
|
|
178
|
+
})[];
|
|
179
|
+
})[];
|
|
180
|
+
})[], unknown>;
|
|
181
|
+
masks: t.Type<readonly string[], object, unknown>;
|
|
182
|
+
tags: t.Type<readonly string[], object, unknown>;
|
|
183
|
+
allowTargetBlank: t.BooleanC;
|
|
184
|
+
allowText: t.BooleanC;
|
|
185
|
+
repeat: t.BooleanC;
|
|
186
|
+
variants: t.ArrayC<t.StringC>;
|
|
187
|
+
}>>;
|
|
188
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
189
|
+
type: t.LiteralC<"Image">;
|
|
190
|
+
}>, t.PartialC<{
|
|
191
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
192
|
+
config: t.ExactC<t.PartialC<{
|
|
193
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
194
|
+
placeholder: t.StringC;
|
|
195
|
+
constraint: t.PartialC<{
|
|
196
|
+
width: t.Type<number | null, unknown, unknown>;
|
|
197
|
+
height: t.Type<number | null, unknown, unknown>;
|
|
198
|
+
}>;
|
|
199
|
+
thumbnails: t.ReadonlyArrayC<t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
200
|
+
name: t.StringC;
|
|
201
|
+
}>, t.PartialC<{
|
|
202
|
+
width: t.Type<number | null, unknown, unknown>;
|
|
203
|
+
height: t.Type<number | null, unknown, unknown>;
|
|
204
|
+
}>]>>>;
|
|
205
|
+
}>>;
|
|
206
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
207
|
+
type: t.LiteralC<"IntegrationFields">;
|
|
208
|
+
}>, t.PartialC<{
|
|
209
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
210
|
+
config: t.ExactC<t.PartialC<{
|
|
211
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
212
|
+
placeholder: t.StringC;
|
|
213
|
+
catalog: t.StringC;
|
|
214
|
+
}>>;
|
|
215
|
+
}>]>>]>;
|
|
216
|
+
export declare type NestableWidget = t.TypeOf<typeof NestableWidget>;
|
|
217
|
+
export declare type NestableFieldTypes = NestableWidget["type"];
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NestableWidget = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
6
|
+
const BooleanField_1 = require("./BooleanField");
|
|
7
|
+
const Color_1 = require("./Color");
|
|
8
|
+
const Date_1 = require("./Date");
|
|
9
|
+
const Embed_1 = require("./Embed");
|
|
10
|
+
const GeoPoint_1 = require("./GeoPoint");
|
|
11
|
+
const Image_1 = require("./Image");
|
|
12
|
+
const IntegrationField_1 = require("./IntegrationField");
|
|
13
|
+
const Link_1 = require("./Link");
|
|
14
|
+
const Number_1 = require("./Number");
|
|
15
|
+
const Range_1 = require("./Range");
|
|
16
|
+
const RichText_1 = require("./RichText");
|
|
17
|
+
const Select_1 = require("./Select");
|
|
18
|
+
const Separator_1 = require("./Separator");
|
|
19
|
+
const Table_1 = require("./Table");
|
|
20
|
+
const Text_1 = require("./Text");
|
|
21
|
+
const Timestamp_1 = require("./Timestamp");
|
|
22
|
+
exports.NestableWidget = t.union([
|
|
23
|
+
Color_1.Color,
|
|
24
|
+
BooleanField_1.BooleanField,
|
|
25
|
+
Embed_1.Embed,
|
|
26
|
+
GeoPoint_1.GeoPoint,
|
|
27
|
+
Date_1.Date,
|
|
28
|
+
Number_1.Number,
|
|
29
|
+
Range_1.Range,
|
|
30
|
+
RichText_1.RichText,
|
|
31
|
+
Select_1.Select,
|
|
32
|
+
Separator_1.Separator,
|
|
33
|
+
Table_1.Table,
|
|
34
|
+
Text_1.Text,
|
|
35
|
+
Timestamp_1.Timestamp,
|
|
36
|
+
Link_1.Link,
|
|
37
|
+
Image_1.Image,
|
|
38
|
+
IntegrationField_1.IntegrationField,
|
|
39
|
+
]);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as t from "io-ts";
|
|
2
|
+
export declare const NumberFieldType = "Number";
|
|
3
|
+
export declare const NumberConfig: t.ExactC<t.PartialC<{
|
|
4
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
5
|
+
placeholder: t.StringC;
|
|
6
|
+
min: t.UnionC<[t.NumberC, import("io-ts-types/lib/NumberFromString").NumberFromStringC]>;
|
|
7
|
+
max: t.UnionC<[t.NumberC, import("io-ts-types/lib/NumberFromString").NumberFromStringC]>;
|
|
8
|
+
step: t.UnionC<[t.NumberC, import("io-ts-types/lib/NumberFromString").NumberFromStringC]>;
|
|
9
|
+
}>>;
|
|
10
|
+
export declare type NumberConfig = t.TypeOf<typeof NumberConfig>;
|
|
11
|
+
export declare const Number: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
12
|
+
type: t.LiteralC<"Number">;
|
|
13
|
+
}>, t.PartialC<{
|
|
14
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
15
|
+
config: t.ExactC<t.PartialC<{
|
|
16
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
17
|
+
placeholder: t.StringC;
|
|
18
|
+
min: t.UnionC<[t.NumberC, import("io-ts-types/lib/NumberFromString").NumberFromStringC]>;
|
|
19
|
+
max: t.UnionC<[t.NumberC, import("io-ts-types/lib/NumberFromString").NumberFromStringC]>;
|
|
20
|
+
step: t.UnionC<[t.NumberC, import("io-ts-types/lib/NumberFromString").NumberFromStringC]>;
|
|
21
|
+
}>>;
|
|
22
|
+
}>]>>;
|
|
23
|
+
export declare type Number = t.TypeOf<typeof Number>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Number = exports.NumberConfig = exports.NumberFieldType = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
6
|
+
const NumberFromString_1 = require("io-ts-types/lib/NumberFromString");
|
|
7
|
+
const validators_1 = require("../../../validators");
|
|
8
|
+
exports.NumberFieldType = "Number";
|
|
9
|
+
exports.NumberConfig = t.exact(t.partial({
|
|
10
|
+
label: validators_1.StringOrNull,
|
|
11
|
+
placeholder: t.string,
|
|
12
|
+
min: t.union([t.number, NumberFromString_1.NumberFromString]),
|
|
13
|
+
max: t.union([t.number, NumberFromString_1.NumberFromString]),
|
|
14
|
+
step: t.union([t.number, NumberFromString_1.NumberFromString]),
|
|
15
|
+
}));
|
|
16
|
+
exports.Number = t.exact(t.intersection([
|
|
17
|
+
t.type({
|
|
18
|
+
type: t.literal(exports.NumberFieldType),
|
|
19
|
+
}),
|
|
20
|
+
t.partial({
|
|
21
|
+
fieldset: validators_1.StringOrNull,
|
|
22
|
+
config: exports.NumberConfig,
|
|
23
|
+
}),
|
|
24
|
+
]));
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as t from "io-ts";
|
|
2
|
+
export declare const RangeFieldType = "Range";
|
|
3
|
+
export declare const RangeConfig: t.ExactC<t.PartialC<{
|
|
4
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
5
|
+
placeholder: t.StringC;
|
|
6
|
+
min: t.UnionC<[t.NumberC, import("io-ts-types/lib/NumberFromString").NumberFromStringC]>;
|
|
7
|
+
max: t.UnionC<[t.NumberC, import("io-ts-types/lib/NumberFromString").NumberFromStringC]>;
|
|
8
|
+
step: t.UnionC<[t.NumberC, import("io-ts-types/lib/NumberFromString").NumberFromStringC]>;
|
|
9
|
+
}>>;
|
|
10
|
+
export declare type RangeConfig = t.TypeOf<typeof RangeConfig>;
|
|
11
|
+
export declare const Range: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
12
|
+
type: t.LiteralC<"Range">;
|
|
13
|
+
}>, t.PartialC<{
|
|
14
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
15
|
+
config: t.ExactC<t.PartialC<{
|
|
16
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
17
|
+
placeholder: t.StringC;
|
|
18
|
+
min: t.UnionC<[t.NumberC, import("io-ts-types/lib/NumberFromString").NumberFromStringC]>;
|
|
19
|
+
max: t.UnionC<[t.NumberC, import("io-ts-types/lib/NumberFromString").NumberFromStringC]>;
|
|
20
|
+
step: t.UnionC<[t.NumberC, import("io-ts-types/lib/NumberFromString").NumberFromStringC]>;
|
|
21
|
+
}>>;
|
|
22
|
+
}>]>>;
|
|
23
|
+
export declare type Range = t.TypeOf<typeof Range>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Range = exports.RangeConfig = exports.RangeFieldType = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
6
|
+
const NumberFromString_1 = require("io-ts-types/lib/NumberFromString");
|
|
7
|
+
const validators_1 = require("../../../validators");
|
|
8
|
+
exports.RangeFieldType = "Range";
|
|
9
|
+
exports.RangeConfig = t.exact(t.partial({
|
|
10
|
+
label: validators_1.StringOrNull,
|
|
11
|
+
placeholder: t.string,
|
|
12
|
+
min: t.union([t.number, NumberFromString_1.NumberFromString]),
|
|
13
|
+
max: t.union([t.number, NumberFromString_1.NumberFromString]),
|
|
14
|
+
step: t.union([t.number, NumberFromString_1.NumberFromString]),
|
|
15
|
+
}));
|
|
16
|
+
exports.Range = t.exact(t.intersection([
|
|
17
|
+
t.type({
|
|
18
|
+
type: t.literal(exports.RangeFieldType),
|
|
19
|
+
}),
|
|
20
|
+
t.partial({
|
|
21
|
+
fieldset: validators_1.StringOrNull,
|
|
22
|
+
config: exports.RangeConfig,
|
|
23
|
+
}),
|
|
24
|
+
]));
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import * as t from "io-ts";
|
|
2
|
+
export declare const RichTextFieldType = "StructuredText";
|
|
3
|
+
export declare const DEFAULT_OPTION = "paragraph";
|
|
4
|
+
export declare type RichTextNodeType = typeof RichTextNodeType[keyof typeof RichTextNodeType];
|
|
5
|
+
export declare const RichTextNodeType: {
|
|
6
|
+
readonly heading1: "heading1";
|
|
7
|
+
readonly heading2: "heading2";
|
|
8
|
+
readonly heading3: "heading3";
|
|
9
|
+
readonly heading4: "heading4";
|
|
10
|
+
readonly heading5: "heading5";
|
|
11
|
+
readonly heading6: "heading6";
|
|
12
|
+
readonly paragraph: "paragraph";
|
|
13
|
+
readonly strong: "strong";
|
|
14
|
+
readonly em: "em";
|
|
15
|
+
readonly preformatted: "preformatted";
|
|
16
|
+
readonly hyperlink: "hyperlink";
|
|
17
|
+
readonly image: "image";
|
|
18
|
+
readonly embed: "embed";
|
|
19
|
+
readonly list: "list-item";
|
|
20
|
+
readonly orderedList: "o-list-item";
|
|
21
|
+
readonly rtl: "rtl";
|
|
22
|
+
};
|
|
23
|
+
export declare const RichTextNodeTypeCodec: t.KeyofC<{
|
|
24
|
+
heading1: null;
|
|
25
|
+
heading2: null;
|
|
26
|
+
heading3: null;
|
|
27
|
+
heading4: null;
|
|
28
|
+
heading5: null;
|
|
29
|
+
heading6: null;
|
|
30
|
+
paragraph: null;
|
|
31
|
+
strong: null;
|
|
32
|
+
em: null;
|
|
33
|
+
preformatted: null;
|
|
34
|
+
hyperlink: null;
|
|
35
|
+
image: null;
|
|
36
|
+
embed: null;
|
|
37
|
+
"list-item": null;
|
|
38
|
+
"o-list-item": null;
|
|
39
|
+
rtl: null;
|
|
40
|
+
}>;
|
|
41
|
+
export declare const RichTextConfig: t.ExactC<t.PartialC<{
|
|
42
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
43
|
+
placeholder: t.StringC;
|
|
44
|
+
useAsTitle: t.BooleanC;
|
|
45
|
+
single: t.Type<string, string, unknown>;
|
|
46
|
+
multi: t.Type<string, string, unknown>;
|
|
47
|
+
imageConstraint: t.PartialC<{
|
|
48
|
+
width: t.Type<number | null, unknown, unknown>;
|
|
49
|
+
height: t.Type<number | null, unknown, unknown>;
|
|
50
|
+
}>;
|
|
51
|
+
labels: t.Type<readonly string[], object, unknown>;
|
|
52
|
+
allowTargetBlank: t.BooleanC;
|
|
53
|
+
}>>;
|
|
54
|
+
export declare type RichTextConfig = t.TypeOf<typeof RichTextConfig>;
|
|
55
|
+
export declare const RichText: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
56
|
+
type: t.LiteralC<"StructuredText">;
|
|
57
|
+
}>, t.PartialC<{
|
|
58
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
59
|
+
config: t.ExactC<t.PartialC<{
|
|
60
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
61
|
+
placeholder: t.StringC;
|
|
62
|
+
useAsTitle: t.BooleanC;
|
|
63
|
+
single: t.Type<string, string, unknown>;
|
|
64
|
+
multi: t.Type<string, string, unknown>;
|
|
65
|
+
imageConstraint: t.PartialC<{
|
|
66
|
+
width: t.Type<number | null, unknown, unknown>;
|
|
67
|
+
height: t.Type<number | null, unknown, unknown>;
|
|
68
|
+
}>;
|
|
69
|
+
labels: t.Type<readonly string[], object, unknown>;
|
|
70
|
+
allowTargetBlank: t.BooleanC;
|
|
71
|
+
}>>;
|
|
72
|
+
}>]>>;
|
|
73
|
+
export declare type RichText = t.TypeOf<typeof RichText>;
|