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