@h3ravel/foundation 0.1.0-alpha.6 → 0.1.0-alpha.8

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/dist/index.cjs CHANGED
@@ -20108,7 +20108,7 @@ let Kernel = class Kernel$2 extends (0, __h3ravel_shared.mix)(__h3ravel_contract
20108
20108
  if (!threshold || typeof handler !== "function") continue;
20109
20109
  if ((this.#requestStartedAt?.diff(end, "milliseconds") ?? 0) > threshold) handler(this.#requestStartedAt, request$2, response$1);
20110
20110
  }
20111
- response$1.reset();
20111
+ if (response$1.reset) response$1.reset();
20112
20112
  this.#requestStartedAt = void 0;
20113
20113
  }
20114
20114
  /**
@@ -38382,8 +38382,8 @@ var RequestException = class RequestException {
38382
38382
  //#endregion
38383
38383
  //#region src/Exceptions/Base/ExceptionHandler.ts
38384
38384
  var ExceptionHandler = class extends Handler {
38385
- async handle(error$1, ctx) {
38386
- this.mapException(error$1);
38385
+ async handle(e, ctx) {
38386
+ let error$1 = this.mapException(e);
38387
38387
  try {
38388
38388
  /**
38389
38389
  * Skip reporting if in dontReport list
package/dist/index.d.ts CHANGED
@@ -1394,7 +1394,7 @@ declare abstract class Handler extends IExceptionHandler {
1394
1394
  /**
1395
1395
  * A map of exceptions with their corresponding custom log levels.
1396
1396
  */
1397
- protected levels: Map<string | Error, "error" | "debug" | "info" | "warn" | "log">;
1397
+ protected levels: Map<string | Error, "debug" | "info" | "warn" | "error" | "log">;
1398
1398
  /**
1399
1399
  * Internal exceptions that are not reported by default. Subclasses may expand.
1400
1400
  */
@@ -1519,7 +1519,9 @@ declare abstract class Handler extends IExceptionHandler {
1519
1519
  * @param error
1520
1520
  * @returns
1521
1521
  */
1522
- protected mapException(error: any): any;
1522
+ protected mapException<E extends Error & {
1523
+ getInnerException?: () => any;
1524
+ }>(error: E): E;
1523
1525
  /**
1524
1526
  * Render an exception into an HTTP Response.
1525
1527
  *
@@ -1656,7 +1658,7 @@ declare abstract class Handler extends IExceptionHandler {
1656
1658
  //#endregion
1657
1659
  //#region src/Exceptions/Base/ExceptionHandler.d.ts
1658
1660
  declare class ExceptionHandler extends Handler {
1659
- handle(error: Error, ctx: IHttpContext): Promise<_h3ravel_contracts0.IResponse | _h3ravel_contracts0.IResponsable>;
1661
+ handle(e: Error, ctx: IHttpContext): Promise<_h3ravel_contracts0.IResponse | _h3ravel_contracts0.IResponsable>;
1660
1662
  }
1661
1663
  //#endregion
1662
1664
  //#region src/Exceptions/Base/RequestException.d.ts
@@ -1792,7 +1794,7 @@ declare class HttpException extends Error {
1792
1794
  protected headers: Record<string, string>;
1793
1795
  code: number;
1794
1796
  constructor(statusCode: number, message?: string, previous?: Error | undefined, headers?: Record<string, string>, code?: number);
1795
- static fromStatusCode(statusCode: number, message?: string, previous?: Error, headers?: Record<string, string>, code?: number): AccessDeniedHttpException | BadRequestHttpException | ConflictHttpException | GoneHttpException | LengthRequiredHttpException | LockedHttpException | NotAcceptableHttpException | NotFoundHttpException | PreconditionFailedHttpException | PreconditionRequiredHttpException | ServiceUnavailableHttpException | TooManyRequestsHttpException | UnprocessableEntityHttpException | UnsupportedMediaTypeHttpException | HttpException;
1797
+ static fromStatusCode(statusCode: number, message?: string, previous?: Error, headers?: Record<string, string>, code?: number): AccessDeniedHttpException | BadRequestHttpException | ConflictHttpException | GoneHttpException | ServiceUnavailableHttpException | TooManyRequestsHttpException | LengthRequiredHttpException | LockedHttpException | NotAcceptableHttpException | PreconditionFailedHttpException | NotFoundHttpException | UnprocessableEntityHttpException | UnsupportedMediaTypeHttpException | PreconditionRequiredHttpException | HttpException;
1796
1798
  getStatusCode(): number;
1797
1799
  getHeaders(): Record<string, string>;
1798
1800
  setHeaders(headers: Record<string, string>): void;
package/dist/index.js CHANGED
@@ -20103,7 +20103,7 @@ let Kernel = class Kernel$2 extends mix(IKernel, use(InteractsWithTime)) {
20103
20103
  if (!threshold || typeof handler !== "function") continue;
20104
20104
  if ((this.#requestStartedAt?.diff(end, "milliseconds") ?? 0) > threshold) handler(this.#requestStartedAt, request$2, response$1);
20105
20105
  }
20106
- response$1.reset();
20106
+ if (response$1.reset) response$1.reset();
20107
20107
  this.#requestStartedAt = void 0;
20108
20108
  }
20109
20109
  /**
@@ -38377,8 +38377,8 @@ var RequestException = class RequestException {
38377
38377
  //#endregion
38378
38378
  //#region src/Exceptions/Base/ExceptionHandler.ts
38379
38379
  var ExceptionHandler = class extends Handler {
38380
- async handle(error$1, ctx) {
38381
- this.mapException(error$1);
38380
+ async handle(e, ctx) {
38381
+ let error$1 = this.mapException(e);
38382
38382
  try {
38383
38383
  /**
38384
38384
  * Skip reporting if in dontReport list
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@h3ravel/foundation",
3
- "version": "0.1.0-alpha.6",
3
+ "version": "0.1.0-alpha.8",
4
4
  "description": "H3ravel Foundation for shared and reuseable services.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -47,14 +47,14 @@
47
47
  ],
48
48
  "devDependencies": {
49
49
  "@types/supertest": "^6.0.3",
50
- "@h3ravel/contracts": "^0.29.0-alpha.6",
50
+ "@h3ravel/contracts": "^0.29.0-alpha.8",
51
51
  "supertest": "^7.1.4"
52
52
  },
53
53
  "dependencies": {
54
54
  "h3": "2.0.1-rc.5",
55
- "@h3ravel/shared": "^0.29.0-alpha.6",
55
+ "@h3ravel/shared": "^0.29.0-alpha.8",
56
56
  "@h3ravel/musket": "^0.6.12-alpha.4",
57
- "@h3ravel/support": "^0.17.0-alpha.6"
57
+ "@h3ravel/support": "^0.17.0-alpha.8"
58
58
  },
59
59
  "scripts": {
60
60
  "build": "tsdown --config-loader unconfig",