@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/promotion.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { PublicRouteRegistryUnavailable as e } from "./publicRouteRegistry.js";
|
|
2
|
+
import { ChangeFeedUnavailable as t, ContentIdConflict as n, ContentNotFound as r, ContentValidationFailed as i, ReferenceUnavailable as a, ReleaseNotEditable as o, ReviewRequired as s, RevisionMismatch as c } from "./errors.js";
|
|
3
|
+
import { asTyped as l } from "./effectForm.js";
|
|
4
|
+
import { pickDeclared as u } from "./contentValues.js";
|
|
5
|
+
import { withPublicRouteStateMutation as d } from "./publicRouteMutation.js";
|
|
6
|
+
import { saveDraft as f } from "./write.js";
|
|
7
|
+
import { addToRelease as p, createRelease as m, publishRelease as h } from "./release.js";
|
|
8
|
+
import { lockEnvironmentPairForPublication as g } from "./environments.js";
|
|
9
|
+
import { and as _, eq as v, neq as y } from "@voltro/database";
|
|
10
|
+
// src/promotion.ts
|
|
11
|
+
var b = (e, t, n, r, i = []) => e.query({
|
|
8
12
|
table: t,
|
|
9
|
-
predicate:
|
|
13
|
+
predicate: _(v("site", n), v("environment", r), y("status", "archived"), ...i),
|
|
10
14
|
order: [{
|
|
11
15
|
column: "id",
|
|
12
16
|
direction: "asc"
|
|
@@ -14,25 +18,25 @@ var g = (e, t, n, r, i = []) => e.query({
|
|
|
14
18
|
take: void 0,
|
|
15
19
|
skip: void 0,
|
|
16
20
|
projection: void 0
|
|
17
|
-
}),
|
|
21
|
+
}), x = (e) => JSON.stringify(e, (e, t) => typeof t == "object" && t && !Array.isArray(t) && !(t instanceof Date) ? Object.fromEntries(Object.entries(t).sort(([e], [t]) => e < t ? -1 : 1)) : t), S = (e) => {
|
|
18
22
|
for (let t of [
|
|
19
23
|
"title",
|
|
20
24
|
"name",
|
|
21
25
|
"slug"
|
|
22
26
|
]) if (typeof e[t] == "string" && e[t] !== "") return e[t];
|
|
23
27
|
return String(e.documentId);
|
|
24
|
-
},
|
|
28
|
+
}, C = (e) => `${String(e.documentId)}\u0000${String(e.locale)}`, w = async (e, t, n) => {
|
|
25
29
|
let r = [];
|
|
26
30
|
for (let i of t) {
|
|
27
|
-
let t = await
|
|
31
|
+
let t = await b(e, `${i.name}_published`, n.site, n.from);
|
|
28
32
|
if (t.length === 0) continue;
|
|
29
|
-
let a = new Map((await
|
|
33
|
+
let a = new Map((await b(e, `${i.name}_published`, n.site, n.to)).map((e) => [C(e), e])), o = new Map((await b(e, `${i.name}_drafts`, n.site, n.to)).map((e) => [C(e), e]));
|
|
30
34
|
for (let e of t) {
|
|
31
|
-
let t = a.get(
|
|
35
|
+
let t = a.get(C(e)), n = o.get(C(e)), s = {
|
|
32
36
|
contentType: i.name,
|
|
33
37
|
documentId: String(e.documentId),
|
|
34
38
|
locale: String(e.locale),
|
|
35
|
-
title:
|
|
39
|
+
title: S(e)
|
|
36
40
|
};
|
|
37
41
|
n !== void 0 && n.status === "draft" ? r.push({
|
|
38
42
|
...s,
|
|
@@ -40,68 +44,72 @@ var g = (e, t, n, r, i = []) => e.query({
|
|
|
40
44
|
}) : t === void 0 ? r.push({
|
|
41
45
|
...s,
|
|
42
46
|
change: "new"
|
|
43
|
-
}) :
|
|
47
|
+
}) : x(u(i, e)) !== x(u(i, t)) && r.push({
|
|
44
48
|
...s,
|
|
45
49
|
change: "changed"
|
|
46
50
|
});
|
|
47
51
|
}
|
|
48
52
|
}
|
|
49
53
|
return r;
|
|
50
|
-
},
|
|
51
|
-
if (
|
|
54
|
+
}, T = async (e, n, r, i, a) => {
|
|
55
|
+
if (i.length === 0) return {
|
|
52
56
|
ok: !1,
|
|
53
57
|
reason: "nothingSelected",
|
|
54
58
|
items: []
|
|
55
59
|
};
|
|
56
|
-
let
|
|
57
|
-
if (
|
|
60
|
+
let o = await g(e, n, r), s = await w(e, n, r), c = new Map(s.map((e) => [`${e.contentType}\u0000${e.documentId}\u0000${e.locale}`, e])), l = i.filter((e) => !c.has(`${e.contentType}\u0000${e.documentId}\u0000${e.locale}`));
|
|
61
|
+
if (l.length > 0) return {
|
|
58
62
|
ok: !1,
|
|
59
63
|
reason: "notInPlan",
|
|
60
|
-
items:
|
|
64
|
+
items: l
|
|
61
65
|
};
|
|
62
|
-
let
|
|
63
|
-
if (
|
|
66
|
+
let _ = i.filter((e) => c.get(`${e.contentType}\u0000${e.documentId}\u0000${e.locale}`).change === "blocked");
|
|
67
|
+
if (_.length > 0) return {
|
|
64
68
|
ok: !1,
|
|
65
69
|
reason: "blocked",
|
|
66
|
-
items:
|
|
70
|
+
items: _
|
|
67
71
|
};
|
|
68
|
-
let
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
documentId
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
72
|
+
let y = new Map(n.map((e) => [e.name, e]));
|
|
73
|
+
return d(e, async () => {
|
|
74
|
+
let s = await m(e, {
|
|
75
|
+
name: a.name,
|
|
76
|
+
site: r.site,
|
|
77
|
+
environment: r.to
|
|
78
|
+
}), c = String(s.id);
|
|
79
|
+
for (let n of i) {
|
|
80
|
+
let i = y.get(n.contentType), [a] = await b(e, `${i.name}_published`, r.site, r.from, [v("documentId", n.documentId), v("locale", n.locale)]), s = {
|
|
81
|
+
site: r.site,
|
|
82
|
+
environment: r.to,
|
|
83
|
+
locale: n.locale
|
|
84
|
+
}, [l] = await b(e, `${i.name}_drafts`, r.site, r.to, [v("documentId", n.documentId), v("locale", n.locale)]);
|
|
85
|
+
if (o === null || a === void 0 || a.tenantId !== o.tenantId) throw new t({ reason: "scope" });
|
|
86
|
+
let d = u(i, a), m = await f(e, i, l === void 0 ? {
|
|
87
|
+
...d,
|
|
88
|
+
documentId: n.documentId
|
|
89
|
+
} : {
|
|
90
|
+
...d,
|
|
91
|
+
id: l.id
|
|
92
|
+
}, s);
|
|
93
|
+
await p(e, c, {
|
|
94
|
+
type: i,
|
|
95
|
+
id: String(m.id),
|
|
96
|
+
locale: n.locale,
|
|
97
|
+
revisionId: String(m.revisionId)
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
return await h(e, n, c), {
|
|
101
|
+
ok: !0,
|
|
102
|
+
releaseId: c,
|
|
103
|
+
promoted: i.length
|
|
104
|
+
};
|
|
105
|
+
});
|
|
106
|
+
}, E = [
|
|
107
|
+
i,
|
|
100
108
|
n,
|
|
101
|
-
|
|
102
|
-
|
|
109
|
+
r,
|
|
110
|
+
c,
|
|
103
111
|
o,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
export {
|
|
112
|
+
s,
|
|
113
|
+
a
|
|
114
|
+
], D = (...e) => l(() => w(...e), ...E), O = (...n) => l(() => T(...n), ...E, t, e);
|
|
115
|
+
export { w as planPromotion, D as planPromotionEffect, T as promote, O as promoteEffect };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { encodeCanonicalPathSegment as e } from "./pathSegmentEncoding.js";
|
|
2
|
+
// src/publicBuild.ts
|
|
3
|
+
var t = class extends Error {
|
|
4
|
+
reason;
|
|
5
|
+
_tag = "CmsPublicBuildUnavailable";
|
|
6
|
+
constructor(e) {
|
|
7
|
+
super("Public build unavailable: " + e), this.reason = e;
|
|
8
|
+
}
|
|
9
|
+
}, n = (e) => {
|
|
10
|
+
throw new t(e);
|
|
11
|
+
}, r = (e) => typeof e == "string" && /^[a-f0-9]{64}$/.test(e), i = (e) => {
|
|
12
|
+
if (typeof e != "object" || !e || Array.isArray(e)) return n("identity");
|
|
13
|
+
let t = e;
|
|
14
|
+
return Object.keys(t).sort().join(",") !== "executionId,inputsId,snapshotDigest,version" || t.version !== 1 || !r(t.snapshotDigest) || !r(t.inputsId) || !r(t.executionId) ? n("identity") : {
|
|
15
|
+
version: 1,
|
|
16
|
+
snapshotDigest: t.snapshotDigest,
|
|
17
|
+
inputsId: t.inputsId,
|
|
18
|
+
executionId: t.executionId
|
|
19
|
+
};
|
|
20
|
+
}, a = (e) => {
|
|
21
|
+
let t = i(e);
|
|
22
|
+
return [
|
|
23
|
+
"1",
|
|
24
|
+
t.snapshotDigest,
|
|
25
|
+
t.inputsId,
|
|
26
|
+
t.executionId
|
|
27
|
+
].join(".");
|
|
28
|
+
}, o = (e) => {
|
|
29
|
+
if (typeof e != "string" || !/^1\.[a-f0-9]{64}\.[a-f0-9]{64}\.[a-f0-9]{64}$/.test(e)) return n("identity");
|
|
30
|
+
let [, t, r, a] = e.split(".");
|
|
31
|
+
return i({
|
|
32
|
+
version: 1,
|
|
33
|
+
snapshotDigest: t,
|
|
34
|
+
inputsId: r,
|
|
35
|
+
executionId: a
|
|
36
|
+
});
|
|
37
|
+
}, s = (e = globalThis.document) => {
|
|
38
|
+
if (e === void 0) return null;
|
|
39
|
+
let t = e.querySelectorAll("meta[name=\"voltro:cms-build\"]");
|
|
40
|
+
return t.length === 0 ? null : t.length === 1 ? o(t[0].getAttribute("content") ?? "") : n("identity");
|
|
41
|
+
}, c = (e) => `<meta name="voltro:cms-build" content="${a(e)}" />`, l = (t) => {
|
|
42
|
+
if (typeof t != "string" || t.length > 4096 || !t.startsWith("/") || t.startsWith("//") || /[\\?#\x00-\x20\x7f]/.test(t) || t.slice(1).includes("//")) return n("request");
|
|
43
|
+
try {
|
|
44
|
+
if (new URL(t, "https://captured.invalid").pathname !== t) return n("request");
|
|
45
|
+
let r = t.split("/").map((t) => {
|
|
46
|
+
let r = decodeURIComponent(t).normalize("NFC");
|
|
47
|
+
return /[\\/\x00-\x1f\x7f]/.test(r) || r === "." || r === ".." ? n("request") : e(r);
|
|
48
|
+
}).join("/").replace(/\/$/, "") || "/";
|
|
49
|
+
return r.length > 4096 ? n("request") : r;
|
|
50
|
+
} catch {
|
|
51
|
+
return n("request");
|
|
52
|
+
}
|
|
53
|
+
}, u = async (e, t, r = {}) => {
|
|
54
|
+
let o = i(e), s = l(t), c = new URLSearchParams({
|
|
55
|
+
build: a(o),
|
|
56
|
+
path: s
|
|
57
|
+
}), u;
|
|
58
|
+
try {
|
|
59
|
+
u = await (r.fetch ?? globalThis.fetch)("/v1/cms/public-build/page?" + c, {
|
|
60
|
+
method: "GET",
|
|
61
|
+
credentials: "same-origin",
|
|
62
|
+
cache: "no-store",
|
|
63
|
+
redirect: "error",
|
|
64
|
+
...r.signal === void 0 ? {} : { signal: r.signal }
|
|
65
|
+
});
|
|
66
|
+
} catch (e) {
|
|
67
|
+
if (r.signal?.aborted) throw e;
|
|
68
|
+
return n("transport");
|
|
69
|
+
}
|
|
70
|
+
if (u.status === 409) return n("changed");
|
|
71
|
+
if (u.status === 404) return n("not-found");
|
|
72
|
+
if (u.status === 403 || u.status === 410) return n("denied");
|
|
73
|
+
if (!u.ok || u.headers.get("content-type")?.split(";", 1)[0] !== "application/json") return n("transport");
|
|
74
|
+
let d;
|
|
75
|
+
try {
|
|
76
|
+
d = await u.json();
|
|
77
|
+
} catch {
|
|
78
|
+
return n("transport");
|
|
79
|
+
}
|
|
80
|
+
if (typeof d != "object" || !d || Array.isArray(d)) return n("request");
|
|
81
|
+
let f = d;
|
|
82
|
+
return Object.keys(f).sort().join(",") !== "build,page,path,version" || f.version !== 1 || f.path !== s || a(i(f.build)) !== a(o) ? n("changed") : {
|
|
83
|
+
version: 1,
|
|
84
|
+
build: o,
|
|
85
|
+
path: s,
|
|
86
|
+
page: f.page
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
export { t as CmsPublicBuildUnavailable, l as canonicalCmsPublicPath, c as cmsPublicBuildMeta, i as copyCmsPublicBuildIdentity, o as decodeCmsPublicBuildIdentity, a as encodeCmsPublicBuildIdentity, u as loadCmsPublicBuildPage, s as readCmsPublicBuildIdentity };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { CmsPublicBuildUnavailable as e, decodeCmsPublicBuildIdentity as t } from "./publicBuild.js";
|
|
2
|
+
import { Effect as n, Schema as r } from "effect";
|
|
3
|
+
import { defineQuery as i } from "@voltro/protocol";
|
|
4
|
+
import { RestRouteError as a, projectedFailure as o, publicApiRoute as s, restError as c, restRoutesToHttpRoutes as l } from "@voltro/protocol/rest";
|
|
5
|
+
// src/publicBuildRest.ts
|
|
6
|
+
var u = {
|
|
7
|
+
"cache-control": "private, no-store",
|
|
8
|
+
pragma: "no-cache",
|
|
9
|
+
vary: "Cookie"
|
|
10
|
+
}, d = r.Struct({
|
|
11
|
+
version: r.Literal(1),
|
|
12
|
+
snapshotDigest: r.String,
|
|
13
|
+
inputsId: r.String,
|
|
14
|
+
executionId: r.String
|
|
15
|
+
}), f = r.Struct({
|
|
16
|
+
build: r.String,
|
|
17
|
+
path: r.String
|
|
18
|
+
}), p = {
|
|
19
|
+
identity: 400,
|
|
20
|
+
request: 400,
|
|
21
|
+
changed: 409,
|
|
22
|
+
"not-found": 404,
|
|
23
|
+
denied: 410,
|
|
24
|
+
transport: 503
|
|
25
|
+
}, m = i({
|
|
26
|
+
name: "cms.publicBuildPage",
|
|
27
|
+
input: f,
|
|
28
|
+
output: r.Struct({
|
|
29
|
+
version: r.Literal(1),
|
|
30
|
+
build: d,
|
|
31
|
+
path: r.String,
|
|
32
|
+
page: r.Unknown
|
|
33
|
+
}),
|
|
34
|
+
error: r.Struct({
|
|
35
|
+
_tag: r.Literal("CmsPublicBuildUnavailable"),
|
|
36
|
+
reason: r.Literals([
|
|
37
|
+
"identity",
|
|
38
|
+
"request",
|
|
39
|
+
"changed",
|
|
40
|
+
"not-found",
|
|
41
|
+
"denied",
|
|
42
|
+
"transport"
|
|
43
|
+
])
|
|
44
|
+
}),
|
|
45
|
+
openAccess: "Anonymous presentation from the current independently admitted public output marker. Private read credentials never grant this endpoint.",
|
|
46
|
+
publicApi: {
|
|
47
|
+
method: "GET",
|
|
48
|
+
path: "/v1/cms/public-build/page",
|
|
49
|
+
security: !1,
|
|
50
|
+
idempotent: !1,
|
|
51
|
+
operationId: "cmsPublicBuildPage",
|
|
52
|
+
tags: ["CMS public builds"],
|
|
53
|
+
errorStatus: { CmsPublicBuildUnavailable: 409 },
|
|
54
|
+
additionalErrorStatuses: { CmsPublicBuildUnavailable: [...new Set(Object.values(p))].filter((e) => e !== 409) },
|
|
55
|
+
summary: "Read a current captured public page presentation",
|
|
56
|
+
description: "Exact public build selector, admitted request host and canonical path. Active generation, region, output membership, current rights and monotone denies are checked. No live fallback; private no-store including errors."
|
|
57
|
+
}
|
|
58
|
+
}), h = (t) => {
|
|
59
|
+
let n = o(new e(t), m, { errorStatus: { CmsPublicBuildUnavailable: p[t] } });
|
|
60
|
+
throw n instanceof a ? c(n.status, n.body, u) : n;
|
|
61
|
+
}, g = (e, r) => {
|
|
62
|
+
let i = [s(m, async (i, a) => {
|
|
63
|
+
let o = i;
|
|
64
|
+
[...new URLSearchParams(a.query).keys()].sort().join(",") !== "build,path" && h("request");
|
|
65
|
+
let s = (() => {
|
|
66
|
+
try {
|
|
67
|
+
return t(o.build);
|
|
68
|
+
} catch {
|
|
69
|
+
return h("identity");
|
|
70
|
+
}
|
|
71
|
+
})(), c = r.choices?.(a.headers), l = await n.runPromise(n.result(e.page({
|
|
72
|
+
build: s,
|
|
73
|
+
path: o.path,
|
|
74
|
+
host: r.host(a.headers),
|
|
75
|
+
...c === void 0 ? {} : { choices: c }
|
|
76
|
+
})));
|
|
77
|
+
if (l._tag === "Success") return l.success;
|
|
78
|
+
h(l.failure.reason);
|
|
79
|
+
})];
|
|
80
|
+
return {
|
|
81
|
+
routes: i,
|
|
82
|
+
httpRoutes: l(i).map((e) => ({
|
|
83
|
+
...e,
|
|
84
|
+
handle: async (...t) => {
|
|
85
|
+
let n = await e.handle(...t);
|
|
86
|
+
return {
|
|
87
|
+
...n,
|
|
88
|
+
headers: {
|
|
89
|
+
...n.headers,
|
|
90
|
+
...u
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
}))
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
export { g as cmsPublicBuildRest };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { normalizeHost as e } from "./domainHost.js";
|
|
2
|
+
import { OutputActivationUnavailable as t } from "./outputActivation.js";
|
|
3
|
+
import { CmsPublicBuildUnavailable as n, canonicalCmsPublicPath as r, copyCmsPublicBuildIdentity as i, encodeCmsPublicBuildIdentity as a } from "./publicBuild.js";
|
|
4
|
+
import { readActiveOutput as o } from "./outputActivationStore.js";
|
|
5
|
+
import { copyPublicConsentChoices as s, selectPublicPresentation as c } from "./publicPresentation.js";
|
|
6
|
+
import { Effect as l } from "effect";
|
|
7
|
+
// src/publicBuildService.ts
|
|
8
|
+
var u = (u) => {
|
|
9
|
+
let d = { ...u.scope }, f = u.keys.map((e) => ({
|
|
10
|
+
id: e.id,
|
|
11
|
+
material: new Uint8Array(e.material)
|
|
12
|
+
})), p = Object.fromEntries(Object.entries(u.regionKeys).map(([e, t]) => [e, t.map((e) => ({
|
|
13
|
+
id: e.id,
|
|
14
|
+
material: new Uint8Array(e.material)
|
|
15
|
+
}))])), m = u.region, h = u.admit, g = u.readPage, _ = u.store;
|
|
16
|
+
return { page: (v) => l.tryPromise({
|
|
17
|
+
try: async () => {
|
|
18
|
+
let t = i(v.build), l = e(v.host), y = r(v.path), b = s(v.choices);
|
|
19
|
+
if (l !== v.host) throw new n("request");
|
|
20
|
+
return _.transactional(async (e) => {
|
|
21
|
+
let r;
|
|
22
|
+
if (await o(e, d, {
|
|
23
|
+
kind: "url",
|
|
24
|
+
url: "https://" + l + y
|
|
25
|
+
}, {
|
|
26
|
+
keys: f,
|
|
27
|
+
regionKeys: p,
|
|
28
|
+
region: m,
|
|
29
|
+
lock: "share",
|
|
30
|
+
admit: async (e, i, o, s) => {
|
|
31
|
+
let d = {
|
|
32
|
+
version: 1,
|
|
33
|
+
snapshotDigest: i.manifest.snapshot.digest,
|
|
34
|
+
inputsId: i.manifest.app.inputsId,
|
|
35
|
+
executionId: i.manifest.app.executionId
|
|
36
|
+
};
|
|
37
|
+
if (a(d) !== a(t)) throw new n("changed");
|
|
38
|
+
if (!i.manifest.paths.some((e) => e.host === l)) throw new n("not-found");
|
|
39
|
+
await h(e, i, o, s);
|
|
40
|
+
let f = c(await u.readPresentations(e, i, s), b), p = await g(e, i, s, {
|
|
41
|
+
host: l,
|
|
42
|
+
path: y,
|
|
43
|
+
presentation: f
|
|
44
|
+
});
|
|
45
|
+
if (!p.found) throw new n("not-found");
|
|
46
|
+
let m = JSON.stringify(p.page);
|
|
47
|
+
if (m === void 0 || Buffer.byteLength(m) > 4194304) throw new n("transport");
|
|
48
|
+
await h(e, i, o, s), r = {
|
|
49
|
+
version: 1,
|
|
50
|
+
build: t,
|
|
51
|
+
path: y,
|
|
52
|
+
page: JSON.parse(m)
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}) === null || r === void 0) throw new n("not-found");
|
|
56
|
+
return r;
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
catch: (e) => e instanceof n ? e : e instanceof t ? new n(e.reason === "denied" ? "denied" : "changed") : new n("transport")
|
|
60
|
+
}) };
|
|
61
|
+
};
|
|
62
|
+
export { u as createCmsPublicBuilds };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { canonicalCmsPublicPath as e } from "./publicBuild.js";
|
|
2
|
+
import { Effect as t } from "effect";
|
|
3
|
+
import { storageByteSecurityHeaders as n } from "@voltro/plugin-storage/byte-security";
|
|
4
|
+
// src/publicOutputHttp.ts
|
|
5
|
+
var r = (r, i) => {
|
|
6
|
+
if (i.redirects && r.redirect === void 0) throw Error("Missing public redirect service");
|
|
7
|
+
let a = [
|
|
8
|
+
...i.documents.map((e) => ({
|
|
9
|
+
...e,
|
|
10
|
+
kind: "document"
|
|
11
|
+
})),
|
|
12
|
+
{
|
|
13
|
+
path: "/__voltro/media",
|
|
14
|
+
match: "prefix",
|
|
15
|
+
kind: "asset"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
path: "/__voltro/web",
|
|
19
|
+
match: "prefix",
|
|
20
|
+
kind: "asset"
|
|
21
|
+
},
|
|
22
|
+
...i.controls ? [
|
|
23
|
+
{
|
|
24
|
+
path: "/sitemap.xml",
|
|
25
|
+
match: "exact",
|
|
26
|
+
kind: "control"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
path: "/robots.txt",
|
|
30
|
+
match: "exact",
|
|
31
|
+
kind: "control"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
path: "/sitemaps",
|
|
35
|
+
match: "prefix",
|
|
36
|
+
kind: "control"
|
|
37
|
+
}
|
|
38
|
+
] : []
|
|
39
|
+
];
|
|
40
|
+
if (a.some((t) => e(t.path) !== t.path) || new Set(a.map((e) => e.path)).size !== a.length) throw Error("Invalid public output mounts");
|
|
41
|
+
return a.map((e) => ({
|
|
42
|
+
path: e.path,
|
|
43
|
+
match: e.match,
|
|
44
|
+
method: "GET",
|
|
45
|
+
answersOtherMethods: !0,
|
|
46
|
+
handle: async (a) => {
|
|
47
|
+
let o = {
|
|
48
|
+
"cache-control": "private, no-store",
|
|
49
|
+
pragma: "no-cache",
|
|
50
|
+
...e.kind === "control" ? {} : { vary: "Cookie" },
|
|
51
|
+
"x-content-type-options": "nosniff"
|
|
52
|
+
};
|
|
53
|
+
if (a.method !== "GET" && a.method !== "HEAD" && !(i.redirects && e.kind === "document")) return {
|
|
54
|
+
status: 405,
|
|
55
|
+
headers: {
|
|
56
|
+
...o,
|
|
57
|
+
allow: "GET, HEAD"
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
let s, c;
|
|
61
|
+
try {
|
|
62
|
+
s = i.host(a.headers), c = e.kind === "control" ? void 0 : i.choices?.(a.headers);
|
|
63
|
+
} catch {
|
|
64
|
+
return {
|
|
65
|
+
status: 400,
|
|
66
|
+
headers: o
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
if (i.redirects && e.kind === "document" && r.redirect !== void 0) {
|
|
70
|
+
let e = await t.runPromise(t.result(r.redirect({
|
|
71
|
+
host: s,
|
|
72
|
+
path: a.path,
|
|
73
|
+
...c === void 0 ? {} : { choices: c }
|
|
74
|
+
})));
|
|
75
|
+
if (e._tag === "Success") {
|
|
76
|
+
let t = e.success;
|
|
77
|
+
return {
|
|
78
|
+
status: t.status,
|
|
79
|
+
headers: {
|
|
80
|
+
...o,
|
|
81
|
+
...t.location === null ? {} : { location: t.location },
|
|
82
|
+
"content-length": "0"
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
let n = e.failure.reason;
|
|
87
|
+
if (n !== "not-found") return {
|
|
88
|
+
status: n === "request" || n === "identity" ? 400 : n === "denied" ? 410 : n === "changed" ? 409 : 503,
|
|
89
|
+
headers: o
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
if (a.method !== "GET" && a.method !== "HEAD") return {
|
|
93
|
+
status: 405,
|
|
94
|
+
headers: {
|
|
95
|
+
...o,
|
|
96
|
+
allow: "GET, HEAD"
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
let l = e.kind === "control" ? r.control({
|
|
100
|
+
host: s,
|
|
101
|
+
path: a.path
|
|
102
|
+
}) : r[e.kind]({
|
|
103
|
+
host: s,
|
|
104
|
+
path: a.path,
|
|
105
|
+
...c === void 0 ? {} : { choices: c }
|
|
106
|
+
}), u = await t.runPromise(t.result(l));
|
|
107
|
+
if (u._tag === "Failure") {
|
|
108
|
+
let e = u.failure.reason;
|
|
109
|
+
return {
|
|
110
|
+
status: e === "request" || e === "identity" ? 400 : e === "not-found" ? 404 : e === "denied" ? 410 : e === "changed" ? 409 : 503,
|
|
111
|
+
headers: o
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
let d = u.success;
|
|
115
|
+
return {
|
|
116
|
+
status: 200,
|
|
117
|
+
headers: {
|
|
118
|
+
...o,
|
|
119
|
+
...e.path === "/__voltro/media" ? n(d.contentType) : {},
|
|
120
|
+
"content-length": String(d.bytes.byteLength)
|
|
121
|
+
},
|
|
122
|
+
contentType: d.contentType,
|
|
123
|
+
...a.method === "HEAD" ? {} : { body: d.bytes }
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
}));
|
|
127
|
+
};
|
|
128
|
+
export { r as cmsPublicOutputHttp };
|