vona-cli-set-api 1.0.489 → 1.0.491

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.
@@ -29,6 +29,7 @@ miniprogram_npm
29
29
  # mine .env files
30
30
  env/.env*.mine
31
31
  /src/backend/config/config/config*.mine.ts
32
+ /src/backend/config/config/config*.mine.tsx
32
33
  /src/backend/typing/modules.d.ts
33
34
  **/.metadata/modules.d.ts
34
35
  src/backend/typing/mine.d.ts
@@ -40,16 +40,11 @@
40
40
  "lint": "eslint",
41
41
  "lint:fix": "eslint --fix"
42
42
  },
43
- "pnpm": {
44
- "overrides": {
45
- "@types/mime": "3.0.4"
46
- }
47
- },
48
43
  "dependencies": {
49
- "vona": "^5.0.275"
44
+ "vona": "^5.0.276"
50
45
  },
51
46
  "devDependencies": {
52
47
  "@cabloy/lint": "^5.0.16",
53
- "eslint": "^9.35.0"
48
+ "eslint": "^9.39.2"
54
49
  }
55
50
  }
@@ -33,3 +33,7 @@ onlyBuiltDependencies:
33
33
  - esbuild
34
34
  - msgpackr-extract
35
35
  - nx
36
+
37
+ overrides:
38
+ "@types/mime": "3.0.4"
39
+ "@types/react": "npm:@cabloy/types-react@^19.2.13"
@@ -3,7 +3,7 @@ import type { IQueryParams } from 'vona-module-a-orm';
3
3
  import type { IDecoratorControllerOptions } from 'vona-module-a-web';
4
4
  import type { Model<%=argv.resourceNameCapitalize%> } from '../model/<%=argv.resourceName%>.ts';
5
5
  import { BeanBase } from 'vona';
6
- import { Api, v } from 'vona-module-a-openapiutils';
6
+ import { Api, Resource, v } from 'vona-module-a-openapiutils';
7
7
  import { Arg, Controller, Web } from 'vona-module-a-web';
8
8
  import { Dto<%=argv.resourceNameCapitalize%>Create } from '../dto/<%=argv.resourceName%>Create.tsx';
9
9
  import { Dto<%=argv.resourceNameCapitalize%>Query } from '../dto/<%=argv.resourceName%>Query.tsx';
@@ -14,6 +14,7 @@ import { Entity<%=argv.resourceNameCapitalize%> } from '../entity/<%=argv.resour
14
14
  export interface IControllerOptions<%=argv.resourceNameCapitalize%> extends IDecoratorControllerOptions {}
15
15
 
16
16
  @Controller<IControllerOptions<%=argv.resourceNameCapitalize%>>('<%=argv.resourceName%>')
