@phtngyn/cms 0.2.0-beta.5 → 0.2.0-beta.7
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/package.json +1 -1
- package/src/{Configuration-JQ1qyaU0.js → Configuration-Da5B2PVH.js} +2 -2
- package/src/{Configuration-JQ1qyaU0.js.map → Configuration-Da5B2PVH.js.map} +1 -1
- package/src/Content.js +3 -3
- package/src/Content.js.map +1 -1
- package/src/{DocumentEngine-j6Vi7nQo.js → DocumentEngine-hh_IGPXO.js} +2 -2
- package/src/{DocumentEngine-j6Vi7nQo.js.map → DocumentEngine-hh_IGPXO.js.map} +1 -1
- package/src/Module.js +1 -1
- package/src/{S3MediaObjects-BRuPQbxl.js → S3MediaObjects-Dwhl2deX.js} +4 -4
- package/src/{S3MediaObjects-BRuPQbxl.js.map → S3MediaObjects-Dwhl2deX.js.map} +1 -1
- package/src/cli.js +3 -3
- package/src/{dev-lifecycle-DdBluSiR.js → dev-lifecycle-CjDq63Ft.js} +8 -8
- package/src/dev-lifecycle-CjDq63Ft.js.map +1 -0
- package/src/{installation-BoG8E3nJ.js → installation-DYNQQBD3.js} +7 -9
- package/src/{installation-BoG8E3nJ.js.map → installation-DYNQQBD3.js.map} +1 -1
- package/src/internal/authoring-catalog.js +1 -1
- package/src/internal/authoring-metadata.js +1 -1
- package/src/internal/configuration.js +1 -1
- package/src/internal/dev-lifecycle.js +1 -1
- package/src/internal/document-model.js +2 -2
- package/src/{metadata-UzZmjwxM.js → metadata-DN9_K6Yl.js} +87 -7
- package/src/metadata-DN9_K6Yl.js.map +1 -0
- package/src/runtime/installation.js +1 -1
- package/src/runtime/plugin.js +1 -1
- package/src/runtime/preview/controller.js +3 -2
- package/src/runtime/preview/controller.js.map +1 -1
- package/src/runtime/preview/crypto.js +16 -0
- package/src/runtime/preview/crypto.js.map +1 -0
- package/src/runtime/preview/plugin.client.js +1 -1
- package/src/runtime/preview/store.js +1 -1
- package/src/runtime/studio-app.js +1 -1
- package/src/runtime/studio-app.js.map +1 -1
- package/src/runtime/studio-document.js +46 -0
- package/src/runtime/studio-document.js.map +1 -0
- package/src/runtime/studio-entry.js +5 -22
- package/src/runtime/studio-entry.js.map +1 -1
- package/src/{store-PKKB8xa2.js → store-X1e1o_MF.js} +2 -2
- package/src/{store-PKKB8xa2.js.map → store-X1e1o_MF.js.map} +1 -1
- package/studio/CreateDocumentDialog-BpjBYGfI.js +335 -0
- package/studio/{documentPlanning-Bx3W9KkD.js → SelectMenu-KiXwx4Y_.js} +15513 -11376
- package/studio/host.css +1 -1
- package/studio/host.js +10343 -14430
- package/src/dev-lifecycle-DdBluSiR.js.map +0 -1
- package/src/metadata-UzZmjwxM.js.map +0 -1
- package/studio/CreateDocumentDialog-vQ8hDs2C.js +0 -253
package/src/Content.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Content.js","names":["ContentSnapshotSchema","ContentSourceSchema","ProtocolContentPlanSchema","ContentApplyResultSchema","ContentSnapshotSourceSchema"],"sources":["../../../src/Content.ts"],"sourcesContent":["/* oxlint-disable effecttsgo/async-function effecttsgo/extends-native-error effecttsgo/node-builtin-import -- This public Node-only API deliberately exposes Promises, native filesystem paths, and an Error subclass to ordinary deployment scripts. */\nimport type {\n ContentApplyResult,\n ContentPlan as ProtocolContentPlan,\n ContentPlanEntry,\n ContentSnapshotSource,\n ContentSource,\n ContentSnapshot,\n} from '@internal/protocol/ContentTransfer'\nimport {\n ContentApplyResult as ContentApplyResultSchema,\n ContentFilePath,\n ContentPlan as ProtocolContentPlanSchema,\n ContentSnapshotSource as ContentSnapshotSourceSchema,\n ContentSource as ContentSourceSchema,\n ContentSnapshot as ContentSnapshotSchema,\n} from '@internal/protocol/ContentTransfer'\nimport type { DocumentIssue } from '@internal/protocol/Documents'\nimport { DocumentIdentity, DocumentPlacement, DocumentValidationFailed } from '@internal/protocol/Documents'\nimport { CMS_AUTHENTICATION_PATH, STUDIO_API_PATH } from '@internal/protocol/HttpPaths'\nimport { Result, Schema } from 'effect'\nimport { createHash } from 'node:crypto'\nimport { lstat, readdir, readFile, mkdir, writeFile } from 'node:fs/promises'\nimport { dirname, extname, relative, resolve, sep } from 'node:path'\n\nexport type CmsContentErrorCode =\n | 'authentication-required'\n | 'content-conflict'\n | 'filesystem-error'\n | 'generation-changed'\n | 'invalid-document'\n | 'document-not-found'\n | 'invalid-response'\n | 'network-error'\n\nexport class CmsContentError extends Error {\n readonly code: CmsContentErrorCode\n readonly conflicts?: ReadonlyArray<CmsContentPlanEntry>\n readonly issues?: ReadonlyArray<DocumentIssue>\n\n constructor(\n code: CmsContentErrorCode,\n message: string,\n options: {\n readonly cause?: unknown\n readonly conflicts?: ReadonlyArray<CmsContentPlanEntry>\n readonly issues?: ReadonlyArray<DocumentIssue>\n } = {},\n ) {\n super(message, options.cause === undefined ? undefined : { cause: options.cause })\n this.name = 'CmsContentError'\n this.code = code\n this.conflicts = options.conflicts\n this.issues = options.issues\n }\n}\n\nexport interface CmsContentCredentials {\n readonly email: string\n readonly password: string\n}\n\nexport interface CmsContentClientOptions {\n readonly baseUrl: string\n readonly credentials: CmsContentCredentials\n readonly fetch?: typeof globalThis.fetch\n}\n\nexport interface CmsContentSourceSet {\n readonly sources: ReadonlyArray<ContentSource>\n}\n\nexport interface CmsContentDocument extends ContentSnapshotSource {}\n\nexport interface CmsContentPlanEntry extends ContentPlanEntry {}\n\nexport interface CmsContentPlan {\n readonly generation: string\n readonly creates: ReadonlyArray<CmsContentPlanEntry>\n readonly updates: ReadonlyArray<CmsContentPlanEntry>\n readonly publications: ReadonlyArray<CmsContentPlanEntry>\n readonly unpublications: ReadonlyArray<CmsContentPlanEntry>\n readonly conflicts: ReadonlyArray<CmsContentPlanEntry>\n readonly unchanged: ReadonlyArray<CmsContentPlanEntry>\n readonly issues: ReadonlyArray<DocumentIssue>\n readonly targetOnly: ReadonlyArray<ContentSnapshotSource>\n readonly valid: boolean\n}\n\nexport interface CmsContentImportOptions {\n readonly overwrite?: boolean\n readonly publish?: boolean\n}\n\nexport interface CmsContentDiff {\n readonly changes: ReadonlyArray<{\n readonly filePath: string\n readonly local?: ContentSource\n readonly target?: ContentSource | ContentSnapshotSource\n readonly markdownChanged: boolean\n readonly publicationChanged: boolean\n }>\n readonly targetOnly: ReadonlyArray<ContentSource | ContentSnapshotSource>\n}\n\nexport interface CmsContentClient {\n readonly plan: (source: CmsContentSourceSet, options?: CmsContentImportOptions) => Promise<CmsContentPlan>\n readonly apply: (plan: CmsContentPlan) => Promise<ContentApplyResult>\n readonly diff: (source: CmsContentSourceSet) => Promise<CmsContentDiff>\n readonly export: (options: { readonly directory: string }) => Promise<CmsContentSourceSet>\n readonly readDocument: (documentId: string) => Promise<CmsContentDocument>\n}\n\ninterface PlanState {\n readonly client: object\n readonly input: {\n readonly sources: ReadonlyArray<ContentSource>\n readonly overwrite: boolean\n readonly publish: boolean\n }\n readonly protocol: ProtocolContentPlan\n}\n\ntype CmsContentRequestBody =\n | PlanState['input']\n | (PlanState['input'] & { readonly expectedGeneration: ProtocolContentPlan['generation'] })\n\nconst plans = new WeakMap<CmsContentPlan, PlanState>()\n\nexport function createCmsContentClient(options: CmsContentClientOptions): CmsContentClient {\n const baseUrl = contentBaseUrl(options.baseUrl)\n const requestFetch = options.fetch ?? globalThis.fetch\n const identity = {}\n let cookie: Promise<string> | undefined\n\n const authenticate = async (): Promise<string> => {\n if (cookie) return cookie\n\n cookie = request(requestFetch, new URL(`${CMS_AUTHENTICATION_PATH}/sign-in/email`, baseUrl), {\n method: 'POST',\n headers: { accept: 'application/json', 'content-type': 'application/json', origin: baseUrl.origin },\n body: JSON.stringify(options.credentials),\n }).then(async (response) => {\n if (!response.ok) throw new CmsContentError('authentication-required', `CMS sign-in failed (${response.status}).`)\n const value = response.headers.get('set-cookie')?.split(';', 1)[0]\n\n if (!value) throw new CmsContentError('authentication-required', 'CMS sign-in did not return a session cookie.')\n\n return value\n })\n\n return cookie\n }\n\n const contentRequest = async <SchemaType extends Schema.ConstraintDecoder<unknown>>(\n path: string,\n schema: SchemaType,\n label: string,\n body?: CmsContentRequestBody,\n ): Promise<SchemaType['Type']> => {\n const session = await authenticate()\n\n const response = await request(requestFetch, new URL(`${STUDIO_API_PATH}/content/${path}`, baseUrl), {\n method: body === undefined ? 'GET' : 'POST',\n headers: {\n accept: 'application/json',\n cookie: session,\n ...(body === undefined ? undefined : { 'content-type': 'application/json' }),\n },\n ...(body === undefined ? undefined : { body: JSON.stringify(body) }),\n })\n\n if (!response.ok) {\n if (response.status === 401 || response.status === 403)\n throw new CmsContentError('authentication-required', `CMS content request was rejected (${response.status}).`)\n\n if (response.status === 409)\n throw new CmsContentError('generation-changed', 'The CMS changed after this content plan was created.')\n\n if (response.status === 422) {\n const failure = await decodeResponse(response, DocumentValidationFailed, 'document validation failure')\n\n throw new CmsContentError('invalid-document', 'The CMS rejected an invalid document.', {\n issues: failure.issues,\n })\n }\n\n throw new CmsContentError('network-error', `CMS content request failed (${response.status}).`)\n }\n\n return decodeResponse(response, schema, label)\n }\n\n const snapshot = async (): Promise<ContentSnapshot> =>\n contentRequest('snapshot', ContentSnapshotSchema, 'content snapshot')\n\n const client: CmsContentClient = {\n plan: async (source, authoredOptions = {}) => {\n const sources = Object.freeze(\n source.sources.map((entry) =>\n Object.freeze(\n ContentSourceSchema.make({\n filePath: entry.filePath,\n ...(entry.identity === undefined ? undefined : { identity: entry.identity }),\n markdown: entry.markdown,\n ...(entry.placement === undefined ? undefined : { placement: entry.placement }),\n published: entry.published,\n }),\n ),\n ),\n )\n\n const input = Object.freeze({\n sources,\n overwrite: authoredOptions.overwrite ?? false,\n publish: authoredOptions.publish ?? false,\n })\n\n const [protocol, current] = await Promise.all([\n contentRequest('plan', ProtocolContentPlanSchema, 'content plan', input),\n snapshot(),\n ])\n\n const documentIds = new Set(sources.flatMap((entry) => (entry.identity ? [entry.identity.documentId] : [])))\n\n const entries = (action: ContentPlanEntry['action']) =>\n protocol.entries.filter((entry) => entry.action === action)\n\n const plan: CmsContentPlan = Object.freeze({\n generation: protocol.generation,\n creates: entries('create'),\n updates: entries('update'),\n publications: entries('publish'),\n unpublications: entries('unpublish'),\n conflicts: entries('conflict'),\n unchanged: entries('unchanged'),\n issues: protocol.issues,\n targetOnly: current.sources.filter((entry) => !documentIds.has(entry.identity.documentId)),\n valid: protocol.valid,\n })\n\n plans.set(plan, { client: identity, input, protocol })\n\n return plan\n },\n apply: async (plan) => {\n const state = plans.get(plan)\n\n if (!state || state.client !== identity)\n throw new CmsContentError('content-conflict', 'This content plan was not created by this client.')\n\n if (!plan.valid)\n throw new CmsContentError('content-conflict', 'The content plan is not valid.', {\n conflicts: plan.conflicts,\n issues: plan.issues,\n })\n\n if (plan.conflicts.length)\n throw new CmsContentError('content-conflict', 'The content plan contains conflicts.', {\n conflicts: plan.conflicts,\n })\n\n if (plan.issues.length)\n throw new CmsContentError('invalid-document', 'The content plan contains invalid documents.', {\n issues: plan.issues,\n })\n\n return contentRequest('apply', ContentApplyResultSchema, 'content apply result', {\n ...state.input,\n expectedGeneration: state.protocol.generation,\n })\n },\n diff: async (source) => diffSources(source.sources, (await snapshot()).sources),\n export: async ({ directory }) => {\n const value = await snapshot()\n\n return writeContentDirectory(directory, value.sources)\n },\n readDocument: async (documentId) => {\n const document = (await snapshot()).sources.find((source) => source.identity.documentId === documentId)\n\n if (!document) throw new CmsContentError('document-not-found', `CMS document ${documentId} was not found.`)\n\n return document\n },\n }\n\n return client\n}\n\nexport async function readCmsContentDirectory(directory: string): Promise<CmsContentSourceSet> {\n try {\n const root = resolve(directory)\n const indexPath = await safeContentFile(root, '.cms-content.json')\n let index: ContentIndex | undefined\n\n try {\n index = parseIndex(await readFile(indexPath, 'utf8'))\n } catch (cause) {\n if (!isMissingFile(cause)) throw cause\n }\n\n if (index) {\n const sources = await Promise.all(\n index.sources.map(async (entry) =>\n decode(\n ContentSourceSchema,\n {\n filePath: entry.filePath,\n identity: entry.identity,\n markdown: await readFile(await safeContentFile(root, entry.filePath), 'utf8'),\n placement: entry.placement,\n published: entry.published,\n revisionId: entry.revisionId,\n },\n 'content source',\n ),\n ),\n )\n\n return { sources }\n }\n\n const files = await markdownFiles(root)\n\n if (!files.length) throw new CmsContentError('filesystem-error', `No Markdown files found in ${root}.`)\n\n return {\n sources: await Promise.all(\n files.map(async (file) =>\n decode(\n ContentSourceSchema,\n {\n filePath: relative(root, file).replaceAll('\\\\', '/'),\n markdown: await readFile(file, 'utf8'),\n published: true,\n },\n 'content source',\n ),\n ),\n ),\n }\n } catch (cause) {\n if (cause instanceof CmsContentError) throw cause\n throw new CmsContentError('filesystem-error', `Could not read CMS content from ${directory}.`, { cause })\n }\n}\n\nexport function diffCmsContentSources(\n local: ReadonlyArray<ContentSource>,\n target: ReadonlyArray<ContentSource | ContentSnapshotSource>,\n): CmsContentDiff {\n return diffSources(local, target)\n}\n\nconst ContentHash = Schema.String.check(Schema.isPattern(/^[a-f0-9]{64}$/u))\n\nconst ContentIndexEntry = Schema.Struct({\n filePath: ContentSourceSchema.fields.filePath,\n identity: DocumentIdentity,\n placement: DocumentPlacement,\n published: Schema.Boolean,\n revisionId: ContentSnapshotSourceSchema.fields.revisionId,\n sha256: ContentHash,\n})\n\nconst ContentIndex = Schema.Struct({\n version: Schema.Literal(2),\n sources: Schema.Array(ContentIndexEntry),\n exportSha256: ContentHash,\n})\n\ntype ContentIndex = typeof ContentIndex.Type\n\ntype ContentIndexEntry = typeof ContentIndexEntry.Type\n\nasync function writeContentDirectory(\n directory: string,\n sources: ReadonlyArray<ContentSnapshotSource>,\n): Promise<CmsContentSourceSet> {\n try {\n const root = resolve(directory)\n const indexPath = await safeContentFile(root, '.cms-content.json')\n let previous: ContentIndex | undefined\n\n try {\n previous = parseIndex(await readFile(indexPath, 'utf8'))\n } catch (cause) {\n if (!isMissingFile(cause)) throw cause\n }\n\n const previousById = new Map(previous?.sources.map((entry) => [entry.identity.documentId, entry]))\n const paths = exportPaths(sources, previousById)\n\n if (previous) {\n const metadata = { version: previous.version, sources: previous.sources }\n\n if (sha256(JSON.stringify(metadata)) !== previous.exportSha256)\n throw new CmsContentError('filesystem-error', 'The local .cms-content.json file has been edited.')\n\n const incomingIds = new Set(sources.map((source) => source.identity.documentId))\n\n for (const entry of previous.sources)\n if (!incomingIds.has(entry.identity.documentId))\n throw new CmsContentError(\n 'filesystem-error',\n `CMS document ${entry.filePath} no longer exists; resolve the local file before exporting again.`,\n )\n }\n\n for (const source of sources) {\n const filePath = paths.get(source.identity.documentId)\n\n if (!filePath)\n throw new CmsContentError(\n 'filesystem-error',\n `Could not allocate an export path for ${source.identity.documentId}.`,\n )\n\n try {\n const local = await readFile(await safeContentFile(root, filePath), 'utf8')\n const before = previousById.get(source.identity.documentId)\n\n if (before ? sha256(local) !== before.sha256 : local !== source.markdown)\n throw new CmsContentError('filesystem-error', `Local edits in ${filePath}; export was stopped.`)\n } catch (cause) {\n if (!isMissingFile(cause)) throw cause\n }\n }\n\n await mkdir(root, { recursive: true })\n const entries: ContentIndexEntry[] = []\n\n for (const source of sources) {\n const filePath = paths.get(source.identity.documentId)\n\n if (!filePath)\n throw new CmsContentError(\n 'filesystem-error',\n `Could not allocate an export path for ${source.identity.documentId}.`,\n )\n const file = await safeContentFile(root, filePath)\n await mkdir(dirname(file), { recursive: true })\n await safeContentFile(root, filePath)\n await writeFile(file, source.markdown)\n entries.push({\n filePath,\n identity: source.identity,\n placement: source.placement,\n published: source.published,\n revisionId: source.revisionId,\n sha256: sha256(source.markdown),\n })\n }\n\n const metadata = { version: 2 as const, sources: entries }\n const index: ContentIndex = { ...metadata, exportSha256: sha256(JSON.stringify(metadata)) }\n await safeContentFile(root, '.cms-content.json')\n await writeFile(indexPath, `${JSON.stringify(index, undefined, 2)}\\n`)\n\n return {\n sources: sources.map((source) =>\n ContentSourceSchema.make({\n filePath: paths.get(source.identity.documentId)!,\n identity: source.identity,\n markdown: source.markdown,\n placement: source.placement,\n published: source.published,\n revisionId: source.revisionId,\n }),\n ),\n }\n } catch (cause) {\n throw new CmsContentError('filesystem-error', `Could not export CMS content to ${directory}.`, { cause })\n }\n}\n\nfunction diffSources(\n local: ReadonlyArray<ContentSource>,\n target: ReadonlyArray<ContentSource | ContentSnapshotSource>,\n): CmsContentDiff {\n const targetById = new Map(\n target.flatMap((source) => (source.identity ? [[source.identity.documentId, source] as const] : [])),\n )\n\n const targetByFile = new Map(\n target.flatMap((source) => ('filePath' in source ? [[source.filePath, source] as const] : [])),\n )\n\n const localIds = new Set(local.flatMap((source) => (source.identity ? [source.identity.documentId] : [])))\n const localFiles = new Set(local.map((source) => source.filePath))\n\n return {\n changes: local.flatMap((source) => {\n const current = source.identity ? targetById.get(source.identity.documentId) : targetByFile.get(source.filePath)\n const markdownChanged = current?.markdown !== source.markdown\n const publicationChanged = current !== undefined && current.published !== source.published\n\n return markdownChanged || publicationChanged\n ? [{ filePath: source.filePath, local: source, target: current, markdownChanged, publicationChanged }]\n : []\n }),\n targetOnly: target.filter((source) =>\n source.identity\n ? !localIds.has(source.identity.documentId)\n : 'filePath' in source && !localFiles.has(source.filePath),\n ),\n }\n}\n\nfunction exportPaths(\n sources: ReadonlyArray<ContentSnapshotSource>,\n previous: ReadonlyMap<string, ContentIndexEntry>,\n): ReadonlyMap<string, ContentFilePath> {\n const byId = new Map(sources.map((source) => [source.identity.documentId, source]))\n const allocated = new Set<string>()\n const result = new Map<string, ContentFilePath>()\n\n const segmentsFor = (source: ContentSnapshotSource, visited = new Set<string>()): ReadonlyArray<string> => {\n if (source.placement.kind === 'home') return []\n\n if (visited.has(source.identity.documentId)) return [source.placement.slug]\n const parent = byId.get(source.placement.parentDocumentId)\n\n return parent\n ? [...segmentsFor(parent, new Set([...visited, source.identity.documentId])), source.placement.slug]\n : [source.placement.slug]\n }\n\n for (const source of sources) {\n const retained = previous.get(source.identity.documentId)?.filePath\n const base = [source.identity.collection, ...(source.identity.locale ? [source.identity.locale] : [])]\n const placement = segmentsFor(source)\n\n const generated =\n source.placement.kind === 'home'\n ? [...base, 'index.md'].join('/')\n : [...base, ...placement.slice(0, -1), `${placement.at(-1) ?? 'document'}.md`].join('/')\n\n let candidate = retained ?? ContentFilePath.make(generated)\n\n if (allocated.has(candidate)) {\n candidate = ContentFilePath.make(generated.replace(/\\.md$/u, `-${source.identity.documentId.slice(0, 8)}.md`))\n }\n\n allocated.add(candidate)\n result.set(source.identity.documentId, candidate)\n }\n\n return result\n}\n\nasync function markdownFiles(directory: string): Promise<ReadonlyArray<string>> {\n const entries = await readdir(directory, { withFileTypes: true })\n\n const nested = await Promise.all(\n entries.map(async (entry) => {\n const path = resolve(directory, entry.name)\n\n if (entry.isDirectory()) return markdownFiles(path)\n\n return entry.isFile() && ['.md', '.mdc'].includes(extname(path)) ? [path] : []\n }),\n )\n\n return nested.flat().sort((left, right) => left.localeCompare(right))\n}\n\nfunction safeContentPath(root: string, filePath: string): string {\n const path = resolve(root, filePath)\n\n if (!path.startsWith(`${root}${sep}`))\n throw new CmsContentError('filesystem-error', `Unsafe content path: ${filePath}`)\n\n return path\n}\n\nasync function safeContentFile(root: string, filePath: string): Promise<string> {\n const path = safeContentPath(root, filePath)\n const segments = relative(root, path).split(sep)\n let current = root\n\n for (const segment of ['', ...segments]) {\n current = segment ? resolve(current, segment) : current\n\n try {\n if ((await lstat(current)).isSymbolicLink())\n throw new CmsContentError('filesystem-error', `Symlinks are not allowed in CMS content paths: ${filePath}`)\n } catch (cause) {\n if (!isMissingFile(cause)) throw cause\n }\n }\n\n return path\n}\n\nfunction contentBaseUrl(value: string): URL {\n let url: URL\n\n try {\n url = new URL(value)\n } catch (cause) {\n throw new CmsContentError('network-error', 'CMS baseUrl is invalid.', { cause })\n }\n\n if (url.username || url.password || url.search || url.hash)\n throw new CmsContentError('network-error', 'CMS baseUrl must be an origin without credentials, query, or fragment.')\n\n if (\n url.protocol !== 'https:' &&\n !(url.protocol === 'http:' && ['localhost', '127.0.0.1', '[::1]'].includes(url.hostname))\n )\n throw new CmsContentError('network-error', 'Use HTTPS for CMS credentials; HTTP is allowed only on localhost.')\n\n return new URL(url.origin)\n}\n\nasync function request(fetch: typeof globalThis.fetch, input: URL, init: RequestInit): Promise<Response> {\n try {\n return await fetch(input, init)\n } catch (cause) {\n throw new CmsContentError('network-error', `Could not reach ${input.origin}.`, { cause })\n }\n}\n\nasync function decodeResponse<SchemaType extends Schema.ConstraintDecoder<unknown>>(\n response: Response,\n schema: SchemaType,\n label: string,\n): Promise<SchemaType['Type']> {\n try {\n return decode(schema, await response.json(), label)\n } catch (cause) {\n if (cause instanceof CmsContentError) throw cause\n throw new CmsContentError('invalid-response', 'CMS returned an invalid JSON response.', { cause })\n }\n}\n\n/* oxlint-disable anti-slop/no-unknown-parameters -- Untrusted JSON and filesystem values enter their explicit Schema decoder here. */\nfunction decode<SchemaType extends Schema.ConstraintDecoder<unknown>>(\n schema: SchemaType,\n value: unknown,\n label: string,\n): SchemaType['Type'] {\n const decoded = Schema.decodeUnknownResult(schema)(value)\n\n if (Result.isFailure(decoded))\n throw new CmsContentError('invalid-response', `CMS returned an invalid ${label}.`, { cause: decoded.failure })\n\n return decoded.success\n}\n/* oxlint-enable anti-slop/no-unknown-parameters */\n\nfunction sha256(value: string): string {\n return createHash('sha256').update(value).digest('hex')\n}\n\nfunction parseIndex(value: string): ContentIndex {\n const decoded = Schema.decodeUnknownResult(ContentIndex)(JSON.parse(value))\n\n if (Result.isFailure(decoded))\n throw new CmsContentError('filesystem-error', 'The .cms-content.json index is invalid.')\n\n const filePaths = new Set(decoded.success.sources.map((entry) => entry.filePath))\n\n if (filePaths.size !== decoded.success.sources.length)\n throw new CmsContentError('filesystem-error', 'The .cms-content.json index contains duplicate file paths.')\n\n return decoded.success\n}\n\nfunction isMissingFile(cause: unknown): boolean {\n return cause instanceof Error && 'code' in cause && cause.code === 'ENOENT'\n}\n\nexport type { ContentApplyResult, ContentSource }\n"],"mappings":";;;;;;;;;AAmCA,IAAa,kBAAb,cAAqC,MAAM;CACzC,AAAS;CACT,AAAS;CACT,AAAS;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AAS,WAAW,OAA6B;CAC/C,MAAM,UAAU,OAAO,oBAAoB,YAAY,CAAC,CAAC,KAAK,MAAM,KAAK,CAAC;CAE1E,IAAI,OAAO,UAAU,OAAO,GAC1B,MAAM,IAAI,gBAAgB,oBAAoB,yCAAyC;CAIzF,IAAI,IAFkB,IAAI,QAAQ,QAAQ,QAAQ,KAAK,UAAU,MAAM,QAAQ,CAEnE,CAAC,CAAC,SAAS,QAAQ,QAAQ,QAAQ,QAC7C,MAAM,IAAI,gBAAgB,oBAAoB,4DAA4D;CAE5G,OAAO,QAAQ;AACjB;AAEA,SAAS,cAAc,OAAyB;CAC9C,OAAO,iBAAiB,SAAS,UAAU,SAAS,MAAM,SAAS;AACrE"}
|
|
1
|
+
{"version":3,"file":"Content.js","names":["ContentSnapshotSchema","ContentSourceSchema","ProtocolContentPlanSchema","ContentApplyResultSchema","ContentSnapshotSourceSchema"],"sources":["../../../src/Content.ts"],"sourcesContent":["/* oxlint-disable effecttsgo/async-function effecttsgo/extends-native-error effecttsgo/node-builtin-import -- This public Node-only API deliberately exposes Promises, native filesystem paths, and an Error subclass to ordinary deployment scripts. */\nimport type {\n ContentApplyResult,\n ContentPlan as ProtocolContentPlan,\n ContentPlanEntry,\n ContentSnapshotSource,\n ContentSource,\n ContentSnapshot,\n} from '@internal/protocol/ContentTransfer'\nimport {\n ContentApplyResult as ContentApplyResultSchema,\n ContentFilePath,\n ContentPlan as ProtocolContentPlanSchema,\n ContentSnapshotSource as ContentSnapshotSourceSchema,\n ContentSource as ContentSourceSchema,\n ContentSnapshot as ContentSnapshotSchema,\n} from '@internal/protocol/ContentTransfer'\nimport type { DocumentIssue } from '@internal/protocol/Documents'\nimport { DocumentIdentity, DocumentPlacement, DocumentValidationFailed } from '@internal/protocol/Documents'\nimport { CMS_AUTHENTICATION_PATH, STUDIO_API_PATH } from '@internal/protocol/HttpPaths'\nimport { NodeCrypto } from '@effect/platform-node-shared'\nimport { Effect, Encoding, Result, Schema } from 'effect'\nimport { lstat, readdir, readFile, mkdir, writeFile } from 'node:fs/promises'\nimport { dirname, extname, relative, resolve, sep } from 'node:path'\n\nexport type CmsContentErrorCode =\n | 'authentication-required'\n | 'content-conflict'\n | 'filesystem-error'\n | 'generation-changed'\n | 'invalid-document'\n | 'document-not-found'\n | 'invalid-response'\n | 'network-error'\n\nexport class CmsContentError extends Error {\n readonly code: CmsContentErrorCode\n readonly conflicts?: ReadonlyArray<CmsContentPlanEntry>\n readonly issues?: ReadonlyArray<DocumentIssue>\n\n constructor(\n code: CmsContentErrorCode,\n message: string,\n options: {\n readonly cause?: unknown\n readonly conflicts?: ReadonlyArray<CmsContentPlanEntry>\n readonly issues?: ReadonlyArray<DocumentIssue>\n } = {},\n ) {\n super(message, options.cause === undefined ? undefined : { cause: options.cause })\n this.name = 'CmsContentError'\n this.code = code\n this.conflicts = options.conflicts\n this.issues = options.issues\n }\n}\n\nexport interface CmsContentCredentials {\n readonly email: string\n readonly password: string\n}\n\nexport interface CmsContentClientOptions {\n readonly baseUrl: string\n readonly credentials: CmsContentCredentials\n readonly fetch?: typeof globalThis.fetch\n}\n\nexport interface CmsContentSourceSet {\n readonly sources: ReadonlyArray<ContentSource>\n}\n\nexport interface CmsContentDocument extends ContentSnapshotSource {}\n\nexport interface CmsContentPlanEntry extends ContentPlanEntry {}\n\nexport interface CmsContentPlan {\n readonly generation: string\n readonly creates: ReadonlyArray<CmsContentPlanEntry>\n readonly updates: ReadonlyArray<CmsContentPlanEntry>\n readonly publications: ReadonlyArray<CmsContentPlanEntry>\n readonly unpublications: ReadonlyArray<CmsContentPlanEntry>\n readonly conflicts: ReadonlyArray<CmsContentPlanEntry>\n readonly unchanged: ReadonlyArray<CmsContentPlanEntry>\n readonly issues: ReadonlyArray<DocumentIssue>\n readonly targetOnly: ReadonlyArray<ContentSnapshotSource>\n readonly valid: boolean\n}\n\nexport interface CmsContentImportOptions {\n readonly overwrite?: boolean\n readonly publish?: boolean\n}\n\nexport interface CmsContentDiff {\n readonly changes: ReadonlyArray<{\n readonly filePath: string\n readonly local?: ContentSource\n readonly target?: ContentSource | ContentSnapshotSource\n readonly markdownChanged: boolean\n readonly publicationChanged: boolean\n }>\n readonly targetOnly: ReadonlyArray<ContentSource | ContentSnapshotSource>\n}\n\nexport interface CmsContentClient {\n readonly plan: (source: CmsContentSourceSet, options?: CmsContentImportOptions) => Promise<CmsContentPlan>\n readonly apply: (plan: CmsContentPlan) => Promise<ContentApplyResult>\n readonly diff: (source: CmsContentSourceSet) => Promise<CmsContentDiff>\n readonly export: (options: { readonly directory: string }) => Promise<CmsContentSourceSet>\n readonly readDocument: (documentId: string) => Promise<CmsContentDocument>\n}\n\ninterface PlanState {\n readonly client: object\n readonly input: {\n readonly sources: ReadonlyArray<ContentSource>\n readonly overwrite: boolean\n readonly publish: boolean\n }\n readonly protocol: ProtocolContentPlan\n}\n\ntype CmsContentRequestBody =\n | PlanState['input']\n | (PlanState['input'] & { readonly expectedGeneration: ProtocolContentPlan['generation'] })\n\nconst plans = new WeakMap<CmsContentPlan, PlanState>()\n\nexport function createCmsContentClient(options: CmsContentClientOptions): CmsContentClient {\n const baseUrl = contentBaseUrl(options.baseUrl)\n const requestFetch = options.fetch ?? globalThis.fetch\n const identity = {}\n let cookie: Promise<string> | undefined\n\n const authenticate = async (): Promise<string> => {\n if (cookie) return cookie\n\n cookie = request(requestFetch, new URL(`${CMS_AUTHENTICATION_PATH}/sign-in/email`, baseUrl), {\n method: 'POST',\n headers: { accept: 'application/json', 'content-type': 'application/json', origin: baseUrl.origin },\n body: JSON.stringify(options.credentials),\n }).then(async (response) => {\n if (!response.ok) throw new CmsContentError('authentication-required', `CMS sign-in failed (${response.status}).`)\n const value = response.headers.get('set-cookie')?.split(';', 1)[0]\n\n if (!value) throw new CmsContentError('authentication-required', 'CMS sign-in did not return a session cookie.')\n\n return value\n })\n\n return cookie\n }\n\n const contentRequest = async <SchemaType extends Schema.ConstraintDecoder<unknown>>(\n path: string,\n schema: SchemaType,\n label: string,\n body?: CmsContentRequestBody,\n ): Promise<SchemaType['Type']> => {\n const session = await authenticate()\n\n const response = await request(requestFetch, new URL(`${STUDIO_API_PATH}/content/${path}`, baseUrl), {\n method: body === undefined ? 'GET' : 'POST',\n headers: {\n accept: 'application/json',\n cookie: session,\n ...(body === undefined ? undefined : { 'content-type': 'application/json' }),\n },\n ...(body === undefined ? undefined : { body: JSON.stringify(body) }),\n })\n\n if (!response.ok) {\n if (response.status === 401 || response.status === 403)\n throw new CmsContentError('authentication-required', `CMS content request was rejected (${response.status}).`)\n\n if (response.status === 409)\n throw new CmsContentError('generation-changed', 'The CMS changed after this content plan was created.')\n\n if (response.status === 422) {\n const failure = await decodeResponse(response, DocumentValidationFailed, 'document validation failure')\n\n throw new CmsContentError('invalid-document', 'The CMS rejected an invalid document.', {\n issues: failure.issues,\n })\n }\n\n throw new CmsContentError('network-error', `CMS content request failed (${response.status}).`)\n }\n\n return decodeResponse(response, schema, label)\n }\n\n const snapshot = async (): Promise<ContentSnapshot> =>\n contentRequest('snapshot', ContentSnapshotSchema, 'content snapshot')\n\n const client: CmsContentClient = {\n plan: async (source, authoredOptions = {}) => {\n const sources = Object.freeze(\n source.sources.map((entry) =>\n Object.freeze(\n ContentSourceSchema.make({\n filePath: entry.filePath,\n ...(entry.identity === undefined ? undefined : { identity: entry.identity }),\n markdown: entry.markdown,\n ...(entry.placement === undefined ? undefined : { placement: entry.placement }),\n published: entry.published,\n }),\n ),\n ),\n )\n\n const input = Object.freeze({\n sources,\n overwrite: authoredOptions.overwrite ?? false,\n publish: authoredOptions.publish ?? false,\n })\n\n const [protocol, current] = await Promise.all([\n contentRequest('plan', ProtocolContentPlanSchema, 'content plan', input),\n snapshot(),\n ])\n\n const documentIds = new Set(sources.flatMap((entry) => (entry.identity ? [entry.identity.documentId] : [])))\n\n const entries = (action: ContentPlanEntry['action']) =>\n protocol.entries.filter((entry) => entry.action === action)\n\n const plan: CmsContentPlan = Object.freeze({\n generation: protocol.generation,\n creates: entries('create'),\n updates: entries('update'),\n publications: entries('publish'),\n unpublications: entries('unpublish'),\n conflicts: entries('conflict'),\n unchanged: entries('unchanged'),\n issues: protocol.issues,\n targetOnly: current.sources.filter((entry) => !documentIds.has(entry.identity.documentId)),\n valid: protocol.valid,\n })\n\n plans.set(plan, { client: identity, input, protocol })\n\n return plan\n },\n apply: async (plan) => {\n const state = plans.get(plan)\n\n if (!state || state.client !== identity)\n throw new CmsContentError('content-conflict', 'This content plan was not created by this client.')\n\n if (!plan.valid)\n throw new CmsContentError('content-conflict', 'The content plan is not valid.', {\n conflicts: plan.conflicts,\n issues: plan.issues,\n })\n\n if (plan.conflicts.length)\n throw new CmsContentError('content-conflict', 'The content plan contains conflicts.', {\n conflicts: plan.conflicts,\n })\n\n if (plan.issues.length)\n throw new CmsContentError('invalid-document', 'The content plan contains invalid documents.', {\n issues: plan.issues,\n })\n\n return contentRequest('apply', ContentApplyResultSchema, 'content apply result', {\n ...state.input,\n expectedGeneration: state.protocol.generation,\n })\n },\n diff: async (source) => diffSources(source.sources, (await snapshot()).sources),\n export: async ({ directory }) => {\n const value = await snapshot()\n\n return writeContentDirectory(directory, value.sources)\n },\n readDocument: async (documentId) => {\n const document = (await snapshot()).sources.find((source) => source.identity.documentId === documentId)\n\n if (!document) throw new CmsContentError('document-not-found', `CMS document ${documentId} was not found.`)\n\n return document\n },\n }\n\n return client\n}\n\nexport async function readCmsContentDirectory(directory: string): Promise<CmsContentSourceSet> {\n try {\n const root = resolve(directory)\n const indexPath = await safeContentFile(root, '.cms-content.json')\n let index: ContentIndex | undefined\n\n try {\n index = parseIndex(await readFile(indexPath, 'utf8'))\n } catch (cause) {\n if (!isMissingFile(cause)) throw cause\n }\n\n if (index) {\n const sources = await Promise.all(\n index.sources.map(async (entry) =>\n decode(\n ContentSourceSchema,\n {\n filePath: entry.filePath,\n identity: entry.identity,\n markdown: await readFile(await safeContentFile(root, entry.filePath), 'utf8'),\n placement: entry.placement,\n published: entry.published,\n revisionId: entry.revisionId,\n },\n 'content source',\n ),\n ),\n )\n\n return { sources }\n }\n\n const files = await markdownFiles(root)\n\n if (!files.length) throw new CmsContentError('filesystem-error', `No Markdown files found in ${root}.`)\n\n return {\n sources: await Promise.all(\n files.map(async (file) =>\n decode(\n ContentSourceSchema,\n {\n filePath: relative(root, file).replaceAll('\\\\', '/'),\n markdown: await readFile(file, 'utf8'),\n published: true,\n },\n 'content source',\n ),\n ),\n ),\n }\n } catch (cause) {\n if (cause instanceof CmsContentError) throw cause\n throw new CmsContentError('filesystem-error', `Could not read CMS content from ${directory}.`, { cause })\n }\n}\n\nexport function diffCmsContentSources(\n local: ReadonlyArray<ContentSource>,\n target: ReadonlyArray<ContentSource | ContentSnapshotSource>,\n): CmsContentDiff {\n return diffSources(local, target)\n}\n\nconst ContentHash = Schema.String.check(Schema.isPattern(/^[a-f0-9]{64}$/u))\n\nconst ContentIndexEntry = Schema.Struct({\n filePath: ContentSourceSchema.fields.filePath,\n identity: DocumentIdentity,\n placement: DocumentPlacement,\n published: Schema.Boolean,\n revisionId: ContentSnapshotSourceSchema.fields.revisionId,\n sha256: ContentHash,\n})\n\nconst ContentIndex = Schema.Struct({\n version: Schema.Literal(2),\n sources: Schema.Array(ContentIndexEntry),\n exportSha256: ContentHash,\n})\n\ntype ContentIndex = typeof ContentIndex.Type\n\ntype ContentIndexEntry = typeof ContentIndexEntry.Type\n\nasync function writeContentDirectory(\n directory: string,\n sources: ReadonlyArray<ContentSnapshotSource>,\n): Promise<CmsContentSourceSet> {\n try {\n const root = resolve(directory)\n const indexPath = await safeContentFile(root, '.cms-content.json')\n let previous: ContentIndex | undefined\n\n try {\n previous = parseIndex(await readFile(indexPath, 'utf8'))\n } catch (cause) {\n if (!isMissingFile(cause)) throw cause\n }\n\n const previousById = new Map(previous?.sources.map((entry) => [entry.identity.documentId, entry]))\n const paths = exportPaths(sources, previousById)\n\n if (previous) {\n const metadata = { version: previous.version, sources: previous.sources }\n\n if (sha256(JSON.stringify(metadata)) !== previous.exportSha256)\n throw new CmsContentError('filesystem-error', 'The local .cms-content.json file has been edited.')\n\n const incomingIds = new Set(sources.map((source) => source.identity.documentId))\n\n for (const entry of previous.sources)\n if (!incomingIds.has(entry.identity.documentId))\n throw new CmsContentError(\n 'filesystem-error',\n `CMS document ${entry.filePath} no longer exists; resolve the local file before exporting again.`,\n )\n }\n\n for (const source of sources) {\n const filePath = paths.get(source.identity.documentId)\n\n if (!filePath)\n throw new CmsContentError(\n 'filesystem-error',\n `Could not allocate an export path for ${source.identity.documentId}.`,\n )\n\n try {\n const local = await readFile(await safeContentFile(root, filePath), 'utf8')\n const before = previousById.get(source.identity.documentId)\n\n if (before ? sha256(local) !== before.sha256 : local !== source.markdown)\n throw new CmsContentError('filesystem-error', `Local edits in ${filePath}; export was stopped.`)\n } catch (cause) {\n if (!isMissingFile(cause)) throw cause\n }\n }\n\n await mkdir(root, { recursive: true })\n const entries: ContentIndexEntry[] = []\n\n for (const source of sources) {\n const filePath = paths.get(source.identity.documentId)\n\n if (!filePath)\n throw new CmsContentError(\n 'filesystem-error',\n `Could not allocate an export path for ${source.identity.documentId}.`,\n )\n const file = await safeContentFile(root, filePath)\n await mkdir(dirname(file), { recursive: true })\n await safeContentFile(root, filePath)\n await writeFile(file, source.markdown)\n entries.push({\n filePath,\n identity: source.identity,\n placement: source.placement,\n published: source.published,\n revisionId: source.revisionId,\n sha256: sha256(source.markdown),\n })\n }\n\n const metadata = { version: 2 as const, sources: entries }\n const index: ContentIndex = { ...metadata, exportSha256: sha256(JSON.stringify(metadata)) }\n await safeContentFile(root, '.cms-content.json')\n await writeFile(indexPath, `${JSON.stringify(index, undefined, 2)}\\n`)\n\n return {\n sources: sources.map((source) =>\n ContentSourceSchema.make({\n filePath: paths.get(source.identity.documentId)!,\n identity: source.identity,\n markdown: source.markdown,\n placement: source.placement,\n published: source.published,\n revisionId: source.revisionId,\n }),\n ),\n }\n } catch (cause) {\n throw new CmsContentError('filesystem-error', `Could not export CMS content to ${directory}.`, { cause })\n }\n}\n\nfunction diffSources(\n local: ReadonlyArray<ContentSource>,\n target: ReadonlyArray<ContentSource | ContentSnapshotSource>,\n): CmsContentDiff {\n const targetById = new Map(\n target.flatMap((source) => (source.identity ? [[source.identity.documentId, source] as const] : [])),\n )\n\n const targetByFile = new Map(\n target.flatMap((source) => ('filePath' in source ? [[source.filePath, source] as const] : [])),\n )\n\n const localIds = new Set(local.flatMap((source) => (source.identity ? [source.identity.documentId] : [])))\n const localFiles = new Set(local.map((source) => source.filePath))\n\n return {\n changes: local.flatMap((source) => {\n const current = source.identity ? targetById.get(source.identity.documentId) : targetByFile.get(source.filePath)\n const markdownChanged = current?.markdown !== source.markdown\n const publicationChanged = current !== undefined && current.published !== source.published\n\n return markdownChanged || publicationChanged\n ? [{ filePath: source.filePath, local: source, target: current, markdownChanged, publicationChanged }]\n : []\n }),\n targetOnly: target.filter((source) =>\n source.identity\n ? !localIds.has(source.identity.documentId)\n : 'filePath' in source && !localFiles.has(source.filePath),\n ),\n }\n}\n\nfunction exportPaths(\n sources: ReadonlyArray<ContentSnapshotSource>,\n previous: ReadonlyMap<string, ContentIndexEntry>,\n): ReadonlyMap<string, ContentFilePath> {\n const byId = new Map(sources.map((source) => [source.identity.documentId, source]))\n const allocated = new Set<string>()\n const result = new Map<string, ContentFilePath>()\n\n const segmentsFor = (source: ContentSnapshotSource, visited = new Set<string>()): ReadonlyArray<string> => {\n if (source.placement.kind === 'home') return []\n\n if (visited.has(source.identity.documentId)) return [source.placement.slug]\n const parent = byId.get(source.placement.parentDocumentId)\n\n return parent\n ? [...segmentsFor(parent, new Set([...visited, source.identity.documentId])), source.placement.slug]\n : [source.placement.slug]\n }\n\n for (const source of sources) {\n const retained = previous.get(source.identity.documentId)?.filePath\n const base = [source.identity.collection, ...(source.identity.locale ? [source.identity.locale] : [])]\n const placement = segmentsFor(source)\n\n const generated =\n source.placement.kind === 'home'\n ? [...base, 'index.md'].join('/')\n : [...base, ...placement.slice(0, -1), `${placement.at(-1) ?? 'document'}.md`].join('/')\n\n let candidate = retained ?? ContentFilePath.make(generated)\n\n if (allocated.has(candidate)) {\n candidate = ContentFilePath.make(generated.replace(/\\.md$/u, `-${source.identity.documentId.slice(0, 8)}.md`))\n }\n\n allocated.add(candidate)\n result.set(source.identity.documentId, candidate)\n }\n\n return result\n}\n\nasync function markdownFiles(directory: string): Promise<ReadonlyArray<string>> {\n const entries = await readdir(directory, { withFileTypes: true })\n\n const nested = await Promise.all(\n entries.map(async (entry) => {\n const path = resolve(directory, entry.name)\n\n if (entry.isDirectory()) return markdownFiles(path)\n\n return entry.isFile() && ['.md', '.mdc'].includes(extname(path)) ? [path] : []\n }),\n )\n\n return nested.flat().sort((left, right) => left.localeCompare(right))\n}\n\nfunction safeContentPath(root: string, filePath: string): string {\n const path = resolve(root, filePath)\n\n if (!path.startsWith(`${root}${sep}`))\n throw new CmsContentError('filesystem-error', `Unsafe content path: ${filePath}`)\n\n return path\n}\n\nasync function safeContentFile(root: string, filePath: string): Promise<string> {\n const path = safeContentPath(root, filePath)\n const segments = relative(root, path).split(sep)\n let current = root\n\n for (const segment of ['', ...segments]) {\n current = segment ? resolve(current, segment) : current\n\n try {\n if ((await lstat(current)).isSymbolicLink())\n throw new CmsContentError('filesystem-error', `Symlinks are not allowed in CMS content paths: ${filePath}`)\n } catch (cause) {\n if (!isMissingFile(cause)) throw cause\n }\n }\n\n return path\n}\n\nfunction contentBaseUrl(value: string): URL {\n let url: URL\n\n try {\n url = new URL(value)\n } catch (cause) {\n throw new CmsContentError('network-error', 'CMS baseUrl is invalid.', { cause })\n }\n\n if (url.username || url.password || url.search || url.hash)\n throw new CmsContentError('network-error', 'CMS baseUrl must be an origin without credentials, query, or fragment.')\n\n if (\n url.protocol !== 'https:' &&\n !(url.protocol === 'http:' && ['localhost', '127.0.0.1', '[::1]'].includes(url.hostname))\n )\n throw new CmsContentError('network-error', 'Use HTTPS for CMS credentials; HTTP is allowed only on localhost.')\n\n return new URL(url.origin)\n}\n\nasync function request(fetch: typeof globalThis.fetch, input: URL, init: RequestInit): Promise<Response> {\n try {\n return await fetch(input, init)\n } catch (cause) {\n throw new CmsContentError('network-error', `Could not reach ${input.origin}.`, { cause })\n }\n}\n\nasync function decodeResponse<SchemaType extends Schema.ConstraintDecoder<unknown>>(\n response: Response,\n schema: SchemaType,\n label: string,\n): Promise<SchemaType['Type']> {\n try {\n return decode(schema, await response.json(), label)\n } catch (cause) {\n if (cause instanceof CmsContentError) throw cause\n throw new CmsContentError('invalid-response', 'CMS returned an invalid JSON response.', { cause })\n }\n}\n\n/* oxlint-disable anti-slop/no-unknown-parameters -- Untrusted JSON and filesystem values enter their explicit Schema decoder here. */\nfunction decode<SchemaType extends Schema.ConstraintDecoder<unknown>>(\n schema: SchemaType,\n value: unknown,\n label: string,\n): SchemaType['Type'] {\n const decoded = Schema.decodeUnknownResult(schema)(value)\n\n if (Result.isFailure(decoded))\n throw new CmsContentError('invalid-response', `CMS returned an invalid ${label}.`, { cause: decoded.failure })\n\n return decoded.success\n}\n/* oxlint-enable anti-slop/no-unknown-parameters */\n\nfunction sha256(value: string): string {\n return Encoding.encodeHex(\n Effect.runSync(NodeCrypto.make.digest('SHA-256', new TextEncoder().encode(value)).pipe(Effect.orDie)),\n )\n}\n\nfunction parseIndex(value: string): ContentIndex {\n const decoded = Schema.decodeUnknownResult(ContentIndex)(JSON.parse(value))\n\n if (Result.isFailure(decoded))\n throw new CmsContentError('filesystem-error', 'The .cms-content.json index is invalid.')\n\n const filePaths = new Set(decoded.success.sources.map((entry) => entry.filePath))\n\n if (filePaths.size !== decoded.success.sources.length)\n throw new CmsContentError('filesystem-error', 'The .cms-content.json index contains duplicate file paths.')\n\n return decoded.success\n}\n\nfunction isMissingFile(cause: unknown): boolean {\n return cause instanceof Error && 'code' in cause && cause.code === 'ENOENT'\n}\n\nexport type { ContentApplyResult, ContentSource }\n"],"mappings":";;;;;;;;;AAmCA,IAAa,kBAAb,cAAqC,MAAM;CACzC,AAAS;CACT,AAAS;CACT,AAAS;CAET,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AAK,CAAC,CAAC,CAAC,KAAK,OAAO,KAAK,CAAC,CACtG;AACF;AAEA,SAAS,WAAW,OAA6B;CAC/C,MAAM,UAAU,OAAO,oBAAoB,YAAY,CAAC,CAAC,KAAK,MAAM,KAAK,CAAC;CAE1E,IAAI,OAAO,UAAU,OAAO,GAC1B,MAAM,IAAI,gBAAgB,oBAAoB,yCAAyC;CAIzF,IAAI,IAFkB,IAAI,QAAQ,QAAQ,QAAQ,KAAK,UAAU,MAAM,QAAQ,CAEnE,CAAC,CAAC,SAAS,QAAQ,QAAQ,QAAQ,QAC7C,MAAM,IAAI,gBAAgB,oBAAoB,4DAA4D;CAE5G,OAAO,QAAQ;AACjB;AAEA,SAAS,cAAc,OAAyB;CAC9C,OAAO,iBAAiB,SAAS,UAAU,SAAS,MAAM,SAAS;AACrE"}
|
|
@@ -2,7 +2,7 @@ import { o as PublicPath, r as DocumentId } from "./scalars-CVZqT3L0.js";
|
|
|
2
2
|
import { P as DocumentSeo, _ as DocumentSourceMapping, b as DocumentValidationResult, l as DocumentIssue, n as CmsMarkdownDocument, r as CompiledDocument, t as CmsDocumentAnalysis } from "./models-VmGmG19-.js";
|
|
3
3
|
import { i as decodeManagedMediaReference, r as decodeAuthoredDocumentReference } from "./References-CCPDAPve.js";
|
|
4
4
|
import { c as resolveCmsComarkAttributes, d as createCmsComarkRenderData, l as withCmsComarkProps, o as normalizeCmsComponentBindings, u as cmsComarkTextContent } from "./Forms-CX-hwmJF.js";
|
|
5
|
-
import { h as SOURCE_MAPPINGS_META_KEY, l as validateCollectionBody, m as createDocumentParser, o as createAuthoringDocumentValidator, p as DOCUMENT_ENGINE_FINGERPRINT } from "./Configuration-
|
|
5
|
+
import { h as SOURCE_MAPPINGS_META_KEY, l as validateCollectionBody, m as createDocumentParser, o as createAuthoringDocumentValidator, p as DOCUMENT_ENGINE_FINGERPRINT } from "./Configuration-Da5B2PVH.js";
|
|
6
6
|
import { DateTime, Effect, Option, Predicate, Result, Schema } from "effect";
|
|
7
7
|
|
|
8
8
|
//#region ../document/src/internal/document-address.ts
|
|
@@ -975,4 +975,4 @@ function errorMessage(cause) {
|
|
|
975
975
|
|
|
976
976
|
//#endregion
|
|
977
977
|
export { DocumentCompilationFailed as n, createDocumentEngine as t };
|
|
978
|
-
//# sourceMappingURL=DocumentEngine-
|
|
978
|
+
//# sourceMappingURL=DocumentEngine-hh_IGPXO.js.map
|