@prismicio/types-internal 1.2.1 → 1.4.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/GroupContent.d.ts +10 -8
- package/lib/content/fields/nestable/LinkContent.d.ts +10 -8
- package/lib/content/fields/nestable/LinkContent.js +5 -3
- package/lib/content/fields/nestable/NestableContent.d.ts +5 -4
- package/lib/content/fields/slices/SharedSliceContent.d.ts +10 -8
- package/lib/documents/widgets/nestable/Link/LinkContent.d.ts +18 -12
- package/lib/documents/widgets/nestable/Link/LinkContent.js +4 -1
- package/package.json +1 -1
- package/src/content/fields/nestable/LinkContent.ts +7 -3
- package/src/documents/widgets/nestable/Link/LinkContent.ts +7 -4
|
@@ -194,9 +194,7 @@ export declare const GroupItemContent: t.ExactC<t.TypeC<{
|
|
|
194
194
|
date?: string | null | undefined;
|
|
195
195
|
} & {
|
|
196
196
|
__TYPE__: "ImageLink";
|
|
197
|
-
}, unknown>]>, t.IntersectionC<[t.
|
|
198
|
-
__TYPE__: t.LiteralC<"FileLink">;
|
|
199
|
-
}>>, t.Type<{
|
|
197
|
+
}, unknown>]>, t.IntersectionC<[t.Type<{
|
|
200
198
|
id: string;
|
|
201
199
|
url: string;
|
|
202
200
|
name: string;
|
|
@@ -212,7 +210,10 @@ export declare const GroupItemContent: t.ExactC<t.TypeC<{
|
|
|
212
210
|
readonly name: string;
|
|
213
211
|
readonly kind: string;
|
|
214
212
|
readonly date?: string | null | undefined;
|
|
215
|
-
}, unknown
|
|
213
|
+
}, unknown>, t.ExactC<t.TypeC<{
|
|
214
|
+
__TYPE__: t.LiteralC<"FileLink">;
|
|
215
|
+
size: t.StringC;
|
|
216
|
+
}>>]>, t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
216
217
|
__TYPE__: t.LiteralC<"DocumentLink">;
|
|
217
218
|
}>>, t.Type<{
|
|
218
219
|
id: string;
|
|
@@ -567,9 +568,7 @@ export declare const GroupContent: t.ExactC<t.TypeC<{
|
|
|
567
568
|
date?: string | null | undefined;
|
|
568
569
|
} & {
|
|
569
570
|
__TYPE__: "ImageLink";
|
|
570
|
-
}, unknown>]>, t.IntersectionC<[t.
|
|
571
|
-
__TYPE__: t.LiteralC<"FileLink">;
|
|
572
|
-
}>>, t.Type<{
|
|
571
|
+
}, unknown>]>, t.IntersectionC<[t.Type<{
|
|
573
572
|
id: string;
|
|
574
573
|
url: string;
|
|
575
574
|
name: string;
|
|
@@ -585,7 +584,10 @@ export declare const GroupContent: t.ExactC<t.TypeC<{
|
|
|
585
584
|
readonly name: string;
|
|
586
585
|
readonly kind: string;
|
|
587
586
|
readonly date?: string | null | undefined;
|
|
588
|
-
}, unknown
|
|
587
|
+
}, unknown>, t.ExactC<t.TypeC<{
|
|
588
|
+
__TYPE__: t.LiteralC<"FileLink">;
|
|
589
|
+
size: t.StringC;
|
|
590
|
+
}>>]>, t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
589
591
|
__TYPE__: t.LiteralC<"DocumentLink">;
|
|
590
592
|
}>>, t.Type<{
|
|
591
593
|
id: string;
|
|
@@ -26,9 +26,7 @@ export declare const ImageLinkContent: t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
|
26
26
|
}, unknown>]>;
|
|
27
27
|
export declare type ImageLinkContent = t.TypeOf<typeof ImageLinkContent>;
|
|
28
28
|
export declare const ImageLinkType = "ImageLink";
|
|
29
|
-
export declare const FileLinkContent: t.IntersectionC<[t.
|
|
30
|
-
__TYPE__: t.LiteralC<"FileLink">;
|
|
31
|
-
}>>, t.Type<{
|
|
29
|
+
export declare const FileLinkContent: t.IntersectionC<[t.Type<{
|
|
32
30
|
id: string;
|
|
33
31
|
url: string;
|
|
34
32
|
name: string;
|
|
@@ -44,7 +42,10 @@ export declare const FileLinkContent: t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
|
44
42
|
readonly name: string;
|
|
45
43
|
readonly kind: string;
|
|
46
44
|
readonly date?: string | null | undefined;
|
|
47
|
-
}, unknown
|
|
45
|
+
}, unknown>, t.ExactC<t.TypeC<{
|
|
46
|
+
__TYPE__: t.LiteralC<"FileLink">;
|
|
47
|
+
size: t.StringC;
|
|
48
|
+
}>>]>;
|
|
48
49
|
export declare type FileLinkContent = t.TypeOf<typeof FileLinkContent>;
|
|
49
50
|
export declare const FileLinkType = "FileLink";
|
|
50
51
|
export declare const DocumentLinkContent: t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
@@ -107,9 +108,7 @@ export declare const LinkContent: t.ExactC<t.TypeC<{
|
|
|
107
108
|
date?: string | null | undefined;
|
|
108
109
|
} & {
|
|
109
110
|
__TYPE__: "ImageLink";
|
|
110
|
-
}, unknown>]>, t.IntersectionC<[t.
|
|
111
|
-
__TYPE__: t.LiteralC<"FileLink">;
|
|
112
|
-
}>>, t.Type<{
|
|
111
|
+
}, unknown>]>, t.IntersectionC<[t.Type<{
|
|
113
112
|
id: string;
|
|
114
113
|
url: string;
|
|
115
114
|
name: string;
|
|
@@ -125,7 +124,10 @@ export declare const LinkContent: t.ExactC<t.TypeC<{
|
|
|
125
124
|
readonly name: string;
|
|
126
125
|
readonly kind: string;
|
|
127
126
|
readonly date?: string | null | undefined;
|
|
128
|
-
}, unknown
|
|
127
|
+
}, unknown>, t.ExactC<t.TypeC<{
|
|
128
|
+
__TYPE__: t.LiteralC<"FileLink">;
|
|
129
|
+
size: t.StringC;
|
|
130
|
+
}>>]>, t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
129
131
|
__TYPE__: t.LiteralC<"DocumentLink">;
|
|
130
132
|
}>>, t.Type<{
|
|
131
133
|
id: string;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.LinkContentType = exports.LinkContent = exports.ExternalLinkType = exports.ExternalLinkContent = exports.DocumentLinkType = exports.DocumentLinkContent = exports.FileLinkType = exports.FileLinkContent = exports.ImageLinkType = exports.ImageLinkContent = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
6
|
+
const io_ts_types_1 = require("io-ts-types");
|
|
6
7
|
const DocumentLink_1 = require("../../../documents/widgets/nestable/Link/DocumentLink");
|
|
7
8
|
const ExternalLink_1 = require("../../../documents/widgets/nestable/Link/ExternalLink");
|
|
8
9
|
const FileLink_1 = require("../../../documents/widgets/nestable/Link/FileLink");
|
|
@@ -16,10 +17,11 @@ exports.ImageLinkContent = t.intersection([
|
|
|
16
17
|
]);
|
|
17
18
|
exports.ImageLinkType = ImageLink_1.ImageLinkType;
|
|
18
19
|
exports.FileLinkContent = t.intersection([
|
|
19
|
-
t.strict({
|
|
20
|
-
__TYPE__: t.literal(FileLink_1.FileLinkType),
|
|
21
|
-
}),
|
|
22
20
|
FileLink_1.FileLink,
|
|
21
|
+
t.exact(t.type({
|
|
22
|
+
__TYPE__: t.literal(FileLink_1.FileLinkType),
|
|
23
|
+
size: (0, io_ts_types_1.withFallback)(t.string, "0"),
|
|
24
|
+
})),
|
|
23
25
|
]);
|
|
24
26
|
exports.FileLinkType = FileLink_1.FileLinkType;
|
|
25
27
|
exports.DocumentLinkContent = t.intersection([
|
|
@@ -192,9 +192,7 @@ export declare const NestableContent: t.UnionC<[t.ExactC<t.TypeC<{
|
|
|
192
192
|
date?: string | null | undefined;
|
|
193
193
|
} & {
|
|
194
194
|
__TYPE__: "ImageLink";
|
|
195
|
-
}, unknown>]>, t.IntersectionC<[t.
|
|
196
|
-
__TYPE__: t.LiteralC<"FileLink">;
|
|
197
|
-
}>>, t.Type<{
|
|
195
|
+
}, unknown>]>, t.IntersectionC<[t.Type<{
|
|
198
196
|
id: string;
|
|
199
197
|
url: string;
|
|
200
198
|
name: string;
|
|
@@ -210,7 +208,10 @@ export declare const NestableContent: t.UnionC<[t.ExactC<t.TypeC<{
|
|
|
210
208
|
readonly name: string;
|
|
211
209
|
readonly kind: string;
|
|
212
210
|
readonly date?: string | null | undefined;
|
|
213
|
-
}, unknown
|
|
211
|
+
}, unknown>, t.ExactC<t.TypeC<{
|
|
212
|
+
__TYPE__: t.LiteralC<"FileLink">;
|
|
213
|
+
size: t.StringC;
|
|
214
|
+
}>>]>, t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
214
215
|
__TYPE__: t.LiteralC<"DocumentLink">;
|
|
215
216
|
}>>, t.Type<{
|
|
216
217
|
id: string;
|
|
@@ -195,9 +195,7 @@ export declare const SharedSliceContent: t.ExactC<t.TypeC<{
|
|
|
195
195
|
date?: string | null | undefined;
|
|
196
196
|
} & {
|
|
197
197
|
__TYPE__: "ImageLink";
|
|
198
|
-
}, unknown>]>, t.IntersectionC<[t.
|
|
199
|
-
__TYPE__: t.LiteralC<"FileLink">;
|
|
200
|
-
}>>, t.Type<{
|
|
198
|
+
}, unknown>]>, t.IntersectionC<[t.Type<{
|
|
201
199
|
id: string;
|
|
202
200
|
url: string;
|
|
203
201
|
name: string;
|
|
@@ -213,7 +211,10 @@ export declare const SharedSliceContent: t.ExactC<t.TypeC<{
|
|
|
213
211
|
readonly name: string;
|
|
214
212
|
readonly kind: string;
|
|
215
213
|
readonly date?: string | null | undefined;
|
|
216
|
-
}, unknown
|
|
214
|
+
}, unknown>, t.ExactC<t.TypeC<{
|
|
215
|
+
__TYPE__: t.LiteralC<"FileLink">;
|
|
216
|
+
size: t.StringC;
|
|
217
|
+
}>>]>, t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
217
218
|
__TYPE__: t.LiteralC<"DocumentLink">;
|
|
218
219
|
}>>, t.Type<{
|
|
219
220
|
id: string;
|
|
@@ -563,9 +564,7 @@ export declare const SharedSliceContent: t.ExactC<t.TypeC<{
|
|
|
563
564
|
date?: string | null | undefined;
|
|
564
565
|
} & {
|
|
565
566
|
__TYPE__: "ImageLink";
|
|
566
|
-
}, unknown>]>, t.IntersectionC<[t.
|
|
567
|
-
__TYPE__: t.LiteralC<"FileLink">;
|
|
568
|
-
}>>, t.Type<{
|
|
567
|
+
}, unknown>]>, t.IntersectionC<[t.Type<{
|
|
569
568
|
id: string;
|
|
570
569
|
url: string;
|
|
571
570
|
name: string;
|
|
@@ -581,7 +580,10 @@ export declare const SharedSliceContent: t.ExactC<t.TypeC<{
|
|
|
581
580
|
readonly name: string;
|
|
582
581
|
readonly kind: string;
|
|
583
582
|
readonly date?: string | null | undefined;
|
|
584
|
-
}, unknown
|
|
583
|
+
}, unknown>, t.ExactC<t.TypeC<{
|
|
584
|
+
__TYPE__: t.LiteralC<"FileLink">;
|
|
585
|
+
size: t.StringC;
|
|
586
|
+
}>>]>, t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
585
587
|
__TYPE__: t.LiteralC<"DocumentLink">;
|
|
586
588
|
}>>, t.Type<{
|
|
587
589
|
id: string;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
|
-
import {
|
|
2
|
+
import { LinkO } from "./index";
|
|
3
3
|
export declare type LinkContent = {
|
|
4
4
|
__TYPE__: "LinkContent";
|
|
5
|
-
value:
|
|
5
|
+
value: LinkO;
|
|
6
6
|
};
|
|
7
7
|
export declare const LinkContentType = "LinkContent";
|
|
8
|
-
export declare const LinkContent: t.Type<LinkContent, {
|
|
8
|
+
export declare const LinkContent: t.Type<LinkContent, ({
|
|
9
9
|
id: string;
|
|
10
|
-
}
|
|
10
|
+
} & {
|
|
11
|
+
__TYPE__: "DocumentLink";
|
|
12
|
+
}) | ({
|
|
11
13
|
url: string;
|
|
12
14
|
} & {
|
|
13
15
|
kind?: "web";
|
|
@@ -15,15 +17,17 @@ export declare const LinkContent: t.Type<LinkContent, {
|
|
|
15
17
|
preview?: {
|
|
16
18
|
title?: string;
|
|
17
19
|
} | null | undefined;
|
|
18
|
-
}) | ({
|
|
19
|
-
id: string;
|
|
20
|
-
url: string;
|
|
21
|
-
name: string;
|
|
22
|
-
kind: string;
|
|
23
20
|
} & {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
__TYPE__: "ExternalLink";
|
|
22
|
+
}) | {
|
|
23
|
+
readonly size: string;
|
|
24
|
+
readonly __TYPE__: "FileLink";
|
|
25
|
+
readonly id: string;
|
|
26
|
+
readonly url: string;
|
|
27
|
+
readonly name: string;
|
|
28
|
+
readonly kind: string;
|
|
29
|
+
readonly date?: string | null | undefined;
|
|
30
|
+
} | ({
|
|
27
31
|
id: string;
|
|
28
32
|
url: string;
|
|
29
33
|
height: string;
|
|
@@ -33,4 +37,6 @@ export declare const LinkContent: t.Type<LinkContent, {
|
|
|
33
37
|
kind: string;
|
|
34
38
|
} & {
|
|
35
39
|
date?: string | null | undefined;
|
|
40
|
+
} & {
|
|
41
|
+
__TYPE__: "ImageLink";
|
|
36
42
|
}), unknown>;
|
|
@@ -10,5 +10,8 @@ exports.LinkContent = new t.Type("LinkContent", (u) => {
|
|
|
10
10
|
var _a;
|
|
11
11
|
return index_1.Link.is((_a = u) === null || _a === void 0 ? void 0 : _a.value);
|
|
12
12
|
}, (u, c) => Either_1.Chain.chain(index_1.Link.validate(u, c), (u) => {
|
|
13
|
-
return t.success({
|
|
13
|
+
return t.success({
|
|
14
|
+
value: index_1.Link.encode(u),
|
|
15
|
+
__TYPE__: exports.LinkContentType,
|
|
16
|
+
});
|
|
14
17
|
}), (linkContent) => index_1.Link.encode(linkContent.value));
|
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as t from "io-ts"
|
|
2
|
+
import { withFallback } from "io-ts-types"
|
|
2
3
|
|
|
3
4
|
import {
|
|
4
5
|
DocumentLink,
|
|
@@ -28,10 +29,13 @@ export type ImageLinkContent = t.TypeOf<typeof ImageLinkContent>
|
|
|
28
29
|
export const ImageLinkType = ilType
|
|
29
30
|
|
|
30
31
|
export const FileLinkContent = t.intersection([
|
|
31
|
-
t.strict({
|
|
32
|
-
__TYPE__: t.literal(flType),
|
|
33
|
-
}),
|
|
34
32
|
FileLink,
|
|
33
|
+
t.exact(
|
|
34
|
+
t.type({
|
|
35
|
+
__TYPE__: t.literal(flType),
|
|
36
|
+
size: withFallback(t.string, "0"),
|
|
37
|
+
}),
|
|
38
|
+
),
|
|
35
39
|
])
|
|
36
40
|
export type FileLinkContent = t.TypeOf<typeof FileLinkContent>
|
|
37
41
|
export const FileLinkType = flType
|
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
import { Chain } from "fp-ts/Either"
|
|
2
2
|
import * as t from "io-ts"
|
|
3
3
|
|
|
4
|
-
import { Link } from "./index"
|
|
4
|
+
import { Link, LinkO } from "./index"
|
|
5
5
|
|
|
6
6
|
export type LinkContent = {
|
|
7
7
|
__TYPE__: "LinkContent"
|
|
8
|
-
value:
|
|
8
|
+
value: LinkO
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export const LinkContentType = "LinkContent"
|
|
12
|
-
export const LinkContent = new t.Type<LinkContent,
|
|
12
|
+
export const LinkContent = new t.Type<LinkContent, LinkO>(
|
|
13
13
|
"LinkContent",
|
|
14
14
|
(u): u is LinkContent => {
|
|
15
15
|
return Link.is((u as LinkContent)?.value)
|
|
16
16
|
},
|
|
17
17
|
(u, c) =>
|
|
18
18
|
Chain.chain(Link.validate(u, c), (u) => {
|
|
19
|
-
return t.success({
|
|
19
|
+
return t.success({
|
|
20
|
+
value: Link.encode(u),
|
|
21
|
+
__TYPE__: LinkContentType,
|
|
22
|
+
} as const)
|
|
20
23
|
}),
|
|
21
24
|
(linkContent) => Link.encode(linkContent.value),
|
|
22
25
|
)
|