@prismicio/types-internal 2.5.0-alpha.2 → 2.5.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.
Files changed (41) hide show
  1. package/lib/content/Document.d.ts +957 -45
  2. package/lib/content/fields/GroupContent.d.ts +8 -8
  3. package/lib/content/fields/GroupContent.js +14 -32
  4. package/lib/content/fields/WidgetContent.d.ts +957 -45
  5. package/lib/content/fields/nestable/NestableContent.d.ts +155 -3
  6. package/lib/content/fields/nestable/RichTextContent/Blocks.d.ts +232 -4
  7. package/lib/content/fields/nestable/RichTextContent/Blocks.js +5 -2
  8. package/lib/content/fields/nestable/RichTextContent/index.d.ts +194 -4
  9. package/lib/content/fields/slices/Slice/CompositeSliceContent.d.ts +314 -10
  10. package/lib/content/fields/slices/Slice/CompositeSliceContent.js +0 -3
  11. package/lib/content/fields/slices/Slice/RepeatableContent.d.ts +80 -3
  12. package/lib/content/fields/slices/Slice/RepeatableContent.js +4 -1
  13. package/lib/content/fields/slices/Slice/SharedSliceContent.d.ts +314 -10
  14. package/lib/content/fields/slices/Slice/SharedSliceContent.js +0 -2
  15. package/lib/content/fields/slices/Slice/SimpleSliceContent.d.ts +155 -3
  16. package/lib/content/fields/slices/Slice/SimpleSliceContent.js +0 -1
  17. package/lib/content/fields/slices/Slice/SlicePrimaryContent.d.ts +155 -3
  18. package/lib/content/fields/slices/Slice/index.d.ts +586 -16
  19. package/lib/content/fields/slices/SliceItem.d.ts +586 -16
  20. package/lib/content/fields/slices/SlicesContent.d.ts +817 -57
  21. package/lib/customtypes/CustomType.d.ts +2042 -690
  22. package/lib/customtypes/Section.d.ts +2028 -676
  23. package/lib/customtypes/diff/SharedSlice.d.ts +678 -2
  24. package/lib/customtypes/diff/Variation.d.ts +678 -3
  25. package/lib/customtypes/widgets/Group.d.ts +996 -15
  26. package/lib/customtypes/widgets/Group.js +15 -27
  27. package/lib/customtypes/widgets/Widget.d.ts +1684 -7
  28. package/lib/customtypes/widgets/slices/LegacySlice.d.ts +168 -2
  29. package/lib/customtypes/widgets/slices/LegacySlice.js +1 -1
  30. package/lib/customtypes/widgets/slices/SharedSlice.d.ts +670 -2
  31. package/lib/customtypes/widgets/slices/SlicePrimaryWidget.d.ts +674 -3
  32. package/lib/customtypes/widgets/slices/Slices.d.ts +1522 -7
  33. package/package.json +1 -1
  34. package/src/content/fields/GroupContent.ts +24 -48
  35. package/src/content/fields/nestable/RichTextContent/Blocks.ts +6 -3
  36. package/src/content/fields/slices/Slice/CompositeSliceContent.ts +4 -7
  37. package/src/content/fields/slices/Slice/RepeatableContent.ts +9 -2
  38. package/src/content/fields/slices/Slice/SharedSliceContent.ts +3 -5
  39. package/src/content/fields/slices/Slice/SimpleSliceContent.ts +1 -3
  40. package/src/customtypes/widgets/Group.ts +34 -61
  41. package/src/customtypes/widgets/slices/LegacySlice.ts +2 -2
