@voltro/cms 0.85.0 → 0.87.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5987 -0
- package/README.md +138 -0
- package/THIRD-PARTY-NOTICES.md +864 -253
- package/dist/ContentForm.js +282 -0
- package/dist/RichDocumentEditor.js +550 -0
- package/dist/RichDocumentView.js +177 -0
- package/dist/RichTextSurface.js +135 -0
- package/dist/aiCandidates.js +199 -0
- package/dist/aiOperations.js +152 -0
- package/dist/applicationBuildSnapshotService.js +101 -0
- package/dist/assetRenditions.js +102 -0
- package/dist/assetRevision.js +46 -0
- package/dist/assetUseRights.js +72 -0
- package/dist/audiences.js +31 -0
- package/dist/availability.js +124 -0
- package/dist/blueprint.js +166 -0
- package/dist/build.d.ts +3063 -0
- package/dist/build.js +37 -0
- package/dist/buildApplicationAdmission.js +16 -0
- package/dist/buildApplicationCatalog.js +136 -0
- package/dist/buildApplicationCatalogTable.js +24 -0
- package/dist/buildApplicationRest.js +99 -0
- package/dist/buildApplicationUpload.js +111 -0
- package/dist/buildSnapshot.js +401 -0
- package/dist/buildSnapshotApplicationPin.js +32 -0
- package/dist/buildSnapshotRest.js +210 -0
- package/dist/buildSnapshotService.js +265 -0
- package/dist/buildSnapshotTables.js +25 -0
- package/dist/bulk.js +282 -0
- package/dist/cacheIdentity.js +152 -0
- package/dist/changes.js +307 -0
- package/dist/cmsContext.js +229 -0
- package/dist/collections.js +224 -0
- package/dist/consent.js +29 -0
- package/dist/contentLocations.js +53 -0
- package/dist/contentProjection.js +83 -0
- package/dist/contentRouteIdentity.js +13 -0
- package/dist/contentRouteMaterializer.js +97 -0
- package/dist/contentRouteTypes.js +39 -0
- package/dist/contentSeo.js +189 -0
- package/dist/contentTreePath.js +60 -0
- package/dist/contentType.js +208 -0
- package/dist/contentValues.js +18 -0
- package/dist/contentfulImport.js +162 -0
- package/dist/copies.js +89 -0
- package/dist/cutover.js +202 -0
- package/dist/deliveryChecks.js +138 -0
- package/dist/domainHost.js +7 -0
- package/dist/domains.js +139 -0
- package/dist/draftTexts.js +164 -0
- package/dist/duplicates.js +78 -0
- package/dist/edgePurge.js +69 -0
- package/dist/editHistory.js +113 -0
- package/dist/effectForm.js +11 -0
- package/dist/environmentAliases.js +138 -0
- package/dist/environments.js +147 -0
- package/dist/errors.js +107 -0
- package/dist/experiments.js +528 -0
- package/dist/exposure.js +28 -0
- package/dist/extensionManifest.js +81 -0
- package/dist/extensions.js +314 -0
- package/dist/fieldSchema.js +199 -0
- package/dist/formStrings.js +74 -0
- package/dist/frontendBindings.js +99 -0
- package/dist/frontendMedia.js +18 -0
- package/dist/glossary.js +73 -0
- package/dist/history.js +54 -0
- package/dist/htmlImport.js +297 -0
- package/dist/index.d.ts +771 -54
- package/dist/index.js +89 -6082
- package/dist/initializePublicRoutes.js +28 -0
- package/dist/liveContentRouteView.js +76 -0
- package/dist/media.js +29 -0
- package/dist/metrics.js +46 -0
- package/dist/migration.js +193 -0
- package/dist/migrationStages.js +13 -0
- package/dist/nativeOutputDeploymentService.js +205 -0
- package/dist/outputActivation.js +234 -0
- package/dist/outputActivationOrigin.js +51 -0
- package/dist/outputActivationStore.js +411 -0
- package/dist/outputActivationTables.js +11 -0
- package/dist/outputActivationTarget.js +81 -0
- package/dist/outputActivationTargetTable.js +25 -0
- package/dist/outputDeployment.js +174 -0
- package/dist/outputDeploymentRest.js +168 -0
- package/dist/outputDeploymentService.js +241 -0
- package/dist/outputRouteGraph.js +177 -0
- package/dist/outputSafetyArtifact.js +147 -0
- package/dist/outputTargetRest.js +62 -0
- package/dist/pathSegmentEncoding.js +4 -0
- package/dist/presenceAnchors.js +68 -0
- package/dist/preview.js +31 -0
- package/dist/privateCmsTransport.js +76 -0
- package/dist/privateNativeRouteReservation.js +10 -0
- package/dist/promotion.js +116 -0
- package/dist/publicBuild.js +90 -0
- package/dist/publicBuildRest.js +98 -0
- package/dist/publicBuildService.js +63 -0
- package/dist/publicOutputHttp.js +129 -0
- package/dist/publicOutputService.js +287 -0
- package/dist/publicPresentation.js +17 -0
- package/dist/publicRouteDispositionAdmission.js +38 -0
- package/dist/publicRouteHistoryStore.js +12 -0
- package/dist/publicRouteHistoryView.js +34 -0
- package/dist/publicRouteIntegrity.js +5 -0
- package/dist/publicRouteMutation.js +6 -0
- package/dist/publicRouteNamespace.js +134 -0
- package/dist/publicRoutePublication.js +36 -0
- package/dist/publicRouteRegistry.js +17 -0
- package/dist/publicRouteRegistryBinding.js +194 -0
- package/dist/publicRouteRegistryDefinition.js +76 -0
- package/dist/publicRouteSitePublication.js +40 -0
- package/dist/publicRouteTables.js +13 -0
- package/dist/publicRouteUrl.js +18 -0
- package/dist/publicationSeo.js +52 -0
- package/dist/publicationState.js +296 -0
- package/dist/quality.js +188 -0
- package/dist/reconfigurePublicRoutes.js +41 -0
- package/dist/recurrence.js +78 -0
- package/dist/redirects.js +130 -0
- package/dist/referenceGraph.js +224 -0
- package/dist/references.js +173 -0
- package/dist/release.js +241 -0
- package/dist/renderReadAuthority.js +43 -0
- package/dist/renderReadGrant.js +137 -0
- package/dist/rest.js +52 -0
- package/dist/review.js +160 -0
- package/dist/richDocument.js +521 -0
- package/dist/richInline.js +100 -0
- package/dist/routeDispositionGraph.js +44 -0
- package/dist/routeDispositionRest.js +51 -0
- package/dist/routeDispositionService.js +73 -0
- package/dist/routeDispositionStore.js +289 -0
- package/dist/routeDispositionTables.js +5 -0
- package/dist/routeDispositions.js +91 -0
- package/dist/routeHistoryStorage.js +320 -0
- package/dist/routeHistoryStore.js +12 -0
- package/dist/schedule.js +80 -0
- package/dist/search.js +148 -0
- package/dist/selectionIntent.js +164 -0
- package/dist/seo.js +31 -0
- package/dist/series.js +105 -0
- package/dist/share.js +112 -0
- package/dist/siteBindings.js +159 -0
- package/dist/siteBuildCandidate.js +104 -0
- package/dist/siteDelivery.js +115 -0
- package/dist/siteState.js +47 -0
- package/dist/snapshotAddressGraph.js +55 -0
- package/dist/snapshotAddressRead.js +73 -0
- package/dist/snapshotAppConsumer.js +71 -0
- package/dist/snapshotAppExecution.js +102 -0
- package/dist/snapshotApplication.js +75 -0
- package/dist/snapshotApprovedRouteDispositions.js +44 -0
- package/dist/snapshotAssetAssembly.js +70 -0
- package/dist/snapshotAssetAssemblyRest.js +50 -0
- package/dist/snapshotBindingRead.js +61 -0
- package/dist/snapshotCodeSeo.js +29 -0
- package/dist/snapshotComponent.js +34 -0
- package/dist/snapshotComponentSource.js +24 -0
- package/dist/snapshotConsumer.js +87 -0
- package/dist/snapshotContentIdentity.js +10 -0
- package/dist/snapshotDefinitions.js +264 -0
- package/dist/snapshotDocumentAssembly.js +193 -0
- package/dist/snapshotDocumentAssemblyRest.js +84 -0
- package/dist/snapshotDocumentProjection.js +202 -0
- package/dist/snapshotDocumentTransfer.js +35 -0
- package/dist/snapshotDocumentTransferRest.js +80 -0
- package/dist/snapshotDomains.js +56 -0
- package/dist/snapshotEnvironment.js +31 -0
- package/dist/snapshotFieldPlan.js +85 -0
- package/dist/snapshotFrontend.js +103 -0
- package/dist/snapshotLink.js +8 -0
- package/dist/snapshotMedia.js +111 -0
- package/dist/snapshotMediaCapture.js +246 -0
- package/dist/snapshotMediaFields.js +225 -0
- package/dist/snapshotMediaRead.js +185 -0
- package/dist/snapshotMediaReader.js +13 -0
- package/dist/snapshotObservation.js +16 -0
- package/dist/snapshotObservedRouteHistory.js +34 -0
- package/dist/snapshotOutputTransfer.js +78 -0
- package/dist/snapshotPageLoader.js +7 -0
- package/dist/snapshotPageSeo.js +59 -0
- package/dist/snapshotPathLocale.js +15 -0
- package/dist/snapshotPresentation.js +86 -0
- package/dist/snapshotPresentationPolicy.js +12 -0
- package/dist/snapshotProjection.js +119 -0
- package/dist/snapshotPublicAccess.js +161 -0
- package/dist/snapshotPublicRouteHistory.js +40 -0
- package/dist/snapshotReadAdmission.js +38 -0
- package/dist/snapshotRedirectOutput.js +151 -0
- package/dist/snapshotRedirectTargets.js +24 -0
- package/dist/snapshotRedirects.js +132 -0
- package/dist/snapshotReference.js +8 -0
- package/dist/snapshotReferenceAddress.js +10 -0
- package/dist/snapshotReferenceGraph.js +79 -0
- package/dist/snapshotReferenceRead.js +65 -0
- package/dist/snapshotRelease.js +99 -0
- package/dist/snapshotRender.js +361 -0
- package/dist/snapshotRenderDependencies.js +178 -0
- package/dist/snapshotRenditions.js +88 -0
- package/dist/snapshotRichDocument.js +62 -0
- package/dist/snapshotRoleTransfer.js +106 -0
- package/dist/snapshotRoleTransferRest.js +99 -0
- package/dist/snapshotRouteAdmission.js +71 -0
- package/dist/snapshotRouteDispatch.js +111 -0
- package/dist/snapshotRouteDispositionPlan.js +73 -0
- package/dist/snapshotRouteRead.js +43 -0
- package/dist/snapshotRoutes.js +79 -0
- package/dist/snapshotRouting.js +113 -0
- package/dist/snapshotSeo.js +179 -0
- package/dist/snapshotSeoControls.js +101 -0
- package/dist/snapshotSeoDocumentInventory.js +115 -0
- package/dist/snapshotSeoDocuments.js +129 -0
- package/dist/snapshotSeoMerge.js +85 -0
- package/dist/snapshotSeoMetadata.js +137 -0
- package/dist/snapshotSeoOutput.js +173 -0
- package/dist/snapshotSeoPathSets.js +105 -0
- package/dist/snapshotSeoRead.js +88 -0
- package/dist/snapshotSite.js +128 -0
- package/dist/snapshotSitemapFiles.js +36 -0
- package/dist/snapshotTreeDependencies.js +58 -0
- package/dist/snapshotTreeLoader.js +10 -0
- package/dist/snapshotTreeRead.js +158 -0
- package/dist/staticPathSet.js +177 -0
- package/dist/staticPathSetRest.js +129 -0
- package/dist/staticPathSetService.js +249 -0
- package/dist/staticPathSetStore.js +338 -0
- package/dist/stewardship.js +146 -0
- package/dist/taxonomy.js +36 -0
- package/dist/team.js +103 -0
- package/dist/templates.js +106 -0
- package/dist/trackChanges.js +197 -0
- package/dist/translation.js +64 -0
- package/dist/tree.js +87 -0
- package/dist/usage.js +50 -0
- package/dist/validation.js +192 -0
- package/dist/visualEditing.js +60 -0
- package/dist/web.d.ts +709 -7
- package/dist/web.js +50 -2
- package/dist/workflow.js +322 -0
- package/dist/write.js +419 -0
- package/dist/xliff.js +325 -0
- package/package.json +20 -6
- package/dist/presenceAnchors-4iHAVQB3.js +0 -4367
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { copySnapshotResource as e } from "./buildSnapshot.js";
|
|
2
|
+
import { readRenderReadCredential as t } from "./renderReadAuthority.js";
|
|
3
|
+
import { copySnapshotPresentationValue as n } from "./snapshotPresentation.js";
|
|
4
|
+
import { copyFrontendOutputSelection as r } from "./frontendBindings.js";
|
|
5
|
+
import { snapshotApplicationConfigurationPins as i, snapshotApplicationPins as a } from "./snapshotApplication.js";
|
|
6
|
+
import { beginSnapshotMediaCapture as o, resumeSnapshotMediaCapture as s } from "./snapshotMediaCapture.js";
|
|
7
|
+
import { captureSiteBuildCandidate as c } from "./siteBuildCandidate.js";
|
|
8
|
+
import { issueSnapshotAppGrant as l } from "./snapshotAppConsumer.js";
|
|
9
|
+
import { readSnapshotRoute as u } from "./snapshotRouteRead.js";
|
|
10
|
+
import { readSnapshotBinding as d } from "./snapshotBindingRead.js";
|
|
11
|
+
import { readSnapshotTree as f } from "./snapshotTreeRead.js";
|
|
12
|
+
import { renderSnapshotRoute as p } from "./snapshotRender.js";
|
|
13
|
+
import { copySnapshotSeoDocumentsSelection as m } from "./snapshotSeoPathSets.js";
|
|
14
|
+
import { readSnapshotSeoDocuments as h, snapshotOutputSafetyBinding as g } from "./snapshotSeoDocuments.js";
|
|
15
|
+
import { captureOutputSafetyArtifact as _, copyOutputSafetySelection as v } from "./outputSafetyArtifact.js";
|
|
16
|
+
import { renderSnapshotSeoControls as y } from "./snapshotSeoOutput.js";
|
|
17
|
+
import { copySnapshotRedirectTargets as b } from "./snapshotRedirectTargets.js";
|
|
18
|
+
import { renderSnapshotRouteDispositions as x } from "./snapshotRedirectOutput.js";
|
|
19
|
+
import { Effect as S, Schema as C } from "effect";
|
|
20
|
+
import { createHash as w } from "node:crypto";
|
|
21
|
+
import { canonicalJson as T } from "@voltro/runtime";
|
|
22
|
+
//#region src/buildSnapshotService.ts
|
|
23
|
+
var E = class extends C.TaggedError()("CmsBuildSnapshotUnavailable", { reason: C.Literals([
|
|
24
|
+
"configuration",
|
|
25
|
+
"credential",
|
|
26
|
+
"capture",
|
|
27
|
+
"grant",
|
|
28
|
+
"read",
|
|
29
|
+
"render"
|
|
30
|
+
]) }) {}, D = (e) => w("sha256").update(T(e)).digest("hex"), O = (e) => {
|
|
31
|
+
throw new E({ reason: e });
|
|
32
|
+
}, k = (e, t) => S.tryPromise({
|
|
33
|
+
try: t,
|
|
34
|
+
catch: (t) => t instanceof E ? t : new E({ reason: e })
|
|
35
|
+
}), A = (C) => {
|
|
36
|
+
let { store: w, application: A, app: j, custody: M, execution: N, output: P } = C, F = {
|
|
37
|
+
tenantId: C.scope.tenantId,
|
|
38
|
+
site: C.scope.site,
|
|
39
|
+
environment: C.scope.environment
|
|
40
|
+
}, I = { ...C.code }, L = C.alias, R = C.requiredScope, z = C.snapshotTtlMs, B = C.maxMediaBytes, V = C.now ?? Date.now, H = {
|
|
41
|
+
id: C.key.id,
|
|
42
|
+
material: new Uint8Array(C.key.material)
|
|
43
|
+
}, U = [H, ...(C.verificationKeys ?? []).map((e) => ({
|
|
44
|
+
id: e.id,
|
|
45
|
+
material: new Uint8Array(e.material)
|
|
46
|
+
}))], W = JSON.parse(T(C.routeDiscovery));
|
|
47
|
+
if (!Number.isSafeInteger(z) || z <= 0 || !Number.isSafeInteger(B) || B < 0 || !/^[A-Za-z][A-Za-z0-9:_.-]{0,127}$/.test(R)) return O("configuration");
|
|
48
|
+
let G = D({
|
|
49
|
+
version: 1,
|
|
50
|
+
scope: F,
|
|
51
|
+
alias: L,
|
|
52
|
+
requiredScope: R,
|
|
53
|
+
ttl: z,
|
|
54
|
+
maxBytes: B,
|
|
55
|
+
application: A.frontend === void 0 ? {
|
|
56
|
+
...i(A, I),
|
|
57
|
+
frontend: {
|
|
58
|
+
source: "retained-application",
|
|
59
|
+
output: r(A.output)
|
|
60
|
+
}
|
|
61
|
+
} : a({
|
|
62
|
+
...A,
|
|
63
|
+
frontend: A.frontend
|
|
64
|
+
}, I),
|
|
65
|
+
discovery: W
|
|
66
|
+
}), K = async (e, n) => {
|
|
67
|
+
let r = await t(e, F, n, V());
|
|
68
|
+
return r === null || !r.scopes.includes(R) ? O("credential") : r;
|
|
69
|
+
}, q = (e) => ({
|
|
70
|
+
snapshot: {
|
|
71
|
+
id: e.snapshot.id,
|
|
72
|
+
digest: e.snapshot.digest
|
|
73
|
+
},
|
|
74
|
+
token: e.token,
|
|
75
|
+
consumerId: e.consumerId,
|
|
76
|
+
buildId: e.buildId,
|
|
77
|
+
host: e.host,
|
|
78
|
+
path: e.path,
|
|
79
|
+
presentation: n(e.presentation)
|
|
80
|
+
});
|
|
81
|
+
return {
|
|
82
|
+
capture: (t) => S.gen(function* () {
|
|
83
|
+
let { apiKey: n, attemptId: r, releaseId: i } = t, a = t.expectedApplication === void 0 ? void 0 : {
|
|
84
|
+
inputsId: t.expectedApplication.inputsId,
|
|
85
|
+
executionId: t.expectedApplication.executionId,
|
|
86
|
+
code: {
|
|
87
|
+
commit: t.expectedApplication.code.commit,
|
|
88
|
+
artifactDigest: t.expectedApplication.code.artifactDigest,
|
|
89
|
+
configDigest: t.expectedApplication.code.configDigest
|
|
90
|
+
}
|
|
91
|
+
}, l = yield* k("credential", () => w.transactional((e) => K(e, n))), u = yield* k("capture", async () => {
|
|
92
|
+
for await (let t of j.entries()) {
|
|
93
|
+
if (t.key !== "configuration") return O("configuration");
|
|
94
|
+
let n = e(t).value, r = n.execution;
|
|
95
|
+
if (a !== void 0) {
|
|
96
|
+
let e = typeof r == "object" && r && !Array.isArray(r) ? r.id : void 0;
|
|
97
|
+
if (D(a) !== D({
|
|
98
|
+
inputsId: n.inputsId,
|
|
99
|
+
executionId: e,
|
|
100
|
+
code: n.app
|
|
101
|
+
})) return O("configuration");
|
|
102
|
+
}
|
|
103
|
+
let i = typeof r == "object" && r && !Array.isArray(r) ? r.definitions : void 0, o = typeof i == "object" && i && !Array.isArray(i) ? i.value : void 0, s = typeof o == "object" && o && !Array.isArray(o) ? o.frontend : void 0;
|
|
104
|
+
return {
|
|
105
|
+
digest: D(n),
|
|
106
|
+
frontend: s
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
return O("configuration");
|
|
110
|
+
}), d = yield* k("capture", () => w.transactional(async (e) => {
|
|
111
|
+
let t = await K(e, n), a = V();
|
|
112
|
+
if (t.id !== l.id) return O("credential");
|
|
113
|
+
let s = D({
|
|
114
|
+
configuration: G,
|
|
115
|
+
retained: u.digest,
|
|
116
|
+
releaseId: i,
|
|
117
|
+
authority: t.id
|
|
118
|
+
});
|
|
119
|
+
return typeof i != "string" || !/^[A-Za-z0-9_-]{1,64}$/.test(i) || typeof r != "string" || !/^[A-Za-z0-9_-]{1,64}$/.test(r) || !Number.isSafeInteger(a + z) || !Number.isFinite(new Date(a + z).getTime()) ? O("capture") : o(e, M, F, {
|
|
120
|
+
id: r,
|
|
121
|
+
contextDigest: s
|
|
122
|
+
}, {
|
|
123
|
+
maxBytes: B,
|
|
124
|
+
now: a,
|
|
125
|
+
capture: (e) => c(e, {
|
|
126
|
+
...A,
|
|
127
|
+
scope: F,
|
|
128
|
+
code: I,
|
|
129
|
+
app: j,
|
|
130
|
+
custody: M,
|
|
131
|
+
routeDiscovery: W,
|
|
132
|
+
frontendManifest: u.frontend,
|
|
133
|
+
alias: L,
|
|
134
|
+
releaseId: i,
|
|
135
|
+
now: a,
|
|
136
|
+
expiresAt: a + z
|
|
137
|
+
})
|
|
138
|
+
});
|
|
139
|
+
})), f = yield* s(w, M, F, d, V).pipe(S.mapError(() => new E({ reason: "capture" })));
|
|
140
|
+
return yield* k("credential", () => w.transactional(async (e) => {
|
|
141
|
+
if ((await K(e, n)).id !== l.id) return O("credential");
|
|
142
|
+
})), {
|
|
143
|
+
id: f.id,
|
|
144
|
+
digest: f.digest,
|
|
145
|
+
expiresAt: f.expiresAt
|
|
146
|
+
};
|
|
147
|
+
}),
|
|
148
|
+
open: (e) => k("grant", () => l(w, F, e, {
|
|
149
|
+
execution: N,
|
|
150
|
+
key: H,
|
|
151
|
+
now: V,
|
|
152
|
+
verificationKeys: U.filter((e) => e.id !== H.id)
|
|
153
|
+
})),
|
|
154
|
+
read: (e) => k("read", () => {
|
|
155
|
+
let t = q(e);
|
|
156
|
+
return w.transactional((e) => u(e, F, t.snapshot, t, {
|
|
157
|
+
keys: U,
|
|
158
|
+
now: V()
|
|
159
|
+
}));
|
|
160
|
+
}),
|
|
161
|
+
readBinding: (e) => k("read", () => {
|
|
162
|
+
let t = {
|
|
163
|
+
...q(e),
|
|
164
|
+
binding: e.binding
|
|
165
|
+
};
|
|
166
|
+
return w.transactional((e) => d(e, F, t.snapshot, t, {
|
|
167
|
+
keys: U,
|
|
168
|
+
now: V()
|
|
169
|
+
}));
|
|
170
|
+
}),
|
|
171
|
+
readTree: (e) => k("read", () => {
|
|
172
|
+
let t = {
|
|
173
|
+
...q(e),
|
|
174
|
+
name: e.name
|
|
175
|
+
};
|
|
176
|
+
return w.transactional((e) => f(e, F, t.snapshot, t, {
|
|
177
|
+
keys: U,
|
|
178
|
+
now: V()
|
|
179
|
+
}));
|
|
180
|
+
}),
|
|
181
|
+
render: (e) => k("render", () => {
|
|
182
|
+
let t = q(e);
|
|
183
|
+
return p(w, F, t.snapshot, t, {
|
|
184
|
+
keys: U,
|
|
185
|
+
execution: N,
|
|
186
|
+
now: V,
|
|
187
|
+
...P === void 0 ? {} : { output: {
|
|
188
|
+
...P,
|
|
189
|
+
custody: M
|
|
190
|
+
} }
|
|
191
|
+
});
|
|
192
|
+
}).pipe(S.map((e) => e === null ? null : {
|
|
193
|
+
html: e.html,
|
|
194
|
+
head: e.head,
|
|
195
|
+
document: e.document,
|
|
196
|
+
artifactId: e.output?.id ?? null
|
|
197
|
+
})),
|
|
198
|
+
renderSafety: (e) => k("render", () => {
|
|
199
|
+
if (P === void 0) return O("configuration");
|
|
200
|
+
let t = q({
|
|
201
|
+
...e,
|
|
202
|
+
path: "/"
|
|
203
|
+
}), n = m(e.documents);
|
|
204
|
+
return _(w, F, {
|
|
205
|
+
provider: P.provider,
|
|
206
|
+
maxBytes: P.maxBytes,
|
|
207
|
+
admit: async (e) => {
|
|
208
|
+
let r = await h(e, F, t, n, {
|
|
209
|
+
keys: U,
|
|
210
|
+
provider: P.provider,
|
|
211
|
+
use: P.use,
|
|
212
|
+
now: V
|
|
213
|
+
});
|
|
214
|
+
return g(r);
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
}),
|
|
218
|
+
renderRedirects: (e) => k("render", () => {
|
|
219
|
+
if (P === void 0) return O("configuration");
|
|
220
|
+
let t = q({
|
|
221
|
+
...e,
|
|
222
|
+
path: "/"
|
|
223
|
+
}), n = m(e.documents), r = v(e.safety), i = b(e.targets, t.host);
|
|
224
|
+
return x(w, F, t.snapshot, {
|
|
225
|
+
...t,
|
|
226
|
+
documents: n,
|
|
227
|
+
safety: r,
|
|
228
|
+
targets: i
|
|
229
|
+
}, {
|
|
230
|
+
declaration: {
|
|
231
|
+
types: A.types,
|
|
232
|
+
site: A.site,
|
|
233
|
+
code: I,
|
|
234
|
+
routing: A.routing,
|
|
235
|
+
routeDiscovery: W
|
|
236
|
+
},
|
|
237
|
+
keys: U,
|
|
238
|
+
provider: P.provider,
|
|
239
|
+
use: P.use,
|
|
240
|
+
maxBytes: P.maxBytes,
|
|
241
|
+
now: V
|
|
242
|
+
});
|
|
243
|
+
}),
|
|
244
|
+
renderSeo: (e) => k("render", () => {
|
|
245
|
+
if (P === void 0) return O("configuration");
|
|
246
|
+
let t = q({
|
|
247
|
+
...e,
|
|
248
|
+
path: "/"
|
|
249
|
+
}), n = e.documents === void 0 ? void 0 : m(e.documents), r = e.safety === void 0 ? void 0 : v(e.safety);
|
|
250
|
+
return y(w, F, t.snapshot, {
|
|
251
|
+
...t,
|
|
252
|
+
...n === void 0 ? {} : { documents: n },
|
|
253
|
+
...r === void 0 ? {} : { safety: r }
|
|
254
|
+
}, {
|
|
255
|
+
keys: U,
|
|
256
|
+
provider: P.provider,
|
|
257
|
+
use: P.use,
|
|
258
|
+
maxBytes: P.maxBytes,
|
|
259
|
+
now: V
|
|
260
|
+
});
|
|
261
|
+
})
|
|
262
|
+
};
|
|
263
|
+
};
|
|
264
|
+
//#endregion
|
|
265
|
+
export { E as CmsBuildSnapshotUnavailable, A as createCmsBuildSnapshots };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { publicationStateEntriesTable as e, publicationStatesTable as t } from "./publicationState.js";
|
|
2
|
+
import { buildSnapshotsTable as n, snapshotResourcesTable as r } from "./buildSnapshot.js";
|
|
3
|
+
import { routeDispositionTables as i } from "./routeDispositionStore.js";
|
|
4
|
+
import { cmsPublicRouteTables as a } from "./publicRouteTables.js";
|
|
5
|
+
import { outputActivationTables as o } from "./outputActivationStore.js";
|
|
6
|
+
import { snapshotMediaCapturesTable as s } from "./snapshotMediaCapture.js";
|
|
7
|
+
import { renderReadGrantsTable as c } from "./renderReadGrant.js";
|
|
8
|
+
import { staticPathSetTables as l } from "./staticPathSetStore.js";
|
|
9
|
+
import { buildApplicationCatalogTable as u } from "./buildApplicationCatalogTable.js";
|
|
10
|
+
//#region src/buildSnapshotTables.ts
|
|
11
|
+
var d = Object.freeze([
|
|
12
|
+
t,
|
|
13
|
+
e,
|
|
14
|
+
n,
|
|
15
|
+
r,
|
|
16
|
+
s,
|
|
17
|
+
c,
|
|
18
|
+
u,
|
|
19
|
+
...l,
|
|
20
|
+
...o,
|
|
21
|
+
...i,
|
|
22
|
+
...a
|
|
23
|
+
]);
|
|
24
|
+
//#endregion
|
|
25
|
+
export { d as cmsBuildSnapshotTables };
|
package/dist/bulk.js
ADDED
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { ContentIdConflict as e, ContentNotFound as t, ContentValidationFailed as n, ReferenceUnavailable as r, ReviewRequired as i, RevisionMismatch as a } from "./errors.js";
|
|
2
|
+
import { asTyped as o } from "./effectForm.js";
|
|
3
|
+
import { applyDerivations as s, publishViolations as c, validateContent as l } from "./validation.js";
|
|
4
|
+
import { CMS_REVISIONS_TABLE as u } from "./contentType.js";
|
|
5
|
+
import { pickDeclared as d } from "./contentValues.js";
|
|
6
|
+
import { assertApproved as f } from "./review.js";
|
|
7
|
+
import { assertReferencesAvailable as p } from "./availability.js";
|
|
8
|
+
import { setOwner as m, stewardshipOf as h } from "./stewardship.js";
|
|
9
|
+
import { publishRevision as g, revalidateContent as _, saveDraft as v, unpublish as y } from "./write.js";
|
|
10
|
+
import { addToRelease as b, releaseStatusOf as x } from "./release.js";
|
|
11
|
+
import { and as S, eq as C, id as w, json as T, table as E, text as D, timestamp as O } from "@voltro/database";
|
|
12
|
+
import { tenant as k } from "@voltro/plugin-multitenancy/mixin";
|
|
13
|
+
//#region src/bulk.ts
|
|
14
|
+
var A = async (e, t, n, r) => (await e.query({
|
|
15
|
+
table: t,
|
|
16
|
+
predicate: S(C("id", n), C("site", r.site), C("environment", r.environment), C("locale", r.locale)),
|
|
17
|
+
order: [],
|
|
18
|
+
take: 1,
|
|
19
|
+
skip: void 0,
|
|
20
|
+
projection: void 0
|
|
21
|
+
}))[0], j = (e, t) => {
|
|
22
|
+
for (let t of [
|
|
23
|
+
"title",
|
|
24
|
+
"name",
|
|
25
|
+
"slug"
|
|
26
|
+
]) {
|
|
27
|
+
let n = e?.[t];
|
|
28
|
+
if (typeof n == "string" && n !== "") return n;
|
|
29
|
+
}
|
|
30
|
+
return t;
|
|
31
|
+
}, M = (e) => e.targets.map((e) => `${e.path}: ${e.reason}`), N = async (e, t, a, o, m) => {
|
|
32
|
+
let g = (e, t = {}) => ({
|
|
33
|
+
...m,
|
|
34
|
+
documentId: null,
|
|
35
|
+
title: m.id,
|
|
36
|
+
revisionId: null,
|
|
37
|
+
disposition: "blocked",
|
|
38
|
+
reason: e,
|
|
39
|
+
detail: [],
|
|
40
|
+
...t
|
|
41
|
+
});
|
|
42
|
+
if (t === void 0) return g("unknownType");
|
|
43
|
+
let _ = {
|
|
44
|
+
...a,
|
|
45
|
+
locale: m.locale
|
|
46
|
+
}, v = await A(e, `${t.name}_drafts`, m.id, _);
|
|
47
|
+
if (v === void 0) return g("notFound");
|
|
48
|
+
let y = {
|
|
49
|
+
documentId: String(v.documentId),
|
|
50
|
+
title: j(v, m.id)
|
|
51
|
+
}, b = (e, t = null) => ({
|
|
52
|
+
...m,
|
|
53
|
+
...y,
|
|
54
|
+
revisionId: t,
|
|
55
|
+
disposition: e,
|
|
56
|
+
reason: null,
|
|
57
|
+
detail: []
|
|
58
|
+
});
|
|
59
|
+
if (o.kind === "unpublish") return await A(e, `${t.name}_published`, m.id, _) === void 0 ? g("notPublished", y) : b("ready");
|
|
60
|
+
if (o.kind === "setOwner") return b((await h(e, t, y.documentId, a)).owner === o.owner ? "unchanged" : "ready");
|
|
61
|
+
if (o.kind === "setField") {
|
|
62
|
+
let e = t.fields[o.field];
|
|
63
|
+
if (e === void 0 || e.derived !== void 0 || e.kind === "richText" || e.kind === "components") return g("invalid", {
|
|
64
|
+
...y,
|
|
65
|
+
detail: [`${o.field}: not a field this can set`]
|
|
66
|
+
});
|
|
67
|
+
let r = String(v.revisionId);
|
|
68
|
+
if (JSON.stringify(v[o.field] ?? null) === JSON.stringify(o.value ?? null)) return b("unchanged", r);
|
|
69
|
+
try {
|
|
70
|
+
l(t, s(t, d(t, {
|
|
71
|
+
...v,
|
|
72
|
+
[o.field]: o.value
|
|
73
|
+
})));
|
|
74
|
+
} catch (e) {
|
|
75
|
+
if (e instanceof n) return g("invalid", {
|
|
76
|
+
...y,
|
|
77
|
+
revisionId: r,
|
|
78
|
+
detail: e.violations.map((e) => `${e.field}: ${e.message}`)
|
|
79
|
+
});
|
|
80
|
+
throw e;
|
|
81
|
+
}
|
|
82
|
+
return b("ready", r);
|
|
83
|
+
}
|
|
84
|
+
let S = String(v.revisionId);
|
|
85
|
+
if (o.kind === "addToRelease" && await x(e, o.releaseId) !== "draft") return g("releaseClosed", {
|
|
86
|
+
...y,
|
|
87
|
+
revisionId: S
|
|
88
|
+
});
|
|
89
|
+
if ((await A(e, `${t.name}_published`, m.id, _))?.revisionId === S) return b("unchanged", S);
|
|
90
|
+
try {
|
|
91
|
+
let [n] = await e.query({
|
|
92
|
+
table: u,
|
|
93
|
+
predicate: C("id", S),
|
|
94
|
+
order: [],
|
|
95
|
+
take: 1,
|
|
96
|
+
skip: void 0,
|
|
97
|
+
projection: void 0
|
|
98
|
+
}), r = n?.values ?? {}, i = c(t, r);
|
|
99
|
+
if (i.length > 0) return g("incomplete", {
|
|
100
|
+
...y,
|
|
101
|
+
revisionId: S,
|
|
102
|
+
detail: i.map((e) => e.field)
|
|
103
|
+
});
|
|
104
|
+
await f(e, t, m.id, _, S), await p(e, t, m.id, r, _);
|
|
105
|
+
} catch (e) {
|
|
106
|
+
if (e instanceof i) return g("reviewRequired", {
|
|
107
|
+
...y,
|
|
108
|
+
revisionId: S
|
|
109
|
+
});
|
|
110
|
+
if (e instanceof r) return g("referenceUnavailable", {
|
|
111
|
+
...y,
|
|
112
|
+
revisionId: S,
|
|
113
|
+
detail: M(e)
|
|
114
|
+
});
|
|
115
|
+
throw e;
|
|
116
|
+
}
|
|
117
|
+
return b("ready", S);
|
|
118
|
+
}, P = async (e, t, n, r, i) => {
|
|
119
|
+
let a = new Map(t.map((e) => [e.name, e])), o = [];
|
|
120
|
+
for (let t of i) o.push(await N(e, a.get(t.type), n, r, t));
|
|
121
|
+
return o;
|
|
122
|
+
}, F = async (e, o, s, c, l) => {
|
|
123
|
+
let u = new Map(o.map((e) => [e.name, e])), f = [], p = /* @__PURE__ */ new Set();
|
|
124
|
+
for (let o of l) {
|
|
125
|
+
let l = {
|
|
126
|
+
type: o.type,
|
|
127
|
+
id: o.id,
|
|
128
|
+
locale: o.locale,
|
|
129
|
+
title: o.title
|
|
130
|
+
};
|
|
131
|
+
if (o.disposition !== "ready") {
|
|
132
|
+
f.push({
|
|
133
|
+
...l,
|
|
134
|
+
outcome: o.disposition === "unchanged" ? "unchanged" : "failed",
|
|
135
|
+
reason: o.reason,
|
|
136
|
+
detail: o.detail
|
|
137
|
+
});
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
let h = u.get(o.type), _ = {
|
|
141
|
+
...s,
|
|
142
|
+
locale: o.locale
|
|
143
|
+
};
|
|
144
|
+
try {
|
|
145
|
+
if (h === void 0) throw new t({
|
|
146
|
+
contentType: o.type,
|
|
147
|
+
id: o.id,
|
|
148
|
+
stage: "draft"
|
|
149
|
+
});
|
|
150
|
+
if (c.kind === "publish") await e.transactional((e) => g(e, h, o.id, _, o.revisionId ?? "")), p.add(h);
|
|
151
|
+
else if (c.kind === "addToRelease") await e.transactional((e) => b(e, c.releaseId, {
|
|
152
|
+
type: h,
|
|
153
|
+
id: o.id,
|
|
154
|
+
locale: o.locale,
|
|
155
|
+
action: "publish",
|
|
156
|
+
revisionId: o.revisionId ?? ""
|
|
157
|
+
}));
|
|
158
|
+
else if (c.kind === "unpublish") await e.transactional((e) => y(e, h, o.id, _)), p.add(h);
|
|
159
|
+
else if (c.kind === "setField") await e.transactional(async (e) => {
|
|
160
|
+
let n = await A(e, `${h.name}_drafts`, o.id, _);
|
|
161
|
+
if (n === void 0) throw new t({
|
|
162
|
+
contentType: o.type,
|
|
163
|
+
id: o.id,
|
|
164
|
+
stage: "draft"
|
|
165
|
+
});
|
|
166
|
+
await v(e, h, {
|
|
167
|
+
...d(h, n),
|
|
168
|
+
id: o.id,
|
|
169
|
+
[c.field]: c.value
|
|
170
|
+
}, _, o.revisionId === null ? {} : { expectedRevision: o.revisionId });
|
|
171
|
+
});
|
|
172
|
+
else {
|
|
173
|
+
if (o.documentId === null) throw new t({
|
|
174
|
+
contentType: o.type,
|
|
175
|
+
id: o.id,
|
|
176
|
+
stage: "draft"
|
|
177
|
+
});
|
|
178
|
+
await m(e, h, o.documentId, s, c.owner);
|
|
179
|
+
}
|
|
180
|
+
f.push({
|
|
181
|
+
...l,
|
|
182
|
+
outcome: "done",
|
|
183
|
+
reason: null,
|
|
184
|
+
detail: []
|
|
185
|
+
});
|
|
186
|
+
} catch (e) {
|
|
187
|
+
let o = e instanceof i ? "reviewRequired" : e instanceof a ? "revisionMoved" : e instanceof n ? "incomplete" : e instanceof r ? "referenceUnavailable" : e instanceof t ? e.stage === "published" ? "notPublished" : "notFound" : "failed", s = e instanceof r ? M(e) : e instanceof n ? e.violations.map((e) => e.field) : o === "failed" ? [e instanceof Error ? e.message : String(e)] : [];
|
|
188
|
+
f.push({
|
|
189
|
+
...l,
|
|
190
|
+
outcome: "failed",
|
|
191
|
+
reason: o,
|
|
192
|
+
detail: s
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
for (let e of p) _(e);
|
|
197
|
+
return f;
|
|
198
|
+
}, I = "cms_bulk_runs", L = E(I, {
|
|
199
|
+
id: w({ prefix: "cbrn" }),
|
|
200
|
+
site: D().maxLength(64),
|
|
201
|
+
environment: D().maxLength(64),
|
|
202
|
+
action: T(),
|
|
203
|
+
plan: T(),
|
|
204
|
+
results: T(),
|
|
205
|
+
status: D().oneOf(["running", "done"]),
|
|
206
|
+
startedBy: D().maxLength(64).nullable(),
|
|
207
|
+
finishedAt: O().nullable()
|
|
208
|
+
}).with(k()), R = (e) => ({
|
|
209
|
+
id: String(e.id),
|
|
210
|
+
action: e.action,
|
|
211
|
+
status: e.status === "done" ? "done" : "running",
|
|
212
|
+
total: (e.plan ?? []).length,
|
|
213
|
+
results: e.results ?? []
|
|
214
|
+
}), z = async (e, t, n, r, i) => {
|
|
215
|
+
let a = await e.insert(I, {
|
|
216
|
+
site: t.site,
|
|
217
|
+
environment: t.environment,
|
|
218
|
+
action: n,
|
|
219
|
+
plan: [...r],
|
|
220
|
+
results: [],
|
|
221
|
+
status: r.length === 0 ? "done" : "running",
|
|
222
|
+
startedBy: i,
|
|
223
|
+
finishedAt: r.length === 0 ? /* @__PURE__ */ new Date() : null
|
|
224
|
+
});
|
|
225
|
+
return String(a.id);
|
|
226
|
+
}, B = async (e, t, n, r = 25, i = /* @__PURE__ */ new Date()) => {
|
|
227
|
+
let [a] = await e.query({
|
|
228
|
+
table: I,
|
|
229
|
+
predicate: C("id", n),
|
|
230
|
+
order: [],
|
|
231
|
+
take: 1,
|
|
232
|
+
skip: void 0,
|
|
233
|
+
projection: void 0
|
|
234
|
+
});
|
|
235
|
+
if (a === void 0) return null;
|
|
236
|
+
let o = a.plan ?? [], s = a.action, c = {
|
|
237
|
+
site: String(a.site),
|
|
238
|
+
environment: String(a.environment)
|
|
239
|
+
}, l = [...a.results ?? []], u = a;
|
|
240
|
+
for (let a of o.slice(l.length, l.length + Math.max(1, r))) {
|
|
241
|
+
let [r] = await F(e, t, c, s, [a]);
|
|
242
|
+
l = [...l, r];
|
|
243
|
+
let d = l.length >= o.length;
|
|
244
|
+
u = await e.update("cms_bulk_runs", n, {
|
|
245
|
+
results: l,
|
|
246
|
+
...d ? {
|
|
247
|
+
status: "done",
|
|
248
|
+
finishedAt: i
|
|
249
|
+
} : {}
|
|
250
|
+
}) ?? u;
|
|
251
|
+
}
|
|
252
|
+
return R(u);
|
|
253
|
+
}, V = async (e, t) => {
|
|
254
|
+
let [n] = await e.query({
|
|
255
|
+
table: I,
|
|
256
|
+
predicate: C("id", t),
|
|
257
|
+
order: [],
|
|
258
|
+
take: 1,
|
|
259
|
+
skip: void 0,
|
|
260
|
+
projection: void 0
|
|
261
|
+
});
|
|
262
|
+
return n === void 0 ? null : R(n);
|
|
263
|
+
}, H = async (e) => (await e.query({
|
|
264
|
+
table: I,
|
|
265
|
+
predicate: C("status", "running"),
|
|
266
|
+
order: [{
|
|
267
|
+
column: "createdAt",
|
|
268
|
+
direction: "asc"
|
|
269
|
+
}],
|
|
270
|
+
take: 20,
|
|
271
|
+
skip: void 0,
|
|
272
|
+
projection: ["id"]
|
|
273
|
+
})).map((e) => String(e.id)), U = [
|
|
274
|
+
e,
|
|
275
|
+
t,
|
|
276
|
+
n,
|
|
277
|
+
r,
|
|
278
|
+
i,
|
|
279
|
+
a
|
|
280
|
+
], W = (...e) => o(() => P(...e), ...U), G = (...e) => o(() => F(...e), ...U), K = (...e) => o(() => z(...e)), q = (...e) => o(() => B(...e)), J = (...e) => o(() => V(...e)), Y = (...e) => o(() => H(...e));
|
|
281
|
+
//#endregion
|
|
282
|
+
export { I as CMS_BULK_RUNS_TABLE, V as bulkRunState, J as bulkRunStateEffect, L as cmsBulkRunsTable, B as continueBulkRun, q as continueBulkRunEffect, P as planBulk, W as planBulkEffect, F as runBulk, G as runBulkEffect, z as startBulkRun, K as startBulkRunEffect, H as unfinishedBulkRuns, Y as unfinishedBulkRunsEffect };
|