@aiao/rxdb-client-generator 0.0.2 → 0.0.4

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.
Files changed (54) hide show
  1. package/LICENSE +21 -0
  2. package/dist/RxDBClientGenerator-HeMQrLeK.js +860 -0
  3. package/{RxDBClientGenerator.d.ts → dist/RxDBClientGenerator.d.ts} +8 -12
  4. package/dist/RxDBClientGenerator.d.ts.map +1 -0
  5. package/{RxDBClientGenerator.utils.d.ts → dist/RxDBClientGenerator.utils.d.ts} +2 -1
  6. package/dist/RxDBClientGenerator.utils.d.ts.map +1 -0
  7. package/dist/analyze_file.d.ts +14 -0
  8. package/dist/analyze_file.d.ts.map +1 -0
  9. package/dist/build_rxdb_client_lib-ClVnYEnB.js +93 -0
  10. package/dist/build_rxdb_client_lib.d.ts +4 -0
  11. package/dist/build_rxdb_client_lib.d.ts.map +1 -0
  12. package/dist/cli.d.ts +3 -0
  13. package/dist/cli.d.ts.map +1 -0
  14. package/dist/cli.interface.d.ts +6 -0
  15. package/dist/cli.interface.d.ts.map +1 -0
  16. package/dist/cli.js +62 -0
  17. package/dist/find_files.d.ts +3 -0
  18. package/dist/find_files.d.ts.map +1 -0
  19. package/dist/generator_all_entity_definition.d.ts +7 -0
  20. package/dist/generator_all_entity_definition.d.ts.map +1 -0
  21. package/{generator_entity_definition.d.ts → dist/generator_entity_definition.d.ts} +3 -2
  22. package/dist/generator_entity_definition.d.ts.map +1 -0
  23. package/{generator_entity_js_file.d.ts → dist/generator_entity_js_file.d.ts} +2 -1
  24. package/dist/generator_entity_js_file.d.ts.map +1 -0
  25. package/{generator_entity_properties.d.ts → dist/generator_entity_properties.d.ts} +4 -2
  26. package/dist/generator_entity_properties.d.ts.map +1 -0
  27. package/{generator_entity_relations.d.ts → dist/generator_entity_relations.d.ts} +5 -2
  28. package/dist/generator_entity_relations.d.ts.map +1 -0
  29. package/{generator_entity_rules.d.ts → dist/generator_entity_rules.d.ts} +3 -2
  30. package/dist/generator_entity_rules.d.ts.map +1 -0
  31. package/dist/generator_repository_methods.d.ts +19 -0
  32. package/dist/generator_repository_methods.d.ts.map +1 -0
  33. package/{generator_tree_repository_methods.d.ts → dist/generator_tree_repository_methods.d.ts} +5 -3
  34. package/dist/generator_tree_repository_methods.d.ts.map +1 -0
  35. package/dist/generator_utils.d.ts +3 -0
  36. package/dist/generator_utils.d.ts.map +1 -0
  37. package/dist/index.d.ts +3 -0
  38. package/dist/index.d.ts.map +1 -0
  39. package/dist/index.js +4 -0
  40. package/dist/ts_morph_browser.d.ts +252 -0
  41. package/dist/ts_morph_browser.d.ts.map +1 -0
  42. package/dist/vite.d.ts +4 -0
  43. package/dist/vite.d.ts.map +1 -0
  44. package/dist/vite.js +15 -0
  45. package/package.json +28 -20
  46. package/cli.d.ts +0 -2
  47. package/cli.js +0 -94
  48. package/generator_all_entity_definition.d.ts +0 -6
  49. package/generator_repository_methods.d.ts +0 -14
  50. package/index.d.ts +0 -2
  51. package/index.js +0 -857
  52. package/ts-morph-browser.d.ts +0 -124
  53. package/vite.d.ts +0 -6
  54. package/vite.js +0 -11
@@ -1,38 +1,34 @@
1
1
  import { EntityMetadataOptions, EntityType } from '@aiao/rxdb';
