@prismicio/types-internal 2.2.0-traverse.alpha-6 → 2.2.0-traverse.alpha-7

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.
Files changed (62) hide show
  1. package/lib/_internal/utils.d.ts +3 -3
  2. package/lib/content/Document.d.ts +1248 -32
  3. package/lib/content/fields/GroupContent.d.ts +273 -7
  4. package/lib/content/fields/WidgetContent.d.ts +1248 -32
  5. package/lib/content/fields/nestable/NestableContent.d.ts +156 -4
  6. package/lib/content/fields/nestable/RichTextContent/Blocks.d.ts +582 -28
  7. package/lib/content/fields/nestable/RichTextContent/Blocks.js +29 -46
  8. package/lib/content/fields/nestable/RichTextContent/index.d.ts +195 -5
  9. package/lib/content/fields/slices/Slice/CompositeSliceContent.d.ts +314 -10
  10. package/lib/content/fields/slices/Slice/CompositeSliceContent.js +3 -5
  11. package/lib/content/fields/slices/Slice/RepeatableContent.d.ts +117 -3
  12. package/lib/content/fields/slices/Slice/SharedSliceContent.d.ts +312 -8
  13. package/lib/content/fields/slices/Slice/SimpleSliceContent.d.ts +312 -8
  14. package/lib/content/fields/slices/Slice/index.d.ts +702 -18
  15. package/lib/content/fields/slices/SliceItem.d.ts +702 -18
  16. package/lib/content/fields/slices/SlicesContent.d.ts +936 -24
  17. package/lib/content/fields/slices/SlicesContent.js +2 -4
  18. package/lib/customtypes/widgets/slices/CompositeSlice.d.ts +0 -5
  19. package/lib/import/converters/fields/nestable/GeoPoint.d.ts +3 -0
  20. package/lib/import/converters/fields/nestable/GeoPoint.js +15 -0
  21. package/lib/import/converters/fields/nestable/Image.d.ts +25 -3
  22. package/lib/import/converters/fields/nestable/Image.js +21 -25
  23. package/lib/import/converters/fields/nestable/RichText/embedBlock.d.ts +4 -0
  24. package/lib/import/converters/fields/nestable/RichText/embedBlock.js +14 -0
  25. package/lib/import/converters/fields/nestable/RichText/imageBlock.d.ts +4 -0
  26. package/lib/import/converters/fields/nestable/RichText/imageBlock.js +12 -0
  27. package/lib/import/converters/fields/nestable/RichText/index.d.ts +4 -0
  28. package/lib/import/converters/fields/nestable/RichText/index.js +22 -0
  29. package/lib/import/converters/fields/nestable/RichText/textBlock.d.ts +4 -0
  30. package/lib/import/converters/fields/nestable/RichText/textBlock.js +41 -0
  31. package/lib/import/converters/fields/nestable/index.d.ts +1 -1
  32. package/lib/import/converters/fields/nestable/index.js +1 -1
  33. package/lib/import/validators/fields/ImportContent.js +3 -3
  34. package/lib/import/validators/fields/ImportField.d.ts +1 -1
  35. package/lib/import/validators/fields/ImportSlices/ImportSlices.js +4 -3
  36. package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceContent/SharedSliceContentEntry.js +1 -1
  37. package/lib/import/validators/fields/nestable/ImportRichText/ImportRichText.d.ts +1 -1
  38. package/lib/import/validators/fields/nestable/ImportRichText/ImportRichText.js +20 -14
  39. package/lib/import/validators/fields/nestable/ImportRichText/blocks/ImportImageBlock.d.ts +16 -2
  40. package/lib/import/validators/fields/nestable/ImportRichText/blocks/ImportImageBlock.js +7 -5
  41. package/lib/import/validators/fields/nestable/Nestable.d.ts +1 -1
  42. package/lib/validators/DefaultOrElse.js +3 -3
  43. package/package.json +1 -1
  44. package/src/_internal/utils.ts +3 -3
  45. package/src/content/fields/nestable/RichTextContent/Blocks.ts +48 -58
  46. package/src/content/fields/slices/Slice/CompositeSliceContent.ts +4 -9
  47. package/src/content/fields/slices/SlicesContent.ts +4 -6
  48. package/src/customtypes/widgets/slices/CompositeSlice.ts +0 -6
  49. package/src/import/converters/fields/nestable/Image.ts +10 -22
  50. package/src/import/converters/fields/nestable/RichText/embedBlock.ts +17 -0
  51. package/src/import/converters/fields/nestable/RichText/imageBlock.ts +17 -0
  52. package/src/import/converters/fields/nestable/RichText/index.ts +23 -0
  53. package/src/import/converters/fields/nestable/RichText/textBlock.ts +48 -0
  54. package/src/import/converters/fields/nestable/index.ts +1 -1
  55. package/src/import/validators/fields/ImportContent.ts +3 -3
  56. package/src/import/validators/fields/ImportSlices/ImportSlices.ts +7 -5
  57. package/src/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceContent/SharedSliceContentEntry.ts +1 -1
  58. package/src/import/validators/fields/nestable/ImportRichText/ImportRichText.ts +38 -25
  59. package/src/import/validators/fields/nestable/ImportRichText/blocks/ImportImageBlock.ts +9 -5
  60. package/src/validators/DefaultOrElse.ts +4 -4
  61. package/src/import/converters/fields/nestable/RichText.ts +0 -62
  62. /package/src/import/converters/fields/nestable/{GeooPoint.ts → GeoPoint.ts} +0 -0
