Comparing version 3.0.0-alpha.1 to 3.0.0-alpha.2
@@ -5,2 +5,7 @@ # Changelog | ||
## [3.0.0-alpha.2][] - 2022-07-07 | ||
- Pass http verb to the hook | ||
- Package meintenance | ||
## [3.0.0-alpha.1][] - 2022-05-16 | ||
@@ -193,4 +198,5 @@ | ||
[unreleased]: https://github.com/metarhia/metacom/compare/3.0.0-alpha.1...HEAD | ||
[3.0.0-alpha.1]: https://github.com/metarhia/metacom/compare/v2.0.7...3.0.0-alpha.1 | ||
[unreleased]: https://github.com/metarhia/metacom/compare/v3.0.0-alpha.2...HEAD | ||
[3.0.0-alpha.2]: https://github.com/metarhia/metacom/compare/v3.0.0-alpha.1...v3.0.0-alpha.2 | ||
[3.0.0-alpha.1]: https://github.com/metarhia/metacom/compare/v2.0.7...v3.0.0-alpha.1 | ||
[2.0.7]: https://github.com/metarhia/metacom/compare/v2.0.6...v2.0.7 | ||
@@ -197,0 +203,0 @@ [2.0.6]: https://github.com/metarhia/metacom/compare/v2.0.5...v2.0.6 |
@@ -146,3 +146,3 @@ import { EventEmitter } from './events.js'; | ||
if (this.opening) return this.opening; | ||
if (this.connected) return; | ||
if (this.connected) return Promise.reslve(); | ||
const socket = new WebSocket(this.url); | ||
@@ -228,3 +228,3 @@ this.active = true; | ||
this.message(packet); | ||
}) | ||
}), | ||
); | ||
@@ -231,0 +231,0 @@ } |
@@ -68,2 +68,3 @@ 'use strict'; | ||
sessions.set(token, session); | ||
return true; | ||
} | ||
@@ -70,0 +71,0 @@ |
@@ -121,4 +121,5 @@ 'use strict'; | ||
async hook(proc, interfaceName, methodName, args) { | ||
const { application, client } = this; | ||
async hook(proc, interfaceName, methodName, args, headers) { | ||
const { application, client, req } = this; | ||
const verb = req.method; | ||
const callId = -1; | ||
@@ -132,3 +133,4 @@ if (!proc) { | ||
try { | ||
result = await proc.invoke(context, { method: methodName, args }); | ||
const par = { verb, method: methodName, args, headers }; | ||
result = await proc.invoke(context, par); | ||
} catch (error) { | ||
@@ -135,0 +137,0 @@ this.error(500, { callId, error }); |
@@ -24,2 +24,3 @@ 'use strict'; | ||
this.ws = null; | ||
this.channels = channels; | ||
this.bind(); | ||
@@ -112,3 +113,3 @@ } | ||
closeChannels() { | ||
for (const channel of channels.values()) { | ||
for (const channel of this.channels.values()) { | ||
if (channel.connection) { | ||
@@ -127,3 +128,3 @@ channel.connection.terminate(); | ||
}); | ||
if (channels.size === 0) { | ||
if (this.channels.size === 0) { | ||
await metautil.delay(SHORT_TIMEOUT); | ||
@@ -130,0 +131,0 @@ return; |
@@ -22,7 +22,7 @@ import { EventEmitter } from 'events'; | ||
iname: string, | ||
ver: string | ||
ver: string, | ||
): (methodName: string) => (args: object) => Promise<void>; | ||
socketCall( | ||
iname: string, | ||
ver: string | ||
ver: string, | ||
): (methodName: string) => (args: object) => Promise<void>; | ||
@@ -73,3 +73,3 @@ } | ||
methodName: string, | ||
args: [] | ||
args: [], | ||
): Promise<void>; | ||
@@ -90,3 +90,3 @@ restoreSession(): Promise<Session | null>; | ||
methodName: string, | ||
args: Array<any> | ||
args: Array<any>, | ||
): Promise<void>; | ||
@@ -108,3 +108,3 @@ startSession(): Session; | ||
methodName: string, | ||
args: Array<any> | ||
args: Array<any>, | ||
): Promise<void>; | ||
@@ -121,2 +121,3 @@ startSession(): Session; | ||
ws?: any; | ||
channels?: Map<Client, Channel>; | ||
constructor(options: Options, application: object); | ||
@@ -123,0 +124,0 @@ bind(): void; |
{ | ||
"name": "metacom", | ||
"version": "3.0.0-alpha.1", | ||
"version": "3.0.0-alpha.2", | ||
"author": "Timur Shemsedinov <timur.shemsedinov@gmail.com>", | ||
@@ -53,13 +53,13 @@ "description": "Communication protocol for Metarhia stack with rpc, events, binary streams, memory and db access", | ||
"engines": { | ||
"node": "^12.9 || 14 || 16 || 17 || 18" | ||
"node": "14 || 16 || 18" | ||
}, | ||
"dependencies": { | ||
"metautil": "^3.5.20", | ||
"metautil": "^3.5.21", | ||
"ws": "^8.6.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^17.0.33", | ||
"@types/node": "^18.0.3", | ||
"@types/ws": "^8.5.3", | ||
"eslint": "^8.15.0", | ||
"eslint-config-metarhia": "^7.0.1", | ||
"eslint": "^8.19.0", | ||
"eslint-config-metarhia": "^8.1.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
@@ -66,0 +66,0 @@ "eslint-plugin-import": "^2.26.0", |
@@ -33,1 +33,7 @@ # Metacom Communication Protocol for Metarhia | ||
``` | ||
## License & Contributors | ||
Copyright (c) 2018-2022 [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. |
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
41635
985
39
Updatedmetautil@^3.5.21