@voltro/cms 0.86.0 → 0.88.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (243) hide show
  1. package/CHANGELOG.md +5484 -0
  2. package/README.md +138 -0
  3. package/THIRD-PARTY-NOTICES.md +1511 -276
  4. package/dist/ContentForm.js +1 -2
  5. package/dist/RichDocumentEditor.js +1 -2
  6. package/dist/RichDocumentView.js +82 -38
  7. package/dist/RichTextSurface.js +1 -2
  8. package/dist/aiCandidates.js +4 -5
  9. package/dist/aiOperations.js +1 -2
  10. package/dist/applicationBuildSnapshotService.js +100 -0
  11. package/dist/assetRenditions.js +101 -0
  12. package/dist/assetRevision.js +45 -0
  13. package/dist/assetUseRights.js +71 -0
  14. package/dist/audiences.js +1 -2
  15. package/dist/availability.js +20 -18
  16. package/dist/blueprint.js +76 -77
  17. package/dist/build.d.ts +3063 -0
  18. package/dist/build.js +37 -0
  19. package/dist/buildApplicationAdmission.js +15 -0
  20. package/dist/buildApplicationCatalog.js +135 -0
  21. package/dist/buildApplicationCatalogTable.js +23 -0
  22. package/dist/buildApplicationRest.js +98 -0
  23. package/dist/buildApplicationUpload.js +110 -0
  24. package/dist/buildSnapshot.js +400 -0
  25. package/dist/buildSnapshotApplicationPin.js +31 -0
  26. package/dist/buildSnapshotRest.js +209 -0
  27. package/dist/buildSnapshotService.js +264 -0
  28. package/dist/buildSnapshotTables.js +24 -0
  29. package/dist/bulk.js +72 -72
  30. package/dist/cacheIdentity.js +1 -2
  31. package/dist/changes.js +280 -64
  32. package/dist/cmsContext.js +1 -2
  33. package/dist/collections.js +1 -2
  34. package/dist/consent.js +6 -7
  35. package/dist/contentLocations.js +52 -0
  36. package/dist/contentProjection.js +82 -0
  37. package/dist/contentRouteIdentity.js +12 -0
  38. package/dist/contentRouteMaterializer.js +96 -0
  39. package/dist/contentRouteTypes.js +38 -0
  40. package/dist/contentSeo.js +188 -0
  41. package/dist/contentTreePath.js +59 -0
  42. package/dist/contentType.js +121 -105
  43. package/dist/contentValues.js +17 -0
  44. package/dist/contentfulImport.js +1 -2
  45. package/dist/copies.js +4 -5
  46. package/dist/cutover.js +1 -2
  47. package/dist/deliveryChecks.js +1 -2
  48. package/dist/domainHost.js +6 -0
  49. package/dist/domains.js +82 -89
  50. package/dist/draftTexts.js +38 -39
  51. package/dist/duplicates.js +24 -25
  52. package/dist/edgePurge.js +1 -2
  53. package/dist/editHistory.js +1 -2
  54. package/dist/effectForm.js +1 -2
  55. package/dist/environmentAliases.js +137 -0
  56. package/dist/environments.js +108 -71
  57. package/dist/errors.js +55 -16
  58. package/dist/experiments.js +8 -9
  59. package/dist/exposure.js +1 -2
  60. package/dist/extensionManifest.js +2 -3
  61. package/dist/extensions.js +1 -2
  62. package/dist/fieldSchema.js +1 -2
  63. package/dist/formStrings.js +1 -2
  64. package/dist/frontendBindings.js +98 -0
  65. package/dist/frontendMedia.js +17 -0
  66. package/dist/glossary.js +1 -2
  67. package/dist/history.js +1 -2
  68. package/dist/htmlImport.js +1 -2
  69. package/dist/index.d.ts +760 -47
  70. package/dist/index.js +89 -73
  71. package/dist/initializePublicRoutes.js +27 -0
  72. package/dist/liveContentRouteView.js +75 -0
  73. package/dist/media.js +1 -2
  74. package/dist/metrics.js +1 -2
  75. package/dist/migration.js +1 -2
  76. package/dist/migrationStages.js +1 -2
  77. package/dist/nativeOutputDeploymentService.js +204 -0
  78. package/dist/outputActivation.js +233 -0
  79. package/dist/outputActivationOrigin.js +50 -0
  80. package/dist/outputActivationStore.js +410 -0
  81. package/dist/outputActivationTables.js +10 -0
  82. package/dist/outputActivationTarget.js +80 -0
  83. package/dist/outputActivationTargetTable.js +24 -0
  84. package/dist/outputDeployment.js +173 -0
  85. package/dist/outputDeploymentRest.js +167 -0
  86. package/dist/outputDeploymentService.js +240 -0
  87. package/dist/outputRouteGraph.js +176 -0
  88. package/dist/outputSafetyArtifact.js +146 -0
  89. package/dist/outputTargetRest.js +61 -0
  90. package/dist/pathSegmentEncoding.js +3 -0
  91. package/dist/presenceAnchors.js +1 -2
  92. package/dist/preview.js +1 -2
  93. package/dist/privateCmsTransport.js +75 -0
  94. package/dist/privateNativeRouteReservation.js +9 -0
  95. package/dist/promotion.js +69 -61
  96. package/dist/publicBuild.js +89 -0
  97. package/dist/publicBuildRest.js +97 -0
  98. package/dist/publicBuildService.js +62 -0
  99. package/dist/publicOutputHttp.js +128 -0
  100. package/dist/publicOutputService.js +286 -0
  101. package/dist/publicPresentation.js +16 -0
  102. package/dist/publicRouteDispositionAdmission.js +37 -0
  103. package/dist/publicRouteHistoryStore.js +11 -0
  104. package/dist/publicRouteHistoryView.js +33 -0
  105. package/dist/publicRouteIntegrity.js +4 -0
  106. package/dist/publicRouteMutation.js +5 -0
  107. package/dist/publicRouteNamespace.js +133 -0
  108. package/dist/publicRoutePublication.js +35 -0
  109. package/dist/publicRouteRegistry.js +16 -0
  110. package/dist/publicRouteRegistryBinding.js +193 -0
  111. package/dist/publicRouteRegistryDefinition.js +75 -0
  112. package/dist/publicRouteSitePublication.js +39 -0
  113. package/dist/publicRouteTables.js +12 -0
  114. package/dist/publicRouteUrl.js +17 -0
  115. package/dist/publicationSeo.js +51 -0
  116. package/dist/publicationState.js +295 -0
  117. package/dist/quality.js +9 -10
  118. package/dist/reconfigurePublicRoutes.js +40 -0
  119. package/dist/recurrence.js +1 -2
  120. package/dist/redirects.js +105 -75
  121. package/dist/referenceGraph.js +16 -16
  122. package/dist/references.js +3 -4
  123. package/dist/release.js +178 -143
  124. package/dist/renderReadAuthority.js +42 -0
  125. package/dist/renderReadGrant.js +136 -0
  126. package/dist/rest.js +1 -2
  127. package/dist/review.js +29 -30
  128. package/dist/richDocument.js +56 -27
  129. package/dist/richInline.js +1 -2
  130. package/dist/routeDispositionGraph.js +43 -0
  131. package/dist/routeDispositionRest.js +50 -0
  132. package/dist/routeDispositionService.js +72 -0
  133. package/dist/routeDispositionStore.js +288 -0
  134. package/dist/routeDispositionTables.js +4 -0
  135. package/dist/routeDispositions.js +90 -0
  136. package/dist/routeHistoryStorage.js +319 -0
  137. package/dist/routeHistoryStore.js +11 -0
  138. package/dist/schedule.js +37 -38
  139. package/dist/search.js +1 -2
  140. package/dist/selectionIntent.js +1 -2
  141. package/dist/seo.js +2 -3
  142. package/dist/series.js +12 -13
  143. package/dist/share.js +14 -15
  144. package/dist/siteBindings.js +158 -0
  145. package/dist/siteBuildCandidate.js +103 -0
  146. package/dist/siteDelivery.js +114 -0
  147. package/dist/siteState.js +46 -0
  148. package/dist/snapshotAddressGraph.js +54 -0
  149. package/dist/snapshotAddressRead.js +72 -0
  150. package/dist/snapshotAppConsumer.js +70 -0
  151. package/dist/snapshotAppExecution.js +101 -0
  152. package/dist/snapshotApplication.js +74 -0
  153. package/dist/snapshotApprovedRouteDispositions.js +43 -0
  154. package/dist/snapshotAssetAssembly.js +69 -0
  155. package/dist/snapshotAssetAssemblyRest.js +49 -0
  156. package/dist/snapshotBindingRead.js +60 -0
  157. package/dist/snapshotCodeSeo.js +28 -0
  158. package/dist/snapshotComponent.js +33 -0
  159. package/dist/snapshotComponentSource.js +23 -0
  160. package/dist/snapshotConsumer.js +86 -0
  161. package/dist/snapshotContentIdentity.js +9 -0
  162. package/dist/snapshotDefinitions.js +263 -0
  163. package/dist/snapshotDocumentAssembly.js +192 -0
  164. package/dist/snapshotDocumentAssemblyRest.js +83 -0
  165. package/dist/snapshotDocumentProjection.js +201 -0
  166. package/dist/snapshotDocumentTransfer.js +34 -0
  167. package/dist/snapshotDocumentTransferRest.js +79 -0
  168. package/dist/snapshotDomains.js +55 -0
  169. package/dist/snapshotEnvironment.js +30 -0
  170. package/dist/snapshotFieldPlan.js +84 -0
  171. package/dist/snapshotFrontend.js +102 -0
  172. package/dist/snapshotLink.js +7 -0
  173. package/dist/snapshotMedia.js +110 -0
  174. package/dist/snapshotMediaCapture.js +245 -0
  175. package/dist/snapshotMediaFields.js +224 -0
  176. package/dist/snapshotMediaRead.js +184 -0
  177. package/dist/snapshotMediaReader.js +12 -0
  178. package/dist/snapshotObservation.js +15 -0
  179. package/dist/snapshotObservedRouteHistory.js +33 -0
  180. package/dist/snapshotOutputTransfer.js +77 -0
  181. package/dist/snapshotPageLoader.js +6 -0
  182. package/dist/snapshotPageSeo.js +58 -0
  183. package/dist/snapshotPathLocale.js +14 -0
  184. package/dist/snapshotPresentation.js +85 -0
  185. package/dist/snapshotPresentationPolicy.js +11 -0
  186. package/dist/snapshotProjection.js +118 -0
  187. package/dist/snapshotPublicAccess.js +160 -0
  188. package/dist/snapshotPublicRouteHistory.js +39 -0
  189. package/dist/snapshotReadAdmission.js +37 -0
  190. package/dist/snapshotRedirectOutput.js +150 -0
  191. package/dist/snapshotRedirectTargets.js +23 -0
  192. package/dist/snapshotRedirects.js +131 -0
  193. package/dist/snapshotReference.js +7 -0
  194. package/dist/snapshotReferenceAddress.js +9 -0
  195. package/dist/snapshotReferenceGraph.js +78 -0
  196. package/dist/snapshotReferenceRead.js +64 -0
  197. package/dist/snapshotRelease.js +98 -0
  198. package/dist/snapshotRender.js +360 -0
  199. package/dist/snapshotRenderDependencies.js +177 -0
  200. package/dist/snapshotRenditions.js +87 -0
  201. package/dist/snapshotRichDocument.js +61 -0
  202. package/dist/snapshotRoleTransfer.js +105 -0
  203. package/dist/snapshotRoleTransferRest.js +98 -0
  204. package/dist/snapshotRouteAdmission.js +70 -0
  205. package/dist/snapshotRouteDispatch.js +110 -0
  206. package/dist/snapshotRouteDispositionPlan.js +72 -0
  207. package/dist/snapshotRouteRead.js +42 -0
  208. package/dist/snapshotRoutes.js +78 -0
  209. package/dist/snapshotRouting.js +112 -0
  210. package/dist/snapshotSeo.js +178 -0
  211. package/dist/snapshotSeoControls.js +100 -0
  212. package/dist/snapshotSeoDocumentInventory.js +114 -0
  213. package/dist/snapshotSeoDocuments.js +128 -0
  214. package/dist/snapshotSeoMerge.js +84 -0
  215. package/dist/snapshotSeoMetadata.js +136 -0
  216. package/dist/snapshotSeoOutput.js +172 -0
  217. package/dist/snapshotSeoPathSets.js +104 -0
  218. package/dist/snapshotSeoRead.js +87 -0
  219. package/dist/snapshotSite.js +127 -0
  220. package/dist/snapshotSitemapFiles.js +35 -0
  221. package/dist/snapshotTreeDependencies.js +57 -0
  222. package/dist/snapshotTreeLoader.js +9 -0
  223. package/dist/snapshotTreeRead.js +157 -0
  224. package/dist/staticPathSet.js +176 -0
  225. package/dist/staticPathSetRest.js +128 -0
  226. package/dist/staticPathSetService.js +248 -0
  227. package/dist/staticPathSetStore.js +337 -0
  228. package/dist/stewardship.js +2 -3
  229. package/dist/taxonomy.js +1 -2
  230. package/dist/team.js +1 -2
  231. package/dist/templates.js +2 -3
  232. package/dist/trackChanges.js +1 -2
  233. package/dist/translation.js +1 -2
  234. package/dist/tree.js +10 -11
  235. package/dist/usage.js +1 -2
  236. package/dist/validation.js +54 -55
  237. package/dist/visualEditing.js +1 -2
  238. package/dist/web.d.ts +709 -7
  239. package/dist/web.js +50 -33
  240. package/dist/workflow.js +9 -10
  241. package/dist/write.js +251 -227
  242. package/dist/xliff.js +1 -2
  243. package/package.json +21 -7
