@zenorm/generate 2.4.0 → 2.5.1

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/generate.js CHANGED
@@ -132,6 +132,7 @@ async function generate(tables, cfg) {
132
132
  repositories.push(` static repository = ${className}.query(_query);`);
133
133
  // 静态方法
134
134
  if (config.staticMethods) {
135
+ // 静态函数
135
136
  repositories.push(...[
136
137
  'of',
137
138
  'find',
@@ -146,6 +147,11 @@ async function generate(tables, cfg) {
146
147
  'update',
147
148
  'delete',
148
149
  ].map(i => ` static ${i}: typeof ${className}.repository.${i} = ${className}.repository.${i}.bind(${className}.repository);`));
150
+ // 静态属性
151
+ repositories.push(...[
152
+ 'master',
153
+ 'slave',
154
+ ].map(i => ` static get ${i}(): typeof ${className}.repository.${i} { return ${className}.repository.${i}; }`));
149
155
  }
150
156
  // 实例方法
151
157
  if (config.instanceMethods) {
package/dist/utils.d.ts CHANGED
@@ -7,4 +7,3 @@ export declare function fileExists(f: string): Promise<boolean>;
7
7
  * @param getContent
8
8
  */
9
9
  export declare function notExistsPut(filename: string, getContent: () => string | Promise<string>): Promise<boolean>;
10
- export declare function currentDatetime(): string;
package/dist/utils.js CHANGED
@@ -7,7 +7,6 @@ exports.cwdPath = cwdPath;
7
7
  exports.checkFileDir = checkFileDir;
8
8
  exports.fileExists = fileExists;
9
9
  exports.notExistsPut = notExistsPut;
10
- exports.currentDatetime = currentDatetime;
11
10
  const node_fs_1 = require("node:fs");
12
11
  const node_path_1 = __importDefault(require("node:path"));
13
12
  function cwdPath(p) {
@@ -34,6 +33,3 @@ async function notExistsPut(filename, getContent) {
34
33
  }
35
34
  return false;
36
35
  }
37
- function currentDatetime() {
38
- return new Date().toLocaleString();
39
- }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zenorm/generate",
3
3
  "description": "Easy ORM, easy query. easy typing! Auto generate typescript declaration.",
4
- "version": "2.4.0",
4
+ "version": "2.5.1",
5
5
  "exports": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "homepage": "https://zenorm.node.ltd",
@@ -35,7 +35,7 @@
35
35
  "rimraf": "^4.4.1",
36
36
  "ts-node": "^10.9.2",
37
37
  "typescript": "^6.0.3",
38
- "zenorm": "^4.5.0"
38
+ "zenorm": "^4.6.0"
39
39
  },
40
40
  "dependencies": {
41
41
  "pascal-case": "^3.1.2",