@prismicio/types-internal 3.13.0-alpha.0 → 3.14.0

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.
@@ -1542,9 +1542,8 @@ export declare const Document: t.RecordC<t.Type<string, string, unknown>, t.Unio
1542
1542
  }>]>>]>]>;
1543
1543
  }>>]>>;
1544
1544
  }>>]>>;
1545
- repeat: t.ArrayC<t.ExactC<t.TypeC<{
1545
+ repeat: t.ArrayC<t.ExactC<t.IntersectionC<[t.TypeC<{
1546
1546
  __TYPE__: t.LiteralC<"GroupItemContent">;
1547
- key: t.StringC;
1548
1547
  value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
1549
1548
  type: t.StringC;
1550
1549
  __TYPE__: t.LiteralC<"EmptyContent">;
@@ -2309,7 +2308,9 @@ export declare const Document: t.RecordC<t.Type<string, string, unknown>, t.Unio
2309
2308
  }>]>>]>]>;
2310
2309
  }>>]>>;
2311
2310
  }>>]>, t.Type<import("./fields").GroupContent, import("./fields").GroupContent, unknown>]>]>>;
2312
- }>>>;
2311
+ }>, t.PartialC<{
2312
+ key: t.StringC;
2313
+ }>]>>>;
2313
2314
  }>>, t.ExactC<t.TypeC<{
2314
2315
  __TYPE__: t.LiteralC<"SharedSliceContent">;
2315
2316
  variation: t.StringC;
@@ -3077,9 +3078,8 @@ export declare const Document: t.RecordC<t.Type<string, string, unknown>, t.Unio
3077
3078
  }>]>>]>]>;
3078
3079
  }>>]>>;
3079
3080
  }>>]>, t.Type<import("./fields").GroupContent, import("./fields").GroupContent, unknown>]>>;
3080
- items: t.ArrayC<t.ExactC<t.TypeC<{
3081
+ items: t.ArrayC<t.ExactC<t.IntersectionC<[t.TypeC<{
3081
3082
  __TYPE__: t.LiteralC<"GroupItemContent">;
3082
- key: t.StringC;
3083
3083
  value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
3084
3084
  type: t.StringC;
3085
3085
  __TYPE__: t.LiteralC<"EmptyContent">;
@@ -3844,7 +3844,9 @@ export declare const Document: t.RecordC<t.Type<string, string, unknown>, t.Unio
3844
3844
  }>]>>]>]>;
3845
3845
  }>>]>>;
3846
3846
  }>>]>, t.Type<import("./fields").GroupContent, import("./fields").GroupContent, unknown>]>]>>;
3847
- }>>>;
3847
+ }>, t.PartialC<{
3848
+ key: t.StringC;
3849
+ }>]>>>;
3848
3850
  }>>, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
3849
3851
  type: t.StringC;
3850
3852
  __TYPE__: t.LiteralC<"EmptyContent">;
@@ -6411,9 +6413,8 @@ export declare const DocumentLegacy: {
6411
6413
  })[];
6412
6414
  };
6413
6415
  };
6414
- repeat: {
6416
+ repeat: ({
6415
6417
  __TYPE__: "GroupItemContent";
6416
- key: string;
6417
6418
  value: [string, {
6418
6419
  type: string;
6419
6420
  __TYPE__: "EmptyContent";
@@ -7004,7 +7005,9 @@ export declare const DocumentLegacy: {
7004
7005
  })[];
7005
7006
  })[];
7006
7007
  }][];
7007
- }[];
7008
+ } & {
7009
+ key?: string;
7010
+ })[];
7008
7011
  } | {
7009
7012
  __TYPE__: "SharedSliceContent";
7010
7013
  variation: string;
@@ -7600,9 +7603,8 @@ export declare const DocumentLegacy: {
7600
7603
  })[];
7601
7604
  };
7602
7605
  };
7603
- items: {
7606
+ items: ({
7604
7607
  __TYPE__: "GroupItemContent";
7605
- key: string;
7606
7608
  value: [string, {
7607
7609
  type: string;
7608
7610
  __TYPE__: "EmptyContent";
@@ -8193,7 +8195,9 @@ export declare const DocumentLegacy: {
8193
8195
  })[];
8194
8196
  })[];
8195
8197
  }][];
8196
- }[];
8198
+ } & {
8199
+ key?: string;
8200
+ })[];
8197
8201
  };
8198
8202
  }[];
8199
8203
  };
@@ -10013,9 +10017,8 @@ export declare function migrateDocument(document: Document, customType: StaticCu
10013
10017
  })[];
10014
10018
  };
10015
10019
  };
10016
- repeat: {
10020
+ repeat: ({
10017
10021
  __TYPE__: "GroupItemContent";
10018
- key: string;
10019
10022
  value: [string, {
10020
10023
  type: string;
10021
10024
  __TYPE__: "EmptyContent";
@@ -10606,7 +10609,9 @@ export declare function migrateDocument(document: Document, customType: StaticCu
10606
10609
  })[];
10607
10610
  })[];
10608
10611
  }][];
10609
- }[];
10612
+ } & {
10613
+ key?: string;
10614
+ })[];
10610
10615
  } | {
10611
10616
  __TYPE__: "SharedSliceContent";
10612
10617
  variation: string;
@@ -11202,9 +11207,8 @@ export declare function migrateDocument(document: Document, customType: StaticCu
11202
11207
  })[];
11203
11208
  };
11204
11209
  };
11205
- items: {
11210
+ items: ({
11206
11211
  __TYPE__: "GroupItemContent";
11207
- key: string;
11208
11212
  value: [string, {
11209
11213
  type: string;
11210
11214
  __TYPE__: "EmptyContent";
@@ -11795,7 +11799,9 @@ export declare function migrateDocument(document: Document, customType: StaticCu
11795
11799
  })[];
11796
11800
  })[];
11797
11801
  }][];
