@prismicio/types-internal 2.2.0-traverse.alpha-8 → 2.2.0-traverse.alpha-9
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 +96 -32
- package/lib/content/fields/GroupContent.d.ts +21 -7
- package/lib/content/fields/WidgetContent.d.ts +96 -32
- package/lib/content/fields/nestable/NestableContent.d.ts +12 -4
- package/lib/content/fields/nestable/RichTextContent/Blocks.d.ts +30 -12
- package/lib/content/fields/nestable/RichTextContent/Blocks.js +11 -2
- package/lib/content/fields/nestable/RichTextContent/index.d.ts +15 -5
- package/lib/content/fields/slices/Slice/CompositeSliceContent.d.ts +24 -8
- package/lib/content/fields/slices/Slice/RepeatableContent.d.ts +9 -3
- package/lib/content/fields/slices/Slice/SharedSliceContent.d.ts +24 -8
- package/lib/content/fields/slices/Slice/SimpleSliceContent.d.ts +24 -8
- package/lib/content/fields/slices/Slice/index.d.ts +54 -18
- package/lib/content/fields/slices/SliceItem.d.ts +54 -18
- package/lib/content/fields/slices/SlicesContent.d.ts +72 -24
- package/package.json +1 -1
- package/src/content/fields/nestable/RichTextContent/Blocks.ts +15 -3
|
@@ -300,7 +300,9 @@ export declare const isSlicesContent: (u: unknown) => u is {
|
|
|
300
300
|
preview?: {
|
|
301
301
|
title?: string;
|
|
302
302
|
} | null | undefined;
|
|
303
|
-
})
|
|
303
|
+
}) | {
|
|
304
|
+
label: string;
|
|
305
|
+
};
|
|
304
306
|
} & {
|
|
305
307
|
start: number;
|
|
306
308
|
end: number;
|
|
@@ -608,7 +610,9 @@ export declare const isSlicesContent: (u: unknown) => u is {
|
|
|
608
610
|
preview?: {
|
|
609
611
|
title?: string;
|
|
610
612
|
} | null | undefined;
|
|
611
|
-
})
|
|
613
|
+
}) | {
|
|
614
|
+
label: string;
|
|
615
|
+
};
|
|
612
616
|
} & {
|
|
613
617
|
start: number;
|
|
614
618
|
end: number;
|
|
@@ -917,7 +921,9 @@ export declare const isSlicesContent: (u: unknown) => u is {
|
|
|
917
921
|
preview?: {
|
|
918
922
|
title?: string;
|
|
919
923
|
} | null | undefined;
|
|
920
|
-
})
|
|
924
|
+
}) | {
|
|
925
|
+
label: string;
|
|
926
|
+
};
|
|
921
927
|
} & {
|
|
922
928
|
start: number;
|
|
923
929
|
end: number;
|
|
@@ -1225,7 +1231,9 @@ export declare const isSlicesContent: (u: unknown) => u is {
|
|
|
1225
1231
|
preview?: {
|
|
1226
1232
|
title?: string;
|
|
1227
1233
|
} | null | undefined;
|
|
1228
|
-
})
|
|
1234
|
+
}) | {
|
|
1235
|
+
label: string;
|
|
1236
|
+
};
|
|
1229
1237
|
} & {
|
|
1230
1238
|
start: number;
|
|
1231
1239
|
end: number;
|
|
@@ -1535,7 +1543,9 @@ export declare const isSlicesContent: (u: unknown) => u is {
|
|
|
1535
1543
|
preview?: {
|
|
1536
1544
|
title?: string;
|
|
1537
1545
|
} | null | undefined;
|
|
1538
|
-
})
|
|
1546
|
+
}) | {
|
|
1547
|
+
label: string;
|
|
1548
|
+
};
|
|
1539
1549
|
} & {
|
|
1540
1550
|
start: number;
|
|
1541
1551
|
end: number;
|
|
@@ -1843,7 +1853,9 @@ export declare const isSlicesContent: (u: unknown) => u is {
|
|
|
1843
1853
|
preview?: {
|
|
1844
1854
|
title?: string;
|
|
1845
1855
|
} | null | undefined;
|
|
1846
|
-
})
|
|
1856
|
+
}) | {
|
|
1857
|
+
label: string;
|
|
1858
|
+
};
|
|
1847
1859
|
} & {
|
|
1848
1860
|
start: number;
|
|
1849
1861
|
end: number;
|
|
@@ -2159,7 +2171,9 @@ export declare const SlicesLegacy: (ctx: LegacyContentCtx) => t.Type<{
|
|
|
2159
2171
|
preview?: {
|
|
2160
2172
|
title?: string;
|
|
2161
2173
|
} | null | undefined;
|
|
2162
|
-
})
|
|
2174
|
+
}) | {
|
|
2175
|
+
label: string;
|
|
2176
|
+
};
|
|
2163
2177
|
} & {
|
|
2164
2178
|
start: number;
|
|
2165
2179
|
end: number;
|
|
@@ -2467,7 +2481,9 @@ export declare const SlicesLegacy: (ctx: LegacyContentCtx) => t.Type<{
|
|
|
2467
2481
|
preview?: {
|
|
2468
2482
|
title?: string;
|
|
2469
2483
|
} | null | undefined;
|
|
2470
|
-
})
|
|
2484
|
+
}) | {
|
|
2485
|
+
label: string;
|
|
2486
|
+
};
|
|
2471
2487
|
} & {
|
|
2472
2488
|
start: number;
|
|
2473
2489
|
end: number;
|
|
@@ -2776,7 +2792,9 @@ export declare const SlicesLegacy: (ctx: LegacyContentCtx) => t.Type<{
|
|
|
2776
2792
|
preview?: {
|
|
2777
2793
|
title?: string;
|
|
2778
2794
|
} | null | undefined;
|
|
2779
|
-
})
|
|
2795
|
+
}) | {
|
|
2796
|
+
label: string;
|
|
2797
|
+
};
|
|
2780
2798
|
} & {
|
|
2781
2799
|
start: number;
|
|
2782
2800
|
end: number;
|
|
@@ -3084,7 +3102,9 @@ export declare const SlicesLegacy: (ctx: LegacyContentCtx) => t.Type<{
|
|
|
3084
3102
|
preview?: {
|
|
3085
3103
|
title?: string;
|
|
3086
3104
|
} | null | undefined;
|
|
3087
|
-
})
|
|
3105
|
+
}) | {
|
|
3106
|
+
label: string;
|
|
3107
|
+
};
|
|
3088
3108
|
} & {
|
|
3089
3109
|
start: number;
|
|
3090
3110
|
end: number;
|
|
@@ -3394,7 +3414,9 @@ export declare const SlicesLegacy: (ctx: LegacyContentCtx) => t.Type<{
|
|
|
3394
3414
|
preview?: {
|
|
3395
3415
|
title?: string;
|
|
3396
3416
|
} | null | undefined;
|
|
3397
|
-
})
|
|
3417
|
+
}) | {
|
|
3418
|
+
label: string;
|
|
3419
|
+
};
|
|
3398
3420
|
} & {
|
|
3399
3421
|
start: number;
|
|
3400
3422
|
end: number;
|
|
@@ -3702,7 +3724,9 @@ export declare const SlicesLegacy: (ctx: LegacyContentCtx) => t.Type<{
|
|
|
3702
3724
|
preview?: {
|
|
3703
3725
|
title?: string;
|
|
3704
3726
|
} | null | undefined;
|
|
3705
|
-
})
|
|
3727
|
+
}) | {
|
|
3728
|
+
label: string;
|
|
3729
|
+
};
|
|
3706
3730
|
} & {
|
|
3707
3731
|
start: number;
|
|
3708
3732
|
end: number;
|
|
@@ -4047,7 +4071,9 @@ export declare const SlicesContent: t.TypeC<{
|
|
|
4047
4071
|
preview?: {
|
|
4048
4072
|
title?: string;
|
|
4049
4073
|
} | null | undefined;
|
|
4050
|
-
})
|
|
4074
|
+
}) | {
|
|
4075
|
+
label: string;
|
|
4076
|
+
};
|
|
4051
4077
|
} & {
|
|
4052
4078
|
start: number;
|
|
4053
4079
|
end: number;
|
|
@@ -4091,7 +4117,9 @@ export declare const SlicesContent: t.TypeC<{
|
|
|
4091
4117
|
preview?: {
|
|
4092
4118
|
title?: string;
|
|
4093
4119
|
} | null | undefined;
|
|
4094
|
-
})
|
|
4120
|
+
}) | {
|
|
4121
|
+
label: string;
|
|
4122
|
+
};
|
|
4095
4123
|
} & {
|
|
4096
4124
|
start: number;
|
|
4097
4125
|
end: number;
|
|
@@ -4426,7 +4454,9 @@ export declare const SlicesContent: t.TypeC<{
|
|
|
4426
4454
|
preview?: {
|
|
4427
4455
|
title?: string;
|
|
4428
4456
|
} | null | undefined;
|
|
4429
|
-
})
|
|
4457
|
+
}) | {
|
|
4458
|
+
label: string;
|
|
4459
|
+
};
|
|
4430
4460
|
} & {
|
|
4431
4461
|
start: number;
|
|
4432
4462
|
end: number;
|
|
@@ -4470,7 +4500,9 @@ export declare const SlicesContent: t.TypeC<{
|
|
|
4470
4500
|
preview?: {
|
|
4471
4501
|
title?: string;
|
|
4472
4502
|
} | null | undefined;
|
|
4473
|
-
})
|
|
4503
|
+
}) | {
|
|
4504
|
+
label: string;
|
|
4505
|
+
};
|
|
4474
4506
|
} & {
|
|
4475
4507
|
start: number;
|
|
4476
4508
|
end: number;
|
|
@@ -4807,7 +4839,9 @@ export declare const SlicesContent: t.TypeC<{
|
|
|
4807
4839
|
preview?: {
|
|
4808
4840
|
title?: string;
|
|
4809
4841
|
} | null | undefined;
|
|
4810
|
-
})
|
|
4842
|
+
}) | {
|
|
4843
|
+
label: string;
|
|
4844
|
+
};
|
|
4811
4845
|
} & {
|
|
4812
4846
|
start: number;
|
|
4813
4847
|
end: number;
|
|
@@ -4851,7 +4885,9 @@ export declare const SlicesContent: t.TypeC<{
|
|
|
4851
4885
|
preview?: {
|
|
4852
4886
|
title?: string;
|
|
4853
4887
|
} | null | undefined;
|
|
4854
|
-
})
|
|
4888
|
+
}) | {
|
|
4889
|
+
label: string;
|
|
4890
|
+
};
|
|
4855
4891
|
} & {
|
|
4856
4892
|
start: number;
|
|
4857
4893
|
end: number;
|
|
@@ -5186,7 +5222,9 @@ export declare const SlicesContent: t.TypeC<{
|
|
|
5186
5222
|
preview?: {
|
|
5187
5223
|
title?: string;
|
|
5188
5224
|
} | null | undefined;
|
|
5189
|
-
})
|
|
5225
|
+
}) | {
|
|
5226
|
+
label: string;
|
|
5227
|
+
};
|
|
5190
5228
|
} & {
|
|
5191
5229
|
start: number;
|
|
5192
5230
|
end: number;
|
|
@@ -5230,7 +5268,9 @@ export declare const SlicesContent: t.TypeC<{
|
|
|
5230
5268
|
preview?: {
|
|
5231
5269
|
title?: string;
|
|
5232
5270
|
} | null | undefined;
|
|
5233
|
-
})
|
|
5271
|
+
}) | {
|
|
5272
|
+
label: string;
|
|
5273
|
+
};
|
|
5234
5274
|
} & {
|
|
5235
5275
|
start: number;
|
|
5236
5276
|
end: number;
|
|
@@ -5564,7 +5604,9 @@ export declare const SlicesContent: t.TypeC<{
|
|
|
5564
5604
|
preview?: {
|
|
5565
5605
|
title?: string;
|
|
5566
5606
|
} | null | undefined;
|
|
5567
|
-
})
|
|
5607
|
+
}) | {
|
|
5608
|
+
label: string;
|
|
5609
|
+
};
|
|
5568
5610
|
} & {
|
|
5569
5611
|
start: number;
|
|
5570
5612
|
end: number;
|
|
@@ -5608,7 +5650,9 @@ export declare const SlicesContent: t.TypeC<{
|
|
|
5608
5650
|
preview?: {
|
|
5609
5651
|
title?: string;
|
|
5610
5652
|
} | null | undefined;
|
|
5611
|
-
})
|
|
5653
|
+
}) | {
|
|
5654
|
+
label: string;
|
|
5655
|
+
};
|
|
5612
5656
|
} & {
|
|
5613
5657
|
start: number;
|
|
5614
5658
|
end: number;
|
|
@@ -5944,7 +5988,9 @@ export declare const SlicesContent: t.TypeC<{
|
|
|
5944
5988
|
preview?: {
|
|
5945
5989
|
title?: string;
|
|
5946
5990
|
} | null | undefined;
|
|
5947
|
-
})
|
|
5991
|
+
}) | {
|
|
5992
|
+
label: string;
|
|
5993
|
+
};
|
|
5948
5994
|
} & {
|
|
5949
5995
|
start: number;
|
|
5950
5996
|
end: number;
|
|
@@ -5988,7 +6034,9 @@ export declare const SlicesContent: t.TypeC<{
|
|
|
5988
6034
|
preview?: {
|
|
5989
6035
|
title?: string;
|
|
5990
6036
|
} | null | undefined;
|
|
5991
|
-
})
|
|
6037
|
+
}) | {
|
|
6038
|
+
label: string;
|
|
6039
|
+
};
|
|
5992
6040
|
} & {
|
|
5993
6041
|
start: number;
|
|
5994
6042
|
end: number;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { either } from "fp-ts"
|
|
2
|
-
import {
|
|
2
|
+
import { isLeft } from "fp-ts/lib/Either"
|
|
3
3
|
import { pipe } from "fp-ts/lib/function"
|
|
4
4
|
import * as t from "io-ts"
|
|
5
5
|
|
|
@@ -18,11 +18,15 @@ import {
|
|
|
18
18
|
import { ImageContentView } from "../ImageContent"
|
|
19
19
|
import { Link, LinkLegacy } from "../LinkContent"
|
|
20
20
|
|
|
21
|
+
const labelCodec = t.strict({
|
|
22
|
+
label: t.string,
|
|
23
|
+
})
|
|
24
|
+
|
|
21
25
|
const SpanFn = (linkCodec: typeof Link | typeof LinkLegacy) =>
|
|
22
26
|
t.exact(
|
|
23
27
|
t.intersection([
|
|
24
28
|
t.partial({
|
|
25
|
-
data: linkCodec,
|
|
29
|
+
data: t.union([linkCodec, labelCodec]),
|
|
26
30
|
}),
|
|
27
31
|
t.type({
|
|
28
32
|
start: t.number,
|
|
@@ -51,7 +55,15 @@ export const ValidatedSpans = <C extends typeof Span | typeof SpanLegacy>(
|
|
|
51
55
|
const res = spans
|
|
52
56
|
.reduce<Array<S>>((acc, maybeSpan) => {
|
|
53
57
|
const decodedSpan = spanCodec.decode(maybeSpan)
|
|
54
|
-
|
|
58
|
+
if (isLeft(decodedSpan)) return acc
|
|
59
|
+
if (
|
|
60
|
+
(decodedSpan.right.type === "hyperlink" ||
|
|
61
|
+
decodedSpan.right.type === "label") &&
|
|
62
|
+
!decodedSpan.right.data
|
|
63
|
+
)
|
|
64
|
+
return acc
|
|
65
|
+
|
|
66
|
+
return [...acc, decodedSpan.right]
|
|
55
67
|
}, [])
|
|
56
68
|
.sort((m1: S, m2: S) => m1.start - m2.start)
|
|
57
69
|
return t.success(res)
|