@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
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { readPublicationBoundary as e } from "./changes.js";
|
|
2
|
+
import { CMS_PATHS_TABLE as t, CMS_REDIRECTS_TABLE as n } from "./redirects.js";
|
|
3
|
+
import { verifyPublicationState as r } from "./publicationState.js";
|
|
4
|
+
import { copySnapshotResource as i } from "./buildSnapshot.js";
|
|
5
|
+
import { snapshotObservedRouteHistorySource as a } from "./snapshotObservedRouteHistory.js";
|
|
6
|
+
import { snapshotPublicRouteHistorySource as o } from "./snapshotPublicRouteHistory.js";
|
|
7
|
+
import { snapshotApprovedRouteDispositionsSource as s } from "./snapshotApprovedRouteDispositions.js";
|
|
8
|
+
import { Schema as c } from "effect";
|
|
9
|
+
import { and as l, eq as u, gt as d, inSet as f } from "@voltro/database";
|
|
10
|
+
import { createHash as p } from "node:crypto";
|
|
11
|
+
import { canonicalJson as m } from "@voltro/runtime";
|
|
12
|
+
//#region src/snapshotRedirects.ts
|
|
13
|
+
var h = class extends c.TaggedError()("SnapshotRedirectUnavailable", { reason: c.Literals([
|
|
14
|
+
"scope",
|
|
15
|
+
"checkpoint",
|
|
16
|
+
"row",
|
|
17
|
+
"history"
|
|
18
|
+
]) }) {}, g = (e) => {
|
|
19
|
+
throw new h({ reason: e });
|
|
20
|
+
}, _ = (e) => typeof e == "string" && e.length > 0, v = (c, h, v, y, b = Date.now()) => {
|
|
21
|
+
let x = {
|
|
22
|
+
tenantId: h.tenantId,
|
|
23
|
+
site: h.site,
|
|
24
|
+
environment: h.environment
|
|
25
|
+
};
|
|
26
|
+
if (!Object.values(x).every(_)) return g("scope");
|
|
27
|
+
let S = o(c, x, y);
|
|
28
|
+
return {
|
|
29
|
+
format: "voltro.cms.redirect-history/v4",
|
|
30
|
+
entries: async function* (o) {
|
|
31
|
+
let h = await e(c, x);
|
|
32
|
+
if (h.generation !== o.generation || h.releaseId !== o.releaseId || h.checkpoint !== o.checkpoint) return g("checkpoint");
|
|
33
|
+
let y = await r(c, x, o, b), C = !1;
|
|
34
|
+
for await (let e of a(c, x, b).entries(o)) if (e.key === "configuration") {
|
|
35
|
+
if (C || e.value.revision !== v.generation || e.value.sourceDigest !== v.sourceDigest || v.generation === 0 != (v.activationId === null)) return g("history");
|
|
36
|
+
C = !0, yield i({
|
|
37
|
+
key: "configuration",
|
|
38
|
+
value: {
|
|
39
|
+
...e.value,
|
|
40
|
+
version: 4,
|
|
41
|
+
coverage: "source-and-activated-output",
|
|
42
|
+
activationId: v.activationId,
|
|
43
|
+
status: v.generation === 0 ? "before-first-activation" : "observed"
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
} else {
|
|
47
|
+
if (!C) return g("history");
|
|
48
|
+
yield i({
|
|
49
|
+
key: "observed:" + e.key,
|
|
50
|
+
value: {
|
|
51
|
+
...e.value,
|
|
52
|
+
version: 2,
|
|
53
|
+
kind: "observed"
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
if (!C) return g("history");
|
|
58
|
+
for await (let e of S.entries(o)) yield i({
|
|
59
|
+
key: "source:" + e.key,
|
|
60
|
+
value: e.value
|
|
61
|
+
});
|
|
62
|
+
for await (let e of s(c, x, b).entries(o)) yield i({
|
|
63
|
+
key: "disposition:" + e.key,
|
|
64
|
+
value: {
|
|
65
|
+
...e.value,
|
|
66
|
+
kind: e.key === "configuration" ? "disposition-configuration" : "disposition"
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
for (let [e, r, a] of [[
|
|
70
|
+
"path",
|
|
71
|
+
t,
|
|
72
|
+
"path"
|
|
73
|
+
], [
|
|
74
|
+
"redirect",
|
|
75
|
+
n,
|
|
76
|
+
"fromPath"
|
|
77
|
+
]]) {
|
|
78
|
+
let t;
|
|
79
|
+
for (;;) {
|
|
80
|
+
let n = await c.query({
|
|
81
|
+
table: r,
|
|
82
|
+
predicate: l(u("tenantId", x.tenantId), u("site", x.site), u("environment", x.environment), f("contentType", y.types), f("locale", y.locales), ...t === void 0 ? [] : [d("id", t)]),
|
|
83
|
+
lock: "update",
|
|
84
|
+
order: [{
|
|
85
|
+
column: "id",
|
|
86
|
+
direction: "asc"
|
|
87
|
+
}],
|
|
88
|
+
take: 500,
|
|
89
|
+
skip: void 0,
|
|
90
|
+
projection: [
|
|
91
|
+
"id",
|
|
92
|
+
"contentType",
|
|
93
|
+
"locale",
|
|
94
|
+
"documentId",
|
|
95
|
+
a
|
|
96
|
+
]
|
|
97
|
+
});
|
|
98
|
+
if (n.length === 0) break;
|
|
99
|
+
for (let t of n) {
|
|
100
|
+
if (![
|
|
101
|
+
t.id,
|
|
102
|
+
t.contentType,
|
|
103
|
+
t.locale,
|
|
104
|
+
t.documentId
|
|
105
|
+
].every(_) || typeof t[a] != "string") return g("row");
|
|
106
|
+
let n = [
|
|
107
|
+
t.contentType,
|
|
108
|
+
t.locale,
|
|
109
|
+
e === "path" ? t.documentId : t[a]
|
|
110
|
+
], r = `${e}:${p("sha256").update(m(n)).digest("hex")}`;
|
|
111
|
+
yield i({
|
|
112
|
+
key: r,
|
|
113
|
+
value: {
|
|
114
|
+
version: 1,
|
|
115
|
+
kind: e,
|
|
116
|
+
...x,
|
|
117
|
+
id: t.id,
|
|
118
|
+
contentType: t.contentType,
|
|
119
|
+
locale: t.locale,
|
|
120
|
+
documentId: t.documentId,
|
|
121
|
+
path: t[a]
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
t = String(n[n.length - 1].id);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
//#endregion
|
|
132
|
+
export { h as SnapshotRedirectUnavailable, v as snapshotRedirectSource };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/snapshotReference.ts
|
|
2
|
+
var e = (e, t) => {
|
|
3
|
+
let n = Object.getOwnPropertyDescriptor(e, Symbol.for("voltro.cms.snapshot.reference/v1"));
|
|
4
|
+
if (n === void 0 || n.enumerable || n.writable || typeof n.value != "function") throw Error("Snapshot reference unavailable");
|
|
5
|
+
return n.value(t);
|
|
6
|
+
};
|
|
7
|
+
//#endregion
|
|
8
|
+
export { e as snapshotReference };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { readCapturedPublicAddress as e } from "./snapshotAddressRead.js";
|
|
2
|
+
//#region src/snapshotReferenceAddress.ts
|
|
3
|
+
var t = (t, n, r, i, a, o) => e(t, n, r.snapshot, {
|
|
4
|
+
contentType: i.targetType,
|
|
5
|
+
documentId: i.targetDocumentId,
|
|
6
|
+
localeId: r.output.localeId,
|
|
7
|
+
mappingId: a
|
|
8
|
+
}, o);
|
|
9
|
+
//#endregion
|
|
10
|
+
export { t as readPlannedSnapshotReferenceAddress };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { readVerifiedSnapshotResource as e } from "./buildSnapshot.js";
|
|
2
|
+
import { copySnapshotReferenceTypes as t } from "./snapshotProjection.js";
|
|
3
|
+
import { coversSnapshotComponents as n } from "./snapshotFrontend.js";
|
|
4
|
+
import { SnapshotRouteReadUnavailable as r } from "./snapshotRouteAdmission.js";
|
|
5
|
+
import { readAdmittedSnapshotFieldPlan as i } from "./snapshotFieldPlan.js";
|
|
6
|
+
import { readPlannedSnapshotReferenceContext as a } from "./snapshotReferenceRead.js";
|
|
7
|
+
import { createHash as o } from "node:crypto";
|
|
8
|
+
import { canonicalJson as s } from "@voltro/runtime";
|
|
9
|
+
//#region src/snapshotReferenceGraph.ts
|
|
10
|
+
var c = (e) => {
|
|
11
|
+
throw new r({ reason: e });
|
|
12
|
+
}, l = (e) => o("sha256").update(s(e)).digest("hex"), u = async (r, o, u, d, f, p) => {
|
|
13
|
+
if (u.length === 0 || u.length > 65 || u[0]?.source !== null || new Set(u.map((e) => e.source)).size !== u.length) return c("bounds");
|
|
14
|
+
let m = u[0].context.snapshot;
|
|
15
|
+
if (u.some((e) => e.context.snapshot.id !== m.id || e.context.snapshot.digest !== m.digest || e.context.output.localeId !== f.localeId || e.source?.startsWith("@ref:"))) return c("binding");
|
|
16
|
+
let h = (await e(r, o, m, "projection", "registry")).value;
|
|
17
|
+
if (!Array.isArray(h.types) || !h.types.every((e) => typeof e == "string")) return c("binding");
|
|
18
|
+
let g = new Set(t(h.referenceTypes, h.types)), _ = Object.create(null), v = [], y = /* @__PURE__ */ new Map(), b = u.map((e) => ({
|
|
19
|
+
...e,
|
|
20
|
+
selection: {
|
|
21
|
+
...e.source === null ? {} : { binding: e.source },
|
|
22
|
+
references: []
|
|
23
|
+
}
|
|
24
|
+
})), x = u.reduce((e, t) => e + t.fields.media.length, 0);
|
|
25
|
+
if (x > 1024) return c("bounds");
|
|
26
|
+
if (g.size === 0) return {
|
|
27
|
+
nodes: _,
|
|
28
|
+
edges: v
|
|
29
|
+
};
|
|
30
|
+
for (let e = 0; e < b.length; e++) {
|
|
31
|
+
let t = b[e];
|
|
32
|
+
for (let e of t.fields.references) {
|
|
33
|
+
if (!g.has(e.targetType)) continue;
|
|
34
|
+
if (v.length >= 8192) return c("bounds");
|
|
35
|
+
let s = l([
|
|
36
|
+
e.targetType,
|
|
37
|
+
e.targetDocumentId,
|
|
38
|
+
t.context.output.localeId
|
|
39
|
+
]), u = y.get(s);
|
|
40
|
+
if (!y.has(s)) {
|
|
41
|
+
if (y.size >= 256 || t.selection.references.length >= 16) return c("bounds");
|
|
42
|
+
let l = await a(r, o, t.context, e, p);
|
|
43
|
+
if (l === null) u = null;
|
|
44
|
+
else {
|
|
45
|
+
if (!n(d, l.components, f)) return c("binding");
|
|
46
|
+
let a = await i(r, o, l, p);
|
|
47
|
+
if (x += a.media.length, x > 1024) return c("bounds");
|
|
48
|
+
u = "@ref:" + s;
|
|
49
|
+
let m = {
|
|
50
|
+
...t.selection,
|
|
51
|
+
references: [...t.selection.references, [...e.path]]
|
|
52
|
+
};
|
|
53
|
+
_[u] = {
|
|
54
|
+
selection: m,
|
|
55
|
+
output: l.output,
|
|
56
|
+
fields: a
|
|
57
|
+
}, b.push({
|
|
58
|
+
source: u,
|
|
59
|
+
context: l,
|
|
60
|
+
fields: a,
|
|
61
|
+
selection: m
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
y.set(s, u);
|
|
65
|
+
}
|
|
66
|
+
v.push({
|
|
67
|
+
source: t.source,
|
|
68
|
+
fieldPath: [...e.path],
|
|
69
|
+
target: u ?? null
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return v.sort((e, t) => s(e) < s(t) ? -1 : +(s(e) > s(t))), {
|
|
74
|
+
nodes: _,
|
|
75
|
+
edges: v
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
//#endregion
|
|
79
|
+
export { u as readAdmittedSnapshotReferenceGraph };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { readVerifiedSnapshotResource as e } from "./buildSnapshot.js";
|
|
2
|
+
import { copySnapshotPresentationValue as t } from "./snapshotPresentation.js";
|
|
3
|
+
import { admitSnapshotPublicDocument as n } from "./snapshotPublicAccess.js";
|
|
4
|
+
import { SnapshotRouteReadUnavailable as r } from "./snapshotRouteAdmission.js";
|
|
5
|
+
import { projectSnapshotDocument as i } from "./snapshotDocumentProjection.js";
|
|
6
|
+
import { readSnapshotRouteContext as a } from "./snapshotRouteRead.js";
|
|
7
|
+
import { readAdmittedSnapshotBindingContext as o } from "./snapshotBindingRead.js";
|
|
8
|
+
import { readAdmittedSnapshotFieldPlan as s } from "./snapshotFieldPlan.js";
|
|
9
|
+
import { canonicalJson as c } from "@voltro/runtime";
|
|
10
|
+
//#region src/snapshotReferenceRead.ts
|
|
11
|
+
var l = () => {
|
|
12
|
+
throw new r({ reason: "binding" });
|
|
13
|
+
}, u = (e) => !Array.isArray(e) || e.length === 0 || e.length > 128 || e.some((e) => typeof e == "number" ? !Number.isSafeInteger(e) || e < 0 : typeof e != "string" || e.length === 0 || e.length > 256) ? l() : [...e], d = async (e, t, n, r, i) => {
|
|
14
|
+
let a = await f(e, t, n, r, i);
|
|
15
|
+
return a === null ? null : p(e, t, n, a, i);
|
|
16
|
+
}, f = async (e, t, n, r, i) => {
|
|
17
|
+
let a = u(r);
|
|
18
|
+
return (await s(e, t, n, i)).references.find((e) => c(e.path) === c(a)) ?? null;
|
|
19
|
+
}, p = async (t, r, a, o, s) => {
|
|
20
|
+
let c = await n(t, r, a.snapshot, o.targetType, a.output.localeId, o.targetDocumentId, s);
|
|
21
|
+
if (c === null) return null;
|
|
22
|
+
let l = c.chain[0], u = (await e(t, r, a.snapshot, "schema", `type:${o.targetType}`)).value, d = await i(t, r, a.snapshot, o.targetType, l, u, s, a.output.presentation);
|
|
23
|
+
return {
|
|
24
|
+
snapshot: a.snapshot,
|
|
25
|
+
document: l,
|
|
26
|
+
binding: a.binding,
|
|
27
|
+
routeId: a.routeId,
|
|
28
|
+
components: d.components,
|
|
29
|
+
output: {
|
|
30
|
+
contentType: o.targetType,
|
|
31
|
+
localeId: a.output.localeId,
|
|
32
|
+
requestedLocale: c.requestedLocale,
|
|
33
|
+
sourceLocale: l.locale,
|
|
34
|
+
fallback: l.locale !== c.requestedLocale,
|
|
35
|
+
values: d.values,
|
|
36
|
+
presentation: d.presentation
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}, m = async (e, n, r, i, s) => {
|
|
40
|
+
let c = {
|
|
41
|
+
...i,
|
|
42
|
+
presentation: t(i.presentation)
|
|
43
|
+
}, f = s.now ?? Date.now();
|
|
44
|
+
if (!Array.isArray(c.references) || c.references.length > 16) return l();
|
|
45
|
+
let p = c.references.map(u), m = {
|
|
46
|
+
tenantId: n.tenantId,
|
|
47
|
+
site: n.site,
|
|
48
|
+
environment: n.environment
|
|
49
|
+
}, h = await a(e, m, r, c, {
|
|
50
|
+
...s,
|
|
51
|
+
now: f
|
|
52
|
+
});
|
|
53
|
+
if (h === null) return null;
|
|
54
|
+
let g = c.binding === void 0 ? {
|
|
55
|
+
...h,
|
|
56
|
+
routeId: h.output.routeId
|
|
57
|
+
} : await o(e, m, h, c.binding, f);
|
|
58
|
+
for (let t of p) {
|
|
59
|
+
if (g === null) return null;
|
|
60
|
+
g = await d(e, m, g, t, f);
|
|
61
|
+
}
|
|
62
|
+
return g;
|
|
63
|
+
}, h = async (...e) => !Array.isArray(e[3].references) || e[3].references.length === 0 ? l() : m(...e);
|
|
64
|
+
//#endregion
|
|
65
|
+
export { d as readAdmittedSnapshotReferenceContext, f as readAdmittedSnapshotReferenceUse, p as readPlannedSnapshotReferenceContext, h as readSnapshotReferenceContext, m as readSnapshotReferenceSourceContext };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { readPublicationBoundary as e } from "./changes.js";
|
|
2
|
+
import { readCapturedPublication as t } from "./publicationState.js";
|
|
3
|
+
import { copySnapshotResource as n } from "./buildSnapshot.js";
|
|
4
|
+
import { CMS_RELEASES_TABLE as r, CMS_RELEASE_ITEMS_TABLE as i } from "./release.js";
|
|
5
|
+
import { Schema as a } from "effect";
|
|
6
|
+
import { and as o, eq as s, gt as c } from "@voltro/database";
|
|
7
|
+
//#region src/snapshotRelease.ts
|
|
8
|
+
var l = class extends a.TaggedError()("SnapshotReleaseUnavailable", { reason: a.Literals([
|
|
9
|
+
"scope",
|
|
10
|
+
"release",
|
|
11
|
+
"checkpoint",
|
|
12
|
+
"item"
|
|
13
|
+
]) }) {}, u = (e) => {
|
|
14
|
+
throw new l({ reason: e });
|
|
15
|
+
}, d = (e) => typeof e == "string" && e.trim().length > 0, f = (e) => e === null || d(e), p = (a, l, p, m = Date.now()) => {
|
|
16
|
+
let h = {
|
|
17
|
+
tenantId: l.tenantId,
|
|
18
|
+
site: l.site,
|
|
19
|
+
environment: l.environment
|
|
20
|
+
};
|
|
21
|
+
return ![
|
|
22
|
+
h.tenantId,
|
|
23
|
+
h.site,
|
|
24
|
+
h.environment,
|
|
25
|
+
p
|
|
26
|
+
].every(d) || !Number.isSafeInteger(m) ? u("scope") : {
|
|
27
|
+
format: "voltro.cms.release/v1",
|
|
28
|
+
entries: async function* (l) {
|
|
29
|
+
let g = await e(a, h);
|
|
30
|
+
if (g.generation !== l.generation || g.releaseId !== p || l.releaseId !== p || g.checkpoint !== l.checkpoint) return u("checkpoint");
|
|
31
|
+
let [_] = await a.query({
|
|
32
|
+
table: r,
|
|
33
|
+
predicate: o(s("tenantId", h.tenantId), s("site", h.site), s("environment", h.environment), s("id", p)),
|
|
34
|
+
lock: "update",
|
|
35
|
+
order: [],
|
|
36
|
+
take: 1,
|
|
37
|
+
skip: void 0,
|
|
38
|
+
projection: void 0
|
|
39
|
+
});
|
|
40
|
+
if (_ === void 0 || _.publicationGeneration !== l.generation || _.publicationCheckpoint !== l.checkpoint || _.status !== "published" || !d(_.name) || !f(_.rollbackOf)) return u("release");
|
|
41
|
+
let v = _.publishedAt instanceof Date ? _.publishedAt.getTime() : typeof _.publishedAt == "string" ? Date.parse(_.publishedAt) : NaN;
|
|
42
|
+
if (!Number.isSafeInteger(v) || v > m) return u("release");
|
|
43
|
+
yield n({
|
|
44
|
+
key: "release",
|
|
45
|
+
value: {
|
|
46
|
+
id: p,
|
|
47
|
+
name: _.name,
|
|
48
|
+
...h,
|
|
49
|
+
publishedAt: v,
|
|
50
|
+
rollbackOf: _.rollbackOf,
|
|
51
|
+
publication: { ...l }
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
let y;
|
|
55
|
+
for (;;) {
|
|
56
|
+
let e = await a.query({
|
|
57
|
+
table: i,
|
|
58
|
+
predicate: o(s("tenantId", h.tenantId), s("releaseId", p), ...y === void 0 ? [] : [c("id", y)]),
|
|
59
|
+
lock: "update",
|
|
60
|
+
order: [{
|
|
61
|
+
column: "id",
|
|
62
|
+
direction: "asc"
|
|
63
|
+
}],
|
|
64
|
+
take: 128,
|
|
65
|
+
skip: void 0,
|
|
66
|
+
projection: void 0
|
|
67
|
+
});
|
|
68
|
+
if (e.length === 0) break;
|
|
69
|
+
for (let r of e) {
|
|
70
|
+
if (![
|
|
71
|
+
r.id,
|
|
72
|
+
r.contentType,
|
|
73
|
+
r.variantId,
|
|
74
|
+
r.locale
|
|
75
|
+
].every(d) || !Number.isSafeInteger(r.position) || Number(r.position) < 0 || !f(r.previousRevisionId) || !(r.action === "publish" ? d(r.revisionId) : r.action === "unpublish" && r.revisionId === null)) return u("item");
|
|
76
|
+
let e = await t(a, h, l.id, String(r.contentType), String(r.locale), String(r.variantId), m);
|
|
77
|
+
if (r.action === "publish" ? e?.revisionId !== r.revisionId : e !== null) return u("item");
|
|
78
|
+
yield n({
|
|
79
|
+
key: `item:${String(r.id)}`,
|
|
80
|
+
value: {
|
|
81
|
+
id: r.id,
|
|
82
|
+
contentType: r.contentType,
|
|
83
|
+
variantId: r.variantId,
|
|
84
|
+
locale: r.locale,
|
|
85
|
+
action: r.action,
|
|
86
|
+
revisionId: r.revisionId,
|
|
87
|
+
previousRevisionId: r.previousRevisionId,
|
|
88
|
+
position: r.position,
|
|
89
|
+
inherited: r.inherited ?? null
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
y = String(e[e.length - 1].id);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
//#endregion
|
|
99
|
+
export { l as SnapshotReleaseUnavailable, p as snapshotReleaseSource };
|