@@ -187,7 +187,45 @@ export declare const isCompositeSliceContent: (u: unknown) => u is {
187
187
  alt?: string | null;
188
188
  provider?: string | null | undefined;
189
189
  } & {
190
- linkTo?: any;
190
+ linkTo?: ({
191
+ __TYPE__: "ImageLink";
192
+ } & {
193
+ id: string;
194
+ url: string;
195
+ height: string;
196
+ width: string;
197
+ size: string;
198
+ name: string;
199
+ kind: string;
200
+ } & {
201
+ date?: string | null | undefined;
202
+ }) | ({
203
+ id: string;
204
+ url: string;
205
+ name: string;
206
+ kind: string;
207
+ size: string;
208
+ } & {
209
+ date?: string | null | undefined;
210
+ } & {
211
+ __TYPE__: "FileLink";
212
+ } & {
213
+ size?: string;
214
+ }) | ({
215
+ __TYPE__: "DocumentLink";
216
+ } & {
217
+ id: string;
218
+ }) | ({
219
+ __TYPE__: "ExternalLink";
220
+ } & {
221
+ url: string;
222
+ } & {
223
+ kind?: "web";
224
+ target?: string | null | undefined;
225
+ preview?: {
226
+ title?: string;
227
+ } | null | undefined;
228
+ }) | null | undefined;
191
229
  };
192
230
  } & {
193
231
  label?: string | null | undefined;
@@ -465,7 +503,45 @@ export declare const isCompositeSliceContent: (u: unknown) => u is {
465
503
  alt?: string | null;
466
504
  provider?: string | null | undefined;
467
505
  } & {
468
- linkTo?: any;
506
+ linkTo?: ({
507
+ __TYPE__: "ImageLink";
508
+ } & {
509
+ id: string;
510
+ url: string;
511
+ height: string;
512
+ width: string;
513
+ size: string;
514
+ name: string;
515
+ kind: string;
516
+ } & {
517
+ date?: string | null | undefined;
518
+ }) | ({
519
+ id: string;
520
+ url: string;
521
+ name: string;
522
+ kind: string;
523
+ size: string;
524
+ } & {
525
+ date?: string | null | undefined;
526
+ } & {
527
+ __TYPE__: "FileLink";
528
+ } & {
529
+ size?: string;
530
+ }) | ({
531
+ __TYPE__: "DocumentLink";
532
+ } & {
533
+ id: string;
534
+ }) | ({
535
+ __TYPE__: "ExternalLink";
536
+ } & {
537
+ url: string;
538
+ } & {
539
+ kind?: "web";
540
+ target?: string | null | undefined;
541
+ preview?: {
542
+ title?: string;
543
+ } | null | undefined;
544
+ }) | null | undefined;
469
545
  };
470
546
  } & {
471
547
  label?: string | null | undefined;
@@ -559,7 +635,7 @@ export declare const isCompositeSliceContent: (u: unknown) => u is {
559
635
  }))[];
560
636
  } | {
561
637
  __TYPE__: "SeparatorContent";
562
- }][];
638
+ } | import("../../GroupContent").GroupContent][];
563
639
  }[];
564
640
  };
