@voltro/cms 0.84.0 → 0.86.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.
Files changed (81) hide show
  1. package/CHANGELOG.md +1215 -0
  2. package/THIRD-PARTY-NOTICES.md +118 -600
  3. package/dist/ContentForm.js +282 -0
  4. package/dist/RichDocumentEditor.js +550 -0
  5. package/dist/RichDocumentView.js +132 -0
  6. package/dist/RichTextSurface.js +135 -0
  7. package/dist/aiCandidates.js +199 -0
  8. package/dist/aiOperations.js +152 -0
  9. package/dist/audiences.js +31 -0
  10. package/dist/availability.js +121 -0
  11. package/dist/blueprint.js +166 -0
  12. package/dist/bulk.js +281 -0
  13. package/dist/cacheIdentity.js +152 -0
  14. package/dist/changes.js +90 -0
  15. package/dist/cmsContext.js +229 -0
  16. package/dist/collections.js +224 -0
  17. package/dist/consent.js +29 -0
  18. package/dist/contentType.js +191 -0
  19. package/dist/contentfulImport.js +162 -0
  20. package/dist/copies.js +89 -0
  21. package/dist/cutover.js +202 -0
  22. package/dist/deliveryChecks.js +138 -0
  23. package/dist/domains.js +145 -0
  24. package/dist/draftTexts.js +164 -0
  25. package/dist/duplicates.js +78 -0
  26. package/dist/edgePurge.js +69 -0
  27. package/dist/editHistory.js +113 -0
  28. package/dist/effectForm.js +11 -0
  29. package/dist/environments.js +109 -0
  30. package/dist/errors.js +67 -0
  31. package/dist/experiments.js +528 -0
  32. package/dist/exposure.js +28 -0
  33. package/dist/extensionManifest.js +81 -0
  34. package/dist/extensions.js +314 -0
  35. package/dist/fieldSchema.js +199 -0
  36. package/dist/formStrings.js +74 -0
  37. package/dist/glossary.js +73 -0
  38. package/dist/history.js +54 -0
  39. package/dist/htmlImport.js +297 -0
  40. package/dist/index.d.ts +2266 -170
  41. package/dist/index.js +73 -3947
  42. package/dist/media.js +29 -0
  43. package/dist/metrics.js +46 -0
  44. package/dist/migration.js +193 -0
  45. package/dist/migrationStages.js +13 -0
  46. package/dist/presenceAnchors.js +68 -0
  47. package/dist/preview.js +31 -0
  48. package/dist/promotion.js +107 -0
  49. package/dist/quality.js +188 -0
  50. package/dist/recurrence.js +78 -0
  51. package/dist/redirects.js +99 -0
  52. package/dist/referenceGraph.js +223 -0
  53. package/dist/references.js +173 -0
  54. package/dist/release.js +205 -0
  55. package/dist/rest.js +52 -0
  56. package/dist/review.js +160 -0
  57. package/dist/richDocument.js +491 -0
  58. package/dist/richInline.js +100 -0
  59. package/dist/schedule.js +80 -0
  60. package/dist/search.js +148 -0
  61. package/dist/selectionIntent.js +164 -0
  62. package/dist/seo.js +31 -0
  63. package/dist/series.js +105 -0
  64. package/dist/share.js +112 -0
  65. package/dist/stewardship.js +146 -0
  66. package/dist/taxonomy.js +36 -0
  67. package/dist/team.js +103 -0
  68. package/dist/templates.js +106 -0
  69. package/dist/trackChanges.js +197 -0
  70. package/dist/translation.js +64 -0
  71. package/dist/tree.js +87 -0
  72. package/dist/usage.js +50 -0
  73. package/dist/validation.js +192 -0
  74. package/dist/visualEditing.js +60 -0
  75. package/dist/web.d.ts +927 -131
  76. package/dist/web.js +33 -2
  77. package/dist/workflow.js +322 -0
  78. package/dist/write.js +394 -0
  79. package/dist/xliff.js +325 -0
  80. package/package.json +6 -6
  81. package/dist/extensionManifest-BK3ZcL2P.js +0 -2782
