@nice2dev/erp-adapter 1.3.12 → 1.3.14
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 +20 -0
- package/dist/omniverk/validate.d.ts +1 -1
- package/dist/omniverk.cjs +2 -2
- package/dist/omniverk.mjs +728 -667
- package/package.json +3 -3
package/dist/omniverk.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { objectFileKind as _e, endsWithAny as te, arrayFileKind as
|
|
1
|
+
import { objectFileKind as _e, endsWithAny as te, arrayFileKind as Be, i18nFileKind as ze, itemsFileKind as Oe, jsonFileKind as Ae, jsonValuesEqual as Le, keepTextFormat as Je, parseJsonText as _, patchJsonText as Me, stringifyJsonText as de } from "@nice2dev/ui-forms/studio";
|
|
2
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)), He = _e({
|
|
3
3
|
id: "manifest",
|
|
4
4
|
label: "Manifest",
|
|
@@ -6,14 +6,14 @@ const V = (e) => typeof e == "object" && e !== null && !Array.isArray(e), G = (e
|
|
|
6
6
|
icon: "file",
|
|
7
7
|
editor: "manifest",
|
|
8
8
|
match: te(".manifest.json")
|
|
9
|
-
}),
|
|
9
|
+
}), De = [
|
|
10
10
|
["dataType", "type"],
|
|
11
11
|
["isRequired", "required"]
|
|
12
12
|
], le = "$aliases";
|
|
13
13
|
function Ze(e) {
|
|
14
14
|
if (!V(e))
|
|
15
15
|
return e;
|
|
16
|
-
const i =
|
|
16
|
+
const i = De.filter(([o, n]) => !(o in e) && n in e);
|
|
17
17
|
if (i.length === 0)
|
|
18
18
|
return e;
|
|
19
19
|
const t = {};
|
|
@@ -30,13 +30,13 @@ function Ye(e) {
|
|
|
30
30
|
for (const [o, n] of Object.entries(e)) {
|
|
31
31
|
if (o === le)
|
|
32
32
|
continue;
|
|
33
|
-
const s =
|
|
33
|
+
const s = De.find(([r, l]) => r === o && i.includes(l));
|
|
34
34
|
t[s ? s[1] : o] = n;
|
|
35
35
|
}
|
|
36
36
|
return t;
|
|
37
37
|
}
|
|
38
38
|
const Se = (e, i) => V(e) && Array.isArray(e.fields) ? { ...e, fields: e.fields.map(i) } : e, Xe = (() => {
|
|
39
|
-
const e =
|
|
39
|
+
const e = Be({
|
|
40
40
|
id: "entities",
|
|
41
41
|
label: "Entities",
|
|
42
42
|
labelKey: "devStudio.kind.entities",
|
|
@@ -55,7 +55,7 @@ const Se = (e, i) => V(e) && Array.isArray(e.fields) ? { ...e, fields: e.fields.
|
|
|
55
55
|
o
|
|
56
56
|
)
|
|
57
57
|
};
|
|
58
|
-
})(), Qe =
|
|
58
|
+
})(), Qe = ze(), ge = {
|
|
59
59
|
input: "textInput",
|
|
60
60
|
text: "textInput",
|
|
61
61
|
textarea: "textArea",
|
|
@@ -96,19 +96,19 @@ function et(e) {
|
|
|
96
96
|
]
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
|
-
function
|
|
100
|
-
var l, y,
|
|
101
|
-
const t = (e.rows ?? []).flatMap((m) => m.cells).find((m) => m.controlType === "dataGrid"), o = ((l = t == null ? void 0 : t.props) == null ? void 0 : l.columns) ?? [], n = i.columns ?? [], s = (
|
|
99
|
+
function Ke(e, i) {
|
|
100
|
+
var l, y, d;
|
|
101
|
+
const t = (e.rows ?? []).flatMap((m) => m.cells).find((m) => m.controlType === "dataGrid"), o = ((l = t == null ? void 0 : t.props) == null ? void 0 : l.columns) ?? [], n = i.columns ?? [], s = (d = (y = e.dataSources) == null ? void 0 : y.find((m) => m.type === "entity")) == null ? void 0 : d.entity, r = (m) => "displayName" in m ? "displayName" : "header" in m ? "header" : "label" in m ? "label" : "displayName";
|
|
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
106
|
columns: o.map((m) => {
|
|
107
|
-
const b = n.find((
|
|
107
|
+
const b = n.find((T) => T.field === m.field);
|
|
108
108
|
if (!b)
|
|
109
109
|
return { field: m.field, displayName: m.header ?? m.field };
|
|
110
|
-
const C = r(b),
|
|
111
|
-
return b[C] === void 0 &&
|
|
110
|
+
const C = r(b), j = m.header ?? m.field;
|
|
111
|
+
return b[C] === void 0 && j === m.field ? b : { ...b, [C]: j };
|
|
112
112
|
})
|
|
113
113
|
});
|
|
114
114
|
}
|
|
@@ -142,12 +142,12 @@ function tt(e) {
|
|
|
142
142
|
]
|
|
143
143
|
});
|
|
144
144
|
let l = [], y = 0;
|
|
145
|
-
const
|
|
145
|
+
const d = () => {
|
|
146
146
|
l.length && (i.push({ id: `tab-${n}-section-${r}-row-${i.length}`, cells: l }), l = [], y = 0);
|
|
147
147
|
};
|
|
148
148
|
(s.controls ?? []).forEach((m, b) => {
|
|
149
149
|
const C = typeof m.colSpan == "number" ? m.colSpan : 6;
|
|
150
|
-
y + C > 12 &&
|
|
150
|
+
y + C > 12 && d(), l.push({
|
|
151
151
|
id: `c-${n}-${r}-${b}`,
|
|
152
152
|
controlType: ge[String(m.type)] ?? "textInput",
|
|
153
153
|
colSpan: C,
|
|
@@ -159,7 +159,7 @@ function tt(e) {
|
|
|
159
159
|
},
|
|
160
160
|
bindings: { value: { source: "record", field: String(m.field ?? "") } }
|
|
161
161
|
}), y += C;
|
|
162
|
-
}),
|
|
162
|
+
}), d();
|
|
163
163
|
});
|
|
164
164
|
}), {
|
|
165
165
|
id: String(e.name),
|
|
@@ -171,48 +171,48 @@ function tt(e) {
|
|
|
171
171
|
rows: i
|
|
172
172
|
};
|
|
173
173
|
}
|
|
174
|
-
function
|
|
175
|
-
var
|
|
174
|
+
function Fe(e, i) {
|
|
175
|
+
var d, m, b, C, j;
|
|
176
176
|
const t = i.tabs ?? [], o = 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
|
-
for (const
|
|
182
|
-
for (const
|
|
183
|
-
const
|
|
184
|
-
if (
|
|
185
|
-
const
|
|
186
|
-
if (
|
|
187
|
-
s = { ...t.find((
|
|
181
|
+
for (const T of e.rows ?? [])
|
|
182
|
+
for (const I of T.cells) {
|
|
183
|
+
const c = I.props ?? {};
|
|
184
|
+
if (I.controlType === "heading" && (c.level === 2 || c.level === 3)) {
|
|
185
|
+
const x = G(c.name) ?? String(c.text ?? "").replace(/\s+/g, "");
|
|
186
|
+
if (c.level === 2)
|
|
187
|
+
s = { ...t.find((k) => k.name === x) ?? {}, name: x, displayName: String(c.text ?? x), 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 D = t.flatMap((S) => S.sections ?? []).find((S) => S.name === x);
|
|
191
|
+
r = { ...D ? Object.fromEntries(Object.entries(D).filter(([S]) => S !== "controls")) : {}, name: x, displayName: String(c.text ?? x), controls: [] }, s.sections.push(r);
|
|
192
192
|
}
|
|
193
193
|
continue;
|
|
194
194
|
}
|
|
195
|
-
const
|
|
196
|
-
if (
|
|
195
|
+
const v = ((m = (d = I.bindings) == null ? void 0 : d.value) == null ? void 0 : m.field) ?? G(c.field);
|
|
196
|
+
if (!v)
|
|
197
197
|
continue;
|
|
198
|
-
const
|
|
199
|
-
...
|
|
200
|
-
field:
|
|
201
|
-
type:
|
|
202
|
-
label:
|
|
203
|
-
colSpan: (
|
|
204
|
-
required:
|
|
198
|
+
const f = o.find((x) => x.field === v), E = f && ge[String(f.type)] === I.controlType ? f.type : ((b = Object.entries(ge).find(([, x]) => x === I.controlType)) == null ? void 0 : b[0]) ?? "input", A = U({
|
|
199
|
+
...f ?? {},
|
|
200
|
+
field: v,
|
|
201
|
+
type: E,
|
|
202
|
+
label: c.label !== void 0 ? String(c.label) : f == null ? void 0 : f.label,
|
|
203
|
+
colSpan: (f == null ? void 0 : f.colSpan) !== void 0 || I.colSpan !== 6 ? I.colSpan : void 0,
|
|
204
|
+
required: c.required === !0 ? !0 : (f == null ? void 0 : f.required) === !0 ? !1 : f == null ? void 0 : f.required
|
|
205
205
|
});
|
|
206
|
-
l().controls.push(
|
|
206
|
+
l().controls.push(A);
|
|
207
207
|
}
|
|
208
|
-
const y = n.map((
|
|
209
|
-
const
|
|
210
|
-
return
|
|
208
|
+
const y = n.map((T) => {
|
|
209
|
+
const I = t.find((c) => c.name === T.name);
|
|
210
|
+
return I ? { ...I, ...T } : T;
|
|
211
211
|
});
|
|
212
212
|
return U({
|
|
213
213
|
...i,
|
|
214
214
|
displayName: "displayName" in i || e.name !== i.name ? e.name : void 0,
|
|
215
|
-
entityName: ((
|
|
215
|
+
entityName: ((j = (C = e.dataSources) == null ? void 0 : C.find((T) => T.type === "entity")) == null ? void 0 : j.entity) ?? i.entityName,
|
|
216
216
|
tabs: y
|
|
217
217
|
});
|
|
218
218
|
}
|
|
@@ -229,18 +229,18 @@ function nt(e, i) {
|
|
|
229
229
|
source: e,
|
|
230
230
|
rawReason: String(t.type ?? (t.viewJson ? "viewJson" : "unknown"))
|
|
231
231
|
};
|
|
232
|
-
const r = s === "List" ? et(t) : tt(t), l = s === "List" ?
|
|
232
|
+
const r = s === "List" ? et(t) : tt(t), l = s === "List" ? Ke(r, t) : Fe(r, t);
|
|
233
233
|
return Le(l, e) ? { key: o, label: n, definition: r, source: e } : { key: o, label: n, source: e, rawReason: `${s} (round-trip)` };
|
|
234
234
|
}
|
|
235
235
|
function st(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" ? Fe(e.definition, {
|
|
240
240
|
type: "Form",
|
|
241
241
|
...i,
|
|
242
242
|
name: i.name ?? e.definition.id
|
|
243
|
-
}) :
|
|
243
|
+
}) : Ke(e.definition, {
|
|
244
244
|
type: "List",
|
|
245
245
|
...i,
|
|
246
246
|
name: i.name ?? e.definition.id
|
|
@@ -280,7 +280,7 @@ function at(e) {
|
|
|
280
280
|
}))
|
|
281
281
|
};
|
|
282
282
|
}
|
|
283
|
-
function
|
|
283
|
+
function Pe(e, i) {
|
|
284
284
|
const t = i.steps ?? [], o = i.connections ?? [];
|
|
285
285
|
return U({
|
|
286
286
|
...i,
|
|
@@ -312,13 +312,13 @@ function rt(e, i) {
|
|
|
312
312
|
if (!(Array.isArray(t.connections) && Array.isArray(s) && s.every((y) => V(y) && typeof y.state == "string")))
|
|
313
313
|
return { key: o, label: n, source: e, rawReason: G(t.triggerType) ?? "automation" };
|
|
314
314
|
const l = at(t);
|
|
315
|
-
return Le(
|
|
315
|
+
return Le(Pe(l, t), e) ? { key: o, label: n, definition: l, source: e } : { key: o, label: n, source: e, rawReason: "state machine (round-trip)" };
|
|
316
316
|
}
|
|
317
317
|
function lt(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 Pe(e.definition, {
|
|
322
322
|
...i,
|
|
323
323
|
name: i.name ?? e.definition.id
|
|
324
324
|
});
|
|
@@ -384,7 +384,7 @@ const mt = Ae({
|
|
|
384
384
|
select: dt,
|
|
385
385
|
assign: pt,
|
|
386
386
|
arrayKey: (e) => e === "/permissions" ? "code" : e === "/permissionGroups" ? "name" : void 0
|
|
387
|
-
}),
|
|
387
|
+
}), ut = Ae({
|
|
388
388
|
id: "seeds",
|
|
389
389
|
label: "Seed data",
|
|
390
390
|
labelKey: "devStudio.kind.seeds",
|
|
@@ -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
|
+
}), ft = {
|
|
403
403
|
id: "script",
|
|
404
404
|
label: "Script",
|
|
405
405
|
labelKey: "devStudio.kind.script",
|
|
@@ -417,9 +417,9 @@ const mt = Ae({
|
|
|
417
417
|
ot,
|
|
418
418
|
ct,
|
|
419
419
|
mt,
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
], gt = (e, i) => i,
|
|
420
|
+
ut,
|
|
421
|
+
ft
|
|
422
|
+
], gt = (e, i) => i, z = (e) => ({
|
|
423
423
|
type: "array",
|
|
424
424
|
title: e,
|
|
425
425
|
items: { type: "string" }
|
|
@@ -474,7 +474,9 @@ function ht(e = gt, i = {}) {
|
|
|
474
474
|
}
|
|
475
475
|
},
|
|
476
476
|
required: ["packageName", "version", "category"]
|
|
477
|
-
}
|
|
477
|
+
},
|
|
478
|
+
// a module's description runs to several sentences (1.3.14: it was a one-line field)
|
|
479
|
+
uiSchema: { description: { type: "textarea" } }
|
|
478
480
|
},
|
|
479
481
|
{
|
|
480
482
|
id: "modules",
|
|
@@ -493,11 +495,11 @@ function ht(e = gt, i = {}) {
|
|
|
493
495
|
description: { type: "string", title: t("field.description", "Description") },
|
|
494
496
|
icon: { type: "string", title: t("field.icon", "Icon") },
|
|
495
497
|
color: { type: "string", title: t("field.color", "Colour") },
|
|
496
|
-
parts:
|
|
498
|
+
parts: z(t("field.parts", "Files"))
|
|
497
499
|
}
|
|
498
500
|
}
|
|
499
501
|
},
|
|
500
|
-
i18n:
|
|
502
|
+
i18n: z(t("field.i18n", "Translation files"))
|
|
501
503
|
}
|
|
502
504
|
}
|
|
503
505
|
},
|
|
@@ -507,7 +509,7 @@ function ht(e = gt, i = {}) {
|
|
|
507
509
|
schema: {
|
|
508
510
|
type: "object",
|
|
509
511
|
properties: {
|
|
510
|
-
dependencies:
|
|
512
|
+
dependencies: z(t("field.dependencies", "Required packages")),
|
|
511
513
|
dependencyRefs: {
|
|
512
514
|
type: "array",
|
|
513
515
|
title: t("field.dependencyRefs", "Dependency details"),
|
|
@@ -534,8 +536,8 @@ function ht(e = gt, i = {}) {
|
|
|
534
536
|
}
|
|
535
537
|
}
|
|
536
538
|
},
|
|
537
|
-
provides:
|
|
538
|
-
requiredControls:
|
|
539
|
+
provides: z(t("field.provides", "Provides")),
|
|
540
|
+
requiredControls: z(t("field.requiredControls", "Required controls"))
|
|
539
541
|
}
|
|
540
542
|
}
|
|
541
543
|
},
|
|
@@ -711,8 +713,8 @@ function ht(e = gt, i = {}) {
|
|
|
711
713
|
image: { type: "string", title: t("field.image", "Image") },
|
|
712
714
|
tag: { type: "string", title: t("field.tag", "Tag") },
|
|
713
715
|
description: { type: "string", title: t("field.description", "Description") },
|
|
714
|
-
ports:
|
|
715
|
-
volumes:
|
|
716
|
+
ports: z(t("field.ports", "Ports")),
|
|
717
|
+
volumes: z(t("field.volumes", "Volumes")),
|
|
716
718
|
command: { type: "string", title: t("field.command", "Command") },
|
|
717
719
|
healthCheckCmd: {
|
|
718
720
|
type: "string",
|
|
@@ -858,31 +860,31 @@ const W = "Custom.", Ne = "Core", wt = {
|
|
|
858
860
|
function bt(e) {
|
|
859
861
|
return [...e.normalize("NFD")].map((i) => $t[i] ?? (new RegExp("\\p{Mn}", "u").test(i) ? "" : i)).join("").normalize("NFC");
|
|
860
862
|
}
|
|
861
|
-
function
|
|
863
|
+
function P(e) {
|
|
862
864
|
const i = bt(e ?? "").split(/[^A-Za-z0-9]+/).filter(Boolean).map((t) => t[0].toUpperCase() + t.slice(1)).join("");
|
|
863
865
|
return /^[0-9]/.test(i) ? `M${i}` : i;
|
|
864
866
|
}
|
|
865
|
-
const
|
|
867
|
+
const je = (e) => e !== e.toLowerCase() && e === e.toUpperCase();
|
|
866
868
|
function he(e) {
|
|
867
869
|
return [...e].map(
|
|
868
|
-
(i, t) => t > 0 &&
|
|
870
|
+
(i, t) => t > 0 && je(i) && !je(e[t - 1]) ? `_${i.toLowerCase()}` : i.toLowerCase()
|
|
869
871
|
).join("");
|
|
870
872
|
}
|
|
871
873
|
function kt(e) {
|
|
872
874
|
return (e.startsWith(W) ? e.slice(W.length) : e.split(".").pop() ?? e).toLowerCase().replace(/[^a-z0-9_-]+/g, "") || "module";
|
|
873
875
|
}
|
|
874
|
-
async function
|
|
876
|
+
async function Re(e) {
|
|
875
877
|
const i = await globalThis.crypto.subtle.digest("SHA-256", new TextEncoder().encode(e));
|
|
876
878
|
return new Uint8Array(i);
|
|
877
879
|
}
|
|
878
880
|
const ke = (e) => Array.from(e, (i) => i.toString(16).padStart(2, "0")).join("");
|
|
879
881
|
async function qe(e, i) {
|
|
880
|
-
const t = (await
|
|
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]));
|
|
881
883
|
return `${o.slice(0, 8)}-${o.slice(8, 12)}-${o.slice(12, 16)}-${o.slice(16, 20)}-${o.slice(20)}`;
|
|
882
884
|
}
|
|
883
885
|
async function Ve(e, i) {
|
|
884
886
|
const t = `custom_${e}_${he(i)}`;
|
|
885
|
-
return t.length <= 63 ? t : `${t.slice(0, 54)}_${ke(await
|
|
887
|
+
return t.length <= 63 ? t : `${t.slice(0, 54)}_${ke(await Re(t)).slice(0, 8)}`;
|
|
886
888
|
}
|
|
887
889
|
function St(e, i) {
|
|
888
890
|
const t = new Set([...i].map((o) => o.toLowerCase()));
|
|
@@ -932,13 +934,13 @@ const Nt = {
|
|
|
932
934
|
date: "date",
|
|
933
935
|
datetime: "datetime"
|
|
934
936
|
};
|
|
935
|
-
function
|
|
937
|
+
function jt(e) {
|
|
936
938
|
var o;
|
|
937
939
|
const i = [];
|
|
938
|
-
(!((o = e.name) != null && o.trim()) ||
|
|
940
|
+
(!((o = e.name) != null && o.trim()) || P(e.name).length === 0) && i.push("The module needs a name with letters or digits."), e.entities.length === 0 && i.push("The module has no entities — add at least one.");
|
|
939
941
|
const t = /* @__PURE__ */ new Set();
|
|
940
942
|
for (const n of e.entities) {
|
|
941
|
-
const s =
|
|
943
|
+
const s = P(n.name);
|
|
942
944
|
if (s.length === 0) {
|
|
943
945
|
i.push(`Entity "${n.name}" needs a name with letters or digits.`);
|
|
944
946
|
continue;
|
|
@@ -948,16 +950,16 @@ function Tt(e) {
|
|
|
948
950
|
r.length === 0 && i.push(`Entity ${s} has no fields — add at least one.`);
|
|
949
951
|
const l = /* @__PURE__ */ new Set();
|
|
950
952
|
for (const y of r) {
|
|
951
|
-
const
|
|
952
|
-
|
|
953
|
+
const d = P(y.name);
|
|
954
|
+
d.length === 0 ? i.push(`${s}: field "${y.name}" needs a name with letters or digits.`) : l.has(d.toLowerCase()) ? i.push(`${s}: field ${d} appears twice.`) : l.add(d.toLowerCase());
|
|
953
955
|
}
|
|
954
956
|
}
|
|
955
957
|
return i;
|
|
956
958
|
}
|
|
957
|
-
const
|
|
959
|
+
const Tt = (e) => e.toISOString().replace(/\.(\d{3})Z$/, ".$10000Z"), Y = (e) => de(e, { finalNewline: !1 }), J = (e, i) => ({
|
|
958
960
|
icon: { name: e, package: "@nice2dev/icons", style: i }
|
|
959
961
|
});
|
|
960
|
-
function
|
|
962
|
+
function Et(e) {
|
|
961
963
|
const i = e && /^Ntd[A-Z]/.test(e), t = e && /^[A-Z]\w*Icon$/.test(e);
|
|
962
964
|
return {
|
|
963
965
|
module: {
|
|
@@ -980,105 +982,105 @@ function xt(e) {
|
|
|
980
982
|
workflowStates: {}
|
|
981
983
|
};
|
|
982
984
|
}
|
|
983
|
-
async function
|
|
984
|
-
var
|
|
985
|
-
const t =
|
|
985
|
+
async function xt(e, i = {}) {
|
|
986
|
+
var E, A, x, D;
|
|
987
|
+
const t = jt(e);
|
|
986
988
|
if (t.length > 0)
|
|
987
989
|
return { problems: t };
|
|
988
|
-
const o = e.name.toLowerCase().startsWith(W.toLowerCase()), n =
|
|
990
|
+
const o = e.name.toLowerCase().startsWith(W.toLowerCase()), n = P(
|
|
989
991
|
o ? e.name.slice(W.length) : e.name
|
|
990
992
|
), s = St(
|
|
991
993
|
W + n,
|
|
992
994
|
i.existingPackageNames ?? /* @__PURE__ */ new Set()
|
|
993
|
-
), r = s.slice(W.length), l = r.toLowerCase(), y = `${s}.${Ne}`,
|
|
995
|
+
), r = s.slice(W.length), l = r.toLowerCase(), y = `${s}.${Ne}`, d = o ? r : e.name.trim(), m = ((E = e.description) == null ? void 0 : E.trim()) || void 0, b = e.entities.map((k) => ({ ...k, name: P(k.name) })), C = e.views !== !1, j = e.permissions !== !1, T = [.../* @__PURE__ */ new Set(["en", "pl", ...e.locales ?? []])], I = e.icon ?? "widgets", c = [], v = [
|
|
994
996
|
`${l}.entities.json`,
|
|
995
997
|
...C ? [`${l}.views.json`] : [],
|
|
996
|
-
...
|
|
998
|
+
...j ? [`${l}.permissions.json`] : []
|
|
997
999
|
];
|
|
998
|
-
|
|
1000
|
+
c.push({
|
|
999
1001
|
path: `${l}.manifest.json`,
|
|
1000
1002
|
text: Y({
|
|
1001
1003
|
packageName: s,
|
|
1002
1004
|
version: "1.0.0",
|
|
1003
|
-
displayName:
|
|
1004
|
-
description: m ??
|
|
1005
|
+
displayName: d,
|
|
1006
|
+
description: m ?? d,
|
|
1005
1007
|
author: "OmniVerk Module Builder",
|
|
1006
1008
|
license: "Proprietary",
|
|
1007
|
-
category: ((
|
|
1008
|
-
icon:
|
|
1009
|
-
exportedAt:
|
|
1009
|
+
category: ((A = e.category) == null ? void 0 : A.trim()) || "Custom",
|
|
1010
|
+
icon: I,
|
|
1011
|
+
exportedAt: Tt((i.now ?? (() => /* @__PURE__ */ new Date()))()),
|
|
1010
1012
|
modules: [
|
|
1011
1013
|
{
|
|
1012
1014
|
name: Ne,
|
|
1013
|
-
displayName:
|
|
1014
|
-
description: e.description ??
|
|
1015
|
-
icon:
|
|
1016
|
-
parts:
|
|
1015
|
+
displayName: d,
|
|
1016
|
+
description: e.description ?? d,
|
|
1017
|
+
icon: I,
|
|
1018
|
+
parts: v
|
|
1017
1019
|
}
|
|
1018
1020
|
],
|
|
1019
1021
|
dependencies: ["Core.Users"],
|
|
1020
|
-
i18n:
|
|
1022
|
+
i18n: T.map((k) => `${l}.${k}.i18n.json`),
|
|
1021
1023
|
...e.ownerTenantId ? { ownerTenantId: e.ownerTenantId } : {},
|
|
1022
1024
|
...e.sourceDefinitionId ? { sourceDefinitionId: e.sourceDefinitionId } : {}
|
|
1023
1025
|
})
|
|
1024
1026
|
});
|
|
1025
|
-
const
|
|
1026
|
-
for (const
|
|
1027
|
-
const
|
|
1028
|
-
for (const
|
|
1029
|
-
const O = se(
|
|
1030
|
-
name:
|
|
1031
|
-
displayName: q(
|
|
1027
|
+
const f = [];
|
|
1028
|
+
for (const k of b) {
|
|
1029
|
+
const S = [{ name: "Id", displayName: "ID", dataType: "Guid", isPrimaryKey: !0 }];
|
|
1030
|
+
for (const $ of k.fields.filter((O) => !ne(O))) {
|
|
1031
|
+
const O = se($), a = {
|
|
1032
|
+
name: P($.name),
|
|
1033
|
+
displayName: q($),
|
|
1032
1034
|
dataType: O
|
|
1033
1035
|
};
|
|
1034
|
-
O === "string" && (a.maxLength =
|
|
1036
|
+
O === "string" && (a.maxLength = $.maxLength && $.maxLength > 0 ? $.maxLength : 200), $.isRequired && (a.isRequired = !0), $.isUnique && (a.isUnique = !0), ($.isIndexed || $.isForeignKey) && (a.isIndexed = !0), $.isForeignKey && (a.isForeignKey = !0, $.referencedEntity && (a.referencedEntity = P($.referencedEntity))), (x = $.defaultValue) != null && x.trim() && (a.defaultValue = $.defaultValue), (D = $.description) != null && D.trim() && (a.description = $.description), S.push(a);
|
|
1035
1037
|
}
|
|
1036
|
-
|
|
1037
|
-
id: await qe(s,
|
|
1038
|
-
name:
|
|
1039
|
-
displayName: q(
|
|
1040
|
-
tableName: await Ve(l,
|
|
1041
|
-
description:
|
|
1042
|
-
entityIcon:
|
|
1038
|
+
f.push({
|
|
1039
|
+
id: await qe(s, k.name),
|
|
1040
|
+
name: k.name,
|
|
1041
|
+
displayName: q(k),
|
|
1042
|
+
tableName: await Ve(l, k.name),
|
|
1043
|
+
description: k.description ?? q(k),
|
|
1044
|
+
entityIcon: k.icon ?? "table_rows",
|
|
1043
1045
|
isAudited: !0,
|
|
1044
1046
|
isSoftDeleteEnabled: !1,
|
|
1045
|
-
fields:
|
|
1047
|
+
fields: S
|
|
1046
1048
|
});
|
|
1047
1049
|
}
|
|
1048
|
-
if (
|
|
1050
|
+
if (c.push({
|
|
1049
1051
|
path: `${l}.entities.json`,
|
|
1050
|
-
text: Y({ moduleName: y, version: "1.0.0", entities:
|
|
1052
|
+
text: Y({ moduleName: y, version: "1.0.0", entities: f })
|
|
1051
1053
|
}), C) {
|
|
1052
|
-
const
|
|
1053
|
-
const O = b.find((p) => p.name ===
|
|
1054
|
+
const k = ($) => {
|
|
1055
|
+
const O = b.find((p) => p.name === P($)), a = O == null ? void 0 : O.fields.find(
|
|
1054
1056
|
(p) => !ne(p) && !p.isForeignKey && se(p) === "string"
|
|
1055
1057
|
);
|
|
1056
|
-
return a ?
|
|
1057
|
-
},
|
|
1058
|
-
for (const
|
|
1059
|
-
const O =
|
|
1060
|
-
field:
|
|
1061
|
-
displayName: q(
|
|
1058
|
+
return a ? P(a.name) : "Name";
|
|
1059
|
+
}, S = [];
|
|
1060
|
+
for (const $ of b) {
|
|
1061
|
+
const O = $.fields.filter((u) => !ne(u)), a = O.filter((u) => !["text", "json"].includes(se(u))).slice(0, 6), p = (a.length ? a : [O[0]]).map((u) => ({
|
|
1062
|
+
field: P(u.name),
|
|
1063
|
+
displayName: q(u),
|
|
1062
1064
|
sortable: !0,
|
|
1063
|
-
type: pe(
|
|
1064
|
-
...
|
|
1065
|
-
})), g = O.filter((
|
|
1066
|
-
field:
|
|
1067
|
-
type: Nt[pe(
|
|
1068
|
-
label: q(
|
|
1069
|
-
...
|
|
1070
|
-
...
|
|
1071
|
-
entity:
|
|
1072
|
-
displayField:
|
|
1065
|
+
type: pe(u)[0],
|
|
1066
|
+
...u.isForeignKey && u.referencedEntity ? { referencedEntity: P(u.referencedEntity) } : {}
|
|
1067
|
+
})), g = O.filter((u) => ["string", "text"].includes(se(u))).map((u) => P(u.name)), h = O.map((u) => ({
|
|
1068
|
+
field: P(u.name),
|
|
1069
|
+
type: Nt[pe(u)[1]] ?? "TextInput",
|
|
1070
|
+
label: q(u),
|
|
1071
|
+
...u.isRequired ? { required: !0 } : {},
|
|
1072
|
+
...u.isForeignKey && u.referencedEntity ? {
|
|
1073
|
+
entity: P(u.referencedEntity),
|
|
1074
|
+
displayField: k(u.referencedEntity)
|
|
1073
1075
|
} : {}
|
|
1074
1076
|
}));
|
|
1075
|
-
|
|
1076
|
-
id: `vw-${l}-${he(
|
|
1077
|
-
name: `${
|
|
1078
|
-
displayName: q(
|
|
1077
|
+
S.push({
|
|
1078
|
+
id: `vw-${l}-${he($.name)}-list`,
|
|
1079
|
+
name: `${$.name}List`,
|
|
1080
|
+
displayName: q($),
|
|
1079
1081
|
type: "List",
|
|
1080
1082
|
icon: "list",
|
|
1081
|
-
entityName:
|
|
1083
|
+
entityName: $.name,
|
|
1082
1084
|
columns: p,
|
|
1083
1085
|
searchFields: g,
|
|
1084
1086
|
pageSize: 25,
|
|
@@ -1086,85 +1088,85 @@ async function Et(e, i = {}) {
|
|
|
1086
1088
|
allowEdit: !0,
|
|
1087
1089
|
allowDelete: !0
|
|
1088
1090
|
});
|
|
1089
|
-
const
|
|
1090
|
-
const w = pe(
|
|
1091
|
+
const N = O.map((u) => {
|
|
1092
|
+
const w = pe(u)[1];
|
|
1091
1093
|
return {
|
|
1092
|
-
field:
|
|
1094
|
+
field: P(u.name),
|
|
1093
1095
|
type: w,
|
|
1094
|
-
label: q(
|
|
1096
|
+
label: q(u),
|
|
1095
1097
|
colSpan: w === "textarea" ? 12 : 6,
|
|
1096
|
-
...
|
|
1097
|
-
...
|
|
1098
|
+
...u.isRequired ? { required: !0 } : {},
|
|
1099
|
+
...u.isForeignKey && u.referencedEntity ? { entity: P(u.referencedEntity) } : {}
|
|
1098
1100
|
};
|
|
1099
1101
|
});
|
|
1100
|
-
|
|
1101
|
-
id: `vw-${l}-${he(
|
|
1102
|
-
name: `${
|
|
1103
|
-
displayName: q(
|
|
1102
|
+
S.push({
|
|
1103
|
+
id: `vw-${l}-${he($.name)}-form`,
|
|
1104
|
+
name: `${$.name}Form`,
|
|
1105
|
+
displayName: q($),
|
|
1104
1106
|
type: "Form",
|
|
1105
1107
|
icon: "edit",
|
|
1106
|
-
entityName:
|
|
1108
|
+
entityName: $.name,
|
|
1107
1109
|
tabs: [
|
|
1108
1110
|
{
|
|
1109
1111
|
name: "Main",
|
|
1110
|
-
displayName: q(
|
|
1111
|
-
sections: [{ name: "Details", displayName: "Details", controls:
|
|
1112
|
+
displayName: q($),
|
|
1113
|
+
sections: [{ name: "Details", displayName: "Details", controls: N }]
|
|
1112
1114
|
}
|
|
1113
1115
|
]
|
|
1114
1116
|
});
|
|
1115
1117
|
}
|
|
1116
|
-
|
|
1118
|
+
c.push({
|
|
1117
1119
|
path: `${l}.views.json`,
|
|
1118
|
-
text: Y({ moduleName: y, version: "1.0.0", views:
|
|
1120
|
+
text: Y({ moduleName: y, version: "1.0.0", views: S })
|
|
1119
1121
|
});
|
|
1120
1122
|
}
|
|
1121
|
-
if (
|
|
1122
|
-
const
|
|
1123
|
-
code:
|
|
1124
|
-
name: `${
|
|
1125
|
-
description: `${a}: ${
|
|
1126
|
-
}),
|
|
1123
|
+
if (j) {
|
|
1124
|
+
const k = (O) => `${r}.${O}`, S = (O, a) => ({
|
|
1125
|
+
code: k(O),
|
|
1126
|
+
name: `${d} — ${a}`,
|
|
1127
|
+
description: `${a}: ${d}`
|
|
1128
|
+
}), $ = (O, a, ...p) => ({
|
|
1127
1129
|
name: `${W}${r} ${O}`,
|
|
1128
|
-
description: `${
|
|
1129
|
-
permissions: p.map(
|
|
1130
|
+
description: `${d} — ${a}`,
|
|
1131
|
+
permissions: p.map(k)
|
|
1130
1132
|
});
|
|
1131
|
-
|
|
1133
|
+
c.push({
|
|
1132
1134
|
path: `${l}.permissions.json`,
|
|
1133
1135
|
text: Y({
|
|
1134
1136
|
moduleName: y,
|
|
1135
1137
|
version: "1.0.0",
|
|
1136
1138
|
permissions: [
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1139
|
+
S("Read", "view records"),
|
|
1140
|
+
S("Create", "add records"),
|
|
1141
|
+
S("Edit", "edit records"),
|
|
1142
|
+
S("Delete", "delete records"),
|
|
1143
|
+
S("Admin", "administer the module")
|
|
1142
1144
|
],
|
|
1143
1145
|
permissionGroups: [
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1146
|
+
$("Viewer", "read only", "Read"),
|
|
1147
|
+
$("Editor", "read and edit", "Read", "Create", "Edit"),
|
|
1148
|
+
$("Admin", "full access", "Read", "Create", "Edit", "Delete", "Admin")
|
|
1147
1149
|
]
|
|
1148
1150
|
})
|
|
1149
1151
|
});
|
|
1150
1152
|
}
|
|
1151
|
-
for (const
|
|
1152
|
-
const
|
|
1153
|
-
"module.displayName":
|
|
1154
|
-
"module.description": m ??
|
|
1153
|
+
for (const k of T) {
|
|
1154
|
+
const S = {
|
|
1155
|
+
"module.displayName": d,
|
|
1156
|
+
"module.description": m ?? d
|
|
1155
1157
|
};
|
|
1156
|
-
for (const
|
|
1157
|
-
|
|
1158
|
-
for (const O of
|
|
1159
|
-
|
|
1160
|
-
C && (
|
|
1158
|
+
for (const $ of b) {
|
|
1159
|
+
S[`entity.${$.name}.displayName`] = q($);
|
|
1160
|
+
for (const O of $.fields.filter((a) => !ne(a)))
|
|
1161
|
+
S[`field.${$.name}.${P(O.name)}.displayName`] = q(O);
|
|
1162
|
+
C && (S[`view.${$.name}List.displayName`] = q($), S[`view.${$.name}Form.displayName`] = q($), S[`view.${$.name}Form.tab.Main`] = q($), S[`view.${$.name}Form.section.Details`] = k === "pl" ? "Szczegóły" : "Details");
|
|
1161
1163
|
}
|
|
1162
|
-
|
|
1163
|
-
path: `${l}.${
|
|
1164
|
-
text: Y({ moduleName: s, locale:
|
|
1164
|
+
c.push({
|
|
1165
|
+
path: `${l}.${k}.i18n.json`,
|
|
1166
|
+
text: Y({ moduleName: s, locale: k, version: "1.0.0", translations: S })
|
|
1165
1167
|
});
|
|
1166
1168
|
}
|
|
1167
|
-
return e.iconConfig !== !1 &&
|
|
1169
|
+
return e.iconConfig !== !1 && c.push({ path: `${l}.iconconfig.json`, text: Y(Et(e.icon)) }), { package: { packageName: s, folder: `Custom/${r}`, files: c }, problems: [] };
|
|
1168
1170
|
}
|
|
1169
1171
|
function It(e) {
|
|
1170
1172
|
const i = (t) => typeof t == "string" && t ? t : void 0;
|
|
@@ -1204,80 +1206,80 @@ function we(e, i) {
|
|
|
1204
1206
|
const Ct = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
1205
1207
|
async function Ot(e, i) {
|
|
1206
1208
|
const t = e.find(
|
|
1207
|
-
(
|
|
1209
|
+
(c) => !c.path.includes("/") && c.path.toLowerCase().endsWith(".manifest.json")
|
|
1208
1210
|
);
|
|
1209
1211
|
if (!t)
|
|
1210
1212
|
throw new Error("The module has no manifest.");
|
|
1211
|
-
const o = _(t.text).value, n = String(o.packageName ?? ""), s = t.path.slice(0, -14), r = i.id, l = kt(r), y = (
|
|
1212
|
-
for (const
|
|
1213
|
+
const o = _(t.text).value, n = String(o.packageName ?? ""), s = t.path.slice(0, -14), r = i.id, l = kt(r), y = (c) => c.startsWith(W) ? c.slice(W.length) : c.split(".").pop() ?? c, d = y(n), m = y(r), b = (c) => c.startsWith(`${s}.`) ? `${l}${c.slice(s.length)}` : c, C = new Map(e.map((c) => [c.path, b(c.path)])), j = /* @__PURE__ */ new Map();
|
|
1214
|
+
for (const c of e.filter((v) => v.path.toLowerCase().endsWith(".permissions.json")))
|
|
1213
1215
|
try {
|
|
1214
|
-
const
|
|
1215
|
-
for (const
|
|
1216
|
-
const
|
|
1217
|
-
|
|
1216
|
+
const v = _(c.text).value;
|
|
1217
|
+
for (const f of H(v) && Array.isArray(v.permissions) ? v.permissions : []) {
|
|
1218
|
+
const E = typeof f.code == "string" ? f.code : "";
|
|
1219
|
+
E.startsWith(`${d}.`) && j.set(E, `${m}${E.slice(d.length)}`);
|
|
1218
1220
|
}
|
|
1219
1221
|
} catch {
|
|
1220
1222
|
}
|
|
1221
|
-
const
|
|
1222
|
-
for (const
|
|
1223
|
-
if (
|
|
1223
|
+
const T = (c) => n && (c === n || c.startsWith(`${n}.`) || c.startsWith(`${n} `)) ? r + c.slice(n.length) : j.get(c) ?? C.get(c) ?? c, I = [];
|
|
1224
|
+
for (const c of e) {
|
|
1225
|
+
if (c.path.startsWith(".revisions/"))
|
|
1224
1226
|
continue;
|
|
1225
|
-
const
|
|
1226
|
-
if (!
|
|
1227
|
-
|
|
1227
|
+
const v = b(c.path);
|
|
1228
|
+
if (!c.path.toLowerCase().endsWith(".json")) {
|
|
1229
|
+
I.push({ path: v, text: c.text });
|
|
1228
1230
|
continue;
|
|
1229
1231
|
}
|
|
1230
|
-
let
|
|
1232
|
+
let f;
|
|
1231
1233
|
try {
|
|
1232
|
-
|
|
1234
|
+
f = _(c.text).value;
|
|
1233
1235
|
} catch {
|
|
1234
|
-
|
|
1236
|
+
I.push({ path: v, text: c.text });
|
|
1235
1237
|
continue;
|
|
1236
1238
|
}
|
|
1237
|
-
let
|
|
1238
|
-
if (
|
|
1239
|
-
const { sourceDefinitionId:
|
|
1240
|
-
|
|
1241
|
-
...
|
|
1239
|
+
let E = we(f, T);
|
|
1240
|
+
if (c === t && H(E)) {
|
|
1241
|
+
const { sourceDefinitionId: A, ...x } = E;
|
|
1242
|
+
E = {
|
|
1243
|
+
...x,
|
|
1242
1244
|
packageName: r,
|
|
1243
1245
|
...i.name ? { displayName: i.name } : {},
|
|
1244
1246
|
...i.packageId ? { category: i.packageId } : {}
|
|
1245
1247
|
};
|
|
1246
1248
|
}
|
|
1247
|
-
if (
|
|
1248
|
-
const
|
|
1249
|
-
for (const
|
|
1250
|
-
if (!H(
|
|
1251
|
-
|
|
1249
|
+
if (c.path.toLowerCase().endsWith(".entities.json") && H(E) && Array.isArray(E.entities)) {
|
|
1250
|
+
const A = [];
|
|
1251
|
+
for (const x of E.entities) {
|
|
1252
|
+
if (!H(x) || typeof x.name != "string") {
|
|
1253
|
+
A.push(x);
|
|
1252
1254
|
continue;
|
|
1253
1255
|
}
|
|
1254
|
-
|
|
1255
|
-
...
|
|
1256
|
-
...typeof
|
|
1257
|
-
...typeof
|
|
1256
|
+
A.push({
|
|
1257
|
+
...x,
|
|
1258
|
+
...typeof x.id == "string" && Ct.test(x.id) ? { id: await qe(r, x.name) } : {},
|
|
1259
|
+
...typeof x.tableName == "string" ? { tableName: await Ve(l, x.name) } : {}
|
|
1258
1260
|
});
|
|
1259
1261
|
}
|
|
1260
|
-
|
|
1262
|
+
E = { ...E, entities: A };
|
|
1261
1263
|
}
|
|
1262
|
-
i.name && /\.en\.i18n\.json$/i.test(
|
|
1263
|
-
...
|
|
1264
|
-
translations: { ...
|
|
1265
|
-
}),
|
|
1264
|
+
i.name && /\.en\.i18n\.json$/i.test(c.path) && H(E) && H(E.translations) && typeof E.translations["module.displayName"] == "string" && (E = {
|
|
1265
|
+
...E,
|
|
1266
|
+
translations: { ...E.translations, "module.displayName": i.name }
|
|
1267
|
+
}), I.push({ path: v, text: Me(c.text, E) });
|
|
1266
1268
|
}
|
|
1267
1269
|
return {
|
|
1268
1270
|
id: r,
|
|
1269
1271
|
packageId: i.packageId ?? o.category,
|
|
1270
|
-
files:
|
|
1272
|
+
files: I
|
|
1271
1273
|
};
|
|
1272
1274
|
}
|
|
1273
|
-
const
|
|
1275
|
+
const K = (e) => typeof e == "object" && e !== null && !Array.isArray(e), Q = (e, i) => K(e) && Array.isArray(e[i]) ? e[i] : [], oe = (e, i) => e.toLowerCase().endsWith(i), ve = (e) => !e.includes("/"), At = /[ąćęłńóśźżĄĆĘŁŃÓŚŹŻ]/, Lt = [
|
|
1274
1276
|
"ING Bank Śląski",
|
|
1275
1277
|
"Bank Śląski",
|
|
1276
1278
|
"BOŚ",
|
|
1277
1279
|
"e-Zamówienia",
|
|
1278
1280
|
"eZamówienia",
|
|
1279
1281
|
"Plataforma de Contratación del Sector Público"
|
|
1280
|
-
], ae = (e) => At.test(Lt.reduce((i, t) => i.split(t).join(""), e)),
|
|
1282
|
+
], ae = (e) => At.test(Lt.reduce((i, t) => i.split(t).join(""), e)), Mt = /* @__PURE__ */ new Set([
|
|
1281
1283
|
"module",
|
|
1282
1284
|
"entity",
|
|
1283
1285
|
"field",
|
|
@@ -1286,8 +1288,8 @@ const F = (e) => typeof e == "object" && e !== null && !Array.isArray(e), Q = (e
|
|
|
1286
1288
|
"nav",
|
|
1287
1289
|
"action",
|
|
1288
1290
|
"tutorial"
|
|
1289
|
-
]),
|
|
1290
|
-
function
|
|
1291
|
+
]), Dt = /* @__PURE__ */ new Set(["int", "int32", "int64", "long", "integer"]);
|
|
1292
|
+
function Kt(e) {
|
|
1291
1293
|
for (let i = 0; i < e.length; i++) {
|
|
1292
1294
|
const t = e.charCodeAt(i);
|
|
1293
1295
|
if (t >= 55296 && t <= 56319 || t >= 9728 && t <= 10175)
|
|
@@ -1295,13 +1297,13 @@ function Ft(e) {
|
|
|
1295
1297
|
}
|
|
1296
1298
|
return !1;
|
|
1297
1299
|
}
|
|
1298
|
-
function
|
|
1299
|
-
if (!
|
|
1300
|
+
function Te(e) {
|
|
1301
|
+
if (!K(e))
|
|
1300
1302
|
return [];
|
|
1301
|
-
const i =
|
|
1303
|
+
const i = K(e.translations) ? e.translations : K(e.keys) ? e.keys : void 0;
|
|
1302
1304
|
return i ? Object.entries(i) : [];
|
|
1303
1305
|
}
|
|
1304
|
-
const
|
|
1306
|
+
const Ee = /^(.*)\.([a-z]{2,3}(?:-[A-Za-z]{2,4})?)\.i18n\.json$/i, Ft = /* @__PURE__ */ new Set([
|
|
1305
1307
|
"hotel.views.json",
|
|
1306
1308
|
"restaurant.views.json",
|
|
1307
1309
|
"backup-dr.views.json",
|
|
@@ -1310,255 +1312,306 @@ const xe = /^(.*)\.([a-z]{2,3}(?:-[A-Za-z]{2,4})?)\.i18n\.json$/i, Pt = /* @__PU
|
|
|
1310
1312
|
"shelf_management.views.json",
|
|
1311
1313
|
"psa.views.json"
|
|
1312
1314
|
]);
|
|
1313
|
-
function
|
|
1315
|
+
function Pt(e, i = {}) {
|
|
1314
1316
|
const t = new Set(
|
|
1315
|
-
[...i.legacyListViewFiles ??
|
|
1316
|
-
(
|
|
1317
|
+
[...i.legacyListViewFiles ?? Ft].map(
|
|
1318
|
+
(c) => c.toLowerCase()
|
|
1317
1319
|
)
|
|
1318
|
-
), o = [], n = (
|
|
1319
|
-
o.push({ severity: "error", ...
|
|
1320
|
+
), o = [], n = (c) => {
|
|
1321
|
+
o.push({ severity: "error", ...c });
|
|
1320
1322
|
}, s = [];
|
|
1321
|
-
for (const
|
|
1322
|
-
if (!(!oe(
|
|
1323
|
+
for (const c of e.files)
|
|
1324
|
+
if (!(!oe(c.path, ".json") || c.path.startsWith(".revisions/")))
|
|
1323
1325
|
try {
|
|
1324
|
-
s.push({ file:
|
|
1325
|
-
} catch (
|
|
1326
|
+
s.push({ file: c, value: _(c.text).value });
|
|
1327
|
+
} catch (v) {
|
|
1326
1328
|
n({
|
|
1327
1329
|
code: "json.invalid",
|
|
1328
|
-
message: `${
|
|
1329
|
-
|
|
1330
|
+
message: `${c.path} is not valid JSON: ${v instanceof Error ? v.message : String(v)}`,
|
|
1331
|
+
messageKey: "devStudio.issue.jsonInvalid",
|
|
1332
|
+
params: { path: c.path, error: v instanceof Error ? v.message : String(v) },
|
|
1333
|
+
path: c.path
|
|
1330
1334
|
});
|
|
1331
1335
|
}
|
|
1332
|
-
const r = (
|
|
1336
|
+
const r = (c) => s.filter((v) => ve(v.file.path) && oe(v.file.path, c)), l = r(".manifest.json");
|
|
1333
1337
|
l.length === 0 && n({
|
|
1334
1338
|
code: "manifest.missing",
|
|
1335
1339
|
message: "The module has no *.manifest.json.",
|
|
1336
1340
|
messageKey: "devStudio.issue.manifestMissing"
|
|
1337
1341
|
});
|
|
1338
|
-
for (const { file:
|
|
1339
|
-
for (const
|
|
1340
|
-
(!
|
|
1342
|
+
for (const { file: c, value: v } of l)
|
|
1343
|
+
for (const f of ["packageName", "version", "category"])
|
|
1344
|
+
(!K(v) || !(f in v)) && n({
|
|
1341
1345
|
code: "manifest.required",
|
|
1342
|
-
message: `The manifest needs "${
|
|
1346
|
+
message: `The manifest needs "${f}".`,
|
|
1343
1347
|
messageKey: "devStudio.issue.manifestRequired",
|
|
1344
|
-
params: { field:
|
|
1345
|
-
path:
|
|
1346
|
-
pointer: `/${
|
|
1348
|
+
params: { field: f },
|
|
1349
|
+
path: c.path,
|
|
1350
|
+
pointer: `/${f}`
|
|
1347
1351
|
});
|
|
1348
1352
|
const y = r(".iconconfig.json");
|
|
1349
|
-
y.length === 0 && n({
|
|
1353
|
+
y.length === 0 && e.contents !== "manifest" && n({
|
|
1350
1354
|
severity: "info",
|
|
1351
1355
|
code: "iconconfig.missing",
|
|
1352
|
-
message: "The module has no *.iconconfig.json: its menu shows a default icon (the CI wants one in every Category/Module folder)."
|
|
1356
|
+
message: "The module has no *.iconconfig.json: its menu shows a default icon (the CI wants one in every Category/Module folder).",
|
|
1357
|
+
messageKey: "devStudio.issue.iconconfigMissing"
|
|
1353
1358
|
});
|
|
1354
|
-
for (const { file:
|
|
1355
|
-
const
|
|
1356
|
-
...
|
|
1357
|
-
...
|
|
1358
|
-
...
|
|
1359
|
-
...
|
|
1359
|
+
for (const { file: c, value: v } of y) {
|
|
1360
|
+
const f = K(v) ? v.module : void 0, E = K(f) ? f.icon : void 0, A = [
|
|
1361
|
+
...K(f) ? [] : ["module"],
|
|
1362
|
+
...K(f) && !K(E) ? ["module.icon"] : [],
|
|
1363
|
+
...K(E) && !("name" in E) ? ["module.icon.name"] : [],
|
|
1364
|
+
...K(E) && !("package" in E) ? ["module.icon.package"] : [],
|
|
1360
1365
|
...["views", "permissions", "workflowStates"].filter(
|
|
1361
|
-
(
|
|
1366
|
+
(x) => !K(v) || !(x in v)
|
|
1362
1367
|
)
|
|
1363
1368
|
];
|
|
1364
|
-
for (const
|
|
1369
|
+
for (const x of A)
|
|
1365
1370
|
n({
|
|
1366
1371
|
code: "iconconfig.structure",
|
|
1367
|
-
message: `The icon config needs "${
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1372
|
+
message: `The icon config needs "${x}".`,
|
|
1373
|
+
messageKey: "devStudio.issue.iconconfigStructure",
|
|
1374
|
+
params: { field: x },
|
|
1375
|
+
path: c.path,
|
|
1376
|
+
pointer: `/${x.split(".").join("/")}`
|
|
1371
1377
|
});
|
|
1372
1378
|
}
|
|
1373
|
-
const
|
|
1374
|
-
for (const { file:
|
|
1375
|
-
if (!
|
|
1379
|
+
const d = [], m = [];
|
|
1380
|
+
for (const { file: c, value: v } of r(".entities.json")) {
|
|
1381
|
+
if (!K(v) || !("entities" in v))
|
|
1376
1382
|
continue;
|
|
1377
|
-
const
|
|
1378
|
-
if (!Array.isArray(
|
|
1383
|
+
const f = [], E = v.entities;
|
|
1384
|
+
if (!Array.isArray(E) || E.length === 0) {
|
|
1379
1385
|
n({
|
|
1380
1386
|
code: "entities.empty",
|
|
1381
1387
|
message: "The file has no entities.",
|
|
1382
|
-
|
|
1388
|
+
messageKey: "devStudio.issue.entitiesEmpty",
|
|
1389
|
+
path: c.path,
|
|
1383
1390
|
pointer: "/entities"
|
|
1384
1391
|
});
|
|
1385
1392
|
continue;
|
|
1386
1393
|
}
|
|
1387
|
-
|
|
1388
|
-
const
|
|
1389
|
-
if (
|
|
1394
|
+
E.forEach((A, x) => {
|
|
1395
|
+
const D = `/entities/${x}`, k = K(A) && typeof A.name == "string" ? A.name : void 0;
|
|
1396
|
+
if (k ? d.push(k) : n({
|
|
1390
1397
|
code: "entities.name",
|
|
1391
|
-
message: `Entity #${
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1398
|
+
message: `Entity #${x + 1} has no name.`,
|
|
1399
|
+
messageKey: "devStudio.issue.entitiesName",
|
|
1400
|
+
params: { n: x + 1 },
|
|
1401
|
+
path: c.path,
|
|
1402
|
+
pointer: D
|
|
1403
|
+
}), !K(A) || !Array.isArray(A.fields)) {
|
|
1395
1404
|
n({
|
|
1396
1405
|
code: "entities.fields",
|
|
1397
|
-
message: `Entity ${
|
|
1398
|
-
|
|
1399
|
-
|
|
1406
|
+
message: `Entity ${k ?? `#${x + 1}`} has no fields array.`,
|
|
1407
|
+
messageKey: "devStudio.issue.entitiesFields",
|
|
1408
|
+
params: { name: k ?? `#${x + 1}` },
|
|
1409
|
+
path: c.path,
|
|
1410
|
+
pointer: D
|
|
1400
1411
|
});
|
|
1401
1412
|
return;
|
|
1402
1413
|
}
|
|
1403
|
-
|
|
1414
|
+
K(A) && typeof A.displayName == "string" && ae(A.displayName) && n({
|
|
1404
1415
|
code: "labels.polish",
|
|
1405
|
-
message: `Entity ${
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1416
|
+
message: `Entity ${k}: the display name "${A.displayName}" is Polish — seed labels are English, Polish goes to the .pl bundle.`,
|
|
1417
|
+
messageKey: "devStudio.issue.polishEntity",
|
|
1418
|
+
params: { name: k ?? "", text: A.displayName },
|
|
1419
|
+
path: c.path,
|
|
1420
|
+
pointer: `${D}/displayName`
|
|
1421
|
+
}), A.fields.forEach((S, $) => {
|
|
1422
|
+
if (!K(S))
|
|
1410
1423
|
return;
|
|
1411
|
-
const O = typeof
|
|
1412
|
-
|
|
1413
|
-
const p = typeof
|
|
1414
|
-
p === void 0 && typeof
|
|
1424
|
+
const O = typeof S.name == "string" ? S.name : void 0, a = `${D}/fields/${$}`;
|
|
1425
|
+
k && O && S.isPrimaryKey !== !0 && m.push(`field.${k}.${O}`);
|
|
1426
|
+
const p = typeof S.dataType == "string" ? S.dataType.replace(/\?+$/, "") : void 0;
|
|
1427
|
+
p === void 0 && typeof S.type == "string" && f.push({ name: `${k}.${O}`, pointer: `${a}/type` }), p && Dt.has(p.toLowerCase()) && (O === "Id" || S.isForeignKey === !0) && n({
|
|
1415
1428
|
code: "entities.keyNotGuid",
|
|
1416
|
-
message: `${
|
|
1417
|
-
|
|
1429
|
+
message: `${k}.${O} is ${p}: keys must be Guid (every row's Id is a uuid).`,
|
|
1430
|
+
messageKey: "devStudio.issue.keyNotGuid",
|
|
1431
|
+
params: { name: `${k}.${O}`, type: p },
|
|
1432
|
+
path: c.path,
|
|
1418
1433
|
pointer: `${a}/dataType`
|
|
1419
|
-
}), typeof
|
|
1434
|
+
}), typeof S.displayName == "string" && ae(S.displayName) && n({
|
|
1420
1435
|
code: "labels.polish",
|
|
1421
|
-
message: `${
|
|
1422
|
-
|
|
1436
|
+
message: `${k}.${O}: the display name "${S.displayName}" is Polish — seed labels are English.`,
|
|
1437
|
+
messageKey: "devStudio.issue.polishField",
|
|
1438
|
+
params: { name: `${k}.${O}`, text: S.displayName },
|
|
1439
|
+
path: c.path,
|
|
1423
1440
|
pointer: `${a}/displayName`
|
|
1424
1441
|
});
|
|
1425
1442
|
});
|
|
1426
|
-
}),
|
|
1443
|
+
}), f.length && n({
|
|
1427
1444
|
severity: "warning",
|
|
1428
1445
|
code: "entities.typeIgnored",
|
|
1429
|
-
message: `${
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1446
|
+
message: `${f.length} field(s) give their type as "type", which installing ignores — it reads "dataType": ${f.slice(0, 5).map((A) => A.name).join(", ")}${f.length > 5 ? ", …" : ""}`,
|
|
1447
|
+
messageKey: "devStudio.issue.typeIgnored",
|
|
1448
|
+
params: {
|
|
1449
|
+
count: f.length,
|
|
1450
|
+
names: `${f.slice(0, 5).map((A) => A.name).join(", ")}${f.length > 5 ? ", …" : ""}`
|
|
1451
|
+
},
|
|
1452
|
+
path: c.path,
|
|
1453
|
+
pointer: f[0].pointer
|
|
1433
1454
|
});
|
|
1434
1455
|
}
|
|
1435
|
-
for (const { file:
|
|
1436
|
-
(!
|
|
1456
|
+
for (const { file: c, value: v } of r(".permissions.json"))
|
|
1457
|
+
(!K(v) || !Array.isArray(v.permissions) || v.permissions.length === 0) && n({
|
|
1437
1458
|
code: "permissions.empty",
|
|
1438
1459
|
message: 'The file needs a non-empty "permissions" array.',
|
|
1439
|
-
|
|
1460
|
+
messageKey: "devStudio.issue.permissionsEmpty",
|
|
1461
|
+
path: c.path,
|
|
1440
1462
|
pointer: "/permissions"
|
|
1441
1463
|
});
|
|
1442
1464
|
const b = [];
|
|
1443
|
-
for (const { file:
|
|
1444
|
-
if (!
|
|
1465
|
+
for (const { file: c, value: v } of r(".views.json")) {
|
|
1466
|
+
if (!K(v) || Object.keys(v).length === 0) {
|
|
1445
1467
|
n({
|
|
1446
1468
|
code: "views.empty",
|
|
1447
1469
|
message: "A views file is a JSON object with at least one property.",
|
|
1448
|
-
|
|
1470
|
+
messageKey: "devStudio.issue.viewsEmpty",
|
|
1471
|
+
path: c.path
|
|
1449
1472
|
});
|
|
1450
1473
|
continue;
|
|
1451
1474
|
}
|
|
1452
|
-
Q(
|
|
1453
|
-
if (!
|
|
1475
|
+
Q(v, "views").forEach((f, E) => {
|
|
1476
|
+
if (!K(f))
|
|
1454
1477
|
return;
|
|
1455
|
-
const
|
|
1456
|
-
typeof
|
|
1478
|
+
const A = `/views/${E}`, x = typeof f.name == "string" ? f.name : "(unnamed)";
|
|
1479
|
+
typeof f.name == "string" && b.push(f.name), typeof f.type == "string" && f.type.toLowerCase() === "list" && !t.has(c.path.toLowerCase()) && (typeof f.entityName != "string" || !f.entityName.trim() ? n({
|
|
1457
1480
|
code: "views.listEntity",
|
|
1458
|
-
message: `List view ${
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1481
|
+
message: `List view ${x} needs a top-level "entityName".`,
|
|
1482
|
+
messageKey: "devStudio.issue.listEntity",
|
|
1483
|
+
params: { name: x },
|
|
1484
|
+
path: c.path,
|
|
1485
|
+
pointer: A
|
|
1486
|
+
}) : (!Array.isArray(f.columns) || f.columns.length === 0) && n({
|
|
1462
1487
|
code: "views.listColumns",
|
|
1463
|
-
message: `List view ${
|
|
1464
|
-
|
|
1465
|
-
|
|
1488
|
+
message: `List view ${x} needs non-empty top-level "columns".`,
|
|
1489
|
+
messageKey: "devStudio.issue.listColumns",
|
|
1490
|
+
params: { name: x },
|
|
1491
|
+
path: c.path,
|
|
1492
|
+
pointer: A
|
|
1466
1493
|
}));
|
|
1467
|
-
const
|
|
1468
|
-
Q(
|
|
1469
|
-
for (const
|
|
1470
|
-
|
|
1471
|
-
}), Q(
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
(a, p) =>
|
|
1494
|
+
const D = [[f, "displayName", A]];
|
|
1495
|
+
Q(f, "columns").forEach((k, S) => {
|
|
1496
|
+
for (const $ of ["header", "displayName", "label"])
|
|
1497
|
+
D.push([k, $, `${A}/columns/${S}`]);
|
|
1498
|
+
}), Q(f, "tabs").forEach((k, S) => {
|
|
1499
|
+
D.push([k, "displayName", `${A}/tabs/${S}`]), Q(k, "sections").forEach(($, O) => {
|
|
1500
|
+
D.push([$, "displayName", `${A}/tabs/${S}/sections/${O}`]), Q($, "controls").forEach(
|
|
1501
|
+
(a, p) => D.push([a, "label", `${A}/tabs/${S}/sections/${O}/controls/${p}`])
|
|
1475
1502
|
);
|
|
1476
1503
|
});
|
|
1477
1504
|
});
|
|
1478
|
-
for (const [
|
|
1479
|
-
const O =
|
|
1505
|
+
for (const [k, S, $] of D) {
|
|
1506
|
+
const O = K(k) ? k[S] : void 0;
|
|
1480
1507
|
typeof O == "string" && ae(O) && n({
|
|
1481
1508
|
code: "labels.polish",
|
|
1482
|
-
message: `View ${
|
|
1483
|
-
|
|
1484
|
-
|
|
1509
|
+
message: `View ${x}: "${O}" is Polish — seed labels are English.`,
|
|
1510
|
+
messageKey: "devStudio.issue.polishView",
|
|
1511
|
+
params: { name: x, text: O },
|
|
1512
|
+
path: c.path,
|
|
1513
|
+
pointer: `${$}/${S}`
|
|
1485
1514
|
});
|
|
1486
1515
|
}
|
|
1487
1516
|
});
|
|
1488
1517
|
}
|
|
1489
|
-
const C = s.filter((
|
|
1490
|
-
for (const
|
|
1491
|
-
const [,
|
|
1492
|
-
|
|
1518
|
+
const C = s.filter((c) => ve(c.file.path) && Ee.test(c.file.path)), j = /* @__PURE__ */ new Map();
|
|
1519
|
+
for (const c of C) {
|
|
1520
|
+
const [, v, f] = Ee.exec(c.file.path), E = j.get(v) ?? /* @__PURE__ */ new Map();
|
|
1521
|
+
E.set(f.toLowerCase(), c), j.set(v, E);
|
|
1493
1522
|
}
|
|
1494
|
-
const
|
|
1495
|
-
[...
|
|
1496
|
-
),
|
|
1497
|
-
for (const [
|
|
1498
|
-
const
|
|
1499
|
-
if (
|
|
1523
|
+
const T = new Set(
|
|
1524
|
+
[...j.keys()].map((c) => c.split(".")[0]).filter((c) => !Mt.has(c))
|
|
1525
|
+
), I = /* @__PURE__ */ new Set();
|
|
1526
|
+
for (const [c, v] of j) {
|
|
1527
|
+
const f = v.get("en"), E = v.get("pl"), A = (x) => new Set(Te(x == null ? void 0 : x.value).map(([D]) => D));
|
|
1528
|
+
if (f && !E && n({
|
|
1500
1529
|
code: "i18n.polishMissing",
|
|
1501
|
-
message: `${
|
|
1502
|
-
|
|
1503
|
-
|
|
1530
|
+
message: `${c}.en.i18n.json needs a .pl.i18n.json sibling (English and Polish are mandatory).`,
|
|
1531
|
+
messageKey: "devStudio.issue.polishBundleMissing",
|
|
1532
|
+
params: { group: c },
|
|
1533
|
+
path: f.file.path
|
|
1534
|
+
}), E && !f && n({
|
|
1504
1535
|
code: "i18n.englishMissing",
|
|
1505
|
-
message: `${
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1536
|
+
message: `${c}.pl.i18n.json needs an .en.i18n.json baseline.`,
|
|
1537
|
+
messageKey: "devStudio.issue.englishBundleMissing",
|
|
1538
|
+
params: { group: c },
|
|
1539
|
+
path: E.file.path
|
|
1540
|
+
}), f && E) {
|
|
1541
|
+
const x = A(f), D = A(E), k = [...x].filter(($) => !D.has($)), S = [...D].filter(($) => !x.has($));
|
|
1542
|
+
k.length && n({
|
|
1510
1543
|
code: "i18n.keyMissing",
|
|
1511
|
-
message: `${
|
|
1512
|
-
|
|
1513
|
-
|
|
1544
|
+
message: `${E.file.path} is missing ${k.length} key(s) of English: ${k.slice(0, 10).join(", ")}`,
|
|
1545
|
+
messageKey: "devStudio.issue.keysMissingPl",
|
|
1546
|
+
params: {
|
|
1547
|
+
path: E.file.path,
|
|
1548
|
+
count: k.length,
|
|
1549
|
+
keys: k.slice(0, 10).join(", ")
|
|
1550
|
+
},
|
|
1551
|
+
path: E.file.path
|
|
1552
|
+
}), S.length && n({
|
|
1514
1553
|
code: "i18n.keyMissing",
|
|
1515
|
-
message: `${
|
|
1516
|
-
|
|
1554
|
+
message: `${f.file.path} is missing ${S.length} key(s) of Polish: ${S.slice(0, 10).join(", ")}`,
|
|
1555
|
+
messageKey: "devStudio.issue.keysMissingEn",
|
|
1556
|
+
params: {
|
|
1557
|
+
path: f.file.path,
|
|
1558
|
+
count: S.length,
|
|
1559
|
+
keys: S.slice(0, 10).join(", ")
|
|
1560
|
+
},
|
|
1561
|
+
path: f.file.path
|
|
1517
1562
|
});
|
|
1518
1563
|
}
|
|
1519
|
-
for (const [
|
|
1520
|
-
const
|
|
1521
|
-
if (
|
|
1564
|
+
for (const [x, D] of v) {
|
|
1565
|
+
const k = Te(D.value), S = k.filter(([$]) => T.has($.split(".")[0])).map(([$]) => $);
|
|
1566
|
+
if (S.length && n({
|
|
1522
1567
|
severity: "warning",
|
|
1523
1568
|
code: "i18n.fileKey",
|
|
1524
|
-
message: `${
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1569
|
+
message: `${D.file.path}: nothing reads keys named after the bundle file — use module./entity./field./view. keys (${S.slice(0, 5).join(", ")}).`,
|
|
1570
|
+
messageKey: "devStudio.issue.fileKey",
|
|
1571
|
+
params: { path: D.file.path, keys: S.slice(0, 5).join(", ") },
|
|
1572
|
+
path: D.file.path
|
|
1573
|
+
}), x === "en")
|
|
1574
|
+
for (const [$, O] of k) {
|
|
1575
|
+
I.add($);
|
|
1576
|
+
const a = $.split(".")[0];
|
|
1530
1577
|
["module", "entity", "field", "view"].includes(a) && typeof O == "string" && ae(O) && n({
|
|
1531
1578
|
code: "i18n.polishInEnglish",
|
|
1532
|
-
message: `${
|
|
1533
|
-
|
|
1579
|
+
message: `${D.file.path}: ${$} = "${O}" — the English bundle is the English UI.`,
|
|
1580
|
+
messageKey: "devStudio.issue.polishInEnglish",
|
|
1581
|
+
params: { path: D.file.path, key: $, text: O },
|
|
1582
|
+
path: D.file.path
|
|
1534
1583
|
});
|
|
1535
1584
|
}
|
|
1536
1585
|
}
|
|
1537
1586
|
}
|
|
1538
1587
|
if (l.length && C.length) {
|
|
1539
|
-
const
|
|
1588
|
+
const v = [
|
|
1540
1589
|
"module.displayName",
|
|
1541
|
-
...
|
|
1542
|
-
...m.map((
|
|
1543
|
-
...b.map((
|
|
1590
|
+
...d.map((f) => `entity.${f}.displayName`),
|
|
1591
|
+
...m.map((f) => `${f}.displayName`),
|
|
1592
|
+
...b.map((f) => `view.${f}.displayName`)
|
|
1544
1593
|
].filter(
|
|
1545
|
-
(
|
|
1594
|
+
(f) => !I.has(f) && !(f.startsWith("field.") && I.has(`${f.slice(0, -12)}.label`))
|
|
1546
1595
|
);
|
|
1547
|
-
|
|
1596
|
+
v.length && n({
|
|
1548
1597
|
code: "i18n.labelMissing",
|
|
1549
|
-
message: `The English bundle has no label for ${
|
|
1598
|
+
message: `The English bundle has no label for ${v.length} name(s): ${v.slice(0, 10).join(", ")}`,
|
|
1599
|
+
messageKey: "devStudio.issue.labelMissing",
|
|
1600
|
+
params: { count: v.length, keys: v.slice(0, 10).join(", ") }
|
|
1550
1601
|
});
|
|
1551
1602
|
}
|
|
1552
|
-
for (const { file:
|
|
1603
|
+
for (const { file: c, value: v } of s)
|
|
1553
1604
|
ce(
|
|
1554
|
-
|
|
1605
|
+
v,
|
|
1555
1606
|
void 0,
|
|
1556
1607
|
"",
|
|
1557
|
-
(
|
|
1608
|
+
(f, E, A) => n({
|
|
1558
1609
|
code: "icons.emoji",
|
|
1559
|
-
message: `${
|
|
1560
|
-
|
|
1561
|
-
|
|
1610
|
+
message: `${E} = "${A}": icon fields take an Ntd* name and column headers are words, never emoji.`,
|
|
1611
|
+
messageKey: "devStudio.issue.iconsEmoji",
|
|
1612
|
+
params: { key: E, text: A },
|
|
1613
|
+
path: c.path,
|
|
1614
|
+
pointer: f
|
|
1562
1615
|
})
|
|
1563
1616
|
);
|
|
1564
1617
|
return o;
|
|
@@ -1568,10 +1621,10 @@ function ce(e, i, t, o) {
|
|
|
1568
1621
|
e.forEach((n, s) => ce(n, i, `${t}/${s}`, o));
|
|
1569
1622
|
return;
|
|
1570
1623
|
}
|
|
1571
|
-
if (
|
|
1624
|
+
if (K(e))
|
|
1572
1625
|
for (const [n, s] of Object.entries(e)) {
|
|
1573
1626
|
const r = `${t}/${n}`;
|
|
1574
|
-
if ((n === "icon" || n === "iconName" || n === "entityIcon" || n === "name" && i === "icon" || i === "cardIcon" || (n === "header" || n === "displayName" && i === "columns")) && typeof s == "string" &&
|
|
1627
|
+
if ((n === "icon" || n === "iconName" || n === "entityIcon" || n === "name" && i === "icon" || i === "cardIcon" || (n === "header" || n === "displayName" && i === "columns")) && typeof s == "string" && Kt(s) && o(r, n, s), n === "optionsJson" && typeof s == "string")
|
|
1575
1628
|
try {
|
|
1576
1629
|
ce(JSON.parse(s), "optionsJson", r, o);
|
|
1577
1630
|
} catch {
|
|
@@ -1579,7 +1632,7 @@ function ce(e, i, t, o) {
|
|
|
1579
1632
|
ce(s, n, r, o);
|
|
1580
1633
|
}
|
|
1581
1634
|
}
|
|
1582
|
-
function
|
|
1635
|
+
function Rt(e, i = {}) {
|
|
1583
1636
|
const t = [], o = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
1584
1637
|
for (const r of e)
|
|
1585
1638
|
for (const l of r.files) {
|
|
@@ -1591,14 +1644,14 @@ function Kt(e, i = {}) {
|
|
|
1591
1644
|
} catch {
|
|
1592
1645
|
continue;
|
|
1593
1646
|
}
|
|
1594
|
-
if (oe(l.path, ".manifest.json") &&
|
|
1595
|
-
const
|
|
1596
|
-
o.set(
|
|
1647
|
+
if (oe(l.path, ".manifest.json") && K(y) && typeof y.packageName == "string" && y.packageName) {
|
|
1648
|
+
const d = y.packageName.toLowerCase();
|
|
1649
|
+
o.set(d, [...o.get(d) ?? [], r.location]);
|
|
1597
1650
|
}
|
|
1598
1651
|
if (oe(l.path, ".entities.json") && r.group) {
|
|
1599
|
-
for (const
|
|
1600
|
-
if (
|
|
1601
|
-
const m = `${r.group}/${
|
|
1652
|
+
for (const d of Q(y, "entities"))
|
|
1653
|
+
if (K(d) && typeof d.name == "string" && d.name) {
|
|
1654
|
+
const m = `${r.group}/${d.name}`.toLowerCase(), b = n.get(m) ?? [];
|
|
1602
1655
|
b.includes(r.location) || n.set(m, [...b, r.location]);
|
|
1603
1656
|
}
|
|
1604
1657
|
}
|
|
@@ -1607,14 +1660,18 @@ function Kt(e, i = {}) {
|
|
|
1607
1660
|
l.length > 1 && t.push({
|
|
1608
1661
|
severity: "error",
|
|
1609
1662
|
code: "workspace.packageName",
|
|
1610
|
-
message: `Package name ${r} is declared by ${l.length} modules: ${l.join(", ")}
|
|
1663
|
+
message: `Package name ${r} is declared by ${l.length} modules: ${l.join(", ")}`,
|
|
1664
|
+
messageKey: "devStudio.issue.duplicatePackage",
|
|
1665
|
+
params: { name: r, count: l.length, modules: l.join(", ") }
|
|
1611
1666
|
});
|
|
1612
1667
|
const s = new Set([...i.knownDuplicates ?? []].map((r) => r.toLowerCase()));
|
|
1613
1668
|
for (const [r, l] of n)
|
|
1614
1669
|
l.length > 1 && !s.has(r) && t.push({
|
|
1615
1670
|
severity: "error",
|
|
1616
1671
|
code: "workspace.entityName",
|
|
1617
|
-
message: `Entity ${r} is declared by ${l.length} modules of the same group: ${l.join(", ")}
|
|
1672
|
+
message: `Entity ${r} is declared by ${l.length} modules of the same group: ${l.join(", ")}`,
|
|
1673
|
+
messageKey: "devStudio.issue.duplicateEntity",
|
|
1674
|
+
params: { name: r, count: l.length, modules: l.join(", ") }
|
|
1618
1675
|
});
|
|
1619
1676
|
return t;
|
|
1620
1677
|
}
|
|
@@ -1663,15 +1720,15 @@ function Vt(e, i) {
|
|
|
1663
1720
|
};
|
|
1664
1721
|
}
|
|
1665
1722
|
const $e = (e) => Object.fromEntries(Object.entries(e).filter(([, i]) => i !== void 0));
|
|
1666
|
-
function
|
|
1723
|
+
function xe(e, i) {
|
|
1667
1724
|
var l;
|
|
1668
1725
|
const t = ee(i) ? i : {}, o = (Array.isArray(t.modules) ? t.modules : []).filter(ee), s = JSON.stringify(Ue(t.tags) ?? []) === JSON.stringify(e.tags ?? []) ? t.tags : (l = e.tags) != null && l.length ? typeof t.tags == "string" ? e.tags.join(",") : e.tags : void 0, r = (y) => {
|
|
1669
|
-
const
|
|
1726
|
+
const d = o.find((m) => m.packageName === y.moduleId);
|
|
1670
1727
|
return $e({
|
|
1671
|
-
...
|
|
1728
|
+
...d,
|
|
1672
1729
|
packageName: y.moduleId,
|
|
1673
1730
|
// seed entries spell `required` out, also when it is false
|
|
1674
|
-
required: y.required === !0 ? !0 : !
|
|
1731
|
+
required: y.required === !0 ? !0 : !d || "required" in d ? !1 : void 0,
|
|
1675
1732
|
condition: y.condition || void 0,
|
|
1676
1733
|
description: y.description || void 0
|
|
1677
1734
|
});
|
|
@@ -1741,16 +1798,16 @@ function Ut(e) {
|
|
|
1741
1798
|
...typeof i.defaultLanguage == "string" ? { defaultLanguage: i.defaultLanguage } : {}
|
|
1742
1799
|
};
|
|
1743
1800
|
}
|
|
1744
|
-
const
|
|
1745
|
-
function
|
|
1801
|
+
const F = (...e) => e.filter(Boolean).join("/"), Wt = (e) => e.slice(0, Math.max(0, e.lastIndexOf("/"))), Gt = (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, _t = /* @__PURE__ */ new Set(["bin", "obj", "node_modules"]), ue = (e) => e.startsWith(".") || _t.has(e), Bt = /^wizard-templates-.+\.seed\.json$/i, zt = /^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})(\d{3})Z$/;
|
|
1802
|
+
function fe(e) {
|
|
1746
1803
|
const i = (t, o = 2) => String(t).padStart(o, "0");
|
|
1747
1804
|
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`;
|
|
1748
1805
|
}
|
|
1749
1806
|
function Jt(e) {
|
|
1750
|
-
const i =
|
|
1807
|
+
const i = zt.exec(e);
|
|
1751
1808
|
return i ? Date.UTC(+i[1], +i[2] - 1, +i[3], +i[4], +i[5], +i[6], +i[7]) : void 0;
|
|
1752
1809
|
}
|
|
1753
|
-
const Ht = (e, i) =>
|
|
1810
|
+
const Ht = (e, i) => F(Wt(e), ".revisions", `${Gt(e)}.${i}`), Zt = (e) => e.normalize("NFKD").replace(/[̀-ͯ]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "custom";
|
|
1754
1811
|
function ni(e) {
|
|
1755
1812
|
const { roots: i } = e, t = e.revisions !== !1, o = e.now ?? (() => /* @__PURE__ */ new Date()), n = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
1756
1813
|
let r = null;
|
|
@@ -1765,7 +1822,7 @@ function ni(e) {
|
|
|
1765
1822
|
throw new Error(`Workspace "${p.label}" is read-only`);
|
|
1766
1823
|
return p;
|
|
1767
1824
|
};
|
|
1768
|
-
async function
|
|
1825
|
+
async function d(a, p) {
|
|
1769
1826
|
const g = await a.read(p);
|
|
1770
1827
|
try {
|
|
1771
1828
|
const h = g ? _(g.text).value : void 0;
|
|
@@ -1774,129 +1831,129 @@ function ni(e) {
|
|
|
1774
1831
|
return {};
|
|
1775
1832
|
}
|
|
1776
1833
|
}
|
|
1777
|
-
function m(a, p, g, h,
|
|
1778
|
-
const
|
|
1834
|
+
function m(a, p, g, h, N) {
|
|
1835
|
+
const u = ie(h.packageName) ?? (p || a.id);
|
|
1779
1836
|
return {
|
|
1780
1837
|
workspaceId: a.id,
|
|
1781
|
-
id:
|
|
1838
|
+
id: u,
|
|
1782
1839
|
packageId: ie(h.category),
|
|
1783
|
-
label: ie(h.displayName) ??
|
|
1840
|
+
label: ie(h.displayName) ?? u,
|
|
1784
1841
|
description: ie(h.description),
|
|
1785
1842
|
version: ie(h.version),
|
|
1786
1843
|
location: p,
|
|
1787
1844
|
readOnly: a.readOnly,
|
|
1788
|
-
files:
|
|
1845
|
+
files: N,
|
|
1789
1846
|
search: `${p} ${g}`
|
|
1790
1847
|
};
|
|
1791
1848
|
}
|
|
1792
1849
|
async function b(a) {
|
|
1793
1850
|
const p = /* @__PURE__ */ new Map(), g = async (h) => {
|
|
1794
|
-
const
|
|
1795
|
-
if (
|
|
1796
|
-
const w =
|
|
1851
|
+
const N = await a.fs.list(h), u = N.filter((w) => w.kind === "file" && w.name.toLowerCase().endsWith(".manifest.json")).map((w) => w.name).sort()[0];
|
|
1852
|
+
if (u) {
|
|
1853
|
+
const w = N.filter((M) => M.kind === "file").map((M) => M.name), L = m(
|
|
1797
1854
|
a,
|
|
1798
1855
|
h,
|
|
1799
|
-
|
|
1800
|
-
await
|
|
1856
|
+
u,
|
|
1857
|
+
await d(a.fs, F(h, u)),
|
|
1801
1858
|
w
|
|
1802
1859
|
);
|
|
1803
|
-
p.has(
|
|
1860
|
+
p.has(L.id.toLowerCase()) || (p.set(L.id.toLowerCase(), { ref: L, dir: h }), s.set(`${a.id}:${L.id.toLowerCase()}`, h));
|
|
1804
1861
|
}
|
|
1805
|
-
for (const w of
|
|
1806
|
-
w.kind === "directory" && !
|
|
1862
|
+
for (const w of N)
|
|
1863
|
+
w.kind === "directory" && !ue(w.name) && !(h === "" && w.name === C(a)) && await g(F(h, w.name));
|
|
1807
1864
|
};
|
|
1808
1865
|
return await g(""), p;
|
|
1809
1866
|
}
|
|
1810
|
-
const C = (a) => a.templatesDir === !1 ? void 0 : a.templatesDir ?? "Templates",
|
|
1811
|
-
n.delete(a.id),
|
|
1812
|
-
},
|
|
1867
|
+
const C = (a) => a.templatesDir === !1 ? void 0 : a.templatesDir ?? "Templates", j = (a) => {
|
|
1868
|
+
n.delete(a.id), k.clear();
|
|
1869
|
+
}, T = (a) => {
|
|
1813
1870
|
let p = n.get(a.id);
|
|
1814
1871
|
return p || (p = b(a), n.set(a.id, p), p.catch(() => n.delete(a.id))), p;
|
|
1815
1872
|
};
|
|
1816
|
-
async function
|
|
1817
|
-
const p = l(a.workspaceId), g = await
|
|
1818
|
-
if (!
|
|
1873
|
+
async function I(a) {
|
|
1874
|
+
const p = l(a.workspaceId), g = await T(p), h = s.get(`${p.id}:${a.id.toLowerCase()}`), N = g.get(a.id.toLowerCase()) ?? (h === void 0 ? void 0 : [...g.values()].find((u) => u.dir === h));
|
|
1875
|
+
if (!N)
|
|
1819
1876
|
throw new Error(`Module "${a.id}" is not in "${p.label}"`);
|
|
1820
|
-
return { root: p, module:
|
|
1877
|
+
return { root: p, module: N };
|
|
1821
1878
|
}
|
|
1822
|
-
async function
|
|
1823
|
-
const g = [], h = async (
|
|
1824
|
-
const w = await a.list(
|
|
1825
|
-
if (!(
|
|
1826
|
-
for (const
|
|
1827
|
-
|
|
1879
|
+
async function c(a, p) {
|
|
1880
|
+
const g = [], h = async (N, u) => {
|
|
1881
|
+
const w = await a.list(F(p, N));
|
|
1882
|
+
if (!(u && w.some((L) => L.kind === "file" && L.name.toLowerCase().endsWith(".manifest.json"))))
|
|
1883
|
+
for (const L of w)
|
|
1884
|
+
L.kind === "file" ? g.push(F(N, L.name)) : ue(L.name) || await h(F(N, L.name), !0);
|
|
1828
1885
|
};
|
|
1829
1886
|
return await h("", !1), g.sort();
|
|
1830
1887
|
}
|
|
1831
|
-
async function
|
|
1888
|
+
async function v(a, p, g, h) {
|
|
1832
1889
|
t && await a.write(Ht(p, h), g);
|
|
1833
1890
|
}
|
|
1834
|
-
async function
|
|
1835
|
-
const g = [], h = async (
|
|
1836
|
-
const
|
|
1837
|
-
for (const w of
|
|
1891
|
+
async function f(a, p) {
|
|
1892
|
+
const g = [], h = async (N) => {
|
|
1893
|
+
const u = await a.list(F(p, N));
|
|
1894
|
+
for (const w of u)
|
|
1838
1895
|
if (w.kind === "directory" && w.name === ".revisions")
|
|
1839
|
-
for (const
|
|
1840
|
-
const
|
|
1841
|
-
|
|
1842
|
-
path:
|
|
1843
|
-
stamp:
|
|
1844
|
-
at:
|
|
1896
|
+
for (const L of await a.list(F(p, N, w.name))) {
|
|
1897
|
+
const M = /^(.*)\.(\d{8}T\d{9}Z)$/.exec(L.name);
|
|
1898
|
+
L.kind === "file" && M && g.push({
|
|
1899
|
+
path: F(N, M[1]),
|
|
1900
|
+
stamp: M[2],
|
|
1901
|
+
at: F(N, ".revisions", L.name)
|
|
1845
1902
|
});
|
|
1846
1903
|
}
|
|
1847
|
-
else w.kind === "directory" && !
|
|
1904
|
+
else w.kind === "directory" && !ue(w.name) && await h(F(N, w.name));
|
|
1848
1905
|
};
|
|
1849
1906
|
return await h(""), g;
|
|
1850
1907
|
}
|
|
1851
|
-
async function
|
|
1908
|
+
async function E(a) {
|
|
1852
1909
|
const p = C(a);
|
|
1853
|
-
return p ? (await a.fs.list(p)).filter((g) => g.kind === "file" &&
|
|
1910
|
+
return p ? (await a.fs.list(p)).filter((g) => g.kind === "file" && Bt.test(g.name)).map((g) => F(p, g.name)).sort() : [];
|
|
1854
1911
|
}
|
|
1855
|
-
async function
|
|
1912
|
+
async function A(a, p) {
|
|
1856
1913
|
const g = await a.fs.read(p);
|
|
1857
1914
|
if (!g)
|
|
1858
1915
|
return { text: "", entries: [] };
|
|
1859
1916
|
const h = _(g.text).value;
|
|
1860
1917
|
return { text: g.text, entries: Array.isArray(h) ? h : [] };
|
|
1861
1918
|
}
|
|
1862
|
-
const
|
|
1919
|
+
const x = {
|
|
1863
1920
|
arrayKey: (a) => a === "" ? "slug" : a.endsWith("/modules") ? "packageName" : void 0
|
|
1864
1921
|
};
|
|
1865
|
-
async function
|
|
1866
|
-
if (g && await
|
|
1922
|
+
async function D(a, p, g, h) {
|
|
1923
|
+
if (g && await v(a.fs, p, g, fe(o())), h.length === 0) {
|
|
1867
1924
|
await a.fs.remove(p);
|
|
1868
1925
|
return;
|
|
1869
1926
|
}
|
|
1870
1927
|
await a.fs.write(
|
|
1871
1928
|
p,
|
|
1872
|
-
g ?
|
|
1929
|
+
g ? Me(g, h, x) : de(h)
|
|
1873
1930
|
);
|
|
1874
1931
|
}
|
|
1875
|
-
const
|
|
1876
|
-
function
|
|
1932
|
+
const k = /* @__PURE__ */ new Map();
|
|
1933
|
+
function S(a, p) {
|
|
1877
1934
|
const g = `${a.id}:${p.dir}`;
|
|
1878
|
-
let h =
|
|
1935
|
+
let h = k.get(g);
|
|
1879
1936
|
if (!h) {
|
|
1880
|
-
const
|
|
1937
|
+
const N = (p.ref.files ?? []).filter((u) => /\.(manifest|entities)\.json$/i.test(u));
|
|
1881
1938
|
h = Promise.all(
|
|
1882
|
-
|
|
1939
|
+
N.map(async (u) => {
|
|
1883
1940
|
var w;
|
|
1884
1941
|
return {
|
|
1885
|
-
path:
|
|
1886
|
-
text: ((w = await a.fs.read(
|
|
1942
|
+
path: u,
|
|
1943
|
+
text: ((w = await a.fs.read(F(p.dir, u))) == null ? void 0 : w.text) ?? ""
|
|
1887
1944
|
};
|
|
1888
1945
|
})
|
|
1889
|
-
).then((
|
|
1946
|
+
).then((u) => ({ location: p.dir, group: p.dir.split("/")[0], files: u })), k.set(g, h);
|
|
1890
1947
|
}
|
|
1891
1948
|
return h;
|
|
1892
1949
|
}
|
|
1893
|
-
async function
|
|
1950
|
+
async function $(a) {
|
|
1894
1951
|
var p;
|
|
1895
1952
|
return r || await ((p = O.listTemplates) == null ? void 0 : p.call(O)), r == null ? void 0 : r.get(a.toLowerCase());
|
|
1896
1953
|
}
|
|
1897
1954
|
const O = {
|
|
1898
1955
|
invalidate() {
|
|
1899
|
-
n.clear(),
|
|
1956
|
+
n.clear(), k.clear(), r = null;
|
|
1900
1957
|
},
|
|
1901
1958
|
async listWorkspaces() {
|
|
1902
1959
|
return i.map((a) => ({
|
|
@@ -1908,172 +1965,172 @@ function ni(e) {
|
|
|
1908
1965
|
}));
|
|
1909
1966
|
},
|
|
1910
1967
|
async listModules(a) {
|
|
1911
|
-
const p = i.findIndex((
|
|
1912
|
-
|
|
1913
|
-
const h = await
|
|
1914
|
-
i.slice(0, p).map(async (
|
|
1968
|
+
const p = i.findIndex((u) => u.id === a), g = l(a);
|
|
1969
|
+
j(g);
|
|
1970
|
+
const h = await T(g), N = await Promise.all(
|
|
1971
|
+
i.slice(0, p).map(async (u) => ({ r: u, modules: await T(u) }))
|
|
1915
1972
|
);
|
|
1916
|
-
return [...h.values()].map(({ ref:
|
|
1917
|
-
const w =
|
|
1918
|
-
return w ? { ...
|
|
1919
|
-
}).sort((
|
|
1973
|
+
return [...h.values()].map(({ ref: u }) => {
|
|
1974
|
+
const w = N.find((L) => L.modules.has(u.id.toLowerCase()));
|
|
1975
|
+
return w ? { ...u, shadowedBy: w.r.id } : u;
|
|
1976
|
+
}).sort((u, w) => u.id.localeCompare(w.id));
|
|
1920
1977
|
},
|
|
1921
1978
|
async readModule(a) {
|
|
1922
|
-
const { root: p, module: g } = await
|
|
1923
|
-
for (const
|
|
1924
|
-
const w = await p.fs.read(
|
|
1925
|
-
w &&
|
|
1926
|
-
path:
|
|
1979
|
+
const { root: p, module: g } = await I(a), h = await c(p.fs, g.dir), N = [];
|
|
1980
|
+
for (const u of h) {
|
|
1981
|
+
const w = await p.fs.read(F(g.dir, u));
|
|
1982
|
+
w && N.push({
|
|
1983
|
+
path: u,
|
|
1927
1984
|
text: w.text,
|
|
1928
1985
|
version: w.version,
|
|
1929
1986
|
...p.readOnly ? { readOnly: !0 } : {}
|
|
1930
1987
|
});
|
|
1931
1988
|
}
|
|
1932
|
-
return
|
|
1989
|
+
return N;
|
|
1933
1990
|
},
|
|
1934
1991
|
async writeModule(a, p) {
|
|
1935
|
-
const { module: g } = await
|
|
1936
|
-
for (const
|
|
1937
|
-
if (
|
|
1938
|
-
throw new Error(`Refusing to write outside the module: ${
|
|
1939
|
-
const
|
|
1940
|
-
|
|
1941
|
-
const
|
|
1942
|
-
(
|
|
1992
|
+
const { module: g } = await I(a), h = y(a.workspaceId), N = /* @__PURE__ */ new Map(), u = [];
|
|
1993
|
+
for (const M of p) {
|
|
1994
|
+
if (M.path.split("/").some((Z) => Z === ".." || Z === "" || Z.startsWith(".")))
|
|
1995
|
+
throw new Error(`Refusing to write outside the module: ${M.path}`);
|
|
1996
|
+
const R = await h.fs.read(F(g.dir, M.path));
|
|
1997
|
+
N.set(M.path, R);
|
|
1998
|
+
const B = M.baseVersion;
|
|
1999
|
+
(B === void 0 ? R !== null && M.type === "write" : (R == null ? void 0 : R.version) !== B) && u.push({ path: M.path, ...R ? { currentVersion: R.version } : {} });
|
|
1943
2000
|
}
|
|
1944
|
-
if (
|
|
1945
|
-
return { ok: !1, conflicts:
|
|
1946
|
-
const w =
|
|
1947
|
-
for (const
|
|
1948
|
-
const
|
|
1949
|
-
|
|
2001
|
+
if (u.length)
|
|
2002
|
+
return { ok: !1, conflicts: u };
|
|
2003
|
+
const w = fe(o()), L = {};
|
|
2004
|
+
for (const M of p) {
|
|
2005
|
+
const R = F(g.dir, M.path), B = N.get(M.path);
|
|
2006
|
+
B && await v(h.fs, R, B.text, w), M.type === "write" ? L[M.path] = await h.fs.write(R, M.text) : await h.fs.remove(R);
|
|
1950
2007
|
}
|
|
1951
|
-
return
|
|
2008
|
+
return j(h), { ok: !0, versions: L, revision: w };
|
|
1952
2009
|
},
|
|
1953
2010
|
async createModule(a) {
|
|
1954
|
-
var
|
|
1955
|
-
const p = y(a.workspaceId), g = a.id.startsWith(W) ? a.id.slice(W.length) : a.id.split(".").pop() ?? a.id, h = ((
|
|
1956
|
-
|
|
1957
|
-
|
|
2011
|
+
var u;
|
|
2012
|
+
const p = y(a.workspaceId), g = a.id.startsWith(W) ? a.id.slice(W.length) : a.id.split(".").pop() ?? a.id, h = ((u = e.moduleFolder) == null ? void 0 : u.call(e, a)) ?? F(
|
|
2013
|
+
P(a.packageId ?? "") || "Custom",
|
|
2014
|
+
P(g) || "Module"
|
|
1958
2015
|
);
|
|
1959
2016
|
if ((await p.fs.list(h)).length > 0)
|
|
1960
2017
|
throw new Error(`The folder ${h} is not empty`);
|
|
1961
|
-
if ((await
|
|
2018
|
+
if ((await T(p)).has(a.id.toLowerCase()))
|
|
1962
2019
|
throw new Error(`"${a.id}" already exists in ${p.label}`);
|
|
1963
2020
|
for (const w of a.files)
|
|
1964
|
-
await p.fs.write(
|
|
1965
|
-
|
|
1966
|
-
const
|
|
1967
|
-
if (!
|
|
2021
|
+
await p.fs.write(F(h, w.path), w.text);
|
|
2022
|
+
j(p);
|
|
2023
|
+
const N = (await T(p)).get(a.id.toLowerCase());
|
|
2024
|
+
if (!N)
|
|
1968
2025
|
throw new Error(`The new module ${a.id} has no manifest naming it`);
|
|
1969
|
-
return
|
|
2026
|
+
return N.ref;
|
|
1970
2027
|
},
|
|
1971
2028
|
async deleteModule(a) {
|
|
1972
|
-
const { module: p } = await
|
|
1973
|
-
await g.fs.removeDir(p.dir), s.delete(`${g.id}:${a.id.toLowerCase()}`),
|
|
2029
|
+
const { module: p } = await I(a), g = y(a.workspaceId);
|
|
2030
|
+
await g.fs.removeDir(p.dir), s.delete(`${g.id}:${a.id.toLowerCase()}`), j(g);
|
|
1974
2031
|
},
|
|
1975
2032
|
async listTemplates() {
|
|
1976
2033
|
const a = /* @__PURE__ */ new Map(), p = [];
|
|
1977
2034
|
for (const g of i)
|
|
1978
|
-
for (const h of await
|
|
1979
|
-
let
|
|
2035
|
+
for (const h of await E(g)) {
|
|
2036
|
+
let N;
|
|
1980
2037
|
try {
|
|
1981
|
-
|
|
2038
|
+
N = (await A(g, h)).entries;
|
|
1982
2039
|
} catch {
|
|
1983
2040
|
continue;
|
|
1984
2041
|
}
|
|
1985
|
-
for (const
|
|
1986
|
-
const w = Vt(
|
|
2042
|
+
for (const u of N) {
|
|
2043
|
+
const w = Vt(u, g.readOnly);
|
|
1987
2044
|
w.id && !a.has(w.id.toLowerCase()) && (a.set(w.id.toLowerCase(), { rootId: g.id, path: h }), p.push(w));
|
|
1988
2045
|
}
|
|
1989
2046
|
}
|
|
1990
2047
|
return r = a, p;
|
|
1991
2048
|
},
|
|
1992
2049
|
async saveTemplate(a, p) {
|
|
1993
|
-
const g = (p == null ? void 0 : p.previousId) ?? a.id, h = await
|
|
2050
|
+
const g = (p == null ? void 0 : p.previousId) ?? a.id, h = await $(g);
|
|
1994
2051
|
if (h) {
|
|
1995
|
-
const
|
|
1996
|
-
(
|
|
1997
|
-
),
|
|
1998
|
-
|
|
2052
|
+
const N = y(h.rootId), { text: u, entries: w } = await A(N, h.path), L = w.findIndex(
|
|
2053
|
+
(R) => me(R) && String(R.slug ?? "").toLowerCase() === g.toLowerCase()
|
|
2054
|
+
), M = [...w];
|
|
2055
|
+
M[L < 0 ? M.length : L] = xe(
|
|
1999
2056
|
a,
|
|
2000
|
-
|
|
2001
|
-
), await
|
|
2057
|
+
L < 0 ? void 0 : w[L]
|
|
2058
|
+
), await D(N, h.path, u, M);
|
|
2002
2059
|
} else {
|
|
2003
|
-
const
|
|
2004
|
-
if (!
|
|
2060
|
+
const N = i.find((M) => !M.readOnly && C(M));
|
|
2061
|
+
if (!N)
|
|
2005
2062
|
throw new Error("No writable folder holds templates");
|
|
2006
|
-
const
|
|
2007
|
-
C(
|
|
2063
|
+
const u = F(
|
|
2064
|
+
C(N),
|
|
2008
2065
|
`wizard-templates-${Zt(a.category ?? "custom")}.seed.json`
|
|
2009
|
-
), { text: w, entries:
|
|
2010
|
-
await
|
|
2066
|
+
), { text: w, entries: L } = await A(N, u);
|
|
2067
|
+
await D(N, u, w, [...L, xe(a)]);
|
|
2011
2068
|
}
|
|
2012
2069
|
return r = null, { ...a, extra: a.extra };
|
|
2013
2070
|
},
|
|
2014
2071
|
async deleteTemplate(a) {
|
|
2015
|
-
const p = await
|
|
2072
|
+
const p = await $(a);
|
|
2016
2073
|
if (!p)
|
|
2017
2074
|
return;
|
|
2018
|
-
const g = y(p.rootId), { text: h, entries:
|
|
2019
|
-
await
|
|
2075
|
+
const g = y(p.rootId), { text: h, entries: N } = await A(g, p.path);
|
|
2076
|
+
await D(
|
|
2020
2077
|
g,
|
|
2021
2078
|
p.path,
|
|
2022
2079
|
h,
|
|
2023
|
-
|
|
2024
|
-
(
|
|
2080
|
+
N.filter(
|
|
2081
|
+
(u) => !(me(u) && String(u.slug ?? "").toLowerCase() === a.toLowerCase())
|
|
2025
2082
|
)
|
|
2026
2083
|
), r = null;
|
|
2027
2084
|
},
|
|
2028
2085
|
async validate(a, p) {
|
|
2029
|
-
const g = l(a.workspaceId), h = [...(await
|
|
2030
|
-
h.filter((
|
|
2031
|
-
),
|
|
2032
|
-
return
|
|
2033
|
-
[...
|
|
2086
|
+
const g = l(a.workspaceId), h = [...(await T(g)).values()], N = await Promise.all(
|
|
2087
|
+
h.filter((L) => L.ref.id.toLowerCase() !== a.id.toLowerCase()).map((L) => S(g, L))
|
|
2088
|
+
), u = h.find((L) => L.ref.id.toLowerCase() === a.id.toLowerCase()), w = (u == null ? void 0 : u.dir) ?? a.id;
|
|
2089
|
+
return Rt(
|
|
2090
|
+
[...N, { location: w, group: w.split("/")[0], files: p }],
|
|
2034
2091
|
{
|
|
2035
2092
|
knownDuplicates: e.knownDuplicates
|
|
2036
2093
|
}
|
|
2037
|
-
).filter((
|
|
2094
|
+
).filter((L) => L.message.split(/[ ,]+/).includes(w));
|
|
2038
2095
|
},
|
|
2039
2096
|
async listRevisions(a, p) {
|
|
2040
|
-
const { root: g, module: h } = await
|
|
2097
|
+
const { root: g, module: h } = await I(a), N = (await f(g.fs, h.dir)).filter(
|
|
2041
2098
|
(w) => !p || w.path === p
|
|
2042
|
-
),
|
|
2043
|
-
for (const w of
|
|
2044
|
-
|
|
2045
|
-
return [...
|
|
2099
|
+
), u = /* @__PURE__ */ new Map();
|
|
2100
|
+
for (const w of N)
|
|
2101
|
+
u.set(w.stamp, [...u.get(w.stamp) ?? [], w.path]);
|
|
2102
|
+
return [...u].map(([w, L]) => ({
|
|
2046
2103
|
id: w,
|
|
2047
2104
|
timestamp: Jt(w) ?? 0,
|
|
2048
|
-
summary:
|
|
2105
|
+
summary: L.sort().join(", "),
|
|
2049
2106
|
...p ? { path: p } : {}
|
|
2050
|
-
})).sort((w,
|
|
2107
|
+
})).sort((w, L) => L.timestamp - w.timestamp);
|
|
2051
2108
|
},
|
|
2052
2109
|
async readRevision(a, p, g) {
|
|
2053
|
-
var
|
|
2054
|
-
const { root: h, module:
|
|
2055
|
-
(
|
|
2110
|
+
var L;
|
|
2111
|
+
const { root: h, module: N } = await I(a), u = (await f(h.fs, N.dir)).filter(
|
|
2112
|
+
(M) => M.stamp === p && (!g || M.path === g)
|
|
2056
2113
|
);
|
|
2057
|
-
if (
|
|
2114
|
+
if (u.length === 0)
|
|
2058
2115
|
throw new Error(`Unknown revision "${p}"`);
|
|
2059
2116
|
const w = {};
|
|
2060
|
-
for (const
|
|
2061
|
-
w[
|
|
2117
|
+
for (const M of u)
|
|
2118
|
+
w[M.path] = ((L = await h.fs.read(F(N.dir, M.at))) == null ? void 0 : L.text) ?? "";
|
|
2062
2119
|
return g ? w[g] : JSON.stringify(w, null, 2);
|
|
2063
2120
|
},
|
|
2064
2121
|
async rollback(a, p, g) {
|
|
2065
|
-
var
|
|
2066
|
-
const { module: h } = await
|
|
2067
|
-
(
|
|
2122
|
+
var L;
|
|
2123
|
+
const { module: h } = await I(a), N = y(a.workspaceId), u = (await f(N.fs, h.dir)).filter(
|
|
2124
|
+
(M) => M.stamp === p && (!g || M.path === g)
|
|
2068
2125
|
);
|
|
2069
|
-
if (
|
|
2126
|
+
if (u.length === 0)
|
|
2070
2127
|
throw new Error(`Unknown revision "${p}"`);
|
|
2071
|
-
const w =
|
|
2072
|
-
for (const
|
|
2073
|
-
const
|
|
2074
|
-
Z && await
|
|
2128
|
+
const w = fe(o());
|
|
2129
|
+
for (const M of u) {
|
|
2130
|
+
const R = F(h.dir, M.path), B = ((L = await N.fs.read(F(h.dir, M.at))) == null ? void 0 : L.text) ?? "", Z = await N.fs.read(R);
|
|
2131
|
+
Z && await v(N.fs, R, Z.text, w), await N.fs.write(R, B);
|
|
2075
2132
|
}
|
|
2076
|
-
|
|
2133
|
+
j(N);
|
|
2077
2134
|
}
|
|
2078
2135
|
};
|
|
2079
2136
|
return O;
|
|
@@ -2104,41 +2161,41 @@ function Qt(e) {
|
|
|
2104
2161
|
return `${e.length}:${(i >>> 0).toString(16)}`;
|
|
2105
2162
|
}
|
|
2106
2163
|
function si(e = {}) {
|
|
2107
|
-
const i = (e.baseUrl ?? "/api").replace(/\/+$/, ""), t = e.fetch ?? ((
|
|
2108
|
-
async function s(
|
|
2109
|
-
const
|
|
2110
|
-
method:
|
|
2164
|
+
const i = (e.baseUrl ?? "/api").replace(/\/+$/, ""), t = e.fetch ?? ((d, m) => globalThis.fetch(d, m)), o = e.language ?? "en", n = encodeURIComponent;
|
|
2165
|
+
async function s(d, m, b, C = "json") {
|
|
2166
|
+
const j = typeof e.headers == "function" ? await e.headers() : e.headers ?? {}, T = await t(`${i}${m}`, {
|
|
2167
|
+
method: d,
|
|
2111
2168
|
credentials: e.credentials ?? "same-origin",
|
|
2112
2169
|
headers: {
|
|
2113
2170
|
Accept: C === "json" ? "application/json" : "text/plain, application/json",
|
|
2114
2171
|
...b === void 0 ? {} : { "Content-Type": "application/json" },
|
|
2115
|
-
...
|
|
2172
|
+
...j
|
|
2116
2173
|
},
|
|
2117
2174
|
...b === void 0 ? {} : { body: JSON.stringify(b) }
|
|
2118
|
-
}),
|
|
2119
|
-
let
|
|
2120
|
-
if (C === "json" || !
|
|
2175
|
+
}), I = await T.text();
|
|
2176
|
+
let c = I;
|
|
2177
|
+
if (C === "json" || !T.ok)
|
|
2121
2178
|
try {
|
|
2122
|
-
|
|
2179
|
+
c = I ? JSON.parse(I) : void 0;
|
|
2123
2180
|
} catch {
|
|
2124
|
-
|
|
2181
|
+
c = I;
|
|
2125
2182
|
}
|
|
2126
|
-
if (!
|
|
2183
|
+
if (!T.ok)
|
|
2127
2184
|
throw new ye(
|
|
2128
|
-
`${
|
|
2129
|
-
|
|
2130
|
-
|
|
2185
|
+
`${d} ${m}: ${T.status} ${T.statusText}`,
|
|
2186
|
+
T.status,
|
|
2187
|
+
c
|
|
2131
2188
|
);
|
|
2132
|
-
return
|
|
2189
|
+
return c;
|
|
2133
2190
|
}
|
|
2134
2191
|
const r = e.templates === !1 ? {} : {
|
|
2135
2192
|
async listTemplates() {
|
|
2136
|
-
const
|
|
2193
|
+
const d = await s(
|
|
2137
2194
|
"GET",
|
|
2138
2195
|
`/module-templates?lang=${n(o)}&hidden=true`
|
|
2139
2196
|
);
|
|
2140
2197
|
return (await Promise.all(
|
|
2141
|
-
(
|
|
2198
|
+
(d ?? []).map(
|
|
2142
2199
|
(b) => s(
|
|
2143
2200
|
"GET",
|
|
2144
2201
|
`/module-templates/${n(b.slug)}?lang=${n(o)}`
|
|
@@ -2146,131 +2203,135 @@ function si(e = {}) {
|
|
|
2146
2203
|
)
|
|
2147
2204
|
)).map((b) => Ie(b, o));
|
|
2148
2205
|
},
|
|
2149
|
-
async saveTemplate(
|
|
2150
|
-
const b = (m == null ? void 0 : m.previousId) ??
|
|
2151
|
-
let
|
|
2206
|
+
async saveTemplate(d, m) {
|
|
2207
|
+
const b = (m == null ? void 0 : m.previousId) ?? d.id, C = Ut(d);
|
|
2208
|
+
let j;
|
|
2152
2209
|
if ((m == null ? void 0 : m.previousId) === void 0)
|
|
2153
|
-
|
|
2210
|
+
j = await s(
|
|
2154
2211
|
"GET",
|
|
2155
|
-
`/module-templates/${n(
|
|
2212
|
+
`/module-templates/${n(d.id)}?lang=${n(o)}`
|
|
2156
2213
|
).then(
|
|
2157
2214
|
() => !0,
|
|
2158
|
-
(
|
|
2215
|
+
(I) => I instanceof ye && I.status === 404 ? !1 : Promise.reject(I)
|
|
2159
2216
|
) ? await s(
|
|
2160
2217
|
"PUT",
|
|
2161
|
-
`/module-templates/${n(
|
|
2218
|
+
`/module-templates/${n(d.id)}?lang=${n(o)}`,
|
|
2162
2219
|
C
|
|
2163
2220
|
) : await s("POST", `/module-templates?lang=${n(o)}`, C);
|
|
2164
2221
|
else {
|
|
2165
|
-
if (b !==
|
|
2222
|
+
if (b !== d.id)
|
|
2166
2223
|
throw new Error(
|
|
2167
2224
|
"The OmniVerk API keeps a template's slug: save it as a new template instead."
|
|
2168
2225
|
);
|
|
2169
|
-
|
|
2226
|
+
j = await s(
|
|
2170
2227
|
"PUT",
|
|
2171
2228
|
`/module-templates/${n(b)}?lang=${n(o)}`,
|
|
2172
2229
|
C
|
|
2173
2230
|
);
|
|
2174
2231
|
}
|
|
2175
|
-
return Ie(
|
|
2232
|
+
return Ie(j, o);
|
|
2176
2233
|
},
|
|
2177
|
-
async deleteTemplate(
|
|
2178
|
-
await s("DELETE", `/module-templates/${n(
|
|
2234
|
+
async deleteTemplate(d) {
|
|
2235
|
+
await s("DELETE", `/module-templates/${n(d)}`);
|
|
2179
2236
|
}
|
|
2180
2237
|
};
|
|
2181
2238
|
if ((e.mode ?? "manifest-only") === "manifest-only") {
|
|
2182
|
-
const
|
|
2183
|
-
var
|
|
2184
|
-
return ((
|
|
2185
|
-
}, C = async (
|
|
2186
|
-
const
|
|
2187
|
-
return { path: b(
|
|
2239
|
+
const d = "seed", m = /* @__PURE__ */ new Map(), b = (j) => {
|
|
2240
|
+
var T, I;
|
|
2241
|
+
return ((T = m.get(j)) == null ? void 0 : T.manifestFile) ?? `${(I = j.split(".").pop()) == null ? void 0 : I.toLowerCase()}.manifest.json`;
|
|
2242
|
+
}, C = async (j) => {
|
|
2243
|
+
const T = await s("GET", `/module-manifests/${n(j)}`), I = de(T, { finalNewline: !1 });
|
|
2244
|
+
return { path: b(j), text: I, version: Qt(I) };
|
|
2188
2245
|
};
|
|
2189
2246
|
return {
|
|
2190
2247
|
async listWorkspaces() {
|
|
2191
|
-
return [{ id:
|
|
2248
|
+
return [{ id: d, label: e.workspaceLabel ?? "Seed/Modules" }];
|
|
2192
2249
|
},
|
|
2193
2250
|
async listModules() {
|
|
2194
|
-
const
|
|
2195
|
-
return m.clear(), (
|
|
2196
|
-
workspaceId:
|
|
2197
|
-
id:
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2251
|
+
const j = await s("GET", "/module-manifests");
|
|
2252
|
+
return m.clear(), (j ?? []).map((T) => (m.set(T.packageName, T), {
|
|
2253
|
+
workspaceId: d,
|
|
2254
|
+
id: T.packageName,
|
|
2255
|
+
// the package is the manifest's category, as in the `files` mode and OmniVerk's own
|
|
2256
|
+
// trees (1.3.14); the first folder only while the API does not list the category
|
|
2257
|
+
packageId: T.category || T.path.split("/")[0] || void 0,
|
|
2258
|
+
label: T.packageName,
|
|
2259
|
+
location: T.path,
|
|
2260
|
+
files: [T.manifestFile],
|
|
2261
|
+
search: T.path,
|
|
2262
|
+
// only the manifest: the checks and the preview do not count what is not given
|
|
2263
|
+
contents: "manifest"
|
|
2203
2264
|
}));
|
|
2204
2265
|
},
|
|
2205
|
-
async readModule(
|
|
2206
|
-
return [await C(
|
|
2266
|
+
async readModule(j) {
|
|
2267
|
+
return [await C(j.id)];
|
|
2207
2268
|
},
|
|
2208
|
-
async writeModule(
|
|
2209
|
-
const
|
|
2210
|
-
if (
|
|
2269
|
+
async writeModule(j, T) {
|
|
2270
|
+
const I = b(j.id), c = T.find((x) => x.path !== I || x.type !== "write");
|
|
2271
|
+
if (c)
|
|
2211
2272
|
throw new Error(
|
|
2212
|
-
`This OmniVerk API stores only the manifest; "${
|
|
2273
|
+
`This OmniVerk API stores only the manifest; "${c.path}" was not saved.`
|
|
2213
2274
|
);
|
|
2214
|
-
const
|
|
2215
|
-
if (
|
|
2275
|
+
const v = T[0];
|
|
2276
|
+
if (!v || v.type !== "write")
|
|
2216
2277
|
return { ok: !0, versions: {} };
|
|
2217
|
-
const
|
|
2218
|
-
if (
|
|
2219
|
-
return { ok: !1, conflicts: [{ path:
|
|
2220
|
-
const
|
|
2278
|
+
const f = await C(j.id);
|
|
2279
|
+
if (v.baseVersion !== void 0 && v.baseVersion !== f.version)
|
|
2280
|
+
return { ok: !1, conflicts: [{ path: I, currentVersion: f.version }] };
|
|
2281
|
+
const E = await s(
|
|
2221
2282
|
"PUT",
|
|
2222
|
-
`/module-manifests/${n(
|
|
2283
|
+
`/module-manifests/${n(j.id)}`,
|
|
2223
2284
|
{
|
|
2224
|
-
manifest: _(
|
|
2285
|
+
manifest: _(v.text).value
|
|
2225
2286
|
}
|
|
2226
|
-
),
|
|
2287
|
+
), A = await C(j.id);
|
|
2227
2288
|
return {
|
|
2228
2289
|
ok: !0,
|
|
2229
|
-
versions: { [
|
|
2230
|
-
...
|
|
2290
|
+
versions: { [I]: A.version },
|
|
2291
|
+
...E != null && E.revision ? { revision: E.revision } : {}
|
|
2231
2292
|
};
|
|
2232
2293
|
},
|
|
2233
|
-
async listRevisions(
|
|
2294
|
+
async listRevisions(j) {
|
|
2234
2295
|
return (await s(
|
|
2235
2296
|
"GET",
|
|
2236
|
-
`/module-manifests/${n(
|
|
2237
|
-
) ?? []).map((
|
|
2238
|
-
id:
|
|
2239
|
-
timestamp: Date.parse(
|
|
2240
|
-
path: b(
|
|
2241
|
-
...
|
|
2297
|
+
`/module-manifests/${n(j.id)}/revisions`
|
|
2298
|
+
) ?? []).map((I) => ({
|
|
2299
|
+
id: I.id,
|
|
2300
|
+
timestamp: Date.parse(I.at) || 0,
|
|
2301
|
+
path: b(j.id),
|
|
2302
|
+
...I.sizeBytes !== void 0 ? { summary: `${I.sizeBytes} B` } : {}
|
|
2242
2303
|
}));
|
|
2243
2304
|
},
|
|
2244
|
-
async readRevision(
|
|
2305
|
+
async readRevision(j, T) {
|
|
2245
2306
|
return s(
|
|
2246
2307
|
"GET",
|
|
2247
|
-
`/module-manifests/${n(
|
|
2308
|
+
`/module-manifests/${n(j.id)}/revisions/${n(T)}`,
|
|
2248
2309
|
void 0,
|
|
2249
2310
|
"text"
|
|
2250
2311
|
);
|
|
2251
2312
|
},
|
|
2252
|
-
async rollback(
|
|
2313
|
+
async rollback(j, T) {
|
|
2253
2314
|
await s(
|
|
2254
2315
|
"POST",
|
|
2255
|
-
`/module-manifests/${n(
|
|
2316
|
+
`/module-manifests/${n(j.id)}/revisions/${n(T)}/rollback`
|
|
2256
2317
|
);
|
|
2257
2318
|
},
|
|
2258
2319
|
...r
|
|
2259
2320
|
};
|
|
2260
2321
|
}
|
|
2261
|
-
const l = (
|
|
2322
|
+
const l = (d) => `/module-files/${n(d.workspaceId)}/modules/${n(d.id)}`, y = (d) => d.map((m) => ({ path: m.path, content: Ce(m.text) }));
|
|
2262
2323
|
return {
|
|
2263
2324
|
async listWorkspaces() {
|
|
2264
2325
|
return s("GET", "/module-files/workspaces");
|
|
2265
2326
|
},
|
|
2266
|
-
async listModules(
|
|
2327
|
+
async listModules(d) {
|
|
2267
2328
|
return (await s(
|
|
2268
2329
|
"GET",
|
|
2269
|
-
`/module-files/${n(
|
|
2270
|
-
) ?? []).map((b) => ({ ...b, workspaceId:
|
|
2330
|
+
`/module-files/${n(d)}/modules`
|
|
2331
|
+
) ?? []).map((b) => ({ ...b, workspaceId: d }));
|
|
2271
2332
|
},
|
|
2272
|
-
async readModule(
|
|
2273
|
-
const m = await s("GET", l(
|
|
2333
|
+
async readModule(d) {
|
|
2334
|
+
const m = await s("GET", l(d));
|
|
2274
2335
|
return ((m == null ? void 0 : m.files) ?? []).map((b) => ({
|
|
2275
2336
|
path: b.path,
|
|
2276
2337
|
text: Xt(b.content),
|
|
@@ -2278,20 +2339,20 @@ function si(e = {}) {
|
|
|
2278
2339
|
...b.readOnly ? { readOnly: !0 } : {}
|
|
2279
2340
|
}));
|
|
2280
2341
|
},
|
|
2281
|
-
async writeModule(
|
|
2342
|
+
async writeModule(d, m) {
|
|
2282
2343
|
var b;
|
|
2283
2344
|
try {
|
|
2284
2345
|
const C = await s(
|
|
2285
2346
|
"PUT",
|
|
2286
|
-
l(
|
|
2347
|
+
l(d),
|
|
2287
2348
|
{
|
|
2288
2349
|
changes: m.map(
|
|
2289
|
-
(
|
|
2350
|
+
(j) => j.type === "write" ? {
|
|
2290
2351
|
type: "write",
|
|
2291
|
-
path:
|
|
2292
|
-
content: Ce(
|
|
2293
|
-
baseVersion:
|
|
2294
|
-
} : { type: "delete", path:
|
|
2352
|
+
path: j.path,
|
|
2353
|
+
content: Ce(j.text),
|
|
2354
|
+
baseVersion: j.baseVersion
|
|
2355
|
+
} : { type: "delete", path: j.path, baseVersion: j.baseVersion }
|
|
2295
2356
|
)
|
|
2296
2357
|
}
|
|
2297
2358
|
);
|
|
@@ -2302,47 +2363,47 @@ function si(e = {}) {
|
|
|
2302
2363
|
};
|
|
2303
2364
|
} catch (C) {
|
|
2304
2365
|
if (C instanceof ye && C.status === 409)
|
|
2305
|
-
return { ok: !1, conflicts: ((b = C.body) == null ? void 0 : b.conflicts) ?? m.map((
|
|
2366
|
+
return { ok: !1, conflicts: ((b = C.body) == null ? void 0 : b.conflicts) ?? m.map((T) => ({ path: T.path })) };
|
|
2306
2367
|
throw C;
|
|
2307
2368
|
}
|
|
2308
2369
|
},
|
|
2309
|
-
async createModule(
|
|
2370
|
+
async createModule(d) {
|
|
2310
2371
|
return { ...await s(
|
|
2311
2372
|
"POST",
|
|
2312
|
-
`/module-files/${n(
|
|
2373
|
+
`/module-files/${n(d.workspaceId)}/modules`,
|
|
2313
2374
|
{
|
|
2314
|
-
packageId:
|
|
2315
|
-
id:
|
|
2316
|
-
files: y(
|
|
2375
|
+
packageId: d.packageId,
|
|
2376
|
+
id: d.id,
|
|
2377
|
+
files: y(d.files)
|
|
2317
2378
|
}
|
|
2318
|
-
), workspaceId:
|
|
2379
|
+
), workspaceId: d.workspaceId };
|
|
2319
2380
|
},
|
|
2320
|
-
async deleteModule(
|
|
2321
|
-
await s("DELETE", l(
|
|
2381
|
+
async deleteModule(d) {
|
|
2382
|
+
await s("DELETE", l(d));
|
|
2322
2383
|
},
|
|
2323
|
-
async listRevisions(
|
|
2384
|
+
async listRevisions(d, m) {
|
|
2324
2385
|
return s(
|
|
2325
2386
|
"GET",
|
|
2326
|
-
`${l(
|
|
2387
|
+
`${l(d)}/revisions${m ? `?path=${n(m)}` : ""}`
|
|
2327
2388
|
);
|
|
2328
2389
|
},
|
|
2329
|
-
async readRevision(
|
|
2390
|
+
async readRevision(d, m, b) {
|
|
2330
2391
|
return s(
|
|
2331
2392
|
"GET",
|
|
2332
|
-
`${l(
|
|
2393
|
+
`${l(d)}/revisions/${n(m)}${b ? `?path=${n(b)}` : ""}`,
|
|
2333
2394
|
void 0,
|
|
2334
2395
|
"text"
|
|
2335
2396
|
);
|
|
2336
2397
|
},
|
|
2337
|
-
async rollback(
|
|
2398
|
+
async rollback(d, m, b) {
|
|
2338
2399
|
await s(
|
|
2339
2400
|
"POST",
|
|
2340
|
-
`${l(
|
|
2401
|
+
`${l(d)}/revisions/${n(m)}/rollback${b ? `?path=${n(b)}` : ""}`
|
|
2341
2402
|
);
|
|
2342
2403
|
},
|
|
2343
2404
|
...e.serverValidation ? {
|
|
2344
|
-
async validate(
|
|
2345
|
-
return s("POST", `${l(
|
|
2405
|
+
async validate(d, m) {
|
|
2406
|
+
return s("POST", `${l(d)}/validate`, {
|
|
2346
2407
|
files: y(m)
|
|
2347
2408
|
});
|
|
2348
2409
|
}
|
|
@@ -2433,9 +2494,9 @@ function oi(e = {}) {
|
|
|
2433
2494
|
const r = (l = be(s)) == null ? void 0 : l.value.packageName;
|
|
2434
2495
|
return typeof r == "string" && r ? r : void 0;
|
|
2435
2496
|
},
|
|
2436
|
-
validateModule: (s) =>
|
|
2497
|
+
validateModule: (s) => Pt(s),
|
|
2437
2498
|
generateModule: async (s, { existingIds: r }) => {
|
|
2438
|
-
const l = await
|
|
2499
|
+
const l = await xt(
|
|
2439
2500
|
{
|
|
2440
2501
|
...It(s),
|
|
2441
2502
|
iconConfig: e.iconConfig,
|
|
@@ -2455,15 +2516,15 @@ function oi(e = {}) {
|
|
|
2455
2516
|
duplicateModule: (s, r) => Ot(s, r),
|
|
2456
2517
|
newFile: (s, { files: r }) => {
|
|
2457
2518
|
var C;
|
|
2458
|
-
const l = ti(r), y = ((C = be(r)) == null ? void 0 : C.value) ?? {},
|
|
2459
|
-
entities: ["entities.json", { moduleName:
|
|
2460
|
-
views: ["views.json", { moduleName:
|
|
2461
|
-
workflows: ["workflows.json", { moduleName:
|
|
2519
|
+
const l = ti(r), y = ((C = be(r)) == null ? void 0 : C.value) ?? {}, d = `${String(y.packageName ?? l)}.Core`, b = {
|
|
2520
|
+
entities: ["entities.json", { moduleName: d, version: "1.0.0", entities: [] }],
|
|
2521
|
+
views: ["views.json", { moduleName: d, version: "1.0.0", views: [] }],
|
|
2522
|
+
workflows: ["workflows.json", { moduleName: d, version: "1.0.0", workflows: [] }],
|
|
2462
2523
|
permissions: [
|
|
2463
2524
|
"permissions.json",
|
|
2464
|
-
{ moduleName:
|
|
2525
|
+
{ moduleName: d, version: "1.0.0", permissions: [], permissionGroups: [] }
|
|
2465
2526
|
],
|
|
2466
|
-
seeds: ["seeds.json", { moduleName:
|
|
2527
|
+
seeds: ["seeds.json", { moduleName: d, version: "1.0.0", seeds: {} }]
|
|
2467
2528
|
}[s];
|
|
2468
2529
|
return b ? { path: `${l}.${b[0]}`, text: de(b[1]) } : void 0;
|
|
2469
2530
|
},
|
|
@@ -2501,8 +2562,8 @@ function ai(e = {}) {
|
|
|
2501
2562
|
for (const l of t.keys()) {
|
|
2502
2563
|
if (!l.startsWith(s))
|
|
2503
2564
|
continue;
|
|
2504
|
-
const y = l.slice(s.length),
|
|
2505
|
-
r.set(
|
|
2565
|
+
const y = l.slice(s.length), d = y.indexOf("/");
|
|
2566
|
+
r.set(d < 0 ? y : y.slice(0, d), d < 0 ? "file" : "directory");
|
|
2506
2567
|
}
|
|
2507
2568
|
return [...r].map(([l, y]) => ({ name: l, kind: y }));
|
|
2508
2569
|
},
|
|
@@ -2545,9 +2606,9 @@ function ci(e) {
|
|
|
2545
2606
|
const i = new TextDecoder("utf-8", { ignoreBOM: !0 });
|
|
2546
2607
|
async function t(r, l = !1) {
|
|
2547
2608
|
let y = e;
|
|
2548
|
-
for (const
|
|
2609
|
+
for (const d of r.split("/").filter(Boolean))
|
|
2549
2610
|
try {
|
|
2550
|
-
y = await y.getDirectoryHandle(
|
|
2611
|
+
y = await y.getDirectoryHandle(d, { create: l });
|
|
2551
2612
|
} catch (m) {
|
|
2552
2613
|
if (re(m))
|
|
2553
2614
|
return null;
|
|
@@ -2560,11 +2621,11 @@ function ci(e) {
|
|
|
2560
2621
|
return l < 0 ? ["", r] : [r.slice(0, l), r.slice(l + 1)];
|
|
2561
2622
|
};
|
|
2562
2623
|
async function n(r, l = !1) {
|
|
2563
|
-
const [y,
|
|
2624
|
+
const [y, d] = o(r), m = await t(y, l);
|
|
2564
2625
|
if (!m)
|
|
2565
2626
|
return null;
|
|
2566
2627
|
try {
|
|
2567
|
-
return await m.getFileHandle(
|
|
2628
|
+
return await m.getFileHandle(d, { create: l });
|
|
2568
2629
|
} catch (b) {
|
|
2569
2630
|
if (re(b))
|
|
2570
2631
|
return null;
|
|
@@ -2576,8 +2637,8 @@ function ci(e) {
|
|
|
2576
2637
|
async list(r) {
|
|
2577
2638
|
const l = await t(r), y = [];
|
|
2578
2639
|
if (l)
|
|
2579
|
-
for await (const
|
|
2580
|
-
y.push({ name:
|
|
2640
|
+
for await (const d of l.values())
|
|
2641
|
+
y.push({ name: d.name, kind: d.kind });
|
|
2581
2642
|
return y;
|
|
2582
2643
|
},
|
|
2583
2644
|
async read(r) {
|
|
@@ -2591,22 +2652,22 @@ function ci(e) {
|
|
|
2591
2652
|
const y = await n(r, !0);
|
|
2592
2653
|
if (!y)
|
|
2593
2654
|
throw new Error(`Cannot write ${r}`);
|
|
2594
|
-
const
|
|
2595
|
-
return await
|
|
2655
|
+
const d = await y.createWritable();
|
|
2656
|
+
return await d.write(l), await d.close(), s(await y.getFile());
|
|
2596
2657
|
},
|
|
2597
2658
|
async remove(r) {
|
|
2598
|
-
const [l, y] = o(r),
|
|
2659
|
+
const [l, y] = o(r), d = await t(l);
|
|
2599
2660
|
try {
|
|
2600
|
-
await (
|
|
2661
|
+
await (d == null ? void 0 : d.removeEntry(y));
|
|
2601
2662
|
} catch (m) {
|
|
2602
2663
|
if (!re(m))
|
|
2603
2664
|
throw m;
|
|
2604
2665
|
}
|
|
2605
2666
|
},
|
|
2606
2667
|
async removeDir(r) {
|
|
2607
|
-
const [l, y] = o(r),
|
|
2668
|
+
const [l, y] = o(r), d = await t(l);
|
|
2608
2669
|
try {
|
|
2609
|
-
await (
|
|
2670
|
+
await (d == null ? void 0 : d.removeEntry(y, { recursive: !0 }));
|
|
2610
2671
|
} catch (m) {
|
|
2611
2672
|
if (!re(m))
|
|
2612
2673
|
throw m;
|
|
@@ -2617,10 +2678,10 @@ function ci(e) {
|
|
|
2617
2678
|
export {
|
|
2618
2679
|
W as OMNIVERK_CUSTOM_PREFIX,
|
|
2619
2680
|
vt as OMNIVERK_DATA_TYPES,
|
|
2620
|
-
|
|
2681
|
+
Ft as OMNIVERK_LEGACY_LIST_VIEW_FILES,
|
|
2621
2682
|
ei as OMNIVERK_LOCALES,
|
|
2622
2683
|
ye as OmniVerkRestError,
|
|
2623
|
-
|
|
2684
|
+
xt as buildOmniVerkModule,
|
|
2624
2685
|
ci as createDirectoryHandleFileSystem,
|
|
2625
2686
|
ai as createMemorySeedFileSystem,
|
|
2626
2687
|
si as createOmniVerkRestProvider,
|
|
@@ -2634,17 +2695,17 @@ export {
|
|
|
2634
2695
|
Qe as omniverkI18nKind,
|
|
2635
2696
|
He as omniverkManifestKind,
|
|
2636
2697
|
ht as omniverkManifestSections,
|
|
2637
|
-
|
|
2698
|
+
P as omniverkPascalIdentifier,
|
|
2638
2699
|
mt as omniverkPermissionsKind,
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2700
|
+
fe as omniverkRevisionStamp,
|
|
2701
|
+
ft as omniverkScriptKind,
|
|
2702
|
+
ut as omniverkSeedsKind,
|
|
2642
2703
|
It as omniverkSpecFromStudio,
|
|
2643
2704
|
qe as omniverkStableId,
|
|
2644
2705
|
Ve as omniverkTableName,
|
|
2645
2706
|
Ie as omniverkTemplateFromDto,
|
|
2646
2707
|
Vt as omniverkTemplateFromEntry,
|
|
2647
|
-
|
|
2708
|
+
xe as omniverkTemplateToEntry,
|
|
2648
2709
|
Ut as omniverkTemplateToInput,
|
|
2649
2710
|
st as omniverkViewFromItem,
|
|
2650
2711
|
nt as omniverkViewItem,
|
|
@@ -2653,6 +2714,6 @@ export {
|
|
|
2653
2714
|
rt as omniverkWorkflowItem,
|
|
2654
2715
|
ct as omniverkWorkflowsKind,
|
|
2655
2716
|
li as pickSeedDirectory,
|
|
2656
|
-
|
|
2657
|
-
|
|
2717
|
+
Pt as validateOmniVerkModule,
|
|
2718
|
+
Rt as validateOmniVerkWorkspace
|
|
2658
2719
|
};
|