565
641
  export declare const CompositeSliceLegacy: (ctx: LegacyContentCtx) => t.Type<{
@@ -745,7 +821,45 @@ export declare const CompositeSliceLegacy: (ctx: LegacyContentCtx) => t.Type<{
745
821
  alt?: string | null;
746
822
  provider?: string | null | undefined;
747
823
  } & {
748
- linkTo?: any;
824
+ linkTo?: ({
825
+ __TYPE__: "ImageLink";
826
+ } & {
827
+ id: string;
828
+ url: string;
829
+ height: string;
830
+ width: string;
831
+ size: string;
832
+ name: string;
833
+ kind: string;
834
+ } & {
835
+ date?: string | null | undefined;
836
+ }) | ({
837
+ id: string;
838
+ url: string;
839
+ name: string;
840
+ kind: string;
841
+ size: string;
842
+ } & {
843
+ date?: string | null | undefined;
844
+ } & {
845
+ __TYPE__: "FileLink";
846
+ } & {
847
+ size?: string;
848
+ }) | ({
849
+ __TYPE__: "DocumentLink";
850
+ } & {
851
+ id: string;
852
+ }) | ({
853
+ __TYPE__: "ExternalLink";
854
+ } & {
855
+ url: string;
856
+ } & {
857
+ kind?: "web";
858
+ target?: string | null | undefined;
859
+ preview?: {
860
+ title?: string;
861
+ } | null | undefined;
862
+ }) | null | undefined;
749
863
  };
750
864
  } & {
751
865
  label?: string | null | undefined;
@@ -1023,7 +1137,45 @@ export declare const CompositeSliceLegacy: (ctx: LegacyContentCtx) => t.Type<{
1023
1137
  alt?: string | null;
1024
1138
  provider?: string | null | undefined;
1025
1139
  } & {
1026
- linkTo?: any;
1140
+ linkTo?: ({
1141
+ __TYPE__: "ImageLink";
1142
+ } & {
1143
+ id: string;
1144
+ url: string;
1145
+ height: string;
1146
+ width: string;
1147
+ size: string;
1148
+ name: string;
1149
+ kind: string;
1150
+ } & {
1151
+ date?: string | null | undefined;
1152
+ }) | ({
1153
+ id: string;
1154
+ url: string;
1155
+ name: string;
1156
+ kind: string;
1157
+ size: string;
1158
+ } & {
1159
+ date?: string | null | undefined;
1160
+ } & {
1161
+ __TYPE__: "FileLink";
1162
+ } & {
1163
+ size?: string;
1164
+ }) | ({
1165
+ __TYPE__: "DocumentLink";
1166
+ } & {
1167
+ id: string;
1168
+ }) | ({
1169
+ __TYPE__: "ExternalLink";
1170
+ } & {
1171
+ url: string;
1172
+ } & {
1173
+ kind?: "web";
1174
+ target?: string | null | undefined;
1175
+ preview?: {
1176
+ title?: string;
1177
+ } | null | undefined;
1178
+ }) | null | undefined;
1027
1179
  };
1028
1180
  } & {
1029
1181
  label?: string | null | undefined;
@@ -1117,7 +1269,7 @@ export declare const CompositeSliceLegacy: (ctx: LegacyContentCtx) => t.Type<{
1117
1269
  }))[];
1118
1270
  } | {
1119
1271
  __TYPE__: "SeparatorContent";
1120
- }][];
1272
+ } | import("../../GroupContent").GroupContent][];
1121
1273
  }[];
1122
1274
  }, WithTypes<{
1123
1275
  repeat?: unknown[];
@@ -1307,7 +1459,83 @@ export declare const CompositeSliceContent: t.ExactC<t.TypeC<{
1307
1459
  alt: t.Type<string | null, string | null, unknown>;
1308
1460
  provider: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
1309
1461
  }>]>>, t.PartialC<{
1310
- linkTo: t.UnionC<[t.Type<any, any, unknown>, t.NullC, t.UndefinedC]>;
1462
+ linkTo: t.UnionC<[t.Type<({
1463
+ __TYPE__: "ImageLink";
1464
+ } & {
1465
+ id: string;
1466
+ url: string;
1467
+ height: string;
1468
+ width: string;
1469
+ size: string;
1470
+ name: string;
1471
+ kind: string;
1472
+ } & {
1473
+ date?: string | null | undefined;
1474
+ }) | ({
1475
+ id: string;
1476
+ url: string;
1477
+ name: string;
1478
+ kind: string;
1479
+ size: string;
1480
+ } & {
1481
+ date?: string | null | undefined;
1482
+ } & {
1483
+ __TYPE__: "FileLink";
1484
+ } & {
1485
+ size?: string;
1486
+ }) | ({
1487
+ __TYPE__: "DocumentLink";
1488
+ } & {
1489
+ id: string;
1490
+ }) | ({
1491
+ __TYPE__: "ExternalLink";
1492
+ } & {
1493
+ url: string;
1494
+ } & {
1495
+ kind?: "web";
1496
+ target?: string | null | undefined;
1497
+ preview?: {
1498
+ title?: string;
1499
+ } | null | undefined;
1500
+ }), ({
1501
+ __TYPE__: "ImageLink";
1502
+ } & {
1503
+ id: string;
1504
+ url: string;
1505
+ height: string;
1506
+ width: string;
1507
+ size: string;
1508
+ name: string;
1509
+ kind: string;
1510
+ } & {
1511
+ date?: string | null | undefined;
1512
+ }) | ({
1513
+ id: string;
1514
+ url: string;
1515
+ name: string;
1516
+ kind: string;
1517
+ size: string;
1518
+ } & {
1519
+ date?: string | null | undefined;
1520
+ } & {
1521
+ __TYPE__: "FileLink";
1522
+ } & {
1523
+ size?: string;
1524
+ }) | ({
1525
+ __TYPE__: "DocumentLink";
1526
+ } & {
1527
+ id: string;
1528
+ }) | ({
1529
+ __TYPE__: "ExternalLink";
1530
+ } & {
1531
+ url: string;
1532
+ } & {
1533
+ kind?: "web";
1534
+ target?: string | null | undefined;
1535
+ preview?: {
1536
+ title?: string;
1537
+ } | null | undefined;
1538
+ }), unknown>, t.NullC, t.UndefinedC]>;
1311
1539
  }>]>;
