@tsed/common 8.0.0-alpha.5 → 8.0.0-alpha.7
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/builder/PlatformBuilder.js.map +1 -1
- package/lib/esm/config/services/PlatformConfiguration.js.map +1 -1
- package/lib/esm/decorators/PlatformProvider.js.map +1 -1
- package/lib/esm/decorators/multer/multerOptions.js.map +1 -1
- package/lib/esm/decorators/multer/multipartFile.js.map +1 -1
- package/lib/esm/decorators/params/request.js +1 -1
- package/lib/esm/decorators/params/request.js.map +1 -1
- package/lib/esm/decorators/params/response.js.map +1 -1
- package/lib/esm/domain/AnyToPromiseWithCtx.js.map +1 -1
- package/lib/esm/domain/PlatformContext.js.map +1 -1
- package/lib/esm/exports.js +5 -5
- package/lib/esm/exports.js.map +1 -1
- package/lib/esm/middlewares/PlatformAcceptMimesMiddleware.js.map +1 -1
- package/lib/esm/middlewares/PlatformMulterMiddleware.js.map +1 -1
- package/lib/esm/services/Platform.js.map +1 -1
- package/lib/esm/services/PlatformAdapter.js.map +1 -1
- package/lib/esm/services/PlatformApplication.js.map +1 -1
- package/lib/esm/services/PlatformHandler.js.map +1 -1
- package/lib/esm/services/PlatformMiddlewaresChain.js.map +1 -1
- package/lib/esm/services/PlatformRequest.js.map +1 -1
- package/lib/esm/services/PlatformResponse.js.map +1 -1
- package/lib/esm/services/PlatformTest.js.map +1 -1
- package/lib/esm/utils/createContext.js.map +1 -1
- package/lib/esm/utils/createHttpServer.js.map +1 -1
- package/lib/esm/utils/createHttpsServer.js.map +1 -1
- package/lib/esm/utils/createInjector.js.map +1 -1
- package/lib/esm/utils/createServer.js.map +1 -1
- package/lib/esm/utils/ensureContext.js.map +1 -1
- package/lib/esm/utils/getConfiguration.js.map +1 -1
- package/lib/esm/utils/getStaticsOptions.js.map +1 -1
- package/lib/esm/utils/printRoutes.js.map +1 -1
- package/lib/esm/utils/registerPlatformAdapter.js.map +1 -1
- package/lib/esm/utils/setResponseHeaders.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/exports.d.ts +5 -5
- 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 +22 -23
- package/vitest.config.mts +4 -4
- 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,67 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { getHostInfoFromPort } from "@tsed/core";
|
|
3
|
-
import { DIConfiguration, TokenProvider } from "@tsed/di";
|
|
4
|
-
import Https from "https";
|
|
5
|
-
import { PlatformJsonMapperSettings } from "../interfaces/PlatformJsonMapperSettings.js";
|
|
6
|
-
/**
|
|
7
|
-
* `PlatformConfiguration` contains all information about your Server configuration.
|
|
8
|
-
*/
|
|
9
|
-
export declare class PlatformConfiguration extends DIConfiguration {
|
|
10
|
-
constructor();
|
|
11
|
-
get port(): string | number | false;
|
|
12
|
-
set port(value: string | number | false);
|
|
13
|
-
get httpsOptions(): Https.ServerOptions;
|
|
14
|
-
set httpsOptions(value: Https.ServerOptions);
|
|
15
|
-
get httpPort(): string | number | false;
|
|
16
|
-
set httpPort(value: string | number | false);
|
|
17
|
-
get httpsPort(): string | number | false;
|
|
18
|
-
set httpsPort(value: string | number | false);
|
|
19
|
-
get mount(): Record<string, TokenProvider[]>;
|
|
20
|
-
set mount(value: Record<string, TokenProvider[]>);
|
|
21
|
-
get statics(): Record<string, (any | string)[]>;
|
|
22
|
-
set statics(value: Record<string, (any | string)[]>);
|
|
23
|
-
get acceptMimes(): string[];
|
|
24
|
-
set acceptMimes(value: string[]);
|
|
25
|
-
get jsonMapper(): Partial<PlatformJsonMapperSettings>;
|
|
26
|
-
set jsonMapper(options: Partial<PlatformJsonMapperSettings>);
|
|
27
|
-
get additionalProperties(): boolean;
|
|
28
|
-
/**
|
|
29
|
-
*
|
|
30
|
-
* @returns {string|number}
|
|
31
|
-
*/
|
|
32
|
-
getHttpPort(): ReturnType<typeof getHostInfoFromPort>;
|
|
33
|
-
/**
|
|
34
|
-
*
|
|
35
|
-
* @param settings
|
|
36
|
-
*/
|
|
37
|
-
setHttpPort(settings: {
|
|
38
|
-
address: string;
|
|
39
|
-
port: number;
|
|
40
|
-
}): void;
|
|
41
|
-
/**
|
|
42
|
-
*
|
|
43
|
-
* @returns {string|number}
|
|
44
|
-
*/
|
|
45
|
-
getHttpsPort(): {
|
|
46
|
-
protocol: string;
|
|
47
|
-
address: string;
|
|
48
|
-
port: number;
|
|
49
|
-
toString(): string;
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
*
|
|
53
|
-
* @param settings
|
|
54
|
-
*/
|
|
55
|
-
setHttpsPort(settings: {
|
|
56
|
-
address: string;
|
|
57
|
-
port: number;
|
|
58
|
-
}): void;
|
|
59
|
-
getBestHost(): {
|
|
60
|
-
protocol: string;
|
|
61
|
-
address: string;
|
|
62
|
-
port: number;
|
|
63
|
-
toString(): string;
|
|
64
|
-
} | {
|
|
65
|
-
toString(): string;
|
|
66
|
-
};
|
|
67
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const ROUTER_OPTIONS: unique symbol;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Define file size limit.
|
|
3
|
-
*
|
|
4
|
-
* ```typescript
|
|
5
|
-
* import {Controller, Post} from "@tsed/common";
|
|
6
|
-
* import {MulterOptions, MultipartFile} from "@tsed/common";
|
|
7
|
-
* import {Multer} from "@types/multer";
|
|
8
|
-
*
|
|
9
|
-
* type MulterFile = Express.Multer.File;
|
|
10
|
-
*
|
|
11
|
-
* @Controller('/')
|
|
12
|
-
* class MyCtrl {
|
|
13
|
-
* @Post('/file2')
|
|
14
|
-
* @MulterFileSize(1024) // (Ko). Applied for all fields
|
|
15
|
-
* private uploadFile(@MultipartFile("file1") file: MulterFile, @MultipartFile("file2") file2: MulterFile) {
|
|
16
|
-
*
|
|
17
|
-
* }
|
|
18
|
-
* }
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* > See the tutorial on the [multer configuration](/tutorials/multer.md).
|
|
22
|
-
* @param fileSize
|
|
23
|
-
* @returns {(target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor}
|
|
24
|
-
* @decorator
|
|
25
|
-
* @multer
|
|
26
|
-
*/
|
|
27
|
-
export declare function MulterFileSize(fileSize: number): MethodDecorator;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { PlatformMulterSettings } from "../../config/interfaces/PlatformMulterSettings.js";
|
|
2
|
-
/**
|
|
3
|
-
* Define multer option for all MultipartFile
|
|
4
|
-
*
|
|
5
|
-
* ```typescript
|
|
6
|
-
* import {Controller, Post, PlatformMulterFile, MultipartFile, MulterOptions} from "@tsed/common";
|
|
7
|
-
*
|
|
8
|
-
* @Controller('/')
|
|
9
|
-
* class MyCtrl {
|
|
10
|
-
* @Post('/file')
|
|
11
|
-
* private uploadFile(@MultipartFile("file1") file: PlatformMulterFile) {
|
|
12
|
-
*
|
|
13
|
-
* }
|
|
14
|
-
*
|
|
15
|
-
* @Post('/file')
|
|
16
|
-
* @MulterOptions({dest: "/other-dir"})
|
|
17
|
-
* private uploadFile(@MultipartFile("file1") file: PlatformMulterFile) {
|
|
18
|
-
*
|
|
19
|
-
* }
|
|
20
|
-
*
|
|
21
|
-
* @Post('/file2')
|
|
22
|
-
* @MulterOptions({dest: "/other-dir"})
|
|
23
|
-
* private uploadFile(@MultipartFile("file1") file: PlatformMulterFile, @MultipartFile("file2") file2: PlatformMulterFile) {
|
|
24
|
-
*
|
|
25
|
-
* }
|
|
26
|
-
*
|
|
27
|
-
* @Post('/files')
|
|
28
|
-
* private uploadFile(@MultipartFile("file1") files: PlatformMulterFile[]) {
|
|
29
|
-
*
|
|
30
|
-
* }
|
|
31
|
-
* }
|
|
32
|
-
* ```
|
|
33
|
-
*
|
|
34
|
-
* See the tutorial on the [multer configuration](/tutorials/multer.md).
|
|
35
|
-
*
|
|
36
|
-
* @param {multer.Options} options
|
|
37
|
-
* @returns {(target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor}
|
|
38
|
-
* @decorator
|
|
39
|
-
* @multer
|
|
40
|
-
*/
|
|
41
|
-
export declare function MulterOptions(options: PlatformMulterSettings): MethodDecorator;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { PlatformMulterFile } from "../../config/interfaces/PlatformMulterSettings.js";
|
|
2
|
-
/**
|
|
3
|
-
* Define a parameter as Multipart file.
|
|
4
|
-
*
|
|
5
|
-
* ```typescript
|
|
6
|
-
* import {Controller, Post} from "@tsed/common";
|
|
7
|
-
* import {MulterOptions, MultipartFile} from "@tsed/common";
|
|
8
|
-
* import {Multer} from "@types/multer";
|
|
9
|
-
*
|
|
10
|
-
* type MulterFile = Express.Multer.File;
|
|
11
|
-
*
|
|
12
|
-
* @Controller('/')
|
|
13
|
-
* class MyCtrl {
|
|
14
|
-
* @Post('/file')
|
|
15
|
-
* private uploadFile(@MultipartFile("file1") file: MulterFile) {
|
|
16
|
-
*
|
|
17
|
-
* }
|
|
18
|
-
*
|
|
19
|
-
* @Post('/file')
|
|
20
|
-
* @MulterOptions({dest: "/other-dir"})
|
|
21
|
-
* private uploadFile(@MultipartFile("file1") file: MulterFile) {
|
|
22
|
-
*
|
|
23
|
-
* }
|
|
24
|
-
*
|
|
25
|
-
* @Post('/file2')
|
|
26
|
-
* @MulterOptions({dest: "/other-dir"})
|
|
27
|
-
* private uploadFile(@MultipartFile("file1") file: MulterFile, @MultipartFile("file2") file2: MulterFile) {
|
|
28
|
-
*
|
|
29
|
-
* }
|
|
30
|
-
*
|
|
31
|
-
* @Post('/files')
|
|
32
|
-
* private uploadFile(@MultipartFile("file1") files: MulterFile[]) {
|
|
33
|
-
*
|
|
34
|
-
* }
|
|
35
|
-
* }
|
|
36
|
-
* ```
|
|
37
|
-
*
|
|
38
|
-
* > See the tutorial on the [multer configuration](/tutorials/multer.md).
|
|
39
|
-
*
|
|
40
|
-
* @param name
|
|
41
|
-
* @param maxCount
|
|
42
|
-
* @returns Function
|
|
43
|
-
* @decorator
|
|
44
|
-
* @input
|
|
45
|
-
*/
|
|
46
|
-
export declare function MultipartFile(name: string, maxCount?: number): ParameterDecorator;
|
|
47
|
-
export type MultipartFile = PlatformMulterFile;
|
|
@@ -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" />
|
|
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
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import "@tsed/logger";
|
|
2
|
-
import "@tsed/logger-file";
|
|
3
|
-
export * from "@tsed/di";
|
|
4
|
-
export * from "@tsed/platform-params";
|
|
5
|
-
export * from "@tsed/platform-exceptions";
|
|
6
|
-
export * from "@tsed/platform-response-filter";
|
|
7
|
-
export * from "@tsed/platform-middlewares";
|
|
8
|
-
export * from "@tsed/platform-log-middleware";
|
|
9
|
-
export * from "@tsed/platform-router";
|
|
10
|
-
export { $log, Logger } from "@tsed/logger";
|
|
11
|
-
export { AcceptMime, Location, Redirect, View, Get, Post, Put, Patch, Delete, Head, Options, All } from "@tsed/schema";
|
package/lib/types-esm/index.d.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Automatically generated by @tsed/barrels.
|
|
3
|
-
*/
|
|
4
|
-
export * from "./builder/PlatformBuilder.js";
|
|
5
|
-
export * from "./config/interfaces/PlatformJsonMapperSettings.js";
|
|
6
|
-
export * from "./config/interfaces/PlatformMulterSettings.js";
|
|
7
|
-
export * from "./config/interfaces/PlatformRouterSettings.js";
|
|
8
|
-
export * from "./config/interfaces/PlatformStaticsSettings.js";
|
|
9
|
-
export * from "./config/services/PlatformConfiguration.js";
|
|
10
|
-
export * from "./constants/routerOptions.js";
|
|
11
|
-
export * from "./decorators/multer/multerFileSize.js";
|
|
12
|
-
export * from "./decorators/multer/multerOptions.js";
|
|
13
|
-
export * from "./decorators/multer/multipartFile.js";
|
|
14
|
-
export * from "./decorators/params/error.js";
|
|
15
|
-
export * from "./decorators/params/next.js";
|
|
16
|
-
export * from "./decorators/params/request.js";
|
|
17
|
-
export * from "./decorators/params/response.js";
|
|
18
|
-
export * from "./decorators/PlatformProvider.js";
|
|
19
|
-
export * from "./domain/AnyToPromiseWithCtx.js";
|
|
20
|
-
export * from "./domain/EndpointMetadata.js";
|
|
21
|
-
export * from "./domain/PlatformContext.js";
|
|
22
|
-
export * from "./domain/PlatformRouteDetails.js";
|
|
23
|
-
export * from "./exports.js";
|
|
24
|
-
export * from "./interfaces/AfterInit.js";
|
|
25
|
-
export * from "./interfaces/AfterListen.js";
|
|
26
|
-
export * from "./interfaces/AfterRoutesInit.js";
|
|
27
|
-
export * from "./interfaces/BeforeInit.js";
|
|
28
|
-
export * from "./interfaces/BeforeListen.js";
|
|
29
|
-
export * from "./interfaces/BeforeRoutesInit.js";
|
|
30
|
-
export * from "./interfaces/HandlerType.js";
|
|
31
|
-
export * from "./interfaces/IncomingEvent.js";
|
|
32
|
-
export * from "./interfaces/OnReady.js";
|
|
33
|
-
export * from "./interfaces/OnRequest.js";
|
|
34
|
-
export * from "./interfaces/OnResponse.js";
|
|
35
|
-
export * from "./interfaces/OnRoutesInit.js";
|
|
36
|
-
export * from "./interfaces/PlatformRouteOptions.js";
|
|
37
|
-
export * from "./interfaces/ResponseErrorObject.js";
|
|
38
|
-
export * from "./interfaces/Route.js";
|
|
39
|
-
export * from "./middlewares/PlatformAcceptMimesMiddleware.js";
|
|
40
|
-
export * from "./middlewares/PlatformMulterMiddleware.js";
|
|
41
|
-
export * from "./services/FakeAdapter.js";
|
|
42
|
-
export * from "./services/FakeResponse.js";
|
|
43
|
-
export * from "./services/Platform.js";
|
|
44
|
-
export * from "./services/PlatformAdapter.js";
|
|
45
|
-
export * from "./services/PlatformApplication.js";
|
|
46
|
-
export * from "./services/PlatformHandler.js";
|
|
47
|
-
export * from "./services/PlatformMiddlewaresChain.js";
|
|
48
|
-
export * from "./services/PlatformRequest.js";
|
|
49
|
-
export * from "./services/PlatformResponse.js";
|
|
50
|
-
export * from "./services/PlatformTest.js";
|
|
51
|
-
export * from "./utils/closeServer.js";
|
|
52
|
-
export * from "./utils/createContext.js";
|
|
53
|
-
export * from "./utils/createHttpServer.js";
|
|
54
|
-
export * from "./utils/createHttpsServer.js";
|
|
55
|
-
export * from "./utils/createInjector.js";
|
|
56
|
-
export * from "./utils/createServer.js";
|
|
57
|
-
export * from "./utils/ensureContext.js";
|
|
58
|
-
export * from "./utils/getStaticsOptions.js";
|
|
59
|
-
export * from "./utils/listenServer.js";
|
|
60
|
-
export * from "./utils/mapReturnedResponse.js";
|
|
61
|
-
export * from "./utils/printRoutes.js";
|
|
62
|
-
export * from "./utils/registerPlatformAdapter.js";
|
|
63
|
-
export * from "./utils/setResponseHeaders.js";
|
|
@@ -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";
|