2
- import { SetRequired } from 'type-fest';
3
- import { Project } from './ts-morph-browser';
2
+ import { Project } from './ts_morph_browser.js';
4
3
  export interface RxDBClientGeneratorOptions {
5
4
  /**
6
5
  * 关系查询深度
7
6
  * 最小为 1
8
- * @default 2
7
+ * @default 3
9
8
  * @example 1 允许查询自己的基本属性 + 自己的关系的基本属性
10
9
  * @example 2 允许查询自己的基本属性 + 自己的关系的基本属性 + 自己关系的关系的基本属性
11
10
  */
12
11
  relationQueryDeep?: number;
13
12
  }
14
- /**
15
- * 生成时使用的 metadata
16
- * ‘extends’ 必填,因为 json 并不能算出继承关系
17
- *
18
- */
19
- export type GeneratorEntityMetadataOptions = SetRequired<EntityMetadataOptions, 'extends'>;
20
13
  /**
21
14
  * RxDB Client 生成器
22
15
  */
23
16
  export declare class RxDBClientGenerator {
17
+ private metadataMap;
24
18
  project: Project;
25
- metadataSet: Set<import('type-fest/source/readonly-deep').ReadonlyObjectDeep<import('@aiao/rxdb').EntityMetadataType>>;
26
- metadataMap: Map<string, import('type-fest/source/readonly-deep').ReadonlyObjectDeep<import('@aiao/rxdb').EntityMetadataType>>;
19
+ metadataSet: Set<Readonly<import('@aiao/rxdb').EntityMetadataType>>;
27
20
  config: Required<RxDBClientGeneratorOptions>;
28
21
  constructor(options?: RxDBClientGeneratorOptions);
29
22
  /**
30
23
  * 添加实体配置
31
24
  * @param value 实体
32
25
  */
33
- addEntity(value: GeneratorEntityMetadataOptions | EntityType): void;
26
+ addEntity(value: EntityMetadataOptions | EntityType, options?: EntityMetadataOptions[]): void;
27
+ getMetadata(mappedEntity: string, mappedNamespace: string): Readonly<import('@aiao/rxdb').EntityMetadataType> | undefined;
34
28
  /**
35
29
  * 执行生成器
36
30
  */
37
31
  exec(): void;
32
+ getSourceFiles(): import('./ts_morph_browser.js').SourceFile[];
38
33
  }
34
+ //# sourceMappingURL=RxDBClientGenerator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RxDBClientGenerator.d.ts","sourceRoot":"","sources":["../src/RxDBClientGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,qBAAqB,EACrB,UAAU,EAIX,MAAM,YAAY,CAAC;AAIpB,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,MAAM,WAAW,0BAA0B;IACzC;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAKD;;GAEG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,WAAW,CAAqC;IACxD,OAAO,EAAG,OAAO,CAAC;IAClB,WAAW,yDAA6B;IAExC,MAAM,EAAE,QAAQ,CAAC,0BAA0B,CAAC,CAE1C;gBAEU,OAAO,CAAC,EAAE,0BAA0B;IAKhD;;;OAGG;IACH,SAAS,CAAC,KAAK,EAAE,qBAAqB,GAAG,UAAU,EAAE,OAAO,CAAC,EAAE,qBAAqB,EAAE;IAatF,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM;IAIzD;;OAEG;IACH,IAAI;IAYJ,cAAc;CAGf"}
@@ -1,5 +1,5 @@
1
1
  import { EntityMetadata, EntityPropertyMetadata } from '@aiao/rxdb';
2
- import { PropertyDeclarationStructure } from './ts-morph-browser';
2
+ import { PropertyDeclarationStructure } from './ts_morph_browser.js';
3
3
  /**
4
4
  * 获取属性配置
5
5
  */
@@ -17,3 +17,4 @@ export declare const getGeneratorEntityDefinitionConfig: (metadata: EntityMetada
17
17
  fileName: string;
18
18
  };
19
19
  export declare function transitionMetadata(metadata: EntityMetadata): string;
