@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
package/dist/changes.js CHANGED
@@ -1,82 +1,299 @@
1
- import { asTyped as e } from "./effectForm.js";
2
- import { and as t, eq as n, gt as r, id as i, integer as a, lt as o, table as s, text as c, timestamp as l } from "@voltro/database";
3
- import { tenant as u } from "@voltro/plugin-multitenancy/mixin";
4
- //#region src/changes.ts
5
- var d = "cms_changes", f = s(d, {
6
- id: i({ prefix: "cchg" }),
7
- site: c().maxLength(64),
8
- environment: c().maxLength(64),
9
- locale: c().maxLength(64),
10
- contentType: c().maxLength(64),
11
- documentId: c().maxLength(64),
12
- variantId: c().maxLength(64),
13
- action: c().oneOf(["published", "unpublished"]),
14
- revision: a().nullable(),
15
- releaseId: c().nullable(),
16
- at: l()
17
- }).with(u()).index("cms_changes_by_place", [
1
+ import { ChangeFeedUnavailable as e, SiteStateUnavailable as t } from "./errors.js";
2
+ import { asTyped as n } from "./effectForm.js";
3
+ import { lockSiteState as r } from "./siteState.js";
4
+ import { and as i, eq as a, generateId as o, gt as s, id as c, integer as l, isNull as u, lte as d, table as f, text as p, timestamp as m } from "@voltro/database";
5
+ import { tenant as h } from "@voltro/plugin-multitenancy/mixin";
6
+ // src/changes.ts
7
+ var g = "cms_changes", _ = "_voltro_cms_change_heads", v = "00000000000000000000", y = f(_, {
8
+ id: c({ prefix: "cseq" }),
9
+ site: p().maxLength(64),
10
+ environment: p().maxLength(64),
11
+ position: p().maxLength(20).default(v),
12
+ generation: p().maxLength(20).default(v),
13
+ releaseId: p().maxLength(64).nullable()
14
+ }).with(h()).unique("cms_change_heads_scope", [
15
+ "tenantId",
16
+ "site",
17
+ "environment"
18
+ ]), b = (t) => {
19
+ if (!t.tenantId || !t.site || !t.environment) throw new e({ reason: "scope" });
20
+ return i(a("tenantId", t.tenantId), a("site", t.site), a("environment", t.environment));
21
+ }, x = (t) => {
22
+ if (typeof t != "string" || !/^[0-9]{20}$/.test(t)) throw new e({ reason: "migration" });
23
+ return t;
24
+ }, S = (t) => {
25
+ let n = (BigInt(x(t)) + 1n).toString();
26
+ if (n.length > 20) throw new e({ reason: "exhausted" });
27
+ return n.padStart(20, "0");
28
+ }, C = async (n, i) => {
29
+ let a = b(i);
30
+ try {
31
+ await r(n, i);
32
+ } catch (n) {
33
+ throw n instanceof t ? new e({ reason: n.reason === "scope" || n.reason === "state" ? "scope" : "migration" }) : n;
34
+ }
35
+ let s = {
36
+ table: _,
37
+ predicate: a,
38
+ lock: "update",
39
+ order: [],
40
+ take: 1,
41
+ skip: void 0,
42
+ projection: void 0
43
+ }, [c] = await n.query(s);
44
+ if (c !== void 0) return c;
45
+ let l = o({
46
+ kind: "typeid",
47
+ prefix: "cseq"
48
+ }, _);
49
+ if (l === null) throw Error("Change feed head requires a generated ID");
50
+ await n.insertIgnore(_, {
51
+ id: l,
52
+ ...i,
53
+ position: v,
54
+ generation: v,
55
+ releaseId: null
56
+ }, { conflictColumns: [
57
+ "tenantId",
58
+ "site",
59
+ "environment"
60
+ ] });
61
+ let [u] = await n.query(s);
62
+ if (u === void 0) throw new e({ reason: "scope" });
63
+ return u;
64
+ }, w = (e, t, n, r) => e.query({
65
+ ...r === void 0 ? {} : { lock: r },
66
+ table: g,
67
+ predicate: i(b(t), u("position")),
68
+ order: [{
69
+ column: "id",
70
+ direction: "asc"
71
+ }],
72
+ take: n,
73
+ skip: void 0,
74
+ projection: ["id"]
75
+ }), T = async (t, n) => {
76
+ let r = await C(t, n), i = x(r.position), a = 0;
77
+ for (;;) {
78
+ let r = await w(t, n, 500);
79
+ if (r.length === 0) break;
80
+ if (a === 0 && i !== v) throw new e({ reason: "migration" });
81
+ for (let e of r) i = S(i), await t.update(g, String(e.id), { position: i }), a++;
82
+ }
83
+ return a > 0 && await t.update(_, String(r.id), { position: i }), a;
84
+ }, E = f(g, {
85
+ id: c({ prefix: "cchg" }),
86
+ site: p().maxLength(64),
87
+ environment: p().maxLength(64),
88
+ locale: p().maxLength(64),
89
+ contentType: p().maxLength(64),
90
+ documentId: p().maxLength(64),
91
+ variantId: p().maxLength(64),
92
+ action: p().oneOf(["published", "unpublished"]),
93
+ revision: l().nullable(),
94
+ releaseId: p().nullable(),
95
+ at: m(),
96
+ position: p().maxLength(20).nullable()
97
+ }).with(h()).index("cms_changes_by_position", [
98
+ "tenantId",
99
+ "site",
100
+ "environment",
101
+ "position"
102
+ ]).index("cms_changes_by_variant_position", [
103
+ "tenantId",
18
104
  "site",
19
105
  "environment",
20
- "id"
21
- ]), p = async (e, t, n, r, i, a = {}) => {
22
- if (t.changeFeed !== !0) return;
23
- let o = n.tenantId;
24
- await e.insert(d, {
25
- site: r.site,
26
- environment: r.environment,
27
- locale: r.locale,
28
- contentType: t.name,
29
- documentId: String(n.documentId),
30
- variantId: String(n.id),
31
- action: i,
32
- revision: i === "published" && typeof n.revision == "number" ? n.revision : null,
33
- releaseId: a.releaseId ?? null,
106
+ "contentType",
107
+ "variantId",
108
+ "locale",
109
+ "position"
110
+ ]), D = async (t, n, r, i, a, o = {}) => {
111
+ let s = r.tenantId;
112
+ if (typeof s != "string" || s === "") throw new e({ reason: "scope" });
113
+ let c = {
114
+ tenantId: s,
115
+ site: i.site,
116
+ environment: i.environment
117
+ }, l = await L(t, c, null);
118
+ if (n.changeFeed !== !0) return;
119
+ if ((await w(t, c, 1)).length > 0) throw new e({ reason: "migration" });
120
+ let u = S(l.position);
121
+ await t.update(_, String(l.id), { position: u }), await t.insert(g, {
122
+ site: i.site,
123
+ environment: i.environment,
124
+ locale: i.locale,
125
+ contentType: n.name,
126
+ documentId: String(r.documentId),
127
+ variantId: String(r.id),
128
+ action: a,
129
+ revision: a === "published" && typeof r.revision == "number" ? r.revision : null,
130
+ releaseId: o.releaseId ?? null,
34
131
  at: /* @__PURE__ */ new Date(),
35
- ...o == null ? {} : { tenantId: o }
132
+ position: u,
133
+ tenantId: s
36
134
  });
37
- }, m = (e) => e instanceof Date ? e.getTime() : typeof e == "string" ? Date.parse(e) : Number(e), h = async (e, i, a = {}) => {
38
- let s = Math.max(1, Math.min(1e3, Math.floor(a.limit ?? 100))), c = new Date((a.now ?? Date.now()) - (a.settleMs ?? 2e3)), l = (await e.query({
39
- table: d,
40
- predicate: t(n("site", i.site), n("environment", i.environment), o("at", c), ...a.after === void 0 ? [] : [r("id", a.after)], ...Object.entries(a.filter ?? {}).map(([e, t]) => n(e, t))),
135
+ }, O = (e) => e instanceof Date ? e.getTime() : typeof e == "string" ? Date.parse(e) : Number(e), k = async (t, n, r) => {
136
+ await C(t, r), await A(t, r);
137
+ let o = 0;
138
+ for (let c of n) {
139
+ if (c.changeFeed !== !0) continue;
140
+ let n;
141
+ for (;;) {
142
+ let l = await t.query({
143
+ table: `${c.name}_published`,
144
+ predicate: i(b(r), a("status", "archived"), ...n === void 0 ? [] : [s("id", n)]),
145
+ order: [{
146
+ column: "id",
147
+ direction: "asc"
148
+ }],
149
+ take: 500,
150
+ skip: void 0,
151
+ projection: void 0
152
+ });
153
+ if (l.length === 0) break;
154
+ for (let n of l) {
155
+ let s = n.locale;
156
+ if (typeof s != "string" || s === "") throw new e({ reason: "scope" });
157
+ let [l] = await t.query({
158
+ table: g,
159
+ predicate: i(b(r), a("contentType", c.name), a("variantId", String(n.id)), a("locale", s)),
160
+ order: [{
161
+ column: "position",
162
+ direction: "desc"
163
+ }],
164
+ take: 1,
165
+ skip: void 0,
166
+ projection: void 0
167
+ });
168
+ l !== void 0 && x(l.position), l?.action !== "unpublished" && (await D(t, c, n, {
169
+ site: r.site,
170
+ environment: r.environment,
171
+ locale: s
172
+ }, "unpublished"), o++);
173
+ }
174
+ n = String(l[l.length - 1].id);
175
+ }
176
+ }
177
+ return o;
178
+ }, A = async (t, n, r) => {
179
+ if ((await w(t, n, 1, r)).length > 0) throw new e({ reason: "migration" });
180
+ }, j = async (t, n, r) => {
181
+ let [o] = await t.query({
182
+ table: g,
183
+ predicate: i(b(n), a("id", r)),
184
+ order: [],
185
+ take: 1,
186
+ skip: void 0,
187
+ projection: ["position"]
188
+ });
189
+ if (o === void 0) throw new e({ reason: "cursor" });
190
+ return x(o.position);
191
+ }, M = (e) => ({
192
+ id: String(e.id),
193
+ at: O(e.at),
194
+ locale: String(e.locale),
195
+ contentType: String(e.contentType),
196
+ documentId: String(e.documentId),
197
+ variantId: String(e.variantId),
198
+ action: e.action === "unpublished" ? "unpublished" : "published",
199
+ revision: typeof e.revision == "number" ? e.revision : null,
200
+ releaseId: typeof e.releaseId == "string" ? e.releaseId : null
201
+ }), N = async (e, t, n) => {
202
+ await A(e, t, n);
203
+ let [r] = await e.query({
204
+ ...n === void 0 ? {} : { lock: n },
205
+ table: g,
206
+ predicate: b(t),
41
207
  order: [{
42
- column: "id",
208
+ column: "position",
209
+ direction: "desc"
210
+ }],
211
+ take: 1,
212
+ skip: void 0,
213
+ projection: ["id", "position"]
214
+ });
215
+ return r === void 0 ? null : (x(r.position), String(r.id));
216
+ }, P = (e, t) => N(e, t), F = (e, t) => N(e, t, "update"), I = (t) => {
217
+ let n = t.releaseId;
218
+ if (n !== null && (typeof n != "string" || n.length === 0)) throw new e({ reason: "migration" });
219
+ return n;
220
+ }, L = async (e, t, n) => {
221
+ let r = await C(e, t), i = S(r.generation);
222
+ return await e.update(_, String(r.id), {
223
+ generation: i,
224
+ releaseId: n
225
+ }), {
226
+ ...r,
227
+ generation: i,
228
+ releaseId: n
229
+ };
230
+ }, R = async (e, t) => {
231
+ await L(e, t, null);
232
+ }, z = async (e, t) => {
233
+ let n = await C(e, t);
234
+ return {
235
+ generation: x(n.generation),
236
+ releaseId: I(n),
237
+ checkpoint: await F(e, t)
238
+ };
239
+ }, B = async (t, n, r) => {
240
+ if (r.trim().length === 0) throw new e({ reason: "scope" });
241
+ return {
242
+ generation: x((await L(t, n, r)).generation),
243
+ releaseId: r,
244
+ checkpoint: await F(t, n)
245
+ };
246
+ }, V = async (e, t, n = 50) => {
247
+ await A(e, t);
248
+ let r = await e.query({
249
+ table: g,
250
+ predicate: b(t),
251
+ order: [{
252
+ column: "position",
253
+ direction: "desc"
254
+ }],
255
+ take: Math.max(1, Math.min(1e3, Math.floor(n))),
256
+ skip: void 0,
257
+ projection: void 0
258
+ });
259
+ for (let e of r) x(e.position);
260
+ return r.map(M);
261
+ }, H = async (t, n, r = {}) => {
262
+ let o = b(n), c = Math.max(1, Math.min(1e3, Math.floor(r.limit ?? 100)));
263
+ await A(t, n);
264
+ let l = r.after === void 0 ? void 0 : await j(t, n, r.after), u = r.through === void 0 ? void 0 : await j(t, n, r.through);
265
+ if (l !== void 0 && u !== void 0 && l > u) throw new e({ reason: "cursor" });
266
+ let f = new Date((r.now ?? Date.now()) - (r.settleMs ?? 2e3)), p = await t.query({
267
+ table: g,
268
+ predicate: i(o, ...l === void 0 ? [] : [s("position", l)], ...u === void 0 ? [] : [d("position", u)], ...Object.entries(r.filter ?? {}).map(([e, t]) => a(e, t))),
269
+ order: [{
270
+ column: "position",
43
271
  direction: "asc"
44
272
  }],
45
- take: s,
273
+ take: c,
46
274
  skip: void 0,
47
275
  projection: void 0
48
- })).map((e) => ({
49
- id: String(e.id),
50
- at: m(e.at),
51
- locale: String(e.locale),
52
- contentType: String(e.contentType),
53
- documentId: String(e.documentId),
54
- variantId: String(e.variantId),
55
- action: e.action === "unpublished" ? "unpublished" : "published",
56
- revision: typeof e.revision == "number" ? e.revision : null,
57
- releaseId: typeof e.releaseId == "string" ? e.releaseId : null
58
- }));
276
+ });
277
+ for (let e of p) x(e.position);
278
+ let m = r.settleMs === 0 ? -1 : p.findIndex((e) => O(e.at) >= f.getTime()), h = (m < 0 ? p : p.slice(0, m)).map(M);
59
279
  return {
60
- items: l,
61
- next: l.length > 0 ? l[l.length - 1].id : a.after ?? null
280
+ items: h,
281
+ next: h.length > 0 ? h[h.length - 1].id : r.after ?? null
62
282
  };
63
- }, g = async (e, r, i) => {
64
- let a = await e.query({
65
- table: d,
66
- predicate: t(n("site", i.site), n("environment", i.environment), n("locale", i.locale), n("contentType", r.contentType), n("documentId", r.documentId)),
283
+ }, U = async (e, t, n) => {
284
+ let r = await e.query({
285
+ table: g,
286
+ predicate: i(a("site", n.site), a("environment", n.environment), a("locale", n.locale), a("contentType", t.contentType), a("documentId", t.documentId)),
67
287
  order: [{
68
- column: "at",
69
- direction: "asc"
70
- }, {
71
- column: "id",
288
+ column: "position",
72
289
  direction: "asc"
73
290
  }],
74
291
  take: void 0,
75
292
  skip: void 0,
76
293
  projection: void 0
77
294
  }), o = [];
78
- for (let e of a) {
79
- let t = new Date(m(e.at)).toISOString(), n = o[o.length - 1];
295
+ for (let e of r) {
296
+ let t = new Date(O(e.at)).toISOString(), n = o[o.length - 1];
80
297
  n !== void 0 && n.to === null && (n.to = t), e.action === "published" && typeof e.revision == "number" && o.push({
81
298
  revision: e.revision,
82
299
  releaseId: typeof e.releaseId == "string" ? e.releaseId : null,
@@ -85,6 +302,5 @@ var d = "cms_changes", f = s(d, {
85
302
  });
86
303
  }
87
304
  return o;
88
- }, _ = (...t) => e(() => h(...t)), v = (...t) => e(() => g(...t)), y = (...t) => e(() => p(...t));
89
- //#endregion
90
- export { d as CMS_CHANGES_TABLE, f as cmsChangesTable, h as readChanges, _ as readChangesEffect, p as recordChange, y as recordChangeEffect, g as revisionTimeline, v as revisionTimelineEffect };
305
+ }, W = (...t) => n(() => H(...t), e), G = (...t) => n(() => P(...t), e), K = (...t) => n(() => V(...t), e), q = (...e) => n(() => U(...e)), J = (...t) => n(() => D(...t), e), Y = (...t) => n(() => T(...t), e), X = (...t) => n(() => k(...t), e);
306
+ export { g as CMS_CHANGES_TABLE, _ as CMS_CHANGE_HEADS_TABLE, B as activatePublicationRelease, y as cmsChangeHeadsTable, E as cmsChangesTable, T as initializeChangeFeed, Y as initializeChangeFeedEffect, R as invalidatePublicationRelease, C as lockPublicationStream, P as readChangeCheckpoint, G as readChangeCheckpointEffect, H as readChanges, W as readChangesEffect, z as readPublicationBoundary, F as readPublicationCheckpoint, V as readRecentChanges, K as readRecentChangesEffect, k as reconcileArchivedPublications, X as reconcileArchivedPublicationsEffect, D as recordChange, J as recordChangeEffect, U as revisionTimeline, q as revisionTimelineEffect };
@@ -3,7 +3,7 @@ import { hadAddress as t, redirectTarget as n } from "./redirects.js";
3
3
  import { usedBy as r } from "./references.js";
4
4
  import { verifyPreviewToken as i } from "./preview.js";
5
5
  import { and as a, eq as o, gt as s, gte as c, lt as l, lte as u, neq as d } from "@voltro/database";
6
- //#region src/cmsContext.ts
6
+ // src/cmsContext.ts
7
7
  var f = (e, t, n) => {
8
8
  switch (t) {
9
9
  case "=": return o(e, n);
@@ -225,5 +225,4 @@ var f = (e, t, n) => {
225
225
  if (e.cms === void 0) throw Error("useCms: `ctx.cms` is not set. Build it with cmsContext(store, types, { scope }) and attach it to your AppContext (or use createCmsClient at build time).");
226
226
  return e.cms;
227
227
  };
228
- //#endregion
229
228
  export { g as cmsContext, _ as createCmsClient, v as useCms };
@@ -2,7 +2,7 @@ import { asTyped as e } from "./effectForm.js";
2
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
3
  import { tenant as c } from "@voltro/plugin-multitenancy/mixin";
4
4
  import { createHash as l, randomBytes as u } from "node:crypto";
5
- //#region src/collections.ts
5
+ // src/collections.ts
6
6
  var d = "cms_collections", f = "cms_collection_items", p = "cms_collection_portals", m = 90, h = a(d, {
7
7
  id: r({ prefix: "ccol" }),
8
8
  site: o().maxLength(64),
@@ -220,5 +220,4 @@ var d = "cms_collections", f = "cms_collection_items", p = "cms_collection_porta
220
220
  reason: "limitReached"
221
221
  };
222
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
223
  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 };
package/dist/consent.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region src/consent.ts
1
+ // src/consent.ts
2
2
  var e = /^https:\/\/[a-z0-9.-]+(:\d+)?$/, t = (t) => {
3
3
  for (let n of t) {
4
4
  let t = /* @__PURE__ */ new Set();
@@ -11,7 +11,7 @@ var e = /^https:\/\/[a-z0-9.-]+(:\d+)?$/, t = (t) => {
11
11
  }, n = (t, n) => {
12
12
  let r = i(t, n);
13
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) => t[e.id] === e.version).map((e) => e.id)), a = (e, t, n) => Array.isArray(e) ? e.map((e) => {
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
15
  if (typeof e != "object" || !e) return e;
16
16
  let r = e, i = t.get(String(r.componentId))?.consent;
17
17
  return i === void 0 || n.has(i) ? e : {
@@ -20,10 +20,9 @@ var e = /^https:\/\/[a-z0-9.-]+(:\d+)?$/, t = (t) => {
20
20
  consentRequired: i,
21
21
  props: {}
22
22
  };
23
- }) : e, o = (e, t, n) => {
23
+ }) : e, s = (e, t, n) => {
24
24
  let r = { ...t };
25
- for (let [i, o] of Object.entries(e.fields)) o.kind === "components" && o.components !== void 0 && (r[i] = a(t[i], new Map(o.components.map((e) => [e.id, e])), n));
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
26
  return r;
27
- }, s = (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, n as consentedOrigins, o as gateConsent, i as grantedPurposes, s as purposesUsedBy };
27
+ }, c = (e) => new Set(Object.values(e.fields).flatMap((e) => (e.components ?? []).flatMap((e) => e.consent === void 0 ? [] : [e.consent])));
28
+ 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,52 @@
1
+ import { ContentLocationUnavailable as e } from "./errors.js";
2
+ import { encodeCanonicalPathSegment as t } from "./pathSegmentEncoding.js";
3
+ // 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
+ export { c as defineContentLocations, l as resolveContentLocation };
@@ -0,0 +1,82 @@
1
+ import { Schema as e } from "effect";
2
+ // 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
+ export { t as ContentProjectionUnavailable, s as defineContentProjection, c as projectContentValues };
@@ -0,0 +1,12 @@
1
+ import { createHash as e } from "node:crypto";
2
+ import { canonicalJson as t } from "@voltro/runtime";
3
+ // 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
+ export { n as contentRouteId };