@voltro/cms 0.85.0 → 0.87.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (244) hide show
  1. package/CHANGELOG.md +5987 -0
  2. package/README.md +138 -0
  3. package/THIRD-PARTY-NOTICES.md +864 -253
  4. package/dist/ContentForm.js +282 -0
  5. package/dist/RichDocumentEditor.js +550 -0
  6. package/dist/RichDocumentView.js +177 -0
  7. package/dist/RichTextSurface.js +135 -0
  8. package/dist/aiCandidates.js +199 -0
  9. package/dist/aiOperations.js +152 -0
  10. package/dist/applicationBuildSnapshotService.js +101 -0
  11. package/dist/assetRenditions.js +102 -0
  12. package/dist/assetRevision.js +46 -0
  13. package/dist/assetUseRights.js +72 -0
  14. package/dist/audiences.js +31 -0
  15. package/dist/availability.js +124 -0
  16. package/dist/blueprint.js +166 -0
  17. package/dist/build.d.ts +3063 -0
  18. package/dist/build.js +37 -0
  19. package/dist/buildApplicationAdmission.js +16 -0
  20. package/dist/buildApplicationCatalog.js +136 -0
  21. package/dist/buildApplicationCatalogTable.js +24 -0
  22. package/dist/buildApplicationRest.js +99 -0
  23. package/dist/buildApplicationUpload.js +111 -0
  24. package/dist/buildSnapshot.js +401 -0
  25. package/dist/buildSnapshotApplicationPin.js +32 -0
  26. package/dist/buildSnapshotRest.js +210 -0
  27. package/dist/buildSnapshotService.js +265 -0
  28. package/dist/buildSnapshotTables.js +25 -0
  29. package/dist/bulk.js +282 -0
  30. package/dist/cacheIdentity.js +152 -0
  31. package/dist/changes.js +307 -0
  32. package/dist/cmsContext.js +229 -0
  33. package/dist/collections.js +224 -0
  34. package/dist/consent.js +29 -0
  35. package/dist/contentLocations.js +53 -0
  36. package/dist/contentProjection.js +83 -0
  37. package/dist/contentRouteIdentity.js +13 -0
  38. package/dist/contentRouteMaterializer.js +97 -0
  39. package/dist/contentRouteTypes.js +39 -0
  40. package/dist/contentSeo.js +189 -0
  41. package/dist/contentTreePath.js +60 -0
  42. package/dist/contentType.js +208 -0
  43. package/dist/contentValues.js +18 -0
  44. package/dist/contentfulImport.js +162 -0
  45. package/dist/copies.js +89 -0
  46. package/dist/cutover.js +202 -0
  47. package/dist/deliveryChecks.js +138 -0
  48. package/dist/domainHost.js +7 -0
  49. package/dist/domains.js +139 -0
  50. package/dist/draftTexts.js +164 -0
  51. package/dist/duplicates.js +78 -0
  52. package/dist/edgePurge.js +69 -0
  53. package/dist/editHistory.js +113 -0
  54. package/dist/effectForm.js +11 -0
  55. package/dist/environmentAliases.js +138 -0
  56. package/dist/environments.js +147 -0
  57. package/dist/errors.js +107 -0
  58. package/dist/experiments.js +528 -0
  59. package/dist/exposure.js +28 -0
  60. package/dist/extensionManifest.js +81 -0
  61. package/dist/extensions.js +314 -0
  62. package/dist/fieldSchema.js +199 -0
  63. package/dist/formStrings.js +74 -0
  64. package/dist/frontendBindings.js +99 -0
  65. package/dist/frontendMedia.js +18 -0
  66. package/dist/glossary.js +73 -0
  67. package/dist/history.js +54 -0
  68. package/dist/htmlImport.js +297 -0
  69. package/dist/index.d.ts +771 -54
  70. package/dist/index.js +89 -6082
  71. package/dist/initializePublicRoutes.js +28 -0
  72. package/dist/liveContentRouteView.js +76 -0
  73. package/dist/media.js +29 -0
  74. package/dist/metrics.js +46 -0
  75. package/dist/migration.js +193 -0
  76. package/dist/migrationStages.js +13 -0
  77. package/dist/nativeOutputDeploymentService.js +205 -0
  78. package/dist/outputActivation.js +234 -0
  79. package/dist/outputActivationOrigin.js +51 -0
  80. package/dist/outputActivationStore.js +411 -0
  81. package/dist/outputActivationTables.js +11 -0
  82. package/dist/outputActivationTarget.js +81 -0
  83. package/dist/outputActivationTargetTable.js +25 -0
  84. package/dist/outputDeployment.js +174 -0
  85. package/dist/outputDeploymentRest.js +168 -0
  86. package/dist/outputDeploymentService.js +241 -0
  87. package/dist/outputRouteGraph.js +177 -0
  88. package/dist/outputSafetyArtifact.js +147 -0
  89. package/dist/outputTargetRest.js +62 -0
  90. package/dist/pathSegmentEncoding.js +4 -0
  91. package/dist/presenceAnchors.js +68 -0
  92. package/dist/preview.js +31 -0
  93. package/dist/privateCmsTransport.js +76 -0
  94. package/dist/privateNativeRouteReservation.js +10 -0
  95. package/dist/promotion.js +116 -0
  96. package/dist/publicBuild.js +90 -0
  97. package/dist/publicBuildRest.js +98 -0
  98. package/dist/publicBuildService.js +63 -0
  99. package/dist/publicOutputHttp.js +129 -0
  100. package/dist/publicOutputService.js +287 -0
  101. package/dist/publicPresentation.js +17 -0
  102. package/dist/publicRouteDispositionAdmission.js +38 -0
  103. package/dist/publicRouteHistoryStore.js +12 -0
  104. package/dist/publicRouteHistoryView.js +34 -0
  105. package/dist/publicRouteIntegrity.js +5 -0
  106. package/dist/publicRouteMutation.js +6 -0
  107. package/dist/publicRouteNamespace.js +134 -0
  108. package/dist/publicRoutePublication.js +36 -0
  109. package/dist/publicRouteRegistry.js +17 -0
  110. package/dist/publicRouteRegistryBinding.js +194 -0
  111. package/dist/publicRouteRegistryDefinition.js +76 -0
  112. package/dist/publicRouteSitePublication.js +40 -0
  113. package/dist/publicRouteTables.js +13 -0
  114. package/dist/publicRouteUrl.js +18 -0
  115. package/dist/publicationSeo.js +52 -0
  116. package/dist/publicationState.js +296 -0
  117. package/dist/quality.js +188 -0
  118. package/dist/reconfigurePublicRoutes.js +41 -0
  119. package/dist/recurrence.js +78 -0
  120. package/dist/redirects.js +130 -0
  121. package/dist/referenceGraph.js +224 -0
  122. package/dist/references.js +173 -0
  123. package/dist/release.js +241 -0
  124. package/dist/renderReadAuthority.js +43 -0
  125. package/dist/renderReadGrant.js +137 -0
  126. package/dist/rest.js +52 -0
  127. package/dist/review.js +160 -0
  128. package/dist/richDocument.js +521 -0
  129. package/dist/richInline.js +100 -0
  130. package/dist/routeDispositionGraph.js +44 -0
  131. package/dist/routeDispositionRest.js +51 -0
  132. package/dist/routeDispositionService.js +73 -0
  133. package/dist/routeDispositionStore.js +289 -0
  134. package/dist/routeDispositionTables.js +5 -0
  135. package/dist/routeDispositions.js +91 -0
  136. package/dist/routeHistoryStorage.js +320 -0
  137. package/dist/routeHistoryStore.js +12 -0
  138. package/dist/schedule.js +80 -0
  139. package/dist/search.js +148 -0
  140. package/dist/selectionIntent.js +164 -0
  141. package/dist/seo.js +31 -0
  142. package/dist/series.js +105 -0
  143. package/dist/share.js +112 -0
  144. package/dist/siteBindings.js +159 -0
  145. package/dist/siteBuildCandidate.js +104 -0
  146. package/dist/siteDelivery.js +115 -0
  147. package/dist/siteState.js +47 -0
  148. package/dist/snapshotAddressGraph.js +55 -0
  149. package/dist/snapshotAddressRead.js +73 -0
  150. package/dist/snapshotAppConsumer.js +71 -0
  151. package/dist/snapshotAppExecution.js +102 -0
  152. package/dist/snapshotApplication.js +75 -0
  153. package/dist/snapshotApprovedRouteDispositions.js +44 -0
  154. package/dist/snapshotAssetAssembly.js +70 -0
  155. package/dist/snapshotAssetAssemblyRest.js +50 -0
  156. package/dist/snapshotBindingRead.js +61 -0
  157. package/dist/snapshotCodeSeo.js +29 -0
  158. package/dist/snapshotComponent.js +34 -0
  159. package/dist/snapshotComponentSource.js +24 -0
  160. package/dist/snapshotConsumer.js +87 -0
  161. package/dist/snapshotContentIdentity.js +10 -0
  162. package/dist/snapshotDefinitions.js +264 -0
  163. package/dist/snapshotDocumentAssembly.js +193 -0
  164. package/dist/snapshotDocumentAssemblyRest.js +84 -0
  165. package/dist/snapshotDocumentProjection.js +202 -0
  166. package/dist/snapshotDocumentTransfer.js +35 -0
  167. package/dist/snapshotDocumentTransferRest.js +80 -0
  168. package/dist/snapshotDomains.js +56 -0
  169. package/dist/snapshotEnvironment.js +31 -0
  170. package/dist/snapshotFieldPlan.js +85 -0
  171. package/dist/snapshotFrontend.js +103 -0
  172. package/dist/snapshotLink.js +8 -0
  173. package/dist/snapshotMedia.js +111 -0
  174. package/dist/snapshotMediaCapture.js +246 -0
  175. package/dist/snapshotMediaFields.js +225 -0
  176. package/dist/snapshotMediaRead.js +185 -0
  177. package/dist/snapshotMediaReader.js +13 -0
  178. package/dist/snapshotObservation.js +16 -0
  179. package/dist/snapshotObservedRouteHistory.js +34 -0
  180. package/dist/snapshotOutputTransfer.js +78 -0
  181. package/dist/snapshotPageLoader.js +7 -0
  182. package/dist/snapshotPageSeo.js +59 -0
  183. package/dist/snapshotPathLocale.js +15 -0
  184. package/dist/snapshotPresentation.js +86 -0
  185. package/dist/snapshotPresentationPolicy.js +12 -0
  186. package/dist/snapshotProjection.js +119 -0
  187. package/dist/snapshotPublicAccess.js +161 -0
  188. package/dist/snapshotPublicRouteHistory.js +40 -0
  189. package/dist/snapshotReadAdmission.js +38 -0
  190. package/dist/snapshotRedirectOutput.js +151 -0
  191. package/dist/snapshotRedirectTargets.js +24 -0
  192. package/dist/snapshotRedirects.js +132 -0
  193. package/dist/snapshotReference.js +8 -0
  194. package/dist/snapshotReferenceAddress.js +10 -0
  195. package/dist/snapshotReferenceGraph.js +79 -0
  196. package/dist/snapshotReferenceRead.js +65 -0
  197. package/dist/snapshotRelease.js +99 -0
  198. package/dist/snapshotRender.js +361 -0
  199. package/dist/snapshotRenderDependencies.js +178 -0
  200. package/dist/snapshotRenditions.js +88 -0
  201. package/dist/snapshotRichDocument.js +62 -0
  202. package/dist/snapshotRoleTransfer.js +106 -0
  203. package/dist/snapshotRoleTransferRest.js +99 -0
  204. package/dist/snapshotRouteAdmission.js +71 -0
  205. package/dist/snapshotRouteDispatch.js +111 -0
  206. package/dist/snapshotRouteDispositionPlan.js +73 -0
  207. package/dist/snapshotRouteRead.js +43 -0
  208. package/dist/snapshotRoutes.js +79 -0
  209. package/dist/snapshotRouting.js +113 -0
  210. package/dist/snapshotSeo.js +179 -0
  211. package/dist/snapshotSeoControls.js +101 -0
  212. package/dist/snapshotSeoDocumentInventory.js +115 -0
  213. package/dist/snapshotSeoDocuments.js +129 -0
  214. package/dist/snapshotSeoMerge.js +85 -0
  215. package/dist/snapshotSeoMetadata.js +137 -0
  216. package/dist/snapshotSeoOutput.js +173 -0
  217. package/dist/snapshotSeoPathSets.js +105 -0
  218. package/dist/snapshotSeoRead.js +88 -0
  219. package/dist/snapshotSite.js +128 -0
  220. package/dist/snapshotSitemapFiles.js +36 -0
  221. package/dist/snapshotTreeDependencies.js +58 -0
  222. package/dist/snapshotTreeLoader.js +10 -0
  223. package/dist/snapshotTreeRead.js +158 -0
  224. package/dist/staticPathSet.js +177 -0
  225. package/dist/staticPathSetRest.js +129 -0
  226. package/dist/staticPathSetService.js +249 -0
  227. package/dist/staticPathSetStore.js +338 -0
  228. package/dist/stewardship.js +146 -0
  229. package/dist/taxonomy.js +36 -0
  230. package/dist/team.js +103 -0
  231. package/dist/templates.js +106 -0
  232. package/dist/trackChanges.js +197 -0
  233. package/dist/translation.js +64 -0
  234. package/dist/tree.js +87 -0
  235. package/dist/usage.js +50 -0
  236. package/dist/validation.js +192 -0
  237. package/dist/visualEditing.js +60 -0
  238. package/dist/web.d.ts +709 -7
  239. package/dist/web.js +50 -2
  240. package/dist/workflow.js +322 -0
  241. package/dist/write.js +419 -0
  242. package/dist/xliff.js +325 -0
  243. package/package.json +20 -6
  244. package/dist/presenceAnchors-4iHAVQB3.js +0 -4367
