@phtngyn/cms 0.1.0-beta.1 → 0.1.0-beta.2
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/README.md +192 -9
- package/package.json +30 -15
- package/src/Configuration-Br7tE9Qt.d.ts +68 -0
- package/src/{Configuration-DyKo0sLS.js → Configuration-CA_jvQKG.js} +26 -147
- package/src/Configuration-CA_jvQKG.js.map +1 -0
- package/src/Configuration.d.ts +2 -44
- package/src/Configuration.js +0 -1
- package/src/Configuration.js.map +1 -1
- package/src/{DocumentEngine-DYObwMDY.js → DocumentEngine-CgiBQU4g.js} +75 -27
- package/src/DocumentEngine-CgiBQU4g.js.map +1 -0
- package/src/DocumentModel-BB9igGC7.d.ts +34 -0
- package/src/DocumentModel.d.ts +2 -34
- package/src/DocumentModel.js +13 -3
- package/src/DocumentModel.js.map +1 -1
- package/src/Forms-BsJMev5_.d.ts +74 -0
- package/src/Forms-CfcI3tPU.js +79 -0
- package/src/Forms-CfcI3tPU.js.map +1 -0
- package/src/Forms-DxbkU3_5.js +367 -0
- package/src/Forms-DxbkU3_5.js.map +1 -0
- package/src/Forms.d.ts +35 -0
- package/src/Forms.js +13 -0
- package/src/Forms.js.map +1 -0
- package/src/{HttpPaths-BbS21Jy8.js → HttpPaths-c9nLZ9H2.js} +6 -2
- package/src/HttpPaths-c9nLZ9H2.js.map +1 -0
- package/src/I18n-DZK4CkJF.d.ts +21 -0
- package/src/I18n.d.ts +2 -0
- package/src/I18n.js +1 -0
- package/src/Module.js +57 -11
- package/src/Module.js.map +1 -1
- package/src/S3MediaObjects-JKMAWyVB.js +2664 -0
- package/src/S3MediaObjects-JKMAWyVB.js.map +1 -0
- package/src/Seed.d.ts +6 -0
- package/src/Seed.js +34 -0
- package/src/Seed.js.map +1 -0
- package/src/Seo-402YumpT.d.ts +198 -0
- package/src/{connection-CBTY-TzB.js → connection-B-iz0Y9Y.js} +5 -7
- package/src/connection-B-iz0Y9Y.js.map +1 -0
- package/src/{installation-DeuBiFRE.js → installation-DgF2M1gL.js} +1005 -2242
- package/src/installation-DgF2M1gL.js.map +1 -0
- package/src/internal/authoring-catalog.js +10 -4
- package/src/internal/authoring-catalog.js.map +1 -1
- package/src/internal/authoring-compiler.js +0 -1
- package/src/internal/authoring-compiler.js.map +1 -1
- package/src/internal/authoring-metadata.js +4 -4
- package/src/internal/authoring-metadata.js.map +1 -1
- package/src/internal/cms-config.js +0 -1
- package/src/internal/cms-config.js.map +1 -1
- package/src/internal/configuration.js +23 -10
- package/src/internal/configuration.js.map +1 -1
- package/src/internal/document-model.js +65 -20
- package/src/internal/document-model.js.map +1 -1
- package/src/internal/form-capabilities.js +12 -0
- package/src/internal/form-capabilities.js.map +1 -0
- package/src/internal/i18n.js +47 -0
- package/src/internal/i18n.js.map +1 -0
- package/src/internal/studio-app.js +2 -2
- package/src/internal/studio-app.js.map +1 -1
- package/src/{location-DtYv2aes.js → location-CFKTeK1K.js} +2 -3
- package/src/location-CFKTeK1K.js.map +1 -0
- package/src/{metadata-DE1Mc2td.js → metadata-BEZPWh-3.js} +3 -72
- package/src/metadata-BEZPWh-3.js.map +1 -0
- package/src/{models-C3witQBK.js → models-BWm1pTAf.js} +3 -2
- package/src/models-BWm1pTAf.js.map +1 -0
- package/src/{models-BkMgeaOL.js → models-DwYioyNV.js} +203 -32
- package/src/models-DwYioyNV.js.map +1 -0
- package/src/runtime/blocks.js +22 -9
- package/src/runtime/blocks.js.map +1 -1
- package/src/runtime/collaboration.js.map +1 -1
- package/src/runtime/delivery/DocumentRenderer.js +7 -4
- package/src/runtime/delivery/DocumentRenderer.js.map +1 -1
- package/src/runtime/delivery/blocks.js +3 -1
- package/src/runtime/delivery/blocks.js.map +1 -1
- package/src/runtime/delivery/context.js +1 -1
- package/src/runtime/delivery/document-page.js +12 -12
- package/src/runtime/delivery/document-page.js.map +1 -1
- package/src/runtime/delivery/document.js +4 -2
- package/src/runtime/delivery/document.js.map +1 -1
- package/src/runtime/delivery/error.js.map +1 -1
- package/src/runtime/delivery/plugin.js +22 -2
- package/src/runtime/delivery/plugin.js.map +1 -1
- package/src/runtime/delivery/types.d.ts +5 -0
- package/src/runtime/delivery/useCmsDocumentSeo.d.ts +56 -0
- package/src/runtime/delivery/useCmsDocumentSeo.js +99 -0
- package/src/runtime/delivery/useCmsDocumentSeo.js.map +1 -0
- package/src/runtime/delivery/useDocument.js +2 -2
- package/src/runtime/delivery/useDocument.js.map +1 -1
- package/src/runtime/delivery/useDocumentQuery.js +2 -2
- package/src/runtime/delivery/useDocumentQuery.js.map +1 -1
- package/src/runtime/forms/document.js +38 -0
- package/src/runtime/forms/document.js.map +1 -0
- package/src/runtime/forms/useCmsForm.js +149 -0
- package/src/runtime/forms/useCmsForm.js.map +1 -0
- package/src/runtime/i18n/translator.js +22 -0
- package/src/runtime/i18n/translator.js.map +1 -0
- package/src/runtime/i18n/useCmsI18n.d.ts +9 -0
- package/src/runtime/i18n/useCmsI18n.js +29 -0
- package/src/runtime/i18n/useCmsI18n.js.map +1 -0
- package/src/runtime/installation.js +1 -1
- package/src/runtime/plugin.js +1 -1
- package/src/runtime/plugin.js.map +1 -1
- package/src/runtime/preview/comark-document.js +0 -1
- package/src/runtime/preview/comark-document.js.map +1 -1
- package/src/runtime/preview/connection.js +1 -1
- package/src/runtime/preview/controller.js +10 -3
- package/src/runtime/preview/controller.js.map +1 -1
- package/src/runtime/preview/overlay.js.map +1 -1
- package/src/runtime/preview/plugin.client.js +59 -48
- package/src/runtime/preview/plugin.client.js.map +1 -1
- package/src/runtime/preview/protocol.js.map +1 -1
- package/src/runtime/preview/store.js +1 -1
- package/src/runtime/preview/targets.js +0 -1
- package/src/runtime/preview/targets.js.map +1 -1
- package/src/runtime/sitemap-entries.js +17 -0
- package/src/runtime/sitemap-entries.js.map +1 -0
- package/src/runtime/sitemap.js +24 -0
- package/src/runtime/sitemap.js.map +1 -0
- package/src/runtime/studio-app.js.map +1 -1
- package/src/runtime/studio-entry.js +2 -2
- package/src/runtime/studio-entry.js.map +1 -1
- package/src/runtime/studio-navigation.js +1 -1
- package/src/scalars-B2lgGUnj.js +26 -0
- package/src/scalars-B2lgGUnj.js.map +1 -0
- package/src/{store-CfFFx9Ua.js → store-DjJs3I7k.js} +12 -7
- package/src/store-DjJs3I7k.js.map +1 -0
- package/studio/{CreateDocumentDialog--L9lTfx6.js → CreateDocumentDialog-CTeIFlPb.js} +44 -44
- package/studio/{collaboration-DUuu678R.js → collaboration-DcK2F6v9.js} +7 -6
- package/studio/{documentPlanning-BXX04Woe.js → documentPlanning-Bfv-d7OU.js} +7310 -6479
- package/studio/{editor-PexnXkJY.js → editor-Bzlh3zXt.js} +7965 -7955
- package/studio/host.css +1 -1
- package/studio/host.js +10416 -7981
- package/src/Configuration-DyKo0sLS.js.map +0 -1
- package/src/DocumentEngine-DYObwMDY.js.map +0 -1
- package/src/HttpPaths-BbS21Jy8.js.map +0 -1
- package/src/StudioHttp-jR2-bc01.js +0 -718
- package/src/StudioHttp-jR2-bc01.js.map +0 -1
- package/src/connection-CBTY-TzB.js.map +0 -1
- package/src/installation-DeuBiFRE.js.map +0 -1
- package/src/location-DtYv2aes.js.map +0 -1
- package/src/metadata-DE1Mc2td.js.map +0 -1
- package/src/models-BkMgeaOL.js.map +0 -1
- package/src/models-C3witQBK.js.map +0 -1
- package/src/store-CfFFx9Ua.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Configuration-DyKo0sLS.js","names":["isJsonObject","jsonObject","CmsMarkdownDocumentSchema","isJsonObject","jsonObject","comarkToEditor","isJsonObject","isElementNode","textContent"],"sources":["../../../../document/src/internal/comark/bindings.ts","../../../../document/src/internal/editor/attributes.ts","../../../../document/src/internal/editor/image.ts","../../../../document/src/internal/editor/marks.ts","../../../../document/src/internal/comark/to-editor.ts","../../../../document/src/internal/comark/source-mapping.ts","../../../../document/src/internal/comark/grammar.ts","../../../../document/src/internal/editor/errors.ts","../../../../document/src/AuthoringSchema.ts","../../../../protocol/src/Authoring.ts","../../../../protocol/src/Configuration.ts"],"sourcesContent":["import type { ComponentDefinition } from '@internal/protocol/Configuration'\nimport type { CmsMarkdownDocument, MarkdownNode } from '@internal/protocol/Documents'\nimport type { NodeRenderData } from 'comark'\nimport { CmsMarkdownDocument as CmsMarkdownDocumentSchema } from '@internal/protocol/Documents'\nimport { resolveAttributes } from 'comark/utils'\nimport { Option, Predicate, Schema } from 'effect'\nimport { mutableJson, mutableJsonObject, toMutableComarkAttributes } from './document-adapter'\n\nconst isJsonObject = Schema.is(Schema.JsonObject)\nconst decodeJson = Schema.decodeUnknownOption(Schema.Json)\n\nexport type CmsComarkAttributeValue = Schema.Json | undefined\nexport type CmsComarkAttributes = ReadonlyMap<string, CmsComarkAttributeValue>\n\ninterface CmsEditorComponentProjection {\n readonly bindings: Schema.JsonObject\n readonly props: Schema.JsonObject\n readonly renderData: NodeRenderData\n}\n\n/** Normalizes bindings exactly as Comark's framework renderers do before passing props to a component. */\nexport function resolveCmsComarkAttributes(\n attributes: Schema.JsonObject,\n renderData: NodeRenderData,\n): CmsComarkAttributes {\n const resolved = new Map<string, CmsComarkAttributeValue>()\n for (const [name, value] of Object.entries(\n resolveAttributes(toMutableComarkAttributes(attributes), renderData, { parseJson: true }),\n )) {\n if (Predicate.isUndefined(value)) {\n resolved.set(name, undefined)\n continue\n }\n const decoded = decodeJson(value)\n if (Option.isNone(decoded)) throw new Error(`Comark resolved non-JSON attribute \"${name}\".`)\n resolved.set(name, decoded.value)\n }\n return resolved\n}\n\n/** Projects bindings to editable values while retaining enough metadata to reconstruct their authored form. */\nexport function projectCmsEditorComponentAttributes(\n attributes: Schema.JsonObject,\n renderData: NodeRenderData,\n): CmsEditorComponentProjection {\n const resolved = resolveCmsComarkAttributes(attributes, renderData)\n const props: Record<string, Schema.Json> = {}\n for (const [name, value] of resolved) {\n if (!Predicate.isUndefined(value)) props[name] = mutableJson(value)\n }\n\n const bindings: Record<string, Schema.Json> = {}\n for (const [authoredName, authoredValue] of Object.entries(attributes)) {\n if (!authoredName.startsWith(':') || authoredName.length === 1) continue\n const name = authoredName.slice(1)\n if (!resolved.has(name)) continue\n const literal = jsonLiteral(authoredValue)\n if (!Predicate.isString(authoredValue) || literal !== authoredValue) {\n bindings[name] = { kind: 'literal' }\n continue\n }\n const resolvedValue = resolved.get(name)\n bindings[name] = Object.assign(\n { expression: authoredValue, kind: 'expression' },\n Predicate.isUndefined(resolvedValue) ? undefined : { resolved: mutableJson(resolvedValue) },\n )\n }\n\n return { bindings, props, renderData: withCmsComarkProps(renderData, resolved) }\n}\n\n/** Reconstructs authored bindings, keeping expressions until a user replaces their resolved value. */\nexport function encodeCmsEditorComponentAttributes(\n props: Schema.JsonObject,\n bindings: Schema.JsonObject,\n): Schema.JsonObject {\n const attributes = mutableJsonObject(props)\n for (const [name, encodedBinding] of Object.entries(bindings)) {\n const binding = jsonObject(encodedBinding)\n const kind = binding.kind\n if (kind !== 'literal' && kind !== 'expression') continue\n const current = props[name]\n if (Predicate.isUndefined(current)) {\n const expression = binding.expression\n if (kind === 'expression' && Predicate.isString(expression)) attributes[`:${name}`] = expression\n continue\n }\n\n delete attributes[name]\n const expression = binding.expression\n const resolved = binding.resolved\n attributes[`:${name}`] =\n kind === 'expression' &&\n Predicate.isString(expression) &&\n Object.hasOwn(binding, 'resolved') &&\n sameJson(current, resolved)\n ? expression\n : mutableJson(current)\n }\n return attributes\n}\n\nexport function withCmsComarkProps(renderData: NodeRenderData, attributes: CmsComarkAttributes): NodeRenderData {\n return attributes.size > 0 ? { ...renderData, props: Object.fromEntries(attributes) } : renderData\n}\n\n/** Restores typed component bindings that Comark's block-YAML roundtrip can emit as plain attributes. */\nexport function normalizeCmsComponentBindings(\n document: CmsMarkdownDocument,\n components: ReadonlyMap<string, ComponentDefinition> | undefined,\n): CmsMarkdownDocument {\n if (!components) return document\n return CmsMarkdownDocumentSchema.make({\n frontmatter: document.frontmatter,\n meta: document.meta,\n nodes: document.nodes.map((node) => normalizeComponentNode(node, components)),\n })\n}\n\nexport function matchesCmsComponentPropType(\n value: CmsComarkAttributeValue,\n type: ComponentDefinition['authoring']['props'][number]['type'],\n): boolean {\n switch (type) {\n case 'object':\n return isJsonObject(value)\n case 'array':\n return Array.isArray(value)\n case 'boolean':\n return Predicate.isBoolean(value)\n case 'number':\n return Predicate.isNumber(value)\n case 'string':\n return Predicate.isString(value)\n }\n}\n\nfunction normalizeComponentNode(\n node: MarkdownNode,\n components: ReadonlyMap<string, ComponentDefinition>,\n): MarkdownNode {\n if (Predicate.isString(node) || node[0] === null) return node\n const [tag, originalAttributes, ...originalChildren] = node\n const attributes = mutableJsonObject(originalAttributes)\n const definition = components.get(tag.toLocaleLowerCase())\n if (definition) {\n for (const prop of definition.authoring.props) {\n if (prop.type === 'string' || `:${prop.name}` in attributes || !(prop.name in attributes)) continue\n const value = attributes[prop.name]\n if (Predicate.isUndefined(value)) continue\n const resolved = jsonLiteral(value)\n if (!matchesCmsComponentPropType(resolved, prop.type)) continue\n delete attributes[prop.name]\n attributes[`:${prop.name}`] = value\n }\n }\n return [tag, attributes, ...originalChildren.map((child) => normalizeComponentNode(child, components))]\n}\n\nfunction jsonLiteral(value: Schema.Json | undefined): CmsComarkAttributeValue {\n if (!Predicate.isString(value)) return value\n try {\n const decoded = decodeJson(JSON.parse(value))\n return Option.isSome(decoded) ? decoded.value : value\n } catch {\n return value\n }\n}\n\nfunction jsonObject(value: Schema.Json | undefined): Schema.JsonObject {\n return isJsonObject(value) ? value : {}\n}\n\nfunction sameJson(left: Schema.Json, right: Schema.Json | undefined): boolean {\n return !Predicate.isUndefined(right) && JSON.stringify(left) === JSON.stringify(right)\n}\n","import { Predicate, Schema } from 'effect'\n\nexport function compactJsonAttributes(\n attributes: Readonly<Record<string, Schema.Json | undefined>>,\n): Schema.JsonObject {\n return Object.fromEntries(\n Object.entries(attributes).filter((entry): entry is [string, Schema.Json] => entry[1] !== undefined),\n )\n}\n\nexport function nonEmptyStringAttribute(value: Schema.Json | undefined): string | undefined {\n return Predicate.isString(value) && value ? value : undefined\n}\n\nexport function finiteNumberAttribute(value: Schema.Json | undefined, fallback: number): number {\n const number = Predicate.isNumber(value) ? value : Number(value)\n return Number.isFinite(number) ? number : fallback\n}\n","import { Predicate, Schema } from 'effect'\nimport { compactJsonAttributes } from './attributes'\n\nconst isJsonObject = Schema.is(Schema.JsonObject)\n\nconst EDITOR_IMAGE_LAYOUTS = ['natural', 'content', 'full'] as const\nexport type EditorImageLayout = (typeof EDITOR_IMAGE_LAYOUTS)[number]\n\nconst EditorImageLayout = Schema.Literals(EDITOR_IMAGE_LAYOUTS)\nconst isEditorImageLayout = Schema.is(EditorImageLayout)\n\nexport const EDITOR_IMAGE_LAYOUT_ATTRIBUTE = 'data-cms-layout'\nconst IMAGE_DECORATIVE_ATTRIBUTE = 'data-cms-decorative'\nconst IMAGE_SEMANTIC_ATTRIBUTES = new Set([\n 'alt',\n IMAGE_DECORATIVE_ATTRIBUTE,\n EDITOR_IMAGE_LAYOUT_ATTRIBUTE,\n 'src',\n 'title',\n])\n\nexport function decodeEditorImageAttributes(attributes: Schema.JsonObject): Schema.JsonObject {\n const cmsProps = Object.fromEntries(\n Object.entries(attributes).filter(([name]) => !IMAGE_SEMANTIC_ATTRIBUTES.has(name)),\n )\n return compactJsonAttributes({\n alt:\n attributes[IMAGE_DECORATIVE_ATTRIBUTE] !== undefined\n ? ''\n : Predicate.isString(attributes.alt)\n ? attributes.alt\n : null,\n cmsProps: Object.keys(cmsProps).length ? cmsProps : null,\n layout: normalizeEditorImageLayout(attributes[EDITOR_IMAGE_LAYOUT_ATTRIBUTE]),\n src: stringValue(attributes.src) || null,\n title: stringValue(attributes.title) || null,\n })\n}\n\nexport function encodeEditorImageAttributes(value: Schema.JsonObject | undefined): Schema.JsonObject {\n const attributes = jsonObject(value)\n const alt = attributes.alt\n const layout = normalizeEditorImageLayout(attributes.layout)\n return compactJsonAttributes(\n Object.assign({}, jsonObject(attributes.cmsProps), {\n alt: Predicate.isString(alt) ? alt : undefined,\n [IMAGE_DECORATIVE_ATTRIBUTE]: alt === '' ? 'true' : undefined,\n [EDITOR_IMAGE_LAYOUT_ATTRIBUTE]: layout === 'natural' ? undefined : layout,\n src: stringValue(attributes.src) || undefined,\n title: stringValue(attributes.title) || undefined,\n }),\n )\n}\n\nexport function normalizeEditorImageLayout(value: Schema.Json | undefined): EditorImageLayout {\n return isEditorImageLayout(value) ? value : 'natural'\n}\n\nfunction jsonObject(value: Schema.Json | undefined): Schema.JsonObject {\n return isJsonObject(value) ? value : {}\n}\n\nfunction stringValue(value: Schema.Json | undefined): string {\n return Predicate.isString(value) || Predicate.isNumber(value) ? String(value) : ''\n}\n","const EDITOR_MARKS = [\n ['bold', 'strong'],\n ['code', 'code'],\n ['italic', 'em'],\n ['link', 'a'],\n ['strike', 'del'],\n ['underline', 'u'],\n] as const\n\nexport const EDITOR_MARK_TYPES = EDITOR_MARKS.map(([type]) => type)\n\nconst editorToComark = new Map<string, string>(EDITOR_MARKS)\nconst comarkToEditor = new Map<string, string>(EDITOR_MARKS.map(([type, tag]) => [tag, type]))\n\nexport function comarkTagForEditorMark(type: string): string | undefined {\n return editorToComark.get(type)\n}\n\nexport function editorMarkForComarkTag(tag: string): string | undefined {\n return comarkToEditor.get(tag)\n}\n\nexport function isEditorMark(type: string): boolean {\n return editorToComark.has(type)\n}\n\nexport function isComarkMark(tag: string): boolean {\n return comarkToEditor.has(tag)\n}\n","import type { MarkdownNode } from '@internal/protocol/Documents'\nimport type { EditorNodeId } from '@internal/protocol/Documents'\nimport type { JSONContent } from '@tiptap/core'\nimport type { NodeRenderData } from 'comark'\nimport { Predicate, Schema } from 'effect'\nimport { projectCmsEditorComponentAttributes, resolveCmsComarkAttributes, withCmsComarkProps } from './bindings'\nimport { editorNodeId, createEditorNodeId } from '../editor/identity'\nimport { decodeEditorImageAttributes } from '../editor/image'\nimport { editorMetadata } from '../editor/metadata'\nimport { compactJsonAttributes, finiteNumberAttribute, nonEmptyStringAttribute } from '../editor/attributes'\nimport { editorMarkForComarkTag, isComarkMark } from '../editor/marks'\n\nconst isJsonObject = Schema.is(Schema.JsonObject)\n\ntype ElementMarkdownNode = Extract<MarkdownNode, readonly [string, Schema.JsonObject, ...MarkdownNode[]]>\n\ninterface DecodeContext {\n readonly usedIds: Set<EditorNodeId>\n}\n\nconst OPAQUE_BLOCK_TAGS = new Set(['math', 'table', 'tbody', 'td', 'th', 'thead', 'tr'])\n\nexport function comarkToEditor(\n nodes: ReadonlyArray<MarkdownNode>,\n renderData: NodeRenderData = { data: {}, frontmatter: {}, meta: {}, props: {} },\n): JSONContent[] {\n return decodeBlocks(\n nodes,\n {\n usedIds: new Set(),\n },\n renderData,\n )\n}\n\nfunction decodeBlocks(\n nodes: ReadonlyArray<MarkdownNode>,\n context: DecodeContext,\n renderData: NodeRenderData,\n wrapInlineContent = false,\n): JSONContent[] {\n const content: JSONContent[] = []\n let inlineNodes: MarkdownNode[] = []\n\n const flushInlineNodes = () => {\n const inline = decodeInlines(inlineNodes, context, renderData)\n if (inline.length) {\n content.push({\n type: 'paragraph',\n attrs: wrapInlineContent ? { cmsSynthetic: true } : { cmsNodeId: claimIdentity(context) },\n content: inline,\n })\n }\n inlineNodes = []\n }\n\n for (const node of nodes) {\n if (Predicate.isString(node) || isInlineElement(node)) {\n inlineNodes.push(node)\n continue\n }\n flushInlineNodes()\n content.push(decodeBlock(node, context, renderData))\n }\n flushInlineNodes()\n return content\n}\n\nfunction decodeBlock(\n node: Exclude<MarkdownNode, string>,\n context: DecodeContext,\n renderData: NodeRenderData,\n): JSONContent {\n if (node[0] === null) {\n return opaqueBlock(node, 'Comment', claimIdentity(context, node[1]))\n }\n\n const [tag, rawAttributes, ...children] = node\n const attrs = cleanAttrs(rawAttributes)\n const childRenderData = withCmsComarkProps(renderData, resolveCmsComarkAttributes(rawAttributes, renderData))\n const metadata = editorMetadata(rawAttributes)\n const cmsNodeId = claimIdentity(context, rawAttributes)\n const commonAttrs = compactJsonAttributes({\n cmsNodeId,\n cmsProps: attrs,\n })\n\n if (/^h[1-6]$/u.test(tag)) {\n return {\n type: 'heading',\n attrs: mergeJsonAttributes(commonAttrs, { level: Number(tag.slice(1)) }),\n content: decodeInlines(children, context, childRenderData),\n }\n }\n\n switch (tag) {\n case 'p':\n return { type: 'paragraph', attrs: commonAttrs, content: decodeInlines(children, context, childRenderData) }\n case 'blockquote':\n return {\n type: 'blockquote',\n attrs: commonAttrs,\n content: decodeBlocks(children, context, childRenderData),\n }\n case 'ul':\n return {\n type: 'bulletList',\n attrs: commonAttrs,\n content: decodeListItems(children, context, childRenderData),\n }\n case 'ol':\n return {\n type: 'orderedList',\n attrs: mergeJsonAttributes(commonAttrs, { start: finiteNumberAttribute(attrs.start, 1) }),\n content: decodeListItems(children, context, childRenderData),\n }\n case 'li':\n return {\n type: 'listItem',\n attrs: commonAttrs,\n content: decodeBlocks(children, context, childRenderData),\n }\n case 'pre': {\n const code = children.find(isElementNode)\n const language =\n nonEmptyStringAttribute(attrs.language) ?? nonEmptyStringAttribute(code?.[1].class)?.replace(/^language-/u, '')\n return {\n type: 'codeBlock',\n attrs: mergeJsonAttributes(commonAttrs, { language }),\n content: textContent(code ? elementChildren(code) : children),\n }\n }\n case 'hr':\n return { type: 'horizontalRule', attrs: commonAttrs }\n default:\n if (OPAQUE_BLOCK_TAGS.has(tag)) return opaqueBlock(node, tag, cmsNodeId)\n const projection = projectCmsEditorComponentAttributes(rawAttributes, renderData)\n return {\n type: 'cmsBlock',\n attrs: compactJsonAttributes({\n bindings: projection.bindings,\n cmsNodeId,\n props: projection.props,\n tag,\n }),\n content: decodeComponentSlots(children, context, projection.renderData, metadata?.implicitSlotId),\n }\n }\n}\n\nfunction decodeComponentSlots(\n children: ReadonlyArray<MarkdownNode>,\n context: DecodeContext,\n renderData: NodeRenderData,\n implicitSlotId?: EditorNodeId,\n): JSONContent[] {\n const templates = children.filter(isSlotTemplate)\n const regular = children.filter((node) => !isSlotTemplate(node))\n const slots = templates.map((node) => decodeSlot(node, context, renderData))\n if (!regular.length) return slots\n\n const defaultContent = slotContent(decodeBlocks(regular, context, renderData, true))\n const explicitDefault = slots.find((slot) => slot.attrs?.name === 'default')\n if (explicitDefault) {\n explicitDefault.content = [...(explicitDefault.content ?? []), ...defaultContent]\n return slots\n }\n\n return [\n {\n type: 'cmsSlot',\n attrs: {\n cmsNodeId: claimIdentityValue(context, implicitSlotId),\n implicit: true,\n name: 'default',\n props: {},\n },\n content: defaultContent,\n },\n ...slots,\n ]\n}\n\nfunction decodeSlot(node: ElementMarkdownNode, context: DecodeContext, renderData: NodeRenderData): JSONContent {\n const attrs = cleanAttrs(node[1])\n const childRenderData = withCmsComarkProps(renderData, resolveCmsComarkAttributes(node[1], renderData))\n const name = slotName(attrs)\n const { name: _name, ...slotProps } = attrs\n return {\n type: 'cmsSlot',\n attrs: {\n cmsNodeId: claimIdentity(context, node[1]),\n implicit: false,\n name,\n props: slotProps,\n },\n content: slotContent(decodeBlocks(elementChildren(node), context, childRenderData, true)),\n }\n}\n\nfunction decodeListItems(\n nodes: ReadonlyArray<MarkdownNode>,\n context: DecodeContext,\n renderData: NodeRenderData,\n): JSONContent[] {\n return nodes\n .filter(isElementNode)\n .filter((node) => node[0] === 'li')\n .map((node) => decodeBlock(node, context, renderData))\n}\n\nfunction decodeInlines(\n nodes: ReadonlyArray<MarkdownNode>,\n context: DecodeContext,\n renderData: NodeRenderData,\n inheritedMarks: NonNullable<JSONContent['marks']> = [],\n): JSONContent[] {\n const result: JSONContent[] = []\n for (const node of nodes) {\n if (Predicate.isString(node)) {\n if (node) {\n result.push(withMarks({ type: 'text', text: node }, inheritedMarks))\n }\n continue\n }\n if (node[0] === null) {\n result.push(\n withMarks(\n {\n type: 'cmsInlineOpaque',\n attrs: { label: 'Comment', node: stripInternalMetadata(node) },\n },\n inheritedMarks,\n ),\n )\n continue\n }\n\n const markType = editorMarkForComarkTag(node[0])\n if (markType) {\n const attrs = cleanAttrs(node[1])\n const childRenderData = withCmsComarkProps(renderData, resolveCmsComarkAttributes(node[1], renderData))\n const markAttrs =\n markType === 'link'\n ? mergeJsonAttributes(attrs, { cmsProps: attrs })\n : Object.keys(attrs).length\n ? { cmsProps: attrs }\n : undefined\n const mark = markAttrs === undefined ? { type: markType } : { attrs: markAttrs, type: markType }\n result.push(...decodeInlines(elementChildren(node), context, childRenderData, [...inheritedMarks, mark]))\n continue\n }\n\n if (node[0] === 'br') {\n result.push(withMarks({ type: 'hardBreak' }, inheritedMarks))\n continue\n }\n if (node[0] === 'img') {\n result.push(\n withMarks(\n {\n type: 'image',\n attrs: mergeJsonAttributes(decodeEditorImageAttributes(cleanAttrs(node[1])), {\n cmsNodeId: claimIdentity(context, node[1]),\n }),\n },\n inheritedMarks,\n ),\n )\n continue\n }\n\n result.push(\n withMarks(\n {\n type: 'cmsInlineOpaque',\n attrs: {\n label: node[0],\n node: stripInternalMetadata(node),\n },\n },\n inheritedMarks,\n ),\n )\n }\n return result\n}\n\nfunction claimIdentity(context: DecodeContext, attributes?: Schema.JsonObject): EditorNodeId {\n return claimIdentityValue(context, attributes ? editorMetadata(attributes)?.nodeId : undefined)\n}\n\nfunction claimIdentityValue(context: DecodeContext, candidate?: Schema.Json): EditorNodeId {\n const existing = editorNodeId(candidate)\n if (existing !== undefined && !context.usedIds.has(existing)) {\n context.usedIds.add(existing)\n return existing\n }\n for (let attempt = 0; attempt < 100; attempt++) {\n const created = createEditorNodeId()\n if (!context.usedIds.has(created)) {\n context.usedIds.add(created)\n return created\n }\n }\n throw new Error('The editor identity factory did not produce a unique identity.')\n}\n\nfunction opaqueBlock(node: Exclude<MarkdownNode, string>, label: string, cmsNodeId: EditorNodeId): JSONContent {\n return {\n type: 'cmsOpaque',\n attrs: {\n cmsNodeId,\n label,\n node: stripInternalMetadata(node),\n },\n }\n}\n\nfunction stripInternalMetadata(node: Exclude<MarkdownNode, string>): Exclude<MarkdownNode, string> {\n if (node[0] === null) return [null, cleanAttrs(node[1]), node[2]]\n const [tag, attributes, ...children] = node\n const clean = cleanAttrs(attributes)\n return [tag, clean, ...children.map((child) => (Predicate.isString(child) ? child : stripInternalMetadata(child)))]\n}\n\nfunction slotContent(content: JSONContent[]): JSONContent[] {\n return content.length ? content : [{ type: 'paragraph', attrs: { cmsSynthetic: true } }]\n}\n\nfunction slotName(attrs: Schema.JsonObject): string {\n return nonEmptyStringAttribute(attrs.name) ?? 'default'\n}\n\nfunction cleanAttrs(attrs: Schema.JsonObject): Schema.JsonObject {\n const { $: _internal, 'data-cms-node': _marker, ...clean } = attrs\n return structuredClone(clean)\n}\n\nfunction textContent(nodes: ReadonlyArray<MarkdownNode>): JSONContent[] | undefined {\n const text = nodes\n .map((node) =>\n Predicate.isString(node)\n ? node\n : node[0] === null\n ? node[2]\n : (textContent(elementChildren(node))\n ?.map((child) => child.text ?? '')\n .join('') ?? ''),\n )\n .join('')\n return text ? [{ type: 'text', text }] : undefined\n}\n\nfunction isInlineElement(node: Exclude<MarkdownNode, string>): boolean {\n return (\n node[0] !== null &&\n (isComarkMark(node[0]) || node[0] === 'br' || node[0] === 'img' || jsonObject(node[1].$).block === 0)\n )\n}\n\nfunction isSlotTemplate(node: MarkdownNode): node is ElementMarkdownNode {\n return isElementNode(node) && node[0] === 'template'\n}\n\nfunction isElementNode(node: MarkdownNode | undefined): node is ElementMarkdownNode {\n return Array.isArray(node) && Predicate.isString(node[0])\n}\n\nfunction elementChildren(node: ElementMarkdownNode): MarkdownNode[] {\n const [, , ...children] = node\n return children\n}\n\nfunction jsonObject(value: Schema.Json | undefined): Schema.JsonObject {\n return isJsonObject(value) ? value : {}\n}\n\nfunction mergeJsonAttributes(\n attributes: Schema.JsonObject,\n additions: Readonly<Record<string, Schema.Json | undefined>>,\n): Schema.JsonObject {\n return compactJsonAttributes(Object.assign({}, attributes, additions))\n}\n\nfunction withMarks(content: JSONContent, marks: NonNullable<JSONContent['marks']>): JSONContent {\n return marks.length ? Object.assign({}, content, { marks }) : content\n}\n","import type { DocumentSourceMapping, DocumentSourcePoint, DocumentSourceRange } from '@internal/protocol/Documents'\nimport type { ComarkParsePostState, ComarkParsePreState, ComarkPlugin, ElementNode, Node } from 'comark'\nimport { Predicate, Schema } from 'effect'\n\nexport const SOURCE_MAPPINGS_META_KEY = '__cmsSourceMappings'\n\ninterface SourceMapParseState {\n __cmsOriginalMarkdown?: string\n parsedLines?: number\n}\n\ninterface ComarkToken extends Schema.Schema.Type<typeof ComarkToken> {}\n\ninterface BlockDescriptor {\n readonly children: BlockDescriptor[]\n range: DocumentSourceRange\n readonly tag: string\n}\n\nconst BLOCK_TAGS = new Map([\n ['blockquote_open', 'blockquote'],\n ['bullet_list_open', 'ul'],\n ['list_item_open', 'li'],\n ['ordered_list_open', 'ol'],\n ['paragraph_open', 'p'],\n ['table_open', 'table'],\n ['tbody_open', 'tbody'],\n ['td_open', 'td'],\n ['th_open', 'th'],\n ['thead_open', 'thead'],\n ['tr_open', 'tr'],\n])\n\nconst ComarkToken = Schema.Struct({\n attrs: Schema.optionalKey(Schema.NullOr(Schema.Array(Schema.Tuple([Schema.String, Schema.String])))),\n hidden: Schema.optionalKey(Schema.Boolean),\n level: Schema.optionalKey(Schema.Finite),\n map: Schema.optionalKey(Schema.NullOr(Schema.Tuple([Schema.Finite, Schema.Finite]))),\n nesting: Schema.optionalKey(Schema.Finite),\n tag: Schema.optionalKey(Schema.String),\n type: Schema.optionalKey(Schema.String),\n})\n\nconst WRAPPER_TAGS = new Set(['blockquote', 'ol', 'pre', 'table', 'ul'])\n\n/** Captures the durable source before frontmatter or other pre-parse stages mutate it. */\nexport function sourceCapturePlugin(): ComarkPlugin {\n return {\n name: 'cms-source-capture',\n pre(state: ComarkParsePreState & SourceMapParseState) {\n state.__cmsOriginalMarkdown = state.markdown\n },\n }\n}\n\n/** Translate Comark block token line maps into exact JavaScript source offsets. */\nexport function sourceMappingPlugin(): ComarkPlugin {\n return {\n name: 'cms-source-mapping',\n post(state: ComarkParsePostState & SourceMapParseState) {\n const source = state.__cmsOriginalMarkdown ?? state.markdown\n const descriptors = createBlockDescriptors(\n state.tokens.flatMap((token) => {\n const decoded = Schema.decodeUnknownOption(ComarkToken)(token)\n return decoded._tag === 'Some' ? [decoded.value] : []\n }),\n source,\n state.markdown,\n state.parsedLines ?? 0,\n )\n const mappings: DocumentSourceMapping[] = []\n mapNodes(state.tree.nodes, descriptors, [], mappings)\n state.tree.meta[SOURCE_MAPPINGS_META_KEY] = mappings\n },\n }\n}\n\nfunction createBlockDescriptors(\n tokens: ReadonlyArray<ComarkToken>,\n source: string,\n parsedMarkdown: string,\n parsedLines: number,\n): BlockDescriptor[] {\n const roots: BlockDescriptor[] = []\n const stack: Array<{ descriptor: BlockDescriptor; level: number }> = []\n const sourceLineStarts = indexLineStarts(source)\n const parsedLineStarts = indexLineStarts(parsedMarkdown)\n const parsedOffset = source.lastIndexOf(parsedMarkdown)\n const slotMaps = createSlotTokenMaps(tokens, parsedMarkdown)\n\n for (let tokenIndex = 0; tokenIndex < tokens.length; tokenIndex++) {\n const token = tokens[tokenIndex]\n if (!token) continue\n const tag = blockTag(token)\n const tokenMap = token.map ?? slotMaps.get(tokenIndex)\n if (!tag || !tokenMap) continue\n\n const level = token.level ?? 0\n while (true) {\n const current = stack.at(-1)\n if (!current || current.level < level) break\n stack.pop()\n }\n\n const descriptor: BlockDescriptor = {\n children: [],\n range: rangeFromParsedLines(\n source,\n sourceLineStarts,\n parsedMarkdown,\n parsedLineStarts,\n parsedOffset,\n tokenMap[0],\n tokenMap[1] + (token.type === 'mdc_block_open' ? 1 : 0),\n parsedLines,\n ),\n tag,\n }\n const parent = stack.at(-1)?.descriptor\n ;(parent?.children ?? roots).push(descriptor)\n if (token.nesting === 1) stack.push({ descriptor, level })\n }\n\n return roots.map(collapseComarkWrapper).map(groupProjectedSlotContent)\n}\n\nfunction blockTag(token: ComarkToken): string | undefined {\n if (token.hidden || !token.type) return undefined\n if (token.type === 'heading_open') return token.tag\n if (token.type === 'mdc_block_open' || (token.type === 'mdc_block_shorthand' && token.nesting !== -1))\n return token.tag || 'component'\n if (token.type === 'mdc_block_slot' && token.nesting === 1) return 'template'\n if (['fence', 'fenced_code_block', 'code_block'].includes(token.type)) return 'pre'\n if (token.type === 'math_block') return 'math'\n if (token.type === 'html_block') return '*'\n if (token.type === 'hr') return 'hr'\n return BLOCK_TAGS.get(token.type)\n}\n\nfunction createSlotTokenMaps(\n tokens: ReadonlyArray<ComarkToken>,\n parsedMarkdown: string,\n): Map<number, [number, number]> {\n const maps = new Map<number, [number, number]>()\n const markers = slotMarkers(parsedMarkdown)\n const stack: Array<{ index: number; marker: number }> = []\n let nextMarker = 0\n\n for (let index = 0; index < tokens.length; index++) {\n const token = tokens[index]\n if (!token || token.type !== 'mdc_block_slot') continue\n\n if (token.nesting === 1) {\n const name = token.attrs?.[0]?.[0]?.replace(/^#/u, '')\n let markerIndex = nextMarker\n while (markerIndex < markers.length && markers[markerIndex]?.name !== name) markerIndex++\n const marker = markers[markerIndex]\n if (marker) {\n stack.push({ index, marker: marker.line })\n nextMarker = markerIndex + 1\n }\n continue\n }\n\n if (token.nesting !== -1) continue\n const open = stack.pop()\n if (!open) continue\n let endLine = open.marker + 1\n for (let childIndex = open.index + 1; childIndex < index; childIndex++) {\n const child = tokens[childIndex]\n const map = child?.map ?? maps.get(childIndex)\n if (child && map) {\n endLine = Math.max(endLine, map[1] + (child.type === 'mdc_block_open' ? 1 : 0))\n }\n }\n maps.set(open.index, [open.marker, endLine])\n }\n return maps\n}\n\nfunction slotMarkers(source: string): Array<{ line: number; name: string }> {\n return source.split(/\\r?\\n/u).flatMap((line, index) => {\n const name = line.match(/^\\s*#([^\\s{]+)/u)?.[1]\n return name ? [{ line: index, name }] : []\n })\n}\n\nfunction collapseComarkWrapper(descriptor: BlockDescriptor): BlockDescriptor {\n const children = descriptor.children.map(collapseComarkWrapper)\n if (WRAPPER_TAGS.has(descriptor.tag) && children.length === 1 && children[0]?.tag === descriptor.tag) {\n return { ...descriptor, children: children[0].children }\n }\n return { ...descriptor, children }\n}\n\n/** Comark projects siblings after a named slot into that active slot. */\nfunction groupProjectedSlotContent(descriptor: BlockDescriptor): BlockDescriptor {\n const grouped: BlockDescriptor[] = []\n let activeSlot: BlockDescriptor | undefined\n\n for (const rawChild of descriptor.children) {\n const child = groupProjectedSlotContent(rawChild)\n if (child.tag === 'template') {\n activeSlot = child\n grouped.push(child)\n continue\n }\n if (!activeSlot) {\n grouped.push(child)\n continue\n }\n activeSlot.children.push(child)\n if (child.range.end.offset > activeSlot.range.end.offset) {\n activeSlot.range = { start: activeSlot.range.start, end: child.range.end }\n }\n }\n return { ...descriptor, children: grouped }\n}\n\nfunction mapNodes(\n nodes: ReadonlyArray<Node>,\n descriptors: ReadonlyArray<BlockDescriptor>,\n parentPath: ReadonlyArray<number>,\n mappings: DocumentSourceMapping[],\n): void {\n let descriptorIndex = 0\n\n for (let nodeIndex = 0; nodeIndex < nodes.length; nodeIndex++) {\n const node = nodes[nodeIndex]\n if (!node || !isElementNode(node)) continue\n\n let matchIndex = descriptorIndex\n while (\n matchIndex < descriptors.length &&\n descriptors[matchIndex]?.tag !== '*' &&\n descriptors[matchIndex]?.tag !== node[0]\n ) {\n matchIndex++\n }\n const descriptor = descriptors[matchIndex]\n if (!descriptor) continue\n\n descriptorIndex = matchIndex + 1\n const nodePath = [...parentPath, nodeIndex]\n mappings.push({ nodePath, range: descriptor.range })\n const [, , ...children] = node\n mapNodes(children, descriptor.children, nodePath, mappings)\n }\n}\n\nfunction isElementNode(node: Node): node is ElementNode {\n return Array.isArray(node) && Predicate.isString(node[0])\n}\n\nfunction indexLineStarts(source: string): number[] {\n const starts = [0]\n for (let offset = 0; offset < source.length; offset++) {\n if (source.charCodeAt(offset) === 10) starts.push(offset + 1)\n }\n return starts\n}\n\nfunction rangeFromParsedLines(\n source: string,\n sourceLineStarts: ReadonlyArray<number>,\n parsedMarkdown: string,\n parsedLineStarts: ReadonlyArray<number>,\n parsedOffset: number,\n startLine: number,\n endLine: number,\n fallbackLineOffset: number,\n): DocumentSourceRange {\n const startOffset =\n parsedOffset >= 0\n ? parsedOffset + (parsedLineStarts[startLine] ?? parsedMarkdown.length)\n : (sourceLineStarts[startLine + fallbackLineOffset] ?? source.length)\n const endOffset =\n parsedOffset >= 0\n ? parsedOffset + (parsedLineStarts[endLine] ?? parsedMarkdown.length)\n : (sourceLineStarts[endLine + fallbackLineOffset] ?? source.length)\n return {\n start: pointAt(source, sourceLineStarts, startOffset),\n end: pointAt(source, sourceLineStarts, Math.max(startOffset, endOffset)),\n }\n}\n\nfunction pointAt(source: string, lineStarts: ReadonlyArray<number>, rawOffset: number): DocumentSourcePoint {\n const offset = Math.min(Math.max(rawOffset, 0), source.length)\n let low = 0\n let high = lineStarts.length - 1\n while (low < high) {\n const middle = Math.ceil((low + high) / 2)\n if ((lineStarts[middle] ?? source.length) <= offset) low = middle\n else high = middle - 1\n }\n return {\n offset,\n line: low + 1,\n column: offset - (lineStarts[low] ?? 0) + 1,\n }\n}\n","import type { ComarkParseFn } from 'comark'\nimport { createMarkdownParser } from 'comark/parse'\nimport alert from 'comark/plugins/alert'\nimport attributes from 'comark/plugins/attributes'\nimport components from 'comark/plugins/components'\nimport frontmatter from 'comark/plugins/frontmatter'\nimport headings from 'comark/plugins/headings'\nimport security from 'comark/plugins/security'\nimport taskList from 'comark/plugins/task-list'\nimport toc from 'comark/plugins/toc'\nimport { sourceCapturePlugin, sourceMappingPlugin } from './source-mapping'\n\n/**\n * Changes when parsing, normalization, or projection semantics change. Stored\n * with compiled documents so migrations can identify stale derived content.\n */\nexport const DOCUMENT_ENGINE_FINGERPRINT =\n 'comark@0.6.2/frontmatter+alert+task-list+components+attributes+security+headings+toc+source-mapping/v1'\n\n/** One explicit grammar for authoring, preview, delivery, and analysis projections. */\nexport function createDocumentParser(): ComarkParseFn {\n return createMarkdownParser({\n autoClose: false,\n registerDefaultPlugins: false,\n plugins: [\n sourceCapturePlugin(),\n frontmatter(),\n alert(),\n taskList(),\n components(),\n attributes(),\n // Security mutates the tree before metadata and source paths are derived.\n security(),\n headings(),\n toc({ depth: 5, searchDepth: 6 }),\n sourceMappingPlugin(),\n ],\n })\n}\n","import { Schema } from 'effect'\n\nexport class EditorDocumentInvalid extends Schema.TaggedError<EditorDocumentInvalid>()('EditorDocument.Invalid', {\n message: Schema.NonEmptyString,\n cause: Schema.Defect(),\n}) {}\n\nexport class EditorRenderFailed extends Schema.TaggedError<EditorRenderFailed>()('EditorDocument.RenderFailed', {\n cause: Schema.Defect(),\n}) {}\n","import type { BlockAuthoring, BlockProp, BlockSlot } from '@internal/protocol/Authoring'\nimport type { Editor, JSONContent } from '@tiptap/core'\nimport type { CollectionBody, ComponentDefinition } from '@internal/protocol/Configuration'\nimport { Extension } from '@tiptap/core'\nimport { Plugin } from '@tiptap/pm/state'\nimport { ySyncPluginKey } from '@tiptap/y-tiptap'\nimport { CmsMarkdownDocument } from '@internal/protocol/Documents'\nimport { Effect, Predicate, Schema } from 'effect'\nimport { comarkToEditor } from './internal/comark/to-editor'\nimport { createCmsComarkRenderData } from './internal/comark/document-adapter'\nimport { createDocumentParser } from './internal/comark/grammar'\nimport { EditorDocumentInvalid } from './internal/editor/errors'\nimport { createEditorNodeId } from './internal/editor/identity'\n\n/** Compiles insertion content with the same grammar used for publication. */\nexport const parseAuthoringContent = Effect.fn('AuthoringSchema.parseContent')(function* (markdown: string) {\n const body = yield* Effect.tryPromise({\n try: () => createDocumentParser()(markdown),\n catch: (cause) => new EditorDocumentInvalid({ cause, message: 'Invalid initial Markdown content.' }),\n })\n const decoded = yield* Schema.decodeUnknownEffect(CmsMarkdownDocument)(body)\n return decoded.nodes\n})\n\nconst isJsonObject = Schema.is(Schema.JsonObject)\n\n/** Resolves collection selectors for both insertion controls and authoritative validation. */\nexport function collectionComponents(\n components: ReadonlyArray<ComponentDefinition>,\n body: CollectionBody | undefined,\n): ReadonlyArray<ComponentDefinition> {\n if (!body) return components\n return components.filter(\n (component) =>\n body.blocks?.includes(component.name) ||\n (component.authoring.group !== undefined && body.groups?.includes(component.authoring.group)),\n )\n}\n\n/** Configuration errors belong to developers, before an installation adopts the catalog. */\nexport function validateCollectionBody(\n components: ReadonlyArray<ComponentDefinition>,\n body: CollectionBody | undefined,\n): ReadonlyArray<string> {\n return [\n ...components.flatMap((component) =>\n component.authoring.slots.flatMap((slot) => [\n ...(slot.blocks ?? [])\n .filter((name) => !components.some((candidate) => candidate.name === name))\n .map((name) => `Unknown block \"${name}\" in ${slot.label}.`),\n ...(slot.groups ?? [])\n .filter((group) => !components.some((candidate) => candidate.authoring.group === group))\n .map((group) => `Unknown block group \"${group}\" in ${slot.label}.`),\n ]),\n ),\n ...(body?.blocks ?? [])\n .filter((name) => !components.some((component) => component.name === name))\n .map((name) => `Unknown block \"${name}\".`),\n ...(body?.groups ?? [])\n .filter((group) => !components.some((component) => component.authoring.group === group))\n .map((group) => `Unknown block group \"${group}\".`),\n ]\n}\n\nfunction contentIssues(\n node: JSONContent,\n schemas: ReadonlyMap<string, AuthoringSchema>,\n allowed: ReadonlySet<string>,\n purpose: 'working' | 'publish',\n collectionAllowed: ReadonlySet<string> = allowed,\n): string[] {\n const issues: string[] = []\n if (node.type === 'cmsBlock') {\n const name = String(node.attrs?.tag).toLowerCase()\n const schema = schemas.get(name)\n if (!schema) issues.push('This block is unavailable. Ask your site developer to restore its definition.')\n else {\n if (!allowed.has(name)) issues.push(`${schema.definition.label} is not allowed in this content region.`)\n issues.push(...schema.validate(node, purpose))\n }\n }\n if (node.type === 'cmsOpaque' || node.type === 'cmsInlineOpaque')\n issues.push('This content is unsupported. Ask your site developer to update it before publishing.')\n if (node.type === 'cmsBlock') {\n const schema = schemas.get(String(node.attrs?.tag).toLowerCase())\n for (const region of node.content ?? []) {\n const slot = schema?.definition.slots.find((candidate) => candidate.name === region.attrs?.name)\n const permitted =\n slot?.input === 'blocks'\n ? new Set(\n collectionComponents(\n [...schemas].map(([name, schema]) => ({ name, authoring: schema.definition })),\n slot.blocks === undefined && slot.groups === undefined ? undefined : slot,\n )\n .map((component) => component.name)\n .filter((name) => collectionAllowed.has(name)),\n )\n : collectionAllowed\n issues.push(...contentIssues(region, schemas, permitted, purpose, collectionAllowed))\n }\n return issues\n }\n return [\n ...issues,\n ...(node.content ?? []).flatMap((child) => contentIssues(child, schemas, allowed, purpose, collectionAllowed)),\n ]\n}\n\n/** Validates authored blocks during single-document compilation as well as catalog publication. */\nexport function validateAuthoringDocument(\n body: CmsMarkdownDocument,\n components: ReadonlyMap<string, ComponentDefinition> | undefined,\n bodyPolicy?: CollectionBody,\n): ReadonlyArray<string> {\n if (!components) return []\n const definitions = [...components.values()]\n const schemas = new Map(\n definitions.map((component) => [component.name, createAuthoringSchema(component.name, component.authoring)]),\n )\n const allowed = new Set(collectionComponents(definitions, bodyPolicy).map((component) => component.name))\n return comarkToEditor(body.nodes, createCmsComarkRenderData(body)).flatMap((node) =>\n contentIssues(node, schemas, allowed, 'publish'),\n )\n}\n\n/** Resolved block behavior shared by insertion, controls, and publication validation. */\nexport interface AuthoringSchema {\n readonly definition: BlockAuthoring\n readonly createContent: () => JSONContent\n readonly createSlot: (name: string) => JSONContent\n readonly setProperty: (current: Schema.JsonObject, name: string, value: Schema.Json | undefined) => Schema.JsonObject\n readonly validate: (node: JSONContent, purpose: 'working' | 'publish') => ReadonlyArray<string>\n}\n\nexport function createAuthoringSchema(name: string, definition: BlockAuthoring): AuthoringSchema {\n const fields = new Map(definition.props.map((field) => [field.name, field]))\n const slots = new Map(definition.slots.map((slot) => [slot.name, slot]))\n if (fields.size !== definition.props.length || slots.size !== definition.slots.length) {\n throw new Error(`${definition.label}: authoring names must be unique.`)\n }\n const initialProps = {\n ...Object.fromEntries(\n definition.props.flatMap((field) => (field.defaultValue === undefined ? [] : [[field.name, field.defaultValue]])),\n ),\n ...definition.initialProps,\n }\n for (const field of definition.props) {\n if (field.defaultValue === undefined) continue\n const issue = propertyIssue(field, field.defaultValue, 'working')\n if (issue) throw new Error(`Invalid default for ${definition.label}: ${issue}`)\n }\n\n function createSlot(slotName: string): JSONContent {\n const slot = slots.get(slotName)\n if (!slot) throw new Error(`${definition.label}: unknown content region ${slotName}.`)\n const content = slot.initial ? comarkToEditor(slot.initial) : []\n return {\n type: 'cmsSlot',\n attrs: { cmsNodeId: createEditorNodeId(), name: slotName, implicit: slotName === 'default', props: {} },\n content: content.length ? content : [{ type: 'paragraph', attrs: { cmsNodeId: createEditorNodeId() } }],\n }\n }\n\n function createContent(): JSONContent {\n return {\n type: 'cmsBlock',\n attrs: { cmsNodeId: createEditorNodeId(), tag: name, props: structuredClone(initialProps) },\n content: definition.slots\n .filter((slot) => slot.required || slot.initial !== undefined)\n .map((slot) => createSlot(slot.name)),\n }\n }\n\n function validate(node: JSONContent, purpose: 'working' | 'publish'): ReadonlyArray<string> {\n const issues: string[] = []\n const attributes = node.attrs?.props\n const values = isJsonObject(attributes) ? attributes : {}\n for (const key of Object.keys(values))\n if (!fields.has(key)) issues.push(`${definition.label}: ${key} is not editable.`)\n for (const field of definition.props) {\n const value = values[field.name] ?? (values[field.name] === null ? null : field.defaultValue)\n const issue = propertyIssue(field, value, purpose)\n if (issue) issues.push(issue)\n }\n const used = new Set<string>()\n for (const region of node.content ?? []) {\n const key = String(region.attrs?.name ?? 'default')\n const slot = slots.get(key)\n if (!slot || region.type !== 'cmsSlot') {\n issues.push(`${definition.label}: unsupported content region ${key}.`)\n continue\n }\n if (used.has(key)) issues.push(`${slot.label} can only appear once.`)\n used.add(key)\n if (!validRegion(slot, region.content ?? []))\n issues.push(`${slot.label} contains unsupported formatting or blocks.`)\n }\n for (const slot of definition.slots)\n if (slot.required && !used.has(slot.name)) issues.push(`${slot.label} is required.`)\n return issues\n }\n\n const schema: AuthoringSchema = {\n definition,\n createContent,\n createSlot,\n validate,\n setProperty(current: Schema.JsonObject, key: string, value: Schema.Json | undefined) {\n const field = fields.get(key)\n if (!field) throw new Error(`${definition.label}: ${key} is not editable.`)\n const issue = propertyIssue(field, value, 'working')\n if (issue) throw new Error(issue)\n const next = Object.fromEntries(Object.entries(current))\n if (value === undefined) delete next[key]\n else next[key] = value\n return next\n },\n }\n const issues = validate(createContent(), 'publish')\n if (issues.length) throw new Error(`Invalid initial content for ${definition.label}: ${issues.join(' ')}`)\n return schema\n}\n\n/** Context for Studio's formatting and insertion controls, resolved from the document selection. */\nexport function selectedAuthoringSlot(\n editor: Editor,\n components: ReadonlyArray<ComponentDefinition>,\n): BlockSlot | undefined {\n const position = editor.state.selection.$from\n for (let depth = position.depth; depth > 0; depth--) {\n const region = position.node(depth)\n if (region.type.name !== 'cmsSlot') continue\n const block = position.node(depth - 1)\n return components\n .find((component) => component.name === block.attrs.tag)\n ?.authoring.slots.find((slot) => slot.name === region.attrs.name)\n }\n return undefined\n}\n\n/** Applies authoring rules to local edits. Remote CRDT updates always converge; publication validates them. */\nexport function createAuthoringExtension(\n components: () => ReadonlyArray<ComponentDefinition>,\n body: () => CollectionBody | undefined = () => undefined,\n): Extension {\n let previousComponents: ReadonlyArray<ComponentDefinition> | undefined\n let schemas = new Map<string, ReturnType<typeof createAuthoringSchema>>()\n function refresh() {\n const current = components()\n if (current === previousComponents) return\n previousComponents = current\n schemas = new Map(\n current.map((component) => [component.name, createAuthoringSchema(component.name, component.authoring)]),\n )\n }\n function issues(content: JSONContent): string[] {\n const allowed = new Set(collectionComponents(components(), body()).map((component) => component.name))\n return contentIssues(content, schemas, allowed, 'working')\n }\n return Extension.create({\n name: 'cmsAuthoringPolicy',\n addProseMirrorPlugins() {\n return [\n new Plugin({\n filterTransaction(transaction, state) {\n if (!transaction.docChanged || transaction.getMeta(ySyncPluginKey)?.isChangeOrigin) return true\n refresh()\n const previous = issues(state.doc.toJSON())\n return issues(transaction.doc.toJSON()).every((issue) => {\n const index = previous.indexOf(issue)\n if (index < 0) return false\n previous.splice(index, 1)\n return true\n })\n },\n }),\n ]\n },\n })\n}\n\nfunction propertyIssue(\n field: BlockProp,\n value: Schema.Json | undefined,\n purpose: 'working' | 'publish',\n): string | undefined {\n if (value === undefined) return field.required && purpose === 'publish' ? `${field.label} is required.` : undefined\n if (value === null && field.nullable) return undefined\n const valid =\n field.type === 'string'\n ? Predicate.isString(value)\n : field.type === 'number'\n ? Predicate.isNumber(value) && Number.isFinite(value)\n : field.type === 'boolean'\n ? Predicate.isBoolean(value)\n : field.type === 'array'\n ? Array.isArray(value)\n : isJsonObject(value)\n if (!valid) return `${field.label} must be ${field.type}.`\n if (field.type === 'object' || field.type === 'array') {\n const entries = Array.isArray(value) ? value : [value]\n const ids = new Set<string>()\n for (const entry of entries) {\n if (!isJsonObject(entry)) return `${field.label} must contain objects.`\n if (field.type === 'array') {\n const id = entry.id\n if (!Predicate.isString(id) || !id || ids.has(id)) return `${field.label} items need unique identities.`\n ids.add(id)\n }\n for (const key of Object.keys(entry))\n if (!(field.type === 'array' && key === 'id') && !field.fields?.some((child) => child.name === key))\n return `${field.label} contains an unavailable field.`\n for (const child of field.fields ?? []) {\n const issue = propertyIssue(child, entry[child.name], purpose)\n if (issue) return `${field.label}: ${issue}`\n }\n }\n }\n if (purpose === 'publish' && field.required && value === '' && (field.input === 'image' || field.input === 'link'))\n return `${field.label} is required.`\n if (\n purpose === 'publish' &&\n Predicate.isString(value) &&\n value &&\n (field.input === 'image' || field.input === 'link') &&\n !validAuthoringUrl(value, field.input)\n )\n return `${field.label} needs a valid ${field.input === 'image' ? 'image URL' : 'link'}.`\n if (field.options.length && !field.options.some((option) => option.value === value))\n return `${field.label} must use one of its available choices.`\n return undefined\n}\n\nfunction validRegion(slot: BlockSlot, content: ReadonlyArray<JSONContent>): boolean {\n if (slot.input === 'blocks')\n return content.every((node) => node.type === 'cmsBlock' || (node.type === 'paragraph' && !node.content?.length))\n const types = new Set(['paragraph', 'text', 'hardBreak'])\n const marks = new Set<string>()\n if (slot.input === 'text' && content.length > 1) return false\n if (slot.input === 'rich-text')\n for (const feature of slot.features) {\n if (feature === 'bullet-list') {\n types.add('bulletList')\n types.add('listItem')\n } else marks.add(feature)\n }\n const valid = (node: JSONContent): boolean =>\n types.has(node.type ?? '') &&\n (node.marks ?? []).every((mark) => marks.has(mark.type)) &&\n (node.content ?? []).every(valid)\n return content.every(valid)\n}\n\n/** URL values remain ordinary Vue strings and use the document model's public paths. */\nexport function validAuthoringUrl(value: string, input: 'image' | 'link'): boolean {\n if (value.trim() !== value || value.includes('\\\\')) return false\n for (const character of value) if (character.charCodeAt(0) <= 32) return false\n if (value.startsWith('/') && !value.startsWith('//')) return true\n if (input === 'link' && value.startsWith('#')) return true\n try {\n const url = new URL(value)\n return ['https:', 'http:', ...(input === 'link' ? ['mailto:', 'tel:'] : [])].includes(url.protocol)\n } catch {\n return false\n }\n}\n\n/** New list entries receive an identity that remains stable through reordering and collaboration. */\nexport function createAuthoringItem(fields: ReadonlyArray<BlockProp>, list = false): Schema.JsonObject {\n return {\n ...(list ? { id: createEditorNodeId() } : undefined),\n ...Object.fromEntries(\n fields\n .filter((field) => field.required || field.defaultValue !== undefined)\n .map((field) => [\n field.name,\n field.defaultValue ??\n (field.type === 'object'\n ? createAuthoringItem(field.fields ?? [])\n : field.type === 'array'\n ? []\n : field.type === 'number'\n ? 0\n : field.type === 'boolean'\n ? false\n : (field.options[0]?.value ?? '')),\n ]),\n ),\n }\n}\n","/** Serializable component authoring data resolved by the framework compiler. */\nimport { Schema } from 'effect'\nimport { MarkdownNode } from './internal/documents/models'\n\nexport interface BlockProp {\n readonly name: string\n readonly label: string\n readonly help?: string\n readonly type: 'string' | 'number' | 'boolean' | 'object' | 'array'\n readonly input: 'text' | 'textarea' | 'select' | 'number' | 'toggle' | 'image' | 'link' | 'object' | 'list'\n readonly required: boolean\n readonly nullable: boolean\n readonly defaultValue?: Schema.Json\n readonly options: ReadonlyArray<{ readonly value: string; readonly label: string }>\n readonly fields?: ReadonlyArray<BlockProp>\n}\n\nexport const BlockProp: Schema.Codec<BlockProp> = Schema.Struct({\n name: Schema.NonEmptyString,\n label: Schema.NonEmptyString,\n help: Schema.optionalKey(Schema.String),\n type: Schema.Literals(['string', 'number', 'boolean', 'object', 'array']),\n input: Schema.Literals(['text', 'textarea', 'select', 'number', 'toggle', 'image', 'link', 'object', 'list']),\n required: Schema.Boolean,\n nullable: Schema.Boolean,\n defaultValue: Schema.optionalKey(Schema.Json),\n fields: Schema.optionalKey(Schema.Array(Schema.suspend(() => BlockProp))),\n options: Schema.Array(Schema.Struct({ value: Schema.String, label: Schema.String })),\n})\n\nexport const BlockSlot = Schema.Struct({\n name: Schema.NonEmptyString,\n label: Schema.NonEmptyString,\n help: Schema.optionalKey(Schema.String),\n required: Schema.Boolean,\n input: Schema.Literals(['text', 'rich-text', 'blocks']),\n blocks: Schema.optionalKey(Schema.Array(Schema.NonEmptyString)),\n groups: Schema.optionalKey(Schema.Array(Schema.NonEmptyString)),\n features: Schema.Array(Schema.Literals(['bold', 'italic', 'link', 'bullet-list', 'code'])),\n initial: Schema.optionalKey(Schema.Array(MarkdownNode)),\n})\nexport interface BlockSlot extends Schema.Schema.Type<typeof BlockSlot> {}\n\nexport const BlockAuthoring = Schema.Struct({\n version: Schema.Literal(1),\n label: Schema.NonEmptyString,\n description: Schema.optionalKey(Schema.String),\n group: Schema.optionalKey(Schema.String),\n icon: Schema.optionalKey(Schema.String),\n props: Schema.Array(BlockProp),\n slots: Schema.Array(BlockSlot),\n initialProps: Schema.JsonObject,\n})\nexport interface BlockAuthoring extends Schema.Schema.Type<typeof BlockAuthoring> {}\n","/** Validated installation configuration shared by authoring, compilation, Studio, and Nuxt. */\nimport { Schema } from 'effect'\nimport { BlockAuthoring } from './Authoring'\nimport { AddressPattern, CollectionName, Locale, SourceDirectory } from './internal/configuration/scalars'\n\nexport { AddressPattern, CollectionName, Locale, SourceDirectory } from './internal/configuration/scalars'\n\nconst fieldPresentation = {\n path: Schema.NonEmptyString,\n label: Schema.NonEmptyString,\n description: Schema.optionalKey(Schema.String),\n defaultValue: Schema.optionalKey(Schema.Json),\n required: Schema.Boolean,\n}\n\nconst BooleanAuthoringField = Schema.Struct({\n type: Schema.tag('boolean'),\n ...fieldPresentation,\n input: Schema.Literal('toggle'),\n})\n\nconst DateAuthoringField = Schema.Struct({\n type: Schema.tag('date'),\n ...fieldPresentation,\n input: Schema.Literal('date'),\n})\n\nconst NumberAuthoringField = Schema.Struct({\n type: Schema.tag('number'),\n ...fieldPresentation,\n input: Schema.Literals(['number', 'select']),\n options: Schema.Array(Schema.Finite),\n})\n\nconst StringAuthoringField = Schema.Struct({\n type: Schema.tag('string'),\n ...fieldPresentation,\n input: Schema.Literals(['select', 'text', 'textarea']),\n options: Schema.Array(Schema.String),\n})\n\nconst StringArrayAuthoringField = Schema.Struct({\n type: Schema.tag('string[]'),\n ...fieldPresentation,\n input: Schema.Literal('multiselect'),\n options: Schema.Array(Schema.String),\n})\n\nexport const DocumentField = Schema.Union([\n BooleanAuthoringField,\n DateAuthoringField,\n NumberAuthoringField,\n StringArrayAuthoringField,\n StringAuthoringField,\n])\nexport type DocumentField = typeof DocumentField.Type\n\nexport const CollectionBody = Schema.Struct({\n blocks: Schema.optionalKey(Schema.Array(Schema.NonEmptyString)),\n groups: Schema.optionalKey(Schema.Array(Schema.NonEmptyString)),\n})\nexport interface CollectionBody extends Schema.Schema.Type<typeof CollectionBody> {}\n\nexport const CollectionDefinition = Schema.Struct({\n collection: CollectionName,\n body: Schema.optionalKey(CollectionBody),\n label: Schema.NonEmptyString,\n description: Schema.String,\n directory: SourceDirectory,\n addressPattern: AddressPattern,\n hierarchy: Schema.Boolean,\n canCreate: Schema.Boolean,\n authoringFields: Schema.Array(DocumentField),\n}).annotate({ identifier: 'CollectionDefinition' })\nexport interface CollectionDefinition extends Schema.Schema.Type<typeof CollectionDefinition> {}\n\nexport const LocaleConfiguration = Schema.Struct({\n locales: Schema.Array(Locale),\n defaultLocale: Locale,\n fallbackLocale: Schema.NullOr(Locale),\n prefixDefaultLocale: Schema.Boolean,\n}).annotate({ identifier: 'LocaleConfiguration' })\nexport interface LocaleConfiguration extends Schema.Schema.Type<typeof LocaleConfiguration> {}\n\nexport const DocumentConfiguration = Schema.Struct({\n types: Schema.Array(CollectionDefinition),\n locales: Schema.optionalKey(LocaleConfiguration),\n}).annotate({ identifier: 'DocumentConfiguration' })\nexport interface DocumentConfiguration extends Schema.Schema.Type<typeof DocumentConfiguration> {}\n\nexport const ComponentDefinition = Schema.Struct({\n authoring: BlockAuthoring,\n name: Schema.NonEmptyString,\n}).annotate({ identifier: 'ComponentDefinition' })\nexport interface ComponentDefinition extends Schema.Schema.Type<typeof ComponentDefinition> {}\n\nexport const AuthoringCatalog = Schema.Struct({\n revision: Schema.NonEmptyString,\n components: Schema.Array(ComponentDefinition),\n})\nexport interface AuthoringCatalog extends Schema.Schema.Type<typeof AuthoringCatalog> {}\n\nexport const MediaConfiguration = Schema.Struct({\n enabled: Schema.Boolean,\n maxUploadBytes: Schema.Int.check(Schema.isGreaterThan(0)),\n})\nexport interface MediaConfiguration extends Schema.Schema.Type<typeof MediaConfiguration> {}\n"],"mappings":";;;;;;;;;;;;;;;;;AAQA,MAAMA,iBAAe,OAAO,GAAG,OAAO,UAAU;AAChD,MAAM,aAAa,OAAO,oBAAoB,OAAO,IAAI;;AAYzD,SAAgB,2BACd,YACA,YACqB;CACrB,MAAM,2BAAW,IAAI,IAAqC;CAC1D,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QACjC,kBAAkB,0BAA0B,UAAU,GAAG,YAAY,EAAE,WAAW,KAAK,CAAC,CAC1F,GAAG;EACD,IAAI,UAAU,YAAY,KAAK,GAAG;GAChC,SAAS,IAAI,MAAM,MAAS;GAC5B;EACF;EACA,MAAM,UAAU,WAAW,KAAK;EAChC,IAAI,OAAO,OAAO,OAAO,GAAG,MAAM,IAAI,MAAM,uCAAuC,KAAK,GAAG;EAC3F,SAAS,IAAI,MAAM,QAAQ,KAAK;CAClC;CACA,OAAO;AACT;;AAGA,SAAgB,oCACd,YACA,YAC8B;CAC9B,MAAM,WAAW,2BAA2B,YAAY,UAAU;CAClE,MAAM,QAAqC,CAAC;CAC5C,KAAK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AC9D,QAAQ,OAAO,YAAY,OAAO,MAAM,OAAO,cAAc,CAAC;AAChE,CAAC;AAGD,MAAa,uBAAuB,OAAO,OAAO;CAChD,YAAY;CACZ,MAAM,OAAO,YAAY,cAAc;CACvC,OAAO,OAAO;CACd,aAAa,OAAO;CACpB,WAAW;CACX,gBAAgB;CAChB,WAAW,OAAO;CAClB,WAAW,OAAO;CAClB,iBAAiB,OAAO,MAAM,aAAa;AAC7C,CAAC,CAAC,CAAC,SAAS,EAAE,YAAY,uBAAuB,CAAC;AAGlD,MAAa,sBAAsB,OAAO,OAAO;CAC/C,SAAS,OAAO,MAAM,MAAM;CAC5B,eAAe;CACf,gBAAgB,OAAO,OAAO,MAAM;CACpC,qBAAqB,OAAO;AAC9B,CAAC,CAAC,CAAC,SAAS,EAAE,YAAY,sBAAsB,CAAC;AAGjD,MAAa,wBAAwB,OAAO,OAAO;CACjD,OAAO,OAAO,MAAM,oBAAoB;CACxC,SAAS,OAAO,YAAY,mBAAmB;AACjD,CAAC,CAAC,CAAC,SAAS,EAAE,YAAY,wBAAwB,CAAC;AAGnD,MAAa,sBAAsB,OAAO,OAAO;CAC/C,WAAW;CACX,MAAM,OAAO;AACf,CAAC,CAAC,CAAC,SAAS,EAAE,YAAY,sBAAsB,CAAC;AAGjD,MAAa,mBAAmB,OAAO,OAAO;CAC5C,UAAU,OAAO;CACjB,YAAY,OAAO,MAAM,mBAAmB;AAC9C,CAAC;AAGD,MAAa,qBAAqB,OAAO,OAAO;CAC9C,SAAS,OAAO;CAChB,gBAAgB,OAAO,IAAI,MAAM,OAAO,cAAc,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentEngine-DYObwMDY.js","names":["nestedValue","PublicPathSchema","CmsDocumentAnalysisSchema","visit","isDocumentParseFailed","DocumentSourceMappingSchema","EffectResult","CompiledDocumentSchema","DocumentParseFailedError","DocumentValidationResultSchema"],"sources":["../../../../protocol/src/internal/documents/address.ts","../../../../document/src/internal/document-engine/errors.ts","../../../../document/src/internal/comark/analysis.ts","../../../../document/src/internal/document-engine/frontmatter-validation.ts","../../../../document/src/internal/document-engine/compilation.ts","../../../../document/src/internal/document-engine/catalog-lookup.ts","../../../../document/src/internal/document-engine/catalog-issues.ts","../../../../document/src/internal/document-engine/reference-target.ts","../../../../document/src/internal/document-engine/references.ts","../../../../document/src/internal/document-engine/catalog.ts","../../../../document/src/internal/document-engine/configuration.ts","../../../../document/src/DocumentEngine.ts"],"sourcesContent":["import type { LocaleConfiguration } from '../../Configuration'\nimport type { AddressPattern, Locale } from '../configuration/scalars'\nimport { Predicate, Result, Schema } from 'effect'\nimport { PublicPath as PublicPathSchema, type PublicPath } from './scalars'\n\nexport interface DocumentAddressToken {\n readonly catchAll: boolean\n readonly name: string\n}\n\nexport interface DocumentAddress {\n readonly pattern: AddressPattern\n readonly tokens: ReadonlyArray<DocumentAddressToken>\n}\n\nexport interface DocumentAddressError {\n readonly field?: string\n readonly message: string\n}\n\nconst addressTokenPattern = /:([a-z][\\w.]*)(\\*)?/giu\n\nexport function parseDocumentAddress(pattern: AddressPattern): Result.Result<DocumentAddress, DocumentAddressError> {\n const matches = [...pattern.matchAll(addressTokenPattern)]\n const tokens = matches.map((match) => ({\n catchAll: match[2] === '*',\n name: match[1] ?? '',\n }))\n const remainder = pattern.replace(addressTokenPattern, '')\n\n if (remainder.includes(':') || tokens.some((token) => !token.name)) {\n return Result.fail({\n field: 'addressPattern',\n message: `Document address pattern \"${pattern}\" contains an invalid token.`,\n })\n }\n if (tokens.filter((token) => token.catchAll).length > 1) {\n return Result.fail({\n field: 'addressPattern',\n message: `Document address pattern \"${pattern}\" contains more than one catch-all token.`,\n })\n }\n if (new Set(tokens.map((token) => token.name)).size !== tokens.length) {\n return Result.fail({\n field: 'addressPattern',\n message: `Document address pattern \"${pattern}\" contains duplicate tokens.`,\n })\n }\n\n return Result.succeed({ pattern, tokens })\n}\n\nexport function resolveDocumentAddress(\n address: DocumentAddress,\n relativeKey: PublicPath,\n data: Schema.JsonObject,\n): Result.Result<PublicPath, DocumentAddressError> {\n const relativePath = relativeKey === '/' ? '' : relativeKey.slice(1)\n let resolved: string = address.pattern\n\n for (const token of address.tokens) {\n const authored = nestedValue(data, token.name)\n const fallback = token.catchAll ? relativePath : undefined\n const value =\n authored === undefined ? fallback : Predicate.isString(authored) && authored.trim() ? authored : undefined\n\n if (value === undefined) {\n return Result.fail({\n field: token.name,\n message:\n authored === undefined\n ? `Document address field \"${token.name}\" is required by pattern \"${address.pattern}\".`\n : `Document address field \"${token.name}\" must be a non-empty string.`,\n })\n }\n\n const normalized = token.catchAll ? normalizeDocumentRelativePath(value) : normalizeDocumentSegment(value)\n if (Result.isFailure(normalized)) return Result.fail(normalized.failure)\n resolved = resolved.replace(`:${token.name}${token.catchAll ? '*' : ''}`, normalized.success)\n }\n\n return normalizePublicPath(resolved)\n}\n\nexport function documentKeyFromSourcePath(relativeSourcePath: string): Result.Result<PublicPath, DocumentAddressError> {\n const extension = relativeSourcePath.match(/\\.(?:md|mdc)$/iu)?.[0]\n if (!extension) {\n return Result.fail({\n field: 'sourcePath',\n message: `Document source must be a Markdown file: \"${relativeSourcePath}\".`,\n })\n }\n\n const segments = relativeSourcePath.slice(0, -extension.length).split('/')\n if (segments.at(-1)?.toLocaleLowerCase() === 'index') segments.pop()\n\n return normalizeDocumentRelativePath(segments.join('/')).pipe(Result.flatMap(normalizePublicPath))\n}\n\nexport function localizeDocumentPath(\n key: PublicPath,\n locale: Locale | undefined,\n configuration: LocaleConfiguration | undefined,\n): PublicPath {\n if (!configuration || !locale || (locale === configuration.defaultLocale && !configuration.prefixDefaultLocale)) {\n return key\n }\n return PublicPathSchema.make(`/${locale}${key === '/' ? '' : key}`)\n}\n\nexport function normalizePublicPath(value: string): Result.Result<PublicPath, DocumentAddressError> {\n const path = `/${value.replace(/\\\\/gu, '/').replace(/^\\/+|\\/+$/gu, '')}`.replace(/\\/{2,}/gu, '/')\n return Schema.decodeResult(PublicPathSchema)(path).pipe(\n Result.mapError(() => ({\n field: 'path',\n message: `Document path \"${value}\" cannot be normalized into a public path.`,\n })),\n )\n}\n\nexport function normalizeDocumentRelativePath(value: string): Result.Result<string, DocumentAddressError> {\n if (!value.trim()) return Result.succeed('')\n\n const segments = value.replace(/\\\\/gu, '/').split('/').filter(Boolean)\n const normalized: string[] = []\n for (const segment of segments) {\n const result = normalizeDocumentSegment(segment)\n if (Result.isFailure(result)) return result\n normalized.push(result.success)\n }\n return Result.succeed(normalized.join('/'))\n}\n\nexport function normalizeDocumentSegment(value: string): Result.Result<string, DocumentAddressError> {\n const normalized = value\n .trim()\n .normalize('NFKC')\n .toLocaleLowerCase()\n .replace(/[^\\p{Letter}\\p{Number}_-]+/gu, '-')\n .replace(/^-+|-+$/gu, '')\n\n return normalized\n ? Result.succeed(normalized)\n : Result.fail({ message: `Document path segment \"${value}\" is empty after normalization.` })\n}\n\nfunction nestedValue(value: Schema.JsonObject, path: string): Schema.Json | undefined {\n return path.split('.').reduce<Schema.Json | undefined>((current, segment) => {\n if (!Schema.is(Schema.JsonObject)(current)) return undefined\n return current[segment]\n }, value)\n}\n","import { DocumentIssue } from '@internal/protocol/Documents'\nimport { SourcePath } from '@internal/protocol/Documents'\nimport { Schema } from 'effect'\n\nexport class DocumentEngineConfigurationInvalid extends Schema.TaggedError<DocumentEngineConfigurationInvalid>()(\n 'DocumentEngine.ConfigurationInvalid',\n {\n message: Schema.NonEmptyString,\n field: Schema.optionalKey(Schema.NonEmptyString),\n },\n) {}\n\nexport class DocumentParseFailed extends Schema.TaggedError<DocumentParseFailed>()(\n 'DocumentEngine.DocumentParseFailed',\n {\n sourcePath: SourcePath,\n cause: Schema.Defect(),\n },\n) {}\n\nexport class DocumentCompilationFailed extends Schema.TaggedError<DocumentCompilationFailed>()(\n 'DocumentEngine.DocumentCompilationFailed',\n {\n issues: Schema.Array(DocumentIssue),\n },\n) {}\n","import type { CmsDocumentAnalysis, CmsMarkdownDocument, MarkdownNode } from '@internal/protocol/Documents'\nimport { CmsDocumentAnalysis as CmsDocumentAnalysisSchema } from '@internal/protocol/Documents'\nimport { Predicate } from 'effect'\nimport { cmsComarkTextContent } from './document-adapter'\n\nexport const CMS_STANDARD_TAGS = new Set([\n 'a',\n 'abbr',\n 'address',\n 'article',\n 'aside',\n 'b',\n 'blockquote',\n 'br',\n 'button',\n 'caption',\n 'code',\n 'col',\n 'colgroup',\n 'dd',\n 'del',\n 'details',\n 'div',\n 'dl',\n 'dt',\n 'em',\n 'figcaption',\n 'figure',\n 'footer',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'header',\n 'hr',\n 'i',\n 'img',\n 'kbd',\n 'li',\n 'main',\n 'mark',\n 'nav',\n 'ol',\n 'p',\n 'pre',\n 'q',\n 's',\n 'section',\n 'small',\n 'span',\n 'strong',\n 'sub',\n 'summary',\n 'sup',\n 'table',\n 'tbody',\n 'td',\n 'template',\n 'tfoot',\n 'th',\n 'thead',\n 'tr',\n 'u',\n 'ul',\n])\n\nexport function analyzeCmsDocument(\n body: CmsMarkdownDocument,\n metadata: { readonly description?: string; readonly title: string },\n): CmsDocumentAnalysis {\n const headings: Array<{ readonly depth: number; readonly id: string; readonly text: string }> = []\n const components = new Set<string>()\n\n visit(body.nodes, (node) => {\n const tag = node[0].toLocaleLowerCase()\n if (/^h[1-6]$/u.test(tag)) {\n headings.push({\n depth: Number(tag.slice(1)),\n id: Predicate.isString(node[1].id) ? node[1].id : '',\n text: cmsComarkTextContent(node).trim(),\n })\n } else if (!CMS_STANDARD_TAGS.has(tag)) {\n components.add(tag)\n }\n })\n\n const bodyText = normalizeText(body.nodes.map(cmsComarkTextContent).join(' '))\n const summary = normalizeText(metadata.description ?? firstParagraph(body.nodes) ?? metadata.title)\n const searchText = normalizeText([metadata.title, metadata.description, bodyText].filter(Boolean).join(' '))\n\n return CmsDocumentAnalysisSchema.make({\n components: [...components].sort(),\n headings,\n searchText,\n summary,\n })\n}\n\nfunction visit(\n nodes: ReadonlyArray<MarkdownNode>,\n inspect: (node: Exclude<MarkdownNode, string | readonly [null, object, string]>) => void,\n): void {\n for (const node of nodes) {\n if (Predicate.isString(node) || node[0] === null) continue\n inspect(node)\n const [, , ...children] = node\n visit(children, inspect)\n }\n}\n\nfunction firstParagraph(nodes: ReadonlyArray<MarkdownNode>): string | undefined {\n const paragraph = nodes.find((node) => Array.isArray(node) && node[0] === 'p')\n if (!paragraph || Predicate.isString(paragraph) || paragraph[0] === null) return undefined\n const text = normalizeText(cmsComarkTextContent(paragraph))\n return text || undefined\n}\n\nfunction normalizeText(value: string): string {\n return value.replace(/\\s+/gu, ' ').trim()\n}\n","import type { CollectionDefinition } from '@internal/protocol/Configuration'\nimport type { DocumentIssue } from '@internal/protocol/Documents'\nimport type { SourcePath } from '@internal/protocol/Documents'\nimport type { DocumentSchemaIssue, ExecutableDocumentSchema } from './document-schema'\nimport { Effect, Predicate, Schema } from 'effect'\n\nexport const validateFrontmatter = Effect.fn('DocumentEngine.validateFrontmatter')(function* (\n raw: Schema.JsonObject,\n schema: ExecutableDocumentSchema,\n type: CollectionDefinition,\n sourcePath: SourcePath,\n) {\n const projection = schema.project(raw)\n const issues = projection.unknownPaths\n .toSorted()\n .map((path): DocumentIssue => unknownFieldIssue(path, type, sourcePath))\n const result = yield* schema.validate(projection.value)\n\n if ('issues' in result) {\n issues.push(...result.issues.map((issue) => schemaIssue(issue, projection.value, type, sourcePath)))\n return { data: projection.value, issues }\n }\n\n const parsed = Schema.decodeUnknownOption(Schema.JsonObject)(result.value)\n if (parsed._tag === 'None') {\n issues.push(\n issue(\n 'schema.constraint',\n 'The collection schema output must be a JSON-compatible object.',\n type,\n sourcePath,\n 'frontmatter',\n ),\n )\n return { data: projection.value, issues }\n }\n\n return issues.length === 0 ? { data: parsed.value, issues } : { data: projection.value, issues }\n})\n\nfunction unknownFieldIssue(path: string, type: CollectionDefinition, sourcePath: SourcePath): DocumentIssue {\n if (path === 'id') {\n return issue(\n 'document.id',\n 'Document identity is managed by the CMS and cannot be authored in frontmatter.',\n type,\n sourcePath,\n path,\n )\n }\n return issue(\n 'schema.unknown',\n `Frontmatter field \"${path}\" is not declared by collection \"${type.collection}\".`,\n type,\n sourcePath,\n path,\n )\n}\n\nfunction schemaIssue(\n error: DocumentSchemaIssue,\n input: Schema.JsonObject,\n type: CollectionDefinition,\n sourcePath: SourcePath,\n): DocumentIssue {\n const field = issuePath(error.path)\n const code = issueCode(error, input, field)\n return issue(code, error.message, type, sourcePath, field || undefined)\n}\n\nfunction issueCode(error: DocumentSchemaIssue, input: Schema.JsonObject, field: string): DocumentIssue['code'] {\n if (error.code === 'invalid_type') return nestedValue(input, field) === undefined ? 'schema.required' : 'schema.type'\n if (error.code === 'invalid_value') return 'schema.option'\n return 'schema.constraint'\n}\n\nfunction issuePath(path: DocumentSchemaIssue['path']): string {\n return (path ?? [])\n .map((segment) => (Predicate.hasProperty(segment, 'key') ? segment.key : segment))\n .map(String)\n .join('.')\n}\n\nfunction nestedValue(value: Schema.JsonObject, path: string): Schema.Json | undefined {\n if (!path) return value\n return path.split('.').reduce<Schema.Json | undefined>((current, segment) => {\n if (Array.isArray(current)) {\n const index = Number(segment)\n return Number.isSafeInteger(index) ? current[index] : undefined\n }\n return Schema.is(Schema.JsonObject)(current) ? current[segment] : undefined\n }, value)\n}\n\nfunction issue(\n code: DocumentIssue['code'],\n message: string,\n type: CollectionDefinition,\n sourcePath: SourcePath,\n field?: string,\n): DocumentIssue {\n return {\n code,\n collection: type.collection,\n ...(field === undefined ? undefined : { field }),\n message,\n severity: 'error',\n sourcePath,\n }\n}\n","import type {\n DocumentIssue,\n DocumentSourceMapping,\n CmsMarkdownDocument as MarkdownDocumentType,\n} from '@internal/protocol/Documents'\nimport type { Locale } from '@internal/protocol/Configuration'\nimport type { ComarkParseFn } from 'comark'\nimport type { DocumentCompilationSource } from './compilation-source'\nimport type { ResolvedDocumentEngineConfiguration, ResolvedCollection } from './configuration'\nimport {\n CompiledDocument,\n documentKeyFromSourcePath,\n DocumentSourceMapping as DocumentSourceMappingSchema,\n localizeDocumentPath,\n CmsMarkdownDocument,\n resolveDocumentAddress,\n} from '@internal/protocol/Documents'\nimport { PublicPath } from '@internal/protocol/Documents'\nimport { Effect, Predicate, Result, Schema } from 'effect'\nimport { DocumentCompilationFailed, DocumentParseFailed } from './errors'\nimport { normalizeCmsComponentBindings } from '../comark/bindings'\nimport { analyzeCmsDocument } from '../comark/analysis'\nimport { DOCUMENT_ENGINE_FINGERPRINT } from '../comark/grammar'\nimport { validateFrontmatter } from './frontmatter-validation'\nimport { SOURCE_MAPPINGS_META_KEY } from '../comark/source-mapping'\nimport { validateAuthoringDocument } from '../../AuthoringSchema'\n\nconst isDocumentParseFailed = Schema.is(DocumentParseFailed)\n\nexport const compileCompiledDocument = Effect.fn('DocumentEngine.compileDocument')(function* (\n configuration: ResolvedDocumentEngineConfiguration,\n parseMarkdown: ComarkParseFn,\n source: DocumentCompilationSource,\n) {\n const location = yield* resolveSourceLocation(configuration, source)\n const parsedBody = yield* parseBody(parseMarkdown, source)\n const mappings = yield* sourceMappings(parsedBody, source)\n const body = normalizeCmsComponentBindings(withoutSourceMappings(parsedBody), configuration.components)\n const relativeKey = yield* fromAddressResult(\n documentKeyFromSourcePath(location.relativeSourcePath),\n source.sourcePath,\n )\n const validation = yield* validateFrontmatter(\n body.frontmatter,\n location.type.schema,\n location.type.definition,\n source.sourcePath,\n ).pipe(\n Effect.mapError(\n (cause) =>\n new DocumentCompilationFailed({\n issues: [\n {\n code: 'schema.constraint',\n collection: location.type.definition.collection,\n message: cause.message,\n severity: 'error',\n sourcePath: source.sourcePath,\n },\n ],\n }),\n ),\n )\n const address = resolveDocumentAddress(location.type.address, relativeKey, validation.data)\n const key = Result.isSuccess(address) ? address.success : provisionalKey(source.documentId)\n const path = localizeDocumentPath(key, location.locale, configuration.documents.locales)\n const title =\n stringValue(validation.data.title) ?? stringValue(body.meta.title) ?? titleFromSource(location.relativeSourcePath)\n const description = stringValue(validation.data.description) ?? stringValue(body.meta.description)\n const issues = Result.isSuccess(address)\n ? validation.issues\n : [...validation.issues, addressIssue(address.failure, source.sourcePath)]\n const canonicalBody = CmsMarkdownDocument.make({ frontmatter: validation.data, meta: body.meta, nodes: body.nodes })\n const analysis = analyzeCmsDocument(canonicalBody, description === undefined ? { title } : { description, title })\n\n return CompiledDocument.make(\n Object.assign(\n {\n id: source.documentId,\n key,\n path,\n collection: location.type.definition.collection,\n draft: source.draft,\n title,\n data: validation.data,\n issues: [\n ...issues,\n ...validateAuthoringDocument(canonicalBody, configuration.components, location.type.definition.body).map(\n (message): DocumentIssue => ({\n code: 'reference.component',\n message,\n severity: 'error',\n sourcePath: source.sourcePath,\n }),\n ),\n ],\n analysis,\n body: canonicalBody,\n engineFingerprint: DOCUMENT_ENGINE_FINGERPRINT,\n source: {\n path: source.sourcePath,\n mappings,\n },\n },\n location.locale === undefined ? undefined : { locale: location.locale },\n description === undefined ? undefined : { description },\n ),\n )\n})\n\nfunction provisionalKey(documentId: DocumentCompilationSource['documentId']): PublicPath {\n return PublicPath.make(`/_cms-invalid/${documentId}`)\n}\n\nfunction addressIssue(\n error: { readonly field?: string; readonly message: string },\n sourcePath: DocumentCompilationSource['sourcePath'],\n): DocumentIssue {\n const issue = {\n code: 'document.invalid' as const,\n message: error.message,\n severity: 'error' as const,\n sourcePath,\n }\n return error.field === undefined ? issue : { ...issue, field: error.field }\n}\n\ninterface SourceLocation {\n readonly locale?: Locale\n readonly relativeSourcePath: string\n readonly type: ResolvedCollection\n}\n\nfunction resolveSourceLocation(\n configuration: ResolvedDocumentEngineConfiguration,\n source: DocumentCompilationSource,\n): Effect.Effect<SourceLocation, DocumentCompilationFailed> {\n const segments = source.sourcePath.split('/')\n let locale: Locale | undefined\n if (configuration.documents.locales) {\n const candidate = segments.shift()\n locale = configuration.documents.locales.locales.find((value) => value === candidate)\n if (!locale) {\n return compilationFailure({\n code: 'document.invalid',\n field: 'locale',\n message: `Localized document \"${source.sourcePath}\" must begin with a configured locale.`,\n severity: 'error',\n sourcePath: source.sourcePath,\n })\n }\n }\n\n const localizedSourcePath = segments.join('/')\n const type = configuration.types.find(\n ({ definition }) => definition.directory === '.' || localizedSourcePath.startsWith(`${definition.directory}/`),\n )\n if (!type) {\n return compilationFailure({\n code: 'document.invalid',\n field: 'sourcePath',\n message: `No document collection contains \"${source.sourcePath}\".`,\n severity: 'error',\n sourcePath: source.sourcePath,\n })\n }\n\n const relativeSourcePath =\n type.definition.directory === '.'\n ? localizedSourcePath\n : localizedSourcePath.slice(type.definition.directory.length + 1)\n if (!relativeSourcePath) {\n return compilationFailure({\n code: 'document.invalid',\n field: 'sourcePath',\n message: `Document source \"${source.sourcePath}\" has no collection-relative path.`,\n severity: 'error',\n sourcePath: source.sourcePath,\n })\n }\n\n return Effect.succeed(locale === undefined ? { relativeSourcePath, type } : { locale, relativeSourcePath, type })\n}\n\nfunction parseBody(\n parseMarkdown: ComarkParseFn,\n source: DocumentCompilationSource,\n): Effect.Effect<MarkdownDocumentType, DocumentParseFailed> {\n return Effect.tryPromise({\n try: () => parseMarkdown(source.markdown),\n catch: (cause) => new DocumentParseFailed({ cause, sourcePath: source.sourcePath }),\n }).pipe(\n Effect.flatMap(Schema.decodeUnknownEffect(CmsMarkdownDocument)),\n Effect.mapError((cause) =>\n isDocumentParseFailed(cause) ? cause : new DocumentParseFailed({ cause, sourcePath: source.sourcePath }),\n ),\n )\n}\n\nfunction sourceMappings(\n body: MarkdownDocumentType,\n source: DocumentCompilationSource,\n): Effect.Effect<ReadonlyArray<DocumentSourceMapping>, DocumentParseFailed> {\n return Schema.decodeUnknownEffect(Schema.Array(DocumentSourceMappingSchema))(\n body.meta[SOURCE_MAPPINGS_META_KEY] ?? [],\n ).pipe(Effect.mapError((cause) => new DocumentParseFailed({ cause, sourcePath: source.sourcePath })))\n}\n\nfunction withoutSourceMappings(body: MarkdownDocumentType): MarkdownDocumentType {\n const { [SOURCE_MAPPINGS_META_KEY]: _mappings, ...meta } = body.meta\n return CmsMarkdownDocument.make({ frontmatter: body.frontmatter, meta, nodes: body.nodes })\n}\n\nfunction fromAddressResult<A>(\n result: Result.Result<A, { readonly field?: string; readonly message: string }>,\n sourcePath: DocumentCompilationSource['sourcePath'],\n): Effect.Effect<A, DocumentCompilationFailed> {\n if (Result.isSuccess(result)) return Effect.succeed(result.success)\n return compilationFailure(addressIssue(result.failure, sourcePath))\n}\n\nfunction compilationFailure(issue: DocumentIssue): Effect.Effect<never, DocumentCompilationFailed> {\n return Effect.fail(new DocumentCompilationFailed({ issues: [issue] }))\n}\n\nfunction stringValue(value: Schema.Json | undefined): string | undefined {\n return Predicate.isString(value) && value.trim() ? value.trim() : undefined\n}\n\nfunction titleFromSource(sourcePath: string): string {\n const file = sourcePath.split('/').at(-1) ?? 'content'\n const stem = file.replace(/\\.(?:md|mdc)$/iu, '')\n const title = stem.toLocaleLowerCase() === 'index' ? (sourcePath.split('/').at(-2) ?? 'home') : stem\n return title.replace(/[-_]+/gu, ' ').replace(/^./u, (character) => character.toLocaleUpperCase())\n}\n","import type { Locale } from '@internal/protocol/Configuration'\nimport type { CompiledDocument, PublicPath } from '@internal/protocol/Documents'\nimport type { ResolvedDocumentEngineConfiguration } from './configuration'\nimport { normalizePublicPath } from '@internal/protocol/Documents'\nimport { Option, Result } from 'effect'\n\nexport interface CatalogLookup {\n readonly findByKey: (key: string, locale?: Locale) => Option.Option<CompiledDocument>\n readonly findByPath: (path: string) => Option.Option<CompiledDocument>\n}\n\nexport function createCatalogLookup(\n documents: ReadonlyArray<CompiledDocument>,\n configuration: ResolvedDocumentEngineConfiguration,\n): CatalogLookup {\n const byPath = new Map(documents.map((document) => [document.path, document]))\n const byVariant = new Map(documents.map((document) => [localeAndKey(document.locale, document.key), document]))\n\n const findByKey = (input: string, locale?: Locale) => {\n const keyResult = normalizePublicPath(input)\n if (Result.isFailure(keyResult)) return Option.none<CompiledDocument>()\n const key = keyResult.success\n const locales = configuration.documents.locales\n if (!locales) return Option.fromNullishOr(byVariant.get(localeAndKey(undefined, key)))\n const requestedLocale = locale ?? locales.defaultLocale\n const localized = byVariant.get(localeAndKey(requestedLocale, key))\n if (localized) return Option.some(localized)\n if (!locales.fallbackLocale) return Option.none()\n return Option.fromNullishOr(byVariant.get(localeAndKey(locales.fallbackLocale, key)))\n }\n\n const findByPath = (input: string) => {\n const pathResult = normalizePublicPath(input)\n if (Result.isFailure(pathResult)) return Option.none<CompiledDocument>()\n const path = pathResult.success\n const direct = byPath.get(path)\n if (direct) return Option.some(direct)\n\n const locales = configuration.documents.locales\n if (!locales) return Option.none()\n const request = localizedRequest(path, locales.locales, locales.defaultLocale, locales.prefixDefaultLocale)\n if (!request) return Option.none()\n const localized = byVariant.get(localeAndKey(request.locale, request.key))\n if (localized) return Option.some(localized)\n if (!locales.fallbackLocale) return Option.none()\n return Option.fromNullishOr(byVariant.get(localeAndKey(locales.fallbackLocale, request.key)))\n }\n\n return { findByKey, findByPath }\n}\n\nexport function localeAndKey(locale: Locale | undefined, key: PublicPath): string {\n return `${locale ?? ''}:${key}`\n}\n\nfunction localizedRequest(\n path: PublicPath,\n locales: ReadonlyArray<Locale>,\n defaultLocale: Locale,\n prefixDefaultLocale: boolean,\n): { readonly key: PublicPath; readonly locale: Locale } | undefined {\n const segments = path === '/' ? [] : path.slice(1).split('/')\n const possibleLocale = locales.find((locale) => locale === segments[0])\n const prefixedLocale =\n possibleLocale && (possibleLocale !== defaultLocale || prefixDefaultLocale) ? possibleLocale : undefined\n if (prefixedLocale) {\n const keyResult = normalizePublicPath(segments.slice(1).join('/'))\n return Result.isSuccess(keyResult) ? { key: keyResult.success, locale: prefixedLocale } : undefined\n }\n if (prefixDefaultLocale) return undefined\n return { key: path, locale: defaultLocale }\n}\n","import type { CompiledDocument, DocumentIssue, PublicPath } from '@internal/protocol/Documents'\nimport type { ResolvedDocumentEngineConfiguration } from './configuration'\nimport { localeAndKey } from './catalog-lookup'\n\nexport function collisionIssues(documents: ReadonlyArray<CompiledDocument>): DocumentIssue[] {\n const issues: DocumentIssue[] = []\n const byId = new Map<string, CompiledDocument>()\n const byPath = new Map<string, CompiledDocument>()\n const byVariant = new Map<string, CompiledDocument>()\n\n for (const document of documents) {\n const identityCollision = byId.get(document.id)\n if (identityCollision) {\n issues.push(\n collisionIssue(\n `Document identity collision for \"${document.id}\" between \"${identityCollision.source.path}\" and \"${document.source.path}\".`,\n document,\n ),\n )\n } else byId.set(document.id, document)\n\n const pathCollision = byPath.get(document.path)\n if (pathCollision) {\n issues.push(\n collisionIssue(\n `Document route collision at \"${document.path}\" between \"${pathCollision.source.path}\" and \"${document.source.path}\".`,\n document,\n document.path,\n ),\n )\n } else byPath.set(document.path, document)\n\n const variant = localeAndKey(document.locale, document.key)\n const variantCollision = byVariant.get(variant)\n if (variantCollision && variantCollision.path !== pathCollision?.path) {\n issues.push(\n collisionIssue(\n `Document locale collision at \"${document.key}\" between \"${variantCollision.source.path}\" and \"${document.source.path}\".`,\n document,\n document.key,\n ),\n )\n } else byVariant.set(variant, document)\n }\n return issues\n}\n\nexport function translationIssues(\n documents: ReadonlyArray<CompiledDocument>,\n configuration: ResolvedDocumentEngineConfiguration,\n): DocumentIssue[] {\n const locales = configuration.documents.locales\n if (!locales) return []\n const variants = new Set(documents.map((document) => localeAndKey(document.locale, document.key)))\n const keys = new Set(documents.map((document) => document.key))\n return [...keys].flatMap((key) =>\n locales.locales.flatMap((locale): DocumentIssue[] =>\n variants.has(localeAndKey(locale, key))\n ? []\n : [\n {\n code: 'i18n.missing-translation',\n key,\n locale,\n message: `Document \"${key}\" is missing its \"${locale}\" translation.`,\n severity: 'warning',\n },\n ],\n ),\n )\n}\n\nfunction collisionIssue(message: string, document: CompiledDocument, key?: PublicPath): DocumentIssue {\n const issue = {\n code: 'document.collision' as const,\n message,\n severity: 'error' as const,\n sourcePath: document.source.path,\n }\n return key === undefined ? issue : Object.assign(issue, { key })\n}\n","import type { PublicPath } from '@internal/protocol/Documents'\nimport type { CmsComarkAttributeValue, CmsComarkAttributes } from '../comark/bindings'\nimport { normalizePublicPath } from '@internal/protocol/Documents'\nimport { Predicate, Result } from 'effect'\nimport { CMS_STANDARD_TAGS } from '../comark/analysis'\n\nexport type DocumentReferenceTarget =\n | { readonly kind: 'component'; readonly name: string }\n | { readonly kind: 'document'; readonly path: PublicPath }\n | { readonly kind: 'media'; readonly key: string }\n\nexport function referenceTarget(\n tag: string,\n attributes: CmsComarkAttributes,\n documentPath: PublicPath,\n mediaBaseUrl: string | undefined,\n): DocumentReferenceTarget | undefined {\n if (tag === 'a') {\n const path = documentTarget(attributes.get('href'), documentPath)\n return path ? { kind: 'document', path } : undefined\n }\n if (tag === 'img') {\n const key = mediaKey(attributes.get('src'), mediaBaseUrl)\n return key ? { kind: 'media', key } : undefined\n }\n\n const normalizedTag = tag.toLocaleLowerCase()\n return CMS_STANDARD_TAGS.has(normalizedTag) ? undefined : { kind: 'component', name: normalizedTag }\n}\n\nexport function targetKey(target: DocumentReferenceTarget): string {\n switch (target.kind) {\n case 'component':\n return `component:${target.name.toLocaleLowerCase()}`\n case 'document':\n return `document:${target.path}`\n case 'media':\n return `media:${target.key}`\n }\n}\n\nfunction mediaKey(value: CmsComarkAttributeValue, mediaBaseUrl: string | undefined): string | undefined {\n if (!Predicate.isString(value) || mediaBaseUrl === undefined) return undefined\n const prefix = `${mediaBaseUrl}/`\n if (!value.startsWith(prefix)) return undefined\n const encodedKey = value.slice(prefix.length).split(/[?#]/u, 1)[0]\n if (!encodedKey) return undefined\n\n try {\n const segments = encodedKey.split('/').map(decodeURIComponent)\n if (\n segments.some(\n (segment) =>\n !segment ||\n segment === '.' ||\n segment === '..' ||\n segment.includes('/') ||\n segment.includes('\\\\') ||\n hasControlCharacter(segment),\n )\n ) {\n return undefined\n }\n const key = segments.join('/')\n return key.startsWith('media/') ? key : undefined\n } catch {\n return undefined\n }\n}\n\nfunction documentTarget(value: CmsComarkAttributeValue, documentPath: PublicPath): PublicPath | undefined {\n if (!Predicate.isString(value)) return undefined\n const href = value.trim()\n if (\n !href ||\n href.startsWith('#') ||\n href.startsWith('?') ||\n href.startsWith('//') ||\n /^[a-z][a-z\\d+.-]*:/iu.test(href)\n ) {\n return undefined\n }\n\n const path = href.split(/[?#]/u)[0] ?? ''\n const resolvedPath = resolveRelativePath(path, documentPath)\n const lastSegment = resolvedPath.split('/').at(-1) ?? ''\n if (lastSegment.includes('.')) return undefined\n const normalized = normalizePublicPath(resolvedPath)\n return Result.isSuccess(normalized) ? normalized.success : undefined\n}\n\nfunction resolveRelativePath(href: string, documentPath: PublicPath): string {\n const normalizedHref = href.replace(/\\\\/gu, '/')\n const segments = normalizedHref.startsWith('/') ? [] : documentPath.split('/').filter(Boolean).slice(0, -1)\n for (const segment of normalizedHref.split('/')) {\n if (!segment || segment === '.') continue\n if (segment === '..') segments.pop()\n else segments.push(segment)\n }\n return `/${segments.join('/')}`\n}\n\nfunction hasControlCharacter(value: string): boolean {\n for (const character of value) {\n const codePoint = character.codePointAt(0)\n if (codePoint !== undefined && (codePoint <= 31 || codePoint === 127)) return true\n }\n return false\n}\n","import type { BlockProp } from '@internal/protocol/Authoring'\nimport type { CompiledDocument, DocumentId, DocumentIssue, MarkdownNode } from '@internal/protocol/Documents'\nimport type { PublicPath, SourcePath } from '@internal/protocol/Documents'\nimport type { CmsComarkAttributes } from '../comark/bindings'\nimport type { NodeRenderData } from 'comark'\nimport type { ResolvedDocumentEngineConfiguration } from './configuration'\nimport type { DocumentReferenceTarget } from './reference-target'\nimport { Option, Predicate, Schema } from 'effect'\nimport { resolveCmsComarkAttributes, withCmsComarkProps } from '../comark/bindings'\nimport { createCmsComarkRenderData } from '../comark/document-adapter'\nimport { referenceTarget, targetKey } from './reference-target'\n\nexport type { DocumentReferenceTarget } from './reference-target'\n\nexport interface DocumentReference {\n readonly nodePath: ReadonlyArray<number>\n readonly source: {\n readonly documentId: DocumentId\n readonly path: PublicPath\n readonly sourcePath: SourcePath\n }\n readonly target: DocumentReferenceTarget\n}\n\nexport interface DocumentReferenceIndex {\n readonly all: ReadonlyArray<DocumentReference>\n readonly impact: (target: DocumentReferenceTarget) => ReadonlyArray<DocumentReference>\n}\n\ninterface IndexedDocumentReferences {\n readonly index: DocumentReferenceIndex\n readonly issues: ReadonlyMap<SourcePath, ReadonlyArray<DocumentIssue>>\n}\n\nconst noReferences: ReadonlyArray<DocumentReference> = Object.freeze([])\n\nexport function createDocumentReferenceIndex(\n documents: ReadonlyArray<CompiledDocument>,\n configuration: ResolvedDocumentEngineConfiguration,\n findByPath: (path: string) => Option.Option<CompiledDocument>,\n): IndexedDocumentReferences {\n const all: DocumentReference[] = []\n const byTarget = new Map<string, DocumentReference[]>()\n const issues = new Map<SourcePath, DocumentIssue[]>()\n\n for (const document of documents) {\n visit(document.body.nodes, createCmsComarkRenderData(document.body), (tag, attributes, children, nodePath) => {\n const targets = [\n referenceTarget(tag, attributes, document.path, configuration.mediaBaseUrl),\n ...propertyTargets(\n configuration.components?.get(tag.toLowerCase())?.authoring.props ?? [],\n Object.fromEntries([...attributes].flatMap(([key, value]) => (value === undefined ? [] : [[key, value]]))),\n document.path,\n configuration.mediaBaseUrl,\n ),\n ]\n for (const target of targets) {\n if (!target) continue\n\n const reference = freezeReference({\n nodePath,\n source: {\n documentId: document.id,\n path: document.path,\n sourcePath: document.source.path,\n },\n target,\n })\n all.push(reference)\n const key = targetKey(target)\n const matching = byTarget.get(key) ?? []\n matching.push(reference)\n byTarget.set(key, matching)\n\n if (target.kind === 'document' && Option.isNone(findByPath(target.path))) {\n addIssue(issues, document.source.path, {\n code: 'reference.document',\n key: target.path,\n message: `Document link \"${target.path}\" does not resolve.`,\n severity: 'error',\n sourcePath: document.source.path,\n })\n }\n }\n })\n }\n\n const frozenAll = Object.freeze(all)\n const frozenByTarget = new Map([...byTarget].map(([key, references]) => [key, Object.freeze(references)] as const))\n\n return {\n index: Object.freeze({\n all: frozenAll,\n impact: (target: DocumentReferenceTarget) => frozenByTarget.get(targetKey(target)) ?? noReferences,\n }),\n issues,\n }\n}\n\nfunction visit(\n nodes: CompiledDocument['body']['nodes'],\n renderData: NodeRenderData,\n onElement: (\n tag: string,\n attributes: CmsComarkAttributes,\n children: ReadonlyArray<MarkdownNode>,\n nodePath: ReadonlyArray<number>,\n ) => void,\n parentPath: ReadonlyArray<number> = [],\n): void {\n nodes.forEach((node, index) => {\n if (Predicate.isString(node) || node[0] === null) return\n const [tag, attributes, ...children] = node\n const nodePath = [...parentPath, index]\n const resolved = resolveCmsComarkAttributes(attributes, renderData)\n onElement(tag, resolved, children, nodePath)\n const childrenRenderData = withCmsComarkProps(renderData, resolved)\n visit(children, childrenRenderData, onElement, nodePath)\n })\n}\n\nfunction freezeReference(reference: DocumentReference): DocumentReference {\n return Object.freeze({\n nodePath: Object.freeze([...reference.nodePath]),\n source: Object.freeze({ ...reference.source }),\n target: Object.freeze({ ...reference.target }),\n })\n}\n\nfunction addIssue(issues: Map<SourcePath, DocumentIssue[]>, sourcePath: SourcePath, issue: DocumentIssue): void {\n const sourceIssues = issues.get(sourcePath) ?? []\n sourceIssues.push(issue)\n issues.set(sourcePath, sourceIssues)\n}\n\nfunction propertyTargets(\n fields: ReadonlyArray<BlockProp>,\n values: Schema.JsonObject,\n path: PublicPath,\n mediaBaseUrl: string | undefined,\n): DocumentReferenceTarget[] {\n return fields.flatMap((field) => {\n const value = values[field.name] === undefined ? field.defaultValue : values[field.name]\n if (field.input === 'link' || field.input === 'image') {\n const target = referenceTarget(\n field.input === 'link' ? 'a' : 'img',\n new Map([[field.input === 'link' ? 'href' : 'src', value]]),\n path,\n mediaBaseUrl,\n )\n return target ? [target] : []\n }\n if (field.fields)\n return (Array.isArray(value) ? value : [value]).flatMap((entry) =>\n Schema.is(Schema.JsonObject)(entry) ? propertyTargets(field.fields ?? [], entry, path, mediaBaseUrl) : [],\n )\n return []\n })\n}\n","import type { Locale } from '@internal/protocol/Configuration'\nimport type { CompiledDocument, DocumentIssue } from '@internal/protocol/Documents'\nimport type { Option, Result } from 'effect'\nimport type { ResolvedDocumentEngineConfiguration } from './configuration'\nimport type { DocumentReferenceIndex } from './references'\nimport { CompiledDocument as CompiledDocumentSchema } from '@internal/protocol/Documents'\nimport { Result as EffectResult } from 'effect'\nimport { collisionIssues, translationIssues } from './catalog-issues'\nimport { createCatalogLookup } from './catalog-lookup'\nimport { DocumentCompilationFailed } from './errors'\nimport { createDocumentReferenceIndex } from './references'\n\nexport interface DocumentCatalog {\n readonly documents: ReadonlyArray<CompiledDocument>\n readonly issues: ReadonlyArray<DocumentIssue>\n readonly findByKey: (key: string, locale?: Locale) => Option.Option<CompiledDocument>\n readonly findByPath: (path: string) => Option.Option<CompiledDocument>\n readonly references: DocumentReferenceIndex\n}\n\nexport function createDocumentCatalog(\n configuration: ResolvedDocumentEngineConfiguration,\n input: ReadonlyArray<CompiledDocument>,\n): Result.Result<DocumentCatalog, DocumentCompilationFailed> {\n const documents = [...input].sort((left, right) => left.source.path.localeCompare(right.source.path))\n const collisions = collisionIssues(documents)\n if (collisions.length > 0) return EffectResult.fail(new DocumentCompilationFailed({ issues: collisions }))\n\n const lookup = createCatalogLookup(documents, configuration)\n const references = createDocumentReferenceIndex(documents, configuration, lookup.findByPath)\n const withReferenceIssues = documents.map((document) => {\n const additional = references.issues.get(document.source.path) ?? []\n return additional.length === 0\n ? document\n : CompiledDocumentSchema.make(Object.assign({}, document, { issues: [...document.issues, ...additional] }))\n })\n\n return EffectResult.succeed({\n documents: withReferenceIssues,\n issues: [\n ...withReferenceIssues.flatMap((document) => document.issues),\n ...translationIssues(withReferenceIssues, configuration),\n ],\n ...createCatalogLookup(withReferenceIssues, configuration),\n references: references.index,\n } satisfies DocumentCatalog)\n}\n","import type { ComponentDefinition, DocumentConfiguration, CollectionDefinition } from '@internal/protocol/Configuration'\nimport type { DocumentAddress } from '@internal/protocol/Documents'\nimport type { ExecutableDocumentModel, ExecutableDocumentSchema } from './document-schema'\nimport { parseDocumentAddress } from '@internal/protocol/Documents'\nimport { validateCollectionBody } from '../../AuthoringSchema'\nimport { Result } from 'effect'\nimport { DocumentEngineConfigurationInvalid } from './errors'\n\nexport interface ResolvedCollection {\n readonly address: DocumentAddress\n readonly definition: CollectionDefinition\n readonly schema: ExecutableDocumentSchema\n}\n\nexport interface ResolvedDocumentEngineConfiguration {\n readonly components?: ReadonlyMap<string, ComponentDefinition>\n readonly documents: DocumentConfiguration\n readonly mediaBaseUrl?: string\n readonly types: ReadonlyArray<ResolvedCollection>\n}\n\nexport interface DocumentEngineOptions {\n readonly components?: ReadonlyArray<ComponentDefinition>\n readonly documentModel: ExecutableDocumentModel\n readonly mediaBaseUrl?: string\n}\n\ntype ResolvedDocumentEngineConfigurationBuilder = {\n -readonly [Key in keyof ResolvedDocumentEngineConfiguration]: ResolvedDocumentEngineConfiguration[Key]\n}\n\nexport function resolveDocumentEngineConfiguration(\n documents: DocumentConfiguration,\n options: DocumentEngineOptions,\n): Result.Result<ResolvedDocumentEngineConfiguration, DocumentEngineConfigurationInvalid> {\n if (documents.types.length === 0) return invalid('Documents must define at least one collection.', 'types')\n\n const collections = new Set<string>()\n const directories = new Map<string, string>()\n const resolved: ResolvedCollection[] = []\n\n for (const definition of documents.types) {\n if (collections.has(definition.collection)) {\n return invalid(`Document collection \"${definition.collection}\" is defined more than once.`, 'types')\n }\n collections.add(definition.collection)\n\n const existing = directories.get(definition.directory)\n if (existing) {\n return invalid(\n `Document collections \"${existing}\" and \"${definition.collection}\" use the same directory \"${definition.directory}\".`,\n 'types',\n )\n }\n directories.set(definition.directory, definition.collection)\n\n const addressResult = parseDocumentAddress(definition.addressPattern)\n if (Result.isFailure(addressResult)) return invalid(addressResult.failure.message, addressResult.failure.field)\n if (definition.hierarchy && !addressResult.success.tokens.some((token) => token.catchAll)) {\n return invalid(\n `Document collection \"${definition.collection}\" can only enable hierarchy with a catch-all address.`,\n 'types',\n )\n }\n const schema = options.documentModel.types[definition.collection]\n if (!schema)\n return invalid(`Document collection \"${definition.collection}\" has no executable schema.`, 'documentModel')\n\n resolved.push({ address: addressResult.success, definition, schema })\n }\n\n const locales = documents.locales\n if (locales) {\n if (new Set(locales.locales).size !== locales.locales.length)\n return invalid('Document locales must be unique.', 'locales.locales')\n if (!locales.locales.includes(locales.defaultLocale)) {\n return invalid(`Default locale \"${locales.defaultLocale}\" is not configured.`, 'locales.defaultLocale')\n }\n if (locales.fallbackLocale && !locales.locales.includes(locales.fallbackLocale)) {\n return invalid(`Fallback locale \"${locales.fallbackLocale}\" is not configured.`, 'locales.fallbackLocale')\n }\n }\n\n let components: ReadonlyMap<string, ComponentDefinition> | undefined\n if (options.components !== undefined) {\n const result = resolveComponents(options.components)\n if (Result.isFailure(result)) return Result.fail(result.failure)\n components = result.success\n for (const definition of documents.types) {\n const issues = validateCollectionBody(options.components, definition.body)\n if (issues.length) return invalid(`${definition.label}: ${issues.join(' ')}`, 'body')\n }\n }\n const mediaBaseUrl = options.mediaBaseUrl?.replace(/\\/+$/u, '')\n\n resolved.sort((left, right) => directoryDepth(right.definition.directory) - directoryDepth(left.definition.directory))\n\n const configuration: ResolvedDocumentEngineConfigurationBuilder = {\n documents,\n types: resolved,\n }\n if (components !== undefined) configuration.components = components\n if (mediaBaseUrl !== undefined) configuration.mediaBaseUrl = mediaBaseUrl\n return Result.succeed(configuration satisfies ResolvedDocumentEngineConfiguration)\n}\n\nfunction resolveComponents(\n definitions: ReadonlyArray<ComponentDefinition>,\n): Result.Result<ReadonlyMap<string, ComponentDefinition>, DocumentEngineConfigurationInvalid> {\n const components = new Map<string, ComponentDefinition>()\n for (const component of definitions) {\n const name = component.name.toLocaleLowerCase()\n if (components.has(name))\n return invalid(`Document component \"${component.name}\" is defined more than once.`, 'components')\n components.set(name, component)\n }\n return Result.succeed(components)\n}\n\nfunction directoryDepth(directory: string): number {\n return directory === '.' ? 0 : directory.split('/').length\n}\n\nfunction invalid(message: string, field?: string): Result.Result<never, DocumentEngineConfigurationInvalid> {\n return Result.fail(new DocumentEngineConfigurationInvalid(field === undefined ? { message } : { field, message }))\n}\n","import type { DocumentConfiguration } from '@internal/protocol/Configuration'\nimport type { CompiledDocument, DocumentIssue, DocumentValidationResult } from '@internal/protocol/Documents'\nimport type { DocumentCompilationSource } from './internal/document-engine/compilation-source'\nimport type { DocumentEngineOptions } from './internal/document-engine/configuration'\nimport type { DocumentCompilationFailed, DocumentParseFailed } from './internal/document-engine/errors'\nimport type { DocumentCatalog } from './internal/document-engine/catalog'\nimport { DocumentValidationResult as DocumentValidationResultSchema } from '@internal/protocol/Documents'\nimport { Effect, Result, Schema } from 'effect'\nimport { compileCompiledDocument } from './internal/document-engine/compilation'\nimport { DOCUMENT_ENGINE_FINGERPRINT, createDocumentParser } from './internal/comark/grammar'\nimport { createDocumentCatalog } from './internal/document-engine/catalog'\nimport { resolveDocumentEngineConfiguration } from './internal/document-engine/configuration'\nimport { DocumentParseFailed as DocumentParseFailedError } from './internal/document-engine/errors'\n\ntype CompilationError = DocumentCompilationFailed | DocumentParseFailed\n\nexport interface DocumentCatalogCompilation {\n readonly previous?: DocumentCatalog\n readonly sources: ReadonlyArray<DocumentCompilationSource>\n}\n\nconst isDocumentParseFailed = Schema.is(DocumentParseFailedError)\n\n/**\n * Portable authority for compiled Documents. `compileAll` reuses unchanged\n * source compilations from `previous`, then rebuilds the catalog-wide collision,\n * translation, and reference projection. `validate` reports every parse or\n * compilation failure as data and therefore has no error channel.\n */\nexport interface DocumentEngine {\n readonly fingerprint: string\n readonly compile: (source: DocumentCompilationSource) => Effect.Effect<CompiledDocument, CompilationError>\n readonly compileAll: (input: DocumentCatalogCompilation) => Effect.Effect<DocumentCatalog, CompilationError>\n readonly validate: (source: DocumentCompilationSource) => Effect.Effect<DocumentValidationResult>\n}\n\n/** Resolves installation configuration once and rejects an unusable engine before any Source is compiled. */\nexport const createDocumentEngine = Effect.fn('DocumentEngine.make')(function* (\n documents: DocumentConfiguration,\n options: DocumentEngineOptions,\n) {\n const configuration = yield* Effect.fromResult(resolveDocumentEngineConfiguration(documents, options))\n const parseMarkdown = createDocumentParser()\n const compilations = new WeakMap<\n DocumentCatalog,\n ReadonlyMap<string, { readonly document: CompiledDocument; readonly source: DocumentCompilationSource }>\n >()\n\n const compile = Effect.fn('DocumentEngine.compile')((source: DocumentCompilationSource) =>\n compileCompiledDocument(configuration, parseMarkdown, source),\n )\n\n const compileAll = Effect.fn('DocumentEngine.compileAll')(function* (input: DocumentCatalogCompilation) {\n const previous = input.previous ? compilations.get(input.previous) : undefined\n const compiled = yield* Effect.forEach(input.sources, (source) => {\n const cached = previous?.get(source.documentId)\n return cached && sameCompilationSource(cached.source, source) ? Effect.succeed(cached.document) : compile(source)\n })\n const catalog = yield* Effect.fromResult(createDocumentCatalog(configuration, compiled))\n compilations.set(\n catalog,\n new Map(\n input.sources.map((source, index) => {\n const document = compiled[index]\n if (!document) throw new Error(`Compiled document \"${source.documentId}\" is missing.`)\n return [source.documentId, { document, source }] as const\n }),\n ),\n )\n return catalog\n })\n\n const validate = Effect.fn('DocumentEngine.validate')(function* (source: DocumentCompilationSource) {\n const result = yield* Effect.result(compile(source))\n if (Result.isSuccess(result)) {\n const document = result.success\n return DocumentValidationResultSchema.make({\n valid: !document.issues.some((issue) => issue.severity === 'error'),\n document,\n issues: document.issues,\n })\n }\n\n const error = result.failure\n const issues: ReadonlyArray<DocumentIssue> = isDocumentParseFailed(error)\n ? [\n {\n code: 'markdown.parse',\n message: errorMessage(error.cause),\n severity: 'error',\n sourcePath: error.sourcePath,\n },\n ]\n : error.issues\n return DocumentValidationResultSchema.make({\n valid: false,\n issues,\n })\n })\n\n return {\n compile,\n compileAll,\n fingerprint: DOCUMENT_ENGINE_FINGERPRINT,\n validate,\n } satisfies DocumentEngine\n})\n\nfunction sameCompilationSource(left: DocumentCompilationSource, right: DocumentCompilationSource): boolean {\n return (\n left.documentId === right.documentId &&\n left.draft === right.draft &&\n left.markdown === right.markdown &&\n left.sourcePath === right.sourcePath\n )\n}\n\nfunction errorMessage(cause: unknown): string {\n return cause instanceof Error && cause.message ? cause.message : 'Markdown could not be parsed.'\n}\n\nexport { DocumentCompilationSource } from './internal/document-engine/compilation-source'\nexport type { DocumentCatalog } from './internal/document-engine/catalog'\nexport type { DocumentEngineOptions } from './internal/document-engine/configuration'\nexport {\n DocumentCompilationFailed,\n DocumentEngineConfigurationInvalid,\n DocumentParseFailed,\n} from './internal/document-engine/errors'\nexport type {\n DocumentReference,\n DocumentReferenceIndex,\n DocumentReferenceTarget,\n} from './internal/document-engine/references'\nexport type {\n DocumentSchemaIssue,\n DocumentSchemaProjection,\n DocumentSchemaValidation,\n ExecutableDocumentModel,\n ExecutableDocumentSchema,\n} from './internal/document-engine/document-schema'\n"],"mappings":";;;;;;AAoBA,MAAM,sBAAsB;AAE5B,SAAgB,qBAAqB,SAA+E;CAElH,MAAM,SAAS,CADE,GAAG,QAAQ,SAAS,mBAAmB,CACnC,CAAC,CAAC,KAAK,WAAW;EACrC,UAAU,MAAM,OAAO;EACvB,MAAM,MAAM,MAAM;CACpB,EAAE;CAGF,IAFkB,QAAQ,QAAQ,qBAAqB,EAE3C,CAAC,CAAC,SAAS,GAAG,KAAK,OAAO,MAAM,UAAU,CAAC,MAAM,IAAI,GAC/D,OAAO,OAAO,KAAK;EACjB,OAAO;EACP,SAAS,6BAA6B,QAAQ;CAChD,CAAC;CAEH,IAAI,OAAO,QAAQ,UAAU,MAAM,QAAQ,CAAC,CAAC,SAAS,GACpD,OAAO,OAAO,KAAK;EACjB,OAAO;EACP,SAAS,6BAA6B,QAAQ;CAChD,CAAC;CAEH,IAAI,IAAI,IAAI,OAAO,KAAK,UAAU,MAAM,IAAI,CAAC,CAAC,CAAC,SAAS,OAAO,QAC7D,OAAO,OAAO,KAAK;EACjB,OAAO;EACP,SAAS,6BAA6B,QAAQ;CAChD,CAAC;CAGH,OAAO,OAAO,QAAQ;EAAE;EAAS;CAAO,CAAC;AAC3C;AAEA,SAAgB,uBACd,SACA,aACA,MACiD;CACjD,MAAM,eAAe,gBAAgB,MAAM,KAAK,YAA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sBAAsB,MAAiC,OAA2C;CACzG,OACE,KAAK,eAAe,MAAM,cAC1B,KAAK,UAAU,MAAM,SACrB,KAAK,aAAa,MAAM,YACxB,KAAK,eAAe,MAAM;AAE9B;AAEA,SAAS,aAAa,OAAwB;CAC5C,OAAO,iBAAiB,SAAS,MAAM,UAAU,MAAM,UAAU;AACnE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HttpPaths-BbS21Jy8.js","names":[],"sources":["../../../../protocol/src/HttpPaths.ts"],"sourcesContent":["export const STUDIO_BASE_PATH = '/_cms'\nexport const STUDIO_APP_PATH = `${STUDIO_BASE_PATH}/app`\nexport const STUDIO_API_PATH = `${STUDIO_BASE_PATH}/api`\nexport const STUDIO_COLLABORATION_PATH = `${STUDIO_BASE_PATH}/collaboration`\nexport const STUDIO_HEALTH_PATH = `${STUDIO_BASE_PATH}/health`\nexport const CMS_AUTHENTICATION_PATH = '/api/cms/auth'\nexport const CMS_LIVENESS_PATH = `${STUDIO_HEALTH_PATH}/live`\nexport const CMS_READINESS_PATH = `${STUDIO_HEALTH_PATH}/ready`\nexport const CMS_DELIVERY_READ_PATH = `${STUDIO_API_PATH}/delivery/read`\nexport const CMS_DELIVERY_QUERY_PATH = `${STUDIO_API_PATH}/delivery/query`\nexport const CMS_PREVIEW_READ_PATH = `${STUDIO_API_PATH}/preview/read`\nexport const CMS_PREVIEW_QUERY_PATH = `${STUDIO_API_PATH}/preview/query`\n"],"mappings":";AAAA,MAAa,mBAAmB;AAChC,MAAa,kBAAkB,GAAG,iBAAiB;AACnD,MAAa,kBAAkB,GAAG,iBAAiB;AACnD,MAAa,4BAA4B,GAAG,iBAAiB;AAC7D,MAAa,qBAAqB,GAAG,iBAAiB;AACtD,MAAa,0BAA0B;AACvC,MAAa,oBAAoB,GAAG,mBAAmB;AACvD,MAAa,qBAAqB,GAAG,mBAAmB;AACxD,MAAa,yBAAyB,GAAG,gBAAgB;AACzD,MAAa,0BAA0B,GAAG,gBAAgB;AAC1D,MAAa,wBAAwB,GAAG,gBAAgB;AACxD,MAAa,yBAAyB,GAAG,gBAAgB"}
|