@heliosjs/middlewares 4.0.0 → 4.0.2
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/catch.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ErrorHandler } from './types/core';
|
|
2
2
|
/**
|
|
3
3
|
* Decorator to register a global or controller-level error handler.
|
|
4
4
|
*
|
|
@@ -7,7 +7,7 @@ import { ErorrHandler } from './types/core';
|
|
|
7
7
|
* It attaches the handler as metadata on the target class, allowing the framework to
|
|
8
8
|
* retrieve and execute the error handler appropriately during runtime.
|
|
9
9
|
*
|
|
10
|
-
* @param {
|
|
10
|
+
* @param {ErrorHandler} handler - The error callback function to handle errors.
|
|
11
11
|
*
|
|
12
12
|
* @returns {Function} A class decorator function that defines the error handler metadata.
|
|
13
13
|
*
|
|
@@ -26,4 +26,4 @@ import { ErorrHandler } from './types/core';
|
|
|
26
26
|
* This metadata is accessible via Reflect API and used internally by the framework
|
|
27
27
|
* to invoke the registered error handler when errors occur.
|
|
28
28
|
*/
|
|
29
|
-
export declare function Catch(handler:
|
|
29
|
+
export declare function Catch(handler: ErrorHandler): (target: any, propertyKey?: string, descriptor?: PropertyDescriptor) => void;
|
package/dist/catch.js
CHANGED
|
@@ -10,7 +10,7 @@ const shared_1 = require("./utils/shared");
|
|
|
10
10
|
* It attaches the handler as metadata on the target class, allowing the framework to
|
|
11
11
|
* retrieve and execute the error handler appropriately during runtime.
|
|
12
12
|
*
|
|
13
|
-
* @param {
|
|
13
|
+
* @param {ErrorHandler} handler - The error callback function to handle errors.
|
|
14
14
|
*
|
|
15
15
|
* @returns {Function} A class decorator function that defines the error handler metadata.
|
|
16
16
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HTTP_METHODS, InterceptorCB, MiddlewareCB, ParamMetadata } from './common';
|
|
2
2
|
import { CORSConfig } from './cors';
|
|
3
|
-
import {
|
|
3
|
+
import { ErrorHandler } from './error';
|
|
4
4
|
import { Request } from './request';
|
|
5
5
|
import { Response } from './response';
|
|
6
6
|
import { SanitizerConfig } from './sanitize';
|
|
@@ -56,7 +56,7 @@ export type SeeControllerHandlers = {
|
|
|
56
56
|
};
|
|
57
57
|
export type FunctionsMeta = {
|
|
58
58
|
middlewares: MiddlewareCB[];
|
|
59
|
-
errors:
|
|
59
|
+
errors: ErrorHandler[];
|
|
60
60
|
cors: CORSConfig[];
|
|
61
61
|
sanitizers: SanitizerConfig[];
|
|
62
62
|
pipes: Pipe[];
|
|
@@ -110,7 +110,7 @@ export interface Guard {
|
|
|
110
110
|
export type GuardFn = (request: Request, response: Response) => boolean;
|
|
111
111
|
export type MiddlewaresMetadata = {
|
|
112
112
|
middlewares: MiddlewareCB[];
|
|
113
|
-
errors:
|
|
113
|
+
errors: ErrorHandler[];
|
|
114
114
|
cors: CORSConfig[];
|
|
115
115
|
sanitizers: SanitizerConfig[];
|
|
116
116
|
pipes: Pipe[];
|
|
@@ -69,7 +69,7 @@ export interface ErrorHandlerConfig {
|
|
|
69
69
|
logStack?: boolean;
|
|
70
70
|
customHandlers?: Record<ErrorCode, (error: HeliosError) => unknown>;
|
|
71
71
|
}
|
|
72
|
-
export type
|
|
72
|
+
export type ErrorHandler = (error: Error, req: Request, response: Response) => unknown;
|
|
73
73
|
type ErrorChildren = {
|
|
74
74
|
property?: string;
|
|
75
75
|
value: unknown;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heliosjs/middlewares",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "Core functionality for Quantum Flow",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"reflect-metadata": "^0.2.2"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@heliosjs/core": "^2.1.
|
|
33
|
+
"@heliosjs/core": "^2.1.2",
|
|
34
34
|
"typescript": ">=4.0.0"
|
|
35
35
|
}
|
|
36
36
|
}
|