@midwayjs/decorator 3.0.0-alpha.6 → 3.0.0-beta.4
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 +43 -0
- package/dist/constant.d.ts +7 -5
- package/dist/constant.js +18 -9
- package/dist/{annotation → decorator/common}/aspect.d.ts +0 -0
- package/dist/{annotation → decorator/common}/aspect.js +5 -4
- package/dist/{annotation → decorator/common}/autoload.d.ts +0 -0
- package/dist/decorator/common/autoload.js +13 -0
- package/dist/{annotation → decorator/common}/configuration.d.ts +0 -0
- package/dist/{annotation → decorator/common}/configuration.js +2 -2
- package/dist/{annotation → decorator/common}/decide.d.ts +0 -0
- package/dist/{annotation → decorator/common}/decide.js +0 -0
- package/dist/decorator/common/filter.d.ts +4 -0
- package/dist/decorator/common/filter.js +30 -0
- package/dist/decorator/common/framework.d.ts +2 -0
- package/dist/decorator/common/framework.js +13 -0
- package/dist/{annotation → decorator/common}/index.d.ts +6 -8
- package/dist/{annotation → decorator/common}/index.js +6 -10
- package/dist/decorator/common/inject.d.ts +3 -0
- package/dist/decorator/common/inject.js +11 -0
- package/dist/decorator/common/middleware.d.ts +2 -0
- package/dist/decorator/common/middleware.js +12 -0
- package/dist/decorator/common/objectDef.d.ts +5 -0
- package/dist/decorator/common/objectDef.js +25 -0
- package/dist/decorator/common/pipeline.d.ts +3 -0
- package/dist/decorator/common/pipeline.js +11 -0
- package/dist/decorator/common/provide.d.ts +3 -0
- package/dist/{annotation → decorator/common}/provide.js +2 -2
- package/dist/{faas/fun.d.ts → decorator/faas/serverlessTrigger.d.ts} +2 -14
- package/dist/decorator/faas/serverlessTrigger.js +29 -0
- package/dist/decorator/framework/index.d.ts +7 -0
- package/dist/decorator/framework/index.js +33 -0
- package/dist/{annotation → decorator/framework}/schedule.d.ts +0 -0
- package/dist/decorator/framework/schedule.js +15 -0
- package/dist/decorator/index.d.ts +18 -0
- package/dist/decorator/index.js +38 -0
- package/dist/{microservice → decorator/microservice}/consumer.d.ts +1 -1
- package/dist/decorator/microservice/consumer.js +17 -0
- package/dist/{microservice → decorator/microservice}/provider.d.ts +1 -1
- package/dist/{microservice → decorator/microservice}/provider.js +9 -8
- package/dist/{microservice → decorator/microservice}/rabbitmqListener.d.ts +0 -0
- package/dist/{microservice → decorator/microservice}/rabbitmqListener.js +2 -2
- package/dist/{rpc → decorator/rpc}/hsf.d.ts +0 -0
- package/dist/decorator/rpc/hsf.js +19 -0
- package/dist/decorator/task/queue.d.ts +2 -0
- package/dist/decorator/task/queue.js +17 -0
- package/dist/{annotation → decorator/task}/task.d.ts +0 -0
- package/dist/{annotation → decorator/task}/task.js +4 -4
- package/dist/{annotation → decorator/task}/taskLocal.d.ts +0 -0
- package/dist/{annotation → decorator/task}/taskLocal.js +4 -4
- package/dist/{web → decorator/web}/controller.d.ts +3 -1
- package/dist/{web → decorator/web}/controller.js +6 -5
- package/dist/{web → decorator/web}/paramMapping.d.ts +10 -10
- package/dist/{web → decorator/web}/paramMapping.js +4 -8
- package/dist/{web → decorator/web}/requestMapping.d.ts +34 -1
- package/dist/{web → decorator/web}/requestMapping.js +5 -3
- package/dist/{web → decorator/web}/response.d.ts +0 -0
- package/dist/{web → decorator/web}/response.js +6 -6
- package/dist/{ws → decorator/ws}/webSocketController.d.ts +1 -1
- package/dist/decorator/ws/webSocketController.js +18 -0
- package/dist/{ws → decorator/ws}/webSocketEvent.d.ts +1 -1
- package/dist/{ws → decorator/ws}/webSocketEvent.js +7 -7
- package/dist/decoratorManager.d.ts +288 -0
- package/dist/{common/decoratorManager.js → decoratorManager.js} +248 -288
- package/dist/index.d.ts +2 -21
- package/dist/index.js +2 -21
- package/dist/interface.d.ts +40 -23
- package/dist/interface.js +31 -17
- package/dist/util/index.d.ts +5 -0
- package/dist/util/index.js +27 -1
- package/package.json +3 -6
- package/dist/annotation/autoload.js +0 -11
- package/dist/annotation/inject.d.ts +0 -3
- package/dist/annotation/inject.js +0 -16
- package/dist/annotation/objectDef.d.ts +0 -7
- package/dist/annotation/objectDef.js +0 -43
- package/dist/annotation/pipeline.d.ts +0 -3
- package/dist/annotation/pipeline.js +0 -27
- package/dist/annotation/priority.d.ts +0 -2
- package/dist/annotation/priority.js +0 -11
- package/dist/annotation/provide.d.ts +0 -3
- package/dist/annotation/queue.d.ts +0 -2
- package/dist/annotation/queue.js +0 -16
- package/dist/annotation/rule.d.ts +0 -1
- package/dist/annotation/rule.js +0 -50
- package/dist/annotation/schedule.js +0 -14
- package/dist/annotation/validate.d.ts +0 -1
- package/dist/annotation/validate.js +0 -36
- package/dist/common/decoratorManager.d.ts +0 -317
- package/dist/common/errMsg.d.ts +0 -4
- package/dist/common/errMsg.js +0 -8
- package/dist/common/metadata.d.ts +0 -9
- package/dist/common/metadata.js +0 -20
- package/dist/common/scopeEnum.d.ts +0 -6
- package/dist/common/scopeEnum.js +0 -10
- package/dist/faas/fun.js +0 -62
- package/dist/faas/handler.d.ts +0 -3
- package/dist/faas/handler.js +0 -21
- package/dist/framework/app.d.ts +0 -3
- package/dist/framework/app.js +0 -22
- package/dist/framework/config.d.ts +0 -2
- package/dist/framework/config.js +0 -25
- package/dist/framework/logger.d.ts +0 -2
- package/dist/framework/logger.js +0 -22
- package/dist/framework/plugin.d.ts +0 -2
- package/dist/framework/plugin.js +0 -22
- package/dist/microservice/consumer.js +0 -17
- package/dist/rpc/hsf.js +0 -18
- package/dist/ws/webSocketController.js +0 -17
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HSFMethod = exports.DubboMethod = exports.GrpcMethod = exports.GrpcStreamTypeEnum = exports.Provider = void 0;
|
|
4
|
-
const __1 = require("
|
|
5
|
-
const
|
|
4
|
+
const __1 = require("../../");
|
|
5
|
+
const common_1 = require("../common");
|
|
6
6
|
function Provider(type, metadata = {}) {
|
|
7
7
|
return (target) => {
|
|
8
|
-
__1.saveModule(__1.MS_PROVIDER_KEY, target);
|
|
9
|
-
__1.saveClassMetadata(__1.MS_PROVIDER_KEY, {
|
|
8
|
+
(0, __1.saveModule)(__1.MS_PROVIDER_KEY, target);
|
|
9
|
+
(0, __1.saveClassMetadata)(__1.MS_PROVIDER_KEY, {
|
|
10
10
|
type,
|
|
11
11
|
metadata,
|
|
12
12
|
}, target);
|
|
13
|
-
|
|
13
|
+
(0, common_1.Scope)(__1.ScopeEnum.Request)(target);
|
|
14
|
+
(0, __1.Provide)()(target);
|
|
14
15
|
};
|
|
15
16
|
}
|
|
16
17
|
exports.Provider = Provider;
|
|
@@ -26,7 +27,7 @@ function GrpcMethod(methodOptions = {}) {
|
|
|
26
27
|
if (!methodOptions.type) {
|
|
27
28
|
methodOptions.type = GrpcStreamTypeEnum.BASE;
|
|
28
29
|
}
|
|
29
|
-
__1.savePropertyMetadata(__1.MS_GRPC_METHOD_KEY, {
|
|
30
|
+
(0, __1.savePropertyMetadata)(__1.MS_GRPC_METHOD_KEY, {
|
|
30
31
|
methodName: methodOptions.methodName || propertyName,
|
|
31
32
|
type: methodOptions.type,
|
|
32
33
|
onEnd: methodOptions.onEnd,
|
|
@@ -37,7 +38,7 @@ function GrpcMethod(methodOptions = {}) {
|
|
|
37
38
|
exports.GrpcMethod = GrpcMethod;
|
|
38
39
|
function DubboMethod(methodName) {
|
|
39
40
|
return (target, propertyName, descriptor) => {
|
|
40
|
-
__1.attachClassMetadata(__1.MS_DUBBO_METHOD_KEY, {
|
|
41
|
+
(0, __1.attachClassMetadata)(__1.MS_DUBBO_METHOD_KEY, {
|
|
41
42
|
methodName: methodName || propertyName,
|
|
42
43
|
}, target);
|
|
43
44
|
return descriptor;
|
|
@@ -46,7 +47,7 @@ function DubboMethod(methodName) {
|
|
|
46
47
|
exports.DubboMethod = DubboMethod;
|
|
47
48
|
function HSFMethod(methodName) {
|
|
48
49
|
return (target, propertyName, descriptor) => {
|
|
49
|
-
__1.attachClassMetadata(__1.MS_HSF_METHOD_KEY, {
|
|
50
|
+
(0, __1.attachClassMetadata)(__1.MS_HSF_METHOD_KEY, {
|
|
50
51
|
methodName: methodName || propertyName,
|
|
51
52
|
}, target);
|
|
52
53
|
return descriptor;
|
|
File without changes
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RabbitMQListener = void 0;
|
|
4
|
-
const __1 = require("
|
|
4
|
+
const __1 = require("../../");
|
|
5
5
|
function RabbitMQListener(queueName, options = {}) {
|
|
6
6
|
return (target, propertyKey) => {
|
|
7
7
|
options.queueName = queueName;
|
|
8
8
|
options.propertyKey = propertyKey;
|
|
9
|
-
__1.attachPropertyDataToClass(__1.MS_CONSUMER_KEY, options, target, propertyKey);
|
|
9
|
+
(0, __1.attachPropertyDataToClass)(__1.MS_CONSUMER_KEY, options, target, propertyKey);
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
12
|
exports.RabbitMQListener = RabbitMQListener;
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HSF = void 0;
|
|
4
|
+
const __1 = require("../../");
|
|
5
|
+
const __2 = require("../");
|
|
6
|
+
/**
|
|
7
|
+
* @param hsfOption
|
|
8
|
+
* @constructor
|
|
9
|
+
*/
|
|
10
|
+
function HSF(hsfOption = {}) {
|
|
11
|
+
return (target) => {
|
|
12
|
+
(0, __1.saveModule)(__1.HSF_KEY, target);
|
|
13
|
+
(0, __1.saveClassMetadata)(__1.HSF_KEY, hsfOption, target);
|
|
14
|
+
(0, __2.Scope)(__1.ScopeEnum.Request)(target);
|
|
15
|
+
(0, __1.Provide)()(target);
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
exports.HSF = HSF;
|
|
19
|
+
//# sourceMappingURL=hsf.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Queue = void 0;
|
|
4
|
+
const __1 = require("../../");
|
|
5
|
+
const constant_1 = require("../../constant");
|
|
6
|
+
function Queue(options) {
|
|
7
|
+
return function (target) {
|
|
8
|
+
(0, __1.saveModule)(constant_1.MODULE_TASK_QUEUE_KEY, target);
|
|
9
|
+
(0, __1.saveClassMetadata)(constant_1.MODULE_TASK_QUEUE_OPTIONS, {
|
|
10
|
+
options,
|
|
11
|
+
name: target.name,
|
|
12
|
+
}, target);
|
|
13
|
+
(0, __1.Provide)()(target);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
exports.Queue = Queue;
|
|
17
|
+
//# sourceMappingURL=queue.js.map
|
|
File without changes
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Task = void 0;
|
|
4
|
-
const __1 = require("
|
|
5
|
-
const constant_1 = require("
|
|
4
|
+
const __1 = require("../../");
|
|
5
|
+
const constant_1 = require("../../constant");
|
|
6
6
|
function Task(options) {
|
|
7
7
|
return function (target, propertyKey, descriptor) {
|
|
8
|
-
__1.saveModule(constant_1.MODULE_TASK_KEY, target.constructor);
|
|
9
|
-
__1.attachClassMetadata(constant_1.MODULE_TASK_METADATA, {
|
|
8
|
+
(0, __1.saveModule)(constant_1.MODULE_TASK_KEY, target.constructor);
|
|
9
|
+
(0, __1.attachClassMetadata)(constant_1.MODULE_TASK_METADATA, {
|
|
10
10
|
options,
|
|
11
11
|
propertyKey,
|
|
12
12
|
value: descriptor.value,
|
|
File without changes
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TaskLocal = void 0;
|
|
4
|
-
const __1 = require("
|
|
5
|
-
const constant_1 = require("
|
|
4
|
+
const __1 = require("../../");
|
|
5
|
+
const constant_1 = require("../../constant");
|
|
6
6
|
function TaskLocal(options) {
|
|
7
7
|
return function (target, propertyKey, descriptor) {
|
|
8
|
-
__1.saveModule(constant_1.MODULE_TASK_TASK_LOCAL_KEY, target.constructor);
|
|
9
|
-
__1.attachClassMetadata(constant_1.MODULE_TASK_TASK_LOCAL_OPTIONS, {
|
|
8
|
+
(0, __1.saveModule)(constant_1.MODULE_TASK_TASK_LOCAL_KEY, target.constructor);
|
|
9
|
+
(0, __1.attachClassMetadata)(constant_1.MODULE_TASK_TASK_LOCAL_OPTIONS, {
|
|
10
10
|
options,
|
|
11
11
|
propertyKey,
|
|
12
12
|
value: descriptor.value,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MiddlewareParamArray } from '
|
|
1
|
+
import { MiddlewareParamArray } from '../../interface';
|
|
2
2
|
export interface ControllerOption {
|
|
3
3
|
prefix: string;
|
|
4
4
|
routerOptions: {
|
|
@@ -7,6 +7,7 @@ export interface ControllerOption {
|
|
|
7
7
|
alias?: string[];
|
|
8
8
|
description?: string;
|
|
9
9
|
tagName?: string;
|
|
10
|
+
ignoreGlobalPrefix?: boolean;
|
|
10
11
|
};
|
|
11
12
|
}
|
|
12
13
|
export declare function Controller(prefix?: string, routerOptions?: {
|
|
@@ -14,5 +15,6 @@ export declare function Controller(prefix?: string, routerOptions?: {
|
|
|
14
15
|
middleware?: MiddlewareParamArray;
|
|
15
16
|
description?: string;
|
|
16
17
|
tagName?: string;
|
|
18
|
+
ignoreGlobalPrefix?: boolean;
|
|
17
19
|
}): ClassDecorator;
|
|
18
20
|
//# sourceMappingURL=controller.d.ts.map
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Controller = void 0;
|
|
4
|
-
const
|
|
5
|
-
const __1 = require("
|
|
4
|
+
const common_1 = require("../common");
|
|
5
|
+
const __1 = require("../../");
|
|
6
6
|
function Controller(prefix = '/', routerOptions = { middleware: [], sensitive: true }) {
|
|
7
7
|
return (target) => {
|
|
8
|
-
__1.saveModule(__1.CONTROLLER_KEY, target);
|
|
8
|
+
(0, __1.saveModule)(__1.CONTROLLER_KEY, target);
|
|
9
9
|
if (prefix)
|
|
10
|
-
__1.saveClassMetadata(__1.CONTROLLER_KEY, {
|
|
10
|
+
(0, __1.saveClassMetadata)(__1.CONTROLLER_KEY, {
|
|
11
11
|
prefix,
|
|
12
12
|
routerOptions,
|
|
13
13
|
}, target);
|
|
14
|
-
|
|
14
|
+
(0, common_1.Scope)(__1.ScopeEnum.Request)(target);
|
|
15
|
+
(0, __1.Provide)()(target);
|
|
15
16
|
};
|
|
16
17
|
}
|
|
17
18
|
exports.Controller = Controller;
|
|
@@ -33,14 +33,14 @@ export interface RouterParamValue {
|
|
|
33
33
|
type: RouteParamTypes;
|
|
34
34
|
propertyData?: any;
|
|
35
35
|
}
|
|
36
|
-
export declare const Session: (property?: string) =>
|
|
37
|
-
export declare const Body: (property?: string) =>
|
|
38
|
-
export declare const Query: (property?: string) =>
|
|
39
|
-
export declare const Param: (property?: string) =>
|
|
40
|
-
export declare const Headers: (property?: string) =>
|
|
41
|
-
export declare const File: (property?: GetFileStreamOptions) =>
|
|
42
|
-
export declare const Files: (property?: GetFilesStreamOptions) =>
|
|
43
|
-
export declare const RequestPath: () =>
|
|
44
|
-
export declare const RequestIP: () =>
|
|
45
|
-
export declare const Queries: (property?: string) =>
|
|
36
|
+
export declare const Session: (property?: string) => ParameterDecorator;
|
|
37
|
+
export declare const Body: (property?: string) => ParameterDecorator;
|
|
38
|
+
export declare const Query: (property?: string) => ParameterDecorator;
|
|
39
|
+
export declare const Param: (property?: string) => ParameterDecorator;
|
|
40
|
+
export declare const Headers: (property?: string) => ParameterDecorator;
|
|
41
|
+
export declare const File: (property?: GetFileStreamOptions) => ParameterDecorator;
|
|
42
|
+
export declare const Files: (property?: GetFilesStreamOptions) => ParameterDecorator;
|
|
43
|
+
export declare const RequestPath: () => ParameterDecorator;
|
|
44
|
+
export declare const RequestIP: () => ParameterDecorator;
|
|
45
|
+
export declare const Queries: (property?: string) => ParameterDecorator;
|
|
46
46
|
//# sourceMappingURL=paramMapping.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Queries = exports.RequestIP = exports.RequestPath = exports.Files = exports.File = exports.Headers = exports.Param = exports.Query = exports.Body = exports.Session = exports.RouteParamTypes = void 0;
|
|
4
|
-
const __1 = require("
|
|
4
|
+
const __1 = require("../../");
|
|
5
5
|
var RouteParamTypes;
|
|
6
6
|
(function (RouteParamTypes) {
|
|
7
7
|
RouteParamTypes[RouteParamTypes["QUERY"] = 0] = "QUERY";
|
|
@@ -17,15 +17,11 @@ var RouteParamTypes;
|
|
|
17
17
|
RouteParamTypes[RouteParamTypes["QUERIES"] = 10] = "QUERIES";
|
|
18
18
|
})(RouteParamTypes = exports.RouteParamTypes || (exports.RouteParamTypes = {}));
|
|
19
19
|
const createParamMapping = function (type) {
|
|
20
|
-
return (propertyData) =>
|
|
21
|
-
|
|
22
|
-
propertyData = __1.getParamNames(target[propertyName])[index];
|
|
23
|
-
}
|
|
24
|
-
__1.attachPropertyDataToClass(__1.WEB_ROUTER_PARAM_KEY, {
|
|
25
|
-
index,
|
|
20
|
+
return (propertyData) => {
|
|
21
|
+
return (0, __1.createCustomParamDecorator)(__1.WEB_ROUTER_PARAM_KEY, {
|
|
26
22
|
type,
|
|
27
23
|
propertyData,
|
|
28
|
-
}
|
|
24
|
+
});
|
|
29
25
|
};
|
|
30
26
|
};
|
|
31
27
|
const Session = (property) => createParamMapping(RouteParamTypes.SESSION)(property);
|
|
@@ -1,12 +1,37 @@
|
|
|
1
|
-
import { MiddlewareParamArray } from '
|
|
1
|
+
import { MiddlewareParamArray } from '../../interface';
|
|
2
2
|
export interface RouterOption {
|
|
3
|
+
/**
|
|
4
|
+
* router path, like "/api"
|
|
5
|
+
*/
|
|
3
6
|
path?: string | RegExp;
|
|
7
|
+
/**
|
|
8
|
+
* http method, like "get", "post"
|
|
9
|
+
*/
|
|
4
10
|
requestMethod: string;
|
|
11
|
+
/**
|
|
12
|
+
* router alias name
|
|
13
|
+
*/
|
|
5
14
|
routerName?: string;
|
|
15
|
+
/**
|
|
16
|
+
* which method decorator attached
|
|
17
|
+
*/
|
|
6
18
|
method?: string;
|
|
19
|
+
/**
|
|
20
|
+
* middleware array in router
|
|
21
|
+
*/
|
|
7
22
|
middleware?: MiddlewareParamArray;
|
|
23
|
+
/**
|
|
24
|
+
* router summary, for swagger
|
|
25
|
+
*/
|
|
8
26
|
summary?: string;
|
|
27
|
+
/**
|
|
28
|
+
* router description, for swagger
|
|
29
|
+
*/
|
|
9
30
|
description?: string;
|
|
31
|
+
/**
|
|
32
|
+
* ignore global prefix
|
|
33
|
+
*/
|
|
34
|
+
ignoreGlobalPrefix?: boolean;
|
|
10
35
|
}
|
|
11
36
|
export declare const RequestMethod: {
|
|
12
37
|
GET: string;
|
|
@@ -27,6 +52,7 @@ export declare const Post: (path?: string | RegExp, routerOptions?: {
|
|
|
27
52
|
middleware?: MiddlewareParamArray;
|
|
28
53
|
summary?: string;
|
|
29
54
|
description?: string;
|
|
55
|
+
ignoreGlobalPrefix?: boolean;
|
|
30
56
|
}) => MethodDecorator;
|
|
31
57
|
/**
|
|
32
58
|
* Routes HTTP GET requests to the specified path.
|
|
@@ -36,6 +62,7 @@ export declare const Get: (path?: string | RegExp, routerOptions?: {
|
|
|
36
62
|
middleware?: MiddlewareParamArray;
|
|
37
63
|
summary?: string;
|
|
38
64
|
description?: string;
|
|
65
|
+
ignoreGlobalPrefix?: boolean;
|
|
39
66
|
}) => MethodDecorator;
|
|
40
67
|
/**
|
|
41
68
|
* Routes HTTP DELETE requests to the specified path.
|
|
@@ -45,6 +72,7 @@ export declare const Del: (path?: string | RegExp, routerOptions?: {
|
|
|
45
72
|
middleware?: MiddlewareParamArray;
|
|
46
73
|
summary?: string;
|
|
47
74
|
description?: string;
|
|
75
|
+
ignoreGlobalPrefix?: boolean;
|
|
48
76
|
}) => MethodDecorator;
|
|
49
77
|
/**
|
|
50
78
|
* Routes HTTP PUT requests to the specified path.
|
|
@@ -54,6 +82,7 @@ export declare const Put: (path?: string | RegExp, routerOptions?: {
|
|
|
54
82
|
middleware?: MiddlewareParamArray;
|
|
55
83
|
summary?: string;
|
|
56
84
|
description?: string;
|
|
85
|
+
ignoreGlobalPrefix?: boolean;
|
|
57
86
|
}) => MethodDecorator;
|
|
58
87
|
/**
|
|
59
88
|
* Routes HTTP PATCH requests to the specified path.
|
|
@@ -63,6 +92,7 @@ export declare const Patch: (path?: string | RegExp, routerOptions?: {
|
|
|
63
92
|
middleware?: MiddlewareParamArray;
|
|
64
93
|
summary?: string;
|
|
65
94
|
description?: string;
|
|
95
|
+
ignoreGlobalPrefix?: boolean;
|
|
66
96
|
}) => MethodDecorator;
|
|
67
97
|
/**
|
|
68
98
|
* Routes HTTP OPTIONS requests to the specified path.
|
|
@@ -72,6 +102,7 @@ export declare const Options: (path?: string | RegExp, routerOptions?: {
|
|
|
72
102
|
middleware?: MiddlewareParamArray;
|
|
73
103
|
summary?: string;
|
|
74
104
|
description?: string;
|
|
105
|
+
ignoreGlobalPrefix?: boolean;
|
|
75
106
|
}) => MethodDecorator;
|
|
76
107
|
/**
|
|
77
108
|
* Routes HTTP HEAD requests to the specified path.
|
|
@@ -81,6 +112,7 @@ export declare const Head: (path?: string | RegExp, routerOptions?: {
|
|
|
81
112
|
middleware?: MiddlewareParamArray;
|
|
82
113
|
summary?: string;
|
|
83
114
|
description?: string;
|
|
115
|
+
ignoreGlobalPrefix?: boolean;
|
|
84
116
|
}) => MethodDecorator;
|
|
85
117
|
/**
|
|
86
118
|
* Routes all HTTP requests to the specified path.
|
|
@@ -90,5 +122,6 @@ export declare const All: (path?: string | RegExp, routerOptions?: {
|
|
|
90
122
|
middleware?: MiddlewareParamArray;
|
|
91
123
|
summary?: string;
|
|
92
124
|
description?: string;
|
|
125
|
+
ignoreGlobalPrefix?: boolean;
|
|
93
126
|
}) => MethodDecorator;
|
|
94
127
|
//# sourceMappingURL=requestMapping.d.ts.map
|
|
@@ -4,7 +4,7 @@ exports.All = exports.Head = exports.Options = exports.Patch = exports.Put = exp
|
|
|
4
4
|
/**
|
|
5
5
|
* 'HEAD', 'OPTIONS', 'GET', 'PUT', 'PATCH', 'POST', 'DELETE' 封装
|
|
6
6
|
*/
|
|
7
|
-
const __1 = require("
|
|
7
|
+
const __1 = require("../../");
|
|
8
8
|
exports.RequestMethod = {
|
|
9
9
|
GET: 'get',
|
|
10
10
|
POST: 'post',
|
|
@@ -27,7 +27,8 @@ const RequestMapping = (metadata = defaultMetadata) => {
|
|
|
27
27
|
const routerName = metadata.routerName;
|
|
28
28
|
const middleware = metadata.middleware;
|
|
29
29
|
return (target, key, descriptor) => {
|
|
30
|
-
|
|
30
|
+
var _a;
|
|
31
|
+
(0, __1.attachClassMetadata)(__1.WEB_ROUTER_KEY, {
|
|
31
32
|
path,
|
|
32
33
|
requestMethod,
|
|
33
34
|
routerName,
|
|
@@ -35,13 +36,14 @@ const RequestMapping = (metadata = defaultMetadata) => {
|
|
|
35
36
|
middleware,
|
|
36
37
|
summary: (metadata === null || metadata === void 0 ? void 0 : metadata.summary) || '',
|
|
37
38
|
description: (metadata === null || metadata === void 0 ? void 0 : metadata.description) || '',
|
|
39
|
+
ignoreGlobalPrefix: (_a = metadata === null || metadata === void 0 ? void 0 : metadata.ignoreGlobalPrefix) !== null && _a !== void 0 ? _a : false,
|
|
38
40
|
}, target);
|
|
39
41
|
return descriptor;
|
|
40
42
|
};
|
|
41
43
|
};
|
|
42
44
|
exports.RequestMapping = RequestMapping;
|
|
43
45
|
const createMappingDecorator = (method) => (path, routerOptions = { middleware: [] }) => {
|
|
44
|
-
return exports.RequestMapping(Object.assign(routerOptions, {
|
|
46
|
+
return (0, exports.RequestMapping)(Object.assign(routerOptions, {
|
|
45
47
|
requestMethod: method,
|
|
46
48
|
path,
|
|
47
49
|
}));
|
|
File without changes
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createRender = exports.ContentType = exports.SetHeader = exports.HttpCode = exports.Redirect = void 0;
|
|
4
|
-
const __1 = require("
|
|
4
|
+
const __1 = require("../../");
|
|
5
5
|
function Redirect(url, code = 302) {
|
|
6
6
|
return (target, key, descriptor) => {
|
|
7
|
-
__1.attachPropertyMetadata(__1.WEB_RESPONSE_KEY, {
|
|
7
|
+
(0, __1.attachPropertyMetadata)(__1.WEB_RESPONSE_KEY, {
|
|
8
8
|
type: __1.WEB_RESPONSE_REDIRECT,
|
|
9
9
|
url,
|
|
10
10
|
code,
|
|
@@ -15,7 +15,7 @@ function Redirect(url, code = 302) {
|
|
|
15
15
|
exports.Redirect = Redirect;
|
|
16
16
|
function HttpCode(code) {
|
|
17
17
|
return (target, key, descriptor) => {
|
|
18
|
-
__1.attachPropertyMetadata(__1.WEB_RESPONSE_KEY, {
|
|
18
|
+
(0, __1.attachPropertyMetadata)(__1.WEB_RESPONSE_KEY, {
|
|
19
19
|
type: __1.WEB_RESPONSE_HTTP_CODE,
|
|
20
20
|
code,
|
|
21
21
|
}, target, key);
|
|
@@ -32,7 +32,7 @@ function SetHeader(headerKey, value) {
|
|
|
32
32
|
else {
|
|
33
33
|
headerObject = headerKey;
|
|
34
34
|
}
|
|
35
|
-
__1.attachPropertyMetadata(__1.WEB_RESPONSE_KEY, {
|
|
35
|
+
(0, __1.attachPropertyMetadata)(__1.WEB_RESPONSE_KEY, {
|
|
36
36
|
type: __1.WEB_RESPONSE_HEADER,
|
|
37
37
|
setHeaders: headerObject,
|
|
38
38
|
}, target, key);
|
|
@@ -42,7 +42,7 @@ function SetHeader(headerKey, value) {
|
|
|
42
42
|
exports.SetHeader = SetHeader;
|
|
43
43
|
function ContentType(contentType) {
|
|
44
44
|
return (target, key, descriptor) => {
|
|
45
|
-
__1.attachPropertyMetadata(__1.WEB_RESPONSE_KEY, {
|
|
45
|
+
(0, __1.attachPropertyMetadata)(__1.WEB_RESPONSE_KEY, {
|
|
46
46
|
type: __1.WEB_RESPONSE_CONTENT_TYPE,
|
|
47
47
|
contentType,
|
|
48
48
|
}, target, key);
|
|
@@ -53,7 +53,7 @@ exports.ContentType = ContentType;
|
|
|
53
53
|
function createRender(RenderEngine) {
|
|
54
54
|
return (templateName) => {
|
|
55
55
|
return (target, key, descriptor) => {
|
|
56
|
-
__1.attachPropertyMetadata(__1.WEB_RESPONSE_KEY, {
|
|
56
|
+
(0, __1.attachPropertyMetadata)(__1.WEB_RESPONSE_KEY, {
|
|
57
57
|
type: __1.WEB_RESPONSE_RENDER,
|
|
58
58
|
templateName,
|
|
59
59
|
}, target, key);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WSController = void 0;
|
|
4
|
+
const common_1 = require("../common");
|
|
5
|
+
const __1 = require("../../");
|
|
6
|
+
function WSController(namespace = '/', routerOptions = { middleware: [] }) {
|
|
7
|
+
return (target) => {
|
|
8
|
+
(0, __1.saveModule)(__1.WS_CONTROLLER_KEY, target);
|
|
9
|
+
(0, __1.saveClassMetadata)(__1.WS_CONTROLLER_KEY, {
|
|
10
|
+
namespace,
|
|
11
|
+
routerOptions,
|
|
12
|
+
}, target);
|
|
13
|
+
(0, common_1.Scope)(__1.ScopeEnum.Request)(target);
|
|
14
|
+
(0, __1.Provide)()(target);
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
exports.WSController = WSController;
|
|
18
|
+
//# sourceMappingURL=webSocketController.js.map
|
|
@@ -31,7 +31,7 @@ export declare function OnWSMessage(eventName: string): MethodDecorator;
|
|
|
31
31
|
export declare function WSEmit(messageName: string, roomName?: string | string[]): MethodDecorator;
|
|
32
32
|
export declare function WSBroadCast(messageName?: string, roomName?: string | string[]): MethodDecorator;
|
|
33
33
|
/**
|
|
34
|
-
* @deprecated please use @
|
|
34
|
+
* @deprecated please use @OnWSMessage
|
|
35
35
|
*/
|
|
36
36
|
export declare const OnMessage: typeof OnWSMessage;
|
|
37
37
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OnConnection = exports.OnDisConnection = exports.Emit = exports.OnMessage = exports.WSBroadCast = exports.WSEmit = exports.OnWSMessage = exports.OnWSDisConnection = exports.OnWSConnection = exports.WSEventTypeEnum = void 0;
|
|
4
|
-
const __1 = require("
|
|
4
|
+
const __1 = require("../../");
|
|
5
5
|
var WSEventTypeEnum;
|
|
6
6
|
(function (WSEventTypeEnum) {
|
|
7
7
|
WSEventTypeEnum["ON_CONNECTION"] = "ws:onConnection";
|
|
@@ -13,7 +13,7 @@ var WSEventTypeEnum;
|
|
|
13
13
|
})(WSEventTypeEnum = exports.WSEventTypeEnum || (exports.WSEventTypeEnum = {}));
|
|
14
14
|
function OnWSConnection() {
|
|
15
15
|
return (target, propertyKey, descriptor) => {
|
|
16
|
-
__1.attachClassMetadata(__1.WS_EVENT_KEY, {
|
|
16
|
+
(0, __1.attachClassMetadata)(__1.WS_EVENT_KEY, {
|
|
17
17
|
eventType: WSEventTypeEnum.ON_CONNECTION,
|
|
18
18
|
propertyName: propertyKey,
|
|
19
19
|
descriptor,
|
|
@@ -23,7 +23,7 @@ function OnWSConnection() {
|
|
|
23
23
|
exports.OnWSConnection = OnWSConnection;
|
|
24
24
|
function OnWSDisConnection() {
|
|
25
25
|
return (target, propertyKey, descriptor) => {
|
|
26
|
-
__1.attachClassMetadata(__1.WS_EVENT_KEY, {
|
|
26
|
+
(0, __1.attachClassMetadata)(__1.WS_EVENT_KEY, {
|
|
27
27
|
eventType: WSEventTypeEnum.ON_DISCONNECTION,
|
|
28
28
|
propertyName: propertyKey,
|
|
29
29
|
descriptor,
|
|
@@ -33,7 +33,7 @@ function OnWSDisConnection() {
|
|
|
33
33
|
exports.OnWSDisConnection = OnWSDisConnection;
|
|
34
34
|
function OnWSMessage(eventName) {
|
|
35
35
|
return (target, propertyKey, descriptor) => {
|
|
36
|
-
__1.attachClassMetadata(__1.WS_EVENT_KEY, {
|
|
36
|
+
(0, __1.attachClassMetadata)(__1.WS_EVENT_KEY, {
|
|
37
37
|
eventType: WSEventTypeEnum.ON_MESSAGE,
|
|
38
38
|
messageEventName: eventName,
|
|
39
39
|
propertyName: propertyKey,
|
|
@@ -44,7 +44,7 @@ function OnWSMessage(eventName) {
|
|
|
44
44
|
exports.OnWSMessage = OnWSMessage;
|
|
45
45
|
function WSEmit(messageName, roomName = []) {
|
|
46
46
|
return (target, propertyKey, descriptor) => {
|
|
47
|
-
__1.attachClassMetadata(__1.WS_EVENT_KEY, {
|
|
47
|
+
(0, __1.attachClassMetadata)(__1.WS_EVENT_KEY, {
|
|
48
48
|
eventType: WSEventTypeEnum.EMIT,
|
|
49
49
|
propertyName: propertyKey,
|
|
50
50
|
messageEventName: messageName,
|
|
@@ -56,7 +56,7 @@ function WSEmit(messageName, roomName = []) {
|
|
|
56
56
|
exports.WSEmit = WSEmit;
|
|
57
57
|
function WSBroadCast(messageName = '', roomName = []) {
|
|
58
58
|
return (target, propertyKey, descriptor) => {
|
|
59
|
-
__1.attachClassMetadata(__1.WS_EVENT_KEY, {
|
|
59
|
+
(0, __1.attachClassMetadata)(__1.WS_EVENT_KEY, {
|
|
60
60
|
eventType: WSEventTypeEnum.BROADCAST,
|
|
61
61
|
propertyName: propertyKey,
|
|
62
62
|
messageEventName: messageName,
|
|
@@ -67,7 +67,7 @@ function WSBroadCast(messageName = '', roomName = []) {
|
|
|
67
67
|
}
|
|
68
68
|
exports.WSBroadCast = WSBroadCast;
|
|
69
69
|
/**
|
|
70
|
-
* @deprecated please use @
|
|
70
|
+
* @deprecated please use @OnWSMessage
|
|
71
71
|
*/
|
|
72
72
|
exports.OnMessage = OnWSMessage;
|
|
73
73
|
/**
|