@midwayjs/core 3.0.0-alpha.9 → 3.0.0-beta.4

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 (109) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/dist/baseFramework.d.ts +55 -22
  3. package/dist/baseFramework.js +151 -232
  4. package/dist/{util → common}/fileDetector.d.ts +0 -0
  5. package/dist/{util → common}/fileDetector.js +16 -10
  6. package/dist/common/filterManager.d.ts +19 -0
  7. package/dist/common/filterManager.js +85 -0
  8. package/dist/common/middlewareManager.d.ts +11 -0
  9. package/dist/common/middlewareManager.js +48 -0
  10. package/dist/common/serviceFactory.d.ts +15 -0
  11. package/dist/{util → common}/serviceFactory.js +16 -6
  12. package/dist/{util → common}/triggerCollector.d.ts +0 -0
  13. package/dist/{util → common}/triggerCollector.js +0 -0
  14. package/dist/common/webGenerator.d.ts +27 -0
  15. package/dist/common/webGenerator.js +125 -0
  16. package/dist/{util → common}/webRouterCollector.d.ts +21 -2
  17. package/dist/{util → common}/webRouterCollector.js +115 -138
  18. package/dist/config/config.default.d.ts +7 -0
  19. package/dist/config/config.default.js +28 -0
  20. package/dist/context/container.d.ts +73 -43
  21. package/dist/context/container.js +277 -270
  22. package/dist/context/definitionRegistry.d.ts +26 -0
  23. package/dist/context/definitionRegistry.js +124 -0
  24. package/dist/context/managedResolverFactory.d.ts +15 -32
  25. package/dist/context/managedResolverFactory.js +88 -317
  26. package/dist/context/providerWrapper.d.ts +2 -3
  27. package/dist/context/requestContainer.d.ts +0 -2
  28. package/dist/context/requestContainer.js +9 -26
  29. package/dist/definitions/functionDefinition.d.ts +3 -4
  30. package/dist/definitions/functionDefinition.js +0 -6
  31. package/dist/definitions/objectCreator.js +6 -6
  32. package/dist/definitions/objectDefinition.d.ts +4 -6
  33. package/dist/definitions/objectDefinition.js +0 -8
  34. package/dist/definitions/properties.d.ts +2 -15
  35. package/dist/definitions/properties.js +3 -72
  36. package/dist/error/base.d.ts +13 -0
  37. package/dist/error/base.js +19 -0
  38. package/dist/error/code.d.ts +59 -0
  39. package/dist/error/code.js +64 -0
  40. package/dist/error/framework.d.ts +21 -0
  41. package/dist/error/framework.js +52 -0
  42. package/dist/error/http.d.ts +58 -0
  43. package/dist/error/http.js +82 -0
  44. package/dist/error/index.d.ts +4 -0
  45. package/dist/error/index.js +16 -0
  46. package/dist/functional/configuration.d.ts +4 -2
  47. package/dist/functional/configuration.js +12 -2
  48. package/dist/index.d.ts +23 -10
  49. package/dist/index.js +33 -33
  50. package/dist/interface.d.ts +263 -184
  51. package/dist/interface.js +9 -1
  52. package/dist/service/aspectService.d.ts +11 -14
  53. package/dist/service/aspectService.js +116 -172
  54. package/dist/service/configService.d.ts +10 -8
  55. package/dist/service/configService.js +61 -38
  56. package/dist/service/decoratorService.d.ts +23 -0
  57. package/dist/service/decoratorService.js +149 -0
  58. package/dist/service/environmentService.js +15 -4
  59. package/dist/service/frameworkService.d.ts +25 -0
  60. package/dist/service/frameworkService.js +171 -0
  61. package/dist/service/informationService.d.ts +4 -7
  62. package/dist/service/informationService.js +41 -10
  63. package/dist/service/lifeCycleService.d.ts +14 -0
  64. package/dist/service/lifeCycleService.js +130 -0
  65. package/dist/service/loggerService.d.ts +27 -0
  66. package/dist/service/loggerService.js +132 -0
  67. package/dist/service/middlewareService.d.ts +11 -0
  68. package/dist/service/middlewareService.js +119 -0
  69. package/dist/{features/pipeline.d.ts → service/pipelineService.d.ts} +56 -46
  70. package/dist/{features/pipeline.js → service/pipelineService.js} +54 -19
  71. package/dist/setup.d.ts +4 -0
  72. package/dist/setup.js +113 -0
  73. package/dist/util/contextUtil.d.ts +1 -1
  74. package/dist/util/contextUtil.js +2 -2
  75. package/dist/util/index.d.ts +55 -0
  76. package/dist/util/index.js +137 -7
  77. package/dist/util/pathFileUtil.js +2 -2
  78. package/dist/util/pathToRegexp.d.ts +17 -0
  79. package/dist/util/pathToRegexp.js +280 -0
  80. package/dist/util/webRouterParam.d.ts +2 -2
  81. package/dist/util/webRouterParam.js +19 -20
  82. package/package.json +8 -13
  83. package/dist/common/lodashWrap.d.ts +0 -9
  84. package/dist/common/lodashWrap.js +0 -18
  85. package/dist/common/notFoundError.d.ts +0 -8
  86. package/dist/common/notFoundError.js +0 -20
  87. package/dist/common/reflectTool.d.ts +0 -15
  88. package/dist/common/reflectTool.js +0 -83
  89. package/dist/context/applicationContext.d.ts +0 -81
  90. package/dist/context/applicationContext.js +0 -263
  91. package/dist/context/managed.d.ts +0 -45
  92. package/dist/context/managed.js +0 -69
  93. package/dist/context/resolverHandler.d.ts +0 -34
  94. package/dist/context/resolverHandler.js +0 -88
  95. package/dist/definitions/messageSource.d.ts +0 -13
  96. package/dist/definitions/messageSource.js +0 -74
  97. package/dist/definitions/resource.d.ts +0 -27
  98. package/dist/definitions/resource.js +0 -116
  99. package/dist/features/index.d.ts +0 -2
  100. package/dist/features/index.js +0 -3
  101. package/dist/logger.d.ts +0 -4
  102. package/dist/logger.js +0 -20
  103. package/dist/util/containerUtil.d.ts +0 -11
  104. package/dist/util/containerUtil.js +0 -26
  105. package/dist/util/emptyFramework.d.ts +0 -62
  106. package/dist/util/emptyFramework.js +0 -72
  107. package/dist/util/serviceFactory.d.ts +0 -13
  108. package/dist/util/staticConfig.d.ts +0 -10
  109. package/dist/util/staticConfig.js +0 -67
