@voltro/cms 0.86.0 → 0.88.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 (243) hide show
  1. package/CHANGELOG.md +5484 -0
  2. package/README.md +138 -0
  3. package/THIRD-PARTY-NOTICES.md +1511 -276
  4. package/dist/ContentForm.js +1 -2
  5. package/dist/RichDocumentEditor.js +1 -2
  6. package/dist/RichDocumentView.js +82 -38
  7. package/dist/RichTextSurface.js +1 -2
  8. package/dist/aiCandidates.js +4 -5
  9. package/dist/aiOperations.js +1 -2
  10. package/dist/applicationBuildSnapshotService.js +100 -0
  11. package/dist/assetRenditions.js +101 -0
  12. package/dist/assetRevision.js +45 -0
  13. package/dist/assetUseRights.js +71 -0
  14. package/dist/audiences.js +1 -2
  15. package/dist/availability.js +20 -18
  16. package/dist/blueprint.js +76 -77
  17. package/dist/build.d.ts +3063 -0
  18. package/dist/build.js +37 -0
  19. package/dist/buildApplicationAdmission.js +15 -0
  20. package/dist/buildApplicationCatalog.js +135 -0
  21. package/dist/buildApplicationCatalogTable.js +23 -0
  22. package/dist/buildApplicationRest.js +98 -0
  23. package/dist/buildApplicationUpload.js +110 -0
  24. package/dist/buildSnapshot.js +400 -0
  25. package/dist/buildSnapshotApplicationPin.js +31 -0
  26. package/dist/buildSnapshotRest.js +209 -0
  27. package/dist/buildSnapshotService.js +264 -0
  28. package/dist/buildSnapshotTables.js +24 -0
  29. package/dist/bulk.js +72 -72
  30. package/dist/cacheIdentity.js +1 -2
  31. package/dist/changes.js +280 -64
  32. package/dist/cmsContext.js +1 -2
  33. package/dist/collections.js +1 -2
  34. package/dist/consent.js +6 -7
  35. package/dist/contentLocations.js +52 -0
  36. package/dist/contentProjection.js +82 -0
  37. package/dist/contentRouteIdentity.js +12 -0
  38. package/dist/contentRouteMaterializer.js +96 -0
  39. package/dist/contentRouteTypes.js +38 -0
  40. package/dist/contentSeo.js +188 -0
  41. package/dist/contentTreePath.js +59 -0
  42. package/dist/contentType.js +121 -105
  43. package/dist/contentValues.js +17 -0
  44. package/dist/contentfulImport.js +1 -2
  45. package/dist/copies.js +4 -5
  46. package/dist/cutover.js +1 -2
  47. package/dist/deliveryChecks.js +1 -2
  48. package/dist/domainHost.js +6 -0
  49. package/dist/domains.js +82 -89
  50. package/dist/draftTexts.js +38 -39
  51. package/dist/duplicates.js +24 -25
  52. package/dist/edgePurge.js +1 -2
  53. package/dist/editHistory.js +1 -2
  54. package/dist/effectForm.js +1 -2
  55. package/dist/environmentAliases.js +137 -0
  56. package/dist/environments.js +108 -71
  57. package/dist/errors.js +55 -16
  58. package/dist/experiments.js +8 -9
  59. package/dist/exposure.js +1 -2
  60. package/dist/extensionManifest.js +2 -3
  61. package/dist/extensions.js +1 -2
  62. package/dist/fieldSchema.js +1 -2
  63. package/dist/formStrings.js +1 -2
  64. package/dist/frontendBindings.js +98 -0
  65. package/dist/frontendMedia.js +17 -0
  66. package/dist/glossary.js +1 -2
  67. package/dist/history.js +1 -2
  68. package/dist/htmlImport.js +1 -2
  69. package/dist/index.d.ts +760 -47
  70. package/dist/index.js +89 -73
  71. package/dist/initializePublicRoutes.js +27 -0
  72. package/dist/liveContentRouteView.js +75 -0
  73. package/dist/media.js +1 -2
  74. package/dist/metrics.js +1 -2
  75. package/dist/migration.js +1 -2
  76. package/dist/migrationStages.js +1 -2
  77. package/dist/nativeOutputDeploymentService.js +204 -0
  78. package/dist/outputActivation.js +233 -0
  79. package/dist/outputActivationOrigin.js +50 -0
  80. package/dist/outputActivationStore.js +410 -0
  81. package/dist/outputActivationTables.js +10 -0
  82. package/dist/outputActivationTarget.js +80 -0
  83. package/dist/outputActivationTargetTable.js +24 -0
  84. package/dist/outputDeployment.js +173 -0
  85. package/dist/outputDeploymentRest.js +167 -0
  86. package/dist/outputDeploymentService.js +240 -0
  87. package/dist/outputRouteGraph.js +176 -0
  88. package/dist/outputSafetyArtifact.js +146 -0
  89. package/dist/outputTargetRest.js +61 -0
  90. package/dist/pathSegmentEncoding.js +3 -0
  91. package/dist/presenceAnchors.js +1 -2
  92. package/dist/preview.js +1 -2
  93. package/dist/privateCmsTransport.js +75 -0
  94. package/dist/privateNativeRouteReservation.js +9 -0
  95. package/dist/promotion.js +69 -61
  96. package/dist/publicBuild.js +89 -0
  97. package/dist/publicBuildRest.js +97 -0
  98. package/dist/publicBuildService.js +62 -0
  99. package/dist/publicOutputHttp.js +128 -0
  100. package/dist/publicOutputService.js +286 -0
  101. package/dist/publicPresentation.js +16 -0
  102. package/dist/publicRouteDispositionAdmission.js +37 -0
  103. package/dist/publicRouteHistoryStore.js +11 -0
  104. package/dist/publicRouteHistoryView.js +33 -0
  105. package/dist/publicRouteIntegrity.js +4 -0
  106. package/dist/publicRouteMutation.js +5 -0
  107. package/dist/publicRouteNamespace.js +133 -0
  108. package/dist/publicRoutePublication.js +35 -0
  109. package/dist/publicRouteRegistry.js +16 -0
  110. package/dist/publicRouteRegistryBinding.js +193 -0
  111. package/dist/publicRouteRegistryDefinition.js +75 -0
  112. package/dist/publicRouteSitePublication.js +39 -0
  113. package/dist/publicRouteTables.js +12 -0
  114. package/dist/publicRouteUrl.js +17 -0
  115. package/dist/publicationSeo.js +51 -0
  116. package/dist/publicationState.js +295 -0
  117. package/dist/quality.js +9 -10
  118. package/dist/reconfigurePublicRoutes.js +40 -0
  119. package/dist/recurrence.js +1 -2
  120. package/dist/redirects.js +105 -75
  121. package/dist/referenceGraph.js +16 -16
  122. package/dist/references.js +3 -4
  123. package/dist/release.js +178 -143
  124. package/dist/renderReadAuthority.js +42 -0
  125. package/dist/renderReadGrant.js +136 -0
  126. package/dist/rest.js +1 -2
  127. package/dist/review.js +29 -30
  128. package/dist/richDocument.js +56 -27
  129. package/dist/richInline.js +1 -2
  130. package/dist/routeDispositionGraph.js +43 -0
  131. package/dist/routeDispositionRest.js +50 -0
  132. package/dist/routeDispositionService.js +72 -0
  133. package/dist/routeDispositionStore.js +288 -0
  134. package/dist/routeDispositionTables.js +4 -0
  135. package/dist/routeDispositions.js +90 -0
  136. package/dist/routeHistoryStorage.js +319 -0
  137. package/dist/routeHistoryStore.js +11 -0
  138. package/dist/schedule.js +37 -38
  139. package/dist/search.js +1 -2
  140. package/dist/selectionIntent.js +1 -2
  141. package/dist/seo.js +2 -3
  142. package/dist/series.js +12 -13
  143. package/dist/share.js +14 -15
  144. package/dist/siteBindings.js +158 -0
  145. package/dist/siteBuildCandidate.js +103 -0
  146. package/dist/siteDelivery.js +114 -0
  147. package/dist/siteState.js +46 -0
  148. package/dist/snapshotAddressGraph.js +54 -0
  149. package/dist/snapshotAddressRead.js +72 -0
  150. package/dist/snapshotAppConsumer.js +70 -0
  151. package/dist/snapshotAppExecution.js +101 -0
  152. package/dist/snapshotApplication.js +74 -0
  153. package/dist/snapshotApprovedRouteDispositions.js +43 -0
  154. package/dist/snapshotAssetAssembly.js +69 -0
  155. package/dist/snapshotAssetAssemblyRest.js +49 -0
  156. package/dist/snapshotBindingRead.js +60 -0
  157. package/dist/snapshotCodeSeo.js +28 -0
  158. package/dist/snapshotComponent.js +33 -0
  159. package/dist/snapshotComponentSource.js +23 -0
  160. package/dist/snapshotConsumer.js +86 -0
  161. package/dist/snapshotContentIdentity.js +9 -0
  162. package/dist/snapshotDefinitions.js +263 -0
  163. package/dist/snapshotDocumentAssembly.js +192 -0
  164. package/dist/snapshotDocumentAssemblyRest.js +83 -0
  165. package/dist/snapshotDocumentProjection.js +201 -0
  166. package/dist/snapshotDocumentTransfer.js +34 -0
  167. package/dist/snapshotDocumentTransferRest.js +79 -0
  168. package/dist/snapshotDomains.js +55 -0
  169. package/dist/snapshotEnvironment.js +30 -0
  170. package/dist/snapshotFieldPlan.js +84 -0
  171. package/dist/snapshotFrontend.js +102 -0
  172. package/dist/snapshotLink.js +7 -0
  173. package/dist/snapshotMedia.js +110 -0
  174. package/dist/snapshotMediaCapture.js +245 -0
  175. package/dist/snapshotMediaFields.js +224 -0
  176. package/dist/snapshotMediaRead.js +184 -0
  177. package/dist/snapshotMediaReader.js +12 -0
  178. package/dist/snapshotObservation.js +15 -0
  179. package/dist/snapshotObservedRouteHistory.js +33 -0
  180. package/dist/snapshotOutputTransfer.js +77 -0
  181. package/dist/snapshotPageLoader.js +6 -0
  182. package/dist/snapshotPageSeo.js +58 -0
  183. package/dist/snapshotPathLocale.js +14 -0
  184. package/dist/snapshotPresentation.js +85 -0
  185. package/dist/snapshotPresentationPolicy.js +11 -0
  186. package/dist/snapshotProjection.js +118 -0
  187. package/dist/snapshotPublicAccess.js +160 -0
  188. package/dist/snapshotPublicRouteHistory.js +39 -0
  189. package/dist/snapshotReadAdmission.js +37 -0
  190. package/dist/snapshotRedirectOutput.js +150 -0
  191. package/dist/snapshotRedirectTargets.js +23 -0
  192. package/dist/snapshotRedirects.js +131 -0
  193. package/dist/snapshotReference.js +7 -0
  194. package/dist/snapshotReferenceAddress.js +9 -0
  195. package/dist/snapshotReferenceGraph.js +78 -0
  196. package/dist/snapshotReferenceRead.js +64 -0
  197. package/dist/snapshotRelease.js +98 -0
  198. package/dist/snapshotRender.js +360 -0
  199. package/dist/snapshotRenderDependencies.js +177 -0
  200. package/dist/snapshotRenditions.js +87 -0
  201. package/dist/snapshotRichDocument.js +61 -0
  202. package/dist/snapshotRoleTransfer.js +105 -0
  203. package/dist/snapshotRoleTransferRest.js +98 -0
  204. package/dist/snapshotRouteAdmission.js +70 -0
  205. package/dist/snapshotRouteDispatch.js +110 -0
  206. package/dist/snapshotRouteDispositionPlan.js +72 -0
  207. package/dist/snapshotRouteRead.js +42 -0
  208. package/dist/snapshotRoutes.js +78 -0
  209. package/dist/snapshotRouting.js +112 -0
  210. package/dist/snapshotSeo.js +178 -0
  211. package/dist/snapshotSeoControls.js +100 -0
  212. package/dist/snapshotSeoDocumentInventory.js +114 -0
  213. package/dist/snapshotSeoDocuments.js +128 -0
  214. package/dist/snapshotSeoMerge.js +84 -0
  215. package/dist/snapshotSeoMetadata.js +136 -0
  216. package/dist/snapshotSeoOutput.js +172 -0
  217. package/dist/snapshotSeoPathSets.js +104 -0
  218. package/dist/snapshotSeoRead.js +87 -0
  219. package/dist/snapshotSite.js +127 -0
  220. package/dist/snapshotSitemapFiles.js +35 -0
  221. package/dist/snapshotTreeDependencies.js +57 -0
  222. package/dist/snapshotTreeLoader.js +9 -0
  223. package/dist/snapshotTreeRead.js +157 -0
  224. package/dist/staticPathSet.js +176 -0
  225. package/dist/staticPathSetRest.js +128 -0
  226. package/dist/staticPathSetService.js +248 -0
  227. package/dist/staticPathSetStore.js +337 -0
  228. package/dist/stewardship.js +2 -3
  229. package/dist/taxonomy.js +1 -2
  230. package/dist/team.js +1 -2
  231. package/dist/templates.js +2 -3
  232. package/dist/trackChanges.js +1 -2
  233. package/dist/translation.js +1 -2
  234. package/dist/tree.js +10 -11
  235. package/dist/usage.js +1 -2
  236. package/dist/validation.js +54 -55
  237. package/dist/visualEditing.js +1 -2
  238. package/dist/web.d.ts +709 -7
  239. package/dist/web.js +50 -33
  240. package/dist/workflow.js +9 -10
  241. package/dist/write.js +251 -227
  242. package/dist/xliff.js +1 -2
  243. package/package.json +21 -7