11798
- }[];
11802
+ } & {
11803
+ key?: string;
11804
+ })[];
11799
11805
  };
11800
11806
  }[];
11801
11807
  };
@@ -8,7 +8,7 @@ export declare const GroupContentType: "GroupContentType";
8
8
  export declare const GroupItemContent: t.Type<GroupItemContent>;
9
9
  export declare type GroupItemContent = {
10
10
  __TYPE__: typeof GroupItemContentType;
11
- key: string;
11
+ key?: string;
12
12
  value: [string, NestableContent | GroupContent][];
13
13
  };
14
14
  export declare const GroupContent: t.Type<GroupContent>;
@@ -13,11 +13,15 @@ const nestable_1 = require("./nestable");
13
13
  const withDefaultValues_1 = require("./withDefaultValues");
14
14
  exports.GroupItemContentType = "GroupItemContent";
15
15
  exports.GroupContentType = "GroupContentType";
16
- exports.GroupItemContent = t.recursion("GroupItemContent", () => t.strict({
17
- __TYPE__: t.literal(exports.GroupItemContentType),
18
- key: t.string,
19
- value: t.array(t.tuple([t.string, t.union([nestable_1.NestableContent, exports.GroupContent])])),
20
- }));
16
+ exports.GroupItemContent = t.recursion("GroupItemContent", () => t.exact(t.intersection([
17
+ t.type({
18
+ __TYPE__: t.literal(exports.GroupItemContentType),
19
+ value: t.array(t.tuple([t.string, t.union([nestable_1.NestableContent, exports.GroupContent])])),
20
+ }),
21
+ t.partial({
22
+ key: t.string,
23
+ }),
24
+ ])));
21
25
  exports.GroupContent = t.recursion("GroupContent", () => t.strict({
22
26
  __TYPE__: t.literal(exports.GroupContentType),
23
27
  value: t.array(exports.GroupItemContent),
@@ -69,7 +73,11 @@ const GroupItemLegacy = (ctx, index) => {
69
73
  types: { ...acc.types, ...encoded.types },
70
74
  keys: { ...acc.keys, ...encoded.keys },
71
75
  };
72
- }, { content: {}, types: {}, keys: { [groupItemCtx.keyOfKey]: item.key } });
76
+ }, {
77
+ content: {},
78
+ types: {},
79
+ keys: item.key ? { [groupItemCtx.keyOfKey]: item.key } : {},
80
+ });
73
81
  });
74
82
  };
75
83
  exports.GroupItemLegacy = GroupItemLegacy;
@@ -147,9 +155,10 @@ function traverseGroupContent({ path, key, apiId, model, content, }) {
147
155
  exports.traverseGroupContent = traverseGroupContent;
148
156
  function traverseGroupItemsContent({ path, model, content, }) {
149
157
  return (transform) => {
150
- return content.map((groupItem) => {
158
+ return content.map((groupItem, index) => {
159
+ var _a;
151
160
  const groupItemPath = path.concat([
152
- { key: groupItem.key, type: "GroupItem" },
161
+ { key: (_a = groupItem.key) !== null && _a !== void 0 ? _a : index.toString(), type: "GroupItem" },
153
162
  ]);
154
163
  const groupItemFields = groupItem.value.reduce((acc, [fieldKey, fieldContent]) => {
155
164
  const fieldDef = model === null || model === void 0 ? void 0 : model[fieldKey];
@@ -199,8 +208,8 @@ function traverseGroupItemsContent({ path, model, content, }) {
199
208
  }, []);
200
209
  return {
201
210
  __TYPE__: groupItem.__TYPE__,
202
- key: groupItem.key,
203
211
  value: groupItemFields,
212
+ ...(groupItem.key && { key: groupItem.key }),
204
213
  };
205
214
  });
206
215
  };
@@ -1539,9 +1539,8 @@ export declare const WidgetContent: t.UnionC<[t.Type<GroupContent, GroupContent,
1539
1539
  }>]>>]>]>;
1540
1540
  }>>]>>;
1541
1541
  }>>]>>;
1542
- repeat: t.ArrayC<t.ExactC<t.TypeC<{
1542
+ repeat: t.ArrayC<t.ExactC<t.IntersectionC<[t.TypeC<{
1543
1543
  __TYPE__: t.LiteralC<"GroupItemContent">;
1544
- key: t.StringC;
1545
1544
  value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
1546
1545
  type: t.StringC;
1547
1546
  __TYPE__: t.LiteralC<"EmptyContent">;
@@ -2306,7 +2305,9 @@ export declare const WidgetContent: t.UnionC<[t.Type<GroupContent, GroupContent,
2306
2305
  }>]>>]>]>;
2307
2306
  }>>]>>;
2308
2307
  }>>]>, t.Type<GroupContent, GroupContent, unknown>]>]>>;
2309
- }>>>;
2308
+ }>, t.PartialC<{
2309
+ key: t.StringC;
2310
+ }>]>>>;
2310
2311
  }>>, t.ExactC<t.TypeC<{
2311
2312
  __TYPE__: t.LiteralC<"SharedSliceContent">;
2312
2313
  variation: t.StringC;
@@ -3074,9 +3075,8 @@ export declare const WidgetContent: t.UnionC<[t.Type<GroupContent, GroupContent,
3074
3075
  }>]>>]>]>;
3075
3076
  }>>]>>;
3076
3077
  }>>]>, t.Type<GroupContent, GroupContent, unknown>]>>;