package/CHANGELOG.md CHANGED
@@ -3,6 +3,66 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.0.0-beta.4](https://github.com/midwayjs/midway/compare/v3.0.0-beta.3...v3.0.0-beta.4) (2021-11-24)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * logger close before bootstrap close ([#1370](https://github.com/midwayjs/midway/issues/1370)) ([6cc2720](https://github.com/midwayjs/midway/commit/6cc2720ed3445e8ffccc96d124b80ed7e2517f08))
12
+
13
+
14
+ ### Features
15
+
16
+ * add i18n ([#1375](https://github.com/midwayjs/midway/issues/1375)) ([bffefe0](https://github.com/midwayjs/midway/commit/bffefe07afe45777d49b5a76b9ab17fc2b9d9a55))
17
+ * auto transform args to type ([#1372](https://github.com/midwayjs/midway/issues/1372)) ([bb3f7d2](https://github.com/midwayjs/midway/commit/bb3f7d2028a034e1926d9df554849332354c3762))
18
+ * support global prefix url ([#1371](https://github.com/midwayjs/midway/issues/1371)) ([cc5fe44](https://github.com/midwayjs/midway/commit/cc5fe44e1d221590562dc71e1f33ae96093e0da7))
19
+
20
+
21
+
22
+
23
+
24
+ # [3.0.0-beta.3](https://github.com/midwayjs/midway/compare/v3.0.0-beta.2...v3.0.0-beta.3) (2021-11-18)
25
+
26
+
27
+ ### Features
28
+
29
+ * add component and framework config definition ([#1367](https://github.com/midwayjs/midway/issues/1367)) ([b2fe615](https://github.com/midwayjs/midway/commit/b2fe6157f99659471ff1333eca0b86bb889f61a3))
30
+
31
+
32
+
33
+
34
+
35
+ # [3.0.0-beta.2](https://github.com/midwayjs/midway/compare/v3.0.0-beta.1...v3.0.0-beta.2) (2021-11-16)
36
+
37
+ **Note:** Version bump only for package @midwayjs/core
38
+
39
+
40
+
41
+
42
+
43
+ # [3.0.0-beta.1](https://github.com/midwayjs/midway/compare/v2.12.4...v3.0.0-beta.1) (2021-11-14)
44
+
45
+
46
+ ### Bug Fixes
47
+
48
+ * circular inject for provide uuid ([#1285](https://github.com/midwayjs/midway/issues/1285)) ([34533bf](https://github.com/midwayjs/midway/commit/34533bfe9bf1c4acdffb1360ab24c716b5196de8))
49
+ * component env filter ([#1234](https://github.com/midwayjs/midway/issues/1234)) ([1ad365f](https://github.com/midwayjs/midway/commit/1ad365fd8ef5e0e7dae3d08a2427a2300038290a))
50
+ * correct aspect chain bug ([#1204](https://github.com/midwayjs/midway/issues/1204)) ([5de5284](https://github.com/midwayjs/midway/commit/5de5284c70b44acc73eaaad651fd2edc72d54f28))
51
+ * empty options in default ([#1241](https://github.com/midwayjs/midway/issues/1241)) ([802109d](https://github.com/midwayjs/midway/commit/802109ddd098afb04d6d540bff509e0aee85b806))
52
+ * functional configuration load async code ([#1300](https://github.com/midwayjs/midway/issues/1300)) ([32bcf03](https://github.com/midwayjs/midway/commit/32bcf030ed1ab04482dc557f8b0c6904e47b31e1))
53
+ * load component with enabledEnvironment ([#1329](https://github.com/midwayjs/midway/issues/1329)) ([3182271](https://github.com/midwayjs/midway/commit/3182271a1eab931e2bf872bff6e2725ebb906ad0))
54
+ * static prefix ([#1321](https://github.com/midwayjs/midway/issues/1321)) ([31fe961](https://github.com/midwayjs/midway/commit/31fe961931fed7656a144b1682ee4c4bb25fdff5))
55
+
56
+
57
+ ### Features
58
+
59
+ * add mongoose component and support multi-instance for typegoose ([#1334](https://github.com/midwayjs/midway/issues/1334)) ([ca0b73f](https://github.com/midwayjs/midway/commit/ca0b73fec77e8871e4001b4c9d3e45397ce32450))
60
+ * add redis component ([#1270](https://github.com/midwayjs/midway/issues/1270)) ([09c993a](https://github.com/midwayjs/midway/commit/09c993ac308d26fa9c742a659471c3f4cf5c5782))
61
+
62
+
63
+
64
+
65
+
6
66
  ## [2.12.3](https://github.com/midwayjs/midway/compare/v2.12.2...v2.12.3) (2021-08-09)
7
67
 
8
68
 
@@ -1,54 +1,87 @@
1
- import { IConfigurationOptions, IMidwayApplication, IMidwayBootstrapOptions, IMidwayContainer, IMidwayContext, IMidwayFramework } from './interface';
2
- import { MidwayFrameworkType } from '@midwayjs/decorator';
1
+ import { CommonMiddlewareUnion, IConfigurationOptions, IMidwayApplication, IMidwayBootstrapOptions, IMidwayContainer, IMidwayContext, IMidwayFramework, CommonFilterUnion, CommonMiddleware, MiddlewareRespond } from './interface';
2
+ import { FrameworkType } from '@midwayjs/decorator';
3
3
  import { ILogger, LoggerOptions } from '@midwayjs/logger';
4
- export declare abstract class BaseFramework<APP extends IMidwayApplication<CTX>, CTX extends IMidwayContext, OPT extends IConfigurationOptions> implements IMidwayFramework<APP, OPT> {
5
- protected applicationContext: IMidwayContainer;
4
+ import { MidwayEnvironmentService } from './service/environmentService';
5
+ import { MidwayConfigService } from './service/configService';
6
+ import { MidwayInformationService } from './service/informationService';
7
+ import { MidwayLoggerService } from './service/loggerService';
8
+ import { ContextMiddlewareManager } from './common/middlewareManager';
9
+ import { MidwayMiddlewareService } from './service/middlewareService';
10
+ import { FilterManager } from './common/filterManager';
11
+ export declare abstract class BaseFramework<APP extends IMidwayApplication<CTX>, CTX extends IMidwayContext, OPT extends IConfigurationOptions, ResOrNext = unknown, Next = unknown> implements IMidwayFramework<APP, CTX, OPT, ResOrNext, Next> {
12
+ readonly applicationContext: IMidwayContainer;
13
+ app: APP;
14
+ configurationOptions: OPT;
6
15
  protected logger: ILogger;
7
16
  protected appLogger: ILogger;
8
- configurationOptions: OPT;
9
- app: APP;
10
17
  protected defaultContext: {};
11
18
  protected BaseContextLoggerClass: any;
12
- protected isMainFramework: boolean;
13
- configure(options?: OPT): BaseFramework<APP, CTX, OPT>;
14
- initialize(options: IMidwayBootstrapOptions): Promise<void>;
15
- protected initializeInfo(options: IMidwayBootstrapOptions): Promise<void>;
16
- protected initializeLogger(options: IMidwayBootstrapOptions): Promise<void>;
19
+ protected ContextLoggerApplyLogger: string;
20
+ protected middlewareManager: ContextMiddlewareManager<CTX, ResOrNext, Next>;
21
+ protected filterManager: FilterManager<CTX, ResOrNext, Next>;
22
+ protected composeMiddleware: any;
23
+ loggerService: MidwayLoggerService;
24
+ environmentService: MidwayEnvironmentService;
25
+ configService: MidwayConfigService;
26
+ informationService: MidwayInformationService;
27
+ middlewareService: MidwayMiddlewareService<CTX, ResOrNext, Next>;
28
+ constructor(applicationContext: IMidwayContainer);
29
+ init(): Promise<this>;
30
+ abstract configure(options?: OPT): any;
31
+ isEnable(): boolean;
32
+ initialize(options?: IMidwayBootstrapOptions): Promise<void>;
33
+ /**
34
+ * @deprecated
35
+ */
17
36
  protected containerInitialize(options: IMidwayBootstrapOptions): Promise<void>;
37
+ /**
38
+ * @deprecated
39
+ */
18
40
  protected containerDirectoryLoad(options: IMidwayBootstrapOptions): Promise<void>;
41
+ /**
42
+ * @deprecated
43
+ */
19
44
  protected containerReady(options: IMidwayBootstrapOptions): Promise<void>;
20
- loadExtension(): Promise<void>;
21
- protected containerStop(): Promise<void>;
22
45
  getApplicationContext(): IMidwayContainer;
23
46
  getConfiguration(key?: string): any;
24
47
  getCurrentEnvironment(): string;
25
48
  getApplication(): APP;
26
49
  abstract applicationInitialize(options: IMidwayBootstrapOptions): any;
27
- abstract getFrameworkType(): MidwayFrameworkType;
50
+ abstract getFrameworkType(): FrameworkType;
28
51
  abstract run(): Promise<void>;
29
- protected setContextLoggerClass(BaseContextLogger: any): void;
52
+ setContextLoggerClass(BaseContextLogger: any): void;
30
53
  protected createContextLogger(ctx: CTX, name?: string): ILogger;
31
54
  stop(): Promise<void>;
32
55
  getAppDir(): string;
33
56
  getBaseDir(): string;
34
57
  protected defineApplicationProperties(applicationProperties?: {}, whiteList?: string[]): void;
35
58
  protected beforeStop(): Promise<void>;
59
+ /**
60
+ * @deprecated
61
+ */
36
62
  protected beforeContainerInitialize(options: Partial<IMidwayBootstrapOptions>): Promise<void>;
63
+ /**
64
+ * @deprecated
65
+ */
37
66
  protected afterContainerInitialize(options: Partial<IMidwayBootstrapOptions>): Promise<void>;
67
+ /**
68
+ * @deprecated
69
+ */
38
70
  protected afterContainerDirectoryLoad(options: Partial<IMidwayBootstrapOptions>): Promise<void>;
39
- protected afterContainerReady(options: Partial<IMidwayBootstrapOptions>): Promise<void>;
40
- loadLifeCycles(isForce?: boolean): Promise<void>;
41
- protected stopLifeCycles(): Promise<void>;
42
71
  /**
43
- * load preload module for container
44
- * @private
72
+ * @deprecated
45
73
  */
46
- protected loadPreloadModule(): Promise<void>;
74
+ protected afterContainerReady(options: Partial<IMidwayBootstrapOptions>): Promise<void>;
75
+ getMiddleware<R, N>(lastMiddleware?: CommonMiddleware<CTX, R, N>): Promise<MiddlewareRespond<CTX, R, N>>;
47
76
  getLogger(name?: string): ILogger;
48
77
  getCoreLogger(): ILogger;
49
78
  createLogger(name: string, option?: LoggerOptions): ILogger;
50
- getProjectName(): any;
79
+ getProjectName(): string;
51
80
  getFrameworkName(): string;
52
81
  getDefaultContextLoggerClass(): any;
82
+ useMiddleware(Middleware: CommonMiddlewareUnion<CTX, ResOrNext, Next>): void;
83
+ useFilter(Filter: CommonFilterUnion<CTX, ResOrNext, Next>): void;
84
+ protected createMiddlewareManager(): ContextMiddlewareManager<CTX, ResOrNext, Next>;
85
+ protected createFilterManager(): FilterManager<CTX, ResOrNext, Next>;
53
86
  }
54
87
  //# sourceMappingURL=baseFramework.d.ts.map