vona 5.0.4 → 5.0.7

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.
Files changed (42) hide show
  1. package/LICENSE +21 -0
  2. package/dist/lib/bean/beanContainer.js +2 -0
  3. package/dist/lib/bean/resource/entity/entityBase.d.ts +1 -4
  4. package/dist/lib/bean/resource/entity/index.d.ts +1 -1
  5. package/dist/lib/bean/resource/entity/index.js +1 -1
  6. package/dist/lib/bean/resource/entity/type.d.ts +4 -0
  7. package/dist/lib/bean/resource/entity/type.js +3 -0
  8. package/dist/lib/bean/resource/model/type.d.ts +3 -1
  9. package/dist/lib/core/meta.d.ts +3 -0
  10. package/dist/lib/core/meta.js +15 -5
  11. package/dist/lib/core/resource.d.ts +2 -2
  12. package/dist/lib/core/resource.js +3 -2
  13. package/dist/lib/decorator/class/aop.d.ts +1 -1
  14. package/dist/lib/decorator/class/aop.js +2 -3
  15. package/dist/lib/decorator/class/atom.d.ts +1 -2
  16. package/dist/lib/decorator/class/atom.js +2 -4
  17. package/dist/lib/decorator/class/bean.d.ts +1 -1
  18. package/dist/lib/decorator/class/controller.d.ts +1 -2
  19. package/dist/lib/decorator/class/controller.js +2 -4
  20. package/dist/lib/decorator/class/entity.d.ts +4 -0
  21. package/dist/lib/decorator/class/entity.js +33 -0
  22. package/dist/lib/decorator/class/index.d.ts +1 -0
  23. package/dist/lib/decorator/class/index.js +1 -0
  24. package/dist/lib/decorator/class/model.d.ts +2 -2
  25. package/dist/lib/decorator/class/model.js +1 -8
  26. package/dist/lib/decorator/class/scope.d.ts +1 -1
  27. package/dist/lib/decorator/class/service.d.ts +1 -2
  28. package/dist/lib/decorator/class/service.js +2 -5
  29. package/dist/lib/decorator/class/virtual.d.ts +1 -1
  30. package/dist/lib/decorator/interface/beanOptions.d.ts +4 -15
  31. package/dist/lib/framework/loader.d.ts +5 -2
  32. package/dist/lib/framework/loader.js +17 -5
  33. package/dist/lib/module/module.js +4 -3
  34. package/dist/lib/module/moduleMeta.js +0 -3
  35. package/dist/types/application/app.d.ts +3 -1
  36. package/dist/types/interface/monkey.d.ts +0 -3
  37. package/dist/types/utils/index.d.ts +1 -0
  38. package/dist/types/utils/index.js +1 -0
  39. package/dist/types/utils/type.d.ts +4 -0
  40. package/dist/types/utils/type.js +3 -0
  41. package/package.json +18 -17
  42. package/LICENSE.en-US +0 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2016-present Vona
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -487,6 +487,8 @@ function __hasMagicMothod(instance) {
487
487
  }
