@aiao/rxdb-client-generator 0.0.12 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{RxDBClientGenerator-8UTHmwAo.js → RxDBClientGenerator-xjVHqGPq.js} +323 -274
- package/dist/{build-client-lib-B9ubrwmh.js → build-client-lib-CGIfjQOF.js} +1 -1
- package/dist/cli.js +1 -1
- package/dist/core/RxDBClientGenerator.utils.d.ts +4 -0
- package/dist/core/RxDBClientGenerator.utils.d.ts.map +1 -1
- package/dist/core/ts-morph-browser.d.ts +18 -0
- package/dist/core/ts-morph-browser.d.ts.map +1 -1
- package/dist/generators/entity-properties.d.ts.map +1 -1
- package/dist/generators/entity-rules.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/vite.js +1 -1
- package/package.json +3 -3
|
@@ -1,31 +1,40 @@
|
|
|
1
|
-
import { PropertyType as d, RelationKind as
|
|
2
|
-
import { omit as
|
|
3
|
-
const
|
|
4
|
-
const t =
|
|
5
|
-
let
|
|
6
|
-
!s && Object.hasOwn(
|
|
7
|
-
const
|
|
1
|
+
import { PropertyType as d, RelationKind as g, ENTITY_BASE_METADATA_OPTIONS as R, TREE_ADJACENCY_LIST_ENTITY_BASE_OPTIONS as O, getEntityMetadata as K, transitionMetadata as x } from "@aiao/rxdb";
|
|
2
|
+
import { omit as V, isNil as F, capitalize as U, unionBy as J, capitalizeFirst as b, isFunction as L } from "@aiao/utils";
|
|
3
|
+
const H = (n, e) => {
|
|
4
|
+
const t = T(n, e), s = !!n.nullable;
|
|
5
|
+
let i = !0;
|
|
6
|
+
!s && Object.hasOwn(n, "default") && (i = !1);
|
|
7
|
+
const a = {
|
|
8
8
|
type: t,
|
|
9
|
-
name:
|
|
9
|
+
name: n.name,
|
|
10
10
|
hasQuestionToken: s,
|
|
11
|
-
hasExclamationToken:
|
|
12
|
-
isReadonly:
|
|
11
|
+
hasExclamationToken: i,
|
|
12
|
+
isReadonly: n.readonly
|
|
13
13
|
};
|
|
14
|
-
return
|
|
15
|
-
},
|
|
14
|
+
return F(n.default) || (a.initializer = z(n, e)), a;
|
|
15
|
+
}, D = (n, e) => `${e.name}${n.name.charAt(0).toUpperCase() + n.name.slice(1)}KeyValue`, S = (n, e) => `${e.name}${n.name.charAt(0).toUpperCase() + n.name.slice(1)}`, Q = (n, e) => n.type !== d.keyValue || !("properties" in n) || !n.properties || n.properties.length === 0 ? "KeyValue" : D(n, e), q = (n, e) => n.type !== d.keyValue || !("properties" in n) || !n.properties || n.properties.length === 0 ? [] : n.properties.map((t) => ({
|
|
16
16
|
name: t.name,
|
|
17
|
-
type:
|
|
17
|
+
type: T(t, e),
|
|
18
18
|
hasQuestionToken: t.nullable || !1,
|
|
19
19
|
docs: t.displayName ? [t.displayName] : void 0
|
|
20
|
-
})),
|
|
20
|
+
})), T = (n, e) => {
|
|
21
21
|
let t = "any";
|
|
22
|
-
switch (
|
|
22
|
+
switch (n.type) {
|
|
23
23
|
case d.uuid:
|
|
24
24
|
t = "UUID";
|
|
25
25
|
break;
|
|
26
26
|
case d.string:
|
|
27
27
|
t = "string";
|
|
28
28
|
break;
|
|
29
|
+
case d.enum: {
|
|
30
|
+
const s = S(n, e), i = "enum" in n ? n.enum : void 0;
|
|
31
|
+
if (Array.isArray(i) && i.length > 0) {
|
|
32
|
+
const a = i.map((r) => `'${r}'`).join(" | ");
|
|
33
|
+
t = `${s} | ${a}`;
|
|
34
|
+
} else
|
|
35
|
+
t = s;
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
29
38
|
case d.number:
|
|
30
39
|
t = "number";
|
|
31
40
|
break;
|
|
@@ -45,98 +54,111 @@ const J = (r, e) => {
|
|
|
45
54
|
t = "number[]";
|
|
46
55
|
break;
|
|
47
56
|
case d.keyValue:
|
|
48
|
-
t =
|
|
57
|
+
t = Q(n, e);
|
|
49
58
|
break;
|
|
50
59
|
case d.json:
|
|
51
60
|
t = "Record<string, any>";
|
|
52
61
|
break;
|
|
53
62
|
}
|
|
54
|
-
return
|
|
55
|
-
},
|
|
56
|
-
switch (
|
|
63
|
+
return n.nullable && (t += " | null"), t;
|
|
64
|
+
}, z = (n, e) => {
|
|
65
|
+
switch (n.type) {
|
|
57
66
|
case d.string:
|
|
58
|
-
return `'${String(
|
|
67
|
+
return `'${String(n.default)}'`;
|
|
68
|
+
case d.enum:
|
|
69
|
+
return `${S(n, e)}.${String(n.default)}`;
|
|
59
70
|
case d.date:
|
|
60
|
-
if (
|
|
71
|
+
if (n.default)
|
|
61
72
|
return "new Date()";
|
|
62
73
|
break;
|
|
63
74
|
}
|
|
64
75
|
return "";
|
|
65
|
-
},
|
|
66
|
-
if (
|
|
67
|
-
if (typeof
|
|
68
|
-
if (Array.isArray(
|
|
69
|
-
for (const t of
|
|
70
|
-
|
|
76
|
+
}, M = (n, e = /* @__PURE__ */ new Set()) => {
|
|
77
|
+
if (n == null) return e;
|
|
78
|
+
if (typeof n == "object")
|
|
79
|
+
if (Array.isArray(n))
|
|
80
|
+
for (const t of n)
|
|
81
|
+
M(t, e);
|
|
71
82
|
else
|
|
72
|
-
for (const t in
|
|
73
|
-
Object.prototype.hasOwnProperty.call(
|
|
83
|
+
for (const t in n)
|
|
84
|
+
Object.prototype.hasOwnProperty.call(n, t) && (e.add(t), M(n[t], e));
|
|
74
85
|
return e;
|
|
75
|
-
},
|
|
76
|
-
Object.keys(d).forEach((
|
|
77
|
-
const e = d[
|
|
78
|
-
typeof e == "string" &&
|
|
86
|
+
}, j = /* @__PURE__ */ new Map();
|
|
87
|
+
Object.keys(d).forEach((n) => {
|
|
88
|
+
const e = d[n];
|
|
89
|
+
typeof e == "string" && j.set(e, n);
|
|
79
90
|
});
|
|
80
|
-
const
|
|
81
|
-
Object.keys(
|
|
82
|
-
const e =
|
|
83
|
-
typeof e == "string" &&
|
|
91
|
+
const C = /* @__PURE__ */ new Map();
|
|
92
|
+
Object.keys(g).forEach((n) => {
|
|
93
|
+
const e = g[n];
|
|
94
|
+
typeof e == "string" && C.set(e, n);
|
|
84
95
|
});
|
|
85
|
-
function
|
|
86
|
-
const e =
|
|
96
|
+
function W(n) {
|
|
97
|
+
const e = V(n, ["propertyMap", "relationMap", "indexMap"]), t = M(e);
|
|
87
98
|
let s = JSON.stringify(e, null, 2);
|
|
88
|
-
return new Set(
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
}),
|
|
92
|
-
const o =
|
|
93
|
-
o && (s = s.replaceAll(`"kind": "${
|
|
94
|
-
}), t.forEach((
|
|
95
|
-
|
|
99
|
+
return new Set(n.properties.map((a) => a.type).filter(Boolean)).forEach((a) => {
|
|
100
|
+
const r = j.get(a);
|
|
101
|
+
r && (s = s.replaceAll(`"type": "${a}"`, `"type": PropertyType.${r}`));
|
|
102
|
+
}), n.relations && new Set(n.relations.map((r) => r.kind)).forEach((r) => {
|
|
103
|
+
const o = C.get(r);
|
|
104
|
+
o && (s = s.replaceAll(`"kind": "${r}"`, `"kind": RelationKind.${o}`));
|
|
105
|
+
}), t.forEach((a) => {
|
|
106
|
+
a.includes("-") || a.includes(" ") || (s = s.replaceAll(`"${a}":`, `${a}:`));
|
|
96
107
|
}), s;
|
|
97
108
|
}
|
|
98
|
-
const
|
|
99
|
-
classProperties:
|
|
109
|
+
const Z = ({
|
|
110
|
+
classProperties: n,
|
|
100
111
|
metadata: e,
|
|
101
112
|
file: t,
|
|
102
113
|
rxdbNamedImports: s
|
|
103
114
|
}) => {
|
|
104
|
-
const
|
|
115
|
+
const i = t.addInterface({
|
|
105
116
|
name: `${e.name}InitData`,
|
|
106
117
|
isExported: !0,
|
|
107
118
|
docs: ["初始化数据"]
|
|
108
|
-
}),
|
|
109
|
-
if (
|
|
110
|
-
const
|
|
111
|
-
name:
|
|
119
|
+
}), a = (r, o = !1) => {
|
|
120
|
+
if (r.type === d.keyValue && "properties" in r && r.properties && r.properties.length > 0) {
|
|
121
|
+
const m = D(r, e), f = t.addInterface({
|
|
122
|
+
name: m,
|
|
112
123
|
isExported: !0,
|
|
113
|
-
docs: [
|
|
114
|
-
});
|
|
115
|
-
H(n, e).forEach((m) => {
|
|
116
|
-
g.addProperty(m);
|
|
124
|
+
docs: [r.displayName || `${r.name} keyValue 类型`]
|
|
117
125
|
});
|
|
126
|
+
q(r, e).forEach((y) => f.addProperty(y));
|
|
118
127
|
}
|
|
119
|
-
|
|
120
|
-
|
|
128
|
+
if (r.type === d.enum && "enum" in r) {
|
|
129
|
+
const m = r;
|
|
130
|
+
if (m.enum && m.enum.length > 0) {
|
|
131
|
+
const f = S(r, e);
|
|
132
|
+
t.addEnum({
|
|
133
|
+
name: f,
|
|
134
|
+
isExported: !0,
|
|
135
|
+
docs: [r.displayName || `${r.name} 枚举类型`],
|
|
136
|
+
members: m.enum.map((p) => ({
|
|
137
|
+
name: p.split(/[-_\s]+/).map((y) => U(y)).join(""),
|
|
138
|
+
value: p
|
|
139
|
+
}))
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
const c = H(r, e), { initializer: u, ...h } = c, l = [];
|
|
144
|
+
l.push(r.displayName || r.name), u && l.push(`@default ${u}`), c.type === "UUID" && s.add("UUID"), o || i.addProperty({
|
|
121
145
|
name: c.name,
|
|
122
146
|
type: c.type,
|
|
123
147
|
hasQuestionToken: !0,
|
|
124
148
|
docs: l
|
|
125
|
-
}),
|
|
149
|
+
}), n.push({
|
|
126
150
|
...h,
|
|
127
151
|
hasExclamationToken: !1,
|
|
128
|
-
isReadonly:
|
|
152
|
+
isReadonly: r.readonly || !1,
|
|
129
153
|
docs: l
|
|
130
154
|
});
|
|
131
155
|
};
|
|
132
|
-
e.properties.forEach((
|
|
133
|
-
i(n);
|
|
134
|
-
}), Array.from(e.computedPropertyMap.values()).forEach((n) => {
|
|
156
|
+
e.properties.forEach((r) => a(r)), Array.from(e.computedPropertyMap.values()).forEach((r) => {
|
|
135
157
|
let o = e.features || {};
|
|
136
|
-
e.repository === "GraphRepository" || e.extends.includes("GraphRepository") ? o = e.features?.graph || {} : (e.repository === "TreeRepository" || e.extends.includes("TreeRepository")) && (o = e.features?.tree || {}), o[
|
|
158
|
+
e.repository === "GraphRepository" || e.extends.includes("GraphRepository") ? o = e.features?.graph || {} : (e.repository === "TreeRepository" || e.extends.includes("TreeRepository")) && (o = e.features?.tree || {}), o[r.name] && a(r, !0);
|
|
137
159
|
});
|
|
138
|
-
},
|
|
139
|
-
const e =
|
|
160
|
+
}, A = (n) => {
|
|
161
|
+
const e = n.propertyMap.get("id");
|
|
140
162
|
if (!e) return "UUID";
|
|
141
163
|
switch (e.type) {
|
|
142
164
|
case d.uuid:
|
|
@@ -148,141 +170,142 @@ const z = ({
|
|
|
148
170
|
default:
|
|
149
171
|
return "UUID";
|
|
150
172
|
}
|
|
151
|
-
},
|
|
152
|
-
classProperties:
|
|
173
|
+
}, X = ({
|
|
174
|
+
classProperties: n,
|
|
153
175
|
metadata: e,
|
|
154
176
|
rxdbNamedImports: t,
|
|
155
177
|
generator: s
|
|
156
178
|
}) => {
|
|
157
|
-
Array.from(e.relationMap.values()).forEach((
|
|
158
|
-
switch (
|
|
179
|
+
Array.from(e.relationMap.values()).forEach((i) => {
|
|
180
|
+
switch (i.kind) {
|
|
159
181
|
// 处理一对一和多对一关系
|
|
160
182
|
// 这两种关系需要生成:
|
|
161
183
|
// 1. 关系可观察对象属性(name$)- 用于访问关联实体
|
|
162
184
|
// 2. 外键ID属性(nameId)- 存储关联实体的ID
|
|
163
|
-
case
|
|
164
|
-
case
|
|
185
|
+
case g.ONE_TO_ONE:
|
|
186
|
+
case g.MANY_TO_ONE:
|
|
165
187
|
{
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
name:
|
|
188
|
+
const a = `RelationEntityObservable<typeof ${i.mappedEntity}>`, r = i.displayName || i.name;
|
|
189
|
+
n.push({
|
|
190
|
+
name: i.name + "$",
|
|
169
191
|
// 关系属性名使用$后缀,表示可观察对象
|
|
170
|
-
type:
|
|
192
|
+
type: a,
|
|
171
193
|
isReadonly: !0,
|
|
172
194
|
// 关系属性是只读的,通过set/remove方法修改
|
|
173
|
-
docs: [
|
|
195
|
+
docs: [r]
|
|
174
196
|
});
|
|
175
|
-
const o = s.getMetadata(
|
|
176
|
-
|
|
177
|
-
name:
|
|
197
|
+
const o = s.getMetadata(i.mappedEntity, i.mappedNamespace), c = A(o);
|
|
198
|
+
n.push({
|
|
199
|
+
name: i.name + "Id",
|
|
178
200
|
// 外键ID属性
|
|
179
201
|
// 当关系 nullable 时,id 既可能不存在(undefined),也可能为 null(根节点),或为有效 id
|
|
180
202
|
// 使用 ?: 与 "| null" 组合表达三种状态
|
|
181
|
-
type:
|
|
203
|
+
type: i.nullable ? `${c} | null` : c,
|
|
182
204
|
isReadonly: !1,
|
|
183
|
-
hasQuestionToken:
|
|
184
|
-
docs: [
|
|
205
|
+
hasQuestionToken: i.nullable,
|
|
206
|
+
docs: [r + " id"]
|
|
185
207
|
}), t.add("RelationEntityObservable");
|
|
186
208
|
}
|
|
187
209
|
break;
|
|
188
210
|
// 处理一对多和多对多关系
|
|
189
211
|
// 这两种关系只需要生成关系可观察集合属性(name$)
|
|
190
212
|
// 不需要外键ID属性,因为外键存储在关联实体或中间表中
|
|
191
|
-
case
|
|
192
|
-
case
|
|
213
|
+
case g.ONE_TO_MANY:
|
|
214
|
+
case g.MANY_TO_MANY:
|
|
193
215
|
{
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
name:
|
|
216
|
+
const a = i.displayName || i.name, r = `RelationEntitiesObservable<${i.mappedEntity}>`;
|
|
217
|
+
n.push({
|
|
218
|
+
name: i.name + "$",
|
|
197
219
|
// 关系集合属性名使用$后缀
|
|
198
220
|
isReadonly: !0,
|
|
199
221
|
// 关系属性是只读的,通过add/remove方法修改
|
|
200
|
-
type:
|
|
201
|
-
docs: [
|
|
222
|
+
type: r,
|
|
223
|
+
docs: [a]
|
|
202
224
|
}), t.add("RelationEntitiesObservable");
|
|
203
225
|
}
|
|
204
226
|
break;
|
|
205
227
|
}
|
|
206
228
|
});
|
|
207
|
-
},
|
|
208
|
-
const s = /* @__PURE__ */ new Set(), { name:
|
|
209
|
-
|
|
229
|
+
}, ee = (n, e, t) => {
|
|
230
|
+
const s = /* @__PURE__ */ new Set(), { name: i } = e, a = e.extends[0] || "", r = [];
|
|
231
|
+
a.includes("TreeAdjacencyListEntityBase") ? r.push("ITreeEntity") : a.includes("EntityBase") && r.push("IEntity"), s.add(a);
|
|
210
232
|
const o = t.addClass({
|
|
211
|
-
name:
|
|
233
|
+
name: i,
|
|
212
234
|
isExported: !0,
|
|
213
|
-
extends:
|
|
214
|
-
implements:
|
|
235
|
+
extends: a,
|
|
236
|
+
implements: r.sort(),
|
|
215
237
|
decorators: [],
|
|
216
238
|
hasDeclareKeyword: !0
|
|
217
239
|
});
|
|
218
240
|
o.addJsDoc(`${e.displayName}`);
|
|
219
241
|
const c = [];
|
|
220
242
|
c.push({
|
|
221
|
-
type: `${
|
|
243
|
+
type: `${i}StaticTypes`,
|
|
222
244
|
name: "[ENTITY_STATIC_TYPES]",
|
|
223
245
|
isStatic: !0
|
|
224
246
|
}), s.add("ENTITY_STATIC_TYPES");
|
|
225
247
|
const u = t.addInterface({
|
|
226
|
-
name: `${
|
|
248
|
+
name: `${i}StaticTypes`,
|
|
227
249
|
docs: ["静态类型"],
|
|
228
250
|
isExported: !0
|
|
229
251
|
}), h = [];
|
|
230
|
-
|
|
252
|
+
Z({
|
|
231
253
|
classProperties: c,
|
|
232
254
|
file: t,
|
|
233
255
|
metadata: e,
|
|
234
256
|
rxdbNamedImports: s
|
|
235
|
-
}),
|
|
257
|
+
}), X({
|
|
236
258
|
classProperties: c,
|
|
237
259
|
metadata: e,
|
|
238
260
|
rxdbNamedImports: s,
|
|
239
|
-
generator:
|
|
261
|
+
generator: n
|
|
240
262
|
});
|
|
241
|
-
const l = e.repository || I,
|
|
242
|
-
if (
|
|
263
|
+
const l = e.repository || I, m = n.getRepositoryGenerator(l);
|
|
264
|
+
if (m) {
|
|
243
265
|
if (l !== I) {
|
|
244
|
-
const p =
|
|
266
|
+
const p = n.getRepositoryGenerator(I);
|
|
245
267
|
p && p.generate({
|
|
246
268
|
metadata: e,
|
|
247
269
|
classProperties: c,
|
|
248
270
|
classMethods: h,
|
|
249
271
|
rxdbNamedImports: s,
|
|
250
|
-
generator:
|
|
272
|
+
generator: n,
|
|
251
273
|
file: t,
|
|
252
274
|
staticTypesInterface: u
|
|
253
275
|
});
|
|
254
276
|
}
|
|
255
|
-
|
|
277
|
+
m.generate({
|
|
256
278
|
metadata: e,
|
|
257
279
|
classProperties: c,
|
|
258
280
|
classMethods: h,
|
|
259
281
|
rxdbNamedImports: s,
|
|
260
|
-
generator:
|
|
282
|
+
generator: n,
|
|
261
283
|
file: t,
|
|
262
284
|
staticTypesInterface: u
|
|
263
285
|
});
|
|
264
286
|
}
|
|
265
287
|
o.addProperties(
|
|
266
|
-
c.sort((p,
|
|
288
|
+
c.sort((p, y) => p.isStatic && !y.isStatic ? -1 : !p.isStatic && y.isStatic ? 1 : p.isReadonly && !y.isReadonly ? -1 : !p.isReadonly && y.isReadonly ? 1 : p.name.localeCompare(y.name))
|
|
267
289
|
), o.addConstructor({
|
|
268
290
|
parameters: [
|
|
269
291
|
{
|
|
270
292
|
name: "initData",
|
|
271
|
-
type: `${
|
|
293
|
+
type: `${i}InitData`,
|
|
272
294
|
hasQuestionToken: !0
|
|
273
295
|
}
|
|
274
296
|
],
|
|
275
297
|
docs: ["初始化数据", "@param initData 初始化数据"]
|
|
276
298
|
});
|
|
277
|
-
const
|
|
278
|
-
(p,
|
|
299
|
+
const f = J(h, (p) => p.name).sort(
|
|
300
|
+
(p, y) => p.isStatic && !y.isStatic ? -1 : !p.isStatic && y.isStatic ? 1 : p.name.localeCompare(y.name)
|
|
279
301
|
);
|
|
280
|
-
return o.addMethods(
|
|
302
|
+
return o.addMethods(f), {
|
|
281
303
|
rxdbNamedImports: s
|
|
282
304
|
};
|
|
283
|
-
},
|
|
305
|
+
}, te = {
|
|
284
306
|
[d.uuid]: "UUID",
|
|
285
307
|
[d.string]: "String",
|
|
308
|
+
[d.enum]: "String",
|
|
286
309
|
[d.number]: "Number",
|
|
287
310
|
[d.integer]: "Number",
|
|
288
311
|
[d.boolean]: "Boolean",
|
|
@@ -290,12 +313,12 @@ const z = ({
|
|
|
290
313
|
[d.stringArray]: "StringArray",
|
|
291
314
|
[d.numberArray]: "NumberArray",
|
|
292
315
|
[d.keyValue]: "KeyValue"
|
|
293
|
-
},
|
|
294
|
-
const s =
|
|
316
|
+
}, N = (n) => te[n] ?? null, k = (n, e, t) => {
|
|
317
|
+
const s = n.length > 0 ? n.map((i) => i.key).join(".") + "." : "";
|
|
295
318
|
return t ? `${s}${e}.${t}` : `${s}${e}`;
|
|
296
|
-
},
|
|
319
|
+
}, se = (n, e, t) => {
|
|
297
320
|
let s;
|
|
298
|
-
switch (
|
|
321
|
+
switch (n.type) {
|
|
299
322
|
case d.stringArray:
|
|
300
323
|
s = "string";
|
|
301
324
|
break;
|
|
@@ -303,71 +326,71 @@ const z = ({
|
|
|
303
326
|
s = "number";
|
|
304
327
|
break;
|
|
305
328
|
case d.keyValue:
|
|
306
|
-
s = `Partial<${
|
|
329
|
+
s = `Partial<${D(n, e)}>`;
|
|
307
330
|
break;
|
|
308
331
|
default:
|
|
309
|
-
t.length > 0 && (s =
|
|
332
|
+
t.length > 0 && (s = T(n, e));
|
|
310
333
|
}
|
|
311
334
|
return s;
|
|
312
|
-
}, E = (
|
|
313
|
-
rule: `${
|
|
335
|
+
}, E = (n, e, t, s, i) => ({
|
|
336
|
+
rule: `${n}Rules`,
|
|
314
337
|
entity: e,
|
|
315
338
|
key: t,
|
|
316
339
|
valueType: s,
|
|
317
|
-
subRuleGroup:
|
|
318
|
-
}),
|
|
319
|
-
|
|
320
|
-
const
|
|
321
|
-
if (!
|
|
322
|
-
const o =
|
|
323
|
-
|
|
340
|
+
subRuleGroup: i
|
|
341
|
+
}), ne = (n, e, t, s, i) => {
|
|
342
|
+
n.type !== d.keyValue || !("properties" in n) || !n.properties || n.properties.forEach((a) => {
|
|
343
|
+
const r = N(a.type);
|
|
344
|
+
if (!r) return;
|
|
345
|
+
const o = k(t, s, a.name), c = T(a, e);
|
|
346
|
+
i.push(E(r, e.name, o, c));
|
|
324
347
|
});
|
|
325
|
-
},
|
|
348
|
+
}, re = (n, e = []) => {
|
|
326
349
|
const t = [];
|
|
327
|
-
return Array.from(
|
|
328
|
-
const
|
|
329
|
-
if (
|
|
330
|
-
const
|
|
331
|
-
t.push(E(
|
|
350
|
+
return Array.from(n.propertyMap.keys()).forEach((s) => {
|
|
351
|
+
const i = n.propertyMap.get(s), a = N(i.type);
|
|
352
|
+
if (a) {
|
|
353
|
+
const r = se(i, n, e), o = k(e, s);
|
|
354
|
+
t.push(E(a, n.name, o, r));
|
|
332
355
|
}
|
|
333
|
-
|
|
356
|
+
ne(i, n, e, s, t);
|
|
334
357
|
}), t;
|
|
335
|
-
},
|
|
358
|
+
}, ie = (n, e, t) => {
|
|
336
359
|
e.foreignKeyNames.forEach((s) => {
|
|
337
|
-
const
|
|
338
|
-
if (!
|
|
339
|
-
const
|
|
360
|
+
const i = e.foreignKeyRelationMap.get(s);
|
|
361
|
+
if (!i) return;
|
|
362
|
+
const r = n.getMetadata(i.mappedEntity, i.mappedNamespace)?.propertyMap.get("id")?.type, o = r && N(r) || "UUID";
|
|
340
363
|
t.push(E(o, e.name, s));
|
|
341
364
|
});
|
|
342
|
-
},
|
|
343
|
-
switch (
|
|
344
|
-
case
|
|
345
|
-
case
|
|
346
|
-
return [
|
|
365
|
+
}, ae = (n) => {
|
|
366
|
+
switch (n.kind) {
|
|
367
|
+
case g.ONE_TO_MANY:
|
|
368
|
+
case g.MANY_TO_MANY:
|
|
369
|
+
return [n.mappedProperty];
|
|
347
370
|
default:
|
|
348
371
|
return [];
|
|
349
372
|
}
|
|
350
|
-
}, oe = (
|
|
351
|
-
Array.from(e.relationMap.keys()).filter((
|
|
352
|
-
const o = e.relationMap.get(
|
|
373
|
+
}, oe = (n, e, t, s) => !!(n.some((a) => a.entity === s.name) || n.length > 0 && e === t), ce = (n, e, t, s, i, a) => {
|
|
374
|
+
Array.from(e.relationMap.keys()).filter((r) => !s.includes(r)).forEach((r) => {
|
|
375
|
+
const o = e.relationMap.get(r);
|
|
353
376
|
if (!o)
|
|
354
377
|
throw new Error("relation is empty");
|
|
355
|
-
const c =
|
|
378
|
+
const c = n.getMetadata(o.mappedEntity, o.mappedNamespace);
|
|
356
379
|
if (!c)
|
|
357
380
|
throw new Error(`generator_entity_rules: metadata "${o.mappedEntity}" not found`);
|
|
358
|
-
if (oe(
|
|
381
|
+
if (oe(a, c, t, e))
|
|
359
382
|
return;
|
|
360
|
-
if (
|
|
383
|
+
if (a.length === 0) {
|
|
361
384
|
const l = `${c.name}RuleGroup`;
|
|
362
|
-
|
|
385
|
+
i.push(E("RelationExists", e.name, r, void 0, l));
|
|
363
386
|
}
|
|
364
|
-
if (
|
|
387
|
+
if (a.length >= n.config.relationQueryDeep)
|
|
365
388
|
return;
|
|
366
|
-
const u =
|
|
367
|
-
|
|
389
|
+
const u = ae(o), h = [...a, { key: r, entity: e.name }];
|
|
390
|
+
P(n, c, t, u, i, h);
|
|
368
391
|
});
|
|
369
|
-
},
|
|
370
|
-
class
|
|
392
|
+
}, P = (n, e, t, s = [], i = [], a = []) => (t = t ?? e, i.push(...re(e, a)), ie(n, e, i), ce(n, e, t, s, i, a), i), B = (n, e) => n.map(({ rule: t, entity: s, key: i, valueType: a, subRuleGroup: r }) => (e.add(t), r ? `${t}<'${i}', ${r}>` : a ? i.includes(".") ? (e.add(`Relation${t}`), `Relation${t}<'${i}', ${a}>`) : `${t}<${s}, '${i}', ${a}>` : i.includes(".") ? (e.add(`Relation${t}`), `Relation${t}<'${i}'>`) : `${t}<${s}, '${i}'>`));
|
|
393
|
+
class de {
|
|
371
394
|
generate(e) {
|
|
372
395
|
this.generateProperties(e), this.generateMethods(e);
|
|
373
396
|
}
|
|
@@ -394,11 +417,11 @@ class ae {
|
|
|
394
417
|
* 共享工具:添加静态查询方法
|
|
395
418
|
*/
|
|
396
419
|
addStaticMethod(e, t) {
|
|
397
|
-
const { classMethods: s, staticTypesInterface:
|
|
398
|
-
t.example &&
|
|
420
|
+
const { classMethods: s, staticTypesInterface: i, rxdbNamedImports: a } = e, r = [t.metHodDoc || `${t.method} 查询`, "@param options 查询选项"];
|
|
421
|
+
t.example && r.push("@example", t.example), s.push({
|
|
399
422
|
name: t.method,
|
|
400
423
|
returnType: `Observable<${t.returnType}>`,
|
|
401
|
-
docs:
|
|
424
|
+
docs: r,
|
|
402
425
|
parameters: [
|
|
403
426
|
{
|
|
404
427
|
name: "options",
|
|
@@ -407,14 +430,14 @@ class ae {
|
|
|
407
430
|
}
|
|
408
431
|
],
|
|
409
432
|
isStatic: !0
|
|
410
|
-
}),
|
|
433
|
+
}), i.addProperty({
|
|
411
434
|
name: `${t.method}Options`,
|
|
412
435
|
type: t.options,
|
|
413
436
|
docs: ["查询选项"]
|
|
414
437
|
});
|
|
415
438
|
const o = t.options.match(/\b([A-Z]\w+Options)\b/g);
|
|
416
439
|
o && o.forEach((c) => {
|
|
417
|
-
!/^[a-z]/.test(c) && c.match(/^(Find|Count|Get)/) &&
|
|
440
|
+
!/^[a-z]/.test(c) && c.match(/^(Find|Count|Get)/) && a.add(c);
|
|
418
441
|
});
|
|
419
442
|
}
|
|
420
443
|
/**
|
|
@@ -431,98 +454,98 @@ class ae {
|
|
|
431
454
|
* 共享工具:获取 ID 类型
|
|
432
455
|
*/
|
|
433
456
|
getIdType(e) {
|
|
434
|
-
return
|
|
457
|
+
return A(e);
|
|
435
458
|
}
|
|
436
459
|
}
|
|
437
|
-
class
|
|
460
|
+
class v extends de {
|
|
438
461
|
name = "Repository";
|
|
439
462
|
generateMethods(e) {
|
|
440
|
-
const { metadata: t, file: s, rxdbNamedImports:
|
|
441
|
-
|
|
463
|
+
const { metadata: t, file: s, rxdbNamedImports: i, staticTypesInterface: a } = e, { name: r } = t, o = A(t);
|
|
464
|
+
a.addProperty({
|
|
442
465
|
name: "idType",
|
|
443
466
|
type: o,
|
|
444
467
|
docs: ["id 类型"]
|
|
445
468
|
});
|
|
446
|
-
const c =
|
|
469
|
+
const c = P(e.generator, t), u = B(c, i), h = `
|
|
447
470
|
|` + c.map((p) => `'${p.key}'`).join(`
|
|
448
471
|
|`);
|
|
449
472
|
s.addTypeAlias({
|
|
450
|
-
name: `${
|
|
473
|
+
name: `${r}Rule`,
|
|
451
474
|
type: Array.from(new Set(u)).join(`
|
|
452
475
|
| `),
|
|
453
476
|
hasDeclareKeyword: !0,
|
|
454
477
|
docs: ["rule"]
|
|
455
478
|
}), s.addTypeAlias({
|
|
456
|
-
name: `${
|
|
479
|
+
name: `${r}RuleGroup`,
|
|
457
480
|
// 关键:逗号后不加空格,直接换行,避免行尾空格
|
|
458
|
-
type: `RuleGroupBase<typeof ${
|
|
459
|
-
${
|
|
481
|
+
type: `RuleGroupBase<typeof ${r},${h},
|
|
482
|
+
${r}Rule>`,
|
|
460
483
|
hasDeclareKeyword: !0,
|
|
461
484
|
docs: ["RuleGroupBase"],
|
|
462
485
|
isExported: !0
|
|
463
486
|
});
|
|
464
|
-
const l = `${
|
|
487
|
+
const l = `${r}OrderByField`, m = Array.from(t.propertyMap.keys());
|
|
465
488
|
s.addTypeAlias({
|
|
466
489
|
name: l,
|
|
467
|
-
type:
|
|
490
|
+
type: m.map((p) => `"${p}"`).join(" | "),
|
|
468
491
|
hasDeclareKeyword: !0,
|
|
469
492
|
docs: ["OrderByField"]
|
|
470
493
|
});
|
|
471
|
-
const
|
|
494
|
+
const f = (p) => ({
|
|
472
495
|
method: p,
|
|
473
|
-
options: `${b(p)}Options<typeof ${
|
|
496
|
+
options: `${b(p)}Options<typeof ${r},${r}RuleGroup,${l}>`
|
|
474
497
|
});
|
|
475
498
|
this.addStaticMethod(e, {
|
|
476
499
|
method: "get",
|
|
477
500
|
options: `${o}`,
|
|
478
|
-
returnType:
|
|
501
|
+
returnType: r,
|
|
479
502
|
metHodDoc: "根据 ID 获取单个实体",
|
|
480
|
-
example: `${
|
|
503
|
+
example: `${r}.get('123').subscribe(entity => console.log(entity));`,
|
|
481
504
|
optionsIsRequired: !0
|
|
482
505
|
}), this.addStaticMethod(e, {
|
|
483
|
-
...
|
|
484
|
-
returnType:
|
|
506
|
+
...f("findOneOrFail"),
|
|
507
|
+
returnType: r,
|
|
485
508
|
metHodDoc: "查询单个实体,未找到时抛出错误",
|
|
486
|
-
example: `${
|
|
509
|
+
example: `${r}.findOneOrFail({ where: { combinator: 'and', rules: [] } }).subscribe(entity => console.log(entity));`,
|
|
487
510
|
optionsIsRequired: !0
|
|
488
511
|
}), this.addStaticMethod(e, {
|
|
489
|
-
...
|
|
490
|
-
returnType: `${
|
|
512
|
+
...f("find"),
|
|
513
|
+
returnType: `${r}[]`,
|
|
491
514
|
metHodDoc: "查询多个实体",
|
|
492
|
-
example: `${
|
|
515
|
+
example: `${r}.find({ where: { combinator: 'and', rules: [] }] }).subscribe(list => console.log(list));`,
|
|
493
516
|
optionsIsRequired: !0
|
|
494
517
|
}), this.addStaticMethod(e, {
|
|
495
|
-
...
|
|
496
|
-
returnType: `${
|
|
518
|
+
...f("findOne"),
|
|
519
|
+
returnType: `${r} | undefined`,
|
|
497
520
|
metHodDoc: "查询单个实体,未找到时返回 undefined",
|
|
498
|
-
example: `${
|
|
521
|
+
example: `${r}.findOne({ where: { combinator: 'and', rules: [] } }).subscribe(entity => console.log(entity));`,
|
|
499
522
|
optionsIsRequired: !0
|
|
500
523
|
}), this.addStaticMethod(e, {
|
|
501
|
-
...
|
|
502
|
-
returnType: `${
|
|
524
|
+
...f("findAll"),
|
|
525
|
+
returnType: `${r}[]`,
|
|
503
526
|
metHodDoc: "查询所有实体",
|
|
504
|
-
example: `${
|
|
527
|
+
example: `${r}.findAll({ where: { combinator: 'and', rules: [] } }).subscribe(list => console.log(list));`,
|
|
505
528
|
optionsIsRequired: !0
|
|
506
529
|
}), this.addStaticMethod(e, {
|
|
507
|
-
...
|
|
508
|
-
returnType: `${
|
|
530
|
+
...f("findByCursor"),
|
|
531
|
+
returnType: `${r}[]`,
|
|
509
532
|
metHodDoc: "游标分页查询",
|
|
510
|
-
example: `${
|
|
533
|
+
example: `${r}.findByCursor({ where: { combinator: 'and', rules: [] } }).subscribe(list => console.log(list));`,
|
|
511
534
|
optionsIsRequired: !0
|
|
512
535
|
}), this.addStaticMethod(e, {
|
|
513
536
|
method: "count",
|
|
514
|
-
options: `${b("count")}Options<typeof ${
|
|
537
|
+
options: `${b("count")}Options<typeof ${r},${r}RuleGroup>`,
|
|
515
538
|
returnType: "number",
|
|
516
539
|
metHodDoc: "统计实体数量",
|
|
517
|
-
example: `${
|
|
540
|
+
example: `${r}.count({ where: { combinator: 'and', rules: [] } }).subscribe(total => console.log(total));`,
|
|
518
541
|
optionsIsRequired: !0
|
|
519
542
|
}), this.addInstanceMethod(e, {
|
|
520
543
|
name: "save",
|
|
521
|
-
returnType: `Promise<${
|
|
544
|
+
returnType: `Promise<${r}>`,
|
|
522
545
|
docs: ["保存"]
|
|
523
546
|
}), this.addInstanceMethod(e, {
|
|
524
547
|
name: "remove",
|
|
525
|
-
returnType: `Promise<${
|
|
548
|
+
returnType: `Promise<${r}>`,
|
|
526
549
|
docs: ["删除"]
|
|
527
550
|
}), this.addInstanceMethod(e, {
|
|
528
551
|
name: "reset",
|
|
@@ -531,25 +554,25 @@ ${n}Rule>`,
|
|
|
531
554
|
});
|
|
532
555
|
}
|
|
533
556
|
}
|
|
534
|
-
class
|
|
557
|
+
class pe extends v {
|
|
535
558
|
name = "TreeRepository";
|
|
536
559
|
generateMethods(e) {
|
|
537
|
-
const { metadata: t, rxdbNamedImports: s, generator:
|
|
538
|
-
(
|
|
539
|
-
), u =
|
|
540
|
-
|
|
560
|
+
const { metadata: t, rxdbNamedImports: s, generator: i, file: a, staticTypesInterface: r } = e, { name: o } = t, c = P(i, t).filter(
|
|
561
|
+
(m) => m.key.startsWith("children.") && m.key !== "children.id"
|
|
562
|
+
), u = B(c, s), h = c.map((m) => `'${m.key}'`).join(" | ");
|
|
563
|
+
a.addTypeAlias({
|
|
541
564
|
name: `${o}TreeRule`,
|
|
542
565
|
type: Array.from(new Set(u)).join(`
|
|
543
566
|
| `),
|
|
544
567
|
hasDeclareKeyword: !0,
|
|
545
568
|
docs: ["TreeRule"]
|
|
546
|
-
}),
|
|
569
|
+
}), a.addTypeAlias({
|
|
547
570
|
name: `${o}TreeRuleGroup`,
|
|
548
571
|
type: `RuleGroupBase<typeof ${o}, ${h}, ${o}TreeRule>`,
|
|
549
572
|
hasDeclareKeyword: !0,
|
|
550
573
|
docs: ["TreeRuleGroup"],
|
|
551
574
|
isExported: !0
|
|
552
|
-
}),
|
|
575
|
+
}), r.addProperty({
|
|
553
576
|
name: "entity",
|
|
554
577
|
type: `${o}`,
|
|
555
578
|
docs: ["查询的实体"]
|
|
@@ -592,8 +615,8 @@ ${o}.countAncestors({ entityId: grand.id }).subscribe(depth => console.log(depth
|
|
|
592
615
|
});
|
|
593
616
|
}
|
|
594
617
|
}
|
|
595
|
-
var G = /* @__PURE__ */ ((
|
|
596
|
-
class
|
|
618
|
+
var G = /* @__PURE__ */ ((n) => (n.Var = "var", n.Let = "let", n.Const = "const", n))(G || {});
|
|
619
|
+
class $ {
|
|
597
620
|
/**
|
|
598
621
|
* 渲染单个参数
|
|
599
622
|
*/
|
|
@@ -625,10 +648,10 @@ class T {
|
|
|
625
648
|
*/
|
|
626
649
|
static renderJsDoc(e, t = 0) {
|
|
627
650
|
if (!e?.length) return "";
|
|
628
|
-
const s = " ".repeat(t),
|
|
651
|
+
const s = " ".repeat(t), i = e.map((a) => `${s} * ${a}`).join(`
|
|
629
652
|
`);
|
|
630
653
|
return `${s}/**
|
|
631
|
-
${
|
|
654
|
+
${i}
|
|
632
655
|
${s} */
|
|
633
656
|
`;
|
|
634
657
|
}
|
|
@@ -636,20 +659,20 @@ ${s} */
|
|
|
636
659
|
* 渲染属性
|
|
637
660
|
*/
|
|
638
661
|
static renderProperty(e, t, s = !0) {
|
|
639
|
-
const
|
|
640
|
-
return e.docs?.length &&
|
|
641
|
-
`),
|
|
662
|
+
const i = " ".repeat(t), a = [];
|
|
663
|
+
return e.docs?.length && a.push(this.renderJsDoc(e.docs, t)), a.push(i), e.isStatic && a.push("static "), e.isReadonly && a.push("readonly "), a.push(e.name), e.hasQuestionToken && a.push("?"), e.type && a.push(`: ${e.type}`), !s && e.initializer && a.push(` = ${e.initializer}`), a.push(`;
|
|
664
|
+
`), a.join("");
|
|
642
665
|
}
|
|
643
666
|
/**
|
|
644
667
|
* 渲染接口块
|
|
645
668
|
*/
|
|
646
669
|
static renderInterfaceBlock(e, t, s) {
|
|
647
|
-
const
|
|
648
|
-
return e.docs?.length &&
|
|
649
|
-
`), e.properties?.length && e.properties.forEach((
|
|
650
|
-
|
|
651
|
-
}),
|
|
652
|
-
`),
|
|
670
|
+
const i = " ".repeat(t), a = [];
|
|
671
|
+
return e.docs?.length && a.push(this.renderJsDoc(e.docs, t)), a.push(i), s && e.isExported && a.push("export "), a.push(`interface ${e.name}`), e.extends?.length && a.push(` extends ${e.extends.join(", ")}`), a.push(` {
|
|
672
|
+
`), e.properties?.length && e.properties.forEach((r) => {
|
|
673
|
+
a.push(this.renderProperty(r, t + 2));
|
|
674
|
+
}), a.push(`${i}}
|
|
675
|
+
`), a.join("");
|
|
653
676
|
}
|
|
654
677
|
/**
|
|
655
678
|
* 渲染导入声明
|
|
@@ -680,8 +703,8 @@ ${s} */
|
|
|
680
703
|
return e.length ? e.map((t) => {
|
|
681
704
|
const s = [];
|
|
682
705
|
return t.docs?.length && s.push(this.renderJsDoc(t.docs, 0)), t.hasDeclareKeyword && s.push("declare "), s.push(`module ${t.name} {
|
|
683
|
-
`), t.interfaces?.length && t.interfaces.forEach((
|
|
684
|
-
s.push(this.renderInterfaceBlock(
|
|
706
|
+
`), t.interfaces?.length && t.interfaces.forEach((i) => {
|
|
707
|
+
s.push(this.renderInterfaceBlock(i, 2, !1));
|
|
685
708
|
}), s.push(`}
|
|
686
709
|
|
|
687
710
|
`), s.join("");
|
|
@@ -693,16 +716,16 @@ ${s} */
|
|
|
693
716
|
static renderClass(e) {
|
|
694
717
|
const t = e.getName();
|
|
695
718
|
if (!t) return "";
|
|
696
|
-
const s = [],
|
|
697
|
-
s.push(this.renderJsDoc(
|
|
698
|
-
const
|
|
699
|
-
if (
|
|
700
|
-
const o =
|
|
719
|
+
const s = [], i = e.jsDoc?.length ? e.jsDoc : [t];
|
|
720
|
+
s.push(this.renderJsDoc(i)), s.push(`export declare class ${t}`);
|
|
721
|
+
const a = e.getBaseClass();
|
|
722
|
+
if (a) {
|
|
723
|
+
const o = a.getName();
|
|
701
724
|
o && s.push(` extends ${o}`);
|
|
702
725
|
}
|
|
703
|
-
const
|
|
704
|
-
if (
|
|
705
|
-
const o =
|
|
726
|
+
const r = e.getImplements();
|
|
727
|
+
if (r.length) {
|
|
728
|
+
const o = r.map((c) => c.getText()).join(", ");
|
|
706
729
|
s.push(` implements ${o}`);
|
|
707
730
|
}
|
|
708
731
|
if (s.push(` {
|
|
@@ -722,6 +745,27 @@ ${s} */
|
|
|
722
745
|
|
|
723
746
|
`), s.join("");
|
|
724
747
|
}
|
|
748
|
+
/**
|
|
749
|
+
* 渲染枚举声明
|
|
750
|
+
*/
|
|
751
|
+
static renderEnums(e) {
|
|
752
|
+
return e.length ? e.map((t) => {
|
|
753
|
+
const s = [];
|
|
754
|
+
return t.docs?.length && s.push(this.renderJsDoc(t.docs, 0)), t.isExported && s.push("export "), t.isConst && s.push("const "), s.push(`enum ${t.name} {
|
|
755
|
+
`), t.members?.length && t.members.forEach((i, a) => {
|
|
756
|
+
const r = a === t.members.length - 1;
|
|
757
|
+
if (i.value !== void 0) {
|
|
758
|
+
const o = typeof i.value == "string" ? `"${i.value}"` : String(i.value);
|
|
759
|
+
s.push(` ${i.name} = ${o}${r ? "" : ","}
|
|
760
|
+
`);
|
|
761
|
+
} else
|
|
762
|
+
s.push(` ${i.name}${r ? "" : ","}
|
|
763
|
+
`);
|
|
764
|
+
}), s.push(`}
|
|
765
|
+
|
|
766
|
+
`), s.join("");
|
|
767
|
+
}).join("") : "";
|
|
768
|
+
}
|
|
725
769
|
/**
|
|
726
770
|
* 渲染变量声明
|
|
727
771
|
*/
|
|
@@ -734,7 +778,7 @@ ${s} */
|
|
|
734
778
|
}).join("") : "";
|
|
735
779
|
}
|
|
736
780
|
}
|
|
737
|
-
class
|
|
781
|
+
class le {
|
|
738
782
|
name;
|
|
739
783
|
extends;
|
|
740
784
|
docs;
|
|
@@ -747,7 +791,7 @@ class de {
|
|
|
747
791
|
this.properties.some((t) => t.name === e.name) || this.properties.push(e);
|
|
748
792
|
}
|
|
749
793
|
}
|
|
750
|
-
class
|
|
794
|
+
class ue {
|
|
751
795
|
structure;
|
|
752
796
|
decorators = [];
|
|
753
797
|
properties = [];
|
|
@@ -806,6 +850,7 @@ class _ {
|
|
|
806
850
|
interfaces = [];
|
|
807
851
|
modules = [];
|
|
808
852
|
typeAliases = [];
|
|
853
|
+
enums = [];
|
|
809
854
|
imports = [];
|
|
810
855
|
variables = [];
|
|
811
856
|
fileContent = "";
|
|
@@ -813,21 +858,21 @@ class _ {
|
|
|
813
858
|
this.filePath = e;
|
|
814
859
|
}
|
|
815
860
|
addClass(e) {
|
|
816
|
-
const t = new
|
|
861
|
+
const t = new ue(e);
|
|
817
862
|
return e.properties && t.addProperties(e.properties), e.methods && t.addMethods(e.methods), e.docs && e.docs.forEach((s) => t.addJsDoc(s)), this.classes.push(t), t;
|
|
818
863
|
}
|
|
819
864
|
addInterface(e) {
|
|
820
865
|
let t = this.interfaces.find((s) => s.name === e.name);
|
|
821
|
-
return t || (t = new
|
|
866
|
+
return t || (t = new le(e), this.interfaces.push(t)), t;
|
|
822
867
|
}
|
|
823
868
|
addModule(e) {
|
|
824
869
|
return this.modules.push(e), {
|
|
825
870
|
addInterface: (t) => {
|
|
826
871
|
const s = this.modules[this.modules.length - 1];
|
|
827
872
|
return s.interfaces || (s.interfaces = []), s.interfaces.push(t), {
|
|
828
|
-
addProperty: (
|
|
829
|
-
const
|
|
830
|
-
|
|
873
|
+
addProperty: (i) => {
|
|
874
|
+
const a = this.modules[this.modules.length - 1], r = a.interfaces[a.interfaces.length - 1];
|
|
875
|
+
r.properties || (r.properties = []), r.properties.push(i);
|
|
831
876
|
}
|
|
832
877
|
};
|
|
833
878
|
}
|
|
@@ -839,6 +884,9 @@ class _ {
|
|
|
839
884
|
addImportDeclaration(e) {
|
|
840
885
|
this.imports.push(e);
|
|
841
886
|
}
|
|
887
|
+
addEnum(e) {
|
|
888
|
+
return this.enums.push(e), e;
|
|
889
|
+
}
|
|
842
890
|
addVariableStatement(e) {
|
|
843
891
|
this.variables.push(e);
|
|
844
892
|
}
|
|
@@ -850,13 +898,14 @@ class _ {
|
|
|
850
898
|
}
|
|
851
899
|
getText() {
|
|
852
900
|
return this.fileContent ? this.fileContent : [
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
this.
|
|
901
|
+
$.renderImports(this.imports),
|
|
902
|
+
$.renderTypeAliases(this.typeAliases),
|
|
903
|
+
$.renderEnums(this.enums),
|
|
904
|
+
$.renderModules(this.modules),
|
|
905
|
+
this.interfaces.map((t) => $.renderInterfaceBlock(t, 0, !0) + `
|
|
857
906
|
`).join(""),
|
|
858
|
-
this.classes.map((t) =>
|
|
859
|
-
|
|
907
|
+
this.classes.map((t) => $.renderClass(t)).join(""),
|
|
908
|
+
$.renderVariables(this.variables)
|
|
860
909
|
].join("");
|
|
861
910
|
}
|
|
862
911
|
setContent(e) {
|
|
@@ -869,7 +918,7 @@ class _ {
|
|
|
869
918
|
console.log(`SourceFile ${this.filePath} saved synchronously`);
|
|
870
919
|
}
|
|
871
920
|
}
|
|
872
|
-
class
|
|
921
|
+
class he {
|
|
873
922
|
files = /* @__PURE__ */ new Map();
|
|
874
923
|
createSourceFile(e, t) {
|
|
875
924
|
const s = new _(e);
|
|
@@ -883,17 +932,17 @@ class le {
|
|
|
883
932
|
return Array.from(this.files.values());
|
|
884
933
|
}
|
|
885
934
|
}
|
|
886
|
-
const Y = "public", I = "Repository",
|
|
887
|
-
class
|
|
935
|
+
const Y = "public", I = "Repository", Te = "TreeRepository", Ee = "GraphRepository", me = "EntityBase", ye = "TreeAdjacencyListEntityBase", fe = "TreeEntityBase", w = (n, e = Y) => `${e}_${n}`;
|
|
936
|
+
class Re {
|
|
888
937
|
/**
|
|
889
938
|
* Repository 生成器注册表
|
|
890
939
|
* 用于支持可扩展的 Repository 类型
|
|
891
940
|
*/
|
|
892
941
|
repositoryGenerators = /* @__PURE__ */ new Map();
|
|
893
942
|
entityMetadataOptionsMap = /* @__PURE__ */ new Map([
|
|
894
|
-
[
|
|
895
|
-
[
|
|
896
|
-
[
|
|
943
|
+
[me, [R]],
|
|
944
|
+
[ye, [O, R]],
|
|
945
|
+
[fe, [O, R]]
|
|
897
946
|
]);
|
|
898
947
|
metadataOptionsSet = /* @__PURE__ */ new Set();
|
|
899
948
|
metadataSet = /* @__PURE__ */ new Set();
|
|
@@ -903,7 +952,7 @@ class $e {
|
|
|
903
952
|
relationQueryDeep: 3
|
|
904
953
|
};
|
|
905
954
|
constructor(e) {
|
|
906
|
-
Object.assign(this.config, e), this.config.relationQueryDeep < 1 && (this.config.relationQueryDeep = 1), this.registerRepositoryGenerator(new
|
|
955
|
+
Object.assign(this.config, e), this.config.relationQueryDeep < 1 && (this.config.relationQueryDeep = 1), this.registerRepositoryGenerator(new v()), this.registerRepositoryGenerator(new pe());
|
|
907
956
|
}
|
|
908
957
|
/**
|
|
909
958
|
* 添加实体配置
|
|
@@ -911,21 +960,21 @@ class $e {
|
|
|
911
960
|
*/
|
|
912
961
|
addEntity(e, t) {
|
|
913
962
|
let s;
|
|
914
|
-
if (
|
|
963
|
+
if (L(e))
|
|
915
964
|
s = K(e);
|
|
916
965
|
else {
|
|
917
|
-
const
|
|
918
|
-
t = t ||
|
|
966
|
+
const i = e;
|
|
967
|
+
t = t || i.extends?.length && this.entityMetadataOptionsMap.get(i.extends[0]) || [], s = x(e, t);
|
|
919
968
|
}
|
|
920
969
|
this.metadataSet.add(s), this.metadataMap.set(`${s.namespace}_${s.name}`, s);
|
|
921
970
|
}
|
|
922
971
|
getMetadata(e, t) {
|
|
923
|
-
return this.metadataMap.get(
|
|
972
|
+
return this.metadataMap.get(w(e, t));
|
|
924
973
|
}
|
|
925
974
|
registerAbstractMetadata(e, t) {
|
|
926
975
|
this.entityMetadataOptionsMap.set(e, t), t.forEach((s) => {
|
|
927
|
-
const
|
|
928
|
-
this.metadataMap.set(
|
|
976
|
+
const i = x(s);
|
|
977
|
+
this.metadataMap.set(w(s.name, s.namespace), i);
|
|
929
978
|
});
|
|
930
979
|
}
|
|
931
980
|
/**
|
|
@@ -954,7 +1003,7 @@ class $e {
|
|
|
954
1003
|
* 执行生成器
|
|
955
1004
|
*/
|
|
956
1005
|
exec() {
|
|
957
|
-
this.project = new
|
|
1006
|
+
this.project = new he(), this.generateAllEntityDefinition(), this.generateEntityJsFile();
|
|
958
1007
|
}
|
|
959
1008
|
getSourceFiles() {
|
|
960
1009
|
return this.project.getSourceFiles();
|
|
@@ -966,21 +1015,21 @@ class $e {
|
|
|
966
1015
|
generateEntityJsFile() {
|
|
967
1016
|
const { project: e, metadataSet: t } = this;
|
|
968
1017
|
let s = "";
|
|
969
|
-
const
|
|
1018
|
+
const i = /* @__PURE__ */ new Set(["Entity", "__decorateClass"]), a = (o) => {
|
|
970
1019
|
const c = this.getMetadata(o.mappedEntity, o.mappedNamespace);
|
|
971
1020
|
if (c?.relations)
|
|
972
1021
|
return c.relations.find(
|
|
973
|
-
(u) => u.kind ===
|
|
1022
|
+
(u) => u.kind === g.MANY_TO_MANY && u.name === o.mappedProperty && u.mappedProperty === o.name
|
|
974
1023
|
);
|
|
975
1024
|
};
|
|
976
1025
|
t.forEach((o) => {
|
|
977
1026
|
o.relations.forEach((c) => {
|
|
978
|
-
if (c.kind ===
|
|
1027
|
+
if (c.kind === g.MANY_TO_MANY && !a(c))
|
|
979
1028
|
throw new Error("mapped relation not found");
|
|
980
1029
|
});
|
|
981
1030
|
}), t.forEach((o) => {
|
|
982
|
-
const c = o.extends[0], { name: u } = o, h = u, l =
|
|
983
|
-
c &&
|
|
1031
|
+
const c = o.extends[0], { name: u } = o, h = u, l = W(o);
|
|
1032
|
+
c && i.add(c), o.properties.length && i.add("PropertyType"), o.relations.length && i.add("RelationKind"), s += `
|
|
984
1033
|
let ${h} = class ${c ? "extends " + c : ""} {};`, s += `
|
|
985
1034
|
${h} = __decorateClass(
|
|
986
1035
|
[
|
|
@@ -988,42 +1037,42 @@ ${h} = __decorateClass(
|
|
|
988
1037
|
],
|
|
989
1038
|
${h}
|
|
990
1039
|
);`;
|
|
991
|
-
}), s = `import { ${Array.from(
|
|
992
|
-
const
|
|
1040
|
+
}), s = `import { ${Array.from(i).sort().join(", ")} } from '@aiao/rxdb';` + s;
|
|
1041
|
+
const r = Array.from(t.values()).map((o) => o.name).sort().join(", ");
|
|
993
1042
|
s += `
|
|
994
|
-
const ENTITIES = [ ${
|
|
995
|
-
export { ENTITIES, ${
|
|
1043
|
+
const ENTITIES = [ ${r} ];`, s += `
|
|
1044
|
+
export { ENTITIES, ${r} };`, e.createSourceFile("index.js", s);
|
|
996
1045
|
}
|
|
997
1046
|
/**
|
|
998
1047
|
* 生成所有 entity 的定义到 index.d.ts 文件里
|
|
999
1048
|
* @private
|
|
1000
1049
|
*/
|
|
1001
1050
|
generateAllEntityDefinition() {
|
|
1002
|
-
const { project: e, metadataSet: t } = this, s = e.createSourceFile("index.d.ts"),
|
|
1051
|
+
const { project: e, metadataSet: t } = this, s = e.createSourceFile("index.d.ts"), a = s.addModule({
|
|
1003
1052
|
name: '"@aiao/rxdb"',
|
|
1004
1053
|
hasDeclareKeyword: !0,
|
|
1005
1054
|
docs: ["rxdb"]
|
|
1006
1055
|
}).addInterface({
|
|
1007
1056
|
name: "RxDB",
|
|
1008
1057
|
docs: ["RxDB"]
|
|
1009
|
-
}),
|
|
1058
|
+
}), r = /* @__PURE__ */ new Set(["EntityType", "IEntity", "ITreeEntity", "RuleGroupBase", "UUID"]);
|
|
1010
1059
|
t.forEach((o) => {
|
|
1011
|
-
const { rxdbNamedImports: c } =
|
|
1012
|
-
c.forEach((l) =>
|
|
1060
|
+
const { rxdbNamedImports: c } = ee(this, o, s);
|
|
1061
|
+
c.forEach((l) => r.add(l));
|
|
1013
1062
|
const { name: u } = o, h = u;
|
|
1014
|
-
o.namespace && o.namespace !== Y ?
|
|
1063
|
+
o.namespace && o.namespace !== Y ? a.addProperty({
|
|
1015
1064
|
name: o.namespace,
|
|
1016
1065
|
type: `{
|
|
1017
1066
|
${h}: typeof ${h};
|
|
1018
1067
|
}`,
|
|
1019
1068
|
docs: [o.displayName]
|
|
1020
|
-
}) :
|
|
1069
|
+
}) : a.addProperty({
|
|
1021
1070
|
name: h,
|
|
1022
1071
|
type: `typeof ${h}`,
|
|
1023
1072
|
docs: [o.displayName]
|
|
1024
1073
|
});
|
|
1025
1074
|
}), s.addImportDeclaration({
|
|
1026
|
-
namedImports: Array.from(
|
|
1075
|
+
namedImports: Array.from(r).filter(Boolean).sort(),
|
|
1027
1076
|
isTypeOnly: !0,
|
|
1028
1077
|
moduleSpecifier: "@aiao/rxdb"
|
|
1029
1078
|
}), s.addImportDeclaration({
|
|
@@ -1045,9 +1094,9 @@ ${h}: typeof ${h};
|
|
|
1045
1094
|
}
|
|
1046
1095
|
export {
|
|
1047
1096
|
Y as N,
|
|
1048
|
-
|
|
1097
|
+
Ee as R,
|
|
1049
1098
|
I as a,
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1099
|
+
Te as b,
|
|
1100
|
+
de as c,
|
|
1101
|
+
Re as d
|
|
1053
1102
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { writeFileSync as _, mkdirSync as R } from "node:fs";
|
|
2
2
|
import { normalize as f, resolve as w, join as S, dirname as I } from "node:path";
|
|
3
3
|
import { Project as T, Node as h } from "ts-morph";
|
|
4
|
-
import { R as b, b as M, a as N, d as A } from "./RxDBClientGenerator-
|
|
4
|
+
import { R as b, b as M, a as N, d as A } from "./RxDBClientGenerator-xjVHqGPq.js";
|
|
5
5
|
import { ENTITY_BASE_METADATA_OPTIONS as x, TREE_ADJACENCY_LIST_ENTITY_BASE_OPTIONS as C, PropertyType as D, RelationKind as Y, OnDeleteAction as F } from "@aiao/rxdb";
|
|
6
6
|
import { glob as B } from "glob";
|
|
7
7
|
function y(n) {
|
package/dist/cli.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { existsSync as p } from "node:fs";
|
|
3
3
|
import { resolve as a, dirname as d, normalize as l } from "node:path";
|
|
4
4
|
import { pathToFileURL as m } from "node:url";
|
|
5
|
-
import { b as h } from "./build-client-lib-
|
|
5
|
+
import { b as h } from "./build-client-lib-CGIfjQOF.js";
|
|
6
6
|
async function b(r) {
|
|
7
7
|
if (!p(r))
|
|
8
8
|
throw new Error(`Config file not found: ${r}`);
|
|
@@ -8,6 +8,10 @@ export declare const getPropertyTypeConfig: (property: EntityPropertyMetadata, m
|
|
|
8
8
|
name: string;
|
|
9
9
|
};
|
|
10
10
|
export declare const getFlatMapInterfaceName: (property: EntityPropertyMetadata, metadata: EntityMetadata) => string;
|
|
11
|
+
/**
|
|
12
|
+
* 生成枚举属性的 TypeScript enum 类型名称
|
|
13
|
+
*/
|
|
14
|
+
export declare const getEnumTypeName: (property: EntityPropertyMetadata, metadata: EntityMetadata) => string;
|
|
11
15
|
/**
|
|
12
16
|
* 生成 keyValue 的精确类型(返回接口名称)
|
|
13
17
|
* 根据 properties 定义生成准确的接口名称
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RxDBClientGenerator.utils.d.ts","sourceRoot":"","sources":["../../src/core/RxDBClientGenerator.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,c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,QAAQ,EAAE,cAAc,GAAG,MAAM,CA6BnE"}
|
|
@@ -169,6 +169,23 @@ export interface ClassDeclaration extends Node {
|
|
|
169
169
|
constructorData?: ConstructorData;
|
|
170
170
|
jsDoc?: string[];
|
|
171
171
|
}
|
|
172
|
+
/**
|
|
173
|
+
* 枚举成员结构
|
|
174
|
+
*/
|
|
175
|
+
export interface EnumMemberStructure {
|
|
176
|
+
name: string;
|
|
177
|
+
value?: string | number;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* 枚举声明结构
|
|
181
|
+
*/
|
|
182
|
+
export interface EnumDeclarationStructure {
|
|
183
|
+
name: string;
|
|
184
|
+
isExported?: boolean;
|
|
185
|
+
isConst?: boolean;
|
|
186
|
+
docs?: string[];
|
|
187
|
+
members?: EnumMemberStructure[];
|
|
188
|
+
}
|
|
172
189
|
/**
|
|
173
190
|
* 添加接口后的返回类型
|
|
174
191
|
*/
|
|
@@ -189,6 +206,7 @@ export interface SourceFile {
|
|
|
189
206
|
addInterface(structure: InterfaceDeclarationStructure): AddedInterface;
|
|
190
207
|
addModule(structure: ModuleDeclarationStructure): AddedModule;
|
|
191
208
|
addTypeAlias(structure: TypeAliasDeclarationStructure): TypeAliasDeclarationStructure;
|
|
209
|
+
addEnum(structure: EnumDeclarationStructure): EnumDeclarationStructure;
|
|
192
210
|
addImportDeclaration(structure: ImportDeclarationStructure): void;
|
|
193
211
|
addVariableStatement(structure: VariableStatementStructure): void;
|
|
194
212
|
getClasses(): ClassDeclaration[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ts-morph-browser.d.ts","sourceRoot":"","sources":["../../src/core/ts-morph-browser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,oBAAY,uBAAuB;IACjC,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,KAAK,UAAU;CAChB;AAED;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS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E,OAAO,CAAC;IACrB,UAAU,EAAE,4BAA4B,EAAE,CAAM;gBAEpC,IAAI,EAAE,6BAA6B;IAK/C,WAAW,CAAC,IAAI,EAAE,4BAA4B,GAAG,IAAI;CAItD;AA8MD;;;GAGG;AACH,qBAAa,OAAO;IAClB,OAAO,CAAC,KAAK,CAAiC;IAE9C,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,UAAU;IAWhE,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU;IAMjD,cAAc,IAAI,UAAU,EAAE;CAG/B;AAID;;GAEG;AACH,eAAO,MAAM,IAAI;wBACK,OAAO,GAAG,IAAI,IAAI,IAAI;2BAMnB,OAAO,GAAG,IAAI,IAAI,IAAI;CAG9C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-properties.d.ts","sourceRoot":"","sources":["../../src/generators/entity-properties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAwC,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"entity-properties.d.ts","sourceRoot":"","sources":["../../src/generators/entity-properties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAwC,MAAM,YAAY,CAAC;AAQlF,OAAO,KAAK,EAAE,YAAY,EAAE,4BAA4B,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAE1G;;GAEG;AACH,eAAO,MAAM,wBAAwB,GAAI,uDAKtC;IACD,QAAQ,EAAE,cAAc,CAAC;IACzB,IAAI,EAAE,UAAU,CAAC;IACjB,eAAe,EAAE,YAAY,CAAC,4BAA4B,CAAC,EAAE,CAAC;IAC9D,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC/B,SA+FA,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-rules.d.ts","sourceRoot":"","sources":["../../src/generators/entity-rules.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EAKf,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAGrE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,SAAS;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAChB;
|
|
1
|
+
{"version":3,"file":"entity-rules.d.ts","sourceRoot":"","sources":["../../src/generators/entity-rules.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EAKf,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAGrE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,SAAS;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAChB;AAmOD,eAAO,MAAM,mBAAmB,GAC9B,WAAW,mBAAmB,EAC9B,UAAU,cAAc,EACxB,gBAAgB,cAAc,EAC9B,aAAY,MAAM,EAAO,EACzB,SAAQ,YAAY,EAAO,EAC3B,QAAO,SAAS,EAAO,KACtB,YAAY,EAad,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/vite.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiao/rxdb-client-generator",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"glob": "^13.0.6",
|
|
42
42
|
"ts-morph": "^27.0.2",
|
|
43
|
-
"@aiao/rxdb": "0.0.
|
|
44
|
-
"@aiao/utils": "0.0.
|
|
43
|
+
"@aiao/rxdb": "0.0.14",
|
|
44
|
+
"@aiao/utils": "0.0.14"
|
|
45
45
|
}
|
|
46
46
|
}
|