@@ -0,0 +1,85 @@
1
+ import { canonicalCmsPublicPath as e } from "./publicBuild.js";
2
+ import { SnapshotSeoReadUnavailable as t } from "./snapshotSeoRead.js";
3
+ //#region src/snapshotSeoMerge.ts
4
+ var n = () => {
5
+ throw new t({ reason: "binding" });
6
+ }, r = (e, t, n) => {
7
+ let r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
8
+ for (let e of n) e.target.kind === "url" ? r.add(e.target.url) : i.add(e.target.digest);
9
+ for (let e of t) e.media.some((e) => i.has(e.digest)) && r.add(e.url);
10
+ let a = e.filter((e) => !r.has(e.path)), o = new Set(a.map((e) => e.path));
11
+ return a.map((e) => ({
12
+ ...e,
13
+ alternates: e.alternates.filter((e) => o.has(e.path))
14
+ }));
15
+ }, i = (t, r, i) => {
16
+ let a = new URL(i.origin);
17
+ if (a.protocol !== "https:" || a.origin !== i.origin) return n();
18
+ let o = (t, r = a) => {
19
+ if (/[\x00-\x20\x7f]/.test(t)) return n();
20
+ let i;
21
+ try {
22
+ i = new URL(t, r);
23
+ } catch {
24
+ return n();
25
+ }
26
+ return i.search || i.hash || i.username || i.password || i.href !== i.origin + i.pathname ? n() : i.protocol !== "https:" || i.origin !== a.origin ? null : e(i.pathname) === i.pathname ? i.href : n();
27
+ }, s = /* @__PURE__ */ new Map();
28
+ for (let e of t) {
29
+ if (o(e.path) !== e.path || s.has(e.path)) return n();
30
+ s.set(e.path, e);
31
+ }
32
+ let c = /* @__PURE__ */ new Map(), l = new Set(s.keys());
33
+ for (let t of r) {
34
+ let r = i.locales.find((e) => e.id === t.localeId && e.enabled);
35
+ if (r === void 0 || !/^native_[a-f0-9]{64}$/.test(t.routeId) || e(t.path) !== t.path) return n();
36
+ let u;
37
+ try {
38
+ u = new URL(t.url);
39
+ } catch {
40
+ return n();
41
+ }
42
+ if (u.protocol !== "https:" || u.origin + u.pathname !== t.url || u.pathname !== t.path) return n();
43
+ let d = t.url;
44
+ if (l.has(d)) return n();
45
+ if (l.add(d), u.origin !== a.origin) continue;
46
+ let f = t.seo.canonical === null ? d : o(t.seo.canonical, u);
47
+ i.indexable && !t.seo.noIndex && f === d && (c.set(d, t), s.set(d, {
48
+ documentId: t.routeId,
49
+ locale: r.tag,
50
+ path: d,
51
+ lastmod: null,
52
+ alternates: []
53
+ }));
54
+ }
55
+ if (!i.indexable) return [];
56
+ let u = [];
57
+ for (let [e, t] of s) {
58
+ let r = c.get(e);
59
+ if (r === void 0) {
60
+ u.push({
61
+ ...t,
62
+ alternates: t.alternates.filter((e) => s.has(e.path))
63
+ });
64
+ continue;
65
+ }
66
+ let i = /* @__PURE__ */ new Set(), a = [];
67
+ for (let t of r.seo.alternates) {
68
+ let r = t.locale.toLowerCase();
69
+ if (i.has(r)) return n();
70
+ i.add(r);
71
+ let c = o(t.href, new URL(e)), l = c === null ? void 0 : s.get(c);
72
+ l === void 0 || r !== "x-default" && l.locale.toLowerCase() !== r || a.push({
73
+ locale: r === "x-default" ? "x-default" : l.locale,
74
+ path: l.path
75
+ });
76
+ }
77
+ u.push({
78
+ ...t,
79
+ alternates: a
80
+ });
81
+ }
82
+ return u.sort((e, t) => e.path < t.path ? -1 : +(e.path > t.path));
83
+ };
84
+ //#endregion
85
+ export { r as filterSnapshotSeoSafety, i as mergeSnapshotSeoDocuments };
@@ -0,0 +1,137 @@
1
+ import { defineContentSeo as e, validateContentSeoFields as t } from "./contentSeo.js";
2
+ import { compileSiteDelivery as n } from "./siteDelivery.js";
3
+ import { defineContentSeoSites as r, resolveScopedContentSeo as i } from "./publicationSeo.js";
4
+ import { readCapturedPublication as a } from "./publicationState.js";
5
+ import { copySnapshotResource as o, deriveBuildSnapshot as s, pinnedSnapshotPartSource as c, readVerifiedSnapshotResource as l, verifyBuildSnapshot as u } from "./buildSnapshot.js";
6
+ import { SnapshotSeoUnavailable as d, snapshotSeoAddressSource as f } from "./snapshotSeo.js";
7
+ import { canonicalJson as p } from "@voltro/runtime";
8
+ //#region src/snapshotSeoMetadata.ts
9
+ var m = () => {
10
+ throw new d({ reason: "configuration" });
11
+ }, h = (e) => typeof e == "object" && !!e && !Array.isArray(e), g = async (s, d, g, _) => {
12
+ let v = {
13
+ tenantId: d.tenantId,
14
+ site: d.site,
15
+ environment: d.environment
16
+ }, y = {
17
+ id: g.id,
18
+ digest: g.digest
19
+ }, b = _.now ?? Date.now(), x = _.xDefault, S = await u(s, v, y, b), C = await f(s, v, y, {
20
+ now: b,
21
+ xDefault: x,
22
+ ..._.routeKey === void 0 ? {} : { routeKey: _.routeKey }
23
+ });
24
+ if (c(s, v, S, "schema", b).format !== "voltro.cms.schema/v1" || c(s, v, S, "site", b).format !== "voltro.cms.site/v3") return m();
25
+ let w = (await l(s, v, S, "routes", "configuration")).value, T = (await l(s, v, S, "site", "configuration")).value, E = n(w.site), D = {
26
+ id: E.definition.id,
27
+ version: E.definition.version,
28
+ environments: E.definition.environments,
29
+ defaultEnvironment: E.definition.defaultEnvironment,
30
+ bindings: E.definition.bindings,
31
+ ...E.definition.seo === void 0 ? {} : { seo: E.definition.seo }
32
+ };
33
+ if (T.version !== 3 || T.tenantId !== v.tenantId || T.site !== v.site || T.environment !== v.environment || p(T.app) !== p(w.app) || p(T.definition) !== p(D)) return m();
34
+ let O = (await l(s, v, S, "schema", "registry")).value;
35
+ return O.version !== 1 || p(O.app) !== p(w.app) || !Array.isArray(w.types) || O.count !== w.types.length ? m() : {
36
+ format: "voltro.cms.seo-metadata/v1",
37
+ entries: async function* (n) {
38
+ for await (let c of C.entries(n)) {
39
+ if (c.key === "configuration") {
40
+ yield o({
41
+ key: c.key,
42
+ value: {
43
+ ...c.value,
44
+ metadataContract: "editorial/v1",
45
+ inputs: S.manifest.parts.filter((e) => [
46
+ "routes",
47
+ "domains",
48
+ "locales",
49
+ "site",
50
+ "schema"
51
+ ].includes(e.part)),
52
+ publication: S.manifest.publication,
53
+ publicAdmission: "required",
54
+ mediaResolution: "retained-occurrence-required"
55
+ }
56
+ });
57
+ continue;
58
+ }
59
+ if (c.value.state === "excluded") {
60
+ yield o(c);
61
+ continue;
62
+ }
63
+ let n = (await l(s, v, S, "routes", String(c.value.routeKey))).value, u = "type:" + String(n.contentType), d = (await l(s, v, S, "schema", u)).value;
64
+ if (d.version !== 1 || p(d.app) !== p(w.app) || !h(d.definition)) return m();
65
+ let f = d.definition, g = w.types.find((e) => e.name === f.name);
66
+ if (f.name !== n.contentType || g === void 0 || !h(f.fields) || p(f.locations ?? []) !== p(g.locations)) return m();
67
+ if (f.seo === void 0) {
68
+ if (f.seoSites !== void 0) return m();
69
+ yield o({
70
+ key: c.key,
71
+ value: {
72
+ ...c.value,
73
+ schemaKey: u,
74
+ metadata: null,
75
+ metadataState: "unconfigured"
76
+ }
77
+ });
78
+ continue;
79
+ }
80
+ let _ = e(f.seo);
81
+ if (t(_, f.fields), _.social?.image !== void 0) {
82
+ let e = f.fields[_.social.image];
83
+ if (e.kind === "reference") {
84
+ if (!w.types.some((t) => t.name === e.referenceType)) return m();
85
+ let t = (await l(s, v, S, "schema", `type:${e.referenceType}`)).value;
86
+ if (t.version !== 1 || p(t.app) !== p(w.app) || !h(t.definition) || t.definition.name !== e.referenceType || !h(t.definition.asset)) return m();
87
+ }
88
+ }
89
+ let y = await a(s, v, S.manifest.publication.id, String(n.contentType), String(n.sourceLocale), String(n.variantId), b);
90
+ if (y === null || y.revisionId !== n.revisionId || y.documentId !== n.documentId || y.revision !== n.revision) return m();
91
+ let x = E.definition.locales.find((e) => e.contentLocale === n.sourceLocale);
92
+ if (x === void 0) return m();
93
+ let C = f.seoSites === void 0 ? void 0 : r(f.seoSites);
94
+ if (C !== void 0 && p(C.find((e) => e.id === v.site) ?? null) !== p(E.definition)) return m();
95
+ let T = i({
96
+ seo: _,
97
+ ...C === void 0 ? {} : { seoSites: C }
98
+ }, y, {
99
+ ...v,
100
+ locale: x.contentLocale
101
+ });
102
+ yield o({
103
+ key: c.key,
104
+ value: {
105
+ ...c.value,
106
+ schemaKey: u,
107
+ metadataState: "projected",
108
+ metadata: T,
109
+ defaultsLocaleId: x.id,
110
+ source: {
111
+ contentType: n.contentType,
112
+ documentId: n.documentId,
113
+ variantId: n.variantId,
114
+ revisionId: n.revisionId,
115
+ locale: n.sourceLocale
116
+ }
117
+ }
118
+ });
119
+ }
120
+ }
121
+ };
122
+ }, _ = async (e, t, n, r) => {
123
+ let i = {
124
+ tenantId: t.tenantId,
125
+ site: t.site,
126
+ environment: t.environment
127
+ }, a = {
128
+ id: n.id,
129
+ digest: n.digest
130
+ }, o = r.now ?? Date.now(), c = r.xDefault, l = await g(e, i, a, {
131
+ now: o,
132
+ xDefault: c
133
+ });
134
+ return s(e, i, a, { seo: l }, o);
135
+ };
136
+ //#endregion
137
+ export { _ as deriveSnapshotSeoMetadata, g as snapshotSeoMetadataSource };
@@ -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 };