@prismicio/types-internal 4.0.0-pr.6.eb53f11 → 4.0.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/dist/content/document.d.ts +2 -3019
- package/dist/content/document.d.ts.map +1 -1
- package/dist/content/field.d.ts +1 -30
- package/dist/content/field.d.ts.map +1 -1
- package/dist/content/field.js.map +1 -1
- package/dist/content/group.d.ts +2 -1
- package/dist/content/group.d.ts.map +1 -1
- package/dist/content/group.js.map +1 -1
- package/dist/content/legacy/group.d.ts +9 -0
- package/dist/content/legacy/group.d.ts.map +1 -0
- package/dist/content/legacy/group.js.map +1 -1
- package/dist/content/legacy/link.d.ts +41 -0
- package/dist/content/legacy/link.d.ts.map +1 -0
- package/dist/content/legacy/link.js.map +1 -1
- package/dist/content/legacy/nestable.js.map +1 -1
- package/dist/content/legacy/repeatable.js +2 -8
- package/dist/content/legacy/repeatable.js.map +1 -1
- package/dist/content/legacy/richText.d.ts +109 -0
- package/dist/content/legacy/richText.d.ts.map +1 -0
- package/dist/content/legacy/richText.js.map +1 -1
- package/dist/content/legacy/slice.js +2 -3
- package/dist/content/legacy/slice.js.map +1 -1
- package/dist/content/link.d.ts +74 -99
- package/dist/content/link.d.ts.map +1 -1
- package/dist/content/link.js +2 -2
- package/dist/content/link.js.map +1 -1
- package/dist/content/nestable.d.ts +13 -749
- package/dist/content/nestable.d.ts.map +1 -1
- package/dist/content/nestable.js +1 -0
- package/dist/content/nestable.js.map +1 -1
- package/dist/content/repeatable.d.ts +3 -98
- package/dist/content/repeatable.d.ts.map +1 -1
- package/dist/content/richText.d.ts +20 -248
- package/dist/content/richText.d.ts.map +1 -1
- package/dist/content/richText.js.map +1 -1
- package/dist/content/slice.d.ts +6 -4509
- package/dist/content/slice.d.ts.map +1 -1
- package/dist/content/slice.js.map +1 -1
- package/dist/content/slices.d.ts +8 -6765
- package/dist/content/slices.d.ts.map +1 -1
- package/dist/content/table.d.ts +2 -134
- package/dist/content/table.d.ts.map +1 -1
- package/dist/content/widget.d.ts +5 -3020
- package/dist/content/widget.d.ts.map +1 -1
- package/dist/content/widget.js.map +1 -1
- package/dist/helpers/contentPath.js +1 -1
- package/dist/helpers/customTypeModel.d.ts +1 -1
- package/dist/helpers/customTypeModel.js +1 -1
- package/dist/helpers/documentContent.d.ts +3 -2
- package/dist/helpers/documentContent.d.ts.map +1 -1
- package/dist/helpers/documentContent.js +14 -1
- package/dist/helpers/documentContent.js.map +1 -1
- package/dist/helpers/sliceContent.d.ts +12 -0
- package/dist/helpers/sliceContent.d.ts.map +1 -0
- package/dist/helpers/sliceContent.js +60 -0
- package/dist/helpers/sliceContent.js.map +1 -0
- package/dist/helpers/traverseContent.d.ts +15 -16
- package/dist/helpers/traverseContent.d.ts.map +1 -1
- package/dist/helpers/traverseContent.js +51 -19
- package/dist/helpers/traverseContent.js.map +1 -1
- package/dist/helpers/traverseContentWithModel.d.ts +14 -15
- package/dist/helpers/traverseContentWithModel.d.ts.map +1 -1
- package/dist/helpers/traverseContentWithModel.js +61 -35
- package/dist/helpers/traverseContentWithModel.js.map +1 -1
- package/dist/index.d.ts +25 -24
- package/dist/index.js +3 -1
- package/dist/io-ts.d.ts +3048 -71012
- package/dist/io-ts.d.ts.map +1 -1
- package/dist/io-ts.js +125 -124
- package/dist/io-ts.js.map +1 -1
- package/dist/model/customType.d.ts +3 -3329
- package/dist/model/customType.d.ts.map +1 -1
- package/dist/model/group.d.ts +375 -376
- package/dist/model/group.d.ts.map +1 -1
- package/dist/model/group.js.map +1 -1
- package/dist/model/image.d.ts +4 -4
- package/dist/model/image.js.map +1 -1
- package/dist/model/link.d.ts +2 -2
- package/dist/model/link.js.map +1 -1
- package/dist/model/nestable.d.ts +17 -178
- package/dist/model/nestable.d.ts.map +1 -1
- package/dist/model/nestable.js +3 -3
- package/dist/model/nestable.js.map +1 -1
- package/dist/model/richText.d.ts +3 -7
- package/dist/model/richText.d.ts.map +1 -1
- package/dist/model/richText.js +4 -3
- package/dist/model/richText.js.map +1 -1
- package/dist/model/section.d.ts +3 -3329
- package/dist/model/section.d.ts.map +1 -1
- package/dist/model/select.d.ts +1 -1
- package/dist/model/select.js +1 -1
- package/dist/model/select.js.map +1 -1
- package/dist/model/slice.d.ts +781 -3720
- package/dist/model/slice.d.ts.map +1 -1
- package/dist/model/slice.js +7 -2
- package/dist/model/slice.js.map +1 -1
- package/dist/model/slices.d.ts +3 -2195
- package/dist/model/slices.d.ts.map +1 -1
- package/dist/model/table.d.ts +2 -1
- package/dist/model/table.d.ts.map +1 -1
- package/dist/model/table.js +9 -7
- package/dist/model/table.js.map +1 -1
- package/dist/model/widget.d.ts +6 -3331
- package/dist/model/widget.d.ts.map +1 -1
- package/dist/model/widget.js.map +1 -1
- package/dist/zod4.d.ts +1332 -34960
- package/dist/zod4.d.ts.map +1 -1
- package/dist/zod4.js +125 -124
- package/dist/zod4.js.map +1 -1
- package/package.json +3 -2
- package/src/content/field.ts +9 -2
- package/src/content/group.ts +5 -2
- package/src/content/legacy/group.ts +12 -4
- package/src/content/legacy/link.ts +32 -9
- package/src/content/legacy/nestable.ts +26 -2
- package/src/content/legacy/repeatable.ts +3 -16
- package/src/content/legacy/richText.ts +37 -5
- package/src/content/legacy/slice.ts +8 -7
- package/src/content/legacy/widget.ts +6 -2
- package/src/content/link.ts +32 -9
- package/src/content/nestable.ts +42 -2
- package/src/content/richText.ts +19 -7
- package/src/content/slice.ts +2 -2
- package/src/content/widget.ts +6 -2
- package/src/helpers/documentContent.ts +32 -1
- package/src/helpers/sliceContent.ts +86 -0
- package/src/helpers/traverseContent.ts +93 -32
- package/src/helpers/traverseContentWithModel.ts +73 -48
- package/src/index.ts +4 -1
- package/src/io-ts.ts +164 -144
- package/src/model/group.ts +4 -1
- package/src/model/image.ts +1 -1
- package/src/model/link.ts +1 -1
- package/src/model/nestable.ts +33 -1
- package/src/model/richText.ts +2 -2
- package/src/model/select.ts +2 -2
- package/src/model/slice.ts +36 -9
- package/src/model/table.ts +11 -2
- package/src/model/widget.ts +8 -4
- package/src/zod4.ts +164 -144
- package/dist/content/legacy/image.d.ts +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.d.ts","names":[],"sources":["../../src/content/document.ts"],"mappings":";;;;cAKa,qBAAA,EAAqB,CAAA,CAAA,aAAA,CAAA,CAAA,CAAA,aAAA,UAAA,CAAA,CAAA,
|
|
1
|
+
{"version":3,"file":"document.d.ts","names":[],"sources":["../../src/content/document.ts"],"mappings":";;;;cAKa,qBAAA,EAAqB,CAAA,CAAA,aAAA,CAAA,CAAA,CAAA,aAAA,UAAA,CAAA,CAAA,WAAA,CAAA,aAAA,WAAA,CAAA,CAAA,IAAA,CAAA,iBAAA,CAAA,aAAA;AAAA,KAEtB,eAAA,GAAkB,CAAA,CAAE,KAAA,QAAa,qBAAA"}
|
package/dist/content/field.d.ts
CHANGED
|
@@ -36,35 +36,6 @@ declare const SelectContentSchema: z.ZodMiniObject<{
|
|
|
36
36
|
value: z.ZodMiniString<string>;
|
|
37
37
|
__TYPE__: z.ZodMiniLiteral<"FieldContent">;
|
|
38
38
|
}, z.core.$strip>;
|
|
39
|
-
declare const FieldContentSchema: z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
40
|
-
type: z.ZodMiniLiteral<"Text">;
|
|
41
|
-
value: z.ZodMiniString<string>;
|
|
42
|
-
__TYPE__: z.ZodMiniLiteral<"FieldContent">;
|
|
43
|
-
}, z.core.$strip>, z.ZodMiniObject<{
|
|
44
|
-
type: z.ZodMiniLiteral<"Color">;
|
|
45
|
-
value: z.ZodMiniString<string>;
|
|
46
|
-
__TYPE__: z.ZodMiniLiteral<"FieldContent">;
|
|
47
|
-
}, z.core.$strip>, z.ZodMiniObject<{
|
|
48
|
-
type: z.ZodMiniLiteral<"Date">;
|
|
49
|
-
value: z.ZodMiniString<string>;
|
|
50
|
-
__TYPE__: z.ZodMiniLiteral<"FieldContent">;
|
|
51
|
-
}, z.core.$strip>, z.ZodMiniObject<{
|
|
52
|
-
type: z.ZodMiniLiteral<"Timestamp">;
|
|
53
|
-
value: z.ZodMiniString<string>;
|
|
54
|
-
__TYPE__: z.ZodMiniLiteral<"FieldContent">;
|
|
55
|
-
}, z.core.$strip>, z.ZodMiniObject<{
|
|
56
|
-
type: z.ZodMiniLiteral<"Number">;
|
|
57
|
-
value: z.ZodMiniString<string>;
|
|
58
|
-
__TYPE__: z.ZodMiniLiteral<"FieldContent">;
|
|
59
|
-
}, z.core.$strip>, z.ZodMiniObject<{
|
|
60
|
-
type: z.ZodMiniLiteral<"Range">;
|
|
61
|
-
value: z.ZodMiniString<string>;
|
|
62
|
-
__TYPE__: z.ZodMiniLiteral<"FieldContent">;
|
|
63
|
-
}, z.core.$strip>, z.ZodMiniObject<{
|
|
64
|
-
type: z.ZodMiniLiteral<"Select">;
|
|
65
|
-
value: z.ZodMiniString<string>;
|
|
66
|
-
__TYPE__: z.ZodMiniLiteral<"FieldContent">;
|
|
67
|
-
}, z.core.$strip>]>;
|
|
68
39
|
type TextContent = z.infer<typeof TextContentSchema>;
|
|
69
40
|
type ColorContent = z.infer<typeof ColorContentSchema>;
|
|
70
41
|
type DateContent = z.infer<typeof DateContentSchema>;
|
|
@@ -72,7 +43,7 @@ type TimestampContent = z.infer<typeof TimestampContentSchema>;
|
|
|
72
43
|
type NumberContent = z.infer<typeof NumberContentSchema>;
|
|
73
44
|
type RangeContent = z.infer<typeof RangeContentSchema>;
|
|
74
45
|
type SelectContent = z.infer<typeof SelectContentSchema>;
|
|
75
|
-
type FieldContent =
|
|
46
|
+
type FieldContent = TextContent | ColorContent | DateContent | TimestampContent | NumberContent | RangeContent | SelectContent;
|
|
76
47
|
//#endregion
|
|
77
48
|
export { ColorContent, DateContent, FieldContent, NumberContent, RangeContent, SelectContent, TextContent, TimestampContent };
|
|
78
49
|
//# sourceMappingURL=field.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.d.ts","names":[],"sources":["../../src/content/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
{"version":3,"file":"field.js","names":[],"sources":["../../src/content/field.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport type { SelectModel } from \"../model/select\"\n\nexport const FieldContentType = \"FieldContent\" as const\nexport const SelectFieldType = \"Select\" as const\n\n// Text\nexport const TextContentSchema = z.object({\n\ttype: z.literal(\"Text\"),\n\tvalue: z.string().check(z.trim()),\n\t__TYPE__: z.literal(FieldContentType),\n})\n\n// Color\nexport const ColorContentSchema = z.object({\n\ttype: z.literal(\"Color\"),\n\tvalue: z.string().check(z.trim()),\n\t__TYPE__: z.literal(FieldContentType),\n})\n\n// Date\nexport const DateContentSchema = z.object({\n\ttype: z.literal(\"Date\"),\n\tvalue: z.string().check(z.trim()),\n\t__TYPE__: z.literal(FieldContentType),\n})\n\n// Timestamp\nexport const TimestampContentSchema = z.object({\n\ttype: z.literal(\"Timestamp\"),\n\tvalue: z.string().check(z.trim()),\n\t__TYPE__: z.literal(FieldContentType),\n})\n\n// Number\nexport const NumberContentSchema = z.object({\n\ttype: z.literal(\"Number\"),\n\tvalue: z.string().check(z.trim()),\n\t__TYPE__: z.literal(FieldContentType),\n})\n\n// Range\nexport const RangeContentSchema = z.object({\n\ttype: z.literal(\"Range\"),\n\tvalue: z.string().check(z.trim()),\n\t__TYPE__: z.literal(FieldContentType),\n})\n\n// Select\nexport const SelectContentSchema = z.object({\n\ttype: z.literal(SelectFieldType),\n\tvalue: z.string().check(z.trim()),\n\t__TYPE__: z.literal(FieldContentType),\n})\n\n// Fields\nexport const FieldContentSchema = z.union([\n\tTextContentSchema,\n\tColorContentSchema,\n\tDateContentSchema,\n\tTimestampContentSchema,\n\tNumberContentSchema,\n\tRangeContentSchema,\n\tSelectContentSchema,\n])\n\nexport type TextContent = z.infer<typeof TextContentSchema>\nexport type ColorContent = z.infer<typeof ColorContentSchema>\nexport type DateContent = z.infer<typeof DateContentSchema>\nexport type TimestampContent = z.infer<typeof TimestampContentSchema>\nexport type NumberContent = z.infer<typeof NumberContentSchema>\nexport type RangeContent = z.infer<typeof RangeContentSchema>\nexport type SelectContent = z.infer<typeof SelectContentSchema>\nexport type FieldContent
|
|
1
|
+
{"version":3,"file":"field.js","names":[],"sources":["../../src/content/field.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport type { SelectModel } from \"../model/select\"\n\nexport const FieldContentType = \"FieldContent\" as const\nexport const SelectFieldType = \"Select\" as const\n\n// Text\nexport const TextContentSchema = z.object({\n\ttype: z.literal(\"Text\"),\n\tvalue: z.string().check(z.trim()),\n\t__TYPE__: z.literal(FieldContentType),\n})\n\n// Color\nexport const ColorContentSchema = z.object({\n\ttype: z.literal(\"Color\"),\n\tvalue: z.string().check(z.trim()),\n\t__TYPE__: z.literal(FieldContentType),\n})\n\n// Date\nexport const DateContentSchema = z.object({\n\ttype: z.literal(\"Date\"),\n\tvalue: z.string().check(z.trim()),\n\t__TYPE__: z.literal(FieldContentType),\n})\n\n// Timestamp\nexport const TimestampContentSchema = z.object({\n\ttype: z.literal(\"Timestamp\"),\n\tvalue: z.string().check(z.trim()),\n\t__TYPE__: z.literal(FieldContentType),\n})\n\n// Number\nexport const NumberContentSchema = z.object({\n\ttype: z.literal(\"Number\"),\n\tvalue: z.string().check(z.trim()),\n\t__TYPE__: z.literal(FieldContentType),\n})\n\n// Range\nexport const RangeContentSchema = z.object({\n\ttype: z.literal(\"Range\"),\n\tvalue: z.string().check(z.trim()),\n\t__TYPE__: z.literal(FieldContentType),\n})\n\n// Select\nexport const SelectContentSchema = z.object({\n\ttype: z.literal(SelectFieldType),\n\tvalue: z.string().check(z.trim()),\n\t__TYPE__: z.literal(FieldContentType),\n})\n\n// Fields\nexport const FieldContentSchema: z.ZodMiniType<FieldContent> = z.union([\n\tTextContentSchema,\n\tColorContentSchema,\n\tDateContentSchema,\n\tTimestampContentSchema,\n\tNumberContentSchema,\n\tRangeContentSchema,\n\tSelectContentSchema,\n])\n\nexport type TextContent = z.infer<typeof TextContentSchema>\nexport type ColorContent = z.infer<typeof ColorContentSchema>\nexport type DateContent = z.infer<typeof DateContentSchema>\nexport type TimestampContent = z.infer<typeof TimestampContentSchema>\nexport type NumberContent = z.infer<typeof NumberContentSchema>\nexport type RangeContent = z.infer<typeof RangeContentSchema>\nexport type SelectContent = z.infer<typeof SelectContentSchema>\nexport type FieldContent =\n\t| TextContent\n\t| ColorContent\n\t| DateContent\n\t| TimestampContent\n\t| NumberContent\n\t| RangeContent\n\t| SelectContent\n\n/**\n * Returns the default value for a Select field based on its configuration.\n */\nexport const SelectContentDefaultValue = (field: SelectModel): SelectContent | undefined =>\n\tfield.config?.default_value\n\t\t? {\n\t\t\t\t__TYPE__: FieldContentType,\n\t\t\t\ttype: SelectFieldType,\n\t\t\t\tvalue: field.config.default_value || \"\",\n\t\t\t}\n\t\t: undefined\n"],"mappings":";;AAIA,MAAa,mBAAmB;AAChC,MAAa,kBAAkB;AAG/B,MAAa,oBAAoB,EAAE,OAAO;CACzC,MAAM,EAAE,QAAQ,OAAO;CACvB,OAAO,EAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACjC,UAAU,EAAE,QAAQ,iBAAiB;CACrC,CAAC;AAGF,MAAa,qBAAqB,EAAE,OAAO;CAC1C,MAAM,EAAE,QAAQ,QAAQ;CACxB,OAAO,EAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACjC,UAAU,EAAE,QAAQ,iBAAiB;CACrC,CAAC;AAGF,MAAa,oBAAoB,EAAE,OAAO;CACzC,MAAM,EAAE,QAAQ,OAAO;CACvB,OAAO,EAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACjC,UAAU,EAAE,QAAQ,iBAAiB;CACrC,CAAC;AAGF,MAAa,yBAAyB,EAAE,OAAO;CAC9C,MAAM,EAAE,QAAQ,YAAY;CAC5B,OAAO,EAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACjC,UAAU,EAAE,QAAQ,iBAAiB;CACrC,CAAC;AAGF,MAAa,sBAAsB,EAAE,OAAO;CAC3C,MAAM,EAAE,QAAQ,SAAS;CACzB,OAAO,EAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACjC,UAAU,EAAE,QAAQ,iBAAiB;CACrC,CAAC;AAGF,MAAa,qBAAqB,EAAE,OAAO;CAC1C,MAAM,EAAE,QAAQ,QAAQ;CACxB,OAAO,EAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACjC,UAAU,EAAE,QAAQ,iBAAiB;CACrC,CAAC;AAGF,MAAa,sBAAsB,EAAE,OAAO;CAC3C,MAAM,EAAE,QAAQ,gBAAgB;CAChC,OAAO,EAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACjC,UAAU,EAAE,QAAQ,iBAAiB;CACrC,CAAC;AAGF,MAAa,qBAAkD,EAAE,MAAM;CACtE;CACA;CACA;CACA;CACA;CACA;CACA;CACA,CAAC"}
|
package/dist/content/group.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ declare const GroupContentSchema: z.ZodMiniObject<{
|
|
|
13
13
|
value: z.ZodMiniArray<z.ZodMiniType<GroupItemContent, unknown, z.core.$ZodTypeInternals<GroupItemContent, unknown>>>;
|
|
14
14
|
}, z.core.$strip>;
|
|
15
15
|
type GroupContent = z.infer<typeof GroupContentSchema>;
|
|
16
|
+
type NestableAndGroupContent = NestableContent | GroupContent;
|
|
16
17
|
//#endregion
|
|
17
|
-
export { GroupContent, GroupItemContent };
|
|
18
|
+
export { GroupContent, GroupItemContent, NestableAndGroupContent };
|
|
18
19
|
//# sourceMappingURL=group.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group.d.ts","names":[],"sources":["../../src/content/group.ts"],"mappings":";;;;cAOa,oBAAA;AAAA,KAkBD,gBAAA;EACX,QAAA,SAAiB,oBAAA;EACjB,GAAA;EACA,KAAA,WAAgB,eAAA,GAAkB,YAAA;AAAA;AAAA,cAMtB,kBAAA,EAAkB,CAAA,CAAA,aAAA;;;;KAKnB,YAAA,GAAe,CAAA,CAAE,KAAA,QAAa,kBAAA"}
|
|
1
|
+
{"version":3,"file":"group.d.ts","names":[],"sources":["../../src/content/group.ts"],"mappings":";;;;cAOa,oBAAA;AAAA,KAkBD,gBAAA;EACX,QAAA,SAAiB,oBAAA;EACjB,GAAA;EACA,KAAA,WAAgB,eAAA,GAAkB,YAAA;AAAA;AAAA,cAMtB,kBAAA,EAAkB,CAAA,CAAA,aAAA;;;;KAKnB,YAAA,GAAe,CAAA,CAAE,KAAA,QAAa,kBAAA;AAAA,KAO9B,uBAAA,GAA0B,eAAA,GAAkB,YAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group.js","names":[],"sources":["../../src/content/group.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport type { GroupModel } from \"../model/group\"\nimport { NestableContentDefaultValue, NestableContentSchema } from \"./nestable\"\nimport type { NestableContent } from \"./nestable\"\n\n// Item\nexport const GroupItemContentType = \"GroupItemContent\" as const\n\nexport const GroupItemContentSchema: z.ZodMiniType<GroupItemContent> = z.object({\n\t__TYPE__: z.literal(GroupItemContentType),\n\tkey: z.string(),\n\tvalue: z.array(\n\t\tz.tuple([\n\t\t\tz.string(),\n\t\t\tz.union([\n\t\t\t\tNestableContentSchema,\n\t\t\t\t// `lazy` is used to handle circular dependency on GroupContentSchema\n\t\t\t\tz.lazy(() => GroupContentSchema),\n\t\t\t]),\n\t\t]),\n\t),\n})\n\n// Manual type definition to handle circular dependency on GroupItemContentSchema\nexport type GroupItemContent = {\n\t__TYPE__: typeof GroupItemContentType\n\tkey: string\n\tvalue: [string, NestableContent | GroupContent][]\n}\n\n// Group\nexport const GroupContentType = \"GroupContentType\" as const\n\nexport const GroupContentSchema = z.object({\n\t__TYPE__: z.literal(GroupContentType),\n\tvalue: z.array(GroupItemContentSchema),\n})\n\nexport type GroupContent = z.infer<typeof GroupContentSchema>\n\nexport const NestableAndGroupContentSchema = z.union([
|
|
1
|
+
{"version":3,"file":"group.js","names":[],"sources":["../../src/content/group.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport type { GroupModel } from \"../model/group\"\nimport { NestableContentDefaultValue, NestableContentSchema } from \"./nestable\"\nimport type { NestableContent } from \"./nestable\"\n\n// Item\nexport const GroupItemContentType = \"GroupItemContent\" as const\n\nexport const GroupItemContentSchema: z.ZodMiniType<GroupItemContent> = z.object({\n\t__TYPE__: z.literal(GroupItemContentType),\n\tkey: z.string(),\n\tvalue: z.array(\n\t\tz.tuple([\n\t\t\tz.string(),\n\t\t\tz.union([\n\t\t\t\tNestableContentSchema,\n\t\t\t\t// `lazy` is used to handle circular dependency on GroupContentSchema\n\t\t\t\tz.lazy(() => GroupContentSchema),\n\t\t\t]),\n\t\t]),\n\t),\n})\n\n// Manual type definition to handle circular dependency on GroupItemContentSchema\nexport type GroupItemContent = {\n\t__TYPE__: typeof GroupItemContentType\n\tkey: string\n\tvalue: [string, NestableContent | GroupContent][]\n}\n\n// Group\nexport const GroupContentType = \"GroupContentType\" as const\n\nexport const GroupContentSchema = z.object({\n\t__TYPE__: z.literal(GroupContentType),\n\tvalue: z.array(GroupItemContentSchema),\n})\n\nexport type GroupContent = z.infer<typeof GroupContentSchema>\n\nexport const NestableAndGroupContentSchema: z.ZodMiniType<NestableAndGroupContent> = z.union([\n\tNestableContentSchema,\n\tGroupContentSchema,\n])\n\nexport type NestableAndGroupContent = NestableContent | GroupContent\n\n// Default values for GroupContent\nexport function groupContentWithDefaultValues(\n\tcustomType: GroupModel,\n\tcontent: GroupContent,\n): GroupContent {\n\tconst fields = customType.config?.fields\n\tif (!fields) return content\n\n\treturn {\n\t\t...content,\n\t\tvalue: content.value.map((groupItem) => {\n\t\t\tconst updatedValue = Object.entries(fields).reduce<GroupItemContent[\"value\"]>(\n\t\t\t\t(acc, [fieldKey, fieldDef]) => {\n\t\t\t\t\tconst existingField = groupItem.value.find(([key]) => key === fieldKey)\n\n\t\t\t\t\tif (existingField) {\n\t\t\t\t\t\treturn [...acc, existingField]\n\t\t\t\t\t}\n\n\t\t\t\t\t// Field is missing, check if we can add a default value\n\t\t\t\t\tif (fieldDef.type === \"Group\") {\n\t\t\t\t\t\t// Recursively apply defaults to nested groups\n\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\t...acc,\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\tfieldKey,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t__TYPE__: GroupContentType,\n\t\t\t\t\t\t\t\t\tvalue: [],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t]\n\t\t\t\t\t}\n\n\t\t\t\t\tconst defaultValue = NestableContentDefaultValue(fieldDef)\n\t\t\t\t\tif (defaultValue) {\n\t\t\t\t\t\treturn [...acc, [fieldKey, defaultValue]]\n\t\t\t\t\t}\n\n\t\t\t\t\treturn acc\n\t\t\t\t},\n\t\t\t\t[],\n\t\t\t)\n\n\t\t\treturn {\n\t\t\t\t...groupItem,\n\t\t\t\tvalue: updatedValue,\n\t\t\t}\n\t\t}),\n\t}\n}\n"],"mappings":";;;AAOA,MAAa,uBAAuB;AAEpC,MAAa,yBAA0D,EAAE,OAAO;CAC/E,UAAU,EAAE,QAAQ,qBAAqB;CACzC,KAAK,EAAE,QAAQ;CACf,OAAO,EAAE,MACR,EAAE,MAAM,CACP,EAAE,QAAQ,EACV,EAAE,MAAM,CACP,uBAEA,EAAE,WAAW,mBAAmB,CAChC,CAAC,CACF,CAAC,CACF;CACD,CAAC;AAUF,MAAa,mBAAmB;AAEhC,MAAa,qBAAqB,EAAE,OAAO;CAC1C,UAAU,EAAE,QAAQ,iBAAiB;CACrC,OAAO,EAAE,MAAM,uBAAuB;CACtC,CAAC;AAIF,MAAa,gCAAwE,EAAE,MAAM,CAC5F,uBACA,mBACA,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from "zod/mini";
|
|
2
|
+
|
|
3
|
+
//#region src/content/legacy/group.d.ts
|
|
4
|
+
declare const GroupItemLegacySchema: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>;
|
|
5
|
+
type GroupItemLegacy = z.infer<typeof GroupItemLegacySchema>;
|
|
6
|
+
type GroupLegacy = (GroupItemLegacy | null)[];
|
|
7
|
+
//#endregion
|
|
8
|
+
export { GroupLegacy };
|
|
9
|
+
//# sourceMappingURL=group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group.d.ts","names":[],"sources":["../../../src/content/legacy/group.ts"],"mappings":";;;cAOa,qBAAA,EAAqB,CAAA,CAAA,aAAA,CAAA,CAAA,CAAA,aAAA,UAAA,CAAA,CAAA,cAAA;AAAA,KAEtB,eAAA,GAAkB,CAAA,CAAE,KAAA,QAAa,qBAAA;AAAA,KAMjC,WAAA,IAAe,eAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group.js","names":[],"sources":["../../../src/content/legacy/group.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { NestableLegacySchema } from \"./nestable\"\n\nexport const GroupItemLegacySchema = z.record(z.string(), z.unknown())\n\nexport type GroupItemLegacy = z.infer<typeof GroupItemLegacySchema>\n\nexport const GroupLegacySchema = z.array(
|
|
1
|
+
{"version":3,"file":"group.js","names":[],"sources":["../../../src/content/legacy/group.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport type { NestableLegacy } from \"./nestable\"\nimport { NestableLegacySchema } from \"./nestable\"\n\n// Keep item values raw here: array-shaped legacy payloads are ambiguous until\n// `codec/group.ts` resolves the field model and picks the right decoder.\nexport const GroupItemLegacySchema = z.record(z.string(), z.unknown())\n\nexport type GroupItemLegacy = z.infer<typeof GroupItemLegacySchema>\n\nexport const GroupLegacySchema: z.ZodMiniType<GroupLegacy> = z.array(\n\tz.union([GroupItemLegacySchema, z.null()]),\n)\n\nexport type GroupLegacy = (GroupItemLegacy | null)[]\n\nexport const NestableAndGroupLegacySchema: z.ZodMiniType<NestableAndGroupLegacy> = z.union([\n\tNestableLegacySchema,\n\tGroupLegacySchema,\n])\n\nexport type NestableAndGroupLegacy = NestableLegacy | GroupLegacy\n"],"mappings":";;;AAOA,MAAa,wBAAwB,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,SAAS,CAAC;AAItE,MAAa,oBAAgD,EAAE,MAC9D,EAAE,MAAM,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAC,CAC1C;AAID,MAAa,+BAAsE,EAAE,MAAM,CAC1F,sBACA,kBACA,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from "zod/mini";
|
|
2
|
+
|
|
3
|
+
//#region src/content/legacy/link.d.ts
|
|
4
|
+
declare const FilledImageLinkValueLegacySchema: z.ZodMiniObject<{
|
|
5
|
+
kind: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<"image", string>>;
|
|
6
|
+
id: z.ZodMiniString<string>;
|
|
7
|
+
url: z.ZodMiniString<string>;
|
|
8
|
+
height: z.ZodMiniString<string>;
|
|
9
|
+
width: z.ZodMiniString<string>;
|
|
10
|
+
size: z.ZodMiniString<string>;
|
|
11
|
+
name: z.ZodMiniString<string>;
|
|
12
|
+
date: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
13
|
+
}, z.core.$strict>;
|
|
14
|
+
declare const FilledFileLinkValueLegacySchema: z.ZodMiniObject<{
|
|
15
|
+
kind: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<"file", string>>;
|
|
16
|
+
id: z.ZodMiniString<string>;
|
|
17
|
+
url: z.ZodMiniString<string>;
|
|
18
|
+
name: z.ZodMiniString<string>;
|
|
19
|
+
size: z.ZodMiniTransform<string, unknown>;
|
|
20
|
+
date: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
21
|
+
}, z.core.$strict>;
|
|
22
|
+
declare const FilledDocumentLinkValueLegacySchema: z.ZodMiniObject<{
|
|
23
|
+
kind: z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniLiteral<"document">>, z.ZodMiniTransform<"document", "document" | undefined>>;
|
|
24
|
+
id: z.ZodMiniString<string>;
|
|
25
|
+
}, z.core.$strict>;
|
|
26
|
+
declare const FilledExternalLinkValueLegacySchema: z.ZodMiniObject<{
|
|
27
|
+
kind: z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniLiteral<"web">>, z.ZodMiniTransform<"web", "web" | undefined>>;
|
|
28
|
+
url: z.ZodMiniString<string>;
|
|
29
|
+
target: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
30
|
+
preview: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniObject<{
|
|
31
|
+
title: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
32
|
+
}, z.core.$strict>>>;
|
|
33
|
+
}, z.core.$strict>;
|
|
34
|
+
type FilledImageLinkValueLegacy = z.infer<typeof FilledImageLinkValueLegacySchema>;
|
|
35
|
+
type FilledFileLinkValueLegacy = z.infer<typeof FilledFileLinkValueLegacySchema>;
|
|
36
|
+
type FilledDocumentLinkValueLegacy = z.infer<typeof FilledDocumentLinkValueLegacySchema>;
|
|
37
|
+
type FilledExternalLinkValueLegacy = z.infer<typeof FilledExternalLinkValueLegacySchema>;
|
|
38
|
+
type FilledLinkValueLegacy = FilledImageLinkValueLegacy | FilledFileLinkValueLegacy | FilledDocumentLinkValueLegacy | FilledExternalLinkValueLegacy;
|
|
39
|
+
//#endregion
|
|
40
|
+
export { FilledLinkValueLegacy };
|
|
41
|
+
//# sourceMappingURL=link.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.d.ts","names":[],"sources":["../../../src/content/legacy/link.ts"],"mappings":";;;cAuBa,gCAAA,EAAgC,CAAA,CAAA,aAAA;;;;;;;;;;cAoBhC,+BAAA,EAA+B,CAAA,CAAA,aAAA;;;;;;;;cA0B/B,mCAAA,EAAmC,CAAA,CAAA,aAAA;;;;cAenC,mCAAA,EAAmC,CAAA,CAAA,aAAA;;;;;;;;KAkC3C,0BAAA,GAA6B,CAAA,CAAE,KAAA,QAAa,gCAAA;AAAA,KAC5C,yBAAA,GAA4B,CAAA,CAAE,KAAA,QAAa,+BAAA;AAAA,KAC3C,6BAAA,GAAgC,CAAA,CAAE,KAAA,QAAa,mCAAA;AAAA,KAC/C,6BAAA,GAAgC,CAAA,CAAE,KAAA,QAAa,mCAAA;AAAA,KACxC,qBAAA,GACT,0BAAA,GACA,yBAAA,GACA,6BAAA,GACA,6BAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.js","names":[],"sources":["../../../src/content/legacy/link.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { NonEmptyStringSchema } from \"../../common/nonEmptyString\"\n\nexport const LinkKind = {\n\tImage: \"image\",\n\tFile: \"file\",\n\tMedia: \"media\",\n\tDocument: \"document\",\n\tExternal: \"web\",\n\tAny: \"any\",\n} as const\n\nexport const LinkType = {\n\tImage: \"ImageLink\",\n\tFile: \"FileLink\",\n\tDocument: \"DocumentLink\",\n\tExternal: \"ExternalLink\",\n\tMedia: \"MediaLink\",\n\tAny: \"AnyLink\",\n} as const\n\n// Image\nexport const FilledImageLinkValueLegacySchema = z.strictObject({\n\t// `kind` was normalized to the literal (legacy behavior)\n\tkind: z.pipe(\n\t\tz.string(),\n\t\tz.transform(() => LinkKind.Image),\n\t),\n\tid: z.string(),\n\turl: z.string(),\n\theight: z.string(),\n\twidth: z.string(),\n\tsize: z.string(),\n\tname: z.string(),\n\tdate: z.nullish(z.string()),\n})\n\nexport const EmptyImageLinkValueLegacySchema = z.strictObject({\n\tkind: z.literal(LinkKind.Image),\n})\n\n// File\nexport const FilledFileLinkValueLegacySchema = z.strictObject({\n\t// `kind` was normalized to the literal (legacy behavior)\n\tkind: z.pipe(\n\t\tz.string(),\n\t\tz.transform(() => LinkKind.File),\n\t),\n\tid: z.string(),\n\turl: z.string(),\n\tname: z.string(),\n\tsize: z.transform((value) => (typeof value === \"string\" ? value : \"0\")),\n\tdate: z.nullish(z.string()),\n})\n\nexport const EmptyFileLinkValueLegacySchema = z.strictObject({\n\tkind: z.literal(LinkKind.File),\n})\n\n// Media\n\n// Media link only represent the empty state as they turn into\n// file or image links when they filled.\nexport const EmptyMediaLinkValueLegacySchema = z.strictObject({\n\tkind: z.literal(LinkKind.Media),\n})\n\n// Document\nexport const FilledDocumentLinkValueLegacySchema = z.strictObject({\n\t// `kind` is not part of the filled schema... (legacy behavior)\n\t// We transform it to the literal for consistency.\n\tkind: z.pipe(\n\t\tz.optional(z.literal(LinkKind.Document)),\n\t\tz.transform(() => LinkKind.Document),\n\t),\n\tid: NonEmptyStringSchema,\n})\n\nexport const EmptyDocumentLinkValueLegacySchema = z.strictObject({\n\tkind: z.literal(LinkKind.Document),\n})\n\n// External\nexport const FilledExternalLinkValueLegacySchema = z.strictObject({\n\t// It's odd that `kind` is optional here... (legacy behavior)\n\t// We transform it to the literal for consistency.\n\tkind: z.pipe(\n\t\tz.optional(z.literal(LinkKind.External)),\n\t\tz.transform(() => LinkKind.External),\n\t),\n\turl: z.string(),\n\ttarget: z.nullish(z.string()),\n\tpreview: z.nullish(\n\t\tz.strictObject({\n\t\t\ttitle: z.optional(z.string()),\n\t\t}),\n\t),\n})\n\nexport const EmptyExternalLinkValueLegacySchema = z.strictObject({\n\tkind: z.literal(LinkKind.External),\n})\n\n// Any\nexport const AnyLinkLegacySchema = z.strictObject({\n\tkind: z.transform(() => LinkKind.Any),\n})\n\n// All\n\nexport const FilledLinkValueLegacySchema = z.union([\n\tFilledImageLinkValueLegacySchema,\n\tFilledFileLinkValueLegacySchema,\n\tFilledDocumentLinkValueLegacySchema,\n\tFilledExternalLinkValueLegacySchema,\n])\n\
|
|
1
|
+
{"version":3,"file":"link.js","names":[],"sources":["../../../src/content/legacy/link.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { NonEmptyStringSchema } from \"../../common/nonEmptyString\"\n\nexport const LinkKind = {\n\tImage: \"image\",\n\tFile: \"file\",\n\tMedia: \"media\",\n\tDocument: \"document\",\n\tExternal: \"web\",\n\tAny: \"any\",\n} as const\n\nexport const LinkType = {\n\tImage: \"ImageLink\",\n\tFile: \"FileLink\",\n\tDocument: \"DocumentLink\",\n\tExternal: \"ExternalLink\",\n\tMedia: \"MediaLink\",\n\tAny: \"AnyLink\",\n} as const\n\n// Image\nexport const FilledImageLinkValueLegacySchema = z.strictObject({\n\t// `kind` was normalized to the literal (legacy behavior)\n\tkind: z.pipe(\n\t\tz.string(),\n\t\tz.transform(() => LinkKind.Image),\n\t),\n\tid: z.string(),\n\turl: z.string(),\n\theight: z.string(),\n\twidth: z.string(),\n\tsize: z.string(),\n\tname: z.string(),\n\tdate: z.nullish(z.string()),\n})\n\nexport const EmptyImageLinkValueLegacySchema = z.strictObject({\n\tkind: z.literal(LinkKind.Image),\n})\n\n// File\nexport const FilledFileLinkValueLegacySchema = z.strictObject({\n\t// `kind` was normalized to the literal (legacy behavior)\n\tkind: z.pipe(\n\t\tz.string(),\n\t\tz.transform(() => LinkKind.File),\n\t),\n\tid: z.string(),\n\turl: z.string(),\n\tname: z.string(),\n\tsize: z.transform((value) => (typeof value === \"string\" ? value : \"0\")),\n\tdate: z.nullish(z.string()),\n})\n\nexport const EmptyFileLinkValueLegacySchema = z.strictObject({\n\tkind: z.literal(LinkKind.File),\n})\n\n// Media\n\n// Media link only represent the empty state as they turn into\n// file or image links when they filled.\nexport const EmptyMediaLinkValueLegacySchema = z.strictObject({\n\tkind: z.literal(LinkKind.Media),\n})\n\n// Document\nexport const FilledDocumentLinkValueLegacySchema = z.strictObject({\n\t// `kind` is not part of the filled schema... (legacy behavior)\n\t// We transform it to the literal for consistency.\n\tkind: z.pipe(\n\t\tz.optional(z.literal(LinkKind.Document)),\n\t\tz.transform(() => LinkKind.Document),\n\t),\n\tid: NonEmptyStringSchema,\n})\n\nexport const EmptyDocumentLinkValueLegacySchema = z.strictObject({\n\tkind: z.literal(LinkKind.Document),\n})\n\n// External\nexport const FilledExternalLinkValueLegacySchema = z.strictObject({\n\t// It's odd that `kind` is optional here... (legacy behavior)\n\t// We transform it to the literal for consistency.\n\tkind: z.pipe(\n\t\tz.optional(z.literal(LinkKind.External)),\n\t\tz.transform(() => LinkKind.External),\n\t),\n\turl: z.string(),\n\ttarget: z.nullish(z.string()),\n\tpreview: z.nullish(\n\t\tz.strictObject({\n\t\t\ttitle: z.optional(z.string()),\n\t\t}),\n\t),\n})\n\nexport const EmptyExternalLinkValueLegacySchema = z.strictObject({\n\tkind: z.literal(LinkKind.External),\n})\n\n// Any\nexport const AnyLinkLegacySchema = z.strictObject({\n\tkind: z.transform(() => LinkKind.Any),\n})\n\n// All\n\nexport const FilledLinkValueLegacySchema: z.ZodMiniType<FilledLinkValueLegacy> = z.union([\n\tFilledImageLinkValueLegacySchema,\n\tFilledFileLinkValueLegacySchema,\n\tFilledDocumentLinkValueLegacySchema,\n\tFilledExternalLinkValueLegacySchema,\n])\n\ntype FilledImageLinkValueLegacy = z.infer<typeof FilledImageLinkValueLegacySchema>\ntype FilledFileLinkValueLegacy = z.infer<typeof FilledFileLinkValueLegacySchema>\ntype FilledDocumentLinkValueLegacy = z.infer<typeof FilledDocumentLinkValueLegacySchema>\ntype FilledExternalLinkValueLegacy = z.infer<typeof FilledExternalLinkValueLegacySchema>\nexport type FilledLinkValueLegacy =\n\t| FilledImageLinkValueLegacy\n\t| FilledFileLinkValueLegacy\n\t| FilledDocumentLinkValueLegacy\n\t| FilledExternalLinkValueLegacy\n\nconst EmptyLinkValueLegacySchema: z.ZodMiniType<EmptyLinkValueLegacy> = z.union([\n\tEmptyImageLinkValueLegacySchema,\n\tEmptyFileLinkValueLegacySchema,\n\tEmptyMediaLinkValueLegacySchema,\n\tEmptyDocumentLinkValueLegacySchema,\n\tEmptyExternalLinkValueLegacySchema,\n\tAnyLinkLegacySchema,\n])\n\ntype EmptyImageLinkValueLegacy = z.infer<typeof EmptyImageLinkValueLegacySchema>\ntype EmptyFileLinkValueLegacy = z.infer<typeof EmptyFileLinkValueLegacySchema>\ntype EmptyMediaLinkValueLegacy = z.infer<typeof EmptyMediaLinkValueLegacySchema>\ntype EmptyDocumentLinkValueLegacy = z.infer<typeof EmptyDocumentLinkValueLegacySchema>\ntype EmptyExternalLinkValueLegacy = z.infer<typeof EmptyExternalLinkValueLegacySchema>\ntype AnyLinkLegacy = z.infer<typeof AnyLinkLegacySchema>\nexport type EmptyLinkValueLegacy =\n\t| EmptyImageLinkValueLegacy\n\t| EmptyFileLinkValueLegacy\n\t| EmptyMediaLinkValueLegacy\n\t| EmptyDocumentLinkValueLegacy\n\t| EmptyExternalLinkValueLegacy\n\t| AnyLinkLegacy\n\nconst LinkValueLegacySchema: z.ZodMiniType<LinkValueLegacy> = z.union([\n\tFilledLinkValueLegacySchema,\n\tEmptyLinkValueLegacySchema,\n])\n\nexport type LinkValueLegacy = FilledLinkValueLegacy | EmptyLinkValueLegacy\n\n// We cannot use z.extend here because we're working with unions.\n// z.intersection wouldn't work also for the same reason.\nexport const LinkLegacySchema = z.pipe(\n\tz.pipe(\n\t\tz.pipe(\n\t\t\tz.record(z.string(), z.unknown()),\n\t\t\tz.transform(\n\t\t\t\t({\n\t\t\t\t\tkey,\n\t\t\t\t\ttext,\n\t\t\t\t\tvariant,\n\t\t\t\t\t...value\n\t\t\t\t}): {\n\t\t\t\t\tkey?: unknown\n\t\t\t\t\ttext?: unknown\n\t\t\t\t\tvariant?: unknown\n\t\t\t\t\tvalue: Record<string, unknown>\n\t\t\t\t} => ({ key, text, variant, value }),\n\t\t\t),\n\t\t),\n\t\tz.object({\n\t\t\tkey: z.optional(z.string()),\n\t\t\ttext: z.optional(z.string()),\n\t\t\tvariant: z.optional(z.string()),\n\t\t\tvalue: LinkValueLegacySchema as z.ZodMiniType<LinkValueLegacy, Record<string, unknown>>,\n\t\t}),\n\t),\n\tz.transform(({ key, text, variant, value }) => ({\n\t\tkey: z.uuidv4().safeParse(key).data ?? crypto.randomUUID(),\n\t\t...(text ? { text } : {}),\n\t\t...(variant ? { variant } : {}),\n\t\t...value,\n\t})),\n)\n\nexport type LinkLegacy = z.infer<typeof LinkLegacySchema>\n"],"mappings":";;;AAIA,MAAa,WAAW;CACvB,OAAO;CACP,MAAM;CACN,OAAO;CACP,UAAU;CACV,UAAU;CACV,KAAK;CACL;AAED,MAAa,WAAW;CACvB,OAAO;CACP,MAAM;CACN,UAAU;CACV,UAAU;CACV,OAAO;CACP,KAAK;CACL;AAGD,MAAa,mCAAmC,EAAE,aAAa;CAE9D,MAAM,EAAE,KACP,EAAE,QAAQ,EACV,EAAE,gBAAgB,SAAS,MAAM,CACjC;CACD,IAAI,EAAE,QAAQ;CACd,KAAK,EAAE,QAAQ;CACf,QAAQ,EAAE,QAAQ;CAClB,OAAO,EAAE,QAAQ;CACjB,MAAM,EAAE,QAAQ;CAChB,MAAM,EAAE,QAAQ;CAChB,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC;CAC3B,CAAC;AAEF,MAAa,kCAAkC,EAAE,aAAa,EAC7D,MAAM,EAAE,QAAQ,SAAS,MAAM,EAC/B,CAAC;AAGF,MAAa,kCAAkC,EAAE,aAAa;CAE7D,MAAM,EAAE,KACP,EAAE,QAAQ,EACV,EAAE,gBAAgB,SAAS,KAAK,CAChC;CACD,IAAI,EAAE,QAAQ;CACd,KAAK,EAAE,QAAQ;CACf,MAAM,EAAE,QAAQ;CAChB,MAAM,EAAE,WAAW,UAAW,OAAO,UAAU,WAAW,QAAQ,IAAK;CACvE,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC;CAC3B,CAAC;AAEF,MAAa,iCAAiC,EAAE,aAAa,EAC5D,MAAM,EAAE,QAAQ,SAAS,KAAK,EAC9B,CAAC;AAMF,MAAa,kCAAkC,EAAE,aAAa,EAC7D,MAAM,EAAE,QAAQ,SAAS,MAAM,EAC/B,CAAC;AAGF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,EAAE,QAAQ,CAAC;CAC/B,OAAO;CACP,CAAC,CACF,EACD,EAAE,WAAW,EAAE,KAAK,MAAM,SAAS,aAAa;CAC/C,KAAK,EAAE,QAAQ,CAAC,UAAU,IAAI,CAAC,QAAQ,OAAO,YAAY;CAC1D,GAAI,OAAO,EAAE,MAAM,GAAG,EAAE;CACxB,GAAI,UAAU,EAAE,SAAS,GAAG,EAAE;CAC9B,GAAG;CACH,EAAE,CACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nestable.js","names":[],"sources":["../../../src/content/legacy/nestable.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { BooleanLegacySchema } from \"./boolean\"\nimport { EmbedLegacyLooseSchema } from \"./embed\"\nimport { EmptyLegacySchema } from \"./empty\"\nimport { StringLegacySchema } from \"./field\"\nimport { GeoPointLegacySchema } from \"./geopoint\"\nimport { ImageLegacySchema } from \"./image\"\nimport { IntegrationFieldLegacySchema } from \"./integrationField\"\nimport { LinkLegacySchema } from \"./link\"\nimport { RepeatableLegacySchema } from \"./repeatable\"\nimport { RichTextLegacySchema } from \"./richText\"\nimport { SeparatorLegacySchema } from \"./separator\"\nimport { TableLegacySchema } from \"./table\"\n\nexport const NestableLegacySchema = z.union([\n\tEmptyLegacySchema,\n\tBooleanLegacySchema,\n\tEmbedLegacyLooseSchema,\n\tStringLegacySchema,\n\tGeoPointLegacySchema,\n\tImageLegacySchema,\n\tIntegrationFieldLegacySchema,\n\tLinkLegacySchema,\n\tRepeatableLegacySchema,\n\tRichTextLegacySchema,\n\tSeparatorLegacySchema,\n\tTableLegacySchema,\n])\n\nexport type NestableLegacy
|
|
1
|
+
{"version":3,"file":"nestable.js","names":[],"sources":["../../../src/content/legacy/nestable.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport type { BooleanLegacy } from \"./boolean\"\nimport { BooleanLegacySchema } from \"./boolean\"\nimport type { EmbedLegacy } from \"./embed\"\nimport { EmbedLegacyLooseSchema } from \"./embed\"\nimport type { EmptyLegacy } from \"./empty\"\nimport { EmptyLegacySchema } from \"./empty\"\nimport type { StringLegacy } from \"./field\"\nimport { StringLegacySchema } from \"./field\"\nimport type { GeoPointLegacy } from \"./geopoint\"\nimport { GeoPointLegacySchema } from \"./geopoint\"\nimport type { ImageLegacy } from \"./image\"\nimport { ImageLegacySchema } from \"./image\"\nimport type { IntegrationFieldLegacy } from \"./integrationField\"\nimport { IntegrationFieldLegacySchema } from \"./integrationField\"\nimport type { LinkLegacy } from \"./link\"\nimport { LinkLegacySchema } from \"./link\"\nimport type { RepeatableLegacy } from \"./repeatable\"\nimport { RepeatableLegacySchema } from \"./repeatable\"\nimport type { RichTextLegacy } from \"./richText\"\nimport { RichTextLegacySchema } from \"./richText\"\nimport type { SeparatorLegacy } from \"./separator\"\nimport { SeparatorLegacySchema } from \"./separator\"\nimport type { TableLegacy } from \"./table\"\nimport { TableLegacySchema } from \"./table\"\n\nexport const NestableLegacySchema: z.ZodMiniType<NestableLegacy> = z.union([\n\tEmptyLegacySchema,\n\tBooleanLegacySchema,\n\tEmbedLegacyLooseSchema,\n\tStringLegacySchema,\n\tGeoPointLegacySchema,\n\tImageLegacySchema,\n\tIntegrationFieldLegacySchema,\n\tLinkLegacySchema,\n\tRepeatableLegacySchema,\n\tRichTextLegacySchema,\n\tSeparatorLegacySchema,\n\tTableLegacySchema,\n])\n\nexport type NestableLegacy =\n\t| EmptyLegacy\n\t| BooleanLegacy\n\t| EmbedLegacy\n\t| StringLegacy\n\t| GeoPointLegacy\n\t| ImageLegacy\n\t| IntegrationFieldLegacy\n\t| LinkLegacy\n\t| RepeatableLegacy\n\t| RichTextLegacy\n\t| SeparatorLegacy\n\t| TableLegacy\n"],"mappings":";;;;;;;;;;;;;;AA2BA,MAAa,uBAAsD,EAAE,MAAM;CAC1E;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,CAAC"}
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import { LinkLegacySchema } from "./link.js";
|
|
2
1
|
import { z } from "zod/mini";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return [LinkLegacySchema.parse(item)];
|
|
6
|
-
} catch {
|
|
7
|
-
return [];
|
|
8
|
-
}
|
|
9
|
-
})));
|
|
2
|
+
//#region src/content/legacy/repeatable.ts
|
|
3
|
+
const RepeatableLegacySchema = z.array(z.unknown());
|
|
10
4
|
//#endregion
|
|
11
5
|
export { RepeatableLegacySchema };
|
|
12
6
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repeatable.js","names":[],"sources":["../../../src/content/legacy/repeatable.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\
|
|
1
|
+
{"version":3,"file":"repeatable.js","names":[],"sources":["../../../src/content/legacy/repeatable.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\n// Keep the legacy schema non-lossy; item-level link decoding lives in\n// `codec/repeatable.ts`, where the field model is available.\nexport const RepeatableLegacySchema = z.array(z.unknown())\n\nexport type RepeatableLegacy = z.infer<typeof RepeatableLegacySchema>\n"],"mappings":";;AAIA,MAAa,yBAAyB,EAAE,MAAM,EAAE,SAAS,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { FilledLinkValueContent } from "../link.js";
|
|
2
|
+
import { FilledLinkValueLegacy } from "./link.js";
|
|
3
|
+
import { z } from "zod/mini";
|
|
4
|
+
|
|
5
|
+
//#region src/content/legacy/richText.d.ts
|
|
6
|
+
declare const RichTextNodeType: {
|
|
7
|
+
readonly paragraph: "paragraph";
|
|
8
|
+
readonly heading1: "heading1";
|
|
9
|
+
readonly heading2: "heading2";
|
|
10
|
+
readonly heading3: "heading3";
|
|
11
|
+
readonly heading4: "heading4";
|
|
12
|
+
readonly heading5: "heading5";
|
|
13
|
+
readonly heading6: "heading6";
|
|
14
|
+
readonly preformatted: "preformatted";
|
|
15
|
+
readonly oListItem: "o-list-item";
|
|
16
|
+
readonly listItem: "list-item";
|
|
17
|
+
readonly image: "image";
|
|
18
|
+
readonly embed: "embed";
|
|
19
|
+
readonly hyperlink: "hyperlink";
|
|
20
|
+
readonly strong: "strong";
|
|
21
|
+
readonly em: "em";
|
|
22
|
+
};
|
|
23
|
+
type HyperlinkSpan<TData extends FilledLinkValueLegacy | FilledLinkValueContent> = {
|
|
24
|
+
type: typeof RichTextNodeType.hyperlink;
|
|
25
|
+
start: number;
|
|
26
|
+
end: number;
|
|
27
|
+
data: TData;
|
|
28
|
+
};
|
|
29
|
+
type LabelSpan = {
|
|
30
|
+
type: "label";
|
|
31
|
+
start: number;
|
|
32
|
+
end: number;
|
|
33
|
+
data: string;
|
|
34
|
+
};
|
|
35
|
+
type BasicSpan = {
|
|
36
|
+
type: typeof RichTextNodeType.strong | typeof RichTextNodeType.em | "list-item";
|
|
37
|
+
start: number;
|
|
38
|
+
end: number;
|
|
39
|
+
};
|
|
40
|
+
type Span<TLink extends FilledLinkValueLegacy | FilledLinkValueContent> = HyperlinkSpan<TLink> | LabelSpan | BasicSpan;
|
|
41
|
+
declare const TextBlockLegacySchema: z.ZodMiniObject<{
|
|
42
|
+
type: z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"paragraph">, z.ZodMiniLiteral<"heading1">, z.ZodMiniLiteral<"heading2">, z.ZodMiniLiteral<"heading3">, z.ZodMiniLiteral<"heading4">, z.ZodMiniLiteral<"heading5">, z.ZodMiniLiteral<"heading6">, z.ZodMiniLiteral<"preformatted">, z.ZodMiniLiteral<"o-list-item">, z.ZodMiniLiteral<"list-item">]>;
|
|
43
|
+
content: z.ZodMiniObject<{
|
|
44
|
+
text: z.ZodMiniString<string>;
|
|
45
|
+
spans: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniArray<z.ZodMiniUnknown>, z.ZodMiniTransform<(LabelSpan | BasicSpan | {
|
|
46
|
+
type: "hyperlink";
|
|
47
|
+
start: number;
|
|
48
|
+
end: number;
|
|
49
|
+
data: FilledLinkValueLegacy;
|
|
50
|
+
})[], unknown[]>>>;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
label: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
53
|
+
direction: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
type TextBlockLegacy = z.infer<typeof TextBlockLegacySchema>;
|
|
56
|
+
declare const ImageBlockLegacySchema: z.ZodMiniObject<{
|
|
57
|
+
type: z.ZodMiniLiteral<"image">;
|
|
58
|
+
data: z.ZodMiniObject<{
|
|
59
|
+
origin: z.ZodMiniObject<{
|
|
60
|
+
id: z.ZodMiniString<string>;
|
|
61
|
+
url: z.ZodMiniString<string>;
|
|
62
|
+
width: z.ZodMiniNumber<number>;
|
|
63
|
+
height: z.ZodMiniNumber<number>;
|
|
64
|
+
}, z.core.$strip>;
|
|
65
|
+
width: z.ZodMiniNumber<number>;
|
|
66
|
+
height: z.ZodMiniNumber<number>;
|
|
67
|
+
edit: z.ZodMiniObject<{
|
|
68
|
+
zoom: z.ZodMiniNumber<number>;
|
|
69
|
+
crop: z.ZodMiniObject<{
|
|
70
|
+
x: z.ZodMiniNumber<number>;
|
|
71
|
+
y: z.ZodMiniNumber<number>;
|
|
72
|
+
}, z.core.$strip>;
|
|
73
|
+
background: z.ZodMiniString<string>;
|
|
74
|
+
}, z.core.$strip>;
|
|
75
|
+
url: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
76
|
+
credits: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
|
|
77
|
+
alt: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
|
|
78
|
+
provider: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
79
|
+
linkTo: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniType<FilledLinkValueLegacy, unknown, z.core.$ZodTypeInternals<FilledLinkValueLegacy, unknown>>>>;
|
|
80
|
+
}, z.core.$strip>;
|
|
81
|
+
label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
82
|
+
direction: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
83
|
+
}, z.core.$strip>;
|
|
84
|
+
type ImageBlockLegacy = z.infer<typeof ImageBlockLegacySchema>;
|
|
85
|
+
declare const EmbedBlockLegacySchema: z.ZodMiniObject<{
|
|
86
|
+
type: z.ZodMiniLiteral<"embed">;
|
|
87
|
+
data: z.ZodMiniObject<{
|
|
88
|
+
embed_url: z.ZodMiniString<string>;
|
|
89
|
+
type: z.ZodMiniString<string>;
|
|
90
|
+
version: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNumber<number>]>>>;
|
|
91
|
+
title: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
92
|
+
author_name: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
93
|
+
author_url: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
94
|
+
provider_name: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
95
|
+
provider_url: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
96
|
+
cache_age: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNumber<number>]>>>;
|
|
97
|
+
thumbnail_url: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
98
|
+
thumbnail_width: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniNumber<number>>>;
|
|
99
|
+
thumbnail_height: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniNumber<number>>>;
|
|
100
|
+
html: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
101
|
+
}, z.core.$loose>;
|
|
102
|
+
label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
103
|
+
direction: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
104
|
+
}, z.core.$strip>;
|
|
105
|
+
type EmbedBlockLegacy = z.infer<typeof EmbedBlockLegacySchema>;
|
|
106
|
+
type RichTextLegacyBlock = TextBlockLegacy | ImageBlockLegacy | EmbedBlockLegacy;
|
|
107
|
+
//#endregion
|
|
108
|
+
export { RichTextLegacyBlock, Span };
|
|
109
|
+
//# sourceMappingURL=richText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"richText.d.ts","names":[],"sources":["../../../src/content/legacy/richText.ts"],"mappings":";;;;;cAYa,gBAAA;EAAA;;;;;;;;;;;;;;;;KAmBR,aAAA,eAA4B,qBAAA,GAAwB,sBAAA;EACxD,IAAA,SAAa,gBAAA,CAAiB,SAAA;EAC9B,KAAA;EACA,GAAA;EACA,IAAA,EAAM,KAAA;AAAA;AAAA,KAeF,SAAA;EACJ,IAAA;EACA,KAAA;EACA,GAAA;EACA,IAAA;AAAA;AAAA,KAaI,SAAA;EACJ,IAAA,SAAa,gBAAA,CAAiB,MAAA,UAAgB,gBAAA,CAAiB,EAAA;EAC/D,KAAA;EACA,GAAA;AAAA;AAAA,KAaW,IAAA,eAAmB,qBAAA,GAAwB,sBAAA,IACpD,aAAA,CAAc,KAAA,IACd,SAAA,GACA,SAAA;AAAA,cAsDG,qBAAA,EAAqB,CAAA,CAAA,aAAA;;;;;;;;;;;;;;KAEtB,eAAA,GAAkB,CAAA,CAAE,KAAA,QAAa,qBAAA;AAAA,cAmBhC,sBAAA,EAAsB,CAAA,CAAA,aAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAKvB,gBAAA,GAAmB,CAAA,CAAE,KAAA,QAAa,sBAAA;AAAA,cAgBjC,sBAAA,EAAsB,CAAA,CAAA,aAAA;;;;;;;;;;;;;;;;;;;;KAEvB,gBAAA,GAAmB,CAAA,CAAE,KAAA,QAAa,sBAAA;AAAA,KAS3B,mBAAA,GAAsB,eAAA,GAAkB,gBAAA,GAAmB,gBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"richText.js","names":[],"sources":["../../../src/content/legacy/richText.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\n// It's important to only import the types here to\n// avoid runtime circular dependencies!\nimport type { EmbedContentSchema } from \"../embed\"\nimport type { ImageViewContentSchema } from \"../image\"\nimport type { FilledLinkValueContentSchema } from \"../link\"\nimport { EmbedLegacyLooseSchema } from \"./embed\"\nimport { ImageViewLegacySchema } from \"./image\"\nimport { FilledLinkValueLegacySchema } from \"./link\"\n\nexport const RichTextNodeType = {\n\tparagraph: \"paragraph\",\n\theading1: \"heading1\",\n\theading2: \"heading2\",\n\theading3: \"heading3\",\n\theading4: \"heading4\",\n\theading5: \"heading5\",\n\theading6: \"heading6\",\n\tpreformatted: \"preformatted\",\n\toListItem: \"o-list-item\",\n\tlistItem: \"list-item\",\n\timage: \"image\",\n\tembed: \"embed\",\n\thyperlink: \"hyperlink\",\n\tstrong: \"strong\",\n\tem: \"em\",\n} as const\n\n// Spans\nconst getHyperlinkSpanSchema = <\n\tTData extends typeof FilledLinkValueLegacySchema | typeof FilledLinkValueContentSchema,\n>(\n\tdata: TData,\n) =>\n\tz.object({\n\t\ttype: z.literal(RichTextNodeType.hyperlink),\n\t\tstart: z.number(),\n\t\tend: z.number(),\n\t\tdata,\n\t})\n\nconst LabelSpanSchema = z.object({\n\ttype: z.literal(\"label\"),\n\tstart: z.number(),\n\tend: z.number(),\n\tdata: z.pipe(\n\t\tz.unknown(),\n\t\tz.transform((value) => (typeof value === \"string\" && value.length > 0 ? value : \"\")),\n\t),\n})\n\nconst BasicSpanSchema = z.object({\n\ttype: z.union([\n\t\tz.literal(RichTextNodeType.strong),\n\t\tz.literal(RichTextNodeType.em),\n\t\tz.literal(\"list-item\"), // legacy case\n\t]),\n\tstart: z.number(),\n\tend: z.number(),\n})\n\n// oxlint-disable-next-line explicit-module-boundary-types\nexport const getSpanSchema = <\n\tTLinkSchema extends typeof FilledLinkValueLegacySchema | typeof FilledLinkValueContentSchema,\n>(\n\tlinkSchema: TLinkSchema,\n) => z.union([getHyperlinkSpanSchema(linkSchema), LabelSpanSchema, BasicSpanSchema])\n\n// Text blocks\nconst TextBlockTypeSchema = z.union([\n\tz.literal(RichTextNodeType.paragraph),\n\tz.literal(RichTextNodeType.heading1),\n\tz.literal(RichTextNodeType.heading2),\n\tz.literal(RichTextNodeType.heading3),\n\tz.literal(RichTextNodeType.heading4),\n\tz.literal(RichTextNodeType.heading5),\n\tz.literal(RichTextNodeType.heading6),\n\tz.literal(RichTextNodeType.preformatted),\n\tz.literal(RichTextNodeType.oListItem),\n\tz.literal(RichTextNodeType.listItem),\n])\n\n// oxlint-disable-next-line explicit-module-boundary-types\nexport const getTextBlockSchema = <\n\tTLinkSchema extends typeof FilledLinkValueLegacySchema | typeof FilledLinkValueContentSchema,\n>(\n\tlinkSchema: TLinkSchema,\n) =>\n\tz.object({\n\t\ttype: TextBlockTypeSchema,\n\t\tcontent: z.object({\n\t\t\ttext: z.string(),\n\t\t\tspans: z.optional(\n\t\t\t\tz.pipe(\n\t\t\t\t\tz.array(z.unknown()),\n\t\t\t\t\tz.transform((spans) => {\n\t\t\t\t\t\tconst spanSchema = getSpanSchema(linkSchema)\n\n\t\t\t\t\t\t// Filter out invalid spans and order them by start position\n\t\t\t\t\t\treturn spans\n\t\t\t\t\t\t\t.flatMap((maybeSpan) => {\n\t\t\t\t\t\t\t\tconst parsed = spanSchema.safeParse(maybeSpan)\n\t\t\t\t\t\t\t\treturn parsed.success ? [parsed.data] : []\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.sort((a, b) => a.start - b.start)\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t),\n\t\t}),\n\t\tlabel: z.optional(z.string()),\n\t\tdirection: z.optional(z.string()),\n\t})\n\nconst TextBlockLegacySchema = getTextBlockSchema(FilledLinkValueLegacySchema)\n\n// Image block\n\n// oxlint-disable-next-line explicit-module-boundary-types\nexport const getImageBlockSchema = <\n\tTData extends typeof ImageViewLegacySchema | typeof ImageViewContentSchema,\n\tTLinkTo extends typeof FilledLinkValueLegacySchema | typeof FilledLinkValueContentSchema,\n>(\n\tdata: TData,\n\tlinkTo: TLinkTo,\n) =>\n\tz.object({\n\t\ttype: z.literal(RichTextNodeType.image),\n\t\tdata: z.extend(data, { linkTo: z.nullish(linkTo) }),\n\t\tlabel: z.nullish(z.string()),\n\t\tdirection: z.nullish(z.string()),\n\t})\n\nconst ImageBlockLegacySchema = getImageBlockSchema(\n\tImageViewLegacySchema,\n\tFilledLinkValueLegacySchema,\n)\n\n// Embed block\n// oxlint-disable-next-line explicit-module-boundary-types\nexport const getEmbedBlockSchema = <\n\tTData extends typeof EmbedLegacyLooseSchema | typeof EmbedContentSchema,\n>(\n\tdata: TData,\n) =>\n\tz.object({\n\t\ttype: z.literal(RichTextNodeType.embed),\n\t\tdata,\n\t\tlabel: z.nullish(z.string()),\n\t\tdirection: z.nullish(z.string()),\n\t})\n\nconst EmbedBlockLegacySchema = getEmbedBlockSchema(EmbedLegacyLooseSchema)\n\n// Blocks\nexport const RichTextLegacyBlockSchema = z.union([\n\tTextBlockLegacySchema,\n\tImageBlockLegacySchema,\n\tEmbedBlockLegacySchema,\n])\n\nexport type RichTextLegacyBlock =
|
|
1
|
+
{"version":3,"file":"richText.js","names":[],"sources":["../../../src/content/legacy/richText.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\n// It's important to only import the types here to\n// avoid runtime circular dependencies!\nimport type { EmbedContentSchema } from \"../embed\"\nimport type { ImageViewContentSchema } from \"../image\"\nimport type { FilledLinkValueContent, FilledLinkValueContentSchema } from \"../link\"\nimport { EmbedLegacyLooseSchema } from \"./embed\"\nimport { ImageViewLegacySchema } from \"./image\"\nimport { FilledLinkValueLegacySchema } from \"./link\"\nimport type { FilledLinkValueLegacy } from \"./link\"\n\nexport const RichTextNodeType = {\n\tparagraph: \"paragraph\",\n\theading1: \"heading1\",\n\theading2: \"heading2\",\n\theading3: \"heading3\",\n\theading4: \"heading4\",\n\theading5: \"heading5\",\n\theading6: \"heading6\",\n\tpreformatted: \"preformatted\",\n\toListItem: \"o-list-item\",\n\tlistItem: \"list-item\",\n\timage: \"image\",\n\tembed: \"embed\",\n\thyperlink: \"hyperlink\",\n\tstrong: \"strong\",\n\tem: \"em\",\n} as const\n\n// Spans\ntype HyperlinkSpan<TData extends FilledLinkValueLegacy | FilledLinkValueContent> = {\n\ttype: typeof RichTextNodeType.hyperlink\n\tstart: number\n\tend: number\n\tdata: TData\n}\n\nconst getHyperlinkSpanSchema = <\n\tTData extends typeof FilledLinkValueLegacySchema | typeof FilledLinkValueContentSchema,\n>(\n\tdata: TData,\n) =>\n\tz.object({\n\t\ttype: z.literal(RichTextNodeType.hyperlink),\n\t\tstart: z.number(),\n\t\tend: z.number(),\n\t\tdata,\n\t})\n\ntype LabelSpan = {\n\ttype: \"label\"\n\tstart: number\n\tend: number\n\tdata: string\n}\n\nconst LabelSpanSchema: z.ZodMiniType<LabelSpan> = z.object({\n\ttype: z.literal(\"label\"),\n\tstart: z.number(),\n\tend: z.number(),\n\tdata: z.pipe(\n\t\tz.unknown(),\n\t\tz.transform((value) => (typeof value === \"string\" && value.length > 0 ? value : \"\")),\n\t),\n})\n\ntype BasicSpan = {\n\ttype: typeof RichTextNodeType.strong | typeof RichTextNodeType.em | \"list-item\"\n\tstart: number\n\tend: number\n}\n\nconst BasicSpanSchema: z.ZodMiniType<BasicSpan> = z.object({\n\ttype: z.union([\n\t\tz.literal(RichTextNodeType.strong),\n\t\tz.literal(RichTextNodeType.em),\n\t\tz.literal(\"list-item\"), // legacy case\n\t]),\n\tstart: z.number(),\n\tend: z.number(),\n})\n\nexport type Span<TLink extends FilledLinkValueLegacy | FilledLinkValueContent> =\n\t| HyperlinkSpan<TLink>\n\t| LabelSpan\n\t| BasicSpan\n\n// oxlint-disable-next-line explicit-module-boundary-types\nexport const getSpanSchema = <\n\tTLinkSchema extends typeof FilledLinkValueLegacySchema | typeof FilledLinkValueContentSchema,\n>(\n\tlinkSchema: TLinkSchema,\n) => z.union([getHyperlinkSpanSchema(linkSchema), LabelSpanSchema, BasicSpanSchema])\n\n// Text blocks\nconst TextBlockTypeSchema = z.union([\n\tz.literal(RichTextNodeType.paragraph),\n\tz.literal(RichTextNodeType.heading1),\n\tz.literal(RichTextNodeType.heading2),\n\tz.literal(RichTextNodeType.heading3),\n\tz.literal(RichTextNodeType.heading4),\n\tz.literal(RichTextNodeType.heading5),\n\tz.literal(RichTextNodeType.heading6),\n\tz.literal(RichTextNodeType.preformatted),\n\tz.literal(RichTextNodeType.oListItem),\n\tz.literal(RichTextNodeType.listItem),\n])\n\n// oxlint-disable-next-line explicit-module-boundary-types\nexport const getTextBlockSchema = <\n\tTLinkSchema extends typeof FilledLinkValueLegacySchema | typeof FilledLinkValueContentSchema,\n>(\n\tlinkSchema: TLinkSchema,\n) =>\n\tz.object({\n\t\ttype: TextBlockTypeSchema,\n\t\tcontent: z.object({\n\t\t\ttext: z.string(),\n\t\t\tspans: z.optional(\n\t\t\t\tz.pipe(\n\t\t\t\t\tz.array(z.unknown()),\n\t\t\t\t\tz.transform((spans) => {\n\t\t\t\t\t\tconst spanSchema = getSpanSchema(linkSchema)\n\n\t\t\t\t\t\t// Filter out invalid spans and order them by start position\n\t\t\t\t\t\treturn spans\n\t\t\t\t\t\t\t.flatMap((maybeSpan) => {\n\t\t\t\t\t\t\t\tconst parsed = spanSchema.safeParse(maybeSpan)\n\t\t\t\t\t\t\t\treturn parsed.success ? [parsed.data] : []\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.sort((a, b) => a.start - b.start)\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t),\n\t\t}),\n\t\tlabel: z.optional(z.string()),\n\t\tdirection: z.optional(z.string()),\n\t})\n\nconst TextBlockLegacySchema = getTextBlockSchema(FilledLinkValueLegacySchema)\n\ntype TextBlockLegacy = z.infer<typeof TextBlockLegacySchema>\n\n// Image block\n\n// oxlint-disable-next-line explicit-module-boundary-types\nexport const getImageBlockSchema = <\n\tTData extends typeof ImageViewLegacySchema | typeof ImageViewContentSchema,\n\tTLinkTo extends typeof FilledLinkValueLegacySchema | typeof FilledLinkValueContentSchema,\n>(\n\tdata: TData,\n\tlinkTo: TLinkTo,\n) =>\n\tz.object({\n\t\ttype: z.literal(RichTextNodeType.image),\n\t\tdata: z.extend(data, { linkTo: z.nullish(linkTo) }),\n\t\tlabel: z.nullish(z.string()),\n\t\tdirection: z.nullish(z.string()),\n\t})\n\nconst ImageBlockLegacySchema = getImageBlockSchema(\n\tImageViewLegacySchema,\n\tFilledLinkValueLegacySchema,\n)\n\ntype ImageBlockLegacy = z.infer<typeof ImageBlockLegacySchema>\n\n// Embed block\n// oxlint-disable-next-line explicit-module-boundary-types\nexport const getEmbedBlockSchema = <\n\tTData extends typeof EmbedLegacyLooseSchema | typeof EmbedContentSchema,\n>(\n\tdata: TData,\n) =>\n\tz.object({\n\t\ttype: z.literal(RichTextNodeType.embed),\n\t\tdata,\n\t\tlabel: z.nullish(z.string()),\n\t\tdirection: z.nullish(z.string()),\n\t})\n\nconst EmbedBlockLegacySchema = getEmbedBlockSchema(EmbedLegacyLooseSchema)\n\ntype EmbedBlockLegacy = z.infer<typeof EmbedBlockLegacySchema>\n\n// Blocks\nexport const RichTextLegacyBlockSchema: z.ZodMiniType<RichTextLegacyBlock> = z.union([\n\tTextBlockLegacySchema,\n\tImageBlockLegacySchema,\n\tEmbedBlockLegacySchema,\n])\n\nexport type RichTextLegacyBlock = TextBlockLegacy | ImageBlockLegacy | EmbedBlockLegacy\n\nexport const RichTextLegacySchema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A;CACA;CACA,CAAC;AAIF,MAAa,uBAAuB,EAAE,MAAM,0BAA0B"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { NestableLegacySchema } from "./nestable.js";
|
|
2
1
|
import { GroupItemLegacySchema, NestableAndGroupLegacySchema } from "./group.js";
|
|
3
2
|
import { z } from "zod/mini";
|
|
4
3
|
//#region src/content/legacy/slice.ts
|
|
5
4
|
const LegacySliceLegacySchema = NestableAndGroupLegacySchema;
|
|
6
5
|
const CompositeSliceLegacySchema = z.object({
|
|
7
|
-
"non-repeat": z.optional(z.record(z.string(),
|
|
6
|
+
"non-repeat": z.optional(z.record(z.string(), z.unknown())),
|
|
8
7
|
repeat: z.optional(z.array(GroupItemLegacySchema))
|
|
9
8
|
});
|
|
10
9
|
const SharedSliceLegacySchema = z.object({
|
|
11
10
|
variation: z.string(),
|
|
12
|
-
primary: z.transform((value) => z.record(z.string(),
|
|
11
|
+
primary: z.transform((value) => z.record(z.string(), z.unknown()).safeParse(value).data || {}),
|
|
13
12
|
items: z.transform((value) => z.array(GroupItemLegacySchema).safeParse(value).data || [])
|
|
14
13
|
});
|
|
15
14
|
const SliceLegacySchema = z.union([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slice.js","names":[],"sources":["../../../src/content/legacy/slice.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { GroupItemLegacySchema, NestableAndGroupLegacySchema } from \"./group\"\
|
|
1
|
+
{"version":3,"file":"slice.js","names":[],"sources":["../../../src/content/legacy/slice.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { GroupItemLegacySchema, NestableAndGroupLegacySchema } from \"./group\"\n\n// Legacy (before 2020)\nexport const LegacySliceLegacySchema = NestableAndGroupLegacySchema\n\nexport type LegacySliceLegacy = z.infer<typeof LegacySliceLegacySchema>\n\n// Composite (2020 to 2021)\n// Keep non-repeat values raw here: array-shaped legacy payloads are ambiguous until\n// `codec/slice.ts` resolves the field model and picks the right decoder.\nexport const CompositeSliceLegacySchema = z.object({\n\t\"non-repeat\": z.optional(z.record(z.string(), z.unknown())),\n\trepeat: z.optional(z.array(GroupItemLegacySchema)),\n})\n\nexport type CompositeSliceLegacy = z.infer<typeof CompositeSliceLegacySchema>\n\n// Shared (2021 to present)\n// Keep primary values raw here: array-shaped legacy payloads are ambiguous until\n// `codec/slice.ts` resolves the field model and picks the right decoder.\nexport const SharedSliceLegacySchema = z.object({\n\tvariation: z.string(),\n\tprimary: z.transform((value) => z.record(z.string(), z.unknown()).safeParse(value).data || {}),\n\titems: z.transform((value) => z.array(GroupItemLegacySchema).safeParse(value).data || []),\n})\n\nexport type SharedSliceLegacy = z.infer<typeof SharedSliceLegacySchema>\n\n// All\nexport const SliceLegacySchema: z.ZodMiniType<SliceLegacy> = z.union([\n\tLegacySliceLegacySchema,\n\tCompositeSliceLegacySchema,\n\tSharedSliceLegacySchema,\n])\n\nexport type SliceLegacy = LegacySliceLegacy | CompositeSliceLegacy | SharedSliceLegacy\n"],"mappings":";;;AAKA,MAAa,0BAA0B;AAOvC,MAAa,6BAA6B,EAAE,OAAO;CAClD,cAAc,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,SAAS,CAAC,CAAC;CAC3D,QAAQ,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;CAClD,CAAC;AAOF,MAAa,0BAA0B,EAAE,OAAO;CAC/C,WAAW,EAAE,QAAQ;CACrB,SAAS,EAAE,WAAW,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,SAAS,CAAC,CAAC,UAAU,MAAM,CAAC,QAAQ,EAAE,CAAC;CAC9F,OAAO,EAAE,WAAW,UAAU,EAAE,MAAM,sBAAsB,CAAC,UAAU,MAAM,CAAC,QAAQ,EAAE,CAAC;CACzF,CAAC;AAKF,MAAa,oBAAgD,EAAE,MAAM;CACpE;CACA;CACA;CACA,CAAC"}
|