@@ -0,0 +1,176 @@
1
+ import { OutputActivationUnavailable as e } from "./outputActivation.js";
2
+ import { copyObservedRoutes as t } from "./routeHistoryStorage.js";
3
+ import { copySnapshotResource as n } from "./buildSnapshot.js";
4
+ import { nativeSnapshotRouteId as r, snapshotRouteDispatch as i } from "./snapshotRouting.js";
5
+ import { copyRouteDispositionDefinition as a } from "./routeDispositions.js";
6
+ import { iterateApprovedRouteDispositions as o } from "./routeDispositionStore.js";
7
+ import { readPublicRouteHistoryView as s } from "./publicRouteHistoryView.js";
8
+ import { verifyStaticPathPage as ee, verifyStaticPathSet as te } from "./staticPathSet.js";
9
+ import { iterateRouteHistory as c, readRouteHistoryPage as ne } from "./routeHistoryStore.js";
10
+ import { readOutputSafetyPage as l } from "./outputActivationStore.js";
11
+ import { admitCapturedAssetUseRights as u } from "./assetUseRights.js";
12
+ import { isPrivateNativeRouteReservation as d } from "./privateNativeRouteReservation.js";
13
+ import { planExactRouteDispositions as f } from "./routeDispositionGraph.js";
14
+ import { canonicalJson as p } from "@voltro/runtime";
15
+ // src/outputRouteGraph.ts
16
+ var m = (t) => {
17
+ throw new e({ reason: t });
18
+ }, h = (e, t) => {
19
+ if (typeof e != "object" || !e || Array.isArray(e) || ![Object.prototype, null].includes(Object.getPrototypeOf(e)) || Object.getOwnPropertySymbols(e).length > 0) return m("input");
20
+ let n = Object.getOwnPropertyDescriptors(e);
21
+ return Object.keys(n).sort().join(",") !== t || Object.values(n).some((e) => !e.enumerable || !("value" in e)) ? m("input") : e;
22
+ }, g = (e, t = 1e5) => {
23
+ if (!Array.isArray(e) || e.length > t || Object.getOwnPropertySymbols(e).length > 0 || Object.keys(e).length !== e.length) return m("input");
24
+ for (let t = 0; t < e.length; t++) {
25
+ let n = Object.getOwnPropertyDescriptor(e, String(t));
26
+ if (n === void 0 || !n.enumerable || !("value" in n)) return m("input");
27
+ }
28
+ return e;
29
+ }, _ = (e) => typeof e == "string" && /^[a-f0-9]{64}$/.test(e), v = () => {
30
+ let e = 2;
31
+ return (t) => {
32
+ if (e += Buffer.byteLength(p(t)) + 1, e > 67108864) return m("input");
33
+ };
34
+ }, y = async (e, y, b, x) => {
35
+ let S = h(b, "artifacts,documents,pathSets,producers,redirects,safety"), C = y.manifest.scope, w = x.now ?? Date.now, T = y.manifest.artifacts.map((e) => ({
36
+ host: e.host,
37
+ documents: e.documents,
38
+ redirects: e.redirects,
39
+ deny: e.deny
40
+ })), E = g(S.artifacts, 256).map((e) => h(n({
41
+ key: "host-artifacts",
42
+ value: { artifacts: e }
43
+ }).value.artifacts, "deny,documents,host,redirects"));
44
+ if (p(E) !== p(T)) return m("integrity");
45
+ let D = g(S.producers, 256).map((e) => h(n({
46
+ key: "producer",
47
+ value: { producer: e }
48
+ }).value.producer, "buildId,consumerId,host"));
49
+ if (D.length !== y.manifest.paths.length || D.some((e, t) => e.host !== y.manifest.paths[t].host || typeof e.consumerId != "string" || typeof e.buildId != "string")) return m("integrity");
50
+ let O = new Map(D.map((e) => [e.host, e])), k = new Set(y.manifest.paths.map((e) => e.host)), A = await ne(e, C, {
51
+ expectedRevision: x.observed.generation,
52
+ take: 1
53
+ });
54
+ if (A.sourceDigest !== x.observed.sourceDigest) return m("changed");
55
+ let j = [], re = v();
56
+ for await (let t of c(e, C, A.revision)) {
57
+ if (re(t), j.length >= 1e5) return m("input");
58
+ j.push({
59
+ url: t.url,
60
+ routeId: t.routeId
61
+ });
62
+ }
63
+ let M = await s(e, C), N = M.namespace.binding;
64
+ if (y.manifest.paths.some((e) => !M.namespace.domains.some((t) => t.host === e.host))) return m("changed");
65
+ let P = [], F = [], I = v();
66
+ for await (let e of M.entries()) {
67
+ if (I(e), P.length >= 1e5) return m("input");
68
+ let t = {
69
+ url: e.url,
70
+ routeId: e.routeId
71
+ };
72
+ P.push(t), e.active && F.push(t);
73
+ }
74
+ let L = new Map(F.map((e) => [e.url, e.routeId])), R = [], z = /* @__PURE__ */ new Map(), B = /* @__PURE__ */ new Set(), V = v();
75
+ for (let e of g(S.pathSets, 256)) {
76
+ let t = h(e, "pages,set"), n = te(t.set, x.keys), a = n.manifest.context, o = y.manifest.paths.find((e) => e.host === a.host), s = O.get(a.host);
77
+ if (o === void 0 || s === void 0 || B.has(n.id) || n.id !== o.setId || n.manifest.count !== o.count || a.tenantId !== C.tenantId || a.site !== C.site || a.environment !== C.environment || a.snapshotId !== y.manifest.snapshot.id || a.snapshotDigest !== y.manifest.snapshot.digest || a.releaseId !== y.manifest.snapshot.releaseId || a.inputsId !== y.manifest.app.inputsId || a.executionId !== y.manifest.app.executionId || a.policyDigest !== y.manifest.renderPolicyDigest || a.consumerId !== s.consumerId || a.buildId !== s.buildId || a.host !== o.host || p(a.localeIds) !== p(N.definition.site.locales.filter((e) => e.enabled).map((e) => e.id).sort()) || !a.owners.includes("cms") || !a.owners.includes("code")) return m("integrity");
78
+ B.add(n.id);
79
+ let c = g(t.pages, 500);
80
+ if (c.length !== n.manifest.pages.length) return m("integrity");
81
+ for (let e = 0; e < c.length; e++) for (let t of ee(n, e, c[e])) {
82
+ if (V(t), R.length >= 1e5) return m("input");
83
+ if (t.host !== a.host) return m("integrity");
84
+ let e = "https://" + t.host + t.path, n = L.get(e), o = i(N.definition.routing, t.path, n !== void 0);
85
+ if (z.has(e) || !N.definition.site.locales.some((e) => e.enabled && e.id === t.localeId) || o === null || o.owner !== t.owner || n !== void 0 && n !== t.routeId) return m("changed");
86
+ if (t.owner === "cms") {
87
+ if (n !== t.routeId) return m("changed");
88
+ } else {
89
+ let e = o.code === null ? void 0 : N.definition.routing.definition?.claims[o.code.file];
90
+ if (e?.kind !== "code" || e.public !== !0 || o.code?.file !== t.file || typeof t.file != "string" || r(C, t.localeId, t.file, t.path) !== t.routeId) return m("changed");
91
+ }
92
+ R.push(t), z.set(e, t.routeId);
93
+ }
94
+ }
95
+ let H = /* @__PURE__ */ new Map();
96
+ for (let e of R) H.set(e.host, (H.get(e.host) ?? 0) + 1);
97
+ if (B.size !== y.manifest.paths.length || y.manifest.paths.some((e) => (H.get(e.host) ?? 0) !== e.count)) return m("integrity");
98
+ let U = v(), W = g(S.documents).map((e) => {
99
+ let r = h(n({
100
+ key: "document",
101
+ value: { document: e }
102
+ }).value.document, "media,routeId,url");
103
+ U(r);
104
+ let [i] = t([{
105
+ url: r.url,
106
+ routeId: r.routeId
107
+ }]);
108
+ if (i === void 0 || z.get(i.url) !== i.routeId) return m("integrity");
109
+ let a = g(r.media).map((e) => {
110
+ let t = h(e, "digest,rights");
111
+ return _(t.digest) ? {
112
+ digest: t.digest,
113
+ rights: t.rights
114
+ } : m("integrity");
115
+ });
116
+ return {
117
+ ...i,
118
+ media: a
119
+ };
120
+ });
121
+ if (new Set(W.map((e) => e.url)).size !== z.size) return m("integrity");
122
+ let G = h(S.safety, "entries,generation"), K = [], q = v(), J, Y;
123
+ for (;;) {
124
+ let t = await l(e, C, {
125
+ ...J === void 0 ? {} : { after: J },
126
+ ...Y === void 0 ? {} : { expectedGeneration: Y }
127
+ });
128
+ Y ??= t.generation;
129
+ for (let e of t.entries) {
130
+ if (q(e), K.length >= 1e5) return m("input");
131
+ K.push(e);
132
+ }
133
+ if (t.next === null) break;
134
+ J = t.next;
135
+ }
136
+ let ie = g(G.entries).map((e) => n({
137
+ key: "safety-entry",
138
+ value: { entry: e }
139
+ }).value.entry);
140
+ if (Y !== G.generation || p(K) !== p(ie)) return m("changed");
141
+ let X = new Set(K.flatMap((e) => e.target.kind === "url" ? [e.target.url] : [])), ae = new Set(K.flatMap((e) => e.target.kind === "asset" ? [e.target.digest] : []));
142
+ for (let t of W) {
143
+ if (X.has(t.url)) return m("denied");
144
+ let n = new URL(t.url);
145
+ for (let r of t.media) {
146
+ if (ae.has(r.digest)) return m("denied");
147
+ await u(e, C, r.rights, w(), x.use({
148
+ host: n.hostname,
149
+ path: n.pathname
150
+ }));
151
+ }
152
+ }
153
+ let Z = [], oe = v();
154
+ for await (let t of o(e, C)) {
155
+ if (oe(t.definition), Z.length >= 1e5) return m("input");
156
+ Z.push(t.definition);
157
+ }
158
+ let Q = (e) => k.has(new URL(e.url).hostname), se = [...new Map([...j.filter(Q), ...P.filter(Q)].map((e) => [e.url, e])).values()].filter((e) => d(N.definition.routing, new URL(e.url).pathname, L.has(e.url))), $ = f({
159
+ observed: j.filter(Q),
160
+ sourceObserved: P.filter(Q),
161
+ currentOwned: F.filter(Q),
162
+ reserved: se,
163
+ current: R.map((e) => ({
164
+ url: "https://" + e.host + e.path,
165
+ routeId: e.routeId
166
+ })),
167
+ decisions: Z.filter((e) => k.has(new URL(e.source.url).hostname)),
168
+ now: w()
169
+ }), ce = v(), le = g(S.redirects).map((e) => {
170
+ let t = a(e);
171
+ return ce(t), t;
172
+ });
173
+ if (p(le) !== p($)) return m("changed");
174
+ for (let e of $) if (X.has(e.source.url) || e.action.kind === "redirect" && X.has(e.action.target.url)) return m("denied");
175
+ };
176
+ export { y as admitOutputRouteGraph };
@@ -0,0 +1,146 @@
1
+ import { normalizeHost as e } from "./domainHost.js";
2
+ import { copyOutputActivationScope as t } from "./outputActivation.js";
3
+ import { copySnapshotResource as n } from "./buildSnapshot.js";
4
+ import { readOutputSafetyPage as r } from "./outputActivationStore.js";
5
+ import { Schema as i } from "effect";
6
+ import { createHash as a } from "node:crypto";
7
+ import { canonicalJson as o } from "@voltro/runtime";
8
+ // src/outputSafetyArtifact.ts
9
+ var s = class extends i.TaggedError()("OutputSafetyArtifactUnavailable", { reason: i.Literals([
10
+ "binding",
11
+ "changed",
12
+ "budget"
13
+ ]) }) {}, c = (e) => {
14
+ throw new s({ reason: e });
15
+ }, l = (e) => a("sha256").update(o(e)).digest("hex"), u = (e) => typeof e == "string" && /^[a-f0-9]{64}$/.test(e), d = (e) => typeof e == "string" && /^[A-Za-z0-9_-]{1,64}$/.test(e), f = (e, t) => !e || typeof e != "object" || Array.isArray(e) || Object.keys(e).sort().join(",") !== t ? c("binding") : e, p = (t) => {
16
+ let r = f(n({
17
+ key: "safety-binding",
18
+ value: { binding: t }
19
+ }).value.binding, "app,buildId,consumerId,documents,host,snapshot"), i = f(r.snapshot, "digest,id"), a = f(r.app, "executionId,inputsId"), o = f(r.documents, "artifactId,pathSetIds");
20
+ return !d(i.id) || !u(i.digest) || !u(a.inputsId) || !u(a.executionId) || !u(o.artifactId) || !Array.isArray(o.pathSetIds) || o.pathSetIds.length < 1 || o.pathSetIds.length > 64 || !o.pathSetIds.every(u) || new Set(o.pathSetIds).size !== o.pathSetIds.length || !d(r.consumerId) || !d(r.buildId) || typeof r.host != "string" || r.host.length > 253 || e(r.host) !== r.host ? c("binding") : {
21
+ snapshot: {
22
+ id: i.id,
23
+ digest: i.digest
24
+ },
25
+ app: {
26
+ inputsId: a.inputsId,
27
+ executionId: a.executionId
28
+ },
29
+ documents: {
30
+ artifactId: o.artifactId,
31
+ pathSetIds: [...o.pathSetIds].sort()
32
+ },
33
+ consumerId: r.consumerId,
34
+ buildId: r.buildId,
35
+ host: r.host
36
+ };
37
+ }, m = (e) => {
38
+ let t = f(n({
39
+ key: "safety-selection",
40
+ value: { selection: e }
41
+ }).value.selection, "artifactId");
42
+ return u(t.artifactId) ? { artifactId: t.artifactId } : c("binding");
43
+ }, h = (e) => !Number.isSafeInteger(e) || e < 1 ? c("budget") : Math.min(e, 67108864), g = async (e, n, i) => {
44
+ let a = t(n), s = h(i.maxBytes), l = i.expectedGeneration, u, d = 0, f = [];
45
+ for (;;) {
46
+ let t = await e.transactional((e) => r(e, a, {
47
+ ...l === void 0 ? {} : { expectedGeneration: l },
48
+ ...u === void 0 ? {} : { after: u }
49
+ }));
50
+ if (l ??= t.generation, l > 1e5) return c("budget");
51
+ for (let e of t.entries) {
52
+ if (d += Buffer.byteLength(o(e), "utf8") + 1, d > s) return c("budget");
53
+ f.push(e);
54
+ }
55
+ if (t.next === null) break;
56
+ u = t.next;
57
+ }
58
+ return f.length === l ? {
59
+ generation: l,
60
+ entries: f
61
+ } : c("changed");
62
+ }, _ = (e, t) => Buffer.from(o({
63
+ version: 1,
64
+ generation: e.generation,
65
+ index: t,
66
+ entries: e.entries.slice(t * 500, (t + 1) * 500)
67
+ }) + "\n", "utf8"), v = (e, t) => {
68
+ let n = [], r = 0;
69
+ for (let i = 0; i < Math.max(1, Math.ceil(e.entries.length / 500)); i++) {
70
+ let o = _(e, i);
71
+ if (r += o.length, r > t) return c("budget");
72
+ n.push({
73
+ path: "safety/" + String(i).padStart(5, "0") + ".json",
74
+ size: o.length,
75
+ digest: a("sha256").update(o).digest("hex"),
76
+ contentType: "application/json"
77
+ });
78
+ }
79
+ return n;
80
+ }, y = (e, t, n) => ({
81
+ version: 1,
82
+ profile: "voltro.cms.snapshot-safety-output/v1",
83
+ kind: "deny",
84
+ ...e,
85
+ ...t,
86
+ generation: n.generation,
87
+ entryCount: n.entries.length,
88
+ chunkCount: Math.max(1, Math.ceil(n.entries.length / 500)),
89
+ safetyDigest: l(n.entries)
90
+ }), b = async (e, n, r) => {
91
+ let i = t(n), a = h(r.maxBytes), s = r.admit, d = r.provider, f = p(await e.transactional((e) => s(e))), m = await g(e, i, { maxBytes: a }), b = l(m.entries), x = v(m, a), S;
92
+ try {
93
+ S = await d.begin();
94
+ for (let e = 0; e < x.length; e++) {
95
+ let t = _(m, e);
96
+ await S.write(x[e], (async function* () {
97
+ yield t;
98
+ })());
99
+ }
100
+ let t = p(await e.transactional((e) => s(e)));
101
+ if (o(t) !== o(f) || l((await g(e, i, {
102
+ maxBytes: a,
103
+ expectedGeneration: m.generation
104
+ })).entries) !== b) return c("changed");
105
+ let n = await S.seal(y(i, f, m));
106
+ return u(n.id) ? {
107
+ artifactId: n.id,
108
+ generation: m.generation,
109
+ entryCount: m.entries.length
110
+ } : c("binding");
111
+ } catch (e) {
112
+ throw S !== void 0 && await Promise.allSettled([S.abort()]), e;
113
+ }
114
+ }, x = async (e, r, i, a) => {
115
+ if (!u(i)) return c("binding");
116
+ let s = t(r), d = h(a.maxBytes), m = a.provider.read?.bind(a.provider);
117
+ if (m === void 0) return c("binding");
118
+ let _ = p(await e.transactional((e) => a.admit(e))), b = await g(e, s, { maxBytes: d }), x = {
119
+ version: 1,
120
+ subject: y(s, _, b),
121
+ files: v(b, d)
122
+ };
123
+ if (l(x) !== i) return c("binding");
124
+ let S = f(n({
125
+ key: "safety-artifact",
126
+ value: { artifact: await m(i) }
127
+ }).value.artifact, "id,manifest");
128
+ if (S.id !== i || o(S.manifest) !== o(x)) return c("binding");
129
+ let C = p(await e.transactional((e) => a.admit(e)));
130
+ return o(C) !== o(_) || l((await g(e, s, {
131
+ maxBytes: d,
132
+ expectedGeneration: b.generation
133
+ })).entries) !== l(b.entries) ? c("changed") : {
134
+ verification: {
135
+ ...b,
136
+ artifactId: i,
137
+ safetyDigest: l(b.entries),
138
+ binding: _
139
+ },
140
+ artifact: {
141
+ id: i,
142
+ manifest: x
143
+ }
144
+ };
145
+ }, S = async (...e) => (await x(...e)).verification;
146
+ export { s as OutputSafetyArtifactUnavailable, b as captureOutputSafetyArtifact, m as copyOutputSafetySelection, x as readCurrentOutputSafetyArtifact, g as readOutputSafetySnapshot, S as readVerifiedOutputSafetyArtifact };
@@ -0,0 +1,61 @@
1
+ import { cmsCredential as e, privateCmsHttpRoutes as t, privateCmsOperation as n } from "./privateCmsTransport.js";
2
+ import { CmsOutputDeploymentUnavailable as r } from "./outputDeploymentService.js";
3
+ import { outputDeploymentManifestSchema as i } from "./outputDeploymentRest.js";
4
+ import { Schema as a } from "effect";
5
+ import { strictInput as o } from "@voltro/protocol";
6
+ // src/outputTargetRest.ts
7
+ var s = a.String.check(a.isPattern(/^[A-Za-z0-9_-]{1,64}$/)), c = a.String.check(a.isPattern(/^[a-f0-9]{64}$/)), l = a.String.check(a.isMaxLength(253)), u = a.Struct({
8
+ deploymentId: s,
9
+ snapshot: a.Struct({
10
+ id: s,
11
+ digest: c
12
+ }),
13
+ pathSets: a.Array(a.Struct({
14
+ host: l,
15
+ jobId: s,
16
+ digest: c
17
+ })).check(a.isMaxLength(256)),
18
+ artifacts: a.Array(a.Struct({
19
+ host: l,
20
+ documents: c,
21
+ assets: c,
22
+ redirects: c,
23
+ sitemap: c,
24
+ robots: c,
25
+ deny: c
26
+ })).check(a.isMaxLength(256))
27
+ }), d = a.Struct({
28
+ set: a.Struct({
29
+ id: c,
30
+ manifest: i
31
+ }),
32
+ pathSets: a.Array(a.Struct({
33
+ host: l,
34
+ jobId: s
35
+ })),
36
+ outputs: a.Array(a.Struct({
37
+ region: s,
38
+ outputId: c
39
+ }))
40
+ }), f = (i) => {
41
+ let a = [{
42
+ ...n({
43
+ namespace: "cms.outputTarget",
44
+ path: "/v1/cms/output-targets",
45
+ operationPrefix: "cmsOutputTarget",
46
+ tags: ["CMS output deployment"],
47
+ error: r,
48
+ credentialError: "CmsOutputDeploymentUnavailable",
49
+ errorStatus: { CmsOutputDeploymentUnavailable: 409 }
50
+ }, "prepare", "Prepare one original complete output target", "Scoped cms:deploy credential. The server derives app, schema, binding and cache contracts from the actual retained snapshot and verifies original signed path jobs. Fixed server ports stage and rehash all six roles in every required region. Metadata alone grants no activation or serving authority.", o(u, "cms.outputTarget.prepare", !0), d, (t, n) => i.prepare({
51
+ ...t,
52
+ credential: e(n, "CmsOutputDeploymentUnavailable")
53
+ })),
54
+ maxBodyBytes: 524288
55
+ }];
56
+ return {
57
+ routes: a,
58
+ httpRoutes: t(a)
59
+ };
60
+ };
61
+ export { f as cmsOutputTargetRest };
@@ -0,0 +1,3 @@
1
+ // src/pathSegmentEncoding.ts
2
+ var e = (e) => encodeURIComponent(e);
3
+ export { e as encodeCanonicalPathSegment };
@@ -1,4 +1,4 @@
1
- //#region src/presenceAnchors.ts
1
+ // src/presenceAnchors.ts
2
2
  var e = /^[A-Za-z0-9_.:/-]{1,120}$/, t = (t) => typeof t == "string" && e.test(t), n = (e) => Number.isInteger(e) && e >= 0 && e <= 1e6, r = (e) => typeof e == "number" && Number.isFinite(e) && e >= 0 && e <= 1, i = (e) => {
3
3
  if (typeof e != "object" || !e) return null;
4
4
  let i = e;
@@ -64,5 +64,4 @@ var e = /^[A-Za-z0-9_.:/-]{1,120}$/, t = (t) => typeof t == "string" && e.test(t
64
64
  field: a
65
65
  });
