@tsed/common 8.0.0-alpha.5 → 8.0.0-alpha.6
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/lib/esm/services/PlatformTest.js.map +1 -1
- package/lib/types/builder/PlatformBuilder.d.ts +1 -1
- package/lib/types/config/services/PlatformConfiguration.d.ts +1 -1
- package/lib/types/domain/PlatformContext.d.ts +1 -1
- package/lib/types/interfaces/IncomingEvent.d.ts +1 -1
- package/lib/types/services/FakeResponse.d.ts +1 -1
- package/lib/types/services/PlatformAdapter.d.ts +1 -1
- package/lib/types/services/PlatformApplication.d.ts +1 -1
- package/lib/types/services/PlatformRequest.d.ts +1 -1
- package/lib/types/services/PlatformResponse.d.ts +2 -2
- package/lib/types/services/PlatformTest.d.ts +1 -1
- package/lib/types/utils/closeServer.d.ts +3 -3
- package/lib/types/utils/createHttpServer.d.ts +1 -1
- package/lib/types/utils/createHttpsServer.d.ts +1 -1
- package/lib/types/utils/createServer.d.ts +3 -3
- package/lib/types/utils/listenServer.d.ts +3 -3
- package/package.json +19 -20
- package/lib/cjs/builder/PlatformBuilder.js +0 -341
- package/lib/cjs/builder/PlatformBuilder.js.map +0 -1
- package/lib/cjs/config/interfaces/PlatformJsonMapperSettings.js +0 -3
- package/lib/cjs/config/interfaces/PlatformJsonMapperSettings.js.map +0 -1
- package/lib/cjs/config/interfaces/PlatformMulterSettings.js +0 -3
- package/lib/cjs/config/interfaces/PlatformMulterSettings.js.map +0 -1
- package/lib/cjs/config/interfaces/PlatformRouterSettings.js +0 -3
- package/lib/cjs/config/interfaces/PlatformRouterSettings.js.map +0 -1
- package/lib/cjs/config/interfaces/PlatformStaticsSettings.js +0 -3
- package/lib/cjs/config/interfaces/PlatformStaticsSettings.js.map +0 -1
- package/lib/cjs/config/services/PlatformConfiguration.js +0 -122
- package/lib/cjs/config/services/PlatformConfiguration.js.map +0 -1
- package/lib/cjs/constants/routerOptions.js +0 -5
- package/lib/cjs/constants/routerOptions.js.map +0 -1
- package/lib/cjs/decorators/PlatformProvider.js +0 -11
- package/lib/cjs/decorators/PlatformProvider.js.map +0 -1
- package/lib/cjs/decorators/multer/multerFileSize.js +0 -35
- package/lib/cjs/decorators/multer/multerFileSize.js.map +0 -1
- package/lib/cjs/decorators/multer/multerOptions.js +0 -52
- package/lib/cjs/decorators/multer/multerOptions.js.map +0 -1
- package/lib/cjs/decorators/multer/multipartFile.js +0 -78
- package/lib/cjs/decorators/multer/multipartFile.js.map +0 -1
- package/lib/cjs/decorators/params/error.js +0 -20
- package/lib/cjs/decorators/params/error.js.map +0 -1
- package/lib/cjs/decorators/params/next.js +0 -21
- package/lib/cjs/decorators/params/next.js.map +0 -1
- package/lib/cjs/decorators/params/request.js +0 -39
- package/lib/cjs/decorators/params/request.js.map +0 -1
- package/lib/cjs/decorators/params/response.js +0 -33
- package/lib/cjs/decorators/params/response.js.map +0 -1
- package/lib/cjs/domain/AnyToPromiseWithCtx.js +0 -25
- package/lib/cjs/domain/AnyToPromiseWithCtx.js.map +0 -1
- package/lib/cjs/domain/EndpointMetadata.js +0 -6
- package/lib/cjs/domain/EndpointMetadata.js.map +0 -1
- package/lib/cjs/domain/PlatformContext.js +0 -73
- package/lib/cjs/domain/PlatformContext.js.map +0 -1
- package/lib/cjs/domain/PlatformRouteDetails.js +0 -3
- package/lib/cjs/domain/PlatformRouteDetails.js.map +0 -1
- package/lib/cjs/exports.js +0 -30
- package/lib/cjs/exports.js.map +0 -1
- package/lib/cjs/index.js +0 -67
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/interfaces/AfterInit.js +0 -3
- package/lib/cjs/interfaces/AfterInit.js.map +0 -1
- package/lib/cjs/interfaces/AfterListen.js +0 -3
- package/lib/cjs/interfaces/AfterListen.js.map +0 -1
- package/lib/cjs/interfaces/AfterRoutesInit.js +0 -3
- package/lib/cjs/interfaces/AfterRoutesInit.js.map +0 -1
- package/lib/cjs/interfaces/BeforeInit.js +0 -3
- package/lib/cjs/interfaces/BeforeInit.js.map +0 -1
- package/lib/cjs/interfaces/BeforeListen.js +0 -3
- package/lib/cjs/interfaces/BeforeListen.js.map +0 -1
- package/lib/cjs/interfaces/BeforeRoutesInit.js +0 -3
- package/lib/cjs/interfaces/BeforeRoutesInit.js.map +0 -1
- package/lib/cjs/interfaces/HandlerType.js +0 -17
- package/lib/cjs/interfaces/HandlerType.js.map +0 -1
- package/lib/cjs/interfaces/IncomingEvent.js +0 -3
- package/lib/cjs/interfaces/IncomingEvent.js.map +0 -1
- package/lib/cjs/interfaces/OnReady.js +0 -3
- package/lib/cjs/interfaces/OnReady.js.map +0 -1
- package/lib/cjs/interfaces/OnRequest.js +0 -3
- package/lib/cjs/interfaces/OnRequest.js.map +0 -1
- package/lib/cjs/interfaces/OnResponse.js +0 -3
- package/lib/cjs/interfaces/OnResponse.js.map +0 -1
- package/lib/cjs/interfaces/OnRoutesInit.js +0 -3
- package/lib/cjs/interfaces/OnRoutesInit.js.map +0 -1
- package/lib/cjs/interfaces/PlatformRouteOptions.js +0 -3
- package/lib/cjs/interfaces/PlatformRouteOptions.js.map +0 -1
- package/lib/cjs/interfaces/ResponseErrorObject.js +0 -3
- package/lib/cjs/interfaces/ResponseErrorObject.js.map +0 -1
- package/lib/cjs/interfaces/Route.js +0 -3
- package/lib/cjs/interfaces/Route.js.map +0 -1
- package/lib/cjs/middlewares/PlatformAcceptMimesMiddleware.js +0 -39
- package/lib/cjs/middlewares/PlatformAcceptMimesMiddleware.js.map +0 -1
- package/lib/cjs/middlewares/PlatformMulterMiddleware.js +0 -70
- package/lib/cjs/middlewares/PlatformMulterMiddleware.js.map +0 -1
- package/lib/cjs/package.json +0 -3
- package/lib/cjs/services/FakeAdapter.js +0 -6
- package/lib/cjs/services/FakeAdapter.js.map +0 -1
- package/lib/cjs/services/FakeResponse.js +0 -59
- package/lib/cjs/services/FakeResponse.js.map +0 -1
- package/lib/cjs/services/Platform.js +0 -76
- package/lib/cjs/services/Platform.js.map +0 -1
- package/lib/cjs/services/PlatformAdapter.js +0 -82
- package/lib/cjs/services/PlatformAdapter.js.map +0 -1
- package/lib/cjs/services/PlatformApplication.js +0 -44
- package/lib/cjs/services/PlatformApplication.js.map +0 -1
- package/lib/cjs/services/PlatformHandler.js +0 -133
- package/lib/cjs/services/PlatformHandler.js.map +0 -1
- package/lib/cjs/services/PlatformMiddlewaresChain.js +0 -60
- package/lib/cjs/services/PlatformMiddlewaresChain.js.map +0 -1
- package/lib/cjs/services/PlatformRequest.js +0 -144
- package/lib/cjs/services/PlatformRequest.js.map +0 -1
- package/lib/cjs/services/PlatformResponse.js +0 -309
- package/lib/cjs/services/PlatformResponse.js.map +0 -1
- package/lib/cjs/services/PlatformTest.js +0 -142
- package/lib/cjs/services/PlatformTest.js.map +0 -1
- package/lib/cjs/utils/closeServer.js +0 -8
- package/lib/cjs/utils/closeServer.js.map +0 -1
- package/lib/cjs/utils/createContext.js +0 -49
- package/lib/cjs/utils/createContext.js.map +0 -1
- package/lib/cjs/utils/createHttpServer.js +0 -18
- package/lib/cjs/utils/createHttpServer.js.map +0 -1
- package/lib/cjs/utils/createHttpsServer.js +0 -18
- package/lib/cjs/utils/createHttpsServer.js.map +0 -1
- package/lib/cjs/utils/createInjector.js +0 -45
- package/lib/cjs/utils/createInjector.js.map +0 -1
- package/lib/cjs/utils/createServer.js +0 -33
- package/lib/cjs/utils/createServer.js.map +0 -1
- package/lib/cjs/utils/ensureContext.js +0 -16
- package/lib/cjs/utils/ensureContext.js.map +0 -1
- package/lib/cjs/utils/getConfiguration.js +0 -36
- package/lib/cjs/utils/getConfiguration.js.map +0 -1
- package/lib/cjs/utils/getStaticsOptions.js +0 -21
- package/lib/cjs/utils/getStaticsOptions.js.map +0 -1
- package/lib/cjs/utils/listenServer.js +0 -14
- package/lib/cjs/utils/listenServer.js.map +0 -1
- package/lib/cjs/utils/mapReturnedResponse.js +0 -15
- package/lib/cjs/utils/mapReturnedResponse.js.map +0 -1
- package/lib/cjs/utils/printRoutes.js +0 -38
- package/lib/cjs/utils/printRoutes.js.map +0 -1
- package/lib/cjs/utils/registerPlatformAdapter.js +0 -11
- package/lib/cjs/utils/registerPlatformAdapter.js.map +0 -1
- package/lib/cjs/utils/setResponseHeaders.js +0 -29
- package/lib/cjs/utils/setResponseHeaders.js.map +0 -1
- package/lib/esm/package.json +0 -3
- package/lib/types-esm/builder/PlatformBuilder.d.ts +0 -100
- package/lib/types-esm/config/interfaces/PlatformJsonMapperSettings.d.ts +0 -10
- package/lib/types-esm/config/interfaces/PlatformMulterSettings.d.ts +0 -14
- package/lib/types-esm/config/interfaces/PlatformRouterSettings.d.ts +0 -10
- package/lib/types-esm/config/interfaces/PlatformStaticsSettings.d.ts +0 -17
- package/lib/types-esm/config/services/PlatformConfiguration.d.ts +0 -67
- package/lib/types-esm/constants/routerOptions.d.ts +0 -1
- package/lib/types-esm/decorators/PlatformProvider.d.ts +0 -3
- package/lib/types-esm/decorators/multer/multerFileSize.d.ts +0 -27
- package/lib/types-esm/decorators/multer/multerOptions.d.ts +0 -41
- package/lib/types-esm/decorators/multer/multipartFile.d.ts +0 -47
- package/lib/types-esm/decorators/params/error.d.ts +0 -7
- package/lib/types-esm/decorators/params/next.d.ts +0 -22
- package/lib/types-esm/decorators/params/request.d.ts +0 -46
- package/lib/types-esm/decorators/params/response.d.ts +0 -40
- package/lib/types-esm/domain/AnyToPromiseWithCtx.d.ts +0 -10
- package/lib/types-esm/domain/EndpointMetadata.d.ts +0 -1
- package/lib/types-esm/domain/PlatformContext.d.ts +0 -80
- package/lib/types-esm/domain/PlatformRouteDetails.d.ts +0 -7
- package/lib/types-esm/exports.d.ts +0 -11
- package/lib/types-esm/index.d.ts +0 -63
- package/lib/types-esm/interfaces/AfterInit.d.ts +0 -3
- package/lib/types-esm/interfaces/AfterListen.d.ts +0 -3
- package/lib/types-esm/interfaces/AfterRoutesInit.d.ts +0 -3
- package/lib/types-esm/interfaces/BeforeInit.d.ts +0 -3
- package/lib/types-esm/interfaces/BeforeListen.d.ts +0 -3
- package/lib/types-esm/interfaces/BeforeRoutesInit.d.ts +0 -3
- package/lib/types-esm/interfaces/HandlerType.d.ts +0 -12
- package/lib/types-esm/interfaces/IncomingEvent.d.ts +0 -6
- package/lib/types-esm/interfaces/OnReady.d.ts +0 -3
- package/lib/types-esm/interfaces/OnRequest.d.ts +0 -4
- package/lib/types-esm/interfaces/OnResponse.d.ts +0 -4
- package/lib/types-esm/interfaces/OnRoutesInit.d.ts +0 -3
- package/lib/types-esm/interfaces/PlatformRouteOptions.d.ts +0 -15
- package/lib/types-esm/interfaces/ResponseErrorObject.d.ts +0 -8
- package/lib/types-esm/interfaces/Route.d.ts +0 -10
- package/lib/types-esm/middlewares/PlatformAcceptMimesMiddleware.d.ts +0 -10
- package/lib/types-esm/middlewares/PlatformMulterMiddleware.d.ts +0 -24
- package/lib/types-esm/services/FakeAdapter.d.ts +0 -1
- package/lib/types-esm/services/FakeResponse.d.ts +0 -22
- package/lib/types-esm/services/Platform.d.ts +0 -25
- package/lib/types-esm/services/PlatformAdapter.d.ts +0 -89
- package/lib/types-esm/services/PlatformApplication.d.ts +0 -29
- package/lib/types-esm/services/PlatformHandler.d.ts +0 -39
- package/lib/types-esm/services/PlatformMiddlewaresChain.d.ts +0 -17
- package/lib/types-esm/services/PlatformRequest.d.ts +0 -111
- package/lib/types-esm/services/PlatformResponse.d.ts +0 -174
- package/lib/types-esm/services/PlatformTest.d.ts +0 -60
- package/lib/types-esm/utils/closeServer.d.ts +0 -7
- package/lib/types-esm/utils/createContext.d.ts +0 -10
- package/lib/types-esm/utils/createHttpServer.d.ts +0 -4
- package/lib/types-esm/utils/createHttpsServer.d.ts +0 -4
- package/lib/types-esm/utils/createInjector.d.ts +0 -9
- package/lib/types-esm/utils/createServer.d.ts +0 -17
- package/lib/types-esm/utils/ensureContext.d.ts +0 -2
- package/lib/types-esm/utils/getConfiguration.d.ts +0 -2
- package/lib/types-esm/utils/getStaticsOptions.d.ts +0 -5
- package/lib/types-esm/utils/listenServer.d.ts +0 -8
- package/lib/types-esm/utils/mapReturnedResponse.d.ts +0 -4
- package/lib/types-esm/utils/printRoutes.d.ts +0 -2
- package/lib/types-esm/utils/registerPlatformAdapter.d.ts +0 -3
- package/lib/types-esm/utils/setResponseHeaders.d.ts +0 -5
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Type } from "@tsed/core";
|
|
3
|
-
import { DITest, InjectorService } from "@tsed/di";
|
|
4
|
-
import type { IncomingMessage, RequestListener, ServerResponse } from "http";
|
|
5
|
-
import { PlatformContext, PlatformContextOptions } from "../domain/PlatformContext.js";
|
|
6
|
-
import { PlatformAdapter, PlatformBuilderSettings } from "./PlatformAdapter.js";
|
|
7
|
-
/**
|
|
8
|
-
* @platform
|
|
9
|
-
*/
|
|
10
|
-
export declare class PlatformTest extends DITest {
|
|
11
|
-
static adapter: Type<PlatformAdapter>;
|
|
12
|
-
static create(settings?: Partial<TsED.Configuration>): Promise<void>;
|
|
13
|
-
/**
|
|
14
|
-
* Create a new injector with the right default services
|
|
15
|
-
*/
|
|
16
|
-
static createInjector(settings?: any): InjectorService;
|
|
17
|
-
/**
|
|
18
|
-
* Load the server silently without listening port and configure it on test profile.
|
|
19
|
-
* @decorator
|
|
20
|
-
* @param mod
|
|
21
|
-
* @param listen
|
|
22
|
-
* @param settings
|
|
23
|
-
* @returns {Promise<void>}
|
|
24
|
-
*/
|
|
25
|
-
static bootstrap(mod: any, { listen, ...settings }?: Partial<PlatformBuilderSettings & {
|
|
26
|
-
listen: boolean;
|
|
27
|
-
}>): () => Promise<void>;
|
|
28
|
-
/**
|
|
29
|
-
* It injects services into the test function where you can alter, spy on, and manipulate them.
|
|
30
|
-
*
|
|
31
|
-
* The inject function has two parameters
|
|
32
|
-
*
|
|
33
|
-
* * an array of Service dependency injection tokens,
|
|
34
|
-
* * a test function whose parameters correspond exactly to each item in the injection token array.
|
|
35
|
-
*
|
|
36
|
-
* @param targets
|
|
37
|
-
* @param func
|
|
38
|
-
*/
|
|
39
|
-
static inject<T>(targets: any[], func: (...args: any[]) => Promise<T> | T): () => Promise<T>;
|
|
40
|
-
/**
|
|
41
|
-
* Return the raw application (express or koa).
|
|
42
|
-
* Use this callback with SuperTest.
|
|
43
|
-
*
|
|
44
|
-
* ```typescript
|
|
45
|
-
* let request: SuperTest.Agent;
|
|
46
|
-
* beforeEach(PlatformTest.bootstrap(Server, {
|
|
47
|
-
* mount: {
|
|
48
|
-
* "/rest": [ProductsController]
|
|
49
|
-
* }
|
|
50
|
-
* }));
|
|
51
|
-
* beforeEach(() => {
|
|
52
|
-
* request = SuperTest(PlatformTest.callback());
|
|
53
|
-
* });
|
|
54
|
-
* ```
|
|
55
|
-
*/
|
|
56
|
-
static callback(): RequestListener<typeof IncomingMessage, typeof ServerResponse>;
|
|
57
|
-
static createRequest(options?: any): any;
|
|
58
|
-
static createResponse(options?: any): any;
|
|
59
|
-
static createRequestContext(options?: Partial<PlatformContextOptions & any>): PlatformContext<import("./PlatformRequest.js").PlatformRequest<any>, import("./PlatformResponse.js").PlatformResponse<any>>;
|
|
60
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
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,10 +0,0 @@
|
|
|
1
|
-
import { InjectorService } from "@tsed/di";
|
|
2
|
-
import { PlatformContext } from "../domain/PlatformContext.js";
|
|
3
|
-
import { IncomingEvent } from "../interfaces/IncomingEvent.js";
|
|
4
|
-
export declare function buildIgnoreLog(ignoreUrlPatterns: any[] | undefined): ((ignore: boolean, data: any, url: string) => any) | undefined;
|
|
5
|
-
/**
|
|
6
|
-
* Create the TsED context to wrap request, response, injector, etc...
|
|
7
|
-
* @param injector
|
|
8
|
-
* @ignore
|
|
9
|
-
*/
|
|
10
|
-
export declare function createContext(injector: InjectorService): (event: IncomingEvent) => PlatformContext;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { InjectorService } from "@tsed/di";
|
|
3
|
-
import Http from "http";
|
|
4
|
-
export declare function createHttpsServer(injector: InjectorService, requestListener?: Http.RequestListener): import("./createServer.js").CreateServerReturn | undefined;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Type } from "@tsed/core";
|
|
2
|
-
import { InjectorService } from "@tsed/di";
|
|
3
|
-
import { PlatformAdapter } from "../services/PlatformAdapter.js";
|
|
4
|
-
interface CreateInjectorOptions {
|
|
5
|
-
adapter?: Type<PlatformAdapter<any>>;
|
|
6
|
-
settings?: Partial<TsED.Configuration>;
|
|
7
|
-
}
|
|
8
|
-
export declare function createInjector({ adapter, settings }: CreateInjectorOptions): InjectorService;
|
|
9
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
/// <reference types="node" />
|
|
4
|
-
import { ReturnHostInfoFromPort } from "@tsed/core";
|
|
5
|
-
import { InjectorService, TokenProvider } from "@tsed/di";
|
|
6
|
-
import Http from "http";
|
|
7
|
-
import Http2 from "http2";
|
|
8
|
-
import Https from "https";
|
|
9
|
-
export interface CreateServerOptions {
|
|
10
|
-
token: TokenProvider;
|
|
11
|
-
type: "http" | "https";
|
|
12
|
-
port: string | false;
|
|
13
|
-
listen?: (hostInfo: ReturnHostInfoFromPort) => Promise<any>;
|
|
14
|
-
server: () => Http.Server | Https.Server | Http2.Http2Server;
|
|
15
|
-
}
|
|
16
|
-
export type CreateServerReturn = () => Promise<Http.Server | Https.Server | Http2.Http2Server>;
|
|
17
|
-
export declare function createServer(injector: InjectorService, { token, type, port, server: get, listen }: CreateServerOptions): undefined | CreateServerReturn;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
/// <reference types="node" />
|
|
4
|
-
import { getHostInfoFromPort } from "@tsed/core";
|
|
5
|
-
import type Http from "http";
|
|
6
|
-
import type Http2 from "http2";
|
|
7
|
-
import type Https from "https";
|
|
8
|
-
export declare function listenServer(server: Http.Server | Https.Server | Http2.Http2Server, hostInfo: ReturnType<typeof getHostInfoFromPort>): Promise<unknown>;
|