@midwayjs/core 3.0.0-alpha.43 → 3.0.0-beta.10

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 (99) hide show
  1. package/CHANGELOG.md +129 -0
  2. package/README.md +1 -1
  3. package/dist/baseFramework.d.ts +56 -22
  4. package/dist/baseFramework.js +156 -204
  5. package/dist/common/applicationManager.d.ts +12 -0
  6. package/dist/common/applicationManager.js +66 -0
  7. package/dist/{util → common}/fileDetector.d.ts +0 -0
  8. package/dist/{util → common}/fileDetector.js +14 -8
  9. package/dist/common/filterManager.d.ts +19 -0
  10. package/dist/common/filterManager.js +85 -0
  11. package/dist/common/middlewareManager.d.ts +68 -0
  12. package/dist/common/middlewareManager.js +183 -0
  13. package/dist/common/serviceFactory.d.ts +15 -0
  14. package/dist/{util → common}/serviceFactory.js +7 -5
  15. package/dist/{util → common}/triggerCollector.d.ts +0 -0
  16. package/dist/{util → common}/triggerCollector.js +0 -0
  17. package/dist/common/webGenerator.d.ts +16 -0
  18. package/dist/common/webGenerator.js +114 -0
  19. package/dist/{util → common}/webRouterCollector.d.ts +9 -4
  20. package/dist/{util → common}/webRouterCollector.js +56 -29
  21. package/dist/config/config.default.d.ts +7 -0
  22. package/dist/config/config.default.js +28 -0
  23. package/dist/context/container.d.ts +46 -40
  24. package/dist/context/container.js +125 -104
  25. package/dist/context/managedResolverFactory.d.ts +3 -16
  26. package/dist/context/managedResolverFactory.js +77 -77
  27. package/dist/context/requestContainer.d.ts +0 -2
  28. package/dist/context/requestContainer.js +4 -18
  29. package/dist/definitions/functionDefinition.d.ts +3 -2
  30. package/dist/definitions/objectDefinition.d.ts +3 -2
  31. package/dist/definitions/properties.d.ts +2 -13
  32. package/dist/definitions/properties.js +3 -56
  33. package/dist/error/base.d.ts +13 -0
  34. package/dist/error/base.js +19 -0
  35. package/dist/error/code.d.ts +60 -0
  36. package/dist/error/code.js +65 -0
  37. package/dist/error/framework.d.ts +24 -0
  38. package/dist/error/framework.js +58 -0
  39. package/dist/error/http.d.ts +58 -0
  40. package/dist/error/http.js +82 -0
  41. package/dist/error/index.d.ts +4 -0
  42. package/dist/error/index.js +16 -0
  43. package/dist/functional/configuration.d.ts +3 -3
  44. package/dist/functional/configuration.js +3 -3
  45. package/dist/index.d.ts +24 -11
  46. package/dist/index.js +36 -14
  47. package/dist/interface.d.ts +252 -157
  48. package/dist/interface.js +9 -1
  49. package/dist/service/aspectService.d.ts +11 -14
  50. package/dist/service/aspectService.js +114 -170
  51. package/dist/service/configService.d.ts +10 -8
  52. package/dist/service/configService.js +56 -33
  53. package/dist/service/decoratorService.d.ts +23 -0
  54. package/dist/service/decoratorService.js +149 -0
  55. package/dist/service/environmentService.js +13 -2
  56. package/dist/service/frameworkService.d.ts +26 -0
  57. package/dist/service/frameworkService.js +176 -0
  58. package/dist/service/informationService.d.ts +4 -7
  59. package/dist/service/informationService.js +39 -8
  60. package/dist/service/lifeCycleService.d.ts +14 -0
  61. package/dist/service/lifeCycleService.js +130 -0
  62. package/dist/service/loggerService.d.ts +27 -0
  63. package/dist/service/loggerService.js +132 -0
  64. package/dist/service/middlewareService.d.ts +11 -0
  65. package/dist/service/middlewareService.js +127 -0
  66. package/dist/{features/pipeline.d.ts → service/pipelineService.d.ts} +56 -46
  67. package/dist/{features/pipeline.js → service/pipelineService.js} +54 -19
  68. package/dist/setup.d.ts +4 -0
  69. package/dist/setup.js +119 -0
  70. package/dist/util/contextUtil.d.ts +1 -1
  71. package/dist/util/contextUtil.js +1 -1
  72. package/dist/util/index.d.ts +64 -0
  73. package/dist/util/index.js +192 -4
  74. package/dist/util/pathToRegexp.d.ts +17 -0
  75. package/dist/util/pathToRegexp.js +280 -0
  76. package/dist/util/webRouterParam.d.ts +2 -2
  77. package/dist/util/webRouterParam.js +19 -20
  78. package/package.json +9 -15
  79. package/dist/common/lodashWrap.d.ts +0 -9
  80. package/dist/common/lodashWrap.js +0 -18
  81. package/dist/common/notFoundError.d.ts +0 -8
  82. package/dist/common/notFoundError.js +0 -20
  83. package/dist/common/reflectTool.d.ts +0 -17
  84. package/dist/common/reflectTool.js +0 -83
  85. package/dist/context/resolverHandler.d.ts +0 -34
  86. package/dist/context/resolverHandler.js +0 -88
  87. package/dist/definitions/messageSource.d.ts +0 -13
  88. package/dist/definitions/messageSource.js +0 -74
  89. package/dist/definitions/resource.d.ts +0 -27
  90. package/dist/definitions/resource.js +0 -116
  91. package/dist/features/index.d.ts +0 -2
  92. package/dist/features/index.js +0 -3
  93. package/dist/logger.d.ts +0 -4
  94. package/dist/logger.js +0 -20
  95. package/dist/util/containerUtil.d.ts +0 -11
  96. package/dist/util/containerUtil.js +0 -26
  97. package/dist/util/emptyFramework.d.ts +0 -62
  98. package/dist/util/emptyFramework.js +0 -72
  99. package/dist/util/serviceFactory.d.ts +0 -15
