@prismicio/types-internal 4.7.0 → 4.8.0-canary.6451918

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 (69) hide show
  1. package/dist/content/codec/group.js +3 -2
  2. package/dist/content/codec/group.js.map +1 -1
  3. package/dist/content/codec/legacyContentCtx.d.ts.map +1 -1
  4. package/dist/content/codec/legacyContentCtx.js +5 -1
  5. package/dist/content/codec/legacyContentCtx.js.map +1 -1
  6. package/dist/content/embed.d.ts +1 -1
  7. package/dist/content/embed.js +1 -1
  8. package/dist/content/embed.js.map +1 -1
  9. package/dist/content/image.d.ts +4 -4
  10. package/dist/content/legacy/image.d.ts +2 -2
  11. package/dist/content/legacy/image.js +2 -2
  12. package/dist/content/legacy/image.js.map +1 -1
  13. package/dist/content/legacy/richText.d.ts +3 -3
  14. package/dist/content/legacy/richText.js +1 -1
  15. package/dist/content/legacy/richText.js.map +1 -1
  16. package/dist/content/richText.d.ts +3 -3
  17. package/dist/content/slice.d.ts +15 -15
  18. package/dist/content/slices.d.ts +15 -15
  19. package/dist/helpers/customTypeModel.d.ts +2 -2
  20. package/dist/helpers/customTypeModel.d.ts.map +1 -1
  21. package/dist/helpers/customTypeModel.js +1 -1
  22. package/dist/helpers/customTypeModel.js.map +1 -1
  23. package/dist/helpers/documentContent.d.ts +4 -3
  24. package/dist/helpers/documentContent.d.ts.map +1 -1
  25. package/dist/helpers/documentContent.js +12 -15
  26. package/dist/helpers/documentContent.js.map +1 -1
  27. package/dist/helpers/sliceContent.d.ts +4 -2
  28. package/dist/helpers/sliceContent.d.ts.map +1 -1
  29. package/dist/helpers/sliceContent.js +11 -2
  30. package/dist/helpers/sliceContent.js.map +1 -1
  31. package/dist/helpers/traverseContent.d.ts +2 -2
  32. package/dist/helpers/traverseContent.d.ts.map +1 -1
  33. package/dist/helpers/traverseContent.js +6 -3
  34. package/dist/helpers/traverseContent.js.map +1 -1
  35. package/dist/index.d.ts +6 -6
  36. package/dist/index.js +2 -2
  37. package/dist/io-ts.d.ts +1072 -1022
  38. package/dist/io-ts.d.ts.map +1 -1
  39. package/dist/io-ts.js +5 -3
  40. package/dist/io-ts.js.map +1 -1
  41. package/dist/model/customType.d.ts +5 -1
  42. package/dist/model/customType.d.ts.map +1 -1
  43. package/dist/model/customType.js.map +1 -1
  44. package/dist/model/group.d.ts +32 -32
  45. package/dist/model/link.d.ts +27 -1
  46. package/dist/model/link.d.ts.map +1 -1
  47. package/dist/model/link.js +3 -3
  48. package/dist/model/link.js.map +1 -1
  49. package/dist/model/table.d.ts +3 -2
  50. package/dist/model/table.d.ts.map +1 -1
  51. package/dist/zod4.d.ts +90 -43
  52. package/dist/zod4.d.ts.map +1 -1
  53. package/dist/zod4.js +5 -3
  54. package/dist/zod4.js.map +1 -1
  55. package/package.json +8 -5
  56. package/src/content/codec/group.ts +1 -1
  57. package/src/content/codec/legacyContentCtx.ts +7 -1
  58. package/src/content/embed.ts +1 -1
  59. package/src/content/legacy/image.ts +2 -2
  60. package/src/content/legacy/richText.ts +1 -1
  61. package/src/helpers/customTypeModel.ts +3 -2
  62. package/src/helpers/documentContent.ts +21 -28
  63. package/src/helpers/sliceContent.ts +16 -0
  64. package/src/helpers/traverseContent.ts +8 -5
  65. package/src/index.ts +9 -3
  66. package/src/io-ts.ts +7 -1
  67. package/src/model/customType.ts +5 -0
  68. package/src/model/link.ts +4 -2
  69. package/src/zod4.ts +7 -1
@@ -32,15 +32,16 @@ const GroupItemLegacyCodec = (ctx, index) => ({
32
32
  };
33
33
  },
