@nice2dev/erp-adapter 1.4.6 → 1.4.7

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.
package/dist/omniverk.mjs CHANGED
@@ -1,58 +1,58 @@
1
- import { objectFileKind as _e, endsWithAny as Z, arrayFileKind as Be, i18nFileKind as ze, itemsFileKind as Oe, jsonFileKind as Ae, scriptsFileKind as Je, jsonValuesEqual as Le, keepTextFormat as He, parseJsonText as _, patchJsonText as Me, stringifyJsonText as ae } from "@nice2dev/ui-forms/studio";
2
- const V = (e) => typeof e == "object" && e !== null && !Array.isArray(e), G = (e) => typeof e == "string" && e ? e : void 0, U = (e) => Object.fromEntries(Object.entries(e).filter(([, i]) => i !== void 0)), Ze = _e({
1
+ import { objectFileKind as Be, endsWithAny as B, arrayFileKind as Oe, i18nFileKind as ze, itemsFileKind as Ae, jsonFileKind as Le, scriptsFileKind as Je, jsonValuesEqual as Ke, keepTextFormat as He, parseJsonText as _, patchJsonText as De, stringifyJsonText as ae } from "@nice2dev/ui-forms/studio";
2
+ const V = (e) => typeof e == "object" && e !== null && !Array.isArray(e), G = (e) => typeof e == "string" && e ? e : void 0, U = (e) => Object.fromEntries(Object.entries(e).filter(([, i]) => i !== void 0)), Ze = Be({
3
3
  id: "manifest",
4
4
  label: "Manifest",
5
5
  labelKey: "devStudio.kind.manifest",
6
6
  icon: "file",
7
7
  editor: "manifest",
8
- match: Z(".manifest.json")
9
- }), De = [
8
+ match: B(".manifest.json")
9
+ }), Me = [
10
10
  ["dataType", "type"],
11
11
  ["isRequired", "required"]
12
12
  ], ce = "$aliases";
13
13
  function Ye(e) {
14
14
  if (!V(e))
15
15
  return e;
16
- const i = De.filter(([o, n]) => !(o in e) && n in e);
16
+ const i = Me.filter(([a, n]) => !(a in e) && n in e);
17
17
  if (i.length === 0)
18
18
  return e;
19
19
  const t = {};
20
- for (const [o, n] of Object.entries(e)) {
21
- const s = i.find(([, r]) => r === o);
22
- t[s ? s[0] : o] = n;
20
+ for (const [a, n] of Object.entries(e)) {
21
+ const s = i.find(([, r]) => r === a);
22
+ t[s ? s[0] : a] = n;
23
23
  }
24
- return t[ce] = i.map(([, o]) => o), t;
24
+ return t[ce] = i.map(([, a]) => a), t;
25
25
  }
26
26
  function Xe(e) {
27
27
  if (!V(e) || !Array.isArray(e[ce]))
28
28
  return e;
29
29
  const i = e[ce], t = {};
30
- for (const [o, n] of Object.entries(e)) {
31
- if (o === ce)
30
+ for (const [a, n] of Object.entries(e)) {
31
+ if (a === ce)
32
32
  continue;
33
- const s = De.find(([r, l]) => r === o && i.includes(l));
34
- t[s ? s[1] : o] = n;
33
+ const s = Me.find(([r, l]) => r === a && i.includes(l));
34
+ t[s ? s[1] : a] = n;
35
35
  }
36
36
  return t;
37
37
  }
38
38
  const Se = (e, i) => V(e) && Array.isArray(e.fields) ? { ...e, fields: e.fields.map(i) } : e, Qe = (() => {
39
- const e = Be({
39
+ const e = Oe({
40
40
  id: "entities",
41
41
  label: "Entities",
42
42
  labelKey: "devStudio.kind.entities",
43
43
  icon: "database",
44
44
  editor: "entities",
45
- match: Z(".entities.json"),
45
+ match: B(".entities.json"),
46
46
  property: "entities",
47
47
  itemKey: "name"
48
48
  });
49
49
  return {
50
50
  ...e,
51
- decode: (i, t) => e.decode(i, t).map((o) => Se(o, Ye)),
52
- encode: (i, t, o) => e.encode(
51
+ decode: (i, t) => e.decode(i, t).map((a) => Se(a, Ye)),
52
+ encode: (i, t, a) => e.encode(
53
53
  i.map((n) => Se(n, Xe)),
54
54
  t,
55
- o
55
+ a
56
56
  )
57
57
  };
58
58
  })(), et = ze(), ge = {
@@ -96,25 +96,25 @@ function tt(e) {
96
96
  ]
97
97
  };
98
98
  }
99
- function Ke(e, i) {
100
- var l, y, d;
101
- const t = (e.rows ?? []).flatMap((m) => m.cells).find((m) => m.controlType === "dataGrid"), o = ((l = t == null ? void 0 : t.props) == null ? void 0 : l.columns) ?? [], n = i.columns ?? [], s = (d = (y = e.dataSources) == null ? void 0 : y.find((m) => m.type === "entity")) == null ? void 0 : d.entity, r = (m) => "displayName" in m ? "displayName" : "header" in m ? "header" : "label" in m ? "label" : "displayName";
99
+ function Fe(e, i) {
100
+ var l, h, d;
101
+ const t = (e.rows ?? []).flatMap((p) => p.cells).find((p) => p.controlType === "dataGrid"), a = ((l = t == null ? void 0 : t.props) == null ? void 0 : l.columns) ?? [], n = i.columns ?? [], s = (d = (h = e.dataSources) == null ? void 0 : h.find((p) => p.type === "entity")) == null ? void 0 : d.entity, r = (p) => "displayName" in p ? "displayName" : "header" in p ? "header" : "label" in p ? "label" : "displayName";
102
102
  return U({
103
103
  ...i,
104
104
  displayName: "displayName" in i || e.name !== i.name ? e.name : void 0,
105
105
  entityName: s ?? i.entityName,
106
- columns: o.map((m) => {
107
- const b = n.find((N) => N.field === m.field);
108
- if (!b)
109
- return { field: m.field, displayName: m.header ?? m.field };
110
- const C = r(b), k = m.header ?? m.field;
111
- return b[C] === void 0 && k === m.field ? b : { ...b, [C]: k };
106
+ columns: a.map((p) => {
107
+ const k = n.find((T) => T.field === p.field);
108
+ if (!k)
109
+ return { field: p.field, displayName: p.header ?? p.field };
110
+ const A = r(k), S = p.header ?? p.field;
111
+ return k[A] === void 0 && S === p.field ? k : { ...k, [A]: S };
112
112
  })
113
113
  });
114
114
  }
115
115
  function it(e) {
116
116
  const i = [];
117
- return e.tabs.forEach((o, n) => {
117
+ return e.tabs.forEach((a, n) => {
118
118
  i.push({
119
119
  id: `tab-${n}`,
120
120
  cells: [
@@ -122,10 +122,10 @@ function it(e) {
122
122
  id: `tab-${n}`,
123
123
  controlType: "heading",
124
124
  colSpan: 12,
125
- props: { text: String(o.displayName ?? o.name ?? ""), level: 2, name: o.name }
125
+ props: { text: String(a.displayName ?? a.name ?? ""), level: 2, name: a.name }
126
126
  }
127
127
  ]
128
- }), (o.sections ?? []).forEach((s, r) => {
128
+ }), (a.sections ?? []).forEach((s, r) => {
129
129
  i.push({
130
130
  id: `tab-${n}-section-${r}`,
131
131
  cells: [
@@ -141,24 +141,24 @@ function it(e) {
141
141
  }
142
142
  ]
143
143
  });
144
- let l = [], y = 0;
144
+ let l = [], h = 0;
145
145
  const d = () => {
146
- l.length && (i.push({ id: `tab-${n}-section-${r}-row-${i.length}`, cells: l }), l = [], y = 0);
146
+ l.length && (i.push({ id: `tab-${n}-section-${r}-row-${i.length}`, cells: l }), l = [], h = 0);
147
147
  };
148
- (s.controls ?? []).forEach((m, b) => {
149
- const C = typeof m.colSpan == "number" ? m.colSpan : 6;
150
- y + C > 12 && d(), l.push({
151
- id: `c-${n}-${r}-${b}`,
152
- controlType: ge[String(m.type)] ?? "textInput",
153
- colSpan: C,
148
+ (s.controls ?? []).forEach((p, k) => {
149
+ const A = typeof p.colSpan == "number" ? p.colSpan : 6;
150
+ h + A > 12 && d(), l.push({
151
+ id: `c-${n}-${r}-${k}`,
152
+ controlType: ge[String(p.type)] ?? "textInput",
153
+ colSpan: A,
154
154
  props: {
155
- label: String(m.label ?? m.field ?? ""),
156
- required: m.required === !0,
157
- field: m.field,
158
- type: m.type
155
+ label: String(p.label ?? p.field ?? ""),
156
+ required: p.required === !0,
157
+ field: p.field,
158
+ type: p.type
159
159
  },
160
- bindings: { value: { source: "record", field: String(m.field ?? "") } }
161
- }), y += C;
160
+ bindings: { value: { source: "record", field: String(p.field ?? "") } }
161
+ }), h += A;
162
162
  }), d();
163
163
  });
164
164
  }), {
@@ -171,49 +171,49 @@ function it(e) {
171
171
  rows: i
172
172
  };
173
173
  }
174
- function Fe(e, i) {
175
- var d, m, b, C, k;
176
- const t = i.tabs ?? [], o = t.flatMap(
177
- (N) => (N.sections ?? []).flatMap((E) => E.controls ?? [])
174
+ function Pe(e, i) {
175
+ var d, p, k, A, S;
176
+ const t = i.tabs ?? [], a = t.flatMap(
177
+ (T) => (T.sections ?? []).flatMap((I) => I.controls ?? [])
178
178
  ), n = [];
179
179
  let s = null, r = null;
180
180
  const l = () => (s || (s = { name: "Main", displayName: e.name, sections: [] }, n.push(s)), r || (r = { name: "Details", displayName: "Details", controls: [] }, s.sections.push(r)), r);
181
- for (const N of e.rows ?? [])
182
- for (const E of N.cells) {
183
- const c = E.props ?? {};
184
- if (E.controlType === "heading" && (c.level === 2 || c.level === 3)) {
185
- const I = G(c.name) ?? String(c.text ?? "").replace(/\s+/g, "");
186
- if (c.level === 2)
187
- s = { ...t.find((S) => S.name === I) ?? {}, name: I, displayName: String(c.text ?? I), sections: [] }, n.push(s), r = null;
181
+ for (const T of e.rows ?? [])
182
+ for (const I of T.cells) {
183
+ const b = I.props ?? {};
184
+ if (I.controlType === "heading" && (b.level === 2 || b.level === 3)) {
185
+ const N = G(b.name) ?? String(b.text ?? "").replace(/\s+/g, "");
186
+ if (b.level === 2)
187
+ s = { ...t.find((j) => j.name === N) ?? {}, name: N, displayName: String(b.text ?? N), sections: [] }, n.push(s), r = null;
188
188
  else {
189
189
  s || (s = { name: "Main", displayName: e.name, sections: [] }, n.push(s));
190
- const D = t.flatMap((j) => j.sections ?? []).find((j) => j.name === I);
191
- r = { ...D ? Object.fromEntries(Object.entries(D).filter(([j]) => j !== "controls")) : {}, name: I, displayName: String(c.text ?? I), controls: [] }, s.sections.push(r);
190
+ const C = t.flatMap((O) => O.sections ?? []).find((O) => O.name === N);
191
+ r = { ...C ? Object.fromEntries(Object.entries(C).filter(([O]) => O !== "controls")) : {}, name: N, displayName: String(b.text ?? N), controls: [] }, s.sections.push(r);
192
192
  }
193
193
  continue;
194
194
  }
195
- const v = ((m = (d = E.bindings) == null ? void 0 : d.value) == null ? void 0 : m.field) ?? G(c.field);
196
- if (!v)
195
+ const D = ((p = (d = I.bindings) == null ? void 0 : d.value) == null ? void 0 : p.field) ?? G(b.field);
196
+ if (!D)
197
197
  continue;
198
- const f = o.find((I) => I.field === v), x = f && ge[String(f.type)] === E.controlType ? f.type : ((b = Object.entries(ge).find(([, I]) => I === E.controlType)) == null ? void 0 : b[0]) ?? "input", A = U({
199
- ...f ?? {},
200
- field: v,
201
- type: x,
202
- label: c.label !== void 0 ? String(c.label) : f == null ? void 0 : f.label,
203
- colSpan: (f == null ? void 0 : f.colSpan) !== void 0 || E.colSpan !== 6 ? E.colSpan : void 0,
204
- required: c.required === !0 ? !0 : (f == null ? void 0 : f.required) === !0 ? !1 : f == null ? void 0 : f.required
198
+ const u = a.find((N) => N.field === D), v = u && ge[String(u.type)] === I.controlType ? u.type : ((k = Object.entries(ge).find(([, N]) => N === I.controlType)) == null ? void 0 : k[0]) ?? "input", f = U({
199
+ ...u ?? {},
200
+ field: D,
201
+ type: v,
202
+ label: b.label !== void 0 ? String(b.label) : u == null ? void 0 : u.label,
203
+ colSpan: (u == null ? void 0 : u.colSpan) !== void 0 || I.colSpan !== 6 ? I.colSpan : void 0,
204
+ required: b.required === !0 ? !0 : (u == null ? void 0 : u.required) === !0 ? !1 : u == null ? void 0 : u.required
205
205
  });
206
- l().controls.push(A);
206
+ l().controls.push(f);
207
207
  }
208
- const y = n.map((N) => {
209
- const E = t.find((c) => c.name === N.name);
210
- return E ? { ...E, ...N } : N;
208
+ const h = n.map((T) => {
209
+ const I = t.find((b) => b.name === T.name);
210
+ return I ? { ...I, ...T } : T;
211
211
  });
212
212
  return U({
213
213
  ...i,
214
214
  displayName: "displayName" in i || e.name !== i.name ? e.name : void 0,
215
- entityName: ((k = (C = e.dataSources) == null ? void 0 : C.find((N) => N.type === "entity")) == null ? void 0 : k.entity) ?? i.entityName,
216
- tabs: y
215
+ entityName: ((S = (A = e.dataSources) == null ? void 0 : A.find((T) => T.type === "entity")) == null ? void 0 : S.entity) ?? i.entityName,
216
+ tabs: h
217
217
  });
218
218
  }
219
219
  const nt = (e) => {
@@ -221,38 +221,38 @@ const nt = (e) => {
221
221
  return i === "list" && typeof e.entityName == "string" && Array.isArray(e.columns) && e.columns.length > 0 ? "List" : i === "form" && typeof e.entityName == "string" && Array.isArray(e.tabs) ? "Form" : null;
222
222
  };
223
223
  function st(e, i) {
224
- const t = V(e) ? e : {}, o = G(t.name) ?? G(t.id) ?? `#${i}`, n = G(t.displayName) ?? o, s = nt(t);
224
+ const t = V(e) ? e : {}, a = G(t.name) ?? G(t.id) ?? `#${i}`, n = G(t.displayName) ?? a, s = nt(t);
225
225
  if (!s)
226
226
  return {
227
- key: o,
227
+ key: a,
228
228
  label: n,
229
229
  source: e,
230
230
  rawReason: String(t.type ?? (t.viewJson ? "viewJson" : "unknown"))
231
231
  };
232
- const r = s === "List" ? tt(t) : it(t), l = s === "List" ? Ke(r, t) : Fe(r, t);
233
- return Le(l, e) ? { key: o, label: n, definition: r, source: e } : { key: o, label: n, source: e, rawReason: `${s} (round-trip)` };
232
+ const r = s === "List" ? tt(t) : it(t), l = s === "List" ? Fe(r, t) : Pe(r, t);
233
+ return Ke(l, e) ? { key: a, label: n, definition: r, source: e } : { key: a, label: n, source: e, rawReason: `${s} (round-trip)` };
234
234
  }
235
235
  function ot(e) {
236
236
  if (!e.definition)
237
237
  return e.source;
238
238
  const i = V(e.source) ? e.source : { name: e.definition.id };
239
- return e.definition.kind === "form" ? Fe(e.definition, {
239
+ return e.definition.kind === "form" ? Pe(e.definition, {
240
240
  type: "Form",
241
241
  ...i,
242
242
  name: i.name ?? e.definition.id
243
- }) : Ke(e.definition, {
243
+ }) : Fe(e.definition, {
244
244
  type: "List",
245
245
  ...i,
246
246
  name: i.name ?? e.definition.id
247
247
  });
248
248
  }
249
- const at = Oe({
249
+ const at = Ae({
250
250
  id: "views",
251
251
  label: "Views",
252
252
  labelKey: "devStudio.kind.views",
253
253
  icon: "grid",
254
254
  editor: "views",
255
- match: Z(".views.json"),
255
+ match: B(".views.json"),
256
256
  property: "views",
257
257
  itemKey: "name",
258
258
  toItem: st,
@@ -265,23 +265,23 @@ function rt(e) {
265
265
  name: String(e.displayName ?? e.name),
266
266
  entityType: String(e.entityName ?? ""),
267
267
  version: 1,
268
- states: i.map((o, n) => ({
269
- id: String(o.state),
270
- name: String(o.displayName ?? o.state),
271
- type: o.isInitial === !0 ? "initial" : o.isFinal === !0 ? "final" : "intermediate",
268
+ states: i.map((a, n) => ({
269
+ id: String(a.state),
270
+ name: String(a.displayName ?? a.state),
271
+ type: a.isInitial === !0 ? "initial" : a.isFinal === !0 ? "final" : "intermediate",
272
272
  position: { x: 60 + n % 4 * 230, y: 80 + Math.floor(n / 4) * 140 }
273
273
  })),
274
- transitions: t.map((o, n) => ({
274
+ transitions: t.map((a, n) => ({
275
275
  id: `t${n}`,
276
- fromStateId: String(o.fromState),
277
- toStateId: String(o.toState),
278
- name: String(o.actionName ?? ""),
279
- ...typeof o.requiredPermission == "string" ? { requiredPermission: o.requiredPermission } : {}
276
+ fromStateId: String(a.fromState),
277
+ toStateId: String(a.toState),
278
+ name: String(a.actionName ?? ""),
279
+ ...typeof a.requiredPermission == "string" ? { requiredPermission: a.requiredPermission } : {}
280
280
  }))
281
281
  };
282
282
  }
283
- function Pe(e, i) {
284
- const t = i.steps ?? [], o = i.connections ?? [];
283
+ function Re(e, i) {
284
+ const t = i.steps ?? [], a = i.connections ?? [];
285
285
  return U({
286
286
  ...i,
287
287
  displayName: "displayName" in i || e.name !== i.name ? e.name : void 0,
@@ -296,7 +296,7 @@ function Pe(e, i) {
296
296
  });
297
297
  }),
298
298
  connections: e.transitions.map((n) => {
299
- const s = /^t(\d+)$/.exec(n.id), r = s ? o[Number(s[1])] : o.find((l) => l.fromState === n.fromStateId && l.toState === n.toStateId);
299
+ const s = /^t(\d+)$/.exec(n.id), r = s ? a[Number(s[1])] : a.find((l) => l.fromState === n.fromStateId && l.toState === n.toStateId);
300
300
  return U({
301
301
  ...r ?? {},
302
302
  fromState: n.fromStateId,
@@ -308,28 +308,28 @@ function Pe(e, i) {
308
308
  });
309
309
  }
310
310
  function lt(e, i) {
311
- const t = V(e) ? e : {}, o = G(t.name) ?? `#${i}`, n = G(t.displayName) ?? o, s = t.steps;
312
- if (!(Array.isArray(t.connections) && Array.isArray(s) && s.every((y) => V(y) && typeof y.state == "string")))
313
- return { key: o, label: n, source: e, rawReason: G(t.triggerType) ?? "automation" };
311
+ const t = V(e) ? e : {}, a = G(t.name) ?? `#${i}`, n = G(t.displayName) ?? a, s = t.steps;
312
+ if (!(Array.isArray(t.connections) && Array.isArray(s) && s.every((h) => V(h) && typeof h.state == "string")))
313
+ return { key: a, label: n, source: e, rawReason: G(t.triggerType) ?? "automation" };
314
314
  const l = rt(t);
315
- return Le(Pe(l, t), e) ? { key: o, label: n, definition: l, source: e } : { key: o, label: n, source: e, rawReason: "state machine (round-trip)" };
315
+ return Ke(Re(l, t), e) ? { key: a, label: n, definition: l, source: e } : { key: a, label: n, source: e, rawReason: "state machine (round-trip)" };
316
316
  }
317
317
  function ct(e) {
318
318
  if (!e.definition)
319
319
  return e.source;
320
320
  const i = V(e.source) ? e.source : { name: e.definition.id };
321
- return Pe(e.definition, {
321
+ return Re(e.definition, {
322
322
  ...i,
323
323
  name: i.name ?? e.definition.id
324
324
  });
325
325
  }
326
- const dt = Oe({
326
+ const dt = Ae({
327
327
  id: "workflows",
328
328
  label: "Workflows",
329
329
  labelKey: "devStudio.kind.workflows",
330
330
  icon: "git-branch",
331
331
  editor: "workflows",
332
- match: Z(".workflows.json"),
332
+ match: B(".workflows.json"),
333
333
  property: "workflows",
334
334
  itemKey: "name",
335
335
  toItem: lt,
@@ -356,11 +356,11 @@ function pt(e) {
356
356
  };
357
357
  }
358
358
  function mt(e, i) {
359
- const t = V(e) ? e : {}, o = t.permissions ?? [], n = t.permissionGroups ?? [];
359
+ const t = V(e) ? e : {}, a = t.permissions ?? [], n = t.permissionGroups ?? [];
360
360
  return {
361
361
  ...t,
362
362
  permissions: i.permissions.map((s) => {
363
- const r = o.find((l) => l.code === s.code);
363
+ const r = a.find((l) => l.code === s.code);
364
364
  return U({ ...r ?? {}, code: s.code, name: s.name, description: s.description });
365
365
  }),
366
366
  permissionGroups: i.groups.map((s) => {
@@ -374,23 +374,23 @@ function mt(e, i) {
374
374
  })
375
375
  };
376
376
  }
377
- const ut = Ae({
377
+ const ut = Le({
378
378
  id: "permissions",
379
379
  label: "Permissions",
380
380
  labelKey: "devStudio.kind.permissions",
381
381
  icon: "shield",
382
382
  editor: "permissions",
383
- match: Z(".permissions.json"),
383
+ match: B(".permissions.json"),
384
384
  select: pt,
385
385
  assign: mt,
386
386
  arrayKey: (e) => e === "/permissions" ? "code" : e === "/permissionGroups" ? "name" : void 0
387
- }), ft = Ae({
387
+ }), ft = Le({
388
388
  id: "seeds",
389
389
  label: "Seed data",
390
390
  labelKey: "devStudio.kind.seeds",
391
391
  icon: "database",
392
392
  editor: "seeds",
393
- match: Z(".seeds.json"),
393
+ match: B(".seeds.json"),
394
394
  select: (e) => {
395
395
  const i = V(e) ? e : {};
396
396
  if (!V(i.seeds) || i.demoSeeds !== void 0 && !V(i.demoSeeds))
@@ -411,10 +411,19 @@ const ut = Ae({
411
411
  files: [{ path: i[0].path, text: He(e, i[0].text) }]
412
412
  })
413
413
  }, gt = Je({
414
- match: Z(".scripts.json"),
414
+ match: B(".scripts.json"),
415
415
  property: "scripts",
416
416
  phasesProperty: "scripts"
417
- }), ht = [
417
+ }), ht = Oe({
418
+ id: "dataSources",
419
+ label: "Data sources",
420
+ labelKey: "devStudio.kind.dataSources",
421
+ icon: "database",
422
+ editor: "dataSources",
423
+ match: B(".datasources.json"),
424
+ property: "dataSources",
425
+ itemKey: "key"
426
+ }), wt = [
418
427
  Ze,
419
428
  Qe,
420
429
  et,
@@ -422,15 +431,16 @@ const ut = Ae({
422
431
  dt,
423
432
  ut,
424
433
  ft,
434
+ ht,
425
435
  gt,
426
436
  yt
427
- ], wt = (e, i) => i, z = (e) => ({
437
+ ], vt = (e, i) => i, J = (e) => ({
428
438
  type: "array",
429
439
  title: e,
430
440
  items: { type: "string" }
431
441
  });
432
- function vt(e = wt, i = {}) {
433
- const t = (s, r) => e(`devStudio.omniverk.${s}`, r), o = {
442
+ function $t(e = vt, i = {}) {
443
+ const t = (s, r) => e(`devStudio.omniverk.${s}`, r), a = {
434
444
  type: "object",
435
445
  properties: {
436
446
  key: { type: "string", title: t("field.key", "Key") },
@@ -500,11 +510,11 @@ function vt(e = wt, i = {}) {
500
510
  description: { type: "string", title: t("field.description", "Description") },
501
511
  icon: { type: "string", title: t("field.icon", "Icon") },
502
512
  color: { type: "string", title: t("field.color", "Colour") },
503
- parts: z(t("field.parts", "Files"))
513
+ parts: J(t("field.parts", "Files"))
504
514
  }
505
515
  }
506
516
  },
507
- i18n: z(t("field.i18n", "Translation files"))
517
+ i18n: J(t("field.i18n", "Translation files"))
508
518
  }
509
519
  }
510
520
  },
@@ -514,7 +524,7 @@ function vt(e = wt, i = {}) {
514
524
  schema: {
515
525
  type: "object",
516
526
  properties: {
517
- dependencies: z(t("field.dependencies", "Required packages")),
527
+ dependencies: J(t("field.dependencies", "Required packages")),
518
528
  dependencyRefs: {
519
529
  type: "array",
520
530
  title: t("field.dependencyRefs", "Dependency details"),
@@ -541,8 +551,8 @@ function vt(e = wt, i = {}) {
541
551
  }
542
552
  }
543
553
  },
544
- provides: z(t("field.provides", "Provides")),
545
- requiredControls: z(t("field.requiredControls", "Required controls"))
554
+ provides: J(t("field.provides", "Provides")),
555
+ requiredControls: J(t("field.requiredControls", "Required controls"))
546
556
  }
547
557
  }
548
558
  },
@@ -564,7 +574,7 @@ function vt(e = wt, i = {}) {
564
574
  icon: { type: "string", title: t("field.icon", "Icon") },
565
575
  isOptional: { type: "boolean", title: t("field.isOptional", "Optional") },
566
576
  order: { type: "integer", title: t("field.order", "Order") },
567
- fields: { type: "array", title: t("field.fields", "Fields"), items: o }
577
+ fields: { type: "array", title: t("field.fields", "Fields"), items: a }
568
578
  }
569
579
  }
570
580
  },
@@ -628,7 +638,7 @@ function vt(e = wt, i = {}) {
628
638
  fields: {
629
639
  type: "array",
630
640
  title: t("field.fields", "Fields"),
631
- items: o
641
+ items: a
632
642
  }
633
643
  }
634
644
  }
@@ -718,8 +728,8 @@ function vt(e = wt, i = {}) {
718
728
  image: { type: "string", title: t("field.image", "Image") },
719
729
  tag: { type: "string", title: t("field.tag", "Tag") },
720
730
  description: { type: "string", title: t("field.description", "Description") },
721
- ports: z(t("field.ports", "Ports")),
722
- volumes: z(t("field.volumes", "Volumes")),
731
+ ports: J(t("field.ports", "Ports")),
732
+ volumes: J(t("field.volumes", "Volumes")),
723
733
  command: { type: "string", title: t("field.command", "Command") },
724
734
  healthCheckCmd: {
725
735
  type: "string",
@@ -809,7 +819,7 @@ function vt(e = wt, i = {}) {
809
819
  }
810
820
  return n;
811
821
  }
812
- const W = "Custom.", Ne = "Core", $t = {
822
+ const W = "Custom.", Ne = "Core", bt = {
813
823
  string: "string",
814
824
  varchar: "string",
815
825
  nvarchar: "string",
@@ -839,7 +849,7 @@ const W = "Custom.", Ne = "Core", $t = {
839
849
  enum: "enum",
840
850
  guid: "Guid",
841
851
  uuid: "Guid"
842
- }, bt = [
852
+ }, kt = [
843
853
  "string",
844
854
  "text",
845
855
  "int",
@@ -853,7 +863,7 @@ const W = "Custom.", Ne = "Core", $t = {
853
863
  "json",
854
864
  "enum",
855
865
  "Guid"
856
- ], kt = {
866
+ ], St = {
857
867
  ł: "l",
858
868
  Ł: "L",
859
869
  ß: "ss",
@@ -862,11 +872,11 @@ const W = "Custom.", Ne = "Core", $t = {
862
872
  ø: "o",
863
873
  Ø: "O"
864
874
  };
865
- function St(e) {
866
- return [...e.normalize("NFD")].map((i) => kt[i] ?? (new RegExp("\\p{Mn}", "u").test(i) ? "" : i)).join("").normalize("NFC");
875
+ function Nt(e) {
876
+ return [...e.normalize("NFD")].map((i) => St[i] ?? (new RegExp("\\p{Mn}", "u").test(i) ? "" : i)).join("").normalize("NFC");
867
877
  }
868
878
  function P(e) {
869
- const i = St(e ?? "").split(/[^A-Za-z0-9]+/).filter(Boolean).map((t) => t[0].toUpperCase() + t.slice(1)).join("");
879
+ const i = Nt(e ?? "").split(/[^A-Za-z0-9]+/).filter(Boolean).map((t) => t[0].toUpperCase() + t.slice(1)).join("");
870
880
  return /^[0-9]/.test(i) ? `M${i}` : i;
871
881
  }
872
882
  const je = (e) => e !== e.toLowerCase() && e === e.toUpperCase();
@@ -875,26 +885,26 @@ function he(e) {
875
885
  (i, t) => t > 0 && je(i) && !je(e[t - 1]) ? `_${i.toLowerCase()}` : i.toLowerCase()
876
886
  ).join("");
877
887
  }
878
- function Nt(e) {
888
+ function jt(e) {
879
889
  return (e.startsWith(W) ? e.slice(W.length) : e.split(".").pop() ?? e).toLowerCase().replace(/[^a-z0-9_-]+/g, "") || "module";
880
890
  }
881
- async function Re(e) {
891
+ async function qe(e) {
882
892
  const i = await globalThis.crypto.subtle.digest("SHA-256", new TextEncoder().encode(e));
883
893
  return new Uint8Array(i);
884
894
  }
885
895
  const ke = (e) => Array.from(e, (i) => i.toString(16).padStart(2, "0")).join("");
886
- async function qe(e, i) {
887
- const t = (await Re(`${e}/${i}`.toLowerCase())).slice(0, 16), o = ke([3, 2, 1, 0, 5, 4, 7, 6, 8, 9, 10, 11, 12, 13, 14, 15].map((n) => t[n]));
888
- return `${o.slice(0, 8)}-${o.slice(8, 12)}-${o.slice(12, 16)}-${o.slice(16, 20)}-${o.slice(20)}`;
889
- }
890
896
  async function Ve(e, i) {
897
+ const t = (await qe(`${e}/${i}`.toLowerCase())).slice(0, 16), a = ke([3, 2, 1, 0, 5, 4, 7, 6, 8, 9, 10, 11, 12, 13, 14, 15].map((n) => t[n]));
898
+ return `${a.slice(0, 8)}-${a.slice(8, 12)}-${a.slice(12, 16)}-${a.slice(16, 20)}-${a.slice(20)}`;
899
+ }
900
+ async function Ue(e, i) {
891
901
  const t = `custom_${e}_${he(i)}`;
892
- return t.length <= 63 ? t : `${t.slice(0, 54)}_${ke(await Re(t)).slice(0, 8)}`;
902
+ return t.length <= 63 ? t : `${t.slice(0, 54)}_${ke(await qe(t)).slice(0, 8)}`;
893
903
  }
894
- function jt(e, i) {
895
- const t = new Set([...i].map((o) => o.toLowerCase()));
896
- for (let o = 1; o < 100; o++) {
897
- const n = o === 1 ? e : `${e}${o}`;
904
+ function Tt(e, i) {
905
+ const t = new Set([...i].map((a) => a.toLowerCase()));
906
+ for (let a = 1; a < 100; a++) {
907
+ const n = a === 1 ? e : `${e}${a}`;
898
908
  if (!t.has(n.toLowerCase()))
899
909
  return n;
900
910
  }
@@ -905,7 +915,7 @@ const ne = (e) => e.name.toLowerCase() === "id", q = (e) => {
905
915
  return (((i = e.displayName) == null ? void 0 : i.trim()) || e.name).trim();
906
916
  };
907
917
  function se(e) {
908
- return e.isForeignKey ? "Guid" : $t[String(e.dataType ?? "").trim().toLowerCase()] ?? "string";
918
+ return e.isForeignKey ? "Guid" : bt[String(e.dataType ?? "").trim().toLowerCase()] ?? "string";
909
919
  }
910
920
  function pe(e) {
911
921
  if (e.isForeignKey)
@@ -930,7 +940,7 @@ function pe(e) {
930
940
  return ["Text", "input"];
931
941
  }
932
942
  }
933
- const Tt = {
943
+ const Et = {
934
944
  lookup: "EntitySelect",
935
945
  textarea: "Textarea",
936
946
  number: "number",
@@ -939,10 +949,10 @@ const Tt = {
939
949
  date: "date",
940
950
  datetime: "datetime"
941
951
  };
942
- function Et(e) {
943
- var o;
952
+ function xt(e) {
953
+ var a;
944
954
  const i = [];
945
- (!((o = e.name) != null && o.trim()) || P(e.name).length === 0) && i.push("The module needs a name with letters or digits."), e.entities.length === 0 && i.push("The module has no entities — add at least one.");
955
+ (!((a = e.name) != null && a.trim()) || P(e.name).length === 0) && i.push("The module needs a name with letters or digits."), e.entities.length === 0 && i.push("The module has no entities — add at least one.");
946
956
  const t = /* @__PURE__ */ new Set();
947
957
  for (const n of e.entities) {
948
958
  const s = P(n.name);
@@ -951,20 +961,20 @@ function Et(e) {
951
961
  continue;
952
962
  }
953
963
  t.has(s.toLowerCase()) && i.push(`Entity ${s} appears twice.`), t.add(s.toLowerCase());
954
- const r = n.fields.filter((y) => !ne(y));
964
+ const r = n.fields.filter((h) => !ne(h));
955
965
  r.length === 0 && i.push(`Entity ${s} has no fields — add at least one.`);
956
966
  const l = /* @__PURE__ */ new Set();
957
- for (const y of r) {
958
- const d = P(y.name);
959
- d.length === 0 ? i.push(`${s}: field "${y.name}" needs a name with letters or digits.`) : l.has(d.toLowerCase()) ? i.push(`${s}: field ${d} appears twice.`) : l.add(d.toLowerCase());
967
+ for (const h of r) {
968
+ const d = P(h.name);
969
+ d.length === 0 ? i.push(`${s}: field "${h.name}" needs a name with letters or digits.`) : l.has(d.toLowerCase()) ? i.push(`${s}: field ${d} appears twice.`) : l.add(d.toLowerCase());
960
970
  }
961
971
  }
962
972
  return i;
963
973
  }
964
- const xt = (e) => e.toISOString().replace(/\.(\d{3})Z$/, ".$10000Z"), X = (e) => ae(e, { finalNewline: !1 }), J = (e, i) => ({
974
+ const It = (e) => e.toISOString().replace(/\.(\d{3})Z$/, ".$10000Z"), X = (e) => ae(e, { finalNewline: !1 }), H = (e, i) => ({
965
975
  icon: { name: e, package: "@nice2dev/icons", style: i }
966
976
  });
967
- function It(e) {
977
+ function Ct(e) {
968
978
  const i = e && /^Ntd[A-Z]/.test(e), t = e && /^[A-Z]\w*Icon$/.test(e);
969
979
  return {
970
980
  module: {
@@ -976,204 +986,204 @@ function It(e) {
976
986
  animation: { type: "none" }
977
987
  },
978
988
  entities: {},
979
- views: { list: J("NtdList", "outline"), form: J("NtdEdit", "outline") },
989
+ views: { list: H("NtdList", "outline"), form: H("NtdEdit", "outline") },
980
990
  permissions: {
981
- read: J("NtdEye", "outline"),
982
- create: J("NtdPlus", "outline"),
983
- update: J("NtdEdit", "outline"),
984
- delete: J("NtdTrash", "outline"),
985
- admin: J("NtdShield", "solid")
991
+ read: H("NtdEye", "outline"),
992
+ create: H("NtdPlus", "outline"),
993
+ update: H("NtdEdit", "outline"),
994
+ delete: H("NtdTrash", "outline"),
995
+ admin: H("NtdShield", "solid")
986
996
  },
987
997
  workflowStates: {}
988
998
  };
989
999
  }
990
- async function Ct(e, i = {}) {
991
- var x, A, I, D;
992
- const t = Et(e);
1000
+ async function Ot(e, i = {}) {
1001
+ var v, f, N, C;
1002
+ const t = xt(e);
993
1003
  if (t.length > 0)
994
1004
  return { problems: t };
995
- const o = e.name.toLowerCase().startsWith(W.toLowerCase()), n = P(
996
- o ? e.name.slice(W.length) : e.name
997
- ), s = jt(
1005
+ const a = e.name.toLowerCase().startsWith(W.toLowerCase()), n = P(
1006
+ a ? e.name.slice(W.length) : e.name
1007
+ ), s = Tt(
998
1008
  W + n,
999
1009
  i.existingPackageNames ?? /* @__PURE__ */ new Set()
1000
- ), r = s.slice(W.length), l = r.toLowerCase(), y = `${s}.${Ne}`, d = o ? r : e.name.trim(), m = ((x = e.description) == null ? void 0 : x.trim()) || void 0, b = e.entities.map((S) => ({ ...S, name: P(S.name) })), C = e.views !== !1, k = e.permissions !== !1, N = [.../* @__PURE__ */ new Set(["en", "pl", ...e.locales ?? []])], E = e.icon ?? "widgets", c = [], v = [
1010
+ ), r = s.slice(W.length), l = r.toLowerCase(), h = `${s}.${Ne}`, d = a ? r : e.name.trim(), p = ((v = e.description) == null ? void 0 : v.trim()) || void 0, k = e.entities.map((j) => ({ ...j, name: P(j.name) })), A = e.views !== !1, S = e.permissions !== !1, T = [.../* @__PURE__ */ new Set(["en", "pl", ...e.locales ?? []])], I = e.icon ?? "widgets", b = [], D = [
1001
1011
  `${l}.entities.json`,
1002
- ...C ? [`${l}.views.json`] : [],
1003
- ...k ? [`${l}.permissions.json`] : []
1012
+ ...A ? [`${l}.views.json`] : [],
1013
+ ...S ? [`${l}.permissions.json`] : []
1004
1014
  ];
1005
- c.push({
1015
+ b.push({
1006
1016
  path: `${l}.manifest.json`,
1007
1017
  text: X({
1008
1018
  packageName: s,
1009
1019
  version: "1.0.0",
1010
1020
  displayName: d,
1011
- description: m ?? d,
1021
+ description: p ?? d,
1012
1022
  author: "OmniVerk Module Builder",
1013
1023
  license: "Proprietary",
1014
- category: ((A = e.category) == null ? void 0 : A.trim()) || "Custom",
1015
- icon: E,
1016
- exportedAt: xt((i.now ?? (() => /* @__PURE__ */ new Date()))()),
1024
+ category: ((f = e.category) == null ? void 0 : f.trim()) || "Custom",
1025
+ icon: I,
1026
+ exportedAt: It((i.now ?? (() => /* @__PURE__ */ new Date()))()),
1017
1027
  modules: [
1018
1028
  {
1019
1029
  name: Ne,
1020
1030
  displayName: d,
1021
1031
  description: e.description ?? d,
1022
- icon: E,
1023
- parts: v
1032
+ icon: I,
1033
+ parts: D
1024
1034
  }
1025
1035
  ],
1026
1036
  dependencies: ["Core.Users"],
1027
- i18n: N.map((S) => `${l}.${S}.i18n.json`),
1037
+ i18n: T.map((j) => `${l}.${j}.i18n.json`),
1028
1038
  ...e.ownerTenantId ? { ownerTenantId: e.ownerTenantId } : {},
1029
1039
  ...e.sourceDefinitionId ? { sourceDefinitionId: e.sourceDefinitionId } : {}
1030
1040
  })
1031
1041
  });
1032
- const f = [];
1033
- for (const S of b) {
1034
- const j = [{ name: "Id", displayName: "ID", dataType: "Guid", isPrimaryKey: !0 }];
1035
- for (const $ of S.fields.filter((O) => !ne(O))) {
1036
- const O = se($), a = {
1037
- name: P($.name),
1038
- displayName: q($),
1039
- dataType: O
1042
+ const u = [];
1043
+ for (const j of k) {
1044
+ const O = [{ name: "Id", displayName: "ID", dataType: "Guid", isPrimaryKey: !0 }];
1045
+ for (const w of j.fields.filter((E) => !ne(E))) {
1046
+ const E = se(w), o = {
1047
+ name: P(w.name),
1048
+ displayName: q(w),
1049
+ dataType: E
1040
1050
  };
1041
- O === "string" && (a.maxLength = $.maxLength && $.maxLength > 0 ? $.maxLength : 200), $.isRequired && (a.isRequired = !0), $.isUnique && (a.isUnique = !0), ($.isIndexed || $.isForeignKey) && (a.isIndexed = !0), $.isForeignKey && (a.isForeignKey = !0, $.referencedEntity && (a.referencedEntity = P($.referencedEntity))), (I = $.defaultValue) != null && I.trim() && (a.defaultValue = $.defaultValue), (D = $.description) != null && D.trim() && (a.description = $.description), j.push(a);
1051
+ E === "string" && (o.maxLength = w.maxLength && w.maxLength > 0 ? w.maxLength : 200), w.isRequired && (o.isRequired = !0), w.isUnique && (o.isUnique = !0), (w.isIndexed || w.isForeignKey) && (o.isIndexed = !0), w.isForeignKey && (o.isForeignKey = !0, w.referencedEntity && (o.referencedEntity = P(w.referencedEntity))), (N = w.defaultValue) != null && N.trim() && (o.defaultValue = w.defaultValue), (C = w.description) != null && C.trim() && (o.description = w.description), O.push(o);
1042
1052
  }
1043
- f.push({
1044
- id: await qe(s, S.name),
1045
- name: S.name,
1046
- displayName: q(S),
1047
- tableName: await Ve(l, S.name),
1048
- description: S.description ?? q(S),
1049
- entityIcon: S.icon ?? "table_rows",
1053
+ u.push({
1054
+ id: await Ve(s, j.name),
1055
+ name: j.name,
1056
+ displayName: q(j),
1057
+ tableName: await Ue(l, j.name),
1058
+ description: j.description ?? q(j),
1059
+ entityIcon: j.icon ?? "table_rows",
1050
1060
  isAudited: !0,
1051
1061
  isSoftDeleteEnabled: !1,
1052
- fields: j
1062
+ fields: O
1053
1063
  });
1054
1064
  }
1055
- if (c.push({
1065
+ if (b.push({
1056
1066
  path: `${l}.entities.json`,
1057
- text: X({ moduleName: y, version: "1.0.0", entities: f })
1058
- }), C) {
1059
- const S = ($) => {
1060
- const O = b.find((p) => p.name === P($)), a = O == null ? void 0 : O.fields.find(
1061
- (p) => !ne(p) && !p.isForeignKey && se(p) === "string"
1067
+ text: X({ moduleName: h, version: "1.0.0", entities: u })
1068
+ }), A) {
1069
+ const j = (w) => {
1070
+ const E = k.find((c) => c.name === P(w)), o = E == null ? void 0 : E.fields.find(
1071
+ (c) => !ne(c) && !c.isForeignKey && se(c) === "string"
1062
1072
  );
1063
- return a ? P(a.name) : "Name";
1064
- }, j = [];
1065
- for (const $ of b) {
1066
- const O = $.fields.filter((u) => !ne(u)), a = O.filter((u) => !["text", "json"].includes(se(u))).slice(0, 6), p = (a.length ? a : [O[0]]).map((u) => ({
1067
- field: P(u.name),
1068
- displayName: q(u),
1073
+ return o ? P(o.name) : "Name";
1074
+ }, O = [];
1075
+ for (const w of k) {
1076
+ const E = w.fields.filter((m) => !ne(m)), o = E.filter((m) => !["text", "json"].includes(se(m))).slice(0, 6), c = (o.length ? o : [E[0]]).map((m) => ({
1077
+ field: P(m.name),
1078
+ displayName: q(m),
1069
1079
  sortable: !0,
1070
- type: pe(u)[0],
1071
- ...u.isForeignKey && u.referencedEntity ? { referencedEntity: P(u.referencedEntity) } : {}
1072
- })), g = O.filter((u) => ["string", "text"].includes(se(u))).map((u) => P(u.name)), h = O.map((u) => ({
1073
- field: P(u.name),
1074
- type: Tt[pe(u)[1]] ?? "TextInput",
1075
- label: q(u),
1076
- ...u.isRequired ? { required: !0 } : {},
1077
- ...u.isForeignKey && u.referencedEntity ? {
1078
- entity: P(u.referencedEntity),
1079
- displayField: S(u.referencedEntity)
1080
+ type: pe(m)[0],
1081
+ ...m.isForeignKey && m.referencedEntity ? { referencedEntity: P(m.referencedEntity) } : {}
1082
+ })), y = E.filter((m) => ["string", "text"].includes(se(m))).map((m) => P(m.name)), g = E.map((m) => ({
1083
+ field: P(m.name),
1084
+ type: Et[pe(m)[1]] ?? "TextInput",
1085
+ label: q(m),
1086
+ ...m.isRequired ? { required: !0 } : {},
1087
+ ...m.isForeignKey && m.referencedEntity ? {
1088
+ entity: P(m.referencedEntity),
1089
+ displayField: j(m.referencedEntity)
1080
1090
  } : {}
1081
1091
  }));
1082
- j.push({
1083
- id: `vw-${l}-${he($.name)}-list`,
1084
- name: `${$.name}List`,
1085
- displayName: q($),
1092
+ O.push({
1093
+ id: `vw-${l}-${he(w.name)}-list`,
1094
+ name: `${w.name}List`,
1095
+ displayName: q(w),
1086
1096
  type: "List",
1087
1097
  icon: "list",
1088
- entityName: $.name,
1089
- columns: p,
1090
- searchFields: g,
1098
+ entityName: w.name,
1099
+ columns: c,
1100
+ searchFields: y,
1091
1101
  pageSize: 25,
1092
- createControls: h,
1102
+ createControls: g,
1093
1103
  allowEdit: !0,
1094
1104
  allowDelete: !0
1095
1105
  });
1096
- const T = O.map((u) => {
1097
- const w = pe(u)[1];
1106
+ const x = E.map((m) => {
1107
+ const $ = pe(m)[1];
1098
1108
  return {
1099
- field: P(u.name),
1100
- type: w,
1101
- label: q(u),
1102
- colSpan: w === "textarea" ? 12 : 6,
1103
- ...u.isRequired ? { required: !0 } : {},
1104
- ...u.isForeignKey && u.referencedEntity ? { entity: P(u.referencedEntity) } : {}
1109
+ field: P(m.name),
1110
+ type: $,
1111
+ label: q(m),
1112
+ colSpan: $ === "textarea" ? 12 : 6,
1113
+ ...m.isRequired ? { required: !0 } : {},
1114
+ ...m.isForeignKey && m.referencedEntity ? { entity: P(m.referencedEntity) } : {}
1105
1115
  };
1106
1116
  });
1107
- j.push({
1108
- id: `vw-${l}-${he($.name)}-form`,
1109
- name: `${$.name}Form`,
1110
- displayName: q($),
1117
+ O.push({
1118
+ id: `vw-${l}-${he(w.name)}-form`,
1119
+ name: `${w.name}Form`,
1120
+ displayName: q(w),
1111
1121
  type: "Form",
1112
1122
  icon: "edit",
1113
- entityName: $.name,
1123
+ entityName: w.name,
1114
1124
  tabs: [
1115
1125
  {
1116
1126
  name: "Main",
1117
- displayName: q($),
1118
- sections: [{ name: "Details", displayName: "Details", controls: T }]
1127
+ displayName: q(w),
1128
+ sections: [{ name: "Details", displayName: "Details", controls: x }]
1119
1129
  }
1120
1130
  ]
1121
1131
  });
1122
1132
  }
1123
- c.push({
1133
+ b.push({
1124
1134
  path: `${l}.views.json`,
1125
- text: X({ moduleName: y, version: "1.0.0", views: j })
1135
+ text: X({ moduleName: h, version: "1.0.0", views: O })
1126
1136
  });
1127
1137
  }
1128
- if (k) {
1129
- const S = (O) => `${r}.${O}`, j = (O, a) => ({
1130
- code: S(O),
1131
- name: `${d} — ${a}`,
1132
- description: `${a}: ${d}`
1133
- }), $ = (O, a, ...p) => ({
1134
- name: `${W}${r} ${O}`,
1135
- description: `${d} — ${a}`,
1136
- permissions: p.map(S)
1138
+ if (S) {
1139
+ const j = (E) => `${r}.${E}`, O = (E, o) => ({
1140
+ code: j(E),
1141
+ name: `${d} — ${o}`,
1142
+ description: `${o}: ${d}`
1143
+ }), w = (E, o, ...c) => ({
1144
+ name: `${W}${r} ${E}`,
1145
+ description: `${d} — ${o}`,
1146
+ permissions: c.map(j)
1137
1147
  });
1138
- c.push({
1148
+ b.push({
1139
1149
  path: `${l}.permissions.json`,
1140
1150
  text: X({
1141
- moduleName: y,
1151
+ moduleName: h,
1142
1152
  version: "1.0.0",
1143
1153
  permissions: [
1144
- j("Read", "view records"),
1145
- j("Create", "add records"),
1146
- j("Edit", "edit records"),
1147
- j("Delete", "delete records"),
1148
- j("Admin", "administer the module")
1154
+ O("Read", "view records"),
1155
+ O("Create", "add records"),
1156
+ O("Edit", "edit records"),
1157
+ O("Delete", "delete records"),
1158
+ O("Admin", "administer the module")
1149
1159
  ],
1150
1160
  permissionGroups: [
1151
- $("Viewer", "read only", "Read"),
1152
- $("Editor", "read and edit", "Read", "Create", "Edit"),
1153
- $("Admin", "full access", "Read", "Create", "Edit", "Delete", "Admin")
1161
+ w("Viewer", "read only", "Read"),
1162
+ w("Editor", "read and edit", "Read", "Create", "Edit"),
1163
+ w("Admin", "full access", "Read", "Create", "Edit", "Delete", "Admin")
1154
1164
  ]
1155
1165
  })
1156
1166
  });
1157
1167
  }
1158
- for (const S of N) {
1159
- const j = {
1168
+ for (const j of T) {
1169
+ const O = {
1160
1170
  "module.displayName": d,
1161
- "module.description": m ?? d
1171
+ "module.description": p ?? d
1162
1172
  };
1163
- for (const $ of b) {
1164
- j[`entity.${$.name}.displayName`] = q($);
1165
- for (const O of $.fields.filter((a) => !ne(a)))
1166
- j[`field.${$.name}.${P(O.name)}.displayName`] = q(O);
1167
- C && (j[`view.${$.name}List.displayName`] = q($), j[`view.${$.name}Form.displayName`] = q($), j[`view.${$.name}Form.tab.Main`] = q($), j[`view.${$.name}Form.section.Details`] = S === "pl" ? "Szczegóły" : "Details");
1173
+ for (const w of k) {
1174
+ O[`entity.${w.name}.displayName`] = q(w);
1175
+ for (const E of w.fields.filter((o) => !ne(o)))
1176
+ O[`field.${w.name}.${P(E.name)}.displayName`] = q(E);
1177
+ A && (O[`view.${w.name}List.displayName`] = q(w), O[`view.${w.name}Form.displayName`] = q(w), O[`view.${w.name}Form.tab.Main`] = q(w), O[`view.${w.name}Form.section.Details`] = j === "pl" ? "Szczegóły" : "Details");
1168
1178
  }
1169
- c.push({
1170
- path: `${l}.${S}.i18n.json`,
1171
- text: X({ moduleName: s, locale: S, version: "1.0.0", translations: j })
1179
+ b.push({
1180
+ path: `${l}.${j}.i18n.json`,
1181
+ text: X({ moduleName: s, locale: j, version: "1.0.0", translations: O })
1172
1182
  });
1173
1183
  }
1174
- return e.iconConfig !== !1 && c.push({ path: `${l}.iconconfig.json`, text: X(It(e.icon)) }), { package: { packageName: s, folder: `Custom/${r}`, files: c }, problems: [] };
1184
+ return e.iconConfig !== !1 && b.push({ path: `${l}.iconconfig.json`, text: X(Ct(e.icon)) }), { package: { packageName: s, folder: `Custom/${r}`, files: b }, problems: [] };
1175
1185
  }
1176
- function Ot(e) {
1186
+ function At(e) {
1177
1187
  const i = (t) => typeof t == "string" && t ? t : void 0;
1178
1188
  return {
1179
1189
  name: e.name,
@@ -1188,103 +1198,103 @@ function Ot(e) {
1188
1198
  displayName: i(t.displayName),
1189
1199
  description: i(t.description),
1190
1200
  icon: i(t.entityIcon) ?? i(t.icon),
1191
- fields: (Array.isArray(t.fields) ? t.fields : []).map((o) => ({
1192
- name: String(o.name ?? ""),
1193
- displayName: i(o.displayName),
1194
- dataType: i(o.dataType) ?? i(o.type),
1195
- isRequired: o.isRequired === !0 || o.required === !0,
1196
- maxLength: typeof o.maxLength == "number" ? o.maxLength : void 0,
1197
- isUnique: o.isUnique === !0,
1198
- isIndexed: o.isIndexed === !0,
1199
- isForeignKey: o.isForeignKey === !0,
1200
- referencedEntity: i(o.referencedEntity),
1201
- defaultValue: o.defaultValue === void 0 || o.defaultValue === null ? void 0 : String(o.defaultValue),
1202
- description: i(o.description)
1201
+ fields: (Array.isArray(t.fields) ? t.fields : []).map((a) => ({
1202
+ name: String(a.name ?? ""),
1203
+ displayName: i(a.displayName),
1204
+ dataType: i(a.dataType) ?? i(a.type),
1205
+ isRequired: a.isRequired === !0 || a.required === !0,
1206
+ maxLength: typeof a.maxLength == "number" ? a.maxLength : void 0,
1207
+ isUnique: a.isUnique === !0,
1208
+ isIndexed: a.isIndexed === !0,
1209
+ isForeignKey: a.isForeignKey === !0,
1210
+ referencedEntity: i(a.referencedEntity),
1211
+ defaultValue: a.defaultValue === void 0 || a.defaultValue === null ? void 0 : String(a.defaultValue),
1212
+ description: i(a.description)
1203
1213
  }))
1204
1214
  }))
1205
1215
  };
1206
1216
  }
1207
- const H = (e) => typeof e == "object" && e !== null && !Array.isArray(e);
1217
+ const Z = (e) => typeof e == "object" && e !== null && !Array.isArray(e);
1208
1218
  function we(e, i) {
1209
- return typeof e == "string" ? i(e) : Array.isArray(e) ? e.map((t) => we(t, i)) : H(e) ? Object.fromEntries(Object.entries(e).map(([t, o]) => [t, we(o, i)])) : e;
1219
+ return typeof e == "string" ? i(e) : Array.isArray(e) ? e.map((t) => we(t, i)) : Z(e) ? Object.fromEntries(Object.entries(e).map(([t, a]) => [t, we(a, i)])) : e;
1210
1220
  }
1211
- const At = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
1212
- async function Lt(e, i) {
1221
+ const Lt = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
1222
+ async function Kt(e, i) {
1213
1223
  const t = e.find(
1214
- (c) => !c.path.includes("/") && c.path.toLowerCase().endsWith(".manifest.json")
1224
+ (b) => !b.path.includes("/") && b.path.toLowerCase().endsWith(".manifest.json")
1215
1225
  );
1216
1226
  if (!t)
1217
1227
  throw new Error("The module has no manifest.");
1218
- const o = _(t.text).value, n = String(o.packageName ?? ""), s = t.path.slice(0, -14), r = i.id, l = Nt(r), y = (c) => c.startsWith(W) ? c.slice(W.length) : c.split(".").pop() ?? c, d = y(n), m = y(r), b = (c) => c.startsWith(`${s}.`) ? `${l}${c.slice(s.length)}` : c, C = new Map(e.map((c) => [c.path, b(c.path)])), k = /* @__PURE__ */ new Map();
1219
- for (const c of e.filter((v) => v.path.toLowerCase().endsWith(".permissions.json")))
1228
+ const a = _(t.text).value, n = String(a.packageName ?? ""), s = t.path.slice(0, -14), r = i.id, l = jt(r), h = (b) => b.startsWith(W) ? b.slice(W.length) : b.split(".").pop() ?? b, d = h(n), p = h(r), k = (b) => b.startsWith(`${s}.`) ? `${l}${b.slice(s.length)}` : b, A = new Map(e.map((b) => [b.path, k(b.path)])), S = /* @__PURE__ */ new Map();
1229
+ for (const b of e.filter((D) => D.path.toLowerCase().endsWith(".permissions.json")))
1220
1230
  try {
1221
- const v = _(c.text).value;
1222
- for (const f of H(v) && Array.isArray(v.permissions) ? v.permissions : []) {
1223
- const x = typeof f.code == "string" ? f.code : "";
1224
- x.startsWith(`${d}.`) && k.set(x, `${m}${x.slice(d.length)}`);
1231
+ const D = _(b.text).value;
1232
+ for (const u of Z(D) && Array.isArray(D.permissions) ? D.permissions : []) {
1233
+ const v = typeof u.code == "string" ? u.code : "";
1234
+ v.startsWith(`${d}.`) && S.set(v, `${p}${v.slice(d.length)}`);
1225
1235
  }
1226
1236
  } catch {
1227
1237
  }
1228
- const N = (c) => n && (c === n || c.startsWith(`${n}.`) || c.startsWith(`${n} `)) ? r + c.slice(n.length) : k.get(c) ?? C.get(c) ?? c, E = [];
1229
- for (const c of e) {
1230
- if (c.path.startsWith(".revisions/"))
1238
+ const T = (b) => n && (b === n || b.startsWith(`${n}.`) || b.startsWith(`${n} `)) ? r + b.slice(n.length) : S.get(b) ?? A.get(b) ?? b, I = [];
1239
+ for (const b of e) {
1240
+ if (b.path.startsWith(".revisions/"))
1231
1241
  continue;
1232
- const v = b(c.path);
1233
- if (!c.path.toLowerCase().endsWith(".json")) {
1234
- E.push({ path: v, text: c.text });
1242
+ const D = k(b.path);
1243
+ if (!b.path.toLowerCase().endsWith(".json")) {
1244
+ I.push({ path: D, text: b.text });
1235
1245
  continue;
1236
1246
  }
1237
- let f;
1247
+ let u;
1238
1248
  try {
1239
- f = _(c.text).value;
1249
+ u = _(b.text).value;
1240
1250
  } catch {
1241
- E.push({ path: v, text: c.text });
1251
+ I.push({ path: D, text: b.text });
1242
1252
  continue;
1243
1253
  }
1244
- let x = we(f, N);
1245
- if (c === t && H(x)) {
1246
- const { sourceDefinitionId: A, ...I } = x;
1247
- x = {
1248
- ...I,
1254
+ let v = we(u, T);
1255
+ if (b === t && Z(v)) {
1256
+ const { sourceDefinitionId: f, ...N } = v;
1257
+ v = {
1258
+ ...N,
1249
1259
  packageName: r,
1250
1260
  ...i.name ? { displayName: i.name } : {},
1251
1261
  ...i.packageId ? { category: i.packageId } : {}
1252
1262
  };
1253
1263
  }
1254
- if (c.path.toLowerCase().endsWith(".entities.json") && H(x) && Array.isArray(x.entities)) {
1255
- const A = [];
1256
- for (const I of x.entities) {
1257
- if (!H(I) || typeof I.name != "string") {
1258
- A.push(I);
1264
+ if (b.path.toLowerCase().endsWith(".entities.json") && Z(v) && Array.isArray(v.entities)) {
1265
+ const f = [];
1266
+ for (const N of v.entities) {
1267
+ if (!Z(N) || typeof N.name != "string") {
1268
+ f.push(N);
1259
1269
  continue;
1260
1270
  }
1261
- A.push({
1262
- ...I,
1263
- ...typeof I.id == "string" && At.test(I.id) ? { id: await qe(r, I.name) } : {},
1264
- ...typeof I.tableName == "string" ? { tableName: await Ve(l, I.name) } : {}
1271
+ f.push({
1272
+ ...N,
1273
+ ...typeof N.id == "string" && Lt.test(N.id) ? { id: await Ve(r, N.name) } : {},
1274
+ ...typeof N.tableName == "string" ? { tableName: await Ue(l, N.name) } : {}
1265
1275
  });
1266
1276
  }
1267
- x = { ...x, entities: A };
1277
+ v = { ...v, entities: f };
1268
1278
  }
1269
- i.name && /\.en\.i18n\.json$/i.test(c.path) && H(x) && H(x.translations) && typeof x.translations["module.displayName"] == "string" && (x = {
1270
- ...x,
1271
- translations: { ...x.translations, "module.displayName": i.name }
1272
- }), E.push({ path: v, text: Me(c.text, x) });
1279
+ i.name && /\.en\.i18n\.json$/i.test(b.path) && Z(v) && Z(v.translations) && typeof v.translations["module.displayName"] == "string" && (v = {
1280
+ ...v,
1281
+ translations: { ...v.translations, "module.displayName": i.name }
1282
+ }), I.push({ path: D, text: De(b.text, v) });
1273
1283
  }
1274
1284
  return {
1275
1285
  id: r,
1276
- packageId: i.packageId ?? o.category,
1277
- files: E
1286
+ packageId: i.packageId ?? a.category,
1287
+ files: I
1278
1288
  };
1279
1289
  }
1280
- const K = (e) => typeof e == "object" && e !== null && !Array.isArray(e), ee = (e, i) => K(e) && Array.isArray(e[i]) ? e[i] : [], oe = (e, i) => e.toLowerCase().endsWith(i), ve = (e) => !e.includes("/"), Mt = /[ąćęłńóśźżĄĆĘŁŃÓŚŹŻ]/, Dt = [
1290
+ const M = (e) => typeof e == "object" && e !== null && !Array.isArray(e), ee = (e, i) => M(e) && Array.isArray(e[i]) ? e[i] : [], oe = (e, i) => e.toLowerCase().endsWith(i), ve = (e) => !e.includes("/"), Dt = /[ąćęłńóśźżĄĆĘŁŃÓŚŹŻ]/, Mt = [
1281
1291
  "ING Bank Śląski",
1282
1292
  "Bank Śląski",
1283
1293
  "BOŚ",
1284
1294
  "e-Zamówienia",
1285
1295
  "eZamówienia",
1286
1296
  "Plataforma de Contratación del Sector Público"
1287
- ], re = (e) => Mt.test(Dt.reduce((i, t) => i.split(t).join(""), e)), Kt = /* @__PURE__ */ new Set([
1297
+ ], re = (e) => Dt.test(Mt.reduce((i, t) => i.split(t).join(""), e)), Ft = /* @__PURE__ */ new Set([
1288
1298
  "module",
1289
1299
  "entity",
1290
1300
  "field",
@@ -1293,8 +1303,8 @@ const K = (e) => typeof e == "object" && e !== null && !Array.isArray(e), ee = (
1293
1303
  "nav",
1294
1304
  "action",
1295
1305
  "tutorial"
1296
- ]), Ft = /* @__PURE__ */ new Set(["int", "int32", "int64", "long", "integer"]);
1297
- function Pt(e) {
1306
+ ]), Pt = /* @__PURE__ */ new Set(["int", "int32", "int64", "long", "integer"]);
1307
+ function Rt(e) {
1298
1308
  for (let i = 0; i < e.length; i++) {
1299
1309
  const t = e.charCodeAt(i);
1300
1310
  if (t >= 55296 && t <= 56319 || t >= 9728 && t <= 10175)
@@ -1303,12 +1313,12 @@ function Pt(e) {
1303
1313
  return !1;
1304
1314
  }
1305
1315
  function Te(e) {
1306
- if (!K(e))
1316
+ if (!M(e))
1307
1317
  return [];
1308
- const i = K(e.translations) ? e.translations : K(e.keys) ? e.keys : void 0;
1318
+ const i = M(e.translations) ? e.translations : M(e.keys) ? e.keys : void 0;
1309
1319
  return i ? Object.entries(i) : [];
1310
1320
  }
1311
- const Ee = /^(.*)\.([a-z]{2,3}(?:-[A-Za-z]{2,4})?)\.i18n\.json$/i, Rt = /* @__PURE__ */ new Set([
1321
+ const Ee = /^(.*)\.([a-z]{2,3}(?:-[A-Za-z]{2,4})?)\.i18n\.json$/i, qt = /* @__PURE__ */ new Set([
1312
1322
  "hotel.views.json",
1313
1323
  "restaurant.views.json",
1314
1324
  "backup-dr.views.json",
@@ -1317,286 +1327,287 @@ const Ee = /^(.*)\.([a-z]{2,3}(?:-[A-Za-z]{2,4})?)\.i18n\.json$/i, Rt = /* @__PU
1317
1327
  "shelf_management.views.json",
1318
1328
  "psa.views.json"
1319
1329
  ]);
1320
- function qt(e, i = {}) {
1330
+ function Vt(e, i = {}) {
1331
+ var D;
1321
1332
  const t = new Set(
1322
- [...i.legacyListViewFiles ?? Rt].map(
1323
- (c) => c.toLowerCase()
1333
+ [...i.legacyListViewFiles ?? qt].map(
1334
+ (u) => u.toLowerCase()
1324
1335
  )
1325
- ), o = [], n = (c) => {
1326
- o.push({ severity: "error", ...c });
1336
+ ), a = [], n = (u) => {
1337
+ a.push({ severity: "error", ...u });
1327
1338
  }, s = [];
1328
- for (const c of e.files)
1329
- if (!(!oe(c.path, ".json") || c.path.startsWith(".revisions/")))
1339
+ for (const u of e.files)
1340
+ if (!(!oe(u.path, ".json") || u.path.startsWith(".revisions/")))
1330
1341
  try {
1331
- s.push({ file: c, value: _(c.text).value });
1342
+ s.push({ file: u, value: _(u.text).value });
1332
1343
  } catch (v) {
1333
1344
  n({
1334
1345
  code: "json.invalid",
1335
- message: `${c.path} is not valid JSON: ${v instanceof Error ? v.message : String(v)}`,
1346
+ message: `${u.path} is not valid JSON: ${v instanceof Error ? v.message : String(v)}`,
1336
1347
  messageKey: "devStudio.issue.jsonInvalid",
1337
- params: { path: c.path, error: v instanceof Error ? v.message : String(v) },
1338
- path: c.path
1348
+ params: { path: u.path, error: v instanceof Error ? v.message : String(v) },
1349
+ path: u.path
1339
1350
  });
1340
1351
  }
1341
- const r = (c) => s.filter((v) => ve(v.file.path) && oe(v.file.path, c)), l = r(".manifest.json");
1352
+ const r = (u) => s.filter((v) => ve(v.file.path) && oe(v.file.path, u)), l = r(".manifest.json");
1342
1353
  l.length === 0 && n({
1343
1354
  code: "manifest.missing",
1344
1355
  message: "The module has no *.manifest.json.",
1345
1356
  messageKey: "devStudio.issue.manifestMissing"
1346
1357
  });
1347
- for (const { file: c, value: v } of l)
1358
+ for (const { file: u, value: v } of l)
1348
1359
  for (const f of ["packageName", "version", "category"])
1349
- (!K(v) || !(f in v)) && n({
1360
+ (!M(v) || !(f in v)) && n({
1350
1361
  code: "manifest.required",
1351
1362
  message: `The manifest needs "${f}".`,
1352
1363
  messageKey: "devStudio.issue.manifestRequired",
1353
1364
  params: { field: f },
1354
- path: c.path,
1365
+ path: u.path,
1355
1366
  pointer: `/${f}`
1356
1367
  });
1357
- const y = r(".iconconfig.json");
1358
- y.length === 0 && e.contents !== "manifest" && n({
1368
+ const h = r(".iconconfig.json");
1369
+ h.length === 0 && e.contents !== "manifest" && n({
1359
1370
  severity: "info",
1360
1371
  code: "iconconfig.missing",
1361
1372
  message: "The module has no *.iconconfig.json: its menu shows a default icon (the CI wants one in every Category/Module folder).",
1362
1373
  messageKey: "devStudio.issue.iconconfigMissing"
1363
1374
  });
1364
- for (const { file: c, value: v } of y) {
1365
- const f = K(v) ? v.module : void 0, x = K(f) ? f.icon : void 0, A = [
1366
- ...K(f) ? [] : ["module"],
1367
- ...K(f) && !K(x) ? ["module.icon"] : [],
1368
- ...K(x) && !("name" in x) ? ["module.icon.name"] : [],
1369
- ...K(x) && !("package" in x) ? ["module.icon.package"] : [],
1375
+ for (const { file: u, value: v } of h) {
1376
+ const f = M(v) ? v.module : void 0, N = M(f) ? f.icon : void 0, C = [
1377
+ ...M(f) ? [] : ["module"],
1378
+ ...M(f) && !M(N) ? ["module.icon"] : [],
1379
+ ...M(N) && !("name" in N) ? ["module.icon.name"] : [],
1380
+ ...M(N) && !("package" in N) ? ["module.icon.package"] : [],
1370
1381
  ...["views", "permissions", "workflowStates"].filter(
1371
- (I) => !K(v) || !(I in v)
1382
+ (j) => !M(v) || !(j in v)
1372
1383
  )
1373
1384
  ];
1374
- for (const I of A)
1385
+ for (const j of C)
1375
1386
  n({
1376
1387
  code: "iconconfig.structure",
1377
- message: `The icon config needs "${I}".`,
1388
+ message: `The icon config needs "${j}".`,
1378
1389
  messageKey: "devStudio.issue.iconconfigStructure",
1379
- params: { field: I },
1380
- path: c.path,
1381
- pointer: `/${I.split(".").join("/")}`
1390
+ params: { field: j },
1391
+ path: u.path,
1392
+ pointer: `/${j.split(".").join("/")}`
1382
1393
  });
1383
1394
  }
1384
- const d = [], m = [];
1385
- for (const { file: c, value: v } of r(".entities.json")) {
1386
- if (!K(v) || !("entities" in v))
1395
+ const d = [], p = [];
1396
+ for (const { file: u, value: v } of r(".entities.json")) {
1397
+ if (!M(v) || !("entities" in v))
1387
1398
  continue;
1388
- const f = [], x = v.entities;
1389
- if (!Array.isArray(x) || x.length === 0) {
1399
+ const f = [], N = v.entities;
1400
+ if (!Array.isArray(N) || N.length === 0) {
1390
1401
  n({
1391
1402
  code: "entities.empty",
1392
1403
  message: "The file has no entities.",
1393
1404
  messageKey: "devStudio.issue.entitiesEmpty",
1394
- path: c.path,
1405
+ path: u.path,
1395
1406
  pointer: "/entities"
1396
1407
  });
1397
1408
  continue;
1398
1409
  }
1399
- x.forEach((A, I) => {
1400
- const D = `/entities/${I}`, S = K(A) && typeof A.name == "string" ? A.name : void 0;
1401
- if (S ? d.push(S) : n({
1410
+ N.forEach((C, j) => {
1411
+ const O = `/entities/${j}`, w = M(C) && typeof C.name == "string" ? C.name : void 0;
1412
+ if (w ? d.push(w) : n({
1402
1413
  code: "entities.name",
1403
- message: `Entity #${I + 1} has no name.`,
1414
+ message: `Entity #${j + 1} has no name.`,
1404
1415
  messageKey: "devStudio.issue.entitiesName",
1405
- params: { n: I + 1 },
1406
- path: c.path,
1407
- pointer: D
1408
- }), !K(A) || !Array.isArray(A.fields)) {
1416
+ params: { n: j + 1 },
1417
+ path: u.path,
1418
+ pointer: O
1419
+ }), !M(C) || !Array.isArray(C.fields)) {
1409
1420
  n({
1410
1421
  code: "entities.fields",
1411
- message: `Entity ${S ?? `#${I + 1}`} has no fields array.`,
1422
+ message: `Entity ${w ?? `#${j + 1}`} has no fields array.`,
1412
1423
  messageKey: "devStudio.issue.entitiesFields",
1413
- params: { name: S ?? `#${I + 1}` },
1414
- path: c.path,
1415
- pointer: D
1424
+ params: { name: w ?? `#${j + 1}` },
1425
+ path: u.path,
1426
+ pointer: O
1416
1427
  });
1417
1428
  return;
1418
1429
  }
1419
- K(A) && typeof A.displayName == "string" && re(A.displayName) && n({
1430
+ M(C) && typeof C.displayName == "string" && re(C.displayName) && n({
1420
1431
  code: "labels.polish",
1421
- message: `Entity ${S}: the display name "${A.displayName}" is Polish — seed labels are English, Polish goes to the .pl bundle.`,
1432
+ message: `Entity ${w}: the display name "${C.displayName}" is Polish — seed labels are English, Polish goes to the .pl bundle.`,
1422
1433
  messageKey: "devStudio.issue.polishEntity",
1423
- params: { name: S ?? "", text: A.displayName },
1424
- path: c.path,
1425
- pointer: `${D}/displayName`
1426
- }), A.fields.forEach((j, $) => {
1427
- if (!K(j))
1434
+ params: { name: w ?? "", text: C.displayName },
1435
+ path: u.path,
1436
+ pointer: `${O}/displayName`
1437
+ }), C.fields.forEach((E, o) => {
1438
+ if (!M(E))
1428
1439
  return;
1429
- const O = typeof j.name == "string" ? j.name : void 0, a = `${D}/fields/${$}`;
1430
- S && O && j.isPrimaryKey !== !0 && m.push(`field.${S}.${O}`);
1431
- const p = typeof j.dataType == "string" ? j.dataType.replace(/\?+$/, "") : void 0;
1432
- p === void 0 && typeof j.type == "string" && f.push({ name: `${S}.${O}`, pointer: `${a}/type` }), p && Ft.has(p.toLowerCase()) && (O === "Id" || j.isForeignKey === !0) && n({
1440
+ const c = typeof E.name == "string" ? E.name : void 0, y = `${O}/fields/${o}`;
1441
+ w && c && E.isPrimaryKey !== !0 && p.push(`field.${w}.${c}`);
1442
+ const g = typeof E.dataType == "string" ? E.dataType.replace(/\?+$/, "") : void 0;
1443
+ g === void 0 && typeof E.type == "string" && f.push({ name: `${w}.${c}`, pointer: `${y}/type` }), g && Pt.has(g.toLowerCase()) && (c === "Id" || E.isForeignKey === !0) && n({
1433
1444
  code: "entities.keyNotGuid",
1434
- message: `${S}.${O} is ${p}: keys must be Guid (every row's Id is a uuid).`,
1445
+ message: `${w}.${c} is ${g}: keys must be Guid (every row's Id is a uuid).`,
1435
1446
  messageKey: "devStudio.issue.keyNotGuid",
1436
- params: { name: `${S}.${O}`, type: p },
1437
- path: c.path,
1438
- pointer: `${a}/dataType`
1439
- }), typeof j.displayName == "string" && re(j.displayName) && n({
1447
+ params: { name: `${w}.${c}`, type: g },
1448
+ path: u.path,
1449
+ pointer: `${y}/dataType`
1450
+ }), typeof E.displayName == "string" && re(E.displayName) && n({
1440
1451
  code: "labels.polish",
1441
- message: `${S}.${O}: the display name "${j.displayName}" is Polish — seed labels are English.`,
1452
+ message: `${w}.${c}: the display name "${E.displayName}" is Polish — seed labels are English.`,
1442
1453
  messageKey: "devStudio.issue.polishField",
1443
- params: { name: `${S}.${O}`, text: j.displayName },
1444
- path: c.path,
1445
- pointer: `${a}/displayName`
1454
+ params: { name: `${w}.${c}`, text: E.displayName },
1455
+ path: u.path,
1456
+ pointer: `${y}/displayName`
1446
1457
  });
1447
1458
  });
1448
1459
  }), f.length && n({
1449
1460
  severity: "warning",
1450
1461
  code: "entities.typeIgnored",
1451
- message: `${f.length} field(s) give their type as "type", which installing ignores — it reads "dataType": ${f.slice(0, 5).map((A) => A.name).join(", ")}${f.length > 5 ? ", …" : ""}`,
1462
+ message: `${f.length} field(s) give their type as "type", which installing ignores — it reads "dataType": ${f.slice(0, 5).map((C) => C.name).join(", ")}${f.length > 5 ? ", …" : ""}`,
1452
1463
  messageKey: "devStudio.issue.typeIgnored",
1453
1464
  params: {
1454
1465
  count: f.length,
1455
- names: `${f.slice(0, 5).map((A) => A.name).join(", ")}${f.length > 5 ? ", …" : ""}`
1466
+ names: `${f.slice(0, 5).map((C) => C.name).join(", ")}${f.length > 5 ? ", …" : ""}`
1456
1467
  },
1457
- path: c.path,
1468
+ path: u.path,
1458
1469
  pointer: f[0].pointer
1459
1470
  });
1460
1471
  }
1461
- for (const { file: c, value: v } of r(".permissions.json"))
1462
- (!K(v) || !Array.isArray(v.permissions) || v.permissions.length === 0) && n({
1472
+ for (const { file: u, value: v } of r(".permissions.json"))
1473
+ (!M(v) || !Array.isArray(v.permissions) || v.permissions.length === 0) && n({
1463
1474
  code: "permissions.empty",
1464
1475
  message: 'The file needs a non-empty "permissions" array.',
1465
1476
  messageKey: "devStudio.issue.permissionsEmpty",
1466
- path: c.path,
1477
+ path: u.path,
1467
1478
  pointer: "/permissions"
1468
1479
  });
1469
- const b = [];
1470
- for (const { file: c, value: v } of r(".views.json")) {
1471
- if (!K(v) || Object.keys(v).length === 0) {
1480
+ const k = [];
1481
+ for (const { file: u, value: v } of r(".views.json")) {
1482
+ if (!M(v) || Object.keys(v).length === 0) {
1472
1483
  n({
1473
1484
  code: "views.empty",
1474
1485
  message: "A views file is a JSON object with at least one property.",
1475
1486
  messageKey: "devStudio.issue.viewsEmpty",
1476
- path: c.path
1487
+ path: u.path
1477
1488
  });
1478
1489
  continue;
1479
1490
  }
1480
- ee(v, "views").forEach((f, x) => {
1481
- if (!K(f))
1491
+ ee(v, "views").forEach((f, N) => {
1492
+ if (!M(f))
1482
1493
  return;
1483
- const A = `/views/${x}`, I = typeof f.name == "string" ? f.name : "(unnamed)";
1484
- typeof f.name == "string" && b.push(f.name), typeof f.type == "string" && f.type.toLowerCase() === "list" && !t.has(c.path.toLowerCase()) && (typeof f.entityName != "string" || !f.entityName.trim() ? n({
1494
+ const C = `/views/${N}`, j = typeof f.name == "string" ? f.name : "(unnamed)";
1495
+ typeof f.name == "string" && k.push(f.name), typeof f.type == "string" && f.type.toLowerCase() === "list" && !t.has(u.path.toLowerCase()) && (typeof f.entityName != "string" || !f.entityName.trim() ? n({
1485
1496
  code: "views.listEntity",
1486
- message: `List view ${I} needs a top-level "entityName".`,
1497
+ message: `List view ${j} needs a top-level "entityName".`,
1487
1498
  messageKey: "devStudio.issue.listEntity",
1488
- params: { name: I },
1489
- path: c.path,
1490
- pointer: A
1499
+ params: { name: j },
1500
+ path: u.path,
1501
+ pointer: C
1491
1502
  }) : (!Array.isArray(f.columns) || f.columns.length === 0) && n({
1492
1503
  code: "views.listColumns",
1493
- message: `List view ${I} needs non-empty top-level "columns".`,
1504
+ message: `List view ${j} needs non-empty top-level "columns".`,
1494
1505
  messageKey: "devStudio.issue.listColumns",
1495
- params: { name: I },
1496
- path: c.path,
1497
- pointer: A
1506
+ params: { name: j },
1507
+ path: u.path,
1508
+ pointer: C
1498
1509
  }));
1499
- const D = [[f, "displayName", A]];
1500
- ee(f, "columns").forEach((S, j) => {
1501
- for (const $ of ["header", "displayName", "label"])
1502
- D.push([S, $, `${A}/columns/${j}`]);
1503
- }), ee(f, "tabs").forEach((S, j) => {
1504
- D.push([S, "displayName", `${A}/tabs/${j}`]), ee(S, "sections").forEach(($, O) => {
1505
- D.push([$, "displayName", `${A}/tabs/${j}/sections/${O}`]), ee($, "controls").forEach(
1506
- (a, p) => D.push([a, "label", `${A}/tabs/${j}/sections/${O}/controls/${p}`])
1510
+ const O = [[f, "displayName", C]];
1511
+ ee(f, "columns").forEach((w, E) => {
1512
+ for (const o of ["header", "displayName", "label"])
1513
+ O.push([w, o, `${C}/columns/${E}`]);
1514
+ }), ee(f, "tabs").forEach((w, E) => {
1515
+ O.push([w, "displayName", `${C}/tabs/${E}`]), ee(w, "sections").forEach((o, c) => {
1516
+ O.push([o, "displayName", `${C}/tabs/${E}/sections/${c}`]), ee(o, "controls").forEach(
1517
+ (y, g) => O.push([y, "label", `${C}/tabs/${E}/sections/${c}/controls/${g}`])
1507
1518
  );
1508
1519
  });
1509
1520
  });
1510
- for (const [S, j, $] of D) {
1511
- const O = K(S) ? S[j] : void 0;
1512
- typeof O == "string" && re(O) && n({
1521
+ for (const [w, E, o] of O) {
1522
+ const c = M(w) ? w[E] : void 0;
1523
+ typeof c == "string" && re(c) && n({
1513
1524
  code: "labels.polish",
1514
- message: `View ${I}: "${O}" is Polish — seed labels are English.`,
1525
+ message: `View ${j}: "${c}" is Polish — seed labels are English.`,
1515
1526
  messageKey: "devStudio.issue.polishView",
1516
- params: { name: I, text: O },
1517
- path: c.path,
1518
- pointer: `${$}/${j}`
1527
+ params: { name: j, text: c },
1528
+ path: u.path,
1529
+ pointer: `${o}/${E}`
1519
1530
  });
1520
1531
  }
1521
1532
  });
1522
1533
  }
1523
- const C = s.filter((c) => ve(c.file.path) && Ee.test(c.file.path)), k = /* @__PURE__ */ new Map();
1524
- for (const c of C) {
1525
- const [, v, f] = Ee.exec(c.file.path), x = k.get(v) ?? /* @__PURE__ */ new Map();
1526
- x.set(f.toLowerCase(), c), k.set(v, x);
1534
+ const A = s.filter((u) => ve(u.file.path) && Ee.test(u.file.path)), S = /* @__PURE__ */ new Map();
1535
+ for (const u of A) {
1536
+ const [, v, f] = Ee.exec(u.file.path), N = S.get(v) ?? /* @__PURE__ */ new Map();
1537
+ N.set(f.toLowerCase(), u), S.set(v, N);
1527
1538
  }
1528
- const N = new Set(
1529
- [...k.keys()].map((c) => c.split(".")[0]).filter((c) => !Kt.has(c))
1530
- ), E = /* @__PURE__ */ new Set();
1531
- for (const [c, v] of k) {
1532
- const f = v.get("en"), x = v.get("pl"), A = (I) => new Set(Te(I == null ? void 0 : I.value).map(([D]) => D));
1533
- if (f && !x && n({
1539
+ const T = new Set(
1540
+ [...S.keys()].map((u) => u.split(".")[0]).filter((u) => !Ft.has(u))
1541
+ ), I = /* @__PURE__ */ new Set();
1542
+ for (const [u, v] of S) {
1543
+ const f = v.get("en"), N = v.get("pl"), C = (j) => new Set(Te(j == null ? void 0 : j.value).map(([O]) => O));
1544
+ if (f && !N && n({
1534
1545
  code: "i18n.polishMissing",
1535
- message: `${c}.en.i18n.json needs a .pl.i18n.json sibling (English and Polish are mandatory).`,
1546
+ message: `${u}.en.i18n.json needs a .pl.i18n.json sibling (English and Polish are mandatory).`,
1536
1547
  messageKey: "devStudio.issue.polishBundleMissing",
1537
- params: { group: c },
1548
+ params: { group: u },
1538
1549
  path: f.file.path
1539
- }), x && !f && n({
1550
+ }), N && !f && n({
1540
1551
  code: "i18n.englishMissing",
1541
- message: `${c}.pl.i18n.json needs an .en.i18n.json baseline.`,
1552
+ message: `${u}.pl.i18n.json needs an .en.i18n.json baseline.`,
1542
1553
  messageKey: "devStudio.issue.englishBundleMissing",
1543
- params: { group: c },
1544
- path: x.file.path
1545
- }), f && x) {
1546
- const I = A(f), D = A(x), S = [...I].filter(($) => !D.has($)), j = [...D].filter(($) => !I.has($));
1547
- S.length && n({
1554
+ params: { group: u },
1555
+ path: N.file.path
1556
+ }), f && N) {
1557
+ const j = C(f), O = C(N), w = [...j].filter((o) => !O.has(o)), E = [...O].filter((o) => !j.has(o));
1558
+ w.length && n({
1548
1559
  code: "i18n.keyMissing",
1549
- message: `${x.file.path} is missing ${S.length} key(s) of English: ${S.slice(0, 10).join(", ")}`,
1560
+ message: `${N.file.path} is missing ${w.length} key(s) of English: ${w.slice(0, 10).join(", ")}`,
1550
1561
  messageKey: "devStudio.issue.keysMissingPl",
1551
1562
  params: {
1552
- path: x.file.path,
1553
- count: S.length,
1554
- keys: S.slice(0, 10).join(", ")
1563
+ path: N.file.path,
1564
+ count: w.length,
1565
+ keys: w.slice(0, 10).join(", ")
1555
1566
  },
1556
- path: x.file.path
1557
- }), j.length && n({
1567
+ path: N.file.path
1568
+ }), E.length && n({
1558
1569
  code: "i18n.keyMissing",
1559
- message: `${f.file.path} is missing ${j.length} key(s) of Polish: ${j.slice(0, 10).join(", ")}`,
1570
+ message: `${f.file.path} is missing ${E.length} key(s) of Polish: ${E.slice(0, 10).join(", ")}`,
1560
1571
  messageKey: "devStudio.issue.keysMissingEn",
1561
1572
  params: {
1562
1573
  path: f.file.path,
1563
- count: j.length,
1564
- keys: j.slice(0, 10).join(", ")
1574
+ count: E.length,
1575
+ keys: E.slice(0, 10).join(", ")
1565
1576
  },
1566
1577
  path: f.file.path
1567
1578
  });
1568
1579
  }
1569
- for (const [I, D] of v) {
1570
- const S = Te(D.value), j = S.filter(([$]) => N.has($.split(".")[0])).map(([$]) => $);
1571
- if (j.length && n({
1580
+ for (const [j, O] of v) {
1581
+ const w = Te(O.value), E = w.filter(([o]) => T.has(o.split(".")[0])).map(([o]) => o);
1582
+ if (E.length && n({
1572
1583
  severity: "warning",
1573
1584
  code: "i18n.fileKey",
1574
- message: `${D.file.path}: nothing reads keys named after the bundle file — use module./entity./field./view. keys (${j.slice(0, 5).join(", ")}).`,
1585
+ message: `${O.file.path}: nothing reads keys named after the bundle file — use module./entity./field./view. keys (${E.slice(0, 5).join(", ")}).`,
1575
1586
  messageKey: "devStudio.issue.fileKey",
1576
- params: { path: D.file.path, keys: j.slice(0, 5).join(", ") },
1577
- path: D.file.path
1578
- }), I === "en")
1579
- for (const [$, O] of S) {
1580
- E.add($);
1581
- const a = $.split(".")[0];
1582
- ["module", "entity", "field", "view"].includes(a) && typeof O == "string" && re(O) && n({
1587
+ params: { path: O.file.path, keys: E.slice(0, 5).join(", ") },
1588
+ path: O.file.path
1589
+ }), j === "en")
1590
+ for (const [o, c] of w) {
1591
+ I.add(o);
1592
+ const y = o.split(".")[0];
1593
+ ["module", "entity", "field", "view"].includes(y) && typeof c == "string" && re(c) && n({
1583
1594
  code: "i18n.polishInEnglish",
1584
- message: `${D.file.path}: ${$} = "${O}" — the English bundle is the English UI.`,
1595
+ message: `${O.file.path}: ${o} = "${c}" — the English bundle is the English UI.`,
1585
1596
  messageKey: "devStudio.issue.polishInEnglish",
1586
- params: { path: D.file.path, key: $, text: O },
1587
- path: D.file.path
1597
+ params: { path: O.file.path, key: o, text: c },
1598
+ path: O.file.path
1588
1599
  });
1589
1600
  }
1590
1601
  }
1591
1602
  }
1592
- if (l.length && C.length) {
1603
+ if (l.length && A.length) {
1593
1604
  const v = [
1594
1605
  "module.displayName",
1595
1606
  ...d.map((f) => `entity.${f}.displayName`),
1596
- ...m.map((f) => `${f}.displayName`),
1597
- ...b.map((f) => `view.${f}.displayName`)
1607
+ ...p.map((f) => `${f}.displayName`),
1608
+ ...k.map((f) => `view.${f}.displayName`)
1598
1609
  ].filter(
1599
- (f) => !E.has(f) && !(f.startsWith("field.") && E.has(`${f.slice(0, -12)}.label`))
1610
+ (f) => !I.has(f) && !(f.startsWith("field.") && I.has(`${f.slice(0, -12)}.label`))
1600
1611
  );
1601
1612
  v.length && n({
1602
1613
  code: "i18n.labelMissing",
@@ -1605,63 +1616,87 @@ function qt(e, i = {}) {
1605
1616
  params: { count: v.length, keys: v.slice(0, 10).join(", ") }
1606
1617
  });
1607
1618
  }
1608
- for (const { file: c, value: v } of s)
1619
+ for (const { file: u, value: v } of s)
1609
1620
  de(
1610
1621
  v,
1611
1622
  void 0,
1612
1623
  "",
1613
- (f, x, A) => n({
1624
+ (f, N, C) => n({
1614
1625
  code: "icons.emoji",
1615
- message: `${x} = "${A}": icon fields take an Ntd* name and column headers are words, never emoji.`,
1626
+ message: `${N} = "${C}": icon fields take an Ntd* name and column headers are words, never emoji.`,
1616
1627
  messageKey: "devStudio.issue.iconsEmoji",
1617
- params: { key: x, text: A },
1618
- path: c.path,
1628
+ params: { key: N, text: C },
1629
+ path: u.path,
1619
1630
  pointer: f
1620
1631
  })
1621
1632
  );
1622
- return o;
1633
+ const b = r(".datasources.json");
1634
+ if (b.length && l.length) {
1635
+ const u = /* @__PURE__ */ new Set();
1636
+ for (const { value: f } of b) {
1637
+ const N = Array.isArray(f) ? f : f == null ? void 0 : f.dataSources;
1638
+ for (const C of Array.isArray(N) ? N : []) {
1639
+ const j = (C == null ? void 0 : C.key) ?? (C == null ? void 0 : C.name);
1640
+ typeof j == "string" && u.add(j);
1641
+ }
1642
+ }
1643
+ const v = (D = l[0].value) == null ? void 0 : D.dataSources;
1644
+ (Array.isArray(v) ? v : []).forEach((f, N) => {
1645
+ const C = (f == null ? void 0 : f.key) ?? (f == null ? void 0 : f.name);
1646
+ typeof C == "string" && !u.has(C) && n({
1647
+ severity: "warning",
1648
+ code: "dataSources.undefined",
1649
+ message: `The manifest lists the data source "${C}", which no *.datasources.json defines.`,
1650
+ messageKey: "devStudio.issue.dataSourceUndefined",
1651
+ params: { key: C },
1652
+ path: l[0].file.path,
1653
+ pointer: `/dataSources/${N}`
1654
+ });
1655
+ });
1656
+ }
1657
+ return a;
1623
1658
  }
1624
- function de(e, i, t, o) {
1659
+ function de(e, i, t, a) {
1625
1660
  if (Array.isArray(e)) {
1626
- e.forEach((n, s) => de(n, i, `${t}/${s}`, o));
1661
+ e.forEach((n, s) => de(n, i, `${t}/${s}`, a));
1627
1662
  return;
1628
1663
  }
1629
- if (K(e))
1664
+ if (M(e))
1630
1665
  for (const [n, s] of Object.entries(e)) {
1631
1666
  const r = `${t}/${n}`;
1632
- if ((n === "icon" || n === "iconName" || n === "entityIcon" || n === "name" && i === "icon" || i === "cardIcon" || (n === "header" || n === "displayName" && i === "columns")) && typeof s == "string" && Pt(s) && o(r, n, s), n === "optionsJson" && typeof s == "string")
1667
+ if ((n === "icon" || n === "iconName" || n === "entityIcon" || n === "name" && i === "icon" || i === "cardIcon" || (n === "header" || n === "displayName" && i === "columns")) && typeof s == "string" && Rt(s) && a(r, n, s), n === "optionsJson" && typeof s == "string")
1633
1668
  try {
1634
- de(JSON.parse(s), "optionsJson", r, o);
1669
+ de(JSON.parse(s), "optionsJson", r, a);
1635
1670
  } catch {
1636
1671
  }
1637
- de(s, n, r, o);
1672
+ de(s, n, r, a);
1638
1673
  }
1639
1674
  }
1640
- function Vt(e, i = {}) {
1641
- const t = [], o = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
1675
+ function Ut(e, i = {}) {
1676
+ const t = [], a = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
1642
1677
  for (const r of e)
1643
1678
  for (const l of r.files) {
1644
1679
  if (!ve(l.path) || !oe(l.path, ".json"))
1645
1680
  continue;
1646
- let y;
1681
+ let h;
1647
1682
  try {
1648
- y = _(l.text).value;
1683
+ h = _(l.text).value;
1649
1684
  } catch {
1650
1685
  continue;
1651
1686
  }
1652
- if (oe(l.path, ".manifest.json") && K(y) && typeof y.packageName == "string" && y.packageName) {
1653
- const d = y.packageName.toLowerCase();
1654
- o.set(d, [...o.get(d) ?? [], r.location]);
1687
+ if (oe(l.path, ".manifest.json") && M(h) && typeof h.packageName == "string" && h.packageName) {
1688
+ const d = h.packageName.toLowerCase();
1689
+ a.set(d, [...a.get(d) ?? [], r.location]);
1655
1690
  }
1656
1691
  if (oe(l.path, ".entities.json") && r.group) {
1657
- for (const d of ee(y, "entities"))
1658
- if (K(d) && typeof d.name == "string" && d.name) {
1659
- const m = `${r.group}/${d.name}`.toLowerCase(), b = n.get(m) ?? [];
1660
- b.includes(r.location) || n.set(m, [...b, r.location]);
1692
+ for (const d of ee(h, "entities"))
1693
+ if (M(d) && typeof d.name == "string" && d.name) {
1694
+ const p = `${r.group}/${d.name}`.toLowerCase(), k = n.get(p) ?? [];
1695
+ k.includes(r.location) || n.set(p, [...k, r.location]);
1661
1696
  }
1662
1697
  }
1663
1698
  }
1664
- for (const [r, l] of o)
1699
+ for (const [r, l] of a)
1665
1700
  l.length > 1 && t.push({
1666
1701
  severity: "error",
1667
1702
  code: "workspace.packageName",
@@ -1680,7 +1715,7 @@ function Vt(e, i = {}) {
1680
1715
  });
1681
1716
  return t;
1682
1717
  }
1683
- const te = (e) => typeof e == "object" && e !== null && !Array.isArray(e), Q = (e) => typeof e == "string" && e ? e : void 0, Ut = /* @__PURE__ */ new Set([
1718
+ const te = (e) => typeof e == "object" && e !== null && !Array.isArray(e), Q = (e) => typeof e == "string" && e ? e : void 0, Wt = /* @__PURE__ */ new Set([
1684
1719
  "slug",
1685
1720
  "category",
1686
1721
  "subCategory",
@@ -1691,20 +1726,20 @@ const te = (e) => typeof e == "object" && e !== null && !Array.isArray(e), Q = (
1691
1726
  "translations",
1692
1727
  "modules"
1693
1728
  ]);
1694
- function Ue(e) {
1729
+ function We(e) {
1695
1730
  if (Array.isArray(e))
1696
1731
  return e.filter((i) => typeof i == "string");
1697
1732
  if (typeof e == "string")
1698
1733
  return e.split(",").map((i) => i.trim()).filter(Boolean);
1699
1734
  }
1700
- function We(e) {
1735
+ function Ge(e) {
1701
1736
  const i = {};
1702
- for (const [t, o] of Object.entries(te(e) ? e : {}))
1703
- te(o) && (i[t] = { ...o, name: String(o.name ?? "") });
1737
+ for (const [t, a] of Object.entries(te(e) ? e : {}))
1738
+ te(a) && (i[t] = { ...a, name: String(a.name ?? "") });
1704
1739
  return i;
1705
1740
  }
1706
- function Wt(e, i) {
1707
- const t = te(e) ? e : {}, o = Object.fromEntries(Object.entries(t).filter(([n]) => !Ut.has(n)));
1741
+ function Gt(e, i) {
1742
+ const t = te(e) ? e : {}, a = Object.fromEntries(Object.entries(t).filter(([n]) => !Wt.has(n)));
1708
1743
  return {
1709
1744
  id: String(t.slug ?? ""),
1710
1745
  category: Q(t.category),
@@ -1712,30 +1747,30 @@ function Wt(e, i) {
1712
1747
  parentId: Q(t.parentSlug),
1713
1748
  icon: Q(t.icon),
1714
1749
  sortOrder: typeof t.sortOrder == "number" ? t.sortOrder : void 0,
1715
- tags: Ue(t.tags),
1716
- translations: We(t.translations),
1750
+ tags: We(t.tags),
1751
+ translations: Ge(t.translations),
1717
1752
  modules: (Array.isArray(t.modules) ? t.modules : []).filter(te).map((n) => ({
1718
1753
  moduleId: String(n.packageName ?? ""),
1719
1754
  required: n.required === !0,
1720
1755
  condition: Q(n.condition),
1721
1756
  description: Q(n.description)
1722
1757
  })),
1723
- ...Object.keys(o).length ? { extra: o } : {},
1758
+ ...Object.keys(a).length ? { extra: a } : {},
1724
1759
  ...i ? { readOnly: i } : {}
1725
1760
  };
1726
1761
  }
1727
1762
  const $e = (e) => Object.fromEntries(Object.entries(e).filter(([, i]) => i !== void 0));
1728
1763
  function xe(e, i) {
1729
1764
  var l;
1730
- const t = te(i) ? i : {}, o = (Array.isArray(t.modules) ? t.modules : []).filter(te), s = JSON.stringify(Ue(t.tags) ?? []) === JSON.stringify(e.tags ?? []) ? t.tags : (l = e.tags) != null && l.length ? typeof t.tags == "string" ? e.tags.join(",") : e.tags : void 0, r = (y) => {
1731
- const d = o.find((m) => m.packageName === y.moduleId);
1765
+ const t = te(i) ? i : {}, a = (Array.isArray(t.modules) ? t.modules : []).filter(te), s = JSON.stringify(We(t.tags) ?? []) === JSON.stringify(e.tags ?? []) ? t.tags : (l = e.tags) != null && l.length ? typeof t.tags == "string" ? e.tags.join(",") : e.tags : void 0, r = (h) => {
1766
+ const d = a.find((p) => p.packageName === h.moduleId);
1732
1767
  return $e({
1733
1768
  ...d,
1734
- packageName: y.moduleId,
1769
+ packageName: h.moduleId,
1735
1770
  // seed entries spell `required` out, also when it is false
1736
- required: y.required === !0 ? !0 : !d || "required" in d ? !1 : void 0,
1737
- condition: y.condition || void 0,
1738
- description: y.description || void 0
1771
+ required: h.required === !0 ? !0 : !d || "required" in d ? !1 : void 0,
1772
+ condition: h.condition || void 0,
1773
+ description: h.description || void 0
1739
1774
  });
1740
1775
  };
1741
1776
  return $e({
@@ -1753,12 +1788,12 @@ function xe(e, i) {
1753
1788
  });
1754
1789
  }
1755
1790
  function Ie(e, i = "en") {
1756
- const t = We(e.translations);
1791
+ const t = Ge(e.translations);
1757
1792
  Object.keys(t).length === 0 && e.name && (t[i] = {
1758
1793
  name: e.name,
1759
1794
  ...e.description ? { description: e.description } : {}
1760
1795
  });
1761
- const o = $e({
1796
+ const a = $e({
1762
1797
  isActive: e.isActive,
1763
1798
  compliance: e.compliance,
1764
1799
  defaultLanguage: e.defaultLanguage ?? void 0,
@@ -1779,11 +1814,11 @@ function Ie(e, i = "en") {
1779
1814
  condition: n.condition ?? void 0,
1780
1815
  description: n.description ?? void 0
1781
1816
  })),
1782
- extra: o,
1817
+ extra: a,
1783
1818
  readOnly: e.source === "seed" || e.source === "code"
1784
1819
  };
1785
1820
  }
1786
- function Gt(e) {
1821
+ function _t(e) {
1787
1822
  const i = e.extra ?? {};
1788
1823
  return {
1789
1824
  slug: e.id,
@@ -1803,528 +1838,528 @@ function Gt(e) {
1803
1838
  ...typeof i.defaultLanguage == "string" ? { defaultLanguage: i.defaultLanguage } : {}
1804
1839
  };
1805
1840
  }
1806
- const F = (...e) => e.filter(Boolean).join("/"), _t = (e) => e.slice(0, Math.max(0, e.lastIndexOf("/"))), Bt = (e) => e.slice(e.lastIndexOf("/") + 1), me = (e) => typeof e == "object" && e !== null && !Array.isArray(e), ie = (e) => typeof e == "string" && e ? e : void 0, zt = /* @__PURE__ */ new Set(["bin", "obj", "node_modules"]), ue = (e) => e.startsWith(".") || zt.has(e), Jt = /^wizard-templates-.+\.seed\.json$/i, Ht = /^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})(\d{3})Z$/;
1841
+ const F = (...e) => e.filter(Boolean).join("/"), Bt = (e) => e.slice(0, Math.max(0, e.lastIndexOf("/"))), zt = (e) => e.slice(e.lastIndexOf("/") + 1), me = (e) => typeof e == "object" && e !== null && !Array.isArray(e), ie = (e) => typeof e == "string" && e ? e : void 0, Jt = /* @__PURE__ */ new Set(["bin", "obj", "node_modules"]), ue = (e) => e.startsWith(".") || Jt.has(e), Ht = /^wizard-templates-.+\.seed\.json$/i, Zt = /^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})(\d{3})Z$/;
1807
1842
  function fe(e) {
1808
- const i = (t, o = 2) => String(t).padStart(o, "0");
1843
+ const i = (t, a = 2) => String(t).padStart(a, "0");
1809
1844
  return `${e.getUTCFullYear()}${i(e.getUTCMonth() + 1)}${i(e.getUTCDate())}T${i(e.getUTCHours())}${i(e.getUTCMinutes())}${i(e.getUTCSeconds())}${i(e.getUTCMilliseconds(), 3)}Z`;
1810
1845
  }
1811
- function Zt(e) {
1812
- const i = Ht.exec(e);
1846
+ function Yt(e) {
1847
+ const i = Zt.exec(e);
1813
1848
  return i ? Date.UTC(+i[1], +i[2] - 1, +i[3], +i[4], +i[5], +i[6], +i[7]) : void 0;
1814
1849
  }
1815
- const Yt = (e, i) => F(_t(e), ".revisions", `${Bt(e)}.${i}`), Xt = (e) => e.normalize("NFKD").replace(/[̀-ͯ]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "custom";
1816
- function oi(e) {
1817
- const { roots: i } = e, t = e.revisions !== !1, o = e.now ?? (() => /* @__PURE__ */ new Date()), n = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
1850
+ const Xt = (e, i) => F(Bt(e), ".revisions", `${zt(e)}.${i}`), Qt = (e) => e.normalize("NFKD").replace(/[̀-ͯ]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "custom";
1851
+ function ai(e) {
1852
+ const { roots: i } = e, t = e.revisions !== !1, a = e.now ?? (() => /* @__PURE__ */ new Date()), n = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
1818
1853
  let r = null;
1819
- const l = (a) => {
1820
- const p = i.find((g) => g.id === a);
1821
- if (!p)
1822
- throw new Error(`Unknown workspace "${a}"`);
1823
- return p;
1824
- }, y = (a) => {
1825
- const p = l(a);
1826
- if (p.readOnly)
1827
- throw new Error(`Workspace "${p.label}" is read-only`);
1828
- return p;
1854
+ const l = (o) => {
1855
+ const c = i.find((y) => y.id === o);
1856
+ if (!c)
1857
+ throw new Error(`Unknown workspace "${o}"`);
1858
+ return c;
1859
+ }, h = (o) => {
1860
+ const c = l(o);
1861
+ if (c.readOnly)
1862
+ throw new Error(`Workspace "${c.label}" is read-only`);
1863
+ return c;
1829
1864
  };
1830
- async function d(a, p) {
1831
- const g = await a.read(p);
1865
+ async function d(o, c) {
1866
+ const y = await o.read(c);
1832
1867
  try {
1833
- const h = g ? _(g.text).value : void 0;
1834
- return me(h) ? h : {};
1868
+ const g = y ? _(y.text).value : void 0;
1869
+ return me(g) ? g : {};
1835
1870
  } catch {
1836
1871
  return {};
1837
1872
  }
1838
1873
  }
1839
- function m(a, p, g, h, T) {
1840
- const u = ie(h.packageName) ?? (p || a.id);
1874
+ function p(o, c, y, g, x) {
1875
+ const m = ie(g.packageName) ?? (c || o.id);
1841
1876
  return {
1842
- workspaceId: a.id,
1843
- id: u,
1844
- packageId: ie(h.category),
1845
- label: ie(h.displayName) ?? u,
1846
- description: ie(h.description),
1847
- version: ie(h.version),
1848
- location: p,
1849
- readOnly: a.readOnly,
1850
- files: T,
1851
- search: `${p} ${g}`
1877
+ workspaceId: o.id,
1878
+ id: m,
1879
+ packageId: ie(g.category),
1880
+ label: ie(g.displayName) ?? m,
1881
+ description: ie(g.description),
1882
+ version: ie(g.version),
1883
+ location: c,
1884
+ readOnly: o.readOnly,
1885
+ files: x,
1886
+ search: `${c} ${y}`
1852
1887
  };
1853
1888
  }
1854
- async function b(a) {
1855
- const p = /* @__PURE__ */ new Map(), g = async (h) => {
1856
- const T = await a.fs.list(h), u = T.filter((w) => w.kind === "file" && w.name.toLowerCase().endsWith(".manifest.json")).map((w) => w.name).sort()[0];
1857
- if (u) {
1858
- const w = T.filter((M) => M.kind === "file").map((M) => M.name), L = m(
1859
- a,
1860
- h,
1861
- u,
1862
- await d(a.fs, F(h, u)),
1863
- w
1889
+ async function k(o) {
1890
+ const c = /* @__PURE__ */ new Map(), y = async (g) => {
1891
+ const x = await o.fs.list(g), m = x.filter(($) => $.kind === "file" && $.name.toLowerCase().endsWith(".manifest.json")).map(($) => $.name).sort()[0];
1892
+ if (m) {
1893
+ const $ = x.filter((K) => K.kind === "file").map((K) => K.name), L = p(
1894
+ o,
1895
+ g,
1896
+ m,
1897
+ await d(o.fs, F(g, m)),
1898
+ $
1864
1899
  );
1865
- p.has(L.id.toLowerCase()) || (p.set(L.id.toLowerCase(), { ref: L, dir: h }), s.set(`${a.id}:${L.id.toLowerCase()}`, h));
1900
+ c.has(L.id.toLowerCase()) || (c.set(L.id.toLowerCase(), { ref: L, dir: g }), s.set(`${o.id}:${L.id.toLowerCase()}`, g));
1866
1901
  }
1867
- for (const w of T)
1868
- w.kind === "directory" && !ue(w.name) && !(h === "" && w.name === C(a)) && await g(F(h, w.name));
1902
+ for (const $ of x)
1903
+ $.kind === "directory" && !ue($.name) && !(g === "" && $.name === A(o)) && await y(F(g, $.name));
1869
1904
  };
1870
- return await g(""), p;
1905
+ return await y(""), c;
1871
1906
  }
1872
- const C = (a) => a.templatesDir === !1 ? void 0 : a.templatesDir ?? "Templates", k = (a) => {
1873
- n.delete(a.id), S.clear();
1874
- }, N = (a) => {
1875
- let p = n.get(a.id);
1876
- return p || (p = b(a), n.set(a.id, p), p.catch(() => n.delete(a.id))), p;
1907
+ const A = (o) => o.templatesDir === !1 ? void 0 : o.templatesDir ?? "Templates", S = (o) => {
1908
+ n.delete(o.id), j.clear();
1909
+ }, T = (o) => {
1910
+ let c = n.get(o.id);
1911
+ return c || (c = k(o), n.set(o.id, c), c.catch(() => n.delete(o.id))), c;
1877
1912
  };
1878
- async function E(a) {
1879
- const p = l(a.workspaceId), g = await N(p), h = s.get(`${p.id}:${a.id.toLowerCase()}`), T = g.get(a.id.toLowerCase()) ?? (h === void 0 ? void 0 : [...g.values()].find((u) => u.dir === h));
1880
- if (!T)
1881
- throw new Error(`Module "${a.id}" is not in "${p.label}"`);
1882
- return { root: p, module: T };
1913
+ async function I(o) {
1914
+ const c = l(o.workspaceId), y = await T(c), g = s.get(`${c.id}:${o.id.toLowerCase()}`), x = y.get(o.id.toLowerCase()) ?? (g === void 0 ? void 0 : [...y.values()].find((m) => m.dir === g));
1915
+ if (!x)
1916
+ throw new Error(`Module "${o.id}" is not in "${c.label}"`);
1917
+ return { root: c, module: x };
1883
1918
  }
1884
- async function c(a, p) {
1885
- const g = [], h = async (T, u) => {
1886
- const w = await a.list(F(p, T));
1887
- if (!(u && w.some((L) => L.kind === "file" && L.name.toLowerCase().endsWith(".manifest.json"))))
1888
- for (const L of w)
1889
- L.kind === "file" ? g.push(F(T, L.name)) : ue(L.name) || await h(F(T, L.name), !0);
1919
+ async function b(o, c) {
1920
+ const y = [], g = async (x, m) => {
1921
+ const $ = await o.list(F(c, x));
1922
+ if (!(m && $.some((L) => L.kind === "file" && L.name.toLowerCase().endsWith(".manifest.json"))))
1923
+ for (const L of $)
1924
+ L.kind === "file" ? y.push(F(x, L.name)) : ue(L.name) || await g(F(x, L.name), !0);
1890
1925
  };
1891
- return await h("", !1), g.sort();
1926
+ return await g("", !1), y.sort();
1892
1927
  }
1893
- async function v(a, p, g, h) {
1894
- t && await a.write(Yt(p, h), g);
1928
+ async function D(o, c, y, g) {
1929
+ t && await o.write(Xt(c, g), y);
1895
1930
  }
1896
- async function f(a, p) {
1897
- const g = [], h = async (T) => {
1898
- const u = await a.list(F(p, T));
1899
- for (const w of u)
1900
- if (w.kind === "directory" && w.name === ".revisions")
1901
- for (const L of await a.list(F(p, T, w.name))) {
1902
- const M = /^(.*)\.(\d{8}T\d{9}Z)$/.exec(L.name);
1903
- L.kind === "file" && M && g.push({
1904
- path: F(T, M[1]),
1905
- stamp: M[2],
1906
- at: F(T, ".revisions", L.name)
1931
+ async function u(o, c) {
1932
+ const y = [], g = async (x) => {
1933
+ const m = await o.list(F(c, x));
1934
+ for (const $ of m)
1935
+ if ($.kind === "directory" && $.name === ".revisions")
1936
+ for (const L of await o.list(F(c, x, $.name))) {
1937
+ const K = /^(.*)\.(\d{8}T\d{9}Z)$/.exec(L.name);
1938
+ L.kind === "file" && K && y.push({
1939
+ path: F(x, K[1]),
1940
+ stamp: K[2],
1941
+ at: F(x, ".revisions", L.name)
1907
1942
  });
1908
1943
  }
1909
- else w.kind === "directory" && !ue(w.name) && await h(F(T, w.name));
1944
+ else $.kind === "directory" && !ue($.name) && await g(F(x, $.name));
1910
1945
  };
1911
- return await h(""), g;
1946
+ return await g(""), y;
1912
1947
  }
1913
- async function x(a) {
1914
- const p = C(a);
1915
- return p ? (await a.fs.list(p)).filter((g) => g.kind === "file" && Jt.test(g.name)).map((g) => F(p, g.name)).sort() : [];
1948
+ async function v(o) {
1949
+ const c = A(o);
1950
+ return c ? (await o.fs.list(c)).filter((y) => y.kind === "file" && Ht.test(y.name)).map((y) => F(c, y.name)).sort() : [];
1916
1951
  }
1917
- async function A(a, p) {
1918
- const g = await a.fs.read(p);
1919
- if (!g)
1952
+ async function f(o, c) {
1953
+ const y = await o.fs.read(c);
1954
+ if (!y)
1920
1955
  return { text: "", entries: [] };
1921
- const h = _(g.text).value;
1922
- return { text: g.text, entries: Array.isArray(h) ? h : [] };
1956
+ const g = _(y.text).value;
1957
+ return { text: y.text, entries: Array.isArray(g) ? g : [] };
1923
1958
  }
1924
- const I = {
1925
- arrayKey: (a) => a === "" ? "slug" : a.endsWith("/modules") ? "packageName" : void 0
1959
+ const N = {
1960
+ arrayKey: (o) => o === "" ? "slug" : o.endsWith("/modules") ? "packageName" : void 0
1926
1961
  };
1927
- async function D(a, p, g, h) {
1928
- if (g && await v(a.fs, p, g, fe(o())), h.length === 0) {
1929
- await a.fs.remove(p);
1962
+ async function C(o, c, y, g) {
1963
+ if (y && await D(o.fs, c, y, fe(a())), g.length === 0) {
1964
+ await o.fs.remove(c);
1930
1965
  return;
1931
1966
  }
1932
- await a.fs.write(
1933
- p,
1934
- g ? Me(g, h, I) : ae(h)
1967
+ await o.fs.write(
1968
+ c,
1969
+ y ? De(y, g, N) : ae(g)
1935
1970
  );
1936
1971
  }
1937
- const S = /* @__PURE__ */ new Map();
1938
- function j(a, p) {
1939
- const g = `${a.id}:${p.dir}`;
1940
- let h = S.get(g);
1941
- if (!h) {
1942
- const T = (p.ref.files ?? []).filter((u) => /\.(manifest|entities)\.json$/i.test(u));
1943
- h = Promise.all(
1944
- T.map(async (u) => {
1945
- var w;
1972
+ const j = /* @__PURE__ */ new Map();
1973
+ function O(o, c) {
1974
+ const y = `${o.id}:${c.dir}`;
1975
+ let g = j.get(y);
1976
+ if (!g) {
1977
+ const x = (c.ref.files ?? []).filter((m) => /\.(manifest|entities)\.json$/i.test(m));
1978
+ g = Promise.all(
1979
+ x.map(async (m) => {
1980
+ var $;
1946
1981
  return {
1947
- path: u,
1948
- text: ((w = await a.fs.read(F(p.dir, u))) == null ? void 0 : w.text) ?? ""
1982
+ path: m,
1983
+ text: (($ = await o.fs.read(F(c.dir, m))) == null ? void 0 : $.text) ?? ""
1949
1984
  };
1950
1985
  })
1951
- ).then((u) => ({ location: p.dir, group: p.dir.split("/")[0], files: u })), S.set(g, h);
1986
+ ).then((m) => ({ location: c.dir, group: c.dir.split("/")[0], files: m })), j.set(y, g);
1952
1987
  }
1953
- return h;
1988
+ return g;
1954
1989
  }
1955
- async function $(a) {
1956
- var p;
1957
- return r || await ((p = O.listTemplates) == null ? void 0 : p.call(O)), r == null ? void 0 : r.get(a.toLowerCase());
1990
+ async function w(o) {
1991
+ var c;
1992
+ return r || await ((c = E.listTemplates) == null ? void 0 : c.call(E)), r == null ? void 0 : r.get(o.toLowerCase());
1958
1993
  }
1959
- const O = {
1994
+ const E = {
1960
1995
  invalidate() {
1961
- n.clear(), S.clear(), r = null;
1996
+ n.clear(), j.clear(), r = null;
1962
1997
  },
1963
1998
  async listWorkspaces() {
1964
- return i.map((a) => ({
1965
- id: a.id,
1966
- label: a.label,
1967
- ...a.description ? { description: a.description } : {},
1968
- ...a.icon ? { icon: a.icon } : {},
1969
- ...a.readOnly ? { readOnly: !0 } : {}
1999
+ return i.map((o) => ({
2000
+ id: o.id,
2001
+ label: o.label,
2002
+ ...o.description ? { description: o.description } : {},
2003
+ ...o.icon ? { icon: o.icon } : {},
2004
+ ...o.readOnly ? { readOnly: !0 } : {}
1970
2005
  }));
1971
2006
  },
1972
- async listModules(a) {
1973
- const p = i.findIndex((u) => u.id === a), g = l(a);
1974
- k(g);
1975
- const h = await N(g), T = await Promise.all(
1976
- i.slice(0, p).map(async (u) => ({ r: u, modules: await N(u) }))
2007
+ async listModules(o) {
2008
+ const c = i.findIndex((m) => m.id === o), y = l(o);
2009
+ S(y);
2010
+ const g = await T(y), x = await Promise.all(
2011
+ i.slice(0, c).map(async (m) => ({ r: m, modules: await T(m) }))
1977
2012
  );
1978
- return [...h.values()].map(({ ref: u }) => {
1979
- const w = T.find((L) => L.modules.has(u.id.toLowerCase()));
1980
- return w ? { ...u, shadowedBy: w.r.id } : u;
1981
- }).sort((u, w) => u.id.localeCompare(w.id));
2013
+ return [...g.values()].map(({ ref: m }) => {
2014
+ const $ = x.find((L) => L.modules.has(m.id.toLowerCase()));
2015
+ return $ ? { ...m, shadowedBy: $.r.id } : m;
2016
+ }).sort((m, $) => m.id.localeCompare($.id));
1982
2017
  },
1983
- async readModule(a) {
1984
- const { root: p, module: g } = await E(a), h = await c(p.fs, g.dir), T = [];
1985
- for (const u of h) {
1986
- const w = await p.fs.read(F(g.dir, u));
1987
- w && T.push({
1988
- path: u,
1989
- text: w.text,
1990
- version: w.version,
1991
- ...p.readOnly ? { readOnly: !0 } : {}
2018
+ async readModule(o) {
2019
+ const { root: c, module: y } = await I(o), g = await b(c.fs, y.dir), x = [];
2020
+ for (const m of g) {
2021
+ const $ = await c.fs.read(F(y.dir, m));
2022
+ $ && x.push({
2023
+ path: m,
2024
+ text: $.text,
2025
+ version: $.version,
2026
+ ...c.readOnly ? { readOnly: !0 } : {}
1992
2027
  });
1993
2028
  }
1994
- return T;
2029
+ return x;
1995
2030
  },
1996
- async writeModule(a, p) {
1997
- const { module: g } = await E(a), h = y(a.workspaceId), T = /* @__PURE__ */ new Map(), u = [];
1998
- for (const M of p) {
1999
- if (M.path.split("/").some((Y) => Y === ".." || Y === "" || Y.startsWith(".")))
2000
- throw new Error(`Refusing to write outside the module: ${M.path}`);
2001
- const R = await h.fs.read(F(g.dir, M.path));
2002
- T.set(M.path, R);
2003
- const B = M.baseVersion;
2004
- (B === void 0 ? R !== null && M.type === "write" : (R == null ? void 0 : R.version) !== B) && u.push({ path: M.path, ...R ? { currentVersion: R.version } : {} });
2031
+ async writeModule(o, c) {
2032
+ const { module: y } = await I(o), g = h(o.workspaceId), x = /* @__PURE__ */ new Map(), m = [];
2033
+ for (const K of c) {
2034
+ if (K.path.split("/").some((Y) => Y === ".." || Y === "" || Y.startsWith(".")))
2035
+ throw new Error(`Refusing to write outside the module: ${K.path}`);
2036
+ const R = await g.fs.read(F(y.dir, K.path));
2037
+ x.set(K.path, R);
2038
+ const z = K.baseVersion;
2039
+ (z === void 0 ? R !== null && K.type === "write" : (R == null ? void 0 : R.version) !== z) && m.push({ path: K.path, ...R ? { currentVersion: R.version } : {} });
2005
2040
  }
2006
- if (u.length)
2007
- return { ok: !1, conflicts: u };
2008
- const w = fe(o()), L = {};
2009
- for (const M of p) {
2010
- const R = F(g.dir, M.path), B = T.get(M.path);
2011
- B && await v(h.fs, R, B.text, w), M.type === "write" ? L[M.path] = await h.fs.write(R, M.text) : await h.fs.remove(R);
2041
+ if (m.length)
2042
+ return { ok: !1, conflicts: m };
2043
+ const $ = fe(a()), L = {};
2044
+ for (const K of c) {
2045
+ const R = F(y.dir, K.path), z = x.get(K.path);
2046
+ z && await D(g.fs, R, z.text, $), K.type === "write" ? L[K.path] = await g.fs.write(R, K.text) : await g.fs.remove(R);
2012
2047
  }
2013
- return k(h), { ok: !0, versions: L, revision: w };
2048
+ return S(g), { ok: !0, versions: L, revision: $ };
2014
2049
  },
2015
- async createModule(a) {
2016
- var u;
2017
- const p = y(a.workspaceId), g = a.id.startsWith(W) ? a.id.slice(W.length) : a.id.split(".").pop() ?? a.id, h = ((u = e.moduleFolder) == null ? void 0 : u.call(e, a)) ?? F(
2018
- P(a.packageId ?? "") || "Custom",
2019
- P(g) || "Module"
2050
+ async createModule(o) {
2051
+ var m;
2052
+ const c = h(o.workspaceId), y = o.id.startsWith(W) ? o.id.slice(W.length) : o.id.split(".").pop() ?? o.id, g = ((m = e.moduleFolder) == null ? void 0 : m.call(e, o)) ?? F(
2053
+ P(o.packageId ?? "") || "Custom",
2054
+ P(y) || "Module"
2020
2055
  );
2021
- if ((await p.fs.list(h)).length > 0)
2022
- throw new Error(`The folder ${h} is not empty`);
2023
- if ((await N(p)).has(a.id.toLowerCase()))
2024
- throw new Error(`"${a.id}" already exists in ${p.label}`);
2025
- for (const w of a.files)
2026
- await p.fs.write(F(h, w.path), w.text);
2027
- k(p);
2028
- const T = (await N(p)).get(a.id.toLowerCase());
2029
- if (!T)
2030
- throw new Error(`The new module ${a.id} has no manifest naming it`);
2031
- return T.ref;
2056
+ if ((await c.fs.list(g)).length > 0)
2057
+ throw new Error(`The folder ${g} is not empty`);
2058
+ if ((await T(c)).has(o.id.toLowerCase()))
2059
+ throw new Error(`"${o.id}" already exists in ${c.label}`);
2060
+ for (const $ of o.files)
2061
+ await c.fs.write(F(g, $.path), $.text);
2062
+ S(c);
2063
+ const x = (await T(c)).get(o.id.toLowerCase());
2064
+ if (!x)
2065
+ throw new Error(`The new module ${o.id} has no manifest naming it`);
2066
+ return x.ref;
2032
2067
  },
2033
- async deleteModule(a) {
2034
- const { module: p } = await E(a), g = y(a.workspaceId);
2035
- await g.fs.removeDir(p.dir), s.delete(`${g.id}:${a.id.toLowerCase()}`), k(g);
2068
+ async deleteModule(o) {
2069
+ const { module: c } = await I(o), y = h(o.workspaceId);
2070
+ await y.fs.removeDir(c.dir), s.delete(`${y.id}:${o.id.toLowerCase()}`), S(y);
2036
2071
  },
2037
2072
  async listTemplates() {
2038
- const a = /* @__PURE__ */ new Map(), p = [];
2039
- for (const g of i)
2040
- for (const h of await x(g)) {
2041
- let T;
2073
+ const o = /* @__PURE__ */ new Map(), c = [];
2074
+ for (const y of i)
2075
+ for (const g of await v(y)) {
2076
+ let x;
2042
2077
  try {
2043
- T = (await A(g, h)).entries;
2078
+ x = (await f(y, g)).entries;
2044
2079
  } catch {
2045
2080
  continue;
2046
2081
  }
2047
- for (const u of T) {
2048
- const w = Wt(u, g.readOnly);
2049
- w.id && !a.has(w.id.toLowerCase()) && (a.set(w.id.toLowerCase(), { rootId: g.id, path: h }), p.push(w));
2082
+ for (const m of x) {
2083
+ const $ = Gt(m, y.readOnly);
2084
+ $.id && !o.has($.id.toLowerCase()) && (o.set($.id.toLowerCase(), { rootId: y.id, path: g }), c.push($));
2050
2085
  }
2051
2086
  }
2052
- return r = a, p;
2087
+ return r = o, c;
2053
2088
  },
2054
- async saveTemplate(a, p) {
2055
- const g = (p == null ? void 0 : p.previousId) ?? a.id, h = await $(g);
2056
- if (h) {
2057
- const T = y(h.rootId), { text: u, entries: w } = await A(T, h.path), L = w.findIndex(
2058
- (R) => me(R) && String(R.slug ?? "").toLowerCase() === g.toLowerCase()
2059
- ), M = [...w];
2060
- M[L < 0 ? M.length : L] = xe(
2061
- a,
2062
- L < 0 ? void 0 : w[L]
2063
- ), await D(T, h.path, u, M);
2089
+ async saveTemplate(o, c) {
2090
+ const y = (c == null ? void 0 : c.previousId) ?? o.id, g = await w(y);
2091
+ if (g) {
2092
+ const x = h(g.rootId), { text: m, entries: $ } = await f(x, g.path), L = $.findIndex(
2093
+ (R) => me(R) && String(R.slug ?? "").toLowerCase() === y.toLowerCase()
2094
+ ), K = [...$];
2095
+ K[L < 0 ? K.length : L] = xe(
2096
+ o,
2097
+ L < 0 ? void 0 : $[L]
2098
+ ), await C(x, g.path, m, K);
2064
2099
  } else {
2065
- const T = i.find((M) => !M.readOnly && C(M));
2066
- if (!T)
2100
+ const x = i.find((K) => !K.readOnly && A(K));
2101
+ if (!x)
2067
2102
  throw new Error("No writable folder holds templates");
2068
- const u = F(
2069
- C(T),
2070
- `wizard-templates-${Xt(a.category ?? "custom")}.seed.json`
2071
- ), { text: w, entries: L } = await A(T, u);
2072
- await D(T, u, w, [...L, xe(a)]);
2103
+ const m = F(
2104
+ A(x),
2105
+ `wizard-templates-${Qt(o.category ?? "custom")}.seed.json`
2106
+ ), { text: $, entries: L } = await f(x, m);
2107
+ await C(x, m, $, [...L, xe(o)]);
2073
2108
  }
2074
- return r = null, { ...a, extra: a.extra };
2109
+ return r = null, { ...o, extra: o.extra };
2075
2110
  },
2076
- async deleteTemplate(a) {
2077
- const p = await $(a);
2078
- if (!p)
2111
+ async deleteTemplate(o) {
2112
+ const c = await w(o);
2113
+ if (!c)
2079
2114
  return;
2080
- const g = y(p.rootId), { text: h, entries: T } = await A(g, p.path);
2081
- await D(
2115
+ const y = h(c.rootId), { text: g, entries: x } = await f(y, c.path);
2116
+ await C(
2117
+ y,
2118
+ c.path,
2082
2119
  g,
2083
- p.path,
2084
- h,
2085
- T.filter(
2086
- (u) => !(me(u) && String(u.slug ?? "").toLowerCase() === a.toLowerCase())
2120
+ x.filter(
2121
+ (m) => !(me(m) && String(m.slug ?? "").toLowerCase() === o.toLowerCase())
2087
2122
  )
2088
2123
  ), r = null;
2089
2124
  },
2090
- async validate(a, p) {
2091
- const g = l(a.workspaceId), h = [...(await N(g)).values()], T = await Promise.all(
2092
- h.filter((L) => L.ref.id.toLowerCase() !== a.id.toLowerCase()).map((L) => j(g, L))
2093
- ), u = h.find((L) => L.ref.id.toLowerCase() === a.id.toLowerCase()), w = (u == null ? void 0 : u.dir) ?? a.id;
2094
- return Vt(
2095
- [...T, { location: w, group: w.split("/")[0], files: p }],
2125
+ async validate(o, c) {
2126
+ const y = l(o.workspaceId), g = [...(await T(y)).values()], x = await Promise.all(
2127
+ g.filter((L) => L.ref.id.toLowerCase() !== o.id.toLowerCase()).map((L) => O(y, L))
2128
+ ), m = g.find((L) => L.ref.id.toLowerCase() === o.id.toLowerCase()), $ = (m == null ? void 0 : m.dir) ?? o.id;
2129
+ return Ut(
2130
+ [...x, { location: $, group: $.split("/")[0], files: c }],
2096
2131
  {
2097
2132
  knownDuplicates: e.knownDuplicates
2098
2133
  }
2099
- ).filter((L) => L.message.split(/[ ,]+/).includes(w));
2134
+ ).filter((L) => L.message.split(/[ ,]+/).includes($));
2100
2135
  },
2101
- async listRevisions(a, p) {
2102
- const { root: g, module: h } = await E(a), T = (await f(g.fs, h.dir)).filter(
2103
- (w) => !p || w.path === p
2104
- ), u = /* @__PURE__ */ new Map();
2105
- for (const w of T)
2106
- u.set(w.stamp, [...u.get(w.stamp) ?? [], w.path]);
2107
- return [...u].map(([w, L]) => ({
2108
- id: w,
2109
- timestamp: Zt(w) ?? 0,
2136
+ async listRevisions(o, c) {
2137
+ const { root: y, module: g } = await I(o), x = (await u(y.fs, g.dir)).filter(
2138
+ ($) => !c || $.path === c
2139
+ ), m = /* @__PURE__ */ new Map();
2140
+ for (const $ of x)
2141
+ m.set($.stamp, [...m.get($.stamp) ?? [], $.path]);
2142
+ return [...m].map(([$, L]) => ({
2143
+ id: $,
2144
+ timestamp: Yt($) ?? 0,
2110
2145
  summary: L.sort().join(", "),
2111
- ...p ? { path: p } : {}
2112
- })).sort((w, L) => L.timestamp - w.timestamp);
2146
+ ...c ? { path: c } : {}
2147
+ })).sort(($, L) => L.timestamp - $.timestamp);
2113
2148
  },
2114
- async readRevision(a, p, g) {
2149
+ async readRevision(o, c, y) {
2115
2150
  var L;
2116
- const { root: h, module: T } = await E(a), u = (await f(h.fs, T.dir)).filter(
2117
- (M) => M.stamp === p && (!g || M.path === g)
2151
+ const { root: g, module: x } = await I(o), m = (await u(g.fs, x.dir)).filter(
2152
+ (K) => K.stamp === c && (!y || K.path === y)
2118
2153
  );
2119
- if (u.length === 0)
2120
- throw new Error(`Unknown revision "${p}"`);
2121
- const w = {};
2122
- for (const M of u)
2123
- w[M.path] = ((L = await h.fs.read(F(T.dir, M.at))) == null ? void 0 : L.text) ?? "";
2124
- return g ? w[g] : JSON.stringify(w, null, 2);
2154
+ if (m.length === 0)
2155
+ throw new Error(`Unknown revision "${c}"`);
2156
+ const $ = {};
2157
+ for (const K of m)
2158
+ $[K.path] = ((L = await g.fs.read(F(x.dir, K.at))) == null ? void 0 : L.text) ?? "";
2159
+ return y ? $[y] : JSON.stringify($, null, 2);
2125
2160
  },
2126
- async rollback(a, p, g) {
2161
+ async rollback(o, c, y) {
2127
2162
  var L;
2128
- const { module: h } = await E(a), T = y(a.workspaceId), u = (await f(T.fs, h.dir)).filter(
2129
- (M) => M.stamp === p && (!g || M.path === g)
2163
+ const { module: g } = await I(o), x = h(o.workspaceId), m = (await u(x.fs, g.dir)).filter(
2164
+ (K) => K.stamp === c && (!y || K.path === y)
2130
2165
  );
2131
- if (u.length === 0)
2132
- throw new Error(`Unknown revision "${p}"`);
2133
- const w = fe(o());
2134
- for (const M of u) {
2135
- const R = F(h.dir, M.path), B = ((L = await T.fs.read(F(h.dir, M.at))) == null ? void 0 : L.text) ?? "", Y = await T.fs.read(R);
2136
- Y && await v(T.fs, R, Y.text, w), await T.fs.write(R, B);
2166
+ if (m.length === 0)
2167
+ throw new Error(`Unknown revision "${c}"`);
2168
+ const $ = fe(a());
2169
+ for (const K of m) {
2170
+ const R = F(g.dir, K.path), z = ((L = await x.fs.read(F(g.dir, K.at))) == null ? void 0 : L.text) ?? "", Y = await x.fs.read(R);
2171
+ Y && await D(x.fs, R, Y.text, $), await x.fs.write(R, z);
2137
2172
  }
2138
- k(T);
2173
+ S(x);
2139
2174
  }
2140
2175
  };
2141
- return O;
2176
+ return E;
2142
2177
  }
2143
2178
  class ye extends Error {
2144
- constructor(i, t, o) {
2145
- super(i), this.status = t, this.body = o, this.name = "OmniVerkRestError";
2179
+ constructor(i, t, a) {
2180
+ super(i), this.status = t, this.body = a, this.name = "OmniVerkRestError";
2146
2181
  }
2147
2182
  }
2148
- const Qt = new TextDecoder("utf-8", { ignoreBOM: !0 });
2149
- function ei(e) {
2183
+ const ei = new TextDecoder("utf-8", { ignoreBOM: !0 });
2184
+ function ti(e) {
2150
2185
  const i = atob(e), t = new Uint8Array(i.length);
2151
- for (let o = 0; o < i.length; o++)
2152
- t[o] = i.charCodeAt(o);
2153
- return Qt.decode(t);
2186
+ for (let a = 0; a < i.length; a++)
2187
+ t[a] = i.charCodeAt(a);
2188
+ return ei.decode(t);
2154
2189
  }
2155
2190
  function Ce(e) {
2156
2191
  const i = new TextEncoder().encode(e);
2157
2192
  let t = "";
2158
- for (let o = 0; o < i.length; o += 32768)
2159
- t += String.fromCharCode(...i.subarray(o, o + 32768));
2193
+ for (let a = 0; a < i.length; a += 32768)
2194
+ t += String.fromCharCode(...i.subarray(a, a + 32768));
2160
2195
  return btoa(t);
2161
2196
  }
2162
- function ti(e) {
2197
+ function ii(e) {
2163
2198
  let i = 2166136261;
2164
2199
  for (let t = 0; t < e.length; t++)
2165
2200
  i = Math.imul(i ^ e.charCodeAt(t), 16777619);
2166
2201
  return `${e.length}:${(i >>> 0).toString(16)}`;
2167
2202
  }
2168
- function ai(e = {}) {
2169
- const i = (e.baseUrl ?? "/api").replace(/\/+$/, ""), t = e.fetch ?? ((d, m) => globalThis.fetch(d, m)), o = e.language ?? "en", n = encodeURIComponent;
2170
- async function s(d, m, b, C = "json") {
2171
- const k = typeof e.headers == "function" ? await e.headers() : e.headers ?? {}, N = await t(`${i}${m}`, {
2203
+ function ri(e = {}) {
2204
+ const i = (e.baseUrl ?? "/api").replace(/\/+$/, ""), t = e.fetch ?? ((d, p) => globalThis.fetch(d, p)), a = e.language ?? "en", n = encodeURIComponent;
2205
+ async function s(d, p, k, A = "json") {
2206
+ const S = typeof e.headers == "function" ? await e.headers() : e.headers ?? {}, T = await t(`${i}${p}`, {
2172
2207
  method: d,
2173
2208
  credentials: e.credentials ?? "same-origin",
2174
2209
  headers: {
2175
- Accept: C === "json" ? "application/json" : "text/plain, application/json",
2176
- ...b === void 0 ? {} : { "Content-Type": "application/json" },
2177
- ...k
2210
+ Accept: A === "json" ? "application/json" : "text/plain, application/json",
2211
+ ...k === void 0 ? {} : { "Content-Type": "application/json" },
2212
+ ...S
2178
2213
  },
2179
- ...b === void 0 ? {} : { body: JSON.stringify(b) }
2180
- }), E = await N.text();
2181
- let c = E;
2182
- if (C === "json" || !N.ok)
2214
+ ...k === void 0 ? {} : { body: JSON.stringify(k) }
2215
+ }), I = await T.text();
2216
+ let b = I;
2217
+ if (A === "json" || !T.ok)
2183
2218
  try {
2184
- c = E ? JSON.parse(E) : void 0;
2219
+ b = I ? JSON.parse(I) : void 0;
2185
2220
  } catch {
2186
- c = E;
2221
+ b = I;
2187
2222
  }
2188
- if (!N.ok)
2223
+ if (!T.ok)
2189
2224
  throw new ye(
2190
- `${d} ${m}: ${N.status} ${N.statusText}`,
2191
- N.status,
2192
- c
2225
+ `${d} ${p}: ${T.status} ${T.statusText}`,
2226
+ T.status,
2227
+ b
2193
2228
  );
2194
- return c;
2229
+ return b;
2195
2230
  }
2196
2231
  const r = e.templates === !1 ? {} : {
2197
2232
  async listTemplates() {
2198
2233
  const d = await s(
2199
2234
  "GET",
2200
- `/module-templates?lang=${n(o)}&hidden=true`
2235
+ `/module-templates?lang=${n(a)}&hidden=true`
2201
2236
  );
2202
2237
  return (await Promise.all(
2203
2238
  (d ?? []).map(
2204
- (b) => s(
2239
+ (k) => s(
2205
2240
  "GET",
2206
- `/module-templates/${n(b.slug)}?lang=${n(o)}`
2241
+ `/module-templates/${n(k.slug)}?lang=${n(a)}`
2207
2242
  )
2208
2243
  )
2209
- )).map((b) => Ie(b, o));
2244
+ )).map((k) => Ie(k, a));
2210
2245
  },
2211
- async saveTemplate(d, m) {
2212
- const b = (m == null ? void 0 : m.previousId) ?? d.id, C = Gt(d);
2213
- let k;
2214
- if ((m == null ? void 0 : m.previousId) === void 0)
2215
- k = await s(
2246
+ async saveTemplate(d, p) {
2247
+ const k = (p == null ? void 0 : p.previousId) ?? d.id, A = _t(d);
2248
+ let S;
2249
+ if ((p == null ? void 0 : p.previousId) === void 0)
2250
+ S = await s(
2216
2251
  "GET",
2217
- `/module-templates/${n(d.id)}?lang=${n(o)}`
2252
+ `/module-templates/${n(d.id)}?lang=${n(a)}`
2218
2253
  ).then(
2219
2254
  () => !0,
2220
- (E) => E instanceof ye && E.status === 404 ? !1 : Promise.reject(E)
2255
+ (I) => I instanceof ye && I.status === 404 ? !1 : Promise.reject(I)
2221
2256
  ) ? await s(
2222
2257
  "PUT",
2223
- `/module-templates/${n(d.id)}?lang=${n(o)}`,
2224
- C
2225
- ) : await s("POST", `/module-templates?lang=${n(o)}`, C);
2258
+ `/module-templates/${n(d.id)}?lang=${n(a)}`,
2259
+ A
2260
+ ) : await s("POST", `/module-templates?lang=${n(a)}`, A);
2226
2261
  else {
2227
- if (b !== d.id)
2262
+ if (k !== d.id)
2228
2263
  throw new Error(
2229
2264
  "The OmniVerk API keeps a template's slug: save it as a new template instead."
2230
2265
  );
2231
- k = await s(
2266
+ S = await s(
2232
2267
  "PUT",
2233
- `/module-templates/${n(b)}?lang=${n(o)}`,
2234
- C
2268
+ `/module-templates/${n(k)}?lang=${n(a)}`,
2269
+ A
2235
2270
  );
2236
2271
  }
2237
- return Ie(k, o);
2272
+ return Ie(S, a);
2238
2273
  },
2239
2274
  async deleteTemplate(d) {
2240
2275
  await s("DELETE", `/module-templates/${n(d)}`);
2241
2276
  }
2242
2277
  };
2243
2278
  if ((e.mode ?? "manifest-only") === "manifest-only") {
2244
- const d = "seed", m = /* @__PURE__ */ new Map(), b = (k) => {
2245
- var N, E;
2246
- return ((N = m.get(k)) == null ? void 0 : N.manifestFile) ?? `${(E = k.split(".").pop()) == null ? void 0 : E.toLowerCase()}.manifest.json`;
2247
- }, C = async (k) => {
2248
- const N = await s("GET", `/module-manifests/${n(k)}`), E = ae(N, { finalNewline: !1 });
2249
- return { path: b(k), text: E, version: ti(E) };
2279
+ const d = "seed", p = /* @__PURE__ */ new Map(), k = (S) => {
2280
+ var T, I;
2281
+ return ((T = p.get(S)) == null ? void 0 : T.manifestFile) ?? `${(I = S.split(".").pop()) == null ? void 0 : I.toLowerCase()}.manifest.json`;
2282
+ }, A = async (S) => {
2283
+ const T = await s("GET", `/module-manifests/${n(S)}`), I = ae(T, { finalNewline: !1 });
2284
+ return { path: k(S), text: I, version: ii(I) };
2250
2285
  };
2251
2286
  return {
2252
2287
  async listWorkspaces() {
2253
2288
  return [{ id: d, label: e.workspaceLabel ?? "Seed/Modules" }];
2254
2289
  },
2255
2290
  async listModules() {
2256
- const k = await s("GET", "/module-manifests");
2257
- return m.clear(), (k ?? []).map((N) => (m.set(N.packageName, N), {
2291
+ const S = await s("GET", "/module-manifests");
2292
+ return p.clear(), (S ?? []).map((T) => (p.set(T.packageName, T), {
2258
2293
  workspaceId: d,
2259
- id: N.packageName,
2294
+ id: T.packageName,
2260
2295
  // the package is the manifest's category, as in the `files` mode and OmniVerk's own
2261
2296
  // trees (1.3.14); the first folder only while the API does not list the category
2262
- packageId: N.category || N.path.split("/")[0] || void 0,
2263
- label: N.packageName,
2264
- location: N.path,
2265
- files: [N.manifestFile],
2266
- search: N.path,
2297
+ packageId: T.category || T.path.split("/")[0] || void 0,
2298
+ label: T.packageName,
2299
+ location: T.path,
2300
+ files: [T.manifestFile],
2301
+ search: T.path,
2267
2302
  // only the manifest: the checks and the preview do not count what is not given
2268
2303
  contents: "manifest"
2269
2304
  }));
2270
2305
  },
2271
- async readModule(k) {
2272
- return [await C(k.id)];
2306
+ async readModule(S) {
2307
+ return [await A(S.id)];
2273
2308
  },
2274
- async writeModule(k, N) {
2275
- const E = b(k.id), c = N.find((I) => I.path !== E || I.type !== "write");
2276
- if (c)
2309
+ async writeModule(S, T) {
2310
+ const I = k(S.id), b = T.find((N) => N.path !== I || N.type !== "write");
2311
+ if (b)
2277
2312
  throw new Error(
2278
- `This OmniVerk API stores only the manifest; "${c.path}" was not saved.`
2313
+ `This OmniVerk API stores only the manifest; "${b.path}" was not saved.`
2279
2314
  );
2280
- const v = N[0];
2281
- if (!v || v.type !== "write")
2315
+ const D = T[0];
2316
+ if (!D || D.type !== "write")
2282
2317
  return { ok: !0, versions: {} };
2283
- const f = await C(k.id);
2284
- if (v.baseVersion !== void 0 && v.baseVersion !== f.version)
2285
- return { ok: !1, conflicts: [{ path: E, currentVersion: f.version }] };
2286
- const x = await s(
2318
+ const u = await A(S.id);
2319
+ if (D.baseVersion !== void 0 && D.baseVersion !== u.version)
2320
+ return { ok: !1, conflicts: [{ path: I, currentVersion: u.version }] };
2321
+ const v = await s(
2287
2322
  "PUT",
2288
- `/module-manifests/${n(k.id)}`,
2323
+ `/module-manifests/${n(S.id)}`,
2289
2324
  {
2290
- manifest: _(v.text).value
2325
+ manifest: _(D.text).value
2291
2326
  }
2292
- ), A = await C(k.id);
2327
+ ), f = await A(S.id);
2293
2328
  return {
2294
2329
  ok: !0,
2295
- versions: { [E]: A.version },
2296
- ...x != null && x.revision ? { revision: x.revision } : {}
2330
+ versions: { [I]: f.version },
2331
+ ...v != null && v.revision ? { revision: v.revision } : {}
2297
2332
  };
2298
2333
  },
2299
- async listRevisions(k) {
2334
+ async listRevisions(S) {
2300
2335
  return (await s(
2301
2336
  "GET",
2302
- `/module-manifests/${n(k.id)}/revisions`
2303
- ) ?? []).map((E) => ({
2304
- id: E.id,
2305
- timestamp: Date.parse(E.at) || 0,
2306
- path: b(k.id),
2307
- ...E.sizeBytes !== void 0 ? { summary: `${E.sizeBytes} B` } : {}
2337
+ `/module-manifests/${n(S.id)}/revisions`
2338
+ ) ?? []).map((I) => ({
2339
+ id: I.id,
2340
+ timestamp: Date.parse(I.at) || 0,
2341
+ path: k(S.id),
2342
+ ...I.sizeBytes !== void 0 ? { summary: `${I.sizeBytes} B` } : {}
2308
2343
  }));
2309
2344
  },
2310
- async readRevision(k, N) {
2345
+ async readRevision(S, T) {
2311
2346
  return s(
2312
2347
  "GET",
2313
- `/module-manifests/${n(k.id)}/revisions/${n(N)}`,
2348
+ `/module-manifests/${n(S.id)}/revisions/${n(T)}`,
2314
2349
  void 0,
2315
2350
  "text"
2316
2351
  );
2317
2352
  },
2318
- async rollback(k, N) {
2353
+ async rollback(S, T) {
2319
2354
  await s(
2320
2355
  "POST",
2321
- `/module-manifests/${n(k.id)}/revisions/${n(N)}/rollback`
2356
+ `/module-manifests/${n(S.id)}/revisions/${n(T)}/rollback`
2322
2357
  );
2323
2358
  },
2324
2359
  ...r
2325
2360
  };
2326
2361
  }
2327
- const l = (d) => `/module-files/${n(d.workspaceId)}/modules/${n(d.id)}`, y = (d) => d.map((m) => ({ path: m.path, content: Ce(m.text) }));
2362
+ const l = (d) => `/module-files/${n(d.workspaceId)}/modules/${n(d.id)}`, h = (d) => d.map((p) => ({ path: p.path, content: Ce(p.text) }));
2328
2363
  return {
2329
2364
  async listWorkspaces() {
2330
2365
  return s("GET", "/module-files/workspaces");
@@ -2333,43 +2368,43 @@ function ai(e = {}) {
2333
2368
  return (await s(
2334
2369
  "GET",
2335
2370
  `/module-files/${n(d)}/modules`
2336
- ) ?? []).map((b) => ({ ...b, workspaceId: d }));
2371
+ ) ?? []).map((k) => ({ ...k, workspaceId: d }));
2337
2372
  },
2338
2373
  async readModule(d) {
2339
- const m = await s("GET", l(d));
2340
- return ((m == null ? void 0 : m.files) ?? []).map((b) => ({
2341
- path: b.path,
2342
- text: ei(b.content),
2343
- ...b.version ? { version: b.version } : {},
2344
- ...b.readOnly ? { readOnly: !0 } : {}
2374
+ const p = await s("GET", l(d));
2375
+ return ((p == null ? void 0 : p.files) ?? []).map((k) => ({
2376
+ path: k.path,
2377
+ text: ti(k.content),
2378
+ ...k.version ? { version: k.version } : {},
2379
+ ...k.readOnly ? { readOnly: !0 } : {}
2345
2380
  }));
2346
2381
  },
2347
- async writeModule(d, m) {
2348
- var b;
2382
+ async writeModule(d, p) {
2383
+ var k;
2349
2384
  try {
2350
- const C = await s(
2385
+ const A = await s(
2351
2386
  "PUT",
2352
2387
  l(d),
2353
2388
  {
2354
- changes: m.map(
2355
- (k) => k.type === "write" ? {
2389
+ changes: p.map(
2390
+ (S) => S.type === "write" ? {
2356
2391
  type: "write",
2357
- path: k.path,
2358
- content: Ce(k.text),
2359
- baseVersion: k.baseVersion
2360
- } : { type: "delete", path: k.path, baseVersion: k.baseVersion }
2392
+ path: S.path,
2393
+ content: Ce(S.text),
2394
+ baseVersion: S.baseVersion
2395
+ } : { type: "delete", path: S.path, baseVersion: S.baseVersion }
2361
2396
  )
2362
2397
  }
2363
2398
  );
2364
2399
  return {
2365
2400
  ok: !0,
2366
- versions: C == null ? void 0 : C.versions,
2367
- ...C != null && C.revision ? { revision: C.revision } : {}
2401
+ versions: A == null ? void 0 : A.versions,
2402
+ ...A != null && A.revision ? { revision: A.revision } : {}
2368
2403
  };
2369
- } catch (C) {
2370
- if (C instanceof ye && C.status === 409)
2371
- return { ok: !1, conflicts: ((b = C.body) == null ? void 0 : b.conflicts) ?? m.map((N) => ({ path: N.path })) };
2372
- throw C;
2404
+ } catch (A) {
2405
+ if (A instanceof ye && A.status === 409)
2406
+ return { ok: !1, conflicts: ((k = A.body) == null ? void 0 : k.conflicts) ?? p.map((T) => ({ path: T.path })) };
2407
+ throw A;
2373
2408
  }
2374
2409
  },
2375
2410
  async createModule(d) {
@@ -2379,44 +2414,44 @@ function ai(e = {}) {
2379
2414
  {
2380
2415
  packageId: d.packageId,
2381
2416
  id: d.id,
2382
- files: y(d.files)
2417
+ files: h(d.files)
2383
2418
  }
2384
2419
  ), workspaceId: d.workspaceId };
2385
2420
  },
2386
2421
  async deleteModule(d) {
2387
2422
  await s("DELETE", l(d));
2388
2423
  },
2389
- async listRevisions(d, m) {
2424
+ async listRevisions(d, p) {
2390
2425
  return s(
2391
2426
  "GET",
2392
- `${l(d)}/revisions${m ? `?path=${n(m)}` : ""}`
2427
+ `${l(d)}/revisions${p ? `?path=${n(p)}` : ""}`
2393
2428
  );
2394
2429
  },
2395
- async readRevision(d, m, b) {
2430
+ async readRevision(d, p, k) {
2396
2431
  return s(
2397
2432
  "GET",
2398
- `${l(d)}/revisions/${n(m)}${b ? `?path=${n(b)}` : ""}`,
2433
+ `${l(d)}/revisions/${n(p)}${k ? `?path=${n(k)}` : ""}`,
2399
2434
  void 0,
2400
2435
  "text"
2401
2436
  );
2402
2437
  },
2403
- async rollback(d, m, b) {
2438
+ async rollback(d, p, k) {
2404
2439
  await s(
2405
2440
  "POST",
2406
- `${l(d)}/revisions/${n(m)}/rollback${b ? `?path=${n(b)}` : ""}`
2441
+ `${l(d)}/revisions/${n(p)}/rollback${k ? `?path=${n(k)}` : ""}`
2407
2442
  );
2408
2443
  },
2409
2444
  ...e.serverValidation ? {
2410
- async validate(d, m) {
2445
+ async validate(d, p) {
2411
2446
  return s("POST", `${l(d)}/validate`, {
2412
- files: y(m)
2447
+ files: h(p)
2413
2448
  });
2414
2449
  }
2415
2450
  } : {},
2416
2451
  ...r
2417
2452
  };
2418
2453
  }
2419
- const ii = [
2454
+ const ni = [
2420
2455
  "en",
2421
2456
  "pl",
2422
2457
  "de",
@@ -2445,12 +2480,12 @@ const ii = [
2445
2480
  } catch {
2446
2481
  return { path: i.path, value: {} };
2447
2482
  }
2448
- }, ni = (e) => {
2483
+ }, si = (e) => {
2449
2484
  var i;
2450
2485
  return ((i = be(e)) == null ? void 0 : i.path.replace(/\.manifest\.json$/i, "")) ?? "module";
2451
2486
  };
2452
- function ri(e = {}) {
2453
- const i = e.t ?? ((s, r) => r), t = (s, r) => i(`devStudio.omniverk.${s}`, r), o = {
2487
+ function li(e = {}) {
2488
+ const i = e.t ?? ((s, r) => r), t = (s, r) => i(`devStudio.omniverk.${s}`, r), a = {
2454
2489
  type: "object",
2455
2490
  properties: {
2456
2491
  name: { type: "string", title: t("field.name", "Name") },
@@ -2458,7 +2493,7 @@ function ri(e = {}) {
2458
2493
  dataType: {
2459
2494
  type: "string",
2460
2495
  title: t("field.dataType", "Data type"),
2461
- enum: [...bt]
2496
+ enum: [...kt]
2462
2497
  },
2463
2498
  maxLength: { type: "integer", title: t("field.maxLength", "Max length") },
2464
2499
  isRequired: { type: "boolean", title: t("field.isRequired", "Required") },
@@ -2489,21 +2524,21 @@ function ri(e = {}) {
2489
2524
  };
2490
2525
  return {
2491
2526
  id: "omniverk",
2492
- kinds: ht,
2493
- manifestSections: vt(i, { scripting: e.scripting }),
2494
- entities: { entityMetaSchema: n, fieldSchema: o },
2495
- locales: e.locales ?? ii,
2527
+ kinds: wt,
2528
+ manifestSections: $t(i, { scripting: e.scripting }),
2529
+ entities: { entityMetaSchema: n, fieldSchema: a },
2530
+ locales: e.locales ?? ni,
2496
2531
  requiredLocales: ["en", "pl"],
2497
2532
  moduleId: (s) => {
2498
2533
  var l;
2499
2534
  const r = (l = be(s)) == null ? void 0 : l.value.packageName;
2500
2535
  return typeof r == "string" && r ? r : void 0;
2501
2536
  },
2502
- validateModule: (s) => qt(s),
2537
+ validateModule: (s) => Vt(s),
2503
2538
  generateModule: async (s, { existingIds: r }) => {
2504
- const l = await Ct(
2539
+ const l = await Ot(
2505
2540
  {
2506
- ...Ot(s),
2541
+ ...At(s),
2507
2542
  iconConfig: e.iconConfig,
2508
2543
  ownerTenantId: e.ownerTenantId
2509
2544
  },
@@ -2518,7 +2553,7 @@ function ri(e = {}) {
2518
2553
  files: l.package.files
2519
2554
  };
2520
2555
  },
2521
- duplicateModule: (s, r) => Lt(s, r),
2556
+ duplicateModule: (s, r) => Kt(s, r),
2522
2557
  scripts: {
2523
2558
  categories: [
2524
2559
  "calculation",
@@ -2532,20 +2567,20 @@ function ri(e = {}) {
2532
2567
  phases: ["preInstall", "postInstall", "preUninstall", "postUninstall", "migrations"]
2533
2568
  },
2534
2569
  newFile: (s, { files: r }) => {
2535
- var C;
2536
- const l = ni(r), y = ((C = be(r)) == null ? void 0 : C.value) ?? {};
2570
+ var A;
2571
+ const l = si(r), h = ((A = be(r)) == null ? void 0 : A.value) ?? {};
2537
2572
  if (s === "scripts") {
2538
- let k = `${l}.scripts.json`;
2539
- for (let E = 2; r.some((c) => c.path === k); E++)
2540
- k = `${l}.${E}.scripts.json`;
2541
- const N = {
2542
- moduleName: String(y.packageName ?? l),
2573
+ let S = `${l}.scripts.json`;
2574
+ for (let I = 2; r.some((b) => b.path === S); I++)
2575
+ S = `${l}.${I}.scripts.json`;
2576
+ const T = {
2577
+ moduleName: String(h.packageName ?? l),
2543
2578
  version: "1.0.0",
2544
2579
  scripts: []
2545
2580
  };
2546
- return { path: k, text: ae(N) };
2581
+ return { path: S, text: ae(T) };
2547
2582
  }
2548
- const d = `${String(y.packageName ?? l)}.Core`, b = {
2583
+ const d = `${String(h.packageName ?? l)}.Core`, k = {
2549
2584
  entities: ["entities.json", { moduleName: d, version: "1.0.0", entities: [] }],
2550
2585
  views: ["views.json", { moduleName: d, version: "1.0.0", views: [] }],
2551
2586
  workflows: ["workflows.json", { moduleName: d, version: "1.0.0", workflows: [] }],
@@ -2553,9 +2588,13 @@ function ri(e = {}) {
2553
2588
  "permissions.json",
2554
2589
  { moduleName: d, version: "1.0.0", permissions: [], permissionGroups: [] }
2555
2590
  ],
2556
- seeds: ["seeds.json", { moduleName: d, version: "1.0.0", seeds: {} }]
2591
+ seeds: ["seeds.json", { moduleName: d, version: "1.0.0", seeds: {} }],
2592
+ dataSources: [
2593
+ "datasources.json",
2594
+ { moduleName: String(h.packageName ?? l), version: "1.0.0", dataSources: [] }
2595
+ ]
2557
2596
  }[s];
2558
- return b ? { path: `${l}.${b[0]}`, text: ae(b[1]) } : void 0;
2597
+ return k ? { path: `${l}.${k[0]}`, text: ae(k[1]) } : void 0;
2559
2598
  },
2560
2599
  templateSchema: {
2561
2600
  type: "object",
@@ -2579,22 +2618,22 @@ function ri(e = {}) {
2579
2618
  }
2580
2619
  };
2581
2620
  }
2582
- function li(e = {}) {
2621
+ function ci(e = {}) {
2583
2622
  let i = 0;
2584
2623
  const t = /* @__PURE__ */ new Map();
2585
2624
  for (const [n, s] of Object.entries(e))
2586
2625
  t.set(n, { text: s, version: String(++i) });
2587
- const o = (n) => n ? `${n}/` : "";
2626
+ const a = (n) => n ? `${n}/` : "";
2588
2627
  return {
2589
2628
  async list(n) {
2590
- const s = o(n), r = /* @__PURE__ */ new Map();
2629
+ const s = a(n), r = /* @__PURE__ */ new Map();
2591
2630
  for (const l of t.keys()) {
2592
2631
  if (!l.startsWith(s))
2593
2632
  continue;
2594
- const y = l.slice(s.length), d = y.indexOf("/");
2595
- r.set(d < 0 ? y : y.slice(0, d), d < 0 ? "file" : "directory");
2633
+ const h = l.slice(s.length), d = h.indexOf("/");
2634
+ r.set(d < 0 ? h : h.slice(0, d), d < 0 ? "file" : "directory");
2596
2635
  }
2597
- return [...r].map(([l, y]) => ({ name: l, kind: y }));
2636
+ return [...r].map(([l, h]) => ({ name: l, kind: h }));
2598
2637
  },
2599
2638
  async read(n) {
2600
2639
  const s = t.get(n);
@@ -2608,7 +2647,7 @@ function li(e = {}) {
2608
2647
  t.delete(n);
2609
2648
  },
2610
2649
  async removeDir(n) {
2611
- const s = o(n);
2650
+ const s = a(n);
2612
2651
  for (const r of [...t.keys()])
2613
2652
  r.startsWith(s) && t.delete(r);
2614
2653
  },
@@ -2617,12 +2656,12 @@ function li(e = {}) {
2617
2656
  }
2618
2657
  };
2619
2658
  }
2620
- const Ge = () => typeof window > "u" ? void 0 : window.showDirectoryPicker;
2621
- function ci() {
2622
- return typeof Ge() == "function";
2659
+ const _e = () => typeof window > "u" ? void 0 : window.showDirectoryPicker;
2660
+ function di() {
2661
+ return typeof _e() == "function";
2623
2662
  }
2624
- async function di(e = {}) {
2625
- const i = Ge();
2663
+ async function pi(e = {}) {
2664
+ const i = _e();
2626
2665
  if (!i)
2627
2666
  throw new Error("This browser cannot open folders (File System Access API).");
2628
2667
  return i({
@@ -2631,119 +2670,120 @@ async function di(e = {}) {
2631
2670
  });
2632
2671
  }
2633
2672
  const le = (e) => typeof e == "object" && e !== null && (e.name === "NotFoundError" || e.name === "TypeMismatchError");
2634
- function pi(e) {
2673
+ function mi(e) {
2635
2674
  const i = new TextDecoder("utf-8", { ignoreBOM: !0 });
2636
2675
  async function t(r, l = !1) {
2637
- let y = e;
2676
+ let h = e;
2638
2677
  for (const d of r.split("/").filter(Boolean))
2639
2678
  try {
2640
- y = await y.getDirectoryHandle(d, { create: l });
2641
- } catch (m) {
2642
- if (le(m))
2679
+ h = await h.getDirectoryHandle(d, { create: l });
2680
+ } catch (p) {
2681
+ if (le(p))
2643
2682
  return null;
2644
- throw m;
2683
+ throw p;
2645
2684
  }
2646
- return y;
2685
+ return h;
2647
2686
  }
2648
- const o = (r) => {
2687
+ const a = (r) => {
2649
2688
  const l = r.lastIndexOf("/");
2650
2689
  return l < 0 ? ["", r] : [r.slice(0, l), r.slice(l + 1)];
2651
2690
  };
2652
2691
  async function n(r, l = !1) {
2653
- const [y, d] = o(r), m = await t(y, l);
2654
- if (!m)
2692
+ const [h, d] = a(r), p = await t(h, l);
2693
+ if (!p)
2655
2694
  return null;
2656
2695
  try {
2657
- return await m.getFileHandle(d, { create: l });
2658
- } catch (b) {
2659
- if (le(b))
2696
+ return await p.getFileHandle(d, { create: l });
2697
+ } catch (k) {
2698
+ if (le(k))
2660
2699
  return null;
2661
- throw b;
2700
+ throw k;
2662
2701
  }
2663
2702
  }
2664
2703
  const s = (r) => `${r.lastModified}:${r.size}`;
2665
2704
  return {
2666
2705
  async list(r) {
2667
- const l = await t(r), y = [];
2706
+ const l = await t(r), h = [];
2668
2707
  if (l)
2669
2708
  for await (const d of l.values())
2670
- y.push({ name: d.name, kind: d.kind });
2671
- return y;
2709
+ h.push({ name: d.name, kind: d.kind });
2710
+ return h;
2672
2711
  },
2673
2712
  async read(r) {
2674
2713
  const l = await n(r);
2675
2714
  if (!l)
2676
2715
  return null;
2677
- const y = await l.getFile();
2678
- return { text: i.decode(await y.arrayBuffer()), version: s(y) };
2716
+ const h = await l.getFile();
2717
+ return { text: i.decode(await h.arrayBuffer()), version: s(h) };
2679
2718
  },
2680
2719
  async write(r, l) {
2681
- const y = await n(r, !0);
2682
- if (!y)
2720
+ const h = await n(r, !0);
2721
+ if (!h)
2683
2722
  throw new Error(`Cannot write ${r}`);
2684
- const d = await y.createWritable();
2685
- return await d.write(l), await d.close(), s(await y.getFile());
2723
+ const d = await h.createWritable();
2724
+ return await d.write(l), await d.close(), s(await h.getFile());
2686
2725
  },
2687
2726
  async remove(r) {
2688
- const [l, y] = o(r), d = await t(l);
2727
+ const [l, h] = a(r), d = await t(l);
2689
2728
  try {
2690
- await (d == null ? void 0 : d.removeEntry(y));
2691
- } catch (m) {
2692
- if (!le(m))
2693
- throw m;
2729
+ await (d == null ? void 0 : d.removeEntry(h));
2730
+ } catch (p) {
2731
+ if (!le(p))
2732
+ throw p;
2694
2733
  }
2695
2734
  },
2696
2735
  async removeDir(r) {
2697
- const [l, y] = o(r), d = await t(l);
2736
+ const [l, h] = a(r), d = await t(l);
2698
2737
  try {
2699
- await (d == null ? void 0 : d.removeEntry(y, { recursive: !0 }));
2700
- } catch (m) {
2701
- if (!le(m))
2702
- throw m;
2738
+ await (d == null ? void 0 : d.removeEntry(h, { recursive: !0 }));
2739
+ } catch (p) {
2740
+ if (!le(p))
2741
+ throw p;
2703
2742
  }
2704
2743
  }
2705
2744
  };
2706
2745
  }
2707
2746
  export {
2708
2747
  W as OMNIVERK_CUSTOM_PREFIX,
2709
- bt as OMNIVERK_DATA_TYPES,
2710
- Rt as OMNIVERK_LEGACY_LIST_VIEW_FILES,
2711
- ii as OMNIVERK_LOCALES,
2748
+ kt as OMNIVERK_DATA_TYPES,
2749
+ qt as OMNIVERK_LEGACY_LIST_VIEW_FILES,
2750
+ ni as OMNIVERK_LOCALES,
2712
2751
  ye as OmniVerkRestError,
2713
- Ct as buildOmniVerkModule,
2714
- pi as createDirectoryHandleFileSystem,
2715
- li as createMemorySeedFileSystem,
2716
- ai as createOmniVerkRestProvider,
2717
- ri as createOmniVerkStudioPreset,
2718
- oi as createSeedFolderProvider,
2719
- Lt as duplicateOmniVerkModule,
2720
- ci as isSeedFolderPickerSupported,
2752
+ Ot as buildOmniVerkModule,
2753
+ mi as createDirectoryHandleFileSystem,
2754
+ ci as createMemorySeedFileSystem,
2755
+ ri as createOmniVerkRestProvider,
2756
+ li as createOmniVerkStudioPreset,
2757
+ ai as createSeedFolderProvider,
2758
+ Kt as duplicateOmniVerkModule,
2759
+ di as isSeedFolderPickerSupported,
2760
+ ht as omniverkDataSourcesKind,
2721
2761
  Qe as omniverkEntitiesKind,
2722
- ht as omniverkFileKinds,
2723
- Nt as omniverkFilePrefix,
2762
+ wt as omniverkFileKinds,
2763
+ jt as omniverkFilePrefix,
2724
2764
  et as omniverkI18nKind,
2725
2765
  Ze as omniverkManifestKind,
2726
- vt as omniverkManifestSections,
2766
+ $t as omniverkManifestSections,
2727
2767
  P as omniverkPascalIdentifier,
2728
2768
  ut as omniverkPermissionsKind,
2729
2769
  fe as omniverkRevisionStamp,
2730
2770
  yt as omniverkScriptKind,
2731
2771
  gt as omniverkScriptsKind,
2732
2772
  ft as omniverkSeedsKind,
2733
- Ot as omniverkSpecFromStudio,
2734
- qe as omniverkStableId,
2735
- Ve as omniverkTableName,
2773
+ At as omniverkSpecFromStudio,
2774
+ Ve as omniverkStableId,
2775
+ Ue as omniverkTableName,
2736
2776
  Ie as omniverkTemplateFromDto,
2737
- Wt as omniverkTemplateFromEntry,
2777
+ Gt as omniverkTemplateFromEntry,
2738
2778
  xe as omniverkTemplateToEntry,
2739
- Gt as omniverkTemplateToInput,
2779
+ _t as omniverkTemplateToInput,
2740
2780
  ot as omniverkViewFromItem,
2741
2781
  st as omniverkViewItem,
2742
2782
  at as omniverkViewsKind,
2743
2783
  ct as omniverkWorkflowFromItem,
2744
2784
  lt as omniverkWorkflowItem,
2745
2785
  dt as omniverkWorkflowsKind,
2746
- di as pickSeedDirectory,
2747
- qt as validateOmniVerkModule,
2748
- Vt as validateOmniVerkWorkspace
2786
+ pi as pickSeedDirectory,
2787
+ Vt as validateOmniVerkModule,
2788
+ Ut as validateOmniVerkWorkspace
2749
2789
  };