66
66
  };
67
- //#endregion
68
67
  export { i as parsePresenceAnchor, a as presenceAnchorOf };
package/dist/preview.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createHmac as e, timingSafeEqual as t } from "node:crypto";
2
- //#region src/preview.ts
2
+ // src/preview.ts
3
3
  var n = 3600, r = (e) => (Buffer.isBuffer(e) ? e : Buffer.from(e, "utf8")).toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, ""), i = (e) => Buffer.from(e.replace(/-/g, "+").replace(/_/g, "/"), "base64"), a = (e) => e ?? process.env.VOLTRO_SESSION_SECRET ?? null, o = (t, i, o = {}) => {
4
4
  let s = a(o.secret);
5
5
  if (s === null) throw Error("cms previewToken requires a signing secret — set VOLTRO_SESSION_SECRET or pass { secret }. Refusing to sign with a hardcoded default (it would ship in the bundle and be forgeable).");
@@ -27,5 +27,4 @@ var n = 3600, r = (e) => (Buffer.isBuffer(e) ? e : Buffer.from(e, "utf8")).toStr
27
27
  return null;
28
28
  }
29
29
  };
30
- //#endregion
31
30
  export { o as previewToken, s as verifyPreviewToken };
@@ -0,0 +1,75 @@
1
+ import { Effect as e } from "effect";
2
+ import { defineAction as t } from "@voltro/protocol";
3
+ import { RestRouteError as n, projectedFailure as r, publicApiRoute as i, restError as a, restRoutesToHttpRoutes as o } from "@voltro/protocol/rest";
4
+ // src/privateCmsTransport.ts
5
+ var s = {
6
+ "cache-control": "private, no-store",
7
+ pragma: "no-cache",
8
+ vary: "Authorization"
9
+ }, c = (e) => {
10
+ let t = e.headers.authorization;
11
+ return typeof t != "string" || t.length > 520 ? null : /^Bearer ([^\s]+)$/i.exec(t)?.[1] ?? null;
12
+ }, l = (e, t) => c(e) ?? (() => {
13
+ throw a(401, {
14
+ error: t,
15
+ _tag: t,
16
+ reason: "credential"
17
+ }, {
18
+ ...s,
19
+ "www-authenticate": "Bearer"
20
+ });
21
+ })(), u = (e) => c(e) === null ? {
22
+ status: 401,
23
+ message: "CMS credential required"
24
+ } : void 0, d = async (t, i, o) => {
25
+ let c = await e.runPromise(e.result(t));
26
+ if (c._tag === "Success") return c.success;
27
+ let l = c.failure;
28
+ if (typeof l == "object" && l && "_tag" in l && l._tag === i && "reason" in l && l.reason === "credential") {
29
+ let e = r(l, o, { errorStatus: { [i]: 401 } });
30
+ throw e instanceof n ? a(e.status, e.body, {
31
+ ...s,
32
+ "www-authenticate": "Bearer"
33
+ }) : e;
34
+ }
35
+ throw l;
36
+ }, f = (e, n, r, a, o, s, c) => {
37
+ let l = `${e.namespace}.${n}`, f = t({
38
+ name: l,
39
+ input: o,
40
+ output: s,
41
+ error: e.error,
42
+ openAccess: "Dedicated credential exchange: the header guard and server-bound CMS service verify authority; no ambient Subject grants access.",
43
+ publicApi: {
44
+ method: "POST",
45
+ path: `${e.path}/${n}`,
46
+ security: "required",
47
+ idempotent: !1,
48
+ operationId: `${e.operationPrefix}${n[0].toUpperCase()}${n.slice(1)}`,
49
+ tags: [...e.tags],
50
+ errorStatus: e.errorStatus,
51
+ ...Object.hasOwn(e.errorStatus, e.credentialError) ? { additionalErrorStatuses: { [e.credentialError]: [401] } } : {},
52
+ summary: r,
53
+ description: a
54
+ }
55
+ }), p = i(f, (t, n) => d(c(t, n), e.credentialError, f));
56
+ return {
57
+ ...p,
58
+ guards: [...p.guards ?? [], u],
59
+ maxBodyBytes: 16384
60
+ };
61
+ }, p = (e) => o(e).map((e) => ({
62
+ ...e,
63
+ handle: async (...t) => {
64
+ let n = await e.handle(...t);
65
+ return {
66
+ ...n,
67
+ headers: {
68
+ ...n.headers,
69
+ ...s,
70
+ ...n.status === 401 ? { "www-authenticate": "Bearer" } : {}
71
+ }
72
+ };
73
+ }
74
+ }));
75
+ export { l as cmsCredential, s as privateCmsHeaders, p as privateCmsHttpRoutes, f as privateCmsOperation };
@@ -0,0 +1,9 @@
1
+ import { snapshotRouteDispatch as e } from "./snapshotRouting.js";
2
+ // src/privateNativeRouteReservation.ts
3
+ var t = (t, n, r) => {
4
+ let i = e(t, n, r);
5
+ if (i?.owner !== "code") return !1;
6
+ let a = t.definition?.claims[i.code.file];
7
+ return a?.kind !== "code" || a.public !== !0;
8
+ };
9
+ export { t as isPrivateNativeRouteReservation };