20
+ //# sourceMappingURL=RxDBClientGenerator.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RxDBClientGenerator.utils.d.ts","sourceRoot":"","sources":["../src/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;UAU5D,MAAM;UACN,MAAM;CAaf,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,UAAU,sBAAsB,WAyBvE,CAAC;AAiBF,eAAO,MAAM,wBAAwB,GAAI,UAAU,cAAc;;;CAShE,CAAC;AAkBF,eAAO,MAAM,kCAAkC,GAAI,UAAU,cAAc;;;CAS1E,CAAC;AAcF,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,CAyBnE"}
@@ -0,0 +1,14 @@
1
+ import { EntityMetadataOptions } from '@aiao/rxdb';
2
+ import { Project } from 'ts-morph';
3
+ interface AnalyzeFileResult {
4
+ decoratorName: string;
5
+ metadataOptions: EntityMetadataOptions;
6
+ extendMetadataOptions: EntityMetadataOptions[];
7
+ implements: string[];
8
+ }
9
+ /**
10
+ * 分析文件中的类
11
+ */
12
+ declare const _default: (filePath: string, project?: Project) => AnalyzeFileResult[];
13
+ export default _default;
14
+ //# sourceMappingURL=analyze_file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyze_file.d.ts","sourceRoot":"","sources":["../src/analyze_file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAwD,MAAM,YAAY,CAAC;AACzG,OAAO,EAAQ,OAAO,EAAE,MAAM,UAAU,CAAC;AAEzC,UAAU,iBAAiB;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,qBAAqB,CAAC;IACvC,qBAAqB,EAAE,qBAAqB,EAAE,CAAC;IAC/C,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AASD;;GAEG;yBACa,UAAU,MAAM,EAAE,UAAS,OAAuB,KAAG,iBAAiB,EAAE;AAAxF,wBAuDE"}
@@ -0,0 +1,93 @@
1
+ import { mkdirSync as h, writeFileSync as x } from "node:fs";
2
+ import { resolve as b, join as E, dirname as _ } from "node:path";
3
+ import { Project as g, Node as u } from "ts-morph";
4
+ import { getEntityMetadataOptions as w, PropertyType as N, RelationKind as C } from "@aiao/rxdb";
5
+ import { glob as O } from "glob";
6
+ import { R as F } from "./RxDBClientGenerator-HeMQrLeK.js";
7
+ const P = (r, s = new g()) => {
8
+ const n = s.addSourceFileAtPath(r).getClasses(), c = /* @__PURE__ */ new Map();
9
+ n.forEach((t) => {
10
+ const e = t.getName();
11
+ if (!e) return;
12
+ const o = { decoratorName: "", extends: "", implements: [] };
13
+ c.set(e, o);
14
+ const m = T(t);
15
+ if (m.length === 1) {
16
+ const { args: p, metadataOptions: d, name: y } = m[0];
17
+ p.length === 1 && (o.metadataOptions = d, o.decoratorName = y);
18
+ }
19
+ const l = t.getBaseClass()?.getName();
20
+ l && (o.extends = l), t.getImplements().forEach((p) => {
21
+ const d = p.getText();
22
+ o.implements.push(d);
23
+ });
24
+ });
25
+ const i = [];
26
+ for (const t of c.values()) {
27
+ const { metadataOptions: e, decoratorName: o } = t;
28
+ if (e) {
29
+ switch (o) {
30
+ case "Entity":
31
+ e.repository = "Repository";
32
+ break;
33
+ case "TreeEntity":
34
+ e.repository = "TreeRepository";
35
+ break;
36
+ }
37
+ i.push({
38
+ decoratorName: o,
39
+ metadataOptions: e,
40
+ implements: t.implements,
41
+ extendMetadataOptions: w(t.extends)
42
+ });
43
+ }
44
+ }
45
+ return i;
46
+ }, T = (r) => u.isDecoratable(r) ? r.getDecorators().map((s) => {
47
+ const a = s.getName(), n = s.getExpression(), c = u.isCallExpression(n);
48
+ let i = [], t;
49
+ return c && (i = n.getArguments().map((e) => e.getText()), i.length && (t = M(i[0]))), {
50
+ name: a,
51
+ args: i,
52
+ metadataOptions: t
53
+ };
54
+ }) : [], M = (r) => {
55
+ try {
56
+ return new Function("PropertyType", "RelationKind", `return ${r}`)(N, C);
57
+ } catch (s) {
58
+ console.error(s);
59
+ }
60
+ }, R = async (r) => {
61
+ const s = [];
62
+ for (const a of r)
63
+ try {
64
+ if (a.includes("*") || a.includes("?")) {
65
+ const n = await O(a, {
66
+ absolute: !0,
67
+ ignore: ["**/node_modules/**", "**/dist/**", "**/build/**", "**/.git/**"]
68
+ });
69
+ s.push(...n);
70
+ } else {
71
+ const n = b(a);
72
+ s.push(n);
73
+ }
74
+ } catch (n) {
75
+ console.error(`处理路径 ${a} 时出错:`, n);
76
+ }
77
+ return [...new Set(s)];
78
+ }, B = async (r) => {
79
+ const { entities: s, outDir: a, ...n } = r, c = await R(s), i = new g(), t = new F(n);
80
+ for (let e = 0; e < c.length; e++) {
81
+ const o = c[e];
82
+ P(o, i).forEach(({ metadataOptions: f, extendMetadataOptions: l }) => {
83
+ t.addEntity(f, l);
84
+ });
85
+ }
86
+ t.exec(), t.getSourceFiles().forEach((e) => {
87
+ const o = E(a, e.getFilePath());
88
+ h(_(o), { recursive: !0 }), x(o, e.getText());
89
+ });
90
+ };
91
+ export {
92
+ B as b
93
+ };
@@ -0,0 +1,4 @@
1
+ import { RxDBClientCLIentGeneratorOptions } from './cli.interface.js';
2
+ declare const _default: (options: RxDBClientCLIentGeneratorOptions) => Promise<void>;
3
+ export default _default;
4
+ //# sourceMappingURL=build_rxdb_client_lib.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build_rxdb_client_lib.d.ts","sourceRoot":"","sources":["../src/build_rxdb_client_lib.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gCAAgC,EAAE,MAAM,oBAAoB,CAAC;yBAIhD,SAAS,gCAAgC;AAA/D,wBAkBE"}
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export declare function main(): Promise<void>;
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAyEA,wBAAsB,IAAI,kBAwCzB"}
@@ -0,0 +1,6 @@
1
+ import { RxDBClientGeneratorOptions } from './RxDBClientGenerator.js';
2
+ export interface RxDBClientCLIentGeneratorOptions extends RxDBClientGeneratorOptions {
3
+ entities: string[];
4
+ outDir: string;
5
+ }
6
+ //# sourceMappingURL=cli.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.interface.d.ts","sourceRoot":"","sources":["../src/cli.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAEtE,MAAM,WAAW,gCAAiC,SAAQ,0BAA0B;IAClF,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB"}
package/dist/cli.js ADDED
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env node
2
+ import { existsSync as f } from "node:fs";
3
+ import { resolve as c, dirname as a } from "node:path";
4
+ import { b as g } from "./build_rxdb_client_lib-ClVnYEnB.js";
5
+ async function u(s) {
6
+ try {
7
+ if (!f(s))
8
+ throw new Error(`配置文件不存在: ${s}`);
9
+ const t = c(s), i = a(t), r = await import(t);
10
+ let e;
11
+ if (r.default)
12
+ e = r.default;
13
+ else if (r.config)
14
+ e = r.config;
15
+ else if (r.rxdbConfig)
16
+ e = r.rxdbConfig;
17
+ else {
18
+ const o = Object.keys(r);
19
+ if (o.length === 0)
20
+ throw new Error("配置文件中没有找到有效的配置导出");
21
+ e = r[o[0]];
22
+ }
23
+ return Array.isArray(e) || (e = [e]), e.forEach((o, l) => {
24
+ if (!o.entities || !Array.isArray(o.entities))
25
+ throw new Error(`配置项 ${l}: entities 必须是字符串数组`);
26
+ if (!o.outDir || typeof o.outDir != "string")
27
+ throw new Error(`配置项 ${l}: outDir 必须是字符串`);
28
+ o.entities = o.entities.map((n) => n.startsWith(".") ? c(i, n) : n), o.outDir.startsWith(".") && (o.outDir = c(i, o.outDir));
29
+ }), e;
30
+ } catch (t) {
31
+ throw new Error(`加载配置文件失败: ${t instanceof Error ? t.message : String(t)}`);
32
+ }
33
+ }
34
+ async function d() {
35
+ try {
36
+ const s = process.argv.slice(2);
37
+ s.length === 0 && (console.error("❌ 请提供配置文件路径"), console.log("使用方法: node cli.js <配置文件路径>"), console.log("示例: node cli.js ./rxdb.config.ts"), console.log("示例: node cli.js packages/rxdb-test/rxdb.config.ts"), process.exit(1));
38
+ const t = s[0];
39
+ console.log("📁 正在加载配置文件:", t);
40
+ const i = await u(t);
41
+ console.log(`✅ 成功加载 ${i.length} 个配置项`);
42
+ for (let r = 0; r < i.length; r++) {
43
+ const e = i[r];
44
+ console.log(`🚀 正在执行配置项 ${r + 1}/${i.length}:`), console.log(` - 实体文件: ${e.entities.join(", ")}`), console.log(` - 输出目录: ${e.outDir}`);
45
+ try {
46
+ await g(e), console.log(`✅ 配置项 ${r + 1} 执行成功`);
47
+ } catch (o) {
48
+ throw console.error(`❌ 配置项 ${r + 1} 执行失败:`, o), o;
49
+ }
50
+ }
51
+ console.log("🎉 所有配置项执行完成!");
52
+ } catch (s) {
53
+ console.error("❌ 程序执行出错:", s), process.exit(1);
54
+ }
55
+ }
56
+ const h = import.meta.url === `file://${process.argv[1]}`;
57
+ h && d().catch((s) => {
58
+ console.error("❌ 程序执行出错:", s), process.exit(1);
59
+ });
60
+ export {
61
+ d as main
62
+ };
@@ -0,0 +1,3 @@
1
+ declare const _default: (filePaths: string[]) => Promise<string[]>;
2
+ export default _default;
3
+ //# sourceMappingURL=find_files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find_files.d.ts","sourceRoot":"","sources":["../src/find_files.ts"],"names":[],"mappings":"yBAGsB,WAAW,MAAM,EAAE,KAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AAA7D,wBAoBE"}
@@ -0,0 +1,7 @@
1
+ import { RxDBClientGenerator } from './RxDBClientGenerator.js';
2
+ /**
3
+ * 生成所有 entity 的定义到 index.d.ts 文件里
4
+ */
5
+ declare const _default: (generator: RxDBClientGenerator) => void;
6
+ export default _default;
7
+ //# sourceMappingURL=generator_all_entity_definition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator_all_entity_definition.d.ts","sourceRoot":"","sources":["../src/generator_all_entity_definition.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAGpE;;GAEG;yBACa,WAAW,mBAAmB;AAA9C,wBAyEE"}
@@ -1,6 +1,6 @@
1
1
  import { EntityMetadata } from '@aiao/rxdb';
