@tsed/common 7.0.0-beta.1 → 7.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/builder/PlatformBuilder.js +38 -27
- 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 +2 -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 +66 -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 +3 -2
- 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/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/importProviders.js +29 -0
- package/lib/cjs/utils/importProviders.js.map +1 -0
- package/lib/cjs/utils/setResponseHeaders.js.map +1 -1
- package/lib/esm/builder/PlatformBuilder.js +25 -14
- 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.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 +66 -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 +7 -7
- 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/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/importProviders.js +25 -0
- package/lib/esm/utils/importProviders.js.map +1 -0
- package/lib/esm/utils/setResponseHeaders.js.map +1 -1
- package/lib/esm/utils/useCtxHandler.js +1 -1
- package/lib/types/builder/PlatformBuilder.d.ts +7 -6
- 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 +2 -1
- 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 +63 -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/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/lib/types/utils/importProviders.d.ts +10 -0
- package/package.json +38 -26
- package/readme.md +50 -57
- 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/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/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/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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Test2.js","sourceRoot":"","sources":["../../../../src/utils/__mock__/Test2.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC;AAE9B,MAAM,OAAO,KAAK;CAAG","sourcesContent":["export const value2 = \"value\";\n\nexport class Test2 {}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { PlatformContext } from "../domain/PlatformContext";
|
|
2
|
-
import { PlatformRequest } from "../services/PlatformRequest";
|
|
3
|
-
import { PlatformResponse } from "../services/PlatformResponse";
|
|
4
|
-
|
|
5
|
-
const defaultReqIdBuilder = (req) => req.get("x-request-id") ||
|
|
1
|
+
import { PlatformContext } from "../domain/PlatformContext.js";
|
|
2
|
+
import { PlatformRequest } from "../services/PlatformRequest.js";
|
|
3
|
+
import { PlatformResponse } from "../services/PlatformResponse.js";
|
|
4
|
+
import { v4 } from "uuid";
|
|
5
|
+
const defaultReqIdBuilder = (req) => req.get("x-request-id") || v4().replace(/-/gi, "");
|
|
6
6
|
/**
|
|
7
7
|
* Create the TsED context to wrap request, response, injector, etc...
|
|
8
8
|
* @param injector
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createContext.js","sourceRoot":"","sources":["../../../src/utils/createContext.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAC,eAAe,EAAC,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"createContext.js","sourceRoot":"","sources":["../../../src/utils/createContext.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAC,eAAe,EAAC,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAE9D,OAAO,EAAC,EAAE,EAAC,MAAM,MAAM,CAAC;AAExB,MAAM,mBAAmB,GAAG,CAAC,GAAQ,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAE7F;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,QAAyB;;IACrD,MAAM,aAAa,GAAG,MAAA,QAAQ,CAAC,WAAW,CAAC,gBAAgB,CAAC,0CAAE,QAAQ,CAAC;IACvE,MAAM,YAAY,GAAG,MAAA,QAAQ,CAAC,WAAW,CAAC,eAAe,CAAC,0CAAE,QAAQ,CAAC;IACrE,MAAM,EAAC,YAAY,GAAG,mBAAmB,EAAE,GAAG,aAAa,EAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,IAAI,EAAE,CAAC;IAE9F,OAAO,KAAK,EAAE,KAAoB,EAA4B,EAAE;QAC9D,MAAM,GAAG,GAAG,IAAI,eAAe,CAAC;YAC9B,KAAK;YACL,EAAE,EAAE,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC;YAC/B,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,GAAG,aAAa;YAChB,QAAQ;YACR,aAAa;YACb,YAAY;SACb,CAAC,CAAC;QAEH,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE;YAC5B,MAAM,GAAG,CAAC,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;YACnC,MAAM,GAAG,CAAC,OAAO,EAAE,CAAC;QACtB,CAAC,CAAC,CAAC;QAEH,MAAM,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;QAElC,OAAO,GAAG,CAAC;IACb,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {InjectorService} from \"@tsed/di\";\nimport {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,6 +1,6 @@
|
|
|
1
|
-
import { EndpointMetadata } from "
|
|
2
|
-
import { HandlerMetadata } from "../domain/HandlerMetadata";
|
|
3
|
-
import { HandlerType } from "../interfaces/HandlerType";
|
|
1
|
+
import { EndpointMetadata } from "@tsed/schema";
|
|
2
|
+
import { HandlerMetadata } from "../domain/HandlerMetadata.js";
|
|
3
|
+
import { HandlerType } from "../interfaces/HandlerType.js";
|
|
4
4
|
function isMetadata(input) {
|
|
5
5
|
return input instanceof HandlerMetadata;
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createHandlerMetadata.js","sourceRoot":"","sources":["../../../src/utils/createHandlerMetadata.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,gBAAgB,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"createHandlerMetadata.js","sourceRoot":"","sources":["../../../src/utils/createHandlerMetadata.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAC,eAAe,EAAyB,MAAM,2BAA2B,CAAC;AAClF,OAAO,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAC;AAGtD,SAAS,UAAU,CAAC,KAAU;IAC5B,OAAO,KAAK,YAAY,eAAe,CAAC;AAC1C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,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,gBAAgB,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,WAAW,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,WAAW,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,eAAe,CAAC,OAAO,CAAC,CAAC;AACtC,CAAC","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"]}
|
|
@@ -1,28 +1,23 @@
|
|
|
1
1
|
import { ProviderScope } from "@tsed/di";
|
|
2
2
|
import { getHostInfoFromPort } from "@tsed/core";
|
|
3
3
|
import Http from "http";
|
|
4
|
-
import {
|
|
5
|
-
import { listenServer } from "./listenServer";
|
|
4
|
+
import { listenServer } from "./listenServer.js";
|
|
6
5
|
export function createHttpServer(injector, requestListener) {
|
|
7
6
|
const { settings } = injector;
|
|
8
7
|
const httpPort = settings.getRaw("httpPort");
|
|
9
8
|
const httpOptions = settings.getRaw("httpOptions");
|
|
10
9
|
const server = httpPort !== false ? Http.createServer(httpOptions, requestListener) : null;
|
|
11
|
-
injector.addProvider(HttpServer, {
|
|
12
|
-
scope: ProviderScope.SINGLETON,
|
|
13
|
-
useValue: server
|
|
14
|
-
});
|
|
15
10
|
injector.addProvider(Http.Server, {
|
|
16
11
|
scope: ProviderScope.SINGLETON,
|
|
17
12
|
useValue: server
|
|
18
13
|
});
|
|
19
|
-
injector.invoke(HttpServer);
|
|
20
14
|
injector.invoke(Http.Server);
|
|
21
|
-
if (
|
|
15
|
+
if (server) {
|
|
22
16
|
const hostInfo = getHostInfoFromPort("http", httpPort);
|
|
23
17
|
return async () => {
|
|
24
18
|
const resolvedHostInfo = await listenServer(injector, server, hostInfo);
|
|
25
19
|
settings.setRaw("httpPort", `${resolvedHostInfo.address}:${resolvedHostInfo.port}`);
|
|
20
|
+
return server;
|
|
26
21
|
};
|
|
27
22
|
}
|
|
28
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createHttpServer.js","sourceRoot":"","sources":["../../../src/utils/createHttpServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,aAAa,EAAC,MAAM,UAAU,CAAC;AACxD,OAAO,EAAC,mBAAmB,EAAC,MAAM,YAAY,CAAC;AAC/C,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"createHttpServer.js","sourceRoot":"","sources":["../../../src/utils/createHttpServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,aAAa,EAAC,MAAM,UAAU,CAAC;AACxD,OAAO,EAAC,mBAAmB,EAAC,MAAM,YAAY,CAAC;AAC/C,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C,MAAM,UAAU,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,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAE3F,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE;QAChC,KAAK,EAAE,aAAa,CAAC,SAAS;QAC9B,QAAQ,EAAE,MAAM;KACjB,CAAC,CAAC;IAEH,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAE7B,IAAI,MAAM,EAAE;QACV,MAAM,QAAQ,GAAG,mBAAmB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAEvD,OAAO,KAAK,IAAI,EAAE;YAChB,MAAM,gBAAgB,GAAG,MAAM,YAAY,CAAC,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","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"]}
|
|
@@ -1,28 +1,23 @@
|
|
|
1
1
|
import { ProviderScope } from "@tsed/di";
|
|
2
2
|
import { getHostInfoFromPort } from "@tsed/core";
|
|
3
3
|
import Https from "https";
|
|
4
|
-
import {
|
|
5
|
-
import { listenServer } from "./listenServer";
|
|
4
|
+
import { listenServer } from "./listenServer.js";
|
|
6
5
|
export function createHttpsServer(injector, requestListener) {
|
|
7
6
|
const { settings } = injector;
|
|
8
7
|
const httpsPort = settings.getRaw("httpsPort");
|
|
9
8
|
const httpsOptions = settings.getRaw("httpsOptions");
|
|
10
9
|
const server = httpsPort !== false ? Https.createServer(httpsOptions, requestListener) : null;
|
|
11
|
-
injector.addProvider(HttpsServer, {
|
|
12
|
-
scope: ProviderScope.SINGLETON,
|
|
13
|
-
useValue: server
|
|
14
|
-
});
|
|
15
10
|
injector.addProvider(Https.Server, {
|
|
16
11
|
scope: ProviderScope.SINGLETON,
|
|
17
12
|
useValue: server
|
|
18
13
|
});
|
|
19
|
-
injector.invoke(HttpsServer);
|
|
20
14
|
injector.invoke(Https.Server);
|
|
21
|
-
if (
|
|
15
|
+
if (server) {
|
|
22
16
|
const hostInfo = getHostInfoFromPort("https", httpsPort);
|
|
23
17
|
return async () => {
|
|
24
18
|
const resolvedHostInfo = await listenServer(injector, server, hostInfo);
|
|
25
19
|
settings.setRaw("httpsPort", `${resolvedHostInfo.address}:${resolvedHostInfo.port}`);
|
|
20
|
+
return server;
|
|
26
21
|
};
|
|
27
22
|
}
|
|
28
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createHttpsServer.js","sourceRoot":"","sources":["../../../src/utils/createHttpsServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,aAAa,EAAC,MAAM,UAAU,CAAC;AACxD,OAAO,EAAC,mBAAmB,EAAC,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"createHttpsServer.js","sourceRoot":"","sources":["../../../src/utils/createHttpsServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,aAAa,EAAC,MAAM,UAAU,CAAC;AACxD,OAAO,EAAC,mBAAmB,EAAC,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C,MAAM,UAAU,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,KAAK,CAAC,YAAY,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAE9F,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,MAAM,EAAE;QACjC,KAAK,EAAE,aAAa,CAAC,SAAS;QAC9B,QAAQ,EAAE,MAAM;KACjB,CAAC,CAAC;IAEH,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE9B,IAAI,MAAM,EAAE;QACV,MAAM,QAAQ,GAAG,mBAAmB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAEzD,OAAO,KAAK,IAAI,EAAE;YAChB,MAAM,gBAAgB,GAAG,MAAM,YAAY,CAAC,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","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"]}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { InjectorService, setLoggerLevel } from "@tsed/di";
|
|
2
2
|
import { $log } from "@tsed/logger";
|
|
3
3
|
import { toMap } from "@tsed/core";
|
|
4
|
-
import { PlatformConfiguration } from "../config/services/PlatformConfiguration";
|
|
5
|
-
import { PlatformHandler } from "../services/PlatformHandler";
|
|
6
|
-
import { PlatformResponse } from "../services/PlatformResponse";
|
|
7
|
-
import { PlatformRouter } from "../services/PlatformRouter";
|
|
8
|
-
import { PlatformApplication } from "../services/PlatformApplication";
|
|
9
|
-
import { Platform } from "../services/Platform";
|
|
10
|
-
import { PlatformRequest } from "../services/PlatformRequest";
|
|
4
|
+
import { PlatformConfiguration } from "../config/services/PlatformConfiguration.js";
|
|
5
|
+
import { PlatformHandler } from "../services/PlatformHandler.js";
|
|
6
|
+
import { PlatformResponse } from "../services/PlatformResponse.js";
|
|
7
|
+
import { PlatformRouter } from "../services/PlatformRouter.js";
|
|
8
|
+
import { PlatformApplication } from "../services/PlatformApplication.js";
|
|
9
|
+
import { Platform } from "../services/Platform.js";
|
|
10
|
+
import { PlatformRequest } from "../services/PlatformRequest.js";
|
|
11
|
+
import { PlatformAdapter } from "../services/PlatformAdapter.js";
|
|
11
12
|
$log.name = "TSED";
|
|
12
13
|
const DEFAULT_PROVIDERS = [
|
|
13
14
|
{ provide: PlatformHandler },
|
|
@@ -17,15 +18,22 @@ const DEFAULT_PROVIDERS = [
|
|
|
17
18
|
{ provide: PlatformApplication },
|
|
18
19
|
{ provide: Platform }
|
|
19
20
|
];
|
|
20
|
-
export function createInjector({
|
|
21
|
+
export function createInjector({ adapter, settings = {} }) {
|
|
21
22
|
const injector = new InjectorService();
|
|
22
23
|
injector.addProvider(PlatformConfiguration);
|
|
23
24
|
injector.settings = injector.invoke(PlatformConfiguration);
|
|
24
25
|
injector.logger = $log;
|
|
25
26
|
injector.settings.set(settings);
|
|
27
|
+
if (adapter) {
|
|
28
|
+
injector.addProvider(PlatformAdapter, {
|
|
29
|
+
useClass: adapter
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
injector.invoke(PlatformAdapter);
|
|
26
33
|
setLoggerLevel(injector);
|
|
27
|
-
|
|
28
|
-
|
|
34
|
+
const instance = injector.get(PlatformAdapter);
|
|
35
|
+
instance.providers = [...DEFAULT_PROVIDERS, ...instance.providers];
|
|
36
|
+
toMap(instance.providers, "provide").forEach((provider, token) => {
|
|
29
37
|
injector.addProvider(token, provider);
|
|
30
38
|
});
|
|
31
39
|
injector.invoke(PlatformApplication);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createInjector.js","sourceRoot":"","sources":["../../../src/utils/createInjector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,
|
|
1
|
+
{"version":3,"file":"createInjector.js","sourceRoot":"","sources":["../../../src/utils/createInjector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAgB,cAAc,EAAC,MAAM,UAAU,CAAC;AACvE,OAAO,EAAC,IAAI,EAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAC,KAAK,EAAO,MAAM,YAAY,CAAC;AACvC,OAAO,EAAC,qBAAqB,EAAC,MAAM,0CAA0C,CAAC;AAC/E,OAAO,EAAC,eAAe,EAAC,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAC,cAAc,EAAC,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAC,mBAAmB,EAAC,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAC,eAAe,EAAC,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAC,eAAe,EAAC,MAAM,6BAA6B,CAAC;AAE5D,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC;AAEnB,MAAM,iBAAiB,GAAG;IACxB,EAAC,OAAO,EAAE,eAAe,EAAC;IAC1B,EAAC,OAAO,EAAE,gBAAgB,EAAC;IAC3B,EAAC,OAAO,EAAE,eAAe,EAAC;IAC1B,EAAC,OAAO,EAAE,cAAc,EAAC;IACzB,EAAC,OAAO,EAAE,mBAAmB,EAAC;IAC9B,EAAC,OAAO,EAAE,QAAQ,EAAC;CACpB,CAAC;AAOF,MAAM,UAAU,cAAc,CAAC,EAAC,OAAO,EAAE,QAAQ,GAAG,EAAE,EAAwB;IAC5E,MAAM,QAAQ,GAAG,IAAI,eAAe,EAAE,CAAC;IACvC,QAAQ,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC;IAE5C,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;IAC3D,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAEhC,IAAI,OAAO,EAAE;QACX,QAAQ,CAAC,WAAW,CAAC,eAAe,EAAE;YACpC,QAAQ,EAAE,OAAO;SAClB,CAAC,CAAC;KACJ;IAED,QAAQ,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IAEjC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAEzB,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAkB,eAAe,CAAE,CAAC;IAEjE,QAAQ,CAAC,SAAS,GAAG,CAAC,GAAG,iBAAiB,EAAE,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;IAEnE,KAAK,CAAoB,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,mBAAmB,CAAC,CAAC;IAErC,OAAO,QAAQ,CAAC;AAClB,CAAC","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"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { GlobalProviders, ProviderType } from "@tsed/di";
|
|
2
|
+
import { importComponents } from "@tsed/components-scan";
|
|
3
|
+
async function recursiveImports(providers, settings, properties) {
|
|
4
|
+
const { exclude = [] } = settings;
|
|
5
|
+
const promises = providers
|
|
6
|
+
.map(({ token }) => GlobalProviders.get(token))
|
|
7
|
+
.filter((provider) => (provider === null || provider === void 0 ? void 0 : provider.type) === ProviderType.MODULE && provider.configuration)
|
|
8
|
+
.map((provider) => importProviders({ exclude, ...provider.configuration }, properties));
|
|
9
|
+
return (await Promise.all(promises)).flat();
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Import providers from given patterns.
|
|
13
|
+
*
|
|
14
|
+
* @param settings
|
|
15
|
+
* @param properties
|
|
16
|
+
*/
|
|
17
|
+
export async function importProviders(settings, properties = ["imports"]) {
|
|
18
|
+
const { exclude = [] } = settings;
|
|
19
|
+
const disableComponentsScan = settings.disableComponentsScan || !!process.env.WEBPACK;
|
|
20
|
+
const promises = properties.map((key) => importComponents(settings[key], exclude, disableComponentsScan));
|
|
21
|
+
const providers = (await Promise.all(promises)).flat();
|
|
22
|
+
const children = await recursiveImports(providers, settings, properties);
|
|
23
|
+
return [...children, ...providers];
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=importProviders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"importProviders.js","sourceRoot":"","sources":["../../../src/utils/importProviders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAY,YAAY,EAAC,MAAM,UAAU,CAAC;AACjE,OAAO,EAAC,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AAEvD,KAAK,UAAU,gBAAgB,CAAC,SAA4C,EAAE,QAAqC,EAAE,UAAoB;IACvI,MAAM,EAAC,OAAO,GAAG,EAAE,EAAC,GAAG,QAAQ,CAAC;IAEhC,MAAM,QAAQ,GAAG,SAAS;SACvB,GAAG,CAAC,CAAC,EAAC,KAAK,EAAC,EAAE,EAAE,CAAC,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;SAC5C,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,MAAK,YAAY,CAAC,MAAM,IAAI,QAAQ,CAAC,aAAa,CAAC;SACtF,GAAG,CAAC,CAAC,QAAkB,EAAE,EAAE,CAAC,eAAe,CAAC,EAAC,OAAO,EAAE,GAAG,QAAQ,CAAC,aAAa,EAAC,EAAE,UAAU,CAAC,CAAC,CAAC;IAElG,OAAO,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAC9C,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,QAAqC,EACrC,aAAuB,CAAC,SAAS,CAAC;IAElC,MAAM,EAAC,OAAO,GAAG,EAAE,EAAC,GAAG,QAAQ,CAAC;IAChC,MAAM,qBAAqB,GAAG,QAAQ,CAAC,qBAAqB,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;IAEtF,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,gBAAgB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,qBAAqB,CAAC,CAAC,CAAC;IAC1G,MAAM,SAAS,GAAG,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACvD,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,SAAS,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;IAEzE,OAAO,CAAC,GAAG,QAAQ,EAAE,GAAG,SAAS,CAAC,CAAC;AACrC,CAAC","sourcesContent":["import {GlobalProviders, Provider, ProviderType} from \"@tsed/di\";\nimport {importComponents} from \"@tsed/components-scan\";\n\nasync function recursiveImports(providers: {token: string; route?: string}[], settings: Partial<TsED.Configuration>, properties: string[]) {\n const {exclude = []} = settings;\n\n const promises = providers\n .map(({token}) => GlobalProviders.get(token))\n .filter((provider) => provider?.type === ProviderType.MODULE && provider.configuration)\n .map((provider: Provider) => importProviders({exclude, ...provider.configuration}, properties));\n\n return (await Promise.all(promises)).flat();\n}\n\n/**\n * Import providers from given patterns.\n *\n * @param settings\n * @param properties\n */\nexport async function importProviders(\n settings: Partial<TsED.Configuration>,\n properties: string[] = [\"imports\"]\n): Promise<{token: string; route?: string}[]> {\n const {exclude = []} = settings;\n const disableComponentsScan = settings.disableComponentsScan || !!process.env.WEBPACK;\n\n const promises = properties.map((key) => importComponents(settings[key], exclude, disableComponentsScan));\n const providers = (await Promise.all(promises)).flat();\n const children = await recursiveImports(providers, settings, properties);\n\n return [...children, ...providers];\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,MAAM,UAAU,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","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"]}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { Type } from "@tsed/core";
|
|
3
|
-
import { InjectorService,
|
|
3
|
+
import { InjectorService, ProviderOpts } from "@tsed/di";
|
|
4
4
|
import { Platform } from "../services/Platform";
|
|
5
5
|
import { PlatformApplication } from "../services/PlatformApplication";
|
|
6
|
-
import { IncomingMessage, ServerResponse } from "http";
|
|
7
|
-
import { PlatformAdapter, PlatformBuilderSettings } from "../
|
|
6
|
+
import type { IncomingMessage, ServerResponse } from "http";
|
|
7
|
+
import { PlatformAdapter, PlatformBuilderSettings } from "../services/PlatformAdapter";
|
|
8
8
|
/**
|
|
9
9
|
* @platform
|
|
10
10
|
*/
|
|
11
11
|
export declare class PlatformBuilder<App = TsED.Application, Router = TsED.Router> {
|
|
12
12
|
#private;
|
|
13
|
-
static adapter: Type<PlatformAdapter
|
|
13
|
+
static adapter: Type<PlatformAdapter<any, any>>;
|
|
14
14
|
readonly name: string;
|
|
15
15
|
protected startedAt: Date;
|
|
16
16
|
protected current: Date;
|
|
@@ -19,6 +19,7 @@ export declare class PlatformBuilder<App = TsED.Application, Router = TsED.Route
|
|
|
19
19
|
get rootModule(): any;
|
|
20
20
|
get app(): PlatformApplication<App, Router>;
|
|
21
21
|
get platform(): Platform;
|
|
22
|
+
get adapter(): PlatformAdapter<App, Router>;
|
|
22
23
|
/**
|
|
23
24
|
* Return the settings configured by the decorator @@Configuration@@.
|
|
24
25
|
*
|
|
@@ -42,7 +43,7 @@ export declare class PlatformBuilder<App = TsED.Application, Router = TsED.Route
|
|
|
42
43
|
*/
|
|
43
44
|
get settings(): TsED.Configuration & import("@tsed/di").DIConfiguration;
|
|
44
45
|
get logger(): import("@tsed/di").DILogger;
|
|
45
|
-
get disableBootstrapLog():
|
|
46
|
+
get disableBootstrapLog(): any;
|
|
46
47
|
static create<App = TsED.Application, Router = TsED.Router>(module: Type<any>, settings: PlatformBuilderSettings<App, Router>): PlatformBuilder<App, Router>;
|
|
47
48
|
static build<App = TsED.Application, Router = TsED.Router>(module: Type<any>, { adapter, ...settings }: PlatformBuilderSettings<App, Router>): PlatformBuilder<App, Router>;
|
|
48
49
|
/**
|
|
@@ -87,7 +88,7 @@ export declare class PlatformBuilder<App = TsED.Application, Router = TsED.Route
|
|
|
87
88
|
ready(): Promise<void>;
|
|
88
89
|
callHook(hook: string, ...args: any[]): Promise<void>;
|
|
89
90
|
loadStatics(hook: string): Promise<void>;
|
|
90
|
-
useProvider(token: Type<any>, settings?: Partial<
|
|
91
|
+
useProvider(token: Type<any>, settings?: Partial<ProviderOpts>): this;
|
|
91
92
|
bootstrap(): Promise<this>;
|
|
92
93
|
protected loadRoutes(): Promise<void>;
|
|
93
94
|
protected diff(): string;
|
|
@@ -13,5 +13,6 @@ export declare function createRouter(injector: InjectorService, provider: Contro
|
|
|
13
13
|
* @ignore
|
|
14
14
|
* @param injector
|
|
15
15
|
* @param provider
|
|
16
|
+
* @param parentUseBefore
|
|
16
17
|
*/
|
|
17
|
-
export declare function buildRouter(injector: InjectorService, provider: ControllerProvider): PlatformRouter<TsED.Router>;
|
|
18
|
+
export declare function buildRouter(injector: InjectorService, provider: ControllerProvider, parentUseBefore?: any[]): PlatformRouter<TsED.Application, TsED.Router>;
|
|
@@ -1,135 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
import { FileFilterCallback } from "multer";
|
|
3
|
-
import { Readable } from "stream";
|
|
1
|
+
import type multer from "multer";
|
|
4
2
|
declare global {
|
|
5
3
|
namespace TsED {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/** Value of the `Content-Type` header for this file. */
|
|
12
|
-
mimetype: string;
|
|
13
|
-
/** Size of the file in bytes. */
|
|
14
|
-
size: number;
|
|
15
|
-
/**
|
|
16
|
-
* A readable stream of this file. Only available to the `_handleFile`
|
|
17
|
-
* callback for custom `StorageEngine`s.
|
|
18
|
-
*/
|
|
19
|
-
stream: Readable;
|
|
20
|
-
/** `DiskStorage` only: Directory to which this file has been uploaded. */
|
|
21
|
-
destination: string;
|
|
22
|
-
/** `DiskStorage` only: Name of this file within `destination`. */
|
|
23
|
-
filename: string;
|
|
24
|
-
/** `DiskStorage` only: Full path to the uploaded file. */
|
|
25
|
-
path: string;
|
|
26
|
-
/** `MemoryStorage` only: A Buffer containing the entire file. */
|
|
27
|
-
buffer: Buffer;
|
|
28
|
-
}
|
|
29
|
-
interface MulterStorageEngine {
|
|
30
|
-
}
|
|
31
|
-
interface MulterOptions {
|
|
32
|
-
/**
|
|
33
|
-
* A `StorageEngine` responsible for processing files uploaded via Multer.
|
|
34
|
-
* Takes precedence over `dest`.
|
|
35
|
-
*/
|
|
36
|
-
storage?: MulterStorageEngine;
|
|
37
|
-
/**
|
|
38
|
-
* The destination directory for uploaded files. If `storage` is not set
|
|
39
|
-
* and `dest` is, Multer will create a `DiskStorage` instance configured
|
|
40
|
-
* to store files at `dest` with random filenames.
|
|
41
|
-
*
|
|
42
|
-
* Ignored if `storage` is set.
|
|
43
|
-
*/
|
|
44
|
-
dest?: string;
|
|
45
|
-
/**
|
|
46
|
-
* An object specifying various limits on incoming data. This object is
|
|
47
|
-
* passed to Busboy directly, and the details of properties can be found
|
|
48
|
-
* at https://github.com/mscdex/busboy#busboy-methods.
|
|
49
|
-
*/
|
|
50
|
-
limits?: {
|
|
51
|
-
/** Maximum size of each form field name in bytes. (Default: 100) */
|
|
52
|
-
fieldNameSize?: number;
|
|
53
|
-
/** Maximum size of each form field value in bytes. (Default: 1048576) */
|
|
54
|
-
fieldSize?: number;
|
|
55
|
-
/** Maximum number of non-file form fields. (Default: Infinity) */
|
|
56
|
-
fields?: number;
|
|
57
|
-
/** Maximum size of each file in bytes. (Default: Infinity) */
|
|
58
|
-
fileSize?: number;
|
|
59
|
-
/** Maximum number of file fields. (Default: Infinity) */
|
|
60
|
-
files?: number;
|
|
61
|
-
/** Maximum number of parts (non-file fields + files). (Default: Infinity) */
|
|
62
|
-
parts?: number;
|
|
63
|
-
/** Maximum number of headers. (Default: 2000) */
|
|
64
|
-
headerPairs?: number;
|
|
65
|
-
};
|
|
66
|
-
/** Preserve the full path of the original filename rather than the basename. (Default: false) */
|
|
67
|
-
preservePath?: boolean;
|
|
68
|
-
/**
|
|
69
|
-
* Optional function to control which files are uploaded. This is called
|
|
70
|
-
* for every file that is processed.
|
|
71
|
-
*
|
|
72
|
-
* @param req The Express `Request` object.
|
|
73
|
-
* @param file Object containing information about the processed file.
|
|
74
|
-
* @param callback a function to control which files should be uploaded and which should be skipped.
|
|
75
|
-
*/
|
|
76
|
-
fileFilter?(req: Request, file: MulterFile, callback: FileFilterCallback): void;
|
|
77
|
-
}
|
|
78
|
-
interface MulterField {
|
|
79
|
-
name: string;
|
|
80
|
-
maxCount?: number;
|
|
81
|
-
}
|
|
82
|
-
type MulterHandler = (req: any, res: any) => Promise<any>;
|
|
83
|
-
interface Multer {
|
|
84
|
-
/**
|
|
85
|
-
* Returns middleware that processes a single file associated with the
|
|
86
|
-
* given form field.
|
|
87
|
-
*
|
|
88
|
-
* The `Request` object will be populated with a `file` object containing
|
|
89
|
-
* information about the processed file.
|
|
90
|
-
*
|
|
91
|
-
* @param fieldName Name of the multipart form field to process.
|
|
92
|
-
*/
|
|
93
|
-
single(fieldName: string): MulterHandler;
|
|
94
|
-
/**
|
|
95
|
-
* Returns middleware that processes multiple files sharing the same field
|
|
96
|
-
* name.
|
|
97
|
-
*
|
|
98
|
-
* The `Request` object will be populated with a `files` array containing
|
|
99
|
-
* an information object for each processed file.
|
|
100
|
-
*
|
|
101
|
-
* @param fieldName Shared name of the multipart form fields to process.
|
|
102
|
-
* @param maxCount Optional. Maximum number of files to process. (default: Infinity)
|
|
103
|
-
* @throws `MulterError('LIMIT_UNEXPECTED_FILE')` if more than `maxCount` files are associated with `fieldName`
|
|
104
|
-
*/
|
|
105
|
-
array(fieldName: string, maxCount?: number): MulterHandler;
|
|
106
|
-
/**
|
|
107
|
-
* Returns middleware that processes multiple files associated with the
|
|
108
|
-
* given form fields.
|
|
109
|
-
*
|
|
110
|
-
* The `Request` object will be populated with a `files` object which
|
|
111
|
-
* maps each field name to an array of the associated file information
|
|
112
|
-
* objects.
|
|
113
|
-
*
|
|
114
|
-
* @param fields Array of `Field` objects describing multipart form fields to process.
|
|
115
|
-
* @throws `MulterError('LIMIT_UNEXPECTED_FILE')` if more than `maxCount` files are associated with `fieldName` for any field.
|
|
116
|
-
*/
|
|
117
|
-
fields(fields: MulterField[]): MulterHandler;
|
|
118
|
-
/**
|
|
119
|
-
* Returns middleware that processes all files contained in the multipart
|
|
120
|
-
* request.
|
|
121
|
-
*
|
|
122
|
-
* The `Request` object will be populated with a `files` array containing
|
|
123
|
-
* an information object for each processed file.
|
|
124
|
-
*/
|
|
125
|
-
any(): MulterHandler;
|
|
126
|
-
/**
|
|
127
|
-
* Returns middleware that accepts only non-file multipart form fields.
|
|
128
|
-
*
|
|
129
|
-
* @throws `MulterError('LIMIT_UNEXPECTED_FILE')` if any file is encountered.
|
|
130
|
-
*/
|
|
131
|
-
none(): MulterHandler;
|
|
132
|
-
}
|
|
4
|
+
type MulterFile = Express.Multer.File;
|
|
5
|
+
type MulterStorageEngine = multer.StorageEngine;
|
|
6
|
+
type MulterOptions = multer.Options;
|
|
7
|
+
type MulterField = multer.Field;
|
|
8
|
+
type Multer = multer.Multer;
|
|
133
9
|
}
|
|
134
10
|
}
|
|
135
11
|
export declare type PlatformMulter = TsED.Multer;
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
import { Env, getHostInfoFromPort } from "@tsed/core";
|
|
3
3
|
import { DIConfiguration } from "@tsed/di";
|
|
4
4
|
import Https from "https";
|
|
5
|
-
import { EndpointDirectoriesSettings, PlatformLoggerSettings } from "../interfaces";
|
|
6
5
|
import { ConverterSettings } from "../interfaces/ConverterSettings";
|
|
6
|
+
import { EndpointDirectoriesSettings } from "../interfaces/EndpointDirectoriesSettings";
|
|
7
|
+
import { PlatformLoggerSettings } from "../interfaces/PlatformLoggerSettings";
|
|
7
8
|
/**
|
|
8
9
|
* `PlatformConfiguration` contains all information about your Server configuration.
|
|
9
10
|
*/
|
|
@@ -1,50 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { ParamMetadata } from "@tsed/platform-params";
|
|
3
|
-
import { JsonMethodStore } from "@tsed/schema";
|
|
4
|
-
export interface EndpointViewOptions {
|
|
5
|
-
path: string;
|
|
6
|
-
options: any;
|
|
7
|
-
}
|
|
8
|
-
export interface EndpointRedirectOptions {
|
|
9
|
-
status: number | undefined;
|
|
10
|
-
url: string;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* EndpointMetadata contains metadata about a controller and his method.
|
|
14
|
-
* Each annotation (@Get, @Body...) attached to a method are stored in a endpoint.
|
|
15
|
-
* EndpointMetadata convert this metadata to an array which contain arguments to call an Express method.
|
|
16
|
-
*
|
|
17
|
-
* Example :
|
|
18
|
-
*
|
|
19
|
-
* @Controller("/my-path")
|
|
20
|
-
* provide MyClass {
|
|
21
|
-
*
|
|
22
|
-
* @Get("/")
|
|
23
|
-
* @Authenticated()
|
|
24
|
-
* public myMethod(){}
|
|
25
|
-
* }
|
|
26
|
-
*
|
|
27
|
-
*/
|
|
28
|
-
export declare class EndpointMetadata extends JsonMethodStore {
|
|
29
|
-
get targetName(): string;
|
|
30
|
-
get params(): ParamMetadata[];
|
|
31
|
-
get view(): EndpointViewOptions;
|
|
32
|
-
set view(view: EndpointViewOptions);
|
|
33
|
-
get acceptMimes(): string[];
|
|
34
|
-
set acceptMimes(mimes: string[]);
|
|
35
|
-
/**
|
|
36
|
-
* Get an endpoint.
|
|
37
|
-
* @param target
|
|
38
|
-
* @param propertyKey
|
|
39
|
-
* @param descriptor
|
|
40
|
-
*/
|
|
41
|
-
static get(target: Type<any>, propertyKey: string | symbol, descriptor?: PropertyDescriptor): EndpointMetadata;
|
|
42
|
-
addOperationPath(method: string, path: string | RegExp, options?: any): import("@tsed/schema").JsonOperation;
|
|
43
|
-
/**
|
|
44
|
-
* Find the a value at the controller level. Let this value be extended or overridden by the endpoint itself.
|
|
45
|
-
*
|
|
46
|
-
* @param key
|
|
47
|
-
* @returns {any}
|
|
48
|
-
*/
|
|
49
|
-
get<T = any>(key: any): T;
|
|
50
|
-
}
|
|
1
|
+
export { EndpointMetadata } from "@tsed/schema";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { ContextMethods, DIContext, DIContextOptions } from "@tsed/di";
|
|
3
3
|
import { IncomingMessage, ServerResponse } from "http";
|
|
4
|
-
import { EndpointMetadata } from "
|
|
4
|
+
import { EndpointMetadata } from "@tsed/schema";
|
|
5
5
|
import { PlatformApplication } from "../services/PlatformApplication";
|
|
6
6
|
import { PlatformRequest } from "../services/PlatformRequest";
|
|
7
7
|
import { PlatformResponse } from "../services/PlatformResponse";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { JsonOperationRoute } from "@tsed/schema";
|
|
2
|
-
import { EndpointMetadata } from "./EndpointMetadata";
|
|
1
|
+
import { EndpointMetadata, JsonOperationRoute } from "@tsed/schema";
|
|
3
2
|
import { ControllerProvider } from "./ControllerProvider";
|
|
4
3
|
export interface PlatformRouterDetailsOptions {
|
|
5
4
|
provider: ControllerProvider;
|
|
@@ -17,7 +16,7 @@ export declare class PlatformRouteDetails extends JsonOperationRoute<EndpointMet
|
|
|
17
16
|
url: string;
|
|
18
17
|
className: string;
|
|
19
18
|
methodClassName: string;
|
|
20
|
-
parameters:
|
|
19
|
+
parameters: import("@tsed/schema").JsonParameterStore[];
|
|
21
20
|
rawBody: boolean;
|
|
22
21
|
};
|
|
23
22
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import "@tsed/logger";
|
|
2
|
+
import "@tsed/logger-file";
|
|
3
|
+
export * from "@tsed/di";
|
|
4
|
+
export * from "@tsed/platform-params";
|
|
5
|
+
export * from "@tsed/platform-exceptions";
|
|
6
|
+
export * from "@tsed/platform-response-filter";
|
|
7
|
+
export * from "@tsed/platform-cache";
|
|
8
|
+
export * from "@tsed/platform-middlewares";
|
|
9
|
+
export * from "@tsed/components-scan";
|
|
10
|
+
export * from "@tsed/platform-log-middleware";
|
|
11
|
+
export { $log, Logger } from "@tsed/logger";
|
|
12
|
+
export { AcceptMime, Location, Redirect, View, Get, Post, Put, Patch, Delete, Head, Options, All } from "@tsed/schema";
|