@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,178 @@
1
+ import { admitSnapshotPresentation as e, copySnapshotConsentPurposes as t } from "./snapshotPresentation.js";
2
+ import { copySnapshotContentIdentity as n } from "./snapshotContentIdentity.js";
3
+ import { snapshotProjectedValue as r } from "./snapshotObservation.js";
4
+ import { createHash as i } from "node:crypto";
5
+ import { canonicalJson as a } from "@voltro/runtime";
6
+ //#region src/snapshotRenderDependencies.ts
7
+ var o = () => {
8
+ throw Error("Snapshot dependencies unavailable");
9
+ }, s = (e) => i("sha256").update(a(e)).digest("hex"), c = (e) => typeof e != "object" || !e || Array.isArray(e) ? o() : e, l = (e, t) => a(e) === a(t), u = (e, t) => e.length > t.length && t.every((t, n) => t === e[n]), d = (i) => {
10
+ if (i.data.version !== 6 || i.references.version !== 4 || !l(i.data.presentation, e(i.data.consentPurposes, i.data.presentation)) || !l(i.data.consentPurposes, t(i.data.consentPurposes)) || !l(i.data.content, n(i.content)) || !l(Object.keys(i.bindings).sort(), Object.keys(i.data.bindings).sort()) || !l(Object.keys(i.references.nodes).sort(), Object.keys(i.referenceGraph.nodes).sort()) || !l(i.references.edges, i.referenceGraph.edges) || !l(i.references.addresses, i.addressGraph.map((e) => ({
11
+ source: e.source,
12
+ fieldPath: e.fieldPath,
13
+ path: e.target?.output.path ?? null
14
+ })))) return o();
15
+ let d = /* @__PURE__ */ new Map(), f = c(i.observations);
16
+ if (Object.keys(f).sort().join(",") !== "coverage,events,selectiveReuse,version" || f.version !== 5 || f.coverage !== "framework-observations" || f.selectiveReuse !== !1 || !Array.isArray(f.events) || f.events.length > 4096) return o();
17
+ let p = [], m = s(i.data.context), h = "";
18
+ for (let e of f.events) {
19
+ let t = c(e), n = t.kind, f = t.fieldPath, m = a(t), g = n === "component" ? "componentId,contextDigest,fieldPath,handler,kind,renderer,source,valueDigest" : n === "media" ? "contextDigest,fieldPath,kind,output,source,valueDigest" : n === "rich-document" || n === "reference" || n === "link" ? "contextDigest,fieldPath,kind,source,valueDigest" : "";
20
+ if (g === "" || Object.keys(t).sort().join(",") !== g || m <= h || !Array.isArray(f) || f.some((e) => typeof e == "number" ? !Number.isSafeInteger(e) || e < 0 : typeof e != "string" || e.length === 0 || e.length > 256)) return o();
21
+ h = m;
22
+ let _ = t.source;
23
+ if (_ !== null && (typeof _ != "string" || !Object.hasOwn(i.bindings, _) && !Object.hasOwn(i.referenceGraph.nodes, _))) return o();
24
+ let v = typeof _ == "string" && Object.hasOwn(i.referenceGraph.nodes, _), y = _ === null ? i.data : v ? i.references.nodes[_] : i.data.bindings[_], b = _ === null ? {
25
+ dependencies: i.fields,
26
+ content: i.content
27
+ } : v ? i.referenceGraph.nodes[_]?.fields : i.bindings[_];
28
+ if (y == null || b == null) return o();
29
+ let x = r(y, f);
30
+ if (t.valueDigest !== s(x) || t.contextDigest !== s(y.context)) return o();
31
+ if (n === "reference") {
32
+ let e = i.referenceGraph.edges.find((e) => e.source === _ && l(e.fieldPath, f));
33
+ if (e === void 0) return o();
34
+ let n = e.target === null ? null : i.references.nodes[e.target], r = e.target === null ? null : i.referenceGraph.nodes[e.target]?.fields;
35
+ if (n === void 0 || r === void 0) return o();
36
+ let c = {
37
+ source: _,
38
+ fieldPath: f
39
+ }, u = s(n);
40
+ d.set("reference:" + a(c), {
41
+ tag: "cms.snapshot.reference",
42
+ inputDigest: s(c),
43
+ valueDigest: u
44
+ }), p.push({
45
+ ...t,
46
+ target: e.target,
47
+ targetContent: r?.content ?? null,
48
+ targetDigest: u
49
+ });
50
+ continue;
51
+ }
52
+ if (n === "link") {
53
+ let e = i.addressGraph.find((e) => e.source === _ && l(e.fieldPath, f));
54
+ if (e === void 0) return o();
55
+ let n = {
56
+ source: _,
57
+ fieldPath: f
58
+ }, r = s(e.target?.output.path ?? null);
59
+ d.set("link:" + a(n), {
60
+ tag: "cms.snapshot.link",
61
+ inputDigest: s(n),
62
+ valueDigest: r
63
+ }), p.push({
64
+ ...t,
65
+ mappingId: e.mappingId,
66
+ targetDigest: r,
67
+ targetRoute: e.target?.output ?? null,
68
+ targetContent: e.target?.document ?? null
69
+ });
70
+ continue;
71
+ }
72
+ if (n === "media") {
73
+ let e = y.media.find((e) => l(e.fieldPath, f) && l(e.output, t.output)), n = i.assets.find((e) => e.source === _ && l(e.selection.fieldPath, f) && l(e.selection.output, t.output));
74
+ if (e === void 0 || n === void 0) return o();
75
+ p.push({
76
+ ...t,
77
+ binaryId: n.binaryId,
78
+ checksum: n.checksum,
79
+ assetVersionId: n.assetVersionId
80
+ });
81
+ continue;
82
+ }
83
+ let S = b.dependencies.find((e) => e.kind === n && l(e.path, f));
84
+ if (S === void 0) return o();
85
+ if (S.kind === "rich-document") {
86
+ let e = b.dependencies.filter((e) => e.kind === "token" && u(e.path, f) && !b.dependencies.some((t) => t.kind === "component" && u(e.path, [...t.path, "props"])));
87
+ p.push({
88
+ ...t,
89
+ definitionDigest: S.digest,
90
+ tokenInputs: e.map((e) => ({
91
+ ...e,
92
+ valueDigest: s(r(y, e.path))
93
+ }))
94
+ });
95
+ continue;
96
+ }
97
+ if (S.kind !== "component") return o();
98
+ let C = i.frontend.components.find((e) => e.id === S.componentId), w = c(x), T = t.handler;
99
+ if (C === void 0 || C.digest !== S.digest || C.renderer !== t.renderer || S.componentId !== t.componentId || w.componentId !== S.componentId || w.fingerprint !== S.fingerprint || (S.consent !== null && !i.data.presentation.granted.some((e) => e.id === S.consent) ? T !== "restricted" || C.restricted === null || Object.keys(c(w.props)).length !== 0 : ![
100
+ "render",
101
+ "empty",
102
+ "loading",
103
+ "error"
104
+ ].includes(String(T)))) return o();
105
+ let E = T === "render" ? b.dependencies.filter((e) => e.kind === "token" && u(e.path, [...f, "props"])) : [];
106
+ p.push({
107
+ ...t,
108
+ definitionDigest: S.digest,
109
+ implementationDigest: s(C[T]),
110
+ tokenInputs: E.map((e) => ({
111
+ ...e,
112
+ valueDigest: s(r(y, e.path))
113
+ }))
114
+ });
115
+ }
116
+ let g = /* @__PURE__ */ new Set([null, ...Object.keys(i.bindings)]);
117
+ for (let e = 0; e <= Object.keys(i.referenceGraph.nodes).length; e++) {
118
+ let e = !1;
119
+ for (let t of p) t.kind === "reference" && g.has(t.source) && typeof t.target == "string" && !g.has(t.target) && (g.add(t.target), e = !0);
120
+ if (!e) break;
121
+ }
122
+ if (p.some((e) => !g.has(e.source))) return o();
123
+ let _ = [...d].sort(([e], [t]) => e < t ? -1 : +(e > t)).map(([, e]) => e);
124
+ return l(i.referenceReads, _) ? {
125
+ version: 6,
126
+ coverage: "framework-observations",
127
+ selectiveReuse: !1,
128
+ inputs: {
129
+ snapshotDigest: i.snapshotDigest,
130
+ inputsId: i.inputsId,
131
+ executionId: i.executionId,
132
+ routeId: i.routeId,
133
+ path: i.data.path,
134
+ contextDigest: m,
135
+ presentation: i.data.presentation,
136
+ consentPurposes: i.data.consentPurposes,
137
+ content: i.content,
138
+ contentDigest: s(i.data.values),
139
+ deliveryDigest: s(i.data),
140
+ addresses: i.addressGraph.map((e) => ({
141
+ source: e.source,
142
+ fieldPath: e.fieldPath,
143
+ mappingId: e.mappingId,
144
+ target: e.target === null ? null : {
145
+ address: e.target.output,
146
+ content: e.target.document,
147
+ ancestors: e.target.ancestors,
148
+ definitionDigest: s(e.target.schema),
149
+ routeDigest: s(e.target.route)
150
+ }
151
+ })),
152
+ references: {
153
+ deliveryDigest: s(i.references),
154
+ edges: i.references.edges,
155
+ nodes: Object.fromEntries(Object.entries(i.referenceGraph.nodes).map(([e, t]) => {
156
+ let r = i.references.nodes[e];
157
+ return r === void 0 || !l(r.content, n(t.fields.content)) || !l(r.values, t.output.values) || r.sourceLocale !== t.output.sourceLocale || r.fallback !== t.output.fallback || !l(r.context, i.data.context) || !l(r.presentation, t.output.presentation) || !l(r.presentation, i.data.presentation) || !l(r.consentPurposes, i.data.consentPurposes) ? o() : [e, {
158
+ content: t.fields.content,
159
+ contextDigest: s(r.context),
160
+ contentDigest: s(r.values),
161
+ deliveryDigest: s(r)
162
+ }];
163
+ }))
164
+ },
165
+ bindings: Object.fromEntries(Object.entries(i.bindings).map(([e, t]) => {
166
+ let r = i.data.bindings[e];
167
+ return !Object.hasOwn(i.data.bindings, e) || t === null != (r === null) || t !== null && r != null && (!l(r.content, n(t.content)) || !l(r.presentation, i.data.presentation) || !l(r.consentPurposes, i.data.consentPurposes)) ? o() : [e, r == null || t === null ? null : {
168
+ content: t.content,
169
+ contextDigest: s(r.context),
170
+ contentDigest: s(r.values)
171
+ }];
172
+ }))
173
+ },
174
+ events: p
175
+ } : o();
176
+ };
177
+ //#endregion
178
+ export { d as snapshotRenderDependencies };
@@ -0,0 +1,88 @@
1
+ import { readPublicationBoundary as e } from "./changes.js";
2
+ import { copySnapshotResource as t } from "./buildSnapshot.js";
3
+ import { readAssetRendition as n, readAssetRenditionSelection as r } from "./assetRenditions.js";
4
+ import { Schema as i } from "effect";
5
+ import { canonicalJson as a } from "@voltro/runtime";
6
+ //#region src/snapshotRenditions.ts
7
+ var o = class extends i.TaggedError()("SnapshotRenditionUnavailable", { reason: i.Literals([
8
+ "configuration",
9
+ "publication",
10
+ "missing",
11
+ "asset",
12
+ "recipe"
13
+ ]) }) {}, s = (e) => {
14
+ throw new o({ reason: e });
15
+ }, c = (e) => typeof e == "string" && e.length > 0 && e.length <= 128 && e.trim() === e, l = (e) => typeof e == "string" && /^[a-f0-9]{64}$/.test(e), u = (e, t) => {
16
+ let { definitionDigest: n, ...r } = e, { definitionDigest: i, ...o } = t;
17
+ return a(r) === a(o);
18
+ }, d = (e) => {
19
+ if (!Array.isArray(e) || e.length > 64) return s("configuration");
20
+ let t = e.map((e) => !e || !c(e.contentType) || e.contentType.length > 64 || !c(e.slot) || e.slot.length > 64 || !e.recipe || !c(e.recipe.format) || !l(e.recipe.digest) || !e.engine || !c(e.engine.name) || !c(e.engine.version) || !l(e.engine.digest) ? s("configuration") : {
21
+ contentType: e.contentType,
22
+ slot: e.slot,
23
+ recipe: {
24
+ format: e.recipe.format,
25
+ digest: e.recipe.digest
26
+ },
27
+ engine: {
28
+ name: e.engine.name,
29
+ version: e.engine.version,
30
+ digest: e.engine.digest
31
+ }
32
+ }).sort((e, t) => {
33
+ let n = a([e.contentType, e.slot]), r = a([t.contentType, t.slot]);
34
+ return n < r ? -1 : +(n > r);
35
+ });
36
+ return new Set(t.map((e) => a([e.contentType, e.slot]))).size === t.length ? t : s("configuration");
37
+ }, f = (i, o, c, l) => {
38
+ let f = {
39
+ tenantId: o.tenantId,
40
+ site: o.site,
41
+ environment: o.environment
42
+ };
43
+ if (c.format !== "voltro.cms.media-uses/v1") return s("configuration");
44
+ let p = d(l);
45
+ return {
46
+ format: "voltro.cms.media-renditions/v1",
47
+ entries: async function* (o) {
48
+ let l = await e(i, f);
49
+ if (l.generation !== o.generation || l.releaseId !== o.releaseId || l.checkpoint !== o.checkpoint) return s("publication");
50
+ for await (let e of c.entries(o)) {
51
+ if (e.key === "configuration") {
52
+ let n = e.value.types;
53
+ if (!Array.isArray(n) || p.some((e) => !n.includes(e.contentType))) return s("configuration");
54
+ yield t({
55
+ ...e,
56
+ value: {
57
+ ...e.value,
58
+ renditionRequirements: p
59
+ }
60
+ });
61
+ continue;
62
+ }
63
+ let o = e.value.assetRevision, c = [];
64
+ if (o !== void 0) for (let e of p.filter((e) => e.contentType === o.contentType)) {
65
+ let t = await r(i, f, o.versionId, e.slot);
66
+ if (t === null || t.renditionId === null) return s("missing");
67
+ let l = await n(i, f, t.renditionId);
68
+ if (!u(o, l.asset)) return s("asset");
69
+ let d = l.output.renditionProof;
70
+ if (a(d.recipe) !== a(e.recipe) || a(d.engine) !== a(e.engine)) return s("recipe");
71
+ c.push({
72
+ selection: t,
73
+ rendition: l
74
+ });
75
+ }
76
+ yield t({
77
+ ...e,
78
+ value: {
79
+ ...e.value,
80
+ renditions: c
81
+ }
82
+ });
83
+ }
84
+ }
85
+ };
86
+ };
87
+ //#endregion
88
+ export { o as SnapshotRenditionUnavailable, d as copySnapshotRenditionRequirements, f as snapshotRenditionsSource };
@@ -0,0 +1,62 @@
1
+ import { richDocumentProblems as e } from "./richDocument.js";
2
+ import { createFrontendMediaReader as t } from "./frontendMedia.js";
3
+ import { snapshotObserver as n, snapshotProjectedValue as r } from "./snapshotObservation.js";
4
+ import { renderSnapshotComponent as i } from "./snapshotComponent.js";
5
+ //#region src/snapshotRichDocument.ts
6
+ var a = () => {
7
+ throw Error("Snapshot rich document unavailable");
8
+ }, o = (o, s, c) => {
9
+ let l = r(o, s), u = n(o), d = [...s];
10
+ if (typeof l != "object" || !l || Array.isArray(l)) return a();
11
+ let f = l;
12
+ if (f.type !== "doc" || !Array.isArray(f.blocks)) return a();
13
+ let p = f.blocks.map((e) => {
14
+ if (typeof e != "object" || !e || Array.isArray(e)) return a();
15
+ let t = e;
16
+ if (t.type !== "component" || t.consentRequired === void 0) return t;
17
+ if (c.bindings[String(t.componentId)]?.schema.consent !== t.consentRequired || t.props === null || typeof t.props != "object" || Object.keys(t.props).length !== 0) return a();
18
+ let { consentRequired: n, ...r } = t;
19
+ return r;
20
+ }), m = {
21
+ ...f,
22
+ blocks: p
23
+ };
24
+ if (e("", m, {
25
+ images: "*",
26
+ links: "*"
27
+ }).some((e) => e.rule === "type" || e.rule === "unknown")) return a();
28
+ u({
29
+ kind: "rich-document",
30
+ fieldPath: d
31
+ });
32
+ let h = t(o.media, d, (e) => u({
33
+ kind: "media",
34
+ ...e
35
+ })), g = (e, t = { kind: "original" }) => h([
36
+ "blocks",
37
+ e,
38
+ "asset"
39
+ ], t) ?? a();
40
+ return {
41
+ document: m,
42
+ hrefOf: (e, { fieldPath: t }) => c.hrefOf?.([...d, ...t]) ?? void 0,
43
+ contactHrefOf: (e, { fieldPath: t }) => c.contactHrefOf?.([...d, ...t]) ?? void 0,
44
+ renderImage: (e, { index: t }) => c.renderImage(e, g(t, c.imageOutput), {
45
+ index: t,
46
+ fieldPath: [
47
+ ...d,
48
+ "blocks",
49
+ t,
50
+ "asset"
51
+ ]
52
+ }),
53
+ fileHrefOf: (e, { index: t }) => g(t).url,
54
+ renderComponent: (e, { index: t }) => i(o, c.bindings, [
55
+ ...d,
56
+ "blocks",
57
+ t
58
+ ])
59
+ };
60
+ };
61
+ //#endregion
62
+ export { o as snapshotRichDocumentProps };
@@ -0,0 +1,106 @@
1
+ import { SnapshotSeoReadUnavailable as e } from "./snapshotSeoRead.js";
2
+ import { copySnapshotSeoDocumentsSelection as t } from "./snapshotSeoPathSets.js";
3
+ import { readSnapshotSeoDocuments as n, snapshotOutputSafetyBinding as r } from "./snapshotSeoDocuments.js";
4
+ import { readCurrentOutputSafetyArtifact as i } from "./outputSafetyArtifact.js";
5
+ import { readSnapshotSeoOutputArtifact as a } from "./snapshotSeoOutput.js";
6
+ import { readSnapshotRedirectOutputArtifact as o } from "./snapshotRedirectOutput.js";
7
+ import { createSnapshotOutputBatch as s, createSnapshotOutputTransfer as c } from "./snapshotOutputTransfer.js";
8
+ import { canonicalJson as l } from "@voltro/protocol";
9
+ //#region src/snapshotRoleTransfer.ts
10
+ var u = () => {
11
+ throw new e({ reason: "binding" });
12
+ }, d = (e) => {
13
+ let { store: d, provider: f, declaration: p, maxBytes: m } = e, h = { ...e.scope }, g = { ...e.use }, _ = e.keys.map((e) => ({
14
+ id: e.id,
15
+ material: new Uint8Array(e.material)
16
+ })), v = e.now ?? Date.now;
17
+ if (!Number.isSafeInteger(m) || m < 1) return u();
18
+ let y = f.readAssets?.bind(f), b = async (e, s) => {
19
+ let c = structuredClone(e), { role: b, id: x } = c;
20
+ if (![
21
+ "assets",
22
+ "deny",
23
+ "redirects",
24
+ "sitemap",
25
+ "robots"
26
+ ].includes(b) || !/^[a-f0-9]{64}$/.test(x) || !Array.isArray(c.targets) || b !== "redirects" && c.targets.length !== 0 || (["assets", "deny"].includes(b) ? c.safety !== null : c.safety === null)) return u();
27
+ let S = {
28
+ snapshot: { ...c.snapshot },
29
+ token: c.token,
30
+ consumerId: c.consumerId,
31
+ buildId: c.buildId,
32
+ host: c.host
33
+ }, C = t(c.documents), w = (e) => n(e, h, S, C, {
34
+ provider: f,
35
+ use: g,
36
+ keys: _,
37
+ now: v
38
+ }), T = async () => {
39
+ if (b === "assets") {
40
+ if (y === void 0) return u();
41
+ let e = await d.transactional(w), t = e.paths.admission.app, n = e.inventory;
42
+ if (t.web === void 0) return u();
43
+ let r = await y({
44
+ id: x,
45
+ snapshotDigest: S.snapshot.digest,
46
+ inputsId: t.inputsId,
47
+ executionId: t.executionId,
48
+ web: { ...t.web },
49
+ consentPurposes: n.consentPurposes,
50
+ presentations: n.presentations,
51
+ documents: n.records.map((e) => ({
52
+ url: e.url,
53
+ path: e.path,
54
+ routeId: e.routeId,
55
+ artifactId: e.artifactId,
56
+ presentation: e.presentation
57
+ }))
58
+ }), i = await d.transactional(w);
59
+ return l(e.inventory) !== l(i.inventory) || l(e.paths.selection) !== l(i.paths.selection) || l(e.paths.admission.context) !== l(i.paths.admission.context) ? u() : r;
60
+ }
61
+ if (b === "deny") return (await i(d, h, x, {
62
+ provider: f,
63
+ maxBytes: m,
64
+ admit: async (e) => r(await w(e))
65
+ })).artifact;
66
+ if (c.safety === null) return u();
67
+ let e = {
68
+ ...S,
69
+ documents: C,
70
+ safety: { ...c.safety }
71
+ };
72
+ return b === "redirects" ? p === void 0 ? u() : o(d, h, S.snapshot, {
73
+ ...e,
74
+ id: x,
75
+ targets: c.targets
76
+ }, {
77
+ declaration: p,
78
+ provider: f,
79
+ use: g,
80
+ keys: _,
81
+ maxBytes: m,
82
+ now: v
83
+ }) : a(d, h, S.snapshot, {
84
+ ...e,
85
+ id: x,
86
+ kind: b
87
+ }, {
88
+ provider: f,
89
+ use: g,
90
+ keys: _,
91
+ maxBytes: m,
92
+ now: v
93
+ });
94
+ }, E = await T(), D = 0;
95
+ for (let e of E.manifest.files) if (!Number.isSafeInteger(e.size) || e.size < 0 || (D += e.size, !Number.isSafeInteger(D) || D > m)) return u();
96
+ if (E.id !== x) return u();
97
+ let O = await s(E), k = await T();
98
+ return l(k) === l(E) ? O : u();
99
+ };
100
+ return {
101
+ ...c(f, b),
102
+ readBatch: s(f, b)
103
+ };
104
+ };
105
+ //#endregion
106
+ export { d as createSnapshotRoleTransfer };
@@ -0,0 +1,99 @@
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/snapshotRoleTransferRest.ts
6
+ var s = (s) => {
7
+ let c = {
8
+ namespace: "cms.roleTransfer",
9
+ path: "/v1/cms/role-transfer",
10
+ operationPrefix: "cmsRoleTransfer",
11
+ tags: ["CMS private output role transfer"],
12
+ error: r,
13
+ errorStatus: { CmsBuildSnapshotUnavailable: 409 },
14
+ credentialError: "CmsBuildSnapshotUnavailable"
15
+ }, l = a.Struct({
16
+ path: a.String,
17
+ digest: a.String,
18
+ size: a.Int,
19
+ contentType: a.String
20
+ }), u = a.Struct({
21
+ offset: a.Int,
22
+ size: a.Int,
23
+ digest: a.String
24
+ }), d = a.Struct({
25
+ artifactId: a.String,
26
+ pathSets: a.Array(a.Struct({
27
+ id: a.String,
28
+ digest: a.String
29
+ }))
30
+ }), f = a.Struct({
31
+ snapshot: a.Struct({
32
+ id: a.String,
33
+ digest: a.String
34
+ }),
35
+ consumerId: a.String,
36
+ buildId: a.String,
37
+ host: a.String,
38
+ id: a.String,
39
+ documents: d,
40
+ role: a.Literals([
41
+ "assets",
42
+ "deny",
43
+ "redirects",
44
+ "sitemap",
45
+ "robots"
46
+ ]),
47
+ safety: a.NullOr(a.Struct({ artifactId: a.String })),
48
+ targets: a.Array(a.Struct({
49
+ host: a.String,
50
+ documents: d
51
+ }))
52
+ }), p = "Render-read bearer; complete signed paths, original document receipts, current media rights and grant are admitted before and after every provider read. The exact role is independently reconstructed from original retained assets or current safety, route history and SEO controls. Metadata and bytes are private; they grant no activation or serving authority. No hidden renewal or retry.", m = (e) => i.tryPromise({
53
+ try: e,
54
+ catch: () => new r({ reason: "render" })
55
+ }), h = [
56
+ n(c, "manifest", "Read a private admitted output role manifest", p, o(f, c.namespace + ".manifest", !0), a.Struct({
57
+ id: a.String,
58
+ manifest: a.Struct({
59
+ version: a.Literal(1),
60
+ subject: a.Record(a.String, a.Unknown),
61
+ files: a.Array(l)
62
+ })
63
+ }), (t, n) => m(() => s.read({
64
+ ...t,
65
+ token: e(n, c.credentialError)
66
+ }))),
67
+ n(c, "file", "Plan bounded private output role chunks", p, o(a.Struct({
68
+ ...f.fields,
69
+ path: a.String
70
+ }), c.namespace + ".file", !0), a.Struct({
71
+ file: l,
72
+ chunks: a.Array(u)
73
+ }), (t, n) => m(() => s.planFile({
74
+ ...t,
75
+ token: e(n, c.credentialError)
76
+ }))),
77
+ n(c, "chunk", "Read a verified private output role chunk", p, o(a.Struct({
78
+ ...f.fields,
79
+ file: l,
80
+ chunk: u
81
+ }), c.namespace + ".chunk", !0), a.Struct({ base64: a.String }), (t, n) => m(async () => ({ base64: Buffer.from(await s.readChunk({
82
+ ...t,
83
+ token: e(n, c.credentialError)
84
+ })).toString("base64") }))),
85
+ n(c, "batch", "Read one bounded batch of complete private output files", p, o(a.Struct({
86
+ ...f.fields,
87
+ files: a.Array(l).check(a.isMinLength(1), a.isMaxLength(200))
88
+ }), c.namespace + ".batch", !0), a.Struct({ base64: a.String }), (t, n) => m(async () => ({ base64: Buffer.from(await s.readBatch({
89
+ ...t,
90
+ token: e(n, c.credentialError)
91
+ })).toString("base64") })))
92
+ ];
93
+ return {
94
+ routes: h,
95
+ httpRoutes: t(h)
96
+ };
97
+ };
98
+ //#endregion
99
+ export { s as cmsSnapshotRoleTransferRest };
@@ -0,0 +1,71 @@
1
+ import { normalizeHost as e } from "./domainHost.js";
2
+ import { findVerifiedSnapshotResource as t, readVerifiedSnapshotResource as n } from "./buildSnapshot.js";
3
+ import { contentRouteId as r } from "./contentRouteIdentity.js";
4
+ import { admitSnapshotPresentation as i, copySnapshotPresentationValue as a } from "./snapshotPresentation.js";
5
+ import { readCapturedSnapshotConsentPurposes as o } from "./snapshotPresentationPolicy.js";
6
+ import { resolveSnapshotReadBinding as s } from "./snapshotReadAdmission.js";
7
+ import { verifyRenderReadGrant as c } from "./renderReadGrant.js";
8
+ import { Schema as l } from "effect";
9
+ import { createHash as u } from "node:crypto";
10
+ import { canonicalJson as d } from "@voltro/runtime";
11
+ //#region src/snapshotRouteAdmission.ts
12
+ var f = class extends l.TaggedError()("SnapshotRouteReadUnavailable", { reason: l.Literals([
13
+ "binding",
14
+ "host",
15
+ "path",
16
+ "route",
17
+ "definition",
18
+ "publication",
19
+ "bounds",
20
+ "projection",
21
+ "owner"
22
+ ]) }) {}, p = (e) => {
23
+ throw new f({ reason: e });
24
+ }, m = (e) => u("sha256").update(d(e)).digest("hex"), h = (e) => typeof e == "string" && e.length > 0, g = (e, t, n) => {
25
+ let { contentType: i, documentId: a, localeId: o, mappingId: s } = n;
26
+ if (![
27
+ i,
28
+ a,
29
+ o,
30
+ s
31
+ ].every(h) || n.version !== 1 || n.state !== "resolved" || n.path !== t || n.tenantId !== e.tenantId || n.site !== e.site || n.environment !== e.environment || n.routeId !== r(e, String(o), String(i), String(a), String(s))) return p("route");
32
+ }, _ = async (r, l, u, d, f) => {
33
+ let h = f.now ?? Date.now(), _ = {
34
+ tenantId: l.tenantId,
35
+ site: l.site,
36
+ environment: l.environment
37
+ }, v = {
38
+ ...d,
39
+ presentation: a(d.presentation)
40
+ }, y = f.keys.map((e) => ({
41
+ id: e.id,
42
+ material: new Uint8Array(e.material)
43
+ })), b = {
44
+ id: u.id,
45
+ digest: u.digest
46
+ }, { snapshot: x, binding: S } = await s(r, _, b, v, h);
47
+ await c(r, v.token, S, {
48
+ keys: y,
49
+ now: h
50
+ });
51
+ let C = typeof v.host == "string" ? e(v.host) : null;
52
+ if (C === null) return p("host");
53
+ let w = (await t(r, _, x, "domains", C))?.value;
54
+ if (w === void 0 || w.version !== 1 || w.host !== C || w.tenantId !== _.tenantId || w.site !== _.site) return p("host");
55
+ if (typeof v.path != "string" || !v.path.startsWith("/") || v.path.startsWith("//") || v.path.length > 4096 || /[\x00-\x20\x7f\\?#]/.test(v.path) || new URL(v.path, `https://${C}`).pathname !== v.path) return p("path");
56
+ let T = (await t(r, _, x, "routes", `path:${m(v.path)}`))?.value;
57
+ T !== void 0 && g(_, v.path, T);
58
+ let E = (await n(r, _, x, "routes", "configuration")).value, D = await o(r, _, x, E.app);
59
+ return {
60
+ snapshot: x,
61
+ binding: S,
62
+ place: _,
63
+ input: v,
64
+ route: T,
65
+ configuration: E,
66
+ presentation: i(D, v.presentation),
67
+ now: h
68
+ };
69
+ };
70
+ //#endregion
71
+ export { f as SnapshotRouteReadUnavailable, _ as readSnapshotRouteAdmission, g as verifySnapshotContentRoute };