@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,101 @@
1
+ import { defineSiteDelivery as e } from "./siteDelivery.js";
2
+ import { pageSnapshotResources as t, readVerifiedSnapshotResource as n } from "./buildSnapshot.js";
3
+ import { verifySnapshotRouteOwnership as r } from "./snapshotRouting.js";
4
+ import { staticPathHash as i } from "./staticPathSet.js";
5
+ import { snapshotSeoMetadataSource as a } from "./snapshotSeoMetadata.js";
6
+ import { readSnapshotRouteAdmission as o, verifySnapshotContentRoute as s } from "./snapshotRouteAdmission.js";
7
+ import { readAdmittedSnapshotContentRoute as c } from "./snapshotRouteRead.js";
8
+ import { SnapshotSeoReadUnavailable as l, readAdmittedSnapshotSeo as u } from "./snapshotSeoRead.js";
9
+ import { snapshotSitemapFiles as d } from "./snapshotSitemapFiles.js";
10
+ import { canonicalJson as f } from "@voltro/runtime";
11
+ //#region src/snapshotSeoControls.ts
12
+ var p = () => {
13
+ throw new l({ reason: "binding" });
14
+ }, m = async (l, m, h, g, _) => {
15
+ let v = await o(l, m, h, {
16
+ ...g,
17
+ path: "/"
18
+ }, _), { snapshot: y, configuration: b, now: x } = v, S = e(b.site);
19
+ if (y.manifest.parts.find((e) => e.part === "seo")?.format !== "voltro.cms.seo-metadata/v1") return p();
20
+ let C = (await n(l, m, y, "seo", "configuration")).value;
21
+ if (typeof C.origin != "string" || typeof C.xDefault != "boolean") return p();
22
+ let w = await a(l, m, y, {
23
+ now: x,
24
+ xDefault: C.xDefault
25
+ }), T = !1;
26
+ for await (let e of w.entries(y.manifest.publication)) {
27
+ if (e.key !== "configuration") return p();
28
+ let t = (e) => Object.fromEntries(Object.entries(e).filter(([e]) => e !== "sourceSnapshot"));
29
+ if (f(t(e.value)) !== f(t(C))) return p();
30
+ T = !0;
31
+ break;
32
+ }
33
+ if (!T) return p();
34
+ let E = new URL(C.origin);
35
+ if (E.protocol !== "https:" || E.origin !== C.origin) return p();
36
+ let D = m.environment === "production" && m.environment === S.defaultEnvironment, O = [], k;
37
+ do {
38
+ let e = await t(l, m, y.id, "routes", {
39
+ now: x,
40
+ limit: 200,
41
+ ...k === void 0 ? {} : { after: k }
42
+ });
43
+ for (let t of e.items) {
44
+ if (!t.key.startsWith("path:")) continue;
45
+ let e = t.value;
46
+ if (typeof e.path != "string" || t.key !== "path:" + i(e.path)) return p();
47
+ if (s(m, e.path, e), e.fallback !== !1 || r(b, e).owner !== "cms") continue;
48
+ let a = await c(l, {
49
+ ...v,
50
+ input: {
51
+ ...v.input,
52
+ path: e.path
53
+ },
54
+ route: e
55
+ });
56
+ if (a === null) continue;
57
+ let { seo: o } = await u(l, m, a, x), d = (await n(l, m, y, "seo", a.output.routeId)).value, f = d.metadata;
58
+ if (!D || f?.sitemap !== !0 || !o.robots.index || o.canonical === null) continue;
59
+ let h = E.origin + a.output.path;
60
+ if (o.canonical !== h || (O.push({
61
+ documentId: a.document.documentId,
62
+ locale: o.languageTag,
63
+ path: h,
64
+ lastmod: d.lastModified,
65
+ alternates: o.alternates.map((e) => ({
66
+ locale: e.locale,
67
+ path: e.href
68
+ }))
69
+ }), O.length > 1e5)) return p();
70
+ }
71
+ k = e.next ?? void 0;
72
+ } while (k !== void 0);
73
+ O.sort((e, t) => e.path < t.path ? -1 : +(e.path > t.path));
74
+ let A = new Set(O.map((e) => e.path));
75
+ if (A.size !== O.length) return p();
76
+ let j = O.map((e) => ({
77
+ ...e,
78
+ alternates: e.alternates.filter((e) => A.has(e.path))
79
+ })), M = S.locales.find((e) => e.id === S.defaultLocale)?.tag, N = d(j, E.origin, C.xDefault ? M : void 0), P = N[0].text, F = D ? `User-agent: *\nAllow: /\n\nSitemap: ${E.origin}/sitemap.xml\n` : "User-agent: *\nDisallow: /\n", I = (await n(l, m, y, "app", "configuration")).value.execution, L = typeof I == "object" && !!I && !Array.isArray(I) && I.web !== void 0;
80
+ return await o(l, m, h, {
81
+ ...g,
82
+ path: "/"
83
+ }, _), {
84
+ sitemap: P,
85
+ robots: F,
86
+ urls: j,
87
+ files: N,
88
+ origin: E.origin,
89
+ indexable: D,
90
+ defaultLanguage: M ?? null,
91
+ xDefault: C.xDefault,
92
+ locales: S.locales.map((e) => ({
93
+ id: e.id,
94
+ tag: e.tag,
95
+ enabled: e.enabled
96
+ })),
97
+ productionDocumentRequired: L
98
+ };
99
+ };
100
+ //#endregion
101
+ export { m as readSnapshotSeoControls };
@@ -0,0 +1,115 @@
1
+ import { canonicalCmsPublicPath as e } from "./publicBuild.js";
2
+ import { copySnapshotResource as t } from "./buildSnapshot.js";
3
+ import { snapshotRoutingPath as n } from "./snapshotRouting.js";
4
+ import { copySnapshotConsentPurposes as r, copySnapshotPresentationValue as i, snapshotPresentations as a } from "./snapshotPresentation.js";
5
+ import { SnapshotSeoReadUnavailable as o } from "./snapshotSeoRead.js";
6
+ import { createHash as s } from "node:crypto";
7
+ import { canonicalJson as c } from "@voltro/runtime";
8
+ //#region src/snapshotSeoDocumentInventory.ts
9
+ var l = () => {
10
+ throw new o({ reason: "binding" });
11
+ }, u = (e) => s("sha256").update(c(e)).digest("hex"), d = (e) => typeof e == "string" && /^[a-f0-9]{64}$/.test(e), f = (e, t) => typeof e != "object" || !e || Array.isArray(e) || ![Object.prototype, null].includes(Object.getPrototypeOf(e)) || Reflect.ownKeys(e).some((t) => typeof t != "string" || !Object.getOwnPropertyDescriptor(e, t).enumerable || !Object.hasOwn(Object.getOwnPropertyDescriptor(e, t), "value")) || t !== void 0 && Object.keys(e).sort().join(",") !== t ? l() : e, p = (e, t) => !Array.isArray(e) || e.length > t || Reflect.ownKeys(e).length !== e.length + 1 ? l() : Array.from({ length: e.length }, (t, n) => {
12
+ let r = Object.getOwnPropertyDescriptor(e, String(n));
13
+ return r === void 0 || !r.enumerable || !Object.hasOwn(r, "value") ? l() : r.value;
14
+ }), m = (o) => {
15
+ let m = f(o, "id,manifest");
16
+ if (!d(m.id)) return l();
17
+ let h = f(m.manifest, "files,subject,version"), g = f(h.subject, "build,consentPurposes,pathSetIds,presentations,profile,records,selector,version");
18
+ if (h.version !== 1 || g.version !== 3 || g.profile !== "voltro.cms-public-documents/v3") return l();
19
+ let _ = f(g.build, "executionId,inputsId,snapshotDigest,version");
20
+ if (_.version !== 1 || !d(_.snapshotDigest) || !d(_.inputsId) || !d(_.executionId)) return l();
21
+ let v = {
22
+ version: 1,
23
+ snapshotDigest: _.snapshotDigest,
24
+ inputsId: _.inputsId,
25
+ executionId: _.executionId
26
+ }, y = [
27
+ "1",
28
+ v.snapshotDigest,
29
+ v.inputsId,
30
+ v.executionId
31
+ ].join(".");
32
+ if (g.selector !== y) return l();
33
+ let b = t({
34
+ key: "public-classes",
35
+ value: {
36
+ consentPurposes: g.consentPurposes,
37
+ presentations: g.presentations
38
+ }
39
+ }).value, x = r(b.consentPurposes), S = a(x, 257).map((e) => ({
40
+ presentation: e,
41
+ key: u(e)
42
+ })).sort((e, t) => e.key < t.key ? -1 : +(e.key > t.key)).map((e) => e.presentation);
43
+ if (c({
44
+ consentPurposes: x,
45
+ presentations: S
46
+ }) !== c(b)) return l();
47
+ let C = p(g.pathSetIds, 64).map((e, t, n) => !d(e) || t > 0 && String(n[t - 1]) >= e ? l() : e);
48
+ if (C.length === 0) return l();
49
+ let w = S.map((e) => u(e)).sort(), T = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new Map(), k = p(h.files, 1e5).map((e) => {
50
+ let t = f(e, "contentType,digest,path,size");
51
+ if (typeof t.path != "string" || t.contentType !== "text/html" || !d(t.digest) || !Number.isSafeInteger(t.size) || Number(t.size) < 0 || Number(t.size) > 4194304 || O.has(t.path)) return l();
52
+ let n = {
53
+ path: t.path,
54
+ contentType: t.contentType,
55
+ digest: t.digest,
56
+ size: Number(t.size)
57
+ };
58
+ return O.set(n.path, n), n;
59
+ }), A = "", j = p(g.records, 1e5).map((r) => {
60
+ let a = t({
61
+ key: "public-document",
62
+ value: f(r, "artifactId,digest,file,media,pageFile,path,presentation,routeId,size,url")
63
+ }).value;
64
+ if (!n(a.pageFile) || typeof a.url != "string" || typeof a.path != "string" || e(a.path) !== a.path || typeof a.routeId != "string" || !/^(route_|native_)[a-f0-9]{64}$/.test(a.routeId) || !d(a.artifactId) || !d(a.digest)) return l();
65
+ let o = new URL(a.url);
66
+ if (o.protocol !== "https:" || o.origin + o.pathname !== a.url || o.pathname !== a.path) return l();
67
+ let c = i(a.presentation), m = u(c), h = a.url + "#" + m;
68
+ if (h <= A || a.file !== "pages/" + s("sha256").update(h).digest("hex") + ".html") return l();
69
+ A = h;
70
+ let g = O.get(String(a.file));
71
+ if (g === void 0 || g.digest !== a.digest || g.size !== a.size) return l();
72
+ let _ = p(a.media, 1e5).map((e) => {
73
+ let t = f(e, "digest,rights"), n = f(t.rights);
74
+ return !d(t.digest) || n.version !== 1 ? l() : {
75
+ digest: t.digest,
76
+ rights: n
77
+ };
78
+ }), v = T.get(a.url) ?? [], y = E.get(a.url);
79
+ return y !== void 0 && (y !== a.routeId || D.get(a.url) !== a.pageFile) ? l() : (D.set(a.url, a.pageFile), E.set(a.url, a.routeId), v.push(m), T.set(a.url, v), {
80
+ url: a.url,
81
+ path: a.path,
82
+ routeId: a.routeId,
83
+ artifactId: a.artifactId,
84
+ presentation: c,
85
+ file: g.path,
86
+ pageFile: a.pageFile,
87
+ digest: g.digest,
88
+ size: g.size,
89
+ media: _
90
+ });
91
+ });
92
+ return k.length !== j.length || [...T.values()].some((e) => c(e.sort()) !== c(w)) || u({
93
+ version: 1,
94
+ subject: {
95
+ version: 3,
96
+ profile: "voltro.cms-public-documents/v3",
97
+ build: v,
98
+ selector: y,
99
+ pathSetIds: C,
100
+ consentPurposes: x,
101
+ presentations: S,
102
+ records: j
103
+ },
104
+ files: k
105
+ }) !== m.id ? l() : {
106
+ build: v,
107
+ selector: y,
108
+ pathSetIds: C,
109
+ consentPurposes: x,
110
+ presentations: S,
111
+ records: j
112
+ };
113
+ };
114
+ //#endregion
115
+ export { m as readSnapshotSeoDocumentInventory };
@@ -0,0 +1,129 @@
1
+ import { copySnapshotResource as e } from "./buildSnapshot.js";
2
+ import { readCapturedSnapshotConsentPurposes as t } from "./snapshotPresentationPolicy.js";
3
+ import { copySnapshotCodeSeo as n } from "./snapshotCodeSeo.js";
4
+ import { admitCapturedAssetUseRights as r } from "./assetUseRights.js";
5
+ import { SnapshotSeoReadUnavailable as i } from "./snapshotSeoRead.js";
6
+ import { readSnapshotSeoPathSets as a } from "./snapshotSeoPathSets.js";
7
+ import { readSnapshotSeoDocumentInventory as o } from "./snapshotSeoDocumentInventory.js";
8
+ import { createHash as s } from "node:crypto";
9
+ import { canonicalJson as c } from "@voltro/runtime";
10
+ //#region src/snapshotSeoDocuments.ts
11
+ var l = (e) => {
12
+ let { app: t, admission: n } = e.paths.admission, r = n.input;
13
+ return {
14
+ snapshot: {
15
+ id: n.snapshot.id,
16
+ digest: n.snapshot.digest
17
+ },
18
+ app: {
19
+ inputsId: t.inputsId,
20
+ executionId: t.executionId
21
+ },
22
+ documents: {
23
+ artifactId: e.paths.selection.artifactId,
24
+ pathSetIds: e.inventory.pathSetIds
25
+ },
26
+ consumerId: r.consumerId,
27
+ buildId: r.buildId,
28
+ host: r.host
29
+ };
30
+ }, u = () => {
31
+ throw new i({ reason: "binding" });
32
+ }, d = (e) => s("sha256").update(c(e)).digest("hex"), f = (e, t) => typeof e != "object" || !e || Array.isArray(e) || ![Object.prototype, null].includes(Object.getPrototypeOf(e)) || Reflect.ownKeys(e).some((t) => typeof t != "string" || !Object.getOwnPropertyDescriptor(e, t).enumerable || !Object.hasOwn(Object.getOwnPropertyDescriptor(e, t), "value")) || t !== void 0 && Object.keys(e).sort().join(",") !== t ? u() : e, p = (e) => !Array.isArray(e) || e.length > 1e5 || Reflect.ownKeys(e).length !== e.length + 1 ? u() : Array.from({ length: e.length }, (t, n) => {
33
+ let r = Object.getOwnPropertyDescriptor(e, String(n));
34
+ return r === void 0 || !r.enumerable || !Object.hasOwn(r, "value") ? u() : r.value;
35
+ }), m = async (i, s, l, m, h) => {
36
+ let g = {
37
+ snapshot: {
38
+ id: l.snapshot.id,
39
+ digest: l.snapshot.digest
40
+ },
41
+ token: l.token,
42
+ consumerId: l.consumerId,
43
+ buildId: l.buildId,
44
+ host: l.host
45
+ }, _ = {
46
+ tenantId: s.tenantId,
47
+ site: s.site,
48
+ environment: s.environment
49
+ }, v = {
50
+ keys: h.keys.map((e) => ({
51
+ id: e.id,
52
+ material: new Uint8Array(e.material)
53
+ })),
54
+ now: h.now ?? Date.now
55
+ }, y = { ...h.use }, b = h.provider.read?.bind(h.provider);
56
+ if (b === void 0) return u();
57
+ let x = await a(i, _, g, m, v), S = await b(x.selection.artifactId);
58
+ if (f(S, "id,manifest").id !== x.selection.artifactId) return u();
59
+ let C = o(S), w = x.admission.app, T = x.admission.admission;
60
+ if (w.web === void 0 || c(C.build) !== c({
61
+ version: 1,
62
+ snapshotDigest: T.snapshot.digest,
63
+ inputsId: w.inputsId,
64
+ executionId: w.executionId
65
+ }) || c(C.pathSetIds) !== c(x.selection.pathSets.map((e) => e.digest).sort())) return u();
66
+ let E = await t(i, _, T.snapshot, T.configuration.app);
67
+ if (c(E) !== c(C.consentPurposes)) return u();
68
+ let D = new Map(x.entries.map((e) => ["https://" + e.host + e.path, e])), O = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Set();
69
+ for (let t of C.records) {
70
+ let a = D.get(t.url);
71
+ if (a === void 0 || t.path !== a.path || t.routeId !== a.routeId || t.pageFile !== a.file) return u();
72
+ let o = f(await b(t.artifactId), "id,manifest"), s = f(o.manifest, "files,subject,version");
73
+ if (o.id !== t.artifactId || s.version !== 1) return u();
74
+ let l = f(s.subject, a.owner === "code" ? "assets,codeSeo,receipt" : "assets,receipt"), m = p(l.assets).map((t) => {
75
+ let n = f(e({
76
+ key: "rendered-asset",
77
+ value: f(t)
78
+ }).value);
79
+ if (n.routeId !== a.routeId || n.snapshotDigest !== T.snapshot.digest || typeof n.checksum != "string" || !/^[a-f0-9]{64}$/.test(n.checksum)) return u();
80
+ let r = f(n.rights);
81
+ return r.version === 1 ? {
82
+ digest: n.checksum,
83
+ rights: r
84
+ } : u();
85
+ });
86
+ if (c(m) !== c(t.media)) return u();
87
+ for (let e of m) await r(i, _, e.rights, v.now(), y);
88
+ let h = f(l.receipt);
89
+ if (h.version !== (a.owner === "code" ? 13 : 12) || h.owner !== a.owner || h.snapshotId !== T.snapshot.id || h.snapshotDigest !== T.snapshot.digest || h.inputsId !== w.inputsId || h.executionId !== w.executionId || h.consumerId !== T.input.consumerId || h.buildId !== T.input.buildId || h.pageFile !== t.pageFile || h.path !== a.path || h.routeId !== a.routeId || h.documentDigest !== t.digest) return u();
90
+ let g = e({
91
+ key: "renderer-binding",
92
+ value: {
93
+ consentPurposes: h.consentPurposes,
94
+ presentation: h.presentation,
95
+ web: h.web
96
+ }
97
+ }).value;
98
+ if (c(g) !== c({
99
+ consentPurposes: E,
100
+ presentation: t.presentation,
101
+ web: w.web
102
+ })) return u();
103
+ let x = p(s.files).map((e) => f(e, "contentType,digest,path,size")).find((e) => e.path === "document.html");
104
+ if (x === void 0 || x.contentType !== "text/html" || x.digest !== t.digest || x.size !== t.size) return u();
105
+ if (a.owner === "code") {
106
+ let e = n(l.codeSeo);
107
+ if (h.codeSeoDigest !== d(e)) return u();
108
+ let r = {
109
+ url: t.url,
110
+ path: a.path,
111
+ localeId: a.localeId,
112
+ routeId: a.routeId,
113
+ seo: e
114
+ }, i = O.get(t.url);
115
+ if (i !== void 0 && c(i) !== c(r)) return u();
116
+ O.set(t.url, r);
117
+ }
118
+ k.add(t.url);
119
+ }
120
+ if (k.size !== D.size || [...D.keys()].some((e) => !k.has(e))) return u();
121
+ let A = await a(i, _, g, x.selection, v);
122
+ return c(A.entries) !== c(x.entries) || c(A.admission.context) !== c(x.admission.context) ? u() : {
123
+ inventory: C,
124
+ paths: A,
125
+ native: [...O.values()]
126
+ };
127
+ };
128
+ //#endregion
129
+ export { m as readSnapshotSeoDocuments, l as snapshotOutputSafetyBinding };
@@ -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 };