17
+ @Resource()
17
18
  export class Controller<%=argv.resourceNameCapitalize%> extends BeanBase {
18
19
  @Web.post()
19
20
  @Api.body(v.tableIdentity())
@@ -23,14 +24,14 @@ export class Controller<%=argv.resourceNameCapitalize%> extends BeanBase {
23
24
 
24
25
  @Web.get()
25
26
  @Api.body(Dto<%=argv.resourceNameCapitalize%>QueryRes)
26
- async findMany(@Arg.filter(Dto<%=argv.resourceNameCapitalize%>Query) params: IQueryParams<Model<%=argv.resourceNameCapitalize%>>): Promise<Dto<%=argv.resourceNameCapitalize%>QueryRes> {
27
- return await this.scope.service.<%=argv.resourceName%>.findMany(params);
27
+ async select(@Arg.filter(Dto<%=argv.resourceNameCapitalize%>Query) params: IQueryParams<Model<%=argv.resourceNameCapitalize%>>): Promise<Dto<%=argv.resourceNameCapitalize%>QueryRes> {
28
+ return await this.scope.service.<%=argv.resourceName%>.select(params);
28
29
  }
29
30
 
30
31
  @Web.get(':id')
31
32
  @Api.body(v.optional(), v.object(Entity<%=argv.resourceNameCapitalize%>))
32
- async findOne(@Arg.param('id', v.tableIdentity()) id: TableIdentity): Promise<Entity<%=argv.resourceNameCapitalize%> | undefined> {
33
- return await this.scope.service.<%=argv.resourceName%>.findOne(id);
33
+ async view(@Arg.param('id', v.tableIdentity()) id: TableIdentity): Promise<Entity<%=argv.resourceNameCapitalize%> | undefined> {
34
+ return await this.scope.service.<%=argv.resourceName%>.view(id);
34
35
  }
35
36
 
36
37
  @Web.patch(':id')
@@ -39,7 +40,7 @@ export class Controller<%=argv.resourceNameCapitalize%> extends BeanBase {
39
40
  }
40
41
 
41
42
  @Web.delete(':id')
42
- async remove(@Arg.param('id', v.tableIdentity()) id: TableIdentity) {
43
- return await this.scope.service.<%=argv.resourceName%>.remove(id);
43
+ async delete(@Arg.param('id', v.tableIdentity()) id: TableIdentity) {
44
+ return await this.scope.service.<%=argv.resourceName%>.delete(id);
44
45
  }
45
46
  }
@@ -7,7 +7,7 @@ export interface IEntityOptions<%=argv.resourceNameCapitalize%> extends IDecorat
7
7
 
8
8
  @Entity<IEntityOptions<%=argv.resourceNameCapitalize%>>('<%=argv.moduleResourceName%>', { openapi: { title: $locale('<%=argv.resourceNameCapitalize%>') } })
9
9
  export class Entity<%=argv.resourceNameCapitalize%> extends EntityBase {
10
- @Api.field(v.title($locale('Name')), v.default(''), v.min(3))
10
+ @Api.field(v.title($locale('Name')), v.required(), v.min(3))
11
11
  name: string;
12
12
 
13
13
  @Api.field(v.title($locale('Description')), v.optional())
@@ -14,11 +14,11 @@ export class Service<%=argv.resourceNameCapitalize%> extends BeanBase {
14
14
  return await this.scope.model.<%=argv.resourceName%>.insert(<%=argv.resourceName%>);
15
15
  }
16
16
 
17
- async findMany(params?: IQueryParams<Model<%=argv.resourceNameCapitalize%>>): Promise<Dto<%=argv.resourceNameCapitalize%>QueryRes> {
17
+ async select(params?: IQueryParams<Model<%=argv.resourceNameCapitalize%>>): Promise<Dto<%=argv.resourceNameCapitalize%>QueryRes> {
18
18
  return await this.scope.model.<%=argv.resourceName%>.selectAndCount(params);
19
19
  }
20
20
 
21
- async findOne(id: TableIdentity): Promise<Entity<%=argv.resourceNameCapitalize%> | undefined> {
21
+ async view(id: TableIdentity): Promise<Entity<%=argv.resourceNameCapitalize%> | undefined> {
22
22
  return await this.scope.model.<%=argv.resourceName%>.getById(id);
23
23
  }
24
24
 
@@ -26,7 +26,7 @@ export class Service<%=argv.resourceNameCapitalize%> extends BeanBase {
26
26
  return await this.scope.model.<%=argv.resourceName%>.updateById(id, <%=argv.resourceName%>);
27
27
  }
28
28
 
29
- async remove(id: TableIdentity) {
29
+ async delete(id: TableIdentity) {
30
30
  return await this.scope.model.<%=argv.resourceName%>.deleteById(id);
31
31
  }
32
32
  }
@@ -13,7 +13,7 @@ const __snippet_update = `if (options.version === <%=argv.fileVersion%>) {
13
13
  await this.bean.model.createTable(entity<%=argv.resourceNameCapitalize%>.$table, table => {
14
14
  table.comment(entity<%=argv.resourceNameCapitalize%>.$comment.$table);
15
15
  table.basicFields();
16
- table.string(entity<%=argv.resourceNameCapitalize%>.name, 50).defaultTo(entity<%=argv.resourceNameCapitalize%>.$default.name).comment(entity<%=argv.resourceNameCapitalize%>.$comment.name);
16
+ table.string(entity<%=argv.resourceNameCapitalize%>.name, 50).comment(entity<%=argv.resourceNameCapitalize%>.$comment.name);
17
17
  table.string(entity<%=argv.resourceNameCapitalize%>.description, 255).comment(entity<%=argv.resourceNameCapitalize%>.$comment.description);
18
18
  });
19
19
  }
package/dist/index.js CHANGED
@@ -230,7 +230,7 @@ async function generateEntryFiles(configMeta, configOptions, modulesMeta, env) {
230
230
  // meta
231
231
  const meta = getEnvMeta(configMeta);
232
232
  configDir = path.join(configOptions.appDir, 'src/backend/config/config');
233
- const files = getEnvFiles(meta, configDir, 'config', '.ts');
233
+ const files = getEnvFiles(meta, configDir, 'config', ['.ts', '.tsx']);
234
234
  const filenames = files.map(item => path.basename(item));
235
235
  const imports = [];
236
236
  const constNames = [];
@@ -784,7 +784,7 @@ class CliBinDev extends BeanCliBase {
784
784
  // execArgs: ['--experimental-transform-types', getImportEsm(), '--trace-deprecation'],
785
785
  // signal: 'SIGHUP',
786
786
  watch: ['packages-utils', 'packages-vona', './src'],
787
- ignore: ['**/node_modules/**', '**/dist/**', '**/test/**/*.test.ts', 'src/backend/play/**', 'src/backend/typing/**', '**/src/config/errors.ts', '**/src/config/locale/*.ts', '**/src/config/config.ts', '**/src/config/constants.ts', '**/src/types/**', '**/src/controller/*.ts', '**/src/model/*.ts', '**/src/service/*.ts', '**/src/bean/*.*.ts', '**/src/dto/*.ts(x)?', '**/src/entity/*.ts(x)?']
787
+ ignore: ['**/node_modules/**', '**/dist/**', '**/test/**/*.test.ts', 'src/backend/play/**', 'src/backend/typing/**', '**/src/config/errors.ts', '**/src/config/locale/*.ts', '**/src/config/config.ts', '**/src/config/constants.ts', '**/src/types/**', '**/src/controller/*.ts(x)?', '**/src/model/*.ts', '**/src/service/*.ts', '**/src/bean/*.*.ts', '**/src/dto/*.ts(x)?', '**/src/entity/*.ts(x)?']
788
788
  });
789
789
  nodemon.on('quit', () => {
790
790
  closed = true;
@@ -2136,6 +2136,7 @@ async function globBeanFiles(sceneName, sceneMeta, moduleName, modulePath) {
2136
2136
  const beanName = parts[parts.length - 1];
2137
2137
  const beanNameFull = `${moduleName}:${beanName}`;
2138
2138
  const beanNameCapitalize = toUpperCaseFirstChar(beanName);
2139
+ const beanFullName = sceneName === 'bean' ? beanName : `${moduleName}.${sceneName}.${beanName}`;
2139
2140
  const fileContent = isIgnore ? '' : fse.readFileSync(filePath).toString();
2140
2141
  const isVirtual = fileContent.includes('@Virtual()');
2141
2142
  result.push({
@@ -2150,6 +2151,7 @@ async function globBeanFiles(sceneName, sceneMeta, moduleName, modulePath) {
2150
2151
  beanName,
2151
2152
  beanNameFull,
2152
2153
  beanNameCapitalize,
2154
+ beanFullName,
2153
2155
  isIgnore,
2154
2156
  isVirtual
2155
2157
  });
@@ -2173,7 +2175,7 @@ function extractBeanInfo(sceneName, fileContent, sceneMeta) {
2173
2175
  }
2174
2176
  }
2175
2177
  // isGlobal
2176
- const isGlobal = sceneMeta.hasLocal ? fileContent.match(/@.*?\(\{([\s\S]*?)global: true([\s\S]*?)\}([\s\S]*?)\)\s*export class/) : true;
2178
+ const isGlobal = sceneMeta.hasLocal ? fileContent.includes('@Global()') : true;
2177
2179
  return {
2178
2180
  optionsCustomInterface,
2179
2181
  optionsCustomInterfaceFrom,
@@ -2181,6 +2183,8 @@ function extractBeanInfo(sceneName, fileContent, sceneMeta) {
2181
2183
  };
2182
2184
  }
2183
2185
 
2186
+ // fileContent.match(/@.*?\(\{([\s\S]*?)global: true([\s\S]*?)\}([\s\S]*?)\)\s*export class/)
2187
+
2184
2188
  async function generateBeanGenerals(sceneName, sceneMeta, moduleName, modulePath) {
2185
2189
  const globFiles = await globBeanFiles(sceneName, sceneMeta, moduleName, modulePath);
2186
2190
  if (globFiles.length === 0) return '';
@@ -5,5 +5,5 @@ export declare function globBeanFiles(sceneName: string, sceneMeta: OnionSceneMe
5
5
  export declare function extractBeanInfo(sceneName: string, fileContent: string, sceneMeta: OnionSceneMeta): {
6
6
  optionsCustomInterface: string | undefined;
7
7
  optionsCustomInterfaceFrom: string | undefined;
8
- isGlobal: boolean | RegExpMatchArray | null;
8
+ isGlobal: boolean;
9
9
  };
@@ -6,7 +6,7 @@ const __snippet_update = `if (options.version === <%=argv.fileVersion%>) {
6
6
  await this.bean.model.createTable(entity<%=argv.resourceNameCapitalize%>.$table, table => {
7
7
  table.comment(entity<%=argv.resourceNameCapitalize%>.$comment.$table);
8
8
  table.basicFields();
9
- table.string(entity<%=argv.resourceNameCapitalize%>.name, 50).defaultTo(entity<%=argv.resourceNameCapitalize%>.$default.name).comment(entity<%=argv.resourceNameCapitalize%>.$comment.name);
9
+ table.string(entity<%=argv.resourceNameCapitalize%>.name, 50).comment(entity<%=argv.resourceNameCapitalize%>.$comment.name);
10
10
  table.string(entity<%=argv.resourceNameCapitalize%>.description, 255).comment(entity<%=argv.resourceNameCapitalize%>.$comment.description);
11
11
  });
12
12
  }
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.489",
4
+ "version": "1.0.491",
5
5
  "description": "vona cli-set-api",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -33,12 +33,12 @@
33
33
  "@babel/plugin-proposal-decorators": "^7.25.9",
34
34
  "@babel/plugin-transform-class-properties": "^7.25.9",
35
35
  "@babel/plugin-transform-typescript": "^7.26.8",
36
- "@cabloy/cli": "^3.0.94",
37
- "@cabloy/dotenv": "^1.1.12",
38
- "@cabloy/extend": "^3.1.11",
39
- "@cabloy/module-glob": "^5.2.51",
40
- "@cabloy/module-info": "^1.3.37",
41
- "@cabloy/utils": "^2.0.16",
36
+ "@cabloy/cli": "^3.0.95",
37
+ "@cabloy/dotenv": "^1.1.13",
38
+ "@cabloy/extend": "^3.1.13",
39
+ "@cabloy/module-glob": "^5.2.53",
40
+ "@cabloy/module-info": "^1.3.41",
41
+ "@cabloy/utils": "^2.0.17",
42
42
  "@cabloy/word-utils": "^2.0.2",
43
43
  "@lcov-viewer/cli": "^1.3.0",
44
44
  "@rollup/plugin-alias": "^5.1.1",
@@ -50,7 +50,7 @@
50
50
  "@rollup/plugin-terser": "^0.4.4",
51
51
  "@rollup/plugin-typescript": "^12.3.0",
52
52
  "babel-plugin-transform-typescript-metadata": "^0.3.2",
53
- "babel-plugin-vona-bean-module": "^1.0.7",
53
+ "babel-plugin-vona-bean-module": "^1.0.8",
54
54
  "chalk": "^3.0.0",
55
55
  "cli-table3": "^0.6.5",
56
56
  "compressing": "^1.10.0",
@@ -65,7 +65,7 @@
65
65
  "ts-node-maintained": "^10.9.6",
66
66
  "urllib": "^4.6.11",
67
67
  "uuid": "^11.1.0",
68
- "vona-core": "^5.0.130",
68
+ "vona-core": "^5.0.131",
69
69
  "why-is-node-running": "^3.2.2",
70
70
  "yargs-parser": "^22.0.0"
71
71
  },