@voltro/cms 0.84.0 → 0.86.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 (81) hide show
  1. package/CHANGELOG.md +1215 -0
  2. package/THIRD-PARTY-NOTICES.md +118 -600
  3. package/dist/ContentForm.js +282 -0
  4. package/dist/RichDocumentEditor.js +550 -0
  5. package/dist/RichDocumentView.js +132 -0
  6. package/dist/RichTextSurface.js +135 -0
  7. package/dist/aiCandidates.js +199 -0
  8. package/dist/aiOperations.js +152 -0
  9. package/dist/audiences.js +31 -0
  10. package/dist/availability.js +121 -0
  11. package/dist/blueprint.js +166 -0
  12. package/dist/bulk.js +281 -0
  13. package/dist/cacheIdentity.js +152 -0
  14. package/dist/changes.js +90 -0
  15. package/dist/cmsContext.js +229 -0
  16. package/dist/collections.js +224 -0
  17. package/dist/consent.js +29 -0
  18. package/dist/contentType.js +191 -0
  19. package/dist/contentfulImport.js +162 -0
  20. package/dist/copies.js +89 -0
  21. package/dist/cutover.js +202 -0
  22. package/dist/deliveryChecks.js +138 -0
  23. package/dist/domains.js +145 -0
  24. package/dist/draftTexts.js +164 -0
  25. package/dist/duplicates.js +78 -0
  26. package/dist/edgePurge.js +69 -0
  27. package/dist/editHistory.js +113 -0
  28. package/dist/effectForm.js +11 -0
  29. package/dist/environments.js +109 -0
  30. package/dist/errors.js +67 -0
  31. package/dist/experiments.js +528 -0
  32. package/dist/exposure.js +28 -0
  33. package/dist/extensionManifest.js +81 -0
  34. package/dist/extensions.js +314 -0
  35. package/dist/fieldSchema.js +199 -0
  36. package/dist/formStrings.js +74 -0
  37. package/dist/glossary.js +73 -0
  38. package/dist/history.js +54 -0
  39. package/dist/htmlImport.js +297 -0
  40. package/dist/index.d.ts +2266 -170
  41. package/dist/index.js +73 -3947
  42. package/dist/media.js +29 -0
  43. package/dist/metrics.js +46 -0
  44. package/dist/migration.js +193 -0
  45. package/dist/migrationStages.js +13 -0
  46. package/dist/presenceAnchors.js +68 -0
  47. package/dist/preview.js +31 -0
  48. package/dist/promotion.js +107 -0
  49. package/dist/quality.js +188 -0
  50. package/dist/recurrence.js +78 -0
  51. package/dist/redirects.js +99 -0
  52. package/dist/referenceGraph.js +223 -0
  53. package/dist/references.js +173 -0
  54. package/dist/release.js +205 -0
  55. package/dist/rest.js +52 -0
  56. package/dist/review.js +160 -0
  57. package/dist/richDocument.js +491 -0
  58. package/dist/richInline.js +100 -0
  59. package/dist/schedule.js +80 -0
  60. package/dist/search.js +148 -0
  61. package/dist/selectionIntent.js +164 -0
  62. package/dist/seo.js +31 -0
  63. package/dist/series.js +105 -0
  64. package/dist/share.js +112 -0
  65. package/dist/stewardship.js +146 -0
  66. package/dist/taxonomy.js +36 -0
  67. package/dist/team.js +103 -0
  68. package/dist/templates.js +106 -0
  69. package/dist/trackChanges.js +197 -0
  70. package/dist/translation.js +64 -0
  71. package/dist/tree.js +87 -0
  72. package/dist/usage.js +50 -0
  73. package/dist/validation.js +192 -0
  74. package/dist/visualEditing.js +60 -0
  75. package/dist/web.d.ts +927 -131
  76. package/dist/web.js +33 -2
  77. package/dist/workflow.js +322 -0
  78. package/dist/write.js +394 -0
  79. package/dist/xliff.js +325 -0
  80. package/package.json +6 -6
  81. package/dist/extensionManifest-BK3ZcL2P.js +0 -2782
