@voltro/cms 0.86.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 (201) hide show
  1. package/CHANGELOG.md +5321 -0
  2. package/README.md +138 -0
  3. package/THIRD-PARTY-NOTICES.md +860 -221
  4. package/dist/RichDocumentView.js +81 -36
  5. package/dist/aiCandidates.js +3 -3
  6. package/dist/applicationBuildSnapshotService.js +101 -0
  7. package/dist/assetRenditions.js +102 -0
  8. package/dist/assetRevision.js +46 -0
  9. package/dist/assetUseRights.js +72 -0
  10. package/dist/availability.js +19 -16
  11. package/dist/blueprint.js +75 -75
  12. package/dist/build.d.ts +3063 -0
  13. package/dist/build.js +37 -0
  14. package/dist/buildApplicationAdmission.js +16 -0
  15. package/dist/buildApplicationCatalog.js +136 -0
  16. package/dist/buildApplicationCatalogTable.js +24 -0
  17. package/dist/buildApplicationRest.js +99 -0
  18. package/dist/buildApplicationUpload.js +111 -0
  19. package/dist/buildSnapshot.js +401 -0
  20. package/dist/buildSnapshotApplicationPin.js +32 -0
  21. package/dist/buildSnapshotRest.js +210 -0
  22. package/dist/buildSnapshotService.js +265 -0
  23. package/dist/buildSnapshotTables.js +25 -0
  24. package/dist/bulk.js +71 -70
  25. package/dist/changes.js +279 -62
  26. package/dist/consent.js +5 -5
  27. package/dist/contentLocations.js +53 -0
  28. package/dist/contentProjection.js +83 -0
  29. package/dist/contentRouteIdentity.js +13 -0
  30. package/dist/contentRouteMaterializer.js +97 -0
  31. package/dist/contentRouteTypes.js +39 -0
  32. package/dist/contentSeo.js +189 -0
  33. package/dist/contentTreePath.js +60 -0
  34. package/dist/contentType.js +117 -100
  35. package/dist/contentValues.js +18 -0
  36. package/dist/copies.js +3 -3
  37. package/dist/domainHost.js +7 -0
  38. package/dist/domains.js +81 -87
  39. package/dist/draftTexts.js +37 -37
  40. package/dist/duplicates.js +23 -23
  41. package/dist/environmentAliases.js +138 -0
  42. package/dist/environments.js +107 -69
  43. package/dist/errors.js +54 -14
  44. package/dist/experiments.js +7 -7
  45. package/dist/frontendBindings.js +99 -0
  46. package/dist/frontendMedia.js +18 -0
  47. package/dist/index.d.ts +760 -47
  48. package/dist/index.js +89 -73
  49. package/dist/initializePublicRoutes.js +28 -0
  50. package/dist/liveContentRouteView.js +76 -0
  51. package/dist/nativeOutputDeploymentService.js +205 -0
  52. package/dist/outputActivation.js +234 -0
  53. package/dist/outputActivationOrigin.js +51 -0
  54. package/dist/outputActivationStore.js +411 -0
  55. package/dist/outputActivationTables.js +11 -0
  56. package/dist/outputActivationTarget.js +81 -0
  57. package/dist/outputActivationTargetTable.js +25 -0
  58. package/dist/outputDeployment.js +174 -0
  59. package/dist/outputDeploymentRest.js +168 -0
  60. package/dist/outputDeploymentService.js +241 -0
  61. package/dist/outputRouteGraph.js +177 -0
  62. package/dist/outputSafetyArtifact.js +147 -0
  63. package/dist/outputTargetRest.js +62 -0
  64. package/dist/pathSegmentEncoding.js +4 -0
  65. package/dist/privateCmsTransport.js +76 -0
  66. package/dist/privateNativeRouteReservation.js +10 -0
  67. package/dist/promotion.js +68 -59
  68. package/dist/publicBuild.js +90 -0
  69. package/dist/publicBuildRest.js +98 -0
  70. package/dist/publicBuildService.js +63 -0
  71. package/dist/publicOutputHttp.js +129 -0
  72. package/dist/publicOutputService.js +287 -0
  73. package/dist/publicPresentation.js +17 -0
  74. package/dist/publicRouteDispositionAdmission.js +38 -0
  75. package/dist/publicRouteHistoryStore.js +12 -0
  76. package/dist/publicRouteHistoryView.js +34 -0
  77. package/dist/publicRouteIntegrity.js +5 -0
  78. package/dist/publicRouteMutation.js +6 -0
  79. package/dist/publicRouteNamespace.js +134 -0
  80. package/dist/publicRoutePublication.js +36 -0
  81. package/dist/publicRouteRegistry.js +17 -0
  82. package/dist/publicRouteRegistryBinding.js +194 -0
  83. package/dist/publicRouteRegistryDefinition.js +76 -0
  84. package/dist/publicRouteSitePublication.js +40 -0
  85. package/dist/publicRouteTables.js +13 -0
  86. package/dist/publicRouteUrl.js +18 -0
  87. package/dist/publicationSeo.js +52 -0
  88. package/dist/publicationState.js +296 -0
  89. package/dist/quality.js +8 -8
  90. package/dist/reconfigurePublicRoutes.js +41 -0
  91. package/dist/redirects.js +104 -73
  92. package/dist/referenceGraph.js +15 -14
  93. package/dist/references.js +2 -2
  94. package/dist/release.js +177 -141
  95. package/dist/renderReadAuthority.js +43 -0
  96. package/dist/renderReadGrant.js +137 -0
  97. package/dist/review.js +28 -28
  98. package/dist/richDocument.js +54 -24
  99. package/dist/routeDispositionGraph.js +44 -0
  100. package/dist/routeDispositionRest.js +51 -0
  101. package/dist/routeDispositionService.js +73 -0
  102. package/dist/routeDispositionStore.js +289 -0
  103. package/dist/routeDispositionTables.js +5 -0
  104. package/dist/routeDispositions.js +91 -0
  105. package/dist/routeHistoryStorage.js +320 -0
  106. package/dist/routeHistoryStore.js +12 -0
  107. package/dist/schedule.js +36 -36
  108. package/dist/seo.js +1 -1
  109. package/dist/series.js +11 -11
  110. package/dist/share.js +13 -13
  111. package/dist/siteBindings.js +159 -0
  112. package/dist/siteBuildCandidate.js +104 -0
  113. package/dist/siteDelivery.js +115 -0
  114. package/dist/siteState.js +47 -0
  115. package/dist/snapshotAddressGraph.js +55 -0
  116. package/dist/snapshotAddressRead.js +73 -0
  117. package/dist/snapshotAppConsumer.js +71 -0
  118. package/dist/snapshotAppExecution.js +102 -0
  119. package/dist/snapshotApplication.js +75 -0
  120. package/dist/snapshotApprovedRouteDispositions.js +44 -0
  121. package/dist/snapshotAssetAssembly.js +70 -0
  122. package/dist/snapshotAssetAssemblyRest.js +50 -0
  123. package/dist/snapshotBindingRead.js +61 -0
  124. package/dist/snapshotCodeSeo.js +29 -0
  125. package/dist/snapshotComponent.js +34 -0
  126. package/dist/snapshotComponentSource.js +24 -0
  127. package/dist/snapshotConsumer.js +87 -0
  128. package/dist/snapshotContentIdentity.js +10 -0
  129. package/dist/snapshotDefinitions.js +264 -0
  130. package/dist/snapshotDocumentAssembly.js +193 -0
  131. package/dist/snapshotDocumentAssemblyRest.js +84 -0
  132. package/dist/snapshotDocumentProjection.js +202 -0
  133. package/dist/snapshotDocumentTransfer.js +35 -0
  134. package/dist/snapshotDocumentTransferRest.js +80 -0
  135. package/dist/snapshotDomains.js +56 -0
  136. package/dist/snapshotEnvironment.js +31 -0
  137. package/dist/snapshotFieldPlan.js +85 -0
  138. package/dist/snapshotFrontend.js +103 -0
  139. package/dist/snapshotLink.js +8 -0
  140. package/dist/snapshotMedia.js +111 -0
  141. package/dist/snapshotMediaCapture.js +246 -0
  142. package/dist/snapshotMediaFields.js +225 -0
  143. package/dist/snapshotMediaRead.js +185 -0
  144. package/dist/snapshotMediaReader.js +13 -0
  145. package/dist/snapshotObservation.js +16 -0
  146. package/dist/snapshotObservedRouteHistory.js +34 -0
  147. package/dist/snapshotOutputTransfer.js +78 -0
  148. package/dist/snapshotPageLoader.js +7 -0
  149. package/dist/snapshotPageSeo.js +59 -0
  150. package/dist/snapshotPathLocale.js +15 -0
  151. package/dist/snapshotPresentation.js +86 -0
  152. package/dist/snapshotPresentationPolicy.js +12 -0
  153. package/dist/snapshotProjection.js +119 -0
  154. package/dist/snapshotPublicAccess.js +161 -0
  155. package/dist/snapshotPublicRouteHistory.js +40 -0
  156. package/dist/snapshotReadAdmission.js +38 -0
  157. package/dist/snapshotRedirectOutput.js +151 -0
  158. package/dist/snapshotRedirectTargets.js +24 -0
  159. package/dist/snapshotRedirects.js +132 -0
  160. package/dist/snapshotReference.js +8 -0
  161. package/dist/snapshotReferenceAddress.js +10 -0
  162. package/dist/snapshotReferenceGraph.js +79 -0
  163. package/dist/snapshotReferenceRead.js +65 -0
  164. package/dist/snapshotRelease.js +99 -0
  165. package/dist/snapshotRender.js +361 -0
  166. package/dist/snapshotRenderDependencies.js +178 -0
  167. package/dist/snapshotRenditions.js +88 -0
  168. package/dist/snapshotRichDocument.js +62 -0
  169. package/dist/snapshotRoleTransfer.js +106 -0
  170. package/dist/snapshotRoleTransferRest.js +99 -0
  171. package/dist/snapshotRouteAdmission.js +71 -0
  172. package/dist/snapshotRouteDispatch.js +111 -0
  173. package/dist/snapshotRouteDispositionPlan.js +73 -0
  174. package/dist/snapshotRouteRead.js +43 -0
  175. package/dist/snapshotRoutes.js +79 -0
  176. package/dist/snapshotRouting.js +113 -0
  177. package/dist/snapshotSeo.js +179 -0
  178. package/dist/snapshotSeoControls.js +101 -0
  179. package/dist/snapshotSeoDocumentInventory.js +115 -0
  180. package/dist/snapshotSeoDocuments.js +129 -0
  181. package/dist/snapshotSeoMerge.js +85 -0
  182. package/dist/snapshotSeoMetadata.js +137 -0
  183. package/dist/snapshotSeoOutput.js +173 -0
  184. package/dist/snapshotSeoPathSets.js +105 -0
  185. package/dist/snapshotSeoRead.js +88 -0
  186. package/dist/snapshotSite.js +128 -0
  187. package/dist/snapshotSitemapFiles.js +36 -0
  188. package/dist/snapshotTreeDependencies.js +58 -0
  189. package/dist/snapshotTreeLoader.js +10 -0
  190. package/dist/snapshotTreeRead.js +158 -0
  191. package/dist/staticPathSet.js +177 -0
  192. package/dist/staticPathSetRest.js +129 -0
  193. package/dist/staticPathSetService.js +249 -0
  194. package/dist/staticPathSetStore.js +338 -0
  195. package/dist/tree.js +9 -9
  196. package/dist/validation.js +53 -53
  197. package/dist/web.d.ts +709 -7
  198. package/dist/web.js +50 -33
  199. package/dist/workflow.js +8 -8
  200. package/dist/write.js +250 -225
  201. package/package.json +20 -6