1312
1540
  }>, t.PartialC<{
1313
1541
  label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
@@ -1456,7 +1684,7 @@ export declare const CompositeSliceContent: t.ExactC<t.TypeC<{
1456
1684
  }>>]>>;
1457
1685
  repeat: t.ArrayC<t.ExactC<t.TypeC<{
1458
1686
  __TYPE__: t.LiteralC<"GroupItemContent">;
1459
- value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.ExactC<t.TypeC<{
1687
+ value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
1460
1688
  type: t.StringC;
1461
1689
  __TYPE__: t.LiteralC<"EmptyContent">;
1462
1690
  }>>, t.ExactC<t.TypeC<{
@@ -1636,7 +1864,83 @@ export declare const CompositeSliceContent: t.ExactC<t.TypeC<{
1636
1864
  alt: t.Type<string | null, string | null, unknown>;
1637
1865
  provider: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
1638
1866
  }>]>>, t.PartialC<{
1639
- linkTo: t.UnionC<[t.Type<any, any, unknown>, t.NullC, t.UndefinedC]>;
1867
+ linkTo: t.UnionC<[t.Type<({
1868
+ __TYPE__: "ImageLink";
1869
+ } & {
1870
+ id: string;
1871
+ url: string;
1872
+ height: string;
1873
+ width: string;
1874
+ size: string;
1875
+ name: string;
1876
+ kind: string;
1877
+ } & {
1878
+ date?: string | null | undefined;
1879
+ }) | ({
1880
+ id: string;
1881
+ url: string;
1882
+ name: string;
1883
+ kind: string;
1884
+ size: string;
1885
+ } & {
1886
+ date?: string | null | undefined;
1887
+ } & {
1888
+ __TYPE__: "FileLink";
1889
+ } & {
1890
+ size?: string;
1891
+ }) | ({
1892
+ __TYPE__: "DocumentLink";
1893
+ } & {
1894
+ id: string;
1895
+ }) | ({
1896
+ __TYPE__: "ExternalLink";
1897
+ } & {
1898
+ url: string;
1899
+ } & {
1900
+ kind?: "web";
1901
+ target?: string | null | undefined;
1902
+ preview?: {
1903
+ title?: string;
1904
+ } | null | undefined;
1905
+ }), ({
1906
+ __TYPE__: "ImageLink";
1907
+ } & {
1908
+ id: string;
1909
+ url: string;
1910
+ height: string;
1911
+ width: string;
1912
+ size: string;
1913
+ name: string;
1914
+ kind: string;
1915
+ } & {
1916
+ date?: string | null | undefined;
1917
+ }) | ({
1918
+ id: string;
1919
+ url: string;
1920
+ name: string;
1921
+ kind: string;
1922
+ size: string;
1923
+ } & {
1924
+ date?: string | null | undefined;
1925
+ } & {
1926
+ __TYPE__: "FileLink";
1927
+ } & {
1928
+ size?: string;
1929
+ }) | ({
1930
+ __TYPE__: "DocumentLink";
1931
+ } & {
1932
+ id: string;
1933
+ }) | ({
1934
+ __TYPE__: "ExternalLink";
1935
+ } & {
1936
+ url: string;
1937
+ } & {
1938
+ kind?: "web";
1939
+ target?: string | null | undefined;
1940
+ preview?: {
1941
+ title?: string;
1942
+ } | null | undefined;
1943
+ }), unknown>, t.NullC, t.UndefinedC]>;
1640
1944
  }>]>;