@@ -0,0 +1,314 @@
1
+ import { asTyped as e } from "./effectForm.js";
2
+ import { ExtensionAccessDenied as t, compareVersions as n, manifestProblems as r, newCapabilities as i, settingsProblems as a, settingsWithDefaults as o } from "./extensionManifest.js";
3
+ import { and as s, eq as c, id as l, json as u, table as d, text as f } from "@voltro/database";
4
+ import { tenant as p } from "@voltro/plugin-multitenancy/mixin";
5
+ //#region src/extensions.ts
6
+ var m = "cms_extensions", h = "cms_extension_data", g = "cms_extension_secrets", _ = d(m, {
7
+ id: l({ prefix: "cext" }),
8
+ extensionId: f(),
9
+ manifest: u(),
10
+ granted: u(),
11
+ pending: u().nullable(),
12
+ previous: u().nullable()
13
+ }).with(p()).unique("cms_extensions_uq_extension", ["tenantId", "extensionId"]), v = d(h, {
14
+ id: l({ prefix: "cexd" }),
15
+ extensionId: f(),
16
+ key: f(),
17
+ value: u()
18
+ }).with(p()).unique("cms_extension_data_uq_key", [
19
+ "tenantId",
20
+ "extensionId",
21
+ "key"
22
+ ]), y = d(g, {
23
+ id: l({ prefix: "cexs" }),
24
+ extensionId: f(),
25
+ name: f(),
26
+ value: f().encrypted().serverOnly()
27
+ }).with(p()).unique("cms_extension_secrets_uq_name", [
28
+ "tenantId",
29
+ "extensionId",
30
+ "name"
31
+ ]), b = (e, t, n) => e.query({
32
+ table: t,
33
+ predicate: n,
34
+ order: [{
35
+ column: "id",
36
+ direction: "asc"
37
+ }],
38
+ take: void 0,
39
+ skip: void 0,
40
+ projection: void 0
41
+ }), x = async (e, t) => (await b(e, m, c("extensionId", t)))[0], S = (e) => {
42
+ let t = e.granted, n = e.pending, r = e.previous;
43
+ return {
44
+ extensionId: String(e.extensionId),
45
+ manifest: e.manifest,
46
+ granted: t,
47
+ pending: n == null ? null : {
48
+ manifest: n,
49
+ adds: i(t, n.capabilities)
50
+ },
51
+ previous: r == null ? null : r.manifest
52
+ };
53
+ }, C = async (e) => (await b(e, m, void 0)).map(S).sort((e, t) => e.extensionId < t.extensionId ? -1 : 1), w = async (e, t) => {
54
+ let n = await x(e, t);
55
+ return n === void 0 ? null : S(n);
56
+ }, T = async (e, t, n) => {
57
+ let a = r(t);
58
+ if (a.length > 0) return {
59
+ ok: !1,
60
+ reason: "invalidManifest",
61
+ problems: a
62
+ };
63
+ let o = i(n, t.capabilities);
64
+ return o.length > 0 ? {
65
+ ok: !1,
66
+ reason: "consentIncomplete",
67
+ missing: o
68
+ } : await x(e, t.id) === void 0 ? {
69
+ ok: !0,
70
+ installed: S(await e.insert(m, {
71
+ extensionId: t.id,
72
+ manifest: t,
73
+ granted: [...t.capabilities],
74
+ pending: null,
75
+ previous: null
76
+ }))
77
+ } : {
78
+ ok: !1,
79
+ reason: "alreadyInstalled"
80
+ };
81
+ }, E = async (e, t) => {
82
+ let a = r(t);
83
+ if (a.length > 0) return {
84
+ ok: !1,
85
+ reason: "invalidManifest",
86
+ problems: a
87
+ };
88
+ let o = await x(e, t.id);
89
+ if (o === void 0) return {
90
+ ok: !1,
91
+ reason: "notInstalled"
92
+ };
93
+ let s = S(o);
94
+ if (n(t.version, s.manifest.version) <= 0) return {
95
+ ok: !1,
96
+ reason: "notNewer"
97
+ };
98
+ let c = i(s.granted, t.capabilities).length === 0 ? {
99
+ manifest: t,
100
+ granted: [...t.capabilities],
101
+ pending: null,
102
+ previous: {
103
+ manifest: s.manifest,
104
+ granted: s.granted
105
+ }
106
+ } : { pending: t }, l = await e.update(m, String(o.id), c);
107
+ return l === null ? {
108
+ ok: !1,
109
+ reason: "notInstalled"
110
+ } : {
111
+ ok: !0,
112
+ installed: S(l)
113
+ };
114
+ }, D = async (e, t, n) => {
115
+ let r = await x(e, t);
116
+ if (r === void 0) return {
117
+ ok: !1,
118
+ reason: "notInstalled"
119
+ };
120
+ let { pending: a } = S(r);
121
+ if (a === null) return {
122
+ ok: !1,
123
+ reason: "nothingPending"
124
+ };
125
+ let o = i(n, a.adds);
126
+ if (o.length > 0) return {
127
+ ok: !1,
128
+ reason: "consentIncomplete",
129
+ missing: o
130
+ };
131
+ let s = S(r), c = await e.update(m, String(r.id), {
132
+ manifest: a.manifest,
133
+ granted: [...a.manifest.capabilities],
134
+ pending: null,
135
+ previous: {
136
+ manifest: s.manifest,
137
+ granted: s.granted
138
+ }
139
+ });
140
+ return c === null ? {
141
+ ok: !1,
142
+ reason: "notInstalled"
143
+ } : {
144
+ ok: !0,
145
+ installed: S(c)
146
+ };
147
+ }, O = async (e, t) => {
148
+ let n = await x(e, t);
149
+ if (n === void 0) return {
150
+ ok: !1,
151
+ reason: "notInstalled"
152
+ };
153
+ let r = n.previous;
154
+ if (r == null) return {
155
+ ok: !1,
156
+ reason: "nothingToRollBack"
157
+ };
158
+ let i = await e.update(m, String(n.id), {
159
+ manifest: r.manifest,
160
+ granted: [...r.granted],
161
+ pending: null,
162
+ previous: null
163
+ });
164
+ return i === null ? {
165
+ ok: !1,
166
+ reason: "notInstalled"
167
+ } : {
168
+ ok: !0,
169
+ installed: S(i)
170
+ };
171
+ }, k = async (e, t) => {
172
+ let n = await x(e, t);
173
+ if (n === void 0) return {
174
+ ok: !1,
175
+ reason: "notInstalled"
176
+ };
177
+ let r = await e.update(m, String(n.id), {
178
+ granted: [],
179
+ pending: null
180
+ });
181
+ return r === null ? {
182
+ ok: !1,
183
+ reason: "notInstalled"
184
+ } : {
185
+ ok: !0,
186
+ installed: S(r)
187
+ };
188
+ }, A = async (e, t, n) => {
189
+ let r = await x(e, t);
190
+ if (r === void 0) return {
191
+ ok: !1,
192
+ reason: "notInstalled"
193
+ };
194
+ let { manifest: a } = S(r), o = i(n, a.capabilities);
195
+ if (o.length > 0) return {
196
+ ok: !1,
197
+ reason: "consentIncomplete",
198
+ missing: o
199
+ };
200
+ let s = await e.update(m, String(r.id), { granted: [...a.capabilities] });
201
+ return s === null ? {
202
+ ok: !1,
203
+ reason: "notInstalled"
204
+ } : {
205
+ ok: !0,
206
+ installed: S(s)
207
+ };
208
+ }, j = "voltro:settings", M = async (e, t) => {
209
+ let n = await w(e, t);
210
+ if (n === null) return null;
211
+ let [r] = await b(e, h, s(c("extensionId", t), c("key", j))), i = r?.value;
212
+ return o(n.manifest, typeof i == "object" && i ? i : {});
213
+ }, N = async (e, t, n) => {
214
+ let r = await w(e, t);
215
+ if (r === null) return {
216
+ ok: !1,
217
+ reason: "notInstalled"
218
+ };
219
+ let i = a(r.manifest, n);
220
+ if (i.length > 0) return {
221
+ ok: !1,
222
+ reason: "invalid",
223
+ problems: i
224
+ };
225
+ let l = {
226
+ ...await M(e, t),
227
+ ...n
228
+ }, [u] = await b(e, h, s(c("extensionId", t), c("key", j)));
229
+ return u === void 0 ? await e.insert(h, {
230
+ extensionId: t,
231
+ key: j,
232
+ value: l
233
+ }) : await e.update(h, String(u.id), { value: l }), {
234
+ ok: !0,
235
+ settings: o(r.manifest, l)
236
+ };
237
+ }, P = async (e, t) => {
238
+ let n = await x(e, t);
239
+ if (n === void 0) return {
240
+ ok: !1,
241
+ reason: "notInstalled"
242
+ };
243
+ let r = await b(e, h, c("extensionId", t));
244
+ for (let t of r) await e.delete(h, String(t.id));
245
+ for (let n of await b(e, g, c("extensionId", t))) await e.delete(g, String(n.id));
246
+ return await e.delete(m, String(n.id)), {
247
+ ok: !0,
248
+ data: r.map((e) => ({
249
+ key: String(e.key),
250
+ value: e.value
251
+ }))
252
+ };
253
+ }, F = async (e, t, n, r) => {
254
+ let i = await w(e, t);
255
+ if (i === null) return {
256
+ ok: !1,
257
+ reason: "notInstalled"
258
+ };
259
+ if (![...i.manifest.capabilities, ...i.pending?.manifest.capabilities ?? []].includes(`secret:${n}`)) return {
260
+ ok: !1,
261
+ reason: "notAsked"
262
+ };
263
+ let [a] = await b(e, g, s(c("extensionId", t), c("name", n)));
264
+ return r === null ? a !== void 0 && await e.delete(g, String(a.id)) : a === void 0 ? await e.insert(g, {
265
+ extensionId: t,
266
+ name: n,
267
+ value: r
268
+ }) : await e.update(g, String(a.id), { value: r }), { ok: !0 };
269
+ }, I = async (e, t, n) => {
270
+ let [r] = await b(e, g, s(c("extensionId", t), c("name", n)));
271
+ return typeof r?.value == "string" ? r.value : void 0;
272
+ }, L = (e, n, r) => {
273
+ let i = n.extensionId, a = (e) => {
274
+ if (!n.granted.includes(e)) throw new t({
275
+ extensionId: i,
276
+ capability: e
277
+ });
278
+ }, o = async (t) => (await b(e, h, s(c("extensionId", i), c("key", t))))[0];
279
+ return {
280
+ extensionId: i,
281
+ readContent: (e, t) => (a("content:read"), r.readContent(e, t)),
282
+ listContent: (e) => (a("content:read"), r.listContent(e)),
283
+ countContent: (e) => (a("content:read"), r.countContent(e)),
284
+ readRevision: (e) => (a("content:read"), r.readRevision(e)),
285
+ writeContent: (e, t, n) => (a("content:write"), r.writeContent(e, t, n)),
286
+ fetch: (e, n) => {
287
+ let o = URL.canParse(e) ? new URL(e) : null;
288
+ if (o === null || o.protocol !== "https:" || o.port !== "") throw new t({
289
+ extensionId: i,
290
+ capability: `egress:${e}`
291
+ });
292
+ return a(`egress:${o.hostname}`), r.fetch(o.href, n);
293
+ },
294
+ secret: (e) => (a(`secret:${e}`), r.secret(e)),
295
+ settings: async () => await M(e, i) ?? {},
296
+ data: {
297
+ get: async (e) => (await o(e))?.value,
298
+ set: async (n, r) => {
299
+ if (n === j) throw new t({
300
+ extensionId: i,
301
+ capability: "settings:write"
302
+ });
303
+ let a = await o(n);
304
+ a === void 0 ? await e.insert(h, {
305
+ extensionId: i,
306
+ key: n,
307
+ value: r
308
+ }) : await e.update(h, String(a.id), { value: r });
309
+ }
310
+ }
311
+ };
312
+ }, R = (...t) => e(() => F(...t)), z = (...t) => e(() => D(...t)), B = (...t) => e(() => I(...t)), V = (...t) => e(() => M(...t)), H = (...t) => e(() => N(...t)), U = (...t) => e(() => T(...t)), W = (...t) => e(() => w(...t)), G = (...t) => e(() => C(...t)), K = (...t) => e(() => A(...t)), q = (...t) => e(() => k(...t)), J = (...t) => e(() => O(...t)), Y = (...t) => e(() => P(...t)), X = (...t) => e(() => E(...t));
313
+ //#endregion
314
+ export { m as CMS_EXTENSIONS_TABLE, h as CMS_EXTENSION_DATA_TABLE, g as CMS_EXTENSION_SECRETS_TABLE, F as bindExtensionSecret, R as bindExtensionSecretEffect, v as cmsExtensionDataTable, y as cmsExtensionSecretsTable, _ as cmsExtensionsTable, D as consentToUpgrade, z as consentToUpgradeEffect, L as extensionSandbox, I as extensionSecret, B as extensionSecretEffect, M as extensionSettings, V as extensionSettingsEffect, T as installExtension, U as installExtensionEffect, w as installedExtension, W as installedExtensionEffect, C as installedExtensions, G as installedExtensionsEffect, A as regrantExtension, K as regrantExtensionEffect, k as revokeExtension, q as revokeExtensionEffect, O as rollbackExtension, J as rollbackExtensionEffect, N as setExtensionSettings, H as setExtensionSettingsEffect, P as uninstallExtension, Y as uninstallExtensionEffect, E as upgradeExtension, X as upgradeExtensionEffect };
@@ -0,0 +1,199 @@
1
+ //#region src/fieldSchema.ts
2
+ var e = (t) => ({
3
+ ...t,
4
+ pipe(...n) {
5
+ let r = t;
6
+ for (let e of n) r = e(r);
7
+ return e(r);
8
+ },
9
+ optional() {
10
+ return e({
11
+ ...t,
12
+ isOptional: !0
13
+ });
14
+ },
15
+ requiredToPublish() {
16
+ return e({
17
+ ...t,
18
+ isOptional: !0,
19
+ publishRequired: !0
20
+ });
21
+ }
22
+ }), t = (e) => (t) => ({
23
+ ...t,
24
+ maxLength: e,
25
+ editorHint: t.kind === "string" && e > 120 ? "textarea" : t.editorHint
26
+ }), n = (e) => (t) => ({
27
+ ...t,
28
+ pattern: e.source
29
+ }), r = () => (e) => ({
30
+ ...e,
31
+ unique: !0
32
+ }), i = (t, n) => e({
33
+ kind: t,
34
+ editorHint: n,
35
+ isOptional: !1
36
+ }), a = {
37
+ String: i("string", "text"),
38
+ Number: i("number", "number"),
39
+ Fraction: e({
40
+ kind: "number",
41
+ editorHint: "number",
42
+ isOptional: !1,
43
+ fraction: !0
44
+ }),
45
+ Boolean: i("boolean", "boolean"),
46
+ Date: i("date", "date"),
47
+ DateTime: i("datetime", "datetime"),
48
+ maxLength: t,
49
+ pattern: n,
50
+ unique: r,
51
+ Literal: (...t) => e({
52
+ kind: "literal",
53
+ editorHint: "select",
54
+ isOptional: !1,
55
+ literals: t
56
+ }),
57
+ Token: (t, n) => {
58
+ let r = t[n];
59
+ if (r === void 0 || Object.keys(r).length === 0) throw Error(`Schema.Token: the design tokens declare no group '${n}'.`);
60
+ return e({
61
+ kind: "literal",
62
+ editorHint: "select",
63
+ isOptional: !1,
64
+ token: n,
65
+ literals: Object.keys(r),
66
+ literalLabels: Object.fromEntries(Object.entries(r).map(([e, t]) => [e, `${e} — ${t}`]))
67
+ });
68
+ },
69
+ Action: (t) => {
70
+ let n = Object.keys(t);
71
+ if (n.length === 0) throw Error("Schema.Action: name at least one action.");
72
+ return e({
73
+ kind: "literal",
74
+ editorHint: "select",
75
+ isOptional: !1,
76
+ action: !0,
77
+ literals: n,
78
+ literalLabels: { ...t }
79
+ });
80
+ },
81
+ RichText: (t = {}) => e({
82
+ kind: "richText",
83
+ editorHint: "richText",
84
+ isOptional: !1,
85
+ richText: t
86
+ }),
87
+ Media: () => e({
88
+ kind: "media",
89
+ editorHint: "media",
90
+ isOptional: !1
91
+ }),
92
+ Reference: (t) => e({
93
+ kind: "reference",
94
+ editorHint: "reference",
95
+ isOptional: !1,
96
+ referenceType: t
97
+ }),
98
+ Array: (t) => e({
99
+ kind: "array",
100
+ editorHint: "array",
101
+ isOptional: !1,
102
+ element: t
103
+ }),
104
+ Struct: (t) => e({
105
+ kind: "struct",
106
+ editorHint: "struct",
107
+ isOptional: !1,
108
+ struct: t
109
+ }),
110
+ Components: (t) => {
111
+ let n = t.map((e) => e.id), r = n.find((e, t) => n.indexOf(e) !== t);
112
+ if (r !== void 0) throw Error(`Schema.Components: component '${r}' is listed twice.`);
113
+ return e({
114
+ kind: "components",
115
+ editorHint: "components",
116
+ isOptional: !1,
117
+ components: t
118
+ });
119
+ }
120
+ }, o = (e) => Object.keys(e).sort().map((t) => {
121
+ let n = e[t], r = n.struct ? `{${o(n.struct)}}` : n.element ? `[${o({ _: n.element })}]` : "";
122
+ return `${t}:${n.kind}${n.isOptional ? "?" : ""}${n.literals ? `(${n.literals.join("|")})` : ""}${n.referenceType ? `->${n.referenceType}` : ""}${r}`;
123
+ }).join(","), s = (e) => {
124
+ let t = 2166136261;
125
+ for (let n = 0; n < e.length; n++) t ^= e.charCodeAt(n), t = Math.imul(t, 16777619);
126
+ return (t >>> 0).toString(16).padStart(8, "0");
127
+ }, c = (e) => s(`${e.id}|${o(e.props)}`), l = (e) => {
128
+ for (let [t, n] of Object.entries(e)) for (let e of [t, ...Object.keys(n)]) if (!/^[a-z][a-zA-Z0-9]*$/.test(e)) throw Error(`defineDesignTokens: '${e}' must be camelCase letters and digits.`);
129
+ return e;
130
+ }, u = (e) => {
131
+ if (!/^[a-z][a-zA-Z0-9]*$/.test(e.name)) throw Error(`defineRichTextProfile('${e.name}'): the name must be camelCase letters and digits.`);
132
+ if (!Number.isInteger(e.version) || e.version < 1) throw Error(`defineRichTextProfile('${e.name}'): the version is a whole number from 1.`);
133
+ let t = e.styles === void 0 ? void 0 : e.styles.tokens[e.styles.group];
134
+ if (e.styles !== void 0 && (t === void 0 || Object.keys(t).length === 0)) throw Error(`defineRichTextProfile('${e.name}'): the design tokens declare no group '${e.styles.group}'.`);
135
+ let n = e.components ?? [], r = n.map((e) => e.id);
136
+ if (new Set(r).size !== r.length) throw Error(`defineRichTextProfile('${e.name}'): a component is listed twice.`);
137
+ let i = [...e.blocks ?? [
138
+ "paragraph",
139
+ "heading",
140
+ "list",
141
+ "table",
142
+ "image",
143
+ "file"
144
+ ], ...n.length > 0 ? ["component"] : []];
145
+ return {
146
+ name: e.name,
147
+ version: e.version,
148
+ id: `${e.name}@${e.version}`,
149
+ blocks: i,
150
+ headings: e.headings ?? [2, 3],
151
+ marks: e.marks ?? [
152
+ "bold",
153
+ "italic",
154
+ "underline"
155
+ ],
156
+ ...e.styles !== void 0 && t !== void 0 ? { styles: {
157
+ group: e.styles.group,
158
+ tokens: t
159
+ } } : {},
160
+ components: n,
161
+ ...e.contactPoints === void 0 ? {} : { contactPoints: e.contactPoints },
162
+ contactLiterals: e.contactLiterals === !0
163
+ };
164
+ }, d = (e) => {
165
+ if (!/^[a-z][a-zA-Z0-9]*$/.test(e.id)) throw Error(`defineComponent('${e.id}'): the id must be camelCase letters and digits.`);
166
+ let t = e.props;
167
+ return {
168
+ id: e.id,
169
+ displayName: e.displayName,
170
+ props: t,
171
+ fingerprint: s(`${e.id}|${o(t)}`),
172
+ ...e.consent === void 0 ? {} : { consent: e.consent },
173
+ ...e.description !== void 0 && e.description.trim() !== "" ? { description: e.description.trim() } : {},
174
+ ...e.jobs !== void 0 && e.jobs.length > 0 ? { jobs: [...new Set(e.jobs.map((e) => e.trim()).filter((e) => e !== ""))] } : {},
175
+ ...e.variants === void 0 ? {} : { variants: e.variants },
176
+ ...e.fixtures === void 0 ? {} : { fixtures: e.fixtures },
177
+ ...e.migrations === void 0 ? {} : { migrations: e.migrations }
178
+ };
179
+ }, f = (e, t) => (n) => ({
180
+ ...n,
181
+ derived: {
182
+ source: e,
183
+ transform: t
184
+ }
185
+ }), p = {
186
+ ä: "ae",
187
+ ö: "oe",
188
+ ü: "ue",
189
+ ß: "ss",
190
+ æ: "ae",
191
+ œ: "oe",
192
+ ø: "o",
193
+ å: "a",
194
+ ł: "l",
195
+ đ: "d",
196
+ þ: "th"
197
+ }, m = (e) => String(e).normalize("NFC").toLowerCase().trim().replace(/[äöüßæœøåłđþ]/g, (e) => p[e] ?? e).normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
198
+ //#endregion
199
+ export { a as Schema, c as componentFingerprint, d as defineComponent, l as defineDesignTokens, u as defineRichTextProfile, f as derivedFrom, s as fnv1a, t as maxLength, n as pattern, m as slugify, r as unique };
@@ -0,0 +1,74 @@
1
+ //#region src/formStrings.ts
2
+ var e = {
3
+ blockNames: {
4
+ paragraph: "Paragraph",
5
+ heading: "Heading",
6
+ list: "List",
7
+ table: "Table",
8
+ image: "Image",
9
+ file: "Download",
10
+ component: "Component"
11
+ },
12
+ moveUp: "Move up",
13
+ moveDown: "Move down",
14
+ remove: "Remove",
15
+ moveUpLabel: (e) => `Move ${e} up`,
16
+ moveDownLabel: (e) => `Move ${e} down`,
17
+ removeLabel: (e) => `Remove ${e}`,
18
+ add: "Add",
19
+ addBlock: "Add block",
20
+ addComponent: "Add component",
21
+ findComponent: "Find a component by what it is for",
22
+ noComponentFound: "No component matches.",
23
+ otherComponents: "Other",
24
+ unknownComponent: (e) => `Unknown component '${e}'.`,
25
+ level: "Level",
26
+ numbered: "Numbered",
27
+ numberedAt: (e) => `Numbered at level ${e}`,
28
+ headerRow: "First row is the header",
29
+ image: "Image",
30
+ file: "File",
31
+ fileLabel: "Link text",
32
+ caption: "Caption",
33
+ text: "Text",
34
+ listItems: "Items, one per line (two spaces in front nest an item)",
35
+ tableRows: "Rows, one per line, cells split by |",
36
+ linkTo: "Link to",
37
+ linkText: "Link text",
38
+ insertLink: "Insert link",
39
+ item: (e, t) => `${e} ${t}`,
40
+ addItem: "Add entry",
41
+ bold: "Bold",
42
+ italic: "Italic",
43
+ underline: "Underline",
44
+ style: "Style",
45
+ noStyle: "No style",
46
+ component: "Component",
47
+ contactKind: "Contact",
48
+ contactPoint: "Contact point",
49
+ contactEmail: "E-mail address",
50
+ contactPhone: "Phone number",
51
+ contactValue: "Address or number",
52
+ contactText: "Contact text",
53
+ insertContact: "Insert contact",
54
+ suggestedChanges: "Suggested changes — accept or reject them to edit this block again.",
55
+ changeBy: (e, t, n) => [
56
+ `${e}:`,
57
+ t === "" ? "" : `adds “${t}”`,
58
+ n === "" ? "" : `removes “${n}”`,
59
+ t === "" && n === "" ? "changes the block" : ""
60
+ ].filter((e) => e !== "").join(" "),
61
+ accept: "Accept",
62
+ reject: "Reject",
63
+ acceptLabel: (e) => `Accept the change by ${e}`,
64
+ rejectLabel: (e) => `Reject the change by ${e}`
65
+ }, t = (t) => t === void 0 ? e : {
66
+ ...e,
67
+ ...t,
68
+ blockNames: {
69
+ ...e.blockNames,
70
+ ...t.blockNames
71
+ }
72
+ };
73
+ //#endregion
74
+ export { e as CONTENT_FORM_STRINGS, t as contentFormStrings };
@@ -0,0 +1,73 @@
1
+ import { asTyped as e } from "./effectForm.js";
2
+ import { and as t, eq as n, id as r, json as i, table as a, text as o } from "@voltro/database";
3
+ import { tenant as s } from "@voltro/plugin-multitenancy/mixin";
4
+ //#region src/glossary.ts
5
+ var c = "cms_glossary", l = a(c, {
6
+ id: r({ prefix: "cgl" }),
7
+ term: o(),
8
+ termKey: o().maxLength(100),
9
+ locale: o().maxLength(64),
10
+ translation: o().nullable(),
11
+ forbidden: i().nullable(),
12
+ note: o().nullable()
13
+ }).with(s()).unique("cms_glossary_uq_term", [
14
+ "tenantId",
15
+ "termKey",
16
+ "locale"
17
+ ]), u = (e) => e.trim().toLowerCase(), d = (e) => ({
18
+ id: String(e.id),
19
+ term: String(e.term),
20
+ locale: String(e.locale),
21
+ translation: typeof e.translation == "string" ? e.translation : null,
22
+ forbidden: Array.isArray(e.forbidden) ? e.forbidden.filter((e) => typeof e == "string") : [],
23
+ note: typeof e.note == "string" ? e.note : null
24
+ }), f = (e) => {
25
+ let t = [], n = e.term.trim();
26
+ return (n === "" || n.length > 100) && t.push("a term has 1 to 100 characters"), /^[a-z]{2}(-[A-Z]{2})?$/.test(e.locale) || t.push(`"${e.locale}" is not a language`), (e.translation ?? "").length > 100 && t.push("a translation has at most 100 characters"), ((e.forbidden ?? []).length > 20 || (e.forbidden ?? []).some((e) => e.trim() === "" || e.length > 100)) && t.push("at most 20 forbidden translations of 1 to 100 characters"), t;
27
+ }, p = async (e, r, i) => {
28
+ let a = {
29
+ term: i.term.trim(),
30
+ locale: i.locale,
31
+ translation: i.translation === void 0 || i.translation === null || i.translation.trim() === "" ? null : i.translation.trim(),
32
+ forbidden: [...new Set((i.forbidden ?? []).map((e) => e.trim()).filter((e) => e !== ""))],
33
+ note: i.note === void 0 || i.note === null || i.note.trim() === "" ? null : i.note.trim()
34
+ }, [o] = await e.query({
35
+ table: c,
36
+ predicate: t(n("tenantId", r), n("termKey", u(i.term)), n("locale", i.locale)),
37
+ order: [],
38
+ take: 1,
39
+ skip: void 0,
40
+ projection: void 0
41
+ });
42
+ return o === void 0 ? (await e.insert(c, {
43
+ ...a,
44
+ termKey: u(i.term),
45
+ tenantId: r
46
+ }), "added") : (await e.update(c, String(o.id), a), "replaced");
47
+ }, m = async (e, r, i) => {
48
+ let [a] = await e.query({
49
+ table: c,
50
+ predicate: t(n("tenantId", r), n("id", i)),
51
+ order: [],
52
+ take: 1,
53
+ skip: void 0,
54
+ projection: void 0
55
+ });
56
+ return a !== void 0 && (await e.delete(c, i), !0);
57
+ }, h = async (e, r, i) => (await e.query({
58
+ table: c,
59
+ predicate: i === void 0 ? n("tenantId", r) : t(n("tenantId", r), n("locale", i)),
60
+ order: [{
61
+ column: "termKey",
62
+ direction: "asc"
63
+ }],
64
+ take: void 0,
65
+ skip: void 0,
66
+ projection: void 0
67
+ })).map(d), g = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), _ = (e, t) => RegExp(`(^|[^\\p{L}\\p{N}])${g(t.trim())}($|[^\\p{L}\\p{N}])`, "iu").test(e), v = (e, t) => t.filter((t) => _(e, t.term)), y = (e, t) => t.flatMap((t) => t.forbidden.filter((t) => _(e, t)).map((e) => ({
68
+ term: t.term,
69
+ found: e,
70
+ use: t.translation
71
+ }))), b = (...t) => e(() => h(...t)), x = (...t) => e(() => m(...t)), S = (...t) => e(() => p(...t));
72
+ //#endregion
73
+ export { c as CMS_GLOSSARY_TABLE, l as cmsGlossaryTable, h as glossary, b as glossaryEffect, f as glossaryInputProblems, y as glossaryProblems, m as removeGlossaryTerm, x as removeGlossaryTermEffect, p as setGlossaryTerm, S as setGlossaryTermEffect, v as termsIn };