@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,185 @@
1
+ import { readCapturedPublication as e, verifyPublicationState as t } from "./publicationState.js";
2
+ import { readBuildSnapshot as n, readVerifiedSnapshotResource as r } from "./buildSnapshot.js";
3
+ import { admitVerifiedSnapshotPublicDocumentLocale as i } from "./snapshotPublicAccess.js";
4
+ import { pinAssetRevision as a } from "./assetRevision.js";
5
+ import { verifyRenderReadGrant as o } from "./renderReadGrant.js";
6
+ import { readSnapshotRouteContext as s } from "./snapshotRouteRead.js";
7
+ import { readSnapshotBindingContext as c } from "./snapshotBindingRead.js";
8
+ import { readSnapshotReferenceContext as l } from "./snapshotReferenceRead.js";
9
+ import { AssetUseRightsUnavailable as u, assertCurrentAssetUseRights as d, assetRightsFields as f } from "./assetUseRights.js";
10
+ import { Effect as p, Schema as m, Stream as h } from "effect";
11
+ import { createHash as g } from "node:crypto";
12
+ import { canonicalJson as _ } from "@voltro/runtime";
13
+ //#region src/snapshotMediaRead.ts
14
+ var v = class extends m.TaggedError()("SnapshotMediaReadUnavailable", { reason: m.Literals([
15
+ "input",
16
+ "route",
17
+ "projection",
18
+ "binding",
19
+ "asset",
20
+ "rights",
21
+ "selection",
22
+ "admission",
23
+ "bounds"
24
+ ]) }) {}, y = (e) => {
25
+ throw new v({ reason: e });
26
+ }, b = (e) => g("sha256").update(_(e)).digest("hex"), x = (e) => typeof e != "object" || !e || Array.isArray(e) ? y("binding") : e, S = (e) => typeof e == "string" && e.length > 0 && e.length <= 128 && !/[\x00-\x1f\x7f]/.test(e), C = async (...e) => {
27
+ try {
28
+ await d(...e);
29
+ } catch (e) {
30
+ if (e instanceof u) return y(e.reason);
31
+ throw e;
32
+ }
33
+ }, w = async (s, c, l, u, d, m, g, w) => {
34
+ let T = {
35
+ tenantId: l.tenantId,
36
+ site: l.site,
37
+ environment: l.environment
38
+ }, E = {
39
+ id: u.id,
40
+ digest: u.digest
41
+ }, D = { ...d }, O = g.keys.map((e) => ({
42
+ id: e.id,
43
+ material: new Uint8Array(e.material)
44
+ })), k = {
45
+ territory: g.use.territory,
46
+ channel: g.use.channel,
47
+ purpose: g.use.purpose
48
+ }, A = g.maxBytes, j = g.now ?? Date.now;
49
+ if (!Object.values(k).every((e) => e === null || S(e) && e.trim() === e) || k.territory !== null && !/^[A-Za-z]{2}$/.test(k.territory) || !Number.isSafeInteger(A) || A < 0 || !Array.isArray(m) || m.length === 0 || m.length > 1024) return y("input");
50
+ let M = m.map((e) => !Array.isArray(e.fieldPath) || e.fieldPath.length === 0 || e.fieldPath.length > 128 || !e.fieldPath.every((e) => typeof e == "string" ? S(e) : Number.isSafeInteger(e) && e >= 0) || !e.output || !["original", "rendition"].includes(e.output.kind) || e.output.kind === "rendition" && !S(e.output.slot) ? y("input") : {
51
+ path: [...e.fieldPath],
52
+ output: { ...e.output }
53
+ });
54
+ return (await s.transactional(async (s) => {
55
+ let c = j(), l = await w(s, T, E, D, {
56
+ keys: O,
57
+ now: c
58
+ });
59
+ if (l === null) return y("route");
60
+ let u = async ({ path: c, output: u }, d) => {
61
+ if ((await n(s, T, E.id, d)).digest !== E.digest) return y("binding");
62
+ await o(s, D.token, l.binding, {
63
+ keys: O,
64
+ now: d
65
+ });
66
+ let p = await t(s, T, l.snapshot.manifest.publication, d), m = l.output.values;
67
+ for (let e of c) {
68
+ if (typeof m != "object" || !m || !Object.hasOwn(m, e) || (Array.isArray(m) ? typeof e != "number" : typeof e != "string")) return y("projection");
69
+ m = m[e];
70
+ }
71
+ if (!S(m)) return y("projection");
72
+ let { snapshot: h, document: g } = l, v = (await r(s, T, h, "assets", `media-use:${b([
73
+ l.output.contentType,
74
+ g.variantId,
75
+ c
76
+ ])}`)).value;
77
+ if (v.version !== 1 || v.tenantId !== T.tenantId || v.site !== T.site || v.environment !== T.environment || v.publicationId !== h.manifest.publication.id || v.contentType !== l.output.contentType || v.variantId !== g.variantId || v.documentId !== g.documentId || v.revisionId !== g.revisionId || v.revision !== g.revision || v.locale !== g.locale || _(v.path) !== _(c) || !S(v.mediaKey)) return y("binding");
78
+ let w, j = {}, M = !1;
79
+ if (v.assetRevision !== void 0) {
80
+ let t = x(v.assetRevision);
81
+ if (![
82
+ t.contentType,
83
+ t.variantId,
84
+ t.locale,
85
+ t.documentId
86
+ ].every(S)) return y("asset");
87
+ let n = (await r(s, T, h, "schema", `type:${String(t.contentType)}`)).value, o = await e(s, T, h.manifest.publication.id, String(t.contentType), String(t.locale), String(t.variantId), d);
88
+ if (o === null) return y("asset");
89
+ let c = x(n.definition);
90
+ if (w = a(T, c, b(n), o), _(w) !== _(t) || w.fileRefId !== v.mediaKey) return y("asset");
91
+ let l = await i(s, T, h, p, w.contentType, w.locale, w.documentId, d);
92
+ if (l?.chain[0]?.variantId !== w.variantId || l.chain[0].revisionId !== w.revisionId) return y("asset");
93
+ if (c.availability !== void 0) {
94
+ M = !0;
95
+ let e = x(c.availability), t = x(c.fields);
96
+ for (let [n, r] of Object.entries(e)) {
97
+ if (!Object.hasOwn(f, n) || !S(r) || !Object.hasOwn(t, r)) return y("binding");
98
+ let e = o[r] ?? null;
99
+ j[f[n]] = n === "territories" && Array.isArray(e) ? e.map((e) => typeof e == "string" ? e.trim().toUpperCase() : e) : e;
100
+ }
101
+ }
102
+ await C(s, T, w, j, M, k, d);
103
+ }
104
+ if ((v.placement === void 0 ? v.mediaKey : w?.documentId) !== m) return y("projection");
105
+ let N = v.binaryKey, P = v.mediaKey;
106
+ if (u.kind === "rendition") {
107
+ if (!Array.isArray(v.renditions) || w === void 0) return y("selection");
108
+ let e = v.renditions.map(x).filter((e) => x(e.selection).slot === u.slot);
109
+ if (e.length !== 1) return y("selection");
110
+ let t = e[0], n = x(t.selection), r = x(t.rendition);
111
+ if (n.versionId !== w.versionId || x(r.asset).versionId !== w.versionId || n.renditionId !== r.id) return y("binding");
112
+ N = t.binaryKey, P = x(r.output).id;
113
+ }
114
+ if (typeof N != "string" || !N.startsWith("binary:") || !S(P)) return y("binding");
115
+ let F = (await r(s, T, h, "assets", N)).value, I = x(F.object);
116
+ if (F.version !== 1 || I.version !== 1 || I.tenantId !== T.tenantId || I.sourceId !== P || F.binaryId !== b([
117
+ "cms-binary/v1",
118
+ T.tenantId,
119
+ I.checksum,
120
+ I.size,
121
+ I.contentType
122
+ ]) || !Number.isSafeInteger(I.size) || I.size < 0) return y("binding");
123
+ if (I.size > A) return y("bounds");
124
+ let L = (await r(s, T, h, "assets", "custody")).value;
125
+ return L.version === 1 ? {
126
+ context: l,
127
+ asset: w,
128
+ capturedRights: j,
129
+ requireRecord: M,
130
+ member: I,
131
+ capture: L.capture,
132
+ binaryId: String(F.binaryId)
133
+ } : y("binding");
134
+ }, d = [];
135
+ for (let e = 0; e < M.length; e++) d.push(await u(M[e], e === 0 ? c : j()));
136
+ return d;
137
+ })).map((e) => {
138
+ let t = p.tryPromise({
139
+ try: () => s.transactional(async (t) => {
140
+ let r = j();
141
+ if ((await n(t, T, E.id, r)).digest !== E.digest) return y("binding");
142
+ await o(t, D.token, e.context.binding, {
143
+ keys: O,
144
+ now: r
145
+ }), e.asset !== void 0 && await C(t, T, e.asset, e.capturedRights, e.requireRecord, k, r);
146
+ }),
147
+ catch: (e) => e instanceof v ? e : new v({ reason: "admission" })
148
+ }), r = h.unwrap(p.gen(function* () {
149
+ return yield* t, (yield* c.read(e.capture, e.member, {
150
+ tenantId: T.tenantId,
151
+ maxBytes: A
152
+ })).stream.pipe(h.tap(() => t), h.concat(h.fromEffect(t.pipe(p.map(() => /* @__PURE__ */ new Uint8Array())))));
153
+ })), i = {
154
+ version: 1,
155
+ asset: e.asset === void 0 ? null : {
156
+ contentType: e.asset.contentType,
157
+ documentId: e.asset.documentId,
158
+ versionId: e.asset.versionId
159
+ },
160
+ captured: Object.fromEntries(Object.entries(e.capturedRights).map(([e, t]) => [e, t instanceof Date ? t.toISOString() : t])),
161
+ requireRecord: e.requireRecord,
162
+ use: { ...k }
163
+ };
164
+ return {
165
+ snapshotId: e.context.snapshot.id,
166
+ snapshotDigest: e.context.snapshot.digest,
167
+ routeId: e.context.routeId,
168
+ binaryId: e.binaryId,
169
+ assetVersionId: e.asset?.versionId ?? null,
170
+ rights: i,
171
+ checksum: e.member.checksum,
172
+ contentType: e.member.contentType,
173
+ size: e.member.size,
174
+ stream: r
175
+ };
176
+ });
177
+ }, T = async (...e) => {
178
+ let t = await s(...e);
179
+ return t === null ? null : {
180
+ ...t,
181
+ routeId: t.output.routeId
182
+ };
183
+ }, E = (e, t, n, r, i, a, o) => w(e, t, n, r, i, a, o, T), D = (e, t, n, r, i, a, o) => w(e, t, n, r, i, a, o, c), O = (e, t, n, r, i, a, o) => w(e, t, n, r, i, a, o, l);
184
+ //#endregion
185
+ export { v as SnapshotMediaReadUnavailable, D as readSnapshotBindingMediaBatch, O as readSnapshotReferenceMediaBatch, E as readSnapshotRouteMediaBatch };
@@ -0,0 +1,13 @@
1
+ import { createFrontendMediaReader as e } from "./frontendMedia.js";
2
+ import { snapshotObserver as t, snapshotProjectedValue as n } from "./snapshotObservation.js";
3
+ //#region src/snapshotMediaReader.ts
4
+ var r = (r, i, a = { kind: "original" }) => {
5
+ let o = t(r), s = n(r, i);
6
+ if (typeof s != "string" || s === "") throw Error("Snapshot media occurrence unavailable");
7
+ return e(r.media, [], (e) => o({
8
+ kind: "media",
9
+ ...e
10
+ }))(i, a);
11
+ };
12
+ //#endregion
13
+ export { r as snapshotMedia };
@@ -0,0 +1,16 @@
1
+ //#region src/snapshotObservation.ts
2
+ var e = (e) => {
3
+ let t = Object.getOwnPropertyDescriptor(e, Symbol.for("voltro.cms.snapshot.observe/v1"));
4
+ if (t === void 0 || t.enumerable || t.writable || typeof t.value != "function") throw Error("Snapshot observation unavailable");
5
+ return t.value;
6
+ }, t = (e, t) => {
7
+ let n = e.values;
8
+ if (t.length === 0 || t.length > 128) throw Error("Snapshot occurrence unavailable");
9
+ for (let e of t) {
10
+ if (typeof n != "object" || !n || !Object.hasOwn(n, e) || (Array.isArray(n) ? typeof e != "number" : typeof e != "string")) throw Error("Snapshot occurrence unavailable");
11
+ n = n[e];
12
+ }
13
+ return n;
14
+ };
15
+ //#endregion
16
+ export { e as snapshotObserver, t as snapshotProjectedValue };
@@ -0,0 +1,34 @@
1
+ import { copyOutputActivationScope as e } from "./outputActivation.js";
2
+ import { verifyPublicationState as t } from "./publicationState.js";
3
+ import { copySnapshotResource as n } from "./buildSnapshot.js";
4
+ import { iterateRouteHistory as r, readRouteHistoryPage as i } from "./routeHistoryStore.js";
5
+ //#region src/snapshotObservedRouteHistory.ts
6
+ var a = (a, o, s = Date.now()) => {
7
+ let c = e(o);
8
+ return {
9
+ format: "voltro.cms.observed-route-history/v1",
10
+ entries: async function* (e) {
11
+ await t(a, c, e, s);
12
+ let { entries: o, next: l, ...u } = await i(a, c, { take: 1 });
13
+ yield n({
14
+ key: "configuration",
15
+ value: {
16
+ version: 1,
17
+ ...c,
18
+ status: u.revision === 0 ? "uninitialized" : "observed",
19
+ ...u
20
+ }
21
+ });
22
+ for await (let e of r(a, c, u.revision)) yield n({
23
+ key: "url:" + e.urlKey,
24
+ value: {
25
+ version: 1,
26
+ ...c,
27
+ ...e
28
+ }
29
+ });
30
+ }
31
+ };
32
+ };
33
+ //#endregion
34
+ export { a as snapshotObservedRouteHistorySource };
@@ -0,0 +1,78 @@
1
+ import { SnapshotSeoReadUnavailable as e } from "./snapshotSeoRead.js";
2
+ import { createHash as t } from "node:crypto";
3
+ import { canonicalJson as n } from "@voltro/protocol";
4
+ //#region src/snapshotOutputTransfer.ts
5
+ var r = () => {
6
+ throw new e({ reason: "binding" });
7
+ }, i = (e) => t("sha256").update(e).digest("hex"), a = 65536, o = (e) => (t, a) => e(t, async (e) => {
8
+ let t = structuredClone(e), o = Buffer.from(n(t.manifest));
9
+ return t.manifest.version !== 1 || i(o) !== t.id || t.manifest.files.length > 1e5 || o.byteLength > 67108864 ? r() : a(t);
10
+ }), s = (e, t) => {
11
+ let s = e.planFile?.bind(e), c = e.readChunk?.bind(e), l = o(t), u = async (e, t) => {
12
+ let i = e.manifest.files.filter((e) => e.path === t);
13
+ if (i.length !== 1 || s === void 0) return r();
14
+ let o = i[0], c = await s({
15
+ id: e.id,
16
+ path: t
17
+ });
18
+ return n(c.file) !== n(o) || c.chunks.length !== Math.max(1, Math.ceil(o.size / a)) || Object.keys(c.chunks).length !== c.chunks.length || c.chunks.some((e, t) => e.offset !== t * a || e.size !== Math.min(a, o.size - e.offset) || !/^[a-f0-9]{64}$/.test(e.digest)) ? r() : structuredClone(c);
19
+ };
20
+ return {
21
+ read: (e) => l(e, async (e) => e),
22
+ planFile: (e) => {
23
+ let t = e.path;
24
+ return l(e, (e) => u(e, t));
25
+ },
26
+ readChunk: (e) => {
27
+ let t = { ...e.file }, o = { ...e.chunk };
28
+ return l(e, async (e) => {
29
+ let s = await u(e, t.path);
30
+ if (c === void 0 || n(s.file) !== n(t) || !s.chunks.some((e) => n(e) === n(o))) return r();
31
+ let l = await c({
32
+ id: e.id,
33
+ file: s.file,
34
+ chunk: o
35
+ });
36
+ if (!(l instanceof Uint8Array) || l.byteLength !== o.size || l.byteLength > a) return r();
37
+ let d = new Uint8Array(l);
38
+ return i(d) === o.digest ? d : r();
39
+ });
40
+ }
41
+ };
42
+ }, c = (t, s) => {
43
+ let c = o(s), l = t.readChunk?.bind(t);
44
+ return (t) => {
45
+ let o = structuredClone(t.files);
46
+ if (!Array.isArray(o) || o.length === 0 || o.length > 200 || Object.keys(o).length !== o.length) return Promise.reject(new e({ reason: "binding" }));
47
+ let s = 0, u = /* @__PURE__ */ new Set();
48
+ for (let t of o) {
49
+ if (typeof t != "object" || !t || u.has(t.path) || !Number.isSafeInteger(t.size) || t.size < 0 || (s += t.size) > a) return Promise.reject(new e({ reason: "binding" }));
50
+ u.add(t.path);
51
+ }
52
+ return c(t, async (e) => {
53
+ if (l === void 0 || o.some((t) => {
54
+ let r = e.manifest.files.filter((e) => e.path === t.path);
55
+ return r.length !== 1 || n(r[0]) !== n(t);
56
+ })) return r();
57
+ let t = [];
58
+ for (let n of o) {
59
+ let a = await l({
60
+ id: e.id,
61
+ file: { ...n },
62
+ chunk: {
63
+ offset: 0,
64
+ size: n.size,
65
+ digest: n.digest
66
+ }
67
+ });
68
+ if (!(a instanceof Uint8Array) || a.byteLength !== n.size) return r();
69
+ let o = new Uint8Array(a);
70
+ if (i(o) !== n.digest) return r();
71
+ t.push(o);
72
+ }
73
+ return new Uint8Array(Buffer.concat(t, s));
74
+ });
75
+ };
76
+ };
77
+ //#endregion
78
+ export { c as createSnapshotOutputBatch, s as createSnapshotOutputTransfer };
@@ -0,0 +1,7 @@
1
+ //#region src/snapshotPageLoader.ts
2
+ var e = async (e) => {
3
+ if (e.query === void 0) throw Error("Snapshot delivery unavailable");
4
+ return e.query("cms.snapshot.route", { path: e.pathname });
5
+ };
6
+ //#endregion
7
+ export { e as snapshotPageLoader };
@@ -0,0 +1,59 @@
1
+ //#region src/snapshotPageSeo.ts
2
+ var e = ({ loaderData: e }) => {
3
+ let t = e.seo, n = t.structuredData, r = [
4
+ {
5
+ name: "robots",
6
+ content: `${t.robots.index ? "index" : "noindex"}, ${t.robots.follow ? "follow" : "nofollow"}`
7
+ },
8
+ {
9
+ property: "og:type",
10
+ content: n !== null && n.type !== "WebPage" ? "article" : "website"
11
+ },
12
+ {
13
+ property: "og:locale",
14
+ content: t.languageTag.replaceAll("-", "_")
15
+ }
16
+ ];
17
+ return t.social.title !== null && r.push({
18
+ property: "og:title",
19
+ content: t.social.title
20
+ }), t.social.description !== null && r.push({
21
+ property: "og:description",
22
+ content: t.social.description
23
+ }), t.social.image !== void 0 && r.push({
24
+ property: "og:image",
25
+ content: t.social.image.url
26
+ }, {
27
+ property: "og:image:type",
28
+ content: t.social.image.contentType
29
+ }), t.canonical !== null && r.push({
30
+ property: "og:url",
31
+ content: t.canonical
32
+ }), {
33
+ ...t.title === null ? {} : { title: t.title },
34
+ ...t.description === null ? {} : { description: t.description },
35
+ ...t.canonical === null ? {} : { canonical: t.canonical },
36
+ tags: r,
37
+ links: [...t.alternates.map((e) => ({
38
+ rel: "alternate",
39
+ hreflang: e.locale,
40
+ href: e.href
41
+ })), ...t.xDefault === null ? [] : [{
42
+ rel: "alternate",
43
+ hreflang: "x-default",
44
+ href: t.xDefault
45
+ }]],
46
+ jsonLd: n === null ? [] : [{
47
+ "@context": "https://schema.org",
48
+ "@type": n.type,
49
+ ...n.type === "WebPage" ? { name: n.title } : { headline: n.title },
50
+ ...t.canonical === null ? {} : { url: t.canonical },
51
+ inLanguage: t.languageTag,
52
+ ...t.social.image === void 0 ? {} : { image: t.social.image.url },
53
+ ...n.description === null ? {} : { description: n.description },
54
+ ...n.datePublished === null ? {} : { datePublished: n.datePublished }
55
+ }]
56
+ };
57
+ };
58
+ //#endregion
59
+ export { e as snapshotPageMeta };
@@ -0,0 +1,15 @@
1
+ import { SnapshotRouteReadUnavailable as e } from "./snapshotRouteAdmission.js";
2
+ //#region src/snapshotPathLocale.ts
3
+ var t = (t, n) => {
4
+ let r;
5
+ try {
6
+ r = decodeURI(n).normalize("NFC");
7
+ } catch {
8
+ throw new e({ reason: "path" });
9
+ }
10
+ let i = t.locales.filter((e) => e.prefix === "" || r === e.prefix || r.startsWith(e.prefix + "/")).sort((e, t) => t.prefix.length - e.prefix.length)[0];
11
+ if (i === void 0 || !i.enabled) throw new e({ reason: "path" });
12
+ return i;
13
+ };
14
+ //#endregion
15
+ export { t as snapshotPathLocale };
@@ -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 };