@voltro/cms 0.86.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.
Files changed (201) hide show
  1. package/CHANGELOG.md +5321 -0
  2. package/README.md +138 -0
  3. package/THIRD-PARTY-NOTICES.md +860 -221
  4. package/dist/RichDocumentView.js +81 -36
  5. package/dist/aiCandidates.js +3 -3
  6. package/dist/applicationBuildSnapshotService.js +101 -0
  7. package/dist/assetRenditions.js +102 -0
  8. package/dist/assetRevision.js +46 -0
  9. package/dist/assetUseRights.js +72 -0
  10. package/dist/availability.js +19 -16
  11. package/dist/blueprint.js +75 -75
  12. package/dist/build.d.ts +3063 -0
  13. package/dist/build.js +37 -0
  14. package/dist/buildApplicationAdmission.js +16 -0
  15. package/dist/buildApplicationCatalog.js +136 -0
  16. package/dist/buildApplicationCatalogTable.js +24 -0
  17. package/dist/buildApplicationRest.js +99 -0
  18. package/dist/buildApplicationUpload.js +111 -0
  19. package/dist/buildSnapshot.js +401 -0
  20. package/dist/buildSnapshotApplicationPin.js +32 -0
  21. package/dist/buildSnapshotRest.js +210 -0
  22. package/dist/buildSnapshotService.js +265 -0
  23. package/dist/buildSnapshotTables.js +25 -0
  24. package/dist/bulk.js +71 -70
  25. package/dist/changes.js +279 -62
  26. package/dist/consent.js +5 -5
  27. package/dist/contentLocations.js +53 -0
  28. package/dist/contentProjection.js +83 -0
  29. package/dist/contentRouteIdentity.js +13 -0
  30. package/dist/contentRouteMaterializer.js +97 -0
  31. package/dist/contentRouteTypes.js +39 -0
  32. package/dist/contentSeo.js +189 -0
  33. package/dist/contentTreePath.js +60 -0
  34. package/dist/contentType.js +117 -100
  35. package/dist/contentValues.js +18 -0
  36. package/dist/copies.js +3 -3
  37. package/dist/domainHost.js +7 -0
  38. package/dist/domains.js +81 -87
  39. package/dist/draftTexts.js +37 -37
  40. package/dist/duplicates.js +23 -23
  41. package/dist/environmentAliases.js +138 -0
  42. package/dist/environments.js +107 -69
  43. package/dist/errors.js +54 -14
  44. package/dist/experiments.js +7 -7
  45. package/dist/frontendBindings.js +99 -0
  46. package/dist/frontendMedia.js +18 -0
  47. package/dist/index.d.ts +760 -47
  48. package/dist/index.js +89 -73
  49. package/dist/initializePublicRoutes.js +28 -0
  50. package/dist/liveContentRouteView.js +76 -0
  51. package/dist/nativeOutputDeploymentService.js +205 -0
  52. package/dist/outputActivation.js +234 -0
  53. package/dist/outputActivationOrigin.js +51 -0
  54. package/dist/outputActivationStore.js +411 -0
  55. package/dist/outputActivationTables.js +11 -0
  56. package/dist/outputActivationTarget.js +81 -0
  57. package/dist/outputActivationTargetTable.js +25 -0
  58. package/dist/outputDeployment.js +174 -0
  59. package/dist/outputDeploymentRest.js +168 -0
  60. package/dist/outputDeploymentService.js +241 -0
  61. package/dist/outputRouteGraph.js +177 -0
  62. package/dist/outputSafetyArtifact.js +147 -0
  63. package/dist/outputTargetRest.js +62 -0
  64. package/dist/pathSegmentEncoding.js +4 -0
  65. package/dist/privateCmsTransport.js +76 -0
  66. package/dist/privateNativeRouteReservation.js +10 -0
  67. package/dist/promotion.js +68 -59
  68. package/dist/publicBuild.js +90 -0
  69. package/dist/publicBuildRest.js +98 -0
  70. package/dist/publicBuildService.js +63 -0
  71. package/dist/publicOutputHttp.js +129 -0
  72. package/dist/publicOutputService.js +287 -0
  73. package/dist/publicPresentation.js +17 -0
  74. package/dist/publicRouteDispositionAdmission.js +38 -0
  75. package/dist/publicRouteHistoryStore.js +12 -0
  76. package/dist/publicRouteHistoryView.js +34 -0
  77. package/dist/publicRouteIntegrity.js +5 -0
  78. package/dist/publicRouteMutation.js +6 -0
  79. package/dist/publicRouteNamespace.js +134 -0
  80. package/dist/publicRoutePublication.js +36 -0
  81. package/dist/publicRouteRegistry.js +17 -0
  82. package/dist/publicRouteRegistryBinding.js +194 -0
  83. package/dist/publicRouteRegistryDefinition.js +76 -0
  84. package/dist/publicRouteSitePublication.js +40 -0
  85. package/dist/publicRouteTables.js +13 -0
  86. package/dist/publicRouteUrl.js +18 -0
  87. package/dist/publicationSeo.js +52 -0
  88. package/dist/publicationState.js +296 -0
  89. package/dist/quality.js +8 -8
  90. package/dist/reconfigurePublicRoutes.js +41 -0
  91. package/dist/redirects.js +104 -73
  92. package/dist/referenceGraph.js +15 -14
  93. package/dist/references.js +2 -2
  94. package/dist/release.js +177 -141
  95. package/dist/renderReadAuthority.js +43 -0
  96. package/dist/renderReadGrant.js +137 -0
  97. package/dist/review.js +28 -28
  98. package/dist/richDocument.js +54 -24
  99. package/dist/routeDispositionGraph.js +44 -0
  100. package/dist/routeDispositionRest.js +51 -0
  101. package/dist/routeDispositionService.js +73 -0
  102. package/dist/routeDispositionStore.js +289 -0
  103. package/dist/routeDispositionTables.js +5 -0
  104. package/dist/routeDispositions.js +91 -0
  105. package/dist/routeHistoryStorage.js +320 -0
  106. package/dist/routeHistoryStore.js +12 -0
  107. package/dist/schedule.js +36 -36
  108. package/dist/seo.js +1 -1
  109. package/dist/series.js +11 -11
  110. package/dist/share.js +13 -13
  111. package/dist/siteBindings.js +159 -0
  112. package/dist/siteBuildCandidate.js +104 -0
  113. package/dist/siteDelivery.js +115 -0
  114. package/dist/siteState.js +47 -0
  115. package/dist/snapshotAddressGraph.js +55 -0
  116. package/dist/snapshotAddressRead.js +73 -0
  117. package/dist/snapshotAppConsumer.js +71 -0
  118. package/dist/snapshotAppExecution.js +102 -0
  119. package/dist/snapshotApplication.js +75 -0
  120. package/dist/snapshotApprovedRouteDispositions.js +44 -0
  121. package/dist/snapshotAssetAssembly.js +70 -0
  122. package/dist/snapshotAssetAssemblyRest.js +50 -0
  123. package/dist/snapshotBindingRead.js +61 -0
  124. package/dist/snapshotCodeSeo.js +29 -0
  125. package/dist/snapshotComponent.js +34 -0
  126. package/dist/snapshotComponentSource.js +24 -0
  127. package/dist/snapshotConsumer.js +87 -0
  128. package/dist/snapshotContentIdentity.js +10 -0
  129. package/dist/snapshotDefinitions.js +264 -0
  130. package/dist/snapshotDocumentAssembly.js +193 -0
  131. package/dist/snapshotDocumentAssemblyRest.js +84 -0
  132. package/dist/snapshotDocumentProjection.js +202 -0
  133. package/dist/snapshotDocumentTransfer.js +35 -0
  134. package/dist/snapshotDocumentTransferRest.js +80 -0
  135. package/dist/snapshotDomains.js +56 -0
  136. package/dist/snapshotEnvironment.js +31 -0
  137. package/dist/snapshotFieldPlan.js +85 -0
  138. package/dist/snapshotFrontend.js +103 -0
  139. package/dist/snapshotLink.js +8 -0
  140. package/dist/snapshotMedia.js +111 -0
  141. package/dist/snapshotMediaCapture.js +246 -0
  142. package/dist/snapshotMediaFields.js +225 -0
  143. package/dist/snapshotMediaRead.js +185 -0
  144. package/dist/snapshotMediaReader.js +13 -0
  145. package/dist/snapshotObservation.js +16 -0
  146. package/dist/snapshotObservedRouteHistory.js +34 -0
  147. package/dist/snapshotOutputTransfer.js +78 -0
  148. package/dist/snapshotPageLoader.js +7 -0
  149. package/dist/snapshotPageSeo.js +59 -0
  150. package/dist/snapshotPathLocale.js +15 -0
  151. package/dist/snapshotPresentation.js +86 -0
  152. package/dist/snapshotPresentationPolicy.js +12 -0
  153. package/dist/snapshotProjection.js +119 -0
  154. package/dist/snapshotPublicAccess.js +161 -0
  155. package/dist/snapshotPublicRouteHistory.js +40 -0
  156. package/dist/snapshotReadAdmission.js +38 -0
  157. package/dist/snapshotRedirectOutput.js +151 -0
  158. package/dist/snapshotRedirectTargets.js +24 -0
  159. package/dist/snapshotRedirects.js +132 -0
  160. package/dist/snapshotReference.js +8 -0
  161. package/dist/snapshotReferenceAddress.js +10 -0
  162. package/dist/snapshotReferenceGraph.js +79 -0
  163. package/dist/snapshotReferenceRead.js +65 -0
  164. package/dist/snapshotRelease.js +99 -0
  165. package/dist/snapshotRender.js +361 -0
  166. package/dist/snapshotRenderDependencies.js +178 -0
  167. package/dist/snapshotRenditions.js +88 -0
  168. package/dist/snapshotRichDocument.js +62 -0
  169. package/dist/snapshotRoleTransfer.js +106 -0
  170. package/dist/snapshotRoleTransferRest.js +99 -0
  171. package/dist/snapshotRouteAdmission.js +71 -0
  172. package/dist/snapshotRouteDispatch.js +111 -0
  173. package/dist/snapshotRouteDispositionPlan.js +73 -0
  174. package/dist/snapshotRouteRead.js +43 -0
  175. package/dist/snapshotRoutes.js +79 -0
  176. package/dist/snapshotRouting.js +113 -0
  177. package/dist/snapshotSeo.js +179 -0
  178. package/dist/snapshotSeoControls.js +101 -0
  179. package/dist/snapshotSeoDocumentInventory.js +115 -0
  180. package/dist/snapshotSeoDocuments.js +129 -0
  181. package/dist/snapshotSeoMerge.js +85 -0
  182. package/dist/snapshotSeoMetadata.js +137 -0
  183. package/dist/snapshotSeoOutput.js +173 -0
  184. package/dist/snapshotSeoPathSets.js +105 -0
  185. package/dist/snapshotSeoRead.js +88 -0
  186. package/dist/snapshotSite.js +128 -0
  187. package/dist/snapshotSitemapFiles.js +36 -0
  188. package/dist/snapshotTreeDependencies.js +58 -0
  189. package/dist/snapshotTreeLoader.js +10 -0
  190. package/dist/snapshotTreeRead.js +158 -0
  191. package/dist/staticPathSet.js +177 -0
  192. package/dist/staticPathSetRest.js +129 -0
  193. package/dist/staticPathSetService.js +249 -0
  194. package/dist/staticPathSetStore.js +338 -0
  195. package/dist/tree.js +9 -9
  196. package/dist/validation.js +53 -53
  197. package/dist/web.d.ts +709 -7
  198. package/dist/web.js +50 -33
  199. package/dist/workflow.js +8 -8
  200. package/dist/write.js +250 -225
  201. package/package.json +20 -6
