Comparing version 3.2.0 to 3.2.1
@@ -5,2 +5,8 @@ # Changelog | ||
## [3.2.1][] - 2024-02-12 | ||
- Added call limits with queue to hooks | ||
- Fix conversion of custom thrown exceptions for response to client | ||
- Update dependencies | ||
## [3.2.0][] - 2023-12-10 | ||
@@ -267,3 +273,4 @@ | ||
[unreleased]: https://github.com/metarhia/metacom/compare/v3.2.0...HEAD | ||
[unreleased]: https://github.com/metarhia/metacom/compare/v3.2.1...HEAD | ||
[3.2.1]: https://github.com/metarhia/metacom/compare/v3.2.0...v3.2.1 | ||
[3.2.0]: https://github.com/metarhia/metacom/compare/v3.1.2...v3.2.0 | ||
@@ -270,0 +277,0 @@ [3.1.2]: https://github.com/metarhia/metacom/compare/v3.1.1...v3.1.2 |
@@ -271,3 +271,3 @@ 'use strict'; | ||
if (typeof error.code === 'number') code = error.code; | ||
error.httpCode = code; | ||
error.httpCode = code <= 599 ? code : 500; | ||
return void client.error(code, { id, error }); | ||
@@ -346,8 +346,20 @@ } finally { | ||
try { | ||
await proc.enter(); | ||
} catch { | ||
return void client.error(503, { id }); | ||
} | ||
let result = null; | ||
try { | ||
const par = { verb, method, args, headers }; | ||
const result = await proc.invoke(context, par); | ||
client.send(result); | ||
result = await proc.invoke(context, par); | ||
} catch (error) { | ||
client.error(500, { id, error }); | ||
} finally { | ||
proc.leave(); | ||
} | ||
if (metautil.isError(result)) { | ||
const { code, httpCode = 200 } = result; | ||
return void client.error(code, { id, error: result, httpCode }); | ||
} | ||
client.send(result); | ||
this.console.log(`${client.ip}\t${method}`); | ||
@@ -354,0 +366,0 @@ } |
@@ -106,3 +106,4 @@ 'use strict'; | ||
console.error(`${ip}\t${method}\t${url}\t${reason}`); | ||
const packet = { type: 'callback', id, error: { message, code } }; | ||
const outCode = pass ? code : httpCode; | ||
const packet = { type: 'callback', id, error: { message, code: outCode } }; | ||
this.send(packet, httpCode); | ||
@@ -109,0 +110,0 @@ } |
{ | ||
"name": "metacom", | ||
"version": "3.2.0", | ||
"version": "3.2.1", | ||
"author": "Timur Shemsedinov <timur.shemsedinov@gmail.com>", | ||
@@ -58,17 +58,17 @@ "description": "Communication protocol for Metarhia stack with rpc, events, binary streams, memory and db access", | ||
"dependencies": { | ||
"metautil": "5.0.0", | ||
"ws": "^8.15.0" | ||
"metautil": "5.2.1", | ||
"ws": "^8.16.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.10.4", | ||
"@types/node": "^20.11.17", | ||
"@types/ws": "^8.5.10", | ||
"eslint": "^8.55.0", | ||
"eslint": "^8.56.0", | ||
"eslint-config-metarhia": "^8.2.2", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-import": "^2.28.1", | ||
"eslint-plugin-prettier": "^5.0.0", | ||
"eslint-plugin-import": "^2.29.1", | ||
"eslint-plugin-prettier": "^5.1.3", | ||
"metatests": "^0.8.2", | ||
"prettier": "^3.1.1", | ||
"prettier": "^3.2.5", | ||
"typescript": "^5.3.3" | ||
} | ||
} |
@@ -105,4 +105,4 @@ # Metacom Communication Protocol for Metarhia | ||
Copyright (c) 2018-2023 [Metarhia contributors](https://github.com/metarhia/metacom/graphs/contributors). | ||
Copyright (c) 2018-2024 [Metarhia contributors](https://github.com/metarhia/metacom/graphs/contributors). | ||
Metacom is [MIT licensed](./LICENSE).\ | ||
Metacom is a part of [Metarhia](https://github.com/metarhia) technology stack. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
66611
1630
+ Addedmetautil@5.2.1(transitive)
- Removedmetautil@5.0.0(transitive)
Updatedmetautil@5.2.1
Updatedws@^8.16.0