@voltro/cms 0.86.0 → 0.87.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/CHANGELOG.md +5321 -0
  2. package/README.md +138 -0
  3. package/THIRD-PARTY-NOTICES.md +860 -221
  4. package/dist/RichDocumentView.js +81 -36
  5. package/dist/aiCandidates.js +3 -3
  6. package/dist/applicationBuildSnapshotService.js +101 -0
  7. package/dist/assetRenditions.js +102 -0
  8. package/dist/assetRevision.js +46 -0
  9. package/dist/assetUseRights.js +72 -0
  10. package/dist/availability.js +19 -16
  11. package/dist/blueprint.js +75 -75
  12. package/dist/build.d.ts +3063 -0
  13. package/dist/build.js +37 -0
  14. package/dist/buildApplicationAdmission.js +16 -0
  15. package/dist/buildApplicationCatalog.js +136 -0
  16. package/dist/buildApplicationCatalogTable.js +24 -0
  17. package/dist/buildApplicationRest.js +99 -0
  18. package/dist/buildApplicationUpload.js +111 -0
  19. package/dist/buildSnapshot.js +401 -0
  20. package/dist/buildSnapshotApplicationPin.js +32 -0
  21. package/dist/buildSnapshotRest.js +210 -0
  22. package/dist/buildSnapshotService.js +265 -0
  23. package/dist/buildSnapshotTables.js +25 -0
  24. package/dist/bulk.js +71 -70
  25. package/dist/changes.js +279 -62
  26. package/dist/consent.js +5 -5
  27. package/dist/contentLocations.js +53 -0
  28. package/dist/contentProjection.js +83 -0
  29. package/dist/contentRouteIdentity.js +13 -0
  30. package/dist/contentRouteMaterializer.js +97 -0
  31. package/dist/contentRouteTypes.js +39 -0
  32. package/dist/contentSeo.js +189 -0
  33. package/dist/contentTreePath.js +60 -0
  34. package/dist/contentType.js +117 -100
  35. package/dist/contentValues.js +18 -0
  36. package/dist/copies.js +3 -3
  37. package/dist/domainHost.js +7 -0
  38. package/dist/domains.js +81 -87
  39. package/dist/draftTexts.js +37 -37
  40. package/dist/duplicates.js +23 -23
  41. package/dist/environmentAliases.js +138 -0
  42. package/dist/environments.js +107 -69
  43. package/dist/errors.js +54 -14
  44. package/dist/experiments.js +7 -7
  45. package/dist/frontendBindings.js +99 -0
  46. package/dist/frontendMedia.js +18 -0
  47. package/dist/index.d.ts +760 -47
  48. package/dist/index.js +89 -73
  49. package/dist/initializePublicRoutes.js +28 -0
  50. package/dist/liveContentRouteView.js +76 -0
  51. package/dist/nativeOutputDeploymentService.js +205 -0
  52. package/dist/outputActivation.js +234 -0
  53. package/dist/outputActivationOrigin.js +51 -0
  54. package/dist/outputActivationStore.js +411 -0
  55. package/dist/outputActivationTables.js +11 -0
  56. package/dist/outputActivationTarget.js +81 -0
  57. package/dist/outputActivationTargetTable.js +25 -0
  58. package/dist/outputDeployment.js +174 -0
  59. package/dist/outputDeploymentRest.js +168 -0
  60. package/dist/outputDeploymentService.js +241 -0
  61. package/dist/outputRouteGraph.js +177 -0
  62. package/dist/outputSafetyArtifact.js +147 -0
  63. package/dist/outputTargetRest.js +62 -0
  64. package/dist/pathSegmentEncoding.js +4 -0
  65. package/dist/privateCmsTransport.js +76 -0
  66. package/dist/privateNativeRouteReservation.js +10 -0
  67. package/dist/promotion.js +68 -59
  68. package/dist/publicBuild.js +90 -0
  69. package/dist/publicBuildRest.js +98 -0
  70. package/dist/publicBuildService.js +63 -0
  71. package/dist/publicOutputHttp.js +129 -0
  72. package/dist/publicOutputService.js +287 -0
  73. package/dist/publicPresentation.js +17 -0
  74. package/dist/publicRouteDispositionAdmission.js +38 -0
  75. package/dist/publicRouteHistoryStore.js +12 -0
  76. package/dist/publicRouteHistoryView.js +34 -0
  77. package/dist/publicRouteIntegrity.js +5 -0
  78. package/dist/publicRouteMutation.js +6 -0
  79. package/dist/publicRouteNamespace.js +134 -0
  80. package/dist/publicRoutePublication.js +36 -0
  81. package/dist/publicRouteRegistry.js +17 -0
  82. package/dist/publicRouteRegistryBinding.js +194 -0
  83. package/dist/publicRouteRegistryDefinition.js +76 -0
  84. package/dist/publicRouteSitePublication.js +40 -0
  85. package/dist/publicRouteTables.js +13 -0
  86. package/dist/publicRouteUrl.js +18 -0
  87. package/dist/publicationSeo.js +52 -0
  88. package/dist/publicationState.js +296 -0
  89. package/dist/quality.js +8 -8
  90. package/dist/reconfigurePublicRoutes.js +41 -0
  91. package/dist/redirects.js +104 -73
  92. package/dist/referenceGraph.js +15 -14
  93. package/dist/references.js +2 -2
  94. package/dist/release.js +177 -141
  95. package/dist/renderReadAuthority.js +43 -0
  96. package/dist/renderReadGrant.js +137 -0
  97. package/dist/review.js +28 -28
  98. package/dist/richDocument.js +54 -24
  99. package/dist/routeDispositionGraph.js +44 -0
  100. package/dist/routeDispositionRest.js +51 -0
  101. package/dist/routeDispositionService.js +73 -0
  102. package/dist/routeDispositionStore.js +289 -0
  103. package/dist/routeDispositionTables.js +5 -0
  104. package/dist/routeDispositions.js +91 -0
  105. package/dist/routeHistoryStorage.js +320 -0
  106. package/dist/routeHistoryStore.js +12 -0
  107. package/dist/schedule.js +36 -36
  108. package/dist/seo.js +1 -1
  109. package/dist/series.js +11 -11
  110. package/dist/share.js +13 -13
  111. package/dist/siteBindings.js +159 -0
  112. package/dist/siteBuildCandidate.js +104 -0
  113. package/dist/siteDelivery.js +115 -0
  114. package/dist/siteState.js +47 -0
  115. package/dist/snapshotAddressGraph.js +55 -0
  116. package/dist/snapshotAddressRead.js +73 -0
  117. package/dist/snapshotAppConsumer.js +71 -0
  118. package/dist/snapshotAppExecution.js +102 -0
  119. package/dist/snapshotApplication.js +75 -0
  120. package/dist/snapshotApprovedRouteDispositions.js +44 -0
  121. package/dist/snapshotAssetAssembly.js +70 -0
  122. package/dist/snapshotAssetAssemblyRest.js +50 -0
  123. package/dist/snapshotBindingRead.js +61 -0
  124. package/dist/snapshotCodeSeo.js +29 -0
  125. package/dist/snapshotComponent.js +34 -0
  126. package/dist/snapshotComponentSource.js +24 -0
  127. package/dist/snapshotConsumer.js +87 -0
  128. package/dist/snapshotContentIdentity.js +10 -0
  129. package/dist/snapshotDefinitions.js +264 -0
  130. package/dist/snapshotDocumentAssembly.js +193 -0
  131. package/dist/snapshotDocumentAssemblyRest.js +84 -0
  132. package/dist/snapshotDocumentProjection.js +202 -0
  133. package/dist/snapshotDocumentTransfer.js +35 -0
  134. package/dist/snapshotDocumentTransferRest.js +80 -0
  135. package/dist/snapshotDomains.js +56 -0
  136. package/dist/snapshotEnvironment.js +31 -0
  137. package/dist/snapshotFieldPlan.js +85 -0
  138. package/dist/snapshotFrontend.js +103 -0
  139. package/dist/snapshotLink.js +8 -0
  140. package/dist/snapshotMedia.js +111 -0
  141. package/dist/snapshotMediaCapture.js +246 -0
  142. package/dist/snapshotMediaFields.js +225 -0
  143. package/dist/snapshotMediaRead.js +185 -0
  144. package/dist/snapshotMediaReader.js +13 -0
  145. package/dist/snapshotObservation.js +16 -0
  146. package/dist/snapshotObservedRouteHistory.js +34 -0
  147. package/dist/snapshotOutputTransfer.js +78 -0
  148. package/dist/snapshotPageLoader.js +7 -0
  149. package/dist/snapshotPageSeo.js +59 -0
  150. package/dist/snapshotPathLocale.js +15 -0
  151. package/dist/snapshotPresentation.js +86 -0
  152. package/dist/snapshotPresentationPolicy.js +12 -0
  153. package/dist/snapshotProjection.js +119 -0
  154. package/dist/snapshotPublicAccess.js +161 -0
  155. package/dist/snapshotPublicRouteHistory.js +40 -0
  156. package/dist/snapshotReadAdmission.js +38 -0
  157. package/dist/snapshotRedirectOutput.js +151 -0
  158. package/dist/snapshotRedirectTargets.js +24 -0
  159. package/dist/snapshotRedirects.js +132 -0
  160. package/dist/snapshotReference.js +8 -0
  161. package/dist/snapshotReferenceAddress.js +10 -0
  162. package/dist/snapshotReferenceGraph.js +79 -0
  163. package/dist/snapshotReferenceRead.js +65 -0
  164. package/dist/snapshotRelease.js +99 -0
  165. package/dist/snapshotRender.js +361 -0
  166. package/dist/snapshotRenderDependencies.js +178 -0
  167. package/dist/snapshotRenditions.js +88 -0
  168. package/dist/snapshotRichDocument.js +62 -0
  169. package/dist/snapshotRoleTransfer.js +106 -0
  170. package/dist/snapshotRoleTransferRest.js +99 -0
  171. package/dist/snapshotRouteAdmission.js +71 -0
  172. package/dist/snapshotRouteDispatch.js +111 -0
  173. package/dist/snapshotRouteDispositionPlan.js +73 -0
  174. package/dist/snapshotRouteRead.js +43 -0
  175. package/dist/snapshotRoutes.js +79 -0
  176. package/dist/snapshotRouting.js +113 -0
  177. package/dist/snapshotSeo.js +179 -0
  178. package/dist/snapshotSeoControls.js +101 -0
  179. package/dist/snapshotSeoDocumentInventory.js +115 -0
  180. package/dist/snapshotSeoDocuments.js +129 -0
  181. package/dist/snapshotSeoMerge.js +85 -0
  182. package/dist/snapshotSeoMetadata.js +137 -0
  183. package/dist/snapshotSeoOutput.js +173 -0
  184. package/dist/snapshotSeoPathSets.js +105 -0
  185. package/dist/snapshotSeoRead.js +88 -0
  186. package/dist/snapshotSite.js +128 -0
  187. package/dist/snapshotSitemapFiles.js +36 -0
  188. package/dist/snapshotTreeDependencies.js +58 -0
  189. package/dist/snapshotTreeLoader.js +10 -0
  190. package/dist/snapshotTreeRead.js +158 -0
  191. package/dist/staticPathSet.js +177 -0
  192. package/dist/staticPathSetRest.js +129 -0
  193. package/dist/staticPathSetService.js +249 -0
  194. package/dist/staticPathSetStore.js +338 -0
  195. package/dist/tree.js +9 -9
  196. package/dist/validation.js +53 -53
  197. package/dist/web.d.ts +709 -7
  198. package/dist/web.js +50 -33
  199. package/dist/workflow.js +8 -8
  200. package/dist/write.js +250 -225
  201. package/package.json +20 -6
