@tsed/common 8.0.0-beta.2 → 8.0.0-beta.4
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/index.js +10 -63
- package/lib/esm/index.js.map +1 -1
- package/lib/types/index.d.ts +10 -63
- package/package.json +11 -32
- package/vitest.config.mts +5 -5
- package/.barrelsby.json +0 -5
- package/lib/esm/builder/PlatformBuilder.js +0 -308
- package/lib/esm/builder/PlatformBuilder.js.map +0 -1
- package/lib/esm/config/interfaces/PlatformJsonMapperSettings.js +0 -2
- package/lib/esm/config/interfaces/PlatformJsonMapperSettings.js.map +0 -1
- package/lib/esm/config/interfaces/PlatformMulterSettings.js +0 -2
- package/lib/esm/config/interfaces/PlatformMulterSettings.js.map +0 -1
- package/lib/esm/config/interfaces/PlatformRouterSettings.js +0 -2
- package/lib/esm/config/interfaces/PlatformRouterSettings.js.map +0 -1
- package/lib/esm/config/interfaces/PlatformStaticsSettings.js +0 -2
- package/lib/esm/config/interfaces/PlatformStaticsSettings.js.map +0 -1
- package/lib/esm/config/services/PlatformConfiguration.js +0 -119
- package/lib/esm/config/services/PlatformConfiguration.js.map +0 -1
- package/lib/esm/constants/routerOptions.js +0 -2
- package/lib/esm/constants/routerOptions.js.map +0 -1
- package/lib/esm/decorators/PlatformProvider.js +0 -7
- package/lib/esm/decorators/PlatformProvider.js.map +0 -1
- package/lib/esm/decorators/multer/multerFileSize.js +0 -31
- package/lib/esm/decorators/multer/multerFileSize.js.map +0 -1
- package/lib/esm/decorators/multer/multerOptions.js +0 -49
- package/lib/esm/decorators/multer/multerOptions.js.map +0 -1
- package/lib/esm/decorators/multer/multipartFile.js +0 -74
- package/lib/esm/decorators/multer/multipartFile.js.map +0 -1
- package/lib/esm/decorators/params/error.js +0 -16
- package/lib/esm/decorators/params/error.js.map +0 -1
- package/lib/esm/decorators/params/next.js +0 -17
- package/lib/esm/decorators/params/next.js.map +0 -1
- package/lib/esm/decorators/params/request.js +0 -34
- package/lib/esm/decorators/params/request.js.map +0 -1
- package/lib/esm/decorators/params/response.js +0 -28
- package/lib/esm/decorators/params/response.js.map +0 -1
- package/lib/esm/domain/AnyToPromiseWithCtx.js +0 -21
- package/lib/esm/domain/AnyToPromiseWithCtx.js.map +0 -1
- package/lib/esm/domain/EndpointMetadata.js +0 -2
- package/lib/esm/domain/EndpointMetadata.js.map +0 -1
- package/lib/esm/domain/PlatformContext.js +0 -69
- package/lib/esm/domain/PlatformContext.js.map +0 -1
- package/lib/esm/domain/PlatformRouteDetails.js +0 -2
- package/lib/esm/domain/PlatformRouteDetails.js.map +0 -1
- package/lib/esm/exports.js +0 -10
- package/lib/esm/exports.js.map +0 -1
- package/lib/esm/interfaces/AfterInit.js +0 -2
- package/lib/esm/interfaces/AfterInit.js.map +0 -1
- package/lib/esm/interfaces/AfterListen.js +0 -2
- package/lib/esm/interfaces/AfterListen.js.map +0 -1
- package/lib/esm/interfaces/AfterRoutesInit.js +0 -2
- package/lib/esm/interfaces/AfterRoutesInit.js.map +0 -1
- package/lib/esm/interfaces/BeforeInit.js +0 -2
- package/lib/esm/interfaces/BeforeInit.js.map +0 -1
- package/lib/esm/interfaces/BeforeListen.js +0 -2
- package/lib/esm/interfaces/BeforeListen.js.map +0 -1
- package/lib/esm/interfaces/BeforeRoutesInit.js +0 -2
- package/lib/esm/interfaces/BeforeRoutesInit.js.map +0 -1
- package/lib/esm/interfaces/HandlerType.js +0 -14
- package/lib/esm/interfaces/HandlerType.js.map +0 -1
- package/lib/esm/interfaces/IncomingEvent.js +0 -2
- package/lib/esm/interfaces/IncomingEvent.js.map +0 -1
- package/lib/esm/interfaces/OnReady.js +0 -2
- package/lib/esm/interfaces/OnReady.js.map +0 -1
- package/lib/esm/interfaces/OnRequest.js +0 -2
- package/lib/esm/interfaces/OnRequest.js.map +0 -1
- package/lib/esm/interfaces/OnResponse.js +0 -2
- package/lib/esm/interfaces/OnResponse.js.map +0 -1
- package/lib/esm/interfaces/OnRoutesInit.js +0 -2
- package/lib/esm/interfaces/OnRoutesInit.js.map +0 -1
- package/lib/esm/interfaces/PlatformRouteOptions.js +0 -2
- package/lib/esm/interfaces/PlatformRouteOptions.js.map +0 -1
- package/lib/esm/interfaces/ResponseErrorObject.js +0 -2
- package/lib/esm/interfaces/ResponseErrorObject.js.map +0 -1
- package/lib/esm/interfaces/Route.js +0 -2
- package/lib/esm/interfaces/Route.js.map +0 -1
- package/lib/esm/middlewares/PlatformAcceptMimesMiddleware.js +0 -36
- package/lib/esm/middlewares/PlatformAcceptMimesMiddleware.js.map +0 -1
- package/lib/esm/middlewares/PlatformMulterMiddleware.js +0 -66
- package/lib/esm/middlewares/PlatformMulterMiddleware.js.map +0 -1
- package/lib/esm/services/FakeAdapter.js +0 -2
- package/lib/esm/services/FakeAdapter.js.map +0 -1
- package/lib/esm/services/FakeResponse.js +0 -55
- package/lib/esm/services/FakeResponse.js.map +0 -1
- package/lib/esm/services/Platform.js +0 -73
- package/lib/esm/services/Platform.js.map +0 -1
- package/lib/esm/services/PlatformAdapter.js +0 -77
- package/lib/esm/services/PlatformAdapter.js.map +0 -1
- package/lib/esm/services/PlatformApplication.js +0 -41
- package/lib/esm/services/PlatformApplication.js.map +0 -1
- package/lib/esm/services/PlatformHandler.js +0 -130
- package/lib/esm/services/PlatformHandler.js.map +0 -1
- package/lib/esm/services/PlatformMiddlewaresChain.js +0 -57
- package/lib/esm/services/PlatformMiddlewaresChain.js.map +0 -1
- package/lib/esm/services/PlatformRequest.js +0 -141
- package/lib/esm/services/PlatformRequest.js.map +0 -1
- package/lib/esm/services/PlatformResponse.js +0 -306
- package/lib/esm/services/PlatformResponse.js.map +0 -1
- package/lib/esm/services/PlatformTest.js +0 -131
- package/lib/esm/services/PlatformTest.js.map +0 -1
- package/lib/esm/utils/closeServer.js +0 -4
- package/lib/esm/utils/closeServer.js.map +0 -1
- package/lib/esm/utils/createContext.js +0 -44
- package/lib/esm/utils/createContext.js.map +0 -1
- package/lib/esm/utils/createHttpServer.js +0 -13
- package/lib/esm/utils/createHttpServer.js.map +0 -1
- package/lib/esm/utils/createHttpsServer.js +0 -13
- package/lib/esm/utils/createHttpsServer.js.map +0 -1
- package/lib/esm/utils/createInjector.js +0 -41
- package/lib/esm/utils/createInjector.js.map +0 -1
- package/lib/esm/utils/createServer.js +0 -29
- package/lib/esm/utils/createServer.js.map +0 -1
- package/lib/esm/utils/ensureContext.js +0 -12
- package/lib/esm/utils/ensureContext.js.map +0 -1
- package/lib/esm/utils/getConfiguration.js +0 -32
- package/lib/esm/utils/getConfiguration.js.map +0 -1
- package/lib/esm/utils/getStaticsOptions.js +0 -17
- package/lib/esm/utils/getStaticsOptions.js.map +0 -1
- package/lib/esm/utils/listenServer.js +0 -10
- package/lib/esm/utils/listenServer.js.map +0 -1
- package/lib/esm/utils/mapReturnedResponse.js +0 -11
- package/lib/esm/utils/mapReturnedResponse.js.map +0 -1
- package/lib/esm/utils/printRoutes.js +0 -34
- package/lib/esm/utils/printRoutes.js.map +0 -1
- package/lib/esm/utils/registerPlatformAdapter.js +0 -7
- package/lib/esm/utils/registerPlatformAdapter.js.map +0 -1
- package/lib/esm/utils/setResponseHeaders.js +0 -25
- package/lib/esm/utils/setResponseHeaders.js.map +0 -1
- package/lib/types/builder/PlatformBuilder.d.ts +0 -100
- package/lib/types/config/interfaces/PlatformJsonMapperSettings.d.ts +0 -10
- package/lib/types/config/interfaces/PlatformMulterSettings.d.ts +0 -14
- package/lib/types/config/interfaces/PlatformRouterSettings.d.ts +0 -10
- package/lib/types/config/interfaces/PlatformStaticsSettings.d.ts +0 -17
- package/lib/types/config/services/PlatformConfiguration.d.ts +0 -67
- package/lib/types/constants/routerOptions.d.ts +0 -1
- package/lib/types/decorators/PlatformProvider.d.ts +0 -3
- package/lib/types/decorators/multer/multerFileSize.d.ts +0 -27
- package/lib/types/decorators/multer/multerOptions.d.ts +0 -42
- package/lib/types/decorators/multer/multipartFile.d.ts +0 -47
- package/lib/types/decorators/params/error.d.ts +0 -7
- package/lib/types/decorators/params/next.d.ts +0 -22
- package/lib/types/decorators/params/request.d.ts +0 -46
- package/lib/types/decorators/params/response.d.ts +0 -40
- package/lib/types/domain/AnyToPromiseWithCtx.d.ts +0 -10
- package/lib/types/domain/EndpointMetadata.d.ts +0 -1
- package/lib/types/domain/PlatformContext.d.ts +0 -80
- package/lib/types/domain/PlatformRouteDetails.d.ts +0 -7
- package/lib/types/exports.d.ts +0 -9
- package/lib/types/interfaces/AfterInit.d.ts +0 -3
- package/lib/types/interfaces/AfterListen.d.ts +0 -3
- package/lib/types/interfaces/AfterRoutesInit.d.ts +0 -3
- package/lib/types/interfaces/BeforeInit.d.ts +0 -3
- package/lib/types/interfaces/BeforeListen.d.ts +0 -3
- package/lib/types/interfaces/BeforeRoutesInit.d.ts +0 -3
- package/lib/types/interfaces/HandlerType.d.ts +0 -12
- package/lib/types/interfaces/IncomingEvent.d.ts +0 -6
- package/lib/types/interfaces/OnReady.d.ts +0 -3
- package/lib/types/interfaces/OnRequest.d.ts +0 -4
- package/lib/types/interfaces/OnResponse.d.ts +0 -4
- package/lib/types/interfaces/OnRoutesInit.d.ts +0 -3
- package/lib/types/interfaces/PlatformRouteOptions.d.ts +0 -15
- package/lib/types/interfaces/ResponseErrorObject.d.ts +0 -8
- package/lib/types/interfaces/Route.d.ts +0 -10
- package/lib/types/middlewares/PlatformAcceptMimesMiddleware.d.ts +0 -10
- package/lib/types/middlewares/PlatformMulterMiddleware.d.ts +0 -24
- package/lib/types/services/FakeAdapter.d.ts +0 -1
- package/lib/types/services/FakeResponse.d.ts +0 -22
- package/lib/types/services/Platform.d.ts +0 -25
- package/lib/types/services/PlatformAdapter.d.ts +0 -89
- package/lib/types/services/PlatformApplication.d.ts +0 -29
- package/lib/types/services/PlatformHandler.d.ts +0 -39
- package/lib/types/services/PlatformMiddlewaresChain.d.ts +0 -17
- package/lib/types/services/PlatformRequest.d.ts +0 -111
- package/lib/types/services/PlatformResponse.d.ts +0 -175
- package/lib/types/services/PlatformTest.d.ts +0 -61
- package/lib/types/utils/closeServer.d.ts +0 -7
- package/lib/types/utils/createContext.d.ts +0 -10
- package/lib/types/utils/createHttpServer.d.ts +0 -4
- package/lib/types/utils/createHttpsServer.d.ts +0 -4
- package/lib/types/utils/createInjector.d.ts +0 -8
- package/lib/types/utils/createServer.d.ts +0 -17
- package/lib/types/utils/ensureContext.d.ts +0 -2
- package/lib/types/utils/getConfiguration.d.ts +0 -2
- package/lib/types/utils/getStaticsOptions.d.ts +0 -5
- package/lib/types/utils/listenServer.d.ts +0 -8
- package/lib/types/utils/mapReturnedResponse.d.ts +0 -4
- package/lib/types/utils/printRoutes.d.ts +0 -2
- package/lib/types/utils/registerPlatformAdapter.d.ts +0 -3
- package/lib/types/utils/setResponseHeaders.d.ts +0 -5
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get the Next function (for express application and middleware).
|
|
3
|
-
*
|
|
4
|
-
* @decorator
|
|
5
|
-
* @operation
|
|
6
|
-
* @input
|
|
7
|
-
*/
|
|
8
|
-
export declare function Next(): ParameterDecorator;
|
|
9
|
-
declare global {
|
|
10
|
-
namespace TsED {
|
|
11
|
-
interface NextFunction extends Function {
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Get the Next function (for express application and middleware).
|
|
17
|
-
*
|
|
18
|
-
* @decorator
|
|
19
|
-
* @operation
|
|
20
|
-
* @input
|
|
21
|
-
*/
|
|
22
|
-
export type Next = TsED.NextFunction;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { Type } from "@tsed/core";
|
|
2
|
-
import { ParamOptions } from "@tsed/platform-params";
|
|
3
|
-
/**
|
|
4
|
-
* Request service.
|
|
5
|
-
*
|
|
6
|
-
* @decorator
|
|
7
|
-
* @operation
|
|
8
|
-
* @input
|
|
9
|
-
*/
|
|
10
|
-
export declare function Request(expression: string, useType: Type<any>): ParameterDecorator;
|
|
11
|
-
export declare function Request(expression: string): ParameterDecorator;
|
|
12
|
-
export declare function Request(useType: Type<any>): ParameterDecorator;
|
|
13
|
-
export declare function Request(options: ParamOptions<any>): ParameterDecorator;
|
|
14
|
-
export declare function Request(): ParameterDecorator;
|
|
15
|
-
/**
|
|
16
|
-
* Request service.
|
|
17
|
-
*
|
|
18
|
-
* @alias Request
|
|
19
|
-
* @decorator
|
|
20
|
-
* @operation
|
|
21
|
-
* @input
|
|
22
|
-
*/
|
|
23
|
-
export declare function Req(expression: string, useType: Type<any>): ParameterDecorator;
|
|
24
|
-
export declare function Req(expression: string): ParameterDecorator;
|
|
25
|
-
export declare function Req(useType: Type<any>): ParameterDecorator;
|
|
26
|
-
export declare function Req(options: Partial<ParamOptions>): ParameterDecorator;
|
|
27
|
-
export declare function Req(): ParameterDecorator;
|
|
28
|
-
/**
|
|
29
|
-
* Request service.
|
|
30
|
-
*
|
|
31
|
-
* @decorator
|
|
32
|
-
* @operation
|
|
33
|
-
* @input
|
|
34
|
-
*/
|
|
35
|
-
export interface Request extends TsED.Request {
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Request service.
|
|
39
|
-
*
|
|
40
|
-
* @alias Request
|
|
41
|
-
* @decorator
|
|
42
|
-
* @operation
|
|
43
|
-
* @input
|
|
44
|
-
*/
|
|
45
|
-
export interface Req extends Request {
|
|
46
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Response service.
|
|
3
|
-
*
|
|
4
|
-
* @decorator
|
|
5
|
-
* @operation
|
|
6
|
-
* @input
|
|
7
|
-
* @response
|
|
8
|
-
*/
|
|
9
|
-
export declare function Response(): ParameterDecorator;
|
|
10
|
-
/**
|
|
11
|
-
* Request service.
|
|
12
|
-
*
|
|
13
|
-
* @alias Response
|
|
14
|
-
* @decorator
|
|
15
|
-
* @operation
|
|
16
|
-
* @input
|
|
17
|
-
* @response
|
|
18
|
-
*/
|
|
19
|
-
export declare function Res(): ParameterDecorator;
|
|
20
|
-
/**
|
|
21
|
-
* Response service.
|
|
22
|
-
*
|
|
23
|
-
* @decorator
|
|
24
|
-
* @operation
|
|
25
|
-
* @input
|
|
26
|
-
* @response
|
|
27
|
-
*/
|
|
28
|
-
export interface Response extends TsED.Response {
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Response service.
|
|
32
|
-
*
|
|
33
|
-
* @alias Response
|
|
34
|
-
* @decorator
|
|
35
|
-
* @operation
|
|
36
|
-
* @input
|
|
37
|
-
* @response
|
|
38
|
-
*/
|
|
39
|
-
export interface Res extends Response {
|
|
40
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { AnyPromiseResult, AnyToPromise } from "@tsed/core";
|
|
2
|
-
import { PlatformContext } from "./PlatformContext.js";
|
|
3
|
-
export declare class AnyToPromiseWithCtx extends AnyToPromise {
|
|
4
|
-
$ctx: PlatformContext;
|
|
5
|
-
constructor($ctx: PlatformContext);
|
|
6
|
-
isDone(): boolean;
|
|
7
|
-
call(cb: Function): Promise<AnyPromiseResult<any>>;
|
|
8
|
-
destroy(): void;
|
|
9
|
-
isCanceledResponse(process: any): boolean;
|
|
10
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { EndpointMetadata } from "@tsed/schema";
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import { DIContext, DIContextOptions } from "@tsed/di";
|
|
3
|
-
import { PlatformHandlerMetadata } from "@tsed/platform-router";
|
|
4
|
-
import { EndpointMetadata } from "@tsed/schema";
|
|
5
|
-
import { IncomingMessage, ServerResponse } from "http";
|
|
6
|
-
import { IncomingEvent } from "../interfaces/IncomingEvent.js";
|
|
7
|
-
import { PlatformApplication } from "../services/PlatformApplication.js";
|
|
8
|
-
import { PlatformRequest } from "../services/PlatformRequest.js";
|
|
9
|
-
import { PlatformResponse } from "../services/PlatformResponse.js";
|
|
10
|
-
declare global {
|
|
11
|
-
namespace TsED {
|
|
12
|
-
interface Context extends PlatformContext {
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
export interface PlatformContextOptions extends DIContextOptions {
|
|
17
|
-
event: IncomingEvent;
|
|
18
|
-
ignoreUrlPatterns?: any[];
|
|
19
|
-
endpoint?: EndpointMetadata;
|
|
20
|
-
}
|
|
21
|
-
export declare class PlatformContext<PReq extends PlatformRequest = PlatformRequest, PRes extends PlatformResponse = PlatformResponse> extends DIContext {
|
|
22
|
-
#private;
|
|
23
|
-
readonly PLATFORM: string;
|
|
24
|
-
event: IncomingEvent;
|
|
25
|
-
/**
|
|
26
|
-
* The data return by the previous endpoint if you use multiple handler on the same route. By default data is empty.
|
|
27
|
-
*/
|
|
28
|
-
data: any;
|
|
29
|
-
/**
|
|
30
|
-
* The error caught by the current handler
|
|
31
|
-
*/
|
|
32
|
-
error?: unknown;
|
|
33
|
-
/**
|
|
34
|
-
*
|
|
35
|
-
*/
|
|
36
|
-
next?: any;
|
|
37
|
-
/**
|
|
38
|
-
* The current @@PlatformResponse@@.
|
|
39
|
-
*/
|
|
40
|
-
readonly response: PRes;
|
|
41
|
-
/**
|
|
42
|
-
* The current @@PlatformRequest@@.
|
|
43
|
-
*/
|
|
44
|
-
readonly request: PReq;
|
|
45
|
-
/**
|
|
46
|
-
* The current @@EndpointMetadata@@ resolved by Ts.ED during the request.
|
|
47
|
-
*/
|
|
48
|
-
endpoint: EndpointMetadata;
|
|
49
|
-
/**
|
|
50
|
-
* The current @@PlatformHandlerMetadata@@ resolved by Ts.ED during the request.
|
|
51
|
-
*/
|
|
52
|
-
handlerMetadata: PlatformHandlerMetadata;
|
|
53
|
-
constructor(options: PlatformContextOptions);
|
|
54
|
-
get url(): string;
|
|
55
|
-
get app(): PlatformApplication<TsED.Application>;
|
|
56
|
-
start(): Promise<void>;
|
|
57
|
-
finish(): Promise<void>;
|
|
58
|
-
isFinished(): boolean;
|
|
59
|
-
isDone(): any;
|
|
60
|
-
/**
|
|
61
|
-
* Return the framework request instance (Express, Koa, etc...)
|
|
62
|
-
*/
|
|
63
|
-
getRequest<Req = any>(): Req;
|
|
64
|
-
/**
|
|
65
|
-
* Return the framework response instance (Express, Koa, etc...)
|
|
66
|
-
*/
|
|
67
|
-
getResponse<Res = any>(): Res;
|
|
68
|
-
/**
|
|
69
|
-
* Get Node.js request
|
|
70
|
-
*/
|
|
71
|
-
getReq(): IncomingMessage;
|
|
72
|
-
/**
|
|
73
|
-
* Get Node.js response
|
|
74
|
-
*/
|
|
75
|
-
getRes(): ServerResponse;
|
|
76
|
-
/**
|
|
77
|
-
* Return the original application instance.
|
|
78
|
-
*/
|
|
79
|
-
getApp<T = any>(): T;
|
|
80
|
-
}
|
package/lib/types/exports.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import "@tsed/logger";
|
|
2
|
-
import "@tsed/logger-file";
|
|
3
|
-
export * from "@tsed/di";
|
|
4
|
-
export { $log, Logger } from "@tsed/logger";
|
|
5
|
-
export * from "@tsed/platform-exceptions";
|
|
6
|
-
export * from "@tsed/platform-middlewares";
|
|
7
|
-
export * from "@tsed/platform-params";
|
|
8
|
-
export * from "@tsed/platform-response-filter";
|
|
9
|
-
export * from "@tsed/platform-router";
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @ignore
|
|
3
|
-
*/
|
|
4
|
-
export declare enum HandlerType {
|
|
5
|
-
CUSTOM = "custom",
|
|
6
|
-
ENDPOINT = "endpoint",
|
|
7
|
-
MIDDLEWARE = "middleware",
|
|
8
|
-
ERR_MIDDLEWARE = "err:middleware",
|
|
9
|
-
CTX_FN = "context",
|
|
10
|
-
RAW_FN = "raw:middleware",
|
|
11
|
-
RAW_ERR_FN = "raw:err:middleware"
|
|
12
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Type } from "@tsed/core";
|
|
2
|
-
import { PathType } from "@tsed/di";
|
|
3
|
-
/**
|
|
4
|
-
* @ignore
|
|
5
|
-
*/
|
|
6
|
-
export interface PlatformRouteOptions {
|
|
7
|
-
token?: Type<any>;
|
|
8
|
-
path?: PathType | undefined;
|
|
9
|
-
method?: string;
|
|
10
|
-
handlers: any[];
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* @ignore
|
|
14
|
-
*/
|
|
15
|
-
export type PlatformRouteWithoutHandlers = Partial<Omit<PlatformRouteOptions, "handlers">>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { MiddlewareMethods } from "@tsed/platform-middlewares";
|
|
2
|
-
import { Context } from "@tsed/platform-params";
|
|
3
|
-
/**
|
|
4
|
-
* @middleware
|
|
5
|
-
* @platform
|
|
6
|
-
*/
|
|
7
|
-
export declare class PlatformAcceptMimesMiddleware implements MiddlewareMethods {
|
|
8
|
-
acceptMimes: string[];
|
|
9
|
-
use(ctx: Context): void;
|
|
10
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { BadRequest } from "@tsed/exceptions";
|
|
2
|
-
import { MiddlewareMethods } from "@tsed/platform-middlewares";
|
|
3
|
-
import type { MulterError } from "multer";
|
|
4
|
-
import { PlatformMulterField, PlatformMulterSettings } from "../config/interfaces/PlatformMulterSettings.js";
|
|
5
|
-
import { PlatformContext } from "../domain/PlatformContext.js";
|
|
6
|
-
import { PlatformApplication } from "../services/PlatformApplication.js";
|
|
7
|
-
export interface MulterInputOptions {
|
|
8
|
-
fields: PlatformMulterField[];
|
|
9
|
-
}
|
|
10
|
-
export declare class MulterException extends BadRequest {
|
|
11
|
-
constructor(er: MulterError);
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* @middleware
|
|
15
|
-
*/
|
|
16
|
-
export declare class PlatformMulterMiddleware implements MiddlewareMethods {
|
|
17
|
-
protected settings: PlatformMulterSettings;
|
|
18
|
-
protected app: PlatformApplication;
|
|
19
|
-
use(ctx: PlatformContext): Promise<any>;
|
|
20
|
-
protected getFields(conf: MulterInputOptions): {
|
|
21
|
-
name: string;
|
|
22
|
-
maxCount: number | undefined;
|
|
23
|
-
}[];
|
|
24
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { FakeAdapter } from "./PlatformAdapter.js";
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import { EventEmitter } from "node:events";
|
|
3
|
-
export declare class FakeResponse extends EventEmitter {
|
|
4
|
-
headers: Record<string, unknown>;
|
|
5
|
-
locals: Record<string, unknown>;
|
|
6
|
-
statusCode: number;
|
|
7
|
-
data: any;
|
|
8
|
-
constructor(opts?: {});
|
|
9
|
-
status(code: number): this;
|
|
10
|
-
contentType(content: string): void;
|
|
11
|
-
contentLength(content: number): void;
|
|
12
|
-
redirect(status: number, path: string): void;
|
|
13
|
-
location(path: string): void;
|
|
14
|
-
get(key: string): unknown;
|
|
15
|
-
getHeaders(): Record<string, unknown>;
|
|
16
|
-
set(key: string, value: any): this;
|
|
17
|
-
setHeader(key: string, value: any): this;
|
|
18
|
-
send(data: any): void;
|
|
19
|
-
json(data: any): void;
|
|
20
|
-
write(chunk: any): void;
|
|
21
|
-
end(data: any): void;
|
|
22
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { InjectorService, TokenProvider } from "@tsed/di";
|
|
2
|
-
import { PlatformLayer, PlatformRouters } from "@tsed/platform-router";
|
|
3
|
-
import { Route, RouteController } from "../interfaces/Route.js";
|
|
4
|
-
import { PlatformApplication } from "./PlatformApplication.js";
|
|
5
|
-
/**
|
|
6
|
-
* `Platform` is used to provide all routes collected by annotation `@Controller`.
|
|
7
|
-
*
|
|
8
|
-
* @platform
|
|
9
|
-
*/
|
|
10
|
-
export declare class Platform {
|
|
11
|
-
#private;
|
|
12
|
-
readonly injector: InjectorService;
|
|
13
|
-
readonly platformApplication: PlatformApplication;
|
|
14
|
-
readonly platformRouters: PlatformRouters;
|
|
15
|
-
constructor(injector: InjectorService, platformApplication: PlatformApplication, platformRouters: PlatformRouters);
|
|
16
|
-
get app(): PlatformApplication<TsED.Application>;
|
|
17
|
-
addRoutes(routes: Route[]): void;
|
|
18
|
-
addRoute(route: string, token: TokenProvider): this;
|
|
19
|
-
getLayers(): PlatformLayer[];
|
|
20
|
-
/**
|
|
21
|
-
* Get all controllers mounted on the application.
|
|
22
|
-
* @returns {RouteController[]}
|
|
23
|
-
*/
|
|
24
|
-
getMountedControllers(): RouteController[];
|
|
25
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import { Type } from "@tsed/core";
|
|
3
|
-
import { InjectorService, ProviderOpts } from "@tsed/di";
|
|
4
|
-
import { PlatformContextHandler, PlatformHandlerMetadata, PlatformLayer } from "@tsed/platform-router";
|
|
5
|
-
import { IncomingMessage, ServerResponse } from "http";
|
|
6
|
-
import { PlatformMulter, PlatformMulterSettings } from "../config/interfaces/PlatformMulterSettings.js";
|
|
7
|
-
import { PlatformStaticsOptions } from "../config/interfaces/PlatformStaticsSettings.js";
|
|
8
|
-
import { PlatformContext } from "../domain/PlatformContext.js";
|
|
9
|
-
import { CreateServerReturn } from "../utils/createServer.js";
|
|
10
|
-
import type { PlatformApplication } from "./PlatformApplication.js";
|
|
11
|
-
export declare abstract class PlatformAdapter<App = TsED.Application> {
|
|
12
|
-
protected injector: InjectorService;
|
|
13
|
-
static readonly NAME: string;
|
|
14
|
-
/**
|
|
15
|
-
* Load providers in top priority
|
|
16
|
-
*/
|
|
17
|
-
providers: ProviderOpts[];
|
|
18
|
-
constructor(injector: InjectorService);
|
|
19
|
-
get app(): PlatformApplication<App>;
|
|
20
|
-
getServers(): CreateServerReturn[];
|
|
21
|
-
onInit(): Promise<void> | void;
|
|
22
|
-
beforeLoadRoutes(): Promise<void> | void;
|
|
23
|
-
afterLoadRoutes(): Promise<void> | void;
|
|
24
|
-
/**
|
|
25
|
-
* create initial context
|
|
26
|
-
*/
|
|
27
|
-
abstract useContext(): any;
|
|
28
|
-
/**
|
|
29
|
-
* Map router layer to the targeted framework
|
|
30
|
-
*/
|
|
31
|
-
abstract mapLayers(layer: PlatformLayer[]): void;
|
|
32
|
-
/**
|
|
33
|
-
* Map handler to the targeted framework
|
|
34
|
-
*/
|
|
35
|
-
abstract mapHandler(handler: Function, layer: PlatformHandlerMetadata): Function;
|
|
36
|
-
/**
|
|
37
|
-
* Return the app instance
|
|
38
|
-
*/
|
|
39
|
-
abstract createApp(): {
|
|
40
|
-
app: App;
|
|
41
|
-
callback(): (req: IncomingMessage, res: ServerResponse) => void;
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Return the statics middlewares
|
|
45
|
-
* @param endpoint
|
|
46
|
-
* @param options
|
|
47
|
-
*/
|
|
48
|
-
abstract statics(endpoint: string, options: PlatformStaticsOptions): any;
|
|
49
|
-
/**
|
|
50
|
-
* Return the multipart middleware
|
|
51
|
-
* @param options
|
|
52
|
-
*/
|
|
53
|
-
abstract multipart(options: PlatformMulterSettings): PlatformMulter;
|
|
54
|
-
/**
|
|
55
|
-
* Return the body parser for the given
|
|
56
|
-
* @param type
|
|
57
|
-
* @param opts
|
|
58
|
-
*/
|
|
59
|
-
abstract bodyParser(type: string, opts?: Record<string, any>): any;
|
|
60
|
-
}
|
|
61
|
-
export interface PlatformBuilderSettings<App = TsED.Application> extends Partial<TsED.Configuration> {
|
|
62
|
-
adapter?: Type<PlatformAdapter<App>>;
|
|
63
|
-
}
|
|
64
|
-
export declare class FakeAdapter extends PlatformAdapter<any> {
|
|
65
|
-
providers: ProviderOpts[];
|
|
66
|
-
static readonly NAME: string;
|
|
67
|
-
static createFakeRawDriver(): {
|
|
68
|
-
(): void;
|
|
69
|
-
use: () => any;
|
|
70
|
-
all: () => any;
|
|
71
|
-
get: () => any;
|
|
72
|
-
patch: () => any;
|
|
73
|
-
post: () => any;
|
|
74
|
-
put: () => any;
|
|
75
|
-
head: () => any;
|
|
76
|
-
delete: () => any;
|
|
77
|
-
options: () => any;
|
|
78
|
-
};
|
|
79
|
-
createApp(): {
|
|
80
|
-
app: any;
|
|
81
|
-
callback(): any;
|
|
82
|
-
};
|
|
83
|
-
multipart(options: PlatformMulterSettings): PlatformMulter;
|
|
84
|
-
statics(endpoint: string, options: PlatformStaticsOptions): any;
|
|
85
|
-
bodyParser(type: string): any;
|
|
86
|
-
mapLayers(layers: PlatformLayer[]): void;
|
|
87
|
-
mapHandler(handler: PlatformContextHandler<PlatformContext>): PlatformContextHandler<PlatformContext<import("./PlatformRequest.js").PlatformRequest<any>, import("./PlatformResponse.js").PlatformResponse<any>>>;
|
|
88
|
-
useContext(): void;
|
|
89
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/// <reference types="multer" />
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
-
import { InjectorService } from "@tsed/di";
|
|
4
|
-
import { PlatformRouter } from "@tsed/platform-router";
|
|
5
|
-
import { IncomingMessage, ServerResponse } from "http";
|
|
6
|
-
import { PlatformMulterSettings } from "../config/interfaces/PlatformMulterSettings.js";
|
|
7
|
-
import { PlatformAdapter } from "./PlatformAdapter.js";
|
|
8
|
-
declare global {
|
|
9
|
-
namespace TsED {
|
|
10
|
-
interface Application {
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* `PlatformApplication` is used to provide all routes collected by annotation `@Controller`.
|
|
16
|
-
*
|
|
17
|
-
* @platform
|
|
18
|
-
*/
|
|
19
|
-
export declare class PlatformApplication<App = TsED.Application> extends PlatformRouter {
|
|
20
|
-
adapter: PlatformAdapter<App>;
|
|
21
|
-
injector: InjectorService;
|
|
22
|
-
rawApp: App;
|
|
23
|
-
rawCallback: () => any;
|
|
24
|
-
constructor(adapter: PlatformAdapter<App>, injector: InjectorService);
|
|
25
|
-
getApp(): App;
|
|
26
|
-
multer(options: PlatformMulterSettings): import("multer").Multer;
|
|
27
|
-
callback(): (req: IncomingMessage, res: ServerResponse) => any;
|
|
28
|
-
callback(req: IncomingMessage, res: ServerResponse): any;
|
|
29
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { AnyPromiseResult } from "@tsed/core";
|
|
2
|
-
import { Provider } from "@tsed/di";
|
|
3
|
-
import { PlatformExceptions } from "@tsed/platform-exceptions";
|
|
4
|
-
import { PlatformParams, PlatformParamsCallback } from "@tsed/platform-params";
|
|
5
|
-
import { PlatformResponseFilter } from "@tsed/platform-response-filter";
|
|
6
|
-
import { PlatformHandlerMetadata, PlatformRouters } from "@tsed/platform-router";
|
|
7
|
-
import { PlatformContext } from "../domain/PlatformContext.js";
|
|
8
|
-
import { PlatformApplication } from "./PlatformApplication.js";
|
|
9
|
-
import { PlatformMiddlewaresChain } from "./PlatformMiddlewaresChain.js";
|
|
10
|
-
/**
|
|
11
|
-
* Platform Handler abstraction layer. Wrap original class method to a pure platform handler (Express, Koa, etc...).
|
|
12
|
-
* @platform
|
|
13
|
-
*/
|
|
14
|
-
export declare class PlatformHandler {
|
|
15
|
-
protected platformRouters: PlatformRouters;
|
|
16
|
-
protected responseFilter: PlatformResponseFilter;
|
|
17
|
-
protected platformParams: PlatformParams;
|
|
18
|
-
protected platformExceptions: PlatformExceptions;
|
|
19
|
-
protected platformApplication: PlatformApplication;
|
|
20
|
-
protected platformMiddlewaresChain: PlatformMiddlewaresChain;
|
|
21
|
-
constructor(platformRouters: PlatformRouters);
|
|
22
|
-
createHandler(handlerMetadata: PlatformHandlerMetadata): any;
|
|
23
|
-
/**
|
|
24
|
-
* @param provider
|
|
25
|
-
* @param propertyKey
|
|
26
|
-
*/
|
|
27
|
-
createCustomHandler(provider: Provider, propertyKey: string): any;
|
|
28
|
-
/**
|
|
29
|
-
* Call handler when a request his handle
|
|
30
|
-
*/
|
|
31
|
-
onRequest(handler: PlatformParamsCallback, $ctx: PlatformContext): Promise<any>;
|
|
32
|
-
onResponse({ status, data, headers }: AnyPromiseResult, $ctx: PlatformContext): void;
|
|
33
|
-
/**
|
|
34
|
-
* Send the response to the consumer.
|
|
35
|
-
* @protected
|
|
36
|
-
* @param $ctx
|
|
37
|
-
*/
|
|
38
|
-
flush($ctx: PlatformContext): Promise<void>;
|
|
39
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { InjectorService } from "@tsed/di";
|
|
2
|
-
import { AlterEndpointHandlersArg } from "@tsed/platform-router";
|
|
3
|
-
import { JsonOperationRoute } from "@tsed/schema";
|
|
4
|
-
import { PlatformAdapter } from "../services/PlatformAdapter.js";
|
|
5
|
-
export declare class PlatformMiddlewaresChain {
|
|
6
|
-
protected acceptMimes: string[];
|
|
7
|
-
protected adapter: PlatformAdapter;
|
|
8
|
-
protected injector: InjectorService;
|
|
9
|
-
get(handlers: AlterEndpointHandlersArg, operationRoute: JsonOperationRoute): AlterEndpointHandlersArg;
|
|
10
|
-
protected hasAcceptMimes(operationRoute: JsonOperationRoute): number;
|
|
11
|
-
protected getParamTypes(middlewares: AlterEndpointHandlersArg, operationRoute: JsonOperationRoute): {
|
|
12
|
-
ACCEPT_MIMES: number;
|
|
13
|
-
FILE: boolean;
|
|
14
|
-
RAW_BODY: boolean;
|
|
15
|
-
BODY: boolean;
|
|
16
|
-
};
|
|
17
|
-
}
|