@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,204 @@
|
|
|
1
|
+
import { copyOutputActivationScope as e, createOutputActivationSet as t, outputActivationHash as n } from "./outputActivation.js";
|
|
2
|
+
import { verifyBuildSnapshot as r } from "./buildSnapshot.js";
|
|
3
|
+
import { readSnapshotAppExecution as i } from "./snapshotAppExecution.js";
|
|
4
|
+
import { readStaticPathSetEvidence as a } from "./staticPathSetStore.js";
|
|
5
|
+
import { makeOutputActivationAdmission as o } from "./outputDeployment.js";
|
|
6
|
+
import { CmsOutputDeploymentUnavailable as s, createCmsOutputDeploymentAuthority as c, createCmsOutputDeployments as l } from "./outputDeploymentService.js";
|
|
7
|
+
import { OUTPUT_ACTIVATION_TARGETS as u } from "./outputActivationTargetTable.js";
|
|
8
|
+
import { readOutputActivationTarget as d, retainOutputActivationTarget as f } from "./outputActivationTarget.js";
|
|
9
|
+
import { and as p, eq as m } from "@voltro/database";
|
|
10
|
+
import { canonicalJson as h } from "@voltro/protocol";
|
|
11
|
+
// src/nativeOutputDeploymentService.ts
|
|
12
|
+
var g = (e) => {
|
|
13
|
+
throw new s({ reason: e });
|
|
14
|
+
}, _ = (e, t) => h(e) === h(t), v = (e) => typeof e?.id != "string" || !/^[A-Za-z0-9_-]{1,64}$/.test(e.id) || !(e.material instanceof Uint8Array) || e.material.byteLength < 32 ? g("configuration") : {
|
|
15
|
+
id: e.id,
|
|
16
|
+
material: new Uint8Array(e.material)
|
|
17
|
+
}, y = (s) => {
|
|
18
|
+
let h = s.store, y = e(s.scope), b = s.now ?? Date.now, x = s.pathKeys.map(v), S = v(s.key), C = Object.keys(s.regions).sort(), w = s.quorum;
|
|
19
|
+
if (x.length < 1 || x.length > 64 || new Set(x.map((e) => e.id)).size !== x.length || C.length < 1 || C.length > 64 || !Number.isSafeInteger(w) || w < 1 || w > C.length) return g("configuration");
|
|
20
|
+
let T = Object.fromEntries(C.map((e) => {
|
|
21
|
+
let t = s.regions[e];
|
|
22
|
+
return !/^[A-Za-z0-9_-]{1,64}$/.test(e) || [
|
|
23
|
+
"stage",
|
|
24
|
+
"verify",
|
|
25
|
+
"readArtifacts",
|
|
26
|
+
"readRoutes"
|
|
27
|
+
].some((e) => typeof t[e] != "function") ? g("configuration") : [e, {
|
|
28
|
+
key: v(t.key),
|
|
29
|
+
verificationKeys: (t.verificationKeys ?? []).map(v),
|
|
30
|
+
stage: t.stage.bind(t),
|
|
31
|
+
verify: t.verify.bind(t),
|
|
32
|
+
readArtifacts: t.readArtifacts.bind(t),
|
|
33
|
+
readRoutes: t.readRoutes.bind(t)
|
|
34
|
+
}];
|
|
35
|
+
})), { boundary: E, transaction: D } = c(h, y, b), O = async (e, t, a) => {
|
|
36
|
+
if (typeof a != "string" || !/^[A-Za-z0-9_-]{1,64}$/.test(a)) return g("input");
|
|
37
|
+
let o = await r(e, y, t, b()), s = await i(e, y, o), c = s.definitions.value, l = (e) => o.manifest.parts.find((t) => t.part === e) ?? g("integrity"), u = n({
|
|
38
|
+
domain: "voltro.cms.output.schema/v1",
|
|
39
|
+
pin: l("schema")
|
|
40
|
+
}), d = n({
|
|
41
|
+
domain: "voltro.cms.output.bindings/v1",
|
|
42
|
+
components: l("components"),
|
|
43
|
+
projection: l("projection"),
|
|
44
|
+
frontend: c.frontend
|
|
45
|
+
}), f = n({
|
|
46
|
+
domain: "voltro.cms.output.cache-key/v1",
|
|
47
|
+
schemaDigest: u,
|
|
48
|
+
bindingsDigest: d,
|
|
49
|
+
site: c.site,
|
|
50
|
+
routing: c.routing,
|
|
51
|
+
consentPurposes: c.consentPurposes
|
|
52
|
+
});
|
|
53
|
+
return {
|
|
54
|
+
snapshot: {
|
|
55
|
+
id: o.id,
|
|
56
|
+
digest: o.digest,
|
|
57
|
+
releaseId: o.manifest.publication.releaseId ?? g("state"),
|
|
58
|
+
publicationGeneration: o.manifest.publication.generation
|
|
59
|
+
},
|
|
60
|
+
app: {
|
|
61
|
+
deploymentId: a,
|
|
62
|
+
inputsId: s.inputsId,
|
|
63
|
+
executionId: s.executionId,
|
|
64
|
+
contractVersion: 1,
|
|
65
|
+
schemaDigest: u,
|
|
66
|
+
bindingsDigest: d,
|
|
67
|
+
cacheKeyDigest: f
|
|
68
|
+
},
|
|
69
|
+
renderPolicyDigest: l("policies").digest
|
|
70
|
+
};
|
|
71
|
+
}, k = async (e, t) => await d(e, y, t) ?? g("state"), A = async (e, t) => {
|
|
72
|
+
let n = await O(e, t.set.manifest.snapshot, t.set.manifest.app.deploymentId);
|
|
73
|
+
return !_(n.app, t.set.manifest.app) || !_(n.snapshot, t.set.manifest.snapshot) || n.renderPolicyDigest !== t.set.manifest.renderPolicyDigest ? g("changed") : n;
|
|
74
|
+
}, j = o({
|
|
75
|
+
pathKeys: x,
|
|
76
|
+
use: s.use.bind(s),
|
|
77
|
+
now: b,
|
|
78
|
+
verifyArtifacts: async (e, t) => {
|
|
79
|
+
let n = await k(e, t.id);
|
|
80
|
+
if (!_(n.set, t)) return g("changed");
|
|
81
|
+
let r;
|
|
82
|
+
for (let e of n.outputs) {
|
|
83
|
+
let n = T[e.region] ?? g("regions");
|
|
84
|
+
await n.verify(t, e.outputId);
|
|
85
|
+
let i = await n.readArtifacts(t, e.outputId);
|
|
86
|
+
if (r !== void 0 && !_(r, i)) return g("integrity");
|
|
87
|
+
r = i;
|
|
88
|
+
}
|
|
89
|
+
if (r === void 0) return g("regions");
|
|
90
|
+
let i = [];
|
|
91
|
+
for (let r of n.pathSets) {
|
|
92
|
+
let n = t.manifest.paths.find((e) => e.host === r.host) ?? g("integrity");
|
|
93
|
+
i.push(await a(e, y, {
|
|
94
|
+
id: r.jobId,
|
|
95
|
+
digest: n.setId
|
|
96
|
+
}, x));
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
...r,
|
|
100
|
+
pathSets: i
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
return {
|
|
105
|
+
...l({
|
|
106
|
+
store: h,
|
|
107
|
+
scope: y,
|
|
108
|
+
key: S,
|
|
109
|
+
...s.verificationKeys === void 0 ? {} : { verificationKeys: s.verificationKeys },
|
|
110
|
+
now: b,
|
|
111
|
+
readSet: async (e, t) => (await k(e, t)).set,
|
|
112
|
+
readDeployment: async (e, t) => {
|
|
113
|
+
let n = await e.query({
|
|
114
|
+
table: u,
|
|
115
|
+
predicate: p(m("tenantId", y.tenantId), m("site", y.site), m("environment", y.environment), m("deploymentId", t)),
|
|
116
|
+
order: [],
|
|
117
|
+
take: 2,
|
|
118
|
+
skip: void 0,
|
|
119
|
+
projection: ["targetId"]
|
|
120
|
+
});
|
|
121
|
+
if (n.length !== 1 || typeof n[0].targetId != "string") return g("state");
|
|
122
|
+
let r = await A(e, await k(e, n[0].targetId));
|
|
123
|
+
return {
|
|
124
|
+
app: r.app,
|
|
125
|
+
renderPolicyDigest: r.renderPolicyDigest
|
|
126
|
+
};
|
|
127
|
+
},
|
|
128
|
+
admit: j,
|
|
129
|
+
readRoutes: (e, t) => (T[t.region] ?? g("regions")).readRoutes(e, t.outputId),
|
|
130
|
+
regions: Object.fromEntries(C.map((e) => {
|
|
131
|
+
let t = T[e];
|
|
132
|
+
return [e, {
|
|
133
|
+
key: t.key,
|
|
134
|
+
verificationKeys: t.verificationKeys,
|
|
135
|
+
verify: async (n, r, i) => {
|
|
136
|
+
if ((await k(n, r.id)).outputs.find((t) => t.region === e)?.outputId !== i) return g("regions");
|
|
137
|
+
await t.verify(r, i);
|
|
138
|
+
}
|
|
139
|
+
}];
|
|
140
|
+
}))
|
|
141
|
+
}),
|
|
142
|
+
prepare: (e) => {
|
|
143
|
+
let r = structuredClone(e);
|
|
144
|
+
return E(async (e) => {
|
|
145
|
+
let i = await D(r.credential, e, async (e) => {
|
|
146
|
+
let i = await O(e, r.snapshot, r.deploymentId);
|
|
147
|
+
if (!Array.isArray(r.pathSets) || r.pathSets.length < 1 || r.pathSets.length > 256) return g("input");
|
|
148
|
+
let o = [...r.pathSets].sort((e, t) => e.host < t.host ? -1 : +(e.host > t.host)), s = [];
|
|
149
|
+
for (let t of o) {
|
|
150
|
+
let n = await a(e, y, {
|
|
151
|
+
id: t.jobId,
|
|
152
|
+
digest: t.digest
|
|
153
|
+
}, x);
|
|
154
|
+
s.push({
|
|
155
|
+
host: t.host,
|
|
156
|
+
setId: n.set.id,
|
|
157
|
+
count: n.set.manifest.count
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
let c = {
|
|
161
|
+
version: 2,
|
|
162
|
+
scope: y,
|
|
163
|
+
...i,
|
|
164
|
+
paths: s,
|
|
165
|
+
artifacts: r.artifacts,
|
|
166
|
+
regions: {
|
|
167
|
+
required: C,
|
|
168
|
+
quorum: w
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
return {
|
|
172
|
+
set: t({
|
|
173
|
+
...c,
|
|
174
|
+
cacheNamespace: n({
|
|
175
|
+
domain: "voltro.cms.output.namespace/v1",
|
|
176
|
+
manifest: c
|
|
177
|
+
})
|
|
178
|
+
}),
|
|
179
|
+
pathSets: o.map(({ host: e, jobId: t }) => ({
|
|
180
|
+
host: e,
|
|
181
|
+
jobId: t
|
|
182
|
+
}))
|
|
183
|
+
};
|
|
184
|
+
}), o = [];
|
|
185
|
+
for (let t of C) {
|
|
186
|
+
e.throwIfAborted();
|
|
187
|
+
let n = await T[t].stage(i.set);
|
|
188
|
+
e.throwIfAborted(), await T[t].verify(i.set, n.outputId), o.push({
|
|
189
|
+
region: t,
|
|
190
|
+
outputId: n.outputId
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
return D(r.credential, e, async (e) => {
|
|
194
|
+
let t = {
|
|
195
|
+
...i,
|
|
196
|
+
outputs: o
|
|
197
|
+
};
|
|
198
|
+
return await A(e, t), f(e, y, t, x);
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
export { y as createCmsNativeOutputDeployments };
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { normalizeHost as e } from "./domainHost.js";
|
|
2
|
+
import { Schema as t } from "effect";
|
|
3
|
+
import { createHash as n, createHmac as r, timingSafeEqual as i } from "node:crypto";
|
|
4
|
+
import { canonicalJson as a } from "@voltro/runtime";
|
|
5
|
+
// src/outputActivation.ts
|
|
6
|
+
var o = class extends t.TaggedError()("OutputActivationUnavailable", { reason: t.Literals([
|
|
7
|
+
"input",
|
|
8
|
+
"integrity",
|
|
9
|
+
"state",
|
|
10
|
+
"changed",
|
|
11
|
+
"generation",
|
|
12
|
+
"regions",
|
|
13
|
+
"denied",
|
|
14
|
+
"expired"
|
|
15
|
+
]) }) {}, s = (e) => n("sha256").update(a(e)).digest("hex"), c = (e) => {
|
|
16
|
+
throw new o({ reason: e });
|
|
17
|
+
}, l = c, u = (e) => typeof e == "string" && /^[a-f0-9]{64}$/.test(e), d = (e) => typeof e == "string" && /^[A-Za-z0-9_-]{1,64}$/.test(e), f = (e, t) => {
|
|
18
|
+
if (!e || typeof e != "object" || Array.isArray(e) || ![Object.prototype, null].includes(Object.getPrototypeOf(e)) || Object.getOwnPropertySymbols(e).length > 0) return l("input");
|
|
19
|
+
let n = Object.getOwnPropertyDescriptors(e);
|
|
20
|
+
return Object.keys(n).sort().join(",") !== [...t].sort().join(",") || Object.values(n).some((e) => !e.enumerable || !("value" in e)) ? l("input") : e;
|
|
21
|
+
}, p = (e, t) => !Array.isArray(e) || e.length < 1 || e.length > t || Object.getOwnPropertySymbols(e).length > 0 || Object.keys(e).length !== e.length ? l("input") : Array.from({ length: e.length }, (t, n) => {
|
|
22
|
+
let r = Object.getOwnPropertyDescriptor(e, String(n));
|
|
23
|
+
return r === void 0 || !r.enumerable || !("value" in r) ? l("input") : r.value;
|
|
24
|
+
}), m = (e) => {
|
|
25
|
+
let t = f(e, [
|
|
26
|
+
"tenantId",
|
|
27
|
+
"site",
|
|
28
|
+
"environment"
|
|
29
|
+
]);
|
|
30
|
+
return Object.values(t).every(d) ? {
|
|
31
|
+
tenantId: String(t.tenantId),
|
|
32
|
+
site: String(t.site),
|
|
33
|
+
environment: String(t.environment)
|
|
34
|
+
} : l("input");
|
|
35
|
+
}, h = (e) => s({
|
|
36
|
+
contractVersion: e.contractVersion,
|
|
37
|
+
bindingsDigest: e.bindingsDigest,
|
|
38
|
+
schemaDigest: e.schemaDigest,
|
|
39
|
+
cacheKeyDigest: e.cacheKeyDigest
|
|
40
|
+
}), g = (e) => {
|
|
41
|
+
let t = f(e, [
|
|
42
|
+
"publicationGeneration",
|
|
43
|
+
"releaseId",
|
|
44
|
+
"deploymentId",
|
|
45
|
+
"renderPolicyDigest",
|
|
46
|
+
"contractDigest"
|
|
47
|
+
]);
|
|
48
|
+
return typeof t.publicationGeneration != "string" || !/^\d{20}$/.test(t.publicationGeneration) || !(t.releaseId === null || d(t.releaseId)) || !d(t.deploymentId) || !u(t.renderPolicyDigest) || !u(t.contractDigest) ? l("input") : { ...t };
|
|
49
|
+
}, _ = (e) => {
|
|
50
|
+
let t = f(e, [
|
|
51
|
+
"deploymentId",
|
|
52
|
+
"inputsId",
|
|
53
|
+
"executionId",
|
|
54
|
+
"contractVersion",
|
|
55
|
+
"bindingsDigest",
|
|
56
|
+
"schemaDigest",
|
|
57
|
+
"cacheKeyDigest"
|
|
58
|
+
]);
|
|
59
|
+
return !d(t.deploymentId) || ![
|
|
60
|
+
"inputsId",
|
|
61
|
+
"executionId",
|
|
62
|
+
"bindingsDigest",
|
|
63
|
+
"schemaDigest",
|
|
64
|
+
"cacheKeyDigest"
|
|
65
|
+
].every((e) => u(t[e])) || !Number.isSafeInteger(t.contractVersion) || Number(t.contractVersion) < 1 ? l("input") : { ...t };
|
|
66
|
+
}, v = (t) => {
|
|
67
|
+
let n = f(t, [
|
|
68
|
+
"version",
|
|
69
|
+
"scope",
|
|
70
|
+
"snapshot",
|
|
71
|
+
"app",
|
|
72
|
+
"renderPolicyDigest",
|
|
73
|
+
"paths",
|
|
74
|
+
"artifacts",
|
|
75
|
+
"cacheNamespace",
|
|
76
|
+
"regions"
|
|
77
|
+
]);
|
|
78
|
+
if (n.version !== 2 || !u(n.renderPolicyDigest) || !u(n.cacheNamespace)) return l("input");
|
|
79
|
+
let r = m(n.scope), i = f(n.snapshot, [
|
|
80
|
+
"id",
|
|
81
|
+
"digest",
|
|
82
|
+
"releaseId",
|
|
83
|
+
"publicationGeneration"
|
|
84
|
+
]);
|
|
85
|
+
if (!d(i.id) || !u(i.digest) || !d(i.releaseId) || typeof i.publicationGeneration != "string" || !/^\d{20}$/.test(i.publicationGeneration)) return l("input");
|
|
86
|
+
let a = _(n.app), o = "", s = p(n.paths, 256).map((t) => {
|
|
87
|
+
let n = f(t, [
|
|
88
|
+
"host",
|
|
89
|
+
"setId",
|
|
90
|
+
"count"
|
|
91
|
+
]);
|
|
92
|
+
return typeof n.host != "string" || n.host <= o || n.host.length > 253 || e(n.host) !== n.host || !u(n.setId) || !Number.isSafeInteger(n.count) || Number(n.count) < 0 || Number(n.count) > 1e5 ? l("input") : (o = n.host, {
|
|
93
|
+
host: n.host,
|
|
94
|
+
setId: n.setId,
|
|
95
|
+
count: Number(n.count)
|
|
96
|
+
});
|
|
97
|
+
}), c = p(n.artifacts, 256).map((e, t) => {
|
|
98
|
+
let n = f(e, [
|
|
99
|
+
"host",
|
|
100
|
+
"documents",
|
|
101
|
+
"assets",
|
|
102
|
+
"redirects",
|
|
103
|
+
"sitemap",
|
|
104
|
+
"robots",
|
|
105
|
+
"deny"
|
|
106
|
+
]);
|
|
107
|
+
return n.host !== s[t]?.host || ![
|
|
108
|
+
"documents",
|
|
109
|
+
"assets",
|
|
110
|
+
"redirects",
|
|
111
|
+
"sitemap",
|
|
112
|
+
"robots",
|
|
113
|
+
"deny"
|
|
114
|
+
].every((e) => u(n[e])) ? l("input") : { ...n };
|
|
115
|
+
});
|
|
116
|
+
if (c.length !== s.length) return l("input");
|
|
117
|
+
let h = f(n.regions, ["required", "quorum"]), g = p(h.required, 64);
|
|
118
|
+
return g.some((e, t, n) => !d(e) || t > 0 && String(n[t - 1]) >= String(e)) || !Number.isSafeInteger(h.quorum) || Number(h.quorum) < 1 || Number(h.quorum) > g.length ? l("input") : {
|
|
119
|
+
version: 2,
|
|
120
|
+
scope: r,
|
|
121
|
+
snapshot: { ...i },
|
|
122
|
+
app: a,
|
|
123
|
+
renderPolicyDigest: n.renderPolicyDigest,
|
|
124
|
+
paths: s,
|
|
125
|
+
artifacts: c,
|
|
126
|
+
cacheNamespace: n.cacheNamespace,
|
|
127
|
+
regions: {
|
|
128
|
+
required: g,
|
|
129
|
+
quorum: Number(h.quorum)
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
}, y = (e) => {
|
|
133
|
+
let t = v(e);
|
|
134
|
+
return {
|
|
135
|
+
id: s(t),
|
|
136
|
+
manifest: t
|
|
137
|
+
};
|
|
138
|
+
}, b = (e) => {
|
|
139
|
+
let t = f(e, ["id", "manifest"]), n = y(t.manifest);
|
|
140
|
+
return t.id === n.id ? n : l("integrity");
|
|
141
|
+
}, x = (e, t, n) => !d(n.id) || !(n.material instanceof Uint8Array) || n.material.byteLength < 32 ? l("input") : r("sha256", n.material).update(a({
|
|
142
|
+
purpose: e,
|
|
143
|
+
body: t,
|
|
144
|
+
keyId: n.id
|
|
145
|
+
})).digest("hex"), S = (e, t, n, r, a) => {
|
|
146
|
+
if (a.length === 0 || new Set(a.map((e) => e.id)).size !== a.length) return l("input");
|
|
147
|
+
let o = a.find((e) => e.id === r);
|
|
148
|
+
if (o === void 0 || !u(n) || !i(Buffer.from(x(e, t, o), "hex"), Buffer.from(n, "hex"))) return l("integrity");
|
|
149
|
+
}, C = (e, t) => {
|
|
150
|
+
let n = {
|
|
151
|
+
version: 1,
|
|
152
|
+
targetId: e.targetId,
|
|
153
|
+
expectedGeneration: e.expectedGeneration,
|
|
154
|
+
mode: e.mode,
|
|
155
|
+
expiresAt: e.expiresAt,
|
|
156
|
+
scope: m(e.scope),
|
|
157
|
+
observation: g(e.observation)
|
|
158
|
+
};
|
|
159
|
+
return !u(n.targetId) || !Number.isSafeInteger(n.expectedGeneration) || n.expectedGeneration < 0 || n.expectedGeneration >= 2 ** 53 - 1 || !["forward", "rollback"].includes(n.mode) || !Number.isSafeInteger(n.expiresAt) || n.expiresAt <= 0 || n.expiresAt > 864e13 ? l("input") : {
|
|
160
|
+
...n,
|
|
161
|
+
id: s(n),
|
|
162
|
+
keyId: t.id,
|
|
163
|
+
signature: x("voltro.cms.output-activation-probe/v1", n, t)
|
|
164
|
+
};
|
|
165
|
+
}, w = (e, t, n) => {
|
|
166
|
+
let r = f(e, [
|
|
167
|
+
"version",
|
|
168
|
+
"id",
|
|
169
|
+
"targetId",
|
|
170
|
+
"scope",
|
|
171
|
+
"expectedGeneration",
|
|
172
|
+
"mode",
|
|
173
|
+
"observation",
|
|
174
|
+
"expiresAt",
|
|
175
|
+
"keyId",
|
|
176
|
+
"signature"
|
|
177
|
+
]);
|
|
178
|
+
if (r.version !== 1 || !u(r.id) || !u(r.targetId) || !d(r.keyId) || !Number.isSafeInteger(r.expectedGeneration) || Number(r.expectedGeneration) < 0 || Number(r.expectedGeneration) >= 2 ** 53 - 1 || !["forward", "rollback"].includes(String(r.mode)) || !Number.isSafeInteger(r.expiresAt) || !Number.isSafeInteger(n)) return l("input");
|
|
179
|
+
let i = {
|
|
180
|
+
version: 1,
|
|
181
|
+
targetId: r.targetId,
|
|
182
|
+
scope: m(r.scope),
|
|
183
|
+
expectedGeneration: Number(r.expectedGeneration),
|
|
184
|
+
mode: r.mode,
|
|
185
|
+
observation: g(r.observation),
|
|
186
|
+
expiresAt: Number(r.expiresAt)
|
|
187
|
+
};
|
|
188
|
+
return s(i) === r.id ? (S("voltro.cms.output-activation-probe/v1", i, r.signature, r.keyId, t), i.expiresAt <= n ? l("expired") : {
|
|
189
|
+
...i,
|
|
190
|
+
id: r.id,
|
|
191
|
+
keyId: r.keyId,
|
|
192
|
+
signature: String(r.signature)
|
|
193
|
+
}) : l("integrity");
|
|
194
|
+
}, T = (e, t, n, r) => {
|
|
195
|
+
if (!d(t) || !u(r)) return l("input");
|
|
196
|
+
let i = {
|
|
197
|
+
version: 1,
|
|
198
|
+
probeId: e.id,
|
|
199
|
+
targetId: e.targetId,
|
|
200
|
+
generation: e.expectedGeneration + 1,
|
|
201
|
+
region: t,
|
|
202
|
+
outputId: r
|
|
203
|
+
};
|
|
204
|
+
return {
|
|
205
|
+
...i,
|
|
206
|
+
keyId: n.id,
|
|
207
|
+
signature: x("voltro.cms.output-region-receipt/v1", i, n)
|
|
208
|
+
};
|
|
209
|
+
}, E = (e, t, n, r) => {
|
|
210
|
+
if (!Array.isArray(n) || n.length > e.manifest.regions.required.length) return l("regions");
|
|
211
|
+
let i = /* @__PURE__ */ new Set(), a = n.map((n) => {
|
|
212
|
+
let a = f(n, [
|
|
213
|
+
"version",
|
|
214
|
+
"probeId",
|
|
215
|
+
"targetId",
|
|
216
|
+
"generation",
|
|
217
|
+
"region",
|
|
218
|
+
"outputId",
|
|
219
|
+
"keyId",
|
|
220
|
+
"signature"
|
|
221
|
+
]);
|
|
222
|
+
return a.version !== 1 || a.probeId !== t.id || a.targetId !== e.id || a.generation !== t.expectedGeneration + 1 || typeof a.region != "string" || !e.manifest.regions.required.includes(a.region) || i.has(a.region) || !u(a.outputId) ? l("regions") : (i.add(a.region), S("voltro.cms.output-region-receipt/v1", {
|
|
223
|
+
version: 1,
|
|
224
|
+
probeId: a.probeId,
|
|
225
|
+
targetId: a.targetId,
|
|
226
|
+
generation: a.generation,
|
|
227
|
+
region: a.region,
|
|
228
|
+
outputId: a.outputId
|
|
229
|
+
}, a.signature, a.keyId, r[a.region] ?? []), { ...a });
|
|
230
|
+
});
|
|
231
|
+
return i.size < e.manifest.regions.quorum ? l("regions") : a.sort((e, t) => e.region < t.region ? -1 : +(e.region > t.region));
|
|
232
|
+
};
|
|
233
|
+
export { o as OutputActivationUnavailable, _ as copyOutputActivationApp, v as copyOutputActivationManifest, g as copyOutputActivationObservation, m as copyOutputActivationScope, b as copyOutputActivationSet, y as createOutputActivationSet, C as makeOutputActivationProbe, T as makeOutputRegionReceipt, h as outputActivationContractDigest, c as outputActivationFail, s as outputActivationHash, w as verifyOutputActivationProbe, E as verifyOutputRegionReceipts };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { copyOutputActivationManifest as e, outputActivationFail as t, outputActivationHash as n } from "./outputActivation.js";
|
|
2
|
+
import { copySnapshotResource as r } from "./buildSnapshot.js";
|
|
3
|
+
// src/outputActivationOrigin.ts
|
|
4
|
+
var i = (e) => !e || typeof e != "object" || Array.isArray(e) ? t("input") : e, a = (a) => {
|
|
5
|
+
if (!/^[A-Za-z0-9_-]{1,64}$/.test(a.activationId) || !Number.isSafeInteger(a.generation) || a.generation < 1) return t("input");
|
|
6
|
+
let o = i(r({
|
|
7
|
+
key: "stored-output-origin",
|
|
8
|
+
value: { manifest: a.manifest }
|
|
9
|
+
}).value.manifest);
|
|
10
|
+
if (typeof a.setId != "string" || !/^[a-f0-9]{64}$/.test(a.setId) || n(o) !== a.setId) return t("integrity");
|
|
11
|
+
if (o.version === 1) {
|
|
12
|
+
let r = i(o.artifacts), s = o.paths;
|
|
13
|
+
if (Object.keys(r).sort().join(",") !== "assets,deny,documents,redirects,robots,sitemap" || !Array.isArray(s)) return t("input");
|
|
14
|
+
let c = e({
|
|
15
|
+
...o,
|
|
16
|
+
version: 2,
|
|
17
|
+
artifacts: s.map((e) => ({
|
|
18
|
+
...r,
|
|
19
|
+
host: i(e).host
|
|
20
|
+
}))
|
|
21
|
+
});
|
|
22
|
+
return {
|
|
23
|
+
scope: c.scope,
|
|
24
|
+
sourceDigest: n({
|
|
25
|
+
version: 1,
|
|
26
|
+
scope: c.scope,
|
|
27
|
+
activationId: a.activationId,
|
|
28
|
+
generation: a.generation,
|
|
29
|
+
setId: a.setId,
|
|
30
|
+
documentArtifactId: r.documents
|
|
31
|
+
})
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
let s = e(o);
|
|
35
|
+
return {
|
|
36
|
+
scope: s.scope,
|
|
37
|
+
sourceDigest: n({
|
|
38
|
+
version: 2,
|
|
39
|
+
scope: s.scope,
|
|
40
|
+
activationId: a.activationId,
|
|
41
|
+
generation: a.generation,
|
|
42
|
+
setId: a.setId,
|
|
43
|
+
documentArtifacts: s.artifacts.map((e) => ({
|
|
44
|
+
host: e.host,
|
|
45
|
+
artifactId: e.documents
|
|
46
|
+
}))
|
|
47
|
+
})
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
export { a as copyStoredOutputActivationOrigin };
|