vona-cli-set-api 1.0.78 → 1.0.81

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.
@@ -45,7 +45,7 @@
45
45
  }
46
46
  },
47
47
  "dependencies": {
48
- "vona": "^5.0.41"
48
+ "vona": "^5.0.42"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@cabloy/lint": "^5.0.16",
@@ -1,4 +1,5 @@
1
1
  import type { BeanScopeUtil, TypeModuleConfig } from 'vona';
2
+ import type { TypeMetaEntity } from 'vona-module-a-database';
2
3
  import type { IDecoratorModelOptions } from 'vona-module-a-database';
3
4
  import type { IMetaOptionsIndex } from 'vona-module-a-index';
4
5
  import type { TypeControllerOptionsActions } from 'vona-module-a-openapi';
@@ -75,9 +76,9 @@ declare module 'vona-module-home-user' {
75
76
 
76
77
  }
77
78
  export interface IModuleEntity {
78
- role: EntityRole;
79
- user: EntityUser;
80
- userRole: EntityUserRole;
79
+ role: TypeMetaEntity<EntityRole>;
80
+ user: TypeMetaEntity<EntityUser>;
81
+ userRole: TypeMetaEntity<EntityUserRole>;
81
82
  }
82
83
  /** entity: end */
83
84
  /** entity: begin */
@@ -85,20 +86,14 @@ declare module 'vona-module-home-user' {
85
86
 
86
87
  export interface EntityRole {
87
88
  get $table(): 'homeRole';
88
- $column: <K extends keyof Omit<EntityRole, '$column' | '$columns' | '$table'>>(column: K) => K;
89
- $columns: <K extends keyof Omit<EntityRole, '$column' | '$columns' | '$table'>>(...columns: K[]) => K[];
90
89
  }
91
90
 
92
91
  export interface EntityUser {
93
92
  get $table(): 'homeUser';
94
- $column: <K extends keyof Omit<EntityUser, '$column' | '$columns' | '$table'>>(column: K) => K;
95
- $columns: <K extends keyof Omit<EntityUser, '$column' | '$columns' | '$table'>>(...columns: K[]) => K[];
96
93
  }
97
94
 
98
95
  export interface EntityUserRole {
99
96
  get $table(): 'homeUserRole';
100
- $column: <K extends keyof Omit<EntityUserRole, '$column' | '$columns' | '$table'>>(column: K) => K;
101
- $columns: <K extends keyof Omit<EntityUserRole, '$column' | '$columns' | '$table'>>(...columns: K[]) => K[];
102
97
  }
103
98
 
104
99
  export interface IEntityOptionsRole {
@@ -10,15 +10,15 @@ export class MetaVersion extends BeanBase implements IMetaVersionUpdate, IMetaVe
10
10
  const entityRole = this.scope.entity.role;
11
11
  await this.bean.model.createTable(entityRole.$table, table => {
12
12
  table.basicFields();
13
- table.string(entityRole.$column('name'), 255);
13
+ table.string(entityRole.name, 255);
14
14
  });
15
15
  // homeUser
16
16
  const entityUser = this.scope.entity.user;
17
17
  await this.bean.model.createTable(entityUser.$table, table => {
18
18
  table.basicFields();
19
- table.string(entityUser.$column('name'), 255);
20
- table.string(entityUser.$column('avatar'), 255);
21
- table.string(entityUser.$column('locale'), 255);
19
+ table.string(entityUser.name, 255);
20
+ table.string(entityUser.avatar, 255);
21
+ table.string(entityUser.locale, 255);
22
22
  });
23
23
  // homeUserRole
24
24
  const entityUserRole = this.scope.entity.userRole;
@@ -1,10 +1,10 @@
1
1
  import type { TableIdentity } from 'vona-module-a-database';
2
2
  import type { IDecoratorControllerOptions } from 'vona-module-a-web';
3
- import type { Dto<%=argv.resourceNameCapitalize%>Update } from '../dto/<%=argv.resourceName%>Update.ts';
4
3
  import { BeanBase } from 'vona';
5
4
  import { Api, Arg, v } from 'vona-module-a-openapi';
6
5
  import { Controller, Web } from 'vona-module-a-web';
7
6
  import { Dto<%=argv.resourceNameCapitalize%>Create } from '../dto/<%=argv.resourceName%>Create.ts';
7
+ import { Dto<%=argv.resourceNameCapitalize%>Update } from '../dto/<%=argv.resourceName%>Update.ts';
8
8
  import { Entity<%=argv.resourceNameCapitalize%> } from '../entity/<%=argv.resourceName%>.ts';
9
9
 
10
10
  export interface IControllerOptions<%=argv.resourceNameCapitalize%> extends IDecoratorControllerOptions {}
@@ -12,8 +12,8 @@ const __snippet_update = `if (options.version === <%=argv.fileVersion%>) {
12
12
  const entity<%=argv.resourceNameCapitalize%> = this.scope.entity.<%=argv.resourceName%>;
13
13
  await this.bean.model.createTable(entity<%=argv.resourceNameCapitalize%>.$table, table => {
14
14
  table.basicFields();
15
- table.string(entity<%=argv.resourceNameCapitalize%>.$column('name'), 50);
16
- table.string(entity<%=argv.resourceNameCapitalize%>.$column('description'), 255);
15
+ table.string(entity<%=argv.resourceNameCapitalize%>.name, 50);
16
+ table.string(entity<%=argv.resourceNameCapitalize%>.description, 255);
17
17
  });
18
18
  }`;
19
19
 
@@ -140,6 +140,9 @@ export class CliToolsMetadata extends BeanCliBase {
140
140
  if (content.includes('TypeControllerOptionsActions')) {
141
141
  content = `import type { TypeControllerOptionsActions } from 'vona-module-a-openapi';\n${content}`;
142
142
  }
143
+ if (content.includes('TypeMetaEntity')) {
144
+ content = `import type { TypeMetaEntity } from 'vona-module-a-database';\n${content}`;
145
+ }
143
146
  return content;
144
147
  }
145
148
  async _generateThis(moduleName, relativeNameCapitalize, modulePath) {
@@ -1,4 +1,4 @@
1
- import { toUpperCaseFirstChar } from '@cabloy/word-utils';
1
+ import { replaceTemplate, toUpperCaseFirstChar } from '@cabloy/word-utils';
2
2
  import { globBeanFiles } from "./utils.js";
3
3
  export async function generateScopeResources(sceneName, sceneMeta, moduleName, modulePath) {
4
4
  const sceneNameCapitalize = toUpperCaseFirstChar(sceneName);
@@ -13,7 +13,11 @@ export async function generateScopeResources(sceneName, sceneMeta, moduleName, m
13
13
  if (isIgnore)
14
14
  continue;
15
15
  contentImports.push(`import type { ${className} } from '${fileNameJSRelative}';`);
16
- contentRecords.push(`'${beanName}': ${className};`);
16
+ let typeClassName = className;
17
+ if (sceneMeta.scopeResourceTypeTemplate) {
18
+ typeClassName = replaceTemplate(sceneMeta.scopeResourceTypeTemplate, { className });
19
+ }
20
+ contentRecords.push(`'${beanName}': ${typeClassName};`);
17
21
  }
18
22
  if (contentImports.length === 0)
19
23
  return '';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vona-cli-set-api",
3
3
  "type": "module",
4
- "version": "1.0.78",
4
+ "version": "1.0.81",
5
5
  "description": "vona cli-set-api",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -31,11 +31,11 @@
31
31
  "@babel/plugin-proposal-decorators": "^7.25.9",
32
32
  "@babel/plugin-transform-class-properties": "^7.25.9",
33
33
  "@babel/plugin-transform-typescript": "^7.26.8",
34
- "@cabloy/cli": "^3.0.31",
34
+ "@cabloy/cli": "^3.0.32",
35
35
  "@cabloy/dotenv": "^1.1.10",
36
36
  "@cabloy/extend": "^3.1.10",
37
- "@cabloy/module-glob": "^5.2.14",
38
- "@cabloy/module-info": "^1.3.21",
37
+ "@cabloy/module-glob": "^5.2.15",
38
+ "@cabloy/module-info": "^1.3.22",
39
39
  "@cabloy/word-utils": "^2.0.1",
40
40
  "@lcov-viewer/cli": "^1.3.0",
41
41
  "@rollup/plugin-alias": "^5.1.1",
@@ -61,7 +61,7 @@
61
61
  "ts-node": "^10.9.2",
62
62
  "urllib": "^4.6.11",
63
63
  "uuid": "^11.1.0",
64
- "vona-core": "^5.0.24",
64
+ "vona-core": "^5.0.25",
65
65
  "why-is-node-running": "^3.2.2",
66
66
  "yargs-parser": "^21.1.1"
67
67
  },