@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
@@ -2,7 +2,7 @@ import { asTyped as e } from "./effectForm.js";
2
2
  import { CMS_REVISIONS_TABLE as t } from "./contentType.js";
3
3
  import { changedFields as n } from "./history.js";
4
4
  import { and as r, eq as i, inSet as a } from "@voltro/database";
5
- //#region src/translation.ts
5
+ // src/translation.ts
6
6
  var o = (e, t, n) => e.query({
7
7
  table: t,
8
8
  predicate: n,
@@ -60,5 +60,4 @@ var o = (e, t, n) => e.query({
60
60
  };
61
61
  return new Map(u.map((e) => [e, _(f.get(e) ?? /* @__PURE__ */ new Map())]));
62
62
  }, d = (...t) => e(() => l(...t)), f = (...t) => e(() => u(...t));
63
- //#endregion
64
63
  export { l as translationStatus, d as translationStatusEffect, u as translationStatuses, f as translationStatusesEffect };
package/dist/tree.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region src/tree.ts
1
+ // src/tree.ts
2
2
  var e = (e, t) => {
3
3
  let n = e[t.parent];
4
4
  return typeof n == "string" && n !== "" ? n : null;
@@ -19,13 +19,13 @@ var e = (e, t) => {
19
19
  let n = e(t.row, i), r = o.get(n) ?? [];
20
20
  r.push(t), o.set(n, r);
21
21
  }
22
- let s = (e, r) => t(e.row, i) - t(r.row, i) || n(e.row, i).localeCompare(n(r.row, i)) || String(e.row.documentId).localeCompare(String(r.row.documentId)), c = [], l = /* @__PURE__ */ new Set(), u = (e, t) => {
23
- for (let r of [...o.get(e) ?? []].sort(s)) {
22
+ let s = (e, t) => e < t ? -1 : +(e > t), c = (e, r) => t(e.row, i) - t(r.row, i) || s(n(e.row, i), n(r.row, i)) || s(String(e.row.documentId), String(r.row.documentId)), l = [], u = /* @__PURE__ */ new Set(), d = (e, t) => {
23
+ for (let r of [...o.get(e) ?? []].sort(c)) {
24
24
  let a = r.row.documentId, o = n(r.row, i);
25
- if (o === "" || l.has(a)) continue;
26
- l.add(a);
25
+ if (o === "" || u.has(a)) continue;
26
+ u.add(a);
27
27
  let s = [...t, o];
28
- c.push({
28
+ l.push({
29
29
  documentId: a,
30
30
  parent: e,
31
31
  depth: t.length,
@@ -34,12 +34,12 @@ var e = (e, t) => {
34
34
  row: r.row,
35
35
  locale: r.locale,
36
36
  fallback: r.fallback
37
- }), u(a, s);
37
+ }), d(a, s);
38
38
  }
39
39
  };
40
- return u(null, []), {
41
- nodes: c,
42
- orphans: [...a.keys()].filter((e) => !l.has(e)).sort()
40
+ return d(null, []), {
41
+ nodes: l,
42
+ orphans: [...a.keys()].filter((e) => !u.has(e)).sort()
43
43
  };
44
44
  }, i = (e) => e != null && e !== "", a = (e, t, n, r = {}) => {
45
45
  let a = new Map(e.nodes.map((e) => [e.documentId, e])), o = r.ancestorsOnly === !0 ? t.parent === null ? void 0 : a.get(t.parent) : t, s = /* @__PURE__ */ new Set();
@@ -83,5 +83,4 @@ var e = (e, t) => {
83
83
  };
84
84
  });
85
85
  };
86
- //#endregion
87
86
  export { r as buildTree, o as effectiveInheritance, a as inheritedValue };
package/dist/usage.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { asTyped as e } from "./effectForm.js";
2
2
  import { and as t, eq as n, neq as r } from "@voltro/database";
3
- //#region src/usage.ts
3
+ // src/usage.ts
4
4
  var i = async (e, i, a) => {
5
5
  let o = {}, s = /* @__PURE__ */ new Set();
6
6
  for (let c of i) {
@@ -46,5 +46,4 @@ var i = async (e, i, a) => {
46
46
  environments: [...s].sort()
47
47
  };
48
48
  }, a = (...t) => e(() => i(...t));
49
- //#endregion
50
49
  export { i as contentUsage, a as contentUsageEffect };
@@ -1,8 +1,8 @@
1
- import { normalizeRichDocument as e, richDocumentProblems as t } from "./richDocument.js";
2
- import { normalizeTerms as n, taxonomyValue as r } from "./taxonomy.js";
3
- import { ContentValidationFailed as i } from "./errors.js";
1
+ import { ContentValidationFailed as e } from "./errors.js";
2
+ import { normalizeRichDocument as t, richDocumentProblems as n } from "./richDocument.js";
3
+ import { normalizeTerms as r, taxonomyValue as i } from "./taxonomy.js";
4
4
  import { documentHasChanges as a } from "./trackChanges.js";
5
- //#region src/validation.ts
5
+ // src/validation.ts
6
6
  var o = /* @__PURE__ */ new Set([
7
7
  "status",
8
8
  "publishAt",
@@ -25,54 +25,54 @@ var o = /* @__PURE__ */ new Set([
25
25
  }), c = (e) => typeof e == "object" && !!e && !Array.isArray(e), l = (e) => e instanceof Date ? !Number.isNaN(e.getTime()) : typeof e == "string" && !Number.isNaN(new Date(e).getTime()), u = (e, t, n) => {
26
26
  let r = [];
27
27
  return t.maxLength !== void 0 && n.length > t.maxLength && r.push(s(e, "maxLength", `exceeds maxLength(${t.maxLength}) — got ${n.length} characters`)), t.pattern !== void 0 && !new RegExp(t.pattern).test(n) && r.push(s(e, "pattern", `does not match pattern /${t.pattern}/`)), r;
28
- }, d = (n, r, i) => {
28
+ }, d = (e, r, i) => {
29
29
  switch (r.kind) {
30
30
  case "string":
31
31
  case "media":
32
- case "reference": return typeof i == "string" ? u(n, r, i) : [s(n, "type", `expected a string, got ${typeof i}`)];
33
- case "number": return typeof i != "number" || !Number.isFinite(i) ? [s(n, "type", "expected a finite number")] : r.fraction !== !0 && !Number.isInteger(i) ? [s(n, "integer", "expected a whole number (declare Schema.Fraction for fractions)")] : [];
34
- case "boolean": return typeof i == "boolean" ? [] : [s(n, "type", `expected a boolean, got ${typeof i}`)];
32
+ case "reference": return typeof i == "string" ? u(e, r, i) : [s(e, "type", `expected a string, got ${typeof i}`)];
33
+ case "number": return typeof i != "number" || !Number.isFinite(i) ? [s(e, "type", "expected a finite number")] : r.fraction !== !0 && !Number.isInteger(i) ? [s(e, "integer", "expected a whole number (declare Schema.Fraction for fractions)")] : [];
34
+ case "boolean": return typeof i == "boolean" ? [] : [s(e, "type", `expected a boolean, got ${typeof i}`)];
35
35
  case "date":
36
- case "datetime": return l(i) ? [] : [s(n, "type", "expected a Date or a parseable date string")];
36
+ case "datetime": return l(i) ? [] : [s(e, "type", "expected a Date or a parseable date string")];
37
37
  case "literal": {
38
- let e = r.literals ?? [];
39
- return typeof i != "string" || !e.includes(i) ? [s(n, "literal", `expected one of: ${e.join(", ")}`)] : [];
38
+ let t = r.literals ?? [];
39
+ return typeof i != "string" || !t.includes(i) ? [s(e, "literal", `expected one of: ${t.join(", ")}`)] : [];
40
40
  }
41
41
  case "richText": {
42
- let a = r.richText ?? {}, o = e(i), l = t(n, o, a).map((e) => s(e.path, e.rule, e.message)), u = new Map((a.profile?.components ?? []).map((e) => [e.id, e]));
43
- return (c(o) && Array.isArray(o.blocks) ? o.blocks : []).forEach((e, t) => {
44
- if (!c(e) || e.type !== "component" || !c(e.props)) return;
45
- let r = u.get(String(e.componentId));
46
- r !== void 0 && l.push(...f(`${n}.blocks[${t}].props`, r.props, e.props, `component '${r.id}'`, !0));
42
+ let a = r.richText ?? {}, o = t(i), l = n(e, o, a).map((e) => s(e.path, e.rule, e.message)), u = new Map((a.profile?.components ?? []).map((e) => [e.id, e]));
43
+ return (c(o) && Array.isArray(o.blocks) ? o.blocks : []).forEach((t, n) => {
44
+ if (!c(t) || t.type !== "component" || !c(t.props)) return;
45
+ let r = u.get(String(t.componentId));
46
+ r !== void 0 && l.push(...f(`${e}.blocks[${n}].props`, r.props, t.props, `component '${r.id}'`, !0));
47
47
  }), l;
48
48
  }
49
49
  case "array": {
50
- if (!Array.isArray(i)) return [s(n, "type", "expected an array")];
51
- let e = r.element;
52
- if (e === void 0) return [];
53
- let t = [];
54
- return i.forEach((r, i) => t.push(...d(`${n}[${i}]`, e, r))), t;
50
+ if (!Array.isArray(i)) return [s(e, "type", "expected an array")];
51
+ let t = r.element;
52
+ if (t === void 0) return [];
53
+ let n = [];
54
+ return i.forEach((r, i) => n.push(...d(`${e}[${i}]`, t, r))), n;
55
55
  }
56
- case "struct": return c(i) ? f(n, r.struct ?? {}, i, "struct", !1) : [s(n, "type", "expected an object")];
56
+ case "struct": return c(i) ? f(e, r.struct ?? {}, i, "struct", !1) : [s(e, "type", "expected an object")];
57
57
  case "components": {
58
- if (!Array.isArray(i)) return [s(n, "type", "expected a list of components")];
59
- let e = new Map((r.components ?? []).map((e) => [e.id, e])), t = [], a = /* @__PURE__ */ new Set();
58
+ if (!Array.isArray(i)) return [s(e, "type", "expected a list of components")];
59
+ let t = new Map((r.components ?? []).map((e) => [e.id, e])), n = [], a = /* @__PURE__ */ new Set();
60
60
  return i.forEach((r, i) => {
61
- let o = `${n}[${i}]`;
61
+ let o = `${e}[${i}]`;
62
62
  if (!c(r)) {
63
- t.push(s(o, "type", "expected a component instance"));
63
+ n.push(s(o, "type", "expected a component instance"));
64
64
  return;
65
65
  }
66
66
  let l = r.instanceId;
67
- typeof l != "string" || l === "" ? t.push(s(`${o}.instanceId`, "required", "missing instance id")) : a.has(l) ? t.push(s(`${o}.instanceId`, "unique", `instance '${l}' appears twice`)) : a.add(l);
68
- let u = e.get(String(r.componentId));
67
+ typeof l != "string" || l === "" ? n.push(s(`${o}.instanceId`, "required", "missing instance id")) : a.has(l) ? n.push(s(`${o}.instanceId`, "unique", `instance '${l}' appears twice`)) : a.add(l);
68
+ let u = t.get(String(r.componentId));
69
69
  if (u === void 0) {
70
- t.push(s(`${o}.componentId`, "unknown", `'${String(r.componentId)}' is not a component this field allows`));
70
+ n.push(s(`${o}.componentId`, "unknown", `'${String(r.componentId)}' is not a component this field allows`));
71
71
  return;
72
72
  }
73
73
  let d = r.props;
74
- c(d) ? t.push(...f(`${o}.props`, u.props, d, `component '${u.id}'`, !0)) : t.push(s(`${o}.props`, "type", "expected an object"));
75
- }), t;
74
+ c(d) ? n.push(...f(`${o}.props`, u.props, d, `component '${u.id}'`, !0)) : n.push(s(`${o}.props`, "type", "expected an object"));
75
+ }), n;
76
76
  }
77
77
  }
78
78
  }, f = (e, t, n, r, i) => {
@@ -84,42 +84,42 @@ var o = /* @__PURE__ */ new Set([
84
84
  for (let i of Object.keys(n)) i in t || a.push(s(`${e}.${i}`, "unknown", `not a declared field of this ${r}`));
85
85
  return a;
86
86
  }, p = (e, t) => {
87
- let r = [];
88
- for (let [n, i] of Object.entries(e.fields)) {
89
- let e = t[n];
90
- e == null ? i.isOptional || r.push(s(n, "required", "missing required field")) : r.push(...d(n, i, e));
87
+ let n = [];
88
+ for (let [r, i] of Object.entries(e.fields)) {
89
+ let e = t[r];
90
+ e == null ? i.isOptional || n.push(s(r, "required", "missing required field")) : n.push(...d(r, i, e));
91
91
  }
92
92
  let i = t.id;
93
- i !== void 0 && typeof i != "string" && r.push(s("id", "type", "expected a string id"));
94
- for (let n of Object.keys(t)) n === "id" || n in e.fields || o.has(n) || r.push(s(n, "unknown", `'${n}' is not a declared field of '${e.name}'`));
93
+ i !== void 0 && typeof i != "string" && n.push(s("id", "type", "expected a string id"));
94
+ for (let r of Object.keys(t)) r === "id" || r in e.fields || o.has(r) || n.push(s(r, "unknown", `'${r}' is not a declared field of '${e.name}'`));
95
95
  let a = e.taxonomy;
96
96
  if (a !== void 0 && (a.unknown ?? "refuse") === "refuse" && Array.isArray(t[a.field])) {
97
- let { unknown: e } = n(a, t[a.field]);
98
- e.length > 0 && r.push(s(a.field, "taxonomy", `not in the vocabulary: ${e.join(", ")}`));
97
+ let { unknown: e } = r(a, t[a.field]);
98
+ e.length > 0 && n.push(s(a.field, "taxonomy", `not in the vocabulary: ${e.join(", ")}`));
99
99
  }
100
- return r;
100
+ return n;
101
101
  }, m = (e, t) => [...Object.entries(e.fields).filter(([e, n]) => {
102
102
  let r = t[e];
103
103
  return n.publishRequired === !0 && (r == null || typeof r == "string" && r.trim() === "");
104
104
  }).map(([e]) => s(e, "requiredToPublish", "needed before publishing")), ...Object.entries(e.fields).filter(([e, n]) => {
105
105
  let r = t[e];
106
106
  return n.kind === "richText" && c(r) && Array.isArray(r.blocks) && a(r);
107
- }).map(([e]) => s(e, "pendingChanges", "accept or reject the suggested changes first"))], h = (e, t) => {
108
- let n = p(e, t);
109
- if (n.length > 0) throw new i({
110
- contentType: e.name,
111
- violations: n
107
+ }).map(([e]) => s(e, "pendingChanges", "accept or reject the suggested changes first"))], h = (t, n) => {
108
+ let r = p(t, n);
109
+ if (r.length > 0) throw new e({
110
+ contentType: t.name,
111
+ violations: r
112
112
  });
113
- }, g = (t, n) => {
114
- let i = { ...n }, a = t.taxonomy;
115
- a !== void 0 && Array.isArray(i[a.field]) && (i[a.field] = r(a, i[a.field]));
116
- for (let e of t.derivedFields) {
117
- let n = t.fields[e]?.derived;
118
- n !== void 0 && (i[e] = n.transform(i[n.source], i));
113
+ }, g = (e, n) => {
114
+ let r = { ...n }, a = e.taxonomy;
115
+ a !== void 0 && Array.isArray(r[a.field]) && (r[a.field] = i(a, r[a.field]));
116
+ for (let t of e.derivedFields) {
117
+ let n = e.fields[t]?.derived;
118
+ n !== void 0 && (r[t] = n.transform(r[n.source], r));
119
119
  }
120
- for (let [n, r] of Object.entries(t.fields)) r.kind === "richText" && i[n] !== void 0 && i[n] !== null && (i[n] = _(r, e(i[n], r.richText?.profile)));
121
- for (let [e, n] of Object.entries(t.fields)) n.kind === "components" && Array.isArray(i[e]) && (i[e] = v(n.components ?? [], i[e]));
122
- return i;
120
+ for (let [n, i] of Object.entries(e.fields)) i.kind === "richText" && r[n] !== void 0 && r[n] !== null && (r[n] = _(i, t(r[n], i.richText?.profile)));
121
+ for (let [t, n] of Object.entries(e.fields)) n.kind === "components" && Array.isArray(r[t]) && (r[t] = v(n.components ?? [], r[t]));
122
+ return r;
123
123
  }, _ = (e, t) => {
124
124
  let n = e.richText?.profile?.components ?? [];
125
125
  return n.length === 0 || !c(t) || !Array.isArray(t.blocks) ? t : {
@@ -188,5 +188,4 @@ var o = /* @__PURE__ */ new Set([
188
188
  }
189
189
  return t;
190
190
  }, x = () => `cins_${globalThis.crypto.randomUUID().replaceAll("-", "")}`;
191
- //#endregion
192
191
  export { g as applyDerivations, b as componentExampleViolations, p as contentViolations, x as newInstanceId, m as publishViolations, y as staleComponents, h as validateContent };
@@ -1,4 +1,4 @@
1
- //#region src/visualEditing.ts
1
+ // src/visualEditing.ts
2
2
  var e = "voltro.cms.visual/1", t = () => Array.from(globalThis.crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(16)), (e) => e.toString(16).padStart(2, "0")).join(""), n = /^[A-Za-z_][A-Za-z0-9_]*(\.\d+)?$/, r = (e, t) => {
3
3
  if (e.origin !== t.origin) return null;
4
4
  let n = e.data;
@@ -56,5 +56,4 @@ var e = "voltro.cms.visual/1", t = () => Array.from(globalThis.crypto.getRandomV
56
56
  let { field: r, index: i } = l(t), a = e.querySelector(`[data-cms-field="${r}"]`);
57
57
  return a === null || i === void 0 ? a : a.querySelectorAll("[data-cms-components] > [data-cms-component]")[i] ?? null;
58
58
  };
59
- //#endregion
60
59
  export { e as VISUAL_EDITING_PROTOCOL, d as formPartOf, u as moveEntry, t as newVisualNonce, l as parseSourcePath, a as readEditorMessage, i as readPreviewMessage, s as sourceAttributes, c as sourcePathOf, o as visualMessage };