@tsed/common 7.0.0-beta.16 → 7.0.0-beta.19
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.json +6 -0
- package/jest.config.js +1 -6
- package/lib/cjs/builder/PlatformBuilder.js +4 -1
- package/lib/cjs/builder/PlatformBuilder.js.map +1 -1
- package/lib/cjs/domain/PlatformContext.js +15 -57
- package/lib/cjs/domain/PlatformContext.js.map +1 -1
- package/lib/cjs/interfaces/PlatformRouteOptions.js.map +1 -1
- package/lib/cjs/services/Platform.js +3 -17
- package/lib/cjs/services/Platform.js.map +1 -1
- package/lib/cjs/services/PlatformAdapter.js.map +1 -1
- package/lib/cjs/services/PlatformHandler.js +70 -56
- package/lib/cjs/services/PlatformHandler.js.map +1 -1
- package/lib/cjs/services/PlatformRequest.js +0 -1
- package/lib/cjs/services/PlatformRequest.js.map +1 -1
- package/lib/cjs/services/PlatformResponse.js +4 -7
- package/lib/cjs/services/PlatformResponse.js.map +1 -1
- package/lib/cjs/services/PlatformTest.js +1 -0
- package/lib/cjs/services/PlatformTest.js.map +1 -1
- package/lib/cjs/utils/createContext.js +3 -3
- package/lib/cjs/utils/createContext.js.map +1 -1
- package/lib/cjs/utils/setResponseHeaders.js +1 -1
- package/lib/cjs/utils/setResponseHeaders.js.map +1 -1
- package/lib/esm/builder/PlatformBuilder.js +4 -1
- package/lib/esm/builder/PlatformBuilder.js.map +1 -1
- package/lib/esm/domain/PlatformContext.js +15 -57
- package/lib/esm/domain/PlatformContext.js.map +1 -1
- package/lib/esm/interfaces/PlatformRouteOptions.js.map +1 -1
- package/lib/esm/services/Platform.js +3 -17
- package/lib/esm/services/Platform.js.map +1 -1
- package/lib/esm/services/PlatformAdapter.js.map +1 -1
- package/lib/esm/services/PlatformHandler.js +72 -58
- package/lib/esm/services/PlatformHandler.js.map +1 -1
- package/lib/esm/services/PlatformRequest.js +0 -1
- package/lib/esm/services/PlatformRequest.js.map +1 -1
- package/lib/esm/services/PlatformResponse.js +4 -7
- package/lib/esm/services/PlatformResponse.js.map +1 -1
- package/lib/esm/services/PlatformTest.js +1 -0
- package/lib/esm/services/PlatformTest.js.map +1 -1
- package/lib/esm/utils/createContext.js +3 -3
- package/lib/esm/utils/createContext.js.map +1 -1
- package/lib/esm/utils/setResponseHeaders.js +1 -1
- package/lib/esm/utils/setResponseHeaders.js.map +1 -1
- package/lib/types/builder/PlatformBuilder.d.ts +2 -2
- package/lib/types/domain/PlatformContext.d.ts +6 -13
- package/lib/types/interfaces/PlatformRouteOptions.d.ts +0 -1
- package/lib/types/services/Platform.d.ts +1 -5
- package/lib/types/services/PlatformAdapter.d.ts +3 -1
- package/lib/types/services/PlatformHandler.d.ts +13 -15
- package/lib/types/services/PlatformRequest.d.ts +0 -1
- package/lib/types/services/PlatformResponse.d.ts +2 -3
- package/package.json +16 -16
|
@@ -2,8 +2,6 @@ import { InjectorService, TokenProvider } from "@tsed/di";
|
|
|
2
2
|
import { PlatformRouters } from "@tsed/platform-router";
|
|
3
3
|
import { Route, RouteController } from "../interfaces/Route";
|
|
4
4
|
import { PlatformApplication } from "./PlatformApplication";
|
|
5
|
-
import { PlatformHandler } from "./PlatformHandler";
|
|
6
|
-
import { PlatformMiddlewaresChain } from "./PlatformMiddlewaresChain";
|
|
7
5
|
/**
|
|
8
6
|
* `Platform` is used to provide all routes collected by annotation `@Controller`.
|
|
9
7
|
*
|
|
@@ -14,9 +12,7 @@ export declare class Platform {
|
|
|
14
12
|
readonly injector: InjectorService;
|
|
15
13
|
readonly platformApplication: PlatformApplication;
|
|
16
14
|
readonly platformRouters: PlatformRouters;
|
|
17
|
-
|
|
18
|
-
readonly platformMiddlewaresChain: PlatformMiddlewaresChain;
|
|
19
|
-
constructor(injector: InjectorService, platformApplication: PlatformApplication, platformRouters: PlatformRouters, platformHandler: PlatformHandler, platformMiddlewaresChain: PlatformMiddlewaresChain);
|
|
15
|
+
constructor(injector: InjectorService, platformApplication: PlatformApplication, platformRouters: PlatformRouters);
|
|
20
16
|
get app(): PlatformApplication<TsED.Application>;
|
|
21
17
|
addRoutes(routes: Route[]): void;
|
|
22
18
|
addRoute(route: string, token: TokenProvider): this;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { Type } from "@tsed/core";
|
|
2
3
|
import { ProviderOpts } from "@tsed/di";
|
|
3
4
|
import { PlatformHandlerMetadata, PlatformLayer } from "@tsed/platform-router";
|
|
5
|
+
import { IncomingMessage, ServerResponse } from "http";
|
|
4
6
|
import { PlatformMulter, PlatformMulterSettings } from "../config/interfaces/PlatformMulterSettings";
|
|
5
7
|
import { PlatformStaticsOptions } from "../config/interfaces/PlatformStaticsSettings";
|
|
6
8
|
export declare abstract class PlatformAdapter<App = TsED.Application> {
|
|
@@ -31,7 +33,7 @@ export declare abstract class PlatformAdapter<App = TsED.Application> {
|
|
|
31
33
|
*/
|
|
32
34
|
abstract app(): {
|
|
33
35
|
app: App;
|
|
34
|
-
callback():
|
|
36
|
+
callback(): (req: IncomingMessage, res: ServerResponse) => void;
|
|
35
37
|
};
|
|
36
38
|
/**
|
|
37
39
|
* Return the statics middlewares
|
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
import { Provider } from "@tsed/di";
|
|
2
|
+
import { PlatformExceptions } from "@tsed/platform-exceptions";
|
|
2
3
|
import { PlatformParams, PlatformParamsCallback } from "@tsed/platform-params";
|
|
3
4
|
import { PlatformResponseFilter } from "@tsed/platform-response-filter";
|
|
4
|
-
import {
|
|
5
|
+
import { PlatformHandlerMetadata, PlatformRouters } from "@tsed/platform-router";
|
|
5
6
|
import { PlatformContext } from "../domain/PlatformContext";
|
|
7
|
+
import { PlatformApplication } from "./PlatformApplication";
|
|
8
|
+
import { PlatformMiddlewaresChain } from "./PlatformMiddlewaresChain";
|
|
6
9
|
/**
|
|
7
10
|
* Platform Handler abstraction layer. Wrap original class method to a pure platform handler (Express, Koa, etc...).
|
|
8
11
|
* @platform
|
|
9
12
|
*/
|
|
10
13
|
export declare class PlatformHandler {
|
|
11
|
-
protected responseFilter: PlatformResponseFilter;
|
|
12
14
|
protected platformRouters: PlatformRouters;
|
|
15
|
+
protected responseFilter: PlatformResponseFilter;
|
|
13
16
|
protected platformParams: PlatformParams;
|
|
14
|
-
|
|
17
|
+
protected platformExceptions: PlatformExceptions;
|
|
18
|
+
protected platformApplication: PlatformApplication;
|
|
19
|
+
protected platformMiddlewaresChain: PlatformMiddlewaresChain;
|
|
20
|
+
constructor(platformRouters: PlatformRouters);
|
|
21
|
+
createHandler(handlerMetadata: PlatformHandlerMetadata): any;
|
|
15
22
|
/**
|
|
16
23
|
* @param provider
|
|
17
24
|
* @param propertyKey
|
|
@@ -22,23 +29,14 @@ export declare class PlatformHandler {
|
|
|
22
29
|
* @protected
|
|
23
30
|
* @param $ctx
|
|
24
31
|
*/
|
|
25
|
-
flush($ctx: PlatformContext): Promise<
|
|
26
|
-
setResponseHeaders($ctx: PlatformContext): void;
|
|
32
|
+
flush($ctx: PlatformContext): Promise<void>;
|
|
27
33
|
/**
|
|
28
|
-
* @param error
|
|
29
|
-
* @param next
|
|
30
34
|
* @param $ctx
|
|
31
35
|
*/
|
|
32
|
-
next(
|
|
36
|
+
next($ctx: PlatformContext): any;
|
|
33
37
|
/**
|
|
34
38
|
* Call handler when a request his handle
|
|
35
39
|
*/
|
|
36
40
|
onRequest(handler: PlatformParamsCallback, $ctx: PlatformContext): Promise<any>;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Manage success scenario
|
|
40
|
-
* @param $ctx
|
|
41
|
-
* @protected
|
|
42
|
-
*/
|
|
43
|
-
protected onSuccess($ctx: PlatformContext): Promise<any>;
|
|
41
|
+
onFinish($ctx: PlatformContext): Promise<unknown>;
|
|
44
42
|
}
|
|
@@ -99,7 +99,6 @@ export declare class PlatformRequest<Req extends {
|
|
|
99
99
|
accepts(mime: string): string | false;
|
|
100
100
|
accepts(mime: string[]): string[] | false;
|
|
101
101
|
isAborted(): any;
|
|
102
|
-
destroy(): void;
|
|
103
102
|
/**
|
|
104
103
|
* Return the Framework response object (express, koa, etc...)
|
|
105
104
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { OutgoingHttpHeaders, ServerResponse } from "http";
|
|
3
3
|
import type { PlatformContext } from "../domain/PlatformContext";
|
|
4
|
-
import { PlatformRequest } from "./PlatformRequest";
|
|
4
|
+
import type { PlatformRequest } from "./PlatformRequest";
|
|
5
5
|
declare global {
|
|
6
6
|
namespace TsED {
|
|
7
7
|
interface Response {
|
|
@@ -151,8 +151,7 @@ export declare class PlatformResponse<Res extends Record<string, any> = any> {
|
|
|
151
151
|
* Add a listener to handler the end of the request/response.
|
|
152
152
|
* @param cb
|
|
153
153
|
*/
|
|
154
|
-
onEnd(cb: (
|
|
154
|
+
onEnd(cb: () => Promise<void> | void): this;
|
|
155
155
|
isDone(): boolean;
|
|
156
|
-
destroy(): void;
|
|
157
156
|
isHeadersSent(): boolean;
|
|
158
157
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/common",
|
|
3
|
-
"version": "7.0.0-beta.
|
|
3
|
+
"version": "7.0.0-beta.19",
|
|
4
4
|
"description": "A TypeScript Framework on top of Express",
|
|
5
5
|
"private": false,
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -62,23 +62,23 @@
|
|
|
62
62
|
}
|
|
63
63
|
],
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@tsed/components-scan": "7.0.0-beta.
|
|
66
|
-
"@tsed/core": "7.0.0-beta.
|
|
67
|
-
"@tsed/di": "7.0.0-beta.
|
|
68
|
-
"@tsed/exceptions": "7.0.0-beta.
|
|
69
|
-
"@tsed/json-mapper": "7.0.0-beta.
|
|
65
|
+
"@tsed/components-scan": "7.0.0-beta.19",
|
|
66
|
+
"@tsed/core": "7.0.0-beta.19",
|
|
67
|
+
"@tsed/di": "7.0.0-beta.19",
|
|
68
|
+
"@tsed/exceptions": "7.0.0-beta.19",
|
|
69
|
+
"@tsed/json-mapper": "7.0.0-beta.19",
|
|
70
70
|
"@tsed/logger": ">=6.2.0",
|
|
71
71
|
"@tsed/logger-file": ">=6.2.0",
|
|
72
|
-
"@tsed/perf": "7.0.0-beta.
|
|
73
|
-
"@tsed/platform-cache": "7.0.0-beta.
|
|
74
|
-
"@tsed/platform-exceptions": "7.0.0-beta.
|
|
75
|
-
"@tsed/platform-log-middleware": "7.0.0-beta.
|
|
76
|
-
"@tsed/platform-middlewares": "7.0.0-beta.
|
|
77
|
-
"@tsed/platform-params": "7.0.0-beta.
|
|
78
|
-
"@tsed/platform-response-filter": "7.0.0-beta.
|
|
79
|
-
"@tsed/platform-router": "7.0.0-beta.
|
|
80
|
-
"@tsed/platform-views": "7.0.0-beta.
|
|
81
|
-
"@tsed/schema": "7.0.0-beta.
|
|
72
|
+
"@tsed/perf": "7.0.0-beta.19",
|
|
73
|
+
"@tsed/platform-cache": "7.0.0-beta.19",
|
|
74
|
+
"@tsed/platform-exceptions": "7.0.0-beta.19",
|
|
75
|
+
"@tsed/platform-log-middleware": "7.0.0-beta.19",
|
|
76
|
+
"@tsed/platform-middlewares": "7.0.0-beta.19",
|
|
77
|
+
"@tsed/platform-params": "7.0.0-beta.19",
|
|
78
|
+
"@tsed/platform-response-filter": "7.0.0-beta.19",
|
|
79
|
+
"@tsed/platform-router": "7.0.0-beta.19",
|
|
80
|
+
"@tsed/platform-views": "7.0.0-beta.19",
|
|
81
|
+
"@tsed/schema": "7.0.0-beta.19",
|
|
82
82
|
"@types/json-schema": "7.0.11",
|
|
83
83
|
"@types/on-finished": "2.3.1",
|
|
84
84
|
"on-finished": "2.4.1",
|