@deepkit/http 1.0.1-alpha.59 → 1.0.1-alpha.63
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/coverage/clover.xml +1086 -0
- package/coverage/coverage-final.json +12 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +79 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +126 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +170 -0
- package/coverage/lcov-report/src/controllers.ts.html +113 -0
- package/coverage/lcov-report/src/decorator.ts.html +1280 -0
- package/coverage/lcov-report/src/filter.ts.html +734 -0
- package/coverage/lcov-report/src/http.ts.html +2192 -0
- package/coverage/lcov-report/src/index.html +246 -0
- package/coverage/lcov-report/src/kernel.ts.html +260 -0
- package/coverage/lcov-report/src/middleware.ts.html +428 -0
- package/coverage/lcov-report/src/model.ts.html +937 -0
- package/coverage/lcov-report/src/module.config.ts.html +89 -0
- package/coverage/lcov-report/src/module.ts.html +245 -0
- package/coverage/lcov-report/src/router.ts.html +2318 -0
- package/coverage/lcov-report/tests/index.html +111 -0
- package/coverage/lcov-report/tests/utils.ts.html +176 -0
- package/coverage/lcov.info +2225 -0
- package/dist/cjs/index.js +5 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/src/controllers.d.ts +4 -4
- package/dist/cjs/src/controllers.js +3 -0
- package/dist/cjs/src/controllers.js.map +1 -1
- package/dist/cjs/src/decorator.d.ts +29 -94
- package/dist/cjs/src/decorator.js +53 -118
- package/dist/cjs/src/decorator.js.map +1 -1
- package/dist/cjs/src/filter.d.ts +1 -0
- package/dist/cjs/src/filter.js +11 -17
- package/dist/cjs/src/filter.js.map +1 -1
- package/dist/cjs/src/http.d.ts +5 -3
- package/dist/cjs/src/http.js +91 -55
- package/dist/cjs/src/http.js.map +1 -1
- package/dist/cjs/src/kernel.d.ts +3 -3
- package/dist/cjs/src/kernel.js +5 -25
- package/dist/cjs/src/kernel.js.map +1 -1
- package/dist/cjs/src/logger.d.ts +2 -2
- package/dist/cjs/src/logger.js +4 -8
- package/dist/cjs/src/logger.js.map +1 -1
- package/dist/cjs/src/middleware.d.ts +5 -1
- package/dist/cjs/src/middleware.js +15 -3
- package/dist/cjs/src/middleware.js.map +1 -1
- package/dist/cjs/src/model.d.ts +62 -2
- package/dist/cjs/src/model.js +101 -26
- package/dist/cjs/src/model.js.map +1 -1
- package/dist/cjs/src/module.config.d.ts +3 -4
- package/dist/cjs/src/module.config.js +8 -6
- package/dist/cjs/src/module.config.js.map +1 -1
- package/dist/cjs/src/module.d.ts +2 -3
- package/dist/cjs/src/module.js +4 -2
- package/dist/cjs/src/module.js.map +1 -1
- package/dist/cjs/src/router.d.ts +24 -53
- package/dist/cjs/src/router.js +140 -159
- package/dist/cjs/src/router.js.map +1 -1
- package/dist/cjs/src/static-serving.d.ts +1 -0
- package/dist/cjs/src/static-serving.js +46 -39
- package/dist/cjs/src/static-serving.js.map +1 -1
- package/dist/cjs/src/utils.js +1 -0
- package/dist/cjs/tests/filter.spec.js +61 -47
- package/dist/cjs/tests/filter.spec.js.map +1 -1
- package/dist/cjs/tests/middleware.spec.d.ts +1 -1
- package/dist/cjs/tests/middleware.spec.js +157 -145
- package/dist/cjs/tests/middleware.spec.js.map +1 -1
- package/dist/cjs/tests/model.spec.js +4 -4
- package/dist/cjs/tests/model.spec.js.map +1 -1
- package/dist/cjs/tests/module.spec.js +4 -3
- package/dist/cjs/tests/module.spec.js.map +1 -1
- package/dist/cjs/tests/router.spec.d.ts +1 -1
- package/dist/cjs/tests/router.spec.js +298 -333
- package/dist/cjs/tests/router.spec.js.map +1 -1
- package/dist/cjs/tests/utils.js +5 -2
- package/dist/cjs/tests/utils.js.map +1 -1
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/src/controllers.d.ts +4 -4
- package/dist/esm/src/controllers.js +3 -0
- package/dist/esm/src/controllers.js.map +1 -1
- package/dist/esm/src/decorator.d.ts +29 -94
- package/dist/esm/src/decorator.js +49 -114
- package/dist/esm/src/decorator.js.map +1 -1
- package/dist/esm/src/filter.d.ts +1 -0
- package/dist/esm/src/filter.js +11 -18
- package/dist/esm/src/filter.js.map +1 -1
- package/dist/esm/src/http.d.ts +5 -3
- package/dist/esm/src/http.js +89 -55
- package/dist/esm/src/http.js.map +1 -1
- package/dist/esm/src/kernel.d.ts +3 -3
- package/dist/esm/src/kernel.js +6 -27
- package/dist/esm/src/kernel.js.map +1 -1
- package/dist/esm/src/logger.d.ts +2 -2
- package/dist/esm/src/logger.js +4 -9
- package/dist/esm/src/logger.js.map +1 -1
- package/dist/esm/src/middleware.d.ts +5 -1
- package/dist/esm/src/middleware.js +12 -0
- package/dist/esm/src/middleware.js.map +1 -1
- package/dist/esm/src/model.d.ts +62 -2
- package/dist/esm/src/model.js +92 -24
- package/dist/esm/src/model.js.map +1 -1
- package/dist/esm/src/module.config.d.ts +3 -4
- package/dist/esm/src/module.config.js +6 -5
- package/dist/esm/src/module.config.js.map +1 -1
- package/dist/esm/src/module.d.ts +2 -3
- package/dist/esm/src/module.js +5 -3
- package/dist/esm/src/module.js.map +1 -1
- package/dist/esm/src/router.d.ts +24 -53
- package/dist/esm/src/router.js +136 -155
- package/dist/esm/src/router.js.map +1 -1
- package/dist/esm/src/static-serving.d.ts +1 -0
- package/dist/esm/src/static-serving.js +39 -32
- package/dist/esm/src/static-serving.js.map +1 -1
- package/dist/esm/src/utils.js +1 -0
- package/dist/esm/tests/filter.spec.js +14 -0
- package/dist/esm/tests/filter.spec.js.map +1 -1
- package/dist/esm/tests/middleware.spec.d.ts +1 -1
- package/dist/esm/tests/middleware.spec.js +60 -48
- package/dist/esm/tests/middleware.spec.js.map +1 -1
- package/dist/esm/tests/module.spec.js +1 -0
- package/dist/esm/tests/module.spec.js.map +1 -1
- package/dist/esm/tests/router.spec.d.ts +1 -1
- package/dist/esm/tests/router.spec.js +167 -202
- package/dist/esm/tests/router.spec.js.map +1 -1
- package/dist/esm/tests/utils.js +4 -1
- package/dist/esm/tests/utils.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +14 -15
- package/src/controllers.ts +3 -3
- package/src/decorator.ts +42 -131
- package/src/filter.ts +0 -2
- package/src/http.ts +35 -36
- package/src/kernel.ts +4 -5
- package/src/logger.ts +2 -4
- package/src/middleware.ts +2 -1
- package/src/model.ts +80 -8
- package/src/module.config.ts +3 -6
- package/src/module.ts +2 -2
- package/src/router.ts +121 -161
- package/src/static-serving.ts +14 -12
- package/tests/middleware.spec.ts +0 -1
- package/tests/router.spec.ts +131 -133
- package/tsconfig.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kernel.js","sourceRoot":"","sources":["../../../src/kernel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"kernel.js","sourceRoot":"","sources":["../../../src/kernel.ts"],"names":[],"mappings":";;;qCAGgC,iBAAiB;AAHjD,gDAAoD;AACpD,qCAAkC;AAClC,0CAAiD;AAEjD,mCAAwF;AACxF,iCAAwD;AACxD,kDAA8D;AAC9D,2BAA4B;AAE5B,MAAa,UAAU;IACnB,YACc,MAAc,EACd,eAAgC,EAChC,eAAgC,EAChC,MAAuB,EACvB,SAAqB;QAJrB,WAAM,GAAN,MAAM,CAAQ;QACd,oBAAe,GAAf,eAAe,CAAiB;QAChC,oBAAe,GAAf,eAAe,CAAiB;QAChC,WAAM,GAAN,MAAM,CAAiB;QACvB,cAAS,GAAT,SAAS,CAAY;IAGnC,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,cAA8B;QAC/C,MAAM,OAAO,GAAG,cAAc,CAAC,KAAK,EAAE,CAAC;QACvC,MAAM,QAAQ,GAAG,IAAI,0BAAkB,CAAC,OAAO,CAAC,CAAC;QACjD,QAAQ,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S,EAAE,IAAI,uBAAgB,CAAC,mBAAmB,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;aACxF;SACJ;QAAC,OAAO,KAAK,EAAE;YACZ,IAAI,CAAC,GAAG,CAAC,WAAW;gBAAE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAEtC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;SAC1D;gBAAS;YACN,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE;gBACjD,IAAA,WAAM,EAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE;gBACvB,CAAC,CAAC,CAAC;aACN;YAED,IAAI,KAAK,EAAE;gBACP,KAAK,CAAC,IAAI,CAAC,EAAE,cAAc,EAAE,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;gBAC/C,KAAK,CAAC,GAAG,EAAE,CAAC;aACf;SACJ;IACL,CAAC;;AAjDL,gCAkDC"}
|
package/dist/cjs/src/logger.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LoggerInterface } from '@deepkit/logger';
|
|
2
2
|
import { httpWorkflow } from './http';
|
|
3
3
|
export declare class HttpLogger {
|
|
4
4
|
private logger;
|
|
5
|
-
constructor(logger:
|
|
5
|
+
constructor(logger: LoggerInterface);
|
|
6
6
|
onHttpRequest(event: typeof httpWorkflow.onResponse.event): void;
|
|
7
7
|
}
|
package/dist/cjs/src/logger.js
CHANGED
|
@@ -10,18 +10,18 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.HttpLogger = void 0;
|
|
13
|
-
|
|
14
|
-
const logger_1 = require("@deepkit/logger");
|
|
13
|
+
var { __ΩLoggerInterface } = require('@deepkit/logger');
|
|
15
14
|
const event_1 = require("@deepkit/event");
|
|
16
15
|
const http_1 = require("./http");
|
|
17
|
-
|
|
16
|
+
class HttpLogger {
|
|
18
17
|
constructor(logger) {
|
|
19
18
|
this.logger = logger;
|
|
20
19
|
}
|
|
21
20
|
onHttpRequest(event) {
|
|
22
21
|
this.logger.log(event.request.connection.remoteAddress, '-', event.request.method, `"${event.request.url}"`, event.response.statusCode, `"${event.request.headers.referer || ''}"`);
|
|
23
22
|
}
|
|
24
|
-
}
|
|
23
|
+
}
|
|
24
|
+
HttpLogger.__type = [() => __ΩLoggerInterface, 'logger', 'constructor', () => http_1.httpWorkflow.onResponse.event, 'event', 'onHttpRequest', 'Pn!2";"0#Pi$2%"0&5'];
|
|
25
25
|
__decorate([
|
|
26
26
|
event_1.eventDispatcher.listen(http_1.httpWorkflow.onResponse, 101) //101 is right after 100 default listener
|
|
27
27
|
,
|
|
@@ -29,9 +29,5 @@ __decorate([
|
|
|
29
29
|
__metadata("design:paramtypes", [Object]),
|
|
30
30
|
__metadata("design:returntype", void 0)
|
|
31
31
|
], HttpLogger.prototype, "onHttpRequest", null);
|
|
32
|
-
HttpLogger = __decorate([
|
|
33
|
-
injector_1.injectable,
|
|
34
|
-
__metadata("design:paramtypes", [logger_1.Logger])
|
|
35
|
-
], HttpLogger);
|
|
36
32
|
exports.HttpLogger = HttpLogger;
|
|
37
33
|
//# sourceMappingURL=logger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/logger.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/logger.ts"],"names":[],"mappings":";;;;;;;;;;;;qCAAgC,iBAAiB;AACjD,0CAAiD;AACjD,iCAAsC;AAEtC,MAAa,UAAU;IACnB,YAAoB,MAAuB;QAAvB,WAAM,GAAN,MAAM,CAAiB;IAC3C,CAAC;IAGD,aAAa,CAAC,KAA2C;QACrD,IAAI,CAAC,MAAM,CAAC,GAAG,CACX,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,EAAE,GAAG,EAC3C,KAAK,CAAC,OAAO,CAAC,MAAM,EACpB,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,GAAG,EACxB,KAAK,CAAC,QAAQ,CAAC,UAAU,EACzB,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,GAAG,CAE7C,CAAC;IACN,CAAC;;kGATwC,UAAU,CAAC,KAAK;AAAzD;IADC,uBAAe,CAAC,MAAM,CAAC,mBAAY,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,yCAAyC;;;;;+CAU9F;AAdL,gCAeC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ClassType } from '@deepkit/core';
|
|
2
2
|
import { AppModule } from '@deepkit/app';
|
|
3
3
|
import { HttpRequest, HttpResponse } from './model';
|
|
4
|
+
import { InjectorModule } from '@deepkit/injector';
|
|
4
5
|
export declare type HttpMiddlewareFn = (req: HttpRequest, res: HttpResponse, next: (err?: any) => void) => void | Promise<void>;
|
|
5
6
|
export interface HttpMiddleware {
|
|
6
7
|
execute: HttpMiddlewareFn;
|
|
@@ -25,7 +26,7 @@ export declare class HttpMiddlewareConfig {
|
|
|
25
26
|
routeNames: string[];
|
|
26
27
|
excludeRouteNames: string[];
|
|
27
28
|
timeout: number;
|
|
28
|
-
modules:
|
|
29
|
+
modules: InjectorModule<any>[];
|
|
29
30
|
selfModule: boolean;
|
|
30
31
|
getClassTypes(): ClassType[];
|
|
31
32
|
}
|
|
@@ -55,3 +56,6 @@ export declare class HttpMiddlewareApi {
|
|
|
55
56
|
forSelfModules(): void;
|
|
56
57
|
}
|
|
57
58
|
export declare const httpMiddleware: import("@deepkit/type").FreeDecoratorResult<typeof HttpMiddlewareApi>;
|
|
59
|
+
export declare type __ΩHttpMiddlewareFn = any[];
|
|
60
|
+
export declare type __ΩHttpMiddleware = any[];
|
|
61
|
+
export declare type __ΩHttpMiddlewareRoute = any[];
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.httpMiddleware = exports.HttpMiddlewareApi = exports.HttpMiddlewareConfig = void 0;
|
|
3
|
+
exports.httpMiddleware = exports.HttpMiddlewareApi = exports.HttpMiddlewareConfig = exports.__ΩHttpMiddlewareRoute = exports.__ΩHttpMiddleware = exports.__ΩHttpMiddlewareFn = void 0;
|
|
4
|
+
var { __ΩClassType } = require('@deepkit/core');
|
|
4
5
|
const core_1 = require("@deepkit/core");
|
|
6
|
+
const app_1 = require("@deepkit/app");
|
|
5
7
|
const type_1 = require("@deepkit/type");
|
|
8
|
+
const model_1 = require("./model");
|
|
9
|
+
const injector_1 = require("@deepkit/injector");
|
|
10
|
+
var __ΩHttpMiddlewareFn = [() => model_1.HttpRequest, 'req', () => model_1.HttpResponse, 'res', 'err', '', 'next', 'PP7!2"P7#2$P"2%8$/&2\'P$$`J/&'];
|
|
11
|
+
exports.__ΩHttpMiddlewareFn = __ΩHttpMiddlewareFn;
|
|
12
|
+
var __ΩHttpMiddleware = [() => __ΩHttpMiddlewareFn, 'execute', 'Pn!4"M'];
|
|
13
|
+
exports.__ΩHttpMiddleware = __ΩHttpMiddleware;
|
|
14
|
+
var __ΩHttpMiddlewareRoute = ['path', 'pathRegExp', "GET", "HEAD", "POST", "PATCH", "PUT", "DELETE", "OPTIONS", "TRACE", 'httpMethod', 'category', 'excludeCategory', 'group', 'excludeGroup', 'P&4!8A4"8P.#.$.%.&.\'.(.).*J4+8&4,8&4-8&4.8&4/8M'];
|
|
15
|
+
exports.__ΩHttpMiddlewareRoute = __ΩHttpMiddlewareRoute;
|
|
6
16
|
class HttpMiddlewareConfig {
|
|
7
17
|
constructor() {
|
|
8
18
|
this.middlewares = [];
|
|
@@ -20,13 +30,14 @@ class HttpMiddlewareConfig {
|
|
|
20
30
|
getClassTypes() {
|
|
21
31
|
const classTypes = [];
|
|
22
32
|
for (const middleware of this.middlewares) {
|
|
23
|
-
if (core_1.isClass(middleware))
|
|
33
|
+
if ((0, core_1.isClass)(middleware))
|
|
24
34
|
classTypes.push(middleware);
|
|
25
35
|
}
|
|
26
36
|
return classTypes;
|
|
27
37
|
}
|
|
28
38
|
}
|
|
29
39
|
exports.HttpMiddlewareConfig = HttpMiddlewareConfig;
|
|
40
|
+
HttpMiddlewareConfig.__type = ['name', () => __ΩHttpMiddlewareFn, () => __ΩClassType, () => __ΩHttpMiddleware, 'middlewares', function () { return []; }, () => __ΩHttpMiddlewareRoute, 'routes', function () { return []; }, () => __ΩHttpMiddlewareRoute, 'excludeRoutes', function () { return []; }, 'order', function () { return 0; }, () => __ΩClassType, 'controllers', function () { return []; }, () => __ΩClassType, 'excludeControllers', function () { return []; }, 'routeNames', function () { return []; }, 'excludeRouteNames', function () { return []; }, 'timeout', function () { return 4000; }, () => injector_1.InjectorModule, 'modules', function () { return []; }, 'selfModule', function () { return false; }, () => __ΩClassType, 'getClassTypes', '&3!8Pn"n$o#"JF3%>&n\'F3(>)n*F3+>,\'3->.n/F30>1n2F33>4&F35>6&F37>8\'39>:P"7;F3<>=)3>>?Pn@F0A5'];
|
|
30
41
|
class HttpMiddlewareApi {
|
|
31
42
|
constructor() {
|
|
32
43
|
this.t = new HttpMiddlewareConfig;
|
|
@@ -79,5 +90,6 @@ class HttpMiddlewareApi {
|
|
|
79
90
|
}
|
|
80
91
|
}
|
|
81
92
|
exports.HttpMiddlewareApi = HttpMiddlewareApi;
|
|
82
|
-
|
|
93
|
+
HttpMiddlewareApi.__type = ['name', () => __ΩHttpMiddlewareFn, () => __ΩClassType, () => __ΩHttpMiddleware, 'middlewares', 'for', () => __ΩHttpMiddlewareRoute, 'routes', 'forRoutes', () => __ΩHttpMiddlewareRoute, 'excludeRoutes', 'names', 'forRouteNames', 'excludeRouteNames', 'timeout', () => __ΩClassType, 'controllers', 'forControllers', () => __ΩClassType, 'excludeControllers', 'order', () => app_1.AppModule, 'modules', 'forModules', 'forSelfModules', 'P&2!"0!PPn"n$o#"J@2%"0&Pn\'@2("0)Pn*@2("0+P&@2,"0-P&@2,"0.P\'2/"0/Pn0@21"02Pn3@21"04P\'25"05PP"76@27"08P"095'];
|
|
94
|
+
exports.httpMiddleware = (0, type_1.createFreeDecoratorContext)(HttpMiddlewareApi);
|
|
83
95
|
//# sourceMappingURL=middleware.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.js","sourceRoot":"","sources":["../../../src/middleware.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"middleware.js","sourceRoot":"","sources":["../../../src/middleware.ts"],"names":[],"mappings":";;;+BAAmC,eAAe;AAAlD,wCAAmD;AACnD,sCAAyC;AACzC,wCAA2D;AAC3D,mCAAoD;AACpD,gDAAmD;;;;;;;AAkBnD,MAAa,oBAAoB;IAAjC;QAEI,gBAAW,GAAqD,EAAE,CAAC;QAEnE,WAAM,GAA0B,EAAE,CAAC;QACnC,kBAAa,GAA0B,EAAE,CAAC;QAE1C,UAAK,GAAW,CAAC,CAAC;QAElB,gBAAW,GAAgB,EAAE,CAAC;QAC9B,uBAAkB,GAAgB,EAAE,CAAC;QAErC,eAAU,GAAa,EAAE,CAAC;QAC1B,sBAAiB,GAAa,EAAE,CAAC;QAEjC,YAAO,GAAW,IAAK,CAAC;QAExB,YAAO,GAA0B,EAAE,CAAC;QAEpC,eAAU,GAAY,KAAK,CAAC;KAU/B;IARG,aAAa;QACT,MAAM,UAAU,GAAgB,EAAE,CAAC;QACnC,KAAK,MAAM,UAAU,IAAI,IAAI,CAAC,WAAW,EAAE;YACvC,IAAI,IAAA,cAAO,EAAC,UAAU,CAAC;gBAAE,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SACxD;QAED,OAAO,UAAU,CAAC;IACtB,CAAC;;AA5BL,oDA6BC;mJA3BmE,EAAE,kEAElC,EAAE,yEACK,EAAE,mCAEzB,CAA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;IAC7B,CAAC;IAED;;OAEG;IACH,cAAc;QACV,IAAI,CAAC,CAAC,CAAC,UAAU,GAAG,IAAI,CAAC;IAC7B,CAAC;;AA3DL,8CA4DC;;AAEY,QAAA,cAAc,GAAG,IAAA,iCAA0B,EAAC,iBAAiB,CAAC,CAAC"}
|
package/dist/cjs/src/model.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { IncomingMessage, ServerResponse } from 'http';
|
|
3
3
|
import { UploadedFile } from './router';
|
|
4
|
+
import { Type, ValidationErrorItem } from '@deepkit/type';
|
|
4
5
|
export declare class HttpResponse extends ServerResponse {
|
|
5
6
|
status(code: number): void;
|
|
6
7
|
}
|
|
@@ -10,6 +11,56 @@ export declare type HttpRequestQuery = {
|
|
|
10
11
|
export declare type HttpRequestResolvedParameters = {
|
|
11
12
|
[name: string]: any;
|
|
12
13
|
};
|
|
14
|
+
export declare class BodyValidationError {
|
|
15
|
+
readonly errors: ValidationErrorItem[];
|
|
16
|
+
constructor(errors?: ValidationErrorItem[]);
|
|
17
|
+
hasErrors(prefix?: string): boolean;
|
|
18
|
+
getErrors(prefix?: string): ValidationErrorItem[];
|
|
19
|
+
getErrorsForPath(path: string): ValidationErrorItem[];
|
|
20
|
+
getErrorMessageForPath(path: string): string;
|
|
21
|
+
}
|
|
22
|
+
export declare class ValidatedBody<T> {
|
|
23
|
+
error: BodyValidationError;
|
|
24
|
+
value?: T | undefined;
|
|
25
|
+
constructor(error: BodyValidationError, value?: T | undefined);
|
|
26
|
+
valid(): this is {
|
|
27
|
+
value: T;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export declare type HttpBody<T> = T & {
|
|
31
|
+
__meta?: ['httpBody'];
|
|
32
|
+
};
|
|
33
|
+
export declare type HttpBodyValidation<T> = ValidatedBody<T> & {
|
|
34
|
+
__meta?: ['httpBodyValidation'];
|
|
35
|
+
};
|
|
36
|
+
export declare type HttpQuery<T, Options extends {
|
|
37
|
+
name?: string;
|
|
38
|
+
} = {}> = T & {
|
|
39
|
+
__meta?: ['httpQuery', Options];
|
|
40
|
+
};
|
|
41
|
+
export declare type HttpQueries<T, Options extends {
|
|
42
|
+
name?: string;
|
|
43
|
+
} = {}> = T & {
|
|
44
|
+
__meta?: ['httpQueries', Options];
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* For all parameters used in the URL path, a regular expression of /[^/]+/ is used. To change that, use getRegExp.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
*
|
|
52
|
+
* class Controller {
|
|
53
|
+
* @http.GET('/user/:username')
|
|
54
|
+
* route(username: HttpRegExp<string, '.*'>) {
|
|
55
|
+
* //username is string
|
|
56
|
+
* }
|
|
57
|
+
* }
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare type HttpRegExp<T, Pattern extends string> = T & {
|
|
61
|
+
__meta?: ['httpRegExp', Pattern];
|
|
62
|
+
};
|
|
63
|
+
export declare function getRegExp(type: Type): string | undefined;
|
|
13
64
|
export declare class RequestBuilder {
|
|
14
65
|
protected path: string;
|
|
15
66
|
protected method: string;
|
|
@@ -49,6 +100,8 @@ export declare class HttpRequest extends IncomingMessage {
|
|
|
49
100
|
static GET(path: string): RequestBuilder;
|
|
50
101
|
static POST(path: string): RequestBuilder;
|
|
51
102
|
static OPTIONS(path: string): RequestBuilder;
|
|
103
|
+
static TRACE(path: string): RequestBuilder;
|
|
104
|
+
static HEAD(path: string): RequestBuilder;
|
|
52
105
|
static PATCH(path: string): RequestBuilder;
|
|
53
106
|
static PUT(path: string): RequestBuilder;
|
|
54
107
|
static DELETE(path: string): RequestBuilder;
|
|
@@ -60,6 +113,13 @@ export declare class MemoryHttpResponse extends HttpResponse {
|
|
|
60
113
|
body: Buffer;
|
|
61
114
|
get json(): any;
|
|
62
115
|
get bodyString(): string;
|
|
63
|
-
write(chunk: any, encoding: any, callback?: any):
|
|
64
|
-
end(chunk: any, encoding?: any, callback?: any):
|
|
116
|
+
write(chunk: any, encoding: any, callback?: any): any;
|
|
117
|
+
end(chunk: any, encoding?: any, callback?: any): any;
|
|
65
118
|
}
|
|
119
|
+
export declare type __ΩHttpRequestQuery = any[];
|
|
120
|
+
export declare type __ΩHttpRequestResolvedParameters = any[];
|
|
121
|
+
export declare type __ΩHttpBody = any[];
|
|
122
|
+
export declare type __ΩHttpBodyValidation = any[];
|
|
123
|
+
export declare type __ΩHttpQuery = any[];
|
|
124
|
+
export declare type __ΩHttpQueries = any[];
|
|
125
|
+
export declare type __ΩHttpRegExp = any[];
|
package/dist/cjs/src/model.js
CHANGED
|
@@ -10,7 +10,11 @@
|
|
|
10
10
|
*/
|
|
11
11
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12
12
|
if (k2 === undefined) k2 = k;
|
|
13
|
-
Object.
|
|
13
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
15
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
16
|
+
}
|
|
17
|
+
Object.defineProperty(o, k2, desc);
|
|
14
18
|
}) : (function(o, m, k, k2) {
|
|
15
19
|
if (k2 === undefined) k2 = k;
|
|
16
20
|
o[k2] = m[k];
|
|
@@ -28,10 +32,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
28
32
|
return result;
|
|
29
33
|
};
|
|
30
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.MemoryHttpResponse = exports.HttpRequest = exports.RequestBuilder = exports.HttpResponse = void 0;
|
|
35
|
+
exports.MemoryHttpResponse = exports.HttpRequest = exports.RequestBuilder = exports.getRegExp = exports.__ΩHttpRegExp = exports.__ΩHttpQueries = exports.__ΩHttpQuery = exports.__ΩHttpBodyValidation = exports.__ΩHttpBody = exports.ValidatedBody = exports.BodyValidationError = exports.__ΩHttpRequestResolvedParameters = exports.__ΩHttpRequestQuery = exports.HttpResponse = void 0;
|
|
32
36
|
const http_1 = require("http");
|
|
37
|
+
const router_1 = require("./router");
|
|
33
38
|
const querystring = __importStar(require("querystring"));
|
|
34
39
|
const stream_1 = require("stream");
|
|
40
|
+
const type_1 = require("@deepkit/type");
|
|
35
41
|
class HttpResponse extends http_1.ServerResponse {
|
|
36
42
|
status(code) {
|
|
37
43
|
this.writeHead(code);
|
|
@@ -39,6 +45,63 @@ class HttpResponse extends http_1.ServerResponse {
|
|
|
39
45
|
}
|
|
40
46
|
}
|
|
41
47
|
exports.HttpResponse = HttpResponse;
|
|
48
|
+
HttpResponse.__type = ['code', 'status', 'P\'2!"0"5'];
|
|
49
|
+
var __ΩHttpRequestQuery = ['P&&LM'];
|
|
50
|
+
exports.__ΩHttpRequestQuery = __ΩHttpRequestQuery;
|
|
51
|
+
var __ΩHttpRequestResolvedParameters = ['P&"LM'];
|
|
52
|
+
exports.__ΩHttpRequestResolvedParameters = __ΩHttpRequestResolvedParameters;
|
|
53
|
+
class BodyValidationError {
|
|
54
|
+
constructor(errors = []) {
|
|
55
|
+
this.errors = errors;
|
|
56
|
+
}
|
|
57
|
+
hasErrors(prefix) {
|
|
58
|
+
return this.getErrors(prefix).length > 0;
|
|
59
|
+
}
|
|
60
|
+
getErrors(prefix) {
|
|
61
|
+
if (prefix)
|
|
62
|
+
return this.errors.filter(Object.assign(v => v.path.startsWith(prefix), { __type: ['v', '', 'P"2!"/"'] }));
|
|
63
|
+
return this.errors;
|
|
64
|
+
}
|
|
65
|
+
getErrorsForPath(path) {
|
|
66
|
+
return this.errors.filter(Object.assign(v => v.path === path, { __type: ['v', '', 'P"2!"/"'] }));
|
|
67
|
+
}
|
|
68
|
+
getErrorMessageForPath(path) {
|
|
69
|
+
return this.getErrorsForPath(path).map(Object.assign(v => v.message, { __type: ['v', '', 'P"2!"/"'] })).join(', ');
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.BodyValidationError = BodyValidationError;
|
|
73
|
+
BodyValidationError.__type = [() => type_1.ValidationErrorItem, 'errors', () => [], 'constructor', 'prefix', 'hasErrors', () => type_1.ValidationErrorItem, 'getErrors', 'path', () => type_1.ValidationErrorItem, 'getErrorsForPath', 'getErrorMessageForPath', 'PP7!F2":>#"0$P&2%8)0&P&2%8P7\'F0(P&2)P7*F0+P&2)&0,5'];
|
|
74
|
+
class ValidatedBody {
|
|
75
|
+
constructor(error, value) {
|
|
76
|
+
this.error = error;
|
|
77
|
+
this.value = value;
|
|
78
|
+
}
|
|
79
|
+
valid() {
|
|
80
|
+
return this.value !== undefined;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
exports.ValidatedBody = ValidatedBody;
|
|
84
|
+
ValidatedBody.__type = ['T', () => BodyValidationError, 'error', 'value', 'constructor', 'valid', 'b!PP7"2#:e"!2$8:"0%P!0&5'];
|
|
85
|
+
var __ΩHttpBody = ['T', "httpBody", '__meta', 'b!Pe"!PP."G4#8MK'];
|
|
86
|
+
exports.__ΩHttpBody = __ΩHttpBody;
|
|
87
|
+
var __ΩHttpBodyValidation = ['T', () => ValidatedBody, "httpBodyValidation", '__meta', 'b!PPe#!7"PP.#G4$8MK'];
|
|
88
|
+
exports.__ΩHttpBodyValidation = __ΩHttpBodyValidation;
|
|
89
|
+
var __ΩHttpQuery = ['T', 'Options', "httpQuery", '__meta', 'b!PMc"Pe"!PP.#e$"G4$8MK'];
|
|
90
|
+
exports.__ΩHttpQuery = __ΩHttpQuery;
|
|
91
|
+
var __ΩHttpQueries = ['T', 'Options', "httpQueries", '__meta', 'b!PMc"Pe"!PP.#e$"G4$8MK'];
|
|
92
|
+
exports.__ΩHttpQueries = __ΩHttpQueries;
|
|
93
|
+
var __ΩHttpRegExp = ['T', 'Pattern', "httpRegExp", '__meta', 'b!b"Pe"!PP.#e$"G4$8MK'];
|
|
94
|
+
exports.__ΩHttpRegExp = __ΩHttpRegExp;
|
|
95
|
+
function getRegExp(type) {
|
|
96
|
+
const options = type_1.metaAnnotation.getForName(type, 'httpRegExp');
|
|
97
|
+
if (!options || !options[0])
|
|
98
|
+
return;
|
|
99
|
+
if (options[0].kind !== 13 /* literal */ || 'string' !== typeof options[0].literal)
|
|
100
|
+
return;
|
|
101
|
+
return options[0].literal;
|
|
102
|
+
}
|
|
103
|
+
exports.getRegExp = getRegExp;
|
|
104
|
+
getRegExp.__type = ['type', 'getRegExp', 'P"2!P&-J/"'];
|
|
42
105
|
class RequestBuilder {
|
|
43
106
|
constructor(path, method = 'GET') {
|
|
44
107
|
this.path = path;
|
|
@@ -53,37 +116,40 @@ class RequestBuilder {
|
|
|
53
116
|
return this.path;
|
|
54
117
|
}
|
|
55
118
|
build() {
|
|
119
|
+
var _a;
|
|
56
120
|
const headers = this._headers;
|
|
57
121
|
const method = this.method;
|
|
58
122
|
const url = this.getUrl();
|
|
59
123
|
const bodyContent = this.contentBuffer;
|
|
60
124
|
const writable = new stream_1.Writable({
|
|
61
|
-
write(chunk, encoding, callback) {
|
|
125
|
+
write: Object.assign(function write(chunk, encoding, callback) {
|
|
62
126
|
-callback();
|
|
63
|
-
},
|
|
64
|
-
writev(chunks, callback) {
|
|
127
|
+
}, { __type: ['chunk', 'encoding', 'callback', 'write', 'P"2!"2""2#"/$'] }),
|
|
128
|
+
writev: Object.assign(function writev(chunks, callback) {
|
|
65
129
|
callback();
|
|
66
|
-
}
|
|
130
|
+
}, { __type: ['chunks', 'callback', 'writev', 'P"2!"2""/#'] })
|
|
67
131
|
});
|
|
68
|
-
const request = new (class extends HttpRequest {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
_read(size) {
|
|
78
|
-
if (!this.done) {
|
|
79
|
-
this.push(bodyContent);
|
|
80
|
-
process.nextTick(() => {
|
|
81
|
-
this.emit('end');
|
|
82
|
-
});
|
|
83
|
-
this.done = true;
|
|
132
|
+
const request = new (_a = class extends HttpRequest {
|
|
133
|
+
constructor() {
|
|
134
|
+
super(...arguments);
|
|
135
|
+
this.url = url;
|
|
136
|
+
this.method = method;
|
|
137
|
+
this.position = 0;
|
|
138
|
+
this.headers = headers;
|
|
139
|
+
this.done = false;
|
|
84
140
|
}
|
|
85
|
-
|
|
86
|
-
|
|
141
|
+
_read(size) {
|
|
142
|
+
if (!this.done) {
|
|
143
|
+
this.push(bodyContent);
|
|
144
|
+
process.nextTick(() => {
|
|
145
|
+
this.emit('end');
|
|
146
|
+
});
|
|
147
|
+
this.done = true;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
_a.__type = ['size', '_read', 'P\'2!"0"5'],
|
|
152
|
+
_a)(writable);
|
|
87
153
|
return request;
|
|
88
154
|
}
|
|
89
155
|
headers(headers) {
|
|
@@ -116,6 +182,7 @@ class RequestBuilder {
|
|
|
116
182
|
}
|
|
117
183
|
}
|
|
118
184
|
exports.RequestBuilder = RequestBuilder;
|
|
185
|
+
RequestBuilder.__type = [() => Buffer, 'contentBuffer', function () { return Buffer.alloc(0); }, '_headers', function () { return {}; }, 'queryPath', 'path', 'method', () => "GET", 'constructor', 'getUrl', () => HttpRequest, 'build', 'headers', 'name', 'value', 'header', 'body', 'json', () => Buffer, 'query', 'P7!3"<>#P&&LM3$<>%&3&8<P&2\'<&2(<>)"0*P"0+PP7,0-PP&&LM2.!0.P&2/P&\'J20!01P%22!03PP&P74J22!02P"25!055'];
|
|
119
186
|
class HttpRequest extends http_1.IncomingMessage {
|
|
120
187
|
constructor() {
|
|
121
188
|
super(...arguments);
|
|
@@ -134,6 +201,12 @@ class HttpRequest extends http_1.IncomingMessage {
|
|
|
134
201
|
static OPTIONS(path) {
|
|
135
202
|
return new RequestBuilder(path, 'OPTIONS');
|
|
136
203
|
}
|
|
204
|
+
static TRACE(path) {
|
|
205
|
+
return new RequestBuilder(path, 'TRACE');
|
|
206
|
+
}
|
|
207
|
+
static HEAD(path) {
|
|
208
|
+
return new RequestBuilder(path, 'HEAD');
|
|
209
|
+
}
|
|
137
210
|
static PATCH(path) {
|
|
138
211
|
return new RequestBuilder(path, 'PATCH');
|
|
139
212
|
}
|
|
@@ -150,10 +223,11 @@ class HttpRequest extends http_1.IncomingMessage {
|
|
|
150
223
|
return this.method || 'GET';
|
|
151
224
|
}
|
|
152
225
|
getRemoteAddress() {
|
|
153
|
-
return this.
|
|
226
|
+
return this.socket.remoteAddress || '';
|
|
154
227
|
}
|
|
155
228
|
}
|
|
156
229
|
exports.HttpRequest = HttpRequest;
|
|
230
|
+
HttpRequest.__type = ['store', function () { return {}; }, () => router_1.UploadedFile, 'uploadedFiles', function () { return {}; }, 'body', 'path', () => RequestBuilder, 'GET', () => RequestBuilder, 'POST', () => RequestBuilder, 'OPTIONS', () => RequestBuilder, 'TRACE', () => RequestBuilder, 'HEAD', () => RequestBuilder, 'PATCH', () => RequestBuilder, 'PUT', () => RequestBuilder, 'DELETE', 'getUrl', 'getMethod', 'getRemoteAddress', 'P&"LM3!>"P&P7#LM3$>%P&"LM3&8P&2\'P7(0)P&2\'P7*0+P&2\'P7,0-P&2\'P7.0/P&2\'P7001P&2\'P7203P&2\'P7405P&2\'P7607P&08P&09P&0:5'];
|
|
157
231
|
class MemoryHttpResponse extends HttpResponse {
|
|
158
232
|
constructor() {
|
|
159
233
|
super(...arguments);
|
|
@@ -202,9 +276,10 @@ class MemoryHttpResponse extends HttpResponse {
|
|
|
202
276
|
}
|
|
203
277
|
this.body = Buffer.concat([this.body, chunk]);
|
|
204
278
|
}
|
|
205
|
-
super.end(chunk, encoding, callback);
|
|
279
|
+
return super.end(chunk, encoding, callback);
|
|
206
280
|
// if (callback) callback();
|
|
207
281
|
}
|
|
208
282
|
}
|
|
209
283
|
exports.MemoryHttpResponse = MemoryHttpResponse;
|
|
284
|
+
MemoryHttpResponse.__type = [() => Buffer, 'body', function () { return Buffer.alloc(0); }, 'chunk', 'encoding', 'callback', 'write', 'end', 'P7!3">#!!P"2$"2%"2&8"0\'P"2$"2%8"2&8"0(5'];
|
|
210
285
|
//# sourceMappingURL=model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/model.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/model.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,+BAAuD;AACvD,qCAAwC;AACxC,yDAA2C;AAC3C,mCAAkC;AAClC,wCAA0F;AAE1F,MAAa,YAAa,SAAQ,qBAAc;IAC5C,MAAM,CAAC,IAAY;QACf,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACrB,IAAI,CAAC,GAAG,EAAE,CAAC;IACf,CAAC;;AAJL,oCAKC;;;;;;AAKD,MAAa,mBAAmB;IAC5B,YACoB,SAAgC,EAAE;QAAlC,WAAM,GAAN,MAAM,CAA4B;IAEtD,CAAC;IAED,SAAS,CAAC,MAAe;QACrB,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IAC7C,CAAC;IAED,SAAS,CAAC,MAAe;QACrB,IAAI,MAAM;YAAE,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,eAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,oCAAC,CAAC;QAEtE,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED,gBAAgB,CAAC,IAAY;QACzB,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,eAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,oCAAC,CAAC;IACpD,CAAC;IAED,sBAAsB,CAAC,IAAY;QAC/B,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,GAAG,eA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AC,CAAC;SACjD;QACD,OAAO,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC5C,4BAA4B;IAChC,CAAC;;AAvDL,gDAwDC;wEAvDyB,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}>;
|
|
1
|
+
export declare class HttpConfig {
|
|
2
|
+
debug: boolean;
|
|
3
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
3
|
+
exports.HttpConfig = void 0;
|
|
4
|
+
class HttpConfig {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.debug = false;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
exports.HttpConfig = HttpConfig;
|
|
10
|
+
HttpConfig.__type = ['debug', function () { return false; }, ')3!>"5'];
|
|
9
11
|
//# sourceMappingURL=module.config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.config.js","sourceRoot":"","sources":["../../../src/module.config.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"module.config.js","sourceRoot":"","sources":["../../../src/module.config.ts"],"names":[],"mappings":";;;AAAA,MAAa,UAAU;IAAvB;QACI,UAAK,GAAY,KAAK,CAAC;KAC1B;;AAFD,gCAEC;mDADoB,KAAK"}
|
package/dist/cjs/src/module.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
+
import { HttpConfig } from './module.config';
|
|
1
2
|
import { AppModule } from '@deepkit/app';
|
|
2
3
|
import { HttpControllers } from './controllers';
|
|
3
4
|
import '@deepkit/type';
|
|
4
5
|
import { ClassType } from '@deepkit/core';
|
|
5
|
-
declare const HttpModule_base: import("@deepkit/app").AppModuleClass<
|
|
6
|
-
debug: import("@deepkit/type").FieldDecoratorResult<boolean>;
|
|
7
|
-
}>>;
|
|
6
|
+
declare const HttpModule_base: import("@deepkit/app").AppModuleClass<HttpConfig>;
|
|
8
7
|
export declare class HttpModule extends HttpModule_base {
|
|
9
8
|
protected httpControllers: HttpControllers;
|
|
10
9
|
process(): void;
|
package/dist/cjs/src/module.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HttpModule = void 0;
|
|
4
|
+
var { __ΩClassType } = require('@deepkit/core');
|
|
4
5
|
const http_1 = require("./http");
|
|
5
6
|
const module_config_1 = require("./module.config");
|
|
6
7
|
const app_1 = require("@deepkit/app");
|
|
@@ -12,8 +13,8 @@ const logger_1 = require("@deepkit/logger");
|
|
|
12
13
|
const model_1 = require("./model");
|
|
13
14
|
require("@deepkit/type");
|
|
14
15
|
const decorator_1 = require("./decorator");
|
|
15
|
-
class HttpModule extends app_1.createModule({
|
|
16
|
-
config: module_config_1.
|
|
16
|
+
class HttpModule extends (0, app_1.createModule)({
|
|
17
|
+
config: module_config_1.HttpConfig,
|
|
17
18
|
providers: [
|
|
18
19
|
router_1.Router,
|
|
19
20
|
kernel_1.HttpKernel,
|
|
@@ -57,4 +58,5 @@ class HttpModule extends app_1.createModule({
|
|
|
57
58
|
}
|
|
58
59
|
}
|
|
59
60
|
exports.HttpModule = HttpModule;
|
|
61
|
+
HttpModule.__type = ['process', () => app_1.AppModule, 'module', () => __ΩClassType, 'controller', 'processController', 'P"0!PP"7"2#n$2%"0&5'];
|
|
60
62
|
//# sourceMappingURL=module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../src/module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../src/module.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