@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,410 @@
|
|
|
1
|
+
import { copyOutputActivationManifest as e, copyOutputActivationObservation as t, copyOutputActivationScope as n, copyOutputActivationSet as r, makeOutputActivationProbe as i, outputActivationContractDigest as a, outputActivationFail as o, outputActivationHash as s, verifyOutputActivationProbe as c, verifyOutputRegionReceipts as l } from "./outputActivation.js";
|
|
2
|
+
import { copyObservedRoutes as u } from "./routeHistoryStorage.js";
|
|
3
|
+
import { copySnapshotResource as d } from "./buildSnapshot.js";
|
|
4
|
+
import { staticPathUrl as f } from "./staticPathSet.js";
|
|
5
|
+
import { copyStoredOutputActivationOrigin as p } from "./outputActivationOrigin.js";
|
|
6
|
+
import { iterateRouteHistory as m, readRouteHistoryPage as h, replaceRouteHistory as g, routeHistoryTables as _ } from "./routeHistoryStore.js";
|
|
7
|
+
import { and as v, eq as y, generateId as b, gt as x, id as S, integer as C, json as w, table as T, text as E, timestamp as D } from "@voltro/database";
|
|
8
|
+
import { tenant as O } from "@voltro/plugin-multitenancy/mixin";
|
|
9
|
+
import { canonicalJson as k } from "@voltro/runtime";
|
|
10
|
+
// src/outputActivationStore.ts
|
|
11
|
+
var A = "_voltro_cms_output_heads", j = "_voltro_cms_output_activations", M = "_voltro_cms_output_denies", N = T(A, {
|
|
12
|
+
id: S({ prefix: "couth" }),
|
|
13
|
+
site: E().maxLength(64),
|
|
14
|
+
environment: E().maxLength(64),
|
|
15
|
+
generation: C(),
|
|
16
|
+
safetyGeneration: C(),
|
|
17
|
+
activeMarkerId: E().maxLength(64).nullable()
|
|
18
|
+
}).with(O()).unique("cms_output_head_scope", [
|
|
19
|
+
"tenantId",
|
|
20
|
+
"site",
|
|
21
|
+
"environment"
|
|
22
|
+
]), P = T(j, {
|
|
23
|
+
id: S({ prefix: "couta" }),
|
|
24
|
+
site: E().maxLength(64),
|
|
25
|
+
environment: E().maxLength(64),
|
|
26
|
+
generation: C(),
|
|
27
|
+
setId: E().maxLength(64),
|
|
28
|
+
manifest: w(),
|
|
29
|
+
probe: w(),
|
|
30
|
+
receipts: w(),
|
|
31
|
+
activatedAt: D()
|
|
32
|
+
}).with(O()).unique("cms_output_activation_generation", [
|
|
33
|
+
"tenantId",
|
|
34
|
+
"site",
|
|
35
|
+
"environment",
|
|
36
|
+
"generation"
|
|
37
|
+
]), F = T(M, {
|
|
38
|
+
id: S({ prefix: "coutd" }),
|
|
39
|
+
site: E().maxLength(64),
|
|
40
|
+
environment: E().maxLength(64),
|
|
41
|
+
keyDigest: E().maxLength(64),
|
|
42
|
+
target: w(),
|
|
43
|
+
reason: E().oneOf([
|
|
44
|
+
"security",
|
|
45
|
+
"rights",
|
|
46
|
+
"takedown"
|
|
47
|
+
])
|
|
48
|
+
}).with(O()).unique("cms_output_safety_deny", [
|
|
49
|
+
"tenantId",
|
|
50
|
+
"site",
|
|
51
|
+
"environment",
|
|
52
|
+
"keyDigest"
|
|
53
|
+
]), I = Object.freeze([
|
|
54
|
+
N,
|
|
55
|
+
P,
|
|
56
|
+
F,
|
|
57
|
+
..._
|
|
58
|
+
]), L = (e) => v(y("tenantId", e.tenantId), y("site", e.site), y("environment", e.environment)), R = (e, t) => {
|
|
59
|
+
let n = b({
|
|
60
|
+
kind: "typeid",
|
|
61
|
+
prefix: e
|
|
62
|
+
}, t);
|
|
63
|
+
return n === null ? o("state") : n;
|
|
64
|
+
}, z = (e) => typeof e.id != "string" || !Number.isSafeInteger(e.generation) || Number(e.generation) < 0 || !Number.isSafeInteger(e.safetyGeneration) || Number(e.safetyGeneration) < 0 || e.activeMarkerId !== null && typeof e.activeMarkerId != "string" || e.generation === 0 != (e.activeMarkerId === null) ? o("state") : {
|
|
65
|
+
id: e.id,
|
|
66
|
+
generation: Number(e.generation),
|
|
67
|
+
safetyGeneration: Number(e.safetyGeneration),
|
|
68
|
+
activeMarkerId: e.activeMarkerId
|
|
69
|
+
}, B = async (e, t, n, r = "update") => {
|
|
70
|
+
n && await e.insertIgnore(A, {
|
|
71
|
+
id: R("couth", A),
|
|
72
|
+
...t,
|
|
73
|
+
generation: 0,
|
|
74
|
+
safetyGeneration: 0,
|
|
75
|
+
activeMarkerId: null
|
|
76
|
+
}, { conflictColumns: [
|
|
77
|
+
"tenantId",
|
|
78
|
+
"site",
|
|
79
|
+
"environment"
|
|
80
|
+
] });
|
|
81
|
+
let [i] = await e.query({
|
|
82
|
+
table: A,
|
|
83
|
+
predicate: L(t),
|
|
84
|
+
lock: r,
|
|
85
|
+
order: [],
|
|
86
|
+
take: 1,
|
|
87
|
+
skip: void 0,
|
|
88
|
+
projection: void 0
|
|
89
|
+
});
|
|
90
|
+
return i === void 0 ? null : z(i);
|
|
91
|
+
}, V = async (e, t) => {
|
|
92
|
+
let r = n(t), i = await B(e, r, !0);
|
|
93
|
+
if (i === null) return o("state");
|
|
94
|
+
let [a] = await e.query({
|
|
95
|
+
table: j,
|
|
96
|
+
predicate: i.generation === 0 ? L(r) : v(L(r), x("generation", i.generation)),
|
|
97
|
+
lock: "update",
|
|
98
|
+
order: [],
|
|
99
|
+
take: 1,
|
|
100
|
+
skip: void 0,
|
|
101
|
+
projection: ["id"]
|
|
102
|
+
});
|
|
103
|
+
if (a !== void 0) return o("state");
|
|
104
|
+
if (i.activeMarkerId === null) return {
|
|
105
|
+
generation: 0,
|
|
106
|
+
activationId: null,
|
|
107
|
+
sourceDigest: null
|
|
108
|
+
};
|
|
109
|
+
let [s] = await e.query({
|
|
110
|
+
table: j,
|
|
111
|
+
predicate: v(L(r), y("id", i.activeMarkerId)),
|
|
112
|
+
lock: "update",
|
|
113
|
+
order: [],
|
|
114
|
+
take: 1,
|
|
115
|
+
skip: void 0,
|
|
116
|
+
projection: void 0
|
|
117
|
+
});
|
|
118
|
+
if (s === void 0 || s.generation !== i.generation) return o("state");
|
|
119
|
+
let c = p({
|
|
120
|
+
setId: s.setId,
|
|
121
|
+
manifest: s.manifest,
|
|
122
|
+
activationId: i.activeMarkerId,
|
|
123
|
+
generation: i.generation
|
|
124
|
+
});
|
|
125
|
+
return W(c.scope, r) ? {
|
|
126
|
+
generation: i.generation,
|
|
127
|
+
activationId: i.activeMarkerId,
|
|
128
|
+
sourceDigest: c.sourceDigest
|
|
129
|
+
} : o("state");
|
|
130
|
+
}, H = (e, t, n, r) => {
|
|
131
|
+
let i = p({
|
|
132
|
+
setId: r.id,
|
|
133
|
+
manifest: r.manifest,
|
|
134
|
+
activationId: t,
|
|
135
|
+
generation: n
|
|
136
|
+
});
|
|
137
|
+
return W(i.scope, e) ? i.sourceDigest : o("state");
|
|
138
|
+
}, U = async (e, t, n) => {
|
|
139
|
+
let r = await n(e, t);
|
|
140
|
+
if (typeof r != "object" || !r || Array.isArray(r) || ![Object.prototype, null].includes(Object.getPrototypeOf(r)) || Object.getOwnPropertySymbols(r).length > 0) return o("input");
|
|
141
|
+
let i = Object.getOwnPropertyDescriptors(r);
|
|
142
|
+
if (Object.keys(i).sort().join(",") !== "documentArtifacts,routes" || Object.values(i).some((e) => !e.enumerable || !("value" in e))) return o("integrity");
|
|
143
|
+
let a = d({
|
|
144
|
+
key: "activation-documents",
|
|
145
|
+
value: { artifacts: i.documentArtifacts.value }
|
|
146
|
+
}).value.artifacts;
|
|
147
|
+
if (k(a) !== k(e.manifest.artifacts.map((e) => ({
|
|
148
|
+
host: e.host,
|
|
149
|
+
artifactId: e.documents
|
|
150
|
+
})))) return o("integrity");
|
|
151
|
+
let s = u(i.routes.value), c = /* @__PURE__ */ new Map();
|
|
152
|
+
for (let t of s) {
|
|
153
|
+
let n = new URL(t.url).hostname;
|
|
154
|
+
if (!e.manifest.paths.some((e) => e.host === n)) return o("integrity");
|
|
155
|
+
c.set(n, (c.get(n) ?? 0) + 1);
|
|
156
|
+
}
|
|
157
|
+
return e.manifest.paths.some((e) => (c.get(e.host) ?? 0) !== e.count) ? o("integrity") : s;
|
|
158
|
+
}, W = (e, t) => k(e) === k(t), G = async (e, n, r, i) => {
|
|
159
|
+
let s = t(await i(e, n, r));
|
|
160
|
+
return r === "forward" && (s.publicationGeneration !== n.manifest.snapshot.publicationGeneration || s.releaseId !== n.manifest.snapshot.releaseId || s.deploymentId !== n.manifest.app.deploymentId || s.renderPolicyDigest !== n.manifest.renderPolicyDigest || s.contractDigest !== a(n.manifest.app)) ? o("changed") : s;
|
|
161
|
+
}, K = async (t, n) => {
|
|
162
|
+
let [r] = await t.query({
|
|
163
|
+
table: j,
|
|
164
|
+
predicate: v(L(n.manifest.scope), y("setId", n.id)),
|
|
165
|
+
order: [],
|
|
166
|
+
take: 1,
|
|
167
|
+
skip: void 0,
|
|
168
|
+
projection: void 0
|
|
169
|
+
});
|
|
170
|
+
if (r === void 0 || k(e(r.manifest)) !== k(n.manifest)) return o("state");
|
|
171
|
+
}, q = async (e, t, i) => {
|
|
172
|
+
let a = n(t), s = await B(e, a, !1);
|
|
173
|
+
if (s === null || s.generation === 0) return {
|
|
174
|
+
revision: 0,
|
|
175
|
+
historyCount: 0
|
|
176
|
+
};
|
|
177
|
+
let u = 0, d;
|
|
178
|
+
for (; u < s.generation;) {
|
|
179
|
+
let t = await e.query({
|
|
180
|
+
table: j,
|
|
181
|
+
predicate: v(L(a), x("generation", u)),
|
|
182
|
+
lock: "update",
|
|
183
|
+
order: [{
|
|
184
|
+
column: "generation",
|
|
185
|
+
direction: "asc"
|
|
186
|
+
}],
|
|
187
|
+
take: 100,
|
|
188
|
+
skip: void 0,
|
|
189
|
+
projection: void 0
|
|
190
|
+
});
|
|
191
|
+
if (t.length === 0) return o("state");
|
|
192
|
+
for (let n of t) {
|
|
193
|
+
if (n.generation !== u + 1 || u >= s.generation || typeof n.id != "string") return o("state");
|
|
194
|
+
let t = r({
|
|
195
|
+
id: n.setId,
|
|
196
|
+
manifest: n.manifest
|
|
197
|
+
}), f = n.activatedAt instanceof Date ? n.activatedAt.getTime() : new Date(String(n.activatedAt)).getTime(), p = c(n.probe, i.keys, f);
|
|
198
|
+
if (!W(t.manifest.scope, a) || !W(p.scope, a) || p.targetId !== t.id || p.expectedGeneration !== u) return o("integrity");
|
|
199
|
+
let m = l(t, p, n.receipts, i.regionKeys), _ = await G(e, t, "rollback", i.admit), v = await U(t, m[0], i.readRoutes);
|
|
200
|
+
if (k(await G(e, t, "rollback", i.admit)) !== k(_)) return o("changed");
|
|
201
|
+
if (d ??= await h(e, a), d.revision !== 0 && d.revision !== s.generation) return o("state");
|
|
202
|
+
u++;
|
|
203
|
+
let y = H(a, n.id, u, t);
|
|
204
|
+
if (d.revision === 0 && await g(e, a, {
|
|
205
|
+
expectedRevision: u - 1,
|
|
206
|
+
sourceDigest: y,
|
|
207
|
+
routes: v
|
|
208
|
+
}), u === s.generation && (n.id !== s.activeMarkerId || d.revision !== 0 && d.sourceDigest !== y)) return o("state");
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
let f = await h(e, a);
|
|
212
|
+
for await (let t of m(e, a, f.revision));
|
|
213
|
+
return {
|
|
214
|
+
revision: f.revision,
|
|
215
|
+
historyCount: f.historyCount
|
|
216
|
+
};
|
|
217
|
+
}, J = async (e, t, n) => {
|
|
218
|
+
let a = r(t), s = await B(e, a.manifest.scope, !0);
|
|
219
|
+
if (s === null || s.generation !== n.expectedGeneration || s.generation >= 2147483647) return o("generation");
|
|
220
|
+
if (!Number.isSafeInteger(n.now) || n.now < 0 || !Number.isSafeInteger(n.ttlMs) || n.ttlMs < 1 || n.ttlMs > 3e4) return o("input");
|
|
221
|
+
n.mode === "rollback" && await K(e, a);
|
|
222
|
+
let c = await G(e, a, n.mode, n.admit);
|
|
223
|
+
return i({
|
|
224
|
+
targetId: a.id,
|
|
225
|
+
scope: a.manifest.scope,
|
|
226
|
+
expectedGeneration: s.generation,
|
|
227
|
+
mode: n.mode,
|
|
228
|
+
observation: c,
|
|
229
|
+
expiresAt: n.now + n.ttlMs
|
|
230
|
+
}, n.key);
|
|
231
|
+
}, Y = async (e, t, n) => {
|
|
232
|
+
let i = r(t), a = c(n.probe, n.keys, n.now);
|
|
233
|
+
if (a.targetId !== i.id || !W(a.scope, i.manifest.scope)) return o("integrity");
|
|
234
|
+
let s = await B(e, i.manifest.scope, !1);
|
|
235
|
+
if (s === null || s.generation !== a.expectedGeneration) return o("generation");
|
|
236
|
+
a.mode === "rollback" && await K(e, i);
|
|
237
|
+
let u = await G(e, i, a.mode, n.admit);
|
|
238
|
+
if (k(u) !== k(a.observation)) return o("changed");
|
|
239
|
+
let d = l(i, a, n.receipts, n.regionKeys), f = await U(i, d[0], n.readRoutes);
|
|
240
|
+
if (k(await G(e, i, a.mode, n.admit)) !== k(u)) return o("changed");
|
|
241
|
+
let m = await h(e, i.manifest.scope);
|
|
242
|
+
if (m.revision !== s.generation) return o("state");
|
|
243
|
+
if (s.activeMarkerId !== null) {
|
|
244
|
+
let [t] = await e.query({
|
|
245
|
+
table: j,
|
|
246
|
+
predicate: v(L(i.manifest.scope), y("id", s.activeMarkerId)),
|
|
247
|
+
lock: "update",
|
|
248
|
+
order: [],
|
|
249
|
+
take: 1,
|
|
250
|
+
skip: void 0,
|
|
251
|
+
projection: void 0
|
|
252
|
+
});
|
|
253
|
+
if (t === void 0 || t.generation !== s.generation) return o("state");
|
|
254
|
+
let n = p({
|
|
255
|
+
setId: t.setId,
|
|
256
|
+
manifest: t.manifest,
|
|
257
|
+
activationId: s.activeMarkerId,
|
|
258
|
+
generation: s.generation
|
|
259
|
+
});
|
|
260
|
+
if (!W(n.scope, i.manifest.scope) || m.sourceDigest !== n.sourceDigest) return o("state");
|
|
261
|
+
}
|
|
262
|
+
let _ = {
|
|
263
|
+
id: R("couta", j),
|
|
264
|
+
generation: s.generation + 1,
|
|
265
|
+
set: i,
|
|
266
|
+
probe: a,
|
|
267
|
+
receipts: d,
|
|
268
|
+
activatedAt: n.now
|
|
269
|
+
};
|
|
270
|
+
return await e.updateMany("_voltro_cms_output_heads", {
|
|
271
|
+
generation: _.generation,
|
|
272
|
+
activeMarkerId: _.id
|
|
273
|
+
}, { where: v(L(i.manifest.scope), y("id", s.id), y("generation", s.generation)) }) === 1 ? (await e.insert(j, {
|
|
274
|
+
id: _.id,
|
|
275
|
+
...i.manifest.scope,
|
|
276
|
+
generation: _.generation,
|
|
277
|
+
setId: i.id,
|
|
278
|
+
manifest: i.manifest,
|
|
279
|
+
probe: a,
|
|
280
|
+
receipts: d,
|
|
281
|
+
activatedAt: new Date(n.now)
|
|
282
|
+
}), await g(e, i.manifest.scope, {
|
|
283
|
+
expectedRevision: m.revision,
|
|
284
|
+
sourceDigest: H(i.manifest.scope, _.id, _.generation, i),
|
|
285
|
+
routes: f
|
|
286
|
+
}), _) : o("generation");
|
|
287
|
+
}, X = (e) => {
|
|
288
|
+
if (!e || typeof e != "object") return o("input");
|
|
289
|
+
if (e.kind === "asset" && Object.keys(e).sort().join(",") === "digest,kind" && /^[a-f0-9]{64}$/.test(e.digest)) return { ...e };
|
|
290
|
+
if (e.kind === "url" && Object.keys(e).sort().join(",") === "kind,url") try {
|
|
291
|
+
let t = new URL(e.url);
|
|
292
|
+
if (t.protocol === "https:" && f(t.hostname, t.pathname) === e.url) return { ...e };
|
|
293
|
+
} catch {
|
|
294
|
+
return o("input");
|
|
295
|
+
}
|
|
296
|
+
return o("input");
|
|
297
|
+
}, Z = async (e, t, r = {}) => {
|
|
298
|
+
let i = n(t), { expectedGeneration: a, after: c, take: l = 500 } = r;
|
|
299
|
+
if (!Number.isSafeInteger(l) || l < 1 || l > 1e3 || a !== void 0 && (!Number.isSafeInteger(a) || a < 0 || a > 2147483647) || c !== void 0 && (a === void 0 || typeof c != "string" || !/^[a-f0-9]{64}$/.test(c))) return o("input");
|
|
300
|
+
let u = (await B(e, i, !1))?.safetyGeneration ?? 0;
|
|
301
|
+
if (u > 2147483647) return o("state");
|
|
302
|
+
if (a !== void 0 && a !== u) return o("generation");
|
|
303
|
+
let d = await e.query({
|
|
304
|
+
table: M,
|
|
305
|
+
predicate: v(L(i), ...c === void 0 ? [] : [x("keyDigest", c)]),
|
|
306
|
+
lock: "update",
|
|
307
|
+
order: [{
|
|
308
|
+
column: "keyDigest",
|
|
309
|
+
direction: "asc"
|
|
310
|
+
}],
|
|
311
|
+
take: l + 1,
|
|
312
|
+
skip: void 0,
|
|
313
|
+
projection: [
|
|
314
|
+
"keyDigest",
|
|
315
|
+
"target",
|
|
316
|
+
"reason"
|
|
317
|
+
]
|
|
318
|
+
});
|
|
319
|
+
if (d.length > l + 1 || d.length > u || c === void 0 && d.length <= l && d.length !== u) return o("state");
|
|
320
|
+
let f = c ?? "", p = d.map((e) => {
|
|
321
|
+
let t = X(e.target), n = e.keyDigest, r = e.reason;
|
|
322
|
+
return typeof n != "string" || !/^[a-f0-9]{64}$/.test(n) || n <= f || s(t) !== n ? o("integrity") : r !== "security" && r !== "rights" && r !== "takedown" ? o("state") : (f = n, {
|
|
323
|
+
keyDigest: n,
|
|
324
|
+
target: t,
|
|
325
|
+
reason: r
|
|
326
|
+
});
|
|
327
|
+
});
|
|
328
|
+
return {
|
|
329
|
+
generation: u,
|
|
330
|
+
entries: p.slice(0, l),
|
|
331
|
+
next: p.length > l ? p[l - 1].keyDigest : null
|
|
332
|
+
};
|
|
333
|
+
}, Q = async (e, t, r, i) => {
|
|
334
|
+
let a = n(t), c = X(r);
|
|
335
|
+
if (![
|
|
336
|
+
"security",
|
|
337
|
+
"rights",
|
|
338
|
+
"takedown"
|
|
339
|
+
].includes(i)) return o("input");
|
|
340
|
+
let l = await B(e, a, !0);
|
|
341
|
+
if (l === null || l.safetyGeneration >= 2147483647) return o("state");
|
|
342
|
+
let u = s(c), [d] = await e.query({
|
|
343
|
+
table: M,
|
|
344
|
+
predicate: v(L(a), y("keyDigest", u)),
|
|
345
|
+
order: [],
|
|
346
|
+
take: 1,
|
|
347
|
+
skip: void 0,
|
|
348
|
+
projection: void 0
|
|
349
|
+
});
|
|
350
|
+
if (d !== void 0) return k(d.target) === k(c) ? l.safetyGeneration : o("integrity");
|
|
351
|
+
await e.insert(M, {
|
|
352
|
+
id: R("coutd", M),
|
|
353
|
+
...a,
|
|
354
|
+
keyDigest: u,
|
|
355
|
+
target: c,
|
|
356
|
+
reason: i
|
|
357
|
+
});
|
|
358
|
+
let f = l.safetyGeneration + 1;
|
|
359
|
+
return await e.update(A, l.id, { safetyGeneration: f }), f;
|
|
360
|
+
}, $ = async (e, t, n, i) => {
|
|
361
|
+
if (n.activeMarkerId === null) return o("state");
|
|
362
|
+
let [a] = await e.query({
|
|
363
|
+
table: j,
|
|
364
|
+
predicate: v(L(t), y("id", n.activeMarkerId)),
|
|
365
|
+
order: [],
|
|
366
|
+
take: 1,
|
|
367
|
+
skip: void 0,
|
|
368
|
+
projection: void 0
|
|
369
|
+
});
|
|
370
|
+
if (a === void 0 || a.generation !== n.generation) return o("state");
|
|
371
|
+
let s = a.activatedAt instanceof Date ? a.activatedAt.getTime() : typeof a.activatedAt == "string" ? Date.parse(a.activatedAt) : NaN;
|
|
372
|
+
if (!Number.isSafeInteger(s)) return o("state");
|
|
373
|
+
let u = r({
|
|
374
|
+
id: a.setId,
|
|
375
|
+
manifest: a.manifest
|
|
376
|
+
});
|
|
377
|
+
if (!W(t, u.manifest.scope)) return o("integrity");
|
|
378
|
+
let d = c(a.probe, i.keys, s);
|
|
379
|
+
if (d.targetId !== u.id || d.expectedGeneration + 1 !== n.generation || !W(d.scope, t)) return o("integrity");
|
|
380
|
+
let f = l(u, d, a.receipts, i.regionKeys);
|
|
381
|
+
return {
|
|
382
|
+
id: n.activeMarkerId,
|
|
383
|
+
generation: n.generation,
|
|
384
|
+
set: u,
|
|
385
|
+
probe: d,
|
|
386
|
+
receipts: f,
|
|
387
|
+
activatedAt: s
|
|
388
|
+
};
|
|
389
|
+
}, ee = async (e, t, r) => {
|
|
390
|
+
let i = n(t), a = await B(e, i, !1, r.lock ?? "update");
|
|
391
|
+
return a === null || a.activeMarkerId === null ? null : $(e, i, a, r);
|
|
392
|
+
}, te = async (e, t, r, i) => {
|
|
393
|
+
let a = n(t), c = X(r), l = await B(e, a, !1, i.lock ?? "update");
|
|
394
|
+
if (l === null || l.activeMarkerId === null) return null;
|
|
395
|
+
let [u] = await e.query({
|
|
396
|
+
table: M,
|
|
397
|
+
predicate: v(L(a), y("keyDigest", s(c))),
|
|
398
|
+
order: [],
|
|
399
|
+
take: 1,
|
|
400
|
+
skip: void 0,
|
|
401
|
+
projection: void 0
|
|
402
|
+
});
|
|
403
|
+
if (u !== void 0) return o("denied");
|
|
404
|
+
let d = await $(e, a, l, i), f = d.receipts.find((e) => e.region === i.region);
|
|
405
|
+
return f === void 0 ? o("regions") : (await i.admit(e, d.set, c, f), {
|
|
406
|
+
marker: d,
|
|
407
|
+
safetyGeneration: l.safetyGeneration
|
|
408
|
+
});
|
|
409
|
+
};
|
|
410
|
+
export { j as OUTPUT_ACTIVATIONS, A as OUTPUT_ACTIVATION_HEADS, M as OUTPUT_SAFETY_DENIES, Y as activateOutputSet, Q as denyOutputTarget, q as initializeOutputRouteHistory, V as lockOutputRouteHistoryCapture, N as outputActivationHeadsTable, I as outputActivationTables, P as outputActivationsTable, F as outputSafetyDeniesTable, J as probeOutputActivation, te as readActiveOutput, ee as readOutputActivationMarker, Z as readOutputSafetyPage };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { outputActivationTables as e } from "./outputActivationStore.js";
|
|
2
|
+
import { outputDeploymentTables as t } from "./outputDeployment.js";
|
|
3
|
+
import { outputActivationTargetsTable as n } from "./outputActivationTargetTable.js";
|
|
4
|
+
// src/outputActivationTables.ts
|
|
5
|
+
var r = Object.freeze([
|
|
6
|
+
...e,
|
|
7
|
+
...t,
|
|
8
|
+
n
|
|
9
|
+
]);
|
|
10
|
+
export { r as cmsOutputActivationTables };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { copyOutputActivationScope as e, copyOutputActivationSet as t, outputActivationFail as n } from "./outputActivation.js";
|
|
2
|
+
import { copySnapshotResource as r } from "./buildSnapshot.js";
|
|
3
|
+
import { readStaticPathSetEvidence as i } from "./staticPathSetStore.js";
|
|
4
|
+
import { OUTPUT_ACTIVATION_TARGETS as a } from "./outputActivationTargetTable.js";
|
|
5
|
+
import { and as o, eq as s } from "@voltro/database";
|
|
6
|
+
import { canonicalJson as c } from "@voltro/protocol";
|
|
7
|
+
// src/outputActivationTarget.ts
|
|
8
|
+
var l = (e, t) => typeof e != "object" || !e || Array.isArray(e) || Object.keys(e).sort().join(",") !== t ? n("input") : e, u = (e) => {
|
|
9
|
+
let i = l(r({
|
|
10
|
+
key: "output-target",
|
|
11
|
+
value: e
|
|
12
|
+
}).value, "outputs,pathSets,set"), a = t(i.set);
|
|
13
|
+
if (!Array.isArray(i.pathSets) || i.pathSets.length !== a.manifest.paths.length || !Array.isArray(i.outputs) || i.outputs.length !== a.manifest.regions.required.length) return n("input");
|
|
14
|
+
let o = i.pathSets.map((e) => {
|
|
15
|
+
let t = l(e, "host,jobId");
|
|
16
|
+
return typeof t.host != "string" || typeof t.jobId != "string" || !/^[A-Za-z0-9_-]{1,64}$/.test(t.jobId) ? n("input") : {
|
|
17
|
+
host: t.host,
|
|
18
|
+
jobId: t.jobId
|
|
19
|
+
};
|
|
20
|
+
}).sort((e, t) => e.host < t.host ? -1 : +(e.host > t.host)), s = i.outputs.map((e) => {
|
|
21
|
+
let t = l(e, "outputId,region");
|
|
22
|
+
return typeof t.region != "string" || typeof t.outputId != "string" || !/^[a-f0-9]{64}$/.test(t.outputId) ? n("input") : {
|
|
23
|
+
region: t.region,
|
|
24
|
+
outputId: t.outputId
|
|
25
|
+
};
|
|
26
|
+
}).sort((e, t) => e.region < t.region ? -1 : +(e.region > t.region));
|
|
27
|
+
return o.some((e, t) => e.host !== a.manifest.paths[t].host) || s.some((e, t) => e.region !== a.manifest.regions.required[t]) ? n("changed") : {
|
|
28
|
+
set: a,
|
|
29
|
+
pathSets: o,
|
|
30
|
+
outputs: s
|
|
31
|
+
};
|
|
32
|
+
}, d = (e, t) => o(s("tenantId", e.tenantId), s("site", e.site), s("environment", e.environment), s("targetId", t)), f = async (t, r, i) => {
|
|
33
|
+
let o = e(r);
|
|
34
|
+
if (typeof i != "string" || !/^[a-f0-9]{64}$/.test(i)) return n("input");
|
|
35
|
+
let s = await t.query({
|
|
36
|
+
table: a,
|
|
37
|
+
predicate: d(o, i),
|
|
38
|
+
order: [],
|
|
39
|
+
take: 2,
|
|
40
|
+
skip: void 0,
|
|
41
|
+
projection: void 0
|
|
42
|
+
});
|
|
43
|
+
if (s.length === 0) return null;
|
|
44
|
+
if (s.length !== 1) return n("state");
|
|
45
|
+
let l = s[0], f = u({
|
|
46
|
+
set: {
|
|
47
|
+
id: i,
|
|
48
|
+
manifest: l.manifest
|
|
49
|
+
},
|
|
50
|
+
pathSets: l.pathSets,
|
|
51
|
+
outputs: l.outputs
|
|
52
|
+
});
|
|
53
|
+
return l.deploymentId !== f.set.manifest.app.deploymentId || c(f.set.manifest.scope) !== c(o) ? n("changed") : f;
|
|
54
|
+
}, p = async (t, r, o, s) => {
|
|
55
|
+
let l = e(r), d = u(o), p = d.set;
|
|
56
|
+
if (c(p.manifest.scope) !== c(l)) return n("changed");
|
|
57
|
+
for (let e of d.pathSets) {
|
|
58
|
+
let r = p.manifest.paths.find((t) => t.host === e.host), a = await i(t, l, {
|
|
59
|
+
id: e.jobId,
|
|
60
|
+
digest: r.setId
|
|
61
|
+
}, s), o = a.set.manifest.context;
|
|
62
|
+
if (o.host !== e.host || o.snapshotId !== p.manifest.snapshot.id || o.snapshotDigest !== p.manifest.snapshot.digest || o.releaseId !== p.manifest.snapshot.releaseId || o.inputsId !== p.manifest.app.inputsId || o.executionId !== p.manifest.app.executionId || o.policyDigest !== p.manifest.renderPolicyDigest || a.set.manifest.count !== r.count) return n("changed");
|
|
63
|
+
}
|
|
64
|
+
await t.insertIgnore(a, {
|
|
65
|
+
...l,
|
|
66
|
+
targetId: p.id,
|
|
67
|
+
deploymentId: p.manifest.app.deploymentId,
|
|
68
|
+
manifest: p.manifest,
|
|
69
|
+
pathSets: d.pathSets,
|
|
70
|
+
outputs: d.outputs
|
|
71
|
+
}, { conflictColumns: [
|
|
72
|
+
"tenantId",
|
|
73
|
+
"site",
|
|
74
|
+
"environment",
|
|
75
|
+
"targetId"
|
|
76
|
+
] });
|
|
77
|
+
let m = await f(t, l, p.id);
|
|
78
|
+
return c(m) === c(d) ? m : n("changed");
|
|
79
|
+
};
|
|
80
|
+
export { f as readOutputActivationTarget, p as retainOutputActivationTarget };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { id as e, json as t, table as n, text as r } from "@voltro/database";
|
|
2
|
+
import { tenant as i } from "@voltro/plugin-multitenancy/mixin";
|
|
3
|
+
// src/outputActivationTargetTable.ts
|
|
4
|
+
var a = "_voltro_cms_output_targets", o = n("_voltro_cms_output_targets", {
|
|
5
|
+
id: e({ prefix: "coutt" }),
|
|
6
|
+
site: r().maxLength(64),
|
|
7
|
+
environment: r().maxLength(64),
|
|
8
|
+
targetId: r().maxLength(64),
|
|
9
|
+
deploymentId: r().maxLength(64),
|
|
10
|
+
manifest: t(),
|
|
11
|
+
pathSets: t(),
|
|
12
|
+
outputs: t()
|
|
13
|
+
}).with(i()).unique("cms_output_target_scope", [
|
|
14
|
+
"tenantId",
|
|
15
|
+
"site",
|
|
16
|
+
"environment",
|
|
17
|
+
"targetId"
|
|
18
|
+
]).unique("cms_output_target_deployment", [
|
|
19
|
+
"tenantId",
|
|
20
|
+
"site",
|
|
21
|
+
"environment",
|
|
22
|
+
"deploymentId"
|
|
23
|
+
]);
|
|
24
|
+
export { a as OUTPUT_ACTIVATION_TARGETS, o as outputActivationTargetsTable };
|