web_api_base 3.6.8 → 3.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Application.d.ts +24 -24
- package/dist/Application.js +449 -421
- package/dist/Application.js.map +1 -1
- package/dist/ApplicationConfiguration.d.ts +18 -18
- package/dist/ApplicationConfiguration.js +126 -126
- package/dist/bin/CreateApplication.d.ts +1 -1
- package/dist/bin/CreateApplication.js +16 -16
- package/dist/bin/CreateController.d.ts +1 -1
- package/dist/bin/CreateController.js +21 -21
- package/dist/controllers/base/ControllerBase.d.ts +19 -19
- package/dist/controllers/base/ControllerBase.js +46 -46
- package/dist/decorators/controllers/ControllerDecorators.d.ts +50 -46
- package/dist/decorators/controllers/ControllerDecorators.js +172 -166
- package/dist/decorators/controllers/ControllerDecorators.js.map +1 -1
- package/dist/decorators/documentation/DocumentationDecorators.d.ts +17 -17
- package/dist/decorators/documentation/DocumentationDecorators.js +38 -38
- package/dist/decorators/validations/ValidationDecorators.d.ts +53 -53
- package/dist/decorators/validations/ValidationDecorators.js +180 -180
- package/dist/decorators/validations/ValidationDecorators.js.map +1 -1
- package/dist/dependencyInjection/DependecyService.d.ts +28 -28
- package/dist/dependencyInjection/DependecyService.js +135 -135
- package/dist/dependencyInjection/DependecyService.js.map +1 -1
- package/dist/dependencyInjection/IDIContext.d.ts +7 -7
- package/dist/dependencyInjection/IDIContext.js +2 -2
- package/dist/documentation/CSS.d.ts +6 -6
- package/dist/documentation/CSS.js +18 -18
- package/dist/documentation/CSS.js.map +1 -1
- package/dist/documentation/Documentation.d.ts +7 -7
- package/dist/documentation/Documentation.js +80 -80
- package/dist/documentation/HTML.d.ts +4 -4
- package/dist/documentation/HTML.js +13 -13
- package/dist/documentation/HTML.js.map +1 -1
- package/dist/documentation/JS.d.ts +5 -5
- package/dist/documentation/JS.js +36 -34
- package/dist/documentation/JS.js.map +1 -1
- package/dist/enums/httpVerbs/HttpVerbs.d.ts +6 -6
- package/dist/enums/httpVerbs/HttpVerbs.js +10 -10
- package/dist/enums/httpVerbs/HttpVerbs.js.map +1 -1
- package/dist/exceptions/ArgumentNullException.d.ts +3 -3
- package/dist/exceptions/ArgumentNullException.js +9 -9
- package/dist/exceptions/ControllerLoadException.d.ts +3 -3
- package/dist/exceptions/ControllerLoadException.js +9 -9
- package/dist/exceptions/Exception.d.ts +4 -4
- package/dist/exceptions/Exception.js +9 -9
- package/dist/exceptions/FindDependencyException.d.ts +3 -3
- package/dist/exceptions/FindDependencyException.js +9 -9
- package/dist/index.d.ts +47 -45
- package/dist/index.js +155 -147
- package/dist/index.js.map +1 -1
- package/dist/interfaces/IApplication.d.ts +13 -13
- package/dist/interfaces/IApplication.js +2 -2
- package/dist/interfaces/IApplicationConfiguration.d.ts +12 -12
- package/dist/interfaces/IApplicationConfiguration.js +2 -2
- package/dist/interfaces/IController.d.ts +5 -5
- package/dist/interfaces/IController.js +2 -2
- package/dist/metadata/FunctionAnalizer.d.ts +8 -8
- package/dist/metadata/FunctionAnalizer.js +22 -22
- package/dist/metadata/OwnMetaDataContainer.d.ts +12 -12
- package/dist/metadata/OwnMetaDataContainer.js +32 -32
- package/dist/metadata/OwnMetaDataContainer.js.map +1 -1
- package/dist/metadata/Type.d.ts +4 -4
- package/dist/metadata/Type.js +36 -36
- package/dist/midlewares/IMidleware.d.ts +19 -19
- package/dist/midlewares/IMidleware.js +2 -2
- package/package.json +8 -11
|
@@ -1,46 +1,50 @@
|
|
|
1
|
-
import 'reflect-metadata';
|
|
2
|
-
import { HTTPVerbs } from '../../enums/httpVerbs/HttpVerbs';
|
|
3
|
-
import IController from '../../interfaces/IController';
|
|
4
|
-
import IMidleware, { IRequestResultHandler } from '../../midlewares/IMidleware';
|
|
5
|
-
export default class ControllersDecorators {
|
|
6
|
-
constructor();
|
|
7
|
-
private static _routeKeyMetadata;
|
|
8
|
-
private static _actionVerbKeyMetadata;
|
|
9
|
-
private static _actionNameKeyMetadata;
|
|
10
|
-
private static _controllerMidlewaresKeyMetadata;
|
|
11
|
-
private static _actionsMidlewaresKeyMetadata;
|
|
12
|
-
private static _validateBodyKeyMetadata;
|
|
13
|
-
private static _fromQueryKeyMetadata;
|
|
14
|
-
private static _fromBodyKeyMetadata;
|
|
15
|
-
private static _controllerMidlewaresAfterKeyMetadata;
|
|
16
|
-
static Route(route?: string): (target: Function) => void;
|
|
17
|
-
static GetRoute(controller: IController): string | undefined;
|
|
18
|
-
static Validate(): (target: Function) => void;
|
|
19
|
-
static IsToValidate(controller: IController): boolean;
|
|
20
|
-
static UseBefore(midleware: IMidleware): (target: Function) => void;
|
|
21
|
-
static UseAfter(resultHandler: IRequestResultHandler): (target: Function) => void;
|
|
22
|
-
static GetMidlewares(controller: IController): IMidleware[];
|
|
23
|
-
static GetMidlewaresAfter(controller: IController): IRequestResultHandler[];
|
|
24
|
-
static RunBefore(midleware: IMidleware): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
|
|
25
|
-
static RunAfter(resultHandler: IRequestResultHandler): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
|
|
26
|
-
static GetBefores(controller: IController, methodName: string): IMidleware[];
|
|
27
|
-
static GetAfters(controller: IController, methodName: string): IRequestResultHandler[];
|
|
28
|
-
static Verb(verb: HTTPVerbs, actionName?: String): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
|
|
29
|
-
static GetVerb(target: IController, methodName: string): HTTPVerbs | undefined;
|
|
30
|
-
static Action(actionName?: String): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
|
|
31
|
-
static GetAction(target: IController, methodName: string): string | undefined;
|
|
32
|
-
static
|
|
33
|
-
static
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { HTTPVerbs } from '../../enums/httpVerbs/HttpVerbs';
|
|
3
|
+
import IController from '../../interfaces/IController';
|
|
4
|
+
import IMidleware, { IRequestResultHandler } from '../../midlewares/IMidleware';
|
|
5
|
+
export default class ControllersDecorators {
|
|
6
|
+
constructor();
|
|
7
|
+
private static _routeKeyMetadata;
|
|
8
|
+
private static _actionVerbKeyMetadata;
|
|
9
|
+
private static _actionNameKeyMetadata;
|
|
10
|
+
private static _controllerMidlewaresKeyMetadata;
|
|
11
|
+
private static _actionsMidlewaresKeyMetadata;
|
|
12
|
+
private static _validateBodyKeyMetadata;
|
|
13
|
+
private static _fromQueryKeyMetadata;
|
|
14
|
+
private static _fromBodyKeyMetadata;
|
|
15
|
+
private static _controllerMidlewaresAfterKeyMetadata;
|
|
16
|
+
static Route(route?: string): (target: Function) => void;
|
|
17
|
+
static GetRoute(controller: IController): string | undefined;
|
|
18
|
+
static Validate(): (target: Function) => void;
|
|
19
|
+
static IsToValidate(controller: IController): boolean;
|
|
20
|
+
static UseBefore(midleware: IMidleware): (target: Function) => void;
|
|
21
|
+
static UseAfter(resultHandler: IRequestResultHandler): (target: Function) => void;
|
|
22
|
+
static GetMidlewares(controller: IController): IMidleware[];
|
|
23
|
+
static GetMidlewaresAfter(controller: IController): IRequestResultHandler[];
|
|
24
|
+
static RunBefore(midleware: IMidleware): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
|
|
25
|
+
static RunAfter(resultHandler: IRequestResultHandler): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
|
|
26
|
+
static GetBefores(controller: IController, methodName: string): IMidleware[];
|
|
27
|
+
static GetAfters(controller: IController, methodName: string): IRequestResultHandler[];
|
|
28
|
+
static Verb(verb: HTTPVerbs, actionName?: String): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
|
|
29
|
+
static GetVerb(target: IController, methodName: string): HTTPVerbs | undefined;
|
|
30
|
+
static Action(actionName?: String): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
|
|
31
|
+
static GetAction(target: IController, methodName: string): string | undefined;
|
|
32
|
+
static RequiredFromBodyArg(bodyPropName?: string): (target: Object, methodName: string, parameterIndex: number) => void;
|
|
33
|
+
static FromBody(bodyPropName?: string, required?: boolean): (target: Object, methodName: string, parameterIndex: number) => void;
|
|
34
|
+
static GetFromBodyArgs(target: Function, method: string): {
|
|
35
|
+
Index: number;
|
|
36
|
+
Field?: string;
|
|
37
|
+
Type: Function;
|
|
38
|
+
Required: boolean;
|
|
39
|
+
}[];
|
|
40
|
+
static RequiredFromQueryArg(bodyPropName?: string): (target: Object, methodName: string, parameterIndex: number) => void;
|
|
41
|
+
static FromQuery(bodyPropName?: string, required?: boolean): (target: Object, methodName: string, parameterIndex: number) => void;
|
|
42
|
+
static GetFromQueryArgs(target: Function, method: string): {
|
|
43
|
+
Index: number;
|
|
44
|
+
Field: string;
|
|
45
|
+
Type: Function;
|
|
46
|
+
Required: boolean;
|
|
47
|
+
}[];
|
|
48
|
+
private static SetMetaData;
|
|
49
|
+
private static GetMetaData;
|
|
50
|
+
}
|
|
@@ -1,167 +1,173 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
require("reflect-metadata");
|
|
7
|
-
const FunctionAnalizer_1 = __importDefault(require("../../metadata/FunctionAnalizer"));
|
|
8
|
-
class ControllersDecorators {
|
|
9
|
-
constructor() { }
|
|
10
|
-
static Route(route) {
|
|
11
|
-
return function (target) {
|
|
12
|
-
let value = route !== null && route !== void 0 ? route : target.name.toLocaleLowerCase().replace("controller", "");
|
|
13
|
-
Reflect.defineMetadata(ControllersDecorators._routeKeyMetadata, value, target);
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
static GetRoute(controller) {
|
|
17
|
-
let meta = Reflect.getMetadata(ControllersDecorators._routeKeyMetadata, controller.constructor);
|
|
18
|
-
let cName = controller.constructor.name.toLocaleLowerCase().replace("controller", "");
|
|
19
|
-
if (!meta)
|
|
20
|
-
meta = cName;
|
|
21
|
-
meta = meta.toLocaleLowerCase().replace("[controller]", cName);
|
|
22
|
-
if (meta && meta[0] != '/') {
|
|
23
|
-
return `/${meta}`.toLocaleLowerCase();
|
|
24
|
-
}
|
|
25
|
-
return meta === null || meta === void 0 ? void 0 : meta.toLocaleLowerCase();
|
|
26
|
-
}
|
|
27
|
-
static Validate() {
|
|
28
|
-
return function (target) {
|
|
29
|
-
Reflect.defineMetadata(ControllersDecorators._validateBodyKeyMetadata, true, target);
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
static IsToValidate(controller) {
|
|
33
|
-
var _a;
|
|
34
|
-
return (_a = Reflect.getMetadata(ControllersDecorators._validateBodyKeyMetadata, controller.constructor)) !== null && _a !== void 0 ? _a : false;
|
|
35
|
-
}
|
|
36
|
-
static UseBefore(midleware) {
|
|
37
|
-
return function (target) {
|
|
38
|
-
var _a;
|
|
39
|
-
let current = (_a = Reflect.getMetadata(ControllersDecorators._controllerMidlewaresKeyMetadata, target)) !== null && _a !== void 0 ? _a : [];
|
|
40
|
-
current.push(midleware);
|
|
41
|
-
Reflect.defineMetadata(ControllersDecorators._controllerMidlewaresKeyMetadata, current, target);
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
static UseAfter(resultHandler) {
|
|
45
|
-
return function (target) {
|
|
46
|
-
var _a;
|
|
47
|
-
let current = (_a = Reflect.getMetadata(ControllersDecorators._controllerMidlewaresAfterKeyMetadata, target)) !== null && _a !== void 0 ? _a : [];
|
|
48
|
-
current.push(resultHandler);
|
|
49
|
-
Reflect.defineMetadata(ControllersDecorators._controllerMidlewaresAfterKeyMetadata, current, target);
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
static GetMidlewares(controller) {
|
|
53
|
-
var _a;
|
|
54
|
-
return (_a = Reflect.getMetadata(ControllersDecorators._controllerMidlewaresKeyMetadata, controller.constructor)) !== null && _a !== void 0 ? _a : [];
|
|
55
|
-
}
|
|
56
|
-
static GetMidlewaresAfter(controller) {
|
|
57
|
-
var _a;
|
|
58
|
-
return (_a = Reflect.getMetadata(ControllersDecorators._controllerMidlewaresAfterKeyMetadata, controller.constructor)) !== null && _a !== void 0 ? _a : [];
|
|
59
|
-
}
|
|
60
|
-
static RunBefore(midleware) {
|
|
61
|
-
return function (target, methodName, propertyDescriptor) {
|
|
62
|
-
var _a;
|
|
63
|
-
let current = (_a = Reflect.getMetadata(ControllersDecorators._actionsMidlewaresKeyMetadata, target, methodName)) !== null && _a !== void 0 ? _a : [];
|
|
64
|
-
current.push(midleware);
|
|
65
|
-
ControllersDecorators.SetMetaData(ControllersDecorators._actionsMidlewaresKeyMetadata, target, methodName, current);
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
static RunAfter(resultHandler) {
|
|
69
|
-
return function (target, methodName, propertyDescriptor) {
|
|
70
|
-
var _a;
|
|
71
|
-
let current = (_a = Reflect.getMetadata(ControllersDecorators._controllerMidlewaresAfterKeyMetadata, target, methodName)) !== null && _a !== void 0 ? _a : [];
|
|
72
|
-
current.push(resultHandler);
|
|
73
|
-
ControllersDecorators.SetMetaData(ControllersDecorators._controllerMidlewaresAfterKeyMetadata, target, methodName, current);
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
static GetBefores(controller, methodName) {
|
|
77
|
-
var _a;
|
|
78
|
-
return (_a = this.GetMetaData(ControllersDecorators._actionsMidlewaresKeyMetadata, controller, methodName)) !== null && _a !== void 0 ? _a : [];
|
|
79
|
-
}
|
|
80
|
-
static GetAfters(controller, methodName) {
|
|
81
|
-
var _a;
|
|
82
|
-
return (_a = this.GetMetaData(ControllersDecorators._controllerMidlewaresAfterKeyMetadata, controller, methodName)) !== null && _a !== void 0 ? _a : [];
|
|
83
|
-
}
|
|
84
|
-
static Verb(verb, actionName) {
|
|
85
|
-
return function (target, methodName, propertyDescriptor) {
|
|
86
|
-
ControllersDecorators.SetMetaData(ControllersDecorators._actionNameKeyMetadata, target, methodName, actionName !== null && actionName !== void 0 ? actionName : methodName.toLocaleLowerCase());
|
|
87
|
-
ControllersDecorators.SetMetaData(ControllersDecorators._actionVerbKeyMetadata, target, methodName, verb);
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
static GetVerb(target, methodName) {
|
|
91
|
-
let meta = this.GetMetaData(ControllersDecorators._actionVerbKeyMetadata, target, methodName);
|
|
92
|
-
return meta;
|
|
93
|
-
}
|
|
94
|
-
static Action(actionName) {
|
|
95
|
-
return function (target, methodName, propertyDescriptor) {
|
|
96
|
-
ControllersDecorators.SetMetaData(ControllersDecorators._actionNameKeyMetadata, target, methodName, actionName !== null && actionName !== void 0 ? actionName : methodName.toLocaleLowerCase());
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
static GetAction(target, methodName) {
|
|
100
|
-
let meta = this.GetMetaData(ControllersDecorators._actionNameKeyMetadata, target, methodName);
|
|
101
|
-
if (meta && meta[0] != '/') {
|
|
102
|
-
return `/${meta}`.toLocaleLowerCase();
|
|
103
|
-
}
|
|
104
|
-
return meta === null || meta === void 0 ? void 0 : meta.toLocaleLowerCase();
|
|
105
|
-
}
|
|
106
|
-
static
|
|
107
|
-
return
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
let
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
return
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
ControllersDecorators.
|
|
164
|
-
ControllersDecorators.
|
|
165
|
-
ControllersDecorators.
|
|
166
|
-
ControllersDecorators.
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
require("reflect-metadata");
|
|
7
|
+
const FunctionAnalizer_1 = __importDefault(require("../../metadata/FunctionAnalizer"));
|
|
8
|
+
class ControllersDecorators {
|
|
9
|
+
constructor() { }
|
|
10
|
+
static Route(route) {
|
|
11
|
+
return function (target) {
|
|
12
|
+
let value = route !== null && route !== void 0 ? route : target.name.toLocaleLowerCase().replace("controller", "");
|
|
13
|
+
Reflect.defineMetadata(ControllersDecorators._routeKeyMetadata, value, target);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
static GetRoute(controller) {
|
|
17
|
+
let meta = Reflect.getMetadata(ControllersDecorators._routeKeyMetadata, controller.constructor);
|
|
18
|
+
let cName = controller.constructor.name.toLocaleLowerCase().replace("controller", "");
|
|
19
|
+
if (!meta)
|
|
20
|
+
meta = cName;
|
|
21
|
+
meta = meta.toLocaleLowerCase().replace("[controller]", cName);
|
|
22
|
+
if (meta && meta[0] != '/') {
|
|
23
|
+
return `/${meta}`.toLocaleLowerCase();
|
|
24
|
+
}
|
|
25
|
+
return meta === null || meta === void 0 ? void 0 : meta.toLocaleLowerCase();
|
|
26
|
+
}
|
|
27
|
+
static Validate() {
|
|
28
|
+
return function (target) {
|
|
29
|
+
Reflect.defineMetadata(ControllersDecorators._validateBodyKeyMetadata, true, target);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
static IsToValidate(controller) {
|
|
33
|
+
var _a;
|
|
34
|
+
return (_a = Reflect.getMetadata(ControllersDecorators._validateBodyKeyMetadata, controller.constructor)) !== null && _a !== void 0 ? _a : false;
|
|
35
|
+
}
|
|
36
|
+
static UseBefore(midleware) {
|
|
37
|
+
return function (target) {
|
|
38
|
+
var _a;
|
|
39
|
+
let current = (_a = Reflect.getMetadata(ControllersDecorators._controllerMidlewaresKeyMetadata, target)) !== null && _a !== void 0 ? _a : [];
|
|
40
|
+
current.push(midleware);
|
|
41
|
+
Reflect.defineMetadata(ControllersDecorators._controllerMidlewaresKeyMetadata, current, target);
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
static UseAfter(resultHandler) {
|
|
45
|
+
return function (target) {
|
|
46
|
+
var _a;
|
|
47
|
+
let current = (_a = Reflect.getMetadata(ControllersDecorators._controllerMidlewaresAfterKeyMetadata, target)) !== null && _a !== void 0 ? _a : [];
|
|
48
|
+
current.push(resultHandler);
|
|
49
|
+
Reflect.defineMetadata(ControllersDecorators._controllerMidlewaresAfterKeyMetadata, current, target);
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
static GetMidlewares(controller) {
|
|
53
|
+
var _a;
|
|
54
|
+
return (_a = Reflect.getMetadata(ControllersDecorators._controllerMidlewaresKeyMetadata, controller.constructor)) !== null && _a !== void 0 ? _a : [];
|
|
55
|
+
}
|
|
56
|
+
static GetMidlewaresAfter(controller) {
|
|
57
|
+
var _a;
|
|
58
|
+
return (_a = Reflect.getMetadata(ControllersDecorators._controllerMidlewaresAfterKeyMetadata, controller.constructor)) !== null && _a !== void 0 ? _a : [];
|
|
59
|
+
}
|
|
60
|
+
static RunBefore(midleware) {
|
|
61
|
+
return function (target, methodName, propertyDescriptor) {
|
|
62
|
+
var _a;
|
|
63
|
+
let current = (_a = Reflect.getMetadata(ControllersDecorators._actionsMidlewaresKeyMetadata, target, methodName)) !== null && _a !== void 0 ? _a : [];
|
|
64
|
+
current.push(midleware);
|
|
65
|
+
ControllersDecorators.SetMetaData(ControllersDecorators._actionsMidlewaresKeyMetadata, target, methodName, current);
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
static RunAfter(resultHandler) {
|
|
69
|
+
return function (target, methodName, propertyDescriptor) {
|
|
70
|
+
var _a;
|
|
71
|
+
let current = (_a = Reflect.getMetadata(ControllersDecorators._controllerMidlewaresAfterKeyMetadata, target, methodName)) !== null && _a !== void 0 ? _a : [];
|
|
72
|
+
current.push(resultHandler);
|
|
73
|
+
ControllersDecorators.SetMetaData(ControllersDecorators._controllerMidlewaresAfterKeyMetadata, target, methodName, current);
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
static GetBefores(controller, methodName) {
|
|
77
|
+
var _a;
|
|
78
|
+
return (_a = this.GetMetaData(ControllersDecorators._actionsMidlewaresKeyMetadata, controller, methodName)) !== null && _a !== void 0 ? _a : [];
|
|
79
|
+
}
|
|
80
|
+
static GetAfters(controller, methodName) {
|
|
81
|
+
var _a;
|
|
82
|
+
return (_a = this.GetMetaData(ControllersDecorators._controllerMidlewaresAfterKeyMetadata, controller, methodName)) !== null && _a !== void 0 ? _a : [];
|
|
83
|
+
}
|
|
84
|
+
static Verb(verb, actionName) {
|
|
85
|
+
return function (target, methodName, propertyDescriptor) {
|
|
86
|
+
ControllersDecorators.SetMetaData(ControllersDecorators._actionNameKeyMetadata, target, methodName, actionName !== null && actionName !== void 0 ? actionName : methodName.toLocaleLowerCase());
|
|
87
|
+
ControllersDecorators.SetMetaData(ControllersDecorators._actionVerbKeyMetadata, target, methodName, verb);
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
static GetVerb(target, methodName) {
|
|
91
|
+
let meta = this.GetMetaData(ControllersDecorators._actionVerbKeyMetadata, target, methodName);
|
|
92
|
+
return meta;
|
|
93
|
+
}
|
|
94
|
+
static Action(actionName) {
|
|
95
|
+
return function (target, methodName, propertyDescriptor) {
|
|
96
|
+
ControllersDecorators.SetMetaData(ControllersDecorators._actionNameKeyMetadata, target, methodName, actionName !== null && actionName !== void 0 ? actionName : methodName.toLocaleLowerCase());
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
static GetAction(target, methodName) {
|
|
100
|
+
let meta = this.GetMetaData(ControllersDecorators._actionNameKeyMetadata, target, methodName);
|
|
101
|
+
if (meta && meta[0] != '/') {
|
|
102
|
+
return `/${meta}`.toLocaleLowerCase();
|
|
103
|
+
}
|
|
104
|
+
return meta === null || meta === void 0 ? void 0 : meta.toLocaleLowerCase();
|
|
105
|
+
}
|
|
106
|
+
static RequiredFromBodyArg(bodyPropName) {
|
|
107
|
+
return ControllersDecorators.FromBody(bodyPropName, true);
|
|
108
|
+
}
|
|
109
|
+
static FromBody(bodyPropName, required) {
|
|
110
|
+
return function (target, methodName, parameterIndex) {
|
|
111
|
+
let meta = ControllersDecorators.GetFromBodyArgs(target.constructor, methodName);
|
|
112
|
+
let params = FunctionAnalizer_1.default.ExtractParamsList(target, target[methodName]);
|
|
113
|
+
let item = meta.filter(x => x.Index == parameterIndex);
|
|
114
|
+
let thisParam = params.filter(s => s.Index == parameterIndex)[0];
|
|
115
|
+
if (item.length == 0)
|
|
116
|
+
meta.push({ Index: parameterIndex, Field: bodyPropName, Type: thisParam.Type, Required: required !== null && required !== void 0 ? required : false });
|
|
117
|
+
else {
|
|
118
|
+
item[0].Field = bodyPropName;
|
|
119
|
+
item[0].Type = thisParam.Type;
|
|
120
|
+
}
|
|
121
|
+
Reflect.defineMetadata(ControllersDecorators._fromBodyKeyMetadata, meta, target.constructor, methodName);
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
static GetFromBodyArgs(target, method) {
|
|
125
|
+
var _a;
|
|
126
|
+
return (_a = Reflect.getMetadata(ControllersDecorators._fromBodyKeyMetadata, target, method)) !== null && _a !== void 0 ? _a : [];
|
|
127
|
+
}
|
|
128
|
+
static RequiredFromQueryArg(bodyPropName) {
|
|
129
|
+
return ControllersDecorators.FromQuery(bodyPropName, true);
|
|
130
|
+
}
|
|
131
|
+
static FromQuery(bodyPropName, required) {
|
|
132
|
+
return function (target, methodName, parameterIndex) {
|
|
133
|
+
let meta = ControllersDecorators.GetFromQueryArgs(target.constructor, methodName);
|
|
134
|
+
let params = FunctionAnalizer_1.default.ExtractParamsList(target, target[methodName]);
|
|
135
|
+
let thisParam = params.filter(s => s.Index == parameterIndex)[0];
|
|
136
|
+
let item = meta.filter(x => x.Index == parameterIndex);
|
|
137
|
+
if (item.length == 0)
|
|
138
|
+
meta.push({ Index: parameterIndex, Field: bodyPropName !== null && bodyPropName !== void 0 ? bodyPropName : thisParam.Name, Type: thisParam.Type, Required: required !== null && required !== void 0 ? required : false });
|
|
139
|
+
else {
|
|
140
|
+
item[0].Field = bodyPropName !== null && bodyPropName !== void 0 ? bodyPropName : thisParam.Name;
|
|
141
|
+
item[0].Type = thisParam.Type;
|
|
142
|
+
}
|
|
143
|
+
Reflect.defineMetadata(ControllersDecorators._fromQueryKeyMetadata, meta, target.constructor, methodName);
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
static GetFromQueryArgs(target, method) {
|
|
147
|
+
var _a;
|
|
148
|
+
return (_a = Reflect.getMetadata(ControllersDecorators._fromQueryKeyMetadata, target, method)) !== null && _a !== void 0 ? _a : [];
|
|
149
|
+
}
|
|
150
|
+
static SetMetaData(key, target, methodName, value) {
|
|
151
|
+
var meta = Reflect.getOwnMetadata(key, target, methodName);
|
|
152
|
+
if (!meta)
|
|
153
|
+
Reflect.defineMetadata(key, value, target, methodName);
|
|
154
|
+
}
|
|
155
|
+
static GetMetaData(key, target, methodName) {
|
|
156
|
+
var meta = Reflect.getMetadata(key, target, methodName);
|
|
157
|
+
if (meta != undefined)
|
|
158
|
+
return meta;
|
|
159
|
+
else
|
|
160
|
+
return undefined;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
ControllersDecorators._routeKeyMetadata = "meta:controllerRoute";
|
|
164
|
+
ControllersDecorators._actionVerbKeyMetadata = "meta:actionVerb";
|
|
165
|
+
ControllersDecorators._actionNameKeyMetadata = "meta:actionName";
|
|
166
|
+
ControllersDecorators._controllerMidlewaresKeyMetadata = "meta:controllerMidlewaresKey";
|
|
167
|
+
ControllersDecorators._actionsMidlewaresKeyMetadata = "meta:actionMidlewaresKey";
|
|
168
|
+
ControllersDecorators._validateBodyKeyMetadata = "meta:validateBodyKey";
|
|
169
|
+
ControllersDecorators._fromQueryKeyMetadata = "meta:fromQueryKey";
|
|
170
|
+
ControllersDecorators._fromBodyKeyMetadata = "meta:fromBodyKey";
|
|
171
|
+
ControllersDecorators._controllerMidlewaresAfterKeyMetadata = "meta:controllerMidlewaresAfterKey";
|
|
172
|
+
exports.default = ControllersDecorators;
|
|
167
173
|
//# sourceMappingURL=ControllerDecorators.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ControllerDecorators.js","sourceRoot":"","sources":["../../../decorators/controllers/ControllerDecorators.ts"],"names":[],"mappings":";;;;;AAAA,4BAA0B;AAK1B,uFAA+D;AAG/D,MAAqB,qBAAqB;IAEtC,gBAAc,CAAC;IAeR,MAAM,CAAC,KAAK,CAAC,KAAe;QAE/B,OAAO,UAAU,MAAiB;YAE9B,IAAI,KAAK,GAAG,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,MAAM,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,OAAO,CAAC,YAAY,EAAC,EAAE,CAAC,CAAC;YAC9E,OAAO,CAAC,cAAc,CAAC,qBAAqB,CAAC,iBAAiB,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;QAEnF,CAAC,CAAA;IACL,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAC,UAAwB;QAE5C,IAAI,IAAI,GAAG,OAAO,CAAC,W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CAAC,CAAC;QAErE,IAAG,CAAC,IAAI;YACJ,OAAO,CAAC,cAAc,CAAC,GAAG,EAAE,KAAK,EAAE,MAAgB,EAAE,UAAU,CAAC,CAAC;IACzE,CAAC;IAGO,MAAM,CAAC,WAAW,CAAI,GAAW,EAAE,MAAe,EAAE,UAAmB;QAE3E,IAAI,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;QAExD,IAAG,IAAI,IAAI,SAAS;YAChB,OAAO,IAAS,CAAC;;YAEjB,OAAO,SAAS,CAAC;IACzB,CAAC;;AApQc,uCAAiB,GAAG,sBAAsB,CAAC;AAC3C,4CAAsB,GAAG,iBAAiB,CAAC;AAC3C,4CAAsB,GAAG,iBAAiB,CAAC;AAC3C,sDAAgC,GAAG,8BAA8B,CAAC;AAClE,mDAA6B,GAAG,0BAA0B,CAAC;AAC3D,8CAAwB,GAAG,sBAAsB,CAAC;AAClD,2CAAqB,GAAG,mBAAmB,CAAC;AAC5C,0CAAoB,GAAG,kBAAkB,CAAC;AAC1C,2DAAqC,GAAG,mCAAmC,CAAC;kBAZ1E,qBAAqB"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import 'reflect-metadata';
|
|
2
|
-
export declare class DocumentationDecorators {
|
|
3
|
-
constructor();
|
|
4
|
-
private static _descriptionKeyMetadata;
|
|
5
|
-
private static _requestKeyMetadata;
|
|
6
|
-
private static _responseKeyMetadata;
|
|
7
|
-
static Description(description: string): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
|
|
8
|
-
static GetDescription(target: Function, method: string): string | undefined;
|
|
9
|
-
static RequestJson(json: string): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
|
|
10
|
-
static GetRequestJson(target: Function, method: string): string | undefined;
|
|
11
|
-
static ProducesResponse(response: {
|
|
12
|
-
Status: number;
|
|
13
|
-
Description?: string;
|
|
14
|
-
JSON?: string;
|
|
15
|
-
}): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
|
|
16
|
-
static GetProducesResponse(target: Function, method: string): Parameters<typeof DocumentationDecorators.ProducesResponse>[0][];
|
|
17
|
-
}
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
export declare class DocumentationDecorators {
|
|
3
|
+
constructor();
|
|
4
|
+
private static _descriptionKeyMetadata;
|
|
5
|
+
private static _requestKeyMetadata;
|
|
6
|
+
private static _responseKeyMetadata;
|
|
7
|
+
static Description(description: string): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
|
|
8
|
+
static GetDescription(target: Function, method: string): string | undefined;
|
|
9
|
+
static RequestJson(json: string): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
|
|
10
|
+
static GetRequestJson(target: Function, method: string): string | undefined;
|
|
11
|
+
static ProducesResponse(response: {
|
|
12
|
+
Status: number;
|
|
13
|
+
Description?: string;
|
|
14
|
+
JSON?: string;
|
|
15
|
+
}): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
|
|
16
|
+
static GetProducesResponse(target: Function, method: string): Parameters<typeof DocumentationDecorators.ProducesResponse>[0][];
|
|
17
|
+
}
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DocumentationDecorators = void 0;
|
|
4
|
-
require("reflect-metadata");
|
|
5
|
-
class DocumentationDecorators {
|
|
6
|
-
constructor() { }
|
|
7
|
-
static Description(description) {
|
|
8
|
-
return function (target, methodName, propertyDescriptor) {
|
|
9
|
-
Reflect.defineMetadata(DocumentationDecorators._descriptionKeyMetadata, description, target, methodName);
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
static GetDescription(target, method) {
|
|
13
|
-
return Reflect.getMetadata(DocumentationDecorators._descriptionKeyMetadata, target, method);
|
|
14
|
-
}
|
|
15
|
-
static RequestJson(json) {
|
|
16
|
-
return function (target, methodName, propertyDescriptor) {
|
|
17
|
-
Reflect.defineMetadata(DocumentationDecorators._requestKeyMetadata, json, target, methodName);
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
static GetRequestJson(target, method) {
|
|
21
|
-
return Reflect.getMetadata(DocumentationDecorators._requestKeyMetadata, target, method);
|
|
22
|
-
}
|
|
23
|
-
static ProducesResponse(response) {
|
|
24
|
-
return function (target, methodName, propertyDescriptor) {
|
|
25
|
-
let meta = DocumentationDecorators.GetProducesResponse(target.constructor, methodName);
|
|
26
|
-
meta.push(response);
|
|
27
|
-
Reflect.defineMetadata(DocumentationDecorators._responseKeyMetadata, meta, target.constructor, methodName);
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
static GetProducesResponse(target, method) {
|
|
31
|
-
var _a;
|
|
32
|
-
return (_a = Reflect.getMetadata(DocumentationDecorators._responseKeyMetadata, target, method)) !== null && _a !== void 0 ? _a : [];
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
exports.DocumentationDecorators = DocumentationDecorators;
|
|
36
|
-
DocumentationDecorators._descriptionKeyMetadata = "meta:descriptionKey";
|
|
37
|
-
DocumentationDecorators._requestKeyMetadata = "meta:requestJsonKey";
|
|
38
|
-
DocumentationDecorators._responseKeyMetadata = "meta:responseJsonKey";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DocumentationDecorators = void 0;
|
|
4
|
+
require("reflect-metadata");
|
|
5
|
+
class DocumentationDecorators {
|
|
6
|
+
constructor() { }
|
|
7
|
+
static Description(description) {
|
|
8
|
+
return function (target, methodName, propertyDescriptor) {
|
|
9
|
+
Reflect.defineMetadata(DocumentationDecorators._descriptionKeyMetadata, description, target, methodName);
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
static GetDescription(target, method) {
|
|
13
|
+
return Reflect.getMetadata(DocumentationDecorators._descriptionKeyMetadata, target, method);
|
|
14
|
+
}
|
|
15
|
+
static RequestJson(json) {
|
|
16
|
+
return function (target, methodName, propertyDescriptor) {
|
|
17
|
+
Reflect.defineMetadata(DocumentationDecorators._requestKeyMetadata, json, target, methodName);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
static GetRequestJson(target, method) {
|
|
21
|
+
return Reflect.getMetadata(DocumentationDecorators._requestKeyMetadata, target, method);
|
|
22
|
+
}
|
|
23
|
+
static ProducesResponse(response) {
|
|
24
|
+
return function (target, methodName, propertyDescriptor) {
|
|
25
|
+
let meta = DocumentationDecorators.GetProducesResponse(target.constructor, methodName);
|
|
26
|
+
meta.push(response);
|
|
27
|
+
Reflect.defineMetadata(DocumentationDecorators._responseKeyMetadata, meta, target.constructor, methodName);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
static GetProducesResponse(target, method) {
|
|
31
|
+
var _a;
|
|
32
|
+
return (_a = Reflect.getMetadata(DocumentationDecorators._responseKeyMetadata, target, method)) !== null && _a !== void 0 ? _a : [];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.DocumentationDecorators = DocumentationDecorators;
|
|
36
|
+
DocumentationDecorators._descriptionKeyMetadata = "meta:descriptionKey";
|
|
37
|
+
DocumentationDecorators._requestKeyMetadata = "meta:requestJsonKey";
|
|
38
|
+
DocumentationDecorators._responseKeyMetadata = "meta:responseJsonKey";
|
|
39
39
|
//# sourceMappingURL=DocumentationDecorators.js.map
|