@nice2dev/erp-adapter 1.4.11 → 1.4.13

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,61 +1,61 @@
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({
1
+ import { objectFileKind as Ee, endsWithAny as _, arrayFileKind as Fe, i18nFileKind as Ye, itemsFileKind as Pe, jsonFileKind as Re, scriptsFileKind as Xe, jsonValuesEqual as Ve, keepTextFormat as et, parseJsonText as z, patchJsonText as qe, stringifyJsonText as le } from "@nice2dev/ui-forms/studio";
2
+ const U = (e) => typeof e == "object" && e !== null && !Array.isArray(e), J = (e) => typeof e == "string" && e ? e : void 0, W = (e) => Object.fromEntries(Object.entries(e).filter(([, i]) => i !== void 0)), tt = Ee({
3
3
  id: "manifest",
4
4
  label: "Manifest",
5
5
  labelKey: "devStudio.kind.manifest",
6
6
  icon: "file",
7
7
  editor: "manifest",
8
- match: B(".manifest.json")
9
- }), Me = [
8
+ match: _(".manifest.json")
9
+ }), Ue = [
10
10
  ["dataType", "type"],
11
11
  ["isRequired", "required"]
12
- ], ce = "$aliases";
13
- function Ye(e) {
14
- if (!V(e))
12
+ ], ue = "$aliases";
13
+ function it(e) {
14
+ if (!U(e))
15
15
  return e;
16
- const i = Me.filter(([a, n]) => !(a in e) && n in e);
16
+ const i = Ue.filter(([o, n]) => !(o in e) && n in e);
17
17
  if (i.length === 0)
18
18
  return e;
19
19
  const t = {};
20
- for (const [a, n] of Object.entries(e)) {
21
- const s = i.find(([, r]) => r === a);
22
- t[s ? s[0] : a] = n;
20
+ for (const [o, n] of Object.entries(e)) {
21
+ const s = i.find(([, a]) => a === o);
22
+ t[s ? s[0] : o] = n;
23
23
  }
24
- return t[ce] = i.map(([, a]) => a), t;
24
+ return t[ue] = i.map(([, o]) => o), t;
25
25
  }
26
- function Xe(e) {
27
- if (!V(e) || !Array.isArray(e[ce]))
26
+ function nt(e) {
27
+ if (!U(e) || !Array.isArray(e[ue]))
28
28
  return e;
29
- const i = e[ce], t = {};
30
- for (const [a, n] of Object.entries(e)) {
31
- if (a === ce)
29
+ const i = e[ue], t = {};
30
+ for (const [o, n] of Object.entries(e)) {
31
+ if (o === ue)
32
32
  continue;
33
- const s = Me.find(([r, l]) => r === a && i.includes(l));
34
- t[s ? s[1] : a] = n;
33
+ const s = Ue.find(([a, l]) => a === o && i.includes(l));
34
+ t[s ? s[1] : o] = n;
35
35
  }
36
36
  return t;
37
37
  }
38
- const Se = (e, i) => V(e) && Array.isArray(e.fields) ? { ...e, fields: e.fields.map(i) } : e, Qe = (() => {
39
- const e = Oe({
38
+ const xe = (e, i) => U(e) && Array.isArray(e.fields) ? { ...e, fields: e.fields.map(i) } : e, st = (() => {
39
+ const e = Fe({
40
40
  id: "entities",
41
41
  label: "Entities",
42
42
  labelKey: "devStudio.kind.entities",
43
43
  icon: "database",
44
44
  editor: "entities",
45
- match: B(".entities.json"),
45
+ match: _(".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((a) => Se(a, Ye)),
52
- encode: (i, t, a) => e.encode(
53
- i.map((n) => Se(n, Xe)),
51
+ decode: (i, t) => e.decode(i, t).map((o) => xe(o, it)),
52
+ encode: (i, t, o) => e.encode(
53
+ i.map((n) => xe(n, nt)),
54
54
  t,
55
- a
55
+ o
56
56
  )
57
57
  };
58
- })(), et = ze(), ge = {
58
+ })(), ot = Ye(), $e = {
59
59
  input: "textInput",
60
60
  text: "textInput",
61
61
  textarea: "textArea",
@@ -68,7 +68,7 @@ const Se = (e, i) => V(e) && Array.isArray(e.fields) ? { ...e, fields: e.fields.
68
68
  lookup: "select",
69
69
  select: "select"
70
70
  };
71
- function tt(e) {
71
+ function at(e) {
72
72
  const i = e.columns.map((t) => ({
73
73
  field: String(t.field ?? ""),
74
74
  header: String(t.displayName ?? t.header ?? t.label ?? t.field ?? "")
@@ -96,25 +96,25 @@ function tt(e) {
96
96
  ]
97
97
  };
98
98
  }
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
- return U({
99
+ function We(e, i) {
100
+ var l, y, p;
101
+ const t = (e.rows ?? []).flatMap((u) => u.cells).find((u) => u.controlType === "dataGrid"), o = ((l = t == null ? void 0 : t.props) == null ? void 0 : l.columns) ?? [], n = i.columns ?? [], s = (p = (y = e.dataSources) == null ? void 0 : y.find((u) => u.type === "entity")) == null ? void 0 : p.entity, a = (u) => "displayName" in u ? "displayName" : "header" in u ? "header" : "label" in u ? "label" : "displayName";
102
+ return W({
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: 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 };
106
+ columns: o.map((u) => {
107
+ const N = n.find((x) => x.field === u.field);
108
+ if (!N)
109
+ return { field: u.field, displayName: u.header ?? u.field };
110
+ const L = a(N), I = u.header ?? u.field;
111
+ return N[L] === void 0 && I === u.field ? N : { ...N, [L]: I };
112
112
  })
113
113
  });
114
114
  }
115
- function it(e) {
115
+ function rt(e) {
116
116
  const i = [];
117
- return e.tabs.forEach((a, n) => {
117
+ return e.tabs.forEach((o, n) => {
118
118
  i.push({
119
119
  id: `tab-${n}`,
120
120
  cells: [
@@ -122,15 +122,15 @@ function it(e) {
122
122
  id: `tab-${n}`,
123
123
  controlType: "heading",
124
124
  colSpan: 12,
125
- props: { text: String(a.displayName ?? a.name ?? ""), level: 2, name: a.name }
125
+ props: { text: String(o.displayName ?? o.name ?? ""), level: 2, name: o.name }
126
126
  }
127
127
  ]
128
- }), (a.sections ?? []).forEach((s, r) => {
128
+ }), (o.sections ?? []).forEach((s, a) => {
129
129
  i.push({
130
- id: `tab-${n}-section-${r}`,
130
+ id: `tab-${n}-section-${a}`,
131
131
  cells: [
132
132
  {
133
- id: `tab-${n}-section-${r}`,
133
+ id: `tab-${n}-section-${a}`,
134
134
  controlType: "heading",
135
135
  colSpan: 12,
136
136
  props: {
@@ -141,25 +141,25 @@ function it(e) {
141
141
  }
142
142
  ]
143
143
  });
144
- let l = [], h = 0;
145
- const d = () => {
146
- l.length && (i.push({ id: `tab-${n}-section-${r}-row-${i.length}`, cells: l }), l = [], h = 0);
144
+ let l = [], y = 0;
145
+ const p = () => {
146
+ l.length && (i.push({ id: `tab-${n}-section-${a}-row-${i.length}`, cells: l }), l = [], y = 0);
147
147
  };
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,
148
+ (s.controls ?? []).forEach((u, N) => {
149
+ const L = typeof u.colSpan == "number" ? u.colSpan : 6;
150
+ y + L > 12 && p(), l.push({
151
+ id: `c-${n}-${a}-${N}`,
152
+ controlType: $e[String(u.type)] ?? "textInput",
153
+ colSpan: L,
154
154
  props: {
155
- label: String(p.label ?? p.field ?? ""),
156
- required: p.required === !0,
157
- field: p.field,
158
- type: p.type
155
+ label: String(u.label ?? u.field ?? ""),
156
+ required: u.required === !0,
157
+ field: u.field,
158
+ type: u.type
159
159
  },
160
- bindings: { value: { source: "record", field: String(p.field ?? "") } }
161
- }), h += A;
162
- }), d();
160
+ bindings: { value: { source: "record", field: String(u.field ?? "") } }
161
+ }), y += L;
162
+ }), p();
163
163
  });
164
164
  }), {
165
165
  id: String(e.name),
@@ -171,202 +171,202 @@ function it(e) {
171
171
  rows: i
172
172
  };
173
173
  }
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 ?? [])
174
+ function Ge(e, i) {
175
+ var p, u, N, L, I;
176
+ const t = i.tabs ?? [], o = t.flatMap(
177
+ (x) => (x.sections ?? []).flatMap((O) => O.controls ?? [])
178
178
  ), n = [];
179
- let s = null, r = null;
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 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;
179
+ let s = null, a = null;
180
+ const l = () => (s || (s = { name: "Main", displayName: e.name, sections: [] }, n.push(s)), a || (a = { name: "Details", displayName: "Details", controls: [] }, s.sections.push(a)), a);
181
+ for (const x of e.rows ?? [])
182
+ for (const O of x.cells) {
183
+ const w = O.props ?? {};
184
+ if (O.controlType === "heading" && (w.level === 2 || w.level === 3)) {
185
+ const E = J(w.name) ?? String(w.text ?? "").replace(/\s+/g, "");
186
+ if (w.level === 2)
187
+ s = { ...t.find((h) => h.name === E) ?? {}, name: E, displayName: String(w.text ?? E), sections: [] }, n.push(s), a = null;
188
188
  else {
189
189
  s || (s = { name: "Main", displayName: e.name, sections: [] }, n.push(s));
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);
190
+ const C = t.flatMap((S) => S.sections ?? []).find((S) => S.name === E);
191
+ a = { ...C ? Object.fromEntries(Object.entries(C).filter(([S]) => S !== "controls")) : {}, name: E, displayName: String(w.text ?? E), controls: [] }, s.sections.push(a);
192
192
  }
193
193
  continue;
194
194
  }
195
- const D = ((p = (d = I.bindings) == null ? void 0 : d.value) == null ? void 0 : p.field) ?? G(b.field);
196
- if (!D)
195
+ const T = ((u = (p = O.bindings) == null ? void 0 : p.value) == null ? void 0 : u.field) ?? J(w.field);
196
+ if (!T)
197
197
  continue;
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
198
+ const m = o.find((E) => E.field === T), b = m && $e[String(m.type)] === O.controlType ? m.type : ((N = Object.entries($e).find(([, E]) => E === O.controlType)) == null ? void 0 : N[0]) ?? "input", g = W({
199
+ ...m ?? {},
200
+ field: T,
201
+ type: b,
202
+ label: w.label !== void 0 ? String(w.label) : m == null ? void 0 : m.label,
203
+ colSpan: (m == null ? void 0 : m.colSpan) !== void 0 || O.colSpan !== 6 ? O.colSpan : void 0,
204
+ required: w.required === !0 ? !0 : (m == null ? void 0 : m.required) === !0 ? !1 : m == null ? void 0 : m.required
205
205
  });
206
- l().controls.push(f);
206
+ l().controls.push(g);
207
207
  }
208
- const h = n.map((T) => {
209
- const I = t.find((b) => b.name === T.name);
210
- return I ? { ...I, ...T } : T;
208
+ const y = n.map((x) => {
209
+ const O = t.find((w) => w.name === x.name);
210
+ return O ? { ...O, ...x } : x;
211
211
  });
212
- return U({
212
+ return W({
213
213
  ...i,
214
214
  displayName: "displayName" in i || e.name !== i.name ? e.name : void 0,
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
215
+ entityName: ((I = (L = e.dataSources) == null ? void 0 : L.find((x) => x.type === "entity")) == null ? void 0 : I.entity) ?? i.entityName,
216
+ tabs: y
217
217
  });
218
218
  }
219
- const nt = (e) => {
219
+ const lt = (e) => {
220
220
  const i = String(e.type ?? "").toLowerCase();
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
- function st(e, i) {
224
- const t = V(e) ? e : {}, a = G(t.name) ?? G(t.id) ?? `#${i}`, n = G(t.displayName) ?? a, s = nt(t);
223
+ function ct(e, i) {
224
+ const t = U(e) ? e : {}, o = J(t.name) ?? J(t.id) ?? `#${i}`, n = J(t.displayName) ?? o, s = lt(t);
225
225
  if (!s)
226
226
  return {
227
- key: a,
227
+ key: o,
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" ? 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)` };
232
+ const a = s === "List" ? at(t) : rt(t), l = s === "List" ? We(a, t) : Ge(a, t);
233
+ return Ve(l, e) ? { key: o, label: n, definition: a, source: e } : { key: o, label: n, source: e, rawReason: `${s} (round-trip)` };
234
234
  }
235
- function ot(e) {
235
+ function dt(e) {
236
236
  if (!e.definition)
237
237
  return e.source;
238
- const i = V(e.source) ? e.source : { name: e.definition.id };
239
- return e.definition.kind === "form" ? Pe(e.definition, {
238
+ const i = U(e.source) ? e.source : { name: e.definition.id };
239
+ return e.definition.kind === "form" ? Ge(e.definition, {
240
240
  type: "Form",
241
241
  ...i,
242
242
  name: i.name ?? e.definition.id
243
- }) : Fe(e.definition, {
243
+ }) : We(e.definition, {
244
244
  type: "List",
245
245
  ...i,
246
246
  name: i.name ?? e.definition.id
247
247
  });
248
248
  }
249
- const at = Ae({
249
+ const pt = Pe({
250
250
  id: "views",
251
251
  label: "Views",
252
252
  labelKey: "devStudio.kind.views",
253
253
  icon: "grid",
254
254
  editor: "views",
255
- match: B(".views.json"),
255
+ match: _(".views.json"),
256
256
  property: "views",
257
257
  itemKey: "name",
258
- toItem: st,
259
- fromItem: ot
258
+ toItem: ct,
259
+ fromItem: dt
260
260
  });
261
- function rt(e) {
261
+ function ut(e) {
262
262
  const i = e.steps ?? [], t = e.connections ?? [];
263
263
  return {
264
264
  id: String(e.name),
265
265
  name: String(e.displayName ?? e.name),
266
266
  entityType: String(e.entityName ?? ""),
267
267
  version: 1,
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",
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",
272
272
  position: { x: 60 + n % 4 * 230, y: 80 + Math.floor(n / 4) * 140 }
273
273
  })),
274
- transitions: t.map((a, n) => ({
274
+ transitions: t.map((o, n) => ({
275
275
  id: `t${n}`,
276
- fromStateId: String(a.fromState),
277
- toStateId: String(a.toState),
278
- name: String(a.actionName ?? ""),
279
- ...typeof a.requiredPermission == "string" ? { requiredPermission: a.requiredPermission } : {}
276
+ fromStateId: String(o.fromState),
277
+ toStateId: String(o.toState),
278
+ name: String(o.actionName ?? ""),
279
+ ...typeof o.requiredPermission == "string" ? { requiredPermission: o.requiredPermission } : {}
280
280
  }))
281
281
  };
282
282
  }
283
- function Re(e, i) {
284
- const t = i.steps ?? [], a = i.connections ?? [];
285
- return U({
283
+ function Je(e, i) {
284
+ const t = i.steps ?? [], o = i.connections ?? [];
285
+ return W({
286
286
  ...i,
287
287
  displayName: "displayName" in i || e.name !== i.name ? e.name : void 0,
288
288
  entityName: e.entityType || i.entityName,
289
289
  steps: e.states.map((n) => {
290
- const s = t.find((l) => l.state === n.id), r = s ?? { state: n.id };
291
- return U({
292
- ...r,
290
+ const s = t.find((l) => l.state === n.id), a = s ?? { state: n.id };
291
+ return W({
292
+ ...a,
293
293
  displayName: s && "displayName" in s || n.name !== n.id ? n.name : void 0,
294
294
  isInitial: n.type === "initial" ? !0 : (s == null ? void 0 : s.isInitial) === !0 || s == null ? void 0 : s.isInitial,
295
295
  isFinal: n.type === "final" ? !0 : (s == null ? void 0 : s.isFinal) === !0 || s == null ? void 0 : s.isFinal
296
296
  });
297
297
  }),
298
298
  connections: e.transitions.map((n) => {
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
- return U({
301
- ...r ?? {},
299
+ const s = /^t(\d+)$/.exec(n.id), a = s ? o[Number(s[1])] : o.find((l) => l.fromState === n.fromStateId && l.toState === n.toStateId);
300
+ return W({
301
+ ...a ?? {},
302
302
  fromState: n.fromStateId,
303
303
  toState: n.toStateId,
304
- actionName: n.name || (r == null ? void 0 : r.actionName),
304
+ actionName: n.name || (a == null ? void 0 : a.actionName),
305
305
  requiredPermission: n.requiredPermission
306
306
  });
307
307
  })
308
308
  });
309
309
  }
310
- function lt(e, i) {
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
- const l = rt(t);
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)" };
310
+ function mt(e, i) {
311
+ const t = U(e) ? e : {}, o = J(t.name) ?? `#${i}`, n = J(t.displayName) ?? o, s = t.steps;
312
+ if (!(Array.isArray(t.connections) && Array.isArray(s) && s.every((y) => U(y) && typeof y.state == "string")))
313
+ return { key: o, label: n, source: e, rawReason: J(t.triggerType) ?? "automation" };
314
+ const l = ut(t);
315
+ return Ve(Je(l, t), e) ? { key: o, label: n, definition: l, source: e } : { key: o, label: n, source: e, rawReason: "state machine (round-trip)" };
316
316
  }
317
- function ct(e) {
317
+ function ft(e) {
318
318
  if (!e.definition)
319
319
  return e.source;
320
- const i = V(e.source) ? e.source : { name: e.definition.id };
321
- return Re(e.definition, {
320
+ const i = U(e.source) ? e.source : { name: e.definition.id };
321
+ return Je(e.definition, {
322
322
  ...i,
323
323
  name: i.name ?? e.definition.id
324
324
  });
325
325
  }
326
- const dt = Ae({
326
+ const yt = Pe({
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: B(".workflows.json"),
332
+ match: _(".workflows.json"),
333
333
  property: "workflows",
334
334
  itemKey: "name",
335
- toItem: lt,
336
- fromItem: ct
335
+ toItem: mt,
336
+ fromItem: ft
337
337
  });
338
- function pt(e) {
339
- const i = V(e) ? e : {};
338
+ function gt(e) {
339
+ const i = U(e) ? e : {};
340
340
  return {
341
341
  permissions: (i.permissions ?? []).map(
342
- (t) => U({
342
+ (t) => W({
343
343
  code: String(t.code ?? ""),
344
- name: G(t.name),
345
- description: G(t.description)
344
+ name: J(t.name),
345
+ description: J(t.description)
346
346
  })
347
347
  ),
348
348
  groups: (i.permissionGroups ?? []).map(
349
- (t) => U({
349
+ (t) => W({
350
350
  id: String(t.name ?? ""),
351
351
  label: String(t.name ?? ""),
352
- description: G(t.description),
352
+ description: J(t.description),
353
353
  permissions: Array.isArray(t.permissions) ? t.permissions : []
354
354
  })
355
355
  )
356
356
  };
357
357
  }
358
- function mt(e, i) {
359
- const t = V(e) ? e : {}, a = t.permissions ?? [], n = t.permissionGroups ?? [];
358
+ function ht(e, i) {
359
+ const t = U(e) ? e : {}, o = t.permissions ?? [], n = t.permissionGroups ?? [];
360
360
  return {
361
361
  ...t,
362
362
  permissions: i.permissions.map((s) => {
363
- const r = a.find((l) => l.code === s.code);
364
- return U({ ...r ?? {}, code: s.code, name: s.name, description: s.description });
363
+ const a = o.find((l) => l.code === s.code);
364
+ return W({ ...a ?? {}, code: s.code, name: s.name, description: s.description });
365
365
  }),
366
366
  permissionGroups: i.groups.map((s) => {
367
- const r = n.find((l) => l.name === s.id);
368
- return U({
369
- ...r ?? {},
367
+ const a = n.find((l) => l.name === s.id);
368
+ return W({
369
+ ...a ?? {},
370
370
  name: s.label,
371
371
  description: s.description,
372
372
  permissions: s.permissions
@@ -374,32 +374,32 @@ function mt(e, i) {
374
374
  })
375
375
  };
376
376
  }
377
- const ut = Le({
377
+ const wt = Re({
378
378
  id: "permissions",
379
379
  label: "Permissions",
380
380
  labelKey: "devStudio.kind.permissions",
381
381
  icon: "shield",
382
382
  editor: "permissions",
383
- match: B(".permissions.json"),
384
- select: pt,
385
- assign: mt,
383
+ match: _(".permissions.json"),
384
+ select: gt,
385
+ assign: ht,
386
386
  arrayKey: (e) => e === "/permissions" ? "code" : e === "/permissionGroups" ? "name" : void 0
387
- }), ft = Le({
387
+ }), vt = Re({
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: B(".seeds.json"),
393
+ match: _(".seeds.json"),
394
394
  select: (e) => {
395
- const i = V(e) ? e : {};
396
- if (!V(i.seeds) || i.demoSeeds !== void 0 && !V(i.demoSeeds))
395
+ const i = U(e) ? e : {};
396
+ if (!U(i.seeds) || i.demoSeeds !== void 0 && !U(i.demoSeeds))
397
397
  throw new Error("seeds is not an object of rows per entity");
398
- return U({ seeds: i.seeds, demoSeeds: i.demoSeeds });
398
+ return W({ seeds: i.seeds, demoSeeds: i.demoSeeds });
399
399
  },
400
- assign: (e, i) => U({ ...V(e) ? e : {}, seeds: i.seeds, demoSeeds: i.demoSeeds }),
400
+ assign: (e, i) => W({ ...U(e) ? e : {}, seeds: i.seeds, demoSeeds: i.demoSeeds }),
401
401
  arrayKey: () => "Id"
402
- }), yt = {
402
+ }), bt = {
403
403
  id: "script",
404
404
  label: "Script",
405
405
  labelKey: "devStudio.kind.script",
@@ -408,405 +408,962 @@ const ut = Le({
408
408
  match: (e) => /(^|\/)(services|scripts|jobs|handlers)\/[^/]+\.(js|ts|cs)$/i.test(e) || /\.cs$/i.test(e),
409
409
  decode: (e) => e[0].text,
410
410
  encode: (e, i) => ({
411
- files: [{ path: i[0].path, text: He(e, i[0].text) }]
411
+ files: [{ path: i[0].path, text: et(e, i[0].text) }]
412
412
  })
413
- }, gt = Je({
414
- match: B(".scripts.json"),
413
+ }, $t = Xe({
414
+ match: _(".scripts.json"),
415
415
  property: "scripts",
416
416
  phasesProperty: "scripts"
417
- }), ht = Oe({
417
+ }), St = Fe({
418
418
  id: "dataSources",
419
419
  label: "Data sources",
420
420
  labelKey: "devStudio.kind.dataSources",
421
421
  icon: "database",
422
422
  editor: "dataSources",
423
- match: B(".datasources.json"),
423
+ match: _(".datasources.json"),
424
424
  property: "dataSources",
425
425
  itemKey: "key"
426
- }), wt = [
427
- Ze,
428
- Qe,
429
- et,
430
- at,
431
- dt,
432
- ut,
433
- ft,
434
- ht,
435
- gt,
436
- yt
437
- ], vt = (e, i) => i, J = (e) => ({
438
- type: "array",
439
- title: e,
440
- items: { type: "string" }
441
- });
442
- function $t(e = vt, i = {}) {
443
- const t = (s, r) => e(`devStudio.omniverk.${s}`, r), a = {
444
- type: "object",
445
- properties: {
446
- key: { type: "string", title: t("field.key", "Key") },
447
- label: { type: "string", title: t("field.label", "Label") },
448
- description: { type: "string", title: t("field.description", "Description") },
449
- fieldType: {
450
- type: "string",
451
- title: t("field.fieldType", "Field type"),
452
- enum: ["text", "select", "toggle", "number", "password"]
453
- },
454
- defaultValue: { type: "string", title: t("field.defaultValue", "Default value") },
455
- isRequired: { type: "boolean", title: t("field.isRequired", "Required") },
456
- isSensitive: { type: "boolean", title: t("field.isSensitive", "Sensitive") },
457
- group: { type: "string", title: t("field.group", "Group") },
458
- validationPattern: {
459
- type: "string",
460
- title: t("field.validationPattern", "Validation pattern")
461
- }
426
+ }), kt = Ee({
427
+ id: "integrations",
428
+ label: "Integrations",
429
+ labelKey: "devStudio.kind.integrations",
430
+ icon: "plug",
431
+ editor: "integrations",
432
+ match: _(".integrations.json")
433
+ }), Nt = Ee({
434
+ id: "environments",
435
+ label: "Environment sets",
436
+ labelKey: "devStudio.kind.environments",
437
+ icon: "globe",
438
+ editor: "environments",
439
+ match: _(".environments.json")
440
+ }), jt = [
441
+ tt,
442
+ st,
443
+ ot,
444
+ pt,
445
+ yt,
446
+ wt,
447
+ vt,
448
+ St,
449
+ $t,
450
+ bt,
451
+ kt,
452
+ Nt
453
+ ], G = "Custom.", Oe = "Core", Tt = {
454
+ string: "string",
455
+ varchar: "string",
456
+ nvarchar: "string",
457
+ text: "text",
458
+ longtext: "text",
459
+ int: "int",
460
+ integer: "int",
461
+ int32: "int",
462
+ long: "long",
463
+ bigint: "long",
464
+ int64: "long",
465
+ decimal: "decimal",
466
+ double: "decimal",
467
+ float: "decimal",
468
+ number: "decimal",
469
+ currency: "currency",
470
+ money: "currency",
471
+ bool: "bool",
472
+ boolean: "bool",
473
+ datetime: "DateTime",
474
+ timestamp: "DateTime",
475
+ date: "DateOnly",
476
+ dateonly: "DateOnly",
477
+ time: "TimeOnly",
478
+ timeonly: "TimeOnly",
479
+ json: "json",
480
+ enum: "enum",
481
+ guid: "Guid",
482
+ uuid: "Guid"
483
+ }, Et = [
484
+ "string",
485
+ "text",
486
+ "int",
487
+ "long",
488
+ "decimal",
489
+ "currency",
490
+ "bool",
491
+ "DateTime",
492
+ "DateOnly",
493
+ "TimeOnly",
494
+ "json",
495
+ "enum",
496
+ "Guid"
497
+ ], It = {
498
+ ł: "l",
499
+ Ł: "L",
500
+ ß: "ss",
501
+ æ: "ae",
502
+ Æ: "AE",
503
+ ø: "o",
504
+ Ø: "O"
505
+ };
506
+ function xt(e) {
507
+ return [...e.normalize("NFD")].map((i) => It[i] ?? (new RegExp("\\p{Mn}", "u").test(i) ? "" : i)).join("").normalize("NFC");
508
+ }
509
+ function P(e) {
510
+ const i = xt(e ?? "").split(/[^A-Za-z0-9]+/).filter(Boolean).map((t) => t[0].toUpperCase() + t.slice(1)).join("");
511
+ return /^[0-9]/.test(i) ? `M${i}` : i;
512
+ }
513
+ const Ce = (e) => e !== e.toLowerCase() && e === e.toUpperCase();
514
+ function Se(e) {
515
+ return [...e].map(
516
+ (i, t) => t > 0 && Ce(i) && !Ce(e[t - 1]) ? `_${i.toLowerCase()}` : i.toLowerCase()
517
+ ).join("");
518
+ }
519
+ function Ot(e) {
520
+ return (e.startsWith(G) ? e.slice(G.length) : e.split(".").pop() ?? e).toLowerCase().replace(/[^a-z0-9_-]+/g, "") || "module";
521
+ }
522
+ async function _e(e) {
523
+ const i = await globalThis.crypto.subtle.digest("SHA-256", new TextEncoder().encode(e));
524
+ return new Uint8Array(i);
525
+ }
526
+ const Ie = (e) => Array.from(e, (i) => i.toString(16).padStart(2, "0")).join("");
527
+ async function fe(e, i) {
528
+ const t = (await _e(`${e}/${i}`.toLowerCase())).slice(0, 16), o = Ie([3, 2, 1, 0, 5, 4, 7, 6, 8, 9, 10, 11, 12, 13, 14, 15].map((n) => t[n]));
529
+ return `${o.slice(0, 8)}-${o.slice(8, 12)}-${o.slice(12, 16)}-${o.slice(16, 20)}-${o.slice(20)}`;
530
+ }
531
+ async function Be(e, i) {
532
+ const t = `custom_${e}_${Se(i)}`;
533
+ return t.length <= 63 ? t : `${t.slice(0, 54)}_${Ie(await _e(t)).slice(0, 8)}`;
534
+ }
535
+ function Ct(e, i) {
536
+ const t = new Set([...i].map((o) => o.toLowerCase()));
537
+ for (let o = 1; o < 100; o++) {
538
+ const n = o === 1 ? e : `${e}${o}`;
539
+ if (!t.has(n.toLowerCase()))
540
+ return n;
541
+ }
542
+ return e + Ie(globalThis.crypto.getRandomValues(new Uint8Array(3)));
543
+ }
544
+ const oe = (e) => e.name.toLowerCase() === "id", q = (e) => {
545
+ var i;
546
+ return (((i = e.displayName) == null ? void 0 : i.trim()) || e.name).trim();
547
+ };
548
+ function ae(e) {
549
+ return e.isForeignKey ? "Guid" : Tt[String(e.dataType ?? "").trim().toLowerCase()] ?? "string";
550
+ }
551
+ function ye(e) {
552
+ if (e.isForeignKey)
553
+ return ["Reference", "lookup"];
554
+ switch (ae(e)) {
555
+ case "text":
556
+ case "json":
557
+ return ["Text", "textarea"];
558
+ case "int":
559
+ case "long":
560
+ case "decimal":
561
+ return ["Number", "number"];
562
+ case "currency":
563
+ return ["Currency", "currency"];
564
+ case "bool":
565
+ return ["Boolean", "toggle"];
566
+ case "DateTime":
567
+ return ["DateTime", "datetime"];
568
+ case "DateOnly":
569
+ return ["Date", "date"];
570
+ default:
571
+ return ["Text", "input"];
572
+ }
573
+ }
574
+ const At = {
575
+ lookup: "EntitySelect",
576
+ textarea: "Textarea",
577
+ number: "number",
578
+ currency: "number",
579
+ toggle: "Toggle",
580
+ date: "date",
581
+ datetime: "datetime"
582
+ };
583
+ function Lt(e) {
584
+ var o;
585
+ const i = [];
586
+ (!((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.");
587
+ const t = /* @__PURE__ */ new Set();
588
+ for (const n of e.entities) {
589
+ const s = P(n.name);
590
+ if (s.length === 0) {
591
+ i.push(`Entity "${n.name}" needs a name with letters or digits.`);
592
+ continue;
462
593
  }
463
- }, n = [
464
- {
465
- id: "general",
466
- title: t("section.general", "General"),
467
- schema: {
468
- type: "object",
469
- properties: {
470
- packageName: { type: "string", title: t("field.packageName", "Package name") },
471
- version: { type: "string", title: t("field.version", "Version") },
472
- displayName: { type: "string", title: t("field.displayName", "Display name") },
473
- description: { type: "string", title: t("field.description", "Description") },
474
- category: { type: "string", title: t("field.category", "Category") },
475
- subCategory: { type: "string", title: t("field.subCategory", "Sub-category") },
476
- icon: { type: "string", title: t("field.icon", "Icon") },
477
- author: { type: "string", title: t("field.author", "Author") },
478
- license: { type: "string", title: t("field.license", "License") },
479
- // seeds use free, standard, premium, pro, professional, core, enterprise, community…
480
- tier: { type: "string", title: t("field.tier", "Tier") },
481
- isCore: { type: "boolean", title: t("field.isCore", "Core module") },
482
- allowMultipleInstances: {
483
- type: "boolean",
484
- title: t("field.allowMultipleInstances", "Allow several instances")
485
- },
486
- defaultInstanceName: {
487
- type: "string",
488
- title: t("field.defaultInstanceName", "Default instance name")
489
- }
490
- },
491
- required: ["packageName", "version", "category"]
594
+ t.has(s.toLowerCase()) && i.push(`Entity ${s} appears twice.`), t.add(s.toLowerCase());
595
+ const a = n.fields.filter((y) => !oe(y));
596
+ a.length === 0 && i.push(`Entity ${s} has no fields — add at least one.`);
597
+ const l = /* @__PURE__ */ new Set();
598
+ for (const y of a) {
599
+ const p = P(y.name);
600
+ p.length === 0 ? i.push(`${s}: field "${y.name}" needs a name with letters or digits.`) : l.has(p.toLowerCase()) ? i.push(`${s}: field ${p} appears twice.`) : l.add(p.toLowerCase());
601
+ }
602
+ }
603
+ return i;
604
+ }
605
+ const Mt = (e) => e.toISOString().replace(/\.(\d{3})Z$/, ".$10000Z"), ee = (e) => le(e, { finalNewline: !1 }), Z = (e, i) => ({
606
+ icon: { name: e, package: "@nice2dev/icons", style: i }
607
+ });
608
+ function Dt(e) {
609
+ const i = e && /^Ntd[A-Z]/.test(e), t = e && /^[A-Z]\w*Icon$/.test(e);
610
+ return {
611
+ module: {
612
+ icon: {
613
+ name: i || t ? e : "NtdGrid",
614
+ package: t ? "@nice2dev/icons-business" : "@nice2dev/icons",
615
+ style: "duotone"
492
616
  },
493
- // a module's description runs to several sentences (1.3.14: it was a one-line field)
494
- uiSchema: { description: { type: "textarea" } }
617
+ animation: { type: "none" }
495
618
  },
496
- {
497
- id: "modules",
498
- title: t("section.modules", "Units"),
499
- schema: {
500
- type: "object",
501
- properties: {
502
- modules: {
503
- type: "array",
504
- title: t("field.modules", "Units"),
505
- items: {
506
- type: "object",
507
- properties: {
508
- name: { type: "string", title: t("field.name", "Name") },
509
- displayName: { type: "string", title: t("field.displayName", "Display name") },
510
- description: { type: "string", title: t("field.description", "Description") },
511
- icon: { type: "string", title: t("field.icon", "Icon") },
512
- color: { type: "string", title: t("field.color", "Colour") },
513
- parts: J(t("field.parts", "Files"))
514
- }
515
- }
516
- },
517
- i18n: J(t("field.i18n", "Translation files"))
518
- }
519
- }
619
+ entities: {},
620
+ views: { list: Z("NtdList", "outline"), form: Z("NtdEdit", "outline") },
621
+ permissions: {
622
+ read: Z("NtdEye", "outline"),
623
+ create: Z("NtdPlus", "outline"),
624
+ update: Z("NtdEdit", "outline"),
625
+ delete: Z("NtdTrash", "outline"),
626
+ admin: Z("NtdShield", "solid")
520
627
  },
521
- {
522
- id: "dependencies",
523
- title: t("section.dependencies", "Dependencies"),
524
- schema: {
525
- type: "object",
526
- properties: {
527
- dependencies: J(t("field.dependencies", "Required packages")),
528
- dependencyRefs: {
529
- type: "array",
530
- title: t("field.dependencyRefs", "Dependency details"),
531
- items: {
532
- type: "object",
533
- properties: {
534
- package: { type: "string", title: t("field.package", "Package") },
535
- isOptional: { type: "boolean", title: t("field.isOptional", "Optional") },
536
- minVersion: { type: "string", title: t("field.minVersion", "Minimum version") },
537
- reason: { type: "string", title: t("field.reason", "Reason") },
538
- relationKind: {
539
- type: "string",
540
- title: t("field.relationKind", "Relation"),
541
- enum: ["operational", "job", "event", "data-flow", "config"]
542
- },
543
- dataFlowDirection: {
544
- type: "string",
545
- title: t("field.dataFlowDirection", "Data flow")
546
- },
547
- instanceBinding: {
548
- type: "string",
549
- title: t("field.instanceBinding", "Instance binding")
550
- }
551
- }
552
- }
553
- },
554
- provides: J(t("field.provides", "Provides")),
555
- requiredControls: J(t("field.requiredControls", "Required controls"))
628
+ workflowStates: {}
629
+ };
630
+ }
631
+ async function Kt(e, i = {}) {
632
+ var b, g, E, C;
633
+ const t = Lt(e);
634
+ if (t.length > 0)
635
+ return { problems: t };
636
+ const o = e.name.toLowerCase().startsWith(G.toLowerCase()), n = P(
637
+ o ? e.name.slice(G.length) : e.name
638
+ ), s = Ct(
639
+ G + n,
640
+ i.existingPackageNames ?? /* @__PURE__ */ new Set()
641
+ ), a = s.slice(G.length), l = a.toLowerCase(), y = `${s}.${Oe}`, p = o ? a : e.name.trim(), u = ((b = e.description) == null ? void 0 : b.trim()) || void 0, N = e.entities.map((h) => ({ ...h, name: P(h.name) })), L = e.views !== !1, I = e.permissions !== !1, x = [.../* @__PURE__ */ new Set(["en", "pl", ...e.locales ?? []])], O = e.icon ?? "widgets", w = [], T = [
642
+ `${l}.entities.json`,
643
+ ...L ? [`${l}.views.json`] : [],
644
+ ...I ? [`${l}.permissions.json`] : []
645
+ ];
646
+ w.push({
647
+ path: `${l}.manifest.json`,
648
+ text: ee({
649
+ packageName: s,
650
+ version: "1.0.0",
651
+ displayName: p,
652
+ description: u ?? p,
653
+ author: "OmniVerk Module Builder",
654
+ license: "Proprietary",
655
+ category: ((g = e.category) == null ? void 0 : g.trim()) || "Custom",
656
+ icon: O,
657
+ exportedAt: Mt((i.now ?? (() => /* @__PURE__ */ new Date()))()),
658
+ modules: [
659
+ {
660
+ name: Oe,
661
+ displayName: p,
662
+ description: e.description ?? p,
663
+ icon: O,
664
+ parts: T
556
665
  }
557
- }
558
- },
666
+ ],
667
+ dependencies: ["Core.Users"],
668
+ i18n: x.map((h) => `${l}.${h}.i18n.json`),
669
+ ...e.ownerTenantId ? { ownerTenantId: e.ownerTenantId } : {},
670
+ ...e.sourceDefinitionId ? { sourceDefinitionId: e.sourceDefinitionId } : {}
671
+ })
672
+ });
673
+ const m = [];
674
+ for (const h of N) {
675
+ const S = [{ name: "Id", displayName: "ID", dataType: "Guid", isPrimaryKey: !0 }];
676
+ for (const d of h.fields.filter((j) => !oe(j))) {
677
+ const j = ae(d), r = {
678
+ name: P(d.name),
679
+ displayName: q(d),
680
+ dataType: j
681
+ };
682
+ j === "string" && (r.maxLength = d.maxLength && d.maxLength > 0 ? d.maxLength : 200), d.isRequired && (r.isRequired = !0), d.isUnique && (r.isUnique = !0), (d.isIndexed || d.isForeignKey) && (r.isIndexed = !0), d.isForeignKey && (r.isForeignKey = !0, d.referencedEntity && (r.referencedEntity = P(d.referencedEntity))), (E = d.defaultValue) != null && E.trim() && (r.defaultValue = d.defaultValue), (C = d.description) != null && C.trim() && (r.description = d.description), S.push(r);
683
+ }
684
+ m.push({
685
+ id: await fe(s, h.name),
686
+ name: h.name,
687
+ displayName: q(h),
688
+ tableName: await Be(l, h.name),
689
+ description: h.description ?? q(h),
690
+ entityIcon: h.icon ?? "table_rows",
691
+ isAudited: !0,
692
+ isSoftDeleteEnabled: !1,
693
+ fields: S
694
+ });
695
+ }
696
+ if (w.push({
697
+ path: `${l}.entities.json`,
698
+ text: ee({ moduleName: y, version: "1.0.0", entities: m })
699
+ }), L) {
700
+ const h = (d) => {
701
+ const j = N.find((c) => c.name === P(d)), r = j == null ? void 0 : j.fields.find(
702
+ (c) => !oe(c) && !c.isForeignKey && ae(c) === "string"
703
+ );
704
+ return r ? P(r.name) : "Name";
705
+ }, S = [];
706
+ for (const d of N) {
707
+ const j = d.fields.filter((f) => !oe(f)), r = j.filter((f) => !["text", "json"].includes(ae(f))).slice(0, 6), c = (r.length ? r : [j[0]]).map((f) => ({
708
+ field: P(f.name),
709
+ displayName: q(f),
710
+ sortable: !0,
711
+ type: ye(f)[0],
712
+ ...f.isForeignKey && f.referencedEntity ? { referencedEntity: P(f.referencedEntity) } : {}
713
+ })), v = j.filter((f) => ["string", "text"].includes(ae(f))).map((f) => P(f.name)), $ = j.map((f) => ({
714
+ field: P(f.name),
715
+ type: At[ye(f)[1]] ?? "TextInput",
716
+ label: q(f),
717
+ ...f.isRequired ? { required: !0 } : {},
718
+ ...f.isForeignKey && f.referencedEntity ? {
719
+ entity: P(f.referencedEntity),
720
+ displayField: h(f.referencedEntity)
721
+ } : {}
722
+ }));
723
+ S.push({
724
+ id: `vw-${l}-${Se(d.name)}-list`,
725
+ name: `${d.name}List`,
726
+ displayName: q(d),
727
+ type: "List",
728
+ icon: "list",
729
+ entityName: d.name,
730
+ columns: c,
731
+ searchFields: v,
732
+ pageSize: 25,
733
+ createControls: $,
734
+ allowEdit: !0,
735
+ allowDelete: !0
736
+ });
737
+ const A = j.map((f) => {
738
+ const k = ye(f)[1];
739
+ return {
740
+ field: P(f.name),
741
+ type: k,
742
+ label: q(f),
743
+ colSpan: k === "textarea" ? 12 : 6,
744
+ ...f.isRequired ? { required: !0 } : {},
745
+ ...f.isForeignKey && f.referencedEntity ? { entity: P(f.referencedEntity) } : {}
746
+ };
747
+ });
748
+ S.push({
749
+ id: `vw-${l}-${Se(d.name)}-form`,
750
+ name: `${d.name}Form`,
751
+ displayName: q(d),
752
+ type: "Form",
753
+ icon: "edit",
754
+ entityName: d.name,
755
+ tabs: [
756
+ {
757
+ name: "Main",
758
+ displayName: q(d),
759
+ sections: [{ name: "Details", displayName: "Details", controls: A }]
760
+ }
761
+ ]
762
+ });
763
+ }
764
+ w.push({
765
+ path: `${l}.views.json`,
766
+ text: ee({ moduleName: y, version: "1.0.0", views: S })
767
+ });
768
+ }
769
+ if (I) {
770
+ const h = (j) => `${a}.${j}`, S = (j, r) => ({
771
+ code: h(j),
772
+ name: `${p} — ${r}`,
773
+ description: `${r}: ${p}`
774
+ }), d = (j, r, ...c) => ({
775
+ name: `${G}${a} ${j}`,
776
+ description: `${p} — ${r}`,
777
+ permissions: c.map(h)
778
+ });
779
+ w.push({
780
+ path: `${l}.permissions.json`,
781
+ text: ee({
782
+ moduleName: y,
783
+ version: "1.0.0",
784
+ permissions: [
785
+ S("Read", "view records"),
786
+ S("Create", "add records"),
787
+ S("Edit", "edit records"),
788
+ S("Delete", "delete records"),
789
+ S("Admin", "administer the module")
790
+ ],
791
+ permissionGroups: [
792
+ d("Viewer", "read only", "Read"),
793
+ d("Editor", "read and edit", "Read", "Create", "Edit"),
794
+ d("Admin", "full access", "Read", "Create", "Edit", "Delete", "Admin")
795
+ ]
796
+ })
797
+ });
798
+ }
799
+ for (const h of x) {
800
+ const S = {
801
+ "module.displayName": p,
802
+ "module.description": u ?? p
803
+ };
804
+ for (const d of N) {
805
+ S[`entity.${d.name}.displayName`] = q(d);
806
+ for (const j of d.fields.filter((r) => !oe(r)))
807
+ S[`field.${d.name}.${P(j.name)}.displayName`] = q(j);
808
+ L && (S[`view.${d.name}List.displayName`] = q(d), S[`view.${d.name}Form.displayName`] = q(d), S[`view.${d.name}Form.tab.Main`] = q(d), S[`view.${d.name}Form.section.Details`] = h === "pl" ? "Szczegóły" : "Details");
809
+ }
810
+ w.push({
811
+ path: `${l}.${h}.i18n.json`,
812
+ text: ee({ moduleName: s, locale: h, version: "1.0.0", translations: S })
813
+ });
814
+ }
815
+ return e.iconConfig !== !1 && w.push({ path: `${l}.iconconfig.json`, text: ee(Dt(e.icon)) }), { package: { packageName: s, folder: `Custom/${a}`, files: w }, problems: [] };
816
+ }
817
+ function Ft(e) {
818
+ const i = (t) => typeof t == "string" && t ? t : void 0;
819
+ return {
820
+ name: e.name,
821
+ description: e.description,
822
+ category: e.packageId,
823
+ icon: e.icon,
824
+ locales: e.locales,
825
+ views: e.views,
826
+ permissions: e.permissions,
827
+ entities: e.entities.map((t) => ({
828
+ name: String(t.name ?? ""),
829
+ displayName: i(t.displayName),
830
+ description: i(t.description),
831
+ icon: i(t.entityIcon) ?? i(t.icon),
832
+ fields: (Array.isArray(t.fields) ? t.fields : []).map((o) => ({
833
+ name: String(o.name ?? ""),
834
+ displayName: i(o.displayName),
835
+ dataType: i(o.dataType) ?? i(o.type),
836
+ isRequired: o.isRequired === !0 || o.required === !0,
837
+ maxLength: typeof o.maxLength == "number" ? o.maxLength : void 0,
838
+ isUnique: o.isUnique === !0,
839
+ isIndexed: o.isIndexed === !0,
840
+ isForeignKey: o.isForeignKey === !0,
841
+ referencedEntity: i(o.referencedEntity),
842
+ defaultValue: o.defaultValue === void 0 || o.defaultValue === null ? void 0 : String(o.defaultValue),
843
+ description: i(o.description)
844
+ }))
845
+ }))
846
+ };
847
+ }
848
+ const Y = (e) => typeof e == "object" && e !== null && !Array.isArray(e);
849
+ function ke(e, i) {
850
+ return typeof e == "string" ? i(e) : Array.isArray(e) ? e.map((t) => ke(t, i)) : Y(e) ? Object.fromEntries(Object.entries(e).map(([t, o]) => [t, ke(o, i)])) : e;
851
+ }
852
+ const Pt = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
853
+ async function Rt(e, i) {
854
+ const t = e.find(
855
+ (w) => !w.path.includes("/") && w.path.toLowerCase().endsWith(".manifest.json")
856
+ );
857
+ if (!t)
858
+ throw new Error("The module has no manifest.");
859
+ const o = z(t.text).value, n = String(o.packageName ?? ""), s = t.path.slice(0, -14), a = i.id, l = Ot(a), y = (w) => w.startsWith(G) ? w.slice(G.length) : w.split(".").pop() ?? w, p = y(n), u = y(a), N = (w) => w.startsWith(`${s}.`) ? `${l}${w.slice(s.length)}` : w, L = new Map(e.map((w) => [w.path, N(w.path)])), I = /* @__PURE__ */ new Map();
860
+ for (const w of e.filter((T) => T.path.toLowerCase().endsWith(".permissions.json")))
861
+ try {
862
+ const T = z(w.text).value;
863
+ for (const m of Y(T) && Array.isArray(T.permissions) ? T.permissions : []) {
864
+ const b = typeof m.code == "string" ? m.code : "";
865
+ b.startsWith(`${p}.`) && I.set(b, `${u}${b.slice(p.length)}`);
866
+ }
867
+ } catch {
868
+ }
869
+ const x = (w) => n && (w === n || w.startsWith(`${n}.`) || w.startsWith(`${n} `)) ? a + w.slice(n.length) : I.get(w) ?? L.get(w) ?? w, O = [];
870
+ for (const w of e) {
871
+ if (w.path.startsWith(".revisions/"))
872
+ continue;
873
+ const T = N(w.path);
874
+ if (!w.path.toLowerCase().endsWith(".json")) {
875
+ O.push({ path: T, text: w.text });
876
+ continue;
877
+ }
878
+ let m;
879
+ try {
880
+ m = z(w.text).value;
881
+ } catch {
882
+ O.push({ path: T, text: w.text });
883
+ continue;
884
+ }
885
+ let b = ke(m, x);
886
+ if (w === t && Y(b)) {
887
+ const { sourceDefinitionId: g, ...E } = b;
888
+ b = {
889
+ ...E,
890
+ packageName: a,
891
+ ...i.name ? { displayName: i.name } : {},
892
+ ...i.packageId ? { category: i.packageId } : {}
893
+ };
894
+ }
895
+ if (w.path.toLowerCase().endsWith(".entities.json") && Y(b) && Array.isArray(b.entities)) {
896
+ const g = [];
897
+ for (const E of b.entities) {
898
+ if (!Y(E) || typeof E.name != "string") {
899
+ g.push(E);
900
+ continue;
901
+ }
902
+ g.push({
903
+ ...E,
904
+ ...typeof E.id == "string" && Pt.test(E.id) ? { id: await fe(a, E.name) } : {},
905
+ ...typeof E.tableName == "string" ? { tableName: await Be(l, E.name) } : {}
906
+ });
907
+ }
908
+ b = { ...b, entities: g };
909
+ }
910
+ i.name && /\.en\.i18n\.json$/i.test(w.path) && Y(b) && Y(b.translations) && typeof b.translations["module.displayName"] == "string" && (b = {
911
+ ...b,
912
+ translations: { ...b.translations, "module.displayName": i.name }
913
+ }), O.push({ path: T, text: qe(w.text, b) });
914
+ }
915
+ return {
916
+ id: a,
917
+ packageId: i.packageId ?? o.category,
918
+ files: O
919
+ };
920
+ }
921
+ const ce = (e) => !!e && typeof e == "object" && !Array.isArray(e), B = (e) => Array.isArray(e) ? e.filter(ce) : [], V = (e) => typeof e == "string" && e ? e : void 0;
922
+ function Vt(e) {
923
+ const i = /* @__PURE__ */ new Map();
924
+ for (const o of B(e.integrations))
925
+ for (const n of B(o.providers))
926
+ for (const s of B(n.fields)) {
927
+ const a = V(s.key);
928
+ !a || i.has(a) || i.set(a, {
929
+ key: a,
930
+ description: V(s.label) ?? V(s.description),
931
+ secret: s.isSensitive === !0 || s.fieldType === "password" || void 0,
932
+ required: s.isRequired === !0 || void 0,
933
+ defaultValue: s.isSensitive === !0 ? void 0 : V(s.defaultValue)
934
+ });
935
+ }
936
+ const t = ce(e.deployment) ? e.deployment : {};
937
+ for (const o of B(t.envVars)) {
938
+ const n = V(o.key);
939
+ !n || i.has(n) || i.set(n, { key: n, description: V(o.description), defaultValue: V(o.defaultValue) });
940
+ }
941
+ return [...i.values()];
942
+ }
943
+ function vi(e, i) {
944
+ const t = ce(e.deployment) ? e.deployment : {}, o = new Map(B(t.envVars).map((s) => [V(s.key) ?? "", s])), n = i.filter((s) => !s.secret && s.key).map((s) => {
945
+ const a = { ...o.get(s.key) ?? {}, key: s.key };
946
+ return s.defaultValue !== void 0 ? a.defaultValue = s.defaultValue : delete a.defaultValue, s.description && (a.description = s.description), a;
947
+ });
948
+ return { ...e, deployment: { ...t, envVars: n } };
949
+ }
950
+ const qt = {
951
+ Anonymous: "none",
952
+ User: "session",
953
+ Admin: "session"
954
+ };
955
+ function Ut(e, i) {
956
+ const t = e.replace(/\/+$/, ""), o = i.replace(/^\/+/, "");
957
+ return o ? `${t}/${o}` : t || "/";
958
+ }
959
+ function Wt(e) {
960
+ const i = ce(e.scripting) ? e.scripting : {}, t = [];
961
+ for (const o of B(i.controllers)) {
962
+ const n = V(o.route) ?? "";
963
+ for (const s of B(o.actions)) {
964
+ const a = (V(s.verb) ?? "GET").toUpperCase(), l = Ut(n, V(s.path) ?? ""), y = V(s.auth) ?? V(o.auth);
965
+ t.push({
966
+ key: `${a} ${l}`,
967
+ method: a,
968
+ path: l,
969
+ handler: V(s.handler),
970
+ auth: y ? qt[y] ?? "session" : void 0
971
+ });
972
+ }
973
+ }
974
+ return t;
975
+ }
976
+ function Gt(e, i) {
977
+ const t = Wt(e), o = i.flatMap((l) => l.expose ?? []), n = (l) => `${l.method.toUpperCase()} ${l.path.replace(/\/+$/, "")}`, s = new Set(t.map(n)), a = new Set(o.map(n));
978
+ return {
979
+ missingInControllers: o.filter((l) => !s.has(n(l))),
980
+ notExposed: t.filter((l) => !a.has(n(l)))
981
+ };
982
+ }
983
+ function bi(e, i) {
984
+ const t = ce(e.scripting) ? e.scripting : {}, o = B(t.controllers).map((s) => ({
985
+ ...s,
986
+ actions: [...B(s.actions)]
987
+ })), { missingInControllers: n } = Gt(e, i);
988
+ for (const s of n) {
989
+ const a = s.path.replace(/^\/+/, "").split("/"), l = `/${a[0] ?? ""}`;
990
+ let y = o.find((p) => V(p.route) === l);
991
+ y || (y = { route: l, actions: [] }, o.push(y)), y.actions.push({
992
+ verb: s.method.toUpperCase(),
993
+ path: a.slice(1).join("/"),
994
+ handler: s.handler ?? "",
995
+ auth: s.auth === "none" || s.auth === "signature" || s.auth === "apiKey" ? "Anonymous" : "User"
996
+ });
997
+ }
998
+ return { ...e, scripting: { ...t, controllers: o } };
999
+ }
1000
+ function ze(e) {
1001
+ const i = [];
1002
+ for (const t of e) {
1003
+ const o = t;
1004
+ o.kind === "folder" || Array.isArray(o.items) ? i.push(...ze(o.items ?? [])) : i.push(o);
1005
+ }
1006
+ return i;
1007
+ }
1008
+ const ge = (e) => {
1009
+ switch (e == null ? void 0 : e.type) {
1010
+ case "bearer":
1011
+ return "Bearer";
1012
+ case "basic":
1013
+ return "Basic";
1014
+ case "apiKey":
1015
+ return "ApiKey";
1016
+ case "oauth2":
1017
+ return "OAuth2";
1018
+ case "digest":
1019
+ return "Digest";
1020
+ case "awsSigV4":
1021
+ return "AwsSigV4";
1022
+ case "hmac":
1023
+ return "Hmac";
1024
+ case void 0:
1025
+ case "none":
1026
+ return "None";
1027
+ default:
1028
+ return "Custom";
1029
+ }
1030
+ };
1031
+ function Jt(e, i) {
1032
+ let t = (e ?? "").split("?")[0];
1033
+ return i && t.startsWith(i) && (t = t.slice(i.length)), t = t.replace(/^\{\{[^}]+\}\}/, "").replace(/^[a-z][\w+.-]*:\/\/[^/]*/i, ""), t.startsWith("/") ? t : `/${t}`;
1034
+ }
1035
+ async function $i(e) {
1036
+ var t, o, n, s, a, l, y, p, u, N, L, I, x, O;
1037
+ const i = {
1038
+ RESTConnection: [],
1039
+ RESTEndpointDefinition: [],
1040
+ SOAPConnection: [],
1041
+ SOAPSavedCall: [],
1042
+ GraphQLEndpoint: [],
1043
+ GraphQLSavedQuery: []
1044
+ };
1045
+ for (const w of e) {
1046
+ const T = w.connection, m = await fe("integration", w.key), b = (h, S) => fe("integration", `${w.key}/${h.id ?? S}`), g = ze(w.endpoints.items), E = (h) => {
1047
+ var S;
1048
+ return (S = w.operations) == null ? void 0 : S.find((d) => d.endpoint && d.endpoint === h);
1049
+ }, C = (h) => h != null && h.startsWith("schedule:") ? h.slice(9) : void 0;
1050
+ if (T.protocol === "soap") {
1051
+ i.SOAPConnection.push({
1052
+ Id: m,
1053
+ Name: w.name,
1054
+ WsdlUrl: T.baseUrl,
1055
+ EndpointUrl: T.baseUrl,
1056
+ SoapVersion: ((o = (t = g.find((h) => {
1057
+ var S;
1058
+ return (S = h.body) == null ? void 0 : S.version;
1059
+ })) == null ? void 0 : t.body) == null ? void 0 : o.version) ?? "1.1",
1060
+ AuthType: ge(T.auth),
1061
+ AuthConfigJson: T.auth ? JSON.stringify(T.auth) : void 0,
1062
+ TimeoutSeconds: T.timeoutMs ? Math.ceil(T.timeoutMs / 1e3) : void 0,
1063
+ IsActive: !0
1064
+ });
1065
+ for (const [h, S] of g.entries()) {
1066
+ const d = E(S.id);
1067
+ i.SOAPSavedCall.push({
1068
+ Id: await b(S, h),
1069
+ ConnectionId: m,
1070
+ Name: S.name ?? `Call ${h + 1}`,
1071
+ Description: S.description,
1072
+ ServiceName: w.name,
1073
+ OperationName: S.name ?? `Call${h + 1}`,
1074
+ SoapAction: (n = S.body) == null ? void 0 : n.action,
1075
+ InputTemplateXml: (s = S.body) == null ? void 0 : s.envelope,
1076
+ LocalEntityName: d == null ? void 0 : d.target,
1077
+ FieldMappingsJson: d != null && d.mapping ? JSON.stringify(d.mapping) : void 0,
1078
+ SyncCronExpression: C(d == null ? void 0 : d.trigger),
1079
+ SyncEnabled: !!C(d == null ? void 0 : d.trigger),
1080
+ SortOrder: h,
1081
+ IsActive: !0
1082
+ });
1083
+ }
1084
+ continue;
1085
+ }
1086
+ if (T.protocol === "graphql") {
1087
+ i.GraphQLEndpoint.push({
1088
+ Id: m,
1089
+ Name: w.name,
1090
+ EndpointUrl: T.baseUrl,
1091
+ AuthType: ge(T.auth),
1092
+ CustomHeaders: (a = T.headers) != null && a.length ? JSON.stringify(Object.fromEntries(T.headers.map((h) => [h.key, h.value]))) : void 0,
1093
+ TimeoutSeconds: T.timeoutMs ? Math.ceil(T.timeoutMs / 1e3) : void 0,
1094
+ IsEnabled: !0
1095
+ });
1096
+ for (const [h, S] of g.entries()) {
1097
+ const d = E(S.id), j = ((l = S.body) == null ? void 0 : l.query) ?? "";
1098
+ i.GraphQLSavedQuery.push({
1099
+ Id: await b(S, h),
1100
+ GraphQLEndpointId: m,
1101
+ Name: S.name ?? `Query ${h + 1}`,
1102
+ OperationType: /^\s*mutation/.test(j) ? "mutation" : /^\s*subscription/.test(j) ? "subscription" : "query",
1103
+ QueryText: j,
1104
+ DefaultVariables: (y = S.body) == null ? void 0 : y.variables,
1105
+ LocalEntityName: d == null ? void 0 : d.target,
1106
+ FieldMappings: d != null && d.mapping ? JSON.stringify(d.mapping) : void 0,
1107
+ IsScheduled: !!C(d == null ? void 0 : d.trigger),
1108
+ CronExpression: C(d == null ? void 0 : d.trigger)
1109
+ });
1110
+ }
1111
+ continue;
1112
+ }
1113
+ if (!(T.protocol !== "rest" && T.protocol !== "odata" && T.protocol !== "webhook")) {
1114
+ i.RESTConnection.push({
1115
+ Id: m,
1116
+ Name: w.name,
1117
+ BaseUrl: T.baseUrl,
1118
+ AuthType: ge(T.auth),
1119
+ AuthConfigJson: T.auth ? JSON.stringify(T.auth) : void 0,
1120
+ DefaultHeadersJson: (p = T.headers) != null && p.length ? JSON.stringify(Object.fromEntries(T.headers.map((h) => [h.key, h.value]))) : void 0,
1121
+ PaginationType: ((u = T.pagination) == null ? void 0 : u.style) ?? "None",
1122
+ PaginationConfigJson: T.pagination ? JSON.stringify(T.pagination) : void 0,
1123
+ RateLimitMaxRequests: T.rateLimit,
1124
+ RateLimitWindowSeconds: T.rateLimit ? 1 : void 0,
1125
+ TimeoutSeconds: T.timeoutMs ? Math.ceil(T.timeoutMs / 1e3) : void 0,
1126
+ RetryCount: (N = T.retry) == null ? void 0 : N.attempts,
1127
+ RetryBackoffMs: (L = T.retry) == null ? void 0 : L.delayMs,
1128
+ WebhookPath: (x = (I = w.expose) == null ? void 0 : I.find((h) => h.auth === "signature")) == null ? void 0 : x.path,
1129
+ IsActive: !0
1130
+ });
1131
+ for (const [h, S] of g.entries()) {
1132
+ const d = E(S.id), j = (S.params ?? []).filter((c) => c.in === "query" && c.enabled !== !1), r = (S.params ?? []).filter((c) => c.in === "header" && c.enabled !== !1);
1133
+ i.RESTEndpointDefinition.push({
1134
+ Id: await b(S, h),
1135
+ ConnectionId: m,
1136
+ Name: S.name ?? `Endpoint ${h + 1}`,
1137
+ Description: S.description,
1138
+ HttpMethod: (S.method ?? "GET").toUpperCase(),
1139
+ PathTemplate: Jt(S.url, T.baseUrl),
1140
+ QueryParamsJson: j.length ? JSON.stringify(Object.fromEntries(j.map((c) => [c.key, c.value]))) : void 0,
1141
+ HeadersJson: r.length ? JSON.stringify(Object.fromEntries(r.map((c) => [c.key, c.value]))) : void 0,
1142
+ BodyTemplate: (O = S.body) == null ? void 0 : O.text,
1143
+ LocalEntityName: d == null ? void 0 : d.target,
1144
+ FieldMappingsJson: d != null && d.mapping ? JSON.stringify(d.mapping) : void 0,
1145
+ SyncDirection: d ? "Inbound" : void 0,
1146
+ SyncCronExpression: C(d == null ? void 0 : d.trigger),
1147
+ SyncEnabled: !!C(d == null ? void 0 : d.trigger),
1148
+ ConflictResolution: d == null ? void 0 : d.conflict,
1149
+ SortOrder: h,
1150
+ IsActive: !0
1151
+ });
1152
+ }
1153
+ }
1154
+ }
1155
+ for (const w of Object.values(i))
1156
+ w.forEach((T, m) => {
1157
+ w[m] = Object.fromEntries(Object.entries(T).filter(([, b]) => b !== void 0));
1158
+ });
1159
+ return i;
1160
+ }
1161
+ const _t = (e, i) => i, Q = (e) => ({
1162
+ type: "array",
1163
+ title: e,
1164
+ items: { type: "string" }
1165
+ });
1166
+ function Bt(e = _t, i = {}) {
1167
+ const t = (s, a) => e(`devStudio.omniverk.${s}`, a), o = {
1168
+ type: "object",
1169
+ properties: {
1170
+ key: { type: "string", title: t("field.key", "Key") },
1171
+ label: { type: "string", title: t("field.label", "Label") },
1172
+ description: { type: "string", title: t("field.description", "Description") },
1173
+ fieldType: {
1174
+ type: "string",
1175
+ title: t("field.fieldType", "Field type"),
1176
+ enum: ["text", "select", "toggle", "number", "password"]
1177
+ },
1178
+ defaultValue: { type: "string", title: t("field.defaultValue", "Default value") },
1179
+ isRequired: { type: "boolean", title: t("field.isRequired", "Required") },
1180
+ isSensitive: { type: "boolean", title: t("field.isSensitive", "Sensitive") },
1181
+ group: { type: "string", title: t("field.group", "Group") },
1182
+ validationPattern: {
1183
+ type: "string",
1184
+ title: t("field.validationPattern", "Validation pattern")
1185
+ }
1186
+ }
1187
+ }, n = [
559
1188
  {
560
- id: "setup",
561
- title: t("section.setup", "Installation"),
1189
+ id: "general",
1190
+ title: t("section.general", "General"),
562
1191
  schema: {
563
1192
  type: "object",
564
1193
  properties: {
565
- setupWizard: {
566
- type: "array",
567
- title: t("field.setupWizard", "Setup wizard steps"),
568
- items: {
569
- type: "object",
570
- properties: {
571
- stepId: { type: "string", title: t("field.stepId", "Step id") },
572
- name: { type: "string", title: t("field.name", "Name") },
573
- description: { type: "string", title: t("field.description", "Description") },
574
- icon: { type: "string", title: t("field.icon", "Icon") },
575
- isOptional: { type: "boolean", title: t("field.isOptional", "Optional") },
576
- order: { type: "integer", title: t("field.order", "Order") },
577
- fields: { type: "array", title: t("field.fields", "Fields"), items: a }
578
- }
579
- }
580
- },
581
- installOptions: {
582
- type: "array",
583
- title: t("field.installOptions", "Install options"),
584
- items: {
585
- type: "object",
586
- properties: {
587
- key: { type: "string", title: t("field.key", "Key") },
588
- label: { type: "string", title: t("field.label", "Label") },
589
- description: { type: "string", title: t("field.description", "Description") },
590
- optionType: {
591
- type: "string",
592
- title: t("field.optionType", "Option type"),
593
- enum: ["toggle", "select"]
594
- },
595
- defaultValue: { type: "string", title: t("field.defaultValue", "Default value") },
596
- isRequired: { type: "boolean", title: t("field.isRequired", "Required") }
597
- }
598
- }
1194
+ packageName: { type: "string", title: t("field.packageName", "Package name") },
1195
+ version: { type: "string", title: t("field.version", "Version") },
1196
+ displayName: { type: "string", title: t("field.displayName", "Display name") },
1197
+ description: { type: "string", title: t("field.description", "Description") },
1198
+ category: { type: "string", title: t("field.category", "Category") },
1199
+ subCategory: { type: "string", title: t("field.subCategory", "Sub-category") },
1200
+ icon: { type: "string", title: t("field.icon", "Icon") },
1201
+ author: { type: "string", title: t("field.author", "Author") },
1202
+ license: { type: "string", title: t("field.license", "License") },
1203
+ // seeds use free, standard, premium, pro, professional, core, enterprise, community…
1204
+ tier: { type: "string", title: t("field.tier", "Tier") },
1205
+ isCore: { type: "boolean", title: t("field.isCore", "Core module") },
1206
+ allowMultipleInstances: {
1207
+ type: "boolean",
1208
+ title: t("field.allowMultipleInstances", "Allow several instances")
599
1209
  },
600
- onInstall: { type: "object", title: t("field.onInstall", "On install") }
601
- }
602
- }
1210
+ defaultInstanceName: {
1211
+ type: "string",
1212
+ title: t("field.defaultInstanceName", "Default instance name")
1213
+ }
1214
+ },
1215
+ required: ["packageName", "version", "category"]
1216
+ },
1217
+ // a module's description runs to several sentences (1.3.14: it was a one-line field)
1218
+ uiSchema: { description: { type: "textarea" } }
603
1219
  },
604
1220
  {
605
- id: "integrations",
606
- title: t("section.integrations", "Integrations"),
1221
+ id: "modules",
1222
+ title: t("section.modules", "Units"),
607
1223
  schema: {
608
1224
  type: "object",
609
1225
  properties: {
610
- integrations: {
1226
+ modules: {
611
1227
  type: "array",
612
- title: t("field.integrations", "Integrations"),
1228
+ title: t("field.modules", "Units"),
613
1229
  items: {
614
1230
  type: "object",
615
1231
  properties: {
616
- key: { type: "string", title: t("field.key", "Key") },
617
- category: { type: "string", title: t("field.category", "Category") },
618
- label: { type: "string", title: t("field.label", "Label") },
1232
+ name: { type: "string", title: t("field.name", "Name") },
1233
+ displayName: { type: "string", title: t("field.displayName", "Display name") },
619
1234
  description: { type: "string", title: t("field.description", "Description") },
620
1235
  icon: { type: "string", title: t("field.icon", "Icon") },
621
- selectionMode: {
622
- type: "string",
623
- title: t("field.selectionMode", "Selection"),
624
- enum: ["multi", "single"]
625
- },
626
- optional: { type: "boolean", title: t("field.isOptional", "Optional") },
627
- providers: {
628
- type: "array",
629
- title: t("field.providers", "Providers"),
630
- items: {
631
- type: "object",
632
- properties: {
633
- key: { type: "string", title: t("field.key", "Key") },
634
- name: { type: "string", title: t("field.name", "Name") },
635
- description: { type: "string", title: t("field.description", "Description") },
636
- icon: { type: "string", title: t("field.icon", "Icon") },
637
- profile: { type: "string", title: t("field.profile", "Profile") },
638
- fields: {
639
- type: "array",
640
- title: t("field.fields", "Fields"),
641
- items: a
642
- }
643
- }
644
- }
645
- }
1236
+ color: { type: "string", title: t("field.color", "Colour") },
1237
+ parts: Q(t("field.parts", "Files"))
646
1238
  }
647
1239
  }
648
- }
1240
+ },
1241
+ i18n: Q(t("field.i18n", "Translation files"))
649
1242
  }
650
1243
  }
651
1244
  },
652
1245
  {
653
- id: "runtime",
654
- title: t("section.runtime", "Runtime"),
1246
+ id: "dependencies",
1247
+ title: t("section.dependencies", "Dependencies"),
655
1248
  schema: {
656
1249
  type: "object",
657
1250
  properties: {
658
- dataSources: {
659
- type: "array",
660
- title: t("field.dataSources", "Data sources"),
661
- items: {
662
- type: "object",
663
- properties: {
664
- key: { type: "string", title: t("field.key", "Key") },
665
- entity: { type: "string", title: t("field.entity", "Entity") },
666
- description: { type: "string", title: t("field.description", "Description") }
667
- }
668
- }
669
- },
670
- routes: {
671
- type: "array",
672
- title: t("field.routes", "Routes"),
673
- items: { type: "object" }
674
- },
675
- eventTriggers: {
1251
+ dependencies: Q(t("field.dependencies", "Required packages")),
1252
+ dependencyRefs: {
676
1253
  type: "array",
677
- title: t("field.eventTriggers", "Events"),
1254
+ title: t("field.dependencyRefs", "Dependency details"),
678
1255
  items: {
679
1256
  type: "object",
680
1257
  properties: {
681
- event: { type: "string", title: t("field.event", "Event") },
682
- description: { type: "string", title: t("field.description", "Description") }
1258
+ package: { type: "string", title: t("field.package", "Package") },
1259
+ isOptional: { type: "boolean", title: t("field.isOptional", "Optional") },
1260
+ minVersion: { type: "string", title: t("field.minVersion", "Minimum version") },
1261
+ reason: { type: "string", title: t("field.reason", "Reason") },
1262
+ relationKind: {
1263
+ type: "string",
1264
+ title: t("field.relationKind", "Relation"),
1265
+ enum: ["operational", "job", "event", "data-flow", "config"]
1266
+ },
1267
+ dataFlowDirection: {
1268
+ type: "string",
1269
+ title: t("field.dataFlowDirection", "Data flow")
1270
+ },
1271
+ instanceBinding: {
1272
+ type: "string",
1273
+ title: t("field.instanceBinding", "Instance binding")
1274
+ }
683
1275
  }
684
1276
  }
685
1277
  },
686
- actions: {
687
- type: "array",
688
- title: t("field.actions", "Actions"),
689
- items: {
690
- type: "object",
691
- properties: {
692
- key: { type: "string", title: t("field.key", "Key") },
693
- label: { type: "string", title: t("field.label", "Label") },
694
- description: { type: "string", title: t("field.description", "Description") },
695
- input: { type: "string", title: t("field.input", "Input") }
696
- }
697
- }
698
- }
1278
+ provides: Q(t("field.provides", "Provides")),
1279
+ requiredControls: Q(t("field.requiredControls", "Required controls"))
699
1280
  }
700
1281
  }
701
1282
  },
702
1283
  {
703
- id: "deployment",
704
- title: t("section.deployment", "Deployment"),
1284
+ id: "setup",
1285
+ title: t("section.setup", "Installation"),
705
1286
  schema: {
706
1287
  type: "object",
707
1288
  properties: {
708
- envVars: {
1289
+ setupWizard: {
709
1290
  type: "array",
710
- title: t("field.envVars", "Environment variables"),
1291
+ title: t("field.setupWizard", "Setup wizard steps"),
711
1292
  items: {
712
1293
  type: "object",
713
1294
  properties: {
714
- key: { type: "string", title: t("field.key", "Key") },
715
- defaultValue: { type: "string", title: t("field.defaultValue", "Default value") },
1295
+ stepId: { type: "string", title: t("field.stepId", "Step id") },
1296
+ name: { type: "string", title: t("field.name", "Name") },
716
1297
  description: { type: "string", title: t("field.description", "Description") },
717
- boundToField: { type: "string", title: t("field.boundToField", "Bound to field") }
1298
+ icon: { type: "string", title: t("field.icon", "Icon") },
1299
+ isOptional: { type: "boolean", title: t("field.isOptional", "Optional") },
1300
+ order: { type: "integer", title: t("field.order", "Order") },
1301
+ fields: { type: "array", title: t("field.fields", "Fields"), items: o }
718
1302
  }
719
1303
  }
720
1304
  },
721
- dockerServices: {
1305
+ installOptions: {
722
1306
  type: "array",
723
- title: t("field.dockerServices", "Docker services"),
1307
+ title: t("field.installOptions", "Install options"),
724
1308
  items: {
725
1309
  type: "object",
726
1310
  properties: {
727
- name: { type: "string", title: t("field.name", "Name") },
728
- image: { type: "string", title: t("field.image", "Image") },
729
- tag: { type: "string", title: t("field.tag", "Tag") },
1311
+ key: { type: "string", title: t("field.key", "Key") },
1312
+ label: { type: "string", title: t("field.label", "Label") },
730
1313
  description: { type: "string", title: t("field.description", "Description") },
731
- ports: J(t("field.ports", "Ports")),
732
- volumes: J(t("field.volumes", "Volumes")),
733
- command: { type: "string", title: t("field.command", "Command") },
734
- healthCheckCmd: {
735
- type: "string",
736
- title: t("field.healthCheckCmd", "Health check")
737
- },
738
- restartPolicy: {
1314
+ optionType: {
739
1315
  type: "string",
740
- title: t("field.restartPolicy", "Restart policy")
1316
+ title: t("field.optionType", "Option type"),
1317
+ enum: ["toggle", "select"]
741
1318
  },
742
- requiresOption: {
743
- type: "string",
744
- title: t("field.requiresOption", "Requires option")
745
- }
1319
+ defaultValue: { type: "string", title: t("field.defaultValue", "Default value") },
1320
+ isRequired: { type: "boolean", title: t("field.isRequired", "Required") }
746
1321
  }
747
1322
  }
748
- }
1323
+ },
1324
+ onInstall: { type: "object", title: t("field.onInstall", "On install") }
749
1325
  }
750
1326
  }
751
- }
752
- ];
753
- if (i.scripting) {
754
- const s = {
755
- type: "string",
756
- title: t("field.auth", "Access"),
757
- enum: ["Anonymous", "User", "Admin"]
758
- };
759
- n.push({
760
- id: "scripting",
761
- title: t("section.scripting", "Server code"),
1327
+ },
1328
+ {
1329
+ id: "integrations",
1330
+ title: t("section.integrations", "Integrations"),
762
1331
  schema: {
763
1332
  type: "object",
764
1333
  properties: {
765
- services: {
1334
+ integrations: {
766
1335
  type: "array",
767
- title: t("field.services", "Services"),
1336
+ title: t("field.integrations", "Integrations"),
768
1337
  items: {
769
1338
  type: "object",
770
- required: ["name", "language", "script"],
771
1339
  properties: {
772
- name: { type: "string", title: t("field.name", "Name") },
773
- scope: {
774
- type: "string",
775
- title: t("field.scope", "Lifetime"),
776
- enum: ["scoped", "singleton", "transient"]
777
- },
778
- language: {
1340
+ key: { type: "string", title: t("field.key", "Key") },
1341
+ category: { type: "string", title: t("field.category", "Category") },
1342
+ label: { type: "string", title: t("field.label", "Label") },
1343
+ description: { type: "string", title: t("field.description", "Description") },
1344
+ icon: { type: "string", title: t("field.icon", "Icon") },
1345
+ selectionMode: {
779
1346
  type: "string",
780
- title: t("field.language", "Language"),
781
- enum: ["js", "csharp"]
1347
+ title: t("field.selectionMode", "Selection"),
1348
+ enum: ["multi", "single"]
782
1349
  },
783
- script: { type: "string", title: t("field.script", "Script") }
784
- }
785
- }
786
- },
787
- controllers: {
788
- type: "array",
789
- title: t("field.controllers", "Controllers"),
790
- items: {
791
- type: "object",
792
- required: ["route"],
793
- properties: {
794
- route: { type: "string", title: t("field.route", "Route") },
795
- auth: s,
796
- actions: {
1350
+ optional: { type: "boolean", title: t("field.isOptional", "Optional") },
1351
+ providers: {
797
1352
  type: "array",
798
- title: t("field.actions", "Actions"),
1353
+ title: t("field.providers", "Providers"),
799
1354
  items: {
800
1355
  type: "object",
801
1356
  properties: {
802
- verb: {
803
- type: "string",
804
- title: t("field.verb", "Method"),
805
- enum: ["GET", "POST", "PUT", "PATCH", "DELETE"]
806
- },
807
- path: { type: "string", title: t("field.path", "Path") },
808
- handler: { type: "string", title: t("field.handler", "Handler") },
809
- auth: s
1357
+ key: { type: "string", title: t("field.key", "Key") },
1358
+ name: { type: "string", title: t("field.name", "Name") },
1359
+ description: { type: "string", title: t("field.description", "Description") },
1360
+ icon: { type: "string", title: t("field.icon", "Icon") },
1361
+ profile: { type: "string", title: t("field.profile", "Profile") },
1362
+ fields: {
1363
+ type: "array",
1364
+ title: t("field.fields", "Fields"),
1365
+ items: o
1366
+ }
810
1367
  }
811
1368
  }
812
1369
  }
@@ -815,486 +1372,185 @@ function $t(e = vt, i = {}) {
815
1372
  }
816
1373
  }
817
1374
  }
818
- });
819
- }
820
- return n;
821
- }
822
- const W = "Custom.", Ne = "Core", bt = {
823
- string: "string",
824
- varchar: "string",
825
- nvarchar: "string",
826
- text: "text",
827
- longtext: "text",
828
- int: "int",
829
- integer: "int",
830
- int32: "int",
831
- long: "long",
832
- bigint: "long",
833
- int64: "long",
834
- decimal: "decimal",
835
- double: "decimal",
836
- float: "decimal",
837
- number: "decimal",
838
- currency: "currency",
839
- money: "currency",
840
- bool: "bool",
841
- boolean: "bool",
842
- datetime: "DateTime",
843
- timestamp: "DateTime",
844
- date: "DateOnly",
845
- dateonly: "DateOnly",
846
- time: "TimeOnly",
847
- timeonly: "TimeOnly",
848
- json: "json",
849
- enum: "enum",
850
- guid: "Guid",
851
- uuid: "Guid"
852
- }, kt = [
853
- "string",
854
- "text",
855
- "int",
856
- "long",
857
- "decimal",
858
- "currency",
859
- "bool",
860
- "DateTime",
861
- "DateOnly",
862
- "TimeOnly",
863
- "json",
864
- "enum",
865
- "Guid"
866
- ], St = {
867
- ł: "l",
868
- Ł: "L",
869
- ß: "ss",
870
- æ: "ae",
871
- Æ: "AE",
872
- ø: "o",
873
- Ø: "O"
874
- };
875
- function Nt(e) {
876
- return [...e.normalize("NFD")].map((i) => St[i] ?? (new RegExp("\\p{Mn}", "u").test(i) ? "" : i)).join("").normalize("NFC");
877
- }
878
- function P(e) {
879
- const i = Nt(e ?? "").split(/[^A-Za-z0-9]+/).filter(Boolean).map((t) => t[0].toUpperCase() + t.slice(1)).join("");
880
- return /^[0-9]/.test(i) ? `M${i}` : i;
881
- }
882
- const je = (e) => e !== e.toLowerCase() && e === e.toUpperCase();
883
- function he(e) {
884
- return [...e].map(
885
- (i, t) => t > 0 && je(i) && !je(e[t - 1]) ? `_${i.toLowerCase()}` : i.toLowerCase()
886
- ).join("");
887
- }
888
- function jt(e) {
889
- return (e.startsWith(W) ? e.slice(W.length) : e.split(".").pop() ?? e).toLowerCase().replace(/[^a-z0-9_-]+/g, "") || "module";
890
- }
891
- async function qe(e) {
892
- const i = await globalThis.crypto.subtle.digest("SHA-256", new TextEncoder().encode(e));
893
- return new Uint8Array(i);
894
- }
895
- const ke = (e) => Array.from(e, (i) => i.toString(16).padStart(2, "0")).join("");
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) {
901
- const t = `custom_${e}_${he(i)}`;
902
- return t.length <= 63 ? t : `${t.slice(0, 54)}_${ke(await qe(t)).slice(0, 8)}`;
903
- }
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}`;
908
- if (!t.has(n.toLowerCase()))
909
- return n;
910
- }
911
- return e + ke(globalThis.crypto.getRandomValues(new Uint8Array(3)));
912
- }
913
- const ne = (e) => e.name.toLowerCase() === "id", q = (e) => {
914
- var i;
915
- return (((i = e.displayName) == null ? void 0 : i.trim()) || e.name).trim();
916
- };
917
- function se(e) {
918
- return e.isForeignKey ? "Guid" : bt[String(e.dataType ?? "").trim().toLowerCase()] ?? "string";
919
- }
920
- function pe(e) {
921
- if (e.isForeignKey)
922
- return ["Reference", "lookup"];
923
- switch (se(e)) {
924
- case "text":
925
- case "json":
926
- return ["Text", "textarea"];
927
- case "int":
928
- case "long":
929
- case "decimal":
930
- return ["Number", "number"];
931
- case "currency":
932
- return ["Currency", "currency"];
933
- case "bool":
934
- return ["Boolean", "toggle"];
935
- case "DateTime":
936
- return ["DateTime", "datetime"];
937
- case "DateOnly":
938
- return ["Date", "date"];
939
- default:
940
- return ["Text", "input"];
941
- }
942
- }
943
- const Et = {
944
- lookup: "EntitySelect",
945
- textarea: "Textarea",
946
- number: "number",
947
- currency: "number",
948
- toggle: "Toggle",
949
- date: "date",
950
- datetime: "datetime"
951
- };
952
- function xt(e) {
953
- var a;
954
- const i = [];
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.");
956
- const t = /* @__PURE__ */ new Set();
957
- for (const n of e.entities) {
958
- const s = P(n.name);
959
- if (s.length === 0) {
960
- i.push(`Entity "${n.name}" needs a name with letters or digits.`);
961
- continue;
962
- }
963
- t.has(s.toLowerCase()) && i.push(`Entity ${s} appears twice.`), t.add(s.toLowerCase());
964
- const r = n.fields.filter((h) => !ne(h));
965
- r.length === 0 && i.push(`Entity ${s} has no fields — add at least one.`);
966
- const l = /* @__PURE__ */ new Set();
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());
970
- }
971
- }
972
- return i;
973
- }
974
- const It = (e) => e.toISOString().replace(/\.(\d{3})Z$/, ".$10000Z"), X = (e) => ae(e, { finalNewline: !1 }), H = (e, i) => ({
975
- icon: { name: e, package: "@nice2dev/icons", style: i }
976
- });
977
- function Ct(e) {
978
- const i = e && /^Ntd[A-Z]/.test(e), t = e && /^[A-Z]\w*Icon$/.test(e);
979
- return {
980
- module: {
981
- icon: {
982
- name: i || t ? e : "NtdGrid",
983
- package: t ? "@nice2dev/icons-business" : "@nice2dev/icons",
984
- style: "duotone"
985
- },
986
- animation: { type: "none" }
987
- },
988
- entities: {},
989
- views: { list: H("NtdList", "outline"), form: H("NtdEdit", "outline") },
990
- permissions: {
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")
996
1375
  },
997
- workflowStates: {}
998
- };
999
- }
1000
- async function Ot(e, i = {}) {
1001
- var v, f, N, C;
1002
- const t = xt(e);
1003
- if (t.length > 0)
1004
- return { problems: t };
1005
- const a = e.name.toLowerCase().startsWith(W.toLowerCase()), n = P(
1006
- a ? e.name.slice(W.length) : e.name
1007
- ), s = Tt(
1008
- W + n,
1009
- i.existingPackageNames ?? /* @__PURE__ */ new Set()
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 = [
1011
- `${l}.entities.json`,
1012
- ...A ? [`${l}.views.json`] : [],
1013
- ...S ? [`${l}.permissions.json`] : []
1014
- ];
1015
- b.push({
1016
- path: `${l}.manifest.json`,
1017
- text: X({
1018
- packageName: s,
1019
- version: "1.0.0",
1020
- displayName: d,
1021
- description: p ?? d,
1022
- author: "OmniVerk Module Builder",
1023
- license: "Proprietary",
1024
- category: ((f = e.category) == null ? void 0 : f.trim()) || "Custom",
1025
- icon: I,
1026
- exportedAt: It((i.now ?? (() => /* @__PURE__ */ new Date()))()),
1027
- modules: [
1028
- {
1029
- name: Ne,
1030
- displayName: d,
1031
- description: e.description ?? d,
1032
- icon: I,
1033
- parts: D
1376
+ {
1377
+ id: "runtime",
1378
+ title: t("section.runtime", "Runtime"),
1379
+ schema: {
1380
+ type: "object",
1381
+ properties: {
1382
+ dataSources: {
1383
+ type: "array",
1384
+ title: t("field.dataSources", "Data sources"),
1385
+ items: {
1386
+ type: "object",
1387
+ properties: {
1388
+ key: { type: "string", title: t("field.key", "Key") },
1389
+ entity: { type: "string", title: t("field.entity", "Entity") },
1390
+ description: { type: "string", title: t("field.description", "Description") }
1391
+ }
1392
+ }
1393
+ },
1394
+ routes: {
1395
+ type: "array",
1396
+ title: t("field.routes", "Routes"),
1397
+ items: { type: "object" }
1398
+ },
1399
+ eventTriggers: {
1400
+ type: "array",
1401
+ title: t("field.eventTriggers", "Events"),
1402
+ items: {
1403
+ type: "object",
1404
+ properties: {
1405
+ event: { type: "string", title: t("field.event", "Event") },
1406
+ description: { type: "string", title: t("field.description", "Description") }
1407
+ }
1408
+ }
1409
+ },
1410
+ actions: {
1411
+ type: "array",
1412
+ title: t("field.actions", "Actions"),
1413
+ items: {
1414
+ type: "object",
1415
+ properties: {
1416
+ key: { type: "string", title: t("field.key", "Key") },
1417
+ label: { type: "string", title: t("field.label", "Label") },
1418
+ description: { type: "string", title: t("field.description", "Description") },
1419
+ input: { type: "string", title: t("field.input", "Input") }
1420
+ }
1421
+ }
1422
+ }
1034
1423
  }
1035
- ],
1036
- dependencies: ["Core.Users"],
1037
- i18n: T.map((j) => `${l}.${j}.i18n.json`),
1038
- ...e.ownerTenantId ? { ownerTenantId: e.ownerTenantId } : {},
1039
- ...e.sourceDefinitionId ? { sourceDefinitionId: e.sourceDefinitionId } : {}
1040
- })
1041
- });
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
1050
- };
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);
1052
- }
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",
1060
- isAudited: !0,
1061
- isSoftDeleteEnabled: !1,
1062
- fields: O
1063
- });
1064
- }
1065
- if (b.push({
1066
- path: `${l}.entities.json`,
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"
1072
- );
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),
1079
- sortable: !0,
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)
1090
- } : {}
1091
- }));
1092
- O.push({
1093
- id: `vw-${l}-${he(w.name)}-list`,
1094
- name: `${w.name}List`,
1095
- displayName: q(w),
1096
- type: "List",
1097
- icon: "list",
1098
- entityName: w.name,
1099
- columns: c,
1100
- searchFields: y,
1101
- pageSize: 25,
1102
- createControls: g,
1103
- allowEdit: !0,
1104
- allowDelete: !0
1105
- });
1106
- const x = E.map((m) => {
1107
- const $ = pe(m)[1];
1108
- return {
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) } : {}
1115
- };
1116
- });
1117
- O.push({
1118
- id: `vw-${l}-${he(w.name)}-form`,
1119
- name: `${w.name}Form`,
1120
- displayName: q(w),
1121
- type: "Form",
1122
- icon: "edit",
1123
- entityName: w.name,
1124
- tabs: [
1125
- {
1126
- name: "Main",
1127
- displayName: q(w),
1128
- sections: [{ name: "Details", displayName: "Details", controls: x }]
1424
+ }
1425
+ },
1426
+ {
1427
+ id: "deployment",
1428
+ title: t("section.deployment", "Deployment"),
1429
+ schema: {
1430
+ type: "object",
1431
+ properties: {
1432
+ envVars: {
1433
+ type: "array",
1434
+ title: t("field.envVars", "Environment variables"),
1435
+ items: {
1436
+ type: "object",
1437
+ properties: {
1438
+ key: { type: "string", title: t("field.key", "Key") },
1439
+ defaultValue: { type: "string", title: t("field.defaultValue", "Default value") },
1440
+ description: { type: "string", title: t("field.description", "Description") },
1441
+ boundToField: { type: "string", title: t("field.boundToField", "Bound to field") }
1442
+ }
1443
+ }
1444
+ },
1445
+ dockerServices: {
1446
+ type: "array",
1447
+ title: t("field.dockerServices", "Docker services"),
1448
+ items: {
1449
+ type: "object",
1450
+ properties: {
1451
+ name: { type: "string", title: t("field.name", "Name") },
1452
+ image: { type: "string", title: t("field.image", "Image") },
1453
+ tag: { type: "string", title: t("field.tag", "Tag") },
1454
+ description: { type: "string", title: t("field.description", "Description") },
1455
+ ports: Q(t("field.ports", "Ports")),
1456
+ volumes: Q(t("field.volumes", "Volumes")),
1457
+ command: { type: "string", title: t("field.command", "Command") },
1458
+ healthCheckCmd: {
1459
+ type: "string",
1460
+ title: t("field.healthCheckCmd", "Health check")
1461
+ },
1462
+ restartPolicy: {
1463
+ type: "string",
1464
+ title: t("field.restartPolicy", "Restart policy")
1465
+ },
1466
+ requiresOption: {
1467
+ type: "string",
1468
+ title: t("field.requiresOption", "Requires option")
1469
+ }
1470
+ }
1471
+ }
1129
1472
  }
1130
- ]
1131
- });
1132
- }
1133
- b.push({
1134
- path: `${l}.views.json`,
1135
- text: X({ moduleName: h, version: "1.0.0", views: O })
1136
- });
1137
- }
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)
1147
- });
1148
- b.push({
1149
- path: `${l}.permissions.json`,
1150
- text: X({
1151
- moduleName: h,
1152
- version: "1.0.0",
1153
- permissions: [
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")
1159
- ],
1160
- permissionGroups: [
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")
1164
- ]
1165
- })
1166
- });
1167
- }
1168
- for (const j of T) {
1169
- const O = {
1170
- "module.displayName": d,
1171
- "module.description": p ?? d
1172
- };
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");
1178
- }
1179
- b.push({
1180
- path: `${l}.${j}.i18n.json`,
1181
- text: X({ moduleName: s, locale: j, version: "1.0.0", translations: O })
1182
- });
1183
- }
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: [] };
1185
- }
1186
- function At(e) {
1187
- const i = (t) => typeof t == "string" && t ? t : void 0;
1188
- return {
1189
- name: e.name,
1190
- description: e.description,
1191
- category: e.packageId,
1192
- icon: e.icon,
1193
- locales: e.locales,
1194
- views: e.views,
1195
- permissions: e.permissions,
1196
- entities: e.entities.map((t) => ({
1197
- name: String(t.name ?? ""),
1198
- displayName: i(t.displayName),
1199
- description: i(t.description),
1200
- icon: i(t.entityIcon) ?? i(t.icon),
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)
1213
- }))
1214
- }))
1215
- };
1216
- }
1217
- const Z = (e) => typeof e == "object" && e !== null && !Array.isArray(e);
1218
- function we(e, i) {
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;
1220
- }
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) {
1223
- const t = e.find(
1224
- (b) => !b.path.includes("/") && b.path.toLowerCase().endsWith(".manifest.json")
1225
- );
1226
- if (!t)
1227
- throw new Error("The module has no manifest.");
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")))
1230
- try {
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)}`);
1473
+ }
1235
1474
  }
1236
- } catch {
1237
1475
  }
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/"))
1241
- continue;
1242
- const D = k(b.path);
1243
- if (!b.path.toLowerCase().endsWith(".json")) {
1244
- I.push({ path: D, text: b.text });
1245
- continue;
1246
- }
1247
- let u;
1248
- try {
1249
- u = _(b.text).value;
1250
- } catch {
1251
- I.push({ path: D, text: b.text });
1252
- continue;
1253
- }
1254
- let v = we(u, T);
1255
- if (b === t && Z(v)) {
1256
- const { sourceDefinitionId: f, ...N } = v;
1257
- v = {
1258
- ...N,
1259
- packageName: r,
1260
- ...i.name ? { displayName: i.name } : {},
1261
- ...i.packageId ? { category: i.packageId } : {}
1262
- };
1263
- }
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);
1269
- continue;
1476
+ ];
1477
+ if (i.scripting) {
1478
+ const s = {
1479
+ type: "string",
1480
+ title: t("field.auth", "Access"),
1481
+ enum: ["Anonymous", "User", "Admin"]
1482
+ };
1483
+ n.push({
1484
+ id: "scripting",
1485
+ title: t("section.scripting", "Server code"),
1486
+ schema: {
1487
+ type: "object",
1488
+ properties: {
1489
+ services: {
1490
+ type: "array",
1491
+ title: t("field.services", "Services"),
1492
+ items: {
1493
+ type: "object",
1494
+ required: ["name", "language", "script"],
1495
+ properties: {
1496
+ name: { type: "string", title: t("field.name", "Name") },
1497
+ scope: {
1498
+ type: "string",
1499
+ title: t("field.scope", "Lifetime"),
1500
+ enum: ["scoped", "singleton", "transient"]
1501
+ },
1502
+ language: {
1503
+ type: "string",
1504
+ title: t("field.language", "Language"),
1505
+ enum: ["js", "csharp"]
1506
+ },
1507
+ script: { type: "string", title: t("field.script", "Script") }
1508
+ }
1509
+ }
1510
+ },
1511
+ controllers: {
1512
+ type: "array",
1513
+ title: t("field.controllers", "Controllers"),
1514
+ items: {
1515
+ type: "object",
1516
+ required: ["route"],
1517
+ properties: {
1518
+ route: { type: "string", title: t("field.route", "Route") },
1519
+ auth: s,
1520
+ actions: {
1521
+ type: "array",
1522
+ title: t("field.actions", "Actions"),
1523
+ items: {
1524
+ type: "object",
1525
+ properties: {
1526
+ verb: {
1527
+ type: "string",
1528
+ title: t("field.verb", "Method"),
1529
+ enum: ["GET", "POST", "PUT", "PATCH", "DELETE"]
1530
+ },
1531
+ path: { type: "string", title: t("field.path", "Path") },
1532
+ handler: { type: "string", title: t("field.handler", "Handler") },
1533
+ auth: s
1534
+ }
1535
+ }
1536
+ }
1537
+ }
1538
+ }
1539
+ }
1270
1540
  }
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) } : {}
1275
- });
1276
1541
  }
1277
- v = { ...v, entities: f };
1278
- }
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) });
1542
+ });
1283
1543
  }
1284
- return {
1285
- id: r,
1286
- packageId: i.packageId ?? a.category,
1287
- files: I
1288
- };
1544
+ return n;
1289
1545
  }
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 = [
1546
+ const K = (e) => typeof e == "object" && e !== null && !Array.isArray(e), ie = (e, i) => K(e) && Array.isArray(e[i]) ? e[i] : [], re = (e, i) => e.toLowerCase().endsWith(i), Ne = (e) => !e.includes("/"), zt = /[ąćęłńóśźżĄĆĘŁŃÓŚŹŻ]/, Ht = [
1291
1547
  "ING Bank Śląski",
1292
1548
  "Bank Śląski",
1293
1549
  "BOŚ",
1294
1550
  "e-Zamówienia",
1295
1551
  "eZamówienia",
1296
1552
  "Plataforma de Contratación del Sector Público"
1297
- ], re = (e) => Dt.test(Mt.reduce((i, t) => i.split(t).join(""), e)), Ft = /* @__PURE__ */ new Set([
1553
+ ], de = (e) => zt.test(Ht.reduce((i, t) => i.split(t).join(""), e)), Zt = /* @__PURE__ */ new Set([
1298
1554
  "module",
1299
1555
  "entity",
1300
1556
  "field",
@@ -1303,8 +1559,8 @@ const M = (e) => typeof e == "object" && e !== null && !Array.isArray(e), ee = (
1303
1559
  "nav",
1304
1560
  "action",
1305
1561
  "tutorial"
1306
- ]), Pt = /* @__PURE__ */ new Set(["int", "int32", "int64", "long", "integer"]);
1307
- function Rt(e) {
1562
+ ]), Qt = /* @__PURE__ */ new Set(["int", "int32", "int64", "long", "integer"]);
1563
+ function Yt(e) {
1308
1564
  for (let i = 0; i < e.length; i++) {
1309
1565
  const t = e.charCodeAt(i);
1310
1566
  if (t >= 55296 && t <= 56319 || t >= 9728 && t <= 10175)
@@ -1312,13 +1568,13 @@ function Rt(e) {
1312
1568
  }
1313
1569
  return !1;
1314
1570
  }
1315
- function Te(e) {
1316
- if (!M(e))
1571
+ function Ae(e) {
1572
+ if (!K(e))
1317
1573
  return [];
1318
- const i = M(e.translations) ? e.translations : M(e.keys) ? e.keys : void 0;
1574
+ const i = K(e.translations) ? e.translations : K(e.keys) ? e.keys : void 0;
1319
1575
  return i ? Object.entries(i) : [];
1320
1576
  }
1321
- const Ee = /^(.*)\.([a-z]{2,3}(?:-[A-Za-z]{2,4})?)\.i18n\.json$/i, qt = /* @__PURE__ */ new Set([
1577
+ const Le = /^(.*)\.([a-z]{2,3}(?:-[A-Za-z]{2,4})?)\.i18n\.json$/i, Xt = /* @__PURE__ */ new Set([
1322
1578
  "hotel.views.json",
1323
1579
  "restaurant.views.json",
1324
1580
  "backup-dr.views.json",
@@ -1327,395 +1583,395 @@ const Ee = /^(.*)\.([a-z]{2,3}(?:-[A-Za-z]{2,4})?)\.i18n\.json$/i, qt = /* @__PU
1327
1583
  "shelf_management.views.json",
1328
1584
  "psa.views.json"
1329
1585
  ]);
1330
- function Vt(e, i = {}) {
1331
- var D;
1586
+ function ei(e, i = {}) {
1587
+ var T;
1332
1588
  const t = new Set(
1333
- [...i.legacyListViewFiles ?? qt].map(
1334
- (u) => u.toLowerCase()
1589
+ [...i.legacyListViewFiles ?? Xt].map(
1590
+ (m) => m.toLowerCase()
1335
1591
  )
1336
- ), a = [], n = (u) => {
1337
- a.push({ severity: "error", ...u });
1592
+ ), o = [], n = (m) => {
1593
+ o.push({ severity: "error", ...m });
1338
1594
  }, s = [];
1339
- for (const u of e.files)
1340
- if (!(!oe(u.path, ".json") || u.path.startsWith(".revisions/")))
1595
+ for (const m of e.files)
1596
+ if (!(!re(m.path, ".json") || m.path.startsWith(".revisions/")))
1341
1597
  try {
1342
- s.push({ file: u, value: _(u.text).value });
1343
- } catch (v) {
1598
+ s.push({ file: m, value: z(m.text).value });
1599
+ } catch (b) {
1344
1600
  n({
1345
1601
  code: "json.invalid",
1346
- message: `${u.path} is not valid JSON: ${v instanceof Error ? v.message : String(v)}`,
1602
+ message: `${m.path} is not valid JSON: ${b instanceof Error ? b.message : String(b)}`,
1347
1603
  messageKey: "devStudio.issue.jsonInvalid",
1348
- params: { path: u.path, error: v instanceof Error ? v.message : String(v) },
1349
- path: u.path
1604
+ params: { path: m.path, error: b instanceof Error ? b.message : String(b) },
1605
+ path: m.path
1350
1606
  });
1351
1607
  }
1352
- const r = (u) => s.filter((v) => ve(v.file.path) && oe(v.file.path, u)), l = r(".manifest.json");
1608
+ const a = (m) => s.filter((b) => Ne(b.file.path) && re(b.file.path, m)), l = a(".manifest.json");
1353
1609
  l.length === 0 && n({
1354
1610
  code: "manifest.missing",
1355
1611
  message: "The module has no *.manifest.json.",
1356
1612
  messageKey: "devStudio.issue.manifestMissing"
1357
1613
  });
1358
- for (const { file: u, value: v } of l)
1359
- for (const f of ["packageName", "version", "category"])
1360
- (!M(v) || !(f in v)) && n({
1614
+ for (const { file: m, value: b } of l)
1615
+ for (const g of ["packageName", "version", "category"])
1616
+ (!K(b) || !(g in b)) && n({
1361
1617
  code: "manifest.required",
1362
- message: `The manifest needs "${f}".`,
1618
+ message: `The manifest needs "${g}".`,
1363
1619
  messageKey: "devStudio.issue.manifestRequired",
1364
- params: { field: f },
1365
- path: u.path,
1366
- pointer: `/${f}`
1620
+ params: { field: g },
1621
+ path: m.path,
1622
+ pointer: `/${g}`
1367
1623
  });
1368
- const h = r(".iconconfig.json");
1369
- h.length === 0 && e.contents !== "manifest" && n({
1624
+ const y = a(".iconconfig.json");
1625
+ y.length === 0 && e.contents !== "manifest" && n({
1370
1626
  severity: "info",
1371
1627
  code: "iconconfig.missing",
1372
1628
  message: "The module has no *.iconconfig.json: its menu shows a default icon (the CI wants one in every Category/Module folder).",
1373
1629
  messageKey: "devStudio.issue.iconconfigMissing"
1374
1630
  });
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"] : [],
1631
+ for (const { file: m, value: b } of y) {
1632
+ const g = K(b) ? b.module : void 0, E = K(g) ? g.icon : void 0, C = [
1633
+ ...K(g) ? [] : ["module"],
1634
+ ...K(g) && !K(E) ? ["module.icon"] : [],
1635
+ ...K(E) && !("name" in E) ? ["module.icon.name"] : [],
1636
+ ...K(E) && !("package" in E) ? ["module.icon.package"] : [],
1381
1637
  ...["views", "permissions", "workflowStates"].filter(
1382
- (j) => !M(v) || !(j in v)
1638
+ (h) => !K(b) || !(h in b)
1383
1639
  )
1384
1640
  ];
1385
- for (const j of C)
1641
+ for (const h of C)
1386
1642
  n({
1387
1643
  code: "iconconfig.structure",
1388
- message: `The icon config needs "${j}".`,
1644
+ message: `The icon config needs "${h}".`,
1389
1645
  messageKey: "devStudio.issue.iconconfigStructure",
1390
- params: { field: j },
1391
- path: u.path,
1392
- pointer: `/${j.split(".").join("/")}`
1646
+ params: { field: h },
1647
+ path: m.path,
1648
+ pointer: `/${h.split(".").join("/")}`
1393
1649
  });
1394
1650
  }
1395
- const d = [], p = [];
1396
- for (const { file: u, value: v } of r(".entities.json")) {
1397
- if (!M(v) || !("entities" in v))
1651
+ const p = [], u = [];
1652
+ for (const { file: m, value: b } of a(".entities.json")) {
1653
+ if (!K(b) || !("entities" in b))
1398
1654
  continue;
1399
- const f = [], N = v.entities;
1400
- if (!Array.isArray(N) || N.length === 0) {
1655
+ const g = [], E = b.entities;
1656
+ if (!Array.isArray(E) || E.length === 0) {
1401
1657
  n({
1402
1658
  code: "entities.empty",
1403
1659
  message: "The file has no entities.",
1404
1660
  messageKey: "devStudio.issue.entitiesEmpty",
1405
- path: u.path,
1661
+ path: m.path,
1406
1662
  pointer: "/entities"
1407
1663
  });
1408
1664
  continue;
1409
1665
  }
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({
1666
+ E.forEach((C, h) => {
1667
+ const S = `/entities/${h}`, d = K(C) && typeof C.name == "string" ? C.name : void 0;
1668
+ if (d ? p.push(d) : n({
1413
1669
  code: "entities.name",
1414
- message: `Entity #${j + 1} has no name.`,
1670
+ message: `Entity #${h + 1} has no name.`,
1415
1671
  messageKey: "devStudio.issue.entitiesName",
1416
- params: { n: j + 1 },
1417
- path: u.path,
1418
- pointer: O
1419
- }), !M(C) || !Array.isArray(C.fields)) {
1672
+ params: { n: h + 1 },
1673
+ path: m.path,
1674
+ pointer: S
1675
+ }), !K(C) || !Array.isArray(C.fields)) {
1420
1676
  n({
1421
1677
  code: "entities.fields",
1422
- message: `Entity ${w ?? `#${j + 1}`} has no fields array.`,
1678
+ message: `Entity ${d ?? `#${h + 1}`} has no fields array.`,
1423
1679
  messageKey: "devStudio.issue.entitiesFields",
1424
- params: { name: w ?? `#${j + 1}` },
1425
- path: u.path,
1426
- pointer: O
1680
+ params: { name: d ?? `#${h + 1}` },
1681
+ path: m.path,
1682
+ pointer: S
1427
1683
  });
1428
1684
  return;
1429
1685
  }
1430
- M(C) && typeof C.displayName == "string" && re(C.displayName) && n({
1686
+ K(C) && typeof C.displayName == "string" && de(C.displayName) && n({
1431
1687
  code: "labels.polish",
1432
- message: `Entity ${w}: the display name "${C.displayName}" is Polish — seed labels are English, Polish goes to the .pl bundle.`,
1688
+ message: `Entity ${d}: the display name "${C.displayName}" is Polish — seed labels are English, Polish goes to the .pl bundle.`,
1433
1689
  messageKey: "devStudio.issue.polishEntity",
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))
1690
+ params: { name: d ?? "", text: C.displayName },
1691
+ path: m.path,
1692
+ pointer: `${S}/displayName`
1693
+ }), C.fields.forEach((j, r) => {
1694
+ if (!K(j))
1439
1695
  return;
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({
1696
+ const c = typeof j.name == "string" ? j.name : void 0, v = `${S}/fields/${r}`;
1697
+ d && c && j.isPrimaryKey !== !0 && u.push(`field.${d}.${c}`);
1698
+ const $ = typeof j.dataType == "string" ? j.dataType.replace(/\?+$/, "") : void 0;
1699
+ $ === void 0 && typeof j.type == "string" && g.push({ name: `${d}.${c}`, pointer: `${v}/type` }), $ && Qt.has($.toLowerCase()) && (c === "Id" || j.isForeignKey === !0) && n({
1444
1700
  code: "entities.keyNotGuid",
1445
- message: `${w}.${c} is ${g}: keys must be Guid (every row's Id is a uuid).`,
1701
+ message: `${d}.${c} is ${$}: keys must be Guid (every row's Id is a uuid).`,
1446
1702
  messageKey: "devStudio.issue.keyNotGuid",
1447
- params: { name: `${w}.${c}`, type: g },
1448
- path: u.path,
1449
- pointer: `${y}/dataType`
1450
- }), typeof E.displayName == "string" && re(E.displayName) && n({
1703
+ params: { name: `${d}.${c}`, type: $ },
1704
+ path: m.path,
1705
+ pointer: `${v}/dataType`
1706
+ }), typeof j.displayName == "string" && de(j.displayName) && n({
1451
1707
  code: "labels.polish",
1452
- message: `${w}.${c}: the display name "${E.displayName}" is Polish — seed labels are English.`,
1708
+ message: `${d}.${c}: the display name "${j.displayName}" is Polish — seed labels are English.`,
1453
1709
  messageKey: "devStudio.issue.polishField",
1454
- params: { name: `${w}.${c}`, text: E.displayName },
1455
- path: u.path,
1456
- pointer: `${y}/displayName`
1710
+ params: { name: `${d}.${c}`, text: j.displayName },
1711
+ path: m.path,
1712
+ pointer: `${v}/displayName`
1457
1713
  });
1458
1714
  });
1459
- }), f.length && n({
1715
+ }), g.length && n({
1460
1716
  severity: "warning",
1461
1717
  code: "entities.typeIgnored",
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 ? ", …" : ""}`,
1718
+ message: `${g.length} field(s) give their type as "type", which installing ignores — it reads "dataType": ${g.slice(0, 5).map((C) => C.name).join(", ")}${g.length > 5 ? ", …" : ""}`,
1463
1719
  messageKey: "devStudio.issue.typeIgnored",
1464
1720
  params: {
1465
- count: f.length,
1466
- names: `${f.slice(0, 5).map((C) => C.name).join(", ")}${f.length > 5 ? ", …" : ""}`
1721
+ count: g.length,
1722
+ names: `${g.slice(0, 5).map((C) => C.name).join(", ")}${g.length > 5 ? ", …" : ""}`
1467
1723
  },
1468
- path: u.path,
1469
- pointer: f[0].pointer
1724
+ path: m.path,
1725
+ pointer: g[0].pointer
1470
1726
  });
1471
1727
  }
1472
- for (const { file: u, value: v } of r(".permissions.json"))
1473
- (!M(v) || !Array.isArray(v.permissions) || v.permissions.length === 0) && n({
1728
+ for (const { file: m, value: b } of a(".permissions.json"))
1729
+ (!K(b) || !Array.isArray(b.permissions) || b.permissions.length === 0) && n({
1474
1730
  code: "permissions.empty",
1475
1731
  message: 'The file needs a non-empty "permissions" array.',
1476
1732
  messageKey: "devStudio.issue.permissionsEmpty",
1477
- path: u.path,
1733
+ path: m.path,
1478
1734
  pointer: "/permissions"
1479
1735
  });
1480
- const k = [];
1481
- for (const { file: u, value: v } of r(".views.json")) {
1482
- if (!M(v) || Object.keys(v).length === 0) {
1736
+ const N = [];
1737
+ for (const { file: m, value: b } of a(".views.json")) {
1738
+ if (!K(b) || Object.keys(b).length === 0) {
1483
1739
  n({
1484
1740
  code: "views.empty",
1485
1741
  message: "A views file is a JSON object with at least one property.",
1486
1742
  messageKey: "devStudio.issue.viewsEmpty",
1487
- path: u.path
1743
+ path: m.path
1488
1744
  });
1489
1745
  continue;
1490
1746
  }
1491
- ee(v, "views").forEach((f, N) => {
1492
- if (!M(f))
1747
+ ie(b, "views").forEach((g, E) => {
1748
+ if (!K(g))
1493
1749
  return;
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({
1750
+ const C = `/views/${E}`, h = typeof g.name == "string" ? g.name : "(unnamed)";
1751
+ typeof g.name == "string" && N.push(g.name), typeof g.type == "string" && g.type.toLowerCase() === "list" && !t.has(m.path.toLowerCase()) && (typeof g.entityName != "string" || !g.entityName.trim() ? n({
1496
1752
  code: "views.listEntity",
1497
- message: `List view ${j} needs a top-level "entityName".`,
1753
+ message: `List view ${h} needs a top-level "entityName".`,
1498
1754
  messageKey: "devStudio.issue.listEntity",
1499
- params: { name: j },
1500
- path: u.path,
1755
+ params: { name: h },
1756
+ path: m.path,
1501
1757
  pointer: C
1502
- }) : (!Array.isArray(f.columns) || f.columns.length === 0) && n({
1758
+ }) : (!Array.isArray(g.columns) || g.columns.length === 0) && n({
1503
1759
  code: "views.listColumns",
1504
- message: `List view ${j} needs non-empty top-level "columns".`,
1760
+ message: `List view ${h} needs non-empty top-level "columns".`,
1505
1761
  messageKey: "devStudio.issue.listColumns",
1506
- params: { name: j },
1507
- path: u.path,
1762
+ params: { name: h },
1763
+ path: m.path,
1508
1764
  pointer: C
1509
1765
  }));
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}`])
1766
+ const S = [[g, "displayName", C]];
1767
+ ie(g, "columns").forEach((d, j) => {
1768
+ for (const r of ["header", "displayName", "label"])
1769
+ S.push([d, r, `${C}/columns/${j}`]);
1770
+ }), ie(g, "tabs").forEach((d, j) => {
1771
+ S.push([d, "displayName", `${C}/tabs/${j}`]), ie(d, "sections").forEach((r, c) => {
1772
+ S.push([r, "displayName", `${C}/tabs/${j}/sections/${c}`]), ie(r, "controls").forEach(
1773
+ (v, $) => S.push([v, "label", `${C}/tabs/${j}/sections/${c}/controls/${$}`])
1518
1774
  );
1519
1775
  });
1520
1776
  });
1521
- for (const [w, E, o] of O) {
1522
- const c = M(w) ? w[E] : void 0;
1523
- typeof c == "string" && re(c) && n({
1777
+ for (const [d, j, r] of S) {
1778
+ const c = K(d) ? d[j] : void 0;
1779
+ typeof c == "string" && de(c) && n({
1524
1780
  code: "labels.polish",
1525
- message: `View ${j}: "${c}" is Polish — seed labels are English.`,
1781
+ message: `View ${h}: "${c}" is Polish — seed labels are English.`,
1526
1782
  messageKey: "devStudio.issue.polishView",
1527
- params: { name: j, text: c },
1528
- path: u.path,
1529
- pointer: `${o}/${E}`
1783
+ params: { name: h, text: c },
1784
+ path: m.path,
1785
+ pointer: `${r}/${j}`
1530
1786
  });
1531
1787
  }
1532
1788
  });
1533
1789
  }
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);
1790
+ const L = s.filter((m) => Ne(m.file.path) && Le.test(m.file.path)), I = /* @__PURE__ */ new Map();
1791
+ for (const m of L) {
1792
+ const [, b, g] = Le.exec(m.file.path), E = I.get(b) ?? /* @__PURE__ */ new Map();
1793
+ E.set(g.toLowerCase(), m), I.set(b, E);
1538
1794
  }
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({
1795
+ const x = new Set(
1796
+ [...I.keys()].map((m) => m.split(".")[0]).filter((m) => !Zt.has(m))
1797
+ ), O = /* @__PURE__ */ new Set();
1798
+ for (const [m, b] of I) {
1799
+ const g = b.get("en"), E = b.get("pl"), C = (h) => new Set(Ae(h == null ? void 0 : h.value).map(([S]) => S));
1800
+ if (g && !E && n({
1545
1801
  code: "i18n.polishMissing",
1546
- message: `${u}.en.i18n.json needs a .pl.i18n.json sibling (English and Polish are mandatory).`,
1802
+ message: `${m}.en.i18n.json needs a .pl.i18n.json sibling (English and Polish are mandatory).`,
1547
1803
  messageKey: "devStudio.issue.polishBundleMissing",
1548
- params: { group: u },
1549
- path: f.file.path
1550
- }), N && !f && n({
1804
+ params: { group: m },
1805
+ path: g.file.path
1806
+ }), E && !g && n({
1551
1807
  code: "i18n.englishMissing",
1552
- message: `${u}.pl.i18n.json needs an .en.i18n.json baseline.`,
1808
+ message: `${m}.pl.i18n.json needs an .en.i18n.json baseline.`,
1553
1809
  messageKey: "devStudio.issue.englishBundleMissing",
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({
1810
+ params: { group: m },
1811
+ path: E.file.path
1812
+ }), g && E) {
1813
+ const h = C(g), S = C(E), d = [...h].filter((r) => !S.has(r)), j = [...S].filter((r) => !h.has(r));
1814
+ d.length && n({
1559
1815
  code: "i18n.keyMissing",
1560
- message: `${N.file.path} is missing ${w.length} key(s) of English: ${w.slice(0, 10).join(", ")}`,
1816
+ message: `${E.file.path} is missing ${d.length} key(s) of English: ${d.slice(0, 10).join(", ")}`,
1561
1817
  messageKey: "devStudio.issue.keysMissingPl",
1562
1818
  params: {
1563
- path: N.file.path,
1564
- count: w.length,
1565
- keys: w.slice(0, 10).join(", ")
1819
+ path: E.file.path,
1820
+ count: d.length,
1821
+ keys: d.slice(0, 10).join(", ")
1566
1822
  },
1567
- path: N.file.path
1568
- }), E.length && n({
1823
+ path: E.file.path
1824
+ }), j.length && n({
1569
1825
  code: "i18n.keyMissing",
1570
- message: `${f.file.path} is missing ${E.length} key(s) of Polish: ${E.slice(0, 10).join(", ")}`,
1826
+ message: `${g.file.path} is missing ${j.length} key(s) of Polish: ${j.slice(0, 10).join(", ")}`,
1571
1827
  messageKey: "devStudio.issue.keysMissingEn",
1572
1828
  params: {
1573
- path: f.file.path,
1574
- count: E.length,
1575
- keys: E.slice(0, 10).join(", ")
1829
+ path: g.file.path,
1830
+ count: j.length,
1831
+ keys: j.slice(0, 10).join(", ")
1576
1832
  },
1577
- path: f.file.path
1833
+ path: g.file.path
1578
1834
  });
1579
1835
  }
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({
1836
+ for (const [h, S] of b) {
1837
+ const d = Ae(S.value), j = d.filter(([r]) => x.has(r.split(".")[0])).map(([r]) => r);
1838
+ if (j.length && n({
1583
1839
  severity: "warning",
1584
1840
  code: "i18n.fileKey",
1585
- message: `${O.file.path}: nothing reads keys named after the bundle file — use module./entity./field./view. keys (${E.slice(0, 5).join(", ")}).`,
1841
+ message: `${S.file.path}: nothing reads keys named after the bundle file — use module./entity./field./view. keys (${j.slice(0, 5).join(", ")}).`,
1586
1842
  messageKey: "devStudio.issue.fileKey",
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({
1843
+ params: { path: S.file.path, keys: j.slice(0, 5).join(", ") },
1844
+ path: S.file.path
1845
+ }), h === "en")
1846
+ for (const [r, c] of d) {
1847
+ O.add(r);
1848
+ const v = r.split(".")[0];
1849
+ ["module", "entity", "field", "view"].includes(v) && typeof c == "string" && de(c) && n({
1594
1850
  code: "i18n.polishInEnglish",
1595
- message: `${O.file.path}: ${o} = "${c}" — the English bundle is the English UI.`,
1851
+ message: `${S.file.path}: ${r} = "${c}" — the English bundle is the English UI.`,
1596
1852
  messageKey: "devStudio.issue.polishInEnglish",
1597
- params: { path: O.file.path, key: o, text: c },
1598
- path: O.file.path
1853
+ params: { path: S.file.path, key: r, text: c },
1854
+ path: S.file.path
1599
1855
  });
1600
1856
  }
1601
1857
  }
1602
1858
  }
1603
- if (l.length && A.length) {
1604
- const v = [
1859
+ if (l.length && L.length) {
1860
+ const b = [
1605
1861
  "module.displayName",
1606
- ...d.map((f) => `entity.${f}.displayName`),
1607
- ...p.map((f) => `${f}.displayName`),
1608
- ...k.map((f) => `view.${f}.displayName`)
1862
+ ...p.map((g) => `entity.${g}.displayName`),
1863
+ ...u.map((g) => `${g}.displayName`),
1864
+ ...N.map((g) => `view.${g}.displayName`)
1609
1865
  ].filter(
1610
- (f) => !I.has(f) && !(f.startsWith("field.") && I.has(`${f.slice(0, -12)}.label`))
1866
+ (g) => !O.has(g) && !(g.startsWith("field.") && O.has(`${g.slice(0, -12)}.label`))
1611
1867
  );
1612
- v.length && n({
1868
+ b.length && n({
1613
1869
  code: "i18n.labelMissing",
1614
- message: `The English bundle has no label for ${v.length} name(s): ${v.slice(0, 10).join(", ")}`,
1870
+ message: `The English bundle has no label for ${b.length} name(s): ${b.slice(0, 10).join(", ")}`,
1615
1871
  messageKey: "devStudio.issue.labelMissing",
1616
- params: { count: v.length, keys: v.slice(0, 10).join(", ") }
1872
+ params: { count: b.length, keys: b.slice(0, 10).join(", ") }
1617
1873
  });
1618
1874
  }
1619
- for (const { file: u, value: v } of s)
1620
- de(
1621
- v,
1875
+ for (const { file: m, value: b } of s)
1876
+ me(
1877
+ b,
1622
1878
  void 0,
1623
1879
  "",
1624
- (f, N, C) => n({
1880
+ (g, E, C) => n({
1625
1881
  code: "icons.emoji",
1626
- message: `${N} = "${C}": icon fields take an Ntd* name and column headers are words, never emoji.`,
1882
+ message: `${E} = "${C}": icon fields take an Ntd* name and column headers are words, never emoji.`,
1627
1883
  messageKey: "devStudio.issue.iconsEmoji",
1628
- params: { key: N, text: C },
1629
- path: u.path,
1630
- pointer: f
1884
+ params: { key: E, text: C },
1885
+ path: m.path,
1886
+ pointer: g
1631
1887
  })
1632
1888
  );
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);
1889
+ const w = a(".datasources.json");
1890
+ if (w.length && l.length) {
1891
+ const m = /* @__PURE__ */ new Set();
1892
+ for (const { value: g } of w) {
1893
+ const E = Array.isArray(g) ? g : g == null ? void 0 : g.dataSources;
1894
+ for (const C of Array.isArray(E) ? E : []) {
1895
+ const h = (C == null ? void 0 : C.key) ?? (C == null ? void 0 : C.name);
1896
+ typeof h == "string" && m.add(h);
1641
1897
  }
1642
1898
  }
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({
1899
+ const b = (T = l[0].value) == null ? void 0 : T.dataSources;
1900
+ (Array.isArray(b) ? b : []).forEach((g, E) => {
1901
+ const C = (g == null ? void 0 : g.key) ?? (g == null ? void 0 : g.name);
1902
+ typeof C == "string" && !m.has(C) && n({
1647
1903
  severity: "warning",
1648
1904
  code: "dataSources.undefined",
1649
1905
  message: `The manifest lists the data source "${C}", which no *.datasources.json defines.`,
1650
1906
  messageKey: "devStudio.issue.dataSourceUndefined",
1651
1907
  params: { key: C },
1652
1908
  path: l[0].file.path,
1653
- pointer: `/dataSources/${N}`
1909
+ pointer: `/dataSources/${E}`
1654
1910
  });
1655
1911
  });
1656
1912
  }
1657
- return a;
1913
+ return o;
1658
1914
  }
1659
- function de(e, i, t, a) {
1915
+ function me(e, i, t, o) {
1660
1916
  if (Array.isArray(e)) {
1661
- e.forEach((n, s) => de(n, i, `${t}/${s}`, a));
1917
+ e.forEach((n, s) => me(n, i, `${t}/${s}`, o));
1662
1918
  return;
1663
1919
  }
1664
- if (M(e))
1920
+ if (K(e))
1665
1921
  for (const [n, s] of Object.entries(e)) {
1666
- const r = `${t}/${n}`;
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")
1922
+ const a = `${t}/${n}`;
1923
+ if ((n === "icon" || n === "iconName" || n === "entityIcon" || n === "name" && i === "icon" || i === "cardIcon" || (n === "header" || n === "displayName" && i === "columns")) && typeof s == "string" && Yt(s) && o(a, n, s), n === "optionsJson" && typeof s == "string")
1668
1924
  try {
1669
- de(JSON.parse(s), "optionsJson", r, a);
1925
+ me(JSON.parse(s), "optionsJson", a, o);
1670
1926
  } catch {
1671
1927
  }
1672
- de(s, n, r, a);
1928
+ me(s, n, a, o);
1673
1929
  }
1674
1930
  }
1675
- function Ut(e, i = {}) {
1676
- const t = [], a = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
1677
- for (const r of e)
1678
- for (const l of r.files) {
1679
- if (!ve(l.path) || !oe(l.path, ".json"))
1931
+ function ti(e, i = {}) {
1932
+ const t = [], o = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
1933
+ for (const a of e)
1934
+ for (const l of a.files) {
1935
+ if (!Ne(l.path) || !re(l.path, ".json"))
1680
1936
  continue;
1681
- let h;
1937
+ let y;
1682
1938
  try {
1683
- h = _(l.text).value;
1939
+ y = z(l.text).value;
1684
1940
  } catch {
1685
1941
  continue;
1686
1942
  }
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]);
1943
+ if (re(l.path, ".manifest.json") && K(y) && typeof y.packageName == "string" && y.packageName) {
1944
+ const p = y.packageName.toLowerCase();
1945
+ o.set(p, [...o.get(p) ?? [], a.location]);
1690
1946
  }
1691
- if (oe(l.path, ".entities.json") && r.group) {
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]);
1947
+ if (re(l.path, ".entities.json") && a.group) {
1948
+ for (const p of ie(y, "entities"))
1949
+ if (K(p) && typeof p.name == "string" && p.name) {
1950
+ const u = `${a.group}/${p.name}`.toLowerCase(), N = n.get(u) ?? [];
1951
+ N.includes(a.location) || n.set(u, [...N, a.location]);
1696
1952
  }
1697
1953
  }
1698
1954
  }
1699
- for (const [r, l] of a)
1955
+ for (const [a, l] of o)
1700
1956
  l.length > 1 && t.push({
1701
1957
  severity: "error",
1702
1958
  code: "workspace.packageName",
1703
- message: `Package name ${r} is declared by ${l.length} modules: ${l.join(", ")}`,
1959
+ message: `Package name ${a} is declared by ${l.length} modules: ${l.join(", ")}`,
1704
1960
  messageKey: "devStudio.issue.duplicatePackage",
1705
- params: { name: r, count: l.length, modules: l.join(", ") }
1961
+ params: { name: a, count: l.length, modules: l.join(", ") }
1706
1962
  });
1707
- const s = new Set([...i.knownDuplicates ?? []].map((r) => r.toLowerCase()));
1708
- for (const [r, l] of n)
1709
- l.length > 1 && !s.has(r) && t.push({
1963
+ const s = new Set([...i.knownDuplicates ?? []].map((a) => a.toLowerCase()));
1964
+ for (const [a, l] of n)
1965
+ l.length > 1 && !s.has(a) && t.push({
1710
1966
  severity: "error",
1711
1967
  code: "workspace.entityName",
1712
- message: `Entity ${r} is declared by ${l.length} modules of the same group: ${l.join(", ")}`,
1968
+ message: `Entity ${a} is declared by ${l.length} modules of the same group: ${l.join(", ")}`,
1713
1969
  messageKey: "devStudio.issue.duplicateEntity",
1714
- params: { name: r, count: l.length, modules: l.join(", ") }
1970
+ params: { name: a, count: l.length, modules: l.join(", ") }
1715
1971
  });
1716
1972
  return t;
1717
1973
  }
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([
1974
+ const ne = (e) => typeof e == "object" && e !== null && !Array.isArray(e), te = (e) => typeof e == "string" && e ? e : void 0, ii = /* @__PURE__ */ new Set([
1719
1975
  "slug",
1720
1976
  "category",
1721
1977
  "subCategory",
@@ -1726,54 +1982,54 @@ const te = (e) => typeof e == "object" && e !== null && !Array.isArray(e), Q = (
1726
1982
  "translations",
1727
1983
  "modules"
1728
1984
  ]);
1729
- function We(e) {
1985
+ function He(e) {
1730
1986
  if (Array.isArray(e))
1731
1987
  return e.filter((i) => typeof i == "string");
1732
1988
  if (typeof e == "string")
1733
1989
  return e.split(",").map((i) => i.trim()).filter(Boolean);
1734
1990
  }
1735
- function Ge(e) {
1991
+ function Ze(e) {
1736
1992
  const i = {};
1737
- for (const [t, a] of Object.entries(te(e) ? e : {}))
1738
- te(a) && (i[t] = { ...a, name: String(a.name ?? "") });
1993
+ for (const [t, o] of Object.entries(ne(e) ? e : {}))
1994
+ ne(o) && (i[t] = { ...o, name: String(o.name ?? "") });
1739
1995
  return i;
1740
1996
  }
1741
- function Gt(e, i) {
1742
- const t = te(e) ? e : {}, a = Object.fromEntries(Object.entries(t).filter(([n]) => !Wt.has(n)));
1997
+ function ni(e, i) {
1998
+ const t = ne(e) ? e : {}, o = Object.fromEntries(Object.entries(t).filter(([n]) => !ii.has(n)));
1743
1999
  return {
1744
2000
  id: String(t.slug ?? ""),
1745
- category: Q(t.category),
1746
- subCategory: Q(t.subCategory),
1747
- parentId: Q(t.parentSlug),
1748
- icon: Q(t.icon),
2001
+ category: te(t.category),
2002
+ subCategory: te(t.subCategory),
2003
+ parentId: te(t.parentSlug),
2004
+ icon: te(t.icon),
1749
2005
  sortOrder: typeof t.sortOrder == "number" ? t.sortOrder : void 0,
1750
- tags: We(t.tags),
1751
- translations: Ge(t.translations),
1752
- modules: (Array.isArray(t.modules) ? t.modules : []).filter(te).map((n) => ({
2006
+ tags: He(t.tags),
2007
+ translations: Ze(t.translations),
2008
+ modules: (Array.isArray(t.modules) ? t.modules : []).filter(ne).map((n) => ({
1753
2009
  moduleId: String(n.packageName ?? ""),
1754
2010
  required: n.required === !0,
1755
- condition: Q(n.condition),
1756
- description: Q(n.description)
2011
+ condition: te(n.condition),
2012
+ description: te(n.description)
1757
2013
  })),
1758
- ...Object.keys(a).length ? { extra: a } : {},
2014
+ ...Object.keys(o).length ? { extra: o } : {},
1759
2015
  ...i ? { readOnly: i } : {}
1760
2016
  };
1761
2017
  }
1762
- const $e = (e) => Object.fromEntries(Object.entries(e).filter(([, i]) => i !== void 0));
1763
- function xe(e, i) {
2018
+ const je = (e) => Object.fromEntries(Object.entries(e).filter(([, i]) => i !== void 0));
2019
+ function Me(e, i) {
1764
2020
  var l;
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);
1767
- return $e({
1768
- ...d,
1769
- packageName: h.moduleId,
2021
+ const t = ne(i) ? i : {}, o = (Array.isArray(t.modules) ? t.modules : []).filter(ne), s = JSON.stringify(He(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, a = (y) => {
2022
+ const p = o.find((u) => u.packageName === y.moduleId);
2023
+ return je({
2024
+ ...p,
2025
+ packageName: y.moduleId,
1770
2026
  // seed entries spell `required` out, also when it is false
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
2027
+ required: y.required === !0 ? !0 : !p || "required" in p ? !1 : void 0,
2028
+ condition: y.condition || void 0,
2029
+ description: y.description || void 0
1774
2030
  });
1775
2031
  };
1776
- return $e({
2032
+ return je({
1777
2033
  ...t,
1778
2034
  slug: e.id,
1779
2035
  category: e.category,
@@ -1784,16 +2040,16 @@ function xe(e, i) {
1784
2040
  ...e.extra,
1785
2041
  tags: s,
1786
2042
  translations: e.translations,
1787
- modules: e.modules.map(r)
2043
+ modules: e.modules.map(a)
1788
2044
  });
1789
2045
  }
1790
- function Ie(e, i = "en") {
1791
- const t = Ge(e.translations);
2046
+ function De(e, i = "en") {
2047
+ const t = Ze(e.translations);
1792
2048
  Object.keys(t).length === 0 && e.name && (t[i] = {
1793
2049
  name: e.name,
1794
2050
  ...e.description ? { description: e.description } : {}
1795
2051
  });
1796
- const a = $e({
2052
+ const o = je({
1797
2053
  isActive: e.isActive,
1798
2054
  compliance: e.compliance,
1799
2055
  defaultLanguage: e.defaultLanguage ?? void 0,
@@ -1814,11 +2070,11 @@ function Ie(e, i = "en") {
1814
2070
  condition: n.condition ?? void 0,
1815
2071
  description: n.description ?? void 0
1816
2072
  })),
1817
- extra: a,
2073
+ extra: o,
1818
2074
  readOnly: e.source === "seed" || e.source === "code"
1819
2075
  };
1820
2076
  }
1821
- function _t(e) {
2077
+ function si(e) {
1822
2078
  const i = e.extra ?? {};
1823
2079
  return {
1824
2080
  slug: e.id,
@@ -1838,620 +2094,620 @@ function _t(e) {
1838
2094
  ...typeof i.defaultLanguage == "string" ? { defaultLanguage: i.defaultLanguage } : {}
1839
2095
  };
1840
2096
  }
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$/;
1842
- function fe(e) {
1843
- const i = (t, a = 2) => String(t).padStart(a, "0");
2097
+ const F = (...e) => e.filter(Boolean).join("/"), oi = (e) => e.slice(0, Math.max(0, e.lastIndexOf("/"))), ai = (e) => e.slice(e.lastIndexOf("/") + 1), he = (e) => typeof e == "object" && e !== null && !Array.isArray(e), se = (e) => typeof e == "string" && e ? e : void 0, ri = /* @__PURE__ */ new Set(["bin", "obj", "node_modules"]), we = (e) => e.startsWith(".") || ri.has(e), li = /^wizard-templates-.+\.seed\.json$/i, ci = /^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})(\d{3})Z$/;
2098
+ function ve(e) {
2099
+ const i = (t, o = 2) => String(t).padStart(o, "0");
1844
2100
  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`;
1845
2101
  }
1846
- function Yt(e) {
1847
- const i = Zt.exec(e);
2102
+ function di(e) {
2103
+ const i = ci.exec(e);
1848
2104
  return i ? Date.UTC(+i[1], +i[2] - 1, +i[3], +i[4], +i[5], +i[6], +i[7]) : void 0;
1849
2105
  }
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();
1853
- let r = null;
1854
- const l = (o) => {
1855
- const c = i.find((y) => y.id === o);
2106
+ const pi = (e, i) => F(oi(e), ".revisions", `${ai(e)}.${i}`), ui = (e) => e.normalize("NFKD").replace(/[̀-ͯ]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "custom";
2107
+ function Si(e) {
2108
+ const { roots: i } = e, t = e.revisions !== !1, o = e.now ?? (() => /* @__PURE__ */ new Date()), n = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
2109
+ let a = null;
2110
+ const l = (r) => {
2111
+ const c = i.find((v) => v.id === r);
1856
2112
  if (!c)
1857
- throw new Error(`Unknown workspace "${o}"`);
2113
+ throw new Error(`Unknown workspace "${r}"`);
1858
2114
  return c;
1859
- }, h = (o) => {
1860
- const c = l(o);
2115
+ }, y = (r) => {
2116
+ const c = l(r);
1861
2117
  if (c.readOnly)
1862
2118
  throw new Error(`Workspace "${c.label}" is read-only`);
1863
2119
  return c;
1864
2120
  };
1865
- async function d(o, c) {
1866
- const y = await o.read(c);
2121
+ async function p(r, c) {
2122
+ const v = await r.read(c);
1867
2123
  try {
1868
- const g = y ? _(y.text).value : void 0;
1869
- return me(g) ? g : {};
2124
+ const $ = v ? z(v.text).value : void 0;
2125
+ return he($) ? $ : {};
1870
2126
  } catch {
1871
2127
  return {};
1872
2128
  }
1873
2129
  }
1874
- function p(o, c, y, g, x) {
1875
- const m = ie(g.packageName) ?? (c || o.id);
2130
+ function u(r, c, v, $, A) {
2131
+ const f = se($.packageName) ?? (c || r.id);
1876
2132
  return {
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),
2133
+ workspaceId: r.id,
2134
+ id: f,
2135
+ packageId: se($.category),
2136
+ label: se($.displayName) ?? f,
2137
+ description: se($.description),
2138
+ version: se($.version),
1883
2139
  location: c,
1884
- readOnly: o.readOnly,
1885
- files: x,
1886
- search: `${c} ${y}`
2140
+ readOnly: r.readOnly,
2141
+ files: A,
2142
+ search: `${c} ${v}`
1887
2143
  };
1888
2144
  }
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
- $
2145
+ async function N(r) {
2146
+ const c = /* @__PURE__ */ new Map(), v = async ($) => {
2147
+ const A = await r.fs.list($), f = A.filter((k) => k.kind === "file" && k.name.toLowerCase().endsWith(".manifest.json")).map((k) => k.name).sort()[0];
2148
+ if (f) {
2149
+ const k = A.filter((D) => D.kind === "file").map((D) => D.name), M = u(
2150
+ r,
2151
+ $,
2152
+ f,
2153
+ await p(r.fs, F($, f)),
2154
+ k
1899
2155
  );
1900
- c.has(L.id.toLowerCase()) || (c.set(L.id.toLowerCase(), { ref: L, dir: g }), s.set(`${o.id}:${L.id.toLowerCase()}`, g));
2156
+ c.has(M.id.toLowerCase()) || (c.set(M.id.toLowerCase(), { ref: M, dir: $ }), s.set(`${r.id}:${M.id.toLowerCase()}`, $));
1901
2157
  }
1902
- for (const $ of x)
1903
- $.kind === "directory" && !ue($.name) && !(g === "" && $.name === A(o)) && await y(F(g, $.name));
2158
+ for (const k of A)
2159
+ k.kind === "directory" && !we(k.name) && !($ === "" && k.name === L(r)) && await v(F($, k.name));
1904
2160
  };
1905
- return await y(""), c;
2161
+ return await v(""), c;
1906
2162
  }
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;
2163
+ const L = (r) => r.templatesDir === !1 ? void 0 : r.templatesDir ?? "Templates", I = (r) => {
2164
+ n.delete(r.id), h.clear();
2165
+ }, x = (r) => {
2166
+ let c = n.get(r.id);
2167
+ return c || (c = N(r), n.set(r.id, c), c.catch(() => n.delete(r.id))), c;
1912
2168
  };
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 };
2169
+ async function O(r) {
2170
+ const c = l(r.workspaceId), v = await x(c), $ = s.get(`${c.id}:${r.id.toLowerCase()}`), A = v.get(r.id.toLowerCase()) ?? ($ === void 0 ? void 0 : [...v.values()].find((f) => f.dir === $));
2171
+ if (!A)
2172
+ throw new Error(`Module "${r.id}" is not in "${c.label}"`);
2173
+ return { root: c, module: A };
1918
2174
  }
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);
2175
+ async function w(r, c) {
2176
+ const v = [], $ = async (A, f) => {
2177
+ const k = await r.list(F(c, A));
2178
+ if (!(f && k.some((M) => M.kind === "file" && M.name.toLowerCase().endsWith(".manifest.json"))))
2179
+ for (const M of k)
2180
+ M.kind === "file" ? v.push(F(A, M.name)) : we(M.name) || await $(F(A, M.name), !0);
1925
2181
  };
1926
- return await g("", !1), y.sort();
2182
+ return await $("", !1), v.sort();
1927
2183
  }
1928
- async function D(o, c, y, g) {
1929
- t && await o.write(Xt(c, g), y);
2184
+ async function T(r, c, v, $) {
2185
+ t && await r.write(pi(c, $), v);
1930
2186
  }
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)
2187
+ async function m(r, c) {
2188
+ const v = [], $ = async (A) => {
2189
+ const f = await r.list(F(c, A));
2190
+ for (const k of f)
2191
+ if (k.kind === "directory" && k.name === ".revisions")
2192
+ for (const M of await r.list(F(c, A, k.name))) {
2193
+ const D = /^(.*)\.(\d{8}T\d{9}Z)$/.exec(M.name);
2194
+ M.kind === "file" && D && v.push({
2195
+ path: F(A, D[1]),
2196
+ stamp: D[2],
2197
+ at: F(A, ".revisions", M.name)
1942
2198
  });
1943
2199
  }
1944
- else $.kind === "directory" && !ue($.name) && await g(F(x, $.name));
2200
+ else k.kind === "directory" && !we(k.name) && await $(F(A, k.name));
1945
2201
  };
1946
- return await g(""), y;
2202
+ return await $(""), v;
1947
2203
  }
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() : [];
2204
+ async function b(r) {
2205
+ const c = L(r);
2206
+ return c ? (await r.fs.list(c)).filter((v) => v.kind === "file" && li.test(v.name)).map((v) => F(c, v.name)).sort() : [];
1951
2207
  }
1952
- async function f(o, c) {
1953
- const y = await o.fs.read(c);
1954
- if (!y)
2208
+ async function g(r, c) {
2209
+ const v = await r.fs.read(c);
2210
+ if (!v)
1955
2211
  return { text: "", entries: [] };
1956
- const g = _(y.text).value;
1957
- return { text: y.text, entries: Array.isArray(g) ? g : [] };
2212
+ const $ = z(v.text).value;
2213
+ return { text: v.text, entries: Array.isArray($) ? $ : [] };
1958
2214
  }
1959
- const N = {
1960
- arrayKey: (o) => o === "" ? "slug" : o.endsWith("/modules") ? "packageName" : void 0
2215
+ const E = {
2216
+ arrayKey: (r) => r === "" ? "slug" : r.endsWith("/modules") ? "packageName" : void 0
1961
2217
  };
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);
2218
+ async function C(r, c, v, $) {
2219
+ if (v && await T(r.fs, c, v, ve(o())), $.length === 0) {
2220
+ await r.fs.remove(c);
1965
2221
  return;
1966
2222
  }
1967
- await o.fs.write(
2223
+ await r.fs.write(
1968
2224
  c,
1969
- y ? De(y, g, N) : ae(g)
2225
+ v ? qe(v, $, E) : le($)
1970
2226
  );
1971
2227
  }
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 $;
2228
+ const h = /* @__PURE__ */ new Map();
2229
+ function S(r, c) {
2230
+ const v = `${r.id}:${c.dir}`;
2231
+ let $ = h.get(v);
2232
+ if (!$) {
2233
+ const A = (c.ref.files ?? []).filter((f) => /\.(manifest|entities)\.json$/i.test(f));
2234
+ $ = Promise.all(
2235
+ A.map(async (f) => {
2236
+ var k;
1981
2237
  return {
1982
- path: m,
1983
- text: (($ = await o.fs.read(F(c.dir, m))) == null ? void 0 : $.text) ?? ""
2238
+ path: f,
2239
+ text: ((k = await r.fs.read(F(c.dir, f))) == null ? void 0 : k.text) ?? ""
1984
2240
  };
1985
2241
  })
1986
- ).then((m) => ({ location: c.dir, group: c.dir.split("/")[0], files: m })), j.set(y, g);
2242
+ ).then((f) => ({ location: c.dir, group: c.dir.split("/")[0], files: f })), h.set(v, $);
1987
2243
  }
1988
- return g;
2244
+ return $;
1989
2245
  }
1990
- async function w(o) {
2246
+ async function d(r) {
1991
2247
  var c;
1992
- return r || await ((c = E.listTemplates) == null ? void 0 : c.call(E)), r == null ? void 0 : r.get(o.toLowerCase());
2248
+ return a || await ((c = j.listTemplates) == null ? void 0 : c.call(j)), a == null ? void 0 : a.get(r.toLowerCase());
1993
2249
  }
1994
- const E = {
2250
+ const j = {
1995
2251
  invalidate() {
1996
- n.clear(), j.clear(), r = null;
2252
+ n.clear(), h.clear(), a = null;
1997
2253
  },
1998
2254
  async listWorkspaces() {
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 } : {}
2255
+ return i.map((r) => ({
2256
+ id: r.id,
2257
+ label: r.label,
2258
+ ...r.description ? { description: r.description } : {},
2259
+ ...r.icon ? { icon: r.icon } : {},
2260
+ ...r.readOnly ? { readOnly: !0 } : {}
2005
2261
  }));
2006
2262
  },
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) }))
2263
+ async listModules(r) {
2264
+ const c = i.findIndex((f) => f.id === r), v = l(r);
2265
+ I(v);
2266
+ const $ = await x(v), A = await Promise.all(
2267
+ i.slice(0, c).map(async (f) => ({ r: f, modules: await x(f) }))
2012
2268
  );
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));
2269
+ return [...$.values()].map(({ ref: f }) => {
2270
+ const k = A.find((M) => M.modules.has(f.id.toLowerCase()));
2271
+ return k ? { ...f, shadowedBy: k.r.id } : f;
2272
+ }).sort((f, k) => f.id.localeCompare(k.id));
2017
2273
  },
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,
2274
+ async readModule(r) {
2275
+ const { root: c, module: v } = await O(r), $ = await w(c.fs, v.dir), A = [];
2276
+ for (const f of $) {
2277
+ const k = await c.fs.read(F(v.dir, f));
2278
+ k && A.push({
2279
+ path: f,
2280
+ text: k.text,
2281
+ version: k.version,
2026
2282
  ...c.readOnly ? { readOnly: !0 } : {}
2027
2283
  });
2028
2284
  }
2029
- return x;
2285
+ return A;
2030
2286
  },
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 } : {} });
2287
+ async writeModule(r, c) {
2288
+ const { module: v } = await O(r), $ = y(r.workspaceId), A = /* @__PURE__ */ new Map(), f = [];
2289
+ for (const D of c) {
2290
+ if (D.path.split("/").some((X) => X === ".." || X === "" || X.startsWith(".")))
2291
+ throw new Error(`Refusing to write outside the module: ${D.path}`);
2292
+ const R = await $.fs.read(F(v.dir, D.path));
2293
+ A.set(D.path, R);
2294
+ const H = D.baseVersion;
2295
+ (H === void 0 ? R !== null && D.type === "write" : (R == null ? void 0 : R.version) !== H) && f.push({ path: D.path, ...R ? { currentVersion: R.version } : {} });
2040
2296
  }
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);
2297
+ if (f.length)
2298
+ return { ok: !1, conflicts: f };
2299
+ const k = ve(o()), M = {};
2300
+ for (const D of c) {
2301
+ const R = F(v.dir, D.path), H = A.get(D.path);
2302
+ H && await T($.fs, R, H.text, k), D.type === "write" ? M[D.path] = await $.fs.write(R, D.text) : await $.fs.remove(R);
2047
2303
  }
2048
- return S(g), { ok: !0, versions: L, revision: $ };
2304
+ return I($), { ok: !0, versions: M, revision: k };
2049
2305
  },
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"
2306
+ async createModule(r) {
2307
+ var f;
2308
+ const c = y(r.workspaceId), v = r.id.startsWith(G) ? r.id.slice(G.length) : r.id.split(".").pop() ?? r.id, $ = ((f = e.moduleFolder) == null ? void 0 : f.call(e, r)) ?? F(
2309
+ P(r.packageId ?? "") || "Custom",
2310
+ P(v) || "Module"
2055
2311
  );
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;
2312
+ if ((await c.fs.list($)).length > 0)
2313
+ throw new Error(`The folder ${$} is not empty`);
2314
+ if ((await x(c)).has(r.id.toLowerCase()))
2315
+ throw new Error(`"${r.id}" already exists in ${c.label}`);
2316
+ for (const k of r.files)
2317
+ await c.fs.write(F($, k.path), k.text);
2318
+ I(c);
2319
+ const A = (await x(c)).get(r.id.toLowerCase());
2320
+ if (!A)
2321
+ throw new Error(`The new module ${r.id} has no manifest naming it`);
2322
+ return A.ref;
2067
2323
  },
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);
2324
+ async deleteModule(r) {
2325
+ const { module: c } = await O(r), v = y(r.workspaceId);
2326
+ await v.fs.removeDir(c.dir), s.delete(`${v.id}:${r.id.toLowerCase()}`), I(v);
2071
2327
  },
2072
2328
  async listTemplates() {
2073
- const o = /* @__PURE__ */ new Map(), c = [];
2074
- for (const y of i)
2075
- for (const g of await v(y)) {
2076
- let x;
2329
+ const r = /* @__PURE__ */ new Map(), c = [];
2330
+ for (const v of i)
2331
+ for (const $ of await b(v)) {
2332
+ let A;
2077
2333
  try {
2078
- x = (await f(y, g)).entries;
2334
+ A = (await g(v, $)).entries;
2079
2335
  } catch {
2080
2336
  continue;
2081
2337
  }
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($));
2338
+ for (const f of A) {
2339
+ const k = ni(f, v.readOnly);
2340
+ k.id && !r.has(k.id.toLowerCase()) && (r.set(k.id.toLowerCase(), { rootId: v.id, path: $ }), c.push(k));
2085
2341
  }
2086
2342
  }
2087
- return r = o, c;
2343
+ return a = r, c;
2088
2344
  },
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);
2345
+ async saveTemplate(r, c) {
2346
+ const v = (c == null ? void 0 : c.previousId) ?? r.id, $ = await d(v);
2347
+ if ($) {
2348
+ const A = y($.rootId), { text: f, entries: k } = await g(A, $.path), M = k.findIndex(
2349
+ (R) => he(R) && String(R.slug ?? "").toLowerCase() === v.toLowerCase()
2350
+ ), D = [...k];
2351
+ D[M < 0 ? D.length : M] = Me(
2352
+ r,
2353
+ M < 0 ? void 0 : k[M]
2354
+ ), await C(A, $.path, f, D);
2099
2355
  } else {
2100
- const x = i.find((K) => !K.readOnly && A(K));
2101
- if (!x)
2356
+ const A = i.find((D) => !D.readOnly && L(D));
2357
+ if (!A)
2102
2358
  throw new Error("No writable folder holds templates");
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)]);
2359
+ const f = F(
2360
+ L(A),
2361
+ `wizard-templates-${ui(r.category ?? "custom")}.seed.json`
2362
+ ), { text: k, entries: M } = await g(A, f);
2363
+ await C(A, f, k, [...M, Me(r)]);
2108
2364
  }
2109
- return r = null, { ...o, extra: o.extra };
2365
+ return a = null, { ...r, extra: r.extra };
2110
2366
  },
2111
- async deleteTemplate(o) {
2112
- const c = await w(o);
2367
+ async deleteTemplate(r) {
2368
+ const c = await d(r);
2113
2369
  if (!c)
2114
2370
  return;
2115
- const y = h(c.rootId), { text: g, entries: x } = await f(y, c.path);
2371
+ const v = y(c.rootId), { text: $, entries: A } = await g(v, c.path);
2116
2372
  await C(
2117
- y,
2373
+ v,
2118
2374
  c.path,
2119
- g,
2120
- x.filter(
2121
- (m) => !(me(m) && String(m.slug ?? "").toLowerCase() === o.toLowerCase())
2375
+ $,
2376
+ A.filter(
2377
+ (f) => !(he(f) && String(f.slug ?? "").toLowerCase() === r.toLowerCase())
2122
2378
  )
2123
- ), r = null;
2379
+ ), a = null;
2124
2380
  },
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 }],
2381
+ async validate(r, c) {
2382
+ const v = l(r.workspaceId), $ = [...(await x(v)).values()], A = await Promise.all(
2383
+ $.filter((M) => M.ref.id.toLowerCase() !== r.id.toLowerCase()).map((M) => S(v, M))
2384
+ ), f = $.find((M) => M.ref.id.toLowerCase() === r.id.toLowerCase()), k = (f == null ? void 0 : f.dir) ?? r.id;
2385
+ return ti(
2386
+ [...A, { location: k, group: k.split("/")[0], files: c }],
2131
2387
  {
2132
2388
  knownDuplicates: e.knownDuplicates
2133
2389
  }
2134
- ).filter((L) => L.message.split(/[ ,]+/).includes($));
2390
+ ).filter((M) => M.message.split(/[ ,]+/).includes(k));
2135
2391
  },
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,
2145
- summary: L.sort().join(", "),
2392
+ async listRevisions(r, c) {
2393
+ const { root: v, module: $ } = await O(r), A = (await m(v.fs, $.dir)).filter(
2394
+ (k) => !c || k.path === c
2395
+ ), f = /* @__PURE__ */ new Map();
2396
+ for (const k of A)
2397
+ f.set(k.stamp, [...f.get(k.stamp) ?? [], k.path]);
2398
+ return [...f].map(([k, M]) => ({
2399
+ id: k,
2400
+ timestamp: di(k) ?? 0,
2401
+ summary: M.sort().join(", "),
2146
2402
  ...c ? { path: c } : {}
2147
- })).sort(($, L) => L.timestamp - $.timestamp);
2403
+ })).sort((k, M) => M.timestamp - k.timestamp);
2148
2404
  },
2149
- async readRevision(o, c, y) {
2150
- var L;
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)
2405
+ async readRevision(r, c, v) {
2406
+ var M;
2407
+ const { root: $, module: A } = await O(r), f = (await m($.fs, A.dir)).filter(
2408
+ (D) => D.stamp === c && (!v || D.path === v)
2153
2409
  );
2154
- if (m.length === 0)
2410
+ if (f.length === 0)
2155
2411
  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);
2412
+ const k = {};
2413
+ for (const D of f)
2414
+ k[D.path] = ((M = await $.fs.read(F(A.dir, D.at))) == null ? void 0 : M.text) ?? "";
2415
+ return v ? k[v] : JSON.stringify(k, null, 2);
2160
2416
  },
2161
- async rollback(o, c, y) {
2162
- var L;
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)
2417
+ async rollback(r, c, v) {
2418
+ var M;
2419
+ const { module: $ } = await O(r), A = y(r.workspaceId), f = (await m(A.fs, $.dir)).filter(
2420
+ (D) => D.stamp === c && (!v || D.path === v)
2165
2421
  );
2166
- if (m.length === 0)
2422
+ if (f.length === 0)
2167
2423
  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);
2424
+ const k = ve(o());
2425
+ for (const D of f) {
2426
+ const R = F($.dir, D.path), H = ((M = await A.fs.read(F($.dir, D.at))) == null ? void 0 : M.text) ?? "", X = await A.fs.read(R);
2427
+ X && await T(A.fs, R, X.text, k), await A.fs.write(R, H);
2172
2428
  }
2173
- S(x);
2429
+ I(A);
2174
2430
  }
2175
2431
  };
2176
- return E;
2432
+ return j;
2177
2433
  }
2178
- class ye extends Error {
2179
- constructor(i, t, a) {
2180
- super(i), this.status = t, this.body = a, this.name = "OmniVerkRestError";
2434
+ class be extends Error {
2435
+ constructor(i, t, o) {
2436
+ super(i), this.status = t, this.body = o, this.name = "OmniVerkRestError";
2181
2437
  }
2182
2438
  }
2183
- const ei = new TextDecoder("utf-8", { ignoreBOM: !0 });
2184
- function ti(e) {
2439
+ const mi = new TextDecoder("utf-8", { ignoreBOM: !0 });
2440
+ function fi(e) {
2185
2441
  const i = atob(e), t = new Uint8Array(i.length);
2186
- for (let a = 0; a < i.length; a++)
2187
- t[a] = i.charCodeAt(a);
2188
- return ei.decode(t);
2442
+ for (let o = 0; o < i.length; o++)
2443
+ t[o] = i.charCodeAt(o);
2444
+ return mi.decode(t);
2189
2445
  }
2190
- function Ce(e) {
2446
+ function Ke(e) {
2191
2447
  const i = new TextEncoder().encode(e);
2192
2448
  let t = "";
2193
- for (let a = 0; a < i.length; a += 32768)
2194
- t += String.fromCharCode(...i.subarray(a, a + 32768));
2449
+ for (let o = 0; o < i.length; o += 32768)
2450
+ t += String.fromCharCode(...i.subarray(o, o + 32768));
2195
2451
  return btoa(t);
2196
2452
  }
2197
- function ii(e) {
2453
+ function yi(e) {
2198
2454
  let i = 2166136261;
2199
2455
  for (let t = 0; t < e.length; t++)
2200
2456
  i = Math.imul(i ^ e.charCodeAt(t), 16777619);
2201
2457
  return `${e.length}:${(i >>> 0).toString(16)}`;
2202
2458
  }
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}`, {
2207
- method: d,
2459
+ function ki(e = {}) {
2460
+ const i = (e.baseUrl ?? "/api").replace(/\/+$/, ""), t = e.fetch ?? ((p, u) => globalThis.fetch(p, u)), o = e.language ?? "en", n = encodeURIComponent;
2461
+ async function s(p, u, N, L = "json") {
2462
+ const I = typeof e.headers == "function" ? await e.headers() : e.headers ?? {}, x = await t(`${i}${u}`, {
2463
+ method: p,
2208
2464
  credentials: e.credentials ?? "same-origin",
2209
2465
  headers: {
2210
- Accept: A === "json" ? "application/json" : "text/plain, application/json",
2211
- ...k === void 0 ? {} : { "Content-Type": "application/json" },
2212
- ...S
2466
+ Accept: L === "json" ? "application/json" : "text/plain, application/json",
2467
+ ...N === void 0 ? {} : { "Content-Type": "application/json" },
2468
+ ...I
2213
2469
  },
2214
- ...k === void 0 ? {} : { body: JSON.stringify(k) }
2215
- }), I = await T.text();
2216
- let b = I;
2217
- if (A === "json" || !T.ok)
2470
+ ...N === void 0 ? {} : { body: JSON.stringify(N) }
2471
+ }), O = await x.text();
2472
+ let w = O;
2473
+ if (L === "json" || !x.ok)
2218
2474
  try {
2219
- b = I ? JSON.parse(I) : void 0;
2475
+ w = O ? JSON.parse(O) : void 0;
2220
2476
  } catch {
2221
- b = I;
2477
+ w = O;
2222
2478
  }
2223
- if (!T.ok)
2224
- throw new ye(
2225
- `${d} ${p}: ${T.status} ${T.statusText}`,
2226
- T.status,
2227
- b
2479
+ if (!x.ok)
2480
+ throw new be(
2481
+ `${p} ${u}: ${x.status} ${x.statusText}`,
2482
+ x.status,
2483
+ w
2228
2484
  );
2229
- return b;
2485
+ return w;
2230
2486
  }
2231
- const r = e.templates === !1 ? {} : {
2487
+ const a = e.templates === !1 ? {} : {
2232
2488
  async listTemplates() {
2233
- const d = await s(
2489
+ const p = await s(
2234
2490
  "GET",
2235
- `/module-templates?lang=${n(a)}&hidden=true`
2491
+ `/module-templates?lang=${n(o)}&hidden=true`
2236
2492
  );
2237
2493
  return (await Promise.all(
2238
- (d ?? []).map(
2239
- (k) => s(
2494
+ (p ?? []).map(
2495
+ (N) => s(
2240
2496
  "GET",
2241
- `/module-templates/${n(k.slug)}?lang=${n(a)}`
2497
+ `/module-templates/${n(N.slug)}?lang=${n(o)}`
2242
2498
  )
2243
2499
  )
2244
- )).map((k) => Ie(k, a));
2500
+ )).map((N) => De(N, o));
2245
2501
  },
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(
2502
+ async saveTemplate(p, u) {
2503
+ const N = (u == null ? void 0 : u.previousId) ?? p.id, L = si(p);
2504
+ let I;
2505
+ if ((u == null ? void 0 : u.previousId) === void 0)
2506
+ I = await s(
2251
2507
  "GET",
2252
- `/module-templates/${n(d.id)}?lang=${n(a)}`
2508
+ `/module-templates/${n(p.id)}?lang=${n(o)}`
2253
2509
  ).then(
2254
2510
  () => !0,
2255
- (I) => I instanceof ye && I.status === 404 ? !1 : Promise.reject(I)
2511
+ (O) => O instanceof be && O.status === 404 ? !1 : Promise.reject(O)
2256
2512
  ) ? await s(
2257
2513
  "PUT",
2258
- `/module-templates/${n(d.id)}?lang=${n(a)}`,
2259
- A
2260
- ) : await s("POST", `/module-templates?lang=${n(a)}`, A);
2514
+ `/module-templates/${n(p.id)}?lang=${n(o)}`,
2515
+ L
2516
+ ) : await s("POST", `/module-templates?lang=${n(o)}`, L);
2261
2517
  else {
2262
- if (k !== d.id)
2518
+ if (N !== p.id)
2263
2519
  throw new Error(
2264
2520
  "The OmniVerk API keeps a template's slug: save it as a new template instead."
2265
2521
  );
2266
- S = await s(
2522
+ I = await s(
2267
2523
  "PUT",
2268
- `/module-templates/${n(k)}?lang=${n(a)}`,
2269
- A
2524
+ `/module-templates/${n(N)}?lang=${n(o)}`,
2525
+ L
2270
2526
  );
2271
2527
  }
2272
- return Ie(S, a);
2528
+ return De(I, o);
2273
2529
  },
2274
- async deleteTemplate(d) {
2275
- await s("DELETE", `/module-templates/${n(d)}`);
2530
+ async deleteTemplate(p) {
2531
+ await s("DELETE", `/module-templates/${n(p)}`);
2276
2532
  }
2277
2533
  };
2278
2534
  if ((e.mode ?? "manifest-only") === "manifest-only") {
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) };
2535
+ const p = "seed", u = /* @__PURE__ */ new Map(), N = (I) => {
2536
+ var x, O;
2537
+ return ((x = u.get(I)) == null ? void 0 : x.manifestFile) ?? `${(O = I.split(".").pop()) == null ? void 0 : O.toLowerCase()}.manifest.json`;
2538
+ }, L = async (I) => {
2539
+ const x = await s("GET", `/module-manifests/${n(I)}`), O = le(x, { finalNewline: !1 });
2540
+ return { path: N(I), text: O, version: yi(O) };
2285
2541
  };
2286
2542
  return {
2287
2543
  async listWorkspaces() {
2288
- return [{ id: d, label: e.workspaceLabel ?? "Seed/Modules" }];
2544
+ return [{ id: p, label: e.workspaceLabel ?? "Seed/Modules" }];
2289
2545
  },
2290
2546
  async listModules() {
2291
- const S = await s("GET", "/module-manifests");
2292
- return p.clear(), (S ?? []).map((T) => (p.set(T.packageName, T), {
2293
- workspaceId: d,
2294
- id: T.packageName,
2547
+ const I = await s("GET", "/module-manifests");
2548
+ return u.clear(), (I ?? []).map((x) => (u.set(x.packageName, x), {
2549
+ workspaceId: p,
2550
+ id: x.packageName,
2295
2551
  // the package is the manifest's category, as in the `files` mode and OmniVerk's own
2296
2552
  // trees (1.3.14); the first folder only while the API does not list the category
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,
2553
+ packageId: x.category || x.path.split("/")[0] || void 0,
2554
+ label: x.packageName,
2555
+ location: x.path,
2556
+ files: [x.manifestFile],
2557
+ search: x.path,
2302
2558
  // only the manifest: the checks and the preview do not count what is not given
2303
2559
  contents: "manifest"
2304
2560
  }));
2305
2561
  },
2306
- async readModule(S) {
2307
- return [await A(S.id)];
2562
+ async readModule(I) {
2563
+ return [await L(I.id)];
2308
2564
  },
2309
- async writeModule(S, T) {
2310
- const I = k(S.id), b = T.find((N) => N.path !== I || N.type !== "write");
2311
- if (b)
2565
+ async writeModule(I, x) {
2566
+ const O = N(I.id), w = x.find((E) => E.path !== O || E.type !== "write");
2567
+ if (w)
2312
2568
  throw new Error(
2313
- `This OmniVerk API stores only the manifest; "${b.path}" was not saved.`
2569
+ `This OmniVerk API stores only the manifest; "${w.path}" was not saved.`
2314
2570
  );
2315
- const D = T[0];
2316
- if (!D || D.type !== "write")
2571
+ const T = x[0];
2572
+ if (!T || T.type !== "write")
2317
2573
  return { ok: !0, versions: {} };
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(
2574
+ const m = await L(I.id);
2575
+ if (T.baseVersion !== void 0 && T.baseVersion !== m.version)
2576
+ return { ok: !1, conflicts: [{ path: O, currentVersion: m.version }] };
2577
+ const b = await s(
2322
2578
  "PUT",
2323
- `/module-manifests/${n(S.id)}`,
2579
+ `/module-manifests/${n(I.id)}`,
2324
2580
  {
2325
- manifest: _(D.text).value
2581
+ manifest: z(T.text).value
2326
2582
  }
2327
- ), f = await A(S.id);
2583
+ ), g = await L(I.id);
2328
2584
  return {
2329
2585
  ok: !0,
2330
- versions: { [I]: f.version },
2331
- ...v != null && v.revision ? { revision: v.revision } : {}
2586
+ versions: { [O]: g.version },
2587
+ ...b != null && b.revision ? { revision: b.revision } : {}
2332
2588
  };
2333
2589
  },
2334
- async listRevisions(S) {
2590
+ async listRevisions(I) {
2335
2591
  return (await s(
2336
2592
  "GET",
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` } : {}
2593
+ `/module-manifests/${n(I.id)}/revisions`
2594
+ ) ?? []).map((O) => ({
2595
+ id: O.id,
2596
+ timestamp: Date.parse(O.at) || 0,
2597
+ path: N(I.id),
2598
+ ...O.sizeBytes !== void 0 ? { summary: `${O.sizeBytes} B` } : {}
2343
2599
  }));
2344
2600
  },
2345
- async readRevision(S, T) {
2601
+ async readRevision(I, x) {
2346
2602
  return s(
2347
2603
  "GET",
2348
- `/module-manifests/${n(S.id)}/revisions/${n(T)}`,
2604
+ `/module-manifests/${n(I.id)}/revisions/${n(x)}`,
2349
2605
  void 0,
2350
2606
  "text"
2351
2607
  );
2352
2608
  },
2353
- async rollback(S, T) {
2609
+ async rollback(I, x) {
2354
2610
  await s(
2355
2611
  "POST",
2356
- `/module-manifests/${n(S.id)}/revisions/${n(T)}/rollback`
2612
+ `/module-manifests/${n(I.id)}/revisions/${n(x)}/rollback`
2357
2613
  );
2358
2614
  },
2359
- ...r
2615
+ ...a
2360
2616
  };
2361
2617
  }
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) }));
2618
+ const l = (p) => `/module-files/${n(p.workspaceId)}/modules/${n(p.id)}`, y = (p) => p.map((u) => ({ path: u.path, content: Ke(u.text) }));
2363
2619
  return {
2364
2620
  async listWorkspaces() {
2365
2621
  return s("GET", "/module-files/workspaces");
2366
2622
  },
2367
- async listModules(d) {
2623
+ async listModules(p) {
2368
2624
  return (await s(
2369
2625
  "GET",
2370
- `/module-files/${n(d)}/modules`
2371
- ) ?? []).map((k) => ({ ...k, workspaceId: d }));
2626
+ `/module-files/${n(p)}/modules`
2627
+ ) ?? []).map((N) => ({ ...N, workspaceId: p }));
2372
2628
  },
2373
- async readModule(d) {
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 } : {}
2629
+ async readModule(p) {
2630
+ const u = await s("GET", l(p));
2631
+ return ((u == null ? void 0 : u.files) ?? []).map((N) => ({
2632
+ path: N.path,
2633
+ text: fi(N.content),
2634
+ ...N.version ? { version: N.version } : {},
2635
+ ...N.readOnly ? { readOnly: !0 } : {}
2380
2636
  }));
2381
2637
  },
2382
- async writeModule(d, p) {
2383
- var k;
2638
+ async writeModule(p, u) {
2639
+ var N;
2384
2640
  try {
2385
- const A = await s(
2641
+ const L = await s(
2386
2642
  "PUT",
2387
- l(d),
2643
+ l(p),
2388
2644
  {
2389
- changes: p.map(
2390
- (S) => S.type === "write" ? {
2645
+ changes: u.map(
2646
+ (I) => I.type === "write" ? {
2391
2647
  type: "write",
2392
- path: S.path,
2393
- content: Ce(S.text),
2394
- baseVersion: S.baseVersion
2395
- } : { type: "delete", path: S.path, baseVersion: S.baseVersion }
2648
+ path: I.path,
2649
+ content: Ke(I.text),
2650
+ baseVersion: I.baseVersion
2651
+ } : { type: "delete", path: I.path, baseVersion: I.baseVersion }
2396
2652
  )
2397
2653
  }
2398
2654
  );
2399
2655
  return {
2400
2656
  ok: !0,
2401
- versions: A == null ? void 0 : A.versions,
2402
- ...A != null && A.revision ? { revision: A.revision } : {}
2657
+ versions: L == null ? void 0 : L.versions,
2658
+ ...L != null && L.revision ? { revision: L.revision } : {}
2403
2659
  };
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;
2660
+ } catch (L) {
2661
+ if (L instanceof be && L.status === 409)
2662
+ return { ok: !1, conflicts: ((N = L.body) == null ? void 0 : N.conflicts) ?? u.map((x) => ({ path: x.path })) };
2663
+ throw L;
2408
2664
  }
2409
2665
  },
2410
- async createModule(d) {
2666
+ async createModule(p) {
2411
2667
  return { ...await s(
2412
2668
  "POST",
2413
- `/module-files/${n(d.workspaceId)}/modules`,
2669
+ `/module-files/${n(p.workspaceId)}/modules`,
2414
2670
  {
2415
- packageId: d.packageId,
2416
- id: d.id,
2417
- files: h(d.files)
2671
+ packageId: p.packageId,
2672
+ id: p.id,
2673
+ files: y(p.files)
2418
2674
  }
2419
- ), workspaceId: d.workspaceId };
2675
+ ), workspaceId: p.workspaceId };
2420
2676
  },
2421
- async deleteModule(d) {
2422
- await s("DELETE", l(d));
2677
+ async deleteModule(p) {
2678
+ await s("DELETE", l(p));
2423
2679
  },
2424
- async listRevisions(d, p) {
2680
+ async listRevisions(p, u) {
2425
2681
  return s(
2426
2682
  "GET",
2427
- `${l(d)}/revisions${p ? `?path=${n(p)}` : ""}`
2683
+ `${l(p)}/revisions${u ? `?path=${n(u)}` : ""}`
2428
2684
  );
2429
2685
  },
2430
- async readRevision(d, p, k) {
2686
+ async readRevision(p, u, N) {
2431
2687
  return s(
2432
2688
  "GET",
2433
- `${l(d)}/revisions/${n(p)}${k ? `?path=${n(k)}` : ""}`,
2689
+ `${l(p)}/revisions/${n(u)}${N ? `?path=${n(N)}` : ""}`,
2434
2690
  void 0,
2435
2691
  "text"
2436
2692
  );
2437
2693
  },
2438
- async rollback(d, p, k) {
2694
+ async rollback(p, u, N) {
2439
2695
  await s(
2440
2696
  "POST",
2441
- `${l(d)}/revisions/${n(p)}/rollback${k ? `?path=${n(k)}` : ""}`
2697
+ `${l(p)}/revisions/${n(u)}/rollback${N ? `?path=${n(N)}` : ""}`
2442
2698
  );
2443
2699
  },
2444
2700
  ...e.serverValidation ? {
2445
- async validate(d, p) {
2446
- return s("POST", `${l(d)}/validate`, {
2447
- files: h(p)
2701
+ async validate(p, u) {
2702
+ return s("POST", `${l(p)}/validate`, {
2703
+ files: y(u)
2448
2704
  });
2449
2705
  }
2450
2706
  } : {},
2451
- ...r
2707
+ ...a
2452
2708
  };
2453
2709
  }
2454
- const ni = [
2710
+ const gi = [
2455
2711
  "en",
2456
2712
  "pl",
2457
2713
  "de",
@@ -2466,13 +2722,13 @@ const ni = [
2466
2722
  "ja",
2467
2723
  "ko",
2468
2724
  "zh-CN"
2469
- ], be = (e) => {
2725
+ ], Te = (e) => {
2470
2726
  const i = e.find(
2471
2727
  (t) => !t.path.includes("/") && t.path.toLowerCase().endsWith(".manifest.json")
2472
2728
  );
2473
2729
  if (i)
2474
2730
  try {
2475
- const t = _(i.text).value;
2731
+ const t = z(i.text).value;
2476
2732
  return {
2477
2733
  path: i.path,
2478
2734
  value: typeof t == "object" && t !== null ? t : {}
@@ -2480,12 +2736,12 @@ const ni = [
2480
2736
  } catch {
2481
2737
  return { path: i.path, value: {} };
2482
2738
  }
2483
- }, si = (e) => {
2739
+ }, hi = (e) => {
2484
2740
  var i;
2485
- return ((i = be(e)) == null ? void 0 : i.path.replace(/\.manifest\.json$/i, "")) ?? "module";
2741
+ return ((i = Te(e)) == null ? void 0 : i.path.replace(/\.manifest\.json$/i, "")) ?? "module";
2486
2742
  };
2487
- function li(e = {}) {
2488
- const i = e.t ?? ((s, r) => r), t = (s, r) => i(`devStudio.omniverk.${s}`, r), a = {
2743
+ function Ni(e = {}) {
2744
+ const i = e.t ?? ((s, a) => a), t = (s, a) => i(`devStudio.omniverk.${s}`, a), o = {
2489
2745
  type: "object",
2490
2746
  properties: {
2491
2747
  name: { type: "string", title: t("field.name", "Name") },
@@ -2493,7 +2749,7 @@ function li(e = {}) {
2493
2749
  dataType: {
2494
2750
  type: "string",
2495
2751
  title: t("field.dataType", "Data type"),
2496
- enum: [...kt]
2752
+ enum: [...Et]
2497
2753
  },
2498
2754
  maxLength: { type: "integer", title: t("field.maxLength", "Max length") },
2499
2755
  isRequired: { type: "boolean", title: t("field.isRequired", "Required") },
@@ -2524,25 +2780,25 @@ function li(e = {}) {
2524
2780
  };
2525
2781
  return {
2526
2782
  id: "omniverk",
2527
- kinds: wt,
2528
- manifestSections: $t(i, { scripting: e.scripting }),
2529
- entities: { entityMetaSchema: n, fieldSchema: a },
2530
- locales: e.locales ?? ni,
2783
+ kinds: jt,
2784
+ manifestSections: Bt(i, { scripting: e.scripting }),
2785
+ entities: { entityMetaSchema: n, fieldSchema: o },
2786
+ locales: e.locales ?? gi,
2531
2787
  requiredLocales: ["en", "pl"],
2532
2788
  moduleId: (s) => {
2533
2789
  var l;
2534
- const r = (l = be(s)) == null ? void 0 : l.value.packageName;
2535
- return typeof r == "string" && r ? r : void 0;
2790
+ const a = (l = Te(s)) == null ? void 0 : l.value.packageName;
2791
+ return typeof a == "string" && a ? a : void 0;
2536
2792
  },
2537
- validateModule: (s) => Vt(s),
2538
- generateModule: async (s, { existingIds: r }) => {
2539
- const l = await Ot(
2793
+ validateModule: (s) => ei(s),
2794
+ generateModule: async (s, { existingIds: a }) => {
2795
+ const l = await Kt(
2540
2796
  {
2541
- ...At(s),
2797
+ ...Ft(s),
2542
2798
  iconConfig: e.iconConfig,
2543
2799
  ownerTenantId: e.ownerTenantId
2544
2800
  },
2545
- { existingPackageNames: r }
2801
+ { existingPackageNames: a }
2546
2802
  );
2547
2803
  if (!l.package)
2548
2804
  throw new Error(l.problems.join(`
@@ -2553,7 +2809,7 @@ function li(e = {}) {
2553
2809
  files: l.package.files
2554
2810
  };
2555
2811
  },
2556
- duplicateModule: (s, r) => Kt(s, r),
2812
+ duplicateModule: (s, a) => Rt(s, a),
2557
2813
  scripts: {
2558
2814
  categories: [
2559
2815
  "calculation",
@@ -2566,35 +2822,53 @@ function li(e = {}) {
2566
2822
  ],
2567
2823
  phases: ["preInstall", "postInstall", "preUninstall", "postUninstall", "migrations"]
2568
2824
  },
2569
- newFile: (s, { files: r }) => {
2570
- var A;
2571
- const l = si(r), h = ((A = be(r)) == null ? void 0 : A.value) ?? {};
2825
+ newFile: (s, { files: a }) => {
2826
+ var L;
2827
+ const l = hi(a), y = ((L = Te(a)) == null ? void 0 : L.value) ?? {};
2572
2828
  if (s === "scripts") {
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),
2829
+ let I = `${l}.scripts.json`;
2830
+ for (let O = 2; a.some((w) => w.path === I); O++)
2831
+ I = `${l}.${O}.scripts.json`;
2832
+ const x = {
2833
+ moduleName: String(y.packageName ?? l),
2578
2834
  version: "1.0.0",
2579
2835
  scripts: []
2580
2836
  };
2581
- return { path: S, text: ae(T) };
2837
+ return { path: I, text: le(x) };
2582
2838
  }
2583
- const d = `${String(h.packageName ?? l)}.Core`, k = {
2584
- entities: ["entities.json", { moduleName: d, version: "1.0.0", entities: [] }],
2585
- views: ["views.json", { moduleName: d, version: "1.0.0", views: [] }],
2586
- workflows: ["workflows.json", { moduleName: d, version: "1.0.0", workflows: [] }],
2839
+ const p = `${String(y.packageName ?? l)}.Core`, N = {
2840
+ entities: ["entities.json", { moduleName: p, version: "1.0.0", entities: [] }],
2841
+ views: ["views.json", { moduleName: p, version: "1.0.0", views: [] }],
2842
+ workflows: ["workflows.json", { moduleName: p, version: "1.0.0", workflows: [] }],
2587
2843
  permissions: [
2588
2844
  "permissions.json",
2589
- { moduleName: d, version: "1.0.0", permissions: [], permissionGroups: [] }
2845
+ { moduleName: p, version: "1.0.0", permissions: [], permissionGroups: [] }
2590
2846
  ],
2591
- seeds: ["seeds.json", { moduleName: d, version: "1.0.0", seeds: {} }],
2847
+ seeds: ["seeds.json", { moduleName: p, version: "1.0.0", seeds: {} }],
2592
2848
  dataSources: [
2593
2849
  "datasources.json",
2594
- { moduleName: String(h.packageName ?? l), version: "1.0.0", dataSources: [] }
2850
+ { moduleName: String(y.packageName ?? l), version: "1.0.0", dataSources: [] }
2851
+ ],
2852
+ // 1.4.12: the variables start from what the manifest's wizard fields and env vars declare
2853
+ integrations: [
2854
+ "integrations.json",
2855
+ {
2856
+ moduleName: String(y.packageName ?? l),
2857
+ version: "1.0.0",
2858
+ integrations: []
2859
+ }
2860
+ ],
2861
+ environments: [
2862
+ "environments.json",
2863
+ {
2864
+ moduleName: String(y.packageName ?? l),
2865
+ version: "1.0.0",
2866
+ variables: Vt(y),
2867
+ sets: [{ id: "default", name: "Default", values: {} }]
2868
+ }
2595
2869
  ]
2596
2870
  }[s];
2597
- return k ? { path: `${l}.${k[0]}`, text: ae(k[1]) } : void 0;
2871
+ return N ? { path: `${l}.${N[0]}`, text: le(N[1]) } : void 0;
2598
2872
  },
2599
2873
  templateSchema: {
2600
2874
  type: "object",
@@ -2618,50 +2892,50 @@ function li(e = {}) {
2618
2892
  }
2619
2893
  };
2620
2894
  }
2621
- function ci(e = {}) {
2895
+ function ji(e = {}) {
2622
2896
  let i = 0;
2623
2897
  const t = /* @__PURE__ */ new Map();
2624
2898
  for (const [n, s] of Object.entries(e))
2625
2899
  t.set(n, { text: s, version: String(++i) });
2626
- const a = (n) => n ? `${n}/` : "";
2900
+ const o = (n) => n ? `${n}/` : "";
2627
2901
  return {
2628
2902
  async list(n) {
2629
- const s = a(n), r = /* @__PURE__ */ new Map();
2903
+ const s = o(n), a = /* @__PURE__ */ new Map();
2630
2904
  for (const l of t.keys()) {
2631
2905
  if (!l.startsWith(s))
2632
2906
  continue;
2633
- const h = l.slice(s.length), d = h.indexOf("/");
2634
- r.set(d < 0 ? h : h.slice(0, d), d < 0 ? "file" : "directory");
2907
+ const y = l.slice(s.length), p = y.indexOf("/");
2908
+ a.set(p < 0 ? y : y.slice(0, p), p < 0 ? "file" : "directory");
2635
2909
  }
2636
- return [...r].map(([l, h]) => ({ name: l, kind: h }));
2910
+ return [...a].map(([l, y]) => ({ name: l, kind: y }));
2637
2911
  },
2638
2912
  async read(n) {
2639
2913
  const s = t.get(n);
2640
2914
  return s ? { ...s } : null;
2641
2915
  },
2642
2916
  async write(n, s) {
2643
- const r = String(++i);
2644
- return t.set(n, { text: s, version: r }), r;
2917
+ const a = String(++i);
2918
+ return t.set(n, { text: s, version: a }), a;
2645
2919
  },
2646
2920
  async remove(n) {
2647
2921
  t.delete(n);
2648
2922
  },
2649
2923
  async removeDir(n) {
2650
- const s = a(n);
2651
- for (const r of [...t.keys()])
2652
- r.startsWith(s) && t.delete(r);
2924
+ const s = o(n);
2925
+ for (const a of [...t.keys()])
2926
+ a.startsWith(s) && t.delete(a);
2653
2927
  },
2654
2928
  snapshot() {
2655
2929
  return Object.fromEntries([...t].map(([n, s]) => [n, s.text]));
2656
2930
  }
2657
2931
  };
2658
2932
  }
2659
- const _e = () => typeof window > "u" ? void 0 : window.showDirectoryPicker;
2660
- function di() {
2661
- return typeof _e() == "function";
2933
+ const Qe = () => typeof window > "u" ? void 0 : window.showDirectoryPicker;
2934
+ function Ti() {
2935
+ return typeof Qe() == "function";
2662
2936
  }
2663
- async function pi(e = {}) {
2664
- const i = _e();
2937
+ async function Ei(e = {}) {
2938
+ const i = Qe();
2665
2939
  if (!i)
2666
2940
  throw new Error("This browser cannot open folders (File System Access API).");
2667
2941
  return i({
@@ -2669,121 +2943,127 @@ async function pi(e = {}) {
2669
2943
  ...e.id ? { id: e.id } : {}
2670
2944
  });
2671
2945
  }
2672
- const le = (e) => typeof e == "object" && e !== null && (e.name === "NotFoundError" || e.name === "TypeMismatchError");
2673
- function mi(e) {
2946
+ const pe = (e) => typeof e == "object" && e !== null && (e.name === "NotFoundError" || e.name === "TypeMismatchError");
2947
+ function Ii(e) {
2674
2948
  const i = new TextDecoder("utf-8", { ignoreBOM: !0 });
2675
- async function t(r, l = !1) {
2676
- let h = e;
2677
- for (const d of r.split("/").filter(Boolean))
2949
+ async function t(a, l = !1) {
2950
+ let y = e;
2951
+ for (const p of a.split("/").filter(Boolean))
2678
2952
  try {
2679
- h = await h.getDirectoryHandle(d, { create: l });
2680
- } catch (p) {
2681
- if (le(p))
2953
+ y = await y.getDirectoryHandle(p, { create: l });
2954
+ } catch (u) {
2955
+ if (pe(u))
2682
2956
  return null;
2683
- throw p;
2957
+ throw u;
2684
2958
  }
2685
- return h;
2959
+ return y;
2686
2960
  }
2687
- const a = (r) => {
2688
- const l = r.lastIndexOf("/");
2689
- return l < 0 ? ["", r] : [r.slice(0, l), r.slice(l + 1)];
2961
+ const o = (a) => {
2962
+ const l = a.lastIndexOf("/");
2963
+ return l < 0 ? ["", a] : [a.slice(0, l), a.slice(l + 1)];
2690
2964
  };
2691
- async function n(r, l = !1) {
2692
- const [h, d] = a(r), p = await t(h, l);
2693
- if (!p)
2965
+ async function n(a, l = !1) {
2966
+ const [y, p] = o(a), u = await t(y, l);
2967
+ if (!u)
2694
2968
  return null;
2695
2969
  try {
2696
- return await p.getFileHandle(d, { create: l });
2697
- } catch (k) {
2698
- if (le(k))
2970
+ return await u.getFileHandle(p, { create: l });
2971
+ } catch (N) {
2972
+ if (pe(N))
2699
2973
  return null;
2700
- throw k;
2974
+ throw N;
2701
2975
  }
2702
2976
  }
2703
- const s = (r) => `${r.lastModified}:${r.size}`;
2977
+ const s = (a) => `${a.lastModified}:${a.size}`;
2704
2978
  return {
2705
- async list(r) {
2706
- const l = await t(r), h = [];
2979
+ async list(a) {
2980
+ const l = await t(a), y = [];
2707
2981
  if (l)
2708
- for await (const d of l.values())
2709
- h.push({ name: d.name, kind: d.kind });
2710
- return h;
2982
+ for await (const p of l.values())
2983
+ y.push({ name: p.name, kind: p.kind });
2984
+ return y;
2711
2985
  },
2712
- async read(r) {
2713
- const l = await n(r);
2986
+ async read(a) {
2987
+ const l = await n(a);
2714
2988
  if (!l)
2715
2989
  return null;
2716
- const h = await l.getFile();
2717
- return { text: i.decode(await h.arrayBuffer()), version: s(h) };
2990
+ const y = await l.getFile();
2991
+ return { text: i.decode(await y.arrayBuffer()), version: s(y) };
2718
2992
  },
2719
- async write(r, l) {
2720
- const h = await n(r, !0);
2721
- if (!h)
2722
- throw new Error(`Cannot write ${r}`);
2723
- const d = await h.createWritable();
2724
- return await d.write(l), await d.close(), s(await h.getFile());
2993
+ async write(a, l) {
2994
+ const y = await n(a, !0);
2995
+ if (!y)
2996
+ throw new Error(`Cannot write ${a}`);
2997
+ const p = await y.createWritable();
2998
+ return await p.write(l), await p.close(), s(await y.getFile());
2725
2999
  },
2726
- async remove(r) {
2727
- const [l, h] = a(r), d = await t(l);
3000
+ async remove(a) {
3001
+ const [l, y] = o(a), p = await t(l);
2728
3002
  try {
2729
- await (d == null ? void 0 : d.removeEntry(h));
2730
- } catch (p) {
2731
- if (!le(p))
2732
- throw p;
3003
+ await (p == null ? void 0 : p.removeEntry(y));
3004
+ } catch (u) {
3005
+ if (!pe(u))
3006
+ throw u;
2733
3007
  }
2734
3008
  },
2735
- async removeDir(r) {
2736
- const [l, h] = a(r), d = await t(l);
3009
+ async removeDir(a) {
3010
+ const [l, y] = o(a), p = await t(l);
2737
3011
  try {
2738
- await (d == null ? void 0 : d.removeEntry(h, { recursive: !0 }));
2739
- } catch (p) {
2740
- if (!le(p))
2741
- throw p;
3012
+ await (p == null ? void 0 : p.removeEntry(y, { recursive: !0 }));
3013
+ } catch (u) {
3014
+ if (!pe(u))
3015
+ throw u;
2742
3016
  }
2743
3017
  }
2744
3018
  };
2745
3019
  }
2746
3020
  export {
2747
- W as OMNIVERK_CUSTOM_PREFIX,
2748
- kt as OMNIVERK_DATA_TYPES,
2749
- qt as OMNIVERK_LEGACY_LIST_VIEW_FILES,
2750
- ni as OMNIVERK_LOCALES,
2751
- ye as OmniVerkRestError,
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,
2761
- Qe as omniverkEntitiesKind,
2762
- wt as omniverkFileKinds,
2763
- jt as omniverkFilePrefix,
2764
- et as omniverkI18nKind,
2765
- Ze as omniverkManifestKind,
2766
- $t as omniverkManifestSections,
3021
+ G as OMNIVERK_CUSTOM_PREFIX,
3022
+ Et as OMNIVERK_DATA_TYPES,
3023
+ Xt as OMNIVERK_LEGACY_LIST_VIEW_FILES,
3024
+ gi as OMNIVERK_LOCALES,
3025
+ be as OmniVerkRestError,
3026
+ Kt as buildOmniVerkModule,
3027
+ Gt as controllerDifferences,
3028
+ bi as controllersFromExposed,
3029
+ Ii as createDirectoryHandleFileSystem,
3030
+ ji as createMemorySeedFileSystem,
3031
+ ki as createOmniVerkRestProvider,
3032
+ Ni as createOmniVerkStudioPreset,
3033
+ Si as createSeedFolderProvider,
3034
+ Rt as duplicateOmniVerkModule,
3035
+ vi as envVarsToManifest,
3036
+ Wt as exposedFromControllers,
3037
+ Ti as isSeedFolderPickerSupported,
3038
+ St as omniverkDataSourcesKind,
3039
+ st as omniverkEntitiesKind,
3040
+ jt as omniverkFileKinds,
3041
+ Ot as omniverkFilePrefix,
3042
+ ot as omniverkI18nKind,
3043
+ tt as omniverkManifestKind,
3044
+ Bt as omniverkManifestSections,
2767
3045
  P as omniverkPascalIdentifier,
2768
- ut as omniverkPermissionsKind,
2769
- fe as omniverkRevisionStamp,
2770
- yt as omniverkScriptKind,
2771
- gt as omniverkScriptsKind,
2772
- ft as omniverkSeedsKind,
2773
- At as omniverkSpecFromStudio,
2774
- Ve as omniverkStableId,
2775
- Ue as omniverkTableName,
2776
- Ie as omniverkTemplateFromDto,
2777
- Gt as omniverkTemplateFromEntry,
2778
- xe as omniverkTemplateToEntry,
2779
- _t as omniverkTemplateToInput,
2780
- ot as omniverkViewFromItem,
2781
- st as omniverkViewItem,
2782
- at as omniverkViewsKind,
2783
- ct as omniverkWorkflowFromItem,
2784
- lt as omniverkWorkflowItem,
2785
- dt as omniverkWorkflowsKind,
2786
- pi as pickSeedDirectory,
2787
- Vt as validateOmniVerkModule,
2788
- Ut as validateOmniVerkWorkspace
3046
+ wt as omniverkPermissionsKind,
3047
+ ve as omniverkRevisionStamp,
3048
+ bt as omniverkScriptKind,
3049
+ $t as omniverkScriptsKind,
3050
+ vt as omniverkSeedsKind,
3051
+ Ft as omniverkSpecFromStudio,
3052
+ fe as omniverkStableId,
3053
+ Be as omniverkTableName,
3054
+ De as omniverkTemplateFromDto,
3055
+ ni as omniverkTemplateFromEntry,
3056
+ Me as omniverkTemplateToEntry,
3057
+ si as omniverkTemplateToInput,
3058
+ dt as omniverkViewFromItem,
3059
+ ct as omniverkViewItem,
3060
+ pt as omniverkViewsKind,
3061
+ ft as omniverkWorkflowFromItem,
3062
+ mt as omniverkWorkflowItem,
3063
+ yt as omniverkWorkflowsKind,
3064
+ Ei as pickSeedDirectory,
3065
+ $i as toOmniVerkConnectorSeeds,
3066
+ ei as validateOmniVerkModule,
3067
+ ti as validateOmniVerkWorkspace,
3068
+ Vt as variablesFromManifest
2789
3069
  };