2
- import { RxDBClientGenerator } from './RxDBClientGenerator';
3
- import { SourceFile } from './ts-morph-browser';
2
+ import { RxDBClientGenerator } from './RxDBClientGenerator.js';
3
+ import { SourceFile } from './ts_morph_browser.js';
4
4
  /**
5
5
  * 生成一个实体的类型文件
6
6
  */
@@ -8,3 +8,4 @@ declare const _default: (generator: RxDBClientGenerator, metadata: EntityMetadat
8
8
  rxdbNamedImports: Set<string>;
9
9
  };
10
10
  export default _default;
11
+ //# sourceMappingURL=generator_entity_definition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator_entity_definition.d.ts","sourceRoot":"","sources":["../src/generator_entity_definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAO5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAIV,UAAU,EACX,MAAM,uBAAuB,CAAC;AAE/B;;GAEG;yBACa,WAAW,mBAAmB,EAAE,UAAU,cAAc,EAAE,MAAM,UAAU;;;AAA1F,wBAmIE"}
@@ -1,6 +1,7 @@
1
- import { RxDBClientGenerator } from './RxDBClientGenerator';
1
+ import { RxDBClientGenerator } from './RxDBClientGenerator.js';
2
2
  /**
3
3
  * 生成实体的 js 文件
4
4
  */
