@deepkit/http 1.0.1-alpha.97 → 1.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/CHANGELOG.md +240 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/src/controllers.js +1 -1
- package/dist/cjs/src/decorator.d.ts +7 -6
- package/dist/cjs/src/decorator.js +55 -42
- package/dist/cjs/src/decorator.js.map +1 -1
- package/dist/cjs/src/filter.js +4 -4
- package/dist/cjs/src/filter.js.map +1 -1
- package/dist/cjs/src/http-app.d.ts +8 -0
- package/dist/cjs/src/http-app.js +16 -0
- package/dist/cjs/src/http-app.js.map +1 -0
- package/dist/cjs/src/http.d.ts +2 -4
- package/dist/cjs/src/http.js +63 -51
- package/dist/cjs/src/http.js.map +1 -1
- package/dist/cjs/src/kernel.d.ts +43 -3
- package/dist/cjs/src/kernel.js +58 -8
- package/dist/cjs/src/kernel.js.map +1 -1
- package/dist/cjs/src/logger.js +2 -2
- package/dist/cjs/src/logger.js.map +1 -1
- package/dist/cjs/src/middleware.d.ts +2 -2
- package/dist/cjs/src/middleware.js +5 -6
- package/dist/cjs/src/middleware.js.map +1 -1
- package/dist/cjs/src/model.d.ts +154 -31
- package/dist/cjs/src/model.js +83 -42
- package/dist/cjs/src/model.js.map +1 -1
- package/dist/cjs/src/module.config.d.ts +67 -2
- package/dist/cjs/src/module.config.js +2 -2
- package/dist/cjs/src/module.config.js.map +1 -1
- package/dist/cjs/src/module.js +18 -13
- package/dist/cjs/src/module.js.map +1 -1
- package/dist/cjs/src/request-parser.d.ts +2 -1
- package/dist/cjs/src/request-parser.js +138 -60
- package/dist/cjs/src/request-parser.js.map +1 -1
- package/dist/cjs/src/router.d.ts +12 -6
- package/dist/cjs/src/router.js +40 -28
- package/dist/cjs/src/router.js.map +1 -1
- package/dist/cjs/src/static-serving.d.ts +4 -0
- package/dist/cjs/src/static-serving.js +44 -40
- package/dist/cjs/src/static-serving.js.map +1 -1
- package/dist/cjs/src/utils.js +1 -2
- package/dist/cjs/src/utils.js.map +1 -1
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/src/controllers.js +2 -2
- package/dist/esm/src/controllers.js.map +1 -1
- package/dist/esm/src/decorator.d.ts +7 -6
- package/dist/esm/src/decorator.js +66 -54
- package/dist/esm/src/decorator.js.map +1 -1
- package/dist/esm/src/filter.js +5 -5
- package/dist/esm/src/filter.js.map +1 -1
- package/dist/esm/src/http-app.d.ts +8 -0
- package/dist/esm/src/http-app.js +12 -0
- package/dist/esm/src/http-app.js.map +1 -0
- package/dist/esm/src/http.d.ts +2 -4
- package/dist/esm/src/http.js +65 -53
- package/dist/esm/src/http.js.map +1 -1
- package/dist/esm/src/kernel.d.ts +43 -3
- package/dist/esm/src/kernel.js +60 -10
- package/dist/esm/src/kernel.js.map +1 -1
- package/dist/esm/src/logger.js +2 -2
- package/dist/esm/src/logger.js.map +1 -1
- package/dist/esm/src/middleware.d.ts +2 -2
- package/dist/esm/src/middleware.js +6 -7
- package/dist/esm/src/middleware.js.map +1 -1
- package/dist/esm/src/model.d.ts +154 -31
- package/dist/esm/src/model.js +61 -32
- package/dist/esm/src/model.js.map +1 -1
- package/dist/esm/src/module.config.d.ts +67 -2
- package/dist/esm/src/module.config.js +2 -2
- package/dist/esm/src/module.config.js.map +1 -1
- package/dist/esm/src/module.js +20 -15
- package/dist/esm/src/module.js.map +1 -1
- package/dist/esm/src/request-parser.d.ts +2 -1
- package/dist/esm/src/request-parser.js +139 -61
- package/dist/esm/src/request-parser.js.map +1 -1
- package/dist/esm/src/router.d.ts +12 -6
- package/dist/esm/src/router.js +46 -36
- package/dist/esm/src/router.js.map +1 -1
- package/dist/esm/src/static-serving.d.ts +4 -0
- package/dist/esm/src/static-serving.js +41 -39
- package/dist/esm/src/static-serving.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/index.ts +1 -0
- package/package.json +23 -16
- package/src/decorator.ts +20 -2
- package/src/http-app.ts +11 -0
- package/src/http.ts +30 -10
- package/src/kernel.ts +81 -9
- package/src/middleware.ts +1 -1
- package/src/model.ts +177 -17
- package/src/module.config.ts +75 -1
- package/src/module.ts +20 -12
- package/src/request-parser.ts +147 -62
- package/src/router.ts +36 -10
- package/src/static-serving.ts +49 -38
- package/tsconfig.json +9 -3
- package/tsconfig.spec.json +8 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../../src/decorator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../../src/decorator.ts"],"names":[],"mappings":";;;;6BAU4C,eAAe;;wCAkBpD,eAAe;;0CACiB,aAAa;;+BAD7C,eAAe;;kCAEiE,iBAAiB;;oCAAjB,iBAAiB;;sCAFjG,eAAe;;gCAAf,eAAe;;uCAAf,eAAe;;8CAAf,eAAe;;iCAAf,eAAe;;uCAAf,eAAe;;;;;AA5BtB;;;;;;;;GAQG;AAEH,OAAO,EAAa,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAEH,2BAA2B,EAC3B,8BAA8B,EAK9B,kBAAkB,EAClB,cAAc,EAGd,kBAAkB,EAElB,UAAU,EAGb,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,cAAc,EAAkB,oBAAoB,EAAoB,MAAM,iBAAiB,CAAC;;AAIzG,SAAS,yBAAyB,CAAC,CAAuB;IACtD,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC;AAChE,CAAC;;AAED,MAAM,OAAO,cAAc;IAA3B;QACI,YAAO,GAAW,EAAE,CAAC;QACrB,YAAO,IAAO,GAAG,kCAAP,IA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,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,QAAQ,CAAI,UAAkB,EAAE,cAAsB,EAAE,EAAE;IAvB1D;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,QAAQ,OAAuE;aAA/E,QAAQ;QACJ,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;KACzG;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,gBAAgB,CAAC,SAAmC,EAAE,QAA2C;QAC7F,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACrD,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,sBAAsB,CAAC,IAAY,EAAE,QAA2C;QAC5E,IAAI,CAAC,CAAC,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACxD,CAAC;;wDApMG,IAAI,UAAU;;;AAiNtB,MAAM,CAAC,MAAM,UAAU,GAAsC,8BAA8B,CAAC,mBAAmB,CAAC,CAAC;;;;;AAQjH,MAAM,CAAC,MAAM,IAAI,GAAsD,cAAc,CAAC,SAAS,EAAE,UAAU,CAA6D,CAAC"}
|
package/dist/esm/src/filter.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*@ts-ignore*/
|
|
2
|
-
import { __ΩClassType
|
|
2
|
+
import { __ΩClassType } from '@deepkit/core';
|
|
3
3
|
import { AppModule } from '@deepkit/app';
|
|
4
4
|
import { RouteConfig, HttpRouter } from './router.js';
|
|
5
|
-
const __ΩHttpRouteFilterRoute = ['path', 'pathRegExp', "GET", "HEAD", "POST", "PATCH", "PUT", "DELETE", "OPTIONS", "TRACE", 'httpMethod', 'category', 'group', 'P&4!8A4"8P.#.$.%.&.\'.(.).*J4+8&4,8&4-
|
|
5
|
+
const __ΩHttpRouteFilterRoute = ['path', 'pathRegExp', "GET", "HEAD", "POST", "PATCH", "PUT", "DELETE", "OPTIONS", "TRACE", 'httpMethod', 'category', 'group', 'HttpRouteFilterRoute', 'P&4!8A4"8P.#.$.%.&.\'.(.).*J4+8&4,8&4-8Mw.y'];
|
|
6
6
|
export { __ΩHttpRouteFilterRoute as __ΩHttpRouteFilterRoute };
|
|
7
7
|
export class HttpRouteFilterModel {
|
|
8
8
|
constructor() {
|
|
@@ -28,7 +28,7 @@ export class HttpRouteFilterModel {
|
|
|
28
28
|
this.moduleClasses = [];
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
HttpRouteFilterModel.__type = [() => __ΩClassType, 'controllers', function () { return []; }, () => __ΩClassType, 'excludeControllers', function () { return []; }, () => __ΩHttpRouteFilterRoute, 'routes', function () { return []; }, () => __ΩHttpRouteFilterRoute, 'excludeRoutes', function () { return []; }, 'routeNames', function () { return []; }, 'excludeRouteNames', function () { return []; }, () => AppModule, 'modules', function () { return []; }, () => AppModule, 'excludeModules', function () { return []; }, () => __ΩClassType, () => AppModule, 'moduleClasses', function () { return []; }, () => __ΩClassType, () => AppModule, 'excludeModuleClasses', function () { return []; }, 'reset', 'n!F3">#n$F3%>&n\'F3(>)n*F3+>,&F3->.&F3/>0P"71F32>3P"74F35>6P"78o7"F39>:P"7<o;"F3=>>P"0?
|
|
31
|
+
HttpRouteFilterModel.__type = [() => __ΩClassType, 'controllers', function () { return []; }, () => __ΩClassType, 'excludeControllers', function () { return []; }, () => __ΩHttpRouteFilterRoute, 'routes', function () { return []; }, () => __ΩHttpRouteFilterRoute, 'excludeRoutes', function () { return []; }, 'routeNames', function () { return []; }, 'excludeRouteNames', function () { return []; }, () => AppModule, 'modules', function () { return []; }, () => AppModule, 'excludeModules', function () { return []; }, () => __ΩClassType, () => AppModule, 'moduleClasses', function () { return []; }, () => __ΩClassType, () => AppModule, 'excludeModuleClasses', function () { return []; }, 'reset', 'HttpRouteFilterModel', 'n!F3">#n$F3%>&n\'F3(>)n*F3+>,&F3->.&F3/>0P"71F32>3P"74F35>6P"78o7"F39>:P"7<o;"F3=>>P"0?5w@'];
|
|
32
32
|
function match(routeConfig, route) {
|
|
33
33
|
if (route.httpMethod && routeConfig.httpMethods.includes(route.httpMethod))
|
|
34
34
|
return true;
|
|
@@ -152,7 +152,7 @@ export class HttpRouterFilterResolver {
|
|
|
152
152
|
return result;
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
-
HttpRouterFilterResolver.__type = [() => HttpRouter, 'router', 'constructor', () => HttpRouteFilterModel, 'filter', () => RouteConfig, 'resolve', 'PP7!2"<"0#PP7$2%P7&F0\'
|
|
155
|
+
HttpRouterFilterResolver.__type = [() => HttpRouter, 'router', 'constructor', () => HttpRouteFilterModel, 'filter', () => RouteConfig, 'resolve', 'HttpRouterFilterResolver', 'PP7!2"<"0#PP7$2%P7&F0\'5w('];
|
|
156
156
|
/**
|
|
157
157
|
* A class to describe a filter for routes.
|
|
158
158
|
*/
|
|
@@ -205,5 +205,5 @@ export class HttpRouteFilter {
|
|
|
205
205
|
return this;
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
-
HttpRouteFilter.__type = ['reset', () => __ΩClassType, 'controllers', 'forControllers', () => __ΩClassType, 'excludeControllers', () => __ΩHttpRouteFilterRoute, 'routes', 'forRoutes', () => __ΩHttpRouteFilterRoute, 'excludeRoutes', 'names', 'forRouteNames', 'excludeRouteNames', () => AppModule, 'modules', 'forModules', () => AppModule, 'excludeModules', () => __ΩClassType, () => AppModule, 'moduleClasses', 'forModuleClasses', () => __ΩClassType, () => AppModule, 'excludeModuleClasses', 'P!0
|
|
208
|
+
HttpRouteFilter.__type = ['model', function () { return new HttpRouteFilterModel(); }, 'reset', () => __ΩClassType, 'controllers', 'forControllers', () => __ΩClassType, 'excludeControllers', () => __ΩHttpRouteFilterRoute, 'routes', 'forRoutes', () => __ΩHttpRouteFilterRoute, 'excludeRoutes', 'names', 'forRouteNames', 'excludeRouteNames', () => AppModule, 'modules', 'forModules', () => AppModule, 'excludeModules', () => __ΩClassType, () => AppModule, 'moduleClasses', 'forModuleClasses', () => __ΩClassType, () => AppModule, 'excludeModuleClasses', 'HttpRouteFilter', '!3!>"P!0#Pn$@2%!0&Pn\'@2%!0(Pn)@2*!0+Pn,@2*!0-P&@2.!0/P&@2.!00PP"71@22!03PP"74@22!05PP"77o6"@28!09PP"7;o:"@28!0<5w='];
|
|
209
209
|
//# sourceMappingURL=filter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.js","sourceRoot":"","sources":["../../../src/filter.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"filter.js","sourceRoot":"","sources":["../../../src/filter.ts"],"names":[],"mappings":";6BAA0B,eAAe;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;;;AAUtD,MAAM,OAAO,oBAAoB;IAAjC;QACI,gBAAW,GAAgB,EAAE,CAAC;QAC9B,uBAAkB,GAAgB,EAAE,CAAC;QAErC,WAAM,GAA2B,EAAE,CAAC;QACpC,kBAAa,GAA2B,EAAE,CAAC;QAE3C,eAAU,GAAa,EAAE,CAAC;QAC1B,sBAAiB,GAAa,EAAE,CAAC;QAEjC,YAAO,GAAqB,EAAE,CAAC;QAC/B,mBAAc,GAAqB,EAAE,CAAC;QAEtC,kBAAa,GAAgC,EAAE,CAAC;QAChD,yBAAoB,GAAgC,EAAE,CAAC;KAe1D;IAbG,KAAK;QACD,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAC;QAE7B,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;QAExB,IAA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K,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,gBAAgB,CAAC,GAAG,aAA0C;QAC1D,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC;QAChD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,oBAAoB,CAAC,GAAG,aAA0C;QAC9D,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC;QACvD,OAAO,IAAI,CAAC;IAChB,CAAC;;wDAvDc,IAAI,oBAAoB,EAAE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { App, RootModuleDefinition } from '@deepkit/app';
|
|
2
|
+
import { HttpRouterRegistry } from './router.js';
|
|
3
|
+
/**
|
|
4
|
+
* Same as App, but with easily accessible router to make the most common use case easier.
|
|
5
|
+
*/
|
|
6
|
+
export declare class HttpApp<T extends RootModuleDefinition> extends App<T> {
|
|
7
|
+
get router(): HttpRouterRegistry;
|
|
8
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { App } from '@deepkit/app';
|
|
2
|
+
import { HttpRouterRegistry } from './router.js';
|
|
3
|
+
/**
|
|
4
|
+
* Same as App, but with easily accessible router to make the most common use case easier.
|
|
5
|
+
*/
|
|
6
|
+
export class HttpApp extends App {
|
|
7
|
+
get router() {
|
|
8
|
+
return super.get(HttpRouterRegistry);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
HttpApp.__type = ['T', () => App, 'HttpApp', 'b!Pe"!7"!5e!!6"w#'];
|
|
12
|
+
//# sourceMappingURL=http-app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-app.js","sourceRoot":"","sources":["../../../src/http-app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAwB,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD;;GAEG;AACH,MAAM,OAAO,OAAwC,SAAQ,GAAM;IAC/D,IAAI,MAAM;QACN,OAAO,KAAK,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IACzC,CAAC"}
|
package/dist/esm/src/http.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
1
|
import { ClassType, CustomError } from '@deepkit/core';
|
|
4
2
|
import { OutgoingHttpHeaders, ServerResponse } from 'http';
|
|
5
3
|
import { HttpRequest, HttpRequestPositionedParameters, HttpResponse } from './model.js';
|
|
@@ -147,7 +145,7 @@ export declare class HttpControllerEvent extends HttpWorkflowEventWithRoute {
|
|
|
147
145
|
response: HttpResponse;
|
|
148
146
|
parameters: HttpRequestPositionedParameters;
|
|
149
147
|
route: RouteConfig;
|
|
150
|
-
constructor(injectorContext: InjectorContext, request: HttpRequest, response: HttpResponse, parameters: HttpRequestPositionedParameters, route: RouteConfig);
|
|
148
|
+
constructor(injectorContext: InjectorContext, request: HttpRequest, response: HttpResponse, parameters: HttpRequestPositionedParameters | undefined, route: RouteConfig);
|
|
151
149
|
}
|
|
152
150
|
export declare class HttpResponseEvent extends WorkflowEvent {
|
|
153
151
|
injectorContext: InjectorContext;
|
|
@@ -225,7 +223,7 @@ export declare class JSONResponse extends BaseResponse {
|
|
|
225
223
|
json: any;
|
|
226
224
|
constructor(json: any, statusCode?: number);
|
|
227
225
|
}
|
|
228
|
-
export
|
|
226
|
+
export type SupportedHttpResult = undefined | null | number | string | Response | JSONResponse | HtmlResponse | HttpResponse | ServerResponse | stream.Readable | Redirect | Uint8Array | Error;
|
|
229
227
|
export interface HttpResultFormatterContext {
|
|
230
228
|
request: HttpRequest;
|
|
231
229
|
response: HttpResponse;
|
package/dist/esm/src/http.js
CHANGED
|
@@ -7,19 +7,19 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
|
+
const __ΩError = ['name', 'message', 'stack', 'Error', 'P&4!&4"&4#8Mw$y'];
|
|
10
11
|
/*@ts-ignore*/
|
|
11
|
-
import { __ΩClassType
|
|
12
|
+
import { __ΩClassType } from '@deepkit/core';
|
|
12
13
|
/*@ts-ignore*/
|
|
13
|
-
import { __ΩRouteParameterResolverForInjector
|
|
14
|
+
import { __ΩRouteParameterResolverForInjector } from './router.js';
|
|
14
15
|
/*@ts-ignore*/
|
|
15
|
-
import { __ΩHttpRequestPositionedParameters
|
|
16
|
+
import { __ΩHttpRequestPositionedParameters } from './model.js';
|
|
16
17
|
/*@ts-ignore*/
|
|
17
|
-
import { __ΩLoggerInterface
|
|
18
|
+
import { __ΩLoggerInterface } from '@deepkit/logger';
|
|
18
19
|
function __assignType(fn, args) {
|
|
19
20
|
fn.__type = args;
|
|
20
21
|
return fn;
|
|
21
22
|
}
|
|
22
|
-
const __ΩError = ['name', 'message', 'stack', 'P&4!&4"&4#8M'];
|
|
23
23
|
/*
|
|
24
24
|
* Deepkit Framework
|
|
25
25
|
* Copyright (C) 2021 Deepkit UG, Marc J. Schmidt
|
|
@@ -29,7 +29,7 @@ const __ΩError = ['name', 'message', 'stack', 'P&4!&4"&4#8M'];
|
|
|
29
29
|
*
|
|
30
30
|
* You should have received a copy of the MIT License along with this program.
|
|
31
31
|
*/
|
|
32
|
-
import { asyncOperation, CustomError, getClassName, getClassTypeFromInstance, isArray, isClassInstance } from '@deepkit/core';
|
|
32
|
+
import { asyncOperation, CustomError, getClassName, getClassTypeFromInstance, isArray, isClassInstance, isObject, } from '@deepkit/core';
|
|
33
33
|
import { ServerResponse } from 'http';
|
|
34
34
|
import { eventDispatcher } from '@deepkit/event';
|
|
35
35
|
import { HttpRequest, HttpResponse } from './model.js';
|
|
@@ -37,10 +37,10 @@ import { InjectorContext } from '@deepkit/injector';
|
|
|
37
37
|
import { HttpRouter, RouteConfig } from './router.js';
|
|
38
38
|
import { createWorkflow, WorkflowEvent } from '@deepkit/workflow';
|
|
39
39
|
import { FrameCategory, Stopwatch } from '@deepkit/stopwatch';
|
|
40
|
-
import { getSerializeFunction, hasTypeInformation, ReflectionKind, resolveReceiveType, SerializationError, serialize, serializer, typeSettings, UnpopulatedCheck, ValidationError } from '@deepkit/type';
|
|
40
|
+
import { getSerializeFunction, hasTypeInformation, ReflectionKind, resolveReceiveType, SerializationError, serialize, serializer, typeSettings, UnpopulatedCheck, ValidationError, } from '@deepkit/type';
|
|
41
41
|
import stream from 'stream';
|
|
42
42
|
export function isElementStruct(v) {
|
|
43
|
-
return '
|
|
43
|
+
return isObject(v) && 'hasOwnProperty' in v && v.hasOwnProperty('render') && v.hasOwnProperty('attributes');
|
|
44
44
|
}
|
|
45
45
|
isElementStruct.__type = ['v', 'isElementStruct', 'P"2!!/"'];
|
|
46
46
|
let templateRender;
|
|
@@ -68,7 +68,7 @@ export class Redirect {
|
|
|
68
68
|
return redirect;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
Redirect.__type = ['routeName', 'routeParameters', 'url', 'statusCode', () => 302, 'constructor', 'parameters', () => ({}), () => 302, () => Redirect, 'toRoute', () => 302, () => Redirect, 'toUrl', '&3!8P&"LM3"8&3#8P\'2$:>%"0&P&2!P&"LM2\'>(\'2$>)P7*0+sP&2#\'2$>,P7-0.
|
|
71
|
+
Redirect.__type = ['routeName', 'routeParameters', 'url', 'statusCode', () => 302, 'constructor', 'parameters', () => ({}), () => 302, () => Redirect, 'toRoute', () => 302, () => Redirect, 'toUrl', 'Redirect', '&3!8P&"LM3"8&3#8P\'2$:>%"0&P&2!P&"LM2\'>(\'2$>)P7*0+sP&2#\'2$>,P7-0.s5w/'];
|
|
72
72
|
export class HttpError extends CustomError {
|
|
73
73
|
constructor(message, httpCode) {
|
|
74
74
|
super(message);
|
|
@@ -76,7 +76,7 @@ export class HttpError extends CustomError {
|
|
|
76
76
|
this.httpCode = httpCode;
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
HttpError.__type = ['T', () => CustomError, 'message', 'httpCode', 'constructor', 'b!P7"P&2#:e"!2$:"0%
|
|
79
|
+
HttpError.__type = ['T', () => CustomError, 'message', 'httpCode', 'constructor', 'HttpError', 'b!P7"P&2#:e"!2$:"0%5w&'];
|
|
80
80
|
export function createHttpError(code, defaultMessage = '') {
|
|
81
81
|
var _a;
|
|
82
82
|
return _a = class extends HttpError {
|
|
@@ -91,47 +91,41 @@ export function createHttpError(code, defaultMessage = '') {
|
|
|
91
91
|
createHttpError.__type = ['code', 'defaultMessage', () => "", () => __ΩClassType, () => HttpError, 'createHttpError', 'P"2!&2">#P"7%o$"/&'];
|
|
92
92
|
export class HttpBadRequestError extends createHttpError(400, 'Bad request') {
|
|
93
93
|
}
|
|
94
|
-
HttpBadRequestError.__type = [() => createHttpError(400, "Bad request"), 'P7!
|
|
94
|
+
HttpBadRequestError.__type = [() => createHttpError(400, "Bad request"), 'HttpBadRequestError', 'P7!5w"'];
|
|
95
95
|
export class HttpUnauthorizedError extends createHttpError(401, 'Unauthorized') {
|
|
96
96
|
}
|
|
97
|
-
HttpUnauthorizedError.__type = [() => createHttpError(401, "Unauthorized"), 'P7!
|
|
97
|
+
HttpUnauthorizedError.__type = [() => createHttpError(401, "Unauthorized"), 'HttpUnauthorizedError', 'P7!5w"'];
|
|
98
98
|
export class HttpAccessDeniedError extends createHttpError(403, 'Access denied') {
|
|
99
99
|
}
|
|
100
|
-
HttpAccessDeniedError.__type = [() => createHttpError(403, "Access denied"), 'P7!
|
|
100
|
+
HttpAccessDeniedError.__type = [() => createHttpError(403, "Access denied"), 'HttpAccessDeniedError', 'P7!5w"'];
|
|
101
101
|
export class HttpNotFoundError extends createHttpError(404, 'Not found') {
|
|
102
102
|
}
|
|
103
|
-
HttpNotFoundError.__type = [() => createHttpError(404, "Not found"), 'P7!
|
|
103
|
+
HttpNotFoundError.__type = [() => createHttpError(404, "Not found"), 'HttpNotFoundError', 'P7!5w"'];
|
|
104
104
|
export class HttpMethodNotAllowedError extends createHttpError(405, 'Method not allowed') {
|
|
105
105
|
}
|
|
106
|
-
HttpMethodNotAllowedError.__type = [() => createHttpError(405, "Method not allowed"), 'P7!
|
|
106
|
+
HttpMethodNotAllowedError.__type = [() => createHttpError(405, "Method not allowed"), 'HttpMethodNotAllowedError', 'P7!5w"'];
|
|
107
107
|
export class HttpNotAcceptableError extends createHttpError(406, 'Not acceptable') {
|
|
108
108
|
}
|
|
109
|
-
HttpNotAcceptableError.__type = [() => createHttpError(406, "Not acceptable"), 'P7!
|
|
109
|
+
HttpNotAcceptableError.__type = [() => createHttpError(406, "Not acceptable"), 'HttpNotAcceptableError', 'P7!5w"'];
|
|
110
110
|
export class HttpTimeoutError extends createHttpError(408, 'Request timeout') {
|
|
111
111
|
}
|
|
112
|
-
HttpTimeoutError.__type = [() => createHttpError(408, "Request timeout"), 'P7!
|
|
112
|
+
HttpTimeoutError.__type = [() => createHttpError(408, "Request timeout"), 'HttpTimeoutError', 'P7!5w"'];
|
|
113
113
|
export class HttpConflictError extends createHttpError(409, 'Conflict') {
|
|
114
114
|
}
|
|
115
|
-
HttpConflictError.__type = [() => createHttpError(409, "Conflict"), 'P7!
|
|
115
|
+
HttpConflictError.__type = [() => createHttpError(409, "Conflict"), 'HttpConflictError', 'P7!5w"'];
|
|
116
116
|
export class HttpGoneError extends createHttpError(410, 'Gone') {
|
|
117
117
|
}
|
|
118
|
-
HttpGoneError.__type = [() => createHttpError(410, "Gone"), 'P7!
|
|
118
|
+
HttpGoneError.__type = [() => createHttpError(410, "Gone"), 'HttpGoneError', 'P7!5w"'];
|
|
119
119
|
export class HttpTooManyRequestsError extends createHttpError(429, 'Too many requests') {
|
|
120
120
|
}
|
|
121
|
-
HttpTooManyRequestsError.__type = [() => createHttpError(429, "Too many requests"), 'P7!
|
|
121
|
+
HttpTooManyRequestsError.__type = [() => createHttpError(429, "Too many requests"), 'HttpTooManyRequestsError', 'P7!5w"'];
|
|
122
122
|
export class HttpInternalServerError extends createHttpError(500, 'Internal server error') {
|
|
123
123
|
}
|
|
124
|
-
HttpInternalServerError.__type = [() => createHttpError(500, "Internal server error"), 'P7!
|
|
124
|
+
HttpInternalServerError.__type = [() => createHttpError(500, "Internal server error"), 'HttpInternalServerError', 'P7!5w"'];
|
|
125
125
|
export class HttpNotImplementedError extends createHttpError(501, 'Not implemented') {
|
|
126
126
|
}
|
|
127
|
-
HttpNotImplementedError.__type = [() => createHttpError(501, "Not implemented"), 'P7!
|
|
127
|
+
HttpNotImplementedError.__type = [() => createHttpError(501, "Not implemented"), 'HttpNotImplementedError', 'P7!5w"'];
|
|
128
128
|
export class HttpWorkflowEvent {
|
|
129
|
-
constructor(injectorContext, request, response) {
|
|
130
|
-
this.injectorContext = injectorContext;
|
|
131
|
-
this.request = request;
|
|
132
|
-
this.response = response;
|
|
133
|
-
this.propagationStopped = false;
|
|
134
|
-
}
|
|
135
129
|
stopPropagation() {
|
|
136
130
|
this.propagationStopped = true;
|
|
137
131
|
}
|
|
@@ -155,6 +149,12 @@ export class HttpWorkflowEvent {
|
|
|
155
149
|
hasNext() {
|
|
156
150
|
return this.nextState !== undefined;
|
|
157
151
|
}
|
|
152
|
+
constructor(injectorContext, request, response) {
|
|
153
|
+
this.injectorContext = injectorContext;
|
|
154
|
+
this.request = request;
|
|
155
|
+
this.response = response;
|
|
156
|
+
this.propagationStopped = false;
|
|
157
|
+
}
|
|
158
158
|
get url() {
|
|
159
159
|
return this.request.url || '/';
|
|
160
160
|
}
|
|
@@ -168,7 +168,7 @@ export class HttpWorkflowEvent {
|
|
|
168
168
|
this.next('response', new HttpResponseEvent(this.injectorContext, this.request, this.response, response));
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
-
HttpWorkflowEvent.__type = ['stopPropagation', 'isPropagationStopped', 'nextState', 'nextStateEvent', 'clearNext', 'event', 'next', 'hasNext', () => InjectorContext, 'injectorContext', () => HttpRequest, 'request', () => HttpResponse, 'response', 'constructor', 'send', 'P"0
|
|
171
|
+
HttpWorkflowEvent.__type = ['propagationStopped', function () { return false; }, 'stopPropagation', 'isPropagationStopped', 'nextState', 'nextStateEvent', 'clearNext', 'event', 'next', 'hasNext', () => InjectorContext, 'injectorContext', () => HttpRequest, 'request', () => HttpResponse, 'response', 'constructor', 'send', 'HttpWorkflowEvent', ')3!>"P"0#P"0$"3%8"3&8P"0\'P&2%"2(8"0)P)0*PP7+2,:P7-2.:P7/20:"01!!P"20"025w3'];
|
|
172
172
|
export const HttpRequestEvent = HttpWorkflowEvent;
|
|
173
173
|
export const HttpRouteNotFoundEvent = HttpWorkflowEvent;
|
|
174
174
|
export class HttpWorkflowEventWithRoute extends HttpWorkflowEvent {
|
|
@@ -186,7 +186,7 @@ export class HttpWorkflowEventWithRoute extends HttpWorkflowEvent {
|
|
|
186
186
|
this.next('accessDenied', new HttpAccessDeniedEvent(this.injectorContext, this.request, this.response, this.route, error));
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
|
-
HttpWorkflowEventWithRoute.__type = [() => HttpWorkflowEvent, () => InjectorContext, 'injectorContext', () => HttpRequest, 'request', () => HttpResponse, 'response', () => RouteConfig, 'route', 'constructor', 'send', () => __ΩError, 'error', 'accessDenied', 'P7!PP7"2#:P7$2%:P7&2\':P7(2):"0*P"2\'"0+Pn,2-8"0.
|
|
189
|
+
HttpWorkflowEventWithRoute.__type = [() => HttpWorkflowEvent, () => InjectorContext, 'injectorContext', () => HttpRequest, 'request', () => HttpResponse, 'response', () => RouteConfig, 'route', 'constructor', 'send', () => __ΩError, 'error', 'accessDenied', 'HttpWorkflowEventWithRoute', 'P7!PP7"2#:P7$2%:P7&2\':P7(2):"0*P"2\'"0+Pn,2-8"0.5w/'];
|
|
190
190
|
export class HttpRouteEvent extends HttpWorkflowEvent {
|
|
191
191
|
constructor(injectorContext, request, response, parameterResolver, route) {
|
|
192
192
|
super(injectorContext, request, response);
|
|
@@ -204,7 +204,7 @@ export class HttpRouteEvent extends HttpWorkflowEvent {
|
|
|
204
204
|
this.next('routeNotFound', new HttpRouteNotFoundEvent(this.injectorContext, this.request, this.response));
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
HttpRouteEvent.__type = [() => HttpWorkflowEvent, () => InjectorContext, 'injectorContext', () => HttpRequest, 'request', () => HttpResponse, 'response', () => __ΩRouteParameterResolverForInjector, 'parameterResolver', () => RouteConfig, 'route', 'constructor', () => RouteConfig, () => __ΩRouteParameterResolverForInjector, 'routeFound', 'notFound', 'P7!PP7"2#:P7$2%:P7&2\':n(2)8:P7*2+8:"0,PP7-2+n.2)"0/P"
|
|
207
|
+
HttpRouteEvent.__type = [() => HttpWorkflowEvent, () => InjectorContext, 'injectorContext', () => HttpRequest, 'request', () => HttpResponse, 'response', () => __ΩRouteParameterResolverForInjector, 'parameterResolver', () => RouteConfig, 'route', 'constructor', () => RouteConfig, () => __ΩRouteParameterResolverForInjector, 'routeFound', 'notFound', 'HttpRouteEvent', 'P7!PP7"2#:P7$2%:P7&2\':n(2)8:P7*2+8:"0,PP7-2+n.2)"0/P"005w1'];
|
|
208
208
|
export class HttpAuthEvent extends HttpWorkflowEventWithRoute {
|
|
209
209
|
constructor(injectorContext, request, response, route, parameterResolver) {
|
|
210
210
|
super(injectorContext, request, response, route);
|
|
@@ -218,7 +218,7 @@ export class HttpAuthEvent extends HttpWorkflowEventWithRoute {
|
|
|
218
218
|
this.next('resolveParameters', new HttpResolveParametersEvent(this.injectorContext, this.request, this.response, this.parameterResolver, this.route));
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
|
-
HttpAuthEvent.__type = [() => HttpWorkflowEventWithRoute, () => InjectorContext, 'injectorContext', () => HttpRequest, 'request', () => HttpResponse, 'response', () => RouteConfig, 'route', () => __ΩRouteParameterResolverForInjector, 'parameterResolver', 'constructor', 'success', 'P7!PP7"2#:P7$2%:P7&2\':P7(2):n*2+:"0,P"0-
|
|
221
|
+
HttpAuthEvent.__type = [() => HttpWorkflowEventWithRoute, () => InjectorContext, 'injectorContext', () => HttpRequest, 'request', () => HttpResponse, 'response', () => RouteConfig, 'route', () => __ΩRouteParameterResolverForInjector, 'parameterResolver', 'constructor', 'success', 'HttpAuthEvent', 'P7!PP7"2#:P7$2%:P7&2\':P7(2):n*2+:"0,P"0-5w.'];
|
|
222
222
|
export class HttpAccessDeniedEvent extends HttpWorkflowEvent {
|
|
223
223
|
constructor(injectorContext, request, response, route, error) {
|
|
224
224
|
super(injectorContext, request, response);
|
|
@@ -229,7 +229,7 @@ export class HttpAccessDeniedEvent extends HttpWorkflowEvent {
|
|
|
229
229
|
this.error = error;
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
|
-
HttpAccessDeniedEvent.__type = [() => HttpWorkflowEvent, () => InjectorContext, 'injectorContext', () => HttpRequest, 'request', () => HttpResponse, 'response', () => RouteConfig, 'route', () => __ΩError, 'error', 'constructor', 'P7!PP7"2#:P7$2%:P7&2\':P7(2):n*2+8:"0,
|
|
232
|
+
HttpAccessDeniedEvent.__type = [() => HttpWorkflowEvent, () => InjectorContext, 'injectorContext', () => HttpRequest, 'request', () => HttpResponse, 'response', () => RouteConfig, 'route', () => __ΩError, 'error', 'constructor', 'HttpAccessDeniedEvent', 'P7!PP7"2#:P7$2%:P7&2\':P7(2):n*2+8:"0,5w-'];
|
|
233
233
|
export class HttpResolveParametersEvent extends HttpWorkflowEventWithRoute {
|
|
234
234
|
constructor(injectorContext, request, response, parameterResolver, route) {
|
|
235
235
|
super(injectorContext, request, response, route);
|
|
@@ -244,7 +244,7 @@ export class HttpResolveParametersEvent extends HttpWorkflowEventWithRoute {
|
|
|
244
244
|
this.next('accessDenied', new HttpAccessDeniedEvent(this.injectorContext, this.request, this.response, this.route));
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
|
-
HttpResolveParametersEvent.__type = [() => HttpWorkflowEventWithRoute, () => __ΩHttpRequestPositionedParameters, 'parameters', function () { return { arguments: [], parameters: {} }; }, () => InjectorContext, 'injectorContext', () => HttpRequest, 'request', () => HttpResponse, 'response', () => __ΩRouteParameterResolverForInjector, 'parameterResolver', () => RouteConfig, 'route', 'constructor', 'accessDenied', 'P7!n"3#>$PP7%2&:P7\'2(:P7)2*:n+2,:P7-2.:"0/P"
|
|
247
|
+
HttpResolveParametersEvent.__type = [() => HttpWorkflowEventWithRoute, () => __ΩHttpRequestPositionedParameters, 'parameters', function () { return { arguments: [], parameters: {} }; }, () => InjectorContext, 'injectorContext', () => HttpRequest, 'request', () => HttpResponse, 'response', () => __ΩRouteParameterResolverForInjector, 'parameterResolver', () => RouteConfig, 'route', 'constructor', 'accessDenied', 'HttpResolveParametersEvent', 'P7!n"3#>$PP7%2&:P7\'2(:P7)2*:n+2,:P7-2.:"0/P"005w1'];
|
|
248
248
|
export class HttpControllerEvent extends HttpWorkflowEventWithRoute {
|
|
249
249
|
constructor(injectorContext, request, response, parameters = { arguments: [], parameters: {} }, route) {
|
|
250
250
|
super(injectorContext, request, response, route);
|
|
@@ -255,7 +255,7 @@ export class HttpControllerEvent extends HttpWorkflowEventWithRoute {
|
|
|
255
255
|
this.route = route;
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
|
-
HttpControllerEvent.__type = [() => HttpWorkflowEventWithRoute, () => InjectorContext, 'injectorContext', () => HttpRequest, 'request', () => HttpResponse, 'response', () => __ΩHttpRequestPositionedParameters, 'parameters', () => ({ arguments: [], parameters: {} }), () => RouteConfig, 'route', 'constructor', 'P7!PP7"2#:P7$2%:P7&2\':n(2):>*P7+2,:"0-
|
|
258
|
+
HttpControllerEvent.__type = [() => HttpWorkflowEventWithRoute, () => InjectorContext, 'injectorContext', () => HttpRequest, 'request', () => HttpResponse, 'response', () => __ΩHttpRequestPositionedParameters, 'parameters', () => ({ arguments: [], parameters: {} }), () => RouteConfig, 'route', 'constructor', 'HttpControllerEvent', 'P7!PP7"2#:P7$2%:P7&2\':n(2):>*P7+2,:"0-5w.'];
|
|
259
259
|
export class HttpResponseEvent extends WorkflowEvent {
|
|
260
260
|
constructor(injectorContext, request, response, result, route) {
|
|
261
261
|
super();
|
|
@@ -270,7 +270,7 @@ export class HttpResponseEvent extends WorkflowEvent {
|
|
|
270
270
|
this.controllerActionTime = 0;
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
|
-
HttpResponseEvent.__type = [() => WorkflowEvent, 'controllerActionTime', function () { return 0; }, () => InjectorContext, 'injectorContext', () => HttpRequest, 'request', () => HttpResponse, 'response', 'result', () => RouteConfig, 'route', 'constructor', 'P7!\'3">#PP7$2%:P7&2\':P7(2):"2*:P7+2,8:"0-
|
|
273
|
+
HttpResponseEvent.__type = [() => WorkflowEvent, 'controllerActionTime', function () { return 0; }, () => InjectorContext, 'injectorContext', () => HttpRequest, 'request', () => HttpResponse, 'response', 'result', () => RouteConfig, 'route', 'constructor', 'HttpResponseEvent', 'P7!\'3">#PP7$2%:P7&2\':P7(2):"2*:P7+2,8:"0-5w.'];
|
|
274
274
|
export class HttpControllerErrorEvent extends HttpWorkflowEventWithRoute {
|
|
275
275
|
constructor(injectorContext, request, response, route, error) {
|
|
276
276
|
super(injectorContext, request, response, route);
|
|
@@ -285,7 +285,7 @@ export class HttpControllerErrorEvent extends HttpWorkflowEventWithRoute {
|
|
|
285
285
|
this.controllerActionTime = 0;
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
|
-
HttpControllerErrorEvent.__type = [() => HttpWorkflowEventWithRoute, 'controllerActionTime', function () { return 0; }, () => InjectorContext, 'injectorContext', () => HttpRequest, 'request', () => HttpResponse, 'response', () => RouteConfig, 'route', () => __ΩError, 'error', 'constructor', 'P7!\'3">#PP7$2%:P7&2\':P7(2):P7*2+:n,2-:"0.
|
|
288
|
+
HttpControllerErrorEvent.__type = [() => HttpWorkflowEventWithRoute, 'controllerActionTime', function () { return 0; }, () => InjectorContext, 'injectorContext', () => HttpRequest, 'request', () => HttpResponse, 'response', () => RouteConfig, 'route', () => __ΩError, 'error', 'constructor', 'HttpControllerErrorEvent', 'P7!\'3">#PP7$2%:P7&2\':P7(2):P7*2+:n,2-:"0.5w/'];
|
|
289
289
|
export const httpWorkflow = createWorkflow('http', {
|
|
290
290
|
start: WorkflowEvent,
|
|
291
291
|
request: HttpRequestEvent,
|
|
@@ -341,7 +341,7 @@ export class BaseResponse {
|
|
|
341
341
|
return this;
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
|
-
BaseResponse.__type = ['autoSerializing', function () { return true; }, '_statusCode', '_headers', () => ({}), 'constructor', 'code', 'status', 'disableAutoSerializing', 'name', 'value', 'header', 'headers', 'type', 'contentType', ')3!>"P\'2#8:!2$:>%"0&P\'2\'!0(P"0)P&2*P&\'J2+!0,P!2-!0-P&2.!0/
|
|
344
|
+
BaseResponse.__type = ['autoSerializing', function () { return true; }, '_statusCode', '_headers', () => ({}), 'constructor', 'code', 'status', 'disableAutoSerializing', 'name', 'value', 'header', 'headers', 'type', 'contentType', 'BaseResponse', ')3!>"P\'2#8:!2$:>%"0&P\'2\'!0(P"0)P&2*P&\'J2+!0,P!2-!0-P&2.!0/5w0'];
|
|
345
345
|
export class Response extends BaseResponse {
|
|
346
346
|
constructor(content, contentType, statusCode) {
|
|
347
347
|
super(statusCode);
|
|
@@ -349,24 +349,24 @@ export class Response extends BaseResponse {
|
|
|
349
349
|
this.contentType(contentType);
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
|
-
Response.__type = [() => BaseResponse, 'content', 'contentType', 'statusCode', 'constructor', 'P7!PP&WJ2":&2#\'2$8"0%
|
|
352
|
+
Response.__type = [() => BaseResponse, 'content', 'contentType', 'statusCode', 'constructor', 'Response', 'P7!PP&WJ2":&2#\'2$8"0%5w&'];
|
|
353
353
|
export class HtmlResponse extends BaseResponse {
|
|
354
354
|
constructor(html, statusCode) {
|
|
355
355
|
super(statusCode);
|
|
356
356
|
this.html = html;
|
|
357
357
|
}
|
|
358
358
|
}
|
|
359
|
-
HtmlResponse.__type = [() => BaseResponse, 'html', 'statusCode', 'constructor', 'P7!P&2":\'2#8"0$
|
|
359
|
+
HtmlResponse.__type = [() => BaseResponse, 'html', 'statusCode', 'constructor', 'HtmlResponse', 'P7!P&2":\'2#8"0$5w%'];
|
|
360
360
|
export class JSONResponse extends BaseResponse {
|
|
361
361
|
constructor(json, statusCode) {
|
|
362
362
|
super(statusCode);
|
|
363
363
|
this.json = json;
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
|
-
JSONResponse.__type = [() => BaseResponse, 'json', 'statusCode', 'constructor', 'P7!P"2":\'2#8"0$
|
|
367
|
-
const __ΩSupportedHttpResult = [() => Response, () => JSONResponse, () => HtmlResponse, () => HttpResponse, () => Redirect, () => __ΩError, 'P-,\'&P7!P7"P7#P7$!!P7%Wn&
|
|
366
|
+
JSONResponse.__type = [() => BaseResponse, 'json', 'statusCode', 'constructor', 'JSONResponse', 'P7!P"2":\'2#8"0$5w%'];
|
|
367
|
+
const __ΩSupportedHttpResult = [() => Response, () => JSONResponse, () => HtmlResponse, () => HttpResponse, () => Redirect, () => __ΩError, 'SupportedHttpResult', 'P-,\'&P7!P7"P7#P7$!!P7%Wn&Jw\'y'];
|
|
368
368
|
export { __ΩSupportedHttpResult as __ΩSupportedHttpResult };
|
|
369
|
-
const __ΩHttpResultFormatterContext = [() => HttpRequest, 'request', () => HttpResponse, 'response', () => RouteConfig, 'route', 'PP7!4"P7#4$P7%4&
|
|
369
|
+
const __ΩHttpResultFormatterContext = [() => HttpRequest, 'request', () => HttpResponse, 'response', () => RouteConfig, 'route', 'HttpResultFormatterContext', 'PP7!4"P7#4$P7%4&8Mw\'y'];
|
|
370
370
|
export { __ΩHttpResultFormatterContext as __ΩHttpResultFormatterContext };
|
|
371
371
|
export class HttpResultFormatter {
|
|
372
372
|
constructor(router) {
|
|
@@ -427,7 +427,7 @@ export class HttpResultFormatter {
|
|
|
427
427
|
}
|
|
428
428
|
handleType(type, instance, context, route) {
|
|
429
429
|
this.setContentTypeIfNotSetAlready(context.response, this.jsonContentType);
|
|
430
|
-
const serializerToUse = route &&
|
|
430
|
+
const serializerToUse = route && route?.serializer ? route.serializer : serializer;
|
|
431
431
|
context.response.end(JSON.stringify(serialize(instance, route ? route.serializationOptions : undefined, serializerToUse, undefined, type)));
|
|
432
432
|
}
|
|
433
433
|
handleStream(stream, context) {
|
|
@@ -492,7 +492,7 @@ export class HttpResultFormatter {
|
|
|
492
492
|
}
|
|
493
493
|
}
|
|
494
494
|
}
|
|
495
|
-
HttpResultFormatter.__type = ['jsonContentType', function () { return 'application/json; charset=utf-8'; }, 'htmlContentType', function () { return 'text/html; charset=utf-8'; }, () => HttpRouter, 'router', 'constructor', () => HttpResponse, 'response', 'contentType', 'setContentTypeIfNotSetAlready', () => __ΩError, 'error', () => __ΩHttpResultFormatterContext, 'context', 'handleError', 'result', () => __ΩHttpResultFormatterContext, 'handleUndefined', () => Redirect, () => __ΩHttpResultFormatterContext, 'handleRedirect', () => __ΩHttpResultFormatterContext, 'handleUnknown', () => HtmlResponse, () => __ΩHttpResultFormatterContext, 'handleHtmlResponse', () => Response, () => __ΩHttpResultFormatterContext, 'handleGenericResponse', () => JSONResponse, () => __ΩHttpResultFormatterContext, 'handleJSONResponse', () => __ΩClassType, 'classType', 'instance', () => __ΩHttpResultFormatterContext, () => RouteConfig, 'route', 'handleTypeEntity', 'type', () => __ΩHttpResultFormatterContext, () => RouteConfig, 'handleType', 'stream', () => __ΩHttpResultFormatterContext, 'handleStream', () => __ΩHttpResultFormatterContext, 'handleBinary', () => __ΩHttpResultFormatterContext, 'handleResponse', () => __ΩSupportedHttpResult, () => __ΩHttpResultFormatterContext, 'handle', '&3!<>"&3#<>$PP7%2&<"0\'PP7(2)&2*$0+<Pn,2-n.2/$00PP-,J21n22/$03PP7421n52/$06P"21n72/$08PP7921n:2/$0;PP7<21n=2/$0>PP7?21n@2/$0AP"oB"2C"2DnE2/P7F2G8$0HP"
|
|
495
|
+
HttpResultFormatter.__type = ['jsonContentType', function () { return 'application/json; charset=utf-8'; }, 'htmlContentType', function () { return 'text/html; charset=utf-8'; }, () => HttpRouter, 'router', 'constructor', () => HttpResponse, 'response', 'contentType', 'setContentTypeIfNotSetAlready', () => __ΩError, 'error', () => __ΩHttpResultFormatterContext, 'context', 'handleError', 'result', () => __ΩHttpResultFormatterContext, 'handleUndefined', () => Redirect, () => __ΩHttpResultFormatterContext, 'handleRedirect', () => __ΩHttpResultFormatterContext, 'handleUnknown', () => HtmlResponse, () => __ΩHttpResultFormatterContext, 'handleHtmlResponse', () => Response, () => __ΩHttpResultFormatterContext, 'handleGenericResponse', () => JSONResponse, () => __ΩHttpResultFormatterContext, 'handleJSONResponse', () => __ΩClassType, 'classType', 'instance', () => __ΩHttpResultFormatterContext, () => RouteConfig, 'route', 'handleTypeEntity', 'Type', 'type', () => __ΩHttpResultFormatterContext, () => RouteConfig, 'handleType', 'stream', () => __ΩHttpResultFormatterContext, 'handleStream', () => __ΩHttpResultFormatterContext, 'handleBinary', () => __ΩHttpResultFormatterContext, 'handleResponse', () => __ΩSupportedHttpResult, () => __ΩHttpResultFormatterContext, 'handle', 'HttpResultFormatter', '&3!<>"&3#<>$PP7%2&<"0\'PP7(2)&2*$0+<Pn,2-n.2/$00PP-,J21n22/$03PP7421n52/$06P"21n72/$08PP7921n:2/$0;PP7<21n=2/$0>PP7?21n@2/$0AP"oB"2C"2DnE2/P7F2G8$0HP"wI2J"2DnK2/P7L2G8$0MP!2NnO2/$0PPW21nQ2/$0RPnS2/"0TPnU21nV2/$0W5wX'];
|
|
496
496
|
export class HttpListener {
|
|
497
497
|
constructor(router, logger, resultFormatter, stopwatch) {
|
|
498
498
|
this.router = router;
|
|
@@ -538,13 +538,17 @@ export class HttpListener {
|
|
|
538
538
|
resolve(undefined);
|
|
539
539
|
return;
|
|
540
540
|
}
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
541
|
+
const timeout = middlewares[i].timeout;
|
|
542
|
+
if (timeout !== undefined && timeout > 0) {
|
|
543
|
+
lastTimer = setTimeout(() => {
|
|
544
|
+
logger.warn(`Middleware timed out. Increase the timeout or fix the middleware. (${middlewares[i].fn})`);
|
|
545
|
+
next();
|
|
546
|
+
}, timeout);
|
|
547
|
+
}
|
|
545
548
|
try {
|
|
546
549
|
await middlewares[i].fn(event.request, event.response, __assignType((error) => {
|
|
547
|
-
|
|
550
|
+
if (lastTimer)
|
|
551
|
+
clearTimeout(lastTimer);
|
|
548
552
|
if (error) {
|
|
549
553
|
event.response.off('finish', finish);
|
|
550
554
|
reject(error);
|
|
@@ -586,7 +590,12 @@ export class HttpListener {
|
|
|
586
590
|
return;
|
|
587
591
|
if (event.hasNext())
|
|
588
592
|
return;
|
|
589
|
-
event.
|
|
593
|
+
if (event.request.throwErrorOnNotFound) {
|
|
594
|
+
throw new HttpNotFoundError;
|
|
595
|
+
}
|
|
596
|
+
else {
|
|
597
|
+
event.send(new HtmlResponse('Not found', 404));
|
|
598
|
+
}
|
|
590
599
|
}
|
|
591
600
|
onAuth(event) {
|
|
592
601
|
if (event.sent)
|
|
@@ -695,7 +704,7 @@ export class HttpListener {
|
|
|
695
704
|
return;
|
|
696
705
|
}
|
|
697
706
|
else {
|
|
698
|
-
this.logger.error(
|
|
707
|
+
this.logger.error(`Controller for route ${event.route.getFullPath()} parameter resolving error:`, event.error);
|
|
699
708
|
event.send(new HtmlResponse('Internal error', 500));
|
|
700
709
|
}
|
|
701
710
|
}
|
|
@@ -712,6 +721,9 @@ export class HttpListener {
|
|
|
712
721
|
return;
|
|
713
722
|
}
|
|
714
723
|
else if (event.error instanceof HttpError) {
|
|
724
|
+
if (event.request.throwErrorOnNotFound && event.error.httpCode === 404) {
|
|
725
|
+
throw event.error;
|
|
726
|
+
}
|
|
715
727
|
event.send(new JSONResponse({
|
|
716
728
|
message: event.error.message
|
|
717
729
|
}, event.error.httpCode).disableAutoSerializing());
|
|
@@ -761,7 +773,7 @@ export class HttpListener {
|
|
|
761
773
|
this.resultFormatter.handle(event.result, event);
|
|
762
774
|
}
|
|
763
775
|
}
|
|
764
|
-
HttpListener.__type = [() => HttpRouter, 'router', () => __ΩLoggerInterface, 'logger', () => HttpResultFormatter, 'resultFormatter', () => Stopwatch, 'stopwatch', 'constructor', () => httpWorkflow.onRequest.event, 'event', 'onRequest', () => httpWorkflow.onRoute.event, 'onRoute', () => httpWorkflow.onRoute.event, 'onRouteForward', () => httpWorkflow.onRouteNotFound.event, 'routeNotFound', () => httpWorkflow.onAuth.event, 'onAuth', () => httpWorkflow.onResolveParameters.event, 'onResolveParameters', () => httpWorkflow.onAccessDenied.event, 'onAccessDenied', () => httpWorkflow.onController.event, 'onController', () => httpWorkflow.onParametersFailed.event, 'onParametersFailed', () => httpWorkflow.onControllerError.event, 'onControllerError', () => httpWorkflow.onResponse.event, 'onResultSerialization', () => httpWorkflow.onResponse.event, 'onResponse', 'PP7!2"<n#2$<P7%2&<P7\'2(8<"0)Pi*2+$0,Pi-2+"0.Pi/2+"00Pi12+$`02Pi32+$04Pi52+"06Pi72+$08Pi92+"0:Pi;2+$0<Pi=2+$0>Pi?2+"0@PiA2+"
|
|
776
|
+
HttpListener.__type = [() => HttpRouter, 'router', () => __ΩLoggerInterface, 'logger', () => HttpResultFormatter, 'resultFormatter', () => Stopwatch, 'stopwatch', 'constructor', () => httpWorkflow.onRequest.event, 'event', 'onRequest', () => httpWorkflow.onRoute.event, 'onRoute', () => httpWorkflow.onRoute.event, 'onRouteForward', () => httpWorkflow.onRouteNotFound.event, 'routeNotFound', () => httpWorkflow.onAuth.event, 'onAuth', () => httpWorkflow.onResolveParameters.event, 'onResolveParameters', () => httpWorkflow.onAccessDenied.event, 'onAccessDenied', () => httpWorkflow.onController.event, 'onController', () => httpWorkflow.onParametersFailed.event, 'onParametersFailed', () => httpWorkflow.onControllerError.event, 'onControllerError', () => httpWorkflow.onResponse.event, 'onResultSerialization', () => httpWorkflow.onResponse.event, 'onResponse', 'HttpListener', 'PP7!2"<n#2$<P7%2&<P7\'2(8<"0)Pi*2+$0,Pi-2+"0.Pi/2+"00Pi12+$`02Pi32+$04Pi52+"06Pi72+$08Pi92+"0:Pi;2+$0<Pi=2+$0>Pi?2+"0@PiA2+"0B5wC'];
|
|
765
777
|
__decorate([
|
|
766
778
|
eventDispatcher.listen(httpWorkflow.onRequest, 100),
|
|
767
779
|
__metadata("design:type", Function),
|