3077
- items: t.ArrayC<t.ExactC<t.TypeC<{
3078
+ items: t.ArrayC<t.ExactC<t.IntersectionC<[t.TypeC<{
3078
3079
  __TYPE__: t.LiteralC<"GroupItemContent">;
3079
- key: t.StringC;
3080
3080
  value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
3081
3081
  type: t.StringC;
3082
3082
  __TYPE__: t.LiteralC<"EmptyContent">;
@@ -3841,7 +3841,9 @@ export declare const WidgetContent: t.UnionC<[t.Type<GroupContent, GroupContent,
3841
3841
  }>]>>]>]>;
3842
3842
  }>>]>>;
3843
3843
  }>>]>, t.Type<GroupContent, GroupContent, unknown>]>]>>;
3844
- }>>>;
3844
+ }>, t.PartialC<{
3845
+ key: t.StringC;
3846
+ }>]>>>;
3845
3847
  }>>, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
3846
3848
  type: t.StringC;
3847
3849
  __TYPE__: t.LiteralC<"EmptyContent">;
@@ -6389,9 +6391,8 @@ export declare const isWidgetContent: (u: unknown) => u is {
6389
6391
  })[];
6390
6392
  };
6391
6393
  };
6392
- repeat: {
6394
+ repeat: ({
6393
6395
  __TYPE__: "GroupItemContent";
6394
- key: string;
6395
6396
  value: [string, {
6396
6397
  type: string;
6397
6398
  __TYPE__: "EmptyContent";
@@ -6982,7 +6983,9 @@ export declare const isWidgetContent: (u: unknown) => u is {
6982
6983
  })[];
6983
6984
  })[];
6984
6985
  }][];
6985
- }[];
6986
+ } & {
6987
+ key?: string;
6988
+ })[];
6986
6989
  } | {
6987
6990
  __TYPE__: "SharedSliceContent";
6988
6991
  variation: string;
@@ -7578,9 +7581,8 @@ export declare const isWidgetContent: (u: unknown) => u is {
7578
7581
  })[];
7579
7582
  };
7580
7583
  };
7581
- items: {
7584
+ items: ({
7582
7585
  __TYPE__: "GroupItemContent";
7583
- key: string;
7584
7586
  value: [string, {
7585
7587
  type: string;
7586
7588
  __TYPE__: "EmptyContent";
@@ -8171,7 +8173,9 @@ export declare const isWidgetContent: (u: unknown) => u is {
8171
8173
  })[];
8172
8174
  })[];
8173
8175
  }][];
8174
- }[];
8176
+ } & {
8177
+ key?: string;
8178
+ })[];
8175
8179
  };
8176
8180
  }[];
8177
8181
  };
@@ -9959,9 +9963,8 @@ export declare const WidgetLegacy: (ctx: LegacyContentCtx) => {
9959
9963
  })[];
9960
9964
  };
9961
9965
  };
9962
- repeat: {
9966
+ repeat: ({
9963
9967
  __TYPE__: "GroupItemContent";
9964
- key: string;
9965
9968
  value: [string, {
9966
9969
  type: string;
9967
9970
  __TYPE__: "EmptyContent";
@@ -10552,7 +10555,9 @@ export declare const WidgetLegacy: (ctx: LegacyContentCtx) => {
10552
10555
  })[];
10553
10556
  })[];
10554
10557
  }][];
10555
- }[];
10558
+ } & {
10559
+ key?: string;
10560
+ })[];
10556
10561
  } | {
10557
10562
  __TYPE__: "SharedSliceContent";
10558
10563
  variation: string;
@@ -11148,9 +11153,8 @@ export declare const WidgetLegacy: (ctx: LegacyContentCtx) => {
11148
11153
  })[];
11149
11154
  };
11150
11155
  };
11151
- items: {
11156
+ items: ({
11152
11157
  __TYPE__: "GroupItemContent";
11153
- key: string;
11154
11158
  value: [string, {
11155
11159
  type: string;
11156
11160
  __TYPE__: "EmptyContent";
@@ -11741,7 +11745,9 @@ export declare const WidgetLegacy: (ctx: LegacyContentCtx) => {
11741
11745
  })[];
11742
11746
  })[];
11743
11747
  }][];
11744
- }[];
11748
+ } & {
11749
+ key?: string;
11750
+ })[];
11745
11751
  };
11746
11752
  }[];
11747
11753
  }> | import("fp-ts/lib/Either").Right<GroupContent> | undefined;
@@ -598,9 +598,8 @@ export declare const isCompositeSliceContent: (u: unknown) => u is {
598
598
  })[];
599
599
  };
600
600
  };
601
- repeat: {
601
+ repeat: ({
602
602
  __TYPE__: "GroupItemContent";
603
- key: string;
604
603
  value: [string, {
605
604
  type: string;
606
605
  __TYPE__: "EmptyContent";
@@ -1191,7 +1190,9 @@ export declare const isCompositeSliceContent: (u: unknown) => u is {
1191
1190
  })[];
1192
1191
  })[];
1193
1192
  }][];
1194
- }[];
1193
+ } & {
1194
+ key?: string;
1195
+ })[];
1195
1196
  };
1196
1197
  export declare const CompositeSliceLegacy: (ctx: LegacyContentCtx) => t.Type<{
1197
1198
  __TYPE__: "CompositeSliceContent";
@@ -1787,9 +1788,8 @@ export declare const CompositeSliceLegacy: (ctx: LegacyContentCtx) => t.Type<{
1787
1788
  })[];
1788
1789
  };
1789
1790
  };
1790
- repeat: {
1791
+ repeat: ({
1791
1792
  __TYPE__: "GroupItemContent";
1792
- key: string;
1793
1793
  value: [string, {
1794
1794
  type: string;
1795
1795
  __TYPE__: "EmptyContent";
@@ -2380,7 +2380,9 @@ export declare const CompositeSliceLegacy: (ctx: LegacyContentCtx) => t.Type<{
2380
2380
  })[];
2381
2381
  })[];
2382
2382
  }][];
