vona-cli-set-api 1.0.432 → 1.0.436
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-index/package.json +1 -1
- package/cli/templates/create/project/basic/boilerplate/src/suite/a-home/modules/home-index/src/.metadata/locales.ts +3 -2
- package/cli/templates/create/project/basic/boilerplate/src/suite/a-home/modules/home-user/package.json +1 -1
- package/cli/templates/create/project/basic/boilerplate/src/suite/a-home/modules/home-user/src/.metadata/index.ts +3 -3
- package/cli/templates/create/project/basic/boilerplate/src/suite/a-home/modules/home-user/src/.metadata/locales.ts +3 -2
- package/cli/templates/create/project/basic/boilerplate/src/suite/a-home/modules/home-user/src/bean/meta.index.ts +4 -7
- package/cli/templates/create/project/basic/boilerplate/src/suite/a-home/package.json +1 -1
- package/cli/templates/tools/crud/boilerplate/src/dto/{{resourceName}}Query.ts_ +2 -2
- package/cli/templates/tools/crud/snippets/2-meta.index.ts +3 -7
- package/dist/index.js +3 -2
- package/dist-cli/templates/tools/crud/snippets/2-meta.index.js +3 -7
- package/package.json +2 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { TypeLocaleBase } from 'vona';
|
|
2
|
+
import { $makeLocaleMagic } from 'vona';
|
|
2
3
|
import locale_en_us from '../config/locale/en-us.ts';
|
|
3
4
|
import locale_zh_cn from '../config/locale/zh-cn.ts';
|
|
4
5
|
|
|
@@ -7,6 +8,6 @@ export const locales = {
|
|
|
7
8
|
'zh-cn': locale_zh_cn,
|
|
8
9
|
};
|
|
9
10
|
|
|
10
|
-
export function $locale<K extends keyof (typeof locales)[TypeLocaleBase]>(key: K)
|
|
11
|
-
return `home-index::${key}
|
|
11
|
+
export function $locale<K extends keyof (typeof locales)[TypeLocaleBase]>(key: K) {
|
|
12
|
+
return $makeLocaleMagic(`home-index::${key}`);
|
|
12
13
|
}
|
|
@@ -43,9 +43,9 @@ export type EntityRoleUserMeta=TypeEntityMeta<EntityRoleUser,EntityRoleUserTable
|
|
|
43
43
|
export type EntityUserMeta=TypeEntityMeta<EntityUser,EntityUserTableName>;
|
|
44
44
|
declare module 'vona-module-a-orm' {
|
|
45
45
|
export interface ITableRecord {
|
|
46
|
-
'homeRole':
|
|
47
|
-
'homeRoleUser':
|
|
48
|
-
'homeUser':
|
|
46
|
+
'homeRole': EntityRoleMeta;
|
|
47
|
+
'homeRoleUser': EntityRoleUserMeta;
|
|
48
|
+
'homeUser': EntityUserMeta;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
declare module 'vona-module-home-user' {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { TypeLocaleBase } from 'vona';
|
|
2
|
+
import { $makeLocaleMagic } from 'vona';
|
|
2
3
|
import locale_en_us from '../config/locale/en-us.ts';
|
|
3
4
|
import locale_zh_cn from '../config/locale/zh-cn.ts';
|
|
4
5
|
|
|
@@ -7,6 +8,6 @@ export const locales = {
|
|
|
7
8
|
'zh-cn': locale_zh_cn,
|
|
8
9
|
};
|
|
9
10
|
|
|
10
|
-
export function $locale<K extends keyof (typeof locales)[TypeLocaleBase]>(key: K)
|
|
11
|
-
return `home-user::${key}
|
|
11
|
+
export function $locale<K extends keyof (typeof locales)[TypeLocaleBase]>(key: K) {
|
|
12
|
+
return $makeLocaleMagic(`home-user::${key}`);
|
|
12
13
|
}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import type { IMetaOptionsIndex } from 'vona-module-a-index';
|
|
2
2
|
import { BeanBase } from 'vona';
|
|
3
3
|
import { Meta } from 'vona-module-a-meta';
|
|
4
|
-
import { $tableColumns } from 'vona-module-a-
|
|
5
|
-
import { EntityRole } from '../entity/role.ts';
|
|
6
|
-
import { EntityRoleUser } from '../entity/roleUser.ts';
|
|
7
|
-
import { EntityUser } from '../entity/user.ts';
|
|
4
|
+
import { $tableColumns } from 'vona-module-a-ormutils';
|
|
8
5
|
|
|
9
6
|
@Meta<IMetaOptionsIndex>({
|
|
10
7
|
indexes: {
|
|
11
|
-
...$tableColumns(
|
|
12
|
-
...$tableColumns(
|
|
13
|
-
...$tableColumns(
|
|
8
|
+
...$tableColumns('homeUser', 'name'),
|
|
9
|
+
...$tableColumns('homeRole', 'name'),
|
|
10
|
+
...$tableColumns('homeRoleUser', ['userId', 'roleId']),
|
|
14
11
|
},
|
|
15
12
|
})
|
|
16
13
|
export class MetaIndex extends BeanBase {}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { IDecoratorDtoOptions } from 'vona-module-a-web';
|
|
2
2
|
import { Api, v } from 'vona-module-a-openapiutils';
|
|
3
|
-
import { $Dto
|
|
3
|
+
import { $Dto } from 'vona-module-a-orm';
|
|
4
4
|
import { Dto } from 'vona-module-a-web';
|
|
5
5
|
import { Entity<%=argv.resourceNameCapitalize%> } from '../entity/<%=argv.resourceName%>.ts';
|
|
6
6
|
|
|
7
7
|
export interface IDtoOptions<%=argv.resourceNameCapitalize%>Query extends IDecoratorDtoOptions {}
|
|
8
8
|
|
|
9
9
|
@Dto<IDtoOptions<%=argv.resourceNameCapitalize%>Query>({
|
|
10
|
-
openapi: { filter: { table:
|
|
10
|
+
openapi: { filter: { table: '<%=argv.moduleResourceName%>' } },
|
|
11
11
|
})
|
|
12
12
|
export class Dto<%=argv.resourceNameCapitalize%>Query extends $Dto.queryPage(Entity<%=argv.resourceNameCapitalize%>, ['name']) {
|
|
13
13
|
@Api.field(v.optional())
|
|
@@ -8,9 +8,8 @@ declare module '@cabloy/cli' {
|
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
const __snippet_import1 = 'import { $tableColumns } from \'vona-module-a-
|
|
12
|
-
const
|
|
13
|
-
const __snippet_update = '...$tableColumns(() => Entity<%=argv.resourceNameCapitalize%>, \'name\'),';
|
|
11
|
+
const __snippet_import1 = 'import { $tableColumns } from \'vona-module-a-ormutils\';';
|
|
12
|
+
const __snippet_update = '...$tableColumns(\'<%=argv.moduleResourceName%>\', \'name\'),';
|
|
14
13
|
|
|
15
14
|
export default metadataCustomSnippet({
|
|
16
15
|
file: 'src/bean/meta.index.ts',
|
|
@@ -35,11 +34,8 @@ export default metadataCustomSnippet({
|
|
|
35
34
|
const code = await cli.template.renderContent({ content: __snippet_import1 });
|
|
36
35
|
ast = ast.replace('import { Meta } from \'vona-module-a-meta\';', `import { Meta } from 'vona-module-a-meta';\n${code}`);
|
|
37
36
|
}
|
|
38
|
-
// import2
|
|
39
|
-
let code = await cli.template.renderContent({ content: __snippet_import2 });
|
|
40
|
-
ast = ast.replace('import { $tableColumns } from \'vona-module-a-orm\';', `import { $tableColumns } from 'vona-module-a-orm';\n${code}`);
|
|
41
37
|
// update
|
|
42
|
-
code = await cli.template.renderContent({ content: __snippet_update });
|
|
38
|
+
const code = await cli.template.renderContent({ content: __snippet_update });
|
|
43
39
|
if (ast.includes('indexes: {}')) {
|
|
44
40
|
ast = ast.replace('indexes: {', `indexes: {\n ${code}\n `);
|
|
45
41
|
} else {
|
package/dist/index.js
CHANGED
|
@@ -2186,14 +2186,15 @@ async function generateLocale1(modulePath, moduleName) {
|
|
|
2186
2186
|
}
|
|
2187
2187
|
// combine
|
|
2188
2188
|
const content = `import type { TypeLocaleBase } from 'vona';
|
|
2189
|
+
import { $makeLocaleMagic } from 'vona';
|
|
2189
2190
|
${contentImports.join('\n')}
|
|
2190
2191
|
|
|
2191
2192
|
export const locales = {
|
|
2192
2193
|
${contentLocales.join('\n')}
|
|
2193
2194
|
};
|
|
2194
2195
|
|
|
2195
|
-
export function $locale<K extends keyof (typeof locales)[TypeLocaleBase]>(key: K)
|
|
2196
|
-
return \`${moduleName}::\${key}
|
|
2196
|
+
export function $locale<K extends keyof (typeof locales)[TypeLocaleBase]>(key: K) {
|
|
2197
|
+
return $makeLocaleMagic(\`${moduleName}::\${key}\`);
|
|
2197
2198
|
}
|
|
2198
2199
|
`;
|
|
2199
2200
|
return content;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import { metadataCustomSnippet } from '@cabloy/cli';
|
|
3
3
|
import { catchError } from '@cabloy/utils';
|
|
4
|
-
const __snippet_import1 = 'import { $tableColumns } from \'vona-module-a-
|
|
5
|
-
const
|
|
6
|
-
const __snippet_update = '...$tableColumns(() => Entity<%=argv.resourceNameCapitalize%>, \'name\'),';
|
|
4
|
+
const __snippet_import1 = 'import { $tableColumns } from \'vona-module-a-ormutils\';';
|
|
5
|
+
const __snippet_update = '...$tableColumns(\'<%=argv.moduleResourceName%>\', \'name\'),';
|
|
7
6
|
export default metadataCustomSnippet({
|
|
8
7
|
file: 'src/bean/meta.index.ts',
|
|
9
8
|
language: 'plain',
|
|
@@ -27,11 +26,8 @@ export default metadataCustomSnippet({
|
|
|
27
26
|
const code = await cli.template.renderContent({ content: __snippet_import1 });
|
|
28
27
|
ast = ast.replace('import { Meta } from \'vona-module-a-meta\';', `import { Meta } from 'vona-module-a-meta';\n${code}`);
|
|
29
28
|
}
|
|
30
|
-
// import2
|
|
31
|
-
let code = await cli.template.renderContent({ content: __snippet_import2 });
|
|
32
|
-
ast = ast.replace('import { $tableColumns } from \'vona-module-a-orm\';', `import { $tableColumns } from 'vona-module-a-orm';\n${code}`);
|
|
33
29
|
// update
|
|
34
|
-
code = await cli.template.renderContent({ content: __snippet_update });
|
|
30
|
+
const code = await cli.template.renderContent({ content: __snippet_update });
|
|
35
31
|
if (ast.includes('indexes: {}')) {
|
|
36
32
|
ast = ast.replace('indexes: {', `indexes: {\n ${code}\n `);
|
|
37
33
|
}
|
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.436",
|
|
5
5
|
"description": "vona cli-set-api",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"ts-node-maintained": "^10.9.6",
|
|
65
65
|
"urllib": "^4.6.11",
|
|
66
66
|
"uuid": "^11.1.0",
|
|
67
|
-
"vona-core": "^5.0.
|
|
67
|
+
"vona-core": "^5.0.109",
|
|
68
68
|
"why-is-node-running": "^3.2.2",
|
|
69
69
|
"yargs-parser": "^22.0.0"
|
|
70
70
|
},
|