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