2383
- }[];
2383
+ } & {
2384
+ key?: string;
2385
+ })[];
2384
2386
  }, WithTypes<{
2385
2387
  repeat?: unknown[];
2386
2388
  "non-repeat"?: {
@@ -3153,9 +3155,8 @@ export declare const CompositeSliceContent: t.ExactC<t.TypeC<{
3153
3155
  }>]>>]>]>;
3154
3156
  }>>]>>;
3155
3157
  }>>]>>;
3156
- repeat: t.ArrayC<t.ExactC<t.TypeC<{
3158
+ repeat: t.ArrayC<t.ExactC<t.IntersectionC<[t.TypeC<{
3157
3159
  __TYPE__: t.LiteralC<"GroupItemContent">;
3158
- key: t.StringC;
3159
3160
  value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
3160
3161
  type: t.StringC;
3161
3162
  __TYPE__: t.LiteralC<"EmptyContent">;
@@ -3920,7 +3921,9 @@ export declare const CompositeSliceContent: t.ExactC<t.TypeC<{
3920
3921
  }>]>>]>]>;
3921
3922
  }>>]>>;
3922
3923
  }>>]>, t.Type<import("../../GroupContent").GroupContent, import("../../GroupContent").GroupContent, unknown>]>]>>;
3923
- }>>>;
3924
+ }>, t.PartialC<{
3925
+ key: t.StringC;
3926
+ }>]>>>;
3924
3927
  }>>;
3925
3928
  export declare type CompositeSliceContent = t.TypeOf<typeof CompositeSliceContent>;
3926
3929
  export declare function compositeSliceContentWithDefaultValues(customType: CompositeSlice, content: CompositeSliceContent): CompositeSliceContent;
@@ -178,7 +178,7 @@ function migrateCompositeSlice(model, content) {
178
178
  items: content.widget.repeat.map((groupItem) => {
179
179
  return {
180
180
  __TYPE__: "GroupItemContent",
181
- key: groupItem.key,
181
+ ...(groupItem.key && { key: groupItem.key }),
182
182
  value: groupItem.value.reduce((acc, [fieldKey, fieldContent]) => {
183
183
  var _a;
184
184
  if (!((_a = model.fields.items) === null || _a === void 0 ? void 0 : _a[fieldKey])) {
@@ -4,9 +4,8 @@ import { GroupContent, GroupItemContent } from "../../GroupContent";
4
4
  export declare const RepeatableWidgetsLegacy: (ctx: LegacyContentCtx) => t.Type<GroupItemContent[], WithTypes<{
5
5
  [x: string]: unknown;
6
6
  }>[], unknown>;
7
- export declare const RepeatableWidgets: t.ArrayC<t.ExactC<t.TypeC<{
7
+ export declare const RepeatableWidgets: t.ArrayC<t.ExactC<t.IntersectionC<[t.TypeC<{
8
8
  __TYPE__: t.LiteralC<"GroupItemContent">;
9
- key: t.StringC;
10
9
  value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
11
10
  type: t.StringC;
12
11
  __TYPE__: t.LiteralC<"EmptyContent">;
@@ -771,4 +770,6 @@ export declare const RepeatableWidgets: t.ArrayC<t.ExactC<t.TypeC<{
771
770
  }>]>>]>]>;
772
771
  }>>]>>;
773
772
  }>>]>, t.Type<GroupContent, GroupContent, unknown>]>]>>;
774
- }>>>;
773
+ }>, t.PartialC<{
774
+ key: t.StringC;
775
+ }>]>>>;
@@ -13,9 +13,13 @@ const RepeatableWidget = t.tuple([
13
13
  t.string,
14
14
  t.union([nestable_1.NestableContent, GroupContent_1.GroupContent]),
15
15
  ]);
16
- const RepeatableWidgetsBlock = t.strict({
17
- __TYPE__: t.literal(GroupContent_1.GroupItemContentType),
18
- key: t.string,
19
- value: t.array(RepeatableWidget),
20
- });
16
+ const RepeatableWidgetsBlock = t.exact(t.intersection([
17
+ t.type({
18
+ __TYPE__: t.literal(GroupContent_1.GroupItemContentType),
19
+ value: t.array(RepeatableWidget),
20
+ }),
21
+ t.partial({
22
+ key: t.string,
23
+ }),
24
+ ]));
21
25
  exports.RepeatableWidgets = t.array(RepeatableWidgetsBlock);
@@ -599,9 +599,8 @@ export declare const isSharedSliceContent: (u: unknown) => u is {
599
599
  })[];
600
600
  };
601
601
  };
602
- items: {
602
+ items: ({
603
603
  __TYPE__: "GroupItemContent";
604
- key: string;
605
604
  value: [string, {
606
605
  type: string;
607
606
  __TYPE__: "EmptyContent";
@@ -1192,7 +1191,9 @@ export declare const isSharedSliceContent: (u: unknown) => u is {
1192
1191
  })[];
1193
1192
  })[];
1194
1193
  }][];
1195
- }[];
1194
+ } & {
1195
+ key?: string;
1196
+ })[];
1196
1197
  };
1197
1198
  export declare const SharedSliceLegacy: (ctx: LegacyContentCtx) => t.Type<{
1198
1199
  __TYPE__: "SharedSliceContent";
@@ -1789,9 +1790,8 @@ export declare const SharedSliceLegacy: (ctx: LegacyContentCtx) => t.Type<{
1789
1790
  })[];
1790
1791
  };
1791
1792
  };
