@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
package/dist/promotion.js CHANGED
@@ -1,12 +1,16 @@
1
- import { asTyped as e } from "./effectForm.js";
2
- import { ContentIdConflict as t, ContentNotFound as n, ContentValidationFailed as r, ReferenceUnavailable as i, ReleaseNotEditable as a, ReviewRequired as o, RevisionMismatch as s } from "./errors.js";
3
- import { pickDeclared as c, saveDraft as l } from "./write.js";
4
- import { addToRelease as u, createRelease as d, publishRelease as f } from "./release.js";
5
- import { and as p, eq as m, neq as h } from "@voltro/database";
6
- //#region src/promotion.ts
7
- var g = (e, t, n, r, i = []) => e.query({
1
+ import { PublicRouteRegistryUnavailable as e } from "./publicRouteRegistry.js";
2
+ import { ChangeFeedUnavailable as t, ContentIdConflict as n, ContentNotFound as r, ContentValidationFailed as i, ReferenceUnavailable as a, ReleaseNotEditable as o, ReviewRequired as s, RevisionMismatch as c } from "./errors.js";
3
+ import { asTyped as l } from "./effectForm.js";
4
+ import { pickDeclared as u } from "./contentValues.js";
5
+ import { withPublicRouteStateMutation as d } from "./publicRouteMutation.js";
6
+ import { saveDraft as f } from "./write.js";
7
+ import { addToRelease as p, createRelease as m, publishRelease as h } from "./release.js";
8
+ import { lockEnvironmentPairForPublication as g } from "./environments.js";
9
+ import { and as _, eq as v, neq as y } from "@voltro/database";
10
+ // src/promotion.ts
11
+ var b = (e, t, n, r, i = []) => e.query({
8
12
  table: t,
9
- predicate: p(m("site", n), m("environment", r), h("status", "archived"), ...i),
13
+ predicate: _(v("site", n), v("environment", r), y("status", "archived"), ...i),
10
14
  order: [{
11
15
  column: "id",
12
16
  direction: "asc"
@@ -14,25 +18,25 @@ var g = (e, t, n, r, i = []) => e.query({
14
18
  take: void 0,
15
19
  skip: void 0,
16
20
  projection: void 0
17
- }), _ = (e) => JSON.stringify(e, (e, t) => typeof t == "object" && t && !Array.isArray(t) && !(t instanceof Date) ? Object.fromEntries(Object.entries(t).sort(([e], [t]) => e < t ? -1 : 1)) : t), v = (e) => {
21
+ }), x = (e) => JSON.stringify(e, (e, t) => typeof t == "object" && t && !Array.isArray(t) && !(t instanceof Date) ? Object.fromEntries(Object.entries(t).sort(([e], [t]) => e < t ? -1 : 1)) : t), S = (e) => {
18
22
  for (let t of [
19
23
  "title",
20
24
  "name",
21
25
  "slug"
22
26
  ]) if (typeof e[t] == "string" && e[t] !== "") return e[t];
23
27
  return String(e.documentId);
24
- }, y = (e) => `${String(e.documentId)}\u0000${String(e.locale)}`, b = async (e, t, n) => {
28
+ }, C = (e) => `${String(e.documentId)}\u0000${String(e.locale)}`, w = async (e, t, n) => {
25
29
  let r = [];
26
30
  for (let i of t) {
27
- let t = await g(e, `${i.name}_published`, n.site, n.from);
31
+ let t = await b(e, `${i.name}_published`, n.site, n.from);
28
32
  if (t.length === 0) continue;
29
- let a = new Map((await g(e, `${i.name}_published`, n.site, n.to)).map((e) => [y(e), e])), o = new Map((await g(e, `${i.name}_drafts`, n.site, n.to)).map((e) => [y(e), e]));
33
+ let a = new Map((await b(e, `${i.name}_published`, n.site, n.to)).map((e) => [C(e), e])), o = new Map((await b(e, `${i.name}_drafts`, n.site, n.to)).map((e) => [C(e), e]));
30
34
  for (let e of t) {
31
- let t = a.get(y(e)), n = o.get(y(e)), s = {
35
+ let t = a.get(C(e)), n = o.get(C(e)), s = {
32
36
  contentType: i.name,
33
37
  documentId: String(e.documentId),
34
38
  locale: String(e.locale),
35
- title: v(e)
39
+ title: S(e)
36
40
  };
37
41
  n !== void 0 && n.status === "draft" ? r.push({
38
42
  ...s,
@@ -40,68 +44,72 @@ var g = (e, t, n, r, i = []) => e.query({
40
44
  }) : t === void 0 ? r.push({
41
45
  ...s,
42
46
  change: "new"
43
- }) : _(c(i, e)) !== _(c(i, t)) && r.push({
47
+ }) : x(u(i, e)) !== x(u(i, t)) && r.push({
44
48
  ...s,
45
49
  change: "changed"
46
50
  });
47
51
  }
48
52
  }
49
53
  return r;
50
- }, x = async (e, t, n, r, i) => {
51
- if (r.length === 0) return {
54
+ }, T = async (e, n, r, i, a) => {
55
+ if (i.length === 0) return {
52
56
  ok: !1,
53
57
  reason: "nothingSelected",
54
58
  items: []
55
59
  };
56
- let a = await b(e, t, n), o = new Map(a.map((e) => [`${e.contentType}\u0000${e.documentId}\u0000${e.locale}`, e])), s = r.filter((e) => !o.has(`${e.contentType}\u0000${e.documentId}\u0000${e.locale}`));
57
- if (s.length > 0) return {
60
+ let o = await g(e, n, r), s = await w(e, n, r), c = new Map(s.map((e) => [`${e.contentType}\u0000${e.documentId}\u0000${e.locale}`, e])), l = i.filter((e) => !c.has(`${e.contentType}\u0000${e.documentId}\u0000${e.locale}`));
61
+ if (l.length > 0) return {
58
62
  ok: !1,
59
63
  reason: "notInPlan",
60
- items: s
64
+ items: l
61
65
  };
62
- let p = r.filter((e) => o.get(`${e.contentType}\u0000${e.documentId}\u0000${e.locale}`).change === "blocked");
63
- if (p.length > 0) return {
66
+ let _ = i.filter((e) => c.get(`${e.contentType}\u0000${e.documentId}\u0000${e.locale}`).change === "blocked");
67
+ if (_.length > 0) return {
64
68
  ok: !1,
65
69
  reason: "blocked",
66
- items: p
70
+ items: _
67
71
  };
68
- let h = new Map(t.map((e) => [e.name, e])), _ = await d(e, {
69
- name: i.name,
70
- site: n.site,
71
- environment: n.to
72
- }), v = String(_.id);
73
- for (let t of r) {
74
- let r = h.get(t.contentType), [i] = await g(e, `${r.name}_published`, n.site, n.from, [m("documentId", t.documentId), m("locale", t.locale)]), a = {
75
- site: n.site,
76
- environment: n.to,
77
- locale: t.locale
78
- }, [o] = await g(e, `${r.name}_drafts`, n.site, n.to, [m("documentId", t.documentId), m("locale", t.locale)]), s = c(r, i), d = await l(e, r, o === void 0 ? {
79
- ...s,
80
- documentId: t.documentId
81
- } : {
82
- ...s,
83
- id: o.id
84
- }, a);
85
- await u(e, v, {
86
- type: r,
87
- id: String(d.id),
88
- locale: t.locale,
89
- revisionId: String(d.revisionId)
90
- });
91
- }
92
- return await f(e, t, v), {
93
- ok: !0,
94
- releaseId: v,
95
- promoted: r.length
96
- };
97
- }, S = [
98
- r,
99
- t,
72
+ let y = new Map(n.map((e) => [e.name, e]));
73
+ return d(e, async () => {
74
+ let s = await m(e, {
75
+ name: a.name,
76
+ site: r.site,
77
+ environment: r.to
78
+ }), c = String(s.id);
79
+ for (let n of i) {
80
+ let i = y.get(n.contentType), [a] = await b(e, `${i.name}_published`, r.site, r.from, [v("documentId", n.documentId), v("locale", n.locale)]), s = {
81
+ site: r.site,
82
+ environment: r.to,
83
+ locale: n.locale
84
+ }, [l] = await b(e, `${i.name}_drafts`, r.site, r.to, [v("documentId", n.documentId), v("locale", n.locale)]);
85
+ if (o === null || a === void 0 || a.tenantId !== o.tenantId) throw new t({ reason: "scope" });
86
+ let d = u(i, a), m = await f(e, i, l === void 0 ? {
87
+ ...d,
88
+ documentId: n.documentId
89
+ } : {
90
+ ...d,
91
+ id: l.id
92
+ }, s);
93
+ await p(e, c, {
94
+ type: i,
95
+ id: String(m.id),
96
+ locale: n.locale,
97
+ revisionId: String(m.revisionId)
98
+ });
99
+ }
100
+ return await h(e, n, c), {
101
+ ok: !0,
102
+ releaseId: c,
103
+ promoted: i.length
104
+ };
105
+ });
106
+ }, E = [
107
+ i,
100
108
  n,
101
- s,
102
- a,
109
+ r,
110
+ c,
103
111
  o,
104
- i
105
- ], C = (...t) => e(() => b(...t), ...S), w = (...t) => e(() => x(...t), ...S);
106
- //#endregion
107
- export { b as planPromotion, C as planPromotionEffect, x as promote, w as promoteEffect };
112
+ s,
113
+ a
114
+ ], D = (...e) => l(() => w(...e), ...E), O = (...n) => l(() => T(...n), ...E, t, e);
115
+ export { w as planPromotion, D as planPromotionEffect, T as promote, O as promoteEffect };
@@ -0,0 +1,89 @@
1
+ import { encodeCanonicalPathSegment as e } from "./pathSegmentEncoding.js";
2
+ // src/publicBuild.ts
3
+ var t = class extends Error {
4
+ reason;
5
+ _tag = "CmsPublicBuildUnavailable";
6
+ constructor(e) {
7
+ super("Public build unavailable: " + e), this.reason = e;
8
+ }
9
+ }, n = (e) => {
10
+ throw new t(e);
11
+ }, r = (e) => typeof e == "string" && /^[a-f0-9]{64}$/.test(e), i = (e) => {
12
+ if (typeof e != "object" || !e || Array.isArray(e)) return n("identity");
13
+ let t = e;
14
+ return Object.keys(t).sort().join(",") !== "executionId,inputsId,snapshotDigest,version" || t.version !== 1 || !r(t.snapshotDigest) || !r(t.inputsId) || !r(t.executionId) ? n("identity") : {
15
+ version: 1,
16
+ snapshotDigest: t.snapshotDigest,
17
+ inputsId: t.inputsId,
18
+ executionId: t.executionId
19
+ };
20
+ }, a = (e) => {
21
+ let t = i(e);
22
+ return [
23
+ "1",
24
+ t.snapshotDigest,
25
+ t.inputsId,
26
+ t.executionId
27
+ ].join(".");
28
+ }, o = (e) => {
29
+ if (typeof e != "string" || !/^1\.[a-f0-9]{64}\.[a-f0-9]{64}\.[a-f0-9]{64}$/.test(e)) return n("identity");
30
+ let [, t, r, a] = e.split(".");
31
+ return i({
32
+ version: 1,
33
+ snapshotDigest: t,
34
+ inputsId: r,
35
+ executionId: a
36
+ });
37
+ }, s = (e = globalThis.document) => {
38
+ if (e === void 0) return null;
39
+ let t = e.querySelectorAll("meta[name=\"voltro:cms-build\"]");
40
+ return t.length === 0 ? null : t.length === 1 ? o(t[0].getAttribute("content") ?? "") : n("identity");
41
+ }, c = (e) => `<meta name="voltro:cms-build" content="${a(e)}" />`, l = (t) => {
42
+ if (typeof t != "string" || t.length > 4096 || !t.startsWith("/") || t.startsWith("//") || /[\\?#\x00-\x20\x7f]/.test(t) || t.slice(1).includes("//")) return n("request");
43
+ try {
44
+ if (new URL(t, "https://captured.invalid").pathname !== t) return n("request");
45
+ let r = t.split("/").map((t) => {
46
+ let r = decodeURIComponent(t).normalize("NFC");
47
+ return /[\\/\x00-\x1f\x7f]/.test(r) || r === "." || r === ".." ? n("request") : e(r);
48
+ }).join("/").replace(/\/$/, "") || "/";
49
+ return r.length > 4096 ? n("request") : r;
50
+ } catch {
51
+ return n("request");
52
+ }
53
+ }, u = async (e, t, r = {}) => {
54
+ let o = i(e), s = l(t), c = new URLSearchParams({
55
+ build: a(o),
56
+ path: s
57
+ }), u;
58
+ try {
59
+ u = await (r.fetch ?? globalThis.fetch)("/v1/cms/public-build/page?" + c, {
60
+ method: "GET",
61
+ credentials: "same-origin",
62
+ cache: "no-store",
63
+ redirect: "error",
64
+ ...r.signal === void 0 ? {} : { signal: r.signal }
65
+ });
66
+ } catch (e) {
67
+ if (r.signal?.aborted) throw e;
68
+ return n("transport");
69
+ }
70
+ if (u.status === 409) return n("changed");
71
+ if (u.status === 404) return n("not-found");
72
+ if (u.status === 403 || u.status === 410) return n("denied");
73
+ if (!u.ok || u.headers.get("content-type")?.split(";", 1)[0] !== "application/json") return n("transport");
74
+ let d;
75
+ try {
76
+ d = await u.json();
77
+ } catch {
78
+ return n("transport");
79
+ }
80
+ if (typeof d != "object" || !d || Array.isArray(d)) return n("request");
81
+ let f = d;
82
+ return Object.keys(f).sort().join(",") !== "build,page,path,version" || f.version !== 1 || f.path !== s || a(i(f.build)) !== a(o) ? n("changed") : {
83
+ version: 1,
84
+ build: o,
85
+ path: s,
86
+ page: f.page
87
+ };
88
+ };
89
+ export { t as CmsPublicBuildUnavailable, l as canonicalCmsPublicPath, c as cmsPublicBuildMeta, i as copyCmsPublicBuildIdentity, o as decodeCmsPublicBuildIdentity, a as encodeCmsPublicBuildIdentity, u as loadCmsPublicBuildPage, s as readCmsPublicBuildIdentity };
@@ -0,0 +1,97 @@
1
+ import { CmsPublicBuildUnavailable as e, decodeCmsPublicBuildIdentity as t } from "./publicBuild.js";
2
+ import { Effect as n, Schema as r } from "effect";
3
+ import { defineQuery as i } from "@voltro/protocol";
4
+ import { RestRouteError as a, projectedFailure as o, publicApiRoute as s, restError as c, restRoutesToHttpRoutes as l } from "@voltro/protocol/rest";
5
+ // src/publicBuildRest.ts
6
+ var u = {
7
+ "cache-control": "private, no-store",
8
+ pragma: "no-cache",
9
+ vary: "Cookie"
10
+ }, d = r.Struct({
11
+ version: r.Literal(1),
12
+ snapshotDigest: r.String,
13
+ inputsId: r.String,
14
+ executionId: r.String
15
+ }), f = r.Struct({
16
+ build: r.String,
17
+ path: r.String
18
+ }), p = {
19
+ identity: 400,
20
+ request: 400,
21
+ changed: 409,
22
+ "not-found": 404,
23
+ denied: 410,
24
+ transport: 503
25
+ }, m = i({
26
+ name: "cms.publicBuildPage",
27
+ input: f,
28
+ output: r.Struct({
29
+ version: r.Literal(1),
30
+ build: d,
31
+ path: r.String,
32
+ page: r.Unknown
33
+ }),
34
+ error: r.Struct({
35
+ _tag: r.Literal("CmsPublicBuildUnavailable"),
36
+ reason: r.Literals([
37
+ "identity",
38
+ "request",
39
+ "changed",
40
+ "not-found",
41
+ "denied",
42
+ "transport"
43
+ ])
44
+ }),
45
+ openAccess: "Anonymous presentation from the current independently admitted public output marker. Private read credentials never grant this endpoint.",
46
+ publicApi: {
47
+ method: "GET",
48
+ path: "/v1/cms/public-build/page",
49
+ security: !1,
50
+ idempotent: !1,
51
+ operationId: "cmsPublicBuildPage",
52
+ tags: ["CMS public builds"],
53
+ errorStatus: { CmsPublicBuildUnavailable: 409 },
54
+ additionalErrorStatuses: { CmsPublicBuildUnavailable: [...new Set(Object.values(p))].filter((e) => e !== 409) },
55
+ summary: "Read a current captured public page presentation",
56
+ description: "Exact public build selector, admitted request host and canonical path. Active generation, region, output membership, current rights and monotone denies are checked. No live fallback; private no-store including errors."
57
+ }
58
+ }), h = (t) => {
59
+ let n = o(new e(t), m, { errorStatus: { CmsPublicBuildUnavailable: p[t] } });
60
+ throw n instanceof a ? c(n.status, n.body, u) : n;
61
+ }, g = (e, r) => {
62
+ let i = [s(m, async (i, a) => {
63
+ let o = i;
64
+ [...new URLSearchParams(a.query).keys()].sort().join(",") !== "build,path" && h("request");
65
+ let s = (() => {
66
+ try {
67
+ return t(o.build);
68
+ } catch {
69
+ return h("identity");
70
+ }
71
+ })(), c = r.choices?.(a.headers), l = await n.runPromise(n.result(e.page({
72
+ build: s,
73
+ path: o.path,
74
+ host: r.host(a.headers),
75
+ ...c === void 0 ? {} : { choices: c }
76
+ })));
77
+ if (l._tag === "Success") return l.success;
78
+ h(l.failure.reason);
79
+ })];
80
+ return {
81
+ routes: i,
82
+ httpRoutes: l(i).map((e) => ({
83
+ ...e,
84
+ handle: async (...t) => {
85
+ let n = await e.handle(...t);
86
+ return {
87
+ ...n,
88
+ headers: {
89
+ ...n.headers,
90
+ ...u
91
+ }
92
+ };
93
+ }
94
+ }))
95
+ };
96
+ };
97
+ export { g as cmsPublicBuildRest };
@@ -0,0 +1,62 @@
1
+ import { normalizeHost as e } from "./domainHost.js";
2
+ import { OutputActivationUnavailable as t } from "./outputActivation.js";
3
+ import { CmsPublicBuildUnavailable as n, canonicalCmsPublicPath as r, copyCmsPublicBuildIdentity as i, encodeCmsPublicBuildIdentity as a } from "./publicBuild.js";
4
+ import { readActiveOutput as o } from "./outputActivationStore.js";
5
+ import { copyPublicConsentChoices as s, selectPublicPresentation as c } from "./publicPresentation.js";
6
+ import { Effect as l } from "effect";
7
+ // src/publicBuildService.ts
8
+ var u = (u) => {
9
+ let d = { ...u.scope }, f = u.keys.map((e) => ({
10
+ id: e.id,
11
+ material: new Uint8Array(e.material)
12
+ })), p = Object.fromEntries(Object.entries(u.regionKeys).map(([e, t]) => [e, t.map((e) => ({
13
+ id: e.id,
14
+ material: new Uint8Array(e.material)
15
+ }))])), m = u.region, h = u.admit, g = u.readPage, _ = u.store;
16
+ return { page: (v) => l.tryPromise({
17
+ try: async () => {
18
+ let t = i(v.build), l = e(v.host), y = r(v.path), b = s(v.choices);
19
+ if (l !== v.host) throw new n("request");
20
+ return _.transactional(async (e) => {
21
+ let r;
22
+ if (await o(e, d, {
23
+ kind: "url",
24
+ url: "https://" + l + y
25
+ }, {
26
+ keys: f,
27
+ regionKeys: p,
28
+ region: m,
29
+ lock: "share",
30
+ admit: async (e, i, o, s) => {
31
+ let d = {
32
+ version: 1,
33
+ snapshotDigest: i.manifest.snapshot.digest,
34
+ inputsId: i.manifest.app.inputsId,
35
+ executionId: i.manifest.app.executionId
36
+ };
37
+ if (a(d) !== a(t)) throw new n("changed");
38
+ if (!i.manifest.paths.some((e) => e.host === l)) throw new n("not-found");
39
+ await h(e, i, o, s);
40
+ let f = c(await u.readPresentations(e, i, s), b), p = await g(e, i, s, {
41
+ host: l,
42
+ path: y,
43
+ presentation: f
44
+ });
45
+ if (!p.found) throw new n("not-found");
46
+ let m = JSON.stringify(p.page);
47
+ if (m === void 0 || Buffer.byteLength(m) > 4194304) throw new n("transport");
48
+ await h(e, i, o, s), r = {
49
+ version: 1,
50
+ build: t,
51
+ path: y,
52
+ page: JSON.parse(m)
53
+ };
54
+ }
55
+ }) === null || r === void 0) throw new n("not-found");
56
+ return r;
57
+ });
58
+ },
59
+ catch: (e) => e instanceof n ? e : e instanceof t ? new n(e.reason === "denied" ? "denied" : "changed") : new n("transport")
60
+ }) };
61
+ };
62
+ export { u as createCmsPublicBuilds };
@@ -0,0 +1,128 @@
1
+ import { canonicalCmsPublicPath as e } from "./publicBuild.js";
2
+ import { Effect as t } from "effect";
3
+ import { storageByteSecurityHeaders as n } from "@voltro/plugin-storage/byte-security";
4
+ // src/publicOutputHttp.ts
5
+ var r = (r, i) => {
6
+ if (i.redirects && r.redirect === void 0) throw Error("Missing public redirect service");
7
+ let a = [
8
+ ...i.documents.map((e) => ({
9
+ ...e,
10
+ kind: "document"
11
+ })),
12
+ {
13
+ path: "/__voltro/media",
14
+ match: "prefix",
15
+ kind: "asset"
16
+ },
17
+ {
18
+ path: "/__voltro/web",
19
+ match: "prefix",
20
+ kind: "asset"
21
+ },
22
+ ...i.controls ? [
23
+ {
24
+ path: "/sitemap.xml",
25
+ match: "exact",
26
+ kind: "control"
27
+ },
28
+ {
29
+ path: "/robots.txt",
30
+ match: "exact",
31
+ kind: "control"
32
+ },
33
+ {
34
+ path: "/sitemaps",
35
+ match: "prefix",
36
+ kind: "control"
37
+ }
38
+ ] : []
39
+ ];
40
+ if (a.some((t) => e(t.path) !== t.path) || new Set(a.map((e) => e.path)).size !== a.length) throw Error("Invalid public output mounts");
41
+ return a.map((e) => ({
42
+ path: e.path,
43
+ match: e.match,
44
+ method: "GET",
45
+ answersOtherMethods: !0,
46
+ handle: async (a) => {
47
+ let o = {
48
+ "cache-control": "private, no-store",
49
+ pragma: "no-cache",
50
+ ...e.kind === "control" ? {} : { vary: "Cookie" },
51
+ "x-content-type-options": "nosniff"
52
+ };
53
+ if (a.method !== "GET" && a.method !== "HEAD" && !(i.redirects && e.kind === "document")) return {
54
+ status: 405,
55
+ headers: {
56
+ ...o,
57
+ allow: "GET, HEAD"
58
+ }
59
+ };
60
+ let s, c;
61
+ try {
62
+ s = i.host(a.headers), c = e.kind === "control" ? void 0 : i.choices?.(a.headers);
63
+ } catch {
64
+ return {
65
+ status: 400,
66
+ headers: o
67
+ };
68
+ }
69
+ if (i.redirects && e.kind === "document" && r.redirect !== void 0) {
70
+ let e = await t.runPromise(t.result(r.redirect({
71
+ host: s,
72
+ path: a.path,
73
+ ...c === void 0 ? {} : { choices: c }
74
+ })));
75
+ if (e._tag === "Success") {
76
+ let t = e.success;
77
+ return {
78
+ status: t.status,
79
+ headers: {
80
+ ...o,
81
+ ...t.location === null ? {} : { location: t.location },
82
+ "content-length": "0"
83
+ }
84
+ };
85
+ }
86
+ let n = e.failure.reason;
87
+ if (n !== "not-found") return {
88
+ status: n === "request" || n === "identity" ? 400 : n === "denied" ? 410 : n === "changed" ? 409 : 503,
89
+ headers: o
90
+ };
91
+ }
92
+ if (a.method !== "GET" && a.method !== "HEAD") return {
93
+ status: 405,
94
+ headers: {
95
+ ...o,
96
+ allow: "GET, HEAD"
97
+ }
98
+ };
99
+ let l = e.kind === "control" ? r.control({
100
+ host: s,
101
+ path: a.path
102
+ }) : r[e.kind]({
103
+ host: s,
104
+ path: a.path,
105
+ ...c === void 0 ? {} : { choices: c }
106
+ }), u = await t.runPromise(t.result(l));
107
+ if (u._tag === "Failure") {
108
+ let e = u.failure.reason;
109
+ return {
110
+ status: e === "request" || e === "identity" ? 400 : e === "not-found" ? 404 : e === "denied" ? 410 : e === "changed" ? 409 : 503,
111
+ headers: o
112
+ };
113
+ }
114
+ let d = u.success;
115
+ return {
116
+ status: 200,
117
+ headers: {
118
+ ...o,
119
+ ...e.path === "/__voltro/media" ? n(d.contentType) : {},
120
+ "content-length": String(d.bytes.byteLength)
121
+ },
122
+ contentType: d.contentType,
123
+ ...a.method === "HEAD" ? {} : { body: d.bytes }
124
+ };
125
+ }
126
+ }));
127
+ };
128
+ export { r as cmsPublicOutputHttp };