@phtngyn/cms 0.1.0-beta.4 → 0.2.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +85 -5
- package/package.json +12 -1
- package/src/ApplicationTypes.d.ts +82 -0
- package/src/ApplicationTypes.js +1 -0
- package/src/{Configuration-CDMYfTre.js → Configuration-CjVUBBwa.js} +3 -3
- package/src/{Configuration-CDMYfTre.js.map → Configuration-CjVUBBwa.js.map} +1 -1
- package/src/Configuration.d.ts +9 -4
- package/src/Configuration.js.map +1 -1
- package/src/Content.d.ts +67 -0
- package/src/Content.js +291 -0
- package/src/Content.js.map +1 -0
- package/src/ContentTransfer-CRQet3QJ.d.ts +48 -0
- package/src/{ContentTransfer-C3Av9sWz.js → ContentTransfer-CTzGGKFV.js} +8 -4
- package/src/ContentTransfer-CTzGGKFV.js.map +1 -0
- package/src/{DocumentEngine-J7g-emdf.js → DocumentEngine-BbhfnTAc.js} +4 -4
- package/src/{DocumentEngine-J7g-emdf.js.map → DocumentEngine-BbhfnTAc.js.map} +1 -1
- package/src/DocumentModel.d.ts +8 -1
- package/src/DocumentModel.js +29 -2
- package/src/DocumentModel.js.map +1 -1
- package/src/{Forms-Dj6NuW66.js → Forms-02-p8qEw.js} +2 -2
- package/src/{Forms-Dj6NuW66.js.map → Forms-02-p8qEw.js.map} +1 -1
- package/src/{Forms-BsJMev5_.d.ts → Forms-BorTcIlp.d.ts} +2 -5
- package/src/Forms.d.ts +25 -14
- package/src/Forms.js.map +1 -1
- package/src/I18n-BXlVunfa.d.ts +27 -0
- package/src/I18n.d.ts +2 -20
- package/src/Module.js +14 -5
- package/src/Module.js.map +1 -1
- package/src/{S3MediaObjects-CpPSzJto.js → S3MediaObjects-DC0c8sYC.js} +54 -35
- package/src/{S3MediaObjects-CpPSzJto.js.map → S3MediaObjects-DC0c8sYC.js.map} +1 -1
- package/src/cli/content.js +63 -221
- package/src/cli/content.js.map +1 -1
- package/src/cli.js +93 -4
- package/src/cli.js.map +1 -1
- package/src/{connection-CBAy2qGy.js → connection-BPf4BQUZ.js} +2 -2
- package/src/{connection-CBAy2qGy.js.map → connection-BPf4BQUZ.js.map} +1 -1
- package/src/dev-lifecycle-vQLxwCFq.js +428 -0
- package/src/dev-lifecycle-vQLxwCFq.js.map +1 -0
- package/src/{installation-CNfIriVm.js → installation-DsGst1BH.js} +578 -457
- package/src/installation-DsGst1BH.js.map +1 -0
- package/src/internal/application-types.js +43 -0
- package/src/internal/application-types.js.map +1 -0
- package/src/internal/authoring-catalog.js +9 -4
- package/src/internal/authoring-catalog.js.map +1 -1
- package/src/internal/authoring-metadata.js +1 -1
- package/src/internal/configuration.js +10 -6
- package/src/internal/configuration.js.map +1 -1
- package/src/internal/dev-lifecycle.js +3 -0
- package/src/internal/document-model.js +2 -2
- package/src/internal/document-model.js.map +1 -1
- package/src/internal/i18n.js +21 -0
- package/src/internal/i18n.js.map +1 -1
- package/src/{location-BTqdfIzX.js → location-BgYhXEZp.js} +2 -2
- package/src/{location-BTqdfIzX.js.map → location-BgYhXEZp.js.map} +1 -1
- package/src/{models-Bah5B3bT.js → models-DgkGTFus.js} +6 -1
- package/src/models-DgkGTFus.js.map +1 -0
- package/src/{models-B4IoTmp7.js → models-k2nXyD6q.js} +2 -2
- package/src/{models-B4IoTmp7.js.map → models-k2nXyD6q.js.map} +1 -1
- package/src/runtime/delivery/context.js +1 -1
- package/src/runtime/delivery/plugin.js +27 -5
- package/src/runtime/delivery/plugin.js.map +1 -1
- package/src/runtime/delivery/preview.d.ts +1 -1
- package/src/runtime/delivery/types.d.ts +2 -85
- package/src/runtime/delivery/useCmsDocumentSeo.d.ts +8 -1
- package/src/runtime/delivery/useCmsDocumentSeo.js +19 -7
- package/src/runtime/delivery/useCmsDocumentSeo.js.map +1 -1
- package/src/runtime/delivery/useDocument.d.ts +2 -2
- package/src/runtime/delivery/useDocument.js.map +1 -1
- package/src/runtime/delivery/useDocumentQuery.d.ts +3 -3
- package/src/runtime/delivery/useDocumentQuery.js.map +1 -1
- package/src/runtime/forms/document.js +1 -1
- package/src/runtime/forms/useCmsForm.js +81 -41
- package/src/runtime/forms/useCmsForm.js.map +1 -1
- package/src/runtime/i18n/useCmsI18n.d.ts +9 -7
- package/src/runtime/i18n/useCmsI18n.js +5 -4
- package/src/runtime/i18n/useCmsI18n.js.map +1 -1
- package/src/runtime/installation.js +2 -2
- package/src/runtime/plugin.js +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/store.js +1 -1
- package/src/runtime/sitemap.js +1 -1
- package/src/scalars-CA6kyipS.d.ts +7 -0
- package/src/{store-b2CSXgMt.js → store-BYgSt7E3.js} +3 -3
- package/src/{store-b2CSXgMt.js.map → store-BYgSt7E3.js.map} +1 -1
- package/src/types-DutFRtaG.d.ts +90 -0
- package/studio/{CreateDocumentDialog-GGey1uBc.js → CreateDocumentDialog-BdiM77bb.js} +1 -1
- package/studio/{documentPlanning-DRErYmBU.js → documentPlanning-B7fyUj9r.js} +7072 -7065
- package/studio/host.js +2 -2
- package/src/ContentTransfer-C3Av9sWz.js.map +0 -1
- package/src/installation-CNfIriVm.js.map +0 -1
- package/src/models-Bah5B3bT.js.map +0 -1
package/src/Content.js
ADDED
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import { a as ContentSource, i as ContentSnapshot, n as ContentApplyResult, r as ContentPlan } from "./ContentTransfer-CTzGGKFV.js";
|
|
2
|
+
import { t as CMS_AUTHENTICATION_PATH, u as STUDIO_API_PATH } from "./HttpPaths-c9nLZ9H2.js";
|
|
3
|
+
import { Result, Schema } from "effect";
|
|
4
|
+
import { createHash } from "node:crypto";
|
|
5
|
+
import { mkdir, readFile, readdir, writeFile } from "node:fs/promises";
|
|
6
|
+
import { dirname, extname, relative, resolve, sep } from "node:path";
|
|
7
|
+
|
|
8
|
+
//#region src/Content.ts
|
|
9
|
+
var CmsContentError = class extends Error {
|
|
10
|
+
code;
|
|
11
|
+
conflicts;
|
|
12
|
+
issues;
|
|
13
|
+
constructor(code, message, options = {}) {
|
|
14
|
+
super(message, options.cause === void 0 ? void 0 : { cause: options.cause });
|
|
15
|
+
this.name = "CmsContentError";
|
|
16
|
+
this.code = code;
|
|
17
|
+
this.conflicts = options.conflicts;
|
|
18
|
+
this.issues = options.issues;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const plans = /* @__PURE__ */ new WeakMap();
|
|
22
|
+
function createCmsContentClient(options) {
|
|
23
|
+
const baseUrl = contentBaseUrl(options.baseUrl);
|
|
24
|
+
const requestFetch = options.fetch ?? globalThis.fetch;
|
|
25
|
+
const identity = {};
|
|
26
|
+
let cookie;
|
|
27
|
+
const authenticate = async () => {
|
|
28
|
+
if (cookie) return cookie;
|
|
29
|
+
cookie = request(requestFetch, new URL(`${CMS_AUTHENTICATION_PATH}/sign-in/email`, baseUrl), {
|
|
30
|
+
method: "POST",
|
|
31
|
+
headers: {
|
|
32
|
+
accept: "application/json",
|
|
33
|
+
"content-type": "application/json",
|
|
34
|
+
origin: baseUrl.origin
|
|
35
|
+
},
|
|
36
|
+
body: JSON.stringify(options.credentials)
|
|
37
|
+
}).then(async (response) => {
|
|
38
|
+
if (!response.ok) throw new CmsContentError("authentication-required", `CMS sign-in failed (${response.status}).`);
|
|
39
|
+
const value = response.headers.get("set-cookie")?.split(";", 1)[0];
|
|
40
|
+
if (!value) throw new CmsContentError("authentication-required", "CMS sign-in did not return a session cookie.");
|
|
41
|
+
return value;
|
|
42
|
+
});
|
|
43
|
+
return cookie;
|
|
44
|
+
};
|
|
45
|
+
const contentRequest = async (path, schema, label, body) => {
|
|
46
|
+
const session = await authenticate();
|
|
47
|
+
const response = await request(requestFetch, new URL(`${STUDIO_API_PATH}/content/${path}`, baseUrl), {
|
|
48
|
+
method: body === void 0 ? "GET" : "POST",
|
|
49
|
+
headers: {
|
|
50
|
+
accept: "application/json",
|
|
51
|
+
cookie: session,
|
|
52
|
+
...body === void 0 ? void 0 : { "content-type": "application/json" }
|
|
53
|
+
},
|
|
54
|
+
...body === void 0 ? void 0 : { body: JSON.stringify(body) }
|
|
55
|
+
});
|
|
56
|
+
if (!response.ok) {
|
|
57
|
+
if (response.status === 401 || response.status === 403) throw new CmsContentError("authentication-required", `CMS content request was rejected (${response.status}).`);
|
|
58
|
+
if (response.status === 409) throw new CmsContentError("generation-changed", "The CMS changed after this content plan was created.");
|
|
59
|
+
throw new CmsContentError("network-error", `CMS content request failed (${response.status}).`);
|
|
60
|
+
}
|
|
61
|
+
let payload;
|
|
62
|
+
try {
|
|
63
|
+
payload = await response.json();
|
|
64
|
+
} catch (cause) {
|
|
65
|
+
throw new CmsContentError("invalid-response", "CMS returned an invalid JSON response.", { cause });
|
|
66
|
+
}
|
|
67
|
+
return decode(schema, payload, label);
|
|
68
|
+
};
|
|
69
|
+
const snapshot = async () => contentRequest("snapshot", ContentSnapshot, "content snapshot");
|
|
70
|
+
return {
|
|
71
|
+
plan: async (source, authoredOptions = {}) => {
|
|
72
|
+
const input = {
|
|
73
|
+
sources: source.sources,
|
|
74
|
+
overwrite: authoredOptions.overwrite ?? false,
|
|
75
|
+
publish: authoredOptions.publish ?? false
|
|
76
|
+
};
|
|
77
|
+
const [protocol, current] = await Promise.all([contentRequest("plan", ContentPlan, "content plan", input), snapshot()]);
|
|
78
|
+
const sourcePaths = new Set(source.sources.map((entry) => entry.sourcePath));
|
|
79
|
+
const entries = (action) => protocol.entries.filter((entry) => entry.action === action);
|
|
80
|
+
const plan = Object.freeze({
|
|
81
|
+
generation: protocol.generation,
|
|
82
|
+
creates: entries("create"),
|
|
83
|
+
updates: entries("update"),
|
|
84
|
+
publications: entries("publish"),
|
|
85
|
+
conflicts: entries("conflict"),
|
|
86
|
+
unchanged: entries("unchanged"),
|
|
87
|
+
issues: protocol.issues,
|
|
88
|
+
targetOnly: current.sources.filter((entry) => !sourcePaths.has(entry.sourcePath)),
|
|
89
|
+
valid: protocol.valid
|
|
90
|
+
});
|
|
91
|
+
plans.set(plan, {
|
|
92
|
+
client: identity,
|
|
93
|
+
input,
|
|
94
|
+
protocol
|
|
95
|
+
});
|
|
96
|
+
return plan;
|
|
97
|
+
},
|
|
98
|
+
apply: async (plan) => {
|
|
99
|
+
const state = plans.get(plan);
|
|
100
|
+
if (!state || state.client !== identity) throw new CmsContentError("content-conflict", "This content plan was not created by this client.");
|
|
101
|
+
if (!plan.valid) throw new CmsContentError("content-conflict", "The content plan is not valid.", {
|
|
102
|
+
conflicts: plan.conflicts,
|
|
103
|
+
issues: plan.issues
|
|
104
|
+
});
|
|
105
|
+
if (plan.conflicts.length) throw new CmsContentError("content-conflict", "The content plan contains conflicts.", { conflicts: plan.conflicts });
|
|
106
|
+
if (plan.issues.length) throw new CmsContentError("invalid-document", "The content plan contains invalid documents.", { issues: plan.issues });
|
|
107
|
+
return contentRequest("apply", ContentApplyResult, "content apply result", {
|
|
108
|
+
...state.input,
|
|
109
|
+
expectedGeneration: state.protocol.generation
|
|
110
|
+
});
|
|
111
|
+
},
|
|
112
|
+
diff: async (source) => diffSources(source.sources, (await snapshot()).sources),
|
|
113
|
+
export: async ({ directory }) => {
|
|
114
|
+
const value = await snapshot();
|
|
115
|
+
await writeContentDirectory(directory, value.sources);
|
|
116
|
+
return { sources: value.sources };
|
|
117
|
+
},
|
|
118
|
+
readDocument: async (documentId) => {
|
|
119
|
+
const document = (await snapshot()).sources.find((source) => source.documentId === documentId);
|
|
120
|
+
if (!document) throw new CmsContentError("document-not-found", `CMS document ${documentId} was not found.`);
|
|
121
|
+
return document;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
async function readCmsContentDirectory(directory) {
|
|
126
|
+
try {
|
|
127
|
+
const root = resolve(directory);
|
|
128
|
+
const indexPath = resolve(root, ".cms-content.json");
|
|
129
|
+
let index;
|
|
130
|
+
try {
|
|
131
|
+
index = parseIndex(await readFile(indexPath, "utf8"));
|
|
132
|
+
} catch (cause) {
|
|
133
|
+
if (!isMissingFile(cause)) throw cause;
|
|
134
|
+
}
|
|
135
|
+
if (index) return { sources: await Promise.all(index.sources.map(async (entry) => decode(ContentSource, {
|
|
136
|
+
sourcePath: entry.sourcePath,
|
|
137
|
+
markdown: await readFile(safeContentPath(root, entry.sourcePath), "utf8"),
|
|
138
|
+
published: entry.published
|
|
139
|
+
}, "content source"))) };
|
|
140
|
+
const files = await markdownFiles(root);
|
|
141
|
+
if (!files.length) throw new CmsContentError("filesystem-error", `No Markdown files found in ${root}.`);
|
|
142
|
+
return { sources: await Promise.all(files.map(async (file) => decode(ContentSource, {
|
|
143
|
+
sourcePath: relative(root, file).replaceAll("\\", "/"),
|
|
144
|
+
markdown: await readFile(file, "utf8"),
|
|
145
|
+
published: true
|
|
146
|
+
}, "content source"))) };
|
|
147
|
+
} catch (cause) {
|
|
148
|
+
if (cause instanceof CmsContentError) throw cause;
|
|
149
|
+
throw new CmsContentError("filesystem-error", `Could not read CMS content from ${directory}.`, { cause });
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
function diffCmsContentSources(local, target) {
|
|
153
|
+
return diffSources(local, target);
|
|
154
|
+
}
|
|
155
|
+
const ContentHash = Schema.String.check(Schema.isPattern(/^[a-f0-9]{64}$/u));
|
|
156
|
+
const ContentIndexEntry = Schema.Struct({
|
|
157
|
+
sourcePath: ContentSource.fields.sourcePath,
|
|
158
|
+
published: Schema.Boolean,
|
|
159
|
+
sha256: ContentHash
|
|
160
|
+
});
|
|
161
|
+
const ContentIndex = Schema.Struct({
|
|
162
|
+
version: Schema.Literal(1),
|
|
163
|
+
sources: Schema.Array(ContentIndexEntry),
|
|
164
|
+
exportSha256: ContentHash
|
|
165
|
+
});
|
|
166
|
+
async function writeContentDirectory(directory, sources) {
|
|
167
|
+
try {
|
|
168
|
+
const root = resolve(directory);
|
|
169
|
+
let previous;
|
|
170
|
+
try {
|
|
171
|
+
previous = parseIndex(await readFile(resolve(root, ".cms-content.json"), "utf8"));
|
|
172
|
+
} catch (cause) {
|
|
173
|
+
if (!isMissingFile(cause)) throw cause;
|
|
174
|
+
}
|
|
175
|
+
if (previous) {
|
|
176
|
+
const metadata = {
|
|
177
|
+
version: previous.version,
|
|
178
|
+
sources: previous.sources
|
|
179
|
+
};
|
|
180
|
+
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
|
+
const incomingPaths = new Set(sources.map((source) => source.sourcePath));
|
|
183
|
+
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
|
+
for (const source of sources) try {
|
|
185
|
+
const local = await readFile(safeContentPath(root, source.sourcePath), "utf8");
|
|
186
|
+
const before = previousByPath.get(source.sourcePath);
|
|
187
|
+
if (before ? sha256(local) !== before.sha256 : local !== source.markdown) throw new CmsContentError("filesystem-error", `Local edits in ${source.sourcePath}; export was stopped.`);
|
|
188
|
+
} catch (cause) {
|
|
189
|
+
if (!isMissingFile(cause)) throw cause;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
await mkdir(root, { recursive: true });
|
|
193
|
+
const entries = [];
|
|
194
|
+
for (const source of sources) {
|
|
195
|
+
const file = safeContentPath(root, source.sourcePath);
|
|
196
|
+
await mkdir(dirname(file), { recursive: true });
|
|
197
|
+
await writeFile(file, source.markdown);
|
|
198
|
+
entries.push({
|
|
199
|
+
sourcePath: source.sourcePath,
|
|
200
|
+
published: source.published,
|
|
201
|
+
sha256: sha256(source.markdown)
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
const metadata = {
|
|
205
|
+
version: 1,
|
|
206
|
+
sources: entries
|
|
207
|
+
};
|
|
208
|
+
const index = {
|
|
209
|
+
...metadata,
|
|
210
|
+
exportSha256: sha256(JSON.stringify(metadata))
|
|
211
|
+
};
|
|
212
|
+
await writeFile(resolve(root, ".cms-content.json"), `${JSON.stringify(index, void 0, 2)}\n`);
|
|
213
|
+
} catch (cause) {
|
|
214
|
+
throw new CmsContentError("filesystem-error", `Could not export CMS content to ${directory}.`, { cause });
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
function diffSources(local, target) {
|
|
218
|
+
const targetByPath = new Map(target.map((source) => [source.sourcePath, source]));
|
|
219
|
+
const localPaths = new Set(local.map((source) => source.sourcePath));
|
|
220
|
+
return {
|
|
221
|
+
changes: local.flatMap((source) => {
|
|
222
|
+
const current = targetByPath.get(source.sourcePath);
|
|
223
|
+
const markdownChanged = current?.markdown !== source.markdown;
|
|
224
|
+
const publicationChanged = current !== void 0 && current.published !== source.published;
|
|
225
|
+
return markdownChanged || publicationChanged ? [{
|
|
226
|
+
sourcePath: source.sourcePath,
|
|
227
|
+
local: source,
|
|
228
|
+
target: current,
|
|
229
|
+
markdownChanged,
|
|
230
|
+
publicationChanged
|
|
231
|
+
}] : [];
|
|
232
|
+
}),
|
|
233
|
+
targetOnly: target.filter((source) => !localPaths.has(source.sourcePath))
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
async function markdownFiles(directory) {
|
|
237
|
+
const entries = await readdir(directory, { withFileTypes: true });
|
|
238
|
+
return (await Promise.all(entries.map(async (entry) => {
|
|
239
|
+
const path = resolve(directory, entry.name);
|
|
240
|
+
if (entry.isDirectory()) return markdownFiles(path);
|
|
241
|
+
return entry.isFile() && [".md", ".mdc"].includes(extname(path)) ? [path] : [];
|
|
242
|
+
}))).flat().sort((left, right) => left.localeCompare(right));
|
|
243
|
+
}
|
|
244
|
+
function safeContentPath(root, sourcePath) {
|
|
245
|
+
const path = resolve(root, sourcePath);
|
|
246
|
+
if (!path.startsWith(`${root}${sep}`)) throw new CmsContentError("filesystem-error", `Unsafe content path: ${sourcePath}`);
|
|
247
|
+
return path;
|
|
248
|
+
}
|
|
249
|
+
function contentBaseUrl(value) {
|
|
250
|
+
let url;
|
|
251
|
+
try {
|
|
252
|
+
url = new URL(value);
|
|
253
|
+
} catch (cause) {
|
|
254
|
+
throw new CmsContentError("network-error", "CMS baseUrl is invalid.", { cause });
|
|
255
|
+
}
|
|
256
|
+
if (url.username || url.password || url.search || url.hash) throw new CmsContentError("network-error", "CMS baseUrl must be an origin without credentials, query, or fragment.");
|
|
257
|
+
if (url.protocol !== "https:" && !(url.protocol === "http:" && [
|
|
258
|
+
"localhost",
|
|
259
|
+
"127.0.0.1",
|
|
260
|
+
"[::1]"
|
|
261
|
+
].includes(url.hostname))) throw new CmsContentError("network-error", "Use HTTPS for CMS credentials; HTTP is allowed only on localhost.");
|
|
262
|
+
return new URL(url.origin);
|
|
263
|
+
}
|
|
264
|
+
async function request(fetch, input, init) {
|
|
265
|
+
try {
|
|
266
|
+
return await fetch(input, init);
|
|
267
|
+
} catch (cause) {
|
|
268
|
+
throw new CmsContentError("network-error", `Could not reach ${input.origin}.`, { cause });
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
function decode(schema, value, label) {
|
|
272
|
+
const decoded = Schema.decodeUnknownResult(schema)(value);
|
|
273
|
+
if (Result.isFailure(decoded)) throw new CmsContentError("invalid-response", `CMS returned an invalid ${label}.`, { cause: decoded.failure });
|
|
274
|
+
return decoded.success;
|
|
275
|
+
}
|
|
276
|
+
function sha256(value) {
|
|
277
|
+
return createHash("sha256").update(value).digest("hex");
|
|
278
|
+
}
|
|
279
|
+
function parseIndex(value) {
|
|
280
|
+
const decoded = Schema.decodeUnknownResult(ContentIndex)(JSON.parse(value));
|
|
281
|
+
if (Result.isFailure(decoded)) throw new CmsContentError("filesystem-error", "The .cms-content.json index is invalid.");
|
|
282
|
+
if (new Set(decoded.success.sources.map((entry) => entry.sourcePath)).size !== decoded.success.sources.length) throw new CmsContentError("filesystem-error", "The .cms-content.json index contains duplicate source paths.");
|
|
283
|
+
return decoded.success;
|
|
284
|
+
}
|
|
285
|
+
function isMissingFile(cause) {
|
|
286
|
+
return cause instanceof Error && "code" in cause && cause.code === "ENOENT";
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
//#endregion
|
|
290
|
+
export { CmsContentError, createCmsContentClient, diffCmsContentSources, readCmsContentDirectory };
|
|
291
|
+
//# sourceMappingURL=Content.js.map
|
|
@@ -0,0 +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,MAA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yC;CAIzF,IAAI,IAFoB,IAAI,QAAQ,QAAQ,QAAQ,KAAK,UAAU,MAAM,UAAU,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"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import "./scalars-CA6kyipS.js";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
//#region ../protocol/src/internal/documents/models.d.ts
|
|
4
|
+
declare const DocumentIssue: Schema.Struct<{
|
|
5
|
+
readonly code: Schema.Literals<readonly ["document.collision", "document.id", "document.invalid", "i18n.missing-translation", "markdown.parse", "reference.document", "reference.component", "seo.invalid", "schema.option", "schema.constraint", "schema.required", "schema.type", "schema.unknown"]>;
|
|
6
|
+
readonly severity: Schema.Literals<readonly ["error", "warning"]>;
|
|
7
|
+
readonly message: Schema.NonEmptyString;
|
|
8
|
+
readonly sourcePath: Schema.optionalKey<Schema.brand<Schema.String, "SourcePath">>;
|
|
9
|
+
readonly collection: Schema.optionalKey<Schema.brand<Schema.String, "CollectionName">>;
|
|
10
|
+
readonly field: Schema.optionalKey<Schema.NonEmptyString>;
|
|
11
|
+
readonly key: Schema.optionalKey<Schema.brand<Schema.String, "PublicPath">>;
|
|
12
|
+
readonly locale: Schema.optionalKey<Schema.brand<Schema.String, "Locale">>;
|
|
13
|
+
}>;
|
|
14
|
+
interface DocumentIssue extends Schema.Schema.Type<typeof DocumentIssue> {}
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region ../protocol/src/ContentTransfer.d.ts
|
|
17
|
+
declare const ContentSource: Schema.Struct<{
|
|
18
|
+
readonly sourcePath: Schema.brand<Schema.String, "SourcePath">;
|
|
19
|
+
readonly markdown: Schema.String;
|
|
20
|
+
/** True only when this exact authored revision is published. */
|
|
21
|
+
readonly published: Schema.Boolean;
|
|
22
|
+
}>;
|
|
23
|
+
interface ContentSource extends Schema.Schema.Type<typeof ContentSource> {}
|
|
24
|
+
declare const ContentSnapshotSource: Schema.Struct<{
|
|
25
|
+
readonly documentId: Schema.brand<Schema.String, "DocumentId">;
|
|
26
|
+
readonly sourcePath: Schema.brand<Schema.String, "SourcePath">;
|
|
27
|
+
readonly markdown: Schema.String;
|
|
28
|
+
/** True only when this exact authored revision is published. */
|
|
29
|
+
readonly published: Schema.Boolean;
|
|
30
|
+
}>;
|
|
31
|
+
interface ContentSnapshotSource extends Schema.Schema.Type<typeof ContentSnapshotSource> {}
|
|
32
|
+
declare const ContentPlanEntry: Schema.Struct<{
|
|
33
|
+
readonly sourcePath: Schema.brand<Schema.String, "SourcePath">;
|
|
34
|
+
readonly action: Schema.Literals<readonly ["create", "update", "publish", "unchanged", "conflict"]>;
|
|
35
|
+
readonly currentRevisionId: Schema.NullOr<Schema.brand<Schema.String, "RevisionId">>;
|
|
36
|
+
}>;
|
|
37
|
+
interface ContentPlanEntry extends Schema.Schema.Type<typeof ContentPlanEntry> {}
|
|
38
|
+
declare const ContentApplyResult: Schema.Struct<{
|
|
39
|
+
readonly created: Schema.Int;
|
|
40
|
+
readonly updated: Schema.Int;
|
|
41
|
+
readonly published: Schema.Int;
|
|
42
|
+
readonly unchanged: Schema.Int;
|
|
43
|
+
readonly generation: Schema.brand<Schema.String, "DocumentGeneration">;
|
|
44
|
+
}>;
|
|
45
|
+
interface ContentApplyResult extends Schema.Schema.Type<typeof ContentApplyResult> {}
|
|
46
|
+
//#endregion
|
|
47
|
+
export { DocumentIssue as a, ContentSource as i, ContentPlanEntry as n, ContentSnapshotSource as r, ContentApplyResult as t };
|
|
48
|
+
//# sourceMappingURL=ContentTransfer-CRQet3QJ.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as RevisionId, d as SourcePath, t as DocumentGeneration } from "./scalars-B2lgGUnj.js";
|
|
2
|
-
import { c as DocumentIssue } from "./models-
|
|
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-DgkGTFus.js";
|
|
3
3
|
import { Schema } from "effect";
|
|
4
4
|
|
|
5
5
|
//#region ../protocol/src/ContentTransfer.ts
|
|
@@ -9,9 +9,13 @@ const ContentSource = Schema.Struct({
|
|
|
9
9
|
/** True only when this exact authored revision is published. */
|
|
10
10
|
published: Schema.Boolean
|
|
11
11
|
});
|
|
12
|
+
const ContentSnapshotSource = Schema.Struct({
|
|
13
|
+
...ContentSource.fields,
|
|
14
|
+
documentId: DocumentId
|
|
15
|
+
});
|
|
12
16
|
const ContentSnapshot = Schema.Struct({
|
|
13
17
|
version: Schema.Literal(1),
|
|
14
|
-
sources: Schema.Array(
|
|
18
|
+
sources: Schema.Array(ContentSnapshotSource)
|
|
15
19
|
});
|
|
16
20
|
const ContentTransferInput = Schema.Struct({
|
|
17
21
|
sources: Schema.Array(ContentSource),
|
|
@@ -50,4 +54,4 @@ var ContentTransferConflict = class extends Schema.TaggedError()("Content.Transf
|
|
|
50
54
|
|
|
51
55
|
//#endregion
|
|
52
56
|
export { ContentSource as a, ContentSnapshot as i, ContentApplyResult as n, ContentTransferConflict as o, ContentPlan as r, ContentTransferInput as s, ContentApplyInput as t };
|
|
53
|
-
//# sourceMappingURL=ContentTransfer-
|
|
57
|
+
//# sourceMappingURL=ContentTransfer-CTzGGKFV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentTransfer-CTzGGKFV.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 { c as
|
|
3
|
-
import {
|
|
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-DgkGTFus.js";
|
|
3
|
+
import { c as resolveCmsComarkAttributes, d as createCmsComarkRenderData, l as withCmsComarkProps, o as normalizeCmsComponentBindings, u as cmsComarkTextContent } from "./Forms-02-p8qEw.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-CjVUBBwa.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-BbhfnTAc.js.map
|