@prismicio/types-internal 4.1.0 → 4.2.0-pr.13.0d96267

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.
Files changed (83) hide show
  1. package/dist/content/field.js +1 -1
  2. package/dist/content/field.js.map +1 -1
  3. package/dist/content/group.d.ts +1 -2
  4. package/dist/content/group.d.ts.map +1 -1
  5. package/dist/content/group.js +1 -1
  6. package/dist/content/group.js.map +1 -1
  7. package/dist/content/legacy/link.d.ts +4 -4
  8. package/dist/content/legacy/link.js +4 -4
  9. package/dist/content/legacy/link.js.map +1 -1
  10. package/dist/content/legacy/richText.d.ts +23 -12
  11. package/dist/content/legacy/richText.d.ts.map +1 -1
  12. package/dist/content/legacy/richText.js +2 -2
  13. package/dist/content/legacy/richText.js.map +1 -1
  14. package/dist/content/link.d.ts +4 -4
  15. package/dist/content/nestable.d.ts +3 -3
  16. package/dist/content/nestable.d.ts.map +1 -1
  17. package/dist/content/nestable.js +3 -9
  18. package/dist/content/nestable.js.map +1 -1
  19. package/dist/content/richText.d.ts +1 -1
  20. package/dist/content/richText.d.ts.map +1 -1
  21. package/dist/content/richText.js +1 -1
  22. package/dist/content/richText.js.map +1 -1
  23. package/dist/content/slice.d.ts +507 -5
  24. package/dist/content/slice.d.ts.map +1 -1
  25. package/dist/content/slice.js +1 -1
  26. package/dist/content/slice.js.map +1 -1
  27. package/dist/content/slices.d.ts +507 -5
  28. package/dist/content/slices.d.ts.map +1 -1
  29. package/dist/content/table.d.ts +5 -2
  30. package/dist/content/table.d.ts.map +1 -1
  31. package/dist/content/widget.js +1 -1
  32. package/dist/content/widget.js.map +1 -1
  33. package/dist/helpers/customTypeModel.d.ts +4 -5
  34. package/dist/helpers/customTypeModel.d.ts.map +1 -1
  35. package/dist/helpers/customTypeModel.js.map +1 -1
  36. package/dist/index.d.ts +6 -7
  37. package/dist/io-ts.d.ts +5138 -1917
  38. package/dist/io-ts.d.ts.map +1 -1
  39. package/dist/io-ts.js +7 -6
  40. package/dist/io-ts.js.map +1 -1
  41. package/dist/model/customType.d.ts +9 -3
  42. package/dist/model/customType.d.ts.map +1 -1
  43. package/dist/model/customType.js +42 -5
  44. package/dist/model/customType.js.map +1 -1
  45. package/dist/model/group.d.ts +2 -2
  46. package/dist/model/group.js +1 -1
  47. package/dist/model/group.js.map +1 -1
  48. package/dist/model/nestable.js +1 -1
  49. package/dist/model/nestable.js.map +1 -1
  50. package/dist/model/slice.d.ts +10 -10
  51. package/dist/model/slice.d.ts.map +1 -1
  52. package/dist/model/slice.js +12 -6
  53. package/dist/model/slice.js.map +1 -1
  54. package/dist/model/widget.d.ts.map +1 -1
  55. package/dist/model/widget.js +2 -2
  56. package/dist/model/widget.js.map +1 -1
  57. package/dist/zod4.d.ts +1814 -249
  58. package/dist/zod4.d.ts.map +1 -1
  59. package/dist/zod4.js +7 -6
  60. package/dist/zod4.js.map +1 -1
  61. package/package.json +9 -6
  62. package/src/content/field.ts +1 -1
  63. package/src/content/group.ts +1 -1
  64. package/src/content/legacy/link.ts +4 -4
  65. package/src/content/legacy/richText.ts +14 -21
  66. package/src/content/nestable.ts +3 -18
  67. package/src/content/richText.ts +9 -6
  68. package/src/content/slice.ts +1 -1
  69. package/src/content/widget.ts +1 -1
  70. package/src/helpers/customTypeModel.ts +8 -5
  71. package/src/index.ts +7 -2
  72. package/src/io-ts.ts +8 -8
  73. package/src/model/customType.ts +72 -17
  74. package/src/model/group.ts +1 -1
  75. package/src/model/nestable.ts +1 -1
  76. package/src/model/slice.ts +36 -25
  77. package/src/model/widget.ts +8 -12
  78. package/src/zod4.ts +8 -8
  79. package/dist/model/section.d.ts +0 -11
  80. package/dist/model/section.d.ts.map +0 -1
  81. package/dist/model/section.js +0 -10
  82. package/dist/model/section.js.map +0 -1
  83. package/src/model/section.ts +0 -12
@@ -37,7 +37,7 @@ const SelectContentSchema = z.object({
37
37
  value: z.string().check(z.trim()),
38
38
  __TYPE__: z.literal(FieldContentType)
39
39
  });
