@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
|
@@ -1,90 +1,18 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
2
|
import type { ContentPath, TraverseWidgetContentFn } from "../../_internal/utils";
|
|
3
|
-
import {
|
|
3
|
+
import type { Link, NestableWidget } from "../../customtypes";
|
|
4
4
|
import type { LegacyContentCtx, WithTypes } from "../LegacyContentCtx";
|
|
5
|
-
export declare const RepeatableContentType: "RepeatableContent";
|
|
6
|
-
export declare const RepeatableFieldType: "Repeatable";
|
|
7
|
-
export declare const RepeatableItemContent: t.ExactC<t.TypeC<{
|
|
8
|
-
__TYPE__: t.LiteralC<"LinkContent">;
|
|
9
|
-
value: t.UnionC<[t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
10
|
-
__TYPE__: t.LiteralC<"ImageLink">;
|
|
11
|
-
}>>, t.UnionC<[t.IntersectionC<[t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
12
|
-
kind: t.StringC;
|
|
13
|
-
id: t.StringC;
|
|
14
|
-
url: t.StringC;
|
|
15
|
-
height: t.StringC;
|
|
16
|
-
width: t.StringC;
|
|
17
|
-
size: t.StringC;
|
|
18
|
-
name: t.StringC;
|
|
19
|
-
}>>, t.ExactC<t.PartialC<{
|
|
20
|
-
date: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
21
|
-
}>>]>, t.ExactC<t.PartialC<{
|
|
22
|
-
text: t.StringC;
|
|
23
|
-
}>>]>, t.ExactC<t.TypeC<{
|
|
24
|
-
kind: t.LiteralC<"image">;
|
|
25
|
-
text: t.StringC;
|
|
26
|
-
}>>]>]>, t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
27
|
-
__TYPE__: t.LiteralC<"FileLink">;
|
|
28
|
-
}>>, t.UnionC<[t.IntersectionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
29
|
-
kind: t.StringC;
|
|
30
|
-
id: t.StringC;
|
|
31
|
-
url: t.StringC;
|
|
32
|
-
name: t.StringC;
|
|
33
|
-
size: t.StringC;
|
|
34
|
-
}>, t.PartialC<{
|
|
35
|
-
date: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
36
|
-
}>]>>, t.ExactC<t.PartialC<{
|
|
37
|
-
text: t.StringC;
|
|
38
|
-
}>>]>, t.ExactC<t.TypeC<{
|
|
39
|
-
kind: t.LiteralC<"file">;
|
|
40
|
-
text: t.StringC;
|
|
41
|
-
}>>]>]>, t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
42
|
-
__TYPE__: t.LiteralC<"DocumentLink">;
|
|
43
|
-
}>>, t.UnionC<[t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
44
|
-
id: t.Type<string, string, unknown>;
|
|
45
|
-
}>>, t.ExactC<t.PartialC<{
|
|
46
|
-
text: t.StringC;
|
|
47
|
-
}>>]>, t.ExactC<t.TypeC<{
|
|
48
|
-
kind: t.LiteralC<"document">;
|
|
49
|
-
text: t.StringC;
|
|
50
|
-
}>>]>]>, t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
51
|
-
__TYPE__: t.LiteralC<"ExternalLink">;
|
|
52
|
-
}>>, t.UnionC<[t.IntersectionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
53
|
-
url: t.StringC;
|
|
54
|
-
}>, t.PartialC<{
|
|
55
|
-
kind: t.LiteralC<"web">;
|
|
56
|
-
target: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
57
|
-
preview: t.UnionC<[t.Type<{
|
|
58
|
-
title?: string;
|
|
59
|
-
}, {
|
|
60
|
-
title?: string;
|
|
61
|
-
}, unknown>, t.NullC, t.UndefinedC]>;
|
|
62
|
-
}>]>>, t.ExactC<t.PartialC<{
|
|
63
|
-
text: t.StringC;
|
|
64
|
-
}>>]>, t.ExactC<t.TypeC<{
|
|
65
|
-
kind: t.LiteralC<"web">;
|
|
66
|
-
text: t.StringC;
|
|
67
|
-
}>>]>]>, t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
68
|
-
__TYPE__: t.LiteralC<"MediaLink">;
|
|
69
|
-
}>>, t.ExactC<t.TypeC<{
|
|
70
|
-
kind: t.LiteralC<"media">;
|
|
71
|
-
text: t.StringC;
|
|
72
|
-
}>>]>, t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
73
|
-
__TYPE__: t.LiteralC<"AnyLink">;
|
|
74
|
-
}>>, t.ExactC<t.TypeC<{
|
|
75
|
-
text: t.StringC;
|
|
76
|
-
}>>]>]>;
|
|
77
|
-
}>>;
|
|
78
|
-
export declare type RepeatableItemContent = t.TypeOf<typeof RepeatableItemContent>;
|
|
79
5
|
export declare const RepeatableContent: t.ExactC<t.TypeC<{
|
|
80
6
|
__TYPE__: t.LiteralC<"RepeatableContent">;
|
|
81
|
-
type: t.
|
|
82
|
-
value: t.ArrayC<t.ExactC<t.TypeC<{
|
|
7
|
+
type: t.LiteralC<"Link">;
|
|
8
|
+
value: t.ArrayC<t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
9
|
+
key: t.Type<string, string, unknown>;
|
|
10
|
+
}>>, t.ExactC<t.TypeC<{
|
|
83
11
|
__TYPE__: t.LiteralC<"LinkContent">;
|
|
84
12
|
value: t.UnionC<[t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
85
13
|
__TYPE__: t.LiteralC<"ImageLink">;
|
|
86
|
-
}>>, t.
|
|
87
|
-
kind: t.
|
|
14
|
+
}>>, t.IntersectionC<[t.UnionC<[t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
15
|
+
kind: t.Type<"image", "image", unknown>;
|
|
88
16
|
id: t.StringC;
|
|
89
17
|
url: t.StringC;
|
|
90
18
|
height: t.StringC;
|
|
@@ -93,38 +21,35 @@ export declare const RepeatableContent: t.ExactC<t.TypeC<{
|
|
|
93
21
|
name: t.StringC;
|
|
94
22
|
}>>, t.ExactC<t.PartialC<{
|
|
95
23
|
date: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
96
|
-
}>>]>, t.ExactC<t.PartialC<{
|
|
97
|
-
text: t.StringC;
|
|
98
24
|
}>>]>, t.ExactC<t.TypeC<{
|
|
99
25
|
kind: t.LiteralC<"image">;
|
|
26
|
+
}>>]>, t.ExactC<t.PartialC<{
|
|
100
27
|
text: t.StringC;
|
|
101
28
|
}>>]>]>, t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
102
29
|
__TYPE__: t.LiteralC<"FileLink">;
|
|
103
|
-
}>>, t.
|
|
104
|
-
kind: t.
|
|
30
|
+
}>>, t.IntersectionC<[t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
31
|
+
kind: t.Type<"file", "file", unknown>;
|
|
105
32
|
id: t.StringC;
|
|
106
33
|
url: t.StringC;
|
|
107
34
|
name: t.StringC;
|
|
108
35
|
size: t.StringC;
|
|
109
36
|
}>, t.PartialC<{
|
|
110
37
|
date: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
111
|
-
}>]>>, t.ExactC<t.
|
|
112
|
-
text: t.StringC;
|
|
113
|
-
}>>]>, t.ExactC<t.TypeC<{
|
|
38
|
+
}>]>>, t.ExactC<t.TypeC<{
|
|
114
39
|
kind: t.LiteralC<"file">;
|
|
40
|
+
}>>]>, t.ExactC<t.PartialC<{
|
|
115
41
|
text: t.StringC;
|
|
116
42
|
}>>]>]>, t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
117
43
|
__TYPE__: t.LiteralC<"DocumentLink">;
|
|
118
|
-
}>>, t.
|
|
44
|
+
}>>, t.IntersectionC<[t.UnionC<[t.ExactC<t.TypeC<{
|
|
119
45
|
id: t.Type<string, string, unknown>;
|
|
120
|
-
}>>, t.ExactC<t.
|
|
121
|
-
text: t.StringC;
|
|
122
|
-
}>>]>, t.ExactC<t.TypeC<{
|
|
46
|
+
}>>, t.ExactC<t.TypeC<{
|
|
123
47
|
kind: t.LiteralC<"document">;
|
|
48
|
+
}>>]>, t.ExactC<t.PartialC<{
|
|
124
49
|
text: t.StringC;
|
|
125
50
|
}>>]>]>, t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
126
51
|
__TYPE__: t.LiteralC<"ExternalLink">;
|
|
127
|
-
}>>, t.
|
|
52
|
+
}>>, t.IntersectionC<[t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
128
53
|
url: t.StringC;
|
|
129
54
|
}>, t.PartialC<{
|
|
130
55
|
kind: t.LiteralC<"web">;
|
|
@@ -134,33 +59,37 @@ export declare const RepeatableContent: t.ExactC<t.TypeC<{
|
|
|
134
59
|
}, {
|
|
135
60
|
title?: string;
|
|
136
61
|
}, unknown>, t.NullC, t.UndefinedC]>;
|
|
137
|
-
}>]>>, t.ExactC<t.
|
|
138
|
-
text: t.StringC;
|
|
139
|
-
}>>]>, t.ExactC<t.TypeC<{
|
|
62
|
+
}>]>>, t.ExactC<t.TypeC<{
|
|
140
63
|
kind: t.LiteralC<"web">;
|
|
64
|
+
}>>]>, t.ExactC<t.PartialC<{
|
|
141
65
|
text: t.StringC;
|
|
142
66
|
}>>]>]>, t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
143
67
|
__TYPE__: t.LiteralC<"MediaLink">;
|
|
144
|
-
}>>, t.ExactC<t.TypeC<{
|
|
68
|
+
}>>, t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
145
69
|
kind: t.LiteralC<"media">;
|
|
70
|
+
}>>, t.ExactC<t.PartialC<{
|
|
146
71
|
text: t.StringC;
|
|
147
|
-
}>>]>, t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
72
|
+
}>>]>]>, t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
148
73
|
__TYPE__: t.LiteralC<"AnyLink">;
|
|
149
|
-
}>>, t.ExactC<t.TypeC<{
|
|
74
|
+
}>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
75
|
+
kind: t.LiteralC<"any">;
|
|
76
|
+
}>, t.PartialC<{
|
|
150
77
|
text: t.StringC;
|
|
151
|
-
}>>]>]>;
|
|
152
|
-
}
|
|
78
|
+
}>]>>]>]>;
|
|
79
|
+
}>>]>>;
|
|
153
80
|
}>>;
|
|
154
81
|
export declare type RepeatableContent = t.TypeOf<typeof RepeatableContent>;
|
|
155
82
|
export declare const isRepeatableContent: t.Is<{
|
|
156
83
|
__TYPE__: "RepeatableContent";
|
|
157
|
-
type: "
|
|
158
|
-
value: {
|
|
84
|
+
type: "Link";
|
|
85
|
+
value: ({
|
|
86
|
+
key: string;
|
|
87
|
+
} & {
|
|
159
88
|
__TYPE__: "LinkContent";
|
|
160
89
|
value: ({
|
|
161
90
|
__TYPE__: "ImageLink";
|
|
162
|
-
} & (({
|
|
163
|
-
kind:
|
|
91
|
+
} & ((({
|
|
92
|
+
kind: "image";
|
|
164
93
|
id: string;
|
|
165
94
|
url: string;
|
|
166
95
|
height: string;
|
|
@@ -169,43 +98,41 @@ export declare const isRepeatableContent: t.Is<{
|
|
|
169
98
|
name: string;
|
|
170
99
|
} & {
|
|
171
100
|
date?: string | null | undefined;
|
|
172
|
-
} & {
|
|
173
|
-
text?: string;
|
|
174
101
|
}) | {
|
|
175
102
|
kind: "image";
|
|
176
|
-
|
|
103
|
+
}) & {
|
|
104
|
+
text?: string;
|
|
177
105
|
})) | ({
|
|
178
106
|
__TYPE__: "FileLink";
|
|
179
|
-
} & (({
|
|
180
|
-
kind:
|
|
107
|
+
} & ((({
|
|
108
|
+
kind: "file";
|
|
181
109
|
id: string;
|
|
182
110
|
url: string;
|
|
183
111
|
name: string;
|
|
184
112
|
size: string;
|
|
185
113
|
} & {
|
|
186
114
|
date?: string | null | undefined;
|
|
187
|
-
} & {
|
|
188
|
-
text?: string;
|
|
189
115
|
}) | {
|
|
190
116
|
kind: "file";
|
|
191
|
-
|
|
117
|
+
}) & {
|
|
118
|
+
text?: string;
|
|
192
119
|
})) | ({
|
|
193
120
|
__TYPE__: "MediaLink";
|
|
194
121
|
} & {
|
|
195
122
|
kind: "media";
|
|
196
|
-
|
|
123
|
+
} & {
|
|
124
|
+
text?: string;
|
|
197
125
|
}) | ({
|
|
198
126
|
__TYPE__: "DocumentLink";
|
|
199
127
|
} & (({
|
|
200
128
|
id: string;
|
|
201
|
-
}
|
|
202
|
-
text?: string;
|
|
203
|
-
}) | {
|
|
129
|
+
} | {
|
|
204
130
|
kind: "document";
|
|
205
|
-
|
|
131
|
+
}) & {
|
|
132
|
+
text?: string;
|
|
206
133
|
})) | ({
|
|
207
134
|
__TYPE__: "ExternalLink";
|
|
208
|
-
} & (({
|
|
135
|
+
} & ((({
|
|
209
136
|
url: string;
|
|
210
137
|
} & {
|
|
211
138
|
kind?: "web";
|
|
@@ -213,19 +140,20 @@ export declare const isRepeatableContent: t.Is<{
|
|
|
213
140
|
preview?: {
|
|
214
141
|
title?: string;
|
|
215
142
|
} | null | undefined;
|
|
216
|
-
} & {
|
|
217
|
-
text?: string;
|
|
218
143
|
}) | {
|
|
219
144
|
kind: "web";
|
|
220
|
-
|
|
145
|
+
}) & {
|
|
146
|
+
text?: string;
|
|
221
147
|
})) | ({
|
|
222
148
|
__TYPE__: "AnyLink";
|
|
223
149
|
} & {
|
|
224
|
-
|
|
150
|
+
kind: "any";
|
|
151
|
+
} & {
|
|
152
|
+
text?: string;
|
|
225
153
|
});
|
|
226
|
-
}[];
|
|
154
|
+
})[];
|
|
227
155
|
}>;
|
|
228
|
-
export declare const RepeatableLegacy: (ctx: LegacyContentCtx, fieldType:
|
|
156
|
+
export declare const RepeatableLegacy: (ctx: LegacyContentCtx, fieldType: "Link") => t.Type<RepeatableContent, WithTypes<Array<unknown>>, unknown>;
|
|
229
157
|
export declare type RepeatableCustomType = Link;
|
|
230
158
|
export declare function traverseRepeatableContent({ path, key, apiId, model, content, }: {
|
|
231
159
|
path: ContentPath;
|
|
@@ -1,28 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.traverseRepeatableContent = exports.RepeatableLegacy = exports.isRepeatableContent = exports.RepeatableContent =
|
|
3
|
+
exports.traverseRepeatableContent = exports.RepeatableLegacy = exports.isRepeatableContent = exports.RepeatableContent = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const fp_ts_1 = require("fp-ts");
|
|
6
6
|
const Either_1 = require("fp-ts/lib/Either");
|
|
7
7
|
const function_1 = require("fp-ts/lib/function");
|
|
8
8
|
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
9
|
-
const customtypes_1 = require("../../customtypes");
|
|
10
9
|
const nestable_1 = require("./nestable");
|
|
11
|
-
exports.RepeatableContentType = "RepeatableContent";
|
|
12
|
-
exports.RepeatableFieldType = "Repeatable";
|
|
13
|
-
exports.RepeatableItemContent = nestable_1.LinkContent;
|
|
14
10
|
exports.RepeatableContent = t.strict({
|
|
15
|
-
__TYPE__: t.literal(
|
|
16
|
-
type:
|
|
17
|
-
|
|
18
|
-
value: t.array(exports.RepeatableItemContent),
|
|
11
|
+
__TYPE__: t.literal("RepeatableContent"),
|
|
12
|
+
type: t.literal("Link"),
|
|
13
|
+
value: t.array(nestable_1.LinkContent),
|
|
19
14
|
});
|
|
20
15
|
exports.isRepeatableContent = exports.RepeatableContent.is;
|
|
21
16
|
const RepeatableLegacy = (ctx, fieldType) => {
|
|
22
|
-
const codecDecode = t.array(t.unknown);
|
|
23
|
-
const codecEncode = t.array(exports.RepeatableItemContent);
|
|
24
17
|
return new t.Type("RepeatableLegacy", exports.isRepeatableContent, (items) => {
|
|
25
|
-
const parsed = (0, function_1.pipe)(
|
|
18
|
+
const parsed = (0, function_1.pipe)(t.array(t.unknown).decode(items), fp_ts_1.either.map((items) => {
|
|
26
19
|
const parsedItems = items.reduce((acc, item) => {
|
|
27
20
|
let result;
|
|
28
21
|
switch (fieldType) {
|
|
@@ -39,12 +32,12 @@ const RepeatableLegacy = (ctx, fieldType) => {
|
|
|
39
32
|
return {
|
|
40
33
|
value: parsedItems,
|
|
41
34
|
type: fieldType,
|
|
42
|
-
__TYPE__:
|
|
35
|
+
__TYPE__: "RepeatableContent",
|
|
43
36
|
};
|
|
44
37
|
}));
|
|
45
38
|
return parsed;
|
|
46
39
|
}, (r) => {
|
|
47
|
-
const res =
|
|
40
|
+
const res = t.array(nestable_1.LinkContent).encode(r.value);
|
|
48
41
|
const encodedItems = res.reduce((acc, item) => {
|
|
49
42
|
let encoded;
|
|
50
43
|
switch (item.__TYPE__) {
|
|
@@ -79,6 +72,9 @@ function traverseRepeatableContent({ path, key, apiId, model, content, }) {
|
|
|
79
72
|
// Can happen if the transform function returns undefined to filter out a field
|
|
80
73
|
if (!transformedField)
|
|
81
74
|
return acc;
|
|
75
|
+
// If the transformed field is not a link content, we don't include it
|
|
76
|
+
if (!(0, nestable_1.isLinkContent)(transformedField))
|
|
77
|
+
return acc;
|
|
82
78
|
return acc.concat(transformedField);
|
|
83
79
|
}, []);
|
|
84
80
|
return transform({
|