@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,86 @@
1
+ import { consentDecisionComplete as e, grantedPurposes as t } from "./consent.js";
2
+ import { Schema as n } from "effect";
3
+ //#region src/snapshotPresentation.ts
4
+ var r = class extends n.TaggedError()("SnapshotPresentationUnavailable", { reason: n.Literals([
5
+ "policy",
6
+ "selection",
7
+ "bounds"
8
+ ]) }) {}, i = (e) => {
9
+ throw new r({ reason: e });
10
+ }, a = (e) => typeof e == "object" && !!e && !Array.isArray(e), o = (e) => typeof e == "string" && e.length > 0 && e.length <= 128 && !/[\x00-\x1f\x7f]/.test(e), s = (e, t) => {
11
+ if (!a(e) || Object.keys(e).sort().join(",") !== "id,version" || !o(e.id) || !Number.isSafeInteger(e.version) || Number(e.version) < 1) return i(t);
12
+ try {
13
+ encodeURIComponent(e.id);
14
+ } catch {
15
+ return i(t);
16
+ }
17
+ return {
18
+ id: e.id,
19
+ version: Number(e.version)
20
+ };
21
+ }, c = (e) => {
22
+ if (!Array.isArray(e) || e.length > 32) return i("policy");
23
+ let t = e.map((e) => s(e, "policy"));
24
+ return new Set(t.map((e) => e.id)).size === t.length ? t.sort((e, t) => e.id < t.id ? -1 : +(e.id > t.id)) : i("policy");
25
+ }, l = (e) => {
26
+ if (e === void 0) return {
27
+ version: 1,
28
+ decided: !1,
29
+ granted: []
30
+ };
31
+ if (!a(e) || Object.keys(e).sort().join(",") !== "decided,granted,version" || e.version !== 1 || typeof e.decided != "boolean" || !Array.isArray(e.granted) || e.granted.length > 32) return i("selection");
32
+ let t = e.granted.map((e) => s(e, "selection")).sort((e, t) => e.id < t.id ? -1 : +(e.id > t.id));
33
+ return new Set(t.map((e) => e.id)).size === t.length ? {
34
+ version: 1,
35
+ decided: e.decided,
36
+ granted: t
37
+ } : i("selection");
38
+ }, u = (e, t) => {
39
+ let n = c(e), r = l(t);
40
+ return n.length === 0 && r.decided || n.length > 0 && !r.decided && r.granted.length === n.length || r.granted.some((e) => !n.some((t) => t.id === e.id && t.version === e.version)) ? i("selection") : r;
41
+ }, d = (n, r) => {
42
+ let o = c(n);
43
+ if (r === void 0 || o.length === 0) return u(o, void 0);
44
+ if (!a(r)) return i("selection");
45
+ let s = Object.fromEntries(Object.entries(r)), l = t(o, s);
46
+ return {
47
+ version: 1,
48
+ decided: e(o, s),
49
+ granted: o.filter((e) => l.has(e.id))
50
+ };
51
+ }, f = (e, t) => {
52
+ let n = "1." + encodeURIComponent(JSON.stringify(u(e, t)));
53
+ return n.length > 32768 ? i("bounds") : n;
54
+ }, p = (e, t) => {
55
+ if (typeof t != "string" || t.length > 32768 || !t.startsWith("1.")) return i("selection");
56
+ let n;
57
+ try {
58
+ n = JSON.parse(decodeURIComponent(t.slice(2)));
59
+ } catch {
60
+ return i("selection");
61
+ }
62
+ let r = u(e, n);
63
+ return f(e, r) === t ? r : i("selection");
64
+ }, m = (e, t = 65) => {
65
+ let n = c(e);
66
+ if (!Number.isSafeInteger(t) || t < 1 || t > 257) return i("bounds");
67
+ let r = u(n, void 0);
68
+ if (n.length === 0) return [r];
69
+ let a = 2 ** n.length;
70
+ if (2 * a - 1 > t) return i("bounds");
71
+ let o = Array.from({ length: a }, (e, t) => ({
72
+ version: 1,
73
+ decided: !0,
74
+ granted: n.filter((e, n) => !!(t & 1 << n))
75
+ }));
76
+ return [
77
+ r,
78
+ ...o,
79
+ ...o.slice(1, -1).map((e) => ({
80
+ ...e,
81
+ decided: !1
82
+ }))
83
+ ];
84
+ };
85
+ //#endregion
86
+ export { r as SnapshotPresentationUnavailable, u as admitSnapshotPresentation, c as copySnapshotConsentPurposes, l as copySnapshotPresentationValue, p as decodeSnapshotPresentation, f as encodeSnapshotPresentation, d as snapshotPresentationFromChoices, m as snapshotPresentations };
@@ -0,0 +1,12 @@
1
+ import { readVerifiedSnapshotResource as e } from "./buildSnapshot.js";
2
+ import { SnapshotPresentationUnavailable as t, copySnapshotConsentPurposes as n } from "./snapshotPresentation.js";
3
+ import { createHash as r } from "node:crypto";
4
+ import { canonicalJson as i } from "@voltro/runtime";
5
+ //#region src/snapshotPresentationPolicy.ts
6
+ var a = async (a, o, s, c) => {
7
+ let l = await e(a, o, s, "policies", "configuration"), u = (await e(a, o, s, "policies", "registry")).value, d = l.value, f = r("sha256").update(i(l)).digest("hex");
8
+ if (s.manifest.parts.find((e) => e.part === "policies")?.format !== "voltro.cms.public-access/v2" || Object.keys(d).sort().join(",") !== "app,consentPurposes,version" || d.version !== 2 || u.version !== 2 || u.consentDigest !== f || i(d.app) !== i(c) || i(u.app) !== i(c)) throw new t({ reason: "policy" });
9
+ return n(d.consentPurposes);
10
+ };
11
+ //#endregion
12
+ export { a as readCapturedSnapshotConsentPurposes };
@@ -0,0 +1,119 @@
1
+ import { defineContentLocations as e } from "./contentLocations.js";
2
+ import { copySnapshotResource as t } from "./buildSnapshot.js";
3
+ import { copySnapshotAppCodePin as n, snapshotContentTypeDefinition as r } from "./snapshotDefinitions.js";
4
+ import { defineContentProjection as i } from "./contentProjection.js";
5
+ import { Schema as a } from "effect";
6
+ import { createHash as o } from "node:crypto";
7
+ import { canonicalJson as s } from "@voltro/runtime";
8
+ //#region src/snapshotProjection.ts
9
+ var c = class extends a.TaggedError()("SnapshotProjectionUnavailable", { reason: a.Literals([
10
+ "definition",
11
+ "scope",
12
+ "binding",
13
+ "unconfigured",
14
+ "publication"
15
+ ]) }) {}, l = (e) => {
16
+ throw new c({ reason: e });
17
+ }, u = (e) => o("sha256").update(s(e)).digest("hex"), d = (n, r) => {
18
+ if (n === void 0) return {};
19
+ let i;
20
+ try {
21
+ i = t({
22
+ key: "trees",
23
+ value: n
24
+ }).value;
25
+ } catch {
26
+ return l("definition");
27
+ }
28
+ let a = Object.entries(i);
29
+ return a.length > 16 ? l("definition") : Object.fromEntries(a.sort(([e], [t]) => e < t ? -1 : +(e > t)).map(([t, n]) => {
30
+ if (!/^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(t) || typeof n != "object" || !n || Array.isArray(n)) return l("definition");
31
+ let i = n;
32
+ if (Object.keys(i).some((e) => ![
33
+ "contentType",
34
+ "mappingId",
35
+ "fields",
36
+ "includeField"
37
+ ].includes(e))) return l("definition");
38
+ let a = r.find((e) => e.name === i.contentType);
39
+ if (a?.tree === void 0 || typeof i.mappingId != "string" || !e(a.locations ?? []).some((e) => e.id === i.mappingId) || !Array.isArray(i.fields) || i.fields.length === 0 || i.fields.length > 64 || new Set(i.fields).size !== i.fields.length) return l("definition");
40
+ let o = [];
41
+ for (let e of i.fields) {
42
+ if (typeof e != "string" || !Object.hasOwn(a.fields, e) || ![
43
+ "string",
44
+ "number",
45
+ "boolean",
46
+ "date",
47
+ "datetime",
48
+ "literal"
49
+ ].includes(a.fields[e].kind)) return l("definition");
50
+ o.push(e);
51
+ }
52
+ let s = i.includeField;
53
+ return s !== void 0 && (typeof s != "string" || !Object.hasOwn(a.fields, s) || a.fields[s].kind !== "boolean") ? l("definition") : [t, {
54
+ contentType: a.name,
55
+ mappingId: i.mappingId,
56
+ fields: o.sort(),
57
+ ...s === void 0 ? {} : { includeField: s }
58
+ }];
59
+ }));
60
+ }, f = (e, t) => e === void 0 ? [] : !Array.isArray(e) || e.length > 64 || e.some((e) => typeof e != "string" || !t.includes(e)) || new Set(e).size !== e.length ? l("definition") : [...e].sort(), p = (e, n) => {
61
+ if (e === void 0) return {};
62
+ let r;
63
+ try {
64
+ r = t({
65
+ key: "referenceRoutes",
66
+ value: e
67
+ }).value;
68
+ } catch {
69
+ return l("definition");
70
+ }
71
+ let i = Object.entries(r);
72
+ return i.length > 64 || i.some(([e, t]) => !n.includes(e) || typeof t != "string" || !/^[A-Za-z][A-Za-z0-9_.-]{0,63}$/.test(t)) ? l("definition") : Object.fromEntries(i.sort(([e], [t]) => e < t ? -1 : +(e > t)));
73
+ }, m = (a, o, s) => {
74
+ let c = n(o);
75
+ if (!/^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(s.id) || a.length === 0 || new Set(a.map((e) => e.name)).size !== a.length) return l("definition");
76
+ let m = t({
77
+ key: "definitions",
78
+ value: s.definitions
79
+ }).value;
80
+ if (Object.keys(m).length !== a.length || Object.keys(m).some((e) => !a.some((t) => t.name === e))) return l("definition");
81
+ let h = [...a].sort((e, t) => e.name < t.name ? -1 : +(e.name > t.name)).map((e) => {
82
+ let n = m[e.name], a = n === null ? null : i(n);
83
+ return a !== null && Object.keys(a.fields).some((t) => !Object.hasOwn(e.fields, t)) ? l("definition") : t({
84
+ key: `type:${e.name}`,
85
+ value: {
86
+ version: 1,
87
+ app: c,
88
+ contentType: e.name,
89
+ definition: a,
90
+ schemaDigest: u(r(e, c).value)
91
+ }
92
+ });
93
+ }), g = f(s.referenceTypes, a.map((e) => e.name));
94
+ if (g.some((e) => !Object.hasOwn(m, e) || m[e] === null)) return l("definition");
95
+ let _ = p(s.referenceRoutes, a.map((e) => e.name)), v = d(s.trees, a);
96
+ for (let [t, n] of Object.entries(_)) if (!e(a.find((e) => e.name === t).locations ?? []).some((e) => e.id === n)) return l("definition");
97
+ let y = t({
98
+ key: "registry",
99
+ value: {
100
+ version: 1,
101
+ app: c,
102
+ id: s.id,
103
+ ...g.length === 0 ? {} : { referenceTypes: g },
104
+ ...Object.keys(_).length === 0 ? {} : { referenceRoutes: _ },
105
+ ...Object.keys(v).length === 0 ? {} : { trees: v },
106
+ definitionDigest: u(h),
107
+ types: h.map((e) => e.value.contentType)
108
+ }
109
+ });
110
+ return {
111
+ format: "voltro.cms.field-projection/v1",
112
+ entries: function* () {
113
+ yield t(y);
114
+ for (let e of h) yield t(e);
115
+ }
116
+ };
117
+ };
118
+ //#endregion
119
+ export { c as SnapshotProjectionUnavailable, p as copySnapshotReferenceRoutes, f as copySnapshotReferenceTypes, d as copySnapshotTrees, m as snapshotProjectionSource };
@@ -0,0 +1,161 @@
1
+ import { compileSiteDelivery as e } from "./siteDelivery.js";
2
+ import { readCapturedDocument as t, verifyPublicationState as n } from "./publicationState.js";
3
+ import { copySnapshotResource as r, readVerifiedSnapshotResource as i, verifyBuildSnapshot as a } from "./buildSnapshot.js";
4
+ import { copySnapshotAppCodePin as o, snapshotContentTypeDefinition as s } from "./snapshotDefinitions.js";
5
+ import { copySnapshotConsentPurposes as c } from "./snapshotPresentation.js";
6
+ import { Schema as l } from "effect";
7
+ import { createHash as u } from "node:crypto";
8
+ import { canonicalJson as d } from "@voltro/runtime";
9
+ //#region src/snapshotPublicAccess.ts
10
+ var f = class extends l.TaggedError()("SnapshotPublicAccessUnavailable", { reason: l.Literals([
11
+ "definition",
12
+ "binding",
13
+ "scope",
14
+ "publication",
15
+ "bounds"
16
+ ]) }) {}, p = (e) => {
17
+ throw new f({ reason: e });
18
+ }, m = (e) => u("sha256").update(d(e)).digest("hex"), h = (e) => typeof e == "object" && !!e && !Array.isArray(e), g = (e) => typeof e == "string" && e.length > 0 && e.length <= 256 && !/[\x00-\x1f\x7f]/.test(e), _ = (e) => h(e) ? e.kind === "public" || e.kind === "deny" ? Object.keys(e).length === 1 ? { kind: e.kind } : p("definition") : e.kind !== "field" || Object.keys(e).length !== 4 || !g(e.field) || !Array.isArray(e.values) || e.values.length === 0 || e.values.length > 64 || !e.values.every(g) || new Set(e.values).size !== e.values.length || e.missing !== "public" && e.missing !== "deny" ? p("definition") : {
19
+ kind: "field",
20
+ field: e.field,
21
+ values: [...e.values].sort(),
22
+ missing: e.missing
23
+ } : p("definition"), v = (e, t) => {
24
+ if (e.kind !== "field") return;
25
+ let n = Object.hasOwn(t, e.field) ? t[e.field] : void 0;
26
+ if (!h(n) || !["string", "literal"].includes(String(n.kind))) return p("definition");
27
+ let r = n.literals;
28
+ if (n.kind === "literal" && (!Array.isArray(r) || e.values.some((e) => !r.includes(e)))) return p("definition");
29
+ }, y = (e, t, n, i = []) => {
30
+ let a = o(t), l = r({
31
+ key: "configuration",
32
+ value: {
33
+ version: 2,
34
+ app: a,
35
+ consentPurposes: c(i)
36
+ }
37
+ }), u = r({
38
+ key: "definitions",
39
+ value: n
40
+ }).value;
41
+ if (e.length === 0 || new Set(e.map((e) => e.name)).size !== e.length || Object.keys(u).length !== e.length || Object.keys(u).some((t) => !e.some((e) => e.name === t))) return p("definition");
42
+ let d = [...e].sort((e, t) => e.name < t.name ? -1 : +(e.name > t.name)).map((e) => {
43
+ let t = _(u[e.name]);
44
+ return v(t, e.fields), r({
45
+ key: `type:${e.name}`,
46
+ value: {
47
+ version: 1,
48
+ app: a,
49
+ contentType: e.name,
50
+ decision: t,
51
+ schemaDigest: m(s(e, a).value)
52
+ }
53
+ });
54
+ }), f = r({
55
+ key: "registry",
56
+ value: {
57
+ version: 2,
58
+ app: a,
59
+ types: d.map((e) => e.value.contentType),
60
+ consentDigest: m(l),
61
+ definitionDigest: m([...d, l])
62
+ }
63
+ });
64
+ return {
65
+ format: "voltro.cms.public-access/v2",
66
+ entries: function* () {
67
+ yield r(f), yield r(l);
68
+ for (let e of d) yield r(e);
69
+ }
70
+ };
71
+ }, b = async (e, t, n, r, i, a, o = Date.now()) => x(e, t, n, r, { profile: i }, a, o), x = async (e, t, r, i, o, s, c) => {
72
+ if (![
73
+ i,
74
+ "profile" in o ? o.profile : o.exact,
75
+ s
76
+ ].every(g)) return p("scope");
77
+ let l = await a(e, t, r, c);
78
+ return w(e, t, l, await n(e, t, l.manifest.publication, c), i, o, s, c);
79
+ }, S = async (e, t, n, r, i, a, o, s) => w(e, t, n, r, i, { profile: a }, o, s), C = async (e, t, n, r, i, a, o, s) => w(e, t, n, r, i, { exact: a }, o, s), w = async (n, r, a, o, s, c, l, u) => {
80
+ if (![
81
+ s,
82
+ "profile" in c ? c.profile : c.exact,
83
+ l
84
+ ].every(g)) return p("scope");
85
+ for (let [e, t] of [
86
+ ["policies", "voltro.cms.public-access/v2"],
87
+ ["schema", "voltro.cms.schema/v1"],
88
+ ["site", "voltro.cms.site/v3"],
89
+ ["locales", "voltro.cms.locales/v1"]
90
+ ]) if (a.manifest.parts.find((t) => t.part === e)?.format !== t) return p("binding");
91
+ if (!o.types.includes(s)) return p("scope");
92
+ let f = (await i(n, r, a, "policies", `type:${s}`)).value, y = (await i(n, r, a, "schema", `type:${s}`)).value, b = (await i(n, r, a, "site", "configuration")).value, x = (await i(n, r, a, "locales", "policy")).value;
93
+ if (f.version !== 1 || y.version !== 1 || b.version !== 3 || x.version !== 1 || f.contentType !== s || f.schemaDigest !== m(y) || [
94
+ f,
95
+ b,
96
+ x
97
+ ].some((e) => d(e.app) !== d(y.app)) || [b, x].some((e) => e.tenantId !== r.tenantId || e.site !== r.site || e.environment !== r.environment) || !h(b.definition) || !h(x.definition) || x.resolution !== "per-node") return p("binding");
98
+ let S = e({
99
+ ...b.definition,
100
+ ...x.definition
101
+ }), C = {
102
+ contentLocales: S.contentLocales,
103
+ defaultLocale: S.defaultLocale,
104
+ sourceLocale: S.sourceLocale,
105
+ fallback: S.fallback,
106
+ prefixes: S.prefixes,
107
+ tags: S.tags,
108
+ directions: S.directions
109
+ };
110
+ if (S.definition.id !== r.site || !S.definition.environments.includes(r.environment) || [b, x].some((e) => e.definitionDigest !== m(S.definition)) || d(x.compiled) !== d(C) || o.locales.length !== S.contentLocales.length || o.locales.some((e) => !S.contentLocales.includes(e))) return p("binding");
111
+ let w = "profile" in c ? S.definition.locales.find((e) => e.id === c.profile && e.enabled)?.contentLocale : S.contentLocales.includes(c.exact) ? c.exact : void 0;
112
+ if (w === void 0) return p("scope");
113
+ let T = y.definition;
114
+ if (!h(T) || T.name !== s || !h(T.fields)) return p("binding");
115
+ let E = _(f.decision);
116
+ if (v(E, T.fields), E.kind === "deny") return null;
117
+ let D = T.tree, O;
118
+ if (D !== void 0) {
119
+ if (!h(D) || !g(D.parent)) return p("binding");
120
+ O = D.parent;
121
+ let e = T.fields[O];
122
+ if (!h(e) || e.kind !== "reference" || e.referenceType !== s) return p("binding");
123
+ }
124
+ let k = [], A = /* @__PURE__ */ new Set(), j = [w, ..."profile" in c ? S.fallback[w] : []], M = l;
125
+ for (;;) {
126
+ if (A.has(M)) return null;
127
+ if (A.size >= 128) return p("bounds");
128
+ A.add(M);
129
+ let e = null;
130
+ for (let i of j) if (e = await t(n, r, a.manifest.publication.id, s, i, M, u), e !== null) break;
131
+ if (e === null) return null;
132
+ if (e.status !== "published" || e.documentId !== M || ![
133
+ e.id,
134
+ e.revisionId,
135
+ e.locale
136
+ ].every(g) || !Number.isSafeInteger(e.revision) || Number(e.revision) < 1) return p("publication");
137
+ if (E.kind === "field") {
138
+ let t = e[E.field];
139
+ if (t == null) {
140
+ if (E.missing !== "public") return null;
141
+ } else if (typeof t != "string" || !E.values.includes(t)) return null;
142
+ }
143
+ k.push({
144
+ documentId: M,
145
+ variantId: String(e.id),
146
+ revisionId: String(e.revisionId),
147
+ revision: Number(e.revision),
148
+ locale: String(e.locale)
149
+ });
150
+ let i = O === void 0 ? void 0 : e[O];
151
+ if (i == null || i === "") return {
152
+ contentType: s,
153
+ requestedLocale: w,
154
+ chain: k
155
+ };
156
+ if (!g(i)) return p("publication");
157
+ M = i;
158
+ }
159
+ };
160
+ //#endregion
161
+ export { f as SnapshotPublicAccessUnavailable, b as admitSnapshotPublicDocument, S as admitVerifiedSnapshotPublicDocument, C as admitVerifiedSnapshotPublicDocumentLocale, y as snapshotPublicAccessSource };
@@ -0,0 +1,40 @@
1
+ import { publicRouteRegistryFail as e } from "./publicRouteRegistry.js";
2
+ import { copySnapshotResource as t } from "./buildSnapshot.js";
3
+ import { compileCmsPublicRouteDeclaration as n } from "./initializePublicRoutes.js";
4
+ import { readPublicRouteHistoryView as r } from "./publicRouteHistoryView.js";
5
+ import { canonicalJson as i } from "@voltro/runtime";
6
+ //#region src/snapshotPublicRouteHistory.ts
7
+ var a = (a, o, s) => {
8
+ let c = n(s);
9
+ return {
10
+ format: "voltro.cms.source-route-history/v1",
11
+ entries: async function* () {
12
+ let n = await r(a, o);
13
+ if (i(n.namespace.binding.definition) !== i(c)) return e("configuration");
14
+ yield t({
15
+ key: "configuration",
16
+ value: {
17
+ version: 1,
18
+ ...n.namespace.scope,
19
+ kind: "source-configuration",
20
+ coverage: "declared-content-source",
21
+ nativeInventory: "not-enumerated",
22
+ binding: n.namespace.binding,
23
+ currentNamespaceDigest: n.namespace.sourceDigest,
24
+ ...n.history
25
+ }
26
+ });
27
+ for await (let e of n.entries()) yield t({
28
+ key: "url:" + e.urlKey,
29
+ value: {
30
+ version: 1,
31
+ ...n.namespace.scope,
32
+ kind: "source-observed",
33
+ ...e
34
+ }
35
+ });
36
+ }
37
+ };
38
+ };
39
+ //#endregion
40
+ export { a as snapshotPublicRouteHistorySource };
@@ -0,0 +1,38 @@
1
+ import { verifyBuildSnapshot as e } from "./buildSnapshot.js";
2
+ import { Schema as t } from "effect";
3
+ //#region src/snapshotReadAdmission.ts
4
+ var n = class extends t.TaggedError()("SnapshotReadAdmissionUnavailable", { reason: t.Literals(["binding"]) }) {}, r = async (t, r, i, a) => {
5
+ let o = await e(t, r, i, a);
6
+ for (let [e, t] of Object.entries({
7
+ policies: "voltro.cms.public-access/v2",
8
+ projection: "voltro.cms.field-projection/v1",
9
+ routes: "voltro.cms.content-routes/v4",
10
+ domains: "voltro.cms.domains/v1",
11
+ schema: "voltro.cms.schema/v1",
12
+ components: "voltro.cms.components/v1",
13
+ assets: "voltro.cms.media-custody/v2",
14
+ site: "voltro.cms.site/v3",
15
+ locales: "voltro.cms.locales/v1",
16
+ seo: "voltro.cms.seo-metadata/v1"
17
+ })) if (o.manifest.parts.find((t) => t.part === e)?.format !== t) throw new n({ reason: "binding" });
18
+ return o;
19
+ }, i = async (e, t, n, i, a) => {
20
+ let o = await r(e, t, n, a);
21
+ return {
22
+ snapshot: o,
23
+ binding: {
24
+ tenantId: t.tenantId,
25
+ site: t.site,
26
+ environment: t.environment,
27
+ consumerId: i.consumerId,
28
+ buildId: i.buildId,
29
+ snapshotId: o.id,
30
+ snapshotDigest: o.digest,
31
+ releaseId: o.manifest.publication.releaseId,
32
+ policyDigest: o.manifest.parts.find((e) => e.part === "policies").digest,
33
+ projectionDigest: o.manifest.parts.find((e) => e.part === "projection").digest
34
+ }
35
+ };
36
+ };
37
+ //#endregion
38
+ export { n as SnapshotReadAdmissionUnavailable, r as readAdmittedBuildSnapshot, i as resolveSnapshotReadBinding };
@@ -0,0 +1,151 @@
1
+ import { lockSiteState as e } from "./siteState.js";
2
+ import { routeDispositionFail as t } from "./routeDispositions.js";
3
+ import { lockOutputRouteHistoryCapture as n } from "./outputActivationStore.js";
4
+ import { copySnapshotSeoDocumentsSelection as r } from "./snapshotSeoPathSets.js";
5
+ import { readSnapshotSeoDocuments as i, snapshotOutputSafetyBinding as a } from "./snapshotSeoDocuments.js";
6
+ import { copyOutputSafetySelection as o, readVerifiedOutputSafetyArtifact as s } from "./outputSafetyArtifact.js";
7
+ import { readSnapshotRouteDispositionPlan as c } from "./snapshotRouteDispositionPlan.js";
8
+ import { copySnapshotRedirectTargets as l } from "./snapshotRedirectTargets.js";
9
+ import { createHash as u } from "node:crypto";
10
+ import { canonicalJson as d } from "@voltro/runtime";
11
+ //#region src/snapshotRedirectOutput.ts
12
+ var f = (u, d, f, p, m) => {
13
+ let h = {
14
+ tenantId: d.tenantId,
15
+ site: d.site,
16
+ environment: d.environment
17
+ }, g = {
18
+ snapshot: {
19
+ id: f.id,
20
+ digest: f.digest
21
+ },
22
+ token: p.token,
23
+ consumerId: p.consumerId,
24
+ buildId: p.buildId,
25
+ host: p.host
26
+ }, _ = r(p.documents), v = o(p.safety), y = l(p.targets, g.host), b = m.keys.map((e) => ({
27
+ id: e.id,
28
+ material: new Uint8Array(e.material)
29
+ })), x = typeof m.declaration == "function" ? m.declaration.bind(m) : m.declaration, S = { ...m.use }, C = m.now ?? Date.now;
30
+ if (!Number.isSafeInteger(m.maxBytes) || m.maxBytes < 1) return t("bounds");
31
+ let w = Math.min(m.maxBytes, 67108864);
32
+ return {
33
+ read: async () => {
34
+ let r, o, l, d = await s(u, h, v.artifactId, {
35
+ provider: m.provider,
36
+ maxBytes: w,
37
+ admit: async (s) => {
38
+ let u = await n(s, h);
39
+ await e(s, h);
40
+ let d = await i(s, h, g, _, {
41
+ provider: m.provider,
42
+ use: S,
43
+ keys: b,
44
+ now: C
45
+ }), f = [d];
46
+ for (let e of y) f.push(await i(s, h, {
47
+ ...g,
48
+ host: e.host
49
+ }, e.documents, {
50
+ provider: m.provider,
51
+ use: S,
52
+ keys: b,
53
+ now: C
54
+ }));
55
+ let p = f.flatMap((e) => e.paths.entries), v = f.flatMap((e) => e.paths.contexts);
56
+ if (o = f.flatMap((e) => e.inventory.records), p.length > 1e5 || o.length > 1e5) return t("bounds");
57
+ l = f.map((e) => ({
58
+ host: e.paths.admission.admission.input.host,
59
+ artifactId: e.paths.selection.artifactId,
60
+ pathSetIds: e.inventory.pathSetIds
61
+ })).sort((e, t) => e.host < t.host ? -1 : +(e.host > t.host));
62
+ let w = d.paths.admission.app, T = typeof x == "function" ? x({
63
+ inputsId: w.inputsId,
64
+ executionId: w.executionId,
65
+ code: { ...w.app },
66
+ routeDiscovery: structuredClone(w.routes.value)
67
+ }) : x;
68
+ return r = await c(s, h, {
69
+ admission: d.paths.admission.admission,
70
+ site: d.paths.admission.site,
71
+ entries: p,
72
+ contexts: v
73
+ }, T, u, C()), a(d);
74
+ }
75
+ });
76
+ if (r === void 0 || o === void 0 || l === void 0) return t("state");
77
+ let f = new Set(d.entries.filter((e) => e.target.kind === "url").map((e) => e.target.kind === "url" ? e.target.url : "")), p = new Set(d.entries.filter((e) => e.target.kind === "asset").map((e) => e.target.kind === "asset" ? e.target.digest : ""));
78
+ for (let e of o) e.media.some((e) => p.has(e.digest)) && f.add(e.url);
79
+ for (let e of r.definitions) if (f.has(e.source.url) || e.action.kind === "redirect" && f.has(e.action.target.url)) return t("graph");
80
+ return {
81
+ ...r,
82
+ binding: d.binding,
83
+ targetDocuments: l,
84
+ safety: {
85
+ artifactId: d.artifactId,
86
+ generation: d.generation,
87
+ safetyDigest: d.safetyDigest
88
+ }
89
+ };
90
+ },
91
+ place: h,
92
+ budget: w
93
+ };
94
+ }, p = (e, t) => ({
95
+ version: 2,
96
+ profile: "voltro.cms.snapshot-redirect-output/v2",
97
+ kind: "redirects",
98
+ ...t,
99
+ ...e.binding,
100
+ targetDocuments: e.targetDocuments,
101
+ safety: e.safety,
102
+ routeState: e.routeState,
103
+ count: e.definitions.length
104
+ }), m = async (...e) => {
105
+ let n = e[4], { read: r, place: i, budget: a } = f(...e), o = await r(), s = Buffer.from(d({
106
+ version: 1,
107
+ definitions: o.definitions
108
+ }) + "\n", "utf8");
109
+ if (s.length > a) return t("bounds");
110
+ let c;
111
+ try {
112
+ if (c = await n.provider.begin(), await c.write({
113
+ path: "redirects.json",
114
+ contentType: "application/json",
115
+ size: s.length,
116
+ digest: u("sha256").update(s).digest("hex")
117
+ }, (async function* () {
118
+ yield s;
119
+ })()), d(await r()) !== d(o)) return t("state");
120
+ let e = await c.seal(p(o, i));
121
+ return /^[a-f0-9]{64}$/.test(e.id) ? {
122
+ artifactId: e.id,
123
+ count: o.definitions.length
124
+ } : t("state");
125
+ } catch (e) {
126
+ throw c !== void 0 && await Promise.allSettled([c.abort()]), e;
127
+ }
128
+ }, h = async (e, n, r, i, a) => {
129
+ let o = i.id, s = f(e, n, r, i, a);
130
+ if (!/^[a-f0-9]{64}$/.test(o) || a.provider.read === void 0) return t("state");
131
+ let c = a.provider.read.bind(a.provider), l = await s.read(), m = Buffer.from(d({
132
+ version: 1,
133
+ definitions: l.definitions
134
+ }) + "\n", "utf8");
135
+ if (m.length > s.budget) return t("bounds");
136
+ let h = {
137
+ version: 1,
138
+ subject: p(l, s.place),
139
+ files: [{
140
+ path: "redirects.json",
141
+ contentType: "application/json",
142
+ size: m.length,
143
+ digest: u("sha256").update(m).digest("hex")
144
+ }]
145
+ };
146
+ if (u("sha256").update(d(h)).digest("hex") !== o) return t("state");
147
+ let g = await c(o);
148
+ return g.id !== o || d(g.manifest) !== d(h) || d(await s.read()) !== d(l) ? t("state") : structuredClone(g);
149
+ };
150
+ //#endregion
151
+ export { h as readSnapshotRedirectOutputArtifact, m as renderSnapshotRouteDispositions };
@@ -0,0 +1,24 @@
1
+ import { normalizeHost as e } from "./domainHost.js";
2
+ import { copySnapshotResource as t } from "./buildSnapshot.js";
3
+ import { routeDispositionFail as n } from "./routeDispositions.js";
4
+ import { copySnapshotSeoDocumentsSelection as r } from "./snapshotSeoPathSets.js";
5
+ //#region src/snapshotRedirectTargets.ts
6
+ var i = (i, a) => {
7
+ if (e(a) !== a) return n("input");
8
+ let o = t({
9
+ key: "redirect-targets",
10
+ value: { targets: i }
11
+ }).value.targets;
12
+ if (!Array.isArray(o) || o.length > 255) return n("bounds");
13
+ let s = "";
14
+ return o.map((t) => {
15
+ if (typeof t != "object" || !t || Array.isArray(t) || Object.keys(t).sort().join(",") !== "documents,host") return n("input");
16
+ let i = t, o = i.host;
17
+ return typeof o != "string" || e(o) !== o || o === a || o <= s ? n("input") : (s = o, {
18
+ host: o,
19
+ documents: r(i.documents)
20
+ });
21
+ });
22
+ };
23
+ //#endregion
24
+ export { i as copySnapshotRedirectTargets };