@etohq/framework 1.1.0 → 1.2.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.
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { NextFunction, Response } from "express";
|
|
2
1
|
import { EtoError } from "@etohq/utils";
|
|
3
|
-
import { EtoMiddlewareRequest } from "../types";
|
|
4
|
-
export declare function errorHandler(): (err: EtoError, req: EtoMiddlewareRequest, res:
|
|
2
|
+
import { EtoMiddlewareNext, EtoMiddlewareRequest, EtoResponse } from "../types";
|
|
3
|
+
export declare function errorHandler(): (err: EtoError, req: EtoMiddlewareRequest, res: EtoResponse, next: EtoMiddlewareNext) => Promise<import("..").HandlerResponse>;
|
|
5
4
|
/**
|
|
6
5
|
* @schema Error
|
|
7
6
|
* title: "Response Error"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-handler.d.ts","sourceRoot":"","sources":["../../../src/http/middlewares/error-handler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"error-handler.d.ts","sourceRoot":"","sources":["../../../src/http/middlewares/error-handler.ts"],"names":[],"mappings":"AACA,OAAO,EAA6B,QAAQ,EAAE,MAAM,cAAc,CAAA;AAElE,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAY/E,wBAAgB,YAAY,UAEnB,QAAQ,OACR,oBAAoB,OACpB,WAAW,QACV,iBAAiB,2CAiE1B;AAED;;;;;;;;;;;;;;;;;GAiBG"}
|
|
@@ -11,7 +11,7 @@ const INVALID_REQUEST_ERROR = "invalid_request_error";
|
|
|
11
11
|
const INVALID_STATE_ERROR = "invalid_state_error";
|
|
12
12
|
// to add to Etomiddleware.
|
|
13
13
|
function errorHandler() {
|
|
14
|
-
return (err, req, res, next) => {
|
|
14
|
+
return async (err, req, res, next) => {
|
|
15
15
|
const logger = req.data.resolve(utils_1.ContainerRegistrationKeys.LOGGER);
|
|
16
16
|
err = (0, exception_formatter_1.formatException)(err);
|
|
17
17
|
logger.error(err);
|
|
@@ -62,7 +62,9 @@ function errorHandler() {
|
|
|
62
62
|
errObj.type = "unknown_error";
|
|
63
63
|
break;
|
|
64
64
|
}
|
|
65
|
-
|
|
65
|
+
const response = await next(req);
|
|
66
|
+
response.status = statusCode;
|
|
67
|
+
return response;
|
|
66
68
|
};
|
|
67
69
|
}
|
|
68
70
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-handler.js","sourceRoot":"","sources":["../../../src/http/middlewares/error-handler.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"error-handler.js","sourceRoot":"","sources":["../../../src/http/middlewares/error-handler.ts"],"names":[],"mappings":";;AAeA,oCAsEC;AApFD,wCAAkE;AAClE,+DAAuD;AAGvD,MAAM,qBAAqB,GAAG,iCAAiC,CAAA;AAC/D,MAAM,mBAAmB,GAAG,gCAAgC,CAAA;AAC5D,MAAM,uBAAuB,GAAG,4BAA4B,CAAA;AAE5D,MAAM,SAAS,GAAG,WAAW,CAAA;AAC7B,MAAM,qBAAqB,GAAG,uBAAuB,CAAA;AACrD,MAAM,mBAAmB,GAAG,qBAAqB,CAAA;AAEjD,2BAA2B;AAE3B,SAAgB,YAAY;IAC1B,OAAO,KAAK,EACV,GAAa,EACb,GAAyB,EACzB,GAAgB,EAChB,IAAuB,EACvB,EAAE;QAEF,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,iCAAyB,CAAC,MAAM,CAAC,CAAA;QAEjE,GAAG,GAAG,IAAA,qCAAe,EAAC,GAAG,CAAC,CAAA;QAE1B,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAEjB,MAAM,SAAS,GAAG,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,CAAA;QAEtC,MAAM,MAAM,GAAG;YACb,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,IAAI,EAAE,GAAG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C7B,MAAM,CAAC,OAAO,GAAG,4BAA4B,CAAA;gBAC7C,MAAM,CAAC,IAAI,GAAG,eAAe,CAAA;gBAC7B,MAAK;QACT,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,CAAA;QAEhC,QAAQ,CAAC,MAAM,GAAG,UAAU,CAAA;QAE5B,OAAO,QAAQ,CAAA;IACjB,CAAC,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etohq/framework",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Framework",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"./feature-flags": "./dist/feature-flags/index.js",
|
|
28
28
|
"./utils": "./dist/utils/index.js",
|
|
29
29
|
"./types": "./dist/types/index.js",
|
|
30
|
+
"./types/http": "./dist/types/http/index.js",
|
|
30
31
|
"./build-tools": "./dist/build-tools/index.js",
|
|
31
32
|
"./orchestration": "./dist/orchestration/index.js",
|
|
32
33
|
"./workflows-sdk": "./dist/workflows-sdk/index.js",
|
|
@@ -54,7 +55,7 @@
|
|
|
54
55
|
"test": "jest --runInBand --bail --passWithNoTests --forceExit"
|
|
55
56
|
},
|
|
56
57
|
"devDependencies": {
|
|
57
|
-
"@etohq/cli": "^1.
|
|
58
|
+
"@etohq/cli": "^1.2.0",
|
|
58
59
|
"@mikro-orm/cli": "5.9.7",
|
|
59
60
|
"@mikro-orm/core": "5.9.7",
|
|
60
61
|
"@mikro-orm/knex": "5.9.7",
|
|
@@ -75,12 +76,12 @@
|
|
|
75
76
|
"vite": "^5.2.11"
|
|
76
77
|
},
|
|
77
78
|
"dependencies": {
|
|
78
|
-
"@etohq/link-modules-sdk": "^1.
|
|
79
|
-
"@etohq/modules-sdk": "^1.
|
|
80
|
-
"@etohq/orchestration": "^1.
|
|
81
|
-
"@etohq/types": "^1.
|
|
82
|
-
"@etohq/utils": "^1.
|
|
83
|
-
"@etohq/workflows-sdk": "^1.
|
|
79
|
+
"@etohq/link-modules-sdk": "^1.2.0",
|
|
80
|
+
"@etohq/modules-sdk": "^1.2.0",
|
|
81
|
+
"@etohq/orchestration": "^1.2.0",
|
|
82
|
+
"@etohq/types": "^1.2.0",
|
|
83
|
+
"@etohq/utils": "^1.2.0",
|
|
84
|
+
"@etohq/workflows-sdk": "^1.2.0",
|
|
84
85
|
"@jercle/yargonaut": "^1.1.5",
|
|
85
86
|
"@opentelemetry/api": "^1.9.0",
|
|
86
87
|
"@types/express": "^4.17.17",
|
|
@@ -97,7 +98,7 @@
|
|
|
97
98
|
"zod": "3.22.4"
|
|
98
99
|
},
|
|
99
100
|
"peerDependencies": {
|
|
100
|
-
"@etohq/cli": "^1.
|
|
101
|
+
"@etohq/cli": "^1.1.0",
|
|
101
102
|
"@mikro-orm/cli": "5.9.7",
|
|
102
103
|
"@mikro-orm/core": "5.9.7",
|
|
103
104
|
"@mikro-orm/knex": "5.9.7",
|