@tsed/common 6.95.9 → 6.95.10
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/package.json +15 -15
- package/lib/cjs/PlatformModule.d.ts +0 -6
- package/lib/cjs/builder/PlatformBuilder.d.ts +0 -104
- package/lib/cjs/builder/PlatformControllerBuilder.d.ts +0 -17
- package/lib/cjs/config/index.d.ts +0 -3
- package/lib/cjs/config/interfaces/ConverterSettings.d.ts +0 -6
- package/lib/cjs/config/interfaces/EndpointDirectoriesSettings.d.ts +0 -3
- package/lib/cjs/config/interfaces/PlatformLoggerSettings.d.ts +0 -44
- package/lib/cjs/config/interfaces/PlatformMulterSettings.d.ts +0 -138
- package/lib/cjs/config/interfaces/PlatformStaticsSettings.d.ts +0 -17
- package/lib/cjs/config/interfaces/index.d.ts +0 -97
- package/lib/cjs/config/services/PlatformConfiguration.d.ts +0 -81
- package/lib/cjs/constants/routerOptions.d.ts +0 -1
- package/lib/cjs/decorators/httpServer.d.ts +0 -28
- package/lib/cjs/decorators/httpsServer.d.ts +0 -28
- package/lib/cjs/decorators/index.d.ts +0 -16
- package/lib/cjs/decorators/method/acceptMime.d.ts +0 -19
- package/lib/cjs/decorators/method/endpointFn.d.ts +0 -9
- package/lib/cjs/decorators/method/location.d.ts +0 -1
- package/lib/cjs/decorators/method/redirect.d.ts +0 -1
- package/lib/cjs/decorators/method/route.d.ts +0 -1
- package/lib/cjs/decorators/method/view.d.ts +0 -25
- package/lib/cjs/decorators/multer/index.d.ts +0 -3
- package/lib/cjs/decorators/multer/multerFileSize.d.ts +0 -27
- package/lib/cjs/decorators/multer/multerOptions.d.ts +0 -41
- package/lib/cjs/decorators/multer/multipartFile.d.ts +0 -47
- package/lib/cjs/decorators/params/endpointInfo.d.ts +0 -13
- package/lib/cjs/decorators/params/error.d.ts +0 -7
- package/lib/cjs/decorators/params/next.d.ts +0 -22
- package/lib/cjs/decorators/params/request.d.ts +0 -46
- package/lib/cjs/decorators/params/response.d.ts +0 -40
- package/lib/cjs/decorators/params/responseData.d.ts +0 -9
- package/lib/cjs/domain/AnyToPromiseWithCtx.d.ts +0 -18
- package/lib/cjs/domain/ControllerProvider.d.ts +0 -24
- package/lib/cjs/domain/EndpointMetadata.d.ts +0 -50
- package/lib/cjs/domain/HandlerMetadata.d.ts +0 -32
- package/lib/cjs/domain/PlatformContext.d.ts +0 -65
- package/lib/cjs/domain/PlatformRouteDetails.d.ts +0 -23
- package/lib/cjs/domain/PropertyMetadata.d.ts +0 -17
- package/lib/cjs/domain/index.d.ts +0 -7
- package/lib/cjs/index.d.ts +0 -22
- package/lib/cjs/interfaces/AfterInit.d.ts +0 -3
- package/lib/cjs/interfaces/AfterListen.d.ts +0 -3
- package/lib/cjs/interfaces/AfterRoutesInit.d.ts +0 -3
- package/lib/cjs/interfaces/BeforeInit.d.ts +0 -3
- package/lib/cjs/interfaces/BeforeListen.d.ts +0 -3
- package/lib/cjs/interfaces/BeforeRoutesInit.d.ts +0 -3
- package/lib/cjs/interfaces/HandlerType.d.ts +0 -12
- package/lib/cjs/interfaces/IncomingEvent.d.ts +0 -6
- package/lib/cjs/interfaces/OnReady.d.ts +0 -3
- package/lib/cjs/interfaces/OnRequest.d.ts +0 -4
- package/lib/cjs/interfaces/OnResponse.d.ts +0 -4
- package/lib/cjs/interfaces/OnRoutesInit.d.ts +0 -3
- package/lib/cjs/interfaces/PathType.d.ts +0 -1
- package/lib/cjs/interfaces/PlatformAdapter.d.ts +0 -19
- package/lib/cjs/interfaces/PlatformRouteOptions.d.ts +0 -16
- package/lib/cjs/interfaces/ResponseErrorObject.d.ts +0 -8
- package/lib/cjs/interfaces/Route.d.ts +0 -10
- package/lib/cjs/interfaces/index.d.ts +0 -17
- package/lib/cjs/middlewares/AcceptMimesMiddleware.d.ts +0 -10
- package/lib/cjs/middlewares/GlobalAcceptMimesMiddleware.d.ts +0 -9
- package/lib/cjs/middlewares/PlatformAcceptMimesMiddleware.d.ts +0 -10
- package/lib/cjs/middlewares/PlatformMulterMiddleware.d.ts +0 -19
- package/lib/cjs/middlewares/__mock__/FakeCtrl.d.ts +0 -2
- package/lib/cjs/middlewares/bindEndpointMiddleware.d.ts +0 -5
- package/lib/cjs/middlewares/index.d.ts +0 -5
- package/lib/cjs/services/FakeRawDriver.d.ts +0 -15
- package/lib/cjs/services/Platform.d.ts +0 -37
- package/lib/cjs/services/PlatformApplication.d.ts +0 -21
- package/lib/cjs/services/PlatformHandler.d.ts +0 -80
- package/lib/cjs/services/PlatformMiddlewaresChain.d.ts +0 -6
- package/lib/cjs/services/PlatformRequest.d.ts +0 -112
- package/lib/cjs/services/PlatformResponse.d.ts +0 -161
- package/lib/cjs/services/PlatformRouter.d.ts +0 -48
- package/lib/cjs/services/PlatformTest.d.ts +0 -58
- package/lib/cjs/services/index.d.ts +0 -8
- package/lib/cjs/utils/createContext.d.ts +0 -9
- package/lib/cjs/utils/createHandlerMetadata.d.ts +0 -8
- package/lib/cjs/utils/createHttpServer.d.ts +0 -4
- package/lib/cjs/utils/createHttpsServer.d.ts +0 -4
- package/lib/cjs/utils/createInjector.d.ts +0 -7
- package/lib/cjs/utils/getConfiguration.d.ts +0 -2
- package/lib/cjs/utils/getStaticsOptions.d.ts +0 -5
- package/lib/cjs/utils/index.d.ts +0 -8
- package/lib/cjs/utils/listenServer.d.ts +0 -7
- package/lib/cjs/utils/loadInjector.d.ts +0 -6
- package/lib/cjs/utils/mapReturnedResponse.d.ts +0 -4
- package/lib/cjs/utils/printRoutes.d.ts +0 -2
- package/lib/cjs/utils/setResponseHeaders.d.ts +0 -5
- package/lib/cjs/utils/useCtxHandler.d.ts +0 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/common",
|
|
3
|
-
"version": "6.95.
|
|
3
|
+
"version": "6.95.10",
|
|
4
4
|
"description": "A TypeScript Framework on top of Express",
|
|
5
5
|
"private": false,
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -59,22 +59,22 @@
|
|
|
59
59
|
}
|
|
60
60
|
],
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@tsed/components-scan": "6.95.
|
|
63
|
-
"@tsed/core": "6.95.
|
|
64
|
-
"@tsed/di": "6.95.
|
|
65
|
-
"@tsed/exceptions": "6.95.
|
|
66
|
-
"@tsed/json-mapper": "6.95.
|
|
62
|
+
"@tsed/components-scan": "6.95.10",
|
|
63
|
+
"@tsed/core": "6.95.10",
|
|
64
|
+
"@tsed/di": "6.95.10",
|
|
65
|
+
"@tsed/exceptions": "6.95.10",
|
|
66
|
+
"@tsed/json-mapper": "6.95.10",
|
|
67
67
|
"@tsed/logger": "^6.0.0",
|
|
68
68
|
"@tsed/logger-file": "^6.0.0",
|
|
69
|
-
"@tsed/perf": "6.95.
|
|
70
|
-
"@tsed/platform-cache": "6.95.
|
|
71
|
-
"@tsed/platform-exceptions": "6.95.
|
|
72
|
-
"@tsed/platform-log-middleware": "6.95.
|
|
73
|
-
"@tsed/platform-middlewares": "6.95.
|
|
74
|
-
"@tsed/platform-params": "6.95.
|
|
75
|
-
"@tsed/platform-response-filter": "6.95.
|
|
76
|
-
"@tsed/platform-views": "6.95.
|
|
77
|
-
"@tsed/schema": "6.95.
|
|
69
|
+
"@tsed/perf": "6.95.10",
|
|
70
|
+
"@tsed/platform-cache": "6.95.10",
|
|
71
|
+
"@tsed/platform-exceptions": "6.95.10",
|
|
72
|
+
"@tsed/platform-log-middleware": "6.95.10",
|
|
73
|
+
"@tsed/platform-middlewares": "6.95.10",
|
|
74
|
+
"@tsed/platform-params": "6.95.10",
|
|
75
|
+
"@tsed/platform-response-filter": "6.95.10",
|
|
76
|
+
"@tsed/platform-views": "6.95.10",
|
|
77
|
+
"@tsed/schema": "6.95.10",
|
|
78
78
|
"@types/json-schema": "7.0.7",
|
|
79
79
|
"on-finished": "2.3.0",
|
|
80
80
|
"tslib": "2.2.0",
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Type } from "@tsed/core";
|
|
3
|
-
import { InjectorService, IProvider } from "@tsed/di";
|
|
4
|
-
import { Platform } from "../services/Platform";
|
|
5
|
-
import { PlatformApplication } from "../services/PlatformApplication";
|
|
6
|
-
import { IncomingMessage, ServerResponse } from "http";
|
|
7
|
-
import { PlatformAdapter, PlatformBuilderSettings } from "../interfaces/PlatformAdapter";
|
|
8
|
-
/**
|
|
9
|
-
* @platform
|
|
10
|
-
*/
|
|
11
|
-
export declare class PlatformBuilder<App = TsED.Application, Router = TsED.Router> {
|
|
12
|
-
#private;
|
|
13
|
-
static adapter: Type<PlatformAdapter>;
|
|
14
|
-
readonly name: string;
|
|
15
|
-
protected startedAt: Date;
|
|
16
|
-
protected current: Date;
|
|
17
|
-
protected constructor(adapter: Type<PlatformAdapter<App, Router>> | undefined, module: Type, settings: Partial<TsED.Configuration>);
|
|
18
|
-
get injector(): InjectorService;
|
|
19
|
-
get rootModule(): any;
|
|
20
|
-
get app(): PlatformApplication<App, Router>;
|
|
21
|
-
get platform(): Platform;
|
|
22
|
-
/**
|
|
23
|
-
* Return the settings configured by the decorator @@Configuration@@.
|
|
24
|
-
*
|
|
25
|
-
* ```typescript
|
|
26
|
-
* @Configuration({
|
|
27
|
-
* rootDir: Path.resolve(__dirname),
|
|
28
|
-
* port: 8000,
|
|
29
|
-
* httpsPort: 8080,
|
|
30
|
-
* mount: {
|
|
31
|
-
* "/rest": "${rootDir}/controllers/**\/*.js"
|
|
32
|
-
* }
|
|
33
|
-
* })
|
|
34
|
-
* export class Server {
|
|
35
|
-
* $onInit(){
|
|
36
|
-
* console.log(this.settings); // {rootDir, port, httpsPort,...}
|
|
37
|
-
* }
|
|
38
|
-
* }
|
|
39
|
-
* ```
|
|
40
|
-
*
|
|
41
|
-
* @returns {PlatformConfiguration}
|
|
42
|
-
*/
|
|
43
|
-
get settings(): TsED.Configuration & import("@tsed/di").DIConfiguration;
|
|
44
|
-
get logger(): import("@tsed/di").DILogger;
|
|
45
|
-
get disableBootstrapLog(): boolean | undefined;
|
|
46
|
-
static create<App = TsED.Application, Router = TsED.Router>(module: Type<any>, settings: PlatformBuilderSettings<App, Router>): PlatformBuilder<App, Router>;
|
|
47
|
-
static build<App = TsED.Application, Router = TsED.Router>(module: Type<any>, { adapter, ...settings }: PlatformBuilderSettings<App, Router>): PlatformBuilder<App, Router>;
|
|
48
|
-
/**
|
|
49
|
-
* Bootstrap a server application
|
|
50
|
-
* @param module
|
|
51
|
-
* @param settings
|
|
52
|
-
*/
|
|
53
|
-
static bootstrap<App = TsED.Application, Router = TsED.Router>(module: Type<any>, settings: PlatformBuilderSettings<App, Router>): Promise<PlatformBuilder<App, Router>>;
|
|
54
|
-
callback(): (req: IncomingMessage, res: ServerResponse) => void;
|
|
55
|
-
callback(req: IncomingMessage, res: ServerResponse): void;
|
|
56
|
-
log(...data: any[]): any;
|
|
57
|
-
/**
|
|
58
|
-
* Add classes to the components list
|
|
59
|
-
* @param classes
|
|
60
|
-
*/
|
|
61
|
-
addComponents(classes: any | any[]): this;
|
|
62
|
-
/**
|
|
63
|
-
* Add classes decorated by @@Controller@@ to components container.
|
|
64
|
-
*
|
|
65
|
-
* ### Example
|
|
66
|
-
*
|
|
67
|
-
* ```typescript
|
|
68
|
-
* @Controller('/ctrl')
|
|
69
|
-
* class MyController{
|
|
70
|
-
* }
|
|
71
|
-
*
|
|
72
|
-
* platform.addControllers('/rest', [MyController])
|
|
73
|
-
* ```
|
|
74
|
-
*
|
|
75
|
-
* ::: tip
|
|
76
|
-
* If the MyController class isn't decorated, the class will be ignored.
|
|
77
|
-
* :::
|
|
78
|
-
*
|
|
79
|
-
* @param {string} endpoint
|
|
80
|
-
* @param {any[]} controllers
|
|
81
|
-
*/
|
|
82
|
-
addControllers(endpoint: string, controllers: any | string | (any | string)[]): void;
|
|
83
|
-
runLifecycle(): Promise<this>;
|
|
84
|
-
loadInjector(): Promise<void>;
|
|
85
|
-
listen(network?: boolean): Promise<void>;
|
|
86
|
-
stop(): Promise<void>;
|
|
87
|
-
ready(): Promise<void>;
|
|
88
|
-
callHook(hook: string, ...args: any[]): Promise<void>;
|
|
89
|
-
loadStatics(hook: string): Promise<void>;
|
|
90
|
-
useProvider(token: Type<any>, settings?: Partial<IProvider>): this;
|
|
91
|
-
bootstrap(): Promise<this>;
|
|
92
|
-
protected loadRoutes(): Promise<void>;
|
|
93
|
-
protected diff(): string;
|
|
94
|
-
protected importProviders(): Promise<void>;
|
|
95
|
-
/**
|
|
96
|
-
* Load middlewares from configuration for the given hook
|
|
97
|
-
* @param hook
|
|
98
|
-
* @protected
|
|
99
|
-
*/
|
|
100
|
-
protected loadMiddlewaresFor(hook: string): void;
|
|
101
|
-
protected createHttpServers(): void;
|
|
102
|
-
protected listenServers(): Promise<void>;
|
|
103
|
-
protected logRoutes(): Promise<void>;
|
|
104
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { InjectorService } from "@tsed/di";
|
|
2
|
-
import { ControllerProvider } from "../domain/ControllerProvider";
|
|
3
|
-
import { PlatformRouter } from "../services/PlatformRouter";
|
|
4
|
-
/**
|
|
5
|
-
* @ignore
|
|
6
|
-
*/
|
|
7
|
-
export declare function getRouter(injector: InjectorService, provider: ControllerProvider): any;
|
|
8
|
-
/**
|
|
9
|
-
* @ignore
|
|
10
|
-
*/
|
|
11
|
-
export declare function createRouter(injector: InjectorService, provider: ControllerProvider): PlatformRouter;
|
|
12
|
-
/**
|
|
13
|
-
* @ignore
|
|
14
|
-
* @param injector
|
|
15
|
-
* @param provider
|
|
16
|
-
*/
|
|
17
|
-
export declare function buildRouter(injector: InjectorService, provider: ControllerProvider): PlatformRouter<TsED.Router>;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
export interface PlatformLoggerSettings {
|
|
2
|
-
/**
|
|
3
|
-
* Enable debug mode. By default debug is false.
|
|
4
|
-
*/
|
|
5
|
-
debug?: boolean;
|
|
6
|
-
/**
|
|
7
|
-
* Enable info mode. By default debug is false.
|
|
8
|
-
*/
|
|
9
|
-
level?: "debug" | "info" | "warn" | "error" | "off";
|
|
10
|
-
/**
|
|
11
|
-
* Enable log performance tracker and disable log server.
|
|
12
|
-
*/
|
|
13
|
-
perf?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* List of regexp to ignore log.
|
|
16
|
-
*/
|
|
17
|
-
ignoreUrlPatterns?: string[];
|
|
18
|
-
/**
|
|
19
|
-
* The number of space characters to use as white space in JSON output. Default is 2 (0 in production).
|
|
20
|
-
*/
|
|
21
|
-
jsonIndentation?: number;
|
|
22
|
-
/**
|
|
23
|
-
* A function called for each incoming request to create a request id.
|
|
24
|
-
* @returns {number}
|
|
25
|
-
*/
|
|
26
|
-
reqIdBuilder?: (req: TsED.Request) => string;
|
|
27
|
-
/**
|
|
28
|
-
* Disable routes table displayed in the logger. By default debug is `false`.
|
|
29
|
-
*/
|
|
30
|
-
disableRoutesSummary?: boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Disable bootstrap log displayed in the logger. By default debug is `false`.
|
|
33
|
-
*/
|
|
34
|
-
disableBootstrapLog?: boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Specify log format. Example: `%[%d{[yyyy-MM-dd hh:mm:ss,SSS}] %p%] %m`. See [@tsed/logger configuration](https://tsedio.github.io/logger/).
|
|
37
|
-
*/
|
|
38
|
-
format?: string;
|
|
39
|
-
/**
|
|
40
|
-
* Specify the log stack size for the context.logger. When the stack.length is reach, the logger is flushed during the request.
|
|
41
|
-
* Default size is set to 30.
|
|
42
|
-
*/
|
|
43
|
-
maxStackSize?: number;
|
|
44
|
-
}
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { FileFilterCallback } from "multer";
|
|
3
|
-
import { Readable } from "stream";
|
|
4
|
-
declare global {
|
|
5
|
-
namespace TsED {
|
|
6
|
-
interface MulterFile {
|
|
7
|
-
/** Name of the form field associated with this file. */
|
|
8
|
-
fieldname: string;
|
|
9
|
-
/** Name of the file on the uploader's computer. */
|
|
10
|
-
originalname: string;
|
|
11
|
-
/** Value of the `Content-Type` header for this file. */
|
|
12
|
-
mimetype: string;
|
|
13
|
-
/** Size of the file in bytes. */
|
|
14
|
-
size: number;
|
|
15
|
-
/**
|
|
16
|
-
* A readable stream of this file. Only available to the `_handleFile`
|
|
17
|
-
* callback for custom `StorageEngine`s.
|
|
18
|
-
*/
|
|
19
|
-
stream: Readable;
|
|
20
|
-
/** `DiskStorage` only: Directory to which this file has been uploaded. */
|
|
21
|
-
destination: string;
|
|
22
|
-
/** `DiskStorage` only: Name of this file within `destination`. */
|
|
23
|
-
filename: string;
|
|
24
|
-
/** `DiskStorage` only: Full path to the uploaded file. */
|
|
25
|
-
path: string;
|
|
26
|
-
/** `MemoryStorage` only: A Buffer containing the entire file. */
|
|
27
|
-
buffer: Buffer;
|
|
28
|
-
}
|
|
29
|
-
interface MulterStorageEngine {
|
|
30
|
-
}
|
|
31
|
-
interface MulterOptions {
|
|
32
|
-
/**
|
|
33
|
-
* A `StorageEngine` responsible for processing files uploaded via Multer.
|
|
34
|
-
* Takes precedence over `dest`.
|
|
35
|
-
*/
|
|
36
|
-
storage?: MulterStorageEngine;
|
|
37
|
-
/**
|
|
38
|
-
* The destination directory for uploaded files. If `storage` is not set
|
|
39
|
-
* and `dest` is, Multer will create a `DiskStorage` instance configured
|
|
40
|
-
* to store files at `dest` with random filenames.
|
|
41
|
-
*
|
|
42
|
-
* Ignored if `storage` is set.
|
|
43
|
-
*/
|
|
44
|
-
dest?: string;
|
|
45
|
-
/**
|
|
46
|
-
* An object specifying various limits on incoming data. This object is
|
|
47
|
-
* passed to Busboy directly, and the details of properties can be found
|
|
48
|
-
* at https://github.com/mscdex/busboy#busboy-methods.
|
|
49
|
-
*/
|
|
50
|
-
limits?: {
|
|
51
|
-
/** Maximum size of each form field name in bytes. (Default: 100) */
|
|
52
|
-
fieldNameSize?: number;
|
|
53
|
-
/** Maximum size of each form field value in bytes. (Default: 1048576) */
|
|
54
|
-
fieldSize?: number;
|
|
55
|
-
/** Maximum number of non-file form fields. (Default: Infinity) */
|
|
56
|
-
fields?: number;
|
|
57
|
-
/** Maximum size of each file in bytes. (Default: Infinity) */
|
|
58
|
-
fileSize?: number;
|
|
59
|
-
/** Maximum number of file fields. (Default: Infinity) */
|
|
60
|
-
files?: number;
|
|
61
|
-
/** Maximum number of parts (non-file fields + files). (Default: Infinity) */
|
|
62
|
-
parts?: number;
|
|
63
|
-
/** Maximum number of headers. (Default: 2000) */
|
|
64
|
-
headerPairs?: number;
|
|
65
|
-
};
|
|
66
|
-
/** Preserve the full path of the original filename rather than the basename. (Default: false) */
|
|
67
|
-
preservePath?: boolean;
|
|
68
|
-
/**
|
|
69
|
-
* Optional function to control which files are uploaded. This is called
|
|
70
|
-
* for every file that is processed.
|
|
71
|
-
*
|
|
72
|
-
* @param req The Express `Request` object.
|
|
73
|
-
* @param file Object containing information about the processed file.
|
|
74
|
-
* @param callback a function to control which files should be uploaded and which should be skipped.
|
|
75
|
-
*/
|
|
76
|
-
fileFilter?(req: Request, file: MulterFile, callback: FileFilterCallback): void;
|
|
77
|
-
}
|
|
78
|
-
interface MulterField {
|
|
79
|
-
name: string;
|
|
80
|
-
maxCount?: number;
|
|
81
|
-
}
|
|
82
|
-
type MulterHandler = (req: any, res: any) => Promise<any>;
|
|
83
|
-
interface Multer {
|
|
84
|
-
/**
|
|
85
|
-
* Returns middleware that processes a single file associated with the
|
|
86
|
-
* given form field.
|
|
87
|
-
*
|
|
88
|
-
* The `Request` object will be populated with a `file` object containing
|
|
89
|
-
* information about the processed file.
|
|
90
|
-
*
|
|
91
|
-
* @param fieldName Name of the multipart form field to process.
|
|
92
|
-
*/
|
|
93
|
-
single(fieldName: string): MulterHandler;
|
|
94
|
-
/**
|
|
95
|
-
* Returns middleware that processes multiple files sharing the same field
|
|
96
|
-
* name.
|
|
97
|
-
*
|
|
98
|
-
* The `Request` object will be populated with a `files` array containing
|
|
99
|
-
* an information object for each processed file.
|
|
100
|
-
*
|
|
101
|
-
* @param fieldName Shared name of the multipart form fields to process.
|
|
102
|
-
* @param maxCount Optional. Maximum number of files to process. (default: Infinity)
|
|
103
|
-
* @throws `MulterError('LIMIT_UNEXPECTED_FILE')` if more than `maxCount` files are associated with `fieldName`
|
|
104
|
-
*/
|
|
105
|
-
array(fieldName: string, maxCount?: number): MulterHandler;
|
|
106
|
-
/**
|
|
107
|
-
* Returns middleware that processes multiple files associated with the
|
|
108
|
-
* given form fields.
|
|
109
|
-
*
|
|
110
|
-
* The `Request` object will be populated with a `files` object which
|
|
111
|
-
* maps each field name to an array of the associated file information
|
|
112
|
-
* objects.
|
|
113
|
-
*
|
|
114
|
-
* @param fields Array of `Field` objects describing multipart form fields to process.
|
|
115
|
-
* @throws `MulterError('LIMIT_UNEXPECTED_FILE')` if more than `maxCount` files are associated with `fieldName` for any field.
|
|
116
|
-
*/
|
|
117
|
-
fields(fields: MulterField[]): MulterHandler;
|
|
118
|
-
/**
|
|
119
|
-
* Returns middleware that processes all files contained in the multipart
|
|
120
|
-
* request.
|
|
121
|
-
*
|
|
122
|
-
* The `Request` object will be populated with a `files` array containing
|
|
123
|
-
* an information object for each processed file.
|
|
124
|
-
*/
|
|
125
|
-
any(): MulterHandler;
|
|
126
|
-
/**
|
|
127
|
-
* Returns middleware that accepts only non-file multipart form fields.
|
|
128
|
-
*
|
|
129
|
-
* @throws `MulterError('LIMIT_UNEXPECTED_FILE')` if any file is encountered.
|
|
130
|
-
*/
|
|
131
|
-
none(): MulterHandler;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
export declare type PlatformMulter = TsED.Multer;
|
|
136
|
-
export declare type PlatformMulterSettings = TsED.MulterOptions;
|
|
137
|
-
export declare type PlatformMulterFile = TsED.MulterFile;
|
|
138
|
-
export declare type PlatformMulterField = TsED.MulterField;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
declare global {
|
|
2
|
-
namespace TsED {
|
|
3
|
-
interface StaticsOptions {
|
|
4
|
-
root: string;
|
|
5
|
-
hook?: "$beforeRoutesInit" | "$afterRoutesInit";
|
|
6
|
-
[key: string]: any;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
export interface PlatformStaticsOptions extends TsED.StaticsOptions {
|
|
11
|
-
root: string;
|
|
12
|
-
[key: string]: any;
|
|
13
|
-
}
|
|
14
|
-
export declare type PathOrStaticsOptions = string | PlatformStaticsOptions;
|
|
15
|
-
export interface PlatformStaticsSettings {
|
|
16
|
-
[endpoint: string]: PathOrStaticsOptions | PathOrStaticsOptions[];
|
|
17
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Env } from "@tsed/core";
|
|
3
|
-
import { ConverterSettings } from "./ConverterSettings";
|
|
4
|
-
import { EndpointDirectoriesSettings } from "./EndpointDirectoriesSettings";
|
|
5
|
-
import { PlatformLoggerSettings } from "./PlatformLoggerSettings";
|
|
6
|
-
import { PlatformMulterSettings } from "./PlatformMulterSettings";
|
|
7
|
-
import { PlatformStaticsSettings } from "./PlatformStaticsSettings";
|
|
8
|
-
import type Http from "http";
|
|
9
|
-
import type Https from "https";
|
|
10
|
-
declare global {
|
|
11
|
-
namespace TsED {
|
|
12
|
-
interface LoggerConfiguration extends Partial<PlatformLoggerSettings> {
|
|
13
|
-
}
|
|
14
|
-
interface Configuration {
|
|
15
|
-
/**
|
|
16
|
-
* The root directory where you build run project. By default, it's equal to `process.cwd().
|
|
17
|
-
*/
|
|
18
|
-
rootDir: string;
|
|
19
|
-
/**
|
|
20
|
-
* The environment profile. By default the environment profile is equals to `NODE_ENV`.
|
|
21
|
-
*/
|
|
22
|
-
env: Env;
|
|
23
|
-
/**
|
|
24
|
-
* Port number for the [HTTP.Server](https://nodejs.org/api/http.html#http_class_http_server).
|
|
25
|
-
*/
|
|
26
|
-
port: string | number;
|
|
27
|
-
/**
|
|
28
|
-
* Port number for the [HTTP.Server](https://nodejs.org/api/http.html#http_class_http_server).
|
|
29
|
-
*/
|
|
30
|
-
httpPort: string | number | boolean;
|
|
31
|
-
/**
|
|
32
|
-
* [Https.ServerOptions](https://nodejs.org/api/tls.html#tls_tls_createserver_options_secureconnectionlistener)):
|
|
33
|
-
* - `key` <string> | <string[]> | [<Buffer>](https://nodejs.org/api/buffer.html#buffer_class_buffer) | <Object[]>: The private key of the server in PEM format. To support multiple keys using different algorithms an array can be provided either as a plain array of key strings or an array of objects in the format `{pem: key, passphrase: passphrase}`. This option is required for ciphers that make use of private keys.
|
|
34
|
-
* - `passphrase` <string> A string containing the passphrase for the private key or pfx.
|
|
35
|
-
* - `cert` <string> | <string[]> | [<Buffer>](https://nodejs.org/api/buffer.html#buffer_class_buffer) | [<Buffer[]>](https://nodejs.org/api/buffer.html#buffer_class_buffer): A string, Buffer, array of strings, or array of Buffers containing the certificate key of the server in PEM format. (Required)
|
|
36
|
-
* - `ca` <string> | <string[]> | [<Buffer>](https://nodejs.org/api/buffer.html#buffer_class_buffer) | [<Buffer[]>](https://nodejs.org/api/buffer.html#buffer_class_buffer): A string, Buffer, array of strings, or array of Buffers of trusted certificates in PEM format. If this is omitted several well known "root" CAs (like VeriSign) will be used. These are used to authorize connections.
|
|
37
|
-
*/
|
|
38
|
-
httpOptions: Http.ServerOptions;
|
|
39
|
-
/**
|
|
40
|
-
* Port number for the [HTTPs.Server](https://nodejs.org/api/https.html#https_class_https_server).
|
|
41
|
-
*/
|
|
42
|
-
httpsPort: string | number | boolean;
|
|
43
|
-
/**
|
|
44
|
-
* [Https.ServerOptions](https://nodejs.org/api/tls.html#tls_tls_createserver_options_secureconnectionlistener)):
|
|
45
|
-
* - `key` <string> | <string[]> | [<Buffer>](https://nodejs.org/api/buffer.html#buffer_class_buffer) | <Object[]>: The private key of the server in PEM format. To support multiple keys using different algorithms an array can be provided either as a plain array of key strings or an array of objects in the format `{pem: key, passphrase: passphrase}`. This option is required for ciphers that make use of private keys.
|
|
46
|
-
* - `passphrase` <string> A string containing the passphrase for the private key or pfx.
|
|
47
|
-
* - `cert` <string> | <string[]> | [<Buffer>](https://nodejs.org/api/buffer.html#buffer_class_buffer) | [<Buffer[]>](https://nodejs.org/api/buffer.html#buffer_class_buffer): A string, Buffer, array of strings, or array of Buffers containing the certificate key of the server in PEM format. (Required)
|
|
48
|
-
* - `ca` <string> | <string[]> | [<Buffer>](https://nodejs.org/api/buffer.html#buffer_class_buffer) | [<Buffer[]>](https://nodejs.org/api/buffer.html#buffer_class_buffer): A string, Buffer, array of strings, or array of Buffers of trusted certificates in PEM format. If this is omitted several well known "root" CAs (like VeriSign) will be used. These are used to authorize connections.
|
|
49
|
-
*/
|
|
50
|
-
httpsOptions: Https.ServerOptions;
|
|
51
|
-
/**
|
|
52
|
-
* Mount all controllers under a directories to an endpoint.
|
|
53
|
-
*/
|
|
54
|
-
mount: EndpointDirectoriesSettings;
|
|
55
|
-
/**
|
|
56
|
-
* List of directories to scan [Services](/docs/services.md), [Middlewares](/docs/middlewares.md) or [Converters](/docs/converters.md).
|
|
57
|
-
*/
|
|
58
|
-
componentsScan: (string | RegExp)[];
|
|
59
|
-
/**
|
|
60
|
-
* Disable the glob pattern. In v7 the componentsScan options will be removed in favor of external module loader.
|
|
61
|
-
*/
|
|
62
|
-
disableComponentsScan: boolean;
|
|
63
|
-
/**
|
|
64
|
-
* List of glob patterns. Exclude all files which matching with this list when Server scan all components with the `mount` or `scanComponents` options.
|
|
65
|
-
*/
|
|
66
|
-
exclude: string[];
|
|
67
|
-
/**
|
|
68
|
-
* Configure the mimes accepted by default by the server.
|
|
69
|
-
*/
|
|
70
|
-
acceptMimes: string[];
|
|
71
|
-
/**
|
|
72
|
-
* Enable debug mode. By default debug is false.
|
|
73
|
-
*/
|
|
74
|
-
debug: boolean;
|
|
75
|
-
/**
|
|
76
|
-
* Converter configuration.
|
|
77
|
-
*/
|
|
78
|
-
converter: Partial<ConverterSettings>;
|
|
79
|
-
/**
|
|
80
|
-
* Logger configuration.
|
|
81
|
-
*/
|
|
82
|
-
logger?: LoggerConfiguration;
|
|
83
|
-
/**
|
|
84
|
-
* Object to mount all directories under to his endpoints. See more on [Serve Static](/tutorials/serve-static-files.md).
|
|
85
|
-
*/
|
|
86
|
-
statics: PlatformStaticsSettings;
|
|
87
|
-
/**
|
|
88
|
-
* Object configure Multer. See more on [Upload file](/tutorials/serve-static-files.md).
|
|
89
|
-
*/
|
|
90
|
-
multer: PlatformMulterSettings;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
export * from "./PlatformLoggerSettings";
|
|
95
|
-
export * from "./EndpointDirectoriesSettings";
|
|
96
|
-
export * from "./PlatformStaticsSettings";
|
|
97
|
-
export * from "./PlatformMulterSettings";
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Env, getHostInfoFromPort } from "@tsed/core";
|
|
3
|
-
import { DIConfiguration } from "@tsed/di";
|
|
4
|
-
import Https from "https";
|
|
5
|
-
import { EndpointDirectoriesSettings, PlatformLoggerSettings } from "../interfaces";
|
|
6
|
-
import { ConverterSettings } from "../interfaces/ConverterSettings";
|
|
7
|
-
/**
|
|
8
|
-
* `PlatformConfiguration` contains all information about your Server configuration.
|
|
9
|
-
*/
|
|
10
|
-
export declare class PlatformConfiguration extends DIConfiguration {
|
|
11
|
-
constructor();
|
|
12
|
-
get version(): string;
|
|
13
|
-
set version(v: string);
|
|
14
|
-
get rootDir(): string;
|
|
15
|
-
set rootDir(value: string);
|
|
16
|
-
get port(): string | number | false;
|
|
17
|
-
set port(value: string | number | false);
|
|
18
|
-
get httpsOptions(): Https.ServerOptions;
|
|
19
|
-
set httpsOptions(value: Https.ServerOptions);
|
|
20
|
-
get httpPort(): string | number | false;
|
|
21
|
-
set httpPort(value: string | number | false);
|
|
22
|
-
get httpsPort(): string | number | false;
|
|
23
|
-
set httpsPort(value: string | number | false);
|
|
24
|
-
get env(): Env;
|
|
25
|
-
set env(value: Env);
|
|
26
|
-
get mount(): EndpointDirectoriesSettings;
|
|
27
|
-
set mount(value: EndpointDirectoriesSettings);
|
|
28
|
-
get componentsScan(): string[];
|
|
29
|
-
set componentsScan(value: string[]);
|
|
30
|
-
get statics(): EndpointDirectoriesSettings;
|
|
31
|
-
set statics(value: EndpointDirectoriesSettings);
|
|
32
|
-
get acceptMimes(): string[];
|
|
33
|
-
set acceptMimes(value: string[]);
|
|
34
|
-
get debug(): boolean;
|
|
35
|
-
set debug(debug: boolean);
|
|
36
|
-
get converter(): Partial<ConverterSettings>;
|
|
37
|
-
set converter(options: Partial<ConverterSettings>);
|
|
38
|
-
get logger(): Partial<PlatformLoggerSettings>;
|
|
39
|
-
set logger(value: Partial<PlatformLoggerSettings>);
|
|
40
|
-
get exclude(): string[];
|
|
41
|
-
set exclude(exclude: string[]);
|
|
42
|
-
/**
|
|
43
|
-
*
|
|
44
|
-
* @returns {string|number}
|
|
45
|
-
*/
|
|
46
|
-
getHttpPort(): ReturnType<typeof getHostInfoFromPort>;
|
|
47
|
-
/**
|
|
48
|
-
*
|
|
49
|
-
* @param settings
|
|
50
|
-
*/
|
|
51
|
-
setHttpPort(settings: {
|
|
52
|
-
address: string;
|
|
53
|
-
port: number;
|
|
54
|
-
}): void;
|
|
55
|
-
/**
|
|
56
|
-
*
|
|
57
|
-
* @returns {string|number}
|
|
58
|
-
*/
|
|
59
|
-
getHttpsPort(): {
|
|
60
|
-
protocol: string;
|
|
61
|
-
address: string;
|
|
62
|
-
port: number;
|
|
63
|
-
toString(): string;
|
|
64
|
-
};
|
|
65
|
-
/**
|
|
66
|
-
*
|
|
67
|
-
* @param settings
|
|
68
|
-
*/
|
|
69
|
-
setHttpsPort(settings: {
|
|
70
|
-
address: string;
|
|
71
|
-
port: number;
|
|
72
|
-
}): void;
|
|
73
|
-
getBestHost(): {
|
|
74
|
-
protocol: string;
|
|
75
|
-
address: string;
|
|
76
|
-
port: number;
|
|
77
|
-
toString(): string;
|
|
78
|
-
} | {
|
|
79
|
-
toString(): string;
|
|
80
|
-
};
|
|
81
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const ROUTER_OPTIONS: unique symbol;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Type } from "@tsed/core";
|
|
3
|
-
import Http from "http";
|
|
4
|
-
/**
|
|
5
|
-
* Inject the Http.Server instance.
|
|
6
|
-
*
|
|
7
|
-
* ### Example
|
|
8
|
-
*
|
|
9
|
-
* ```typescript
|
|
10
|
-
* import {HttpServer, Service} from "@tsed/common";
|
|
11
|
-
*
|
|
12
|
-
* @Service()
|
|
13
|
-
* export default class OtherService {
|
|
14
|
-
* constructor(@HttpServer httpServer: HttpServer) {}
|
|
15
|
-
* }
|
|
16
|
-
* ```
|
|
17
|
-
*
|
|
18
|
-
* > Note: TypeScript transform and store `HttpServer` as `Function` type in the metadata. So to inject a factory, you must use the `@Inject(type)` decorator.
|
|
19
|
-
*
|
|
20
|
-
* @param {Type<any>} target
|
|
21
|
-
* @param {string} targetKey
|
|
22
|
-
* @param {TypedPropertyDescriptor<Function> | number} descriptor
|
|
23
|
-
* @returns {any}
|
|
24
|
-
* @decorator
|
|
25
|
-
* @deprecated Use Https.Server from "http"
|
|
26
|
-
*/
|
|
27
|
-
export declare function HttpServer(target: Type<any>, targetKey: string, descriptor: TypedPropertyDescriptor<Function> | number): any;
|
|
28
|
-
export declare type HttpServer = Http.Server;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Type } from "@tsed/core";
|
|
3
|
-
import Https from "https";
|
|
4
|
-
/**
|
|
5
|
-
* Inject the Https.Server instance.
|
|
6
|
-
*
|
|
7
|
-
* ### Example
|
|
8
|
-
*
|
|
9
|
-
* ```typescript
|
|
10
|
-
* import {HttpsServer, Service} from "@tsed/common";
|
|
11
|
-
*
|
|
12
|
-
* @Service()
|
|
13
|
-
* export default class OtherService {
|
|
14
|
-
* constructor(@HttpsServer httpServer: HttpServer) {}
|
|
15
|
-
* }
|
|
16
|
-
* ```
|
|
17
|
-
*
|
|
18
|
-
* > Note: TypeScript transform and store `HttpsServer` as `Function` type in the metadata. So to inject a factory, you must use the `@Inject(type)` decorator.
|
|
19
|
-
*
|
|
20
|
-
* @param {Type<any>} target
|
|
21
|
-
* @param {string} targetKey
|
|
22
|
-
* @param {TypedPropertyDescriptor<Function> | number} descriptor
|
|
23
|
-
* @returns {any}
|
|
24
|
-
* @decorator
|
|
25
|
-
* @deprecated Use Https.Server from "https"
|
|
26
|
-
*/
|
|
27
|
-
export declare function HttpsServer(target: Type<any>, targetKey: string, descriptor: TypedPropertyDescriptor<Function> | number): any;
|
|
28
|
-
export declare type HttpsServer = Https.Server;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export * from "./httpServer";
|
|
2
|
-
export * from "./httpsServer";
|
|
3
|
-
export * from "./multer";
|
|
4
|
-
export * from "./method/route";
|
|
5
|
-
export * from "./method/acceptMime";
|
|
6
|
-
export * from "./method/location";
|
|
7
|
-
export * from "./method/redirect";
|
|
8
|
-
export * from "./method/endpointFn";
|
|
9
|
-
export * from "./method/view";
|
|
10
|
-
export * from "./params/responseData";
|
|
11
|
-
export * from "./params/response";
|
|
12
|
-
export * from "./params/request";
|
|
13
|
-
export * from "./params/next";
|
|
14
|
-
export * from "./params/error";
|
|
15
|
-
export * from "./params/endpointInfo";
|
|
16
|
-
export * from "../utils/mapReturnedResponse";
|