vona-cli-set-api 1.0.79 → 1.0.82
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/cli/templates/create/project/basic/boilerplate/package.original.json +1 -1
- package/cli/templates/create/project/basic/boilerplate/src/suite/a-home/modules/home-user/src/.metadata/index.ts +7 -21
- package/cli/templates/create/project/basic/boilerplate/src/suite/a-home/modules/home-user/src/bean/meta.version.ts +4 -4
- package/cli/templates/tools/crud/snippets/2-meta.version.ts +2 -2
- package/dist/lib/bean/cli.tools.metadata.js +3 -0
- package/dist/lib/bean/toolsMetadata/generateScopeResources.js +6 -2
- package/package.json +5 -5
|
@@ -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,32 +76,17 @@ 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, EntityRoleTableName>;
|
|
80
|
+
user: TypeMetaEntity<EntityUser, EntityUserTableName>;
|
|
81
|
+
userRole: TypeMetaEntity<EntityUserRole, EntityUserRoleTableName>;
|
|
81
82
|
}
|
|
82
83
|
/** entity: end */
|
|
83
84
|
/** entity: begin */
|
|
85
|
+
export type EntityRoleTableName = 'homeRole';
|
|
86
|
+
export type EntityUserTableName = 'homeUser';
|
|
87
|
+
export type EntityUserRoleTableName = 'homeUserRole';
|
|
84
88
|
declare module 'vona-module-home-user' {
|
|
85
89
|
|
|
86
|
-
export interface EntityRole {
|
|
87
|
-
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
|
-
}
|
|
91
|
-
|
|
92
|
-
export interface EntityUser {
|
|
93
|
-
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
|
-
}
|
|
97
|
-
|
|
98
|
-
export interface EntityUserRole {
|
|
99
|
-
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
|
-
}
|
|
103
|
-
|
|
104
90
|
export interface IEntityOptionsRole {
|
|
105
91
|
fields?: TypeEntityOptionsFields<EntityRole, IEntityOptionsRole['_fieldsMore_']>;
|
|
106
92
|
}
|
|
@@ -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
|
|
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
|
|
20
|
-
table.string(entityUser
|
|
21
|
-
table.string(entityUser
|
|
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;
|
|
@@ -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
|
|
16
|
-
table.string(entity<%=argv.resourceNameCapitalize
|
|
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
|
-
|
|
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.
|
|
4
|
+
"version": "1.0.82",
|
|
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.
|
|
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.
|
|
38
|
-
"@cabloy/module-info": "^1.3.
|
|
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.
|
|
64
|
+
"vona-core": "^5.0.25",
|
|
65
65
|
"why-is-node-running": "^3.2.2",
|
|
66
66
|
"yargs-parser": "^21.1.1"
|
|
67
67
|
},
|