@voltro/cms 0.85.0 → 0.87.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/CHANGELOG.md +5987 -0
- package/README.md +138 -0
- package/THIRD-PARTY-NOTICES.md +864 -253
- package/dist/ContentForm.js +282 -0
- package/dist/RichDocumentEditor.js +550 -0
- package/dist/RichDocumentView.js +177 -0
- package/dist/RichTextSurface.js +135 -0
- package/dist/aiCandidates.js +199 -0
- package/dist/aiOperations.js +152 -0
- package/dist/applicationBuildSnapshotService.js +101 -0
- package/dist/assetRenditions.js +102 -0
- package/dist/assetRevision.js +46 -0
- package/dist/assetUseRights.js +72 -0
- package/dist/audiences.js +31 -0
- package/dist/availability.js +124 -0
- package/dist/blueprint.js +166 -0
- package/dist/build.d.ts +3063 -0
- package/dist/build.js +37 -0
- package/dist/buildApplicationAdmission.js +16 -0
- package/dist/buildApplicationCatalog.js +136 -0
- package/dist/buildApplicationCatalogTable.js +24 -0
- package/dist/buildApplicationRest.js +99 -0
- package/dist/buildApplicationUpload.js +111 -0
- package/dist/buildSnapshot.js +401 -0
- package/dist/buildSnapshotApplicationPin.js +32 -0
- package/dist/buildSnapshotRest.js +210 -0
- package/dist/buildSnapshotService.js +265 -0
- package/dist/buildSnapshotTables.js +25 -0
- package/dist/bulk.js +282 -0
- package/dist/cacheIdentity.js +152 -0
- package/dist/changes.js +307 -0
- package/dist/cmsContext.js +229 -0
- package/dist/collections.js +224 -0
- package/dist/consent.js +29 -0
- package/dist/contentLocations.js +53 -0
- package/dist/contentProjection.js +83 -0
- package/dist/contentRouteIdentity.js +13 -0
- package/dist/contentRouteMaterializer.js +97 -0
- package/dist/contentRouteTypes.js +39 -0
- package/dist/contentSeo.js +189 -0
- package/dist/contentTreePath.js +60 -0
- package/dist/contentType.js +208 -0
- package/dist/contentValues.js +18 -0
- package/dist/contentfulImport.js +162 -0
- package/dist/copies.js +89 -0
- package/dist/cutover.js +202 -0
- package/dist/deliveryChecks.js +138 -0
- package/dist/domainHost.js +7 -0
- package/dist/domains.js +139 -0
- package/dist/draftTexts.js +164 -0
- package/dist/duplicates.js +78 -0
- package/dist/edgePurge.js +69 -0
- package/dist/editHistory.js +113 -0
- package/dist/effectForm.js +11 -0
- package/dist/environmentAliases.js +138 -0
- package/dist/environments.js +147 -0
- package/dist/errors.js +107 -0
- package/dist/experiments.js +528 -0
- package/dist/exposure.js +28 -0
- package/dist/extensionManifest.js +81 -0
- package/dist/extensions.js +314 -0
- package/dist/fieldSchema.js +199 -0
- package/dist/formStrings.js +74 -0
- package/dist/frontendBindings.js +99 -0
- package/dist/frontendMedia.js +18 -0
- package/dist/glossary.js +73 -0
- package/dist/history.js +54 -0
- package/dist/htmlImport.js +297 -0
- package/dist/index.d.ts +771 -54
- package/dist/index.js +89 -6082
- package/dist/initializePublicRoutes.js +28 -0
- package/dist/liveContentRouteView.js +76 -0
- package/dist/media.js +29 -0
- package/dist/metrics.js +46 -0
- package/dist/migration.js +193 -0
- package/dist/migrationStages.js +13 -0
- package/dist/nativeOutputDeploymentService.js +205 -0
- package/dist/outputActivation.js +234 -0
- package/dist/outputActivationOrigin.js +51 -0
- package/dist/outputActivationStore.js +411 -0
- package/dist/outputActivationTables.js +11 -0
- package/dist/outputActivationTarget.js +81 -0
- package/dist/outputActivationTargetTable.js +25 -0
- package/dist/outputDeployment.js +174 -0
- package/dist/outputDeploymentRest.js +168 -0
- package/dist/outputDeploymentService.js +241 -0
- package/dist/outputRouteGraph.js +177 -0
- package/dist/outputSafetyArtifact.js +147 -0
- package/dist/outputTargetRest.js +62 -0
- package/dist/pathSegmentEncoding.js +4 -0
- package/dist/presenceAnchors.js +68 -0
- package/dist/preview.js +31 -0
- package/dist/privateCmsTransport.js +76 -0
- package/dist/privateNativeRouteReservation.js +10 -0
- package/dist/promotion.js +116 -0
- package/dist/publicBuild.js +90 -0
- package/dist/publicBuildRest.js +98 -0
- package/dist/publicBuildService.js +63 -0
- package/dist/publicOutputHttp.js +129 -0
- package/dist/publicOutputService.js +287 -0
- package/dist/publicPresentation.js +17 -0
- package/dist/publicRouteDispositionAdmission.js +38 -0
- package/dist/publicRouteHistoryStore.js +12 -0
- package/dist/publicRouteHistoryView.js +34 -0
- package/dist/publicRouteIntegrity.js +5 -0
- package/dist/publicRouteMutation.js +6 -0
- package/dist/publicRouteNamespace.js +134 -0
- package/dist/publicRoutePublication.js +36 -0
- package/dist/publicRouteRegistry.js +17 -0
- package/dist/publicRouteRegistryBinding.js +194 -0
- package/dist/publicRouteRegistryDefinition.js +76 -0
- package/dist/publicRouteSitePublication.js +40 -0
- package/dist/publicRouteTables.js +13 -0
- package/dist/publicRouteUrl.js +18 -0
- package/dist/publicationSeo.js +52 -0
- package/dist/publicationState.js +296 -0
- package/dist/quality.js +188 -0
- package/dist/reconfigurePublicRoutes.js +41 -0
- package/dist/recurrence.js +78 -0
- package/dist/redirects.js +130 -0
- package/dist/referenceGraph.js +224 -0
- package/dist/references.js +173 -0
- package/dist/release.js +241 -0
- package/dist/renderReadAuthority.js +43 -0
- package/dist/renderReadGrant.js +137 -0
- package/dist/rest.js +52 -0
- package/dist/review.js +160 -0
- package/dist/richDocument.js +521 -0
- package/dist/richInline.js +100 -0
- package/dist/routeDispositionGraph.js +44 -0
- package/dist/routeDispositionRest.js +51 -0
- package/dist/routeDispositionService.js +73 -0
- package/dist/routeDispositionStore.js +289 -0
- package/dist/routeDispositionTables.js +5 -0
- package/dist/routeDispositions.js +91 -0
- package/dist/routeHistoryStorage.js +320 -0
- package/dist/routeHistoryStore.js +12 -0
- package/dist/schedule.js +80 -0
- package/dist/search.js +148 -0
- package/dist/selectionIntent.js +164 -0
- package/dist/seo.js +31 -0
- package/dist/series.js +105 -0
- package/dist/share.js +112 -0
- package/dist/siteBindings.js +159 -0
- package/dist/siteBuildCandidate.js +104 -0
- package/dist/siteDelivery.js +115 -0
- package/dist/siteState.js +47 -0
- package/dist/snapshotAddressGraph.js +55 -0
- package/dist/snapshotAddressRead.js +73 -0
- package/dist/snapshotAppConsumer.js +71 -0
- package/dist/snapshotAppExecution.js +102 -0
- package/dist/snapshotApplication.js +75 -0
- package/dist/snapshotApprovedRouteDispositions.js +44 -0
- package/dist/snapshotAssetAssembly.js +70 -0
- package/dist/snapshotAssetAssemblyRest.js +50 -0
- package/dist/snapshotBindingRead.js +61 -0
- package/dist/snapshotCodeSeo.js +29 -0
- package/dist/snapshotComponent.js +34 -0
- package/dist/snapshotComponentSource.js +24 -0
- package/dist/snapshotConsumer.js +87 -0
- package/dist/snapshotContentIdentity.js +10 -0
- package/dist/snapshotDefinitions.js +264 -0
- package/dist/snapshotDocumentAssembly.js +193 -0
- package/dist/snapshotDocumentAssemblyRest.js +84 -0
- package/dist/snapshotDocumentProjection.js +202 -0
- package/dist/snapshotDocumentTransfer.js +35 -0
- package/dist/snapshotDocumentTransferRest.js +80 -0
- package/dist/snapshotDomains.js +56 -0
- package/dist/snapshotEnvironment.js +31 -0
- package/dist/snapshotFieldPlan.js +85 -0
- package/dist/snapshotFrontend.js +103 -0
- package/dist/snapshotLink.js +8 -0
- package/dist/snapshotMedia.js +111 -0
- package/dist/snapshotMediaCapture.js +246 -0
- package/dist/snapshotMediaFields.js +225 -0
- package/dist/snapshotMediaRead.js +185 -0
- package/dist/snapshotMediaReader.js +13 -0
- package/dist/snapshotObservation.js +16 -0
- package/dist/snapshotObservedRouteHistory.js +34 -0
- package/dist/snapshotOutputTransfer.js +78 -0
- package/dist/snapshotPageLoader.js +7 -0
- package/dist/snapshotPageSeo.js +59 -0
- package/dist/snapshotPathLocale.js +15 -0
- package/dist/snapshotPresentation.js +86 -0
- package/dist/snapshotPresentationPolicy.js +12 -0
- package/dist/snapshotProjection.js +119 -0
- package/dist/snapshotPublicAccess.js +161 -0
- package/dist/snapshotPublicRouteHistory.js +40 -0
- package/dist/snapshotReadAdmission.js +38 -0
- package/dist/snapshotRedirectOutput.js +151 -0
- package/dist/snapshotRedirectTargets.js +24 -0
- package/dist/snapshotRedirects.js +132 -0
- package/dist/snapshotReference.js +8 -0
- package/dist/snapshotReferenceAddress.js +10 -0
- package/dist/snapshotReferenceGraph.js +79 -0
- package/dist/snapshotReferenceRead.js +65 -0
- package/dist/snapshotRelease.js +99 -0
- package/dist/snapshotRender.js +361 -0
- package/dist/snapshotRenderDependencies.js +178 -0
- package/dist/snapshotRenditions.js +88 -0
- package/dist/snapshotRichDocument.js +62 -0
- package/dist/snapshotRoleTransfer.js +106 -0
- package/dist/snapshotRoleTransferRest.js +99 -0
- package/dist/snapshotRouteAdmission.js +71 -0
- package/dist/snapshotRouteDispatch.js +111 -0
- package/dist/snapshotRouteDispositionPlan.js +73 -0
- package/dist/snapshotRouteRead.js +43 -0
- package/dist/snapshotRoutes.js +79 -0
- package/dist/snapshotRouting.js +113 -0
- package/dist/snapshotSeo.js +179 -0
- package/dist/snapshotSeoControls.js +101 -0
- package/dist/snapshotSeoDocumentInventory.js +115 -0
- package/dist/snapshotSeoDocuments.js +129 -0
- package/dist/snapshotSeoMerge.js +85 -0
- package/dist/snapshotSeoMetadata.js +137 -0
- package/dist/snapshotSeoOutput.js +173 -0
- package/dist/snapshotSeoPathSets.js +105 -0
- package/dist/snapshotSeoRead.js +88 -0
- package/dist/snapshotSite.js +128 -0
- package/dist/snapshotSitemapFiles.js +36 -0
- package/dist/snapshotTreeDependencies.js +58 -0
- package/dist/snapshotTreeLoader.js +10 -0
- package/dist/snapshotTreeRead.js +158 -0
- package/dist/staticPathSet.js +177 -0
- package/dist/staticPathSetRest.js +129 -0
- package/dist/staticPathSetService.js +249 -0
- package/dist/staticPathSetStore.js +338 -0
- package/dist/stewardship.js +146 -0
- package/dist/taxonomy.js +36 -0
- package/dist/team.js +103 -0
- package/dist/templates.js +106 -0
- package/dist/trackChanges.js +197 -0
- package/dist/translation.js +64 -0
- package/dist/tree.js +87 -0
- package/dist/usage.js +50 -0
- package/dist/validation.js +192 -0
- package/dist/visualEditing.js +60 -0
- package/dist/web.d.ts +709 -7
- package/dist/web.js +50 -2
- package/dist/workflow.js +322 -0
- package/dist/write.js +419 -0
- package/dist/xliff.js +325 -0
- package/package.json +20 -6
- package/dist/presenceAnchors-4iHAVQB3.js +0 -4367
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
|
+
"&": "&",
|
|
185
|
+
"<": "<",
|
|
186
|
+
">": ">",
|
|
187
|
+
"\"": """,
|
|
188
|
+
"'": "'"
|
|
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.
|
|
3
|
+
"version": "0.87.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",
|
|
@@ -28,7 +28,12 @@
|
|
|
28
28
|
"import": "./dist/web.js",
|
|
29
29
|
"default": "./dist/web.js"
|
|
30
30
|
},
|
|
31
|
-
"./package.json": "./package.json"
|
|
31
|
+
"./package.json": "./package.json",
|
|
32
|
+
"./build": {
|
|
33
|
+
"types": "./dist/build.d.ts",
|
|
34
|
+
"import": "./dist/build.js",
|
|
35
|
+
"default": "./dist/build.js"
|
|
36
|
+
}
|
|
32
37
|
},
|
|
33
38
|
"main": "./dist/index.js",
|
|
34
39
|
"module": "./dist/index.js",
|
|
@@ -38,16 +43,25 @@
|
|
|
38
43
|
"node": ">=24.0.0"
|
|
39
44
|
},
|
|
40
45
|
"dependencies": {
|
|
41
|
-
"@voltro/database": "0.
|
|
42
|
-
"@voltro/local-first": "0.
|
|
43
|
-
"@voltro/plugin-multitenancy": "0.
|
|
44
|
-
"@voltro/
|
|
46
|
+
"@voltro/database": "0.87.0",
|
|
47
|
+
"@voltro/local-first": "0.87.0",
|
|
48
|
+
"@voltro/plugin-multitenancy": "0.87.0",
|
|
49
|
+
"@voltro/protocol": "0.87.0",
|
|
50
|
+
"@voltro/runtime": "0.87.0"
|
|
45
51
|
},
|
|
46
52
|
"peerDependencies": {
|
|
53
|
+
"@voltro/plugin-storage": "0.87.0",
|
|
54
|
+
"@voltro/workflow": "0.87.0",
|
|
47
55
|
"effect": "4.0.1",
|
|
48
56
|
"react": "^19.0.0"
|
|
49
57
|
},
|
|
50
58
|
"peerDependenciesMeta": {
|
|
59
|
+
"@voltro/plugin-storage": {
|
|
60
|
+
"optional": true
|
|
61
|
+
},
|
|
62
|
+
"@voltro/workflow": {
|
|
63
|
+
"optional": true
|
|
64
|
+
},
|
|
51
65
|
"react": {
|
|
52
66
|
"optional": true
|
|
53
67
|
}
|