1792
- items: {
1793
+ items: ({
1793
1794
  __TYPE__: "GroupItemContent";
1794
- key: string;
1795
1795
  value: [string, {
1796
1796
  type: string;
1797
1797
  __TYPE__: "EmptyContent";
@@ -2382,7 +2382,9 @@ export declare const SharedSliceLegacy: (ctx: LegacyContentCtx) => t.Type<{
2382
2382
  })[];
2383
2383
  })[];
2384
2384
  }][];
2385
- }[];
2385
+ } & {
2386
+ key?: string;
2387
+ })[];
2386
2388
  }, WithTypes<{
2387
2389
  variation: string;
2388
2390
  items: unknown[];
@@ -3157,9 +3159,8 @@ export declare const SharedSliceContent: t.ExactC<t.TypeC<{
3157
3159
  }>]>>]>]>;
3158
3160
  }>>]>>;
3159
3161
  }>>]>, t.Type<import("../../GroupContent").GroupContent, import("../../GroupContent").GroupContent, unknown>]>>;
3160
- items: t.ArrayC<t.ExactC<t.TypeC<{
3162
+ items: t.ArrayC<t.ExactC<t.IntersectionC<[t.TypeC<{
3161
3163
  __TYPE__: t.LiteralC<"GroupItemContent">;
3162
- key: t.StringC;
3163
3164
  value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
3164
3165
  type: t.StringC;
3165
3166
  __TYPE__: t.LiteralC<"EmptyContent">;
@@ -3924,7 +3925,9 @@ export declare const SharedSliceContent: t.ExactC<t.TypeC<{
3924
3925
  }>]>>]>]>;
3925
3926
  }>>]>>;
3926
3927
  }>>]>, t.Type<import("../../GroupContent").GroupContent, import("../../GroupContent").GroupContent, unknown>]>]>>;
3927
- }>>>;
3928
+ }>, t.PartialC<{
3929
+ key: t.StringC;
3930
+ }>]>>>;
3928
3931
  }>>;
3929
3932
  export declare type SharedSliceContent = t.TypeOf<typeof SharedSliceContent>;
3930
3933
  export declare function sharedSliceContentWithDefaultValues(customType: SharedSlice, content: SharedSliceContent): SharedSliceContent;
@@ -101,7 +101,7 @@ function migrateSimpleSlice(model, content) {
101
101
  items: content.widget.value.map((groupItem) => {
102
102
  return {
103
103
  __TYPE__: "GroupItemContent",
104
- key: groupItem.key,
104
+ ...(groupItem.key && { key: groupItem.key }),
105
105
  value: groupItem.value.reduce((acc, [fieldKey, fieldContent]) => {
106
106
  var _a;
107
107
  return ((_a = model.fields.items) === null || _a === void 0 ? void 0 : _a[fieldKey])
@@ -1184,9 +1184,8 @@ export declare const SliceLegacy: (ctx: LegacyContentCtx) => {
1184
1184
  })[];
1185
1185
  };
1186
1186
  };
1187
- repeat: {
1187
+ repeat: ({
1188
1188
  __TYPE__: "GroupItemContent";
1189
- key: string;
1190
1189
  value: [string, {
1191
1190
  type: string;
1192
1191
  __TYPE__: "EmptyContent";
@@ -1777,7 +1776,9 @@ export declare const SliceLegacy: (ctx: LegacyContentCtx) => {
1777
1776
  })[];
1778
1777
  })[];
1779
1778
  }][];
1780
- }[];
1779
+ } & {
1780
+ key?: string;
1781
+ })[];
1781
1782
  }> | import("fp-ts/lib/Either").Right<{
1782
1783
  __TYPE__: "SharedSliceContent";
1783
1784
  variation: string;
@@ -2373,9 +2374,8 @@ export declare const SliceLegacy: (ctx: LegacyContentCtx) => {
2373
2374
  })[];
2374
2375
  };
2375
2376
  };
2376
- items: {
2377
+ items: ({
2377
2378
  __TYPE__: "GroupItemContent";
2378
- key: string;
2379
2379
  value: [string, {
2380
2380
  type: string;
2381
2381
  __TYPE__: "EmptyContent";
@@ -2966,7 +2966,9 @@ export declare const SliceLegacy: (ctx: LegacyContentCtx) => {
2966
2966
  })[];
2967
2967
  })[];
2968
2968
  }][];
2969
- }[];
2969
+ } & {
2970
+ key?: string;
2971
+ })[];
2970
2972
  }> | import("fp-ts/lib/Either").Right<import("../..").GroupContent> | undefined;
2971
2973
  encode: (value: SliceContent) => import("../../../LegacyContentCtx").WithTypes<unknown> | undefined;
2972
2974
  };
@@ -3736,9 +3738,8 @@ export declare const SliceContent: t.UnionC<[t.ExactC<t.TypeC<{
3736
3738
  }>]>>]>]>;
3737
3739
  }>>]>>;
3738
3740
  }>>]>>;
3739
- repeat: t.ArrayC<t.ExactC<t.TypeC<{
3741
+ repeat: t.ArrayC<t.ExactC<t.IntersectionC<[t.TypeC<{
3740
3742
  __TYPE__: t.LiteralC<"GroupItemContent">;
3741
- key: t.StringC;
3742
3743
  value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
3743
3744
  type: t.StringC;
3744
3745
  __TYPE__: t.LiteralC<"EmptyContent">;
@@ -4503,7 +4504,9 @@ export declare const SliceContent: t.UnionC<[t.ExactC<t.TypeC<{
4503
4504
  }>]>>]>]>;
4504
4505
  }>>]>>;
4505
4506
  }>>]>, t.Type<import("../..").GroupContent, import("../..").GroupContent, unknown>]>]>>;
