@voltro/cms 0.85.0 → 0.87.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (244) hide show
  1. package/CHANGELOG.md +5987 -0
  2. package/README.md +138 -0
  3. package/THIRD-PARTY-NOTICES.md +864 -253
  4. package/dist/ContentForm.js +282 -0
  5. package/dist/RichDocumentEditor.js +550 -0
  6. package/dist/RichDocumentView.js +177 -0
  7. package/dist/RichTextSurface.js +135 -0
  8. package/dist/aiCandidates.js +199 -0
  9. package/dist/aiOperations.js +152 -0
  10. package/dist/applicationBuildSnapshotService.js +101 -0
  11. package/dist/assetRenditions.js +102 -0
  12. package/dist/assetRevision.js +46 -0
  13. package/dist/assetUseRights.js +72 -0
  14. package/dist/audiences.js +31 -0
  15. package/dist/availability.js +124 -0
  16. package/dist/blueprint.js +166 -0
  17. package/dist/build.d.ts +3063 -0
  18. package/dist/build.js +37 -0
  19. package/dist/buildApplicationAdmission.js +16 -0
  20. package/dist/buildApplicationCatalog.js +136 -0
  21. package/dist/buildApplicationCatalogTable.js +24 -0
  22. package/dist/buildApplicationRest.js +99 -0
  23. package/dist/buildApplicationUpload.js +111 -0
  24. package/dist/buildSnapshot.js +401 -0
  25. package/dist/buildSnapshotApplicationPin.js +32 -0
  26. package/dist/buildSnapshotRest.js +210 -0
  27. package/dist/buildSnapshotService.js +265 -0
  28. package/dist/buildSnapshotTables.js +25 -0
  29. package/dist/bulk.js +282 -0
  30. package/dist/cacheIdentity.js +152 -0
  31. package/dist/changes.js +307 -0
  32. package/dist/cmsContext.js +229 -0
  33. package/dist/collections.js +224 -0
  34. package/dist/consent.js +29 -0
  35. package/dist/contentLocations.js +53 -0
  36. package/dist/contentProjection.js +83 -0
  37. package/dist/contentRouteIdentity.js +13 -0
  38. package/dist/contentRouteMaterializer.js +97 -0
  39. package/dist/contentRouteTypes.js +39 -0
  40. package/dist/contentSeo.js +189 -0
  41. package/dist/contentTreePath.js +60 -0
  42. package/dist/contentType.js +208 -0
  43. package/dist/contentValues.js +18 -0
  44. package/dist/contentfulImport.js +162 -0
  45. package/dist/copies.js +89 -0
  46. package/dist/cutover.js +202 -0
  47. package/dist/deliveryChecks.js +138 -0
  48. package/dist/domainHost.js +7 -0
  49. package/dist/domains.js +139 -0
  50. package/dist/draftTexts.js +164 -0
  51. package/dist/duplicates.js +78 -0
  52. package/dist/edgePurge.js +69 -0
  53. package/dist/editHistory.js +113 -0
  54. package/dist/effectForm.js +11 -0
  55. package/dist/environmentAliases.js +138 -0
  56. package/dist/environments.js +147 -0
  57. package/dist/errors.js +107 -0
  58. package/dist/experiments.js +528 -0
  59. package/dist/exposure.js +28 -0
  60. package/dist/extensionManifest.js +81 -0
  61. package/dist/extensions.js +314 -0
  62. package/dist/fieldSchema.js +199 -0
  63. package/dist/formStrings.js +74 -0
  64. package/dist/frontendBindings.js +99 -0
  65. package/dist/frontendMedia.js +18 -0
  66. package/dist/glossary.js +73 -0
  67. package/dist/history.js +54 -0
  68. package/dist/htmlImport.js +297 -0
  69. package/dist/index.d.ts +771 -54
  70. package/dist/index.js +89 -6082
  71. package/dist/initializePublicRoutes.js +28 -0
  72. package/dist/liveContentRouteView.js +76 -0
  73. package/dist/media.js +29 -0
  74. package/dist/metrics.js +46 -0
  75. package/dist/migration.js +193 -0
  76. package/dist/migrationStages.js +13 -0
  77. package/dist/nativeOutputDeploymentService.js +205 -0
  78. package/dist/outputActivation.js +234 -0
  79. package/dist/outputActivationOrigin.js +51 -0
  80. package/dist/outputActivationStore.js +411 -0
  81. package/dist/outputActivationTables.js +11 -0
  82. package/dist/outputActivationTarget.js +81 -0
  83. package/dist/outputActivationTargetTable.js +25 -0
  84. package/dist/outputDeployment.js +174 -0
  85. package/dist/outputDeploymentRest.js +168 -0
  86. package/dist/outputDeploymentService.js +241 -0
  87. package/dist/outputRouteGraph.js +177 -0
  88. package/dist/outputSafetyArtifact.js +147 -0
  89. package/dist/outputTargetRest.js +62 -0
  90. package/dist/pathSegmentEncoding.js +4 -0
  91. package/dist/presenceAnchors.js +68 -0
  92. package/dist/preview.js +31 -0
  93. package/dist/privateCmsTransport.js +76 -0
  94. package/dist/privateNativeRouteReservation.js +10 -0
  95. package/dist/promotion.js +116 -0
  96. package/dist/publicBuild.js +90 -0
  97. package/dist/publicBuildRest.js +98 -0
  98. package/dist/publicBuildService.js +63 -0
  99. package/dist/publicOutputHttp.js +129 -0
  100. package/dist/publicOutputService.js +287 -0
  101. package/dist/publicPresentation.js +17 -0
  102. package/dist/publicRouteDispositionAdmission.js +38 -0
  103. package/dist/publicRouteHistoryStore.js +12 -0
  104. package/dist/publicRouteHistoryView.js +34 -0
  105. package/dist/publicRouteIntegrity.js +5 -0
  106. package/dist/publicRouteMutation.js +6 -0
  107. package/dist/publicRouteNamespace.js +134 -0
  108. package/dist/publicRoutePublication.js +36 -0
  109. package/dist/publicRouteRegistry.js +17 -0
  110. package/dist/publicRouteRegistryBinding.js +194 -0
  111. package/dist/publicRouteRegistryDefinition.js +76 -0
  112. package/dist/publicRouteSitePublication.js +40 -0
  113. package/dist/publicRouteTables.js +13 -0
  114. package/dist/publicRouteUrl.js +18 -0
  115. package/dist/publicationSeo.js +52 -0
  116. package/dist/publicationState.js +296 -0
  117. package/dist/quality.js +188 -0
  118. package/dist/reconfigurePublicRoutes.js +41 -0
  119. package/dist/recurrence.js +78 -0
  120. package/dist/redirects.js +130 -0
  121. package/dist/referenceGraph.js +224 -0
  122. package/dist/references.js +173 -0
  123. package/dist/release.js +241 -0
  124. package/dist/renderReadAuthority.js +43 -0
  125. package/dist/renderReadGrant.js +137 -0
  126. package/dist/rest.js +52 -0
  127. package/dist/review.js +160 -0
  128. package/dist/richDocument.js +521 -0
  129. package/dist/richInline.js +100 -0
  130. package/dist/routeDispositionGraph.js +44 -0
  131. package/dist/routeDispositionRest.js +51 -0
  132. package/dist/routeDispositionService.js +73 -0
  133. package/dist/routeDispositionStore.js +289 -0
  134. package/dist/routeDispositionTables.js +5 -0
  135. package/dist/routeDispositions.js +91 -0
  136. package/dist/routeHistoryStorage.js +320 -0
  137. package/dist/routeHistoryStore.js +12 -0
  138. package/dist/schedule.js +80 -0
  139. package/dist/search.js +148 -0
  140. package/dist/selectionIntent.js +164 -0
  141. package/dist/seo.js +31 -0
  142. package/dist/series.js +105 -0
  143. package/dist/share.js +112 -0
  144. package/dist/siteBindings.js +159 -0
  145. package/dist/siteBuildCandidate.js +104 -0
  146. package/dist/siteDelivery.js +115 -0
  147. package/dist/siteState.js +47 -0
  148. package/dist/snapshotAddressGraph.js +55 -0
  149. package/dist/snapshotAddressRead.js +73 -0
  150. package/dist/snapshotAppConsumer.js +71 -0
  151. package/dist/snapshotAppExecution.js +102 -0
  152. package/dist/snapshotApplication.js +75 -0
  153. package/dist/snapshotApprovedRouteDispositions.js +44 -0
  154. package/dist/snapshotAssetAssembly.js +70 -0
  155. package/dist/snapshotAssetAssemblyRest.js +50 -0
  156. package/dist/snapshotBindingRead.js +61 -0
  157. package/dist/snapshotCodeSeo.js +29 -0
  158. package/dist/snapshotComponent.js +34 -0
  159. package/dist/snapshotComponentSource.js +24 -0
  160. package/dist/snapshotConsumer.js +87 -0
  161. package/dist/snapshotContentIdentity.js +10 -0
  162. package/dist/snapshotDefinitions.js +264 -0
  163. package/dist/snapshotDocumentAssembly.js +193 -0
  164. package/dist/snapshotDocumentAssemblyRest.js +84 -0
  165. package/dist/snapshotDocumentProjection.js +202 -0
  166. package/dist/snapshotDocumentTransfer.js +35 -0
  167. package/dist/snapshotDocumentTransferRest.js +80 -0
  168. package/dist/snapshotDomains.js +56 -0
  169. package/dist/snapshotEnvironment.js +31 -0
  170. package/dist/snapshotFieldPlan.js +85 -0
  171. package/dist/snapshotFrontend.js +103 -0
  172. package/dist/snapshotLink.js +8 -0
  173. package/dist/snapshotMedia.js +111 -0
  174. package/dist/snapshotMediaCapture.js +246 -0
  175. package/dist/snapshotMediaFields.js +225 -0
  176. package/dist/snapshotMediaRead.js +185 -0
  177. package/dist/snapshotMediaReader.js +13 -0
  178. package/dist/snapshotObservation.js +16 -0
  179. package/dist/snapshotObservedRouteHistory.js +34 -0
  180. package/dist/snapshotOutputTransfer.js +78 -0
  181. package/dist/snapshotPageLoader.js +7 -0
  182. package/dist/snapshotPageSeo.js +59 -0
  183. package/dist/snapshotPathLocale.js +15 -0
  184. package/dist/snapshotPresentation.js +86 -0
  185. package/dist/snapshotPresentationPolicy.js +12 -0
  186. package/dist/snapshotProjection.js +119 -0
  187. package/dist/snapshotPublicAccess.js +161 -0
  188. package/dist/snapshotPublicRouteHistory.js +40 -0
  189. package/dist/snapshotReadAdmission.js +38 -0
  190. package/dist/snapshotRedirectOutput.js +151 -0
  191. package/dist/snapshotRedirectTargets.js +24 -0
  192. package/dist/snapshotRedirects.js +132 -0
  193. package/dist/snapshotReference.js +8 -0
  194. package/dist/snapshotReferenceAddress.js +10 -0
  195. package/dist/snapshotReferenceGraph.js +79 -0
  196. package/dist/snapshotReferenceRead.js +65 -0
  197. package/dist/snapshotRelease.js +99 -0
  198. package/dist/snapshotRender.js +361 -0
  199. package/dist/snapshotRenderDependencies.js +178 -0
  200. package/dist/snapshotRenditions.js +88 -0
  201. package/dist/snapshotRichDocument.js +62 -0
  202. package/dist/snapshotRoleTransfer.js +106 -0
  203. package/dist/snapshotRoleTransferRest.js +99 -0
  204. package/dist/snapshotRouteAdmission.js +71 -0
  205. package/dist/snapshotRouteDispatch.js +111 -0
  206. package/dist/snapshotRouteDispositionPlan.js +73 -0
  207. package/dist/snapshotRouteRead.js +43 -0
  208. package/dist/snapshotRoutes.js +79 -0
  209. package/dist/snapshotRouting.js +113 -0
  210. package/dist/snapshotSeo.js +179 -0
  211. package/dist/snapshotSeoControls.js +101 -0
  212. package/dist/snapshotSeoDocumentInventory.js +115 -0
  213. package/dist/snapshotSeoDocuments.js +129 -0
  214. package/dist/snapshotSeoMerge.js +85 -0
  215. package/dist/snapshotSeoMetadata.js +137 -0
  216. package/dist/snapshotSeoOutput.js +173 -0
  217. package/dist/snapshotSeoPathSets.js +105 -0
  218. package/dist/snapshotSeoRead.js +88 -0
  219. package/dist/snapshotSite.js +128 -0
  220. package/dist/snapshotSitemapFiles.js +36 -0
  221. package/dist/snapshotTreeDependencies.js +58 -0
  222. package/dist/snapshotTreeLoader.js +10 -0
  223. package/dist/snapshotTreeRead.js +158 -0
  224. package/dist/staticPathSet.js +177 -0
  225. package/dist/staticPathSetRest.js +129 -0
  226. package/dist/staticPathSetService.js +249 -0
  227. package/dist/staticPathSetStore.js +338 -0
  228. package/dist/stewardship.js +146 -0
  229. package/dist/taxonomy.js +36 -0
  230. package/dist/team.js +103 -0
  231. package/dist/templates.js +106 -0
  232. package/dist/trackChanges.js +197 -0
  233. package/dist/translation.js +64 -0
  234. package/dist/tree.js +87 -0
  235. package/dist/usage.js +50 -0
  236. package/dist/validation.js +192 -0
  237. package/dist/visualEditing.js +60 -0
  238. package/dist/web.d.ts +709 -7
  239. package/dist/web.js +50 -2
  240. package/dist/workflow.js +322 -0
  241. package/dist/write.js +419 -0
  242. package/dist/xliff.js +325 -0
  243. package/package.json +20 -6
  244. package/dist/presenceAnchors-4iHAVQB3.js +0 -4367
