@aiao/rxdb-client-generator 0.0.13 → 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.
@@ -1,31 +1,40 @@
1
- import { PropertyType as d, RelationKind as f, ENTITY_BASE_METADATA_OPTIONS as R, TREE_ADJACENCY_LIST_ENTITY_BASE_OPTIONS as P, getEntityMetadata as K, transitionMetadata as O } from "@aiao/rxdb";
2
- import { omit as F, isNil as V, unionBy as v, capitalizeFirst as b, isFunction as U } from "@aiao/utils";
3
- const J = (r, e) => {
4
- const t = $(r, e), s = !!r.nullable;
5
- let a = !0;
6
- !s && Object.hasOwn(r, "default") && (a = !1);
7
- const i = {
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: r.name,
9
+ name: n.name,
10
10
  hasQuestionToken: s,
11
- hasExclamationToken: a,
12
- isReadonly: r.readonly
11
+ hasExclamationToken: i,
12
+ isReadonly: n.readonly
13
13
  };
14
- return V(r.default) || (i.initializer = Q(r)), i;
15
- }, M = (r, e) => `${e.name}${r.name.charAt(0).toUpperCase() + r.name.slice(1)}KeyValue`, L = (r, e) => r.type !== d.keyValue || !("properties" in r) || !r.properties || r.properties.length === 0 ? "KeyValue" : M(r, e), H = (r, e) => r.type !== d.keyValue || !("properties" in r) || !r.properties || r.properties.length === 0 ? [] : r.properties.map((t) => ({
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: $(t, e),
17
+ type: T(t, e),
18
18
  hasQuestionToken: t.nullable || !1,
19
19
  docs: t.displayName ? [t.displayName] : void 0
20
- })), $ = (r, e) => {
20
+ })), T = (n, e) => {
21
21
  let t = "any";
22
- switch (r.type) {
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 = L(r, e);
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 r.nullable && (t += " | null"), t;
55
- }, Q = (r) => {
56
- switch (r.type) {
63
+ return n.nullable && (t += " | null"), t;
64
+ }, z = (n, e) => {
65
+ switch (n.type) {
57
66
  case d.string:
58
- return `'${String(r.default)}'`;
67
+ return `'${String(n.default)}'`;
68
+ case d.enum:
69
+ return `${S(n, e)}.${String(n.default)}`;
59
70
  case d.date:
60
- if (r.default)
71
+ if (n.default)
61
72
  return "new Date()";
62
73
  break;
63
74
  }
64
75
  return "";
65
- }, D = (r, e = /* @__PURE__ */ new Set()) => {
66
- if (r == null) return e;
67
- if (typeof r == "object")
68
- if (Array.isArray(r))
69
- for (const t of r)
70
- D(t, e);
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 r)
73
- Object.prototype.hasOwnProperty.call(r, t) && (e.add(t), D(r[t], e));
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
- }, w = /* @__PURE__ */ new Map();
76
- Object.keys(d).forEach((r) => {
77
- const e = d[r];
78
- typeof e == "string" && w.set(e, r);
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 j = /* @__PURE__ */ new Map();
81
- Object.keys(f).forEach((r) => {
82
- const e = f[r];
83
- typeof e == "string" && j.set(e, r);
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 q(r) {
86
- const e = F(r, ["propertyMap", "relationMap", "indexMap"]), t = D(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(r.properties.map((i) => i.type).filter(Boolean)).forEach((i) => {
89
- const n = w.get(i);
90
- n && (s = s.replaceAll(`"type": "${i}"`, `"type": PropertyType.${n}`));
91
- }), r.relations && new Set(r.relations.map((n) => n.kind)).forEach((n) => {
92
- const o = j.get(n);
93
- o && (s = s.replaceAll(`"kind": "${n}"`, `"kind": RelationKind.${o}`));
94
- }), t.forEach((i) => {
95
- i.includes("-") || i.includes(" ") || (s = s.replaceAll(`"${i}":`, `${i}:`));
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 z = ({
99
- classProperties: r,
109
+ const Z = ({
110
+ classProperties: n,
100
111
  metadata: e,
101
112
  file: t,
102
113
  rxdbNamedImports: s
103
114
  }) => {
104
- const a = t.addInterface({
115
+ const i = t.addInterface({
105
116
  name: `${e.name}InitData`,
106
117
  isExported: !0,
107
118
  docs: ["初始化数据"]
108
- }), i = (n, o = !1) => {
109
- if (n.type === d.keyValue && "properties" in n && n.properties && n.properties.length > 0) {
110
- const y = M(n, e), g = t.addInterface({
111
- name: y,
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: [n.displayName || `${n.name} keyValue 类型`]
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
- const c = J(n, e), { initializer: u, ...h } = c, l = [];
120
- l.push(n.displayName || n.name), u && l.push(`@default ${u}`), c.type === "UUID" && s.add("UUID"), o || a.addProperty({
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
- }), r.push({
149
+ }), n.push({
126
150
  ...h,
127
151
  hasExclamationToken: !1,
128
- isReadonly: n.readonly || !1,
152
+ isReadonly: r.readonly || !1,
129
153
  docs: l
130
154
  });
131
155
  };
132
- e.properties.forEach((n) => {
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[n.name] && i(n, !0);
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
- }, S = (r) => {
139
- const e = r.propertyMap.get("id");
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
- }, W = ({
152
- classProperties: r,
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((a) => {
158
- switch (a.kind) {
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 f.ONE_TO_ONE:
164
- case f.MANY_TO_ONE:
185
+ case g.ONE_TO_ONE:
186
+ case g.MANY_TO_ONE:
165
187
  {
166
- const i = `RelationEntityObservable<typeof ${a.mappedEntity}>`, n = a.displayName || a.name;
167
- r.push({
168
- name: a.name + "$",
188
+ const a = `RelationEntityObservable<typeof ${i.mappedEntity}>`, r = i.displayName || i.name;
189
+ n.push({
190
+ name: i.name + "$",
169
191
  // 关系属性名使用$后缀,表示可观察对象
170
- type: i,
192
+ type: a,
171
193
  isReadonly: !0,
172
194
  // 关系属性是只读的,通过set/remove方法修改
173
- docs: [n]
195
+ docs: [r]
174
196
  });
175
- const o = s.getMetadata(a.mappedEntity, a.mappedNamespace), c = S(o);
176
- r.push({
177
- name: a.name + "Id",
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: a.nullable ? `${c} | null` : c,
203
+ type: i.nullable ? `${c} | null` : c,
182
204
  isReadonly: !1,
183
- hasQuestionToken: a.nullable,
184
- docs: [n + " id"]
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 f.ONE_TO_MANY:
192
- case f.MANY_TO_MANY:
213
+ case g.ONE_TO_MANY:
214
+ case g.MANY_TO_MANY:
193
215
  {
194
- const i = a.displayName || a.name, n = `RelationEntitiesObservable<${a.mappedEntity}>`;
195
- r.push({
196
- name: a.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: n,
201
- docs: [i]
222
+ type: r,
223
+ docs: [a]
202
224
  }), t.add("RelationEntitiesObservable");
203
225
  }
204
226
  break;
205
227
  }
206
228
  });
207
- }, Z = (r, e, t) => {
208
- const s = /* @__PURE__ */ new Set(), { name: a } = e, i = e.extends[0] || "", n = [];
209
- i.includes("TreeAdjacencyListEntityBase") ? n.push("ITreeEntity") : i.includes("EntityBase") && n.push("IEntity"), s.add(i);
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: a,
233
+ name: i,
212
234
  isExported: !0,
213
- extends: i,
214
- implements: n.sort(),
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: `${a}StaticTypes`,
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: `${a}StaticTypes`,
248
+ name: `${i}StaticTypes`,
227
249
  docs: ["静态类型"],
228
250
  isExported: !0
229
251
  }), h = [];
230
- z({
252
+ Z({
231
253
  classProperties: c,
232
254
  file: t,
233
255
  metadata: e,
234
256
  rxdbNamedImports: s
235
- }), W({
257
+ }), X({
236
258
  classProperties: c,
237
259
  metadata: e,
238
260
  rxdbNamedImports: s,
239
- generator: r
261
+ generator: n
240
262
  });
241
- const l = e.repository || I, y = r.getRepositoryGenerator(l);
242
- if (y) {
263
+ const l = e.repository || I, m = n.getRepositoryGenerator(l);
264
+ if (m) {
243
265
  if (l !== I) {
244
- const p = r.getRepositoryGenerator(I);
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: r,
272
+ generator: n,
251
273
  file: t,
252
274
  staticTypesInterface: u
253
275
  });
254
276
  }
255
- y.generate({
277
+ m.generate({
256
278
  metadata: e,
257
279
  classProperties: c,
258
280
  classMethods: h,
259
281
  rxdbNamedImports: s,
260
- generator: r,
282
+ generator: n,
261
283
  file: t,
262
284
  staticTypesInterface: u
263
285
  });
264
286
  }
265
287
  o.addProperties(
266
- c.sort((p, m) => p.isStatic && !m.isStatic ? -1 : !p.isStatic && m.isStatic ? 1 : p.isReadonly && !m.isReadonly ? -1 : !p.isReadonly && m.isReadonly ? 1 : p.name.localeCompare(m.name))
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: `${a}InitData`,
293
+ type: `${i}InitData`,
272
294
  hasQuestionToken: !0
273
295
  }
274
296
  ],
275
297
  docs: ["初始化数据", "@param initData 初始化数据"]
276
298
  });
277
- const g = v(h, (p) => p.name).sort(
278
- (p, m) => p.isStatic && !m.isStatic ? -1 : !p.isStatic && m.isStatic ? 1 : p.name.localeCompare(m.name)
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(g), {
302
+ return o.addMethods(f), {
281
303
  rxdbNamedImports: s
282
304
  };
283
- }, X = {
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
- }, A = (r) => X[r] ?? null, C = (r, e, t) => {
294
- const s = r.length > 0 ? r.map((a) => a.key).join(".") + "." : "";
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
- }, ee = (r, e, t) => {
319
+ }, se = (n, e, t) => {
297
320
  let s;
298
- switch (r.type) {
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<${M(r, e)}>`;
329
+ s = `Partial<${D(n, e)}>`;
307
330
  break;
308
331
  default:
309
- t.length > 0 && (s = $(r, e));
332
+ t.length > 0 && (s = T(n, e));
310
333
  }
311
334
  return s;
312
- }, E = (r, e, t, s, a) => ({
313
- rule: `${r}Rules`,
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: a
318
- }), te = (r, e, t, s, a) => {
319
- r.type !== d.keyValue || !("properties" in r) || !r.properties || r.properties.forEach((i) => {
320
- const n = A(i.type);
321
- if (!n) return;
322
- const o = C(t, s, i.name), c = $(i, e);
323
- a.push(E(n, e.name, o, c));
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
- }, se = (r, e = []) => {
348
+ }, re = (n, e = []) => {
326
349
  const t = [];
327
- return Array.from(r.propertyMap.keys()).forEach((s) => {
328
- const a = r.propertyMap.get(s), i = A(a.type);
329
- if (i) {
330
- const n = ee(a, r, e), o = C(e, s);
331
- t.push(E(i, r.name, o, n));
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
- te(a, r, e, s, t);
356
+ ne(i, n, e, s, t);
334
357
  }), t;
335
- }, re = (r, e, t) => {
358
+ }, ie = (n, e, t) => {
336
359
  e.foreignKeyNames.forEach((s) => {
337
- const a = e.foreignKeyRelationMap.get(s);
338
- if (!a) return;
339
- const n = r.getMetadata(a.mappedEntity, a.mappedNamespace)?.propertyMap.get("id")?.type, o = n && A(n) || "UUID";
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
- }, ne = (r) => {
343
- switch (r.kind) {
344
- case f.ONE_TO_MANY:
345
- case f.MANY_TO_MANY:
346
- return [r.mappedProperty];
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 = (r, e, t, s) => !!(r.some((i) => i.entity === s.name) || r.length > 0 && e === t), ie = (r, e, t, s, a, i) => {
351
- Array.from(e.relationMap.keys()).filter((n) => !s.includes(n)).forEach((n) => {
352
- const o = e.relationMap.get(n);
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 = r.getMetadata(o.mappedEntity, o.mappedNamespace);
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(i, c, t, e))
381
+ if (oe(a, c, t, e))
359
382
  return;
360
- if (i.length === 0) {
383
+ if (a.length === 0) {
361
384
  const l = `${c.name}RuleGroup`;
362
- a.push(E("RelationExists", e.name, n, void 0, l));
385
+ i.push(E("RelationExists", e.name, r, void 0, l));
363
386
  }
364
- if (i.length >= r.config.relationQueryDeep)
387
+ if (a.length >= n.config.relationQueryDeep)
365
388
  return;
366
- const u = ne(o), h = [...i, { key: n, entity: e.name }];
367
- N(r, c, t, u, a, h);
389
+ const u = ae(o), h = [...a, { key: r, entity: e.name }];
390
+ P(n, c, t, u, i, h);
368
391
  });
369
- }, N = (r, e, t, s = [], a = [], i = []) => (t = t ?? e, a.push(...se(e, i)), re(r, e, a), ie(r, e, t, s, a, i), a), k = (r, e) => r.map(({ rule: t, entity: s, key: a, valueType: i, subRuleGroup: n }) => (e.add(t), n ? `${t}<'${a}', ${n}>` : i ? a.includes(".") ? (e.add(`Relation${t}`), `Relation${t}<'${a}', ${i}>`) : `${t}<${s}, '${a}', ${i}>` : a.includes(".") ? (e.add(`Relation${t}`), `Relation${t}<'${a}'>`) : `${t}<${s}, '${a}'>`));
370
- class ae {
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: a, rxdbNamedImports: i } = e, n = [t.metHodDoc || `${t.method} 查询`, "@param options 查询选项"];
398
- t.example && n.push("@example", t.example), s.push({
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: n,
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
- }), a.addProperty({
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)/) && i.add(c);
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 S(e);
457
+ return A(e);
435
458
  }
436
459
  }
437
- class B extends ae {
460
+ class v extends de {
438
461
  name = "Repository";
439
462
  generateMethods(e) {
440
- const { metadata: t, file: s, rxdbNamedImports: a, staticTypesInterface: i } = e, { name: n } = t, o = S(t);
441
- i.addProperty({
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 = N(e.generator, t), u = k(c, a), h = `
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: `${n}Rule`,
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: `${n}RuleGroup`,
479
+ name: `${r}RuleGroup`,
457
480
  // 关键:逗号后不加空格,直接换行,避免行尾空格
458
- type: `RuleGroupBase<typeof ${n},${h},
459
- ${n}Rule>`,
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 = `${n}OrderByField`, y = Array.from(t.propertyMap.keys());
487
+ const l = `${r}OrderByField`, m = Array.from(t.propertyMap.keys());
465
488
  s.addTypeAlias({
466
489
  name: l,
467
- type: y.map((p) => `"${p}"`).join(" | "),
490
+ type: m.map((p) => `"${p}"`).join(" | "),
468
491
  hasDeclareKeyword: !0,
469
492
  docs: ["OrderByField"]
470
493
  });
471
- const g = (p) => ({
494
+ const f = (p) => ({
472
495
  method: p,
473
- options: `${b(p)}Options<typeof ${n},${n}RuleGroup,${l}>`
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: n,
501
+ returnType: r,
479
502
  metHodDoc: "根据 ID 获取单个实体",
480
- example: `${n}.get('123').subscribe(entity => console.log(entity));`,
503
+ example: `${r}.get('123').subscribe(entity => console.log(entity));`,
481
504
  optionsIsRequired: !0
482
505
  }), this.addStaticMethod(e, {
483
- ...g("findOneOrFail"),
484
- returnType: n,
506
+ ...f("findOneOrFail"),
507
+ returnType: r,
485
508
  metHodDoc: "查询单个实体,未找到时抛出错误",
486
- example: `${n}.findOneOrFail({ where: { combinator: 'and', rules: [] } }).subscribe(entity => console.log(entity));`,
509
+ example: `${r}.findOneOrFail({ where: { combinator: 'and', rules: [] } }).subscribe(entity => console.log(entity));`,
487
510
  optionsIsRequired: !0
488
511
  }), this.addStaticMethod(e, {
489
- ...g("find"),
490
- returnType: `${n}[]`,
512
+ ...f("find"),
513
+ returnType: `${r}[]`,
491
514
  metHodDoc: "查询多个实体",
492
- example: `${n}.find({ where: { combinator: 'and', rules: [] }] }).subscribe(list => console.log(list));`,
515
+ example: `${r}.find({ where: { combinator: 'and', rules: [] }] }).subscribe(list => console.log(list));`,
493
516
  optionsIsRequired: !0
494
517
  }), this.addStaticMethod(e, {
495
- ...g("findOne"),
496
- returnType: `${n} | undefined`,
518
+ ...f("findOne"),
519
+ returnType: `${r} | undefined`,
497
520
  metHodDoc: "查询单个实体,未找到时返回 undefined",
498
- example: `${n}.findOne({ where: { combinator: 'and', rules: [] } }).subscribe(entity => console.log(entity));`,
521
+ example: `${r}.findOne({ where: { combinator: 'and', rules: [] } }).subscribe(entity => console.log(entity));`,
499
522
  optionsIsRequired: !0
500
523
  }), this.addStaticMethod(e, {
501
- ...g("findAll"),
502
- returnType: `${n}[]`,
524
+ ...f("findAll"),
525
+ returnType: `${r}[]`,
503
526
  metHodDoc: "查询所有实体",
504
- example: `${n}.findAll({ where: { combinator: 'and', rules: [] } }).subscribe(list => console.log(list));`,
527
+ example: `${r}.findAll({ where: { combinator: 'and', rules: [] } }).subscribe(list => console.log(list));`,
505
528
  optionsIsRequired: !0
506
529
  }), this.addStaticMethod(e, {
507
- ...g("findByCursor"),
508
- returnType: `${n}[]`,
530
+ ...f("findByCursor"),
531
+ returnType: `${r}[]`,
509
532
  metHodDoc: "游标分页查询",
510
- example: `${n}.findByCursor({ where: { combinator: 'and', rules: [] } }).subscribe(list => console.log(list));`,
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 ${n},${n}RuleGroup>`,
537
+ options: `${b("count")}Options<typeof ${r},${r}RuleGroup>`,
515
538
  returnType: "number",
516
539
  metHodDoc: "统计实体数量",
517
- example: `${n}.count({ where: { combinator: 'and', rules: [] } }).subscribe(total => console.log(total));`,
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<${n}>`,
544
+ returnType: `Promise<${r}>`,
522
545
  docs: ["保存"]
523
546
  }), this.addInstanceMethod(e, {
524
547
  name: "remove",
525
- returnType: `Promise<${n}>`,
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 ce extends B {
557
+ class pe extends v {
535
558
  name = "TreeRepository";
536
559
  generateMethods(e) {
537
- const { metadata: t, rxdbNamedImports: s, generator: a, file: i, staticTypesInterface: n } = e, { name: o } = t, c = N(a, t).filter(
538
- (y) => y.key.startsWith("children.") && y.key !== "children.id"
539
- ), u = k(c, s), h = c.map((y) => `'${y.key}'`).join(" | ");
540
- i.addTypeAlias({
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
- }), i.addTypeAlias({
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
- }), n.addProperty({
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__ */ ((r) => (r.Var = "var", r.Let = "let", r.Const = "const", r))(G || {});
596
- class T {
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), a = e.map((i) => `${s} * ${i}`).join(`
651
+ const s = " ".repeat(t), i = e.map((a) => `${s} * ${a}`).join(`
629
652
  `);
630
653
  return `${s}/**
631
- ${a}
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 a = " ".repeat(t), i = [];
640
- return e.docs?.length && i.push(this.renderJsDoc(e.docs, t)), i.push(a), e.isStatic && i.push("static "), e.isReadonly && i.push("readonly "), i.push(e.name), e.hasQuestionToken && i.push("?"), e.type && i.push(`: ${e.type}`), !s && e.initializer && i.push(` = ${e.initializer}`), i.push(`;
641
- `), i.join("");
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 a = " ".repeat(t), i = [];
648
- return e.docs?.length && i.push(this.renderJsDoc(e.docs, t)), i.push(a), s && e.isExported && i.push("export "), i.push(`interface ${e.name}`), e.extends?.length && i.push(` extends ${e.extends.join(", ")}`), i.push(` {
649
- `), e.properties?.length && e.properties.forEach((n) => {
650
- i.push(this.renderProperty(n, t + 2));
651
- }), i.push(`${a}}
652
- `), i.join("");
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((a) => {
684
- s.push(this.renderInterfaceBlock(a, 2, !1));
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 = [], a = e.jsDoc?.length ? e.jsDoc : [t];
697
- s.push(this.renderJsDoc(a)), s.push(`export declare class ${t}`);
698
- const i = e.getBaseClass();
699
- if (i) {
700
- const o = i.getName();
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 n = e.getImplements();
704
- if (n.length) {
705
- const o = n.map((c) => c.getText()).join(", ");
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 de {
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 pe {
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 pe(e);
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 de(e), this.interfaces.push(t)), t;
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: (a) => {
829
- const i = this.modules[this.modules.length - 1], n = i.interfaces[i.interfaces.length - 1];
830
- n.properties || (n.properties = []), n.properties.push(a);
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
- T.renderImports(this.imports),
854
- T.renderTypeAliases(this.typeAliases),
855
- T.renderModules(this.modules),
856
- this.interfaces.map((t) => T.renderInterfaceBlock(t, 0, !0) + `
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) => T.renderClass(t)).join(""),
859
- T.renderVariables(this.variables)
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 le {
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", ge = "TreeRepository", Te = "GraphRepository", ue = "EntityBase", he = "TreeAdjacencyListEntityBase", ye = "TreeEntityBase", x = (r, e = Y) => `${e}_${r}`;
887
- class $e {
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
- [ue, [R]],
895
- [he, [P, R]],
896
- [ye, [P, R]]
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 B()), this.registerRepositoryGenerator(new ce());
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 (U(e))
963
+ if (L(e))
915
964
  s = K(e);
916
965
  else {
917
- const a = e;
918
- t = t || a.extends?.length && this.entityMetadataOptionsMap.get(a.extends[0]) || [], s = O(e, 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(x(e, t));
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 a = O(s);
928
- this.metadataMap.set(x(s.name, s.namespace), a);
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 le(), this.generateAllEntityDefinition(), this.generateEntityJsFile();
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 a = /* @__PURE__ */ new Set(["Entity", "__decorateClass"]), i = (o) => {
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 === f.MANY_TO_MANY && u.name === o.mappedProperty && u.mappedProperty === o.name
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 === f.MANY_TO_MANY && !i(c))
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 = q(o);
983
- c && a.add(c), o.properties.length && a.add("PropertyType"), o.relations.length && a.add("RelationKind"), s += `
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(a).sort().join(", ")} } from '@aiao/rxdb';` + s;
992
- const n = Array.from(t.values()).map((o) => o.name).sort().join(", ");
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 = [ ${n} ];`, s += `
995
- export { ENTITIES, ${n} };`, e.createSourceFile("index.js", s);
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"), i = s.addModule({
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
- }), n = /* @__PURE__ */ new Set(["EntityType", "IEntity", "ITreeEntity", "RuleGroupBase", "UUID"]);
1058
+ }), r = /* @__PURE__ */ new Set(["EntityType", "IEntity", "ITreeEntity", "RuleGroupBase", "UUID"]);
1010
1059
  t.forEach((o) => {
1011
- const { rxdbNamedImports: c } = Z(this, o, s);
1012
- c.forEach((l) => n.add(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 ? i.addProperty({
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
- }) : i.addProperty({
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(n).filter(Boolean).sort(),
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
- Te as R,
1097
+ Ee as R,
1049
1098
  I as a,
1050
- ge as b,
1051
- ae as c,
1052
- $e as d
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-8UTHmwAo.js";
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-B9ubrwmh.js";
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,cAAc,EAAE,sBAAsB,EAA8B,MAAM,YAAY,CAAC;AAEhG,OAAO,KAAK,EAAgB,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAExF;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAAI,UAAU,sBAAsB,EAAE,UAAU,cAAc;UAUtF,MAAM;UACN,MAAM;CAaf,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,UAAU,sBAAsB,EAAE,UAAU,cAAc,WACL,CAAC;AAC9F;;;G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AAC;AAmBF,eAAO,MAAM,wBAAwB,GAAI,UAAU,cAAc;;;CAShE,CAAC;AAsBF,eAAO,MAAM,kCAAkC,GAAI,UAAU,cAAc;;;CAS1E,CAAC;AAkBF,wBAAgB,kBAAkB,CAAC,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,CAAC;AAEvD;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,CAAC;AAIhC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YAAY,CAAC;AAMlF,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,SA8EA,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;AAkOD,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"}
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
@@ -1,4 +1,4 @@
1
- import { N as O, R as P, a, b as T, c as Y, d as _ } from "./RxDBClientGenerator-8UTHmwAo.js";
1
+ import { N as O, R as P, a, b as T, c as Y, d as _ } from "./RxDBClientGenerator-xjVHqGPq.js";
2
2
  export {
3
3
  O as NAMESPACE_PUBLIC,
4
4
  P as REPOSITORY_TYPE_GRAPH_REPOSITORY,
package/dist/vite.js CHANGED
@@ -1,4 +1,4 @@
1
- import { b as i } from "./build-client-lib-B9ubrwmh.js";
1
+ import { b as i } from "./build-client-lib-CGIfjQOF.js";
2
2
  function l(n) {
3
3
  return {
4
4
  name: "rxdb-client-generator-vite-plugin",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiao/rxdb-client-generator",
3
- "version": "0.0.13",
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.13",
44
- "@aiao/utils": "0.0.13"
43
+ "@aiao/rxdb": "0.0.14",
44
+ "@aiao/utils": "0.0.14"
45
45
  }
46
46
  }