1641
1945
  }>, t.PartialC<{
1642
1946
  label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
@@ -1782,7 +2086,7 @@ export declare const CompositeSliceContent: t.ExactC<t.TypeC<{
1782
2086
  }>]>>]>>;
1783
2087
  }>>, t.ExactC<t.TypeC<{
1784
2088
  __TYPE__: t.LiteralC<"SeparatorContent">;
1785
- }>>]>]>>;
2089
+ }>>]>, t.Type<import("../../GroupContent").GroupContent, import("../../GroupContent").GroupContent, unknown>]>]>>;
1786
2090
  }>>>;
1787
2091
  }>>;
1788
2092
  export declare type CompositeSliceContent = t.TypeOf<typeof CompositeSliceContent>;
@@ -28,7 +28,6 @@ const CompositeSliceLegacy = (ctx) => {
28
28
  if (!result || (0, Either_1.isLeft)(result))
29
29
  return;
30
30
  return result.right;
31
- // We don't support nested groups on composite slice items
32
31
  })() || [];
33
32
  const nonRepeat = Object.entries(parsedSlice["non-repeat"] || {}).reduce((acc, [key, value]) => {
34
33
  const fieldCtx = (0, LegacyContentCtx_1.getFieldCtx)(key, ctx, ["non-repeat"]);
@@ -128,7 +127,6 @@ function traverseCompositeSliceContent({ path, sliceKey, sliceName, model, conte
128
127
  path: path.concat([{ key: "repeat", type: "items" }]),
129
128
  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,
130
129
  content: content.widget.repeat,
131
- // We don't support nested groups on composite slice items
132
130
  })(transformWidget);
133
131
  return transformSlice({
134
132
  key: sliceKey,
@@ -176,7 +174,6 @@ function migrateCompositeSlice(model, content) {
176
174
  return acc.concat([[fieldKey, fieldContent]]);
177
175
  }, []),
178
176
  };
179
- // We don't support nested groups on composite slice items
180
177
  }, []),
181
178
  },
182
179
  };
@@ -1,11 +1,12 @@
1
1
  import * as t from "io-ts";
2
2
  import type { LegacyContentCtx } from "../../../LegacyContentCtx";
3
+ import { GroupContent } from "../../GroupContent";
3
4
  export declare const RepeatableWidgetsLegacy: (ctx: LegacyContentCtx) => t.ArrayC<t.Type<import("../../GroupContent").GroupItemContent, import("../../../LegacyContentCtx").WithTypes<{
4
5
  [x: string]: unknown;
5
6
  }>, unknown>>;