@@ -0,0 +1,241 @@
1
+ import { lockSiteState as e } from "./siteState.js";
2
+ import { lockPublicationStream as t } from "./changes.js";
3
+ import { OutputActivationUnavailable as n, copyOutputActivationApp as r, copyOutputActivationScope as i, copyOutputActivationSet as a, makeOutputRegionReceipt as o, verifyOutputActivationProbe as s, verifyOutputRegionReceipts as c } from "./outputActivation.js";
4
+ import { lockRenderReadCredential as l, readRenderReadCredential as u } from "./renderReadAuthority.js";
5
+ import { activateOutputSet as d, lockOutputRouteHistoryCapture as f, probeOutputActivation as p, readOutputActivationMarker as m } from "./outputActivationStore.js";
6
+ import { bindOutputDeployment as h, readOutputDeployment as g } from "./outputDeployment.js";
7
+ import { Effect as _, Schema as v } from "effect";
8
+ import { canonicalJson as y, dataStoreApiKeyStore as b, makeApiKeyService as x } from "@voltro/runtime";
9
+ //#region src/outputDeploymentService.ts
10
+ var S = "cms:deploy", C = class extends v.TaggedError()("CmsOutputDeploymentUnavailable", { reason: v.Literals([
11
+ "configuration",
12
+ "credential",
13
+ "input",
14
+ "integrity",
15
+ "state",
16
+ "changed",
17
+ "generation",
18
+ "regions",
19
+ "denied",
20
+ "expired",
21
+ "unadmitted"
22
+ ]) }) {}, w = (e) => {
23
+ throw new C({ reason: e });
24
+ }, T = (e, t) => y(e) === y(t), E = (e) => {
25
+ if (!Number.isSafeInteger(e.expectedRevision) || e.expectedRevision < 0 || e.expectedRevision >= 2147483647 || !Number.isSafeInteger(e.expectedGeneration) || e.expectedGeneration < 0 || e.expectedGeneration >= 2147483647 || !["forward", "rollback"].includes(e.mode) || !Array.isArray(e.outputs) || e.outputs.length < 1 || e.outputs.length > 64) return w("input");
26
+ let t = e.outputs.map((e) => typeof e != "object" || !e || typeof e.region != "string" || !/^[A-Za-z0-9_-]{1,64}$/.test(e.region) || typeof e.outputId != "string" || !/^[a-f0-9]{64}$/.test(e.outputId) ? w("input") : {
27
+ region: e.region,
28
+ outputId: e.outputId
29
+ }).sort((e, t) => e.region < t.region ? -1 : +(e.region > t.region));
30
+ return new Set(t.map((e) => e.region)).size === t.length ? t : w("regions");
31
+ }, D = (e) => !/^[A-Za-z0-9_-]{1,64}$/.test(e.id) || !(e.material instanceof Uint8Array) || e.material.byteLength < 32 ? w("configuration") : {
32
+ id: e.id,
33
+ material: new Uint8Array(e.material)
34
+ }, O = (e, r, a) => {
35
+ let o = i(r), s = (e) => _.tryPromise({
36
+ try: e,
37
+ catch: (e) => e instanceof C ? e : new C({ reason: e instanceof n ? e.reason : "state" })
38
+ }), c = async (e, t, n, r) => {
39
+ n.throwIfAborted();
40
+ let i = await l(e, o, t, a());
41
+ return i === null || !i.scopes.includes("cms:deploy") || r !== void 0 && i.id !== r ? w("credential") : (n.throwIfAborted(), i.id);
42
+ };
43
+ return {
44
+ boundary: s,
45
+ authorize: c,
46
+ transaction: async (n, r, i) => {
47
+ r.throwIfAborted();
48
+ let s = await e.transactional((e) => u(e, o, n, a()));
49
+ return s === null || !s.scopes.includes("cms:deploy") ? w("credential") : e.transactional(async (e) => {
50
+ await f(e, o), await t(e, o);
51
+ let l = await c(e, n, r, s.id), u = await x(b(e)).verify(n, a());
52
+ if (u === null || u.id !== l) return w("credential");
53
+ await c(e, n, r, l);
54
+ let d = await i(e, l);
55
+ return await c(e, n, r, l), d;
56
+ });
57
+ }
58
+ };
59
+ }, k = (t) => {
60
+ let n = i(t.scope), l = t.store, u = t.now ?? Date.now, f = D(t.key), _ = [f, ...(t.verificationKeys ?? []).map(D)];
61
+ if (new Set(_.map((e) => e.id)).size !== _.length) return w("configuration");
62
+ let v = Object.fromEntries(Object.entries(t.regions).map(([e, t]) => {
63
+ if (!/^[A-Za-z0-9_-]{1,64}$/.test(e) || typeof t.verify != "function") return w("configuration");
64
+ let n = D(t.key), r = [n, ...(t.verificationKeys ?? []).map(D)];
65
+ return new Set(r.map((e) => e.id)).size === r.length ? [e, {
66
+ key: n,
67
+ keys: r,
68
+ verify: t.verify.bind(t)
69
+ }] : w("configuration");
70
+ })), y = Object.fromEntries(Object.entries(v).map(([e, t]) => [e, t.keys])), b = t.readDeployment.bind(t), x = t.readSet.bind(t), S = t.admit.bind(t), C = t.readRoutes.bind(t), { boundary: k, authorize: A, transaction: j } = O(l, n, u), M = async (e, t) => {
71
+ if (!/^[a-f0-9]{64}$/.test(t)) return w("input");
72
+ let r = a(await x(e, t));
73
+ return r.id !== t || !T(r.manifest.scope, n) || r.manifest.regions.required.some((e) => !Object.hasOwn(v, e)) ? w("changed") : r;
74
+ }, N = (e) => structuredClone(e), P = async (e, t) => {
75
+ let n = await M(e, t), i = await b(e, n.manifest.app.deploymentId);
76
+ return !T(r(i.app), n.manifest.app) || i.renderPolicyDigest !== n.manifest.renderPolicyDigest ? w("changed") : n;
77
+ }, F = async (e, t, r, i) => {
78
+ let a = await g(e, n), o = await m(e, n, {
79
+ keys: _,
80
+ regionKeys: y
81
+ });
82
+ return a?.revision === r.expectedRevision + 1 && o?.generation === r.expectedGeneration + 1 && T(a.app, t.manifest.app) && a.renderPolicyDigest === t.manifest.renderPolicyDigest && T(o.set, t) && o.probe.mode === r.mode && T(o.receipts.map(({ region: e, outputId: t }) => ({
83
+ region: e,
84
+ outputId: t
85
+ })).sort((e, t) => e.region < t.region ? -1 : +(e.region > t.region)), i) ? {
86
+ deployment: a,
87
+ activation: o
88
+ } : null;
89
+ };
90
+ return {
91
+ inspect: (e) => {
92
+ let t = N(e);
93
+ return k((e) => j(t.credential, e, async (e) => {
94
+ let t = await g(e, n), r = await m(e, n, {
95
+ keys: _,
96
+ regionKeys: y
97
+ });
98
+ return {
99
+ revision: t?.revision ?? 0,
100
+ generation: r?.generation ?? 0
101
+ };
102
+ }));
103
+ },
104
+ deploy: (e) => {
105
+ let t = N(e);
106
+ return k(async (e) => {
107
+ let r = E(t), i = await j(t.credential, e, async (e) => {
108
+ let n = await M(e, t.targetId);
109
+ return T(r.map((e) => e.region), n.manifest.regions.required) ? {
110
+ set: n,
111
+ prior: await F(e, n, t, r)
112
+ } : w("regions");
113
+ });
114
+ return i.prior === null ? (await Promise.all(r.map((e) => v[e.region].verify(l, i.set, e.outputId))), j(t.credential, e, async (a, s) => {
115
+ let c = await M(a, t.targetId);
116
+ if (!T(c, i.set)) return w("changed");
117
+ let l = await F(a, c, t, r);
118
+ if (l !== null) return l;
119
+ await P(a, t.targetId), await A(a, t.credential, e, s);
120
+ let m = await h(a, n, {
121
+ expectedRevision: t.expectedRevision,
122
+ app: c.manifest.app,
123
+ renderPolicyDigest: c.manifest.renderPolicyDigest
124
+ }), g = async (...n) => {
125
+ await A(a, t.credential, e, s);
126
+ let r = await S(...n);
127
+ return await A(a, t.credential, e, s), r;
128
+ }, b = await p(a, c, {
129
+ expectedGeneration: t.expectedGeneration,
130
+ mode: t.mode,
131
+ key: f,
132
+ now: u(),
133
+ ttlMs: 3e4,
134
+ admit: g
135
+ }), x = r.map((e) => o(b, e.region, v[e.region].key, e.outputId));
136
+ return {
137
+ deployment: m,
138
+ activation: await d(a, c, {
139
+ probe: b,
140
+ keys: _,
141
+ regionKeys: y,
142
+ receipts: x,
143
+ now: u(),
144
+ admit: g,
145
+ readRoutes: C
146
+ })
147
+ };
148
+ })) : i.prior;
149
+ });
150
+ },
151
+ confirm: (e) => {
152
+ let t = N(e);
153
+ return k(async (e) => {
154
+ let n = E(t);
155
+ return j(t.credential, e, async (e) => {
156
+ let r = await M(e, t.targetId);
157
+ return T(n.map((e) => e.region), r.manifest.regions.required) ? await F(e, r, t, n) ?? w("changed") : w("regions");
158
+ });
159
+ });
160
+ },
161
+ bind: (t) => {
162
+ let i = N(t);
163
+ return k((t) => j(i.credential, t, async (a, o) => {
164
+ if (!/^[A-Za-z0-9_-]{1,64}$/.test(i.deploymentId)) return w("input");
165
+ let s = await b(a, i.deploymentId), c = r(s.app);
166
+ if (c.deploymentId !== i.deploymentId) return w("changed");
167
+ await A(a, i.credential, t, o), await e(a, n);
168
+ let l = await g(a, n, { lock: "update" });
169
+ if (l !== null && l.revision === i.expectedRevision + 1 && T(l.app, c) && l.renderPolicyDigest === s.renderPolicyDigest) return await A(a, i.credential, t, o), l;
170
+ let u = await h(a, n, {
171
+ expectedRevision: i.expectedRevision,
172
+ app: c,
173
+ renderPolicyDigest: s.renderPolicyDigest
174
+ });
175
+ return await A(a, i.credential, t, o), u;
176
+ }));
177
+ },
178
+ probe: (e) => {
179
+ let t = N(e);
180
+ return k((e) => j(t.credential, e, async (n, r) => {
181
+ let i = await M(n, t.targetId), a = await p(n, i, {
182
+ expectedGeneration: t.expectedGeneration,
183
+ mode: t.mode,
184
+ key: f,
185
+ now: u(),
186
+ ttlMs: 3e4,
187
+ admit: async (...i) => {
188
+ await A(n, t.credential, e, r);
189
+ let a = await S(...i);
190
+ return await A(n, t.credential, e, r), a;
191
+ }
192
+ });
193
+ return await A(n, t.credential, e, r), a;
194
+ }));
195
+ },
196
+ observeRegion: (e) => {
197
+ let t = N(e);
198
+ return k(async (e) => {
199
+ let r = await j(t.credential, e, async (e, r) => {
200
+ let i = await M(e, t.targetId), a = s(t.probe, _, u()), o = v[t.region];
201
+ return a.targetId !== i.id || !T(a.scope, n) || !i.manifest.regions.required.includes(t.region) || o === void 0 || !/^[a-f0-9]{64}$/.test(t.outputId) ? w("regions") : {
202
+ parent: r,
203
+ set: i,
204
+ proof: a,
205
+ port: o
206
+ };
207
+ });
208
+ return await r.port.verify(l, r.set, t.outputId), j(t.credential, e, async (e, n) => n === r.parent ? T(await M(e, t.targetId), r.set) ? (s(r.proof, _, u()), o(r.proof, t.region, r.port.key, t.outputId)) : w("changed") : w("credential"));
209
+ });
210
+ },
211
+ activate: (e) => {
212
+ let t = N(e);
213
+ return k((e) => j(t.credential, e, async (r, i) => {
214
+ let a = await M(r, t.targetId), o = await m(r, n, {
215
+ keys: _,
216
+ regionKeys: y
217
+ });
218
+ if (o?.probe.id === t.probe.id) {
219
+ let n = s(t.probe, _, o.activatedAt), l = c(a, n, t.receipts, y), u = (e) => [...e].sort((e, t) => e.region < t.region ? -1 : +(e.region > t.region));
220
+ return o.set.id !== a.id || !T(o.probe, n) || !T(u(o.receipts), u(l)) ? w("changed") : (await A(r, t.credential, e, i), o);
221
+ }
222
+ let l = await d(r, a, {
223
+ probe: t.probe,
224
+ keys: _,
225
+ regionKeys: y,
226
+ receipts: t.receipts,
227
+ now: u(),
228
+ admit: async (...n) => {
229
+ await A(r, t.credential, e, i);
230
+ let a = await S(...n);
231
+ return await A(r, t.credential, e, i), a;
232
+ },
233
+ readRoutes: C
234
+ });
235
+ return await A(r, t.credential, e, i), l;
236
+ }));
237
+ }
238
+ };
239
+ };
240
+ //#endregion
241
+ export { S as CMS_OUTPUT_DEPLOY_SCOPE, C as CmsOutputDeploymentUnavailable, O as createCmsOutputDeploymentAuthority, k as createCmsOutputDeployments };
@@ -0,0 +1,177 @@
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
+ //#region 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
+ //#endregion
177
+ export { y as admitOutputRouteGraph };
@@ -0,0 +1,147 @@
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
+ //#region 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
+ //#endregion
147
+ export { s as OutputSafetyArtifactUnavailable, b as captureOutputSafetyArtifact, m as copyOutputSafetySelection, x as readCurrentOutputSafetyArtifact, g as readOutputSafetySnapshot, S as readVerifiedOutputSafetyArtifact };
@@ -0,0 +1,62 @@
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
+ //#region 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
+ //#endregion
62
+ export { f as cmsOutputTargetRest };
@@ -0,0 +1,4 @@
1
+ //#region src/pathSegmentEncoding.ts
2
+ var e = (e) => encodeURIComponent(e);
3
+ //#endregion
4
+ export { e as encodeCanonicalPathSegment };