routup 0.0.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/LICENSE +21 -0
- package/README.md +74 -0
- package/dist/constants.d.ts +20 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +31 -0
- package/dist/constants.js.map +1 -0
- package/dist/helpers/index.d.ts +3 -0
- package/dist/helpers/index.d.ts.map +1 -0
- package/dist/helpers/index.js +25 -0
- package/dist/helpers/index.js.map +1 -0
- package/dist/helpers/request/body.d.ts +5 -0
- package/dist/helpers/request/body.d.ts.map +1 -0
- package/dist/helpers/request/body.js +19 -0
- package/dist/helpers/request/body.js.map +1 -0
- package/dist/helpers/request/cache.d.ts +3 -0
- package/dist/helpers/request/cache.d.ts.map +1 -0
- package/dist/helpers/request/cache.js +21 -0
- package/dist/helpers/request/cache.js.map +1 -0
- package/dist/helpers/request/env.d.ts +4 -0
- package/dist/helpers/request/env.d.ts.map +1 -0
- package/dist/helpers/request/env.js +27 -0
- package/dist/helpers/request/env.js.map +1 -0
- package/dist/helpers/request/header-accept-charset.d.ts +7 -0
- package/dist/helpers/request/header-accept-charset.d.ts.map +1 -0
- package/dist/helpers/request/header-accept-charset.js +21 -0
- package/dist/helpers/request/header-accept-charset.js.map +1 -0
- package/dist/helpers/request/header-accept-encoding.d.ts +7 -0
- package/dist/helpers/request/header-accept-encoding.d.ts.map +1 -0
- package/dist/helpers/request/header-accept-encoding.js +21 -0
- package/dist/helpers/request/header-accept-encoding.js.map +1 -0
- package/dist/helpers/request/header-accept-language.d.ts +7 -0
- package/dist/helpers/request/header-accept-language.d.ts.map +1 -0
- package/dist/helpers/request/header-accept-language.js +21 -0
- package/dist/helpers/request/header-accept-language.js.map +1 -0
- package/dist/helpers/request/header-accept.d.ts +7 -0
- package/dist/helpers/request/header-accept.d.ts.map +1 -0
- package/dist/helpers/request/header-accept.js +45 -0
- package/dist/helpers/request/header-accept.js.map +1 -0
- package/dist/helpers/request/header-content-type.d.ts +4 -0
- package/dist/helpers/request/header-content-type.d.ts.map +1 -0
- package/dist/helpers/request/header-content-type.js +28 -0
- package/dist/helpers/request/header-content-type.js.map +1 -0
- package/dist/helpers/request/header.d.ts +5 -0
- package/dist/helpers/request/header.d.ts.map +1 -0
- package/dist/helpers/request/header.js +18 -0
- package/dist/helpers/request/header.js.map +1 -0
- package/dist/helpers/request/index.d.ts +13 -0
- package/dist/helpers/request/index.d.ts.map +1 -0
- package/dist/helpers/request/index.js +35 -0
- package/dist/helpers/request/index.js.map +1 -0
- package/dist/helpers/request/mount-path.d.ts +6 -0
- package/dist/helpers/request/mount-path.d.ts.map +1 -0
- package/dist/helpers/request/mount-path.js +22 -0
- package/dist/helpers/request/mount-path.js.map +1 -0
- package/dist/helpers/request/negotiator.d.ts +5 -0
- package/dist/helpers/request/negotiator.d.ts.map +1 -0
- package/dist/helpers/request/negotiator.js +22 -0
- package/dist/helpers/request/negotiator.js.map +1 -0
- package/dist/helpers/request/params.d.ts +5 -0
- package/dist/helpers/request/params.d.ts.map +1 -0
- package/dist/helpers/request/params.js +25 -0
- package/dist/helpers/request/params.js.map +1 -0
- package/dist/helpers/request/path.d.ts +4 -0
- package/dist/helpers/request/path.d.ts.map +1 -0
- package/dist/helpers/request/path.js +21 -0
- package/dist/helpers/request/path.js.map +1 -0
- package/dist/helpers/response/body.d.ts +7 -0
- package/dist/helpers/response/body.d.ts.map +1 -0
- package/dist/helpers/response/body.js +48 -0
- package/dist/helpers/response/body.js.map +1 -0
- package/dist/helpers/response/cache.d.ts +8 -0
- package/dist/helpers/response/cache.d.ts.map +1 -0
- package/dist/helpers/response/cache.js +25 -0
- package/dist/helpers/response/cache.js.map +1 -0
- package/dist/helpers/response/header-attachment.d.ts +4 -0
- package/dist/helpers/response/header-attachment.d.ts.map +1 -0
- package/dist/helpers/response/header-attachment.js +29 -0
- package/dist/helpers/response/header-attachment.js.map +1 -0
- package/dist/helpers/response/header-content-type.d.ts +4 -0
- package/dist/helpers/response/header-content-type.d.ts.map +1 -0
- package/dist/helpers/response/header-content-type.js +25 -0
- package/dist/helpers/response/header-content-type.js.map +1 -0
- package/dist/helpers/response/header.d.ts +4 -0
- package/dist/helpers/response/header.d.ts.map +1 -0
- package/dist/helpers/response/header.js +39 -0
- package/dist/helpers/response/header.js.map +1 -0
- package/dist/helpers/response/index.d.ts +10 -0
- package/dist/helpers/response/index.d.ts.map +1 -0
- package/dist/helpers/response/index.js +32 -0
- package/dist/helpers/response/index.js.map +1 -0
- package/dist/helpers/response/send-file.d.ts +5 -0
- package/dist/helpers/response/send-file.d.ts.map +1 -0
- package/dist/helpers/response/send-file.js +27 -0
- package/dist/helpers/response/send-file.js.map +1 -0
- package/dist/helpers/response/send-format.d.ts +5 -0
- package/dist/helpers/response/send-format.d.ts.map +1 -0
- package/dist/helpers/response/send-format.js +13 -0
- package/dist/helpers/response/send-format.js.map +1 -0
- package/dist/helpers/response/send-redirect.d.ts +3 -0
- package/dist/helpers/response/send-redirect.d.ts.map +1 -0
- package/dist/helpers/response/send-redirect.js +19 -0
- package/dist/helpers/response/send-redirect.js.map +1 -0
- package/dist/helpers/response/send-stream.d.ts +7 -0
- package/dist/helpers/response/send-stream.d.ts.map +1 -0
- package/dist/helpers/response/send-stream.js +33 -0
- package/dist/helpers/response/send-stream.js.map +1 -0
- package/dist/helpers/response/send.d.ts +3 -0
- package/dist/helpers/response/send.d.ts.map +1 -0
- package/dist/helpers/response/send.js +100 -0
- package/dist/helpers/response/send.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/layer/index.d.ts +3 -0
- package/dist/layer/index.d.ts.map +1 -0
- package/dist/layer/index.js +25 -0
- package/dist/layer/index.js.map +1 -0
- package/dist/layer/module.d.ts +15 -0
- package/dist/layer/module.d.ts.map +1 -0
- package/dist/layer/module.js +72 -0
- package/dist/layer/module.js.map +1 -0
- package/dist/layer/utils.d.ts +3 -0
- package/dist/layer/utils.d.ts.map +1 -0
- package/dist/layer/utils.js +15 -0
- package/dist/layer/utils.js.map +1 -0
- package/dist/path/index.d.ts +3 -0
- package/dist/path/index.d.ts.map +1 -0
- package/dist/path/index.js +25 -0
- package/dist/path/index.js.map +1 -0
- package/dist/path/matcher.d.ts +13 -0
- package/dist/path/matcher.d.ts.map +1 -0
- package/dist/path/matcher.js +73 -0
- package/dist/path/matcher.js.map +1 -0
- package/dist/path/type.d.ts +5 -0
- package/dist/path/type.d.ts.map +1 -0
- package/dist/path/type.js +9 -0
- package/dist/path/type.js.map +1 -0
- package/dist/route/index.d.ts +3 -0
- package/dist/route/index.d.ts.map +1 -0
- package/dist/route/index.js +25 -0
- package/dist/route/index.js.map +1 -0
- package/dist/route/module.d.ts +21 -0
- package/dist/route/module.d.ts.map +1 -0
- package/dist/route/module.js +87 -0
- package/dist/route/module.js.map +1 -0
- package/dist/route/utils.d.ts +3 -0
- package/dist/route/utils.d.ts.map +1 -0
- package/dist/route/utils.js +15 -0
- package/dist/route/utils.js.map +1 -0
- package/dist/router/index.d.ts +3 -0
- package/dist/router/index.d.ts.map +1 -0
- package/dist/router/index.js +25 -0
- package/dist/router/index.js.map +1 -0
- package/dist/router/module.d.ts +40 -0
- package/dist/router/module.d.ts.map +1 -0
- package/dist/router/module.js +229 -0
- package/dist/router/module.js.map +1 -0
- package/dist/router/type.d.ts +18 -0
- package/dist/router/type.d.ts.map +1 -0
- package/dist/router/type.js +9 -0
- package/dist/router/type.js.map +1 -0
- package/dist/type.d.ts +25 -0
- package/dist/type.d.ts.map +1 -0
- package/dist/type.js +9 -0
- package/dist/type.js.map +1 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +28 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/is-instance.d.ts +2 -0
- package/dist/utils/is-instance.d.ts.map +1 -0
- package/dist/utils/is-instance.js +16 -0
- package/dist/utils/is-instance.js.map +1 -0
- package/dist/utils/mime.d.ts +2 -0
- package/dist/utils/mime.d.ts.map +1 -0
- package/dist/utils/mime.js +21 -0
- package/dist/utils/mime.js.map +1 -0
- package/dist/utils/path.d.ts +3 -0
- package/dist/utils/path.d.ts.map +1 -0
- package/dist/utils/path.js +14 -0
- package/dist/utils/path.js.map +1 -0
- package/dist/utils/response.d.ts +3 -0
- package/dist/utils/response.d.ts.map +1 -0
- package/dist/utils/response.js +31 -0
- package/dist/utils/response.js.map +1 -0
- package/dist/utils/url.d.ts +8 -0
- package/dist/utils/url.d.ts.map +1 -0
- package/dist/utils/url.js +58 -0
- package/dist/utils/url.js.map +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/route/module.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,+BAA6B;AAC7B,4CAAsC;AACtC,oCAAiC;AACjC,kCAAsC;AAMtC,MAAa,KAAK;IASd,qDAAqD;IAErD,YAAY,IAAU;QAVb,mBAAa,GAAG,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAMnC,WAAM,GAA6B,EAAE,CAAC;QAK5C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QAEjB,IAAI,CAAC,WAAW,GAAG,IAAI,kBAAW,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;IAED,qDAAqD;IAErD,SAAS,CAAC,IAAY;QAClB,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAED,WAAW,CAAC,MAAc;QACtB,OAAO,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;IACnF,CAAC;IAED,qDAAqD;IAErD,QAAQ,CACJ,GAAY,EACZ,GAAa,EACb,IAAoB,EACpB,IAAU;QAEV,IAAI,CAAC,GAAG,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@@
|
|
|
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.isRouteInstance = void 0;
|
|
10
|
+
const utils_1 = require("../utils");
|
|
11
|
+
function isRouteInstance(input) {
|
|
12
|
+
return (0, utils_1.isInstance)(input, 'Route');
|
|
13
|
+
}
|
|
14
|
+
exports.isRouteInstance = isRouteInstance;
|
|
15
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/route/utils.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,oCAAsC;AAGtC,SAAgB,eAAe,CAAC,KAAc;IAC1C,OAAO,IAAA,kBAAU,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACtC,CAAC;AAFD,0CAEC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/router/index.ts"],"names":[],"mappings":"AAOA,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/router/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,2CAAyB;AACzB,yCAAuB"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { RequestListener } from 'http';
|
|
3
|
+
import { PathMatcher } from '../path';
|
|
4
|
+
import { Layer } from '../layer';
|
|
5
|
+
import { Route } from '../route';
|
|
6
|
+
import { DispatcherMeta, ErrorHandler, Handler, Next, Path, Request, Response } from '../type';
|
|
7
|
+
import { RouterOptions } from './type';
|
|
8
|
+
export declare function isRouterInstance(input: unknown): input is Router;
|
|
9
|
+
export declare class Router {
|
|
10
|
+
readonly '@instanceof': symbol;
|
|
11
|
+
protected options: RouterOptions;
|
|
12
|
+
protected stack: (Router | Route | Layer)[];
|
|
13
|
+
protected pathMatcher: PathMatcher | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Is root router instance?
|
|
16
|
+
*
|
|
17
|
+
* @protected
|
|
18
|
+
*/
|
|
19
|
+
protected isRoot: boolean | undefined;
|
|
20
|
+
constructor(options?: RouterOptions);
|
|
21
|
+
setOption<T extends keyof RouterOptions>(key: T, value: RouterOptions[T]): void;
|
|
22
|
+
createListener(): RequestListener;
|
|
23
|
+
listen(port: number): import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>;
|
|
24
|
+
matchPath(path: string): boolean;
|
|
25
|
+
dispatch(req: Request, res: Response, meta?: DispatcherMeta, done?: Next): void;
|
|
26
|
+
dispatchAsync(req: Request, res: Response): Promise<void>;
|
|
27
|
+
use(router: Router): this;
|
|
28
|
+
use(handler: Handler): this;
|
|
29
|
+
use(handler: ErrorHandler): this;
|
|
30
|
+
use(path: Path, router: Router): this;
|
|
31
|
+
use(path: Path, handler: Handler): this;
|
|
32
|
+
use(path: Path, handler: ErrorHandler): this;
|
|
33
|
+
route(path: Path): Route;
|
|
34
|
+
delete(path: Path, ...handlers: Handler[]): this;
|
|
35
|
+
get(path: Path, ...handlers: Handler[]): this;
|
|
36
|
+
post(path: Path, ...handlers: Handler[]): this;
|
|
37
|
+
put(path: Path, ...handlers: Handler[]): this;
|
|
38
|
+
patch(path: Path, ...handlers: Handler[]): this;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAOtC,OAAO,EAAE,KAAK,EAAmB,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,KAAK,EAAmB,MAAM,UAAU,CAAC;AAClD,OAAO,EACH,cAAc,EACd,YAAY,EACZ,OAAO,EACP,IAAI,EAAE,IAAI,EACV,OAAO,EACP,QAAQ,EAEX,MAAM,SAAS,CAAC;AAKjB,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,wBAAgB,gBAAgB,CAAC,KAAK,EAA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;IAeT,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,QAAQ,EAAE,OAAO,EAAE,GAAI,IAAI;IAOjD,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,QAAQ,EAAE,OAAO,EAAE,GAAI,IAAI;IAO9C,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,QAAQ,EAAE,OAAO,EAAE,GAAI,IAAI;IAO/C,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,QAAQ,EAAE,OAAO,EAAE,GAAI,IAAI;IAO9C,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,QAAQ,EAAE,OAAO,EAAE,GAAI,IAAI;CAMnD"}
|
|
@@ -0,0 +1,229 @@
|
|
|
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.Router = exports.isRouterInstance = void 0;
|
|
10
|
+
const http_1 = require("http");
|
|
11
|
+
const smob_1 = require("smob");
|
|
12
|
+
const path_1 = require("../path");
|
|
13
|
+
const utils_1 = require("../utils");
|
|
14
|
+
const layer_1 = require("../layer");
|
|
15
|
+
const route_1 = require("../route");
|
|
16
|
+
const helpers_1 = require("../helpers");
|
|
17
|
+
function isRouterInstance(input) {
|
|
18
|
+
return (0, utils_1.isInstance)(input, 'Router');
|
|
19
|
+
}
|
|
20
|
+
exports.isRouterInstance = isRouterInstance;
|
|
21
|
+
class Router {
|
|
22
|
+
// --------------------------------------------------
|
|
23
|
+
constructor(options) {
|
|
24
|
+
this['@instanceof'] = Symbol.for('Router');
|
|
25
|
+
this.stack = [];
|
|
26
|
+
options = options || {};
|
|
27
|
+
options.timeout = options.timeout || 60000;
|
|
28
|
+
options.mountPath = options.mountPath || '/';
|
|
29
|
+
this.options = options;
|
|
30
|
+
this.setOption('mountPath', this.options.mountPath);
|
|
31
|
+
}
|
|
32
|
+
// --------------------------------------------------
|
|
33
|
+
setOption(key, value) {
|
|
34
|
+
if (key === 'mountPath') {
|
|
35
|
+
if (value === '/' || !(0, utils_1.isPath)(value)) {
|
|
36
|
+
this.options.mountPath = '/';
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (typeof value === 'string') {
|
|
40
|
+
this.options.mountPath = (0, utils_1.withLeadingSlash)((0, utils_1.withoutTrailingSlash)(`${value}`));
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
this.options.mountPath = value;
|
|
44
|
+
}
|
|
45
|
+
this.pathMatcher = new path_1.PathMatcher(this.options.mountPath, { end: false });
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
this.options[key] = value;
|
|
49
|
+
}
|
|
50
|
+
// --------------------------------------------------
|
|
51
|
+
createListener() {
|
|
52
|
+
this.isRoot = true;
|
|
53
|
+
return (req, res) => {
|
|
54
|
+
this.dispatch(req, res);
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/* istanbul ignore next */
|
|
58
|
+
listen(port) {
|
|
59
|
+
const server = (0, http_1.createServer)(this.createListener);
|
|
60
|
+
return server.listen(port);
|
|
61
|
+
}
|
|
62
|
+
// --------------------------------------------------
|
|
63
|
+
matchPath(path) {
|
|
64
|
+
if (this.pathMatcher) {
|
|
65
|
+
return this.pathMatcher.test(path);
|
|
66
|
+
}
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
// --------------------------------------------------
|
|
70
|
+
dispatch(req, res, meta, done) {
|
|
71
|
+
let index = -1;
|
|
72
|
+
meta = meta || {};
|
|
73
|
+
if (this.isRoot) {
|
|
74
|
+
(0, utils_1.createResponseTimeout)(res, this.options.timeout || 60000, done);
|
|
75
|
+
}
|
|
76
|
+
const fn = (err) => {
|
|
77
|
+
/* istanbul ignore if */
|
|
78
|
+
if (!this.isRoot) {
|
|
79
|
+
if (typeof done !== 'undefined') {
|
|
80
|
+
done(err);
|
|
81
|
+
}
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (typeof err !== 'undefined') {
|
|
85
|
+
res.statusCode = 500;
|
|
86
|
+
res.statusMessage = err.message;
|
|
87
|
+
res.end();
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
res.statusCode = 404;
|
|
91
|
+
res.end();
|
|
92
|
+
};
|
|
93
|
+
let path = meta.path || (0, helpers_1.useRequestPath)(req);
|
|
94
|
+
if (this.pathMatcher) {
|
|
95
|
+
const output = this.pathMatcher.exec(path);
|
|
96
|
+
if (typeof output !== 'undefined') {
|
|
97
|
+
if (path === output.path) {
|
|
98
|
+
path = '/';
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
path = (0, utils_1.withLeadingSlash)(path.substring(output.path.length));
|
|
102
|
+
}
|
|
103
|
+
meta.params = (0, smob_1.merge)(meta.params || {}, output.params);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
const next = (err) => {
|
|
107
|
+
if (index >= this.stack.length - 1) {
|
|
108
|
+
fn(err);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
(0, helpers_1.setRequestMountPath)(req, this.options.mountPath || '/');
|
|
112
|
+
let layer;
|
|
113
|
+
let match = false;
|
|
114
|
+
while (!match && index < this.stack.length) {
|
|
115
|
+
index++;
|
|
116
|
+
layer = this.stack[index];
|
|
117
|
+
if ((0, layer_1.isLayerInstance)(layer)) {
|
|
118
|
+
match = layer.matchPath(path);
|
|
119
|
+
}
|
|
120
|
+
if (isRouterInstance(layer)) {
|
|
121
|
+
match = layer.matchPath(path);
|
|
122
|
+
}
|
|
123
|
+
if ((0, route_1.isRouteInstance)(layer)) {
|
|
124
|
+
match = layer.matchPath(path);
|
|
125
|
+
if (req.method &&
|
|
126
|
+
!layer.matchMethod(req.method)) {
|
|
127
|
+
match = false;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (!match || !layer) {
|
|
132
|
+
fn(err);
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
let layerMeta = Object.assign(Object.assign({}, meta), { path });
|
|
136
|
+
if ((0, layer_1.isLayerInstance)(layer)) {
|
|
137
|
+
const output = layer.exec(path);
|
|
138
|
+
if (output) {
|
|
139
|
+
layerMeta = {
|
|
140
|
+
params: output.params,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (err) {
|
|
145
|
+
if ((0, layer_1.isLayerInstance)(layer) && layer.isError()) {
|
|
146
|
+
layer.dispatch(req, res, layerMeta, next, err);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
/* istanbul ignore next */
|
|
150
|
+
next(err);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
layer.dispatch(req, res, layerMeta, next);
|
|
154
|
+
};
|
|
155
|
+
next();
|
|
156
|
+
}
|
|
157
|
+
/* istanbul ignore next */
|
|
158
|
+
dispatchAsync(req, res) {
|
|
159
|
+
return new Promise((resolve, reject) => {
|
|
160
|
+
this.dispatch(req, res, {}, (err) => {
|
|
161
|
+
if (err) {
|
|
162
|
+
reject(err);
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
resolve();
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
use(...input) {
|
|
170
|
+
if (input.length === 0) {
|
|
171
|
+
return this;
|
|
172
|
+
}
|
|
173
|
+
let path;
|
|
174
|
+
if ((0, utils_1.isPath)(input[0])) {
|
|
175
|
+
path = input.shift();
|
|
176
|
+
}
|
|
177
|
+
for (let i = 0; i < input.length; i++) {
|
|
178
|
+
const item = input[i];
|
|
179
|
+
if (isRouterInstance(item)) {
|
|
180
|
+
if (path) {
|
|
181
|
+
item.setOption('mountPath', path);
|
|
182
|
+
}
|
|
183
|
+
this.stack.push(item);
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
if (typeof item === 'function') {
|
|
187
|
+
this.stack.push(new layer_1.Layer(path || '/', { strict: false, end: false }, item));
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return this;
|
|
191
|
+
}
|
|
192
|
+
// --------------------------------------------------
|
|
193
|
+
route(path) {
|
|
194
|
+
const index = this.stack.findIndex((item) => (0, route_1.isRouteInstance)(item) && item.path === path);
|
|
195
|
+
if (index !== -1) {
|
|
196
|
+
return this.stack[index];
|
|
197
|
+
}
|
|
198
|
+
const route = new route_1.Route(path);
|
|
199
|
+
this.stack.push(route);
|
|
200
|
+
return route;
|
|
201
|
+
}
|
|
202
|
+
delete(path, ...handlers) {
|
|
203
|
+
const route = this.route(path);
|
|
204
|
+
route.delete(...handlers);
|
|
205
|
+
return this;
|
|
206
|
+
}
|
|
207
|
+
get(path, ...handlers) {
|
|
208
|
+
const route = this.route(path);
|
|
209
|
+
route.get(...handlers);
|
|
210
|
+
return this;
|
|
211
|
+
}
|
|
212
|
+
post(path, ...handlers) {
|
|
213
|
+
const route = this.route(path);
|
|
214
|
+
route.post(...handlers);
|
|
215
|
+
return this;
|
|
216
|
+
}
|
|
217
|
+
put(path, ...handlers) {
|
|
218
|
+
const route = this.route(path);
|
|
219
|
+
route.put(...handlers);
|
|
220
|
+
return this;
|
|
221
|
+
}
|
|
222
|
+
patch(path, ...handlers) {
|
|
223
|
+
const route = this.route(path);
|
|
224
|
+
route.patch(...handlers);
|
|
225
|
+
return this;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
exports.Router = Router;
|
|
229
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/router/module.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,+BAAqD;AAErD,+BAA6B;AAC7B,kCAAsC;AACtC,oCAKkB;AAClB,oCAAkD;AAClD,oCAAkD;A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G,QAAmB;QAClC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC/B,KAAK,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC;QAEvB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,IAAU,EAAE,GAAG,QAAmB;QACpC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC/B,KAAK,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,CAAC;QAEzB,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AA7TD,wBA6TC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Path } from '../type';
|
|
2
|
+
export declare type RouterOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* Milliseconds (ms) until request should time out.
|
|
5
|
+
*
|
|
6
|
+
* @type number
|
|
7
|
+
* @default 60_000
|
|
8
|
+
*/
|
|
9
|
+
timeout?: number;
|
|
10
|
+
/**
|
|
11
|
+
* Mount path.
|
|
12
|
+
*
|
|
13
|
+
* @type string
|
|
14
|
+
* @default '/'
|
|
15
|
+
*/
|
|
16
|
+
mountPath?: Path;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/router/type.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,oBAAY,aAAa,GAAG;IACxB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,IAAI,CAAA;CACnB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../src/router/type.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
|
package/dist/type.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { IncomingMessage, ServerResponse } from 'http';
|
|
3
|
+
export declare type ResponseFormat = {
|
|
4
|
+
[key: string]: () => void;
|
|
5
|
+
default: () => void;
|
|
6
|
+
};
|
|
7
|
+
export interface Response extends ServerResponse {
|
|
8
|
+
}
|
|
9
|
+
export interface Request extends IncomingMessage {
|
|
10
|
+
}
|
|
11
|
+
export declare type Next = (err?: Error) => void;
|
|
12
|
+
export declare type Path = string | RegExp;
|
|
13
|
+
export declare type ErrorHandler = (err: Error, req: Request, res: Response, next: Next) => unknown;
|
|
14
|
+
export declare type Handler = (req: Request, res: Response, next: Next) => unknown;
|
|
15
|
+
export declare type DispatcherMeta = {
|
|
16
|
+
/**
|
|
17
|
+
* Params collected on path.
|
|
18
|
+
*/
|
|
19
|
+
params?: Record<string, any>;
|
|
20
|
+
/**
|
|
21
|
+
* Path to check for the current instance.
|
|
22
|
+
*/
|
|
23
|
+
path?: string;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=type.d.ts.map
|
|
@@ -0,0 +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,oBAAY,cAAc,GAAG;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,IAAI,CAAC;IAC1B,OAAO,EAAE,MAAM,IAAI,CAAA;CACtB,CAAC;AAEF,MAAM,WAAW,QAAS,SAAQ,cAAc;CAE/C;AAED,MAAM,WAAW,OAAQ,SAAQ,eAAe;CAE/C;AAED,oBAAY,IAAI,GAAG,CAAC,GAAG,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;AAEzC,oBAAY,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;AAInC,oBAAY,YAAY,GAAG,CACvB,GAAG,EAAE,KAAK,EACV,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,IAAI,KACT,OAAO,CAAC;AAEb,oBAAY,OAAO,GAAG,CAClB,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,IAAI,KACT,OAAO,CAAC;AAIb,oBAAY,cAAc,GAAG;IACzB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;CAChB,CAAC"}
|
package/dist/type.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
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
|
package/dist/type.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../src/type.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
|
|
@@ -0,0 +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,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
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("./is-instance"), exports);
|
|
24
|
+
__exportStar(require("./mime"), exports);
|
|
25
|
+
__exportStar(require("./path"), exports);
|
|
26
|
+
__exportStar(require("./response"), exports);
|
|
27
|
+
__exportStar(require("./url"), exports);
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,gDAA8B;AAC9B,yCAAuB;AACvB,yCAAuB;AACvB,6CAA2B;AAC3B,wCAAsB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-instance.d.ts","sourceRoot":"","sources":["../../src/utils/is-instance.ts"],"names":[],"mappings":"AAOA,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAMtD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
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.isInstance = void 0;
|
|
10
|
+
function isInstance(input, name) {
|
|
11
|
+
return (typeof input === 'object' &&
|
|
12
|
+
input !== null &&
|
|
13
|
+
input['@instanceof'] === Symbol.for(name));
|
|
14
|
+
}
|
|
15
|
+
exports.isInstance = isInstance;
|
|
16
|
+
//# sourceMappingURL=is-instance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-instance.js","sourceRoot":"","sources":["../../src/utils/is-instance.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,SAAgB,UAAU,CAAC,KAAc,EAAE,IAAY;IACnD,OAAO,CACH,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACb,KAAmC,CAAC,aAAa,CAAC,KAAK,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAC3E,CAAC;AACN,CAAC;AAND,gCAMC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mime.d.ts","sourceRoot":"","sources":["../../src/utils/mime.ts"],"names":[],"mappings":"AASA,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAI,MAAM,GAAG,SAAS,CAM7D"}
|
|
@@ -0,0 +1,21 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getMimeType = void 0;
|
|
13
|
+
const mime_1 = __importDefault(require("mime"));
|
|
14
|
+
function getMimeType(type) {
|
|
15
|
+
if (type.indexOf('/') !== -1) {
|
|
16
|
+
return type;
|
|
17
|
+
}
|
|
18
|
+
return mime_1.default.getType(type) || undefined;
|
|
19
|
+
}
|
|
20
|
+
exports.getMimeType = getMimeType;
|
|
21
|
+
//# sourceMappingURL=mime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mime.js","sourceRoot":"","sources":["../../src/utils/mime.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;AAEH,gDAAwB;AAExB,SAAgB,WAAW,CAAC,IAAY;IACpC,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE;QAC1B,OAAO,IAAI,CAAC;KACf;IAED,OAAO,cAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC;AAC3C,CAAC;AAND,kCAMC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../src/utils/path.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAI,KAAK,IAAI,IAAI,CAErD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
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.isPath = void 0;
|
|
10
|
+
function isPath(input) {
|
|
11
|
+
return typeof input === 'string' || input instanceof RegExp;
|
|
12
|
+
}
|
|
13
|
+
exports.isPath = isPath;
|
|
14
|
+
//# sourceMappingURL=path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path.js","sourceRoot":"","sources":["../../src/utils/path.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAIH,SAAgB,MAAM,CAAC,KAAc;IACjC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,CAAC;AAChE,CAAC;AAFD,wBAEC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../src/utils/response.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGzC,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,IAAI,QAuBhF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
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.createResponseTimeout = void 0;
|
|
10
|
+
/* istanbul ignore next */
|
|
11
|
+
function createResponseTimeout(res, timeout, done) {
|
|
12
|
+
const instance = setTimeout(() => {
|
|
13
|
+
res.statusCode = 504;
|
|
14
|
+
res.statusMessage = 'Gateway Timeout';
|
|
15
|
+
res.end();
|
|
16
|
+
}, timeout);
|
|
17
|
+
res.once('close', () => {
|
|
18
|
+
clearTimeout(instance);
|
|
19
|
+
if (typeof done === 'function') {
|
|
20
|
+
done();
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
res.once('error', (e) => {
|
|
24
|
+
clearTimeout(instance);
|
|
25
|
+
if (typeof done === 'function') {
|
|
26
|
+
done(e);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
exports.createResponseTimeout = createResponseTimeout;
|
|
31
|
+
//# sourceMappingURL=response.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"response.js","sourceRoot":"","sources":["../../src/utils/response.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAIH,0BAA0B;AAC1B,SAAgB,qBAAqB,CAAC,GAAa,EAAE,OAAe,EAAE,IAAW;IAC7E,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG,EAAE;QAC7B,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC;QACrB,GAAG,CAAC,aAAa,GAAG,iBAAiB,CAAC;QAEtC,GAAG,CAAC,GAAG,EAAE,CAAC;IACd,CAAC,EAAE,OAAO,CAAC,CAAC;IAEZ,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE;QACnB,YAAY,CAAC,QAAQ,CAAC,CAAC;QAEvB,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE;YAC5B,IAAI,EAAE,CAAC;SACV;IACL,CAAC,CAAC,CAAC;IAEH,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;QACpB,YAAY,CAAC,QAAQ,CAAC,CAAC;QAEvB,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE;YAC5B,IAAI,CAAC,CAAC,CAAC,CAAC;SACX;IACL,CAAC,CAAC,CAAC;AACP,CAAC;AAvBD,sDAuBC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function hasTrailingSlash(input?: string, queryParams?: boolean): boolean;
|
|
2
|
+
export declare function withoutTrailingSlash(input?: string, queryParams?: boolean): string;
|
|
3
|
+
export declare function withTrailingSlash(input?: string, queryParams?: boolean): string;
|
|
4
|
+
export declare function hasLeadingSlash(input?: string): boolean;
|
|
5
|
+
export declare function withoutLeadingSlash(input?: string): string;
|
|
6
|
+
export declare function withLeadingSlash(input?: string): string;
|
|
7
|
+
export declare function cleanDoubleSlashes(input?: string): string;
|
|
8
|
+
//# sourceMappingURL=url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../src/utils/url.ts"],"names":[],"mappings":"AASA,wBAAgB,gBAAgB,CAAC,KAAK,SAAK,EAAE,WAAW,UAAQ,GAAG,OAAO,CAMzE;AAED,wBAAgB,oBAAoB,CAAC,KAAK,SAAK,EAAE,WAAW,UAAQ,GAAG,MAAM,CAY5E;AAED,wBAAgB,iBAAiB,CAAC,KAAK,SAAK,EAAE,WAAW,UAAQ,GAAG,MAAM,CAWzE;AAED,wBAAgB,eAAe,CAAC,KAAK,SAAK,GAAG,OAAO,CAEnD;AAED,wBAAgB,mBAAmB,CAAC,KAAK,SAAK,GAAG,MAAM,CAEtD;AAED,wBAAgB,gBAAgB,CAAC,KAAK,SAAK,GAAG,MAAM,CAEnD;AAED,wBAAgB,kBAAkB,CAAC,KAAK,SAAK,GAAG,MAAM,CAIrD"}
|