@midwayjs/core 3.0.0-alpha.28 → 3.0.0-alpha.41
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/dist/baseFramework.js +4 -33
- package/dist/common/reflectTool.d.ts +3 -1
- package/dist/context/container.d.ts +45 -23
- package/dist/context/container.js +199 -202
- package/dist/context/definitionRegistry.d.ts +26 -0
- package/dist/context/definitionRegistry.js +124 -0
- package/dist/context/managedResolverFactory.d.ts +15 -19
- package/dist/context/managedResolverFactory.js +27 -256
- package/dist/context/providerWrapper.d.ts +2 -3
- package/dist/context/requestContainer.js +7 -10
- package/dist/context/resolverHandler.d.ts +2 -2
- package/dist/context/resolverHandler.js +1 -1
- package/dist/definitions/functionDefinition.d.ts +0 -2
- package/dist/definitions/functionDefinition.js +0 -6
- package/dist/definitions/objectDefinition.d.ts +1 -4
- package/dist/definitions/objectDefinition.js +0 -8
- package/dist/definitions/properties.d.ts +0 -2
- package/dist/definitions/properties.js +5 -21
- package/dist/features/pipeline.d.ts +3 -3
- package/dist/functional/configuration.d.ts +2 -0
- package/dist/functional/configuration.js +10 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -23
- package/dist/interface.d.ts +21 -32
- package/dist/util/containerUtil.js +1 -1
- package/dist/util/webRouterCollector.d.ts +8 -0
- package/dist/util/webRouterCollector.js +63 -119
- package/package.json +5 -4
- package/dist/context/applicationContext.d.ts +0 -81
- package/dist/context/applicationContext.js +0 -263
- package/dist/context/managed.d.ts +0 -45
- package/dist/context/managed.js +0 -69
- package/dist/util/staticConfig.d.ts +0 -10
- package/dist/util/staticConfig.js +0 -67
|
@@ -28,9 +28,6 @@ class FunctionDefinition {
|
|
|
28
28
|
this.innerScope = decorator_1.ScopeEnum.Singleton;
|
|
29
29
|
this.creator = new FunctionWrapperCreator(this);
|
|
30
30
|
}
|
|
31
|
-
set autowire(autowire) {
|
|
32
|
-
this.innerAutowire = autowire;
|
|
33
|
-
}
|
|
34
31
|
getAttr(key) { }
|
|
35
32
|
hasAttr(key) {
|
|
36
33
|
return false;
|
|
@@ -44,9 +41,6 @@ class FunctionDefinition {
|
|
|
44
41
|
isAsync() {
|
|
45
42
|
return this.asynchronous;
|
|
46
43
|
}
|
|
47
|
-
isAutowire() {
|
|
48
|
-
return this.innerAutowire;
|
|
49
|
-
}
|
|
50
44
|
isDirect() {
|
|
51
45
|
return false;
|
|
52
46
|
}
|
|
@@ -2,9 +2,8 @@ import { IObjectCreator, IObjectDefinition, HandlerProp } from '../interface';
|
|
|
2
2
|
import { ScopeEnum, ObjectIdentifier } from '@midwayjs/decorator';
|
|
3
3
|
import { ObjectProperties } from './properties';
|
|
4
4
|
export declare class ObjectDefinition implements IObjectDefinition {
|
|
5
|
-
protected _attrs: Map<
|
|
5
|
+
protected _attrs: Map<ObjectIdentifier, any>;
|
|
6
6
|
protected _asynchronous: boolean;
|
|
7
|
-
protected _autowire: boolean;
|
|
8
7
|
scope: ScopeEnum;
|
|
9
8
|
creator: IObjectCreator;
|
|
10
9
|
id: string;
|
|
@@ -21,8 +20,6 @@ export declare class ObjectDefinition implements IObjectDefinition {
|
|
|
21
20
|
namespace: string;
|
|
22
21
|
handlerProps: HandlerProp[];
|
|
23
22
|
constructor();
|
|
24
|
-
set autowire(autowire: boolean);
|
|
25
|
-
isAutowire(): boolean;
|
|
26
23
|
set asynchronous(asynchronous: boolean);
|
|
27
24
|
isAsync(): boolean;
|
|
28
25
|
isSingletonScope(): boolean;
|
|
@@ -9,8 +9,6 @@ class ObjectDefinition {
|
|
|
9
9
|
constructor() {
|
|
10
10
|
this._attrs = new Map();
|
|
11
11
|
this._asynchronous = false;
|
|
12
|
-
// 对象定义默认需要自动装配
|
|
13
|
-
this._autowire = true;
|
|
14
12
|
this.scope = decorator_1.ScopeEnum.Singleton;
|
|
15
13
|
this.creator = null;
|
|
16
14
|
this.id = null;
|
|
@@ -27,12 +25,6 @@ class ObjectDefinition {
|
|
|
27
25
|
this.handlerProps = [];
|
|
28
26
|
this.creator = new objectCreator_1.ObjectCreator(this);
|
|
29
27
|
}
|
|
30
|
-
set autowire(autowire) {
|
|
31
|
-
this._autowire = autowire;
|
|
32
|
-
}
|
|
33
|
-
isAutowire() {
|
|
34
|
-
return this._autowire;
|
|
35
|
-
}
|
|
36
28
|
set asynchronous(asynchronous) {
|
|
37
29
|
this._asynchronous = asynchronous;
|
|
38
30
|
}
|
|
@@ -9,13 +9,11 @@ export declare class ObjectProperties implements IProperties {
|
|
|
9
9
|
has(key: ObjectIdentifier): boolean;
|
|
10
10
|
set(key: ObjectIdentifier, value: any): any;
|
|
11
11
|
putAll(props: IProperties): void;
|
|
12
|
-
putObject(props: Record<string, unknown>, needClone?: boolean): void;
|
|
13
12
|
stringPropertyNames(): ObjectIdentifier[];
|
|
14
13
|
getProperty(key: ObjectIdentifier, defaultValue?: any): any;
|
|
15
14
|
addProperty(key: ObjectIdentifier, value: any): void;
|
|
16
15
|
setProperty(key: ObjectIdentifier, value: any): any;
|
|
17
16
|
clear(): void;
|
|
18
17
|
toJSON(): Record<string, unknown>;
|
|
19
|
-
clone(): IProperties;
|
|
20
18
|
}
|
|
21
19
|
//# sourceMappingURL=properties.d.ts.map
|
|
@@ -5,7 +5,7 @@ const _ = require("../common/lodashWrap");
|
|
|
5
5
|
const util_1 = require("util");
|
|
6
6
|
class ObjectProperties {
|
|
7
7
|
constructor() {
|
|
8
|
-
this.innerConfig =
|
|
8
|
+
this.innerConfig = new Map();
|
|
9
9
|
}
|
|
10
10
|
get size() {
|
|
11
11
|
return this.keys().length;
|
|
@@ -28,7 +28,7 @@ class ObjectProperties {
|
|
|
28
28
|
return JSON.parse(JSON.stringify(_.get(this.innerConfig, key)));
|
|
29
29
|
}
|
|
30
30
|
has(key) {
|
|
31
|
-
return this.innerConfig
|
|
31
|
+
return this.innerConfig.get(key) !== undefined;
|
|
32
32
|
}
|
|
33
33
|
set(key, value) {
|
|
34
34
|
const origin = this.get(key);
|
|
@@ -38,25 +38,14 @@ class ObjectProperties {
|
|
|
38
38
|
putAll(props) {
|
|
39
39
|
const keys = props.keys();
|
|
40
40
|
for (const key of keys) {
|
|
41
|
-
if (typeof this.innerConfig
|
|
42
|
-
this.set(key, _.defaultsDeep(props.get(key), this.innerConfig
|
|
41
|
+
if (typeof this.innerConfig.get(key) === 'object') {
|
|
42
|
+
this.set(key, _.defaultsDeep(props.get(key), this.innerConfig.get(key)));
|
|
43
43
|
}
|
|
44
44
|
else {
|
|
45
45
|
this.set(key, props.get(key));
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
putObject(props, needClone = false) {
|
|
50
|
-
if (needClone) {
|
|
51
|
-
const tmp = _.cloneDeep(props);
|
|
52
|
-
_.defaultsDeep(tmp, this.innerConfig);
|
|
53
|
-
this.innerConfig = tmp;
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
_.defaultsDeep(props, this.innerConfig);
|
|
57
|
-
this.innerConfig = props;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
49
|
stringPropertyNames() {
|
|
61
50
|
return this.keys();
|
|
62
51
|
}
|
|
@@ -73,16 +62,11 @@ class ObjectProperties {
|
|
|
73
62
|
return this.set(key, value);
|
|
74
63
|
}
|
|
75
64
|
clear() {
|
|
76
|
-
this.innerConfig
|
|
65
|
+
this.innerConfig.clear();
|
|
77
66
|
}
|
|
78
67
|
toJSON() {
|
|
79
68
|
return JSON.parse(JSON.stringify(this.innerConfig));
|
|
80
69
|
}
|
|
81
|
-
clone() {
|
|
82
|
-
const cfg = new ObjectProperties();
|
|
83
|
-
cfg.putObject(this.toJSON());
|
|
84
|
-
return cfg;
|
|
85
|
-
}
|
|
86
70
|
}
|
|
87
71
|
exports.ObjectProperties = ObjectProperties;
|
|
88
72
|
//# sourceMappingURL=properties.js.map
|
|
@@ -127,7 +127,7 @@ export interface IPipelineHandler {
|
|
|
127
127
|
*/
|
|
128
128
|
waterfall<T>(opts: IPipelineOptions): Promise<IPipelineResult<T>>;
|
|
129
129
|
}
|
|
130
|
-
import {
|
|
130
|
+
import { IMidwayContainer } from '../interface';
|
|
131
131
|
export declare class PipelineContext implements IPipelineContext {
|
|
132
132
|
args: any;
|
|
133
133
|
info: {
|
|
@@ -145,7 +145,7 @@ export declare class PipelineContext implements IPipelineContext {
|
|
|
145
145
|
export declare class PipelineHandler implements IPipelineHandler {
|
|
146
146
|
private applicationContext;
|
|
147
147
|
private valves;
|
|
148
|
-
constructor(applicationContext:
|
|
148
|
+
constructor(applicationContext: IMidwayContainer, valves?: string[]);
|
|
149
149
|
parallel<T>(opts: IPipelineOptions): Promise<IPipelineResult<T>>;
|
|
150
150
|
concat<T>(opts: IPipelineOptions): Promise<IPipelineResult<T>>;
|
|
151
151
|
series<T>(opts: IPipelineOptions): Promise<IPipelineResult<T>>;
|
|
@@ -155,5 +155,5 @@ export declare class PipelineHandler implements IPipelineHandler {
|
|
|
155
155
|
private prepareParallelValves;
|
|
156
156
|
private packResult;
|
|
157
157
|
}
|
|
158
|
-
export declare function pipelineFactory(applicationContext:
|
|
158
|
+
export declare function pipelineFactory(applicationContext: IMidwayContainer, valves?: string[]): PipelineHandler;
|
|
159
159
|
//# sourceMappingURL=pipeline.d.ts.map
|
|
@@ -3,8 +3,10 @@ import { InjectionConfigurationOptions } from '@midwayjs/decorator';
|
|
|
3
3
|
export declare class FunctionalConfiguration {
|
|
4
4
|
private readyHandler;
|
|
5
5
|
private stopHandler;
|
|
6
|
+
private configLoadHandler;
|
|
6
7
|
private options;
|
|
7
8
|
constructor(options: InjectionConfigurationOptions);
|
|
9
|
+
onConfigLoad(configLoadHandler: ((container: IMidwayContainer, app: IMidwayApplication) => any) | IMidwayContainer, app?: IMidwayApplication): this;
|
|
8
10
|
onReady(readyHandler: ((container: IMidwayContainer, app: IMidwayApplication) => void) | IMidwayContainer, app?: IMidwayApplication): this;
|
|
9
11
|
onStop(stopHandler: ((container: IMidwayContainer, app: IMidwayApplication) => void) | IMidwayContainer, app?: IMidwayApplication): this;
|
|
10
12
|
getConfigurationOptions(): InjectionConfigurationOptions;
|
|
@@ -6,6 +6,16 @@ class FunctionalConfiguration {
|
|
|
6
6
|
this.options = options;
|
|
7
7
|
this.readyHandler = () => { };
|
|
8
8
|
this.stopHandler = () => { };
|
|
9
|
+
this.configLoadHandler = () => { };
|
|
10
|
+
}
|
|
11
|
+
onConfigLoad(configLoadHandler, app) {
|
|
12
|
+
if (typeof configLoadHandler === 'function') {
|
|
13
|
+
this.configLoadHandler = configLoadHandler;
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
this.configLoadHandler(configLoadHandler, app);
|
|
17
|
+
}
|
|
18
|
+
return this;
|
|
9
19
|
}
|
|
10
20
|
onReady(readyHandler, app) {
|
|
11
21
|
if (typeof readyHandler === 'function') {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { MidwayFrameworkType } from '@midwayjs/decorator';
|
|
2
2
|
export * from './interface';
|
|
3
3
|
export * from './context/container';
|
|
4
4
|
export { MidwayRequestContainer } from './context/requestContainer';
|
package/dist/index.js
CHANGED
|
@@ -10,31 +10,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.MidwayInformationService = exports.MidwayEnvironmentService = exports.MidwayConfigService = exports.createConfiguration = exports.classToPlain = exports.plainToClass = exports.delegateTargetPrototypeMethod = exports.safeRequire = exports.safelyGet = exports.BaseFramework = exports.MidwayRequestContainer = exports.
|
|
13
|
+
exports.MidwayInformationService = exports.MidwayEnvironmentService = exports.MidwayConfigService = exports.createConfiguration = exports.classToPlain = exports.plainToClass = exports.delegateTargetPrototypeMethod = exports.safeRequire = exports.safelyGet = exports.BaseFramework = exports.MidwayRequestContainer = exports.MidwayFrameworkType = void 0;
|
|
14
14
|
var decorator_1 = require("@midwayjs/decorator");
|
|
15
|
-
Object.defineProperty(exports, "ScopeEnum", { enumerable: true, get: function () { return decorator_1.ScopeEnum; } });
|
|
16
15
|
Object.defineProperty(exports, "MidwayFrameworkType", { enumerable: true, get: function () { return decorator_1.MidwayFrameworkType; } });
|
|
17
|
-
Object.defineProperty(exports, "saveClassMetadata", { enumerable: true, get: function () { return decorator_1.saveClassMetadata; } });
|
|
18
|
-
Object.defineProperty(exports, "attachClassMetadata", { enumerable: true, get: function () { return decorator_1.attachClassMetadata; } });
|
|
19
|
-
Object.defineProperty(exports, "getClassMetadata", { enumerable: true, get: function () { return decorator_1.getClassMetadata; } });
|
|
20
|
-
Object.defineProperty(exports, "savePropertyDataToClass", { enumerable: true, get: function () { return decorator_1.savePropertyDataToClass; } });
|
|
21
|
-
Object.defineProperty(exports, "attachPropertyDataToClass", { enumerable: true, get: function () { return decorator_1.attachPropertyDataToClass; } });
|
|
22
|
-
Object.defineProperty(exports, "getPropertyDataFromClass", { enumerable: true, get: function () { return decorator_1.getPropertyDataFromClass; } });
|
|
23
|
-
Object.defineProperty(exports, "listPropertyDataFromClass", { enumerable: true, get: function () { return decorator_1.listPropertyDataFromClass; } });
|
|
24
|
-
Object.defineProperty(exports, "savePropertyMetadata", { enumerable: true, get: function () { return decorator_1.savePropertyMetadata; } });
|
|
25
|
-
Object.defineProperty(exports, "attachPropertyMetadata", { enumerable: true, get: function () { return decorator_1.attachPropertyMetadata; } });
|
|
26
|
-
Object.defineProperty(exports, "getPropertyMetadata", { enumerable: true, get: function () { return decorator_1.getPropertyMetadata; } });
|
|
27
|
-
Object.defineProperty(exports, "savePreloadModule", { enumerable: true, get: function () { return decorator_1.savePreloadModule; } });
|
|
28
|
-
Object.defineProperty(exports, "listPreloadModule", { enumerable: true, get: function () { return decorator_1.listPreloadModule; } });
|
|
29
|
-
Object.defineProperty(exports, "saveModule", { enumerable: true, get: function () { return decorator_1.saveModule; } });
|
|
30
|
-
Object.defineProperty(exports, "listModule", { enumerable: true, get: function () { return decorator_1.listModule; } });
|
|
31
|
-
Object.defineProperty(exports, "resetModule", { enumerable: true, get: function () { return decorator_1.resetModule; } });
|
|
32
|
-
Object.defineProperty(exports, "clearAllModule", { enumerable: true, get: function () { return decorator_1.clearAllModule; } });
|
|
33
|
-
Object.defineProperty(exports, "getParamNames", { enumerable: true, get: function () { return decorator_1.getParamNames; } });
|
|
34
|
-
Object.defineProperty(exports, "getProviderId", { enumerable: true, get: function () { return decorator_1.getProviderId; } });
|
|
35
|
-
Object.defineProperty(exports, "getObjectDefinition", { enumerable: true, get: function () { return decorator_1.getObjectDefinition; } });
|
|
36
|
-
Object.defineProperty(exports, "classNamed", { enumerable: true, get: function () { return decorator_1.classNamed; } });
|
|
37
|
-
Object.defineProperty(exports, "generateProvideId", { enumerable: true, get: function () { return decorator_1.generateProvideId; } });
|
|
38
16
|
__exportStar(require("./interface"), exports);
|
|
39
17
|
__exportStar(require("./context/container"), exports);
|
|
40
18
|
var requestContainer_1 = require("./context/requestContainer");
|
package/dist/interface.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { ILogger, LoggerOptions } from '@midwayjs/logger';
|
|
|
5
5
|
* 生命周期定义
|
|
6
6
|
*/
|
|
7
7
|
export interface ILifeCycle {
|
|
8
|
-
onConfigLoad?(container: IMidwayContainer, app?: IMidwayApplication): Promise<
|
|
8
|
+
onConfigLoad?(container: IMidwayContainer, app?: IMidwayApplication): Promise<any>;
|
|
9
9
|
onReady(container: IMidwayContainer, app?: IMidwayApplication): Promise<void>;
|
|
10
10
|
onStop?(container: IMidwayContainer, app?: IMidwayApplication): Promise<void>;
|
|
11
11
|
}
|
|
@@ -22,7 +22,6 @@ export interface IMessageSource {
|
|
|
22
22
|
*/
|
|
23
23
|
export interface IObjectFactory {
|
|
24
24
|
registry: IObjectDefinitionRegistry;
|
|
25
|
-
isAsync(identifier: ObjectIdentifier): boolean;
|
|
26
25
|
get<T>(identifier: new () => T, args?: any): T;
|
|
27
26
|
get<T>(identifier: ObjectIdentifier, args?: any): T;
|
|
28
27
|
getAsync<T>(identifier: new () => T, args?: any): Promise<T>;
|
|
@@ -45,7 +44,6 @@ export interface IObjectDefinition {
|
|
|
45
44
|
dependsOn: ObjectIdentifier[];
|
|
46
45
|
constructorArgs: IManagedInstance[];
|
|
47
46
|
properties: IProperties;
|
|
48
|
-
isAutowire(): boolean;
|
|
49
47
|
isAsync(): boolean;
|
|
50
48
|
isSingletonScope(): boolean;
|
|
51
49
|
isRequestScope(): boolean;
|
|
@@ -65,13 +63,12 @@ export interface HandlerProp {
|
|
|
65
63
|
*/
|
|
66
64
|
export interface IObjectDefinitionMetadata {
|
|
67
65
|
namespace?: string;
|
|
68
|
-
id:
|
|
66
|
+
id: ObjectIdentifier;
|
|
69
67
|
name: string;
|
|
70
68
|
initMethod: string;
|
|
71
69
|
destroyMethod: string;
|
|
72
70
|
constructMethod: string;
|
|
73
71
|
scope: ScopeEnum;
|
|
74
|
-
autowire: boolean;
|
|
75
72
|
srcPath: string;
|
|
76
73
|
path: any;
|
|
77
74
|
export: string;
|
|
@@ -88,13 +85,14 @@ export interface IObjectDefinitionMetadata {
|
|
|
88
85
|
}
|
|
89
86
|
export interface FrameworkDecoratorMetadata {
|
|
90
87
|
key: string;
|
|
88
|
+
targetKey: string;
|
|
91
89
|
propertyName: string;
|
|
92
90
|
meta: any;
|
|
93
91
|
}
|
|
94
92
|
export interface IObjectCreator {
|
|
95
93
|
load(): any;
|
|
96
|
-
doConstruct(Clzz: any, args?: any, context?:
|
|
97
|
-
doConstructAsync(Clzz: any, args?: any, context?:
|
|
94
|
+
doConstruct(Clzz: any, args?: any, context?: IMidwayContainer): any;
|
|
95
|
+
doConstructAsync(Clzz: any, args?: any, context?: IMidwayContainer): Promise<any>;
|
|
98
96
|
doInit(obj: any): void;
|
|
99
97
|
doInitAsync(obj: any): Promise<void>;
|
|
100
98
|
doDestroy(obj: any): void;
|
|
@@ -109,7 +107,6 @@ export interface IObjectDefinitionRegistry {
|
|
|
109
107
|
registerDefinition(identifier: ObjectIdentifier, definition: IObjectDefinition): any;
|
|
110
108
|
getSingletonDefinitionIds(): ObjectIdentifier[];
|
|
111
109
|
getDefinition(identifier: ObjectIdentifier): IObjectDefinition;
|
|
112
|
-
getDefinitionByPath(path: string): IObjectDefinition;
|
|
113
110
|
getDefinitionByName(name: string): IObjectDefinition[];
|
|
114
111
|
removeDefinition(identifier: ObjectIdentifier): void;
|
|
115
112
|
hasDefinition(identifier: ObjectIdentifier): boolean;
|
|
@@ -117,6 +114,8 @@ export interface IObjectDefinitionRegistry {
|
|
|
117
114
|
hasObject(identifier: ObjectIdentifier): boolean;
|
|
118
115
|
registerObject(identifier: ObjectIdentifier, target: any): any;
|
|
119
116
|
getObject(identifier: ObjectIdentifier): any;
|
|
117
|
+
getIdentifierRelation(): IIdentifierRelationShip;
|
|
118
|
+
setIdentifierRelation(identifierRelation: IIdentifierRelationShip): any;
|
|
120
119
|
}
|
|
121
120
|
/**
|
|
122
121
|
* 属性配置抽象
|
|
@@ -135,7 +134,6 @@ export interface IProperties {
|
|
|
135
134
|
addProperty(key: ObjectIdentifier, value: any): void;
|
|
136
135
|
setProperty(key: ObjectIdentifier, value: any): any;
|
|
137
136
|
clear(): void;
|
|
138
|
-
clone(): IProperties;
|
|
139
137
|
}
|
|
140
138
|
/**
|
|
141
139
|
* 资源配置抽象
|
|
@@ -156,19 +154,6 @@ export interface IResource {
|
|
|
156
154
|
getSubResources(): IResource[];
|
|
157
155
|
createRelative(path: string): IResource;
|
|
158
156
|
}
|
|
159
|
-
/**
|
|
160
|
-
* IoC上下文抽象
|
|
161
|
-
*/
|
|
162
|
-
export interface IApplicationContext extends IObjectFactory {
|
|
163
|
-
disableConflictCheck: boolean;
|
|
164
|
-
baseDir: string;
|
|
165
|
-
parent: IApplicationContext;
|
|
166
|
-
props: IProperties;
|
|
167
|
-
dependencyMap: Map<string, ObjectDependencyTree>;
|
|
168
|
-
ready(): any;
|
|
169
|
-
stop(): Promise<void>;
|
|
170
|
-
registerObject(identifier: ObjectIdentifier, target: any): any;
|
|
171
|
-
}
|
|
172
157
|
/**
|
|
173
158
|
* 解析内部管理的属性、json、ref等实例的解析器
|
|
174
159
|
* 同时创建这些对象的实际使用的对象
|
|
@@ -214,7 +199,18 @@ export interface IResolverHandler {
|
|
|
214
199
|
hasHandler(key: string): boolean;
|
|
215
200
|
getHandler(key: string): any;
|
|
216
201
|
}
|
|
217
|
-
export interface
|
|
202
|
+
export interface IIdentifierRelationShip {
|
|
203
|
+
saveClassRelation(module: any, namespace?: string): any;
|
|
204
|
+
saveFunctionRelation(ObjectIdentifier: any, uuid: any): any;
|
|
205
|
+
hasRelation(id: ObjectIdentifier): boolean;
|
|
206
|
+
getRelation(id: ObjectIdentifier): string;
|
|
207
|
+
}
|
|
208
|
+
export interface IMidwayContainer extends IObjectFactory {
|
|
209
|
+
parent: IMidwayContainer;
|
|
210
|
+
identifierMapping: IIdentifierRelationShip;
|
|
211
|
+
ready(): any;
|
|
212
|
+
stop(): Promise<void>;
|
|
213
|
+
registerObject(identifier: ObjectIdentifier, target: any): any;
|
|
218
214
|
load(module?: any): any;
|
|
219
215
|
bind<T>(target: T, options?: ObjectDefinitionOptions): void;
|
|
220
216
|
bind<T>(identifier: ObjectIdentifier, target: T, options?: ObjectDefinitionOptions): void;
|
|
@@ -223,9 +219,6 @@ export interface IMidwayContainer extends IApplicationContext {
|
|
|
223
219
|
setFileDetector(fileDetector: IFileDetector): any;
|
|
224
220
|
registerDataHandler(handlerType: string, handler: (...args: any[]) => any): any;
|
|
225
221
|
createChild(): IMidwayContainer;
|
|
226
|
-
/**
|
|
227
|
-
* 默认不添加创建的 configuration 到 configurations 数组中
|
|
228
|
-
*/
|
|
229
222
|
getConfigService(): IConfigService;
|
|
230
223
|
getEnvironmentService(): IEnvironmentService;
|
|
231
224
|
getInformationService(): IInformationService;
|
|
@@ -246,7 +239,7 @@ export interface IMidwayContainer extends IApplicationContext {
|
|
|
246
239
|
getAttr<T>(key: string): T;
|
|
247
240
|
}
|
|
248
241
|
export interface IFileDetector {
|
|
249
|
-
run(container:
|
|
242
|
+
run(container: IMidwayContainer): any;
|
|
250
243
|
}
|
|
251
244
|
export interface IConfigService {
|
|
252
245
|
add(configFilePaths: any[]): any;
|
|
@@ -324,11 +317,6 @@ export interface IMidwayBaseApplication<T extends IMidwayContext = IMidwayContex
|
|
|
324
317
|
getAttr<T>(key: string): T;
|
|
325
318
|
}
|
|
326
319
|
export declare type IMidwayApplication<T extends IMidwayContext = IMidwayContext, FrameworkApplication = unknown> = IMidwayBaseApplication<T> & FrameworkApplication;
|
|
327
|
-
/**
|
|
328
|
-
* @deprecated
|
|
329
|
-
*/
|
|
330
|
-
export interface IMidwayCoreApplication extends IMidwayApplication {
|
|
331
|
-
}
|
|
332
320
|
export interface IMidwayBootstrapOptions {
|
|
333
321
|
logger?: ILogger | boolean;
|
|
334
322
|
baseDir?: string;
|
|
@@ -342,6 +330,7 @@ export interface IMidwayBootstrapOptions {
|
|
|
342
330
|
loadDir?: string[];
|
|
343
331
|
disableConflictCheck?: boolean;
|
|
344
332
|
applicationContext?: IMidwayContainer;
|
|
333
|
+
configurationModule?: any;
|
|
345
334
|
isMainFramework?: boolean;
|
|
346
335
|
globalApplicationHandler?: (type: MidwayFrameworkType) => IMidwayApplication;
|
|
347
336
|
globalConfig?: any;
|
|
@@ -15,7 +15,7 @@ const createModuleContainer = (options) => {
|
|
|
15
15
|
};
|
|
16
16
|
exports.createModuleContainer = createModuleContainer;
|
|
17
17
|
const createDirectoryGlobContainer = options => {
|
|
18
|
-
const applicationContext = new container_1.MidwayContainer(
|
|
18
|
+
const applicationContext = new container_1.MidwayContainer();
|
|
19
19
|
applicationContext.setFileDetector(new fileDetector_1.DirectoryFileDetector({
|
|
20
20
|
loadDir: options.baseDir,
|
|
21
21
|
}));
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export interface RouterInfo {
|
|
2
|
+
/**
|
|
3
|
+
* uuid
|
|
4
|
+
*/
|
|
5
|
+
id: string;
|
|
2
6
|
/**
|
|
3
7
|
* router prefix
|
|
4
8
|
*/
|
|
@@ -92,6 +96,10 @@ export declare class WebRouterCollector {
|
|
|
92
96
|
_paramString: string;
|
|
93
97
|
_category: number;
|
|
94
98
|
_weight: number;
|
|
99
|
+
/**
|
|
100
|
+
* uuid
|
|
101
|
+
*/
|
|
102
|
+
id: string;
|
|
95
103
|
/**
|
|
96
104
|
* router prefix
|
|
97
105
|
*/
|