@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.
- package/CHANGELOG.md +149 -0
- package/README.md +1 -1
- package/dist/baseFramework.d.ts +56 -22
- package/dist/baseFramework.js +157 -232
- package/dist/common/applicationManager.d.ts +12 -0
- package/dist/common/applicationManager.js +66 -0
- package/dist/{util → common}/fileDetector.d.ts +0 -0
- package/dist/{util → common}/fileDetector.js +16 -10
- package/dist/common/filterManager.d.ts +19 -0
- package/dist/common/filterManager.js +85 -0
- package/dist/common/middlewareManager.d.ts +68 -0
- package/dist/common/middlewareManager.js +183 -0
- package/dist/common/serviceFactory.d.ts +15 -0
- package/dist/{util → common}/serviceFactory.js +16 -6
- package/dist/{util → common}/triggerCollector.d.ts +0 -0
- package/dist/{util → common}/triggerCollector.js +0 -0
- package/dist/common/webGenerator.d.ts +16 -0
- package/dist/common/webGenerator.js +117 -0
- package/dist/{util → common}/webRouterCollector.d.ts +21 -2
- package/dist/common/webRouterCollector.js +331 -0
- package/dist/config/config.default.d.ts +7 -0
- package/dist/config/config.default.js +28 -0
- package/dist/context/container.d.ts +73 -43
- package/dist/context/container.js +289 -271
- package/dist/context/definitionRegistry.d.ts +26 -0
- package/dist/context/definitionRegistry.js +124 -0
- package/dist/context/managedResolverFactory.d.ts +15 -32
- package/dist/context/managedResolverFactory.js +91 -320
- package/dist/context/providerWrapper.d.ts +2 -3
- package/dist/context/requestContainer.d.ts +0 -2
- package/dist/context/requestContainer.js +9 -26
- package/dist/definitions/functionDefinition.d.ts +3 -4
- package/dist/definitions/functionDefinition.js +0 -6
- package/dist/definitions/objectCreator.js +9 -8
- package/dist/definitions/objectDefinition.d.ts +4 -6
- package/dist/definitions/objectDefinition.js +0 -8
- package/dist/definitions/properties.d.ts +2 -15
- package/dist/definitions/properties.js +3 -72
- package/dist/error/base.d.ts +32 -0
- package/dist/error/base.js +48 -0
- package/dist/error/framework.d.ts +45 -0
- package/dist/error/framework.js +87 -0
- package/dist/error/http.d.ts +119 -0
- package/dist/error/http.js +169 -0
- package/dist/error/index.d.ts +4 -0
- package/dist/error/index.js +16 -0
- package/dist/functional/configuration.d.ts +4 -2
- package/dist/functional/configuration.js +12 -2
- package/dist/index.d.ts +24 -11
- package/dist/index.js +36 -36
- package/dist/interface.d.ts +270 -184
- package/dist/interface.js +9 -1
- package/dist/service/aspectService.d.ts +11 -14
- package/dist/service/aspectService.js +116 -172
- package/dist/service/configService.d.ts +10 -8
- package/dist/service/configService.js +61 -38
- package/dist/service/decoratorService.d.ts +23 -0
- package/dist/service/decoratorService.js +149 -0
- package/dist/service/environmentService.js +15 -4
- package/dist/service/frameworkService.d.ts +26 -0
- package/dist/service/frameworkService.js +176 -0
- package/dist/service/informationService.d.ts +4 -7
- package/dist/service/informationService.js +41 -10
- package/dist/service/lifeCycleService.d.ts +14 -0
- package/dist/service/lifeCycleService.js +130 -0
- package/dist/service/loggerService.d.ts +27 -0
- package/dist/service/loggerService.js +132 -0
- package/dist/service/middlewareService.d.ts +10 -0
- package/dist/service/middlewareService.js +123 -0
- package/dist/{features/pipeline.d.ts → service/pipelineService.d.ts} +56 -46
- package/dist/{features/pipeline.js → service/pipelineService.js} +54 -19
- package/dist/setup.d.ts +4 -0
- package/dist/setup.js +119 -0
- package/dist/util/contextUtil.d.ts +1 -1
- package/dist/util/contextUtil.js +2 -2
- package/dist/util/index.d.ts +64 -0
- package/dist/util/index.js +195 -7
- package/dist/util/pathFileUtil.js +2 -2
- package/dist/util/pathToRegexp.d.ts +17 -0
- package/dist/util/pathToRegexp.js +280 -0
- package/dist/util/webRouterParam.d.ts +2 -2
- package/dist/util/webRouterParam.js +43 -24
- package/package.json +10 -15
- package/dist/common/lodashWrap.d.ts +0 -9
- package/dist/common/lodashWrap.js +0 -18
- package/dist/common/notFoundError.d.ts +0 -8
- package/dist/common/notFoundError.js +0 -20
- package/dist/common/reflectTool.d.ts +0 -15
- package/dist/common/reflectTool.js +0 -83
- 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/context/resolverHandler.d.ts +0 -34
- package/dist/context/resolverHandler.js +0 -88
- package/dist/definitions/messageSource.d.ts +0 -13
- package/dist/definitions/messageSource.js +0 -74
- package/dist/definitions/resource.d.ts +0 -27
- package/dist/definitions/resource.js +0 -116
- package/dist/features/index.d.ts +0 -2
- package/dist/features/index.js +0 -3
- package/dist/logger.d.ts +0 -4
- package/dist/logger.js +0 -20
- package/dist/util/containerUtil.d.ts +0 -11
- package/dist/util/containerUtil.js +0 -26
- package/dist/util/emptyFramework.d.ts +0 -62
- package/dist/util/emptyFramework.js +0 -72
- package/dist/util/serviceFactory.d.ts +0 -13
- package/dist/util/staticConfig.d.ts +0 -10
- package/dist/util/staticConfig.js +0 -67
- package/dist/util/webRouterCollector.js +0 -348
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { MidwayHttpError, ResOrMessage } from './base';
|
|
2
|
+
export declare enum HttpStatus {
|
|
3
|
+
CONTINUE = 100,
|
|
4
|
+
SWITCHING_PROTOCOLS = 101,
|
|
5
|
+
PROCESSING = 102,
|
|
6
|
+
EARLYHINTS = 103,
|
|
7
|
+
OK = 200,
|
|
8
|
+
CREATED = 201,
|
|
9
|
+
ACCEPTED = 202,
|
|
10
|
+
NON_AUTHORITATIVE_INFORMATION = 203,
|
|
11
|
+
NO_CONTENT = 204,
|
|
12
|
+
RESET_CONTENT = 205,
|
|
13
|
+
PARTIAL_CONTENT = 206,
|
|
14
|
+
AMBIGUOUS = 300,
|
|
15
|
+
MOVED_PERMANENTLY = 301,
|
|
16
|
+
FOUND = 302,
|
|
17
|
+
SEE_OTHER = 303,
|
|
18
|
+
NOT_MODIFIED = 304,
|
|
19
|
+
TEMPORARY_REDIRECT = 307,
|
|
20
|
+
PERMANENT_REDIRECT = 308,
|
|
21
|
+
BAD_REQUEST = 400,
|
|
22
|
+
UNAUTHORIZED = 401,
|
|
23
|
+
PAYMENT_REQUIRED = 402,
|
|
24
|
+
FORBIDDEN = 403,
|
|
25
|
+
NOT_FOUND = 404,
|
|
26
|
+
METHOD_NOT_ALLOWED = 405,
|
|
27
|
+
NOT_ACCEPTABLE = 406,
|
|
28
|
+
PROXY_AUTHENTICATION_REQUIRED = 407,
|
|
29
|
+
REQUEST_TIMEOUT = 408,
|
|
30
|
+
CONFLICT = 409,
|
|
31
|
+
GONE = 410,
|
|
32
|
+
LENGTH_REQUIRED = 411,
|
|
33
|
+
PRECONDITION_FAILED = 412,
|
|
34
|
+
PAYLOAD_TOO_LARGE = 413,
|
|
35
|
+
URI_TOO_LONG = 414,
|
|
36
|
+
UNSUPPORTED_MEDIA_TYPE = 415,
|
|
37
|
+
REQUESTED_RANGE_NOT_SATISFIABLE = 416,
|
|
38
|
+
EXPECTATION_FAILED = 417,
|
|
39
|
+
I_AM_A_TEAPOT = 418,
|
|
40
|
+
MISDIRECTED = 421,
|
|
41
|
+
UNPROCESSABLE_ENTITY = 422,
|
|
42
|
+
FAILED_DEPENDENCY = 424,
|
|
43
|
+
PRECONDITION_REQUIRED = 428,
|
|
44
|
+
TOO_MANY_REQUESTS = 429,
|
|
45
|
+
INTERNAL_SERVER_ERROR = 500,
|
|
46
|
+
NOT_IMPLEMENTED = 501,
|
|
47
|
+
BAD_GATEWAY = 502,
|
|
48
|
+
SERVICE_UNAVAILABLE = 503,
|
|
49
|
+
GATEWAY_TIMEOUT = 504,
|
|
50
|
+
HTTP_VERSION_NOT_SUPPORTED = 505
|
|
51
|
+
}
|
|
52
|
+
export declare class BadRequestError extends MidwayHttpError {
|
|
53
|
+
constructor(resOrMessage: ResOrMessage);
|
|
54
|
+
}
|
|
55
|
+
export declare class UnauthorizedError extends MidwayHttpError {
|
|
56
|
+
constructor(resOrMessage: ResOrMessage);
|
|
57
|
+
}
|
|
58
|
+
export declare class NotFoundError extends MidwayHttpError {
|
|
59
|
+
constructor(resOrMessage: ResOrMessage);
|
|
60
|
+
}
|
|
61
|
+
export declare class ForbiddenError extends MidwayHttpError {
|
|
62
|
+
constructor(resOrMessage: ResOrMessage);
|
|
63
|
+
}
|
|
64
|
+
export declare class NotAcceptableError extends MidwayHttpError {
|
|
65
|
+
constructor(resOrMessage: ResOrMessage);
|
|
66
|
+
}
|
|
67
|
+
export declare class RequestTimeoutError extends MidwayHttpError {
|
|
68
|
+
constructor(resOrMessage: ResOrMessage);
|
|
69
|
+
}
|
|
70
|
+
export declare class ConflictError extends MidwayHttpError {
|
|
71
|
+
constructor(resOrMessage: ResOrMessage);
|
|
72
|
+
}
|
|
73
|
+
export declare class GoneError extends MidwayHttpError {
|
|
74
|
+
constructor(resOrMessage: ResOrMessage);
|
|
75
|
+
}
|
|
76
|
+
export declare class PayloadTooLargeError extends MidwayHttpError {
|
|
77
|
+
constructor(resOrMessage: ResOrMessage);
|
|
78
|
+
}
|
|
79
|
+
export declare class UnsupportedMediaTypeError extends MidwayHttpError {
|
|
80
|
+
constructor(resOrMessage: ResOrMessage);
|
|
81
|
+
}
|
|
82
|
+
export declare class UnprocessableError extends MidwayHttpError {
|
|
83
|
+
constructor(resOrMessage: ResOrMessage);
|
|
84
|
+
}
|
|
85
|
+
export declare class InternalServerErrorError extends MidwayHttpError {
|
|
86
|
+
constructor(resOrMessage: ResOrMessage);
|
|
87
|
+
}
|
|
88
|
+
declare class NotImplementedError extends MidwayHttpError {
|
|
89
|
+
constructor(resOrMessage: ResOrMessage);
|
|
90
|
+
}
|
|
91
|
+
export declare class BadGatewayError extends MidwayHttpError {
|
|
92
|
+
constructor(resOrMessage: ResOrMessage);
|
|
93
|
+
}
|
|
94
|
+
export declare class ServiceUnavailableError extends MidwayHttpError {
|
|
95
|
+
constructor(resOrMessage: ResOrMessage);
|
|
96
|
+
}
|
|
97
|
+
export declare class GatewayTimeoutError extends MidwayHttpError {
|
|
98
|
+
constructor(resOrMessage: ResOrMessage);
|
|
99
|
+
}
|
|
100
|
+
export declare const httpError: {
|
|
101
|
+
BadRequestError: typeof BadRequestError;
|
|
102
|
+
UnauthorizedError: typeof UnauthorizedError;
|
|
103
|
+
NotFoundError: typeof NotFoundError;
|
|
104
|
+
ForbiddenError: typeof ForbiddenError;
|
|
105
|
+
NotAcceptableError: typeof NotAcceptableError;
|
|
106
|
+
RequestTimeoutError: typeof RequestTimeoutError;
|
|
107
|
+
ConflictError: typeof ConflictError;
|
|
108
|
+
GoneError: typeof GoneError;
|
|
109
|
+
PayloadTooLargeError: typeof PayloadTooLargeError;
|
|
110
|
+
UnsupportedMediaTypeError: typeof UnsupportedMediaTypeError;
|
|
111
|
+
UnprocessableError: typeof UnprocessableError;
|
|
112
|
+
InternalServerErrorError: typeof InternalServerErrorError;
|
|
113
|
+
NotImplementedError: typeof NotImplementedError;
|
|
114
|
+
BadGatewayError: typeof BadGatewayError;
|
|
115
|
+
ServiceUnavailableError: typeof ServiceUnavailableError;
|
|
116
|
+
GatewayTimeoutError: typeof GatewayTimeoutError;
|
|
117
|
+
};
|
|
118
|
+
export {};
|
|
119
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.httpError = exports.GatewayTimeoutError = exports.ServiceUnavailableError = exports.BadGatewayError = exports.InternalServerErrorError = exports.UnprocessableError = exports.UnsupportedMediaTypeError = exports.PayloadTooLargeError = exports.GoneError = exports.ConflictError = exports.RequestTimeoutError = exports.NotAcceptableError = exports.ForbiddenError = exports.NotFoundError = exports.UnauthorizedError = exports.BadRequestError = exports.HttpStatus = void 0;
|
|
4
|
+
const base_1 = require("./base");
|
|
5
|
+
var HttpStatus;
|
|
6
|
+
(function (HttpStatus) {
|
|
7
|
+
HttpStatus[HttpStatus["CONTINUE"] = 100] = "CONTINUE";
|
|
8
|
+
HttpStatus[HttpStatus["SWITCHING_PROTOCOLS"] = 101] = "SWITCHING_PROTOCOLS";
|
|
9
|
+
HttpStatus[HttpStatus["PROCESSING"] = 102] = "PROCESSING";
|
|
10
|
+
HttpStatus[HttpStatus["EARLYHINTS"] = 103] = "EARLYHINTS";
|
|
11
|
+
HttpStatus[HttpStatus["OK"] = 200] = "OK";
|
|
12
|
+
HttpStatus[HttpStatus["CREATED"] = 201] = "CREATED";
|
|
13
|
+
HttpStatus[HttpStatus["ACCEPTED"] = 202] = "ACCEPTED";
|
|
14
|
+
HttpStatus[HttpStatus["NON_AUTHORITATIVE_INFORMATION"] = 203] = "NON_AUTHORITATIVE_INFORMATION";
|
|
15
|
+
HttpStatus[HttpStatus["NO_CONTENT"] = 204] = "NO_CONTENT";
|
|
16
|
+
HttpStatus[HttpStatus["RESET_CONTENT"] = 205] = "RESET_CONTENT";
|
|
17
|
+
HttpStatus[HttpStatus["PARTIAL_CONTENT"] = 206] = "PARTIAL_CONTENT";
|
|
18
|
+
HttpStatus[HttpStatus["AMBIGUOUS"] = 300] = "AMBIGUOUS";
|
|
19
|
+
HttpStatus[HttpStatus["MOVED_PERMANENTLY"] = 301] = "MOVED_PERMANENTLY";
|
|
20
|
+
HttpStatus[HttpStatus["FOUND"] = 302] = "FOUND";
|
|
21
|
+
HttpStatus[HttpStatus["SEE_OTHER"] = 303] = "SEE_OTHER";
|
|
22
|
+
HttpStatus[HttpStatus["NOT_MODIFIED"] = 304] = "NOT_MODIFIED";
|
|
23
|
+
HttpStatus[HttpStatus["TEMPORARY_REDIRECT"] = 307] = "TEMPORARY_REDIRECT";
|
|
24
|
+
HttpStatus[HttpStatus["PERMANENT_REDIRECT"] = 308] = "PERMANENT_REDIRECT";
|
|
25
|
+
HttpStatus[HttpStatus["BAD_REQUEST"] = 400] = "BAD_REQUEST";
|
|
26
|
+
HttpStatus[HttpStatus["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
|
|
27
|
+
HttpStatus[HttpStatus["PAYMENT_REQUIRED"] = 402] = "PAYMENT_REQUIRED";
|
|
28
|
+
HttpStatus[HttpStatus["FORBIDDEN"] = 403] = "FORBIDDEN";
|
|
29
|
+
HttpStatus[HttpStatus["NOT_FOUND"] = 404] = "NOT_FOUND";
|
|
30
|
+
HttpStatus[HttpStatus["METHOD_NOT_ALLOWED"] = 405] = "METHOD_NOT_ALLOWED";
|
|
31
|
+
HttpStatus[HttpStatus["NOT_ACCEPTABLE"] = 406] = "NOT_ACCEPTABLE";
|
|
32
|
+
HttpStatus[HttpStatus["PROXY_AUTHENTICATION_REQUIRED"] = 407] = "PROXY_AUTHENTICATION_REQUIRED";
|
|
33
|
+
HttpStatus[HttpStatus["REQUEST_TIMEOUT"] = 408] = "REQUEST_TIMEOUT";
|
|
34
|
+
HttpStatus[HttpStatus["CONFLICT"] = 409] = "CONFLICT";
|
|
35
|
+
HttpStatus[HttpStatus["GONE"] = 410] = "GONE";
|
|
36
|
+
HttpStatus[HttpStatus["LENGTH_REQUIRED"] = 411] = "LENGTH_REQUIRED";
|
|
37
|
+
HttpStatus[HttpStatus["PRECONDITION_FAILED"] = 412] = "PRECONDITION_FAILED";
|
|
38
|
+
HttpStatus[HttpStatus["PAYLOAD_TOO_LARGE"] = 413] = "PAYLOAD_TOO_LARGE";
|
|
39
|
+
HttpStatus[HttpStatus["URI_TOO_LONG"] = 414] = "URI_TOO_LONG";
|
|
40
|
+
HttpStatus[HttpStatus["UNSUPPORTED_MEDIA_TYPE"] = 415] = "UNSUPPORTED_MEDIA_TYPE";
|
|
41
|
+
HttpStatus[HttpStatus["REQUESTED_RANGE_NOT_SATISFIABLE"] = 416] = "REQUESTED_RANGE_NOT_SATISFIABLE";
|
|
42
|
+
HttpStatus[HttpStatus["EXPECTATION_FAILED"] = 417] = "EXPECTATION_FAILED";
|
|
43
|
+
HttpStatus[HttpStatus["I_AM_A_TEAPOT"] = 418] = "I_AM_A_TEAPOT";
|
|
44
|
+
HttpStatus[HttpStatus["MISDIRECTED"] = 421] = "MISDIRECTED";
|
|
45
|
+
HttpStatus[HttpStatus["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
|
|
46
|
+
HttpStatus[HttpStatus["FAILED_DEPENDENCY"] = 424] = "FAILED_DEPENDENCY";
|
|
47
|
+
HttpStatus[HttpStatus["PRECONDITION_REQUIRED"] = 428] = "PRECONDITION_REQUIRED";
|
|
48
|
+
HttpStatus[HttpStatus["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
|
|
49
|
+
HttpStatus[HttpStatus["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
|
|
50
|
+
HttpStatus[HttpStatus["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
|
|
51
|
+
HttpStatus[HttpStatus["BAD_GATEWAY"] = 502] = "BAD_GATEWAY";
|
|
52
|
+
HttpStatus[HttpStatus["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
|
|
53
|
+
HttpStatus[HttpStatus["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
|
|
54
|
+
HttpStatus[HttpStatus["HTTP_VERSION_NOT_SUPPORTED"] = 505] = "HTTP_VERSION_NOT_SUPPORTED";
|
|
55
|
+
})(HttpStatus = exports.HttpStatus || (exports.HttpStatus = {}));
|
|
56
|
+
class BadRequestError extends base_1.MidwayHttpError {
|
|
57
|
+
constructor(resOrMessage) {
|
|
58
|
+
super(resOrMessage, HttpStatus.BAD_REQUEST);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.BadRequestError = BadRequestError;
|
|
62
|
+
class UnauthorizedError extends base_1.MidwayHttpError {
|
|
63
|
+
constructor(resOrMessage) {
|
|
64
|
+
super(resOrMessage, HttpStatus.UNAUTHORIZED);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.UnauthorizedError = UnauthorizedError;
|
|
68
|
+
class NotFoundError extends base_1.MidwayHttpError {
|
|
69
|
+
constructor(resOrMessage) {
|
|
70
|
+
super(resOrMessage, HttpStatus.NOT_FOUND);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.NotFoundError = NotFoundError;
|
|
74
|
+
class ForbiddenError extends base_1.MidwayHttpError {
|
|
75
|
+
constructor(resOrMessage) {
|
|
76
|
+
super(resOrMessage, HttpStatus.FORBIDDEN);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.ForbiddenError = ForbiddenError;
|
|
80
|
+
class NotAcceptableError extends base_1.MidwayHttpError {
|
|
81
|
+
constructor(resOrMessage) {
|
|
82
|
+
super(resOrMessage, HttpStatus.NOT_ACCEPTABLE);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
exports.NotAcceptableError = NotAcceptableError;
|
|
86
|
+
class RequestTimeoutError extends base_1.MidwayHttpError {
|
|
87
|
+
constructor(resOrMessage) {
|
|
88
|
+
super(resOrMessage, HttpStatus.REQUEST_TIMEOUT);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
exports.RequestTimeoutError = RequestTimeoutError;
|
|
92
|
+
class ConflictError extends base_1.MidwayHttpError {
|
|
93
|
+
constructor(resOrMessage) {
|
|
94
|
+
super(resOrMessage, HttpStatus.CONFLICT);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
exports.ConflictError = ConflictError;
|
|
98
|
+
class GoneError extends base_1.MidwayHttpError {
|
|
99
|
+
constructor(resOrMessage) {
|
|
100
|
+
super(resOrMessage, HttpStatus.GONE);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
exports.GoneError = GoneError;
|
|
104
|
+
class PayloadTooLargeError extends base_1.MidwayHttpError {
|
|
105
|
+
constructor(resOrMessage) {
|
|
106
|
+
super(resOrMessage, HttpStatus.PAYLOAD_TOO_LARGE);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
exports.PayloadTooLargeError = PayloadTooLargeError;
|
|
110
|
+
class UnsupportedMediaTypeError extends base_1.MidwayHttpError {
|
|
111
|
+
constructor(resOrMessage) {
|
|
112
|
+
super(resOrMessage, HttpStatus.UNSUPPORTED_MEDIA_TYPE);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
exports.UnsupportedMediaTypeError = UnsupportedMediaTypeError;
|
|
116
|
+
class UnprocessableError extends base_1.MidwayHttpError {
|
|
117
|
+
constructor(resOrMessage) {
|
|
118
|
+
super(resOrMessage, HttpStatus.UNPROCESSABLE_ENTITY);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.UnprocessableError = UnprocessableError;
|
|
122
|
+
class InternalServerErrorError extends base_1.MidwayHttpError {
|
|
123
|
+
constructor(resOrMessage) {
|
|
124
|
+
super(resOrMessage, HttpStatus.INTERNAL_SERVER_ERROR);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
exports.InternalServerErrorError = InternalServerErrorError;
|
|
128
|
+
class NotImplementedError extends base_1.MidwayHttpError {
|
|
129
|
+
constructor(resOrMessage) {
|
|
130
|
+
super(resOrMessage, HttpStatus.NOT_IMPLEMENTED);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
class BadGatewayError extends base_1.MidwayHttpError {
|
|
134
|
+
constructor(resOrMessage) {
|
|
135
|
+
super(resOrMessage, HttpStatus.BAD_GATEWAY);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
exports.BadGatewayError = BadGatewayError;
|
|
139
|
+
class ServiceUnavailableError extends base_1.MidwayHttpError {
|
|
140
|
+
constructor(resOrMessage) {
|
|
141
|
+
super(resOrMessage, HttpStatus.SERVICE_UNAVAILABLE);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
exports.ServiceUnavailableError = ServiceUnavailableError;
|
|
145
|
+
class GatewayTimeoutError extends base_1.MidwayHttpError {
|
|
146
|
+
constructor(resOrMessage) {
|
|
147
|
+
super(resOrMessage, HttpStatus.GATEWAY_TIMEOUT);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
exports.GatewayTimeoutError = GatewayTimeoutError;
|
|
151
|
+
exports.httpError = {
|
|
152
|
+
BadRequestError,
|
|
153
|
+
UnauthorizedError,
|
|
154
|
+
NotFoundError,
|
|
155
|
+
ForbiddenError,
|
|
156
|
+
NotAcceptableError,
|
|
157
|
+
RequestTimeoutError,
|
|
158
|
+
ConflictError,
|
|
159
|
+
GoneError,
|
|
160
|
+
PayloadTooLargeError,
|
|
161
|
+
UnsupportedMediaTypeError,
|
|
162
|
+
UnprocessableError,
|
|
163
|
+
InternalServerErrorError,
|
|
164
|
+
NotImplementedError,
|
|
165
|
+
BadGatewayError,
|
|
166
|
+
ServiceUnavailableError,
|
|
167
|
+
GatewayTimeoutError,
|
|
168
|
+
};
|
|
169
|
+
//# sourceMappingURL=http.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./base"), exports);
|
|
14
|
+
__exportStar(require("./http"), exports);
|
|
15
|
+
__exportStar(require("./framework"), exports);
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -3,10 +3,12 @@ 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);
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
onConfigLoad(configLoadHandler: ((container: IMidwayContainer, app: IMidwayApplication) => any) | IMidwayContainer, app?: IMidwayApplication): any;
|
|
10
|
+
onReady(readyHandler: ((container: IMidwayContainer, app: IMidwayApplication) => void) | IMidwayContainer, app?: IMidwayApplication): any;
|
|
11
|
+
onStop(stopHandler: ((container: IMidwayContainer, app: IMidwayApplication) => void) | IMidwayContainer, app?: IMidwayApplication): any;
|
|
10
12
|
getConfigurationOptions(): InjectionConfigurationOptions;
|
|
11
13
|
}
|
|
12
14
|
export declare const createConfiguration: (options: InjectionConfigurationOptions) => FunctionalConfiguration;
|
|
@@ -6,13 +6,23 @@ 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
|
+
return this.configLoadHandler(configLoadHandler, app);
|
|
17
|
+
}
|
|
18
|
+
return this;
|
|
9
19
|
}
|
|
10
20
|
onReady(readyHandler, app) {
|
|
11
21
|
if (typeof readyHandler === 'function') {
|
|
12
22
|
this.readyHandler = readyHandler;
|
|
13
23
|
}
|
|
14
24
|
else {
|
|
15
|
-
this.readyHandler(readyHandler, app);
|
|
25
|
+
return this.readyHandler(readyHandler, app);
|
|
16
26
|
}
|
|
17
27
|
return this;
|
|
18
28
|
}
|
|
@@ -21,7 +31,7 @@ class FunctionalConfiguration {
|
|
|
21
31
|
this.stopHandler = stopHandler;
|
|
22
32
|
}
|
|
23
33
|
else {
|
|
24
|
-
this.stopHandler(stopHandler, app);
|
|
34
|
+
return this.stopHandler(stopHandler, app);
|
|
25
35
|
}
|
|
26
36
|
return this;
|
|
27
37
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,25 +1,38 @@
|
|
|
1
|
-
export { ObjectIdentifier, ObjectDefinitionOptions, IManagedInstance, ScopeEnum, MidwayFrameworkType, saveClassMetadata, attachClassMetadata, getClassMetadata, savePropertyDataToClass, attachPropertyDataToClass, getPropertyDataFromClass, listPropertyDataFromClass, savePropertyMetadata, attachPropertyMetadata, getPropertyMetadata, savePreloadModule, listPreloadModule, saveModule, listModule, resetModule, clearAllModule, getParamNames, getProviderId, getObjectDefinition, classNamed, generateProvideId, } from '@midwayjs/decorator';
|
|
2
1
|
export * from './interface';
|
|
3
2
|
export * from './context/container';
|
|
4
3
|
export { MidwayRequestContainer } from './context/requestContainer';
|
|
5
4
|
export { BaseFramework } from './baseFramework';
|
|
6
5
|
export * from './context/providerWrapper';
|
|
7
6
|
export * from './common/constants';
|
|
8
|
-
export { safelyGet, safeRequire, delegateTargetPrototypeMethod } from './util/';
|
|
7
|
+
export { safelyGet, safeRequire, delegateTargetPrototypeMethod, delegateTargetMethod, delegateTargetProperties, deprecatedOutput, transformRequestObjectByType, pathMatching, wrapMiddleware, } from './util/';
|
|
9
8
|
export * from './util/pathFileUtil';
|
|
10
|
-
export * from './features';
|
|
11
9
|
export * from './util/webRouterParam';
|
|
12
|
-
export * from './
|
|
13
|
-
export * from './
|
|
14
|
-
export * from './util/emptyFramework';
|
|
15
|
-
export { plainToClass, classToPlain } from 'class-transformer';
|
|
10
|
+
export * from './common/webRouterCollector';
|
|
11
|
+
export * from './common/triggerCollector';
|
|
16
12
|
export { createConfiguration } from './functional/configuration';
|
|
17
13
|
export { MidwayConfigService } from './service/configService';
|
|
18
14
|
export { MidwayEnvironmentService } from './service/environmentService';
|
|
19
15
|
export { MidwayInformationService } from './service/informationService';
|
|
20
|
-
export
|
|
16
|
+
export { MidwayLoggerService } from './service/loggerService';
|
|
17
|
+
export { MidwayFrameworkService } from './service/frameworkService';
|
|
18
|
+
export { MidwayAspectService } from './service/aspectService';
|
|
19
|
+
export { MidwayLifeCycleService } from './service/lifeCycleService';
|
|
20
|
+
export { MidwayMiddlewareService } from './service/middlewareService';
|
|
21
|
+
export { MidwayDecoratorService } from './service/decoratorService';
|
|
22
|
+
export * from './service/pipelineService';
|
|
21
23
|
export * from './util/contextUtil';
|
|
22
|
-
export * from './
|
|
23
|
-
export * from './
|
|
24
|
-
export * from './
|
|
24
|
+
export * from './common/serviceFactory';
|
|
25
|
+
export * from './common/fileDetector';
|
|
26
|
+
export * from './common/webGenerator';
|
|
27
|
+
export * from './common/middlewareManager';
|
|
28
|
+
export * from './util/pathToRegexp';
|
|
29
|
+
export * from './common/filterManager';
|
|
30
|
+
export * from './common/applicationManager';
|
|
31
|
+
export * from './setup';
|
|
32
|
+
export * from './error';
|
|
33
|
+
/**
|
|
34
|
+
* proxy
|
|
35
|
+
*/
|
|
36
|
+
export { MidwayFrameworkType } from '@midwayjs/decorator';
|
|
37
|
+
export { ILogger, IMidwayLogger } from '@midwayjs/logger';
|
|
25
38
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -10,31 +10,7 @@ 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.
|
|
14
|
-
var decorator_1 = require("@midwayjs/decorator");
|
|
15
|
-
Object.defineProperty(exports, "ScopeEnum", { enumerable: true, get: function () { return decorator_1.ScopeEnum; } });
|
|
16
|
-
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; } });
|
|
13
|
+
exports.MidwayFrameworkType = exports.MidwayDecoratorService = exports.MidwayMiddlewareService = exports.MidwayLifeCycleService = exports.MidwayAspectService = exports.MidwayFrameworkService = exports.MidwayLoggerService = exports.MidwayInformationService = exports.MidwayEnvironmentService = exports.MidwayConfigService = exports.createConfiguration = exports.wrapMiddleware = exports.pathMatching = exports.transformRequestObjectByType = exports.deprecatedOutput = exports.delegateTargetProperties = exports.delegateTargetMethod = exports.delegateTargetPrototypeMethod = exports.safeRequire = exports.safelyGet = exports.BaseFramework = exports.MidwayRequestContainer = void 0;
|
|
38
14
|
__exportStar(require("./interface"), exports);
|
|
39
15
|
__exportStar(require("./context/container"), exports);
|
|
40
16
|
var requestContainer_1 = require("./context/requestContainer");
|
|
@@ -47,15 +23,16 @@ var util_1 = require("./util/");
|
|
|
47
23
|
Object.defineProperty(exports, "safelyGet", { enumerable: true, get: function () { return util_1.safelyGet; } });
|
|
48
24
|
Object.defineProperty(exports, "safeRequire", { enumerable: true, get: function () { return util_1.safeRequire; } });
|
|
49
25
|
Object.defineProperty(exports, "delegateTargetPrototypeMethod", { enumerable: true, get: function () { return util_1.delegateTargetPrototypeMethod; } });
|
|
26
|
+
Object.defineProperty(exports, "delegateTargetMethod", { enumerable: true, get: function () { return util_1.delegateTargetMethod; } });
|
|
27
|
+
Object.defineProperty(exports, "delegateTargetProperties", { enumerable: true, get: function () { return util_1.delegateTargetProperties; } });
|
|
28
|
+
Object.defineProperty(exports, "deprecatedOutput", { enumerable: true, get: function () { return util_1.deprecatedOutput; } });
|
|
29
|
+
Object.defineProperty(exports, "transformRequestObjectByType", { enumerable: true, get: function () { return util_1.transformRequestObjectByType; } });
|
|
30
|
+
Object.defineProperty(exports, "pathMatching", { enumerable: true, get: function () { return util_1.pathMatching; } });
|
|
31
|
+
Object.defineProperty(exports, "wrapMiddleware", { enumerable: true, get: function () { return util_1.wrapMiddleware; } });
|
|
50
32
|
__exportStar(require("./util/pathFileUtil"), exports);
|
|
51
|
-
__exportStar(require("./features"), exports);
|
|
52
33
|
__exportStar(require("./util/webRouterParam"), exports);
|
|
53
|
-
__exportStar(require("./
|
|
54
|
-
__exportStar(require("./
|
|
55
|
-
__exportStar(require("./util/emptyFramework"), exports);
|
|
56
|
-
var class_transformer_1 = require("class-transformer");
|
|
57
|
-
Object.defineProperty(exports, "plainToClass", { enumerable: true, get: function () { return class_transformer_1.plainToClass; } });
|
|
58
|
-
Object.defineProperty(exports, "classToPlain", { enumerable: true, get: function () { return class_transformer_1.classToPlain; } });
|
|
34
|
+
__exportStar(require("./common/webRouterCollector"), exports);
|
|
35
|
+
__exportStar(require("./common/triggerCollector"), exports);
|
|
59
36
|
var configuration_1 = require("./functional/configuration");
|
|
60
37
|
Object.defineProperty(exports, "createConfiguration", { enumerable: true, get: function () { return configuration_1.createConfiguration; } });
|
|
61
38
|
var configService_1 = require("./service/configService");
|
|
@@ -64,9 +41,32 @@ var environmentService_1 = require("./service/environmentService");
|
|
|
64
41
|
Object.defineProperty(exports, "MidwayEnvironmentService", { enumerable: true, get: function () { return environmentService_1.MidwayEnvironmentService; } });
|
|
65
42
|
var informationService_1 = require("./service/informationService");
|
|
66
43
|
Object.defineProperty(exports, "MidwayInformationService", { enumerable: true, get: function () { return informationService_1.MidwayInformationService; } });
|
|
67
|
-
|
|
44
|
+
var loggerService_1 = require("./service/loggerService");
|
|
45
|
+
Object.defineProperty(exports, "MidwayLoggerService", { enumerable: true, get: function () { return loggerService_1.MidwayLoggerService; } });
|
|
46
|
+
var frameworkService_1 = require("./service/frameworkService");
|
|
47
|
+
Object.defineProperty(exports, "MidwayFrameworkService", { enumerable: true, get: function () { return frameworkService_1.MidwayFrameworkService; } });
|
|
48
|
+
var aspectService_1 = require("./service/aspectService");
|
|
49
|
+
Object.defineProperty(exports, "MidwayAspectService", { enumerable: true, get: function () { return aspectService_1.MidwayAspectService; } });
|
|
50
|
+
var lifeCycleService_1 = require("./service/lifeCycleService");
|
|
51
|
+
Object.defineProperty(exports, "MidwayLifeCycleService", { enumerable: true, get: function () { return lifeCycleService_1.MidwayLifeCycleService; } });
|
|
52
|
+
var middlewareService_1 = require("./service/middlewareService");
|
|
53
|
+
Object.defineProperty(exports, "MidwayMiddlewareService", { enumerable: true, get: function () { return middlewareService_1.MidwayMiddlewareService; } });
|
|
54
|
+
var decoratorService_1 = require("./service/decoratorService");
|
|
55
|
+
Object.defineProperty(exports, "MidwayDecoratorService", { enumerable: true, get: function () { return decoratorService_1.MidwayDecoratorService; } });
|
|
56
|
+
__exportStar(require("./service/pipelineService"), exports);
|
|
68
57
|
__exportStar(require("./util/contextUtil"), exports);
|
|
69
|
-
__exportStar(require("./
|
|
70
|
-
__exportStar(require("./
|
|
71
|
-
__exportStar(require("./
|
|
58
|
+
__exportStar(require("./common/serviceFactory"), exports);
|
|
59
|
+
__exportStar(require("./common/fileDetector"), exports);
|
|
60
|
+
__exportStar(require("./common/webGenerator"), exports);
|
|
61
|
+
__exportStar(require("./common/middlewareManager"), exports);
|
|
62
|
+
__exportStar(require("./util/pathToRegexp"), exports);
|
|
63
|
+
__exportStar(require("./common/filterManager"), exports);
|
|
64
|
+
__exportStar(require("./common/applicationManager"), exports);
|
|
65
|
+
__exportStar(require("./setup"), exports);
|
|
66
|
+
__exportStar(require("./error"), exports);
|
|
67
|
+
/**
|
|
68
|
+
* proxy
|
|
69
|
+
*/
|
|
70
|
+
var decorator_1 = require("@midwayjs/decorator");
|
|
71
|
+
Object.defineProperty(exports, "MidwayFrameworkType", { enumerable: true, get: function () { return decorator_1.MidwayFrameworkType; } });
|
|
72
72
|
//# sourceMappingURL=index.js.map
|