@jcbuisson/express-x-client 1.0.7 → 1.0.9
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/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jcbuisson/express-x-client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "",
|
|
5
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.mjs",
|
|
6
7
|
"repository": {
|
|
7
8
|
"type": "git",
|
|
8
9
|
"url": "git@gitlab.com:buisson31/express-x-client.git"
|
|
@@ -12,7 +13,8 @@
|
|
|
12
13
|
"private": false,
|
|
13
14
|
"keywords": [],
|
|
14
15
|
"dependencies": {
|
|
15
|
-
"socket.io-client": "^4.6.0"
|
|
16
|
+
"socket.io-client": "^4.6.0",
|
|
17
|
+
"uuid": "^9.0.0"
|
|
16
18
|
},
|
|
17
19
|
"devDependencies": {
|
|
18
20
|
}
|
|
@@ -4,7 +4,6 @@ import { v4 } from 'uuid'
|
|
|
4
4
|
function expressxClient(socket) {
|
|
5
5
|
|
|
6
6
|
const waitingPromisesByUid = {}
|
|
7
|
-
const timersByUid = {}
|
|
8
7
|
const action2service2handlers = {}
|
|
9
8
|
let onConnectionCallback = null
|
|
10
9
|
let onDisconnectionCallback = null
|
|
@@ -26,7 +25,7 @@ function expressxClient(socket) {
|
|
|
26
25
|
// on receiving response from service request
|
|
27
26
|
socket.on('client-response', ({ uid, error, result }) => {
|
|
28
27
|
console.log('client-response', uid, error, result)
|
|
29
|
-
if (!waitingPromisesByUid[uid]) return // may not exist because
|
|
28
|
+
if (!waitingPromisesByUid[uid]) return // may not exist because a timeout removed it
|
|
30
29
|
const [resolve, reject] = waitingPromisesByUid[uid]
|
|
31
30
|
if (error) {
|
|
32
31
|
reject(error)
|