@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
@@ -0,0 +1,39 @@
1
+ import { defineContentLocations as e } from "./contentLocations.js";
2
+ //#region src/contentRouteTypes.ts
3
+ var t = (e) => typeof e == "string" && e.length > 0, n = (e, t) => e < t ? -1 : +(e > t), r = (r) => {
4
+ if (r.length === 0 || r.some((e) => !t(e.name)) || new Set(r.map((e) => e.name)).size !== r.length) return {
5
+ ok: !1,
6
+ reason: "types"
7
+ };
8
+ let i = [];
9
+ for (let n of r) {
10
+ let r = e(n.locations ?? []);
11
+ if ((n.tree !== void 0 || n.address !== void 0) && r.length === 0) return {
12
+ ok: !1,
13
+ reason: "mapping"
14
+ };
15
+ for (let e of r) for (let t of e.segments) if (typeof t != "string" && ("field" in t && n.fields[t.field]?.kind !== "string" || "tree" in t && n.tree === void 0)) return {
16
+ ok: !1,
17
+ reason: "mapping"
18
+ };
19
+ let a = n.tree === void 0 ? null : {
20
+ parent: n.tree.parent,
21
+ segment: n.tree.segment
22
+ };
23
+ if (a !== null && (!t(a.parent) || !t(a.segment))) return {
24
+ ok: !1,
25
+ reason: "mapping"
26
+ };
27
+ i.push({
28
+ name: n.name,
29
+ locations: r,
30
+ tree: a
31
+ });
32
+ }
33
+ return {
34
+ ok: !0,
35
+ types: i.sort((e, t) => n(e.name, t.name))
36
+ };
37
+ };
38
+ //#endregion
39
+ export { r as compileContentRouteTypes };
@@ -0,0 +1,189 @@
1
+ import { ContentSeoUnavailable as e } from "./errors.js";
2
+ //#region src/contentSeo.ts
3
+ var t = (t) => {
4
+ throw new e({ reason: t });
5
+ }, n = (e) => typeof e == "string" && /^[A-Za-z][A-Za-z0-9_]{0,63}$/.test(e), r = (e, n) => {
6
+ if (typeof e != "object" || !e || Array.isArray(e) || ![Object.prototype, null].includes(Object.getPrototypeOf(e)) || Object.getOwnPropertySymbols(e).length) return t("definition");
7
+ let r = Object.getOwnPropertyDescriptors(e);
8
+ return Object.entries(r).some(([e, t]) => !n.includes(e) || !t.enumerable || !("value" in t)) ? t("definition") : Object.fromEntries(Object.entries(r).map(([e, t]) => [e, t.value]));
9
+ }, i = (e) => {
10
+ let i = r(e, [
11
+ "fields",
12
+ "required",
13
+ "recommendedMaxLength"
14
+ ]), a = i.fields;
15
+ if (!Array.isArray(a) || a.length < 1 || a.length > 8 || Object.getOwnPropertySymbols(a).length || Object.keys(a).length !== a.length || Object.getOwnPropertyNames(a).length !== a.length + 1) return t("definition");
16
+ let o = Array.from({ length: a.length }, (e, r) => {
17
+ let i = Object.getOwnPropertyDescriptor(a, String(r));
18
+ return i === void 0 || !("value" in i) || !i.enumerable || !n(i.value) ? t("definition") : i.value;
19
+ });
20
+ return new Set(o).size !== o.length || "required" in i && typeof i.required != "boolean" || "recommendedMaxLength" in i && (!Number.isSafeInteger(i.recommendedMaxLength) || Number(i.recommendedMaxLength) < 1 || Number(i.recommendedMaxLength) > 1e4) ? t("definition") : Object.freeze({
21
+ fields: Object.freeze(o),
22
+ ...i.required === void 0 ? {} : { required: i.required },
23
+ ...i.recommendedMaxLength === void 0 ? {} : { recommendedMaxLength: Number(i.recommendedMaxLength) }
24
+ });
25
+ }, a = (e) => {
26
+ let n = r(e, ["index", "follow"]);
27
+ return typeof n.index != "boolean" || typeof n.follow != "boolean" ? t("definition") : Object.freeze({
28
+ index: n.index,
29
+ follow: n.follow
30
+ });
31
+ }, o = (e) => typeof e == "string" && e.length <= 1e4 && !/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/.test(e), s = (e) => {
32
+ let o = r(e, [
33
+ "version",
34
+ "title",
35
+ "description",
36
+ "social",
37
+ "canonical",
38
+ "robots",
39
+ "sitemap",
40
+ "structuredData"
41
+ ]);
42
+ if (o.version !== 1 || o.canonical !== void 0 && o.canonical !== "route" && o.canonical !== "omit" || o.sitemap !== void 0 && typeof o.sitemap != "boolean") return t("definition");
43
+ let s = o.social === void 0 ? void 0 : r(o.social, [
44
+ "title",
45
+ "description",
46
+ "image"
47
+ ]);
48
+ if (s?.image !== void 0 && !n(s.image)) return t("definition");
49
+ let c = o.structuredData === void 0 ? void 0 : r(o.structuredData, [
50
+ "type",
51
+ "title",
52
+ "description",
53
+ "datePublished"
54
+ ]);
55
+ return c !== void 0 && (typeof c.type != "string" || ![
56
+ "WebPage",
57
+ "Article",
58
+ "BlogPosting"
59
+ ].includes(c.type) || !n(c.title) || ["description", "datePublished"].some((e) => c[e] !== void 0 && !n(c[e]))) ? t("definition") : Object.freeze({
60
+ version: 1,
61
+ title: i(o.title),
62
+ ...o.description === void 0 ? {} : { description: i(o.description) },
63
+ ...s === void 0 ? {} : { social: Object.freeze({
64
+ ...s.title === void 0 ? {} : { title: i(s.title) },
65
+ ...s.description === void 0 ? {} : { description: i(s.description) },
66
+ ...s.image === void 0 ? {} : { image: s.image }
67
+ }) },
68
+ ...o.canonical === void 0 ? {} : { canonical: o.canonical },
69
+ ...o.robots === void 0 ? {} : { robots: a(o.robots) },
70
+ ...o.sitemap === void 0 ? {} : { sitemap: o.sitemap },
71
+ ...c === void 0 ? {} : { structuredData: Object.freeze({
72
+ type: c.type,
73
+ title: c.title,
74
+ ...c.description === void 0 ? {} : { description: c.description },
75
+ ...c.datePublished === void 0 ? {} : { datePublished: c.datePublished }
76
+ }) }
77
+ });
78
+ }, c = (e) => {
79
+ let n = r(e, [
80
+ "title",
81
+ "description",
82
+ "social",
83
+ "robots",
84
+ "sitemap"
85
+ ]), i = n.social === void 0 ? void 0 : r(n.social, ["title", "description"]);
86
+ if (["title", "description"].some((e) => n[e] !== void 0 && !o(n[e]) || i?.[e] !== void 0 && !o(i[e])) || n.sitemap !== void 0 && typeof n.sitemap != "boolean") return t("defaults");
87
+ let s = (e) => Object.fromEntries(["title", "description"].flatMap((t) => e[t] === void 0 || e[t].trim() === "" ? [] : [[t, e[t].trim()]]));
88
+ return Object.freeze({
89
+ ...s(n),
90
+ ...i === void 0 ? {} : { social: Object.freeze(s(i)) },
91
+ ...n.robots === void 0 ? {} : { robots: a(n.robots) },
92
+ ...n.sitemap === void 0 ? {} : { sitemap: n.sitemap }
93
+ });
94
+ }, l = (e, r) => {
95
+ let i = s(e), a = (e, n) => {
96
+ if (!Object.hasOwn(r, e) || r[e]?.kind !== n) return t("field");
97
+ };
98
+ for (let e of [
99
+ i.title,
100
+ i.description,
101
+ i.social?.title,
102
+ i.social?.description
103
+ ]) for (let t of e?.fields ?? []) a(t, "string");
104
+ if (i.social?.image !== void 0) {
105
+ let e = Object.hasOwn(r, i.social.image) ? r[i.social.image] : void 0;
106
+ if (e?.kind !== "media" && !(e?.kind === "reference" && n(e.referenceType))) return t("field");
107
+ }
108
+ i.structuredData !== void 0 && (a(i.structuredData.title, "string"), i.structuredData.description !== void 0 && a(i.structuredData.description, "string"), i.structuredData.datePublished !== void 0 && a(i.structuredData.datePublished, "datetime"));
109
+ }, u = (e, n, r = {}) => {
110
+ let i = s(e), a = c(r);
111
+ if (typeof n != "object" || !n || Array.isArray(n) || ![Object.prototype, null].includes(Object.getPrototypeOf(n))) return t("values");
112
+ let l = [], u = {}, d = (e) => {
113
+ let r = Object.getOwnPropertyDescriptor(n, e);
114
+ if (r !== void 0) return "value" in r ? r.value : t("values");
115
+ }, f = (e, t, n = null, r = null) => {
116
+ let i = null;
117
+ u[t] = null;
118
+ for (let n of e?.fields ?? []) {
119
+ let e = d(n);
120
+ if (e != null && e !== "") {
121
+ if (!o(e)) l.push({
122
+ kind: "invalid",
123
+ target: t,
124
+ field: n,
125
+ rule: "text"
126
+ });
127
+ else if (e.trim() !== "") {
128
+ i = e.trim(), u[t] = n;
129
+ break;
130
+ }
131
+ }
132
+ }
133
+ return i === null && (i = n?.trim() || null, i !== null && (u[t] = r)), i === null && e?.required && l.push({
134
+ kind: "missing",
135
+ target: t,
136
+ field: null,
137
+ rule: "required"
138
+ }), i !== null && e?.recommendedMaxLength !== void 0 && i.length > e.recommendedMaxLength && l.push({
139
+ kind: "recommendation",
140
+ target: t,
141
+ field: u[t],
142
+ rule: "recommendedMaxLength"
143
+ }), i;
144
+ }, p = f(i.title, "title", a.title ?? null), m = f(i.description, "description", a.description ?? null), h = f(i.social?.title, "social.title", a.social?.title ?? p, a.social?.title === void 0 ? u.title : null), g = f(i.social?.description, "social.description", a.social?.description ?? m, a.social?.description === void 0 ? u.description : null), _ = f(i.social?.image === void 0 ? void 0 : { fields: [i.social.image] }, "social.image"), v = null;
145
+ if (i.structuredData !== void 0) {
146
+ let e = f({
147
+ fields: [i.structuredData.title],
148
+ required: !0
149
+ }, "structuredData.title"), t = f(i.structuredData.description === void 0 ? void 0 : { fields: [i.structuredData.description] }, "structuredData.description"), n = null;
150
+ if (i.structuredData.datePublished !== void 0) {
151
+ let e = i.structuredData.datePublished, t = d(e);
152
+ if (u["structuredData.datePublished"] = null, t != null && t !== "") {
153
+ let r = t instanceof Date ? t : typeof t == "string" ? new Date(t) : null;
154
+ r === null || !Number.isFinite(r.getTime()) ? l.push({
155
+ kind: "invalid",
156
+ target: "structuredData.datePublished",
157
+ field: e,
158
+ rule: "date"
159
+ }) : (n = r.toISOString(), u["structuredData.datePublished"] = e);
160
+ }
161
+ }
162
+ e !== null && (v = Object.freeze({
163
+ type: i.structuredData.type,
164
+ title: e,
165
+ description: t,
166
+ datePublished: n
167
+ }));
168
+ }
169
+ return Object.freeze({
170
+ title: p,
171
+ description: m,
172
+ canonical: i.canonical ?? "route",
173
+ robots: i.robots ?? a.robots ?? Object.freeze({
174
+ index: !1,
175
+ follow: !1
176
+ }),
177
+ sitemap: i.sitemap ?? a.sitemap ?? !1,
178
+ social: Object.freeze({
179
+ title: h,
180
+ description: g,
181
+ imageKey: _
182
+ }),
183
+ structuredData: v,
184
+ sources: Object.freeze(u),
185
+ findings: Object.freeze(l.map((e) => Object.freeze(e)))
186
+ });
187
+ };
188
+ //#endregion
189
+ export { s as defineContentSeo, c as defineContentSeoDefaults, u as resolveContentSeo, l as validateContentSeoFields };
@@ -0,0 +1,60 @@
1
+ import { resolveContentLocation as e } from "./contentLocations.js";
2
+ //#region src/contentTreePath.ts
3
+ var t = async (t, n, r) => {
4
+ let i = [], a = [], o = /* @__PURE__ */ new Set(), s = t;
5
+ for (; s !== null;) {
6
+ let c = s.documentId;
7
+ if (typeof c != "string" || c.length === 0) return {
8
+ ok: !1,
9
+ reason: "publication"
10
+ };
11
+ if (o.has(c)) return {
12
+ ok: !0,
13
+ path: null,
14
+ ancestors: i
15
+ };
16
+ if (o.size >= 128) return {
17
+ ok: !1,
18
+ reason: "bounds"
19
+ };
20
+ o.add(c);
21
+ let l = s[n.segment];
22
+ if (l === "" || l == null) return {
23
+ ok: !0,
24
+ path: null,
25
+ ancestors: i
26
+ };
27
+ if (typeof l != "string") return {
28
+ ok: !1,
29
+ reason: "publication"
30
+ };
31
+ e({
32
+ id: "segment",
33
+ segments: [{ field: n.segment }]
34
+ }, s, { prefix: "" }), a.unshift(l), s !== t && i.unshift({
35
+ documentId: c,
36
+ variantId: String(s.id),
37
+ revisionId: String(s.revisionId),
38
+ revision: Number(s.revision),
39
+ locale: String(s.locale)
40
+ });
41
+ let u = s[n.parent];
42
+ if (u == null || u === "") return {
43
+ ok: !0,
44
+ path: a.join("/"),
45
+ ancestors: i
46
+ };
47
+ if (typeof u != "string") return {
48
+ ok: !1,
49
+ reason: "publication"
50
+ };
51
+ s = await r(u);
52
+ }
53
+ return {
54
+ ok: !0,
55
+ path: null,
56
+ ancestors: i
57
+ };
58
+ };
59
+ //#endregion
60
+ export { t as resolveContentTreePath };
@@ -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";
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";
7
11
  //#region src/contentType.ts
8
- var m = [
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,7 +105,7 @@ 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];
@@ -99,7 +116,7 @@ var m = [
99
116
  let n = t[i.mask];
100
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,78 @@ 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
207
  //#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 };
208
+ 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,18 @@
1
+ //#region 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
+ //#endregion
18
+ export { e as pickDeclared, t as readContentModificationTime };
package/dist/copies.js CHANGED
@@ -1,5 +1,5 @@
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";
@@ -84,6 +84,6 @@ 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));
87
+ })), S = (...a) => i(() => v(...a), n, t, e, r), C = (...e) => i(() => y(...e)), w = (...e) => i(() => x(...e));
88
88
  //#endregion
89
89
  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 };
@@ -0,0 +1,7 @@
1
+ //#region 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
+ //#endregion
7
+ export { t as normalizeHost };