@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,127 @@
1
+ import { SiteBindingUnavailable as e } from "./errors.js";
2
+ import { compileSiteDelivery as t } from "./siteDelivery.js";
3
+ import { readPublicationBoundary as n } from "./changes.js";
4
+ import { readCapturedDocument as r, verifyPublicationState as i } from "./publicationState.js";
5
+ import { copySnapshotResource as a } from "./buildSnapshot.js";
6
+ import { copySnapshotAppCodePin as o } from "./snapshotDefinitions.js";
7
+ import { lockSiteContentBinding as s, siteContentBindingRevision as c } from "./siteBindings.js";
8
+ import { createHash as l } from "node:crypto";
9
+ import { canonicalJson as u } from "@voltro/runtime";
10
+ // src/snapshotSite.ts
11
+ var d = (n, r, i) => {
12
+ let s = {
13
+ tenantId: n.tenantId,
14
+ site: n.site,
15
+ environment: n.environment
16
+ }, c = t(r), d = c.definition, f = o(i);
17
+ if (d.id !== s.site || !d.environments.includes(s.environment)) throw new e({ reason: "scope" });
18
+ let p = l("sha256").update(u(d)).digest("hex");
19
+ return {
20
+ compiled: c,
21
+ definitionDigest: p,
22
+ site: a({
23
+ key: "configuration",
24
+ value: {
25
+ version: 3,
26
+ ...s,
27
+ app: f,
28
+ definitionDigest: p,
29
+ definition: {
30
+ id: d.id,
31
+ version: d.version,
32
+ environments: d.environments,
33
+ defaultEnvironment: d.defaultEnvironment,
34
+ bindings: d.bindings,
35
+ ...d.seo === void 0 ? {} : { seo: d.seo }
36
+ }
37
+ }
38
+ }),
39
+ locales: a({
40
+ key: "policy",
41
+ value: {
42
+ version: 1,
43
+ ...s,
44
+ app: f,
45
+ definitionDigest: p,
46
+ definition: {
47
+ version: d.version,
48
+ defaultLocale: d.defaultLocale,
49
+ sourceLocale: d.sourceLocale,
50
+ locales: d.locales
51
+ },
52
+ compiled: {
53
+ contentLocales: c.contentLocales,
54
+ defaultLocale: c.defaultLocale,
55
+ sourceLocale: c.sourceLocale,
56
+ fallback: c.fallback,
57
+ prefixes: c.prefixes,
58
+ tags: c.tags,
59
+ directions: c.directions
60
+ },
61
+ resolution: "per-node"
62
+ }
63
+ })
64
+ };
65
+ }, f = (t, o, l, u, f = Date.now()) => {
66
+ let p = {
67
+ tenantId: o.tenantId,
68
+ site: o.site,
69
+ environment: o.environment
70
+ }, m = d(p, l, u), { compiled: h, definitionDigest: g } = m, _ = h.definition, v = h.contentLocales, y = async (r) => {
71
+ let a = await n(t, p);
72
+ if (a.generation !== r.generation || a.releaseId !== r.releaseId || a.checkpoint !== r.checkpoint) throw new e({ reason: "state" });
73
+ let o = await i(t, p, r, f);
74
+ if (o.locales.length !== v.length || o.locales.some((e) => !v.includes(e))) throw new e({ reason: "scope" });
75
+ return o;
76
+ };
77
+ return {
78
+ site: {
79
+ format: "voltro.cms.site/v3",
80
+ entries: async function* (n) {
81
+ let i = await y(n);
82
+ yield a(m.site);
83
+ for (let [o, l] of Object.entries(_.bindings).sort(([e], [t]) => e < t ? -1 : +(e > t))) {
84
+ let u = await s(t, p, o);
85
+ if (u.contentType !== l || !i.types.includes(l)) throw new e({ reason: "target" });
86
+ let d = await c(t, p, o, u.revisionId);
87
+ if (d.contentType !== u.contentType || d.documentId !== u.documentId) throw new e({ reason: "state" });
88
+ yield a({
89
+ key: `binding:${o}`,
90
+ value: {
91
+ version: 3,
92
+ ...p,
93
+ binding: { ...u },
94
+ locales: v,
95
+ definitionDigest: g
96
+ }
97
+ });
98
+ let m = !1;
99
+ for (let e of v) {
100
+ let i = await r(t, p, n.id, u.contentType, e, u.documentId, f);
101
+ m ||= i !== null, yield a({
102
+ key: `binding:${o}:locale:${e}`,
103
+ value: {
104
+ version: 3,
105
+ locale: e,
106
+ documentId: u.documentId,
107
+ variant: i === null ? null : {
108
+ id: i.id,
109
+ revisionId: i.revisionId,
110
+ revision: i.revision
111
+ }
112
+ }
113
+ });
114
+ }
115
+ if (!m) throw new e({ reason: "target" });
116
+ }
117
+ }
118
+ },
119
+ locales: {
120
+ format: "voltro.cms.locales/v1",
121
+ entries: async function* (e) {
122
+ await y(e), yield a(m.locales);
123
+ }
124
+ }
125
+ };
126
+ };
127
+ export { d as snapshotSiteConfiguration, f as snapshotSiteSources };
@@ -0,0 +1,35 @@
1
+ import { sitemapXml as e } from "./seo.js";
2
+ import { SnapshotSeoReadUnavailable as t } from "./snapshotSeoRead.js";
3
+ // src/snapshotSitemapFiles.ts
4
+ var n = () => {
5
+ throw new t({ reason: "binding" });
6
+ }, r = 5e4, i = 52428800, a = (e) => e.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&apos;"), o = (t, o, s) => {
7
+ let c = new URL(o);
8
+ if (c.protocol !== "https:" || c.origin !== o) return n();
9
+ let l = e([], (e, t) => t, s), u = l.slice(0, l.indexOf(">\n", l.indexOf("<urlset")) + 2), d = "\n</urlset>\n", f = Buffer.byteLength(u + d), p = [], m = [], h = f, g = () => {
10
+ p.push(u + m.join("\n") + d), m = [], h = f;
11
+ };
12
+ for (let a of t) {
13
+ for (let e of [a.path, ...a.alternates.map((e) => e.path)]) if (e.length >= 2048 || /[\x00-\x20\x7f]/.test(e) || new URL(e).origin !== o) return n();
14
+ let t = e([a], (e, t) => t, s).slice(u.length, -11), c = Buffer.byteLength(t);
15
+ if (c + f > i) return n();
16
+ (m.length === r || h + c + (m.length === 0 ? 0 : 1) > i) && g(), h += c + (m.length === 0 ? 0 : 1), m.push(t);
17
+ }
18
+ if ((m.length > 0 || p.length === 0) && g(), p.length === 1) return [{
19
+ path: "/sitemap.xml",
20
+ contentType: "application/xml",
21
+ text: p[0]
22
+ }];
23
+ if (p.length > r) return n();
24
+ let _ = p.map((e, t) => ({
25
+ path: `/sitemaps/sitemap-${String(t + 1).padStart(5, "0")}.xml`,
26
+ contentType: "application/xml",
27
+ text: e
28
+ })), v = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<sitemapindex xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n" + _.map((e) => ` <sitemap><loc>${a(o + e.path)}</loc></sitemap>`).join("\n") + "\n</sitemapindex>\n";
29
+ return Buffer.byteLength(v) > i ? n() : [{
30
+ path: "/sitemap.xml",
31
+ contentType: "application/xml",
32
+ text: v
33
+ }, ..._];
34
+ };
35
+ export { o as snapshotSitemapFiles };
@@ -0,0 +1,57 @@
1
+ import { createHash as e } from "node:crypto";
2
+ import { canonicalJson as t } from "@voltro/runtime";
3
+ // src/snapshotTreeDependencies.ts
4
+ var n = () => {
5
+ throw Error("Snapshot tree dependencies unavailable");
6
+ }, r = (n) => e("sha256").update(t(n)).digest("hex"), i = (e) => {
7
+ if (!Array.isArray(e.reads) || e.reads.length > 4112) return n();
8
+ let t = new Map(Object.entries(e.trees).map(([t, n]) => [r({
9
+ path: e.path,
10
+ name: t
11
+ }), {
12
+ name: t,
13
+ data: n
14
+ }])), i = [], a = [], o = "";
15
+ for (let s of e.reads) {
16
+ if (typeof s != "object" || !s || Array.isArray(s)) return n();
17
+ let c = s;
18
+ if (Object.keys(c).sort().join(",") !== "inputDigest,tag,valueDigest" || typeof c.inputDigest != "string" || !/^[a-f0-9]{64}$/.test(c.inputDigest) || typeof c.valueDigest != "string" || !/^[a-f0-9]{64}$/.test(c.valueDigest)) return n();
19
+ if (c.tag === "cms.snapshot.reference" || c.tag === "cms.snapshot.link") {
20
+ if (e.owner !== "cms") return n();
21
+ i.push(s);
22
+ continue;
23
+ }
24
+ if (c.tag !== "cms.snapshot.tree") return n();
25
+ let l = t.get(c.inputDigest);
26
+ if (l === void 0 || l.name <= o || c.valueDigest !== r(l.data)) return n();
27
+ o = l.name, a.push({
28
+ name: l.name,
29
+ inputDigest: c.inputDigest,
30
+ valueDigest: c.valueDigest
31
+ });
32
+ }
33
+ return {
34
+ references: i,
35
+ graph: {
36
+ version: 1,
37
+ coverage: "captured-queries",
38
+ selectiveReuse: !1,
39
+ inputs: {
40
+ owner: e.owner,
41
+ snapshotDigest: e.snapshotDigest,
42
+ inputsId: e.inputsId,
43
+ executionId: e.executionId,
44
+ routeId: e.routeId,
45
+ path: e.path,
46
+ contextDigest: r(e.context),
47
+ trees: Object.fromEntries(Object.entries(e.trees).map(([e, t]) => [e, {
48
+ contentType: t.contentType,
49
+ localeId: t.localeId,
50
+ valueDigest: r(t)
51
+ }]))
52
+ },
53
+ reads: a
54
+ }
55
+ };
56
+ };
57
+ export { i as snapshotTreeDependencies };
@@ -0,0 +1,9 @@
1
+ // src/snapshotTreeLoader.ts
2
+ var e = async (e, t) => {
3
+ if (e.query === void 0) throw Error("Snapshot tree unavailable");
4
+ return e.query("cms.snapshot.tree", {
5
+ path: e.pathname,
6
+ name: t
7
+ });
8
+ };
9
+ export { e as snapshotTreeLoader };
@@ -0,0 +1,157 @@
1
+ import { compileSiteDelivery as e, defineSiteDelivery as t } from "./siteDelivery.js";
2
+ import { buildTree as n } from "./tree.js";
3
+ import { pageCapturedPublications as r, readCapturedPublication as i, verifyPublicationState as a } from "./publicationState.js";
4
+ import { readVerifiedSnapshotResource as o } from "./buildSnapshot.js";
5
+ import { verifySnapshotRouteOwnership as s } from "./snapshotRouting.js";
6
+ import { admitVerifiedSnapshotPublicDocument as c } from "./snapshotPublicAccess.js";
7
+ import { projectContentValues as l } from "./contentProjection.js";
8
+ import { copySnapshotTrees as u } from "./snapshotProjection.js";
9
+ import { readSnapshotAppExecution as d } from "./snapshotAppExecution.js";
10
+ import { SnapshotRouteReadUnavailable as f, readSnapshotRouteAdmission as p } from "./snapshotRouteAdmission.js";
11
+ import { readAdmittedCapturedAddress as m } from "./snapshotAddressRead.js";
12
+ import { snapshotPathLocale as h } from "./snapshotPathLocale.js";
13
+ import { createHash as g } from "node:crypto";
14
+ import { canonicalJson as _ } from "@voltro/runtime";
15
+ // src/snapshotTreeRead.ts
16
+ var v = (e) => {
17
+ throw new f({ reason: e });
18
+ }, y = (e) => g("sha256").update(_(e)).digest("hex"), b = (e) => typeof e != "object" || !e || Array.isArray(e) ? v("definition") : e, x = async (e, n, r, i, a) => {
19
+ let o = { ...i }, c = await p(e, n, r, o, a);
20
+ if (typeof o.name != "string" || !/^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(o.name)) return v("definition");
21
+ let l = t(c.configuration.site), u = h(l, o.path);
22
+ await d(e, c.place, c.snapshot, void 0, [], {
23
+ id: u.id,
24
+ contentLocale: u.contentLocale
25
+ });
26
+ let f = c.route;
27
+ if (f !== void 0 && f.definitionDigest !== c.configuration.definitionDigest) return v("binding");
28
+ let m = f !== void 0 && s(c.configuration, f).owner === "cms" ? {
29
+ contentType: String(f.contentType),
30
+ documentId: String(f.documentId)
31
+ } : null, g = await S(e, c.place, c.snapshot, u.id, m, c.now);
32
+ return Object.hasOwn(g, o.name) ? g[o.name] : v("definition");
33
+ }, S = async (t, s, d, f, p, h) => {
34
+ let g = (await o(t, s, d, "projection", "registry")).value;
35
+ if (g.trees === void 0) return {};
36
+ if (!Array.isArray(g.types) || !g.types.every((e) => typeof e == "string")) return v("binding");
37
+ let x = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new Map();
38
+ for (let e of Object.values(b(g.trees))) {
39
+ let n = b(e).contentType;
40
+ if (typeof n != "string" || !g.types.includes(n)) return v("definition");
41
+ if (S.has(n)) continue;
42
+ let r = (await o(t, s, d, "schema", `type:${n}`)).value, i = b(r.definition);
43
+ if (r.version !== 1 || i.name !== n || _(r.app) !== _(g.app)) return v("binding");
44
+ S.set(n, r), x.set(n, i);
45
+ }
46
+ let C = u(g.trees, [...x.values()]), w = (await o(t, s, d, "routes", "configuration")).value, T = e(w.site), E = T.definition.locales.find((e) => e.id === f && e.enabled), D = (await o(t, s, d, "site", "configuration")).value;
47
+ if (E === void 0 || T.definition.id !== s.site || !T.definition.environments.includes(s.environment) || w.tenantId !== s.tenantId || w.environment !== s.environment || _(w.app) !== _(g.app) || D.definitionDigest !== y(T.definition)) return v("binding");
48
+ let O = await a(t, s, d.manifest.publication, h), k = Object.create(null), A = 0, j = 0, M = 0, N = 0;
49
+ for (let [e, a] of Object.entries(C)) {
50
+ let o = x.get(a.contentType).tree, u = [
51
+ "id",
52
+ "documentId",
53
+ "revisionId",
54
+ "status",
55
+ "locale",
56
+ o.parent,
57
+ o.segment,
58
+ ...o.order === void 0 ? [] : [o.order],
59
+ ...a.includeField === void 0 ? [] : [a.includeField]
60
+ ], g = /* @__PURE__ */ new Map();
61
+ for (let e of [E.contentLocale, ...T.fallback[E.contentLocale]]) {
62
+ let n;
63
+ do {
64
+ let i = await r(t, s, d.manifest.publication.id, a.contentType, e, {
65
+ limit: 200,
66
+ now: h,
67
+ ...n === void 0 ? {} : { after: n }
68
+ });
69
+ for (let t of i.items) {
70
+ if (++A > 5e4) return v("bounds");
71
+ if (typeof t.documentId != "string" || t.status !== "published" || t.locale !== e) return v("publication");
72
+ if (!g.has(t.documentId)) {
73
+ let n = Object.fromEntries(u.filter((e) => Object.hasOwn(t, e)).map((e) => [e, t[e]]));
74
+ if (Object.values(n).some((e) => e !== null && typeof e != "string" && typeof e != "boolean" && !(typeof e == "number" && Number.isFinite(e)))) return v("publication");
75
+ if (N += Buffer.byteLength(_(n)), N > 16777216) return v("bounds");
76
+ g.set(t.documentId, {
77
+ row: n,
78
+ locale: e,
79
+ fallback: e !== E.contentLocale
80
+ });
81
+ }
82
+ }
83
+ n = i.next ?? void 0;
84
+ } while (n !== void 0);
85
+ }
86
+ for (let e of g.values()) {
87
+ let t = /* @__PURE__ */ new Set(), n = e;
88
+ for (; n !== void 0;) {
89
+ let e = String(n.row.documentId);
90
+ if (t.has(e)) break;
91
+ if (t.size >= 128) return v("bounds");
92
+ t.add(e);
93
+ let r = n.row[o.parent];
94
+ n = typeof r == "string" ? g.get(r) : void 0;
95
+ }
96
+ }
97
+ let y = n([...g.values()], o), b = new Map(y.nodes.map((e) => [e.documentId, e])), S = /* @__PURE__ */ new Map(), C = async (e) => {
98
+ if (S.has(e.documentId)) return S.get(e.documentId);
99
+ if (++M > 4096) return v("bounds");
100
+ let n = await c(t, s, d, O, a.contentType, f, e.documentId, h);
101
+ if (n === null) return S.set(e.documentId, null), null;
102
+ let r = await m(t, s, d, {
103
+ contentType: a.contentType,
104
+ documentId: e.documentId,
105
+ localeId: f,
106
+ mappingId: a.mappingId
107
+ }, n, h);
108
+ if (r === null) return S.set(e.documentId, null), null;
109
+ if (r.document.variantId !== e.row.id || r.document.revisionId !== e.row.revisionId || r.document.locale !== e.locale) return v("binding");
110
+ let o = await i(t, s, d.manifest.publication.id, a.contentType, r.document.locale, r.document.variantId, h);
111
+ if (o === null || o.documentId !== e.documentId || o.revisionId !== r.document.revisionId) return v("publication");
112
+ let u = l({
113
+ version: 1,
114
+ fields: Object.fromEntries(a.fields.map((e) => [e, !0]))
115
+ }, o);
116
+ if (Object.values(u).some((e) => e !== null && typeof e != "string" && typeof e != "boolean" && !(typeof e == "number" && Number.isFinite(e)))) return v("publication");
117
+ let p = {
118
+ documentId: e.documentId,
119
+ parent: e.parent,
120
+ depth: e.depth,
121
+ path: r.output.path,
122
+ sourceLocale: e.locale,
123
+ fallback: e.fallback,
124
+ values: u
125
+ };
126
+ return S.set(e.documentId, p), p;
127
+ }, w = [], D = /* @__PURE__ */ new Set();
128
+ for (let e of y.nodes) {
129
+ if (a.includeField !== void 0 && (e.row[a.includeField] !== !0 || e.parent !== null && !D.has(e.parent))) continue;
130
+ let t = await C(e);
131
+ if (t !== null) {
132
+ if (++j > 4096) return v("bounds");
133
+ w.push(t), D.add(e.documentId);
134
+ }
135
+ }
136
+ let P = p?.contentType === a.contentType ? b.get(p.documentId) : void 0, F = P === void 0 ? null : await C(P), I = [];
137
+ if (F !== null) for (let e = P.parent; e !== null;) {
138
+ let t = b.get(e);
139
+ if (t === void 0) return v("binding");
140
+ let n = await C(t);
141
+ if (n === null) return v("binding");
142
+ if (++j > 4096) return v("bounds");
143
+ I.unshift(n), e = t.parent;
144
+ }
145
+ k[e] = {
146
+ version: 1,
147
+ contentType: a.contentType,
148
+ localeId: f,
149
+ requestedLocale: E.contentLocale,
150
+ currentDocumentId: F?.documentId ?? null,
151
+ nodes: w,
152
+ ancestors: I
153
+ };
154
+ }
155
+ return Buffer.byteLength(_(k)) > 4194304 ? v("bounds") : k;
156
+ };
157
+ export { S as readAdmittedSnapshotTrees, x as readSnapshotTree };
@@ -0,0 +1,176 @@
1
+ import { normalizeHost as e } from "./domainHost.js";
2
+ import { canonicalCmsPublicPath as t } from "./publicBuild.js";
3
+ import { Schema as n } from "effect";
4
+ import { createHash as r, createHmac as i, timingSafeEqual as a } from "node:crypto";
5
+ import { canonicalJson as o } from "@voltro/runtime";
6
+ // src/staticPathSet.ts
7
+ var s = class extends n.TaggedError()("StaticPathSetUnavailable", { reason: n.Literals([
8
+ "input",
9
+ "bounds",
10
+ "integrity",
11
+ "key",
12
+ "cursor",
13
+ "state",
14
+ "changed"
15
+ ]) }) {}, c = class extends n.TaggedError()("StaticPathSetConflict", {
16
+ url: n.String,
17
+ owners: n.Array(n.String),
18
+ repair: n.String
19
+ }) {}, l = (e) => r("sha256").update(o(e)).digest("hex"), u = (e) => {
20
+ throw new s({ reason: e });
21
+ }, d = (e) => typeof e == "string" && /^[a-f0-9]{64}$/.test(e), f = (e) => typeof e == "string" && /^[A-Za-z0-9_-]{1,64}$/.test(e), p = (e) => typeof e != "object" || !e || Array.isArray(e) ? u("input") : e, m = (e, t) => {
22
+ if (Object.keys(e).sort().join(",") !== [...t].sort().join(",")) return u("input");
23
+ }, h = (e) => typeof e == "string" && e.length > 0 && e.length <= 1024 && !/[\\\x00-\x1f\x7f:]/.test(e) && e.split("/").every((e) => e !== "" && e !== "." && e !== ".." && e.toLowerCase() !== ".git"), g = (n, r) => {
24
+ if (e(n) !== n) return u("input");
25
+ try {
26
+ return `https://${n}${t(r)}`;
27
+ } catch {
28
+ return u("input");
29
+ }
30
+ }, _ = (e) => {
31
+ let t = p(e);
32
+ if (m(t, [
33
+ "host",
34
+ "path",
35
+ "localeId",
36
+ "routeId",
37
+ "owner",
38
+ "file",
39
+ "sourceDigest",
40
+ "parameters"
41
+ ]), typeof t.host != "string" || typeof t.path != "string" || !f(t.localeId) || typeof t.routeId != "string" || !/^(route_|native_)[a-f0-9]{64}$/.test(t.routeId) || typeof t.owner != "string" || !["cms", "code"].includes(t.owner) || !(t.file === null && t.sourceDigest === null || h(t.file) && d(t.sourceDigest)) || t.owner === "code" && t.file === null) return u("input");
42
+ g(t.host, t.path);
43
+ let n = p(t.parameters);
44
+ return Object.keys(n).length > 64 || Object.entries(n).some(([e, t]) => !/^[A-Za-z_][A-Za-z0-9_]{0,127}$/.test(e) || typeof t != "string" || t.length > 4096) ? u("input") : {
45
+ host: t.host,
46
+ path: t.path,
47
+ localeId: t.localeId,
48
+ routeId: t.routeId,
49
+ owner: t.owner,
50
+ file: t.file,
51
+ sourceDigest: t.sourceDigest,
52
+ parameters: Object.fromEntries(Object.keys(n).sort().map((e) => [e, n[e]]))
53
+ };
54
+ }, v = (e) => {
55
+ if (!Array.isArray(e) || e.length === 0 || e.length > 2 || e.some((e) => typeof e != "string" || !["cms", "code"].includes(e))) return u("input");
56
+ let t = [...e].sort();
57
+ return new Set(t).size === t.length ? t : u("input");
58
+ }, y = (t) => {
59
+ let n = p(t), r = [
60
+ "tenantId",
61
+ "site",
62
+ "environment",
63
+ "snapshotId",
64
+ "consumerId",
65
+ "buildId"
66
+ ], i = [
67
+ "snapshotDigest",
68
+ "inputsId",
69
+ "executionId",
70
+ "routesDigest",
71
+ "domainsDigest",
72
+ "localesDigest",
73
+ "policyDigest",
74
+ "projectionDigest"
75
+ ];
76
+ if (m(n, [
77
+ ...r,
78
+ ...i,
79
+ "releaseId",
80
+ "host",
81
+ "localeIds",
82
+ "owners"
83
+ ]), !r.every((e) => f(n[e])) || !i.every((e) => d(n[e])) || !(n.releaseId === null || f(n.releaseId)) || typeof n.host != "string" || e(n.host) !== n.host || !Array.isArray(n.localeIds) || n.localeIds.length === 0 || n.localeIds.length > 64 || n.localeIds.some((e, t, n) => !f(e) || t > 0 && n[t - 1] >= e)) return u("input");
84
+ let a = v(n.owners);
85
+ return o(a) === o(n.owners) ? {
86
+ ...n,
87
+ localeIds: [...n.localeIds],
88
+ owners: a
89
+ } : u("input");
90
+ }, b = (e) => !f(e.id) || !(e.material instanceof Uint8Array) || e.material.byteLength < 32 ? u("key") : {
91
+ id: e.id,
92
+ material: new Uint8Array(e.material)
93
+ }, x = (e, t) => i("sha256", t.material).update(o({
94
+ purpose: "voltro.cms.static-path-set/v1",
95
+ id: e,
96
+ keyId: t.id
97
+ })).digest("hex"), S = (e) => {
98
+ let t = p(e);
99
+ if (m(t, [
100
+ "version",
101
+ "context",
102
+ "sort",
103
+ "pageSize",
104
+ "count",
105
+ "sources",
106
+ "pages"
107
+ ]), t.version !== 1 || t.sort !== "host-nfc-path/v1" || t.pageSize !== 200 || typeof t.count != "number" || !Number.isSafeInteger(t.count) || t.count < 0 || t.count > 1e5 || !Array.isArray(t.pages) || t.pages.length !== Math.ceil(t.count / 200)) return u("bounds");
108
+ let n = p(t.sources);
109
+ if (m(n, ["count", "digest"]), typeof n.count != "number" || !Number.isSafeInteger(n.count) || n.count < 1 || n.count > 1e5 || !d(n.digest)) return u("integrity");
110
+ let r = 0, i = "", a = t.pages.map((e, n) => {
111
+ let a = p(e);
112
+ return m(a, [
113
+ "count",
114
+ "digest",
115
+ "first",
116
+ "last"
117
+ ]), typeof a.count != "number" || a.count !== Math.min(200, Number(t.count) - n * 200) || !d(a.digest) || typeof a.first != "string" || typeof a.last != "string" || a.first > a.last || a.first <= i || a.last.length > 8192 ? u("integrity") : (r += a.count, i = a.last, {
118
+ count: a.count,
119
+ digest: a.digest,
120
+ first: a.first,
121
+ last: a.last
122
+ });
123
+ });
124
+ return r === t.count ? {
125
+ version: 1,
126
+ context: y(t.context),
127
+ sort: "host-nfc-path/v1",
128
+ pageSize: 200,
129
+ count: r,
130
+ sources: {
131
+ count: n.count,
132
+ digest: n.digest
133
+ },
134
+ pages: a
135
+ } : u("integrity");
136
+ }, C = (e, t) => {
137
+ let n = b(t), r = S(e), i = l(r);
138
+ return {
139
+ id: i,
140
+ manifest: r,
141
+ keyId: n.id,
142
+ signature: x(i, n)
143
+ };
144
+ }, w = (e, t) => {
145
+ let n = p(e);
146
+ m(n, [
147
+ "id",
148
+ "manifest",
149
+ "keyId",
150
+ "signature"
151
+ ]);
152
+ let r = t.map(b);
153
+ if (r.length === 0 || new Set(r.map((e) => e.id)).size !== r.length) return u("key");
154
+ let i = r.find((e) => e.id === n.keyId);
155
+ if (i === void 0 || !d(n.id) || !d(n.signature)) return u("integrity");
156
+ let o = S(n.manifest);
157
+ return l(o) !== n.id || !a(Buffer.from(x(n.id, i), "hex"), Buffer.from(n.signature, "hex")) ? u("integrity") : {
158
+ id: n.id,
159
+ manifest: o,
160
+ keyId: i.id,
161
+ signature: n.signature
162
+ };
163
+ }, T = (e, t, n) => {
164
+ if (e.manifest.count === 0 && e.manifest.pages.length === 0 && t === 0 && Array.isArray(n) && n.length === 0) return [];
165
+ if (!Number.isSafeInteger(t) || t < 0 || t >= e.manifest.pages.length || !Array.isArray(n)) return u("bounds");
166
+ let r = e.manifest.pages[t];
167
+ if (n.length !== r.count || l(n) !== r.digest) return u("integrity");
168
+ let i = n.map(_), a = "";
169
+ for (let t of i) {
170
+ let n = g(t.host, t.path);
171
+ if (t.host !== e.manifest.context.host || !e.manifest.context.localeIds.includes(t.localeId) || !e.manifest.context.owners.includes(t.owner) || n <= a) return u("integrity");
172
+ a = n;
173
+ }
174
+ return g(i[0].host, i[0].path) !== r.first || a !== r.last ? u("integrity") : i;
175
+ };
176
+ export { c as StaticPathSetConflict, s as StaticPathSetUnavailable, y as copyStaticPathContext, _ as copyStaticPathEntry, S as copyStaticPathManifest, v as copyStaticPathOwners, C as signStaticPathSet, l as staticPathHash, g as staticPathUrl, T as verifyStaticPathPage, w as verifyStaticPathSet };
@@ -0,0 +1,128 @@
1
+ import { cmsCredential as e, privateCmsHttpRoutes as t, privateCmsOperation as n } from "./privateCmsTransport.js";
2
+ import { StaticPathSetConflict as r, StaticPathSetUnavailable as i } from "./staticPathSet.js";
3
+ import { Schema as a } from "effect";
4
+ // src/staticPathSetRest.ts
5
+ var o = a.Struct({
6
+ id: a.String,
7
+ digest: a.String
8
+ }), s = a.Struct({
9
+ snapshot: o,
10
+ consumerId: a.String,
11
+ buildId: a.String,
12
+ host: a.String,
13
+ localeIds: a.optional(a.Array(a.String)),
14
+ owners: a.optional(a.Array(a.Literals(["cms", "code"])))
15
+ }), c = a.Struct({
16
+ tenantId: a.String,
17
+ site: a.String,
18
+ environment: a.String,
19
+ snapshotId: a.String,
20
+ snapshotDigest: a.String,
21
+ releaseId: a.NullOr(a.String),
22
+ consumerId: a.String,
23
+ buildId: a.String,
24
+ inputsId: a.String,
25
+ executionId: a.String,
26
+ routesDigest: a.String,
27
+ domainsDigest: a.String,
28
+ localesDigest: a.String,
29
+ policyDigest: a.String,
30
+ projectionDigest: a.String,
31
+ host: a.String,
32
+ localeIds: a.Array(a.String),
33
+ owners: a.Array(a.Literals(["cms", "code"]))
34
+ }), l = a.Struct({
35
+ id: a.String,
36
+ keyId: a.String,
37
+ signature: a.String,
38
+ manifest: a.Struct({
39
+ version: a.Literal(1),
40
+ context: c,
41
+ sort: a.Literal("host-nfc-path/v1"),
42
+ pageSize: a.Literal(200),
43
+ count: a.Number,
44
+ sources: a.Struct({
45
+ count: a.Number,
46
+ digest: a.String
47
+ }),
48
+ pages: a.Array(a.Struct({
49
+ count: a.Number,
50
+ digest: a.String,
51
+ first: a.String,
52
+ last: a.String
53
+ }))
54
+ })
55
+ }), u = a.Struct({
56
+ id: a.String,
57
+ revision: a.Number,
58
+ phase: a.Literals([
59
+ "cms",
60
+ "code",
61
+ "seal",
62
+ "ready"
63
+ ]),
64
+ enumerated: a.Number,
65
+ set: a.NullOr(l)
66
+ }), d = a.Struct({
67
+ host: a.String,
68
+ path: a.String,
69
+ localeId: a.String,
70
+ routeId: a.String,
71
+ owner: a.Literals(["cms", "code"]),
72
+ file: a.NullOr(a.String),
73
+ sourceDigest: a.NullOr(a.String),
74
+ parameters: a.Record(a.String, a.String)
75
+ }), f = {
76
+ namespace: "cms.staticPathSet",
77
+ path: "/v1/cms/static-path-sets",
78
+ operationPrefix: "cmsStaticPathSet",
79
+ tags: ["CMS static path sets"],
80
+ credentialError: "CmsBuildSnapshotUnavailable",
81
+ error: a.Union([i, r]),
82
+ errorStatus: {
83
+ StaticPathSetUnavailable: 409,
84
+ StaticPathSetConflict: 409
85
+ }
86
+ }, p = (t, n) => ({
87
+ snapshot: t.snapshot,
88
+ token: e(n, "CmsBuildSnapshotUnavailable"),
89
+ consumerId: t.consumerId,
90
+ buildId: t.buildId,
91
+ host: t.host,
92
+ ...t.localeIds === void 0 ? {} : { localeIds: t.localeIds },
93
+ ...t.owners === void 0 ? {} : { owners: t.owners }
94
+ }), m = (e) => {
95
+ let r = [
96
+ n(f, "begin", "Begin or resume a captured static path set", "Render-read bearer. Scope, snapshot, build, admitted host and exact locale selection identify the durable job. An id alone grants nothing.", s, u, (t, n) => e.begin(p(t, n))),
97
+ n(f, "advance", "Advance one bounded durable path enumeration step", "Render-read bearer for the same build. Captured CMS resources and retained native code are merged with captured ownership rules. Renew bounded grants through snapshot open when needed. URL conflicts include both admitted owners and a repair action.", a.Struct({
98
+ ...s.fields,
99
+ id: a.String,
100
+ revision: a.Number
101
+ }), u, (t, n) => e.advance({
102
+ ...p(t, n),
103
+ id: t.id,
104
+ revision: t.revision
105
+ })),
106
+ n(f, "page", "Read one authenticated immutable static path page", "Render-read bearer. The digest pins the complete signed set and its exact filter, count and ordered page digests. Index is interpreted only within this root. Repeating the same page is idempotent; there is no live fallback.", a.Struct({
107
+ ...s.fields,
108
+ id: a.String,
109
+ digest: a.String,
110
+ index: a.Number
111
+ }), a.Struct({
112
+ set: l,
113
+ index: a.Number,
114
+ entries: a.Array(d),
115
+ next: a.NullOr(a.Number)
116
+ }), (t, n) => e.page({
117
+ ...p(t, n),
118
+ id: t.id,
119
+ digest: t.digest,
120
+ index: t.index
121
+ }))
122
+ ];
123
+ return {
124
+ routes: r,
125
+ httpRoutes: t(r)
126
+ };
127
+ };
128
+ export { m as cmsStaticPathSetRest };