@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,100 @@
1
+ //#region src/richInline.ts
2
+ var e = (e) => e.type === "text" ? e.marks ?? [] : [], t = (e) => e.type === "text" ? e.style : void 0, n = (e, t) => e.length === t.length && e.every((e) => t.includes(e)), r = (e, t, n, r) => ({
3
+ type: "text",
4
+ text: e,
5
+ ...t.length > 0 ? { marks: [...t].sort() } : {},
6
+ ...n === void 0 ? {} : { style: n },
7
+ ...r === void 0 ? {} : { change: r }
8
+ }), i = (n, i) => i === void 0 ? r(n, []) : r(n, e(i), t(i), i.change), a = (e, t) => e.change?.id === t.change?.id && e.change?.kind === t.change?.kind, o = (r) => {
9
+ let o = [];
10
+ for (let s of r) {
11
+ if (s.text === "") continue;
12
+ let r = o[o.length - 1];
13
+ s.type === "text" && r?.type === "text" && n(e(r), e(s)) && t(r) === t(s) && a(r, s) ? o[o.length - 1] = i(r.text + s.text, s) : o.push(s.type === "text" ? i(s.text, s) : s);
14
+ }
15
+ return o;
16
+ }, s = (e) => e.map((e) => e.text).join(""), c = (t, n, r, i) => {
17
+ if (r <= n) return !1;
18
+ let a = 0;
19
+ for (let o of t) {
20
+ let t = a;
21
+ if (a += o.text.length, !(a <= n || t >= r) && (o.type !== "text" || !e(o).includes(i))) return !1;
22
+ }
23
+ return !0;
24
+ }, l = (n, i, a, s) => {
25
+ if (a <= i) return n;
26
+ let l = c(n, i, a, s), u = [], d = 0;
27
+ for (let o of n) {
28
+ let n = d;
29
+ if (d += o.text.length, o.type !== "text" || d <= i || n >= a) {
30
+ u.push(o);
31
+ continue;
32
+ }
33
+ let c = Math.max(i, n) - n, f = Math.min(a, d) - n, p = e(o), m = t(o), h = l ? p.filter((e) => e !== s) : p.includes(s) ? p : [...p, s];
34
+ u.push(r(o.text.slice(0, c), p, m, o.change), r(o.text.slice(c, f), h, m, o.change), r(o.text.slice(f), p, m, o.change));
35
+ }
36
+ return o(u);
37
+ }, u = (e, t, n) => {
38
+ let a = [], o = 0;
39
+ for (let s of e) {
40
+ let e = o;
41
+ o += s.text.length;
42
+ let c = Math.max(t, e) - e, l = Math.min(n, o) - e;
43
+ l <= c || (s.type === "text" ? a.push(i(s.text.slice(c, l), s)) : a.push(c === 0 && l === s.text.length ? s : r(s.text.slice(c, l), [], void 0, s.change)));
44
+ }
45
+ return a;
46
+ }, d = (e, t, n, r) => {
47
+ let a = u(e, 0, t), [s] = n > t ? u(e, t, t + 1) : [], c = s ?? a[a.length - 1];
48
+ return o([
49
+ ...a,
50
+ i(r, c),
51
+ ...u(e, n, 2 ** 53 - 1)
52
+ ]);
53
+ }, f = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;"), p = (t) => t.map((t) => {
54
+ if (t.type === "link") return `<a data-target="${f(t.target)}">${f(t.text)}</a>`;
55
+ if (t.type === "contact") return `<a data-contact="${f("target" in t.contact ? `contact:${t.contact.target}` : `${t.contact.channel}:${t.contact.value}`)}">${f(t.text)}</a>`;
56
+ let n = f(t.text);
57
+ return e(t).includes("underline") && (n = `<u>${n}</u>`), e(t).includes("italic") && (n = `<em>${n}</em>`), e(t).includes("bold") && (n = `<strong>${n}</strong>`), t.style === void 0 ? n : `<span data-style="${f(t.style)}">${n}</span>`;
58
+ }).join(""), m = (e) => {
59
+ let t = e.indexOf(":"), n = e.slice(0, t), r = e.slice(t + 1);
60
+ return t <= 0 || r === "" ? null : n === "contact" ? { target: r } : n === "email" || n === "phone" ? {
61
+ channel: n,
62
+ value: r
63
+ } : null;
64
+ }, h = (e) => {
65
+ let t = [], n = (e, i, a) => {
66
+ if (e.nodeType === 3) {
67
+ t.push(r(e.textContent ?? "", i, a));
68
+ return;
69
+ }
70
+ if (e.nodeType !== 1) return;
71
+ let o = e.nodeName.toLowerCase();
72
+ if (o === "br") {
73
+ t.push(r("\n", i, a));
74
+ return;
75
+ }
76
+ if (o === "a" && e.getAttribute?.("data-target")) {
77
+ t.push({
78
+ type: "link",
79
+ target: e.getAttribute("data-target"),
80
+ text: e.textContent ?? ""
81
+ });
82
+ return;
83
+ }
84
+ let s = o === "a" ? m(e.getAttribute?.("data-contact") ?? "") : null;
85
+ if (s !== null) {
86
+ t.push({
87
+ type: "contact",
88
+ text: e.textContent ?? "",
89
+ contact: s
90
+ });
91
+ return;
92
+ }
93
+ let c = o === "strong" || o === "b" ? [.../* @__PURE__ */ new Set([...i, "bold"])] : o === "em" || o === "i" ? [.../* @__PURE__ */ new Set([...i, "italic"])] : o === "u" ? [.../* @__PURE__ */ new Set([...i, "underline"])] : i, l = o === "span" ? e.getAttribute?.("data-style") : null;
94
+ for (let t of Array.from(e.childNodes)) n(t, c, l != null && l !== "" ? l : a);
95
+ };
96
+ for (let t of Array.from(e.childNodes)) n(t, [], void 0);
97
+ return o(t);
98
+ };
99
+ //#endregion
100
+ export { c as hasMark, h as inlineFromDom, p as inlineHtml, s as inlineText, o as mergeInline, d as replaceText, u as sliceInline, l as toggleMark };
@@ -0,0 +1,44 @@
1
+ import { copyObservedRoutes as e } from "./routeHistoryStorage.js";
2
+ import { copyRouteDispositionDefinition as t, routeDispositionFail as n } from "./routeDispositions.js";
3
+ //#region src/routeDispositionGraph.ts
4
+ var r = (r) => {
5
+ let i = e(r.observed), a = e(r.current), o = e(r.sourceObserved ?? []), s = e(r.currentOwned ?? []), c = new Set(e(r.reserved ?? []).map((e) => e.url));
6
+ if (!Number.isSafeInteger(r.now) || r.now < 0 || r.now > 864e13) return n("input");
7
+ if (!Array.isArray(r.decisions) || r.decisions.length > 1e5 || Object.getOwnPropertySymbols(r.decisions).length !== 0 || Object.keys(r.decisions).length !== r.decisions.length) return n("bounds");
8
+ let l = /* @__PURE__ */ new Map();
9
+ for (let e = 0; e < r.decisions.length; e++) {
10
+ let i = Object.getOwnPropertyDescriptor(r.decisions, String(e));
11
+ if (i === void 0 || !i.enumerable || !("value" in i)) return n("input");
12
+ let a = t(i.value);
13
+ if (l.has(a.source.url)) return n("graph");
14
+ l.set(a.source.url, a);
15
+ }
16
+ let u = new Map(a.map((e) => [e.url, e.routeId])), d = new Map(s.map((e) => [e.url, e.routeId]));
17
+ for (let e of a) {
18
+ if (c.has(e.url) || d.has(e.url) && d.get(e.url) !== e.routeId) return n("graph");
19
+ d.set(e.url, e.routeId);
20
+ }
21
+ e([...d].map(([e, t]) => ({
22
+ url: e,
23
+ routeId: t
24
+ })));
25
+ let f = new Map(i.map((e) => [e.url, e.routeId])), p = /* @__PURE__ */ new Set();
26
+ for (let e of o) f.has(e.url) && f.get(e.url) !== e.routeId ? p.add(e.url) : f.set(e.url, e.routeId);
27
+ let m = e([...f].map(([e, t]) => ({
28
+ url: e,
29
+ routeId: t
30
+ })));
31
+ for (let e of l.values()) if (!f.has(e.source.url) && !d.has(e.source.url)) return n("graph");
32
+ let h = [];
33
+ for (let e of m) {
34
+ if (d.has(e.url) || c.has(e.url)) continue;
35
+ if (p.has(e.url)) return n("hold");
36
+ let t = l.get(e.url);
37
+ if (t === void 0 || t.source.routeId !== e.routeId || t.action.kind === "hold" || t.activeFrom !== null && r.now < t.activeFrom || t.activeUntil !== null && r.now >= t.activeUntil) return n("hold");
38
+ if (t.action.kind === "redirect" && u.get(t.action.target.url) !== t.action.target.routeId) return n("graph");
39
+ h.push(t);
40
+ }
41
+ return h;
42
+ };
43
+ //#endregion
44
+ export { r as planExactRouteDispositions };
@@ -0,0 +1,51 @@
1
+ import { RouteDispositionDefinitionSchema as e, RouteDispositionUnavailable as t } from "./routeDispositions.js";
2
+ import { cmsCredential as n, privateCmsHttpRoutes as r, privateCmsOperation as i } from "./privateCmsTransport.js";
3
+ import { Schema as a } from "effect";
4
+ import { strictInput as o } from "@voltro/protocol";
5
+ //#region src/routeDispositionRest.ts
6
+ var s = a.Struct({
7
+ revision: a.Int,
8
+ revisionId: a.String,
9
+ previousRevisionId: a.NullOr(a.String),
10
+ definition: e,
11
+ approvedAt: a.Int
12
+ }), c = {
13
+ namespace: "cms.routeDisposition",
14
+ path: "/v1/cms/route-dispositions",
15
+ operationPrefix: "cmsRouteDisposition",
16
+ tags: ["CMS route dispositions"],
17
+ error: t,
18
+ errorStatus: { RouteDispositionUnavailable: 409 },
19
+ credentialError: "RouteDispositionUnavailable"
20
+ }, l = (t) => {
21
+ let l = [i(c, "approve", "Approve one exact scoped route disposition", "Organization API-key bearer with the server-configured approval capability. Scope, authority and approval time come from the server. The expected revision is a CAS observation, never authority. This records editorial intent; only a separately admitted complete output graph may activate a redirect or retirement.", o(a.Struct({
22
+ expectedRevision: a.Int,
23
+ definition: e
24
+ }), "cms.routeDisposition.approve", !0), a.Struct({
25
+ ...s.fields,
26
+ count: a.Int
27
+ }), (e, r) => t.approve({
28
+ ...e,
29
+ apiKey: n(r, c.credentialError)
30
+ })), i(c, "list", "Read one scoped page of approved route dispositions", "Organization API-key bearer with the server-configured read capability. A continuation requires the observed revision and refuses after a change. No private key identity or credentials are projected. Revoked, personal or foreign credentials never authorize a read.", o(a.Struct({
31
+ expectedRevision: a.optional(a.Int),
32
+ after: a.optional(a.String),
33
+ take: a.optional(a.Int)
34
+ }), "cms.routeDisposition.list", !0), a.Struct({
35
+ revision: a.Int,
36
+ count: a.Int,
37
+ entries: a.Array(s),
38
+ next: a.NullOr(a.String)
39
+ }), (e, r) => t.list({
40
+ apiKey: n(r, c.credentialError),
41
+ ...e.expectedRevision === void 0 ? {} : { expectedRevision: e.expectedRevision },
42
+ ...e.after === void 0 ? {} : { after: e.after },
43
+ ...e.take === void 0 ? {} : { take: e.take }
44
+ }))];
45
+ return {
46
+ routes: l,
47
+ httpRoutes: r(l)
48
+ };
49
+ };
50
+ //#endregion
51
+ export { l as cmsRouteDispositionRest };
@@ -0,0 +1,73 @@
1
+ import { lockPublicationStream as e } from "./changes.js";
2
+ import { copyOutputActivationScope as t } from "./outputActivation.js";
3
+ import { RouteDispositionUnavailable as n, copyRouteDispositionDefinition as r, routeDispositionFail as i } from "./routeDispositions.js";
4
+ import { readRenderReadOrganization as a } from "./renderReadAuthority.js";
5
+ import { readApprovedRouteDispositionPage as o, writeApprovedRouteDisposition as s } from "./routeDispositionStore.js";
6
+ import { Effect as c } from "effect";
7
+ import { API_KEYS_TABLE as l, dataStoreApiKeyStore as u, makeApiKeyService as d } from "@voltro/runtime";
8
+ //#region src/routeDispositionService.ts
9
+ var f = (f) => {
10
+ let { store: p, approvalScope: m, readScope: h } = f, g = t(f.scope), _ = f.now ?? Date.now;
11
+ if (![m, h].every((e) => /^[A-Za-z][A-Za-z0-9:_.-]{0,127}$/.test(e))) return i("input");
12
+ let v = ({ authority: e, ...t }) => t, y = (e) => c.tryPromise({
13
+ try: e,
14
+ catch: (e) => e instanceof n ? e : new n({ reason: "state" })
15
+ }), b = (e) => new Proxy(e, { get(e, t) {
16
+ if (t === "query") return (t) => e.query(t.table === l ? {
17
+ ...t,
18
+ lock: "update"
19
+ } : t);
20
+ let n = Reflect.get(e, t);
21
+ return typeof n == "function" ? n.bind(e) : n;
22
+ } }), x = async (e, t, n) => {
23
+ let r = await a(b(e), g, t, _());
24
+ return r === null || !r.scopes.includes(n) ? i("credential") : t;
25
+ }, S = async (e, t, n) => {
26
+ if (typeof t != "string" || t.length === 0 || t.length > 512) return i("credential");
27
+ let r = await d(u(b(e))).verify(t, _());
28
+ return r === null ? i("credential") : x(e, r.id, n);
29
+ };
30
+ return {
31
+ approve: (t) => y(async () => {
32
+ let n = t.apiKey, a = t.expectedRevision, o = r(t.definition);
33
+ return p.transactional(async (t) => {
34
+ await e(t, g);
35
+ let r = await S(t, n, m);
36
+ if (await x(t, r, m) !== r) return i("credential");
37
+ let c = await s(t, g, {
38
+ expectedRevision: a,
39
+ definition: o,
40
+ authority: {
41
+ kind: "apiKey",
42
+ id: r,
43
+ scope: m
44
+ },
45
+ now: _()
46
+ });
47
+ if (await x(t, r, m) !== r) return i("credential");
48
+ let { count: l, ...u } = c;
49
+ return {
50
+ ...v(u),
51
+ count: l
52
+ };
53
+ });
54
+ }),
55
+ list: (t) => y(async () => {
56
+ let n = t.apiKey, { expectedRevision: r, after: a, take: s } = t;
57
+ return p.transactional(async (t) => {
58
+ await e(t, g);
59
+ let c = await S(t, n, h), l = await o(t, g, {
60
+ ...r === void 0 ? {} : { expectedRevision: r },
61
+ ...a === void 0 ? {} : { after: a },
62
+ ...s === void 0 ? {} : { take: s }
63
+ });
64
+ return await x(t, c, h) === c ? {
65
+ ...l,
66
+ entries: l.entries.map(({ urlKey: e, ...t }) => v(t))
67
+ } : i("credential");
68
+ });
69
+ })
70
+ };
71
+ };
72
+ //#endregion
73
+ export { f as createCmsRouteDispositions };
@@ -0,0 +1,289 @@
1
+ import { invalidatePublicationRelease as e, lockPublicationStream as t } from "./changes.js";
2
+ import { copyOutputActivationScope as n, outputActivationHash as r } from "./outputActivation.js";
3
+ import { copyCanonicalPublicRouteUrl as i } from "./publicRouteUrl.js";
4
+ import { copyRouteDispositionDefinition as a, routeDispositionFail as o } from "./routeDispositions.js";
5
+ import { copyRenderReadAuthority as s } from "./renderReadAuthority.js";
6
+ import { and as c, eq as l, generateId as u, gt as d, id as f, inSet as p, integer as m, json as h, table as g, text as _, timestamp as v } from "@voltro/database";
7
+ import { tenant as y } from "@voltro/plugin-multitenancy/mixin";
8
+ import { canonicalJson as b } from "@voltro/runtime";
9
+ //#region src/routeDispositionStore.ts
10
+ var x = "_voltro_cms_route_disposition_heads", S = "_voltro_cms_route_dispositions", C = "_voltro_cms_route_disposition_revisions", w = g(x, {
11
+ id: f({ prefix: "crph" }),
12
+ site: _().maxLength(64),
13
+ environment: _().maxLength(64),
14
+ revision: m(),
15
+ count: m()
16
+ }).with(y()).unique("cms_route_disposition_scope", [
17
+ "tenantId",
18
+ "site",
19
+ "environment"
20
+ ]), T = () => ({
21
+ site: _().maxLength(64),
22
+ environment: _().maxLength(64),
23
+ urlKey: _().maxLength(64),
24
+ revision: m(),
25
+ revisionId: _().maxLength(64),
26
+ previousRevisionId: _().maxLength(64).nullable(),
27
+ definition: h(),
28
+ authority: h(),
29
+ approvedAt: v(),
30
+ integrityDigest: _().maxLength(64)
31
+ }), E = g(S, {
32
+ id: f({ prefix: "crpd" }),
33
+ ...T()
34
+ }).with(y()).unique("cms_route_disposition_source", [
35
+ "tenantId",
36
+ "site",
37
+ "environment",
38
+ "urlKey"
39
+ ]), D = g(C, {
40
+ id: f({ prefix: "crpv" }),
41
+ ...T()
42
+ }).with(y()).unique("cms_route_disposition_revision", [
43
+ "tenantId",
44
+ "site",
45
+ "environment",
46
+ "revision"
47
+ ]), O = [
48
+ w,
49
+ E,
50
+ D
51
+ ], k = 2147483647, A = 1e5, j = (e) => Number.isSafeInteger(e) && Number(e) >= 0 && Number(e) <= k, M = (e) => typeof e == "string" && /^[A-Za-z0-9_-]{1,64}$/.test(e), N = (e) => typeof e == "string" && /^[a-f0-9]{64}$/.test(e), P = (e) => {
52
+ try {
53
+ return n(e);
54
+ } catch {
55
+ return o("scope");
56
+ }
57
+ }, F = (e) => c(l("tenantId", e.tenantId), l("site", e.site), l("environment", e.environment)), I = (e, t) => u({
58
+ kind: "typeid",
59
+ prefix: e
60
+ }, t) ?? o("state"), L = async (e, t, n) => {
61
+ let r = () => e.query({
62
+ table: x,
63
+ predicate: F(t),
64
+ lock: "update",
65
+ order: [],
66
+ take: 2,
67
+ skip: void 0,
68
+ projection: void 0
69
+ }), i = await r();
70
+ if (i.length === 0) {
71
+ for (let n of [S, C]) if ((await e.query({
72
+ table: n,
73
+ predicate: F(t),
74
+ lock: "update",
75
+ order: [],
76
+ take: 1,
77
+ skip: void 0,
78
+ projection: ["id"]
79
+ })).length > 0) return o("state");
80
+ if (!n) return null;
81
+ await e.insertIgnore(x, {
82
+ id: I("crph", x),
83
+ ...t,
84
+ revision: 0,
85
+ count: 0
86
+ }, { conflictColumns: [
87
+ "tenantId",
88
+ "site",
89
+ "environment"
90
+ ] }), i = await r();
91
+ }
92
+ let a = i[0];
93
+ return i.length !== 1 || a === void 0 || !M(a.id) || !j(a.revision) || !j(a.count) || a.count > A || a.count > a.revision || a.count === 0 != (a.revision === 0) ? o("state") : {
94
+ id: a.id,
95
+ revision: a.revision,
96
+ count: a.count
97
+ };
98
+ }, R = (e, t, n) => {
99
+ let i;
100
+ try {
101
+ i = a(e.definition);
102
+ } catch {
103
+ return o("state");
104
+ }
105
+ let c = s(e.authority), l = e.approvedAt instanceof Date ? e.approvedAt.getTime() : NaN;
106
+ if (!M(e.revisionId) || !j(e.revision) || e.revision < 1 || e.revision > n.revision || !(e.previousRevisionId === null || M(e.previousRevisionId)) || e.previousRevisionId === e.revisionId || c === null || !Number.isSafeInteger(l) || l < 0 || !N(e.urlKey) || e.urlKey !== r(i.source.url)) return o("state");
107
+ let u = {
108
+ revision: e.revision,
109
+ revisionId: e.revisionId,
110
+ previousRevisionId: e.previousRevisionId,
111
+ definition: i,
112
+ authority: c,
113
+ approvedAt: l
114
+ }, d = r({
115
+ scope: t,
116
+ ...u
117
+ });
118
+ return e.integrityDigest === d ? {
119
+ ...u,
120
+ urlKey: e.urlKey,
121
+ integrityDigest: d
122
+ } : o("state");
123
+ }, z = async (e, t, n, r) => {
124
+ let i = r.map((e) => R(e, t, n)), a = i.map((e) => e.revisionId);
125
+ if (new Set(a).size !== a.length) return o("state");
126
+ let s = a.length === 0 ? [] : await e.query({
127
+ table: C,
128
+ predicate: c(F(t), p("id", a)),
129
+ lock: "update",
130
+ order: [],
131
+ take: a.length + 1,
132
+ skip: void 0,
133
+ projection: void 0
134
+ });
135
+ if (s.length !== a.length) return o("state");
136
+ let l = new Map(s.map((e) => [String(e.id), e]));
137
+ if (l.size !== s.length) return o("state");
138
+ for (let e of i) {
139
+ let r = l.get(e.revisionId);
140
+ if (r === void 0 || r.id !== r.revisionId || b(R(r, t, n)) !== b(e)) return o("state");
141
+ }
142
+ return i.map(({ integrityDigest: e, ...t }) => t);
143
+ }, B = async (e, t, n) => {
144
+ let a = P(t);
145
+ try {
146
+ i(n);
147
+ } catch {
148
+ return o("input");
149
+ }
150
+ let s = await L(e, a, !1);
151
+ if (s === null) return null;
152
+ let u = await e.query({
153
+ table: S,
154
+ predicate: c(F(a), l("urlKey", r(n))),
155
+ lock: "update",
156
+ order: [],
157
+ take: 2,
158
+ skip: void 0,
159
+ projection: void 0
160
+ });
161
+ if (u.length > 1) return o("state");
162
+ let d = (await z(e, a, s, u))[0];
163
+ if (d === void 0) return null;
164
+ if (d.definition.source.url !== n) return o("state");
165
+ let { urlKey: f, ...p } = d;
166
+ return p;
167
+ }, V = async (e, t, n = {}) => {
168
+ let r = P(t), { expectedRevision: i, after: a, take: s = 500 } = n;
169
+ if (!Number.isInteger(s) || s < 1 || s > 1e3 || i !== void 0 && !j(i) || a !== void 0 && (!N(a) || i === void 0)) return o("input");
170
+ let l = await L(e, r, !1);
171
+ if (i !== void 0 && i !== (l?.revision ?? 0)) return o("revision");
172
+ if (l === null) return {
173
+ revision: 0,
174
+ count: 0,
175
+ entries: [],
176
+ next: null
177
+ };
178
+ let u = await z(e, r, l, await e.query({
179
+ table: S,
180
+ predicate: c(F(r), ...a === void 0 ? [] : [d("urlKey", a)]),
181
+ lock: "update",
182
+ order: [{
183
+ column: "urlKey",
184
+ direction: "asc"
185
+ }],
186
+ take: s + 1,
187
+ skip: void 0,
188
+ projection: void 0
189
+ }));
190
+ if (u.length > l.count) return o("state");
191
+ let f = a ?? "";
192
+ for (let e of u) {
193
+ if (e.urlKey <= f) return o("state");
194
+ f = e.urlKey;
195
+ }
196
+ return {
197
+ revision: l.revision,
198
+ count: l.count,
199
+ entries: u.slice(0, s),
200
+ next: u.length > s ? u[s - 1].urlKey : null
201
+ };
202
+ }, H = async (n, i, u) => {
203
+ let d = P(i), f = u.expectedRevision, p = a(u.definition), m = s(u.authority), h = u.now;
204
+ if (!j(f) || m === null || !Number.isSafeInteger(h) || h < 0 || h > 864e13) return o("input");
205
+ await t(n, d);
206
+ let g = await L(n, d, !0);
207
+ if (g === null) return o("state");
208
+ let _ = r(p.source.url), v = await n.query({
209
+ table: S,
210
+ predicate: c(F(d), l("urlKey", _)),
211
+ lock: "update",
212
+ order: [],
213
+ take: 2,
214
+ skip: void 0,
215
+ projection: void 0
216
+ });
217
+ if (v.length > 1) return o("state");
218
+ let y = (await z(n, d, g, v))[0], x = y !== void 0 && b(y.definition) === b(p) && b(y.authority) === b(m);
219
+ if (g.revision !== f) {
220
+ if (g.revision === f + 1 && y?.revision === g.revision && x) {
221
+ let { urlKey: e, ...t } = y;
222
+ return {
223
+ ...t,
224
+ count: g.count
225
+ };
226
+ }
227
+ return o("revision");
228
+ }
229
+ if (x && y !== void 0) {
230
+ let { urlKey: e, ...t } = y;
231
+ return {
232
+ ...t,
233
+ count: g.count
234
+ };
235
+ }
236
+ if (g.revision === k || y === void 0 && g.count === A) return o("bounds");
237
+ let w = {
238
+ revision: g.revision + 1,
239
+ revisionId: I("crpv", C),
240
+ previousRevisionId: y?.revisionId ?? null,
241
+ definition: p,
242
+ authority: m,
243
+ approvedAt: h
244
+ }, T = {
245
+ ...d,
246
+ urlKey: _,
247
+ ...w,
248
+ approvedAt: new Date(h),
249
+ integrityDigest: r({
250
+ scope: d,
251
+ ...w
252
+ })
253
+ };
254
+ if (await n.insert(C, {
255
+ id: w.revisionId,
256
+ ...T
257
+ }), y === void 0) await n.insert(S, {
258
+ id: I("crpd", S),
259
+ ...T
260
+ });
261
+ else {
262
+ let e = v[0];
263
+ if (!M(e.id)) return o("state");
264
+ await n.update(S, e.id, T);
265
+ }
266
+ let E = g.count + +(y === void 0);
267
+ return await n.updateMany("_voltro_cms_route_disposition_heads", {
268
+ revision: w.revision,
269
+ count: E
270
+ }, { where: c(F(d), l("id", g.id), l("revision", g.revision)) }) === 1 ? (await e(n, d), {
271
+ ...w,
272
+ count: E
273
+ }) : o("revision");
274
+ };
275
+ async function* U(e, t) {
276
+ let n, r, i = 0, a = 0;
277
+ do {
278
+ let o = await V(e, t, {
279
+ ...r === void 0 ? {} : { expectedRevision: r },
280
+ ...n === void 0 ? {} : { after: n }
281
+ });
282
+ r = o.revision, a = o.count;
283
+ for (let { urlKey: e, ...t } of o.entries) i++, yield t;
284
+ n = o.next ?? void 0;
285
+ } while (n !== void 0);
286
+ if (i !== a) return o("state");
287
+ }
288
+ //#endregion
289
+ export { S as ROUTE_DISPOSITIONS, x as ROUTE_DISPOSITION_HEADS, C as ROUTE_DISPOSITION_REVISIONS, U as iterateApprovedRouteDispositions, V as readApprovedRouteDispositionPage, B as readApprovedRouteDispositionUrl, w as routeDispositionHeadsTable, D as routeDispositionRevisionsTable, O as routeDispositionTables, E as routeDispositionsTable, H as writeApprovedRouteDisposition };
@@ -0,0 +1,5 @@
1
+ import { routeDispositionTables as e } from "./routeDispositionStore.js";
2
+ //#region src/routeDispositionTables.ts
3
+ var t = Object.freeze([...e]);
4
+ //#endregion
5
+ export { t as cmsRouteDispositionTables };
@@ -0,0 +1,91 @@
1
+ import { copyCanonicalPublicRouteUrl as e } from "./publicRouteUrl.js";
2
+ import { Schema as t } from "effect";
3
+ //#region src/routeDispositions.ts
4
+ var n = class extends t.TaggedError()("RouteDispositionUnavailable", { reason: t.Literals([
5
+ "input",
6
+ "bounds",
7
+ "scope",
8
+ "state",
9
+ "revision",
10
+ "credential",
11
+ "graph",
12
+ "hold"
13
+ ]) }) {}, r = (e) => {
14
+ throw new n({ reason: e });
15
+ }, i = (e, t) => {
16
+ if (typeof e != "object" || !e || Array.isArray(e) || ![Object.prototype, null].includes(Object.getPrototypeOf(e)) || Object.getOwnPropertySymbols(e).length > 0) return r("input");
17
+ let n = Object.getOwnPropertyDescriptors(e);
18
+ return Object.values(n).some((e) => !e.enumerable || !("value" in e)) || t !== void 0 && Object.keys(n).sort().join(",") !== t ? r("input") : Object.fromEntries(Object.entries(n).map(([e, t]) => [e, t.value]));
19
+ }, a = (t) => {
20
+ let n = i(t, "routeId,url");
21
+ if (typeof n.routeId != "string" || !/^(route|native)_[a-f0-9]{64}$/.test(n.routeId)) return r("input");
22
+ try {
23
+ return {
24
+ url: e(n.url),
25
+ routeId: n.routeId
26
+ };
27
+ } catch {
28
+ return r("input");
29
+ }
30
+ }, o = (e) => e === null ? null : Number.isSafeInteger(e) && Number(e) >= 0 && Number(e) <= 864e13 ? Number(e) : r("input"), s = (e) => {
31
+ let t = i(e);
32
+ if (t.kind === "hold") return i(e, "kind"), { kind: "hold" };
33
+ if (t.kind === "gone") return i(e, "kind,status"), t.status === 404 || t.status === 410 ? {
34
+ kind: "gone",
35
+ status: t.status
36
+ } : r("input");
37
+ if (t.kind !== "redirect") return r("input");
38
+ i(e, "kind,method,status,target");
39
+ let n = a(t.target);
40
+ return (t.status === 301 || t.status === 302) && t.method === "allow-post-to-get" ? {
41
+ kind: "redirect",
42
+ status: t.status,
43
+ method: "allow-post-to-get",
44
+ target: n
45
+ } : (t.status === 307 || t.status === 308) && t.method === "preserve" ? {
46
+ kind: "redirect",
47
+ status: t.status,
48
+ method: "preserve",
49
+ target: n
50
+ } : r("input");
51
+ }, c = (e) => {
52
+ let t = i(e, "action,activeFrom,activeUntil,source,version");
53
+ if (t.version !== 1) return r("input");
54
+ let n = a(t.source), c = s(t.action), l = o(t.activeFrom), u = o(t.activeUntil);
55
+ return l !== null && u !== null && l >= u || c.kind === "redirect" && c.target.url === n.url ? r("input") : {
56
+ version: 1,
57
+ source: n,
58
+ action: c,
59
+ activeFrom: l,
60
+ activeUntil: u
61
+ };
62
+ }, l = t.Struct({
63
+ url: t.String,
64
+ routeId: t.String
65
+ }), u = t.Struct({
66
+ version: t.Literal(1),
67
+ source: l,
68
+ action: t.Union([
69
+ t.Struct({
70
+ kind: t.Literal("redirect"),
71
+ status: t.Literals([301, 302]),
72
+ method: t.Literal("allow-post-to-get"),
73
+ target: l
74
+ }),
75
+ t.Struct({
76
+ kind: t.Literal("redirect"),
77
+ status: t.Literals([307, 308]),
78
+ method: t.Literal("preserve"),
79
+ target: l
80
+ }),
81
+ t.Struct({
82
+ kind: t.Literal("gone"),
83
+ status: t.Literals([404, 410])
84
+ }),
85
+ t.Struct({ kind: t.Literal("hold") })
86
+ ]),
87
+ activeFrom: t.NullOr(t.Int),
88
+ activeUntil: t.NullOr(t.Int)
89
+ });
90
+ //#endregion
91
+ export { u as RouteDispositionDefinitionSchema, n as RouteDispositionUnavailable, c as copyRouteDispositionDefinition, r as routeDispositionFail };