@phtngyn/cms 0.2.0-beta.1 → 0.2.0-beta.3
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/CHANGELOG.md +13 -0
- package/README.md +40 -45
- package/package.json +7 -5
- package/src/ApplicationTypes.d.ts +7 -5
- package/src/{Configuration-CjVUBBwa.js → Configuration-BU-UyGoH.js} +4 -4
- package/src/{Configuration-CjVUBBwa.js.map → Configuration-BU-UyGoH.js.map} +1 -1
- package/src/Configuration.d.ts +41 -24
- package/src/Configuration.js.map +1 -1
- package/src/Content.js +42 -19
- package/src/Content.js.map +1 -1
- package/src/{ContentTransfer-CTzGGKFV.js → ContentTransfer-BhF9G56s.js} +2 -2
- package/src/{ContentTransfer-CTzGGKFV.js.map → ContentTransfer-BhF9G56s.js.map} +1 -1
- package/src/{DocumentEngine-BbhfnTAc.js → DocumentEngine-ClhFXW9M.js} +4 -4
- package/src/{DocumentEngine-BbhfnTAc.js.map → DocumentEngine-ClhFXW9M.js.map} +1 -1
- package/src/DocumentModel.d.ts +6 -1
- package/src/DocumentModel.js +4 -3
- package/src/DocumentModel.js.map +1 -1
- package/src/{Forms-CfcI3tPU.js → Forms-BbkE7QfC.js} +47 -16
- package/src/Forms-BbkE7QfC.js.map +1 -0
- package/src/{Forms-02-p8qEw.js → Forms-DoB56hfe.js} +24 -7
- package/src/Forms-DoB56hfe.js.map +1 -0
- package/src/{Forms-BorTcIlp.d.ts → Forms-R0HoTR-o.d.ts} +30 -9
- package/src/Forms.d.ts +16 -15
- package/src/Forms.js.map +1 -1
- package/src/{I18n-BXlVunfa.d.ts → I18n-zbqpWxki.d.ts} +3 -1
- package/src/I18n.d.ts +1 -1
- package/src/Module.js +4 -2
- package/src/Module.js.map +1 -1
- package/src/{S3MediaObjects-DC0c8sYC.js → S3MediaObjects-CR3p1WTg.js} +21 -13
- package/src/S3MediaObjects-CR3p1WTg.js.map +1 -0
- package/src/cli.js +60 -34
- package/src/cli.js.map +1 -1
- package/src/{connection-BPf4BQUZ.js → connection-D5S9Iph-.js} +2 -2
- package/src/{connection-BPf4BQUZ.js.map → connection-D5S9Iph-.js.map} +1 -1
- package/src/{dev-lifecycle-vQLxwCFq.js → dev-lifecycle-D3f9-upa.js} +129 -42
- package/src/dev-lifecycle-D3f9-upa.js.map +1 -0
- package/src/{installation-DsGst1BH.js → installation-fZtNxtoW.js} +68 -41
- package/src/installation-fZtNxtoW.js.map +1 -0
- package/src/internal/authoring-catalog.js +2 -2
- package/src/internal/authoring-metadata.js +1 -1
- package/src/internal/configuration.js +149 -50
- package/src/internal/configuration.js.map +1 -1
- package/src/internal/dev-lifecycle.js +2 -2
- package/src/internal/diagnostics.js +47 -0
- package/src/internal/diagnostics.js.map +1 -0
- package/src/internal/document-model.js +2 -2
- package/src/internal/form-capabilities.js +1 -1
- package/src/internal/i18n.js +6 -1
- package/src/internal/i18n.js.map +1 -1
- package/src/internal/studio-app.js +8 -6
- package/src/internal/studio-app.js.map +1 -1
- package/src/{location-BgYhXEZp.js → location-CPX7oj0o.js} +2 -2
- package/src/{location-BgYhXEZp.js.map → location-CPX7oj0o.js.map} +1 -1
- package/src/{models-k2nXyD6q.js → models-C9kF9JlQ.js} +2 -2
- package/src/{models-k2nXyD6q.js.map → models-C9kF9JlQ.js.map} +1 -1
- package/src/{models-DgkGTFus.js → models-ChRxBChy.js} +4 -2
- package/src/{models-DgkGTFus.js.map → models-ChRxBChy.js.map} +1 -1
- package/src/runtime/delivery/context.js +1 -1
- package/src/runtime/delivery/plugin.js +3 -2
- package/src/runtime/delivery/plugin.js.map +1 -1
- package/src/runtime/forms/document.js +1 -1
- package/src/runtime/forms/useCmsForm.js +73 -46
- package/src/runtime/forms/useCmsForm.js.map +1 -1
- package/src/runtime/i18n/useCmsI18n.d.ts +1 -1
- package/src/runtime/i18n/useCmsI18n.js.map +1 -1
- package/src/runtime/installation.js +1 -1
- package/src/runtime/plugin.js +12 -4
- package/src/runtime/plugin.js.map +1 -1
- package/src/runtime/preview/connection.js +1 -1
- package/src/runtime/preview/controller.js +2 -2
- package/src/runtime/preview/plugin.client.js +3 -3
- package/src/runtime/preview/plugin.client.js.map +1 -1
- package/src/runtime/preview/store.js +1 -1
- package/src/runtime/sitemap.js +1 -1
- package/src/{store-BYgSt7E3.js → store-CCsjHaZm.js} +8 -8
- package/src/store-CCsjHaZm.js.map +1 -0
- package/studio/{CreateDocumentDialog-BdiM77bb.js → CreateDocumentDialog-DJ8c0WZb.js} +3 -3
- package/studio/{documentPlanning-B7fyUj9r.js → documentPlanning-CDb31mnl.js} +6417 -6358
- package/studio/host.css +1 -1
- package/studio/host.js +7612 -7249
- package/src/Forms-02-p8qEw.js.map +0 -1
- package/src/Forms-CfcI3tPU.js.map +0 -1
- package/src/S3MediaObjects-DC0c8sYC.js.map +0 -1
- package/src/dev-lifecycle-vQLxwCFq.js.map +0 -1
- package/src/installation-DsGst1BH.js.map +0 -1
- package/src/store-BYgSt7E3.js.map +0 -1
package/src/Content.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as ContentSource, i as ContentSnapshot, n as ContentApplyResult, r as ContentPlan } from "./ContentTransfer-
|
|
1
|
+
import { a as ContentSource, i as ContentSnapshot, n as ContentApplyResult, r as ContentPlan } from "./ContentTransfer-BhF9G56s.js";
|
|
2
2
|
import { t as CMS_AUTHENTICATION_PATH, u as STUDIO_API_PATH } from "./HttpPaths-c9nLZ9H2.js";
|
|
3
3
|
import { Result, Schema } from "effect";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
5
|
-
import { mkdir, readFile, readdir, writeFile } from "node:fs/promises";
|
|
5
|
+
import { lstat, mkdir, readFile, readdir, writeFile } from "node:fs/promises";
|
|
6
6
|
import { dirname, extname, relative, resolve, sep } from "node:path";
|
|
7
7
|
|
|
8
8
|
//#region src/Content.ts
|
|
@@ -69,13 +69,18 @@ function createCmsContentClient(options) {
|
|
|
69
69
|
const snapshot = async () => contentRequest("snapshot", ContentSnapshot, "content snapshot");
|
|
70
70
|
return {
|
|
71
71
|
plan: async (source, authoredOptions = {}) => {
|
|
72
|
-
const
|
|
73
|
-
|
|
72
|
+
const sources = Object.freeze(source.sources.map((entry) => Object.freeze(ContentSource.make({
|
|
73
|
+
sourcePath: entry.sourcePath,
|
|
74
|
+
markdown: entry.markdown,
|
|
75
|
+
published: entry.published
|
|
76
|
+
}))));
|
|
77
|
+
const input = Object.freeze({
|
|
78
|
+
sources,
|
|
74
79
|
overwrite: authoredOptions.overwrite ?? false,
|
|
75
80
|
publish: authoredOptions.publish ?? false
|
|
76
|
-
};
|
|
81
|
+
});
|
|
77
82
|
const [protocol, current] = await Promise.all([contentRequest("plan", ContentPlan, "content plan", input), snapshot()]);
|
|
78
|
-
const sourcePaths = new Set(
|
|
83
|
+
const sourcePaths = new Set(sources.map((entry) => entry.sourcePath));
|
|
79
84
|
const entries = (action) => protocol.entries.filter((entry) => entry.action === action);
|
|
80
85
|
const plan = Object.freeze({
|
|
81
86
|
generation: protocol.generation,
|
|
@@ -125,7 +130,7 @@ function createCmsContentClient(options) {
|
|
|
125
130
|
async function readCmsContentDirectory(directory) {
|
|
126
131
|
try {
|
|
127
132
|
const root = resolve(directory);
|
|
128
|
-
const indexPath =
|
|
133
|
+
const indexPath = await safeContentFile(root, ".cms-content.json");
|
|
129
134
|
let index;
|
|
130
135
|
try {
|
|
131
136
|
index = parseIndex(await readFile(indexPath, "utf8"));
|
|
@@ -134,7 +139,7 @@ async function readCmsContentDirectory(directory) {
|
|
|
134
139
|
}
|
|
135
140
|
if (index) return { sources: await Promise.all(index.sources.map(async (entry) => decode(ContentSource, {
|
|
136
141
|
sourcePath: entry.sourcePath,
|
|
137
|
-
markdown: await readFile(
|
|
142
|
+
markdown: await readFile(await safeContentFile(root, entry.sourcePath), "utf8"),
|
|
138
143
|
published: entry.published
|
|
139
144
|
}, "content source"))) };
|
|
140
145
|
const files = await markdownFiles(root);
|
|
@@ -166,34 +171,37 @@ const ContentIndex = Schema.Struct({
|
|
|
166
171
|
async function writeContentDirectory(directory, sources) {
|
|
167
172
|
try {
|
|
168
173
|
const root = resolve(directory);
|
|
174
|
+
const indexPath = await safeContentFile(root, ".cms-content.json");
|
|
175
|
+
await Promise.all(sources.map((source) => safeContentFile(root, source.sourcePath)));
|
|
169
176
|
let previous;
|
|
170
177
|
try {
|
|
171
|
-
previous = parseIndex(await readFile(
|
|
178
|
+
previous = parseIndex(await readFile(indexPath, "utf8"));
|
|
172
179
|
} catch (cause) {
|
|
173
180
|
if (!isMissingFile(cause)) throw cause;
|
|
174
181
|
}
|
|
182
|
+
const previousByPath = new Map(previous?.sources.map((entry) => [entry.sourcePath, entry]));
|
|
175
183
|
if (previous) {
|
|
176
184
|
const metadata = {
|
|
177
185
|
version: previous.version,
|
|
178
186
|
sources: previous.sources
|
|
179
187
|
};
|
|
180
188
|
if (sha256(JSON.stringify(metadata)) !== previous.exportSha256) throw new CmsContentError("filesystem-error", "The local .cms-content.json file has been edited.");
|
|
181
|
-
const previousByPath = new Map(previous.sources.map((entry) => [entry.sourcePath, entry]));
|
|
182
189
|
const incomingPaths = new Set(sources.map((source) => source.sourcePath));
|
|
183
190
|
for (const entry of previous.sources) if (!incomingPaths.has(entry.sourcePath)) throw new CmsContentError("filesystem-error", `CMS document ${entry.sourcePath} no longer exists; resolve the local file before exporting again.`);
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
+
}
|
|
192
|
+
for (const source of sources) try {
|
|
193
|
+
const local = await readFile(await safeContentFile(root, source.sourcePath), "utf8");
|
|
194
|
+
const before = previousByPath.get(source.sourcePath);
|
|
195
|
+
if (before ? sha256(local) !== before.sha256 : local !== source.markdown) throw new CmsContentError("filesystem-error", `Local edits in ${source.sourcePath}; export was stopped.`);
|
|
196
|
+
} catch (cause) {
|
|
197
|
+
if (!isMissingFile(cause)) throw cause;
|
|
191
198
|
}
|
|
192
199
|
await mkdir(root, { recursive: true });
|
|
193
200
|
const entries = [];
|
|
194
201
|
for (const source of sources) {
|
|
195
|
-
const file =
|
|
202
|
+
const file = await safeContentFile(root, source.sourcePath);
|
|
196
203
|
await mkdir(dirname(file), { recursive: true });
|
|
204
|
+
await safeContentFile(root, source.sourcePath);
|
|
197
205
|
await writeFile(file, source.markdown);
|
|
198
206
|
entries.push({
|
|
199
207
|
sourcePath: source.sourcePath,
|
|
@@ -209,7 +217,8 @@ async function writeContentDirectory(directory, sources) {
|
|
|
209
217
|
...metadata,
|
|
210
218
|
exportSha256: sha256(JSON.stringify(metadata))
|
|
211
219
|
};
|
|
212
|
-
await
|
|
220
|
+
await safeContentFile(root, ".cms-content.json");
|
|
221
|
+
await writeFile(indexPath, `${JSON.stringify(index, void 0, 2)}\n`);
|
|
213
222
|
} catch (cause) {
|
|
214
223
|
throw new CmsContentError("filesystem-error", `Could not export CMS content to ${directory}.`, { cause });
|
|
215
224
|
}
|
|
@@ -246,6 +255,20 @@ function safeContentPath(root, sourcePath) {
|
|
|
246
255
|
if (!path.startsWith(`${root}${sep}`)) throw new CmsContentError("filesystem-error", `Unsafe content path: ${sourcePath}`);
|
|
247
256
|
return path;
|
|
248
257
|
}
|
|
258
|
+
async function safeContentFile(root, sourcePath) {
|
|
259
|
+
const path = safeContentPath(root, sourcePath);
|
|
260
|
+
const segments = relative(root, path).split(sep);
|
|
261
|
+
let current = root;
|
|
262
|
+
for (const segment of ["", ...segments]) {
|
|
263
|
+
current = segment ? resolve(current, segment) : current;
|
|
264
|
+
try {
|
|
265
|
+
if ((await lstat(current)).isSymbolicLink()) throw new CmsContentError("filesystem-error", `Symlinks are not allowed in CMS content paths: ${sourcePath}`);
|
|
266
|
+
} catch (cause) {
|
|
267
|
+
if (!isMissingFile(cause)) throw cause;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
return path;
|
|
271
|
+
}
|
|
249
272
|
function contentBaseUrl(value) {
|
|
250
273
|
let url;
|
|
251
274
|
try {
|
package/src/Content.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Content.js","names":["ContentSnapshotSchema","ProtocolContentPlanSchema","ContentApplyResultSchema","ContentSourceSchema"],"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 ContentPlan as ProtocolContentPlanSchema,\n ContentSource as ContentSourceSchema,\n ContentSnapshot as ContentSnapshotSchema,\n} from '@internal/protocol/ContentTransfer'\nimport type { DocumentIssue } 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 { 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 conflicts: ReadonlyArray<CmsContentPlanEntry>\n readonly unchanged: ReadonlyArray<CmsContentPlanEntry>\n readonly issues: ReadonlyArray<DocumentIssue>\n readonly targetOnly: ReadonlyArray<ContentSource>\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 sourcePath: string\n readonly local?: ContentSource\n readonly target?: ContentSource\n readonly markdownChanged: boolean\n readonly publicationChanged: boolean\n }>\n readonly targetOnly: ReadonlyArray<ContentSource>\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 throw new CmsContentError('network-error', `CMS content request failed (${response.status}).`)\n }\n\n let payload: unknown\n\n try {\n payload = await response.json()\n } catch (cause) {\n throw new CmsContentError('invalid-response', 'CMS returned an invalid JSON response.', { cause })\n }\n\n return decode(schema, payload, 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 input = {\n sources: source.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 sourcePaths = new Set(source.sources.map((entry) => entry.sourcePath))\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 conflicts: entries('conflict'),\n unchanged: entries('unchanged'),\n issues: protocol.issues,\n targetOnly: current.sources.filter((entry) => !sourcePaths.has(entry.sourcePath)),\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 await writeContentDirectory(directory, value.sources)\n\n return { sources: value.sources }\n },\n readDocument: async (documentId) => {\n const document = (await snapshot()).sources.find((source) => source.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 = resolve(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 sourcePath: entry.sourcePath,\n markdown: await readFile(safeContentPath(root, entry.sourcePath), 'utf8'),\n published: entry.published,\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 sourcePath: 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>,\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 sourcePath: ContentSourceSchema.fields.sourcePath,\n published: Schema.Boolean,\n sha256: ContentHash,\n})\n\nconst ContentIndex = Schema.Struct({\n version: Schema.Literal(1),\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(directory: string, sources: ReadonlyArray<ContentSource>): Promise<void> {\n try {\n const root = resolve(directory)\n let previous: ContentIndex | undefined\n\n try {\n previous = parseIndex(await readFile(resolve(root, '.cms-content.json'), 'utf8'))\n } catch (cause) {\n if (!isMissingFile(cause)) throw cause\n }\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 previousByPath = new Map(previous.sources.map((entry) => [entry.sourcePath, entry]))\n const incomingPaths = new Set(sources.map((source) => source.sourcePath))\n\n for (const entry of previous.sources)\n if (!incomingPaths.has(entry.sourcePath))\n throw new CmsContentError(\n 'filesystem-error',\n `CMS document ${entry.sourcePath} no longer exists; resolve the local file before exporting again.`,\n )\n\n for (const source of sources) {\n try {\n const local = await readFile(safeContentPath(root, source.sourcePath), 'utf8')\n const before = previousByPath.get(source.sourcePath)\n\n if (before ? sha256(local) !== before.sha256 : local !== source.markdown)\n throw new CmsContentError('filesystem-error', `Local edits in ${source.sourcePath}; export was stopped.`)\n } catch (cause) {\n if (!isMissingFile(cause)) throw cause\n }\n }\n }\n\n await mkdir(root, { recursive: true })\n const entries: ContentIndexEntry[] = []\n\n for (const source of sources) {\n const file = safeContentPath(root, source.sourcePath)\n await mkdir(dirname(file), { recursive: true })\n await writeFile(file, source.markdown)\n entries.push({ sourcePath: source.sourcePath, published: source.published, sha256: sha256(source.markdown) })\n }\n\n const metadata = { version: 1 as const, sources: entries }\n const index: ContentIndex = { ...metadata, exportSha256: sha256(JSON.stringify(metadata)) }\n await writeFile(resolve(root, '.cms-content.json'), `${JSON.stringify(index, undefined, 2)}\\n`)\n } catch (cause) {\n throw new CmsContentError('filesystem-error', `Could not export CMS content to ${directory}.`, { cause })\n }\n}\n\nfunction diffSources(local: ReadonlyArray<ContentSource>, target: ReadonlyArray<ContentSource>): CmsContentDiff {\n const targetByPath = new Map(target.map((source) => [source.sourcePath, source]))\n const localPaths = new Set(local.map((source) => source.sourcePath))\n\n return {\n changes: local.flatMap((source) => {\n const current = targetByPath.get(source.sourcePath)\n const markdownChanged = current?.markdown !== source.markdown\n const publicationChanged = current !== undefined && current.published !== source.published\n\n return markdownChanged || publicationChanged\n ? [{ sourcePath: source.sourcePath, local: source, target: current, markdownChanged, publicationChanged }]\n : []\n }),\n targetOnly: target.filter((source) => !localPaths.has(source.sourcePath)),\n }\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, sourcePath: string): string {\n const path = resolve(root, sourcePath)\n\n if (!path.startsWith(`${root}${sep}`))\n throw new CmsContentError('filesystem-error', `Unsafe content path: ${sourcePath}`)\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\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 sourcePaths = new Set(decoded.success.sources.map((entry) => entry.sourcePath))\n\n if (sourcePaths.size !== decoded.success.sources.length)\n throw new CmsContentError('filesystem-error', 'The .cms-content.json index contains duplicate source 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":";;;;;;;;AAgCA,IAAa,kBAAb,cAAqC,MAAM;CACzC,AAAS;CACT,AAAS;CACT,AAAS;CAET,YACE,MACA,SACA,UAII,CAAC,GACL;EACA,MAAM,SAAS,QAAQ,UAAU,SAAY,SAAY,EAAE,OAAO,QAAQ,MAAM,CAAC;EACjF,KAAK,OAAO;EACZ,KAAK,OAAO;EACZ,KAAK,YAAY,QAAQ;EACzB,KAAK,SAAS,QAAQ;CACxB;AACF;AAuEA,MAAM,wBAAQ,IAAI,QAAmC;AAErD,SAAgB,uBAAuB,SAAoD;CACzF,MAAM,UAAU,eAAe,QAAQ,OAAO;CAC9C,MAAM,eAAe,QAAQ,SAAS,WAAW;CACjD,MAAM,WAAW,CAAC;CAClB,IAAI;CAEJ,MAAM,eAAe,YAA6B;EAChD,IAAI,QAAQ,OAAO;EAEnB,SAAS,QAAQ,cAAc,IAAI,IAAI,GAAG,wBAAwB,iBAAiB,OAAO,GAAG;GAC3F,QAAQ;GACR,SAAS;IAAE,QAAQ;IAAoB,gBAAgB;IAAoB,QAAQ,QAAQ;GAAO;GAClG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AS,cAAc,OAAyB;CAC9C,OAAO,iBAAiB,SAAS,UAAU,SAAS,MAAM,SAAS;AACrE"}
|
|
1
|
+
{"version":3,"file":"Content.js","names":["ContentSnapshotSchema","ContentSourceSchema","ProtocolContentPlanSchema","ContentApplyResultSchema"],"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 ContentPlan as ProtocolContentPlanSchema,\n ContentSource as ContentSourceSchema,\n ContentSnapshot as ContentSnapshotSchema,\n} from '@internal/protocol/ContentTransfer'\nimport type { DocumentIssue } 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 conflicts: ReadonlyArray<CmsContentPlanEntry>\n readonly unchanged: ReadonlyArray<CmsContentPlanEntry>\n readonly issues: ReadonlyArray<DocumentIssue>\n readonly targetOnly: ReadonlyArray<ContentSource>\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 sourcePath: string\n readonly local?: ContentSource\n readonly target?: ContentSource\n readonly markdownChanged: boolean\n readonly publicationChanged: boolean\n }>\n readonly targetOnly: ReadonlyArray<ContentSource>\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 throw new CmsContentError('network-error', `CMS content request failed (${response.status}).`)\n }\n\n let payload: unknown\n\n try {\n payload = await response.json()\n } catch (cause) {\n throw new CmsContentError('invalid-response', 'CMS returned an invalid JSON response.', { cause })\n }\n\n return decode(schema, payload, 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 sourcePath: entry.sourcePath,\n markdown: entry.markdown,\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 sourcePaths = new Set(sources.map((entry) => entry.sourcePath))\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 conflicts: entries('conflict'),\n unchanged: entries('unchanged'),\n issues: protocol.issues,\n targetOnly: current.sources.filter((entry) => !sourcePaths.has(entry.sourcePath)),\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 await writeContentDirectory(directory, value.sources)\n\n return { sources: value.sources }\n },\n readDocument: async (documentId) => {\n const document = (await snapshot()).sources.find((source) => source.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 sourcePath: entry.sourcePath,\n markdown: await readFile(await safeContentFile(root, entry.sourcePath), 'utf8'),\n published: entry.published,\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 sourcePath: 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>,\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 sourcePath: ContentSourceSchema.fields.sourcePath,\n published: Schema.Boolean,\n sha256: ContentHash,\n})\n\nconst ContentIndex = Schema.Struct({\n version: Schema.Literal(1),\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(directory: string, sources: ReadonlyArray<ContentSource>): Promise<void> {\n try {\n const root = resolve(directory)\n const indexPath = await safeContentFile(root, '.cms-content.json')\n await Promise.all(sources.map((source) => safeContentFile(root, source.sourcePath)))\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 previousByPath = new Map(previous?.sources.map((entry) => [entry.sourcePath, entry]))\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 incomingPaths = new Set(sources.map((source) => source.sourcePath))\n\n for (const entry of previous.sources)\n if (!incomingPaths.has(entry.sourcePath))\n throw new CmsContentError(\n 'filesystem-error',\n `CMS document ${entry.sourcePath} no longer exists; resolve the local file before exporting again.`,\n )\n }\n\n for (const source of sources) {\n try {\n const local = await readFile(await safeContentFile(root, source.sourcePath), 'utf8')\n const before = previousByPath.get(source.sourcePath)\n\n if (before ? sha256(local) !== before.sha256 : local !== source.markdown)\n throw new CmsContentError('filesystem-error', `Local edits in ${source.sourcePath}; 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 file = await safeContentFile(root, source.sourcePath)\n await mkdir(dirname(file), { recursive: true })\n await safeContentFile(root, source.sourcePath)\n await writeFile(file, source.markdown)\n entries.push({ sourcePath: source.sourcePath, published: source.published, sha256: sha256(source.markdown) })\n }\n\n const metadata = { version: 1 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 } catch (cause) {\n throw new CmsContentError('filesystem-error', `Could not export CMS content to ${directory}.`, { cause })\n }\n}\n\nfunction diffSources(local: ReadonlyArray<ContentSource>, target: ReadonlyArray<ContentSource>): CmsContentDiff {\n const targetByPath = new Map(target.map((source) => [source.sourcePath, source]))\n const localPaths = new Set(local.map((source) => source.sourcePath))\n\n return {\n changes: local.flatMap((source) => {\n const current = targetByPath.get(source.sourcePath)\n const markdownChanged = current?.markdown !== source.markdown\n const publicationChanged = current !== undefined && current.published !== source.published\n\n return markdownChanged || publicationChanged\n ? [{ sourcePath: source.sourcePath, local: source, target: current, markdownChanged, publicationChanged }]\n : []\n }),\n targetOnly: target.filter((source) => !localPaths.has(source.sourcePath)),\n }\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, sourcePath: string): string {\n const path = resolve(root, sourcePath)\n\n if (!path.startsWith(`${root}${sep}`))\n throw new CmsContentError('filesystem-error', `Unsafe content path: ${sourcePath}`)\n\n return path\n}\n\nasync function safeContentFile(root: string, sourcePath: string): Promise<string> {\n const path = safeContentPath(root, sourcePath)\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: ${sourcePath}`)\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\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 sourcePaths = new Set(decoded.success.sources.map((entry) => entry.sourcePath))\n\n if (sourcePaths.size !== decoded.success.sources.length)\n throw new CmsContentError('filesystem-error', 'The .cms-content.json index contains duplicate source 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":";;;;;;;;AAgCA,IAAa,kBAAb,cAAqC,MAAM;CACzC,AAAS;CACT,AAAS;CACT,AAAS;CAET,YACE,MACA,SACA,UAII,CAAC,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CAErE,CAAC,CAAC,SAAS,QAAQ,QAAQ,QAAQ,QAC/C,MAAM,IAAI,gBAAgB,oBAAoB,8DAA8D;CAE9G,OAAO,QAAQ;AACjB;AAEA,SAAS,cAAc,OAAyB;CAC9C,OAAO,iBAAiB,SAAS,UAAU,SAAS,MAAM,SAAS;AACrE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as RevisionId, d as SourcePath, r as DocumentId, t as DocumentGeneration } from "./scalars-B2lgGUnj.js";
|
|
2
|
-
import { c as DocumentIssue } from "./models-
|
|
2
|
+
import { c as DocumentIssue } from "./models-ChRxBChy.js";
|
|
3
3
|
import { Schema } from "effect";
|
|
4
4
|
|
|
5
5
|
//#region ../protocol/src/ContentTransfer.ts
|
|
@@ -54,4 +54,4 @@ var ContentTransferConflict = class extends Schema.TaggedError()("Content.Transf
|
|
|
54
54
|
|
|
55
55
|
//#endregion
|
|
56
56
|
export { ContentSource as a, ContentSnapshot as i, ContentApplyResult as n, ContentTransferConflict as o, ContentPlan as r, ContentTransferInput as s, ContentApplyInput as t };
|
|
57
|
-
//# sourceMappingURL=ContentTransfer-
|
|
57
|
+
//# sourceMappingURL=ContentTransfer-BhF9G56s.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentTransfer-
|
|
1
|
+
{"version":3,"file":"ContentTransfer-BhF9G56s.js","names":[],"sources":["../../../../protocol/src/ContentTransfer.ts"],"sourcesContent":["import { Schema } from 'effect'\nimport { DocumentGeneration, DocumentId, DocumentIssue, RevisionId, SourcePath } from './Documents'\n\nexport const ContentSource = Schema.Struct({\n sourcePath: SourcePath,\n markdown: Schema.String,\n /** True only when this exact authored revision is published. */\n published: Schema.Boolean,\n})\n\nexport interface ContentSource extends Schema.Schema.Type<typeof ContentSource> {}\n\nexport const ContentSnapshotSource = Schema.Struct({\n ...ContentSource.fields,\n documentId: DocumentId,\n})\n\nexport interface ContentSnapshotSource extends Schema.Schema.Type<typeof ContentSnapshotSource> {}\n\nexport const ContentSnapshot = Schema.Struct({\n version: Schema.Literal(1),\n sources: Schema.Array(ContentSnapshotSource),\n})\n\nexport interface ContentSnapshot extends Schema.Schema.Type<typeof ContentSnapshot> {}\n\nexport const ContentTransferInput = Schema.Struct({\n sources: Schema.Array(ContentSource),\n overwrite: Schema.Boolean,\n publish: Schema.Boolean,\n})\n\nexport interface ContentTransferInput extends Schema.Schema.Type<typeof ContentTransferInput> {}\n\nexport const ContentPlanEntry = Schema.Struct({\n sourcePath: SourcePath,\n action: Schema.Literals(['create', 'update', 'publish', 'unchanged', 'conflict']),\n currentRevisionId: Schema.NullOr(RevisionId),\n})\n\nexport interface ContentPlanEntry extends Schema.Schema.Type<typeof ContentPlanEntry> {}\n\nexport const ContentPlan = Schema.Struct({\n generation: DocumentGeneration,\n entries: Schema.Array(ContentPlanEntry),\n issues: Schema.Array(DocumentIssue),\n valid: Schema.Boolean,\n})\n\nexport interface ContentPlan extends Schema.Schema.Type<typeof ContentPlan> {}\n\nexport const ContentApplyInput = Schema.Struct({\n ...ContentTransferInput.fields,\n expectedGeneration: DocumentGeneration,\n})\n\nexport interface ContentApplyInput extends Schema.Schema.Type<typeof ContentApplyInput> {}\n\nexport const ContentApplyResult = Schema.Struct({\n created: Schema.Int,\n updated: Schema.Int,\n published: Schema.Int,\n unchanged: Schema.Int,\n generation: DocumentGeneration,\n})\n\nexport interface ContentApplyResult extends Schema.Schema.Type<typeof ContentApplyResult> {}\n\nexport class ContentTransferConflict extends Schema.TaggedError<ContentTransferConflict>()('Content.TransferConflict', {\n message: Schema.NonEmptyString,\n}) {}\n"],"mappings":";;;;;AAGA,MAAa,gBAAgB,OAAO,OAAO;CACzC,YAAY;CACZ,UAAU,OAAO;;CAEjB,WAAW,OAAO;AACpB,CAAC;AAID,MAAa,wBAAwB,OAAO,OAAO;CACjD,GAAG,cAAc;CACjB,YAAY;AACd,CAAC;AAID,MAAa,kBAAkB,OAAO,OAAO;CAC3C,SAAS,OAAO,QAAQ,CAAC;CACzB,SAAS,OAAO,MAAM,qBAAqB;AAC7C,CAAC;AAID,MAAa,uBAAuB,OAAO,OAAO;CAChD,SAAS,OAAO,MAAM,aAAa;CACnC,WAAW,OAAO;CAClB,SAAS,OAAO;AAClB,CAAC;AAID,MAAa,mBAAmB,OAAO,OAAO;CAC5C,YAAY;CACZ,QAAQ,OAAO,SAAS;EAAC;EAAU;EAAU;EAAW;EAAa;CAAU,CAAC;CAChF,mBAAmB,OAAO,OAAO,UAAU;AAC7C,CAAC;AAID,MAAa,cAAc,OAAO,OAAO;CACvC,YAAY;CACZ,SAAS,OAAO,MAAM,gBAAgB;CACtC,QAAQ,OAAO,MAAM,aAAa;CAClC,OAAO,OAAO;AAChB,CAAC;AAID,MAAa,oBAAoB,OAAO,OAAO;CAC7C,GAAG,qBAAqB;CACxB,oBAAoB;AACtB,CAAC;AAID,MAAa,qBAAqB,OAAO,OAAO;CAC9C,SAAS,OAAO;CAChB,SAAS,OAAO;CAChB,WAAW,OAAO;CAClB,WAAW,OAAO;CAClB,YAAY;AACd,CAAC;AAID,IAAa,0BAAb,cAA6C,OAAO,YAAqC,CAAC,CAAC,4BAA4B,EACrH,SAAS,OAAO,eAClB,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { d as SourcePath, o as PublicPath } from "./scalars-B2lgGUnj.js";
|
|
2
|
-
import { M as DocumentSeo, c as DocumentIssue, h as DocumentSourceMapping, n as CmsMarkdownDocument, r as CompiledDocument, t as CmsDocumentAnalysis, v as DocumentValidationResult } from "./models-
|
|
3
|
-
import { c as resolveCmsComarkAttributes, d as createCmsComarkRenderData, l as withCmsComarkProps, o as normalizeCmsComponentBindings, u as cmsComarkTextContent } from "./Forms-
|
|
4
|
-
import { f as DOCUMENT_ENGINE_FINGERPRINT, l as validateCollectionBody, m as SOURCE_MAPPINGS_META_KEY, o as createAuthoringDocumentValidator, p as createDocumentParser } from "./Configuration-
|
|
2
|
+
import { M as DocumentSeo, c as DocumentIssue, h as DocumentSourceMapping, n as CmsMarkdownDocument, r as CompiledDocument, t as CmsDocumentAnalysis, v as DocumentValidationResult } from "./models-ChRxBChy.js";
|
|
3
|
+
import { c as resolveCmsComarkAttributes, d as createCmsComarkRenderData, l as withCmsComarkProps, o as normalizeCmsComponentBindings, u as cmsComarkTextContent } from "./Forms-DoB56hfe.js";
|
|
4
|
+
import { f as DOCUMENT_ENGINE_FINGERPRINT, l as validateCollectionBody, m as SOURCE_MAPPINGS_META_KEY, o as createAuthoringDocumentValidator, p as createDocumentParser } from "./Configuration-BU-UyGoH.js";
|
|
5
5
|
import { DateTime, Effect, Option, Predicate, Result, Schema } from "effect";
|
|
6
6
|
|
|
7
7
|
//#region ../document/src/internal/document-address.ts
|
|
@@ -874,4 +874,4 @@ function errorMessage(cause) {
|
|
|
874
874
|
|
|
875
875
|
//#endregion
|
|
876
876
|
export { normalizeDocumentRelativePath as a, resolveDocumentAddress as c, localizeDocumentPath as i, referenceTarget as n, normalizePublicPath as o, DocumentCompilationFailed as r, parseDocumentAddress as s, createDocumentEngine as t };
|
|
877
|
-
//# sourceMappingURL=DocumentEngine-
|
|
877
|
+
//# sourceMappingURL=DocumentEngine-ClhFXW9M.js.map
|