@nice2dev/ui-forms 1.4.4 → 1.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +8 -6
- package/dist/index.d.ts +283 -8
- package/dist/index.mjs +3938 -2784
- package/dist/studio.cjs +23 -7
- package/dist/studio.d.ts +277 -8
- package/dist/studio.mjs +928 -575
- package/dist/ui-forms.css +1 -1
- package/package.json +5 -5
package/dist/studio.mjs
CHANGED
|
@@ -1,7 +1,138 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
const
|
|
1
|
+
var we = Object.defineProperty;
|
|
2
|
+
var ve = (e, t, n) => t in e ? we(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var Y = (e, t, n) => ve(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
const J = () => ({
|
|
5
|
+
version: 1,
|
|
6
|
+
sections: [],
|
|
7
|
+
folders: [],
|
|
8
|
+
placement: {}
|
|
9
|
+
}), dt = (e, t) => `${e}:${t}`, _ = ".studio.json", Se = /^([^/]+?)\.(manifest|entities|views|workflows|permissions|rbac|seeds|datasources|scripts)\.json$/i, $e = (e) => !e.includes("/") && e.toLowerCase().endsWith(_);
|
|
10
|
+
function ft(e) {
|
|
11
|
+
const t = e.find((n) => $e(n.path));
|
|
12
|
+
if (t)
|
|
13
|
+
return t.path;
|
|
14
|
+
for (const n of e) {
|
|
15
|
+
const s = Se.exec(n.path);
|
|
16
|
+
if (s)
|
|
17
|
+
return `${s[1]}${_}`;
|
|
18
|
+
}
|
|
19
|
+
return `module${_}`;
|
|
20
|
+
}
|
|
21
|
+
const N = (e) => typeof e == "object" && e !== null && !Array.isArray(e), b = (e) => typeof e == "string" && e ? e : void 0;
|
|
22
|
+
function pt(e) {
|
|
23
|
+
if (!e)
|
|
24
|
+
return J();
|
|
25
|
+
let t;
|
|
26
|
+
try {
|
|
27
|
+
t = JSON.parse(e.replace(/^\uFEFF/, ""));
|
|
28
|
+
} catch {
|
|
29
|
+
return J();
|
|
30
|
+
}
|
|
31
|
+
if (!N(t))
|
|
32
|
+
return J();
|
|
33
|
+
const n = (Array.isArray(t.sections) ? t.sections : []).filter(N).map((i) => ({ id: b(i.id), label: b(i.label) ?? b(i.id) })).filter((i) => !!i.id && !!i.label), s = (Array.isArray(t.folders) ? t.folders : []).filter(N).map((i) => ({
|
|
34
|
+
id: b(i.id),
|
|
35
|
+
label: b(i.label) ?? b(i.id),
|
|
36
|
+
group: b(i.group),
|
|
37
|
+
...b(i.parent) ? { parent: b(i.parent) } : {},
|
|
38
|
+
...b(i.section) ? { section: b(i.section) } : {}
|
|
39
|
+
})).filter((i) => !!i.id && !!i.label && !!i.group), r = {};
|
|
40
|
+
if (N(t.placement))
|
|
41
|
+
for (const [i, a] of Object.entries(t.placement)) {
|
|
42
|
+
if (!N(a))
|
|
43
|
+
continue;
|
|
44
|
+
const l = {};
|
|
45
|
+
b(a.section) && (l.section = b(a.section)), b(a.folder) && (l.folder = b(a.folder)), typeof a.order == "number" && Number.isFinite(a.order) && (l.order = a.order), (l.section || l.folder || l.order !== void 0) && (r[i] = l);
|
|
46
|
+
}
|
|
47
|
+
return { version: 1, sections: n, folders: s, placement: r };
|
|
48
|
+
}
|
|
49
|
+
const ut = (e) => e.sections.length === 0 && e.folders.length === 0 && Object.keys(e.placement).length === 0;
|
|
50
|
+
function mt(e, t) {
|
|
51
|
+
const n = JSON.stringify(e, null, 2) + `
|
|
52
|
+
`;
|
|
53
|
+
return t != null && t.includes(`\r
|
|
54
|
+
`) ? n.replace(/\n/g, `\r
|
|
55
|
+
`) : n;
|
|
56
|
+
}
|
|
57
|
+
const je = (e) => e.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "item";
|
|
58
|
+
function re(e, t) {
|
|
59
|
+
const n = je(e);
|
|
60
|
+
let s = n;
|
|
61
|
+
for (let r = 2; t.has(s); r++)
|
|
62
|
+
s = `${n}-${r}`;
|
|
63
|
+
return s;
|
|
64
|
+
}
|
|
65
|
+
function ht(e, t) {
|
|
66
|
+
const n = re(t, new Set(e.sections.map((s) => s.id)));
|
|
67
|
+
return { layout: { ...e, sections: [...e.sections, { id: n, label: t }] }, id: n };
|
|
68
|
+
}
|
|
69
|
+
function yt(e, t) {
|
|
70
|
+
const n = re(t.label, new Set(e.folders.map((r) => r.id))), s = { id: n, label: t.label, group: t.group };
|
|
71
|
+
return t.parent && (s.parent = t.parent), t.section && (s.section = t.section), { layout: { ...e, folders: [...e.folders, s] }, id: n };
|
|
72
|
+
}
|
|
73
|
+
function gt(e, t, n) {
|
|
74
|
+
return t.kind === "section" ? { ...e, sections: e.sections.map((s) => s.id === t.id ? { ...s, label: n } : s) } : { ...e, folders: e.folders.map((s) => s.id === t.id ? { ...s, label: n } : s) };
|
|
75
|
+
}
|
|
76
|
+
function bt(e, t) {
|
|
77
|
+
const n = {};
|
|
78
|
+
if (t.kind === "folder") {
|
|
79
|
+
const s = e.folders.find((r) => r.id === t.id);
|
|
80
|
+
for (const [r, i] of Object.entries(e.placement))
|
|
81
|
+
n[r] = i.folder === t.id ? { ...i, folder: s == null ? void 0 : s.parent } : i, n[r].folder || delete n[r].folder;
|
|
82
|
+
return {
|
|
83
|
+
...e,
|
|
84
|
+
folders: e.folders.filter((r) => r.id !== t.id).map((r) => r.parent === t.id ? { ...r, parent: s == null ? void 0 : s.parent } : r).map((r) => {
|
|
85
|
+
if (!r.parent) {
|
|
86
|
+
const { parent: i, ...a } = r;
|
|
87
|
+
return a;
|
|
88
|
+
}
|
|
89
|
+
return r;
|
|
90
|
+
}),
|
|
91
|
+
placement: U(n)
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
for (const [s, r] of Object.entries(e.placement))
|
|
95
|
+
if (r.section === t.id) {
|
|
96
|
+
const { section: i, ...a } = r;
|
|
97
|
+
n[s] = a;
|
|
98
|
+
} else
|
|
99
|
+
n[s] = r;
|
|
100
|
+
return {
|
|
101
|
+
...e,
|
|
102
|
+
sections: e.sections.filter((s) => s.id !== t.id),
|
|
103
|
+
folders: e.folders.map((s) => {
|
|
104
|
+
if (s.section === t.id) {
|
|
105
|
+
const { section: r, ...i } = s;
|
|
106
|
+
return i;
|
|
107
|
+
}
|
|
108
|
+
return s;
|
|
109
|
+
}),
|
|
110
|
+
placement: U(n)
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function U(e) {
|
|
114
|
+
const t = {};
|
|
115
|
+
for (const [n, s] of Object.entries(e))
|
|
116
|
+
(s.section || s.folder || s.order !== void 0) && (t[n] = s);
|
|
117
|
+
return t;
|
|
118
|
+
}
|
|
119
|
+
function kt(e, t, n) {
|
|
120
|
+
var i;
|
|
121
|
+
const s = (i = e.placement[t]) == null ? void 0 : i.order, r = {};
|
|
122
|
+
if (n.folder) {
|
|
123
|
+
r.folder = n.folder;
|
|
124
|
+
const a = e.folders.find((l) => l.id === n.folder);
|
|
125
|
+
a != null && a.section && (r.section = a.section);
|
|
126
|
+
} else n.section && (r.section = n.section);
|
|
127
|
+
return s !== void 0 && (r.order = s), { ...e, placement: U({ ...e.placement, [t]: r }) };
|
|
128
|
+
}
|
|
129
|
+
function wt(e, t, n) {
|
|
130
|
+
if (t === n || !e.placement[t])
|
|
131
|
+
return e;
|
|
132
|
+
const s = { ...e.placement, [n]: e.placement[t] };
|
|
133
|
+
return delete s[t], { ...e, placement: s };
|
|
134
|
+
}
|
|
135
|
+
const ie = "\uFEFF", oe = {
|
|
5
136
|
bom: !1,
|
|
6
137
|
eol: `
|
|
7
138
|
`,
|
|
@@ -9,98 +140,98 @@ const H = {
|
|
|
9
140
|
finalNewline: !0,
|
|
10
141
|
colonSpace: !0
|
|
11
142
|
};
|
|
12
|
-
function
|
|
143
|
+
function X(e) {
|
|
13
144
|
const t = e.charCodeAt(0) === 65279, n = e.includes(`\r
|
|
14
145
|
`) ? `\r
|
|
15
146
|
` : `
|
|
16
147
|
`;
|
|
17
|
-
let
|
|
148
|
+
let s = oe.indent;
|
|
18
149
|
const r = e.split(/\r?\n/);
|
|
19
|
-
for (let
|
|
20
|
-
const
|
|
21
|
-
if (
|
|
22
|
-
|
|
150
|
+
for (let a = 1; a < r.length; a++) {
|
|
151
|
+
const l = /^([ \t]+)\S/.exec(r[a]);
|
|
152
|
+
if (l) {
|
|
153
|
+
s = l[1];
|
|
23
154
|
break;
|
|
24
155
|
}
|
|
25
156
|
}
|
|
26
|
-
const
|
|
157
|
+
const i = /"\s*:(\s?)/.exec(e);
|
|
27
158
|
return {
|
|
28
159
|
bom: t,
|
|
29
160
|
eol: n,
|
|
30
|
-
indent:
|
|
161
|
+
indent: s,
|
|
31
162
|
finalNewline: /\n$/.test(e),
|
|
32
|
-
colonSpace:
|
|
163
|
+
colonSpace: i ? i[1] !== "" : !0
|
|
33
164
|
};
|
|
34
165
|
}
|
|
35
|
-
function
|
|
36
|
-
const t =
|
|
166
|
+
function x(e) {
|
|
167
|
+
const t = X(e);
|
|
37
168
|
return { value: JSON.parse(t.bom ? e.slice(1) : e), format: t };
|
|
38
169
|
}
|
|
39
|
-
function
|
|
40
|
-
const n = { ...
|
|
41
|
-
return (n.bom ?
|
|
170
|
+
function v(e, t) {
|
|
171
|
+
const n = { ...oe, ...t }, s = A(e, n, "");
|
|
172
|
+
return (n.bom ? ie : "") + s + (n.finalNewline ? n.eol : "");
|
|
42
173
|
}
|
|
43
|
-
function
|
|
174
|
+
function Oe(e, t) {
|
|
44
175
|
if (t === void 0)
|
|
45
176
|
return e;
|
|
46
177
|
let n = t.includes(`\r
|
|
47
178
|
`) ? e.replace(/\r?\n/g, `\r
|
|
48
179
|
`) : e;
|
|
49
|
-
return t.charCodeAt(0) === 65279 && n.charCodeAt(0) !== 65279 && (n =
|
|
180
|
+
return t.charCodeAt(0) === 65279 && n.charCodeAt(0) !== 65279 && (n = ie + n), n;
|
|
50
181
|
}
|
|
51
|
-
function
|
|
182
|
+
function C(e, t) {
|
|
52
183
|
if (e === t)
|
|
53
184
|
return !0;
|
|
54
185
|
if (typeof e != typeof t || e === null || t === null || typeof e != "object" || Array.isArray(e) !== Array.isArray(t))
|
|
55
186
|
return !1;
|
|
56
187
|
if (Array.isArray(e)) {
|
|
57
|
-
const
|
|
58
|
-
return e.length ===
|
|
188
|
+
const i = t;
|
|
189
|
+
return e.length === i.length && e.every((a, l) => C(a, i[l]));
|
|
59
190
|
}
|
|
60
|
-
const n = e,
|
|
61
|
-
return r.length !== Object.keys(
|
|
62
|
-
(
|
|
191
|
+
const n = e, s = t, r = Object.keys(n);
|
|
192
|
+
return r.length !== Object.keys(s).length ? !1 : r.every(
|
|
193
|
+
(i) => Object.prototype.hasOwnProperty.call(s, i) && C(n[i], s[i])
|
|
63
194
|
);
|
|
64
195
|
}
|
|
65
|
-
function
|
|
66
|
-
return
|
|
196
|
+
function ae(e, t, n) {
|
|
197
|
+
return Ae(e, t, n).text;
|
|
67
198
|
}
|
|
68
|
-
function
|
|
69
|
-
const
|
|
70
|
-
text:
|
|
199
|
+
function Ae(e, t, n) {
|
|
200
|
+
const s = X(e), r = (o) => ({
|
|
201
|
+
text: v(t, s),
|
|
71
202
|
exact: !1,
|
|
72
|
-
reason:
|
|
203
|
+
reason: o
|
|
73
204
|
});
|
|
74
|
-
let
|
|
205
|
+
let i;
|
|
75
206
|
try {
|
|
76
|
-
|
|
77
|
-
} catch (
|
|
78
|
-
return r(
|
|
207
|
+
i = new Ee(e).parseDocument();
|
|
208
|
+
} catch (o) {
|
|
209
|
+
return r(o instanceof Error ? o.message : String(o));
|
|
79
210
|
}
|
|
80
|
-
if (
|
|
211
|
+
if (R(i))
|
|
81
212
|
return r("duplicate keys");
|
|
82
|
-
const
|
|
213
|
+
const a = [], l = {
|
|
83
214
|
text: e,
|
|
84
|
-
format:
|
|
85
|
-
edits:
|
|
215
|
+
format: s,
|
|
216
|
+
edits: a,
|
|
86
217
|
options: n,
|
|
87
218
|
compact: !e.trimEnd().includes(`
|
|
88
219
|
`)
|
|
89
220
|
};
|
|
90
|
-
|
|
91
|
-
const
|
|
221
|
+
G(l, i, t, "", !1);
|
|
222
|
+
const f = Ke(e, a);
|
|
92
223
|
try {
|
|
93
|
-
const
|
|
94
|
-
if (!
|
|
224
|
+
const o = JSON.parse(s.bom ? f.slice(1) : f);
|
|
225
|
+
if (!C(o, t))
|
|
95
226
|
return r("patch did not read back");
|
|
96
227
|
} catch {
|
|
97
228
|
return r("patch was not valid JSON");
|
|
98
229
|
}
|
|
99
|
-
return { text:
|
|
230
|
+
return { text: f, exact: !0 };
|
|
100
231
|
}
|
|
101
|
-
class
|
|
232
|
+
class Ee {
|
|
102
233
|
constructor(t) {
|
|
103
|
-
|
|
234
|
+
Y(this, "pos", 0);
|
|
104
235
|
this.text = t;
|
|
105
236
|
}
|
|
106
237
|
parseDocument() {
|
|
@@ -124,12 +255,12 @@ class fe {
|
|
|
124
255
|
const n = this.pos;
|
|
125
256
|
if (t === '"')
|
|
126
257
|
return { kind: "scalar", start: n, end: this.stringEnd(), value: JSON.parse(this.slice(n)) };
|
|
127
|
-
const
|
|
258
|
+
const s = /^(?:-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|true|false|null)/.exec(
|
|
128
259
|
this.text.slice(n, n + 64)
|
|
129
260
|
);
|
|
130
|
-
if (!
|
|
261
|
+
if (!s)
|
|
131
262
|
throw new Error(`Unexpected token at ${n}`);
|
|
132
|
-
return this.pos = n +
|
|
263
|
+
return this.pos = n + s[0].length, { kind: "scalar", start: n, end: this.pos, value: JSON.parse(s[0]) };
|
|
133
264
|
}
|
|
134
265
|
slice(t) {
|
|
135
266
|
return this.text.slice(t, this.pos);
|
|
@@ -153,17 +284,17 @@ class fe {
|
|
|
153
284
|
return { kind: "object", start: t, end: ++this.pos, members: n };
|
|
154
285
|
for (; ; ) {
|
|
155
286
|
this.ws();
|
|
156
|
-
const
|
|
287
|
+
const s = this.pos;
|
|
157
288
|
if (this.text[this.pos] !== '"')
|
|
158
289
|
throw new Error(`Expected a key at ${this.pos}`);
|
|
159
|
-
const r = JSON.parse(this.text.slice(
|
|
290
|
+
const r = JSON.parse(this.text.slice(s, this.stringEnd()));
|
|
160
291
|
if (this.ws(), this.text[this.pos] !== ":")
|
|
161
292
|
throw new Error(`Expected ':' at ${this.pos}`);
|
|
162
|
-
this.pos++, n.push({ key: r, start:
|
|
163
|
-
const
|
|
164
|
-
if (
|
|
293
|
+
this.pos++, n.push({ key: r, start: s, value: this.value() }), this.ws();
|
|
294
|
+
const i = this.text[this.pos++];
|
|
295
|
+
if (i === "}")
|
|
165
296
|
return { kind: "object", start: t, end: this.pos, members: n };
|
|
166
|
-
if (
|
|
297
|
+
if (i !== ",")
|
|
167
298
|
throw new Error(`Expected ',' or '}' at ${this.pos - 1}`);
|
|
168
299
|
}
|
|
169
300
|
}
|
|
@@ -173,277 +304,277 @@ class fe {
|
|
|
173
304
|
return { kind: "array", start: t, end: ++this.pos, items: n };
|
|
174
305
|
for (; ; ) {
|
|
175
306
|
n.push(this.value()), this.ws();
|
|
176
|
-
const
|
|
177
|
-
if (
|
|
307
|
+
const s = this.text[this.pos++];
|
|
308
|
+
if (s === "]")
|
|
178
309
|
return { kind: "array", start: t, end: this.pos, items: n };
|
|
179
|
-
if (
|
|
310
|
+
if (s !== ",")
|
|
180
311
|
throw new Error(`Expected ',' or ']' at ${this.pos - 1}`);
|
|
181
312
|
}
|
|
182
313
|
}
|
|
183
314
|
}
|
|
184
|
-
function
|
|
315
|
+
function R(e) {
|
|
185
316
|
if (e.kind === "object") {
|
|
186
317
|
const t = /* @__PURE__ */ new Set();
|
|
187
318
|
for (const n of e.members) {
|
|
188
|
-
if (t.has(n.key) ||
|
|
319
|
+
if (t.has(n.key) || R(n.value))
|
|
189
320
|
return !0;
|
|
190
321
|
t.add(n.key);
|
|
191
322
|
}
|
|
192
323
|
} else if (e.kind === "array")
|
|
193
|
-
return e.items.some(
|
|
324
|
+
return e.items.some(R);
|
|
194
325
|
return !1;
|
|
195
326
|
}
|
|
196
|
-
function
|
|
327
|
+
function F(e) {
|
|
197
328
|
if (e.kind === "scalar")
|
|
198
329
|
return e.value;
|
|
199
330
|
if (e.kind === "array")
|
|
200
|
-
return e.items.map(
|
|
331
|
+
return e.items.map(F);
|
|
201
332
|
const t = {};
|
|
202
333
|
for (const n of e.members)
|
|
203
|
-
t[n.key] =
|
|
334
|
+
t[n.key] = F(n.value);
|
|
204
335
|
return t;
|
|
205
336
|
}
|
|
206
|
-
function
|
|
337
|
+
function A(e, t, n) {
|
|
207
338
|
if (e === null || typeof e != "object")
|
|
208
339
|
return e === void 0 ? "null" : JSON.stringify(e);
|
|
209
|
-
const
|
|
340
|
+
const s = n + t.indent, r = t.colonSpace ? ": " : ":";
|
|
210
341
|
if (Array.isArray(e))
|
|
211
|
-
return e.length === 0 ? "[]" : `[${t.eol}${e.map((
|
|
212
|
-
const
|
|
213
|
-
([,
|
|
342
|
+
return e.length === 0 ? "[]" : `[${t.eol}${e.map((a) => s + A(a, t, s)).join(`,${t.eol}`)}${t.eol}${n}]`;
|
|
343
|
+
const i = Object.entries(e).filter(
|
|
344
|
+
([, a]) => a !== void 0
|
|
214
345
|
);
|
|
215
|
-
return
|
|
346
|
+
return i.length === 0 ? "{}" : `{${t.eol}${i.map(([a, l]) => `${s}${JSON.stringify(a)}${r}${A(l, t, s)}`).join(`,${t.eol}`)}${t.eol}${n}}`;
|
|
216
347
|
}
|
|
217
|
-
function
|
|
348
|
+
function E(e, t, n = !1) {
|
|
218
349
|
if (e === null || typeof e != "object")
|
|
219
350
|
return e === void 0 ? "null" : JSON.stringify(e);
|
|
220
|
-
const
|
|
351
|
+
const s = t.colonSpace ? ": " : ":", r = n ? "," : ", ";
|
|
221
352
|
if (Array.isArray(e))
|
|
222
|
-
return `[${e.map((
|
|
223
|
-
const
|
|
224
|
-
([,
|
|
225
|
-
),
|
|
226
|
-
return
|
|
227
|
-
}
|
|
228
|
-
const
|
|
229
|
-
function
|
|
353
|
+
return `[${e.map((l) => E(l, t, n)).join(r)}]`;
|
|
354
|
+
const i = Object.entries(e).filter(
|
|
355
|
+
([, l]) => l !== void 0
|
|
356
|
+
), a = n ? "" : " ";
|
|
357
|
+
return i.length === 0 ? "{}" : `{${a}${i.map(([l, f]) => `${JSON.stringify(l)}${s}${E(f, t, n)}`).join(r)}${a}}`;
|
|
358
|
+
}
|
|
359
|
+
const ce = (e) => e.compact ? "," : ", ";
|
|
360
|
+
function Ke(e, t) {
|
|
230
361
|
let n = e;
|
|
231
|
-
for (const
|
|
232
|
-
n = n.slice(0,
|
|
362
|
+
for (const s of [...t].sort((r, i) => i.start - r.start))
|
|
363
|
+
n = n.slice(0, s.start) + s.text + n.slice(s.end);
|
|
233
364
|
return n;
|
|
234
365
|
}
|
|
235
|
-
function
|
|
236
|
-
var
|
|
366
|
+
function L(e, t) {
|
|
367
|
+
var s;
|
|
237
368
|
const n = e.lastIndexOf(`
|
|
238
369
|
`, t - 1) + 1;
|
|
239
|
-
return ((
|
|
370
|
+
return ((s = /^[ \t]*/.exec(e.slice(n, t))) == null ? void 0 : s[0]) ?? "";
|
|
240
371
|
}
|
|
241
|
-
function
|
|
372
|
+
function le(e, t) {
|
|
242
373
|
return !e.slice(t.start, t.end).includes(`
|
|
243
374
|
`);
|
|
244
375
|
}
|
|
245
|
-
function
|
|
246
|
-
return e.compact ? !0 : t.kind === "scalar" || (t.kind === "object" ? t.members.length === 0 : t.items.length === 0) ? n :
|
|
376
|
+
function Z(e, t, n) {
|
|
377
|
+
return e.compact ? !0 : t.kind === "scalar" || (t.kind === "object" ? t.members.length === 0 : t.items.length === 0) ? n : le(e.text, t);
|
|
247
378
|
}
|
|
248
|
-
function
|
|
249
|
-
const r =
|
|
379
|
+
function T(e, t, n, s) {
|
|
380
|
+
const r = Z(e, t, s);
|
|
250
381
|
e.edits.push({
|
|
251
382
|
start: t.start,
|
|
252
383
|
end: t.end,
|
|
253
|
-
text: r ?
|
|
384
|
+
text: r ? E(n, e.format, e.compact) : A(n, e.format, L(e.text, t.start))
|
|
254
385
|
});
|
|
255
386
|
}
|
|
256
|
-
const
|
|
257
|
-
function
|
|
387
|
+
const de = (e) => typeof e == "object" && e !== null && !Array.isArray(e);
|
|
388
|
+
function G(e, t, n, s, r) {
|
|
258
389
|
if (t.kind === "scalar") {
|
|
259
390
|
if (t.value === n)
|
|
260
391
|
return;
|
|
261
|
-
|
|
392
|
+
T(e, t, n, r);
|
|
262
393
|
return;
|
|
263
394
|
}
|
|
264
|
-
|
|
395
|
+
C(F(t), n) || (t.kind === "object" && de(n) ? Ne(e, t, n, s, r) : t.kind === "array" && Array.isArray(n) ? Te(e, t, n, s, r) : T(e, t, n, r));
|
|
265
396
|
}
|
|
266
|
-
function
|
|
267
|
-
return n !== void 0 ?
|
|
397
|
+
function fe(e, t, n) {
|
|
398
|
+
return n !== void 0 ? L(e.text, n) : L(e.text, t.start) + e.format.indent;
|
|
268
399
|
}
|
|
269
|
-
function
|
|
270
|
-
var
|
|
271
|
-
const
|
|
272
|
-
(
|
|
273
|
-
),
|
|
274
|
-
(
|
|
400
|
+
function Ne(e, t, n, s, r) {
|
|
401
|
+
var d;
|
|
402
|
+
const i = Z(e, t, r), a = t.members.filter(
|
|
403
|
+
(p) => Object.prototype.hasOwnProperty.call(n, p.key) && n[p.key] !== void 0
|
|
404
|
+
), l = Object.keys(n).filter(
|
|
405
|
+
(p) => n[p] !== void 0 && !t.members.some((h) => h.key === p)
|
|
275
406
|
);
|
|
276
|
-
if (
|
|
277
|
-
|
|
407
|
+
if (a.length === 0 && t.members.length > 0) {
|
|
408
|
+
T(e, t, n, r);
|
|
278
409
|
return;
|
|
279
410
|
}
|
|
280
|
-
for (const
|
|
281
|
-
|
|
282
|
-
if (
|
|
411
|
+
for (const p of a)
|
|
412
|
+
G(e, p.value, n[p.key], `${s}/${Le(p.key)}`, i);
|
|
413
|
+
if (pe(
|
|
283
414
|
e,
|
|
284
|
-
t.members.map((
|
|
285
|
-
t.members.map((
|
|
286
|
-
),
|
|
415
|
+
t.members.map((p) => ({ start: p.start, end: p.value.end })),
|
|
416
|
+
t.members.map((p) => a.includes(p))
|
|
417
|
+
), l.length === 0)
|
|
287
418
|
return;
|
|
288
|
-
const
|
|
289
|
-
if (
|
|
290
|
-
const
|
|
291
|
-
(h) => `${JSON.stringify(h)}${
|
|
419
|
+
const f = e.format.colonSpace ? ": " : ":";
|
|
420
|
+
if (i) {
|
|
421
|
+
const p = l.map(
|
|
422
|
+
(h) => `${JSON.stringify(h)}${f}${E(n[h], e.format, e.compact)}`
|
|
292
423
|
);
|
|
293
|
-
|
|
424
|
+
me(e, t, a.length > 0 ? a[a.length - 1].value.end : void 0, p);
|
|
294
425
|
return;
|
|
295
426
|
}
|
|
296
|
-
const
|
|
297
|
-
(
|
|
427
|
+
const o = fe(e, t, (d = t.members[0]) == null ? void 0 : d.start), c = l.map(
|
|
428
|
+
(p) => `${o}${JSON.stringify(p)}${f}${A(n[p], e.format, o)}`
|
|
298
429
|
);
|
|
299
|
-
|
|
430
|
+
ue(e, t, a.length > 0 ? a[a.length - 1].value.end : void 0, c);
|
|
300
431
|
}
|
|
301
|
-
const
|
|
302
|
-
function
|
|
303
|
-
var
|
|
304
|
-
const r = [...n, ...
|
|
305
|
-
if (r.length === 0 || !r.every(
|
|
432
|
+
const Ie = ["name", "id", "code", "key", "slug", "state", "Id"];
|
|
433
|
+
function xe(e, t, n, s) {
|
|
434
|
+
var f, o;
|
|
435
|
+
const r = [...n, ...s];
|
|
436
|
+
if (r.length === 0 || !r.every(de))
|
|
306
437
|
return;
|
|
307
|
-
const
|
|
308
|
-
const
|
|
309
|
-
return
|
|
310
|
-
},
|
|
311
|
-
return (
|
|
438
|
+
const i = (c, d) => {
|
|
439
|
+
const p = c.map((h) => h[d]);
|
|
440
|
+
return p.every((h) => typeof h == "string" || typeof h == "number") && new Set(p).size === p.length;
|
|
441
|
+
}, a = (o = (f = e.options) == null ? void 0 : f.arrayKey) == null ? void 0 : o.call(f, t);
|
|
442
|
+
return (a ? [a] : Ie).find((c) => i(n, c) && i(s, c));
|
|
312
443
|
}
|
|
313
|
-
function
|
|
444
|
+
function Te(e, t, n, s, r) {
|
|
314
445
|
var g;
|
|
315
|
-
const
|
|
316
|
-
const m = u
|
|
317
|
-
return n.findIndex((
|
|
318
|
-
}) :
|
|
446
|
+
const i = Z(e, t, r), a = t.items.map(F), l = xe(e, s, a, n), f = (u) => u[l], o = l !== void 0 ? a.map((u) => {
|
|
447
|
+
const m = f(u);
|
|
448
|
+
return n.findIndex((k) => f(k) === m);
|
|
449
|
+
}) : Fe(a, n);
|
|
319
450
|
{
|
|
320
|
-
const
|
|
321
|
-
for (let m = 0; m <
|
|
322
|
-
if (
|
|
451
|
+
const u = new Set(o.filter((m) => m >= 0));
|
|
452
|
+
for (let m = 0; m < o.length; m++) {
|
|
453
|
+
if (o[m] >= 0)
|
|
323
454
|
continue;
|
|
324
|
-
let
|
|
455
|
+
let k = -1;
|
|
325
456
|
for (let y = m - 1; y >= 0; y--)
|
|
326
|
-
if (
|
|
327
|
-
|
|
457
|
+
if (o[y] >= 0) {
|
|
458
|
+
k = o[y];
|
|
328
459
|
break;
|
|
329
460
|
}
|
|
330
|
-
let
|
|
331
|
-
for (let y = m + 1; y <
|
|
332
|
-
if (
|
|
333
|
-
|
|
461
|
+
let j = n.length;
|
|
462
|
+
for (let y = m + 1; y < o.length; y++)
|
|
463
|
+
if (o[y] >= 0) {
|
|
464
|
+
j = o[y];
|
|
334
465
|
break;
|
|
335
466
|
}
|
|
336
|
-
for (let y =
|
|
337
|
-
if (!
|
|
338
|
-
|
|
467
|
+
for (let y = k + 1; y < j; y++)
|
|
468
|
+
if (!u.has(y)) {
|
|
469
|
+
o[m] = y, u.add(y);
|
|
339
470
|
break;
|
|
340
471
|
}
|
|
341
472
|
}
|
|
342
473
|
}
|
|
343
|
-
const
|
|
344
|
-
if (
|
|
345
|
-
|
|
474
|
+
const c = o.filter((u) => u >= 0);
|
|
475
|
+
if (c.some((u, m) => m > 0 && u < c[m - 1])) {
|
|
476
|
+
T(e, t, n, r);
|
|
346
477
|
return;
|
|
347
478
|
}
|
|
348
|
-
if (
|
|
349
|
-
|
|
479
|
+
if (c.length === 0 && t.items.length > 0) {
|
|
480
|
+
T(e, t, n, r);
|
|
350
481
|
return;
|
|
351
482
|
}
|
|
352
|
-
t.items.forEach((
|
|
353
|
-
|
|
354
|
-
}),
|
|
483
|
+
t.items.forEach((u, m) => {
|
|
484
|
+
o[m] >= 0 && G(e, u, n[o[m]], `${s}/${o[m]}`, i);
|
|
485
|
+
}), pe(
|
|
355
486
|
e,
|
|
356
|
-
t.items.map((
|
|
357
|
-
|
|
487
|
+
t.items.map((u) => ({ start: u.start, end: u.end })),
|
|
488
|
+
o.map((u) => u >= 0)
|
|
358
489
|
);
|
|
359
|
-
const
|
|
360
|
-
n.forEach((
|
|
361
|
-
if (
|
|
490
|
+
const d = t.items.length > 0 && t.items.every((u) => u.kind !== "scalar" && le(e.text, u)), p = fe(e, t, (g = t.items[0]) == null ? void 0 : g.start), h = /* @__PURE__ */ new Map();
|
|
491
|
+
n.forEach((u, m) => {
|
|
492
|
+
if (o.includes(m))
|
|
362
493
|
return;
|
|
363
|
-
let
|
|
364
|
-
for (let
|
|
365
|
-
if (
|
|
366
|
-
|
|
494
|
+
let k;
|
|
495
|
+
for (let O = t.items.length - 1; O >= 0; O--)
|
|
496
|
+
if (o[O] >= 0 && o[O] < m) {
|
|
497
|
+
k = O;
|
|
367
498
|
break;
|
|
368
499
|
}
|
|
369
|
-
const
|
|
370
|
-
y.push(
|
|
500
|
+
const j = i ? E(u, e.format, e.compact) : d ? `${p}${E(u, e.format)}` : `${p}${A(u, e.format, p)}`, y = h.get(k) ?? [];
|
|
501
|
+
y.push(j), h.set(k, y);
|
|
371
502
|
});
|
|
372
|
-
for (const [
|
|
373
|
-
const
|
|
374
|
-
if (
|
|
375
|
-
const
|
|
503
|
+
for (const [u, m] of h) {
|
|
504
|
+
const k = u === void 0 ? void 0 : t.items[u].end;
|
|
505
|
+
if (u === void 0 && c.length > 0) {
|
|
506
|
+
const j = t.items[o.findIndex((O) => O >= 0)], y = i ? ce(e) : `,${e.format.eol}`;
|
|
376
507
|
e.edits.push({
|
|
377
|
-
start:
|
|
378
|
-
end:
|
|
379
|
-
text:
|
|
508
|
+
start: j.start,
|
|
509
|
+
end: j.start,
|
|
510
|
+
text: i ? m.join(y) + y : m.join(y).trimStart() + y + p
|
|
380
511
|
});
|
|
381
512
|
continue;
|
|
382
513
|
}
|
|
383
|
-
|
|
514
|
+
i ? me(e, t, k, m) : ue(e, t, k, m);
|
|
384
515
|
}
|
|
385
516
|
}
|
|
386
|
-
const
|
|
387
|
-
function
|
|
388
|
-
const n = e.length,
|
|
389
|
-
if (n *
|
|
390
|
-
return e.map((
|
|
391
|
-
const r = e.map((
|
|
392
|
-
for (let
|
|
393
|
-
for (let
|
|
394
|
-
c
|
|
395
|
-
const
|
|
396
|
-
let
|
|
397
|
-
for (;
|
|
398
|
-
r[
|
|
399
|
-
return
|
|
400
|
-
}
|
|
401
|
-
function
|
|
402
|
-
for (let
|
|
403
|
-
if (n[
|
|
517
|
+
const Ce = 4e6;
|
|
518
|
+
function Fe(e, t) {
|
|
519
|
+
const n = e.length, s = t.length;
|
|
520
|
+
if (n * s > Ce)
|
|
521
|
+
return e.map((c, d) => d < s ? d : -1);
|
|
522
|
+
const r = e.map((c) => JSON.stringify(c)), i = t.map((c) => JSON.stringify(c)), a = Array.from({ length: n + 1 }, () => new Uint32Array(s + 1));
|
|
523
|
+
for (let c = n - 1; c >= 0; c--)
|
|
524
|
+
for (let d = s - 1; d >= 0; d--)
|
|
525
|
+
a[c][d] = r[c] === i[d] ? a[c + 1][d + 1] + 1 : Math.max(a[c + 1][d], a[c][d + 1]);
|
|
526
|
+
const l = new Array(n).fill(-1);
|
|
527
|
+
let f = 0, o = 0;
|
|
528
|
+
for (; f < n && o < s; )
|
|
529
|
+
r[f] === i[o] ? l[f++] = o++ : a[f + 1][o] >= a[f][o + 1] ? f++ : o++;
|
|
530
|
+
return l;
|
|
531
|
+
}
|
|
532
|
+
function pe(e, t, n) {
|
|
533
|
+
for (let s = 0; s < t.length; s++) {
|
|
534
|
+
if (n[s])
|
|
404
535
|
continue;
|
|
405
|
-
let r =
|
|
536
|
+
let r = s;
|
|
406
537
|
for (; r + 1 < t.length && !n[r + 1]; )
|
|
407
538
|
r++;
|
|
408
|
-
r + 1 < t.length ? e.edits.push({ start: t[
|
|
539
|
+
r + 1 < t.length ? e.edits.push({ start: t[s].start, end: t[r + 1].start, text: "" }) : s > 0 ? e.edits.push({ start: t[s - 1].end, end: t[r].end, text: "" }) : e.edits.push({ start: t[s].start, end: t[r].end, text: "" }), s = r;
|
|
409
540
|
}
|
|
410
541
|
}
|
|
411
|
-
function
|
|
542
|
+
function ue(e, t, n, s) {
|
|
412
543
|
const r = e.format.eol;
|
|
413
544
|
if (n !== void 0) {
|
|
414
|
-
e.edits.push({ start: n, end: n, text: `,${r}${
|
|
545
|
+
e.edits.push({ start: n, end: n, text: `,${r}${s.join(`,${r}`)}` });
|
|
415
546
|
return;
|
|
416
547
|
}
|
|
417
|
-
const
|
|
548
|
+
const i = t.end - 1;
|
|
418
549
|
if ((t.kind === "object" ? t.members.length : t.items.length) === 0)
|
|
419
550
|
e.edits.push({
|
|
420
551
|
start: t.start + 1,
|
|
421
|
-
end:
|
|
422
|
-
text: `${r}${
|
|
552
|
+
end: i,
|
|
553
|
+
text: `${r}${s.join(`,${r}`)}${r}${L(e.text, t.start)}`
|
|
423
554
|
});
|
|
424
555
|
else {
|
|
425
|
-
const
|
|
426
|
-
e.edits.push({ start:
|
|
556
|
+
const l = t.kind === "object" ? t.members[0].start : t.items[0].start;
|
|
557
|
+
e.edits.push({ start: l, end: l, text: `${s.join(`,${r}`).trimStart()}` });
|
|
427
558
|
}
|
|
428
559
|
}
|
|
429
|
-
function
|
|
430
|
-
const r =
|
|
560
|
+
function me(e, t, n, s) {
|
|
561
|
+
const r = ce(e);
|
|
431
562
|
if (n !== void 0) {
|
|
432
|
-
e.edits.push({ start: n, end: n, text: `${r}${
|
|
563
|
+
e.edits.push({ start: n, end: n, text: `${r}${s.join(r)}` });
|
|
433
564
|
return;
|
|
434
565
|
}
|
|
435
|
-
const
|
|
566
|
+
const i = t.kind === "object" && !e.compact ? " " : "";
|
|
436
567
|
e.edits.push({
|
|
437
568
|
start: t.start + 1,
|
|
438
569
|
end: t.end - 1,
|
|
439
|
-
text: `${
|
|
570
|
+
text: `${i}${s.join(r)}${i}`
|
|
440
571
|
});
|
|
441
572
|
}
|
|
442
|
-
function
|
|
573
|
+
function Le(e) {
|
|
443
574
|
return e.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
444
575
|
}
|
|
445
|
-
const K = (e) => e.slice(e.lastIndexOf("/") + 1),
|
|
446
|
-
function
|
|
576
|
+
const K = (e) => e.slice(e.lastIndexOf("/") + 1), Me = (e) => e.charCodeAt(0) === 65279 ? e.slice(1) : e;
|
|
577
|
+
function M(e) {
|
|
447
578
|
return {
|
|
448
579
|
id: e.id,
|
|
449
580
|
label: e.label,
|
|
@@ -452,19 +583,19 @@ function R(e) {
|
|
|
452
583
|
match: e.match,
|
|
453
584
|
editor: e.editor,
|
|
454
585
|
decode(t, n) {
|
|
455
|
-
return e.select(
|
|
586
|
+
return e.select(x(t[0].text).value, n);
|
|
456
587
|
},
|
|
457
|
-
encode(t, n,
|
|
458
|
-
const r = n[0].text,
|
|
588
|
+
encode(t, n, s) {
|
|
589
|
+
const r = n[0].text, i = x(r).value, a = e.assign(i, t, s);
|
|
459
590
|
return {
|
|
460
591
|
files: [
|
|
461
|
-
{ path: n[0].path, text:
|
|
592
|
+
{ path: n[0].path, text: ae(r, a, { arrayKey: e.arrayKey }) }
|
|
462
593
|
]
|
|
463
594
|
};
|
|
464
595
|
}
|
|
465
596
|
};
|
|
466
597
|
}
|
|
467
|
-
const
|
|
598
|
+
const q = M({
|
|
468
599
|
id: "json",
|
|
469
600
|
label: "JSON",
|
|
470
601
|
labelKey: "devStudio.kind.json",
|
|
@@ -473,7 +604,7 @@ const F = R({
|
|
|
473
604
|
editor: "json",
|
|
474
605
|
select: (e) => e,
|
|
475
606
|
assign: (e, t) => t
|
|
476
|
-
}),
|
|
607
|
+
}), z = {
|
|
477
608
|
id: "text",
|
|
478
609
|
label: "Text",
|
|
479
610
|
labelKey: "devStudio.kind.text",
|
|
@@ -482,20 +613,20 @@ const F = R({
|
|
|
482
613
|
editor: "text",
|
|
483
614
|
decode: (e) => e[0].text,
|
|
484
615
|
encode: (e, t) => ({
|
|
485
|
-
files: [{ path: t[0].path, text:
|
|
616
|
+
files: [{ path: t[0].path, text: Oe(e, t[0].text) }]
|
|
486
617
|
})
|
|
487
618
|
};
|
|
488
|
-
function
|
|
489
|
-
return e.find((n) => n.match(t)) ?? (
|
|
619
|
+
function Pe(e, t) {
|
|
620
|
+
return e.find((n) => n.match(t)) ?? (q.match(t) ? q : z);
|
|
490
621
|
}
|
|
491
|
-
function
|
|
492
|
-
for (const
|
|
493
|
-
if (
|
|
622
|
+
function Je(e, t, n) {
|
|
623
|
+
for (const s of [q, z])
|
|
624
|
+
if (s.match(e.path))
|
|
494
625
|
try {
|
|
495
|
-
const r =
|
|
626
|
+
const r = s.decode([e], n);
|
|
496
627
|
return {
|
|
497
|
-
key: `${
|
|
498
|
-
kind:
|
|
628
|
+
key: `${s.id}:${e.path}`,
|
|
629
|
+
kind: s,
|
|
499
630
|
paths: [e.path],
|
|
500
631
|
label: K(e.path),
|
|
501
632
|
model: r,
|
|
@@ -505,64 +636,64 @@ function $e(e, t, n) {
|
|
|
505
636
|
}
|
|
506
637
|
return {
|
|
507
638
|
key: `text:${e.path}`,
|
|
508
|
-
kind:
|
|
639
|
+
kind: z,
|
|
509
640
|
paths: [e.path],
|
|
510
641
|
label: K(e.path),
|
|
511
642
|
model: e.text,
|
|
512
643
|
error: t
|
|
513
644
|
};
|
|
514
645
|
}
|
|
515
|
-
function
|
|
516
|
-
var
|
|
517
|
-
const r = e.encode(t, n,
|
|
518
|
-
if (
|
|
519
|
-
throw new Error(`${K(
|
|
520
|
-
}
|
|
521
|
-
function
|
|
522
|
-
const
|
|
523
|
-
for (const
|
|
524
|
-
const
|
|
525
|
-
|
|
646
|
+
function De(e, t, n, s) {
|
|
647
|
+
var l, f;
|
|
648
|
+
const r = e.encode(t, n, s), i = new Map(n.map((o) => [o.path, o.text])), a = ((l = r.files.find((o) => i.get(o.path) !== o.text)) == null ? void 0 : l.path) ?? ((f = r.deleted) == null ? void 0 : f.find((o) => i.has(o)));
|
|
649
|
+
if (a !== void 0)
|
|
650
|
+
throw new Error(`${K(a)} would not be stored as it is`);
|
|
651
|
+
}
|
|
652
|
+
function vt(e, t, n) {
|
|
653
|
+
const s = /* @__PURE__ */ new Map();
|
|
654
|
+
for (const i of t) {
|
|
655
|
+
const a = Pe(e, i.path), l = a.group ? a.group(i.path) : i.path, f = `${a.id}:${l}`, o = s.get(f) ?? { kind: a, group: l, files: [] };
|
|
656
|
+
o.files.push(i), s.set(f, o);
|
|
526
657
|
}
|
|
527
658
|
const r = [];
|
|
528
|
-
for (const [
|
|
529
|
-
const
|
|
659
|
+
for (const [i, { kind: a, group: l, files: f }] of s) {
|
|
660
|
+
const o = f.map((d) => d.path).sort(), c = K(a.group ? l : o[0]);
|
|
530
661
|
try {
|
|
531
|
-
const
|
|
532
|
-
|
|
533
|
-
} catch (
|
|
534
|
-
const
|
|
535
|
-
for (const h of
|
|
536
|
-
r.push(
|
|
662
|
+
const d = a.decode(f, n);
|
|
663
|
+
De(a, d, f, n), r.push({ key: i, kind: a, paths: o, label: c, model: d });
|
|
664
|
+
} catch (d) {
|
|
665
|
+
const p = d instanceof Error ? d.message : String(d);
|
|
666
|
+
for (const h of f)
|
|
667
|
+
r.push(Je(h, p, n));
|
|
537
668
|
}
|
|
538
669
|
}
|
|
539
|
-
return r.sort((
|
|
670
|
+
return r.sort((i, a) => i.label.localeCompare(a.label));
|
|
540
671
|
}
|
|
541
|
-
function
|
|
542
|
-
const r = n.filter((
|
|
543
|
-
for (const
|
|
544
|
-
const
|
|
545
|
-
|
|
672
|
+
function St(e, t, n, s) {
|
|
673
|
+
const r = n.filter((f) => e.paths.includes(f.path)), i = e.kind.encode(t, r, s), a = new Map(n.map((f) => [f.path, f])), l = [];
|
|
674
|
+
for (const f of i.files) {
|
|
675
|
+
const o = a.get(f.path);
|
|
676
|
+
o && o.text === f.text || l.push({ type: "write", path: f.path, text: f.text, baseVersion: o == null ? void 0 : o.version });
|
|
546
677
|
}
|
|
547
|
-
for (const
|
|
548
|
-
const
|
|
549
|
-
|
|
678
|
+
for (const f of i.deleted ?? []) {
|
|
679
|
+
const o = a.get(f);
|
|
680
|
+
o && l.push({ type: "delete", path: f, baseVersion: o.version });
|
|
550
681
|
}
|
|
551
|
-
return
|
|
682
|
+
return l;
|
|
552
683
|
}
|
|
553
|
-
function
|
|
684
|
+
function _e(e, t) {
|
|
554
685
|
try {
|
|
555
|
-
return JSON.parse(
|
|
686
|
+
return JSON.parse(Me(e));
|
|
556
687
|
} catch {
|
|
557
688
|
return t;
|
|
558
689
|
}
|
|
559
690
|
}
|
|
560
|
-
const w = (e) => typeof e == "object" && e !== null && !Array.isArray(e),
|
|
691
|
+
const w = (e) => typeof e == "object" && e !== null && !Array.isArray(e), $ = (...e) => (t) => {
|
|
561
692
|
const n = t.toLowerCase();
|
|
562
|
-
return e.some((
|
|
693
|
+
return e.some((s) => n.endsWith(s.toLowerCase()));
|
|
563
694
|
};
|
|
564
|
-
function
|
|
565
|
-
return
|
|
695
|
+
function P(e) {
|
|
696
|
+
return M({
|
|
566
697
|
id: e.id,
|
|
567
698
|
label: e.label,
|
|
568
699
|
labelKey: e.labelKey,
|
|
@@ -579,123 +710,318 @@ function J(e) {
|
|
|
579
710
|
arrayKey: e.itemKey ? () => e.itemKey : void 0
|
|
580
711
|
});
|
|
581
712
|
}
|
|
582
|
-
function
|
|
583
|
-
const t =
|
|
713
|
+
function he(e) {
|
|
714
|
+
const t = P(e);
|
|
584
715
|
return {
|
|
585
716
|
...t,
|
|
586
|
-
decode: (n,
|
|
587
|
-
encode: (n,
|
|
588
|
-
n.map((
|
|
589
|
-
|
|
717
|
+
decode: (n, s) => t.decode(n, s).map((r, i) => e.toItem(r, i)),
|
|
718
|
+
encode: (n, s, r) => t.encode(
|
|
719
|
+
n.map((i) => e.fromItem(i)),
|
|
720
|
+
s,
|
|
590
721
|
r
|
|
591
722
|
)
|
|
592
723
|
};
|
|
593
724
|
}
|
|
594
|
-
function
|
|
595
|
-
return
|
|
725
|
+
function ye(e) {
|
|
726
|
+
return M({
|
|
596
727
|
...e,
|
|
597
728
|
select: (t) => w(t) ? t : {},
|
|
598
729
|
assign: (t, n) => n
|
|
599
730
|
});
|
|
600
731
|
}
|
|
601
|
-
const
|
|
602
|
-
const t =
|
|
732
|
+
const Ue = /^(.*)\.([a-z]{2,3}(?:-[A-Za-z]{2,4})?)\.i18n\.json$/i, Re = (e) => {
|
|
733
|
+
const t = Ue.exec(e);
|
|
603
734
|
return t ? { group: t[1], locale: t[2] } : null;
|
|
604
|
-
},
|
|
605
|
-
function
|
|
735
|
+
}, V = (e) => w(e) && Object.values(e).every((t) => typeof t == "string");
|
|
736
|
+
function qe(e) {
|
|
606
737
|
if (w(e)) {
|
|
607
738
|
for (const t of ["translations", "keys"])
|
|
608
739
|
if (t in e) {
|
|
609
|
-
if (
|
|
740
|
+
if (V(e[t]))
|
|
610
741
|
return e[t];
|
|
611
742
|
throw new Error(`"${t}" is not a flat map of texts`);
|
|
612
743
|
}
|
|
613
|
-
if (
|
|
744
|
+
if (V(e))
|
|
614
745
|
return e;
|
|
615
746
|
}
|
|
616
747
|
throw new Error("no translations in this file");
|
|
617
748
|
}
|
|
618
|
-
function
|
|
619
|
-
return w(e) ? w(e.translations) ? { ...e, translations: t } : w(e.keys) ? { ...e, keys: t } :
|
|
749
|
+
function Q(e, t) {
|
|
750
|
+
return w(e) ? w(e.translations) ? { ...e, translations: t } : w(e.keys) ? { ...e, keys: t } : V(e) ? t : { ...e, translations: t } : { translations: t };
|
|
620
751
|
}
|
|
621
|
-
function
|
|
622
|
-
const t = e.parse ??
|
|
752
|
+
function ze(e = {}) {
|
|
753
|
+
const t = e.parse ?? Re, n = e.pathFor ?? ((s, r) => `${s}.${r}.i18n.json`);
|
|
623
754
|
return {
|
|
624
755
|
id: e.id ?? "i18n",
|
|
625
756
|
label: e.label ?? "Translations",
|
|
626
757
|
labelKey: e.labelKey ?? "devStudio.kind.i18n",
|
|
627
758
|
icon: "globe",
|
|
628
759
|
editor: "i18n",
|
|
629
|
-
match: (
|
|
630
|
-
group: (
|
|
760
|
+
match: (s) => t(s) !== null,
|
|
761
|
+
group: (s) => {
|
|
631
762
|
var r;
|
|
632
|
-
return ((r = t(
|
|
763
|
+
return ((r = t(s)) == null ? void 0 : r.group) ?? s;
|
|
633
764
|
},
|
|
634
|
-
decode(
|
|
765
|
+
decode(s) {
|
|
635
766
|
const r = {};
|
|
636
|
-
for (const
|
|
637
|
-
const
|
|
638
|
-
|
|
767
|
+
for (const i of s) {
|
|
768
|
+
const a = t(i.path);
|
|
769
|
+
a && (r[a.locale] = { ...qe(x(i.text).value) });
|
|
639
770
|
}
|
|
640
771
|
return r;
|
|
641
772
|
},
|
|
642
|
-
encode(
|
|
643
|
-
const
|
|
644
|
-
let
|
|
645
|
-
for (const
|
|
646
|
-
const
|
|
647
|
-
|
|
773
|
+
encode(s, r) {
|
|
774
|
+
const i = /* @__PURE__ */ new Map();
|
|
775
|
+
let a = "";
|
|
776
|
+
for (const c of r) {
|
|
777
|
+
const d = t(c.path);
|
|
778
|
+
d && (i.set(d.locale, c), a = d.group);
|
|
648
779
|
}
|
|
649
|
-
const
|
|
650
|
-
for (const [
|
|
651
|
-
const
|
|
652
|
-
if (
|
|
653
|
-
const g =
|
|
654
|
-
|
|
655
|
-
path:
|
|
656
|
-
text:
|
|
780
|
+
const l = i.get("en") ?? r[0], f = [];
|
|
781
|
+
for (const [c, d] of Object.entries(s)) {
|
|
782
|
+
const p = i.get(c);
|
|
783
|
+
if (p) {
|
|
784
|
+
const g = x(p.text).value;
|
|
785
|
+
f.push({
|
|
786
|
+
path: p.path,
|
|
787
|
+
text: ae(p.text, Q(g, d))
|
|
657
788
|
});
|
|
658
789
|
continue;
|
|
659
790
|
}
|
|
660
|
-
const h = n(
|
|
661
|
-
if (
|
|
662
|
-
const g =
|
|
663
|
-
|
|
791
|
+
const h = n(a || K((l == null ? void 0 : l.path) ?? "module"), c);
|
|
792
|
+
if (l) {
|
|
793
|
+
const g = x(l.text).value, u = w(g) && "locale" in g ? { ...g, locale: c } : g;
|
|
794
|
+
f.push({
|
|
664
795
|
path: h,
|
|
665
|
-
text:
|
|
666
|
-
|
|
667
|
-
|
|
796
|
+
text: v(
|
|
797
|
+
Q(u, d),
|
|
798
|
+
X(l.text)
|
|
668
799
|
)
|
|
669
800
|
});
|
|
670
801
|
} else
|
|
671
|
-
|
|
802
|
+
f.push({ path: h, text: v({ locale: c, translations: d }) });
|
|
672
803
|
}
|
|
673
|
-
const
|
|
674
|
-
return { files:
|
|
804
|
+
const o = [...i.entries()].filter(([c]) => !(c in s)).map(([, c]) => c.path);
|
|
805
|
+
return { files: f, deleted: o };
|
|
675
806
|
}
|
|
676
807
|
};
|
|
677
808
|
}
|
|
678
|
-
const
|
|
679
|
-
|
|
809
|
+
const S = (e) => typeof e == "object" && e !== null && !Array.isArray(e), Ve = [
|
|
810
|
+
"frontend",
|
|
811
|
+
"backend",
|
|
812
|
+
"noCode",
|
|
813
|
+
"sql"
|
|
814
|
+
], $t = [
|
|
815
|
+
"preInstall",
|
|
816
|
+
"postInstall",
|
|
817
|
+
"preUninstall",
|
|
818
|
+
"postUninstall"
|
|
819
|
+
];
|
|
820
|
+
function We(e) {
|
|
821
|
+
switch (e) {
|
|
822
|
+
case "frontend":
|
|
823
|
+
return ["typescript", "javascript"];
|
|
824
|
+
case "backend":
|
|
825
|
+
return ["csharp", "javascript"];
|
|
826
|
+
case "sql":
|
|
827
|
+
return ["sql"];
|
|
828
|
+
case "noCode":
|
|
829
|
+
return [];
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
const Be = /* @__PURE__ */ new Set([
|
|
833
|
+
"read",
|
|
834
|
+
"filter",
|
|
835
|
+
"map",
|
|
836
|
+
"aggregate",
|
|
837
|
+
"set",
|
|
838
|
+
"if",
|
|
839
|
+
"forEach",
|
|
840
|
+
"write",
|
|
841
|
+
"callScript",
|
|
842
|
+
"return"
|
|
843
|
+
]), ge = (e) => Array.isArray(e) && e.every((t) => S(t) && typeof t.id == "string" && Be.has(String(t.type)));
|
|
844
|
+
function W(e) {
|
|
845
|
+
if (Ve.includes(e.kind))
|
|
846
|
+
return e.kind;
|
|
847
|
+
if (e.source === void 0 && ge(e.steps))
|
|
848
|
+
return "noCode";
|
|
849
|
+
const t = typeof e.language == "string" ? e.language.toLowerCase() : "";
|
|
850
|
+
return t.endsWith("sql") || e.source === void 0 && typeof e.sql == "string" ? "sql" : /^(csharp|c#|cs\b)/.test(t) ? "backend" : "frontend";
|
|
851
|
+
}
|
|
852
|
+
const be = [
|
|
853
|
+
"id",
|
|
854
|
+
"displayName",
|
|
855
|
+
"description",
|
|
856
|
+
"language",
|
|
857
|
+
"category",
|
|
858
|
+
"trigger",
|
|
859
|
+
"returnType",
|
|
860
|
+
"source",
|
|
861
|
+
"sourcePath"
|
|
862
|
+
], Xe = (e) => Array.isArray(e) && e.every((t) => S(t) && typeof t.name == "string");
|
|
863
|
+
function Ze(e, t) {
|
|
864
|
+
const n = `#${t + 1}`;
|
|
865
|
+
if (!S(e) || typeof e.name != "string" || !e.name) {
|
|
866
|
+
const l = S(e) && typeof e.displayName == "string" ? e.displayName : n;
|
|
867
|
+
return { key: `#${t}`, label: l, rawReason: "no name", source: e };
|
|
868
|
+
}
|
|
869
|
+
const s = e.name, r = typeof e.displayName == "string" && e.displayName ? e.displayName : s, i = (l) => ({
|
|
870
|
+
key: s,
|
|
871
|
+
label: r,
|
|
872
|
+
rawReason: l,
|
|
873
|
+
source: e
|
|
874
|
+
}), a = { name: s, kind: W(e) };
|
|
875
|
+
for (const l of be) {
|
|
876
|
+
const f = e[l];
|
|
877
|
+
if (f !== void 0) {
|
|
878
|
+
if (typeof f != "string")
|
|
879
|
+
return i(`"${l}" is not text`);
|
|
880
|
+
a[l] = f;
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
if (e.parameters !== void 0) {
|
|
884
|
+
if (!Xe(e.parameters))
|
|
885
|
+
return i('"parameters" is not a list of named parameters');
|
|
886
|
+
a.parameters = e.parameters;
|
|
887
|
+
}
|
|
888
|
+
if (a.kind === "noCode") {
|
|
889
|
+
if (e.steps !== void 0 && !ge(e.steps))
|
|
890
|
+
return i('"steps" are not no-code steps');
|
|
891
|
+
a.steps = e.steps ?? [];
|
|
892
|
+
}
|
|
893
|
+
return { key: s, label: r, definition: a, source: e };
|
|
894
|
+
}
|
|
895
|
+
function Ge(e) {
|
|
896
|
+
const t = e.definition;
|
|
897
|
+
if (!t)
|
|
898
|
+
return e.source;
|
|
899
|
+
const n = S(e.source) ? e.source : {}, s = { ...n, name: t.name };
|
|
900
|
+
for (const r of be)
|
|
901
|
+
t[r] === void 0 ? delete s[r] : s[r] = t[r];
|
|
902
|
+
return t.parameters === void 0 ? delete s.parameters : s.parameters = t.parameters, t.kind === "noCode" ? s.steps = t.steps ?? [] : W(n) === "noCode" && delete s.steps, delete s.kind, ("kind" in n || W(s) !== t.kind) && (s.kind = t.kind), s;
|
|
903
|
+
}
|
|
904
|
+
function D(e) {
|
|
905
|
+
const t = /* @__PURE__ */ new Set();
|
|
906
|
+
return e.map((n, s) => {
|
|
907
|
+
const r = Ze(n, s);
|
|
908
|
+
return t.has(r.key) && (r.key = `${r.key}#${s}`), t.add(r.key), r;
|
|
909
|
+
});
|
|
910
|
+
}
|
|
911
|
+
function ee(e, t) {
|
|
912
|
+
if (!S(e) || !Object.values(e).every((n) => Array.isArray(n) && n.every((s) => typeof s == "string")))
|
|
913
|
+
throw new Error(`"${t}" is not lists of SQL statements per phase`);
|
|
914
|
+
return e;
|
|
915
|
+
}
|
|
916
|
+
function He(e) {
|
|
917
|
+
const t = e.property ?? "scripts", n = e.phasesProperty ?? "phases", s = t === n, r = (i) => i.scripts.map(Ge);
|
|
918
|
+
return M({
|
|
919
|
+
id: e.id ?? "scripts",
|
|
920
|
+
label: e.label ?? "Scripts",
|
|
921
|
+
labelKey: e.labelKey ?? "devStudio.kind.scripts",
|
|
922
|
+
icon: e.icon ?? "code",
|
|
923
|
+
editor: "scriptList",
|
|
924
|
+
match: e.match,
|
|
925
|
+
select: (i) => {
|
|
926
|
+
if (Array.isArray(i))
|
|
927
|
+
return { scripts: D(i), ...s ? { holds: "scripts" } : {} };
|
|
928
|
+
if (!S(i) || i[t] === void 0 && i[n] === void 0)
|
|
929
|
+
throw new Error(`no "${t}" in this file`);
|
|
930
|
+
const a = i[t];
|
|
931
|
+
if (s)
|
|
932
|
+
return Array.isArray(a) ? { scripts: D(a), holds: "scripts" } : { scripts: [], phases: ee(a, t), holds: "phases" };
|
|
933
|
+
if (a !== void 0 && !Array.isArray(a))
|
|
934
|
+
throw new Error(`"${t}" is not a list`);
|
|
935
|
+
const l = i[n];
|
|
936
|
+
return {
|
|
937
|
+
scripts: D(a ?? []),
|
|
938
|
+
...l !== void 0 ? { phases: ee(l, n) } : {}
|
|
939
|
+
};
|
|
940
|
+
},
|
|
941
|
+
assign: (i, a) => {
|
|
942
|
+
if (a.holds === "phases" && a.scripts.length > 0)
|
|
943
|
+
throw new Error("This file holds database scripts only; add scripts to another file.");
|
|
944
|
+
if (Array.isArray(i) && a.phases === void 0)
|
|
945
|
+
return r(a);
|
|
946
|
+
const l = S(i) ? i : {};
|
|
947
|
+
if (s)
|
|
948
|
+
return {
|
|
949
|
+
...l,
|
|
950
|
+
[t]: a.holds === "phases" ? a.phases ?? {} : r(a)
|
|
951
|
+
};
|
|
952
|
+
const f = { ...l };
|
|
953
|
+
return (t in l || a.scripts.length > 0) && (f[t] = r(a)), a.phases === void 0 ? delete f[n] : f[n] = a.phases, f;
|
|
954
|
+
},
|
|
955
|
+
arrayKey: (i) => i === `/${t}` ? "name" : void 0
|
|
956
|
+
});
|
|
957
|
+
}
|
|
958
|
+
function Ye(e) {
|
|
959
|
+
const n = e.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").split(/[^A-Za-z0-9]+/).filter(Boolean).map((s, r) => r === 0 ? s[0].toLowerCase() + s.slice(1) : s[0].toUpperCase() + s.slice(1)).join("");
|
|
960
|
+
return /^[A-Za-z_]/.test(n) ? n : `script${n}`;
|
|
961
|
+
}
|
|
962
|
+
function jt(e) {
|
|
963
|
+
const t = Ye(e.name), n = e.language ?? We(e.kind)[0], s = {
|
|
964
|
+
name: t,
|
|
965
|
+
kind: e.kind,
|
|
966
|
+
...e.name !== t ? { displayName: e.name } : {},
|
|
967
|
+
...n ? { language: n } : {},
|
|
968
|
+
...e.category ? { category: e.category } : {},
|
|
969
|
+
...e.trigger ? { trigger: e.trigger } : {},
|
|
970
|
+
parameters: []
|
|
971
|
+
}, r = t[0].toUpperCase() + t.slice(1);
|
|
972
|
+
switch (e.kind) {
|
|
973
|
+
case "noCode":
|
|
974
|
+
return { ...s, steps: [] };
|
|
975
|
+
case "sql":
|
|
976
|
+
return { ...s, source: `-- ${e.name}
|
|
977
|
+
SELECT 1;
|
|
978
|
+
` };
|
|
979
|
+
case "backend":
|
|
980
|
+
return {
|
|
981
|
+
...s,
|
|
982
|
+
returnType: "object",
|
|
983
|
+
source: n === "csharp" ? `public static object ${r}(IDictionary<string, object> args)
|
|
984
|
+
{
|
|
985
|
+
return null;
|
|
986
|
+
}
|
|
987
|
+
` : `function ${t}(args) {
|
|
988
|
+
return null;
|
|
989
|
+
}
|
|
990
|
+
`
|
|
991
|
+
};
|
|
992
|
+
case "frontend":
|
|
993
|
+
return {
|
|
994
|
+
...s,
|
|
995
|
+
returnType: "void",
|
|
996
|
+
source: n === "typescript" ? `export function ${t}(): void {
|
|
997
|
+
}
|
|
998
|
+
` : `export function ${t}() {
|
|
999
|
+
}
|
|
1000
|
+
`
|
|
1001
|
+
};
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
const I = (e) => JSON.parse(JSON.stringify(e));
|
|
1005
|
+
function Ot(e) {
|
|
680
1006
|
const t = e.revisions !== !1;
|
|
681
1007
|
let n = 0;
|
|
682
|
-
const
|
|
1008
|
+
const s = e.workspaces.map((o) => ({
|
|
683
1009
|
meta: {
|
|
684
|
-
id:
|
|
685
|
-
label:
|
|
686
|
-
description:
|
|
687
|
-
icon:
|
|
688
|
-
readOnly:
|
|
1010
|
+
id: o.id,
|
|
1011
|
+
label: o.label,
|
|
1012
|
+
description: o.description,
|
|
1013
|
+
icon: o.icon,
|
|
1014
|
+
readOnly: o.readOnly
|
|
689
1015
|
},
|
|
690
|
-
packages: new Map((
|
|
1016
|
+
packages: new Map((o.packages ?? []).map((c) => [c.id, { ...c, workspaceId: o.id }])),
|
|
691
1017
|
modules: new Map(
|
|
692
|
-
|
|
693
|
-
|
|
1018
|
+
o.modules.map((c) => [
|
|
1019
|
+
c.id,
|
|
694
1020
|
{
|
|
695
|
-
...
|
|
1021
|
+
...c,
|
|
696
1022
|
files: new Map(
|
|
697
|
-
Object.entries(
|
|
698
|
-
([
|
|
1023
|
+
Object.entries(c.files).map(
|
|
1024
|
+
([d, p]) => [d, { text: p, version: ++n }]
|
|
699
1025
|
)
|
|
700
1026
|
),
|
|
701
1027
|
revisions: []
|
|
@@ -703,166 +1029,166 @@ function Ue(e) {
|
|
|
703
1029
|
])
|
|
704
1030
|
)
|
|
705
1031
|
}));
|
|
706
|
-
let r = (e.templates ?? []).map((
|
|
707
|
-
const
|
|
708
|
-
const
|
|
709
|
-
if (!
|
|
710
|
-
throw new Error(`Unknown workspace "${
|
|
711
|
-
return
|
|
712
|
-
},
|
|
713
|
-
const
|
|
714
|
-
if (!
|
|
715
|
-
throw new Error(`Unknown module "${
|
|
716
|
-
return
|
|
717
|
-
},
|
|
718
|
-
workspaceId:
|
|
719
|
-
id:
|
|
720
|
-
packageId:
|
|
721
|
-
label:
|
|
722
|
-
description:
|
|
723
|
-
icon:
|
|
724
|
-
version:
|
|
725
|
-
readOnly:
|
|
726
|
-
files: [...
|
|
727
|
-
}),
|
|
728
|
-
path:
|
|
729
|
-
text:
|
|
730
|
-
version: String(
|
|
1032
|
+
let r = (e.templates ?? []).map((o) => I(o));
|
|
1033
|
+
const i = (o) => {
|
|
1034
|
+
const c = s.find((d) => d.meta.id === o);
|
|
1035
|
+
if (!c)
|
|
1036
|
+
throw new Error(`Unknown workspace "${o}"`);
|
|
1037
|
+
return c;
|
|
1038
|
+
}, a = (o) => {
|
|
1039
|
+
const c = i(o.workspaceId).modules.get(o.id);
|
|
1040
|
+
if (!c)
|
|
1041
|
+
throw new Error(`Unknown module "${o.id}"`);
|
|
1042
|
+
return c;
|
|
1043
|
+
}, l = (o, c) => ({
|
|
1044
|
+
workspaceId: o,
|
|
1045
|
+
id: c.id,
|
|
1046
|
+
packageId: c.packageId,
|
|
1047
|
+
label: c.label ?? c.id,
|
|
1048
|
+
description: c.description,
|
|
1049
|
+
icon: c.icon,
|
|
1050
|
+
version: c.version,
|
|
1051
|
+
readOnly: c.readOnly || i(o).meta.readOnly,
|
|
1052
|
+
files: [...c.files.keys()].sort()
|
|
1053
|
+
}), f = (o, c) => ({
|
|
1054
|
+
path: o,
|
|
1055
|
+
text: c.text,
|
|
1056
|
+
version: String(c.version)
|
|
731
1057
|
});
|
|
732
1058
|
return {
|
|
733
1059
|
async listWorkspaces() {
|
|
734
|
-
return
|
|
1060
|
+
return s.map((o) => ({ ...o.meta }));
|
|
735
1061
|
},
|
|
736
|
-
async listModules(
|
|
737
|
-
return [...
|
|
1062
|
+
async listModules(o) {
|
|
1063
|
+
return [...i(o).modules.values()].map((d) => l(o, d));
|
|
738
1064
|
},
|
|
739
|
-
async listPackages(
|
|
740
|
-
const
|
|
741
|
-
return [...
|
|
1065
|
+
async listPackages(o) {
|
|
1066
|
+
const c = i(o), d = [...c.packages.values()], p = [...new Set([...c.modules.values()].map((h) => h.packageId).filter(Boolean))].filter((h) => !c.packages.has(h)).map((h) => ({ id: h, workspaceId: o, label: h, derived: !0 }));
|
|
1067
|
+
return [...d, ...p];
|
|
742
1068
|
},
|
|
743
|
-
async readModule(
|
|
744
|
-
return [...
|
|
1069
|
+
async readModule(o) {
|
|
1070
|
+
return [...a(o).files.entries()].map(([d, p]) => f(d, p));
|
|
745
1071
|
},
|
|
746
|
-
async writeModule(
|
|
747
|
-
const
|
|
748
|
-
if (
|
|
749
|
-
throw new Error(`Module "${
|
|
750
|
-
const
|
|
751
|
-
const m =
|
|
752
|
-
return m ? String(m.version) !==
|
|
753
|
-
}).map((
|
|
1072
|
+
async writeModule(o, c) {
|
|
1073
|
+
const d = a(o);
|
|
1074
|
+
if (d.readOnly || i(o.workspaceId).meta.readOnly)
|
|
1075
|
+
throw new Error(`Module "${o.id}" is read-only`);
|
|
1076
|
+
const p = c.filter((u) => u.baseVersion !== void 0).filter((u) => {
|
|
1077
|
+
const m = d.files.get(u.path);
|
|
1078
|
+
return m ? String(m.version) !== u.baseVersion : !1;
|
|
1079
|
+
}).map((u) => {
|
|
754
1080
|
var m;
|
|
755
|
-
return { path:
|
|
1081
|
+
return { path: u.path, currentVersion: String((m = d.files.get(u.path)) == null ? void 0 : m.version) };
|
|
756
1082
|
});
|
|
757
|
-
if (
|
|
758
|
-
return { ok: !1, conflicts:
|
|
1083
|
+
if (p.length > 0)
|
|
1084
|
+
return { ok: !1, conflicts: p };
|
|
759
1085
|
let h;
|
|
760
1086
|
if (t) {
|
|
761
|
-
const
|
|
762
|
-
for (const [m,
|
|
763
|
-
|
|
764
|
-
h = `r${++n}`,
|
|
1087
|
+
const u = {};
|
|
1088
|
+
for (const [m, k] of d.files)
|
|
1089
|
+
u[m] = k.text;
|
|
1090
|
+
h = `r${++n}`, d.revisions.unshift({
|
|
765
1091
|
id: h,
|
|
766
1092
|
timestamp: Date.now(),
|
|
767
1093
|
label: h,
|
|
768
|
-
summary:
|
|
769
|
-
files:
|
|
1094
|
+
summary: c.map((m) => `${m.type} ${m.path}`).join(", "),
|
|
1095
|
+
files: u
|
|
770
1096
|
});
|
|
771
1097
|
}
|
|
772
1098
|
const g = {};
|
|
773
|
-
for (const
|
|
774
|
-
if (
|
|
775
|
-
|
|
1099
|
+
for (const u of c)
|
|
1100
|
+
if (u.type === "delete")
|
|
1101
|
+
d.files.delete(u.path);
|
|
776
1102
|
else {
|
|
777
1103
|
const m = ++n;
|
|
778
|
-
|
|
1104
|
+
d.files.set(u.path, { text: u.text, version: m }), g[u.path] = String(m);
|
|
779
1105
|
}
|
|
780
1106
|
return { ok: !0, versions: g, revision: h };
|
|
781
1107
|
},
|
|
782
|
-
async createModule(
|
|
783
|
-
const
|
|
784
|
-
if (
|
|
785
|
-
throw new Error(`Workspace "${
|
|
786
|
-
if (
|
|
787
|
-
throw new Error(`Module "${
|
|
788
|
-
const
|
|
789
|
-
id:
|
|
790
|
-
packageId:
|
|
1108
|
+
async createModule(o) {
|
|
1109
|
+
const c = i(o.workspaceId);
|
|
1110
|
+
if (c.meta.readOnly)
|
|
1111
|
+
throw new Error(`Workspace "${o.workspaceId}" is read-only`);
|
|
1112
|
+
if (c.modules.has(o.id))
|
|
1113
|
+
throw new Error(`Module "${o.id}" already exists`);
|
|
1114
|
+
const d = {
|
|
1115
|
+
id: o.id,
|
|
1116
|
+
packageId: o.packageId,
|
|
791
1117
|
files: new Map(
|
|
792
|
-
|
|
1118
|
+
o.files.map((p) => [p.path, { text: p.text, version: ++n }])
|
|
793
1119
|
),
|
|
794
1120
|
revisions: []
|
|
795
1121
|
};
|
|
796
|
-
return
|
|
1122
|
+
return c.modules.set(o.id, d), l(o.workspaceId, d);
|
|
797
1123
|
},
|
|
798
|
-
async deleteModule(
|
|
799
|
-
const
|
|
800
|
-
if (
|
|
801
|
-
throw new Error(`Workspace "${
|
|
802
|
-
|
|
1124
|
+
async deleteModule(o) {
|
|
1125
|
+
const c = i(o.workspaceId);
|
|
1126
|
+
if (c.meta.readOnly)
|
|
1127
|
+
throw new Error(`Workspace "${o.workspaceId}" is read-only`);
|
|
1128
|
+
c.modules.delete(o.id);
|
|
803
1129
|
},
|
|
804
|
-
async savePackage(
|
|
805
|
-
return
|
|
1130
|
+
async savePackage(o) {
|
|
1131
|
+
return i(o.workspaceId).packages.set(o.id, { ...o, derived: !1 }), { ...o, derived: !1 };
|
|
806
1132
|
},
|
|
807
|
-
async deletePackage(
|
|
808
|
-
|
|
1133
|
+
async deletePackage(o) {
|
|
1134
|
+
i(o.workspaceId).packages.delete(o.id);
|
|
809
1135
|
},
|
|
810
1136
|
async listTemplates() {
|
|
811
|
-
return r.map((
|
|
1137
|
+
return r.map((o) => I(o));
|
|
812
1138
|
},
|
|
813
|
-
async saveTemplate(
|
|
814
|
-
const
|
|
815
|
-
return r = h >= 0 ? r.map((g,
|
|
1139
|
+
async saveTemplate(o, c) {
|
|
1140
|
+
const d = (c == null ? void 0 : c.previousId) ?? o.id, p = I(o), h = r.findIndex((g) => g.id === d);
|
|
1141
|
+
return r = h >= 0 ? r.map((g, u) => u === h ? p : g) : [...r, p], I(p);
|
|
816
1142
|
},
|
|
817
|
-
async deleteTemplate(
|
|
818
|
-
r = r.filter((
|
|
1143
|
+
async deleteTemplate(o) {
|
|
1144
|
+
r = r.filter((c) => c.id !== o);
|
|
819
1145
|
},
|
|
820
|
-
async listRevisions(
|
|
821
|
-
return
|
|
1146
|
+
async listRevisions(o, c) {
|
|
1147
|
+
return a(o).revisions.filter((d) => !c || c in d.files).map(({ files: d, ...p }) => ({ ...p, ...c ? { path: c } : {} }));
|
|
822
1148
|
},
|
|
823
|
-
async readRevision(
|
|
824
|
-
const
|
|
825
|
-
if (!
|
|
826
|
-
throw new Error(`Unknown revision "${
|
|
827
|
-
return
|
|
1149
|
+
async readRevision(o, c, d) {
|
|
1150
|
+
const p = a(o).revisions.find((h) => h.id === c);
|
|
1151
|
+
if (!p)
|
|
1152
|
+
throw new Error(`Unknown revision "${c}"`);
|
|
1153
|
+
return d ? p.files[d] ?? "" : JSON.stringify(p.files, null, 2);
|
|
828
1154
|
},
|
|
829
|
-
async rollback(
|
|
830
|
-
const
|
|
1155
|
+
async rollback(o, c, d) {
|
|
1156
|
+
const p = a(o), h = p.revisions.find((u) => u.id === c);
|
|
831
1157
|
if (!h)
|
|
832
|
-
throw new Error(`Unknown revision "${
|
|
833
|
-
const g =
|
|
834
|
-
if (!
|
|
835
|
-
for (const
|
|
836
|
-
|
|
837
|
-
for (const [
|
|
838
|
-
m !== void 0 &&
|
|
1158
|
+
throw new Error(`Unknown revision "${c}"`);
|
|
1159
|
+
const g = d ? { [d]: h.files[d] } : h.files;
|
|
1160
|
+
if (!d)
|
|
1161
|
+
for (const u of [...p.files.keys()])
|
|
1162
|
+
u in g || p.files.delete(u);
|
|
1163
|
+
for (const [u, m] of Object.entries(g))
|
|
1164
|
+
m !== void 0 && p.files.set(u, { text: m, version: ++n });
|
|
839
1165
|
},
|
|
840
1166
|
snapshot() {
|
|
841
1167
|
return {
|
|
842
|
-
workspaces:
|
|
843
|
-
...
|
|
844
|
-
packages: [...
|
|
845
|
-
modules: [...
|
|
846
|
-
id:
|
|
847
|
-
packageId:
|
|
848
|
-
label:
|
|
849
|
-
description:
|
|
850
|
-
icon:
|
|
851
|
-
version:
|
|
852
|
-
readOnly:
|
|
853
|
-
files: Object.fromEntries([...
|
|
1168
|
+
workspaces: s.map((o) => ({
|
|
1169
|
+
...o.meta,
|
|
1170
|
+
packages: [...o.packages.values()].map(({ workspaceId: c, ...d }) => d),
|
|
1171
|
+
modules: [...o.modules.values()].map((c) => ({
|
|
1172
|
+
id: c.id,
|
|
1173
|
+
packageId: c.packageId,
|
|
1174
|
+
label: c.label,
|
|
1175
|
+
description: c.description,
|
|
1176
|
+
icon: c.icon,
|
|
1177
|
+
version: c.version,
|
|
1178
|
+
readOnly: c.readOnly,
|
|
1179
|
+
files: Object.fromEntries([...c.files.entries()].map(([d, p]) => [d, p.text]))
|
|
854
1180
|
}))
|
|
855
1181
|
})),
|
|
856
|
-
templates: r.map((
|
|
1182
|
+
templates: r.map((o) => I(o)),
|
|
857
1183
|
revisions: t
|
|
858
1184
|
};
|
|
859
1185
|
}
|
|
860
1186
|
};
|
|
861
1187
|
}
|
|
862
|
-
function
|
|
1188
|
+
function At(e) {
|
|
863
1189
|
return e;
|
|
864
1190
|
}
|
|
865
|
-
function
|
|
1191
|
+
function B(e, t) {
|
|
866
1192
|
if (!t || e === void 0 || e === null)
|
|
867
1193
|
return !0;
|
|
868
1194
|
if (t.enum && !t.enum.includes(e))
|
|
@@ -877,71 +1203,71 @@ function L(e, t) {
|
|
|
877
1203
|
case "boolean":
|
|
878
1204
|
return typeof e == "boolean";
|
|
879
1205
|
case "array":
|
|
880
|
-
return Array.isArray(e) && (!t.items || e.every((n) =>
|
|
1206
|
+
return Array.isArray(e) && (!t.items || e.every((n) => B(n, t.items)));
|
|
881
1207
|
case "object": {
|
|
882
1208
|
if (typeof e != "object" || Array.isArray(e))
|
|
883
1209
|
return !1;
|
|
884
1210
|
const n = t.properties;
|
|
885
|
-
return !n || Object.entries(e).every(([
|
|
1211
|
+
return !n || Object.entries(e).every(([s, r]) => s in n && B(r, n[s]));
|
|
886
1212
|
}
|
|
887
1213
|
default:
|
|
888
1214
|
return !0;
|
|
889
1215
|
}
|
|
890
1216
|
}
|
|
891
|
-
function
|
|
892
|
-
var
|
|
893
|
-
const n = (e.fields ?? []).map((
|
|
894
|
-
if (!e.schema || !
|
|
1217
|
+
function Et(e, t) {
|
|
1218
|
+
var a;
|
|
1219
|
+
const n = (e.fields ?? []).map((l) => l.name), s = (a = e.schema) == null ? void 0 : a.properties;
|
|
1220
|
+
if (!e.schema || !s)
|
|
895
1221
|
return { section: e, keys: n };
|
|
896
|
-
const r = Object.entries(
|
|
897
|
-
([
|
|
898
|
-
),
|
|
1222
|
+
const r = Object.entries(s).filter(
|
|
1223
|
+
([l, f]) => !(l in t) || B(t[l], f)
|
|
1224
|
+
), i = r.map(([l]) => l);
|
|
899
1225
|
return {
|
|
900
1226
|
section: {
|
|
901
1227
|
...e,
|
|
902
1228
|
schema: {
|
|
903
1229
|
...e.schema,
|
|
904
1230
|
properties: Object.fromEntries(r),
|
|
905
|
-
...e.schema.required ? { required: e.schema.required.filter((
|
|
1231
|
+
...e.schema.required ? { required: e.schema.required.filter((l) => i.includes(l)) } : {}
|
|
906
1232
|
}
|
|
907
1233
|
},
|
|
908
|
-
keys: [...
|
|
1234
|
+
keys: [...i, ...n]
|
|
909
1235
|
};
|
|
910
1236
|
}
|
|
911
|
-
function
|
|
1237
|
+
function Kt(e) {
|
|
912
1238
|
var n;
|
|
913
1239
|
const t = /* @__PURE__ */ new Set();
|
|
914
|
-
for (const
|
|
915
|
-
for (const r of Object.keys(((n =
|
|
1240
|
+
for (const s of e) {
|
|
1241
|
+
for (const r of Object.keys(((n = s.schema) == null ? void 0 : n.properties) ?? {}))
|
|
916
1242
|
t.add(r);
|
|
917
|
-
for (const r of
|
|
1243
|
+
for (const r of s.fields ?? [])
|
|
918
1244
|
t.add(r.name);
|
|
919
1245
|
}
|
|
920
1246
|
return t;
|
|
921
1247
|
}
|
|
922
|
-
function
|
|
1248
|
+
function Nt(e) {
|
|
923
1249
|
return e.map((t) => {
|
|
924
1250
|
const n = t;
|
|
925
1251
|
return {
|
|
926
1252
|
name: String(n.tableName || n.name || "Entity"),
|
|
927
|
-
columns: (Array.isArray(n.fields) ? n.fields : []).map((
|
|
928
|
-
name: String(
|
|
1253
|
+
columns: (Array.isArray(n.fields) ? n.fields : []).map((s) => ({
|
|
1254
|
+
name: String(s.name ?? ""),
|
|
929
1255
|
// seeds spell the type both ways (OmniVerk: `dataType`, older files: `type`)
|
|
930
|
-
dataType: String(
|
|
931
|
-
isPrimaryKey: !!
|
|
932
|
-
isForeignKey: !!(
|
|
1256
|
+
dataType: String(s.dataType ?? s.type ?? "string"),
|
|
1257
|
+
isPrimaryKey: !!s.isPrimaryKey,
|
|
1258
|
+
isForeignKey: !!(s.isForeignKey ?? s.foreignKey)
|
|
933
1259
|
}))
|
|
934
1260
|
};
|
|
935
1261
|
});
|
|
936
1262
|
}
|
|
937
|
-
function
|
|
938
|
-
const t = e.manifest ?? {}, n = String(t.displayName || t.packageName || "Module"),
|
|
939
|
-
id: `view:${
|
|
940
|
-
label:
|
|
1263
|
+
function It(e) {
|
|
1264
|
+
const t = e.manifest ?? {}, n = String(t.displayName || t.packageName || "Module"), s = (e.views ?? []).map((i) => ({
|
|
1265
|
+
id: `view:${i.id}`,
|
|
1266
|
+
label: i.name,
|
|
941
1267
|
type: "view"
|
|
942
|
-
})), r = (e.entities ?? []).map((
|
|
943
|
-
const
|
|
944
|
-
return { id: `entity:${
|
|
1268
|
+
})), r = (e.entities ?? []).map((i) => {
|
|
1269
|
+
const a = String(i.name ?? "Entity");
|
|
1270
|
+
return { id: `entity:${a}`, label: a, type: "entity" };
|
|
945
1271
|
});
|
|
946
1272
|
return {
|
|
947
1273
|
roles: [
|
|
@@ -960,7 +1286,7 @@ function Be(e) {
|
|
|
960
1286
|
label: n,
|
|
961
1287
|
type: "module",
|
|
962
1288
|
children: [
|
|
963
|
-
...
|
|
1289
|
+
...s.length ? [{ id: "views", label: "Views", type: "group", children: s }] : [],
|
|
964
1290
|
...r.length ? [{ id: "entities", label: "Entities", type: "group", children: r }] : []
|
|
965
1291
|
]
|
|
966
1292
|
}
|
|
@@ -968,111 +1294,114 @@ function Be(e) {
|
|
|
968
1294
|
grants: {}
|
|
969
1295
|
};
|
|
970
1296
|
}
|
|
971
|
-
const
|
|
1297
|
+
const H = ye({
|
|
972
1298
|
id: "manifest",
|
|
973
1299
|
label: "Manifest",
|
|
974
1300
|
labelKey: "devStudio.kind.manifest",
|
|
975
1301
|
icon: "file",
|
|
976
1302
|
editor: "manifest",
|
|
977
|
-
match:
|
|
978
|
-
}),
|
|
1303
|
+
match: $(".manifest.json")
|
|
1304
|
+
}), Qe = P({
|
|
979
1305
|
id: "entities",
|
|
980
1306
|
label: "Entities",
|
|
981
1307
|
labelKey: "devStudio.kind.entities",
|
|
982
1308
|
icon: "database",
|
|
983
1309
|
editor: "entities",
|
|
984
|
-
match:
|
|
1310
|
+
match: $(".entities.json"),
|
|
985
1311
|
property: "entities",
|
|
986
1312
|
itemKey: "name"
|
|
987
|
-
}),
|
|
988
|
-
function
|
|
989
|
-
const n = e,
|
|
1313
|
+
}), et = ze();
|
|
1314
|
+
function ke(e, t) {
|
|
1315
|
+
const n = e, s = typeof e == "object" && e !== null && typeof n.id == "string";
|
|
990
1316
|
return {
|
|
991
|
-
key:
|
|
992
|
-
label:
|
|
993
|
-
...
|
|
1317
|
+
key: s ? n.id : `#${t}`,
|
|
1318
|
+
label: s && n.name || (s ? n.id : `#${t + 1}`),
|
|
1319
|
+
...s ? { definition: n } : { rawReason: "no id" },
|
|
994
1320
|
source: e
|
|
995
1321
|
};
|
|
996
1322
|
}
|
|
997
|
-
const
|
|
1323
|
+
const tt = he({
|
|
998
1324
|
id: "views",
|
|
999
1325
|
label: "Views",
|
|
1000
1326
|
labelKey: "devStudio.kind.views",
|
|
1001
1327
|
icon: "grid",
|
|
1002
1328
|
editor: "views",
|
|
1003
|
-
match:
|
|
1329
|
+
match: $(".views.json"),
|
|
1004
1330
|
property: "views",
|
|
1005
1331
|
itemKey: "id",
|
|
1006
|
-
toItem: (e, t) =>
|
|
1332
|
+
toItem: (e, t) => ke(e, t),
|
|
1007
1333
|
fromItem: (e) => e.definition ?? e.source
|
|
1008
|
-
}),
|
|
1334
|
+
}), nt = he({
|
|
1009
1335
|
id: "workflows",
|
|
1010
1336
|
label: "Workflows",
|
|
1011
1337
|
labelKey: "devStudio.kind.workflows",
|
|
1012
1338
|
icon: "git-branch",
|
|
1013
1339
|
editor: "workflows",
|
|
1014
|
-
match:
|
|
1340
|
+
match: $(".workflows.json"),
|
|
1015
1341
|
property: "workflows",
|
|
1016
1342
|
itemKey: "id",
|
|
1017
|
-
toItem: (e, t) =>
|
|
1343
|
+
toItem: (e, t) => ke(e, t),
|
|
1018
1344
|
fromItem: (e) => e.definition ?? e.source
|
|
1019
|
-
}),
|
|
1345
|
+
}), st = P({
|
|
1020
1346
|
id: "dataSources",
|
|
1021
1347
|
label: "Data sources",
|
|
1022
1348
|
labelKey: "devStudio.kind.dataSources",
|
|
1023
1349
|
icon: "database",
|
|
1024
1350
|
editor: "dataSources",
|
|
1025
|
-
match:
|
|
1351
|
+
match: $(".datasources.json"),
|
|
1026
1352
|
property: "dataSources",
|
|
1027
1353
|
itemKey: "key"
|
|
1028
|
-
}),
|
|
1354
|
+
}), rt = ye({
|
|
1029
1355
|
id: "rbac",
|
|
1030
1356
|
label: "Access",
|
|
1031
1357
|
labelKey: "devStudio.kind.rbac",
|
|
1032
1358
|
icon: "shield",
|
|
1033
1359
|
editor: "rbac",
|
|
1034
|
-
match:
|
|
1035
|
-
}),
|
|
1360
|
+
match: $(".rbac.json")
|
|
1361
|
+
}), it = P({
|
|
1036
1362
|
id: "hooks",
|
|
1037
1363
|
label: "Lifecycle hooks",
|
|
1038
1364
|
labelKey: "devStudio.kind.hooks",
|
|
1039
1365
|
icon: "zap",
|
|
1040
1366
|
editor: "hooks",
|
|
1041
|
-
match:
|
|
1367
|
+
match: $(".hooks.json"),
|
|
1042
1368
|
property: "bindings",
|
|
1043
1369
|
itemKey: "id"
|
|
1044
|
-
}),
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1370
|
+
}), ot = He({
|
|
1371
|
+
match: $(".scripts.json")
|
|
1372
|
+
}), at = [
|
|
1373
|
+
H,
|
|
1374
|
+
Qe,
|
|
1375
|
+
et,
|
|
1376
|
+
tt,
|
|
1377
|
+
nt,
|
|
1378
|
+
st,
|
|
1379
|
+
rt,
|
|
1380
|
+
it,
|
|
1381
|
+
ot
|
|
1053
1382
|
];
|
|
1054
|
-
function
|
|
1383
|
+
function te(e) {
|
|
1055
1384
|
return e.normalize("NFKD").replace(/[̀-ͯ]/g, "").replace(/ł/g, "l").replace(/Ł/g, "L").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "module";
|
|
1056
1385
|
}
|
|
1057
|
-
const
|
|
1058
|
-
const t = e.find((n) =>
|
|
1059
|
-
return t ?
|
|
1386
|
+
const ne = (e) => {
|
|
1387
|
+
const t = e.find((n) => H.match(n.path));
|
|
1388
|
+
return t ? _e(t.text, void 0) : void 0;
|
|
1060
1389
|
};
|
|
1061
|
-
function
|
|
1062
|
-
const t = e.find((n) =>
|
|
1390
|
+
function ct(e) {
|
|
1391
|
+
const t = e.find((n) => H.match(n.path));
|
|
1063
1392
|
return t ? K(t.path).replace(/\.manifest\.json$/i, "") : "module";
|
|
1064
1393
|
}
|
|
1065
|
-
const
|
|
1394
|
+
const se = (e) => Array.isArray(e.fields) ? e.fields : [], xt = {
|
|
1066
1395
|
id: "native",
|
|
1067
|
-
kinds:
|
|
1396
|
+
kinds: at,
|
|
1068
1397
|
locales: ["en", "pl", "de", "fr", "es", "uk"],
|
|
1069
1398
|
requiredLocales: ["en"],
|
|
1070
1399
|
moduleId: (e) => {
|
|
1071
|
-
const t =
|
|
1400
|
+
const t = ne(e), n = (t == null ? void 0 : t.id) ?? (t == null ? void 0 : t.packageName);
|
|
1072
1401
|
return typeof n == "string" ? n : void 0;
|
|
1073
1402
|
},
|
|
1074
1403
|
validateModule: ({ files: e }) => {
|
|
1075
|
-
const t =
|
|
1404
|
+
const t = ne(e);
|
|
1076
1405
|
return t ? ["id", "name", "version"].filter((n) => typeof t[n] != "string" || !t[n]).map((n) => ({
|
|
1077
1406
|
severity: "error",
|
|
1078
1407
|
code: "manifest.required",
|
|
@@ -1090,24 +1419,25 @@ const G = (e) => Array.isArray(e.fields) ? e.fields : [], We = {
|
|
|
1090
1419
|
];
|
|
1091
1420
|
},
|
|
1092
1421
|
newFile: (e, { files: t }) => {
|
|
1093
|
-
const n =
|
|
1422
|
+
const n = ct(t), r = {
|
|
1094
1423
|
entities: ["entities.json", { entities: [] }],
|
|
1095
1424
|
views: ["views.json", { views: [] }],
|
|
1096
1425
|
workflows: ["workflows.json", { workflows: [] }],
|
|
1097
1426
|
dataSources: ["datasources.json", { dataSources: [] }],
|
|
1098
1427
|
rbac: ["rbac.json", { roles: [], actions: [], resources: [], grants: {} }],
|
|
1099
|
-
hooks: ["hooks.json", { bindings: [] }]
|
|
1428
|
+
hooks: ["hooks.json", { bindings: [] }],
|
|
1429
|
+
scripts: ["scripts.json", { scripts: [] }]
|
|
1100
1430
|
}[e];
|
|
1101
|
-
return r ? { path: `${n}.${r[0]}`, text:
|
|
1431
|
+
return r ? { path: `${n}.${r[0]}`, text: v(r[1]) } : void 0;
|
|
1102
1432
|
},
|
|
1103
1433
|
generateModule: async (e, { existingIds: t }) => {
|
|
1104
|
-
let n =
|
|
1434
|
+
let n = te(e.name);
|
|
1105
1435
|
for (let r = 2; t.has(n); r++)
|
|
1106
|
-
n = `${
|
|
1107
|
-
const
|
|
1436
|
+
n = `${te(e.name)}-${r}`;
|
|
1437
|
+
const s = [
|
|
1108
1438
|
{
|
|
1109
1439
|
path: `${n}.manifest.json`,
|
|
1110
|
-
text:
|
|
1440
|
+
text: v({
|
|
1111
1441
|
id: n,
|
|
1112
1442
|
name: e.name,
|
|
1113
1443
|
version: "1.0.0",
|
|
@@ -1116,31 +1446,31 @@ const G = (e) => Array.isArray(e.fields) ? e.fields : [], We = {
|
|
|
1116
1446
|
...e.packageId ? { category: e.packageId } : {}
|
|
1117
1447
|
})
|
|
1118
1448
|
},
|
|
1119
|
-
{ path: `${n}.entities.json`, text:
|
|
1449
|
+
{ path: `${n}.entities.json`, text: v({ entities: e.entities }) }
|
|
1120
1450
|
];
|
|
1121
1451
|
for (const r of e.locales) {
|
|
1122
|
-
const
|
|
1123
|
-
for (const
|
|
1124
|
-
const
|
|
1125
|
-
|
|
1126
|
-
for (const
|
|
1127
|
-
|
|
1452
|
+
const i = { "module.displayName": e.name };
|
|
1453
|
+
for (const a of e.entities) {
|
|
1454
|
+
const l = String(a.name ?? "");
|
|
1455
|
+
i[`entity.${l}.displayName`] = l;
|
|
1456
|
+
for (const f of se(a))
|
|
1457
|
+
i[`field.${l}.${String(f.name)}.label`] = String(f.name);
|
|
1128
1458
|
}
|
|
1129
|
-
|
|
1459
|
+
s.push({
|
|
1130
1460
|
path: `${n}.${r}.i18n.json`,
|
|
1131
|
-
text:
|
|
1461
|
+
text: v({ locale: r, translations: i })
|
|
1132
1462
|
});
|
|
1133
1463
|
}
|
|
1134
1464
|
if (e.views) {
|
|
1135
|
-
const r = e.entities.map((
|
|
1136
|
-
const
|
|
1465
|
+
const r = e.entities.map((i) => {
|
|
1466
|
+
const a = String(i.name ?? "Item");
|
|
1137
1467
|
return {
|
|
1138
|
-
id: `${
|
|
1139
|
-
name: `${
|
|
1468
|
+
id: `${a}List`,
|
|
1469
|
+
name: `${a} list`,
|
|
1140
1470
|
kind: "grid",
|
|
1141
1471
|
version: 2,
|
|
1142
1472
|
columns: 12,
|
|
1143
|
-
dataSources: [{ key: "rows", type: "entity", entity:
|
|
1473
|
+
dataSources: [{ key: "rows", type: "entity", entity: a, autoLoad: !0 }],
|
|
1144
1474
|
rows: [
|
|
1145
1475
|
{
|
|
1146
1476
|
id: "r1",
|
|
@@ -1150,9 +1480,9 @@ const G = (e) => Array.isArray(e.fields) ? e.fields : [], We = {
|
|
|
1150
1480
|
controlType: "dataGrid",
|
|
1151
1481
|
colSpan: 12,
|
|
1152
1482
|
props: {
|
|
1153
|
-
columns:
|
|
1154
|
-
field: String(
|
|
1155
|
-
header: String(
|
|
1483
|
+
columns: se(i).map((l) => ({
|
|
1484
|
+
field: String(l.name),
|
|
1485
|
+
header: String(l.name)
|
|
1156
1486
|
}))
|
|
1157
1487
|
},
|
|
1158
1488
|
bindings: { data: { source: "rows", field: "" } }
|
|
@@ -1162,7 +1492,7 @@ const G = (e) => Array.isArray(e.fields) ? e.fields : [], We = {
|
|
|
1162
1492
|
]
|
|
1163
1493
|
};
|
|
1164
1494
|
});
|
|
1165
|
-
|
|
1495
|
+
s.push({ path: `${n}.views.json`, text: v({ views: r }) });
|
|
1166
1496
|
}
|
|
1167
1497
|
if (e.permissions) {
|
|
1168
1498
|
const r = {
|
|
@@ -1176,58 +1506,81 @@ const G = (e) => Array.isArray(e.fields) ? e.fields : [], We = {
|
|
|
1176
1506
|
{ id: "edit", label: "Edit" },
|
|
1177
1507
|
{ id: "delete", label: "Delete" }
|
|
1178
1508
|
],
|
|
1179
|
-
resources: e.entities.map((
|
|
1180
|
-
id: `entity:${String(
|
|
1181
|
-
label: String(
|
|
1509
|
+
resources: e.entities.map((i) => ({
|
|
1510
|
+
id: `entity:${String(i.name)}`,
|
|
1511
|
+
label: String(i.name),
|
|
1182
1512
|
type: "entity"
|
|
1183
1513
|
})),
|
|
1184
1514
|
grants: {}
|
|
1185
1515
|
};
|
|
1186
|
-
|
|
1516
|
+
s.push({ path: `${n}.rbac.json`, text: v(r) });
|
|
1187
1517
|
}
|
|
1188
|
-
return { id: n, packageId: e.packageId, files:
|
|
1518
|
+
return { id: n, packageId: e.packageId, files: s };
|
|
1189
1519
|
}
|
|
1190
1520
|
};
|
|
1191
1521
|
export {
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1522
|
+
Ve as NICE_STUDIO_SCRIPT_KINDS,
|
|
1523
|
+
$t as NICE_STUDIO_SCRIPT_PHASES,
|
|
1524
|
+
yt as addStudioFolder,
|
|
1525
|
+
ht as addStudioSection,
|
|
1526
|
+
P as arrayFileKind,
|
|
1527
|
+
vt as buildDocuments,
|
|
1528
|
+
Ot as createMemoryStudioProvider,
|
|
1529
|
+
At as defineManifestSection,
|
|
1530
|
+
It as deriveDefaultRbac,
|
|
1531
|
+
X as detectJsonTextFormat,
|
|
1532
|
+
J as emptyStudioLayout,
|
|
1533
|
+
St as encodeDocument,
|
|
1534
|
+
$ as endsWithAny,
|
|
1535
|
+
Nt as entitiesToSchemas,
|
|
1201
1536
|
K as fileName,
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1537
|
+
Et as fitManifestSection,
|
|
1538
|
+
Ge as fromStudioScriptItem,
|
|
1539
|
+
ze as i18nFileKind,
|
|
1540
|
+
W as inferStudioScriptKind,
|
|
1541
|
+
ut as isEmptyStudioLayout,
|
|
1542
|
+
$e as isStudioLayoutPath,
|
|
1543
|
+
he as itemsFileKind,
|
|
1544
|
+
q as jsonFallbackKind,
|
|
1545
|
+
M as jsonFileKind,
|
|
1546
|
+
B as jsonValueFitsSchema,
|
|
1547
|
+
C as jsonValuesEqual,
|
|
1548
|
+
Oe as keepTextFormat,
|
|
1549
|
+
Kt as manifestSectionKeys,
|
|
1550
|
+
ct as modulePrefix,
|
|
1551
|
+
st as nativeDataSourcesKind,
|
|
1552
|
+
Qe as nativeEntitiesKind,
|
|
1553
|
+
at as nativeFileKinds,
|
|
1554
|
+
it as nativeHooksKind,
|
|
1555
|
+
et as nativeI18nKind,
|
|
1556
|
+
H as nativeManifestKind,
|
|
1557
|
+
rt as nativeRbacKind,
|
|
1558
|
+
ot as nativeScriptsKind,
|
|
1559
|
+
xt as nativeStudioPreset,
|
|
1560
|
+
tt as nativeViewsKind,
|
|
1561
|
+
nt as nativeWorkflowsKind,
|
|
1562
|
+
jt as newStudioScript,
|
|
1563
|
+
ye as objectFileKind,
|
|
1564
|
+
x as parseJsonText,
|
|
1565
|
+
pt as parseStudioLayout,
|
|
1566
|
+
ae as patchJsonText,
|
|
1567
|
+
Ae as patchJsonTextDetailed,
|
|
1568
|
+
kt as placeStudioEntry,
|
|
1569
|
+
qe as readTranslations,
|
|
1570
|
+
bt as removeStudioLayoutNode,
|
|
1571
|
+
wt as renameStudioEntryRef,
|
|
1572
|
+
gt as renameStudioLayoutNode,
|
|
1573
|
+
Pe as resolveFileKind,
|
|
1574
|
+
_e as safeJson,
|
|
1575
|
+
He as scriptsFileKind,
|
|
1576
|
+
mt as serializeStudioLayout,
|
|
1577
|
+
te as slugifyModuleId,
|
|
1578
|
+
v as stringifyJsonText,
|
|
1579
|
+
dt as studioEntryRef,
|
|
1580
|
+
ft as studioLayoutPath,
|
|
1581
|
+
Ye as studioScriptIdentifier,
|
|
1582
|
+
We as studioScriptLanguages,
|
|
1583
|
+
z as textFallbackKind,
|
|
1584
|
+
Ze as toStudioScriptItem,
|
|
1585
|
+
Q as writeTranslations
|
|
1233
1586
|
};
|