@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
@@ -0,0 +1,96 @@
1
+ import { resolveContentLocation as e } from "./contentLocations.js";
2
+ import { copySnapshotResource as t } from "./buildSnapshot.js";
3
+ import { snapshotRouteOwnership as n } from "./snapshotRouting.js";
4
+ import { resolveContentTreePath as r } from "./contentTreePath.js";
5
+ import { contentRouteId as i } from "./contentRouteIdentity.js";
6
+ import { Schema as a } from "effect";
7
+ import { createHash as o } from "node:crypto";
8
+ import { canonicalJson as s } from "@voltro/runtime";
9
+ // src/contentRouteMaterializer.ts
10
+ var c = class extends a.TaggedError()("ContentRouteMaterializationUnavailable", { reason: a.Literals([
11
+ "scope",
12
+ "publication",
13
+ "bounds"
14
+ ]) }) {}, l = (e) => {
15
+ throw new c({ reason: e });
16
+ }, u = (e) => typeof e == "string" && e.length > 0, d = (e, t) => e < t ? -1 : +(e > t), f = (e) => o("sha256").update(s(e)).digest("hex");
17
+ async function* p(a, o) {
18
+ let { scope: s, site: c, routing: p, definitionDigest: m } = a;
19
+ if (c.definition.id !== s.site || !c.definition.environments.includes(s.environment)) return l("scope");
20
+ for (let h of a.types) if (h.locations.length !== 0) for (let a of c.definition.locales.filter((e) => e.enabled).sort((e, t) => d(e.id, t.id))) {
21
+ let d = [a.contentLocale, ...c.fallback[a.contentLocale]], g = async (e) => {
22
+ for (let t of d) {
23
+ let n = await o.read(h.name, t, e);
24
+ if (n !== null) return n;
25
+ }
26
+ return null;
27
+ };
28
+ for (let c of d) {
29
+ let d;
30
+ for (;;) {
31
+ let _ = await o.page(h.name, c, d);
32
+ for (let o of _.items) {
33
+ if (!u(o.documentId)) return l("publication");
34
+ let c = await g(o.documentId), d = c?.content;
35
+ if (c === null || d === void 0 || d.id !== o.id) continue;
36
+ let _ = h.tree === null ? {
37
+ ok: !0,
38
+ path: "",
39
+ ancestors: []
40
+ } : await r(d, h.tree, async (e) => (await g(e))?.content ?? null);
41
+ if (!_.ok) return l(_.reason);
42
+ let v = _.path === null, y = _.ancestors;
43
+ for (let r of h.locations) {
44
+ let o = i(s, a.id, h.name, String(d.documentId), r.id), l = {
45
+ version: 1,
46
+ ...s,
47
+ routeId: o,
48
+ mappingId: r.id,
49
+ contentType: h.name,
50
+ documentId: d.documentId,
51
+ localeId: a.id,
52
+ requestedLocale: a.contentLocale,
53
+ sourceLocale: d.locale,
54
+ fallback: d.locale !== a.contentLocale,
55
+ variantId: d.id,
56
+ revisionId: d.revisionId,
57
+ revision: d.revision,
58
+ definitionDigest: m,
59
+ lastModified: c.modifiedAt
60
+ }, u = v ? null : e(r, d, {
61
+ prefix: a.prefix,
62
+ ...h.tree === null ? {} : { treePath: _.path }
63
+ }), g = u === null ? `unroutable:${o}` : `path:${f(u)}`;
64
+ yield t({
65
+ key: `identity:${o}`,
66
+ value: {
67
+ version: 1,
68
+ kind: "route-index",
69
+ target: g
70
+ }
71
+ }), v ? yield t({
72
+ key: `unroutable:${o}`,
73
+ value: {
74
+ ...l,
75
+ state: "unroutable",
76
+ reason: "orphan"
77
+ }
78
+ }) : yield t({
79
+ key: g,
80
+ value: {
81
+ ...l,
82
+ state: "resolved",
83
+ path: u,
84
+ ancestors: y,
85
+ ownership: n(p, u)
86
+ }
87
+ });
88
+ }
89
+ }
90
+ if (_.next === null) break;
91
+ d = _.next;
92
+ }
93
+ }
94
+ }
95
+ }
96
+ export { c as ContentRouteMaterializationUnavailable, p as materializeContentRoutes };
@@ -0,0 +1,38 @@
1
+ import { defineContentLocations as e } from "./contentLocations.js";
2
+ // 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
+ export { r as compileContentRouteTypes };
@@ -0,0 +1,188 @@
1
+ import { ContentSeoUnavailable as e } from "./errors.js";
2
+ // 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
+ export { s as defineContentSeo, c as defineContentSeoDefaults, u as resolveContentSeo, l as validateContentSeoFields };
@@ -0,0 +1,59 @@
1
+ import { resolveContentLocation as e } from "./contentLocations.js";
2
+ // 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
+ export { t as resolveContentTreePath };