@midwayjs/decorator 3.4.4 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/dist/index.d.ts +3 -7
  2. package/dist/index.js +14 -12
  3. package/package.json +3 -3
  4. package/dist/constant.d.ts +0 -54
  5. package/dist/constant.js +0 -85
  6. package/dist/decorator/common/aspect.d.ts +0 -20
  7. package/dist/decorator/common/aspect.js +0 -22
  8. package/dist/decorator/common/autoload.d.ts +0 -2
  9. package/dist/decorator/common/autoload.js +0 -13
  10. package/dist/decorator/common/configuration.d.ts +0 -24
  11. package/dist/decorator/common/configuration.js +0 -11
  12. package/dist/decorator/common/filter.d.ts +0 -6
  13. package/dist/decorator/common/filter.js +0 -31
  14. package/dist/decorator/common/framework.d.ts +0 -2
  15. package/dist/decorator/common/framework.js +0 -13
  16. package/dist/decorator/common/index.d.ts +0 -11
  17. package/dist/decorator/common/index.js +0 -27
  18. package/dist/decorator/common/inject.d.ts +0 -3
  19. package/dist/decorator/common/inject.js +0 -11
  20. package/dist/decorator/common/middleware.d.ts +0 -2
  21. package/dist/decorator/common/middleware.js +0 -12
  22. package/dist/decorator/common/objectDef.d.ts +0 -7
  23. package/dist/decorator/common/objectDef.js +0 -25
  24. package/dist/decorator/common/pipeline.d.ts +0 -3
  25. package/dist/decorator/common/pipeline.js +0 -11
  26. package/dist/decorator/common/provide.d.ts +0 -3
  27. package/dist/decorator/common/provide.js +0 -11
  28. package/dist/decorator/faas/serverlessTrigger.d.ts +0 -13
  29. package/dist/decorator/faas/serverlessTrigger.js +0 -29
  30. package/dist/decorator/framework/index.d.ts +0 -7
  31. package/dist/decorator/framework/index.js +0 -33
  32. package/dist/decorator/framework/schedule.d.ts +0 -21
  33. package/dist/decorator/framework/schedule.js +0 -15
  34. package/dist/decorator/index.d.ts +0 -19
  35. package/dist/decorator/index.js +0 -43
  36. package/dist/decorator/microservice/consumer.d.ts +0 -5
  37. package/dist/decorator/microservice/consumer.js +0 -18
  38. package/dist/decorator/microservice/kafkaListener.d.ts +0 -6
  39. package/dist/decorator/microservice/kafkaListener.js +0 -13
  40. package/dist/decorator/microservice/provider.d.ts +0 -16
  41. package/dist/decorator/microservice/provider.js +0 -48
  42. package/dist/decorator/microservice/rabbitmqListener.d.ts +0 -50
  43. package/dist/decorator/microservice/rabbitmqListener.js +0 -13
  44. package/dist/decorator/rpc/hsf.d.ts +0 -12
  45. package/dist/decorator/rpc/hsf.js +0 -19
  46. package/dist/decorator/task/queue.d.ts +0 -2
  47. package/dist/decorator/task/queue.js +0 -17
  48. package/dist/decorator/task/task.d.ts +0 -2
  49. package/dist/decorator/task/task.js +0 -18
  50. package/dist/decorator/task/taskLocal.d.ts +0 -2
  51. package/dist/decorator/task/taskLocal.js +0 -17
  52. package/dist/decorator/web/controller.d.ts +0 -20
  53. package/dist/decorator/web/controller.js +0 -19
  54. package/dist/decorator/web/paramMapping.d.ts +0 -31
  55. package/dist/decorator/web/paramMapping.js +0 -50
  56. package/dist/decorator/web/requestMapping.d.ts +0 -129
  57. package/dist/decorator/web/requestMapping.js +0 -83
  58. package/dist/decorator/web/response.d.ts +0 -9
  59. package/dist/decorator/web/response.js +0 -65
  60. package/dist/decorator/ws/webSocketController.d.ts +0 -10
  61. package/dist/decorator/ws/webSocketController.js +0 -21
  62. package/dist/decorator/ws/webSocketEvent.d.ts +0 -60
  63. package/dist/decorator/ws/webSocketEvent.js +0 -87
  64. package/dist/decoratorManager.d.ts +0 -301
  65. package/dist/decoratorManager.js +0 -708
  66. package/dist/interface.d.ts +0 -238
  67. package/dist/interface.js +0 -67
  68. package/dist/util/camelCase.d.ts +0 -3
  69. package/dist/util/camelCase.js +0 -88
  70. package/dist/util/flatted.d.ts +0 -7
  71. package/dist/util/flatted.js +0 -91
  72. package/dist/util/format.d.ts +0 -25
  73. package/dist/util/format.js +0 -38
  74. package/dist/util/fs.d.ts +0 -5
  75. package/dist/util/fs.js +0 -15
  76. package/dist/util/index.d.ts +0 -62
  77. package/dist/util/index.js +0 -200
  78. package/dist/util/uuid.d.ts +0 -5
  79. package/dist/util/uuid.js +0 -64
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Schedule = void 0;
4
- const __1 = require("../../");
5
- const common_1 = require("../common");
6
- function Schedule(scheduleOpts) {
7
- return function (target) {
8
- (0, __1.saveModule)(__1.SCHEDULE_KEY, target);
9
- (0, __1.saveClassMetadata)(__1.SCHEDULE_KEY, scheduleOpts, target);
10
- (0, common_1.Scope)(__1.ScopeEnum.Request)(target);
11
- (0, __1.Provide)()(target);
12
- };
13
- }
14
- exports.Schedule = Schedule;
15
- //# sourceMappingURL=schedule.js.map
@@ -1,19 +0,0 @@
1
- export * from './common/index';
2
- export * from './faas/serverlessTrigger';
3
- export * from './framework/index';
4
- export * from './framework/schedule';
5
- export * from './microservice/consumer';
6
- export * from './microservice/provider';
7
- export * from './microservice/rabbitmqListener';
8
- export * from './microservice/kafkaListener';
9
- export * from './rpc/hsf';
10
- export * from './task/queue';
11
- export * from './task/task';
12
- export * from './task/taskLocal';
13
- export * from './web/controller';
14
- export * from './web/paramMapping';
15
- export * from './web/requestMapping';
16
- export * from './web/response';
17
- export * from './ws/webSocketController';
18
- export * from './ws/webSocketEvent';
19
- //# sourceMappingURL=index.d.ts.map
@@ -1,43 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- // common
18
- __exportStar(require("./common/index"), exports);
19
- // faas
20
- __exportStar(require("./faas/serverlessTrigger"), exports);
21
- // framework
22
- __exportStar(require("./framework/index"), exports);
23
- __exportStar(require("./framework/schedule"), exports);
24
- // microservice
25
- __exportStar(require("./microservice/consumer"), exports);
26
- __exportStar(require("./microservice/provider"), exports);
27
- __exportStar(require("./microservice/rabbitmqListener"), exports);
28
- __exportStar(require("./microservice/kafkaListener"), exports);
29
- // rpc
30
- __exportStar(require("./rpc/hsf"), exports);
31
- // task
32
- __exportStar(require("./task/queue"), exports);
33
- __exportStar(require("./task/task"), exports);
34
- __exportStar(require("./task/taskLocal"), exports);
35
- // web
36
- __exportStar(require("./web/controller"), exports);
37
- __exportStar(require("./web/paramMapping"), exports);
38
- __exportStar(require("./web/requestMapping"), exports);
39
- __exportStar(require("./web/response"), exports);
40
- // ws
41
- __exportStar(require("./ws/webSocketController"), exports);
42
- __exportStar(require("./ws/webSocketEvent"), exports);
43
- //# sourceMappingURL=index.js.map
@@ -1,5 +0,0 @@
1
- import { MSListenerType } from '../../';
2
- export declare function Consumer(type: MSListenerType.MQTT): ClassDecorator;
3
- export declare function Consumer(type: MSListenerType.RABBITMQ, options?: any): ClassDecorator;
4
- export declare function Consumer(type: MSListenerType.KAFKA, options?: any): ClassDecorator;
5
- //# sourceMappingURL=consumer.d.ts.map
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Consumer = void 0;
4
- const __1 = require("../../");
5
- const common_1 = require("../common");
6
- function Consumer(type, options = {}) {
7
- return (target) => {
8
- (0, __1.saveModule)(__1.MS_CONSUMER_KEY, target);
9
- (0, __1.saveClassMetadata)(__1.MS_CONSUMER_KEY, {
10
- type,
11
- metadata: options,
12
- }, target);
13
- (0, common_1.Scope)(__1.ScopeEnum.Request)(target);
14
- (0, __1.Provide)()(target);
15
- };
16
- }
17
- exports.Consumer = Consumer;
18
- //# sourceMappingURL=consumer.js.map
@@ -1,6 +0,0 @@
1
- export interface KafkaListenerOptions {
2
- propertyKey?: string;
3
- topic?: string;
4
- }
5
- export declare function KafkaListener(topic: string, options?: KafkaListenerOptions): MethodDecorator;
6
- //# sourceMappingURL=kafkaListener.d.ts.map
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KafkaListener = void 0;
4
- const __1 = require("../..");
5
- function KafkaListener(topic, options = {}) {
6
- return (target, propertyKey) => {
7
- options.topic = topic;
8
- options.propertyKey = propertyKey;
9
- (0, __1.attachPropertyDataToClass)(__1.MS_CONSUMER_KEY, options, target, propertyKey);
10
- };
11
- }
12
- exports.KafkaListener = KafkaListener;
13
- //# sourceMappingURL=kafkaListener.js.map
@@ -1,16 +0,0 @@
1
- import { MSProviderType, GRPCMetadata } from '../../';
2
- export declare function Provider(type: MSProviderType.GRPC, metadata?: GRPCMetadata.ProviderOptions): ClassDecorator;
3
- export declare function Provider(type: MSProviderType.DUBBO, metadata?: any): ClassDecorator;
4
- export declare enum GrpcStreamTypeEnum {
5
- BASE = "base",
6
- DUPLEX = "ServerDuplexStream",
7
- READABLE = "ServerReadableStream",
8
- WRITEABLE = "ServerWritableStream"
9
- }
10
- export declare function GrpcMethod(methodOptions?: {
11
- methodName?: string;
12
- type?: GrpcStreamTypeEnum;
13
- onEnd?: string;
14
- }): MethodDecorator;
15
- export declare function DubboMethod(methodName?: string): MethodDecorator;
16
- //# sourceMappingURL=provider.d.ts.map
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DubboMethod = exports.GrpcMethod = exports.GrpcStreamTypeEnum = exports.Provider = void 0;
4
- const __1 = require("../../");
5
- const common_1 = require("../common");
6
- function Provider(type, metadata = {}) {
7
- return (target) => {
8
- (0, __1.saveModule)(__1.MS_PROVIDER_KEY, target);
9
- (0, __1.saveClassMetadata)(__1.MS_PROVIDER_KEY, {
10
- type,
11
- metadata,
12
- }, target);
13
- (0, common_1.Scope)(__1.ScopeEnum.Request)(target);
14
- (0, __1.Provide)()(target);
15
- };
16
- }
17
- exports.Provider = Provider;
18
- var GrpcStreamTypeEnum;
19
- (function (GrpcStreamTypeEnum) {
20
- GrpcStreamTypeEnum["BASE"] = "base";
21
- GrpcStreamTypeEnum["DUPLEX"] = "ServerDuplexStream";
22
- GrpcStreamTypeEnum["READABLE"] = "ServerReadableStream";
23
- GrpcStreamTypeEnum["WRITEABLE"] = "ServerWritableStream";
24
- })(GrpcStreamTypeEnum = exports.GrpcStreamTypeEnum || (exports.GrpcStreamTypeEnum = {}));
25
- function GrpcMethod(methodOptions = {}) {
26
- return (target, propertyName, descriptor) => {
27
- if (!methodOptions.type) {
28
- methodOptions.type = GrpcStreamTypeEnum.BASE;
29
- }
30
- (0, __1.savePropertyMetadata)(__1.MS_GRPC_METHOD_KEY, {
31
- methodName: methodOptions.methodName || propertyName,
32
- type: methodOptions.type,
33
- onEnd: methodOptions.onEnd,
34
- }, target, propertyName);
35
- return descriptor;
36
- };
37
- }
38
- exports.GrpcMethod = GrpcMethod;
39
- function DubboMethod(methodName) {
40
- return (target, propertyName, descriptor) => {
41
- (0, __1.attachClassMetadata)(__1.MS_DUBBO_METHOD_KEY, {
42
- methodName: methodName || propertyName,
43
- }, target);
44
- return descriptor;
45
- };
46
- }
47
- exports.DubboMethod = DubboMethod;
48
- //# sourceMappingURL=provider.js.map
@@ -1,50 +0,0 @@
1
- export interface RabbitMQListenerOptions {
2
- propertyKey?: string;
3
- queueName?: string;
4
- exchange?: string;
5
- /**
6
- * queue options
7
- */
8
- exclusive?: boolean;
9
- durable?: boolean;
10
- autoDelete?: boolean;
11
- messageTtl?: number;
12
- expires?: number;
13
- deadLetterExchange?: string;
14
- deadLetterRoutingKey?: string;
15
- maxLength?: number;
16
- maxPriority?: number;
17
- pattern?: string;
18
- /**
19
- * prefetch
20
- */
21
- prefetch?: number;
22
- /**
23
- * router
24
- */
25
- routingKey?: string;
26
- /**
27
- * exchange options
28
- */
29
- exchangeOptions?: {
30
- type?: 'direct' | 'topic' | 'headers' | 'fanout' | 'match' | string;
31
- durable?: boolean;
32
- internal?: boolean;
33
- autoDelete?: boolean;
34
- alternateExchange?: string;
35
- arguments?: any;
36
- };
37
- /**
38
- * consumeOptions
39
- */
40
- consumeOptions?: {
41
- consumerTag?: string;
42
- noLocal?: boolean;
43
- noAck?: boolean;
44
- exclusive?: boolean;
45
- priority?: number;
46
- arguments?: any;
47
- };
48
- }
49
- export declare function RabbitMQListener(queueName: string, options?: RabbitMQListenerOptions): MethodDecorator;
50
- //# sourceMappingURL=rabbitmqListener.d.ts.map
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RabbitMQListener = void 0;
4
- const __1 = require("../../");
5
- function RabbitMQListener(queueName, options = {}) {
6
- return (target, propertyKey) => {
7
- options.queueName = queueName;
8
- options.propertyKey = propertyKey;
9
- (0, __1.attachPropertyDataToClass)(__1.MS_CONSUMER_KEY, options, target, propertyKey);
10
- };
11
- }
12
- exports.RabbitMQListener = RabbitMQListener;
13
- //# sourceMappingURL=rabbitmqListener.js.map
@@ -1,12 +0,0 @@
1
- export interface HSFOpts {
2
- interfaceName?: string;
3
- version?: string;
4
- group?: string;
5
- namespace?: string;
6
- }
7
- /**
8
- * @param hsfOption
9
- * @constructor
10
- */
11
- export declare function HSF(hsfOption?: HSFOpts): ClassDecorator;
12
- //# sourceMappingURL=hsf.d.ts.map
@@ -1,19 +0,0 @@
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
@@ -1,2 +0,0 @@
1
- export declare function Queue(options?: any): ClassDecorator;
2
- //# sourceMappingURL=queue.d.ts.map
@@ -1,17 +0,0 @@
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
@@ -1,2 +0,0 @@
1
- export declare function Task(options: any): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
2
- //# sourceMappingURL=task.d.ts.map
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Task = void 0;
4
- const __1 = require("../../");
5
- const constant_1 = require("../../constant");
6
- function Task(options) {
7
- return function (target, propertyKey, descriptor) {
8
- (0, __1.saveModule)(constant_1.MODULE_TASK_KEY, target.constructor);
9
- (0, __1.attachClassMetadata)(constant_1.MODULE_TASK_METADATA, {
10
- options,
11
- propertyKey,
12
- value: descriptor.value,
13
- name: target.constructor.name,
14
- }, target);
15
- };
16
- }
17
- exports.Task = Task;
18
- //# sourceMappingURL=task.js.map
@@ -1,2 +0,0 @@
1
- export declare function TaskLocal(options: any): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
2
- //# sourceMappingURL=taskLocal.d.ts.map
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TaskLocal = void 0;
4
- const __1 = require("../../");
5
- const constant_1 = require("../../constant");
6
- function TaskLocal(options) {
7
- return function (target, propertyKey, descriptor) {
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
- options,
11
- propertyKey,
12
- value: descriptor.value,
13
- }, target);
14
- };
15
- }
16
- exports.TaskLocal = TaskLocal;
17
- //# sourceMappingURL=taskLocal.js.map
@@ -1,20 +0,0 @@
1
- import { MiddlewareParamArray } from '../../interface';
2
- export interface ControllerOption {
3
- prefix: string;
4
- routerOptions: {
5
- sensitive?: boolean;
6
- middleware?: MiddlewareParamArray;
7
- alias?: string[];
8
- description?: string;
9
- tagName?: string;
10
- ignoreGlobalPrefix?: boolean;
11
- };
12
- }
13
- export declare function Controller(prefix?: string, routerOptions?: {
14
- sensitive?: boolean;
15
- middleware?: MiddlewareParamArray;
16
- description?: string;
17
- tagName?: string;
18
- ignoreGlobalPrefix?: boolean;
19
- }): ClassDecorator;
20
- //# sourceMappingURL=controller.d.ts.map
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Controller = void 0;
4
- const common_1 = require("../common");
5
- const __1 = require("../../");
6
- function Controller(prefix = '/', routerOptions = { middleware: [], sensitive: true }) {
7
- return (target) => {
8
- (0, __1.saveModule)(__1.CONTROLLER_KEY, target);
9
- if (prefix)
10
- (0, __1.saveClassMetadata)(__1.CONTROLLER_KEY, {
11
- prefix,
12
- routerOptions,
13
- }, target);
14
- (0, common_1.Scope)(__1.ScopeEnum.Request)(target);
15
- (0, __1.Provide)()(target);
16
- };
17
- }
18
- exports.Controller = Controller;
19
- //# sourceMappingURL=controller.js.map
@@ -1,31 +0,0 @@
1
- export declare enum RouteParamTypes {
2
- QUERY = 0,
3
- BODY = 1,
4
- PARAM = 2,
5
- HEADERS = 3,
6
- SESSION = 4,
7
- FILESTREAM = 5,
8
- FILESSTREAM = 6,
9
- NEXT = 7,
10
- REQUEST_PATH = 8,
11
- REQUEST_IP = 9,
12
- QUERIES = 10,
13
- FIELDS = 11
14
- }
15
- export interface RouterParamValue {
16
- index: number;
17
- type: RouteParamTypes;
18
- propertyData?: any;
19
- }
20
- export declare const Session: (property?: string) => ParameterDecorator;
21
- export declare const Body: (property?: string) => ParameterDecorator;
22
- export declare const Query: (property?: string) => ParameterDecorator;
23
- export declare const Param: (property?: string) => ParameterDecorator;
24
- export declare const Headers: (property?: string) => ParameterDecorator;
25
- export declare const File: (property?: any) => ParameterDecorator;
26
- export declare const Files: (property?: any) => ParameterDecorator;
27
- export declare const RequestPath: () => ParameterDecorator;
28
- export declare const RequestIP: () => ParameterDecorator;
29
- export declare const Queries: (property?: string) => ParameterDecorator;
30
- export declare const Fields: (property?: string) => ParameterDecorator;
31
- //# sourceMappingURL=paramMapping.d.ts.map
@@ -1,50 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Fields = 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("../../");
5
- var RouteParamTypes;
6
- (function (RouteParamTypes) {
7
- RouteParamTypes[RouteParamTypes["QUERY"] = 0] = "QUERY";
8
- RouteParamTypes[RouteParamTypes["BODY"] = 1] = "BODY";
9
- RouteParamTypes[RouteParamTypes["PARAM"] = 2] = "PARAM";
10
- RouteParamTypes[RouteParamTypes["HEADERS"] = 3] = "HEADERS";
11
- RouteParamTypes[RouteParamTypes["SESSION"] = 4] = "SESSION";
12
- RouteParamTypes[RouteParamTypes["FILESTREAM"] = 5] = "FILESTREAM";
13
- RouteParamTypes[RouteParamTypes["FILESSTREAM"] = 6] = "FILESSTREAM";
14
- RouteParamTypes[RouteParamTypes["NEXT"] = 7] = "NEXT";
15
- RouteParamTypes[RouteParamTypes["REQUEST_PATH"] = 8] = "REQUEST_PATH";
16
- RouteParamTypes[RouteParamTypes["REQUEST_IP"] = 9] = "REQUEST_IP";
17
- RouteParamTypes[RouteParamTypes["QUERIES"] = 10] = "QUERIES";
18
- RouteParamTypes[RouteParamTypes["FIELDS"] = 11] = "FIELDS";
19
- })(RouteParamTypes = exports.RouteParamTypes || (exports.RouteParamTypes = {}));
20
- const createParamMapping = function (type) {
21
- return (propertyData) => {
22
- return (0, __1.createCustomParamDecorator)(__1.WEB_ROUTER_PARAM_KEY, {
23
- type,
24
- propertyData,
25
- });
26
- };
27
- };
28
- const Session = (property) => createParamMapping(RouteParamTypes.SESSION)(property);
29
- exports.Session = Session;
30
- const Body = (property) => createParamMapping(RouteParamTypes.BODY)(property);
31
- exports.Body = Body;
32
- const Query = (property) => createParamMapping(RouteParamTypes.QUERY)(property);
33
- exports.Query = Query;
34
- const Param = (property) => createParamMapping(RouteParamTypes.PARAM)(property);
35
- exports.Param = Param;
36
- const Headers = (property) => createParamMapping(RouteParamTypes.HEADERS)(property);
37
- exports.Headers = Headers;
38
- const File = (property) => createParamMapping(RouteParamTypes.FILESTREAM)(property);
39
- exports.File = File;
40
- const Files = (property) => createParamMapping(RouteParamTypes.FILESSTREAM)(property);
41
- exports.Files = Files;
42
- const RequestPath = () => createParamMapping(RouteParamTypes.REQUEST_PATH)();
43
- exports.RequestPath = RequestPath;
44
- const RequestIP = () => createParamMapping(RouteParamTypes.REQUEST_IP)();
45
- exports.RequestIP = RequestIP;
46
- const Queries = (property) => createParamMapping(RouteParamTypes.QUERIES)(property);
47
- exports.Queries = Queries;
48
- const Fields = (property) => createParamMapping(RouteParamTypes.FIELDS)(property);
49
- exports.Fields = Fields;
50
- //# sourceMappingURL=paramMapping.js.map
@@ -1,129 +0,0 @@
1
- import { MiddlewareParamArray } from '../../interface';
2
- export interface RouterOption {
3
- /**
4
- * router path, like "/api"
5
- */
6
- path?: string | RegExp;
7
- /**
8
- * http method, like "get", "post"
9
- */
10
- requestMethod: string;
11
- /**
12
- * router alias name
13
- */
14
- routerName?: string;
15
- /**
16
- * which method decorator attached
17
- */
18
- method?: string;
19
- /**
20
- * middleware array in router
21
- */
22
- middleware?: MiddlewareParamArray;
23
- /**
24
- * router summary, for swagger
25
- * @deprecated
26
- */
27
- summary?: string;
28
- /**
29
- * router description, for swagger
30
- * @deprecated
31
- */
32
- description?: string;
33
- /**
34
- * ignore global prefix
35
- */
36
- ignoreGlobalPrefix?: boolean;
37
- }
38
- export declare const RequestMethod: {
39
- GET: string;
40
- POST: string;
41
- PUT: string;
42
- DELETE: string;
43
- PATCH: string;
44
- ALL: string;
45
- OPTIONS: string;
46
- HEAD: string;
47
- };
48
- export declare const RequestMapping: (metadata?: RouterOption) => MethodDecorator;
49
- /**
50
- * Routes HTTP POST requests to the specified path.
51
- */
52
- export declare const Post: (path?: string | RegExp, routerOptions?: {
53
- routerName?: string;
54
- middleware?: MiddlewareParamArray;
55
- summary?: string;
56
- description?: string;
57
- ignoreGlobalPrefix?: boolean;
58
- }) => MethodDecorator;
59
- /**
60
- * Routes HTTP GET requests to the specified path.
61
- */
62
- export declare const Get: (path?: string | RegExp, routerOptions?: {
63
- routerName?: string;
64
- middleware?: MiddlewareParamArray;
65
- summary?: string;
66
- description?: string;
67
- ignoreGlobalPrefix?: boolean;
68
- }) => MethodDecorator;
69
- /**
70
- * Routes HTTP DELETE requests to the specified path.
71
- */
72
- export declare const Del: (path?: string | RegExp, routerOptions?: {
73
- routerName?: string;
74
- middleware?: MiddlewareParamArray;
75
- summary?: string;
76
- description?: string;
77
- ignoreGlobalPrefix?: boolean;
78
- }) => MethodDecorator;
79
- /**
80
- * Routes HTTP PUT requests to the specified path.
81
- */
82
- export declare const Put: (path?: string | RegExp, routerOptions?: {
83
- routerName?: string;
84
- middleware?: MiddlewareParamArray;
85
- summary?: string;
86
- description?: string;
87
- ignoreGlobalPrefix?: boolean;
88
- }) => MethodDecorator;
89
- /**
90
- * Routes HTTP PATCH requests to the specified path.
91
- */
92
- export declare const Patch: (path?: string | RegExp, routerOptions?: {
93
- routerName?: string;
94
- middleware?: MiddlewareParamArray;
95
- summary?: string;
96
- description?: string;
97
- ignoreGlobalPrefix?: boolean;
98
- }) => MethodDecorator;
99
- /**
100
- * Routes HTTP OPTIONS requests to the specified path.
101
- */
102
- export declare const Options: (path?: string | RegExp, routerOptions?: {
103
- routerName?: string;
104
- middleware?: MiddlewareParamArray;
105
- summary?: string;
106
- description?: string;
107
- ignoreGlobalPrefix?: boolean;
108
- }) => MethodDecorator;
109
- /**
110
- * Routes HTTP HEAD requests to the specified path.
111
- */
112
- export declare const Head: (path?: string | RegExp, routerOptions?: {
113
- routerName?: string;
114
- middleware?: MiddlewareParamArray;
115
- summary?: string;
116
- description?: string;
117
- ignoreGlobalPrefix?: boolean;
118
- }) => MethodDecorator;
119
- /**
120
- * Routes all HTTP requests to the specified path.
121
- */
122
- export declare const All: (path?: string | RegExp, routerOptions?: {
123
- routerName?: string;
124
- middleware?: MiddlewareParamArray;
125
- summary?: string;
126
- description?: string;
127
- ignoreGlobalPrefix?: boolean;
128
- }) => MethodDecorator;
129
- //# sourceMappingURL=requestMapping.d.ts.map