@tsed/common 7.0.0-beta.1 → 7.0.0-beta.12
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/cjs/builder/PlatformBuilder.js +48 -42
- package/lib/cjs/builder/PlatformBuilder.js.map +1 -1
- package/lib/cjs/builder/PlatformControllerBuilder.js +5 -8
- package/lib/cjs/builder/PlatformControllerBuilder.js.map +1 -1
- package/lib/cjs/config/interfaces/PlatformMulterSettings.js.map +1 -1
- package/lib/cjs/config/services/PlatformConfiguration.js +8 -2
- package/lib/cjs/config/services/PlatformConfiguration.js.map +1 -1
- package/lib/cjs/decorators/multer/multipartFile.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.map +1 -1
- package/lib/cjs/domain/PlatformRouteDetails.js.map +1 -1
- package/lib/cjs/exports.js +31 -0
- package/lib/cjs/exports.js.map +1 -0
- package/lib/cjs/index.js +64 -30
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/interfaces/PlatformRouteOptions.js.map +1 -1
- package/lib/cjs/middlewares/PlatformAcceptMimesMiddleware.js +8 -8
- package/lib/cjs/middlewares/PlatformAcceptMimesMiddleware.js.map +1 -1
- package/lib/cjs/middlewares/PlatformMulterMiddleware.js +25 -13
- package/lib/cjs/middlewares/PlatformMulterMiddleware.js.map +1 -1
- package/lib/cjs/middlewares/__mock__/FakeCtrl.js +1 -1
- package/lib/cjs/middlewares/bindEndpointMiddleware.js.map +1 -1
- package/lib/cjs/package.json +3 -0
- package/lib/cjs/services/FakeAdapter.js +55 -0
- package/lib/cjs/services/FakeAdapter.js.map +1 -0
- package/lib/cjs/services/Platform.js +30 -9
- package/lib/cjs/services/Platform.js.map +1 -1
- package/lib/cjs/services/PlatformAdapter.js +14 -0
- package/lib/cjs/services/PlatformAdapter.js.map +1 -0
- package/lib/cjs/services/PlatformApplication.js +9 -11
- package/lib/cjs/services/PlatformApplication.js.map +1 -1
- package/lib/cjs/services/PlatformHandler.js +11 -9
- package/lib/cjs/services/PlatformHandler.js.map +1 -1
- package/lib/cjs/services/PlatformMiddlewaresChain.js +56 -15
- package/lib/cjs/services/PlatformMiddlewaresChain.js.map +1 -1
- package/lib/cjs/services/PlatformRequest.js +2 -2
- package/lib/cjs/services/PlatformResponse.js +5 -5
- package/lib/cjs/services/PlatformResponse.js.map +1 -1
- package/lib/cjs/services/PlatformRouter.js +14 -32
- package/lib/cjs/services/PlatformRouter.js.map +1 -1
- package/lib/cjs/services/PlatformTest.js +10 -3
- package/lib/cjs/services/PlatformTest.js.map +1 -1
- package/lib/cjs/utils/__mock__/Test1.js +8 -0
- package/lib/cjs/utils/__mock__/Test1.js.map +1 -0
- package/lib/cjs/utils/__mock__/Test2.js +8 -0
- package/lib/cjs/utils/__mock__/Test2.js.map +1 -0
- package/lib/cjs/utils/__mock__/controllers/rest/TestCtrl.js +12 -0
- package/lib/cjs/utils/__mock__/controllers/rest/TestCtrl.js.map +1 -0
- package/lib/cjs/utils/__mock__/module1/Module1.js +19 -0
- package/lib/cjs/utils/__mock__/module1/Module1.js.map +1 -0
- package/lib/cjs/utils/__mock__/module1/controllers/M1Ctrl1.js +17 -0
- package/lib/cjs/utils/__mock__/module1/controllers/M1Ctrl1.js.map +1 -0
- package/lib/cjs/utils/__mock__/module1/services/M1Service.js +17 -0
- package/lib/cjs/utils/__mock__/module1/services/M1Service.js.map +1 -0
- package/lib/cjs/utils/__mock__/module1/submodule/SubModule.js +15 -0
- package/lib/cjs/utils/__mock__/module1/submodule/SubModule.js.map +1 -0
- package/lib/cjs/utils/__mock__/module1/submodule/SubService.js +12 -0
- package/lib/cjs/utils/__mock__/module1/submodule/SubService.js.map +1 -0
- package/lib/cjs/utils/__mock__/module2/Module2.js +18 -0
- package/lib/cjs/utils/__mock__/module2/Module2.js.map +1 -0
- package/lib/cjs/utils/__mock__/module2/controllers/M2Ctrl.js +12 -0
- package/lib/cjs/utils/__mock__/module2/controllers/M2Ctrl.js.map +1 -0
- package/lib/cjs/utils/createContext.js +2 -2
- package/lib/cjs/utils/createContext.js.map +1 -1
- package/lib/cjs/utils/createHandlerMetadata.js +2 -2
- package/lib/cjs/utils/createHandlerMetadata.js.map +1 -1
- package/lib/cjs/utils/createHttpServer.js +3 -8
- package/lib/cjs/utils/createHttpServer.js.map +1 -1
- package/lib/cjs/utils/createHttpsServer.js +3 -8
- package/lib/cjs/utils/createHttpsServer.js.map +1 -1
- package/lib/cjs/utils/createInjector.js +11 -3
- package/lib/cjs/utils/createInjector.js.map +1 -1
- package/lib/cjs/utils/getConfiguration.js +4 -0
- package/lib/cjs/utils/getConfiguration.js.map +1 -1
- package/lib/cjs/utils/setResponseHeaders.js.map +1 -1
- package/lib/esm/builder/PlatformBuilder.js +38 -32
- package/lib/esm/builder/PlatformBuilder.js.map +1 -1
- package/lib/esm/builder/PlatformControllerBuilder.js +8 -11
- package/lib/esm/builder/PlatformControllerBuilder.js.map +1 -1
- package/lib/esm/config/interfaces/PlatformMulterSettings.js.map +1 -1
- package/lib/esm/config/services/PlatformConfiguration.js +6 -0
- 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/domain/ControllerProvider.js +1 -1
- package/lib/esm/domain/EndpointMetadata.js +1 -66
- package/lib/esm/domain/EndpointMetadata.js.map +1 -1
- package/lib/esm/domain/HandlerMetadata.js +1 -1
- package/lib/esm/domain/PlatformContext.js +3 -3
- package/lib/esm/domain/PlatformContext.js.map +1 -1
- package/lib/esm/domain/PlatformRouteDetails.js.map +1 -1
- package/lib/esm/exports.js +13 -0
- package/lib/esm/exports.js.map +1 -0
- package/lib/esm/index.js +64 -27
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/interfaces/PlatformRouteOptions.js.map +1 -1
- package/lib/esm/middlewares/PlatformMulterMiddleware.js +16 -5
- package/lib/esm/middlewares/PlatformMulterMiddleware.js.map +1 -1
- package/lib/esm/middlewares/bindEndpointMiddleware.js.map +1 -1
- package/lib/esm/package.json +3 -0
- package/lib/esm/services/FakeAdapter.js +51 -0
- package/lib/esm/services/FakeAdapter.js.map +1 -0
- package/lib/esm/services/Platform.js +31 -10
- package/lib/esm/services/Platform.js.map +1 -1
- package/lib/esm/services/PlatformAdapter.js +10 -0
- package/lib/esm/services/PlatformAdapter.js.map +1 -0
- package/lib/esm/services/PlatformApplication.js +11 -13
- package/lib/esm/services/PlatformApplication.js.map +1 -1
- package/lib/esm/services/PlatformHandler.js +13 -11
- package/lib/esm/services/PlatformHandler.js.map +1 -1
- package/lib/esm/services/PlatformMiddlewaresChain.js +61 -20
- package/lib/esm/services/PlatformMiddlewaresChain.js.map +1 -1
- package/lib/esm/services/PlatformResponse.js +1 -1
- package/lib/esm/services/PlatformResponse.js.map +1 -1
- package/lib/esm/services/PlatformRouter.js +13 -31
- package/lib/esm/services/PlatformRouter.js.map +1 -1
- package/lib/esm/services/PlatformTest.js +14 -8
- package/lib/esm/services/PlatformTest.js.map +1 -1
- package/lib/esm/utils/__mock__/Test1.js +4 -0
- package/lib/esm/utils/__mock__/Test1.js.map +1 -0
- package/lib/esm/utils/__mock__/Test2.js +4 -0
- package/lib/esm/utils/__mock__/Test2.js.map +1 -0
- package/lib/esm/utils/__mock__/controllers/rest/TestCtrl.js +9 -0
- package/lib/esm/utils/__mock__/controllers/rest/TestCtrl.js.map +1 -0
- package/lib/esm/utils/__mock__/module1/Module1.js +16 -0
- package/lib/esm/utils/__mock__/module1/Module1.js.map +1 -0
- package/lib/esm/utils/__mock__/module1/controllers/M1Ctrl1.js +14 -0
- package/lib/esm/utils/__mock__/module1/controllers/M1Ctrl1.js.map +1 -0
- package/lib/esm/utils/__mock__/module1/services/M1Service.js +14 -0
- package/lib/esm/utils/__mock__/module1/services/M1Service.js.map +1 -0
- package/lib/esm/utils/__mock__/module1/submodule/SubModule.js +12 -0
- package/lib/esm/utils/__mock__/module1/submodule/SubModule.js.map +1 -0
- package/lib/esm/utils/__mock__/module1/submodule/SubService.js +9 -0
- package/lib/esm/utils/__mock__/module1/submodule/SubService.js.map +1 -0
- package/lib/esm/utils/__mock__/module2/Module2.js +15 -0
- package/lib/esm/utils/__mock__/module2/Module2.js.map +1 -0
- package/lib/esm/utils/__mock__/module2/controllers/M2Ctrl.js +9 -0
- package/lib/esm/utils/__mock__/module2/controllers/M2Ctrl.js.map +1 -0
- package/lib/esm/utils/createContext.js +5 -5
- package/lib/esm/utils/createContext.js.map +1 -1
- package/lib/esm/utils/createHandlerMetadata.js +3 -3
- package/lib/esm/utils/createHandlerMetadata.js.map +1 -1
- package/lib/esm/utils/createHttpServer.js +3 -8
- package/lib/esm/utils/createHttpServer.js.map +1 -1
- package/lib/esm/utils/createHttpsServer.js +3 -8
- package/lib/esm/utils/createHttpsServer.js.map +1 -1
- package/lib/esm/utils/createInjector.js +18 -10
- package/lib/esm/utils/createInjector.js.map +1 -1
- package/lib/esm/utils/getConfiguration.js +4 -0
- package/lib/esm/utils/getConfiguration.js.map +1 -1
- package/lib/esm/utils/setResponseHeaders.js.map +1 -1
- package/lib/esm/utils/useCtxHandler.js +1 -1
- package/lib/types/builder/PlatformBuilder.d.ts +9 -8
- package/lib/types/builder/PlatformControllerBuilder.d.ts +2 -1
- package/lib/types/config/interfaces/PlatformMulterSettings.d.ts +6 -130
- package/lib/types/config/services/PlatformConfiguration.d.ts +12 -6
- package/lib/types/domain/EndpointMetadata.d.ts +1 -50
- package/lib/types/domain/PlatformContext.d.ts +1 -1
- package/lib/types/domain/PlatformRouteDetails.d.ts +2 -3
- package/lib/types/exports.d.ts +12 -0
- package/lib/types/index.d.ts +61 -17
- package/lib/types/interfaces/PlatformRouteOptions.d.ts +1 -1
- package/lib/types/middlewares/PlatformMulterMiddleware.d.ts +8 -3
- package/lib/types/middlewares/bindEndpointMiddleware.d.ts +2 -1
- package/lib/types/services/FakeAdapter.d.ts +30 -0
- package/lib/types/services/Platform.d.ts +10 -1
- package/lib/types/services/PlatformAdapter.d.ts +47 -0
- package/lib/types/services/PlatformApplication.d.ts +3 -3
- package/lib/types/services/PlatformHandler.d.ts +1 -1
- package/lib/types/services/PlatformMiddlewaresChain.d.ts +6 -2
- package/lib/types/services/PlatformResponse.d.ts +6 -6
- package/lib/types/services/PlatformRouter.d.ts +10 -7
- package/lib/types/services/PlatformTest.d.ts +2 -2
- package/lib/types/utils/__mock__/Test1.d.ts +3 -0
- package/lib/types/utils/__mock__/Test2.d.ts +3 -0
- package/lib/types/utils/__mock__/controllers/rest/TestCtrl.d.ts +2 -0
- package/lib/types/utils/__mock__/module1/Module1.d.ts +2 -0
- package/lib/types/utils/__mock__/module1/controllers/M1Ctrl1.d.ts +5 -0
- package/lib/types/utils/__mock__/module1/services/M1Service.d.ts +5 -0
- package/lib/types/utils/__mock__/module1/submodule/SubModule.d.ts +2 -0
- package/lib/types/utils/__mock__/module1/submodule/SubService.d.ts +2 -0
- package/lib/types/utils/__mock__/module2/Module2.d.ts +2 -0
- package/lib/types/utils/__mock__/module2/controllers/M2Ctrl.d.ts +2 -0
- package/lib/types/utils/createHandlerMetadata.d.ts +1 -1
- package/lib/types/utils/createHttpServer.d.ts +1 -1
- package/lib/types/utils/createHttpsServer.d.ts +2 -1
- package/lib/types/utils/createInjector.d.ts +5 -3
- package/package.json +41 -26
- package/readme.md +52 -58
- package/tsconfig.compile.esm.json +2 -12
- 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/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/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/index.js +0 -12
- package/lib/cjs/services/index.js.map +0 -1
- package/lib/cjs/utils/index.js +0 -11
- package/lib/cjs/utils/index.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/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/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/index.js +0 -9
- package/lib/esm/services/index.js.map +0 -1
- package/lib/esm/utils/index.js +0 -8
- package/lib/esm/utils/index.js.map +0 -1
- 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/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/index.d.ts +0 -3
- package/lib/types/services/FakeRawDriver.d.ts +0 -15
- package/lib/types/services/index.d.ts +0 -8
- package/lib/types/utils/index.d.ts +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformTest.js","sourceRoot":"","sources":["../../../src/services/PlatformTest.ts"],"names":[],"mappings":";;;AAAA,iCAAgE;AAChE,gEAA2D;AAC3D,+DAAkF;AAClF,4DAAuD;AACvD,+DAA0D;AAC1D,gEAA2D;AAI3D;;GAEG;AACH,MAAa,YAAa,SAAQ,WAAM;IAGtC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,WAA0B,EAAE;QAC9C,WAAM,CAAC,QAAQ,GAAG,YAAY,CAAC,cAAc,CAAC,IAAA,mCAAgB,EAAC,QAAQ,CAAC,CAAC,CAAC;QAC1E,MAAM,WAAM,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;IACzC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,WAAgB,EAAE;QACtC,OAAO,IAAA,+BAAc,EAAC;YACpB,SAAS,EAAE,EAAE;YACb,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Ac,EAAE;SACnG,CAAC;QAEF,OAAO,IAAI,iCAAe,CAAC;YACzB,EAAE,EAAE,IAAI;YACR,QAAQ,EAAE,WAAM,CAAC,QAAQ;YACzB,MAAM,EAAE,WAAM,CAAC,QAAQ,CAAC,MAAM;YAC9B,GAAG,EAAE,GAAG;YACR,GAAG,OAAO;YACV,KAAK;SACN,CAAC,CAAC;IACL,CAAC;CACF;AAxKD,oCAwKC","sourcesContent":["import {DITest, DITestOptions, InjectorService} from \"@tsed/di\";\nimport {PlatformBuilder} from \"../builder/PlatformBuilder\";\nimport {PlatformContext, PlatformContextOptions} from \"../domain/PlatformContext\";\nimport {createInjector} from \"../utils/createInjector\";\nimport {PlatformApplication} from \"./PlatformApplication\";\nimport {getConfiguration} from \"../utils/getConfiguration\";\nimport {PlatformAdapter, PlatformBuilderSettings} from \"../interfaces/PlatformAdapter\";\nimport {Type} from \"@tsed/core\";\n\n/**\n * @platform\n */\nexport class PlatformTest extends DITest {\n public static adapter: Type<PlatformAdapter>;\n\n static async create(settings: DITestOptions = {}) {\n DITest.injector = PlatformTest.createInjector(getConfiguration(settings));\n await DITest.createContainer(settings);\n }\n\n /**\n * Create a new injector with the right default services\n */\n static createInjector(settings: any = {}): InjectorService {\n return createInjector({\n providers: [],\n settings: DITest.configure({httpPort: false, httpsPort: false, ...settings})\n });\n }\n\n /**\n * Load the server silently without listening port and configure it on test profile.\n * @decorator\n * @param mod\n * @param listen\n * @param settings\n * @returns {Promise<void>}\n */\n static bootstrap(mod: any, {listen, ...settings}: Partial<PlatformBuilderSettings & {listen: boolean}> = {}): () => Promise<void> {\n return async function before(): Promise<void> {\n let instance: PlatformBuilder;\n const adapter: Type<PlatformAdapter> = settings.platform || settings.adapter || PlatformTest.adapter;\n\n /* istanbul ignore next */\n if (!adapter) {\n throw new Error(\n \"Platform adapter is not specified. Have you added at least `import @tsed/platform-express` (or equivalent) on your Server.ts ?\"\n );\n }\n\n // @ts-ignore\n settings = DITest.configure(settings);\n settings.adapter = adapter as any;\n\n instance = await PlatformBuilder.build(mod, settings).bootstrap();\n await instance.listen(!!listen);\n\n // used by inject method\n DITest.injector = instance.injector;\n };\n }\n\n /**\n * It injects services into the test function where you can alter, spy on, and manipulate them.\n *\n * The inject function has two parameters\n *\n * * an array of Service dependency injection tokens,\n * * a test function whose parameters correspond exactly to each item in the injection token array.\n *\n * @param targets\n * @param func\n */\n static inject<T>(targets: any[], func: (...args: any[]) => Promise<T> | T): () => Promise<T> {\n return async (): Promise<T> => {\n if (!DITest.hasInjector()) {\n await PlatformTest.create();\n }\n\n const injector: InjectorService = DITest.injector;\n const deps = [];\n\n for (const target of targets) {\n deps.push(injector.has(target) ? injector.get(target) : await injector.invoke(target));\n }\n\n return await func(...deps);\n };\n }\n\n /**\n * Return the raw application (express or koa).\n * Use this callback with SuperTest.\n *\n * ```typescript\n * let request: SuperTest.SuperTest<SuperTest.Test>;\n * beforeEach(PlatformTest.bootstrap(Server, {\n * mount: {\n * \"/rest\": [ProductsController]\n * }\n * }));\n * beforeEach(() => {\n * request = SuperTest(PlatformTest.callback());\n * });\n * ```\n */\n static callback() {\n return DITest.injector.get<PlatformApplication>(PlatformApplication)?.callback();\n }\n\n static createRequest(options: any = {}): any {\n return {\n headers: {},\n get(key: string) {\n return this.headers[key.toLowerCase()];\n },\n accepts(mime?: string | string[]) {\n return require(\"accepts\")(this).types([].concat(mime as never));\n },\n ...options\n };\n }\n\n static createResponse(options: any = {}): any {\n return {\n headers: {},\n locals: {},\n statusCode: 200,\n status(code: number) {\n this.statusCode = code;\n return this;\n },\n contentType(content: string) {\n this.set(\"content-type\", content);\n },\n contentLength(content: number) {\n this.set(\"content-length\", content);\n },\n redirect(status: number, path: string) {\n this.statusCode = status;\n this.set(\"location\", path);\n },\n location(path: string) {\n this.set(\"location\", path);\n },\n get(key: string) {\n return this.headers[key.toLowerCase()];\n },\n getHeaders() {\n return this.headers;\n },\n set(key: string, value: any) {\n this.headers[key.toLowerCase()] = value;\n return this;\n },\n send(data: any) {\n this.data = data;\n },\n json(data: any) {\n this.data = data;\n },\n ...options\n };\n }\n\n static createRequestContext(options: Partial<PlatformContextOptions & any> = {}) {\n const event = {\n request: options?.request?.request || options?.event?.request || PlatformTest.createRequest(),\n response: options?.response?.response || options?.event?.response || PlatformTest.createResponse()\n };\n\n return new PlatformContext({\n id: \"id\",\n injector: DITest.injector,\n logger: DITest.injector.logger,\n url: \"/\",\n ...options,\n event\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PlatformTest.js","sourceRoot":"","sources":["../../../src/services/PlatformTest.ts"],"names":[],"mappings":";;;;AAAA,iCAAgE;AAEhE,gEAA2D;AAC3D,+DAAkF;AAClF,4DAAuD;AACvD,+DAA0D;AAC1D,gEAA2D;AAE3D,8DAA8B;AAE9B;;GAEG;AACH,MAAa,YAAa,SAAQ,WAAM;IAGtC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,WAA0B,EAAE;QAC9C,WAAM,CAAC,QAAQ,GAAG,YAAY,CAAC,cAAc,CAAC,IAAA,mCAAgB,EAAC,QAAQ,CAAC,CAAC,CAAC;QAC1E,MAAM,WAAM,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;IACzC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,WAAgB,EAAE;QACtC,OAAO,IAAA,+BAAc,EAAC;YACpB,QAAQ,EAAE,WAAM,CAAC,SAAS,CAAC,EAAC,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAC,CAAC;SAC7E,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,SAAS,CAAC,GAAQ,EAAE,EAAC,MAAM,EAAE,GAAG,QAAQ,KAA0D,EAAE;QACzG,OAAO,KAAK,UAAU,MAAM;YAC1B,IAAI,QAAyB,CAAC;YAC9B,MAAM,OAAO,GAA0B,QAAQ,CAAC,QAAQ,IAAI,QAAQ,CAAC,OAAO,IAAI,YAA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ACR,QAAQ,EAAE,WAAM,CAAC,QAAQ;YACzB,MAAM,EAAE,WAAM,CAAC,QAAQ,CAAC,MAAM;YAC9B,GAAG,EAAE,GAAG;YACR,GAAG,OAAO;YACV,KAAK;SACN,CAAC,CAAC;IACL,CAAC;CACF;AA/KD,oCA+KC","sourcesContent":["import {DITest, DITestOptions, InjectorService} from \"@tsed/di\";\nimport {Type} from \"@tsed/core\";\nimport {PlatformBuilder} from \"../builder/PlatformBuilder\";\nimport {PlatformContext, PlatformContextOptions} from \"../domain/PlatformContext\";\nimport {createInjector} from \"../utils/createInjector\";\nimport {PlatformApplication} from \"./PlatformApplication\";\nimport {getConfiguration} from \"../utils/getConfiguration\";\nimport {PlatformAdapter, PlatformBuilderSettings} from \"./PlatformAdapter\";\nimport accepts from \"accepts\";\n\n/**\n * @platform\n */\nexport class PlatformTest extends DITest {\n public static adapter: Type<PlatformAdapter>;\n\n static async create(settings: DITestOptions = {}) {\n DITest.injector = PlatformTest.createInjector(getConfiguration(settings));\n await DITest.createContainer(settings);\n }\n\n /**\n * Create a new injector with the right default services\n */\n static createInjector(settings: any = {}): InjectorService {\n return createInjector({\n settings: DITest.configure({httpPort: false, httpsPort: false, ...settings})\n });\n }\n\n /**\n * Load the server silently without listening port and configure it on test profile.\n * @decorator\n * @param mod\n * @param listen\n * @param settings\n * @returns {Promise<void>}\n */\n static bootstrap(mod: any, {listen, ...settings}: Partial<PlatformBuilderSettings & {listen: boolean}> = {}): () => Promise<void> {\n return async function before(): Promise<void> {\n let instance: PlatformBuilder;\n const adapter: Type<PlatformAdapter> = settings.platform || settings.adapter || PlatformTest.adapter;\n\n /* istanbul ignore next */\n if (!adapter) {\n throw new Error(\n \"Platform adapter is not specified. Have you added at least `import @tsed/platform-express` (or equivalent) on your Server.ts ?\"\n );\n }\n\n // @ts-ignore\n settings = DITest.configure(settings);\n settings.adapter = adapter as any;\n\n const configuration = getConfiguration(settings, mod);\n const disableComponentsScan = configuration.disableComponentsScan || !!process.env.WEBPACK;\n\n if (!disableComponentsScan) {\n const {importProviders} = await import(\"@tsed/components-scan\");\n await importProviders(configuration);\n }\n\n instance = await PlatformBuilder.build(mod, configuration).bootstrap();\n await instance.listen(!!listen);\n\n // used by inject method\n DITest.injector = instance.injector;\n };\n }\n\n /**\n * It injects services into the test function where you can alter, spy on, and manipulate them.\n *\n * The inject function has two parameters\n *\n * * an array of Service dependency injection tokens,\n * * a test function whose parameters correspond exactly to each item in the injection token array.\n *\n * @param targets\n * @param func\n */\n static inject<T>(targets: any[], func: (...args: any[]) => Promise<T> | T): () => Promise<T> {\n return async (): Promise<T> => {\n if (!DITest.hasInjector()) {\n await PlatformTest.create();\n }\n\n const injector: InjectorService = DITest.injector;\n const deps = [];\n\n for (const target of targets) {\n deps.push(injector.has(target) ? injector.get(target) : await injector.invoke(target));\n }\n\n return await func(...deps);\n };\n }\n\n /**\n * Return the raw application (express or koa).\n * Use this callback with SuperTest.\n *\n * ```typescript\n * let request: SuperTest.SuperTest<SuperTest.Test>;\n * beforeEach(PlatformTest.bootstrap(Server, {\n * mount: {\n * \"/rest\": [ProductsController]\n * }\n * }));\n * beforeEach(() => {\n * request = SuperTest(PlatformTest.callback());\n * });\n * ```\n */\n static callback() {\n return DITest.injector.get<PlatformApplication>(PlatformApplication)?.callback();\n }\n\n static createRequest(options: any = {}): any {\n return {\n headers: {},\n get(key: string) {\n return this.headers[key.toLowerCase()];\n },\n accepts(mime?: string | string[]) {\n return accepts(this).types([].concat(mime as never));\n },\n ...options\n };\n }\n\n static createResponse(options: any = {}): any {\n return {\n headers: {},\n locals: {},\n statusCode: 200,\n status(code: number) {\n this.statusCode = code;\n return this;\n },\n contentType(content: string) {\n this.set(\"content-type\", content);\n },\n contentLength(content: number) {\n this.set(\"content-length\", content);\n },\n redirect(status: number, path: string) {\n this.statusCode = status;\n this.set(\"location\", path);\n },\n location(path: string) {\n this.set(\"location\", path);\n },\n get(key: string) {\n return this.headers[key.toLowerCase()];\n },\n getHeaders() {\n return this.headers;\n },\n set(key: string, value: any) {\n this.headers[key.toLowerCase()] = value;\n return this;\n },\n send(data: any) {\n this.data = data;\n },\n json(data: any) {\n this.data = data;\n },\n ...options\n };\n }\n\n static createRequestContext(options: Partial<PlatformContextOptions & any> = {}) {\n const event = {\n request: options?.request?.request || options?.event?.request || PlatformTest.createRequest(),\n response: options?.response?.response || options?.event?.response || PlatformTest.createResponse()\n };\n\n return new PlatformContext({\n id: \"id\",\n injector: DITest.injector,\n logger: DITest.injector.logger,\n url: \"/\",\n ...options,\n event\n });\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Test1.js","sourceRoot":"","sources":["../../../../src/utils/__mock__/Test1.ts"],"names":[],"mappings":";;;AAAa,QAAA,MAAM,GAAG,OAAO,CAAC;AAE9B,MAAa,KAAK;CAAG;AAArB,sBAAqB","sourcesContent":["export const value1 = \"value\";\n\nexport class Test1 {}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Test2.js","sourceRoot":"","sources":["../../../../src/utils/__mock__/Test2.ts"],"names":[],"mappings":";;;AAAa,QAAA,MAAM,GAAG,OAAO,CAAC;AAE9B,MAAa,KAAK;CAAG;AAArB,sBAAqB","sourcesContent":["export const value2 = \"value\";\n\nexport class Test2 {}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TestCtrl = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const di_1 = require("@tsed/di");
|
|
6
|
+
let TestCtrl = class TestCtrl {
|
|
7
|
+
};
|
|
8
|
+
TestCtrl = tslib_1.__decorate([
|
|
9
|
+
(0, di_1.Controller)("/root")
|
|
10
|
+
], TestCtrl);
|
|
11
|
+
exports.TestCtrl = TestCtrl;
|
|
12
|
+
//# sourceMappingURL=TestCtrl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TestCtrl.js","sourceRoot":"","sources":["../../../../../../src/utils/__mock__/controllers/rest/TestCtrl.ts"],"names":[],"mappings":";;;;AAAA,iCAAoC;AAGpC,IAAa,QAAQ,GAArB,MAAa,QAAQ;CAAG,CAAA;AAAX,QAAQ;IADpB,IAAA,eAAU,EAAC,OAAO,CAAC;GACP,QAAQ,CAAG;AAAX,4BAAQ","sourcesContent":["import {Controller} from \"@tsed/di\";\n\n@Controller(\"/root\")\nexport class TestCtrl {}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Module1 = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const SubModule_1 = require("./submodule/SubModule");
|
|
6
|
+
const di_1 = require("@tsed/di");
|
|
7
|
+
const M1Ctrl1_1 = require("./controllers/M1Ctrl1");
|
|
8
|
+
let Module1 = class Module1 {
|
|
9
|
+
};
|
|
10
|
+
Module1 = tslib_1.__decorate([
|
|
11
|
+
(0, di_1.Module)({
|
|
12
|
+
mount: {
|
|
13
|
+
"/m1": [M1Ctrl1_1.M1Ctrl1]
|
|
14
|
+
},
|
|
15
|
+
imports: [SubModule_1.SubModule]
|
|
16
|
+
})
|
|
17
|
+
], Module1);
|
|
18
|
+
exports.Module1 = Module1;
|
|
19
|
+
//# sourceMappingURL=Module1.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Module1.js","sourceRoot":"","sources":["../../../../../src/utils/__mock__/module1/Module1.ts"],"names":[],"mappings":";;;;AAAA,qDAAgD;AAChD,iCAAgC;AAChC,mDAA8C;AAQ9C,IAAa,OAAO,GAApB,MAAa,OAAO;CAAG,CAAA;AAAV,OAAO;IANnB,IAAA,WAAM,EAAC;QACN,KAAK,EAAE;YACL,KAAK,EAAE,CAAC,iBAAO,CAAC;SACjB;QACD,OAAO,EAAE,CAAC,qBAAS,CAAC;KACrB,CAAC;GACW,OAAO,CAAG;AAAV,0BAAO","sourcesContent":["import {SubModule} from \"./submodule/SubModule\";\nimport {Module} from \"@tsed/di\";\nimport {M1Ctrl1} from \"./controllers/M1Ctrl1\";\n\n@Module({\n mount: {\n \"/m1\": [M1Ctrl1]\n },\n imports: [SubModule]\n})\nexport class Module1 {}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.M1Ctrl1 = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const di_1 = require("@tsed/di");
|
|
6
|
+
const M1Service_1 = require("../services/M1Service");
|
|
7
|
+
let M1Ctrl1 = class M1Ctrl1 {
|
|
8
|
+
constructor(service) {
|
|
9
|
+
this.service = service;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
M1Ctrl1 = tslib_1.__decorate([
|
|
13
|
+
(0, di_1.Controller)("/m1"),
|
|
14
|
+
tslib_1.__metadata("design:paramtypes", [M1Service_1.M1Service])
|
|
15
|
+
], M1Ctrl1);
|
|
16
|
+
exports.M1Ctrl1 = M1Ctrl1;
|
|
17
|
+
//# sourceMappingURL=M1Ctrl1.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"M1Ctrl1.js","sourceRoot":"","sources":["../../../../../../src/utils/__mock__/module1/controllers/M1Ctrl1.ts"],"names":[],"mappings":";;;;AAAA,iCAAoC;AACpC,qDAAgD;AAGhD,IAAa,OAAO,GAApB,MAAa,OAAO;IAClB,YAAmB,OAAkB;QAAlB,YAAO,GAAP,OAAO,CAAW;IAAG,CAAC;CAC1C,CAAA;AAFY,OAAO;IADnB,IAAA,eAAU,EAAC,KAAK,CAAC;6CAEY,qBAAS;GAD1B,OAAO,CAEnB;AAFY,0BAAO","sourcesContent":["import {Controller} from \"@tsed/di\";\nimport {M1Service} from \"../services/M1Service\";\n\n@Controller(\"/m1\")\nexport class M1Ctrl1 {\n constructor(public service: M1Service) {}\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.M1Service = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const di_1 = require("@tsed/di");
|
|
6
|
+
const SubService_1 = require("../submodule/SubService");
|
|
7
|
+
let M1Service = class M1Service {
|
|
8
|
+
constructor(subService) {
|
|
9
|
+
this.subService = subService;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
M1Service = tslib_1.__decorate([
|
|
13
|
+
(0, di_1.Injectable)(),
|
|
14
|
+
tslib_1.__metadata("design:paramtypes", [SubService_1.SubService])
|
|
15
|
+
], M1Service);
|
|
16
|
+
exports.M1Service = M1Service;
|
|
17
|
+
//# sourceMappingURL=M1Service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"M1Service.js","sourceRoot":"","sources":["../../../../../../src/utils/__mock__/module1/services/M1Service.ts"],"names":[],"mappings":";;;;AAAA,iCAAoC;AACpC,wDAAmD;AAGnD,IAAa,SAAS,GAAtB,MAAa,SAAS;IACpB,YAAmB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAG,CAAC;CAC9C,CAAA;AAFY,SAAS;IADrB,IAAA,eAAU,GAAE;6CAEoB,uBAAU;GAD9B,SAAS,CAErB;AAFY,8BAAS","sourcesContent":["import {Injectable} from \"@tsed/di\";\nimport {SubService} from \"../submodule/SubService\";\n\n@Injectable()\nexport class M1Service {\n constructor(public subService: SubService) {}\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SubModule = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const di_1 = require("@tsed/di");
|
|
6
|
+
const SubService_1 = require("./SubService");
|
|
7
|
+
let SubModule = class SubModule {
|
|
8
|
+
};
|
|
9
|
+
SubModule = tslib_1.__decorate([
|
|
10
|
+
(0, di_1.Module)({
|
|
11
|
+
imports: [SubService_1.SubService]
|
|
12
|
+
})
|
|
13
|
+
], SubModule);
|
|
14
|
+
exports.SubModule = SubModule;
|
|
15
|
+
//# sourceMappingURL=SubModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubModule.js","sourceRoot":"","sources":["../../../../../../src/utils/__mock__/module1/submodule/SubModule.ts"],"names":[],"mappings":";;;;AAAA,iCAAgC;AAChC,6CAAwC;AAKxC,IAAa,SAAS,GAAtB,MAAa,SAAS;CAAG,CAAA;AAAZ,SAAS;IAHrB,IAAA,WAAM,EAAC;QACN,OAAO,EAAE,CAAC,uBAAU,CAAC;KACtB,CAAC;GACW,SAAS,CAAG;AAAZ,8BAAS","sourcesContent":["import {Module} from \"@tsed/di\";\nimport {SubService} from \"./SubService\";\n\n@Module({\n imports: [SubService]\n})\nexport class SubModule {}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SubService = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const di_1 = require("@tsed/di");
|
|
6
|
+
let SubService = class SubService {
|
|
7
|
+
};
|
|
8
|
+
SubService = tslib_1.__decorate([
|
|
9
|
+
(0, di_1.Injectable)()
|
|
10
|
+
], SubService);
|
|
11
|
+
exports.SubService = SubService;
|
|
12
|
+
//# sourceMappingURL=SubService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubService.js","sourceRoot":"","sources":["../../../../../../src/utils/__mock__/module1/submodule/SubService.ts"],"names":[],"mappings":";;;;AAAA,iCAAoC;AAGpC,IAAa,UAAU,GAAvB,MAAa,UAAU;CAAG,CAAA;AAAb,UAAU;IADtB,IAAA,eAAU,GAAE;GACA,UAAU,CAAG;AAAb,gCAAU","sourcesContent":["import {Injectable} from \"@tsed/di\";\n\n@Injectable()\nexport class SubService {}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Module2 = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const di_1 = require("@tsed/di");
|
|
6
|
+
const M2Ctrl_1 = require("./controllers/M2Ctrl");
|
|
7
|
+
let Module2 = class Module2 {
|
|
8
|
+
};
|
|
9
|
+
Module2 = tslib_1.__decorate([
|
|
10
|
+
(0, di_1.Module)({
|
|
11
|
+
mount: {
|
|
12
|
+
"/mod2": [M2Ctrl_1.M2Ctrl]
|
|
13
|
+
},
|
|
14
|
+
imports: []
|
|
15
|
+
})
|
|
16
|
+
], Module2);
|
|
17
|
+
exports.Module2 = Module2;
|
|
18
|
+
//# sourceMappingURL=Module2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Module2.js","sourceRoot":"","sources":["../../../../../src/utils/__mock__/module2/Module2.ts"],"names":[],"mappings":";;;;AAAA,iCAAgC;AAChC,iDAA4C;AAQ5C,IAAa,OAAO,GAApB,MAAa,OAAO;CAAG,CAAA;AAAV,OAAO;IANnB,IAAA,WAAM,EAAC;QACN,KAAK,EAAE;YACL,OAAO,EAAE,CAAC,eAAM,CAAC;SAClB;QACD,OAAO,EAAE,EAAE;KACZ,CAAC;GACW,OAAO,CAAG;AAAV,0BAAO","sourcesContent":["import {Module} from \"@tsed/di\";\nimport {M2Ctrl} from \"./controllers/M2Ctrl\";\n\n@Module({\n mount: {\n \"/mod2\": [M2Ctrl]\n },\n imports: []\n})\nexport class Module2 {}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.M2Ctrl = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const di_1 = require("@tsed/di");
|
|
6
|
+
let M2Ctrl = class M2Ctrl {
|
|
7
|
+
};
|
|
8
|
+
M2Ctrl = tslib_1.__decorate([
|
|
9
|
+
(0, di_1.Controller)("/m2")
|
|
10
|
+
], M2Ctrl);
|
|
11
|
+
exports.M2Ctrl = M2Ctrl;
|
|
12
|
+
//# sourceMappingURL=M2Ctrl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"M2Ctrl.js","sourceRoot":"","sources":["../../../../../../src/utils/__mock__/module2/controllers/M2Ctrl.ts"],"names":[],"mappings":";;;;AAAA,iCAAoC;AAGpC,IAAa,MAAM,GAAnB,MAAa,MAAM;CAAG,CAAA;AAAT,MAAM;IADlB,IAAA,eAAU,EAAC,KAAK,CAAC;GACL,MAAM,CAAG;AAAT,wBAAM","sourcesContent":["import {Controller} from \"@tsed/di\";\n\n@Controller(\"/m2\")\nexport class M2Ctrl {}\n"]}
|
|
@@ -4,8 +4,8 @@ exports.createContext = void 0;
|
|
|
4
4
|
const PlatformContext_1 = require("../domain/PlatformContext");
|
|
5
5
|
const PlatformRequest_1 = require("../services/PlatformRequest");
|
|
6
6
|
const PlatformResponse_1 = require("../services/PlatformResponse");
|
|
7
|
-
const
|
|
8
|
-
const defaultReqIdBuilder = (req) => req.get("x-request-id") ||
|
|
7
|
+
const uuid_1 = require("uuid");
|
|
8
|
+
const defaultReqIdBuilder = (req) => req.get("x-request-id") || (0, uuid_1.v4)().replace(/-/gi, "");
|
|
9
9
|
/**
|
|
10
10
|
* Create the TsED context to wrap request, response, injector, etc...
|
|
11
11
|
* @param injector
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createContext.js","sourceRoot":"","sources":["../../../src/utils/createContext.ts"],"names":[],"mappings":";;;AACA,+DAA0D;AAC1D,iEAA4D;AAC5D,mEAA8D;
|
|
1
|
+
{"version":3,"file":"createContext.js","sourceRoot":"","sources":["../../../src/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import {PlatformContext} from \"../domain/PlatformContext\";\nimport {PlatformRequest} from \"../services/PlatformRequest\";\nimport {PlatformResponse} from \"../services/PlatformResponse\";\nimport {IncomingEvent} from \"../interfaces/IncomingEvent\";\nimport {v4} from \"uuid\";\n\nconst defaultReqIdBuilder = (req: any) => req.get(\"x-request-id\") || v4().replace(/-/gi, \"\");\n\n/**\n * Create the TsED context to wrap request, response, injector, etc...\n * @param injector\n * @ignore\n */\nexport function createContext(injector: InjectorService) {\n const ResponseKlass = injector.getProvider(PlatformResponse)?.useClass;\n const RequestKlass = injector.getProvider(PlatformRequest)?.useClass;\n const {reqIdBuilder = defaultReqIdBuilder, ...loggerOptions} = injector.settings.logger || {};\n\n return async (event: IncomingEvent): Promise<PlatformContext> => {\n const ctx = new PlatformContext({\n event,\n id: reqIdBuilder(event.request),\n logger: injector.logger,\n ...loggerOptions,\n injector,\n ResponseKlass,\n RequestKlass\n });\n\n ctx.response.onEnd(async () => {\n await ctx.emit(\"$onResponse\", ctx);\n await ctx.destroy();\n });\n\n await ctx.emit(\"$onRequest\", ctx);\n\n return ctx;\n };\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createHandlerMetadata = void 0;
|
|
4
|
-
const
|
|
4
|
+
const schema_1 = require("@tsed/schema");
|
|
5
5
|
const HandlerMetadata_1 = require("../domain/HandlerMetadata");
|
|
6
6
|
const HandlerType_1 = require("../interfaces/HandlerType");
|
|
7
7
|
function isMetadata(input) {
|
|
@@ -15,7 +15,7 @@ function createHandlerMetadata(injector, obj, routeOptions = {}) {
|
|
|
15
15
|
return obj;
|
|
16
16
|
}
|
|
17
17
|
let options;
|
|
18
|
-
if (obj instanceof
|
|
18
|
+
if (obj instanceof schema_1.EndpointMetadata) {
|
|
19
19
|
const provider = injector.getProvider(routeOptions.token);
|
|
20
20
|
options = {
|
|
21
21
|
token: provider.token,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createHandlerMetadata.js","sourceRoot":"","sources":["../../../src/utils/createHandlerMetadata.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"createHandlerMetadata.js","sourceRoot":"","sources":["../../../src/utils/createHandlerMetadata.ts"],"names":[],"mappings":";;;AACA,yCAA8C;AAC9C,+DAAkF;AAClF,2DAAsD;AAGtD,SAAS,UAAU,CAAC,KAAU;IAC5B,OAAO,KAAK,YAAY,iCAAe,CAAC;AAC1C,CAAC;AAED;;GAEG;AACH,SAAgB,qBAAqB,CACnC,QAAyB,EACzB,GAA2B,EAC3B,eAA6C,EAAE;IAE/C,IAAI,UAAU,CAAC,GAAG,CAAC,EAAE;QACnB,OAAO,GAAsB,CAAC;KAC/B;IAED,IAAI,OAA+B,CAAC;IAEpC,IAAI,GAAG,YAAY,yBAAgB,EAAE;QACnC,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,CAAE,CAAC;QAE3D,OAAO,GAAG;YACR,KAAK,EAAE,QAAQ,CAAC,KAAK;YACrB,MAAM,EAAE,QAAQ,CAAC,QAAQ;YACzB,KAAK,EAAE,QAAQ,CAAC,KAAK;YACrB,IAAI,EAAE,yBAAW,CAAC,QAAQ;YAC1B,WAAW,EAAE,GAAG,CAAC,WAAW;SAC7B,CAAC;KACH;SAAM;QACL,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAE3C,IAAI,QAAQ,EAAE;YACZ,OAAO,GAAG;gBACR,KAAK,EAAE,QAAQ,CAAC,KAAK;gBACrB,MAAM,EAAE,QAAQ,CAAC,QAAQ;gBACzB,KAAK,EAAE,QAAQ,CAAC,KAAK;gBACrB,IAAI,EAAE,yBAAW,CAAC,UAAU;gBAC5B,WAAW,EAAE,KAAK;aACnB,CAAC;SACH;aAAM;YACL,OAAO,GAAG;gBACR,MAAM,EAAE,GAAG;aACZ,CAAC;SACH;KACF;IAED,OAAO,CAAC,YAAY,GAAG,YAAY,CAAC;IAEpC,OAAO,IAAI,iCAAe,CAAC,OAAO,CAAC,CAAC;AACtC,CAAC;AA1CD,sDA0CC","sourcesContent":["import {InjectorService} from \"@tsed/di\";\nimport {EndpointMetadata} from \"@tsed/schema\";\nimport {HandlerMetadata, HandlerMetadataOptions} from \"../domain/HandlerMetadata\";\nimport {HandlerType} from \"../interfaces/HandlerType\";\nimport {PlatformRouteWithoutHandlers} from \"../interfaces/PlatformRouteOptions\";\n\nfunction isMetadata(input: any) {\n return input instanceof HandlerMetadata;\n}\n\n/**\n * @ignore\n */\nexport function createHandlerMetadata(\n injector: InjectorService,\n obj: any | EndpointMetadata,\n routeOptions: PlatformRouteWithoutHandlers = {}\n): HandlerMetadata {\n if (isMetadata(obj)) {\n return obj as HandlerMetadata;\n }\n\n let options: HandlerMetadataOptions;\n\n if (obj instanceof EndpointMetadata) {\n const provider = injector.getProvider(routeOptions.token)!;\n\n options = {\n token: provider.token,\n target: provider.useClass,\n scope: provider.scope,\n type: HandlerType.ENDPOINT,\n propertyKey: obj.propertyKey\n };\n } else {\n const provider = injector.getProvider(obj);\n\n if (provider) {\n options = {\n token: provider.token,\n target: provider.useClass,\n scope: provider.scope,\n type: HandlerType.MIDDLEWARE,\n propertyKey: \"use\"\n };\n } else {\n options = {\n target: obj\n };\n }\n }\n\n options.routeOptions = routeOptions;\n\n return new HandlerMetadata(options);\n}\n"]}
|
|
@@ -4,29 +4,24 @@ exports.createHttpServer = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const di_1 = require("@tsed/di");
|
|
6
6
|
const core_1 = require("@tsed/core");
|
|
7
|
-
const http_1 =
|
|
8
|
-
const httpServer_1 = require("../decorators/httpServer");
|
|
7
|
+
const http_1 = tslib_1.__importDefault(require("http"));
|
|
9
8
|
const listenServer_1 = require("./listenServer");
|
|
10
9
|
function createHttpServer(injector, requestListener) {
|
|
11
10
|
const { settings } = injector;
|
|
12
11
|
const httpPort = settings.getRaw("httpPort");
|
|
13
12
|
const httpOptions = settings.getRaw("httpOptions");
|
|
14
13
|
const server = httpPort !== false ? http_1.default.createServer(httpOptions, requestListener) : null;
|
|
15
|
-
injector.addProvider(httpServer_1.HttpServer, {
|
|
16
|
-
scope: di_1.ProviderScope.SINGLETON,
|
|
17
|
-
useValue: server
|
|
18
|
-
});
|
|
19
14
|
injector.addProvider(http_1.default.Server, {
|
|
20
15
|
scope: di_1.ProviderScope.SINGLETON,
|
|
21
16
|
useValue: server
|
|
22
17
|
});
|
|
23
|
-
injector.invoke(httpServer_1.HttpServer);
|
|
24
18
|
injector.invoke(http_1.default.Server);
|
|
25
|
-
if (
|
|
19
|
+
if (server) {
|
|
26
20
|
const hostInfo = (0, core_1.getHostInfoFromPort)("http", httpPort);
|
|
27
21
|
return async () => {
|
|
28
22
|
const resolvedHostInfo = await (0, listenServer_1.listenServer)(injector, server, hostInfo);
|
|
29
23
|
settings.setRaw("httpPort", `${resolvedHostInfo.address}:${resolvedHostInfo.port}`);
|
|
24
|
+
return server;
|
|
30
25
|
};
|
|
31
26
|
}
|
|
32
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createHttpServer.js","sourceRoot":"","sources":["../../../src/utils/createHttpServer.ts"],"names":[],"mappings":";;;;AAAA,iCAAwD;AACxD,qCAA+C;AAC/C,
|
|
1
|
+
{"version":3,"file":"createHttpServer.js","sourceRoot":"","sources":["../../../src/utils/createHttpServer.ts"],"names":[],"mappings":";;;;AAAA,iCAAwD;AACxD,qCAA+C;AAC/C,wDAAwB;AACxB,iDAA4C;AAE5C,SAAgB,gBAAgB,CAAC,QAAyB,EAAE,eAAqC;IAC/F,MAAM,EAAC,QAAQ,EAAC,GAAG,QAAQ,CAAC;IAC5B,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAC7C,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAEnD,MAAM,MAAM,GAAG,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,cAAI,CAAC,YAAY,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAE3F,QAAQ,CAAC,WAAW,CAAC,cAAI,CAAC,MAAM,EAAE;QAChC,KAAK,EAAE,kBAAa,CAAC,SAAS;QAC9B,QAAQ,EAAE,MAAM;KACjB,CAAC,CAAC;IAEH,QAAQ,CAAC,MAAM,CAAC,cAAI,CAAC,MAAM,CAAC,CAAC;IAE7B,IAAI,MAAM,EAAE;QACV,MAAM,QAAQ,GAAG,IAAA,0BAAmB,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAEvD,OAAO,KAAK,IAAI,EAAE;YAChB,MAAM,gBAAgB,GAAG,MAAM,IAAA,2BAAY,EAAC,QAAQ,EAAE,MAAqB,EAAE,QAAQ,CAAC,CAAC;YACvF,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,GAAG,gBAAgB,CAAC,OAAO,IAAI,gBAAgB,CAAC,IAAI,EAAE,CAAC,CAAC;YACpF,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC;KACH;AACH,CAAC;AAvBD,4CAuBC","sourcesContent":["import {InjectorService, ProviderScope} from \"@tsed/di\";\nimport {getHostInfoFromPort} from \"@tsed/core\";\nimport Http from \"http\";\nimport {listenServer} from \"./listenServer\";\n\nexport function createHttpServer(injector: InjectorService, requestListener: Http.RequestListener) {\n const {settings} = injector;\n const httpPort = settings.getRaw(\"httpPort\");\n const httpOptions = settings.getRaw(\"httpOptions\");\n\n const server = httpPort !== false ? Http.createServer(httpOptions, requestListener) : null;\n\n injector.addProvider(Http.Server, {\n scope: ProviderScope.SINGLETON,\n useValue: server\n });\n\n injector.invoke(Http.Server);\n\n if (server) {\n const hostInfo = getHostInfoFromPort(\"http\", httpPort);\n\n return async () => {\n const resolvedHostInfo = await listenServer(injector, server as Http.Server, hostInfo);\n settings.setRaw(\"httpPort\", `${resolvedHostInfo.address}:${resolvedHostInfo.port}`);\n return server;\n };\n }\n}\n"]}
|
|
@@ -4,29 +4,24 @@ exports.createHttpsServer = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const di_1 = require("@tsed/di");
|
|
6
6
|
const core_1 = require("@tsed/core");
|
|
7
|
-
const https_1 =
|
|
8
|
-
const httpsServer_1 = require("../decorators/httpsServer");
|
|
7
|
+
const https_1 = tslib_1.__importDefault(require("https"));
|
|
9
8
|
const listenServer_1 = require("./listenServer");
|
|
10
9
|
function createHttpsServer(injector, requestListener) {
|
|
11
10
|
const { settings } = injector;
|
|
12
11
|
const httpsPort = settings.getRaw("httpsPort");
|
|
13
12
|
const httpsOptions = settings.getRaw("httpsOptions");
|
|
14
13
|
const server = httpsPort !== false ? https_1.default.createServer(httpsOptions, requestListener) : null;
|
|
15
|
-
injector.addProvider(httpsServer_1.HttpsServer, {
|
|
16
|
-
scope: di_1.ProviderScope.SINGLETON,
|
|
17
|
-
useValue: server
|
|
18
|
-
});
|
|
19
14
|
injector.addProvider(https_1.default.Server, {
|
|
20
15
|
scope: di_1.ProviderScope.SINGLETON,
|
|
21
16
|
useValue: server
|
|
22
17
|
});
|
|
23
|
-
injector.invoke(httpsServer_1.HttpsServer);
|
|
24
18
|
injector.invoke(https_1.default.Server);
|
|
25
|
-
if (
|
|
19
|
+
if (server) {
|
|
26
20
|
const hostInfo = (0, core_1.getHostInfoFromPort)("https", httpsPort);
|
|
27
21
|
return async () => {
|
|
28
22
|
const resolvedHostInfo = await (0, listenServer_1.listenServer)(injector, server, hostInfo);
|
|
29
23
|
settings.setRaw("httpsPort", `${resolvedHostInfo.address}:${resolvedHostInfo.port}`);
|
|
24
|
+
return server;
|
|
30
25
|
};
|
|
31
26
|
}
|
|
32
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createHttpsServer.js","sourceRoot":"","sources":["../../../src/utils/createHttpsServer.ts"],"names":[],"mappings":";;;;AAAA,iCAAwD;AACxD,qCAA+C;AAC/C
|
|
1
|
+
{"version":3,"file":"createHttpsServer.js","sourceRoot":"","sources":["../../../src/utils/createHttpsServer.ts"],"names":[],"mappings":";;;;AAAA,iCAAwD;AACxD,qCAA+C;AAC/C,0DAA0B;AAE1B,iDAA4C;AAE5C,SAAgB,iBAAiB,CAAC,QAAyB,EAAE,eAAsC;IACjG,MAAM,EAAC,QAAQ,EAAC,GAAG,QAAQ,CAAC;IAC5B,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAC/C,MAAM,YAAY,GAAG,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAErD,MAAM,MAAM,GAAG,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,eAAK,CAAC,YAAY,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAE9F,QAAQ,CAAC,WAAW,CAAC,eAAK,CAAC,MAAM,EAAE;QACjC,KAAK,EAAE,kBAAa,CAAC,SAAS;QAC9B,QAAQ,EAAE,MAAM;KACjB,CAAC,CAAC;IAEH,QAAQ,CAAC,MAAM,CAAC,eAAK,CAAC,MAAM,CAAC,CAAC;IAE9B,IAAI,MAAM,EAAE;QACV,MAAM,QAAQ,GAAG,IAAA,0BAAmB,EAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAEzD,OAAO,KAAK,IAAI,EAAE;YAChB,MAAM,gBAAgB,GAAG,MAAM,IAAA,2BAAY,EAAC,QAAQ,EAAE,MAAsB,EAAE,QAAQ,CAAC,CAAC;YACxF,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,gBAAgB,CAAC,OAAO,IAAI,gBAAgB,CAAC,IAAI,EAAE,CAAC,CAAC;YACrF,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC;KACH;AACH,CAAC;AAvBD,8CAuBC","sourcesContent":["import {InjectorService, ProviderScope} from \"@tsed/di\";\nimport {getHostInfoFromPort} from \"@tsed/core\";\nimport Https from \"https\";\nimport Http from \"http\";\nimport {listenServer} from \"./listenServer\";\n\nexport function createHttpsServer(injector: InjectorService, requestListener?: Http.RequestListener) {\n const {settings} = injector;\n const httpsPort = settings.getRaw(\"httpsPort\");\n const httpsOptions = settings.getRaw(\"httpsOptions\");\n\n const server = httpsPort !== false ? Https.createServer(httpsOptions, requestListener) : null;\n\n injector.addProvider(Https.Server, {\n scope: ProviderScope.SINGLETON,\n useValue: server\n });\n\n injector.invoke(Https.Server);\n\n if (server) {\n const hostInfo = getHostInfoFromPort(\"https\", httpsPort);\n\n return async () => {\n const resolvedHostInfo = await listenServer(injector, server as Https.Server, hostInfo);\n settings.setRaw(\"httpsPort\", `${resolvedHostInfo.address}:${resolvedHostInfo.port}`);\n return server;\n };\n }\n}\n"]}
|
|
@@ -11,6 +11,7 @@ const PlatformRouter_1 = require("../services/PlatformRouter");
|
|
|
11
11
|
const PlatformApplication_1 = require("../services/PlatformApplication");
|
|
12
12
|
const Platform_1 = require("../services/Platform");
|
|
13
13
|
const PlatformRequest_1 = require("../services/PlatformRequest");
|
|
14
|
+
const PlatformAdapter_1 = require("../services/PlatformAdapter");
|
|
14
15
|
logger_1.$log.name = "TSED";
|
|
15
16
|
const DEFAULT_PROVIDERS = [
|
|
16
17
|
{ provide: PlatformHandler_1.PlatformHandler },
|
|
@@ -20,15 +21,22 @@ const DEFAULT_PROVIDERS = [
|
|
|
20
21
|
{ provide: PlatformApplication_1.PlatformApplication },
|
|
21
22
|
{ provide: Platform_1.Platform }
|
|
22
23
|
];
|
|
23
|
-
function createInjector({
|
|
24
|
+
function createInjector({ adapter, settings = {} }) {
|
|
24
25
|
const injector = new di_1.InjectorService();
|
|
25
26
|
injector.addProvider(PlatformConfiguration_1.PlatformConfiguration);
|
|
26
27
|
injector.settings = injector.invoke(PlatformConfiguration_1.PlatformConfiguration);
|
|
27
28
|
injector.logger = logger_1.$log;
|
|
28
29
|
injector.settings.set(settings);
|
|
30
|
+
if (adapter) {
|
|
31
|
+
injector.addProvider(PlatformAdapter_1.PlatformAdapter, {
|
|
32
|
+
useClass: adapter
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
injector.invoke(PlatformAdapter_1.PlatformAdapter);
|
|
29
36
|
(0, di_1.setLoggerLevel)(injector);
|
|
30
|
-
|
|
31
|
-
|
|
37
|
+
const instance = injector.get(PlatformAdapter_1.PlatformAdapter);
|
|
38
|
+
instance.providers = [...DEFAULT_PROVIDERS, ...instance.providers];
|
|
39
|
+
(0, core_1.toMap)(instance.providers, "provide").forEach((provider, token) => {
|
|
32
40
|
injector.addProvider(token, provider);
|
|
33
41
|
});
|
|
34
42
|
injector.invoke(PlatformApplication_1.PlatformApplication);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createInjector.js","sourceRoot":"","sources":["../../../src/utils/createInjector.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"createInjector.js","sourceRoot":"","sources":["../../../src/utils/createInjector.ts"],"names":[],"mappings":";;;AAAA,iCAAuE;AACvE,yCAAkC;AAClC,qCAAuC;AACvC,oFAA+E;AAC/E,iEAA4D;AAC5D,mEAA8D;AAC9D,+DAA0D;AAC1D,yEAAoE;AACpE,mDAA8C;AAC9C,iEAA4D;AAC5D,iEAA4D;AAE5D,aAAI,CAAC,IAAI,GAAG,MAAM,CAAC;AAEnB,MAAM,iBAAiB,GAAG;IACxB,EAAC,OAAO,EAAE,iCAAe,EAAC;IAC1B,EAAC,OAAO,EAAE,mCAAgB,EAAC;IAC3B,EAAC,OAAO,EAAE,iCAAe,EAAC;IAC1B,EAAC,OAAO,EAAE,+BAAc,EAAC;IACzB,EAAC,OAAO,EAAE,yCAAmB,EAAC;IAC9B,EAAC,OAAO,EAAE,mBAAQ,EAAC;CACpB,CAAC;AAOF,SAAgB,cAAc,CAAC,EAAC,OAAO,EAAE,QAAQ,GAAG,EAAE,EAAwB;IAC5E,MAAM,QAAQ,GAAG,IAAI,oBAAe,EAAE,CAAC;IACvC,QAAQ,CAAC,WAAW,CAAC,6CAAqB,CAAC,CAAC;IAE5C,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,6CAAqB,CAAC,CAAC;IAC3D,QAAQ,CAAC,MAAM,GAAG,aAAI,CAAC;IACvB,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAEhC,IAAI,OAAO,EAAE;QACX,QAAQ,CAAC,WAAW,CAAC,iCAAe,EAAE;YACpC,QAAQ,EAAE,OAAO;SAClB,CAAC,CAAC;KACJ;IAED,QAAQ,CAAC,MAAM,CAAC,iCAAe,CAAC,CAAC;IAEjC,IAAA,mBAAc,EAAC,QAAQ,CAAC,CAAC;IAEzB,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAkB,iCAAe,CAAE,CAAC;IAEjE,QAAQ,CAAC,SAAS,GAAG,CAAC,GAAG,iBAAiB,EAAE,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;IAEnE,IAAA,YAAK,EAAoB,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE;QAClF,QAAQ,CAAC,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,MAAM,CAAC,yCAAmB,CAAC,CAAC;IAErC,OAAO,QAAQ,CAAC;AAClB,CAAC;AA7BD,wCA6BC","sourcesContent":["import {InjectorService, ProviderOpts, setLoggerLevel} from \"@tsed/di\";\nimport {$log} from \"@tsed/logger\";\nimport {toMap, Type} from \"@tsed/core\";\nimport {PlatformConfiguration} from \"../config/services/PlatformConfiguration\";\nimport {PlatformHandler} from \"../services/PlatformHandler\";\nimport {PlatformResponse} from \"../services/PlatformResponse\";\nimport {PlatformRouter} from \"../services/PlatformRouter\";\nimport {PlatformApplication} from \"../services/PlatformApplication\";\nimport {Platform} from \"../services/Platform\";\nimport {PlatformRequest} from \"../services/PlatformRequest\";\nimport {PlatformAdapter} from \"../services/PlatformAdapter\";\n\n$log.name = \"TSED\";\n\nconst DEFAULT_PROVIDERS = [\n {provide: PlatformHandler},\n {provide: PlatformResponse},\n {provide: PlatformRequest},\n {provide: PlatformRouter},\n {provide: PlatformApplication},\n {provide: Platform}\n];\n\ninterface CreateInjectorOptions {\n adapter?: Type<PlatformAdapter<any, any>>;\n settings?: Partial<TsED.Configuration>;\n}\n\nexport function createInjector({adapter, settings = {}}: CreateInjectorOptions) {\n const injector = new InjectorService();\n injector.addProvider(PlatformConfiguration);\n\n injector.settings = injector.invoke(PlatformConfiguration);\n injector.logger = $log;\n injector.settings.set(settings);\n\n if (adapter) {\n injector.addProvider(PlatformAdapter, {\n useClass: adapter\n });\n }\n\n injector.invoke(PlatformAdapter);\n\n setLoggerLevel(injector);\n\n const instance = injector.get<PlatformAdapter>(PlatformAdapter)!;\n\n instance.providers = [...DEFAULT_PROVIDERS, ...instance.providers];\n\n toMap<any, ProviderOpts>(instance.providers, \"provide\").forEach((provider, token) => {\n injector.addProvider(token, provider);\n });\n\n injector.invoke(PlatformApplication);\n\n return injector;\n}\n"]}
|
|
@@ -4,9 +4,13 @@ exports.getConfiguration = void 0;
|
|
|
4
4
|
const core_1 = require("@tsed/core");
|
|
5
5
|
const di_1 = require("@tsed/di");
|
|
6
6
|
function getConfiguration(configuration = {}, module = null) {
|
|
7
|
+
if (configuration.$$resolved) {
|
|
8
|
+
return configuration;
|
|
9
|
+
}
|
|
7
10
|
const store = module ? core_1.Store.from(module).get("configuration") || {} : {};
|
|
8
11
|
const env = configuration.env || store.env || process.env.NODE_ENV || core_1.Env.DEV;
|
|
9
12
|
const config = {
|
|
13
|
+
$$resolved: true,
|
|
10
14
|
exclude: ["**/*.spec.ts", "**/*.spec.js"],
|
|
11
15
|
componentsScan: ["${rootDir}/mvc/**/*.ts", "${rootDir}/services/**/*.ts", "${rootDir}/middlewares/**/*.ts"],
|
|
12
16
|
env,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getConfiguration.js","sourceRoot":"","sources":["../../../src/utils/getConfiguration.ts"],"names":[],"mappings":";;;AAAA,qCAAuD;AACvD,iCAAqD;AAErD,SAAgB,gBAAgB,CAAC,gBAAqB,EAAE,EAAE,SAA2B,IAAI;IACvF,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,YAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1E,MAAM,GAAG,GAAG,aAAa,CAAC,GAAG,IAAI,KAAK,CAAC,GAAG,IAAK,OAAO,CAAC,GAAG,CAAC,QAAgB,IAAI,UAAG,CAAC,GAAG,CAAC;IAEvF,MAAM,MAAM,GAAG;QACb,OAAO,EAAE,CAAC,cAAc,EAAE,cAAc,CAAC;QACzC,cAAc,EAAE,CAAC,wBAAwB,EAAE,6BAA6B,EAAE,gCAAgC,CAAC;QAC3G,GAAG;QACH,QAAQ,EAAE,IAAI;QACd,SAAS,EAAE,KAAK;QAChB,GAAG,KAAK;QACR,GAAG,aAAa;QAChB,MAAM,EAAE;YACN,CAAC,iBAAY,CAAC,UAAU,CAAC,EAAE,kBAAa,CAAC,SAAS;YAClD,GAAG,KAAK,CAAC,MAAM;YACf,GAAG,aAAa,CAAC,MAAM;SACxB;QACD,KAAK,EACH,KAAK,CAAC,KAAK,IAAI,aAAa,CAAC,KAAK;YAChC,CAAC,CAAC,IAAA,gBAAS,EAAC,KAAK,CAAC,KAAK,IAAI,EAAE,EAAE,aAAa,CAAC,KAAK,IAAI,EAAE,CAAC;YACzD,CAAC,CAAC;gBACE,OAAO,EAAE,gCAAgC;aAC1C;QACP,MAAM,EAAE;YACN,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,GAAG,KAAK,UAAG,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;QACH,QAAQ,EAAE,IAAI;QACd,SAAS,EAAE,KAAK;QAChB,GAAG,KAAK;QACR,GAAG,aAAa;QAChB,MAAM,EAAE;YACN,CAAC,iBAAY,CAAC,UAAU,CAAC,EAAE,kBAAa,CAAC,SAAS;YAClD,GAAG,KAAK,CAAC,MAAM;YACf,GAAG,aAAa,CAAC,MAAM;SACxB;QACD,KAAK,EACH,KAAK,CAAC,KAAK,IAAI,aAAa,CAAC,KAAK;YAChC,CAAC,CAAC,IAAA,gBAAS,EAAC,KAAK,CAAC,KAAK,IAAI,EAAE,EAAE,aAAa,CAAC,KAAK,IAAI,EAAE,CAAC;YACzD,CAAC,CAAC;gBACE,OAAO,EAAE,gCAAgC;aAC1C;QACP,MAAM,EAAE;YACN,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,GAAG,KAAK,UAAG,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM;YACxC,UAAU,EAAE,IAAI;YAChB,GAAG,KAAK,CAAC,MAAM;YACf,GAAG,aAAa,CAAC,MAAM;YACvB,eAAe,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,UAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SAC3D;KACF,CAAC;IAEF,IAAI,CAAC,aAAa,CAAC,qBAAqB,IAAI,KAAK,CAAC,cAAc,IAAI,aAAa,CAAC,cAAc,EAAE;QAChG,MAAM,CAAC,cAAc,GAAG,CAAC,GAAG,KAAK,CAAC,cAAc,EAAE,GAAG,aAAa,CAAC,cAAc,CAAC,CAAC;KACpF;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AA3CD,4CA2CC","sourcesContent":["import {deepMerge, Env, Store, Type} from \"@tsed/core\";\nimport {ProviderScope, ProviderType} from \"@tsed/di\";\n\nexport function getConfiguration(configuration: any = {}, module: Type<any> | null = null) {\n if (configuration.$$resolved) {\n return configuration;\n }\n\n const store = module ? Store.from(module).get(\"configuration\") || {} : {};\n const env = configuration.env || store.env || (process.env.NODE_ENV as Env) || Env.DEV;\n\n const config = {\n $$resolved: true,\n exclude: [\"**/*.spec.ts\", \"**/*.spec.js\"],\n componentsScan: [\"${rootDir}/mvc/**/*.ts\", \"${rootDir}/services/**/*.ts\", \"${rootDir}/middlewares/**/*.ts\"],\n env,\n httpPort: 8080,\n httpsPort: false,\n ...store,\n ...configuration,\n scopes: {\n [ProviderType.CONTROLLER]: ProviderScope.SINGLETON,\n ...store.scopes,\n ...configuration.scopes\n },\n mount:\n store.mount || configuration.mount\n ? deepMerge(store.mount || {}, configuration.mount || {})\n : {\n \"/rest\": \"${rootDir}/controllers/**/*.ts\"\n },\n logger: {\n debug: false,\n level: env === Env.TEST ? \"off\" : \"info\",\n logRequest: true,\n ...store.logger,\n ...configuration.logger,\n jsonIndentation: process.env.NODE_ENV === Env.PROD ? 0 : 2\n }\n };\n\n if (!configuration.disableComponentsScan && store.componentsScan && configuration.componentsScan) {\n config.componentsScan = [...store.componentsScan, ...configuration.componentsScan];\n }\n\n return config;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setResponseHeaders.js","sourceRoot":"","sources":["../../../src/utils/setResponseHeaders.ts"],"names":[],"mappings":";;;AAIA,SAAS,YAAY,CAAC,WAA2D,EAAE,
|
|
1
|
+
{"version":3,"file":"setResponseHeaders.js","sourceRoot":"","sources":["../../../src/utils/setResponseHeaders.ts"],"names":[],"mappings":";;;AAIA,SAAS,YAAY,CAAC,WAA2D,EAAE,OAA4B;IAC7G,OAAO,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE;QACjE,GAAG,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;QACxB,OAAO;YACL,GAAG,OAAO;YACV,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC;SACxE,CAAC;IACJ,CAAC,EAAE,OAAO,CAAC,CAAC;AACd,CAAC;AAED;;GAEG;AACH,SAAgB,kBAAkB,CAAC,GAAoB;IACrD,MAAM,EAAC,QAAQ,EAAE,QAAQ,EAAC,GAAG,GAAG,CAAC;IACjC,MAAM,EAAC,SAAS,EAAC,GAAG,QAAQ,CAAC;IAE7B,IAAI,QAAQ,CAAC,MAAM,EAAE,EAAE;QACrB,OAAO;KACR;IAED,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,EAAE;QACzB,kDAAkD;QAClD,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC,CAAC;KACxC;IAED,MAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;IACvC,MAAM,OAAO,GAAG,SAAS,CAAC,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;IAC5D,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;IAEnE,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IAEnC,IAAI,SAAS,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE;QACvC,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;KAClE;AACH,CAAC;AAtBD,gDAsBC","sourcesContent":["import {JsonHeader} from \"@tsed/schema\";\nimport {OutgoingHttpHeaders} from \"http\";\nimport {PlatformContext} from \"../domain/PlatformContext\";\n\nfunction mergeHeaders(specHeaders: Record<string, JsonHeader & {example: string}>, headers: OutgoingHttpHeaders) {\n return Object.entries(specHeaders).reduce((headers, [key, item]) => {\n key = key.toLowerCase();\n return {\n ...headers,\n [key]: headers[key] === undefined ? String(item.example) : headers[key]\n };\n }, headers);\n}\n\n/**\n * @ignore\n */\nexport function setResponseHeaders(ctx: PlatformContext) {\n const {response, endpoint} = ctx;\n const {operation} = endpoint;\n\n if (response.isDone()) {\n return;\n }\n\n if (!response.hasStatus()) {\n // apply status only if the isn't already modified\n response.status(operation.getStatus());\n }\n\n const statusCode = response.statusCode;\n const headers = operation.getHeadersOf(response.statusCode);\n const mergedHeaders = mergeHeaders(headers, response.getHeaders());\n\n response.setHeaders(mergedHeaders);\n\n if (operation.isRedirection(statusCode)) {\n response.redirect(statusCode, String(mergedHeaders[\"location\"]));\n }\n}\n"]}
|