@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,224 @@
1
+ import { asTyped as e } from "./effectForm.js";
2
+ import { and as t, eq as n, id as r, integer as i, table as a, text as o, timestamp as s } from "@voltro/database";
3
+ import { tenant as c } from "@voltro/plugin-multitenancy/mixin";
4
+ import { createHash as l, randomBytes as u } from "node:crypto";
5
+ //#region src/collections.ts
6
+ var d = "cms_collections", f = "cms_collection_items", p = "cms_collection_portals", m = 90, h = a(d, {
7
+ id: r({ prefix: "ccol" }),
8
+ site: o().maxLength(64),
9
+ environment: o().maxLength(64),
10
+ name: o(),
11
+ description: o().nullable()
12
+ }).with(c()), g = a(f, {
13
+ id: r({ prefix: "ccli" }),
14
+ collectionId: o().maxLength(64),
15
+ contentType: o().maxLength(64),
16
+ documentId: o().maxLength(64),
17
+ position: i()
18
+ }).with(c()).unique("cms_collection_items_once", ["collectionId", "documentId"]), _ = a(p, {
19
+ id: r({ prefix: "ccpt" }),
20
+ collectionId: o().maxLength(64),
21
+ tokenHash: o().unique(),
22
+ label: o().nullable(),
23
+ expiresAt: s(),
24
+ revokedAt: s().nullable(),
25
+ maxDownloads: i().nullable(),
26
+ downloads: i()
27
+ }).with(c()), v = (e) => l("sha256").update(e, "utf8").digest("hex"), y = (e) => e instanceof Date ? e : new Date(String(e)), b = async (e, t, n) => {
28
+ let r = n.name.trim().slice(0, 120), i = n.description?.trim() ? n.description.trim().slice(0, 500) : null, a = await e.insert(d, {
29
+ site: t.site,
30
+ environment: t.environment,
31
+ name: r,
32
+ description: i
33
+ });
34
+ return {
35
+ id: String(a.id),
36
+ name: r,
37
+ description: i
38
+ };
39
+ }, x = async (e, r) => (await e.query({
40
+ table: d,
41
+ predicate: t(n("site", r.site), n("environment", r.environment)),
42
+ order: [{
43
+ column: "name",
44
+ direction: "asc"
45
+ }],
46
+ take: 500,
47
+ skip: void 0,
48
+ projection: void 0
49
+ })).map((e) => ({
50
+ id: String(e.id),
51
+ name: String(e.name),
52
+ description: typeof e.description == "string" ? e.description : null
53
+ })), S = async (e, t, r = !1) => (await e.query({
54
+ table: f,
55
+ predicate: n("collectionId", t),
56
+ order: [{
57
+ column: "position",
58
+ direction: "asc"
59
+ }],
60
+ take: 1e3,
61
+ skip: void 0,
62
+ projection: void 0,
63
+ ...r ? { crossTenant: !0 } : {}
64
+ })).map((e) => ({
65
+ contentType: String(e.contentType),
66
+ documentId: String(e.documentId),
67
+ position: Number(e.position)
68
+ })), C = async (e, t) => (await e.query({
69
+ table: d,
70
+ predicate: n("id", t),
71
+ order: [],
72
+ take: 1,
73
+ skip: void 0,
74
+ projection: void 0
75
+ }))[0], w = async (e, t, n) => {
76
+ if (await C(e, t) === void 0) return !1;
77
+ let r = await S(e, t);
78
+ return r.some((e) => e.documentId === n.documentId) || await e.insert(f, {
79
+ collectionId: t,
80
+ contentType: n.contentType,
81
+ documentId: n.documentId,
82
+ position: r.length
83
+ }), !0;
84
+ }, T = async (e, r, i) => {
85
+ let [a] = await e.query({
86
+ table: f,
87
+ predicate: t(n("collectionId", r), n("documentId", i)),
88
+ order: [],
89
+ take: 1,
90
+ skip: void 0,
91
+ projection: void 0
92
+ });
93
+ return a !== void 0 && (await e.delete(f, String(a.id)), !0);
94
+ }, E = async (e, t, n, r = /* @__PURE__ */ new Date()) => {
95
+ if (await C(e, t) === void 0) return {
96
+ ok: !1,
97
+ reason: "notFound"
98
+ };
99
+ let i = (n.expiresAt.getTime() - r.getTime()) / 864e5;
100
+ if (!(i > 0) || i > 90) return {
101
+ ok: !1,
102
+ reason: "badExpiry"
103
+ };
104
+ let a = n.maxDownloads ?? null;
105
+ if (a !== null && (!Number.isInteger(a) || a < 1 || a > 1e5)) return {
106
+ ok: !1,
107
+ reason: "badLimit"
108
+ };
109
+ let o = u(32).toString("base64url"), s = await e.insert(p, {
110
+ collectionId: t,
111
+ tokenHash: v(o),
112
+ label: n.label?.trim() ? n.label.trim().slice(0, 120) : null,
113
+ expiresAt: n.expiresAt,
114
+ revokedAt: null,
115
+ maxDownloads: a,
116
+ downloads: 0
117
+ });
118
+ return {
119
+ ok: !0,
120
+ id: String(s.id),
121
+ token: o
122
+ };
123
+ }, D = (e) => ({
124
+ id: String(e.id),
125
+ label: typeof e.label == "string" ? e.label : null,
126
+ expiresAt: y(e.expiresAt),
127
+ revoked: e.revokedAt !== null && e.revokedAt !== void 0,
128
+ maxDownloads: typeof e.maxDownloads == "number" ? e.maxDownloads : null,
129
+ downloads: Number(e.downloads ?? 0)
130
+ }), O = async (e, t) => (await e.query({
131
+ table: p,
132
+ predicate: n("collectionId", t),
133
+ order: [{
134
+ column: "createdAt",
135
+ direction: "desc"
136
+ }],
137
+ take: 100,
138
+ skip: void 0,
139
+ projection: void 0
140
+ })).map(D), k = async (e, t, r = /* @__PURE__ */ new Date()) => {
141
+ let [i] = await e.query({
142
+ table: p,
143
+ predicate: n("id", t),
144
+ order: [],
145
+ take: 1,
146
+ skip: void 0,
147
+ projection: void 0
148
+ });
149
+ return i === void 0 || i.revokedAt !== null && i.revokedAt !== void 0 ? !1 : (await e.update(p, t, { revokedAt: r }), !0);
150
+ }, A = async (e, r, i = /* @__PURE__ */ new Date()) => {
151
+ let [a] = await e.query({
152
+ table: p,
153
+ predicate: n("tokenHash", v(r)),
154
+ order: [],
155
+ take: 1,
156
+ skip: void 0,
157
+ projection: void 0,
158
+ crossTenant: !0
159
+ });
160
+ if (a === void 0) return {
161
+ ok: !1,
162
+ reason: "unknown"
163
+ };
164
+ let o = D(a);
165
+ if (o.revoked) return {
166
+ ok: !1,
167
+ reason: "revoked"
168
+ };
169
+ if (o.expiresAt.getTime() <= i.getTime()) return {
170
+ ok: !1,
171
+ reason: "expired"
172
+ };
173
+ let s = typeof a.tenantId == "string" ? a.tenantId : null, [c] = await e.query({
174
+ table: d,
175
+ predicate: t(n("id", String(a.collectionId)), n("tenantId", s)),
176
+ order: [],
177
+ take: 1,
178
+ skip: void 0,
179
+ projection: void 0,
180
+ crossTenant: !0
181
+ });
182
+ return c === void 0 ? {
183
+ ok: !1,
184
+ reason: "unknown"
185
+ } : {
186
+ ok: !0,
187
+ portal: o,
188
+ tenantId: s,
189
+ collection: {
190
+ id: String(c.id),
191
+ name: String(c.name),
192
+ description: typeof c.description == "string" ? c.description : null
193
+ },
194
+ items: await S(e, String(c.id), !0),
195
+ downloadsLeft: o.maxDownloads === null ? null : Math.max(0, o.maxDownloads - o.downloads)
196
+ };
197
+ }, j = async (e, r, i, a = /* @__PURE__ */ new Date()) => {
198
+ for (let o = 0; o < 5; o++) {
199
+ let o = await A(e, r, a);
200
+ if (!o.ok) return o;
201
+ let s = o.items.find((e) => e.documentId === i);
202
+ if (s === void 0) return {
203
+ ok: !1,
204
+ reason: "notInCollection"
205
+ };
206
+ let { portal: c } = o;
207
+ if (c.maxDownloads !== null && c.downloads >= c.maxDownloads) return {
208
+ ok: !1,
209
+ reason: "limitReached"
210
+ };
211
+ if (await e.updateMany("cms_collection_portals", { downloads: c.downloads + 1 }, { where: t(n("id", c.id), n("downloads", c.downloads)) }) === 1) return {
212
+ ok: !0,
213
+ contentType: s.contentType,
214
+ tenantId: o.tenantId,
215
+ downloadsLeft: c.maxDownloads === null ? null : c.maxDownloads - c.downloads - 1
216
+ };
217
+ }
218
+ return {
219
+ ok: !1,
220
+ reason: "limitReached"
221
+ };
222
+ }, M = (...t) => e(() => b(...t)), N = (...t) => e(() => x(...t)), P = (...t) => e(() => S(...t)), F = (...t) => e(() => w(...t)), I = (...t) => e(() => T(...t)), L = (...t) => e(() => E(...t)), R = (...t) => e(() => O(...t)), z = (...t) => e(() => k(...t)), B = (...t) => e(() => A(...t)), V = (...t) => e(() => j(...t));
223
+ //#endregion
224
+ export { d as CMS_COLLECTIONS_TABLE, f as CMS_COLLECTION_ITEMS_TABLE, p as CMS_COLLECTION_PORTALS_TABLE, m as MAX_PORTAL_DAYS, w as addToCollection, F as addToCollectionEffect, g as cmsCollectionItemsTable, _ as cmsCollectionPortalsTable, h as cmsCollectionsTable, S as collectionItems, P as collectionItemsEffect, O as collectionPortals, R as collectionPortalsEffect, b as createCollection, M as createCollectionEffect, E as createPortal, L as createPortalEffect, x as listCollections, N as listCollectionsEffect, j as recordPortalDownload, V as recordPortalDownloadEffect, T as removeFromCollection, I as removeFromCollectionEffect, A as resolvePortal, B as resolvePortalEffect, k as revokePortal, z as revokePortalEffect };
@@ -0,0 +1,29 @@
1
+ //#region src/consent.ts
2
+ var e = /^https:\/\/[a-z0-9.-]+(:\d+)?$/, t = (t) => {
3
+ for (let n of t) {
4
+ let t = /* @__PURE__ */ new Set();
5
+ for (let r of n.vendors ?? []) {
6
+ if (!/^[a-z][a-zA-Z0-9]*$/.test(r.id) || t.has(r.id)) throw Error(`consent purpose '${n.id}': vendor id '${r.id}' must be a unique camelCase id`);
7
+ t.add(r.id);
8
+ for (let t of r.origins) if (!e.test(t)) throw Error(`consent purpose '${n.id}': vendor '${r.name}' origin '${t}' must be exactly https://host`);
9
+ }
10
+ }
11
+ }, n = (t, n) => {
12
+ let r = i(t, n);
13
+ return [...new Set(t.filter((e) => r.has(e.id)).flatMap((e) => (e.vendors ?? []).flatMap((e) => e.origins)).filter((t) => e.test(t)))].sort();
14
+ }, r = (e, t, r = "frame-ancestors 'none'; base-uri 'none'; object-src 'none'") => [r, `frame-src ${["'self'", ...n(e, t)].join(" ")}`].filter((e) => e !== "").join("; "), i = (e, t) => new Set(e.filter((e) => Object.hasOwn(t, e.id) && t[e.id] === e.version).map((e) => e.id)), a = (e, t) => t !== void 0 && e.every((e) => Object.hasOwn(t, e.id) && (t[e.id] === 0 || t[e.id] === e.version)), o = (e, t, n) => Array.isArray(e) ? e.map((e) => {
15
+ if (typeof e != "object" || !e) return e;
16
+ let r = e, i = t.get(String(r.componentId))?.consent;
17
+ return i === void 0 || n.has(i) ? e : {
18
+ instanceId: String(r.instanceId ?? ""),
19
+ componentId: String(r.componentId),
20
+ consentRequired: i,
21
+ props: {}
22
+ };
23
+ }) : e, s = (e, t, n) => {
24
+ let r = { ...t };
25
+ for (let [i, a] of Object.entries(e.fields)) a.kind === "components" && a.components !== void 0 && (r[i] = o(t[i], new Map(a.components.map((e) => [e.id, e])), n));
26
+ return r;
27
+ }, c = (e) => new Set(Object.values(e.fields).flatMap((e) => (e.components ?? []).flatMap((e) => e.consent === void 0 ? [] : [e.consent])));
28
+ //#endregion
29
+ export { t as checkConsentPurposes, r as consentContentSecurityPolicy, a as consentDecisionComplete, n as consentedOrigins, s as gateConsent, i as grantedPurposes, c as purposesUsedBy };
@@ -0,0 +1,53 @@
1
+ import { ContentLocationUnavailable as e } from "./errors.js";
2
+ import { encodeCanonicalPathSegment as t } from "./pathSegmentEncoding.js";
3
+ //#region src/contentLocations.ts
4
+ var n = (t) => {
5
+ throw new e({ reason: t });
6
+ }, r = (e) => {
7
+ if (typeof e != "object" || !e || Array.isArray(e) || ![Object.prototype, null].includes(Object.getPrototypeOf(e)) || Object.getOwnPropertySymbols(e).length !== 0) return n("definition");
8
+ let t = Object.getOwnPropertyDescriptors(e);
9
+ return Object.values(t).some((e) => !e.enumerable || !("value" in e)) ? n("definition") : Object.fromEntries(Object.entries(t).map(([e, t]) => [e, t.value]));
10
+ }, i = (e, t) => {
11
+ if (!Array.isArray(e) || e.length > t || Object.getOwnPropertySymbols(e).length !== 0 || Object.keys(e).length !== e.length || Object.keys(e).some((e, t) => e !== String(t))) return n("definition");
12
+ let r = Object.getOwnPropertyDescriptors(e);
13
+ return Object.entries(r).some(([e, t]) => e !== "length" && (!t.enumerable || !("value" in t))) ? n("definition") : Array.from({ length: e.length }, (e, t) => r[String(t)].value);
14
+ }, a = (e) => typeof e == "string" && /^[A-Za-z][A-Za-z0-9_.-]{0,63}$/.test(e), o = (e) => typeof e != "string" || e.length === 0 || e.length > 256 || e.trim() !== e || e.normalize("NFC") !== e || e === "." || e === ".." || /[\/\\%?#\u0000-\u001f\u007f]/u.test(e) || /[\uD800-\uDFFF]/u.test(e) ? n("path") : e, s = (e) => t(o(e)), c = (e) => {
15
+ let t = /* @__PURE__ */ new Set();
16
+ return Object.freeze(i(e, 32).map((e) => {
17
+ let s = r(e);
18
+ if (Object.keys(s).length !== 2 || !Object.hasOwn(s, "segments") || !a(s.id) || t.has(s.id)) return n("definition");
19
+ t.add(s.id);
20
+ let c = 0, l = i(s.segments, 64).map((e) => {
21
+ if (typeof e == "string") return o(e);
22
+ let t = r(e);
23
+ return Object.keys(t).length === 1 ? Object.hasOwn(t, "field") && a(t.field) ? Object.freeze({ field: t.field }) : Object.hasOwn(t, "tree") && t.tree === !0 && ++c === 1 ? Object.freeze({ tree: !0 }) : n("definition") : n("definition");
24
+ });
25
+ return Object.freeze({
26
+ id: s.id,
27
+ segments: Object.freeze(l)
28
+ });
29
+ }));
30
+ }, l = (e, t, i) => {
31
+ let a = c([e])[0];
32
+ if (typeof t != "object" || !t || Array.isArray(t)) return n("field");
33
+ let o = r(i);
34
+ if (Object.keys(o).some((e) => e !== "prefix" && e !== "treePath") || typeof o.prefix != "string") return n("path");
35
+ let l = o.prefix;
36
+ if (l.length > 4096) return n("bounds");
37
+ if (l !== "" && (!l.startsWith("/") || l.endsWith("/"))) return n("path");
38
+ let u = l === "" ? [] : l.slice(1).split("/").map(s);
39
+ for (let e of a.segments) if (typeof e == "string") u.push(s(e));
40
+ else if ("field" in e) {
41
+ let r = Object.getOwnPropertyDescriptor(t, e.field);
42
+ if (r === void 0 || !("value" in r) || typeof r.value != "string") return n("field");
43
+ u.push(s(r.value));
44
+ } else {
45
+ if (typeof o.treePath != "string" || o.treePath === "") return n("tree");
46
+ if (o.treePath.length > 4096) return n("bounds");
47
+ u.push(...o.treePath.split("/").map(s));
48
+ }
49
+ let d = `/${u.join("/")}`;
50
+ return u.length > 128 || d.length > 4096 ? n("bounds") : d;
51
+ };
52
+ //#endregion
53
+ export { c as defineContentLocations, l as resolveContentLocation };
@@ -0,0 +1,83 @@
1
+ import { Schema as e } from "effect";
2
+ //#region src/contentProjection.ts
3
+ var t = class extends e.TaggedError()("ContentProjectionUnavailable", { reason: e.Literals([
4
+ "definition",
5
+ "value",
6
+ "bounds"
7
+ ]) }) {}, n = (e) => {
8
+ throw new t({ reason: e });
9
+ }, r = (e) => e.length > 0 && e.length <= 128 && !/[\u0000-\u001f\u007f]/.test(e), i = (e, t) => typeof e != "object" || !e || Array.isArray(e) || ![Object.prototype, null].includes(Object.getPrototypeOf(e)) ? n(t) : e, a = (e, t, r) => {
10
+ let i = Object.getOwnPropertyDescriptor(e, t);
11
+ if (i !== void 0) return !i.enumerable || !("value" in i) ? n(r) : i.value;
12
+ }, o = (e) => {
13
+ let t = i(e, "definition");
14
+ return Object.getOwnPropertySymbols(t).length ? n("definition") : Object.fromEntries(Object.getOwnPropertyNames(t).map((e) => [e, a(t, e, "definition")]));
15
+ }, s = (e) => {
16
+ let t = /* @__PURE__ */ new Set(), a = 0, s = (e, r) => {
17
+ let s = i(e, "definition");
18
+ if (t.has(s)) return n("definition");
19
+ if (++a > 4096 || t.size >= 32) return n("bounds");
20
+ t.add(s);
21
+ try {
22
+ return r(o(s));
23
+ } finally {
24
+ t.delete(s);
25
+ }
26
+ }, c = (e) => s(e, (e) => {
27
+ let t = Object.keys(e).sort();
28
+ return t.length > 256 || t.some((e) => !r(e)) ? n("definition") : Object.freeze(Object.fromEntries(t.map((t) => [t, l(e[t])])));
29
+ }), l = (e) => e === !0 ? ++a > 4096 ? n("bounds") : !0 : s(e, (e) => Object.keys(e).length === 1 ? "object" in e ? Object.freeze({ object: c(e.object) }) : "array" in e ? Object.freeze({ array: l(e.array) }) : "variant" in e ? s(e.variant, (e) => {
30
+ if (Object.keys(e).length !== 2 || typeof e.field != "string" || !r(e.field)) return n("definition");
31
+ let t = e.field, i = s(e.cases, (e) => {
32
+ let i = Object.keys(e).sort();
33
+ return i.length === 0 || i.length > 256 || i.some((e) => !r(e)) ? n("definition") : Object.freeze(Object.fromEntries(i.map((r) => {
34
+ let i = c(e[r]);
35
+ return Object.hasOwn(i, t) ? n("definition") : [r, i];
36
+ })));
37
+ });
38
+ return Object.freeze({ variant: Object.freeze({
39
+ field: t,
40
+ cases: i
41
+ }) });
42
+ }) : n("definition") : n("definition"));
43
+ return s(e, (e) => Object.keys(e).length !== 2 || e.version !== 1 || !("fields" in e) ? n("definition") : Object.freeze({
44
+ version: 1,
45
+ fields: c(e.fields)
46
+ }));
47
+ }, c = (e, t, r) => {
48
+ let o = s(e), c = /* @__PURE__ */ new Set(), l = 0, u = 0, d = new TextEncoder(), f = (e) => {
49
+ if (e.length > 524288 || (u += d.encode(e).length, u > 524288)) return n("bounds");
50
+ }, p = (e, t) => {
51
+ if (c.has(e)) return n("value");
52
+ if (c.size >= 64) return n("bounds");
53
+ c.add(e);
54
+ try {
55
+ return t();
56
+ } finally {
57
+ c.delete(e);
58
+ }
59
+ }, m = (e, t) => {
60
+ let n = i(t, "value");
61
+ return p(n, () => {
62
+ let t = Object.fromEntries(Object.entries(e).flatMap(([e, t]) => {
63
+ let r = a(n, e, "value");
64
+ return r === void 0 ? [] : (f(e), [[e, h(t, r)]]);
65
+ }));
66
+ return r?.(n, t), t;
67
+ });
68
+ }, h = (e, t) => {
69
+ if (++l > 1e5) return n("bounds");
70
+ if (t === null) return null;
71
+ if (e === !0) return typeof t == "string" ? (f(t), t) : typeof t == "boolean" || typeof t == "number" && Number.isFinite(t) ? t : n("value");
72
+ if ("object" in e) return m(e.object, t);
73
+ if ("array" in e) return !Array.isArray(t) || t.length > 1e4 ? n(Array.isArray(t) ? "bounds" : "value") : p(t, () => Array.from({ length: t.length }, (r, i) => {
74
+ let o = a(t, String(i), "value");
75
+ return o === void 0 ? n("value") : h(e.array, o);
76
+ }));
77
+ let r = i(t, "value"), { field: o, cases: s } = e.variant, c = a(r, o, "value");
78
+ return typeof c != "string" || !Object.hasOwn(s, c) ? n("value") : (f(o), f(c), Object.fromEntries([[o, c], ...Object.entries(m(s[c], r))]));
79
+ }, g = m(o.fields, t);
80
+ return d.encode(JSON.stringify(g)).length > 524288 ? n("bounds") : g;
81
+ };
82
+ //#endregion
83
+ export { t as ContentProjectionUnavailable, s as defineContentProjection, c as projectContentValues };
@@ -0,0 +1,13 @@
1
+ import { createHash as e } from "node:crypto";
2
+ import { canonicalJson as t } from "@voltro/runtime";
3
+ //#region src/contentRouteIdentity.ts
4
+ var n = (n, r, i, a, o) => `route_${e("sha256").update(t([
5
+ n.tenantId,
6
+ n.site,
7
+ r,
8
+ i,
9
+ a,
10
+ o
11
+ ])).digest("hex")}`;
12
+ //#endregion
13
+ export { n as contentRouteId };
@@ -0,0 +1,97 @@
1
+ import { resolveContentLocation as e } from "./contentLocations.js";
2
+ import { copySnapshotResource as t } from "./buildSnapshot.js";
3
+ import { snapshotRouteOwnership as n } from "./snapshotRouting.js";
4
+ import { resolveContentTreePath as r } from "./contentTreePath.js";
5
+ import { contentRouteId as i } from "./contentRouteIdentity.js";
6
+ import { Schema as a } from "effect";
7
+ import { createHash as o } from "node:crypto";
8
+ import { canonicalJson as s } from "@voltro/runtime";
9
+ //#region src/contentRouteMaterializer.ts
10
+ var c = class extends a.TaggedError()("ContentRouteMaterializationUnavailable", { reason: a.Literals([
11
+ "scope",
12
+ "publication",
13
+ "bounds"
14
+ ]) }) {}, l = (e) => {
15
+ throw new c({ reason: e });
16
+ }, u = (e) => typeof e == "string" && e.length > 0, d = (e, t) => e < t ? -1 : +(e > t), f = (e) => o("sha256").update(s(e)).digest("hex");
17
+ async function* p(a, o) {
18
+ let { scope: s, site: c, routing: p, definitionDigest: m } = a;
19
+ if (c.definition.id !== s.site || !c.definition.environments.includes(s.environment)) return l("scope");
20
+ for (let h of a.types) if (h.locations.length !== 0) for (let a of c.definition.locales.filter((e) => e.enabled).sort((e, t) => d(e.id, t.id))) {
21
+ let d = [a.contentLocale, ...c.fallback[a.contentLocale]], g = async (e) => {
22
+ for (let t of d) {
23
+ let n = await o.read(h.name, t, e);
24
+ if (n !== null) return n;
25
+ }
26
+ return null;
27
+ };
28
+ for (let c of d) {
29
+ let d;
30
+ for (;;) {
31
+ let _ = await o.page(h.name, c, d);
32
+ for (let o of _.items) {
33
+ if (!u(o.documentId)) return l("publication");
34
+ let c = await g(o.documentId), d = c?.content;
35
+ if (c === null || d === void 0 || d.id !== o.id) continue;
36
+ let _ = h.tree === null ? {
37
+ ok: !0,
38
+ path: "",
39
+ ancestors: []
40
+ } : await r(d, h.tree, async (e) => (await g(e))?.content ?? null);
41
+ if (!_.ok) return l(_.reason);
42
+ let v = _.path === null, y = _.ancestors;
43
+ for (let r of h.locations) {
44
+ let o = i(s, a.id, h.name, String(d.documentId), r.id), l = {
45
+ version: 1,
46
+ ...s,
47
+ routeId: o,
48
+ mappingId: r.id,
49
+ contentType: h.name,
50
+ documentId: d.documentId,
51
+ localeId: a.id,
52
+ requestedLocale: a.contentLocale,
53
+ sourceLocale: d.locale,
54
+ fallback: d.locale !== a.contentLocale,
55
+ variantId: d.id,
56
+ revisionId: d.revisionId,
57
+ revision: d.revision,
58
+ definitionDigest: m,
59
+ lastModified: c.modifiedAt
60
+ }, u = v ? null : e(r, d, {
61
+ prefix: a.prefix,
62
+ ...h.tree === null ? {} : { treePath: _.path }
63
+ }), g = u === null ? `unroutable:${o}` : `path:${f(u)}`;
64
+ yield t({
65
+ key: `identity:${o}`,
66
+ value: {
67
+ version: 1,
68
+ kind: "route-index",
69
+ target: g
70
+ }
71
+ }), v ? yield t({
72
+ key: `unroutable:${o}`,
73
+ value: {
74
+ ...l,
75
+ state: "unroutable",
76
+ reason: "orphan"
77
+ }
78
+ }) : yield t({
79
+ key: g,
80
+ value: {
81
+ ...l,
82
+ state: "resolved",
83
+ path: u,
84
+ ancestors: y,
85
+ ownership: n(p, u)
86
+ }
87
+ });
88
+ }
89
+ }
90
+ if (_.next === null) break;
91
+ d = _.next;
92
+ }
93
+ }
94
+ }
95
+ }
96
+ //#endregion
97
+ export { c as ContentRouteMaterializationUnavailable, p as materializeContentRoutes };
@@ -0,0 +1,39 @@
1
+ import { defineContentLocations as e } from "./contentLocations.js";
2
+ //#region src/contentRouteTypes.ts
3
+ var t = (e) => typeof e == "string" && e.length > 0, n = (e, t) => e < t ? -1 : +(e > t), r = (r) => {
4
+ if (r.length === 0 || r.some((e) => !t(e.name)) || new Set(r.map((e) => e.name)).size !== r.length) return {
5
+ ok: !1,
6
+ reason: "types"
7
+ };
8
+ let i = [];
9
+ for (let n of r) {
10
+ let r = e(n.locations ?? []);
11
+ if ((n.tree !== void 0 || n.address !== void 0) && r.length === 0) return {
12
+ ok: !1,
13
+ reason: "mapping"
14
+ };
15
+ for (let e of r) for (let t of e.segments) if (typeof t != "string" && ("field" in t && n.fields[t.field]?.kind !== "string" || "tree" in t && n.tree === void 0)) return {
16
+ ok: !1,
17
+ reason: "mapping"
18
+ };
19
+ let a = n.tree === void 0 ? null : {
20
+ parent: n.tree.parent,
21
+ segment: n.tree.segment
22
+ };
23
+ if (a !== null && (!t(a.parent) || !t(a.segment))) return {
24
+ ok: !1,
25
+ reason: "mapping"
26
+ };
27
+ i.push({
28
+ name: n.name,
29
+ locations: r,
30
+ tree: a
31
+ });
32
+ }
33
+ return {
34
+ ok: !0,
35
+ types: i.sort((e, t) => n(e.name, t.name))
36
+ };
37
+ };
38
+ //#endregion
39
+ export { r as compileContentRouteTypes };