@prismicio/types-internal 4.6.0-pr.25.41a8b18 → 4.6.0-pr.26.ebb6cbc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/asset.d.ts +1 -2
- package/dist/common/asset.d.ts.map +1 -1
- package/dist/common/asset.js.map +1 -1
- package/dist/common/embed.d.ts +1 -2
- package/dist/common/embed.d.ts.map +1 -1
- package/dist/common/embed.js.map +1 -1
- package/dist/common/hexaColorCode.d.ts +1 -2
- package/dist/common/hexaColorCode.d.ts.map +1 -1
- package/dist/common/hexaColorCode.js.map +1 -1
- package/dist/common/nonEmptyString.d.ts +1 -2
- package/dist/common/nonEmptyString.d.ts.map +1 -1
- package/dist/common/nonEmptyString.js.map +1 -1
- package/dist/common/widgetKey.d.ts +1 -2
- package/dist/common/widgetKey.d.ts.map +1 -1
- package/dist/common/widgetKey.js.map +1 -1
- package/dist/content/boolean.d.ts +1 -2
- package/dist/content/boolean.d.ts.map +1 -1
- package/dist/content/boolean.js.map +1 -1
- package/dist/content/codec/boolean.js.map +1 -1
- package/dist/content/codec/document.js.map +1 -1
- package/dist/content/codec/embed.js.map +1 -1
- package/dist/content/codec/empty.js.map +1 -1
- package/dist/content/codec/field.js.map +1 -1
- package/dist/content/codec/geopoint.js.map +1 -1
- package/dist/content/codec/group.js +6 -4
- package/dist/content/codec/group.js.map +1 -1
- package/dist/content/codec/image.js.map +1 -1
- package/dist/content/codec/integrationField.js.map +1 -1
- package/dist/content/codec/legacyContentCtx.d.ts +2 -15
- package/dist/content/codec/legacyContentCtx.d.ts.map +1 -1
- package/dist/content/codec/legacyContentCtx.js.map +1 -1
- package/dist/content/codec/link.js.map +1 -1
- package/dist/content/codec/nestable.js.map +1 -1
- package/dist/content/codec/repeatable.js.map +1 -1
- package/dist/content/codec/richText.js.map +1 -1
- package/dist/content/codec/separator.js.map +1 -1
- package/dist/content/codec/slice.js.map +1 -1
- package/dist/content/codec/slices.js.map +1 -1
- package/dist/content/codec/table.js.map +1 -1
- package/dist/content/codec/uid.js.map +1 -1
- package/dist/content/codec/widget.js.map +1 -1
- package/dist/content/document.d.ts +1 -2
- package/dist/content/document.d.ts.map +1 -1
- package/dist/content/document.js.map +1 -1
- package/dist/content/embed.d.ts +1 -2
- package/dist/content/embed.d.ts.map +1 -1
- package/dist/content/embed.js.map +1 -1
- package/dist/content/empty.d.ts +1 -2
- package/dist/content/empty.d.ts.map +1 -1
- package/dist/content/empty.js.map +1 -1
- package/dist/content/field.d.ts +1 -2
- package/dist/content/field.d.ts.map +1 -1
- package/dist/content/field.js.map +1 -1
- package/dist/content/geopoint.d.ts +1 -2
- package/dist/content/geopoint.d.ts.map +1 -1
- package/dist/content/geopoint.js.map +1 -1
- package/dist/content/group.d.ts +3 -2
- package/dist/content/group.d.ts.map +1 -1
- package/dist/content/group.js.map +1 -1
- package/dist/content/image.d.ts +1 -2
- package/dist/content/image.d.ts.map +1 -1
- package/dist/content/image.js.map +1 -1
- package/dist/content/integrationField.d.ts +1 -2
- package/dist/content/integrationField.d.ts.map +1 -1
- package/dist/content/integrationField.js.map +1 -1
- package/dist/content/legacy/boolean.js.map +1 -1
- package/dist/content/legacy/document.d.ts +1 -2
- package/dist/content/legacy/document.d.ts.map +1 -1
- package/dist/content/legacy/document.js.map +1 -1
- package/dist/content/legacy/embed.js.map +1 -1
- package/dist/content/legacy/empty.js.map +1 -1
- package/dist/content/legacy/field.js.map +1 -1
- package/dist/content/legacy/geopoint.js.map +1 -1
- package/dist/content/legacy/group.d.ts +2 -2
- package/dist/content/legacy/group.d.ts.map +1 -1
- package/dist/content/legacy/group.js.map +1 -1
- package/dist/content/legacy/image.d.ts +0 -1
- package/dist/content/legacy/image.d.ts.map +1 -1
- package/dist/content/legacy/image.js.map +1 -1
- package/dist/content/legacy/integrationField.js.map +1 -1
- package/dist/content/legacy/link.d.ts +1 -2
- package/dist/content/legacy/link.d.ts.map +1 -1
- package/dist/content/legacy/link.js.map +1 -1
- package/dist/content/legacy/nestable.d.ts +12 -0
- package/dist/content/legacy/nestable.js.map +1 -1
- package/dist/content/legacy/repeatable.js.map +1 -1
- package/dist/content/legacy/richText.d.ts +5 -2
- package/dist/content/legacy/richText.d.ts.map +1 -1
- package/dist/content/legacy/richText.js.map +1 -1
- package/dist/content/legacy/separator.js.map +1 -1
- package/dist/content/legacy/slice.js +1 -1
- package/dist/content/legacy/slice.js.map +1 -1
- package/dist/content/legacy/slices.js.map +1 -1
- package/dist/content/legacy/table.d.ts +2 -0
- package/dist/content/legacy/table.js.map +1 -1
- package/dist/content/legacy/uid.js.map +1 -1
- package/dist/content/link.d.ts +7 -8
- package/dist/content/link.d.ts.map +1 -1
- package/dist/content/link.js.map +1 -1
- package/dist/content/nestable.d.ts +0 -1
- package/dist/content/nestable.d.ts.map +1 -1
- package/dist/content/nestable.js.map +1 -1
- package/dist/content/repeatable.d.ts +3 -4
- package/dist/content/repeatable.d.ts.map +1 -1
- package/dist/content/repeatable.js.map +1 -1
- package/dist/content/richText.d.ts +2 -3
- package/dist/content/richText.d.ts.map +1 -1
- package/dist/content/richText.js +2 -2
- package/dist/content/richText.js.map +1 -1
- package/dist/content/separator.d.ts +1 -2
- package/dist/content/separator.d.ts.map +1 -1
- package/dist/content/separator.js.map +1 -1
- package/dist/content/slice.d.ts +13 -14
- package/dist/content/slice.d.ts.map +1 -1
- package/dist/content/slice.js.map +1 -1
- package/dist/content/slices.d.ts +13 -14
- package/dist/content/slices.d.ts.map +1 -1
- package/dist/content/slices.js.map +1 -1
- package/dist/content/table.d.ts +1 -2
- package/dist/content/table.d.ts.map +1 -1
- package/dist/content/table.js.map +1 -1
- package/dist/content/uid.d.ts +1 -2
- package/dist/content/uid.d.ts.map +1 -1
- package/dist/content/uid.js.map +1 -1
- package/dist/content/widget.d.ts +0 -1
- package/dist/content/widget.d.ts.map +1 -1
- package/dist/content/widget.js.map +1 -1
- package/dist/helpers/contentPath.d.ts +1 -1
- package/dist/helpers/contentPath.d.ts.map +1 -1
- package/dist/helpers/contentPath.js +1 -1
- package/dist/helpers/contentPath.js.map +1 -1
- package/dist/helpers/customTypeModel.d.ts +1 -3
- package/dist/helpers/customTypeModel.d.ts.map +1 -1
- package/dist/helpers/customTypeModel.js +1 -1
- package/dist/helpers/customTypeModel.js.map +1 -1
- package/dist/helpers/documentContent.d.ts +1 -3
- package/dist/helpers/documentContent.d.ts.map +1 -1
- package/dist/helpers/documentContent.js +1 -1
- package/dist/helpers/documentContent.js.map +1 -1
- package/dist/helpers/fieldModel.d.ts +1 -1
- package/dist/helpers/fieldModel.d.ts.map +1 -1
- package/dist/helpers/fieldModel.js +1 -1
- package/dist/helpers/fieldModel.js.map +1 -1
- package/dist/helpers/imageContent.d.ts +2 -6
- package/dist/helpers/imageContent.d.ts.map +1 -1
- package/dist/helpers/imageContent.js +1 -1
- package/dist/helpers/imageContent.js.map +1 -1
- package/dist/helpers/repository.d.ts +1 -1
- package/dist/helpers/repository.d.ts.map +1 -1
- package/dist/helpers/repository.js +1 -1
- package/dist/helpers/repository.js.map +1 -1
- package/dist/helpers/sliceContent.d.ts +1 -3
- package/dist/helpers/sliceContent.d.ts.map +1 -1
- package/dist/helpers/sliceContent.js.map +1 -1
- package/dist/helpers/sliceModel.d.ts +1 -1
- package/dist/helpers/sliceModel.d.ts.map +1 -1
- package/dist/helpers/sliceModel.js +1 -1
- package/dist/helpers/sliceModel.js.map +1 -1
- package/dist/helpers/traverseContent.d.ts +0 -1
- package/dist/helpers/traverseContent.d.ts.map +1 -1
- package/dist/helpers/traverseContent.js.map +1 -1
- package/dist/helpers/traverseContentWithModel.d.ts +0 -1
- package/dist/helpers/traverseContentWithModel.d.ts.map +1 -1
- package/dist/helpers/traverseContentWithModel.js.map +1 -1
- package/dist/helpers/withDefaultContent.d.ts +1 -3
- package/dist/helpers/withDefaultContent.d.ts.map +1 -1
- package/dist/helpers/withDefaultContent.js +1 -1
- package/dist/helpers/withDefaultContent.js.map +1 -1
- package/dist/io-ts.d.ts +1153 -1159
- package/dist/io-ts.d.ts.map +1 -1
- package/dist/io-ts.js.map +1 -1
- package/dist/model/boolean.d.ts +1 -2
- package/dist/model/boolean.d.ts.map +1 -1
- package/dist/model/boolean.js.map +1 -1
- package/dist/model/color.d.ts +1 -2
- package/dist/model/color.d.ts.map +1 -1
- package/dist/model/color.js.map +1 -1
- package/dist/model/customType.d.ts +3 -4
- package/dist/model/customType.d.ts.map +1 -1
- package/dist/model/customType.js +1 -1
- package/dist/model/customType.js.map +1 -1
- package/dist/model/date.d.ts +1 -2
- package/dist/model/date.d.ts.map +1 -1
- package/dist/model/date.js.map +1 -1
- package/dist/model/embed.d.ts +1 -2
- package/dist/model/embed.d.ts.map +1 -1
- package/dist/model/embed.js.map +1 -1
- package/dist/model/geopoint.d.ts +1 -2
- package/dist/model/geopoint.d.ts.map +1 -1
- package/dist/model/geopoint.js.map +1 -1
- package/dist/model/group.d.ts +39 -40
- package/dist/model/group.d.ts.map +1 -1
- package/dist/model/group.js +1 -1
- package/dist/model/group.js.map +1 -1
- package/dist/model/image.d.ts +1 -2
- package/dist/model/image.d.ts.map +1 -1
- package/dist/model/image.js +1 -1
- package/dist/model/image.js.map +1 -1
- package/dist/model/integrationField.d.ts +1 -2
- package/dist/model/integrationField.d.ts.map +1 -1
- package/dist/model/integrationField.js.map +1 -1
- package/dist/model/link.d.ts +2 -3
- package/dist/model/link.d.ts.map +1 -1
- package/dist/model/link.js.map +1 -1
- package/dist/model/nestable.d.ts +0 -1
- package/dist/model/nestable.d.ts.map +1 -1
- package/dist/model/nestable.js.map +1 -1
- package/dist/model/number.d.ts +1 -2
- package/dist/model/number.d.ts.map +1 -1
- package/dist/model/number.js.map +1 -1
- package/dist/model/range.d.ts +1 -2
- package/dist/model/range.d.ts.map +1 -1
- package/dist/model/range.js.map +1 -1
- package/dist/model/richText.d.ts +1 -2
- package/dist/model/richText.d.ts.map +1 -1
- package/dist/model/richText.js +1 -1
- package/dist/model/richText.js.map +1 -1
- package/dist/model/select.d.ts +1 -2
- package/dist/model/select.d.ts.map +1 -1
- package/dist/model/select.js.map +1 -1
- package/dist/model/separator.d.ts +1 -2
- package/dist/model/separator.d.ts.map +1 -1
- package/dist/model/separator.js.map +1 -1
- package/dist/model/slice.d.ts +44 -45
- package/dist/model/slice.d.ts.map +1 -1
- package/dist/model/slice.js +1 -1
- package/dist/model/slice.js.map +1 -1
- package/dist/model/slices.d.ts +1 -2
- package/dist/model/slices.d.ts.map +1 -1
- package/dist/model/slices.js +1 -1
- package/dist/model/slices.js.map +1 -1
- package/dist/model/table.d.ts +3 -3
- package/dist/model/table.d.ts.map +1 -1
- package/dist/model/table.js.map +1 -1
- package/dist/model/text.d.ts +1 -2
- package/dist/model/text.d.ts.map +1 -1
- package/dist/model/text.js.map +1 -1
- package/dist/model/timestamp.d.ts +1 -2
- package/dist/model/timestamp.d.ts.map +1 -1
- package/dist/model/timestamp.js.map +1 -1
- package/dist/model/uid.d.ts +1 -2
- package/dist/model/uid.d.ts.map +1 -1
- package/dist/model/uid.js.map +1 -1
- package/dist/model/widget.d.ts +25 -26
- package/dist/model/widget.d.ts.map +1 -1
- package/dist/model/widget.js +1 -1
- package/dist/model/widget.js.map +1 -1
- package/dist/zod4.d.ts +3351 -3353
- package/dist/zod4.d.ts.map +1 -1
- package/dist/zod4.js.map +1 -1
- package/package.json +11 -12
- package/src/helpers/customTypeModel.ts +3 -1
- package/src/model/image.ts +4 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slice.js","names":[],"sources":["../../../src/content/codec/slice.ts"],"sourcesContent":["import { CompositeSliceLegacySchema, SharedSliceLegacySchema } from \"../legacy/slice\"\nimport type {\n\tCompositeSliceLegacy,\n\tSharedSliceLegacy,\n\tLegacySliceLegacy,\n\tSliceLegacy,\n} from \"../legacy/slice\"\nimport {\n\tCompositeSliceContentSchema,\n\tCompositeSliceContentType,\n\tSharedSliceContentSchema,\n\tSharedSliceContentType,\n\tLegacySliceContentSchema,\n\tSliceContentSchema,\n} from \"../slice\"\nimport type {\n\tCompositeSliceContent,\n\tSharedSliceContent,\n\tLegacySliceContent,\n\tSliceContent,\n} from \"../slice\"\nimport { GroupItemLegacyCodec, NestableAndGroupLegacyCodec } from \"./group\"\nimport { getFieldCtx, type LegacyCodec, type LegacyContentCtx } from \"./legacyContentCtx\"\nimport { NestableLegacyCodec } from \"./nestable\"\n\n// Simple (before 2020)\nexport const LegacySliceLegacyCodec = (\n\tctx: LegacyContentCtx,\n): LegacyCodec<LegacySliceContent, LegacySliceLegacy, true> => ({\n\tname: \"LegacySliceLegacy\",\n\n\tis(input): input is LegacySliceContent {\n\t\treturn LegacySliceContentSchema.safeParse(input).success\n\t},\n\n\ttoContent(input) {\n\t\treturn NestableAndGroupLegacyCodec(ctx).toContent(input)\n\t},\n\n\tfromContent(input) {\n\t\treturn NestableAndGroupLegacyCodec(ctx).fromContent(input)\n\t},\n})\n\n// Composite (2020 to 2021)\nexport const CompositeSliceLegacyCodec = (\n\tctx: LegacyContentCtx,\n): LegacyCodec<CompositeSliceContent, CompositeSliceLegacy> => ({\n\tname: \"CompositeSliceLegacy\",\n\n\tis(input): input is CompositeSliceContent {\n\t\treturn CompositeSliceContentSchema.safeParse(input).success\n\t},\n\n\ttoContent(input) {\n\t\tconst parsed = CompositeSliceLegacySchema.safeParse(input)\n\t\tif (!parsed.success) {\n\t\t\treturn parsed\n\t\t}\n\n\t\tconst nonRepeat: CompositeSliceContent[\"nonRepeat\"] = {}\n\t\tfor (const [key, legacy] of Object.entries(parsed.data[\"non-repeat\"] || {})) {\n\t\t\tconst fieldCtx = getFieldCtx({\n\t\t\t\tfieldKey: key,\n\t\t\t\tctx,\n\t\t\t\tprefixes: [\"non-repeat\"],\n\t\t\t})\n\n\t\t\tconst result = NestableLegacyCodec(fieldCtx).toContent(legacy)\n\t\t\tif (!result.success) continue\n\n\t\t\tnonRepeat[key] = result.data\n\t\t}\n\n\t\tconst repeat: CompositeSliceContent[\"repeat\"] = []\n\t\tfor (let index = 0; index < (parsed.data.repeat?.length || 0); index++) {\n\t\t\tconst item = parsed.data.repeat?.[index]\n\t\t\tconst itemCtx = getFieldCtx({ fieldKey: \"repeat\", ctx })\n\n\t\t\tconst result = GroupItemLegacyCodec(itemCtx, index).toContent(item)\n\t\t\tif (!result.success) continue\n\n\t\t\trepeat.push(result.data)\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: {\n\t\t\t\t__TYPE__: CompositeSliceContentType,\n\t\t\t\tnonRepeat,\n\t\t\t\trepeat,\n\t\t\t},\n\t\t}\n\t},\n\n\tfromContent(input) {\n\t\tconst legacy: ReturnType<\n\t\t\tLegacyCodec<CompositeSliceContent, CompositeSliceLegacy>[\"fromContent\"]\n\t\t> = {\n\t\t\tcontent: {\n\t\t\t\t\"non-repeat\": {},\n\t\t\t\trepeat: [],\n\t\t\t},\n\t\t\ttypes: {\n\t\t\t\t[ctx.keyOfType]: \"Slice\",\n\t\t\t},\n\t\t\tkeys: {},\n\t\t}\n\n\t\t// Non-repeat\n\t\tfor (const [key, content] of Object.entries(input.nonRepeat)) {\n\t\t\tconst fieldCtx = getFieldCtx({\n\t\t\t\tfieldKey: key,\n\t\t\t\tctx,\n\t\t\t\tprefixes: [\"non-repeat\"],\n\t\t\t})\n\n\t\t\tconst result = NestableLegacyCodec(fieldCtx).fromContent(content)\n\t\t\tif (!result) continue\n\n\t\t\tlegacy.content[\"non-repeat\"]![key] = 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\t// Repeat\n\t\tconst repeatCtx = getFieldCtx({ fieldKey: \"repeat\", ctx })\n\t\tfor (let index = 0; index < input.repeat.length; index++) {\n\t\t\tconst item = input.repeat[index]\n\t\t\tconst result = GroupItemLegacyCodec(repeatCtx, index).fromContent(item)\n\n\t\t\tlegacy.content.repeat!.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\n// Shared (2021 to present)\nexport const SharedSliceLegacyCodec = (\n\tctx: LegacyContentCtx,\n): LegacyCodec<SharedSliceContent, SharedSliceLegacy> => ({\n\tname: \"SharedSliceLegacy\",\n\n\tis(input): input is SharedSliceContent {\n\t\treturn SharedSliceContentSchema.safeParse(input).success\n\t},\n\n\ttoContent(input) {\n\t\tconst parsed = SharedSliceLegacySchema.safeParse(input)\n\t\tif (!parsed.success) {\n\t\t\treturn parsed\n\t\t}\n\n\t\tconst primary: SharedSliceContent[\"primary\"] = {}\n\t\tfor (const [key, legacy] of Object.entries(parsed.data[\"primary\"])) {\n\t\t\tconst fieldCtx = getFieldCtx({\n\t\t\t\tfieldKey: key,\n\t\t\t\tctx,\n\t\t\t\tprefixes: [\"variations\", parsed.data.variation, \"primary\"],\n\t\t\t})\n\n\t\t\tconst result = NestableAndGroupLegacyCodec(fieldCtx).toContent(legacy)\n\t\t\tif (!result.success) continue\n\n\t\t\tprimary[key] = result.data\n\t\t}\n\n\t\tconst items: SharedSliceContent[\"items\"] = []\n\t\tfor (let index = 0; index < parsed.data.items.length; index++) {\n\t\t\tconst item = parsed.data.items[index]\n\t\t\tconst itemCtx = getFieldCtx({\n\t\t\t\tfieldKey: \"items\",\n\t\t\t\tctx,\n\t\t\t\tprefixes: [\"variations\", parsed.data.variation],\n\t\t\t})\n\n\t\t\tconst result = GroupItemLegacyCodec(itemCtx, index).toContent(item)\n\t\t\tif (!result.success) continue\n\n\t\t\titems.push(result.data)\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: {\n\t\t\t\t__TYPE__: SharedSliceContentType,\n\t\t\t\tvariation: parsed.data.variation,\n\t\t\t\tprimary,\n\t\t\t\titems,\n\t\t\t},\n\t\t}\n\t},\n\n\tfromContent(input) {\n\t\tconst legacy: ReturnType<LegacyCodec<SharedSliceContent, SharedSliceLegacy>[\"fromContent\"]> = {\n\t\t\tcontent: {\n\t\t\t\tprimary: {},\n\t\t\t\titems: [],\n\t\t\t\tvariation: input.variation,\n\t\t\t},\n\t\t\ttypes: {\n\t\t\t\t[ctx.keyOfType]: \"SharedSlice\",\n\t\t\t},\n\t\t\tkeys: {},\n\t\t}\n\n\t\t// Primary\n\t\tfor (const [key, content] of Object.entries(input.primary)) {\n\t\t\tconst fieldCtx = getFieldCtx({\n\t\t\t\tfieldKey: key,\n\t\t\t\tctx,\n\t\t\t\tprefixes: [\"variations\", input.variation, \"primary\"],\n\t\t\t})\n\n\t\t\tconst result = NestableAndGroupLegacyCodec(fieldCtx).fromContent(content)\n\t\t\tif (!result) continue\n\n\t\t\tlegacy.content.primary[key] = 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\t// Items\n\t\tconst repeatCtx = getFieldCtx({\n\t\t\tfieldKey: \"items\",\n\t\t\tctx,\n\t\t\tprefixes: [\"variations\", input.variation],\n\t\t})\n\t\tfor (let index = 0; index < input.items.length; index++) {\n\t\t\tconst item = input.items[index]\n\t\t\tconst result = GroupItemLegacyCodec(repeatCtx, index).fromContent(item)\n\n\t\t\tlegacy.content.items.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\n// All\nexport const SliceLegacyCodec = (\n\tctx: LegacyContentCtx,\n): LegacyCodec<SliceContent, SliceLegacy, true> => ({\n\tname: \"SliceLegacy\",\n\n\tis(input): input is SliceContent {\n\t\treturn SliceContentSchema.safeParse(input).success\n\t},\n\n\ttoContent(input) {\n\t\tswitch (ctx.fieldType) {\n\t\t\tcase \"Slice\":\n\t\t\t\treturn CompositeSliceLegacyCodec(ctx).toContent(input)\n\t\t\tcase \"SharedSlice\":\n\t\t\t\treturn SharedSliceLegacyCodec(ctx).toContent(input)\n\t\t\tdefault:\n\t\t\t\treturn LegacySliceLegacyCodec(ctx).toContent(input)\n\t\t}\n\t},\n\n\tfromContent(input) {\n\t\tswitch (input.__TYPE__) {\n\t\t\tcase CompositeSliceContentType:\n\t\t\t\treturn CompositeSliceLegacyCodec(ctx).fromContent(input)\n\t\t\tcase SharedSliceContentType:\n\t\t\t\treturn SharedSliceLegacyCodec(ctx).fromContent(input)\n\t\t\tdefault:\n\t\t\t\treturn LegacySliceLegacyCodec(ctx).fromContent(input)\n\t\t}\n\t},\n})\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"slice.js","names":[],"sources":["../../../src/content/codec/slice.ts"],"sourcesContent":["import { CompositeSliceLegacySchema, SharedSliceLegacySchema } from \"../legacy/slice\"\nimport type {\n\tCompositeSliceLegacy,\n\tSharedSliceLegacy,\n\tLegacySliceLegacy,\n\tSliceLegacy,\n} from \"../legacy/slice\"\nimport {\n\tCompositeSliceContentSchema,\n\tCompositeSliceContentType,\n\tSharedSliceContentSchema,\n\tSharedSliceContentType,\n\tLegacySliceContentSchema,\n\tSliceContentSchema,\n} from \"../slice\"\nimport type {\n\tCompositeSliceContent,\n\tSharedSliceContent,\n\tLegacySliceContent,\n\tSliceContent,\n} from \"../slice\"\nimport { GroupItemLegacyCodec, NestableAndGroupLegacyCodec } from \"./group\"\nimport { getFieldCtx, type LegacyCodec, type LegacyContentCtx } from \"./legacyContentCtx\"\nimport { NestableLegacyCodec } from \"./nestable\"\n\n// Simple (before 2020)\nexport const LegacySliceLegacyCodec = (\n\tctx: LegacyContentCtx,\n): LegacyCodec<LegacySliceContent, LegacySliceLegacy, true> => ({\n\tname: \"LegacySliceLegacy\",\n\n\tis(input): input is LegacySliceContent {\n\t\treturn LegacySliceContentSchema.safeParse(input).success\n\t},\n\n\ttoContent(input) {\n\t\treturn NestableAndGroupLegacyCodec(ctx).toContent(input)\n\t},\n\n\tfromContent(input) {\n\t\treturn NestableAndGroupLegacyCodec(ctx).fromContent(input)\n\t},\n})\n\n// Composite (2020 to 2021)\nexport const CompositeSliceLegacyCodec = (\n\tctx: LegacyContentCtx,\n): LegacyCodec<CompositeSliceContent, CompositeSliceLegacy> => ({\n\tname: \"CompositeSliceLegacy\",\n\n\tis(input): input is CompositeSliceContent {\n\t\treturn CompositeSliceContentSchema.safeParse(input).success\n\t},\n\n\ttoContent(input) {\n\t\tconst parsed = CompositeSliceLegacySchema.safeParse(input)\n\t\tif (!parsed.success) {\n\t\t\treturn parsed\n\t\t}\n\n\t\tconst nonRepeat: CompositeSliceContent[\"nonRepeat\"] = {}\n\t\tfor (const [key, legacy] of Object.entries(parsed.data[\"non-repeat\"] || {})) {\n\t\t\tconst fieldCtx = getFieldCtx({\n\t\t\t\tfieldKey: key,\n\t\t\t\tctx,\n\t\t\t\tprefixes: [\"non-repeat\"],\n\t\t\t})\n\n\t\t\tconst result = NestableLegacyCodec(fieldCtx).toContent(legacy)\n\t\t\tif (!result.success) continue\n\n\t\t\tnonRepeat[key] = result.data\n\t\t}\n\n\t\tconst repeat: CompositeSliceContent[\"repeat\"] = []\n\t\tfor (let index = 0; index < (parsed.data.repeat?.length || 0); index++) {\n\t\t\tconst item = parsed.data.repeat?.[index]\n\t\t\tconst itemCtx = getFieldCtx({ fieldKey: \"repeat\", ctx })\n\n\t\t\tconst result = GroupItemLegacyCodec(itemCtx, index).toContent(item)\n\t\t\tif (!result.success) continue\n\n\t\t\trepeat.push(result.data)\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: {\n\t\t\t\t__TYPE__: CompositeSliceContentType,\n\t\t\t\tnonRepeat,\n\t\t\t\trepeat,\n\t\t\t},\n\t\t}\n\t},\n\n\tfromContent(input) {\n\t\tconst legacy: ReturnType<\n\t\t\tLegacyCodec<CompositeSliceContent, CompositeSliceLegacy>[\"fromContent\"]\n\t\t> = {\n\t\t\tcontent: {\n\t\t\t\t\"non-repeat\": {},\n\t\t\t\trepeat: [],\n\t\t\t},\n\t\t\ttypes: {\n\t\t\t\t[ctx.keyOfType]: \"Slice\",\n\t\t\t},\n\t\t\tkeys: {},\n\t\t}\n\n\t\t// Non-repeat\n\t\tfor (const [key, content] of Object.entries(input.nonRepeat)) {\n\t\t\tconst fieldCtx = getFieldCtx({\n\t\t\t\tfieldKey: key,\n\t\t\t\tctx,\n\t\t\t\tprefixes: [\"non-repeat\"],\n\t\t\t})\n\n\t\t\tconst result = NestableLegacyCodec(fieldCtx).fromContent(content)\n\t\t\tif (!result) continue\n\n\t\t\tlegacy.content[\"non-repeat\"]![key] = 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\t// Repeat\n\t\tconst repeatCtx = getFieldCtx({ fieldKey: \"repeat\", ctx })\n\t\tfor (let index = 0; index < input.repeat.length; index++) {\n\t\t\tconst item = input.repeat[index]\n\t\t\tconst result = GroupItemLegacyCodec(repeatCtx, index).fromContent(item)\n\n\t\t\tlegacy.content.repeat!.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\n// Shared (2021 to present)\nexport const SharedSliceLegacyCodec = (\n\tctx: LegacyContentCtx,\n): LegacyCodec<SharedSliceContent, SharedSliceLegacy> => ({\n\tname: \"SharedSliceLegacy\",\n\n\tis(input): input is SharedSliceContent {\n\t\treturn SharedSliceContentSchema.safeParse(input).success\n\t},\n\n\ttoContent(input) {\n\t\tconst parsed = SharedSliceLegacySchema.safeParse(input)\n\t\tif (!parsed.success) {\n\t\t\treturn parsed\n\t\t}\n\n\t\tconst primary: SharedSliceContent[\"primary\"] = {}\n\t\tfor (const [key, legacy] of Object.entries(parsed.data[\"primary\"])) {\n\t\t\tconst fieldCtx = getFieldCtx({\n\t\t\t\tfieldKey: key,\n\t\t\t\tctx,\n\t\t\t\tprefixes: [\"variations\", parsed.data.variation, \"primary\"],\n\t\t\t})\n\n\t\t\tconst result = NestableAndGroupLegacyCodec(fieldCtx).toContent(legacy)\n\t\t\tif (!result.success) continue\n\n\t\t\tprimary[key] = result.data\n\t\t}\n\n\t\tconst items: SharedSliceContent[\"items\"] = []\n\t\tfor (let index = 0; index < parsed.data.items.length; index++) {\n\t\t\tconst item = parsed.data.items[index]\n\t\t\tconst itemCtx = getFieldCtx({\n\t\t\t\tfieldKey: \"items\",\n\t\t\t\tctx,\n\t\t\t\tprefixes: [\"variations\", parsed.data.variation],\n\t\t\t})\n\n\t\t\tconst result = GroupItemLegacyCodec(itemCtx, index).toContent(item)\n\t\t\tif (!result.success) continue\n\n\t\t\titems.push(result.data)\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: {\n\t\t\t\t__TYPE__: SharedSliceContentType,\n\t\t\t\tvariation: parsed.data.variation,\n\t\t\t\tprimary,\n\t\t\t\titems,\n\t\t\t},\n\t\t}\n\t},\n\n\tfromContent(input) {\n\t\tconst legacy: ReturnType<LegacyCodec<SharedSliceContent, SharedSliceLegacy>[\"fromContent\"]> = {\n\t\t\tcontent: {\n\t\t\t\tprimary: {},\n\t\t\t\titems: [],\n\t\t\t\tvariation: input.variation,\n\t\t\t},\n\t\t\ttypes: {\n\t\t\t\t[ctx.keyOfType]: \"SharedSlice\",\n\t\t\t},\n\t\t\tkeys: {},\n\t\t}\n\n\t\t// Primary\n\t\tfor (const [key, content] of Object.entries(input.primary)) {\n\t\t\tconst fieldCtx = getFieldCtx({\n\t\t\t\tfieldKey: key,\n\t\t\t\tctx,\n\t\t\t\tprefixes: [\"variations\", input.variation, \"primary\"],\n\t\t\t})\n\n\t\t\tconst result = NestableAndGroupLegacyCodec(fieldCtx).fromContent(content)\n\t\t\tif (!result) continue\n\n\t\t\tlegacy.content.primary[key] = 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\t// Items\n\t\tconst repeatCtx = getFieldCtx({\n\t\t\tfieldKey: \"items\",\n\t\t\tctx,\n\t\t\tprefixes: [\"variations\", input.variation],\n\t\t})\n\t\tfor (let index = 0; index < input.items.length; index++) {\n\t\t\tconst item = input.items[index]\n\t\t\tconst result = GroupItemLegacyCodec(repeatCtx, index).fromContent(item)\n\n\t\t\tlegacy.content.items.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\n// All\nexport const SliceLegacyCodec = (\n\tctx: LegacyContentCtx,\n): LegacyCodec<SliceContent, SliceLegacy, true> => ({\n\tname: \"SliceLegacy\",\n\n\tis(input): input is SliceContent {\n\t\treturn SliceContentSchema.safeParse(input).success\n\t},\n\n\ttoContent(input) {\n\t\tswitch (ctx.fieldType) {\n\t\t\tcase \"Slice\":\n\t\t\t\treturn CompositeSliceLegacyCodec(ctx).toContent(input)\n\t\t\tcase \"SharedSlice\":\n\t\t\t\treturn SharedSliceLegacyCodec(ctx).toContent(input)\n\t\t\tdefault:\n\t\t\t\treturn LegacySliceLegacyCodec(ctx).toContent(input)\n\t\t}\n\t},\n\n\tfromContent(input) {\n\t\tswitch (input.__TYPE__) {\n\t\t\tcase CompositeSliceContentType:\n\t\t\t\treturn CompositeSliceLegacyCodec(ctx).fromContent(input)\n\t\t\tcase SharedSliceContentType:\n\t\t\t\treturn SharedSliceLegacyCodec(ctx).fromContent(input)\n\t\t\tdefault:\n\t\t\t\treturn LegacySliceLegacyCodec(ctx).fromContent(input)\n\t\t}\n\t},\n})\n"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slices.js","names":[],"sources":["../../../src/content/codec/slices.ts"],"sourcesContent":["import { SliceItemLegacySchema, SlicesLegacySchema } from \"../legacy/slices\"\nimport type { SliceItemLegacy, SlicesLegacy } from \"../legacy/slices\"\nimport { SliceItemContentSchema, SlicesContentSchema, SlicesContentType } from \"../slices\"\nimport type { SliceItemContent, SlicesContent } from \"../slices\"\nimport { type LegacyContentCtx, type LegacyCodec, getFieldCtx } from \"./legacyContentCtx\"\nimport { SliceLegacyCodec } from \"./slice\"\n\n// Item\nexport const SliceItemLegacyCodec = (\n\tctx: LegacyContentCtx,\n): LegacyCodec<SliceItemContent, SliceItemLegacy> => ({\n\tname: \"SlicesItemLegacy\",\n\n\tis(input): input is SliceItemContent {\n\t\treturn SliceItemContentSchema.safeParse(input).success\n\t},\n\n\ttoContent(input) {\n\t\tconst parsed = SliceItemLegacySchema.safeParse(input)\n\t\tif (!parsed.success) {\n\t\t\treturn parsed\n\t\t}\n\n\t\tconst sliceName = parsed.data.key.split(\"$\")[0]\n\t\tconst itemCtx = getFieldCtx({\n\t\t\tfieldKey: sliceName,\n\t\t\tcontentKey: parsed.data.key,\n\t\t\tctx,\n\t\t})\n\t\tconst result = SliceLegacyCodec(itemCtx).toContent(parsed.data.value)\n\n\t\tif (!result.success) {\n\t\t\treturn result\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: {\n\t\t\t\tkey: parsed.data.key,\n\t\t\t\tname: sliceName,\n\t\t\t\tmaybeLabel: parsed.data.label || undefined,\n\t\t\t\twidget: result.data,\n\t\t\t},\n\t\t}\n\t},\n\n\tfromContent(input) {\n\t\tconst itemCtx = getFieldCtx({\n\t\t\tfieldKey: input.name,\n\t\t\tcontentKey: input.key,\n\t\t\tctx,\n\t\t})\n\t\tconst result = SliceLegacyCodec(itemCtx).fromContent(input.widget)\n\n\t\tif (!result) {\n\t\t\treturn {\n\t\t\t\tcontent: {\n\t\t\t\t\tkey: input.key,\n\t\t\t\t\tlabel: input.maybeLabel,\n\t\t\t\t\tvalue: {},\n\t\t\t\t},\n\t\t\t\ttypes: {},\n\t\t\t\tkeys: {},\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tcontent: {\n\t\t\t\tkey: input.key,\n\t\t\t\tlabel: input.maybeLabel,\n\t\t\t\tvalue: result.content,\n\t\t\t},\n\t\t\ttypes: result.types,\n\t\t\tkeys: result.keys,\n\t\t}\n\t},\n})\n\n// Slices\nexport const SlicesLegacyCodec = (\n\tctx: LegacyContentCtx,\n): LegacyCodec<SlicesContent, SlicesLegacy> => ({\n\tname: \"SlicesLegacy\",\n\n\tis(input): input is SlicesContent {\n\t\treturn SlicesContentSchema.safeParse(input).success\n\t},\n\n\ttoContent(input) {\n\t\tconst parsed = SlicesLegacySchema.safeParse(input)\n\t\tif (!parsed.success) {\n\t\t\treturn parsed\n\t\t}\n\n\t\tconst value: SlicesContent[\"value\"] = []\n\t\tfor (let index = 0; index < parsed.data.length; index++) {\n\t\t\tconst item = parsed.data[index]\n\t\t\tconst result = SliceItemLegacyCodec(ctx).toContent(item)\n\t\t\tif (!result.success) {\n\t\t\t\treturn result\n\t\t\t}\n\t\t\tvalue.push(result.data)\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { __TYPE__: SlicesContentType, value },\n\t\t}\n\t},\n\n\tfromContent(input) {\n\t\tconst legacy: ReturnType<LegacyCodec<SlicesContent, SlicesLegacy>[\"fromContent\"]> = {\n\t\t\tcontent: [],\n\t\t\ttypes: { [ctx.keyOfType]: \"Slices\" },\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 = SliceItemLegacyCodec(ctx).fromContent(item)\n\t\t\tif (!result) continue\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"],"mappings":";;;;;AAQA,MAAa,wBACZ,SACqD;CACrD,MAAM;CAEN,GAAG,OAAkC;
|
|
1
|
+
{"version":3,"file":"slices.js","names":[],"sources":["../../../src/content/codec/slices.ts"],"sourcesContent":["import { SliceItemLegacySchema, SlicesLegacySchema } from \"../legacy/slices\"\nimport type { SliceItemLegacy, SlicesLegacy } from \"../legacy/slices\"\nimport { SliceItemContentSchema, SlicesContentSchema, SlicesContentType } from \"../slices\"\nimport type { SliceItemContent, SlicesContent } from \"../slices\"\nimport { type LegacyContentCtx, type LegacyCodec, getFieldCtx } from \"./legacyContentCtx\"\nimport { SliceLegacyCodec } from \"./slice\"\n\n// Item\nexport const SliceItemLegacyCodec = (\n\tctx: LegacyContentCtx,\n): LegacyCodec<SliceItemContent, SliceItemLegacy> => ({\n\tname: \"SlicesItemLegacy\",\n\n\tis(input): input is SliceItemContent {\n\t\treturn SliceItemContentSchema.safeParse(input).success\n\t},\n\n\ttoContent(input) {\n\t\tconst parsed = SliceItemLegacySchema.safeParse(input)\n\t\tif (!parsed.success) {\n\t\t\treturn parsed\n\t\t}\n\n\t\tconst sliceName = parsed.data.key.split(\"$\")[0]\n\t\tconst itemCtx = getFieldCtx({\n\t\t\tfieldKey: sliceName,\n\t\t\tcontentKey: parsed.data.key,\n\t\t\tctx,\n\t\t})\n\t\tconst result = SliceLegacyCodec(itemCtx).toContent(parsed.data.value)\n\n\t\tif (!result.success) {\n\t\t\treturn result\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: {\n\t\t\t\tkey: parsed.data.key,\n\t\t\t\tname: sliceName,\n\t\t\t\tmaybeLabel: parsed.data.label || undefined,\n\t\t\t\twidget: result.data,\n\t\t\t},\n\t\t}\n\t},\n\n\tfromContent(input) {\n\t\tconst itemCtx = getFieldCtx({\n\t\t\tfieldKey: input.name,\n\t\t\tcontentKey: input.key,\n\t\t\tctx,\n\t\t})\n\t\tconst result = SliceLegacyCodec(itemCtx).fromContent(input.widget)\n\n\t\tif (!result) {\n\t\t\treturn {\n\t\t\t\tcontent: {\n\t\t\t\t\tkey: input.key,\n\t\t\t\t\tlabel: input.maybeLabel,\n\t\t\t\t\tvalue: {},\n\t\t\t\t},\n\t\t\t\ttypes: {},\n\t\t\t\tkeys: {},\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tcontent: {\n\t\t\t\tkey: input.key,\n\t\t\t\tlabel: input.maybeLabel,\n\t\t\t\tvalue: result.content,\n\t\t\t},\n\t\t\ttypes: result.types,\n\t\t\tkeys: result.keys,\n\t\t}\n\t},\n})\n\n// Slices\nexport const SlicesLegacyCodec = (\n\tctx: LegacyContentCtx,\n): LegacyCodec<SlicesContent, SlicesLegacy> => ({\n\tname: \"SlicesLegacy\",\n\n\tis(input): input is SlicesContent {\n\t\treturn SlicesContentSchema.safeParse(input).success\n\t},\n\n\ttoContent(input) {\n\t\tconst parsed = SlicesLegacySchema.safeParse(input)\n\t\tif (!parsed.success) {\n\t\t\treturn parsed\n\t\t}\n\n\t\tconst value: SlicesContent[\"value\"] = []\n\t\tfor (let index = 0; index < parsed.data.length; index++) {\n\t\t\tconst item = parsed.data[index]\n\t\t\tconst result = SliceItemLegacyCodec(ctx).toContent(item)\n\t\t\tif (!result.success) {\n\t\t\t\treturn result\n\t\t\t}\n\t\t\tvalue.push(result.data)\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { __TYPE__: SlicesContentType, value },\n\t\t}\n\t},\n\n\tfromContent(input) {\n\t\tconst legacy: ReturnType<LegacyCodec<SlicesContent, SlicesLegacy>[\"fromContent\"]> = {\n\t\t\tcontent: [],\n\t\t\ttypes: { [ctx.keyOfType]: \"Slices\" },\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 = SliceItemLegacyCodec(ctx).fromContent(item)\n\t\t\tif (!result) continue\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"],"mappings":";;;;;AAQA,MAAa,wBACZ,SACqD;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,YAAY,OAAO,KAAK,IAAI,MAAM,GAAG,CAAC,CAAC;EAM7C,MAAM,SAAS,iBALC,YAAY;GAC3B,UAAU;GACV,YAAY,OAAO,KAAK;GACxB;EACD,CACsC,CAAC,CAAC,CAAC,UAAU,OAAO,KAAK,KAAK;EAEpE,IAAI,CAAC,OAAO,SACX,OAAO;EAGR,OAAO;GACN,SAAS;GACT,MAAM;IACL,KAAK,OAAO,KAAK;IACjB,MAAM;IACN,YAAY,OAAO,KAAK,SAAS,KAAA;IACjC,QAAQ,OAAO;GAChB;EACD;CACD;CAEA,YAAY,OAAO;EAMlB,MAAM,SAAS,iBALC,YAAY;GAC3B,UAAU,MAAM;GAChB,YAAY,MAAM;GAClB;EACD,CACsC,CAAC,CAAC,CAAC,YAAY,MAAM,MAAM;EAEjE,IAAI,CAAC,QACJ,OAAO;GACN,SAAS;IACR,KAAK,MAAM;IACX,OAAO,MAAM;IACb,OAAO,CAAC;GACT;GACA,OAAO,CAAC;GACR,MAAM,CAAC;EACR;EAGD,OAAO;GACN,SAAS;IACR,KAAK,MAAM;IACX,OAAO,MAAM;IACb,OAAO,OAAO;GACf;GACA,OAAO,OAAO;GACd,MAAM,OAAO;EACd;CACD;AACD;AAGA,MAAa,qBACZ,SAC+C;CAC/C,MAAM;CAEN,GAAG,OAA+B;EACjC,OAAO,oBAAoB,UAAU,KAAK,CAAC,CAAC;CAC7C;CAEA,UAAU,OAAO;EAChB,MAAM,SAAS,mBAAmB,UAAU,KAAK;EACjD,IAAI,CAAC,OAAO,SACX,OAAO;EAGR,MAAM,QAAgC,CAAC;EACvC,KAAK,IAAI,QAAQ,GAAG,QAAQ,OAAO,KAAK,QAAQ,SAAS;GACxD,MAAM,OAAO,OAAO,KAAK;GACzB,MAAM,SAAS,qBAAqB,GAAG,CAAC,CAAC,UAAU,IAAI;GACvD,IAAI,CAAC,OAAO,SACX,OAAO;GAER,MAAM,KAAK,OAAO,IAAI;EACvB;EAEA,OAAO;GACN,SAAS;GACT,MAAM;IAAE,UAAU;IAAmB;GAAM;EAC5C;CACD;CAEA,YAAY,OAAO;EAClB,MAAM,SAA8E;GACnF,SAAS,CAAC;GACV,OAAO,GAAG,IAAI,YAAY,SAAS;GACnC,MAAM,CAAC;EACR;EAEA,KAAK,IAAI,QAAQ,GAAG,QAAQ,MAAM,MAAM,QAAQ,SAAS;GACxD,MAAM,OAAO,MAAM,MAAM;GACzB,MAAM,SAAS,qBAAqB,GAAG,CAAC,CAAC,YAAY,IAAI;GACzD,IAAI,CAAC,QAAQ;GAEb,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.js","names":[],"sources":["../../../src/content/codec/table.ts"],"sourcesContent":["import { TableLegacySchema } from \"../legacy/table\"\nimport type { TableLegacy } from \"../legacy/table\"\nimport { RichTextContentType } from \"../richText\"\nimport { TableContentSchema, TableContentType } from \"../table\"\nimport type { TableContent } from \"../table\"\nimport type { LegacyContentCtx, LegacyCodec } from \"./legacyContentCtx\"\nimport { blockLegacyToValue, blockValueToLegacy } from \"./richText\"\n\nexport const TableLegacyCodec = (\n\tctx: LegacyContentCtx,\n): LegacyCodec<TableContent, TableLegacy> => ({\n\tname: \"TableLegacy\",\n\n\tis(input): input is TableContent {\n\t\treturn TableContentSchema.safeParse(input).success\n\t},\n\n\ttoContent(input) {\n\t\tconst parsed = TableLegacySchema.safeParse(input)\n\t\tif (!parsed.success) {\n\t\t\treturn parsed\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: {\n\t\t\t\t__TYPE__: TableContentType,\n\t\t\t\tcontent: parsed.data.content.map((row) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...row,\n\t\t\t\t\t\tcontent: row.content.map((cell) => {\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t...cell,\n\t\t\t\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\t\t\t__TYPE__: RichTextContentType,\n\t\t\t\t\t\t\t\t\tvalue: cell.content.map((block) => blockLegacyToValue(block)),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}),\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t},\n\t\t}\n\t},\n\n\tfromContent(input) {\n\t\treturn {\n\t\t\tcontent: {\n\t\t\t\tcontent: input.content.map((row) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...row,\n\t\t\t\t\t\tcontent: row.content.map((cell) => {\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t...cell,\n\t\t\t\t\t\t\t\tcontent: cell.content.value.map((block) => blockValueToLegacy(block)),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}),\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t},\n\t\t\ttypes: { [ctx.keyOfType]: \"Table\" },\n\t\t\tkeys: {},\n\t\t}\n\t},\n})\n"],"mappings":";;;;;AAQA,MAAa,oBACZ,SAC6C;CAC7C,MAAM;CAEN,GAAG,OAA8B;
|
|
1
|
+
{"version":3,"file":"table.js","names":[],"sources":["../../../src/content/codec/table.ts"],"sourcesContent":["import { TableLegacySchema } from \"../legacy/table\"\nimport type { TableLegacy } from \"../legacy/table\"\nimport { RichTextContentType } from \"../richText\"\nimport { TableContentSchema, TableContentType } from \"../table\"\nimport type { TableContent } from \"../table\"\nimport type { LegacyContentCtx, LegacyCodec } from \"./legacyContentCtx\"\nimport { blockLegacyToValue, blockValueToLegacy } from \"./richText\"\n\nexport const TableLegacyCodec = (\n\tctx: LegacyContentCtx,\n): LegacyCodec<TableContent, TableLegacy> => ({\n\tname: \"TableLegacy\",\n\n\tis(input): input is TableContent {\n\t\treturn TableContentSchema.safeParse(input).success\n\t},\n\n\ttoContent(input) {\n\t\tconst parsed = TableLegacySchema.safeParse(input)\n\t\tif (!parsed.success) {\n\t\t\treturn parsed\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: {\n\t\t\t\t__TYPE__: TableContentType,\n\t\t\t\tcontent: parsed.data.content.map((row) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...row,\n\t\t\t\t\t\tcontent: row.content.map((cell) => {\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t...cell,\n\t\t\t\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\t\t\t__TYPE__: RichTextContentType,\n\t\t\t\t\t\t\t\t\tvalue: cell.content.map((block) => blockLegacyToValue(block)),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}),\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t},\n\t\t}\n\t},\n\n\tfromContent(input) {\n\t\treturn {\n\t\t\tcontent: {\n\t\t\t\tcontent: input.content.map((row) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...row,\n\t\t\t\t\t\tcontent: row.content.map((cell) => {\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t...cell,\n\t\t\t\t\t\t\t\tcontent: cell.content.value.map((block) => blockValueToLegacy(block)),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}),\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t},\n\t\t\ttypes: { [ctx.keyOfType]: \"Table\" },\n\t\t\tkeys: {},\n\t\t}\n\t},\n})\n"],"mappings":";;;;;AAQA,MAAa,oBACZ,SAC6C;CAC7C,MAAM;CAEN,GAAG,OAA8B;EAChC,OAAO,mBAAmB,UAAU,KAAK,CAAC,CAAC;CAC5C;CAEA,UAAU,OAAO;EAChB,MAAM,SAAS,kBAAkB,UAAU,KAAK;EAChD,IAAI,CAAC,OAAO,SACX,OAAO;EAGR,OAAO;GACN,SAAS;GACT,MAAM;IACL,UAAU;IACV,SAAS,OAAO,KAAK,QAAQ,KAAK,QAAQ;KACzC,OAAO;MACN,GAAG;MACH,SAAS,IAAI,QAAQ,KAAK,SAAS;OAClC,OAAO;QACN,GAAG;QACH,SAAS;SACR,UAAU;SACV,OAAO,KAAK,QAAQ,KAAK,UAAU,mBAAmB,KAAK,CAAC;QAC7D;OACD;MACD,CAAC;KACF;IACD,CAAC;GACF;EACD;CACD;CAEA,YAAY,OAAO;EAClB,OAAO;GACN,SAAS,EACR,SAAS,MAAM,QAAQ,KAAK,QAAQ;IACnC,OAAO;KACN,GAAG;KACH,SAAS,IAAI,QAAQ,KAAK,SAAS;MAClC,OAAO;OACN,GAAG;OACH,SAAS,KAAK,QAAQ,MAAM,KAAK,UAAU,mBAAmB,KAAK,CAAC;MACrE;KACD,CAAC;IACF;GACD,CAAC,EACF;GACA,OAAO,GAAG,IAAI,YAAY,QAAQ;GAClC,MAAM,CAAC;EACR;CACD;AACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uid.js","names":[],"sources":["../../../src/content/codec/uid.ts"],"sourcesContent":["import { UIDLegacySchema } from \"../legacy/uid\"\nimport type { UIDLegacy } from \"../legacy/uid\"\nimport { UIDContentSchema, UIDContentType } from \"../uid\"\nimport type { UIDContent } from \"../uid\"\nimport type { LegacyContentCtx, LegacyCodec } from \"./legacyContentCtx\"\n\nexport const UIDLegacyCodec = (ctx: LegacyContentCtx): LegacyCodec<UIDContent, UIDLegacy> => ({\n\tname: \"UIDLegacy\",\n\n\tis(input): input is UIDContent {\n\t\treturn UIDContentSchema.safeParse(input).success\n\t},\n\n\ttoContent(input) {\n\t\tconst parsed = UIDLegacySchema.safeParse(input)\n\t\tif (!parsed.success) {\n\t\t\treturn parsed\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: {\n\t\t\t\t__TYPE__: UIDContentType,\n\t\t\t\tvalue: parsed.data,\n\t\t\t},\n\t\t}\n\t},\n\n\tfromContent(input) {\n\t\treturn {\n\t\t\tcontent: input.value,\n\t\t\ttypes: { [ctx.keyOfType]: \"UID\" },\n\t\t\tkeys: {},\n\t\t}\n\t},\n})\n"],"mappings":";;;AAMA,MAAa,kBAAkB,SAA+D;CAC7F,MAAM;CAEN,GAAG,OAA4B;
|
|
1
|
+
{"version":3,"file":"uid.js","names":[],"sources":["../../../src/content/codec/uid.ts"],"sourcesContent":["import { UIDLegacySchema } from \"../legacy/uid\"\nimport type { UIDLegacy } from \"../legacy/uid\"\nimport { UIDContentSchema, UIDContentType } from \"../uid\"\nimport type { UIDContent } from \"../uid\"\nimport type { LegacyContentCtx, LegacyCodec } from \"./legacyContentCtx\"\n\nexport const UIDLegacyCodec = (ctx: LegacyContentCtx): LegacyCodec<UIDContent, UIDLegacy> => ({\n\tname: \"UIDLegacy\",\n\n\tis(input): input is UIDContent {\n\t\treturn UIDContentSchema.safeParse(input).success\n\t},\n\n\ttoContent(input) {\n\t\tconst parsed = UIDLegacySchema.safeParse(input)\n\t\tif (!parsed.success) {\n\t\t\treturn parsed\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: {\n\t\t\t\t__TYPE__: UIDContentType,\n\t\t\t\tvalue: parsed.data,\n\t\t\t},\n\t\t}\n\t},\n\n\tfromContent(input) {\n\t\treturn {\n\t\t\tcontent: input.value,\n\t\t\ttypes: { [ctx.keyOfType]: \"UID\" },\n\t\t\tkeys: {},\n\t\t}\n\t},\n})\n"],"mappings":";;;AAMA,MAAa,kBAAkB,SAA+D;CAC7F,MAAM;CAEN,GAAG,OAA4B;EAC9B,OAAO,iBAAiB,UAAU,KAAK,CAAC,CAAC;CAC1C;CAEA,UAAU,OAAO;EAChB,MAAM,SAAS,gBAAgB,UAAU,KAAK;EAC9C,IAAI,CAAC,OAAO,SACX,OAAO;EAGR,OAAO;GACN,SAAS;GACT,MAAM;IACL,UAAU;IACV,OAAO,OAAO;GACf;EACD;CACD;CAEA,YAAY,OAAO;EAClB,OAAO;GACN,SAAS,MAAM;GACf,OAAO,GAAG,IAAI,YAAY,MAAM;GAChC,MAAM,CAAC;EACR;CACD;AACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget.js","names":[],"sources":["../../../src/content/codec/widget.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { GroupContentType } from \"../group\"\nimport type { WidgetLegacy } from \"../legacy/widget\"\nimport { SlicesContentType } from \"../slices\"\nimport { UIDContentType } from \"../uid\"\nimport { WidgetContentSchema } from \"../widget\"\nimport type { WidgetContent } from \"../widget\"\nimport { GroupLegacyCodec } from \"./group\"\nimport type { LegacyCodec, LegacyContentCtx } from \"./legacyContentCtx\"\nimport { NestableLegacyCodec } from \"./nestable\"\nimport { SlicesLegacyCodec } from \"./slices\"\nimport { UIDLegacyCodec } from \"./uid\"\n\nconst UnsupportedWidgetLegacySchema = z.never()\n\nexport const WidgetLegacyCodec = (\n\tctx: LegacyContentCtx,\n): LegacyCodec<WidgetContent, WidgetLegacy, true> => ({\n\tname: \"WidgetLegacy\",\n\n\tis(input): input is WidgetContent {\n\t\treturn WidgetContentSchema.safeParse(input).success\n\t},\n\n\ttoContent(input) {\n\t\tif (!ctx.fieldType) {\n\t\t\treturn UnsupportedWidgetLegacySchema.safeParse(\n\t\t\t\tinput,\n\t\t\t) as z.core.util.SafeParseError<WidgetLegacy>\n\t\t}\n\n\t\tswitch (ctx.fieldType) {\n\t\t\tcase \"UID\":\n\t\t\t\treturn UIDLegacyCodec(ctx).toContent(input)\n\t\t\tcase \"Group\":\n\t\t\t\treturn GroupLegacyCodec(ctx).toContent(input)\n\t\t\tcase \"Choice\":\n\t\t\tcase \"Slices\":\n\t\t\t\treturn SlicesLegacyCodec(ctx).toContent(input)\n\t\t\tdefault:\n\t\t\t\treturn NestableLegacyCodec(ctx).toContent(input)\n\t\t}\n\t},\n\n\tfromContent(input) {\n\t\tswitch (input.__TYPE__) {\n\t\t\tcase UIDContentType:\n\t\t\t\treturn UIDLegacyCodec(ctx).fromContent(input)\n\t\t\tcase GroupContentType:\n\t\t\t\treturn GroupLegacyCodec(ctx).fromContent(input)\n\t\t\tcase SlicesContentType:\n\t\t\t\treturn SlicesLegacyCodec(ctx).fromContent(input)\n\t\t\tdefault:\n\t\t\t\treturn NestableLegacyCodec(ctx).fromContent(input)\n\t\t}\n\t},\n})\n"],"mappings":";;;;;;;;;;AAcA,MAAM,gCAAgC,EAAE,
|
|
1
|
+
{"version":3,"file":"widget.js","names":[],"sources":["../../../src/content/codec/widget.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { GroupContentType } from \"../group\"\nimport type { WidgetLegacy } from \"../legacy/widget\"\nimport { SlicesContentType } from \"../slices\"\nimport { UIDContentType } from \"../uid\"\nimport { WidgetContentSchema } from \"../widget\"\nimport type { WidgetContent } from \"../widget\"\nimport { GroupLegacyCodec } from \"./group\"\nimport type { LegacyCodec, LegacyContentCtx } from \"./legacyContentCtx\"\nimport { NestableLegacyCodec } from \"./nestable\"\nimport { SlicesLegacyCodec } from \"./slices\"\nimport { UIDLegacyCodec } from \"./uid\"\n\nconst UnsupportedWidgetLegacySchema = z.never()\n\nexport const WidgetLegacyCodec = (\n\tctx: LegacyContentCtx,\n): LegacyCodec<WidgetContent, WidgetLegacy, true> => ({\n\tname: \"WidgetLegacy\",\n\n\tis(input): input is WidgetContent {\n\t\treturn WidgetContentSchema.safeParse(input).success\n\t},\n\n\ttoContent(input) {\n\t\tif (!ctx.fieldType) {\n\t\t\treturn UnsupportedWidgetLegacySchema.safeParse(\n\t\t\t\tinput,\n\t\t\t) as z.core.util.SafeParseError<WidgetLegacy>\n\t\t}\n\n\t\tswitch (ctx.fieldType) {\n\t\t\tcase \"UID\":\n\t\t\t\treturn UIDLegacyCodec(ctx).toContent(input)\n\t\t\tcase \"Group\":\n\t\t\t\treturn GroupLegacyCodec(ctx).toContent(input)\n\t\t\tcase \"Choice\":\n\t\t\tcase \"Slices\":\n\t\t\t\treturn SlicesLegacyCodec(ctx).toContent(input)\n\t\t\tdefault:\n\t\t\t\treturn NestableLegacyCodec(ctx).toContent(input)\n\t\t}\n\t},\n\n\tfromContent(input) {\n\t\tswitch (input.__TYPE__) {\n\t\t\tcase UIDContentType:\n\t\t\t\treturn UIDLegacyCodec(ctx).fromContent(input)\n\t\t\tcase GroupContentType:\n\t\t\t\treturn GroupLegacyCodec(ctx).fromContent(input)\n\t\t\tcase SlicesContentType:\n\t\t\t\treturn SlicesLegacyCodec(ctx).fromContent(input)\n\t\t\tdefault:\n\t\t\t\treturn NestableLegacyCodec(ctx).fromContent(input)\n\t\t}\n\t},\n})\n"],"mappings":";;;;;;;;;;AAcA,MAAM,gCAAgC,EAAE,MAAM;AAE9C,MAAa,qBACZ,SACqD;CACrD,MAAM;CAEN,GAAG,OAA+B;EACjC,OAAO,oBAAoB,UAAU,KAAK,CAAC,CAAC;CAC7C;CAEA,UAAU,OAAO;EAChB,IAAI,CAAC,IAAI,WACR,OAAO,8BAA8B,UACpC,KACD;EAGD,QAAQ,IAAI,WAAZ;GACC,KAAK,OACJ,OAAO,eAAe,GAAG,CAAC,CAAC,UAAU,KAAK;GAC3C,KAAK,SACJ,OAAO,iBAAiB,GAAG,CAAC,CAAC,UAAU,KAAK;GAC7C,KAAK;GACL,KAAK,UACJ,OAAO,kBAAkB,GAAG,CAAC,CAAC,UAAU,KAAK;GAC9C,SACC,OAAO,oBAAoB,GAAG,CAAC,CAAC,UAAU,KAAK;EACjD;CACD;CAEA,YAAY,OAAO;EAClB,QAAQ,MAAM,UAAd;GACC,KAAK,gBACJ,OAAO,eAAe,GAAG,CAAC,CAAC,YAAY,KAAK;GAC7C,KAAK,kBACJ,OAAO,iBAAiB,GAAG,CAAC,CAAC,YAAY,KAAK;GAC/C,KAAK,mBACJ,OAAO,kBAAkB,GAAG,CAAC,CAAC,YAAY,KAAK;GAChD,SACC,OAAO,oBAAoB,GAAG,CAAC,CAAC,YAAY,KAAK;EACnD;CACD;AACD"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { WidgetContent } from "./widget.js";
|
|
2
2
|
import { z } from "zod/mini";
|
|
3
|
-
|
|
4
3
|
//#region src/content/document.d.ts
|
|
5
4
|
declare const DocumentContentSchema: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniType<WidgetContent, unknown, z.core.$ZodTypeInternals<WidgetContent, unknown>>>;
|
|
6
5
|
type DocumentContent = z.infer<typeof DocumentContentSchema>;
|
|
7
6
|
//#endregion
|
|
8
|
-
export { DocumentContent };
|
|
7
|
+
export { DocumentContent, DocumentContentSchema };
|
|
9
8
|
//# sourceMappingURL=document.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.d.ts","names":[],"sources":["../../src/content/document.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"document.d.ts","names":[],"sources":["../../src/content/document.ts"],"mappings":";;;cAKa,uBAAqB,EAAA,cAAA,EAAA,uBAAA,EAAA,YAAA,wBAAA,EAAA,KAAA,kBAAA;KAEtB,kBAAkB,EAAE,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.js","names":[],"sources":["../../src/content/document.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { WidgetKeySchema } from \"../common/widgetKey\"\nimport { WidgetContentSchema } from \"./widget\"\n\nexport const DocumentContentSchema = z.record(WidgetKeySchema, WidgetContentSchema)\n\nexport type DocumentContent = z.infer<typeof DocumentContentSchema>\n"],"mappings":";;;;AAKA,MAAa,wBAAwB,EAAE,OAAO,iBAAiB,
|
|
1
|
+
{"version":3,"file":"document.js","names":[],"sources":["../../src/content/document.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { WidgetKeySchema } from \"../common/widgetKey\"\nimport { WidgetContentSchema } from \"./widget\"\n\nexport const DocumentContentSchema = z.record(WidgetKeySchema, WidgetContentSchema)\n\nexport type DocumentContent = z.infer<typeof DocumentContentSchema>\n"],"mappings":";;;;AAKA,MAAa,wBAAwB,EAAE,OAAO,iBAAiB,mBAAmB"}
|
package/dist/content/embed.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from "zod/mini";
|
|
2
|
-
|
|
3
2
|
//#region src/content/embed.d.ts
|
|
4
3
|
declare const EmbedContentSchema: z.ZodMiniObject<{
|
|
5
4
|
embed_url: z.ZodMiniString<string>;
|
|
@@ -20,5 +19,5 @@ declare const EmbedContentSchema: z.ZodMiniObject<{
|
|
|
20
19
|
}, z.core.$strip>;
|
|
21
20
|
type EmbedContent = z.infer<typeof EmbedContentSchema>;
|
|
22
21
|
//#endregion
|
|
23
|
-
export { EmbedContent };
|
|
22
|
+
export { EmbedContent, EmbedContentSchema };
|
|
24
23
|
//# sourceMappingURL=embed.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embed.d.ts","names":[],"sources":["../../src/content/embed.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"embed.d.ts","names":[],"sources":["../../src/content/embed.ts"],"mappings":";;cAMa,oBAAkB,EAAA;;;;;;;;;;;;;;;;;KAKnB,eAAe,EAAE,aAAa"}
|
|
@@ -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,
|
|
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"}
|
package/dist/content/empty.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from "zod/mini";
|
|
2
|
-
|
|
3
2
|
//#region src/content/empty.d.ts
|
|
4
3
|
declare const EmptyContentSchema: z.ZodMiniObject<{
|
|
5
4
|
type: z.ZodMiniString<string>;
|
|
@@ -7,5 +6,5 @@ declare const EmptyContentSchema: z.ZodMiniObject<{
|
|
|
7
6
|
}, z.core.$strip>;
|
|
8
7
|
type EmptyContent = z.infer<typeof EmptyContentSchema>;
|
|
9
8
|
//#endregion
|
|
10
|
-
export { EmptyContent };
|
|
9
|
+
export { EmptyContent, EmptyContentSchema };
|
|
11
10
|
//# sourceMappingURL=empty.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empty.d.ts","names":[],"sources":["../../src/content/empty.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"empty.d.ts","names":[],"sources":["../../src/content/empty.ts"],"mappings":";;cAIa,oBAAkB,EAAA;;;;KAKnB,eAAe,EAAE,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empty.js","names":[],"sources":["../../src/content/empty.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nexport const EmptyContentType = \"EmptyContent\" as const\n\nexport const EmptyContentSchema = z.object({\n\ttype: z.string(),\n\t__TYPE__: z.literal(EmptyContentType),\n})\n\nexport type EmptyContent = z.infer<typeof EmptyContentSchema>\n"],"mappings":";;AAEA,MAAa,mBAAmB;AAEhC,MAAa,qBAAqB,EAAE,OAAO;CAC1C,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"empty.js","names":[],"sources":["../../src/content/empty.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nexport const EmptyContentType = \"EmptyContent\" as const\n\nexport const EmptyContentSchema = z.object({\n\ttype: z.string(),\n\t__TYPE__: z.literal(EmptyContentType),\n})\n\nexport type EmptyContent = z.infer<typeof EmptyContentSchema>\n"],"mappings":";;AAEA,MAAa,mBAAmB;AAEhC,MAAa,qBAAqB,EAAE,OAAO;CAC1C,MAAM,EAAE,OAAO;CACf,UAAU,EAAE,QAAQ,gBAAgB;AACrC,CAAC"}
|
package/dist/content/field.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from "zod/mini";
|
|
2
|
-
|
|
3
2
|
//#region src/content/field.d.ts
|
|
4
3
|
declare const TextContentSchema: z.ZodMiniObject<{
|
|
5
4
|
type: z.ZodMiniLiteral<"Text">;
|
|
@@ -45,5 +44,5 @@ type RangeContent = z.infer<typeof RangeContentSchema>;
|
|
|
45
44
|
type SelectContent = z.infer<typeof SelectContentSchema>;
|
|
46
45
|
type FieldContent = TextContent | ColorContent | DateContent | TimestampContent | NumberContent | RangeContent | SelectContent;
|
|
47
46
|
//#endregion
|
|
48
|
-
export { ColorContent, DateContent, FieldContent, NumberContent, RangeContent, SelectContent, TextContent, TimestampContent };
|
|
47
|
+
export { ColorContent, ColorContentSchema, DateContent, DateContentSchema, FieldContent, NumberContent, NumberContentSchema, RangeContent, RangeContentSchema, SelectContent, SelectContentSchema, TextContent, TextContentSchema, TimestampContent, TimestampContentSchema };
|
|
49
48
|
//# sourceMappingURL=field.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.d.ts","names":[],"sources":["../../src/content/field.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"field.d.ts","names":[],"sources":["../../src/content/field.ts"],"mappings":";;cAMa,mBAAiB,EAAA;;;;;cAOjB,oBAAkB,EAAA;;;;;cAOlB,mBAAiB,EAAA;;;;;cAOjB,wBAAsB,EAAA;;;;;cAOtB,qBAAmB,EAAA;;;;;cAOnB,oBAAkB,EAAA;;;;;cAOlB,qBAAmB,EAAA;;;;;KAiBpB,cAAc,EAAE,aAAa;KAC7B,eAAe,EAAE,aAAa;KAC9B,cAAc,EAAE,aAAa;KAC7B,mBAAmB,EAAE,aAAa;KAClC,gBAAgB,EAAE,aAAa;KAC/B,eAAe,EAAE,aAAa;KAC9B,gBAAgB,EAAE,aAAa;KAC/B,eACT,cACA,eACA,cACA,mBACA,gBACA,eACA"}
|
|
@@ -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.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,
|
|
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,MAAM;CACtB,OAAO,EAAE,OAAO,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC;CAChC,UAAU,EAAE,QAAQ,gBAAgB;AACrC,CAAC;AAGD,MAAa,qBAAqB,EAAE,OAAO;CAC1C,MAAM,EAAE,QAAQ,OAAO;CACvB,OAAO,EAAE,OAAO,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC;CAChC,UAAU,EAAE,QAAQ,gBAAgB;AACrC,CAAC;AAGD,MAAa,oBAAoB,EAAE,OAAO;CACzC,MAAM,EAAE,QAAQ,MAAM;CACtB,OAAO,EAAE,OAAO,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC;CAChC,UAAU,EAAE,QAAQ,gBAAgB;AACrC,CAAC;AAGD,MAAa,yBAAyB,EAAE,OAAO;CAC9C,MAAM,EAAE,QAAQ,WAAW;CAC3B,OAAO,EAAE,OAAO,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC;CAChC,UAAU,EAAE,QAAQ,gBAAgB;AACrC,CAAC;AAGD,MAAa,sBAAsB,EAAE,OAAO;CAC3C,MAAM,EAAE,QAAQ,QAAQ;CACxB,OAAO,EAAE,OAAO,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC;CAChC,UAAU,EAAE,QAAQ,gBAAgB;AACrC,CAAC;AAGD,MAAa,qBAAqB,EAAE,OAAO;CAC1C,MAAM,EAAE,QAAQ,OAAO;CACvB,OAAO,EAAE,OAAO,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC;CAChC,UAAU,EAAE,QAAQ,gBAAgB;AACrC,CAAC;AAGD,MAAa,sBAAsB,EAAE,OAAO;CAC3C,MAAM,EAAE,QAAQ,eAAe;CAC/B,OAAO,EAAE,OAAO,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC;CAChC,UAAU,EAAE,QAAQ,gBAAgB;AACrC,CAAC;AAGD,MAAa,qBAAqB,EAAE,mBAAmB,QAAQ;CAC9D;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from "zod/mini";
|
|
2
|
-
|
|
3
2
|
//#region src/content/geopoint.d.ts
|
|
4
3
|
declare const GeoPointContentSchema: z.ZodMiniObject<{
|
|
5
4
|
position: z.ZodMiniObject<{
|
|
@@ -10,5 +9,5 @@ declare const GeoPointContentSchema: z.ZodMiniObject<{
|
|
|
10
9
|
}, z.core.$strip>;
|
|
11
10
|
type GeoPointContent = z.infer<typeof GeoPointContentSchema>;
|
|
12
11
|
//#endregion
|
|
13
|
-
export { GeoPointContent };
|
|
12
|
+
export { GeoPointContent, GeoPointContentSchema };
|
|
14
13
|
//# sourceMappingURL=geopoint.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geopoint.d.ts","names":[],"sources":["../../src/content/geopoint.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"geopoint.d.ts","names":[],"sources":["../../src/content/geopoint.ts"],"mappings":";;cAMa,uBAAqB,EAAA;;;;;;;KAItB,kBAAkB,EAAE,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geopoint.js","names":[],"sources":["../../src/content/geopoint.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { GeoPointLegacySchema } from \"./legacy/geopoint\"\n\nexport const GeoPointContentType = \"GeoPointContent\" as const\n\nexport const GeoPointContentSchema = z.extend(GeoPointLegacySchema, {\n\t__TYPE__: z.literal(GeoPointContentType),\n})\n\nexport type GeoPointContent = z.infer<typeof GeoPointContentSchema>\n"],"mappings":";;;AAIA,MAAa,sBAAsB;AAEnC,MAAa,wBAAwB,EAAE,OAAO,sBAAsB,EACnE,UAAU,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"geopoint.js","names":[],"sources":["../../src/content/geopoint.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { GeoPointLegacySchema } from \"./legacy/geopoint\"\n\nexport const GeoPointContentType = \"GeoPointContent\" as const\n\nexport const GeoPointContentSchema = z.extend(GeoPointLegacySchema, {\n\t__TYPE__: z.literal(GeoPointContentType),\n})\n\nexport type GeoPointContent = z.infer<typeof GeoPointContentSchema>\n"],"mappings":";;;AAIA,MAAa,sBAAsB;AAEnC,MAAa,wBAAwB,EAAE,OAAO,sBAAsB,EACnE,UAAU,EAAE,QAAQ,mBAAmB,EACxC,CAAC"}
|
package/dist/content/group.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import "./link.js";
|
|
2
|
+
import "./richText.js";
|
|
1
3
|
import { NestableContent } from "./nestable.js";
|
|
2
4
|
import { z } from "zod/mini";
|
|
3
|
-
|
|
4
5
|
//#region src/content/group.d.ts
|
|
5
6
|
declare const GroupItemContentType: "GroupItemContent";
|
|
6
7
|
type GroupItemContent = {
|
|
@@ -14,5 +15,5 @@ declare const GroupContentSchema: z.ZodMiniObject<{
|
|
|
14
15
|
}, z.core.$strip>;
|
|
15
16
|
type GroupContent = z.infer<typeof GroupContentSchema>;
|
|
16
17
|
//#endregion
|
|
17
|
-
export { GroupContent, GroupItemContent };
|
|
18
|
+
export { GroupContent, GroupContentSchema, GroupItemContent, GroupItemContentType };
|
|
18
19
|
//# sourceMappingURL=group.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group.d.ts","names":[],"sources":["../../src/content/group.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"group.d.ts","names":[],"sources":["../../src/content/group.ts"],"mappings":";;;;;cAMa;KAkBD;EACX,iBAAiB;EACjB;EACA,gBAAgB,kBAAkB;;cAMtB,oBAAkB,EAAA;;;;KAKnB,eAAe,EAAE,aAAa"}
|
|
@@ -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.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,
|
|
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,oBAAoB;CACxC,KAAK,EAAE,OAAO;CACd,OAAO,EAAE,MACR,EAAE,MAAM,CACP,EAAE,OAAO,GACT,EAAE,MAAM,CACP,uBAEA,EAAE,WAAW,kBAAkB,CAChC,CAAC,CACF,CAAC,CACF;AACD,CAAC;AAUD,MAAa,mBAAmB;AAEhC,MAAa,qBAAqB,EAAE,OAAO;CAC1C,UAAU,EAAE,QAAQ,gBAAgB;CACpC,OAAO,EAAE,MAAM,sBAAsB;AACtC,CAAC;AAID,MAAa,gCAAgC,EAAE,mBAAmB,YAAY,CAC7E,uBACA,kBACD,CAAC"}
|
package/dist/content/image.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ImageLegacyViewSchema } from "./legacy/image.js";
|
|
2
2
|
import { z } from "zod/mini";
|
|
3
|
-
|
|
4
3
|
//#region src/content/image.d.ts
|
|
5
4
|
type ImageContentView = z.infer<typeof ImageLegacyViewSchema>;
|
|
6
5
|
declare const ImageContentSchema: z.ZodMiniObject<{
|
|
@@ -50,5 +49,5 @@ declare const ImageContentSchema: z.ZodMiniObject<{
|
|
|
50
49
|
}, z.core.$strip>;
|
|
51
50
|
type ImageContent = z.infer<typeof ImageContentSchema>;
|
|
52
51
|
//#endregion
|
|
53
|
-
export { ImageContent, ImageContentView };
|
|
52
|
+
export { ImageContent, ImageContentSchema, ImageContentView };
|
|
54
53
|
//# sourceMappingURL=image.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.d.ts","names":[],"sources":["../../src/content/image.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"image.d.ts","names":[],"sources":["../../src/content/image.ts"],"mappings":";;;KAQY,mBAAmB,EAAE,aAAa;cAEjC,oBAAkB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAInB,eAAe,EAAE,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.js","names":[],"sources":["../../src/content/image.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { ImageLegacyViewSchema, ImageLegacySchema } from \"./legacy/image\"\n\nexport const ImageContentType = \"ImageContent\" as const\n\nexport const ImageContentViewSchema = ImageLegacyViewSchema\n\nexport type ImageContentView = z.infer<typeof ImageLegacyViewSchema>\n\nexport const ImageContentSchema = z.extend(ImageLegacySchema, {\n\t__TYPE__: z.literal(ImageContentType),\n})\n\nexport type ImageContent = z.infer<typeof ImageContentSchema>\n"],"mappings":";;;AAIA,MAAa,mBAAmB;AAEhC,MAAa,yBAAyB;AAItC,MAAa,qBAAqB,EAAE,OAAO,mBAAmB,EAC7D,UAAU,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"image.js","names":[],"sources":["../../src/content/image.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { ImageLegacyViewSchema, ImageLegacySchema } from \"./legacy/image\"\n\nexport const ImageContentType = \"ImageContent\" as const\n\nexport const ImageContentViewSchema = ImageLegacyViewSchema\n\nexport type ImageContentView = z.infer<typeof ImageLegacyViewSchema>\n\nexport const ImageContentSchema = z.extend(ImageLegacySchema, {\n\t__TYPE__: z.literal(ImageContentType),\n})\n\nexport type ImageContent = z.infer<typeof ImageContentSchema>\n"],"mappings":";;;AAIA,MAAa,mBAAmB;AAEhC,MAAa,yBAAyB;AAItC,MAAa,qBAAqB,EAAE,OAAO,mBAAmB,EAC7D,UAAU,EAAE,QAAQ,gBAAgB,EACrC,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from "zod/mini";
|
|
2
|
-
|
|
3
2
|
//#region src/content/integrationField.d.ts
|
|
4
3
|
declare const IntegrationFieldContentSchema: z.ZodMiniObject<{
|
|
5
4
|
__TYPE__: z.ZodMiniLiteral<"IntegrationFieldsContent">;
|
|
@@ -7,5 +6,5 @@ declare const IntegrationFieldContentSchema: z.ZodMiniObject<{
|
|
|
7
6
|
}, z.core.$strip>;
|
|
8
7
|
type IntegrationFieldContent = z.infer<typeof IntegrationFieldContentSchema>;
|
|
9
8
|
//#endregion
|
|
10
|
-
export { IntegrationFieldContent };
|
|
9
|
+
export { IntegrationFieldContent, IntegrationFieldContentSchema };
|
|
11
10
|
//# sourceMappingURL=integrationField.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integrationField.d.ts","names":[],"sources":["../../src/content/integrationField.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"integrationField.d.ts","names":[],"sources":["../../src/content/integrationField.ts"],"mappings":";;cAIa,+BAA6B,EAAA;;;;KAK9B,0BAA0B,EAAE,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integrationField.js","names":[],"sources":["../../src/content/integrationField.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nexport const IntegrationFieldContentType = \"IntegrationFieldsContent\" as const\n\nexport const IntegrationFieldContentSchema = z.object({\n\t__TYPE__: z.literal(IntegrationFieldContentType),\n\tvalue: z.string(),\n})\n\nexport type IntegrationFieldContent = z.infer<typeof IntegrationFieldContentSchema>\n"],"mappings":";;AAEA,MAAa,8BAA8B;AAE3C,MAAa,gCAAgC,EAAE,OAAO;CACrD,UAAU,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"integrationField.js","names":[],"sources":["../../src/content/integrationField.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nexport const IntegrationFieldContentType = \"IntegrationFieldsContent\" as const\n\nexport const IntegrationFieldContentSchema = z.object({\n\t__TYPE__: z.literal(IntegrationFieldContentType),\n\tvalue: z.string(),\n})\n\nexport type IntegrationFieldContent = z.infer<typeof IntegrationFieldContentSchema>\n"],"mappings":";;AAEA,MAAa,8BAA8B;AAE3C,MAAa,gCAAgC,EAAE,OAAO;CACrD,UAAU,EAAE,QAAQ,2BAA2B;CAC/C,OAAO,EAAE,OAAO;AACjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boolean.js","names":[],"sources":["../../../src/content/legacy/boolean.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nexport const BooleanLegacySchema = z.boolean()\n\nexport type BooleanLegacy = z.infer<typeof BooleanLegacySchema>\n"],"mappings":";;AAEA,MAAa,sBAAsB,EAAE,
|
|
1
|
+
{"version":3,"file":"boolean.js","names":[],"sources":["../../../src/content/legacy/boolean.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nexport const BooleanLegacySchema = z.boolean()\n\nexport type BooleanLegacy = z.infer<typeof BooleanLegacySchema>\n"],"mappings":";;AAEA,MAAa,sBAAsB,EAAE,QAAQ"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { z } from "zod/mini";
|
|
2
|
-
|
|
3
2
|
//#region src/content/legacy/document.d.ts
|
|
4
3
|
declare const DocumentLegacySchema: z.ZodMiniPipe<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>, z.ZodMiniTransform<Record<string, unknown>, Record<string, unknown>>>;
|
|
5
4
|
type DocumentLegacy = z.infer<typeof DocumentLegacySchema>;
|
|
6
5
|
//#endregion
|
|
7
|
-
export { DocumentLegacy };
|
|
6
|
+
export { DocumentLegacy, DocumentLegacySchema };
|
|
8
7
|
//# sourceMappingURL=document.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.d.ts","names":[],"sources":["../../../src/content/legacy/document.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"document.d.ts","names":[],"sources":["../../../src/content/legacy/document.ts"],"mappings":";;cAKa,sBAAoB,EAAA,YAAA,EAAA,cAAA,EAAA,uBAAA,EAAA,iBAAA,EAAA,iBAAA,yBAAA;KAmBrB,iBAAiB,EAAE,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.js","names":[],"sources":["../../../src/content/legacy/document.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { WidgetKeySchema } from \"../../common/widgetKey\"\nimport type { WidgetKey } from \"../../common/widgetKey\"\n\nexport const DocumentLegacySchema = z.pipe(\n\tz.record(z.string(), z.unknown()),\n\tz.transform((value) => {\n\t\tconst documentLegacy: Record<WidgetKey, unknown> = {}\n\n\t\tfor (const [widgetKey, widgetValue] of Object.entries(value)) {\n\t\t\t// Keep v3 behavior: invalid widget keys are dropped, but the document\n\t\t\t// decode still succeeds. Widget value validation happens later in\n\t\t\t// DocumentLegacyCodec via WidgetLegacyCodec.\n\t\t\tconst result = WidgetKeySchema.safeParse(widgetKey)\n\t\t\tif (result.success) {\n\t\t\t\tdocumentLegacy[result.data] = widgetValue\n\t\t\t}\n\t\t}\n\n\t\treturn documentLegacy\n\t}),\n)\n\nexport type DocumentLegacy = z.infer<typeof DocumentLegacySchema>\n"],"mappings":";;;AAKA,MAAa,uBAAuB,EAAE,KACrC,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"document.js","names":[],"sources":["../../../src/content/legacy/document.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { WidgetKeySchema } from \"../../common/widgetKey\"\nimport type { WidgetKey } from \"../../common/widgetKey\"\n\nexport const DocumentLegacySchema = z.pipe(\n\tz.record(z.string(), z.unknown()),\n\tz.transform((value) => {\n\t\tconst documentLegacy: Record<WidgetKey, unknown> = {}\n\n\t\tfor (const [widgetKey, widgetValue] of Object.entries(value)) {\n\t\t\t// Keep v3 behavior: invalid widget keys are dropped, but the document\n\t\t\t// decode still succeeds. Widget value validation happens later in\n\t\t\t// DocumentLegacyCodec via WidgetLegacyCodec.\n\t\t\tconst result = WidgetKeySchema.safeParse(widgetKey)\n\t\t\tif (result.success) {\n\t\t\t\tdocumentLegacy[result.data] = widgetValue\n\t\t\t}\n\t\t}\n\n\t\treturn documentLegacy\n\t}),\n)\n\nexport type DocumentLegacy = z.infer<typeof DocumentLegacySchema>\n"],"mappings":";;;AAKA,MAAa,uBAAuB,EAAE,KACrC,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC,GAChC,EAAE,WAAW,UAAU;CACtB,MAAM,iBAA6C,CAAC;CAEpD,KAAK,MAAM,CAAC,WAAW,gBAAgB,OAAO,QAAQ,KAAK,GAAG;EAI7D,MAAM,SAAS,gBAAgB,UAAU,SAAS;EAClD,IAAI,OAAO,SACV,eAAe,OAAO,QAAQ;CAEhC;CAEA,OAAO;AACR,CAAC,CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embed.js","names":[],"sources":["../../../src/content/legacy/embed.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nconst EmbedShape = {\n\tembed_url: z.string(),\n\ttype: z.string(),\n\tversion: z.nullish(z.union([z.string(), z.number()])),\n\ttitle: z.nullish(z.string()),\n\tauthor_name: z.nullish(z.string()),\n\tauthor_url: z.nullish(z.string()),\n\tprovider_name: z.nullish(z.string()),\n\tprovider_url: z.nullish(z.string()),\n\tcache_age: z.nullish(z.union([z.string(), z.number()])),\n\tthumbnail_url: z.nullish(z.string()),\n\tthumbnail_width: z.nullish(z.number()),\n\tthumbnail_height: z.nullish(z.number()),\n\thtml: z.nullish(z.string()),\n}\n\nexport const EmbedLegacySchema = z.object(EmbedShape)\n\nexport const EmbedLegacyLooseSchema = z.looseObject(EmbedShape)\n\nexport type EmbedLegacy = z.infer<typeof EmbedLegacySchema>\n"],"mappings":";;AAEA,MAAM,aAAa;CAClB,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"embed.js","names":[],"sources":["../../../src/content/legacy/embed.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nconst EmbedShape = {\n\tembed_url: z.string(),\n\ttype: z.string(),\n\tversion: z.nullish(z.union([z.string(), z.number()])),\n\ttitle: z.nullish(z.string()),\n\tauthor_name: z.nullish(z.string()),\n\tauthor_url: z.nullish(z.string()),\n\tprovider_name: z.nullish(z.string()),\n\tprovider_url: z.nullish(z.string()),\n\tcache_age: z.nullish(z.union([z.string(), z.number()])),\n\tthumbnail_url: z.nullish(z.string()),\n\tthumbnail_width: z.nullish(z.number()),\n\tthumbnail_height: z.nullish(z.number()),\n\thtml: z.nullish(z.string()),\n}\n\nexport const EmbedLegacySchema = z.object(EmbedShape)\n\nexport const EmbedLegacyLooseSchema = z.looseObject(EmbedShape)\n\nexport type EmbedLegacy = z.infer<typeof EmbedLegacySchema>\n"],"mappings":";;AAEA,MAAM,aAAa;CAClB,WAAW,EAAE,OAAO;CACpB,MAAM,EAAE,OAAO;CACf,SAAS,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;CACpD,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC;CAC3B,aAAa,EAAE,QAAQ,EAAE,OAAO,CAAC;CACjC,YAAY,EAAE,QAAQ,EAAE,OAAO,CAAC;CAChC,eAAe,EAAE,QAAQ,EAAE,OAAO,CAAC;CACnC,cAAc,EAAE,QAAQ,EAAE,OAAO,CAAC;CAClC,WAAW,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;CACtD,eAAe,EAAE,QAAQ,EAAE,OAAO,CAAC;CACnC,iBAAiB,EAAE,QAAQ,EAAE,OAAO,CAAC;CACrC,kBAAkB,EAAE,QAAQ,EAAE,OAAO,CAAC;CACtC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC;AAC3B;AAEA,MAAa,oBAAoB,EAAE,OAAO,UAAU;AAEpD,MAAa,yBAAyB,EAAE,YAAY,UAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empty.js","names":[],"sources":["../../../src/content/legacy/empty.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nexport const EmptyLegacySchema = z.union([\n\tz.null(),\n\tz.object({\n\t\tvalue: z.null(),\n\t}),\n])\n\nexport type EmptyLegacy = z.infer<typeof EmptyLegacySchema>\n"],"mappings":";;AAEA,MAAa,oBAAoB,EAAE,MAAM,CACxC,EAAE,
|
|
1
|
+
{"version":3,"file":"empty.js","names":[],"sources":["../../../src/content/legacy/empty.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nexport const EmptyLegacySchema = z.union([\n\tz.null(),\n\tz.object({\n\t\tvalue: z.null(),\n\t}),\n])\n\nexport type EmptyLegacy = z.infer<typeof EmptyLegacySchema>\n"],"mappings":";;AAEA,MAAa,oBAAoB,EAAE,MAAM,CACxC,EAAE,KAAK,GACP,EAAE,OAAO,EACR,OAAO,EAAE,KAAK,EACf,CAAC,CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.js","names":[],"sources":["../../../src/content/legacy/field.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nexport const StringLegacySchema = z.pipe(\n\tz.string(),\n\tz.transform((s: string) => s.trim()),\n)\n\nexport type StringLegacy = z.infer<typeof StringLegacySchema>\n"],"mappings":";;AAEA,MAAa,qBAAqB,EAAE,KACnC,EAAE,
|
|
1
|
+
{"version":3,"file":"field.js","names":[],"sources":["../../../src/content/legacy/field.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nexport const StringLegacySchema = z.pipe(\n\tz.string(),\n\tz.transform((s: string) => s.trim()),\n)\n\nexport type StringLegacy = z.infer<typeof StringLegacySchema>\n"],"mappings":";;AAEA,MAAa,qBAAqB,EAAE,KACnC,EAAE,OAAO,GACT,EAAE,WAAW,MAAc,EAAE,KAAK,CAAC,CACpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geopoint.js","names":[],"sources":["../../../src/content/legacy/geopoint.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nexport const GeoPointLegacySchema = z.object({\n\tposition: z.object({\n\t\tlat: z.number(),\n\t\tlng: z.number(),\n\t}),\n})\n\nexport type GeoPointLegacy = z.infer<typeof GeoPointLegacySchema>\n"],"mappings":";;AAEA,MAAa,uBAAuB,EAAE,OAAO,EAC5C,UAAU,EAAE,OAAO;CAClB,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"geopoint.js","names":[],"sources":["../../../src/content/legacy/geopoint.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nexport const GeoPointLegacySchema = z.object({\n\tposition: z.object({\n\t\tlat: z.number(),\n\t\tlng: z.number(),\n\t}),\n})\n\nexport type GeoPointLegacy = z.infer<typeof GeoPointLegacySchema>\n"],"mappings":";;AAEA,MAAa,uBAAuB,EAAE,OAAO,EAC5C,UAAU,EAAE,OAAO;CAClB,KAAK,EAAE,OAAO;CACd,KAAK,EAAE,OAAO;AACf,CAAC,EACF,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import "./nestable.js";
|
|
1
2
|
import { z } from "zod/mini";
|
|
2
|
-
|
|
3
3
|
//#region src/content/legacy/group.d.ts
|
|
4
4
|
declare const GroupItemLegacySchema: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>;
|
|
5
5
|
type GroupItemLegacy = z.infer<typeof GroupItemLegacySchema>;
|
|
6
6
|
type GroupLegacy = (GroupItemLegacy | null)[];
|
|
7
7
|
//#endregion
|
|
8
|
-
export { GroupLegacy };
|
|
8
|
+
export { GroupItemLegacy, GroupItemLegacySchema, GroupLegacy };
|
|
9
9
|
//# sourceMappingURL=group.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group.d.ts","names":[],"sources":["../../../src/content/legacy/group.ts"],"mappings":";;;cAOa,
|
|
1
|
+
{"version":3,"file":"group.d.ts","names":[],"sources":["../../../src/content/legacy/group.ts"],"mappings":";;;cAOa,uBAAqB,EAAA,cAAA,EAAA,uBAAA,EAAA;KAEtB,kBAAkB,EAAE,aAAa;KAMjC,eAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group.js","names":[],"sources":["../../../src/content/legacy/group.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport type { NestableLegacy } from \"./nestable\"\nimport { NestableLegacySchema } from \"./nestable\"\n\n// Keep item values raw here: array-shaped legacy payloads are ambiguous until\n// `codec/group.ts` resolves the field model and picks the right decoder.\nexport const GroupItemLegacySchema = z.record(z.string(), z.unknown())\n\nexport type GroupItemLegacy = z.infer<typeof GroupItemLegacySchema>\n\nexport const GroupLegacySchema: z.ZodMiniType<GroupLegacy> = z.array(\n\tz.union([GroupItemLegacySchema, z.null()]),\n)\n\nexport type GroupLegacy = (GroupItemLegacy | null)[]\n\nexport const NestableAndGroupLegacySchema: z.ZodMiniType<NestableAndGroupLegacy> = z.union([\n\tNestableLegacySchema,\n\tGroupLegacySchema,\n])\n\nexport type NestableAndGroupLegacy = NestableLegacy | GroupLegacy\n"],"mappings":";;;AAOA,MAAa,wBAAwB,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"group.js","names":[],"sources":["../../../src/content/legacy/group.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport type { NestableLegacy } from \"./nestable\"\nimport { NestableLegacySchema } from \"./nestable\"\n\n// Keep item values raw here: array-shaped legacy payloads are ambiguous until\n// `codec/group.ts` resolves the field model and picks the right decoder.\nexport const GroupItemLegacySchema = z.record(z.string(), z.unknown())\n\nexport type GroupItemLegacy = z.infer<typeof GroupItemLegacySchema>\n\nexport const GroupLegacySchema: z.ZodMiniType<GroupLegacy> = z.array(\n\tz.union([GroupItemLegacySchema, z.null()]),\n)\n\nexport type GroupLegacy = (GroupItemLegacy | null)[]\n\nexport const NestableAndGroupLegacySchema: z.ZodMiniType<NestableAndGroupLegacy> = z.union([\n\tNestableLegacySchema,\n\tGroupLegacySchema,\n])\n\nexport type NestableAndGroupLegacy = NestableLegacy | GroupLegacy\n"],"mappings":";;;AAOA,MAAa,wBAAwB,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC;AAIrE,MAAa,oBAAgD,EAAE,MAC9D,EAAE,MAAM,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAC,CAC1C;AAIA,MAAa,+BAAsE,EAAE,MAAM,CAC1F,sBACA,iBACD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.d.ts","names":[],"sources":["../../../src/content/legacy/image.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"image.d.ts","names":[],"sources":["../../../src/content/legacy/image.ts"],"mappings":";;cAyBa,uBAAqB,EAAA"}
|
|
@@ -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,
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integrationField.js","names":[],"sources":["../../../src/content/legacy/integrationField.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nexport const IntegrationFieldLegacySchema = z.string()\n\nexport type IntegrationFieldLegacy = z.infer<typeof IntegrationFieldLegacySchema>\n"],"mappings":";;AAEA,MAAa,+BAA+B,EAAE,
|
|
1
|
+
{"version":3,"file":"integrationField.js","names":[],"sources":["../../../src/content/legacy/integrationField.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nexport const IntegrationFieldLegacySchema = z.string()\n\nexport type IntegrationFieldLegacy = z.infer<typeof IntegrationFieldLegacySchema>\n"],"mappings":";;AAEA,MAAa,+BAA+B,EAAE,OAAO"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from "zod/mini";
|
|
2
|
-
|
|
3
2
|
//#region src/content/legacy/link.d.ts
|
|
4
3
|
declare const FilledImageLinkLegacyValueSchema: z.ZodMiniObject<{
|
|
5
4
|
kind: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<"image", string>>;
|
|
@@ -37,5 +36,5 @@ type FilledDocumentLinkLegacyValue = z.infer<typeof FilledDocumentLinkLegacyValu
|
|
|
37
36
|
type FilledExternalLinkLegacyValue = z.infer<typeof FilledExternalLinkLegacyValueSchema>;
|
|
38
37
|
type FilledLinkLegacyValue = FilledImageLinkLegacyValue | FilledFileLinkLegacyValue | FilledDocumentLinkLegacyValue | FilledExternalLinkLegacyValue;
|
|
39
38
|
//#endregion
|
|
40
|
-
export { FilledLinkLegacyValue };
|
|
39
|
+
export { FilledDocumentLinkLegacyValueSchema, FilledExternalLinkLegacyValueSchema, FilledFileLinkLegacyValueSchema, FilledImageLinkLegacyValueSchema, FilledLinkLegacyValue };
|
|
41
40
|
//# sourceMappingURL=link.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.d.ts","names":[],"sources":["../../../src/content/legacy/link.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"link.d.ts","names":[],"sources":["../../../src/content/legacy/link.ts"],"mappings":";;cAuBa,kCAAgC,EAAA;;;;;;;;;;cAoBhC,iCAA+B,EAAA;;;;;;;;cA0B/B,qCAAmC,EAAA;;;;cAenC,qCAAmC,EAAA;;;;;;;;KAkC3C,6BAA6B,EAAE,aAAa;KAC5C,4BAA4B,EAAE,aAAa;KAC3C,gCAAgC,EAAE,aAAa;KAC/C,gCAAgC,EAAE,aAAa;KACxC,wBACT,6BACA,4BACA,gCACA"}
|
|
@@ -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.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;
|
|
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.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":"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"}
|