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

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 (111) hide show
  1. package/CHANGELOG.md +149 -0
  2. package/README.md +1 -1
  3. package/dist/baseFramework.d.ts +56 -22
  4. package/dist/baseFramework.js +157 -232
  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 +16 -10
  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 +16 -6
  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 +117 -0
  19. package/dist/{util → common}/webRouterCollector.d.ts +21 -2
  20. package/dist/common/webRouterCollector.js +331 -0
  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 +73 -43
  24. package/dist/context/container.js +289 -271
  25. package/dist/context/definitionRegistry.d.ts +26 -0
  26. package/dist/context/definitionRegistry.js +124 -0
  27. package/dist/context/managedResolverFactory.d.ts +15 -32
  28. package/dist/context/managedResolverFactory.js +91 -320
  29. package/dist/context/providerWrapper.d.ts +2 -3
  30. package/dist/context/requestContainer.d.ts +0 -2
  31. package/dist/context/requestContainer.js +9 -26
  32. package/dist/definitions/functionDefinition.d.ts +3 -4
  33. package/dist/definitions/functionDefinition.js +0 -6
  34. package/dist/definitions/objectCreator.js +9 -8
  35. package/dist/definitions/objectDefinition.d.ts +4 -6
  36. package/dist/definitions/objectDefinition.js +0 -8
  37. package/dist/definitions/properties.d.ts +2 -15
  38. package/dist/definitions/properties.js +3 -72
  39. package/dist/error/base.d.ts +32 -0
  40. package/dist/error/base.js +48 -0
  41. package/dist/error/framework.d.ts +45 -0
  42. package/dist/error/framework.js +87 -0
  43. package/dist/error/http.d.ts +119 -0
  44. package/dist/error/http.js +169 -0
  45. package/dist/error/index.d.ts +4 -0
  46. package/dist/error/index.js +16 -0
  47. package/dist/functional/configuration.d.ts +4 -2
  48. package/dist/functional/configuration.js +12 -2
  49. package/dist/index.d.ts +24 -11
  50. package/dist/index.js +36 -36
  51. package/dist/interface.d.ts +270 -184
  52. package/dist/interface.js +9 -1
  53. package/dist/service/aspectService.d.ts +11 -14
  54. package/dist/service/aspectService.js +116 -172
  55. package/dist/service/configService.d.ts +10 -8
  56. package/dist/service/configService.js +61 -38
  57. package/dist/service/decoratorService.d.ts +23 -0
  58. package/dist/service/decoratorService.js +149 -0
  59. package/dist/service/environmentService.js +15 -4
  60. package/dist/service/frameworkService.d.ts +26 -0
  61. package/dist/service/frameworkService.js +176 -0
  62. package/dist/service/informationService.d.ts +4 -7
  63. package/dist/service/informationService.js +41 -10
  64. package/dist/service/lifeCycleService.d.ts +14 -0
  65. package/dist/service/lifeCycleService.js +130 -0
  66. package/dist/service/loggerService.d.ts +27 -0
  67. package/dist/service/loggerService.js +132 -0
  68. package/dist/service/middlewareService.d.ts +10 -0
  69. package/dist/service/middlewareService.js +123 -0
  70. package/dist/{features/pipeline.d.ts → service/pipelineService.d.ts} +56 -46
  71. package/dist/{features/pipeline.js → service/pipelineService.js} +54 -19
  72. package/dist/setup.d.ts +4 -0
  73. package/dist/setup.js +119 -0
  74. package/dist/util/contextUtil.d.ts +1 -1
  75. package/dist/util/contextUtil.js +2 -2
  76. package/dist/util/index.d.ts +64 -0
  77. package/dist/util/index.js +195 -7
  78. package/dist/util/pathFileUtil.js +2 -2
  79. package/dist/util/pathToRegexp.d.ts +17 -0
  80. package/dist/util/pathToRegexp.js +280 -0
  81. package/dist/util/webRouterParam.d.ts +2 -2
  82. package/dist/util/webRouterParam.js +43 -24
  83. package/package.json +10 -15
  84. package/dist/common/lodashWrap.d.ts +0 -9
  85. package/dist/common/lodashWrap.js +0 -18
  86. package/dist/common/notFoundError.d.ts +0 -8
  87. package/dist/common/notFoundError.js +0 -20
  88. package/dist/common/reflectTool.d.ts +0 -15
  89. package/dist/common/reflectTool.js +0 -83
  90. package/dist/context/applicationContext.d.ts +0 -81
  91. package/dist/context/applicationContext.js +0 -263
  92. package/dist/context/managed.d.ts +0 -45
  93. package/dist/context/managed.js +0 -69
  94. package/dist/context/resolverHandler.d.ts +0 -34
  95. package/dist/context/resolverHandler.js +0 -88
  96. package/dist/definitions/messageSource.d.ts +0 -13
  97. package/dist/definitions/messageSource.js +0 -74
  98. package/dist/definitions/resource.d.ts +0 -27
  99. package/dist/definitions/resource.js +0 -116
  100. package/dist/features/index.d.ts +0 -2
  101. package/dist/features/index.js +0 -3
  102. package/dist/logger.d.ts +0 -4
  103. package/dist/logger.js +0 -20
  104. package/dist/util/containerUtil.d.ts +0 -11
  105. package/dist/util/containerUtil.js +0 -26
  106. package/dist/util/emptyFramework.d.ts +0 -62
  107. package/dist/util/emptyFramework.js +0 -72
  108. package/dist/util/serviceFactory.d.ts +0 -13
  109. package/dist/util/staticConfig.d.ts +0 -10
  110. package/dist/util/staticConfig.js +0 -67
  111. package/dist/util/webRouterCollector.js +0 -348
