@voltro/cms 0.85.0 → 0.87.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (244) hide show
  1. package/CHANGELOG.md +5987 -0
  2. package/README.md +138 -0
  3. package/THIRD-PARTY-NOTICES.md +864 -253
  4. package/dist/ContentForm.js +282 -0
  5. package/dist/RichDocumentEditor.js +550 -0
  6. package/dist/RichDocumentView.js +177 -0
  7. package/dist/RichTextSurface.js +135 -0
  8. package/dist/aiCandidates.js +199 -0
  9. package/dist/aiOperations.js +152 -0
  10. package/dist/applicationBuildSnapshotService.js +101 -0
  11. package/dist/assetRenditions.js +102 -0
  12. package/dist/assetRevision.js +46 -0
  13. package/dist/assetUseRights.js +72 -0
  14. package/dist/audiences.js +31 -0
  15. package/dist/availability.js +124 -0
  16. package/dist/blueprint.js +166 -0
  17. package/dist/build.d.ts +3063 -0
  18. package/dist/build.js +37 -0
  19. package/dist/buildApplicationAdmission.js +16 -0
  20. package/dist/buildApplicationCatalog.js +136 -0
  21. package/dist/buildApplicationCatalogTable.js +24 -0
  22. package/dist/buildApplicationRest.js +99 -0
  23. package/dist/buildApplicationUpload.js +111 -0
  24. package/dist/buildSnapshot.js +401 -0
  25. package/dist/buildSnapshotApplicationPin.js +32 -0
  26. package/dist/buildSnapshotRest.js +210 -0
  27. package/dist/buildSnapshotService.js +265 -0
  28. package/dist/buildSnapshotTables.js +25 -0
  29. package/dist/bulk.js +282 -0
  30. package/dist/cacheIdentity.js +152 -0
  31. package/dist/changes.js +307 -0
  32. package/dist/cmsContext.js +229 -0
  33. package/dist/collections.js +224 -0
  34. package/dist/consent.js +29 -0
  35. package/dist/contentLocations.js +53 -0
  36. package/dist/contentProjection.js +83 -0
  37. package/dist/contentRouteIdentity.js +13 -0
  38. package/dist/contentRouteMaterializer.js +97 -0
  39. package/dist/contentRouteTypes.js +39 -0
  40. package/dist/contentSeo.js +189 -0
  41. package/dist/contentTreePath.js +60 -0
  42. package/dist/contentType.js +208 -0
  43. package/dist/contentValues.js +18 -0
  44. package/dist/contentfulImport.js +162 -0
  45. package/dist/copies.js +89 -0
  46. package/dist/cutover.js +202 -0
  47. package/dist/deliveryChecks.js +138 -0
  48. package/dist/domainHost.js +7 -0
  49. package/dist/domains.js +139 -0
  50. package/dist/draftTexts.js +164 -0
  51. package/dist/duplicates.js +78 -0
  52. package/dist/edgePurge.js +69 -0
  53. package/dist/editHistory.js +113 -0
  54. package/dist/effectForm.js +11 -0
  55. package/dist/environmentAliases.js +138 -0
  56. package/dist/environments.js +147 -0
  57. package/dist/errors.js +107 -0
  58. package/dist/experiments.js +528 -0
  59. package/dist/exposure.js +28 -0
  60. package/dist/extensionManifest.js +81 -0
  61. package/dist/extensions.js +314 -0
  62. package/dist/fieldSchema.js +199 -0
  63. package/dist/formStrings.js +74 -0
  64. package/dist/frontendBindings.js +99 -0
  65. package/dist/frontendMedia.js +18 -0
  66. package/dist/glossary.js +73 -0
  67. package/dist/history.js +54 -0
  68. package/dist/htmlImport.js +297 -0
  69. package/dist/index.d.ts +771 -54
  70. package/dist/index.js +89 -6082
  71. package/dist/initializePublicRoutes.js +28 -0
  72. package/dist/liveContentRouteView.js +76 -0
  73. package/dist/media.js +29 -0
  74. package/dist/metrics.js +46 -0
  75. package/dist/migration.js +193 -0
  76. package/dist/migrationStages.js +13 -0
  77. package/dist/nativeOutputDeploymentService.js +205 -0
  78. package/dist/outputActivation.js +234 -0
  79. package/dist/outputActivationOrigin.js +51 -0
  80. package/dist/outputActivationStore.js +411 -0
  81. package/dist/outputActivationTables.js +11 -0
  82. package/dist/outputActivationTarget.js +81 -0
  83. package/dist/outputActivationTargetTable.js +25 -0
  84. package/dist/outputDeployment.js +174 -0
  85. package/dist/outputDeploymentRest.js +168 -0
  86. package/dist/outputDeploymentService.js +241 -0
  87. package/dist/outputRouteGraph.js +177 -0
  88. package/dist/outputSafetyArtifact.js +147 -0
  89. package/dist/outputTargetRest.js +62 -0
  90. package/dist/pathSegmentEncoding.js +4 -0
  91. package/dist/presenceAnchors.js +68 -0
  92. package/dist/preview.js +31 -0
  93. package/dist/privateCmsTransport.js +76 -0
  94. package/dist/privateNativeRouteReservation.js +10 -0
  95. package/dist/promotion.js +116 -0
  96. package/dist/publicBuild.js +90 -0
  97. package/dist/publicBuildRest.js +98 -0
  98. package/dist/publicBuildService.js +63 -0
  99. package/dist/publicOutputHttp.js +129 -0
  100. package/dist/publicOutputService.js +287 -0
  101. package/dist/publicPresentation.js +17 -0
  102. package/dist/publicRouteDispositionAdmission.js +38 -0
  103. package/dist/publicRouteHistoryStore.js +12 -0
  104. package/dist/publicRouteHistoryView.js +34 -0
  105. package/dist/publicRouteIntegrity.js +5 -0
  106. package/dist/publicRouteMutation.js +6 -0
  107. package/dist/publicRouteNamespace.js +134 -0
  108. package/dist/publicRoutePublication.js +36 -0
  109. package/dist/publicRouteRegistry.js +17 -0
  110. package/dist/publicRouteRegistryBinding.js +194 -0
  111. package/dist/publicRouteRegistryDefinition.js +76 -0
  112. package/dist/publicRouteSitePublication.js +40 -0
  113. package/dist/publicRouteTables.js +13 -0
  114. package/dist/publicRouteUrl.js +18 -0
  115. package/dist/publicationSeo.js +52 -0
  116. package/dist/publicationState.js +296 -0
  117. package/dist/quality.js +188 -0
  118. package/dist/reconfigurePublicRoutes.js +41 -0
  119. package/dist/recurrence.js +78 -0
  120. package/dist/redirects.js +130 -0
  121. package/dist/referenceGraph.js +224 -0
  122. package/dist/references.js +173 -0
  123. package/dist/release.js +241 -0
  124. package/dist/renderReadAuthority.js +43 -0
  125. package/dist/renderReadGrant.js +137 -0
  126. package/dist/rest.js +52 -0
  127. package/dist/review.js +160 -0
  128. package/dist/richDocument.js +521 -0
  129. package/dist/richInline.js +100 -0
  130. package/dist/routeDispositionGraph.js +44 -0
  131. package/dist/routeDispositionRest.js +51 -0
  132. package/dist/routeDispositionService.js +73 -0
  133. package/dist/routeDispositionStore.js +289 -0
  134. package/dist/routeDispositionTables.js +5 -0
  135. package/dist/routeDispositions.js +91 -0
  136. package/dist/routeHistoryStorage.js +320 -0
  137. package/dist/routeHistoryStore.js +12 -0
  138. package/dist/schedule.js +80 -0
  139. package/dist/search.js +148 -0
  140. package/dist/selectionIntent.js +164 -0
  141. package/dist/seo.js +31 -0
  142. package/dist/series.js +105 -0
  143. package/dist/share.js +112 -0
  144. package/dist/siteBindings.js +159 -0
  145. package/dist/siteBuildCandidate.js +104 -0
  146. package/dist/siteDelivery.js +115 -0
  147. package/dist/siteState.js +47 -0
  148. package/dist/snapshotAddressGraph.js +55 -0
  149. package/dist/snapshotAddressRead.js +73 -0
  150. package/dist/snapshotAppConsumer.js +71 -0
  151. package/dist/snapshotAppExecution.js +102 -0
  152. package/dist/snapshotApplication.js +75 -0
  153. package/dist/snapshotApprovedRouteDispositions.js +44 -0
  154. package/dist/snapshotAssetAssembly.js +70 -0
  155. package/dist/snapshotAssetAssemblyRest.js +50 -0
  156. package/dist/snapshotBindingRead.js +61 -0
  157. package/dist/snapshotCodeSeo.js +29 -0
  158. package/dist/snapshotComponent.js +34 -0
  159. package/dist/snapshotComponentSource.js +24 -0
  160. package/dist/snapshotConsumer.js +87 -0
  161. package/dist/snapshotContentIdentity.js +10 -0
  162. package/dist/snapshotDefinitions.js +264 -0
  163. package/dist/snapshotDocumentAssembly.js +193 -0
  164. package/dist/snapshotDocumentAssemblyRest.js +84 -0
  165. package/dist/snapshotDocumentProjection.js +202 -0
  166. package/dist/snapshotDocumentTransfer.js +35 -0
  167. package/dist/snapshotDocumentTransferRest.js +80 -0
  168. package/dist/snapshotDomains.js +56 -0
  169. package/dist/snapshotEnvironment.js +31 -0
  170. package/dist/snapshotFieldPlan.js +85 -0
  171. package/dist/snapshotFrontend.js +103 -0
  172. package/dist/snapshotLink.js +8 -0
  173. package/dist/snapshotMedia.js +111 -0
  174. package/dist/snapshotMediaCapture.js +246 -0
  175. package/dist/snapshotMediaFields.js +225 -0
  176. package/dist/snapshotMediaRead.js +185 -0
  177. package/dist/snapshotMediaReader.js +13 -0
  178. package/dist/snapshotObservation.js +16 -0
  179. package/dist/snapshotObservedRouteHistory.js +34 -0
  180. package/dist/snapshotOutputTransfer.js +78 -0
  181. package/dist/snapshotPageLoader.js +7 -0
  182. package/dist/snapshotPageSeo.js +59 -0
  183. package/dist/snapshotPathLocale.js +15 -0
  184. package/dist/snapshotPresentation.js +86 -0
  185. package/dist/snapshotPresentationPolicy.js +12 -0
  186. package/dist/snapshotProjection.js +119 -0
  187. package/dist/snapshotPublicAccess.js +161 -0
  188. package/dist/snapshotPublicRouteHistory.js +40 -0
  189. package/dist/snapshotReadAdmission.js +38 -0
  190. package/dist/snapshotRedirectOutput.js +151 -0
  191. package/dist/snapshotRedirectTargets.js +24 -0
  192. package/dist/snapshotRedirects.js +132 -0
  193. package/dist/snapshotReference.js +8 -0
  194. package/dist/snapshotReferenceAddress.js +10 -0
  195. package/dist/snapshotReferenceGraph.js +79 -0
  196. package/dist/snapshotReferenceRead.js +65 -0
  197. package/dist/snapshotRelease.js +99 -0
  198. package/dist/snapshotRender.js +361 -0
  199. package/dist/snapshotRenderDependencies.js +178 -0
  200. package/dist/snapshotRenditions.js +88 -0
  201. package/dist/snapshotRichDocument.js +62 -0
  202. package/dist/snapshotRoleTransfer.js +106 -0
  203. package/dist/snapshotRoleTransferRest.js +99 -0
  204. package/dist/snapshotRouteAdmission.js +71 -0
  205. package/dist/snapshotRouteDispatch.js +111 -0
  206. package/dist/snapshotRouteDispositionPlan.js +73 -0
  207. package/dist/snapshotRouteRead.js +43 -0
  208. package/dist/snapshotRoutes.js +79 -0
  209. package/dist/snapshotRouting.js +113 -0
  210. package/dist/snapshotSeo.js +179 -0
  211. package/dist/snapshotSeoControls.js +101 -0
  212. package/dist/snapshotSeoDocumentInventory.js +115 -0
  213. package/dist/snapshotSeoDocuments.js +129 -0
  214. package/dist/snapshotSeoMerge.js +85 -0
  215. package/dist/snapshotSeoMetadata.js +137 -0
  216. package/dist/snapshotSeoOutput.js +173 -0
  217. package/dist/snapshotSeoPathSets.js +105 -0
  218. package/dist/snapshotSeoRead.js +88 -0
  219. package/dist/snapshotSite.js +128 -0
  220. package/dist/snapshotSitemapFiles.js +36 -0
  221. package/dist/snapshotTreeDependencies.js +58 -0
  222. package/dist/snapshotTreeLoader.js +10 -0
  223. package/dist/snapshotTreeRead.js +158 -0
  224. package/dist/staticPathSet.js +177 -0
  225. package/dist/staticPathSetRest.js +129 -0
  226. package/dist/staticPathSetService.js +249 -0
  227. package/dist/staticPathSetStore.js +338 -0
  228. package/dist/stewardship.js +146 -0
  229. package/dist/taxonomy.js +36 -0
  230. package/dist/team.js +103 -0
  231. package/dist/templates.js +106 -0
  232. package/dist/trackChanges.js +197 -0
  233. package/dist/translation.js +64 -0
  234. package/dist/tree.js +87 -0
  235. package/dist/usage.js +50 -0
  236. package/dist/validation.js +192 -0
  237. package/dist/visualEditing.js +60 -0
  238. package/dist/web.d.ts +709 -7
  239. package/dist/web.js +50 -2
  240. package/dist/workflow.js +322 -0
  241. package/dist/write.js +419 -0
  242. package/dist/xliff.js +325 -0
  243. package/package.json +20 -6
  244. package/dist/presenceAnchors-4iHAVQB3.js +0 -4367
