@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,19 +1,23 @@
1
- import { checkTemplates as e } from "./templates.js";
2
- import { checkSearch as t } from "./search.js";
3
- import { taxonomyProblem as n } from "./taxonomy.js";
4
- import { componentExampleViolations as r } from "./validation.js";
5
- import { boolean as i, date as a, id as o, integer as s, json as c, real as l, table as u, text as d, timestamp as f } from "@voltro/database";
6
- import { tenant as p } from "@voltro/plugin-multitenancy/mixin";
7
- //#region src/contentType.ts
8
- var m = [
1
+ import { ContentLocationUnavailable as e, ContentSeoUnavailable as t } from "./errors.js";
2
+ import { defineContentSeo as n, validateContentSeoFields as r } from "./contentSeo.js";
3
+ import { defineContentSeoSites as i } from "./publicationSeo.js";
4
+ import { checkTemplates as a } from "./templates.js";
5
+ import { checkSearch as o } from "./search.js";
6
+ import { taxonomyProblem as s } from "./taxonomy.js";
7
+ import { componentExampleViolations as c } from "./validation.js";
8
+ import { defineContentLocations as l } from "./contentLocations.js";
9
+ import { boolean as u, date as d, id as f, integer as p, json as m, real as h, table as g, text as _, timestamp as v } from "@voltro/database";
10
+ import { tenant as y } from "@voltro/plugin-multitenancy/mixin";
11
+ // src/contentType.ts
12
+ var b = [
9
13
  "site",
10
14
  "environment",
11
15
  "locale"
12
- ], h = [
16
+ ], x = [
13
17
  "draft",
14
18
  "published",
15
19
  "archived"
16
- ], g = [
20
+ ], S = [
17
21
  "id",
18
22
  "status",
19
23
  "publishAt",
@@ -29,58 +33,71 @@ var m = [
29
33
  "updatedAt",
30
34
  "createdBy",
31
35
  "updatedBy"
32
- ], _ = (i) => {
33
- let a = {}, o = [], s = [];
34
- for (let [e, t] of Object.entries(i.fields)) {
35
- if (g.includes(e)) throw Error(`defineContentType('${i.name}'): field '${e}' collides with a reserved lifecycle column (${g.join(", ")}). Rename it.`);
36
+ ], C = (u) => {
37
+ let d = {}, f = [], p = [];
38
+ for (let [e, t] of Object.entries(u.fields)) {
39
+ if (S.includes(e)) throw Error(`defineContentType('${u.name}'): field '${e}' collides with a reserved lifecycle column (${S.join(", ")}). Rename it.`);
36
40
  let n = t;
37
- if (n.unique && n.kind !== "string") throw Error(`defineContentType('${i.name}'): field '${e}' is marked unique() but is a '${n.kind}' field — per-tenant uniqueness is only supported on string fields (a slug). Remove unique() or make it a Schema.String.`);
38
- a[e] = n, n.derived && o.push(e), n.unique && s.push(e);
41
+ if (n.unique && n.kind !== "string") throw Error(`defineContentType('${u.name}'): field '${e}' is marked unique() but is a '${n.kind}' field — per-tenant uniqueness is only supported on string fields (a slug). Remove unique() or make it a Schema.String.`);
42
+ d[e] = n, n.derived && f.push(e), n.unique && p.push(e);
39
43
  }
40
- if (i.list) {
41
- let e = /* @__PURE__ */ new Set([...Object.keys(a), ...g]);
42
- for (let t of i.list.columns) if (!e.has(t)) throw Error(`defineContentType('${i.name}'): list.columns entry '${t}' is not a declared field (or lifecycle column) of this content type.`);
43
- let t = i.list.defaultSort?.field;
44
- if (t !== void 0 && !e.has(t)) throw Error(`defineContentType('${i.name}'): list.defaultSort.field '${t}' is not a declared field (or lifecycle column) of this content type.`);
44
+ let m = u.asset === void 0 ? void 0 : { file: u.asset.file };
45
+ if (m !== void 0 && (Object.keys(u.asset).some((e) => e !== "file") || typeof m.file != "string" || !Object.hasOwn(d, m.file) || d[m.file]?.kind !== "media" || d[m.file]?.isOptional === !0)) throw Error(`defineContentType('${u.name}'): asset.file must name a required Media field.`);
46
+ if (u.list) {
47
+ let e = /* @__PURE__ */ new Set([...Object.keys(d), ...S]);
48
+ for (let t of u.list.columns) if (!e.has(t)) throw Error(`defineContentType('${u.name}'): list.columns entry '${t}' is not a declared field (or lifecycle column) of this content type.`);
49
+ let t = u.list.defaultSort?.field;
50
+ if (t !== void 0 && !e.has(t)) throw Error(`defineContentType('${u.name}'): list.defaultSort.field '${t}' is not a declared field (or lifecycle column) of this content type.`);
45
51
  }
46
- if (i.tree && y(i.name, a, i.tree), i.address !== void 0) {
47
- if (i.tree) throw Error(`defineContentType('${i.name}'): address is for a type outside a tree — a tree type is addressed by its tree.`);
48
- if (a[i.address]?.kind !== "string") throw Error(`defineContentType('${i.name}'): address '${i.address}' must be a declared string field.`);
52
+ if (u.tree && T(u.name, d, u.tree), u.address !== void 0) {
53
+ if (u.tree) throw Error(`defineContentType('${u.name}'): address is for a type outside a tree — a tree type is addressed by its tree.`);
54
+ if (d[u.address]?.kind !== "string") throw Error(`defineContentType('${u.name}'): address '${u.address}' must be a declared string field.`);
49
55
  }
50
- i.availability && b(i.name, a, i.availability), i.templates && e(i.name, a, i.templates), i.search && t(i.name, a, i.search), i.quality && v(i.name, a, i.quality);
51
- for (let e of Object.values(a)) for (let t of e.components ?? []) {
52
- let [e] = r(t);
53
- if (e !== void 0) throw Error(`defineContentType('${i.name}'): component '${t.id}' ${e.field}: ${e.message}.`);
56
+ u.availability && E(u.name, d, u.availability), u.templates && a(u.name, d, u.templates), u.search && o(u.name, d, u.search), u.quality && w(u.name, d, u.quality);
57
+ for (let e of Object.values(d)) for (let t of e.components ?? []) {
58
+ let [e] = c(t);
59
+ if (e !== void 0) throw Error(`defineContentType('${u.name}'): component '${t.id}' ${e.field}: ${e.message}.`);
54
60
  }
55
- if (i.taxonomy) {
56
- let e = a[i.taxonomy.field];
57
- if (e?.kind !== "array" || e.element?.kind !== "string") throw Error(`defineContentType('${i.name}'): taxonomy field '${i.taxonomy.field}' must be a declared Schema.Array(Schema.String) field.`);
58
- let t = n(i.taxonomy);
59
- if (t !== null) throw Error(`defineContentType('${i.name}'): taxonomy ${t}.`);
61
+ if (u.taxonomy) {
62
+ let e = d[u.taxonomy.field];
63
+ if (e?.kind !== "array" || e.element?.kind !== "string") throw Error(`defineContentType('${u.name}'): taxonomy field '${u.taxonomy.field}' must be a declared Schema.Array(Schema.String) field.`);
64
+ let t = s(u.taxonomy);
65
+ if (t !== null) throw Error(`defineContentType('${u.name}'): taxonomy ${t}.`);
66
+ }
67
+ if (u.lifecycle && !(Number.isInteger(u.lifecycle.reviewEveryDays) && u.lifecycle.reviewEveryDays > 0)) throw Error(`defineContentType('${u.name}'): lifecycle.reviewEveryDays must be a positive whole number of days.`);
68
+ let h = u.seo === void 0 ? void 0 : n(u.seo);
69
+ if (h !== void 0 && r(h, d), u.seoSites !== void 0 && h === void 0) throw new t({ reason: "definition" });
70
+ let g = u.seoSites === void 0 ? void 0 : i(u.seoSites), _ = u.locations === void 0 ? void 0 : l(u.locations);
71
+ for (let t of _ ?? []) for (let n of t.segments) if (typeof n != "string") {
72
+ if ("field" in n && d[n.field]?.kind !== "string") throw new e({ reason: "field" });
73
+ if ("tree" in n && u.tree === void 0) throw new e({ reason: "tree" });
60
74
  }
61
- if (i.lifecycle && !(Number.isInteger(i.lifecycle.reviewEveryDays) && i.lifecycle.reviewEveryDays > 0)) throw Error(`defineContentType('${i.name}'): lifecycle.reviewEveryDays must be a positive whole number of days.`);
62
75
  return {
63
- name: i.name,
64
- displayName: i.displayName,
65
- pluralName: i.pluralName,
66
- fields: a,
67
- ...i.list ? { list: i.list } : {},
68
- ...i.idPrefix ? { idPrefix: i.idPrefix } : {},
69
- ...i.revalidate ? { revalidate: i.revalidate } : {},
70
- ...i.tree ? { tree: i.tree } : {},
71
- ...i.address === void 0 ? {} : { address: i.address },
72
- ...i.review ? { review: i.review } : {},
73
- ...i.availability ? { availability: i.availability } : {},
74
- ...i.lifecycle ? { lifecycle: i.lifecycle } : {},
75
- ...i.templates ? { templates: i.templates } : {},
76
- ...i.changeFeed === !0 ? { changeFeed: !0 } : {},
77
- ...i.search ? { search: i.search } : {},
78
- ...i.quality && i.quality.length > 0 ? { quality: i.quality } : {},
79
- ...i.taxonomy ? { taxonomy: i.taxonomy } : {},
80
- derivedFields: o,
81
- uniqueFields: s
76
+ name: u.name,
77
+ displayName: u.displayName,
78
+ pluralName: u.pluralName,
79
+ fields: d,
80
+ ...m === void 0 ? {} : { asset: m },
81
+ ...u.list ? { list: u.list } : {},
82
+ ...u.idPrefix ? { idPrefix: u.idPrefix } : {},
83
+ ...u.revalidate ? { revalidate: u.revalidate } : {},
84
+ ...u.tree ? { tree: u.tree } : {},
85
+ ...u.address === void 0 ? {} : { address: u.address },
86
+ ..._ === void 0 ? {} : { locations: _ },
87
+ ...h === void 0 ? {} : { seo: h },
88
+ ...g === void 0 ? {} : { seoSites: g },
89
+ ...u.review ? { review: u.review } : {},
90
+ ...u.availability ? { availability: u.availability } : {},
91
+ ...u.lifecycle ? { lifecycle: u.lifecycle } : {},
92
+ ...u.templates ? { templates: u.templates } : {},
93
+ ...u.changeFeed === !0 ? { changeFeed: !0 } : {},
94
+ ...u.search ? { search: u.search } : {},
95
+ ...u.quality && u.quality.length > 0 ? { quality: u.quality } : {},
96
+ ...u.taxonomy ? { taxonomy: u.taxonomy } : {},
97
+ derivedFields: f,
98
+ uniqueFields: p
82
99
  };
83
- }, v = (e, t, n) => {
100
+ }, w = (e, t, n) => {
84
101
  let r = /* @__PURE__ */ new Set();
85
102
  for (let i of n) {
86
103
  if (!/^[A-Za-z][A-Za-z0-9.-]{0,63}$/.test(i.id)) throw Error(`defineContentType('${e}'): quality rule id '${i.id}' must be letters, digits, '.' or '-', at most 64.`);
@@ -88,18 +105,18 @@ var m = [
88
105
  if (r.add(i.id), t[i.field] === void 0) throw Error(`defineContentType('${e}'): quality rule '${i.id}' names '${i.field}', which is no field of this type.`);
89
106
  if (i.sites?.length === 0 || i.locales?.length === 0) throw Error(`defineContentType('${e}'): quality rule '${i.id}' names an empty list of sites or locales — leave it out to apply everywhere.`);
90
107
  }
91
- }, y = (e, t, n) => {
108
+ }, T = (e, t, n) => {
92
109
  let r = (t) => {
93
110
  throw Error(`defineContentType('${e}'): tree ${t}`);
94
111
  }, i = t[n.parent];
95
- i === void 0 ? r(`parent '${n.parent}' is not a declared field.`) : (i.kind !== "reference" || i.referenceType !== e || !i.isOptional) && r(`parent '${n.parent}' must be Schema.Reference('${e}').optional() — roots have no parent.`);
112
+ i === void 0 ? r(`parent '${n.parent}' is not a declared field.`) : i.kind === "reference" && i.referenceType === e && i.isOptional || r(`parent '${n.parent}' must be Schema.Reference('${e}').optional() — roots have no parent.`);
96
113
  let a = t[n.segment];
97
114
  (a === void 0 || a.kind !== "string") && r(`segment '${n.segment}' must be a declared string field.`), n.order !== void 0 && t[n.order]?.kind !== "number" && r(`order '${n.order}' must be a declared number field.`);
98
- for (let [e, i] of Object.entries(n.inherit ?? {})) if ((t[e] === void 0 || !t[e].isOptional) && r(`inherit '${e}' must be a declared optional field — a page that sets nothing inherits.`), i.mask !== void 0) {
115
+ for (let [e, i] of Object.entries(n.inherit ?? {})) if (t[e] !== void 0 && t[e].isOptional || r(`inherit '${e}' must be a declared optional field — a page that sets nothing inherits.`), i.mask !== void 0) {
99
116
  let n = t[i.mask];
100
- (n === void 0 || !n.isOptional || n.kind !== "boolean") && r(`inherit '${e}' mask '${i.mask}' must be a declared optional Boolean field.`), i.locked === !0 && r(`inherit '${e}' is locked, so it cannot be masked — drop 'mask' or 'locked'.`);
117
+ n !== void 0 && n.isOptional && n.kind === "boolean" || r(`inherit '${e}' mask '${i.mask}' must be a declared optional Boolean field.`), i.locked === !0 && r(`inherit '${e}' is locked, so it cannot be masked — drop 'mask' or 'locked'.`);
101
118
  }
102
- }, b = (e, t, n) => {
119
+ }, E = (e, t, n) => {
103
120
  let r = n.until === void 0 ? void 0 : t[n.until];
104
121
  if (n.until !== void 0 && (r === void 0 || r.kind !== "date" && r.kind !== "datetime")) throw Error(`defineContentType('${e}'): availability.until '${n.until}' must be a declared date or datetime field.`);
105
122
  let i = n.blocked === void 0 ? void 0 : t[n.blocked];
@@ -114,78 +131,77 @@ var m = [
114
131
  let i = n[r] === void 0 ? void 0 : t[n[r]];
115
132
  if (n[r] !== void 0 && (i?.kind !== "array" || i.element?.kind !== "string" && i.element?.kind !== "literal")) throw Error(`defineContentType('${e}'): availability.${r} '${n[r]}' must be a declared list of text or choices.`);
116
133
  }
117
- }, x = (e) => {
134
+ }, D = (e) => {
118
135
  switch (e.kind) {
119
- case "string": return e.isOptional ? d().nullable() : d();
120
- case "number": return e.fraction === !0 ? e.isOptional ? l().nullable() : l() : e.isOptional ? s().nullable() : s();
121
- case "boolean": return e.isOptional ? i().nullable() : i();
122
- case "date": return e.isOptional ? a().nullable() : a();
123
- case "datetime": return e.isOptional ? f().nullable() : f();
136
+ case "string": return e.isOptional ? _().nullable() : _();
137
+ case "number": return e.fraction === !0 ? e.isOptional ? h().nullable() : h() : e.isOptional ? p().nullable() : p();
138
+ case "boolean": return e.isOptional ? u().nullable() : u();
139
+ case "date": return e.isOptional ? d().nullable() : d();
140
+ case "datetime": return e.isOptional ? v().nullable() : v();
124
141
  case "literal": {
125
- let t = e.literals ?? [], n = t.length > 0 ? d().oneOf(t) : d();
142
+ let t = e.literals ?? [], n = t.length > 0 ? _().oneOf(t) : _();
126
143
  return e.isOptional ? n.nullable() : n;
127
144
  }
128
145
  case "richText":
129
146
  case "array":
130
147
  case "struct":
131
148
  case "components": {
132
- let t = c();
149
+ let t = m();
133
150
  return e.isOptional ? t.nullable() : t;
134
151
  }
135
152
  case "media":
136
- case "reference": return e.isOptional ? d().nullable() : d();
153
+ case "reference": return e.isOptional ? _().nullable() : _();
137
154
  }
138
- }, S = (e) => {
155
+ }, O = (e) => {
139
156
  let t = {};
140
- for (let [n, r] of Object.entries(e.fields)) t[n] = x(r);
157
+ for (let [n, r] of Object.entries(e.fields)) t[n] = D(r);
141
158
  return t;
142
- }, C = (e) => e.idPrefix, w = (e, t) => {
143
- let n = C(e), r = n ? o({ prefix: n }) : o(), i = u(`${e.name}_${t}`, {
159
+ }, k = (e) => e.idPrefix, A = (e, t) => {
160
+ let n = k(e), r = n ? f({ prefix: n }) : f(), i = g(`${e.name}_${t}`, {
144
161
  id: r,
145
- status: d().oneOf(h),
162
+ status: _().oneOf(x),
146
163
  ...t === "drafts" ? {
147
- publishAt: f().nullable(),
148
- unpublishAt: f().nullable()
164
+ publishAt: v().nullable(),
165
+ unpublishAt: v().nullable()
149
166
  } : {},
150
- revisionId: d().default(""),
151
- revision: s().default(0),
152
- documentId: d().maxLength(64).backfill((e) => String(e.id)),
153
- site: d().maxLength(64).default(""),
154
- environment: d().maxLength(64).default(""),
155
- locale: d().maxLength(64).default(""),
156
- ...S(e)
157
- }).with(p()).unique(D(e, `${e.name}_${t}_variant_key`, "the document variant key"), [
167
+ revisionId: _().default(""),
168
+ revision: p().default(0),
169
+ documentId: _().maxLength(64).backfill((e) => String(e.id)),
170
+ site: _().maxLength(64).default(""),
171
+ environment: _().maxLength(64).default(""),
172
+ locale: _().maxLength(64).default(""),
173
+ ...O(e)
174
+ }).with(y()).unique(N(e, `${e.name}_${t}_variant_key`, "the document variant key"), [
158
175
  "tenantId",
159
- ...m,
176
+ ...b,
160
177
  "documentId"
161
178
  ]);
162
- return e.uniqueFields.reduce((n, r) => n.unique(E(e, t, r), [
179
+ return e.uniqueFields.reduce((n, r) => n.unique(M(e, t, r), [
163
180
  "tenantId",
164
- ...m,
181
+ ...b,
165
182
  r
166
183
  ]), i);
167
- }, T = 63, E = (e, t, n) => D(e, `${e.name}_${t}_uq_${n}`, `the unique constraint for field '${n}'`), D = (e, t, n) => {
168
- if (t.length > T) throw Error(`contentTypeToEntities('${e.name}'): ${n} would be named '${t}' (${t.length} chars), past the ${T}-byte identifier limit. Shorten the content type name or the field name.`);
184
+ }, j = 63, M = (e, t, n) => N(e, `${e.name}_${t}_uq_${n}`, `the unique constraint for field '${n}'`), N = (e, t, n) => {
185
+ if (t.length > j) throw Error(`contentTypeToEntities('${e.name}'): ${n} would be named '${t}' (${t.length} chars), past the ${j}-byte identifier limit. Shorten the content type name or the field name.`);
169
186
  return t;
170
- }, O = "cms_revisions", k = u(O, {
171
- id: o({ prefix: "crev" }),
172
- contentType: d().maxLength(64),
173
- documentId: d().maxLength(64),
174
- number: s(),
175
- site: d().maxLength(64).default(""),
176
- environment: d().maxLength(64).default(""),
177
- locale: d().maxLength(64).default(""),
178
- values: c(),
179
- basedOn: d().nullable()
180
- }).with(p()).unique("cms_revisions_uq_variant_number", [
187
+ }, P = "cms_revisions", F = g(P, {
188
+ id: f({ prefix: "crev" }),
189
+ contentType: _().maxLength(64),
190
+ documentId: _().maxLength(64),
191
+ number: p(),
192
+ site: _().maxLength(64).default(""),
193
+ environment: _().maxLength(64).default(""),
194
+ locale: _().maxLength(64).default(""),
195
+ values: m(),
196
+ basedOn: _().nullable()
197
+ }).with(y()).unique("cms_revisions_uq_variant_number", [
181
198
  "tenantId",
182
199
  "contentType",
183
200
  "documentId",
184
- ...m,
201
+ ...b,
185
202
  "number"
186
- ]), A = (e) => ({
187
- draft: w(e, "drafts"),
188
- published: w(e, "published")
203
+ ]), I = (e) => ({
204
+ draft: A(e, "drafts"),
205
+ published: A(e, "published")
189
206
  });
190
- //#endregion
191
- export { O as CMS_REVISIONS_TABLE, m as CMS_SCOPE_COLUMNS, h as CONTENT_STATUSES, g as RESERVED_FIELD_NAMES, k as cmsRevisionsTable, A as contentTypeToEntities, _ as defineContentType };
207
+ export { P as CMS_REVISIONS_TABLE, b as CMS_SCOPE_COLUMNS, x as CONTENT_STATUSES, S as RESERVED_FIELD_NAMES, F as cmsRevisionsTable, I as contentTypeToEntities, C as defineContentType };
@@ -0,0 +1,17 @@
1
+ // src/contentValues.ts
2
+ var e = (e, t) => {
3
+ let n = {};
4
+ for (let r of Object.keys(e.fields)) r in t && (n[r] = t[r]);
5
+ return n;
6
+ }, t = (e) => {
7
+ if (e == null) return {
8
+ ok: !0,
9
+ value: null
10
+ };
11
+ let t = e instanceof Date ? e : typeof e == "string" || typeof e == "number" ? new Date(e) : null;
12
+ return t === null || !Number.isFinite(t.getTime()) ? { ok: !1 } : {
13
+ ok: !0,
14
+ value: t.toISOString()
15
+ };
16
+ };
17
+ export { e as pickDeclared, t as readContentModificationTime };
@@ -1,5 +1,5 @@
1
1
  import "./richDocument.js";
2
- //#region src/contentfulImport.ts
2
+ // src/contentfulImport.ts
3
3
  var e = {
4
4
  bold: "bold",
5
5
  italic: "italic",
@@ -158,5 +158,4 @@ var e = {
158
158
  findings: a
159
159
  };
160
160
  };
161
- //#endregion
162
161
  export { t as richDocumentFromContentful };
package/dist/copies.js CHANGED
@@ -1,9 +1,9 @@
1
- import { asTyped as e } from "./effectForm.js";
2
- import { ContentIdConflict as t, ContentNotFound as n, ContentValidationFailed as r, RevisionMismatch as i } from "./errors.js";
1
+ import { ContentIdConflict as e, ContentNotFound as t, ContentValidationFailed as n, RevisionMismatch as r } from "./errors.js";
2
+ import { asTyped as i } from "./effectForm.js";
3
3
  import { saveDraft as a } from "./write.js";
4
4
  import { and as o, eq as s, id as c, table as l, text as u, timestamp as d } from "@voltro/database";
5
5
  import { tenant as f } from "@voltro/plugin-multitenancy/mixin";
6
- //#region src/copies.ts
6
+ // src/copies.ts
7
7
  var p = "cms_copies", m = l(p, {
8
8
  id: c({ prefix: "ccpy" }),
9
9
  contentType: u().maxLength(64),
@@ -84,6 +84,5 @@ var p = "cms_copies", m = l(p, {
84
84
  })).map((e) => ({
85
85
  ...b(e),
86
86
  documentId: String(e.documentId)
87
- })), S = (...a) => e(() => v(...a), r, n, t, i), C = (...t) => e(() => y(...t)), w = (...t) => e(() => x(...t));
88
- //#endregion
87
+ })), S = (...a) => i(() => v(...a), n, t, e, r), C = (...e) => i(() => y(...e)), w = (...e) => i(() => x(...e));
89
88
  export { p as CMS_COPIES_TABLE, m as cmsCopiesTable, x as copiesOf, w as copiesOfEffect, v as copyDocument, S as copyDocumentEffect, y as copyOrigin, C as copyOriginEffect };
package/dist/cutover.js CHANGED
@@ -2,7 +2,7 @@ import { asTyped as e } from "./effectForm.js";
2
2
  import { CMS_REVISIONS_TABLE as t } from "./contentType.js";
3
3
  import { and as n, eq as r, gt as i, id as a, inSet as o, json as s, table as c, text as l, timestamp as u } from "@voltro/database";
4
4
  import { tenant as d } from "@voltro/plugin-multitenancy/mixin";
5
- //#region src/cutover.ts
5
+ // src/cutover.ts
6
6
  var f = "cms_cutover_issues", p = "cms_cutover_decisions", m = c(f, {
7
7
  id: a({ prefix: "ccis" }),
8
8
  source: l().maxLength(200),
@@ -198,5 +198,4 @@ var f = "cms_cutover_issues", p = "cms_cutover_decisions", m = c(f, {
198
198
  decidedBy: String(e.decidedBy),
199
199
  decidedAt: e.decidedAt instanceof Date ? e.decidedAt : new Date(String(e.decidedAt))
200
200
  })), E = (...t) => e(() => b(...t)), D = (...t) => e(() => x(...t)), O = (...t) => e(() => S(...t)), k = (...t) => e(() => C(...t)), A = (...t) => e(() => w(...t)), j = (...t) => e(() => T(...t));
201
- //#endregion
202
201
  export { p as CMS_CUTOVER_DECISIONS_TABLE, f as CMS_CUTOVER_ISSUES_TABLE, g as MAX_ROLLBACK_DAYS, h as cmsCutoverDecisionsTable, m as cmsCutoverIssuesTable, C as cutoverAdoption, k as cutoverAdoptionEffect, T as cutoverDecisions, j as cutoverDecisionsEffect, x as cutoverIssues, D as cutoverIssuesEffect, _ as cutoverPlanProblem, w as decideCutover, A as decideCutoverEffect, v as evaluateCutover, b as recordCutoverIssues, E as recordCutoverIssuesEffect, S as resolveCutoverIssue, O as resolveCutoverIssueEffect };
@@ -2,7 +2,7 @@ import { asTyped as e } from "./effectForm.js";
2
2
  import { CMS_RELEASES_TABLE as t, CMS_RELEASE_ITEMS_TABLE as n } from "./release.js";
3
3
  import { and as r, eq as i, id as a, integer as o, table as s, text as c, timestamp as l } from "@voltro/database";
4
4
  import { tenant as u } from "@voltro/plugin-multitenancy/mixin";
5
- //#region src/deliveryChecks.ts
5
+ // src/deliveryChecks.ts
6
6
  var d = "cms_delivery_checks", f = s(d, {
7
7
  id: a({ prefix: "cdlv" }),
8
8
  contentType: c().maxLength(64),
@@ -134,5 +134,4 @@ var d = "cms_delivery_checks", f = s(d, {
134
134
  complete: u.length > 0 && f === u.length
135
135
  };
136
136
  }, b = (...t) => e(() => h(...t)), x = (...t) => e(() => g(...t)), S = (...t) => e(() => _(...t)), C = (...t) => e(() => y(...t));
137
- //#endregion
138
137
  export { d as CMS_DELIVERY_CHECKS_TABLE, f as cmsDeliveryChecksTable, _ as deliveryChecks, S as deliveryChecksEffect, y as releaseCheckpoint, C as releaseCheckpointEffect, h as requestDeliveryCheck, b as requestDeliveryCheckEffect, g as runDeliveryChecks, x as runDeliveryChecksEffect };
@@ -0,0 +1,6 @@
1
+ // src/domainHost.ts
2
+ var e = /^(?=.{1,253}$)(?!-)[a-z0-9-]{1,63}(?<!-)(\.(?!-)[a-z0-9-]{1,63}(?<!-))+$/, t = (t) => {
3
+ let n = t.trim().toLowerCase().replace(/\.$/, "");
4
+ return e.test(n) && !/^\d+(\.\d+){3}$/.test(n) ? n : null;
5
+ };
6
+ export { t as normalizeHost };
package/dist/domains.js CHANGED
@@ -1,20 +1,23 @@
1
- import { asTyped as e } from "./effectForm.js";
2
- import { and as t, boolean as n, eq as r, id as i, table as a, text as o, timestamp as s } from "@voltro/database";
3
- import { tenant as c } from "@voltro/plugin-multitenancy/mixin";
4
- import { randomBytes as l } from "node:crypto";
5
- //#region src/domains.ts
6
- var u = "cms_site_domains", d = a(u, {
7
- id: i({ prefix: "cdom" }),
8
- site: o().maxLength(64),
9
- host: o().maxLength(253),
10
- token: o().maxLength(64),
11
- status: o().oneOf(["pending", "verified"]),
12
- verifiedAt: s().nullable(),
13
- isPrimary: n().default(!1)
14
- }).with(c()).unique("cms_site_domains_host", ["host"]), f = /^(?=.{1,253}$)(?!-)[a-z0-9-]{1,63}(?<!-)(\.(?!-)[a-z0-9-]{1,63}(?<!-))+$/, p = (e) => {
15
- let t = e.trim().toLowerCase().replace(/\.$/, "");
16
- return f.test(t) && !/^\d+(\.\d+){3}$/.test(t) ? t : null;
17
- }, m = (e) => ({
1
+ import { PublicRouteRegistryUnavailable as e } from "./publicRouteRegistry.js";
2
+ import { ChangeFeedUnavailable as t, SiteStateUnavailable as n } from "./errors.js";
3
+ import { asTyped as r } from "./effectForm.js";
4
+ import { copySiteScope as i, lockSiteState as a, siteStatePredicate as o } from "./siteState.js";
5
+ import { normalizeHost as s } from "./domainHost.js";
6
+ import { withPublicRouteStateMutation as c } from "./publicRouteMutation.js";
7
+ import { reconcileDomainPublication as l } from "./publicRouteSitePublication.js";
8
+ import { and as u, boolean as d, eq as f, id as p, table as m, text as h, timestamp as g } from "@voltro/database";
9
+ import { tenant as _ } from "@voltro/plugin-multitenancy/mixin";
10
+ import { randomBytes as v } from "node:crypto";
11
+ // src/domains.ts
12
+ var y = "cms_site_domains", b = m(y, {
13
+ id: p({ prefix: "cdom" }),
14
+ site: h().maxLength(64),
15
+ host: h().maxLength(253),
16
+ token: h().maxLength(64),
17
+ status: h().oneOf(["pending", "verified"]),
18
+ verifiedAt: g().nullable(),
19
+ isPrimary: d().default(!1)
20
+ }).with(_()).unique("cms_site_domains_host", ["host"]), x = (e) => ({
18
21
  id: String(e.id),
19
22
  site: String(e.site),
20
23
  host: String(e.host),
@@ -25,9 +28,9 @@ var u = "cms_site_domains", d = a(u, {
25
28
  name: `_voltro-verify.${String(e.host)}`,
26
29
  value: `voltro-verify=${String(e.token)}`
27
30
  }
28
- }), h = async (e, t) => (await e.query({
29
- table: u,
30
- predicate: r("site", t),
31
+ }), S = async (e, t) => (await e.query({
32
+ table: y,
33
+ predicate: o(i(t)),
31
34
  order: [{
32
35
  column: "host",
33
36
  direction: "asc"
@@ -35,111 +38,101 @@ var u = "cms_site_domains", d = a(u, {
35
38
  take: 100,
36
39
  skip: void 0,
37
40
  projection: void 0
38
- })).map(m).sort((e, t) => Number(t.primary) - Number(e.primary)), g = async (e, t, n) => {
39
- let i = p(n);
40
- if (i === null) return {
41
+ })).map(x).sort((e, t) => Number(t.primary) - Number(e.primary)), C = async (e, t, n) => {
42
+ let r = i(t), o = s(n);
43
+ if (o === null) return {
41
44
  ok: !1,
42
45
  reason: "notAHost"
43
46
  };
44
- let [a] = await e.query({
45
- table: u,
46
- predicate: r("host", i),
47
- order: [],
48
- take: 1,
49
- skip: void 0,
50
- projection: void 0,
51
- crossTenant: !0
52
- });
53
- return a === void 0 ? {
54
- ok: !0,
55
- domain: m(await e.insert(u, {
56
- site: t,
57
- host: i,
58
- token: l(16).toString("hex"),
59
- status: "pending",
60
- verifiedAt: null,
61
- isPrimary: !1
62
- }))
63
- } : {
47
+ await a(e, r);
48
+ let c = await e.insertIgnoreWithOutcome(y, {
49
+ ...r,
50
+ host: o,
51
+ token: v(16).toString("hex"),
52
+ status: "pending",
53
+ verifiedAt: null,
54
+ isPrimary: !1
55
+ }, { conflictColumns: ["host"] });
56
+ return c.outcome === "ignored" ? {
64
57
  ok: !1,
65
58
  reason: "taken"
59
+ } : {
60
+ ok: !0,
61
+ domain: x(c.row)
66
62
  };
67
- }, _ = async (e, t, n, i = /* @__PURE__ */ new Date()) => {
68
- let [a] = await e.query({
69
- table: u,
70
- predicate: r("id", t),
63
+ }, w = async (e, t, n) => {
64
+ let r = i(t);
65
+ await a(e, r);
66
+ let [s] = await e.query({
67
+ table: y,
68
+ predicate: u(o(r), f("id", n)),
69
+ lock: "update",
71
70
  order: [],
72
71
  take: 1,
73
72
  skip: void 0,
74
73
  projection: void 0
75
74
  });
75
+ return s;
76
+ }, T = async (e, t, n, r, i = /* @__PURE__ */ new Date()) => {
77
+ let a = await w(e, t, n);
76
78
  if (a === void 0) return {
77
79
  ok: !1,
78
80
  reason: "notFound"
79
81
  };
80
- let o = m(a);
82
+ let o = x(a);
81
83
  if (o.status === "verified") return {
82
84
  ok: !0,
83
85
  domain: o
84
86
  };
85
- let s = await n(o.record.name).catch(() => []);
86
- return s.some((e) => e.trim() === o.record.value) ? {
87
- ok: !0,
88
- domain: m(await e.update(u, t, {
87
+ let s = await r(o.record.name).catch(() => []);
88
+ return s.some((e) => e.trim() === o.record.value) ? c(e, async () => {
89
+ let r = await e.update(y, n, {
89
90
  status: "verified",
90
91
  verifiedAt: i
91
- }) ?? {
92
- ...a,
93
- status: "verified",
94
- verifiedAt: i
95
- })
96
- } : {
92
+ });
93
+ return await l(e, t), {
94
+ ok: !0,
95
+ domain: x(r ?? {
96
+ ...a,
97
+ status: "verified",
98
+ verifiedAt: i
99
+ })
100
+ };
101
+ }) : {
97
102
  ok: !1,
98
103
  reason: "recordMissing",
99
104
  found: s
100
105
  };
101
- }, v = async (e, n) => {
102
- let [i] = await e.query({
103
- table: u,
104
- predicate: r("id", n),
105
- order: [],
106
- take: 1,
107
- skip: void 0,
108
- projection: void 0
109
- });
110
- return i === void 0 ? {
106
+ }, E = async (e, t, n) => {
107
+ let r = await w(e, t, n);
108
+ return r === void 0 ? {
111
109
  ok: !1,
112
110
  reason: "notFound"
113
- } : i.status === "verified" ? (await e.updateMany(u, { isPrimary: !1 }, { where: t(r("site", String(i.site)), r("isPrimary", !0)) }), await e.update(u, n, { isPrimary: !0 }), { ok: !0 }) : {
111
+ } : r.status === "verified" ? c(e, async () => (await e.updateMany(y, { isPrimary: !1 }, { where: u(o({
112
+ tenantId: String(r.tenantId),
113
+ site: String(r.site)
114
+ }), f("isPrimary", !0)) }), await e.update(y, n, { isPrimary: !0 }), await l(e, t), { ok: !0 })) : {
114
115
  ok: !1,
115
116
  reason: "notVerified"
116
117
  };
117
- }, y = async (e, t) => {
118
- let [n] = await e.query({
119
- table: u,
120
- predicate: r("id", t),
121
- order: [],
122
- take: 1,
123
- skip: void 0,
124
- projection: void 0
125
- });
126
- return n === void 0 ? {
118
+ }, D = async (e, t, n) => {
119
+ let r = await w(e, t, n);
120
+ return r === void 0 ? {
127
121
  ok: !1,
128
122
  reason: "notFound"
129
- } : n.isPrimary === !0 ? {
123
+ } : r.isPrimary === !0 ? {
130
124
  ok: !1,
131
125
  reason: "primary"
132
- } : (await e.delete(u, t), { ok: !0 });
133
- }, b = async (e, n) => {
134
- let [i] = await e.query({
135
- table: u,
136
- predicate: t(r("site", n), r("isPrimary", !0)),
126
+ } : c(e, async () => (await e.delete(y, n), r.status === "verified" && await l(e, t), { ok: !0 }));
127
+ }, O = async (e, t) => {
128
+ let [n] = await e.query({
129
+ table: y,
130
+ predicate: u(o(i(t)), f("status", "verified"), f("isPrimary", !0)),
137
131
  order: [],
138
132
  take: 1,
139
133
  skip: void 0,
140
134
  projection: void 0
141
135
  });
142
- return i === void 0 ? null : String(i.host);
143
- }, x = (...t) => e(() => h(...t)), S = (...t) => e(() => g(...t)), C = (...t) => e(() => _(...t)), w = (...t) => e(() => v(...t)), T = (...t) => e(() => y(...t)), E = (...t) => e(() => b(...t));
144
- //#endregion
145
- export { u as CMS_SITE_DOMAINS_TABLE, g as addDomain, S as addDomainEffect, d as cmsSiteDomainsTable, p as normalizeHost, b as primaryDomain, E as primaryDomainEffect, y as removeDomain, T as removeDomainEffect, v as setPrimaryDomain, w as setPrimaryDomainEffect, h as siteDomains, x as siteDomainsEffect, _ as verifyDomain, C as verifyDomainEffect };
136
+ return n === void 0 ? null : String(n.host);
137
+ }, k = (...e) => r(() => S(...e), n), A = (...e) => r(() => C(...e), n), j = (...i) => r(() => T(...i), n, t, e), M = (...i) => r(() => E(...i), n, t, e), N = (...i) => r(() => D(...i), n, t, e), P = (...e) => r(() => O(...e), n);
138
+ export { y as CMS_SITE_DOMAINS_TABLE, C as addDomain, A as addDomainEffect, b as cmsSiteDomainsTable, s as normalizeHost, O as primaryDomain, P as primaryDomainEffect, D as removeDomain, N as removeDomainEffect, E as setPrimaryDomain, M as setPrimaryDomainEffect, S as siteDomains, k as siteDomainsEffect, T as verifyDomain, j as verifyDomainEffect };