@inversifyjs/http-core 3.3.0 → 4.1.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 +42 -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 +4 -2
- package/lib/cjs/http/adapter/InversifyHttpAdapter.d.ts.map +1 -1
- package/lib/cjs/http/adapter/InversifyHttpAdapter.js +30 -46
- 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/buildInterceptedHandler.d.ts +1 -1
- package/lib/cjs/http/calculations/buildInterceptedHandler.d.ts.map +1 -1
- package/lib/cjs/http/calculations/buildInterceptedHandler.js +2 -2
- package/lib/cjs/http/calculations/buildInterceptedHandler.js.map +1 -1
- 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/model/RouterExplorerControllerMethodMetadata.d.ts +1 -1
- package/lib/cjs/routerExplorer/model/RouterExplorerControllerMethodMetadata.d.ts.map +1 -1
- package/lib/esm/index.d.ts +24 -29
- package/lib/esm/index.js +1 -1
- package/lib/esm/index.js.map +1 -1
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuccessHttpResponse.js","sourceRoot":"","sources":["../../../../src/httpResponse/models/SuccessHttpResponse.ts"],"names":[],"mappings":";;;AAGA,
|
|
1
|
+
{"version":3,"file":"SuccessHttpResponse.js","sourceRoot":"","sources":["../../../../src/httpResponse/models/SuccessHttpResponse.ts"],"names":[],"mappings":";;;AAGA,yDAGgC;AAEhC,MAAa,mBAAmB;IAIZ;IACA;IAJX,CAAC,6BAAoB,CAAC,CAAO;IAEpC,YACkB,UAA0B,EAC1B,IAAkD;QADlD,eAAU,GAAV,UAAU,CAAgB;QAC1B,SAAI,GAAJ,IAAI,CAA8C;QAElE,IAAI,CAAC,6BAAoB,CAAC,GAAG,IAAI,CAAC;IACpC,CAAC;CACF;AATD,kDASC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { Stream } from 'node:stream';
|
|
1
2
|
import { ErrorHttpResponse } from './ErrorHttpResponse';
|
|
2
3
|
export declare class UnauthorizedHttpResponse extends ErrorHttpResponse {
|
|
3
|
-
constructor(
|
|
4
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
4
5
|
}
|
|
5
6
|
//# sourceMappingURL=UnauthorizedHttpResponse.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnauthorizedHttpResponse.d.ts","sourceRoot":"","sources":["../../../../src/httpResponse/models/UnauthorizedHttpResponse.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UnauthorizedHttpResponse.d.ts","sourceRoot":"","sources":["../../../../src/httpResponse/models/UnauthorizedHttpResponse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,qBAAa,wBAAyB,SAAQ,iBAAiB;gBAE3D,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,EAC9D,YAAY,GAAE,MAAuB,EACrC,YAAY,CAAC,EAAE,YAAY;CAI9B"}
|
|
@@ -4,8 +4,8 @@ exports.UnauthorizedHttpResponse = void 0;
|
|
|
4
4
|
const HttpStatusCode_1 = require("../../http/models/HttpStatusCode");
|
|
5
5
|
const ErrorHttpResponse_1 = require("./ErrorHttpResponse");
|
|
6
6
|
class UnauthorizedHttpResponse extends ErrorHttpResponse_1.ErrorHttpResponse {
|
|
7
|
-
constructor(
|
|
8
|
-
super(HttpStatusCode_1.HttpStatusCode.UNAUTHORIZED,
|
|
7
|
+
constructor(body, errorMessage = 'Unauthorized', errorOptions) {
|
|
8
|
+
super(HttpStatusCode_1.HttpStatusCode.UNAUTHORIZED, body, errorMessage, errorOptions);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
exports.UnauthorizedHttpResponse = UnauthorizedHttpResponse;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnauthorizedHttpResponse.js","sourceRoot":"","sources":["../../../../src/httpResponse/models/UnauthorizedHttpResponse.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"UnauthorizedHttpResponse.js","sourceRoot":"","sources":["../../../../src/httpResponse/models/UnauthorizedHttpResponse.ts"],"names":[],"mappings":";;;AAEA,qEAAkE;AAClE,2DAAwD;AAExD,MAAa,wBAAyB,SAAQ,qCAAiB;IAC7D,YACE,IAA8D,EAC9D,eAAuB,cAAc,EACrC,YAA2B;QAE3B,KAAK,CAAC,+BAAc,CAAC,YAAY,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;IACvE,CAAC;CACF;AARD,4DAQC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { Stream } from 'node:stream';
|
|
1
2
|
import { ErrorHttpResponse } from './ErrorHttpResponse';
|
|
2
3
|
export declare class UnprocessableEntityHttpResponse extends ErrorHttpResponse {
|
|
3
|
-
constructor(
|
|
4
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
4
5
|
}
|
|
5
6
|
//# sourceMappingURL=UnprocessableEntityHttpResponse.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnprocessableEntityHttpResponse.d.ts","sourceRoot":"","sources":["../../../../src/httpResponse/models/UnprocessableEntityHttpResponse.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UnprocessableEntityHttpResponse.d.ts","sourceRoot":"","sources":["../../../../src/httpResponse/models/UnprocessableEntityHttpResponse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,qBAAa,+BAAgC,SAAQ,iBAAiB;gBAElE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,EAC9D,YAAY,GAAE,MAA+B,EAC7C,YAAY,CAAC,EAAE,YAAY;CAS9B"}
|
|
@@ -4,8 +4,8 @@ exports.UnprocessableEntityHttpResponse = void 0;
|
|
|
4
4
|
const HttpStatusCode_1 = require("../../http/models/HttpStatusCode");
|
|
5
5
|
const ErrorHttpResponse_1 = require("./ErrorHttpResponse");
|
|
6
6
|
class UnprocessableEntityHttpResponse extends ErrorHttpResponse_1.ErrorHttpResponse {
|
|
7
|
-
constructor(
|
|
8
|
-
super(HttpStatusCode_1.HttpStatusCode.UNPROCESSABLE_ENTITY,
|
|
7
|
+
constructor(body, errorMessage = 'Unprocessable Entity', errorOptions) {
|
|
8
|
+
super(HttpStatusCode_1.HttpStatusCode.UNPROCESSABLE_ENTITY, body, errorMessage, errorOptions);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
exports.UnprocessableEntityHttpResponse = UnprocessableEntityHttpResponse;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnprocessableEntityHttpResponse.js","sourceRoot":"","sources":["../../../../src/httpResponse/models/UnprocessableEntityHttpResponse.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"UnprocessableEntityHttpResponse.js","sourceRoot":"","sources":["../../../../src/httpResponse/models/UnprocessableEntityHttpResponse.ts"],"names":[],"mappings":";;;AAEA,qEAAkE;AAClE,2DAAwD;AAExD,MAAa,+BAAgC,SAAQ,qCAAiB;IACpE,YACE,IAA8D,EAC9D,eAAuB,sBAAsB,EAC7C,YAA2B;QAE3B,KAAK,CACH,+BAAc,CAAC,oBAAoB,EACnC,IAAI,EACJ,YAAY,EACZ,YAAY,CACb,CAAC;IACJ,CAAC;CACF;AAbD,0EAaC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ErrorFilter } from '@inversifyjs/framework-core';
|
|
2
|
+
import { Logger } from '@inversifyjs/logger';
|
|
2
3
|
import { Newable } from 'inversify';
|
|
3
|
-
export declare function buildErrorTypeToErrorFilterMap(target: NewableFunction, methodKey: string | symbol): Map<Newable<Error> | null, Newable<ErrorFilter>>;
|
|
4
|
+
export declare function buildErrorTypeToErrorFilterMap(logger: Logger, target: NewableFunction, methodKey: string | symbol): Map<Newable<Error> | null, Newable<ErrorFilter>>;
|
|
4
5
|
//# sourceMappingURL=buildErrorTypeToErrorFilterMap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildErrorTypeToErrorFilterMap.d.ts","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/buildErrorTypeToErrorFilterMap.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EAGZ,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,eAAe,EACvB,SAAS,EAAE,MAAM,GAAG,MAAM,GACzB,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"buildErrorTypeToErrorFilterMap.d.ts","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/buildErrorTypeToErrorFilterMap.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EAGZ,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,eAAe,EACvB,SAAS,EAAE,MAAM,GAAG,MAAM,GACzB,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC,CA0BlD"}
|
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.buildErrorTypeToErrorFilterMap = buildErrorTypeToErrorFilterMap;
|
|
4
4
|
const framework_core_1 = require("@inversifyjs/framework-core");
|
|
5
5
|
const setErrorFilterToErrorFilterMap_1 = require("../../http/actions/setErrorFilterToErrorFilterMap");
|
|
6
|
-
function buildErrorTypeToErrorFilterMap(target, methodKey) {
|
|
6
|
+
function buildErrorTypeToErrorFilterMap(logger, target, methodKey) {
|
|
7
7
|
const errorTypeToErrorFilterMap = new Map();
|
|
8
8
|
for (const errorFilter of (0, framework_core_1.getClassMethodErrorFilterMetadata)(target, methodKey)) {
|
|
9
|
-
(0, setErrorFilterToErrorFilterMap_1.setErrorFilterToErrorFilterMap)(errorTypeToErrorFilterMap, errorFilter);
|
|
9
|
+
(0, setErrorFilterToErrorFilterMap_1.setErrorFilterToErrorFilterMap)(logger, errorTypeToErrorFilterMap, errorFilter);
|
|
10
10
|
}
|
|
11
11
|
for (const errorFilter of (0, framework_core_1.getClassErrorFilterMetadata)(target)) {
|
|
12
|
-
(0, setErrorFilterToErrorFilterMap_1.setErrorFilterToErrorFilterMap)(errorTypeToErrorFilterMap, errorFilter);
|
|
12
|
+
(0, setErrorFilterToErrorFilterMap_1.setErrorFilterToErrorFilterMap)(logger, errorTypeToErrorFilterMap, errorFilter);
|
|
13
13
|
}
|
|
14
14
|
return errorTypeToErrorFilterMap;
|
|
15
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildErrorTypeToErrorFilterMap.js","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/buildErrorTypeToErrorFilterMap.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"buildErrorTypeToErrorFilterMap.js","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/buildErrorTypeToErrorFilterMap.ts"],"names":[],"mappings":";;AAUA,wEA8BC;AAxCD,gEAIqC;AAIrC,sGAAmG;AAEnG,SAAgB,8BAA8B,CAC5C,MAAc,EACd,MAAuB,EACvB,SAA0B;IAE1B,MAAM,yBAAyB,GAG3B,IAAI,GAAG,EAAE,CAAC;IAEd,KAAK,MAAM,WAAW,IAAI,IAAA,kDAAiC,EACzD,MAAM,EACN,SAAS,CACV,EAAE,CAAC;QACF,IAAA,+DAA8B,EAC5B,MAAM,EACN,yBAAyB,EACzB,WAAW,CACZ,CAAC;IACJ,CAAC;IAED,KAAK,MAAM,WAAW,IAAI,IAAA,4CAA2B,EAAC,MAAM,CAAC,EAAE,CAAC;QAC9D,IAAA,+DAA8B,EAC5B,MAAM,EACN,yBAAyB,EACzB,WAAW,CACZ,CAAC;IACJ,CAAC;IAED,OAAO,yBAAyB,CAAC;AACnC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import { Logger } from '@inversifyjs/logger';
|
|
1
2
|
import { ControllerMetadata } from '../model/ControllerMetadata';
|
|
2
3
|
import { RouterExplorerControllerMetadata } from '../model/RouterExplorerControllerMetadata';
|
|
3
|
-
export declare function buildRouterExplorerControllerMetadata<TRequest, TResponse, TResult>(controllerMetadata: ControllerMetadata): RouterExplorerControllerMetadata<TRequest, TResponse, TResult>;
|
|
4
|
+
export declare function buildRouterExplorerControllerMetadata<TRequest, TResponse, TResult>(logger: Logger, controllerMetadata: ControllerMetadata): RouterExplorerControllerMetadata<TRequest, TResponse, TResult>;
|
|
4
5
|
//# sourceMappingURL=buildRouterExplorerControllerMetadata.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildRouterExplorerControllerMetadata.d.ts","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/buildRouterExplorerControllerMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEjE,OAAO,EAAE,gCAAgC,EAAE,MAAM,2CAA2C,CAAC;AAI7F,wBAAgB,qCAAqC,CACnD,QAAQ,EACR,SAAS,EACT,OAAO,EAEP,kBAAkB,EAAE,kBAAkB,GACrC,gCAAgC,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"buildRouterExplorerControllerMetadata.d.ts","sourceRoot":"","sources":["../../../../src/routerExplorer/calculations/buildRouterExplorerControllerMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEjE,OAAO,EAAE,gCAAgC,EAAE,MAAM,2CAA2C,CAAC;AAI7F,wBAAgB,qCAAqC,CACnD,QAAQ,EACR,SAAS,EACT,OAAO,EAEP,MAAM,EAAE,MAAM,EACd,kBAAkB,EAAE,kBAAkB,GACrC,gCAAgC,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,CAehE"}
|
|
@@ -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"}
|
|
@@ -7,7 +7,7 @@ export interface RouterExplorerControllerMethodMetadata<TRequest = unknown, TRes
|
|
|
7
7
|
readonly errorTypeToErrorFilterMap: Map<Newable<Error> | null, Newable<ErrorFilter>>;
|
|
8
8
|
readonly guardList: ServiceIdentifier<Guard<TRequest>>[];
|
|
9
9
|
readonly headerMetadataList: [string, string][];
|
|
10
|
-
readonly interceptorList: ServiceIdentifier<Interceptor<TRequest>>[];
|
|
10
|
+
readonly interceptorList: ServiceIdentifier<Interceptor<TRequest, TResponse>>[];
|
|
11
11
|
readonly methodKey: string | symbol;
|
|
12
12
|
readonly parameterMetadataList: (ControllerMethodParameterMetadata<TRequest, TResponse, TResult> | undefined)[];
|
|
13
13
|
readonly path: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouterExplorerControllerMethodMetadata.d.ts","sourceRoot":"","sources":["../../../../src/routerExplorer/model/RouterExplorerControllerMethodMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,KAAK,EACL,WAAW,EACX,UAAU,EACX,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC;AAExF,MAAM,WAAW,sCAAsC,CACrD,QAAQ,GAAG,OAAO,EAClB,SAAS,GAAG,OAAO,EACnB,OAAO,GAAG,OAAO;IAEjB,QAAQ,CAAC,yBAAyB,EAAE,GAAG,CACrC,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,EACrB,OAAO,CAAC,WAAW,CAAC,CACrB,CAAC;IACF,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;IACzD,QAAQ,CAAC,kBAAkB,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IAChD,QAAQ,CAAC,eAAe,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"RouterExplorerControllerMethodMetadata.d.ts","sourceRoot":"","sources":["../../../../src/routerExplorer/model/RouterExplorerControllerMethodMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,KAAK,EACL,WAAW,EACX,UAAU,EACX,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC;AAExF,MAAM,WAAW,sCAAsC,CACrD,QAAQ,GAAG,OAAO,EAClB,SAAS,GAAG,OAAO,EACnB,OAAO,GAAG,OAAO;IAEjB,QAAQ,CAAC,yBAAyB,EAAE,GAAG,CACrC,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,EACrB,OAAO,CAAC,WAAW,CAAC,CACrB,CAAC;IACF,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;IACzD,QAAQ,CAAC,kBAAkB,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IAChD,QAAQ,CAAC,eAAe,EAAE,iBAAiB,CACzC,WAAW,CAAC,QAAQ,EAAE,SAAS,CAAC,CACjC,EAAE,CAAC;IACJ,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IACpC,QAAQ,CAAC,qBAAqB,EAAE,CAC5B,iCAAiC,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,GAC/D,SAAS,CACZ,EAAE,CAAC;IACJ,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,yBAAyB,EAAE,iBAAiB,CAEnD,UAAU,CAAC,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,CAAC,CAC9C,EAAE,CAAC;IACJ,QAAQ,CAAC,wBAAwB,EAAE,iBAAiB,CAElD,UAAU,CAAC,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,CAAC,CAC9C,EAAE,CAAC;IACJ,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAC9C,QAAQ,CAAC,UAAU,EAAE,cAAc,GAAG,SAAS,CAAC;IAChD,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;CACpC"}
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Interceptor, Middleware, ApplyMiddlewareOptions, ErrorFilter, Guard, Pipe } from '@inversifyjs/framework-core';
|
|
2
2
|
export { ApplyMiddleware, CatchError, CatchErrorOptions, ErrorFilter, Guard, Interceptor, InterceptorTransformObject, Middleware, MiddlewarePhase, Pipe, PipeMetadata, UseErrorFilter, UseGuard, UseInterceptor } from '@inversifyjs/framework-core';
|
|
3
3
|
import { Readable, Stream } from 'node:stream';
|
|
4
|
-
import { Container, Newable, ServiceIdentifier, BindingScope } from 'inversify';
|
|
5
4
|
import { Logger } from '@inversifyjs/logger';
|
|
5
|
+
import { Container, Newable, ServiceIdentifier, BindingScope } from 'inversify';
|
|
6
6
|
|
|
7
7
|
interface HttpAdapterOptions {
|
|
8
8
|
logger?: boolean | Logger;
|
|
@@ -117,6 +117,7 @@ declare abstract class InversifyHttpAdapter<TRequest, TResponse, TNextFunction e
|
|
|
117
117
|
protected readonly globalHandlers: {
|
|
118
118
|
interceptorList: Interceptor<TRequest, TResponse>[];
|
|
119
119
|
};
|
|
120
|
+
protected readonly _logger: Logger;
|
|
120
121
|
constructor(container: Container, defaultHttpAdapterOptions: RequiredOptions<TOptions>, httpAdapterOptions: TOptions | undefined, awaitableRequestMethodParamTypes?: Iterable<RequestMethodParameterType> | undefined);
|
|
121
122
|
applyGlobalMiddleware(...middlewareList: (Newable<Middleware> | ApplyMiddlewareOptions)[]): void;
|
|
122
123
|
useGlobalFilters(...errorFilterList: Newable<ErrorFilter>[]): void;
|
|
@@ -125,14 +126,14 @@ declare abstract class InversifyHttpAdapter<TRequest, TResponse, TNextFunction e
|
|
|
125
126
|
useGlobalPipe(...pipeList: (ServiceIdentifier<Pipe> | Pipe)[]): void;
|
|
126
127
|
protected _buildServer(): Promise<void>;
|
|
127
128
|
abstract build(): Promise<unknown>;
|
|
128
|
-
protected abstract _getBody(request: TRequest, parameterName?: string): unknown;
|
|
129
|
+
protected abstract _getBody(request: TRequest, response: TResponse, parameterName?: string): unknown;
|
|
129
130
|
protected abstract _getParams(request: TRequest, parameterName?: string): unknown;
|
|
130
131
|
protected abstract _getQuery(request: TRequest, parameterName?: string): unknown;
|
|
131
132
|
protected abstract _getHeaders(request: TRequest, parameterName?: string): unknown;
|
|
132
133
|
protected abstract _getCookies(request: TRequest, response: TResponse, parameterName?: string): unknown;
|
|
133
134
|
protected abstract _replyText(request: TRequest, response: TResponse, value: string): TResult;
|
|
134
135
|
protected abstract _replyJson(request: TRequest, response: TResponse, value?: object): TResult;
|
|
135
|
-
protected abstract _replyStream(request: TRequest, response: TResponse, value: Readable): TResult
|
|
136
|
+
protected abstract _replyStream(request: TRequest, response: TResponse, value: Readable): TResult | Promise<TResult>;
|
|
136
137
|
protected abstract _setStatus(request: TRequest, response: TResponse, statusCode: HttpStatusCode): void;
|
|
137
138
|
protected abstract _setHeader(request: TRequest, response: TResponse, key: string, value: string): void;
|
|
138
139
|
protected abstract _buildRouter(routerParams: RouterParams<TRequest, TResponse, TNextFunction, TResult>): void | Promise<void>;
|
|
@@ -201,14 +202,11 @@ interface HttpResponse {
|
|
|
201
202
|
|
|
202
203
|
declare function isHttpResponse(value: unknown): value is HttpResponse;
|
|
203
204
|
|
|
204
|
-
declare const isSuccessHttpResponse: unique symbol;
|
|
205
205
|
declare class SuccessHttpResponse implements HttpResponse {
|
|
206
206
|
readonly statusCode: HttpStatusCode;
|
|
207
207
|
readonly body?: (object | string | number | boolean | Stream) | undefined;
|
|
208
208
|
[isHttpResponse$1]: true;
|
|
209
|
-
[isSuccessHttpResponse]: true;
|
|
210
209
|
constructor(statusCode: HttpStatusCode, body?: (object | string | number | boolean | Stream) | undefined);
|
|
211
|
-
static is(value: unknown): value is SuccessHttpResponse;
|
|
212
210
|
}
|
|
213
211
|
|
|
214
212
|
declare class AcceptedHttpResponse extends SuccessHttpResponse {
|
|
@@ -219,26 +217,23 @@ declare class AlreadyReportedHttpResponse extends SuccessHttpResponse {
|
|
|
219
217
|
constructor(body?: object | string | number | boolean);
|
|
220
218
|
}
|
|
221
219
|
|
|
222
|
-
declare const isErrorHttpResponse: unique symbol;
|
|
223
220
|
declare class ErrorHttpResponse extends Error implements HttpResponse {
|
|
224
221
|
readonly statusCode: HttpStatusCode;
|
|
225
222
|
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;
|
|
223
|
+
readonly body?: object | string | number | boolean | Stream | undefined;
|
|
224
|
+
constructor(statusCode: HttpStatusCode, body?: object | string | number | boolean | Stream | undefined, message?: string | undefined, errorOptions?: ErrorOptions | undefined);
|
|
230
225
|
}
|
|
231
226
|
|
|
232
227
|
declare class BadGatewayHttpResponse extends ErrorHttpResponse {
|
|
233
|
-
constructor(
|
|
228
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
234
229
|
}
|
|
235
230
|
|
|
236
231
|
declare class BadRequestHttpResponse extends ErrorHttpResponse {
|
|
237
|
-
constructor(
|
|
232
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
238
233
|
}
|
|
239
234
|
|
|
240
235
|
declare class ConflictHttpResponse extends ErrorHttpResponse {
|
|
241
|
-
constructor(
|
|
236
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
242
237
|
}
|
|
243
238
|
|
|
244
239
|
declare class ContentDifferentHttpResponse extends SuccessHttpResponse {
|
|
@@ -250,35 +245,35 @@ declare class CreatedHttpResponse extends SuccessHttpResponse {
|
|
|
250
245
|
}
|
|
251
246
|
|
|
252
247
|
declare class ForbiddenHttpResponse extends ErrorHttpResponse {
|
|
253
|
-
constructor(
|
|
248
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
254
249
|
}
|
|
255
250
|
|
|
256
251
|
declare class GatewayTimeoutHttpResponse extends ErrorHttpResponse {
|
|
257
|
-
constructor(
|
|
252
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
258
253
|
}
|
|
259
254
|
|
|
260
255
|
declare class GoneHttpResponse extends ErrorHttpResponse {
|
|
261
|
-
constructor(
|
|
256
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
262
257
|
}
|
|
263
258
|
|
|
264
259
|
declare class HttpVersionNotSupportedHttpResponse extends ErrorHttpResponse {
|
|
265
|
-
constructor(
|
|
260
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
266
261
|
}
|
|
267
262
|
|
|
268
263
|
declare class InsufficientStorageHttpResponse extends ErrorHttpResponse {
|
|
269
|
-
constructor(
|
|
264
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
270
265
|
}
|
|
271
266
|
|
|
272
267
|
declare class InternalServerErrorHttpResponse extends ErrorHttpResponse {
|
|
273
|
-
constructor(
|
|
268
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
274
269
|
}
|
|
275
270
|
|
|
276
271
|
declare class LoopDetectedHttpResponse extends ErrorHttpResponse {
|
|
277
|
-
constructor(
|
|
272
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
278
273
|
}
|
|
279
274
|
|
|
280
275
|
declare class MethodNotAllowedHttpResponse extends ErrorHttpResponse {
|
|
281
|
-
constructor(
|
|
276
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
282
277
|
}
|
|
283
278
|
|
|
284
279
|
declare class MultiStatusHttpResponse extends SuccessHttpResponse {
|
|
@@ -294,15 +289,15 @@ declare class NonAuthoritativeInformationHttpResponse extends SuccessHttpRespons
|
|
|
294
289
|
}
|
|
295
290
|
|
|
296
291
|
declare class NotAcceptableHttpResponse extends ErrorHttpResponse {
|
|
297
|
-
constructor(
|
|
292
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
298
293
|
}
|
|
299
294
|
|
|
300
295
|
declare class NotFoundHttpResponse extends ErrorHttpResponse {
|
|
301
|
-
constructor(
|
|
296
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
302
297
|
}
|
|
303
298
|
|
|
304
299
|
declare class NotImplementedHttpResponse extends ErrorHttpResponse {
|
|
305
|
-
constructor(
|
|
300
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
306
301
|
}
|
|
307
302
|
|
|
308
303
|
declare class OkHttpResponse extends SuccessHttpResponse {
|
|
@@ -314,7 +309,7 @@ declare class PartialContentHttpResponse extends SuccessHttpResponse {
|
|
|
314
309
|
}
|
|
315
310
|
|
|
316
311
|
declare class PaymentRequiredHttpResponse extends ErrorHttpResponse {
|
|
317
|
-
constructor(
|
|
312
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
318
313
|
}
|
|
319
314
|
|
|
320
315
|
declare class ResetContentHttpResponse extends SuccessHttpResponse {
|
|
@@ -322,15 +317,15 @@ declare class ResetContentHttpResponse extends SuccessHttpResponse {
|
|
|
322
317
|
}
|
|
323
318
|
|
|
324
319
|
declare class ServiceUnavailableHttpResponse extends ErrorHttpResponse {
|
|
325
|
-
constructor(
|
|
320
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
326
321
|
}
|
|
327
322
|
|
|
328
323
|
declare class UnauthorizedHttpResponse extends ErrorHttpResponse {
|
|
329
|
-
constructor(
|
|
324
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
330
325
|
}
|
|
331
326
|
|
|
332
327
|
declare class UnprocessableEntityHttpResponse extends ErrorHttpResponse {
|
|
333
|
-
constructor(
|
|
328
|
+
constructor(body?: object | string | number | boolean | Stream | undefined, errorMessage?: string, errorOptions?: ErrorOptions);
|
|
334
329
|
}
|
|
335
330
|
|
|
336
331
|
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,findInPrototypeChain as T}from"@inversifyjs/prototype-utils";import{getOwnReflectMetadata as h,updateOwnReflectMetadata as N,buildEmptyArrayMetadata as O,buildArrayMetadataWithIndex as R,setReflectMetadata as A,buildArrayMetadataWithElement as f,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]}const g=Symbol.for("@inversifyjs/http-core/ErrorHttpResponse");class C extends Error{statusCode;[m];[g];body;constructor(t,e,r,s){super(r,s),this.statusCode=t,this.body={error:e,message:r,statusCode:t},this[g]=!0,this[m]=!0}static is(t){return D(t)&&!0===t[g]}}var P;!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"}(P||(P={}));class H extends C{constructor(t,e="Forbidden",r){super(P.FORBIDDEN,e,t,r)}}class w extends C{constructor(t,e="Internal Server Error",r){super(P.INTERNAL_SERVER_ERROR,e,t,r)}}function S(e,r){const s=t(r);for(const t of s){void 0===e.get(t)&&e.set(t,r)}}const U="@inversifyjs/http-core/controller/controllerMethodHeaderMetadataReflectKey";const b="@inversifyjs/http-core/controller/controllerMethodParameterMetadataReflectKey";const v="@inversifyjs/http-core/controller/controllerMethodStatusCodeMetadataReflectKey";const F="@inversifyjs/http-core/controller/controllerMethodUseNativeHandlerMetadataReflectKey";function G(t,d){const u=(E=t.target,N=d.methodKey,T(E,t=>h(t,b,N))??[]);var E,N;const O=function(t,e){return T(t,t=>h(t,v,e))}(t.target,d.methodKey),R=[...s(t.target),...o(t.target,d.methodKey)],A=[...a(t.target),...n(t.target,d.methodKey)],f=i(t.target),_=c(f),I=l(t.target,d.methodKey),y=function(t,s){const o=new Map;for(const r of e(t,s))S(o,r);for(const e of r(t))S(o,e);return o}(t.target,d.methodKey),M=c(I),L=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()]}(t.target,d.methodKey),m=function(t,e){return T(t,t=>h(t,F,e))??!1}(t.target,d.methodKey);return{errorTypeToErrorFilterMap:y,guardList:R,headerMetadataList:L,interceptorList:A,methodKey:d.methodKey,parameterMetadataList:u,path:d.path,postHandlerMiddlewareList:[..._.postHandlerMiddlewareList,...M.postHandlerMiddlewareList],preHandlerMiddlewareList:[..._.preHandlerMiddlewareList,...M.preHandlerMiddlewareList],requestMethodType:d.requestMethodType,statusCode:O,useNativeHandler:m}}function x(t,e){return e.map(e=>G(t,e))}const B="@inversifyjs/http-core/controller/controllerMethodMetadataReflectKey";function Y(t){const e=new Map;let r=t;for(;void 0!==r;){const t=h(r,B);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 K(t){return{controllerMethodMetadataList:x(t,Y(t.target)),path:t.path,serviceIdentifier:t.serviceIdentifier,target:t.target}}const Q="@inversifyjs/http-core/controller/controllerMetadataReflectKey";function j(){return h(Reflect,Q)}var q;!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"}(q||(q={}));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 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.#u(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.#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=j();if(void 0===e)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 r=[];for(const s of e)t.isBound(s.serviceIdentifier)&&r.push(K(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.#f(e,r.methodKey,r.parameterMetadataList);let o;o=r.useNativeHandler?(t,e,r)=>r:(t,e,s)=>this.#_(t,e,s,r.statusCode);const a=this.#I(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))}#f(t,e,r){const s=r.map(t=>{if(void 0!==t)switch(t.parameterType){case q.Body:return e=>this._getBody(e,t.parameterName);case q.Cookies:return(e,r)=>this._getCookies(e,r,t.parameterName);case q.Custom:return(e,r)=>t.customParameterDecoratorHandler?.(e,r);case q.Headers:return e=>this._getHeaders(e,t.parameterName);case q.Next:return(t,e,r)=>r;case q.Params:return e=>this._getParams(e,t.parameterName);case q.Query:return e=>this._getQuery(e,t.parameterName);case q.Request:return t=>t;case q.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.#M(i,[...this.#o,...l.pipeList],{methodName:e,parameterIndex:c,targetClass:t})})),i}}async#M(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#L(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)}#I(t){const e=async(r,s,o)=>{const a=await this.#L(o,t.errorTypeToErrorFilterMap)??await this.#L(o,this.#r);if(void 0===a){let t;return C.is(o)?t=o:(this.#m(o),t=new w(void 0,void 0,{cause:o})),this.#_(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)}#_(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.#I(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.#I(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.#_(e,s,new H)}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){S(this.#r,t)}#E(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,b,O,R(t,s),r),t.parameterType!==q.Next&&t.parameterType!==q.Response||A(e.constructor,F,!0,r)}}({customParameterDecoratorHandler:s,parameterName:o,parameterType:t,pipeList:a})}function $(t,...e){return W(q.Custom,e,void 0,t)}function X(t,e){return(r,s)=>{const o={methodKey:s,path:k(e??"/"),requestMethodType:t};N(r.constructor,B,O,f(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(q.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,Q,O,f(r))}}function et(t,...e){return W(q.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(q.Headers,e,t)}function nt(){return W(q.Next,[])}const it=t=>X(Z.Options,t);function ct(t,...e){return W(q.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(q.Query,e,t)}function pt(...t){return W(q.Request,t)}function Tt(...t){return W(q.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)=>{A(e.constructor,v,t,r)}}const Ot=Symbol.for("@inversifyjs/http-core/SuccessHttpResponse");class Rt{statusCode;body;[m];[Ot];constructor(t,e){this.statusCode=t,this.body=e,this[m]=!0,this[Ot]=!0}static is(t){return D(t)&&!0===t[Ot]}}class At extends Rt{constructor(t){super(P.ACCEPTED,t)}}class ft extends Rt{constructor(t){super(P.ALREADY_REPORTED,t)}}class _t extends C{constructor(t,e="Bad Gateway",r){super(P.BAD_GATEWAY,e,t,r)}}class It extends C{constructor(t,e="Bad Request",r){super(P.BAD_REQUEST,e,t,r)}}class yt extends C{constructor(t,e="Conflict",r){super(P.CONFLICT,e,t,r)}}class Mt extends Rt{constructor(t){super(P.CONTENT_DIFFERENT,t)}}class Lt extends Rt{constructor(t){super(P.CREATED,t)}}class mt extends C{constructor(t,e="Gateway Timeout",r){super(P.GATEWAY_TIMEOUT,e,t,r)}}class Dt extends C{constructor(t,e="Gone",r){super(P.GONE,e,t,r)}}class gt extends C{constructor(t,e="HTTP Version Not Supported",r){super(P.HTTP_VERSION_NOT_SUPPORTED,e,t,r)}}class Ct extends C{constructor(t,e="Insufficient Storage",r){super(P.INSUFFICIENT_STORAGE,e,t,r)}}class Pt extends C{constructor(t,e="Loop Detected",r){super(P.LOOP_DETECTED,e,t,r)}}class Ht extends C{constructor(t,e="Method Not Allowed",r){super(P.METHOD_NOT_ALLOWED,e,t,r)}}class wt extends Rt{constructor(t){super(P.MULTI_STATUS,t)}}class St extends Rt{constructor(){super(P.NO_CONTENT)}}class Ut extends Rt{constructor(t){super(P.NON_AUTHORITATIVE_INFORMATION,t)}}class bt extends C{constructor(t,e="Not Acceptable",r){super(P.NOT_ACCEPTABLE,e,t,r)}}class vt extends C{constructor(t,e="Not Found",r){super(P.NOT_FOUND,e,t,r)}}class Ft extends C{constructor(t,e="Not Implemented",r){super(P.NOT_IMPLEMENTED,e,t,r)}}class Gt extends Rt{constructor(t){super(P.OK,t)}}class xt extends Rt{constructor(t){super(P.PARTIAL_CONTENT,t)}}class Bt extends C{constructor(t,e="Payment Required",r){super(P.PAYMENT_REQUIRED,e,t,r)}}class Yt extends Rt{constructor(t){super(P.RESET_CONTENT,t)}}class Kt extends C{constructor(t,e="Service Unavailable",r){super(P.SERVICE_UNAVAILABLE,e,t,r)}}class Qt extends C{constructor(t,e="Unauthorized",r){super(P.UNAUTHORIZED,e,t,r)}}class jt extends C{constructor(t,e="Unprocessable Entity",r){super(P.UNPROCESSABLE_ENTITY,e,t,r)}}export{At as AcceptedHttpResponse,J as All,ft as AlreadyReportedHttpResponse,_t as BadGatewayHttpResponse,It as BadRequestHttpResponse,z as Body,yt as ConflictHttpResponse,Mt as ContentDifferentHttpResponse,tt as Controller,et as Cookies,Lt as CreatedHttpResponse,rt as Delete,C as ErrorHttpResponse,H as ForbiddenHttpResponse,mt as GatewayTimeoutHttpResponse,st as Get,Dt as GoneHttpResponse,ot as Head,at as Headers,P as HttpStatusCode,gt as HttpVersionNotSupportedHttpResponse,Ct as InsufficientStorageHttpResponse,w as InternalServerErrorHttpResponse,V as InversifyHttpAdapter,Pt as LoopDetectedHttpResponse,Ht as MethodNotAllowedHttpResponse,wt as MultiStatusHttpResponse,nt as Next,St as NoContentHttpResponse,Ut as NonAuthoritativeInformationHttpResponse,bt as NotAcceptableHttpResponse,vt as NotFoundHttpResponse,Ft as NotImplementedHttpResponse,Gt as OkHttpResponse,it as Options,ct as Params,xt as PartialContentHttpResponse,lt as Patch,Bt as PaymentRequiredHttpResponse,dt as Post,ut as Put,Et as Query,pt as Request,q as RequestMethodParameterType,Z as RequestMethodType,Yt as ResetContentHttpResponse,Tt as Response,Kt as ServiceUnavailableHttpResponse,ht as SetHeader,Nt as StatusCode,Qt as UnauthorizedHttpResponse,jt as UnprocessableEntityHttpResponse,k as buildNormalizedPath,$ as createCustomParameterDecorator,j as getControllerMetadataList,Y as getControllerMethodMetadataList,D 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 _,buildEmptyMapMetadata as A}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(d.target),...n(d.target,u.methodKey)],A=i(d.target),I=c(A),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:_,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;_logger;#t;#e;#r;#s;#o;#a;#n;#i;constructor(t,e,r,s){this.#t=new Set(s),this.#e=t,this.httpAdapterOptions=this.#c(e,r),this.#s=[],this.#o=[],this.#r=new Map,this._logger=this.#l(this.httpAdapterOptions),this.#i=!1,this.globalHandlers={interceptorList:[]},this.#a=[],this.#n=[],this.#d()}applyGlobalMiddleware(...t){if(this.#i)throw new M(L.invalidOperationAfterBuild,"Cannot apply global middleware after the server has been built");const e=c(t);this.#a.push(...e.postHandlerMiddlewareList),this.#n.push(...e.preHandlerMiddlewareList)}useGlobalFilters(...t){for(const e of t)this.#u(e)}applyGlobalGuards(...t){if(this.#i)throw new M(L.invalidOperationAfterBuild,"Cannot apply global guard after the server has been built");this.#s.push(...t)}useGlobalInterceptors(...t){if(this.#i)throw new M(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.#i=!0}async#T(t,e,r,s){t[e]=this.#t.has(s)?await r:r}#l(t){return"boolean"==typeof t.logger?new E:t.logger}#c(t,e){return{...t,...e}}async#p(){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._logger);for(const e of t)await this._buildRouter({path:e.path,routeParamsList:this.#h(e)}),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.#f(e,this.#a),...this.#f(e,e.postHandlerMiddlewareList)],preHandlerMiddlewareList:[...this.#f(e,this.#n),...this.#f(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.#A(t,e,s,r.statusCode);const a=this.#I(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 await 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 await 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 V.Body:return(e,r)=>this._getBody(e,r,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.#T(i,c,s(o,a,n),l.parameterType),await this.#M(i,[...this.#o,...l.pipeList],{methodName:e,parameterIndex:c,targetClass:t})})),i}}async#M(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#L(t,e){return q(this.#e,t,e)}#I(t){const e=async(r,s,o)=>{const a=await this.#L(o,[t.errorTypeToErrorFilterMap,this.#r]);if(void 0===a){let t;return this.#m(o),t=new w(void 0,void 0,{cause:o}),this.#A(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)}#A(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))}#f(t,e){const r=this.#I(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.#I(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():await this.#A(e,s,new P)}catch(t){return r(e,s,t)}})}#N(t,e,r){if(!1!==this.httpAdapterOptions.logger){this._logger.info(`${t} {${e}}:`);for(const t of r)this._logger.info(` - .${t.methodKey}() mapped {${t.path}, ${t.requestMethodType}}`)}}#m(t){t instanceof Error&&this._logger.error(t.stack??t.message),this._logger.error("An unexpected error occurred")}#u(t){H(this._logger,this.#r,t)}#d(){var t;this.#r.set(g,(t=this.#A.bind(this),{catch:(e,r,s)=>t(r,s,e)}))}#E(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,_(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,_(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,A,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 _t extends g{constructor(t,e="Bad Gateway",r){super(C.BAD_GATEWAY,t,e,r)}}class At 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,_t as BadGatewayHttpResponse,At 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
|