package/CHANGELOG.md CHANGED
@@ -3,6 +3,135 @@
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.10](https://github.com/midwayjs/midway/compare/v3.0.0-beta.9...v3.0.0-beta.10) (2021-12-20)
7
+
8
+
9
+ ### Features
10
+
11
+ * default add session & bodyparser support for koa/express/faas ([#1420](https://github.com/midwayjs/midway/issues/1420)) ([cdaff31](https://github.com/midwayjs/midway/commit/cdaff317c3e862a95494a167995a28280af639bf))
12
+ * implement i18n for validate ([#1426](https://github.com/midwayjs/midway/issues/1426)) ([4c7ed2f](https://github.com/midwayjs/midway/commit/4c7ed2ff2e7ccf10f88f62abad230f92f5e76b97))
13
+
14
+
15
+
16
+
17
+
18
+ # [3.0.0-beta.9](https://github.com/midwayjs/midway/compare/v3.0.0-beta.8...v3.0.0-beta.9) (2021-12-09)
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * faas missing config in framework ([#1413](https://github.com/midwayjs/midway/issues/1413)) ([7ab16a2](https://github.com/midwayjs/midway/commit/7ab16a24b29d5254a762bfffcdf18385effdf639))
24
+
25
+
26
+
27
+
28
+
29
+ # [3.0.0-beta.8](https://github.com/midwayjs/midway/compare/v3.0.0-beta.7...v3.0.0-beta.8) (2021-12-08)
30
+
31
+
32
+ ### Bug Fixes
33
+
34
+ * express routing middleware takes effect at the controller level ([#1364](https://github.com/midwayjs/midway/issues/1364)) ([b9272e0](https://github.com/midwayjs/midway/commit/b9272e0971003443304b0c53815be31a0061b4bd))
35
+
36
+
37
+
38
+
39
+
40
+ # [3.0.0-beta.7](https://github.com/midwayjs/midway/compare/v3.0.0-beta.6...v3.0.0-beta.7) (2021-12-03)
41
+
42
+
43
+ ### Bug Fixes
44
+
45
+ * add app.keys ([#1395](https://github.com/midwayjs/midway/issues/1395)) ([c44afc6](https://github.com/midwayjs/midway/commit/c44afc6cc6764a959d1fa7ae04d60099282d156a))
46
+ * middleware with ctx.body ([#1389](https://github.com/midwayjs/midway/issues/1389)) ([77af5c0](https://github.com/midwayjs/midway/commit/77af5c0b456f1843f4dcfd3dbfd2c0aa244c51bd))
47
+
48
+
49
+
50
+
51
+
52
+ # [3.0.0-beta.6](https://github.com/midwayjs/midway/compare/v3.0.0-beta.5...v3.0.0-beta.6) (2021-11-26)
53
+
54
+
55
+ ### Bug Fixes
56
+
57
+ * class transformer method missing ([#1387](https://github.com/midwayjs/midway/issues/1387)) ([074e839](https://github.com/midwayjs/midway/commit/074e8393598dc95e2742f735df75a2191c5fe25d))
58
+
59
+
60
+
61
+
62
+
63
+ # [3.0.0-beta.5](https://github.com/midwayjs/midway/compare/v3.0.0-beta.4...v3.0.0-beta.5) (2021-11-25)
64
+
65
+
66
+ ### Bug Fixes
67
+
68
+ * [@match](https://github.com/match) empty args ([#1384](https://github.com/midwayjs/midway/issues/1384)) ([6f90fc9](https://github.com/midwayjs/midway/commit/6f90fc993ff01e078288ff664833c61c02dede51))
69
+ * router sort ([#1383](https://github.com/midwayjs/midway/issues/1383)) ([f253887](https://github.com/midwayjs/midway/commit/f2538876d3eaf7dec55173d86b5b9caeeeb7be64))
70
+
71
+
72
+
73
+
74
+
75
+ # [3.0.0-beta.4](https://github.com/midwayjs/midway/compare/v3.0.0-beta.3...v3.0.0-beta.4) (2021-11-24)
76
+
77
+
78
+ ### Bug Fixes
79
+
80
+ * logger close before bootstrap close ([#1370](https://github.com/midwayjs/midway/issues/1370)) ([6cc2720](https://github.com/midwayjs/midway/commit/6cc2720ed3445e8ffccc96d124b80ed7e2517f08))
81
+
82
+
83
+ ### Features
84
+
85
+ * add i18n ([#1375](https://github.com/midwayjs/midway/issues/1375)) ([bffefe0](https://github.com/midwayjs/midway/commit/bffefe07afe45777d49b5a76b9ab17fc2b9d9a55))
86
+ * auto transform args to type ([#1372](https://github.com/midwayjs/midway/issues/1372)) ([bb3f7d2](https://github.com/midwayjs/midway/commit/bb3f7d2028a034e1926d9df554849332354c3762))
87
+ * support global prefix url ([#1371](https://github.com/midwayjs/midway/issues/1371)) ([cc5fe44](https://github.com/midwayjs/midway/commit/cc5fe44e1d221590562dc71e1f33ae96093e0da7))
88
+
89
+
90
+
91
+
92
+
93
+ # [3.0.0-beta.3](https://github.com/midwayjs/midway/compare/v3.0.0-beta.2...v3.0.0-beta.3) (2021-11-18)
94
+
95
+
96
+ ### Features
97
+
98
+ * add component and framework config definition ([#1367](https://github.com/midwayjs/midway/issues/1367)) ([b2fe615](https://github.com/midwayjs/midway/commit/b2fe6157f99659471ff1333eca0b86bb889f61a3))
99
+
100
+
101
+
102
+
103
+
104
+ # [3.0.0-beta.2](https://github.com/midwayjs/midway/compare/v3.0.0-beta.1...v3.0.0-beta.2) (2021-11-16)
105
+
106
+ **Note:** Version bump only for package @midwayjs/core
107
+
108
+
109
+
110
+
111
+
112
+ # [3.0.0-beta.1](https://github.com/midwayjs/midway/compare/v2.12.4...v3.0.0-beta.1) (2021-11-14)
113
+
114
+
115
+ ### Bug Fixes
116
+
117
+ * circular inject for provide uuid ([#1285](https://github.com/midwayjs/midway/issues/1285)) ([34533bf](https://github.com/midwayjs/midway/commit/34533bfe9bf1c4acdffb1360ab24c716b5196de8))
118
+ * component env filter ([#1234](https://github.com/midwayjs/midway/issues/1234)) ([1ad365f](https://github.com/midwayjs/midway/commit/1ad365fd8ef5e0e7dae3d08a2427a2300038290a))
119
+ * correct aspect chain bug ([#1204](https://github.com/midwayjs/midway/issues/1204)) ([5de5284](https://github.com/midwayjs/midway/commit/5de5284c70b44acc73eaaad651fd2edc72d54f28))
120
+ * empty options in default ([#1241](https://github.com/midwayjs/midway/issues/1241)) ([802109d](https://github.com/midwayjs/midway/commit/802109ddd098afb04d6d540bff509e0aee85b806))
121
+ * functional configuration load async code ([#1300](https://github.com/midwayjs/midway/issues/1300)) ([32bcf03](https://github.com/midwayjs/midway/commit/32bcf030ed1ab04482dc557f8b0c6904e47b31e1))
122
+ * load component with enabledEnvironment ([#1329](https://github.com/midwayjs/midway/issues/1329)) ([3182271](https://github.com/midwayjs/midway/commit/3182271a1eab931e2bf872bff6e2725ebb906ad0))
123
+ * static prefix ([#1321](https://github.com/midwayjs/midway/issues/1321)) ([31fe961](https://github.com/midwayjs/midway/commit/31fe961931fed7656a144b1682ee4c4bb25fdff5))
124
+
125
+
126
+ ### Features
127
+
128
+ * 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))
129
+ * add redis component ([#1270](https://github.com/midwayjs/midway/issues/1270)) ([09c993a](https://github.com/midwayjs/midway/commit/09c993ac308d26fa9c742a659471c3f4cf5c5782))
130
+
131
+
132
+
133
+
134
+
6
135
  ## [2.12.3](https://github.com/midwayjs/midway/compare/v2.12.2...v2.12.3) (2021-08-09)
7
136
 
8
137
 
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  this is a sub package for midway.
7
7
 
8
- Document: [https://midwayjs.org/midway](https://midwayjs.org/midway)
8
+ Document: [https://midwayjs.org](https://midwayjs.org)
9
9
 
10
10
  ## License
11
11
 
@@ -1,54 +1,88 @@
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
+ applyMiddleware<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
+ getMiddleware(): ContextMiddlewareManager<CTX, ResOrNext, Next>;
84
+ useFilter(Filter: CommonFilterUnion<CTX, ResOrNext, Next>): void;
85
+ protected createMiddlewareManager(): ContextMiddlewareManager<CTX, ResOrNext, Next>;
86
+ protected createFilterManager(): FilterManager<CTX, ResOrNext, Next>;
53
87
  }
54
88
  //# sourceMappingURL=baseFramework.d.ts.map