@tsed/common 8.0.0-beta.2 → 8.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/esm/index.js +10 -63
- package/lib/esm/index.js.map +1 -1
- package/lib/types/index.d.ts +10 -63
- package/package.json +11 -32
- package/vitest.config.mts +5 -5
- package/.barrelsby.json +0 -5
- package/lib/esm/builder/PlatformBuilder.js +0 -308
- package/lib/esm/builder/PlatformBuilder.js.map +0 -1
- package/lib/esm/config/interfaces/PlatformJsonMapperSettings.js +0 -2
- package/lib/esm/config/interfaces/PlatformJsonMapperSettings.js.map +0 -1
- package/lib/esm/config/interfaces/PlatformMulterSettings.js +0 -2
- package/lib/esm/config/interfaces/PlatformMulterSettings.js.map +0 -1
- package/lib/esm/config/interfaces/PlatformRouterSettings.js +0 -2
- package/lib/esm/config/interfaces/PlatformRouterSettings.js.map +0 -1
- package/lib/esm/config/interfaces/PlatformStaticsSettings.js +0 -2
- package/lib/esm/config/interfaces/PlatformStaticsSettings.js.map +0 -1
- package/lib/esm/config/services/PlatformConfiguration.js +0 -119
- package/lib/esm/config/services/PlatformConfiguration.js.map +0 -1
- package/lib/esm/constants/routerOptions.js +0 -2
- package/lib/esm/constants/routerOptions.js.map +0 -1
- package/lib/esm/decorators/PlatformProvider.js +0 -7
- package/lib/esm/decorators/PlatformProvider.js.map +0 -1
- package/lib/esm/decorators/multer/multerFileSize.js +0 -31
- package/lib/esm/decorators/multer/multerFileSize.js.map +0 -1
- package/lib/esm/decorators/multer/multerOptions.js +0 -49
- package/lib/esm/decorators/multer/multerOptions.js.map +0 -1
- package/lib/esm/decorators/multer/multipartFile.js +0 -74
- package/lib/esm/decorators/multer/multipartFile.js.map +0 -1
- package/lib/esm/decorators/params/error.js +0 -16
- package/lib/esm/decorators/params/error.js.map +0 -1
- package/lib/esm/decorators/params/next.js +0 -17
- package/lib/esm/decorators/params/next.js.map +0 -1
- package/lib/esm/decorators/params/request.js +0 -34
- package/lib/esm/decorators/params/request.js.map +0 -1
- package/lib/esm/decorators/params/response.js +0 -28
- package/lib/esm/decorators/params/response.js.map +0 -1
- package/lib/esm/domain/AnyToPromiseWithCtx.js +0 -21
- package/lib/esm/domain/AnyToPromiseWithCtx.js.map +0 -1
- package/lib/esm/domain/EndpointMetadata.js +0 -2
- package/lib/esm/domain/EndpointMetadata.js.map +0 -1
- package/lib/esm/domain/PlatformContext.js +0 -69
- package/lib/esm/domain/PlatformContext.js.map +0 -1
- package/lib/esm/domain/PlatformRouteDetails.js +0 -2
- package/lib/esm/domain/PlatformRouteDetails.js.map +0 -1
- package/lib/esm/exports.js +0 -10
- package/lib/esm/exports.js.map +0 -1
- package/lib/esm/interfaces/AfterInit.js +0 -2
- package/lib/esm/interfaces/AfterInit.js.map +0 -1
- package/lib/esm/interfaces/AfterListen.js +0 -2
- package/lib/esm/interfaces/AfterListen.js.map +0 -1
- package/lib/esm/interfaces/AfterRoutesInit.js +0 -2
- package/lib/esm/interfaces/AfterRoutesInit.js.map +0 -1
- package/lib/esm/interfaces/BeforeInit.js +0 -2
- package/lib/esm/interfaces/BeforeInit.js.map +0 -1
- package/lib/esm/interfaces/BeforeListen.js +0 -2
- package/lib/esm/interfaces/BeforeListen.js.map +0 -1
- package/lib/esm/interfaces/BeforeRoutesInit.js +0 -2
- package/lib/esm/interfaces/BeforeRoutesInit.js.map +0 -1
- package/lib/esm/interfaces/HandlerType.js +0 -14
- package/lib/esm/interfaces/HandlerType.js.map +0 -1
- package/lib/esm/interfaces/IncomingEvent.js +0 -2
- package/lib/esm/interfaces/IncomingEvent.js.map +0 -1
- package/lib/esm/interfaces/OnReady.js +0 -2
- package/lib/esm/interfaces/OnReady.js.map +0 -1
- package/lib/esm/interfaces/OnRequest.js +0 -2
- package/lib/esm/interfaces/OnRequest.js.map +0 -1
- package/lib/esm/interfaces/OnResponse.js +0 -2
- package/lib/esm/interfaces/OnResponse.js.map +0 -1
- package/lib/esm/interfaces/OnRoutesInit.js +0 -2
- package/lib/esm/interfaces/OnRoutesInit.js.map +0 -1
- package/lib/esm/interfaces/PlatformRouteOptions.js +0 -2
- package/lib/esm/interfaces/PlatformRouteOptions.js.map +0 -1
- package/lib/esm/interfaces/ResponseErrorObject.js +0 -2
- package/lib/esm/interfaces/ResponseErrorObject.js.map +0 -1
- package/lib/esm/interfaces/Route.js +0 -2
- package/lib/esm/interfaces/Route.js.map +0 -1
- package/lib/esm/middlewares/PlatformAcceptMimesMiddleware.js +0 -36
- package/lib/esm/middlewares/PlatformAcceptMimesMiddleware.js.map +0 -1
- package/lib/esm/middlewares/PlatformMulterMiddleware.js +0 -66
- package/lib/esm/middlewares/PlatformMulterMiddleware.js.map +0 -1
- package/lib/esm/services/FakeAdapter.js +0 -2
- package/lib/esm/services/FakeAdapter.js.map +0 -1
- package/lib/esm/services/FakeResponse.js +0 -55
- package/lib/esm/services/FakeResponse.js.map +0 -1
- package/lib/esm/services/Platform.js +0 -73
- package/lib/esm/services/Platform.js.map +0 -1
- package/lib/esm/services/PlatformAdapter.js +0 -77
- package/lib/esm/services/PlatformAdapter.js.map +0 -1
- package/lib/esm/services/PlatformApplication.js +0 -41
- package/lib/esm/services/PlatformApplication.js.map +0 -1
- package/lib/esm/services/PlatformHandler.js +0 -130
- package/lib/esm/services/PlatformHandler.js.map +0 -1
- package/lib/esm/services/PlatformMiddlewaresChain.js +0 -57
- package/lib/esm/services/PlatformMiddlewaresChain.js.map +0 -1
- package/lib/esm/services/PlatformRequest.js +0 -141
- package/lib/esm/services/PlatformRequest.js.map +0 -1
- package/lib/esm/services/PlatformResponse.js +0 -306
- package/lib/esm/services/PlatformResponse.js.map +0 -1
- package/lib/esm/services/PlatformTest.js +0 -131
- package/lib/esm/services/PlatformTest.js.map +0 -1
- package/lib/esm/utils/closeServer.js +0 -4
- package/lib/esm/utils/closeServer.js.map +0 -1
- package/lib/esm/utils/createContext.js +0 -44
- package/lib/esm/utils/createContext.js.map +0 -1
- package/lib/esm/utils/createHttpServer.js +0 -13
- package/lib/esm/utils/createHttpServer.js.map +0 -1
- package/lib/esm/utils/createHttpsServer.js +0 -13
- package/lib/esm/utils/createHttpsServer.js.map +0 -1
- package/lib/esm/utils/createInjector.js +0 -41
- package/lib/esm/utils/createInjector.js.map +0 -1
- package/lib/esm/utils/createServer.js +0 -29
- package/lib/esm/utils/createServer.js.map +0 -1
- package/lib/esm/utils/ensureContext.js +0 -12
- package/lib/esm/utils/ensureContext.js.map +0 -1
- package/lib/esm/utils/getConfiguration.js +0 -32
- package/lib/esm/utils/getConfiguration.js.map +0 -1
- package/lib/esm/utils/getStaticsOptions.js +0 -17
- package/lib/esm/utils/getStaticsOptions.js.map +0 -1
- package/lib/esm/utils/listenServer.js +0 -10
- package/lib/esm/utils/listenServer.js.map +0 -1
- package/lib/esm/utils/mapReturnedResponse.js +0 -11
- package/lib/esm/utils/mapReturnedResponse.js.map +0 -1
- package/lib/esm/utils/printRoutes.js +0 -34
- package/lib/esm/utils/printRoutes.js.map +0 -1
- package/lib/esm/utils/registerPlatformAdapter.js +0 -7
- package/lib/esm/utils/registerPlatformAdapter.js.map +0 -1
- package/lib/esm/utils/setResponseHeaders.js +0 -25
- package/lib/esm/utils/setResponseHeaders.js.map +0 -1
- package/lib/types/builder/PlatformBuilder.d.ts +0 -100
- package/lib/types/config/interfaces/PlatformJsonMapperSettings.d.ts +0 -10
- package/lib/types/config/interfaces/PlatformMulterSettings.d.ts +0 -14
- package/lib/types/config/interfaces/PlatformRouterSettings.d.ts +0 -10
- package/lib/types/config/interfaces/PlatformStaticsSettings.d.ts +0 -17
- package/lib/types/config/services/PlatformConfiguration.d.ts +0 -67
- package/lib/types/constants/routerOptions.d.ts +0 -1
- package/lib/types/decorators/PlatformProvider.d.ts +0 -3
- package/lib/types/decorators/multer/multerFileSize.d.ts +0 -27
- package/lib/types/decorators/multer/multerOptions.d.ts +0 -42
- package/lib/types/decorators/multer/multipartFile.d.ts +0 -47
- package/lib/types/decorators/params/error.d.ts +0 -7
- package/lib/types/decorators/params/next.d.ts +0 -22
- package/lib/types/decorators/params/request.d.ts +0 -46
- package/lib/types/decorators/params/response.d.ts +0 -40
- package/lib/types/domain/AnyToPromiseWithCtx.d.ts +0 -10
- package/lib/types/domain/EndpointMetadata.d.ts +0 -1
- package/lib/types/domain/PlatformContext.d.ts +0 -80
- package/lib/types/domain/PlatformRouteDetails.d.ts +0 -7
- package/lib/types/exports.d.ts +0 -9
- package/lib/types/interfaces/AfterInit.d.ts +0 -3
- package/lib/types/interfaces/AfterListen.d.ts +0 -3
- package/lib/types/interfaces/AfterRoutesInit.d.ts +0 -3
- package/lib/types/interfaces/BeforeInit.d.ts +0 -3
- package/lib/types/interfaces/BeforeListen.d.ts +0 -3
- package/lib/types/interfaces/BeforeRoutesInit.d.ts +0 -3
- package/lib/types/interfaces/HandlerType.d.ts +0 -12
- package/lib/types/interfaces/IncomingEvent.d.ts +0 -6
- package/lib/types/interfaces/OnReady.d.ts +0 -3
- package/lib/types/interfaces/OnRequest.d.ts +0 -4
- package/lib/types/interfaces/OnResponse.d.ts +0 -4
- package/lib/types/interfaces/OnRoutesInit.d.ts +0 -3
- package/lib/types/interfaces/PlatformRouteOptions.d.ts +0 -15
- package/lib/types/interfaces/ResponseErrorObject.d.ts +0 -8
- package/lib/types/interfaces/Route.d.ts +0 -10
- package/lib/types/middlewares/PlatformAcceptMimesMiddleware.d.ts +0 -10
- package/lib/types/middlewares/PlatformMulterMiddleware.d.ts +0 -24
- package/lib/types/services/FakeAdapter.d.ts +0 -1
- package/lib/types/services/FakeResponse.d.ts +0 -22
- package/lib/types/services/Platform.d.ts +0 -25
- package/lib/types/services/PlatformAdapter.d.ts +0 -89
- package/lib/types/services/PlatformApplication.d.ts +0 -29
- package/lib/types/services/PlatformHandler.d.ts +0 -39
- package/lib/types/services/PlatformMiddlewaresChain.d.ts +0 -17
- package/lib/types/services/PlatformRequest.d.ts +0 -111
- package/lib/types/services/PlatformResponse.d.ts +0 -175
- package/lib/types/services/PlatformTest.d.ts +0 -61
- package/lib/types/utils/closeServer.d.ts +0 -7
- package/lib/types/utils/createContext.d.ts +0 -10
- package/lib/types/utils/createHttpServer.d.ts +0 -4
- package/lib/types/utils/createHttpsServer.d.ts +0 -4
- package/lib/types/utils/createInjector.d.ts +0 -8
- package/lib/types/utils/createServer.d.ts +0 -17
- package/lib/types/utils/ensureContext.d.ts +0 -2
- package/lib/types/utils/getConfiguration.d.ts +0 -2
- package/lib/types/utils/getStaticsOptions.d.ts +0 -5
- package/lib/types/utils/listenServer.d.ts +0 -8
- package/lib/types/utils/mapReturnedResponse.d.ts +0 -4
- package/lib/types/utils/printRoutes.d.ts +0 -2
- package/lib/types/utils/registerPlatformAdapter.d.ts +0 -3
- package/lib/types/utils/setResponseHeaders.d.ts +0 -5
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { __decorate, __metadata } from "tslib";
|
|
2
|
-
import { getHostInfoFromPort, isBoolean } from "@tsed/core";
|
|
3
|
-
import { DIConfiguration, Injectable, ProviderScope } from "@tsed/di";
|
|
4
|
-
import { JsonMapperSettings } from "@tsed/json-mapper";
|
|
5
|
-
const rootDir = process.cwd();
|
|
6
|
-
/**
|
|
7
|
-
* `PlatformConfiguration` contains all information about your Server configuration.
|
|
8
|
-
*/
|
|
9
|
-
let PlatformConfiguration = class PlatformConfiguration extends DIConfiguration {
|
|
10
|
-
constructor() {
|
|
11
|
-
super({ rootDir });
|
|
12
|
-
}
|
|
13
|
-
get port() {
|
|
14
|
-
return this.httpPort;
|
|
15
|
-
}
|
|
16
|
-
set port(value) {
|
|
17
|
-
this.httpPort = value;
|
|
18
|
-
}
|
|
19
|
-
get httpsOptions() {
|
|
20
|
-
return this.getRaw("httpsOptions");
|
|
21
|
-
}
|
|
22
|
-
set httpsOptions(value) {
|
|
23
|
-
this.setRaw("httpsOptions", value);
|
|
24
|
-
}
|
|
25
|
-
get httpPort() {
|
|
26
|
-
return this.getRaw("httpPort");
|
|
27
|
-
}
|
|
28
|
-
set httpPort(value) {
|
|
29
|
-
this.setRaw("httpPort", value);
|
|
30
|
-
}
|
|
31
|
-
get httpsPort() {
|
|
32
|
-
return this.getRaw("httpsPort");
|
|
33
|
-
}
|
|
34
|
-
set httpsPort(value) {
|
|
35
|
-
this.setRaw("httpsPort", value);
|
|
36
|
-
}
|
|
37
|
-
get mount() {
|
|
38
|
-
return this.get("mount");
|
|
39
|
-
}
|
|
40
|
-
set mount(value) {
|
|
41
|
-
this.setRaw("mount", value);
|
|
42
|
-
}
|
|
43
|
-
get statics() {
|
|
44
|
-
return this.getRaw("statics") || this.getRaw("serveStatic") || {};
|
|
45
|
-
}
|
|
46
|
-
set statics(value) {
|
|
47
|
-
this.setRaw("statics", value);
|
|
48
|
-
}
|
|
49
|
-
get acceptMimes() {
|
|
50
|
-
return this.getRaw("acceptMimes");
|
|
51
|
-
}
|
|
52
|
-
set acceptMimes(value) {
|
|
53
|
-
this.setRaw("acceptMimes", value || []);
|
|
54
|
-
}
|
|
55
|
-
get jsonMapper() {
|
|
56
|
-
return {
|
|
57
|
-
...JsonMapperSettings
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
set jsonMapper(options) {
|
|
61
|
-
JsonMapperSettings.strictGroups = Boolean(options.strictGroups);
|
|
62
|
-
JsonMapperSettings.disableUnsecureConstructor = Boolean(options.disableUnsecureConstructor);
|
|
63
|
-
JsonMapperSettings.additionalProperties = Boolean(isBoolean(options.additionalProperties) ? options.additionalProperties : options.additionalProperties === "accept");
|
|
64
|
-
}
|
|
65
|
-
get additionalProperties() {
|
|
66
|
-
return this.get("converter.additionalProperties") === "accept";
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
*
|
|
70
|
-
* @returns {string|number}
|
|
71
|
-
*/
|
|
72
|
-
getHttpPort() {
|
|
73
|
-
return getHostInfoFromPort("http", this.getRaw("httpPort"));
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
*
|
|
77
|
-
* @param settings
|
|
78
|
-
*/
|
|
79
|
-
setHttpPort(settings) {
|
|
80
|
-
this.setRaw("httpPort", `${settings.address}:${settings.port}`);
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
*
|
|
84
|
-
* @returns {string|number}
|
|
85
|
-
*/
|
|
86
|
-
getHttpsPort() {
|
|
87
|
-
return getHostInfoFromPort("https", this.getRaw("httpsPort"));
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
*
|
|
91
|
-
* @param settings
|
|
92
|
-
*/
|
|
93
|
-
setHttpsPort(settings) {
|
|
94
|
-
this.setRaw("httpsPort", `${settings.address}:${settings.port}`);
|
|
95
|
-
}
|
|
96
|
-
getBestHost() {
|
|
97
|
-
const { httpsPort, httpPort } = this;
|
|
98
|
-
if (httpsPort) {
|
|
99
|
-
return this.getHttpsPort();
|
|
100
|
-
}
|
|
101
|
-
if (httpPort) {
|
|
102
|
-
return this.getHttpPort();
|
|
103
|
-
}
|
|
104
|
-
return {
|
|
105
|
-
toString() {
|
|
106
|
-
return "/";
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
PlatformConfiguration = __decorate([
|
|
112
|
-
Injectable({
|
|
113
|
-
scope: ProviderScope.SINGLETON,
|
|
114
|
-
global: true
|
|
115
|
-
}),
|
|
116
|
-
__metadata("design:paramtypes", [])
|
|
117
|
-
], PlatformConfiguration);
|
|
118
|
-
export { PlatformConfiguration };
|
|
119
|
-
//# sourceMappingURL=PlatformConfiguration.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformConfiguration.js","sourceRoot":"","sources":["../../../../src/config/services/PlatformConfiguration.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,mBAAmB,EAAE,SAAS,EAAC,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAC,eAAe,EAAE,UAAU,EAAE,aAAa,EAAgB,MAAM,UAAU,CAAC;AACnF,OAAO,EAAC,kBAAkB,EAAC,MAAM,mBAAmB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C,CAAC,CAAC;IAChE,CAAC;IAED;;;OAGG;IACH,YAAY,CAAC,QAAyC;QACpD,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IACnE,CAAC;IAED,WAAW;QACT,MAAM,EAAC,SAAS,EAAE,QAAQ,EAAC,GAAG,IAAI,CAAC;QAEnC,IAAI,SAAS,EAAE,CAAC;YACd,OAAO,IAAI,CAAC,YAAY,EAAE,CAAC;QAC7B,CAAC;QAED,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;QAC5B,CAAC;QAED,OAAO;YACL,QAAQ;gBACN,OAAO,GAAG,CAAC;YACb,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AAhIY,qBAAqB;IAJjC,UAAU,CAAC;QACV,KAAK,EAAE,aAAa,CAAC,SAAS;QAC9B,MAAM,EAAE,IAAI;KACb,CAAC;;GACW,qBAAqB,CAgIjC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"routerOptions.js","sourceRoot":"","sources":["../../../src/constants/routerOptions.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformProvider.js","sourceRoot":"","sources":["../../../src/decorators/PlatformProvider.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,uBAAuB,EAAC,MAAM,qCAAqC,CAAC;AAE5E,MAAM,UAAU,gBAAgB;IAC9B,OAAO,CAAC,KAA4B,EAAE,EAAE;QACtC,uBAAuB,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { MulterOptions } from "./multerOptions.js";
|
|
2
|
-
/**
|
|
3
|
-
* Define file size limit.
|
|
4
|
-
*
|
|
5
|
-
* ```typescript
|
|
6
|
-
* import {Post} from "@tsed/schema";
|
|
7
|
-
* import {Controller, 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('/file2')
|
|
15
|
-
* @MulterFileSize(1024) // (Ko). Applied for all fields
|
|
16
|
-
* private uploadFile(@MultipartFile("file1") file: MulterFile, @MultipartFile("file2") file2: MulterFile) {
|
|
17
|
-
*
|
|
18
|
-
* }
|
|
19
|
-
* }
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* > See the tutorial on the [multer configuration](/tutorials/multer.md).
|
|
23
|
-
* @param fileSize
|
|
24
|
-
* @returns {(target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor}
|
|
25
|
-
* @decorator
|
|
26
|
-
* @multer
|
|
27
|
-
*/
|
|
28
|
-
export function MulterFileSize(fileSize) {
|
|
29
|
-
return MulterOptions({ limits: { fileSize } });
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=multerFileSize.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"multerFileSize.js","sourceRoot":"","sources":["../../../../src/decorators/multer/multerFileSize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,cAAc,CAAC,QAAgB;IAC7C,OAAO,aAAa,CAAC,EAAC,MAAM,EAAE,EAAC,QAAQ,EAAC,EAAC,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { StoreMerge } from "@tsed/core";
|
|
2
|
-
import { PlatformMulterMiddleware } from "../../middlewares/PlatformMulterMiddleware.js";
|
|
3
|
-
/**
|
|
4
|
-
* Define multer option for all MultipartFile
|
|
5
|
-
*
|
|
6
|
-
* ```typescript
|
|
7
|
-
* import {Controller, PlatformMulterFile, MultipartFile, MulterOptions} from "@tsed/common";
|
|
8
|
-
* import {Post} from "@tsed/schema";
|
|
9
|
-
*
|
|
10
|
-
* @Controller('/')
|
|
11
|
-
* class MyCtrl {
|
|
12
|
-
* @Post('/file')
|
|
13
|
-
* private uploadFile(@MultipartFile("file1") file: PlatformMulterFile) {
|
|
14
|
-
*
|
|
15
|
-
* }
|
|
16
|
-
*
|
|
17
|
-
* @Post('/file')
|
|
18
|
-
* @MulterOptions({dest: "/other-dir"})
|
|
19
|
-
* private uploadFile(@MultipartFile("file1") file: PlatformMulterFile) {
|
|
20
|
-
*
|
|
21
|
-
* }
|
|
22
|
-
*
|
|
23
|
-
* @Post('/file2')
|
|
24
|
-
* @MulterOptions({dest: "/other-dir"})
|
|
25
|
-
* private uploadFile(@MultipartFile("file1") file: PlatformMulterFile, @MultipartFile("file2") file2: PlatformMulterFile) {
|
|
26
|
-
*
|
|
27
|
-
* }
|
|
28
|
-
*
|
|
29
|
-
* @Post('/files')
|
|
30
|
-
* private uploadFile(@MultipartFile("file1") files: PlatformMulterFile[]) {
|
|
31
|
-
*
|
|
32
|
-
* }
|
|
33
|
-
* }
|
|
34
|
-
* ```
|
|
35
|
-
*
|
|
36
|
-
* See the tutorial on the [multer configuration](/tutorials/multer.md).
|
|
37
|
-
*
|
|
38
|
-
* @param {multer.Options} options
|
|
39
|
-
* @returns {(target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor}
|
|
40
|
-
* @decorator
|
|
41
|
-
* @multer
|
|
42
|
-
*/
|
|
43
|
-
export function MulterOptions(options) {
|
|
44
|
-
return (target, propertyKey, descriptor) => {
|
|
45
|
-
StoreMerge(PlatformMulterMiddleware, { options })(target, propertyKey, descriptor);
|
|
46
|
-
return descriptor;
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=multerOptions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"multerOptions.js","sourceRoot":"","sources":["../../../../src/decorators/multer/multerOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AAGtC,OAAO,EAAC,wBAAwB,EAAC,MAAM,+CAA+C,CAAC;AAEvF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,UAAU,aAAa,CAAC,OAA+B;IAC3D,OAAO,CAAC,MAAW,EAAE,WAAmB,EAAE,UAA8B,EAAE,EAAE;QAC1E,UAAU,CAAC,wBAAwB,EAAE,EAAC,OAAO,EAAC,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;QAEjF,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { Metadata, StoreMerge, useDecorators, useMethodDecorators } from "@tsed/core";
|
|
2
|
-
import { ParamTypes, UseParam } from "@tsed/platform-params";
|
|
3
|
-
import { InFile } from "@tsed/schema";
|
|
4
|
-
import { PlatformMulterMiddleware } from "../../middlewares/PlatformMulterMiddleware.js";
|
|
5
|
-
function mapOptions(name, maxCount) {
|
|
6
|
-
return {
|
|
7
|
-
fields: [
|
|
8
|
-
{
|
|
9
|
-
name,
|
|
10
|
-
maxCount
|
|
11
|
-
}
|
|
12
|
-
]
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Define a parameter as Multipart file.
|
|
17
|
-
*
|
|
18
|
-
* ```typescript
|
|
19
|
-
* import {Post} from "@tsed/schema";
|
|
20
|
-
* import {Controller, MulterOptions, MultipartFile} from "@tsed/common";
|
|
21
|
-
* import {Multer} from "@types/multer";
|
|
22
|
-
*
|
|
23
|
-
* type MulterFile = Express.Multer.File;
|
|
24
|
-
*
|
|
25
|
-
* @Controller('/')
|
|
26
|
-
* class MyCtrl {
|
|
27
|
-
* @Post('/file')
|
|
28
|
-
* private uploadFile(@MultipartFile("file1") file: MulterFile) {
|
|
29
|
-
*
|
|
30
|
-
* }
|
|
31
|
-
*
|
|
32
|
-
* @Post('/file')
|
|
33
|
-
* @MulterOptions({dest: "/other-dir"})
|
|
34
|
-
* private uploadFile(@MultipartFile("file1") file: MulterFile) {
|
|
35
|
-
*
|
|
36
|
-
* }
|
|
37
|
-
*
|
|
38
|
-
* @Post('/file2')
|
|
39
|
-
* @MulterOptions({dest: "/other-dir"})
|
|
40
|
-
* private uploadFile(@MultipartFile("file1") file: MulterFile, @MultipartFile("file2") file2: MulterFile) {
|
|
41
|
-
*
|
|
42
|
-
* }
|
|
43
|
-
*
|
|
44
|
-
* @Post('/files')
|
|
45
|
-
* private uploadFile(@MultipartFile("file1") files: MulterFile[]) {
|
|
46
|
-
*
|
|
47
|
-
* }
|
|
48
|
-
* }
|
|
49
|
-
* ```
|
|
50
|
-
*
|
|
51
|
-
* > See the tutorial on the [multer configuration](/tutorials/multer.md).
|
|
52
|
-
*
|
|
53
|
-
* @param name
|
|
54
|
-
* @param maxCount
|
|
55
|
-
* @returns Function
|
|
56
|
-
* @decorator
|
|
57
|
-
* @input
|
|
58
|
-
*/
|
|
59
|
-
export function MultipartFile(name, maxCount) {
|
|
60
|
-
return (...args) => {
|
|
61
|
-
const [target, propertyKey, index] = args;
|
|
62
|
-
const multiple = Metadata.getParamTypes(target, propertyKey)[index] === Array;
|
|
63
|
-
name = (typeof name === "object" ? undefined : name);
|
|
64
|
-
const expression = [name, !multiple && "0"].filter(Boolean).join(".");
|
|
65
|
-
const decorators = useDecorators(InFile(name), useMethodDecorators(StoreMerge(PlatformMulterMiddleware, mapOptions(name, maxCount))), UseParam({
|
|
66
|
-
paramType: ParamTypes.FILES,
|
|
67
|
-
dataPath: "$ctx.request.files",
|
|
68
|
-
expression,
|
|
69
|
-
useValidation: true
|
|
70
|
-
}));
|
|
71
|
-
decorators(...args);
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
//# sourceMappingURL=multipartFile.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"multipartFile.js","sourceRoot":"","sources":["../../../../src/decorators/multer/multipartFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,mBAAmB,EAAC,MAAM,YAAY,CAAC;AACzG,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAC,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AAGpC,OAAO,EAAqB,wBAAwB,EAAC,MAAM,+CAA+C,CAAC;AAE3G,SAAS,UAAU,CAAC,IAAY,EAAE,QAA4B;IAC5D,OAAO;QACL,MAAM,EAAE;YACN;gBACE,IAAI;gBACJ,QAAQ;aACT;SACF;KACF,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,QAAiB;IAC3D,OAAO,CAAC,GAAG,IAAyB,EAAQ,EAAE;QAC5C,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC;QAC1C,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,KAAe,CAAC,KAAK,KAAK,CAAC;QAExF,IAAI,GAAG,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAE,CAAC;QAEtD,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,CAAC,QAAQ,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAEtE,MAAM,UAAU,GAAG,aAAa,CAC9B,MAAM,CAAC,IAAI,CAAC,EACZ,mBAAmB,CAAC,UAAU,CAAC,wBAAwB,EAAE,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,EACrF,QAAQ,CAAC;YACP,SAAS,EAAE,UAAU,CAAC,KAAK;YAC3B,QAAQ,EAAE,oBAAoB;YAC9B,UAAU;YACV,aAAa,EAAE,IAAI;SACpB,CAAC,CACH,CAAC;QAEF,UAAU,CAAC,GAAG,IAAI,CAAC,CAAC;IACtB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ParamTypes, UseParam } from "@tsed/platform-params";
|
|
2
|
-
/**
|
|
3
|
-
* @returns {Function}
|
|
4
|
-
* @decorator
|
|
5
|
-
* @operation
|
|
6
|
-
* @input
|
|
7
|
-
*/
|
|
8
|
-
export function Err() {
|
|
9
|
-
return UseParam({
|
|
10
|
-
paramType: ParamTypes.ERR,
|
|
11
|
-
dataPath: "$ctx.error",
|
|
12
|
-
useValidation: false,
|
|
13
|
-
useMapper: false
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=error.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../../../src/decorators/params/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAC,MAAM,uBAAuB,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,UAAU,GAAG;IACjB,OAAO,QAAQ,CAAC;QACd,SAAS,EAAE,UAAU,CAAC,GAAG;QACzB,QAAQ,EAAE,YAAY;QACtB,aAAa,EAAE,KAAK;QACpB,SAAS,EAAE,KAAK;KACjB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ParamTypes, UseParam } from "@tsed/platform-params";
|
|
2
|
-
/**
|
|
3
|
-
* Get the Next function (for express application and middleware).
|
|
4
|
-
*
|
|
5
|
-
* @decorator
|
|
6
|
-
* @operation
|
|
7
|
-
* @input
|
|
8
|
-
*/
|
|
9
|
-
export function Next() {
|
|
10
|
-
return UseParam({
|
|
11
|
-
paramType: ParamTypes.NEXT_FN,
|
|
12
|
-
dataPath: "next",
|
|
13
|
-
useMapper: false,
|
|
14
|
-
useValidation: false
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=next.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"next.js","sourceRoot":"","sources":["../../../../src/decorators/params/next.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAC,MAAM,uBAAuB,CAAC;AAE3D;;;;;;GAMG;AACH,MAAM,UAAU,IAAI;IAClB,OAAO,QAAQ,CAAC;QACd,SAAS,EAAE,UAAU,CAAC,OAAO;QAC7B,QAAQ,EAAE,MAAM;QAChB,SAAS,EAAE,KAAK;QAChB,aAAa,EAAE,KAAK;KACrB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { isClass, Metadata, nameOf } from "@tsed/core";
|
|
2
|
-
import { mapParamsOptions, ParamTypes, UseParam } from "@tsed/platform-params";
|
|
3
|
-
import { IncomingMessage } from "http";
|
|
4
|
-
function getParamType(target, propertyKey, parameterIndex) {
|
|
5
|
-
const type = Metadata.getOwnParamTypes(target, propertyKey)[parameterIndex];
|
|
6
|
-
if (isClass(type)) {
|
|
7
|
-
if (nameOf(type) === "PlatformRequest") {
|
|
8
|
-
return { paramType: ParamTypes.PLATFORM_REQUEST, dataPath: "$ctx.request" };
|
|
9
|
-
}
|
|
10
|
-
if (type === IncomingMessage) {
|
|
11
|
-
return { paramType: ParamTypes.NODE_REQUEST, dataPath: "$ctx.request.req" };
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
return { paramType: ParamTypes.REQUEST, dataPath: "$ctx.request.request" };
|
|
15
|
-
}
|
|
16
|
-
export function Request(...args) {
|
|
17
|
-
// @ts-ignore
|
|
18
|
-
return Req(...args);
|
|
19
|
-
}
|
|
20
|
-
export function Req(...args) {
|
|
21
|
-
const { expression, useType, useMapper = false, useValidation = false } = mapParamsOptions(args);
|
|
22
|
-
return (target, propertyKey, parameterIndex) => {
|
|
23
|
-
const { paramType, dataPath } = getParamType(target, propertyKey, parameterIndex);
|
|
24
|
-
UseParam({
|
|
25
|
-
paramType,
|
|
26
|
-
dataPath,
|
|
27
|
-
expression,
|
|
28
|
-
useType,
|
|
29
|
-
useMapper,
|
|
30
|
-
useValidation
|
|
31
|
-
})(target, propertyKey, parameterIndex);
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=request.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../src/decorators/params/request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAO,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAC,gBAAgB,EAAgB,UAAU,EAAE,QAAQ,EAAC,MAAM,uBAAuB,CAAC;AAC3F,OAAO,EAAC,eAAe,EAAC,MAAM,MAAM,CAAC;AAErC,SAAS,YAAY,CAAC,MAAc,EAAE,WAAwC,EAAE,cAAsB;IACpG,MAAM,IAAI,GAAG,QAAQ,CAAC,gBAAgB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,cAAc,CAAC,CAAC;IAE5E,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QAClB,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,iBAAiB,EAAE,CAAC;YACvC,OAAO,EAAC,SAAS,EAAE,UAAU,CAAC,gBAAgB,EAAE,QAAQ,EAAE,cAAc,EAAC,CAAC;QAC5E,CAAC;QAED,IAAI,IAAI,KAAK,eAAe,EAAE,CAAC;YAC7B,OAAO,EAAC,SAAS,EAAE,UAAU,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,EAAC,CAAC;QAC5E,CAAC;IACH,CAAC;IAED,OAAO,EAAC,SAAS,EAAE,UAAU,CAAC,OAAO,EAAE,QAAQ,EAAE,sBAAsB,EAAC,CAAC;AAC3E,CAAC;AAcD,MAAM,UAAU,OAAO,CAAC,GAAG,IAAW;IACpC,aAAa;IACb,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;AACtB,CAAC;AAeD,MAAM,UAAU,GAAG,CAAC,GAAG,IAAW;IAChC,MAAM,EAAC,UAAU,EAAE,OAAO,EAAE,SAAS,GAAG,KAAK,EAAE,aAAa,GAAG,KAAK,EAAC,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAE/F,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,EAAE;QAC7C,MAAM,EAAC,SAAS,EAAE,QAAQ,EAAC,GAAG,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC;QAEhF,QAAQ,CAAC;YACP,SAAS;YACT,QAAQ;YACR,UAAU;YACV,OAAO;YACP,SAAS;YACT,aAAa;SACd,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC;IAC1C,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { isClass, Metadata, nameOf } from "@tsed/core";
|
|
2
|
-
import { ParamTypes, UseParam } from "@tsed/platform-params";
|
|
3
|
-
import { ServerResponse } from "http";
|
|
4
|
-
function getParamType(target, propertyKey, parameterIndex) {
|
|
5
|
-
const type = Metadata.getOwnParamTypes(target, propertyKey)[parameterIndex];
|
|
6
|
-
if (isClass(type)) {
|
|
7
|
-
if (nameOf(type) === "PlatformResponse") {
|
|
8
|
-
return { paramType: ParamTypes.PLATFORM_RESPONSE, dataPath: "$ctx.response" };
|
|
9
|
-
}
|
|
10
|
-
if (type === ServerResponse) {
|
|
11
|
-
return { paramType: ParamTypes.NODE_RESPONSE, dataPath: "$ctx.response.res" };
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
return { paramType: ParamTypes.RESPONSE, dataPath: "$ctx.response.response" };
|
|
15
|
-
}
|
|
16
|
-
export function Response() {
|
|
17
|
-
return Res();
|
|
18
|
-
}
|
|
19
|
-
export function Res() {
|
|
20
|
-
return (target, propertyKey, parameterIndex) => {
|
|
21
|
-
const { paramType, dataPath } = getParamType(target, propertyKey, parameterIndex);
|
|
22
|
-
UseParam({
|
|
23
|
-
paramType,
|
|
24
|
-
dataPath
|
|
25
|
-
})(target, propertyKey, parameterIndex);
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=response.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"response.js","sourceRoot":"","sources":["../../../../src/decorators/params/response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAC,MAAM,YAAY,CAAC;AACrD,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAC,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAC,cAAc,EAAC,MAAM,MAAM,CAAC;AAEpC,SAAS,YAAY,CAAC,MAAc,EAAE,WAAwC,EAAE,cAAsB;IACpG,MAAM,IAAI,GAAG,QAAQ,CAAC,gBAAgB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,cAAc,CAAC,CAAC;IAE5E,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QAClB,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,kBAAkB,EAAE,CAAC;YACxC,OAAO,EAAC,SAAS,EAAE,UAAU,CAAC,iBAAiB,EAAE,QAAQ,EAAE,eAAe,EAAC,CAAC;QAC9E,CAAC;QAED,IAAI,IAAI,KAAK,cAAc,EAAE,CAAC;YAC5B,OAAO,EAAC,SAAS,EAAE,UAAU,CAAC,aAAa,EAAE,QAAQ,EAAE,mBAAmB,EAAC,CAAC;QAC9E,CAAC;IACH,CAAC;IAED,OAAO,EAAC,SAAS,EAAE,UAAU,CAAC,QAAQ,EAAE,QAAQ,EAAE,wBAAwB,EAAC,CAAC;AAC9E,CAAC;AAWD,MAAM,UAAU,QAAQ;IACtB,OAAO,GAAG,EAAE,CAAC;AACf,CAAC;AAYD,MAAM,UAAU,GAAG;IACjB,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,EAAE;QAC7C,MAAM,EAAC,SAAS,EAAE,QAAQ,EAAC,GAAG,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC;QAChF,QAAQ,CAAC;YACP,SAAS;YACT,QAAQ;SACT,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC;IAC1C,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { AnyToPromise } from "@tsed/core";
|
|
2
|
-
export class AnyToPromiseWithCtx extends AnyToPromise {
|
|
3
|
-
constructor($ctx) {
|
|
4
|
-
super();
|
|
5
|
-
this.$ctx = $ctx;
|
|
6
|
-
}
|
|
7
|
-
isDone() {
|
|
8
|
-
const { $ctx } = this;
|
|
9
|
-
return $ctx?.isDone() || super.isDone();
|
|
10
|
-
}
|
|
11
|
-
call(cb) {
|
|
12
|
-
return super.call(() => cb(this));
|
|
13
|
-
}
|
|
14
|
-
destroy() {
|
|
15
|
-
this.$ctx = null;
|
|
16
|
-
}
|
|
17
|
-
isCanceledResponse(process) {
|
|
18
|
-
return process === this.$ctx.getResponse();
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=AnyToPromiseWithCtx.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AnyToPromiseWithCtx.js","sourceRoot":"","sources":["../../../src/domain/AnyToPromiseWithCtx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,YAAY,EAAC,MAAM,YAAY,CAAC;AAI1D,MAAM,OAAO,mBAAoB,SAAQ,YAAY;IAGnD,YAAY,IAAqB;QAC/B,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,MAAM;QACJ,MAAM,EAAC,IAAI,EAAC,GAAG,IAAI,CAAC;QAEpB,OAAO,IAAI,EAAE,MAAM,EAAE,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;IAC1C,CAAC;IAED,IAAI,CAAC,EAAY;QACf,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IACpC,CAAC;IAED,OAAO;QACJ,IAAI,CAAC,IAAY,GAAG,IAAI,CAAC;IAC5B,CAAC;IAED,kBAAkB,CAAC,OAAY;QAC7B,OAAO,OAAO,KAAK,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;IAC7C,CAAC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EndpointMetadata.js","sourceRoot":"","sources":["../../../src/domain/EndpointMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { DIContext } from "@tsed/di";
|
|
2
|
-
import { PlatformApplication } from "../services/PlatformApplication.js";
|
|
3
|
-
import { PlatformRequest } from "../services/PlatformRequest.js";
|
|
4
|
-
import { PlatformResponse } from "../services/PlatformResponse.js";
|
|
5
|
-
export class PlatformContext extends DIContext {
|
|
6
|
-
#isFinished;
|
|
7
|
-
constructor(options) {
|
|
8
|
-
super(options);
|
|
9
|
-
this.PLATFORM = "WWW";
|
|
10
|
-
this.#isFinished = false;
|
|
11
|
-
options.endpoint && (this.endpoint = options.endpoint);
|
|
12
|
-
this.event = options.event;
|
|
13
|
-
this.response = new (options.ResponseKlass || PlatformResponse)(this);
|
|
14
|
-
this.request = new (options.RequestKlass || PlatformRequest)(this);
|
|
15
|
-
this.request.request.$ctx = this;
|
|
16
|
-
this.request.request.id = this.id;
|
|
17
|
-
this.response.setHeader("x-request-id", this.id);
|
|
18
|
-
}
|
|
19
|
-
get url() {
|
|
20
|
-
return this.request.url;
|
|
21
|
-
}
|
|
22
|
-
get app() {
|
|
23
|
-
return this.injector.get(PlatformApplication);
|
|
24
|
-
}
|
|
25
|
-
start() {
|
|
26
|
-
return this.emit("$onRequest", this);
|
|
27
|
-
}
|
|
28
|
-
async finish() {
|
|
29
|
-
await Promise.all([this.emit("$onResponse", this), this.destroy()]);
|
|
30
|
-
this.#isFinished = true;
|
|
31
|
-
}
|
|
32
|
-
isFinished() {
|
|
33
|
-
return this.#isFinished;
|
|
34
|
-
}
|
|
35
|
-
isDone() {
|
|
36
|
-
return this.request?.isAborted() || this.response?.isDone() || this.isFinished();
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Return the framework request instance (Express, Koa, etc...)
|
|
40
|
-
*/
|
|
41
|
-
getRequest() {
|
|
42
|
-
return this.request.getRequest();
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Return the framework response instance (Express, Koa, etc...)
|
|
46
|
-
*/
|
|
47
|
-
getResponse() {
|
|
48
|
-
return this.response.getResponse();
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Get Node.js request
|
|
52
|
-
*/
|
|
53
|
-
getReq() {
|
|
54
|
-
return this.request.getReq();
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Get Node.js response
|
|
58
|
-
*/
|
|
59
|
-
getRes() {
|
|
60
|
-
return this.response.getRes();
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Return the original application instance.
|
|
64
|
-
*/
|
|
65
|
-
getApp() {
|
|
66
|
-
return this.app.getApp();
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
//# sourceMappingURL=PlatformContext.js.map
|
|
@@ -1 +0,0 @@
|
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CAAE,CAAC;IACtE,CAAC;IAED,KAAK;QACH,OAAO,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,MAAM;QACV,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QACpE,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC1B,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;IACnF,CAAC;IAED;;OAEG;IACH,UAAU;QACR,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAO,CAAC;IACxC,CAAC;IAED;;OAEG;IACH,WAAW;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAO,CAAC;IAC1C,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,EAAS,CAAC;IAClC,CAAC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformRouteDetails.js","sourceRoot":"","sources":["../../../src/domain/PlatformRouteDetails.ts"],"names":[],"mappings":""}
|
package/lib/esm/exports.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import "@tsed/logger";
|
|
2
|
-
import "@tsed/logger-file";
|
|
3
|
-
export * from "@tsed/di";
|
|
4
|
-
export { $log, Logger } from "@tsed/logger";
|
|
5
|
-
export * from "@tsed/platform-exceptions";
|
|
6
|
-
export * from "@tsed/platform-middlewares";
|
|
7
|
-
export * from "@tsed/platform-params";
|
|
8
|
-
export * from "@tsed/platform-response-filter";
|
|
9
|
-
export * from "@tsed/platform-router";
|
|
10
|
-
//# sourceMappingURL=exports.js.map
|
package/lib/esm/exports.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../../src/exports.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AACtB,OAAO,mBAAmB,CAAC;AAE3B,cAAc,UAAU,CAAC;AACzB,OAAO,EAAC,IAAI,EAAE,MAAM,EAAC,MAAM,cAAc,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AfterInit.js","sourceRoot":"","sources":["../../../src/interfaces/AfterInit.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AfterListen.js","sourceRoot":"","sources":["../../../src/interfaces/AfterListen.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AfterRoutesInit.js","sourceRoot":"","sources":["../../../src/interfaces/AfterRoutesInit.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BeforeInit.js","sourceRoot":"","sources":["../../../src/interfaces/BeforeInit.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BeforeListen.js","sourceRoot":"","sources":["../../../src/interfaces/BeforeListen.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BeforeRoutesInit.js","sourceRoot":"","sources":["../../../src/interfaces/BeforeRoutesInit.ts"],"names":[],"mappings":""}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @ignore
|
|
3
|
-
*/
|
|
4
|
-
export var HandlerType;
|
|
5
|
-
(function (HandlerType) {
|
|
6
|
-
HandlerType["CUSTOM"] = "custom";
|
|
7
|
-
HandlerType["ENDPOINT"] = "endpoint";
|
|
8
|
-
HandlerType["MIDDLEWARE"] = "middleware";
|
|
9
|
-
HandlerType["ERR_MIDDLEWARE"] = "err:middleware";
|
|
10
|
-
HandlerType["CTX_FN"] = "context";
|
|
11
|
-
HandlerType["RAW_FN"] = "raw:middleware";
|
|
12
|
-
HandlerType["RAW_ERR_FN"] = "raw:err:middleware";
|
|
13
|
-
})(HandlerType || (HandlerType = {}));
|
|
14
|
-
//# sourceMappingURL=HandlerType.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HandlerType.js","sourceRoot":"","sources":["../../../src/interfaces/HandlerType.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,WAQX;AARD,WAAY,WAAW;IACrB,gCAAiB,CAAA;IACjB,oCAAqB,CAAA;IACrB,wCAAyB,CAAA;IACzB,gDAAiC,CAAA;IACjC,iCAAkB,CAAA;IAClB,wCAAyB,CAAA;IACzB,gDAAiC,CAAA;AACnC,CAAC,EARW,WAAW,KAAX,WAAW,QAQtB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IncomingEvent.js","sourceRoot":"","sources":["../../../src/interfaces/IncomingEvent.ts"],"names":[],"mappings":""}
|