40
- const FieldContentSchema = z.union([
40
+ const FieldContentSchema = z.discriminatedUnion("type", [
41
41
  TextContentSchema,
42
42
  ColorContentSchema,
43
43
  DateContentSchema,
@@ -1 +1 @@
1
- {"version":3,"file":"field.js","names":[],"sources":["../../src/content/field.ts"],"sourcesContent":["import { z } from \"zod/mini\"\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"],"mappings":";;AAEA,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"}
1
+ {"version":3,"file":"field.js","names":[],"sources":["../../src/content/field.ts"],"sourcesContent":["import { z } from \"zod/mini\"\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.discriminatedUnion(\"type\", [\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"],"mappings":";;AAEA,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,qBAAqB,EAAE,mBAAmB,QAAQ;CAC9D;CACA;CACA;CACA;CACA;CACA;CACA;CACA,CAAC"}
@@ -13,7 +13,6 @@ 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;
17
16
  //#endregion
18
- export { GroupContent, GroupItemContent, NestableAndGroupContent };
17
+ export { GroupContent, GroupItemContent };
19
18
  //# sourceMappingURL=group.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"group.d.ts","names":[],"sources":["../../src/content/group.ts"],"mappings":";;;;cAMa,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
+ {"version":3,"file":"group.d.ts","names":[],"sources":["../../src/content/group.ts"],"mappings":";;;;cAMa,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"}
@@ -12,7 +12,7 @@ const GroupContentSchema = z.object({
12
12
  __TYPE__: z.literal(GroupContentType),
13
13
  value: z.array(GroupItemContentSchema)
14
14
  });
15
- const NestableAndGroupContentSchema = z.union([NestableContentSchema, GroupContentSchema]);
15
+ const NestableAndGroupContentSchema = z.discriminatedUnion("__TYPE__", [NestableContentSchema, GroupContentSchema]);
16
16
  //#endregion
17
17
  export { GroupContentSchema, GroupContentType, GroupItemContentSchema, GroupItemContentType, NestableAndGroupContentSchema };
18
18
 
@@ -1 +1 @@
1
- {"version":3,"file":"group.js","names":[],"sources":["../../src/content/group.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { 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"],"mappings":";;;AAMA,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"}
1
+ {"version":3,"file":"group.js","names":[],"sources":["../../src/content/group.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { 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.discriminatedUnion(\"__TYPE__\", [\n\tNestableContentSchema,\n\tGroupContentSchema,\n])\n\nexport type NestableAndGroupContent = NestableContent | GroupContent\n"],"mappings":";;;AAMA,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,gCAAgC,EAAE,mBAAmB,YAAY,CAC7E,uBACA,mBACA,CAAC"}
@@ -10,7 +10,7 @@ declare const FilledImageLinkLegacyValueSchema: z.ZodMiniObject<{
10
10
  size: z.ZodMiniString<string>;
11
11
  name: z.ZodMiniString<string>;
12
12
  date: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
13
- }, z.core.$strict>;
13
+ }, z.core.$strip>;
14
14
  declare const FilledFileLinkLegacyValueSchema: z.ZodMiniObject<{
15
15
  kind: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<"file", string>>;
16
16
  id: z.ZodMiniString<string>;
@@ -18,11 +18,11 @@ declare const FilledFileLinkLegacyValueSchema: z.ZodMiniObject<{
18
18
  name: z.ZodMiniString<string>;
19
19
  size: z.ZodMiniTransform<string, unknown>;
20
20
  date: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
21
- }, z.core.$strict>;
21
+ }, z.core.$strip>;
22
22
  declare const FilledDocumentLinkLegacyValueSchema: z.ZodMiniObject<{
23
23
  kind: z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniLiteral<"document">>, z.ZodMiniTransform<"document", "document" | undefined>>;
24
24
  id: z.ZodMiniString<string>;
25
- }, z.core.$strict>;
25
+ }, z.core.$strip>;
26
26
  declare const FilledExternalLinkLegacyValueSchema: z.ZodMiniObject<{
27
27
  kind: z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniLiteral<"web">>, z.ZodMiniTransform<"web", "web" | undefined>>;
28
28
  url: z.ZodMiniString<string>;
@@ -30,7 +30,7 @@ declare const FilledExternalLinkLegacyValueSchema: z.ZodMiniObject<{
30
30
  preview: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniObject<{
31
31
  title: z.ZodMiniOptional<z.ZodMiniString<string>>;
32
32
  }, z.core.$strict>>>;
33
- }, z.core.$strict>;
33
+ }, z.core.$strip>;
34
34
  type FilledImageLinkLegacyValue = z.infer<typeof FilledImageLinkLegacyValueSchema>;
35
35
  type FilledFileLinkLegacyValue = z.infer<typeof FilledFileLinkLegacyValueSchema>;
36
36
  type FilledDocumentLinkLegacyValue = z.infer<typeof FilledDocumentLinkLegacyValueSchema>;
@@ -17,7 +17,7 @@ const LinkType = {
17
17
  Media: "MediaLink",
18
18
  Any: "AnyLink"
19
19
  };
20
- const FilledImageLinkLegacyValueSchema = z.strictObject({
20
+ const FilledImageLinkLegacyValueSchema = z.object({
21
21
  kind: z.pipe(z.string(), z.transform(() => LinkKind.Image)),
22
22
  id: z.string(),
23
23
  url: z.string(),
@@ -28,7 +28,7 @@ const FilledImageLinkLegacyValueSchema = z.strictObject({
28
28
  date: z.nullish(z.string())
29
29
  });
30
30
  const EmptyImageLinkLegacyValueSchema = z.strictObject({ kind: z.literal(LinkKind.Image) });
31
- const FilledFileLinkLegacyValueSchema = z.strictObject({
31
+ const FilledFileLinkLegacyValueSchema = z.object({
32
32
  kind: z.pipe(z.string(), z.transform(() => LinkKind.File)),
33
33
  id: z.string(),
34
34
  url: z.string(),
@@ -38,12 +38,12 @@ const FilledFileLinkLegacyValueSchema = z.strictObject({
38
38
  });
39
39
  const EmptyFileLinkLegacyValueSchema = z.strictObject({ kind: z.literal(LinkKind.File) });
40
40
  const EmptyMediaLinkLegacyValueSchema = z.strictObject({ kind: z.literal(LinkKind.Media) });
41
- const FilledDocumentLinkLegacyValueSchema = z.strictObject({
41
+ const FilledDocumentLinkLegacyValueSchema = z.object({
42
42
  kind: z.pipe(z.optional(z.literal(LinkKind.Document)), z.transform(() => LinkKind.Document)),
43
43
  id: NonEmptyStringSchema
44
44
  });
45
45
  const EmptyDocumentLinkLegacyValueSchema = z.strictObject({ kind: z.literal(LinkKind.Document) });
46
- const FilledExternalLinkLegacyValueSchema = z.strictObject({
46
+ const FilledExternalLinkLegacyValueSchema = z.object({
47
47
  kind: z.pipe(z.optional(z.literal(LinkKind.External)), z.transform(() => LinkKind.External)),
48
48
  url: z.string(),
49
49
  target: z.nullish(z.string()),
@@ -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 FilledImageLinkLegacyValueSchema = 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 EmptyImageLinkLegacyValueSchema = z.strictObject({\n\tkind: z.literal(LinkKind.Image),\n})\n\n// File\nexport const FilledFileLinkLegacyValueSchema = 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 EmptyFileLinkLegacyValueSchema = 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 EmptyMediaLinkLegacyValueSchema = z.strictObject({\n\tkind: z.literal(LinkKind.Media),\n})\n\n// Document\nexport const FilledDocumentLinkLegacyValueSchema = 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 EmptyDocumentLinkLegacyValueSchema = z.strictObject({\n\tkind: z.literal(LinkKind.Document),\n})\n\n// External\nexport const FilledExternalLinkLegacyValueSchema = 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 EmptyExternalLinkLegacyValueSchema = 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 FilledLinkLegacyValueSchema: z.ZodMiniType<FilledLinkLegacyValue> = z.union([\n\tFilledImageLinkLegacyValueSchema,\n\tFilledFileLinkLegacyValueSchema,\n\tFilledDocumentLinkLegacyValueSchema,\n\tFilledExternalLinkLegacyValueSchema,\n])\n\ntype FilledImageLinkLegacyValue = z.infer<typeof FilledImageLinkLegacyValueSchema>\ntype FilledFileLinkLegacyValue = z.infer<typeof FilledFileLinkLegacyValueSchema>\ntype FilledDocumentLinkLegacyValue = z.infer<typeof FilledDocumentLinkLegacyValueSchema>\ntype FilledExternalLinkLegacyValue = z.infer<typeof FilledExternalLinkLegacyValueSchema>\nexport type FilledLinkLegacyValue =\n\t| FilledImageLinkLegacyValue\n\t| FilledFileLinkLegacyValue\n\t| FilledDocumentLinkLegacyValue\n\t| FilledExternalLinkLegacyValue\n\nconst EmptyLinkLegacyValueSchema: z.ZodMiniType<EmptyLinkLegacyValue> = z.union([\n\tEmptyImageLinkLegacyValueSchema,\n\tEmptyFileLinkLegacyValueSchema,\n\tEmptyMediaLinkLegacyValueSchema,\n\tEmptyDocumentLinkLegacyValueSchema,\n\tEmptyExternalLinkLegacyValueSchema,\n\tAnyLinkLegacySchema,\n])\n\ntype EmptyImageLinkLegacyValue = z.infer<typeof EmptyImageLinkLegacyValueSchema>\ntype EmptyFileLinkLegacyValue = z.infer<typeof EmptyFileLinkLegacyValueSchema>\ntype EmptyMediaLinkLegacyValue = z.infer<typeof EmptyMediaLinkLegacyValueSchema>\ntype EmptyDocumentLinkLegacyValue = z.infer<typeof EmptyDocumentLinkLegacyValueSchema>\ntype EmptyExternalLinkLegacyValue = z.infer<typeof EmptyExternalLinkLegacyValueSchema>\ntype AnyLinkLegacy = z.infer<typeof AnyLinkLegacySchema>\nexport type EmptyLinkLegacyValue =\n\t| EmptyImageLinkLegacyValue\n\t| EmptyFileLinkLegacyValue\n\t| EmptyMediaLinkLegacyValue\n\t| EmptyDocumentLinkLegacyValue\n\t| EmptyExternalLinkLegacyValue\n\t| AnyLinkLegacy\n\nconst LinkLegacyValueSchema: z.ZodMiniType<LinkLegacyValue> = z.union([\n\tFilledLinkLegacyValueSchema,\n\tEmptyLinkLegacyValueSchema,\n])\n\nexport type LinkLegacyValue = FilledLinkLegacyValue | EmptyLinkLegacyValue\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: LinkLegacyValueSchema as z.ZodMiniType<LinkLegacyValue, 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;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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 FilledImageLinkLegacyValueSchema = z.object({\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 EmptyImageLinkLegacyValueSchema = z.strictObject({\n\tkind: z.literal(LinkKind.Image),\n})\n\n// File\nexport const FilledFileLinkLegacyValueSchema = z.object({\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 EmptyFileLinkLegacyValueSchema = 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 EmptyMediaLinkLegacyValueSchema = z.strictObject({\n\tkind: z.literal(LinkKind.Media),\n})\n\n// Document\nexport const FilledDocumentLinkLegacyValueSchema = z.object({\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 EmptyDocumentLinkLegacyValueSchema = z.strictObject({\n\tkind: z.literal(LinkKind.Document),\n})\n\n// External\nexport const FilledExternalLinkLegacyValueSchema = z.object({\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 EmptyExternalLinkLegacyValueSchema = 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 FilledLinkLegacyValueSchema: z.ZodMiniType<FilledLinkLegacyValue> = z.union([\n\tFilledImageLinkLegacyValueSchema,\n\tFilledFileLinkLegacyValueSchema,\n\tFilledDocumentLinkLegacyValueSchema,\n\tFilledExternalLinkLegacyValueSchema,\n])\n\ntype FilledImageLinkLegacyValue = z.infer<typeof FilledImageLinkLegacyValueSchema>\ntype FilledFileLinkLegacyValue = z.infer<typeof FilledFileLinkLegacyValueSchema>\ntype FilledDocumentLinkLegacyValue = z.infer<typeof FilledDocumentLinkLegacyValueSchema>\ntype FilledExternalLinkLegacyValue = z.infer<typeof FilledExternalLinkLegacyValueSchema>\nexport type FilledLinkLegacyValue =\n\t| FilledImageLinkLegacyValue\n\t| FilledFileLinkLegacyValue\n\t| FilledDocumentLinkLegacyValue\n\t| FilledExternalLinkLegacyValue\n\nconst EmptyLinkLegacyValueSchema: z.ZodMiniType<EmptyLinkLegacyValue> = z.union([\n\tEmptyImageLinkLegacyValueSchema,\n\tEmptyFileLinkLegacyValueSchema,\n\tEmptyMediaLinkLegacyValueSchema,\n\tEmptyDocumentLinkLegacyValueSchema,\n\tEmptyExternalLinkLegacyValueSchema,\n\tAnyLinkLegacySchema,\n])\n\ntype EmptyImageLinkLegacyValue = z.infer<typeof EmptyImageLinkLegacyValueSchema>\ntype EmptyFileLinkLegacyValue = z.infer<typeof EmptyFileLinkLegacyValueSchema>\ntype EmptyMediaLinkLegacyValue = z.infer<typeof EmptyMediaLinkLegacyValueSchema>\ntype EmptyDocumentLinkLegacyValue = z.infer<typeof EmptyDocumentLinkLegacyValueSchema>\ntype EmptyExternalLinkLegacyValue = z.infer<typeof EmptyExternalLinkLegacyValueSchema>\ntype AnyLinkLegacy = z.infer<typeof AnyLinkLegacySchema>\nexport type EmptyLinkLegacyValue =\n\t| EmptyImageLinkLegacyValue\n\t| EmptyFileLinkLegacyValue\n\t| EmptyMediaLinkLegacyValue\n\t| EmptyDocumentLinkLegacyValue\n\t| EmptyExternalLinkLegacyValue\n\t| AnyLinkLegacy\n\nconst LinkLegacyValueSchema: z.ZodMiniType<LinkLegacyValue> = z.union([\n\tFilledLinkLegacyValueSchema,\n\tEmptyLinkLegacyValueSchema,\n])\n\nexport type LinkLegacyValue = FilledLinkLegacyValue | EmptyLinkLegacyValue\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: LinkLegacyValueSchema as z.ZodMiniType<LinkLegacyValue, 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,OAAO;CAExD,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,OAAO;CAEvD,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,E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AAE,QAAQ,CAAC;CAC5B,SAAS,EAAE,SAAS,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"}
@@ -27,23 +27,34 @@ type HyperlinkSpan<TData extends FilledLinkLegacyValue | FilledLinkContentValue>
27
27
  end: number;
28
28
  data: TData;
29
29
  };
30
- type LabelSpan = {
31
- type: "label";
32
- start: number;
33
- end: number;
34
- data: string;
35
- };
36
- type BasicSpan = {
37
- type: typeof RichTextNodeType.strong | typeof RichTextNodeType.em | "list-item";
38
- start: number;
39
- end: number;
40
- };
30
+ declare const LabelSpanSchema: z.ZodMiniObject<{
31
+ type: z.ZodMiniLiteral<"label">;
32
+ start: z.ZodMiniNumber<number>;
33
+ end: z.ZodMiniNumber<number>;
34
+ data: z.ZodMiniPipe<z.ZodMiniUnknown, z.ZodMiniTransform<string, unknown>>;
35
+ }, z.core.$strip>;
36
+ type LabelSpan = z.infer<typeof LabelSpanSchema>;
37
+ declare const BasicSpanSchema: z.ZodMiniObject<{
38
+ type: z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"strong">, z.ZodMiniLiteral<"em">, z.ZodMiniLiteral<"list-item">]>;
39
+ start: z.ZodMiniNumber<number>;
40
+ end: z.ZodMiniNumber<number>;
41
+ }, z.core.$strip>;
42
+ type BasicSpan = z.infer<typeof BasicSpanSchema>;
41
43
  type Span<TLink extends FilledLinkLegacyValue | FilledLinkContentValue> = HyperlinkSpan<TLink> | LabelSpan | BasicSpan;
42
44
  declare const TextBlockLegacySchema: z.ZodMiniObject<{
43
45
  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">]>;
44
46
  content: z.ZodMiniObject<{
45
47
  text: z.ZodMiniString<string>;
46
- spans: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniArray<z.ZodMiniUnknown>, z.ZodMiniTransform<(LabelSpan | BasicSpan | {
48
+ spans: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniArray<z.ZodMiniUnknown>, z.ZodMiniTransform<({
49
+ type: "label";
50
+ start: number;
51
+ end: number;
52
+ data: string;
53
+ } | {
54
+ type: "list-item" | "strong" | "em";
55
+ start: number;
56
+ end: number;
57
+ } | {
47
58
  type: "hyperlink";
48
59
  start: number;
49
60
  end: number;
@@ -1 +1 @@
1
- {"version":3,"file":"richText.d.ts","names":[],"sources":["../../../src/content/legacy/richText.ts"],"mappings":";;;;;cAYa,gBAAA;EAAA;;;;;;;;;;;;;;;;KAkBD,iBAAA,WAA4B,gBAAA,eAA+B,gBAAA;AAAA,KAGlE,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;;;;;;;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AA,EAAsB,CAAA,CAAA,aAAA;;;;;;;;;;;;;;;;;;;;KAEvB,gBAAA,GAAmB,CAAA,CAAE,KAAA,QAAa,sBAAA;AAAA,KAQ3B,mBAAA,GAAsB,eAAA,GAAkB,gBAAA,GAAmB,gBAAA"}
@@ -41,7 +41,7 @@ const BasicSpanSchema = z.object({
41
41
  start: z.number(),
42
42
  end: z.number()
43
43
  });
44
- const getSpanSchema = (linkSchema) => z.union([
44
+ const getSpanSchema = (linkSchema) => z.discriminatedUnion("type", [
45
45
  getHyperlinkSpanSchema(linkSchema),
46
46
  LabelSpanSchema,
47
47
  BasicSpanSchema
@@ -88,7 +88,7 @@ const getEmbedBlockSchema = (data) => z.object({
88
88
  direction: z.nullish(z.string())
89
89
  });
90
90
  const EmbedBlockLegacySchema = getEmbedBlockSchema(EmbedLegacyLooseSchema);
91
- const RichTextLegacyBlockSchema = z.union([
91
+ const RichTextLegacyBlockSchema = z.discriminatedUnion("type", [
92
92
  TextBlockLegacySchema,
93
93
  ImageBlockLegacySchema,
94
94
  EmbedBlockLegacySchema
@@ -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 { ImageContentViewSchema } from \"../image\"\nimport type { FilledLinkContentValue, FilledLinkContentValueSchema } from \"../link\"\nimport { EmbedLegacyLooseSchema } from \"./embed\"\nimport { ImageLegacyViewSchema } from \"./image\"\nimport { FilledLinkLegacyValueSchema } from \"./link\"\nimport type { FilledLinkLegacyValue } from \"./link\"\n\nexport const RichTextNodeType = {\n\theading1: \"heading1\",\n\theading2: \"heading2\",\n\theading3: \"heading3\",\n\theading4: \"heading4\",\n\theading5: \"heading5\",\n\theading6: \"heading6\",\n\tparagraph: \"paragraph\",\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\nexport type RichTextNodeTypes = (typeof RichTextNodeType)[keyof typeof RichTextNodeType]\n\n// Spans\ntype HyperlinkSpan<TData extends FilledLinkLegacyValue | FilledLinkContentValue> = {\n\ttype: typeof RichTextNodeType.hyperlink\n\tstart: number\n\tend: number\n\tdata: TData\n}\n\nconst getHyperlinkSpanSchema = <\n\tTData extends typeof FilledLinkLegacyValueSchema | typeof FilledLinkContentValueSchema,\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 FilledLinkLegacyValue | FilledLinkContentValue> =\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 FilledLinkLegacyValueSchema | typeof FilledLinkContentValueSchema,\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 FilledLinkLegacyValueSchema | typeof FilledLinkContentValueSchema,\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(FilledLinkLegacyValueSchema)\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 ImageLegacyViewSchema | typeof ImageContentViewSchema,\n\tTLinkTo extends typeof FilledLinkLegacyValueSchema | typeof FilledLinkContentValueSchema,\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\tImageLegacyViewSchema,\n\tFilledLinkLegacyValueSchema,\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 = z.array(RichTextLegacyBlockSchema)\n\nexport type RichTextLegacy = z.infer<typeof RichTextLegacySchema>\n"],"mappings":";;;;;AAYA,MAAa,mBAAmB;CAC/B,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,WAAW;CACX,cAAc;CACd,WAAW;CACX,UAAU;CACV,OAAO;CACP,OAAO;CACP,WAAW;CACX,QAAQ;CACR,IAAI;CACJ;AAY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B,EAAE,WAAW,UAAU;GACtB,MAAM,aAAa,cAAc,WAAW;AAG5C,UAAO,MACL,SAAS,cAAc;IACvB,MAAM,SAAS,WAAW,UAAU,UAAU;AAC9C,WAAO,OAAO,UAAU,CAAC,OAAO,KAAK,GAAG,EAAE;KACzC,CACD,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,MAAM;IAClC,CACF,CACD;EACD,CAAC;CACF,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC;CAC7B,WAAW,EAAE,SAAS,EAAE,QAAQ,CAAC;CACjC,CAAC;AAEH,MAAM,wBAAwB,mBAAmB,4BAA4B;AAO7E,MAAa,uBAIZ,MACA,WAEA,EAAE,OAAO;CACR,MAAM,EAAE,QAAQ,iBAAiB,MAAM;CACvC,MAAM,EAAE,OAAO,MAAM,EAAE,QAAQ,EAAE,QAAQ,OAAO,EAAE,CAAC;CACnD,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC;CAC5B,WAAW,EAAE,QAAQ,EAAE,QAAQ,CAAC;CAChC,CAAC;AAEH,MAAM,yBAAyB,oBAC9B,uBACA,4BACA;AAMD,MAAa,uBAGZ,SAEA,EAAE,OAAO;CACR,MAAM,EAAE,QAAQ,iBAAiB,MAAM;CACvC;CACA,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC;CAC5B,WAAW,EAAE,QAAQ,EAAE,QAAQ,CAAC;CAChC,CAAC;AAEH,MAAM,yBAAyB,oBAAoB,uBAAuB;AAK1E,MAAa,4BAAgE,EAAE,MAAM;CACpF;CACA;CACA;CACA,CAAC;AAIF,MAAa,uBAAuB,EAAE,MAAM,0BAA0B"}
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 { ImageContentViewSchema } from \"../image\"\nimport type { FilledLinkContentValue, FilledLinkContentValueSchema } from \"../link\"\nimport { EmbedLegacyLooseSchema } from \"./embed\"\nimport { ImageLegacyViewSchema } from \"./image\"\nimport { FilledLinkLegacyValueSchema } from \"./link\"\nimport type { FilledLinkLegacyValue } from \"./link\"\n\nexport const RichTextNodeType = {\n\theading1: \"heading1\",\n\theading2: \"heading2\",\n\theading3: \"heading3\",\n\theading4: \"heading4\",\n\theading5: \"heading5\",\n\theading6: \"heading6\",\n\tparagraph: \"paragraph\",\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\nexport type RichTextNodeTypes = (typeof RichTextNodeType)[keyof typeof RichTextNodeType]\n\n// Spans\ntype HyperlinkSpan<TData extends FilledLinkLegacyValue | FilledLinkContentValue> = {\n\ttype: typeof RichTextNodeType.hyperlink\n\tstart: number\n\tend: number\n\tdata: TData\n}\n\nconst getHyperlinkSpanSchema = <\n\tTData extends typeof FilledLinkLegacyValueSchema | typeof FilledLinkContentValueSchema,\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})\ntype LabelSpan = z.infer<typeof LabelSpanSchema>\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})\ntype BasicSpan = z.infer<typeof BasicSpanSchema>\n\nexport type Span<TLink extends FilledLinkLegacyValue | FilledLinkContentValue> =\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 FilledLinkLegacyValueSchema | typeof FilledLinkContentValueSchema,\n>(\n\tlinkSchema: TLinkSchema,\n) =>\n\tz.discriminatedUnion(\"type\", [\n\t\tgetHyperlinkSpanSchema(linkSchema),\n\t\tLabelSpanSchema,\n\t\tBasicSpanSchema,\n\t])\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 FilledLinkLegacyValueSchema | typeof FilledLinkContentValueSchema,\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(FilledLinkLegacyValueSchema)\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 ImageLegacyViewSchema | typeof ImageContentViewSchema,\n\tTLinkTo extends typeof FilledLinkLegacyValueSchema | typeof FilledLinkContentValueSchema,\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\tImageLegacyViewSchema,\n\tFilledLinkLegacyValueSchema,\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.discriminatedUnion(\n\t\"type\",\n\t[TextBlockLegacySchema, ImageBlockLegacySchema, EmbedBlockLegacySchema],\n)\n\nexport type RichTextLegacyBlock = TextBlockLegacy | ImageBlockLegacy | EmbedBlockLegacy\n\nexport const RichTextLegacySchema = z.array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AC;CAAuB;CAAwB;CAAuB,CACvE;AAID,MAAa,uBAAuB,EAAE,MAAM,0BAA0B"}
@@ -11,7 +11,7 @@ declare const FilledImageLinkContentValueSchema: z.ZodMiniObject<{
11
11
  name: z.ZodMiniString<string>;
12
12
  date: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
13
13
  __TYPE__: z.ZodMiniLiteral<"ImageLink">;
14
- }, z.core.$strict>;
14
+ }, z.core.$strip>;
15
15
  declare const EmptyImageLinkContentValueSchema: z.ZodMiniObject<{
16
16
  kind: z.ZodMiniLiteral<"image">;
17
17
  __TYPE__: z.ZodMiniLiteral<"ImageLink">;
@@ -24,7 +24,7 @@ declare const FilledFileLinkContentValueSchema: z.ZodMiniObject<{
24
24
  size: z.ZodMiniTransform<string, unknown>;
25
25
  date: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
26
26
  __TYPE__: z.ZodMiniLiteral<"FileLink">;
27
- }, z.core.$strict>;
27
+ }, z.core.$strip>;
28
28
  declare const EmptyFileLinkContentValueSchema: z.ZodMiniObject<{
29
29
  kind: z.ZodMiniLiteral<"file">;
30
30
  __TYPE__: z.ZodMiniLiteral<"FileLink">;
@@ -37,7 +37,7 @@ declare const FilledDocumentLinkContentValueSchema: z.ZodMiniObject<{
37
37
  kind: z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniLiteral<"document">>, z.ZodMiniTransform<"document", "document" | undefined>>;
38
38
  id: z.ZodMiniString<string>;
39
39
  __TYPE__: z.ZodMiniLiteral<"DocumentLink">;
40
- }, z.core.$strict>;
40
+ }, z.core.$strip>;
41
41
  declare const EmptyDocumentLinkContentValueSchema: z.ZodMiniObject<{
42
42
  kind: z.ZodMiniLiteral<"document">;
43
43
  __TYPE__: z.ZodMiniLiteral<"DocumentLink">;
@@ -50,7 +50,7 @@ declare const FilledExternalLinkContentValueSchema: z.ZodMiniObject<{
50
50
  title: z.ZodMiniOptional<z.ZodMiniString<string>>;
51
51
  }, z.core.$strict>>>;
52
52
  __TYPE__: z.ZodMiniLiteral<"ExternalLink">;
53
- }, z.core.$strict>;
53
+ }, z.core.$strip>;
54
54
  declare const EmptyExternalLinkContentValueSchema: z.ZodMiniObject<{
55
55
  kind: z.ZodMiniLiteral<"web">;
56
56
  __TYPE__: z.ZodMiniLiteral<"ExternalLink">;
@@ -1,13 +1,13 @@
1
1
  import { BooleanContent } from "./boolean.js";
2
+ import { LinkContent } from "./link.js";
2
3
  import { EmbedContent } from "./embed.js";
4
+ import { ImageContent } from "./image.js";
5
+ import { RichTextContent } from "./richText.js";
3
6
  import { EmptyContent } from "./empty.js";
4
7
  import { ColorContent, DateContent, NumberContent, RangeContent, SelectContent, TextContent, TimestampContent } from "./field.js";
5
8
  import { GeoPointContent } from "./geopoint.js";
6
- import { ImageContent } from "./image.js";
7
9
  import { IntegrationFieldContent } from "./integrationField.js";
8
- import { LinkContent } from "./link.js";
9
10
  import { RepeatableContent } from "./repeatable.js";
10
- import { RichTextContent } from "./richText.js";
11
11
  import { SeparatorContent } from "./separator.js";
12
12
  import { TableContent } from "./table.js";
13
13
  import { z } from "zod/mini";
@@ -1 +1 @@
1
- {"version":3,"file":"nestable.d.ts","names":[],"sources":["../../src/content/nestable.ts"],"mappings":";;;;;;;;;;;;;;;KAiEY,eAAA,GACT,YAAA,GACA,cAAA,GACA,YAAA,GACA,WAAA,GACA,YAAA,GACA,eAAA,GACA,YAAA,GACA,uBAAA,GACA,WAAA,GACA,aAAA,GACA,YAAA,GACA,iBAAA,GACA,eAAA,GACA,aAAA,GACA,gBAAA,GACA,YAAA,GACA,WAAA,GACA,gBAAA"}
1
+ {"version":3,"file":"nestable.d.ts","names":[],"sources":["../../src/content/nestable.ts"],"mappings":";;;;;;;;;;;;;;;KAkDY,eAAA,GACT,YAAA,GACA,cAAA,GACA,YAAA,GACA,WAAA,GACA,YAAA,GACA,eAAA,GACA,YAAA,GACA,uBAAA,GACA,WAAA,GACA,aAAA,GACA,YAAA,GACA,iBAAA,GACA,eAAA,GACA,aAAA,GACA,gBAAA,GACA,YAAA,GACA,WAAA,GACA,gBAAA"}
@@ -4,7 +4,7 @@ import { LinkContentSchema, LinkContentType } from "./link.js";
4
4
  import { RichTextContentSchema, RichTextContentType } from "./richText.js";
5
5
  import { BooleanContentSchema, BooleanContentType } from "./boolean.js";
6
6
  import { EmptyContentSchema, EmptyContentType } from "./empty.js";
7
- import { ColorContentSchema, DateContentSchema, FieldContentType, NumberContentSchema, RangeContentSchema, SelectContentSchema, TextContentSchema, TimestampContentSchema } from "./field.js";
7
+ import { FieldContentSchema, FieldContentType } from "./field.js";
8
8
  import { GeoPointContentSchema, GeoPointContentType } from "./geopoint.js";
9
9
  import { IntegrationFieldContentSchema, IntegrationFieldContentType } from "./integrationField.js";
10
10
  import { RepeatableContentSchema, RepeatableContentType } from "./repeatable.js";
@@ -12,25 +12,19 @@ import { SeparatorContentSchema, SeparatorContentType } from "./separator.js";
12
12
  import { TableContentSchema, TableContentType } from "./table.js";
13
13
  import { z } from "zod/mini";
14
14
  //#region src/content/nestable.ts
15
- const NestableContentSchema = z.union([
15
+ const NestableContentSchema = z.discriminatedUnion("__TYPE__", [
16
16
  EmptyContentSchema,
17
17
  BooleanContentSchema,
18
- ColorContentSchema,
19
- DateContentSchema,
20
18
  EmbedContentSchema,
21
19
  GeoPointContentSchema,
22
20
  ImageContentSchema,
23
21
  IntegrationFieldContentSchema,
24
22
  LinkContentSchema,
25
- NumberContentSchema,
26
- RangeContentSchema,
27
23
  RepeatableContentSchema,
28
24
  RichTextContentSchema,
29
- SelectContentSchema,
30
25
  SeparatorContentSchema,
31
26
  TableContentSchema,
32
- TextContentSchema,
33
- TimestampContentSchema
27
+ FieldContentSchema
34
28
  ]);
35
29
  const NestableContentTypes = [
36
30
  EmptyContentType,
@@ -1 +1 @@
1
- {"version":3,"file":"nestable.js","names":[],"sources":["../../src/content/nestable.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport type { BooleanContent } from \"./boolean\"\nimport { BooleanContentSchema, BooleanContentType } from \"./boolean\"\nimport type { EmbedContent } from \"./embed\"\nimport { EmbedContentSchema, EmbedContentType } from \"./embed\"\nimport type { EmptyContent } from \"./empty\"\nimport { EmptyContentSchema, EmptyContentType } from \"./empty\"\nimport type {\n\tColorContent,\n\tDateContent,\n\tNumberContent,\n\tRangeContent,\n\tSelectContent,\n\tTextContent,\n\tTimestampContent,\n} from \"./field\"\nimport {\n\tColorContentSchema,\n\tDateContentSchema,\n\tFieldContentType,\n\tNumberContentSchema,\n\tRangeContentSchema,\n\tSelectContentSchema,\n\tTextContentSchema,\n\tTimestampContentSchema,\n} from \"./field\"\nimport type { GeoPointContent } from \"./geopoint\"\nimport { GeoPointContentSchema, GeoPointContentType } from \"./geopoint\"\nimport type { ImageContent } from \"./image\"\nimport { ImageContentSchema, ImageContentType } from \"./image\"\nimport type { IntegrationFieldContent } from \"./integrationField\"\nimport { IntegrationFieldContentSchema, IntegrationFieldContentType } from \"./integrationField\"\nimport type { LinkContent } from \"./link\"\nimport { LinkContentSchema, LinkContentType } from \"./link\"\nimport type { RepeatableContent } from \"./repeatable\"\nimport { RepeatableContentSchema, RepeatableContentType } from \"./repeatable\"\nimport type { RichTextContent } from \"./richText\"\nimport { RichTextContentSchema, RichTextContentType } from \"./richText\"\nimport type { SeparatorContent } from \"./separator\"\nimport { SeparatorContentSchema, SeparatorContentType } from \"./separator\"\nimport type { TableContent } from \"./table\"\nimport { TableContentSchema, TableContentType } from \"./table\"\n\nexport const NestableContentSchema: z.ZodMiniType<NestableContent> = z.union([\n\tEmptyContentSchema,\n\tBooleanContentSchema,\n\tColorContentSchema,\n\tDateContentSchema,\n\tEmbedContentSchema,\n\tGeoPointContentSchema,\n\tImageContentSchema,\n\tIntegrationFieldContentSchema,\n\tLinkContentSchema,\n\tNumberContentSchema,\n\tRangeContentSchema,\n\tRepeatableContentSchema,\n\tRichTextContentSchema,\n\tSelectContentSchema,\n\tSeparatorContentSchema,\n\tTableContentSchema,\n\tTextContentSchema,\n\tTimestampContentSchema,\n])\n\nexport type NestableContent =\n\t| EmptyContent\n\t| BooleanContent\n\t| ColorContent\n\t| DateContent\n\t| EmbedContent\n\t| GeoPointContent\n\t| ImageContent\n\t| IntegrationFieldContent\n\t| LinkContent\n\t| NumberContent\n\t| RangeContent\n\t| RepeatableContent\n\t| RichTextContent\n\t| SelectContent\n\t| SeparatorContent\n\t| TableContent\n\t| TextContent\n\t| TimestampContent\n\nconst NestableContentTypes = [\n\tEmptyContentType,\n\tBooleanContentType,\n\tEmbedContentType,\n\tFieldContentType,\n\tGeoPointContentType,\n\tImageContentType,\n\tIntegrationFieldContentType,\n\tLinkContentType,\n\tRepeatableContentType,\n\tRichTextContentType,\n\tSeparatorContentType,\n\tTableContentType,\n]\ntype NestableContentType = (typeof NestableContentTypes)[number]\n\n/** @internal */\nexport function isNestableContent(content: {\n\t__TYPE__: string\n}): content is { __TYPE__: NestableContentType } {\n\treturn (NestableContentTypes as string[]).includes(content.__TYPE__)\n}\n"],"mappings":";;;;;;;;;;;;;;AA4CA,MAAa,wBAAwD,EAAE,MAAM;CAC5E;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,CAAC;AAsBF,MAAM,uBAAuB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;AAID,SAAgB,kBAAkB,SAEe;AAChD,QAAQ,qBAAkC,SAAS,QAAQ,SAAS"}
1
+ {"version":3,"file":"nestable.js","names":[],"sources":["../../src/content/nestable.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport type { BooleanContent } from \"./boolean\"\nimport { BooleanContentSchema, BooleanContentType } from \"./boolean\"\nimport type { EmbedContent } from \"./embed\"\nimport { EmbedContentSchema, EmbedContentType } from \"./embed\"\nimport type { EmptyContent } from \"./empty\"\nimport { EmptyContentSchema, EmptyContentType } from \"./empty\"\nimport type {\n\tColorContent,\n\tDateContent,\n\tNumberContent,\n\tRangeContent,\n\tSelectContent,\n\tTextContent,\n\tTimestampContent,\n} from \"./field\"\nimport { FieldContentType, FieldContentSchema } from \"./field\"\nimport type { GeoPointContent } from \"./geopoint\"\nimport { GeoPointContentSchema, GeoPointContentType } from \"./geopoint\"\nimport type { ImageContent } from \"./image\"\nimport { ImageContentSchema, ImageContentType } from \"./image\"\nimport type { IntegrationFieldContent } from \"./integrationField\"\nimport { IntegrationFieldContentSchema, IntegrationFieldContentType } from \"./integrationField\"\nimport type { LinkContent } from \"./link\"\nimport { LinkContentSchema, LinkContentType } from \"./link\"\nimport type { RepeatableContent } from \"./repeatable\"\nimport { RepeatableContentSchema, RepeatableContentType } from \"./repeatable\"\nimport type { RichTextContent } from \"./richText\"\nimport { RichTextContentSchema, RichTextContentType } from \"./richText\"\nimport type { SeparatorContent } from \"./separator\"\nimport { SeparatorContentSchema, SeparatorContentType } from \"./separator\"\nimport type { TableContent } from \"./table\"\nimport { TableContentSchema, TableContentType } from \"./table\"\n\nexport const NestableContentSchema = z.discriminatedUnion(\"__TYPE__\", [\n\tEmptyContentSchema,\n\tBooleanContentSchema,\n\tEmbedContentSchema,\n\tGeoPointContentSchema,\n\tImageContentSchema,\n\tIntegrationFieldContentSchema,\n\tLinkContentSchema,\n\tRepeatableContentSchema,\n\tRichTextContentSchema,\n\tSeparatorContentSchema,\n\tTableContentSchema,\n\tFieldContentSchema,\n])\n\nexport type NestableContent =\n\t| EmptyContent\n\t| BooleanContent\n\t| ColorContent\n\t| DateContent\n\t| EmbedContent\n\t| GeoPointContent\n\t| ImageContent\n\t| IntegrationFieldContent\n\t| LinkContent\n\t| NumberContent\n\t| RangeContent\n\t| RepeatableContent\n\t| RichTextContent\n\t| SelectContent\n\t| SeparatorContent\n\t| TableContent\n\t| TextContent\n\t| TimestampContent\n\nconst NestableContentTypes = [\n\tEmptyContentType,\n\tBooleanContentType,\n\tEmbedContentType,\n\tFieldContentType,\n\tGeoPointContentType,\n\tImageContentType,\n\tIntegrationFieldContentType,\n\tLinkContentType,\n\tRepeatableContentType,\n\tRichTextContentType,\n\tSeparatorContentType,\n\tTableContentType,\n]\ntype NestableContentType = (typeof NestableContentTypes)[number]\n\n/** @internal */\nexport function isNestableContent(content: {\n\t__TYPE__: string\n}): content is { __TYPE__: NestableContentType } {\n\treturn (NestableContentTypes as string[]).includes(content.__TYPE__)\n}\n"],"mappings":";;;;;;;;;;;;;;AAmCA,MAAa,wBAAwB,EAAE,mBAAmB,YAAY;CACrE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,CAAC;AAsBF,MAAM,uBAAuB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;AAID,SAAgB,kBAAkB,SAEe;AAChD,QAAQ,qBAAkC,SAAS,QAAQ,SAAS"}
@@ -14,7 +14,7 @@ declare const RichTextContentTextBlockSchema: z.ZodMiniObject<{
14
14
  end: number;
15
15
  data: string;
16
16
  } | {
17
- type: "strong" | "em" | "list-item";
17
+ type: "list-item" | "strong" | "em";
18
18
  start: number;
19
19
  end: number;
20
20
  } | {
@@ -1 +1 @@
1
- {"version":3,"file":"richText.d.ts","names":[],"sources":["../../src/content/richText.ts"],"mappings":";;;;;KAkBY,mBAAA,GAAsB,IAAA,CAAK,sBAAA;AAAA,cAOjC,8BAAA,EAA8B,CAAA,CAAA,aAAA;;;;;;;;;;;;;;;;;;;;;;;KACxB,wBAAA,GAA2B,CAAA,CAAE,KAAA,QAAa,8BAAA;AAAA,cAEhD,+BAAA,EAA+B,CAAA,CAAA,aAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAIzB,yBAAA,GAA4B,CAAA,CAAE,KAAA,QAAa,+BAAA;AAAA,cAEjD,+BAAA,EAA+B,CAAA,CAAA,aAAA;;;;;;;;;;;;;;;;;;;;;;KACzB,yBAAA,GAA4B,CAAA,CAAE,KAAA,QAAa,+BAAA;AAAA,KAS3C,oBAAA,GACT,wBAAA,GACA,yBAAA,GACA,yBAAA;AAAA,cAEU,mBAAA;AAAA,KAED,eAAA;EACX,QAAA,SAAiB,mBAAA;EACjB,KAAA,EAAO,oBAAA;AAAA"}
1
+ {"version":3,"file":"richText.d.ts","names":[],"sources":["../../src/content/richText.ts"],"mappings":";;;;;KAkBY,mBAAA,GAAsB,IAAA,CAAK,sBAAA;AAAA,cAOjC,8BAAA,EAA8B,CAAA,CAAA,aAAA;;;;;;;;;;;;;;;;;;;;;;;KACxB,wBAAA,GAA2B,CAAA,CAAE,KAAA,QAAa,8BAAA;AAAA,cAEhD,+BAAA,EAA+B,CAAA,CAAA,aAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAIzB,yBAAA,GAA4B,CAAA,CAAE,KAAA,QAAa,+BAAA;AAAA,cAEjD,+BAAA,EAA+B,CAAA,CAAA,aAAA;;;;;;;;;;;;;;;;;;;;;;KACzB,yBAAA,GAA4B,CAAA,CAAE,KAAA,QAAa,+BAAA;AAAA,KAY3C,oBAAA,GACT,wBAAA,GACA,yBAAA,GACA,yBAAA;AAAA,cAEU,mBAAA;AAAA,KAED,eAAA;EACX,QAAA,SAAiB,mBAAA;EACjB,KAAA,EAAO,oBAAA;AAAA"}
@@ -8,7 +8,7 @@ const RichTextContentSpanSchema = getSpanSchema(FilledLinkContentValueSchema);
8
8
  const RichTextContentTextBlockSchema = getTextBlockSchema(FilledLinkContentValueSchema);
9
9
  const RichTextContentImageBlockSchema = getImageBlockSchema(ImageContentViewSchema, FilledLinkContentValueSchema);
10
10
  const RichTextContentEmbedBlockSchema = getEmbedBlockSchema(EmbedContentSchema);
11
- const RichTextContentBlockSchema = z.union([
11
+ const RichTextContentBlockSchema = z.discriminatedUnion("type", [
12
12
  RichTextContentTextBlockSchema,
13
13
  RichTextContentImageBlockSchema,
14
14
  RichTextContentEmbedBlockSchema
@@ -1 +1 @@
1
- {"version":3,"file":"richText.js","names":[],"sources":["../../src/content/richText.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { EmbedContentSchema } from \"./embed\"\nimport { ImageContentViewSchema } from \"./image\"\nimport {\n\tgetEmbedBlockSchema,\n\tgetImageBlockSchema,\n\tgetSpanSchema,\n\tgetTextBlockSchema,\n} from \"./legacy/richText\"\nimport type { Span } from \"./legacy/richText\"\nimport type { FilledLinkContentValue } from \"./link\"\nimport { FilledLinkContentValueSchema } from \"./link\"\n\nexport { RichTextNodeType } from \"./legacy/richText\"\nexport type { RichTextNodeTypes } from \"./legacy/richText\"\n\n// Spans\nexport type RichTextContentSpan = Span<FilledLinkContentValue>\n\nexport const RichTextContentSpanSchema: z.ZodMiniType<RichTextContentSpan> = getSpanSchema(\n\tFilledLinkContentValueSchema,\n)\n\n// Blocks\nconst RichTextContentTextBlockSchema = getTextBlockSchema(FilledLinkContentValueSchema)\nexport type RichTextContentTextBlock = z.infer<typeof RichTextContentTextBlockSchema>\n\nconst RichTextContentImageBlockSchema = getImageBlockSchema(\n\tImageContentViewSchema,\n\tFilledLinkContentValueSchema,\n)\nexport type RichTextContentImageBlock = z.infer<typeof RichTextContentImageBlockSchema>\n\nconst RichTextContentEmbedBlockSchema = getEmbedBlockSchema(EmbedContentSchema)\nexport type RichTextContentEmbedBlock = z.infer<typeof RichTextContentEmbedBlockSchema>\n\nexport const RichTextContentBlockSchema: z.ZodMiniType<RichTextContentBlock> = z.union([\n\tRichTextContentTextBlockSchema,\n\tRichTextContentImageBlockSchema,\n\tRichTextContentEmbedBlockSchema,\n])\n\n// Used by content/codec/richText\nexport type RichTextContentBlock =\n\t| RichTextContentTextBlock\n\t| RichTextContentImageBlock\n\t| RichTextContentEmbedBlock\n\nexport const RichTextContentType = \"StructuredTextContent\" as const\n\nexport type RichTextContent = {\n\t__TYPE__: typeof RichTextContentType\n\tvalue: RichTextContentBlock[]\n}\n\nexport const RichTextContentSchema: z.ZodMiniType<RichTextContent> = z.object({\n\t__TYPE__: z.literal(RichTextContentType),\n\tvalue: z.array(RichTextContentBlockSchema),\n})\n"],"mappings":";;;;;;AAoBA,MAAa,4BAAgE,cAC5E,6BACA;AAGD,MAAM,iCAAiC,mBAAmB,6BAA6B;AAGvF,MAAM,kCAAkC,oBACvC,wBACA,6BACA;AAGD,MAAM,kCAAkC,oBAAoB,mBAAmB;AAG/E,MAAa,6BAAkE,EAAE,MAAM;CACtF;CACA;CACA;CACA,CAAC;AAQF,MAAa,sBAAsB;AAOnC,MAAa,wBAAwD,EAAE,OAAO;CAC7E,UAAU,EAAE,QAAQ,oBAAoB;CACxC,OAAO,EAAE,MAAM,2BAA2B;CAC1C,CAAC"}
1
+ {"version":3,"file":"richText.js","names":[],"sources":["../../src/content/richText.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { EmbedContentSchema } from \"./embed\"\nimport { ImageContentViewSchema } from \"./image\"\nimport {\n\tgetEmbedBlockSchema,\n\tgetImageBlockSchema,\n\tgetSpanSchema,\n\tgetTextBlockSchema,\n} from \"./legacy/richText\"\nimport type { Span } from \"./legacy/richText\"\nimport type { FilledLinkContentValue } from \"./link\"\nimport { FilledLinkContentValueSchema } from \"./link\"\n\nexport { RichTextNodeType } from \"./legacy/richText\"\nexport type { RichTextNodeTypes } from \"./legacy/richText\"\n\n// Spans\nexport type RichTextContentSpan = Span<FilledLinkContentValue>\n\nexport const RichTextContentSpanSchema: z.ZodMiniType<RichTextContentSpan> = getSpanSchema(\n\tFilledLinkContentValueSchema,\n)\n\n// Blocks\nconst RichTextContentTextBlockSchema = getTextBlockSchema(FilledLinkContentValueSchema)\nexport type RichTextContentTextBlock = z.infer<typeof RichTextContentTextBlockSchema>\n\nconst RichTextContentImageBlockSchema = getImageBlockSchema(\n\tImageContentViewSchema,\n\tFilledLinkContentValueSchema,\n)\nexport type RichTextContentImageBlock = z.infer<typeof RichTextContentImageBlockSchema>\n\nconst RichTextContentEmbedBlockSchema = getEmbedBlockSchema(EmbedContentSchema)\nexport type RichTextContentEmbedBlock = z.infer<typeof RichTextContentEmbedBlockSchema>\n\nexport const RichTextContentBlockSchema: z.ZodMiniType<RichTextContentBlock> = z.discriminatedUnion(\n\t\"type\",\n\t[\n\t\tRichTextContentTextBlockSchema,\n\t\tRichTextContentImageBlockSchema,\n\t\tRichTextContentEmbedBlockSchema,\n\t],\n)\n\n// Used by content/codec/richText\nexport type RichTextContentBlock =\n\t| RichTextContentTextBlock\n\t| RichTextContentImageBlock\n\t| RichTextContentEmbedBlock\n\nexport const RichTextContentType = \"StructuredTextContent\" as const\n\nexport type RichTextContent = {\n\t__TYPE__: typeof RichTextContentType\n\tvalue: RichTextContentBlock[]\n}\n\nexport const RichTextContentSchema = z.object({\n\t__TYPE__: z.literal(RichTextContentType),\n\tvalue: z.array(RichTextContentBlockSchema),\n})\n"],"mappings":";;;;;;AAoBA,MAAa,4BAAgE,cAC5E,6BACA;AAGD,MAAM,iCAAiC,mBAAmB,6BAA6B;AAGvF,MAAM,kCAAkC,oBACvC,wBACA,6BACA;AAGD,MAAM,kCAAkC,oBAAoB,mBAAmB;AAG/E,MAAa,6BAAkE,EAAE,mBAChF,QACA;CACC;CACA;CACA;CACA,CACD;AAQD,MAAa,sBAAsB;AAOnC,MAAa,wBAAwB,EAAE,OAAO;CAC7C,UAAU,EAAE,QAAQ,oBAAoB;CACxC,OAAO,EAAE,MAAM,2BAA2B;CAC1C,CAAC"}