@prismicio/types-internal 0.1.1 → 0.2.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/README.md +13 -13
- package/{dist → lib}/customtypes/CustomType.d.ts +699 -699
- package/{dist → lib}/customtypes/CustomType.js +28 -28
- package/{dist → lib}/customtypes/Format.d.ts +0 -0
- package/{dist → lib}/customtypes/Format.js +0 -0
- package/{dist → lib}/customtypes/Section.d.ts +1038 -1038
- package/{dist → lib}/customtypes/Section.js +2 -3
- package/lib/customtypes/index.d.ts +4 -0
- package/{dist → lib}/customtypes/index.js +4 -4
- package/{dist → lib}/customtypes/widgets/Group.d.ts +45 -45
- package/{dist → lib}/customtypes/widgets/Group.js +8 -8
- package/{dist → lib}/customtypes/widgets/UID.d.ts +4 -4
- package/{dist → lib}/customtypes/widgets/UID.js +7 -7
- package/{dist → lib}/customtypes/widgets/Widget.d.ts +1039 -1039
- package/{dist → lib}/customtypes/widgets/Widget.js +9 -12
- package/{dist → lib}/customtypes/widgets/WidgetTypes.d.ts +0 -0
- package/{dist → lib}/customtypes/widgets/WidgetTypes.js +0 -0
- package/lib/customtypes/widgets/index.d.ts +7 -0
- package/{dist → lib}/customtypes/widgets/index.js +4 -4
- package/{dist → lib}/customtypes/widgets/nestable/BooleanField.d.ts +3 -3
- package/{dist → lib}/customtypes/widgets/nestable/BooleanField.js +6 -6
- package/{dist → lib}/customtypes/widgets/nestable/Color.d.ts +4 -4
- package/{dist → lib}/customtypes/widgets/nestable/Color.js +6 -6
- package/{dist → lib}/customtypes/widgets/nestable/Date.d.ts +4 -4
- package/{dist → lib}/customtypes/widgets/nestable/Date.js +7 -7
- package/{dist → lib}/customtypes/widgets/nestable/Embed.d.ts +4 -4
- package/{dist → lib}/customtypes/widgets/nestable/Embed.js +7 -7
- package/{dist → lib}/customtypes/widgets/nestable/GeoPoint.d.ts +4 -4
- package/{dist → lib}/customtypes/widgets/nestable/GeoPoint.js +6 -6
- package/lib/customtypes/widgets/nestable/Image.d.ts +23 -0
- package/{dist → lib}/customtypes/widgets/nestable/Image.js +10 -10
- package/{dist → lib}/customtypes/widgets/nestable/IntegrationField.d.ts +4 -4
- package/{dist → lib}/customtypes/widgets/nestable/IntegrationField.js +7 -7
- package/{dist → lib}/customtypes/widgets/nestable/Link.d.ts +4 -4
- package/{dist → lib}/customtypes/widgets/nestable/Link.js +18 -23
- package/{dist → lib}/customtypes/widgets/nestable/NestableWidget.d.ts +42 -42
- package/{dist → lib}/customtypes/widgets/nestable/NestableWidget.js +5 -5
- package/{dist → lib}/customtypes/widgets/nestable/Number.d.ts +4 -4
- package/{dist → lib}/customtypes/widgets/nestable/Number.js +8 -8
- package/{dist → lib}/customtypes/widgets/nestable/Range.d.ts +4 -4
- package/{dist → lib}/customtypes/widgets/nestable/Range.js +7 -7
- package/{dist → lib}/customtypes/widgets/nestable/RichText.d.ts +6 -6
- package/{dist → lib}/customtypes/widgets/nestable/RichText.js +42 -48
- package/lib/customtypes/widgets/nestable/Select.d.ts +15 -0
- package/{dist → lib}/customtypes/widgets/nestable/Select.js +7 -9
- package/{dist → lib}/customtypes/widgets/nestable/Separator.d.ts +3 -3
- package/{dist → lib}/customtypes/widgets/nestable/Separator.js +5 -5
- package/{dist → lib}/customtypes/widgets/nestable/Text.d.ts +4 -4
- package/{dist → lib}/customtypes/widgets/nestable/Text.js +7 -7
- package/{dist → lib}/customtypes/widgets/nestable/Timestamp.d.ts +4 -4
- package/{dist → lib}/customtypes/widgets/nestable/Timestamp.js +7 -7
- package/lib/customtypes/widgets/nestable/index.d.ts +15 -0
- package/{dist → lib}/customtypes/widgets/nestable/index.js +0 -0
- package/{dist → lib}/customtypes/widgets/shared/ImageConstraint.d.ts +3 -3
- package/{dist → lib}/customtypes/widgets/shared/ImageConstraint.js +16 -15
- package/lib/customtypes/widgets/shared/index.d.ts +1 -0
- package/{dist → lib}/customtypes/widgets/shared/index.js +0 -0
- package/{dist → lib}/customtypes/widgets/slices/CompositeSlice.d.ts +87 -87
- package/{dist → lib}/customtypes/widgets/slices/CompositeSlice.js +8 -8
- package/{dist → lib}/customtypes/widgets/slices/LegacySlice.d.ts +87 -87
- package/{dist → lib}/customtypes/widgets/slices/LegacySlice.js +3 -7
- package/{dist → lib}/customtypes/widgets/slices/SharedSlice.d.ts +84 -84
- package/{dist → lib}/customtypes/widgets/slices/SharedSlice.js +7 -7
- package/{dist → lib}/customtypes/widgets/slices/SharedSliceRef.d.ts +2 -2
- package/{dist → lib}/customtypes/widgets/slices/SharedSliceRef.js +1 -1
- package/{dist → lib}/customtypes/widgets/slices/Slice.d.ts +1 -1
- package/{dist → lib}/customtypes/widgets/slices/Slice.js +0 -0
- package/{dist → lib}/customtypes/widgets/slices/Slices.d.ts +1556 -1556
- package/{dist → lib}/customtypes/widgets/slices/Slices.js +31 -23
- package/{dist → lib}/customtypes/widgets/slices/SlicesTypes.d.ts +0 -0
- package/{dist → lib}/customtypes/widgets/slices/SlicesTypes.js +0 -0
- package/lib/customtypes/widgets/slices/index.d.ts +7 -0
- package/{dist → lib}/customtypes/widgets/slices/index.js +3 -3
- package/lib/documents/DocumentData.d.ts +8 -0
- package/lib/documents/DocumentData.js +46 -0
- package/lib/documents/index.d.ts +2 -0
- package/lib/documents/index.js +28 -0
- package/lib/documents/widgets/EmptyContent.d.ts +8 -0
- package/lib/documents/widgets/EmptyContent.js +9 -0
- package/lib/documents/widgets/GroupContent.d.ts +16 -0
- package/lib/documents/widgets/GroupContent.js +77 -0
- package/lib/documents/widgets/SimpleWidgetContent.d.ts +20 -0
- package/lib/documents/widgets/SimpleWidgetContent.js +96 -0
- package/lib/documents/widgets/StaticWidgetContent.d.ts +10 -0
- package/lib/documents/widgets/StaticWidgetContent.js +44 -0
- package/lib/documents/widgets/UIDContent.d.ts +7 -0
- package/lib/documents/widgets/UIDContent.js +28 -0
- package/lib/documents/widgets/Widget.d.ts +0 -0
- package/lib/documents/widgets/Widget.js +1 -0
- package/lib/documents/widgets/index.d.ts +35 -0
- package/lib/documents/widgets/index.js +60 -0
- package/lib/documents/widgets/nestable/BooleanContent.d.ts +8 -0
- package/lib/documents/widgets/nestable/BooleanContent.js +29 -0
- package/lib/documents/widgets/nestable/EmbedContent.d.ts +40 -0
- package/lib/documents/widgets/nestable/EmbedContent.js +54 -0
- package/lib/documents/widgets/nestable/FieldContent.d.ts +12 -0
- package/lib/documents/widgets/nestable/FieldContent.js +53 -0
- package/lib/documents/widgets/nestable/GeoPointContent.d.ts +17 -0
- package/lib/documents/widgets/nestable/GeoPointContent.js +31 -0
- package/lib/documents/widgets/nestable/ImageContent.d.ts +127 -0
- package/lib/documents/widgets/nestable/ImageContent.js +59 -0
- package/lib/documents/widgets/nestable/IntegrationFieldsContent.d.ts +8 -0
- package/lib/documents/widgets/nestable/IntegrationFieldsContent.js +34 -0
- package/lib/documents/widgets/nestable/Link/DocumentLink.d.ts +12 -0
- package/lib/documents/widgets/nestable/Link/DocumentLink.js +31 -0
- package/lib/documents/widgets/nestable/Link/ExternalLink.d.ts +24 -0
- package/lib/documents/widgets/nestable/Link/ExternalLink.js +42 -0
- package/lib/documents/widgets/nestable/Link/FileLink.d.ts +22 -0
- package/lib/documents/widgets/nestable/Link/FileLink.js +42 -0
- package/lib/documents/widgets/nestable/Link/ImageLink.d.ts +28 -0
- package/lib/documents/widgets/nestable/Link/ImageLink.js +44 -0
- package/lib/documents/widgets/nestable/Link/LinkContent.d.ts +36 -0
- package/lib/documents/widgets/nestable/Link/LinkContent.js +31 -0
- package/lib/documents/widgets/nestable/Link/index.d.ts +89 -0
- package/lib/documents/widgets/nestable/Link/index.js +53 -0
- package/lib/documents/widgets/nestable/SeparatorContent.d.ts +7 -0
- package/lib/documents/widgets/nestable/SeparatorContent.js +10 -0
- package/lib/documents/widgets/nestable/StructuredTextContent/Block.d.ts +274 -0
- package/lib/documents/widgets/nestable/StructuredTextContent/Block.js +118 -0
- package/lib/documents/widgets/nestable/StructuredTextContent/index.d.ts +9 -0
- package/lib/documents/widgets/nestable/StructuredTextContent/index.js +32 -0
- package/lib/documents/widgets/nestable/index.d.ts +26 -0
- package/lib/documents/widgets/nestable/index.js +64 -0
- package/lib/documents/widgets/slices/CompositeSliceContent.d.ts +14 -0
- package/lib/documents/widgets/slices/CompositeSliceContent.js +68 -0
- package/lib/documents/widgets/slices/SharedSliceContent.d.ts +15 -0
- package/lib/documents/widgets/slices/SharedSliceContent.js +80 -0
- package/lib/documents/widgets/slices/SimpleSliceContent.d.ts +6 -0
- package/lib/documents/widgets/slices/SimpleSliceContent.js +8 -0
- package/lib/documents/widgets/slices/SliceWidgetContent.d.ts +8 -0
- package/lib/documents/widgets/slices/SliceWidgetContent.js +47 -0
- package/lib/documents/widgets/slices/SlicesContent.d.ts +17 -0
- package/lib/documents/widgets/slices/SlicesContent.js +69 -0
- package/lib/documents/widgets/slices/index.d.ts +5 -0
- package/lib/documents/widgets/slices/index.js +17 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +25 -0
- package/lib/validators/DateFromString.d.ts +3 -0
- package/lib/validators/DateFromString.js +28 -0
- package/lib/validators/DateFromStringOrNumber.d.ts +3 -0
- package/lib/validators/DateFromStringOrNumber.js +28 -0
- package/lib/validators/DateFromTsMs.d.ts +3 -0
- package/lib/validators/DateFromTsMs.js +28 -0
- package/lib/validators/IntFromNumber.d.ts +5 -0
- package/{dist → lib}/validators/IntFromNumber.js +4 -7
- package/lib/validators/IntFromPixels.d.ts +8 -0
- package/{dist → lib}/validators/IntFromPixels.js +5 -5
- package/lib/validators/NonEmptyString.d.ts +3 -0
- package/lib/validators/NonEmptyString.js +24 -0
- package/lib/validators/NonEmptyStringOrNull.d.ts +3 -0
- package/lib/validators/NonEmptyStringOrNull.js +17 -0
- package/lib/validators/NumberOrNull.d.ts +3 -0
- package/{dist/index.js → lib/validators/NumberOrNull.js} +3 -2
- package/lib/validators/StringFromBoolean.d.ts +5 -0
- package/{dist → lib}/validators/StringFromBoolean.js +5 -8
- package/lib/validators/StringFromNumber.d.ts +5 -0
- package/{dist → lib}/validators/StringFromNumber.js +5 -8
- package/lib/validators/StringOrNull.d.ts +3 -0
- package/{dist → lib}/validators/StringOrNull.js +2 -2
- package/lib/validators/function.d.ts +14 -0
- package/lib/validators/function.js +77 -0
- package/lib/validators/index.d.ts +12 -0
- package/lib/validators/index.js +48 -0
- package/package.json +30 -18
- package/src/customtypes/CustomType.ts +173 -116
- package/src/customtypes/Format.ts +3 -3
- package/src/customtypes/Section.ts +26 -13
- package/src/customtypes/index.ts +4 -4
- package/src/customtypes/widgets/Group.ts +21 -20
- package/src/customtypes/widgets/UID.ts +18 -17
- package/src/customtypes/widgets/Widget.ts +22 -23
- package/src/customtypes/widgets/WidgetTypes.ts +21 -21
- package/src/customtypes/widgets/index.ts +7 -7
- package/src/customtypes/widgets/nestable/BooleanField.ts +19 -19
- package/src/customtypes/widgets/nestable/Color.ts +17 -16
- package/src/customtypes/widgets/nestable/Date.ts +19 -18
- package/src/customtypes/widgets/nestable/Embed.ts +19 -18
- package/src/customtypes/widgets/nestable/GeoPoint.ts +17 -16
- package/src/customtypes/widgets/nestable/Image.ts +26 -26
- package/src/customtypes/widgets/nestable/IntegrationField.ts +18 -17
- package/src/customtypes/widgets/nestable/Link.ts +80 -68
- package/src/customtypes/widgets/nestable/NestableWidget.ts +32 -32
- package/src/customtypes/widgets/nestable/Number.ts +22 -21
- package/src/customtypes/widgets/nestable/Range.ts +22 -21
- package/src/customtypes/widgets/nestable/RichText.ts +164 -134
- package/src/customtypes/widgets/nestable/Select.ts +22 -21
- package/src/customtypes/widgets/nestable/Separator.ts +15 -14
- package/src/customtypes/widgets/nestable/Text.ts +18 -17
- package/src/customtypes/widgets/nestable/Timestamp.ts +19 -18
- package/src/customtypes/widgets/nestable/index.ts +15 -15
- package/src/customtypes/widgets/shared/ImageConstraint.ts +31 -29
- package/src/customtypes/widgets/shared/index.ts +1 -1
- package/src/customtypes/widgets/slices/CompositeSlice.ts +21 -21
- package/src/customtypes/widgets/slices/LegacySlice.ts +6 -10
- package/src/customtypes/widgets/slices/SharedSlice.ts +33 -31
- package/src/customtypes/widgets/slices/SharedSliceRef.ts +6 -6
- package/src/customtypes/widgets/slices/Slice.ts +4 -4
- package/src/customtypes/widgets/slices/Slices.ts +95 -73
- package/src/customtypes/widgets/slices/SlicesTypes.ts +3 -3
- package/src/customtypes/widgets/slices/index.ts +7 -7
- package/src/documents/DocumentData.ts +54 -0
- package/src/documents/index.ts +2 -0
- package/src/documents/widgets/EmptyContent.ts +8 -0
- package/src/documents/widgets/GroupContent.ts +91 -0
- package/src/documents/widgets/SimpleWidgetContent.ts +96 -0
- package/src/documents/widgets/StaticWidgetContent.ts +46 -0
- package/src/documents/widgets/UIDContent.ts +18 -0
- package/src/documents/widgets/index.ts +56 -0
- package/src/documents/widgets/nestable/BooleanContent.ts +21 -0
- package/src/documents/widgets/nestable/EmbedContent.ts +54 -0
- package/src/documents/widgets/nestable/FieldContent.ts +45 -0
- package/src/documents/widgets/nestable/GeoPointContent.ts +18 -0
- package/src/documents/widgets/nestable/ImageContent.ts +51 -0
- package/src/documents/widgets/nestable/IntegrationFieldsContent.ts +26 -0
- package/src/documents/widgets/nestable/Link/DocumentLink.ts +18 -0
- package/src/documents/widgets/nestable/Link/ExternalLink.ts +31 -0
- package/src/documents/widgets/nestable/Link/FileLink.ts +29 -0
- package/src/documents/widgets/nestable/Link/ImageLink.ts +31 -0
- package/src/documents/widgets/nestable/Link/LinkContent.ts +22 -0
- package/src/documents/widgets/nestable/Link/index.ts +33 -0
- package/src/documents/widgets/nestable/SeparatorContent.ts +8 -0
- package/src/documents/widgets/nestable/StructuredTextContent/Block.ts +122 -0
- package/src/documents/widgets/nestable/StructuredTextContent/index.ts +25 -0
- package/src/documents/widgets/nestable/index.ts +35 -0
- package/src/documents/widgets/slices/CompositeSliceContent.ts +77 -0
- package/src/documents/widgets/slices/SharedSliceContent.ts +94 -0
- package/src/documents/widgets/slices/SimpleSliceContent.ts +4 -0
- package/src/documents/widgets/slices/SliceWidgetContent.ts +51 -0
- package/src/documents/widgets/slices/SlicesContent.ts +91 -0
- package/src/documents/widgets/slices/index.ts +5 -0
- package/src/index.ts +3 -1
- package/src/validators/DateFromString.ts +17 -0
- package/src/validators/DateFromStringOrNumber.ts +17 -0
- package/src/validators/DateFromTsMs.ts +17 -0
- package/src/validators/IntFromNumber.ts +22 -24
- package/src/validators/IntFromPixels.ts +27 -26
- package/src/validators/NonEmptyString.ts +9 -0
- package/src/validators/NonEmptyStringOrNull.ts +22 -0
- package/src/validators/NumberOrNull.ts +5 -0
- package/src/validators/StringFromBoolean.ts +17 -19
- package/src/validators/StringFromNumber.ts +17 -19
- package/src/validators/StringOrNull.ts +4 -2
- package/src/validators/function.ts +71 -0
- package/src/validators/index.ts +12 -0
- package/dist/customtypes/index.d.ts +0 -4
- package/dist/customtypes/widgets/index.d.ts +0 -7
- package/dist/customtypes/widgets/nestable/Image.d.ts +0 -23
- package/dist/customtypes/widgets/nestable/Select.d.ts +0 -15
- package/dist/customtypes/widgets/nestable/index.d.ts +0 -15
- package/dist/customtypes/widgets/shared/index.d.ts +0 -1
- package/dist/customtypes/widgets/slices/index.d.ts +0 -7
- package/dist/index.d.ts +0 -1
- package/dist/index.js.map +0 -1
- package/dist/validators/IntFromNumber.d.ts +0 -7
- package/dist/validators/IntFromPixels.d.ts +0 -7
- package/dist/validators/StringFromBoolean.d.ts +0 -7
- package/dist/validators/StringFromNumber.d.ts +0 -7
- package/dist/validators/StringOrNull.d.ts +0 -2
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import * as t from
|
|
1
|
+
import * as t from "io-ts";
|
|
2
2
|
declare const NestableWidget: t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
3
3
|
type: t.LiteralC<import("../WidgetTypes").default.Color>;
|
|
4
4
|
}>, t.PartialC<{
|
|
5
|
-
fieldset: t.UnionC<[t.
|
|
5
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
6
6
|
config: t.ExactC<t.PartialC<{
|
|
7
|
-
label: t.UnionC<[t.
|
|
7
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
8
8
|
placeholder: t.StringC;
|
|
9
9
|
}>>;
|
|
10
10
|
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
11
11
|
type: t.LiteralC<import("../WidgetTypes").default.BooleanField>;
|
|
12
12
|
}>, t.PartialC<{
|
|
13
13
|
config: t.ExactC<t.PartialC<{
|
|
14
|
-
label: t.UnionC<[t.
|
|
14
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
15
15
|
default_value: t.BooleanC;
|
|
16
16
|
placeholder_true: t.StringC;
|
|
17
17
|
placeholder_false: t.StringC;
|
|
@@ -19,63 +19,63 @@ declare const NestableWidget: t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
19
19
|
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
20
20
|
type: t.LiteralC<import("../WidgetTypes").default.Embed>;
|
|
21
21
|
}>, t.PartialC<{
|
|
22
|
-
fieldset: t.UnionC<[t.
|
|
22
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
23
23
|
config: t.ExactC<t.PartialC<{
|
|
24
|
-
label: t.UnionC<[t.
|
|
24
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
25
25
|
placeholder: t.StringC;
|
|
26
26
|
useAsTitle: t.BooleanC;
|
|
27
27
|
}>>;
|
|
28
28
|
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
29
29
|
type: t.LiteralC<import("../WidgetTypes").default.GeoPoint>;
|
|
30
30
|
}>, t.PartialC<{
|
|
31
|
-
fieldset: t.UnionC<[t.
|
|
31
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
32
32
|
config: t.ExactC<t.PartialC<{
|
|
33
|
-
label: t.UnionC<[t.
|
|
33
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
34
34
|
}>>;
|
|
35
35
|
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
36
36
|
type: t.LiteralC<import("../WidgetTypes").default.Date>;
|
|
37
37
|
}>, t.PartialC<{
|
|
38
|
-
fieldset: t.UnionC<[t.
|
|
38
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
39
39
|
config: t.ExactC<t.PartialC<{
|
|
40
|
-
label: t.UnionC<[t.
|
|
40
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
41
41
|
placeholder: t.StringC;
|
|
42
42
|
default: t.StringC;
|
|
43
43
|
}>>;
|
|
44
44
|
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
45
45
|
type: t.LiteralC<import("../WidgetTypes").default.Number>;
|
|
46
46
|
}>, t.PartialC<{
|
|
47
|
-
fieldset: t.UnionC<[t.
|
|
47
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
48
48
|
config: t.ExactC<t.PartialC<{
|
|
49
|
-
label: t.UnionC<[t.
|
|
49
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
50
50
|
placeholder: t.StringC;
|
|
51
|
-
min: t.UnionC<[t.NumberC, import("io-ts-types
|
|
52
|
-
max: t.UnionC<[t.NumberC, import("io-ts-types
|
|
53
|
-
step: t.UnionC<[t.NumberC, import("io-ts-types
|
|
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
54
|
}>>;
|
|
55
55
|
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
56
56
|
type: t.LiteralC<import("../WidgetTypes").default.Range>;
|
|
57
57
|
}>, t.PartialC<{
|
|
58
|
-
fieldset: t.UnionC<[t.
|
|
58
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
59
59
|
config: t.ExactC<t.PartialC<{
|
|
60
|
-
label: t.UnionC<[t.
|
|
60
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
61
61
|
placeholder: t.StringC;
|
|
62
|
-
min: t.UnionC<[t.NumberC, import("io-ts-types
|
|
63
|
-
max: t.UnionC<[t.NumberC, import("io-ts-types
|
|
64
|
-
step: t.UnionC<[t.NumberC, import("io-ts-types
|
|
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
65
|
}>>;
|
|
66
66
|
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
67
67
|
type: t.LiteralC<import("../WidgetTypes").default.RichText>;
|
|
68
68
|
}>, t.PartialC<{
|
|
69
|
-
fieldset: t.UnionC<[t.
|
|
69
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
70
70
|
config: t.ExactC<t.PartialC<{
|
|
71
|
-
label: t.UnionC<[t.
|
|
71
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
72
72
|
placeholder: t.StringC;
|
|
73
73
|
useAsTitle: t.BooleanC;
|
|
74
74
|
single: t.Type<string, string, unknown>;
|
|
75
75
|
multi: t.Type<string, string, unknown>;
|
|
76
76
|
imageConstraint: t.PartialC<{
|
|
77
|
-
width: t.Type<number | null,
|
|
78
|
-
height: t.Type<number | null,
|
|
77
|
+
width: t.Type<number | null, unknown, unknown>;
|
|
78
|
+
height: t.Type<number | null, unknown, unknown>;
|
|
79
79
|
}>;
|
|
80
80
|
labels: t.Type<string[], object, unknown>;
|
|
81
81
|
allowTargetBlank: t.BooleanC;
|
|
@@ -83,43 +83,43 @@ declare const NestableWidget: t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
83
83
|
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
84
84
|
type: t.LiteralC<import("../WidgetTypes").default.Select>;
|
|
85
85
|
}>, t.PartialC<{
|
|
86
|
-
fieldset: t.UnionC<[t.
|
|
86
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
87
87
|
config: t.ExactC<t.PartialC<{
|
|
88
|
-
label: t.UnionC<[t.
|
|
88
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
89
89
|
placeholder: t.StringC;
|
|
90
90
|
default_value: t.StringC;
|
|
91
|
-
options: t.ArrayC<t.UnionC<[t.StringC,
|
|
91
|
+
options: t.ArrayC<t.UnionC<[t.StringC, t.Type<string, string, unknown>, t.Type<string, string, unknown>]>>;
|
|
92
92
|
}>>;
|
|
93
93
|
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
94
94
|
type: t.LiteralC<import("../WidgetTypes").default.Separator>;
|
|
95
95
|
}>, t.PartialC<{
|
|
96
96
|
config: t.ExactC<t.PartialC<{
|
|
97
|
-
label: t.UnionC<[t.
|
|
97
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
98
98
|
}>>;
|
|
99
99
|
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
100
100
|
type: t.LiteralC<import("../WidgetTypes").default.Text>;
|
|
101
101
|
}>, t.PartialC<{
|
|
102
|
-
fieldset: t.UnionC<[t.
|
|
102
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
103
103
|
config: t.ExactC<t.PartialC<{
|
|
104
|
-
label: t.UnionC<[t.
|
|
104
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
105
105
|
useAsTitle: t.BooleanC;
|
|
106
106
|
placeholder: t.StringC;
|
|
107
107
|
}>>;
|
|
108
108
|
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
109
109
|
type: t.LiteralC<import("../WidgetTypes").default.Timestamp>;
|
|
110
110
|
}>, t.PartialC<{
|
|
111
|
-
fieldset: t.UnionC<[t.
|
|
111
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
112
112
|
config: t.ExactC<t.PartialC<{
|
|
113
|
-
label: t.UnionC<[t.
|
|
113
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
114
114
|
placeholder: t.StringC;
|
|
115
115
|
default: t.StringC;
|
|
116
116
|
}>>;
|
|
117
117
|
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
118
118
|
type: t.LiteralC<import("../WidgetTypes").default.Link>;
|
|
119
119
|
}>, t.PartialC<{
|
|
120
|
-
fieldset: t.UnionC<[t.
|
|
120
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
121
121
|
config: t.ExactC<t.PartialC<{
|
|
122
|
-
label: t.UnionC<[t.
|
|
122
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
123
123
|
useAsTitle: t.BooleanC;
|
|
124
124
|
placeholder: t.StringC;
|
|
125
125
|
select: t.UnionC<[t.LiteralC<"media">, t.LiteralC<"document">, t.LiteralC<"web">, t.NullC]>;
|
|
@@ -131,27 +131,27 @@ declare const NestableWidget: t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
131
131
|
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
132
132
|
type: t.LiteralC<import("../WidgetTypes").default.Image>;
|
|
133
133
|
}>, t.PartialC<{
|
|
134
|
-
fieldset: t.UnionC<[t.
|
|
134
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
135
135
|
config: t.ExactC<t.PartialC<{
|
|
136
|
-
label: t.UnionC<[t.
|
|
136
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
137
137
|
placeholder: t.StringC;
|
|
138
138
|
constraint: t.PartialC<{
|
|
139
|
-
width: t.Type<number | null,
|
|
140
|
-
height: t.Type<number | null,
|
|
139
|
+
width: t.Type<number | null, unknown, unknown>;
|
|
140
|
+
height: t.Type<number | null, unknown, unknown>;
|
|
141
141
|
}>;
|
|
142
142
|
thumbnails: t.ArrayC<t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
143
143
|
name: t.StringC;
|
|
144
144
|
}>, t.PartialC<{
|
|
145
|
-
width: t.Type<number | null,
|
|
146
|
-
height: t.Type<number | null,
|
|
145
|
+
width: t.Type<number | null, unknown, unknown>;
|
|
146
|
+
height: t.Type<number | null, unknown, unknown>;
|
|
147
147
|
}>]>>>;
|
|
148
148
|
}>>;
|
|
149
149
|
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
150
150
|
type: t.LiteralC<import("../WidgetTypes").default.IntegrationField>;
|
|
151
151
|
}>, t.PartialC<{
|
|
152
|
-
fieldset: t.UnionC<[t.
|
|
152
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
153
153
|
config: t.ExactC<t.PartialC<{
|
|
154
|
-
label: t.UnionC<[t.
|
|
154
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
155
155
|
placeholder: t.StringC;
|
|
156
156
|
catalog: t.StringC;
|
|
157
157
|
}>>;
|
|
@@ -23,11 +23,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
const t = __importStar(require("io-ts"));
|
|
26
|
-
const Color_1 = __importDefault(require("./Color"));
|
|
27
26
|
const BooleanField_1 = __importDefault(require("./BooleanField"));
|
|
27
|
+
const Color_1 = __importDefault(require("./Color"));
|
|
28
28
|
const Date_1 = __importDefault(require("./Date"));
|
|
29
29
|
const Embed_1 = __importDefault(require("./Embed"));
|
|
30
30
|
const GeoPoint_1 = __importDefault(require("./GeoPoint"));
|
|
31
|
+
const Image_1 = __importDefault(require("./Image"));
|
|
32
|
+
const IntegrationField_1 = __importDefault(require("./IntegrationField"));
|
|
33
|
+
const Link_1 = __importDefault(require("./Link"));
|
|
31
34
|
const Number_1 = __importDefault(require("./Number"));
|
|
32
35
|
const Range_1 = __importDefault(require("./Range"));
|
|
33
36
|
const RichText_1 = __importDefault(require("./RichText"));
|
|
@@ -35,9 +38,6 @@ const Select_1 = __importDefault(require("./Select"));
|
|
|
35
38
|
const Separator_1 = __importDefault(require("./Separator"));
|
|
36
39
|
const Text_1 = __importDefault(require("./Text"));
|
|
37
40
|
const Timestamp_1 = __importDefault(require("./Timestamp"));
|
|
38
|
-
const Link_1 = __importDefault(require("./Link"));
|
|
39
|
-
const Image_1 = __importDefault(require("./Image"));
|
|
40
|
-
const IntegrationField_1 = __importDefault(require("./IntegrationField"));
|
|
41
41
|
const NestableWidget = t.union([
|
|
42
42
|
Color_1.default,
|
|
43
43
|
BooleanField_1.default,
|
|
@@ -53,6 +53,6 @@ const NestableWidget = t.union([
|
|
|
53
53
|
Timestamp_1.default,
|
|
54
54
|
Link_1.default,
|
|
55
55
|
Image_1.default,
|
|
56
|
-
IntegrationField_1.default
|
|
56
|
+
IntegrationField_1.default,
|
|
57
57
|
]);
|
|
58
58
|
exports.default = NestableWidget;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as t from
|
|
2
|
-
import WidgetTypes from
|
|
1
|
+
import * as t from "io-ts";
|
|
2
|
+
import WidgetTypes from "../WidgetTypes";
|
|
3
3
|
declare const Number: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
4
4
|
type: t.LiteralC<WidgetTypes.Number>;
|
|
5
5
|
}>, t.PartialC<{
|
|
6
|
-
fieldset: t.UnionC<[t.
|
|
6
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
7
7
|
config: t.ExactC<t.PartialC<{
|
|
8
|
-
label: t.UnionC<[t.
|
|
8
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
9
9
|
placeholder: t.StringC;
|
|
10
10
|
min: t.UnionC<[t.NumberC, import("io-ts-types/lib/NumberFromString").NumberFromStringC]>;
|
|
11
11
|
max: t.UnionC<[t.NumberC, import("io-ts-types/lib/NumberFromString").NumberFromStringC]>;
|
|
@@ -23,23 +23,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
const t = __importStar(require("io-ts"));
|
|
26
|
-
const StringOrNull_1 = require("../../../validators/StringOrNull");
|
|
27
|
-
const WidgetTypes_1 = __importDefault(require("../WidgetTypes"));
|
|
28
26
|
const NumberFromString_1 = require("io-ts-types/lib/NumberFromString");
|
|
27
|
+
const validators_1 = require("../../../validators");
|
|
28
|
+
const WidgetTypes_1 = __importDefault(require("../WidgetTypes"));
|
|
29
29
|
const NumberConfig = t.exact(t.partial({
|
|
30
|
-
label:
|
|
30
|
+
label: validators_1.StringOrNull,
|
|
31
31
|
placeholder: t.string,
|
|
32
32
|
min: t.union([t.number, NumberFromString_1.NumberFromString]),
|
|
33
33
|
max: t.union([t.number, NumberFromString_1.NumberFromString]),
|
|
34
|
-
step: t.union([t.number, NumberFromString_1.NumberFromString])
|
|
34
|
+
step: t.union([t.number, NumberFromString_1.NumberFromString]),
|
|
35
35
|
}));
|
|
36
36
|
const Number = t.exact(t.intersection([
|
|
37
37
|
t.type({
|
|
38
|
-
type: t.literal(WidgetTypes_1.default.Number)
|
|
38
|
+
type: t.literal(WidgetTypes_1.default.Number),
|
|
39
39
|
}),
|
|
40
40
|
t.partial({
|
|
41
|
-
fieldset:
|
|
42
|
-
config: NumberConfig
|
|
43
|
-
})
|
|
41
|
+
fieldset: validators_1.StringOrNull,
|
|
42
|
+
config: NumberConfig,
|
|
43
|
+
}),
|
|
44
44
|
]));
|
|
45
45
|
exports.default = Number;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as t from
|
|
2
|
-
import WidgetTypes from
|
|
1
|
+
import * as t from "io-ts";
|
|
2
|
+
import WidgetTypes from "../WidgetTypes";
|
|
3
3
|
declare const Range: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
4
4
|
type: t.LiteralC<WidgetTypes.Range>;
|
|
5
5
|
}>, t.PartialC<{
|
|
6
|
-
fieldset: t.UnionC<[t.
|
|
6
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
7
7
|
config: t.ExactC<t.PartialC<{
|
|
8
|
-
label: t.UnionC<[t.
|
|
8
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
9
9
|
placeholder: t.StringC;
|
|
10
10
|
min: t.UnionC<[t.NumberC, import("io-ts-types/lib/NumberFromString").NumberFromStringC]>;
|
|
11
11
|
max: t.UnionC<[t.NumberC, import("io-ts-types/lib/NumberFromString").NumberFromStringC]>;
|
|
@@ -23,11 +23,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
const t = __importStar(require("io-ts"));
|
|
26
|
-
const StringOrNull_1 = require("../../../validators/StringOrNull");
|
|
27
|
-
const WidgetTypes_1 = __importDefault(require("../WidgetTypes"));
|
|
28
26
|
const NumberFromString_1 = require("io-ts-types/lib/NumberFromString");
|
|
27
|
+
const validators_1 = require("../../../validators");
|
|
28
|
+
const WidgetTypes_1 = __importDefault(require("../WidgetTypes"));
|
|
29
29
|
const RangeConfig = t.exact(t.partial({
|
|
30
|
-
label:
|
|
30
|
+
label: validators_1.StringOrNull,
|
|
31
31
|
placeholder: t.string,
|
|
32
32
|
min: t.union([t.number, NumberFromString_1.NumberFromString]),
|
|
33
33
|
max: t.union([t.number, NumberFromString_1.NumberFromString]),
|
|
@@ -35,11 +35,11 @@ const RangeConfig = t.exact(t.partial({
|
|
|
35
35
|
}));
|
|
36
36
|
const Range = t.exact(t.intersection([
|
|
37
37
|
t.type({
|
|
38
|
-
type: t.literal(WidgetTypes_1.default.Range)
|
|
38
|
+
type: t.literal(WidgetTypes_1.default.Range),
|
|
39
39
|
}),
|
|
40
40
|
t.partial({
|
|
41
|
-
fieldset:
|
|
42
|
-
config: RangeConfig
|
|
43
|
-
})
|
|
41
|
+
fieldset: validators_1.StringOrNull,
|
|
42
|
+
config: RangeConfig,
|
|
43
|
+
}),
|
|
44
44
|
]));
|
|
45
45
|
exports.default = Range;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import * as t from
|
|
2
|
-
import WidgetTypes from
|
|
1
|
+
import * as t from "io-ts";
|
|
2
|
+
import WidgetTypes from "../WidgetTypes";
|
|
3
3
|
declare const RichText: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
4
4
|
type: t.LiteralC<WidgetTypes.RichText>;
|
|
5
5
|
}>, t.PartialC<{
|
|
6
|
-
fieldset: t.UnionC<[t.
|
|
6
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
7
7
|
config: t.ExactC<t.PartialC<{
|
|
8
|
-
label: t.UnionC<[t.
|
|
8
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
9
9
|
placeholder: t.StringC;
|
|
10
10
|
useAsTitle: t.BooleanC;
|
|
11
11
|
single: t.Type<string, string, unknown>;
|
|
12
12
|
multi: t.Type<string, string, unknown>;
|
|
13
13
|
imageConstraint: t.PartialC<{
|
|
14
|
-
width: t.Type<number | null,
|
|
15
|
-
height: t.Type<number | null,
|
|
14
|
+
width: t.Type<number | null, unknown, unknown>;
|
|
15
|
+
height: t.Type<number | null, unknown, unknown>;
|
|
16
16
|
}>;
|
|
17
17
|
labels: t.Type<string[], object, unknown>;
|
|
18
18
|
allowTargetBlank: t.BooleanC;
|
|
@@ -22,44 +22,41 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
const t = __importStar(require("io-ts"));
|
|
26
|
-
const StringOrNull_1 = require("../../../validators/StringOrNull");
|
|
27
25
|
const Either_1 = require("fp-ts/lib/Either");
|
|
28
|
-
const
|
|
26
|
+
const t = __importStar(require("io-ts"));
|
|
27
|
+
const validators_1 = require("../../../validators");
|
|
29
28
|
const ImageConstraint_1 = __importDefault(require("../shared/ImageConstraint"));
|
|
30
|
-
const
|
|
29
|
+
const WidgetTypes_1 = __importDefault(require("../WidgetTypes"));
|
|
30
|
+
const DEFAULT_OPTION = "paragraph";
|
|
31
31
|
const options = [
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
32
|
+
"heading1",
|
|
33
|
+
"heading2",
|
|
34
|
+
"heading3",
|
|
35
|
+
"heading4",
|
|
36
|
+
"heading5",
|
|
37
|
+
"heading6",
|
|
38
|
+
"paragraph",
|
|
39
|
+
"strong",
|
|
40
|
+
"em",
|
|
41
|
+
"preformatted",
|
|
42
|
+
"hyperlink",
|
|
43
|
+
"image",
|
|
44
|
+
"embed",
|
|
45
|
+
"list-item",
|
|
46
|
+
"o-list-item",
|
|
47
|
+
"rtl",
|
|
48
48
|
];
|
|
49
|
-
const RichTextOptions = new t.Type(
|
|
50
|
-
return Either_1.either.chain(t.union([
|
|
51
|
-
t.string,
|
|
52
|
-
t.null
|
|
53
|
-
]).validate(u, context), (s) => {
|
|
49
|
+
const RichTextOptions = new t.Type("RichTextOptions", (u) => typeof u === "string", (u, context) => {
|
|
50
|
+
return Either_1.either.chain(t.union([t.string, t.null]).validate(u, context), (s) => {
|
|
54
51
|
if (!s)
|
|
55
52
|
return t.success(DEFAULT_OPTION);
|
|
56
|
-
const entries = s.split(
|
|
57
|
-
const filtered = entries.filter(entry => options.includes(entry));
|
|
53
|
+
const entries = s.split(",").map((e) => e.trim());
|
|
54
|
+
const filtered = entries.filter((entry) => options.includes(entry));
|
|
58
55
|
if (!filtered.length)
|
|
59
56
|
return t.success(DEFAULT_OPTION);
|
|
60
|
-
return t.success(filtered.join(
|
|
57
|
+
return t.success(filtered.join(","));
|
|
61
58
|
});
|
|
62
|
-
}, a => a);
|
|
59
|
+
}, (a) => a);
|
|
63
60
|
const NoLabels = (labels) => {
|
|
64
61
|
if (!labels)
|
|
65
62
|
return t.success([]);
|
|
@@ -71,12 +68,12 @@ const LabelsAsObject = (labels) => {
|
|
|
71
68
|
if (!Object.entries(labelsObj).length)
|
|
72
69
|
return t.success([]);
|
|
73
70
|
// weird case labels with empty key as parent
|
|
74
|
-
if (labelsObj[
|
|
75
|
-
return t.success(labelsObj[
|
|
71
|
+
if (labelsObj[""]) {
|
|
72
|
+
return t.success(labelsObj[""].map((l) => l.name));
|
|
76
73
|
}
|
|
77
74
|
const convertedObjectToArray = Object.entries(labelsObj)
|
|
78
75
|
.reduce((acc, [, labelsEntries]) => {
|
|
79
|
-
return acc.concat(labelsEntries.map(l => l.name));
|
|
76
|
+
return acc.concat(labelsEntries.map((l) => l.name));
|
|
80
77
|
}, [])
|
|
81
78
|
.filter(Boolean);
|
|
82
79
|
return t.success(convertedObjectToArray);
|
|
@@ -84,51 +81,48 @@ const LabelsAsObject = (labels) => {
|
|
|
84
81
|
};
|
|
85
82
|
const LabelsAsArray = (labels) => {
|
|
86
83
|
if (labels instanceof Array) {
|
|
87
|
-
const isValidLabels = labels.reduce((acc, l) => acc && typeof l ===
|
|
84
|
+
const isValidLabels = labels.reduce((acc, l) => acc && typeof l === "string", true);
|
|
88
85
|
if (isValidLabels)
|
|
89
86
|
return t.success(labels);
|
|
90
87
|
}
|
|
91
88
|
};
|
|
92
89
|
const LabelsAsString = (labels) => {
|
|
93
|
-
if (typeof labels ===
|
|
90
|
+
if (typeof labels === "string") {
|
|
94
91
|
return t.success([labels]);
|
|
95
92
|
}
|
|
96
93
|
};
|
|
97
|
-
const RichTextLabels = new t.Type(
|
|
94
|
+
const RichTextLabels = new t.Type("RichTextLabels", (u) => {
|
|
98
95
|
return u instanceof Array;
|
|
99
96
|
}, (u, context) => {
|
|
100
97
|
const legacyValidator = t.record(t.string, t.array(t.record(t.literal("name"), t.string)));
|
|
101
98
|
const validator = t.array(t.string);
|
|
102
|
-
return Either_1.either.chain(t
|
|
103
|
-
legacyValidator,
|
|
104
|
-
|
|
105
|
-
t.string,
|
|
106
|
-
t.null,
|
|
107
|
-
]).validate(u, context), (labels) => {
|
|
99
|
+
return Either_1.either.chain(t
|
|
100
|
+
.union([legacyValidator, validator, t.string, t.null])
|
|
101
|
+
.validate(u, context), (labels) => {
|
|
108
102
|
return (NoLabels(labels) ||
|
|
109
103
|
LabelsAsArray(labels) ||
|
|
110
104
|
LabelsAsObject(labels) ||
|
|
111
105
|
LabelsAsString(labels) ||
|
|
112
106
|
t.failure(u, context));
|
|
113
107
|
});
|
|
114
|
-
}, res => res);
|
|
108
|
+
}, (res) => res);
|
|
115
109
|
const RichTextConfig = t.exact(t.partial({
|
|
116
|
-
label:
|
|
110
|
+
label: validators_1.StringOrNull,
|
|
117
111
|
placeholder: t.string,
|
|
118
112
|
useAsTitle: t.boolean,
|
|
119
113
|
single: RichTextOptions,
|
|
120
114
|
multi: RichTextOptions,
|
|
121
115
|
imageConstraint: ImageConstraint_1.default,
|
|
122
116
|
labels: RichTextLabels,
|
|
123
|
-
allowTargetBlank: t.boolean
|
|
117
|
+
allowTargetBlank: t.boolean,
|
|
124
118
|
}));
|
|
125
119
|
const RichText = t.exact(t.intersection([
|
|
126
120
|
t.type({
|
|
127
|
-
type: t.literal(WidgetTypes_1.default.RichText)
|
|
121
|
+
type: t.literal(WidgetTypes_1.default.RichText),
|
|
128
122
|
}),
|
|
129
123
|
t.partial({
|
|
130
|
-
fieldset:
|
|
131
|
-
config: RichTextConfig
|
|
132
|
-
})
|
|
124
|
+
fieldset: validators_1.StringOrNull,
|
|
125
|
+
config: RichTextConfig,
|
|
126
|
+
}),
|
|
133
127
|
]));
|
|
134
128
|
exports.default = RichText;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as t from "io-ts";
|
|
2
|
+
import WidgetTypes from "../WidgetTypes";
|
|
3
|
+
declare const Select: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
4
|
+
type: t.LiteralC<WidgetTypes.Select>;
|
|
5
|
+
}>, t.PartialC<{
|
|
6
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
7
|
+
config: t.ExactC<t.PartialC<{
|
|
8
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
9
|
+
placeholder: t.StringC;
|
|
10
|
+
default_value: t.StringC;
|
|
11
|
+
options: t.ArrayC<t.UnionC<[t.StringC, t.Type<string, string, unknown>, t.Type<string, string, unknown>]>>;
|
|
12
|
+
}>>;
|
|
13
|
+
}>]>>;
|
|
14
|
+
declare type Select = t.TypeOf<typeof Select>;
|
|
15
|
+
export default Select;
|
|
@@ -23,23 +23,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
const t = __importStar(require("io-ts"));
|
|
26
|
-
const
|
|
27
|
-
const StringFromBoolean_1 = require("../../../validators/StringFromBoolean");
|
|
26
|
+
const validators_1 = require("../../../validators");
|
|
28
27
|
const WidgetTypes_1 = __importDefault(require("../WidgetTypes"));
|
|
29
|
-
const StringFromNumber_1 = require("../../../validators/StringFromNumber");
|
|
30
28
|
const SelectConfig = t.exact(t.partial({
|
|
31
|
-
label:
|
|
29
|
+
label: validators_1.StringOrNull,
|
|
32
30
|
placeholder: t.string,
|
|
33
31
|
default_value: t.string,
|
|
34
|
-
options: t.array(t.union([t.string,
|
|
32
|
+
options: t.array(t.union([t.string, validators_1.StringFromNumber, validators_1.StringFromBoolean])),
|
|
35
33
|
}));
|
|
36
34
|
const Select = t.exact(t.intersection([
|
|
37
35
|
t.type({
|
|
38
|
-
type: t.literal(WidgetTypes_1.default.Select)
|
|
36
|
+
type: t.literal(WidgetTypes_1.default.Select),
|
|
39
37
|
}),
|
|
40
38
|
t.partial({
|
|
41
|
-
fieldset:
|
|
42
|
-
config: SelectConfig
|
|
43
|
-
})
|
|
39
|
+
fieldset: validators_1.StringOrNull,
|
|
40
|
+
config: SelectConfig,
|
|
41
|
+
}),
|
|
44
42
|
]));
|
|
45
43
|
exports.default = Select;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as t from
|
|
2
|
-
import WidgetTypes from
|
|
1
|
+
import * as t from "io-ts";
|
|
2
|
+
import WidgetTypes from "../WidgetTypes";
|
|
3
3
|
declare const Separator: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
4
4
|
type: t.LiteralC<WidgetTypes.Separator>;
|
|
5
5
|
}>, t.PartialC<{
|
|
6
6
|
config: t.ExactC<t.PartialC<{
|
|
7
|
-
label: t.UnionC<[t.
|
|
7
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
8
8
|
}>>;
|
|
9
9
|
}>]>>;
|
|
10
10
|
declare type Separator = t.TypeOf<typeof Separator>;
|
|
@@ -23,17 +23,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
const t = __importStar(require("io-ts"));
|
|
26
|
-
const
|
|
26
|
+
const validators_1 = require("../../../validators");
|
|
27
27
|
const WidgetTypes_1 = __importDefault(require("../WidgetTypes"));
|
|
28
28
|
const SeparatorConfig = t.exact(t.partial({
|
|
29
|
-
label:
|
|
29
|
+
label: validators_1.StringOrNull,
|
|
30
30
|
}));
|
|
31
31
|
const Separator = t.exact(t.intersection([
|
|
32
32
|
t.type({
|
|
33
|
-
type: t.literal(WidgetTypes_1.default.Separator)
|
|
33
|
+
type: t.literal(WidgetTypes_1.default.Separator),
|
|
34
34
|
}),
|
|
35
35
|
t.partial({
|
|
36
|
-
config: SeparatorConfig
|
|
37
|
-
})
|
|
36
|
+
config: SeparatorConfig,
|
|
37
|
+
}),
|
|
38
38
|
]));
|
|
39
39
|
exports.default = Separator;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as t from
|
|
2
|
-
import WidgetTypes from
|
|
1
|
+
import * as t from "io-ts";
|
|
2
|
+
import WidgetTypes from "../WidgetTypes";
|
|
3
3
|
declare const Text: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
4
4
|
type: t.LiteralC<WidgetTypes.Text>;
|
|
5
5
|
}>, t.PartialC<{
|
|
6
|
-
fieldset: t.UnionC<[t.
|
|
6
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
7
7
|
config: t.ExactC<t.PartialC<{
|
|
8
|
-
label: t.UnionC<[t.
|
|
8
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
9
9
|
useAsTitle: t.BooleanC;
|
|
10
10
|
placeholder: t.StringC;
|
|
11
11
|
}>>;
|
|
@@ -23,20 +23,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
const t = __importStar(require("io-ts"));
|
|
26
|
-
const
|
|
26
|
+
const validators_1 = require("../../../validators");
|
|
27
27
|
const WidgetTypes_1 = __importDefault(require("../WidgetTypes"));
|
|
28
28
|
const TextConfig = t.exact(t.partial({
|
|
29
|
-
label:
|
|
29
|
+
label: validators_1.StringOrNull,
|
|
30
30
|
useAsTitle: t.boolean,
|
|
31
|
-
placeholder: t.string
|
|
31
|
+
placeholder: t.string,
|
|
32
32
|
}));
|
|
33
33
|
const Text = t.exact(t.intersection([
|
|
34
34
|
t.type({
|
|
35
|
-
type: t.literal(WidgetTypes_1.default.Text)
|
|
35
|
+
type: t.literal(WidgetTypes_1.default.Text),
|
|
36
36
|
}),
|
|
37
37
|
t.partial({
|
|
38
|
-
fieldset:
|
|
39
|
-
config: TextConfig
|
|
40
|
-
})
|
|
38
|
+
fieldset: validators_1.StringOrNull,
|
|
39
|
+
config: TextConfig,
|
|
40
|
+
}),
|
|
41
41
|
]));
|
|
42
42
|
exports.default = Text;
|