4506
- }>>>;
4507
+ }>, t.PartialC<{
4508
+ key: t.StringC;
4509
+ }>]>>>;
4507
4510
  }>>, t.ExactC<t.TypeC<{
4508
4511
  __TYPE__: t.LiteralC<"SharedSliceContent">;
4509
4512
  variation: t.StringC;
@@ -5271,9 +5274,8 @@ export declare const SliceContent: t.UnionC<[t.ExactC<t.TypeC<{
5271
5274
  }>]>>]>]>;
5272
5275
  }>>]>>;
5273
5276
  }>>]>, t.Type<import("../..").GroupContent, import("../..").GroupContent, unknown>]>>;
5274
- items: t.ArrayC<t.ExactC<t.TypeC<{
5277
+ items: t.ArrayC<t.ExactC<t.IntersectionC<[t.TypeC<{
5275
5278
  __TYPE__: t.LiteralC<"GroupItemContent">;
5276
- key: t.StringC;
5277
5279
  value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
5278
5280
  type: t.StringC;
5279
5281
  __TYPE__: t.LiteralC<"EmptyContent">;
@@ -6038,7 +6040,9 @@ export declare const SliceContent: t.UnionC<[t.ExactC<t.TypeC<{
6038
6040
  }>]>>]>]>;
6039
6041
  }>>]>>;
6040
6042
  }>>]>, t.Type<import("../..").GroupContent, import("../..").GroupContent, unknown>]>]>>;
6041
- }>>>;
6043
+ }>, t.PartialC<{
6044
+ key: t.StringC;
6045
+ }>]>>>;
6042
6046
  }>>, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
6043
6047
  type: t.StringC;
6044
6048
  __TYPE__: t.LiteralC<"EmptyContent">;
@@ -776,9 +776,8 @@ export declare const SliceItemContent: t.TypeC<{
776
776
  }>]>>]>]>;
777
777
  }>>]>>;
778
778
  }>>]>>;
779
- repeat: t.ArrayC<t.ExactC<t.TypeC<{
779
+ repeat: t.ArrayC<t.ExactC<t.IntersectionC<[t.TypeC<{
780
780
  __TYPE__: t.LiteralC<"GroupItemContent">;
781
- key: t.StringC;
782
781
  value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
783
782
  type: t.StringC;
784
783
  __TYPE__: t.LiteralC<"EmptyContent">;
@@ -1543,7 +1542,9 @@ export declare const SliceItemContent: t.TypeC<{
1543
1542
  }>]>>]>]>;
1544
1543
  }>>]>>;
1545
1544
  }>>]>, t.Type<import("../GroupContent").GroupContent, import("../GroupContent").GroupContent, unknown>]>]>>;
1546
- }>>>;
1545
+ }>, t.PartialC<{
1546
+ key: t.StringC;
1547
+ }>]>>>;
1547
1548
  }>>, t.ExactC<t.TypeC<{
1548
1549
  __TYPE__: t.LiteralC<"SharedSliceContent">;
1549
1550
  variation: t.StringC;
@@ -2311,9 +2312,8 @@ export declare const SliceItemContent: t.TypeC<{
2311
2312
  }>]>>]>]>;
2312
2313
  }>>]>>;
2313
2314
  }>>]>, t.Type<import("../GroupContent").GroupContent, import("../GroupContent").GroupContent, unknown>]>>;
2314
- items: t.ArrayC<t.ExactC<t.TypeC<{
2315
+ items: t.ArrayC<t.ExactC<t.IntersectionC<[t.TypeC<{
2315
2316
  __TYPE__: t.LiteralC<"GroupItemContent">;
2316
- key: t.StringC;
2317
2317
  value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
2318
2318
  type: t.StringC;
2319
2319
  __TYPE__: t.LiteralC<"EmptyContent">;
@@ -3078,7 +3078,9 @@ export declare const SliceItemContent: t.TypeC<{
3078
3078
  }>]>>]>]>;
3079
3079
  }>>]>>;
3080
3080
  }>>]>, t.Type<import("../GroupContent").GroupContent, import("../GroupContent").GroupContent, unknown>]>]>>;
3081
- }>>>;
3081
+ }>, t.PartialC<{
3082
+ key: t.StringC;
3083
+ }>]>>>;
3082
3084
  }>>, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
3083
3085
  type: t.StringC;
3084
3086
  __TYPE__: t.LiteralC<"EmptyContent">;
@@ -5052,9 +5054,8 @@ export declare const SlicesItemLegacy: (ctx: LegacyContentCtx) => t.Type<{
5052
5054
  })[];
5053
5055
  };
5054
5056
  };
5055
- repeat: {
5057
+ repeat: ({
5056
5058
  __TYPE__: "GroupItemContent";
5057
- key: string;
5058
5059
  value: [string, {
5059
5060
  type: string;
5060
5061
  __TYPE__: "EmptyContent";
@@ -5645,7 +5646,9 @@ export declare const SlicesItemLegacy: (ctx: LegacyContentCtx) => t.Type<{
5645
5646
  })[];
5646
5647
  })[];
5647
5648
  }][];
5648
- }[];
5649
+ } & {
5650
+ key?: string;
5651
+ })[];
5649
5652
  } | {
5650
5653
  __TYPE__: "SharedSliceContent";
5651
5654
  variation: string;
@@ -6241,9 +6244,8 @@ export declare const SlicesItemLegacy: (ctx: LegacyContentCtx) => t.Type<{
6241
6244
  })[];
6242
6245
  };
6243
6246
  };