6
7
  export declare const RepeatableWidgets: t.ArrayC<t.ExactC<t.TypeC<{
7
8
  __TYPE__: t.LiteralC<"GroupItemContent">;
8
- value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.ExactC<t.TypeC<{
9
+ value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
9
10
  type: t.StringC;
10
11
  __TYPE__: t.LiteralC<"EmptyContent">;
11
12
  }>>, t.ExactC<t.TypeC<{
@@ -185,7 +186,83 @@ export declare const RepeatableWidgets: t.ArrayC<t.ExactC<t.TypeC<{
185
186
  alt: t.Type<string | null, string | null, unknown>;
186
187
  provider: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
187
188
  }>]>>, t.PartialC<{
188
- linkTo: t.UnionC<[t.Type<any, any, unknown>, t.NullC, t.UndefinedC]>;
189
+ linkTo: t.UnionC<[t.Type<({
190
+ __TYPE__: "ImageLink";
191
+ } & {
192
+ id: string;
193
+ url: string;
194
+ height: string;
195
+ width: string;
196
+ size: string;
197
+ name: string;
198
+ kind: string;
199
+ } & {
200
+ date?: string | null | undefined;
201
+ }) | ({
202
+ id: string;
203
+ url: string;
204
+ name: string;
205
+ kind: string;
206
+ size: string;
207
+ } & {
208
+ date?: string | null | undefined;
209
+ } & {
210
+ __TYPE__: "FileLink";
211
+ } & {
212
+ size?: string;
213
+ }) | ({
214
+ __TYPE__: "DocumentLink";
215
+ } & {
216
+ id: string;
217
+ }) | ({
218
+ __TYPE__: "ExternalLink";
219
+ } & {
220
+ url: string;
221
+ } & {
222
+ kind?: "web";
223
+ target?: string | null | undefined;
224
+ preview?: {
225
+ title?: string;
226
+ } | null | undefined;
227
+ }), ({
228
+ __TYPE__: "ImageLink";
229
+ } & {
230
+ id: string;
231
+ url: string;
232
+ height: string;
233
+ width: string;
234
+ size: string;
235
+ name: string;
236
+ kind: string;
237
+ } & {
238
+ date?: string | null | undefined;
239
+ }) | ({
240
+ id: string;
241
+ url: string;
242
+ name: string;
243
+ kind: string;
244
+ size: string;
245
+ } & {
246
+ date?: string | null | undefined;
247
+ } & {
248
+ __TYPE__: "FileLink";
249
+ } & {
250
+ size?: string;
251
+ }) | ({
252
+ __TYPE__: "DocumentLink";
253
+ } & {
254
+ id: string;
255
+ }) | ({
256
+ __TYPE__: "ExternalLink";
257
+ } & {
258
+ url: string;
259
+ } & {
260
+ kind?: "web";
261
+ target?: string | null | undefined;
262
+ preview?: {
263
+ title?: string;
264
+ } | null | undefined;
265
+ }), unknown>, t.NullC, t.UndefinedC]>;
189
266
  }>]>;
190
267
  }>, t.PartialC<{
191
268
  label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
@@ -331,5 +408,5 @@ export declare const RepeatableWidgets: t.ArrayC<t.ExactC<t.TypeC<{
331
408
  }>]>>]>>;
332
409
  }>>, t.ExactC<t.TypeC<{
333
410
  __TYPE__: t.LiteralC<"SeparatorContent">;
334
- }>>]>]>>;
411
+ }>>]>, t.Type<GroupContent, GroupContent, unknown>]>]>>;
335
412
  }>>>;
@@ -9,7 +9,10 @@ const RepeatableWidgetsLegacy = (ctx) => {
9
9
  return t.array((0, GroupContent_1.GroupItemLegacy)(ctx));
10
10
  };
11
11
  exports.RepeatableWidgetsLegacy = RepeatableWidgetsLegacy;
12
- const RepeatableWidget = t.tuple([t.string, nestable_1.NestableContent]);
12
+ const RepeatableWidget = t.tuple([
13
+ t.string,
14
+ t.union([nestable_1.NestableContent, GroupContent_1.GroupContent]),
15
+ ]);
13
16
  const RepeatableWidgetsBlock = t.strict({
14
17
  __TYPE__: t.literal(GroupContent_1.GroupItemContentType),
15
18
  value: t.array(RepeatableWidget),