routup 0.5.0 → 0.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.
- package/README.md +7 -6
- package/dist/handler/type.d.ts +0 -3
- package/dist/handler/type.d.ts.map +1 -1
- package/dist/handler/utils.d.ts +1 -4
- package/dist/handler/utils.d.ts.map +1 -1
- package/dist/handler/utils.js +1 -28
- package/dist/handler/utils.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/router/module.d.ts +1 -3
- package/dist/router/module.d.ts.map +1 -1
- package/dist/router/module.js +14 -58
- package/dist/router/module.js.map +1 -1
- package/dist/type.d.ts +0 -3
- package/dist/type.d.ts.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/object.d.ts +2 -0
- package/dist/utils/object.d.ts.map +1 -0
- package/dist/{decorators/method/type.js → utils/object.js} +8 -1
- package/dist/utils/object.js.map +1 -0
- package/package.json +2 -2
- package/dist/decorators/controller/index.d.ts +0 -2
- package/dist/decorators/controller/index.d.ts.map +0 -1
- package/dist/decorators/controller/index.js +0 -24
- package/dist/decorators/controller/index.js.map +0 -1
- package/dist/decorators/controller/module.d.ts +0 -4
- package/dist/decorators/controller/module.d.ts.map +0 -1
- package/dist/decorators/controller/module.js +0 -29
- package/dist/decorators/controller/module.js.map +0 -1
- package/dist/decorators/index.d.ts +0 -5
- package/dist/decorators/index.d.ts.map +0 -1
- package/dist/decorators/index.js +0 -27
- package/dist/decorators/index.js.map +0 -1
- package/dist/decorators/method/arguments.d.ts +0 -4
- package/dist/decorators/method/arguments.d.ts.map +0 -1
- package/dist/decorators/method/arguments.js +0 -22
- package/dist/decorators/method/arguments.js.map +0 -1
- package/dist/decorators/method/index.d.ts +0 -4
- package/dist/decorators/method/index.d.ts.map +0 -1
- package/dist/decorators/method/index.js +0 -26
- package/dist/decorators/method/index.js.map +0 -1
- package/dist/decorators/method/module.d.ts +0 -8
- package/dist/decorators/method/module.d.ts.map +0 -1
- package/dist/decorators/method/module.js +0 -46
- package/dist/decorators/method/module.js.map +0 -1
- package/dist/decorators/method/type.d.ts +0 -7
- package/dist/decorators/method/type.d.ts.map +0 -1
- package/dist/decorators/method/type.js.map +0 -1
- package/dist/decorators/parameter/index.d.ts +0 -3
- package/dist/decorators/parameter/index.d.ts.map +0 -1
- package/dist/decorators/parameter/index.js +0 -25
- package/dist/decorators/parameter/index.js.map +0 -1
- package/dist/decorators/parameter/module.d.ts +0 -10
- package/dist/decorators/parameter/module.d.ts.map +0 -1
- package/dist/decorators/parameter/module.js +0 -58
- package/dist/decorators/parameter/module.js.map +0 -1
- package/dist/decorators/parameter/type.d.ts +0 -8
- package/dist/decorators/parameter/type.d.ts.map +0 -1
- package/dist/decorators/parameter/type.js +0 -9
- package/dist/decorators/parameter/type.js.map +0 -1
- package/dist/decorators/type.d.ts +0 -14
- package/dist/decorators/type.d.ts.map +0 -1
- package/dist/decorators/type.js +0 -9
- package/dist/decorators/type.js.map +0 -1
- package/dist/decorators/utils/index.d.ts +0 -2
- package/dist/decorators/utils/index.d.ts.map +0 -1
- package/dist/decorators/utils/index.js +0 -24
- package/dist/decorators/utils/index.js.map +0 -1
- package/dist/decorators/utils/meta.d.ts +0 -3
- package/dist/decorators/utils/meta.d.ts.map +0 -1
- package/dist/decorators/utils/meta.js +0 -24
- package/dist/decorators/utils/meta.js.map +0 -1
package/README.md
CHANGED
|
@@ -62,12 +62,13 @@ router.listen(3000);
|
|
|
62
62
|
According to the fact that routup is a minimalistic framework, it depends on plugins to cover some
|
|
63
63
|
typically http framework functions, which are not integrated in the main package.
|
|
64
64
|
|
|
65
|
-
| Name
|
|
66
|
-
|
|
67
|
-
| [body](https://www.npmjs.com/package/@routup/body)
|
|
68
|
-
| [cookie](https://www.npmjs.com/package/@routup/cookie)
|
|
69
|
-
| [
|
|
70
|
-
| [
|
|
65
|
+
| Name | Description |
|
|
66
|
+
|-----------------------------------------------------------------|--------------------------------------------------------------------------|
|
|
67
|
+
| [body](https://www.npmjs.com/package/@routup/body) | Read and parse the request body. |
|
|
68
|
+
| [cookie](https://www.npmjs.com/package/@routup/cookie) | Read and parse request cookies and serialize cookies for the response. |
|
|
69
|
+
| [decorators](https://www.npmjs.com/package/@routup/decorators) | Create request handlers with class-, method- & parameter-decorators. |
|
|
70
|
+
| [query](https://www.npmjs.com/package/@routup/query) | Read and parse the query string of the request url. |
|
|
71
|
+
| [swagger](https://www.npmjs.com/package/@routup/swagger) | Serve generated docs from URL or based on a JSON file. |
|
|
71
72
|
|
|
72
73
|
## License
|
|
73
74
|
|
package/dist/handler/type.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { Next, Request, Response } from '../type';
|
|
2
2
|
export type Handler = (req: Request, res: Response, next: Next) => unknown;
|
|
3
3
|
export type ErrorHandler = (err: Error, req: Request, res: Response, next: Next) => unknown;
|
|
4
|
-
export interface HandlerInterface {
|
|
5
|
-
run(request: Request, response: Response, next: Next): Promise<void> | void;
|
|
6
|
-
}
|
|
7
4
|
//# sourceMappingURL=type.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/handler/type.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAElD,MAAM,MAAM,OAAO,GAAG,CAClB,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,IAAI,KACT,OAAO,CAAC;AAEb,MAAM,MAAM,YAAY,GAAG,CACvB,GAAG,EAAE,KAAK,EACV,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,IAAI,KACT,OAAO,CAAC
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/handler/type.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAElD,MAAM,MAAM,OAAO,GAAG,CAClB,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,IAAI,KACT,OAAO,CAAC;AAEb,MAAM,MAAM,YAAY,GAAG,CACvB,GAAG,EAAE,KAAK,EACV,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,IAAI,KACT,OAAO,CAAC"}
|
package/dist/handler/utils.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Handler, HandlerInterface } from './type';
|
|
3
|
-
export declare function isHandlerClassInstance(input: unknown): input is HandlerInterface;
|
|
4
|
-
export declare function createHandlerForClassType(item: ClassType): Handler;
|
|
1
|
+
import { Next, Response } from '../type';
|
|
5
2
|
export declare function processHandlerExecutionOutput(res: Response, next: Next, output?: unknown): void;
|
|
6
3
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/handler/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/handler/utils.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGzC,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,OAAO,QAiBxF"}
|
package/dist/handler/utils.js
CHANGED
|
@@ -6,36 +6,9 @@
|
|
|
6
6
|
* view the LICENSE file that was distributed with this source code.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.processHandlerExecutionOutput =
|
|
10
|
-
const smob_1 = require("smob");
|
|
9
|
+
exports.processHandlerExecutionOutput = void 0;
|
|
11
10
|
const helpers_1 = require("../helpers");
|
|
12
11
|
const utils_1 = require("../utils");
|
|
13
|
-
function isHandlerClassInstance(input) {
|
|
14
|
-
return (0, smob_1.isObject)(input) &&
|
|
15
|
-
typeof input.run === 'function';
|
|
16
|
-
}
|
|
17
|
-
exports.isHandlerClassInstance = isHandlerClassInstance;
|
|
18
|
-
function createHandlerForClassType(item) {
|
|
19
|
-
return (req, res, next) => {
|
|
20
|
-
try {
|
|
21
|
-
const middle = new item();
|
|
22
|
-
if (isHandlerClassInstance(middle)) {
|
|
23
|
-
middle.run(req, res, next);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
/* istanbul ignore next */
|
|
27
|
-
middle(req, res, next);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
catch (e) {
|
|
31
|
-
/* istanbul ignore next */
|
|
32
|
-
if (e instanceof Error) {
|
|
33
|
-
next(e);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
exports.createHandlerForClassType = createHandlerForClassType;
|
|
39
12
|
function processHandlerExecutionOutput(res, next, output) {
|
|
40
13
|
if ((0, utils_1.isPromise)(output)) {
|
|
41
14
|
output
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/handler/utils.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/handler/utils.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,wCAAkC;AAElC,oCAAqC;AAErC,SAAgB,6BAA6B,CAAC,GAAa,EAAE,IAAU,EAAE,MAAgB;IACrF,IAAI,IAAA,iBAAS,EAAC,MAAM,CAAC,EAAE;QACnB,MAAM;aACD,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;YACR,IAAI,OAAO,CAAC,KAAK,WAAW,EAAE;gBAC1B,IAAA,cAAI,EAAC,GAAG,EAAE,CAAC,CAAC,CAAC;aAChB;YAED,OAAO,CAAC,CAAC;QACb,CAAC,CAAC;aACD,KAAK,CAAC,IAAI,CAAC,CAAC;QACjB,OAAO;KACV;IAED,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QAC/B,IAAA,cAAI,EAAC,GAAG,EAAE,MAAM,CAAC,CAAC;KACrB;AACL,CAAC;AAjBD,sEAiBC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export * from './constants';
|
|
2
|
-
export * from './decorators';
|
|
3
2
|
export * from './handler';
|
|
4
3
|
export * from './helpers';
|
|
5
4
|
export * from './layer';
|
|
@@ -7,4 +6,5 @@ export * from './path';
|
|
|
7
6
|
export * from './route';
|
|
8
7
|
export * from './router';
|
|
9
8
|
export * from './type';
|
|
9
|
+
export * from './utils';
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,cAAc,aAAa,CAAC;AAC5B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -21,7 +21,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
23
|
__exportStar(require("./constants"), exports);
|
|
24
|
-
__exportStar(require("./decorators"), exports);
|
|
25
24
|
__exportStar(require("./handler"), exports);
|
|
26
25
|
__exportStar(require("./helpers"), exports);
|
|
27
26
|
__exportStar(require("./layer"), exports);
|
|
@@ -29,4 +28,5 @@ __exportStar(require("./path"), exports);
|
|
|
29
28
|
__exportStar(require("./route"), exports);
|
|
30
29
|
__exportStar(require("./router"), exports);
|
|
31
30
|
__exportStar(require("./type"), exports);
|
|
31
|
+
__exportStar(require("./utils"), exports);
|
|
32
32
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,8CAA4B;AAC5B
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,8CAA4B;AAC5B,4CAA0B;AAC1B,4CAA0B;AAC1B,0CAAwB;AACxB,yCAAuB;AACvB,0CAAwB;AACxB,2CAAyB;AACzB,yCAAuB;AACvB,0CAAwB"}
|
package/dist/router/module.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { ErrorHandler, Handler } from '../handler';
|
|
|
4
4
|
import { PathMatcher } from '../path';
|
|
5
5
|
import { Layer } from '../layer';
|
|
6
6
|
import { Route } from '../route';
|
|
7
|
-
import {
|
|
7
|
+
import { DispatcherMeta, Next, Path, Request, Response } from '../type';
|
|
8
8
|
import { RouterOptions } from './type';
|
|
9
9
|
export declare function isRouterInstance(input: unknown): input is Router;
|
|
10
10
|
export declare class Router {
|
|
@@ -40,7 +40,5 @@ export declare class Router {
|
|
|
40
40
|
use(path: Path, router: Router): this;
|
|
41
41
|
use(path: Path, handler: Handler): this;
|
|
42
42
|
use(path: Path, handler: ErrorHandler): this;
|
|
43
|
-
useController(input: (ClassType | Record<string, any>)): void;
|
|
44
|
-
useControllers(input: (ClassType | Record<string, any>)[]): void;
|
|
45
43
|
}
|
|
46
44
|
//# sourceMappingURL=module.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/router/module.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,eAAe,EAAgB,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/router/module.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,eAAe,EAAgB,MAAM,MAAM,CAAC;AAGrD,OAAO,EACH,YAAY,EAAE,OAAO,EACxB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAStC,OAAO,EAAE,KAAK,EAAmB,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,KAAK,EAAmB,MAAM,UAAU,CAAC;AAClD,OAAO,EACH,cAAc,EACd,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,QAAQ,EACX,MAAM,SAAS,CAAC;AAKjB,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAI,KAAK,IAAI,MAAM,CAEjE;AAED,qBAAa,MAAM;IACf,QAAQ,CAAC,aAAa,SAAwB;IAE9C,SAAS,CAAC,SAAS,EAAG,IAAI,GAAG,SAAS,CAAC;IAEvC,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAEtC,SAAS,CAAC,KAAK,EAAG,CAAC,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC,EAAE,CAAM;IAElD,SAAS,CAAC,WAAW,EAAG,WAAW,GAAG,SAAS,CAAC;IAEhD;;;;OAIG;IACH,SAAS,CAAC,MAAM,EAAG,OAAO,GAAG,SAAS,CAAC;gBAI3B,OAAO,CAAC,E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AAE,MAAM,GAAI,IAAI;IAEtC,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,GAAI,IAAI;IAExC,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,GAAI,IAAI;CA+BhD"}
|
package/dist/router/module.js
CHANGED
|
@@ -10,16 +10,13 @@ exports.Router = exports.isRouterInstance = void 0;
|
|
|
10
10
|
const http_1 = require("http");
|
|
11
11
|
const smob_1 = require("smob");
|
|
12
12
|
const constants_1 = require("../constants");
|
|
13
|
-
const decorators_1 = require("../decorators");
|
|
14
|
-
const utils_1 = require("../decorators/utils");
|
|
15
|
-
const handler_1 = require("../handler");
|
|
16
13
|
const path_1 = require("../path");
|
|
17
|
-
const
|
|
14
|
+
const utils_1 = require("../utils");
|
|
18
15
|
const layer_1 = require("../layer");
|
|
19
16
|
const route_1 = require("../route");
|
|
20
17
|
const helpers_1 = require("../helpers");
|
|
21
18
|
function isRouterInstance(input) {
|
|
22
|
-
return (0,
|
|
19
|
+
return (0, utils_1.isInstance)(input, 'Router');
|
|
23
20
|
}
|
|
24
21
|
exports.isRouterInstance = isRouterInstance;
|
|
25
22
|
class Router {
|
|
@@ -33,12 +30,12 @@ class Router {
|
|
|
33
30
|
}
|
|
34
31
|
// --------------------------------------------------
|
|
35
32
|
setMountPath(value) {
|
|
36
|
-
if (value === '/' || !(0,
|
|
33
|
+
if (value === '/' || !(0, utils_1.isPath)(value)) {
|
|
37
34
|
this.mountPath = '/';
|
|
38
35
|
return;
|
|
39
36
|
}
|
|
40
37
|
if (typeof value === 'string') {
|
|
41
|
-
this.mountPath = (0,
|
|
38
|
+
this.mountPath = (0, utils_1.withLeadingSlash)((0, utils_1.withoutTrailingSlash)(`${value}`));
|
|
42
39
|
}
|
|
43
40
|
else {
|
|
44
41
|
this.mountPath = value;
|
|
@@ -71,7 +68,7 @@ class Router {
|
|
|
71
68
|
let allowedMethods = [];
|
|
72
69
|
if (this.isRoot &&
|
|
73
70
|
this.timeout) {
|
|
74
|
-
(0,
|
|
71
|
+
(0, utils_1.createResponseTimeout)(res, this.timeout, done);
|
|
75
72
|
}
|
|
76
73
|
const fn = (err) => {
|
|
77
74
|
/* istanbul ignore if */
|
|
@@ -103,16 +100,17 @@ class Router {
|
|
|
103
100
|
if (this.pathMatcher) {
|
|
104
101
|
const output = this.pathMatcher.exec(path);
|
|
105
102
|
if (typeof output !== 'undefined') {
|
|
106
|
-
meta.mountPath = (0,
|
|
103
|
+
meta.mountPath = (0, utils_1.cleanDoubleSlashes)(`${meta.mountPath || ''}/${output.path}`);
|
|
107
104
|
if (path === output.path) {
|
|
108
105
|
path = '/';
|
|
109
106
|
}
|
|
110
107
|
else {
|
|
111
|
-
path = (0,
|
|
108
|
+
path = (0, utils_1.withLeadingSlash)(path.substring(output.path.length));
|
|
112
109
|
}
|
|
113
110
|
meta.params = (0, smob_1.merge)(meta.params || {}, output.params);
|
|
114
111
|
}
|
|
115
112
|
}
|
|
113
|
+
meta.path = path;
|
|
116
114
|
if (!meta.mountPath) {
|
|
117
115
|
meta.mountPath = '/';
|
|
118
116
|
}
|
|
@@ -147,16 +145,17 @@ class Router {
|
|
|
147
145
|
fn(err);
|
|
148
146
|
return;
|
|
149
147
|
}
|
|
150
|
-
const layerMeta = Object.assign(
|
|
148
|
+
const layerMeta = Object.assign({}, meta);
|
|
151
149
|
if ((0, layer_1.isLayerInstance)(layer)) {
|
|
152
150
|
const output = layer.exec(path);
|
|
153
151
|
if (output) {
|
|
154
152
|
layerMeta.params = (0, smob_1.merge)(output.params, layerMeta.params || {});
|
|
155
|
-
layerMeta.mountPath = (0,
|
|
153
|
+
layerMeta.mountPath = (0, utils_1.cleanDoubleSlashes)(`${layerMeta.mountPath || ''}/${output.path}`);
|
|
156
154
|
}
|
|
157
155
|
}
|
|
158
156
|
if (err) {
|
|
159
|
-
if ((0, layer_1.isLayerInstance)(layer) &&
|
|
157
|
+
if ((0, layer_1.isLayerInstance)(layer) &&
|
|
158
|
+
layer.isError()) {
|
|
160
159
|
layer.dispatch(req, res, layerMeta, next, err);
|
|
161
160
|
return;
|
|
162
161
|
}
|
|
@@ -184,7 +183,7 @@ class Router {
|
|
|
184
183
|
route(path) {
|
|
185
184
|
if (typeof path === 'string' &&
|
|
186
185
|
path.length > 0) {
|
|
187
|
-
path = (0,
|
|
186
|
+
path = (0, utils_1.withLeadingSlash)(path);
|
|
188
187
|
}
|
|
189
188
|
const index = this.stack.findIndex((item) => (0, route_1.isRouteInstance)(item) && item.path === path);
|
|
190
189
|
if (index !== -1) {
|
|
@@ -235,7 +234,7 @@ class Router {
|
|
|
235
234
|
return this;
|
|
236
235
|
}
|
|
237
236
|
let path;
|
|
238
|
-
if ((0,
|
|
237
|
+
if ((0, utils_1.isPath)(input[0])) {
|
|
239
238
|
path = input.shift();
|
|
240
239
|
}
|
|
241
240
|
for (let i = 0; i < input.length; i++) {
|
|
@@ -253,49 +252,6 @@ class Router {
|
|
|
253
252
|
}
|
|
254
253
|
return this;
|
|
255
254
|
}
|
|
256
|
-
// --------------------------------------------------
|
|
257
|
-
useController(input) {
|
|
258
|
-
let controller;
|
|
259
|
-
if ((0, smob_1.isObject)(input)) {
|
|
260
|
-
controller = input;
|
|
261
|
-
}
|
|
262
|
-
else {
|
|
263
|
-
controller = new input();
|
|
264
|
-
}
|
|
265
|
-
const meta = (0, utils_1.useDecoratorMeta)(controller);
|
|
266
|
-
const router = new Router();
|
|
267
|
-
for (let i = 0; i < meta.middlewares.length; i++) {
|
|
268
|
-
const handler = (0, handler_1.createHandlerForClassType)(meta.middlewares[i]);
|
|
269
|
-
router.use(handler);
|
|
270
|
-
}
|
|
271
|
-
const propertyKeys = Object.keys(meta.methods);
|
|
272
|
-
for (let i = 0; i < propertyKeys.length; i++) {
|
|
273
|
-
const handler = (req, res, next) => {
|
|
274
|
-
const output = controller[propertyKeys[i]].apply(controller, [
|
|
275
|
-
...(0, decorators_1.buildDecoratorMethodArguments)(req, res, next, meta.parameters[propertyKeys[i]]),
|
|
276
|
-
]);
|
|
277
|
-
(0, handler_1.processHandlerExecutionOutput)(res, next, output);
|
|
278
|
-
};
|
|
279
|
-
const method = meta.methods[propertyKeys[i]];
|
|
280
|
-
const handlers = [];
|
|
281
|
-
if (method.middlewares) {
|
|
282
|
-
for (let i = 0; i < method.middlewares.length; i++) {
|
|
283
|
-
handlers.push((0, handler_1.createHandlerForClassType)(method.middlewares[i]));
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
router[method.method].apply(router, [
|
|
287
|
-
method.url,
|
|
288
|
-
...handlers,
|
|
289
|
-
handler,
|
|
290
|
-
]);
|
|
291
|
-
}
|
|
292
|
-
this.use(meta.url, router);
|
|
293
|
-
}
|
|
294
|
-
useControllers(input) {
|
|
295
|
-
for (let i = 0; i < input.length; i++) {
|
|
296
|
-
this.useController(input[i]);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
255
|
}
|
|
300
256
|
exports.Router = Router;
|
|
301
257
|
//# sourceMappingURL=module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/router/module.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,+BAAqD;AACrD,+
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/router/module.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,+BAAqD;AACrD,+BAA0C;AAC1C,4CAAkD;AAIlD,kCAAsC;AACtC,oCAOkB;AAClB,oCAAkD;AAClD,oCAAkD;AAQlD,wCAGoB;AAGpB,SAAgB,gBAAgB,CAAC,KAAc;IAC3C,OAAO,IAAA,kBAAU,EAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AACvC,CAAC;AAFD,4CAEC;AAED,MAAa,MAAM;IAkBf,qDAAqD;IAErD,YAAY,OAAuB;QAnB1B,mBAAa,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAMpC,UAAK,GAAg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CAAC,CAAC;aAChF;SACJ;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AA5WD,wBA4WC"}
|
package/dist/type.d.ts
CHANGED
package/dist/type.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../src/type.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAEvD,MAAM,WAAW,QAAS,SAAQ,cAAc;CAE/C;AAED,MAAM,WAAW,OAAQ,SAAQ,eAAe;CAE/C;AAED,MAAM,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;AAEzC,MAAM,MAAM,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;AAInC,MAAM,MAAM,cAAc,GAAG;IACzB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,SAAS,CAAC,EAAE,MAAM,CAAA;CACrB,CAAC
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../src/type.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAEvD,MAAM,WAAW,QAAS,SAAQ,cAAc;CAE/C;AAED,MAAM,WAAW,OAAQ,SAAQ,eAAe;CAE/C;AAED,MAAM,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;AAEzC,MAAM,MAAM,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;AAInC,MAAM,MAAM,cAAc,GAAG;IACzB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,SAAS,CAAC,EAAE,MAAM,CAAA;CACrB,CAAC"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAOA,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAOA,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -22,6 +22,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
23
|
__exportStar(require("./is-instance"), exports);
|
|
24
24
|
__exportStar(require("./mime"), exports);
|
|
25
|
+
__exportStar(require("./object"), exports);
|
|
25
26
|
__exportStar(require("./path"), exports);
|
|
26
27
|
__exportStar(require("./promise"), exports);
|
|
27
28
|
__exportStar(require("./response"), exports);
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,gDAA8B;AAC9B,yCAAuB;AACvB,yCAAuB;AACvB,4CAA0B;AAC1B,6CAA2B;AAC3B,wCAAsB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,gDAA8B;AAC9B,yCAAuB;AACvB,2CAAyB;AACzB,yCAAuB;AACvB,4CAA0B;AAC1B,6CAA2B;AAC3B,wCAAsB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../src/utils/object.ts"],"names":[],"mappings":"AAOA,wBAAgB,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAI,IAAI,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAMpE"}
|
|
@@ -6,4 +6,11 @@
|
|
|
6
6
|
* view the LICENSE file that was distributed with this source code.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
|
|
9
|
+
exports.isObject = void 0;
|
|
10
|
+
function isObject(item) {
|
|
11
|
+
return (!!item &&
|
|
12
|
+
typeof item === 'object' &&
|
|
13
|
+
!Array.isArray(item));
|
|
14
|
+
}
|
|
15
|
+
exports.isObject = isObject;
|
|
16
|
+
//# sourceMappingURL=object.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object.js","sourceRoot":"","sources":["../../src/utils/object.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,SAAgB,QAAQ,CAAC,IAAa;IAClC,OAAO,CACH,CAAC,CAAC,IAAI;QACN,OAAO,IAAI,KAAK,QAAQ;QACxB,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CACvB,CAAC;AACN,CAAC;AAND,4BAMC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "routup",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Routup is a minimalistic http based routing framework.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"path-to-regexp": "^6.2.1",
|
|
53
53
|
"smob": "^0.0.6"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "d0ca9f5c1f2cd6c336858d4793505b92473c4d80"
|
|
56
56
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/decorators/controller/index.ts"],"names":[],"mappings":"AAOA,cAAc,UAAU,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2022.
|
|
4
|
-
* Author Peter Placzek (tada5hi)
|
|
5
|
-
* For the full copyright and license information,
|
|
6
|
-
* view the LICENSE file that was distributed with this source code.
|
|
7
|
-
*/
|
|
8
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
10
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
-
}
|
|
14
|
-
Object.defineProperty(o, k2, desc);
|
|
15
|
-
}) : (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === undefined) k2 = k;
|
|
17
|
-
o[k2] = m[k];
|
|
18
|
-
}));
|
|
19
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
20
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
-
};
|
|
22
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
__exportStar(require("./module"), exports);
|
|
24
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/decorators/controller/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,2CAAyB"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ClassType } from '../../type';
|
|
2
|
-
export declare function createClassDecorator(url: string, middlewares?: ClassType[]): ClassDecorator;
|
|
3
|
-
export declare function DController(url: string, middlewares?: ClassType[]): ClassDecorator;
|
|
4
|
-
//# sourceMappingURL=module.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/decorators/controller/module.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,wBAAgB,oBAAoB,CAChC,GAAG,EAAE,MAAM,EACX,WAAW,CAAC,EAAE,SAAS,EAAE,GACzB,cAAc,CAcjB;AAED,wBAAgB,WAAW,CACvB,GAAG,EAAE,MAAM,EACX,WAAW,CAAC,EAAE,SAAS,EAAE,GACzB,cAAc,CAEjB"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2022-2022.
|
|
4
|
-
* Author Peter Placzek (tada5hi)
|
|
5
|
-
* For the full copyright and license information,
|
|
6
|
-
* view the LICENSE file that was distributed with this source code.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.DController = exports.createClassDecorator = void 0;
|
|
10
|
-
const utils_1 = require("../utils");
|
|
11
|
-
function createClassDecorator(url, middlewares) {
|
|
12
|
-
return (target) => {
|
|
13
|
-
const meta = (0, utils_1.useDecoratorMeta)(target.prototype);
|
|
14
|
-
meta.url = url;
|
|
15
|
-
meta.middlewares = [];
|
|
16
|
-
if (Array.isArray(middlewares)) {
|
|
17
|
-
meta.middlewares = [
|
|
18
|
-
...meta.middlewares,
|
|
19
|
-
...middlewares,
|
|
20
|
-
];
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
exports.createClassDecorator = createClassDecorator;
|
|
25
|
-
function DController(url, middlewares) {
|
|
26
|
-
return createClassDecorator(url, middlewares);
|
|
27
|
-
}
|
|
28
|
-
exports.DController = DController;
|
|
29
|
-
//# sourceMappingURL=module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../src/decorators/controller/module.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAGH,oCAA4C;AAE5C,SAAgB,oBAAoB,CAChC,GAAW,EACX,WAAyB;IAEzB,OAAO,CAAC,MAAW,EAAS,EAAE;QAC1B,MAAM,IAAI,GAAG,IAAA,wBAAgB,EAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAEhD,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QAEtB,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;YAC5B,IAAI,CAAC,WAAW,GAAG;gBACf,GAAG,IAAI,CAAC,WAAW;gBACnB,GAAG,WAAW;aACjB,CAAC;SACL;IACL,CAAC,CAAC;AACN,CAAC;AAjBD,oDAiBC;AAED,SAAgB,WAAW,CACvB,GAAW,EACX,WAAyB;IAEzB,OAAO,oBAAoB,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;AAClD,CAAC;AALD,kCAKC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/decorators/index.ts"],"names":[],"mappings":"AAOA,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC"}
|
package/dist/decorators/index.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2022-2022.
|
|
4
|
-
* Author Peter Placzek (tada5hi)
|
|
5
|
-
* For the full copyright and license information,
|
|
6
|
-
* view the LICENSE file that was distributed with this source code.
|
|
7
|
-
*/
|
|
8
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
10
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
-
}
|
|
14
|
-
Object.defineProperty(o, k2, desc);
|
|
15
|
-
}) : (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === undefined) k2 = k;
|
|
17
|
-
o[k2] = m[k];
|
|
18
|
-
}));
|
|
19
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
20
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
-
};
|
|
22
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
__exportStar(require("./controller"), exports);
|
|
24
|
-
__exportStar(require("./method"), exports);
|
|
25
|
-
__exportStar(require("./parameter"), exports);
|
|
26
|
-
__exportStar(require("./type"), exports);
|
|
27
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/decorators/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,+CAA6B;AAC7B,2CAAyB;AACzB,8CAA4B;AAC5B,yCAAuB"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Next, Request, Response } from '../../type';
|
|
2
|
-
import { DecoratorParameterOptions } from '../parameter';
|
|
3
|
-
export declare function buildDecoratorMethodArguments(req: Request, res: Response, next: Next, parameters: DecoratorParameterOptions[]): any[];
|
|
4
|
-
//# sourceMappingURL=arguments.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"arguments.d.ts","sourceRoot":"","sources":["../../../src/decorators/method/arguments.ts"],"names":[],"mappings":"AAMA,OAAO,EACH,IAAI,EAAE,OAAO,EAAE,QAAQ,EAC1B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAEzD,wBAAgB,6BAA6B,CACzC,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,yBAAyB,EAAE,GACxC,GAAG,EAAE,CAmBP"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildDecoratorMethodArguments = void 0;
|
|
4
|
-
function buildDecoratorMethodArguments(req, res, next, parameters) {
|
|
5
|
-
/* istanbul ignore next */
|
|
6
|
-
if (parameters.length === 0) {
|
|
7
|
-
return [req, res, next];
|
|
8
|
-
}
|
|
9
|
-
const items = [];
|
|
10
|
-
for (let i = 0; i < parameters.length; i++) {
|
|
11
|
-
const parameter = parameters[i];
|
|
12
|
-
if (typeof parameter.property === 'string') {
|
|
13
|
-
items[parameter.index] = parameter.build(req, res, next, parameter.property);
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
items[parameter.index] = parameter.build(req, res, next);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return items;
|
|
20
|
-
}
|
|
21
|
-
exports.buildDecoratorMethodArguments = buildDecoratorMethodArguments;
|
|
22
|
-
//# sourceMappingURL=arguments.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"arguments.js","sourceRoot":"","sources":["../../../src/decorators/method/arguments.ts"],"names":[],"mappings":";;;AAWA,SAAgB,6BAA6B,CACzC,GAAY,EACZ,GAAa,EACb,IAAU,EACV,UAAuC;IAEvC,0BAA0B;IAC1B,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;QACzB,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;KAC3B;IAED,MAAM,KAAK,GAAU,EAAE,CAAC;IAExB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACxC,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;QAEhC,IAAI,OAAO,SAAS,CAAC,QAAQ,KAAK,QAAQ,EAAE;YACxC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;SAChF;aAAM;YACH,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;SAC5D;KACJ;IAED,OAAO,KAAK,CAAC;AACjB,CAAC;AAxBD,sEAwBC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/decorators/method/index.ts"],"names":[],"mappings":"AAOA,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2022.
|
|
4
|
-
* Author Peter Placzek (tada5hi)
|
|
5
|
-
* For the full copyright and license information,
|
|
6
|
-
* view the LICENSE file that was distributed with this source code.
|
|
7
|
-
*/
|
|
8
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
10
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
-
}
|
|
14
|
-
Object.defineProperty(o, k2, desc);
|
|
15
|
-
}) : (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === undefined) k2 = k;
|
|
17
|
-
o[k2] = m[k];
|
|
18
|
-
}));
|
|
19
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
20
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
-
};
|
|
22
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
__exportStar(require("./arguments"), exports);
|
|
24
|
-
__exportStar(require("./module"), exports);
|
|
25
|
-
__exportStar(require("./type"), exports);
|
|
26
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/decorators/method/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,8CAA4B;AAC5B,2CAAyB;AACzB,yCAAuB"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ClassType } from '../../type';
|
|
2
|
-
export declare function createMethodDecorator(method: string, url: string, handlers?: ClassType[]): MethodDecorator;
|
|
3
|
-
export declare function DDelete(url: string, handlers?: ClassType[]): MethodDecorator;
|
|
4
|
-
export declare function DGet(url: string, handlers?: ClassType[]): MethodDecorator;
|
|
5
|
-
export declare function DPost(url: string, handlers?: ClassType[]): MethodDecorator;
|
|
6
|
-
export declare function DPut(url: string, handlers?: ClassType[]): MethodDecorator;
|
|
7
|
-
export declare function DPatch(url: string, handlers?: ClassType[]): MethodDecorator;
|
|
8
|
-
//# sourceMappingURL=module.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/decorators/method/module.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,wBAAgB,qBAAqB,CACjC,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,QAAQ,CAAC,EAAE,SAAS,EAAE,GACtB,eAAe,CAmBlB;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAI,eAAe,CAE7E;AAED,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAI,eAAe,CAE1E;AAED,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAI,eAAe,CAE3E;AAED,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAI,eAAe,CAE1E;AAED,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAI,eAAe,CAE5E"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2022-2022.
|
|
4
|
-
* Author Peter Placzek (tada5hi)
|
|
5
|
-
* For the full copyright and license information,
|
|
6
|
-
* view the LICENSE file that was distributed with this source code.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.DPatch = exports.DPut = exports.DPost = exports.DGet = exports.DDelete = exports.createMethodDecorator = void 0;
|
|
10
|
-
const utils_1 = require("../utils");
|
|
11
|
-
function createMethodDecorator(method, url, handlers) {
|
|
12
|
-
return (target, propertyKey, descriptor) => {
|
|
13
|
-
/* istanbul ignore next */
|
|
14
|
-
if (typeof propertyKey !== 'string') {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
const meta = (0, utils_1.useDecoratorMeta)(target);
|
|
18
|
-
meta.methods[propertyKey] = {
|
|
19
|
-
method,
|
|
20
|
-
url,
|
|
21
|
-
middlewares: handlers || [],
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
exports.createMethodDecorator = createMethodDecorator;
|
|
26
|
-
function DDelete(url, handlers) {
|
|
27
|
-
return createMethodDecorator('delete', url, handlers);
|
|
28
|
-
}
|
|
29
|
-
exports.DDelete = DDelete;
|
|
30
|
-
function DGet(url, handlers) {
|
|
31
|
-
return createMethodDecorator('get', url, handlers);
|
|
32
|
-
}
|
|
33
|
-
exports.DGet = DGet;
|
|
34
|
-
function DPost(url, handlers) {
|
|
35
|
-
return createMethodDecorator('post', url, handlers);
|
|
36
|
-
}
|
|
37
|
-
exports.DPost = DPost;
|
|
38
|
-
function DPut(url, handlers) {
|
|
39
|
-
return createMethodDecorator('put', url, handlers);
|
|
40
|
-
}
|
|
41
|
-
exports.DPut = DPut;
|
|
42
|
-
function DPatch(url, handlers) {
|
|
43
|
-
return createMethodDecorator('patch', url, handlers);
|
|
44
|
-
}
|
|
45
|
-
exports.DPatch = DPatch;
|
|
46
|
-
//# sourceMappingURL=module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../src/decorators/method/module.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAGH,oCAA4C;AAE5C,SAAgB,qBAAqB,CACjC,MAAc,EACd,GAAW,EACX,QAAsB;IAEtB,OAAO,CACH,MAAW,EACX,WAA4B,EAC5B,UAAwC,EACnC,EAAE;QACP,0BAA0B;QAC1B,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;YACjC,OAAO;SACV;QAED,MAAM,IAAI,GAAG,IAAA,wBAAgB,EAAC,MAAM,CAAC,CAAC;QAEtC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG;YACxB,MAAM;YACN,GAAG;YACH,WAAW,EAAE,QAAQ,IAAI,EAAE;SAC9B,CAAC;IACN,CAAC,CAAC;AACN,CAAC;AAvBD,sDAuBC;AAED,SAAgB,OAAO,CAAC,GAAW,EAAE,QAAsB;IACvD,OAAO,qBAAqB,CAAC,QAAQ,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;AAC1D,CAAC;AAFD,0BAEC;AAED,SAAgB,IAAI,CAAC,GAAW,EAAE,QAAsB;IACpD,OAAO,qBAAqB,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;AACvD,CAAC;AAFD,oBAEC;AAED,SAAgB,KAAK,CAAC,GAAW,EAAE,QAAsB;IACrD,OAAO,qBAAqB,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;AACxD,CAAC;AAFD,sBAEC;AAED,SAAgB,IAAI,CAAC,GAAW,EAAE,QAAsB;IACpD,OAAO,qBAAqB,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;AACvD,CAAC;AAFD,oBAEC;AAED,SAAgB,MAAM,CAAC,GAAW,EAAE,QAAsB;IACtD,OAAO,qBAAqB,CAAC,OAAO,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;AACzD,CAAC;AAFD,wBAEC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../src/decorators/method/type.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,MAAM,sBAAsB,GAAG;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,SAAS,EAAE,CAAC;CAC5B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../src/decorators/method/type.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/decorators/parameter/index.ts"],"names":[],"mappings":"AAOA,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2022.
|
|
4
|
-
* Author Peter Placzek (tada5hi)
|
|
5
|
-
* For the full copyright and license information,
|
|
6
|
-
* view the LICENSE file that was distributed with this source code.
|
|
7
|
-
*/
|
|
8
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
10
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
-
}
|
|
14
|
-
Object.defineProperty(o, k2, desc);
|
|
15
|
-
}) : (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === undefined) k2 = k;
|
|
17
|
-
o[k2] = m[k];
|
|
18
|
-
}));
|
|
19
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
20
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
-
};
|
|
22
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
__exportStar(require("./module"), exports);
|
|
24
|
-
__exportStar(require("./type"), exports);
|
|
25
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/decorators/parameter/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,2CAAyB;AACzB,yCAAuB"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { DecoratorParameterBuildFn } from './type';
|
|
2
|
-
export declare function createParameterDecorator(build: DecoratorParameterBuildFn): ((property?: string) => ParameterDecorator);
|
|
3
|
-
export declare function DRequest(): ParameterDecorator;
|
|
4
|
-
export declare function DResponse(): ParameterDecorator;
|
|
5
|
-
export declare function DNext(): ParameterDecorator;
|
|
6
|
-
export declare function DParams(): ParameterDecorator;
|
|
7
|
-
export declare function DParam(property: string): ParameterDecorator;
|
|
8
|
-
export declare function DHeaders(): ParameterDecorator;
|
|
9
|
-
export declare function DHeader(property: string): ParameterDecorator;
|
|
10
|
-
//# sourceMappingURL=module.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/decorators/parameter/module.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,yBAAyB,EAAE,MAAM,QAAQ,CAAC;AAEnD,wBAAgB,wBAAwB,CACpC,KAAK,EAAE,yBAAyB,GAChC,CAAC,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,kBAAkB,CAAC,CAsB9C;AAED,wBAAgB,QAAQ,IAAK,kBAAkB,CAE9C;AAED,wBAAgB,SAAS,IAAK,kBAAkB,CAE/C;AAED,wBAAgB,KAAK,IAAK,kBAAkB,CAE3C;AAED,wBAAgB,OAAO,IAAK,kBAAkB,CAE7C;AAED,wBAAgB,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAI,kBAAkB,CAE5D;AAED,wBAAgB,QAAQ,IAAK,kBAAkB,CAE9C;AAED,wBAAgB,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAI,kBAAkB,CAE7D"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2022-2022.
|
|
4
|
-
* Author Peter Placzek (tada5hi)
|
|
5
|
-
* For the full copyright and license information,
|
|
6
|
-
* view the LICENSE file that was distributed with this source code.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.DHeader = exports.DHeaders = exports.DParam = exports.DParams = exports.DNext = exports.DResponse = exports.DRequest = exports.createParameterDecorator = void 0;
|
|
10
|
-
const helpers_1 = require("../../helpers");
|
|
11
|
-
const utils_1 = require("../utils");
|
|
12
|
-
function createParameterDecorator(build) {
|
|
13
|
-
return (property) => (target, propertyKey, parameterIndex) => {
|
|
14
|
-
/* istanbul ignore next */
|
|
15
|
-
if (typeof propertyKey !== 'string') {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
const meta = (0, utils_1.useDecoratorMeta)(target);
|
|
19
|
-
if (typeof meta.parameters[propertyKey] === 'undefined') {
|
|
20
|
-
meta.parameters[propertyKey] = [];
|
|
21
|
-
}
|
|
22
|
-
meta.parameters[propertyKey].push({
|
|
23
|
-
index: parameterIndex,
|
|
24
|
-
property,
|
|
25
|
-
build,
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
exports.createParameterDecorator = createParameterDecorator;
|
|
30
|
-
function DRequest() {
|
|
31
|
-
return createParameterDecorator((req) => req)();
|
|
32
|
-
}
|
|
33
|
-
exports.DRequest = DRequest;
|
|
34
|
-
function DResponse() {
|
|
35
|
-
return createParameterDecorator((req, res) => res)();
|
|
36
|
-
}
|
|
37
|
-
exports.DResponse = DResponse;
|
|
38
|
-
function DNext() {
|
|
39
|
-
return createParameterDecorator((req, res, next) => next)();
|
|
40
|
-
}
|
|
41
|
-
exports.DNext = DNext;
|
|
42
|
-
function DParams() {
|
|
43
|
-
return createParameterDecorator((req, res, next) => (0, helpers_1.useRequestParams)(req))();
|
|
44
|
-
}
|
|
45
|
-
exports.DParams = DParams;
|
|
46
|
-
function DParam(property) {
|
|
47
|
-
return createParameterDecorator((req, res, next) => (0, helpers_1.useRequestParam)(req, property))(property);
|
|
48
|
-
}
|
|
49
|
-
exports.DParam = DParam;
|
|
50
|
-
function DHeaders() {
|
|
51
|
-
return createParameterDecorator((req, res, next) => req.headers)();
|
|
52
|
-
}
|
|
53
|
-
exports.DHeaders = DHeaders;
|
|
54
|
-
function DHeader(property) {
|
|
55
|
-
return createParameterDecorator((req, res, next) => req.headers[property])(property);
|
|
56
|
-
}
|
|
57
|
-
exports.DHeader = DHeader;
|
|
58
|
-
//# sourceMappingURL=module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../src/decorators/parameter/module.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,2CAAkE;AAClE,oCAA4C;AAG5C,SAAgB,wBAAwB,CACpC,KAAgC;IAEhC,OAAO,CAAC,QAAiB,EAAE,EAAE,CAAC,CAC1B,MAAW,EACX,WAA4B,EAC5B,cAAsB,EACxB,EAAE;QACA,0BAA0B;QAC1B,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;YACjC,OAAO;SACV;QAED,MAAM,IAAI,GAAG,IAAA,wBAAgB,EAAC,MAAM,CAAC,CAAC;QACtC,IAAI,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,WAAW,EAAE;YACrD,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC;SACrC;QAED,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC;YAC9B,KAAK,EAAE,cAAc;YACrB,QAAQ;YACR,KAAK;SACR,CAAC,CAAC;IACP,CAAC,CAAC;AACN,CAAC;AAxBD,4DAwBC;AAED,SAAgB,QAAQ;IACpB,OAAO,wBAAwB,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;AACpD,CAAC;AAFD,4BAEC;AAED,SAAgB,SAAS;IACrB,OAAO,wBAAwB,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;AACzD,CAAC;AAFD,8BAEC;AAED,SAAgB,KAAK;IACjB,OAAO,wBAAwB,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;AAChE,CAAC;AAFD,sBAEC;AAED,SAAgB,OAAO;IACnB,OAAO,wBAAwB,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,IAAA,0BAAgB,EAAC,GAAG,CAAC,CAAC,EAAE,CAAC;AACjF,CAAC;AAFD,0BAEC;AAED,SAAgB,MAAM,CAAC,QAAgB;IACnC,OAAO,wBAAwB,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,IAAA,yBAAe,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AAClG,CAAC;AAFD,wBAEC;AAED,SAAgB,QAAQ;IACpB,OAAO,wBAAwB,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;AACvE,CAAC;AAFD,4BAEC;AAED,SAAgB,OAAO,CAAC,QAAgB;IACpC,OAAO,wBAAwB,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AACzF,CAAC;AAFD,0BAEC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Next, Request, Response } from '../../type';
|
|
2
|
-
export type DecoratorParameterBuildFn = (req: Request, res: Response, next: Next, property?: string) => any;
|
|
3
|
-
export type DecoratorParameterOptions = {
|
|
4
|
-
index: number;
|
|
5
|
-
build: DecoratorParameterBuildFn;
|
|
6
|
-
property?: string;
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=type.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../src/decorators/parameter/type.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAErD,MAAM,MAAM,yBAAyB,GAAG,CACpC,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,IAAI,EACV,QAAQ,CAAC,EAAE,MAAM,KAChB,GAAG,CAAC;AAET,MAAM,MAAM,yBAAyB,GAAG;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,yBAAyB,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2022.
|
|
4
|
-
* Author Peter Placzek (tada5hi)
|
|
5
|
-
* For the full copyright and license information,
|
|
6
|
-
* view the LICENSE file that was distributed with this source code.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
//# sourceMappingURL=type.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../src/decorators/parameter/type.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ClassType } from '../type';
|
|
2
|
-
import { DecoratorMethodOptions } from './method';
|
|
3
|
-
import { DecoratorParameterOptions } from './parameter';
|
|
4
|
-
export type DecoratorMeta = {
|
|
5
|
-
url: string;
|
|
6
|
-
methods: {
|
|
7
|
-
[key: string]: DecoratorMethodOptions;
|
|
8
|
-
};
|
|
9
|
-
middlewares: ClassType[];
|
|
10
|
-
parameters: {
|
|
11
|
-
[key: string]: DecoratorParameterOptions[];
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=type.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/decorators/type.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAExD,MAAM,MAAM,aAAa,GAAG;IACxB,GAAG,EAAE,MAAM,CAAC;IAEZ,OAAO,EAAE;QACL,CAAC,GAAG,EAAE,MAAM,GAAG,sBAAsB,CAAA;KACxC,CAAC;IAEF,WAAW,EAAE,SAAS,EAAE,CAAC;IAEzB,UAAU,EAAE;QACR,CAAC,GAAG,EAAE,MAAM,GAAG,yBAAyB,EAAE,CAAA;KAC7C,CAAA;CACJ,CAAC"}
|
package/dist/decorators/type.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2022-2022.
|
|
4
|
-
* Author Peter Placzek (tada5hi)
|
|
5
|
-
* For the full copyright and license information,
|
|
6
|
-
* view the LICENSE file that was distributed with this source code.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
//# sourceMappingURL=type.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../src/decorators/type.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/decorators/utils/index.ts"],"names":[],"mappings":"AAOA,cAAc,QAAQ,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2022.
|
|
4
|
-
* Author Peter Placzek (tada5hi)
|
|
5
|
-
* For the full copyright and license information,
|
|
6
|
-
* view the LICENSE file that was distributed with this source code.
|
|
7
|
-
*/
|
|
8
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
10
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
-
}
|
|
14
|
-
Object.defineProperty(o, k2, desc);
|
|
15
|
-
}) : (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === undefined) k2 = k;
|
|
17
|
-
o[k2] = m[k];
|
|
18
|
-
}));
|
|
19
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
20
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
-
};
|
|
22
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
__exportStar(require("./meta"), exports);
|
|
24
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/decorators/utils/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,yCAAuB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/decorators/utils/meta.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAIxC,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAI,aAAa,CAa5E"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2022.
|
|
4
|
-
* Author Peter Placzek (tada5hi)
|
|
5
|
-
* For the full copyright and license information,
|
|
6
|
-
* view the LICENSE file that was distributed with this source code.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.useDecoratorMeta = void 0;
|
|
10
|
-
const symbol = Symbol.for('DecoratorMeta');
|
|
11
|
-
function useDecoratorMeta(target) {
|
|
12
|
-
if (symbol in target) {
|
|
13
|
-
return target[symbol];
|
|
14
|
-
}
|
|
15
|
-
target[symbol] = {
|
|
16
|
-
url: '',
|
|
17
|
-
middlewares: [],
|
|
18
|
-
methods: {},
|
|
19
|
-
parameters: {},
|
|
20
|
-
};
|
|
21
|
-
return target[symbol];
|
|
22
|
-
}
|
|
23
|
-
exports.useDecoratorMeta = useDecoratorMeta;
|
|
24
|
-
//# sourceMappingURL=meta.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../../../src/decorators/utils/meta.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAIH,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AAE3C,SAAgB,gBAAgB,CAAC,MAA2B;IACxD,IAAI,MAAM,IAAI,MAAM,EAAE;QAClB,OAAQ,MAAc,CAAC,MAAM,CAAC,CAAC;KAClC;IAEA,MAAc,CAAC,MAAM,CAAC,GAAG;QACtB,GAAG,EAAE,EAAE;QACP,WAAW,EAAE,EAAE;QACf,OAAO,EAAE,EAAE;QACX,UAAU,EAAE,EAAE;KACA,CAAC;IAEnB,OAAQ,MAAc,CAAC,MAAM,CAAC,CAAC;AACnC,CAAC;AAbD,4CAaC"}
|