@digipair/skill-client-websocket 0.50.0 → 0.50.7
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/index.cjs.js +11 -5
- package/index.esm.js +16 -10
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -18,13 +18,15 @@ function _extends() {
|
|
|
18
18
|
const WS = typeof WebSocket === 'undefined' ? require('ws') : WebSocket;
|
|
19
19
|
let ClientWebSocketService = class ClientWebSocketService {
|
|
20
20
|
async send(params, _pinsSettingsList, _context) {
|
|
21
|
+
var _websocket_ws;
|
|
21
22
|
const { websocket, message } = params;
|
|
22
|
-
return websocket.send(JSON.stringify(message));
|
|
23
|
+
return (_websocket_ws = websocket.ws) == null ? void 0 : _websocket_ws.send(JSON.stringify(message));
|
|
23
24
|
}
|
|
24
25
|
async close(params, _pinsSettingsList, _context) {
|
|
26
|
+
var _websocket_ws;
|
|
25
27
|
const { websocket } = params;
|
|
26
28
|
websocket.cwssForceClose = true;
|
|
27
|
-
return websocket.close();
|
|
29
|
+
return (_websocket_ws = websocket.ws) == null ? void 0 : _websocket_ws.close();
|
|
28
30
|
}
|
|
29
31
|
async connect(params, _pinsSettingsList, context) {
|
|
30
32
|
var _context_protected;
|
|
@@ -48,19 +50,21 @@ let ClientWebSocketService = class ClientWebSocketService {
|
|
|
48
50
|
};
|
|
49
51
|
// Event onclose: Déconnexion
|
|
50
52
|
this.ws.onclose = async ()=>{
|
|
51
|
-
|
|
53
|
+
this.ws = null;
|
|
54
|
+
const reconnect = this.cwssForceClose ? false : this.reconnectWebSocket(params, _pinsSettingsList, context);
|
|
52
55
|
if (!reconnect) {
|
|
53
56
|
await engine.executePinsList(close, _extends({}, context));
|
|
54
57
|
}
|
|
55
58
|
};
|
|
56
59
|
// Event onerror: Erreur
|
|
57
60
|
this.ws.onerror = async (err)=>{
|
|
61
|
+
var _this_ws;
|
|
58
62
|
await engine.executePinsList(error, _extends({}, context, {
|
|
59
63
|
error: err
|
|
60
64
|
}));
|
|
61
|
-
this.ws.close(); // Ferme la connexion en cas d'erreur
|
|
65
|
+
(_this_ws = this.ws) == null ? void 0 : _this_ws.close(); // Ferme la connexion en cas d'erreur
|
|
62
66
|
};
|
|
63
|
-
return this
|
|
67
|
+
return this;
|
|
64
68
|
}
|
|
65
69
|
reconnectWebSocket(params, pinsSettingsList, context) {
|
|
66
70
|
if (this.retryCount >= this.maxRetries) {
|
|
@@ -75,6 +79,8 @@ let ClientWebSocketService = class ClientWebSocketService {
|
|
|
75
79
|
}
|
|
76
80
|
constructor(){
|
|
77
81
|
this.retryCount = 0;
|
|
82
|
+
this.ws = null;
|
|
83
|
+
this.cwssForceClose = false;
|
|
78
84
|
}
|
|
79
85
|
};
|
|
80
86
|
const connect = (params, pinsSettingsList, context)=>new ClientWebSocketService().connect(params, pinsSettingsList, context);
|
package/index.esm.js
CHANGED
|
@@ -23899,14 +23899,14 @@ function indent(str, spaces) {
|
|
|
23899
23899
|
var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
|
|
23900
23900
|
// match is required
|
|
23901
23901
|
if (!match) {
|
|
23902
|
-
return
|
|
23902
|
+
return nextMatch = nextMatch1, i = i1, tokens = tokens1, {
|
|
23903
23903
|
v: nextMatch1
|
|
23904
23904
|
};
|
|
23905
23905
|
}
|
|
23906
23906
|
var token = match.token, offset = match.offset;
|
|
23907
23907
|
i1 += offset;
|
|
23908
23908
|
if (token === " ") {
|
|
23909
|
-
return
|
|
23909
|
+
return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
|
|
23910
23910
|
}
|
|
23911
23911
|
tokens1 = _to_consumable_array$1(tokens1).concat([
|
|
23912
23912
|
token
|
|
@@ -23925,7 +23925,7 @@ function indent(str, spaces) {
|
|
|
23925
23925
|
if (contextKeys.some(function(el) {
|
|
23926
23926
|
return el.startsWith(name);
|
|
23927
23927
|
})) {
|
|
23928
|
-
return
|
|
23928
|
+
return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
|
|
23929
23929
|
}
|
|
23930
23930
|
if (dateTimeIdentifiers.some(function(el) {
|
|
23931
23931
|
return el === name;
|
|
@@ -23944,9 +23944,9 @@ function indent(str, spaces) {
|
|
|
23944
23944
|
if (dateTimeIdentifiers.some(function(el) {
|
|
23945
23945
|
return el.startsWith(name);
|
|
23946
23946
|
})) {
|
|
23947
|
-
return
|
|
23947
|
+
return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
|
|
23948
23948
|
}
|
|
23949
|
-
return
|
|
23949
|
+
return nextMatch = nextMatch1, i = i1, tokens = tokens1, {
|
|
23950
23950
|
v: nextMatch1
|
|
23951
23951
|
};
|
|
23952
23952
|
};
|
|
@@ -27956,13 +27956,15 @@ const preparePinsSettings = async (settings, context)=>{
|
|
|
27956
27956
|
const WS = typeof WebSocket === 'undefined' ? require('ws') : WebSocket;
|
|
27957
27957
|
let ClientWebSocketService = class ClientWebSocketService {
|
|
27958
27958
|
async send(params, _pinsSettingsList, _context) {
|
|
27959
|
+
var _websocket_ws;
|
|
27959
27960
|
const { websocket, message } = params;
|
|
27960
|
-
return websocket.send(JSON.stringify(message));
|
|
27961
|
+
return (_websocket_ws = websocket.ws) == null ? void 0 : _websocket_ws.send(JSON.stringify(message));
|
|
27961
27962
|
}
|
|
27962
27963
|
async close(params, _pinsSettingsList, _context) {
|
|
27964
|
+
var _websocket_ws;
|
|
27963
27965
|
const { websocket } = params;
|
|
27964
27966
|
websocket.cwssForceClose = true;
|
|
27965
|
-
return websocket.close();
|
|
27967
|
+
return (_websocket_ws = websocket.ws) == null ? void 0 : _websocket_ws.close();
|
|
27966
27968
|
}
|
|
27967
27969
|
async connect(params, _pinsSettingsList, context) {
|
|
27968
27970
|
var _context_protected;
|
|
@@ -27986,19 +27988,21 @@ let ClientWebSocketService = class ClientWebSocketService {
|
|
|
27986
27988
|
};
|
|
27987
27989
|
// Event onclose: Déconnexion
|
|
27988
27990
|
this.ws.onclose = async ()=>{
|
|
27989
|
-
|
|
27991
|
+
this.ws = null;
|
|
27992
|
+
const reconnect = this.cwssForceClose ? false : this.reconnectWebSocket(params, _pinsSettingsList, context);
|
|
27990
27993
|
if (!reconnect) {
|
|
27991
27994
|
await executePinsList(close, _extends({}, context));
|
|
27992
27995
|
}
|
|
27993
27996
|
};
|
|
27994
27997
|
// Event onerror: Erreur
|
|
27995
27998
|
this.ws.onerror = async (err)=>{
|
|
27999
|
+
var _this_ws;
|
|
27996
28000
|
await executePinsList(error, _extends({}, context, {
|
|
27997
28001
|
error: err
|
|
27998
28002
|
}));
|
|
27999
|
-
this.ws.close(); // Ferme la connexion en cas d'erreur
|
|
28003
|
+
(_this_ws = this.ws) == null ? void 0 : _this_ws.close(); // Ferme la connexion en cas d'erreur
|
|
28000
28004
|
};
|
|
28001
|
-
return this
|
|
28005
|
+
return this;
|
|
28002
28006
|
}
|
|
28003
28007
|
reconnectWebSocket(params, pinsSettingsList, context) {
|
|
28004
28008
|
if (this.retryCount >= this.maxRetries) {
|
|
@@ -28013,6 +28017,8 @@ let ClientWebSocketService = class ClientWebSocketService {
|
|
|
28013
28017
|
}
|
|
28014
28018
|
constructor(){
|
|
28015
28019
|
this.retryCount = 0;
|
|
28020
|
+
this.ws = null;
|
|
28021
|
+
this.cwssForceClose = false;
|
|
28016
28022
|
}
|
|
28017
28023
|
};
|
|
28018
28024
|
const connect = (params, pinsSettingsList, context)=>new ClientWebSocketService().connect(params, pinsSettingsList, context);
|