@tsed/common 7.53.0 → 7.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/jest.config.js +4 -4
- package/lib/cjs/builder/PlatformBuilder.js +8 -14
- package/lib/cjs/builder/PlatformBuilder.js.map +1 -1
- package/lib/cjs/index.js +2 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/services/FakeAdapter.js +2 -45
- package/lib/cjs/services/FakeAdapter.js.map +1 -1
- package/lib/cjs/services/PlatformAdapter.js +66 -6
- package/lib/cjs/services/PlatformAdapter.js.map +1 -1
- package/lib/cjs/services/PlatformApplication.js +3 -2
- package/lib/cjs/services/PlatformApplication.js.map +1 -1
- package/lib/cjs/utils/closeServer.js +8 -0
- package/lib/cjs/utils/closeServer.js.map +1 -0
- package/lib/cjs/utils/createHttpServer.js +6 -17
- package/lib/cjs/utils/createHttpServer.js.map +1 -1
- package/lib/cjs/utils/createHttpsServer.js +6 -17
- package/lib/cjs/utils/createHttpsServer.js.map +1 -1
- package/lib/cjs/utils/createInjector.js +1 -0
- package/lib/cjs/utils/createInjector.js.map +1 -1
- package/lib/cjs/utils/createServer.js +25 -0
- package/lib/cjs/utils/createServer.js.map +1 -0
- package/lib/esm/builder/PlatformBuilder.js +8 -14
- package/lib/esm/builder/PlatformBuilder.js.map +1 -1
- package/lib/esm/index.js +2 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/services/FakeAdapter.js +1 -44
- package/lib/esm/services/FakeAdapter.js.map +1 -1
- package/lib/esm/services/PlatformAdapter.js +63 -4
- package/lib/esm/services/PlatformAdapter.js.map +1 -1
- package/lib/esm/services/PlatformApplication.js +3 -2
- package/lib/esm/services/PlatformApplication.js.map +1 -1
- package/lib/esm/utils/closeServer.js +4 -0
- package/lib/esm/utils/closeServer.js.map +1 -0
- package/lib/esm/utils/createHttpServer.js +6 -17
- package/lib/esm/utils/createHttpServer.js.map +1 -1
- package/lib/esm/utils/createHttpsServer.js +6 -17
- package/lib/esm/utils/createHttpsServer.js.map +1 -1
- package/lib/esm/utils/createInjector.js +1 -0
- package/lib/esm/utils/createInjector.js.map +1 -1
- package/lib/esm/utils/createServer.js +21 -0
- package/lib/esm/utils/createServer.js.map +1 -0
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/index.d.ts +2 -0
- package/lib/types/services/FakeAdapter.d.ts +1 -31
- package/lib/types/services/PlatformAdapter.d.ts +41 -9
- package/lib/types/utils/closeServer.d.ts +7 -0
- package/lib/types/utils/createHttpServer.d.ts +1 -1
- package/lib/types/utils/createHttpsServer.d.ts +1 -3
- package/lib/types/utils/createServer.d.ts +15 -0
- package/package.json +14 -14
package/lib/types/index.d.ts
CHANGED
|
@@ -47,10 +47,12 @@ export * from "./services/PlatformMiddlewaresChain";
|
|
|
47
47
|
export * from "./services/PlatformRequest";
|
|
48
48
|
export * from "./services/PlatformResponse";
|
|
49
49
|
export * from "./services/PlatformTest";
|
|
50
|
+
export * from "./utils/closeServer";
|
|
50
51
|
export * from "./utils/createContext";
|
|
51
52
|
export * from "./utils/createHttpServer";
|
|
52
53
|
export * from "./utils/createHttpsServer";
|
|
53
54
|
export * from "./utils/createInjector";
|
|
55
|
+
export * from "./utils/createServer";
|
|
54
56
|
export * from "./utils/ensureContext";
|
|
55
57
|
export * from "./utils/getStaticsOptions";
|
|
56
58
|
export * from "./utils/listenServer";
|
|
@@ -1,31 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { PlatformContextHandler, PlatformLayer } from "@tsed/platform-router";
|
|
3
|
-
import { PlatformMulter, PlatformMulterSettings } from "../config/interfaces/PlatformMulterSettings";
|
|
4
|
-
import { PlatformStaticsOptions } from "../config/interfaces/PlatformStaticsSettings";
|
|
5
|
-
import { PlatformContext } from "../domain/PlatformContext";
|
|
6
|
-
import { PlatformAdapter } from "./PlatformAdapter";
|
|
7
|
-
export declare class FakeAdapter implements PlatformAdapter<any> {
|
|
8
|
-
providers: ProviderOpts[];
|
|
9
|
-
static createFakeRawDriver(): {
|
|
10
|
-
(): void;
|
|
11
|
-
use: () => any;
|
|
12
|
-
all: () => any;
|
|
13
|
-
get: () => any;
|
|
14
|
-
patch: () => any;
|
|
15
|
-
post: () => any;
|
|
16
|
-
put: () => any;
|
|
17
|
-
head: () => any;
|
|
18
|
-
delete: () => any;
|
|
19
|
-
options: () => any;
|
|
20
|
-
};
|
|
21
|
-
app(): {
|
|
22
|
-
app: any;
|
|
23
|
-
callback(): any;
|
|
24
|
-
};
|
|
25
|
-
multipart(options: PlatformMulterSettings): PlatformMulter;
|
|
26
|
-
statics(endpoint: string, options: PlatformStaticsOptions): any;
|
|
27
|
-
bodyParser(type: string): any;
|
|
28
|
-
mapLayers(layers: PlatformLayer[]): void;
|
|
29
|
-
mapHandler(handler: PlatformContextHandler<PlatformContext>): PlatformContextHandler<PlatformContext<import("./PlatformRequest").PlatformRequest<any>, import("./PlatformResponse").PlatformResponse<any>>>;
|
|
30
|
-
useContext(): void;
|
|
31
|
-
}
|
|
1
|
+
export { FakeAdapter } from "./PlatformAdapter";
|
|
@@ -1,38 +1,45 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { Type } from "@tsed/core";
|
|
3
|
-
import { ProviderOpts } from "@tsed/di";
|
|
4
|
-
import { PlatformHandlerMetadata, PlatformLayer } from "@tsed/platform-router";
|
|
3
|
+
import { InjectorService, ProviderOpts } from "@tsed/di";
|
|
4
|
+
import { PlatformContextHandler, PlatformHandlerMetadata, PlatformLayer } from "@tsed/platform-router";
|
|
5
5
|
import { IncomingMessage, ServerResponse } from "http";
|
|
6
6
|
import { PlatformMulter, PlatformMulterSettings } from "../config/interfaces/PlatformMulterSettings";
|
|
7
7
|
import { PlatformStaticsOptions } from "../config/interfaces/PlatformStaticsSettings";
|
|
8
|
+
import { PlatformContext } from "../domain/PlatformContext";
|
|
9
|
+
import { CreateServerReturn } from "../utils/createServer";
|
|
10
|
+
import type { PlatformApplication } from "./PlatformApplication";
|
|
8
11
|
export declare abstract class PlatformAdapter<App = TsED.Application> {
|
|
12
|
+
protected injector: InjectorService;
|
|
9
13
|
static readonly NAME: string;
|
|
10
14
|
/**
|
|
11
15
|
* Load providers in top priority
|
|
12
16
|
*/
|
|
13
17
|
providers: ProviderOpts[];
|
|
18
|
+
constructor(injector: InjectorService);
|
|
19
|
+
get app(): PlatformApplication<App>;
|
|
14
20
|
/**
|
|
15
21
|
* Called after the injector instantiation
|
|
16
22
|
*/
|
|
17
|
-
onInit
|
|
18
|
-
beforeLoadRoutes
|
|
19
|
-
afterLoadRoutes
|
|
23
|
+
onInit(): any;
|
|
24
|
+
beforeLoadRoutes(): Promise<any>;
|
|
25
|
+
afterLoadRoutes(): Promise<any>;
|
|
20
26
|
/**
|
|
21
27
|
* create initial context
|
|
22
28
|
*/
|
|
23
|
-
abstract useContext
|
|
29
|
+
abstract useContext(): any;
|
|
24
30
|
/**
|
|
25
31
|
* Map router layer to the targeted framework
|
|
26
32
|
*/
|
|
27
|
-
abstract mapLayers
|
|
33
|
+
abstract mapLayers(layer: PlatformLayer[]): void;
|
|
28
34
|
/**
|
|
29
35
|
* Map handler to the targeted framework
|
|
30
36
|
*/
|
|
31
|
-
abstract mapHandler
|
|
37
|
+
abstract mapHandler(handler: Function, layer: PlatformHandlerMetadata): Function;
|
|
38
|
+
getServers(): CreateServerReturn[];
|
|
32
39
|
/**
|
|
33
40
|
* Return the app instance
|
|
34
41
|
*/
|
|
35
|
-
abstract
|
|
42
|
+
abstract createApp(): {
|
|
36
43
|
app: App;
|
|
37
44
|
callback(): (req: IncomingMessage, res: ServerResponse) => void;
|
|
38
45
|
};
|
|
@@ -57,3 +64,28 @@ export declare abstract class PlatformAdapter<App = TsED.Application> {
|
|
|
57
64
|
export interface PlatformBuilderSettings<App = TsED.Application> extends Partial<TsED.Configuration> {
|
|
58
65
|
adapter?: Type<PlatformAdapter<App>>;
|
|
59
66
|
}
|
|
67
|
+
export declare class FakeAdapter extends PlatformAdapter<any> {
|
|
68
|
+
providers: ProviderOpts[];
|
|
69
|
+
static createFakeRawDriver(): {
|
|
70
|
+
(): void;
|
|
71
|
+
use: () => any;
|
|
72
|
+
all: () => any;
|
|
73
|
+
get: () => any;
|
|
74
|
+
patch: () => any;
|
|
75
|
+
post: () => any;
|
|
76
|
+
put: () => any;
|
|
77
|
+
head: () => any;
|
|
78
|
+
delete: () => any;
|
|
79
|
+
options: () => any;
|
|
80
|
+
};
|
|
81
|
+
createApp(): {
|
|
82
|
+
app: any;
|
|
83
|
+
callback(): any;
|
|
84
|
+
};
|
|
85
|
+
multipart(options: PlatformMulterSettings): PlatformMulter;
|
|
86
|
+
statics(endpoint: string, options: PlatformStaticsOptions): any;
|
|
87
|
+
bodyParser(type: string): any;
|
|
88
|
+
mapLayers(layers: PlatformLayer[]): void;
|
|
89
|
+
mapHandler(handler: PlatformContextHandler<PlatformContext>): PlatformContextHandler<PlatformContext<import("./PlatformRequest").PlatformRequest<any>, import("./PlatformResponse").PlatformResponse<any>>>;
|
|
90
|
+
useContext(): void;
|
|
91
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
/// <reference types="node" />
|
|
4
|
+
import type Http from "http";
|
|
5
|
+
import type Http2 from "http2";
|
|
6
|
+
import type Https from "https";
|
|
7
|
+
export declare function closeServer(server: Http.Server | Https.Server | Http2.Http2Server): Promise<unknown>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { InjectorService } from "@tsed/di";
|
|
3
3
|
import Http from "http";
|
|
4
|
-
export declare function createHttpServer(injector: InjectorService, requestListener: Http.RequestListener): (
|
|
4
|
+
export declare function createHttpServer(injector: InjectorService, requestListener: Http.RequestListener): import("./createServer").CreateServerReturn | undefined;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
2
|
import { InjectorService } from "@tsed/di";
|
|
4
|
-
import Https from "https";
|
|
5
3
|
import Http from "http";
|
|
6
|
-
export declare function createHttpsServer(injector: InjectorService, requestListener?: Http.RequestListener): (
|
|
4
|
+
export declare function createHttpsServer(injector: InjectorService, requestListener?: Http.RequestListener): import("./createServer").CreateServerReturn | undefined;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
/// <reference types="node" />
|
|
4
|
+
import { InjectorService, TokenProvider } from "@tsed/di";
|
|
5
|
+
import Http from "http";
|
|
6
|
+
import Http2 from "http2";
|
|
7
|
+
import Https from "https";
|
|
8
|
+
export interface CreateServerOptions {
|
|
9
|
+
token: TokenProvider;
|
|
10
|
+
type: "http" | "https";
|
|
11
|
+
port: string | false;
|
|
12
|
+
server: () => Http.Server | Https.Server | Http2.Http2Server;
|
|
13
|
+
}
|
|
14
|
+
export type CreateServerReturn = () => Promise<Http.Server | Https.Server | Http2.Http2Server>;
|
|
15
|
+
export declare function createServer(injector: InjectorService, { token, type, port, server: get }: CreateServerOptions): undefined | CreateServerReturn;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/common",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.55.0",
|
|
4
4
|
"description": "A TypeScript Framework on top of Express",
|
|
5
5
|
"private": false,
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -63,27 +63,27 @@
|
|
|
63
63
|
}
|
|
64
64
|
],
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@tsed/core": "7.
|
|
67
|
-
"@tsed/di": "7.
|
|
68
|
-
"@tsed/exceptions": "7.
|
|
69
|
-
"@tsed/json-mapper": "7.
|
|
66
|
+
"@tsed/core": "7.55.0",
|
|
67
|
+
"@tsed/di": "7.55.0",
|
|
68
|
+
"@tsed/exceptions": "7.55.0",
|
|
69
|
+
"@tsed/json-mapper": "7.55.0",
|
|
70
70
|
"@tsed/logger": ">=6.2.2",
|
|
71
71
|
"@tsed/logger-file": ">=6.2.2",
|
|
72
|
-
"@tsed/platform-exceptions": "7.
|
|
73
|
-
"@tsed/platform-log-middleware": "7.
|
|
74
|
-
"@tsed/platform-middlewares": "7.
|
|
75
|
-
"@tsed/platform-params": "7.
|
|
76
|
-
"@tsed/platform-response-filter": "7.
|
|
77
|
-
"@tsed/platform-router": "7.
|
|
78
|
-
"@tsed/platform-views": "7.
|
|
79
|
-
"@tsed/schema": "7.
|
|
72
|
+
"@tsed/platform-exceptions": "7.55.0",
|
|
73
|
+
"@tsed/platform-log-middleware": "7.55.0",
|
|
74
|
+
"@tsed/platform-middlewares": "7.55.0",
|
|
75
|
+
"@tsed/platform-params": "7.55.0",
|
|
76
|
+
"@tsed/platform-response-filter": "7.55.0",
|
|
77
|
+
"@tsed/platform-router": "7.55.0",
|
|
78
|
+
"@tsed/platform-views": "7.55.0",
|
|
79
|
+
"@tsed/schema": "7.55.0",
|
|
80
80
|
"@types/json-schema": "7.0.11",
|
|
81
81
|
"accepts": "^1.3.8",
|
|
82
82
|
"tslib": "2.5.0",
|
|
83
83
|
"uuid": "8.3.2"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
|
-
"@tsed/components-scan": "7.
|
|
86
|
+
"@tsed/components-scan": "7.55.0",
|
|
87
87
|
"@tsed/eslint": "7.44.1",
|
|
88
88
|
"@tsed/typescript": "7.44.1",
|
|
89
89
|
"eslint": "^8.12.0"
|