@@ -0,0 +1,47 @@
1
+ import { SiteStateUnavailable as e } from "./errors.js";
2
+ import { and as t, eq as n, generateId as r, id as i, table as a, text as o } from "@voltro/database";
3
+ import { tenant as s } from "@voltro/plugin-multitenancy/mixin";
4
+ //#region src/siteState.ts
5
+ var c = "_voltro_cms_site_state_heads", l = a(c, {
6
+ id: i({ prefix: "cssh" }),
7
+ site: o().maxLength(64)
8
+ }).with(s()).unique("cms_site_state_scope", ["tenantId", "site"]), u = (t) => {
9
+ if (![t.tenantId, t.site].every((e) => typeof e == "string" && e.length > 0 && e.length <= 64 && e.trim() === e)) throw new e({ reason: "scope" });
10
+ return {
11
+ tenantId: t.tenantId,
12
+ site: t.site
13
+ };
14
+ }, d = (e) => t(n("tenantId", e.tenantId), n("site", e.site)), f = async (t, n) => {
15
+ let i = u(n), a = r({
16
+ kind: "typeid",
17
+ prefix: "cssh"
18
+ }, c);
19
+ if (a === null) throw new e({ reason: "state" });
20
+ await t.insertIgnore(c, {
21
+ id: String(a),
22
+ ...i
23
+ }, { conflictColumns: ["tenantId", "site"] });
24
+ let [o] = await t.query({
25
+ table: c,
26
+ predicate: d(i),
27
+ lock: "update",
28
+ order: [],
29
+ take: 1,
30
+ skip: void 0,
31
+ projection: ["id"]
32
+ });
33
+ if (o === void 0) throw new e({ reason: "state" });
34
+ }, p = async (t, n) => {
35
+ let r = u(n), [i] = await t.query({
36
+ table: c,
37
+ predicate: d(r),
38
+ lock: "share",
39
+ order: [],
40
+ take: 1,
41
+ skip: void 0,
42
+ projection: ["id"]
43
+ });
44
+ if (i === void 0) throw new e({ reason: "state" });
45
+ };
46
+ //#endregion
47
+ export { c as CMS_SITE_STATE_HEADS_TABLE, l as cmsSiteStateHeadsTable, u as copySiteScope, f as lockSiteState, p as lockSiteStateForRead, d as siteStatePredicate };
@@ -0,0 +1,55 @@
1
+ import { readVerifiedSnapshotResource as e } from "./buildSnapshot.js";
2
+ import { copySnapshotReferenceRoutes as t } from "./snapshotProjection.js";
3
+ import { SnapshotRouteReadUnavailable as n } from "./snapshotRouteAdmission.js";
4
+ import { readPlannedSnapshotReferenceAddress as r } from "./snapshotReferenceAddress.js";
5
+ import { canonicalJson as i } from "@voltro/runtime";
6
+ //#region src/snapshotAddressGraph.ts
7
+ var a = (e) => {
8
+ throw new n({ reason: e });
9
+ }, o = async (n, o, s, c, l) => {
10
+ if (s.length === 0 || s.length > 65 || s[0]?.source !== null || new Set(s.map((e) => e.source)).size !== s.length || Object.keys(c.nodes).length > 256) return a("bounds");
11
+ let u = s[0].context.snapshot;
12
+ if (s.some((e) => e.context.snapshot.id !== u.id || e.context.snapshot.digest !== u.digest || e.source?.startsWith("@ref:"))) return a("binding");
13
+ let d = (await e(n, o, u, "projection", "registry")).value;
14
+ if (!Array.isArray(d.types) || !d.types.every((e) => typeof e == "string")) return a("binding");
15
+ let f = t(d.referenceRoutes, d.types), p = [], m = /* @__PURE__ */ new Map();
16
+ if (Object.keys(f).length === 0) return p;
17
+ let h = [...s.map((e) => ({
18
+ source: e.source,
19
+ output: e.context.output,
20
+ fields: e.fields
21
+ })), ...Object.entries(c.nodes).map(([e, t]) => ({
22
+ source: e,
23
+ output: t.output,
24
+ fields: t.fields
25
+ }))];
26
+ for (let e of h) for (let t of e.fields.references) {
27
+ if (!Object.hasOwn(f, t.targetType)) continue;
28
+ if (p.length >= 8192) return a("bounds");
29
+ let s = f[t.targetType], c = i([
30
+ t.targetType,
31
+ t.targetDocumentId,
32
+ e.output.localeId,
33
+ s
34
+ ]);
35
+ if (!m.has(c)) {
36
+ if (m.size >= 256) return a("bounds");
37
+ m.set(c, await r(n, o, {
38
+ snapshot: u,
39
+ output: e.output
40
+ }, t, s, l));
41
+ }
42
+ p.push({
43
+ source: e.source,
44
+ fieldPath: [...t.path],
45
+ mappingId: s,
46
+ target: m.get(c) ?? null
47
+ });
48
+ }
49
+ return p.sort((e, t) => {
50
+ let n = i([e.source, e.fieldPath]), r = i([t.source, t.fieldPath]);
51
+ return n < r ? -1 : +(n > r);
52
+ }), p;
53
+ };
54
+ //#endregion
55
+ export { o as readAdmittedSnapshotAddressGraph };
@@ -0,0 +1,73 @@
1
+ import { compileSiteDelivery as e } from "./siteDelivery.js";
2
+ import { defineContentLocations as t, resolveContentLocation as n } from "./contentLocations.js";
3
+ import { readCapturedPublication as r } from "./publicationState.js";
4
+ import { findVerifiedSnapshotResource as i, readVerifiedSnapshotResource as a } from "./buildSnapshot.js";
5
+ import { verifySnapshotRouteOwnership as o } from "./snapshotRouting.js";
6
+ import { contentRouteId as s } from "./contentRouteIdentity.js";
7
+ import { admitSnapshotPublicDocument as c } from "./snapshotPublicAccess.js";
8
+ import { SnapshotRouteReadUnavailable as l } from "./snapshotRouteAdmission.js";
9
+ import { createHash as u } from "node:crypto";
10
+ import { canonicalJson as d } from "@voltro/runtime";
11
+ //#region src/snapshotAddressRead.ts
12
+ var f = (e) => {
13
+ throw new l({ reason: e });
14
+ }, p = (e) => u("sha256").update(d(e)).digest("hex"), m = (e, t) => d(e) === d(t), h = (e) => typeof e != "object" || !e || Array.isArray(e) ? f("binding") : e, g = async (e, t, n, r, i) => {
15
+ let a = { ...r }, o = { ...t };
16
+ if (n.manifest.parts.find((e) => e.part === "routes")?.format !== "voltro.cms.content-routes/v4") return f("binding");
17
+ if (typeof a.mappingId != "string" || !/^[A-Za-z][A-Za-z0-9_.-]{0,63}$/.test(a.mappingId)) return f("definition");
18
+ let s = await c(e, o, n, a.contentType, a.localeId, a.documentId, i);
19
+ return s === null ? null : _(e, o, n, a, s, i);
20
+ }, _ = async (c, l, u, d, g, _) => {
21
+ if (g.contentType !== d.contentType || g.chain[0]?.documentId !== d.documentId) return f("binding");
22
+ let v = g.chain[0], y = [...g.chain.slice(1)].reverse(), b = (await a(c, l, u, "schema", `type:${d.contentType}`)).value, x = h(b.definition), S = t(x.locations ?? []), C = S.find((e) => e.id === d.mappingId);
23
+ if (C === void 0) return f("definition");
24
+ let w = (await a(c, l, u, "routes", "configuration")).value, T = (await a(c, l, u, "site", "configuration")).value, E = e(w.site), D = E.definition.locales.find((e) => e.id === d.localeId && e.enabled), O = w.types;
25
+ if (w.version !== 1 || w.tenantId !== l.tenantId || w.environment !== l.environment || E.definition.id !== l.site || !E.definition.environments.includes(l.environment) || !m(w.app, b.app) || T.definitionDigest !== p(E.definition) || !Array.isArray(O) || w.definitionDigest !== p({
26
+ site: E.definition,
27
+ types: O,
28
+ routing: w.routing
29
+ }) || D === void 0 || D.contentLocale !== g.requestedLocale) return f("binding");
30
+ let k = O.map(h).filter((e) => e.name === d.contentType), A = x.tree === void 0 ? null : h(x.tree);
31
+ if (k.length !== 1 || !m(k[0].locations, S) || !m(k[0].tree, A === null ? null : {
32
+ parent: A.parent,
33
+ segment: A.segment
34
+ })) return f("binding");
35
+ let j = s(l, d.localeId, d.contentType, d.documentId, d.mappingId), M = await i(c, l, u, "routes", `identity:${j}`);
36
+ if (M === null) return null;
37
+ if (M.value.version !== 1 || M.value.kind !== "route-index" || typeof M.value.target != "string") return f("route");
38
+ let N = M.value.target, P = (await a(c, l, u, "routes", N)).value;
39
+ if (P.version !== 1 || P.routeId !== j || P.contentType !== d.contentType || P.documentId !== d.documentId || P.mappingId !== d.mappingId || P.localeId !== d.localeId || P.tenantId !== l.tenantId || P.site !== l.site || P.environment !== l.environment || P.definitionDigest !== w.definitionDigest || P.variantId !== v.variantId || P.revisionId !== v.revisionId || P.revision !== v.revision || P.sourceLocale !== v.locale || P.requestedLocale !== g.requestedLocale || P.fallback !== (v.locale !== g.requestedLocale)) return f("route");
40
+ if (P.state === "unroutable") return N !== `unroutable:${j}` || P.reason !== "orphan" ? f("route") : null;
41
+ if (P.state !== "resolved" || typeof P.path != "string" || N !== `path:${p(P.path)}` || !m(P.ancestors, y)) return f("route");
42
+ if (o(w, P).owner !== "cms") return null;
43
+ let F = [];
44
+ for (let e of [...y, v]) {
45
+ let t = await r(c, l, u.manifest.publication.id, d.contentType, e.locale, e.variantId, _);
46
+ if (t === null || t.documentId !== e.documentId || t.revisionId !== e.revisionId || t.revision !== e.revision) return f("publication");
47
+ F.push(t);
48
+ }
49
+ let I = A === null ? null : F.map((e) => typeof A.segment != "string" || typeof e[A.segment] != "string" ? f("definition") : (n({
50
+ id: "segment",
51
+ segments: [{ field: A.segment }]
52
+ }, e, { prefix: "" }), e[A.segment])), L = n(C, F.at(-1), {
53
+ prefix: D.prefix,
54
+ ...I === null ? {} : { treePath: I.join("/") }
55
+ });
56
+ return P.path === L ? {
57
+ output: {
58
+ routeId: j,
59
+ path: L,
60
+ mappingId: d.mappingId,
61
+ localeId: d.localeId,
62
+ requestedLocale: g.requestedLocale,
63
+ sourceLocale: v.locale,
64
+ fallback: v.locale !== g.requestedLocale
65
+ },
66
+ document: v,
67
+ ancestors: y,
68
+ schema: b,
69
+ route: P
70
+ } : f("route");
71
+ };
72
+ //#endregion
73
+ export { _ as readAdmittedCapturedAddress, g as readCapturedPublicAddress };
@@ -0,0 +1,71 @@
1
+ import { readRenderReadCredential as e } from "./renderReadAuthority.js";
2
+ import { copySnapshotConsentPurposes as t } from "./snapshotPresentation.js";
3
+ import { readAdmittedBuildSnapshot as n } from "./snapshotReadAdmission.js";
4
+ import { readSnapshotAppExecution as r, verifyRetainedSnapshotRoutes as i, verifySnapshotAppExecution as a } from "./snapshotAppExecution.js";
5
+ import { copySnapshotConsumer as o, issueSnapshotReadGrant as s } from "./snapshotConsumer.js";
6
+ import { Schema as c } from "effect";
7
+ import { canonicalJson as l } from "@voltro/runtime";
8
+ //#region src/snapshotAppConsumer.ts
9
+ var u = class extends c.TaggedError()("SnapshotAppConsumerUnavailable", { reason: c.Literals(["credential", "changed"]) }) {}, d = (e) => {
10
+ throw new u({ reason: e });
11
+ }, f = async (c, u, f, p) => {
12
+ let m = {
13
+ tenantId: u.tenantId,
14
+ site: u.site,
15
+ environment: u.environment
16
+ }, h = {
17
+ id: f.snapshot.id,
18
+ digest: f.snapshot.digest
19
+ }, g = f.apiKey, _ = f.resume === void 0 ? void 0 : {
20
+ token: f.resume.token,
21
+ buildId: f.resume.buildId
22
+ }, v = p.verificationKeys?.map((e) => ({
23
+ id: e.id,
24
+ material: new Uint8Array(e.material)
25
+ })), y = {
26
+ id: p.key.id,
27
+ material: new Uint8Array(p.key.material)
28
+ }, b = p.now ?? Date.now, x = p.execution.run.bind(p.execution);
29
+ if (typeof g != "string" || g.length === 0 || g.length > 512) return d("credential");
30
+ let S = await c.transactional(async (t) => {
31
+ let i = b();
32
+ if (!Number.isSafeInteger(i) || !Number.isFinite(new Date(i).getTime())) return d("credential");
33
+ let a = await e(t, m, g, i);
34
+ if (a === null || a.scopes.length === 0) return d("credential");
35
+ let s = await n(t, m, h, i), c = await r(t, m, s), l = o(c.declaration.value, i);
36
+ return a.scopes.includes(l.requiredScope) ? c : d("credential");
37
+ }), C = S.definitions.value;
38
+ if (typeof C != "object" || !C || Array.isArray(C) || !("consentPurposes" in C)) return d("changed");
39
+ let w = t(C.consentPurposes), T = await x({
40
+ inputsId: S.inputsId,
41
+ executionId: S.executionId,
42
+ exportName: "definitions",
43
+ inputJson: l({ app: S.app })
44
+ });
45
+ if (a(S, "definitions", { app: S.app }, T), l(T.value) !== l(S.definitions.value)) return d("changed");
46
+ await i(S, x);
47
+ let E = await x({
48
+ inputsId: S.inputsId,
49
+ executionId: S.executionId,
50
+ exportName: "describe",
51
+ inputJson: "null"
52
+ });
53
+ return a(S, "describe", null, E), l(E.value) === l(S.declaration.value) ? c.transactional(async (e) => {
54
+ let t = b(), i = o(S.declaration.value, t), a = await n(e, m, h, t), c = await r(e, m, a);
55
+ return l(c) === l(S) ? {
56
+ ...await s(e, m, {
57
+ apiKey: g,
58
+ snapshot: h,
59
+ ..._ === void 0 ? {} : { resume: _ }
60
+ }, {
61
+ key: y,
62
+ now: t,
63
+ consumer: i,
64
+ ...v === void 0 ? {} : { verificationKeys: v }
65
+ }),
66
+ consentPurposes: structuredClone(w)
67
+ } : d("changed");
68
+ }) : d("changed");
69
+ };
70
+ //#endregion
71
+ export { u as SnapshotAppConsumerUnavailable, f as issueSnapshotAppGrant };
@@ -0,0 +1,102 @@
1
+ import { readVerifiedSnapshotResource as e } from "./buildSnapshot.js";
2
+ import { copySnapshotAppCodePin as t } from "./snapshotDefinitions.js";
3
+ import { copyFrontendOutputContext as n } from "./frontendBindings.js";
4
+ import { coversSnapshotComponents as r } from "./snapshotFrontend.js";
5
+ import { matchesSnapshotApplication as i } from "./snapshotApplication.js";
6
+ import { Schema as a } from "effect";
7
+ import { createHash as o } from "node:crypto";
8
+ import { canonicalJson as s } from "@voltro/runtime";
9
+ //#region src/snapshotAppExecution.ts
10
+ var c = class extends a.TaggedError()("SnapshotAppUnavailable", { reason: a.Literals([
11
+ "app",
12
+ "receipt",
13
+ "declaration",
14
+ "definitions",
15
+ "renderer",
16
+ "routes"
17
+ ]) }) {}, l = (e) => {
18
+ throw new c({ reason: e });
19
+ }, u = (e) => typeof e == "string" && /^[a-f0-9]{64}$/.test(e), d = (e) => o("sha256").update(s(e)).digest("hex"), f = (e) => typeof e != "object" || !e || Array.isArray(e) ? l("app") : e, p = async (a, o, c, d, p = [], m) => {
20
+ if (c.manifest.parts.find((e) => e.part === "app")?.format !== "voltro.app.build-inputs/v1" || c.manifest.parts.find((e) => e.part === "schema")?.format !== "voltro.cms.schema/v1") return l("app");
21
+ let g = (await e(a, o, c, "app", "configuration")).value, _ = (await e(a, o, c, "schema", "registry")).value, v = f(g.execution), y = f(g.app), b = f(v.runtime);
22
+ if (g.version !== 1 || !u(g.inputsId) || v.version !== 1 || !u(v.id) || v.profile !== "voltro.node-bundle/v1" || !u(b.binaryDigest) || ![
23
+ "node",
24
+ "platform",
25
+ "arch"
26
+ ].every((e) => typeof b[e] == "string") || _.version !== 1 || s(y) !== s(_.app)) return l("app");
27
+ if (d !== void 0) {
28
+ let t = (await e(a, o, c, "schema", `type:${d}`)).value;
29
+ if (s(y) !== s(t.app)) return l("app");
30
+ }
31
+ let x = t({
32
+ commit: String(y.commit),
33
+ artifactDigest: String(y.artifactDigest),
34
+ configDigest: String(y.configDigest)
35
+ }), S = v.web === void 0 ? void 0 : f(v.web);
36
+ if (S !== void 0 && (Object.keys(S).sort().join(",") !== "id,namespace,version" || S.version !== 1 || !u(S.id) || !u(S.namespace) || v.nativePageEntry !== "pages.mjs")) return l("app");
37
+ let C = {
38
+ inputsId: g.inputsId,
39
+ executionId: v.id,
40
+ app: x,
41
+ runtime: b,
42
+ ...S === void 0 ? {} : { web: {
43
+ id: S.id,
44
+ namespace: S.namespace
45
+ } }
46
+ };
47
+ if (v.declaration === void 0) return l("declaration");
48
+ let w = f(v.declaration);
49
+ if (!Object.hasOwn(w, "value")) return l("app");
50
+ let T = {
51
+ value: w.value,
52
+ receipt: f(w.receipt)
53
+ };
54
+ if (h(C, "describe", null, T), v.definitions === void 0) return l("definitions");
55
+ let E = f(v.definitions);
56
+ if (!Object.hasOwn(E, "value")) return l("definitions");
57
+ let D = {
58
+ value: E.value,
59
+ receipt: f(E.receipt)
60
+ };
61
+ if (h(C, "definitions", { app: x }, D), v.routes === void 0) return l("routes");
62
+ let O = f(v.routes);
63
+ if (!Object.hasOwn(O, "value")) return l("routes");
64
+ let k = {
65
+ value: O.value,
66
+ receipt: f(O.receipt)
67
+ };
68
+ if (h(C, "__voltro_routes", null, k), !await i(a, o, c, D.value, x, k.value)) return l("definitions");
69
+ let A = D.value, j;
70
+ if (m !== void 0) {
71
+ let e = A.site.locales.find((e) => e.enabled && e.id === m.id && e.contentLocale === m.contentLocale);
72
+ if (e === void 0) return l("renderer");
73
+ j = n({
74
+ ...A.frontend.output,
75
+ localeId: e.id,
76
+ contentLocale: e.contentLocale,
77
+ languageTag: e.tag,
78
+ direction: e.direction
79
+ });
80
+ }
81
+ return r(A.frontend, p, j) ? {
82
+ ...C,
83
+ nativePages: v.nativePageEntry === "pages.mjs",
84
+ declaration: T,
85
+ definitions: D,
86
+ routes: k,
87
+ ...j === void 0 ? {} : { context: j }
88
+ } : l("renderer");
89
+ }, m = async (e, t) => {
90
+ let n = await t({
91
+ inputsId: e.inputsId,
92
+ executionId: e.executionId,
93
+ exportName: "__voltro_routes",
94
+ inputJson: "null"
95
+ });
96
+ if (h(e, "__voltro_routes", null, n), s(n.value) !== s(e.routes.value)) return l("routes");
97
+ }, h = (e, t, n, r) => {
98
+ let i = r.receipt;
99
+ return i.version !== 1 || i.profile !== "voltro.node-permission-json/v1" || i.inputsId !== e.inputsId || i.executionId !== e.executionId || i.exportName !== t || s(i.app) !== s(e.app) || s(i.runtime) !== s(e.runtime) || s(i.web ?? null) !== s(e.web ?? null) || i.inputDigest !== d(n) || i.resultDigest !== d(r.value) || !u(i.runnerDigest) ? l("receipt") : { runnerDigest: i.runnerDigest };
100
+ };
101
+ //#endregion
102
+ export { c as SnapshotAppUnavailable, p as readSnapshotAppExecution, m as verifyRetainedSnapshotRoutes, h as verifySnapshotAppExecution };
@@ -0,0 +1,75 @@
1
+ import { compileSiteDelivery as e } from "./siteDelivery.js";
2
+ import { readVerifiedSnapshotResource as t, snapshotStaticPartPin as n } from "./buildSnapshot.js";
3
+ import { compileSnapshotRouting as r, copySnapshotRoutingDefinition as i } from "./snapshotRouting.js";
4
+ import { copySnapshotAppCodePin as a, snapshotDefinitionSources as o } from "./snapshotDefinitions.js";
5
+ import { copySnapshotConsentPurposes as s } from "./snapshotPresentation.js";
6
+ import { snapshotPublicAccessSource as c } from "./snapshotPublicAccess.js";
7
+ import { snapshotProjectionSource as l } from "./snapshotProjection.js";
8
+ import { copySnapshotRenditionRequirements as u } from "./snapshotRenditions.js";
9
+ import { matchesSnapshotFrontend as d, snapshotFrontendFromManifest as f, snapshotFrontendManifest as p } from "./snapshotFrontend.js";
10
+ import { snapshotSiteConfiguration as m } from "./snapshotSite.js";
11
+ import { readCapturedSnapshotConsentPurposes as h } from "./snapshotPresentationPolicy.js";
12
+ import { canonicalJson as g } from "@voltro/runtime";
13
+ //#region src/snapshotApplication.ts
14
+ var _ = (t, r) => {
15
+ let d = a(r), { types: f } = t, p = {
16
+ ...o(f, d),
17
+ policies: c(f, d, t.access, t.consentPurposes),
18
+ projection: l(f, d, t.projection)
19
+ };
20
+ if (typeof t.xDefault != "boolean") throw TypeError("Snapshot xDefault must be a boolean");
21
+ return {
22
+ version: 2,
23
+ app: d,
24
+ parts: [
25
+ "schema",
26
+ "components",
27
+ "policies",
28
+ "projection"
29
+ ].map((e) => n(e, p[e])),
30
+ site: e(t.site).definition,
31
+ renditions: u(t.renditions),
32
+ xDefault: t.xDefault,
33
+ routing: i(t.routing),
34
+ consentPurposes: s(t.consentPurposes ?? [])
35
+ };
36
+ }, v = (e, t) => ({
37
+ ..._(e, t),
38
+ frontend: p(e.types, e.frontend, a(t), e.output)
39
+ }), y = (e, t, n) => ({
40
+ ..._(e, t),
41
+ frontend: e.frontend === void 0 ? f(e.types, n, a(t), e.output) : p(e.types, e.frontend, a(t), e.output)
42
+ }), b = async (e, n, i, a, o, c) => {
43
+ if (typeof a != "object" || !a || Array.isArray(a)) return !1;
44
+ let l = a, f, p, _;
45
+ try {
46
+ f = m(n, l.site, o), p = u(l.renditions), _ = s(l.consentPurposes);
47
+ } catch {
48
+ return !1;
49
+ }
50
+ if (typeof l.xDefault != "boolean" || g(a) !== g({
51
+ version: 2,
52
+ app: o,
53
+ parts: [
54
+ "schema",
55
+ "components",
56
+ "policies",
57
+ "projection"
58
+ ].map((e) => i.manifest.parts.find((t) => t.part === e)),
59
+ site: f.compiled.definition,
60
+ renditions: p,
61
+ xDefault: l.xDefault,
62
+ frontend: l.frontend,
63
+ routing: l.routing,
64
+ consentPurposes: _
65
+ }) || g(await h(e, n, i, o)) !== g(_) || !await d(e, n, i, l.frontend, o)) return !1;
66
+ let v = await t(e, n, i, "site", "configuration"), y = await t(e, n, i, "locales", "policy"), b = await t(e, n, i, "assets", "configuration"), x = await t(e, n, i, "seo", "configuration"), S = await t(e, n, i, "routes", "configuration");
67
+ try {
68
+ if (g(S.value.routing) !== g(r(l.routing, c, o))) return !1;
69
+ } catch {
70
+ return !1;
71
+ }
72
+ return g(v) === g(f.site) && g(y) === g(f.locales) && g(b.value.renditionRequirements) === g(p) && x.value.xDefault === l.xDefault;
73
+ };
74
+ //#endregion
75
+ export { b as matchesSnapshotApplication, _ as snapshotApplicationConfigurationPins, v as snapshotApplicationPins, y as snapshotCaptureApplicationPins };
@@ -0,0 +1,44 @@
1
+ import { copyOutputActivationScope as e, outputActivationHash as t } from "./outputActivation.js";
2
+ import { verifyPublicationState as n } from "./publicationState.js";
3
+ import { copySnapshotResource as r } from "./buildSnapshot.js";
4
+ import { routeDispositionFail as i } from "./routeDispositions.js";
5
+ import { iterateApprovedRouteDispositions as a, readApprovedRouteDispositionPage as o } from "./routeDispositionStore.js";
6
+ import { canonicalJson as s } from "@voltro/runtime";
7
+ import { Buffer as c } from "node:buffer";
8
+ //#region src/snapshotApprovedRouteDispositions.ts
9
+ var l = (l, u, d = Date.now()) => {
10
+ let f = e(u);
11
+ return {
12
+ format: "voltro.cms.approved-route-dispositions/v1",
13
+ entries: async function* (e) {
14
+ await n(l, f, e, d);
15
+ let u = await o(l, f, { take: 1 });
16
+ yield r({
17
+ key: "configuration",
18
+ value: {
19
+ version: 1,
20
+ ...f,
21
+ revision: u.revision,
22
+ count: u.count
23
+ }
24
+ });
25
+ let p = 0, m = 0;
26
+ for await (let e of a(l, f)) {
27
+ if (e.revision > u.revision || ++p > u.count) return i("state");
28
+ let n = r({
29
+ key: "url:" + t(e.definition.source.url),
30
+ value: {
31
+ version: 1,
32
+ ...f,
33
+ ...e
34
+ }
35
+ });
36
+ if (m += c.byteLength(s(n), "utf8"), m > 67108864) return i("bounds");
37
+ yield n;
38
+ }
39
+ if (p !== u.count) return i("state");
40
+ }
41
+ };
42
+ };
43
+ //#endregion
44
+ export { l as snapshotApprovedRouteDispositionsSource };
@@ -0,0 +1,70 @@
1
+ import { SnapshotSeoReadUnavailable as e } from "./snapshotSeoRead.js";
2
+ import { copySnapshotSeoDocumentsSelection as t } from "./snapshotSeoPathSets.js";
3
+ import { readSnapshotSeoDocuments as n } from "./snapshotSeoDocuments.js";
4
+ import { createHash as r } from "node:crypto";
5
+ import { canonicalJson as i } from "@voltro/runtime";
6
+ //#region src/snapshotAssetAssembly.ts
7
+ var a = () => {
8
+ throw new e({ reason: "binding" });
9
+ }, o = (e) => r("sha256").update(i(e)).digest("hex"), s = (e) => typeof e == "string" && /^[a-f0-9]{64}$/.test(e), c = (e) => {
10
+ let { store: r, provider: c } = e, l = { ...e.use }, u = {
11
+ tenantId: e.scope.tenantId,
12
+ site: e.scope.site,
13
+ environment: e.scope.environment
14
+ }, d = e.keys.map((e) => ({
15
+ id: e.id,
16
+ material: new Uint8Array(e.material)
17
+ })), f = e.now ?? Date.now;
18
+ return { render: async (e) => {
19
+ let p = {
20
+ snapshot: {
21
+ id: e.snapshot.id,
22
+ digest: e.snapshot.digest
23
+ },
24
+ token: e.token,
25
+ consumerId: e.consumerId,
26
+ buildId: e.buildId,
27
+ host: e.host
28
+ }, m = t(e.documents), h = c.composeAssets?.bind(c), g = c.read?.bind(c);
29
+ if (h === void 0 || g === void 0) return a();
30
+ let _ = () => r.transactional((e) => n(e, u, p, m, {
31
+ provider: c,
32
+ use: l,
33
+ keys: d,
34
+ now: f
35
+ })), v = await _(), y = v.paths.admission.app, b = v.inventory;
36
+ if (y.web === void 0) return a();
37
+ let x = await h({
38
+ snapshotDigest: p.snapshot.digest,
39
+ inputsId: y.inputsId,
40
+ executionId: y.executionId,
41
+ web: { ...y.web },
42
+ consentPurposes: b.consentPurposes,
43
+ presentations: b.presentations,
44
+ documents: b.records.map((e) => ({
45
+ url: e.url,
46
+ path: e.path,
47
+ routeId: e.routeId,
48
+ artifactId: e.artifactId,
49
+ presentation: e.presentation
50
+ }))
51
+ });
52
+ if (!s(x.id) || !Number.isSafeInteger(x.files) || x.files < 0 || !Number.isSafeInteger(x.bytes) || x.bytes < 0) return a();
53
+ let S = await g(x.id), C = S.manifest.subject;
54
+ if (S.id !== x.id || S.manifest.version !== 1 || o(S.manifest) !== x.id || S.manifest.files.length !== x.files || S.manifest.files.reduce((e, t) => e + t.size, 0) !== x.bytes || C.version !== 2 || C.profile !== "voltro.cms-public-assets/v2" || i(C.build) !== i({
55
+ snapshotDigest: p.snapshot.digest,
56
+ inputsId: y.inputsId,
57
+ executionId: y.executionId
58
+ }) || i(C.consentPurposes) !== i(b.consentPurposes) || i(C.presentations) !== i(b.presentations) || !s(C.webAssetsId)) return a();
59
+ let w = await g(C.webAssetsId), T = w.manifest.subject;
60
+ if (w.id !== C.webAssetsId || o(w.manifest) !== w.id || T.version !== 1 || T.profile !== "voltro.cms-client-assets/v1" || T.snapshotContent !== !1 || i(T.web) !== i(y.web) || T.source === null || typeof T.source != "object" || Reflect.get(T.source, "id") !== y.inputsId) return a();
61
+ let E = await _();
62
+ return i(E.inventory) !== i(v.inventory) || i(E.paths.selection) !== i(v.paths.selection) || i(E.paths.admission.context) !== i(v.paths.admission.context) ? a() : {
63
+ artifactId: x.id,
64
+ files: x.files,
65
+ bytes: x.bytes
66
+ };
67
+ } };
68
+ };
69
+ //#endregion
70
+ export { c as createSnapshotAssetAssembly };
@@ -0,0 +1,50 @@
1
+ import { cmsCredential as e, privateCmsHttpRoutes as t, privateCmsOperation as n } from "./privateCmsTransport.js";
2
+ import { CmsBuildSnapshotUnavailable as r } from "./buildSnapshotService.js";
3
+ import { Effect as i, Schema as a } from "effect";
4
+ import { strictInput as o } from "@voltro/protocol";
5
+ //#region src/snapshotAssetAssemblyRest.ts
6
+ var s = (s) => {
7
+ let c = {
8
+ namespace: "cms.snapshotAssets",
9
+ path: "/v1/cms/snapshot-assets",
10
+ operationPrefix: "cmsSnapshotAssets",
11
+ tags: ["CMS snapshot assets"],
12
+ error: r,
13
+ errorStatus: { CmsBuildSnapshotUnavailable: 409 },
14
+ credentialError: "CmsBuildSnapshotUnavailable"
15
+ }, l = a.Struct({
16
+ snapshot: a.Struct({
17
+ id: a.String,
18
+ digest: a.String
19
+ }),
20
+ consumerId: a.String,
21
+ buildId: a.String,
22
+ host: a.String,
23
+ documents: a.Struct({
24
+ artifactId: a.String,
25
+ pathSets: a.Array(a.Struct({
26
+ id: a.String,
27
+ digest: a.String
28
+ }))
29
+ })
30
+ }), u = [n(c, "render", "Compose private captured web and media assets", "Render-read bearer. The server verifies complete signed paths, every document and consent class, original renderer receipts and current media rights. Its fixed retained archive supplies the exact production web bytes. All physical bytes are rehashed through EOF and authority is rechecked after composition. No caller filesystem path or web asset identity is accepted. Returned artifact IDs confer no activation or serving authority.", o(l, c.namespace + ".render", !0), a.Struct({
31
+ artifactId: a.String,
32
+ files: a.Int,
33
+ bytes: a.Int
34
+ }), (t, n) => {
35
+ let a = e(n, c.credentialError);
36
+ return i.tryPromise({
37
+ try: () => s.render({
38
+ ...t,
39
+ token: a
40
+ }),
41
+ catch: () => new r({ reason: "render" })
42
+ });
43
+ })];
44
+ return {
45
+ routes: u,
46
+ httpRoutes: t(u)
47
+ };
48
+ };
49
+ //#endregion
50
+ export { s as cmsSnapshotAssetsRest };
@@ -0,0 +1,61 @@
1
+ import { readVerifiedSnapshotResource as e } from "./buildSnapshot.js";
2
+ import { copySnapshotPresentationValue as t } from "./snapshotPresentation.js";
3
+ import { admitSnapshotPublicDocument as n } from "./snapshotPublicAccess.js";
4
+ import { SnapshotRouteReadUnavailable as r } from "./snapshotRouteAdmission.js";
5
+ import { projectSnapshotDocument as i } from "./snapshotDocumentProjection.js";
6
+ import { readSnapshotRouteContext as a } from "./snapshotRouteRead.js";
7
+ import { canonicalJson as o } from "@voltro/runtime";
8
+ //#region src/snapshotBindingRead.ts
9
+ var s = () => {
10
+ throw new r({ reason: "binding" });
11
+ }, c = (e) => typeof e != "object" || !e || Array.isArray(e) ? s() : e, l = async (e, n, r, i, o) => {
12
+ let s = {
13
+ tenantId: n.tenantId,
14
+ site: n.site,
15
+ environment: n.environment
16
+ }, c = {
17
+ ...i,
18
+ presentation: t(i.presentation)
19
+ }, l = o.now ?? Date.now(), d = await a(e, s, r, c, {
20
+ ...o,
21
+ now: l
22
+ });
23
+ return d === null ? null : u(e, s, d, c.binding, l);
24
+ }, u = async (t, r, a, l, u) => {
25
+ let { snapshot: d, output: f } = a;
26
+ if (typeof l != "string" || l.length === 0 || l.length > 256 || /[\x00-\x1f\x7f]/.test(l)) return s();
27
+ let p = (await e(t, r, d, "site", "configuration")).value, m = c(c(p.definition).bindings);
28
+ if (!Object.hasOwn(m, l)) return null;
29
+ let h = m[l];
30
+ if (typeof h != "string" || h.length === 0) return s();
31
+ let g = (await e(t, r, d, "site", `binding:${l}`)).value, _ = c(g.binding);
32
+ if (g.version !== 3 || g.definitionDigest !== p.definitionDigest || g.tenantId !== r.tenantId || g.site !== r.site || g.environment !== r.environment || _.contentType !== h || typeof _.documentId != "string") return s();
33
+ let v = await n(t, r, d, h, f.localeId, _.documentId, u);
34
+ if (v === null) return null;
35
+ let y = v.chain[0], b = (await e(t, r, d, "site", `binding:${l}:locale:${y.locale}`)).value, x = c(b.variant);
36
+ if (b.version !== 3 || b.locale !== y.locale || b.documentId !== y.documentId || x.id !== y.variantId || x.revisionId !== y.revisionId || x.revision !== y.revision) return s();
37
+ let S = (await e(t, r, d, "schema", `type:${h}`)).value;
38
+ if (o(S.app) !== o(p.app)) return s();
39
+ let { values: C, components: w, presentation: T } = await i(t, r, d, h, y, S, u, a.output.presentation);
40
+ return {
41
+ snapshot: d,
42
+ document: y,
43
+ binding: a.binding,
44
+ routeId: f.routeId,
45
+ components: w,
46
+ output: {
47
+ snapshotId: d.id,
48
+ snapshotDigest: d.digest,
49
+ binding: l,
50
+ contentType: h,
51
+ localeId: f.localeId,
52
+ requestedLocale: v.requestedLocale,
53
+ sourceLocale: y.locale,
54
+ fallback: y.locale !== v.requestedLocale,
55
+ values: C,
56
+ presentation: T
57
+ }
58
+ };
59
+ }, d = async (...e) => (await l(...e))?.output ?? null;
60
+ //#endregion
61
+ export { u as readAdmittedSnapshotBindingContext, d as readSnapshotBinding, l as readSnapshotBindingContext };