@@ -0,0 +1,173 @@
1
+ import { readSnapshotRouteAdmission as e } from "./snapshotRouteAdmission.js";
2
+ import { SnapshotSeoReadUnavailable as t } from "./snapshotSeoRead.js";
3
+ import { snapshotSitemapFiles as n } from "./snapshotSitemapFiles.js";
4
+ import { readSnapshotSeoControls as r } from "./snapshotSeoControls.js";
5
+ import { copySnapshotSeoDocumentsSelection as i } from "./snapshotSeoPathSets.js";
6
+ import { readSnapshotSeoDocuments as a, snapshotOutputSafetyBinding as o } from "./snapshotSeoDocuments.js";
7
+ import { filterSnapshotSeoSafety as s, mergeSnapshotSeoDocuments as c } from "./snapshotSeoMerge.js";
8
+ import { copyOutputSafetySelection as l, readVerifiedOutputSafetyArtifact as u } from "./outputSafetyArtifact.js";
9
+ import { createHash as d } from "node:crypto";
10
+ import { canonicalJson as f } from "@voltro/runtime";
11
+ //#region src/snapshotSeoOutput.ts
12
+ var p = (d, p, m, h, g) => {
13
+ let _ = {
14
+ tenantId: p.tenantId,
15
+ site: p.site,
16
+ environment: p.environment
17
+ }, v = {
18
+ id: m.id,
19
+ digest: m.digest
20
+ }, y = h.documents === void 0 ? void 0 : i(h.documents), b = h.safety === void 0 ? void 0 : l(h.safety), x = {
21
+ token: h.token,
22
+ consumerId: h.consumerId,
23
+ buildId: h.buildId,
24
+ host: h.host
25
+ }, S = g.use === void 0 ? void 0 : { ...g.use }, C = g.keys.map((e) => ({
26
+ id: e.id,
27
+ material: new Uint8Array(e.material)
28
+ })), w = g.now ?? Date.now, T = () => d.transactional((e) => r(e, _, v, x, {
29
+ keys: C,
30
+ now: w()
31
+ }));
32
+ return {
33
+ read: async () => {
34
+ let e = await T();
35
+ if (y === void 0) {
36
+ if (e.productionDocumentRequired || b !== void 0) throw new t({ reason: "binding" });
37
+ return {
38
+ ...e,
39
+ documents: null,
40
+ app: null,
41
+ safety: null,
42
+ indexedUrls: null
43
+ };
44
+ }
45
+ if (S === void 0 || g.maxBytes === void 0 || b === void 0) throw new t({ reason: "binding" });
46
+ let r, i = await u(d, _, b.artifactId, {
47
+ provider: g.provider,
48
+ maxBytes: g.maxBytes,
49
+ admit: async (e) => {
50
+ let t = await a(e, _, {
51
+ ...x,
52
+ snapshot: v
53
+ }, y, {
54
+ keys: C,
55
+ now: w,
56
+ provider: g.provider,
57
+ use: S
58
+ });
59
+ return r = t, o(t);
60
+ }
61
+ });
62
+ if (r === void 0) throw new t({ reason: "binding" });
63
+ let l = new Set(r.inventory.records.map((e) => e.url)), p = s(c(e.urls.filter((e) => l.has(e.path)), r.native, e), r.inventory.records, i.entries), m = n(p, e.origin, e.xDefault && e.defaultLanguage !== null ? e.defaultLanguage : void 0), h = p.map((e) => e.path), E = 2;
64
+ for (let e = 0; e < h.length; e++) if (E += Buffer.byteLength(f(h[e]), "utf8") + (e === 0 ? 0 : 1), E > Math.min(g.maxBytes, 25165824)) throw new t({ reason: "binding" });
65
+ return {
66
+ ...e,
67
+ urls: p,
68
+ files: m,
69
+ sitemap: m[0].text,
70
+ documents: i.binding.documents,
71
+ app: i.binding.app,
72
+ safety: {
73
+ artifactId: i.artifactId,
74
+ generation: i.generation,
75
+ safetyDigest: i.safetyDigest
76
+ },
77
+ indexedUrls: h
78
+ };
79
+ },
80
+ readAuthority: () => d.transactional((t) => e(t, _, v, {
81
+ ...x,
82
+ path: "/"
83
+ }, {
84
+ keys: C,
85
+ now: w()
86
+ })),
87
+ place: _,
88
+ original: v,
89
+ input: x
90
+ };
91
+ }, m = (e, t, n) => ({
92
+ version: e.documents === null ? 1 : 3,
93
+ profile: e.documents === null ? "voltro.cms.snapshot-seo-output/v1" : "voltro.cms.snapshot-seo-output/v3",
94
+ kind: n,
95
+ ...e.documents === null ? {} : {
96
+ documents: e.documents,
97
+ app: e.app,
98
+ safety: e.safety,
99
+ indexedUrls: e.indexedUrls
100
+ },
101
+ ...t.place,
102
+ snapshot: t.original,
103
+ consumerId: t.input.consumerId,
104
+ buildId: t.input.buildId,
105
+ host: t.input.host,
106
+ controlsDigest: d("sha256").update(f(e)).digest("hex"),
107
+ urlCount: e.urls.length
108
+ }), h = async (...e) => {
109
+ let n = e[4], r = p(...e), { read: i, readAuthority: a } = r, o = await i(), s = [];
110
+ try {
111
+ let e = [];
112
+ for (let [t, i] of [["sitemap", o.files], ["robots", [{
113
+ path: "/robots.txt",
114
+ text: o.robots,
115
+ contentType: "text/plain"
116
+ }]]]) {
117
+ s.length > 0 && await a();
118
+ let c = await n.provider.begin();
119
+ s.push(c);
120
+ for (let e of i) {
121
+ let t = Buffer.from(e.text, "utf8");
122
+ await c.write({
123
+ path: e.path.slice(1),
124
+ size: t.length,
125
+ contentType: e.contentType,
126
+ digest: d("sha256").update(t).digest("hex")
127
+ }, (async function* () {
128
+ yield t;
129
+ })());
130
+ }
131
+ e.push({
132
+ stage: c,
133
+ subject: m(o, r, t)
134
+ });
135
+ }
136
+ let c = [];
137
+ for (let t of e) await a(), c.push((await t.stage.seal(t.subject)).id);
138
+ if (f(await i()) !== f(o)) throw new t({ reason: "binding" });
139
+ return {
140
+ sitemapArtifactId: c[0],
141
+ robotsArtifactId: c[1],
142
+ urlCount: o.urls.length
143
+ };
144
+ } catch (e) {
145
+ throw await Promise.allSettled(s.map((e) => e.abort())), e;
146
+ }
147
+ }, g = async (e, n, r, i, a) => {
148
+ let o = i.id, s = i.kind, c = p(e, n, r, i, a);
149
+ if (!/^[a-f0-9]{64}$/.test(o) || !["sitemap", "robots"].includes(s) || a.provider.read === void 0) throw new t({ reason: "binding" });
150
+ let l = a.provider.read.bind(a.provider), u = await c.read(), h = s === "sitemap" ? u.files : [{
151
+ path: "/robots.txt",
152
+ text: u.robots,
153
+ contentType: "text/plain"
154
+ }], g = {
155
+ version: 1,
156
+ subject: m(u, c, s),
157
+ files: h.map((e) => {
158
+ let t = Buffer.from(e.text, "utf8");
159
+ return {
160
+ path: e.path.slice(1),
161
+ size: t.length,
162
+ contentType: e.contentType,
163
+ digest: d("sha256").update(t).digest("hex")
164
+ };
165
+ }).sort((e, t) => e.path < t.path ? -1 : +(e.path > t.path))
166
+ };
167
+ if (d("sha256").update(f(g)).digest("hex") !== o) throw new t({ reason: "binding" });
168
+ let _ = await l(o);
169
+ if (_.id !== o || f(_.manifest) !== f(g) || f(await c.read()) !== f(u)) throw new t({ reason: "binding" });
170
+ return structuredClone(_);
171
+ };
172
+ //#endregion
173
+ export { g as readSnapshotSeoOutputArtifact, h as renderSnapshotSeoControls };
@@ -0,0 +1,105 @@
1
+ import { copySnapshotResource as e } from "./buildSnapshot.js";
2
+ import { copyStaticPathContext as t, staticPathUrl as n } from "./staticPathSet.js";
3
+ import { SnapshotSeoReadUnavailable as r } from "./snapshotSeoRead.js";
4
+ import { STATIC_PATH_SETS_TABLE as i, pageStaticPathSet as a, readStaticPathSet as o } from "./staticPathSetStore.js";
5
+ import { readSnapshotStaticPathAdmission as s } from "./staticPathSetService.js";
6
+ import { and as c, eq as l } from "@voltro/database";
7
+ import { canonicalJson as u } from "@voltro/runtime";
8
+ //#region src/snapshotSeoPathSets.ts
9
+ var d = () => {
10
+ throw new r({ reason: "binding" });
11
+ }, f = (e) => typeof e == "string" && /^[a-f0-9]{64}$/.test(e), p = (e) => typeof e != "object" || !e || Array.isArray(e) ? d() : e, m = (t) => {
12
+ let n = p(e({
13
+ key: "seo-documents",
14
+ value: { selection: t }
15
+ }).value.selection);
16
+ if (Object.keys(n).sort().join(",") !== "pathSets" || !Array.isArray(n.pathSets) || n.pathSets.length === 0 || n.pathSets.length > 64) return d();
17
+ let r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
18
+ return { pathSets: n.pathSets.map((e) => {
19
+ let t = p(e);
20
+ return Object.keys(t).sort().join(",") !== "digest,id" || typeof t.id != "string" || !/^[A-Za-z0-9_-]{1,64}$/.test(t.id) || !f(t.digest) || r.has(t.id) || i.has(t.digest) ? d() : (r.add(t.id), i.add(t.digest), {
21
+ id: t.id,
22
+ digest: t.digest
23
+ });
24
+ }) };
25
+ }, h = (t) => {
26
+ let n = p(e({
27
+ key: "seo-documents",
28
+ value: { selection: t }
29
+ }).value.selection);
30
+ return Object.keys(n).sort().join(",") !== "artifactId,pathSets" || !f(n.artifactId) ? d() : {
31
+ artifactId: n.artifactId,
32
+ ...m({ pathSets: n.pathSets })
33
+ };
34
+ }, g = async (e, r, f, p, h) => {
35
+ let g = m(p), _ = {
36
+ tenantId: r.tenantId,
37
+ site: r.site,
38
+ environment: r.environment
39
+ }, v = {
40
+ snapshot: {
41
+ id: f.snapshot.id,
42
+ digest: f.snapshot.digest
43
+ },
44
+ token: f.token,
45
+ consumerId: f.consumerId,
46
+ buildId: f.buildId,
47
+ host: f.host
48
+ }, y = h.keys.map((e) => ({
49
+ id: e.id,
50
+ material: new Uint8Array(e.material)
51
+ })), b = h.now ?? Date.now, x = [], S = /* @__PURE__ */ new Set(), C = [], w;
52
+ for (let r of g.pathSets) {
53
+ let [f] = await e.query({
54
+ table: i,
55
+ predicate: c(l("tenantId", _.tenantId), l("site", _.site), l("environment", _.environment), l("id", r.id)),
56
+ order: [],
57
+ take: 1,
58
+ skip: void 0,
59
+ projection: void 0
60
+ });
61
+ if (f === void 0) return d();
62
+ let p = t(f.context), m = {
63
+ ...v,
64
+ localeIds: p.localeIds,
65
+ owners: p.owners
66
+ }, h = await s(e, _, m, {
67
+ keys: y,
68
+ now: b()
69
+ }), g = await o(e, h.context, r.id, y);
70
+ if (g.sealed === null || g.sealed.id !== r.digest) return d();
71
+ for (let t = 0; t < Math.max(1, g.sealed.manifest.pages.length); t++) {
72
+ let i = await a(e, h.context, r.id, t, y);
73
+ if (i.set.id !== r.digest) return d();
74
+ for (let e of i.entries) {
75
+ let t = n(e.host, e.path);
76
+ if (e.host !== v.host || S.has(t) || x.length >= 1e5) return d();
77
+ if (e.owner === "code" && h.app.web !== void 0) {
78
+ let t = e.file === null ? void 0 : h.routing.definition?.claims[e.file];
79
+ if (t?.kind !== "code" || t.public !== !0) return d();
80
+ }
81
+ S.add(t), x.push(e);
82
+ }
83
+ }
84
+ let T = await s(e, _, m, {
85
+ keys: y,
86
+ now: b()
87
+ });
88
+ if (u(T.context) !== u(h.context)) return d();
89
+ C.push(T.context), w ??= T;
90
+ }
91
+ return w === void 0 ? d() : (x.sort((e, t) => e.path < t.path ? -1 : +(e.path > t.path)), {
92
+ selection: g,
93
+ admission: w,
94
+ entries: x,
95
+ contexts: C
96
+ });
97
+ }, _ = async (e, t, n, r, i) => {
98
+ let a = h(r);
99
+ return {
100
+ ...await g(e, t, n, { pathSets: a.pathSets }, i),
101
+ selection: a
102
+ };
103
+ };
104
+ //#endregion
105
+ export { m as copySnapshotPathSetSelection, h as copySnapshotSeoDocumentsSelection, g as readSnapshotPathSets, _ as readSnapshotSeoPathSets };
@@ -0,0 +1,88 @@
1
+ import { defineSiteDelivery as e } from "./siteDelivery.js";
2
+ import { resolveScopedContentSeo as t } from "./publicationSeo.js";
3
+ import { readVerifiedSnapshotResource as n } from "./buildSnapshot.js";
4
+ import { admitSnapshotPublicDocument as r } from "./snapshotPublicAccess.js";
5
+ import { snapshotSeoMetadataSource as i } from "./snapshotSeoMetadata.js";
6
+ import { Schema as a } from "effect";
7
+ import { createHash as o } from "node:crypto";
8
+ import { canonicalJson as s } from "@voltro/runtime";
9
+ //#region src/snapshotSeoRead.ts
10
+ var c = class extends a.TaggedError()("SnapshotSeoReadUnavailable", { reason: a.Literals([
11
+ "binding",
12
+ "projection",
13
+ "publication",
14
+ "media",
15
+ "access"
16
+ ]) }) {}, l = (e) => {
17
+ throw new c({ reason: e });
18
+ }, u = (e) => o("sha256").update(s(e)).digest("hex"), d = async (a, o, c, d) => {
19
+ let { snapshot: f, route: p, output: m } = c;
20
+ if (f.manifest.parts.find((e) => e.part === "seo")?.format !== "voltro.cms.seo-metadata/v1") return l("binding");
21
+ let h = (await n(a, o, f, "seo", "configuration")).value;
22
+ if (typeof h.xDefault != "boolean") return l("binding");
23
+ let g = await i(a, o, f, {
24
+ now: d,
25
+ xDefault: h.xDefault,
26
+ routeKey: `path:${u(m.path)}`
27
+ }), _, v = !1;
28
+ for await (let e of g.entries(f.manifest.publication)) {
29
+ if (e.key === "configuration") {
30
+ let t = (e) => Object.fromEntries(Object.entries(e).filter(([e]) => e !== "sourceSnapshot"));
31
+ if (s(t(e.value)) !== s(t(h))) return l("binding");
32
+ v = !0;
33
+ continue;
34
+ }
35
+ if (_ !== void 0 || e.key !== m.routeId) return l("binding");
36
+ let t = await n(a, o, f, "seo", e.key);
37
+ if (s(t) !== s(e) || e.value.state !== "resolved") return l("binding");
38
+ _ = e.value;
39
+ }
40
+ if (!v || _ === void 0) return l("binding");
41
+ let y = (await n(a, o, f, "schema", `type:${m.contentType}`)).value, b = t(y.definition, m.values, {
42
+ ...o,
43
+ locale: m.sourceLocale
44
+ });
45
+ if (s(b) !== s(_.metadata)) return l("projection");
46
+ if (b?.findings.some((e) => e.kind !== "recommendation")) return l("publication");
47
+ let x = b?.social.imageKey == null ? null : b.sources["social.image"];
48
+ if (b?.social.imageKey != null && (typeof x != "string" || !Object.hasOwn(m.values, x))) return l("media");
49
+ let S = (await n(a, o, f, "routes", "configuration")).value, C = e(S.site).locales.find((e) => e.contentLocale === m.sourceLocale)?.tag;
50
+ if (C === void 0) return l("binding");
51
+ let w = [];
52
+ for (let e of _.alternates) {
53
+ let t = await r(a, o, f, m.contentType, e.localeId, String(p.documentId), d);
54
+ if (t === null) continue;
55
+ let i = (await n(a, o, f, "routes", `identity:${e.routeId}`)).value, s = (await n(a, o, f, "routes", String(i.target))).value, c = t.chain[0];
56
+ if (s.routeId !== e.routeId || s.fallback !== !1 || s.sourceLocale !== c.locale || s.variantId !== c.variantId || s.revisionId !== c.revisionId || s.revision !== c.revision) return l("binding");
57
+ w.push({
58
+ locale: e.locale,
59
+ href: e.href
60
+ });
61
+ }
62
+ let T = b?.canonical === "omit" ? null : String(_.canonical);
63
+ return T !== null && !w.some((e) => e.href === T) ? l("access") : {
64
+ image: x == null ? null : {
65
+ fieldPath: [x],
66
+ origin: new URL(String(_.canonical)).origin
67
+ },
68
+ seo: {
69
+ title: b?.title ?? null,
70
+ description: b?.description ?? null,
71
+ canonical: T,
72
+ alternates: w,
73
+ xDefault: w.some((e) => e.href === _.xDefault) ? String(_.xDefault) : null,
74
+ languageTag: C,
75
+ robots: b?.robots ?? {
76
+ index: !1,
77
+ follow: !1
78
+ },
79
+ social: {
80
+ title: b?.social.title ?? null,
81
+ description: b?.social.description ?? null
82
+ },
83
+ structuredData: b?.structuredData ?? null
84
+ }
85
+ };
86
+ };
87
+ //#endregion
88
+ export { c as SnapshotSeoReadUnavailable, d as readAdmittedSnapshotSeo };
@@ -0,0 +1,128 @@
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
+ //#region 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
+ //#endregion
128
+ export { d as snapshotSiteConfiguration, f as snapshotSiteSources };
@@ -0,0 +1,36 @@
1
+ import { sitemapXml as e } from "./seo.js";
2
+ import { SnapshotSeoReadUnavailable as t } from "./snapshotSeoRead.js";
3
+ //#region 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
+ //#endregion
36
+ export { o as snapshotSitemapFiles };
@@ -0,0 +1,58 @@
1
+ import { createHash as e } from "node:crypto";
2
+ import { canonicalJson as t } from "@voltro/runtime";
3
+ //#region 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
+ //#endregion
58
+ export { i as snapshotTreeDependencies };
@@ -0,0 +1,10 @@
1
+ //#region 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
+ //#endregion
10
+ export { e as snapshotTreeLoader };