@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,173 @@
1
+ import { lockSiteState as e, lockSiteStateForRead as t } from "./siteState.js";
2
+ import { lockPublicationStream as n, readPublicationBoundary as r } from "./changes.js";
3
+ import { OutputActivationUnavailable as i, copyOutputActivationApp as a, copyOutputActivationScope as o, outputActivationContractDigest as s, outputActivationFail as c } from "./outputActivation.js";
4
+ import { StaticPathSetUnavailable as l } from "./staticPathSet.js";
5
+ import { lockOutputRouteHistoryCapture as u } from "./outputActivationStore.js";
6
+ import { AssetUseRightsUnavailable as d } from "./assetUseRights.js";
7
+ import { admitOutputRouteGraph as f } from "./outputRouteGraph.js";
8
+ import { and as p, eq as m, generateId as h, id as g, integer as _, json as v, table as y, text as b } from "@voltro/database";
9
+ import { tenant as x } from "@voltro/plugin-multitenancy/mixin";
10
+ import { canonicalJson as S } from "@voltro/runtime";
11
+ // src/outputDeployment.ts
12
+ var C = "_voltro_cms_output_deployments", w = "_voltro_cms_output_deployment_builds", T = y(C, {
13
+ id: g({ prefix: "coutdep" }),
14
+ site: b().maxLength(64),
15
+ environment: b().maxLength(64),
16
+ revision: _(),
17
+ app: v(),
18
+ renderPolicyDigest: b().maxLength(64)
19
+ }).with(x()).unique("cms_output_deployment_scope", [
20
+ "tenantId",
21
+ "site",
22
+ "environment"
23
+ ]), E = y(w, {
24
+ id: g({ prefix: "coutapp" }),
25
+ site: b().maxLength(64),
26
+ environment: b().maxLength(64),
27
+ deploymentId: b().maxLength(64),
28
+ app: v()
29
+ }).with(x()).unique("cms_output_deployment_identity", [
30
+ "tenantId",
31
+ "site",
32
+ "environment",
33
+ "deploymentId"
34
+ ]), D = Object.freeze([T, E]), O = (e) => p(m("tenantId", e.tenantId), m("site", e.site), m("environment", e.environment)), k = async (e, t, n = "update") => {
35
+ let [r] = await e.query({
36
+ table: C,
37
+ predicate: O(t),
38
+ lock: n,
39
+ order: [],
40
+ take: 1,
41
+ skip: void 0,
42
+ projection: void 0
43
+ });
44
+ return r === void 0 ? null : typeof r.id != "string" || !Number.isSafeInteger(r.revision) || Number(r.revision) < 1 || typeof r.renderPolicyDigest != "string" || !/^[a-f0-9]{64}$/.test(r.renderPolicyDigest) ? c("state") : {
45
+ id: r.id,
46
+ revision: Number(r.revision),
47
+ app: a(r.app),
48
+ renderPolicyDigest: r.renderPolicyDigest
49
+ };
50
+ }, A = async (e, t, n = "update") => await k(e, t, n) ?? c("state"), j = async (e, t, n = {}) => {
51
+ let r = await k(e, o(t), n.lock ?? "share");
52
+ return r === null ? null : {
53
+ revision: r.revision,
54
+ app: r.app,
55
+ renderPolicyDigest: r.renderPolicyDigest
56
+ };
57
+ }, M = async (e, t, n, r = "update") => {
58
+ let [i] = await e.query({
59
+ table: w,
60
+ predicate: p(O(t), m("deploymentId", n)),
61
+ lock: r,
62
+ order: [],
63
+ take: 1,
64
+ skip: void 0,
65
+ projection: void 0
66
+ });
67
+ if (i === void 0) return c("state");
68
+ let o = a(i.app);
69
+ return o.deploymentId === n ? o : c("integrity");
70
+ }, N = async (t, n, r) => {
71
+ let i = o(n), s = a(r.app);
72
+ if (!Number.isSafeInteger(r.expectedRevision) || r.expectedRevision < 0 || r.expectedRevision >= 2147483647 || !/^[a-f0-9]{64}$/.test(r.renderPolicyDigest)) return c("input");
73
+ await e(t, i);
74
+ let l = h({
75
+ kind: "typeid",
76
+ prefix: "coutapp"
77
+ }, w);
78
+ if (l === null) return c("state");
79
+ if (await t.insertIgnore(w, {
80
+ id: l,
81
+ ...i,
82
+ deploymentId: s.deploymentId,
83
+ app: s
84
+ }, { conflictColumns: [
85
+ "tenantId",
86
+ "site",
87
+ "environment",
88
+ "deploymentId"
89
+ ] }), S(await M(t, i, s.deploymentId)) !== S(s)) return c("changed");
90
+ if (r.expectedRevision === 0) {
91
+ let e = h({
92
+ kind: "typeid",
93
+ prefix: "coutdep"
94
+ }, C);
95
+ if (e === null) return c("state");
96
+ await t.insertIgnore(C, {
97
+ id: e,
98
+ ...i,
99
+ revision: 1,
100
+ app: s,
101
+ renderPolicyDigest: r.renderPolicyDigest
102
+ }, { conflictColumns: [
103
+ "tenantId",
104
+ "site",
105
+ "environment"
106
+ ] });
107
+ let n = await A(t, i);
108
+ return n.revision !== 1 || S(n.app) !== S(s) || n.renderPolicyDigest !== r.renderPolicyDigest ? c("changed") : {
109
+ revision: n.revision,
110
+ app: n.app,
111
+ renderPolicyDigest: n.renderPolicyDigest
112
+ };
113
+ }
114
+ let u = await A(t, i);
115
+ if (u.revision !== r.expectedRevision) return c("changed");
116
+ let d = u.revision + 1;
117
+ return await t.updateMany("_voltro_cms_output_deployments", {
118
+ revision: d,
119
+ app: s,
120
+ renderPolicyDigest: r.renderPolicyDigest
121
+ }, { where: p(O(i), m("id", u.id), m("revision", u.revision)) }) === 1 ? {
122
+ revision: d,
123
+ app: s,
124
+ renderPolicyDigest: r.renderPolicyDigest
125
+ } : c("changed");
126
+ }, P = (e, t) => {
127
+ if (s(e.app) !== s(t.manifest.app) || e.renderPolicyDigest !== t.manifest.renderPolicyDigest) return c("changed");
128
+ }, F = (t) => async (n, i) => {
129
+ let a = o(i.manifest.scope);
130
+ await e(n, a);
131
+ let l = await A(n, a), u = await r(n, a);
132
+ return S(await M(n, a, i.manifest.app.deploymentId)) === S(i.manifest.app) ? (P(l, i), await t(n, i), {
133
+ publicationGeneration: u.generation,
134
+ releaseId: u.releaseId,
135
+ deploymentId: l.app.deploymentId,
136
+ renderPolicyDigest: l.renderPolicyDigest,
137
+ contractDigest: s(l.app)
138
+ }) : c("changed");
139
+ }, I = (e) => {
140
+ if (typeof e != "object" || !e || !Array.isArray(e.pathKeys) || e.pathKeys.length < 1 || e.pathKeys.length > 64 || typeof e.verifyArtifacts != "function" || typeof e.use != "function" || e.now !== void 0 && typeof e.now != "function") return c("input");
141
+ let t = {
142
+ ...e,
143
+ pathKeys: e.pathKeys.map((e) => ({
144
+ id: e.id,
145
+ material: new Uint8Array(e.material)
146
+ }))
147
+ };
148
+ return async (e, r, a) => {
149
+ try {
150
+ let i = await u(e, r.manifest.scope);
151
+ return await F(async (e, r) => {
152
+ await n(e, r.manifest.scope);
153
+ let a = await t.verifyArtifacts(e, r);
154
+ await f(e, r, a, {
155
+ observed: i,
156
+ keys: t.pathKeys,
157
+ use: t.use,
158
+ ...t.now === void 0 ? {} : { now: t.now }
159
+ });
160
+ })(e, r, a);
161
+ } catch (e) {
162
+ if (e instanceof i) throw e;
163
+ return e instanceof l ? c("integrity") : e instanceof d ? c("denied") : c("changed");
164
+ }
165
+ };
166
+ }, L = (e) => async (n, r, i, a) => {
167
+ let s = o(r.manifest.scope);
168
+ await t(n, s);
169
+ let l = await A(n, s, "share");
170
+ if (S(await M(n, s, r.manifest.app.deploymentId, "share")) !== S(r.manifest.app)) return c("changed");
171
+ P(l, r), await e(n, r, i, a);
172
+ };
173
+ export { C as OUTPUT_DEPLOYMENTS, w as OUTPUT_DEPLOYMENT_BUILDS, N as bindOutputDeployment, I as makeOutputActivationAdmission, F as makeOutputDeploymentAdmission, L as makeOutputServingAdmission, E as outputDeploymentBuildsTable, D as outputDeploymentTables, T as outputDeploymentsTable, j as readOutputDeployment };
@@ -0,0 +1,167 @@
1
+ import { cmsCredential as e, privateCmsHttpRoutes as t, privateCmsOperation as n } from "./privateCmsTransport.js";
2
+ import { CmsOutputDeploymentUnavailable as r } from "./outputDeploymentService.js";
3
+ import { Schema as i } from "effect";
4
+ import { strictInput as a } from "@voltro/protocol";
5
+ // src/outputDeploymentRest.ts
6
+ var o = i.String.pipe(i.check(i.isPattern(/^[a-f0-9]{64}$/))), s = i.String.pipe(i.check(i.isPattern(/^[A-Za-z0-9_-]{1,64}$/))), c = i.String.pipe(i.check(i.isPattern(/^\d{20}$/))), l = i.Struct({
7
+ tenantId: s,
8
+ site: s,
9
+ environment: s
10
+ }), u = i.Struct({
11
+ deploymentId: s,
12
+ inputsId: o,
13
+ executionId: o,
14
+ contractVersion: i.Int,
15
+ bindingsDigest: o,
16
+ schemaDigest: o,
17
+ cacheKeyDigest: o
18
+ }), d = i.Struct({
19
+ publicationGeneration: c,
20
+ releaseId: i.NullOr(s),
21
+ deploymentId: s,
22
+ renderPolicyDigest: o,
23
+ contractDigest: o
24
+ }), f = i.Struct({
25
+ version: i.Literal(1),
26
+ id: o,
27
+ targetId: o,
28
+ scope: l,
29
+ expectedGeneration: i.Int,
30
+ mode: i.Literals(["forward", "rollback"]),
31
+ observation: d,
32
+ expiresAt: i.Int,
33
+ keyId: s,
34
+ signature: o
35
+ }), p = i.Struct({
36
+ version: i.Literal(1),
37
+ probeId: o,
38
+ targetId: o,
39
+ generation: i.Int,
40
+ region: s,
41
+ outputId: o,
42
+ keyId: s,
43
+ signature: o
44
+ }), m = i.Array(p).pipe(i.check(i.isMaxLength(64))), h = i.String.pipe(i.check(i.isMaxLength(253))), g = i.Struct({
45
+ version: i.Literal(2),
46
+ scope: l,
47
+ snapshot: i.Struct({
48
+ id: s,
49
+ digest: o,
50
+ releaseId: s,
51
+ publicationGeneration: c
52
+ }),
53
+ app: u,
54
+ renderPolicyDigest: o,
55
+ paths: i.Array(i.Struct({
56
+ host: h,
57
+ setId: o,
58
+ count: i.Int
59
+ })).pipe(i.check(i.isMaxLength(256))),
60
+ artifacts: i.Array(i.Struct({
61
+ host: h,
62
+ documents: o,
63
+ assets: o,
64
+ redirects: o,
65
+ sitemap: o,
66
+ robots: o,
67
+ deny: o
68
+ })).pipe(i.check(i.isMaxLength(256))),
69
+ cacheNamespace: o,
70
+ regions: i.Struct({
71
+ required: i.Array(s).pipe(i.check(i.isMaxLength(64))),
72
+ quorum: i.Int
73
+ })
74
+ }), _ = g, v = i.Struct({
75
+ id: s,
76
+ generation: i.Int,
77
+ set: i.Struct({
78
+ id: o,
79
+ manifest: _
80
+ }),
81
+ probe: f,
82
+ receipts: m,
83
+ activatedAt: i.Int
84
+ }), y = i.Struct({
85
+ targetId: o,
86
+ expectedRevision: i.Int,
87
+ expectedGeneration: i.Int,
88
+ mode: i.Literals(["forward", "rollback"]),
89
+ outputs: i.Array(i.Struct({
90
+ region: s,
91
+ outputId: o
92
+ })).pipe(i.check(i.isMaxLength(64)))
93
+ }), b = i.Struct({
94
+ deployment: i.Struct({
95
+ revision: i.Int,
96
+ app: u,
97
+ renderPolicyDigest: o
98
+ }),
99
+ activation: v
100
+ }), x = (t) => e(t, "CmsOutputDeploymentUnavailable"), S = (e, t, i, o, s, c) => ({
101
+ ...n({
102
+ namespace: "cms.outputDeployment",
103
+ path: "/v1/cms/output-deployments",
104
+ operationPrefix: "cmsOutputDeployment",
105
+ tags: ["CMS output deployment"],
106
+ error: r,
107
+ credentialError: "CmsOutputDeploymentUnavailable",
108
+ errorStatus: { CmsOutputDeploymentUnavailable: 409 }
109
+ }, e, t, i, a(o, "cms.outputDeployment." + e, !0), s, c),
110
+ maxBodyBytes: 65536
111
+ }), C = (e) => {
112
+ let n = [
113
+ S("inspect", "Read current deployment and activation epochs", "Fresh scoped cms:deploy authority. Metadata only; no output, provider or serving authority. Retain these exact epochs with the original deployment intent.", i.Struct({}), i.Struct({
114
+ revision: i.Int,
115
+ generation: i.Int
116
+ }), (t, n) => e.inspect({ credential: x(n) })),
117
+ S("deploy", "Atomically bind and publish one complete output target", "Fresh scoped cms:deploy authority. Verify every required physical region before a single transaction binds the original app and policy, admits the current graph, signs regional custody and activates the complete set. Failure rolls back the binding and activation together. Exact current lost acknowledgements return the same epochs and result.", y, b, (t, n) => e.deploy({
118
+ ...t,
119
+ credential: x(n)
120
+ })),
121
+ S("confirm", "Confirm one exact current native publication", "Fresh scoped cms:deploy authority. Acknowledge only the already committed original target, epochs, mode and complete regional output identity. This operation never stages, binds, probes, signs or activates a target. Missing, displaced or changed publications refuse; expired original private inputs do not prevent confirmation. The acknowledgement grants no public serving or Cloud readiness.", y, b, (t, n) => e.confirm({
122
+ ...t,
123
+ credential: x(n)
124
+ })),
125
+ S("bind", "Bind one admitted output deployment", "Dedicated scoped cms:deploy credential. The server resolves the original deployment contract and policy; the request supplies only its ID and expected revision. No execution, provider allocation or app contract comes from HTTP.", i.Struct({
126
+ deploymentId: s,
127
+ expectedRevision: i.Int
128
+ }), i.Struct({
129
+ revision: i.Int,
130
+ app: u,
131
+ renderPolicyDigest: o
132
+ }), (t, n) => e.bind({
133
+ ...t,
134
+ credential: x(n)
135
+ })),
136
+ S("probe", "Probe one complete output activation target", "Dedicated scoped deployment credential. The server resolves the immutable target, verifies current deployment/publication/graph/rights and signs a probe valid for at most 30 seconds. Target IDs grant no authority.", i.Struct({
137
+ targetId: o,
138
+ expectedGeneration: i.Int,
139
+ mode: i.Literals(["forward", "rollback"])
140
+ }), f, (t, n) => e.probe({
141
+ ...t,
142
+ credential: x(n)
143
+ })),
144
+ S("observeRegion", "Verify physical regional custody and sign its original probe", "The server reads the exact target/output through its fixed regional adapter and rehashes every role/file. Current scoped credential and original unexpired probe are checked after physical IO. No filesystem paths, signer keys, replacement probe or serving authority is accepted.", i.Struct({
145
+ targetId: o,
146
+ probe: f,
147
+ region: s,
148
+ outputId: o
149
+ }), p, (t, n) => e.observeRegion({
150
+ ...t,
151
+ credential: x(n)
152
+ })),
153
+ S("activate", "Atomically activate one fully admitted output set", "Fresh scoped deployment credential, current graph/rights and original probe/region policy guard the generation CAS. Exact recovery of an already committed current marker returns that same result without renewing its probe or advancing generation. It grants no public read permission; serving still enforces current denials and rights.", i.Struct({
154
+ targetId: o,
155
+ probe: f,
156
+ receipts: m
157
+ }), v, (t, n) => e.activate({
158
+ ...t,
159
+ credential: x(n)
160
+ }))
161
+ ];
162
+ return {
163
+ routes: n,
164
+ httpRoutes: t(n)
165
+ };
166
+ };
167
+ export { C as cmsOutputDeploymentRest, g as outputDeploymentManifestSchema };
@@ -0,0 +1,240 @@
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
+ // 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
+ export { S as CMS_OUTPUT_DEPLOY_SCOPE, C as CmsOutputDeploymentUnavailable, O as createCmsOutputDeploymentAuthority, k as createCmsOutputDeployments };