6244
- items: {
6247
+ items: ({
6245
6248
  __TYPE__: "GroupItemContent";
6246
- key: string;
6247
6249
  value: [string, {
6248
6250
  type: string;
6249
6251
  __TYPE__: "EmptyContent";
@@ -6834,7 +6836,9 @@ export declare const SlicesItemLegacy: (ctx: LegacyContentCtx) => t.Type<{
6834
6836
  })[];
6835
6837
  })[];
6836
6838
  }][];
6837
- }[];
6839
+ } & {
6840
+ key?: string;
6841
+ })[];
6838
6842
  };
6839
6843
  }, WithTypes<{
6840
6844
  key: string;
@@ -1192,9 +1192,8 @@ export declare const isSlicesContent: (u: unknown) => u is {
1192
1192
  })[];
1193
1193
  };
1194
1194
  };
1195
- repeat: {
1195
+ repeat: ({
1196
1196
  __TYPE__: "GroupItemContent";
1197
- key: string;
1198
1197
  value: [string, {
1199
1198
  type: string;
1200
1199
  __TYPE__: "EmptyContent";
@@ -1785,7 +1784,9 @@ export declare const isSlicesContent: (u: unknown) => u is {
1785
1784
  })[];
1786
1785
  })[];
1787
1786
  }][];
1788
- }[];
1787
+ } & {
1788
+ key?: string;
1789
+ })[];
1789
1790
  } | {
1790
1791
  __TYPE__: "SharedSliceContent";
1791
1792
  variation: string;
@@ -2381,9 +2382,8 @@ export declare const isSlicesContent: (u: unknown) => u is {
2381
2382
  })[];
2382
2383
  };
2383
2384
  };
2384
- items: {
2385
+ items: ({
2385
2386
  __TYPE__: "GroupItemContent";
2386
- key: string;
2387
2387
  value: [string, {
2388
2388
  type: string;
2389
2389
  __TYPE__: "EmptyContent";
@@ -2974,7 +2974,9 @@ export declare const isSlicesContent: (u: unknown) => u is {
2974
2974
  })[];
2975
2975
  })[];
2976
2976
  }][];
2977
- }[];
2977
+ } & {
2978
+ key?: string;
2979
+ })[];
2978
2980
  };
2979
2981
  }[];
2980
2982
  };
@@ -4168,9 +4170,8 @@ export declare const SlicesLegacy: (ctx: LegacyContentCtx) => t.Type<{
4168
4170
  })[];
4169
4171
  };
4170
4172
  };
4171
- repeat: {
4173
+ repeat: ({
4172
4174
  __TYPE__: "GroupItemContent";
4173
- key: string;
4174
4175
  value: [string, {
4175
4176
  type: string;
4176
4177
  __TYPE__: "EmptyContent";
@@ -4761,7 +4762,9 @@ export declare const SlicesLegacy: (ctx: LegacyContentCtx) => t.Type<{
4761
4762
  })[];
4762
4763
  })[];
4763
4764
  }][];
4764
- }[];
4765
+ } & {
4766
+ key?: string;
4767
+ })[];
4765
4768
  } | {
4766
4769
  __TYPE__: "SharedSliceContent";
4767
4770
  variation: string;
@@ -5357,9 +5360,8 @@ export declare const SlicesLegacy: (ctx: LegacyContentCtx) => t.Type<{
5357
5360
  })[];
5358
5361
  };
5359
5362
  };
5360
- items: {
5363
+ items: ({
5361
5364
  __TYPE__: "GroupItemContent";
5362
- key: string;
5363
5365
  value: [string, {
5364
5366
  type: string;
5365
5367
  __TYPE__: "EmptyContent";
@@ -5950,7 +5952,9 @@ export declare const SlicesLegacy: (ctx: LegacyContentCtx) => t.Type<{
5950
5952
  })[];
5951
5953
  })[];
5952
5954
  }][];
5953
- }[];
5955
+ } & {
5956
+ key?: string;
5957
+ })[];
5954
5958
  };
5955
5959
  }[];
5956
5960
  }, WithTypes<SlicesLegacy>, unknown>;
@@ -6726,9 +6730,8 @@ export declare const SlicesContent: t.TypeC<{
6726
6730
  }>]>>]>]>;
6727
6731
  }>>]>>;
6728
6732
  }>>]>>;
6729
- repeat: t.ArrayC<t.ExactC<t.TypeC<{
6733
+ repeat: t.ArrayC<t.ExactC<t.IntersectionC<[t.TypeC<{
6730
6734
  __TYPE__: t.LiteralC<"GroupItemContent">;
6731
- key: t.StringC;
6732
6735
  value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
6733
6736
  type: t.StringC;
6734
6737
  __TYPE__: t.LiteralC<"EmptyContent">;
@@ -7493,7 +7496,9 @@ export declare const SlicesContent: t.TypeC<{
7493
7496
  }>]>>]>]>;
7494
7497
  }>>]>>;
7495
7498
  }>>]>, t.Type<import("..").GroupContent, import("..").GroupContent, unknown>]>]>>;
7496
- }>>>;
7499
+ }>, t.PartialC<{
7500
+ key: t.StringC;
7501
+ }>]>>>;
7497
7502
  }>>, t.ExactC<t.TypeC<{
7498
7503
  __TYPE__: t.LiteralC<"SharedSliceContent">;
7499
7504
  variation: t.StringC;
@@ -8261,9 +8266,8 @@ export declare const SlicesContent: t.TypeC<{
8261
8266
  }>]>>]>]>;
8262
8267
  }>>]>>;
8263
8268
  }>>]>, t.Type<import("..").GroupContent, import("..").GroupContent, unknown>]>>;
