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