@inversifyjs/http-core 3.2.0 → 4.0.0
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/CHANGELOG.md +44 -0
- package/lib/cjs/http/actions/setErrorFilterToErrorFilterMap.d.ts +2 -1
- package/lib/cjs/http/actions/setErrorFilterToErrorFilterMap.d.ts.map +1 -1
- package/lib/cjs/http/actions/setErrorFilterToErrorFilterMap.js +5 -1
- package/lib/cjs/http/actions/setErrorFilterToErrorFilterMap.js.map +1 -1
- package/lib/cjs/http/adapter/InversifyHttpAdapter.d.ts.map +1 -1
- package/lib/cjs/http/adapter/InversifyHttpAdapter.js +18 -34
- package/lib/cjs/http/adapter/InversifyHttpAdapter.js.map +1 -1
- package/lib/cjs/http/calculations/buildHttpResponseErrorFilter.d.ts +6 -0
- package/lib/cjs/http/calculations/buildHttpResponseErrorFilter.d.ts.map +1 -0
- package/lib/cjs/http/calculations/buildHttpResponseErrorFilter.js +12 -0
- package/lib/cjs/http/calculations/buildHttpResponseErrorFilter.js.map +1 -0
- package/lib/cjs/http/calculations/buildHttpResponseErrorFilter.spec.d.ts +2 -0
- package/lib/cjs/http/calculations/buildHttpResponseErrorFilter.spec.d.ts.map +1 -0
- package/lib/cjs/http/calculations/getErrorFilterForError.d.ts +4 -0
- package/lib/cjs/http/calculations/getErrorFilterForError.d.ts.map +1 -0
- package/lib/cjs/http/calculations/getErrorFilterForError.js +30 -0
- package/lib/cjs/http/calculations/getErrorFilterForError.js.map +1 -0
- package/lib/cjs/http/calculations/getErrorFilterForError.spec.d.ts +2 -0
- package/lib/cjs/http/calculations/getErrorFilterForError.spec.d.ts.map +1 -0
- package/lib/cjs/httpResponse/models/BadGatewayHttpResponse.d.ts +2 -1
- package/lib/cjs/httpResponse/models/BadGatewayHttpResponse.d.ts.map +1 -1
- package/lib/cjs/httpResponse/models/BadGatewayHttpResponse.js +2 -2
- package/lib/cjs/httpResponse/models/BadGatewayHttpResponse.js.map +1 -1
- package/lib/cjs/httpResponse/models/BadRequestHttpResponse.d.ts +2 -1
- package/lib/cjs/httpResponse/models/BadRequestHttpResponse.d.ts.map +1 -1
- package/lib/cjs/httpResponse/models/BadRequestHttpResponse.js +2 -2
- package/lib/cjs/httpResponse/models/BadRequestHttpResponse.js.map +1 -1
- package/lib/cjs/httpResponse/models/ConflictHttpResponse.d.ts +2 -1
- package/lib/cjs/httpResponse/models/ConflictHttpResponse.d.ts.map +1 -1
- package/lib/cjs/httpResponse/models/ConflictHttpResponse.js +2 -2
- package/lib/cjs/httpResponse/models/ConflictHttpResponse.js.map +1 -1
- package/lib/cjs/httpResponse/models/ErrorHttpResponse.d.ts +3 -7
- package/lib/cjs/httpResponse/models/ErrorHttpResponse.d.ts.map +1 -1
- package/lib/cjs/httpResponse/models/ErrorHttpResponse.js +2 -10
- package/lib/cjs/httpResponse/models/ErrorHttpResponse.js.map +1 -1
- package/lib/cjs/httpResponse/models/ForbiddenHttpResponse.d.ts +2 -1
- package/lib/cjs/httpResponse/models/ForbiddenHttpResponse.d.ts.map +1 -1
- package/lib/cjs/httpResponse/models/ForbiddenHttpResponse.js +2 -2
- package/lib/cjs/httpResponse/models/ForbiddenHttpResponse.js.map +1 -1
- package/lib/cjs/httpResponse/models/GatewayTimeoutHttpResponse.d.ts +2 -1
- package/lib/cjs/httpResponse/models/GatewayTimeoutHttpResponse.d.ts.map +1 -1
- package/lib/cjs/httpResponse/models/GatewayTimeoutHttpResponse.js +2 -2
- package/lib/cjs/httpResponse/models/GatewayTimeoutHttpResponse.js.map +1 -1
- package/lib/cjs/httpResponse/models/GoneHttpResponse.d.ts +2 -1
- package/lib/cjs/httpResponse/models/GoneHttpResponse.d.ts.map +1 -1
- package/lib/cjs/httpResponse/models/GoneHttpResponse.js +2 -2
- package/lib/cjs/httpResponse/models/GoneHttpResponse.js.map +1 -1
- package/lib/cjs/httpResponse/models/HttpResponse.d.ts +1 -1
- package/lib/cjs/httpResponse/models/HttpResponse.d.ts.map +1 -1
- package/lib/cjs/httpResponse/models/HttpVersionNotSupportedHttpResponse.d.ts +2 -1
- package/lib/cjs/httpResponse/models/HttpVersionNotSupportedHttpResponse.d.ts.map +1 -1
- package/lib/cjs/httpResponse/models/HttpVersionNotSupportedHttpResponse.js +2 -2
- package/lib/cjs/httpResponse/models/HttpVersionNotSupportedHttpResponse.js.map +1 -1
- package/lib/cjs/httpResponse/models/InsufficientStorageHttpResponse.d.ts +2 -1
- package/lib/cjs/httpResponse/models/InsufficientStorageHttpResponse.d.ts.map +1 -1
- package/lib/cjs/httpResponse/models/InsufficientStorageHttpResponse.js +2 -2
- package/lib/cjs/httpResponse/models/InsufficientStorageHttpResponse.js.map +1 -1
- package/lib/cjs/httpResponse/models/InternalServerErrorHttpResponse.d.ts +2 -1
- package/lib/cjs/httpResponse/models/InternalServerErrorHttpResponse.d.ts.map +1 -1
- package/lib/cjs/httpResponse/models/InternalServerErrorHttpResponse.js +2 -2
- package/lib/cjs/httpResponse/models/InternalServerErrorHttpResponse.js.map +1 -1
- package/lib/cjs/httpResponse/models/LoopDetectedHttpResponse.d.ts +2 -1
- package/lib/cjs/httpResponse/models/LoopDetectedHttpResponse.d.ts.map +1 -1
- package/lib/cjs/httpResponse/models/LoopDetectedHttpResponse.js +2 -2
- package/lib/cjs/httpResponse/models/LoopDetectedHttpResponse.js.map +1 -1
- package/lib/cjs/httpResponse/models/MethodNotAllowedHttpResponse.d.ts +2 -1
- package/lib/cjs/httpResponse/models/MethodNotAllowedHttpResponse.d.ts.map +1 -1
- package/lib/cjs/httpResponse/models/MethodNotAllowedHttpResponse.js +2 -2
- package/lib/cjs/httpResponse/models/MethodNotAllowedHttpResponse.js.map +1 -1
- package/lib/cjs/httpResponse/models/NotAcceptableHttpResponse.d.ts +2 -1
- package/lib/cjs/httpResponse/models/NotAcceptableHttpResponse.d.ts.map +1 -1
- package/lib/cjs/httpResponse/models/NotAcceptableHttpResponse.js +2 -2
- package/lib/cjs/httpResponse/models/NotAcceptableHttpResponse.js.map +1 -1
- package/lib/cjs/httpResponse/models/NotFoundHttpResponse.d.ts +2 -1
- package/lib/cjs/httpResponse/models/NotFoundHttpResponse.d.ts.map +1 -1
- package/lib/cjs/httpResponse/models/NotFoundHttpResponse.js +2 -2
- package/lib/cjs/httpResponse/models/NotFoundHttpResponse.js.map +1 -1
- package/lib/cjs/httpResponse/models/NotImplementedHttpResponse.d.ts +2 -1
- package/lib/cjs/httpResponse/models/NotImplementedHttpResponse.d.ts.map +1 -1
- package/lib/cjs/httpResponse/models/NotImplementedHttpResponse.js +2 -2
- package/lib/cjs/httpResponse/models/NotImplementedHttpResponse.js.map +1 -1
- package/lib/cjs/httpResponse/models/PaymentRequiredHttpResponse.d.ts +2 -1
- package/lib/cjs/httpResponse/models/PaymentRequiredHttpResponse.d.ts.map +1 -1
- package/lib/cjs/httpResponse/models/PaymentRequiredHttpResponse.js +2 -2
- package/lib/cjs/httpResponse/models/PaymentRequiredHttpResponse.js.map +1 -1
- package/lib/cjs/httpResponse/models/ServiceUnavailableHttpResponse.d.ts +2 -1
- package/lib/cjs/httpResponse/models/ServiceUnavailableHttpResponse.d.ts.map +1 -1
- package/lib/cjs/httpResponse/models/ServiceUnavailableHttpResponse.js +2 -2
- package/lib/cjs/httpResponse/models/ServiceUnavailableHttpResponse.js.map +1 -1
- package/lib/cjs/httpResponse/models/SuccessHttpResponse.d.ts +1 -5
- package/lib/cjs/httpResponse/models/SuccessHttpResponse.d.ts.map +1 -1
- package/lib/cjs/httpResponse/models/SuccessHttpResponse.js +0 -8
- package/lib/cjs/httpResponse/models/SuccessHttpResponse.js.map +1 -1
- package/lib/cjs/httpResponse/models/UnauthorizedHttpResponse.d.ts +2 -1
- package/lib/cjs/httpResponse/models/UnauthorizedHttpResponse.d.ts.map +1 -1
- package/lib/cjs/httpResponse/models/UnauthorizedHttpResponse.js +2 -2
- package/lib/cjs/httpResponse/models/UnauthorizedHttpResponse.js.map +1 -1
- package/lib/cjs/httpResponse/models/UnprocessableEntityHttpResponse.d.ts +2 -1
- package/lib/cjs/httpResponse/models/UnprocessableEntityHttpResponse.d.ts.map +1 -1
- package/lib/cjs/httpResponse/models/UnprocessableEntityHttpResponse.js +2 -2
- package/lib/cjs/httpResponse/models/UnprocessableEntityHttpResponse.js.map +1 -1
- package/lib/cjs/routerExplorer/calculations/buildErrorTypeToErrorFilterMap.d.ts +2 -1
- package/lib/cjs/routerExplorer/calculations/buildErrorTypeToErrorFilterMap.d.ts.map +1 -1
- package/lib/cjs/routerExplorer/calculations/buildErrorTypeToErrorFilterMap.js +3 -3
- package/lib/cjs/routerExplorer/calculations/buildErrorTypeToErrorFilterMap.js.map +1 -1
- package/lib/cjs/routerExplorer/calculations/buildRouterExplorerControllerMetadata.d.ts +2 -1
- package/lib/cjs/routerExplorer/calculations/buildRouterExplorerControllerMetadata.d.ts.map +1 -1
- package/lib/cjs/routerExplorer/calculations/buildRouterExplorerControllerMetadata.js +2 -2
- package/lib/cjs/routerExplorer/calculations/buildRouterExplorerControllerMetadata.js.map +1 -1
- package/lib/cjs/routerExplorer/calculations/buildRouterExplorerControllerMetadataList.d.ts +2 -1
- package/lib/cjs/routerExplorer/calculations/buildRouterExplorerControllerMetadataList.d.ts.map +1 -1
- package/lib/cjs/routerExplorer/calculations/buildRouterExplorerControllerMetadataList.js +2 -2
- package/lib/cjs/routerExplorer/calculations/buildRouterExplorerControllerMetadataList.js.map +1 -1
- package/lib/cjs/routerExplorer/calculations/buildRouterExplorerControllerMethodMetadata.d.ts +2 -1
- package/lib/cjs/routerExplorer/calculations/buildRouterExplorerControllerMethodMetadata.d.ts.map +1 -1
- package/lib/cjs/routerExplorer/calculations/buildRouterExplorerControllerMethodMetadata.js +2 -2
- package/lib/cjs/routerExplorer/calculations/buildRouterExplorerControllerMethodMetadata.js.map +1 -1
- package/lib/cjs/routerExplorer/calculations/buildRouterExplorerControllerMethodMetadataList.d.ts +2 -1
- package/lib/cjs/routerExplorer/calculations/buildRouterExplorerControllerMethodMetadataList.d.ts.map +1 -1
- package/lib/cjs/routerExplorer/calculations/buildRouterExplorerControllerMethodMetadataList.js +2 -2
- package/lib/cjs/routerExplorer/calculations/buildRouterExplorerControllerMethodMetadataList.js.map +1 -1
- package/lib/cjs/routerExplorer/calculations/getControllerMethodHeaderMetadataList.d.ts.map +1 -1
- package/lib/cjs/routerExplorer/calculations/getControllerMethodHeaderMetadataList.js +14 -5
- package/lib/cjs/routerExplorer/calculations/getControllerMethodHeaderMetadataList.js.map +1 -1
- package/lib/cjs/routerExplorer/calculations/getControllerMethodMetadataList.d.ts.map +1 -1
- package/lib/cjs/routerExplorer/calculations/getControllerMethodMetadataList.js +16 -1
- package/lib/cjs/routerExplorer/calculations/getControllerMethodMetadataList.js.map +1 -1
- package/lib/cjs/routerExplorer/calculations/getControllerMethodParameterMetadataList.d.ts.map +1 -1
- package/lib/cjs/routerExplorer/calculations/getControllerMethodParameterMetadataList.js +2 -1
- package/lib/cjs/routerExplorer/calculations/getControllerMethodParameterMetadataList.js.map +1 -1
- package/lib/cjs/routerExplorer/calculations/getControllerMethodStatusCodeMetadata.d.ts.map +1 -1
- package/lib/cjs/routerExplorer/calculations/getControllerMethodStatusCodeMetadata.js +2 -1
- package/lib/cjs/routerExplorer/calculations/getControllerMethodStatusCodeMetadata.js.map +1 -1
- package/lib/cjs/routerExplorer/calculations/getControllerMethodUseNativeHandlerMetadata.d.ts.map +1 -1
- package/lib/cjs/routerExplorer/calculations/getControllerMethodUseNativeHandlerMetadata.js +2 -1
- package/lib/cjs/routerExplorer/calculations/getControllerMethodUseNativeHandlerMetadata.js.map +1 -1
- package/lib/esm/index.d.ts +20 -26
- package/lib/esm/index.js +1 -1
- package/lib/esm/index.js.map +1 -1
- package/package.json +12 -12
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.buildRouterExplorerControllerMetadata = buildRouterExplorerControllerMetadata;
|
|
4
4
|
const buildRouterExplorerControllerMethodMetadataList_1 = require("./buildRouterExplorerControllerMethodMetadataList");
|
|
5
5
|
const getControllerMethodMetadataList_1 = require("./getControllerMethodMetadataList");
|
|
6
|
-
function buildRouterExplorerControllerMetadata(controllerMetadata) {
|
|
6
|
+
function buildRouterExplorerControllerMetadata(logger, controllerMetadata) {
|
|
7
7
|
const controllerMethodMetadataList = (0, getControllerMethodMetadataList_1.getControllerMethodMetadataList)(controllerMetadata.target);
|
|
8
8
|
return {
|
|
9
|
-
controllerMethodMetadataList: (0, buildRouterExplorerControllerMethodMetadataList_1.buildRouterExplorerControllerMethodMetadataList)(controllerMetadata, controllerMethodMetadataList),
|
|
9
|
+
controllerMethodMetadataList: (0, buildRouterExplorerControllerMethodMetadataList_1.buildRouterExplorerControllerMethodMetadataList)(logger, controllerMetadata, controllerMethodMetadataList),
|
|
10
10
|
path: controllerMetadata.path,
|
|
11
11
|
serviceIdentifier: controllerMetadata.serviceIdentifier,
|
|
12
12
|
target: controllerMetadata.target,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildRouterExplorerControllerMetadata.js","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/buildRouterExplorerControllerMetadata.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"buildRouterExplorerControllerMetadata.js","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/buildRouterExplorerControllerMetadata.ts"],"names":[],"mappings":";;AAQA,sFAsBC;AAzBD,uHAAoH;AACpH,uFAAoF;AAEpF,SAAgB,qCAAqC,CAKnD,MAAc,EACd,kBAAsC;IAEtC,MAAM,4BAA4B,GAChC,IAAA,iEAA+B,EAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAE7D,OAAO;QACL,4BAA4B,EAC1B,IAAA,iGAA+C,EAC7C,MAAM,EACN,kBAAkB,EAClB,4BAA4B,CAC7B;QACH,IAAI,EAAE,kBAAkB,CAAC,IAAI;QAC7B,iBAAiB,EAAE,kBAAkB,CAAC,iBAAiB;QACvD,MAAM,EAAE,kBAAkB,CAAC,MAAM;KAClC,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import { Logger } from '@inversifyjs/logger';
|
|
1
2
|
import { Container } from 'inversify';
|
|
2
3
|
import { RouterExplorerControllerMetadata } from '../model/RouterExplorerControllerMetadata';
|
|
3
|
-
export declare function buildRouterExplorerControllerMetadataList<TRequest, TResponse, TResult>(container: Container): RouterExplorerControllerMetadata<TRequest, TResponse, TResult>[];
|
|
4
|
+
export declare function buildRouterExplorerControllerMetadataList<TRequest, TResponse, TResult>(container: Container, logger: Logger): RouterExplorerControllerMetadata<TRequest, TResponse, TResult>[];
|
|
4
5
|
//# sourceMappingURL=buildRouterExplorerControllerMetadataList.d.ts.map
|
package/lib/cjs/routerExplorer/calculations/buildRouterExplorerControllerMetadataList.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildRouterExplorerControllerMetadataList.d.ts","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/buildRouterExplorerControllerMetadataList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAKtC,OAAO,EAAE,gCAAgC,EAAE,MAAM,2CAA2C,CAAC;AAI7F,wBAAgB,yCAAyC,CACvD,QAAQ,EACR,SAAS,EACT,OAAO,EAEP,SAAS,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"buildRouterExplorerControllerMetadataList.d.ts","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/buildRouterExplorerControllerMetadataList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAKtC,OAAO,EAAE,gCAAgC,EAAE,MAAM,2CAA2C,CAAC;AAI7F,wBAAgB,yCAAyC,CACvD,QAAQ,EACR,SAAS,EACT,OAAO,EAEP,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,GACb,gCAAgC,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,CA0BlE"}
|
|
@@ -5,7 +5,7 @@ const InversifyHttpAdapterError_1 = require("../../error/models/InversifyHttpAda
|
|
|
5
5
|
const InversifyHttpAdapterErrorKind_1 = require("../../error/models/InversifyHttpAdapterErrorKind");
|
|
6
6
|
const buildRouterExplorerControllerMetadata_1 = require("./buildRouterExplorerControllerMetadata");
|
|
7
7
|
const getControllerMetadataList_1 = require("./getControllerMetadataList");
|
|
8
|
-
function buildRouterExplorerControllerMetadataList(container) {
|
|
8
|
+
function buildRouterExplorerControllerMetadataList(container, logger) {
|
|
9
9
|
const controllerMetadataList = (0, getControllerMetadataList_1.getControllerMetadataList)();
|
|
10
10
|
if (controllerMetadataList === undefined) {
|
|
11
11
|
throw new InversifyHttpAdapterError_1.InversifyHttpAdapterError(InversifyHttpAdapterErrorKind_1.InversifyHttpAdapterErrorKind.noControllerFound, 'No controllers found. Please ensure that your controllers are properly registered in your container and are annotated with the @Controller() decorator.');
|
|
@@ -13,7 +13,7 @@ function buildRouterExplorerControllerMetadataList(container) {
|
|
|
13
13
|
const routerExplorerControllerMetadataList = [];
|
|
14
14
|
for (const controllerMetadata of controllerMetadataList) {
|
|
15
15
|
if (container.isBound(controllerMetadata.serviceIdentifier)) {
|
|
16
|
-
routerExplorerControllerMetadataList.push((0, buildRouterExplorerControllerMetadata_1.buildRouterExplorerControllerMetadata)(controllerMetadata));
|
|
16
|
+
routerExplorerControllerMetadataList.push((0, buildRouterExplorerControllerMetadata_1.buildRouterExplorerControllerMetadata)(logger, controllerMetadata));
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
return routerExplorerControllerMetadataList;
|
package/lib/cjs/routerExplorer/calculations/buildRouterExplorerControllerMetadataList.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildRouterExplorerControllerMetadataList.js","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/buildRouterExplorerControllerMetadataList.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"buildRouterExplorerControllerMetadataList.js","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/buildRouterExplorerControllerMetadataList.ts"],"names":[],"mappings":";;AAUA,8FAiCC;AAxCD,4FAAyF;AACzF,oGAAiG;AAGjG,mGAAgG;AAChG,2EAAwE;AAExE,SAAgB,yCAAyC,CAKvD,SAAoB,EACpB,MAAc;IAEd,MAAM,sBAAsB,GAC1B,IAAA,qDAAyB,GAAE,CAAC;IAE9B,IAAI,sBAAsB,KAAK,SAAS,EAAE,CAAC;QACzC,MAAM,IAAI,qDAAyB,CACjC,6DAA6B,CAAC,iBAAiB,EAC/C,yJAAyJ,CAC1J,CAAC;IACJ,CAAC;IAED,MAAM,oCAAoC,GAIpC,EAAE,CAAC;IAET,KAAK,MAAM,kBAAkB,IAAI,sBAAsB,EAAE,CAAC;QACxD,IAAI,SAAS,CAAC,OAAO,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,EAAE,CAAC;YAC5D,oCAAoC,CAAC,IAAI,CACvC,IAAA,6EAAqC,EAAC,MAAM,EAAE,kBAAkB,CAAC,CAClE,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,oCAAoC,CAAC;AAC9C,CAAC"}
|
package/lib/cjs/routerExplorer/calculations/buildRouterExplorerControllerMethodMetadata.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { Logger } from '@inversifyjs/logger';
|
|
1
2
|
import { ControllerMetadata } from '../model/ControllerMetadata';
|
|
2
3
|
import { ControllerMethodMetadata } from '../model/ControllerMethodMetadata';
|
|
3
4
|
import { RouterExplorerControllerMethodMetadata } from '../model/RouterExplorerControllerMethodMetadata';
|
|
4
|
-
export declare function buildRouterExplorerControllerMethodMetadata<TRequest, TResponse, TResult>(controllerMetadata: ControllerMetadata, controllerMethodMetadata: ControllerMethodMetadata): RouterExplorerControllerMethodMetadata<TRequest, TResponse, TResult>;
|
|
5
|
+
export declare function buildRouterExplorerControllerMethodMetadata<TRequest, TResponse, TResult>(logger: Logger, controllerMetadata: ControllerMetadata, controllerMethodMetadata: ControllerMethodMetadata): RouterExplorerControllerMethodMetadata<TRequest, TResponse, TResult>;
|
|
5
6
|
//# sourceMappingURL=buildRouterExplorerControllerMethodMetadata.d.ts.map
|
package/lib/cjs/routerExplorer/calculations/buildRouterExplorerControllerMethodMetadata.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildRouterExplorerControllerMethodMetadata.d.ts","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/buildRouterExplorerControllerMethodMetadata.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"buildRouterExplorerControllerMethodMetadata.d.ts","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/buildRouterExplorerControllerMethodMetadata.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAI7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAE7E,OAAO,EAAE,sCAAsC,EAAE,MAAM,iDAAiD,CAAC;AAOzG,wBAAgB,2CAA2C,CACzD,QAAQ,EACR,SAAS,EACT,OAAO,EAEP,MAAM,EAAE,MAAM,EACd,kBAAkB,EAAE,kBAAkB,EACtC,wBAAwB,EAAE,wBAAwB,GACjD,sCAAsC,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,CAgGtE"}
|
|
@@ -7,7 +7,7 @@ const getControllerMethodHeaderMetadataList_1 = require("./getControllerMethodHe
|
|
|
7
7
|
const getControllerMethodParameterMetadataList_1 = require("./getControllerMethodParameterMetadataList");
|
|
8
8
|
const getControllerMethodStatusCodeMetadata_1 = require("./getControllerMethodStatusCodeMetadata");
|
|
9
9
|
const getControllerMethodUseNativeHandlerMetadata_1 = require("./getControllerMethodUseNativeHandlerMetadata");
|
|
10
|
-
function buildRouterExplorerControllerMethodMetadata(controllerMetadata, controllerMethodMetadata) {
|
|
10
|
+
function buildRouterExplorerControllerMethodMetadata(logger, controllerMetadata, controllerMethodMetadata) {
|
|
11
11
|
const controllerMethodParameterMetadataList = (0, getControllerMethodParameterMetadataList_1.getControllerMethodParameterMetadataList)(controllerMetadata.target, controllerMethodMetadata.methodKey);
|
|
12
12
|
const controllerMethodStatusCode = (0, getControllerMethodStatusCodeMetadata_1.getControllerMethodStatusCodeMetadata)(controllerMetadata.target, controllerMethodMetadata.methodKey);
|
|
13
13
|
const controllerMethodGuardList = [
|
|
@@ -21,7 +21,7 @@ function buildRouterExplorerControllerMethodMetadata(controllerMetadata, control
|
|
|
21
21
|
const controllerMiddlewareList = (0, framework_core_1.getClassMiddlewareList)(controllerMetadata.target);
|
|
22
22
|
const controllerMiddlewareOptions = (0, framework_core_1.buildMiddlewareOptionsFromApplyMiddlewareOptions)(controllerMiddlewareList);
|
|
23
23
|
const controllerMethodMiddlewareList = (0, framework_core_1.getClassMethodMiddlewareList)(controllerMetadata.target, controllerMethodMetadata.methodKey);
|
|
24
|
-
const errorTypeToErrorFilterMap = (0, buildErrorTypeToErrorFilterMap_1.buildErrorTypeToErrorFilterMap)(controllerMetadata.target, controllerMethodMetadata.methodKey);
|
|
24
|
+
const errorTypeToErrorFilterMap = (0, buildErrorTypeToErrorFilterMap_1.buildErrorTypeToErrorFilterMap)(logger, controllerMetadata.target, controllerMethodMetadata.methodKey);
|
|
25
25
|
const controllerMethodMiddlewareOptions = (0, framework_core_1.buildMiddlewareOptionsFromApplyMiddlewareOptions)(controllerMethodMiddlewareList);
|
|
26
26
|
const headerMetadataList = (0, getControllerMethodHeaderMetadataList_1.getControllerMethodHeaderMetadataList)(controllerMetadata.target, controllerMethodMetadata.methodKey);
|
|
27
27
|
const useNativeHandler = (0, getControllerMethodUseNativeHandlerMetadata_1.getControllerMethodUseNativeHandlerMetadata)(controllerMetadata.target, controllerMethodMetadata.methodKey);
|
package/lib/cjs/routerExplorer/calculations/buildRouterExplorerControllerMethodMetadata.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildRouterExplorerControllerMethodMetadata.js","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/buildRouterExplorerControllerMethodMetadata.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"buildRouterExplorerControllerMethodMetadata.js","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/buildRouterExplorerControllerMethodMetadata.ts"],"names":[],"mappings":";;AA6BA,kGAwGC;AArID,gEAcqC;AASrC,qFAAkF;AAClF,mGAAgG;AAChG,yGAAsG;AACtG,mGAAgG;AAChG,+GAA4G;AAE5G,SAAgB,2CAA2C,CAKzD,MAAc,EACd,kBAAsC,EACtC,wBAAkD;IAElD,MAAM,qCAAqC,GAGrC,IAAA,mFAAwC,EAC5C,kBAAkB,CAAC,MAAM,EACzB,wBAAwB,CAAC,SAAS,CACnC,CAAC;IAEF,MAAM,0BAA0B,GAC9B,IAAA,6EAAqC,EACnC,kBAAkB,CAAC,MAAM,EACzB,wBAAwB,CAAC,SAAS,CACnC,CAAC;IAEJ,MAAM,yBAAyB,GAAyC;QACtE,GAAG,IAAA,kCAAiB,EAAC,kBAAkB,CAAC,MAAM,CAAC;QAC/C,GAAG,IAAA,wCAAuB,EACxB,kBAAkB,CAAC,MAAM,EACzB,wBAAwB,CAAC,SAAS,CACnC;KACF,CAAC;IAEF,MAAM,+BAA+B,GAE/B;QACJ,GAAG,IAAA,wCAAuB,EAAC,kBAAkB,CAAC,MAAM,CAAC;QACrD,GAAG,IAAA,8CAA6B,EAC9B,kBAAkB,CAAC,MAAM,EACzB,wBAAwB,CAAC,SAAS,CACnC;KACF,CAAC;IAEF,MAAM,wBAAwB,GAIxB,IAAA,uCAAsB,EAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAExD,MAAM,2BAA2B,GAC/B,IAAA,iEAAgD,EAAC,wBAAwB,CAAC,CAAC;IAE7E,MAAM,8BAA8B,GAI9B,IAAA,6CAA4B,EAChC,kBAAkB,CAAC,MAAM,EACzB,wBAAwB,CAAC,SAAS,CACnC,CAAC;IAEF,MAAM,yBAAyB,GAG3B,IAAA,+DAA8B,EAChC,MAAM,EACN,kBAAkB,CAAC,MAAM,EACzB,wBAAwB,CAAC,SAAS,CACnC,CAAC;IAEF,MAAM,iCAAiC,GACrC,IAAA,iEAAgD,EAC9C,8BAA8B,CAC/B,CAAC;IAEJ,MAAM,kBAAkB,GACtB,IAAA,6EAAqC,EACnC,kBAAkB,CAAC,MAAM,EACzB,wBAAwB,CAAC,SAAS,CACnC,CAAC;IAEJ,MAAM,gBAAgB,GAAY,IAAA,yFAA2C,EAC3E,kBAAkB,CAAC,MAAM,EACzB,wBAAwB,CAAC,SAAS,CACnC,CAAC;IAEF,OAAO;QACL,yBAAyB;QACzB,SAAS,EAAE,yBAAyB;QACpC,kBAAkB;QAClB,eAAe,EAAE,+BAA+B;QAChD,SAAS,EAAE,wBAAwB,CAAC,SAAS;QAC7C,qBAAqB,EAAE,qCAAqC;QAC5D,IAAI,EAAE,wBAAwB,CAAC,IAAI;QACnC,yBAAyB,EAAE;YACzB,GAAG,2BAA2B,CAAC,yBAAyB;YACxD,GAAG,iCAAiC,CAAC,yBAAyB;SAC/D;QACD,wBAAwB,EAAE;YACxB,GAAG,2BAA2B,CAAC,wBAAwB;YACvD,GAAG,iCAAiC,CAAC,wBAAwB;SAC9D;QACD,iBAAiB,EAAE,wBAAwB,CAAC,iBAAiB;QAC7D,UAAU,EAAE,0BAA0B;QACtC,gBAAgB;KACjB,CAAC;AACJ,CAAC"}
|
package/lib/cjs/routerExplorer/calculations/buildRouterExplorerControllerMethodMetadataList.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { Logger } from '@inversifyjs/logger';
|
|
1
2
|
import { ControllerMetadata } from '../model/ControllerMetadata';
|
|
2
3
|
import { ControllerMethodMetadata } from '../model/ControllerMethodMetadata';
|
|
3
4
|
import { RouterExplorerControllerMethodMetadata } from '../model/RouterExplorerControllerMethodMetadata';
|
|
4
|
-
export declare function buildRouterExplorerControllerMethodMetadataList<TRequest, TResponse, TResult>(controllerMetadata: ControllerMetadata, controllerMethodMetadataList: ControllerMethodMetadata[]): RouterExplorerControllerMethodMetadata<TRequest, TResponse, TResult>[];
|
|
5
|
+
export declare function buildRouterExplorerControllerMethodMetadataList<TRequest, TResponse, TResult>(logger: Logger, controllerMetadata: ControllerMetadata, controllerMethodMetadataList: ControllerMethodMetadata[]): RouterExplorerControllerMethodMetadata<TRequest, TResponse, TResult>[];
|
|
5
6
|
//# sourceMappingURL=buildRouterExplorerControllerMethodMetadataList.d.ts.map
|
package/lib/cjs/routerExplorer/calculations/buildRouterExplorerControllerMethodMetadataList.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildRouterExplorerControllerMethodMetadataList.d.ts","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/buildRouterExplorerControllerMethodMetadataList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,sCAAsC,EAAE,MAAM,iDAAiD,CAAC;AAGzG,wBAAgB,+CAA+C,CAC7D,QAAQ,EACR,SAAS,EACT,OAAO,EAEP,kBAAkB,EAAE,kBAAkB,EACtC,4BAA4B,EAAE,wBAAwB,EAAE,GACvD,sCAAsC,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"buildRouterExplorerControllerMethodMetadataList.d.ts","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/buildRouterExplorerControllerMethodMetadataList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,sCAAsC,EAAE,MAAM,iDAAiD,CAAC;AAGzG,wBAAgB,+CAA+C,CAC7D,QAAQ,EACR,SAAS,EACT,OAAO,EAEP,MAAM,EAAE,MAAM,EACd,kBAAkB,EAAE,kBAAkB,EACtC,4BAA4B,EAAE,wBAAwB,EAAE,GACvD,sCAAsC,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,CASxE"}
|
package/lib/cjs/routerExplorer/calculations/buildRouterExplorerControllerMethodMetadataList.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildRouterExplorerControllerMethodMetadataList = buildRouterExplorerControllerMethodMetadataList;
|
|
4
4
|
const buildRouterExplorerControllerMethodMetadata_1 = require("./buildRouterExplorerControllerMethodMetadata");
|
|
5
|
-
function buildRouterExplorerControllerMethodMetadataList(controllerMetadata, controllerMethodMetadataList) {
|
|
6
|
-
return controllerMethodMetadataList.map((controllerMethodMetadata) => (0, buildRouterExplorerControllerMethodMetadata_1.buildRouterExplorerControllerMethodMetadata)(controllerMetadata, controllerMethodMetadata));
|
|
5
|
+
function buildRouterExplorerControllerMethodMetadataList(logger, controllerMetadata, controllerMethodMetadataList) {
|
|
6
|
+
return controllerMethodMetadataList.map((controllerMethodMetadata) => (0, buildRouterExplorerControllerMethodMetadata_1.buildRouterExplorerControllerMethodMetadata)(logger, controllerMetadata, controllerMethodMetadata));
|
|
7
7
|
}
|
|
8
8
|
//# sourceMappingURL=buildRouterExplorerControllerMethodMetadataList.js.map
|
package/lib/cjs/routerExplorer/calculations/buildRouterExplorerControllerMethodMetadataList.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildRouterExplorerControllerMethodMetadataList.js","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/buildRouterExplorerControllerMethodMetadataList.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"buildRouterExplorerControllerMethodMetadataList.js","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/buildRouterExplorerControllerMethodMetadataList.ts"],"names":[],"mappings":";;AAOA,0GAiBC;AAnBD,+GAA4G;AAE5G,SAAgB,+CAA+C,CAK7D,MAAc,EACd,kBAAsC,EACtC,4BAAwD;IAExD,OAAO,4BAA4B,CAAC,GAAG,CACrC,CAAC,wBAAkD,EAAE,EAAE,CACrD,IAAA,yFAA2C,EACzC,MAAM,EACN,kBAAkB,EAClB,wBAAwB,CACzB,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getControllerMethodHeaderMetadataList.d.ts","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/getControllerMethodHeaderMetadataList.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getControllerMethodHeaderMetadataList.d.ts","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/getControllerMethodHeaderMetadataList.ts"],"names":[],"mappings":"AAMA,wBAAgB,qCAAqC,CACnD,UAAU,EAAE,eAAe,EAC3B,SAAS,EAAE,MAAM,GAAG,MAAM,GACzB,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAyBpB"}
|
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getControllerMethodHeaderMetadataList = getControllerMethodHeaderMetadataList;
|
|
4
|
+
const prototype_utils_1 = require("@inversifyjs/prototype-utils");
|
|
4
5
|
const reflect_metadata_utils_1 = require("@inversifyjs/reflect-metadata-utils");
|
|
5
6
|
const controllerMethodHeaderMetadataReflectKey_1 = require("../../reflectMetadata/data/controllerMethodHeaderMetadataReflectKey");
|
|
6
7
|
function getControllerMethodHeaderMetadataList(controller, methodKey) {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const headerMetadataMap = new Map();
|
|
9
|
+
let currentType = controller;
|
|
10
|
+
while (currentType !== undefined) {
|
|
11
|
+
const headerMetadata = (0, reflect_metadata_utils_1.getOwnReflectMetadata)(currentType, controllerMethodHeaderMetadataReflectKey_1.controllerMethodHeaderMetadataReflectKey, methodKey);
|
|
12
|
+
if (headerMetadata !== undefined) {
|
|
13
|
+
for (const [key, value] of headerMetadata.entries()) {
|
|
14
|
+
if (!headerMetadataMap.has(key)) {
|
|
15
|
+
headerMetadataMap.set(key, value);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
currentType = (0, prototype_utils_1.getBaseType)(currentType);
|
|
11
20
|
}
|
|
12
|
-
return
|
|
21
|
+
return [...headerMetadataMap.entries()];
|
|
13
22
|
}
|
|
14
23
|
//# sourceMappingURL=getControllerMethodHeaderMetadataList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getControllerMethodHeaderMetadataList.js","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/getControllerMethodHeaderMetadataList.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"getControllerMethodHeaderMetadataList.js","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/getControllerMethodHeaderMetadataList.ts"],"names":[],"mappings":";;AAMA,sFA4BC;AAlCD,kEAA2D;AAC3D,gFAA4E;AAG5E,kIAA+H;AAE/H,SAAgB,qCAAqC,CACnD,UAA2B,EAC3B,SAA0B;IAE1B,MAAM,iBAAiB,GAAwB,IAAI,GAAG,EAAkB,CAAC;IAEzE,IAAI,WAAW,GAAwB,UAAqB,CAAC;IAE7D,OAAO,WAAW,KAAK,SAAS,EAAE,CAAC;QACjC,MAAM,cAAc,GAClB,IAAA,8CAAqB,EACnB,WAAW,EACX,mFAAwC,EACxC,SAAS,CACV,CAAC;QAEJ,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;YACjC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,cAAc,CAAC,OAAO,EAAE,EAAE,CAAC;gBACpD,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;oBAChC,iBAAiB,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;gBACpC,CAAC;YACH,CAAC;QACH,CAAC;QAED,WAAW,GAAG,IAAA,6BAAW,EAAC,WAAW,CAAC,CAAC;IACzC,CAAC;IAED,OAAO,CAAC,GAAG,iBAAiB,CAAC,OAAO,EAAE,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getControllerMethodMetadataList.d.ts","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/getControllerMethodMetadataList.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getControllerMethodMetadataList.d.ts","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/getControllerMethodMetadataList.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAE7E,wBAAgB,+BAA+B,CAC7C,qBAAqB,EAAE,eAAe,GACrC,wBAAwB,EAAE,CA0B5B"}
|
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getControllerMethodMetadataList = getControllerMethodMetadataList;
|
|
4
|
+
const prototype_utils_1 = require("@inversifyjs/prototype-utils");
|
|
4
5
|
const reflect_metadata_utils_1 = require("@inversifyjs/reflect-metadata-utils");
|
|
5
6
|
const controllerMethodMetadataReflectKey_1 = require("../../reflectMetadata/data/controllerMethodMetadataReflectKey");
|
|
6
7
|
function getControllerMethodMetadataList(controllerConstructor) {
|
|
7
|
-
|
|
8
|
+
const metadataListMap = new Map();
|
|
9
|
+
let currentType = controllerConstructor;
|
|
10
|
+
while (currentType !== undefined) {
|
|
11
|
+
const metadataList = (0, reflect_metadata_utils_1.getOwnReflectMetadata)(currentType, controllerMethodMetadataReflectKey_1.controllerMethodMetadataReflectKey);
|
|
12
|
+
if (metadataList !== undefined) {
|
|
13
|
+
for (const metadata of metadataList) {
|
|
14
|
+
const collisionKey = `${metadata.requestMethodType}:${metadata.path}`;
|
|
15
|
+
if (!metadataListMap.has(collisionKey)) {
|
|
16
|
+
metadataListMap.set(collisionKey, metadata);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
currentType = (0, prototype_utils_1.getBaseType)(currentType);
|
|
21
|
+
}
|
|
22
|
+
return [...metadataListMap.values()];
|
|
8
23
|
}
|
|
9
24
|
//# sourceMappingURL=getControllerMethodMetadataList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getControllerMethodMetadataList.js","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/getControllerMethodMetadataList.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"getControllerMethodMetadataList.js","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/getControllerMethodMetadataList.ts"],"names":[],"mappings":";;AAOA,0EA4BC;AAnCD,kEAA2D;AAC3D,gFAA4E;AAG5E,sHAAmH;AAGnH,SAAgB,+BAA+B,CAC7C,qBAAsC;IAEtC,MAAM,eAAe,GAA0C,IAAI,GAAG,EAGnE,CAAC;IAEJ,IAAI,WAAW,GAAwB,qBAAgC,CAAC;IAExE,OAAO,WAAW,KAAK,SAAS,EAAE,CAAC;QACjC,MAAM,YAAY,GAChB,IAAA,8CAAqB,EAAC,WAAW,EAAE,uEAAkC,CAAC,CAAC;QAEzE,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;YAC/B,KAAK,MAAM,QAAQ,IAAI,YAAY,EAAE,CAAC;gBACpC,MAAM,YAAY,GAAW,GAAG,QAAQ,CAAC,iBAAiB,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC;gBAE9E,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;oBACvC,eAAe,CAAC,GAAG,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;gBAC9C,CAAC;YACH,CAAC;QACH,CAAC;QAED,WAAW,GAAG,IAAA,6BAAW,EAAC,WAAW,CAAC,CAAC;IACzC,CAAC;IAED,OAAO,CAAC,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC;AACvC,CAAC"}
|
package/lib/cjs/routerExplorer/calculations/getControllerMethodParameterMetadataList.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getControllerMethodParameterMetadataList.d.ts","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/getControllerMethodParameterMetadataList.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getControllerMethodParameterMetadataList.d.ts","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/getControllerMethodParameterMetadataList.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iCAAiC,EAAE,MAAM,4CAA4C,CAAC;AAE/F,wBAAgB,wCAAwC,CACtD,qBAAqB,EAAE,eAAe,EACtC,SAAS,EAAE,MAAM,GAAG,MAAM,GACzB,CAAC,iCAAiC,GAAG,SAAS,CAAC,EAAE,CAcnD"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getControllerMethodParameterMetadataList = getControllerMethodParameterMetadataList;
|
|
4
|
+
const prototype_utils_1 = require("@inversifyjs/prototype-utils");
|
|
4
5
|
const reflect_metadata_utils_1 = require("@inversifyjs/reflect-metadata-utils");
|
|
5
6
|
const controllerMethodParameterMetadataReflectKey_1 = require("../../reflectMetadata/data/controllerMethodParameterMetadataReflectKey");
|
|
6
7
|
function getControllerMethodParameterMetadataList(controllerConstructor, methodKey) {
|
|
7
|
-
return ((0, reflect_metadata_utils_1.getOwnReflectMetadata)(
|
|
8
|
+
return ((0, prototype_utils_1.findInPrototypeChain)(controllerConstructor, (type) => (0, reflect_metadata_utils_1.getOwnReflectMetadata)(type, controllerMethodParameterMetadataReflectKey_1.controllerMethodParameterMetadataReflectKey, methodKey)) ?? []);
|
|
8
9
|
}
|
|
9
10
|
//# sourceMappingURL=getControllerMethodParameterMetadataList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getControllerMethodParameterMetadataList.js","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/getControllerMethodParameterMetadataList.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"getControllerMethodParameterMetadataList.js","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/getControllerMethodParameterMetadataList.ts"],"names":[],"mappings":";;AAOA,4FAiBC;AAxBD,kEAAoE;AACpE,gFAA4E;AAG5E,wIAAqI;AAGrI,SAAgB,wCAAwC,CACtD,qBAAsC,EACtC,SAA0B;IAE1B,OAAO,CACL,IAAA,sCAAoB,EAClB,qBAAgC,EAChC,CACE,IAAa,EACkD,EAAE,CACjE,IAAA,8CAAqB,EACnB,IAAI,EACJ,yFAA2C,EAC3C,SAAS,CACV,CACJ,IAAI,EAAE,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getControllerMethodStatusCodeMetadata.d.ts","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/getControllerMethodStatusCodeMetadata.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getControllerMethodStatusCodeMetadata.d.ts","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/getControllerMethodStatusCodeMetadata.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAGlE,wBAAgB,qCAAqC,CACnD,qBAAqB,EAAE,eAAe,EACtC,SAAS,EAAE,MAAM,GAAG,MAAM,GACzB,cAAc,GAAG,SAAS,CAU5B"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getControllerMethodStatusCodeMetadata = getControllerMethodStatusCodeMetadata;
|
|
4
|
+
const prototype_utils_1 = require("@inversifyjs/prototype-utils");
|
|
4
5
|
const reflect_metadata_utils_1 = require("@inversifyjs/reflect-metadata-utils");
|
|
5
6
|
const controllerMethodStatusCodeMetadataReflectKey_1 = require("../../reflectMetadata/data/controllerMethodStatusCodeMetadataReflectKey");
|
|
6
7
|
function getControllerMethodStatusCodeMetadata(controllerConstructor, methodKey) {
|
|
7
|
-
return (0, reflect_metadata_utils_1.getOwnReflectMetadata)(
|
|
8
|
+
return (0, prototype_utils_1.findInPrototypeChain)(controllerConstructor, (type) => (0, reflect_metadata_utils_1.getOwnReflectMetadata)(type, controllerMethodStatusCodeMetadataReflectKey_1.controllerMethodStatusCodeMetadataReflectKey, methodKey));
|
|
8
9
|
}
|
|
9
10
|
//# sourceMappingURL=getControllerMethodStatusCodeMetadata.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getControllerMethodStatusCodeMetadata.js","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/getControllerMethodStatusCodeMetadata.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"getControllerMethodStatusCodeMetadata.js","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/getControllerMethodStatusCodeMetadata.ts"],"names":[],"mappings":";;AAOA,sFAaC;AApBD,kEAAoE;AACpE,gFAA4E;AAI5E,0IAAuI;AAEvI,SAAgB,qCAAqC,CACnD,qBAAsC,EACtC,SAA0B;IAE1B,OAAO,IAAA,sCAAoB,EACzB,qBAAgC,EAChC,CAAC,IAAa,EAA8B,EAAE,CAC5C,IAAA,8CAAqB,EACnB,IAAI,EACJ,2FAA4C,EAC5C,SAAS,CACV,CACJ,CAAC;AACJ,CAAC"}
|
package/lib/cjs/routerExplorer/calculations/getControllerMethodUseNativeHandlerMetadata.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getControllerMethodUseNativeHandlerMetadata.d.ts","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/getControllerMethodUseNativeHandlerMetadata.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getControllerMethodUseNativeHandlerMetadata.d.ts","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/getControllerMethodUseNativeHandlerMetadata.ts"],"names":[],"mappings":"AAMA,wBAAgB,2CAA2C,CACzD,qBAAqB,EAAE,eAAe,EACtC,SAAS,EAAE,MAAM,GAAG,MAAM,GACzB,OAAO,CAYT"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getControllerMethodUseNativeHandlerMetadata = getControllerMethodUseNativeHandlerMetadata;
|
|
4
|
+
const prototype_utils_1 = require("@inversifyjs/prototype-utils");
|
|
4
5
|
const reflect_metadata_utils_1 = require("@inversifyjs/reflect-metadata-utils");
|
|
5
6
|
const controllerMethodUseNativeHandlerMetadataReflectKey_1 = require("../../reflectMetadata/data/controllerMethodUseNativeHandlerMetadataReflectKey");
|
|
6
7
|
function getControllerMethodUseNativeHandlerMetadata(controllerConstructor, methodKey) {
|
|
7
|
-
return ((0, reflect_metadata_utils_1.getOwnReflectMetadata)(
|
|
8
|
+
return ((0, prototype_utils_1.findInPrototypeChain)(controllerConstructor, (type) => (0, reflect_metadata_utils_1.getOwnReflectMetadata)(type, controllerMethodUseNativeHandlerMetadataReflectKey_1.controllerMethodUseNativeHandlerMetadataReflectKey, methodKey)) ?? false);
|
|
8
9
|
}
|
|
9
10
|
//# sourceMappingURL=getControllerMethodUseNativeHandlerMetadata.js.map
|
package/lib/cjs/routerExplorer/calculations/getControllerMethodUseNativeHandlerMetadata.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getControllerMethodUseNativeHandlerMetadata.js","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/getControllerMethodUseNativeHandlerMetadata.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"getControllerMethodUseNativeHandlerMetadata.js","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/getControllerMethodUseNativeHandlerMetadata.ts"],"names":[],"mappings":";;AAMA,kGAeC;AArBD,kEAAoE;AACpE,gFAA4E;AAG5E,sJAAmJ;AAEnJ,SAAgB,2CAA2C,CACzD,qBAAsC,EACtC,SAA0B;IAE1B,OAAO,CACL,IAAA,sCAAoB,EAClB,qBAAgC,EAChC,CAAC,IAAa,EAAuB,EAAE,CACrC,IAAA,8CAAqB,EACnB,IAAI,EACJ,uGAAkD,EAClD,SAAS,CACV,CACJ,IAAI,KAAK,CACX,CAAC;AACJ,CAAC"}
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -201,14 +201,11 @@ interface HttpResponse {
|
|
|
201
201
|
|
|
202
202
|
declare function isHttpResponse(value: unknown): value is HttpResponse;
|
|
203
203
|
|
|
204
|
-
declare const isSuccessHttpResponse: unique symbol;
|
|
205
204
|
declare class SuccessHttpResponse implements HttpResponse {
|
|
206
205
|
readonly statusCode: HttpStatusCode;
|
|
207
206
|
readonly body?: (object | string | number | boolean | Stream) | undefined;
|
|
208
207
|
[isHttpResponse$1]: true;
|
|
209
|
-
[isSuccessHttpResponse]: true;
|
|
210
208
|
constructor(statusCode: HttpStatusCode, body?: (object | string | number | boolean | Stream) | undefined);
|
|
211
|
-
static is(value: unknown): value is SuccessHttpResponse;
|
|
212
209
|
}
|
|
213
210
|
|
|
214
211
|
declare class AcceptedHttpResponse extends SuccessHttpResponse {
|
|
@@ -219,26 +216,23 @@ declare class AlreadyReportedHttpResponse extends SuccessHttpResponse {
|
|
|
219
216
|
constructor(body?: object | string | number | boolean);
|
|
220
217
|
}
|
|
221
218
|
|
|
222
|
-
declare const isErrorHttpResponse: unique symbol;
|
|
223
219
|
declare class ErrorHttpResponse extends Error implements HttpResponse {
|
|
224
220
|
readonly statusCode: HttpStatusCode;
|
|
225
221
|
readonly [isHttpResponse$1]: true;
|
|
226
|
-
readonly
|
|
227
|
-
|
|
228
|
-
constructor(statusCode: HttpStatusCode, error: string, message?: string, errorOptions?: ErrorOptions);
|
|
229
|
-
static is(value: unknown): value is ErrorHttpResponse;
|
|
222
|
+
readonly body?: object | string | number | boolean | Stream | undefined;
|
|
223
|
+
constructor(statusCode: HttpStatusCode, body?: object | string | number | boolean | Stream | undefined, message?: string | undefined, errorOptions?: ErrorOptions | undefined);
|
|
230
224
|
}
|
|
231
225
|
|
|
232
226
|
declare class BadGatewayHttpResponse extends ErrorHttpResponse {
|
|
233
|
-
constructor(
|
|
227
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
234
228
|
}
|
|
235
229
|
|
|
236
230
|
declare class BadRequestHttpResponse extends ErrorHttpResponse {
|
|
237
|
-
constructor(
|
|
231
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
238
232
|
}
|
|
239
233
|
|
|
240
234
|
declare class ConflictHttpResponse extends ErrorHttpResponse {
|
|
241
|
-
constructor(
|
|
235
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
242
236
|
}
|
|
243
237
|
|
|
244
238
|
declare class ContentDifferentHttpResponse extends SuccessHttpResponse {
|
|
@@ -250,35 +244,35 @@ declare class CreatedHttpResponse extends SuccessHttpResponse {
|
|
|
250
244
|
}
|
|
251
245
|
|
|
252
246
|
declare class ForbiddenHttpResponse extends ErrorHttpResponse {
|
|
253
|
-
constructor(
|
|
247
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
254
248
|
}
|
|
255
249
|
|
|
256
250
|
declare class GatewayTimeoutHttpResponse extends ErrorHttpResponse {
|
|
257
|
-
constructor(
|
|
251
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
258
252
|
}
|
|
259
253
|
|
|
260
254
|
declare class GoneHttpResponse extends ErrorHttpResponse {
|
|
261
|
-
constructor(
|
|
255
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
262
256
|
}
|
|
263
257
|
|
|
264
258
|
declare class HttpVersionNotSupportedHttpResponse extends ErrorHttpResponse {
|
|
265
|
-
constructor(
|
|
259
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
266
260
|
}
|
|
267
261
|
|
|
268
262
|
declare class InsufficientStorageHttpResponse extends ErrorHttpResponse {
|
|
269
|
-
constructor(
|
|
263
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
270
264
|
}
|
|
271
265
|
|
|
272
266
|
declare class InternalServerErrorHttpResponse extends ErrorHttpResponse {
|
|
273
|
-
constructor(
|
|
267
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
274
268
|
}
|
|
275
269
|
|
|
276
270
|
declare class LoopDetectedHttpResponse extends ErrorHttpResponse {
|
|
277
|
-
constructor(
|
|
271
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
278
272
|
}
|
|
279
273
|
|
|
280
274
|
declare class MethodNotAllowedHttpResponse extends ErrorHttpResponse {
|
|
281
|
-
constructor(
|
|
275
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
282
276
|
}
|
|
283
277
|
|
|
284
278
|
declare class MultiStatusHttpResponse extends SuccessHttpResponse {
|
|
@@ -294,15 +288,15 @@ declare class NonAuthoritativeInformationHttpResponse extends SuccessHttpRespons
|
|
|
294
288
|
}
|
|
295
289
|
|
|
296
290
|
declare class NotAcceptableHttpResponse extends ErrorHttpResponse {
|
|
297
|
-
constructor(
|
|
291
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
298
292
|
}
|
|
299
293
|
|
|
300
294
|
declare class NotFoundHttpResponse extends ErrorHttpResponse {
|
|
301
|
-
constructor(
|
|
295
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
302
296
|
}
|
|
303
297
|
|
|
304
298
|
declare class NotImplementedHttpResponse extends ErrorHttpResponse {
|
|
305
|
-
constructor(
|
|
299
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
306
300
|
}
|
|
307
301
|
|
|
308
302
|
declare class OkHttpResponse extends SuccessHttpResponse {
|
|
@@ -314,7 +308,7 @@ declare class PartialContentHttpResponse extends SuccessHttpResponse {
|
|
|
314
308
|
}
|
|
315
309
|
|
|
316
310
|
declare class PaymentRequiredHttpResponse extends ErrorHttpResponse {
|
|
317
|
-
constructor(
|
|
311
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
318
312
|
}
|
|
319
313
|
|
|
320
314
|
declare class ResetContentHttpResponse extends SuccessHttpResponse {
|
|
@@ -322,15 +316,15 @@ declare class ResetContentHttpResponse extends SuccessHttpResponse {
|
|
|
322
316
|
}
|
|
323
317
|
|
|
324
318
|
declare class ServiceUnavailableHttpResponse extends ErrorHttpResponse {
|
|
325
|
-
constructor(
|
|
319
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
326
320
|
}
|
|
327
321
|
|
|
328
322
|
declare class UnauthorizedHttpResponse extends ErrorHttpResponse {
|
|
329
|
-
constructor(
|
|
323
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
330
324
|
}
|
|
331
325
|
|
|
332
326
|
declare class UnprocessableEntityHttpResponse extends ErrorHttpResponse {
|
|
333
|
-
constructor(
|
|
327
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
334
328
|
}
|
|
335
329
|
|
|
336
330
|
interface ControllerMetadata {
|
package/lib/esm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{getCatchErrorMetadata as t,getClassMethodErrorFilterMetadata as e,getClassErrorFilterMetadata as r,getClassGuardList as s,getClassMethodGuardList as o,getClassInterceptorList as a,getClassMethodInterceptorList as n,getClassMiddlewareList as i,buildMiddlewareOptionsFromApplyMiddlewareOptions as c,getClassMethodMiddlewareList as l,isPipe as d}from"@inversifyjs/framework-core";export{ApplyMiddleware,CatchError,MiddlewarePhase,UseErrorFilter,UseGuard,UseInterceptor}from"@inversifyjs/framework-core";import{Readable as u}from"node:stream";import{ConsoleLogger as E}from"@inversifyjs/logger";import{getBaseType as p}from"@inversifyjs/prototype-utils";import{getOwnReflectMetadata as T,updateOwnReflectMetadata as h,buildEmptyArrayMetadata as N,buildArrayMetadataWithIndex as O,setReflectMetadata as R,buildArrayMetadataWithElement as A,buildEmptyMapMetadata as _}from"@inversifyjs/reflect-metadata-utils";import{injectable as I}from"inversify";const f=Symbol.for("@inversifyjs/http-core/InversifyHttpAdapterError");class y extends Error{kind;extraData;[f];constructor(t,e,r,s){super(e,r),this.kind=t,this.extraData=s,this[f]=!0}static is(t){return"object"==typeof t&&null!==t&&!0===t[f]}static isErrorOfKind(t,e){return y.is(t)&&t.kind===e}}var L;!function(t){t[t.invalidOperationAfterBuild=0]="invalidOperationAfterBuild",t[t.noControllerFound=1]="noControllerFound",t[t.requestParamIncorrectUse=2]="requestParamIncorrectUse"}(L||(L={}));const M=Symbol.for("@inversifyjs/http-core/HttpResponse");function m(t){return"object"==typeof t&&null!==t&&!0===t[M]}const D=Symbol.for("@inversifyjs/http-core/ErrorHttpResponse");class g extends Error{statusCode;[M];[D];body;constructor(t,e,r,s){super(r,s),this.statusCode=t,this.body={error:e,message:r,statusCode:t},this[D]=!0,this[M]=!0}static is(t){return m(t)&&!0===t[D]}}var C;!function(t){t[t.CONTINUE=100]="CONTINUE",t[t.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",t[t.PROCESSING=102]="PROCESSING",t[t.EARLYHINTS=103]="EARLYHINTS",t[t.OK=200]="OK",t[t.CREATED=201]="CREATED",t[t.ACCEPTED=202]="ACCEPTED",t[t.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",t[t.NO_CONTENT=204]="NO_CONTENT",t[t.RESET_CONTENT=205]="RESET_CONTENT",t[t.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",t[t.MULTI_STATUS=207]="MULTI_STATUS",t[t.ALREADY_REPORTED=208]="ALREADY_REPORTED",t[t.CONTENT_DIFFERENT=210]="CONTENT_DIFFERENT",t[t.AMBIGUOUS=300]="AMBIGUOUS",t[t.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",t[t.FOUND=302]="FOUND",t[t.SEE_OTHER=303]="SEE_OTHER",t[t.NOT_MODIFIED=304]="NOT_MODIFIED",t[t.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",t[t.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",t[t.BAD_REQUEST=400]="BAD_REQUEST",t[t.UNAUTHORIZED=401]="UNAUTHORIZED",t[t.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",t[t.FORBIDDEN=403]="FORBIDDEN",t[t.NOT_FOUND=404]="NOT_FOUND",t[t.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",t[t.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",t[t.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",t[t.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",t[t.CONFLICT=409]="CONFLICT",t[t.GONE=410]="GONE",t[t.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",t[t.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",t[t.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",t[t.URI_TOO_LONG=414]="URI_TOO_LONG",t[t.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",t[t.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",t[t.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",t[t.I_AM_A_TEAPOT=418]="I_AM_A_TEAPOT",t[t.MISDIRECTED=421]="MISDIRECTED",t[t.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",t[t.LOCKED=423]="LOCKED",t[t.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",t[t.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",t[t.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",t[t.UNRECOVERABLE_ERROR=456]="UNRECOVERABLE_ERROR",t[t.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",t[t.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",t[t.BAD_GATEWAY=502]="BAD_GATEWAY",t[t.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",t[t.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",t[t.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",t[t.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",t[t.LOOP_DETECTED=508]="LOOP_DETECTED"}(C||(C={}));class P extends g{constructor(t,e="Forbidden",r){super(C.FORBIDDEN,e,t,r)}}class H extends g{constructor(t,e="Internal Server Error",r){super(C.INTERNAL_SERVER_ERROR,e,t,r)}}function w(e,r){const s=t(r);for(const t of s){void 0===e.get(t)&&e.set(t,r)}}const S="@inversifyjs/http-core/controller/controllerMethodHeaderMetadataReflectKey";const U="@inversifyjs/http-core/controller/controllerMethodParameterMetadataReflectKey";const b="@inversifyjs/http-core/controller/controllerMethodStatusCodeMetadataReflectKey";const v="@inversifyjs/http-core/controller/controllerMethodUseNativeHandlerMetadataReflectKey";function F(t,d){const u=(E=t.target,p=d.methodKey,T(E,U,p)??[]);var E,p;const h=function(t,e){return T(t,b,e)}(t.target,d.methodKey),N=[...s(t.target),...o(t.target,d.methodKey)],O=[...a(t.target),...n(t.target,d.methodKey)],R=i(t.target),A=c(R),_=l(t.target,d.methodKey),I=function(t,s){const o=new Map;for(const r of e(t,s))w(o,r);for(const e of r(t))w(o,e);return o}(t.target,d.methodKey),f=c(_),y=function(t,e){const r=T(t,S,e),s=[];return void 0!==r&&s.push(...r.entries()),s}(t.target,d.methodKey),L=function(t,e){return T(t,v,e)??!1}(t.target,d.methodKey);return{errorTypeToErrorFilterMap:I,guardList:N,headerMetadataList:y,interceptorList:O,methodKey:d.methodKey,parameterMetadataList:u,path:d.path,postHandlerMiddlewareList:[...A.postHandlerMiddlewareList,...f.postHandlerMiddlewareList],preHandlerMiddlewareList:[...A.preHandlerMiddlewareList,...f.preHandlerMiddlewareList],requestMethodType:d.requestMethodType,statusCode:h,useNativeHandler:L}}function G(t,e){return e.map(e=>F(t,e))}const x="@inversifyjs/http-core/controller/controllerMethodMetadataReflectKey";function B(t){return T(t,x)??[]}function Y(t){return{controllerMethodMetadataList:G(t,B(t.target)),path:t.path,serviceIdentifier:t.serviceIdentifier,target:t.target}}const K="@inversifyjs/http-core/controller/controllerMetadataReflectKey";function Q(){return T(Reflect,K)}var j;!function(t){t.Body="body",t.Cookies="cookies",t.Custom="custom",t.Headers="headers",t.Next="next",t.Params="params",t.Request="request",t.Response="response",t.Query="query"}(j||(j={}));class V{httpAdapterOptions;globalHandlers;#t;#e;#r;#s;#o;#a;#n;#i;#c;constructor(t,e,r,s){this.#t=new Set(s),this.#e=t,this.httpAdapterOptions=this.#l(e,r),this.#s=[],this.#o=[],this.#r=new Map,this.#a=this.#d(this.httpAdapterOptions),this.#c=!1,this.globalHandlers={interceptorList:[]},this.#n=[],this.#i=[]}applyGlobalMiddleware(...t){if(this.#c)throw new y(L.invalidOperationAfterBuild,"Cannot apply global middleware after the server has been built");const e=c(t);this.#n.push(...e.postHandlerMiddlewareList),this.#i.push(...e.preHandlerMiddlewareList)}useGlobalFilters(...t){for(const e of t)this.#u(e)}applyGlobalGuards(...t){if(this.#c)throw new y(L.invalidOperationAfterBuild,"Cannot apply global guard after the server has been built");this.#s.push(...t)}useGlobalInterceptors(...t){if(this.#c)throw new y(L.invalidOperationAfterBuild,"Cannot apply global interceptor after the server has been built");for(const e of t)this.#E(e)}useGlobalPipe(...t){this.#o.push(...t)}async _buildServer(){await this.#p(),this.#c=!0}async#T(t,e,r,s){t[e]=this.#t.has(s)?await r:r}#d(t){return"boolean"==typeof t.logger?new E:t.logger}#l(t,e){return{...t,...e}}async#p(){const t=function(t){const e=Q();if(void 0===e)throw new y(L.noControllerFound,"No controllers found. Please ensure that your controllers are properly registered in your container and are annotated with the @Controller() decorator.");const r=[];for(const s of e)t.isBound(s.serviceIdentifier)&&r.push(Y(s));return r}(this.#e);for(const e of t)await this._buildRouter({path:e.path,routeParamsList:this.#h(e)}),!1!==this.httpAdapterOptions.logger&&this.#N(e.target.name,e.path,e.controllerMethodMetadataList)}#h(t){return t.controllerMethodMetadataList.map(e=>({guardList:[...this.#O(this.#s,e),...this.#O(e.guardList,e)],handler:this.#R(t.serviceIdentifier,t.target,e),path:e.path,postHandlerMiddlewareList:[...this.#A(e,this.#n),...this.#A(e,e.postHandlerMiddlewareList)],preHandlerMiddlewareList:[...this.#A(e,this.#i),...this.#A(e,e.preHandlerMiddlewareList)],requestMethodType:e.requestMethodType}))}#R(t,e,r){const s=this.#_(e,r.methodKey,r.parameterMetadataList);let o;o=r.useNativeHandler?(t,e,r)=>r:(t,e,s)=>this.#I(t,e,s,r.statusCode);const a=this.#f(r);return function(t,e,r,s,o,a,n){return 0===e.interceptorList.length?async(i,c,l)=>{try{const o=await r.getAsync(t),d=await s(i,c,l);n(i,c,e.headerMetadataList);const u=await(o[e.methodKey]?.(...d));return a(i,c,u)}catch(t){return o(i,c,t)}}:async(i,c,l)=>{const d=[],u={push:t=>{d.push(t)}};let E;const p=o=>o<e.interceptorList.length?async()=>{const t=await r.getAsync(e.interceptorList[o]);return await t.intercept(i,c,p(o+1)),u}:async()=>{const o=await r.getAsync(t),a=await s(i,c,l);return n(i,c,e.headerMetadataList),E=await(o[e.methodKey]?.(...a)),u};try{await p(0)();for(const t of d)E=await t(E);return a(i,c,E)}catch(t){return o(i,c,t)}}}(t,r,this.#e,s,a,o,this.#y.bind(this))}#_(t,e,r){const s=r.map(t=>{if(void 0!==t)switch(t.parameterType){case j.Body:return e=>this._getBody(e,t.parameterName);case j.Cookies:return(e,r)=>this._getCookies(e,r,t.parameterName);case j.Custom:return(e,r)=>t.customParameterDecoratorHandler?.(e,r);case j.Headers:return e=>this._getHeaders(e,t.parameterName);case j.Next:return(t,e,r)=>r;case j.Params:return e=>this._getParams(e,t.parameterName);case j.Query:return e=>this._getQuery(e,t.parameterName);case j.Request:return t=>t;case j.Response:return(t,e)=>e}});return async(o,a,n)=>{const i=new Array(r.length);return await Promise.all(s.map(async(s,c)=>{const l=r[c];await this.#T(i,c,s(o,a,n),l.parameterType),await this.#L(i,[...this.#o,...l.pipeList],{methodName:e,parameterIndex:c,targetClass:t})})),i}}async#L(t,e,r){for(const s of e){const e=d(s)?s:await this.#e.getAsync(s);t[r.parameterIndex]=await e.execute(t[r.parameterIndex],r)}}async#M(t,e){if(t instanceof Error){let r=t.constructor;for(;r!==Error;){const t=e.get(r);if(void 0!==t)return this.#e.getAsync(t);r=p(r)}const s=e.get(r);if(void 0!==s)return this.#e.getAsync(s)}const r=e.get(null);if(void 0!==r)return this.#e.getAsync(r)}#f(t){const e=async(r,s,o)=>{const a=await this.#M(o,t.errorTypeToErrorFilterMap)??await this.#M(o,this.#r);if(void 0===a){let t;return g.is(o)?t=o:(this.#m(o),t=new H(void 0,void 0,{cause:o})),this.#I(r,s,t)}try{return await a.catch(o,r,s)}catch(o){return e(r,s,o)}};return e}#y(t,e,r){for(const[s,o]of r)this._setHeader(t,e,s,o)}#I(t,e,r,s){let o,a=s;return m(r)?(o=r.body,a=r.statusCode):o=r,void 0!==a&&this._setStatus(t,e,a),"string"==typeof o?this._replyText(t,e,o):void 0===o||"object"==typeof o?o instanceof u?this._replyStream(t,e,o):this._replyJson(t,e,o):this._replyText(t,e,JSON.stringify(o))}#A(t,e){const r=this.#f(t);return e.map(t=>async(e,s,o)=>{try{const r=await this.#e.getAsync(t);return await r.execute(e,s,o)}catch(t){return r(e,s,t)}})}#O(t,e){const r=this.#f(e);return t.map(t=>async(e,s,o)=>{try{const r=await this.#e.getAsync(t);return await r.activate(e)?void await o():this.#I(e,s,new P)}catch(t){return r(e,s,t)}})}#N(t,e,r){this.#a.info(`${t} {${e}}:`);for(const t of r)this.#a.info(` - .${t.methodKey}() mapped {${t.path}, ${t.requestMethodType}}`)}#m(t){t instanceof Error&&this.#a.error(t.stack??t.message),this.#a.error("An unexpected error occurred")}#u(t){w(this.#r,t)}#E(t){this.globalHandlers.interceptorList.push(this.#e.get(t))}}function q(t){return"/"+t.split("/").filter(t=>t.length>0).join("/")}function k(t,e,r,s){let o;const a=[];void 0!==r&&("object"!=typeof r||d(r)?a.push(r):o=r.name),e.length>0&&a.push(...e);return function(t){return(e,r,s)=>{if(void 0===r)throw new y(L.requestParamIncorrectUse,"Expected param decorator to be used on a method parameter. Instead, it was found on a constructor parameter");h(e.constructor,U,N,O(t,s),r),t.parameterType!==j.Next&&t.parameterType!==j.Response||R(e.constructor,v,!0,r)}}({customParameterDecoratorHandler:s,parameterName:o,parameterType:t,pipeList:a})}function W(t,...e){return k(j.Custom,e,void 0,t)}function $(t,e){return(r,s)=>{const o={methodKey:s,path:q(e??"/"),requestMethodType:t};h(r.constructor,x,N,A(o))}}var X;!function(t){t.All="all",t.Delete="delete",t.Get="get",t.Head="head",t.Options="options",t.Patch="patch",t.Post="post",t.Put="put"}(X||(X={}));const Z=t=>$(X.All,t);function J(t,...e){return k(j.Body,e,t)}function z(t){return e=>{const r={path:"/",serviceIdentifier:e,target:e};let s;void 0!==t&&("string"==typeof t?r.path=q(t):(r.path=q(t.path??"/"),void 0!==t.serviceIdentifier&&(r.serviceIdentifier=t.serviceIdentifier),s=t.scope)),I(s)(e),h(Reflect,K,N,A(r))}}function tt(t,...e){return k(j.Cookies,e,t)}const et=t=>$(X.Delete,t),rt=t=>$(X.Get,t),st=t=>$(X.Head,t);function ot(t,...e){return k(j.Headers,e,t)}function at(){return k(j.Next,[])}const nt=t=>$(X.Options,t);function it(t,...e){return k(j.Params,e,t)}const ct=t=>$(X.Patch,t),lt=t=>$(X.Post,t),dt=t=>$(X.Put,t);function ut(t,...e){return k(j.Query,e,t)}function Et(...t){return k(j.Request,t)}function pt(...t){return k(j.Response,t)}function Tt(t,e){return(r,s)=>{h(r.constructor,S,_,function(t,e){return r=>{const s=t.toLowerCase(),o=r.get(s);return void 0!==o?r.set(s,`${o}, ${e}`):r.set(s,e),r}}(t,e),s)}}function ht(t){return(e,r)=>{R(e.constructor,b,t,r)}}const Nt=Symbol.for("@inversifyjs/http-core/SuccessHttpResponse");class Ot{statusCode;body;[M];[Nt];constructor(t,e){this.statusCode=t,this.body=e,this[M]=!0,this[Nt]=!0}static is(t){return m(t)&&!0===t[Nt]}}class Rt extends Ot{constructor(t){super(C.ACCEPTED,t)}}class At extends Ot{constructor(t){super(C.ALREADY_REPORTED,t)}}class _t extends g{constructor(t,e="Bad Gateway",r){super(C.BAD_GATEWAY,e,t,r)}}class It extends g{constructor(t,e="Bad Request",r){super(C.BAD_REQUEST,e,t,r)}}class ft extends g{constructor(t,e="Conflict",r){super(C.CONFLICT,e,t,r)}}class yt extends Ot{constructor(t){super(C.CONTENT_DIFFERENT,t)}}class Lt extends Ot{constructor(t){super(C.CREATED,t)}}class Mt extends g{constructor(t,e="Gateway Timeout",r){super(C.GATEWAY_TIMEOUT,e,t,r)}}class mt extends g{constructor(t,e="Gone",r){super(C.GONE,e,t,r)}}class Dt extends g{constructor(t,e="HTTP Version Not Supported",r){super(C.HTTP_VERSION_NOT_SUPPORTED,e,t,r)}}class gt extends g{constructor(t,e="Insufficient Storage",r){super(C.INSUFFICIENT_STORAGE,e,t,r)}}class Ct extends g{constructor(t,e="Loop Detected",r){super(C.LOOP_DETECTED,e,t,r)}}class Pt extends g{constructor(t,e="Method Not Allowed",r){super(C.METHOD_NOT_ALLOWED,e,t,r)}}class Ht extends Ot{constructor(t){super(C.MULTI_STATUS,t)}}class wt extends Ot{constructor(){super(C.NO_CONTENT)}}class St extends Ot{constructor(t){super(C.NON_AUTHORITATIVE_INFORMATION,t)}}class Ut extends g{constructor(t,e="Not Acceptable",r){super(C.NOT_ACCEPTABLE,e,t,r)}}class bt extends g{constructor(t,e="Not Found",r){super(C.NOT_FOUND,e,t,r)}}class vt extends g{constructor(t,e="Not Implemented",r){super(C.NOT_IMPLEMENTED,e,t,r)}}class Ft extends Ot{constructor(t){super(C.OK,t)}}class Gt extends Ot{constructor(t){super(C.PARTIAL_CONTENT,t)}}class xt extends g{constructor(t,e="Payment Required",r){super(C.PAYMENT_REQUIRED,e,t,r)}}class Bt extends Ot{constructor(t){super(C.RESET_CONTENT,t)}}class Yt extends g{constructor(t,e="Service Unavailable",r){super(C.SERVICE_UNAVAILABLE,e,t,r)}}class Kt extends g{constructor(t,e="Unauthorized",r){super(C.UNAUTHORIZED,e,t,r)}}class Qt extends g{constructor(t,e="Unprocessable Entity",r){super(C.UNPROCESSABLE_ENTITY,e,t,r)}}export{Rt as AcceptedHttpResponse,Z as All,At as AlreadyReportedHttpResponse,_t as BadGatewayHttpResponse,It as BadRequestHttpResponse,J as Body,ft as ConflictHttpResponse,yt as ContentDifferentHttpResponse,z as Controller,tt as Cookies,Lt as CreatedHttpResponse,et as Delete,g as ErrorHttpResponse,P as ForbiddenHttpResponse,Mt as GatewayTimeoutHttpResponse,rt as Get,mt as GoneHttpResponse,st as Head,ot as Headers,C as HttpStatusCode,Dt as HttpVersionNotSupportedHttpResponse,gt as InsufficientStorageHttpResponse,H as InternalServerErrorHttpResponse,V as InversifyHttpAdapter,Ct as LoopDetectedHttpResponse,Pt as MethodNotAllowedHttpResponse,Ht as MultiStatusHttpResponse,at as Next,wt as NoContentHttpResponse,St as NonAuthoritativeInformationHttpResponse,Ut as NotAcceptableHttpResponse,bt as NotFoundHttpResponse,vt as NotImplementedHttpResponse,Ft as OkHttpResponse,nt as Options,it as Params,Gt as PartialContentHttpResponse,ct as Patch,xt as PaymentRequiredHttpResponse,lt as Post,dt as Put,ut as Query,Et as Request,j as RequestMethodParameterType,X as RequestMethodType,Bt as ResetContentHttpResponse,pt as Response,Yt as ServiceUnavailableHttpResponse,Tt as SetHeader,ht as StatusCode,Kt as UnauthorizedHttpResponse,Qt as UnprocessableEntityHttpResponse,q as buildNormalizedPath,W as createCustomParameterDecorator,Q as getControllerMetadataList,B as getControllerMethodMetadataList,m as isHttpResponse};
|
|
1
|
+
import{getCatchErrorMetadata as t,getClassMethodErrorFilterMetadata as e,getClassErrorFilterMetadata as r,getClassGuardList as s,getClassMethodGuardList as o,getClassInterceptorList as a,getClassMethodInterceptorList as n,getClassMiddlewareList as i,buildMiddlewareOptionsFromApplyMiddlewareOptions as c,getClassMethodMiddlewareList as l,isPipe as d}from"@inversifyjs/framework-core";export{ApplyMiddleware,CatchError,MiddlewarePhase,UseErrorFilter,UseGuard,UseInterceptor}from"@inversifyjs/framework-core";import{Readable as u}from"node:stream";import{ConsoleLogger as E}from"@inversifyjs/logger";import{getBaseType as p,findInPrototypeChain as T}from"@inversifyjs/prototype-utils";import{getOwnReflectMetadata as h,updateOwnReflectMetadata as N,buildEmptyArrayMetadata as O,buildArrayMetadataWithIndex as R,setReflectMetadata as f,buildArrayMetadataWithElement as A,buildEmptyMapMetadata as _}from"@inversifyjs/reflect-metadata-utils";import{injectable as I}from"inversify";const y=Symbol.for("@inversifyjs/http-core/InversifyHttpAdapterError");class M extends Error{kind;extraData;[y];constructor(t,e,r,s){super(e,r),this.kind=t,this.extraData=s,this[y]=!0}static is(t){return"object"==typeof t&&null!==t&&!0===t[y]}static isErrorOfKind(t,e){return M.is(t)&&t.kind===e}}var L;!function(t){t[t.invalidOperationAfterBuild=0]="invalidOperationAfterBuild",t[t.noControllerFound=1]="noControllerFound",t[t.requestParamIncorrectUse=2]="requestParamIncorrectUse"}(L||(L={}));const m=Symbol.for("@inversifyjs/http-core/HttpResponse");function D(t){return"object"==typeof t&&null!==t&&!0===t[m]}class g extends Error{statusCode;[m];body;constructor(t,e,r,s){super(r,s),this.statusCode=t,this.body=e,this[m]=!0}}var C;!function(t){t[t.CONTINUE=100]="CONTINUE",t[t.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",t[t.PROCESSING=102]="PROCESSING",t[t.EARLYHINTS=103]="EARLYHINTS",t[t.OK=200]="OK",t[t.CREATED=201]="CREATED",t[t.ACCEPTED=202]="ACCEPTED",t[t.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",t[t.NO_CONTENT=204]="NO_CONTENT",t[t.RESET_CONTENT=205]="RESET_CONTENT",t[t.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",t[t.MULTI_STATUS=207]="MULTI_STATUS",t[t.ALREADY_REPORTED=208]="ALREADY_REPORTED",t[t.CONTENT_DIFFERENT=210]="CONTENT_DIFFERENT",t[t.AMBIGUOUS=300]="AMBIGUOUS",t[t.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",t[t.FOUND=302]="FOUND",t[t.SEE_OTHER=303]="SEE_OTHER",t[t.NOT_MODIFIED=304]="NOT_MODIFIED",t[t.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",t[t.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",t[t.BAD_REQUEST=400]="BAD_REQUEST",t[t.UNAUTHORIZED=401]="UNAUTHORIZED",t[t.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",t[t.FORBIDDEN=403]="FORBIDDEN",t[t.NOT_FOUND=404]="NOT_FOUND",t[t.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",t[t.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",t[t.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",t[t.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",t[t.CONFLICT=409]="CONFLICT",t[t.GONE=410]="GONE",t[t.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",t[t.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",t[t.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",t[t.URI_TOO_LONG=414]="URI_TOO_LONG",t[t.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",t[t.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",t[t.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",t[t.I_AM_A_TEAPOT=418]="I_AM_A_TEAPOT",t[t.MISDIRECTED=421]="MISDIRECTED",t[t.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",t[t.LOCKED=423]="LOCKED",t[t.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",t[t.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",t[t.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",t[t.UNRECOVERABLE_ERROR=456]="UNRECOVERABLE_ERROR",t[t.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",t[t.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",t[t.BAD_GATEWAY=502]="BAD_GATEWAY",t[t.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",t[t.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",t[t.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",t[t.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",t[t.LOOP_DETECTED=508]="LOOP_DETECTED"}(C||(C={}));class P extends g{constructor(t,e="Forbidden",r){super(C.FORBIDDEN,t,e,r)}}class w extends g{constructor(t,e="Internal Server Error",r){super(C.INTERNAL_SERVER_ERROR,t,e,r)}}function H(e,r,s){const o=t(s);for(const t of o){if(void 0===r.get(t))r.set(t,s);else{const r=null===t?"null (catch-all)":t.name;e.warn(`Error filter '${s.name}' was not registered for error type '${r}' because an error filter is already registered for this error type.`)}}}const U="@inversifyjs/http-core/controller/controllerMethodHeaderMetadataReflectKey";const S="@inversifyjs/http-core/controller/controllerMethodParameterMetadataReflectKey";const b="@inversifyjs/http-core/controller/controllerMethodStatusCodeMetadataReflectKey";const v="@inversifyjs/http-core/controller/controllerMethodUseNativeHandlerMetadataReflectKey";function F(t,d,u){const E=(N=d.target,O=u.methodKey,T(N,t=>h(t,S,O))??[]);var N,O;const R=function(t,e){return T(t,t=>h(t,b,e))}(d.target,u.methodKey),f=[...s(d.target),...o(d.target,u.methodKey)],A=[...a(d.target),...n(d.target,u.methodKey)],_=i(d.target),I=c(_),y=l(d.target,u.methodKey),M=function(t,s,o){const a=new Map;for(const r of e(s,o))H(t,a,r);for(const e of r(s))H(t,a,e);return a}(t,d.target,u.methodKey),L=c(y),m=function(t,e){const r=new Map;let s=t;for(;void 0!==s;){const t=h(s,U,e);if(void 0!==t)for(const[e,s]of t.entries())r.has(e)||r.set(e,s);s=p(s)}return[...r.entries()]}(d.target,u.methodKey),D=function(t,e){return T(t,t=>h(t,v,e))??!1}(d.target,u.methodKey);return{errorTypeToErrorFilterMap:M,guardList:f,headerMetadataList:m,interceptorList:A,methodKey:u.methodKey,parameterMetadataList:E,path:u.path,postHandlerMiddlewareList:[...I.postHandlerMiddlewareList,...L.postHandlerMiddlewareList],preHandlerMiddlewareList:[...I.preHandlerMiddlewareList,...L.preHandlerMiddlewareList],requestMethodType:u.requestMethodType,statusCode:R,useNativeHandler:D}}function G(t,e,r){return r.map(r=>F(t,e,r))}const x="@inversifyjs/http-core/controller/controllerMethodMetadataReflectKey";function B(t){const e=new Map;let r=t;for(;void 0!==r;){const t=h(r,x);if(void 0!==t)for(const r of t){const t=`${r.requestMethodType}:${r.path}`;e.has(t)||e.set(t,r)}r=p(r)}return[...e.values()]}function Y(t,e){return{controllerMethodMetadataList:G(t,e,B(e.target)),path:e.path,serviceIdentifier:e.serviceIdentifier,target:e.target}}const K="@inversifyjs/http-core/controller/controllerMetadataReflectKey";function Q(){return h(Reflect,K)}async function q(t,e,r){for(const s of function*(t){if(t instanceof Error){let e=t.constructor;for(;e!==Error;)yield e,e=p(e);yield e}yield null}(e))for(const e of r){const r=e.get(s);if(void 0!==r)return"function"==typeof r?t.getAsync(r):r}}var V;!function(t){t.Body="body",t.Cookies="cookies",t.Custom="custom",t.Headers="headers",t.Next="next",t.Params="params",t.Request="request",t.Response="response",t.Query="query"}(V||(V={}));class j{httpAdapterOptions;globalHandlers;#t;#e;#r;#s;#o;#a;#n;#i;#c;constructor(t,e,r,s){this.#t=new Set(s),this.#e=t,this.httpAdapterOptions=this.#l(e,r),this.#s=[],this.#o=[],this.#r=new Map,this.#a=this.#d(this.httpAdapterOptions),this.#c=!1,this.globalHandlers={interceptorList:[]},this.#n=[],this.#i=[],this.#u()}applyGlobalMiddleware(...t){if(this.#c)throw new M(L.invalidOperationAfterBuild,"Cannot apply global middleware after the server has been built");const e=c(t);this.#n.push(...e.postHandlerMiddlewareList),this.#i.push(...e.preHandlerMiddlewareList)}useGlobalFilters(...t){for(const e of t)this.#E(e)}applyGlobalGuards(...t){if(this.#c)throw new M(L.invalidOperationAfterBuild,"Cannot apply global guard after the server has been built");this.#s.push(...t)}useGlobalInterceptors(...t){if(this.#c)throw new M(L.invalidOperationAfterBuild,"Cannot apply global interceptor after the server has been built");for(const e of t)this.#p(e)}useGlobalPipe(...t){this.#o.push(...t)}async _buildServer(){await this.#T(),this.#c=!0}async#h(t,e,r,s){t[e]=this.#t.has(s)?await r:r}#d(t){return"boolean"==typeof t.logger?new E:t.logger}#l(t,e){return{...t,...e}}async#T(){const t=function(t,e){const r=Q();if(void 0===r)throw new M(L.noControllerFound,"No controllers found. Please ensure that your controllers are properly registered in your container and are annotated with the @Controller() decorator.");const s=[];for(const o of r)t.isBound(o.serviceIdentifier)&&s.push(Y(e,o));return s}(this.#e,this.#a);for(const e of t)await this._buildRouter({path:e.path,routeParamsList:this.#N(e)}),!1!==this.httpAdapterOptions.logger&&this.#O(e.target.name,e.path,e.controllerMethodMetadataList)}#N(t){return t.controllerMethodMetadataList.map(e=>({guardList:[...this.#R(this.#s,e),...this.#R(e.guardList,e)],handler:this.#f(t.serviceIdentifier,t.target,e),path:e.path,postHandlerMiddlewareList:[...this.#A(e,this.#n),...this.#A(e,e.postHandlerMiddlewareList)],preHandlerMiddlewareList:[...this.#A(e,this.#i),...this.#A(e,e.preHandlerMiddlewareList)],requestMethodType:e.requestMethodType}))}#f(t,e,r){const s=this.#_(e,r.methodKey,r.parameterMetadataList);let o;o=r.useNativeHandler?(t,e,r)=>r:(t,e,s)=>this.#I(t,e,s,r.statusCode);const a=this.#y(r);return function(t,e,r,s,o,a,n){return 0===e.interceptorList.length?async(i,c,l)=>{try{const o=await r.getAsync(t),d=await s(i,c,l);n(i,c,e.headerMetadataList);const u=await(o[e.methodKey]?.(...d));return a(i,c,u)}catch(t){return o(i,c,t)}}:async(i,c,l)=>{const d=[],u={push:t=>{d.push(t)}};let E;const p=o=>o<e.interceptorList.length?async()=>{const t=await r.getAsync(e.interceptorList[o]);return await t.intercept(i,c,p(o+1)),u}:async()=>{const o=await r.getAsync(t),a=await s(i,c,l);return n(i,c,e.headerMetadataList),E=await(o[e.methodKey]?.(...a)),u};try{await p(0)();for(const t of d)E=await t(E);return a(i,c,E)}catch(t){return o(i,c,t)}}}(t,r,this.#e,s,a,o,this.#M.bind(this))}#_(t,e,r){const s=r.map(t=>{if(void 0!==t)switch(t.parameterType){case V.Body:return e=>this._getBody(e,t.parameterName);case V.Cookies:return(e,r)=>this._getCookies(e,r,t.parameterName);case V.Custom:return(e,r)=>t.customParameterDecoratorHandler?.(e,r);case V.Headers:return e=>this._getHeaders(e,t.parameterName);case V.Next:return(t,e,r)=>r;case V.Params:return e=>this._getParams(e,t.parameterName);case V.Query:return e=>this._getQuery(e,t.parameterName);case V.Request:return t=>t;case V.Response:return(t,e)=>e}});return async(o,a,n)=>{const i=new Array(r.length);return await Promise.all(s.map(async(s,c)=>{const l=r[c];await this.#h(i,c,s(o,a,n),l.parameterType),await this.#L(i,[...this.#o,...l.pipeList],{methodName:e,parameterIndex:c,targetClass:t})})),i}}async#L(t,e,r){for(const s of e){const e=d(s)?s:await this.#e.getAsync(s);t[r.parameterIndex]=await e.execute(t[r.parameterIndex],r)}}async#m(t,e){return q(this.#e,t,e)}#y(t){const e=async(r,s,o)=>{const a=await this.#m(o,[t.errorTypeToErrorFilterMap,this.#r]);if(void 0===a){let t;return this.#D(o),t=new w(void 0,void 0,{cause:o}),this.#I(r,s,t)}try{return await a.catch(o,r,s)}catch(o){return e(r,s,o)}};return e}#M(t,e,r){for(const[s,o]of r)this._setHeader(t,e,s,o)}#I(t,e,r,s){let o,a=s;return D(r)?(o=r.body,a=r.statusCode):o=r,void 0!==a&&this._setStatus(t,e,a),"string"==typeof o?this._replyText(t,e,o):void 0===o||"object"==typeof o?o instanceof u?this._replyStream(t,e,o):this._replyJson(t,e,o):this._replyText(t,e,JSON.stringify(o))}#A(t,e){const r=this.#y(t);return e.map(t=>async(e,s,o)=>{try{const r=await this.#e.getAsync(t);return await r.execute(e,s,o)}catch(t){return r(e,s,t)}})}#R(t,e){const r=this.#y(e);return t.map(t=>async(e,s,o)=>{try{const r=await this.#e.getAsync(t);return await r.activate(e)?void await o():this.#I(e,s,new P)}catch(t){return r(e,s,t)}})}#O(t,e,r){this.#a.info(`${t} {${e}}:`);for(const t of r)this.#a.info(` - .${t.methodKey}() mapped {${t.path}, ${t.requestMethodType}}`)}#D(t){t instanceof Error&&this.#a.error(t.stack??t.message),this.#a.error("An unexpected error occurred")}#E(t){H(this.#a,this.#r,t)}#u(){var t;this.#r.set(g,(t=this.#I.bind(this),{catch:(e,r,s)=>t(r,s,e)}))}#p(t){this.globalHandlers.interceptorList.push(this.#e.get(t))}}function k(t){return"/"+t.split("/").filter(t=>t.length>0).join("/")}function W(t,e,r,s){let o;const a=[];void 0!==r&&("object"!=typeof r||d(r)?a.push(r):o=r.name),e.length>0&&a.push(...e);return function(t){return(e,r,s)=>{if(void 0===r)throw new M(L.requestParamIncorrectUse,"Expected param decorator to be used on a method parameter. Instead, it was found on a constructor parameter");N(e.constructor,S,O,R(t,s),r),t.parameterType!==V.Next&&t.parameterType!==V.Response||f(e.constructor,v,!0,r)}}({customParameterDecoratorHandler:s,parameterName:o,parameterType:t,pipeList:a})}function $(t,...e){return W(V.Custom,e,void 0,t)}function X(t,e){return(r,s)=>{const o={methodKey:s,path:k(e??"/"),requestMethodType:t};N(r.constructor,x,O,A(o))}}var Z;!function(t){t.All="all",t.Delete="delete",t.Get="get",t.Head="head",t.Options="options",t.Patch="patch",t.Post="post",t.Put="put"}(Z||(Z={}));const J=t=>X(Z.All,t);function z(t,...e){return W(V.Body,e,t)}function tt(t){return e=>{const r={path:"/",serviceIdentifier:e,target:e};let s;void 0!==t&&("string"==typeof t?r.path=k(t):(r.path=k(t.path??"/"),void 0!==t.serviceIdentifier&&(r.serviceIdentifier=t.serviceIdentifier),s=t.scope)),I(s)(e),N(Reflect,K,O,A(r))}}function et(t,...e){return W(V.Cookies,e,t)}const rt=t=>X(Z.Delete,t),st=t=>X(Z.Get,t),ot=t=>X(Z.Head,t);function at(t,...e){return W(V.Headers,e,t)}function nt(){return W(V.Next,[])}const it=t=>X(Z.Options,t);function ct(t,...e){return W(V.Params,e,t)}const lt=t=>X(Z.Patch,t),dt=t=>X(Z.Post,t),ut=t=>X(Z.Put,t);function Et(t,...e){return W(V.Query,e,t)}function pt(...t){return W(V.Request,t)}function Tt(...t){return W(V.Response,t)}function ht(t,e){return(r,s)=>{N(r.constructor,U,_,function(t,e){return r=>{const s=t.toLowerCase(),o=r.get(s);return void 0!==o?r.set(s,`${o}, ${e}`):r.set(s,e),r}}(t,e),s)}}function Nt(t){return(e,r)=>{f(e.constructor,b,t,r)}}class Ot{statusCode;body;[m];constructor(t,e){this.statusCode=t,this.body=e,this[m]=!0}}class Rt extends Ot{constructor(t){super(C.ACCEPTED,t)}}class ft extends Ot{constructor(t){super(C.ALREADY_REPORTED,t)}}class At extends g{constructor(t,e="Bad Gateway",r){super(C.BAD_GATEWAY,t,e,r)}}class _t extends g{constructor(t,e="Bad Request",r){super(C.BAD_REQUEST,t,e,r)}}class It extends g{constructor(t,e="Conflict",r){super(C.CONFLICT,t,e,r)}}class yt extends Ot{constructor(t){super(C.CONTENT_DIFFERENT,t)}}class Mt extends Ot{constructor(t){super(C.CREATED,t)}}class Lt extends g{constructor(t,e="Gateway Timeout",r){super(C.GATEWAY_TIMEOUT,t,e,r)}}class mt extends g{constructor(t,e="Gone",r){super(C.GONE,t,e,r)}}class Dt extends g{constructor(t,e="HTTP Version Not Supported",r){super(C.HTTP_VERSION_NOT_SUPPORTED,t,e,r)}}class gt extends g{constructor(t,e="Insufficient Storage",r){super(C.INSUFFICIENT_STORAGE,t,e,r)}}class Ct extends g{constructor(t,e="Loop Detected",r){super(C.LOOP_DETECTED,t,e,r)}}class Pt extends g{constructor(t,e="Method Not Allowed",r){super(C.METHOD_NOT_ALLOWED,t,e,r)}}class wt extends Ot{constructor(t){super(C.MULTI_STATUS,t)}}class Ht extends Ot{constructor(){super(C.NO_CONTENT)}}class Ut extends Ot{constructor(t){super(C.NON_AUTHORITATIVE_INFORMATION,t)}}class St extends g{constructor(t,e="Not Acceptable",r){super(C.NOT_ACCEPTABLE,t,e,r)}}class bt extends g{constructor(t,e="Not Found",r){super(C.NOT_FOUND,t,e,r)}}class vt extends g{constructor(t,e="Not Implemented",r){super(C.NOT_IMPLEMENTED,t,e,r)}}class Ft extends Ot{constructor(t){super(C.OK,t)}}class Gt extends Ot{constructor(t){super(C.PARTIAL_CONTENT,t)}}class xt extends g{constructor(t,e="Payment Required",r){super(C.PAYMENT_REQUIRED,t,e,r)}}class Bt extends Ot{constructor(t){super(C.RESET_CONTENT,t)}}class Yt extends g{constructor(t,e="Service Unavailable",r){super(C.SERVICE_UNAVAILABLE,t,e,r)}}class Kt extends g{constructor(t,e="Unauthorized",r){super(C.UNAUTHORIZED,t,e,r)}}class Qt extends g{constructor(t,e="Unprocessable Entity",r){super(C.UNPROCESSABLE_ENTITY,t,e,r)}}export{Rt as AcceptedHttpResponse,J as All,ft as AlreadyReportedHttpResponse,At as BadGatewayHttpResponse,_t as BadRequestHttpResponse,z as Body,It as ConflictHttpResponse,yt as ContentDifferentHttpResponse,tt as Controller,et as Cookies,Mt as CreatedHttpResponse,rt as Delete,g as ErrorHttpResponse,P as ForbiddenHttpResponse,Lt as GatewayTimeoutHttpResponse,st as Get,mt as GoneHttpResponse,ot as Head,at as Headers,C as HttpStatusCode,Dt as HttpVersionNotSupportedHttpResponse,gt as InsufficientStorageHttpResponse,w as InternalServerErrorHttpResponse,j as InversifyHttpAdapter,Ct as LoopDetectedHttpResponse,Pt as MethodNotAllowedHttpResponse,wt as MultiStatusHttpResponse,nt as Next,Ht as NoContentHttpResponse,Ut as NonAuthoritativeInformationHttpResponse,St as NotAcceptableHttpResponse,bt as NotFoundHttpResponse,vt as NotImplementedHttpResponse,Ft as OkHttpResponse,it as Options,ct as Params,Gt as PartialContentHttpResponse,lt as Patch,xt as PaymentRequiredHttpResponse,dt as Post,ut as Put,Et as Query,pt as Request,V as RequestMethodParameterType,Z as RequestMethodType,Bt as ResetContentHttpResponse,Tt as Response,Yt as ServiceUnavailableHttpResponse,ht as SetHeader,Nt as StatusCode,Kt as UnauthorizedHttpResponse,Qt as UnprocessableEntityHttpResponse,k as buildNormalizedPath,$ as createCustomParameterDecorator,Q as getControllerMetadataList,B as getControllerMethodMetadataList,D as isHttpResponse};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|