routup 0.1.4 → 0.3.0-alpha.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/dist/decorators/controller/index.d.ts +2 -0
- package/dist/decorators/controller/index.d.ts.map +1 -0
- package/dist/decorators/controller/index.js +24 -0
- package/dist/decorators/controller/index.js.map +1 -0
- package/dist/decorators/controller/module.d.ts +4 -0
- package/dist/decorators/controller/module.d.ts.map +1 -0
- package/dist/decorators/controller/module.js +29 -0
- package/dist/decorators/controller/module.js.map +1 -0
- package/dist/decorators/index.d.ts +5 -0
- package/dist/decorators/index.d.ts.map +1 -0
- package/dist/decorators/index.js +27 -0
- package/dist/decorators/index.js.map +1 -0
- package/dist/decorators/method/arguments.d.ts +4 -0
- package/dist/decorators/method/arguments.d.ts.map +1 -0
- package/dist/decorators/method/arguments.js +22 -0
- package/dist/decorators/method/arguments.js.map +1 -0
- package/dist/decorators/method/index.d.ts +4 -0
- package/dist/decorators/method/index.d.ts.map +1 -0
- package/dist/decorators/method/index.js +26 -0
- package/dist/decorators/method/index.js.map +1 -0
- package/dist/decorators/method/module.d.ts +8 -0
- package/dist/decorators/method/module.d.ts.map +1 -0
- package/dist/decorators/method/module.js +46 -0
- package/dist/decorators/method/module.js.map +1 -0
- package/dist/decorators/method/type.d.ts +7 -0
- package/dist/decorators/method/type.d.ts.map +1 -0
- package/dist/decorators/method/type.js +9 -0
- package/dist/decorators/method/type.js.map +1 -0
- package/dist/decorators/parameter/index.d.ts +3 -0
- package/dist/decorators/parameter/index.d.ts.map +1 -0
- package/dist/decorators/parameter/index.js +25 -0
- package/dist/decorators/parameter/index.js.map +1 -0
- package/dist/decorators/parameter/module.d.ts +10 -0
- package/dist/decorators/parameter/module.d.ts.map +1 -0
- package/dist/decorators/parameter/module.js +58 -0
- package/dist/decorators/parameter/module.js.map +1 -0
- package/dist/decorators/parameter/type.d.ts +8 -0
- package/dist/decorators/parameter/type.d.ts.map +1 -0
- package/dist/decorators/parameter/type.js +9 -0
- package/dist/decorators/parameter/type.js.map +1 -0
- package/dist/decorators/type.d.ts +14 -0
- package/dist/decorators/type.d.ts.map +1 -0
- package/dist/decorators/type.js +9 -0
- package/dist/decorators/type.js.map +1 -0
- package/dist/decorators/utils/index.d.ts +2 -0
- package/dist/decorators/utils/index.d.ts.map +1 -0
- package/dist/decorators/utils/index.js +24 -0
- package/dist/decorators/utils/index.js.map +1 -0
- package/dist/decorators/utils/meta.d.ts +3 -0
- package/dist/decorators/utils/meta.d.ts.map +1 -0
- package/dist/decorators/utils/meta.js +24 -0
- package/dist/decorators/utils/meta.js.map +1 -0
- package/dist/handler/index.d.ts +3 -0
- package/dist/handler/index.d.ts.map +1 -0
- package/dist/handler/index.js +25 -0
- package/dist/handler/index.js.map +1 -0
- package/dist/handler/type.d.ts +7 -0
- package/dist/handler/type.d.ts.map +1 -0
- package/dist/handler/type.js +3 -0
- package/dist/handler/type.js.map +1 -0
- package/dist/handler/utils.d.ts +5 -0
- package/dist/handler/utils.d.ts.map +1 -0
- package/dist/handler/utils.js +37 -0
- package/dist/handler/utils.js.map +1 -0
- package/dist/helpers/request/index.d.ts +2 -2
- package/dist/helpers/request/index.d.ts.map +1 -1
- package/dist/helpers/request/index.js +2 -2
- package/dist/helpers/request/index.js.map +1 -1
- package/dist/helpers/request/params.d.ts +5 -4
- package/dist/helpers/request/params.d.ts.map +1 -1
- package/dist/helpers/request/params.js +11 -1
- package/dist/helpers/request/params.js.map +1 -1
- package/dist/helpers/response/index.d.ts +0 -1
- package/dist/helpers/response/index.d.ts.map +1 -1
- package/dist/helpers/response/index.js +0 -1
- package/dist/helpers/response/index.js.map +1 -1
- package/dist/helpers/response/send-format.d.ts +6 -4
- package/dist/helpers/response/send-format.d.ts.map +1 -1
- package/dist/helpers/response/send-format.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/route/module.d.ts +2 -1
- package/dist/route/module.d.ts.map +1 -1
- package/dist/route/module.js.map +1 -1
- package/dist/router/module.d.ts +10 -7
- package/dist/router/module.d.ts.map +1 -1
- package/dist/router/module.js +81 -29
- package/dist/router/module.js.map +1 -1
- package/dist/type.d.ts +3 -6
- package/dist/type.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/helpers/request/body.d.ts +0 -5
- package/dist/helpers/request/body.d.ts.map +0 -1
- package/dist/helpers/request/body.js +0 -19
- package/dist/helpers/request/body.js.map +0 -1
- package/dist/helpers/response/body.d.ts +0 -7
- package/dist/helpers/response/body.d.ts.map +0 -1
- package/dist/helpers/response/body.js +0 -48
- package/dist/helpers/response/body.js.map +0 -1
|
@@ -1,48 +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.useResponseBodyFormatted = exports.setResponseBody = exports.useResponseBody = void 0;
|
|
10
|
-
const constants_1 = require("../../constants");
|
|
11
|
-
const BodySymbol = Symbol.for('ResBody');
|
|
12
|
-
function useResponseBody(res) {
|
|
13
|
-
if (BodySymbol in res) {
|
|
14
|
-
return res[BodySymbol];
|
|
15
|
-
}
|
|
16
|
-
return undefined;
|
|
17
|
-
}
|
|
18
|
-
exports.useResponseBody = useResponseBody;
|
|
19
|
-
function setResponseBody(res, body) {
|
|
20
|
-
res[BodySymbol] = body;
|
|
21
|
-
}
|
|
22
|
-
exports.setResponseBody = setResponseBody;
|
|
23
|
-
/* istanbul ignore next */
|
|
24
|
-
function useResponseBodyFormatted(res) {
|
|
25
|
-
const body = useResponseBody(res);
|
|
26
|
-
if (typeof body === 'undefined') {
|
|
27
|
-
return undefined;
|
|
28
|
-
}
|
|
29
|
-
let contentType = res.getHeader(constants_1.HeaderName.CONTENT_TYPE);
|
|
30
|
-
if (!contentType) {
|
|
31
|
-
return contentType;
|
|
32
|
-
}
|
|
33
|
-
if (Array.isArray(contentType)) {
|
|
34
|
-
contentType = contentType.shift();
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
contentType = `${contentType}`.split('; ').shift();
|
|
38
|
-
}
|
|
39
|
-
switch (contentType) {
|
|
40
|
-
case 'application/json':
|
|
41
|
-
return JSON.parse(body.toString('utf-8'));
|
|
42
|
-
case 'text/html':
|
|
43
|
-
return body.toString('utf-8');
|
|
44
|
-
}
|
|
45
|
-
return body;
|
|
46
|
-
}
|
|
47
|
-
exports.useResponseBodyFormatted = useResponseBodyFormatted;
|
|
48
|
-
//# sourceMappingURL=body.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"body.js","sourceRoot":"","sources":["../../../src/helpers/response/body.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAGH,+CAA6C;AAE7C,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;AAEzC,SAAgB,eAAe,CAAC,GAAmB;IAC/C,IAAI,UAAU,IAAI,GAAG,EAAE;QACnB,OAAQ,GAAW,CAAC,UAAU,CAAC,CAAC;KACnC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC;AAND,0CAMC;AAED,SAAgB,eAAe,CAAC,GAAmB,EAAE,IAAY;IAC5D,GAAW,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;AACpC,CAAC;AAFD,0CAEC;AAED,0BAA0B;AAC1B,SAAgB,wBAAwB,CAAC,GAAmB;IACxD,MAAM,IAAI,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE;QAC7B,OAAO,SAAS,CAAC;KACpB;IAED,IAAI,WAAW,GAAG,GAAG,CAAC,SAAS,CAAC,sBAAU,CAAC,YAAY,CAAC,CAAC;IACzD,IAAI,CAAC,WAAW,EAAE;QACd,OAAO,WAAW,CAAC;KACtB;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;QAC5B,WAAW,GAAG,WAAW,CAAC,KAAK,EAAE,CAAC;KACrC;SAAM;QACH,WAAW,GAAG,GAAG,WAAW,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC;KACtD;IAED,QAAQ,WAAW,EAAE;QACjB,KAAK,kBAAkB;YACnB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QAC9C,KAAK,WAAW;YACZ,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;KACrC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC;AAzBD,4DAyBC"}
|