@prismicio/types-internal 2.0.0-alpha.7 → 2.0.0-alpha.8
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 +608 -32
- package/lib/content/fields/GroupContent.d.ts +190 -10
- package/lib/content/fields/WidgetContent.d.ts +912 -48
- package/lib/content/fields/nestable/EmbedContent.d.ts +44 -41
- package/lib/content/fields/nestable/EmbedContent.js +15 -38
- package/lib/content/fields/nestable/NestableContent.d.ts +114 -7
- package/lib/content/fields/nestable/RichTextContent/Blocks.d.ts +76 -5
- package/lib/content/fields/nestable/RichTextContent/Blocks.js +15 -7
- package/lib/content/fields/nestable/RichTextContent/index.d.ts +76 -4
- package/lib/content/fields/slices/Slice/CompositeSliceContent.d.ts +228 -12
- package/lib/content/fields/slices/Slice/RepeatableContent.d.ts +76 -4
- package/lib/content/fields/slices/Slice/SharedSliceContent.d.ts +228 -12
- package/lib/content/fields/slices/Slice/SimpleSliceContent.d.ts +190 -10
- package/lib/content/fields/slices/Slice/index.d.ts +421 -22
- package/lib/content/fields/slices/Slice/index.js +3 -0
- package/lib/content/fields/slices/SliceItem.d.ts +456 -24
- package/lib/content/fields/slices/SliceItem.js +2 -2
- package/lib/content/fields/slices/SlicesContent.d.ts +684 -36
- package/lib/content/fields/slices/index.d.ts +1 -3
- package/lib/content/fields/slices/index.js +1 -3
- package/package.json +1 -1
- package/src/content/fields/nestable/EmbedContent.ts +20 -59
- package/src/content/fields/nestable/RichTextContent/Blocks.ts +19 -8
- package/src/content/fields/slices/Slice/index.ts +4 -0
- package/src/content/fields/slices/SliceItem.ts +2 -2
- package/src/content/fields/slices/index.ts +1 -3
|
@@ -1,7 +1,25 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
2
|
import type { LegacyContentCtx, WithTypes } from "../../LegacyContentCtx";
|
|
3
3
|
export declare const EmbedContentType = "EmbedContent";
|
|
4
|
-
export declare const isEmbedContent: (u: unknown) => u is
|
|
4
|
+
export declare const isEmbedContent: (u: unknown) => u is {
|
|
5
|
+
embed_url: string;
|
|
6
|
+
type: string;
|
|
7
|
+
} & {
|
|
8
|
+
version?: string | number | null;
|
|
9
|
+
title?: string | null | undefined;
|
|
10
|
+
author_name?: string | null | undefined;
|
|
11
|
+
author_url?: string | null | undefined;
|
|
12
|
+
provider_name?: string | null | undefined;
|
|
13
|
+
provider_url?: string | null | undefined;
|
|
14
|
+
cache_age?: string | number | null;
|
|
15
|
+
thumbnail_url?: string | null | undefined;
|
|
16
|
+
thumbnail_width?: number | null | undefined;
|
|
17
|
+
thumbnail_height?: number | null | undefined;
|
|
18
|
+
html?: string | null | undefined;
|
|
19
|
+
} & {
|
|
20
|
+
__TYPE__: "EmbedContent";
|
|
21
|
+
all: unknown;
|
|
22
|
+
};
|
|
5
23
|
export declare const EmbedContentLegacy: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
6
24
|
embed_url: t.StringC;
|
|
7
25
|
type: t.StringC;
|
|
@@ -18,8 +36,8 @@ export declare const EmbedContentLegacy: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
18
36
|
thumbnail_height: t.UnionC<[t.Type<number, number, unknown>, t.NullC, t.UndefinedC]>;
|
|
19
37
|
html: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
20
38
|
}>]>>;
|
|
21
|
-
type EmbedLegacy = t.TypeOf<typeof EmbedContentLegacy>;
|
|
22
|
-
export declare const EmbedLegacy: (ctx: LegacyContentCtx) => t.Type<
|
|
39
|
+
export type EmbedLegacy = t.TypeOf<typeof EmbedContentLegacy>;
|
|
40
|
+
export declare const EmbedLegacy: (ctx: LegacyContentCtx) => t.Type<{
|
|
23
41
|
embed_url: string;
|
|
24
42
|
type: string;
|
|
25
43
|
} & {
|
|
@@ -34,42 +52,27 @@ export declare const EmbedLegacy: (ctx: LegacyContentCtx) => t.Type<EmbedContent
|
|
|
34
52
|
thumbnail_width?: number | null | undefined;
|
|
35
53
|
thumbnail_height?: number | null | undefined;
|
|
36
54
|
html?: string | null | undefined;
|
|
37
|
-
}
|
|
38
|
-
export type EmbedContent = EmbedLegacy & {
|
|
39
|
-
__TYPE__: typeof EmbedContentType;
|
|
40
|
-
all: unknown;
|
|
41
|
-
};
|
|
42
|
-
export declare const EmbedContent: t.Type<EmbedContent, EmbedContent, unknown>;
|
|
43
|
-
export declare function buildEmbedContent(embed: Omit<EmbedContent, "all">): {
|
|
44
|
-
all: {
|
|
45
|
-
embed_url: string;
|
|
46
|
-
type: string;
|
|
47
|
-
} & {
|
|
48
|
-
version?: string | number | null;
|
|
49
|
-
title?: string | null | undefined;
|
|
50
|
-
author_name?: string | null | undefined;
|
|
51
|
-
author_url?: string | null | undefined;
|
|
52
|
-
provider_name?: string | null | undefined;
|
|
53
|
-
provider_url?: string | null | undefined;
|
|
54
|
-
cache_age?: string | number | null;
|
|
55
|
-
thumbnail_url?: string | null | undefined;
|
|
56
|
-
thumbnail_width?: number | null | undefined;
|
|
57
|
-
thumbnail_height?: number | null | undefined;
|
|
58
|
-
html?: string | null | undefined;
|
|
59
|
-
};
|
|
60
|
-
type: string;
|
|
61
|
-
version?: string | number | null;
|
|
55
|
+
} & {
|
|
62
56
|
__TYPE__: "EmbedContent";
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
57
|
+
all: unknown;
|
|
58
|
+
}, WithTypes<unknown>, unknown>;
|
|
59
|
+
export declare const EmbedContent: t.IntersectionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
60
|
+
embed_url: t.StringC;
|
|
61
|
+
type: t.StringC;
|
|
62
|
+
}>, t.PartialC<{
|
|
63
|
+
version: t.UnionC<[t.StringC, t.NumberC, t.NullC]>;
|
|
64
|
+
title: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
65
|
+
author_name: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
66
|
+
author_url: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
67
|
+
provider_name: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
68
|
+
provider_url: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
69
|
+
cache_age: t.UnionC<[t.StringC, t.NumberC, t.NullC]>;
|
|
70
|
+
thumbnail_url: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
71
|
+
thumbnail_width: t.UnionC<[t.Type<number, number, unknown>, t.NullC, t.UndefinedC]>;
|
|
72
|
+
thumbnail_height: t.UnionC<[t.Type<number, number, unknown>, t.NullC, t.UndefinedC]>;
|
|
73
|
+
html: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
74
|
+
}>]>>, t.ExactC<t.TypeC<{
|
|
75
|
+
__TYPE__: t.LiteralC<"EmbedContent">;
|
|
76
|
+
all: t.UnknownC;
|
|
77
|
+
}>>]>;
|
|
78
|
+
export type EmbedContent = t.TypeOf<typeof EmbedContent>;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.EmbedContent = exports.EmbedLegacy = exports.EmbedContentLegacy = exports.isEmbedContent = exports.EmbedContentType = 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");
|
|
7
7
|
const t = tslib_1.__importStar(require("io-ts"));
|
|
8
|
-
const Objects_1 = require("../../../utils/Objects");
|
|
9
8
|
const validators_1 = require("../../../validators");
|
|
10
9
|
const utils_1 = require("../../utils");
|
|
11
10
|
exports.EmbedContentType = "EmbedContent";
|
|
@@ -31,48 +30,26 @@ exports.EmbedContentLegacy = t.exact(t.intersection([
|
|
|
31
30
|
}),
|
|
32
31
|
]));
|
|
33
32
|
const EmbedLegacy = (ctx) => new t.Type("EmbedLegacy", exports.isEmbedContent, (u) => {
|
|
34
|
-
return (0, function_1.pipe)(exports.EmbedContentLegacy.decode(u), fp_ts_1.either.map((embed) =>
|
|
33
|
+
return (0, function_1.pipe)(exports.EmbedContentLegacy.decode(u), fp_ts_1.either.map((embed) => ({
|
|
35
34
|
...embed,
|
|
35
|
+
all: u,
|
|
36
36
|
__TYPE__: exports.EmbedContentType,
|
|
37
37
|
})));
|
|
38
38
|
}, (embed) => {
|
|
39
39
|
return {
|
|
40
|
-
|
|
40
|
+
/**
|
|
41
|
+
* we cast here because actually in the all property
|
|
42
|
+
* we can have extra keys that are never parsed and we don't want to loose them.
|
|
43
|
+
**/
|
|
44
|
+
content: embed.all,
|
|
41
45
|
types: { [ctx.keyOfType]: "Embed" },
|
|
42
46
|
};
|
|
43
47
|
});
|
|
44
48
|
exports.EmbedLegacy = EmbedLegacy;
|
|
45
|
-
exports.EmbedContent =
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
exports.
|
|
49
|
-
t.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
])
|
|
53
|
-
.decode(u), fp_ts_1.either.map((parsedEmbed) => {
|
|
54
|
-
return buildEmbedContent(parsedEmbed);
|
|
55
|
-
}));
|
|
56
|
-
}, (e) => e);
|
|
57
|
-
function buildEmbedContent(embed) {
|
|
58
|
-
return {
|
|
59
|
-
...embed,
|
|
60
|
-
all: (0, Objects_1.withOptionals)({
|
|
61
|
-
embed_url: embed.embed_url,
|
|
62
|
-
type: embed.type,
|
|
63
|
-
}, [
|
|
64
|
-
["author_name", embed.author_name],
|
|
65
|
-
["author_url", embed.author_url],
|
|
66
|
-
["cache_age", embed.cache_age],
|
|
67
|
-
["html", embed.html],
|
|
68
|
-
["provider_name", embed.provider_name],
|
|
69
|
-
["provider_url", embed.provider_url],
|
|
70
|
-
["thumbnail_height", embed.thumbnail_height],
|
|
71
|
-
["thumbnail_width", embed.thumbnail_width],
|
|
72
|
-
["thumbnail_url", embed.thumbnail_url],
|
|
73
|
-
["title", embed.title],
|
|
74
|
-
["version", embed.version],
|
|
75
|
-
]),
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
exports.buildEmbedContent = buildEmbedContent;
|
|
49
|
+
exports.EmbedContent = t.intersection([
|
|
50
|
+
exports.EmbedContentLegacy,
|
|
51
|
+
t.strict({
|
|
52
|
+
__TYPE__: t.literal(exports.EmbedContentType),
|
|
53
|
+
all: t.unknown,
|
|
54
|
+
}),
|
|
55
|
+
]);
|
|
@@ -1,13 +1,30 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
2
|
import type { LegacyContentCtx } from "../../LegacyContentCtx";
|
|
3
|
-
import { EmbedContent } from "./EmbedContent";
|
|
4
3
|
export declare const NestableContent: t.UnionC<[t.ExactC<t.TypeC<{
|
|
5
4
|
type: t.StringC;
|
|
6
5
|
__TYPE__: t.LiteralC<"EmptyContent">;
|
|
7
6
|
}>>, t.ExactC<t.TypeC<{
|
|
8
7
|
__TYPE__: t.LiteralC<"BooleanContent">;
|
|
9
8
|
value: t.BooleanC;
|
|
10
|
-
}>>, t.
|
|
9
|
+
}>>, t.IntersectionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
10
|
+
embed_url: t.StringC;
|
|
11
|
+
type: t.StringC;
|
|
12
|
+
}>, t.PartialC<{
|
|
13
|
+
version: t.UnionC<[t.StringC, t.NumberC, t.NullC]>;
|
|
14
|
+
title: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
15
|
+
author_name: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
16
|
+
author_url: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
17
|
+
provider_name: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
18
|
+
provider_url: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
19
|
+
cache_age: t.UnionC<[t.StringC, t.NumberC, t.NullC]>;
|
|
20
|
+
thumbnail_url: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
21
|
+
thumbnail_width: t.UnionC<[t.Type<number, number, unknown>, t.NullC, t.UndefinedC]>;
|
|
22
|
+
thumbnail_height: t.UnionC<[t.Type<number, number, unknown>, t.NullC, t.UndefinedC]>;
|
|
23
|
+
html: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
24
|
+
}>]>>, t.ExactC<t.TypeC<{
|
|
25
|
+
__TYPE__: t.LiteralC<"EmbedContent">;
|
|
26
|
+
all: t.UnknownC;
|
|
27
|
+
}>>]>, t.ExactC<t.TypeC<{
|
|
11
28
|
type: t.LiteralC<"Text">;
|
|
12
29
|
value: t.Type<string, string, unknown>;
|
|
13
30
|
__TYPE__: t.LiteralC<"FieldContent">;
|
|
@@ -246,7 +263,25 @@ export declare const NestableContent: t.UnionC<[t.ExactC<t.TypeC<{
|
|
|
246
263
|
direction: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
247
264
|
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
248
265
|
type: t.LiteralC<"embed">;
|
|
249
|
-
data: t.
|
|
266
|
+
data: t.IntersectionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
267
|
+
embed_url: t.StringC;
|
|
268
|
+
type: t.StringC;
|
|
269
|
+
}>, t.PartialC<{
|
|
270
|
+
version: t.UnionC<[t.StringC, t.NumberC, t.NullC]>;
|
|
271
|
+
title: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
272
|
+
author_name: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
273
|
+
author_url: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
274
|
+
provider_name: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
275
|
+
provider_url: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
276
|
+
cache_age: t.UnionC<[t.StringC, t.NumberC, t.NullC]>;
|
|
277
|
+
thumbnail_url: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
278
|
+
thumbnail_width: t.UnionC<[t.Type<number, number, unknown>, t.NullC, t.UndefinedC]>;
|
|
279
|
+
thumbnail_height: t.UnionC<[t.Type<number, number, unknown>, t.NullC, t.UndefinedC]>;
|
|
280
|
+
html: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
281
|
+
}>]>>, t.ExactC<t.TypeC<{
|
|
282
|
+
__TYPE__: t.LiteralC<"EmbedContent">;
|
|
283
|
+
all: t.UnknownC;
|
|
284
|
+
}>>]>;
|
|
250
285
|
}>, t.PartialC<{
|
|
251
286
|
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
252
287
|
direction: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
@@ -281,7 +316,25 @@ export type NestableContentType = NestableContent["__TYPE__"];
|
|
|
281
316
|
export declare const isNestableContent: (u: unknown) => u is {
|
|
282
317
|
__TYPE__: "BooleanContent";
|
|
283
318
|
value: boolean;
|
|
284
|
-
} |
|
|
319
|
+
} | ({
|
|
320
|
+
embed_url: string;
|
|
321
|
+
type: string;
|
|
322
|
+
} & {
|
|
323
|
+
version?: string | number | null;
|
|
324
|
+
title?: string | null | undefined;
|
|
325
|
+
author_name?: string | null | undefined;
|
|
326
|
+
author_url?: string | null | undefined;
|
|
327
|
+
provider_name?: string | null | undefined;
|
|
328
|
+
provider_url?: string | null | undefined;
|
|
329
|
+
cache_age?: string | number | null;
|
|
330
|
+
thumbnail_url?: string | null | undefined;
|
|
331
|
+
thumbnail_width?: number | null | undefined;
|
|
332
|
+
thumbnail_height?: number | null | undefined;
|
|
333
|
+
html?: string | null | undefined;
|
|
334
|
+
} & {
|
|
335
|
+
__TYPE__: "EmbedContent";
|
|
336
|
+
all: unknown;
|
|
337
|
+
}) | {
|
|
285
338
|
type: "Color";
|
|
286
339
|
value: string;
|
|
287
340
|
__TYPE__: "FieldContent";
|
|
@@ -485,7 +538,25 @@ export declare const isNestableContent: (u: unknown) => u is {
|
|
|
485
538
|
direction?: string | null | undefined;
|
|
486
539
|
}) | ({
|
|
487
540
|
type: "embed";
|
|
488
|
-
data:
|
|
541
|
+
data: {
|
|
542
|
+
embed_url: string;
|
|
543
|
+
type: string;
|
|
544
|
+
} & {
|
|
545
|
+
version?: string | number | null;
|
|
546
|
+
title?: string | null | undefined;
|
|
547
|
+
author_name?: string | null | undefined;
|
|
548
|
+
author_url?: string | null | undefined;
|
|
549
|
+
provider_name?: string | null | undefined;
|
|
550
|
+
provider_url?: string | null | undefined;
|
|
551
|
+
cache_age?: string | number | null;
|
|
552
|
+
thumbnail_url?: string | null | undefined;
|
|
553
|
+
thumbnail_width?: number | null | undefined;
|
|
554
|
+
thumbnail_height?: number | null | undefined;
|
|
555
|
+
html?: string | null | undefined;
|
|
556
|
+
} & {
|
|
557
|
+
__TYPE__: "EmbedContent";
|
|
558
|
+
all: unknown;
|
|
559
|
+
};
|
|
489
560
|
} & {
|
|
490
561
|
label?: string | null | undefined;
|
|
491
562
|
direction?: string | null | undefined;
|
|
@@ -513,7 +584,25 @@ export declare const NestableLegacy: (ctx: LegacyContentCtx) => {
|
|
|
513
584
|
decode(value: unknown): import("fp-ts/lib/Either").Left<t.Errors> | import("fp-ts/lib/Either").Right<{
|
|
514
585
|
__TYPE__: "BooleanContent";
|
|
515
586
|
value: boolean;
|
|
516
|
-
}> | import("fp-ts/lib/Either").Right<
|
|
587
|
+
}> | import("fp-ts/lib/Either").Right<{
|
|
588
|
+
embed_url: string;
|
|
589
|
+
type: string;
|
|
590
|
+
} & {
|
|
591
|
+
version?: string | number | null;
|
|
592
|
+
title?: string | null | undefined;
|
|
593
|
+
author_name?: string | null | undefined;
|
|
594
|
+
author_url?: string | null | undefined;
|
|
595
|
+
provider_name?: string | null | undefined;
|
|
596
|
+
provider_url?: string | null | undefined;
|
|
597
|
+
cache_age?: string | number | null;
|
|
598
|
+
thumbnail_url?: string | null | undefined;
|
|
599
|
+
thumbnail_width?: number | null | undefined;
|
|
600
|
+
thumbnail_height?: number | null | undefined;
|
|
601
|
+
html?: string | null | undefined;
|
|
602
|
+
} & {
|
|
603
|
+
__TYPE__: "EmbedContent";
|
|
604
|
+
all: unknown;
|
|
605
|
+
}> | import("fp-ts/lib/Either").Right<{
|
|
517
606
|
type: "Color";
|
|
518
607
|
value: string;
|
|
519
608
|
__TYPE__: "FieldContent";
|
|
@@ -717,7 +806,25 @@ export declare const NestableLegacy: (ctx: LegacyContentCtx) => {
|
|
|
717
806
|
direction?: string | null | undefined;
|
|
718
807
|
}) | ({
|
|
719
808
|
type: "embed";
|
|
720
|
-
data:
|
|
809
|
+
data: {
|
|
810
|
+
embed_url: string;
|
|
811
|
+
type: string;
|
|
812
|
+
} & {
|
|
813
|
+
version?: string | number | null;
|
|
814
|
+
title?: string | null | undefined;
|
|
815
|
+
author_name?: string | null | undefined;
|
|
816
|
+
author_url?: string | null | undefined;
|
|
817
|
+
provider_name?: string | null | undefined;
|
|
818
|
+
provider_url?: string | null | undefined;
|
|
819
|
+
cache_age?: string | number | null;
|
|
820
|
+
thumbnail_url?: string | null | undefined;
|
|
821
|
+
thumbnail_width?: number | null | undefined;
|
|
822
|
+
thumbnail_height?: number | null | undefined;
|
|
823
|
+
html?: string | null | undefined;
|
|
824
|
+
} & {
|
|
825
|
+
__TYPE__: "EmbedContent";
|
|
826
|
+
all: unknown;
|
|
827
|
+
};
|
|
721
828
|
} & {
|
|
722
829
|
label?: string | null | undefined;
|
|
723
830
|
direction?: string | null | undefined;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
|
-
import { EmbedContent } from "../EmbedContent";
|
|
3
2
|
import { Link, LinkLegacy } from "../LinkContent";
|
|
4
3
|
export declare const Meta: t.ExactC<t.IntersectionC<[t.PartialC<{
|
|
5
4
|
data: t.UnknownC;
|
|
@@ -175,7 +174,25 @@ export type ImageBlock = t.TypeOf<typeof ImageBlock>;
|
|
|
175
174
|
export declare function checkImageBlock(block: Block): block is ImageBlock;
|
|
176
175
|
export declare const EmbedBlock: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
177
176
|
type: t.LiteralC<"embed">;
|
|
178
|
-
data: t.
|
|
177
|
+
data: t.IntersectionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
178
|
+
embed_url: t.StringC;
|
|
179
|
+
type: t.StringC;
|
|
180
|
+
}>, t.PartialC<{
|
|
181
|
+
version: t.UnionC<[t.StringC, t.NumberC, t.NullC]>;
|
|
182
|
+
title: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
183
|
+
author_name: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
184
|
+
author_url: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
185
|
+
provider_name: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
186
|
+
provider_url: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
187
|
+
cache_age: t.UnionC<[t.StringC, t.NumberC, t.NullC]>;
|
|
188
|
+
thumbnail_url: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
189
|
+
thumbnail_width: t.UnionC<[t.Type<number, number, unknown>, t.NullC, t.UndefinedC]>;
|
|
190
|
+
thumbnail_height: t.UnionC<[t.Type<number, number, unknown>, t.NullC, t.UndefinedC]>;
|
|
191
|
+
html: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
192
|
+
}>]>>, t.ExactC<t.TypeC<{
|
|
193
|
+
__TYPE__: t.LiteralC<"EmbedContent">;
|
|
194
|
+
all: t.UnknownC;
|
|
195
|
+
}>>]>;
|
|
179
196
|
}>, t.PartialC<{
|
|
180
197
|
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
181
198
|
direction: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
@@ -277,7 +294,25 @@ export declare const BlockLegacy: t.Type<({
|
|
|
277
294
|
direction?: string | null | undefined;
|
|
278
295
|
}) | ({
|
|
279
296
|
type: "embed";
|
|
280
|
-
data:
|
|
297
|
+
data: {
|
|
298
|
+
embed_url: string;
|
|
299
|
+
type: string;
|
|
300
|
+
} & {
|
|
301
|
+
version?: string | number | null;
|
|
302
|
+
title?: string | null | undefined;
|
|
303
|
+
author_name?: string | null | undefined;
|
|
304
|
+
author_url?: string | null | undefined;
|
|
305
|
+
provider_name?: string | null | undefined;
|
|
306
|
+
provider_url?: string | null | undefined;
|
|
307
|
+
cache_age?: string | number | null;
|
|
308
|
+
thumbnail_url?: string | null | undefined;
|
|
309
|
+
thumbnail_width?: number | null | undefined;
|
|
310
|
+
thumbnail_height?: number | null | undefined;
|
|
311
|
+
html?: string | null | undefined;
|
|
312
|
+
} & {
|
|
313
|
+
__TYPE__: "EmbedContent";
|
|
314
|
+
all: unknown;
|
|
315
|
+
};
|
|
281
316
|
} & {
|
|
282
317
|
label?: string | null | undefined;
|
|
283
318
|
direction?: string | null | undefined;
|
|
@@ -367,7 +402,25 @@ export declare const BlockLegacy: t.Type<({
|
|
|
367
402
|
direction?: string | null | undefined;
|
|
368
403
|
}) | ({
|
|
369
404
|
type: "embed";
|
|
370
|
-
data:
|
|
405
|
+
data: {
|
|
406
|
+
embed_url: string;
|
|
407
|
+
type: string;
|
|
408
|
+
} & {
|
|
409
|
+
version?: string | number | null;
|
|
410
|
+
title?: string | null | undefined;
|
|
411
|
+
author_name?: string | null | undefined;
|
|
412
|
+
author_url?: string | null | undefined;
|
|
413
|
+
provider_name?: string | null | undefined;
|
|
414
|
+
provider_url?: string | null | undefined;
|
|
415
|
+
cache_age?: string | number | null;
|
|
416
|
+
thumbnail_url?: string | null | undefined;
|
|
417
|
+
thumbnail_width?: number | null | undefined;
|
|
418
|
+
thumbnail_height?: number | null | undefined;
|
|
419
|
+
html?: string | null | undefined;
|
|
420
|
+
} & {
|
|
421
|
+
__TYPE__: "EmbedContent";
|
|
422
|
+
all: unknown;
|
|
423
|
+
};
|
|
371
424
|
} & {
|
|
372
425
|
label?: string | null | undefined;
|
|
373
426
|
direction?: string | null | undefined;
|
|
@@ -496,7 +549,25 @@ export declare const Block: t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
496
549
|
direction: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
497
550
|
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
498
551
|
type: t.LiteralC<"embed">;
|
|
499
|
-
data: t.
|
|
552
|
+
data: t.IntersectionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
553
|
+
embed_url: t.StringC;
|
|
554
|
+
type: t.StringC;
|
|
555
|
+
}>, t.PartialC<{
|
|
556
|
+
version: t.UnionC<[t.StringC, t.NumberC, t.NullC]>;
|
|
557
|
+
title: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
558
|
+
author_name: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
559
|
+
author_url: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
560
|
+
provider_name: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
561
|
+
provider_url: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
562
|
+
cache_age: t.UnionC<[t.StringC, t.NumberC, t.NullC]>;
|
|
563
|
+
thumbnail_url: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
564
|
+
thumbnail_width: t.UnionC<[t.Type<number, number, unknown>, t.NullC, t.UndefinedC]>;
|
|
565
|
+
thumbnail_height: t.UnionC<[t.Type<number, number, unknown>, t.NullC, t.UndefinedC]>;
|
|
566
|
+
html: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
567
|
+
}>]>>, t.ExactC<t.TypeC<{
|
|
568
|
+
__TYPE__: t.LiteralC<"EmbedContent">;
|
|
569
|
+
all: t.UnknownC;
|
|
570
|
+
}>>]>;
|
|
500
571
|
}>, t.PartialC<{
|
|
501
572
|
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
502
573
|
direction: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
@@ -84,23 +84,31 @@ exports.checkImageBlock = checkImageBlock;
|
|
|
84
84
|
const embedBlockLegacyCodec = t.exact(t.intersection([
|
|
85
85
|
t.type({
|
|
86
86
|
type: t.literal(nestable_1.RichTextNodeType.embed),
|
|
87
|
-
data:
|
|
87
|
+
data: t.unknown,
|
|
88
88
|
}),
|
|
89
89
|
t.partial({
|
|
90
90
|
label: validators_1.StringOrNull,
|
|
91
91
|
direction: validators_1.StringOrNull,
|
|
92
92
|
}),
|
|
93
93
|
]));
|
|
94
|
-
const EmbedBlockLegacy = new t.Type("EmbedBlockLegacy", (u) => u.type === "embed", (block) => (0, function_1.pipe)(embedBlockLegacyCodec.decode(block), fp_ts_1.either.
|
|
94
|
+
const EmbedBlockLegacy = new t.Type("EmbedBlockLegacy", (u) => u.type === "embed", (block) => (0, function_1.pipe)(embedBlockLegacyCodec.decode(block), fp_ts_1.either.chain((decodedBlock) => {
|
|
95
|
+
return fp_ts_1.either.map((decodedData) => {
|
|
96
|
+
return [decodedBlock, decodedData];
|
|
97
|
+
})(EmbedContent_1.EmbedContentLegacy.decode(decodedBlock.data));
|
|
98
|
+
}), fp_ts_1.either.map(([block, parsedData]) => {
|
|
95
99
|
return exports.EmbedBlock.encode({
|
|
96
|
-
...
|
|
97
|
-
data:
|
|
98
|
-
...
|
|
100
|
+
...block,
|
|
101
|
+
data: {
|
|
102
|
+
...parsedData,
|
|
99
103
|
__TYPE__: EmbedContent_1.EmbedContentType,
|
|
100
|
-
|
|
104
|
+
all: block.data,
|
|
105
|
+
},
|
|
101
106
|
});
|
|
102
107
|
})), (embedBlock) => {
|
|
103
|
-
return
|
|
108
|
+
return {
|
|
109
|
+
...embedBlockLegacyCodec.encode(embedBlock),
|
|
110
|
+
data: EmbedContent_1.EmbedContentLegacy.encode(embedBlock.data),
|
|
111
|
+
};
|
|
104
112
|
});
|
|
105
113
|
exports.EmbedBlock = t.exact(t.intersection([
|
|
106
114
|
t.type({
|
|
@@ -73,7 +73,25 @@ export declare const isRichTextContent: (u: unknown) => u is {
|
|
|
73
73
|
direction?: string | null | undefined;
|
|
74
74
|
}) | ({
|
|
75
75
|
type: "embed";
|
|
76
|
-
data:
|
|
76
|
+
data: {
|
|
77
|
+
embed_url: string;
|
|
78
|
+
type: string;
|
|
79
|
+
} & {
|
|
80
|
+
version?: string | number | null;
|
|
81
|
+
title?: string | null | undefined;
|
|
82
|
+
author_name?: string | null | undefined;
|
|
83
|
+
author_url?: string | null | undefined;
|
|
84
|
+
provider_name?: string | null | undefined;
|
|
85
|
+
provider_url?: string | null | undefined;
|
|
86
|
+
cache_age?: string | number | null;
|
|
87
|
+
thumbnail_url?: string | null | undefined;
|
|
88
|
+
thumbnail_width?: number | null | undefined;
|
|
89
|
+
thumbnail_height?: number | null | undefined;
|
|
90
|
+
html?: string | null | undefined;
|
|
91
|
+
} & {
|
|
92
|
+
__TYPE__: "EmbedContent";
|
|
93
|
+
all: unknown;
|
|
94
|
+
};
|
|
77
95
|
} & {
|
|
78
96
|
label?: string | null | undefined;
|
|
79
97
|
direction?: string | null | undefined;
|
|
@@ -205,7 +223,25 @@ export declare const RichTextContent: t.ExactC<t.TypeC<{
|
|
|
205
223
|
direction: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
206
224
|
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
207
225
|
type: t.LiteralC<"embed">;
|
|
208
|
-
data: t.
|
|
226
|
+
data: t.IntersectionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
227
|
+
embed_url: t.StringC;
|
|
228
|
+
type: t.StringC;
|
|
229
|
+
}>, t.PartialC<{
|
|
230
|
+
version: t.UnionC<[t.StringC, t.NumberC, t.NullC]>;
|
|
231
|
+
title: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
232
|
+
author_name: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
233
|
+
author_url: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
234
|
+
provider_name: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
235
|
+
provider_url: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
236
|
+
cache_age: t.UnionC<[t.StringC, t.NumberC, t.NullC]>;
|
|
237
|
+
thumbnail_url: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
238
|
+
thumbnail_width: t.UnionC<[t.Type<number, number, unknown>, t.NullC, t.UndefinedC]>;
|
|
239
|
+
thumbnail_height: t.UnionC<[t.Type<number, number, unknown>, t.NullC, t.UndefinedC]>;
|
|
240
|
+
html: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
241
|
+
}>]>>, t.ExactC<t.TypeC<{
|
|
242
|
+
__TYPE__: t.LiteralC<"EmbedContent">;
|
|
243
|
+
all: t.UnknownC;
|
|
244
|
+
}>>]>;
|
|
209
245
|
}>, t.PartialC<{
|
|
210
246
|
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
211
247
|
direction: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
@@ -307,7 +343,25 @@ export declare const RichTextLegacy: (ctx: LegacyContentCtx) => t.Type<{
|
|
|
307
343
|
direction?: string | null | undefined;
|
|
308
344
|
}) | ({
|
|
309
345
|
type: "embed";
|
|
310
|
-
data:
|
|
346
|
+
data: {
|
|
347
|
+
embed_url: string;
|
|
348
|
+
type: string;
|
|
349
|
+
} & {
|
|
350
|
+
version?: string | number | null;
|
|
351
|
+
title?: string | null | undefined;
|
|
352
|
+
author_name?: string | null | undefined;
|
|
353
|
+
author_url?: string | null | undefined;
|
|
354
|
+
provider_name?: string | null | undefined;
|
|
355
|
+
provider_url?: string | null | undefined;
|
|
356
|
+
cache_age?: string | number | null;
|
|
357
|
+
thumbnail_url?: string | null | undefined;
|
|
358
|
+
thumbnail_width?: number | null | undefined;
|
|
359
|
+
thumbnail_height?: number | null | undefined;
|
|
360
|
+
html?: string | null | undefined;
|
|
361
|
+
} & {
|
|
362
|
+
__TYPE__: "EmbedContent";
|
|
363
|
+
all: unknown;
|
|
364
|
+
};
|
|
311
365
|
} & {
|
|
312
366
|
label?: string | null | undefined;
|
|
313
367
|
direction?: string | null | undefined;
|
|
@@ -398,7 +452,25 @@ export declare const RichTextLegacy: (ctx: LegacyContentCtx) => t.Type<{
|
|
|
398
452
|
direction?: string | null | undefined;
|
|
399
453
|
}) | ({
|
|
400
454
|
type: "embed";
|
|
401
|
-
data:
|
|
455
|
+
data: {
|
|
456
|
+
embed_url: string;
|
|
457
|
+
type: string;
|
|
458
|
+
} & {
|
|
459
|
+
version?: string | number | null;
|
|
460
|
+
title?: string | null | undefined;
|
|
461
|
+
author_name?: string | null | undefined;
|
|
462
|
+
author_url?: string | null | undefined;
|
|
463
|
+
provider_name?: string | null | undefined;
|
|
464
|
+
provider_url?: string | null | undefined;
|
|
465
|
+
cache_age?: string | number | null;
|
|
466
|
+
thumbnail_url?: string | null | undefined;
|
|
467
|
+
thumbnail_width?: number | null | undefined;
|
|
468
|
+
thumbnail_height?: number | null | undefined;
|
|
469
|
+
html?: string | null | undefined;
|
|
470
|
+
} & {
|
|
471
|
+
__TYPE__: "EmbedContent";
|
|
472
|
+
all: unknown;
|
|
473
|
+
};
|
|
402
474
|
} & {
|
|
403
475
|
label?: string | null | undefined;
|
|
404
476
|
direction?: string | null | undefined;
|