@tsed/common 8.0.0-beta.3 → 8.0.0-beta.5
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 +11 -63
- package/lib/esm/index.js.map +1 -1
- package/lib/types/index.d.ts +11 -63
- package/package.json +11 -32
- package/readme.md +3 -3
- 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,111 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import { IncomingHttpHeaders, IncomingMessage } from "http";
|
|
3
|
-
import type { PlatformContext } from "../domain/PlatformContext.js";
|
|
4
|
-
import type { PlatformResponse } from "./PlatformResponse.js";
|
|
5
|
-
declare global {
|
|
6
|
-
namespace TsED {
|
|
7
|
-
interface Request {
|
|
8
|
-
id: string;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Platform Request abstraction layer.
|
|
14
|
-
* @platform
|
|
15
|
-
*/
|
|
16
|
-
export declare class PlatformRequest<Req extends {
|
|
17
|
-
[key: string]: any;
|
|
18
|
-
} = any> {
|
|
19
|
-
readonly $ctx: PlatformContext;
|
|
20
|
-
constructor($ctx: PlatformContext);
|
|
21
|
-
/**
|
|
22
|
-
* The current @@PlatformResponse@@.
|
|
23
|
-
*/
|
|
24
|
-
get response(): PlatformResponse;
|
|
25
|
-
get raw(): Req;
|
|
26
|
-
get secure(): boolean;
|
|
27
|
-
get host(): string;
|
|
28
|
-
get protocol(): string;
|
|
29
|
-
/**
|
|
30
|
-
* Get the url of the request.
|
|
31
|
-
*
|
|
32
|
-
* Is equivalent of `express.response.originalUrl || express.response.url`.
|
|
33
|
-
*/
|
|
34
|
-
get url(): string;
|
|
35
|
-
get headers(): IncomingHttpHeaders;
|
|
36
|
-
get method(): string;
|
|
37
|
-
/**
|
|
38
|
-
* Contains key-value pairs of data submitted in the request body. By default, it is `undefined`, and is populated when you use
|
|
39
|
-
* `body-parsing` middleware such as `express.json()` or `express.urlencoded()`.
|
|
40
|
-
*/
|
|
41
|
-
get body(): any;
|
|
42
|
-
get rawBody(): any;
|
|
43
|
-
/**
|
|
44
|
-
* When using `cookie-parser` middleware, this property is an object that contains cookies sent by the request.
|
|
45
|
-
* If the request contains no cookies, it defaults to `{}`.
|
|
46
|
-
*/
|
|
47
|
-
get cookies(): {
|
|
48
|
-
[key: string]: any;
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
* This property is an object containing properties mapped to the named route `parameters`.
|
|
52
|
-
* For example, if you have the route `/user/:name`, then the `name` property is available as `req.params.name`.
|
|
53
|
-
* This object defaults to `{}`.
|
|
54
|
-
*/
|
|
55
|
-
get params(): {
|
|
56
|
-
[key: string]: any;
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* This property is an object containing a property for each query string parameter in the route.
|
|
60
|
-
* When query parser is set to disabled, it is an empty object `{}`, otherwise it is the result of the configured query parser.
|
|
61
|
-
*/
|
|
62
|
-
get query(): {
|
|
63
|
-
[key: string]: any;
|
|
64
|
-
};
|
|
65
|
-
/**
|
|
66
|
-
* This property is an object containing a property for each session attributes set by any code.
|
|
67
|
-
* It requires to install a middleware like express-session to work.
|
|
68
|
-
*/
|
|
69
|
-
get session(): {
|
|
70
|
-
[key: string]: any;
|
|
71
|
-
};
|
|
72
|
-
get files(): any;
|
|
73
|
-
get route(): import("@tsed/platform-router").SinglePathType;
|
|
74
|
-
/**
|
|
75
|
-
* Return the original request framework instance
|
|
76
|
-
*/
|
|
77
|
-
get request(): Req;
|
|
78
|
-
/**
|
|
79
|
-
* Return the original request node.js instance
|
|
80
|
-
*/
|
|
81
|
-
get req(): IncomingMessage;
|
|
82
|
-
/**
|
|
83
|
-
* Returns the HTTP request header specified by field. The match is case-insensitive.
|
|
84
|
-
*
|
|
85
|
-
* ```typescript
|
|
86
|
-
* request.get('Content-Type') // => "text/plain"
|
|
87
|
-
* ```
|
|
88
|
-
*
|
|
89
|
-
* @param name
|
|
90
|
-
*/
|
|
91
|
-
get(name: string): any;
|
|
92
|
-
getHeader(name: string): any;
|
|
93
|
-
/**
|
|
94
|
-
* Checks if the specified content types are acceptable, based on the request’s Accept HTTP header field. The method returns the best match, or if none of the specified content types is acceptable, returns false (in which case, the application should respond with 406 "Not Acceptable").
|
|
95
|
-
*
|
|
96
|
-
* The type value may be a single MIME type string (such as “application/json”), an extension name such as “json”, a comma-delimited list, or an array. For a list or array, the method returns the best match (if any).
|
|
97
|
-
*
|
|
98
|
-
* @param mime
|
|
99
|
-
*/
|
|
100
|
-
accepts(mime: string): string | false;
|
|
101
|
-
accepts(mime: string[]): string[] | false;
|
|
102
|
-
isAborted(): any;
|
|
103
|
-
/**
|
|
104
|
-
* Return the Framework response object (express, koa, etc...)
|
|
105
|
-
*/
|
|
106
|
-
getRequest<R = Req>(): R;
|
|
107
|
-
/**
|
|
108
|
-
* Return the Node.js response object
|
|
109
|
-
*/
|
|
110
|
-
getReq(): IncomingMessage;
|
|
111
|
-
}
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
4
|
-
import { OutgoingHttpHeaders, ServerResponse } from "http";
|
|
5
|
-
import type { PlatformContext } from "../domain/PlatformContext.js";
|
|
6
|
-
import type { PlatformRequest } from "./PlatformRequest.js";
|
|
7
|
-
declare global {
|
|
8
|
-
namespace TsED {
|
|
9
|
-
interface Response {
|
|
10
|
-
}
|
|
11
|
-
interface SetCookieOpts extends Record<string, unknown> {
|
|
12
|
-
maxAge?: number | undefined;
|
|
13
|
-
signed?: boolean | undefined;
|
|
14
|
-
expires?: Date | undefined;
|
|
15
|
-
httpOnly?: boolean | undefined;
|
|
16
|
-
path?: string | undefined;
|
|
17
|
-
domain?: string | undefined;
|
|
18
|
-
secure?: boolean | undefined;
|
|
19
|
-
encode?: ((val: string) => string) | undefined;
|
|
20
|
-
sameSite?: boolean | "lax" | "strict" | "none" | undefined;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Platform Response abstraction layer.
|
|
26
|
-
* @platform
|
|
27
|
-
*/
|
|
28
|
-
export declare class PlatformResponse<Res extends Record<string, any> = any> {
|
|
29
|
-
readonly $ctx: PlatformContext;
|
|
30
|
-
data: any;
|
|
31
|
-
constructor($ctx: PlatformContext);
|
|
32
|
-
/**
|
|
33
|
-
* The current @@PlatformRequest@@.
|
|
34
|
-
*/
|
|
35
|
-
get request(): PlatformRequest;
|
|
36
|
-
get raw(): Res;
|
|
37
|
-
/**
|
|
38
|
-
* Get the current statusCode
|
|
39
|
-
*/
|
|
40
|
-
get statusCode(): any;
|
|
41
|
-
/**
|
|
42
|
-
* An object that contains response local variables scoped to the request, and therefore available only to the view(s) rendered during that request / response cycle (if any). Otherwise, this property is identical to app.locals.
|
|
43
|
-
*
|
|
44
|
-
* This property is useful for exposing request-level information such as the request path name, authenticated user, user settings, and so on.
|
|
45
|
-
*/
|
|
46
|
-
get locals(): any;
|
|
47
|
-
/**
|
|
48
|
-
* Return the original response framework instance
|
|
49
|
-
*/
|
|
50
|
-
get response(): Res;
|
|
51
|
-
/**
|
|
52
|
-
* Return the original response node.js instance
|
|
53
|
-
*/
|
|
54
|
-
get res(): ServerResponse<import("http").IncomingMessage>;
|
|
55
|
-
/**
|
|
56
|
-
* Returns the HTTP response header specified by field. The match is case-insensitive.
|
|
57
|
-
*
|
|
58
|
-
* ```typescript
|
|
59
|
-
* response.get('Content-Type') // => "text/plain"
|
|
60
|
-
* ```
|
|
61
|
-
*
|
|
62
|
-
* @param name
|
|
63
|
-
*/
|
|
64
|
-
get(name: string): any;
|
|
65
|
-
getHeaders(): OutgoingHttpHeaders;
|
|
66
|
-
/**
|
|
67
|
-
* Return the Framework response object (express, koa, etc...)
|
|
68
|
-
*/
|
|
69
|
-
getResponse<R = Res>(): R;
|
|
70
|
-
/**
|
|
71
|
-
* Return the Node.js response object
|
|
72
|
-
*/
|
|
73
|
-
getRes(): ServerResponse;
|
|
74
|
-
hasStatus(): boolean;
|
|
75
|
-
/**
|
|
76
|
-
* Sets the HTTP status for the response.
|
|
77
|
-
*
|
|
78
|
-
* @param status
|
|
79
|
-
*/
|
|
80
|
-
status(status: number): this;
|
|
81
|
-
/**
|
|
82
|
-
* Set header `field` to `val`, or pass
|
|
83
|
-
* an object of header fields.
|
|
84
|
-
*
|
|
85
|
-
* Examples:
|
|
86
|
-
* ```typescript
|
|
87
|
-
* response.setHeaders({ Accept: 'text/plain', 'X-API-Key': 'tobi' });
|
|
88
|
-
* ```
|
|
89
|
-
*
|
|
90
|
-
* Aliased as `res.header()`.
|
|
91
|
-
*/
|
|
92
|
-
setHeaders(headers: OutgoingHttpHeaders): this;
|
|
93
|
-
setHeader(key: string, item: any): this;
|
|
94
|
-
/**
|
|
95
|
-
* Set `Content-Type` response header with `type` through `mime.lookup()`
|
|
96
|
-
* when it does not contain "/", or set the Content-Type to `type` otherwise.
|
|
97
|
-
*
|
|
98
|
-
* Examples:
|
|
99
|
-
*
|
|
100
|
-
* res.type('.html');
|
|
101
|
-
* res.type('html');
|
|
102
|
-
* res.type('json');
|
|
103
|
-
* res.type('application/json');
|
|
104
|
-
* res.type('png');
|
|
105
|
-
*/
|
|
106
|
-
contentType(contentType: string): this;
|
|
107
|
-
contentLength(length: number): this;
|
|
108
|
-
getContentLength(): number | undefined;
|
|
109
|
-
getContentType(): any;
|
|
110
|
-
/**
|
|
111
|
-
* Sets the HTTP response Content-Disposition header field to “attachment”.
|
|
112
|
-
* If a filename is given, then it sets the Content-Type based on the extension name via res.type(), and sets the Content-Disposition “filename=” parameter.
|
|
113
|
-
*
|
|
114
|
-
* ```typescript
|
|
115
|
-
* res.attachment()
|
|
116
|
-
* // Content-Disposition: attachment
|
|
117
|
-
*
|
|
118
|
-
* res.attachment('path/to/logo.png')
|
|
119
|
-
* // Content-Disposition: attachment; filename="logo.png"
|
|
120
|
-
* // Content-Type: image/png
|
|
121
|
-
* ```
|
|
122
|
-
*
|
|
123
|
-
* @param filename
|
|
124
|
-
*/
|
|
125
|
-
attachment(filename: string): this;
|
|
126
|
-
/**
|
|
127
|
-
* Redirects to the URL derived from the specified path, with specified status, a positive integer that corresponds to an [HTTP status code](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html).
|
|
128
|
-
* If not specified, status defaults to `302 Found`.
|
|
129
|
-
*
|
|
130
|
-
* @param status
|
|
131
|
-
* @param url
|
|
132
|
-
*/
|
|
133
|
-
redirect(status: number, url: string): this;
|
|
134
|
-
/**
|
|
135
|
-
* Sets the response Location HTTP header to the specified path parameter.
|
|
136
|
-
*
|
|
137
|
-
* @param location
|
|
138
|
-
*/
|
|
139
|
-
location(location: string): this;
|
|
140
|
-
/**
|
|
141
|
-
* Stream the given data.
|
|
142
|
-
*
|
|
143
|
-
* @param data
|
|
144
|
-
*/
|
|
145
|
-
stream(data: any): this;
|
|
146
|
-
/**
|
|
147
|
-
* Renders a view and sends the rendered HTML string to the client.
|
|
148
|
-
*
|
|
149
|
-
* @param path
|
|
150
|
-
* @param options
|
|
151
|
-
*/
|
|
152
|
-
render(path: string, options?: any): Promise<any>;
|
|
153
|
-
/**
|
|
154
|
-
* Send any data to your consumer.
|
|
155
|
-
*
|
|
156
|
-
* This method accept a ReadableStream, a plain object, boolean, string, number, null and undefined data.
|
|
157
|
-
* It chooses the better way to send the data.
|
|
158
|
-
*
|
|
159
|
-
* @param data
|
|
160
|
-
*/
|
|
161
|
-
body(data: any): this;
|
|
162
|
-
getBody(): any;
|
|
163
|
-
/**
|
|
164
|
-
* Add a listener to handler the end of the request/response.
|
|
165
|
-
* @param cb
|
|
166
|
-
*/
|
|
167
|
-
onEnd(cb: () => Promise<void> | void): this;
|
|
168
|
-
isDone(): boolean;
|
|
169
|
-
isHeadersSent(): boolean;
|
|
170
|
-
cookie(name: string, value: string | null, opts?: TsED.SetCookieOpts): this;
|
|
171
|
-
protected formatHeader(key: string, item: any): any;
|
|
172
|
-
protected json(data: any): this;
|
|
173
|
-
protected buffer(data: any): void;
|
|
174
|
-
protected end(data?: string | Buffer): void;
|
|
175
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
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
|
-
* @deprecated use PlatformTest.injector.invoke instead
|
|
37
|
-
* @param targets
|
|
38
|
-
* @param func
|
|
39
|
-
*/
|
|
40
|
-
static inject<T>(targets: any[], func: (...args: any[]) => Promise<T> | T): () => Promise<T>;
|
|
41
|
-
/**
|
|
42
|
-
* Return the raw application (express or koa).
|
|
43
|
-
* Use this callback with SuperTest.
|
|
44
|
-
*
|
|
45
|
-
* ```typescript
|
|
46
|
-
* let request: SuperTest.Agent;
|
|
47
|
-
* beforeEach(PlatformTest.bootstrap(Server, {
|
|
48
|
-
* mount: {
|
|
49
|
-
* "/rest": [ProductsController]
|
|
50
|
-
* }
|
|
51
|
-
* }));
|
|
52
|
-
* beforeEach(() => {
|
|
53
|
-
* request = SuperTest(PlatformTest.callback());
|
|
54
|
-
* });
|
|
55
|
-
* ```
|
|
56
|
-
*/
|
|
57
|
-
static callback(): RequestListener<typeof IncomingMessage, typeof ServerResponse>;
|
|
58
|
-
static createRequest(options?: any): any;
|
|
59
|
-
static createResponse(options?: any): any;
|
|
60
|
-
static createRequestContext(options?: Partial<PlatformContextOptions & any>): PlatformContext<import("./PlatformRequest.js").PlatformRequest<any>, import("./PlatformResponse.js").PlatformResponse<any>>;
|
|
61
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
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" resolution-mode="require"/>
|
|
2
|
-
import { InjectorService } from "@tsed/di";
|
|
3
|
-
import Http from "http";
|
|
4
|
-
export declare function createHttpServer(injector: InjectorService, requestListener: Http.RequestListener): import("./createServer.js").CreateServerReturn | undefined;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
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,8 +0,0 @@
|
|
|
1
|
-
import { Type } from "@tsed/core";
|
|
2
|
-
import { PlatformAdapter } from "../services/PlatformAdapter.js";
|
|
3
|
-
interface CreateInjectorOptions {
|
|
4
|
-
adapter?: Type<PlatformAdapter<any>>;
|
|
5
|
-
settings?: Partial<TsED.Configuration>;
|
|
6
|
-
}
|
|
7
|
-
export declare function createInjector({ adapter, settings }: CreateInjectorOptions): import("@tsed/di").InjectorService;
|
|
8
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
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" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
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>;
|