package/dist/xliff.js ADDED
@@ -0,0 +1,325 @@
1
+ import { inlineMarkupOf as e, parseInlineMarkup as t } from "./richDocument.js";
2
+ //#region src/xliff.ts
3
+ var n = class extends Error {
4
+ reason;
5
+ _tag = "XliffInvalid";
6
+ constructor(e) {
7
+ super(`XLIFF not accepted: ${e}`), this.reason = e;
8
+ }
9
+ }, r = (e) => e.kind === "string" && e.pattern === void 0 && e.derived === void 0 && e.literals === void 0, i = (t, n, r) => {
10
+ switch (n.type) {
11
+ case "paragraph":
12
+ case "heading": return [{
13
+ id: `${t}/${n.id}`,
14
+ source: e(n.content)
15
+ }];
16
+ case "list": return n.items.map((r, i) => ({
17
+ id: `${t}/${n.id}/${i}`,
18
+ source: e(r)
19
+ }));
20
+ case "table": return n.rows.flatMap((r, i) => r.map((r, a) => ({
21
+ id: `${t}/${n.id}/${i}.${a}`,
22
+ source: e(r)
23
+ })));
24
+ case "image": return n.caption === void 0 || n.caption === "" ? [] : [{
25
+ id: `${t}/${n.id}/caption`,
26
+ source: n.caption
27
+ }];
28
+ case "file": return n.label === "" ? [] : [{
29
+ id: `${t}/${n.id}/label`,
30
+ source: n.label
31
+ }];
32
+ case "component": {
33
+ let e = r.richText?.profile?.components.find((e) => e.id === n.componentId);
34
+ return e === void 0 ? [] : [...s(e.props, n.props, `${t}/${n.id}/`)];
35
+ }
36
+ }
37
+ }, a = (e) => {
38
+ let t = e?.blocks;
39
+ return Array.isArray(t) ? t : [];
40
+ }, o = (e) => Array.isArray(e) ? e : [], s = (e, t, n = "") => {
41
+ let c = [];
42
+ for (let [l, u] of Object.entries(e)) {
43
+ let e = `${n}${l}`, d = t[l];
44
+ if (r(u)) typeof d == "string" && d.trim() !== "" && c.push({
45
+ id: e,
46
+ source: d
47
+ });
48
+ else if (u.kind === "richText") for (let t of a(d)) c.push(...i(e, t, u));
49
+ else if (u.kind === "components") {
50
+ let t = new Map((u.components ?? []).map((e) => [e.id, e]));
51
+ for (let n of o(d)) {
52
+ let r = n.componentId === void 0 ? void 0 : t.get(n.componentId);
53
+ r !== void 0 && n.instanceId !== void 0 && c.push(...s(r.props, n.props ?? {}, `${e}/${n.instanceId}/`));
54
+ }
55
+ }
56
+ }
57
+ return c.filter((e) => e.source.trim() !== "");
58
+ }, c = (e) => e.some((e) => e.change !== void 0), l = (e, t, n) => {
59
+ switch (t.type) {
60
+ case "paragraph":
61
+ case "heading": return c(t.content) ? [{
62
+ id: `${e}/${t.id}`,
63
+ kind: "suggestedChange"
64
+ }] : [];
65
+ case "list": return t.items.some(c) ? [{
66
+ id: `${e}/${t.id}`,
67
+ kind: "suggestedChange"
68
+ }] : [];
69
+ case "table": return t.rows.some((e) => e.some(c)) ? [{
70
+ id: `${e}/${t.id}`,
71
+ kind: "suggestedChange"
72
+ }] : [];
73
+ case "image":
74
+ case "file": return [];
75
+ case "component": {
76
+ let r = n.richText?.profile?.components.find((e) => e.id === t.componentId);
77
+ return r === void 0 ? [{
78
+ id: `${e}/${t.id}`,
79
+ kind: "unknownComponent"
80
+ }] : [...u(r.props, t.props, `${e}/${t.id}/`)];
81
+ }
82
+ }
83
+ }, u = (e, t, n = "") => {
84
+ let r = [];
85
+ for (let [i, s] of Object.entries(e)) {
86
+ let e = `${n}${i}`, c = t[i];
87
+ if (s.kind === "richText") for (let t of a(c)) r.push(...l(e, t, s));
88
+ else if (s.kind === "components") {
89
+ let t = new Map((s.components ?? []).map((e) => [e.id, e]));
90
+ for (let n of o(c)) {
91
+ if (n.instanceId === void 0) continue;
92
+ let i = n.componentId === void 0 ? void 0 : t.get(n.componentId);
93
+ i === void 0 ? r.push({
94
+ id: `${e}/${n.instanceId}`,
95
+ kind: "unknownComponent"
96
+ }) : r.push(...u(i.props, n.props ?? {}, `${e}/${n.instanceId}/`));
97
+ }
98
+ }
99
+ }
100
+ return r;
101
+ }, d = (e) => {
102
+ let t = 2166136261;
103
+ for (let n of e) for (let e of `${n.id}\u0000${n.source}\u0001`) t ^= e.codePointAt(0) ?? 0, t = Math.imul(t, 16777619) >>> 0;
104
+ return t.toString(16).padStart(8, "0");
105
+ }, f = (e, n, i) => {
106
+ let s = new Map(i.filter((e) => e.target !== void 0).map((e) => [e.id, e.target])), c = (e, n, i) => {
107
+ let l = { ...n };
108
+ for (let [u, d] of Object.entries(e)) {
109
+ let e = `${i}${u}`, f = n[u];
110
+ if (r(d)) {
111
+ let t = s.get(e);
112
+ t !== void 0 && typeof f == "string" && (l[u] = t);
113
+ } else if (d.kind === "richText" && typeof f == "object" && f) {
114
+ let n = d.richText?.profile, r = Object.keys(n?.styles?.tokens ?? {}), i = (e, n) => {
115
+ let i = s.get(e);
116
+ return i === void 0 ? n : t(i, r);
117
+ };
118
+ l[u] = {
119
+ ...f,
120
+ blocks: a(f).map((t) => {
121
+ let r = `${e}/${t.id}`;
122
+ switch (t.type) {
123
+ case "paragraph":
124
+ case "heading": return {
125
+ ...t,
126
+ content: i(r, t.content)
127
+ };
128
+ case "list": return {
129
+ ...t,
130
+ items: t.items.map((e, t) => i(`${r}/${t}`, e))
131
+ };
132
+ case "table": return {
133
+ ...t,
134
+ rows: t.rows.map((e, t) => e.map((e, n) => i(`${r}/${t}.${n}`, e)))
135
+ };
136
+ case "image": {
137
+ let e = s.get(`${r}/caption`);
138
+ return e === void 0 ? t : {
139
+ ...t,
140
+ caption: e
141
+ };
142
+ }
143
+ case "file": {
144
+ let e = s.get(`${r}/label`);
145
+ return e === void 0 ? t : {
146
+ ...t,
147
+ label: e
148
+ };
149
+ }
150
+ case "component": {
151
+ let e = n?.components.find((e) => e.id === t.componentId);
152
+ return e === void 0 ? t : {
153
+ ...t,
154
+ props: c(e.props, t.props, `${r}/`)
155
+ };
156
+ }
157
+ }
158
+ })
159
+ };
160
+ } else if (d.kind === "components" && Array.isArray(f)) {
161
+ let t = new Map((d.components ?? []).map((e) => [e.id, e]));
162
+ l[u] = o(f).map((n) => {
163
+ let r = n.componentId === void 0 ? void 0 : t.get(n.componentId);
164
+ return r === void 0 || n.instanceId === void 0 ? n : {
165
+ ...n,
166
+ props: c(r.props, n.props ?? {}, `${e}/${n.instanceId}/`)
167
+ };
168
+ });
169
+ }
170
+ }
171
+ return l;
172
+ };
173
+ return c(e, n, "");
174
+ }, p = (e, t) => {
175
+ let n = new Set(e.map((e) => e.id)), r = new Map(t.map((e) => [e.id, e])), i = 0, a = 0;
176
+ for (let e of t) n.has(e.id) && (e.target !== void 0 && e.target.trim() !== "" ? i++ : a++);
177
+ return {
178
+ translated: i,
179
+ untranslated: a,
180
+ unknown: t.filter((e) => !n.has(e.id)).map((e) => e.id),
181
+ missing: e.filter((e) => !r.has(e.id)).map((e) => e.id)
182
+ };
183
+ }, m = (e) => e.replace(/[&<>"']/g, (e) => ({
184
+ "&": "&amp;",
185
+ "<": "&lt;",
186
+ ">": "&gt;",
187
+ "\"": "&quot;",
188
+ "'": "&apos;"
189
+ })[e]), h = (e) => {
190
+ let t = Object.entries(e.notes);
191
+ return [
192
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
193
+ `<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.1" srcLang="${m(e.srcLang)}" trgLang="${m(e.trgLang)}">`,
194
+ ` <file id="${m(e.fileId)}">`,
195
+ ...t.length === 0 ? [] : [
196
+ " <notes>",
197
+ ...t.map(([e, t]) => ` <note category="${m(e)}">${m(t)}</note>`),
198
+ " </notes>"
199
+ ],
200
+ ...e.units.flatMap((e) => [
201
+ ` <unit id="${m(e.id)}">`,
202
+ ` <segment${e.state === void 0 ? "" : ` state="${e.state}"`}>`,
203
+ ` <source>${m(e.source)}</source>`,
204
+ ...e.target === void 0 ? [] : [` <target>${m(e.target)}</target>`],
205
+ " </segment>",
206
+ " </unit>"
207
+ ]),
208
+ " </file>",
209
+ "</xliff>",
210
+ ""
211
+ ].join("\n");
212
+ }, g = 5242880, _ = {
213
+ lt: "<",
214
+ gt: ">",
215
+ amp: "&",
216
+ quot: "\"",
217
+ apos: "'"
218
+ }, v = (e) => e.replace(/&(#x[0-9a-fA-F]+|#[0-9]+|[a-zA-Z]+);/g, (e, t) => {
219
+ if (t.startsWith("#x")) return String.fromCodePoint(Number.parseInt(t.slice(2), 16));
220
+ if (t.startsWith("#")) return String.fromCodePoint(Number.parseInt(t.slice(1), 10));
221
+ let r = _[t];
222
+ if (r === void 0) throw new n(`unknown entity ${e}`);
223
+ return r;
224
+ }), y = (e) => e.slice(e.indexOf(":") + 1), b = (e) => {
225
+ if (e.length > g) throw new n("larger than 5 MB");
226
+ if (/<!DOCTYPE|<!ENTITY/i.test(e)) throw new n("a DOCTYPE or entity declaration is not allowed");
227
+ let t = {
228
+ name: "#root",
229
+ attrs: {},
230
+ children: []
231
+ }, r = [t], i = 0, a = () => r[r.length - 1];
232
+ for (; i < e.length;) {
233
+ let o = e.indexOf("<", i);
234
+ if (o === -1) {
235
+ a().children.push(v(e.slice(i)));
236
+ break;
237
+ }
238
+ if (o > i && a().children.push(v(e.slice(i, o))), e.startsWith("<?", o)) {
239
+ if (i = e.indexOf("?>", o) + 2, i < 2) throw new n("unterminated declaration");
240
+ continue;
241
+ }
242
+ if (e.startsWith("<!--", o)) {
243
+ if (i = e.indexOf("-->", o) + 3, i < 3) throw new n("unterminated comment");
244
+ continue;
245
+ }
246
+ if (e.startsWith("<![CDATA[", o)) {
247
+ let t = e.indexOf("]]>", o);
248
+ if (t === -1) throw new n("unterminated CDATA");
249
+ a().children.push(e.slice(o + 9, t)), i = t + 3;
250
+ continue;
251
+ }
252
+ let s = e.indexOf(">", o);
253
+ if (s === -1) throw new n("unterminated tag");
254
+ let c = e.slice(o + 1, s);
255
+ if (i = s + 1, c.startsWith("/")) {
256
+ let e = y(c.slice(1).trim()), i = r.pop();
257
+ if (i === void 0 || i === t || i.name !== e) throw new n(`unexpected </${e}>`);
258
+ continue;
259
+ }
260
+ let l = c.endsWith("/"), u = l ? c.slice(0, -1) : c, d = /^\s*([A-Za-z_][\w.:-]*)/.exec(u);
261
+ if (d === null) throw new n("malformed tag");
262
+ let f = {};
263
+ for (let e of u.slice(d[0].length).matchAll(/([A-Za-z_][\w.:-]*)\s*=\s*("([^"]*)"|'([^']*)')/g)) f[y(e[1])] = v(e[3] ?? e[4] ?? "");
264
+ let p = {
265
+ name: y(d[1]),
266
+ attrs: f,
267
+ children: []
268
+ };
269
+ a().children.push(p), l || r.push(p);
270
+ }
271
+ if (r.length !== 1) throw new n(`unclosed <${a().name}>`);
272
+ let o = t.children.filter((e) => typeof e != "string");
273
+ if (o.length !== 1) throw new n("not one root element");
274
+ return o[0];
275
+ }, x = (e, t) => e.children.filter((e) => typeof e != "string" && e.name === t), S = (e, t) => e.children.map((e) => {
276
+ if (typeof e == "string") return e;
277
+ throw new n(`inline <${e.name}> in ${t} is not supported`);
278
+ }).join(""), C = /* @__PURE__ */ new Set([
279
+ "initial",
280
+ "translated",
281
+ "reviewed",
282
+ "final"
283
+ ]), w = (e) => {
284
+ let t = b(e);
285
+ if (t.name !== "xliff") throw new n("the root element is not <xliff>");
286
+ if (!/^2\./.test(t.attrs.version ?? "")) throw new n(`version ${t.attrs.version ?? "(none)"} is not XLIFF 2`);
287
+ let r = t.attrs.srcLang, i = t.attrs.trgLang;
288
+ if (!r || !i) throw new n("srcLang and trgLang are required");
289
+ let a = x(t, "file");
290
+ if (a.length !== 1) throw new n(`expected one <file>, found ${a.length}`);
291
+ let o = a[0], s = {};
292
+ for (let e of x(o, "notes")) for (let t of x(e, "note")) {
293
+ let e = t.attrs.category;
294
+ e !== void 0 && (s[e] = S(t, "a note"));
295
+ }
296
+ let c = x(o, "unit").map((e) => {
297
+ let t = e.attrs.id;
298
+ if (!t) throw new n("a <unit> without an id");
299
+ let r = x(e, "segment"), i = [], a = [], o;
300
+ for (let e of r) {
301
+ let r = x(e, "source")[0];
302
+ if (r === void 0) throw new n(`unit ${t}: a <segment> without <source>`);
303
+ i.push(S(r, `unit ${t}`));
304
+ let s = x(e, "target")[0];
305
+ s !== void 0 && a.push(S(s, `unit ${t}`));
306
+ let c = e.attrs.state;
307
+ c !== void 0 && C.has(c) && (o = c);
308
+ }
309
+ return {
310
+ id: t,
311
+ source: i.join(""),
312
+ ...a.length === r.length && r.length > 0 ? { target: a.join("") } : {},
313
+ ...o === void 0 ? {} : { state: o }
314
+ };
315
+ });
316
+ return {
317
+ srcLang: r,
318
+ trgLang: i,
319
+ fileId: o.attrs.id ?? "",
320
+ notes: s,
321
+ units: c
322
+ };
323
+ };
324
+ //#endregion
325
+ export { n as XliffInvalid, f as applyTranslation, p as matchUnits, w as parseXliff, h as toXliff, u as translationLosses, s as translationUnits, d as unitsHash };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voltro/cms",
3
- "version": "0.84.0",
3
+ "version": "0.86.0",
4
4
  "description": "Headless CMS — typed content-type schemas in code (defineContentType + the Schema field namespace), draft/published table derivation (contentTypeToEntities), the ctx.cms typed read surface, the write pipeline (saveDraft/publish/unpublish/archive with save-time validation + derivation), a REST mount (GET /v1/cms/<type>), signed preview tokens, and a browser-safe schema→widget <ContentForm> renderer.",
5
5
  "keywords": [
6
6
  "voltro",
@@ -38,13 +38,13 @@
38
38
  "node": ">=24.0.0"
39
39
  },
40
40
  "dependencies": {
41
- "@voltro/database": "0.84.0",
42
- "@voltro/local-first": "0.84.0",
43
- "@voltro/plugin-multitenancy": "0.84.0",
44
- "@voltro/runtime": "0.84.0"
41
+ "@voltro/database": "0.86.0",
42
+ "@voltro/local-first": "0.86.0",
43
+ "@voltro/plugin-multitenancy": "0.86.0",
44
+ "@voltro/runtime": "0.86.0"
45
45
  },
46
46
  "peerDependencies": {
47
- "effect": "^3.22.2",
47
+ "effect": "4.0.1",
48
48
  "react": "^19.0.0"
49
49
  },
50
50
  "peerDependenciesMeta": {