@@ -0,0 +1,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 };
@@ -0,0 +1,208 @@
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
+ //#region src/contentType.ts
12
+ var b = [
13
+ "site",
14
+ "environment",
15
+ "locale"
16
+ ], x = [
17
+ "draft",
18
+ "published",
19
+ "archived"
20
+ ], S = [
21
+ "id",
22
+ "status",
23
+ "publishAt",
24
+ "unpublishAt",
25
+ "revisionId",
26
+ "revision",
27
+ "documentId",
28
+ "site",
29
+ "environment",
30
+ "locale",
31
+ "tenantId",
32
+ "createdAt",
33
+ "updatedAt",
34
+ "createdBy",
35
+ "updatedBy"
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.`);
40
+ let n = t;
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);
43
+ }
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.`);
51
+ }
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.`);
55
+ }
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}.`);
60
+ }
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" });
74
+ }
75
+ return {
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
99
+ };
100
+ }, w = (e, t, n) => {
101
+ let r = /* @__PURE__ */ new Set();
102
+ for (let i of n) {
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.`);
104
+ if (r.has(i.id)) throw Error(`defineContentType('${e}'): quality rule '${i.id}' is declared twice.`);
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.`);
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.`);
107
+ }
108
+ }, T = (e, t, n) => {
109
+ let r = (t) => {
110
+ throw Error(`defineContentType('${e}'): tree ${t}`);
111
+ }, i = t[n.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.`);
113
+ let a = t[n.segment];
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.`);
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) {
116
+ let n = t[i.mask];
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'.`);
118
+ }
119
+ }, E = (e, t, n) => {
120
+ let r = n.until === void 0 ? void 0 : t[n.until];
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.`);
122
+ let i = n.blocked === void 0 ? void 0 : t[n.blocked];
123
+ if (n.blocked !== void 0 && (i === void 0 || i.kind !== "boolean")) throw Error(`defineContentType('${e}'): availability.blocked '${n.blocked}' must be a declared boolean field.`);
124
+ let a = n.from === void 0 ? void 0 : t[n.from];
125
+ if (n.from !== void 0 && (a === void 0 || a.kind !== "date" && a.kind !== "datetime")) throw Error(`defineContentType('${e}'): availability.from '${n.from}' must be a declared date or datetime field.`);
126
+ for (let r of [
127
+ "territories",
128
+ "channels",
129
+ "purposes"
130
+ ]) {
131
+ let i = n[r] === void 0 ? void 0 : t[n[r]];
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.`);
133
+ }
134
+ }, D = (e) => {
135
+ switch (e.kind) {
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();
141
+ case "literal": {
142
+ let t = e.literals ?? [], n = t.length > 0 ? _().oneOf(t) : _();
143
+ return e.isOptional ? n.nullable() : n;
144
+ }
145
+ case "richText":
146
+ case "array":
147
+ case "struct":
148
+ case "components": {
149
+ let t = m();
150
+ return e.isOptional ? t.nullable() : t;
151
+ }
152
+ case "media":
153
+ case "reference": return e.isOptional ? _().nullable() : _();
154
+ }
155
+ }, O = (e) => {
156
+ let t = {};
157
+ for (let [n, r] of Object.entries(e.fields)) t[n] = D(r);
158
+ return 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}`, {
161
+ id: r,
162
+ status: _().oneOf(x),
163
+ ...t === "drafts" ? {
164
+ publishAt: v().nullable(),
165
+ unpublishAt: v().nullable()
166
+ } : {},
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"), [
175
+ "tenantId",
176
+ ...b,
177
+ "documentId"
178
+ ]);
179
+ return e.uniqueFields.reduce((n, r) => n.unique(M(e, t, r), [
180
+ "tenantId",
181
+ ...b,
182
+ r
183
+ ]), i);
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.`);
186
+ return t;
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", [
198
+ "tenantId",
199
+ "contentType",
200
+ "documentId",
201
+ ...b,
202
+ "number"
203
+ ]), I = (e) => ({
204
+ draft: A(e, "drafts"),
205
+ published: A(e, "published")
206
+ });
207
+ //#endregion
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 };
@@ -0,0 +1,162 @@
1
+ import "./richDocument.js";
2
+ //#region src/contentfulImport.ts
3
+ var e = {
4
+ bold: "bold",
5
+ italic: "italic",
6
+ underline: "underline"
7
+ }, t = (t, n = {}) => {
8
+ let r = 0, i = n.newId ?? (() => `rb_import_${++r}`), a = [], o = (e, t) => {
9
+ a.some((n) => n.kind === e && n.detail === t) || a.push({
10
+ kind: e,
11
+ detail: t
12
+ });
13
+ }, s = (t) => {
14
+ let r = [], i = (e) => {
15
+ let t = r[r.length - 1];
16
+ e.type === "text" && t?.type === "text" && (t.marks ?? []).join() === (e.marks ?? []).join() ? r[r.length - 1] = {
17
+ ...t,
18
+ text: t.text + e.text
19
+ } : e.text !== "" && r.push(e);
20
+ };
21
+ for (let r of t ?? []) switch (r.nodeType) {
22
+ case "text": {
23
+ let t = (r.marks ?? []).map((t) => e[t.type]).filter((e) => e !== void 0);
24
+ i({
25
+ type: "text",
26
+ text: r.value ?? "",
27
+ ...t.length > 0 ? { marks: t } : {}
28
+ });
29
+ break;
30
+ }
31
+ case "entry-hyperlink": {
32
+ let e = r.data?.target?.sys?.id ?? "", t = n.resolveEntry?.(e) ?? null, a = s(r.content).map((e) => e.text).join("");
33
+ t === null ? (o("externalLink", `entry:${e}`), i({
34
+ type: "text",
35
+ text: a
36
+ })) : i({
37
+ type: "link",
38
+ target: t,
39
+ text: a
40
+ });
41
+ break;
42
+ }
43
+ case "hyperlink":
44
+ o("externalLink", r.data?.uri ?? "");
45
+ for (let e of s(r.content)) i(e);
46
+ break;
47
+ default:
48
+ o("unsupportedTag", r.nodeType);
49
+ for (let e of s(r.content)) i(e);
50
+ }
51
+ let a = r[0];
52
+ a !== void 0 && (r[0] = {
53
+ ...a,
54
+ text: a.text.replace(/^[ \t\r\n\f]+/, "")
55
+ });
56
+ let c = r[r.length - 1];
57
+ return c !== void 0 && (r[r.length - 1] = {
58
+ ...c,
59
+ text: c.text.replace(/[ \t\r\n\f]+$/, "")
60
+ }), r.filter((e) => e.text !== "");
61
+ }, c = (e) => (e.content ?? []).flatMap((e, t) => {
62
+ let n = e.nodeType === "paragraph" ? s(e.content) : s([e]);
63
+ return t > 0 && n.length > 0 ? [{
64
+ type: "text",
65
+ text: " "
66
+ }, ...n] : n;
67
+ }), l = [];
68
+ for (let e of t?.content ?? []) switch (e.nodeType) {
69
+ case "paragraph": {
70
+ let t = s(e.content);
71
+ t.length > 0 && l.push({
72
+ id: i(),
73
+ type: "paragraph",
74
+ content: t
75
+ });
76
+ break;
77
+ }
78
+ case "heading-1":
79
+ case "heading-2":
80
+ case "heading-3":
81
+ case "heading-4":
82
+ case "heading-5":
83
+ case "heading-6": {
84
+ let t = s(e.content);
85
+ t.length > 0 && l.push({
86
+ id: i(),
87
+ type: "heading",
88
+ level: e.nodeType === "heading-1" || e.nodeType === "heading-2" ? 2 : 3,
89
+ content: t
90
+ });
91
+ break;
92
+ }
93
+ case "unordered-list":
94
+ case "ordered-list": {
95
+ let t = [], n = [], r = [], a = (e) => e.nodeType === "ordered-list" ? "ordered" : "unordered", o = (i, s) => {
96
+ for (let l of i.content ?? []) {
97
+ let i = (l.content ?? []).filter((e) => e.nodeType === "unordered-list" || e.nodeType === "ordered-list"), u = c({
98
+ ...l,
99
+ content: (l.content ?? []).filter((e) => !i.includes(e))
100
+ });
101
+ u.length > 0 && (t.push(u), n.push(Math.min(s, 3, n.length === 0 ? 0 : n[n.length - 1] + 1)));
102
+ for (let t of i) {
103
+ let n = Math.min(s + 1, 3) - 1;
104
+ for (; r.length < n;) r.push(r[r.length - 1] ?? a(e));
105
+ r.length === n && r.push(a(t)), o(t, s + 1);
106
+ }
107
+ }
108
+ };
109
+ o(e, 0);
110
+ let s = a(e);
111
+ t.length > 0 && l.push({
112
+ id: i(),
113
+ type: "list",
114
+ ordered: s === "ordered",
115
+ items: t,
116
+ ...n.some((e) => e > 0) ? {
117
+ levels: n,
118
+ ...r.some((e) => e !== s) ? { sublists: r } : {}
119
+ } : {}
120
+ });
121
+ break;
122
+ }
123
+ case "table": {
124
+ let t = (e.content ?? []).map((e) => (e.content ?? []).map(c)), n = (e.content?.[0]?.content ?? []).some((e) => e.nodeType === "table-header-cell");
125
+ t.length > 0 && l.push({
126
+ id: i(),
127
+ type: "table",
128
+ header: n,
129
+ rows: t
130
+ });
131
+ break;
132
+ }
133
+ case "embedded-asset-block": {
134
+ let t = e.data?.target?.sys?.id ?? "", r = n.resolveAsset?.(t) ?? null;
135
+ r === null ? o("image", `asset:${t}`) : l.push({
136
+ id: i(),
137
+ type: "image",
138
+ asset: r
139
+ });
140
+ break;
141
+ }
142
+ case "hr": break;
143
+ default: {
144
+ o("unsupportedTag", e.nodeType);
145
+ let t = s((e.content ?? []).flatMap((e) => e.nodeType === "paragraph" ? e.content ?? [] : [e]));
146
+ t.length > 0 && l.push({
147
+ id: i(),
148
+ type: "paragraph",
149
+ content: t
150
+ });
151
+ }
152
+ }
153
+ return {
154
+ document: {
155
+ type: "doc",
156
+ blocks: l
157
+ },
158
+ findings: a
159
+ };
160
+ };
161
+ //#endregion
162
+ export { t as richDocumentFromContentful };