@midwayjs/core 3.0.0-beta.13 → 3.0.0-beta.14
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.
- package/CHANGELOG.md +11 -0
- package/dist/context/requestContainer.js +2 -0
- package/dist/interface.d.ts +18 -2
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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.14](https://github.com/midwayjs/midway/compare/v3.0.0-beta.13...v3.0.0-beta.14) (2022-01-04)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* cos config definition & 3.x doc update ([#1515](https://github.com/midwayjs/midway/issues/1515)) ([0ac7ac5](https://github.com/midwayjs/midway/commit/0ac7ac5805b7ab8873f8792fc1712a74e3223172))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [3.0.0-beta.13](https://github.com/midwayjs/midway/compare/v3.0.0-beta.12...v3.0.0-beta.13) (2021-12-30)
|
|
7
18
|
|
|
8
19
|
|
|
@@ -13,6 +13,8 @@ class MidwayRequestContainer extends container_1.MidwayContainer {
|
|
|
13
13
|
this.ctx = ctx;
|
|
14
14
|
// register ctx
|
|
15
15
|
this.registerObject(interface_1.REQUEST_CTX_KEY, ctx);
|
|
16
|
+
// register res
|
|
17
|
+
this.registerObject('res', {});
|
|
16
18
|
if (ctx.logger) {
|
|
17
19
|
// register contextLogger
|
|
18
20
|
this.registerObject('logger', ctx.logger);
|
package/dist/interface.d.ts
CHANGED
|
@@ -14,9 +14,19 @@ export declare type ServiceFactoryConfigOption<OPTIONS> = {
|
|
|
14
14
|
[key: string]: PowerPartial<OPTIONS>;
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
|
-
declare type ConfigType<T> = T extends (...args: any[]) => any ? PowerPartial<ReturnType<T
|
|
17
|
+
declare type ConfigType<T> = T extends (...args: any[]) => any ? Writable<PowerPartial<ReturnType<T>>> : Writable<PowerPartial<T>>;
|
|
18
|
+
/**
|
|
19
|
+
* Get definition from config
|
|
20
|
+
*/
|
|
18
21
|
export declare type FileConfigOption<T, K = unknown> = K extends keyof ConfigType<T> ? Pick<ConfigType<T>, K> : ConfigType<T>;
|
|
19
22
|
/**
|
|
23
|
+
* Make object property writeable
|
|
24
|
+
*/
|
|
25
|
+
export declare type Writable<T> = {
|
|
26
|
+
-readonly [P in keyof T]: T[P];
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Lifecycle Definition
|
|
20
30
|
* 生命周期定义
|
|
21
31
|
*/
|
|
22
32
|
export interface ILifeCycle extends Partial<IObjectLifeCycle> {
|
|
@@ -29,8 +39,8 @@ export declare type ObjectContext = {
|
|
|
29
39
|
originName?: string;
|
|
30
40
|
};
|
|
31
41
|
/**
|
|
42
|
+
* Abstract Object Factory
|
|
32
43
|
* 对象容器抽象
|
|
33
|
-
* 默认用Xml容器实现一个
|
|
34
44
|
*/
|
|
35
45
|
export interface IObjectFactory {
|
|
36
46
|
registry: IObjectDefinitionRegistry;
|
|
@@ -46,6 +56,10 @@ export declare enum ObjectLifeCycleEvent {
|
|
|
46
56
|
AFTER_INIT = "afterObjectInit",
|
|
47
57
|
BEFORE_DESTROY = "beforeObjectDestroy"
|
|
48
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Object Lifecycle
|
|
61
|
+
* 对象生命周期
|
|
62
|
+
*/
|
|
49
63
|
export interface IObjectLifeCycle {
|
|
50
64
|
onBeforeBind(fn: (Clzz: any, options: {
|
|
51
65
|
context: IMidwayContainer;
|
|
@@ -72,6 +86,7 @@ export interface IObjectLifeCycle {
|
|
|
72
86
|
}) => void): any;
|
|
73
87
|
}
|
|
74
88
|
/**
|
|
89
|
+
* Object Definition
|
|
75
90
|
* 对象描述定义
|
|
76
91
|
*/
|
|
77
92
|
export interface IObjectDefinition {
|
|
@@ -123,6 +138,7 @@ export interface IObjectCreator {
|
|
|
123
138
|
doDestroyAsync(obj: any): Promise<void>;
|
|
124
139
|
}
|
|
125
140
|
/**
|
|
141
|
+
* Object Definition Registry
|
|
126
142
|
* 对象定义存储容器
|
|
127
143
|
*/
|
|
128
144
|
export interface IObjectDefinitionRegistry {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/core",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.14",
|
|
4
4
|
"description": "midway core",
|
|
5
5
|
"main": "dist/index",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -21,18 +21,18 @@
|
|
|
21
21
|
],
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@midwayjs/decorator": "^3.0.0-beta.
|
|
25
|
-
"koa": "
|
|
24
|
+
"@midwayjs/decorator": "^3.0.0-beta.14",
|
|
25
|
+
"koa": "2.13.4",
|
|
26
26
|
"midway-test-component": "*",
|
|
27
|
-
"mm": "3",
|
|
28
|
-
"sinon": "
|
|
27
|
+
"mm": "3.2.0",
|
|
28
|
+
"sinon": "12.0.1"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@midwayjs/decorator": "*"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@midwayjs/glob": "^1.0.2",
|
|
35
|
-
"@midwayjs/logger": "
|
|
35
|
+
"@midwayjs/logger": "2.14.0",
|
|
36
36
|
"class-transformer": "^0.5.1",
|
|
37
37
|
"extend2": "^1.0.0",
|
|
38
38
|
"picomatch": "^2.3.0"
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"engines": {
|
|
46
46
|
"node": ">=12"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "95695ada36190cf376e93a1a8866b3fb6dde06bc"
|
|
49
49
|
}
|