34
34
  fromContent(input) {
35
+ const groupItemCtx = ctx.withContentKey(index.toString());
35
36
  const legacy = {
36
37
  content: {},
37
38
  types: {},
38
- keys: { [ctx.withContentKey(index.toString()).keyOfKey]: input.key }
39
+ keys: { [groupItemCtx.keyOfKey]: input.key }
39
40
  };
40
41
  for (const [key, content] of input.value) {
41
42
  const itemCtx = getFieldCtx({
42
43
  fieldKey: key,
43
- ctx
44
+ ctx: groupItemCtx
44
45
  });
45
46
  const result = NestableAndGroupLegacyCodec(itemCtx).fromContent(content);
46
47
  if (result) {
@@ -1 +1 @@
1
- {"version":3,"file":"group.js","names":[],"sources":["../../../src/content/codec/group.ts"],"sourcesContent":["import {\n\tGroupContentSchema,\n\tGroupContentType,\n\tGroupItemContentSchema,\n\tGroupItemContentType,\n\tNestableAndGroupContentSchema,\n} from \"../group\"\nimport type { GroupContent, GroupItemContent, NestableAndGroupContent } from \"../group\"\nimport { GroupItemLegacySchema, GroupLegacySchema } from \"../legacy/group\"\nimport type { GroupItemLegacy, GroupLegacy, NestableAndGroupLegacy } from \"../legacy/group\"\nimport { type LegacyContentCtx, type LegacyCodec, getFieldCtx } from \"./legacyContentCtx\"\nimport { NestableLegacyCodec } from \"./nestable\"\n\nexport const GroupItemLegacyCodec = (\n\tctx: LegacyContentCtx,\n\tindex: number,\n): LegacyCodec<GroupItemContent, GroupItemLegacy> => ({\n\tname: \"GroupItemLegacy\",\n\n\tis(input): input is GroupItemContent {\n\t\treturn GroupItemContentSchema.safeParse(input).success\n\t},\n\n\ttoContent(input) {\n\t\tconst parsed = GroupItemLegacySchema.safeParse(input)\n\t\tif (!parsed.success) {\n\t\t\treturn parsed\n\t\t}\n\n\t\tconst groupItemCtx = ctx.withContentKey(index.toString())\n\n\t\tconst value: GroupItemContent[\"value\"] = []\n\t\tfor (const [key, legacy] of Object.entries(parsed.data)) {\n\t\t\tconst itemCtx = getFieldCtx({\n\t\t\t\tfieldKey: key,\n\t\t\t\tcontentKey: key,\n\t\t\t\tctx: groupItemCtx,\n\t\t\t})\n\n\t\t\tconst result = NestableAndGroupLegacyCodec(itemCtx).toContent(legacy)\n\t\t\tif (result.success) {\n\t\t\t\tvalue.push([key, result.data])\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: {\n\t\t\t\t__TYPE__: GroupItemContentType,\n\t\t\t\tkey: groupItemCtx.fieldContentKey,\n\t\t\t\tvalue,\n\t\t\t},\n\t\t}\n\t},\n\n\tfromContent(input) {\n\t\tconst groupItemCtx = ctx.withContentKey(index.toString())\n\n\t\tconst legacy: ReturnType<LegacyCodec<GroupItemContent, GroupItemLegacy>[\"fromContent\"]> = {\n\t\t\tcontent: {},\n\t\t\ttypes: {},\n\t\t\tkeys: { [groupItemCtx.keyOfKey]: input.key },\n\t\t}\n\n\t\tfor (const [key, content] of input.value) {\n\t\t\tconst itemCtx = getFieldCtx({ fieldKey: key, ctx })\n\n\t\t\tconst result = NestableAndGroupLegacyCodec(itemCtx).fromContent(content)\n\t\t\tif (result) {\n\t\t\t\tlegacy.content[key] = result.content\n\t\t\t\tlegacy.types = { ...legacy.types, ...result.types }\n\t\t\t\tlegacy.keys = { ...legacy.keys, ...result.keys }\n\t\t\t}\n\t\t}\n\n\t\treturn legacy\n\t},\n})\n\nexport const GroupLegacyCodec = (\n\tctx: LegacyContentCtx,\n): LegacyCodec<GroupContent, GroupLegacy> => ({\n\tname: \"GroupLegacy\",\n\n\tis(input): input is GroupContent {\n\t\treturn GroupContentSchema.safeParse(input).success\n\t},\n\n\ttoContent(input) {\n\t\tconst parsed = GroupLegacySchema.safeParse(input)\n\t\tif (!parsed.success) {\n\t\t\treturn parsed\n\t\t}\n\n\t\tconst value: GroupContent[\"value\"] = []\n\t\tfor (let index = 0; index < parsed.data.length; index++) {\n\t\t\tconst item = parsed.data[index]\n\n\t\t\t// Replace null items with empty GroupItemContent\n\t\t\tif (!item) {\n\t\t\t\tvalue.push({\n\t\t\t\t\t__TYPE__: GroupItemContentType,\n\t\t\t\t\tkey: ctx.withContentKey(index.toString()).fieldContentKey,\n\t\t\t\t\tvalue: [],\n\t\t\t\t})\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst result = GroupItemLegacyCodec(ctx, index).toContent(item)\n\t\t\tif (!result.success) {\n\t\t\t\treturn result\n\t\t\t}\n\n\t\t\tvalue.push(result.data)\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { __TYPE__: GroupContentType, value },\n\t\t}\n\t},\n\n\tfromContent(input) {\n\t\tconst legacy: ReturnType<LegacyCodec<GroupContent, GroupLegacy>[\"fromContent\"]> = {\n\t\t\tcontent: [],\n\t\t\ttypes: { [ctx.keyOfType]: \"Group\" },\n\t\t\tkeys: {},\n\t\t}\n\n\t\tfor (let index = 0; index < input.value.length; index++) {\n\t\t\tconst item = input.value[index]\n\t\t\tconst result = GroupItemLegacyCodec(ctx, index).fromContent(item)\n\n\t\t\tlegacy.content.push(result.content)\n\t\t\tlegacy.types = { ...legacy.types, ...result.types }\n\t\t\tlegacy.keys = { ...legacy.keys, ...result.keys }\n\t\t}\n\n\t\treturn legacy\n\t},\n})\n\nexport const NestableAndGroupLegacyCodec = (\n\tctx: LegacyContentCtx,\n): LegacyCodec<NestableAndGroupContent, NestableAndGroupLegacy, true> => ({\n\tname: \"NestableAndGroupLegacy\",\n\n\tis(input): input is NestableAndGroupContent {\n\t\treturn NestableAndGroupContentSchema.safeParse(input).success\n\t},\n\n\ttoContent(input) {\n\t\treturn ctx.fieldType === \"Group\"\n\t\t\t? GroupLegacyCodec(ctx).toContent(input)\n\t\t\t: NestableLegacyCodec(ctx).toContent(input)\n\t},\n\n\tfromContent(input) {\n\t\treturn input.__TYPE__ === GroupContentType\n\t\t\t? GroupLegacyCodec(ctx).fromContent(input)\n\t\t\t: NestableLegacyCodec(ctx).fromContent(input)\n\t},\n})\n"],"mappings":";;;;;AAaA,MAAa,wBACZ,KACA,WACqD;CACrD,MAAM;CAEN,GAAG,OAAkC;EACpC,OAAO,uBAAuB,UAAU,KAAK,CAAC,CAAC;CAChD;CAEA,UAAU,OAAO;EAChB,MAAM,SAAS,sBAAsB,UAAU,KAAK;EACpD,IAAI,CAAC,OAAO,SACX,OAAO;EAGR,MAAM,eAAe,IAAI,eAAe,MAAM,SAAS,CAAC;EAExD,MAAM,QAAmC,CAAC;EAC1C,KAAK,MAAM,CAAC,KAAK,WAAW,OAAO,QAAQ,OAA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AAC,CAAC;KAC1C,OAAO,CAAC;IACT,CAAC;IACD;GACD;GAEA,MAAM,SAAS,qBAAqB,KAAK,KAAK,CAAC,CAAC,UAAU,IAAI;GAC9D,IAAI,CAAC,OAAO,SACX,OAAO;GAGR,MAAM,KAAK,OAAO,IAAI;EACvB;EAEA,OAAO;GACN,SAAS;GACT,MAAM;IAAE,UAAU;IAAkB;GAAM;EAC3C;CACD;CAEA,YAAY,OAAO;EAClB,MAAM,SAA4E;GACjF,SAAS,CAAC;GACV,OAAO,GAAG,IAAI,YAAY,QAAQ;GAClC,MAAM,CAAC;EACR;EAEA,KAAK,IAAI,QAAQ,GAAG,QAAQ,MAAM,MAAM,QAAQ,SAAS;GACxD,MAAM,OAAO,MAAM,MAAM;GACzB,MAAM,SAAS,qBAAqB,KAAK,KAAK,CAAC,CAAC,YAAY,IAAI;GAEhE,OAAO,QAAQ,KAAK,OAAO,OAAO;GAClC,OAAO,QAAQ;IAAE,GAAG,OAAO;IAAO,GAAG,OAAO;GAAM;GAClD,OAAO,OAAO;IAAE,GAAG,OAAO;IAAM,GAAG,OAAO;GAAK;EAChD;EAEA,OAAO;CACR;AACD;AAEA,MAAa,+BACZ,SACyE;CACzE,MAAM;CAEN,GAAG,OAAyC;EAC3C,OAAO,8BAA8B,UAAU,KAAK,CAAC,CAAC;CACvD;CAEA,UAAU,OAAO;EAChB,OAAO,IAAI,cAAc,UACtB,iBAAiB,GAAG,CAAC,CAAC,UAAU,KAAK,IACrC,oBAAoB,GAAG,CAAC,CAAC,UAAU,KAAK;CAC5C;CAEA,YAAY,OAAO;EAClB,OAAO,MAAM,aAAA,qBACV,iBAAiB,GAAG,CAAC,CAAC,YAAY,KAAK,IACvC,oBAAoB,GAAG,CAAC,CAAC,YAAY,KAAK;CAC9C;AACD"}
1
+ {"version":3,"file":"group.js","names":[],"sources":["../../../src/content/codec/group.ts"],"sourcesContent":["import {\n\tGroupContentSchema,\n\tGroupContentType,\n\tGroupItemContentSchema,\n\tGroupItemContentType,\n\tNestableAndGroupContentSchema,\n} from \"../group\"\nimport type { GroupContent, GroupItemContent, NestableAndGroupContent } from \"../group\"\nimport { GroupItemLegacySchema, GroupLegacySchema } from \"../legacy/group\"\nimport type { GroupItemLegacy, GroupLegacy, NestableAndGroupLegacy } from \"../legacy/group\"\nimport { type LegacyContentCtx, type LegacyCodec, getFieldCtx } from \"./legacyContentCtx\"\nimport { NestableLegacyCodec } from \"./nestable\"\n\nexport const GroupItemLegacyCodec = (\n\tctx: LegacyContentCtx,\n\tindex: number,\n): LegacyCodec<GroupItemContent, GroupItemLegacy> => ({\n\tname: \"GroupItemLegacy\",\n\n\tis(input): input is GroupItemContent {\n\t\treturn GroupItemContentSchema.safeParse(input).success\n\t},\n\n\ttoContent(input) {\n\t\tconst parsed = GroupItemLegacySchema.safeParse(input)\n\t\tif (!parsed.success) {\n\t\t\treturn parsed\n\t\t}\n\n\t\tconst groupItemCtx = ctx.withContentKey(index.toString())\n\n\t\tconst value: GroupItemContent[\"value\"] = []\n\t\tfor (const [key, legacy] of Object.entries(parsed.data)) {\n\t\t\tconst itemCtx = getFieldCtx({\n\t\t\t\tfieldKey: key,\n\t\t\t\tcontentKey: key,\n\t\t\t\tctx: groupItemCtx,\n\t\t\t})\n\n\t\t\tconst result = NestableAndGroupLegacyCodec(itemCtx).toContent(legacy)\n\t\t\tif (result.success) {\n\t\t\t\tvalue.push([key, result.data])\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: {\n\t\t\t\t__TYPE__: GroupItemContentType,\n\t\t\t\tkey: groupItemCtx.fieldContentKey,\n\t\t\t\tvalue,\n\t\t\t},\n\t\t}\n\t},\n\n\tfromContent(input) {\n\t\tconst groupItemCtx = ctx.withContentKey(index.toString())\n\n\t\tconst legacy: ReturnType<LegacyCodec<GroupItemContent, GroupItemLegacy>[\"fromContent\"]> = {\n\t\t\tcontent: {},\n\t\t\ttypes: {},\n\t\t\tkeys: { [groupItemCtx.keyOfKey]: input.key },\n\t\t}\n\n\t\tfor (const [key, content] of input.value) {\n\t\t\tconst itemCtx = getFieldCtx({ fieldKey: key, ctx: groupItemCtx })\n\n\t\t\tconst result = NestableAndGroupLegacyCodec(itemCtx).fromContent(content)\n\t\t\tif (result) {\n\t\t\t\tlegacy.content[key] = result.content\n\t\t\t\tlegacy.types = { ...legacy.types, ...result.types }\n\t\t\t\tlegacy.keys = { ...legacy.keys, ...result.keys }\n\t\t\t}\n\t\t}\n\n\t\treturn legacy\n\t},\n})\n\nexport const GroupLegacyCodec = (\n\tctx: LegacyContentCtx,\n): LegacyCodec<GroupContent, GroupLegacy> => ({\n\tname: \"GroupLegacy\",\n\n\tis(input): input is GroupContent {\n\t\treturn GroupContentSchema.safeParse(input).success\n\t},\n\n\ttoContent(input) {\n\t\tconst parsed = GroupLegacySchema.safeParse(input)\n\t\tif (!parsed.success) {\n\t\t\treturn parsed\n\t\t}\n\n\t\tconst value: GroupContent[\"value\"] = []\n\t\tfor (let index = 0; index < parsed.data.length; index++) {\n\t\t\tconst item = parsed.data[index]\n\n\t\t\t// Replace null items with empty GroupItemContent\n\t\t\tif (!item) {\n\t\t\t\tvalue.push({\n\t\t\t\t\t__TYPE__: GroupItemContentType,\n\t\t\t\t\tkey: ctx.withContentKey(index.toString()).fieldContentKey,\n\t\t\t\t\tvalue: [],\n\t\t\t\t})\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst result = GroupItemLegacyCodec(ctx, index).toContent(item)\n\t\t\tif (!result.success) {\n\t\t\t\treturn result\n\t\t\t}\n\n\t\t\tvalue.push(result.data)\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { __TYPE__: GroupContentType, value },\n\t\t}\n\t},\n\n\tfromContent(input) {\n\t\tconst legacy: ReturnType<LegacyCodec<GroupContent, GroupLegacy>[\"fromContent\"]> = {\n\t\t\tcontent: [],\n\t\t\ttypes: { [ctx.keyOfType]: \"Group\" },\n\t\t\tkeys: {},\n\t\t}\n\n\t\tfor (let index = 0; index < input.value.length; index++) {\n\t\t\tconst item = input.value[index]\n\t\t\tconst result = GroupItemLegacyCodec(ctx, index).fromContent(item)\n\n\t\t\tlegacy.content.push(result.content)\n\t\t\tlegacy.types = { ...legacy.types, ...result.types }\n\t\t\tlegacy.keys = { ...legacy.keys, ...result.keys }\n\t\t}\n\n\t\treturn legacy\n\t},\n})\n\nexport const NestableAndGroupLegacyCodec = (\n\tctx: LegacyContentCtx,\n): LegacyCodec<NestableAndGroupContent, NestableAndGroupLegacy, true> => ({\n\tname: \"NestableAndGroupLegacy\",\n\n\tis(input): input is NestableAndGroupContent {\n\t\treturn NestableAndGroupContentSchema.safeParse(input).success\n\t},\n\n\ttoContent(input) {\n\t\treturn ctx.fieldType === \"Group\"\n\t\t\t? GroupLegacyCodec(ctx).toContent(input)\n\t\t\t: NestableLegacyCodec(ctx).toContent(input)\n\t},\n\n\tfromContent(input) {\n\t\treturn input.__TYPE__ === GroupContentType\n\t\t\t? GroupLegacyCodec(ctx).fromContent(input)\n\t\t\t: NestableLegacyCodec(ctx).fromContent(input)\n\t},\n})\n"],"mappings":";;;;;AAaA,MAAa,wBACZ,KACA,WACqD;CACrD,MAAM;CAEN,GAAG,OAAkC;EACpC,OAAO,uBAAuB,UAAU,KAAK,CAAC,CAAC;CAChD;CAEA,UAAU,OAAO;EAChB,MAAM,SAAS,sBAAsB,UAAU,KAAK;EACpD,IAAI,CAAC,OAAO,SACX,OAAO;EAGR,MAAM,eAAe,IAAI,eAAe,MAAM,SAAS,CAAC;EAExD,MAAM,QAAmC,CAAC;EAC1C,KAAK,MAAM,CAAC,KAAK,WAAW,OAAO,QAAQ,OAAO,IAAI,GAAG;GACxD,MAAM,UAAU,YAAY;IAC3B,UAAU;IACV,YAAY;IACZ,KAAK;GACN,CAAC;GAED,MAAM,SAAS,4BAA4B,OAAO,CAAC,CAAC,UAAU,MAAM;GACpE,IAAI,OAAO,SACV,MAAM,KAAK,CAAC,KAAK,OAAO,I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I;EACvB;EAEA,OAAO;GACN,SAAS;GACT,MAAM;IAAE,UAAU;IAAkB;GAAM;EAC3C;CACD;CAEA,YAAY,OAAO;EAClB,MAAM,SAA4E;GACjF,SAAS,CAAC;GACV,OAAO,GAAG,IAAI,YAAY,QAAQ;GAClC,MAAM,CAAC;EACR;EAEA,KAAK,IAAI,QAAQ,GAAG,QAAQ,MAAM,MAAM,QAAQ,SAAS;GACxD,MAAM,OAAO,MAAM,MAAM;GACzB,MAAM,SAAS,qBAAqB,KAAK,KAAK,CAAC,CAAC,YAAY,IAAI;GAEhE,OAAO,QAAQ,KAAK,OAAO,OAAO;GAClC,OAAO,QAAQ;IAAE,GAAG,OAAO;IAAO,GAAG,OAAO;GAAM;GAClD,OAAO,OAAO;IAAE,GAAG,OAAO;IAAM,GAAG,OAAO;GAAK;EAChD;EAEA,OAAO;CACR;AACD;AAEA,MAAa,+BACZ,SACyE;CACzE,MAAM;CAEN,GAAG,OAAyC;EAC3C,OAAO,8BAA8B,UAAU,KAAK,CAAC,CAAC;CACvD;CAEA,UAAU,OAAO;EAChB,OAAO,IAAI,cAAc,UACtB,iBAAiB,GAAG,CAAC,CAAC,UAAU,KAAK,IACrC,oBAAoB,GAAG,CAAC,CAAC,UAAU,KAAK;CAC5C;CAEA,YAAY,OAAO;EAClB,OAAO,MAAM,aAAA,qBACV,iBAAiB,GAAG,CAAC,CAAC,YAAY,KAAK,IACvC,oBAAoB,GAAG,CAAC,CAAC,YAAY,KAAK;CAC9C;AACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"legacyContentCtx.d.ts","names":[],"sources":["../../../src/content/codec/legacyContentCtx.ts"],"mappings":";;;UAIU;EACT;EACA;EACA,YAAY;EACZ,cAAc;EACd,WAAW,YAAY;EACvB,UAAU;;cAGE;EACZ;EACA;EACA;EACA;EACA,WAAW;EACX,YAAY;EACZ,UAAU,YAAY;EACtB,SAAS;EACT;EACA,aAAa;EACb;EAEA,cACC,UACA,YACA,aACA,WACA,UACA,WACE;EAmBH,eAAe,qBAAqB;;UAS3B;EACT;EACA;EACA,KAAK;EACL,WAAW;;iBAGI,cACf,UACA,YAAY,iBACZ,KACA,YACE,oBAAoB;iBAYP,WACf,aACA,WAAU,YAAY,mBACtB,UAAS,sBACP"}
1
+ {"version":3,"file":"legacyContentCtx.d.ts","names":[],"sources":["../../../src/content/codec/legacyContentCtx.ts"],"mappings":";;;UASU;EACT;EACA;EACA,YAAY;EACZ,cAAc;EACd,WAAW,YAAY;EACvB,UAAU;;cAGE;EACZ;EACA;EACA;EACA;EACA,WAAW;EACX,YAAY;EACZ,UAAU,YAAY;EACtB,SAAS;EACT;EACA,aAAa;EACb;EAEA,cACC,UACA,YACA,aACA,WACA,UACA,WACE;EAoBH,eAAe,qBAAqB;;UAS3B;EACT;EACA;EACA,KAAK;EACL,WAAW;;iBAGI,cACf,UACA,YAAY,iBACZ,KACA,YACE,oBAAoB;iBAYP,WACf,aACA,WAAU,YAAY,mBACtB,UAAS,sBACP"}
@@ -1,4 +1,8 @@
1
+ import { v5 } from "uuid";
1
2
  //#region src/content/codec/legacyContentCtx.ts
3
+ function uuidV5ForPath(path) {
4
+ return v5(JSON.stringify(path), v5.URL);
5
+ }
2
6
  var LegacyContentCtx = class LegacyContentCtx {
3
7
  fieldKey;
4
8
  prefixedKey;
@@ -24,7 +28,7 @@ var LegacyContentCtx = class LegacyContentCtx {
24
28
  this.keyOfType = `${prefixedKey}_TYPE`;
25
29
  this.keyOfKey = `${prefixedContentKey}_KEY`;
26
30
  this.fieldType = this.allTypes.get(this.prefixedKey);
27
- this.fieldContentKey = this.allKeys.get(prefixedContentKey) ?? crypto.randomUUID();
31
+ this.fieldContentKey = this.allKeys.get(prefixedContentKey) ?? uuidV5ForPath([...this.contentPath, this.contentKey]);
28
32
  }
29
33
  withContentKey(contentKey) {
30
34
  return new LegacyContentCtx({
@@ -1 +1 @@
1
- {"version":3,"file":"legacyContentCtx.js","names":[],"sources":["../../../src/content/codec/legacyContentCtx.ts"],"sourcesContent":["import type { z } from \"zod/mini\"\n\nimport type { FieldOrSliceType } from \"../../model/widget\"\n\ninterface LegacyContentCtxParams {\n\tfieldKey: string\n\tcontentKey?: string\n\tfieldPath?: Array<string>\n\tcontentPath?: Array<string>\n\tallTypes?: Map<string, FieldOrSliceType>\n\tallKeys?: Map<string, string>\n}\n\nexport class LegacyContentCtx {\n\tfieldKey: string\n\tprefixedKey: string\n\tkeyOfType: string\n\tkeyOfKey: string\n\tfieldPath: Array<string>\n\tfieldType?: FieldOrSliceType | undefined\n\tallTypes: Map<string, FieldOrSliceType>\n\tallKeys: Map<string, string>\n\tcontentKey: string\n\tcontentPath: Array<string>\n\tfieldContentKey: string\n\n\tconstructor({\n\t\tfieldKey,\n\t\tcontentKey,\n\t\tcontentPath,\n\t\tfieldPath,\n\t\tallTypes,\n\t\tallKeys,\n\t}: LegacyContentCtxParams) {\n\t\tthis.fieldKey = fieldKey\n\t\tthis.contentKey = contentKey || fieldKey\n\t\tthis.fieldPath = fieldPath || []\n\t\tthis.contentPath = contentPath || []\n\t\tthis.allTypes = allTypes || new Map<string, FieldOrSliceType>()\n\t\tthis.allKeys = allKeys || new Map<string, string>()\n\n\t\tconst prefixedKey = Array.of(this.fieldPath, [this.fieldKey]).flat().join(\".\")\n\n\t\tconst prefixedContentKey = Array.of(this.contentPath, [this.contentKey]).flat().join(\".\")\n\n\t\tthis.prefixedKey = prefixedKey\n\t\tthis.keyOfType = `${prefixedKey}_TYPE`\n\t\tthis.keyOfKey = `${prefixedContentKey}_KEY`\n\t\tthis.fieldType = this.allTypes.get(this.prefixedKey)\n\t\tthis.fieldContentKey = this.allKeys.get(prefixedContentKey) ?? crypto.randomUUID()\n\t}\n\n\twithContentKey(contentKey: string): LegacyContentCtx {\n\t\treturn new LegacyContentCtx({\n\t\t\t...this,\n\t\t\tcontentPath: [...this.contentPath, this.contentKey],\n\t\t\tcontentKey,\n\t\t})\n\t}\n}\n\ninterface GetFieldCtxParams {\n\tfieldKey: string\n\tcontentKey?: string\n\tctx: LegacyContentCtx\n\tprefixes?: Array<string>\n}\n\nexport function getFieldCtx({\n\tfieldKey,\n\tcontentKey: contentKeyParam,\n\tctx,\n\tprefixes,\n}: GetFieldCtxParams): LegacyContentCtx {\n\tconst contentKey = contentKeyParam || fieldKey\n\treturn new LegacyContentCtx({\n\t\tfieldKey,\n\t\tcontentKey,\n\t\tcontentPath: [...ctx.contentPath, ctx.contentKey, ...(prefixes || [])],\n\t\tfieldPath: [...ctx.fieldPath, ctx.fieldKey, ...(prefixes || [])],\n\t\tallTypes: ctx.allTypes,\n\t\tallKeys: ctx.allKeys,\n\t})\n}\n\nexport function defaultCtx(\n\tkey: string,\n\tallTypes: Map<string, FieldOrSliceType> = new Map(),\n\tallKeys: Map<string, string> = new Map(),\n): LegacyContentCtx {\n\treturn new LegacyContentCtx({\n\t\tfieldKey: key,\n\t\tcontentKey: key,\n\t\tcontentPath: [],\n\t\tfieldPath: [],\n\t\tallTypes,\n\t\tallKeys,\n\t})\n}\n\ntype WithTypes<T> = {\n\tkeys: Record<string, string>\n\ttypes: Record<string, FieldOrSliceType>\n\tcontent: T\n}\n\nexport type LegacyCodec<A, LegacyRaw, AllowUndefined extends boolean = false> = {\n\tname: string\n\tis(input: unknown): input is A\n\ttoContent(\n\t\tinput: unknown,\n\t): z.core.util.SafeParseSuccess<A> | z.core.util.SafeParseError<LegacyRaw | unknown>\n\tfromContent(\n\t\tvalue: A,\n\t): AllowUndefined extends false ? WithTypes<LegacyRaw> : WithTypes<LegacyRaw> | undefined\n}\n"],"mappings":";AAaA,IAAa,mBAAb,MAAa,iBAAiB;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA,YAAY,EACX,UACA,YACA,aACA,WACA,UACA,WAC0B;EAC1B,KAAK,WAAW;EAChB,KAAK,aAAa,cAAc;EAChC,KAAK,YAAY,aAAa,CAAC;EAC/B,KAAK,cAAc,eAAe,CAAC;EACnC,KAAK,WAAW,4BAAY,IAAI,IAA8B;EAC9D,KAAK,UAAU,2BAAW,IAAI,IAAoB;EAElD,MAAM,cAAc,MAAM,GAAG,KAAK,WAAW,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG;EAE7E,MAAM,qBAAqB,MAAM,GAAG,KAAK,aAAa,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG;EAExF,KAAK,cAAc;EACnB,KAAK,YAAY,GAAG,YAAY;EAChC,KAAK,WAAW,GAAG,mBAAmB;EACtC,KAAK,YAAY,KAAK,SAAS,IAAI,KAAK,WAAW;EACnD,KAAK,kBAAkB,KAAK,QAAQ,IAAI,kBAAkB,KAAK,OAAO,WAAW;CAClF;CAEA,eAAe,YAAsC;EACpD,OAAO,IAAI,iBAAiB;GAC3B,GAAG;GACH,aAAa,CAAC,GAAG,KAAK,aAAa,KAAK,UAAU;GAClD;EACD,CAAC;CACF;AACD;AASA,SAAgB,YAAY,EAC3B,UACA,YAAY,iBACZ,KACA,YACuC;CAEvC,OAAO,IAAI,iBAAiB;EAC3B;EACA,YAHkB,mBAAmB;EAIrC,aAAa;GAAC,GAAG,IAAI;GAAa,IAAI;GAAY,GAAI,YAAY,CAAC;EAAE;EACrE,WAAW;GAAC,GAAG,IAAI;GAAW,IAAI;GAAU,GAAI,YAAY,CAAC;EAAE;EAC/D,UAAU,IAAI;EACd,SAAS,IAAI;CACd,CAAC;AACF;AAEA,SAAgB,WACf,KACA,2BAA0C,IAAI,IAAI,GAClD,0BAA+B,IAAI,IAAI,GACpB;CACnB,OAAO,IAAI,iBAAiB;EAC3B,UAAU;EACV,YAAY;EACZ,aAAa,CAAC;EACd,WAAW,CAAC;EACZ;EACA;CACD,CAAC;AACF"}
1
+ {"version":3,"file":"legacyContentCtx.js","names":["uuidV5"],"sources":["../../../src/content/codec/legacyContentCtx.ts"],"sourcesContent":["import { v5 as uuidV5 } from \"uuid\"\nimport type { z } from \"zod/mini\"\n\nimport type { FieldOrSliceType } from \"../../model/widget\"\n\nfunction uuidV5ForPath(path: string[]): string {\n\treturn uuidV5(JSON.stringify(path), uuidV5.URL)\n}\n\ninterface LegacyContentCtxParams {\n\tfieldKey: string\n\tcontentKey?: string\n\tfieldPath?: Array<string>\n\tcontentPath?: Array<string>\n\tallTypes?: Map<string, FieldOrSliceType>\n\tallKeys?: Map<string, string>\n}\n\nexport class LegacyContentCtx {\n\tfieldKey: string\n\tprefixedKey: string\n\tkeyOfType: string\n\tkeyOfKey: string\n\tfieldPath: Array<string>\n\tfieldType?: FieldOrSliceType | undefined\n\tallTypes: Map<string, FieldOrSliceType>\n\tallKeys: Map<string, string>\n\tcontentKey: string\n\tcontentPath: Array<string>\n\tfieldContentKey: string\n\n\tconstructor({\n\t\tfieldKey,\n\t\tcontentKey,\n\t\tcontentPath,\n\t\tfieldPath,\n\t\tallTypes,\n\t\tallKeys,\n\t}: LegacyContentCtxParams) {\n\t\tthis.fieldKey = fieldKey\n\t\tthis.contentKey = contentKey || fieldKey\n\t\tthis.fieldPath = fieldPath || []\n\t\tthis.contentPath = contentPath || []\n\t\tthis.allTypes = allTypes || new Map<string, FieldOrSliceType>()\n\t\tthis.allKeys = allKeys || new Map<string, string>()\n\n\t\tconst prefixedKey = Array.of(this.fieldPath, [this.fieldKey]).flat().join(\".\")\n\n\t\tconst prefixedContentKey = Array.of(this.contentPath, [this.contentKey]).flat().join(\".\")\n\n\t\tthis.prefixedKey = prefixedKey\n\t\tthis.keyOfType = `${prefixedKey}_TYPE`\n\t\tthis.keyOfKey = `${prefixedContentKey}_KEY`\n\t\tthis.fieldType = this.allTypes.get(this.prefixedKey)\n\t\tthis.fieldContentKey =\n\t\t\tthis.allKeys.get(prefixedContentKey) ?? uuidV5ForPath([...this.contentPath, this.contentKey])\n\t}\n\n\twithContentKey(contentKey: string): LegacyContentCtx {\n\t\treturn new LegacyContentCtx({\n\t\t\t...this,\n\t\t\tcontentPath: [...this.contentPath, this.contentKey],\n\t\t\tcontentKey,\n\t\t})\n\t}\n}\n\ninterface GetFieldCtxParams {\n\tfieldKey: string\n\tcontentKey?: string\n\tctx: LegacyContentCtx\n\tprefixes?: Array<string>\n}\n\nexport function getFieldCtx({\n\tfieldKey,\n\tcontentKey: contentKeyParam,\n\tctx,\n\tprefixes,\n}: GetFieldCtxParams): LegacyContentCtx {\n\tconst contentKey = contentKeyParam || fieldKey\n\treturn new LegacyContentCtx({\n\t\tfieldKey,\n\t\tcontentKey,\n\t\tcontentPath: [...ctx.contentPath, ctx.contentKey, ...(prefixes || [])],\n\t\tfieldPath: [...ctx.fieldPath, ctx.fieldKey, ...(prefixes || [])],\n\t\tallTypes: ctx.allTypes,\n\t\tallKeys: ctx.allKeys,\n\t})\n}\n\nexport function defaultCtx(\n\tkey: string,\n\tallTypes: Map<string, FieldOrSliceType> = new Map(),\n\tallKeys: Map<string, string> = new Map(),\n): LegacyContentCtx {\n\treturn new LegacyContentCtx({\n\t\tfieldKey: key,\n\t\tcontentKey: key,\n\t\tcontentPath: [],\n\t\tfieldPath: [],\n\t\tallTypes,\n\t\tallKeys,\n\t})\n}\n\ntype WithTypes<T> = {\n\tkeys: Record<string, string>\n\ttypes: Record<string, FieldOrSliceType>\n\tcontent: T\n}\n\nexport type LegacyCodec<A, LegacyRaw, AllowUndefined extends boolean = false> = {\n\tname: string\n\tis(input: unknown): input is A\n\ttoContent(\n\t\tinput: unknown,\n\t): z.core.util.SafeParseSuccess<A> | z.core.util.SafeParseError<LegacyRaw | unknown>\n\tfromContent(\n\t\tvalue: A,\n\t): AllowUndefined extends false ? WithTypes<LegacyRaw> : WithTypes<LegacyRaw> | undefined\n}\n"],"mappings":";;AAKA,SAAS,cAAc,MAAwB;CAC9C,OAAOA,GAAO,KAAK,UAAU,IAAI,GAAGA,GAAO,GAAG;AAC/C;AAWA,IAAa,mBAAb,MAAa,iBAAiB;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA,YAAY,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EACV,YAAY;EACZ,aAAa,CAAC;EACd,WAAW,CAAC;EACZ;EACA;CACD,CAAC;AACF"}
@@ -15,7 +15,7 @@ declare const EmbedContentSchema: z.ZodMiniObject<{
15
15
  thumbnail_height: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniNumber<number>>>;
16
16
  html: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
17
17
  __TYPE__: z.ZodMiniLiteral<"EmbedContent">;
18
- all: z.ZodMiniUnknown;
18
+ all: z.ZodMiniOptional<z.ZodMiniUnknown>;
19
19
  }, z.core.$strip>;
20
20
  type EmbedContent = z.infer<typeof EmbedContentSchema>;
21
21
  //#endregion
@@ -4,7 +4,7 @@ import { z } from "zod/mini";
4
4
  const EmbedContentType = "EmbedContent";
5
5
  const EmbedContentSchema = z.extend(EmbedLegacySchema, {
6
6
  __TYPE__: z.literal(EmbedContentType),
7
- all: z.unknown()
7
+ all: z.optional(z.unknown())
8
8
  });
9
9
  //#endregion
10
10
  export { EmbedContentSchema, EmbedContentType };
@@ -1 +1 @@
1
- {"version":3,"file":"embed.js","names":[],"sources":["../../src/content/embed.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { EmbedLegacySchema } from \"./legacy/embed\"\n\nexport const EmbedContentType = \"EmbedContent\" as const\n\nexport const EmbedContentSchema = z.extend(EmbedLegacySchema, {\n\t__TYPE__: z.literal(EmbedContentType),\n\tall: z.unknown(),\n})\n\nexport type EmbedContent = z.infer<typeof EmbedContentSchema>\n"],"mappings":";;;AAIA,MAAa,mBAAmB;AAEhC,MAAa,qBAAqB,EAAE,OAAO,mBAAmB;CAC7D,UAAU,EAAE,QAAQ,gBAAgB;CACpC,KAAK,EAAE,QAAQ;AAChB,CAAC"}
1
+ {"version":3,"file":"embed.js","names":[],"sources":["../../src/content/embed.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { EmbedLegacySchema } from \"./legacy/embed\"\n\nexport const EmbedContentType = \"EmbedContent\" as const\n\nexport const EmbedContentSchema = z.extend(EmbedLegacySchema, {\n\t__TYPE__: z.literal(EmbedContentType),\n\tall: z.optional(z.unknown()),\n})\n\nexport type EmbedContent = z.infer<typeof EmbedContentSchema>\n"],"mappings":";;;AAIA,MAAa,mBAAmB;AAEhC,MAAa,qBAAqB,EAAE,OAAO,mBAAmB;CAC7D,UAAU,EAAE,QAAQ,gBAAgB;CACpC,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC;AAC5B,CAAC"}
@@ -20,8 +20,8 @@ declare const ImageContentSchema: z.ZodMiniObject<{
20
20
  background: z.ZodMiniString<string>;
21
21
  }, z.core.$strip>;
22
22
  url: z.ZodMiniOptional<z.ZodMiniString<string>>;
23
- credits: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
24
- alt: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
23
+ credits: z.ZodMiniOptional<z.ZodMiniDefault<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>>;
24
+ alt: z.ZodMiniOptional<z.ZodMiniDefault<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>>;
25
25
  provider: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
26
26
  thumbnails: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniObject<{
27
27
  origin: z.ZodMiniObject<{
@@ -41,8 +41,8 @@ declare const ImageContentSchema: z.ZodMiniObject<{
41
41
  background: z.ZodMiniString<string>;
42
42
  }, z.core.$strip>;
43
43
  url: z.ZodMiniOptional<z.ZodMiniString<string>>;
44
- credits: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
45
- alt: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
44
+ credits: z.ZodMiniOptional<z.ZodMiniDefault<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>>;
45
+ alt: z.ZodMiniOptional<z.ZodMiniDefault<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>>;
46
46
  provider: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
47
47
  }, z.core.$strip>>>;
48
48
  __TYPE__: z.ZodMiniLiteral<"ImageContent">;
@@ -18,8 +18,8 @@ declare const ImageLegacyViewSchema: z.ZodMiniObject<{
18
18
  background: z.ZodMiniString<string>;
19
19
  }, z.core.$strip>;
20
20
  url: z.ZodMiniOptional<z.ZodMiniString<string>>;
21
- credits: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
22
- alt: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
21
+ credits: z.ZodMiniOptional<z.ZodMiniDefault<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>>;
22
+ alt: z.ZodMiniOptional<z.ZodMiniDefault<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>>;
23
23
  provider: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
24
24
  }, z.core.$strip>;
25
25
  //#endregion
@@ -22,8 +22,8 @@ const ImageLegacyViewSchema = z.object({
22
22
  height: z.number(),
23
23
  edit: EditSchema,
24
24
  url: z.optional(z.string()),
25
- credits: z.optional(NonEmptyStringOrNullSchema),
26
- alt: z.optional(NonEmptyStringOrNullSchema),
25
+ credits: z.optional(z._default(NonEmptyStringOrNullSchema, null)),
26
+ alt: z.optional(z._default(NonEmptyStringOrNullSchema, null)),
27
27
  provider: z.nullish(z.string())
28
28
  });
29
29
  const ImageLegacySchema = z.extend(ImageLegacyViewSchema, { thumbnails: z.optional(z.record(z.string(), ImageLegacyViewSchema)) });
@@ -1 +1 @@
1
- {"version":3,"file":"image.js","names":[],"sources":["../../../src/content/legacy/image.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nconst OriginSchema = z.object({\n\tid: z.string(),\n\turl: z.string(),\n\twidth: z.number(),\n\theight: z.number(),\n})\n\nconst CropSchema = z.object({\n\tx: z.number(),\n\ty: z.number(),\n})\n\nconst EditSchema = z.object({\n\tzoom: z.number(),\n\tcrop: CropSchema,\n\tbackground: z.string(),\n})\n\nconst NonEmptyStringOrNullSchema = z.pipe(\n\tz.nullish(z.string()),\n\tz.transform((value) => (typeof value === \"string\" && value.length > 0 ? value : null)),\n)\n\nexport const ImageLegacyViewSchema = z.object({\n\torigin: OriginSchema,\n\twidth: z.number(),\n\theight: z.number(),\n\tedit: EditSchema,\n\turl: z.optional(z.string()),\n\tcredits: z.optional(NonEmptyStringOrNullSchema),\n\talt: z.optional(NonEmptyStringOrNullSchema),\n\tprovider: z.nullish(z.string()),\n})\n\nexport type ImageLegacyView = z.infer<typeof ImageLegacyViewSchema>\n\nexport const ImageLegacySchema = z.extend(ImageLegacyViewSchema, {\n\tthumbnails: z.optional(z.record(z.string(), ImageLegacyViewSchema)),\n})\n\nexport type ImageLegacy = z.infer<typeof ImageLegacySchema>\n"],"mappings":";;AAEA,MAAM,eAAe,EAAE,OAAO;CAC7B,IAAI,EAAE,OAAO;CACb,KAAK,EAAE,OAAO;CACd,OAAO,EAAE,OAAO;CAChB,QAAQ,EAAE,OAAO;AAClB,CAAC;AAED,MAAM,aAAa,EAAE,OAAO;CAC3B,GAAG,EAAE,OAAO;CACZ,GAAG,EAAE,OAAO;AACb,CAAC;AAED,MAAM,aAAa,EAAE,OAAO;CAC3B,MAAM,EAAE,OAAO;CACf,MAAM;CACN,YAAY,EAAE,OAAO;AACtB,CAAC;AAED,MAAM,6BAA6B,EAAE,KACpC,EAAE,QAAQ,EAAE,OAAO,CAAC,GACpB,EAAE,WAAW,UAAW,OAAO,UAAU,YAAY,MAAM,SAAS,IAAI,QAAQ,IAAK,CACtF;AAEA,MAAa,wBAAwB,EAAE,OAAO;CAC7C,QAAQ;CACR,OAAO,EAAE,OAAO;CAChB,QAAQ,EAAE,OAAO;CACjB,MAAM;CACN,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC;CAC1B,SAAS,EAAE,SAAS,0BAA0B;CAC9C,KAAK,EAAE,SAAS,0BAA0B;CAC1C,UAAU,EAAE,QAAQ,EAAE,OAAO,CAAC;AAC/B,CAAC;AAID,MAAa,oBAAoB,EAAE,OAAO,uBAAuB,EAChE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,qBAAqB,CAAC,EACnE,CAAC"}
1
+ {"version":3,"file":"image.js","names":[],"sources":["../../../src/content/legacy/image.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nconst OriginSchema = z.object({\n\tid: z.string(),\n\turl: z.string(),\n\twidth: z.number(),\n\theight: z.number(),\n})\n\nconst CropSchema = z.object({\n\tx: z.number(),\n\ty: z.number(),\n})\n\nconst EditSchema = z.object({\n\tzoom: z.number(),\n\tcrop: CropSchema,\n\tbackground: z.string(),\n})\n\nconst NonEmptyStringOrNullSchema = z.pipe(\n\tz.nullish(z.string()),\n\tz.transform((value) => (typeof value === \"string\" && value.length > 0 ? value : null)),\n)\n\nexport const ImageLegacyViewSchema = z.object({\n\torigin: OriginSchema,\n\twidth: z.number(),\n\theight: z.number(),\n\tedit: EditSchema,\n\turl: z.optional(z.string()),\n\tcredits: z.optional(z._default(NonEmptyStringOrNullSchema, null)),\n\talt: z.optional(z._default(NonEmptyStringOrNullSchema, null)),\n\tprovider: z.nullish(z.string()),\n})\n\nexport type ImageLegacyView = z.infer<typeof ImageLegacyViewSchema>\n\nexport const ImageLegacySchema = z.extend(ImageLegacyViewSchema, {\n\tthumbnails: z.optional(z.record(z.string(), ImageLegacyViewSchema)),\n})\n\nexport type ImageLegacy = z.infer<typeof ImageLegacySchema>\n"],"mappings":";;AAEA,MAAM,eAAe,EAAE,OAAO;CAC7B,IAAI,EAAE,OAAO;CACb,KAAK,EAAE,OAAO;CACd,OAAO,EAAE,OAAO;CAChB,QAAQ,EAAE,OAAO;AAClB,CAAC;AAED,MAAM,aAAa,EAAE,OAAO;CAC3B,GAAG,EAAE,OAAO;CACZ,GAAG,EAAE,OAAO;AACb,CAAC;AAED,MAAM,aAAa,EAAE,OAAO;CAC3B,MAAM,EAAE,OAAO;CACf,MAAM;CACN,YAAY,EAAE,OAAO;AACtB,CAAC;AAED,MAAM,6BAA6B,EAAE,KACpC,EAAE,QAAQ,EAAE,OAAO,CAAC,GACpB,EAAE,WAAW,UAAW,OAAO,UAAU,YAAY,MAAM,SAAS,IAAI,QAAQ,IAAK,CACtF;AAEA,MAAa,wBAAwB,EAAE,OAAO;CAC7C,QAAQ;CACR,OAAO,EAAE,OAAO;CAChB,QAAQ,EAAE,OAAO;CACjB,MAAM;CACN,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC;CAC1B,SAAS,EAAE,SAAS,EAAE,SAAS,4BAA4B,IAAI,CAAC;CAChE,KAAK,EAAE,SAAS,EAAE,SAAS,4BAA4B,IAAI,CAAC;CAC5D,UAAU,EAAE,QAAQ,EAAE,OAAO,CAAC;AAC/B,CAAC;AAID,MAAa,oBAAoB,EAAE,OAAO,uBAAuB,EAChE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,qBAAqB,CAAC,EACnE,CAAC"}
@@ -34,7 +34,7 @@ declare const LabelSpanSchema: z.ZodMiniObject<{
34
34
  type: z.ZodMiniLiteral<"label">;
35
35
  start: z.ZodMiniNumber<number>;
36
36
  end: z.ZodMiniNumber<number>;
37
- data: z.ZodMiniPipe<z.ZodMiniUnknown, z.ZodMiniTransform<string, unknown>>;
37
+ data: z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniUnknown>, z.ZodMiniTransform<string, unknown>>;
38
38
  }, z.core.$strip>;
39
39
  type LabelSpan = z.infer<typeof LabelSpanSchema>;
40
40
  declare const BasicSpanSchema: z.ZodMiniObject<{
@@ -88,8 +88,8 @@ declare const ImageBlockLegacySchema: z.ZodMiniObject<{
88
88
  background: z.ZodMiniString<string>;
89
89
  }, z.core.$strip>;
90
90
  url: z.ZodMiniOptional<z.ZodMiniString<string>>;
91
- credits: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
92
- alt: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
91
+ credits: z.ZodMiniOptional<z.ZodMiniDefault<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>>;
92
+ alt: z.ZodMiniOptional<z.ZodMiniDefault<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>>;
93
93
  provider: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
94
94
  linkTo: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniType<FilledLinkLegacyValue, unknown, z.core.$ZodTypeInternals<FilledLinkLegacyValue, unknown>>>>;
95
95
  }, z.core.$strip>;
@@ -30,7 +30,7 @@ const LabelSpanSchema = z.object({
30
30
  type: z.literal("label"),
31
31
  start: z.number(),
32
32
  end: z.number(),
33
- data: z.pipe(z.unknown(), z.transform((value) => typeof value === "string" && value.length > 0 ? value : ""))
33
+ data: z.pipe(z.optional(z.unknown()), z.transform((value) => typeof value === "string" && value.length > 0 ? value : ""))
34
34
  });
35
35
  const BasicSpanSchema = z.object({
36
36
  type: z.union([
@@ -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\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\nexport type RichTextLegacySpan = Span<FilledLinkLegacyValue>\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(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;AACL;AAYA,MAAM,0BAGL,SAEA,EAAE,OAAO;CACR,MAAM,EAAE,QAAQ,iBAAiB,SAAS;CAC1C,OAAO,EAAE,OAAO;CAChB,KAAK,EAAE,OAAO;CACd;AACD,CAAC;AAEF,MAAM,kBAAkB,EAAE,OAAO;CAChC,MAAM,EAAE,QAAQ,OAAO;CACvB,OAAO,EAAE,OAAO;CAChB,KAAK,EAAE,OAAO;CACd,MAAM,EAAE,KACP,EAAE,QAAQ,GACV,EAAE,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AAS,EAAE,OAAO,CAAC;CAC5B,WAAW,EAAE,SAAS,EAAE,OAAO,CAAC;AACjC,CAAC;AAEF,MAAM,wBAAwB,mBAAmB,2BAA2B;AAO5E,MAAa,uBAIZ,MACA,WAEA,EAAE,OAAO;CACR,MAAM,EAAE,QAAQ,iBAAiB,KAAK;CACtC,MAAM,EAAE,OAAO,MAAM,EAAE,QAAQ,EAAE,QAAQ,MAAM,EAAE,CAAC;CAClD,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC;CAC3B,WAAW,EAAE,QAAQ,EAAE,OAAO,CAAC;AAChC,CAAC;AAEF,MAAM,yBAAyB,oBAC9B,uBACA,2BACD;AAMA,MAAa,uBAGZ,SAEA,EAAE,OAAO;CACR,MAAM,EAAE,QAAQ,iBAAiB,KAAK;CACtC;CACA,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC;CAC3B,WAAW,EAAE,QAAQ,EAAE,OAAO,CAAC;AAChC,CAAC;AAEF,MAAM,yBAAyB,oBAAoB,sBAAsB;AAKzE,MAAa,4BAAgE,EAAE,mBAC9E,QACA;CAAC;CAAuB;CAAwB;AAAsB,CACvE;AAIA,MAAa,uBAAuB,EAAE,MAAM,yBAAyB"}
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.optional(z.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\nexport type RichTextLegacySpan = Span<FilledLinkLegacyValue>\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(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,OA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z.ZodMiniOptional<z.ZodMiniString<string>>;
50
- credits: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
51
- alt: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
50
+ credits: z.ZodMiniOptional<z.ZodMiniDefault<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>>;
51
+ alt: z.ZodMiniOptional<z.ZodMiniDefault<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>>;
52
52
  provider: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
53
53
  linkTo: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniType<FilledLinkContentValue, unknown, z.core.$ZodTypeInternals<FilledLinkContentValue, unknown>>>>;
54
54
  }, z.core.$strip>;
@@ -73,7 +73,7 @@ declare const RichTextContentEmbedBlockSchema: z.ZodMiniObject<{
73
73
  thumbnail_height: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniNumber<number>>>;
74
74
  html: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
75
75
  __TYPE__: z.ZodMiniLiteral<"EmbedContent">;
76
- all: z.ZodMiniUnknown;
76
+ all: z.ZodMiniOptional<z.ZodMiniUnknown>;
77
77
  }, z.core.$strip>;
78
78
  label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
79
79
  direction: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
@@ -24,7 +24,7 @@ declare const LegacySliceContentSchema: z.ZodMiniDiscriminatedUnion<[z.ZodMiniDi
24
24
  thumbnail_height: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniNumber<number>>>;
25
25
  html: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
26
26
  __TYPE__: z.ZodMiniLiteral<"EmbedContent">;
27
- all: z.ZodMiniUnknown;
27
+ all: z.ZodMiniOptional<z.ZodMiniUnknown>;
28
28
  }, z.core.$strip>, z.ZodMiniObject<{
29
29
  position: z.ZodMiniObject<{
30
30
  lat: z.ZodMiniNumber<number>;
@@ -49,8 +49,8 @@ declare const LegacySliceContentSchema: z.ZodMiniDiscriminatedUnion<[z.ZodMiniDi
49
49
  background: z.ZodMiniString<string>;
50
50
  }, z.core.$strip>;
51
51
  url: z.ZodMiniOptional<z.ZodMiniString<string>>;
52
- credits: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
53
- alt: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
52
+ credits: z.ZodMiniOptional<z.ZodMiniDefault<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>>;
53
+ alt: z.ZodMiniOptional<z.ZodMiniDefault<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>>;
54
54
  provider: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
55
55
  thumbnails: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniObject<{
56
56
  origin: z.ZodMiniObject<{
@@ -70,8 +70,8 @@ declare const LegacySliceContentSchema: z.ZodMiniDiscriminatedUnion<[z.ZodMiniDi
70
70
  background: z.ZodMiniString<string>;
71
71
  }, z.core.$strip>;
72
72
  url: z.ZodMiniOptional<z.ZodMiniString<string>>;
73
- credits: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
74
- alt: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
73
+ credits: z.ZodMiniOptional<z.ZodMiniDefault<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>>;
74
+ alt: z.ZodMiniOptional<z.ZodMiniDefault<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>>;
75
75
  provider: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
76
76
  }, z.core.$strip>>>;
77
77
  __TYPE__: z.ZodMiniLiteral<"ImageContent">;
@@ -196,7 +196,7 @@ declare const CompositeSliceContentSchema: z.ZodMiniObject<{
196
196
  thumbnail_height: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniNumber<number>>>;
197
197
  html: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
198
198
  __TYPE__: z.ZodMiniLiteral<"EmbedContent">;
199
- all: z.ZodMiniUnknown;
199
+ all: z.ZodMiniOptional<z.ZodMiniUnknown>;
200
200
  }, z.core.$strip>, z.ZodMiniObject<{
201
201
  position: z.ZodMiniObject<{
202
202
  lat: z.ZodMiniNumber<number>;
@@ -221,8 +221,8 @@ declare const CompositeSliceContentSchema: z.ZodMiniObject<{
221
221
  background: z.ZodMiniString<string>;
222
222
  }, z.core.$strip>;
223
223
  url: z.ZodMiniOptional<z.ZodMiniString<string>>;
224
- credits: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
225
- alt: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
224
+ credits: z.ZodMiniOptional<z.ZodMiniDefault<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>>;
225
+ alt: z.ZodMiniOptional<z.ZodMiniDefault<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>>;
226
226
  provider: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
227
227
  thumbnails: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniObject<{
228
228
  origin: z.ZodMiniObject<{
@@ -242,8 +242,8 @@ declare const CompositeSliceContentSchema: z.ZodMiniObject<{
242
242
  background: z.ZodMiniString<string>;
243
243
  }, z.core.$strip>;
244
244
  url: z.ZodMiniOptional<z.ZodMiniString<string>>;
245
- credits: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
246
- alt: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
245
+ credits: z.ZodMiniOptional<z.ZodMiniDefault<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>>;
246
+ alt: z.ZodMiniOptional<z.ZodMiniDefault<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>>;
247
247
  provider: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
248
248
  }, z.core.$strip>>>;
249
249
  __TYPE__: z.ZodMiniLiteral<"ImageContent">;
@@ -368,7 +368,7 @@ declare const SharedSliceContentSchema: z.ZodMiniObject<{
368
368
  thumbnail_height: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniNumber<number>>>;
369
369
  html: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
370
370
  __TYPE__: z.ZodMiniLiteral<"EmbedContent">;
371
- all: z.ZodMiniUnknown;
371
+ all: z.ZodMiniOptional<z.ZodMiniUnknown>;
372
372
  }, z.core.$strip>, z.ZodMiniObject<{
373
373
  position: z.ZodMiniObject<{
374
374
  lat: z.ZodMiniNumber<number>;
@@ -393,8 +393,8 @@ declare const SharedSliceContentSchema: z.ZodMiniObject<{
393
393
  background: z.ZodMiniString<string>;
394
394
  }, z.core.$strip>;
395
395
  url: z.ZodMiniOptional<z.ZodMiniString<string>>;
396
- credits: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
397
- alt: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
396
+ credits: z.ZodMiniOptional<z.ZodMiniDefault<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>>;
397
+ alt: z.ZodMiniOptional<z.ZodMiniDefault<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>>;
398
398
  provider: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
399
399
  thumbnails: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniObject<{
400
400
  origin: z.ZodMiniObject<{
@@ -414,8 +414,8 @@ declare const SharedSliceContentSchema: z.ZodMiniObject<{
414
414
  background: z.ZodMiniString<string>;
415
415
  }, z.core.$strip>;
416
416
  url: z.ZodMiniOptional<z.ZodMiniString<string>>;
417
- credits: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
418
- alt: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
417
+ credits: z.ZodMiniOptional<z.ZodMiniDefault<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>>;
418
+ alt: z.ZodMiniOptional<z.ZodMiniDefault<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>>;
419
419
  provider: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
420
420
  }, z.core.$strip>>>;
421
421
  __TYPE__: z.ZodMiniLiteral<"ImageContent">;
@@ -29,7 +29,7 @@ declare const LegacySliceItemContentSchema: z.ZodMiniObject<{
29
29
  thumbnail_height: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniNumber<number>>>;
30
30
  html: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
31
31
  __TYPE__: z.ZodMiniLiteral<"EmbedContent">;
32
- all: z.ZodMiniUnknown;
32
+ all: z.ZodMiniOptional<z.ZodMiniUnknown>;
33
33
  }, z.core.$strip>, z.ZodMiniObject<{
34
34
  position: z.ZodMiniObject<{
35
35
  lat: z.ZodMiniNumber<number>;
@@ -54,8 +54,8 @@ declare const LegacySliceItemContentSchema: z.ZodMiniObject<{
54
54
  background: z.ZodMiniString<string>;
55
55
  }, z.core.$strip>;
56
56
  url: z.ZodMiniOptional<z.ZodMiniString<string>>;
57
- credits: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
58
- alt: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
57
+ credits: z.ZodMiniOptional<z.ZodMiniDefault<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>>;
58
+ alt: z.ZodMiniOptional<z.ZodMiniDefault<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>>;
59
59
  provider: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
60
60
  thumbnails: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniObject<{
61
61
  origin: z.ZodMiniObject<{
@@ -75,8 +75,8 @@ declare const LegacySliceItemContentSchema: z.ZodMiniObject<{
75
75
  background: z.ZodMiniString<string>;
76
76
  }, z.core.$strip>;
77
77
  url: z.ZodMiniOptional<z.ZodMiniString<string>>;
78
- credits: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
79
- alt: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
78
+ credits: z.ZodMiniOptional<z.ZodMiniDefault<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>>;
79
+ alt: z.ZodMiniOptional<z.ZodMiniDefault<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>>;
80
80
  provider: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
81
81
  }, z.core.$strip>>>;
82
82
  __TYPE__: z.ZodMiniLiteral<"ImageContent">;
@@ -206,7 +206,7 @@ declare const CompositeSliceItemContentSchema: z.ZodMiniObject<{
206
206
  thumbnail_height: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniNumber<number>>>;
207
207
  html: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
208
208
  __TYPE__: z.ZodMiniLiteral<"EmbedContent">;
209
- all: z.ZodMiniUnknown;
209
+ all: z.ZodMiniOptional<z.ZodMiniUnknown>;
210
210
  }, z.core.$strip>, z.ZodMiniObject<{
211
211
  position: z.ZodMiniObject<{
212
212
  lat: z.ZodMiniNumber<number>;
@@ -231,8 +231,8 @@ declare const CompositeSliceItemContentSchema: z.ZodMiniObject<{
231
231
  background: z.ZodMiniString<string>;
232
232
  }, z.core.$strip>;
233
233
  url: z.ZodMiniOptional<z.ZodMiniString<string>>;
234
- credits: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
235
- alt: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
234
+ credits: z.ZodMiniOptional<z.ZodMiniDefault<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>>;
235
+ alt: z.ZodMiniOptional<z.ZodMiniDefault<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>>;
236
236
  provider: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
237
237
  thumbnails: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniObject<{
238
238
  origin: z.ZodMiniObject<{
@@ -252,8 +252,8 @@ declare const CompositeSliceItemContentSchema: z.ZodMiniObject<{
252
252
  background: z.ZodMiniString<string>;
253
253
  }, z.core.$strip>;
254
254
  url: z.ZodMiniOptional<z.ZodMiniString<string>>;
255
- credits: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
256
- alt: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
255
+ credits: z.ZodMiniOptional<z.ZodMiniDefault<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>>;
256
+ alt: z.ZodMiniOptional<z.ZodMiniDefault<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>>;
257
257
  provider: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
258
258
  }, z.core.$strip>>>;
259
259
  __TYPE__: z.ZodMiniLiteral<"ImageContent">;
@@ -383,7 +383,7 @@ declare const SharedSliceItemContentSchema: z.ZodMiniObject<{
383
383
  thumbnail_height: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniNumber<number>>>;
384
384
  html: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
385
385
  __TYPE__: z.ZodMiniLiteral<"EmbedContent">;
386
- all: z.ZodMiniUnknown;
386
+ all: z.ZodMiniOptional<z.ZodMiniUnknown>;
387
387
  }, z.core.$strip>, z.ZodMiniObject<{
388
388
  position: z.ZodMiniObject<{
389
389
  lat: z.ZodMiniNumber<number>;
@@ -408,8 +408,8 @@ declare const SharedSliceItemContentSchema: z.ZodMiniObject<{
408
408
  background: z.ZodMiniString<string>;
409
409
  }, z.core.$strip>;
410
410
  url: z.ZodMiniOptional<z.ZodMiniString<string>>;
411
- credits: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
412
- alt: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
411
+ credits: z.ZodMiniOptional<z.ZodMiniDefault<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>>;
412
+ alt: z.ZodMiniOptional<z.ZodMiniDefault<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>>;
413
413
  provider: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
414
414
  thumbnails: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniObject<{
415
415
  origin: z.ZodMiniObject<{
@@ -429,8 +429,8 @@ declare const SharedSliceItemContentSchema: z.ZodMiniObject<{
429
429
  background: z.ZodMiniString<string>;
430
430
  }, z.core.$strip>;
431
431
  url: z.ZodMiniOptional<z.ZodMiniString<string>>;
432
- credits: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
433
- alt: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
432
+ credits: z.ZodMiniOptional<z.ZodMiniDefault<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>>;
433
+ alt: z.ZodMiniOptional<z.ZodMiniDefault<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>>;
434
434
  provider: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
435
435
  }, z.core.$strip>>>;
436
436
  __TYPE__: z.ZodMiniLiteral<"ImageContent">;
@@ -1,5 +1,5 @@
1
1
  import { SharedSliceModel } from "../model/slice.js";
2
- import { DynamicCustomTypeModel, DynamicCustomTypeModelTab, StaticCustomTypeModel, StaticCustomTypeModelTab } from "../model/customType.js";
2
+ import { DynamicCustomTypeModel, DynamicCustomTypeModelTab, FlattenedStaticCustomTypeModel, StaticCustomTypeModel, StaticCustomTypeModelTab } from "../model/customType.js";
3
3
  declare namespace customTypeModel_d_exports {
4
4
  export { collectSharedSlices, filterMissingSharedSlices, flatten, serializeID, toDynamic, toStatic };
5
5
  }
@@ -7,7 +7,7 @@ declare function toStatic(customType: DynamicCustomTypeModel, sharedSlices: Map<
7
7
  declare function toDynamic(customType: StaticCustomTypeModel): DynamicCustomTypeModel;
8
8
  declare function flatten(customType: StaticCustomTypeModel): StaticCustomTypeModelTab;
9
9
  declare function flatten(customType: DynamicCustomTypeModel): DynamicCustomTypeModelTab;
10
- declare function collectSharedSlices(customType: StaticCustomTypeModel): Record<string, SharedSliceModel>;
10
+ declare function collectSharedSlices(customType: StaticCustomTypeModel | FlattenedStaticCustomTypeModel): Record<string, SharedSliceModel>;
11
11
  declare function filterMissingSharedSlices<TCustomType extends StaticCustomTypeModel | DynamicCustomTypeModel>(customType: TCustomType, sharedSlices: Map<string, SharedSliceModel> | Record<string, SharedSliceModel>): TCustomType;
12
12
  declare function serializeID(input: string): string;
13
13
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"customTypeModel.d.ts","names":[],"sources":["../../src/helpers/customTypeModel.ts"],"mappings":";;;;;iBAQgB,SACf,YAAY,wBACZ,cAAc,YAAY,oBAAoB,eAAe,oBAC3D;iBAwCa,UAAU,YAAY,wBAAwB;iBAkC9C,QAAQ,YAAY,wBAAwB;iBAC5C,QAAQ,YAAY,yBAAyB;iBAO7C,oBACf,YAAY,wBACV,eAAe;iBAiBF,0BACf,oBAAoB,wBAAwB,wBAE5C,YAAY,aACZ,cAAc,YAAY,oBAAoB,eAAe,oBAC3D;iBAuCa,YAAY"}
1
+ {"version":3,"file":"customTypeModel.d.ts","names":[],"sources":["../../src/helpers/customTypeModel.ts"],"mappings":";;;;;iBASgB,SACf,YAAY,wBACZ,cAAc,YAAY,oBAAoB,eAAe,oBAC3D;iBAwCa,UAAU,YAAY,wBAAwB;iBAkC9C,QAAQ,YAAY,wBAAwB;iBAC5C,QAAQ,YAAY,yBAAyB;iBAO7C,oBACf,YAAY,wBAAwB,iCAClC,eAAe;iBAiBF,0BACf,oBAAoB,wBAAwB,wBAE5C,YAAY,aACZ,cAAc,YAAY,oBAAoB,eAAe,oBAC3D;iBAuCa,YAAY"}
@@ -73,7 +73,7 @@ function flatten(customType) {
73
73
  }
74
74
  function collectSharedSlices(customType) {
75
75
  const sharedSlices = {};
76
- const flattened = flatten(customType);
76
+ const flattened = "fields" in customType ? customType.fields : flatten(customType);
77
77
  for (const widget of Object.values(flattened)) if (widget.type === "Slices" || widget.type === "Choice") {
78
78
  for (const [id, model] of Object.entries(widget.config?.choices || {})) if (model.type === "SharedSlice") sharedSlices[id] = model;
79
79
  }
@@ -1 +1 @@
1
- {"version":3,"file":"customTypeModel.js","names":[],"sources":["../../src/helpers/customTypeModel.ts"],"sourcesContent":["import type {\n\tDynamicCustomTypeModel,\n\tDynamicCustomTypeModelTab,\n\tStaticCustomTypeModel,\n\tStaticCustomTypeModelTab,\n} from \"../model/customType\"\nimport type { DynamicSliceModel, SharedSliceModel, StaticSliceModel } from \"../model/slice\"\n\nexport function toStatic(\n\tcustomType: DynamicCustomTypeModel,\n\tsharedSlices: Map<string, SharedSliceModel> | Record<string, SharedSliceModel>,\n): StaticCustomTypeModel {\n\tconst json: StaticCustomTypeModel[\"json\"] = {}\n\n\tconst sharedSlicesMap =\n\t\tsharedSlices instanceof Map ? sharedSlices : new Map(Object.entries(sharedSlices))\n\n\tfor (const [tabKey, tab] of Object.entries(customType.json)) {\n\t\tconst tabJSON: StaticCustomTypeModel[\"json\"][string] = {}\n\t\tfor (const [key, widget] of Object.entries(tab)) {\n\t\t\tswitch (widget.type) {\n\t\t\t\tcase \"Slices\":\n\t\t\t\tcase \"Choice\":\n\t\t\t\t\tconst choices: Record<string, StaticSliceModel> = {}\n\t\t\t\t\tfor (const [id, model] of Object.entries(widget.config?.choices || {})) {\n\t\t\t\t\t\tif (model.type === \"SharedSlice\") {\n\t\t\t\t\t\t\tconst sharedSlice = sharedSlicesMap.get(id)\n\t\t\t\t\t\t\tif (sharedSlice) {\n\t\t\t\t\t\t\t\tchoices[id] = sharedSlice\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tchoices[id] = model\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\ttabJSON[key] = {\n\t\t\t\t\t\t...widget,\n\t\t\t\t\t\tconfig: { ...widget.config, choices },\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\ttabJSON[key] = widget\n\t\t\t}\n\t\t}\n\n\t\tjson[tabKey] = tabJSON\n\t}\n\n\treturn { ...customType, json }\n}\n\nexport function toDynamic(customType: StaticCustomTypeModel): DynamicCustomTypeModel {\n\tconst json: DynamicCustomTypeModel[\"json\"] = {}\n\n\tfor (const [tabKey, tab] of Object.entries(customType.json)) {\n\t\tconst tabJSON: DynamicCustomTypeModel[\"json\"][string] = {}\n\t\tfor (const [key, widget] of Object.entries(tab)) {\n\t\t\tswitch (widget.type) {\n\t\t\t\tcase \"Slices\":\n\t\t\t\tcase \"Choice\":\n\t\t\t\t\tconst choices: Record<string, DynamicSliceModel> = {}\n\t\t\t\t\tfor (const [id, model] of Object.entries(widget.config?.choices || {})) {\n\t\t\t\t\t\tif (model.type === \"SharedSlice\") {\n\t\t\t\t\t\t\tchoices[id] = { type: \"SharedSlice\" }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tchoices[id] = model\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\ttabJSON[key] = {\n\t\t\t\t\t\t...widget,\n\t\t\t\t\t\tconfig: { ...widget.config, choices },\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\ttabJSON[key] = widget\n\t\t\t}\n\t\t}\n\n\t\tjson[tabKey] = tabJSON\n\t}\n\n\treturn { ...customType, json }\n}\n\nexport function flatten(customType: StaticCustomTypeModel): StaticCustomTypeModelTab\nexport function flatten(customType: DynamicCustomTypeModel): DynamicCustomTypeModelTab\nexport function flatten(\n\tcustomType: StaticCustomTypeModel | DynamicCustomTypeModel,\n): StaticCustomTypeModelTab | DynamicCustomTypeModelTab {\n\treturn Object.values(customType.json).reduce((acc, fields) => ({ ...acc, ...fields }), {})\n}\n\nexport function collectSharedSlices(\n\tcustomType: StaticCustomTypeModel,\n): Record<string, SharedSliceModel> {\n\tconst sharedSlices: Record<string, SharedSliceModel> = {}\n\n\tconst flattened = flatten(customType)\n\tfor (const widget of Object.values(flattened)) {\n\t\tif (widget.type === \"Slices\" || widget.type === \"Choice\") {\n\t\t\tfor (const [id, model] of Object.entries(widget.config?.choices || {})) {\n\t\t\t\tif (model.type === \"SharedSlice\") {\n\t\t\t\t\tsharedSlices[id] = model\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn sharedSlices\n}\n\nexport function filterMissingSharedSlices<\n\tTCustomType extends StaticCustomTypeModel | DynamicCustomTypeModel,\n>(\n\tcustomType: TCustomType,\n\tsharedSlices: Map<string, SharedSliceModel> | Record<string, SharedSliceModel>,\n): TCustomType {\n\tconst json: TCustomType[\"json\"] = {}\n\n\tconst sharedSlicesMap =\n\t\tsharedSlices instanceof Map ? sharedSlices : new Map(Object.entries(sharedSlices))\n\n\tfor (const [tabKey, tab] of Object.entries(customType.json)) {\n\t\tconst tabJSON: typeof tab = {}\n\t\tfor (const [key, widget] of Object.entries(tab)) {\n\t\t\tswitch (widget.type) {\n\t\t\t\tcase \"Slices\":\n\t\t\t\tcase \"Choice\":\n\t\t\t\t\tconst choices: Required<typeof widget>[\"config\"][\"choices\"] = {}\n\t\t\t\t\tfor (const [id, model] of Object.entries(widget.config?.choices || {})) {\n\t\t\t\t\t\tif (model.type === \"SharedSlice\") {\n\t\t\t\t\t\t\tif (sharedSlicesMap.get(id)) {\n\t\t\t\t\t\t\t\tchoices[id] = model\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tchoices[id] = model\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\ttabJSON[key] = {\n\t\t\t\t\t\t...widget,\n\t\t\t\t\t\tconfig: { ...widget.config, choices },\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\ttabJSON[key] = widget\n\t\t\t}\n\t\t}\n\n\t\tjson[tabKey] = tabJSON\n\t}\n\n\treturn { ...customType, json }\n}\n\nexport function serializeID(input: string): string {\n\tconst normalized = input\n\t\t.trim()\n\t\t.normalize(\"NFD\")\n\t\t.replace(/\\p{M}/gu, \"\")\n\t\t.toLowerCase()\n\t\t.replace(/[^a-z0-9]+/g, \"_\")\n\t\t.replace(/^_+|_+$/g, \"\")\n\n\tif (normalized.length === 0) {\n\t\tthrow new Error(`Cannot serialize \"${input}\": result is empty.`)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MAAQ;KAAQ;IACrC;IACA;GACD,SACC,QAAQ,OAAO;EACjB;EAGD,KAAK,UAAU;CAChB;CAEA,OAAO;EAAE,GAAG;EAAY;CAAK;AAC9B;AAEA,SAAgB,YAAY,OAAuB;CAClD,MAAM,aAAa,MACjB,KAAK,CAAC,CACN,UAAU,KAAK,CAAC,CAChB,QAAQ,WAAW,EAAE,CAAC,CACtB,YAAY,CAAC,CACb,QAAQ,eAAe,GAAG,CAAC,CAC3B,QAAQ,YAAY,EAAE;CAExB,IAAI,WAAW,WAAW,GACzB,MAAM,IAAI,MAAM,qBAAqB,MAAM,oBAAoB;CAGhE,OAAO;AACR"}
1
+ {"version":3,"file":"customTypeModel.js","names":[],"sources":["../../src/helpers/customTypeModel.ts"],"sourcesContent":["import type {\n\tDynamicCustomTypeModel,\n\tDynamicCustomTypeModelTab,\n\tFlattenedStaticCustomTypeModel,\n\tStaticCustomTypeModel,\n\tStaticCustomTypeModelTab,\n} from \"../model/customType\"\nimport type { DynamicSliceModel, SharedSliceModel, StaticSliceModel } from \"../model/slice\"\n\nexport function toStatic(\n\tcustomType: DynamicCustomTypeModel,\n\tsharedSlices: Map<string, SharedSliceModel> | Record<string, SharedSliceModel>,\n): StaticCustomTypeModel {\n\tconst json: StaticCustomTypeModel[\"json\"] = {}\n\n\tconst sharedSlicesMap =\n\t\tsharedSlices instanceof Map ? sharedSlices : new Map(Object.entries(sharedSlices))\n\n\tfor (const [tabKey, tab] of Object.entries(customType.json)) {\n\t\tconst tabJSON: StaticCustomTypeModel[\"json\"][string] = {}\n\t\tfor (const [key, widget] of Object.entries(tab)) {\n\t\t\tswitch (widget.type) {\n\t\t\t\tcase \"Slices\":\n\t\t\t\tcase \"Choice\":\n\t\t\t\t\tconst choices: Record<string, StaticSliceModel> = {}\n\t\t\t\t\tfor (const [id, model] of Object.entries(widget.config?.choices || {})) {\n\t\t\t\t\t\tif (model.type === \"SharedSlice\") {\n\t\t\t\t\t\t\tconst sharedSlice = sharedSlicesMap.get(id)\n\t\t\t\t\t\t\tif (sharedSlice) {\n\t\t\t\t\t\t\t\tchoices[id] = sharedSlice\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tchoices[id] = model\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\ttabJSON[key] = {\n\t\t\t\t\t\t...widget,\n\t\t\t\t\t\tconfig: { ...widget.config, choices },\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\ttabJSON[key] = widget\n\t\t\t}\n\t\t}\n\n\t\tjson[tabKey] = tabJSON\n\t}\n\n\treturn { ...customType, json }\n}\n\nexport function toDynamic(customType: StaticCustomTypeModel): DynamicCustomTypeModel {\n\tconst json: DynamicCustomTypeModel[\"json\"] = {}\n\n\tfor (const [tabKey, tab] of Object.entries(customType.json)) {\n\t\tconst tabJSON: DynamicCustomTypeModel[\"json\"][string] = {}\n\t\tfor (const [key, widget] of Object.entries(tab)) {\n\t\t\tswitch (widget.type) {\n\t\t\t\tcase \"Slices\":\n\t\t\t\tcase \"Choice\":\n\t\t\t\t\tconst choices: Record<string, DynamicSliceModel> = {}\n\t\t\t\t\tfor (const [id, model] of Object.entries(widget.config?.choices || {})) {\n\t\t\t\t\t\tif (model.type === \"SharedSlice\") {\n\t\t\t\t\t\t\tchoices[id] = { type: \"SharedSlice\" }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tchoices[id] = model\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\ttabJSON[key] = {\n\t\t\t\t\t\t...widget,\n\t\t\t\t\t\tconfig: { ...widget.config, choices },\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\ttabJSON[key] = widget\n\t\t\t}\n\t\t}\n\n\t\tjson[tabKey] = tabJSON\n\t}\n\n\treturn { ...customType, json }\n}\n\nexport function flatten(customType: StaticCustomTypeModel): StaticCustomTypeModelTab\nexport function flatten(customType: DynamicCustomTypeModel): DynamicCustomTypeModelTab\nexport function flatten(\n\tcustomType: StaticCustomTypeModel | DynamicCustomTypeModel,\n): StaticCustomTypeModelTab | DynamicCustomTypeModelTab {\n\treturn Object.values(customType.json).reduce((acc, fields) => ({ ...acc, ...fields }), {})\n}\n\nexport function collectSharedSlices(\n\tcustomType: StaticCustomTypeModel | FlattenedStaticCustomTypeModel,\n): Record<string, SharedSliceModel> {\n\tconst sharedSlices: Record<string, SharedSliceModel> = {}\n\n\tconst flattened = \"fields\" in customType ? customType.fields : flatten(customType)\n\tfor (const widget of Object.values(flattened)) {\n\t\tif (widget.type === \"Slices\" || widget.type === \"Choice\") {\n\t\t\tfor (const [id, model] of Object.entries(widget.config?.choices || {})) {\n\t\t\t\tif (model.type === \"SharedSlice\") {\n\t\t\t\t\tsharedSlices[id] = model\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn sharedSlices\n}\n\nexport function filterMissingSharedSlices<\n\tTCustomType extends StaticCustomTypeModel | DynamicCustomTypeModel,\n>(\n\tcustomType: TCustomType,\n\tsharedSlices: Map<string, SharedSliceModel> | Record<string, SharedSliceModel>,\n): TCustomType {\n\tconst json: TCustomType[\"json\"] = {}\n\n\tconst sharedSlicesMap =\n\t\tsharedSlices instanceof Map ? sharedSlices : new Map(Object.entries(sharedSlices))\n\n\tfor (const [tabKey, tab] of Object.entries(customType.json)) {\n\t\tconst tabJSON: typeof tab = {}\n\t\tfor (const [key, widget] of Object.entries(tab)) {\n\t\t\tswitch (widget.type) {\n\t\t\t\tcase \"Slices\":\n\t\t\t\tcase \"Choice\":\n\t\t\t\t\tconst choices: Required<typeof widget>[\"config\"][\"choices\"] = {}\n\t\t\t\t\tfor (const [id, model] of Object.entries(widget.config?.choices || {})) {\n\t\t\t\t\t\tif (model.type === \"SharedSlice\") {\n\t\t\t\t\t\t\tif (sharedSlicesMap.get(id)) {\n\t\t\t\t\t\t\t\tchoices[id] = model\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tchoices[id] = model\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\ttabJSON[key] = {\n\t\t\t\t\t\t...widget,\n\t\t\t\t\t\tconfig: { ...widget.config, choices },\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\ttabJSON[key] = widget\n\t\t\t}\n\t\t}\n\n\t\tjson[tabKey] = tabJSON\n\t}\n\n\treturn { ...customType, json }\n}\n\nexport function serializeID(input: string): string {\n\tconst normalized = input\n\t\t.trim()\n\t\t.normalize(\"NFD\")\n\t\t.replace(/\\p{M}/gu, \"\")\n\t\t.toLowerCase()\n\t\t.replace(/[^a-z0-9]+/g, \"_\")\n\t\t.replace(/^_+|_+$/g, \"\")\n\n\tif (normalized.length === 0) {\n\t\tthrow new Error(`Cannot serialize \"${input}\": result is empty.`)\n\t}\n\n\treturn normalized\n}\n"],"mappings":";;;;;;;;;;AASA,SAAgB,SACf,YACA,cACwB;CACxB,MAAM,OAAsC,CAAC;CAE7C,MAAM,kBACL,wBAAwB,MAAM,eAAe,IAAI,IAAI,OAAO,QAAQ,YAAY,CAAC;CAElF,KAAK,MAAM,CAAC,QAAQ,QAAQ,OAAO,QAAQ,WAAW,IAAI,GAAG;EAC5D,MAAM,UAAiD,CAAC;EACxD,KAAK,MAAM,CAAC,KAAK,WAAW,OAAO,QAAQ,GAAG,GAC7C,QAAQ,OAAO,MAAf;GACC,KAAK;GACL,KAAK;IACJ,MAAM,UAA4C,CAAC;IACnD,KAAK,MAAM,CAAC,IAAI,UAAU,OAAO,QAAQ,OAAO,QAAQ,WAAW,CAAC,CAAC,GACpE,IAAI,MAAM,SAAS,eAAe;KACjC,MAAM,cAAc,gBAAgB,IAAI,EAAE;KAC1C,IAAI,aACH,QAAQ,MAAM;IAEhB,OACC,QAAQ,MAAM;IAIhB,QAAQ,OAAO;KACd,GAAG;KACH,QAAQ;MAAE,GAAG,OA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A,SAAgB,0BAGf,YACA,cACc;CACd,MAAM,OAA4B,CAAC;CAEnC,MAAM,kBACL,wBAAwB,MAAM,eAAe,IAAI,IAAI,OAAO,QAAQ,YAAY,CAAC;CAElF,KAAK,MAAM,CAAC,QAAQ,QAAQ,OAAO,QAAQ,WAAW,IAAI,GAAG;EAC5D,MAAM,UAAsB,CAAC;EAC7B,KAAK,MAAM,CAAC,KAAK,WAAW,OAAO,QAAQ,GAAG,GAC7C,QAAQ,OAAO,MAAf;GACC,KAAK;GACL,KAAK;IACJ,MAAM,UAAwD,CAAC;IAC/D,KAAK,MAAM,CAAC,IAAI,UAAU,OAAO,QAAQ,OAAO,QAAQ,WAAW,CAAC,CAAC,GACpE,IAAI,MAAM,SAAS;SACd,gBAAgB,IAAI,EAAE,GACzB,QAAQ,MAAM;IAAA,OAGf,QAAQ,MAAM;IAIhB,QAAQ,OAAO;KACd,GAAG;KACH,QAAQ;MAAE,GAAG,OAAO;MAAQ;KAAQ;IACrC;IACA;GACD,SACC,QAAQ,OAAO;EACjB;EAGD,KAAK,UAAU;CAChB;CAEA,OAAO;EAAE,GAAG;EAAY;CAAK;AAC9B;AAEA,SAAgB,YAAY,OAAuB;CAClD,MAAM,aAAa,MACjB,KAAK,CAAC,CACN,UAAU,KAAK,CAAC,CAChB,QAAQ,WAAW,EAAE,CAAC,CACtB,YAAY,CAAC,CACb,QAAQ,eAAe,GAAG,CAAC,CAC3B,QAAQ,YAAY,EAAE;CAExB,IAAI,WAAW,WAAW,GACzB,MAAM,IAAI,MAAM,qBAAqB,MAAM,oBAAoB;CAGhE,OAAO;AACR"}
@@ -1,19 +1,20 @@
1
1
  import { WidgetContent } from "../content/widget.js";
2
2
  import { DocumentContent } from "../content/document.js";
3
- import { StaticCustomTypeModel } from "../model/customType.js";
3
+ import { FlattenedStaticCustomTypeModel, StaticCustomTypeModel } from "../model/customType.js";
4
4
  import { Path } from "./contentPath.js";
5
5
  import { DocumentLegacy } from "../content/legacy/document.js";
6
6
  declare namespace documentContent_d_exports {
7
- export { collectWidgets, fromLegacy, serializeUID, toLegacy };
7
+ export { collectWidgets, fromLegacy, migrateDocument, serializeUID, toLegacy };
8
8
  }
9
9
  declare function collectWidgets<TWidgetContent extends WidgetContent>(document: DocumentContent, test: (content: WidgetContent, args: {
10
10
  path: Path;
11
11
  key: string;
12
12
  apiID: string;
13
13
  }) => content is TWidgetContent): Record<string, TWidgetContent>;
14
+ declare function migrateDocument(document: DocumentContent, model: StaticCustomTypeModel | FlattenedStaticCustomTypeModel): DocumentContent;
14
15
  declare function fromLegacy(legacy: DocumentLegacy, model: StaticCustomTypeModel): DocumentContent | undefined;
15
16
  declare function toLegacy(document: DocumentContent): DocumentLegacy;
16
17
  declare function serializeUID(input: string): string;
17
18
  //#endregion
18
- export { collectWidgets, documentContent_d_exports, fromLegacy, serializeUID, toLegacy };
19
+ export { collectWidgets, documentContent_d_exports, fromLegacy, migrateDocument, serializeUID, toLegacy };
19
20
  //# sourceMappingURL=documentContent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"documentContent.d.ts","names":[],"sources":["../../src/helpers/documentContent.ts"],"mappings":";;;;;;;;iBAkBgB,eAAe,uBAAuB,eACrD,UAAU,iBACV,OACC,SAAS,eACT;EACC,MAAM;EACN;EACA;MAEG,WAAW,iBACd,eAAe;iBAgBF,WACf,QAAQ,gBACR,OAAO,wBACL;iBAwDa,SAAS,UAAU,kBAAkB;iBAMrC,aAAa"}
1
+ {"version":3,"file":"documentContent.d.ts","names":[],"sources":["../../src/helpers/documentContent.ts"],"mappings":";;;;;;;;iBAgBgB,eAAe,uBAAuB,eACrD,UAAU,iBACV,OACC,SAAS,eACT;EACC,MAAM;EACN;EACA;MAEG,WAAW,iBACd,eAAe;iBAgBF,gBACf,UAAU,iBACV,OAAO,wBAAwB,iCAC7B;iBAea,WACf,QAAQ,gBACR,OAAO,wBACL;iBAiCa,SAAS,UAAU,kBAAkB;iBAMrC,aAAa"}