@prismicio/types-internal 2.7.0-alpha.3 → 2.7.0-alpha.4
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/Document.d.ts +2118 -798
- package/lib/content/fields/WidgetContent.d.ts +2118 -798
- package/lib/content/fields/nestable/LinkContent.d.ts +248 -85
- package/lib/content/fields/nestable/LinkContent.js +96 -42
- package/lib/content/fields/nestable/NestableContent.d.ts +353 -133
- package/lib/content/fields/nestable/RichTextContent/Blocks.d.ts +654 -234
- package/lib/content/fields/nestable/RichTextContent/index.d.ts +320 -120
- package/lib/content/fields/slices/Slice/CompositeSliceContent.d.ts +706 -266
- package/lib/content/fields/slices/Slice/RepeatableContent.d.ts +161 -61
- package/lib/content/fields/slices/Slice/SharedSliceContent.d.ts +706 -266
- package/lib/content/fields/slices/Slice/SimpleSliceContent.d.ts +353 -133
- package/lib/content/fields/slices/Slice/SlicePrimaryContent.d.ts +353 -133
- package/lib/content/fields/slices/Slice/index.d.ts +1285 -485
- package/lib/content/fields/slices/SliceItem.d.ts +1285 -485
- package/lib/content/fields/slices/SlicesContent.d.ts +1766 -666
- package/lib/customtypes/CustomType.d.ts +18 -320
- package/lib/customtypes/Section.d.ts +18 -320
- package/lib/customtypes/diff/SharedSlice.d.ts +8 -160
- package/lib/customtypes/diff/Variation.d.ts +8 -160
- package/lib/customtypes/widgets/Group.d.ts +18 -315
- package/lib/customtypes/widgets/Group.js +5 -43
- package/lib/customtypes/widgets/Widget.d.ts +33 -412
- package/lib/customtypes/widgets/nestable/Link.d.ts +2 -0
- package/lib/customtypes/widgets/nestable/Link.js +1 -0
- package/lib/customtypes/widgets/nestable/NestableWidget.d.ts +1 -0
- package/lib/customtypes/widgets/slices/CompositeSlice.d.ts +2 -0
- package/lib/customtypes/widgets/slices/LegacySlice.d.ts +4 -42
- package/lib/customtypes/widgets/slices/SharedSlice.d.ts +16 -168
- package/lib/customtypes/widgets/slices/SlicePrimaryWidget.d.ts +10 -164
- package/lib/customtypes/widgets/slices/Slices.d.ts +34 -366
- package/package.json +1 -1
- package/src/content/fields/nestable/LinkContent.ts +121 -50
- package/src/customtypes/widgets/Group.ts +6 -52
- package/src/customtypes/widgets/nestable/Link.ts +1 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LinkContent = exports.Link = exports.LinkContentLegacy = exports.LinkLegacy = exports.isLinkContent = exports.LinkContentType = exports.ExternalLinkContent = exports.ExternalLinkType = exports.DocumentLinkContent = exports.DocumentLinkType = exports.FileLinkContent = exports.FileLinkType = exports.ImageLinkContent = exports.ImageLinkType = void 0;
|
|
3
|
+
exports.LinkContent = exports.Link = exports.LinkContentLegacy = exports.LinkLegacy = exports.isLinkContent = exports.LinkContentType = exports.AnyLinkContent = exports.AnyLinkType = exports.ExternalLinkContent = exports.ExternalLinkType = exports.DocumentLinkContent = exports.DocumentLinkType = exports.FileLinkContent = exports.FileLinkType = exports.ImageLinkContent = exports.ImageLinkType = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const fp_ts_1 = require("fp-ts");
|
|
6
6
|
const function_1 = require("fp-ts/lib/function");
|
|
@@ -10,20 +10,28 @@ const validators_1 = require("../../../validators");
|
|
|
10
10
|
const function_2 = require("../../../validators/function");
|
|
11
11
|
const utils_1 = require("../../utils");
|
|
12
12
|
exports.ImageLinkType = "ImageLink";
|
|
13
|
-
const imageLinkLegacyCodec = t.
|
|
14
|
-
t.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
13
|
+
const imageLinkLegacyCodec = t.intersection([
|
|
14
|
+
t.strict({ kind: t.literal("image") }),
|
|
15
|
+
t.union([
|
|
16
|
+
t.exact(t.intersection([
|
|
17
|
+
t.type({
|
|
18
|
+
id: t.string,
|
|
19
|
+
url: t.string,
|
|
20
|
+
height: t.string,
|
|
21
|
+
width: t.string,
|
|
22
|
+
size: t.string,
|
|
23
|
+
name: t.string,
|
|
24
|
+
}),
|
|
25
|
+
t.partial({
|
|
26
|
+
date: validators_1.StringOrNull,
|
|
27
|
+
text: t.string,
|
|
28
|
+
}),
|
|
29
|
+
])),
|
|
30
|
+
t.strict({
|
|
31
|
+
text: t.string,
|
|
32
|
+
}),
|
|
33
|
+
]),
|
|
34
|
+
]);
|
|
27
35
|
const ImageLinkLegacy = new t.Type("ImageLink", (u) => (0, utils_1.hasContentType)(u) && u.__TYPE__ === exports.ImageLinkType, (image) => {
|
|
28
36
|
return (0, function_1.pipe)(imageLinkLegacyCodec.decode(image), fp_ts_1.either.map((parsedImage) => {
|
|
29
37
|
return exports.ImageLinkContent.encode({
|
|
@@ -41,18 +49,28 @@ exports.ImageLinkContent = t.intersection([
|
|
|
41
49
|
imageLinkLegacyCodec,
|
|
42
50
|
]);
|
|
43
51
|
exports.FileLinkType = "FileLink";
|
|
44
|
-
const fileLinkLegacyCodec = t.
|
|
45
|
-
t.
|
|
46
|
-
|
|
47
|
-
url: t.string,
|
|
48
|
-
name: t.string,
|
|
49
|
-
kind: t.string,
|
|
50
|
-
size: (0, io_ts_types_1.withFallback)(t.string, "0"),
|
|
51
|
-
}),
|
|
52
|
-
t.partial({
|
|
53
|
-
date: (0, function_2.nullable)(t.string),
|
|
52
|
+
const fileLinkLegacyCodec = t.intersection([
|
|
53
|
+
t.strict({
|
|
54
|
+
kind: t.literal("file"),
|
|
54
55
|
}),
|
|
55
|
-
|
|
56
|
+
t.union([
|
|
57
|
+
t.exact(t.intersection([
|
|
58
|
+
t.type({
|
|
59
|
+
id: t.string,
|
|
60
|
+
url: t.string,
|
|
61
|
+
name: t.string,
|
|
62
|
+
size: (0, io_ts_types_1.withFallback)(t.string, "0"),
|
|
63
|
+
}),
|
|
64
|
+
t.partial({
|
|
65
|
+
date: validators_1.StringOrNull,
|
|
66
|
+
text: t.string,
|
|
67
|
+
}),
|
|
68
|
+
])),
|
|
69
|
+
t.strict({
|
|
70
|
+
text: t.string,
|
|
71
|
+
}),
|
|
72
|
+
]),
|
|
73
|
+
]);
|
|
56
74
|
const FileLinkLegacy = new t.Type("FileLink", (u) => (0, utils_1.hasContentType)(u) && u.__TYPE__ === exports.FileLinkType, (file) => {
|
|
57
75
|
return (0, function_1.pipe)(fileLinkLegacyCodec.decode(file), fp_ts_1.either.map((parsedFile) => {
|
|
58
76
|
return exports.FileLinkContent.encode({
|
|
@@ -64,18 +82,25 @@ const FileLinkLegacy = new t.Type("FileLink", (u) => (0, utils_1.hasContentType)
|
|
|
64
82
|
return fileLinkLegacyCodec.encode(file);
|
|
65
83
|
});
|
|
66
84
|
exports.FileLinkContent = t.intersection([
|
|
85
|
+
t.strict({
|
|
86
|
+
__TYPE__: t.literal(exports.FileLinkType),
|
|
87
|
+
}),
|
|
67
88
|
fileLinkLegacyCodec,
|
|
89
|
+
]);
|
|
90
|
+
exports.DocumentLinkType = "DocumentLink";
|
|
91
|
+
const documentLinkLegacyCodec = t.union([
|
|
68
92
|
t.exact(t.intersection([
|
|
69
|
-
t.type({
|
|
70
|
-
__TYPE__: t.literal(exports.FileLinkType),
|
|
71
|
-
}),
|
|
93
|
+
t.type({ id: validators_1.NonEmptyString }),
|
|
72
94
|
t.partial({
|
|
73
|
-
|
|
95
|
+
kind: t.literal("document"),
|
|
96
|
+
text: t.string,
|
|
74
97
|
}),
|
|
75
98
|
])),
|
|
99
|
+
t.strict({
|
|
100
|
+
kind: t.literal("document"),
|
|
101
|
+
text: t.string,
|
|
102
|
+
}),
|
|
76
103
|
]);
|
|
77
|
-
exports.DocumentLinkType = "DocumentLink";
|
|
78
|
-
const documentLinkLegacyCodec = t.strict({ id: validators_1.NonEmptyString });
|
|
79
104
|
const DocumentLinkLegacy = new t.Type("DocumentLink", (u) => (0, utils_1.hasContentType)(u) && u.__TYPE__ === exports.DocumentLinkType, (file) => {
|
|
80
105
|
return (0, function_1.pipe)(documentLinkLegacyCodec.decode(file), fp_ts_1.either.map((parsedDoc) => {
|
|
81
106
|
return exports.DocumentLinkContent.encode({
|
|
@@ -93,18 +118,25 @@ exports.DocumentLinkContent = t.intersection([
|
|
|
93
118
|
documentLinkLegacyCodec,
|
|
94
119
|
]);
|
|
95
120
|
exports.ExternalLinkType = "ExternalLink";
|
|
96
|
-
const externalLinkLegacyCodec = t.
|
|
97
|
-
t.
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
121
|
+
const externalLinkLegacyCodec = t.union([
|
|
122
|
+
t.exact(t.intersection([
|
|
123
|
+
t.type({
|
|
124
|
+
url: t.string,
|
|
125
|
+
}),
|
|
126
|
+
t.partial({
|
|
127
|
+
kind: t.literal("web"),
|
|
128
|
+
target: validators_1.StringOrNull,
|
|
129
|
+
preview: (0, function_2.nullable)(t.partial({
|
|
130
|
+
title: t.string,
|
|
131
|
+
})),
|
|
132
|
+
text: t.string,
|
|
133
|
+
}),
|
|
134
|
+
])),
|
|
135
|
+
t.strict({
|
|
101
136
|
kind: t.literal("web"),
|
|
102
|
-
|
|
103
|
-
preview: (0, function_2.nullable)(t.partial({
|
|
104
|
-
title: t.string,
|
|
105
|
-
})),
|
|
137
|
+
text: t.string,
|
|
106
138
|
}),
|
|
107
|
-
])
|
|
139
|
+
]);
|
|
108
140
|
const ExternalLinkLegacy = new t.Type("ExternalLink", (u) => (0, utils_1.hasContentType)(u) && u.__TYPE__ === exports.ExternalLinkType, (file) => {
|
|
109
141
|
return (0, function_1.pipe)(externalLinkLegacyCodec.decode(file), fp_ts_1.either.map((parsedLink) => {
|
|
110
142
|
return exports.ExternalLinkContent.encode({
|
|
@@ -121,6 +153,26 @@ exports.ExternalLinkContent = t.intersection([
|
|
|
121
153
|
}),
|
|
122
154
|
externalLinkLegacyCodec,
|
|
123
155
|
]);
|
|
156
|
+
exports.AnyLinkType = "AnyLink";
|
|
157
|
+
const anyLinkLegacyCodec = t.strict({
|
|
158
|
+
text: t.string,
|
|
159
|
+
});
|
|
160
|
+
const AnyLinkLegacy = new t.Type("AnyLink", (u) => (0, utils_1.hasContentType)(u) && u.__TYPE__ === exports.AnyLinkType, (anyLink) => {
|
|
161
|
+
return (0, function_1.pipe)(anyLinkLegacyCodec.decode(anyLink), fp_ts_1.either.map((parsedAnyLink) => {
|
|
162
|
+
return exports.AnyLinkContent.encode({
|
|
163
|
+
...parsedAnyLink,
|
|
164
|
+
__TYPE__: exports.AnyLinkType,
|
|
165
|
+
});
|
|
166
|
+
}));
|
|
167
|
+
}, (anyLink) => {
|
|
168
|
+
return anyLinkLegacyCodec.encode(anyLink);
|
|
169
|
+
});
|
|
170
|
+
exports.AnyLinkContent = t.intersection([
|
|
171
|
+
t.strict({
|
|
172
|
+
__TYPE__: t.literal(exports.AnyLinkType),
|
|
173
|
+
}),
|
|
174
|
+
anyLinkLegacyCodec,
|
|
175
|
+
]);
|
|
124
176
|
exports.LinkContentType = "LinkContent";
|
|
125
177
|
const isLinkContent = (u) => (0, utils_1.hasContentType)(u) && u.__TYPE__ === exports.LinkContentType;
|
|
126
178
|
exports.isLinkContent = isLinkContent;
|
|
@@ -129,6 +181,7 @@ exports.LinkLegacy = t.union([
|
|
|
129
181
|
FileLinkLegacy,
|
|
130
182
|
DocumentLinkLegacy,
|
|
131
183
|
ExternalLinkLegacy,
|
|
184
|
+
AnyLinkLegacy,
|
|
132
185
|
]);
|
|
133
186
|
const LinkContentLegacy = (ctx) => new t.Type("LinkLegacy", exports.isLinkContent, (u) => {
|
|
134
187
|
return (0, function_1.pipe)(exports.LinkLegacy.decode(u), fp_ts_1.either.map((link) => exports.LinkContent.encode({
|
|
@@ -147,6 +200,7 @@ exports.Link = t.union([
|
|
|
147
200
|
exports.FileLinkContent,
|
|
148
201
|
exports.DocumentLinkContent,
|
|
149
202
|
exports.ExternalLinkContent,
|
|
203
|
+
exports.AnyLinkContent,
|
|
150
204
|
]);
|
|
151
205
|
exports.LinkContent = t.strict({
|
|
152
206
|
__TYPE__: t.literal(exports.LinkContentType),
|