@prismicio/types-internal 2.1.0-alpha.4 → 2.2.0-alpha.1
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/common/HexaColorCode.d.ts +4 -0
- package/lib/common/HexaColorCode.js +7 -0
- package/lib/content/Document.d.ts +1 -1
- package/lib/customtypes/CustomType.d.ts +875 -923
- package/lib/customtypes/CustomType.js +74 -13
- package/lib/customtypes/Section.d.ts +866 -924
- package/lib/customtypes/Section.js +1 -23
- package/lib/customtypes/diff/SharedSlice.d.ts +168 -184
- package/lib/customtypes/diff/Variation.d.ts +167 -183
- package/lib/customtypes/widgets/Group.d.ts +2 -20
- package/lib/customtypes/widgets/Group.js +1 -20
- package/lib/customtypes/widgets/Widget.d.ts +733 -821
- package/lib/customtypes/widgets/nestable/{Link/index.d.ts → Link.d.ts} +2 -19
- package/lib/customtypes/widgets/nestable/{Link/index.js → Link.js} +2 -4
- package/lib/customtypes/widgets/nestable/NestableWidget.d.ts +158 -9
- package/lib/customtypes/widgets/nestable/NestableWidget.js +17 -1
- package/lib/customtypes/widgets/slices/CompositeSlice.d.ts +2 -20
- package/lib/customtypes/widgets/slices/CompositeSlice.js +1 -26
- package/lib/customtypes/widgets/slices/LegacySlice.d.ts +2 -18
- package/lib/customtypes/widgets/slices/SharedSlice.d.ts +4 -38
- package/lib/customtypes/widgets/slices/SharedSlice.js +1 -35
- package/lib/customtypes/widgets/slices/Slices.d.ts +801 -947
- package/lib/customtypes/widgets/slices/Slices.js +1 -34
- package/lib/import/converters/Document.d.ts +3 -0
- package/lib/import/converters/Document.js +17 -0
- package/lib/import/converters/fields/index.d.ts +1 -0
- package/lib/import/converters/fields/index.js +4 -0
- package/lib/import/converters/fields/nestable/Color.d.ts +3 -0
- package/lib/import/converters/fields/nestable/Color.js +10 -0
- package/lib/import/converters/fields/nestable/Date.d.ts +3 -0
- package/lib/import/converters/fields/nestable/Date.js +15 -0
- package/lib/import/converters/fields/nestable/Nestable.d.ts +3 -0
- package/lib/import/converters/fields/nestable/Nestable.js +23 -0
- package/lib/import/converters/fields/nestable/Number.d.ts +3 -0
- package/lib/import/converters/fields/nestable/Number.js +10 -0
- package/lib/import/converters/fields/nestable/Select.d.ts +3 -0
- package/lib/import/converters/fields/nestable/Select.js +10 -0
- package/lib/import/converters/fields/nestable/Text.d.ts +3 -0
- package/lib/import/converters/fields/nestable/Text.js +10 -0
- package/lib/import/converters/fields/nestable/Timestamp.d.ts +3 -0
- package/lib/import/converters/fields/nestable/Timestamp.js +10 -0
- package/lib/import/converters/fields/nestable/index.d.ts +7 -0
- package/lib/import/converters/fields/nestable/index.js +10 -0
- package/lib/import/converters/fields/utils.d.ts +1 -0
- package/lib/import/converters/fields/utils.js +10 -0
- package/lib/import/converters/index.d.ts +2 -0
- package/lib/import/converters/index.js +5 -0
- package/lib/import/index.d.ts +2 -0
- package/lib/import/index.js +5 -0
- package/lib/import/validators/Document.d.ts +6 -0
- package/lib/import/validators/Document.js +72 -0
- package/lib/import/validators/fields/index.d.ts +6 -0
- package/lib/import/validators/fields/index.js +4 -0
- package/lib/import/validators/fields/nestable/Color.d.ts +5 -0
- package/lib/import/validators/fields/nestable/Color.js +15 -0
- package/lib/import/validators/fields/nestable/Date.d.ts +4 -0
- package/lib/import/validators/fields/nestable/Date.js +17 -0
- package/lib/import/validators/fields/nestable/Nestable.d.ts +9 -0
- package/lib/import/validators/fields/nestable/Nestable.js +34 -0
- package/lib/import/validators/fields/nestable/Number.d.ts +10 -0
- package/lib/import/validators/fields/nestable/Number.js +16 -0
- package/lib/import/validators/fields/nestable/Select.d.ts +9 -0
- package/lib/import/validators/fields/nestable/Select.js +17 -0
- package/lib/import/validators/fields/nestable/Text.d.ts +3 -0
- package/lib/import/validators/fields/nestable/Text.js +5 -0
- package/lib/import/validators/fields/nestable/Timestamp.d.ts +5 -0
- package/lib/import/validators/fields/nestable/Timestamp.js +17 -0
- package/lib/import/validators/fields/nestable/index.d.ts +7 -0
- package/lib/import/validators/fields/nestable/index.js +10 -0
- package/lib/import/validators/index.d.ts +2 -0
- package/lib/import/validators/index.js +5 -0
- package/lib/utils/Objects.d.ts +1 -0
- package/lib/utils/Objects.js +9 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +2 -1
- package/lib/validators/BasicTypes.d.ts +3 -0
- package/lib/validators/BasicTypes.js +8 -0
- package/lib/validators/DateFromString.js +2 -1
- package/lib/validators/NullOrT.d.ts +2 -0
- package/lib/validators/NullOrT.js +13 -0
- package/lib/validators/index.d.ts +2 -0
- package/lib/validators/index.js +2 -0
- package/package.json +1 -1
- package/src/common/HexaColorCode.ts +11 -0
- package/src/customtypes/CustomType.ts +97 -24
- package/src/customtypes/Section.ts +1 -28
- package/src/customtypes/widgets/Group.ts +0 -24
- package/src/customtypes/widgets/nestable/{Link/index.ts → Link.ts} +2 -5
- package/src/customtypes/widgets/nestable/NestableWidget.ts +17 -0
- package/src/customtypes/widgets/slices/CompositeSlice.ts +0 -33
- package/src/customtypes/widgets/slices/SharedSlice.ts +0 -47
- package/src/customtypes/widgets/slices/Slices.ts +1 -44
- package/src/import/converters/Document.ts +22 -0
- package/src/import/converters/fields/index.ts +1 -0
- package/src/import/converters/fields/nestable/Color.ts +12 -0
- package/src/import/converters/fields/nestable/Date.ts +18 -0
- package/src/import/converters/fields/nestable/Nestable.ts +33 -0
- package/src/import/converters/fields/nestable/Number.ts +12 -0
- package/src/import/converters/fields/nestable/Select.ts +12 -0
- package/src/import/converters/fields/nestable/Text.ts +12 -0
- package/src/import/converters/fields/nestable/Timestamp.ts +12 -0
- package/src/import/converters/fields/nestable/index.ts +7 -0
- package/src/import/converters/fields/utils.ts +7 -0
- package/src/import/converters/index.ts +2 -0
- package/src/import/index.ts +2 -0
- package/src/import/validators/Document.ts +96 -0
- package/src/import/validators/fields/index.ts +8 -0
- package/src/import/validators/fields/nestable/Color.ts +28 -0
- package/src/import/validators/fields/nestable/Date.ts +35 -0
- package/src/import/validators/fields/nestable/Nestable.ts +41 -0
- package/src/import/validators/fields/nestable/Number.ts +36 -0
- package/src/import/validators/fields/nestable/Select.ts +36 -0
- package/src/import/validators/fields/nestable/Text.ts +7 -0
- package/src/import/validators/fields/nestable/Timestamp.ts +36 -0
- package/src/import/validators/fields/nestable/index.ts +7 -0
- package/src/import/validators/index.ts +2 -0
- package/src/utils/Objects.ts +8 -0
- package/src/utils/index.ts +1 -0
- package/src/validators/BasicTypes.ts +5 -0
- package/src/validators/DateFromString.ts +3 -1
- package/src/validators/NullOrT.ts +18 -0
- package/src/validators/index.ts +2 -0
- package/lib/customtypes/_internal/utils.d.ts +0 -3
- package/lib/customtypes/_internal/utils.js +0 -20
- package/lib/customtypes/widgets/nestable/Link/ContentRelationshipResolver.d.ts +0 -11
- package/lib/customtypes/widgets/nestable/Link/ContentRelationshipResolver.js +0 -15
- package/lib/validators/StringOrT.d.ts +0 -3
- package/lib/validators/StringOrT.js +0 -15
- package/src/customtypes/_internal/utils.ts +0 -25
- package/src/customtypes/widgets/nestable/Link/ContentRelationshipResolver.ts +0 -20
- package/src/validators/StringOrT.ts +0 -21
|
@@ -5,15 +5,7 @@ export declare const LinkConfig: t.ExactC<t.PartialC<{
|
|
|
5
5
|
useAsTitle: t.BooleanC;
|
|
6
6
|
placeholder: t.StringC;
|
|
7
7
|
select: t.UnionC<[t.LiteralC<"media">, t.LiteralC<"document">, t.LiteralC<"web">, t.NullC]>;
|
|
8
|
-
customtypes: t.ReadonlyArrayC<t.
|
|
9
|
-
customTypeId: string;
|
|
10
|
-
} & {
|
|
11
|
-
fetchFields?: boolean;
|
|
12
|
-
}, {
|
|
13
|
-
customTypeId: string;
|
|
14
|
-
} & {
|
|
15
|
-
fetchFields?: boolean;
|
|
16
|
-
}, unknown>>;
|
|
8
|
+
customtypes: t.ReadonlyArrayC<t.StringC>;
|
|
17
9
|
masks: t.Type<readonly string[], object, unknown>;
|
|
18
10
|
tags: t.Type<readonly string[], object, unknown>;
|
|
19
11
|
allowTargetBlank: t.BooleanC;
|
|
@@ -28,19 +20,10 @@ export declare const Link: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
28
20
|
useAsTitle: t.BooleanC;
|
|
29
21
|
placeholder: t.StringC;
|
|
30
22
|
select: t.UnionC<[t.LiteralC<"media">, t.LiteralC<"document">, t.LiteralC<"web">, t.NullC]>;
|
|
31
|
-
customtypes: t.ReadonlyArrayC<t.
|
|
32
|
-
customTypeId: string;
|
|
33
|
-
} & {
|
|
34
|
-
fetchFields?: boolean;
|
|
35
|
-
}, {
|
|
36
|
-
customTypeId: string;
|
|
37
|
-
} & {
|
|
38
|
-
fetchFields?: boolean;
|
|
39
|
-
}, unknown>>;
|
|
23
|
+
customtypes: t.ReadonlyArrayC<t.StringC>;
|
|
40
24
|
masks: t.Type<readonly string[], object, unknown>;
|
|
41
25
|
tags: t.Type<readonly string[], object, unknown>;
|
|
42
26
|
allowTargetBlank: t.BooleanC;
|
|
43
27
|
}>>;
|
|
44
28
|
}>]>>;
|
|
45
29
|
export declare type Link = t.TypeOf<typeof Link>;
|
|
46
|
-
export * from "./ContentRelationshipResolver";
|
|
@@ -5,8 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const Either_1 = require("fp-ts/lib/Either");
|
|
6
6
|
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
7
7
|
const withFallback_1 = require("io-ts-types/lib/withFallback");
|
|
8
|
-
const validators_1 = require("
|
|
9
|
-
const ContentRelationshipResolver_1 = require("./ContentRelationshipResolver");
|
|
8
|
+
const validators_1 = require("../../../validators");
|
|
10
9
|
const arrayString = (entries) => {
|
|
11
10
|
if (entries instanceof Array) {
|
|
12
11
|
const isValidEntries = entries.reduce((acc, l) => acc && typeof l === "string", true);
|
|
@@ -39,7 +38,7 @@ exports.LinkConfig = t.exact(t.partial({
|
|
|
39
38
|
t.literal("web"),
|
|
40
39
|
t.null,
|
|
41
40
|
]), null),
|
|
42
|
-
customtypes:
|
|
41
|
+
customtypes: t.readonlyArray(t.string),
|
|
43
42
|
masks: MasksArrayString,
|
|
44
43
|
tags: MasksArrayString,
|
|
45
44
|
allowTargetBlank: t.boolean,
|
|
@@ -53,4 +52,3 @@ exports.Link = t.exact(t.intersection([
|
|
|
53
52
|
config: exports.LinkConfig,
|
|
54
53
|
}),
|
|
55
54
|
]));
|
|
56
|
-
(0, tslib_1.__exportStar)(require("./ContentRelationshipResolver"), exports);
|
|
@@ -123,15 +123,7 @@ export declare const NestableWidget: t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC
|
|
|
123
123
|
useAsTitle: t.BooleanC;
|
|
124
124
|
placeholder: t.StringC;
|
|
125
125
|
select: t.UnionC<[t.LiteralC<"media">, t.LiteralC<"document">, t.LiteralC<"web">, t.NullC]>;
|
|
126
|
-
customtypes: t.ReadonlyArrayC<t.
|
|
127
|
-
customTypeId: string;
|
|
128
|
-
} & {
|
|
129
|
-
fetchFields?: boolean;
|
|
130
|
-
}, {
|
|
131
|
-
customTypeId: string;
|
|
132
|
-
} & {
|
|
133
|
-
fetchFields?: boolean;
|
|
134
|
-
}, unknown>>;
|
|
126
|
+
customtypes: t.ReadonlyArrayC<t.StringC>;
|
|
135
127
|
masks: t.Type<readonly string[], object, unknown>;
|
|
136
128
|
tags: t.Type<readonly string[], object, unknown>;
|
|
137
129
|
allowTargetBlank: t.BooleanC;
|
|
@@ -164,5 +156,162 @@ export declare const NestableWidget: t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC
|
|
|
164
156
|
catalog: t.StringC;
|
|
165
157
|
}>>;
|
|
166
158
|
}>]>>]>;
|
|
159
|
+
export declare const isNestableWidget: (u: unknown) => u is ({
|
|
160
|
+
type: "Boolean";
|
|
161
|
+
} & {
|
|
162
|
+
config?: {
|
|
163
|
+
label?: string | null | undefined;
|
|
164
|
+
default_value?: boolean;
|
|
165
|
+
placeholder_true?: string;
|
|
166
|
+
placeholder_false?: string;
|
|
167
|
+
};
|
|
168
|
+
}) | ({
|
|
169
|
+
type: "Color";
|
|
170
|
+
} & {
|
|
171
|
+
fieldset?: string | null | undefined;
|
|
172
|
+
config?: {
|
|
173
|
+
label?: string | null | undefined;
|
|
174
|
+
placeholder?: string;
|
|
175
|
+
};
|
|
176
|
+
}) | ({
|
|
177
|
+
type: "Date";
|
|
178
|
+
} & {
|
|
179
|
+
fieldset?: string | null | undefined;
|
|
180
|
+
config?: {
|
|
181
|
+
label?: string | null | undefined;
|
|
182
|
+
placeholder?: string;
|
|
183
|
+
default?: string;
|
|
184
|
+
};
|
|
185
|
+
}) | ({
|
|
186
|
+
type: "Embed";
|
|
187
|
+
} & {
|
|
188
|
+
fieldset?: string | null | undefined;
|
|
189
|
+
config?: {
|
|
190
|
+
label?: string | null | undefined;
|
|
191
|
+
placeholder?: string;
|
|
192
|
+
useAsTitle?: boolean;
|
|
193
|
+
};
|
|
194
|
+
}) | ({
|
|
195
|
+
type: "GeoPoint";
|
|
196
|
+
} & {
|
|
197
|
+
fieldset?: string | null | undefined;
|
|
198
|
+
config?: {
|
|
199
|
+
label?: string | null | undefined;
|
|
200
|
+
};
|
|
201
|
+
}) | ({
|
|
202
|
+
type: "Image";
|
|
203
|
+
} & {
|
|
204
|
+
fieldset?: string | null | undefined;
|
|
205
|
+
config?: {
|
|
206
|
+
label?: string | null | undefined;
|
|
207
|
+
placeholder?: string;
|
|
208
|
+
constraint?: {
|
|
209
|
+
width?: number | null;
|
|
210
|
+
height?: number | null;
|
|
211
|
+
};
|
|
212
|
+
thumbnails?: readonly ({
|
|
213
|
+
name: string;
|
|
214
|
+
} & {
|
|
215
|
+
width?: number | null;
|
|
216
|
+
height?: number | null;
|
|
217
|
+
})[];
|
|
218
|
+
};
|
|
219
|
+
}) | ({
|
|
220
|
+
type: "IntegrationFields";
|
|
221
|
+
} & {
|
|
222
|
+
fieldset?: string | null | undefined;
|
|
223
|
+
config?: {
|
|
224
|
+
label?: string | null | undefined;
|
|
225
|
+
placeholder?: string;
|
|
226
|
+
catalog?: string;
|
|
227
|
+
};
|
|
228
|
+
}) | ({
|
|
229
|
+
type: "Link";
|
|
230
|
+
} & {
|
|
231
|
+
fieldset?: string | null | undefined;
|
|
232
|
+
config?: {
|
|
233
|
+
label?: string | null | undefined;
|
|
234
|
+
useAsTitle?: boolean;
|
|
235
|
+
placeholder?: string;
|
|
236
|
+
select?: "media" | "document" | "web" | null;
|
|
237
|
+
customtypes?: readonly string[];
|
|
238
|
+
masks?: readonly string[];
|
|
239
|
+
tags?: readonly string[];
|
|
240
|
+
allowTargetBlank?: boolean;
|
|
241
|
+
};
|
|
242
|
+
}) | ({
|
|
243
|
+
type: "Number";
|
|
244
|
+
} & {
|
|
245
|
+
fieldset?: string | null | undefined;
|
|
246
|
+
config?: {
|
|
247
|
+
label?: string | null | undefined;
|
|
248
|
+
placeholder?: string;
|
|
249
|
+
min?: number;
|
|
250
|
+
max?: number;
|
|
251
|
+
step?: number;
|
|
252
|
+
};
|
|
253
|
+
}) | ({
|
|
254
|
+
type: "Range";
|
|
255
|
+
} & {
|
|
256
|
+
fieldset?: string | null | undefined;
|
|
257
|
+
config?: {
|
|
258
|
+
label?: string | null | undefined;
|
|
259
|
+
placeholder?: string;
|
|
260
|
+
min?: number;
|
|
261
|
+
max?: number;
|
|
262
|
+
step?: number;
|
|
263
|
+
};
|
|
264
|
+
}) | ({
|
|
265
|
+
type: "StructuredText";
|
|
266
|
+
} & {
|
|
267
|
+
fieldset?: string | null | undefined;
|
|
268
|
+
config?: {
|
|
269
|
+
label?: string | null | undefined;
|
|
270
|
+
placeholder?: string;
|
|
271
|
+
useAsTitle?: boolean;
|
|
272
|
+
single?: string;
|
|
273
|
+
multi?: string;
|
|
274
|
+
imageConstraint?: {
|
|
275
|
+
width?: number | null;
|
|
276
|
+
height?: number | null;
|
|
277
|
+
};
|
|
278
|
+
labels?: readonly string[];
|
|
279
|
+
allowTargetBlank?: boolean;
|
|
280
|
+
};
|
|
281
|
+
}) | ({
|
|
282
|
+
type: "Select";
|
|
283
|
+
} & {
|
|
284
|
+
fieldset?: string | null | undefined;
|
|
285
|
+
config?: {
|
|
286
|
+
label?: string | null | undefined;
|
|
287
|
+
placeholder?: string;
|
|
288
|
+
default_value?: string;
|
|
289
|
+
options?: readonly string[];
|
|
290
|
+
};
|
|
291
|
+
}) | ({
|
|
292
|
+
type: "Separator";
|
|
293
|
+
} & {
|
|
294
|
+
config?: {
|
|
295
|
+
label?: string | null | undefined;
|
|
296
|
+
};
|
|
297
|
+
}) | ({
|
|
298
|
+
type: "Text";
|
|
299
|
+
} & {
|
|
300
|
+
fieldset?: string | null | undefined;
|
|
301
|
+
config?: {
|
|
302
|
+
label?: string | null | undefined;
|
|
303
|
+
useAsTitle?: boolean;
|
|
304
|
+
placeholder?: string;
|
|
305
|
+
};
|
|
306
|
+
}) | ({
|
|
307
|
+
type: "Timestamp";
|
|
308
|
+
} & {
|
|
309
|
+
fieldset?: string | null | undefined;
|
|
310
|
+
config?: {
|
|
311
|
+
label?: string | null | undefined;
|
|
312
|
+
placeholder?: string;
|
|
313
|
+
default?: string;
|
|
314
|
+
};
|
|
315
|
+
});
|
|
167
316
|
export declare type NestableWidget = t.TypeOf<typeof NestableWidget>;
|
|
168
317
|
export declare type NestableFieldTypes = NestableWidget["type"];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NestableWidget = void 0;
|
|
3
|
+
exports.isNestableWidget = exports.NestableWidget = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
6
6
|
const BooleanField_1 = require("./BooleanField");
|
|
@@ -35,3 +35,19 @@ exports.NestableWidget = t.union([
|
|
|
35
35
|
Image_1.Image,
|
|
36
36
|
IntegrationField_1.IntegrationField,
|
|
37
37
|
]);
|
|
38
|
+
const isNestableWidget = (u) => Color_1.Color.is(u) ||
|
|
39
|
+
BooleanField_1.BooleanField.is(u) ||
|
|
40
|
+
Embed_1.Embed.is(u) ||
|
|
41
|
+
GeoPoint_1.GeoPoint.is(u) ||
|
|
42
|
+
Date_1.Date.is(u) ||
|
|
43
|
+
Number_1.Number.is(u) ||
|
|
44
|
+
Range_1.Range.is(u) ||
|
|
45
|
+
RichText_1.RichText.is(u) ||
|
|
46
|
+
Select_1.Select.is(u) ||
|
|
47
|
+
Separator_1.Separator.is(u) ||
|
|
48
|
+
Text_1.Text.is(u) ||
|
|
49
|
+
Timestamp_1.Timestamp.is(u) ||
|
|
50
|
+
Link_1.Link.is(u) ||
|
|
51
|
+
Image_1.Image.is(u) ||
|
|
52
|
+
IntegrationField_1.IntegrationField.is(u);
|
|
53
|
+
exports.isNestableWidget = isNestableWidget;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
|
-
import { TraverseFn } from "../../_internal/utils";
|
|
3
2
|
export declare const CompositeSliceType = "Slice";
|
|
4
3
|
export declare const CompositeSliceConfig: t.ExactC<t.PartialC<{
|
|
5
4
|
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
@@ -136,15 +135,7 @@ export declare const CompositeSlice: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
136
135
|
useAsTitle: t.BooleanC;
|
|
137
136
|
placeholder: t.StringC;
|
|
138
137
|
select: t.UnionC<[t.LiteralC<"media">, t.LiteralC<"document">, t.LiteralC<"web">, t.NullC]>;
|
|
139
|
-
customtypes: t.ReadonlyArrayC<t.
|
|
140
|
-
customTypeId: string;
|
|
141
|
-
} & {
|
|
142
|
-
fetchFields?: boolean;
|
|
143
|
-
}, {
|
|
144
|
-
customTypeId: string;
|
|
145
|
-
} & {
|
|
146
|
-
fetchFields?: boolean;
|
|
147
|
-
}, unknown>>;
|
|
138
|
+
customtypes: t.ReadonlyArrayC<t.StringC>;
|
|
148
139
|
masks: t.Type<readonly string[], object, unknown>;
|
|
149
140
|
tags: t.Type<readonly string[], object, unknown>;
|
|
150
141
|
allowTargetBlank: t.BooleanC;
|
|
@@ -301,15 +292,7 @@ export declare const CompositeSlice: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
301
292
|
useAsTitle: t.BooleanC;
|
|
302
293
|
placeholder: t.StringC;
|
|
303
294
|
select: t.UnionC<[t.LiteralC<"media">, t.LiteralC<"document">, t.LiteralC<"web">, t.NullC]>;
|
|
304
|
-
customtypes: t.ReadonlyArrayC<t.
|
|
305
|
-
customTypeId: string;
|
|
306
|
-
} & {
|
|
307
|
-
fetchFields?: boolean;
|
|
308
|
-
}, {
|
|
309
|
-
customTypeId: string;
|
|
310
|
-
} & {
|
|
311
|
-
fetchFields?: boolean;
|
|
312
|
-
}, unknown>>;
|
|
295
|
+
customtypes: t.ReadonlyArrayC<t.StringC>;
|
|
313
296
|
masks: t.Type<readonly string[], object, unknown>;
|
|
314
297
|
tags: t.Type<readonly string[], object, unknown>;
|
|
315
298
|
allowTargetBlank: t.BooleanC;
|
|
@@ -347,4 +330,3 @@ export declare const CompositeSlice: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
347
330
|
}>>;
|
|
348
331
|
}>]>>;
|
|
349
332
|
export declare type CompositeSlice = t.TypeOf<typeof CompositeSlice>;
|
|
350
|
-
export declare function traverseCompositeSlice(path: ReadonlyArray<string>, slice: CompositeSlice, f: TraverseFn): CompositeSlice;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.CompositeSlice = exports.CompositeSliceConfig = exports.CompositeSliceType = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
6
6
|
const common_1 = require("../../../common");
|
|
7
7
|
const validators_1 = require("../../../validators");
|
|
8
|
-
const utils_1 = require("../../_internal/utils");
|
|
9
8
|
const NestableWidget_1 = require("../nestable/NestableWidget");
|
|
10
9
|
exports.CompositeSliceType = "Slice";
|
|
11
10
|
exports.CompositeSliceConfig = t.exact(t.partial({
|
|
@@ -25,27 +24,3 @@ exports.CompositeSlice = t.exact(t.intersection([
|
|
|
25
24
|
config: exports.CompositeSliceConfig,
|
|
26
25
|
}),
|
|
27
26
|
]));
|
|
28
|
-
function traverseCompositeSlice(path, slice, f) {
|
|
29
|
-
const primaryEntries = slice["non-repeat"] &&
|
|
30
|
-
Object.entries(slice["non-repeat"]).map(([widgetKey, widgetValue]) => {
|
|
31
|
-
return [
|
|
32
|
-
widgetKey,
|
|
33
|
-
f(widgetValue, widgetKey, path.concat(["non-repeat", widgetKey])),
|
|
34
|
-
];
|
|
35
|
-
});
|
|
36
|
-
const itemsEntries = slice.repeat &&
|
|
37
|
-
Object.entries(slice.repeat).map(([widgetKey, widgetValue]) => {
|
|
38
|
-
return [
|
|
39
|
-
widgetKey,
|
|
40
|
-
f(widgetValue, widgetKey, path.concat(["repeat", widgetKey])),
|
|
41
|
-
];
|
|
42
|
-
});
|
|
43
|
-
return {
|
|
44
|
-
...slice,
|
|
45
|
-
...(primaryEntries
|
|
46
|
-
? { "non-repeat": (0, utils_1.fromEntriesWithValue)(primaryEntries) }
|
|
47
|
-
: {}),
|
|
48
|
-
...(itemsEntries ? { repeat: (0, utils_1.fromEntriesWithValue)(itemsEntries) } : {}),
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
exports.traverseCompositeSlice = traverseCompositeSlice;
|
|
@@ -123,15 +123,7 @@ export declare const LegacySlice: t.UnionC<[t.UnionC<[t.ExactC<t.IntersectionC<[
|
|
|
123
123
|
useAsTitle: t.BooleanC;
|
|
124
124
|
placeholder: t.StringC;
|
|
125
125
|
select: t.UnionC<[t.LiteralC<"media">, t.LiteralC<"document">, t.LiteralC<"web">, t.NullC]>;
|
|
126
|
-
customtypes: t.ReadonlyArrayC<t.
|
|
127
|
-
customTypeId: string;
|
|
128
|
-
} & {
|
|
129
|
-
fetchFields?: boolean;
|
|
130
|
-
}, {
|
|
131
|
-
customTypeId: string;
|
|
132
|
-
} & {
|
|
133
|
-
fetchFields?: boolean;
|
|
134
|
-
}, unknown>>;
|
|
126
|
+
customtypes: t.ReadonlyArrayC<t.StringC>;
|
|
135
127
|
masks: t.Type<readonly string[], object, unknown>;
|
|
136
128
|
tags: t.Type<readonly string[], object, unknown>;
|
|
137
129
|
allowTargetBlank: t.BooleanC;
|
|
@@ -296,15 +288,7 @@ export declare const LegacySlice: t.UnionC<[t.UnionC<[t.ExactC<t.IntersectionC<[
|
|
|
296
288
|
useAsTitle: t.BooleanC;
|
|
297
289
|
placeholder: t.StringC;
|
|
298
290
|
select: t.UnionC<[t.LiteralC<"media">, t.LiteralC<"document">, t.LiteralC<"web">, t.NullC]>;
|
|
299
|
-
customtypes: t.ReadonlyArrayC<t.
|
|
300
|
-
customTypeId: string;
|
|
301
|
-
} & {
|
|
302
|
-
fetchFields?: boolean;
|
|
303
|
-
}, {
|
|
304
|
-
customTypeId: string;
|
|
305
|
-
} & {
|
|
306
|
-
fetchFields?: boolean;
|
|
307
|
-
}, unknown>>;
|
|
291
|
+
customtypes: t.ReadonlyArrayC<t.StringC>;
|
|
308
292
|
masks: t.Type<readonly string[], object, unknown>;
|
|
309
293
|
tags: t.Type<readonly string[], object, unknown>;
|
|
310
294
|
allowTargetBlank: t.BooleanC;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
|
-
import { TraverseFn } from "../../_internal/utils";
|
|
3
2
|
export declare const Variation: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
4
3
|
id: t.StringC;
|
|
5
4
|
name: t.StringC;
|
|
@@ -133,15 +132,7 @@ export declare const Variation: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
133
132
|
useAsTitle: t.BooleanC;
|
|
134
133
|
placeholder: t.StringC;
|
|
135
134
|
select: t.UnionC<[t.LiteralC<"media">, t.LiteralC<"document">, t.LiteralC<"web">, t.NullC]>;
|
|
136
|
-
customtypes: t.ReadonlyArrayC<t.
|
|
137
|
-
customTypeId: string;
|
|
138
|
-
} & {
|
|
139
|
-
fetchFields?: boolean;
|
|
140
|
-
}, {
|
|
141
|
-
customTypeId: string;
|
|
142
|
-
} & {
|
|
143
|
-
fetchFields?: boolean;
|
|
144
|
-
}, unknown>>;
|
|
135
|
+
customtypes: t.ReadonlyArrayC<t.StringC>;
|
|
145
136
|
masks: t.Type<readonly string[], object, unknown>;
|
|
146
137
|
tags: t.Type<readonly string[], object, unknown>;
|
|
147
138
|
allowTargetBlank: t.BooleanC;
|
|
@@ -298,15 +289,7 @@ export declare const Variation: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
298
289
|
useAsTitle: t.BooleanC;
|
|
299
290
|
placeholder: t.StringC;
|
|
300
291
|
select: t.UnionC<[t.LiteralC<"media">, t.LiteralC<"document">, t.LiteralC<"web">, t.NullC]>;
|
|
301
|
-
customtypes: t.ReadonlyArrayC<t.
|
|
302
|
-
customTypeId: string;
|
|
303
|
-
} & {
|
|
304
|
-
fetchFields?: boolean;
|
|
305
|
-
}, {
|
|
306
|
-
customTypeId: string;
|
|
307
|
-
} & {
|
|
308
|
-
fetchFields?: boolean;
|
|
309
|
-
}, unknown>>;
|
|
292
|
+
customtypes: t.ReadonlyArrayC<t.StringC>;
|
|
310
293
|
masks: t.Type<readonly string[], object, unknown>;
|
|
311
294
|
tags: t.Type<readonly string[], object, unknown>;
|
|
312
295
|
allowTargetBlank: t.BooleanC;
|
|
@@ -479,15 +462,7 @@ export declare const SharedSlice: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
479
462
|
useAsTitle: t.BooleanC;
|
|
480
463
|
placeholder: t.StringC;
|
|
481
464
|
select: t.UnionC<[t.LiteralC<"media">, t.LiteralC<"document">, t.LiteralC<"web">, t.NullC]>;
|
|
482
|
-
customtypes: t.ReadonlyArrayC<t.
|
|
483
|
-
customTypeId: string;
|
|
484
|
-
} & {
|
|
485
|
-
fetchFields?: boolean;
|
|
486
|
-
}, {
|
|
487
|
-
customTypeId: string;
|
|
488
|
-
} & {
|
|
489
|
-
fetchFields?: boolean;
|
|
490
|
-
}, unknown>>;
|
|
465
|
+
customtypes: t.ReadonlyArrayC<t.StringC>;
|
|
491
466
|
masks: t.Type<readonly string[], object, unknown>;
|
|
492
467
|
tags: t.Type<readonly string[], object, unknown>;
|
|
493
468
|
allowTargetBlank: t.BooleanC;
|
|
@@ -644,15 +619,7 @@ export declare const SharedSlice: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
644
619
|
useAsTitle: t.BooleanC;
|
|
645
620
|
placeholder: t.StringC;
|
|
646
621
|
select: t.UnionC<[t.LiteralC<"media">, t.LiteralC<"document">, t.LiteralC<"web">, t.NullC]>;
|
|
647
|
-
customtypes: t.ReadonlyArrayC<t.
|
|
648
|
-
customTypeId: string;
|
|
649
|
-
} & {
|
|
650
|
-
fetchFields?: boolean;
|
|
651
|
-
}, {
|
|
652
|
-
customTypeId: string;
|
|
653
|
-
} & {
|
|
654
|
-
fetchFields?: boolean;
|
|
655
|
-
}, unknown>>;
|
|
622
|
+
customtypes: t.ReadonlyArrayC<t.StringC>;
|
|
656
623
|
masks: t.Type<readonly string[], object, unknown>;
|
|
657
624
|
tags: t.Type<readonly string[], object, unknown>;
|
|
658
625
|
allowTargetBlank: t.BooleanC;
|
|
@@ -690,4 +657,3 @@ export declare const SharedSlice: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
690
657
|
description: t.StringC;
|
|
691
658
|
}>]>>;
|
|
692
659
|
export declare type SharedSlice = t.TypeOf<typeof SharedSlice>;
|
|
693
|
-
export declare function traverseSharedSlice(slice: SharedSlice, f: TraverseFn): SharedSlice;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.SharedSlice = exports.SharedSliceType = exports.Variation = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
6
6
|
const withFallback_1 = require("io-ts-types/lib/withFallback");
|
|
7
7
|
const common_1 = require("../../../common");
|
|
8
|
-
const utils_1 = require("../../_internal/utils");
|
|
9
8
|
const NestableWidget_1 = require("../nestable/NestableWidget");
|
|
10
9
|
const IMAGE_PLACEHOLDER_URL = "https://images.prismic.io/slice-machine/621a5ec4-0387-4bc5-9860-2dd46cbc07cd_default_ss.png?auto=compress,format";
|
|
11
10
|
exports.Variation = t.exact(t.intersection([
|
|
@@ -35,36 +34,3 @@ exports.SharedSlice = t.exact(t.intersection([
|
|
|
35
34
|
description: t.string,
|
|
36
35
|
}),
|
|
37
36
|
]));
|
|
38
|
-
function traverseVariation(path, variation, f) {
|
|
39
|
-
const primaryEntries = variation.primary &&
|
|
40
|
-
Object.entries(variation.primary).map(([widgetKey, widgetValue]) => {
|
|
41
|
-
return [
|
|
42
|
-
widgetKey,
|
|
43
|
-
f(widgetValue, widgetKey, path.concat(["primary", widgetKey])),
|
|
44
|
-
];
|
|
45
|
-
});
|
|
46
|
-
const itemsEntries = variation.items &&
|
|
47
|
-
Object.entries(variation.items).map(([widgetKey, widgetValue]) => {
|
|
48
|
-
return [
|
|
49
|
-
widgetKey,
|
|
50
|
-
f(widgetValue, widgetKey, path.concat(["items", widgetKey])),
|
|
51
|
-
];
|
|
52
|
-
});
|
|
53
|
-
return {
|
|
54
|
-
...variation,
|
|
55
|
-
...(primaryEntries
|
|
56
|
-
? { primary: (0, utils_1.fromEntriesWithValue)(primaryEntries) }
|
|
57
|
-
: {}),
|
|
58
|
-
...(itemsEntries ? { items: (0, utils_1.fromEntriesWithValue)(itemsEntries) } : {}),
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
function traverseSharedSlice(slice, f) {
|
|
62
|
-
const variations = slice.variations.reduce((acc, v) => {
|
|
63
|
-
return acc.concat(traverseVariation([v.id], v, f));
|
|
64
|
-
}, []);
|
|
65
|
-
return {
|
|
66
|
-
...slice,
|
|
67
|
-
variations,
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
exports.traverseSharedSlice = traverseSharedSlice;
|