@prismicio/types-internal 3.3.0-alpha.0 → 3.3.0-alpha.2

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.
@@ -158,7 +158,6 @@ function traverseDocument({ document, customType, }) {
158
158
  { key, type: "Widget" },
159
159
  ]);
160
160
  const transformedWidget = (() => {
161
- var _a;
162
161
  switch (content.__TYPE__) {
163
162
  case "SliceContentType":
164
163
  return (0, fields_1.traverseSlices)({
@@ -182,9 +181,7 @@ function traverseDocument({ document, customType, }) {
182
181
  path,
183
182
  key,
184
183
  apiId: key,
185
- model: (fieldModel === null || fieldModel === void 0 ? void 0 : fieldModel.type) === "Link" && ((_a = fieldModel.config) === null || _a === void 0 ? void 0 : _a.repeat)
186
- ? fieldModel
187
- : undefined,
184
+ model: (fieldModel === null || fieldModel === void 0 ? void 0 : fieldModel.type) === "Link" ? fieldModel : undefined,
188
185
  content,
189
186
  })(transformWidget);
190
187
  default:
@@ -129,7 +129,6 @@ function traverseGroupItemsContent({ path, model, content, }) {
129
129
  { key: index.toString(), type: "GroupItem" },
130
130
  ]);
131
131
  const groupItemFields = groupItem.value.reduce((acc, [fieldKey, fieldContent]) => {
132
- var _a;
133
132
  const fieldDef = model === null || model === void 0 ? void 0 : model[fieldKey];
134
133
  let transformedField;
135
134
  if ((!fieldDef || (fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.type) === customtypes_1.GroupFieldType) &&
@@ -142,8 +141,7 @@ function traverseGroupItemsContent({ path, model, content, }) {
142
141
  content: fieldContent,
143
142
  })(transform);
144
143
  }
145
- else if ((!fieldDef ||
146
- ((fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.type) === "Link" && ((_a = fieldDef.config) === null || _a === void 0 ? void 0 : _a.repeat))) &&
144
+ else if ((!fieldDef || (fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.type) === "Link") &&
147
145
  fieldContent.__TYPE__ === "RepeatableContent") {
148
146
  transformedField = (0, nestable_1.traverseRepeatableContent)({
149
147
  path: groupItemPath.concat([{ key: fieldKey, type: "Widget" }]),
@@ -62,11 +62,18 @@ function traverseRepeatableContent({ path, key, apiId, model, content, }) {
62
62
  const itemPath = path.concat([
63
63
  { key: index.toString(), type: "Widget" },
64
64
  ]);
65
+ // Content inside repeatable can't be repeatable.
66
+ const newModel = (model === null || model === void 0 ? void 0 : model.type) === "Link" && model.config
67
+ ? {
68
+ ...model,
69
+ config: { ...model.config, repeat: false },
70
+ }
71
+ : model;
65
72
  const transformedField = transform({
66
73
  path: itemPath,
67
74
  key: key,
68
75
  apiId: apiId,
69
- model: model,
76
+ model: newModel,
70
77
  content: fieldContent,
71
78
  });
72
79
  // Can happen if the transform function returns undefined to filter out a field
@@ -120,7 +120,6 @@ function traverseSharedSliceContent({ path, sliceKey, sliceName, model, content,
120
120
  var _a, _b;
121
121
  const fieldDef = (_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];
122
122
  const transformedField = (() => {
123
- var _a;
124
123
  if ((0, GroupContent_1.isGroupContent)(fieldContent)) {
125
124
  return (0, GroupContent_1.traverseGroupContent)({
126
125
  path: path.concat([
@@ -142,9 +141,7 @@ function traverseSharedSliceContent({ path, sliceKey, sliceName, model, content,
142
141
  key: fieldKey,
143
142
  apiId: fieldKey,
144
143
  content: fieldContent,
145
- model: (fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.type) === "Link" && ((_a = fieldDef.config) === null || _a === void 0 ? void 0 : _a.repeat)
146
- ? fieldDef
147
- : undefined,
144
+ model: (fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.type) === "Link" ? fieldDef : undefined,
148
145
  })(transformWidget);
149
146
  }
150
147
  else if ((0, nestable_1.isNestableContent)(fieldContent)) {
@@ -102,10 +102,7 @@ export declare const StaticCustomType: t.ExactC<t.IntersectionC<[t.TypeC<{
102
102
  allowTargetBlank?: boolean;
103
103
  allowText?: boolean;
104
104
  repeat?: boolean;
105
- variant?: {
106
- options: string[];
107
- default_value: string;
108
- };
105
+ variants?: string[];
109
106
  };
110
107
  }) | ({
111
108
  type: "Number";
@@ -274,10 +271,7 @@ export declare const StaticCustomType: t.ExactC<t.IntersectionC<[t.TypeC<{
274
271
  allowTargetBlank?: boolean;
275
272
  allowText?: boolean;
276
273
  repeat?: boolean;
277
- variant?: {
278
- options: string[];
279
- default_value: string;
280
- };
274
+ variants?: string[];
281
275
  };
282
276
  }) | ({
283
277
  type: "Number";
@@ -446,10 +440,7 @@ export declare const StaticCustomType: t.ExactC<t.IntersectionC<[t.TypeC<{
446
440
  allowTargetBlank?: boolean;
447
441
  allowText?: boolean;
448
442
  repeat?: boolean;
449
- variant?: {
450
- options: string[];
451
- default_value: string;
452
- };
443
+ variants?: string[];
453
444
  };
454
445
  }) | ({
455
446
  type: "Number";
@@ -628,10 +619,7 @@ export declare const StaticCustomType: t.ExactC<t.IntersectionC<[t.TypeC<{
628
619
  allowTargetBlank?: boolean;
629
620
  allowText?: boolean;
630
621
  repeat?: boolean;
631
- variant?: {
632
- options: string[];
633
- default_value: string;
634
- };
622
+ variants?: string[];
635
623
  };
636
624
  }) | ({
637
625
  type: "Number";
@@ -800,10 +788,7 @@ export declare const StaticCustomType: t.ExactC<t.IntersectionC<[t.TypeC<{
800
788
  allowTargetBlank?: boolean;
801
789
  allowText?: boolean;
802
790
  repeat?: boolean;
803
- variant?: {
804
- options: string[];
805
- default_value: string;
806
- };
791
+ variants?: string[];
807
792
  };
808
793
  }) | ({
809
794
  type: "Number";
@@ -973,10 +958,7 @@ export declare const StaticCustomType: t.ExactC<t.IntersectionC<[t.TypeC<{
973
958
  allowTargetBlank?: boolean;
974
959
  allowText?: boolean;
975
960
  repeat?: boolean;
976
- variant?: {
977
- options: string[];
978
- default_value: string;
979
- };
961
+ variants?: string[];
980
962
  };
981
963
  }) | ({
982
964
  type: "Number";
@@ -1138,10 +1120,7 @@ export declare const StaticCustomType: t.ExactC<t.IntersectionC<[t.TypeC<{
1138
1120
  allowTargetBlank?: boolean;
1139
1121
  allowText?: boolean;
1140
1122
  repeat?: boolean;
1141
- variant?: {
1142
- options: string[];
1143
- default_value: string;
1144
- };
1123
+ variants?: string[];
1145
1124
  };
1146
1125
  }) | ({
1147
1126
  type: "Number";
@@ -1319,10 +1298,7 @@ export declare const StaticCustomType: t.ExactC<t.IntersectionC<[t.TypeC<{
1319
1298
  allowTargetBlank?: boolean;
1320
1299
  allowText?: boolean;
1321
1300
  repeat?: boolean;
1322
- variant?: {
1323
- options: string[];
1324
- default_value: string;
1325
- };
1301
+ variants?: string[];
1326
1302
  };
1327
1303
  }) | ({
1328
1304
  type: "Number";
@@ -1491,10 +1467,7 @@ export declare const StaticCustomType: t.ExactC<t.IntersectionC<[t.TypeC<{
1491
1467
  allowTargetBlank?: boolean;
1492
1468
  allowText?: boolean;
1493
1469
  repeat?: boolean;
1494
- variant?: {
1495
- options: string[];
1496
- default_value: string;
1497
- };
1470
+ variants?: string[];
1498
1471
  };
1499
1472
  }) | ({
1500
1473
  type: "Number";
@@ -1663,10 +1636,7 @@ export declare const StaticCustomType: t.ExactC<t.IntersectionC<[t.TypeC<{
1663
1636
  allowTargetBlank?: boolean;
1664
1637
  allowText?: boolean;
1665
1638
  repeat?: boolean;
1666
- variant?: {
1667
- options: string[];
1668
- default_value: string;
1669
- };
1639
+ variants?: string[];
1670
1640
  };
1671
1641
  }) | ({
1672
1642
  type: "Number";
@@ -1834,10 +1804,7 @@ export declare const StaticCustomType: t.ExactC<t.IntersectionC<[t.TypeC<{
1834
1804
  allowTargetBlank?: boolean;
1835
1805
  allowText?: boolean;
1836
1806
  repeat?: boolean;
1837
- variant?: {
1838
- options: string[];
1839
- default_value: string;
1840
- };
1807
+ variants?: string[];
1841
1808
  };
1842
1809
  }) | ({
1843
1810
  type: "Number";
@@ -2031,10 +1998,7 @@ export declare const CustomType: t.ExactC<t.IntersectionC<[t.TypeC<{
2031
1998
  allowTargetBlank?: boolean;
2032
1999
  allowText?: boolean;
2033
2000
  repeat?: boolean;
2034
- variant?: {
2035
- options: string[];
2036
- default_value: string;
2037
- };
2001
+ variants?: string[];
2038
2002
  };
2039
2003
  }) | ({
2040
2004
  type: "Number";
@@ -2203,10 +2167,7 @@ export declare const CustomType: t.ExactC<t.IntersectionC<[t.TypeC<{
2203
2167
  allowTargetBlank?: boolean;
2204
2168
  allowText?: boolean;
2205
2169
  repeat?: boolean;
2206
- variant?: {
2207
- options: string[];
2208
- default_value: string;
2209
- };
2170
+ variants?: string[];
2210
2171
  };
2211
2172
  }) | ({
2212
2173
  type: "Number";
@@ -2375,10 +2336,7 @@ export declare const CustomType: t.ExactC<t.IntersectionC<[t.TypeC<{
2375
2336
  allowTargetBlank?: boolean;
2376
2337
  allowText?: boolean;
2377
2338
  repeat?: boolean;
2378
- variant?: {
2379
- options: string[];
2380
- default_value: string;
2381
- };
2339
+ variants?: string[];
2382
2340
  };
2383
2341
  }) | ({
2384
2342
  type: "Number";
@@ -2557,10 +2515,7 @@ export declare const CustomType: t.ExactC<t.IntersectionC<[t.TypeC<{
2557
2515
  allowTargetBlank?: boolean;
2558
2516
  allowText?: boolean;
2559
2517
  repeat?: boolean;
2560
- variant?: {
2561
- options: string[];
2562
- default_value: string;
2563
- };
2518
+ variants?: string[];
2564
2519
  };
2565
2520
  }) | ({
2566
2521
  type: "Number";
@@ -2729,10 +2684,7 @@ export declare const CustomType: t.ExactC<t.IntersectionC<[t.TypeC<{
2729
2684
  allowTargetBlank?: boolean;
2730
2685
  allowText?: boolean;
2731
2686
  repeat?: boolean;
2732
- variant?: {
2733
- options: string[];
2734
- default_value: string;
2735
- };
2687
+ variants?: string[];
2736
2688
  };
2737
2689
  }) | ({
2738
2690
  type: "Number";
@@ -2902,10 +2854,7 @@ export declare const CustomType: t.ExactC<t.IntersectionC<[t.TypeC<{
2902
2854
  allowTargetBlank?: boolean;
2903
2855
  allowText?: boolean;
2904
2856
  repeat?: boolean;
2905
- variant?: {
2906
- options: string[];
2907
- default_value: string;
2908
- };
2857
+ variants?: string[];
2909
2858
  };
2910
2859
  }) | ({
2911
2860
  type: "Number";
@@ -3067,10 +3016,7 @@ export declare const CustomType: t.ExactC<t.IntersectionC<[t.TypeC<{
3067
3016
  allowTargetBlank?: boolean;
3068
3017
  allowText?: boolean;
3069
3018
  repeat?: boolean;
3070
- variant?: {
3071
- options: string[];
3072
- default_value: string;
3073
- };
3019
+ variants?: string[];
3074
3020
  };
3075
3021
  }) | ({
3076
3022
  type: "Number";
@@ -86,10 +86,7 @@ export declare const StaticSection: t.RecordC<t.Type<string, string, unknown>, t
86
86
  allowTargetBlank?: boolean;
87
87
  allowText?: boolean;
88
88
  repeat?: boolean;
89
- variant?: {
90
- options: string[];
91
- default_value: string;
92
- };
89
+ variants?: string[];
93
90
  };
94
91
  }) | ({
95
92
  type: "Number";
@@ -258,10 +255,7 @@ export declare const StaticSection: t.RecordC<t.Type<string, string, unknown>, t
258
255
  allowTargetBlank?: boolean;
259
256
  allowText?: boolean;
260
257
  repeat?: boolean;
261
- variant?: {
262
- options: string[];
263
- default_value: string;
264
- };
258
+ variants?: string[];
265
259
  };
266
260
  }) | ({
267
261
  type: "Number";
@@ -430,10 +424,7 @@ export declare const StaticSection: t.RecordC<t.Type<string, string, unknown>, t
430
424
  allowTargetBlank?: boolean;
431
425
  allowText?: boolean;
432
426
  repeat?: boolean;
433
- variant?: {
434
- options: string[];
435
- default_value: string;
436
- };
427
+ variants?: string[];
437
428
  };
438
429
  }) | ({
439
430
  type: "Number";
@@ -612,10 +603,7 @@ export declare const StaticSection: t.RecordC<t.Type<string, string, unknown>, t
612
603
  allowTargetBlank?: boolean;
613
604
  allowText?: boolean;
614
605
  repeat?: boolean;
615
- variant?: {
616
- options: string[];
617
- default_value: string;
618
- };
606
+ variants?: string[];
619
607
  };
620
608
  }) | ({
621
609
  type: "Number";
@@ -784,10 +772,7 @@ export declare const StaticSection: t.RecordC<t.Type<string, string, unknown>, t
784
772
  allowTargetBlank?: boolean;
785
773
  allowText?: boolean;
786
774
  repeat?: boolean;
787
- variant?: {
788
- options: string[];
789
- default_value: string;
790
- };
775
+ variants?: string[];
791
776
  };
792
777
  }) | ({
793
778
  type: "Number";
@@ -957,10 +942,7 @@ export declare const StaticSection: t.RecordC<t.Type<string, string, unknown>, t
957
942
  allowTargetBlank?: boolean;
958
943
  allowText?: boolean;
959
944
  repeat?: boolean;
960
- variant?: {
961
- options: string[];
962
- default_value: string;
963
- };
945
+ variants?: string[];
964
946
  };
965
947
  }) | ({
966
948
  type: "Number";
@@ -1122,10 +1104,7 @@ export declare const StaticSection: t.RecordC<t.Type<string, string, unknown>, t
1122
1104
  allowTargetBlank?: boolean;
1123
1105
  allowText?: boolean;
1124
1106
  repeat?: boolean;
1125
- variant?: {
1126
- options: string[];
1127
- default_value: string;
1128
- };
1107
+ variants?: string[];
1129
1108
  };
1130
1109
  }) | ({
1131
1110
  type: "Number";
@@ -1303,10 +1282,7 @@ export declare const StaticSection: t.RecordC<t.Type<string, string, unknown>, t
1303
1282
  allowTargetBlank?: boolean;
1304
1283
  allowText?: boolean;
1305
1284
  repeat?: boolean;
1306
- variant?: {
1307
- options: string[];
1308
- default_value: string;
1309
- };
1285
+ variants?: string[];
1310
1286
  };
1311
1287
  }) | ({
1312
1288
  type: "Number";
@@ -1475,10 +1451,7 @@ export declare const StaticSection: t.RecordC<t.Type<string, string, unknown>, t
1475
1451
  allowTargetBlank?: boolean;
1476
1452
  allowText?: boolean;
1477
1453
  repeat?: boolean;
1478
- variant?: {
1479
- options: string[];
1480
- default_value: string;
1481
- };
1454
+ variants?: string[];
1482
1455
  };
1483
1456
  }) | ({
1484
1457
  type: "Number";
@@ -1647,10 +1620,7 @@ export declare const StaticSection: t.RecordC<t.Type<string, string, unknown>, t
1647
1620
  allowTargetBlank?: boolean;
1648
1621
  allowText?: boolean;
1649
1622
  repeat?: boolean;
1650
- variant?: {
1651
- options: string[];
1652
- default_value: string;
1653
- };
1623
+ variants?: string[];
1654
1624
  };
1655
1625
  }) | ({
1656
1626
  type: "Number";
@@ -1818,10 +1788,7 @@ export declare const StaticSection: t.RecordC<t.Type<string, string, unknown>, t
1818
1788
  allowTargetBlank?: boolean;
1819
1789
  allowText?: boolean;
1820
1790
  repeat?: boolean;
1821
- variant?: {
1822
- options: string[];
1823
- default_value: string;
1824
- };
1791
+ variants?: string[];
1825
1792
  };
1826
1793
  }) | ({
1827
1794
  type: "Number";
@@ -2002,10 +1969,7 @@ export declare const DynamicSection: t.RecordC<t.Type<string, string, unknown>,
2002
1969
  allowTargetBlank?: boolean;
2003
1970
  allowText?: boolean;
2004
1971
  repeat?: boolean;
2005
- variant?: {
2006
- options: string[];
2007
- default_value: string;
2008
- };
1972
+ variants?: string[];
2009
1973
  };
2010
1974
  }) | ({
2011
1975
  type: "Number";
@@ -2174,10 +2138,7 @@ export declare const DynamicSection: t.RecordC<t.Type<string, string, unknown>,
2174
2138
  allowTargetBlank?: boolean;
2175
2139
  allowText?: boolean;
2176
2140
  repeat?: boolean;
2177
- variant?: {
2178
- options: string[];
2179
- default_value: string;
2180
- };
2141
+ variants?: string[];
2181
2142
  };
2182
2143
  }) | ({
2183
2144
  type: "Number";
@@ -2346,10 +2307,7 @@ export declare const DynamicSection: t.RecordC<t.Type<string, string, unknown>,
2346
2307
  allowTargetBlank?: boolean;
2347
2308
  allowText?: boolean;
2348
2309
  repeat?: boolean;
2349
- variant?: {
2350
- options: string[];
2351
- default_value: string;
2352
- };
2310
+ variants?: string[];
2353
2311
  };
2354
2312
  }) | ({
2355
2313
  type: "Number";
@@ -2528,10 +2486,7 @@ export declare const DynamicSection: t.RecordC<t.Type<string, string, unknown>,
2528
2486
  allowTargetBlank?: boolean;
2529
2487
  allowText?: boolean;
2530
2488
  repeat?: boolean;
2531
- variant?: {
2532
- options: string[];
2533
- default_value: string;
2534
- };
2489
+ variants?: string[];
2535
2490
  };
2536
2491
  }) | ({
2537
2492
  type: "Number";
@@ -2700,10 +2655,7 @@ export declare const DynamicSection: t.RecordC<t.Type<string, string, unknown>,
2700
2655
  allowTargetBlank?: boolean;
2701
2656
  allowText?: boolean;
2702
2657
  repeat?: boolean;
2703
- variant?: {
2704
- options: string[];
2705
- default_value: string;
2706
- };
2658
+ variants?: string[];
2707
2659
  };
2708
2660
  }) | ({
2709
2661
  type: "Number";
@@ -2873,10 +2825,7 @@ export declare const DynamicSection: t.RecordC<t.Type<string, string, unknown>,
2873
2825
  allowTargetBlank?: boolean;
2874
2826
  allowText?: boolean;
2875
2827
  repeat?: boolean;
2876
- variant?: {
2877
- options: string[];
2878
- default_value: string;
2879
- };
2828
+ variants?: string[];
2880
2829
  };
2881
2830
  }) | ({
2882
2831
  type: "Number";
@@ -3038,10 +2987,7 @@ export declare const DynamicSection: t.RecordC<t.Type<string, string, unknown>,
3038
2987
  allowTargetBlank?: boolean;
3039
2988
  allowText?: boolean;
3040
2989
  repeat?: boolean;
3041
- variant?: {
3042
- options: string[];
3043
- default_value: string;
3044
- };
2990
+ variants?: string[];
3045
2991
  };
3046
2992
  }) | ({
3047
2993
  type: "Number";
@@ -104,10 +104,7 @@ export declare const SliceComparator: {
104
104
  allowTargetBlank?: boolean;
105
105
  allowText?: boolean;
106
106
  repeat?: boolean;
107
- variant?: {
108
- options: string[];
109
- default_value: string;
110
- };
107
+ variants?: string[];
111
108
  };
112
109
  }) | ({
113
110
  type: "Number";
@@ -276,10 +273,7 @@ export declare const SliceComparator: {
276
273
  allowTargetBlank?: boolean;
277
274
  allowText?: boolean;
278
275
  repeat?: boolean;
279
- variant?: {
280
- options: string[];
281
- default_value: string;
282
- };
276
+ variants?: string[];
283
277
  };
284
278
  }) | ({
285
279
  type: "Number";
@@ -448,10 +442,7 @@ export declare const SliceComparator: {
448
442
  allowTargetBlank?: boolean;
449
443
  allowText?: boolean;
450
444
  repeat?: boolean;
451
- variant?: {
452
- options: string[];
453
- default_value: string;
454
- };
445
+ variants?: string[];
455
446
  };
456
447
  }) | ({
457
448
  type: "Number";
@@ -619,10 +610,7 @@ export declare const SliceComparator: {
619
610
  allowTargetBlank?: boolean;
620
611
  allowText?: boolean;
621
612
  repeat?: boolean;
622
- variant?: {
623
- options: string[];
624
- default_value: string;
625
- };
613
+ variants?: string[];
626
614
  };
627
615
  }) | ({
628
616
  type: "Number";
@@ -803,10 +791,7 @@ export declare const SliceComparator: {
803
791
  allowTargetBlank?: boolean;
804
792
  allowText?: boolean;
805
793
  repeat?: boolean;
806
- variant?: {
807
- options: string[];
808
- default_value: string;
809
- };
794
+ variants?: string[];
810
795
  };
811
796
  }) | ({
812
797
  type: "Number";
@@ -975,10 +960,7 @@ export declare const SliceComparator: {
975
960
  allowTargetBlank?: boolean;
976
961
  allowText?: boolean;
977
962
  repeat?: boolean;
978
- variant?: {
979
- options: string[];
980
- default_value: string;
981
- };
963
+ variants?: string[];
982
964
  };
983
965
  }) | ({
984
966
  type: "Number";
@@ -1147,10 +1129,7 @@ export declare const SliceComparator: {
1147
1129
  allowTargetBlank?: boolean;
1148
1130
  allowText?: boolean;
1149
1131
  repeat?: boolean;
1150
- variant?: {
1151
- options: string[];
1152
- default_value: string;
1153
- };
1132
+ variants?: string[];
1154
1133
  };
1155
1134
  }) | ({
1156
1135
  type: "Number";
@@ -1318,10 +1297,7 @@ export declare const SliceComparator: {
1318
1297
  allowTargetBlank?: boolean;
1319
1298
  allowText?: boolean;
1320
1299
  repeat?: boolean;
1321
- variant?: {
1322
- options: string[];
1323
- default_value: string;
1324
- };
1300
+ variants?: string[];
1325
1301
  };
1326
1302
  }) | ({
1327
1303
  type: "Number";