488
488
  function __isInnerMethod(prop) {
489
489
  return [
490
+ '__magic_get__',
491
+ '__magic_set__',
490
492
  '__get__',
491
493
  '__set__',
492
494
  '__init__',
@@ -1,14 +1,11 @@
1
1
  export type TableIdentity = string | number;
2
2
  export interface EntityBase {
3
- id: number;
3
+ id: TableIdentity;
4
4
  createdAt: Date;
5
5
  updatedAt: Date;
6
6
  deleted: number;
7
7
  iid: number;
8
8
  }
9
- export interface TableIdentityParams {
10
- id: number;
11
- }
12
9
  export interface EntityItemBase extends EntityBase {
13
10
  atomId: TableIdentity;
14
11
  }
@@ -1,2 +1,2 @@
1
- export * from './entityBase.js';
1
+ export * from './type.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -14,5 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./entityBase.js"), exports);
17
+ __exportStar(require("./type.js"), exports);
18
18
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,4 @@
1
+ export interface IDecoratorEntityOptions {
2
+ table?: string;
3
+ }
4
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=type.js.map
@@ -1,4 +1,6 @@
1
- export interface IModelOptions {
1
+ export interface IDecoratorModelOptions<T extends object = {}> {
2
+ entity?: T;
3
+ table?: string;
2
4
  disableDeleted?: boolean;
3
5
  disableInstance?: boolean;
4
6
  disableUpdateTime?: boolean;
@@ -11,6 +11,7 @@ import { BroadcastClient } from '../module/broadcast/broadcastClient.js';
11
11
  import { VonaContext, IModule, IModuleMeta, ISuite, TypeModuleResourceLocaleModules, TypeModuleResourceLocales } from '../../types/index.js';
12
12
  import { AppResource } from './resource.js';
13
13
  import { AppMetadata } from './metadata.js';
14
+ import { VonaMetaFlavor, VonaMetaMode } from 'vona-shared';
14
15
  export declare class AppMeta extends BeanSimple {
15
16
  workerId: string;
16
17
  inApp: boolean;
@@ -18,6 +19,8 @@ export declare class AppMeta extends BeanSimple {
18
19
  isProd: boolean;
19
20
  isTest: boolean;
20
21
  isLocal: boolean;
22
+ flavor: VonaMetaFlavor;
23
+ mode: VonaMetaMode;
21
24
  util: AppUtil;
22
25
  mockUtil: AppMockUtil;
23
26
  reload: AppReload;
@@ -70,6 +70,18 @@ class AppMeta extends beanSimple_js_1.BeanSimple {
70
70
  writable: true,
71
71
  value: void 0
72
72
  });
73
+ Object.defineProperty(this, "flavor", {
74
+ enumerable: true,
75
+ configurable: true,
76
+ writable: true,
77
+ value: void 0
78
+ });
79
+ Object.defineProperty(this, "mode", {
80
+ enumerable: true,
81
+ configurable: true,
82
+ writable: true,
83
+ value: void 0
84
+ });
73
85
  Object.defineProperty(this, "util", {
74
86
  enumerable: true,
75
87
  configurable: true,
@@ -322,13 +334,11 @@ class AppMeta extends beanSimple_js_1.BeanSimple {
322
334
  this.metadata = metadata_js_1.appMetadata;
323
335
  }
324
336
  prepareEnv() {
325
- // isProd
326
- this.isProd =
327
- this.app.config.env !== 'local' && this.app.config.env !== 'unittest' && this.app.config.env !== 'test';
328
- // isTest
337
+ this.isProd = this.app.config.env === 'prod';
329
338
  this.isTest = this.app.config.env === 'unittest' || this.app.config.env === 'test';
330
- // isLocal
331
339
  this.isLocal = this.app.config.env === 'local';
340
+ this.flavor = this.app.options.flavor || process.env.META_FLAVOR || 'normal';
341
+ this.mode = this.app.config.env;
332
342
  }
333
343
  }
334
344
  exports.AppMeta = AppMeta;
@@ -10,11 +10,11 @@ export declare class AppResource extends BeanSimple {
10
10
  aopsArray: IDecoratorBeanOptionsBase[];
11
11
  addUse(target: object, options: IDecoratorUseOptionsBase): void;
12
12
  getUses(target: object): Record<MetadataKey, IDecoratorUseOptionsBase> | undefined;
13
- addAop<T>(options: Partial<IDecoratorBeanOptionsBase<T>>): IDecoratorBeanOptionsBase<T>;
13
+ addAop<T>(options: Partial<IDecoratorBeanOptionsBase<T>>): IDecoratorBeanOptionsBase<unknown>;
14
14
  findAopsMatched<T>(A: Constructable<T>): string[] | undefined;
15
15
  findAopsMatched<K extends keyof IBeanRecord>(beanFullName: K): string[] | undefined;
16
16
  findAopsMatched(beanFullName: string): string[] | undefined;
17
- addBean<T>(options: Partial<IDecoratorBeanOptionsBase<T>>): IDecoratorBeanOptionsBase<T>;
17
+ addBean(options: Partial<IDecoratorBeanOptionsBase>): IDecoratorBeanOptionsBase<unknown>;
18
18
  getBeanFullName<T>(A: Constructable<T>): string | undefined;
19
19
  getBean<T>(A: Constructable<T>): IDecoratorBeanOptionsBase<T> | undefined;
20
20
  getBean<K extends keyof IBeanRecord>(beanFullName: K): IDecoratorBeanOptionsBase<IBeanRecord[K]> | undefined;
@@ -56,16 +56,17 @@ class AppResource extends beanSimple_js_1.BeanSimple {
56
56
  // loop
57
57
  const aopsMatched = [];
58
58
  for (const aop of this.aopsArray) {
59
+ const aopOptions = aop.options;
59
60
  // not self
60
61
  if (aop.beanFullName === beanOptions.beanFullName)
61
62
  continue;
62
63
  // // check if match aop
63
64
  // if (beanOptions.aop && !aop.matchAop) continue;
64
65
  // gate
65
- if (!this.app.meta.util.checkGate(aop.gate))
66
+ if (!this.app.meta.util.checkGate(aopOptions.gate))
66
67
  continue;
67
68
  // match
68
- if (__aopMatch(aop.aopMatch, beanOptions.beanFullName)) {
69
+ if (__aopMatch(aopOptions.match, beanOptions.beanFullName)) {
69
70
  aopsMatched.push(aop.beanFullName);
70
71
  }
71
72
  }
@@ -1,3 +1,3 @@
1
1
  import { IDecoratorAopOptions } from '../index.js';
2
- export declare function Aop<T>(options: IDecoratorAopOptions): ClassDecorator;
2
+ export declare function Aop(options: IDecoratorAopOptions): ClassDecorator;
3
3
  //# sourceMappingURL=aop.d.ts.map
@@ -11,11 +11,10 @@ function Aop(options) {
11
11
  index_js_1.appResource.addAop({
12
12
  module,
13
13
  scene: 'aop',
14
- name: options.name,
14
+ name: undefined,
15
15
  beanClass: target,
16
16
  aop: true,
17
- aopMatch: options.match,
18
- gate: options.gate,
17
+ options,
19
18
  });
20
19
  };
21
20
  }
@@ -1,3 +1,2 @@
1
- import { IDecoratorAtomOptions } from '../index.js';
2
- export declare function Atom<T>(options?: IDecoratorAtomOptions): ClassDecorator;
1
+ export declare function Atom(): ClassDecorator;
3
2
  //# sourceMappingURL=atom.d.ts.map
@@ -3,17 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Atom = void 0;
4
4
  const index_js_1 = require("../../../index.js");
5
5
  const util_js_1 = require("./util.js");
6
- function Atom(options) {
6
+ function Atom() {
7
7
  return function (target) {
8
- if (!options)
9
- options = {};
10
8
  // module
11
9
  const module = (0, util_js_1.parseModuleName)();
12
10
  // add
13
11
  index_js_1.appResource.addBean({
14
12
  module,
15
13
  scene: 'atom',
16
- name: options.name,
14
+ name: undefined,
17
15
  beanClass: target,
18
16
  });
19
17
  };
@@ -1,3 +1,3 @@
1
1
  import { IDecoratorBeanOptions } from '../index.js';
2
- export declare function Bean<T>(options?: IDecoratorBeanOptions): ClassDecorator;
2
+ export declare function Bean(options?: IDecoratorBeanOptions): ClassDecorator;
3
3
  //# sourceMappingURL=bean.d.ts.map
@@ -1,3 +1,2 @@
1
- import { IDecoratorControllerOptions } from '../index.js';
2
- export declare function Controller<T>(options?: IDecoratorControllerOptions): ClassDecorator;
1
+ export declare function Controller(): ClassDecorator;
3
2
  //# sourceMappingURL=controller.d.ts.map
@@ -3,17 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Controller = void 0;
4
4
  const index_js_1 = require("../../../index.js");
5
5
  const util_js_1 = require("./util.js");
6
- function Controller(options) {
6
+ function Controller() {
7
7
  return function (target) {
8
- if (!options)
9
- options = {};
10
8
  // module
11
9
  const module = (0, util_js_1.parseModuleName)();
12
10
  // add
13
11
  index_js_1.appResource.addBean({
14
12
  module,
15
13
  scene: 'controller',
16
- name: options.name,
14
+ name: undefined,
17
15
  beanClass: target,
18
16
  });
19
17
  };
@@ -0,0 +1,4 @@
1
+ import { IDecoratorEntityOptions } from '../../../index.js';
2
+ export declare function Entity(options?: IDecoratorEntityOptions): ClassDecorator;
3
+ export declare function Entity(table?: string): ClassDecorator;
4
+ //# sourceMappingURL=entity.d.ts.map
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Entity = void 0;
4
+ const index_js_1 = require("../../../index.js");
5
+ const util_js_1 = require("./util.js");
6
+ const __tableNames = new Set();
7
+ function Entity(options) {
8
+ return function (target) {
9
+ if (!options)
10
+ options = {};
11
+ if (typeof options === 'string') {
12
+ options = { table: options };
13
+ }
14
+ // module
15
+ const module = (0, util_js_1.parseModuleName)();
16
+ // tableName
17
+ const tableName = options.table;
18
+ if (__tableNames.has(tableName)) {
19
+ throw new Error(`model table exists: ${tableName}`);
20
+ }
21
+ __tableNames.add(tableName);
22
+ // add
23
+ index_js_1.appResource.addBean({
24
+ module,
25
+ scene: 'entity',
26
+ name: undefined,
27
+ beanClass: target,
28
+ options,
29
+ });
30
+ };
31
+ }
32
+ exports.Entity = Entity;
33
+ //# sourceMappingURL=entity.js.map
@@ -2,6 +2,7 @@ export * from './aop.js';
2
2
  export * from './atom.js';
3
3
  export * from './bean.js';
4
4
  export * from './controller.js';
5
+ export * from './entity.js';
5
6
  export * from './model.js';
6
7
  export * from './service.js';
7
8
  export * from './virtual.js';
@@ -18,6 +18,7 @@ __exportStar(require("./aop.js"), exports);
18
18
  __exportStar(require("./atom.js"), exports);
19
19
  __exportStar(require("./bean.js"), exports);
20
20
  __exportStar(require("./controller.js"), exports);
21
+ __exportStar(require("./entity.js"), exports);
21
22
  __exportStar(require("./model.js"), exports);
22
23
  __exportStar(require("./service.js"), exports);
23
24
  __exportStar(require("./virtual.js"), exports);
@@ -1,3 +1,3 @@
1
- import { IDecoratorModelOptions } from '../index.js';
2
- export declare function Model<T>(options: IDecoratorModelOptions): ClassDecorator;
1
+ import { IDecoratorModelOptions } from '../../../index.js';
2
+ export declare function Model(options?: IDecoratorModelOptions): ClassDecorator;
3
3
  //# sourceMappingURL=model.d.ts.map
@@ -3,22 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Model = void 0;
4
4
  const index_js_1 = require("../../../index.js");
5
5
  const util_js_1 = require("./util.js");
6
- const __tableNames = new Set();
7
6
  function Model(options) {
8
7
  return function (target) {
9
8
  // module
10
9
  const module = (0, util_js_1.parseModuleName)();
11
- // tableName
12
- const tableName = options.table;
13
- if (__tableNames.has(tableName)) {
14
- throw new Error(`model table exists: ${tableName}`);
15
- }
16
- __tableNames.add(tableName);
17
10
  // add
18
11
  index_js_1.appResource.addBean({
19
12
  module,
20
13
  scene: 'model',
21
- name: options.name,
14
+ name: undefined,
22
15
  beanClass: target,
23
16
  options,
24
17
  });
@@ -1,2 +1,2 @@
1
- export declare function Scope<T>(): ClassDecorator;
1
+ export declare function Scope(): ClassDecorator;
2
2
  //# sourceMappingURL=scope.d.ts.map
@@ -1,3 +1,2 @@
1
- import { IDecoratorServiceOptions } from '../index.js';
2
- export declare function Service<T>(options?: IDecoratorServiceOptions): ClassDecorator;
1
+ export declare function Service(): ClassDecorator;
3
2
  //# sourceMappingURL=service.d.ts.map
@@ -3,18 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Service = void 0;
4
4
  const index_js_1 = require("../../../index.js");
5
5
  const util_js_1 = require("./util.js");
6
- function Service(options) {
6
+ function Service() {
7
7
  return function (target) {
8
- if (!options)
9
- options = {};
10
8
  // module
11
9
  const module = (0, util_js_1.parseModuleName)();
12
10
  // add
13
11
  index_js_1.appResource.addBean({
14
12
  module,
15
13
  scene: 'service',
16
- name: options.name,
17
- containerScope: options.containerScope,
14
+ name: undefined,
18
15
  beanClass: target,
19
16
  });
20
17
  };
@@ -1,3 +1,3 @@
1
1
  import { IDecoratorVirtualOptions } from '../index.js';
2
- export declare function Virtual<T>(options?: IDecoratorVirtualOptions): ClassDecorator;
2
+ export declare function Virtual(options?: IDecoratorVirtualOptions): ClassDecorator;
3
3
  //# sourceMappingURL=virtual.d.ts.map
@@ -1,9 +1,8 @@
1
1
  import { IModuleMiddlewareGate } from '../../bean/index.js';
2
- import { IModelOptions } from '../../bean/resource/model/type.js';
3
2
  import { MetadataKey } from '../../core/metadata.js';
4
3
  import { Constructable } from '../index.js';
5
4
  import { ContainerScope } from '../index.js';
6
- export type TypeDecoratorBeanOptionsSceneBase = 'service' | 'aop' | 'virtual' | 'scope' | 'controller' | 'model' | 'atom' | TypeDecoratorBeanOptionsScene;
5
+ export type TypeDecoratorBeanOptionsSceneBase = 'service' | 'aop' | 'virtual' | 'scope' | 'controller' | 'entity' | 'model' | 'atom' | TypeDecoratorBeanOptionsScene;
7
6
  export type TypeDecoratorBeanOptionsScene = 'bean' | 'service' | 'broadcast' | 'startup' | 'queue' | 'version' | 'schedule' | 'middleware' | 'middleware.io' | 'event' | 'stats' | 'sequence' | 'test' | 'flow.node' | 'flow.edge' | 'flow.behavior' | 'flow.service' | 'auth.provider' | 'cli.create' | 'cli.default' | 'cli.front' | 'cli.git' | 'cli.store' | 'cli.token' | 'cli.tools' | 'io.message' | 'io.channel' | 'summer.cache' | 'captcha.provider' | 'sms.provider' | 'database.dialect';
8
7
  export interface IDecoratorBeanOptionsBase<T = unknown> {
9
8
  /**
@@ -17,10 +16,8 @@ export interface IDecoratorBeanOptionsBase<T = unknown> {
17
16
  beanClass: Constructable<T>;
18
17
  containerScope?: ContainerScope;
19
18
  aop: boolean | undefined;
20
- aopMatch?: string | RegExp | (string | RegExp)[];
21
19
  virtual?: boolean;
22
20
  moduleBelong?: string;
23
- gate?: IModuleMiddlewareGate;
24
21
  options?: unknown;
25
22
  __aopChains__: MetadataKey[];
26
23
  __aopChainsKey__: Record<string, [MetadataKey, string][]>;
@@ -33,23 +30,15 @@ export interface IDecoratorBeanOptions {
33
30
  }
34
31
  export type IDecoratorVirtualOptions = IDecoratorBeanOptions;
35
32
  export interface IDecoratorServiceOptions {
36
- name?: string;
37
- containerScope?: ContainerScope;
38
33
  }
39
34
  export interface IDecoratorAtomOptions {
40
- name?: string;
41
35
  }
42
36
  export interface IDecoratorControllerOptions {
43
- name?: string;
44
- }
45
- export interface IDecoratorModelOptions {
46
- name?: string;
47
- table: string;
48
- options: IModelOptions;
49
37
  }
38
+ type TypeDecoratorAopOptionsMatch = string | RegExp | (string | RegExp)[];
50
39
  export interface IDecoratorAopOptions {
51
- name?: string;
52
- match: string | RegExp | (string | RegExp)[];
40
+ match: TypeDecoratorAopOptionsMatch;
53
41
  gate?: IModuleMiddlewareGate;
54
42
  }
43
+ export {};
55
44
  //# sourceMappingURL=beanOptions.d.ts.map
@@ -1,10 +1,12 @@
1
+ import { VonaConfigMeta } from 'vona-shared';
1
2
  export declare const CustomAppWorkerLoader: {
2
3
  new (): {
3
4
  [x: string]: any;
4
5
  pkgVona: any;
5
6
  loadConfig(): void;
6
7
  getAppname(): any;
7
- _loadEnvAndConfig(): void;
8
+ _loadAppEnvs(meta: VonaConfigMeta): void;
9
+ _loadAppConfig(meta: VonaConfigMeta): void;
8
10
  };
9
11
  [x: string]: any;
10
12
  };
@@ -14,7 +16,8 @@ export declare const CustomAgentWorkerLoader: {
14
16
  pkgVona: any;
15
17
  loadConfig(): void;
16
18
  getAppname(): any;
17
- _loadEnvAndConfig(): void;
19
+ _loadAppEnvs(meta: VonaConfigMeta): void;
20
+ _loadAppConfig(meta: VonaConfigMeta): void;
18
21
  };
19
22
  [x: string]: any;
20
23
  };
@@ -20,8 +20,21 @@ function createLoaderClass(Base) {
20
20
  });
21
21
  }
22
22
  loadConfig() {
23
+ // meta
24
+ const mode = this.serverEnv;
25
+ // use process.env.META_FLAVOR for test
26
+ const meta = {
27
+ flavor: this.app.options.flavor || process.env.META_FLAVOR || 'normal',
28
+ mode,
29
+ mine: 'mine',
30
+ };
31
+ // load envs
32
+ this._loadAppEnvs(meta);
33
+ // load super config
23
34
  super.loadConfig();
24
- this._loadEnvAndConfig();
35
+ // load app config
36
+ this._loadAppConfig(meta);
37
+ // subdomainOffset
25
38
  this.app.subdomainOffset = typeof this.config.subdomainOffset === 'undefined' ? 2 : this.config.subdomainOffset;
26
39
  }
27
40
  getAppname() {
@@ -31,13 +44,12 @@ function createLoaderClass(Base) {
31
44
  }
32
45
  return this.pkgVona.name;
33
46
  }
34
- _loadEnvAndConfig() {
35
- // load envs
36
- const meta = { serverEnv: this.serverEnv, mine: 'mine' };
47
+ _loadAppEnvs(meta) {
37
48
  const projectPath = path_1.default.join(this.options.baseDir, '../..');
38
49
  const envDir = path_1.default.join(projectPath, 'env');
39
50
  (0, dotenv_1.loadEnvs)(meta, envDir, '.env');
40
- // load config
51
+ }
52
+ _loadAppConfig(meta) {
41
53
  const configDir = path_1.default.join(this.options.baseDir, 'config/config');
42
54
  const files = (0, dotenv_1.getEnvFiles)(meta, configDir, 'config', '.js');
43
55
  if (!files)
@@ -42,9 +42,10 @@ class ModuleTools extends beanSimple_js_1.BeanSimple {
42
42
  const { suites, modules, modulesArray } = await (0, module_glob_1.glob)({
43
43
  projectMode: 'vona',
44
44
  projectPath: path_1.default.join(app.options.baseDir, '../..'),
45
- disabledModules: process.env.Project_Disabled_Modules,
46
- disabledSuites: process.env.Project_Disabled_Suites,
47
- log: !!app.meta.inAgent,
45
+ disabledModules: process.env.PROJECT_DISABLED_MODULES,
46
+ disabledSuites: process.env.PROJECT_DISABLED_SUITES,
47
+ log: false,
48
+ //log: !!app.meta.inAgent,
48
49
  });
49
50
  app.meta.suites = suites;
50
51
  app.meta.modules = modules;
@@ -15,9 +15,6 @@ async function default_1(app, modules) {
15
15
  else {
16
16
  module.meta = module.resource.meta;
17
17
  }
18
- if (module.meta) {
19
- await app.meta.util.monkeyModule(app.meta.appMonkey, app.meta.modulesMonkey, 'metaLoaded', module, module.meta);
20
- }
21
18
  app.meta.metas[module.info.relativeName] = module.meta;
22
19
  }
23
20
  }
@@ -7,7 +7,9 @@ import { Redis } from 'ioredis';
7
7
  import { VonaConfig } from '../config/config.js';
8
8
  export * as IORedis from 'ioredis';
9
9
  export interface VonaApplication extends EggApplication {
10
- options: EggLoaderOptions;
10
+ options: EggLoaderOptions & {
11
+ flavor: any;
12
+ };
11
13
  meta: AppMeta;
12
14
  bean: BeanContainer;
13
15
  redis: Singleton<Redis>;
@@ -5,19 +5,16 @@ export interface IMonkeyApp {
5
5
  moduleLoading(module: IModule): Promise<void>;
6
6
  moduleLoaded(module: IModule): Promise<void>;
7
7
  configLoaded(module: IModule, config: any): Promise<void>;
8
- metaLoaded(module: IModule, meta: any): Promise<void>;
9
8
  }
10
9
  export interface IModuleMain {
11
10
  moduleLoading(): Promise<void>;
12
11
  moduleLoaded(): Promise<void>;
13
12
  configLoaded(config: any): Promise<void>;
14
- metaLoaded(meta: any): Promise<void>;
15
13
  }
16
14
  export interface IMonkeyModule {
17
15
  moduleLoading(module: IModule): Promise<void>;
18
16
  moduleLoaded(module: IModule): Promise<void>;
19
17
  configLoaded(module: IModule, config: any): Promise<void>;
20
- metaLoaded(module: IModule, meta: any): Promise<void>;
21
18
  }
22
19
  export interface IMonkeySystem {
23
20
  createContext(context: VonaContext): void;
@@ -1,3 +1,4 @@
1
1
  export * from './cast.js';
2
2
  export * from './powerPartial.js';
3
+ export * from './type.js';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./cast.js"), exports);
18
18
  __exportStar(require("./powerPartial.js"), exports);
19
+ __exportStar(require("./type.js"), exports);
19
20
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,4 @@
1
+ export interface Type<T = any> extends Function {
2
+ new (...args: any[]): T;
3
+ }
4
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=type.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vona",
3
- "version": "5.0.4",
3
+ "version": "5.0.7",
4
4
  "description": "vona",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -32,20 +32,20 @@
32
32
  ],
33
33
  "author": "zhennann",
34
34
  "dependencies": {
35
- "@cabloy/cluster-reload": "^1.0.4",
36
- "@cabloy/compose": "^1.0.6",
37
- "@cabloy/deps": "^1.0.4",
38
- "@cabloy/dotenv": "^1.0.6",
35
+ "@cabloy/cluster-reload": "^1.0.7",
36
+ "@cabloy/compose": "^1.0.9",
37
+ "@cabloy/deps": "^1.0.7",
38
+ "@cabloy/dotenv": "^1.0.9",
39
39
  "@cabloy/egg-socket.io": "^6.0.0",
40
- "@cabloy/ensure-array": "^1.0.5",
41
- "@cabloy/extend": "^3.0.9",
42
- "@cabloy/json5": "^1.0.4",
40
+ "@cabloy/ensure-array": "^1.0.8",
41
+ "@cabloy/extend": "^3.0.12",
42
+ "@cabloy/json5": "^1.0.7",
43
43
  "@cabloy/koa-static-cache": "^5.1.8",
44
- "@cabloy/localeutil": "^1.0.8",
45
- "@cabloy/module-glob": "^5.1.5",
46
- "@cabloy/module-info": "^1.1.5",
47
- "@cabloy/module-info-pro": "^1.0.13",
48
- "@cabloy/set": "^1.0.4",
44
+ "@cabloy/localeutil": "^1.0.11",
45
+ "@cabloy/module-glob": "^5.1.8",
46
+ "@cabloy/module-info": "^1.1.8",
47
+ "@cabloy/module-info-pro": "^1.0.16",
48
+ "@cabloy/set": "^1.0.7",
49
49
  "@cabloy/word-utils": "^1.0.2",
50
50
  "@zhennann/egg-passport": "^2.1.5",
51
51
  "async": "^3.2.0",
@@ -56,7 +56,7 @@
56
56
  "debounce": "^1.2.0",
57
57
  "debug": "^4.3.4",
58
58
  "egg": "^3.17.5",
59
- "egg-born-mock": "^6.0.4",
59
+ "egg-born-mock": "^6.0.7",
60
60
  "egg-cluster": "^2.2.1",
61
61
  "egg-path-matching": "^1.0.1",
62
62
  "egg-redis": "^2.4.0",
@@ -74,12 +74,13 @@
74
74
  "passport-oauth2": "^1.6.1",
75
75
  "raw-body": "2.5.1",
76
76
  "redlock": "^4.1.0",
77
- "reflect-metadata": "^0.2.1",
77
+ "reflect-metadata": "^0.2.2",
78
78
  "regenerator-runtime": "^0.14.1",
79
79
  "semver": "^7.3.7",
80
80
  "socket.io": "^2.3.0",
81
81
  "supertest": "^4.0.2",
82
- "uuid": "^9.0.1"
82
+ "uuid": "^9.0.1",
83
+ "vona-shared": "^1.0.7"
83
84
  },
84
- "gitHead": "72c82934d27173943963f25132b03c3f8e8933d3"
85
+ "gitHead": "2d40c063c115b230fdbc89f5a78b4412ebd0dfc9"
85
86
  }
package/LICENSE.en-US DELETED
@@ -1,3 +0,0 @@
1
- Copyright (c) 2016-present CabloyJS
2
-
3
- CabloyJS 5.0 internal beta version, still under continuous development, not yet open source, please do not spread it