@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
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { consentDecisionComplete as e, grantedPurposes as t } from "./consent.js";
|
|
2
|
+
import { Schema as n } from "effect";
|
|
3
|
+
// src/snapshotPresentation.ts
|
|
4
|
+
var r = class extends n.TaggedError()("SnapshotPresentationUnavailable", { reason: n.Literals([
|
|
5
|
+
"policy",
|
|
6
|
+
"selection",
|
|
7
|
+
"bounds"
|
|
8
|
+
]) }) {}, i = (e) => {
|
|
9
|
+
throw new r({ reason: e });
|
|
10
|
+
}, a = (e) => typeof e == "object" && !!e && !Array.isArray(e), o = (e) => typeof e == "string" && e.length > 0 && e.length <= 128 && !/[\x00-\x1f\x7f]/.test(e), s = (e, t) => {
|
|
11
|
+
if (!a(e) || Object.keys(e).sort().join(",") !== "id,version" || !o(e.id) || !Number.isSafeInteger(e.version) || Number(e.version) < 1) return i(t);
|
|
12
|
+
try {
|
|
13
|
+
encodeURIComponent(e.id);
|
|
14
|
+
} catch {
|
|
15
|
+
return i(t);
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
id: e.id,
|
|
19
|
+
version: Number(e.version)
|
|
20
|
+
};
|
|
21
|
+
}, c = (e) => {
|
|
22
|
+
if (!Array.isArray(e) || e.length > 32) return i("policy");
|
|
23
|
+
let t = e.map((e) => s(e, "policy"));
|
|
24
|
+
return new Set(t.map((e) => e.id)).size === t.length ? t.sort((e, t) => e.id < t.id ? -1 : +(e.id > t.id)) : i("policy");
|
|
25
|
+
}, l = (e) => {
|
|
26
|
+
if (e === void 0) return {
|
|
27
|
+
version: 1,
|
|
28
|
+
decided: !1,
|
|
29
|
+
granted: []
|
|
30
|
+
};
|
|
31
|
+
if (!a(e) || Object.keys(e).sort().join(",") !== "decided,granted,version" || e.version !== 1 || typeof e.decided != "boolean" || !Array.isArray(e.granted) || e.granted.length > 32) return i("selection");
|
|
32
|
+
let t = e.granted.map((e) => s(e, "selection")).sort((e, t) => e.id < t.id ? -1 : +(e.id > t.id));
|
|
33
|
+
return new Set(t.map((e) => e.id)).size === t.length ? {
|
|
34
|
+
version: 1,
|
|
35
|
+
decided: e.decided,
|
|
36
|
+
granted: t
|
|
37
|
+
} : i("selection");
|
|
38
|
+
}, u = (e, t) => {
|
|
39
|
+
let n = c(e), r = l(t);
|
|
40
|
+
return n.length === 0 && r.decided || n.length > 0 && !r.decided && r.granted.length === n.length || r.granted.some((e) => !n.some((t) => t.id === e.id && t.version === e.version)) ? i("selection") : r;
|
|
41
|
+
}, d = (n, r) => {
|
|
42
|
+
let o = c(n);
|
|
43
|
+
if (r === void 0 || o.length === 0) return u(o, void 0);
|
|
44
|
+
if (!a(r)) return i("selection");
|
|
45
|
+
let s = Object.fromEntries(Object.entries(r)), l = t(o, s);
|
|
46
|
+
return {
|
|
47
|
+
version: 1,
|
|
48
|
+
decided: e(o, s),
|
|
49
|
+
granted: o.filter((e) => l.has(e.id))
|
|
50
|
+
};
|
|
51
|
+
}, f = (e, t) => {
|
|
52
|
+
let n = "1." + encodeURIComponent(JSON.stringify(u(e, t)));
|
|
53
|
+
return n.length > 32768 ? i("bounds") : n;
|
|
54
|
+
}, p = (e, t) => {
|
|
55
|
+
if (typeof t != "string" || t.length > 32768 || !t.startsWith("1.")) return i("selection");
|
|
56
|
+
let n;
|
|
57
|
+
try {
|
|
58
|
+
n = JSON.parse(decodeURIComponent(t.slice(2)));
|
|
59
|
+
} catch {
|
|
60
|
+
return i("selection");
|
|
61
|
+
}
|
|
62
|
+
let r = u(e, n);
|
|
63
|
+
return f(e, r) === t ? r : i("selection");
|
|
64
|
+
}, m = (e, t = 65) => {
|
|
65
|
+
let n = c(e);
|
|
66
|
+
if (!Number.isSafeInteger(t) || t < 1 || t > 257) return i("bounds");
|
|
67
|
+
let r = u(n, void 0);
|
|
68
|
+
if (n.length === 0) return [r];
|
|
69
|
+
let a = 2 ** n.length;
|
|
70
|
+
if (2 * a - 1 > t) return i("bounds");
|
|
71
|
+
let o = Array.from({ length: a }, (e, t) => ({
|
|
72
|
+
version: 1,
|
|
73
|
+
decided: !0,
|
|
74
|
+
granted: n.filter((e, n) => !!(t & 1 << n))
|
|
75
|
+
}));
|
|
76
|
+
return [
|
|
77
|
+
r,
|
|
78
|
+
...o,
|
|
79
|
+
...o.slice(1, -1).map((e) => ({
|
|
80
|
+
...e,
|
|
81
|
+
decided: !1
|
|
82
|
+
}))
|
|
83
|
+
];
|
|
84
|
+
};
|
|
85
|
+
export { r as SnapshotPresentationUnavailable, u as admitSnapshotPresentation, c as copySnapshotConsentPurposes, l as copySnapshotPresentationValue, p as decodeSnapshotPresentation, f as encodeSnapshotPresentation, d as snapshotPresentationFromChoices, m as snapshotPresentations };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { readVerifiedSnapshotResource as e } from "./buildSnapshot.js";
|
|
2
|
+
import { SnapshotPresentationUnavailable as t, copySnapshotConsentPurposes as n } from "./snapshotPresentation.js";
|
|
3
|
+
import { createHash as r } from "node:crypto";
|
|
4
|
+
import { canonicalJson as i } from "@voltro/runtime";
|
|
5
|
+
// src/snapshotPresentationPolicy.ts
|
|
6
|
+
var a = async (a, o, s, c) => {
|
|
7
|
+
let l = await e(a, o, s, "policies", "configuration"), u = (await e(a, o, s, "policies", "registry")).value, d = l.value, f = r("sha256").update(i(l)).digest("hex");
|
|
8
|
+
if (s.manifest.parts.find((e) => e.part === "policies")?.format !== "voltro.cms.public-access/v2" || Object.keys(d).sort().join(",") !== "app,consentPurposes,version" || d.version !== 2 || u.version !== 2 || u.consentDigest !== f || i(d.app) !== i(c) || i(u.app) !== i(c)) throw new t({ reason: "policy" });
|
|
9
|
+
return n(d.consentPurposes);
|
|
10
|
+
};
|
|
11
|
+
export { a as readCapturedSnapshotConsentPurposes };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { defineContentLocations as e } from "./contentLocations.js";
|
|
2
|
+
import { copySnapshotResource as t } from "./buildSnapshot.js";
|
|
3
|
+
import { copySnapshotAppCodePin as n, snapshotContentTypeDefinition as r } from "./snapshotDefinitions.js";
|
|
4
|
+
import { defineContentProjection as i } from "./contentProjection.js";
|
|
5
|
+
import { Schema as a } from "effect";
|
|
6
|
+
import { createHash as o } from "node:crypto";
|
|
7
|
+
import { canonicalJson as s } from "@voltro/runtime";
|
|
8
|
+
// src/snapshotProjection.ts
|
|
9
|
+
var c = class extends a.TaggedError()("SnapshotProjectionUnavailable", { reason: a.Literals([
|
|
10
|
+
"definition",
|
|
11
|
+
"scope",
|
|
12
|
+
"binding",
|
|
13
|
+
"unconfigured",
|
|
14
|
+
"publication"
|
|
15
|
+
]) }) {}, l = (e) => {
|
|
16
|
+
throw new c({ reason: e });
|
|
17
|
+
}, u = (e) => o("sha256").update(s(e)).digest("hex"), d = (n, r) => {
|
|
18
|
+
if (n === void 0) return {};
|
|
19
|
+
let i;
|
|
20
|
+
try {
|
|
21
|
+
i = t({
|
|
22
|
+
key: "trees",
|
|
23
|
+
value: n
|
|
24
|
+
}).value;
|
|
25
|
+
} catch {
|
|
26
|
+
return l("definition");
|
|
27
|
+
}
|
|
28
|
+
let a = Object.entries(i);
|
|
29
|
+
return a.length > 16 ? l("definition") : Object.fromEntries(a.sort(([e], [t]) => e < t ? -1 : +(e > t)).map(([t, n]) => {
|
|
30
|
+
if (!/^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(t) || typeof n != "object" || !n || Array.isArray(n)) return l("definition");
|
|
31
|
+
let i = n;
|
|
32
|
+
if (Object.keys(i).some((e) => ![
|
|
33
|
+
"contentType",
|
|
34
|
+
"mappingId",
|
|
35
|
+
"fields",
|
|
36
|
+
"includeField"
|
|
37
|
+
].includes(e))) return l("definition");
|
|
38
|
+
let a = r.find((e) => e.name === i.contentType);
|
|
39
|
+
if (a?.tree === void 0 || typeof i.mappingId != "string" || !e(a.locations ?? []).some((e) => e.id === i.mappingId) || !Array.isArray(i.fields) || i.fields.length === 0 || i.fields.length > 64 || new Set(i.fields).size !== i.fields.length) return l("definition");
|
|
40
|
+
let o = [];
|
|
41
|
+
for (let e of i.fields) {
|
|
42
|
+
if (typeof e != "string" || !Object.hasOwn(a.fields, e) || ![
|
|
43
|
+
"string",
|
|
44
|
+
"number",
|
|
45
|
+
"boolean",
|
|
46
|
+
"date",
|
|
47
|
+
"datetime",
|
|
48
|
+
"literal"
|
|
49
|
+
].includes(a.fields[e].kind)) return l("definition");
|
|
50
|
+
o.push(e);
|
|
51
|
+
}
|
|
52
|
+
let s = i.includeField;
|
|
53
|
+
return s !== void 0 && (typeof s != "string" || !Object.hasOwn(a.fields, s) || a.fields[s].kind !== "boolean") ? l("definition") : [t, {
|
|
54
|
+
contentType: a.name,
|
|
55
|
+
mappingId: i.mappingId,
|
|
56
|
+
fields: o.sort(),
|
|
57
|
+
...s === void 0 ? {} : { includeField: s }
|
|
58
|
+
}];
|
|
59
|
+
}));
|
|
60
|
+
}, f = (e, t) => e === void 0 ? [] : !Array.isArray(e) || e.length > 64 || e.some((e) => typeof e != "string" || !t.includes(e)) || new Set(e).size !== e.length ? l("definition") : [...e].sort(), p = (e, n) => {
|
|
61
|
+
if (e === void 0) return {};
|
|
62
|
+
let r;
|
|
63
|
+
try {
|
|
64
|
+
r = t({
|
|
65
|
+
key: "referenceRoutes",
|
|
66
|
+
value: e
|
|
67
|
+
}).value;
|
|
68
|
+
} catch {
|
|
69
|
+
return l("definition");
|
|
70
|
+
}
|
|
71
|
+
let i = Object.entries(r);
|
|
72
|
+
return i.length > 64 || i.some(([e, t]) => !n.includes(e) || typeof t != "string" || !/^[A-Za-z][A-Za-z0-9_.-]{0,63}$/.test(t)) ? l("definition") : Object.fromEntries(i.sort(([e], [t]) => e < t ? -1 : +(e > t)));
|
|
73
|
+
}, m = (a, o, s) => {
|
|
74
|
+
let c = n(o);
|
|
75
|
+
if (!/^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(s.id) || a.length === 0 || new Set(a.map((e) => e.name)).size !== a.length) return l("definition");
|
|
76
|
+
let m = t({
|
|
77
|
+
key: "definitions",
|
|
78
|
+
value: s.definitions
|
|
79
|
+
}).value;
|
|
80
|
+
if (Object.keys(m).length !== a.length || Object.keys(m).some((e) => !a.some((t) => t.name === e))) return l("definition");
|
|
81
|
+
let h = [...a].sort((e, t) => e.name < t.name ? -1 : +(e.name > t.name)).map((e) => {
|
|
82
|
+
let n = m[e.name], a = n === null ? null : i(n);
|
|
83
|
+
return a !== null && Object.keys(a.fields).some((t) => !Object.hasOwn(e.fields, t)) ? l("definition") : t({
|
|
84
|
+
key: `type:${e.name}`,
|
|
85
|
+
value: {
|
|
86
|
+
version: 1,
|
|
87
|
+
app: c,
|
|
88
|
+
contentType: e.name,
|
|
89
|
+
definition: a,
|
|
90
|
+
schemaDigest: u(r(e, c).value)
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}), g = f(s.referenceTypes, a.map((e) => e.name));
|
|
94
|
+
if (g.some((e) => !Object.hasOwn(m, e) || m[e] === null)) return l("definition");
|
|
95
|
+
let _ = p(s.referenceRoutes, a.map((e) => e.name)), v = d(s.trees, a);
|
|
96
|
+
for (let [t, n] of Object.entries(_)) if (!e(a.find((e) => e.name === t).locations ?? []).some((e) => e.id === n)) return l("definition");
|
|
97
|
+
let y = t({
|
|
98
|
+
key: "registry",
|
|
99
|
+
value: {
|
|
100
|
+
version: 1,
|
|
101
|
+
app: c,
|
|
102
|
+
id: s.id,
|
|
103
|
+
...g.length === 0 ? {} : { referenceTypes: g },
|
|
104
|
+
...Object.keys(_).length === 0 ? {} : { referenceRoutes: _ },
|
|
105
|
+
...Object.keys(v).length === 0 ? {} : { trees: v },
|
|
106
|
+
definitionDigest: u(h),
|
|
107
|
+
types: h.map((e) => e.value.contentType)
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
return {
|
|
111
|
+
format: "voltro.cms.field-projection/v1",
|
|
112
|
+
entries: function* () {
|
|
113
|
+
yield t(y);
|
|
114
|
+
for (let e of h) yield t(e);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
export { c as SnapshotProjectionUnavailable, p as copySnapshotReferenceRoutes, f as copySnapshotReferenceTypes, d as copySnapshotTrees, m as snapshotProjectionSource };
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { compileSiteDelivery as e } from "./siteDelivery.js";
|
|
2
|
+
import { readCapturedDocument as t, verifyPublicationState as n } from "./publicationState.js";
|
|
3
|
+
import { copySnapshotResource as r, readVerifiedSnapshotResource as i, verifyBuildSnapshot as a } from "./buildSnapshot.js";
|
|
4
|
+
import { copySnapshotAppCodePin as o, snapshotContentTypeDefinition as s } from "./snapshotDefinitions.js";
|
|
5
|
+
import { copySnapshotConsentPurposes as c } from "./snapshotPresentation.js";
|
|
6
|
+
import { Schema as l } from "effect";
|
|
7
|
+
import { createHash as u } from "node:crypto";
|
|
8
|
+
import { canonicalJson as d } from "@voltro/runtime";
|
|
9
|
+
// src/snapshotPublicAccess.ts
|
|
10
|
+
var f = class extends l.TaggedError()("SnapshotPublicAccessUnavailable", { reason: l.Literals([
|
|
11
|
+
"definition",
|
|
12
|
+
"binding",
|
|
13
|
+
"scope",
|
|
14
|
+
"publication",
|
|
15
|
+
"bounds"
|
|
16
|
+
]) }) {}, p = (e) => {
|
|
17
|
+
throw new f({ reason: e });
|
|
18
|
+
}, m = (e) => u("sha256").update(d(e)).digest("hex"), h = (e) => typeof e == "object" && !!e && !Array.isArray(e), g = (e) => typeof e == "string" && e.length > 0 && e.length <= 256 && !/[\x00-\x1f\x7f]/.test(e), _ = (e) => h(e) ? e.kind === "public" || e.kind === "deny" ? Object.keys(e).length === 1 ? { kind: e.kind } : p("definition") : e.kind !== "field" || Object.keys(e).length !== 4 || !g(e.field) || !Array.isArray(e.values) || e.values.length === 0 || e.values.length > 64 || !e.values.every(g) || new Set(e.values).size !== e.values.length || e.missing !== "public" && e.missing !== "deny" ? p("definition") : {
|
|
19
|
+
kind: "field",
|
|
20
|
+
field: e.field,
|
|
21
|
+
values: [...e.values].sort(),
|
|
22
|
+
missing: e.missing
|
|
23
|
+
} : p("definition"), v = (e, t) => {
|
|
24
|
+
if (e.kind !== "field") return;
|
|
25
|
+
let n = Object.hasOwn(t, e.field) ? t[e.field] : void 0;
|
|
26
|
+
if (!h(n) || !["string", "literal"].includes(String(n.kind))) return p("definition");
|
|
27
|
+
let r = n.literals;
|
|
28
|
+
if (n.kind === "literal" && (!Array.isArray(r) || e.values.some((e) => !r.includes(e)))) return p("definition");
|
|
29
|
+
}, y = (e, t, n, i = []) => {
|
|
30
|
+
let a = o(t), l = r({
|
|
31
|
+
key: "configuration",
|
|
32
|
+
value: {
|
|
33
|
+
version: 2,
|
|
34
|
+
app: a,
|
|
35
|
+
consentPurposes: c(i)
|
|
36
|
+
}
|
|
37
|
+
}), u = r({
|
|
38
|
+
key: "definitions",
|
|
39
|
+
value: n
|
|
40
|
+
}).value;
|
|
41
|
+
if (e.length === 0 || new Set(e.map((e) => e.name)).size !== e.length || Object.keys(u).length !== e.length || Object.keys(u).some((t) => !e.some((e) => e.name === t))) return p("definition");
|
|
42
|
+
let d = [...e].sort((e, t) => e.name < t.name ? -1 : +(e.name > t.name)).map((e) => {
|
|
43
|
+
let t = _(u[e.name]);
|
|
44
|
+
return v(t, e.fields), r({
|
|
45
|
+
key: `type:${e.name}`,
|
|
46
|
+
value: {
|
|
47
|
+
version: 1,
|
|
48
|
+
app: a,
|
|
49
|
+
contentType: e.name,
|
|
50
|
+
decision: t,
|
|
51
|
+
schemaDigest: m(s(e, a).value)
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}), f = r({
|
|
55
|
+
key: "registry",
|
|
56
|
+
value: {
|
|
57
|
+
version: 2,
|
|
58
|
+
app: a,
|
|
59
|
+
types: d.map((e) => e.value.contentType),
|
|
60
|
+
consentDigest: m(l),
|
|
61
|
+
definitionDigest: m([...d, l])
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
return {
|
|
65
|
+
format: "voltro.cms.public-access/v2",
|
|
66
|
+
entries: function* () {
|
|
67
|
+
yield r(f), yield r(l);
|
|
68
|
+
for (let e of d) yield r(e);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}, b = async (e, t, n, r, i, a, o = Date.now()) => x(e, t, n, r, { profile: i }, a, o), x = async (e, t, r, i, o, s, c) => {
|
|
72
|
+
if (![
|
|
73
|
+
i,
|
|
74
|
+
"profile" in o ? o.profile : o.exact,
|
|
75
|
+
s
|
|
76
|
+
].every(g)) return p("scope");
|
|
77
|
+
let l = await a(e, t, r, c);
|
|
78
|
+
return w(e, t, l, await n(e, t, l.manifest.publication, c), i, o, s, c);
|
|
79
|
+
}, S = async (e, t, n, r, i, a, o, s) => w(e, t, n, r, i, { profile: a }, o, s), C = async (e, t, n, r, i, a, o, s) => w(e, t, n, r, i, { exact: a }, o, s), w = async (n, r, a, o, s, c, l, u) => {
|
|
80
|
+
if (![
|
|
81
|
+
s,
|
|
82
|
+
"profile" in c ? c.profile : c.exact,
|
|
83
|
+
l
|
|
84
|
+
].every(g)) return p("scope");
|
|
85
|
+
for (let [e, t] of [
|
|
86
|
+
["policies", "voltro.cms.public-access/v2"],
|
|
87
|
+
["schema", "voltro.cms.schema/v1"],
|
|
88
|
+
["site", "voltro.cms.site/v3"],
|
|
89
|
+
["locales", "voltro.cms.locales/v1"]
|
|
90
|
+
]) if (a.manifest.parts.find((t) => t.part === e)?.format !== t) return p("binding");
|
|
91
|
+
if (!o.types.includes(s)) return p("scope");
|
|
92
|
+
let f = (await i(n, r, a, "policies", `type:${s}`)).value, y = (await i(n, r, a, "schema", `type:${s}`)).value, b = (await i(n, r, a, "site", "configuration")).value, x = (await i(n, r, a, "locales", "policy")).value;
|
|
93
|
+
if (f.version !== 1 || y.version !== 1 || b.version !== 3 || x.version !== 1 || f.contentType !== s || f.schemaDigest !== m(y) || [
|
|
94
|
+
f,
|
|
95
|
+
b,
|
|
96
|
+
x
|
|
97
|
+
].some((e) => d(e.app) !== d(y.app)) || [b, x].some((e) => e.tenantId !== r.tenantId || e.site !== r.site || e.environment !== r.environment) || !h(b.definition) || !h(x.definition) || x.resolution !== "per-node") return p("binding");
|
|
98
|
+
let S = e({
|
|
99
|
+
...b.definition,
|
|
100
|
+
...x.definition
|
|
101
|
+
}), C = {
|
|
102
|
+
contentLocales: S.contentLocales,
|
|
103
|
+
defaultLocale: S.defaultLocale,
|
|
104
|
+
sourceLocale: S.sourceLocale,
|
|
105
|
+
fallback: S.fallback,
|
|
106
|
+
prefixes: S.prefixes,
|
|
107
|
+
tags: S.tags,
|
|
108
|
+
directions: S.directions
|
|
109
|
+
};
|
|
110
|
+
if (S.definition.id !== r.site || !S.definition.environments.includes(r.environment) || [b, x].some((e) => e.definitionDigest !== m(S.definition)) || d(x.compiled) !== d(C) || o.locales.length !== S.contentLocales.length || o.locales.some((e) => !S.contentLocales.includes(e))) return p("binding");
|
|
111
|
+
let w = "profile" in c ? S.definition.locales.find((e) => e.id === c.profile && e.enabled)?.contentLocale : S.contentLocales.includes(c.exact) ? c.exact : void 0;
|
|
112
|
+
if (w === void 0) return p("scope");
|
|
113
|
+
let T = y.definition;
|
|
114
|
+
if (!h(T) || T.name !== s || !h(T.fields)) return p("binding");
|
|
115
|
+
let E = _(f.decision);
|
|
116
|
+
if (v(E, T.fields), E.kind === "deny") return null;
|
|
117
|
+
let D = T.tree, O;
|
|
118
|
+
if (D !== void 0) {
|
|
119
|
+
if (!h(D) || !g(D.parent)) return p("binding");
|
|
120
|
+
O = D.parent;
|
|
121
|
+
let e = T.fields[O];
|
|
122
|
+
if (!h(e) || e.kind !== "reference" || e.referenceType !== s) return p("binding");
|
|
123
|
+
}
|
|
124
|
+
let k = [], A = /* @__PURE__ */ new Set(), j = [w, ..."profile" in c ? S.fallback[w] : []], M = l;
|
|
125
|
+
for (;;) {
|
|
126
|
+
if (A.has(M)) return null;
|
|
127
|
+
if (A.size >= 128) return p("bounds");
|
|
128
|
+
A.add(M);
|
|
129
|
+
let e = null;
|
|
130
|
+
for (let i of j) if (e = await t(n, r, a.manifest.publication.id, s, i, M, u), e !== null) break;
|
|
131
|
+
if (e === null) return null;
|
|
132
|
+
if (e.status !== "published" || e.documentId !== M || ![
|
|
133
|
+
e.id,
|
|
134
|
+
e.revisionId,
|
|
135
|
+
e.locale
|
|
136
|
+
].every(g) || !Number.isSafeInteger(e.revision) || Number(e.revision) < 1) return p("publication");
|
|
137
|
+
if (E.kind === "field") {
|
|
138
|
+
let t = e[E.field];
|
|
139
|
+
if (t == null) {
|
|
140
|
+
if (E.missing !== "public") return null;
|
|
141
|
+
} else if (typeof t != "string" || !E.values.includes(t)) return null;
|
|
142
|
+
}
|
|
143
|
+
k.push({
|
|
144
|
+
documentId: M,
|
|
145
|
+
variantId: String(e.id),
|
|
146
|
+
revisionId: String(e.revisionId),
|
|
147
|
+
revision: Number(e.revision),
|
|
148
|
+
locale: String(e.locale)
|
|
149
|
+
});
|
|
150
|
+
let i = O === void 0 ? void 0 : e[O];
|
|
151
|
+
if (i == null || i === "") return {
|
|
152
|
+
contentType: s,
|
|
153
|
+
requestedLocale: w,
|
|
154
|
+
chain: k
|
|
155
|
+
};
|
|
156
|
+
if (!g(i)) return p("publication");
|
|
157
|
+
M = i;
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
export { f as SnapshotPublicAccessUnavailable, b as admitSnapshotPublicDocument, S as admitVerifiedSnapshotPublicDocument, C as admitVerifiedSnapshotPublicDocumentLocale, y as snapshotPublicAccessSource };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { publicRouteRegistryFail as e } from "./publicRouteRegistry.js";
|
|
2
|
+
import { copySnapshotResource as t } from "./buildSnapshot.js";
|
|
3
|
+
import { compileCmsPublicRouteDeclaration as n } from "./initializePublicRoutes.js";
|
|
4
|
+
import { readPublicRouteHistoryView as r } from "./publicRouteHistoryView.js";
|
|
5
|
+
import { canonicalJson as i } from "@voltro/runtime";
|
|
6
|
+
// src/snapshotPublicRouteHistory.ts
|
|
7
|
+
var a = (a, o, s) => {
|
|
8
|
+
let c = n(s);
|
|
9
|
+
return {
|
|
10
|
+
format: "voltro.cms.source-route-history/v1",
|
|
11
|
+
entries: async function* () {
|
|
12
|
+
let n = await r(a, o);
|
|
13
|
+
if (i(n.namespace.binding.definition) !== i(c)) return e("configuration");
|
|
14
|
+
yield t({
|
|
15
|
+
key: "configuration",
|
|
16
|
+
value: {
|
|
17
|
+
version: 1,
|
|
18
|
+
...n.namespace.scope,
|
|
19
|
+
kind: "source-configuration",
|
|
20
|
+
coverage: "declared-content-source",
|
|
21
|
+
nativeInventory: "not-enumerated",
|
|
22
|
+
binding: n.namespace.binding,
|
|
23
|
+
currentNamespaceDigest: n.namespace.sourceDigest,
|
|
24
|
+
...n.history
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
for await (let e of n.entries()) yield t({
|
|
28
|
+
key: "url:" + e.urlKey,
|
|
29
|
+
value: {
|
|
30
|
+
version: 1,
|
|
31
|
+
...n.namespace.scope,
|
|
32
|
+
kind: "source-observed",
|
|
33
|
+
...e
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export { a as snapshotPublicRouteHistorySource };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { verifyBuildSnapshot as e } from "./buildSnapshot.js";
|
|
2
|
+
import { Schema as t } from "effect";
|
|
3
|
+
// src/snapshotReadAdmission.ts
|
|
4
|
+
var n = class extends t.TaggedError()("SnapshotReadAdmissionUnavailable", { reason: t.Literals(["binding"]) }) {}, r = async (t, r, i, a) => {
|
|
5
|
+
let o = await e(t, r, i, a);
|
|
6
|
+
for (let [e, t] of Object.entries({
|
|
7
|
+
policies: "voltro.cms.public-access/v2",
|
|
8
|
+
projection: "voltro.cms.field-projection/v1",
|
|
9
|
+
routes: "voltro.cms.content-routes/v4",
|
|
10
|
+
domains: "voltro.cms.domains/v1",
|
|
11
|
+
schema: "voltro.cms.schema/v1",
|
|
12
|
+
components: "voltro.cms.components/v1",
|
|
13
|
+
assets: "voltro.cms.media-custody/v2",
|
|
14
|
+
site: "voltro.cms.site/v3",
|
|
15
|
+
locales: "voltro.cms.locales/v1",
|
|
16
|
+
seo: "voltro.cms.seo-metadata/v1"
|
|
17
|
+
})) if (o.manifest.parts.find((t) => t.part === e)?.format !== t) throw new n({ reason: "binding" });
|
|
18
|
+
return o;
|
|
19
|
+
}, i = async (e, t, n, i, a) => {
|
|
20
|
+
let o = await r(e, t, n, a);
|
|
21
|
+
return {
|
|
22
|
+
snapshot: o,
|
|
23
|
+
binding: {
|
|
24
|
+
tenantId: t.tenantId,
|
|
25
|
+
site: t.site,
|
|
26
|
+
environment: t.environment,
|
|
27
|
+
consumerId: i.consumerId,
|
|
28
|
+
buildId: i.buildId,
|
|
29
|
+
snapshotId: o.id,
|
|
30
|
+
snapshotDigest: o.digest,
|
|
31
|
+
releaseId: o.manifest.publication.releaseId,
|
|
32
|
+
policyDigest: o.manifest.parts.find((e) => e.part === "policies").digest,
|
|
33
|
+
projectionDigest: o.manifest.parts.find((e) => e.part === "projection").digest
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export { n as SnapshotReadAdmissionUnavailable, r as readAdmittedBuildSnapshot, i as resolveSnapshotReadBinding };
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { lockSiteState as e } from "./siteState.js";
|
|
2
|
+
import { routeDispositionFail as t } from "./routeDispositions.js";
|
|
3
|
+
import { lockOutputRouteHistoryCapture as n } from "./outputActivationStore.js";
|
|
4
|
+
import { copySnapshotSeoDocumentsSelection as r } from "./snapshotSeoPathSets.js";
|
|
5
|
+
import { readSnapshotSeoDocuments as i, snapshotOutputSafetyBinding as a } from "./snapshotSeoDocuments.js";
|
|
6
|
+
import { copyOutputSafetySelection as o, readVerifiedOutputSafetyArtifact as s } from "./outputSafetyArtifact.js";
|
|
7
|
+
import { readSnapshotRouteDispositionPlan as c } from "./snapshotRouteDispositionPlan.js";
|
|
8
|
+
import { copySnapshotRedirectTargets as l } from "./snapshotRedirectTargets.js";
|
|
9
|
+
import { createHash as u } from "node:crypto";
|
|
10
|
+
import { canonicalJson as d } from "@voltro/runtime";
|
|
11
|
+
// src/snapshotRedirectOutput.ts
|
|
12
|
+
var f = (u, d, f, p, m) => {
|
|
13
|
+
let h = {
|
|
14
|
+
tenantId: d.tenantId,
|
|
15
|
+
site: d.site,
|
|
16
|
+
environment: d.environment
|
|
17
|
+
}, g = {
|
|
18
|
+
snapshot: {
|
|
19
|
+
id: f.id,
|
|
20
|
+
digest: f.digest
|
|
21
|
+
},
|
|
22
|
+
token: p.token,
|
|
23
|
+
consumerId: p.consumerId,
|
|
24
|
+
buildId: p.buildId,
|
|
25
|
+
host: p.host
|
|
26
|
+
}, _ = r(p.documents), v = o(p.safety), y = l(p.targets, g.host), b = m.keys.map((e) => ({
|
|
27
|
+
id: e.id,
|
|
28
|
+
material: new Uint8Array(e.material)
|
|
29
|
+
})), x = typeof m.declaration == "function" ? m.declaration.bind(m) : m.declaration, S = { ...m.use }, C = m.now ?? Date.now;
|
|
30
|
+
if (!Number.isSafeInteger(m.maxBytes) || m.maxBytes < 1) return t("bounds");
|
|
31
|
+
let w = Math.min(m.maxBytes, 67108864);
|
|
32
|
+
return {
|
|
33
|
+
read: async () => {
|
|
34
|
+
let r, o, l, d = await s(u, h, v.artifactId, {
|
|
35
|
+
provider: m.provider,
|
|
36
|
+
maxBytes: w,
|
|
37
|
+
admit: async (s) => {
|
|
38
|
+
let u = await n(s, h);
|
|
39
|
+
await e(s, h);
|
|
40
|
+
let d = await i(s, h, g, _, {
|
|
41
|
+
provider: m.provider,
|
|
42
|
+
use: S,
|
|
43
|
+
keys: b,
|
|
44
|
+
now: C
|
|
45
|
+
}), f = [d];
|
|
46
|
+
for (let e of y) f.push(await i(s, h, {
|
|
47
|
+
...g,
|
|
48
|
+
host: e.host
|
|
49
|
+
}, e.documents, {
|
|
50
|
+
provider: m.provider,
|
|
51
|
+
use: S,
|
|
52
|
+
keys: b,
|
|
53
|
+
now: C
|
|
54
|
+
}));
|
|
55
|
+
let p = f.flatMap((e) => e.paths.entries), v = f.flatMap((e) => e.paths.contexts);
|
|
56
|
+
if (o = f.flatMap((e) => e.inventory.records), p.length > 1e5 || o.length > 1e5) return t("bounds");
|
|
57
|
+
l = f.map((e) => ({
|
|
58
|
+
host: e.paths.admission.admission.input.host,
|
|
59
|
+
artifactId: e.paths.selection.artifactId,
|
|
60
|
+
pathSetIds: e.inventory.pathSetIds
|
|
61
|
+
})).sort((e, t) => e.host < t.host ? -1 : +(e.host > t.host));
|
|
62
|
+
let w = d.paths.admission.app, T = typeof x == "function" ? x({
|
|
63
|
+
inputsId: w.inputsId,
|
|
64
|
+
executionId: w.executionId,
|
|
65
|
+
code: { ...w.app },
|
|
66
|
+
routeDiscovery: structuredClone(w.routes.value)
|
|
67
|
+
}) : x;
|
|
68
|
+
return r = await c(s, h, {
|
|
69
|
+
admission: d.paths.admission.admission,
|
|
70
|
+
site: d.paths.admission.site,
|
|
71
|
+
entries: p,
|
|
72
|
+
contexts: v
|
|
73
|
+
}, T, u, C()), a(d);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
if (r === void 0 || o === void 0 || l === void 0) return t("state");
|
|
77
|
+
let f = new Set(d.entries.filter((e) => e.target.kind === "url").map((e) => e.target.kind === "url" ? e.target.url : "")), p = new Set(d.entries.filter((e) => e.target.kind === "asset").map((e) => e.target.kind === "asset" ? e.target.digest : ""));
|
|
78
|
+
for (let e of o) e.media.some((e) => p.has(e.digest)) && f.add(e.url);
|
|
79
|
+
for (let e of r.definitions) if (f.has(e.source.url) || e.action.kind === "redirect" && f.has(e.action.target.url)) return t("graph");
|
|
80
|
+
return {
|
|
81
|
+
...r,
|
|
82
|
+
binding: d.binding,
|
|
83
|
+
targetDocuments: l,
|
|
84
|
+
safety: {
|
|
85
|
+
artifactId: d.artifactId,
|
|
86
|
+
generation: d.generation,
|
|
87
|
+
safetyDigest: d.safetyDigest
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
place: h,
|
|
92
|
+
budget: w
|
|
93
|
+
};
|
|
94
|
+
}, p = (e, t) => ({
|
|
95
|
+
version: 2,
|
|
96
|
+
profile: "voltro.cms.snapshot-redirect-output/v2",
|
|
97
|
+
kind: "redirects",
|
|
98
|
+
...t,
|
|
99
|
+
...e.binding,
|
|
100
|
+
targetDocuments: e.targetDocuments,
|
|
101
|
+
safety: e.safety,
|
|
102
|
+
routeState: e.routeState,
|
|
103
|
+
count: e.definitions.length
|
|
104
|
+
}), m = async (...e) => {
|
|
105
|
+
let n = e[4], { read: r, place: i, budget: a } = f(...e), o = await r(), s = Buffer.from(d({
|
|
106
|
+
version: 1,
|
|
107
|
+
definitions: o.definitions
|
|
108
|
+
}) + "\n", "utf8");
|
|
109
|
+
if (s.length > a) return t("bounds");
|
|
110
|
+
let c;
|
|
111
|
+
try {
|
|
112
|
+
if (c = await n.provider.begin(), await c.write({
|
|
113
|
+
path: "redirects.json",
|
|
114
|
+
contentType: "application/json",
|
|
115
|
+
size: s.length,
|
|
116
|
+
digest: u("sha256").update(s).digest("hex")
|
|
117
|
+
}, (async function* () {
|
|
118
|
+
yield s;
|
|
119
|
+
})()), d(await r()) !== d(o)) return t("state");
|
|
120
|
+
let e = await c.seal(p(o, i));
|
|
121
|
+
return /^[a-f0-9]{64}$/.test(e.id) ? {
|
|
122
|
+
artifactId: e.id,
|
|
123
|
+
count: o.definitions.length
|
|
124
|
+
} : t("state");
|
|
125
|
+
} catch (e) {
|
|
126
|
+
throw c !== void 0 && await Promise.allSettled([c.abort()]), e;
|
|
127
|
+
}
|
|
128
|
+
}, h = async (e, n, r, i, a) => {
|
|
129
|
+
let o = i.id, s = f(e, n, r, i, a);
|
|
130
|
+
if (!/^[a-f0-9]{64}$/.test(o) || a.provider.read === void 0) return t("state");
|
|
131
|
+
let c = a.provider.read.bind(a.provider), l = await s.read(), m = Buffer.from(d({
|
|
132
|
+
version: 1,
|
|
133
|
+
definitions: l.definitions
|
|
134
|
+
}) + "\n", "utf8");
|
|
135
|
+
if (m.length > s.budget) return t("bounds");
|
|
136
|
+
let h = {
|
|
137
|
+
version: 1,
|
|
138
|
+
subject: p(l, s.place),
|
|
139
|
+
files: [{
|
|
140
|
+
path: "redirects.json",
|
|
141
|
+
contentType: "application/json",
|
|
142
|
+
size: m.length,
|
|
143
|
+
digest: u("sha256").update(m).digest("hex")
|
|
144
|
+
}]
|
|
145
|
+
};
|
|
146
|
+
if (u("sha256").update(d(h)).digest("hex") !== o) return t("state");
|
|
147
|
+
let g = await c(o);
|
|
148
|
+
return g.id !== o || d(g.manifest) !== d(h) || d(await s.read()) !== d(l) ? t("state") : structuredClone(g);
|
|
149
|
+
};
|
|
150
|
+
export { h as readSnapshotRedirectOutputArtifact, m as renderSnapshotRouteDispositions };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { normalizeHost as e } from "./domainHost.js";
|
|
2
|
+
import { copySnapshotResource as t } from "./buildSnapshot.js";
|
|
3
|
+
import { routeDispositionFail as n } from "./routeDispositions.js";
|
|
4
|
+
import { copySnapshotSeoDocumentsSelection as r } from "./snapshotSeoPathSets.js";
|
|
5
|
+
// src/snapshotRedirectTargets.ts
|
|
6
|
+
var i = (i, a) => {
|
|
7
|
+
if (e(a) !== a) return n("input");
|
|
8
|
+
let o = t({
|
|
9
|
+
key: "redirect-targets",
|
|
10
|
+
value: { targets: i }
|
|
11
|
+
}).value.targets;
|
|
12
|
+
if (!Array.isArray(o) || o.length > 255) return n("bounds");
|
|
13
|
+
let s = "";
|
|
14
|
+
return o.map((t) => {
|
|
15
|
+
if (typeof t != "object" || !t || Array.isArray(t) || Object.keys(t).sort().join(",") !== "documents,host") return n("input");
|
|
16
|
+
let i = t, o = i.host;
|
|
17
|
+
return typeof o != "string" || e(o) !== o || o === a || o <= s ? n("input") : (s = o, {
|
|
18
|
+
host: o,
|
|
19
|
+
documents: r(i.documents)
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
export { i as copySnapshotRedirectTargets };
|