@@ -0,0 +1,193 @@
1
+ import { publicRouteRegistryFail as e } from "./publicRouteRegistry.js";
2
+ import { CMS_REVISIONS_TABLE as t } from "./contentType.js";
3
+ import { lockSiteState as n } from "./siteState.js";
4
+ import { invalidatePublicationRelease as r, lockPublicationStream as i, readPublicationBoundary as a } from "./changes.js";
5
+ import { CMS_PATHS_TABLE as o, CMS_REDIRECTS_TABLE as s } from "./redirects.js";
6
+ import { queryPublicRouteIntegrity as c } from "./publicRouteIntegrity.js";
7
+ import { copyOutputActivationScope as l, outputActivationHash as u } from "./outputActivation.js";
8
+ import { readPublicRouteHistoryPage as d, replacePublicRouteHistory as f } from "./publicRouteHistoryStore.js";
9
+ import { copyPublicRouteRegistryDefinition as p } from "./publicRouteRegistryDefinition.js";
10
+ import { and as m, eq as h, generateId as g, id as _, integer as v, json as y, table as b, text as x, timestamp as S } from "@voltro/database";
11
+ import { tenant as C } from "@voltro/plugin-multitenancy/mixin";
12
+ import { canonicalJson as w } from "@voltro/runtime";
13
+ // src/publicRouteRegistryBinding.ts
14
+ var T = "_voltro_cms_public_route_registry_heads", E = "_voltro_cms_public_route_registry_bindings", D = b(T, {
15
+ id: _({ prefix: "crrh" }),
16
+ site: x().maxLength(64),
17
+ environment: x().maxLength(64),
18
+ revision: v(),
19
+ bindingId: x().maxLength(64)
20
+ }).with(C()).unique("cms_public_route_registry_scope", [
21
+ "tenantId",
22
+ "site",
23
+ "environment"
24
+ ]), O = b(E, {
25
+ id: _({ prefix: "crrb" }),
26
+ site: x().maxLength(64),
27
+ environment: x().maxLength(64),
28
+ revision: v(),
29
+ definition: y(),
30
+ definitionDigest: x().maxLength(64),
31
+ previousBindingId: x().maxLength(64).nullable(),
32
+ origin: y(),
33
+ boundAt: S(),
34
+ integrityDigest: x().maxLength(64)
35
+ }).with(C()).unique("cms_public_route_binding_revision", [
36
+ "tenantId",
37
+ "site",
38
+ "environment",
39
+ "revision"
40
+ ]), k = [D, O], A = (t) => {
41
+ try {
42
+ return l(t);
43
+ } catch {
44
+ return e("scope");
45
+ }
46
+ }, j = (e) => m(h("tenantId", e.tenantId), h("site", e.site), h("environment", e.environment)), M = (e) => typeof e == "string" && /^[A-Za-z0-9_-]{1,64}$/.test(e), N = (e) => Number.isInteger(e) && Number(e) >= 1 && Number(e) <= 2147483647, P = (t, n) => g({
47
+ kind: "typeid",
48
+ prefix: t
49
+ }, n) ?? e("state"), F = (t) => {
50
+ if (typeof t != "object" || !t || Array.isArray(t) || Object.getOwnPropertySymbols(t).length !== 0) return e("state");
51
+ let n = Object.getOwnPropertyDescriptors(t);
52
+ if (Object.keys(n).sort().join(",") !== "checkpoint,generation,releaseId" || Object.values(n).some((e) => !e.enumerable || !("value" in e))) return e("state");
53
+ let r = n.generation.value;
54
+ return typeof r != "string" || !/^0{20}$/.test(r) || n.releaseId.value !== null || n.checkpoint.value !== null ? e("state") : {
55
+ generation: r,
56
+ releaseId: null,
57
+ checkpoint: null
58
+ };
59
+ }, I = (e, t, n) => e.insert(E, {
60
+ id: n.id,
61
+ ...t,
62
+ revision: n.revision,
63
+ previousBindingId: n.previousBindingId,
64
+ definition: n.definition,
65
+ definitionDigest: u(n.definition),
66
+ origin: n.origin,
67
+ boundAt: new Date(n.boundAt),
68
+ integrityDigest: u({
69
+ scope: t,
70
+ ...n
71
+ })
72
+ }), L = async (t, n) => {
73
+ let r = A(n), i = await c(t, {
74
+ table: T,
75
+ predicate: j(r),
76
+ lock: "update",
77
+ order: [],
78
+ take: 2,
79
+ skip: void 0,
80
+ projection: void 0
81
+ });
82
+ if (i.length === 0) return (await c(t, {
83
+ table: "_voltro_cms_public_route_registry_bindings",
84
+ predicate: j(r),
85
+ lock: "update",
86
+ order: [],
87
+ take: 1,
88
+ skip: void 0,
89
+ projection: ["id"]
90
+ })).length > 0 ? e("state") : null;
91
+ let a = i[0];
92
+ if (i.length !== 1 || !M(a.id) || !M(a.bindingId) || !N(a.revision)) return e("state");
93
+ let o = await c(t, {
94
+ table: E,
95
+ predicate: m(j(r), h("id", a.bindingId)),
96
+ lock: "update",
97
+ order: [],
98
+ take: 2,
99
+ skip: void 0,
100
+ projection: void 0
101
+ }), s = o[0];
102
+ if (o.length !== 1 || s === void 0 || s.revision !== a.revision || !M(s.id) || !(s.previousBindingId === null || M(s.previousBindingId)) || s.previousBindingId === null != (s.revision === 1)) return e("state");
103
+ let l;
104
+ try {
105
+ l = p(s.definition);
106
+ } catch {
107
+ return e("state");
108
+ }
109
+ let d = s.boundAt instanceof Date ? s.boundAt.getTime() : NaN, f = F(s.origin);
110
+ if (!Number.isSafeInteger(d) || d < 0 || d > 864e13 || l.site.id !== r.site || !l.site.environments.includes(r.environment) || s.definitionDigest !== u(l)) return e("state");
111
+ let g = {
112
+ id: s.id,
113
+ revision: a.revision,
114
+ previousBindingId: s.previousBindingId,
115
+ definition: l,
116
+ origin: f,
117
+ boundAt: d
118
+ };
119
+ return s.integrityDigest === u({
120
+ scope: r,
121
+ ...g
122
+ }) ? g : e("state");
123
+ }, R = async (l, m, h) => {
124
+ let g = A(m), _ = p(h.definition), v = h.expectedRevision, y = h.now;
125
+ if (!Number.isSafeInteger(v) || v < 0 || v > 2147483647) return e("revision");
126
+ if (!Number.isSafeInteger(y) || y < 0 || y > 864e13) return e("bounds");
127
+ if (_.site.id !== g.site || !_.site.environments.includes(g.environment)) return e("scope");
128
+ await n(l, g), await i(l, g);
129
+ let b = await L(l, g);
130
+ if (b !== null) return v !== 0 && v !== b.revision ? e("revision") : w(b.definition) === w(_) ? (await d(l, g, { take: 1 })).revision === 0 ? e("history") : b : e("configuration");
131
+ if (v !== 0) return e("revision");
132
+ let x = await a(l, g);
133
+ if (BigInt(x.generation) !== 0n || x.releaseId !== null || x.checkpoint !== null) return e("history");
134
+ for (let n of [
135
+ t,
136
+ o,
137
+ s,
138
+ ..._.types.map((e) => e.name + "_published")
139
+ ]) if ((await c(l, {
140
+ table: n,
141
+ predicate: j(g),
142
+ lock: "update",
143
+ order: [],
144
+ take: 1,
145
+ skip: void 0,
146
+ projection: ["id"]
147
+ })).length > 0) return e("history");
148
+ let S = {
149
+ id: P("crrb", E),
150
+ revision: 1,
151
+ previousBindingId: null,
152
+ definition: _,
153
+ origin: x,
154
+ boundAt: y
155
+ };
156
+ return await I(l, g, S), await l.insert(T, {
157
+ id: P("crrh", T),
158
+ ...g,
159
+ revision: 1,
160
+ bindingId: S.id
161
+ }), await r(l, g), await f(l, g, {
162
+ expectedRevision: 0,
163
+ sourceDigest: u({
164
+ scope: g,
165
+ binding: S,
166
+ origin: "fresh-source-namespace"
167
+ }),
168
+ routes: []
169
+ }), S;
170
+ }, z = async (t, r, a) => {
171
+ let o = A(r), s = p(a.definition), c = a.expectedRevision;
172
+ if (!N(c) || c === 2147483647) return e("revision");
173
+ if (!Number.isSafeInteger(a.now) || a.now < 0 || a.now > 864e13) return e("bounds");
174
+ if (s.site.id !== o.site || !s.site.environments.includes(o.environment)) return e("scope");
175
+ await n(t, o), await i(t, o);
176
+ let l = await L(t, o);
177
+ if (l === null) return e("configuration");
178
+ if (l.revision !== c) return e("revision");
179
+ if (w(l.definition) === w(s)) return l;
180
+ let u = {
181
+ id: P("crrb", E),
182
+ revision: c + 1,
183
+ previousBindingId: l.id,
184
+ definition: s,
185
+ origin: { ...l.origin },
186
+ boundAt: a.now
187
+ };
188
+ return await I(t, o, u), await t.updateMany("_voltro_cms_public_route_registry_heads", {
189
+ revision: u.revision,
190
+ bindingId: u.id
191
+ }, { where: m(j(o), h("revision", c), h("bindingId", l.id)) }) === 1 ? u : e("revision");
192
+ };
193
+ export { E as PUBLIC_ROUTE_REGISTRY_BINDINGS, T as PUBLIC_ROUTE_REGISTRY_HEADS, z as advancePublicRouteDefinition, R as bindInitialPublicRouteDefinition, k as publicRouteRegistryBindingTables, O as publicRouteRegistryBindingsTable, D as publicRouteRegistryHeadsTable, L as readPublicRouteBinding };
@@ -0,0 +1,75 @@
1
+ import { PublicRouteRegistryUnavailable as e, publicRouteRegistryFail as t } from "./publicRouteRegistry.js";
2
+ import { compileSiteDelivery as n } from "./siteDelivery.js";
3
+ import { defineContentLocations as r } from "./contentLocations.js";
4
+ import { outputActivationHash as i } from "./outputActivation.js";
5
+ import { compileContentRouteTypes as a } from "./contentRouteTypes.js";
6
+ import { copySnapshotResource as o } from "./buildSnapshot.js";
7
+ import { compileSnapshotRouting as s } from "./snapshotRouting.js";
8
+ import { copySnapshotAppCodePin as c } from "./snapshotDefinitions.js";
9
+ import { canonicalJson as l } from "@voltro/runtime";
10
+ // src/publicRouteRegistryDefinition.ts
11
+ var u = (e, n) => typeof e != "object" || !e || Array.isArray(e) || Object.keys(e).sort().join(",") !== n ? t("definition") : e, d = (e) => typeof e == "string" && /^[A-Za-z][A-Za-z0-9_.-]{0,63}$/.test(e), f = (e, n, r) => r === null ? e !== null || n !== null ? t("definition") : {
12
+ definition: null,
13
+ discovery: null
14
+ } : s(e, n, r), p = (a) => {
15
+ try {
16
+ let e = u(o({
17
+ key: "route-definition",
18
+ value: a
19
+ }).value, "app,definitionDigest,routing,site,types,version");
20
+ if (e.version !== 1 || !Array.isArray(e.types) || e.types.length === 0) return t("definition");
21
+ let s = e.app === null ? null : c(e.app), p = n(e.site).definition, m = u(e.routing, "definition,discovery"), h = f(m.definition, m.discovery, s), g = [], _ = "";
22
+ for (let n of e.types) {
23
+ let e = u(n, "locations,name,tree");
24
+ if (!d(e.name) || e.name <= _ || !Array.isArray(e.locations)) return t("definition");
25
+ _ = e.name;
26
+ let i = r(e.locations), a = null;
27
+ if (e.tree !== null) {
28
+ let n = u(e.tree, "parent,segment");
29
+ if (!d(n.parent) || !d(n.segment)) return t("definition");
30
+ a = {
31
+ parent: n.parent,
32
+ segment: n.segment
33
+ };
34
+ }
35
+ g.push({
36
+ name: e.name,
37
+ locations: i,
38
+ tree: a
39
+ });
40
+ }
41
+ let v = {
42
+ version: 1,
43
+ app: s,
44
+ site: p,
45
+ types: g,
46
+ routing: h,
47
+ definitionDigest: i({
48
+ site: p,
49
+ types: g,
50
+ routing: h
51
+ })
52
+ };
53
+ return l(v) === l(e) ? v : t("definition");
54
+ } catch (n) {
55
+ if (n instanceof e) throw n;
56
+ return t("definition");
57
+ }
58
+ }, m = (e) => {
59
+ let r = a(e.types);
60
+ if (!r.ok) return t("definition");
61
+ let o = e.app === null ? null : c(e.app), s = n(e.site).definition, l = f(e.routing.definition, e.routing.discovery, o), u = r.types;
62
+ return p({
63
+ version: 1,
64
+ app: o,
65
+ site: s,
66
+ types: u,
67
+ routing: l,
68
+ definitionDigest: i({
69
+ site: s,
70
+ types: u,
71
+ routing: l
72
+ })
73
+ });
74
+ };
75
+ export { m as compilePublicRouteRegistryDefinition, f as compilePublicRouteRouting, p as copyPublicRouteRegistryDefinition };
@@ -0,0 +1,39 @@
1
+ import { publicRouteRegistryFail as e } from "./publicRouteRegistry.js";
2
+ import { copySiteScope as t } from "./siteState.js";
3
+ import { invalidatePublicationRelease as n, lockPublicationStream as r } from "./changes.js";
4
+ import { queryPublicRouteIntegrity as i } from "./publicRouteIntegrity.js";
5
+ import { PUBLIC_ROUTE_REGISTRY_HEADS as a } from "./publicRouteRegistryBinding.js";
6
+ import { reconcilePublicRouteNamespace as o } from "./publicRouteNamespace.js";
7
+ import { and as s, eq as c, gt as l } from "@voltro/database";
8
+ // src/publicRouteSitePublication.ts
9
+ var u = async (u, d) => {
10
+ let f = t(d), p = /* @__PURE__ */ new Set(), m;
11
+ for (;;) {
12
+ let t = await i(u, {
13
+ table: a,
14
+ predicate: s(c("tenantId", f.tenantId), c("site", f.site), ...m === void 0 ? [] : [l("id", m)]),
15
+ lock: "update",
16
+ order: [{
17
+ column: "id",
18
+ direction: "asc"
19
+ }],
20
+ take: 200,
21
+ skip: void 0,
22
+ projection: void 0
23
+ });
24
+ if (t.length === 0) break;
25
+ for (let n of t) {
26
+ if (typeof n.id != "string" || n.id <= (m ?? "") || typeof n.environment != "string" || !/^[a-z][a-z0-9_-]{0,63}$/.test(n.environment) || p.has(n.environment) || n.tenantId !== f.tenantId || n.site !== f.site) return e("state");
27
+ if (p.size >= 1e4) return e("bounds");
28
+ m = n.id, p.add(n.environment);
29
+ }
30
+ }
31
+ for (let e of [...p].sort()) {
32
+ let t = {
33
+ ...f,
34
+ environment: e
35
+ };
36
+ await r(u, t), await n(u, t), await o(u, t);
37
+ }
38
+ };
39
+ export { u as reconcileDomainPublication };
@@ -0,0 +1,12 @@
1
+ import { cmsSiteStateHeadsTable as e } from "./siteState.js";
2
+ import { publicRouteHistoryTables as t } from "./publicRouteHistoryStore.js";
3
+ import { publicRouteRegistryBindingTables as n } from "./publicRouteRegistryBinding.js";
4
+ import { cmsSiteDomainsTable as r } from "./domains.js";
5
+ // src/publicRouteTables.ts
6
+ var i = [
7
+ e,
8
+ ...n,
9
+ ...t,
10
+ r
11
+ ];
12
+ export { i as cmsPublicRouteTables };
@@ -0,0 +1,17 @@
1
+ import { normalizeHost as e } from "./domainHost.js";
2
+ import { CmsPublicBuildUnavailable as t, canonicalCmsPublicPath as n } from "./publicBuild.js";
3
+ // src/publicRouteUrl.ts
4
+ var r = (r) => {
5
+ let i = () => {
6
+ throw new t("request");
7
+ };
8
+ if (typeof r != "string" || r.length > 4400) return i();
9
+ try {
10
+ let t = new URL(r);
11
+ if (t.protocol !== "https:" || t.host !== e(t.host) || t.host !== t.hostname || t.origin + t.pathname !== r || n(t.pathname) !== t.pathname) return i();
12
+ } catch {
13
+ return i();
14
+ }
15
+ return r;
16
+ };
17
+ export { r as copyCanonicalPublicRouteUrl };
@@ -0,0 +1,51 @@
1
+ import { ContentSeoUnavailable as e } from "./errors.js";
2
+ import { resolveContentSeo as t } from "./contentSeo.js";
3
+ import { defineSiteDelivery as n } from "./siteDelivery.js";
4
+ // src/publicationSeo.ts
5
+ var r = (t) => {
6
+ let r = () => {
7
+ throw new e({ reason: "definition" });
8
+ };
9
+ if (!Array.isArray(t) || t.length < 1 || t.length > 128 || Object.getOwnPropertySymbols(t).length || Object.getOwnPropertyNames(t).length !== t.length + 1) return r();
10
+ let i = Array.from({ length: t.length }, (e, i) => {
11
+ let a = Object.getOwnPropertyDescriptor(t, String(i));
12
+ return a === void 0 || !a.enumerable || !("value" in a) ? r() : n(a.value);
13
+ });
14
+ return new Set(i.map((e) => e.id)).size === i.length ? Object.freeze(i) : r();
15
+ }, i = (n, i, a) => {
16
+ if (n.seo === void 0) {
17
+ if (n.seoSites !== void 0) throw new e({ reason: "definition" });
18
+ return null;
19
+ }
20
+ if (n.seoSites === void 0) return t(n.seo, i);
21
+ let o = r(n.seoSites).find((e) => e.id === a.site), s = o?.locales.find((e) => e.contentLocale === a.locale);
22
+ if (o === void 0 || !o.environments.includes(a.environment) || s === void 0) throw new e({ reason: "scope" });
23
+ let c = o.seo !== void 0 && Object.hasOwn(o.seo, s.id) ? o.seo[s.id] : void 0;
24
+ return t(n.seo, i, c);
25
+ }, a = (t, n, r) => {
26
+ let a;
27
+ try {
28
+ a = i(t, n, r);
29
+ } catch (t) {
30
+ if (!(t instanceof e)) throw t;
31
+ return [{
32
+ field: "$seo",
33
+ rule: `seo.${t.reason}`,
34
+ message: "SEO metadata could not be resolved for this publication scope."
35
+ }];
36
+ }
37
+ if (a === null || t.seo === void 0) return [];
38
+ let o = t.seo, s = {
39
+ title: o.title.fields[0],
40
+ description: o.description?.fields[0],
41
+ "social.title": o.social?.title?.fields[0],
42
+ "social.description": o.social?.description?.fields[0],
43
+ "structuredData.title": o.structuredData?.title
44
+ };
45
+ return a.findings.flatMap((e) => e.kind === "recommendation" ? [] : [{
46
+ field: e.field ?? s[e.target] ?? "$seo",
47
+ rule: `seo.${e.rule}`,
48
+ message: e.kind === "missing" ? `SEO ${e.target} is required for publication.` : `SEO ${e.target} contains an invalid ${e.rule} value.`
49
+ }]);
50
+ };
51
+ export { r as defineContentSeoSites, i as resolveScopedContentSeo, a as seoPublishViolations };
@@ -0,0 +1,295 @@
1
+ import { readPublicationBoundary as e } from "./changes.js";
2
+ import { pickDeclared as t, readContentModificationTime as n } from "./contentValues.js";
3
+ import { Schema as r } from "effect";
4
+ import { and as i, eq as a, gt as o, id as s, integer as c, json as l, or as u, table as d, text as f, timestamp as p } from "@voltro/database";
5
+ import { tenant as m } from "@voltro/plugin-multitenancy/mixin";
6
+ import { createHash as h } from "node:crypto";
7
+ import { canonicalJson as g } from "@voltro/runtime";
8
+ // src/publicationState.ts
9
+ var _ = class extends r.TaggedError()("PublicationStateUnavailable", { reason: r.Literals([
10
+ "scope",
11
+ "types",
12
+ "locales",
13
+ "expiry",
14
+ "state",
15
+ "expired",
16
+ "publication",
17
+ "cursor",
18
+ "query"
19
+ ]) }) {}, v = "_voltro_cms_publication_states", y = "_voltro_cms_publication_state_entries", b = d(v, {
20
+ id: s({ prefix: "cstate" }),
21
+ site: f().maxLength(64),
22
+ environment: f().maxLength(64),
23
+ state: f().oneOf(["capturing", "sealed"]),
24
+ checkpoint: f().maxLength(64).nullable(),
25
+ generation: f().maxLength(20),
26
+ releaseId: f().maxLength(64).nullable(),
27
+ types: l(),
28
+ locales: l(),
29
+ capturedAt: p(),
30
+ expiresAt: p(),
31
+ entries: c().default(0),
32
+ digest: f().maxLength(64).default("")
33
+ }).with(m()), x = d(y, {
34
+ id: s({ prefix: "cpub" }),
35
+ stateId: f().maxLength(64),
36
+ site: f().maxLength(64),
37
+ environment: f().maxLength(64),
38
+ contentType: f().maxLength(64),
39
+ variantId: f().maxLength(64),
40
+ documentId: f().maxLength(64),
41
+ locale: f().maxLength(64),
42
+ revisionId: f().maxLength(64),
43
+ revision: c(),
44
+ values: l(),
45
+ modifiedAt: f().maxLength(32).nullable(),
46
+ digest: f().maxLength(64)
47
+ }).with(m()).index("cms_pubstate_entries_page", [
48
+ "tenantId",
49
+ "stateId",
50
+ "contentType",
51
+ "locale",
52
+ "variantId"
53
+ ]).index("cms_pubstate_entries_document", [
54
+ "tenantId",
55
+ "stateId",
56
+ "contentType",
57
+ "locale",
58
+ "documentId"
59
+ ]).unique("cms_pubstate_entries_variant", [
60
+ "tenantId",
61
+ "stateId",
62
+ "contentType",
63
+ "variantId"
64
+ ]), S = (e) => {
65
+ throw new _({ reason: e });
66
+ }, C = (e) => typeof e == "string" && e.trim().length > 0, w = (e) => [
67
+ e.tenantId,
68
+ e.site,
69
+ e.environment
70
+ ].every(C) ? i(a("tenantId", e.tenantId), a("site", e.site), a("environment", e.environment)) : S("scope"), T = (e) => Array.isArray(e) && e.every(C), E = (e) => h("sha256").update(g(e)).digest("hex"), D = (e) => {
71
+ let t = n(e);
72
+ return t.ok ? t.value : S("publication");
73
+ }, O = (e) => ({
74
+ contentType: e.contentType,
75
+ variantId: e.variantId,
76
+ documentId: e.documentId,
77
+ locale: e.locale,
78
+ revisionId: e.revisionId,
79
+ revision: e.revision,
80
+ values: e.values,
81
+ modifiedAt: D(e.modifiedAt)
82
+ }), k = async (n, r, s, c) => {
83
+ let l = w(s), d = r.map((e) => e.name).sort();
84
+ if (r.length === 0 || !d.every(C) || new Set(d).size !== d.length) return S("types");
85
+ if (!T(c.locales) || c.locales.length === 0 || new Set(c.locales).size !== c.locales.length) return S("locales");
86
+ let f = [...c.locales].sort(), p = c.now ?? Date.now();
87
+ if (!Number.isSafeInteger(p) || !Number.isFinite(new Date(p).getTime()) || !Number.isSafeInteger(c.expiresAt) || c.expiresAt <= p || !Number.isFinite(new Date(c.expiresAt).getTime())) return S("expiry");
88
+ let { checkpoint: m, generation: _, releaseId: b } = await e(n, s), x = await n.insert(v, {
89
+ ...s,
90
+ state: "capturing",
91
+ checkpoint: m,
92
+ generation: _,
93
+ releaseId: b,
94
+ types: d,
95
+ locales: f,
96
+ capturedAt: new Date(p),
97
+ expiresAt: new Date(c.expiresAt),
98
+ entries: 0,
99
+ digest: ""
100
+ }), O = String(x.id), k = h("sha256").update(g({
101
+ version: 3,
102
+ scope: s,
103
+ types: d,
104
+ locales: f,
105
+ checkpoint: m,
106
+ generation: _,
107
+ releaseId: b
108
+ }) + "\n"), A = 0;
109
+ for (let e of [...r].sort((e, t) => e.name < t.name ? -1 : +(e.name > t.name))) {
110
+ let r;
111
+ for (;;) {
112
+ let c = await n.query({
113
+ table: `${e.name}_published`,
114
+ lock: "update",
115
+ predicate: i(l, a("status", "published"), u(...f.map((e) => a("locale", e))), ...r === void 0 ? [] : [o("id", r)]),
116
+ order: [{
117
+ column: "id",
118
+ direction: "asc"
119
+ }],
120
+ take: 500,
121
+ skip: void 0,
122
+ projection: void 0
123
+ });
124
+ if (c.length === 0) break;
125
+ let d = c.map((n) => {
126
+ if (![
127
+ n.id,
128
+ n.documentId,
129
+ n.revisionId,
130
+ n.locale
131
+ ].every(C) || !Number.isSafeInteger(n.revision) || Number(n.revision) < 1) return S("publication");
132
+ let r = JSON.parse(JSON.stringify(t(e, n))), i = {
133
+ contentType: e.name,
134
+ variantId: n.id,
135
+ documentId: n.documentId,
136
+ locale: n.locale,
137
+ revisionId: n.revisionId,
138
+ revision: n.revision,
139
+ values: r,
140
+ modifiedAt: D(n.updatedAt)
141
+ }, a = E(i);
142
+ return k.update(a + "\n"), {
143
+ ...s,
144
+ stateId: O,
145
+ ...i,
146
+ digest: a
147
+ };
148
+ });
149
+ await n.insertMany(y, d, { returning: "none" }), A += c.length, r = String(c[c.length - 1].id);
150
+ }
151
+ }
152
+ let j = {
153
+ entries: A,
154
+ digest: k.digest("hex")
155
+ };
156
+ return await n.update(v, O, {
157
+ state: "sealed",
158
+ ...j
159
+ }), {
160
+ id: O,
161
+ checkpoint: m,
162
+ generation: _,
163
+ releaseId: b,
164
+ ...j
165
+ };
166
+ }, A = async (e, t, n, r, o, s) => {
167
+ let [c] = await e.query({
168
+ table: v,
169
+ predicate: i(w(t), a("id", n)),
170
+ order: [],
171
+ take: 1,
172
+ skip: void 0,
173
+ projection: void 0
174
+ });
175
+ if (c === void 0 || c.state !== "sealed" || !T(c.types) || !c.types.includes(r) || !T(c.locales) || !c.locales.includes(o) || typeof c.digest != "string" || !/^[0-9a-f]{64}$/.test(c.digest) || !Number.isSafeInteger(c.entries) || Number(c.entries) < 0) return S("state");
176
+ let l = c.expiresAt instanceof Date ? c.expiresAt.getTime() : new Date(String(c.expiresAt)).getTime();
177
+ if (!Number.isFinite(s) || !Number.isFinite(l)) return S("state");
178
+ if (l <= s) return S("expired");
179
+ }, j = (e) => e.digest !== E(O(e)) || e.values === null || typeof e.values != "object" || Array.isArray(e.values) ? S("publication") : structuredClone({
180
+ ...e.values,
181
+ id: e.variantId,
182
+ documentId: e.documentId,
183
+ revisionId: e.revisionId,
184
+ revision: e.revision,
185
+ tenantId: e.tenantId,
186
+ site: e.site,
187
+ environment: e.environment,
188
+ locale: e.locale,
189
+ status: "published"
190
+ }), M = async (e, t, n, r, o, s, c = Date.now()) => {
191
+ await A(e, t, n, r, o, c);
192
+ let [l] = await e.query({
193
+ table: y,
194
+ predicate: i(w(t), a("stateId", n), a("contentType", r), a("locale", o), a("variantId", s)),
195
+ order: [],
196
+ take: 1,
197
+ skip: void 0,
198
+ projection: void 0
199
+ });
200
+ return l === void 0 ? null : j(l);
201
+ }, N = async (e, t, n, r, o, s, c = Date.now()) => {
202
+ if (!C(s)) return S("query");
203
+ await A(e, t, n, r, o, c);
204
+ let l = await e.query({
205
+ table: y,
206
+ predicate: i(w(t), a("stateId", n), a("contentType", r), a("locale", o), a("documentId", s)),
207
+ order: [],
208
+ take: 2,
209
+ skip: void 0,
210
+ projection: void 0
211
+ });
212
+ return l.length > 1 ? S("publication") : l[0] === void 0 ? null : {
213
+ content: j(l[0]),
214
+ modifiedAt: D(l[0].modifiedAt)
215
+ };
216
+ }, P = async (e, t, n, r, i, a, o = Date.now()) => (await N(e, t, n, r, i, a, o))?.content ?? null, F = async (e, t, n, r, s, c = {}) => {
217
+ await A(e, t, n, r, s, c.now ?? Date.now());
218
+ let l = c.limit ?? 100;
219
+ if (!Number.isSafeInteger(l) || l < 1 || l > 200) return S("query");
220
+ let u = i(w(t), a("stateId", n), a("contentType", r), a("locale", s)), d;
221
+ if (c.after !== void 0) {
222
+ let [t] = await e.query({
223
+ table: y,
224
+ predicate: i(u, a("id", c.after)),
225
+ order: [],
226
+ take: 1,
227
+ skip: void 0,
228
+ projection: ["variantId"]
229
+ });
230
+ if (t === void 0 || !C(t.variantId)) return S("cursor");
231
+ d = t.variantId;
232
+ }
233
+ let f = await e.query({
234
+ table: y,
235
+ predicate: i(u, ...d === void 0 ? [] : [o("variantId", d)]),
236
+ order: [{
237
+ column: "variantId",
238
+ direction: "asc"
239
+ }],
240
+ take: l + 1,
241
+ skip: void 0,
242
+ projection: void 0
243
+ }), p = f.slice(0, l);
244
+ return {
245
+ items: p.map(j),
246
+ next: f.length > l ? String(p[p.length - 1].id) : null
247
+ };
248
+ }, I = async (e, t, n, r = Date.now()) => {
249
+ let [s] = await e.query({
250
+ table: v,
251
+ predicate: i(w(t), a("id", n.id)),
252
+ order: [],
253
+ take: 1,
254
+ skip: void 0,
255
+ projection: void 0
256
+ });
257
+ if (s === void 0 || !T(s.types) || !T(s.locales) || s.types.length === 0 || s.locales.length === 0 || s.checkpoint !== n.checkpoint || s.generation !== n.generation || s.releaseId !== n.releaseId || !/^[0-9]{20}$/.test(n.generation) || n.releaseId !== null && !C(n.releaseId) || s.entries !== n.entries || s.digest !== n.digest) return S("state");
258
+ await A(e, t, n.id, s.types[0], s.locales[0], r);
259
+ let c = h("sha256").update(g({
260
+ version: 3,
261
+ scope: t,
262
+ types: s.types,
263
+ locales: s.locales,
264
+ checkpoint: s.checkpoint,
265
+ generation: s.generation,
266
+ releaseId: s.releaseId
267
+ }) + "\n"), l = 0;
268
+ for (let r of s.types) {
269
+ let u;
270
+ for (;;) {
271
+ let d = await e.query({
272
+ table: y,
273
+ predicate: i(w(t), a("stateId", n.id), a("contentType", r), ...u === void 0 ? [] : [o("variantId", u)]),
274
+ order: [{
275
+ column: "variantId",
276
+ direction: "asc"
277
+ }],
278
+ take: 500,
279
+ skip: void 0,
280
+ projection: void 0
281
+ });
282
+ if (d.length === 0) break;
283
+ for (let e of d) {
284
+ if (!C(e.variantId) || !s.locales.includes(String(e.locale))) return S("publication");
285
+ j(e), c.update(String(e.digest) + "\n"), l++;
286
+ }
287
+ u = String(d[d.length - 1].variantId);
288
+ }
289
+ }
290
+ return l !== n.entries || c.digest("hex") !== n.digest ? S("publication") : {
291
+ types: [...s.types],
292
+ locales: [...s.locales]
293
+ };
294
+ };
295
+ export { v as PUBLICATION_STATES_TABLE, y as PUBLICATION_STATE_ENTRIES_TABLE, _ as PublicationStateUnavailable, k as capturePublicationState, F as pageCapturedPublications, x as publicationStateEntriesTable, b as publicationStatesTable, P as readCapturedDocument, N as readCapturedDocumentEntry, M as readCapturedPublication, I as verifyPublicationState };