@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,192 @@
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
+ import { documentHasChanges as a } from "./trackChanges.js";
5
+ //#region src/validation.ts
6
+ var o = /* @__PURE__ */ new Set([
7
+ "status",
8
+ "publishAt",
9
+ "unpublishAt",
10
+ "revisionId",
11
+ "revision",
12
+ "documentId",
13
+ "site",
14
+ "environment",
15
+ "locale",
16
+ "tenantId",
17
+ "createdAt",
18
+ "updatedAt",
19
+ "createdBy",
20
+ "updatedBy"
21
+ ]), s = (e, t, n) => ({
22
+ field: e,
23
+ rule: t,
24
+ message: n
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
+ let r = [];
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 = (e, r, i) => {
29
+ switch (r.kind) {
30
+ case "string":
31
+ case "media":
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
+ case "date":
36
+ case "datetime": return l(i) ? [] : [s(e, "type", "expected a Date or a parseable date string")];
37
+ case "literal": {
38
+ let t = r.literals ?? [];
39
+ return typeof i != "string" || !t.includes(i) ? [s(e, "literal", `expected one of: ${t.join(", ")}`)] : [];
40
+ }
41
+ case "richText": {
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
+ }), l;
48
+ }
49
+ case "array": {
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
+ }
56
+ case "struct": return c(i) ? f(e, r.struct ?? {}, i, "struct", !1) : [s(e, "type", "expected an object")];
57
+ case "components": {
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
+ return i.forEach((r, i) => {
61
+ let o = `${e}[${i}]`;
62
+ if (!c(r)) {
63
+ n.push(s(o, "type", "expected a component instance"));
64
+ return;
65
+ }
66
+ let l = r.instanceId;
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
+ if (u === void 0) {
70
+ n.push(s(`${o}.componentId`, "unknown", `'${String(r.componentId)}' is not a component this field allows`));
71
+ return;
72
+ }
73
+ let d = r.props;
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
+ }
77
+ }
78
+ }, f = (e, t, n, r, i) => {
79
+ let a = [];
80
+ for (let [r, o] of Object.entries(t)) {
81
+ let t = n[r];
82
+ t == null || i && t === "" ? o.isOptional || a.push(s(`${e}.${r}`, "required", "missing required field")) : a.push(...d(`${e}.${r}`, o, t));
83
+ }
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
+ return a;
86
+ }, p = (e, t) => {
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
+ }
92
+ let i = t.id;
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
+ let a = e.taxonomy;
96
+ if (a !== void 0 && (a.unknown ?? "refuse") === "refuse" && Array.isArray(t[a.field])) {
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
+ }
100
+ return n;
101
+ }, m = (e, t) => [...Object.entries(e.fields).filter(([e, n]) => {
102
+ let r = t[e];
103
+ return n.publishRequired === !0 && (r == null || typeof r == "string" && r.trim() === "");
104
+ }).map(([e]) => s(e, "requiredToPublish", "needed before publishing")), ...Object.entries(e.fields).filter(([e, n]) => {
105
+ let r = t[e];
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 = (t, n) => {
108
+ let r = p(t, n);
109
+ if (r.length > 0) throw new e({
110
+ contentType: t.name,
111
+ violations: r
112
+ });
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
+ }
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
+ }, _ = (e, t) => {
124
+ let n = e.richText?.profile?.components ?? [];
125
+ return n.length === 0 || !c(t) || !Array.isArray(t.blocks) ? t : {
126
+ ...t,
127
+ blocks: t.blocks.map((e) => {
128
+ if (!c(e) || e.type !== "component") return e;
129
+ let [t] = v(n, [{
130
+ ...e,
131
+ instanceId: e.id
132
+ }]);
133
+ return t === void 0 || t.fingerprint === void 0 ? e : {
134
+ ...e,
135
+ props: t.props,
136
+ fingerprint: t.fingerprint
137
+ };
138
+ })
139
+ };
140
+ }, v = (e, t) => {
141
+ let n = new Map(e.map((e) => [e.id, e]));
142
+ return t.map((e) => {
143
+ if (!c(e)) return e;
144
+ let t = n.get(String(e.componentId)), r = typeof e.instanceId == "string" && e.instanceId !== "" ? e.instanceId : x();
145
+ if (t === void 0) return {
146
+ ...e,
147
+ instanceId: r
148
+ };
149
+ let i = c(e.props) ? e.props : {}, a = typeof e.fingerprint == "string" ? e.fingerprint : null, o = a !== null && a !== t.fingerprint ? t.migrations?.[a] : void 0;
150
+ o !== void 0 && (i = o(i));
151
+ let s = Object.fromEntries(Object.entries(i).map(([e, n]) => {
152
+ let r = t.props[e];
153
+ return [e, r?.kind === "components" && Array.isArray(n) ? v(r.components ?? [], n) : n];
154
+ }));
155
+ return {
156
+ ...e,
157
+ instanceId: r,
158
+ props: s,
159
+ fingerprint: t.fingerprint
160
+ };
161
+ });
162
+ }, y = (e, t) => {
163
+ let n = [], r = (e, t, i) => {
164
+ if (e.kind !== "components" || !Array.isArray(t)) return;
165
+ let a = new Map((e.components ?? []).map((e) => [e.id, e]));
166
+ t.forEach((e, t) => {
167
+ if (!c(e)) return;
168
+ let o = a.get(String(e.componentId));
169
+ if (o === void 0) return;
170
+ let s = typeof e.fingerprint == "string" ? e.fingerprint : null;
171
+ s !== o.fingerprint && (s === null || o.migrations?.[s] === void 0) && n.push({
172
+ path: `${i}[${t}]`,
173
+ componentId: o.id,
174
+ fingerprint: s
175
+ });
176
+ let l = c(e.props) ? e.props : {};
177
+ for (let [e, n] of Object.entries(o.props)) r(n, l[e], `${i}[${t}].props.${e}`);
178
+ });
179
+ };
180
+ for (let [n, i] of Object.entries(e.fields)) r(i, t[n], n);
181
+ return n;
182
+ }, b = (e) => {
183
+ let t = [];
184
+ for (let [n, r] of Object.entries(e.fixtures ?? {})) t.push(...f(`fixtures.${n}`, e.props, r, `component '${e.id}'`, !0));
185
+ for (let [n, r] of Object.entries(e.variants ?? {})) {
186
+ let i = Object.fromEntries(Object.entries(e.props).filter(([e]) => e in r));
187
+ t.push(...f(`variants.${n}`, i, r, `component '${e.id}'`, !0));
188
+ }
189
+ return t;
190
+ }, x = () => `cins_${globalThis.crypto.randomUUID().replaceAll("-", "")}`;
191
+ //#endregion
192
+ export { g as applyDerivations, b as componentExampleViolations, p as contentViolations, x as newInstanceId, m as publishViolations, y as staleComponents, h as validateContent };
@@ -0,0 +1,60 @@
1
+ //#region src/visualEditing.ts
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
+ if (e.origin !== t.origin) return null;
4
+ let n = e.data;
5
+ if (typeof n != "object" || !n) return null;
6
+ let r = n;
7
+ return r.protocol === "voltro.cms.visual/1" && typeof r.nonce == "string" && r.nonce === t.nonce ? r : null;
8
+ }, i = (t, i) => {
9
+ let a = r(t, i);
10
+ if (a === null) return null;
11
+ let o = {
12
+ protocol: e,
13
+ nonce: i.nonce
14
+ };
15
+ return a.kind === "ready" ? {
16
+ ...o,
17
+ kind: "ready"
18
+ } : typeof a.path != "string" || !n.test(a.path) ? null : a.kind === "select" ? {
19
+ ...o,
20
+ kind: "select",
21
+ path: a.path
22
+ } : a.kind === "move" && Number.isInteger(a.to) && a.to >= 0 ? {
23
+ ...o,
24
+ kind: "move",
25
+ path: a.path,
26
+ to: a.to
27
+ } : null;
28
+ }, a = (t, n) => {
29
+ let i = r(t, n);
30
+ return i === null || i.kind !== "values" || typeof i.values != "object" || i.values === null || Array.isArray(i.values) ? null : {
31
+ protocol: e,
32
+ nonce: n.nonce,
33
+ kind: "values",
34
+ values: i.values
35
+ };
36
+ }, o = (t, n) => ({
37
+ protocol: e,
38
+ nonce: t.nonce,
39
+ ...n
40
+ }), s = (e) => ({ "data-cms-source": e }), c = (e) => {
41
+ let t = e;
42
+ return (typeof t?.closest == "function" ? t.closest("[data-cms-source]") : null)?.getAttribute("data-cms-source") ?? null;
43
+ }, l = (e) => {
44
+ let [t = "", n] = e.split(".");
45
+ return n === void 0 ? { field: t } : {
46
+ field: t,
47
+ index: Number(n)
48
+ };
49
+ }, u = (e, t, n) => {
50
+ let r = Math.max(0, Math.min(e.length - 1, n));
51
+ if (t < 0 || t >= e.length || t === r) return e;
52
+ let i = [...e], [a] = i.splice(t, 1);
53
+ return i.splice(r, 0, a), i;
54
+ }, d = (e, t) => {
55
+ if (!n.test(t)) return null;
56
+ let { field: r, index: i } = l(t), a = e.querySelector(`[data-cms-field="${r}"]`);
57
+ return a === null || i === void 0 ? a : a.querySelectorAll("[data-cms-components] > [data-cms-component]")[i] ?? null;
58
+ };
59
+ //#endregion
60
+ 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 };