@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,225 @@
1
+ import { richDocumentProblems as e, richDocumentReferencePaths as t } from "./richDocument.js";
2
+ import { Schema as n } from "effect";
3
+ import { createHash as r } from "node:crypto";
4
+ import { canonicalJson as i } from "@voltro/runtime";
5
+ //#region src/snapshotMediaFields.ts
6
+ var a = class extends n.TaggedError()("SnapshotMediaUnavailable", { reason: n.Literals([
7
+ "scope",
8
+ "definition",
9
+ "publication",
10
+ "bounds",
11
+ "asset"
12
+ ]) }) {}, o = (e) => {
13
+ throw new a({ reason: e });
14
+ }, s = (e) => r("sha256").update(i(e)).digest("hex"), c = (e) => typeof e == "string" && e.length > 0, l = (e) => typeof e != "object" || !e || Array.isArray(e) ? o("definition") : e, u = (n, r) => {
15
+ let i = new Map(r.filter((e) => e.key !== "registry").map((e) => [l(e.value.definition).id, e])), a = (e, t) => Object.entries(l(e)).map(([e, n]) => [e, u(n, t)]), u = (e, t) => {
16
+ if (t > 64) return o("bounds");
17
+ let n = l(e), r = (e) => e === void 0 ? /* @__PURE__ */ new Map() : Array.isArray(e) ? new Map(e.map((e) => {
18
+ let n = l(e), r = i.get(n.id);
19
+ if (!c(n.id) || r === void 0 || s(r.value) !== n.digest) return o("definition");
20
+ let u = l(r.value.definition);
21
+ return !c(u.fingerprint) || u.consent !== void 0 && !c(u.consent) ? o("definition") : [n.id, {
22
+ fingerprint: u.fingerprint,
23
+ digest: s(r.value),
24
+ consent: typeof u.consent == "string" ? u.consent : null,
25
+ fields: a(u.props, t + 1)
26
+ }];
27
+ })) : o("definition");
28
+ switch (n.kind) {
29
+ case "media": return { kind: "media" };
30
+ case "reference": return c(n.referenceType) ? {
31
+ kind: "reference",
32
+ targetType: n.referenceType
33
+ } : o("definition");
34
+ case "array": return {
35
+ kind: "array",
36
+ element: u(n.element, t + 1)
37
+ };
38
+ case "struct": return {
39
+ kind: "struct",
40
+ fields: a(n.struct, t + 1)
41
+ };
42
+ case "components": return {
43
+ kind: "components",
44
+ components: r(n.components)
45
+ };
46
+ case "richText": {
47
+ let e = n.richText === void 0 ? {} : l(n.richText);
48
+ return {
49
+ kind: "richText",
50
+ components: r((e.profile === void 0 ? {} : l(e.profile)).components),
51
+ options: e
52
+ };
53
+ }
54
+ case "string":
55
+ case "number":
56
+ case "boolean":
57
+ case "date":
58
+ case "datetime":
59
+ case "literal": return n.token === void 0 ? { kind: "leaf" } : n.kind !== "literal" || !c(n.token) || !Array.isArray(n.literals) || !n.literals.every(c) ? o("definition") : {
60
+ kind: "leaf",
61
+ token: {
62
+ group: n.token,
63
+ names: n.literals,
64
+ digest: s(n)
65
+ }
66
+ };
67
+ default: return o("definition");
68
+ }
69
+ }, p = n.filter((e) => e.key !== "registry").map((e) => {
70
+ let t = l(e.value.definition);
71
+ return c(t.name) ? {
72
+ name: t.name,
73
+ fields: a(t.fields, 0),
74
+ definition: t,
75
+ digest: s(e.value)
76
+ } : o("definition");
77
+ }), m = function* (n, r, i) {
78
+ if (i.length > 128) return o("bounds");
79
+ if (r == null) return;
80
+ if (n.kind === "leaf") {
81
+ if (n.token !== void 0) {
82
+ if (typeof r != "string" || !n.token.names.includes(r)) return o("publication");
83
+ yield {
84
+ kind: "token",
85
+ path: i,
86
+ group: n.token.group,
87
+ name: r,
88
+ digest: n.token.digest
89
+ };
90
+ }
91
+ return;
92
+ }
93
+ if (n.kind === "reference") {
94
+ if (typeof r != "string") return o("publication");
95
+ r !== "" && (yield {
96
+ path: i,
97
+ targetType: n.targetType,
98
+ targetDocumentId: r
99
+ });
100
+ return;
101
+ }
102
+ if (n.kind === "media") {
103
+ if (typeof r != "string") return o("publication");
104
+ r !== "" && (yield {
105
+ path: i,
106
+ mediaKey: r
107
+ });
108
+ return;
109
+ }
110
+ if (n.kind === "array") {
111
+ if (!Array.isArray(r)) return o("publication");
112
+ for (let e = 0; e < r.length; e++) yield* m(n.element, r[e], [...i, e]);
113
+ return;
114
+ }
115
+ if (n.kind === "struct") {
116
+ if (typeof r != "object" || Array.isArray(r)) return o("publication");
117
+ for (let [e, t] of n.fields) yield* m(t, r[e], [...i, e]);
118
+ return;
119
+ }
120
+ if (n.kind === "richText") {
121
+ if (e("", r, n.options).length > 0 || n.options.profile !== void 0 && r.profile !== n.options.profile.id) return o("publication");
122
+ yield {
123
+ kind: "rich-document",
124
+ path: i,
125
+ digest: s(n.options)
126
+ }, yield* f(r, i, n.options);
127
+ for (let e of t(i, r, n.options)) {
128
+ let t = r;
129
+ for (let n of e.path.slice(i.length)) t = d(t, n);
130
+ let n = l(t), a = n.type === "image" || n.type === "file" ? ["asset"] : n.type === "contact" ? ["contact", "target"] : ["target"];
131
+ yield {
132
+ ...e,
133
+ path: [...e.path, ...a]
134
+ };
135
+ }
136
+ }
137
+ let a = n.kind === "richText" ? typeof r == "object" && !Array.isArray(r) ? r.blocks : void 0 : r;
138
+ if (!Array.isArray(a)) return o("publication");
139
+ for (let e = 0; e < a.length; e++) {
140
+ let t = a[e];
141
+ if (typeof t != "object" || !t || Array.isArray(t)) return o("publication");
142
+ let r = t;
143
+ if (n.kind === "richText" && r.type !== "component") {
144
+ if (![
145
+ "paragraph",
146
+ "heading",
147
+ "list",
148
+ "table",
149
+ "image",
150
+ "file"
151
+ ].includes(String(r.type))) return o("publication");
152
+ continue;
153
+ }
154
+ let s = r.props, c = typeof r.componentId == "string" ? n.components.get(r.componentId) : void 0;
155
+ if (c === void 0 || r.fingerprint !== c.fingerprint || typeof s != "object" || !s || Array.isArray(s)) return o("publication");
156
+ let l = n.kind === "richText" ? [
157
+ ...i,
158
+ "blocks",
159
+ e,
160
+ "props"
161
+ ] : [
162
+ ...i,
163
+ e,
164
+ "props"
165
+ ];
166
+ yield {
167
+ kind: "component",
168
+ path: l.slice(0, -1),
169
+ componentId: String(r.componentId),
170
+ digest: c.digest,
171
+ fingerprint: c.fingerprint,
172
+ consent: c.consent
173
+ };
174
+ for (let [e, t] of c.fields) yield* m(t, s[e], [...l, e]);
175
+ }
176
+ };
177
+ return p.map((e) => ({
178
+ name: e.name,
179
+ definition: e.definition,
180
+ digest: e.digest,
181
+ uses: function* (t) {
182
+ for (let [n, r] of e.fields) for (let e of m(r, t[n], [n])) "kind" in e || (yield e);
183
+ },
184
+ dependencies: function* (t) {
185
+ for (let [n, r] of e.fields) for (let e of m(r, t[n], [n])) "kind" in e && (yield e);
186
+ }
187
+ }));
188
+ }, d = (e, t) => typeof e != "object" || !e || !Object.hasOwn(e, t) ? o("publication") : e[t], f = function* (e, t, n) {
189
+ let r = n.profile?.styles;
190
+ if (r === void 0) return;
191
+ let i = function* (e, t) {
192
+ e !== void 0 && (yield {
193
+ kind: "token",
194
+ path: [...t, "style"],
195
+ group: r.group,
196
+ name: e,
197
+ digest: s(r)
198
+ });
199
+ }, a = function* (e, t) {
200
+ for (let n = 0; n < e.length; n++) {
201
+ let r = e[n];
202
+ r.type === "text" && (yield* i(r.style, [...t, n]));
203
+ }
204
+ };
205
+ for (let n = 0; n < e.blocks.length; n++) {
206
+ let r = e.blocks[n], o = [
207
+ ...t,
208
+ "blocks",
209
+ n
210
+ ];
211
+ if ((r.type === "paragraph" || r.type === "heading" || r.type === "list") && (yield* i(r.style, o)), (r.type === "paragraph" || r.type === "heading") && (yield* a(r.content, [...o, "content"])), r.type === "list") for (let e = 0; e < r.items.length; e++) yield* a(r.items[e], [
212
+ ...o,
213
+ "items",
214
+ e
215
+ ]);
216
+ if (r.type === "table") for (let e = 0; e < r.rows.length; e++) for (let t = 0; t < r.rows[e].length; t++) yield* a(r.rows[e][t], [
217
+ ...o,
218
+ "rows",
219
+ e,
220
+ t
221
+ ]);
222
+ }
223
+ };
224
+ //#endregion
225
+ export { a as SnapshotMediaUnavailable, u as compileSnapshotMediaFields };
@@ -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 };