package/CHANGELOG.md CHANGED
@@ -3,6 +3,155 @@
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.12](https://github.com/midwayjs/midway/compare/v3.0.0-beta.11...v3.0.0-beta.12) (2021-12-28)
7
+
8
+
9
+ ### Features
10
+
11
+ * custom error code & add @Files/@Fields ([#1438](https://github.com/midwayjs/midway/issues/1438)) ([b0032af](https://github.com/midwayjs/midway/commit/b0032afd2fa9ea0416fe69f4bd0c1a58bea5314e))
12
+ * support throw err status ([#1440](https://github.com/midwayjs/midway/issues/1440)) ([7b98110](https://github.com/midwayjs/midway/commit/7b98110d65c5287a8fcb3eb5356dea2d7a32cee9))
13
+
14
+
15
+
16
+
17
+
18
+ # [3.0.0-beta.11](https://github.com/midwayjs/midway/compare/v3.0.0-beta.10...v3.0.0-beta.11) (2021-12-21)
19
+
20
+ **Note:** Version bump only for package @midwayjs/core
21
+
22
+
23
+
24
+
25
+
26
+ # [3.0.0-beta.10](https://github.com/midwayjs/midway/compare/v3.0.0-beta.9...v3.0.0-beta.10) (2021-12-20)
27
+
28
+
29
+ ### Features
30
+
31
+ * 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))
32
+ * implement i18n for validate ([#1426](https://github.com/midwayjs/midway/issues/1426)) ([4c7ed2f](https://github.com/midwayjs/midway/commit/4c7ed2ff2e7ccf10f88f62abad230f92f5e76b97))
33
+
34
+
35
+
36
+
37
+
38
+ # [3.0.0-beta.9](https://github.com/midwayjs/midway/compare/v3.0.0-beta.8...v3.0.0-beta.9) (2021-12-09)
39
+
40
+
41
+ ### Bug Fixes
42
+
43
+ * faas missing config in framework ([#1413](https://github.com/midwayjs/midway/issues/1413)) ([7ab16a2](https://github.com/midwayjs/midway/commit/7ab16a24b29d5254a762bfffcdf18385effdf639))
44
+
45
+
46
+
47
+
48
+
49
+ # [3.0.0-beta.8](https://github.com/midwayjs/midway/compare/v3.0.0-beta.7...v3.0.0-beta.8) (2021-12-08)
50
+
51
+
52
+ ### Bug Fixes
53
+
54
+ * 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))
55
+
56
+
57
+
58
+
59
+
60
+ # [3.0.0-beta.7](https://github.com/midwayjs/midway/compare/v3.0.0-beta.6...v3.0.0-beta.7) (2021-12-03)
61
+
62
+
63
+ ### Bug Fixes
64
+
65
+ * add app.keys ([#1395](https://github.com/midwayjs/midway/issues/1395)) ([c44afc6](https://github.com/midwayjs/midway/commit/c44afc6cc6764a959d1fa7ae04d60099282d156a))
66
+ * middleware with ctx.body ([#1389](https://github.com/midwayjs/midway/issues/1389)) ([77af5c0](https://github.com/midwayjs/midway/commit/77af5c0b456f1843f4dcfd3dbfd2c0aa244c51bd))
67
+
68
+
69
+
70
+
71
+
72
+ # [3.0.0-beta.6](https://github.com/midwayjs/midway/compare/v3.0.0-beta.5...v3.0.0-beta.6) (2021-11-26)
73
+
74
+
75
+ ### Bug Fixes
76
+
77
+ * class transformer method missing ([#1387](https://github.com/midwayjs/midway/issues/1387)) ([074e839](https://github.com/midwayjs/midway/commit/074e8393598dc95e2742f735df75a2191c5fe25d))
78
+
79
+
80
+
81
+
82
+
83
+ # [3.0.0-beta.5](https://github.com/midwayjs/midway/compare/v3.0.0-beta.4...v3.0.0-beta.5) (2021-11-25)
84
+
85
+
86
+ ### Bug Fixes
87
+
88
+ * [@match](https://github.com/match) empty args ([#1384](https://github.com/midwayjs/midway/issues/1384)) ([6f90fc9](https://github.com/midwayjs/midway/commit/6f90fc993ff01e078288ff664833c61c02dede51))
89
+ * router sort ([#1383](https://github.com/midwayjs/midway/issues/1383)) ([f253887](https://github.com/midwayjs/midway/commit/f2538876d3eaf7dec55173d86b5b9caeeeb7be64))
90
+
91
+
92
+
93
+
94
+
95
+ # [3.0.0-beta.4](https://github.com/midwayjs/midway/compare/v3.0.0-beta.3...v3.0.0-beta.4) (2021-11-24)
96
+
97
+
98
+ ### Bug Fixes
99
+
100
+ * logger close before bootstrap close ([#1370](https://github.com/midwayjs/midway/issues/1370)) ([6cc2720](https://github.com/midwayjs/midway/commit/6cc2720ed3445e8ffccc96d124b80ed7e2517f08))
101
+
102
+
103
+ ### Features
104
+
105
+ * add i18n ([#1375](https://github.com/midwayjs/midway/issues/1375)) ([bffefe0](https://github.com/midwayjs/midway/commit/bffefe07afe45777d49b5a76b9ab17fc2b9d9a55))
106
+ * auto transform args to type ([#1372](https://github.com/midwayjs/midway/issues/1372)) ([bb3f7d2](https://github.com/midwayjs/midway/commit/bb3f7d2028a034e1926d9df554849332354c3762))
107
+ * support global prefix url ([#1371](https://github.com/midwayjs/midway/issues/1371)) ([cc5fe44](https://github.com/midwayjs/midway/commit/cc5fe44e1d221590562dc71e1f33ae96093e0da7))
108
+
109
+
110
+
111
+
112
+
113
+ # [3.0.0-beta.3](https://github.com/midwayjs/midway/compare/v3.0.0-beta.2...v3.0.0-beta.3) (2021-11-18)
114
+
115
+
116
+ ### Features
117
+
118
+ * add component and framework config definition ([#1367](https://github.com/midwayjs/midway/issues/1367)) ([b2fe615](https://github.com/midwayjs/midway/commit/b2fe6157f99659471ff1333eca0b86bb889f61a3))
119
+
120
+
121
+
122
+
123
+
124
+ # [3.0.0-beta.2](https://github.com/midwayjs/midway/compare/v3.0.0-beta.1...v3.0.0-beta.2) (2021-11-16)
125
+
126
+ **Note:** Version bump only for package @midwayjs/core
127
+
128
+
129
+
130
+
131
+
132
+ # [3.0.0-beta.1](https://github.com/midwayjs/midway/compare/v2.12.4...v3.0.0-beta.1) (2021-11-14)
133
+
134
+
135
+ ### Bug Fixes
136
+
137
+ * circular inject for provide uuid ([#1285](https://github.com/midwayjs/midway/issues/1285)) ([34533bf](https://github.com/midwayjs/midway/commit/34533bfe9bf1c4acdffb1360ab24c716b5196de8))
138
+ * component env filter ([#1234](https://github.com/midwayjs/midway/issues/1234)) ([1ad365f](https://github.com/midwayjs/midway/commit/1ad365fd8ef5e0e7dae3d08a2427a2300038290a))
139
+ * correct aspect chain bug ([#1204](https://github.com/midwayjs/midway/issues/1204)) ([5de5284](https://github.com/midwayjs/midway/commit/5de5284c70b44acc73eaaad651fd2edc72d54f28))
140
+ * empty options in default ([#1241](https://github.com/midwayjs/midway/issues/1241)) ([802109d](https://github.com/midwayjs/midway/commit/802109ddd098afb04d6d540bff509e0aee85b806))
141
+ * functional configuration load async code ([#1300](https://github.com/midwayjs/midway/issues/1300)) ([32bcf03](https://github.com/midwayjs/midway/commit/32bcf030ed1ab04482dc557f8b0c6904e47b31e1))
142
+ * load component with enabledEnvironment ([#1329](https://github.com/midwayjs/midway/issues/1329)) ([3182271](https://github.com/midwayjs/midway/commit/3182271a1eab931e2bf872bff6e2725ebb906ad0))
143
+ * static prefix ([#1321](https://github.com/midwayjs/midway/issues/1321)) ([31fe961](https://github.com/midwayjs/midway/commit/31fe961931fed7656a144b1682ee4c4bb25fdff5))
144
+
145
+
146
+ ### Features
147
+
148
+ * 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))
149
+ * add redis component ([#1270](https://github.com/midwayjs/midway/issues/1270)) ([09c993a](https://github.com/midwayjs/midway/commit/09c993ac308d26fa9c742a659471c3f4cf5c5782))
150
+
151
+
152
+
153
+
154
+
6
155
  ## [2.12.3](https://github.com/midwayjs/midway/compare/v2.12.2...v2.12.3) (2021-08-09)
7
156
 
8
157
 
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