5
5
  declare const _default: (generator: RxDBClientGenerator) => void;
6
6
  export default _default;
7
+ //# sourceMappingURL=generator_entity_js_file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator_entity_js_file.d.ts","sourceRoot":"","sources":["../src/generator_entity_js_file.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAGpE;;GAEG;yBACa,WAAW,mBAAmB;AAA9C,wBA8DE"}
@@ -1,11 +1,13 @@
1
1
  import { EntityMetadata } from '@aiao/rxdb';
2
- import { OptionalKind, PropertyDeclarationStructure, SourceFile } from './ts-morph-browser';
2
+ import { OptionalKind, PropertyDeclarationStructure, SourceFile } from './ts_morph_browser.js';
3
3
  /**
4
4
  * 生成实体的属性
5
5
  */
6
- declare const _default: ({ classProperties, metadata, file }: {
6
+ declare const _default: ({ classProperties, metadata, file, rxdbNamedImports }: {
7
7
  metadata: EntityMetadata;
8
8
  file: SourceFile;
9
9
  classProperties: OptionalKind<PropertyDeclarationStructure>[];
10
+ rxdbNamedImports: Set<string>;
10
11
  }) => void;
11
12
  export default _default;
13
+ //# sourceMappingURL=generator_entity_properties.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator_entity_properties.d.ts","sourceRoot":"","sources":["../src/generator_entity_properties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,KAAK,EAAE,YAAY,EAAE,4BAA4B,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEpG;;GAEG;yBACa,uDAKb;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;AAVD,wBAkDE"}
@@ -1,5 +1,6 @@
1
1
  import { EntityMetadata } from '@aiao/rxdb';
2
- import { OptionalKind, PropertyDeclarationStructure } from './ts-morph-browser';
2
+ import { RxDBClientGenerator } from './RxDBClientGenerator.js';
3
+ import { OptionalKind, PropertyDeclarationStructure } from './ts_morph_browser.js';
3
4
  /**
4
5
  * 生成实体的关系属性
5
6
  *
@@ -14,9 +15,11 @@ import { OptionalKind, PropertyDeclarationStructure } from './ts-morph-browser';
14
15
  * @param options.classProperties - 类属性数组,生成的属性会添加到这里
15
16
  * @param options.rxdbNamedImports - rxdb导入集合,用于收集所需的导入
16
17
  */
17
- declare const _default: ({ classProperties, metadata, rxdbNamedImports }: {
18
+ declare const _default: ({ classProperties, metadata, rxdbNamedImports, generator }: {
18
19
  metadata: EntityMetadata;
19
20
  classProperties: OptionalKind<PropertyDeclarationStructure>[];
20
21
  rxdbNamedImports: Set<string>;
22
+ generator: RxDBClientGenerator;
21
23
  }) => void;
22
24
  export default _default;
25
+ //# sourceMappingURL=generator_entity_relations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator_entity_relations.d.ts","sourceRoot":"","sources":["../src/generator_entity_relations.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,cAAc,EAAgB,MAAM,YAAY,CAAC;AAE1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAExF;;;;;;;;;;;;;GAaG;yBACa,4DAKb;IACD,QAAQ,EAAE,cAAc,CAAC;IACzB,eAAe,EAAE,YAAY,CAAC,4BAA4B,CAAC,EAAE,CAAC;IAC9D,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B,SAAS,EAAE,mBAAmB,CAAC;CAChC;AAVD,wBA6EE"}
@@ -1,6 +1,6 @@
1
1
  import { EntityMetadata } from '@aiao/rxdb';
2
- import { RxDBClientGenerator } from './RxDBClientGenerator';
3
- interface RuleTypeData {
2
+ import { RxDBClientGenerator } from './RxDBClientGenerator.js';
3
+ export interface RuleTypeData {
4
4
  rule: string;
5
5
  entity: string;
6
6
  key: string;
@@ -11,3 +11,4 @@ declare const generator_entity_rules: (generator: RxDBClientGenerator, metadata:
11
11
  entity: string;
12
12
  }[]) => RuleTypeData[];
13
13
  export default generator_entity_rules;
14
+ //# sourceMappingURL=generator_entity_rules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator_entity_rules.d.ts","sourceRoot":"","sources":["../src/generator_entity_rules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA8B,MAAM,YAAY,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAG/D,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAuCD,QAAA,MAAM,sBAAsB,GAC1B,WAAW,mBAAmB,EAC9B,UAAU,cAAc,EACxB,gBAAgB,cAAc,EAC9B,aAAY,MAAM,EAAO,EACzB,SAAQ,YAAY,EAAO,EAC3B,QAAO;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAAO,KAC5C,YAAY,EA2Dd,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { EntityMetadata, UUID } from '@aiao/rxdb';
2
+ import { RuleTypeData } from './generator_entity_rules.js';
3
+ import { RxDBClientGenerator } from './RxDBClientGenerator.js';
4
+ import { AddedInterface, MethodDeclarationStructure, OptionalKind, SourceFile } from './ts_morph_browser.js';
5
+ export declare const build_rules: (entityRules: RuleTypeData[], rxdbNamedImports: Set<string>) => string[];
6
+ /**
7
+ * 生成 repository 方法
8
+ */
9
+ declare const _default: ({ classMethods, rxdbNamedImports, generator, metadata, file, staticTypesInterface, idType }: {
10
+ classMethods: OptionalKind<MethodDeclarationStructure>[];
11
+ rxdbNamedImports: Set<string>;
12
+ generator: RxDBClientGenerator;
13
+ metadata: EntityMetadata;
14
+ file: SourceFile;
15
+ staticTypesInterface: AddedInterface;
16
+ idType: UUID | string | number;
17
+ }) => void;
18
+ export default _default;
19
+ //# sourceMappingURL=generator_repository_methods.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator_repository_methods.d.ts","sourceRoot":"","sources":["../src/generator_repository_methods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElD,OAA+B,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,0BAA0B,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAElH,eAAO,MAAM,WAAW,GAAI,aAAa,YAAY,EAAE,EAAE,kBAAkB,GAAG,CAAC,MAAM,CAAC,aAmBrF,CAAC;AAEF;;GAEG;yBACa,6FAQb;IACD,YAAY,EAAE,YAAY,CAAC,0BAA0B,CAAC,EAAE,CAAC;IACzD,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B,SAAS,EAAE,mBAAmB,CAAC;IAC/B,QAAQ,EAAE,cAAc,CAAC;IACzB,IAAI,EAAE,UAAU,CAAC;IACjB,oBAAoB,EAAE,cAAc,CAAC;IACrC,MAAM,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;CAChC;AAhBD,wBAsIE"}
@@ -1,14 +1,16 @@
1
1
  import { EntityMetadata } from '@aiao/rxdb';
2
- import { RxDBClientGenerator } from './RxDBClientGenerator';
3
- import { MethodDeclarationStructure, OptionalKind, SourceFile } from './ts-morph-browser';
2
+ import { RxDBClientGenerator } from './RxDBClientGenerator.js';
3
+ import { AddedInterface, MethodDeclarationStructure, OptionalKind, SourceFile } from './ts_morph_browser.js';
4
4
  /**
5
5
  * 生成 tree repository 方法
6
6
  */
7
- declare const _default: ({ metadata, classMethods, rxdbNamedImports, generator, file }: {
7
+ declare const _default: ({ metadata, classMethods, rxdbNamedImports, generator, file, staticTypesInterface }: {
8
8
  generator: RxDBClientGenerator;
9
9
  metadata: EntityMetadata;
10
10
  classMethods: OptionalKind<MethodDeclarationStructure>[];
11
11
  rxdbNamedImports: Set<string>;
12
12
  file: SourceFile;
13
+ staticTypesInterface: AddedInterface;
13
14
  }) => void;
14
15
  export default _default;
16
+ //# sourceMappingURL=generator_tree_repository_methods.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator_tree_repository_methods.d.ts","sourceRoot":"","sources":["../src/generator_tree_repository_methods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAI5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,0BAA0B,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAE7G;;GAEG;yBACa,qFAOb;IACD,SAAS,EAAE,mBAAmB,CAAC;IAC/B,QAAQ,EAAE,cAAc,CAAC;IACzB,YAAY,EAAE,YAAY,CAAC,0BAA0B,CAAC,EAAE,CAAC;IACzD,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B,IAAI,EAAE,UAAU,CAAC;IACjB,oBAAoB,EAAE,cAAc,CAAC;CACtC;AAdD,wBA6HE"}
@@ -0,0 +1,3 @@
1
+ import { EntityMetadata } from '@aiao/rxdb';
2
+ export declare const get_id_type: (metadata: EntityMetadata) => string;
3
+ //# sourceMappingURL=generator_utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator_utils.d.ts","sourceRoot":"","sources":["../src/generator_utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAgB,MAAM,YAAY,CAAC;AAE1D,eAAO,MAAM,WAAW,GAAI,UAAU,cAAc,WAcnD,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './RxDBClientGenerator.js';
2
+ export type { SourceFile } from './ts_morph_browser.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,YAAY,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ import { R as o } from "./RxDBClientGenerator-HeMQrLeK.js";
2
+ export {
3
+ o as RxDBClientGenerator
4
+ };