@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,286 @@
1
+ import { normalizeHost as e } from "./domainHost.js";
2
+ import { OutputActivationUnavailable as t } from "./outputActivation.js";
3
+ import { CmsPublicBuildUnavailable as n, canonicalCmsPublicPath as r } from "./publicBuild.js";
4
+ import { copySnapshotResource as i } from "./buildSnapshot.js";
5
+ import { readActiveOutput as a, readOutputSafetyPage as o } from "./outputActivationStore.js";
6
+ import { AssetUseRightsUnavailable as s, retainCapturedAssetUseRights as c } from "./assetUseRights.js";
7
+ import { copyPublicConsentChoices as l, selectPublicPresentation as u } from "./publicPresentation.js";
8
+ import { createCmsPublicBuilds as d } from "./publicBuildService.js";
9
+ import { admitPublicRouteDisposition as f, assertPublicRouteDispositionTime as p } from "./publicRouteDispositionAdmission.js";
10
+ import { Effect as m, Semaphore as h } from "effect";
11
+ import { createHash as g } from "node:crypto";
12
+ import { canonicalJson as _ } from "@voltro/runtime";
13
+ // src/publicOutputService.ts
14
+ var v = (e) => {
15
+ throw new n(e);
16
+ }, y = (e) => e instanceof n ? e : e instanceof s ? new n("denied") : e instanceof t ? new n(e.reason === "denied" ? "denied" : "changed") : new n("transport"), b = (t) => {
17
+ let s = h.makeUnsafe(1), b = (e) => s.withPermit(m.uninterruptible(e)), x = {
18
+ ...t,
19
+ scope: { ...t.scope },
20
+ keys: t.keys.map((e) => ({
21
+ id: e.id,
22
+ material: new Uint8Array(e.material)
23
+ })),
24
+ regionKeys: Object.fromEntries(Object.entries(t.regionKeys).map(([e, t]) => [e, t.map((e) => ({
25
+ id: e.id,
26
+ material: new Uint8Array(e.material)
27
+ }))]))
28
+ }, S = x.now ?? Date.now, C = (e) => {
29
+ let t = S();
30
+ try {
31
+ for (let n of e) n(t);
32
+ } catch (e) {
33
+ throw y(e);
34
+ }
35
+ }, w = async (e, t, n, r, i, o) => {
36
+ for (let s of i) if (await a(e, x.scope, {
37
+ kind: "asset",
38
+ digest: s.digest
39
+ }, {
40
+ ...x,
41
+ lock: "share",
42
+ admit: async (e, i, a, l) => {
43
+ if (i.id !== t.id || l.outputId !== n.outputId) return v("changed");
44
+ await x.admit(e, i, a, l), o.push(await c(e, x.scope, s.rights, S(), x.use(r)));
45
+ }
46
+ }) === null) return v("changed");
47
+ }, T = (e) => m.suspend(() => {
48
+ let t = [], n = d({
49
+ ...x,
50
+ admit: async (...e) => {
51
+ await x.admit(...e), C(t);
52
+ },
53
+ readPage: async (e, n, r, i) => {
54
+ try {
55
+ let a = await x.readDocument(e, n, r, i);
56
+ return a.found ? (await w(e, n, r, i, a.media, t), {
57
+ found: !0,
58
+ page: a.projectPage()
59
+ }) : a;
60
+ } catch (e) {
61
+ throw y(e);
62
+ }
63
+ }
64
+ }).page;
65
+ return m.flatMap(n(e), (e) => m.try({
66
+ try: () => (C(t), e),
67
+ catch: y
68
+ }));
69
+ }), E = (t, n) => m.tryPromise({
70
+ try: async () => {
71
+ let o = e(n.host), s = r(n.path), c = l(n.choices);
72
+ if (o !== n.host || s !== n.path) return v("request");
73
+ let d = {
74
+ host: o,
75
+ path: s
76
+ }, f = [], p = await x.store.transactional(async (e) => {
77
+ let n, r, l = await a(e, x.scope, {
78
+ kind: "url",
79
+ url: "https://" + o + s
80
+ }, {
81
+ ...x,
82
+ lock: "share",
83
+ admit: async (e, l, p, m) => {
84
+ if (!l.manifest.paths.some((e) => e.host === o)) return v("not-found");
85
+ await x.admit(e, l, p, m);
86
+ let h = u(await x.readPresentations(e, l, m), c), g = {
87
+ ...d,
88
+ presentation: h
89
+ }, y = t === "asset" ? await x.readAsset(e, l, m, g) : await x.readDocument(e, l, m, g);
90
+ if (!y.found) return v("not-found");
91
+ let b;
92
+ if ("media" in y) b = y.media;
93
+ else {
94
+ let t = y.uses.filter((e) => new URL(e.documentUrl).hostname === o && _(e.presentation) === _(h));
95
+ if ((s.startsWith("/__voltro/media/") || y.uses.length > 0) && t.length === 0) return v("not-found");
96
+ if (b = t.map((e) => ({
97
+ digest: y.digest,
98
+ rights: e.rights
99
+ })), t.length === 0 && await a(e, x.scope, {
100
+ kind: "asset",
101
+ digest: y.digest
102
+ }, {
103
+ ...x,
104
+ lock: "share",
105
+ admit: async (e, t, n, r) => {
106
+ if (t.id !== l.id || r.outputId !== m.outputId) return v("changed");
107
+ await x.admit(e, t, n, r);
108
+ }
109
+ }) === null) return v("changed");
110
+ }
111
+ if (await w(e, l, m, d, b, f), await x.admit(e, l, p, m), n = {
112
+ bytes: new Uint8Array(y.bytes),
113
+ digest: y.digest,
114
+ contentType: y.contentType
115
+ }, t === "admitted-document") {
116
+ if (!("media" in y)) return v("transport");
117
+ let e = y.source === void 0 ? void 0 : i({
118
+ key: "public-document-source",
119
+ value: { source: y.source }
120
+ }).value.source;
121
+ r = {
122
+ admission: {
123
+ setId: l.id,
124
+ region: m.region,
125
+ outputId: m.outputId,
126
+ snapshotDigest: l.manifest.snapshot.digest,
127
+ app: structuredClone(l.manifest.app),
128
+ target: structuredClone(g)
129
+ },
130
+ ...e === void 0 ? {} : { source: e }
131
+ };
132
+ }
133
+ }
134
+ });
135
+ if (l === null || n === void 0) return v("not-found");
136
+ let p = r === void 0 ? void 0 : {
137
+ ...n,
138
+ ...r.source === void 0 ? {} : { source: r.source },
139
+ admission: {
140
+ ...r.admission,
141
+ generation: l.marker.generation,
142
+ safetyGeneration: l.safetyGeneration
143
+ }
144
+ };
145
+ return C(f), {
146
+ file: n,
147
+ admitted: p
148
+ };
149
+ });
150
+ return C(f), p;
151
+ },
152
+ catch: y
153
+ }), D = (t) => m.tryPromise({
154
+ try: async () => {
155
+ let n = e(t.host), i = r(t.path), s = l(t.choices);
156
+ if (n !== t.host || i !== t.path) return v("request");
157
+ let c = x.readRedirect;
158
+ if (c === void 0) return v("not-found");
159
+ let d = "https://" + n + i, m = [], h = await x.store.transactional(async (e) => {
160
+ let t, r, l = await a(e, x.scope, {
161
+ kind: "url",
162
+ url: d
163
+ }, {
164
+ ...x,
165
+ admit: async (e, l, h, g) => {
166
+ if (!l.manifest.paths.some((e) => e.host === n)) return v("not-found");
167
+ await x.admit(e, l, h, g);
168
+ let _ = await c(e, l, g, {
169
+ host: n,
170
+ path: i
171
+ });
172
+ if (!_.found) return v("not-found");
173
+ if (r = _.safetyGeneration, !Number.isSafeInteger(r) || r < 0 || r > 1e5) return v("transport");
174
+ if ((await o(e, x.scope, { take: 1 })).generation !== r) return v("changed");
175
+ let y = await f(e, x.scope, _.definition, g.generation, S());
176
+ if (y.source.url !== d) return v("transport");
177
+ m.push((e) => p(y, e));
178
+ let b = y.action;
179
+ if (b.kind === "hold") return v("changed");
180
+ if (b.kind === "redirect") {
181
+ let t = new URL(b.target.url), n = {
182
+ host: t.hostname,
183
+ path: t.pathname
184
+ };
185
+ if (await a(e, x.scope, {
186
+ kind: "url",
187
+ url: b.target.url
188
+ }, {
189
+ ...x,
190
+ admit: async (e, t, r, i) => {
191
+ if (t.id !== l.id || i.outputId !== g.outputId) return v("changed");
192
+ await x.admit(e, t, r, i);
193
+ let a = u(await x.readPresentations(e, t, i), s), o = await x.readDocument(e, t, i, {
194
+ ...n,
195
+ presentation: a
196
+ });
197
+ if (!o.found) return v("changed");
198
+ await w(e, t, i, n, o.media, m), await x.admit(e, t, r, i);
199
+ }
200
+ }) === null) return v("changed");
201
+ }
202
+ await f(e, x.scope, y, g.generation, S()), await x.admit(e, l, h, g), t = {
203
+ status: b.status,
204
+ location: b.kind === "redirect" ? b.target.url : null
205
+ };
206
+ }
207
+ });
208
+ return l === null || t === void 0 ? v("not-found") : l.safetyGeneration === r ? (C(m), t) : v("changed");
209
+ });
210
+ return C(m), h;
211
+ },
212
+ catch: y
213
+ }), O = (t) => m.tryPromise({
214
+ try: async () => {
215
+ let n = e(t.host), i = r(t.path);
216
+ if (n !== t.host || i !== t.path) return v("request");
217
+ if (x.readControl === void 0 || i !== "/robots.txt" && i !== "/sitemap.xml" && !/^\/sitemaps\/sitemap-\d{5}\.xml$/.test(i)) return v("not-found");
218
+ let s = x.readControl, c = {
219
+ host: n,
220
+ path: i
221
+ }, l = [], u = await x.store.transactional(async (e) => {
222
+ let t, u, d = await a(e, x.scope, {
223
+ kind: "url",
224
+ url: "https://" + n + i
225
+ }, {
226
+ ...x,
227
+ admit: async (e, d, f, p) => {
228
+ if (!d.manifest.paths.some((e) => e.host === n)) return v("not-found");
229
+ await x.admit(e, d, f, p);
230
+ let m = await s(e, d, p, c);
231
+ if (!m.found) return v("not-found");
232
+ if (m.contentType !== (i === "/robots.txt" ? "text/plain" : "application/xml") || m.bytes.byteLength > 52428800 || g("sha256").update(m.bytes).digest("hex") !== m.digest) return v("transport");
233
+ if (await a(e, x.scope, {
234
+ kind: "asset",
235
+ digest: m.digest
236
+ }, {
237
+ ...x,
238
+ admit: async (e, t, n, r) => {
239
+ if (t.id !== d.id || r.outputId !== p.outputId) return v("changed");
240
+ await x.admit(e, t, n, r);
241
+ }
242
+ }) === null) return v("changed");
243
+ if (!Number.isSafeInteger(m.safetyGeneration) || m.safetyGeneration < 0 || m.safetyGeneration > 1e5) return v("transport");
244
+ if (u = m.safetyGeneration, (await o(e, x.scope, { take: 1 })).generation !== u) return v("changed");
245
+ if (!Array.isArray(m.uses) || m.uses.length > 1e5) return v("transport");
246
+ for (let t of m.uses) {
247
+ let n = new URL(t.documentUrl), i = {
248
+ host: n.hostname,
249
+ path: n.pathname
250
+ };
251
+ if (n.protocol !== "https:" || n.host !== n.hostname || n.origin + n.pathname !== t.documentUrl || r(i.path) !== i.path || !d.manifest.paths.some((e) => e.host === i.host)) return v("transport");
252
+ if (await a(e, x.scope, {
253
+ kind: "url",
254
+ url: t.documentUrl
255
+ }, {
256
+ ...x,
257
+ admit: async (e, t, n, r) => {
258
+ if (t.id !== d.id || r.outputId !== p.outputId) return v("changed");
259
+ await x.admit(e, t, n, r);
260
+ }
261
+ }) === null) return v("changed");
262
+ await w(e, d, p, i, t.media, l);
263
+ }
264
+ await x.admit(e, d, f, p), t = {
265
+ bytes: new Uint8Array(m.bytes),
266
+ digest: m.digest,
267
+ contentType: m.contentType
268
+ };
269
+ }
270
+ });
271
+ return d === null || t === void 0 ? v("not-found") : u === d.safetyGeneration ? (C(l), t) : v("changed");
272
+ });
273
+ return C(l), u;
274
+ },
275
+ catch: y
276
+ });
277
+ return {
278
+ page: (e) => b(T(e)),
279
+ redirect: (e) => b(D(e)),
280
+ document: (e) => b(m.map(E("document", e), (e) => e.file)),
281
+ asset: (e) => b(m.map(E("asset", e), (e) => e.file)),
282
+ control: (e) => b(O(e)),
283
+ admittedDocument: (e) => b(m.flatMap(E("admitted-document", e), (e) => e.admitted === void 0 ? m.fail(new n("transport")) : m.succeed(e.admitted)))
284
+ };
285
+ };
286
+ export { b as createCmsPublicOutputs };
@@ -0,0 +1,16 @@
1
+ import { CmsPublicBuildUnavailable as e } from "./publicBuild.js";
2
+ import { admitSnapshotPresentation as t, copySnapshotConsentPurposes as n, snapshotPresentationFromChoices as r, snapshotPresentations as i } from "./snapshotPresentation.js";
3
+ import { canonicalJson as a } from "@voltro/runtime";
4
+ // src/publicPresentation.ts
5
+ var o = (t) => {
6
+ if (t === void 0) return;
7
+ if (typeof t != "object" || !t || Array.isArray(t) || Object.keys(t).length > 128) throw new e("request");
8
+ let n = Object.entries(Object.getOwnPropertyDescriptors(t)).filter(([, e]) => e.enumerable);
9
+ if (n.some(([, e]) => !Object.hasOwn(e, "value") || !Number.isSafeInteger(e.value) || e.value < 0)) throw new e("request");
10
+ return Object.fromEntries(n.map(([e, t]) => [e, Number(t.value)]));
11
+ }, s = (o, s) => {
12
+ let c = n(o.consentPurposes), l = o.presentations.map((e) => a(t(c, e))).sort(), u = i(c, 257).map(a).sort();
13
+ if (a(l) !== a(u)) throw new e("transport");
14
+ return r(c, s);
15
+ };
16
+ export { o as copyPublicConsentChoices, s as selectPublicPresentation };
@@ -0,0 +1,37 @@
1
+ import { lockSiteState as e } from "./siteState.js";
2
+ import { CmsPublicBuildUnavailable as t } from "./publicBuild.js";
3
+ import { readPublicRouteHistoryPage as n, readPublicRouteHistoryUrl as r } from "./publicRouteHistoryStore.js";
4
+ import { readPublicRouteBinding as i } from "./publicRouteRegistryBinding.js";
5
+ import { copyRouteDispositionDefinition as a } from "./routeDispositions.js";
6
+ import { readApprovedRouteDispositionUrl as o } from "./routeDispositionStore.js";
7
+ import { readRouteHistoryPage as s, readRouteHistoryUrl as c } from "./routeHistoryStore.js";
8
+ import { lockOutputRouteHistoryCapture as l } from "./outputActivationStore.js";
9
+ import { isPrivateNativeRouteReservation as u } from "./privateNativeRouteReservation.js";
10
+ import { canonicalJson as d } from "@voltro/runtime";
11
+ // src/publicRouteDispositionAdmission.ts
12
+ var f = (e) => {
13
+ throw new t(e);
14
+ }, p = (e, t) => {
15
+ if (!Number.isSafeInteger(t) || t < 0 || e.action.kind === "hold" || e.activeFrom !== null && t < e.activeFrom || e.activeUntil !== null && t >= e.activeUntil) return f("changed");
16
+ }, m = async (t, m, h, g, _) => {
17
+ let v = a(h), y = await l(t, m);
18
+ if (y.generation !== g) return f("changed");
19
+ await e(t, m);
20
+ let b = await i(t, m);
21
+ if (b === null || (await s(t, m, {
22
+ expectedRevision: g,
23
+ take: 1
24
+ })).sourceDigest !== y.sourceDigest || (await n(t, m, { take: 1 })).revision < 1) return f("changed");
25
+ let x = await r(t, m, v.source.url), S = await c(t, m, v.source.url);
26
+ if (x?.active || S?.active || u(b.definition.routing, new URL(v.source.url).pathname, !1)) return f("not-found");
27
+ if (x === null && S === null) return f("transport");
28
+ if (x !== null && x.routeId !== v.source.routeId || S !== null && S.routeId !== v.source.routeId) return f("changed");
29
+ let C = await o(t, m, v.source.url);
30
+ if (C === null || d(C.definition) !== d(v)) return f("changed");
31
+ if (p(v, _), v.action.kind === "redirect") {
32
+ let e = v.action.target, n = await r(t, m, e.url), i = await c(t, m, e.url);
33
+ if (u(b.definition.routing, new URL(e.url).pathname, n?.active === !0) || n !== null && (!n.active || n.routeId !== e.routeId) || i === null || !i.active || i.routeId !== e.routeId) return f("changed");
34
+ }
35
+ return v;
36
+ };
37
+ export { m as admitPublicRouteDisposition, p as assertPublicRouteDispositionTime };
@@ -0,0 +1,11 @@
1
+ import { createRouteHistoryStore as e } from "./routeHistoryStorage.js";
2
+ // src/publicRouteHistoryStore.ts
3
+ var t = "_voltro_cms_public_route_history_heads", n = "_voltro_cms_public_route_history", { routeHistoryTables: r, readRouteHistoryPage: i, readRouteHistoryUrl: a, replaceRouteHistory: o, iterateRouteHistory: s } = e({
4
+ heads: t,
5
+ entries: n,
6
+ headPrefix: "cprh",
7
+ entryPrefix: "cpre",
8
+ headIndex: "cms_public_route_history_head_scope",
9
+ entryIndex: "cms_public_route_history_url_scope"
10
+ });
11
+ export { n as PUBLIC_ROUTE_HISTORY_ENTRIES, t as PUBLIC_ROUTE_HISTORY_HEADS, s as iteratePublicRouteHistory, r as publicRouteHistoryTables, i as readPublicRouteHistoryPage, a as readPublicRouteHistoryUrl, o as replacePublicRouteHistory };
@@ -0,0 +1,33 @@
1
+ import { publicRouteRegistryFail as e } from "./publicRouteRegistry.js";
2
+ import { outputActivationHash as t } from "./outputActivation.js";
3
+ import { copyObservedRoutes as n } from "./routeHistoryStorage.js";
4
+ import { iteratePublicRouteHistory as r, readPublicRouteHistoryPage as i } from "./publicRouteHistoryStore.js";
5
+ import { readPublicRouteNamespace as a, withPublicRouteNamespaceBoundary as o } from "./publicRouteNamespace.js";
6
+ import { canonicalJson as s } from "@voltro/runtime";
7
+ // src/publicRouteHistoryView.ts
8
+ var c = 1e5, l = 67108864, u = (u, d) => o(async () => {
9
+ let f = await a(u, d), { entries: p, next: m, ...h } = await i(u, d, { take: 1 });
10
+ return h.revision === 0 ? e("history") : h.historyCount > c ? e("bounds") : t(n(f.routes)) === h.currentDigest ? {
11
+ namespace: f,
12
+ history: h,
13
+ entries: async function* () {
14
+ let i = [], a = 2, c = r(u, d, h.revision)[Symbol.asyncIterator]();
15
+ for (;;) {
16
+ let t = await o(() => c.next());
17
+ if (t.done) break;
18
+ let n = t.value;
19
+ if (a += Buffer.byteLength(s(n)) + 1, a > l) return e("bounds");
20
+ if (n.active) {
21
+ if (i.length >= h.currentCount) return e("history");
22
+ i.push({
23
+ url: n.url,
24
+ routeId: n.routeId
25
+ });
26
+ }
27
+ yield n;
28
+ }
29
+ if (i.length !== h.currentCount || t(n(i)) !== h.currentDigest) return e("history");
30
+ }
31
+ } : e("history");
32
+ });
33
+ export { u as readPublicRouteHistoryView };
@@ -0,0 +1,4 @@
1
+ import { publicRouteRegistryFail as e } from "./publicRouteRegistry.js";
2
+ // src/publicRouteIntegrity.ts
3
+ var t = (t, n) => t.integrityQuery === void 0 ? e("configuration") : t.integrityQuery(n);
4
+ export { t as queryPublicRouteIntegrity };
@@ -0,0 +1,5 @@
1
+ import { publicRouteRegistryFail as e } from "./publicRouteRegistry.js";
2
+ import { readPublicRouteBinding as t } from "./publicRouteRegistryBinding.js";
3
+ // src/publicRouteMutation.ts
4
+ var n = async (n, r, i, a) => n.savepoint === void 0 ? i || await t(n, r) !== null ? e("configuration") : a() : n.savepoint(a), r = async (t, n) => t.savepoint === void 0 ? e("configuration") : t.savepoint(n);
5
+ export { n as withPublicRouteMutation, r as withPublicRouteStateMutation };
@@ -0,0 +1,133 @@
1
+ import { publicRouteRegistryFail as e } from "./publicRouteRegistry.js";
2
+ import { ContentLocationUnavailable as t } from "./errors.js";
3
+ import { readPublicationBoundary as n } from "./changes.js";
4
+ import { queryPublicRouteIntegrity as r } from "./publicRouteIntegrity.js";
5
+ import { normalizeHost as i } from "./domainHost.js";
6
+ import { copyOutputActivationScope as a, outputActivationHash as o } from "./outputActivation.js";
7
+ import { copyCanonicalPublicRouteUrl as s } from "./publicRouteUrl.js";
8
+ import { RouteHistoryUnavailable as c } from "./routeHistoryStorage.js";
9
+ import { readPublicRouteHistoryPage as l, replacePublicRouteHistory as u } from "./publicRouteHistoryStore.js";
10
+ import { SnapshotRoutingUnavailable as d, nativeSnapshotRouteId as f } from "./snapshotRouting.js";
11
+ import { CMS_SITE_DOMAINS_TABLE as p } from "./domains.js";
12
+ import { readLiveContentRouteView as m } from "./liveContentRouteView.js";
13
+ import { ContentRouteMaterializationUnavailable as h, materializeContentRoutes as g } from "./contentRouteMaterializer.js";
14
+ import { and as _, eq as v, gt as y } from "@voltro/database";
15
+ import { canonicalJson as b } from "@voltro/runtime";
16
+ // src/publicRouteNamespace.ts
17
+ var x = 1e5, S = 67108864, C = async (t, n) => {
18
+ let a = [], o = /* @__PURE__ */ new Set(), s, c = 0, l = 0;
19
+ for (;;) {
20
+ let u = await r(t, {
21
+ table: p,
22
+ predicate: _(v("tenantId", n.tenantId), v("site", n.site), ...s === void 0 ? [] : [y("id", s)]),
23
+ lock: "update",
24
+ order: [{
25
+ column: "id",
26
+ direction: "asc"
27
+ }],
28
+ take: 200,
29
+ skip: void 0,
30
+ projection: void 0
31
+ });
32
+ if (u.length === 0) break;
33
+ for (let t of u) {
34
+ if (++l > 1e4) return e("bounds");
35
+ if (typeof t.id != "string" || t.id <= (s ?? "") || t.tenantId !== n.tenantId || t.site !== n.site || typeof t.host != "string" || i(t.host) !== t.host || o.has(t.host) || typeof t.isPrimary != "boolean" || !["pending", "verified"].includes(String(t.status))) return e("state");
36
+ if (s = t.id, o.add(t.host), t.status === "pending") {
37
+ if (t.isPrimary) return e("state");
38
+ continue;
39
+ }
40
+ let r = t.verifiedAt instanceof Date ? t.verifiedAt.getTime() : NaN;
41
+ if (!Number.isSafeInteger(r) || r < 0 || t.isPrimary && ++c > 1) return e("state");
42
+ a.push({
43
+ host: t.host,
44
+ primary: t.isPrimary
45
+ });
46
+ }
47
+ }
48
+ return a.sort((e, t) => e.host < t.host ? -1 : +(e.host > t.host));
49
+ }, w = async (t, r) => {
50
+ let i;
51
+ try {
52
+ i = a(r);
53
+ } catch {
54
+ return e("scope");
55
+ }
56
+ let { binding: c, site: l, view: u } = await m(t, i), d = await n(t, i), p = await C(t, i), h = /* @__PURE__ */ new Map(), _ = [], v = 2;
57
+ for await (let t of g({
58
+ scope: i,
59
+ site: l,
60
+ types: c.definition.types,
61
+ routing: c.definition.routing,
62
+ definitionDigest: c.definition.definitionDigest
63
+ }, u)) {
64
+ if (!t.key.startsWith("path:")) continue;
65
+ let n = t.value.path;
66
+ if (typeof n != "string" || t.key !== "path:" + o(n)) return e("state");
67
+ if (h.has(n)) return e("conflict");
68
+ if (h.size >= x || (v += Buffer.byteLength(b(t)), v > S)) return e("bounds");
69
+ h.set(n, t);
70
+ }
71
+ let y = [...h.values()].sort((e, t) => String(e.value.path) < String(t.value.path) ? -1 : 1);
72
+ for (let t of y) {
73
+ let n = t.value, r = String(n.path), a = n.ownership, o = a.owner === "cms" ? String(n.routeId) : a.code === null ? e("state") : f(i, String(n.localeId), a.code.file, r);
74
+ for (let t of p) {
75
+ if (_.length >= x) return e("bounds");
76
+ let n;
77
+ try {
78
+ n = s("https://" + t.host + r);
79
+ } catch {
80
+ return e("state");
81
+ }
82
+ if (v += Buffer.byteLength(b({
83
+ url: n,
84
+ routeId: o
85
+ })), v > S) return e("bounds");
86
+ _.push({
87
+ url: n,
88
+ routeId: o
89
+ });
90
+ }
91
+ }
92
+ let w = o({
93
+ scope: i,
94
+ bindingId: c.id,
95
+ bindingRevision: c.revision,
96
+ definition: c.definition,
97
+ boundary: d,
98
+ domains: p,
99
+ paths: y
100
+ });
101
+ return {
102
+ scope: i,
103
+ binding: c,
104
+ boundary: d,
105
+ domains: p,
106
+ paths: y,
107
+ routes: _,
108
+ sourceDigest: w
109
+ };
110
+ }, T = async (t, n) => {
111
+ let r = await D(t, n), i = await l(t, r.scope, { take: 1 });
112
+ if (i.revision === 0) return e("history");
113
+ let a = await u(t, r.scope, {
114
+ expectedRevision: i.revision,
115
+ sourceDigest: r.sourceDigest,
116
+ routes: r.routes
117
+ });
118
+ return {
119
+ ...r,
120
+ history: a
121
+ };
122
+ }, E = async (n) => {
123
+ try {
124
+ return await n();
125
+ } catch (n) {
126
+ if (n instanceof t) return e(n.reason === "bounds" ? "bounds" : "location");
127
+ if (n instanceof c) return e(n.reason === "bounds" || n.reason === "revision" || n.reason === "scope" ? n.reason : "history");
128
+ if (n instanceof h) return e(n.reason === "publication" ? "state" : n.reason);
129
+ if (n instanceof d) return e(n.reason === "collision" ? "conflict" : "configuration");
130
+ throw n;
131
+ }
132
+ }, D = (...e) => E(() => w(...e)), O = (...e) => E(() => T(...e));
133
+ export { D as readPublicRouteNamespace, O as reconcilePublicRouteNamespace, E as withPublicRouteNamespaceBoundary };
@@ -0,0 +1,35 @@
1
+ import { publicRouteRegistryFail as e } from "./publicRouteRegistry.js";
2
+ import { compileContentRouteTypes as t } from "./contentRouteTypes.js";
3
+ import { readPublicRouteBinding as n } from "./publicRouteRegistryBinding.js";
4
+ import { reconcilePublicRouteNamespace as r } from "./publicRouteNamespace.js";
5
+ import { canonicalJson as i } from "@voltro/runtime";
6
+ // src/publicRoutePublication.ts
7
+ var a = /* @__PURE__ */ new WeakMap(), o = (e) => i(e), s = (t, n) => typeof t.tenantId != "string" || t.tenantId === "" ? e("scope") : {
8
+ tenantId: t.tenantId,
9
+ site: n.site,
10
+ environment: n.environment
11
+ }, c = async (c, l, u, d) => {
12
+ let f = s(u, d), p = await n(c, f);
13
+ if (p === null) return l.locations !== void 0 && l.locations.length > 0 ? e("configuration") : void 0;
14
+ let m = p.definition.types.find((e) => e.name === l.name);
15
+ if (m === void 0) return l.locations !== void 0 && l.locations.length > 0 ? e("configuration") : void 0;
16
+ let h = t([l]);
17
+ if (!h.ok || i(h.types[0]) !== i(m)) return e("configuration");
18
+ let g = a.get(c)?.get(o(f));
19
+ g === void 0 ? await r(c, f) : g.dirty = !0;
20
+ }, l = async (t, n, i) => t.savepoint === void 0 ? e("configuration") : t.savepoint(async () => {
21
+ let e = a.get(t);
22
+ e === void 0 && (e = /* @__PURE__ */ new Map(), a.set(t, e));
23
+ let s = o(n), c = e.get(s) ?? {
24
+ depth: 0,
25
+ dirty: !1
26
+ };
27
+ e.set(s, c), c.depth++;
28
+ try {
29
+ let e = await i();
30
+ return c.depth === 1 && c.dirty && await r(t, n), e;
31
+ } finally {
32
+ c.depth--, c.depth === 0 && e.delete(s), e.size === 0 && a.delete(t);
33
+ }
34
+ });
35
+ export { s as publicationRouteScope, c as reconcilePublishedContentRoutes, l as withPublicRoutePublicationBatch };
@@ -0,0 +1,16 @@
1
+ import { Schema as e } from "effect";
2
+ // src/publicRouteRegistry.ts
3
+ var t = class extends e.TaggedError()("PublicRouteRegistryUnavailable", { reason: e.Literals([
4
+ "scope",
5
+ "definition",
6
+ "configuration",
7
+ "history",
8
+ "state",
9
+ "revision",
10
+ "conflict",
11
+ "bounds",
12
+ "location"
13
+ ]) }) {}, n = (e) => {
14
+ throw new t({ reason: e });
15
+ };
16
+ export { t as PublicRouteRegistryUnavailable, n as publicRouteRegistryFail };