@phtngyn/cms 0.1.0-beta.0
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/LICENSE +13 -0
- package/README.md +90 -0
- package/dist/studio/assets/ActivityEntryRow-D--fRvWI.js +1 -0
- package/dist/studio/assets/ActivityView-D-XBBUHb.js +1 -0
- package/dist/studio/assets/CreateDocumentDialog-CH8UH1QM.js +1 -0
- package/dist/studio/assets/DocumentsView-CxRpmAxt.js +34 -0
- package/dist/studio/assets/DropdownMenu-BSb1l7fr.js +1 -0
- package/dist/studio/assets/Input-DVao38h7.js +3 -0
- package/dist/studio/assets/MediaView-BHrPIjxB.js +1 -0
- package/dist/studio/assets/Modal-VNrXGa5C.js +1 -0
- package/dist/studio/assets/OverviewView-DfP6-mLZ.js +1 -0
- package/dist/studio/assets/Select-BJZIs9sY.js +1 -0
- package/dist/studio/assets/SettingsView-CerHe-ua.js +1 -0
- package/dist/studio/assets/Skeleton-CWJNi3nS.js +1 -0
- package/dist/studio/assets/StudioPageHeader-DP9HDAF2.js +1 -0
- package/dist/studio/assets/UsersView-cP3REkH2.js +1 -0
- package/dist/studio/assets/collaboration-BLnCzfvV.js +4 -0
- package/dist/studio/assets/context-dY4fNbn3.js +1 -0
- package/dist/studio/assets/editor-CE07wW83.js +137 -0
- package/dist/studio/assets/gateway-BAyQgCse.js +10 -0
- package/dist/studio/assets/index-CjoaPLhZ.js +28 -0
- package/dist/studio/assets/index-s2rPqCmP.css +2 -0
- package/dist/studio/assets/render-BkxbK2St.js +83 -0
- package/dist/studio/assets/rolldown-runtime-DK3Fl9T5.js +1 -0
- package/dist/studio/assets/useMediaLibrary-D7qR7aBf.js +1 -0
- package/dist/studio/index.html +76 -0
- package/package.json +75 -0
- package/src/Authoring.d.ts +46 -0
- package/src/Authoring.js +1 -0
- package/src/AuthoringSchema-BQ5kbhVB.js +926 -0
- package/src/AuthoringSchema-BQ5kbhVB.js.map +1 -0
- package/src/Configuration-BGYFD2N1.js +150 -0
- package/src/Configuration-BGYFD2N1.js.map +1 -0
- package/src/Configuration.d.ts +44 -0
- package/src/Configuration.js +9 -0
- package/src/Configuration.js.map +1 -0
- package/src/DocumentEngine-Da0kWotL.js +851 -0
- package/src/DocumentEngine-Da0kWotL.js.map +1 -0
- package/src/DocumentModel.d.ts +30 -0
- package/src/DocumentModel.js +15 -0
- package/src/DocumentModel.js.map +1 -0
- package/src/HttpPaths-86qLGB90.js +15 -0
- package/src/HttpPaths-86qLGB90.js.map +1 -0
- package/src/Module.d.ts +12 -0
- package/src/Module.js +167 -0
- package/src/Module.js.map +1 -0
- package/src/StudioHttp-BTLLooh0.js +916 -0
- package/src/StudioHttp-BTLLooh0.js.map +1 -0
- package/src/connection-ZGtL54qY.js +94 -0
- package/src/connection-ZGtL54qY.js.map +1 -0
- package/src/installation-BNKaVjni.js +9128 -0
- package/src/installation-BNKaVjni.js.map +1 -0
- package/src/internal/authoring-compiler.js +120 -0
- package/src/internal/authoring-compiler.js.map +1 -0
- package/src/internal/authoring-metadata.js +163 -0
- package/src/internal/authoring-metadata.js.map +1 -0
- package/src/internal/cms-config.js +46 -0
- package/src/internal/cms-config.js.map +1 -0
- package/src/internal/component-metadata.js +37 -0
- package/src/internal/component-metadata.js.map +1 -0
- package/src/internal/configuration.js +93 -0
- package/src/internal/configuration.js.map +1 -0
- package/src/internal/document-model.js +236 -0
- package/src/internal/document-model.js.map +1 -0
- package/src/internal/field-metadata.js +6 -0
- package/src/internal/field-metadata.js.map +1 -0
- package/src/metadata-Czvi3E4K.js +190 -0
- package/src/metadata-Czvi3E4K.js.map +1 -0
- package/src/models-Citx8jBi.js +306 -0
- package/src/models-Citx8jBi.js.map +1 -0
- package/src/models-DS5ClMsH.js +153 -0
- package/src/models-DS5ClMsH.js.map +1 -0
- package/src/runtime/api.js +9 -0
- package/src/runtime/api.js.map +1 -0
- package/src/runtime/collaboration.js +40 -0
- package/src/runtime/collaboration.js.map +1 -0
- package/src/runtime/delivery/DocumentField.js +23 -0
- package/src/runtime/delivery/DocumentField.js.map +1 -0
- package/src/runtime/delivery/DocumentRenderer.js +51 -0
- package/src/runtime/delivery/DocumentRenderer.js.map +1 -0
- package/src/runtime/delivery/DocumentScope.js +41 -0
- package/src/runtime/delivery/DocumentScope.js.map +1 -0
- package/src/runtime/delivery/document-page.js +23 -0
- package/src/runtime/delivery/document-page.js.map +1 -0
- package/src/runtime/delivery/document.js +25 -0
- package/src/runtime/delivery/document.js.map +1 -0
- package/src/runtime/delivery/preview.d.ts +11 -0
- package/src/runtime/delivery/preview.js +6 -0
- package/src/runtime/delivery/preview.js.map +1 -0
- package/src/runtime/delivery/types.d.ts +80 -0
- package/src/runtime/delivery/types.js +1 -0
- package/src/runtime/delivery/useDocument.d.ts +6 -0
- package/src/runtime/delivery/useDocument.js +20 -0
- package/src/runtime/delivery/useDocument.js.map +1 -0
- package/src/runtime/delivery/useDocumentQuery.d.ts +7 -0
- package/src/runtime/delivery/useDocumentQuery.js +26 -0
- package/src/runtime/delivery/useDocumentQuery.js.map +1 -0
- package/src/runtime/installation.js +3 -0
- package/src/runtime/plugin.js +32 -0
- package/src/runtime/plugin.js.map +1 -0
- package/src/runtime/preview/CmsStudioPreviewMarker.js +15 -0
- package/src/runtime/preview/CmsStudioPreviewMarker.js.map +1 -0
- package/src/runtime/preview/comark-document.js +38 -0
- package/src/runtime/preview/comark-document.js.map +1 -0
- package/src/runtime/preview/connection.js +3 -0
- package/src/runtime/preview/controller.js +247 -0
- package/src/runtime/preview/controller.js.map +1 -0
- package/src/runtime/preview/plugin.client.js +70 -0
- package/src/runtime/preview/plugin.client.js.map +1 -0
- package/src/runtime/preview/preview.css +9 -0
- package/src/runtime/preview/protocol.d.ts +10 -0
- package/src/runtime/preview/protocol.js +11 -0
- package/src/runtime/preview/protocol.js.map +1 -0
- package/src/runtime/preview/store.js +4 -0
- package/src/runtime/preview/targets.js +102 -0
- package/src/runtime/preview/targets.js.map +1 -0
- package/src/runtime/studio-app.js +13 -0
- package/src/runtime/studio-app.js.map +1 -0
- package/src/store-Nl4uxEXx.js +221 -0
- package/src/store-Nl4uxEXx.js.map +1 -0
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { FIELD_INPUT_METADATA } from "./field-metadata.js";
|
|
2
|
+
import { t as createDocumentEngine } from "../DocumentEngine-Da0kWotL.js";
|
|
3
|
+
import { n as DocumentConfiguration } from "../Configuration-BGYFD2N1.js";
|
|
4
|
+
import { Effect, Result, Schema } from "effect";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
|
|
7
|
+
//#region src/internal/document-model.ts
|
|
8
|
+
const isJsonObject = Schema.is(Schema.JsonObject);
|
|
9
|
+
var CmsDocumentModelInvalid = class extends Schema.TaggedError()("Cms.DocumentModelInvalid", {
|
|
10
|
+
message: Schema.NonEmptyString,
|
|
11
|
+
path: Schema.NonEmptyString
|
|
12
|
+
}) {};
|
|
13
|
+
const isCmsDocumentModelInvalid = Schema.is(CmsDocumentModelInvalid);
|
|
14
|
+
/** Compiles authored Zod schemas into the portable and server-only halves of the CMS document model. */
|
|
15
|
+
function compileCmsDocumentModel(documents) {
|
|
16
|
+
try {
|
|
17
|
+
const compiled = Object.entries(documents.collections).map(([collection, options]) => compileCollection(collection, options));
|
|
18
|
+
const decoded = Schema.decodeResult(DocumentConfiguration)({
|
|
19
|
+
...documents.locales === void 0 ? void 0 : { locales: {
|
|
20
|
+
...documents.locales,
|
|
21
|
+
fallbackLocale: documents.locales.fallbackLocale ?? null,
|
|
22
|
+
locales: [...documents.locales.locales],
|
|
23
|
+
prefixDefaultLocale: documents.locales.prefixDefaultLocale ?? false
|
|
24
|
+
} },
|
|
25
|
+
types: compiled.map((entry) => entry.authoring)
|
|
26
|
+
});
|
|
27
|
+
if (Result.isFailure(decoded)) throw invalid("documents", String(decoded.failure));
|
|
28
|
+
const model = {
|
|
29
|
+
authoring: decoded.success,
|
|
30
|
+
executable: { types: Object.fromEntries(compiled.map((entry) => [entry.authoring.collection, entry.executable])) }
|
|
31
|
+
};
|
|
32
|
+
const engine = Effect.runSync(Effect.result(createDocumentEngine(model.authoring, { documentModel: model.executable })));
|
|
33
|
+
if (Result.isFailure(engine)) throw invalid("documents", engine.failure.message);
|
|
34
|
+
return model;
|
|
35
|
+
} catch (cause) {
|
|
36
|
+
throw isCmsDocumentModelInvalid(cause) ? cause : invalid("documents.collections", cause instanceof Error ? cause.message : String(cause));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function compileCollection(collection, options) {
|
|
40
|
+
const path = `documents.collections.${collection}`;
|
|
41
|
+
let generated;
|
|
42
|
+
try {
|
|
43
|
+
generated = z.toJSONSchema(options.schema, {
|
|
44
|
+
cycles: "throw",
|
|
45
|
+
io: "input",
|
|
46
|
+
reused: "inline",
|
|
47
|
+
target: "draft-2020-12",
|
|
48
|
+
unrepresentable: "throw"
|
|
49
|
+
});
|
|
50
|
+
} catch (cause) {
|
|
51
|
+
throw invalid(`${path}.schema`, cause instanceof Error ? cause.message : String(cause));
|
|
52
|
+
}
|
|
53
|
+
const decoded = Schema.decodeUnknownResult(Schema.JsonObject)(generated);
|
|
54
|
+
if (Result.isFailure(decoded)) throw invalid(`${path}.schema`, "The generated input structure is not serializable.");
|
|
55
|
+
const input = decoded.success;
|
|
56
|
+
if (input.type !== "object") throw invalid(`${path}.schema`, "A collection schema must be a Zod object.");
|
|
57
|
+
const projection = compileProjection(input, `${path}.schema`);
|
|
58
|
+
return {
|
|
59
|
+
authoring: {
|
|
60
|
+
addressPattern: options.route,
|
|
61
|
+
authoringFields: compileAuthoringFields(input, `${path}.schema`),
|
|
62
|
+
canCreate: options.canCreate ?? true,
|
|
63
|
+
collection,
|
|
64
|
+
description: options.description ?? "",
|
|
65
|
+
directory: options.source ?? collection,
|
|
66
|
+
hierarchy: options.hierarchy ?? options.route.includes("*"),
|
|
67
|
+
label: options.label
|
|
68
|
+
},
|
|
69
|
+
executable: {
|
|
70
|
+
project: projection,
|
|
71
|
+
validate: (value) => Effect.tryPromise(() => Promise.resolve(options.schema["~standard"].validate(value)))
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function compileProjection(schema, path, parent = "") {
|
|
76
|
+
const properties = objectKeyword(schema, "properties", path, true);
|
|
77
|
+
const declarations = new Map(Object.entries(properties).map(([name, value]) => {
|
|
78
|
+
const fieldPath = parent ? `${parent}.${name}` : name;
|
|
79
|
+
const property = requireObject(value, `${path}.${name}`);
|
|
80
|
+
return [name, property.type === "object" ? compileProjection(property, `${path}.${name}`, fieldPath) : void 0];
|
|
81
|
+
}));
|
|
82
|
+
return (input) => {
|
|
83
|
+
const value = {};
|
|
84
|
+
const unknownPaths = [];
|
|
85
|
+
for (const [name, child] of Object.entries(input)) {
|
|
86
|
+
const nested = declarations.get(name);
|
|
87
|
+
if (!declarations.has(name)) unknownPaths.push(parent ? `${parent}.${name}` : name);
|
|
88
|
+
else if (nested && isJsonObject(child)) {
|
|
89
|
+
const projected = nested(child);
|
|
90
|
+
value[name] = projected.value;
|
|
91
|
+
unknownPaths.push(...projected.unknownPaths);
|
|
92
|
+
} else value[name] = child;
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
unknownPaths,
|
|
96
|
+
value
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
function compileAuthoringFields(schema, path, parent = "", parentRequired = true) {
|
|
101
|
+
const properties = objectKeyword(schema, "properties", path, true);
|
|
102
|
+
const required = stringArrayKeyword(schema, "required", path);
|
|
103
|
+
return Object.entries(properties).flatMap(([name, value]) => {
|
|
104
|
+
if (!name || name.includes(".")) throw invalid(`${path}.${name || "<empty>"}`, "Field names must be non-empty and cannot contain dots.");
|
|
105
|
+
const fieldPath = parent ? `${parent}.${name}` : name;
|
|
106
|
+
if (fieldPath === "id") throw invalid(`${path}.id`, "Field \"id\" is reserved for CMS identity.");
|
|
107
|
+
const property = requireObject(value, `${path}.${name}`);
|
|
108
|
+
const fieldRequired = parentRequired && required.has(name);
|
|
109
|
+
if (property.type === "object") {
|
|
110
|
+
if (property.default !== void 0) throw invalid(`${path}.${name}`, "Defaults on object fields are not supported; default their leaf fields instead.");
|
|
111
|
+
return compileAuthoringFields(property, `${path}.${name}`, fieldPath, fieldRequired);
|
|
112
|
+
}
|
|
113
|
+
return [compileAuthoringField(property, `${path}.${name}`, fieldPath, fieldRequired)];
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
function compileAuthoringField(schema, schemaPath, path, required) {
|
|
117
|
+
const presentation = fieldPresentation(schema, schemaPath, path, required);
|
|
118
|
+
switch (schema.type) {
|
|
119
|
+
case "boolean": return {
|
|
120
|
+
...presentation,
|
|
121
|
+
input: input(schema, schemaPath, "toggle", ["toggle"]),
|
|
122
|
+
type: "boolean"
|
|
123
|
+
};
|
|
124
|
+
case "integer":
|
|
125
|
+
case "number": {
|
|
126
|
+
const options = numericOptions(schema.enum, schemaPath);
|
|
127
|
+
return {
|
|
128
|
+
...presentation,
|
|
129
|
+
input: input(schema, schemaPath, options.length > 0 ? "select" : "number", ["number", "select"]),
|
|
130
|
+
options,
|
|
131
|
+
type: "number"
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
case "string": {
|
|
135
|
+
if (schema.format === "date") return {
|
|
136
|
+
...presentation,
|
|
137
|
+
input: input(schema, schemaPath, "date", ["date"]),
|
|
138
|
+
type: "date"
|
|
139
|
+
};
|
|
140
|
+
const options = stringOptions(schema.enum, schemaPath);
|
|
141
|
+
return {
|
|
142
|
+
...presentation,
|
|
143
|
+
input: input(schema, schemaPath, options.length > 0 ? "select" : "text", [
|
|
144
|
+
"select",
|
|
145
|
+
"text",
|
|
146
|
+
"textarea"
|
|
147
|
+
]),
|
|
148
|
+
options,
|
|
149
|
+
type: "string"
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
case "array": {
|
|
153
|
+
const items = requireObject(schema.items, `${schemaPath}[]`);
|
|
154
|
+
if (items.type !== "string") throw invalid(schemaPath, "Studio currently supports authoring arrays of strings.");
|
|
155
|
+
return {
|
|
156
|
+
...presentation,
|
|
157
|
+
input: input(schema, schemaPath, "multiselect", ["multiselect"]),
|
|
158
|
+
options: stringOptions(items.enum, `${schemaPath}[]`),
|
|
159
|
+
type: "string[]"
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
default: throw invalid(schemaPath, `Studio cannot generate an input for schema type "${displayJson(schema.type)}".`);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
function fieldPresentation(schema, schemaPath, path, required) {
|
|
166
|
+
const defaultValue = schema.default;
|
|
167
|
+
const description = stringKeyword(schema, "description", schemaPath);
|
|
168
|
+
const title = stringKeyword(schema, "title", schemaPath);
|
|
169
|
+
return {
|
|
170
|
+
...defaultValue === void 0 ? void 0 : { defaultValue },
|
|
171
|
+
...description === void 0 ? void 0 : { description },
|
|
172
|
+
label: title?.trim() || humanize(path),
|
|
173
|
+
path,
|
|
174
|
+
required
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
function input(schema, path, fallback, supported) {
|
|
178
|
+
const configured = schema[FIELD_INPUT_METADATA];
|
|
179
|
+
if (configured === void 0) return fallback;
|
|
180
|
+
const decoded = Schema.decodeUnknownResult(Schema.Literals([...supported]))(configured);
|
|
181
|
+
if (Result.isSuccess(decoded)) return decoded.success;
|
|
182
|
+
throw invalid(path, `Input "${displayJson(configured)}" is not compatible with this field.`);
|
|
183
|
+
}
|
|
184
|
+
function stringOptions(value, path) {
|
|
185
|
+
if (value === void 0) return [];
|
|
186
|
+
const decoded = Schema.decodeUnknownResult(Schema.Array(Schema.String))(value);
|
|
187
|
+
if (Result.isFailure(decoded)) throw invalid(path, "Field options must all be strings.");
|
|
188
|
+
return decoded.success;
|
|
189
|
+
}
|
|
190
|
+
function numericOptions(value, path) {
|
|
191
|
+
if (value === void 0) return [];
|
|
192
|
+
const decoded = Schema.decodeUnknownResult(Schema.Array(Schema.Finite))(value);
|
|
193
|
+
if (Result.isFailure(decoded)) throw invalid(path, "Field options must all be finite numbers.");
|
|
194
|
+
return decoded.success;
|
|
195
|
+
}
|
|
196
|
+
function objectKeyword(schema, keyword, path, optional = false) {
|
|
197
|
+
const value = schema[keyword];
|
|
198
|
+
if (value === void 0 && optional) return {};
|
|
199
|
+
return requireObject(value, `${path}.${keyword}`);
|
|
200
|
+
}
|
|
201
|
+
function stringArrayKeyword(schema, keyword, path) {
|
|
202
|
+
const value = schema[keyword];
|
|
203
|
+
if (value === void 0) return /* @__PURE__ */ new Set();
|
|
204
|
+
const decoded = Schema.decodeUnknownResult(Schema.Array(Schema.String))(value);
|
|
205
|
+
if (Result.isFailure(decoded)) throw invalid(`${path}.${keyword}`, `Expected "${keyword}" to be an array of strings.`);
|
|
206
|
+
return new Set(decoded.success);
|
|
207
|
+
}
|
|
208
|
+
function stringKeyword(schema, keyword, path) {
|
|
209
|
+
const value = schema[keyword];
|
|
210
|
+
if (value === void 0) return void 0;
|
|
211
|
+
const decoded = Schema.decodeUnknownResult(Schema.String)(value);
|
|
212
|
+
if (Result.isFailure(decoded)) throw invalid(`${path}.${keyword}`, `Expected "${keyword}" to be a string.`);
|
|
213
|
+
return decoded.success;
|
|
214
|
+
}
|
|
215
|
+
function requireObject(value, path) {
|
|
216
|
+
if (!isJsonObject(value)) throw invalid(path, "Studio requires an object input structure at this location.");
|
|
217
|
+
return value;
|
|
218
|
+
}
|
|
219
|
+
function humanize(path) {
|
|
220
|
+
const name = path.split(".").at(-1) ?? path;
|
|
221
|
+
const words = name.replace(/([a-z\d])([A-Z])/gu, "$1 $2").replace(/[-_]+/gu, " ").trim();
|
|
222
|
+
return words ? `${words.charAt(0).toUpperCase()}${words.slice(1)}` : name;
|
|
223
|
+
}
|
|
224
|
+
function displayJson(value) {
|
|
225
|
+
return value === void 0 ? "undefined" : JSON.stringify(value) ?? "undefined";
|
|
226
|
+
}
|
|
227
|
+
function invalid(path, message) {
|
|
228
|
+
return new CmsDocumentModelInvalid({
|
|
229
|
+
message,
|
|
230
|
+
path
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
//#endregion
|
|
235
|
+
export { CmsDocumentModelInvalid, compileCmsDocumentModel };
|
|
236
|
+
//# sourceMappingURL=document-model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-model.js","names":[],"sources":["../../../../src/internal/document-model.ts"],"sourcesContent":["import type {\n DocumentSchemaProjection,\n ExecutableDocumentModel,\n ExecutableDocumentSchema,\n} from '@internal/document/DocumentEngine'\nimport type {\n DocumentConfiguration as DocumentConfigurationType,\n DocumentField,\n} from '@internal/protocol/Configuration'\nimport type { CmsCollectionOptions, CmsDocumentModelOptions, CmsFieldInput } from '../DocumentModel'\nimport { createDocumentEngine } from '@internal/document/DocumentEngine'\nimport { DocumentConfiguration } from '@internal/protocol/Configuration'\nimport { Effect, Result, Schema } from 'effect'\nimport { z } from 'zod'\nimport { FIELD_INPUT_METADATA } from './field-metadata'\n\nconst isJsonObject = Schema.is(Schema.JsonObject)\n\ntype EncodedDocumentConfiguration = Schema.Codec.Encoded<typeof DocumentConfiguration>\n\ninterface CmsDocumentModel {\n readonly authoring: DocumentConfigurationType\n readonly executable: ExecutableDocumentModel\n}\n\ninterface CompiledCollection {\n readonly authoring: EncodedDocumentConfiguration['types'][number]\n readonly executable: ExecutableDocumentSchema\n}\n\nexport class CmsDocumentModelInvalid extends Schema.TaggedError<CmsDocumentModelInvalid>()('Cms.DocumentModelInvalid', {\n message: Schema.NonEmptyString,\n path: Schema.NonEmptyString,\n}) {}\nconst isCmsDocumentModelInvalid = Schema.is(CmsDocumentModelInvalid)\n\n/** Compiles authored Zod schemas into the portable and server-only halves of the CMS document model. */\nexport function compileCmsDocumentModel(documents: CmsDocumentModelOptions): CmsDocumentModel {\n try {\n const compiled = Object.entries(documents.collections).map(([collection, options]) =>\n compileCollection(collection, options),\n )\n const decoded = Schema.decodeResult(DocumentConfiguration)({\n ...(documents.locales === undefined\n ? undefined\n : {\n locales: {\n ...documents.locales,\n fallbackLocale: documents.locales.fallbackLocale ?? null,\n locales: [...documents.locales.locales],\n prefixDefaultLocale: documents.locales.prefixDefaultLocale ?? false,\n },\n }),\n types: compiled.map((entry) => entry.authoring),\n })\n if (Result.isFailure(decoded)) throw invalid('documents', String(decoded.failure))\n const model = {\n authoring: decoded.success,\n executable: {\n types: Object.fromEntries(compiled.map((entry) => [entry.authoring.collection, entry.executable])),\n },\n }\n const engine = Effect.runSync(\n Effect.result(createDocumentEngine(model.authoring, { documentModel: model.executable })),\n )\n if (Result.isFailure(engine)) throw invalid('documents', engine.failure.message)\n return model\n } catch (cause) {\n throw isCmsDocumentModelInvalid(cause)\n ? cause\n : invalid('documents.collections', cause instanceof Error ? cause.message : String(cause))\n }\n}\n\nfunction compileCollection(collection: string, options: CmsCollectionOptions): CompiledCollection {\n const path = `documents.collections.${collection}`\n let generated: unknown\n try {\n generated = z.toJSONSchema(options.schema, {\n cycles: 'throw',\n io: 'input',\n reused: 'inline',\n target: 'draft-2020-12',\n unrepresentable: 'throw',\n })\n } catch (cause) {\n throw invalid(`${path}.schema`, cause instanceof Error ? cause.message : String(cause))\n }\n\n const decoded = Schema.decodeUnknownResult(Schema.JsonObject)(generated)\n if (Result.isFailure(decoded)) throw invalid(`${path}.schema`, 'The generated input structure is not serializable.')\n const input = decoded.success\n if (input.type !== 'object') throw invalid(`${path}.schema`, 'A collection schema must be a Zod object.')\n const projection = compileProjection(input, `${path}.schema`)\n\n return {\n authoring: {\n addressPattern: options.route,\n authoringFields: compileAuthoringFields(input, `${path}.schema`),\n canCreate: options.canCreate ?? true,\n collection,\n description: options.description ?? '',\n directory: options.source ?? collection,\n hierarchy: options.hierarchy ?? options.route.includes('*'),\n label: options.label,\n },\n executable: {\n project: projection,\n validate: (value) => Effect.tryPromise(() => Promise.resolve(options.schema['~standard'].validate(value))),\n },\n }\n}\n\ntype ProjectDocumentProjection = (input: Schema.JsonObject) => DocumentSchemaProjection\n\nfunction compileProjection(schema: Schema.JsonObject, path: string, parent = ''): ProjectDocumentProjection {\n const properties = objectKeyword(schema, 'properties', path, true)\n const declarations = new Map(\n Object.entries(properties).map(([name, value]) => {\n const fieldPath = parent ? `${parent}.${name}` : name\n const property = requireObject(value, `${path}.${name}`)\n const nested = property.type === 'object' ? compileProjection(property, `${path}.${name}`, fieldPath) : undefined\n return [name, nested] as const\n }),\n )\n return (input) => {\n const value: Record<string, Schema.Json> = {}\n const unknownPaths: string[] = []\n for (const [name, child] of Object.entries(input)) {\n const nested = declarations.get(name)\n if (!declarations.has(name)) {\n unknownPaths.push(parent ? `${parent}.${name}` : name)\n } else if (nested && isJsonObject(child)) {\n const projected = nested(child)\n value[name] = projected.value\n unknownPaths.push(...projected.unknownPaths)\n } else {\n value[name] = child\n }\n }\n return { unknownPaths, value }\n }\n}\n\nfunction compileAuthoringFields(\n schema: Schema.JsonObject,\n path: string,\n parent = '',\n parentRequired = true,\n): ReadonlyArray<DocumentField> {\n const properties = objectKeyword(schema, 'properties', path, true)\n const required = stringArrayKeyword(schema, 'required', path)\n return Object.entries(properties).flatMap(([name, value]) => {\n if (!name || name.includes('.')) {\n throw invalid(`${path}.${name || '<empty>'}`, 'Field names must be non-empty and cannot contain dots.')\n }\n const fieldPath = parent ? `${parent}.${name}` : name\n if (fieldPath === 'id') throw invalid(`${path}.id`, 'Field \"id\" is reserved for CMS identity.')\n const property = requireObject(value, `${path}.${name}`)\n const fieldRequired = parentRequired && required.has(name)\n if (property.type === 'object') {\n if (property.default !== undefined) {\n throw invalid(\n `${path}.${name}`,\n 'Defaults on object fields are not supported; default their leaf fields instead.',\n )\n }\n return compileAuthoringFields(property, `${path}.${name}`, fieldPath, fieldRequired)\n }\n return [compileAuthoringField(property, `${path}.${name}`, fieldPath, fieldRequired)]\n })\n}\n\nfunction compileAuthoringField(\n schema: Schema.JsonObject,\n schemaPath: string,\n path: string,\n required: boolean,\n): DocumentField {\n const presentation = fieldPresentation(schema, schemaPath, path, required)\n switch (schema.type) {\n case 'boolean':\n return { ...presentation, input: input(schema, schemaPath, 'toggle', ['toggle']), type: 'boolean' }\n case 'integer':\n case 'number': {\n const options = numericOptions(schema.enum, schemaPath)\n return {\n ...presentation,\n input: input(schema, schemaPath, options.length > 0 ? 'select' : 'number', ['number', 'select']),\n options,\n type: 'number',\n }\n }\n case 'string': {\n if (schema.format === 'date') {\n return { ...presentation, input: input(schema, schemaPath, 'date', ['date']), type: 'date' }\n }\n const options = stringOptions(schema.enum, schemaPath)\n return {\n ...presentation,\n input: input(schema, schemaPath, options.length > 0 ? 'select' : 'text', ['select', 'text', 'textarea']),\n options,\n type: 'string',\n }\n }\n case 'array': {\n const items = requireObject(schema.items, `${schemaPath}[]`)\n if (items.type !== 'string') throw invalid(schemaPath, 'Studio currently supports authoring arrays of strings.')\n return {\n ...presentation,\n input: input(schema, schemaPath, 'multiselect', ['multiselect']),\n options: stringOptions(items.enum, `${schemaPath}[]`),\n type: 'string[]',\n }\n }\n default:\n throw invalid(schemaPath, `Studio cannot generate an input for schema type \"${displayJson(schema.type)}\".`)\n }\n}\n\nfunction fieldPresentation(schema: Schema.JsonObject, schemaPath: string, path: string, required: boolean) {\n const defaultValue = schema.default\n const description = stringKeyword(schema, 'description', schemaPath)\n const title = stringKeyword(schema, 'title', schemaPath)\n return {\n ...(defaultValue === undefined ? undefined : { defaultValue }),\n ...(description === undefined ? undefined : { description }),\n label: title?.trim() || humanize(path),\n path,\n required,\n }\n}\n\nfunction input<const Supported extends ReadonlyArray<CmsFieldInput>>(\n schema: Schema.JsonObject,\n path: string,\n fallback: Supported[number],\n supported: Supported,\n): Supported[number] {\n const configured = schema[FIELD_INPUT_METADATA]\n if (configured === undefined) return fallback\n const decoded = Schema.decodeUnknownResult(Schema.Literals([...supported]))(configured)\n if (Result.isSuccess(decoded)) return decoded.success\n throw invalid(path, `Input \"${displayJson(configured)}\" is not compatible with this field.`)\n}\n\nfunction stringOptions(value: Schema.Json | undefined, path: string): ReadonlyArray<string> {\n if (value === undefined) return []\n const decoded = Schema.decodeUnknownResult(Schema.Array(Schema.String))(value)\n if (Result.isFailure(decoded)) throw invalid(path, 'Field options must all be strings.')\n return decoded.success\n}\n\nfunction numericOptions(value: Schema.Json | undefined, path: string): ReadonlyArray<number> {\n if (value === undefined) return []\n const decoded = Schema.decodeUnknownResult(Schema.Array(Schema.Finite))(value)\n if (Result.isFailure(decoded)) throw invalid(path, 'Field options must all be finite numbers.')\n return decoded.success\n}\n\nfunction objectKeyword(schema: Schema.JsonObject, keyword: string, path: string, optional = false): Schema.JsonObject {\n const value = schema[keyword]\n if (value === undefined && optional) return {}\n return requireObject(value, `${path}.${keyword}`)\n}\n\nfunction stringArrayKeyword(schema: Schema.JsonObject, keyword: string, path: string): ReadonlySet<string> {\n const value = schema[keyword]\n if (value === undefined) return new Set()\n const decoded = Schema.decodeUnknownResult(Schema.Array(Schema.String))(value)\n if (Result.isFailure(decoded)) throw invalid(`${path}.${keyword}`, `Expected \"${keyword}\" to be an array of strings.`)\n return new Set(decoded.success)\n}\n\nfunction stringKeyword(schema: Schema.JsonObject, keyword: string, path: string): string | undefined {\n const value = schema[keyword]\n if (value === undefined) return undefined\n const decoded = Schema.decodeUnknownResult(Schema.String)(value)\n if (Result.isFailure(decoded)) throw invalid(`${path}.${keyword}`, `Expected \"${keyword}\" to be a string.`)\n return decoded.success\n}\n\nfunction requireObject(value: Schema.Json | undefined, path: string): Schema.JsonObject {\n if (!isJsonObject(value)) throw invalid(path, 'Studio requires an object input structure at this location.')\n return value\n}\n\nfunction humanize(path: string): string {\n const name = path.split('.').at(-1) ?? path\n const words = name\n .replace(/([a-z\\d])([A-Z])/gu, '$1 $2')\n .replace(/[-_]+/gu, ' ')\n .trim()\n return words ? `${words.charAt(0).toUpperCase()}${words.slice(1)}` : name\n}\n\nfunction displayJson(value: Schema.Json | undefined): string {\n return value === undefined ? 'undefined' : (JSON.stringify(value) ?? 'undefined')\n}\n\nfunction invalid(path: string, message: string): CmsDocumentModelInvalid {\n return new CmsD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A0C;CACvE,OAAO,IAAI,wBAAwB;EAAE;EAAS;CAAK,CAAC;AACtD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-metadata.js","names":[],"sources":["../../../../src/internal/field-metadata.ts"],"sourcesContent":["export const FIELD_INPUT_METADATA = 'x-cms-input'\n"],"mappings":";AAAA,MAAa,uBAAuB"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { V as EditorNodeId } from "./models-Citx8jBi.js";
|
|
2
|
+
import { Predicate, Schema } from "effect";
|
|
3
|
+
import { textContent } from "comark/utils";
|
|
4
|
+
|
|
5
|
+
//#region ../document/src/internal/comark/document-adapter.ts
|
|
6
|
+
const isJsonObject$1 = Schema.is(Schema.JsonObject);
|
|
7
|
+
/** The only adapter from the validated wire document to Comark's mutable document model. */
|
|
8
|
+
function toComarkDocument(document) {
|
|
9
|
+
return {
|
|
10
|
+
frontmatter: mutableJsonObject(document.frontmatter),
|
|
11
|
+
meta: mutableJsonObject(document.meta),
|
|
12
|
+
nodes: document.nodes.map(toComarkNode)
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function createCmsComarkRenderData(document) {
|
|
16
|
+
return {
|
|
17
|
+
data: {},
|
|
18
|
+
frontmatter: mutableJsonObject(document.frontmatter),
|
|
19
|
+
meta: mutableJsonObject(document.meta),
|
|
20
|
+
props: {}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/** Extracts inline text with Comark semantics, preserving punctuation between nested inline nodes. */
|
|
24
|
+
function cmsComarkTextContent(node) {
|
|
25
|
+
return textContent(toComarkNode(node), { decodeUnicodeEntities: true });
|
|
26
|
+
}
|
|
27
|
+
function toMutableComarkAttributes(attributes) {
|
|
28
|
+
const result = {};
|
|
29
|
+
for (const [name, value] of Object.entries(attributes)) if (name !== "$") result[name] = mutableJson(value);
|
|
30
|
+
const internal = jsonObject$1(attributes.$);
|
|
31
|
+
const line = internal.line;
|
|
32
|
+
const html = binaryFlag(internal.html);
|
|
33
|
+
const block = binaryFlag(internal.block);
|
|
34
|
+
if (Predicate.isNumber(line) || html !== void 0 || block !== void 0) {
|
|
35
|
+
const metadata = {};
|
|
36
|
+
if (Predicate.isNumber(line)) metadata.line = line;
|
|
37
|
+
if (html !== void 0) metadata.html = html;
|
|
38
|
+
if (block !== void 0) metadata.block = block;
|
|
39
|
+
result.$ = metadata;
|
|
40
|
+
}
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
function mutableJson(value) {
|
|
44
|
+
if (Array.isArray(value)) return value.map(mutableJson);
|
|
45
|
+
if (isJsonObject$1(value)) return mutableJsonObject(value);
|
|
46
|
+
return value;
|
|
47
|
+
}
|
|
48
|
+
function toComarkNode(node) {
|
|
49
|
+
if (Predicate.isString(node)) return node;
|
|
50
|
+
if (node[0] === null) return [
|
|
51
|
+
null,
|
|
52
|
+
toMutableComarkAttributes(node[1]),
|
|
53
|
+
node[2]
|
|
54
|
+
];
|
|
55
|
+
const [tag, attributes, ...children] = node;
|
|
56
|
+
return [
|
|
57
|
+
tag,
|
|
58
|
+
toMutableComarkAttributes(attributes),
|
|
59
|
+
...children.map(toComarkNode)
|
|
60
|
+
];
|
|
61
|
+
}
|
|
62
|
+
function mutableJsonObject(value) {
|
|
63
|
+
return Object.fromEntries(Object.entries(value).map(([key, child]) => [key, mutableJson(child)]));
|
|
64
|
+
}
|
|
65
|
+
function binaryFlag(value) {
|
|
66
|
+
return value === 0 || value === 1 ? value : void 0;
|
|
67
|
+
}
|
|
68
|
+
function jsonObject$1(value) {
|
|
69
|
+
return isJsonObject$1(value) ? value : {};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region ../document/src/internal/editor/identity.ts
|
|
74
|
+
const isEditorNodeId = Schema.is(EditorNodeId);
|
|
75
|
+
const IDENTIFIED_EDITOR_TYPES = /* @__PURE__ */ new Set([
|
|
76
|
+
"blockquote",
|
|
77
|
+
"bulletList",
|
|
78
|
+
"cmsBlock",
|
|
79
|
+
"cmsOpaque",
|
|
80
|
+
"cmsSlot",
|
|
81
|
+
"codeBlock",
|
|
82
|
+
"heading",
|
|
83
|
+
"horizontalRule",
|
|
84
|
+
"image",
|
|
85
|
+
"listItem",
|
|
86
|
+
"orderedList",
|
|
87
|
+
"paragraph"
|
|
88
|
+
]);
|
|
89
|
+
function createEditorNodeId() {
|
|
90
|
+
const bytes = globalThis.crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(16));
|
|
91
|
+
bytes[6] = (bytes[6] ?? 0) & 15 | 64;
|
|
92
|
+
bytes[8] = (bytes[8] ?? 0) & 63 | 128;
|
|
93
|
+
const hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
94
|
+
return EditorNodeId.make(`${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`);
|
|
95
|
+
}
|
|
96
|
+
function editorNodeId(value) {
|
|
97
|
+
return isEditorNodeId(value) ? value : void 0;
|
|
98
|
+
}
|
|
99
|
+
function isIdentifiedEditorType(type) {
|
|
100
|
+
return type !== void 0 && IDENTIFIED_EDITOR_TYPES.has(type);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
//#endregion
|
|
104
|
+
//#region ../document/src/internal/editor/metadata.ts
|
|
105
|
+
const isJsonObject = Schema.is(Schema.JsonObject);
|
|
106
|
+
function assertCanonicalEditorContent(content) {
|
|
107
|
+
const seen = /* @__PURE__ */ new Set();
|
|
108
|
+
const visit = (node, path) => {
|
|
109
|
+
if (isIdentifiedEditorNode(node)) {
|
|
110
|
+
const id = editorNodeId(node.attrs?.cmsNodeId);
|
|
111
|
+
if (id === void 0) throw new Error(`Authorable ${node.type} at ${diagnosticPath(path)} has no valid node identity.`);
|
|
112
|
+
if (seen.has(id)) throw new Error(`Authorable ${node.type} at ${diagnosticPath(path)} duplicates node identity "${id}".`);
|
|
113
|
+
seen.add(id);
|
|
114
|
+
}
|
|
115
|
+
node.content?.forEach((child, index) => visit(child, [...path, index]));
|
|
116
|
+
};
|
|
117
|
+
visit(content, []);
|
|
118
|
+
}
|
|
119
|
+
function identifiedAttributes(attributes, nodeIdValue, implicitSlotIdValue) {
|
|
120
|
+
const nodeId = editorNodeId(nodeIdValue);
|
|
121
|
+
const implicitSlotId = implicitSlotIdValue === void 0 ? void 0 : editorNodeId(implicitSlotIdValue);
|
|
122
|
+
if (nodeId === void 0) throw new Error("Cannot project an authorable node without a valid identity.");
|
|
123
|
+
if (implicitSlotIdValue !== void 0 && implicitSlotId === void 0) throw new Error("Cannot project an implicit slot without a valid identity.");
|
|
124
|
+
const internal = structuredClone(jsonObject(attributes.$));
|
|
125
|
+
if (implicitSlotId === void 0) internal.editor = { nodeId };
|
|
126
|
+
else internal.editor = {
|
|
127
|
+
implicitSlotId,
|
|
128
|
+
nodeId
|
|
129
|
+
};
|
|
130
|
+
const result = structuredClone(attributes);
|
|
131
|
+
result.$ = internal;
|
|
132
|
+
return result;
|
|
133
|
+
}
|
|
134
|
+
function editorMetadata(attributes) {
|
|
135
|
+
const metadata = jsonObject(jsonObject(attributes.$).editor);
|
|
136
|
+
const nodeId = editorNodeId(metadata.nodeId);
|
|
137
|
+
const implicitSlotId = metadata.implicitSlotId === void 0 ? void 0 : editorNodeId(metadata.implicitSlotId);
|
|
138
|
+
if (nodeId === void 0) return void 0;
|
|
139
|
+
if (metadata.implicitSlotId !== void 0 && implicitSlotId === void 0) return void 0;
|
|
140
|
+
return implicitSlotId === void 0 ? { nodeId } : {
|
|
141
|
+
implicitSlotId,
|
|
142
|
+
nodeId
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function withoutEditorMetadata(body) {
|
|
146
|
+
return {
|
|
147
|
+
frontmatter: structuredClone(body.frontmatter),
|
|
148
|
+
meta: structuredClone(body.meta),
|
|
149
|
+
nodes: body.nodes.map(cleanNode)
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
function cleanNode(node) {
|
|
153
|
+
if (Predicate.isString(node)) return node;
|
|
154
|
+
if (node[0] === null) return [
|
|
155
|
+
null,
|
|
156
|
+
cleanNodeAttributes(node[1]),
|
|
157
|
+
node[2]
|
|
158
|
+
];
|
|
159
|
+
const [tag, attributes, ...children] = node;
|
|
160
|
+
return [
|
|
161
|
+
tag,
|
|
162
|
+
cleanNodeAttributes(attributes),
|
|
163
|
+
...children.map(cleanNode)
|
|
164
|
+
];
|
|
165
|
+
}
|
|
166
|
+
function cleanNodeAttributes(attributes) {
|
|
167
|
+
const cleanAttributes = structuredClone(attributes);
|
|
168
|
+
const internal = jsonObject(cleanAttributes.$);
|
|
169
|
+
if (internal.editor !== void 0) {
|
|
170
|
+
const { editor: _editor, ...remaining } = internal;
|
|
171
|
+
if (Object.keys(remaining).length) cleanAttributes.$ = remaining;
|
|
172
|
+
else delete cleanAttributes.$;
|
|
173
|
+
}
|
|
174
|
+
return cleanAttributes;
|
|
175
|
+
}
|
|
176
|
+
function isIdentifiedEditorNode(node) {
|
|
177
|
+
if (!isIdentifiedEditorType(node.type)) return false;
|
|
178
|
+
if (node.attrs?.cmsSynthetic === true || node.attrs?.cmsTransient === true) return false;
|
|
179
|
+
return node.type !== "paragraph" || Boolean(node.content?.length);
|
|
180
|
+
}
|
|
181
|
+
function diagnosticPath(path) {
|
|
182
|
+
return path.length ? path.join(".") : "document root";
|
|
183
|
+
}
|
|
184
|
+
function jsonObject(value) {
|
|
185
|
+
return isJsonObject(value) ? value : {};
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
//#endregion
|
|
189
|
+
export { createEditorNodeId as a, createCmsComarkRenderData as c, toComarkDocument as d, toMutableComarkAttributes as f, withoutEditorMetadata as i, mutableJson as l, editorMetadata as n, editorNodeId as o, identifiedAttributes as r, cmsComarkTextContent as s, assertCanonicalEditorContent as t, mutableJsonObject as u };
|
|
190
|
+
//# sourceMappingURL=metadata-Czvi3E4K.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata-Czvi3E4K.js","names":["isJsonObject","jsonObject","EditorNodeIdSchema"],"sources":["../../../../document/src/internal/comark/document-adapter.ts","../../../../document/src/internal/editor/identity.ts","../../../../document/src/internal/editor/metadata.ts"],"sourcesContent":["import type { CmsMarkdownDocument, MarkdownNode } from '@internal/protocol/Documents'\nimport type {\n ElementNodeAttributes,\n MarkdownDocument as ComarkMarkdownDocument,\n Node as ComarkNode,\n NodeRenderData,\n} from 'comark'\nimport { textContent } from 'comark/utils'\nimport { Predicate, Schema } from 'effect'\n\nconst isJsonObject = Schema.is(Schema.JsonObject)\n\n/** The only adapter from the validated wire document to Comark's mutable document model. */\nexport function toComarkDocument(document: CmsMarkdownDocument): ComarkMarkdownDocument {\n return {\n frontmatter: mutableJsonObject(document.frontmatter),\n meta: mutableJsonObject(document.meta),\n nodes: document.nodes.map(toComarkNode),\n }\n}\n\nexport function createCmsComarkRenderData(document: CmsMarkdownDocument): NodeRenderData {\n return {\n data: {},\n frontmatter: mutableJsonObject(document.frontmatter),\n meta: mutableJsonObject(document.meta),\n props: {},\n }\n}\n\n/** Extracts inline text with Comark semantics, preserving punctuation between nested inline nodes. */\nexport function cmsComarkTextContent(node: MarkdownNode): string {\n return textContent(toComarkNode(node), { decodeUnicodeEntities: true })\n}\n\nexport function toMutableComarkAttributes(attributes: Schema.JsonObject): ElementNodeAttributes {\n const result: ElementNodeAttributes = {}\n for (const [name, value] of Object.entries(attributes)) {\n if (name !== '$') result[name] = mutableJson(value)\n }\n const internal = jsonObject(attributes.$)\n const line = internal.line\n const html = binaryFlag(internal.html)\n const block = binaryFlag(internal.block)\n if (Predicate.isNumber(line) || html !== undefined || block !== undefined) {\n const metadata: Record<string, number> = {}\n if (Predicate.isNumber(line)) metadata.line = line\n if (html !== undefined) metadata.html = html\n if (block !== undefined) metadata.block = block\n result.$ = metadata\n }\n return result\n}\n\nexport function mutableJson(value: Schema.Json): Schema.Json {\n if (Array.isArray(value)) return value.map(mutableJson)\n if (isJsonObject(value)) return mutableJsonObject(value)\n return value\n}\n\nfunction toComarkNode(node: MarkdownNode): ComarkNode {\n if (Predicate.isString(node)) return node\n if (node[0] === null) return [null, toMutableComarkAttributes(node[1]), node[2]]\n const [tag, attributes, ...children] = node\n return [tag, toMutableComarkAttributes(attributes), ...children.map(toComarkNode)]\n}\n\nexport function mutableJsonObject(value: Schema.JsonObject): Record<string, Schema.Json> {\n return Object.fromEntries(Object.entries(value).map(([key, child]) => [key, mutableJson(child)]))\n}\n\nfunction binaryFlag(value: Schema.Json | undefined): 0 | 1 | undefined {\n return value === 0 || value === 1 ? value : undefined\n}\n\nfunction jsonObject(value: Schema.Json | undefined): Schema.JsonObject {\n return isJsonObject(value) ? value : {}\n}\n","import type { EditorNodeId } from '@internal/protocol/Documents'\nimport { EditorNodeId as EditorNodeIdSchema } from '@internal/protocol/Documents'\nimport { Schema } from 'effect'\n\nconst isEditorNodeId = Schema.is(EditorNodeIdSchema)\n\nexport const IDENTIFIED_EDITOR_TYPES = new Set([\n 'blockquote',\n 'bulletList',\n 'cmsBlock',\n 'cmsOpaque',\n 'cmsSlot',\n 'codeBlock',\n 'heading',\n 'horizontalRule',\n 'image',\n 'listItem',\n 'orderedList',\n 'paragraph',\n])\n\nexport function createEditorNodeId(): EditorNodeId {\n const bytes = globalThis.crypto.getRandomValues(new Uint8Array(16))\n bytes[6] = ((bytes[6] ?? 0) & 0x0f) | 0x40\n bytes[8] = ((bytes[8] ?? 0) & 0x3f) | 0x80\n const hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, '0')).join('')\n return EditorNodeIdSchema.make(\n `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`,\n )\n}\n\nexport function editorNodeId(value: Schema.Json | undefined): EditorNodeId | undefined {\n return isEditorNodeId(value) ? value : undefined\n}\n\nexport function isIdentifiedEditorType(type: string | undefined): boolean {\n return type !== undefined && IDENTIFIED_EDITOR_TYPES.has(type)\n}\n","import type { CmsMarkdownDocument, MarkdownNode } from '@internal/protocol/Documents'\nimport type { EditorNodeId } from '@internal/protocol/Documents'\nimport type { JSONContent } from '@tiptap/core'\nimport { Predicate, Schema } from 'effect'\nimport { editorNodeId, isIdentifiedEditorType } from './identity'\n\nconst isJsonObject = Schema.is(Schema.JsonObject)\n\ninterface EditorMetadata {\n readonly implicitSlotId?: EditorNodeId\n readonly nodeId: EditorNodeId\n}\n\nexport function assertCanonicalEditorContent(content: JSONContent): void {\n const seen = new Set<EditorNodeId>()\n const visit = (node: JSONContent, path: ReadonlyArray<number>) => {\n if (isIdentifiedEditorNode(node)) {\n const id = editorNodeId(node.attrs?.cmsNodeId)\n if (id === undefined) {\n throw new Error(`Authorable ${node.type} at ${diagnosticPath(path)} has no valid node identity.`)\n }\n if (seen.has(id)) {\n throw new Error(`Authorable ${node.type} at ${diagnosticPath(path)} duplicates node identity \"${id}\".`)\n }\n seen.add(id)\n }\n node.content?.forEach((child, index) => visit(child, [...path, index]))\n }\n visit(content, [])\n}\n\nexport function identifiedAttributes(\n attributes: Schema.JsonObject,\n nodeIdValue: Schema.Json | undefined,\n implicitSlotIdValue?: Schema.Json,\n): Schema.JsonObject {\n const nodeId = editorNodeId(nodeIdValue)\n const implicitSlotId = implicitSlotIdValue === undefined ? undefined : editorNodeId(implicitSlotIdValue)\n if (nodeId === undefined) throw new Error('Cannot project an authorable node without a valid identity.')\n if (implicitSlotIdValue !== undefined && implicitSlotId === undefined)\n throw new Error('Cannot project an implicit slot without a valid identity.')\n\n const internal: Record<string, Schema.Json> = structuredClone(jsonObject(attributes.$))\n if (implicitSlotId === undefined) internal.editor = { nodeId }\n else internal.editor = { implicitSlotId, nodeId }\n const result: Record<string, Schema.Json> = structuredClone(attributes)\n result.$ = internal\n return result\n}\n\nexport function editorMetadata(attributes: Schema.JsonObject): EditorMetadata | undefined {\n const metadata = jsonObject(jsonObject(attributes.$).editor)\n const nodeId = editorNodeId(metadata.nodeId)\n const implicitSlotId = metadata.implicitSlotId === undefined ? undefined : editorNodeId(metadata.implicitSlotId)\n if (nodeId === undefined) return undefined\n if (metadata.implicitSlotId !== undefined && implicitSlotId === undefined) return undefined\n return implicitSlotId === undefined ? { nodeId } : { implicitSlotId, nodeId }\n}\n\nexport function withoutEditorMetadata(body: CmsMarkdownDocument): CmsMarkdownDocument {\n return {\n frontmatter: structuredClone(body.frontmatter),\n meta: structuredClone(body.meta),\n nodes: body.nodes.map(cleanNode),\n }\n}\n\nfunction cleanNode(node: MarkdownNode): MarkdownNode {\n if (Predicate.isString(node)) return node\n if (node[0] === null) {\n const cleanAttributes = cleanNodeAttributes(node[1])\n return [null, cleanAttributes, node[2]]\n }\n const [tag, attributes, ...children] = node\n return [tag, cleanNodeAttributes(attributes), ...children.map(cleanNode)]\n}\n\nfunction cleanNodeAttributes(attributes: Schema.JsonObject): Record<string, Schema.Json> {\n const cleanAttributes: Record<string, Schema.Json> = structuredClone(attributes)\n const internal = jsonObject(cleanAttributes.$)\n if (internal.editor !== undefined) {\n const { editor: _editor, ...remaining } = internal\n if (Object.keys(remaining).length) cleanAttributes.$ = remaining\n else delete cleanAttributes.$\n }\n return cleanAttributes\n}\n\nfunction isIdentifiedEditorNode(node: JSONContent): boolean {\n if (!isIdentifiedEditorType(node.type)) return false\n if (node.attrs?.cmsSynthetic === true || node.attrs?.cmsTransient === true) return false\n return node.type !== 'paragraph' || Boolean(node.content?.length)\n}\n\nfunction diagnosticPath(path: ReadonlyArray<number>): string {\n return path.length ? path.join('.') : 'document root'\n}\n\nfunction jsonObject(value: Schema.Json | undefined): Schema.JsonObject {\n return isJsonObject(value) ? value : {}\n}\n"],"mappings":";;;;;AAUA,MAAMA,iBAAe,OAAO,GAAG,OAAO,UAAU;;AAGhD,SAAgB,iBAAiB,UAAuD;CACtF,OAAO;EACL,aAAa,kBAAkB,SAAS,WAAW;EACnD,MAAM,kBAAkB,SAAS,IAAI;EACrC,OAAO,SAAS,MAAM,IAAI,YAAY;CACxC;AACF;A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