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