@tsed/common 7.0.0-beta.2 → 7.0.0-beta.20
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/coverage.json +6 -0
- package/jest.config.js +9 -0
- package/lib/cjs/builder/PlatformBuilder.js +94 -65
- package/lib/cjs/builder/PlatformBuilder.js.map +1 -1
- package/lib/cjs/config/interfaces/PlatformLoggerSettings.js.map +1 -1
- package/lib/cjs/config/interfaces/PlatformMulterSettings.js.map +1 -1
- package/lib/cjs/config/services/PlatformConfiguration.js +2 -66
- package/lib/cjs/config/services/PlatformConfiguration.js.map +1 -1
- package/lib/cjs/decorators/multer/multipartFile.js.map +1 -1
- package/lib/cjs/decorators/params/error.js +1 -1
- package/lib/cjs/decorators/params/error.js.map +1 -1
- package/lib/cjs/domain/AnyToPromiseWithCtx.js +4 -5
- package/lib/cjs/domain/AnyToPromiseWithCtx.js.map +1 -1
- package/lib/cjs/domain/EndpointMetadata.js +2 -66
- package/lib/cjs/domain/EndpointMetadata.js.map +1 -1
- package/lib/cjs/domain/PlatformContext.js +46 -38
- package/lib/cjs/domain/PlatformContext.js.map +1 -1
- package/lib/cjs/domain/PlatformRouteDetails.js +0 -21
- package/lib/cjs/domain/PlatformRouteDetails.js.map +1 -1
- package/lib/cjs/exports.js +32 -0
- package/lib/cjs/exports.js.map +1 -0
- package/lib/cjs/index.js +58 -30
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/interfaces/PlatformRouteOptions.js.map +1 -1
- package/lib/cjs/interfaces/Route.js.map +1 -1
- package/lib/cjs/middlewares/PlatformAcceptMimesMiddleware.js +10 -9
- package/lib/cjs/middlewares/PlatformAcceptMimesMiddleware.js.map +1 -1
- package/lib/cjs/middlewares/PlatformMulterMiddleware.js +27 -13
- package/lib/cjs/middlewares/PlatformMulterMiddleware.js.map +1 -1
- package/lib/cjs/package.json +3 -0
- package/lib/cjs/services/FakeAdapter.js +49 -0
- package/lib/cjs/services/FakeAdapter.js.map +1 -0
- package/lib/cjs/services/Platform.js +33 -68
- package/lib/cjs/services/Platform.js.map +1 -1
- package/lib/cjs/services/PlatformAdapter.js +24 -0
- package/lib/cjs/services/PlatformAdapter.js.map +1 -0
- package/lib/cjs/services/PlatformApplication.js +26 -14
- package/lib/cjs/services/PlatformApplication.js.map +1 -1
- package/lib/cjs/services/PlatformHandler.js +115 -172
- package/lib/cjs/services/PlatformHandler.js.map +1 -1
- package/lib/cjs/services/PlatformMiddlewaresChain.js +46 -19
- package/lib/cjs/services/PlatformMiddlewaresChain.js.map +1 -1
- package/lib/cjs/services/PlatformRequest.js +17 -13
- package/lib/cjs/services/PlatformRequest.js.map +1 -1
- package/lib/cjs/services/PlatformResponse.js +20 -23
- package/lib/cjs/services/PlatformResponse.js.map +1 -1
- package/lib/cjs/services/PlatformTest.js +31 -10
- package/lib/cjs/services/PlatformTest.js.map +1 -1
- package/lib/cjs/utils/createContext.js +32 -21
- package/lib/cjs/utils/createContext.js.map +1 -1
- package/lib/cjs/utils/createHttpServer.js +6 -11
- package/lib/cjs/utils/createHttpServer.js.map +1 -1
- package/lib/cjs/utils/createHttpsServer.js +6 -11
- package/lib/cjs/utils/createHttpsServer.js.map +1 -1
- package/lib/cjs/utils/createInjector.js +16 -10
- package/lib/cjs/utils/createInjector.js.map +1 -1
- package/lib/cjs/utils/ensureContext.js +16 -0
- package/lib/cjs/utils/ensureContext.js.map +1 -0
- package/lib/cjs/utils/getConfiguration.js +6 -12
- package/lib/cjs/utils/getConfiguration.js.map +1 -1
- package/lib/cjs/utils/printRoutes.js +10 -8
- package/lib/cjs/utils/printRoutes.js.map +1 -1
- package/lib/cjs/utils/setResponseHeaders.js +8 -14
- package/lib/cjs/utils/setResponseHeaders.js.map +1 -1
- package/lib/esm/builder/PlatformBuilder.js +74 -68
- package/lib/esm/builder/PlatformBuilder.js.map +1 -1
- package/lib/esm/config/interfaces/PlatformLoggerSettings.js.map +1 -1
- package/lib/esm/config/interfaces/PlatformMulterSettings.js.map +1 -1
- package/lib/esm/config/services/PlatformConfiguration.js +0 -64
- package/lib/esm/config/services/PlatformConfiguration.js.map +1 -1
- package/lib/esm/decorators/multer/multerFileSize.js +1 -1
- package/lib/esm/decorators/multer/multerOptions.js +1 -1
- package/lib/esm/decorators/multer/multipartFile.js +1 -1
- package/lib/esm/decorators/multer/multipartFile.js.map +1 -1
- package/lib/esm/decorators/params/error.js +1 -1
- package/lib/esm/decorators/params/error.js.map +1 -1
- package/lib/esm/domain/AnyToPromiseWithCtx.js +4 -5
- package/lib/esm/domain/AnyToPromiseWithCtx.js.map +1 -1
- package/lib/esm/domain/EndpointMetadata.js +1 -66
- package/lib/esm/domain/EndpointMetadata.js.map +1 -1
- package/lib/esm/domain/PlatformContext.js +49 -41
- package/lib/esm/domain/PlatformContext.js.map +1 -1
- package/lib/esm/domain/PlatformRouteDetails.js +1 -19
- package/lib/esm/domain/PlatformRouteDetails.js.map +1 -1
- package/lib/esm/exports.js +14 -0
- package/lib/esm/exports.js.map +1 -0
- package/lib/esm/index.js +58 -27
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/interfaces/PlatformRouteOptions.js.map +1 -1
- package/lib/esm/interfaces/Route.js.map +1 -1
- package/lib/esm/middlewares/PlatformAcceptMimesMiddleware.js +2 -1
- package/lib/esm/middlewares/PlatformAcceptMimesMiddleware.js.map +1 -1
- package/lib/esm/middlewares/PlatformMulterMiddleware.js +18 -5
- package/lib/esm/middlewares/PlatformMulterMiddleware.js.map +1 -1
- package/lib/esm/package.json +3 -0
- package/lib/esm/services/FakeAdapter.js +45 -0
- package/lib/esm/services/FakeAdapter.js.map +1 -0
- package/lib/esm/services/Platform.js +34 -69
- package/lib/esm/services/Platform.js.map +1 -1
- package/lib/esm/services/PlatformAdapter.js +20 -0
- package/lib/esm/services/PlatformAdapter.js.map +1 -0
- package/lib/esm/services/PlatformApplication.js +27 -15
- package/lib/esm/services/PlatformApplication.js.map +1 -1
- package/lib/esm/services/PlatformHandler.js +116 -173
- package/lib/esm/services/PlatformHandler.js.map +1 -1
- package/lib/esm/services/PlatformMiddlewaresChain.js +49 -22
- package/lib/esm/services/PlatformMiddlewaresChain.js.map +1 -1
- package/lib/esm/services/PlatformRequest.js +16 -12
- package/lib/esm/services/PlatformRequest.js.map +1 -1
- package/lib/esm/services/PlatformResponse.js +19 -22
- package/lib/esm/services/PlatformResponse.js.map +1 -1
- package/lib/esm/services/PlatformTest.js +34 -14
- package/lib/esm/services/PlatformTest.js.map +1 -1
- package/lib/esm/utils/createContext.js +33 -23
- package/lib/esm/utils/createContext.js.map +1 -1
- package/lib/esm/utils/createHttpServer.js +6 -11
- package/lib/esm/utils/createHttpServer.js.map +1 -1
- package/lib/esm/utils/createHttpsServer.js +6 -11
- package/lib/esm/utils/createHttpsServer.js.map +1 -1
- package/lib/esm/utils/createInjector.js +20 -14
- package/lib/esm/utils/createInjector.js.map +1 -1
- package/lib/esm/utils/ensureContext.js +12 -0
- package/lib/esm/utils/ensureContext.js.map +1 -0
- package/lib/esm/utils/getConfiguration.js +8 -14
- package/lib/esm/utils/getConfiguration.js.map +1 -1
- package/lib/esm/utils/printRoutes.js +10 -8
- package/lib/esm/utils/printRoutes.js.map +1 -1
- package/lib/esm/utils/setResponseHeaders.js +8 -14
- package/lib/esm/utils/setResponseHeaders.js.map +1 -1
- package/lib/types/builder/PlatformBuilder.d.ts +19 -17
- package/lib/types/config/interfaces/PlatformLoggerSettings.d.ts +2 -43
- package/lib/types/config/interfaces/PlatformMulterSettings.d.ts +6 -130
- package/lib/types/config/services/PlatformConfiguration.d.ts +6 -21
- package/lib/types/domain/AnyToPromiseWithCtx.d.ts +1 -9
- package/lib/types/domain/EndpointMetadata.d.ts +1 -50
- package/lib/types/domain/PlatformContext.d.ts +32 -18
- package/lib/types/domain/PlatformRouteDetails.d.ts +4 -20
- package/lib/types/exports.d.ts +13 -0
- package/lib/types/index.d.ts +56 -18
- package/lib/types/interfaces/PlatformRouteOptions.d.ts +1 -2
- package/lib/types/interfaces/Route.d.ts +2 -3
- package/lib/types/middlewares/PlatformMulterMiddleware.d.ts +8 -3
- package/lib/types/services/FakeAdapter.d.ts +31 -0
- package/lib/types/services/Platform.d.ts +9 -21
- package/lib/types/services/PlatformAdapter.d.ts +58 -0
- package/lib/types/services/PlatformApplication.d.ts +15 -7
- package/lib/types/services/PlatformHandler.d.ts +21 -59
- package/lib/types/services/PlatformMiddlewaresChain.d.ts +6 -3
- package/lib/types/services/PlatformRequest.d.ts +8 -10
- package/lib/types/services/PlatformResponse.d.ts +15 -19
- package/lib/types/services/PlatformTest.d.ts +5 -4
- package/lib/types/utils/createContext.d.ts +4 -1
- package/lib/types/utils/createHttpServer.d.ts +1 -1
- package/lib/types/utils/createHttpsServer.d.ts +3 -1
- package/lib/types/utils/createInjector.d.ts +5 -3
- package/lib/types/utils/ensureContext.d.ts +2 -0
- package/lib/types/utils/listenServer.d.ts +2 -0
- package/package.json +43 -26
- package/readme.md +52 -58
- package/tsconfig.compile.esm.json +2 -12
- package/lib/cjs/builder/PlatformControllerBuilder.js +0 -85
- package/lib/cjs/builder/PlatformControllerBuilder.js.map +0 -1
- package/lib/cjs/config/index.js +0 -7
- package/lib/cjs/config/index.js.map +0 -1
- package/lib/cjs/config/interfaces/EndpointDirectoriesSettings.js +0 -3
- package/lib/cjs/config/interfaces/EndpointDirectoriesSettings.js.map +0 -1
- package/lib/cjs/config/interfaces/index.js +0 -8
- package/lib/cjs/config/interfaces/index.js.map +0 -1
- package/lib/cjs/decorators/httpServer.js +0 -32
- package/lib/cjs/decorators/httpServer.js.map +0 -1
- package/lib/cjs/decorators/httpsServer.js +0 -32
- package/lib/cjs/decorators/httpsServer.js.map +0 -1
- package/lib/cjs/decorators/index.js +0 -21
- package/lib/cjs/decorators/index.js.map +0 -1
- package/lib/cjs/decorators/method/acceptMime.js +0 -28
- package/lib/cjs/decorators/method/acceptMime.js.map +0 -1
- package/lib/cjs/decorators/method/endpointFn.js +0 -15
- package/lib/cjs/decorators/method/endpointFn.js.map +0 -1
- package/lib/cjs/decorators/method/location.js +0 -6
- package/lib/cjs/decorators/method/location.js.map +0 -1
- package/lib/cjs/decorators/method/redirect.js +0 -6
- package/lib/cjs/decorators/method/redirect.js.map +0 -1
- package/lib/cjs/decorators/method/route.js +0 -13
- package/lib/cjs/decorators/method/route.js.map +0 -1
- package/lib/cjs/decorators/method/view.js +0 -34
- package/lib/cjs/decorators/method/view.js.map +0 -1
- package/lib/cjs/decorators/multer/index.js +0 -7
- package/lib/cjs/decorators/multer/index.js.map +0 -1
- package/lib/cjs/domain/ControllerProvider.js +0 -51
- package/lib/cjs/domain/ControllerProvider.js.map +0 -1
- package/lib/cjs/domain/HandlerMetadata.js +0 -57
- package/lib/cjs/domain/HandlerMetadata.js.map +0 -1
- package/lib/cjs/domain/index.js +0 -10
- package/lib/cjs/domain/index.js.map +0 -1
- package/lib/cjs/interfaces/PathType.js +0 -3
- package/lib/cjs/interfaces/PathType.js.map +0 -1
- package/lib/cjs/interfaces/PlatformAdapter.js +0 -3
- package/lib/cjs/interfaces/PlatformAdapter.js.map +0 -1
- package/lib/cjs/interfaces/index.js +0 -21
- package/lib/cjs/interfaces/index.js.map +0 -1
- package/lib/cjs/middlewares/__mock__/FakeCtrl.js +0 -12
- package/lib/cjs/middlewares/__mock__/FakeCtrl.js.map +0 -1
- package/lib/cjs/middlewares/bindEndpointMiddleware.js +0 -13
- package/lib/cjs/middlewares/bindEndpointMiddleware.js.map +0 -1
- package/lib/cjs/middlewares/index.js +0 -7
- package/lib/cjs/middlewares/index.js.map +0 -1
- package/lib/cjs/services/FakeRawDriver.js +0 -26
- package/lib/cjs/services/FakeRawDriver.js.map +0 -1
- package/lib/cjs/services/PlatformRouter.js +0 -126
- package/lib/cjs/services/PlatformRouter.js.map +0 -1
- package/lib/cjs/services/index.js +0 -12
- package/lib/cjs/services/index.js.map +0 -1
- package/lib/cjs/utils/createHandlerMetadata.js +0 -49
- package/lib/cjs/utils/createHandlerMetadata.js.map +0 -1
- package/lib/cjs/utils/index.js +0 -11
- package/lib/cjs/utils/index.js.map +0 -1
- package/lib/cjs/utils/useCtxHandler.js +0 -15
- package/lib/cjs/utils/useCtxHandler.js.map +0 -1
- package/lib/esm/builder/PlatformControllerBuilder.js +0 -79
- package/lib/esm/builder/PlatformControllerBuilder.js.map +0 -1
- package/lib/esm/config/index.js +0 -4
- package/lib/esm/config/index.js.map +0 -1
- package/lib/esm/config/interfaces/EndpointDirectoriesSettings.js +0 -2
- package/lib/esm/config/interfaces/EndpointDirectoriesSettings.js.map +0 -1
- package/lib/esm/config/interfaces/index.js +0 -5
- package/lib/esm/config/interfaces/index.js.map +0 -1
- package/lib/esm/decorators/httpServer.js +0 -28
- package/lib/esm/decorators/httpServer.js.map +0 -1
- package/lib/esm/decorators/httpsServer.js +0 -28
- package/lib/esm/decorators/httpsServer.js.map +0 -1
- package/lib/esm/decorators/index.js +0 -18
- package/lib/esm/decorators/index.js.map +0 -1
- package/lib/esm/decorators/method/acceptMime.js +0 -24
- package/lib/esm/decorators/method/acceptMime.js.map +0 -1
- package/lib/esm/decorators/method/endpointFn.js +0 -11
- package/lib/esm/decorators/method/endpointFn.js.map +0 -1
- package/lib/esm/decorators/method/location.js +0 -2
- package/lib/esm/decorators/method/location.js.map +0 -1
- package/lib/esm/decorators/method/redirect.js +0 -2
- package/lib/esm/decorators/method/redirect.js.map +0 -1
- package/lib/esm/decorators/method/route.js +0 -2
- package/lib/esm/decorators/method/route.js.map +0 -1
- package/lib/esm/decorators/method/view.js +0 -30
- package/lib/esm/decorators/method/view.js.map +0 -1
- package/lib/esm/decorators/multer/index.js +0 -4
- package/lib/esm/decorators/multer/index.js.map +0 -1
- package/lib/esm/domain/ControllerProvider.js +0 -47
- package/lib/esm/domain/ControllerProvider.js.map +0 -1
- package/lib/esm/domain/HandlerMetadata.js +0 -53
- package/lib/esm/domain/HandlerMetadata.js.map +0 -1
- package/lib/esm/domain/index.js +0 -7
- package/lib/esm/domain/index.js.map +0 -1
- package/lib/esm/interfaces/PathType.js +0 -2
- package/lib/esm/interfaces/PathType.js.map +0 -1
- package/lib/esm/interfaces/PlatformAdapter.js +0 -2
- package/lib/esm/interfaces/PlatformAdapter.js.map +0 -1
- package/lib/esm/interfaces/index.js +0 -18
- package/lib/esm/interfaces/index.js.map +0 -1
- package/lib/esm/middlewares/__mock__/FakeCtrl.js +0 -9
- package/lib/esm/middlewares/__mock__/FakeCtrl.js.map +0 -1
- package/lib/esm/middlewares/bindEndpointMiddleware.js +0 -9
- package/lib/esm/middlewares/bindEndpointMiddleware.js.map +0 -1
- package/lib/esm/middlewares/index.js +0 -4
- package/lib/esm/middlewares/index.js.map +0 -1
- package/lib/esm/services/FakeRawDriver.js +0 -22
- package/lib/esm/services/FakeRawDriver.js.map +0 -1
- package/lib/esm/services/PlatformRouter.js +0 -123
- package/lib/esm/services/PlatformRouter.js.map +0 -1
- package/lib/esm/services/index.js +0 -9
- package/lib/esm/services/index.js.map +0 -1
- package/lib/esm/utils/createHandlerMetadata.js +0 -45
- package/lib/esm/utils/createHandlerMetadata.js.map +0 -1
- package/lib/esm/utils/index.js +0 -8
- package/lib/esm/utils/index.js.map +0 -1
- package/lib/esm/utils/useCtxHandler.js +0 -11
- package/lib/esm/utils/useCtxHandler.js.map +0 -1
- package/lib/types/builder/PlatformControllerBuilder.d.ts +0 -17
- package/lib/types/config/index.d.ts +0 -3
- package/lib/types/config/interfaces/EndpointDirectoriesSettings.d.ts +0 -3
- package/lib/types/config/interfaces/index.d.ts +0 -97
- package/lib/types/decorators/httpServer.d.ts +0 -28
- package/lib/types/decorators/httpsServer.d.ts +0 -28
- package/lib/types/decorators/index.d.ts +0 -14
- package/lib/types/decorators/method/acceptMime.d.ts +0 -19
- package/lib/types/decorators/method/endpointFn.d.ts +0 -9
- package/lib/types/decorators/method/location.d.ts +0 -1
- package/lib/types/decorators/method/redirect.d.ts +0 -1
- package/lib/types/decorators/method/route.d.ts +0 -1
- package/lib/types/decorators/method/view.d.ts +0 -25
- package/lib/types/decorators/multer/index.d.ts +0 -3
- package/lib/types/domain/ControllerProvider.d.ts +0 -24
- package/lib/types/domain/HandlerMetadata.d.ts +0 -32
- package/lib/types/domain/index.d.ts +0 -6
- package/lib/types/interfaces/PathType.d.ts +0 -1
- package/lib/types/interfaces/PlatformAdapter.d.ts +0 -19
- package/lib/types/interfaces/index.d.ts +0 -17
- package/lib/types/middlewares/__mock__/FakeCtrl.d.ts +0 -2
- package/lib/types/middlewares/bindEndpointMiddleware.d.ts +0 -5
- package/lib/types/middlewares/index.d.ts +0 -3
- package/lib/types/services/FakeRawDriver.d.ts +0 -15
- package/lib/types/services/PlatformRouter.d.ts +0 -48
- package/lib/types/services/index.d.ts +0 -8
- package/lib/types/utils/createHandlerMetadata.d.ts +0 -8
- package/lib/types/utils/index.d.ts +0 -7
- package/lib/types/utils/useCtxHandler.d.ts +0 -13
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AcceptMime = void 0;
|
|
4
|
-
const core_1 = require("@tsed/core");
|
|
5
|
-
const schema_1 = require("@tsed/schema");
|
|
6
|
-
/**
|
|
7
|
-
* Set a mime list which are acceptable and checks if the specified content types are acceptable, based on the request’s Accept HTTP header field.
|
|
8
|
-
*
|
|
9
|
-
* ```typescript
|
|
10
|
-
* @Controller('/mypath')
|
|
11
|
-
* export class MyCtrl {
|
|
12
|
-
*
|
|
13
|
-
* @Get('/')
|
|
14
|
-
* @AcceptMime('application/json')
|
|
15
|
-
* public getResource(){}
|
|
16
|
-
* }
|
|
17
|
-
* ```
|
|
18
|
-
*
|
|
19
|
-
* @param mimes
|
|
20
|
-
* @decorator
|
|
21
|
-
* @operation
|
|
22
|
-
* @response
|
|
23
|
-
*/
|
|
24
|
-
function AcceptMime(...mimes) {
|
|
25
|
-
return (0, core_1.useDecorators)((0, schema_1.Produces)(...mimes), (0, core_1.StoreSet)("acceptMimes", mimes));
|
|
26
|
-
}
|
|
27
|
-
exports.AcceptMime = AcceptMime;
|
|
28
|
-
//# sourceMappingURL=acceptMime.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"acceptMime.js","sourceRoot":"","sources":["../../../../src/decorators/method/acceptMime.ts"],"names":[],"mappings":";;;AAAA,qCAAmD;AACnD,yCAAsC;AAEtC;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,UAAU,CAAC,GAAG,KAAe;IAC3C,OAAO,IAAA,oBAAa,EAAC,IAAA,iBAAQ,EAAC,GAAG,KAAK,CAAC,EAAE,IAAA,eAAQ,EAAC,aAAa,EAAE,KAAK,CAAC,CAAC,CAAC;AAC3E,CAAC;AAFD,gCAEC","sourcesContent":["import {StoreSet, useDecorators} from \"@tsed/core\";\nimport {Produces} from \"@tsed/schema\";\n\n/**\n * Set a mime list which are acceptable and checks if the specified content types are acceptable, based on the request’s Accept HTTP header field.\n *\n * ```typescript\n * @Controller('/mypath')\n * export class MyCtrl {\n *\n * @Get('/')\n * @AcceptMime('application/json')\n * public getResource(){}\n * }\n * ```\n *\n * @param mimes\n * @decorator\n * @operation\n * @response\n */\nexport function AcceptMime(...mimes: string[]): Function {\n return useDecorators(Produces(...mimes), StoreSet(\"acceptMimes\", mimes));\n}\n"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EndpointFn = void 0;
|
|
4
|
-
const schema_1 = require("@tsed/schema");
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
* @param fn
|
|
8
|
-
* @decorator
|
|
9
|
-
* @deprecated Deprecated since 2021-10-05. Use JsonEntityFn instead.
|
|
10
|
-
*/
|
|
11
|
-
function EndpointFn(fn) {
|
|
12
|
-
return (0, schema_1.JsonEntityFn)(fn);
|
|
13
|
-
}
|
|
14
|
-
exports.EndpointFn = EndpointFn;
|
|
15
|
-
//# sourceMappingURL=endpointFn.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"endpointFn.js","sourceRoot":"","sources":["../../../../src/decorators/method/endpointFn.ts"],"names":[],"mappings":";;;AACA,yCAA0C;AAG1C;;;;;GAKG;AACH,SAAgB,UAAU,CAAC,EAAyE;IAClG,OAAO,IAAA,qBAAY,EAAmB,EAAE,CAAQ,CAAC;AACnD,CAAC;AAFD,gCAEC","sourcesContent":["import {DecoratorParameters} from \"@tsed/core\";\nimport {JsonEntityFn} from \"@tsed/schema\";\nimport {EndpointMetadata} from \"../../domain\";\n\n/**\n *\n * @param fn\n * @decorator\n * @deprecated Deprecated since 2021-10-05. Use JsonEntityFn instead.\n */\nexport function EndpointFn(fn: (endpoint: EndpointMetadata, parameters: DecoratorParameters) => void): MethodDecorator {\n return JsonEntityFn<EndpointMetadata>(fn) as any;\n}\n"]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Location = void 0;
|
|
4
|
-
var schema_1 = require("@tsed/schema");
|
|
5
|
-
Object.defineProperty(exports, "Location", { enumerable: true, get: function () { return schema_1.Location; } });
|
|
6
|
-
//# sourceMappingURL=location.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"location.js","sourceRoot":"","sources":["../../../../src/decorators/method/location.ts"],"names":[],"mappings":";;;AAAA,uCAAsC;AAA9B,kGAAA,QAAQ,OAAA","sourcesContent":["export {Location} from \"@tsed/schema\";\n"]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Redirect = void 0;
|
|
4
|
-
var schema_1 = require("@tsed/schema");
|
|
5
|
-
Object.defineProperty(exports, "Redirect", { enumerable: true, get: function () { return schema_1.Redirect; } });
|
|
6
|
-
//# sourceMappingURL=redirect.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"redirect.js","sourceRoot":"","sources":["../../../../src/decorators/method/redirect.ts"],"names":[],"mappings":";;;AAAA,uCAAsC;AAA9B,kGAAA,QAAQ,OAAA","sourcesContent":["export {Redirect} from \"@tsed/schema\";\n"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.All = exports.Options = exports.Head = exports.Delete = exports.Patch = exports.Put = exports.Post = exports.Get = void 0;
|
|
4
|
-
var schema_1 = require("@tsed/schema");
|
|
5
|
-
Object.defineProperty(exports, "Get", { enumerable: true, get: function () { return schema_1.Get; } });
|
|
6
|
-
Object.defineProperty(exports, "Post", { enumerable: true, get: function () { return schema_1.Post; } });
|
|
7
|
-
Object.defineProperty(exports, "Put", { enumerable: true, get: function () { return schema_1.Put; } });
|
|
8
|
-
Object.defineProperty(exports, "Patch", { enumerable: true, get: function () { return schema_1.Patch; } });
|
|
9
|
-
Object.defineProperty(exports, "Delete", { enumerable: true, get: function () { return schema_1.Delete; } });
|
|
10
|
-
Object.defineProperty(exports, "Head", { enumerable: true, get: function () { return schema_1.Head; } });
|
|
11
|
-
Object.defineProperty(exports, "Options", { enumerable: true, get: function () { return schema_1.Options; } });
|
|
12
|
-
Object.defineProperty(exports, "All", { enumerable: true, get: function () { return schema_1.All; } });
|
|
13
|
-
//# sourceMappingURL=route.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../src/decorators/method/route.ts"],"names":[],"mappings":";;;AAAA,uCAA+E;AAAvE,6FAAA,GAAG,OAAA;AAAE,8FAAA,IAAI,OAAA;AAAE,6FAAA,GAAG,OAAA;AAAE,+FAAA,KAAK,OAAA;AAAE,gGAAA,MAAM,OAAA;AAAE,8FAAA,IAAI,OAAA;AAAE,iGAAA,OAAO,OAAA;AAAE,6FAAA,GAAG,OAAA","sourcesContent":["export {Get, Post, Put, Patch, Delete, Head, Options, All} from \"@tsed/schema\";\n"]}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.View = void 0;
|
|
4
|
-
const core_1 = require("@tsed/core");
|
|
5
|
-
/**
|
|
6
|
-
* Use a view and sends the rendered HTML string to the client. Optional parameter:
|
|
7
|
-
*
|
|
8
|
-
* * viewOptions, an object whose properties define local variables for the view.
|
|
9
|
-
*
|
|
10
|
-
* The view argument is a string that is the file path of the view file to render.
|
|
11
|
-
* This can be an absolute path, or a path relative to the views setting.
|
|
12
|
-
* If the path does not contain a file extension, then the view engine setting determines the file extension.
|
|
13
|
-
* If the path does contain a file extension, then Express will load the module for the specified template engine (via require())
|
|
14
|
-
* and render it using the loaded module’s __express function.
|
|
15
|
-
*
|
|
16
|
-
* For more information, see [Using template engines with Express](http://expressjs.com/guide/using-template-engines.html).
|
|
17
|
-
*
|
|
18
|
-
* > NOTE: The view argument performs file system operations like reading a file from disk and evaluating Node.js modules,
|
|
19
|
-
* and as so for security reasons should not contain input from the end-user.
|
|
20
|
-
*
|
|
21
|
-
* @param path Relative path to the view file.
|
|
22
|
-
* @param options Additional options
|
|
23
|
-
* @decorator
|
|
24
|
-
* @operation
|
|
25
|
-
* @response
|
|
26
|
-
* @ignores
|
|
27
|
-
* @deprecated Use View decorator from @tsed/platform-views instead.
|
|
28
|
-
*/
|
|
29
|
-
// istanbul ignore next
|
|
30
|
-
function View(path, options) {
|
|
31
|
-
return (0, core_1.StoreSet)("view", { path, options });
|
|
32
|
-
}
|
|
33
|
-
exports.View = View;
|
|
34
|
-
//# sourceMappingURL=view.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"view.js","sourceRoot":"","sources":["../../../../src/decorators/method/view.ts"],"names":[],"mappings":";;;AAAA,qCAAoC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,uBAAuB;AACvB,SAAgB,IAAI,CAAC,IAAY,EAAE,OAAgB;IACjD,OAAO,IAAA,eAAQ,EAAC,MAAM,EAAE,EAAC,IAAI,EAAE,OAAO,EAAC,CAAQ,CAAC;AAClD,CAAC;AAFD,oBAEC","sourcesContent":["import {StoreSet} from \"@tsed/core\";\n\n/**\n * Use a view and sends the rendered HTML string to the client. Optional parameter:\n *\n * * viewOptions, an object whose properties define local variables for the view.\n *\n * The view argument is a string that is the file path of the view file to render.\n * This can be an absolute path, or a path relative to the views setting.\n * If the path does not contain a file extension, then the view engine setting determines the file extension.\n * If the path does contain a file extension, then Express will load the module for the specified template engine (via require())\n * and render it using the loaded module’s __express function.\n *\n * For more information, see [Using template engines with Express](http://expressjs.com/guide/using-template-engines.html).\n *\n * > NOTE: The view argument performs file system operations like reading a file from disk and evaluating Node.js modules,\n * and as so for security reasons should not contain input from the end-user.\n *\n * @param path Relative path to the view file.\n * @param options Additional options\n * @decorator\n * @operation\n * @response\n * @ignores\n * @deprecated Use View decorator from @tsed/platform-views instead.\n */\n// istanbul ignore next\nexport function View(path: string, options?: Object): MethodDecorator {\n return StoreSet(\"view\", {path, options}) as any;\n}\n"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
(0, tslib_1.__exportStar)(require("./multerFileSize"), exports);
|
|
5
|
-
(0, tslib_1.__exportStar)(require("./multerOptions"), exports);
|
|
6
|
-
(0, tslib_1.__exportStar)(require("./multipartFile"), exports);
|
|
7
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/decorators/multer/index.ts"],"names":[],"mappings":";;;AAAA,gEAAiC;AACjC,+DAAgC;AAChC,+DAAgC","sourcesContent":["export * from \"./multerFileSize\";\nexport * from \"./multerOptions\";\nexport * from \"./multipartFile\";\n"]}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ControllerProvider = void 0;
|
|
4
|
-
const di_1 = require("@tsed/di");
|
|
5
|
-
const routerOptions_1 = require("../constants/routerOptions");
|
|
6
|
-
let AUTO_INC = 0;
|
|
7
|
-
class ControllerProvider extends di_1.Provider {
|
|
8
|
-
constructor(provide, options = {}) {
|
|
9
|
-
super(provide, options);
|
|
10
|
-
this.type = di_1.ProviderType.CONTROLLER;
|
|
11
|
-
this.tokenRouter = `${this.name}_ROUTER_${AUTO_INC++}`;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
*
|
|
15
|
-
*/
|
|
16
|
-
get routerOptions() {
|
|
17
|
-
return this.store.get(routerOptions_1.ROUTER_OPTIONS) || {};
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
*
|
|
21
|
-
* @param value
|
|
22
|
-
*/
|
|
23
|
-
set routerOptions(value) {
|
|
24
|
-
this.store.set(routerOptions_1.ROUTER_OPTIONS, value);
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
*
|
|
28
|
-
* @returns {any[]}
|
|
29
|
-
*/
|
|
30
|
-
get middlewares() {
|
|
31
|
-
return Object.assign({
|
|
32
|
-
use: [],
|
|
33
|
-
useAfter: [],
|
|
34
|
-
useBefore: []
|
|
35
|
-
}, this.store.get("middlewares", {}));
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
*
|
|
39
|
-
* @param middlewares
|
|
40
|
-
*/
|
|
41
|
-
set middlewares(middlewares) {
|
|
42
|
-
const mdlwrs = this.middlewares;
|
|
43
|
-
const concat = (key, a, b) => (a[key] = a[key].concat(b[key]));
|
|
44
|
-
Object.keys(middlewares).forEach((key) => {
|
|
45
|
-
concat(key, mdlwrs, middlewares);
|
|
46
|
-
});
|
|
47
|
-
this.store.set("middlewares", mdlwrs);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.ControllerProvider = ControllerProvider;
|
|
51
|
-
//# sourceMappingURL=ControllerProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ControllerProvider.js","sourceRoot":"","sources":["../../../src/domain/ControllerProvider.ts"],"names":[],"mappings":";;;AAAA,iCAAsF;AACtF,8DAA0D;AAE1D,IAAI,QAAQ,GAAG,CAAC,CAAC;AAEjB,MAAa,kBAA4B,SAAQ,aAAW;IAG1D,YAAY,OAAsB,EAAE,UAA6B,EAAE;QACjE,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,iBAAY,CAAC,UAAU,CAAC;QACpC,IAAI,CAAC,WAAW,GAAG,GAAG,IAAI,CAAC,IAAI,WAAW,QAAQ,EAAE,EAAE,CAAC;IACzD,CAAC;IAED;;OAEG;IACH,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,8BAAc,CAAC,IAAK,EAAU,CAAC;IACvD,CAAC;IAED;;;OAGG;IACH,IAAI,aAAa,CAAC,KAAU;QAC1B,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,8BAAc,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;IAED;;;OAGG;IACH,IAAI,WAAW;QACb,OAAO,MAAM,CAAC,MAAM,CAClB;YACE,GAAG,EAAE,EAAE;YACP,QAAQ,EAAE,EAAE;YACZ,SAAS,EAAE,EAAE;SACd,EACD,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,aAAa,EAAE,EAAE,CAAC,CAClC,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,IAAI,WAAW,CAAC,WAAkC;QAChD,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC;QAChC,MAAM,MAAM,GAAG,CAAC,GAAW,EAAE,CAAM,EAAE,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAEjF,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,GAAW,EAAE,EAAE;YAC/C,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IACxC,CAAC;CACF;AApDD,gDAoDC","sourcesContent":["import {ControllerMiddlewares, Provider, ProviderType, TokenProvider} from \"@tsed/di\";\nimport {ROUTER_OPTIONS} from \"../constants/routerOptions\";\n\nlet AUTO_INC = 0;\n\nexport class ControllerProvider<T = any> extends Provider<T> {\n readonly tokenRouter: string;\n\n constructor(provide: TokenProvider, options: Partial<Provider> = {}) {\n super(provide, options);\n this.type = ProviderType.CONTROLLER;\n this.tokenRouter = `${this.name}_ROUTER_${AUTO_INC++}`;\n }\n\n /**\n *\n */\n get routerOptions(): any {\n return this.store.get(ROUTER_OPTIONS) || ({} as any);\n }\n\n /**\n *\n * @param value\n */\n set routerOptions(value: any) {\n this.store.set(ROUTER_OPTIONS, value);\n }\n\n /**\n *\n * @returns {any[]}\n */\n get middlewares(): ControllerMiddlewares {\n return Object.assign(\n {\n use: [],\n useAfter: [],\n useBefore: []\n },\n this.store.get(\"middlewares\", {})\n );\n }\n\n /**\n *\n * @param middlewares\n */\n set middlewares(middlewares: ControllerMiddlewares) {\n const mdlwrs = this.middlewares;\n const concat = (key: string, a: any, b: any) => (a[key] = a[key].concat(b[key]));\n\n Object.keys(middlewares).forEach((key: string) => {\n concat(key, mdlwrs, middlewares);\n });\n this.store.set(\"middlewares\", mdlwrs);\n }\n}\n"]}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HandlerMetadata = void 0;
|
|
4
|
-
const core_1 = require("@tsed/core");
|
|
5
|
-
const di_1 = require("@tsed/di");
|
|
6
|
-
const platform_params_1 = require("@tsed/platform-params");
|
|
7
|
-
const schema_1 = require("@tsed/schema");
|
|
8
|
-
const HandlerType_1 = require("../interfaces/HandlerType");
|
|
9
|
-
class HandlerMetadata {
|
|
10
|
-
constructor(options) {
|
|
11
|
-
this.injectable = false;
|
|
12
|
-
this.type = HandlerType_1.HandlerType.RAW_FN;
|
|
13
|
-
this.hasNextFunction = false;
|
|
14
|
-
const { target, token, propertyKey, type, scope, routeOptions } = options;
|
|
15
|
-
this.type = type || target.type || HandlerType_1.HandlerType.RAW_FN;
|
|
16
|
-
this.scope = scope || di_1.ProviderScope.SINGLETON;
|
|
17
|
-
this.routeOptions = routeOptions || {};
|
|
18
|
-
const handler = propertyKey ? target.prototype[propertyKey] : target;
|
|
19
|
-
if (propertyKey) {
|
|
20
|
-
this.target = target;
|
|
21
|
-
this.token = token;
|
|
22
|
-
this.propertyKey = propertyKey;
|
|
23
|
-
this.hasNextFunction = this.hasParamType(platform_params_1.ParamTypes.NEXT_FN);
|
|
24
|
-
if (this.hasParamType(platform_params_1.ParamTypes.ERR)) {
|
|
25
|
-
this.type = HandlerType_1.HandlerType.ERR_MIDDLEWARE;
|
|
26
|
-
}
|
|
27
|
-
this.injectable = schema_1.JsonParameterStore.getParams(target, propertyKey).length > 0;
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
this.handler = handler;
|
|
31
|
-
}
|
|
32
|
-
if (!this.injectable) {
|
|
33
|
-
if (handler.length === 4) {
|
|
34
|
-
this.type = HandlerType_1.HandlerType.RAW_ERR_FN;
|
|
35
|
-
}
|
|
36
|
-
this.hasNextFunction = handler.length >= 3;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
get hasErrorParam() {
|
|
40
|
-
return this.type === HandlerType_1.HandlerType.ERR_MIDDLEWARE || this.type === HandlerType_1.HandlerType.RAW_ERR_FN;
|
|
41
|
-
}
|
|
42
|
-
getParams() {
|
|
43
|
-
return schema_1.JsonParameterStore.getParams(this.target, this.propertyKey) || [];
|
|
44
|
-
}
|
|
45
|
-
hasParamType(paramType) {
|
|
46
|
-
return this.getParams().findIndex((p) => p.paramType === paramType) > -1;
|
|
47
|
-
}
|
|
48
|
-
isFinal() {
|
|
49
|
-
var _a;
|
|
50
|
-
return ((_a = this.routeOptions) === null || _a === void 0 ? void 0 : _a.isFinal) || false;
|
|
51
|
-
}
|
|
52
|
-
toString() {
|
|
53
|
-
return [this.target && (0, core_1.nameOf)(this.target), this.propertyKey].filter(Boolean).join(".");
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
exports.HandlerMetadata = HandlerMetadata;
|
|
57
|
-
//# sourceMappingURL=HandlerMetadata.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HandlerMetadata.js","sourceRoot":"","sources":["../../../src/domain/HandlerMetadata.ts"],"names":[],"mappings":";;;AAAA,qCAAwC;AACxC,iCAAuC;AACvC,2DAAiD;AACjD,yCAAgD;AAChD,2DAAsD;AAYtD,MAAa,eAAe;IAY1B,YAAY,OAA+B;QARlC,eAAU,GAAY,KAAK,CAAC;QAC5B,SAAI,GAAgB,yBAAW,CAAC,MAAM,CAAC;QACvC,oBAAe,GAAY,KAAK,CAAC;QAOxC,MAAM,EAAC,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAC,GAAG,OAAO,CAAC;QAExE,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,MAAM,CAAC,IAAI,IAAI,yBAAW,CAAC,MAAM,CAAC;QACtD,IAAI,CAAC,KAAK,GAAG,KAAK,IAAI,kBAAa,CAAC,SAAS,CAAC;QAC9C,IAAI,CAAC,YAAY,GAAG,YAAY,IAAI,EAAE,CAAC;QACvC,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QAErE,IAAI,WAAW,EAAE;YACf,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;YACrB,IAAI,CAAC,KAAK,GAAG,KAAM,CAAC;YACpB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;YAC/B,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,YAAY,CAAC,4BAAU,CAAC,OAAO,CAAC,CAAC;YAE7D,IAAI,IAAI,CAAC,YAAY,CAAC,4BAAU,CAAC,GAAG,CAAC,EAAE;gBACrC,IAAI,CAAC,IAAI,GAAG,yBAAW,CAAC,cAAc,CAAC;aACxC;YAED,IAAI,CAAC,UAAU,GAAG,2BAAkB,CAAC,SAAS,CAAC,MAAa,EAAE,WAAW,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;SACvF;aAAM;YACL,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;SACxB;QAED,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YACpB,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;gBACxB,IAAI,CAAC,IAAI,GAAG,yBAAW,CAAC,UAAU,CAAC;aACpC;YACD,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC;SAC5C;IACH,CAAC;IAED,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,IAAI,KAAK,yBAAW,CAAC,cAAc,IAAI,IAAI,CAAC,IAAI,KAAK,yBAAW,CAAC,UAAU,CAAC;IAC1F,CAAC;IAEM,SAAS;QACd,OAAO,2BAAkB,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;IAC3E,CAAC;IAEM,YAAY,CAAC,SAAc;QAChC,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3E,CAAC;IAEM,OAAO;;QACZ,OAAO,CAAA,MAAA,IAAI,CAAC,YAAY,0CAAE,OAAO,KAAI,KAAK,CAAC;IAC7C,CAAC;IAED,QAAQ;QACN,OAAO,CAAC,IAAI,CAAC,MAAM,IAAI,IAAA,aAAM,EAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1F,CAAC;CACF;AA9DD,0CA8DC","sourcesContent":["import {nameOf, Type} from \"@tsed/core\";\nimport {ProviderScope} from \"@tsed/di\";\nimport {ParamTypes} from \"@tsed/platform-params\";\nimport {JsonParameterStore} from \"@tsed/schema\";\nimport {HandlerType} from \"../interfaces/HandlerType\";\nimport {PlatformRouteOptions, PlatformRouteWithoutHandlers} from \"../interfaces/PlatformRouteOptions\";\n\nexport interface HandlerMetadataOptions {\n target: (Type<any> | Function) & {type?: HandlerType};\n routeOptions?: PlatformRouteWithoutHandlers;\n token?: Type<any>;\n propertyKey?: string | symbol;\n scope?: ProviderScope;\n type?: HandlerType;\n}\n\nexport class HandlerMetadata {\n readonly target: any;\n readonly token: Type<any>;\n readonly propertyKey: string | symbol;\n readonly injectable: boolean = false;\n readonly type: HandlerType = HandlerType.RAW_FN;\n readonly hasNextFunction: boolean = false;\n readonly routeOptions: Partial<PlatformRouteOptions>;\n readonly scope: ProviderScope;\n\n handler: any;\n\n constructor(options: HandlerMetadataOptions) {\n const {target, token, propertyKey, type, scope, routeOptions} = options;\n\n this.type = type || target.type || HandlerType.RAW_FN;\n this.scope = scope || ProviderScope.SINGLETON;\n this.routeOptions = routeOptions || {};\n const handler = propertyKey ? target.prototype[propertyKey] : target;\n\n if (propertyKey) {\n this.target = target;\n this.token = token!;\n this.propertyKey = propertyKey;\n this.hasNextFunction = this.hasParamType(ParamTypes.NEXT_FN);\n\n if (this.hasParamType(ParamTypes.ERR)) {\n this.type = HandlerType.ERR_MIDDLEWARE;\n }\n\n this.injectable = JsonParameterStore.getParams(target as any, propertyKey).length > 0;\n } else {\n this.handler = handler;\n }\n\n if (!this.injectable) {\n if (handler.length === 4) {\n this.type = HandlerType.RAW_ERR_FN;\n }\n this.hasNextFunction = handler.length >= 3;\n }\n }\n\n get hasErrorParam() {\n return this.type === HandlerType.ERR_MIDDLEWARE || this.type === HandlerType.RAW_ERR_FN;\n }\n\n public getParams() {\n return JsonParameterStore.getParams(this.target, this.propertyKey) || [];\n }\n\n public hasParamType(paramType: any): boolean {\n return this.getParams().findIndex((p) => p.paramType === paramType) > -1;\n }\n\n public isFinal() {\n return this.routeOptions?.isFinal || false;\n }\n\n toString() {\n return [this.target && nameOf(this.target), this.propertyKey].filter(Boolean).join(\".\");\n }\n}\n"]}
|
package/lib/cjs/domain/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
(0, tslib_1.__exportStar)(require("./AnyToPromiseWithCtx"), exports);
|
|
5
|
-
(0, tslib_1.__exportStar)(require("./PlatformContext"), exports);
|
|
6
|
-
(0, tslib_1.__exportStar)(require("./PlatformRouteDetails"), exports);
|
|
7
|
-
(0, tslib_1.__exportStar)(require("./ControllerProvider"), exports);
|
|
8
|
-
(0, tslib_1.__exportStar)(require("./EndpointMetadata"), exports);
|
|
9
|
-
(0, tslib_1.__exportStar)(require("./HandlerMetadata"), exports);
|
|
10
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/domain/index.ts"],"names":[],"mappings":";;;AAAA,qEAAsC;AACtC,iEAAkC;AAClC,sEAAuC;AACvC,oEAAqC;AACrC,kEAAmC;AACnC,iEAAkC","sourcesContent":["export * from \"./AnyToPromiseWithCtx\";\nexport * from \"./PlatformContext\";\nexport * from \"./PlatformRouteDetails\";\nexport * from \"./ControllerProvider\";\nexport * from \"./EndpointMetadata\";\nexport * from \"./HandlerMetadata\";\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PathType.js","sourceRoot":"","sources":["../../../src/interfaces/PathType.ts"],"names":[],"mappings":"","sourcesContent":["export type PathType = string | RegExp | (string | RegExp)[];\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformAdapter.js","sourceRoot":"","sources":["../../../src/interfaces/PlatformAdapter.ts"],"names":[],"mappings":"","sourcesContent":["import {Type} from \"@tsed/core\";\nimport {IProvider} from \"@tsed/di\";\n\nexport interface PlatformAdapter<App = TsED.Application, Router = TsED.Router> {\n /**\n * Load providers in top priority\n */\n readonly providers: IProvider[];\n /**\n * Called after the injector instantiation\n */\n onInit?: () => any;\n beforeLoadRoutes?: () => Promise<any>;\n afterLoadRoutes?: () => Promise<any>;\n useRouter?: () => any;\n useContext?: () => any;\n}\n\nexport interface PlatformBuilderSettings<App = TsED.Application, Router = TsED.Router> extends Partial<TsED.Configuration> {\n adapter?: Type<PlatformAdapter<App, Router>>;\n}\n"]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
(0, tslib_1.__exportStar)(require("./ResponseErrorObject"), exports);
|
|
5
|
-
(0, tslib_1.__exportStar)(require("./HandlerType"), exports);
|
|
6
|
-
(0, tslib_1.__exportStar)(require("./PlatformRouteOptions"), exports);
|
|
7
|
-
(0, tslib_1.__exportStar)(require("./BeforeInit"), exports);
|
|
8
|
-
(0, tslib_1.__exportStar)(require("./AfterInit"), exports);
|
|
9
|
-
(0, tslib_1.__exportStar)(require("./AfterRoutesInit"), exports);
|
|
10
|
-
(0, tslib_1.__exportStar)(require("./BeforeListen"), exports);
|
|
11
|
-
(0, tslib_1.__exportStar)(require("./AfterListen"), exports);
|
|
12
|
-
(0, tslib_1.__exportStar)(require("./BeforeRoutesInit"), exports);
|
|
13
|
-
(0, tslib_1.__exportStar)(require("./AfterRoutesInit"), exports);
|
|
14
|
-
(0, tslib_1.__exportStar)(require("./OnRoutesInit"), exports);
|
|
15
|
-
(0, tslib_1.__exportStar)(require("./OnReady"), exports);
|
|
16
|
-
(0, tslib_1.__exportStar)(require("./OnRequest"), exports);
|
|
17
|
-
(0, tslib_1.__exportStar)(require("./OnResponse"), exports);
|
|
18
|
-
(0, tslib_1.__exportStar)(require("./Route"), exports);
|
|
19
|
-
(0, tslib_1.__exportStar)(require("./IncomingEvent"), exports);
|
|
20
|
-
(0, tslib_1.__exportStar)(require("./PlatformAdapter"), exports);
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":";;;AAAA,qEAAsC;AACtC,6DAA8B;AAC9B,sEAAuC;AACvC,4DAA6B;AAC7B,2DAA4B;AAC5B,iEAAkC;AAClC,8DAA+B;AAC/B,6DAA8B;AAC9B,kEAAmC;AACnC,iEAAkC;AAClC,8DAA+B;AAC/B,yDAA0B;AAC1B,2DAA4B;AAC5B,4DAA6B;AAC7B,uDAAwB;AACxB,+DAAgC;AAChC,iEAAkC","sourcesContent":["export * from \"./ResponseErrorObject\";\nexport * from \"./HandlerType\";\nexport * from \"./PlatformRouteOptions\";\nexport * from \"./BeforeInit\";\nexport * from \"./AfterInit\";\nexport * from \"./AfterRoutesInit\";\nexport * from \"./BeforeListen\";\nexport * from \"./AfterListen\";\nexport * from \"./BeforeRoutesInit\";\nexport * from \"./AfterRoutesInit\";\nexport * from \"./OnRoutesInit\";\nexport * from \"./OnReady\";\nexport * from \"./OnRequest\";\nexport * from \"./OnResponse\";\nexport * from \"./Route\";\nexport * from \"./IncomingEvent\";\nexport * from \"./PlatformAdapter\";\n"]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FakeCtrl = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const di_1 = require("@tsed/di");
|
|
6
|
-
let FakeCtrl = class FakeCtrl {
|
|
7
|
-
};
|
|
8
|
-
FakeCtrl = (0, tslib_1.__decorate)([
|
|
9
|
-
(0, di_1.Controller)("/")
|
|
10
|
-
], FakeCtrl);
|
|
11
|
-
exports.FakeCtrl = FakeCtrl;
|
|
12
|
-
//# sourceMappingURL=FakeCtrl.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FakeCtrl.js","sourceRoot":"","sources":["../../../../src/middlewares/__mock__/FakeCtrl.ts"],"names":[],"mappings":";;;;AAAA,iCAAoC;AAGpC,IAAa,QAAQ,GAArB,MAAa,QAAQ;CAAG,CAAA;AAAX,QAAQ;IADpB,IAAA,eAAU,EAAC,GAAG,CAAC;GACH,QAAQ,CAAG;AAAX,4BAAQ","sourcesContent":["import {Controller} from \"@tsed/di\";\n\n@Controller(\"/\")\nexport class FakeCtrl {}\n"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.bindEndpointMiddleware = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @ignore
|
|
6
|
-
*/
|
|
7
|
-
function bindEndpointMiddleware(endpoint) {
|
|
8
|
-
return (ctx) => {
|
|
9
|
-
ctx.endpoint = endpoint;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
exports.bindEndpointMiddleware = bindEndpointMiddleware;
|
|
13
|
-
//# sourceMappingURL=bindEndpointMiddleware.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bindEndpointMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/bindEndpointMiddleware.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACH,SAAgB,sBAAsB,CAAC,QAA0B;IAC/D,OAAO,CAAC,GAAoB,EAAE,EAAE;QAC9B,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC1B,CAAC,CAAC;AACJ,CAAC;AAJD,wDAIC","sourcesContent":["import type {EndpointMetadata, PlatformContext} from \"../domain\";\n\n/**\n * @ignore\n */\nexport function bindEndpointMiddleware(endpoint: EndpointMetadata) {\n return (ctx: PlatformContext) => {\n ctx.endpoint = endpoint;\n };\n}\n"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
(0, tslib_1.__exportStar)(require("./bindEndpointMiddleware"), exports);
|
|
5
|
-
(0, tslib_1.__exportStar)(require("./PlatformMulterMiddleware"), exports);
|
|
6
|
-
(0, tslib_1.__exportStar)(require("./PlatformAcceptMimesMiddleware"), exports);
|
|
7
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/middlewares/index.ts"],"names":[],"mappings":";;;AAAA,wEAAyC;AACzC,0EAA2C;AAC3C,+EAAgD","sourcesContent":["export * from \"./bindEndpointMiddleware\";\nexport * from \"./PlatformMulterMiddleware\";\nexport * from \"./PlatformAcceptMimesMiddleware\";\n"]}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createFakeRawDriver = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @ignore
|
|
6
|
-
*/
|
|
7
|
-
const createFakeRawDriver = () => {
|
|
8
|
-
// istanbul ignore next
|
|
9
|
-
function FakeRawDriver() { }
|
|
10
|
-
// istanbul ignore next
|
|
11
|
-
function use() {
|
|
12
|
-
return this;
|
|
13
|
-
}
|
|
14
|
-
FakeRawDriver.use = use;
|
|
15
|
-
FakeRawDriver.all = use;
|
|
16
|
-
FakeRawDriver.get = use;
|
|
17
|
-
FakeRawDriver.patch = use;
|
|
18
|
-
FakeRawDriver.post = use;
|
|
19
|
-
FakeRawDriver.put = use;
|
|
20
|
-
FakeRawDriver.head = use;
|
|
21
|
-
FakeRawDriver.delete = use;
|
|
22
|
-
FakeRawDriver.options = use;
|
|
23
|
-
return FakeRawDriver;
|
|
24
|
-
};
|
|
25
|
-
exports.createFakeRawDriver = createFakeRawDriver;
|
|
26
|
-
//# sourceMappingURL=FakeRawDriver.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FakeRawDriver.js","sourceRoot":"","sources":["../../../src/services/FakeRawDriver.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACI,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACtC,uBAAuB;IACvB,SAAS,aAAa,KAAI,CAAC;IAE3B,uBAAuB;IACvB,SAAS,GAAG;QACV,OAAO,IAAI,CAAC;IACd,CAAC;IAED,aAAa,CAAC,GAAG,GAAG,GAAG,CAAC;IACxB,aAAa,CAAC,GAAG,GAAG,GAAG,CAAC;IACxB,aAAa,CAAC,GAAG,GAAG,GAAG,CAAC;IACxB,aAAa,CAAC,KAAK,GAAG,GAAG,CAAC;IAC1B,aAAa,CAAC,IAAI,GAAG,GAAG,CAAC;IACzB,aAAa,CAAC,GAAG,GAAG,GAAG,CAAC;IACxB,aAAa,CAAC,IAAI,GAAG,GAAG,CAAC;IACzB,aAAa,CAAC,MAAM,GAAG,GAAG,CAAC;IAC3B,aAAa,CAAC,OAAO,GAAG,GAAG,CAAC;IAE5B,OAAO,aAAa,CAAC;AACvB,CAAC,CAAC;AApBW,QAAA,mBAAmB,uBAoB9B","sourcesContent":["/**\n * @ignore\n */\nexport const createFakeRawDriver = () => {\n // istanbul ignore next\n function FakeRawDriver() {}\n\n // istanbul ignore next\n function use() {\n return this;\n }\n\n FakeRawDriver.use = use;\n FakeRawDriver.all = use;\n FakeRawDriver.get = use;\n FakeRawDriver.patch = use;\n FakeRawDriver.post = use;\n FakeRawDriver.put = use;\n FakeRawDriver.head = use;\n FakeRawDriver.delete = use;\n FakeRawDriver.options = use;\n\n return FakeRawDriver;\n};\n"]}
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var PlatformRouter_1;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.PlatformRouter = exports.PLATFORM_ROUTER_OPTIONS = void 0;
|
|
5
|
-
const tslib_1 = require("tslib");
|
|
6
|
-
const di_1 = require("@tsed/di");
|
|
7
|
-
const util_1 = require("util");
|
|
8
|
-
const FakeRawDriver_1 = require("./FakeRawDriver");
|
|
9
|
-
const PlatformHandler_1 = require("./PlatformHandler");
|
|
10
|
-
/**
|
|
11
|
-
* @ignore
|
|
12
|
-
*/
|
|
13
|
-
exports.PLATFORM_ROUTER_OPTIONS = Symbol.for("PlatformRouterOptions");
|
|
14
|
-
/**
|
|
15
|
-
* Platform Router abstraction layer.
|
|
16
|
-
* @platform
|
|
17
|
-
*/
|
|
18
|
-
let PlatformRouter = PlatformRouter_1 = class PlatformRouter {
|
|
19
|
-
constructor(platformHandler) {
|
|
20
|
-
this.platformHandler = platformHandler;
|
|
21
|
-
this.isBuilt = false;
|
|
22
|
-
this.rawRouter = this.raw = PlatformRouter_1.createRawRouter();
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Create a new instance of PlatformRouter
|
|
26
|
-
* @param injector
|
|
27
|
-
* @param routerOptions
|
|
28
|
-
*/
|
|
29
|
-
static create(injector, routerOptions = {}) {
|
|
30
|
-
const locals = new Map();
|
|
31
|
-
locals.set(exports.PLATFORM_ROUTER_OPTIONS, routerOptions);
|
|
32
|
-
return injector.invoke(PlatformRouter_1, locals);
|
|
33
|
-
}
|
|
34
|
-
static createRawRouter() {
|
|
35
|
-
return (0, FakeRawDriver_1.createFakeRawDriver)();
|
|
36
|
-
}
|
|
37
|
-
callback() {
|
|
38
|
-
return this.raw;
|
|
39
|
-
}
|
|
40
|
-
getRouter() {
|
|
41
|
-
return this.rawRouter;
|
|
42
|
-
}
|
|
43
|
-
use(...handlers) {
|
|
44
|
-
// @ts-ignore
|
|
45
|
-
this.getRouter().use(...this.mapHandlers(handlers));
|
|
46
|
-
return this;
|
|
47
|
-
}
|
|
48
|
-
addRoute(options) {
|
|
49
|
-
const { method, path, handlers, ...opts } = options;
|
|
50
|
-
// @ts-ignore
|
|
51
|
-
this.getRouter()[method](path, ...this.mapHandlers(handlers, { method, path, ...opts }));
|
|
52
|
-
return this;
|
|
53
|
-
}
|
|
54
|
-
all(path, ...handlers) {
|
|
55
|
-
return this.addRoute({ method: "all", path, handlers, isFinal: true });
|
|
56
|
-
}
|
|
57
|
-
get(path, ...handlers) {
|
|
58
|
-
return this.addRoute({ method: "get", path, handlers, isFinal: true });
|
|
59
|
-
}
|
|
60
|
-
post(path, ...handlers) {
|
|
61
|
-
return this.addRoute({ method: "post", path, handlers, isFinal: true });
|
|
62
|
-
}
|
|
63
|
-
put(path, ...handlers) {
|
|
64
|
-
return this.addRoute({ method: "put", path, handlers, isFinal: true });
|
|
65
|
-
}
|
|
66
|
-
delete(path, ...handlers) {
|
|
67
|
-
return this.addRoute({ method: "delete", path, handlers, isFinal: true });
|
|
68
|
-
}
|
|
69
|
-
patch(path, ...handlers) {
|
|
70
|
-
return this.addRoute({ method: "patch", path, handlers, isFinal: true });
|
|
71
|
-
}
|
|
72
|
-
head(path, ...handlers) {
|
|
73
|
-
return this.addRoute({ method: "head", path, handlers, isFinal: true });
|
|
74
|
-
}
|
|
75
|
-
options(path, ...handlers) {
|
|
76
|
-
return this.addRoute({ method: "options", path, handlers, isFinal: true });
|
|
77
|
-
}
|
|
78
|
-
statics(path, options) {
|
|
79
|
-
return this;
|
|
80
|
-
}
|
|
81
|
-
multer(options) {
|
|
82
|
-
const m = require("multer")(options);
|
|
83
|
-
const makePromise = (multer, name) => {
|
|
84
|
-
// istanbul ignore next
|
|
85
|
-
if (!multer[name])
|
|
86
|
-
return;
|
|
87
|
-
const fn = multer[name];
|
|
88
|
-
multer[name] = function apply(...args) {
|
|
89
|
-
const middleware = Reflect.apply(fn, this, args);
|
|
90
|
-
return (req, res) => (0, util_1.promisify)(middleware)(req, res);
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
makePromise(m, "any");
|
|
94
|
-
makePromise(m, "array");
|
|
95
|
-
makePromise(m, "fields");
|
|
96
|
-
makePromise(m, "none");
|
|
97
|
-
makePromise(m, "single");
|
|
98
|
-
return m;
|
|
99
|
-
}
|
|
100
|
-
mapHandlers(handlers, options = {}) {
|
|
101
|
-
return handlers.reduce((list, handler, index) => {
|
|
102
|
-
if (typeof handler === "string") {
|
|
103
|
-
return list.concat(handler);
|
|
104
|
-
}
|
|
105
|
-
if (handler instanceof PlatformRouter_1) {
|
|
106
|
-
return list.concat(handler.callback());
|
|
107
|
-
}
|
|
108
|
-
return list.concat(this.platformHandler.createHandler(handler, {
|
|
109
|
-
...options,
|
|
110
|
-
isFinal: options.isFinal ? index === handlers.length - 1 : false
|
|
111
|
-
}));
|
|
112
|
-
}, []);
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
(0, tslib_1.__decorate)([
|
|
116
|
-
(0, di_1.Inject)(),
|
|
117
|
-
(0, tslib_1.__metadata)("design:type", di_1.InjectorService)
|
|
118
|
-
], PlatformRouter.prototype, "injector", void 0);
|
|
119
|
-
PlatformRouter = PlatformRouter_1 = (0, tslib_1.__decorate)([
|
|
120
|
-
(0, di_1.Injectable)({
|
|
121
|
-
scope: di_1.ProviderScope.INSTANCE
|
|
122
|
-
}),
|
|
123
|
-
(0, tslib_1.__metadata)("design:paramtypes", [PlatformHandler_1.PlatformHandler])
|
|
124
|
-
], PlatformRouter);
|
|
125
|
-
exports.PlatformRouter = PlatformRouter;
|
|
126
|
-
//# sourceMappingURL=PlatformRouter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformRouter.js","sourceRoot":"","sources":["../../../src/services/PlatformRouter.ts"],"names":[],"mappings":"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","sourcesContent":["import {Inject, Injectable, InjectorService, PathType, ProviderScope} from \"@tsed/di\";\nimport {promisify} from \"util\";\nimport {PlatformMulter, PlatformMulterSettings, PlatformStaticsOptions} from \"../config\";\nimport {PlatformRouteOptions, PlatformRouteWithoutHandlers} from \"../interfaces\";\nimport {createFakeRawDriver} from \"./FakeRawDriver\";\nimport {PlatformHandler} from \"./PlatformHandler\";\n\n/**\n * @ignore\n */\nexport const PLATFORM_ROUTER_OPTIONS = Symbol.for(\"PlatformRouterOptions\");\n\ndeclare global {\n namespace TsED {\n // @ts-ignore\n export interface Router {}\n }\n}\n\n/**\n * Platform Router abstraction layer.\n * @platform\n */\n@Injectable({\n scope: ProviderScope.INSTANCE\n})\nexport class PlatformRouter<Router = TsED.Router> {\n rawRouter: Router;\n raw: any;\n isBuilt: boolean = false;\n\n @Inject()\n injector: InjectorService;\n\n constructor(protected platformHandler: PlatformHandler) {\n this.rawRouter = this.raw = PlatformRouter.createRawRouter();\n }\n\n /**\n * Create a new instance of PlatformRouter\n * @param injector\n * @param routerOptions\n */\n static create(injector: InjectorService, routerOptions: any = {}) {\n const locals = new Map();\n locals.set(PLATFORM_ROUTER_OPTIONS, routerOptions);\n\n return injector.invoke<PlatformRouter>(PlatformRouter, locals);\n }\n\n protected static createRawRouter(): any {\n return createFakeRawDriver();\n }\n\n callback(): any {\n return this.raw;\n }\n\n getRouter(): Router {\n return this.rawRouter;\n }\n\n use(...handlers: any[]) {\n // @ts-ignore\n this.getRouter().use(...this.mapHandlers(handlers));\n\n return this;\n }\n\n addRoute(options: Partial<PlatformRouteOptions>) {\n const {method, path, handlers, ...opts} = options;\n\n // @ts-ignore\n this.getRouter()[method](path, ...this.mapHandlers(handlers, {method, path, ...opts}));\n\n return this;\n }\n\n all(path: PathType, ...handlers: any[]) {\n return this.addRoute({method: \"all\", path, handlers, isFinal: true});\n }\n\n get(path: PathType, ...handlers: any[]) {\n return this.addRoute({method: \"get\", path, handlers, isFinal: true});\n }\n\n post(path: PathType, ...handlers: any[]) {\n return this.addRoute({method: \"post\", path, handlers, isFinal: true});\n }\n\n put(path: PathType, ...handlers: any[]) {\n return this.addRoute({method: \"put\", path, handlers, isFinal: true});\n }\n\n delete(path: PathType, ...handlers: any[]) {\n return this.addRoute({method: \"delete\", path, handlers, isFinal: true});\n }\n\n patch(path: PathType, ...handlers: any[]) {\n return this.addRoute({method: \"patch\", path, handlers, isFinal: true});\n }\n\n head(path: PathType, ...handlers: any[]) {\n return this.addRoute({method: \"head\", path, handlers, isFinal: true});\n }\n\n options(path: PathType, ...handlers: any[]) {\n return this.addRoute({method: \"options\", path, handlers, isFinal: true});\n }\n\n statics(path: string, options: PlatformStaticsOptions): this {\n return this;\n }\n\n multer(options: PlatformMulterSettings): PlatformMulter {\n const m = require(\"multer\")(options);\n\n const makePromise = (multer: any, name: string) => {\n // istanbul ignore next\n if (!multer[name]) return;\n\n const fn = multer[name];\n\n multer[name] = function apply(...args: any[]) {\n const middleware = Reflect.apply(fn, this, args);\n\n return (req: any, res: any) => promisify(middleware)(req, res);\n };\n };\n\n makePromise(m, \"any\");\n makePromise(m, \"array\");\n makePromise(m, \"fields\");\n makePromise(m, \"none\");\n makePromise(m, \"single\");\n\n return m;\n }\n\n protected mapHandlers(handlers: any[], options: PlatformRouteWithoutHandlers = {}): any[] {\n return handlers.reduce((list, handler, index) => {\n if (typeof handler === \"string\") {\n return list.concat(handler);\n }\n\n if (handler instanceof PlatformRouter) {\n return list.concat(handler.callback());\n }\n\n return list.concat(\n this.platformHandler.createHandler(handler, {\n ...options,\n isFinal: options.isFinal ? index === handlers.length - 1 : false\n })\n );\n }, []);\n }\n}\n"]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
(0, tslib_1.__exportStar)(require("./Platform"), exports);
|
|
5
|
-
(0, tslib_1.__exportStar)(require("./PlatformApplication"), exports);
|
|
6
|
-
(0, tslib_1.__exportStar)(require("./PlatformHandler"), exports);
|
|
7
|
-
(0, tslib_1.__exportStar)(require("./PlatformRequest"), exports);
|
|
8
|
-
(0, tslib_1.__exportStar)(require("./PlatformResponse"), exports);
|
|
9
|
-
(0, tslib_1.__exportStar)(require("./PlatformRouter"), exports);
|
|
10
|
-
(0, tslib_1.__exportStar)(require("./PlatformTest"), exports);
|
|
11
|
-
(0, tslib_1.__exportStar)(require("./PlatformMiddlewaresChain"), exports);
|
|
12
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/index.ts"],"names":[],"mappings":";;;AAAA,0DAA2B;AAC3B,qEAAsC;AACtC,iEAAkC;AAClC,iEAAkC;AAClC,kEAAmC;AACnC,gEAAiC;AACjC,8DAA+B;AAC/B,0EAA2C","sourcesContent":["export * from \"./Platform\";\nexport * from \"./PlatformApplication\";\nexport * from \"./PlatformHandler\";\nexport * from \"./PlatformRequest\";\nexport * from \"./PlatformResponse\";\nexport * from \"./PlatformRouter\";\nexport * from \"./PlatformTest\";\nexport * from \"./PlatformMiddlewaresChain\";\n"]}
|