package/dist/quality.js CHANGED
@@ -1,5 +1,5 @@
1
- import { asTyped as e } from "./effectForm.js";
2
- import { ContentNotFound as t } from "./errors.js";
1
+ import { ContentNotFound as e } from "./errors.js";
2
+ import { asTyped as t } from "./effectForm.js";
3
3
  import { and as n, eq as r, id as i, table as a, text as o, timestamp as s } from "@voltro/database";
4
4
  import { tenant as c } from "@voltro/plugin-multitenancy/mixin";
5
5
  //#region src/quality.ts
@@ -66,7 +66,7 @@ var l = "cms_quality_exceptions", u = 90, d = a(l, {
66
66
  take: void 0,
67
67
  skip: void 0,
68
68
  projection: void 0
69
- })).map((e) => h(e, a)), v = async (e, i, a, o, s, c = /* @__PURE__ */ new Date()) => {
69
+ })).map((e) => h(e, a)), v = async (t, i, a, o, s, c = /* @__PURE__ */ new Date()) => {
70
70
  let u = (i.quality ?? []).find((e) => e.id === s.ruleId && f(e, o));
71
71
  if (u === void 0) return {
72
72
  ok: !1,
@@ -86,7 +86,7 @@ var l = "cms_quality_exceptions", u = 90, d = a(l, {
86
86
  ok: !1,
87
87
  reason: "badExpiry"
88
88
  };
89
- let [m] = await e.query({
89
+ let [m] = await t.query({
90
90
  table: `${i.name}_drafts`,
91
91
  predicate: n(r("id", a), r("site", o.site), r("environment", o.environment), r("locale", o.locale)),
92
92
  order: [],
@@ -94,16 +94,16 @@ var l = "cms_quality_exceptions", u = 90, d = a(l, {
94
94
  skip: void 0,
95
95
  projection: void 0
96
96
  });
97
- if (m === void 0) throw new t({
97
+ if (m === void 0) throw new e({
98
98
  contentType: i.name,
99
99
  id: a,
100
100
  stage: "draft"
101
101
  });
102
- if ((await _(e, i, a, o, c)).some((e) => e.ruleId === u.id && (e.state === "requested" || e.state === "approved"))) return {
102
+ if ((await _(t, i, a, o, c)).some((e) => e.ruleId === u.id && (e.state === "requested" || e.state === "approved"))) return {
103
103
  ok: !1,
104
104
  reason: "alreadyOpen"
105
105
  };
106
- let h = m.tenantId, g = await e.insert(l, {
106
+ let h = m.tenantId, g = await t.insert(l, {
107
107
  site: o.site,
108
108
  environment: o.environment,
109
109
  locale: o.locale,
@@ -183,6 +183,6 @@ var l = "cms_quality_exceptions", u = 90, d = a(l, {
183
183
  rule: `quality.${e.ruleId}`,
184
184
  message: e.message
185
185
  }));
186
- }, x = (...t) => e(() => _(...t)), S = (...n) => e(() => v(...n), t), C = (...t) => e(() => y(...t)), w = (...t) => e(() => b(...t));
186
+ }, x = (...e) => t(() => _(...e)), S = (...n) => t(() => v(...n), e), C = (...e) => t(() => y(...e)), w = (...e) => t(() => b(...e));
187
187
  //#endregion
188
188
  export { l as CMS_QUALITY_EXCEPTIONS_TABLE, u as MAX_EXCEPTION_DAYS, d as cmsQualityExceptionsTable, y as decideQualityException, C as decideQualityExceptionEffect, _ as qualityExceptions, x as qualityExceptionsEffect, p as qualityFindings, b as qualityViolations, w as qualityViolationsEffect, v as requestQualityException, S as requestQualityExceptionEffect, f as ruleApplies };
@@ -0,0 +1,41 @@
1
+ import { PublicRouteRegistryUnavailable as e, publicRouteRegistryFail as t } from "./publicRouteRegistry.js";
2
+ import { ChangeFeedUnavailable as n, SiteStateUnavailable as r } from "./errors.js";
3
+ import { asTyped as i } from "./effectForm.js";
4
+ import { lockSiteState as a } from "./siteState.js";
5
+ import { invalidatePublicationRelease as o, lockPublicationStream as s } from "./changes.js";
6
+ import { copyOutputActivationScope as c } from "./outputActivation.js";
7
+ import { advancePublicRouteDefinition as l } from "./publicRouteRegistryBinding.js";
8
+ import { reconcilePublicRouteNamespace as u, withPublicRouteNamespaceBoundary as d } from "./publicRouteNamespace.js";
9
+ import { compileCmsPublicRouteDeclaration as f } from "./initializePublicRoutes.js";
10
+ import { readPublicRouteHistoryView as p } from "./publicRouteHistoryView.js";
11
+ import { canonicalJson as m } from "@voltro/runtime";
12
+ //#region src/reconfigurePublicRoutes.ts
13
+ var h = (h, g, _, v) => i(() => d(async () => {
14
+ if (h.savepoint === void 0) return t("configuration");
15
+ let e = v?.expectedRevision, n = v?.now ?? Date.now();
16
+ if (!Number.isSafeInteger(e) || e < 1 || e > 2147483647) return t("revision");
17
+ if (!Number.isSafeInteger(n) || n < 0 || n > 864e13) return t("bounds");
18
+ let r;
19
+ try {
20
+ r = c(g);
21
+ } catch {
22
+ return t("scope");
23
+ }
24
+ let i = f(_);
25
+ return i.site.id !== r.site || !i.site.environments.includes(r.environment) ? t("scope") : h.savepoint(async () => {
26
+ await a(h, r), await s(h, r);
27
+ let c = await p(h, r), d = c.namespace;
28
+ for await (let e of c.entries());
29
+ let f = m(d.binding.definition) === m(i);
30
+ if (e !== d.binding.revision) return f && d.binding.revision === e + 1 ? { revision: d.binding.revision } : t("revision");
31
+ if (f) return { revision: d.binding.revision };
32
+ let g = await l(h, r, {
33
+ expectedRevision: e,
34
+ definition: i,
35
+ now: n
36
+ });
37
+ return await o(h, r), await u(h, r), { revision: g.revision };
38
+ });
39
+ }), e, n, r);
40
+ //#endregion
41
+ export { h as reconfigureCmsPublicRoutes };
package/dist/redirects.js CHANGED
@@ -1,99 +1,130 @@
1
- import { asTyped as e } from "./effectForm.js";
2
- import { buildTree as t } from "./tree.js";
3
- import { and as n, eq as r, id as i, neq as a, table as o, text as s } from "@voltro/database";
4
- import { tenant as c } from "@voltro/plugin-multitenancy/mixin";
1
+ import { ChangeFeedUnavailable as e } from "./errors.js";
2
+ import { asTyped as t } from "./effectForm.js";
3
+ import { buildTree as n } from "./tree.js";
4
+ import { invalidatePublicationRelease as r, lockPublicationStream as i } from "./changes.js";
5
+ import { and as a, eq as o, id as s, neq as c, table as l, text as u } from "@voltro/database";
6
+ import { tenant as d } from "@voltro/plugin-multitenancy/mixin";
5
7
  //#region src/redirects.ts
6
- var l = "cms_paths", u = "cms_redirects", d = o(l, {
7
- id: i({ prefix: "cpth" }),
8
- contentType: s().maxLength(64),
9
- documentId: s().maxLength(64),
10
- site: s().maxLength(64),
11
- environment: s().maxLength(64),
12
- locale: s().maxLength(64),
13
- path: s()
14
- }).with(c()).index("cms_paths_by_document", [
8
+ var f = "cms_paths", p = "cms_redirects", m = l(f, {
9
+ id: s({ prefix: "cpth" }),
10
+ contentType: u().maxLength(64),
11
+ documentId: u().maxLength(64),
12
+ site: u().maxLength(64),
13
+ environment: u().maxLength(64),
14
+ locale: u().maxLength(64),
15
+ path: u()
16
+ }).with(d()).index("cms_paths_by_document", [
15
17
  "contentType",
16
18
  "documentId",
17
19
  "site",
18
20
  "environment",
19
21
  "locale"
20
- ]), f = o(u, {
21
- id: i({ prefix: "crdr" }),
22
- contentType: s().maxLength(64),
23
- site: s().maxLength(64),
24
- environment: s().maxLength(64),
25
- locale: s().maxLength(64),
26
- fromPath: s(),
27
- documentId: s().maxLength(64)
28
- }).with(c()).index("cms_redirects_by_path", [
22
+ ]), h = l(p, {
23
+ id: s({ prefix: "crdr" }),
24
+ contentType: u().maxLength(64),
25
+ site: u().maxLength(64),
26
+ environment: u().maxLength(64),
27
+ locale: u().maxLength(64),
28
+ fromPath: u(),
29
+ documentId: u().maxLength(64)
30
+ }).with(d()).index("cms_redirects_by_path", [
29
31
  "contentType",
30
32
  "site",
31
33
  "environment",
32
34
  "locale",
33
35
  "fromPath"
34
- ]), p = (e, t, n) => e.query({
36
+ ]), g = (e, t, n) => e.query({
35
37
  table: t,
36
38
  predicate: n,
37
39
  order: [],
38
40
  take: void 0,
39
41
  skip: void 0,
40
42
  projection: void 0
41
- }), m = (e) => [
42
- r("site", e.site),
43
- r("environment", e.environment),
44
- r("locale", e.locale)
45
- ], h = async (e, i, o, s) => {
46
- if (i.tree === void 0 && i.address === void 0) return;
47
- let c = await p(e, `${i.name}_published`, n(...m(o), a("status", "archived"))), d = i.address, f = i.tree === void 0 ? { nodes: c.filter((e) => typeof e[d] == "string" && e[d] !== "").map((e) => ({
43
+ }), _ = (e) => [
44
+ o("site", e.site),
45
+ o("environment", e.environment),
46
+ o("locale", e.locale)
47
+ ], v = (t, n) => {
48
+ if (typeof n != "string" || n.length === 0 || !t.site || !t.environment || !t.locale) throw new e({ reason: "scope" });
49
+ return {
50
+ tenantId: n,
51
+ site: t.site,
52
+ environment: t.environment
53
+ };
54
+ }, y = async (t, n) => {
55
+ let r = await t.query({
56
+ table: p,
57
+ predicate: n,
58
+ order: [],
59
+ take: 2,
60
+ skip: void 0,
61
+ projection: void 0
62
+ });
63
+ if (r.length > 1) throw new e({ reason: "migration" });
64
+ return r[0];
65
+ }, b = async (t, r, s, l) => {
66
+ if (r.tree === void 0 && r.address === void 0) return !1;
67
+ let u = v(s, l);
68
+ await i(t, u);
69
+ let d = o("tenantId", u.tenantId), m = await g(t, `${r.name}_published`, a(d, ..._(s), c("status", "archived"))), h = r.address, b = r.tree === void 0 ? { nodes: m.filter((e) => typeof e[h] == "string" && e[h] !== "").map((e) => ({
48
70
  documentId: String(e.documentId),
49
- path: String(e[d])
50
- })) } : t(c.map((e) => ({
71
+ path: String(e[h])
72
+ })) } : n(m.map((e) => ({
51
73
  row: e,
52
- locale: o.locale,
74
+ locale: s.locale,
53
75
  fallback: !1
54
- })), i.tree), h = new Map((await p(e, l, n(r("contentType", i.name), ...m(o)))).map((e) => [String(e.documentId), e])), g = s == null ? {} : { tenantId: s };
55
- for (let t of f.nodes) {
56
- let a = h.get(t.documentId);
57
- if (a === void 0) {
58
- await e.insert(l, {
59
- contentType: i.name,
60
- documentId: t.documentId,
61
- ...o,
62
- path: t.path,
63
- ...g
64
- });
76
+ })), r.tree), x = await g(t, f, a(d, o("contentType", r.name), ..._(s))), S = new Map(x.map((e) => [String(e.documentId), e]));
77
+ if (S.size !== x.length) throw new e({ reason: "migration" });
78
+ let C = { tenantId: u.tenantId }, w = !1;
79
+ for (let e of b.nodes) {
80
+ let n = S.get(e.documentId);
81
+ if (n === void 0) {
82
+ await t.insert(f, {
83
+ contentType: r.name,
84
+ documentId: e.documentId,
85
+ ...s,
86
+ path: e.path,
87
+ ...C
88
+ }), w = !0;
65
89
  continue;
66
90
  }
67
- if (a.path === t.path) continue;
68
- let s = String(a.path), [c] = await p(e, u, n(r("contentType", i.name), ...m(o), r("fromPath", s)));
69
- c === void 0 ? await e.insert(u, {
70
- contentType: i.name,
71
- ...o,
72
- fromPath: s,
73
- documentId: t.documentId,
74
- ...g
75
- }) : await e.update(u, String(c.id), { documentId: t.documentId }), await e.update(l, String(a.id), { path: t.path });
91
+ if (n.path === e.path) continue;
92
+ let i = String(n.path), c = await y(t, a(d, o("contentType", r.name), ..._(s), o("fromPath", i)));
93
+ c === void 0 ? await t.insert(p, {
94
+ contentType: r.name,
95
+ ...s,
96
+ fromPath: i,
97
+ documentId: e.documentId,
98
+ ...C
99
+ }) : await t.update(p, String(c.id), { documentId: e.documentId }), await t.update(f, String(n.id), { path: e.path }), w = !0;
76
100
  }
77
- }, g = async (e, t, i, a, o, s) => {
78
- let c = a.replace(/^\/+|\/+$/g, "");
79
- if (c === "") return;
80
- let l = s == null ? {} : { tenantId: s }, [d] = await p(e, u, n(r("contentType", t.name), ...m(i), r("fromPath", c)));
81
- d === void 0 ? await e.insert(u, {
101
+ return w;
102
+ }, x = async (e, t, n, i) => {
103
+ await b(e, t, n, i) && await r(e, v(n, i));
104
+ }, S = async (e, t, n, s, c, l) => {
105
+ let u = s.replace(/^\/+|\/+$/g, "");
106
+ if (u === "") return;
107
+ let d = v(n, l);
108
+ await i(e, d);
109
+ let f = await y(e, a(o("tenantId", d.tenantId), o("contentType", t.name), ..._(n), o("fromPath", u)));
110
+ f?.documentId !== c && (f === void 0 ? await e.insert(p, {
82
111
  contentType: t.name,
83
- ...i,
84
- fromPath: c,
85
- documentId: o,
86
- ...l
87
- }) : await e.update(u, String(d.id), { documentId: o });
88
- }, _ = async (e, t, i, a, o) => {
89
- let s = o === void 0 ? [] : [r("tenantId", o)], [c] = await p(e, u, n(r("contentType", t), ...m(a), r("fromPath", i), ...s));
112
+ ...n,
113
+ fromPath: u,
114
+ documentId: c,
115
+ tenantId: d.tenantId
116
+ }) : await e.update(p, String(f.id), { documentId: c }), await r(e, d));
117
+ }, C = async (e, t, n, r, i) => {
118
+ let s = i === void 0 ? [] : [o("tenantId", i)], [c] = await g(e, p, a(o("contentType", t), ..._(r), o("fromPath", n), ...s));
90
119
  return c === void 0 ? null : String(c.documentId);
91
- }, v = async (e, t, i, a) => {
92
- let o = a.replace(/^\/+|\/+$/g, ""), [s] = await p(e, u, n(r("contentType", t.name), ...m(i), r("fromPath", o)));
93
- return s !== void 0 && (await e.delete(u, String(s.id)), !0);
94
- }, y = async (e, t, i, a, o) => {
95
- let s = o === void 0 ? [] : [r("tenantId", o)], [c] = await p(e, l, n(r("contentType", t), ...m(a), r("path", i), ...s));
96
- return c !== void 0 || await _(e, t, i, a, o) !== null;
97
- }, b = (e, t, i) => p(e, u, n(r("contentType", t), ...m(i))), x = (...t) => e(() => g(...t)), S = (...t) => e(() => y(...t)), C = (...t) => e(() => b(...t)), w = (...t) => e(() => h(...t)), T = (...t) => e(() => _(...t)), E = (...t) => e(() => v(...t));
120
+ }, w = async (e, t, n, s, c) => {
121
+ let l = s.replace(/^\/+|\/+$/g, ""), u = v(n, c);
122
+ await i(e, u);
123
+ let d = await y(e, a(o("tenantId", u.tenantId), o("contentType", t.name), ..._(n), o("fromPath", l)));
124
+ return d !== void 0 && (await e.delete(p, String(d.id)), await r(e, u), !0);
125
+ }, T = async (e, t, n, r, i) => {
126
+ let s = i === void 0 ? [] : [o("tenantId", i)], [c] = await g(e, f, a(o("contentType", t), ..._(r), o("path", n), ...s));
127
+ return c !== void 0 || await C(e, t, n, r, i) !== null;
128
+ }, E = (e, t, n) => g(e, p, a(o("contentType", t), ..._(n))), D = (...n) => t(() => S(...n), e), O = (...e) => t(() => T(...e)), k = (...e) => t(() => E(...e)), A = (...n) => t(() => x(...n), e), j = (...e) => t(() => C(...e)), M = (...n) => t(() => w(...n), e);
98
129
  //#endregion
99
- export { l as CMS_PATHS_TABLE, u as CMS_REDIRECTS_TABLE, g as addRedirect, x as addRedirectEffect, d as cmsPathsTable, f as cmsRedirectsTable, y as hadAddress, S as hadAddressEffect, b as listRedirects, C as listRedirectsEffect, h as recordPaths, w as recordPathsEffect, _ as redirectTarget, T as redirectTargetEffect, v as removeRedirect, E as removeRedirectEffect };
130
+ export { f as CMS_PATHS_TABLE, p as CMS_REDIRECTS_TABLE, S as addRedirect, D as addRedirectEffect, m as cmsPathsTable, h as cmsRedirectsTable, T as hadAddress, O as hadAddressEffect, E as listRedirects, k as listRedirectsEffect, x as recordPaths, A as recordPathsEffect, b as recordPublicationPaths, C as redirectTarget, j as redirectTargetEffect, w as removeRedirect, M as removeRedirectEffect };
@@ -1,9 +1,10 @@
1
- import { asTyped as e } from "./effectForm.js";
2
- import { ContentNotFound as t, ContentValidationFailed as n, RevisionMismatch as r } from "./errors.js";
1
+ import { ContentNotFound as e, ContentValidationFailed as t, RevisionMismatch as n } from "./errors.js";
2
+ import { asTyped as r } from "./effectForm.js";
3
3
  import { CMS_REVISIONS_TABLE as i } from "./contentType.js";
4
4
  import { CMS_PATHS_TABLE as a, CMS_REDIRECTS_TABLE as o } from "./redirects.js";
5
5
  import { CMS_REFERENCES_TABLE as s, referencesOf as c, usedBy as l } from "./references.js";
6
- import { pickDeclared as u, saveDraft as d } from "./write.js";
6
+ import { pickDeclared as u } from "./contentValues.js";
7
+ import { saveDraft as d } from "./write.js";
7
8
  import { CMS_RELEASES_TABLE as f, CMS_RELEASE_ITEMS_TABLE as p } from "./release.js";
8
9
  import { and as m, eq as h, inSet as g } from "@voltro/database";
9
10
  //#region src/referenceGraph.ts
@@ -165,7 +166,7 @@ var _ = (e, t, n) => e.query({
165
166
  ok: !0,
166
167
  items: [...a.values()]
167
168
  };
168
- }, D = async (e, i, a, o, s) => {
169
+ }, D = async (r, i, a, o, s) => {
169
170
  let c = new Map(i.map((e) => [e.name, e])), l = [];
170
171
  for (let i of a) {
171
172
  let a = c.get(i.type), f = {
@@ -174,26 +175,26 @@ var _ = (e, t, n) => e.query({
174
175
  locale: i.locale
175
176
  };
176
177
  try {
177
- if (a === void 0) throw new t({
178
+ if (a === void 0) throw new e({
178
179
  contentType: i.type,
179
180
  id: i.variantId,
180
181
  stage: "draft"
181
182
  });
182
- let n = await e.transactional(async (e) => {
183
- let [n] = await _(e, `${a.name}_drafts`, m(h("id", i.variantId), h("site", f.site), h("environment", f.environment), h("locale", f.locale)));
184
- if (n === void 0) throw new t({
183
+ let t = await r.transactional(async (t) => {
184
+ let [n] = await _(t, `${a.name}_drafts`, m(h("id", i.variantId), h("site", f.site), h("environment", f.environment), h("locale", f.locale)));
185
+ if (n === void 0) throw new e({
185
186
  contentType: i.type,
186
187
  id: i.variantId,
187
188
  stage: "draft"
188
189
  });
189
190
  let r = { ...u(a, n) };
190
191
  for (let e of i.paths) r = r === null ? null : T(r, e, o);
191
- return r === null ? null : d(e, a, {
192
+ return r === null ? null : d(t, a, {
192
193
  ...r,
193
194
  id: i.variantId
194
195
  }, f, i.revisionId === null ? {} : { expectedRevision: i.revisionId });
195
196
  });
196
- l.push(n === null ? {
197
+ l.push(t === null ? {
197
198
  ...i,
198
199
  outcome: "failed",
199
200
  reason: "pathGone",
@@ -203,11 +204,11 @@ var _ = (e, t, n) => e.query({
203
204
  ...i,
204
205
  outcome: "done",
205
206
  reason: null,
206
- newRevisionId: String(n.revisionId),
207
+ newRevisionId: String(t.revisionId),
207
208
  detail: []
208
209
  });
209
- } catch (e) {
210
- let a = e instanceof r ? "revisionMoved" : e instanceof n ? "incomplete" : e instanceof t ? "notFound" : "failed", o = e instanceof n ? e.violations.map((e) => e.field) : a === "failed" ? [e instanceof Error ? e.message : String(e)] : [];
210
+ } catch (r) {
211
+ let a = r instanceof n ? "revisionMoved" : r instanceof t ? "incomplete" : r instanceof e ? "notFound" : "failed", o = r instanceof t ? r.violations.map((e) => e.field) : a === "failed" ? [r instanceof Error ? r.message : String(r)] : [];
211
212
  l.push({
212
213
  ...i,
213
214
  outcome: "failed",
@@ -218,6 +219,6 @@ var _ = (e, t, n) => e.query({
218
219
  }
219
220
  }
220
221
  return l;
221
- }, O = (...t) => e(() => C(...t)), k = (...t) => e(() => x(...t)), A = (...t) => e(() => S(...t)), j = (...t) => e(() => E(...t)), M = (...t) => e(() => D(...t));
222
+ }, O = (...e) => r(() => C(...e)), k = (...e) => r(() => x(...e)), A = (...e) => r(() => S(...e)), j = (...e) => r(() => E(...e)), M = (...e) => r(() => D(...e));
222
223
  //#endregion
223
224
  export { b as componentsOf, C as documentGraph, O as documentGraphEffect, x as draftUses, k as draftUsesEffect, E as planReferenceReplacement, j as planReferenceReplacementEffect, D as replaceReferences, M as replaceReferencesEffect, S as revisionsReferencing, A as revisionsReferencingEffect, T as withReferenceAt };
@@ -105,7 +105,7 @@ var d = "cms_references", f = c(d, {
105
105
  targetDocumentId: e.targetDocumentId,
106
106
  ...o == null ? {} : { tenantId: o }
107
107
  }));
108
- s.length > 0 && await e.insertMany(d, s);
108
+ s.length > 0 && await e.insertMany(d, s, { returning: "none" });
109
109
  }, y = (e) => {
110
110
  let t = (e) => e.kind === "reference" || e.kind === "richText" || e.element !== void 0 && t(e.element) || Object.values(e.struct ?? {}).some(t) || (e.components ?? []).some((e) => Object.values(e.props).some(t));
111
111
  return Object.values(e.fields).some(t);
@@ -123,7 +123,7 @@ var d = "cms_references", f = c(d, {
123
123
  ...e,
124
124
  ...n.tenantId !== void 0 && n.tenantId !== null ? { tenantId: n.tenantId } : {}
125
125
  }));
126
- a.length > 0 && await e.insertMany(d, a);
126
+ a.length > 0 && await e.insertMany(d, a, { returning: "none" });
127
127
  }, x = async (e, t, n) => {
128
128
  async function* o(t, n) {
129
129
  let i;