vona-module-a-web 5.0.16 → 5.0.18

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.
@@ -17,23 +17,10 @@ declare module 'vona' {
17
17
  }
18
18
  }
19
19
  /** bean: end */
20
- /** startup: begin */
21
- export * from '../bean/startup.listen.ts';
22
- import { type IDecoratorStartupOptions } from 'vona-module-a-startup';
23
- declare module 'vona-module-a-startup' {
24
- interface IStartupRecord {
25
- 'a-web:listen': IDecoratorStartupOptions;
26
- }
27
- }
28
- declare module 'vona-module-a-web' {
29
- interface StartupListen {
30
- }
31
- }
32
- /** startup: end */
33
20
  /** service: begin */
34
21
  export * from '../service/web.ts';
35
22
  import 'vona';
36
- declare module 'vona-module-a-web' {
23
+ declare module 'vona-module-a-bean' {
37
24
  interface IServiceRecord {
38
25
  'a-web:web': never;
39
26
  }
@@ -57,6 +44,19 @@ declare module 'vona' {
57
44
  }
58
45
  }
59
46
  /** service: end */
47
+ /** startup: begin */
48
+ export * from '../bean/startup.listen.ts';
49
+ import { type IDecoratorStartupOptions } from 'vona-module-a-startup';
50
+ declare module 'vona-module-a-startup' {
51
+ interface IStartupRecord {
52
+ 'a-web:listen': IDecoratorStartupOptions;
53
+ }
54
+ }
55
+ declare module 'vona-module-a-web' {
56
+ interface StartupListen {
57
+ }
58
+ }
59
+ /** startup: end */
60
60
  /** config: begin */
61
61
  export * from '../config/config.ts';
62
62
  import type { config } from '../config/config.ts';
package/dist/index.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import { appMetadata, BeanInfo, BeanBase, appResource, deepExtend, compose, cast, BeanSimple, BeanScopeBase, createBeanDecorator } from 'vona';
2
2
  import * as ModuleInfo from '@cabloy/module-info';
3
- import { Bean, Scope } from 'vona-module-a-bean';
3
+ import { Bean, Service, Scope } from 'vona-module-a-bean';
4
4
  import { SymbolUseOnionOptions } from 'vona-module-a-onion';
5
- import { SymbolRouteHandlersArgumentsValue, SymbolRouteHandlersArgumentsMeta, SymbolOpenApiOptions, mergeFieldsOpenAPIMetadata } from 'vona-module-a-openapi';
5
+ import { SymbolRouteHandlersArgumentsValue, SymbolRouteHandlersArgumentsMeta, mergeFieldsOpenAPIMetadata } from 'vona-module-a-openapi';
6
6
  import { valid } from 'vona-module-a-validation';
7
7
  import { SymbolUploadValue } from 'vona-module-a-upload';
8
8
  import http from 'node:http';
9
9
  import { Startup } from 'vona-module-a-startup';
10
- import { Service as Service$1, SymbolRequestMappingHandler as SymbolRequestMappingHandler$1 } from 'vona-module-a-web';
11
10
  import Router from 'find-my-way';
12
11
  import { SymbolRouterMiddleware } from 'vona-module-a-executor';
12
+ import { SymbolOpenApiOptions } from 'vona-module-a-openapiutils';
13
13
  import { combineParamsAndQuery } from '@cabloy/utils';
14
14
 
15
15
  async function middlewareGuard(ctx, next) {
@@ -383,11 +383,30 @@ async function routeTailDoneMiddleware(ctx, next) {
383
383
  // }
384
384
 
385
385
  var _dec$2, _dec2$2, _class$2;
386
- let StartupListen = (_dec$2 = Startup({
386
+ let ServiceWeb = (_dec$2 = Service(), _dec2$2 = BeanInfo({
387
+ module: "a-web"
388
+ }), _dec$2(_class$2 = _dec2$2(_class$2 = class ServiceWeb extends BeanBase {
389
+ combineControllerActionApiPath(controller, actionKey, prefix, simplify) {
390
+ // beanOptions
391
+ const beanOptions = appResource.getBean(controller);
392
+ if (!beanOptions) return undefined;
393
+ // controllerPath
394
+ const controllerOptions = beanOptions.options;
395
+ const controllerPath = controllerOptions.path;
396
+ // actionPath
397
+ const handlerMetadata = appMetadata.getMetadata(SymbolRequestMappingHandler, controller.prototype, actionKey);
398
+ const actionPath = handlerMetadata.path || '';
399
+ // combine
400
+ return this.app.util.combineApiPathControllerAndAction(beanOptions.module, controllerPath, actionPath, prefix, simplify);
401
+ }
402
+ }) || _class$2) || _class$2);
403
+
404
+ var _dec$1, _dec2$1, _class$1;
405
+ let StartupListen = (_dec$1 = Startup({
387
406
  after: true
388
- }), _dec2$2 = BeanInfo({
407
+ }), _dec2$1 = BeanInfo({
389
408
  module: "a-web"
390
- }), _dec$2(_class$2 = _dec2$2(_class$2 = class StartupListen extends BeanBase {
409
+ }), _dec$1(_class$1 = _dec2$1(_class$1 = class StartupListen extends BeanBase {
391
410
  async execute() {
392
411
  if (!this.app.config.server.listen.disable) {
393
412
  this.app.server = this._listen(this.app.config.server.listen.port, this.app.config.server.listen.hostname);
@@ -413,25 +432,6 @@ let StartupListen = (_dec$2 = Startup({
413
432
  }); // not set instanceName
414
433
  };
415
434
  }
416
- }) || _class$2) || _class$2);
417
-
418
- var _dec$1, _dec2$1, _class$1;
419
- let ServiceWeb = (_dec$1 = Service$1(), _dec2$1 = BeanInfo({
420
- module: "a-web"
421
- }), _dec$1(_class$1 = _dec2$1(_class$1 = class ServiceWeb extends BeanBase {
422
- combineControllerActionApiPath(controller, actionKey, prefix, simplify) {
423
- // beanOptions
424
- const beanOptions = appResource.getBean(controller);
425
- if (!beanOptions) return undefined;
426
- // controllerPath
427
- const controllerOptions = beanOptions.options;
428
- const controllerPath = controllerOptions.path;
429
- // actionPath
430
- const handlerMetadata = appMetadata.getMetadata(SymbolRequestMappingHandler$1, controller.prototype, actionKey);
431
- const actionPath = handlerMetadata.path || '';
432
- // combine
433
- return this.app.util.combineApiPathControllerAndAction(beanOptions.module, controllerPath, actionPath, prefix, simplify);
434
- }
435
435
  }) || _class$1) || _class$1);
436
436
 
437
437
  function config(_app) {
@@ -535,9 +535,6 @@ function Controller(path, options) {
535
535
  mergeActionsOpenAPIMetadata(target);
536
536
  });
537
537
  }
538
- function Service() {
539
- return createBeanDecorator('service');
540
- }
541
538
  function Dto(options) {
542
539
  return createBeanDecorator('dto', options, false, false, target => {
543
540
  mergeFieldsOpenAPIMetadata(target);
@@ -614,4 +611,4 @@ function $apiPathAndCombineParamsAndQuery(path, options) {
614
611
  return combineParamsAndQuery(path, options);
615
612
  }
616
613
 
617
- export { $apiPath, $apiPathAndCombineParamsAndQuery, BeanRouter, Controller, Dto, Main, RequestMapping, ScopeModuleAWeb, Service, ServiceWeb, StartupListen, SymbolRequestMappingHandler, Web, config, mergeActionsOpenAPIMetadata };
614
+ export { $apiPath, $apiPathAndCombineParamsAndQuery, BeanRouter, Controller, Dto, Main, RequestMapping, ScopeModuleAWeb, ServiceWeb, StartupListen, SymbolRequestMappingHandler, Web, config, mergeActionsOpenAPIMetadata };
@@ -3,6 +3,5 @@ import type { IDecoratorControllerOptions } from '../../types/controller.ts';
3
3
  import type { IDecoratorDtoOptions } from '../../types/dto.ts';
4
4
  export declare function Controller<T extends IDecoratorControllerOptions>(options?: T): ClassDecorator;
5
5
  export declare function Controller<T extends IDecoratorControllerOptions>(path?: string, options?: Omit<T, 'path'>): ClassDecorator;
6
- export declare function Service(): ClassDecorator;
7
6
  export declare function Dto<T extends IDecoratorDtoOptions<any>>(options?: Omit<T, '_fieldsMore_'>): ClassDecorator;
8
7
  export declare function mergeActionsOpenAPIMetadata(target: Constructable): void;
@@ -1,4 +1,4 @@
1
- import type { IOpenApiOptions } from 'vona-module-a-openapi';
1
+ import type { IOpenApiOptions } from 'vona-module-a-openapiutils';
2
2
  import type { TypeRequestMethod } from '../../types/request.ts';
3
3
  export interface RequestMappingMetadata {
4
4
  path?: string;
@@ -1,6 +1,5 @@
1
1
  import type { OmitNever } from 'vona';
2
- import type { ServiceOnion } from 'vona-module-a-onion';
3
- import type { IOnionOptionsEnable } from 'vona-module-a-onion';
2
+ import type { ServiceOnion, TypeOnionOptionsEnableSimple } from 'vona-module-a-onion';
4
3
  export interface IApiPathRecordMethodMap {
5
4
  get: IApiPathGetRecord;
6
5
  post: IApiPathPostRecord;
@@ -22,7 +21,7 @@ export interface IApiPathPatchRecord {
22
21
  }
23
22
  export interface IControllerRecord {
24
23
  }
25
- export interface IDecoratorControllerOptions extends IOnionOptionsEnable<'instanceName'> {
24
+ export interface IDecoratorControllerOptions extends TypeOnionOptionsEnableSimple {
26
25
  path?: string;
27
26
  exclude?: boolean;
28
27
  tags?: string[];
@@ -3,4 +3,3 @@ export * from './dto.ts';
3
3
  export * from './request.ts';
4
4
  export * from './response.ts';
5
5
  export * from './router.ts';
6
- export * from './service.ts';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vona-module-a-web",
3
3
  "type": "module",
4
- "version": "5.0.16",
4
+ "version": "5.0.18",
5
5
  "title": "a-web",
6
6
  "vonaModule": {
7
7
  "capabilities": {
@@ -17,13 +17,6 @@
17
17
  "boilerplate": "cli/dto/boilerplate",
18
18
  "metadataCustom": "cli/dto/metadata/generate.ts"
19
19
  },
20
- "service": {
21
- "sceneIsolate": true,
22
- "scopeResource": true,
23
- "beanGeneral": true,
24
- "optionsGlobalInterfaceFrom": "vona-module-a-web",
25
- "boilerplate": "cli/service/boilerplate"
26
- },
27
20
  "controller": {
28
21
  "sceneIsolate": true,
29
22
  "optionsGlobalInterfaceName": "IDecoratorControllerOptions",
@@ -1,5 +0,0 @@
1
- import { BeanBase } from 'vona';
2
- import { Service } from 'vona-module-a-web';
3
-
4
- @Service()
5
- export class Service<%=argv.beanNameCapitalize%> extends BeanBase {}
@@ -1,13 +0,0 @@
1
- import type { ServiceOnion } from 'vona-module-a-onion';
2
- export interface IServiceRecord {
3
- }
4
- declare module 'vona-module-a-onion' {
5
- interface BeanOnion {
6
- service: ServiceOnion<never, keyof IServiceRecord>;
7
- }
8
- }
9
- declare module 'vona' {
10
- interface IBeanSceneRecord {
11
- service: never;
12
- }
13
- }