8264
- items: t.ArrayC<t.ExactC<t.TypeC<{
8269
+ items: t.ArrayC<t.ExactC<t.IntersectionC<[t.TypeC<{
8265
8270
  __TYPE__: t.LiteralC<"GroupItemContent">;
8266
- key: t.StringC;
8267
8271
  value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
8268
8272
  type: t.StringC;
8269
8273
  __TYPE__: t.LiteralC<"EmptyContent">;
@@ -9028,7 +9032,9 @@ export declare const SlicesContent: t.TypeC<{
9028
9032
  }>]>>]>]>;
9029
9033
  }>>]>>;
9030
9034
  }>>]>, t.Type<import("..").GroupContent, import("..").GroupContent, unknown>]>]>>;
9031
- }>>>;
9035
+ }>, t.PartialC<{
9036
+ key: t.StringC;
9037
+ }>]>>>;
9032
9038
  }>>, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
9033
9039
  type: t.StringC;
9034
9040
  __TYPE__: t.LiteralC<"EmptyContent">;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismicio/types-internal",
3
- "version": "3.13.0-alpha.0",
3
+ "version": "3.14.0",
4
4
  "description": "Prismic types for Custom Types and Prismic Data",
5
5
  "keywords": [
6
6
  "typescript",
@@ -36,17 +36,24 @@ export const GroupContentType = "GroupContentType" as const
36
36
  export const GroupItemContent: t.Type<GroupItemContent> = t.recursion(
37
37
  "GroupItemContent",
38
38
  () =>
39
- t.strict({
40
- __TYPE__: t.literal(GroupItemContentType),
41
- key: t.string,
42
- value: t.array(
43
- t.tuple([t.string, t.union([NestableContent, GroupContent])]),
44
- ),
45
- }),
39
+ t.exact(
40
+ t.intersection([
41
+ t.type({
42
+ __TYPE__: t.literal(GroupItemContentType),
43
+ value: t.array(
44
+ t.tuple([t.string, t.union([NestableContent, GroupContent])]),
45
+ ),
46
+ }),
47
+ t.partial({
48
+ key: t.string,
49
+ }),
50
+ ]),
51
+ ),
46
52
  )
53
+
47
54
  export type GroupItemContent = {
48
55
  __TYPE__: typeof GroupItemContentType
49
- key: string
56
+ key?: string
50
57
  value: [string, NestableContent | GroupContent][]
51
58
  }
52
59
 
@@ -129,7 +136,11 @@ export const GroupItemLegacy = (ctx: LegacyContentCtx, index: number) => {
129
136
  keys: { ...acc.keys, ...encoded.keys },
130
137
  }
131
138
  },
132
- { content: {}, types: {}, keys: { [groupItemCtx.keyOfKey]: item.key } },
139
+ {
140
+ content: {},
141
+ types: {},
142
+ keys: item.key ? { [groupItemCtx.keyOfKey]: item.key } : {},
143
+ },
133
144
  )
134
145
  },
135
146
  )
@@ -264,9 +275,9 @@ export function traverseGroupItemsContent({
264
275
  model?: Record<string, Group | NestableWidget> | undefined
265
276
  }) {
266
277
  return (transform: TraverseWidgetContentFn): Array<GroupItemContent> => {
267
- return content.map((groupItem) => {
278
+ return content.map((groupItem, index) => {
268
279
  const groupItemPath = path.concat([
269
- { key: groupItem.key, type: "GroupItem" },
280
+ { key: groupItem.key ?? index.toString(), type: "GroupItem" },
270
281
  ])
271
282
 
272
283
  const groupItemFields = groupItem.value.reduce<GroupItemContent["value"]>(
@@ -325,8 +336,8 @@ export function traverseGroupItemsContent({
325
336
 
326
337
  return {
327
338
  __TYPE__: groupItem.__TYPE__,
328
- key: groupItem.key,
329
339
  value: groupItemFields,
340
+ ...(groupItem.key && { key: groupItem.key }),
330
341
  }
331
342
  })
332
343
  }
@@ -273,7 +273,7 @@ export function migrateCompositeSlice(
273
273
  items: content.widget.repeat.map((groupItem) => {
274
274
  return {
275
275
  __TYPE__: "GroupItemContent",
276
- key: groupItem.key,
276
+ ...(groupItem.key && { key: groupItem.key }),
277
277
  value: groupItem.value.reduce<GroupItemContent["value"]>(
278
278
  (acc, [fieldKey, fieldContent]) => {
279
279
  if (!model.fields.items?.[fieldKey]) {
@@ -20,10 +20,16 @@ const RepeatableWidget = t.tuple([
20
20
  t.string,
21
21
  t.union([NestableContent, GroupContent]),
22
22
  ])
23
- const RepeatableWidgetsBlock = t.strict({
24
- __TYPE__: t.literal(GroupItemContentType),
25
- key: t.string,
26
- value: t.array(RepeatableWidget),
27
- })
23
+ const RepeatableWidgetsBlock = t.exact(
24
+ t.intersection([
25
+ t.type({
26
+ __TYPE__: t.literal(GroupItemContentType),
27
+ value: t.array(RepeatableWidget),
28
+ }),
29
+ t.partial({
30
+ key: t.string,
31
+ }),
32
+ ]),
33
+ )
28
34
 
29
35
  export const RepeatableWidgets = t.array(RepeatableWidgetsBlock)
@@ -150,7 +150,7 @@ export function migrateSimpleSlice(
150
150
  items: content.widget.value.map((groupItem) => {
151
151
  return {
152
152
  __TYPE__: "GroupItemContent",
153
- key: groupItem.key,
153
+ ...(groupItem.key && { key: groupItem.key }),
154
154
  value: groupItem.value.reduce<GroupItemContent["value"]>(
155
155
  (acc, [fieldKey, fieldContent]) => {
156
156
  return model.fields.items?.[fieldKey]