@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
@@ -1,9 +1,9 @@
1
- import { asTyped as e } from "./effectForm.js";
2
- import { ReferenceUnavailable as t } from "./errors.js";
1
+ import { ReferenceUnavailable as e } from "./errors.js";
2
+ import { asTyped as t } from "./effectForm.js";
3
3
  import { referencesOf as n } from "./references.js";
4
4
  import { and as r, boolean as i, eq as a, gt as o, id as s, inSet as c, json as l, lte as u, table as d, text as f, timestamp as p } from "@voltro/database";
5
5
  import { tenant as m } from "@voltro/plugin-multitenancy/mixin";
6
- //#region src/availability.ts
6
+ // src/availability.ts
7
7
  var h = "cms_availability", g = d(h, {
8
8
  id: s({ prefix: "cavl" }),
9
9
  contentType: f().maxLength(64),
@@ -31,7 +31,13 @@ var h = "cms_availability", g = d(h, {
31
31
  return Number.isNaN(t.getTime()) ? null : t;
32
32
  }
33
33
  return null;
34
- }, y = async (e, t, n, i) => {
34
+ }, y = (e, t, n = {}) => {
35
+ let r = (e, t, n = !1) => {
36
+ let r = _(e);
37
+ return r === null || t == null || t === "" ? !1 : !r.includes(n ? t.toUpperCase() : t);
38
+ }, i = v(e.availableUntil), a = v(e.availableFrom);
39
+ return e.blocked === !0 ? "blocked" : i !== null && i.getTime() <= t.getTime() ? "expired" : a !== null && a.getTime() > t.getTime() ? "notYet" : r(e.territories, n.territory, !0) ? "territory" : r(e.channels, n.channel) ? "channel" : r(e.purposes, n.purpose) ? "purpose" : null;
40
+ }, b = async (e, t, n, i) => {
35
41
  let o = t.availability;
36
42
  if (o === void 0) return;
37
43
  let s = {
@@ -62,7 +68,7 @@ var h = "cms_availability", g = d(h, {
62
68
  ...s,
63
69
  ...l == null ? {} : { tenantId: l }
64
70
  });
65
- }, b = async (e, t, n, i = /* @__PURE__ */ new Date(), o = {}) => {
71
+ }, x = async (e, t, n, i = /* @__PURE__ */ new Date(), o = {}) => {
66
72
  let s = /* @__PURE__ */ new Map(), l = [...new Set(t)];
67
73
  if (l.length === 0) return s;
68
74
  let u = await e.query({
@@ -72,16 +78,13 @@ var h = "cms_availability", g = d(h, {
72
78
  take: void 0,
73
79
  skip: void 0,
74
80
  projection: void 0
75
- }), d = (e, t, n = !1) => {
76
- let r = _(e);
77
- return r === null || t == null || t === "" ? !1 : !r.includes(n ? t.toUpperCase() : t);
78
- };
81
+ });
79
82
  for (let e of u) {
80
- let t = e.documentId, n = v(e.availableUntil), r = v(e.availableFrom);
81
- e.blocked === !0 ? s.set(t, "blocked") : n !== null && n.getTime() <= i.getTime() ? s.set(t, "expired") : r !== null && r.getTime() > i.getTime() ? s.set(t, "notYet") : d(e.territories, o.territory, !0) ? s.set(t, "territory") : d(e.channels, o.channel) ? s.set(t, "channel") : d(e.purposes, o.purpose) && s.set(t, "purpose");
83
+ let t = e.documentId, n = y(e, i, o);
84
+ n !== null && s.set(t, n);
82
85
  }
83
86
  return s;
84
- }, x = async (e, t, n, i = /* @__PURE__ */ new Date()) => {
87
+ }, S = async (e, t, n, i = /* @__PURE__ */ new Date()) => {
85
88
  let s = new Date(i.getTime() + n * 864e5);
86
89
  return (await e.query({
87
90
  table: h,
@@ -102,11 +105,11 @@ var h = "cms_availability", g = d(h, {
102
105
  days: Math.ceil((t.getTime() - i.getTime()) / 864e5)
103
106
  }];
104
107
  });
105
- }, S = async (e, r, i, a, o, s = /* @__PURE__ */ new Date()) => {
108
+ }, C = async (t, r, i, a, o, s = /* @__PURE__ */ new Date()) => {
106
109
  let c = n(r, a);
107
110
  if (c.length === 0) return;
108
- let l = await b(e, c.map((e) => e.targetDocumentId), o, s);
109
- if (l.size !== 0) throw new t({
111
+ let l = await x(t, c.map((e) => e.targetDocumentId), o, s);
112
+ if (l.size !== 0) throw new e({
110
113
  contentType: r.name,
111
114
  id: i,
112
115
  targets: c.filter((e) => l.has(e.targetDocumentId)).map((e) => ({
@@ -116,6 +119,5 @@ var h = "cms_availability", g = d(h, {
116
119
  reason: l.get(e.targetDocumentId)
117
120
  }))
118
121
  });
119
- }, C = [t], w = (...t) => e(() => x(...t)), T = (...t) => e(() => S(...t), ...C), E = (...t) => e(() => b(...t), ...C), D = (...t) => e(() => y(...t), ...C);
120
- //#endregion
121
- export { h as CMS_AVAILABILITY_TABLE, S as assertReferencesAvailable, T as assertReferencesAvailableEffect, g as cmsAvailabilityTable, x as expiringAmong, w as expiringAmongEffect, b as unavailableAmong, E as unavailableAmongEffect, y as writeAvailability, D as writeAvailabilityEffect };
122
+ }, w = [e], T = (...e) => t(() => S(...e)), E = (...e) => t(() => C(...e), ...w), D = (...e) => t(() => x(...e), ...w), O = (...e) => t(() => b(...e), ...w);
123
+ export { h as CMS_AVAILABILITY_TABLE, C as assertReferencesAvailable, E as assertReferencesAvailableEffect, y as availabilityReason, g as cmsAvailabilityTable, S as expiringAmong, T as expiringAmongEffect, x as unavailableAmong, D as unavailableAmongEffect, b as writeAvailability, O as writeAvailabilityEffect };
package/dist/blueprint.js CHANGED
@@ -1,44 +1,44 @@
1
- import { templateValues as e } from "./templates.js";
2
- import { asTyped as t } from "./effectForm.js";
3
- import { ContentIdConflict as n, ContentNotFound as r, ContentValidationFailed as i, ReferenceUnavailable as a, ReviewRequired as o, RevisionMismatch as s } from "./errors.js";
4
- import { applyDerivations as c } from "./validation.js";
5
- import { teamProblems as l } from "./team.js";
6
- import { reviewRequiredFor as u } from "./review.js";
7
- import { publish as d, saveDraft as f } from "./write.js";
8
- import { and as p, eq as m } from "@voltro/database";
9
- //#region src/blueprint.ts
10
- var h = class extends Error {
1
+ import { ChangeFeedUnavailable as e, ContentIdConflict as t, ContentNotFound as n, ContentValidationFailed as r, ReferenceUnavailable as i, ReviewRequired as a, RevisionMismatch as o } from "./errors.js";
2
+ import { templateValues as s } from "./templates.js";
3
+ import { asTyped as c } from "./effectForm.js";
4
+ import { applyDerivations as l } from "./validation.js";
5
+ import { teamProblems as u } from "./team.js";
6
+ import { reviewRequiredFor as d } from "./review.js";
7
+ import { publish as f, saveDraft as p } from "./write.js";
8
+ import { and as m, eq as h } from "@voltro/database";
9
+ // src/blueprint.ts
10
+ var g = class extends Error {
11
11
  reason;
12
12
  _tag = "BlueprintInvalid";
13
13
  constructor(e) {
14
14
  super(`blueprint not usable: ${e}`), this.reason = e;
15
15
  }
16
- }, g = "$entry", _ = (e) => ({ [g]: e }), v = (e) => {
16
+ }, _ = "$entry", v = (e) => ({ [_]: e }), y = (e) => {
17
17
  if (typeof e != "object" || !e || Array.isArray(e)) return;
18
- let t = Object.keys(e), n = e[g];
18
+ let t = Object.keys(e), n = e[_];
19
19
  return t.length === 1 && typeof n == "string" ? n : void 0;
20
- }, y = (e, t) => {
21
- let n = v(e);
20
+ }, b = (e, t) => {
21
+ let n = y(e);
22
22
  if (n !== void 0) t.add(n);
23
- else if (Array.isArray(e)) for (let n of e) y(n, t);
24
- else if (typeof e == "object" && e) for (let n of Object.values(e)) y(n, t);
23
+ else if (Array.isArray(e)) for (let n of e) b(n, t);
24
+ else if (typeof e == "object" && e) for (let n of Object.values(e)) b(n, t);
25
25
  return t;
26
- }, b = (e, t) => {
27
- let n = v(e);
28
- return n === void 0 ? Array.isArray(e) ? e.map((e) => b(e, t)) : typeof e == "object" && e ? Object.fromEntries(Object.entries(e).map(([e, n]) => [e, b(n, t)])) : e : t.get(n);
29
- }, x = (e) => {
30
- let t = e.team === void 0 ? [] : l(e.team);
31
- if (t.length > 0) throw new h(t.join("; "));
26
+ }, x = (e, t) => {
27
+ let n = y(e);
28
+ return n === void 0 ? Array.isArray(e) ? e.map((e) => x(e, t)) : typeof e == "object" && e ? Object.fromEntries(Object.entries(e).map(([e, n]) => [e, x(n, t)])) : e : t.get(n);
29
+ }, S = (e) => {
30
+ let t = e.team === void 0 ? [] : u(e.team);
31
+ if (t.length > 0) throw new g(t.join("; "));
32
32
  let n = /* @__PURE__ */ new Map();
33
33
  for (let t of e.entries) {
34
- if (n.has(t.key)) throw new h(`the key '${t.key}' is used twice`);
34
+ if (n.has(t.key)) throw new g(`the key '${t.key}' is used twice`);
35
35
  n.set(t.key, t);
36
36
  }
37
- let r = new Map(e.entries.map((e) => [e.key, y([e.values, e.translations ?? {}], /* @__PURE__ */ new Set())]));
38
- for (let [e, t] of r) for (let r of t) if (!n.has(r)) throw new h(`'${e}' references '${r}', which is no entry`);
37
+ let r = new Map(e.entries.map((e) => [e.key, b([e.values, e.translations ?? {}], /* @__PURE__ */ new Set())]));
38
+ for (let [e, t] of r) for (let r of t) if (!n.has(r)) throw new g(`'${e}' references '${r}', which is no entry`);
39
39
  let i = [], a = /* @__PURE__ */ new Map(), o = (e, t) => {
40
40
  if (a.get(e) !== "done") {
41
- if (a.get(e) === "visiting") throw new h(`the entries reference each other in a circle: ${[...t, e].join(" → ")}`);
41
+ if (a.get(e) === "visiting") throw new g(`the entries reference each other in a circle: ${[...t, e].join(" → ")}`);
42
42
  a.set(e, "visiting");
43
43
  for (let n of r.get(e) ?? []) o(n, [...t, e]);
44
44
  a.set(e, "done"), i.push(n.get(e));
@@ -49,31 +49,31 @@ var h = class extends Error {
49
49
  ...e,
50
50
  entries: i
51
51
  };
52
- }, S = (e, t) => {
52
+ }, C = (e, t) => {
53
53
  let n = e.find((e) => e.name === t.type);
54
- if (n === void 0) throw new h(`'${t.key}' is of type '${t.type}', which this app does not have`);
55
- if (t.match !== void 0 && n.fields[t.match] === void 0) throw new h(`'${t.key}' matches on '${t.match}', which ${n.name} does not have`);
54
+ if (n === void 0) throw new g(`'${t.key}' is of type '${t.type}', which this app does not have`);
55
+ if (t.match !== void 0 && n.fields[t.match] === void 0) throw new g(`'${t.key}' matches on '${t.match}', which ${n.name} does not have`);
56
56
  return n;
57
- }, C = (t, n, r, i) => {
58
- let a = {};
59
- if (n.template !== void 0) {
60
- let r = e(t, n.template);
61
- if (r === null) throw new h(`'${n.key}' is built from the template '${n.template}', which ${t.name} does not have`);
62
- a = r;
57
+ }, w = (e, t, n, r) => {
58
+ let i = {};
59
+ if (t.template !== void 0) {
60
+ let n = s(e, t.template);
61
+ if (n === null) throw new g(`'${t.key}' is built from the template '${t.template}', which ${e.name} does not have`);
62
+ i = n;
63
63
  }
64
- let o = r === i ? {} : n.translations?.[r] ?? {};
64
+ let a = n === r ? {} : t.translations?.[n] ?? {};
65
65
  return {
66
- ...a,
67
- ...n.values,
68
- ...o
66
+ ...i,
67
+ ...t.values,
68
+ ...a
69
69
  };
70
- }, w = (e, t) => {
70
+ }, T = (e, t) => {
71
71
  if (typeof t.title == "string" && t.title !== "") return t.title;
72
72
  let n = e.match === void 0 ? void 0 : t[e.match];
73
73
  return typeof n == "string" && n !== "" ? n : e.key;
74
- }, T = (e, t, n, r) => e.query({
74
+ }, E = (e, t, n, r) => e.query({
75
75
  table: `${t.name}_drafts`,
76
- predicate: p(m("site", n.site), m("environment", n.environment), m("locale", n.locale), ...r === null ? [] : [r]),
76
+ predicate: m(h("site", n.site), h("environment", n.environment), h("locale", n.locale), ...r === null ? [] : [r]),
77
77
  order: [{
78
78
  column: "id",
79
79
  direction: "asc"
@@ -81,47 +81,47 @@ var h = class extends Error {
81
81
  take: 1,
82
82
  skip: void 0,
83
83
  projection: void 0
84
- }), E = async (e, t, n, r, i, a) => {
84
+ }), D = async (e, t, n, r, i, a) => {
85
85
  if (a !== null) {
86
- let [n] = await T(e, t, r, m("documentId", a));
86
+ let [n] = await E(e, t, r, h("documentId", a));
87
87
  if (n !== void 0) return n;
88
88
  }
89
89
  let o = n.match === void 0 ? void 0 : i[n.match];
90
90
  if (n.match !== void 0 && (o == null || o === "")) return null;
91
- let [s] = await T(e, t, r, n.match === void 0 ? null : m(n.match, o));
91
+ let [s] = await E(e, t, r, n.match === void 0 ? null : h(n.match, o));
92
92
  return s ?? null;
93
- }, D = (e, t) => [e.locale, ...Object.keys(t.translations ?? {}).filter((t) => t !== e.locale)], O = async (e, t, n, r, i) => {
93
+ }, O = (e, t) => [e.locale, ...Object.keys(t.translations ?? {}).filter((t) => t !== e.locale)], k = async (e, t, n, r, i) => {
94
94
  let a = /* @__PURE__ */ new Map(), o = [], s = 0;
95
- for (let l of n.entries) {
96
- let p = S(t, l), m = null, h = !1, g = !1;
97
- for (let t of D(n, l)) {
95
+ for (let c of n.entries) {
96
+ let u = C(t, c), m = null, h = !1, g = !1;
97
+ for (let t of O(n, c)) {
98
98
  if (g) break;
99
99
  let _ = {
100
100
  site: r.site,
101
101
  environment: r.environment,
102
102
  locale: t
103
- }, v = C(p, l, t, n.locale), y = c(p, b(v, a)), x = await E(e, p, l, _, y, m);
104
- if (x !== null) {
105
- g = t === n.locale, m ??= String(x.documentId), o.push({
106
- key: l.key,
107
- type: p.name,
103
+ }, v = w(u, c, t, n.locale), y = l(u, x(v, a)), b = await D(e, u, c, _, y, m);
104
+ if (b !== null) {
105
+ g = t === n.locale, m ??= String(b.documentId), o.push({
106
+ key: c.key,
107
+ type: u.name,
108
108
  locale: t,
109
- label: w(l, x),
109
+ label: T(c, b),
110
110
  action: "present",
111
- documentId: String(x.documentId),
112
- variantId: String(x.id),
111
+ documentId: String(b.documentId),
112
+ variantId: String(b.id),
113
113
  outcome: null
114
114
  });
115
115
  continue;
116
116
  }
117
- let S = w(l, y);
117
+ let S = T(c, y);
118
118
  m === null && !h && s++, h = !0;
119
- let T = l.publish === !1 ? "draft" : p.review?.required === !0 || p.review?.required === "workspace" && (n.team?.reviewRequired ?? []).includes(p.name) ? "review" : "live";
119
+ let C = c.publish === !1 ? "draft" : u.review?.required === !0 || u.review?.required === "workspace" && (n.team?.reviewRequired ?? []).includes(u.name) ? "review" : "live";
120
120
  if (!i) {
121
- let e = T;
121
+ let e = C;
122
122
  o.push({
123
- key: l.key,
124
- type: p.name,
123
+ key: c.key,
124
+ type: u.name,
125
125
  locale: t,
126
126
  label: S,
127
127
  action: "create",
@@ -131,36 +131,35 @@ var h = class extends Error {
131
131
  });
132
132
  continue;
133
133
  }
134
- let D = await f(e, p, {
134
+ let E = await p(e, u, {
135
135
  ...y,
136
136
  ...m === null ? {} : { documentId: m }
137
- }, _), O = T === "live" && await u(e, p, String(D.id)) ? "review" : T;
138
- O === "live" && await d(e, p, String(D.id), _), m ??= String(D.documentId), o.push({
139
- key: l.key,
140
- type: p.name,
137
+ }, _), O = C === "live" && await d(e, u, String(E.id)) ? "review" : C;
138
+ O === "live" && await f(e, u, String(E.id), _), m ??= String(E.documentId), o.push({
139
+ key: c.key,
140
+ type: u.name,
141
141
  locale: t,
142
142
  label: S,
143
143
  action: "create",
144
- documentId: String(D.documentId),
145
- variantId: String(D.id),
144
+ documentId: String(E.documentId),
145
+ variantId: String(E.id),
146
146
  outcome: O
147
147
  });
148
148
  }
149
- m !== null && a.set(l.key, m);
149
+ m !== null && a.set(c.key, m);
150
150
  }
151
151
  return {
152
152
  blueprint: n.id,
153
153
  steps: o,
154
154
  documents: s
155
155
  };
156
- }, k = (e, t, n, r) => O(e, t, n, r, !1), A = (e, t, n, r) => O(e, t, n, r, !0), j = [
157
- h,
156
+ }, A = (e, t, n, r) => k(e, t, n, r, !1), j = (e, t, n, r) => k(e, t, n, r, !0), M = [
157
+ g,
158
+ t,
158
159
  n,
159
160
  r,
160
161
  i,
161
162
  a,
162
- o,
163
- s
164
- ], M = (...e) => t(() => A(...e), ...j), N = (...e) => t(() => k(...e), ...j);
165
- //#endregion
166
- export { h as BlueprintInvalid, A as applyBlueprint, M as applyBlueprintEffect, _ as blueprintRef, x as defineBlueprint, k as planBlueprint, N as planBlueprintEffect };
163
+ o
164
+ ], N = (...t) => c(() => j(...t), ...M, e), P = (...e) => c(() => A(...e), ...M);
165
+ export { g as BlueprintInvalid, j as applyBlueprint, N as applyBlueprintEffect, v as blueprintRef, S as defineBlueprint, A as planBlueprint, P as planBlueprintEffect };