@prismicio/types-internal 2.5.0-alpha.2 → 2.5.0-alpha.3
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/lib/content/Document.d.ts +8 -8
- package/lib/content/fields/GroupContent.d.ts +8 -8
- package/lib/content/fields/GroupContent.js +14 -32
- package/lib/content/fields/WidgetContent.d.ts +8 -8
- package/lib/content/fields/slices/Slice/CompositeSliceContent.d.ts +4 -4
- package/lib/content/fields/slices/Slice/CompositeSliceContent.js +0 -3
- package/lib/content/fields/slices/Slice/RepeatableContent.d.ts +3 -2
- package/lib/content/fields/slices/Slice/RepeatableContent.js +4 -1
- package/lib/content/fields/slices/Slice/SharedSliceContent.d.ts +4 -4
- package/lib/content/fields/slices/Slice/SharedSliceContent.js +0 -2
- package/lib/content/fields/slices/Slice/SimpleSliceContent.js +0 -1
- package/lib/content/fields/slices/Slice/index.d.ts +6 -6
- package/lib/content/fields/slices/SliceItem.d.ts +6 -6
- package/lib/content/fields/slices/SlicesContent.d.ts +8 -8
- package/lib/customtypes/CustomType.d.ts +2042 -690
- package/lib/customtypes/Section.d.ts +2028 -676
- package/lib/customtypes/diff/SharedSlice.d.ts +678 -2
- package/lib/customtypes/diff/Variation.d.ts +678 -3
- package/lib/customtypes/widgets/Group.d.ts +996 -15
- package/lib/customtypes/widgets/Group.js +15 -27
- package/lib/customtypes/widgets/Widget.d.ts +1684 -7
- package/lib/customtypes/widgets/slices/LegacySlice.d.ts +168 -2
- package/lib/customtypes/widgets/slices/LegacySlice.js +1 -1
- package/lib/customtypes/widgets/slices/SharedSlice.d.ts +670 -2
- package/lib/customtypes/widgets/slices/SlicePrimaryWidget.d.ts +674 -3
- package/lib/customtypes/widgets/slices/Slices.d.ts +1522 -7
- package/package.json +1 -1
- package/src/content/fields/GroupContent.ts +24 -48
- package/src/content/fields/slices/Slice/CompositeSliceContent.ts +4 -7
- package/src/content/fields/slices/Slice/RepeatableContent.ts +9 -2
- package/src/content/fields/slices/Slice/SharedSliceContent.ts +3 -5
- package/src/content/fields/slices/Slice/SimpleSliceContent.ts +1 -3
- package/src/customtypes/widgets/Group.ts +34 -61
- package/src/customtypes/widgets/slices/LegacySlice.ts +2 -2
|
@@ -670,7 +670,7 @@ export declare const Document: t.RecordC<t.Type<string, string, unknown>, t.Unio
|
|
|
670
670
|
}>>]>>;
|
|
671
671
|
repeat: t.ArrayC<t.ExactC<t.TypeC<{
|
|
672
672
|
__TYPE__: t.LiteralC<"GroupItemContent">;
|
|
673
|
-
value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.ExactC<t.TypeC<{
|
|
673
|
+
value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
|
|
674
674
|
type: t.StringC;
|
|
675
675
|
__TYPE__: t.LiteralC<"EmptyContent">;
|
|
676
676
|
}>>, t.ExactC<t.TypeC<{
|
|
@@ -996,7 +996,7 @@ export declare const Document: t.RecordC<t.Type<string, string, unknown>, t.Unio
|
|
|
996
996
|
}>]>>]>>;
|
|
997
997
|
}>>, t.ExactC<t.TypeC<{
|
|
998
998
|
__TYPE__: t.LiteralC<"SeparatorContent">;
|
|
999
|
-
}>>]>]>>;
|
|
999
|
+
}>>]>, t.Type<import("./fields").GroupContent, import("./fields").GroupContent, unknown>]>]>>;
|
|
1000
1000
|
}>>>;
|
|
1001
1001
|
}>>, t.ExactC<t.TypeC<{
|
|
1002
1002
|
__TYPE__: t.LiteralC<"SharedSliceContent">;
|
|
@@ -1330,7 +1330,7 @@ export declare const Document: t.RecordC<t.Type<string, string, unknown>, t.Unio
|
|
|
1330
1330
|
}>>]>, t.Type<import("./fields").GroupContent, import("./fields").GroupContent, unknown>]>>;
|
|
1331
1331
|
items: t.ArrayC<t.ExactC<t.TypeC<{
|
|
1332
1332
|
__TYPE__: t.LiteralC<"GroupItemContent">;
|
|
1333
|
-
value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.ExactC<t.TypeC<{
|
|
1333
|
+
value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
|
|
1334
1334
|
type: t.StringC;
|
|
1335
1335
|
__TYPE__: t.LiteralC<"EmptyContent">;
|
|
1336
1336
|
}>>, t.ExactC<t.TypeC<{
|
|
@@ -1656,7 +1656,7 @@ export declare const Document: t.RecordC<t.Type<string, string, unknown>, t.Unio
|
|
|
1656
1656
|
}>]>>]>>;
|
|
1657
1657
|
}>>, t.ExactC<t.TypeC<{
|
|
1658
1658
|
__TYPE__: t.LiteralC<"SeparatorContent">;
|
|
1659
|
-
}>>]>]>>;
|
|
1659
|
+
}>>]>, t.Type<import("./fields").GroupContent, import("./fields").GroupContent, unknown>]>]>>;
|
|
1660
1660
|
}>>>;
|
|
1661
1661
|
}>>, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
|
|
1662
1662
|
type: t.StringC;
|
|
@@ -3117,7 +3117,7 @@ export declare const DocumentLegacy: {
|
|
|
3117
3117
|
}))[];
|
|
3118
3118
|
} | {
|
|
3119
3119
|
__TYPE__: "SeparatorContent";
|
|
3120
|
-
}][];
|
|
3120
|
+
} | import("./fields").GroupContent][];
|
|
3121
3121
|
}[];
|
|
3122
3122
|
} | {
|
|
3123
3123
|
__TYPE__: "SharedSliceContent";
|
|
@@ -3675,7 +3675,7 @@ export declare const DocumentLegacy: {
|
|
|
3675
3675
|
}))[];
|
|
3676
3676
|
} | {
|
|
3677
3677
|
__TYPE__: "SeparatorContent";
|
|
3678
|
-
}][];
|
|
3678
|
+
} | import("./fields").GroupContent][];
|
|
3679
3679
|
}[];
|
|
3680
3680
|
};
|
|
3681
3681
|
}[];
|
|
@@ -4827,7 +4827,7 @@ export declare function migrateDocument(document: Document, customType: StaticCu
|
|
|
4827
4827
|
}))[];
|
|
4828
4828
|
} | {
|
|
4829
4829
|
__TYPE__: "SeparatorContent";
|
|
4830
|
-
}][];
|
|
4830
|
+
} | import("./fields").GroupContent][];
|
|
4831
4831
|
}[];
|
|
4832
4832
|
} | {
|
|
4833
4833
|
__TYPE__: "SharedSliceContent";
|
|
@@ -5385,7 +5385,7 @@ export declare function migrateDocument(document: Document, customType: StaticCu
|
|
|
5385
5385
|
}))[];
|
|
5386
5386
|
} | {
|
|
5387
5387
|
__TYPE__: "SeparatorContent";
|
|
5388
|
-
}][];
|
|
5388
|
+
} | import("./fields").GroupContent][];
|
|
5389
5389
|
}[];
|
|
5390
5390
|
};
|
|
5391
5391
|
}[];
|
|
@@ -3,19 +3,20 @@ import type { ContentPath, TraverseWidgetContentFn } from "../../_internal/utils
|
|
|
3
3
|
import { type Group, type NestableWidget } from "../../customtypes";
|
|
4
4
|
import { LegacyContentCtx, WithTypes } from "../LegacyContentCtx";
|
|
5
5
|
import { NestableContent } from "./nestable";
|
|
6
|
-
export declare const GroupContentType: "GroupContentType";
|
|
7
|
-
export declare const isGroupContent: (u: unknown) => u is GroupContent;
|
|
8
|
-
export declare const GroupContent: t.Type<GroupContent>;
|
|
9
|
-
export declare type GroupContent = {
|
|
10
|
-
__TYPE__: typeof GroupContentType;
|
|
11
|
-
value: GroupItemContent[];
|
|
12
|
-
};
|
|
13
6
|
export declare const GroupItemContentType: "GroupItemContent";
|
|
7
|
+
export declare const GroupContentType: "GroupContentType";
|
|
14
8
|
export declare const GroupItemContent: t.Type<GroupItemContent>;
|
|
15
9
|
export declare type GroupItemContent = {
|
|
16
10
|
__TYPE__: typeof GroupItemContentType;
|
|
17
11
|
value: [string, NestableContent | GroupContent][];
|
|
18
12
|
};
|
|
13
|
+
export declare const GroupContent: t.Type<GroupContent>;
|
|
14
|
+
export declare type GroupContent = {
|
|
15
|
+
__TYPE__: typeof GroupContentType;
|
|
16
|
+
value: GroupItemContent[];
|
|
17
|
+
};
|
|
18
|
+
export declare const isGroupContent: (u: unknown) => u is GroupContent;
|
|
19
|
+
export declare const GroupContentDefaultValue: GroupContent;
|
|
19
20
|
declare const itemLegacyReader: t.RecordC<t.StringC, t.UnknownC>;
|
|
20
21
|
declare type GroupItemLegacy = t.TypeOf<typeof itemLegacyReader>;
|
|
21
22
|
export declare const GroupItemLegacy: (ctx: LegacyContentCtx) => t.Type<GroupItemContent, WithTypes<{
|
|
@@ -23,7 +24,6 @@ export declare const GroupItemLegacy: (ctx: LegacyContentCtx) => t.Type<GroupIte
|
|
|
23
24
|
}>, unknown>;
|
|
24
25
|
declare type GroupLegacy = Array<GroupItemLegacy>;
|
|
25
26
|
export declare const GroupLegacy: (ctx: LegacyContentCtx) => t.Type<GroupContent, WithTypes<GroupLegacy>, unknown>;
|
|
26
|
-
export declare const GroupContentDefaultValue: GroupContent;
|
|
27
27
|
export declare function groupContentWithDefaultValues(customType: Group, content: GroupContent): GroupContent;
|
|
28
28
|
export declare function traverseGroupContent({ path, key, apiId, model, content, }: {
|
|
29
29
|
path: ContentPath;
|
|
@@ -1,48 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.traverseGroupItemsContent = exports.traverseGroupContent = exports.groupContentWithDefaultValues = exports.
|
|
3
|
+
exports.traverseGroupItemsContent = exports.traverseGroupContent = exports.groupContentWithDefaultValues = exports.GroupLegacy = exports.GroupItemLegacy = exports.GroupContentDefaultValue = exports.isGroupContent = exports.GroupContent = exports.GroupItemContent = exports.GroupContentType = exports.GroupItemContentType = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const fp_ts_1 = require("fp-ts");
|
|
6
6
|
const Either_1 = require("fp-ts/lib/Either");
|
|
7
7
|
const function_1 = require("fp-ts/lib/function");
|
|
8
8
|
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
9
9
|
const customtypes_1 = require("../../customtypes");
|
|
10
|
-
const function_2 = require("../../validators/function");
|
|
11
10
|
const LegacyContentCtx_1 = require("../LegacyContentCtx");
|
|
12
11
|
const utils_1 = require("../utils");
|
|
13
12
|
const nestable_1 = require("./nestable");
|
|
14
13
|
const withDefaultValues_1 = require("./withDefaultValues");
|
|
15
|
-
exports.GroupContentType = "GroupContentType";
|
|
16
|
-
const isGroupContent = (u) => (0, utils_1.hasContentType)(u) && u.__TYPE__ === exports.GroupContentType;
|
|
17
|
-
exports.isGroupContent = isGroupContent;
|
|
18
|
-
const MAX_GROUP_DEPTH = 1;
|
|
19
|
-
const getGroupDepth = (group, depth = 0) => {
|
|
20
|
-
// Stop searching when we're over limit
|
|
21
|
-
if (depth > MAX_GROUP_DEPTH)
|
|
22
|
-
return depth;
|
|
23
|
-
for (const item of group.value) {
|
|
24
|
-
for (const [_key, widget] of item.value) {
|
|
25
|
-
if ((0, exports.isGroupContent)(widget)) {
|
|
26
|
-
depth = Math.max(depth, getGroupDepth(widget, depth + 1));
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return depth;
|
|
31
|
-
};
|
|
32
|
-
exports.GroupContent = (0, function_2.refineType)(t.recursion("GroupContent", () => t.strict({
|
|
33
|
-
__TYPE__: t.literal(exports.GroupContentType),
|
|
34
|
-
value: t.array(exports.GroupItemContent),
|
|
35
|
-
})), "GroupContent", (g) => {
|
|
36
|
-
if (getGroupDepth(g) > MAX_GROUP_DEPTH) {
|
|
37
|
-
throw new Error(`GroupContent is nested too deeply (max ${MAX_GROUP_DEPTH} level)`);
|
|
38
|
-
}
|
|
39
|
-
return true;
|
|
40
|
-
});
|
|
41
14
|
exports.GroupItemContentType = "GroupItemContent";
|
|
15
|
+
exports.GroupContentType = "GroupContentType";
|
|
42
16
|
exports.GroupItemContent = t.recursion("GroupItemContent", () => t.strict({
|
|
43
17
|
__TYPE__: t.literal(exports.GroupItemContentType),
|
|
44
18
|
value: t.array(t.tuple([t.string, t.union([nestable_1.NestableContent, exports.GroupContent])])),
|
|
45
19
|
}));
|
|
20
|
+
exports.GroupContent = t.recursion("GroupContent", () => t.strict({
|
|
21
|
+
__TYPE__: t.literal(exports.GroupContentType),
|
|
22
|
+
value: t.array(exports.GroupItemContent),
|
|
23
|
+
}));
|
|
24
|
+
const isGroupContent = (u) => (0, utils_1.hasContentType)(u) &&
|
|
25
|
+
u.__TYPE__ === exports.GroupContentType &&
|
|
26
|
+
exports.GroupContent.decode(u)._tag === "Right";
|
|
27
|
+
exports.isGroupContent = isGroupContent;
|
|
28
|
+
exports.GroupContentDefaultValue = {
|
|
29
|
+
__TYPE__: exports.GroupContentType,
|
|
30
|
+
value: [],
|
|
31
|
+
};
|
|
46
32
|
const itemLegacyReader = t.record(t.string, t.unknown);
|
|
47
33
|
const GroupItemLegacy = (ctx) => {
|
|
48
34
|
return new t.Type("GroupItemLegacy", (u) => (0, utils_1.hasContentType)(u) && u.__TYPE__ === exports.GroupItemContentType, (u) => {
|
|
@@ -107,10 +93,6 @@ const GroupLegacy = (ctx) => {
|
|
|
107
93
|
});
|
|
108
94
|
};
|
|
109
95
|
exports.GroupLegacy = GroupLegacy;
|
|
110
|
-
exports.GroupContentDefaultValue = {
|
|
111
|
-
__TYPE__: exports.GroupContentType,
|
|
112
|
-
value: [],
|
|
113
|
-
};
|
|
114
96
|
function groupContentWithDefaultValues(customType, content) {
|
|
115
97
|
var _a;
|
|
116
98
|
const fields = (_a = customType.config) === null || _a === void 0 ? void 0 : _a.fields;
|
|
@@ -667,7 +667,7 @@ export declare const WidgetContent: t.UnionC<[t.Type<GroupContent, GroupContent,
|
|
|
667
667
|
}>>]>>;
|
|
668
668
|
repeat: t.ArrayC<t.ExactC<t.TypeC<{
|
|
669
669
|
__TYPE__: t.LiteralC<"GroupItemContent">;
|
|
670
|
-
value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.ExactC<t.TypeC<{
|
|
670
|
+
value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
|
|
671
671
|
type: t.StringC;
|
|
672
672
|
__TYPE__: t.LiteralC<"EmptyContent">;
|
|
673
673
|
}>>, t.ExactC<t.TypeC<{
|
|
@@ -993,7 +993,7 @@ export declare const WidgetContent: t.UnionC<[t.Type<GroupContent, GroupContent,
|
|
|
993
993
|
}>]>>]>>;
|
|
994
994
|
}>>, t.ExactC<t.TypeC<{
|
|
995
995
|
__TYPE__: t.LiteralC<"SeparatorContent">;
|
|
996
|
-
}>>]>]>>;
|
|
996
|
+
}>>]>, t.Type<GroupContent, GroupContent, unknown>]>]>>;
|
|
997
997
|
}>>>;
|
|
998
998
|
}>>, t.ExactC<t.TypeC<{
|
|
999
999
|
__TYPE__: t.LiteralC<"SharedSliceContent">;
|
|
@@ -1327,7 +1327,7 @@ export declare const WidgetContent: t.UnionC<[t.Type<GroupContent, GroupContent,
|
|
|
1327
1327
|
}>>]>, t.Type<GroupContent, GroupContent, unknown>]>>;
|
|
1328
1328
|
items: t.ArrayC<t.ExactC<t.TypeC<{
|
|
1329
1329
|
__TYPE__: t.LiteralC<"GroupItemContent">;
|
|
1330
|
-
value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.ExactC<t.TypeC<{
|
|
1330
|
+
value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
|
|
1331
1331
|
type: t.StringC;
|
|
1332
1332
|
__TYPE__: t.LiteralC<"EmptyContent">;
|
|
1333
1333
|
}>>, t.ExactC<t.TypeC<{
|
|
@@ -1653,7 +1653,7 @@ export declare const WidgetContent: t.UnionC<[t.Type<GroupContent, GroupContent,
|
|
|
1653
1653
|
}>]>>]>>;
|
|
1654
1654
|
}>>, t.ExactC<t.TypeC<{
|
|
1655
1655
|
__TYPE__: t.LiteralC<"SeparatorContent">;
|
|
1656
|
-
}>>]>]>>;
|
|
1656
|
+
}>>]>, t.Type<GroupContent, GroupContent, unknown>]>]>>;
|
|
1657
1657
|
}>>>;
|
|
1658
1658
|
}>>, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
|
|
1659
1659
|
type: t.StringC;
|
|
@@ -3096,7 +3096,7 @@ export declare const isWidgetContent: (u: unknown) => u is {
|
|
|
3096
3096
|
}))[];
|
|
3097
3097
|
} | {
|
|
3098
3098
|
__TYPE__: "SeparatorContent";
|
|
3099
|
-
}][];
|
|
3099
|
+
} | GroupContent][];
|
|
3100
3100
|
}[];
|
|
3101
3101
|
} | {
|
|
3102
3102
|
__TYPE__: "SharedSliceContent";
|
|
@@ -3654,7 +3654,7 @@ export declare const isWidgetContent: (u: unknown) => u is {
|
|
|
3654
3654
|
}))[];
|
|
3655
3655
|
} | {
|
|
3656
3656
|
__TYPE__: "SeparatorContent";
|
|
3657
|
-
}][];
|
|
3657
|
+
} | GroupContent][];
|
|
3658
3658
|
}[];
|
|
3659
3659
|
};
|
|
3660
3660
|
}[];
|
|
@@ -4774,7 +4774,7 @@ export declare const WidgetLegacy: (ctx: LegacyContentCtx) => {
|
|
|
4774
4774
|
}))[];
|
|
4775
4775
|
} | {
|
|
4776
4776
|
__TYPE__: "SeparatorContent";
|
|
4777
|
-
}][];
|
|
4777
|
+
} | GroupContent][];
|
|
4778
4778
|
}[];
|
|
4779
4779
|
} | {
|
|
4780
4780
|
__TYPE__: "SharedSliceContent";
|
|
@@ -5332,7 +5332,7 @@ export declare const WidgetLegacy: (ctx: LegacyContentCtx) => {
|
|
|
5332
5332
|
}))[];
|
|
5333
5333
|
} | {
|
|
5334
5334
|
__TYPE__: "SeparatorContent";
|
|
5335
|
-
}][];
|
|
5335
|
+
} | GroupContent][];
|
|
5336
5336
|
}[];
|
|
5337
5337
|
};
|
|
5338
5338
|
}[];
|
|
@@ -559,7 +559,7 @@ export declare const isCompositeSliceContent: (u: unknown) => u is {
|
|
|
559
559
|
}))[];
|
|
560
560
|
} | {
|
|
561
561
|
__TYPE__: "SeparatorContent";
|
|
562
|
-
}][];
|
|
562
|
+
} | import("../../GroupContent").GroupContent][];
|
|
563
563
|
}[];
|
|
564
564
|
};
|
|
565
565
|
export declare const CompositeSliceLegacy: (ctx: LegacyContentCtx) => t.Type<{
|
|
@@ -1117,7 +1117,7 @@ export declare const CompositeSliceLegacy: (ctx: LegacyContentCtx) => t.Type<{
|
|
|
1117
1117
|
}))[];
|
|
1118
1118
|
} | {
|
|
1119
1119
|
__TYPE__: "SeparatorContent";
|
|
1120
|
-
}][];
|
|
1120
|
+
} | import("../../GroupContent").GroupContent][];
|
|
1121
1121
|
}[];
|
|
1122
1122
|
}, WithTypes<{
|
|
1123
1123
|
repeat?: unknown[];
|
|
@@ -1456,7 +1456,7 @@ export declare const CompositeSliceContent: t.ExactC<t.TypeC<{
|
|
|
1456
1456
|
}>>]>>;
|
|
1457
1457
|
repeat: t.ArrayC<t.ExactC<t.TypeC<{
|
|
1458
1458
|
__TYPE__: t.LiteralC<"GroupItemContent">;
|
|
1459
|
-
value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.ExactC<t.TypeC<{
|
|
1459
|
+
value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
|
|
1460
1460
|
type: t.StringC;
|
|
1461
1461
|
__TYPE__: t.LiteralC<"EmptyContent">;
|
|
1462
1462
|
}>>, t.ExactC<t.TypeC<{
|
|
@@ -1782,7 +1782,7 @@ export declare const CompositeSliceContent: t.ExactC<t.TypeC<{
|
|
|
1782
1782
|
}>]>>]>>;
|
|
1783
1783
|
}>>, t.ExactC<t.TypeC<{
|
|
1784
1784
|
__TYPE__: t.LiteralC<"SeparatorContent">;
|
|
1785
|
-
}>>]>]>>;
|
|
1785
|
+
}>>]>, t.Type<import("../../GroupContent").GroupContent, import("../../GroupContent").GroupContent, unknown>]>]>>;
|
|
1786
1786
|
}>>>;
|
|
1787
1787
|
}>>;
|
|
1788
1788
|
export declare type CompositeSliceContent = t.TypeOf<typeof CompositeSliceContent>;
|
|
@@ -28,7 +28,6 @@ const CompositeSliceLegacy = (ctx) => {
|
|
|
28
28
|
if (!result || (0, Either_1.isLeft)(result))
|
|
29
29
|
return;
|
|
30
30
|
return result.right;
|
|
31
|
-
// We don't support nested groups on composite slice items
|
|
32
31
|
})() || [];
|
|
33
32
|
const nonRepeat = Object.entries(parsedSlice["non-repeat"] || {}).reduce((acc, [key, value]) => {
|
|
34
33
|
const fieldCtx = (0, LegacyContentCtx_1.getFieldCtx)(key, ctx, ["non-repeat"]);
|
|
@@ -128,7 +127,6 @@ function traverseCompositeSliceContent({ path, sliceKey, sliceName, model, conte
|
|
|
128
127
|
path: path.concat([{ key: "repeat", type: "items" }]),
|
|
129
128
|
model: (model === null || model === void 0 ? void 0 : model.type) === "SharedSlice" ? model === null || model === void 0 ? void 0 : model.fields.items : model === null || model === void 0 ? void 0 : model.repeat,
|
|
130
129
|
content: content.widget.repeat,
|
|
131
|
-
// We don't support nested groups on composite slice items
|
|
132
130
|
})(transformWidget);
|
|
133
131
|
return transformSlice({
|
|
134
132
|
key: sliceKey,
|
|
@@ -176,7 +174,6 @@ function migrateCompositeSlice(model, content) {
|
|
|
176
174
|
return acc.concat([[fieldKey, fieldContent]]);
|
|
177
175
|
}, []),
|
|
178
176
|
};
|
|
179
|
-
// We don't support nested groups on composite slice items
|
|
180
177
|
}, []),
|
|
181
178
|
},
|
|
182
179
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
2
|
import type { LegacyContentCtx } from "../../../LegacyContentCtx";
|
|
3
|
+
import { GroupContent } from "../../GroupContent";
|
|
3
4
|
export declare const RepeatableWidgetsLegacy: (ctx: LegacyContentCtx) => t.ArrayC<t.Type<import("../../GroupContent").GroupItemContent, import("../../../LegacyContentCtx").WithTypes<{
|
|
4
5
|
[x: string]: unknown;
|
|
5
6
|
}>, unknown>>;
|
|
6
7
|
export declare const RepeatableWidgets: t.ArrayC<t.ExactC<t.TypeC<{
|
|
7
8
|
__TYPE__: t.LiteralC<"GroupItemContent">;
|
|
8
|
-
value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.ExactC<t.TypeC<{
|
|
9
|
+
value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
|
|
9
10
|
type: t.StringC;
|
|
10
11
|
__TYPE__: t.LiteralC<"EmptyContent">;
|
|
11
12
|
}>>, t.ExactC<t.TypeC<{
|
|
@@ -331,5 +332,5 @@ export declare const RepeatableWidgets: t.ArrayC<t.ExactC<t.TypeC<{
|
|
|
331
332
|
}>]>>]>>;
|
|
332
333
|
}>>, t.ExactC<t.TypeC<{
|
|
333
334
|
__TYPE__: t.LiteralC<"SeparatorContent">;
|
|
334
|
-
}>>]>]>>;
|
|
335
|
+
}>>]>, t.Type<GroupContent, GroupContent, unknown>]>]>>;
|
|
335
336
|
}>>>;
|
|
@@ -9,7 +9,10 @@ const RepeatableWidgetsLegacy = (ctx) => {
|
|
|
9
9
|
return t.array((0, GroupContent_1.GroupItemLegacy)(ctx));
|
|
10
10
|
};
|
|
11
11
|
exports.RepeatableWidgetsLegacy = RepeatableWidgetsLegacy;
|
|
12
|
-
const RepeatableWidget = t.tuple([
|
|
12
|
+
const RepeatableWidget = t.tuple([
|
|
13
|
+
t.string,
|
|
14
|
+
t.union([nestable_1.NestableContent, GroupContent_1.GroupContent]),
|
|
15
|
+
]);
|
|
13
16
|
const RepeatableWidgetsBlock = t.strict({
|
|
14
17
|
__TYPE__: t.literal(GroupContent_1.GroupItemContentType),
|
|
15
18
|
value: t.array(RepeatableWidget),
|
|
@@ -560,7 +560,7 @@ export declare const isSharedSliceContent: (u: unknown) => u is {
|
|
|
560
560
|
}))[];
|
|
561
561
|
} | {
|
|
562
562
|
__TYPE__: "SeparatorContent";
|
|
563
|
-
}][];
|
|
563
|
+
} | import("../../GroupContent").GroupContent][];
|
|
564
564
|
}[];
|
|
565
565
|
};
|
|
566
566
|
export declare const SharedSliceLegacy: (ctx: LegacyContentCtx) => t.Type<{
|
|
@@ -1119,7 +1119,7 @@ export declare const SharedSliceLegacy: (ctx: LegacyContentCtx) => t.Type<{
|
|
|
1119
1119
|
}))[];
|
|
1120
1120
|
} | {
|
|
1121
1121
|
__TYPE__: "SeparatorContent";
|
|
1122
|
-
}][];
|
|
1122
|
+
} | import("../../GroupContent").GroupContent][];
|
|
1123
1123
|
}[];
|
|
1124
1124
|
}, WithTypes<{
|
|
1125
1125
|
variation: string;
|
|
@@ -1460,7 +1460,7 @@ export declare const SharedSliceContent: t.ExactC<t.TypeC<{
|
|
|
1460
1460
|
}>>]>, t.Type<import("../../GroupContent").GroupContent, import("../../GroupContent").GroupContent, unknown>]>>;
|
|
1461
1461
|
items: t.ArrayC<t.ExactC<t.TypeC<{
|
|
1462
1462
|
__TYPE__: t.LiteralC<"GroupItemContent">;
|
|
1463
|
-
value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.ExactC<t.TypeC<{
|
|
1463
|
+
value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
|
|
1464
1464
|
type: t.StringC;
|
|
1465
1465
|
__TYPE__: t.LiteralC<"EmptyContent">;
|
|
1466
1466
|
}>>, t.ExactC<t.TypeC<{
|
|
@@ -1786,7 +1786,7 @@ export declare const SharedSliceContent: t.ExactC<t.TypeC<{
|
|
|
1786
1786
|
}>]>>]>>;
|
|
1787
1787
|
}>>, t.ExactC<t.TypeC<{
|
|
1788
1788
|
__TYPE__: t.LiteralC<"SeparatorContent">;
|
|
1789
|
-
}>>]>]>>;
|
|
1789
|
+
}>>]>, t.Type<import("../../GroupContent").GroupContent, import("../../GroupContent").GroupContent, unknown>]>]>>;
|
|
1790
1790
|
}>>>;
|
|
1791
1791
|
}>>;
|
|
1792
1792
|
export declare type SharedSliceContent = t.TypeOf<typeof SharedSliceContent>;
|
|
@@ -35,7 +35,6 @@ const SharedSliceLegacy = (ctx) => {
|
|
|
35
35
|
if (!result || (0, Either_1.isLeft)(result))
|
|
36
36
|
return;
|
|
37
37
|
return result.right;
|
|
38
|
-
// We don't support nested groups on shared slice items
|
|
39
38
|
})() || [];
|
|
40
39
|
const primary = Object.entries(parsedSlice.primary).reduce((acc, [key, value]) => {
|
|
41
40
|
const FieldCtx = (0, LegacyContentCtx_1.getFieldCtx)(key, ctx, [
|
|
@@ -164,7 +163,6 @@ function traverseSharedSliceContent({ path, sliceKey, sliceName, model, content,
|
|
|
164
163
|
path: path.concat([{ key: "items", type: "items" }]),
|
|
165
164
|
model: model === null || model === void 0 ? void 0 : model.fields.items,
|
|
166
165
|
content: content.widget.items,
|
|
167
|
-
// We don't support nested groups on shared slice items
|
|
168
166
|
})(transformWidget);
|
|
169
167
|
return transformSlice({
|
|
170
168
|
key: sliceKey,
|
|
@@ -830,7 +830,7 @@ export declare const SliceLegacy: (ctx: LegacyContentCtx) => {
|
|
|
830
830
|
}))[];
|
|
831
831
|
} | {
|
|
832
832
|
__TYPE__: "SeparatorContent";
|
|
833
|
-
}][];
|
|
833
|
+
} | import("../..").GroupContent][];
|
|
834
834
|
}[];
|
|
835
835
|
}> | import("fp-ts/lib/Either").Right<{
|
|
836
836
|
__TYPE__: "SharedSliceContent";
|
|
@@ -1388,7 +1388,7 @@ export declare const SliceLegacy: (ctx: LegacyContentCtx) => {
|
|
|
1388
1388
|
}))[];
|
|
1389
1389
|
} | {
|
|
1390
1390
|
__TYPE__: "SeparatorContent";
|
|
1391
|
-
}][];
|
|
1391
|
+
} | import("../..").GroupContent][];
|
|
1392
1392
|
}[];
|
|
1393
1393
|
}> | undefined;
|
|
1394
1394
|
encode: (value: SliceContent) => import("../../../LegacyContentCtx").WithTypes<unknown> | undefined;
|
|
@@ -1724,7 +1724,7 @@ export declare const SliceContent: t.UnionC<[t.ExactC<t.TypeC<{
|
|
|
1724
1724
|
}>>]>>;
|
|
1725
1725
|
repeat: t.ArrayC<t.ExactC<t.TypeC<{
|
|
1726
1726
|
__TYPE__: t.LiteralC<"GroupItemContent">;
|
|
1727
|
-
value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.ExactC<t.TypeC<{
|
|
1727
|
+
value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
|
|
1728
1728
|
type: t.StringC;
|
|
1729
1729
|
__TYPE__: t.LiteralC<"EmptyContent">;
|
|
1730
1730
|
}>>, t.ExactC<t.TypeC<{
|
|
@@ -2050,7 +2050,7 @@ export declare const SliceContent: t.UnionC<[t.ExactC<t.TypeC<{
|
|
|
2050
2050
|
}>]>>]>>;
|
|
2051
2051
|
}>>, t.ExactC<t.TypeC<{
|
|
2052
2052
|
__TYPE__: t.LiteralC<"SeparatorContent">;
|
|
2053
|
-
}>>]>]>>;
|
|
2053
|
+
}>>]>, t.Type<import("../..").GroupContent, import("../..").GroupContent, unknown>]>]>>;
|
|
2054
2054
|
}>>>;
|
|
2055
2055
|
}>>, t.ExactC<t.TypeC<{
|
|
2056
2056
|
__TYPE__: t.LiteralC<"SharedSliceContent">;
|
|
@@ -2384,7 +2384,7 @@ export declare const SliceContent: t.UnionC<[t.ExactC<t.TypeC<{
|
|
|
2384
2384
|
}>>]>, t.Type<import("../..").GroupContent, import("../..").GroupContent, unknown>]>>;
|
|
2385
2385
|
items: t.ArrayC<t.ExactC<t.TypeC<{
|
|
2386
2386
|
__TYPE__: t.LiteralC<"GroupItemContent">;
|
|
2387
|
-
value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.ExactC<t.TypeC<{
|
|
2387
|
+
value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
|
|
2388
2388
|
type: t.StringC;
|
|
2389
2389
|
__TYPE__: t.LiteralC<"EmptyContent">;
|
|
2390
2390
|
}>>, t.ExactC<t.TypeC<{
|
|
@@ -2710,7 +2710,7 @@ export declare const SliceContent: t.UnionC<[t.ExactC<t.TypeC<{
|
|
|
2710
2710
|
}>]>>]>>;
|
|
2711
2711
|
}>>, t.ExactC<t.TypeC<{
|
|
2712
2712
|
__TYPE__: t.LiteralC<"SeparatorContent">;
|
|
2713
|
-
}>>]>]>>;
|
|
2713
|
+
}>>]>, t.Type<import("../..").GroupContent, import("../..").GroupContent, unknown>]>]>>;
|
|
2714
2714
|
}>>>;
|
|
2715
2715
|
}>>, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
|
|
2716
2716
|
type: t.StringC;
|
|
@@ -341,7 +341,7 @@ export declare const SliceItemContent: t.TypeC<{
|
|
|
341
341
|
}>>]>>;
|
|
342
342
|
repeat: t.ArrayC<t.ExactC<t.TypeC<{
|
|
343
343
|
__TYPE__: t.LiteralC<"GroupItemContent">;
|
|
344
|
-
value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.ExactC<t.TypeC<{
|
|
344
|
+
value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
|
|
345
345
|
type: t.StringC;
|
|
346
346
|
__TYPE__: t.LiteralC<"EmptyContent">;
|
|
347
347
|
}>>, t.ExactC<t.TypeC<{
|
|
@@ -667,7 +667,7 @@ export declare const SliceItemContent: t.TypeC<{
|
|
|
667
667
|
}>]>>]>>;
|
|
668
668
|
}>>, t.ExactC<t.TypeC<{
|
|
669
669
|
__TYPE__: t.LiteralC<"SeparatorContent">;
|
|
670
|
-
}>>]>]>>;
|
|
670
|
+
}>>]>, t.Type<import("../GroupContent").GroupContent, import("../GroupContent").GroupContent, unknown>]>]>>;
|
|
671
671
|
}>>>;
|
|
672
672
|
}>>, t.ExactC<t.TypeC<{
|
|
673
673
|
__TYPE__: t.LiteralC<"SharedSliceContent">;
|
|
@@ -1001,7 +1001,7 @@ export declare const SliceItemContent: t.TypeC<{
|
|
|
1001
1001
|
}>>]>, t.Type<import("../GroupContent").GroupContent, import("../GroupContent").GroupContent, unknown>]>>;
|
|
1002
1002
|
items: t.ArrayC<t.ExactC<t.TypeC<{
|
|
1003
1003
|
__TYPE__: t.LiteralC<"GroupItemContent">;
|
|
1004
|
-
value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.ExactC<t.TypeC<{
|
|
1004
|
+
value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
|
|
1005
1005
|
type: t.StringC;
|
|
1006
1006
|
__TYPE__: t.LiteralC<"EmptyContent">;
|
|
1007
1007
|
}>>, t.ExactC<t.TypeC<{
|
|
@@ -1327,7 +1327,7 @@ export declare const SliceItemContent: t.TypeC<{
|
|
|
1327
1327
|
}>]>>]>>;
|
|
1328
1328
|
}>>, t.ExactC<t.TypeC<{
|
|
1329
1329
|
__TYPE__: t.LiteralC<"SeparatorContent">;
|
|
1330
|
-
}>>]>]>>;
|
|
1330
|
+
}>>]>, t.Type<import("../GroupContent").GroupContent, import("../GroupContent").GroupContent, unknown>]>]>>;
|
|
1331
1331
|
}>>>;
|
|
1332
1332
|
}>>, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
|
|
1333
1333
|
type: t.StringC;
|
|
@@ -2504,7 +2504,7 @@ export declare const SlicesItemLegacy: (ctx: LegacyContentCtx) => t.Type<{
|
|
|
2504
2504
|
}))[];
|
|
2505
2505
|
} | {
|
|
2506
2506
|
__TYPE__: "SeparatorContent";
|
|
2507
|
-
}][];
|
|
2507
|
+
} | import("../GroupContent").GroupContent][];
|
|
2508
2508
|
}[];
|
|
2509
2509
|
} | {
|
|
2510
2510
|
__TYPE__: "SharedSliceContent";
|
|
@@ -3062,7 +3062,7 @@ export declare const SlicesItemLegacy: (ctx: LegacyContentCtx) => t.Type<{
|
|
|
3062
3062
|
}))[];
|
|
3063
3063
|
} | {
|
|
3064
3064
|
__TYPE__: "SeparatorContent";
|
|
3065
|
-
}][];
|
|
3065
|
+
} | import("../GroupContent").GroupContent][];
|
|
3066
3066
|
}[];
|
|
3067
3067
|
};
|
|
3068
3068
|
}, WithTypes<{
|
|
@@ -838,7 +838,7 @@ export declare const isSlicesContent: (u: unknown) => u is {
|
|
|
838
838
|
}))[];
|
|
839
839
|
} | {
|
|
840
840
|
__TYPE__: "SeparatorContent";
|
|
841
|
-
}][];
|
|
841
|
+
} | import("..").GroupContent][];
|
|
842
842
|
}[];
|
|
843
843
|
} | {
|
|
844
844
|
__TYPE__: "SharedSliceContent";
|
|
@@ -1396,7 +1396,7 @@ export declare const isSlicesContent: (u: unknown) => u is {
|
|
|
1396
1396
|
}))[];
|
|
1397
1397
|
} | {
|
|
1398
1398
|
__TYPE__: "SeparatorContent";
|
|
1399
|
-
}][];
|
|
1399
|
+
} | import("..").GroupContent][];
|
|
1400
1400
|
}[];
|
|
1401
1401
|
};
|
|
1402
1402
|
}[];
|
|
@@ -2237,7 +2237,7 @@ export declare const SlicesLegacy: (ctx: LegacyContentCtx) => t.Type<{
|
|
|
2237
2237
|
}))[];
|
|
2238
2238
|
} | {
|
|
2239
2239
|
__TYPE__: "SeparatorContent";
|
|
2240
|
-
}][];
|
|
2240
|
+
} | import("..").GroupContent][];
|
|
2241
2241
|
}[];
|
|
2242
2242
|
} | {
|
|
2243
2243
|
__TYPE__: "SharedSliceContent";
|
|
@@ -2795,7 +2795,7 @@ export declare const SlicesLegacy: (ctx: LegacyContentCtx) => t.Type<{
|
|
|
2795
2795
|
}))[];
|
|
2796
2796
|
} | {
|
|
2797
2797
|
__TYPE__: "SeparatorContent";
|
|
2798
|
-
}][];
|
|
2798
|
+
} | import("..").GroupContent][];
|
|
2799
2799
|
}[];
|
|
2800
2800
|
};
|
|
2801
2801
|
}[];
|
|
@@ -3137,7 +3137,7 @@ export declare const SlicesContent: t.TypeC<{
|
|
|
3137
3137
|
}>>]>>;
|
|
3138
3138
|
repeat: t.ArrayC<t.ExactC<t.TypeC<{
|
|
3139
3139
|
__TYPE__: t.LiteralC<"GroupItemContent">;
|
|
3140
|
-
value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.ExactC<t.TypeC<{
|
|
3140
|
+
value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
|
|
3141
3141
|
type: t.StringC;
|
|
3142
3142
|
__TYPE__: t.LiteralC<"EmptyContent">;
|
|
3143
3143
|
}>>, t.ExactC<t.TypeC<{
|
|
@@ -3463,7 +3463,7 @@ export declare const SlicesContent: t.TypeC<{
|
|
|
3463
3463
|
}>]>>]>>;
|
|
3464
3464
|
}>>, t.ExactC<t.TypeC<{
|
|
3465
3465
|
__TYPE__: t.LiteralC<"SeparatorContent">;
|
|
3466
|
-
}>>]>]>>;
|
|
3466
|
+
}>>]>, t.Type<import("..").GroupContent, import("..").GroupContent, unknown>]>]>>;
|
|
3467
3467
|
}>>>;
|
|
3468
3468
|
}>>, t.ExactC<t.TypeC<{
|
|
3469
3469
|
__TYPE__: t.LiteralC<"SharedSliceContent">;
|
|
@@ -3797,7 +3797,7 @@ export declare const SlicesContent: t.TypeC<{
|
|
|
3797
3797
|
}>>]>, t.Type<import("..").GroupContent, import("..").GroupContent, unknown>]>>;
|
|
3798
3798
|
items: t.ArrayC<t.ExactC<t.TypeC<{
|
|
3799
3799
|
__TYPE__: t.LiteralC<"GroupItemContent">;
|
|
3800
|
-
value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.ExactC<t.TypeC<{
|
|
3800
|
+
value: t.ArrayC<t.TupleC<[t.StringC, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
|
|
3801
3801
|
type: t.StringC;
|
|
3802
3802
|
__TYPE__: t.LiteralC<"EmptyContent">;
|
|
3803
3803
|
}>>, t.ExactC<t.TypeC<{
|
|
@@ -4123,7 +4123,7 @@ export declare const SlicesContent: t.TypeC<{
|
|
|
4123
4123
|
}>]>>]>>;
|
|
4124
4124
|
}>>, t.ExactC<t.TypeC<{
|
|
4125
4125
|
__TYPE__: t.LiteralC<"SeparatorContent">;
|
|
4126
|
-
}>>]>]>>;
|
|
4126
|
+
}>>]>, t.Type<import("..").GroupContent, import("..").GroupContent, unknown>]>]>>;
|
|
4127
4127
|
}>>>;
|
|
4128
4128
|
}>>, t.UnionC<[t.UnionC<[t.ExactC<t.TypeC<{
|
|
4129
4129
|
type: t.StringC;
|