@prismicio/types-internal 4.0.0-pr.6.bf36d5e → 4.0.0-pr.6.c2b7195
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/dist/content/codec/richText.js +2 -2
- package/dist/content/codec/richText.js.map +1 -1
- package/dist/content/legacy/richText.js +3 -3
- package/dist/content/legacy/richText.js.map +1 -1
- package/dist/content/richText.d.ts +133 -1
- package/dist/content/richText.d.ts.map +1 -1
- package/dist/content/richText.js +3 -3
- package/dist/content/richText.js.map +1 -1
- package/dist/helpers/traverseContent.d.ts.map +1 -1
- package/dist/helpers/traverseContent.js.map +1 -1
- package/dist/helpers/traverseContentWithModel.d.ts.map +1 -1
- package/dist/helpers/traverseContentWithModel.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/io-ts.d.ts +1790 -1529
- package/dist/io-ts.d.ts.map +1 -1
- package/dist/io-ts.js +3 -2
- package/dist/io-ts.js.map +1 -1
- package/dist/model/customType.d.ts +288 -288
- package/dist/model/group.d.ts +48 -48
- package/dist/model/link.d.ts +16 -16
- package/dist/model/link.d.ts.map +1 -1
- package/dist/model/link.js +7 -7
- package/dist/model/link.js.map +1 -1
- package/dist/model/nestable.d.ts +16 -16
- package/dist/model/section.d.ts +288 -288
- package/dist/model/slice.d.ts +384 -384
- package/dist/model/slices.d.ts +192 -192
- package/dist/model/widget.d.ts +288 -288
- package/dist/zod4.d.ts +1588 -1457
- package/dist/zod4.d.ts.map +1 -1
- package/dist/zod4.js +3 -2
- package/dist/zod4.js.map +1 -1
- package/package.json +1 -1
- package/src/content/codec/richText.ts +10 -6
- package/src/content/legacy/richText.ts +3 -3
- package/src/content/richText.ts +4 -4
- package/src/helpers/traverseContent.ts +7 -13
- package/src/helpers/traverseContentWithModel.ts +5 -9
- package/src/index.ts +1 -1
- package/src/io-ts.ts +2 -1
- package/src/model/link.ts +38 -44
- package/src/zod4.ts +2 -1
- package/dist/content/legacy/image.d.ts +0 -1
package/dist/model/group.d.ts
CHANGED
|
@@ -78,31 +78,31 @@ declare const NestedGroupModelSchema: z.ZodMiniObject<{
|
|
|
78
78
|
useAsTitle: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
79
79
|
placeholder: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
80
80
|
select: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnknown, z.ZodMiniTransform<"media" | "document" | "web" | null, unknown>>>;
|
|
81
|
-
customtypes: z.ZodMiniOptional<z.
|
|
81
|
+
customtypes: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniObject<{
|
|
82
82
|
id: z.ZodMiniString<string>;
|
|
83
|
-
fields: z.
|
|
83
|
+
fields: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
84
84
|
id: z.ZodMiniString<string>;
|
|
85
|
-
fields: z.
|
|
85
|
+
fields: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
86
86
|
id: z.ZodMiniString<string>;
|
|
87
|
-
customtypes: z.
|
|
87
|
+
customtypes: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniObject<{
|
|
88
88
|
id: z.ZodMiniString<string>;
|
|
89
|
-
fields: z.
|
|
89
|
+
fields: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
90
90
|
id: z.ZodMiniString<string>;
|
|
91
|
-
fields: z.
|
|
92
|
-
}, z.core.$strip>, z.ZodMiniString<string>]
|
|
93
|
-
}, z.core.$strip>]
|
|
94
|
-
}, z.core.$strip>, z.ZodMiniString<string>]
|
|
91
|
+
fields: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
92
|
+
}, z.core.$strip>, z.ZodMiniString<string>]>>;
|
|
93
|
+
}, z.core.$strip>]>>;
|
|
94
|
+
}, z.core.$strip>, z.ZodMiniString<string>]>>;
|
|
95
95
|
}, z.core.$strip>, z.ZodMiniObject<{
|
|
96
96
|
id: z.ZodMiniString<string>;
|
|
97
|
-
customtypes: z.
|
|
97
|
+
customtypes: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniObject<{
|
|
98
98
|
id: z.ZodMiniString<string>;
|
|
99
|
-
fields: z.
|
|
99
|
+
fields: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
100
100
|
id: z.ZodMiniString<string>;
|
|
101
|
-
fields: z.
|
|
102
|
-
}, z.core.$strip>, z.ZodMiniString<string>]
|
|
103
|
-
}, z.core.$strip>]
|
|
104
|
-
}, z.core.$strip>, z.ZodMiniString<string>]
|
|
105
|
-
}, z.core.$strip>]
|
|
101
|
+
fields: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
102
|
+
}, z.core.$strip>, z.ZodMiniString<string>]>>;
|
|
103
|
+
}, z.core.$strip>]>>;
|
|
104
|
+
}, z.core.$strip>, z.ZodMiniString<string>]>>;
|
|
105
|
+
}, z.core.$strip>]>>>;
|
|
106
106
|
masks: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniString<string>>, z.ZodMiniString<string>]>, z.ZodMiniTransform<readonly string[], string | string[]>>>;
|
|
107
107
|
tags: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniString<string>>, z.ZodMiniString<string>]>, z.ZodMiniTransform<readonly string[], string | string[]>>>;
|
|
108
108
|
allowTargetBlank: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
@@ -266,31 +266,31 @@ declare const GroupModelSchema: z.ZodMiniObject<{
|
|
|
266
266
|
useAsTitle: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
267
267
|
placeholder: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
268
268
|
select: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnknown, z.ZodMiniTransform<"media" | "document" | "web" | null, unknown>>>;
|
|
269
|
-
customtypes: z.ZodMiniOptional<z.
|
|
269
|
+
customtypes: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniObject<{
|
|
270
270
|
id: z.ZodMiniString<string>;
|
|
271
|
-
fields: z.
|
|
271
|
+
fields: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
272
272
|
id: z.ZodMiniString<string>;
|
|
273
|
-
fields: z.
|
|
273
|
+
fields: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
274
274
|
id: z.ZodMiniString<string>;
|
|
275
|
-
customtypes: z.
|
|
275
|
+
customtypes: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniObject<{
|
|
276
276
|
id: z.ZodMiniString<string>;
|
|
277
|
-
fields: z.
|
|
277
|
+
fields: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
278
278
|
id: z.ZodMiniString<string>;
|
|
279
|
-
fields: z.
|
|
280
|
-
}, z.core.$strip>, z.ZodMiniString<string>]
|
|
281
|
-
}, z.core.$strip>]
|
|
282
|
-
}, z.core.$strip>, z.ZodMiniString<string>]
|
|
279
|
+
fields: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
280
|
+
}, z.core.$strip>, z.ZodMiniString<string>]>>;
|
|
281
|
+
}, z.core.$strip>]>>;
|
|
282
|
+
}, z.core.$strip>, z.ZodMiniString<string>]>>;
|
|
283
283
|
}, z.core.$strip>, z.ZodMiniObject<{
|
|
284
284
|
id: z.ZodMiniString<string>;
|
|
285
|
-
customtypes: z.
|
|
285
|
+
customtypes: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniObject<{
|
|
286
286
|
id: z.ZodMiniString<string>;
|
|
287
|
-
fields: z.
|
|
287
|
+
fields: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
288
288
|
id: z.ZodMiniString<string>;
|
|
289
|
-
fields: z.
|
|
290
|
-
}, z.core.$strip>, z.ZodMiniString<string>]
|
|
291
|
-
}, z.core.$strip>]
|
|
292
|
-
}, z.core.$strip>, z.ZodMiniString<string>]
|
|
293
|
-
}, z.core.$strip>]
|
|
289
|
+
fields: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
290
|
+
}, z.core.$strip>, z.ZodMiniString<string>]>>;
|
|
291
|
+
}, z.core.$strip>]>>;
|
|
292
|
+
}, z.core.$strip>, z.ZodMiniString<string>]>>;
|
|
293
|
+
}, z.core.$strip>]>>>;
|
|
294
294
|
masks: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniString<string>>, z.ZodMiniString<string>]>, z.ZodMiniTransform<readonly string[], string | string[]>>>;
|
|
295
295
|
tags: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniString<string>>, z.ZodMiniString<string>]>, z.ZodMiniTransform<readonly string[], string | string[]>>>;
|
|
296
296
|
allowTargetBlank: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
@@ -450,31 +450,31 @@ declare const GroupModelSchema: z.ZodMiniObject<{
|
|
|
450
450
|
useAsTitle: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
451
451
|
placeholder: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
452
452
|
select: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnknown, z.ZodMiniTransform<"media" | "document" | "web" | null, unknown>>>;
|
|
453
|
-
customtypes: z.ZodMiniOptional<z.
|
|
453
|
+
customtypes: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniObject<{
|
|
454
454
|
id: z.ZodMiniString<string>;
|
|
455
|
-
fields: z.
|
|
455
|
+
fields: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
456
456
|
id: z.ZodMiniString<string>;
|
|
457
|
-
fields: z.
|
|
457
|
+
fields: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
458
458
|
id: z.ZodMiniString<string>;
|
|
459
|
-
customtypes: z.
|
|
459
|
+
customtypes: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniObject<{
|
|
460
460
|
id: z.ZodMiniString<string>;
|
|
461
|
-
fields: z.
|
|
461
|
+
fields: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
462
462
|
id: z.ZodMiniString<string>;
|
|
463
|
-
fields: z.
|
|
464
|
-
}, z.core.$strip>, z.ZodMiniString<string>]
|
|
465
|
-
}, z.core.$strip>]
|
|
466
|
-
}, z.core.$strip>, z.ZodMiniString<string>]
|
|
463
|
+
fields: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
464
|
+
}, z.core.$strip>, z.ZodMiniString<string>]>>;
|
|
465
|
+
}, z.core.$strip>]>>;
|
|
466
|
+
}, z.core.$strip>, z.ZodMiniString<string>]>>;
|
|
467
467
|
}, z.core.$strip>, z.ZodMiniObject<{
|
|
468
468
|
id: z.ZodMiniString<string>;
|
|
469
|
-
customtypes: z.
|
|
469
|
+
customtypes: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniObject<{
|
|
470
470
|
id: z.ZodMiniString<string>;
|
|
471
|
-
fields: z.
|
|
471
|
+
fields: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
472
472
|
id: z.ZodMiniString<string>;
|
|
473
|
-
fields: z.
|
|
474
|
-
}, z.core.$strip>, z.ZodMiniString<string>]
|
|
475
|
-
}, z.core.$strip>]
|
|
476
|
-
}, z.core.$strip>, z.ZodMiniString<string>]
|
|
477
|
-
}, z.core.$strip>]
|
|
473
|
+
fields: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
474
|
+
}, z.core.$strip>, z.ZodMiniString<string>]>>;
|
|
475
|
+
}, z.core.$strip>]>>;
|
|
476
|
+
}, z.core.$strip>, z.ZodMiniString<string>]>>;
|
|
477
|
+
}, z.core.$strip>]>>>;
|
|
478
478
|
masks: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniString<string>>, z.ZodMiniString<string>]>, z.ZodMiniTransform<readonly string[], string | string[]>>>;
|
|
479
479
|
tags: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniString<string>>, z.ZodMiniString<string>]>, z.ZodMiniTransform<readonly string[], string | string[]>>>;
|
|
480
480
|
allowTargetBlank: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
package/dist/model/link.d.ts
CHANGED
|
@@ -9,31 +9,31 @@ declare const LinkModelSchema: z.ZodMiniObject<{
|
|
|
9
9
|
useAsTitle: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
10
10
|
placeholder: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
11
11
|
select: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnknown, z.ZodMiniTransform<"media" | "document" | "web" | null, unknown>>>;
|
|
12
|
-
customtypes: z.ZodMiniOptional<z.
|
|
12
|
+
customtypes: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniObject<{
|
|
13
13
|
id: z.ZodMiniString<string>;
|
|
14
|
-
fields: z.
|
|
14
|
+
fields: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
15
15
|
id: z.ZodMiniString<string>;
|
|
16
|
-
fields: z.
|
|
16
|
+
fields: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
17
17
|
id: z.ZodMiniString<string>;
|
|
18
|
-
customtypes: z.
|
|
18
|
+
customtypes: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniObject<{
|
|
19
19
|
id: z.ZodMiniString<string>;
|
|
20
|
-
fields: z.
|
|
20
|
+
fields: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
21
21
|
id: z.ZodMiniString<string>;
|
|
22
|
-
fields: z.
|
|
23
|
-
}, z.core.$strip>, z.ZodMiniString<string>]
|
|
24
|
-
}, z.core.$strip>]
|
|
25
|
-
}, z.core.$strip>, z.ZodMiniString<string>]
|
|
22
|
+
fields: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
23
|
+
}, z.core.$strip>, z.ZodMiniString<string>]>>;
|
|
24
|
+
}, z.core.$strip>]>>;
|
|
25
|
+
}, z.core.$strip>, z.ZodMiniString<string>]>>;
|
|
26
26
|
}, z.core.$strip>, z.ZodMiniObject<{
|
|
27
27
|
id: z.ZodMiniString<string>;
|
|
28
|
-
customtypes: z.
|
|
28
|
+
customtypes: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniObject<{
|
|
29
29
|
id: z.ZodMiniString<string>;
|
|
30
|
-
fields: z.
|
|
30
|
+
fields: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
31
31
|
id: z.ZodMiniString<string>;
|
|
32
|
-
fields: z.
|
|
33
|
-
}, z.core.$strip>, z.ZodMiniString<string>]
|
|
34
|
-
}, z.core.$strip>]
|
|
35
|
-
}, z.core.$strip>, z.ZodMiniString<string>]
|
|
36
|
-
}, z.core.$strip>]
|
|
32
|
+
fields: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
33
|
+
}, z.core.$strip>, z.ZodMiniString<string>]>>;
|
|
34
|
+
}, z.core.$strip>]>>;
|
|
35
|
+
}, z.core.$strip>, z.ZodMiniString<string>]>>;
|
|
36
|
+
}, z.core.$strip>]>>>;
|
|
37
37
|
masks: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniString<string>>, z.ZodMiniString<string>]>, z.ZodMiniTransform<readonly string[], string | string[]>>>;
|
|
38
38
|
tags: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniString<string>>, z.ZodMiniString<string>]>, z.ZodMiniTransform<readonly string[], string | string[]>>>;
|
|
39
39
|
allowTargetBlank: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
package/dist/model/link.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.d.ts","names":[],"sources":["../../src/model/link.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"link.d.ts","names":[],"sources":["../../src/model/link.ts"],"mappings":";;;cAsIa,eAAA,EAAe,CAAA,CAAA,aAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAMhB,SAAA,GAAY,CAAA,CAAE,KAAA,QAAa,eAAA"}
|
package/dist/model/link.js
CHANGED
|
@@ -2,7 +2,7 @@ import { z } from "zod/mini";
|
|
|
2
2
|
//#region src/model/link.ts
|
|
3
3
|
const MasksArrayStringSchema = z.pipe(z.union([z.array(z.string()), z.string()]), z.transform((val) => typeof val === "string" ? [val] : val));
|
|
4
4
|
const noDuplicateStrings = z.refine((arr) => new Set(arr).size === arr.length, "Fields have duplicates.");
|
|
5
|
-
const CustomTypeLevel2FieldGroupFieldsSchema = z.
|
|
5
|
+
const CustomTypeLevel2FieldGroupFieldsSchema = z.array(z.string()).check(noDuplicateStrings);
|
|
6
6
|
const CustomTypeLevel2FieldSchema = z.union([z.object({
|
|
7
7
|
id: z.string(),
|
|
8
8
|
fields: CustomTypeLevel2FieldGroupFieldsSchema
|
|
@@ -11,18 +11,18 @@ const noDuplicateIds = (items) => {
|
|
|
11
11
|
const arr = items;
|
|
12
12
|
return new Set(arr.map((item) => typeof item === "string" ? item : item.id)).size === arr.length;
|
|
13
13
|
};
|
|
14
|
-
const CustomTypeLevel2FieldsSchema = z.
|
|
14
|
+
const CustomTypeLevel2FieldsSchema = z.array(CustomTypeLevel2FieldSchema).check(z.refine(noDuplicateIds, "Fields have duplicates."));
|
|
15
15
|
const CustomTypeLevel2Schema = z.union([z.string(), z.object({
|
|
16
16
|
id: z.string(),
|
|
17
17
|
fields: CustomTypeLevel2FieldsSchema
|
|
18
18
|
})]);
|
|
19
|
-
const CustomTypesLevel2Schema = z.
|
|
19
|
+
const CustomTypesLevel2Schema = z.array(CustomTypeLevel2Schema).check(z.refine(noDuplicateIds, "Custom types have duplicates."));
|
|
20
20
|
const CustomTypeLevel1FieldCustomTypesSchema = z.object({
|
|
21
21
|
id: z.string(),
|
|
22
22
|
customtypes: CustomTypesLevel2Schema
|
|
23
23
|
});
|
|
24
24
|
const CustomTypeLevel1FieldGroupFieldSchema = z.union([CustomTypeLevel1FieldCustomTypesSchema, z.string()]);
|
|
25
|
-
const CustomTypeLevel1FieldGroupFieldsSchema = z.
|
|
25
|
+
const CustomTypeLevel1FieldGroupFieldsSchema = z.array(CustomTypeLevel1FieldGroupFieldSchema).check(z.refine(noDuplicateIds, "Fields have duplicates."));
|
|
26
26
|
const CustomTypeLevel1FieldSchema = z.union([
|
|
27
27
|
z.object({
|
|
28
28
|
id: z.string(),
|
|
@@ -31,12 +31,12 @@ const CustomTypeLevel1FieldSchema = z.union([
|
|
|
31
31
|
CustomTypeLevel1FieldCustomTypesSchema,
|
|
32
32
|
z.string()
|
|
33
33
|
]);
|
|
34
|
-
const CustomTypeLevel1FieldsSchema = z.
|
|
34
|
+
const CustomTypeLevel1FieldsSchema = z.array(CustomTypeLevel1FieldSchema).check(z.refine(noDuplicateIds, "Fields have duplicates."));
|
|
35
35
|
const CustomTypeLevel1Schema = z.union([z.string(), z.object({
|
|
36
36
|
id: z.string(),
|
|
37
37
|
fields: CustomTypeLevel1FieldsSchema
|
|
38
38
|
})]);
|
|
39
|
-
const CustomTypesSchema = z.
|
|
39
|
+
const CustomTypesSchema = z.array(CustomTypeLevel1Schema).check(({ value, issues }) => {
|
|
40
40
|
const cts = value;
|
|
41
41
|
const push = (message) => issues.push({
|
|
42
42
|
code: "custom",
|
|
@@ -65,7 +65,7 @@ const CustomTypesSchema = z.readonly(z.array(CustomTypeLevel1Schema).check(({ va
|
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
67
|
if (strings.size > 0 && objects.size > 0) push("Cannot mix custom types as strings and objects with fields.");
|
|
68
|
-
})
|
|
68
|
+
});
|
|
69
69
|
const SelectWithFallbackSchema = z.pipe(z.unknown(), z.transform((val) => {
|
|
70
70
|
if (val === "media" || val === "document" || val === "web" || val === null) return val;
|
|
71
71
|
return null;
|
package/dist/model/link.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.js","names":[],"sources":["../../src/model/link.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\n// Accepts string | string[], normalizes string to [string]\nconst MasksArrayStringSchema = z.pipe(\n\tz.union([z.array(z.string()), z.string()]),\n\tz.transform((val): readonly string[] => (typeof val === \"string\" ? [val] : val)),\n)\n\n// --- CustomTypes hierarchy (field selection in content relationship fields) ---\n\n// Level 2\n\nconst noDuplicateStrings = z.refine(\n\t(arr) => new Set(arr as string[]).size === (arr as string[]).length,\n\t\"Fields have duplicates.\",\n)\n\nconst CustomTypeLevel2FieldGroupFieldsSchema = z.
|
|
1
|
+
{"version":3,"file":"link.js","names":[],"sources":["../../src/model/link.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\n// Accepts string | string[], normalizes string to [string]\nconst MasksArrayStringSchema = z.pipe(\n\tz.union([z.array(z.string()), z.string()]),\n\tz.transform((val): readonly string[] => (typeof val === \"string\" ? [val] : val)),\n)\n\n// --- CustomTypes hierarchy (field selection in content relationship fields) ---\n\n// Level 2\n\nconst noDuplicateStrings = z.refine(\n\t(arr) => new Set(arr as string[]).size === (arr as string[]).length,\n\t\"Fields have duplicates.\",\n)\n\nconst CustomTypeLevel2FieldGroupFieldsSchema = z.array(z.string()).check(noDuplicateStrings)\n\nconst CustomTypeLevel2FieldSchema = z.union([\n\tz.object({ id: z.string(), fields: CustomTypeLevel2FieldGroupFieldsSchema }),\n\tz.string(),\n])\n\nconst noDuplicateIds = (items: unknown) => {\n\tconst arr = items as { id: string }[] | string[]\n\tconst ids = new Set(arr.map((item) => (typeof item === \"string\" ? item : item.id)))\n\treturn ids.size === arr.length\n}\n\nconst CustomTypeLevel2FieldsSchema = z\n\t.array(CustomTypeLevel2FieldSchema)\n\t.check(z.refine(noDuplicateIds, \"Fields have duplicates.\"))\n\nconst CustomTypeLevel2Schema = z.union([\n\tz.string(),\n\tz.object({ id: z.string(), fields: CustomTypeLevel2FieldsSchema }),\n])\n\nconst CustomTypesLevel2Schema = z\n\t.array(CustomTypeLevel2Schema)\n\t.check(z.refine(noDuplicateIds, \"Custom types have duplicates.\"))\n\n// Level 1\n\nconst CustomTypeLevel1FieldCustomTypesSchema = z.object({\n\tid: z.string(),\n\tcustomtypes: CustomTypesLevel2Schema,\n})\n\nconst CustomTypeLevel1FieldGroupFieldSchema = z.union([\n\tCustomTypeLevel1FieldCustomTypesSchema,\n\tz.string(),\n])\n\nconst CustomTypeLevel1FieldGroupFieldsSchema = z\n\t.array(CustomTypeLevel1FieldGroupFieldSchema)\n\t.check(z.refine(noDuplicateIds, \"Fields have duplicates.\"))\n\nconst CustomTypeLevel1FieldSchema = z.union([\n\tz.object({\n\t\tid: z.string(),\n\t\tfields: CustomTypeLevel1FieldGroupFieldsSchema,\n\t}),\n\tCustomTypeLevel1FieldCustomTypesSchema,\n\tz.string(),\n])\n\nconst CustomTypeLevel1FieldsSchema = z\n\t.array(CustomTypeLevel1FieldSchema)\n\t.check(z.refine(noDuplicateIds, \"Fields have duplicates.\"))\n\nconst CustomTypeLevel1Schema = z.union([\n\tz.string(),\n\tz.object({ id: z.string(), fields: CustomTypeLevel1FieldsSchema }),\n])\n\nconst CustomTypesSchema = z.array(CustomTypeLevel1Schema).check(({ value, issues }) => {\n\tconst cts = value as ({ id: string } | string)[]\n\tconst push = (message: string) => issues.push({ code: \"custom\", input: value, message })\n\tconst strings = new Set<string>()\n\tconst objects = new Set<string>()\n\tfor (const ct of cts) {\n\t\tlet failed = false\n\t\tif (typeof ct === \"string\") {\n\t\t\tfailed = objects.has(ct)\n\t\t\tstrings.add(ct)\n\t\t} else {\n\t\t\tconst { id } = ct\n\t\t\tfailed = strings.has(id) || objects.has(id)\n\t\t\tobjects.add(id)\n\t\t}\n\t\tif (failed) {\n\t\t\tpush(\"Custom types have duplicates.\")\n\t\t\treturn\n\t\t}\n\t}\n\tif (objects.size > 1) {\n\t\tpush(\"Cannot have multiple custom types with fields selection.\")\n\t\treturn\n\t}\n\tif (strings.size > 0 && objects.size > 0) {\n\t\tpush(\"Cannot mix custom types as strings and objects with fields.\")\n\t}\n})\n\n// --- Select with fallback to null ---\n\nconst SelectWithFallbackSchema = z.pipe(\n\tz.unknown(),\n\tz.transform((val): \"media\" | \"document\" | \"web\" | null => {\n\t\tif (val === \"media\" || val === \"document\" || val === \"web\" || val === null) {\n\t\t\treturn val\n\t\t}\n\t\treturn null\n\t}),\n)\n\n// --- LinkConfig and Link ---\n\nconst LinkConfigSchema = z.object({\n\tlabel: z.nullish(z.string()),\n\tuseAsTitle: z.optional(z.boolean()),\n\tplaceholder: z.optional(z.string()),\n\tselect: z.optional(SelectWithFallbackSchema),\n\tcustomtypes: z.optional(CustomTypesSchema),\n\tmasks: z.optional(MasksArrayStringSchema),\n\ttags: z.optional(MasksArrayStringSchema),\n\tallowTargetBlank: z.optional(z.boolean()),\n\tallowText: z.optional(z.boolean()),\n\trepeat: z.optional(z.boolean()),\n\tvariants: z.optional(z.array(z.string())),\n})\n\nexport const LinkModelSchema = z.object({\n\ttype: z.literal(\"Link\"),\n\tfieldset: z.nullish(z.string()),\n\tconfig: z.optional(Lin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AO,EAAE,QAAQ,EAAE,QAAQ,CAAC;CAC5B,YAAY,EAAE,SAAS,EAAE,SAAS,CAAC;CACnC,aAAa,EAAE,SAAS,EAAE,QAAQ,CAAC;CACnC,QAAQ,EAAE,SAAS,yBAAyB;CAC5C,aAAa,EAAE,SAAS,kBAAkB;CAC1C,OAAO,EAAE,SAAS,uBAAuB;CACzC,MAAM,EAAE,SAAS,uBAAuB;CACxC,kBAAkB,EAAE,SAAS,EAAE,SAAS,CAAC;CACzC,WAAW,EAAE,SAAS,EAAE,SAAS,CAAC;CAClC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC;CAC/B,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;CACzC,CAAC;AAEF,MAAa,kBAAkB,EAAE,OAAO;CACvC,MAAM,EAAE,QAAQ,OAAO;CACvB,UAAU,EAAE,QAAQ,EAAE,QAAQ,CAAC;CAC/B,QAAQ,EAAE,SAAS,iBAAiB;CACpC,CAAC"}
|
package/dist/model/nestable.d.ts
CHANGED
|
@@ -70,31 +70,31 @@ declare const NestableModelSchema: z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
|
70
70
|
useAsTitle: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
71
71
|
placeholder: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
72
72
|
select: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnknown, z.ZodMiniTransform<"media" | "document" | "web" | null, unknown>>>;
|
|
73
|
-
customtypes: z.ZodMiniOptional<z.
|
|
73
|
+
customtypes: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniObject<{
|
|
74
74
|
id: z.ZodMiniString<string>;
|
|
75
|
-
fields: z.
|
|
75
|
+
fields: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
76
76
|
id: z.ZodMiniString<string>;
|
|
77
|
-
fields: z.
|
|
77
|
+
fields: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
78
78
|
id: z.ZodMiniString<string>;
|
|
79
|
-
customtypes: z.
|
|
79
|
+
customtypes: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniObject<{
|
|
80
80
|
id: z.ZodMiniString<string>;
|
|
81
|
-
fields: z.
|
|
81
|
+
fields: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
82
82
|
id: z.ZodMiniString<string>;
|
|
83
|
-
fields: z.
|
|
84
|
-
}, z.core.$strip>, z.ZodMiniString<string>]
|
|
85
|
-
}, z.core.$strip>]
|
|
86
|
-
}, z.core.$strip>, z.ZodMiniString<string>]
|
|
83
|
+
fields: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
84
|
+
}, z.core.$strip>, z.ZodMiniString<string>]>>;
|
|
85
|
+
}, z.core.$strip>]>>;
|
|
86
|
+
}, z.core.$strip>, z.ZodMiniString<string>]>>;
|
|
87
87
|
}, z.core.$strip>, z.ZodMiniObject<{
|
|
88
88
|
id: z.ZodMiniString<string>;
|
|
89
|
-
customtypes: z.
|
|
89
|
+
customtypes: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniObject<{
|
|
90
90
|
id: z.ZodMiniString<string>;
|
|
91
|
-
fields: z.
|
|
91
|
+
fields: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
92
92
|
id: z.ZodMiniString<string>;
|
|
93
|
-
fields: z.
|
|
94
|
-
}, z.core.$strip>, z.ZodMiniString<string>]
|
|
95
|
-
}, z.core.$strip>]
|
|
96
|
-
}, z.core.$strip>, z.ZodMiniString<string>]
|
|
97
|
-
}, z.core.$strip>]
|
|
93
|
+
fields: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
94
|
+
}, z.core.$strip>, z.ZodMiniString<string>]>>;
|
|
95
|
+
}, z.core.$strip>]>>;
|
|
96
|
+
}, z.core.$strip>, z.ZodMiniString<string>]>>;
|
|
97
|
+
}, z.core.$strip>]>>>;
|
|
98
98
|
masks: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniString<string>>, z.ZodMiniString<string>]>, z.ZodMiniTransform<readonly string[], string | string[]>>>;
|
|
99
99
|
tags: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniString<string>>, z.ZodMiniString<string>]>, z.ZodMiniTransform<readonly string[], string | string[]>>>;
|
|
100
100
|
allowTargetBlank: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|