@@ -1,6 +1,6 @@
1
1
  import * as t from "io-ts";
2
2
  import type { ContentPath, TraverseSliceContentFn, TraverseWidgetContentFn } from "../../../../_internal/utils";
3
- import type { CompositeSliceFields, VariationFields } from "../../../../customtypes";
3
+ import type { CompositeSlice, VariationFields } from "../../../../customtypes";
4
4
  import { LegacyContentCtx, WithTypes } from "../../../LegacyContentCtx";
5
5
  import type { CompositeSliceItemContent, SharedSliceItemContent } from "../SliceItem";
6
6
  export declare const CompositeSliceContentType = "CompositeSliceContent";
@@ -260,7 +260,45 @@ export declare const isCompositeSliceContent: (u: unknown) => u is {
260
260
  text: string;
261
261
  } & {
262
262
  spans?: ({
263
- data?: unknown;
263
+ data?: ({
264
+ __TYPE__: "ImageLink";
265
+ } & {
266
+ id: string;
267
+ url: string;
268
+ height: string;
269
+ width: string;
270
+ size: string;
271
+ name: string;
272
+ kind: string;
273
+ } & {
274
+ date?: string | null | undefined;
275
+ }) | ({
276
+ id: string;
277
+ url: string;
278
+ name: string;
279
+ kind: string;
280
+ size: string;
281
+ } & {
282
+ date?: string | null | undefined;
283
+ } & {
284
+ __TYPE__: "FileLink";
285
+ } & {
286
+ size?: string;
287
+ }) | ({
288
+ __TYPE__: "DocumentLink";
289
+ } & {
290
+ id: string;
291
+ }) | ({
292
+ __TYPE__: "ExternalLink";
293
+ } & {
294
+ url: string;
295
+ } & {
296
+ kind?: "web";
297
+ target?: string | null | undefined;
298
+ preview?: {
299
+ title?: string;
300
+ } | null | undefined;
301
+ });
264
302
  } & {
265
303
  start: number;
266
304
  end: number;
@@ -530,7 +568,45 @@ export declare const isCompositeSliceContent: (u: unknown) => u is {
530
568
  text: string;
531
569
  } & {
532
570
  spans?: ({
533
- data?: unknown;
571
+ data?: ({
572
+ __TYPE__: "ImageLink";
573
+ } & {
574
+ id: string;
575
+ url: string;
576
+ height: string;
577
+ width: string;
578
+ size: string;
579
+ name: string;
580
+ kind: string;
581
+ } & {
582
+ date?: string | null | undefined;
583
+ }) | ({
584
+ id: string;
585
+ url: string;
586
+ name: string;
587
+ kind: string;
588
+ size: string;
589
+ } & {
590
+ date?: string | null | undefined;
591
+ } & {
592
+ __TYPE__: "FileLink";
593
+ } & {
594
+ size?: string;
595
+ }) | ({
596
+ __TYPE__: "DocumentLink";
597
+ } & {
598
+ id: string;
599
+ }) | ({
600
+ __TYPE__: "ExternalLink";
601
+ } & {
602
+ url: string;
603
+ } & {
604
+ kind?: "web";
605
+ target?: string | null | undefined;
606
+ preview?: {
607
+ title?: string;
608
+ } | null | undefined;
609
+ });
534
610
  } & {
535
611
  start: number;
536
612
  end: number;
@@ -802,7 +878,45 @@ export declare const CompositeSliceLegacy: (ctx: LegacyContentCtx) => t.Type<{
802
878
  text: string;
803
879
  } & {
804
880
  spans?: ({
805
- data?: unknown;
881
+ data?: ({
882
+ __TYPE__: "ImageLink";
883
+ } & {
884
+ id: string;
885
+ url: string;
886
+ height: string;
887
+ width: string;
888
+ size: string;
889
+ name: string;
890
+ kind: string;
891
+ } & {
892
+ date?: string | null | undefined;
893
+ }) | ({
894
+ id: string;
895
+ url: string;
896
+ name: string;
897
+ kind: string;
898
+ size: string;
899
+ } & {
900
+ date?: string | null | undefined;
901
+ } & {
902
+ __TYPE__: "FileLink";
903
+ } & {
904
+ size?: string;
905
+ }) | ({
906
+ __TYPE__: "DocumentLink";
907
+ } & {
908
+ id: string;
909
+ }) | ({
910
+ __TYPE__: "ExternalLink";
911
+ } & {
912
+ url: string;
913
+ } & {
914
+ kind?: "web";
915
+ target?: string | null | undefined;
916
+ preview?: {
917
+ title?: string;
918
+ } | null | undefined;
919
+ });
806
920
  } & {
807
921
  start: number;
808
922
  end: number;
@@ -1072,7 +1186,45 @@ export declare const CompositeSliceLegacy: (ctx: LegacyContentCtx) => t.Type<{
1072
1186
  text: string;
1073
1187
  } & {
1074
1188
  spans?: ({
1075
- data?: unknown;
1189
+ data?: ({
1190
+ __TYPE__: "ImageLink";
1191
+ } & {
1192
+ id: string;
1193
+ url: string;
1194
+ height: string;
1195
+ width: string;
1196
+ size: string;
1197
+ name: string;
1198
+ kind: string;
1199
+ } & {
1200
+ date?: string | null | undefined;
1201
+ }) | ({
1202
+ id: string;
1203
+ url: string;
1204
+ name: string;
1205
+ kind: string;
1206
+ size: string;
1207
+ } & {
1208
+ date?: string | null | undefined;
1209
+ } & {
1210
+ __TYPE__: "FileLink";
1211
+ } & {
1212
+ size?: string;
1213
+ }) | ({
1214
+ __TYPE__: "DocumentLink";
1215
+ } & {
1216
+ id: string;
1217
+ }) | ({
1218
+ __TYPE__: "ExternalLink";
1219
+ } & {
1220
+ url: string;
1221
+ } & {
1222
+ kind?: "web";
1223
+ target?: string | null | undefined;
1224
+ preview?: {
1225
+ title?: string;
1226
+ } | null | undefined;
1227
+ });
1076
1228
  } & {
1077
1229
  start: number;
1078
1230
  end: number;
@@ -1376,13 +1528,89 @@ export declare const CompositeSliceContent: t.ExactC<t.TypeC<{
1376
1528
  text: t.StringC;
1377
1529
  }>, t.PartialC<{
1378
1530
  spans: t.Type<({
1379
- data?: unknown;
1531
+ data?: ({
1532
+ __TYPE__: "ImageLink";
1533
+ } & {
1534
+ id: string;
1535
+ url: string;
1536
+ height: string;
1537
+ width: string;
1538
+ size: string;
1539
+ name: string;
1540
+ kind: string;
1541
+ } & {
1542
+ date?: string | null | undefined;
1543
+ }) | ({
1544
+ id: string;
1545
+ url: string;
1546
+ name: string;
1547
+ kind: string;
1548
+ size: string;
1549
+ } & {
1550
+ date?: string | null | undefined;
1551
+ } & {
1552
+ __TYPE__: "FileLink";
1553
+ } & {
1554
+ size?: string;
1555
+ }) | ({
1556
+ __TYPE__: "DocumentLink";
1557
+ } & {
1558
+ id: string;
1559
+ }) | ({
1560
+ __TYPE__: "ExternalLink";
1561
+ } & {
1562
+ url: string;
1563
+ } & {
1564
+ kind?: "web";
1565
+ target?: string | null | undefined;
1566
+ preview?: {
1567
+ title?: string;
1568
+ } | null | undefined;
1569
+ });
1380
1570
  } & {
1381
1571
  start: number;
1382
1572
  end: number;
1383
1573
  type: "image" | "label" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "embed" | "list-item" | "o-list-item" | "rtl";
1384
1574
  })[], ({
1385
- data?: unknown;
1575
+ data?: ({
1576
+ __TYPE__: "ImageLink";
1577
+ } & {
1578
+ id: string;
1579
+ url: string;
1580
+ height: string;
1581
+ width: string;
1582
+ size: string;
1583
+ name: string;
1584
+ kind: string;
1585
+ } & {
1586
+ date?: string | null | undefined;
1587
+ }) | ({
1588
+ id: string;
1589
+ url: string;
1590
+ name: string;
1591
+ kind: string;
1592
+ size: string;
1593
+ } & {
1594
+ date?: string | null | undefined;
1595
+ } & {
1596
+ __TYPE__: "FileLink";
1597
+ } & {
1598
+ size?: string;
1599
+ }) | ({
1600
+ __TYPE__: "DocumentLink";
1601
+ } & {
1602
+ id: string;
1603
+ }) | ({
1604
+ __TYPE__: "ExternalLink";
1605
+ } & {
1606
+ url: string;
1607
+ } & {
1608
+ kind?: "web";
1609
+ target?: string | null | undefined;
1610
+ preview?: {
1611
+ title?: string;
1612
+ } | null | undefined;
1613
+ });
1386
1614
  } & {
1387
1615
  start: number;
1388
1616
  end: number;
@@ -1679,13 +1907,89 @@ export declare const CompositeSliceContent: t.ExactC<t.TypeC<{
1679
1907
  text: t.StringC;
1680
1908
  }>, t.PartialC<{
1681
1909
  spans: t.Type<({
1682
- data?: unknown;
1910
+ data?: ({
1911
+ __TYPE__: "ImageLink";
1912
+ } & {
1913
+ id: string;
1914
+ url: string;
1915
+ height: string;
1916
+ width: string;
1917
+ size: string;
1918
+ name: string;
1919
+ kind: string;
1920
+ } & {
1921
+ date?: string | null | undefined;
1922
+ }) | ({
1923
+ id: string;
1924
+ url: string;
1925
+ name: string;
1926
+ kind: string;
1927
+ size: string;
1928
+ } & {
1929
+ date?: string | null | undefined;
1930
+ } & {
1931
+ __TYPE__: "FileLink";
1932
+ } & {
1933
+ size?: string;
1934
+ }) | ({
1935
+ __TYPE__: "DocumentLink";
1936
+ } & {
1937
+ id: string;
1938
+ }) | ({
1939
+ __TYPE__: "ExternalLink";
1940
+ } & {
1941
+ url: string;
1942
+ } & {
1943
+ kind?: "web";
1944
+ target?: string | null | undefined;
1945
+ preview?: {
1946
+ title?: string;
1947
+ } | null | undefined;
1948
+ });
1683
1949
  } & {
1684
1950
  start: number;
1685
1951
  end: number;
1686
1952
  type: "image" | "label" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "embed" | "list-item" | "o-list-item" | "rtl";
1687
1953
  })[], ({
1688
- data?: unknown;
1954
+ data?: ({
1955
+ __TYPE__: "ImageLink";
1956
+ } & {
1957
+ id: string;
1958
+ url: string;
1959
+ height: string;
1960
+ width: string;
1961
+ size: string;
1962
+ name: string;
1963
+ kind: string;
1964
+ } & {
1965
+ date?: string | null | undefined;
1966
+ }) | ({
1967
+ id: string;
1968
+ url: string;
1969
+ name: string;
1970
+ kind: string;
1971
+ size: string;
1972
+ } & {
1973
+ date?: string | null | undefined;
1974
+ } & {
1975
+ __TYPE__: "FileLink";
1976
+ } & {
1977
+ size?: string;
1978
+ }) | ({
1979
+ __TYPE__: "DocumentLink";
1980
+ } & {
1981
+ id: string;
1982
+ }) | ({
1983
+ __TYPE__: "ExternalLink";
1984
+ } & {
1985
+ url: string;
1986
+ } & {
1987
+ kind?: "web";
1988
+ target?: string | null | undefined;
1989
+ preview?: {
1990
+ title?: string;
1991
+ } | null | undefined;
1992
+ });
1689
1993
  } & {
1690
1994
  start: number;
1691
1995
  end: number;
@@ -1707,6 +2011,6 @@ export declare function traverseCompositeSliceContent({ path, sliceKey, sliceNam
1707
2011
  sliceKey: string;
1708
2012
  sliceName: string;
1709
2013
  content: CompositeSliceItemContent;
1710
- model?: VariationFields | CompositeSliceFields | undefined;
2014
+ model?: VariationFields | CompositeSlice | undefined;
1711
2015
  }): (transformWidget: TraverseWidgetContentFn, transformSlice: TraverseSliceContentFn) => SharedSliceItemContent | CompositeSliceItemContent | undefined;
1712
2016
  export declare function migrateCompositeSlice(model: VariationFields, content: CompositeSliceItemContent): SharedSliceItemContent;
@@ -84,10 +84,10 @@ function traverseCompositeSliceContent({ path, sliceKey, sliceName, model, conte
84
84
  return (transformWidget, transformSlice) => {
85
85
  const primary = Object.entries(content.widget.nonRepeat).reduce((acc, [fieldKey, fieldContent]) => {
86
86
  const fieldDef = (() => {
87
- var _a, _b, _c, _d;
87
+ var _a, _b, _c;
88
88
  return (model === null || model === void 0 ? void 0 : model.type) === "SharedSlice"
89
89
  ? (_b = (_a = model === null || model === void 0 ? void 0 : model.fields) === null || _a === void 0 ? void 0 : _a.primary) === null || _b === void 0 ? void 0 : _b[fieldKey]
90
- : (_d = (_c = model === null || model === void 0 ? void 0 : model.fields) === null || _c === void 0 ? void 0 : _c.repeat) === null || _d === void 0 ? void 0 : _d[fieldKey];
90
+ : (_c = model === null || model === void 0 ? void 0 : model["non-repeat"]) === null || _c === void 0 ? void 0 : _c[fieldKey];
91
91
  })();
92
92
  const transformedField = transformWidget({
93
93
  path: path.concat([
@@ -109,9 +109,7 @@ function traverseCompositeSliceContent({ path, sliceKey, sliceName, model, conte
109
109
  }, {});
110
110
  const items = (0, GroupContent_1.traverseGroupItemsContent)({
111
111
  path: path.concat([{ key: "repeat", type: "items" }]),
112
- model: (model === null || model === void 0 ? void 0 : model.type) === "SharedSlice"
113
- ? model === null || model === void 0 ? void 0 : model.fields.items
114
- : model === null || model === void 0 ? void 0 : model.fields.repeat,
112
+ model: (model === null || model === void 0 ? void 0 : model.type) === "SharedSlice" ? model === null || model === void 0 ? void 0 : model.fields.items : model === null || model === void 0 ? void 0 : model.repeat,
115
113
  content: content.widget.repeat,
116
114
  })(transformWidget);
117
115
  return transformSlice({
@@ -255,7 +255,45 @@ export declare const RepeatableWidgetsLegacy: (ctx: LegacyContentCtx) => t.Array
255
255
  text: string;
256
256
  } & {
257
257
  spans?: ({
258
- data?: unknown;
258
+ data?: ({
259
+ __TYPE__: "ImageLink";
260
+ } & {
261
+ id: string;
262
+ url: string;
263
+ height: string;
264
+ width: string;
265
+ size: string;
266
+ name: string;
267
+ kind: string;
268
+ } & {
269
+ date?: string | null | undefined;
270
+ }) | ({
271
+ id: string;
272
+ url: string;
273
+ name: string;
274
+ kind: string;
275
+ size: string;
276
+ } & {
277
+ date?: string | null | undefined;
278
+ } & {
279
+ __TYPE__: "FileLink";
280
+ } & {
281
+ size?: string;
282
+ }) | ({
283
+ __TYPE__: "DocumentLink";
284
+ } & {
285
+ id: string;
286
+ }) | ({
287
+ __TYPE__: "ExternalLink";
288
+ } & {
289
+ url: string;
290
+ } & {
291
+ kind?: "web";
292
+ target?: string | null | undefined;
293
+ preview?: {
294
+ title?: string;
295
+ } | null | undefined;
296
+ });
259
297
  } & {
260
298
  start: number;
261
299
  end: number;
@@ -555,13 +593,89 @@ export declare const RepeatableWidgets: t.ArrayC<t.ExactC<t.TypeC<{
555
593
  text: t.StringC;
556
594
  }>, t.PartialC<{
557
595
  spans: t.Type<({
558
- data?: unknown;
596
+ data?: ({
597
+ __TYPE__: "ImageLink";
598
+ } & {
599
+ id: string;
600
+ url: string;
601
+ height: string;
602
+ width: string;
603
+ size: string;
604
+ name: string;
605
+ kind: string;
606
+ } & {
607
+ date?: string | null | undefined;
608
+ }) | ({
609
+ id: string;
610
+ url: string;
611
+ name: string;
612
+ kind: string;
613
+ size: string;
614
+ } & {
615
+ date?: string | null | undefined;
616
+ } & {
617
+ __TYPE__: "FileLink";
618
+ } & {
619
+ size?: string;
620
+ }) | ({
621
+ __TYPE__: "DocumentLink";
622
+ } & {
623
+ id: string;
624
+ }) | ({
625
+ __TYPE__: "ExternalLink";
626
+ } & {
627
+ url: string;
628
+ } & {
629
+ kind?: "web";
630
+ target?: string | null | undefined;
631
+ preview?: {
632
+ title?: string;
633
+ } | null | undefined;
634
+ });
559
635
  } & {
560
636
  start: number;
561
637
  end: number;
562
638
  type: "image" | "label" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "embed" | "list-item" | "o-list-item" | "rtl";
563
639
  })[], ({
564
- data?: unknown;
640
+ data?: ({
641
+ __TYPE__: "ImageLink";
642
+ } & {
643
+ id: string;
644
+ url: string;
645
+ height: string;
646
+ width: string;
647
+ size: string;
648
+ name: string;
649
+ kind: string;
650
+ } & {
651
+ date?: string | null | undefined;
652
+ }) | ({
653
+ id: string;
654
+ url: string;
655
+ name: string;
656
+ kind: string;
657
+ size: string;
658
+ } & {
659
+ date?: string | null | undefined;
660
+ } & {
661
+ __TYPE__: "FileLink";
662
+ } & {
663
+ size?: string;
664
+ }) | ({
665
+ __TYPE__: "DocumentLink";
666
+ } & {
667
+ id: string;
668
+ }) | ({
669
+ __TYPE__: "ExternalLink";
670
+ } & {
671
+ url: string;
672
+ } & {
673
+ kind?: "web";
674
+ target?: string | null | undefined;
675
+ preview?: {
676
+ title?: string;
677
+ } | null | undefined;
678
+ });
565
679
  } & {
566
680
  start: number;
567
681
  end: number;