@voltro/cms 0.86.0 → 0.88.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 +5484 -0
- package/README.md +138 -0
- package/THIRD-PARTY-NOTICES.md +1511 -276
- package/dist/ContentForm.js +1 -2
- package/dist/RichDocumentEditor.js +1 -2
- package/dist/RichDocumentView.js +82 -38
- package/dist/RichTextSurface.js +1 -2
- package/dist/aiCandidates.js +4 -5
- package/dist/aiOperations.js +1 -2
- package/dist/applicationBuildSnapshotService.js +100 -0
- package/dist/assetRenditions.js +101 -0
- package/dist/assetRevision.js +45 -0
- package/dist/assetUseRights.js +71 -0
- package/dist/audiences.js +1 -2
- package/dist/availability.js +20 -18
- package/dist/blueprint.js +76 -77
- package/dist/build.d.ts +3063 -0
- package/dist/build.js +37 -0
- package/dist/buildApplicationAdmission.js +15 -0
- package/dist/buildApplicationCatalog.js +135 -0
- package/dist/buildApplicationCatalogTable.js +23 -0
- package/dist/buildApplicationRest.js +98 -0
- package/dist/buildApplicationUpload.js +110 -0
- package/dist/buildSnapshot.js +400 -0
- package/dist/buildSnapshotApplicationPin.js +31 -0
- package/dist/buildSnapshotRest.js +209 -0
- package/dist/buildSnapshotService.js +264 -0
- package/dist/buildSnapshotTables.js +24 -0
- package/dist/bulk.js +72 -72
- package/dist/cacheIdentity.js +1 -2
- package/dist/changes.js +280 -64
- package/dist/cmsContext.js +1 -2
- package/dist/collections.js +1 -2
- package/dist/consent.js +6 -7
- package/dist/contentLocations.js +52 -0
- package/dist/contentProjection.js +82 -0
- package/dist/contentRouteIdentity.js +12 -0
- package/dist/contentRouteMaterializer.js +96 -0
- package/dist/contentRouteTypes.js +38 -0
- package/dist/contentSeo.js +188 -0
- package/dist/contentTreePath.js +59 -0
- package/dist/contentType.js +121 -105
- package/dist/contentValues.js +17 -0
- package/dist/contentfulImport.js +1 -2
- package/dist/copies.js +4 -5
- package/dist/cutover.js +1 -2
- package/dist/deliveryChecks.js +1 -2
- package/dist/domainHost.js +6 -0
- package/dist/domains.js +82 -89
- package/dist/draftTexts.js +38 -39
- package/dist/duplicates.js +24 -25
- package/dist/edgePurge.js +1 -2
- package/dist/editHistory.js +1 -2
- package/dist/effectForm.js +1 -2
- package/dist/environmentAliases.js +137 -0
- package/dist/environments.js +108 -71
- package/dist/errors.js +55 -16
- package/dist/experiments.js +8 -9
- package/dist/exposure.js +1 -2
- package/dist/extensionManifest.js +2 -3
- package/dist/extensions.js +1 -2
- package/dist/fieldSchema.js +1 -2
- package/dist/formStrings.js +1 -2
- package/dist/frontendBindings.js +98 -0
- package/dist/frontendMedia.js +17 -0
- package/dist/glossary.js +1 -2
- package/dist/history.js +1 -2
- package/dist/htmlImport.js +1 -2
- package/dist/index.d.ts +760 -47
- package/dist/index.js +89 -73
- package/dist/initializePublicRoutes.js +27 -0
- package/dist/liveContentRouteView.js +75 -0
- package/dist/media.js +1 -2
- package/dist/metrics.js +1 -2
- package/dist/migration.js +1 -2
- package/dist/migrationStages.js +1 -2
- package/dist/nativeOutputDeploymentService.js +204 -0
- package/dist/outputActivation.js +233 -0
- package/dist/outputActivationOrigin.js +50 -0
- package/dist/outputActivationStore.js +410 -0
- package/dist/outputActivationTables.js +10 -0
- package/dist/outputActivationTarget.js +80 -0
- package/dist/outputActivationTargetTable.js +24 -0
- package/dist/outputDeployment.js +173 -0
- package/dist/outputDeploymentRest.js +167 -0
- package/dist/outputDeploymentService.js +240 -0
- package/dist/outputRouteGraph.js +176 -0
- package/dist/outputSafetyArtifact.js +146 -0
- package/dist/outputTargetRest.js +61 -0
- package/dist/pathSegmentEncoding.js +3 -0
- package/dist/presenceAnchors.js +1 -2
- package/dist/preview.js +1 -2
- package/dist/privateCmsTransport.js +75 -0
- package/dist/privateNativeRouteReservation.js +9 -0
- package/dist/promotion.js +69 -61
- package/dist/publicBuild.js +89 -0
- package/dist/publicBuildRest.js +97 -0
- package/dist/publicBuildService.js +62 -0
- package/dist/publicOutputHttp.js +128 -0
- package/dist/publicOutputService.js +286 -0
- package/dist/publicPresentation.js +16 -0
- package/dist/publicRouteDispositionAdmission.js +37 -0
- package/dist/publicRouteHistoryStore.js +11 -0
- package/dist/publicRouteHistoryView.js +33 -0
- package/dist/publicRouteIntegrity.js +4 -0
- package/dist/publicRouteMutation.js +5 -0
- package/dist/publicRouteNamespace.js +133 -0
- package/dist/publicRoutePublication.js +35 -0
- package/dist/publicRouteRegistry.js +16 -0
- package/dist/publicRouteRegistryBinding.js +193 -0
- package/dist/publicRouteRegistryDefinition.js +75 -0
- package/dist/publicRouteSitePublication.js +39 -0
- package/dist/publicRouteTables.js +12 -0
- package/dist/publicRouteUrl.js +17 -0
- package/dist/publicationSeo.js +51 -0
- package/dist/publicationState.js +295 -0
- package/dist/quality.js +9 -10
- package/dist/reconfigurePublicRoutes.js +40 -0
- package/dist/recurrence.js +1 -2
- package/dist/redirects.js +105 -75
- package/dist/referenceGraph.js +16 -16
- package/dist/references.js +3 -4
- package/dist/release.js +178 -143
- package/dist/renderReadAuthority.js +42 -0
- package/dist/renderReadGrant.js +136 -0
- package/dist/rest.js +1 -2
- package/dist/review.js +29 -30
- package/dist/richDocument.js +56 -27
- package/dist/richInline.js +1 -2
- package/dist/routeDispositionGraph.js +43 -0
- package/dist/routeDispositionRest.js +50 -0
- package/dist/routeDispositionService.js +72 -0
- package/dist/routeDispositionStore.js +288 -0
- package/dist/routeDispositionTables.js +4 -0
- package/dist/routeDispositions.js +90 -0
- package/dist/routeHistoryStorage.js +319 -0
- package/dist/routeHistoryStore.js +11 -0
- package/dist/schedule.js +37 -38
- package/dist/search.js +1 -2
- package/dist/selectionIntent.js +1 -2
- package/dist/seo.js +2 -3
- package/dist/series.js +12 -13
- package/dist/share.js +14 -15
- package/dist/siteBindings.js +158 -0
- package/dist/siteBuildCandidate.js +103 -0
- package/dist/siteDelivery.js +114 -0
- package/dist/siteState.js +46 -0
- package/dist/snapshotAddressGraph.js +54 -0
- package/dist/snapshotAddressRead.js +72 -0
- package/dist/snapshotAppConsumer.js +70 -0
- package/dist/snapshotAppExecution.js +101 -0
- package/dist/snapshotApplication.js +74 -0
- package/dist/snapshotApprovedRouteDispositions.js +43 -0
- package/dist/snapshotAssetAssembly.js +69 -0
- package/dist/snapshotAssetAssemblyRest.js +49 -0
- package/dist/snapshotBindingRead.js +60 -0
- package/dist/snapshotCodeSeo.js +28 -0
- package/dist/snapshotComponent.js +33 -0
- package/dist/snapshotComponentSource.js +23 -0
- package/dist/snapshotConsumer.js +86 -0
- package/dist/snapshotContentIdentity.js +9 -0
- package/dist/snapshotDefinitions.js +263 -0
- package/dist/snapshotDocumentAssembly.js +192 -0
- package/dist/snapshotDocumentAssemblyRest.js +83 -0
- package/dist/snapshotDocumentProjection.js +201 -0
- package/dist/snapshotDocumentTransfer.js +34 -0
- package/dist/snapshotDocumentTransferRest.js +79 -0
- package/dist/snapshotDomains.js +55 -0
- package/dist/snapshotEnvironment.js +30 -0
- package/dist/snapshotFieldPlan.js +84 -0
- package/dist/snapshotFrontend.js +102 -0
- package/dist/snapshotLink.js +7 -0
- package/dist/snapshotMedia.js +110 -0
- package/dist/snapshotMediaCapture.js +245 -0
- package/dist/snapshotMediaFields.js +224 -0
- package/dist/snapshotMediaRead.js +184 -0
- package/dist/snapshotMediaReader.js +12 -0
- package/dist/snapshotObservation.js +15 -0
- package/dist/snapshotObservedRouteHistory.js +33 -0
- package/dist/snapshotOutputTransfer.js +77 -0
- package/dist/snapshotPageLoader.js +6 -0
- package/dist/snapshotPageSeo.js +58 -0
- package/dist/snapshotPathLocale.js +14 -0
- package/dist/snapshotPresentation.js +85 -0
- package/dist/snapshotPresentationPolicy.js +11 -0
- package/dist/snapshotProjection.js +118 -0
- package/dist/snapshotPublicAccess.js +160 -0
- package/dist/snapshotPublicRouteHistory.js +39 -0
- package/dist/snapshotReadAdmission.js +37 -0
- package/dist/snapshotRedirectOutput.js +150 -0
- package/dist/snapshotRedirectTargets.js +23 -0
- package/dist/snapshotRedirects.js +131 -0
- package/dist/snapshotReference.js +7 -0
- package/dist/snapshotReferenceAddress.js +9 -0
- package/dist/snapshotReferenceGraph.js +78 -0
- package/dist/snapshotReferenceRead.js +64 -0
- package/dist/snapshotRelease.js +98 -0
- package/dist/snapshotRender.js +360 -0
- package/dist/snapshotRenderDependencies.js +177 -0
- package/dist/snapshotRenditions.js +87 -0
- package/dist/snapshotRichDocument.js +61 -0
- package/dist/snapshotRoleTransfer.js +105 -0
- package/dist/snapshotRoleTransferRest.js +98 -0
- package/dist/snapshotRouteAdmission.js +70 -0
- package/dist/snapshotRouteDispatch.js +110 -0
- package/dist/snapshotRouteDispositionPlan.js +72 -0
- package/dist/snapshotRouteRead.js +42 -0
- package/dist/snapshotRoutes.js +78 -0
- package/dist/snapshotRouting.js +112 -0
- package/dist/snapshotSeo.js +178 -0
- package/dist/snapshotSeoControls.js +100 -0
- package/dist/snapshotSeoDocumentInventory.js +114 -0
- package/dist/snapshotSeoDocuments.js +128 -0
- package/dist/snapshotSeoMerge.js +84 -0
- package/dist/snapshotSeoMetadata.js +136 -0
- package/dist/snapshotSeoOutput.js +172 -0
- package/dist/snapshotSeoPathSets.js +104 -0
- package/dist/snapshotSeoRead.js +87 -0
- package/dist/snapshotSite.js +127 -0
- package/dist/snapshotSitemapFiles.js +35 -0
- package/dist/snapshotTreeDependencies.js +57 -0
- package/dist/snapshotTreeLoader.js +9 -0
- package/dist/snapshotTreeRead.js +157 -0
- package/dist/staticPathSet.js +176 -0
- package/dist/staticPathSetRest.js +128 -0
- package/dist/staticPathSetService.js +248 -0
- package/dist/staticPathSetStore.js +337 -0
- package/dist/stewardship.js +2 -3
- package/dist/taxonomy.js +1 -2
- package/dist/team.js +1 -2
- package/dist/templates.js +2 -3
- package/dist/trackChanges.js +1 -2
- package/dist/translation.js +1 -2
- package/dist/tree.js +10 -11
- package/dist/usage.js +1 -2
- package/dist/validation.js +54 -55
- package/dist/visualEditing.js +1 -2
- package/dist/web.d.ts +709 -7
- package/dist/web.js +50 -33
- package/dist/workflow.js +9 -10
- package/dist/write.js +251 -227
- package/dist/xliff.js +1 -2
- package/package.json +21 -7
package/dist/translation.js
CHANGED
|
@@ -2,7 +2,7 @@ import { asTyped as e } from "./effectForm.js";
|
|
|
2
2
|
import { CMS_REVISIONS_TABLE as t } from "./contentType.js";
|
|
3
3
|
import { changedFields as n } from "./history.js";
|
|
4
4
|
import { and as r, eq as i, inSet as a } from "@voltro/database";
|
|
5
|
-
|
|
5
|
+
// src/translation.ts
|
|
6
6
|
var o = (e, t, n) => e.query({
|
|
7
7
|
table: t,
|
|
8
8
|
predicate: n,
|
|
@@ -60,5 +60,4 @@ var o = (e, t, n) => e.query({
|
|
|
60
60
|
};
|
|
61
61
|
return new Map(u.map((e) => [e, _(f.get(e) ?? /* @__PURE__ */ new Map())]));
|
|
62
62
|
}, d = (...t) => e(() => l(...t)), f = (...t) => e(() => u(...t));
|
|
63
|
-
//#endregion
|
|
64
63
|
export { l as translationStatus, d as translationStatusEffect, u as translationStatuses, f as translationStatusesEffect };
|
package/dist/tree.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/tree.ts
|
|
2
2
|
var e = (e, t) => {
|
|
3
3
|
let n = e[t.parent];
|
|
4
4
|
return typeof n == "string" && n !== "" ? n : null;
|
|
@@ -19,13 +19,13 @@ var e = (e, t) => {
|
|
|
19
19
|
let n = e(t.row, i), r = o.get(n) ?? [];
|
|
20
20
|
r.push(t), o.set(n, r);
|
|
21
21
|
}
|
|
22
|
-
let s = (e, r) => t(e.row, i) - t(r.row, i) || n(e.row, i)
|
|
23
|
-
for (let r of [...o.get(e) ?? []].sort(
|
|
22
|
+
let s = (e, t) => e < t ? -1 : +(e > t), c = (e, r) => t(e.row, i) - t(r.row, i) || s(n(e.row, i), n(r.row, i)) || s(String(e.row.documentId), String(r.row.documentId)), l = [], u = /* @__PURE__ */ new Set(), d = (e, t) => {
|
|
23
|
+
for (let r of [...o.get(e) ?? []].sort(c)) {
|
|
24
24
|
let a = r.row.documentId, o = n(r.row, i);
|
|
25
|
-
if (o === "" ||
|
|
26
|
-
|
|
25
|
+
if (o === "" || u.has(a)) continue;
|
|
26
|
+
u.add(a);
|
|
27
27
|
let s = [...t, o];
|
|
28
|
-
|
|
28
|
+
l.push({
|
|
29
29
|
documentId: a,
|
|
30
30
|
parent: e,
|
|
31
31
|
depth: t.length,
|
|
@@ -34,12 +34,12 @@ var e = (e, t) => {
|
|
|
34
34
|
row: r.row,
|
|
35
35
|
locale: r.locale,
|
|
36
36
|
fallback: r.fallback
|
|
37
|
-
}),
|
|
37
|
+
}), d(a, s);
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
|
-
return
|
|
41
|
-
nodes:
|
|
42
|
-
orphans: [...a.keys()].filter((e) => !
|
|
40
|
+
return d(null, []), {
|
|
41
|
+
nodes: l,
|
|
42
|
+
orphans: [...a.keys()].filter((e) => !u.has(e)).sort()
|
|
43
43
|
};
|
|
44
44
|
}, i = (e) => e != null && e !== "", a = (e, t, n, r = {}) => {
|
|
45
45
|
let a = new Map(e.nodes.map((e) => [e.documentId, e])), o = r.ancestorsOnly === !0 ? t.parent === null ? void 0 : a.get(t.parent) : t, s = /* @__PURE__ */ new Set();
|
|
@@ -83,5 +83,4 @@ var e = (e, t) => {
|
|
|
83
83
|
};
|
|
84
84
|
});
|
|
85
85
|
};
|
|
86
|
-
//#endregion
|
|
87
86
|
export { r as buildTree, o as effectiveInheritance, a as inheritedValue };
|
package/dist/usage.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { asTyped as e } from "./effectForm.js";
|
|
2
2
|
import { and as t, eq as n, neq as r } from "@voltro/database";
|
|
3
|
-
|
|
3
|
+
// src/usage.ts
|
|
4
4
|
var i = async (e, i, a) => {
|
|
5
5
|
let o = {}, s = /* @__PURE__ */ new Set();
|
|
6
6
|
for (let c of i) {
|
|
@@ -46,5 +46,4 @@ var i = async (e, i, a) => {
|
|
|
46
46
|
environments: [...s].sort()
|
|
47
47
|
};
|
|
48
48
|
}, a = (...t) => e(() => i(...t));
|
|
49
|
-
//#endregion
|
|
50
49
|
export { i as contentUsage, a as contentUsageEffect };
|
package/dist/validation.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { ContentValidationFailed as e } from "./errors.js";
|
|
2
|
+
import { normalizeRichDocument as t, richDocumentProblems as n } from "./richDocument.js";
|
|
3
|
+
import { normalizeTerms as r, taxonomyValue as i } from "./taxonomy.js";
|
|
4
4
|
import { documentHasChanges as a } from "./trackChanges.js";
|
|
5
|
-
|
|
5
|
+
// src/validation.ts
|
|
6
6
|
var o = /* @__PURE__ */ new Set([
|
|
7
7
|
"status",
|
|
8
8
|
"publishAt",
|
|
@@ -25,54 +25,54 @@ var o = /* @__PURE__ */ new Set([
|
|
|
25
25
|
}), c = (e) => typeof e == "object" && !!e && !Array.isArray(e), l = (e) => e instanceof Date ? !Number.isNaN(e.getTime()) : typeof e == "string" && !Number.isNaN(new Date(e).getTime()), u = (e, t, n) => {
|
|
26
26
|
let r = [];
|
|
27
27
|
return t.maxLength !== void 0 && n.length > t.maxLength && r.push(s(e, "maxLength", `exceeds maxLength(${t.maxLength}) — got ${n.length} characters`)), t.pattern !== void 0 && !new RegExp(t.pattern).test(n) && r.push(s(e, "pattern", `does not match pattern /${t.pattern}/`)), r;
|
|
28
|
-
}, d = (
|
|
28
|
+
}, d = (e, r, i) => {
|
|
29
29
|
switch (r.kind) {
|
|
30
30
|
case "string":
|
|
31
31
|
case "media":
|
|
32
|
-
case "reference": return typeof i == "string" ? u(
|
|
33
|
-
case "number": return typeof i != "number" || !Number.isFinite(i) ? [s(
|
|
34
|
-
case "boolean": return typeof i == "boolean" ? [] : [s(
|
|
32
|
+
case "reference": return typeof i == "string" ? u(e, r, i) : [s(e, "type", `expected a string, got ${typeof i}`)];
|
|
33
|
+
case "number": return typeof i != "number" || !Number.isFinite(i) ? [s(e, "type", "expected a finite number")] : r.fraction !== !0 && !Number.isInteger(i) ? [s(e, "integer", "expected a whole number (declare Schema.Fraction for fractions)")] : [];
|
|
34
|
+
case "boolean": return typeof i == "boolean" ? [] : [s(e, "type", `expected a boolean, got ${typeof i}`)];
|
|
35
35
|
case "date":
|
|
36
|
-
case "datetime": return l(i) ? [] : [s(
|
|
36
|
+
case "datetime": return l(i) ? [] : [s(e, "type", "expected a Date or a parseable date string")];
|
|
37
37
|
case "literal": {
|
|
38
|
-
let
|
|
39
|
-
return typeof i != "string" || !
|
|
38
|
+
let t = r.literals ?? [];
|
|
39
|
+
return typeof i != "string" || !t.includes(i) ? [s(e, "literal", `expected one of: ${t.join(", ")}`)] : [];
|
|
40
40
|
}
|
|
41
41
|
case "richText": {
|
|
42
|
-
let a = r.richText ?? {}, o =
|
|
43
|
-
return (c(o) && Array.isArray(o.blocks) ? o.blocks : []).forEach((
|
|
44
|
-
if (!c(
|
|
45
|
-
let r = u.get(String(
|
|
46
|
-
r !== void 0 && l.push(...f(`${
|
|
42
|
+
let a = r.richText ?? {}, o = t(i), l = n(e, o, a).map((e) => s(e.path, e.rule, e.message)), u = new Map((a.profile?.components ?? []).map((e) => [e.id, e]));
|
|
43
|
+
return (c(o) && Array.isArray(o.blocks) ? o.blocks : []).forEach((t, n) => {
|
|
44
|
+
if (!c(t) || t.type !== "component" || !c(t.props)) return;
|
|
45
|
+
let r = u.get(String(t.componentId));
|
|
46
|
+
r !== void 0 && l.push(...f(`${e}.blocks[${n}].props`, r.props, t.props, `component '${r.id}'`, !0));
|
|
47
47
|
}), l;
|
|
48
48
|
}
|
|
49
49
|
case "array": {
|
|
50
|
-
if (!Array.isArray(i)) return [s(
|
|
51
|
-
let
|
|
52
|
-
if (
|
|
53
|
-
let
|
|
54
|
-
return i.forEach((r, i) =>
|
|
50
|
+
if (!Array.isArray(i)) return [s(e, "type", "expected an array")];
|
|
51
|
+
let t = r.element;
|
|
52
|
+
if (t === void 0) return [];
|
|
53
|
+
let n = [];
|
|
54
|
+
return i.forEach((r, i) => n.push(...d(`${e}[${i}]`, t, r))), n;
|
|
55
55
|
}
|
|
56
|
-
case "struct": return c(i) ? f(
|
|
56
|
+
case "struct": return c(i) ? f(e, r.struct ?? {}, i, "struct", !1) : [s(e, "type", "expected an object")];
|
|
57
57
|
case "components": {
|
|
58
|
-
if (!Array.isArray(i)) return [s(
|
|
59
|
-
let
|
|
58
|
+
if (!Array.isArray(i)) return [s(e, "type", "expected a list of components")];
|
|
59
|
+
let t = new Map((r.components ?? []).map((e) => [e.id, e])), n = [], a = /* @__PURE__ */ new Set();
|
|
60
60
|
return i.forEach((r, i) => {
|
|
61
|
-
let o = `${
|
|
61
|
+
let o = `${e}[${i}]`;
|
|
62
62
|
if (!c(r)) {
|
|
63
|
-
|
|
63
|
+
n.push(s(o, "type", "expected a component instance"));
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
66
|
let l = r.instanceId;
|
|
67
|
-
typeof l != "string" || l === "" ?
|
|
68
|
-
let u =
|
|
67
|
+
typeof l != "string" || l === "" ? n.push(s(`${o}.instanceId`, "required", "missing instance id")) : a.has(l) ? n.push(s(`${o}.instanceId`, "unique", `instance '${l}' appears twice`)) : a.add(l);
|
|
68
|
+
let u = t.get(String(r.componentId));
|
|
69
69
|
if (u === void 0) {
|
|
70
|
-
|
|
70
|
+
n.push(s(`${o}.componentId`, "unknown", `'${String(r.componentId)}' is not a component this field allows`));
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
73
|
let d = r.props;
|
|
74
|
-
c(d) ?
|
|
75
|
-
}),
|
|
74
|
+
c(d) ? n.push(...f(`${o}.props`, u.props, d, `component '${u.id}'`, !0)) : n.push(s(`${o}.props`, "type", "expected an object"));
|
|
75
|
+
}), n;
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
}, f = (e, t, n, r, i) => {
|
|
@@ -84,42 +84,42 @@ var o = /* @__PURE__ */ new Set([
|
|
|
84
84
|
for (let i of Object.keys(n)) i in t || a.push(s(`${e}.${i}`, "unknown", `not a declared field of this ${r}`));
|
|
85
85
|
return a;
|
|
86
86
|
}, p = (e, t) => {
|
|
87
|
-
let
|
|
88
|
-
for (let [
|
|
89
|
-
let e = t[
|
|
90
|
-
e == null ? i.isOptional ||
|
|
87
|
+
let n = [];
|
|
88
|
+
for (let [r, i] of Object.entries(e.fields)) {
|
|
89
|
+
let e = t[r];
|
|
90
|
+
e == null ? i.isOptional || n.push(s(r, "required", "missing required field")) : n.push(...d(r, i, e));
|
|
91
91
|
}
|
|
92
92
|
let i = t.id;
|
|
93
|
-
i !== void 0 && typeof i != "string" &&
|
|
94
|
-
for (let
|
|
93
|
+
i !== void 0 && typeof i != "string" && n.push(s("id", "type", "expected a string id"));
|
|
94
|
+
for (let r of Object.keys(t)) r === "id" || r in e.fields || o.has(r) || n.push(s(r, "unknown", `'${r}' is not a declared field of '${e.name}'`));
|
|
95
95
|
let a = e.taxonomy;
|
|
96
96
|
if (a !== void 0 && (a.unknown ?? "refuse") === "refuse" && Array.isArray(t[a.field])) {
|
|
97
|
-
let { unknown: e } =
|
|
98
|
-
e.length > 0 &&
|
|
97
|
+
let { unknown: e } = r(a, t[a.field]);
|
|
98
|
+
e.length > 0 && n.push(s(a.field, "taxonomy", `not in the vocabulary: ${e.join(", ")}`));
|
|
99
99
|
}
|
|
100
|
-
return
|
|
100
|
+
return n;
|
|
101
101
|
}, m = (e, t) => [...Object.entries(e.fields).filter(([e, n]) => {
|
|
102
102
|
let r = t[e];
|
|
103
103
|
return n.publishRequired === !0 && (r == null || typeof r == "string" && r.trim() === "");
|
|
104
104
|
}).map(([e]) => s(e, "requiredToPublish", "needed before publishing")), ...Object.entries(e.fields).filter(([e, n]) => {
|
|
105
105
|
let r = t[e];
|
|
106
106
|
return n.kind === "richText" && c(r) && Array.isArray(r.blocks) && a(r);
|
|
107
|
-
}).map(([e]) => s(e, "pendingChanges", "accept or reject the suggested changes first"))], h = (
|
|
108
|
-
let
|
|
109
|
-
if (
|
|
110
|
-
contentType:
|
|
111
|
-
violations:
|
|
107
|
+
}).map(([e]) => s(e, "pendingChanges", "accept or reject the suggested changes first"))], h = (t, n) => {
|
|
108
|
+
let r = p(t, n);
|
|
109
|
+
if (r.length > 0) throw new e({
|
|
110
|
+
contentType: t.name,
|
|
111
|
+
violations: r
|
|
112
112
|
});
|
|
113
|
-
}, g = (
|
|
114
|
-
let
|
|
115
|
-
a !== void 0 && Array.isArray(
|
|
116
|
-
for (let
|
|
117
|
-
let n =
|
|
118
|
-
n !== void 0 && (
|
|
113
|
+
}, g = (e, n) => {
|
|
114
|
+
let r = { ...n }, a = e.taxonomy;
|
|
115
|
+
a !== void 0 && Array.isArray(r[a.field]) && (r[a.field] = i(a, r[a.field]));
|
|
116
|
+
for (let t of e.derivedFields) {
|
|
117
|
+
let n = e.fields[t]?.derived;
|
|
118
|
+
n !== void 0 && (r[t] = n.transform(r[n.source], r));
|
|
119
119
|
}
|
|
120
|
-
for (let [n,
|
|
121
|
-
for (let [
|
|
122
|
-
return
|
|
120
|
+
for (let [n, i] of Object.entries(e.fields)) i.kind === "richText" && r[n] !== void 0 && r[n] !== null && (r[n] = _(i, t(r[n], i.richText?.profile)));
|
|
121
|
+
for (let [t, n] of Object.entries(e.fields)) n.kind === "components" && Array.isArray(r[t]) && (r[t] = v(n.components ?? [], r[t]));
|
|
122
|
+
return r;
|
|
123
123
|
}, _ = (e, t) => {
|
|
124
124
|
let n = e.richText?.profile?.components ?? [];
|
|
125
125
|
return n.length === 0 || !c(t) || !Array.isArray(t.blocks) ? t : {
|
|
@@ -188,5 +188,4 @@ var o = /* @__PURE__ */ new Set([
|
|
|
188
188
|
}
|
|
189
189
|
return t;
|
|
190
190
|
}, x = () => `cins_${globalThis.crypto.randomUUID().replaceAll("-", "")}`;
|
|
191
|
-
//#endregion
|
|
192
191
|
export { g as applyDerivations, b as componentExampleViolations, p as contentViolations, x as newInstanceId, m as publishViolations, y as staleComponents, h as validateContent };
|
package/dist/visualEditing.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/visualEditing.ts
|
|
2
2
|
var e = "voltro.cms.visual/1", t = () => Array.from(globalThis.crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(16)), (e) => e.toString(16).padStart(2, "0")).join(""), n = /^[A-Za-z_][A-Za-z0-9_]*(\.\d+)?$/, r = (e, t) => {
|
|
3
3
|
if (e.origin !== t.origin) return null;
|
|
4
4
|
let n = e.data;
|
|
@@ -56,5 +56,4 @@ var e = "voltro.cms.visual/1", t = () => Array.from(globalThis.crypto.getRandomV
|
|
|
56
56
|
let { field: r, index: i } = l(t), a = e.querySelector(`[data-cms-field="${r}"]`);
|
|
57
57
|
return a === null || i === void 0 ? a : a.querySelectorAll("[data-cms-components] > [data-cms-component]")[i] ?? null;
|
|
58
58
|
};
|
|
59
|
-
//#endregion
|
|
60
59
|
export { e as VISUAL_EDITING_PROTOCOL, d as formPartOf, u as moveEntry, t as newVisualNonce, l as parseSourcePath, a as readEditorMessage, i as readPreviewMessage, s as sourceAttributes, c as sourcePathOf, o as visualMessage };
|