@ancon/wildcat-utils 1.50.22 → 1.50.24

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@ancon/wildcat-utils",
3
- "version": "1.50.22",
3
+ "version": "1.50.24",
4
4
  "private": false,
5
5
  "main": "index.js",
6
6
  "module": "index.mjs",
@@ -1 +1 @@
1
- "use strict";var f=Object.defineProperty;var d=(r,e,t)=>e in r?f(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var n=(r,e,t)=>(d(r,typeof e!="symbol"?e+"":e,t),t);const h=require("@microsoft/signalr"),a=require("@ancon/wildcat-types"),l=require("../shared/wait.js"),u=require("../api/generateBackoffWithEqualJitter.js");require("../number/randomIntFromInterval.js");class g{constructor(e){n(this,"internalEvents");n(this,"signalREvents");n(this,"hubConnection");n(this,"clientId");n(this,"logger");n(this,"backoff",[]);n(this,"reconnectAttempt",0);n(this,"shouldReconnect",!0);n(this,"groups");n(this,"info",(e,t)=>{var i;(i=this.logger)==null||i.info(e,t)});n(this,"generateBackoff",()=>{this.backoff=u(50,500,5e3),this.info("Generated new backoff")});n(this,"reconnect",async()=>{if(this.shouldReconnect)try{this.info("Attempting to reconnect...",{attempt:this.reconnectAttempt+1}),await this.connect(!0),this.info("Reconnected"),this.reconnectAttempt=0}catch{if(this.backoff[this.reconnectAttempt]!=null){const t=this.backoff[this.reconnectAttempt];if(t!=null)await l(t);else throw new Error("Could not resolve ms from backoff")}else{this.reconnectAttempt>0&&this.info("Ran out of backoff intervals, restarting backoff..."),this.reconnectAttempt=0,this.generateBackoff();const t=this.backoff[this.reconnectAttempt];if(t!=null)await l(t);else throw new Error("Could not resolve ms from backoff")}this.reconnectAttempt+=1,await this.reconnect()}});n(this,"buildInitialListeners",()=>{this.hubConnection.onclose(()=>{this.groups=[],this.info("Hub connection closed"),this.emitEvent("disconnected"),this.reconnect()}),this.hubConnection.onreconnected(()=>this.emitEvent("reconnected"))});n(this,"emitEvent",(e,...t)=>{if(this.internalEvents.has(e)){this.info(`Emitting event "${e}"`);const i=this.internalEvents.get(e);i&&i.forEach(s=>s(...t))}else this.info(`Failed to emit event "${e}". There were no listeners.`)});n(this,"skipSignal",(e,t)=>{this.info(`Skipped signal "${e}"`,t)});n(this,"enhanceListener",(e,t,i)=>s=>{const o=JSON.parse(s),c=i&&o.clientId&&o.clientId===this.clientId;return c||this.info(`Received signal "${e}"`,s),c?this.skipSignal(e,s):t(o)});n(this,"setClientId",e=>{this.clientId=e});n(this,"connect",async(e=!1)=>{try{this.info("Connecting..."),await this.hubConnection.start(),this.info("Connected"),this.emitEvent("connected")}catch(t){if(this.info("Failed to connect"),e)throw t}});n(this,"disconnect",async()=>{try{this.shouldReconnect=!1,this.info("Disconnecting..."),await this.hubConnection.stop(),this.info("Disconnected"),this.emitEvent("disconnected")}catch{this.info("Failed to disconnect")}});n(this,"addEventListener",(e,t)=>{this.internalEvents.has(e)||this.internalEvents.set(e,[]);const i=this.internalEvents.get(e);return i&&i.push(t),()=>this.removeEventListener(e,t)});n(this,"removeEventListener",(e,t)=>{var i;if(this.internalEvents.has(e)){const s=this.internalEvents.get(e),o=((i=s==null?void 0:s.indexOf)==null?void 0:i.call(s,t))??-1;o>=0?(s.splice(o,1),this.info(`Removed event listener for event "${e}"`)):this.info(`Failed to remove event listener for event "${e}". Specified listener was not found.`)}else this.info(`Failed to remove event listener for event "${e}". Event doesn't have any listeners.`)});n(this,"addSignalListener",(e,t,i=!0)=>{this.signalREvents.has(e)||this.signalREvents.set(e,[]);const s=this.signalREvents.get(e),o=this.enhanceListener(e,t,i);return s&&s.push(o),this.hubConnection.on(e,o),this.info(`Added signal listener for signal "${e}"`),()=>this.removeSignalListener(e,o)});n(this,"removeSignalListener",(e,t)=>{var i;if(this.signalREvents.has(e)){const s=this.signalREvents.get(e),o=((i=s==null?void 0:s.indexOf)==null?void 0:i.call(s,t))??-1;o>=0?(this.hubConnection.off(e,t),s.splice(o,1),this.info(`Removed signal listener for signal "${e}"`)):this.info(`Failed to remove signal listener for signal "${e}". Specified listener was not found.`)}else this.info(`Failed to remove signal listener for signal "${e}". Signal doesn't have any listeners.`)});n(this,"joinGroup",async e=>{this.info(`Joining group "${e}"...`);const t=this.groups.push(e)-1;try{await this.hubConnection.invoke(a.SignalRMethodName.JoinGroup,e),this.info(`Joined group "${e}"`)}catch(i){this.info(`Failed to join group "${e}"`,i),t>=0&&this.groups.splice(t,1)}});n(this,"leaveGroup",async e=>{this.info(`Leaving group "${e}"...`);const t=this.groups.indexOf(e);t>=0&&this.groups.splice(t,1);try{await this.hubConnection.invoke(a.SignalRMethodName.LeaveGroup,e),this.info(`Left group "${e}"`)}catch(i){this.groups.indexOf(e)<0&&this.groups.push(e),this.info(`Failed to leave group "${e}"`,i)}});n(this,"leaveAllGroups",async()=>{this.info(`Leaving all (${this.groups.length}) groups...`);const e=[...this.groups].map(t=>this.leaveGroup(t));await Promise.all(e),this.info("Left all groups")});n(this,"getHubConnectionId",()=>this.hubConnection.connectionId);this.internalEvents=new Map,this.signalREvents=new Map,this.groups=[],e.enableLogging&&(this.logger=e.logger),this.hubConnection=new h.HubConnectionBuilder().withUrl(`${e.signalRApiUrl}/${e.hub}`).configureLogging(h.LogLevel.None).build(),this.buildInitialListeners()}}module.exports=g;
1
+ "use strict";var f=Object.defineProperty;var d=(r,e,t)=>e in r?f(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var n=(r,e,t)=>(d(r,typeof e!="symbol"?e+"":e,t),t);const h=require("@microsoft/signalr"),a=require("@ancon/wildcat-types"),l=require("../shared/wait.js"),u=require("../api/generateBackoffWithEqualJitter.js");require("../number/randomIntFromInterval.js");class g{constructor(e){n(this,"internalEvents");n(this,"signalREvents");n(this,"hubConnection");n(this,"clientId");n(this,"logger");n(this,"backoff",[]);n(this,"reconnectAttempt",0);n(this,"shouldReconnect",!0);n(this,"groups");n(this,"info",(e,t)=>{var i;(i=this.logger)==null||i.info(e,t)});n(this,"generateBackoff",()=>{this.backoff=u(50,500,5e3),this.info("Generated new backoff")});n(this,"reconnect",async()=>{if(this.shouldReconnect)try{this.info("Attempting to reconnect...",{attempt:this.reconnectAttempt+1}),await this.connect(!0),this.info("Reconnected"),this.reconnectAttempt=0}catch{if(this.backoff[this.reconnectAttempt]!=null){const t=this.backoff[this.reconnectAttempt];if(t!=null)await l(t);else throw new Error("Could not resolve ms from backoff")}else{this.reconnectAttempt>0&&this.info("Ran out of backoff intervals, restarting backoff..."),this.reconnectAttempt=0,this.generateBackoff();const t=this.backoff[this.reconnectAttempt];if(t!=null)await l(t);else throw new Error("Could not resolve ms from backoff")}this.reconnectAttempt+=1,await this.reconnect()}});n(this,"buildInitialListeners",()=>{this.hubConnection.onclose(()=>{this.groups=[],this.info("Hub connection closed"),this.emitEvent("disconnected"),this.reconnect()}),this.hubConnection.onreconnected(()=>this.emitEvent("reconnected"))});n(this,"emitEvent",(e,...t)=>{if(this.internalEvents.has(e)){this.info(`Emitting event "${e}"`);const i=this.internalEvents.get(e);i&&i.forEach(s=>s(...t))}else this.info(`Failed to emit event "${e}". There were no listeners.`)});n(this,"skipSignal",(e,t)=>{this.info(`Skipped signal "${e}"`,t)});n(this,"enhanceListener",(e,t,i)=>s=>{const o=JSON.parse(s),c=i&&o.clientId&&o.clientId===this.clientId;return c||this.info(`Received signal "${e}"`,s),c?this.skipSignal(e,s):t(o)});n(this,"setClientId",e=>{this.clientId=e});n(this,"connect",async(e=!1)=>{try{this.info("Connecting..."),await this.hubConnection.start(),this.info("Connected"),this.emitEvent("connected")}catch(t){if(this.info("Failed to connect"),e)throw t}});n(this,"disconnect",async()=>{try{this.shouldReconnect=!1,this.info("Disconnecting..."),await this.hubConnection.stop(),this.info("Disconnected"),this.emitEvent("disconnected")}catch{this.info("Failed to disconnect")}});n(this,"addEventListener",(e,t)=>{this.internalEvents.has(e)||this.internalEvents.set(e,[]);const i=this.internalEvents.get(e);return i&&i.push(t),()=>this.removeEventListener(e,t)});n(this,"removeEventListener",(e,t)=>{var i;if(this.internalEvents.has(e)){const s=this.internalEvents.get(e),o=((i=s==null?void 0:s.indexOf)==null?void 0:i.call(s,t))??-1;o>=0?(s.splice(o,1),this.info(`Removed event listener for event "${e}"`)):this.info(`Failed to remove event listener for event "${e}". Specified listener was not found.`)}else this.info(`Failed to remove event listener for event "${e}". Event doesn't have any listeners.`)});n(this,"addSignalListener",(e,t,i=!0)=>{this.signalREvents.has(e)||this.signalREvents.set(e,[]);const s=this.signalREvents.get(e),o=this.enhanceListener(e,t,i);return s&&s.push(o),this.hubConnection.on(e,o),this.info(`Added signal listener for signal "${e}"`),()=>this.removeSignalListener(e,o)});n(this,"removeSignalListener",(e,t)=>{var i;if(this.signalREvents.has(e)){const s=this.signalREvents.get(e),o=((i=s==null?void 0:s.indexOf)==null?void 0:i.call(s,t))??-1;o>=0?(this.hubConnection.off(e,t),s.splice(o,1),this.info(`Removed signal listener for signal "${e}"`)):this.info(`Failed to remove signal listener for signal "${e}". Specified listener was not found.`)}else this.info(`Failed to remove signal listener for signal "${e}". Signal doesn't have any listeners.`)});n(this,"joinGroup",async e=>{this.info(`Joining group "${e}"...`);const t=this.groups.push(e)-1;try{await this.hubConnection.invoke(a.SignalRMethodName.JoinGroup,e),this.info(`Joined group "${e}"`)}catch(i){this.info(`Failed to join group "${e}"`,i),t>=0&&this.groups.splice(t,1)}});n(this,"leaveGroup",async e=>{this.info(`Leaving group "${e}"...`);const t=this.groups.indexOf(e);t>=0&&this.groups.splice(t,1);try{await this.hubConnection.invoke(a.SignalRMethodName.LeaveGroup,e),this.info(`Left group "${e}"`)}catch(i){this.groups.indexOf(e)<0&&this.groups.push(e),this.info(`Failed to leave group "${e}"`,i)}});n(this,"leaveAllGroups",async()=>{this.info(`Leaving all (${this.groups.length}) groups...`);const e=[...this.groups].map(t=>this.leaveGroup(t));await Promise.all(e),this.info("Left all groups")});n(this,"getHubConnectionId",()=>this.hubConnection.connectionId);this.internalEvents=new Map,this.signalREvents=new Map,this.groups=[],e.enableLogging&&(this.logger=e.logger),this.hubConnection=new h.HubConnectionBuilder().withUrl(`${e.signalRApiUrl}/${e.hub}`).configureLogging(h.LogLevel.None).build(),e.serverTimeoutInMilliseconds&&(this.hubConnection.serverTimeoutInMilliseconds=e.serverTimeoutInMilliseconds),this.buildInitialListeners()}}module.exports=g;
@@ -1,13 +1,13 @@
1
1
  var f = Object.defineProperty;
2
- var l = (r, t, e) => t in r ? f(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
- var n = (r, t, e) => (l(r, typeof t != "symbol" ? t + "" : t, e), e);
2
+ var l = (r, e, t) => e in r ? f(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var n = (r, e, t) => (l(r, typeof e != "symbol" ? e + "" : e, t), t);
4
4
  import { HubConnectionBuilder as d, LogLevel as u } from "@microsoft/signalr";
5
5
  import { SignalRMethodName as h } from "@ancon/wildcat-types";
6
6
  import a from "../shared/wait.mjs";
7
7
  import g from "../api/generateBackoffWithEqualJitter.mjs";
8
8
  import "../number/randomIntFromInterval.mjs";
9
9
  class L {
10
- constructor(t) {
10
+ constructor(e) {
11
11
  n(this, "internalEvents");
12
12
  n(this, "signalREvents");
13
13
  n(this, "hubConnection");
@@ -17,9 +17,9 @@ class L {
17
17
  n(this, "reconnectAttempt", 0);
18
18
  n(this, "shouldReconnect", !0);
19
19
  n(this, "groups");
20
- n(this, "info", (t, e) => {
20
+ n(this, "info", (e, t) => {
21
21
  var i;
22
- (i = this.logger) == null || i.info(t, e);
22
+ (i = this.logger) == null || i.info(e, t);
23
23
  });
24
24
  n(this, "generateBackoff", () => {
25
25
  this.backoff = g(50, 500, 5e3), this.info("Generated new backoff");
@@ -32,16 +32,16 @@ class L {
32
32
  }), await this.connect(!0), this.info("Reconnected"), this.reconnectAttempt = 0;
33
33
  } catch {
34
34
  if (this.backoff[this.reconnectAttempt] != null) {
35
- const e = this.backoff[this.reconnectAttempt];
36
- if (e != null)
37
- await a(e);
35
+ const t = this.backoff[this.reconnectAttempt];
36
+ if (t != null)
37
+ await a(t);
38
38
  else
39
39
  throw new Error("Could not resolve ms from backoff");
40
40
  } else {
41
41
  this.reconnectAttempt > 0 && this.info("Ran out of backoff intervals, restarting backoff..."), this.reconnectAttempt = 0, this.generateBackoff();
42
- const e = this.backoff[this.reconnectAttempt];
43
- if (e != null)
44
- await a(e);
42
+ const t = this.backoff[this.reconnectAttempt];
43
+ if (t != null)
44
+ await a(t);
45
45
  else
46
46
  throw new Error("Could not resolve ms from backoff");
47
47
  }
@@ -58,30 +58,30 @@ class L {
58
58
  * @param event Event to emit
59
59
  * @param args Arguments to send to the listeners
60
60
  */
61
- n(this, "emitEvent", (t, ...e) => {
62
- if (this.internalEvents.has(t)) {
63
- this.info(`Emitting event "${t}"`);
64
- const i = this.internalEvents.get(t);
65
- i && i.forEach((s) => s(...e));
61
+ n(this, "emitEvent", (e, ...t) => {
62
+ if (this.internalEvents.has(e)) {
63
+ this.info(`Emitting event "${e}"`);
64
+ const i = this.internalEvents.get(e);
65
+ i && i.forEach((s) => s(...t));
66
66
  } else
67
- this.info(`Failed to emit event "${t}". There were no listeners.`);
67
+ this.info(`Failed to emit event "${e}". There were no listeners.`);
68
68
  });
69
- n(this, "skipSignal", (t, e) => {
70
- this.info(`Skipped signal "${t}"`, e);
69
+ n(this, "skipSignal", (e, t) => {
70
+ this.info(`Skipped signal "${e}"`, t);
71
71
  });
72
- n(this, "enhanceListener", (t, e, i) => (s) => {
72
+ n(this, "enhanceListener", (e, t, i) => (s) => {
73
73
  const o = JSON.parse(s), c = i && o.clientId && o.clientId === this.clientId;
74
- return c || this.info(`Received signal "${t}"`, s), c ? this.skipSignal(t, s) : e(o);
74
+ return c || this.info(`Received signal "${e}"`, s), c ? this.skipSignal(e, s) : t(o);
75
75
  });
76
- n(this, "setClientId", (t) => {
77
- this.clientId = t;
76
+ n(this, "setClientId", (e) => {
77
+ this.clientId = e;
78
78
  });
79
- n(this, "connect", async (t = !1) => {
79
+ n(this, "connect", async (e = !1) => {
80
80
  try {
81
81
  this.info("Connecting..."), await this.hubConnection.start(), this.info("Connected"), this.emitEvent("connected");
82
- } catch (e) {
83
- if (this.info("Failed to connect"), t)
84
- throw e;
82
+ } catch (t) {
83
+ if (this.info("Failed to connect"), e)
84
+ throw t;
85
85
  }
86
86
  });
87
87
  n(this, "disconnect", async () => {
@@ -96,26 +96,26 @@ class L {
96
96
  * @param event Event to listen on
97
97
  * @param listener Event listener function
98
98
  */
99
- n(this, "addEventListener", (t, e) => {
100
- this.internalEvents.has(t) || this.internalEvents.set(t, []);
101
- const i = this.internalEvents.get(t);
102
- return i && i.push(e), () => this.removeEventListener(t, e);
99
+ n(this, "addEventListener", (e, t) => {
100
+ this.internalEvents.has(e) || this.internalEvents.set(e, []);
101
+ const i = this.internalEvents.get(e);
102
+ return i && i.push(t), () => this.removeEventListener(e, t);
103
103
  });
104
104
  /**
105
105
  * Remove internal event listener
106
106
  * @param event Event to stop listening to
107
107
  * @param listener Event listener function
108
108
  */
109
- n(this, "removeEventListener", (t, e) => {
109
+ n(this, "removeEventListener", (e, t) => {
110
110
  var i;
111
- if (this.internalEvents.has(t)) {
112
- const s = this.internalEvents.get(t), o = ((i = s == null ? void 0 : s.indexOf) == null ? void 0 : i.call(s, e)) ?? -1;
113
- o >= 0 ? (s.splice(o, 1), this.info(`Removed event listener for event "${t}"`)) : this.info(
114
- `Failed to remove event listener for event "${t}". Specified listener was not found.`
111
+ if (this.internalEvents.has(e)) {
112
+ const s = this.internalEvents.get(e), o = ((i = s == null ? void 0 : s.indexOf) == null ? void 0 : i.call(s, t)) ?? -1;
113
+ o >= 0 ? (s.splice(o, 1), this.info(`Removed event listener for event "${e}"`)) : this.info(
114
+ `Failed to remove event listener for event "${e}". Specified listener was not found.`
115
115
  );
116
116
  } else
117
117
  this.info(
118
- `Failed to remove event listener for event "${t}". Event doesn't have any listeners.`
118
+ `Failed to remove event listener for event "${e}". Event doesn't have any listeners.`
119
119
  );
120
120
  });
121
121
  /**
@@ -123,58 +123,58 @@ class L {
123
123
  * @param signal Signal name
124
124
  * @param listener Signal listener function
125
125
  */
126
- n(this, "addSignalListener", (t, e, i = !0) => {
127
- this.signalREvents.has(t) || this.signalREvents.set(t, []);
128
- const s = this.signalREvents.get(t), o = this.enhanceListener(
129
- t,
126
+ n(this, "addSignalListener", (e, t, i = !0) => {
127
+ this.signalREvents.has(e) || this.signalREvents.set(e, []);
128
+ const s = this.signalREvents.get(e), o = this.enhanceListener(
130
129
  e,
130
+ t,
131
131
  i
132
132
  );
133
- return s && s.push(o), this.hubConnection.on(t, o), this.info(`Added signal listener for signal "${t}"`), () => this.removeSignalListener(t, o);
133
+ return s && s.push(o), this.hubConnection.on(e, o), this.info(`Added signal listener for signal "${e}"`), () => this.removeSignalListener(e, o);
134
134
  });
135
135
  /**
136
136
  * Remove signal listener
137
137
  * @param signal Signal name
138
138
  * @param listener Signal listener function
139
139
  */
140
- n(this, "removeSignalListener", (t, e) => {
140
+ n(this, "removeSignalListener", (e, t) => {
141
141
  var i;
142
- if (this.signalREvents.has(t)) {
143
- const s = this.signalREvents.get(t), o = ((i = s == null ? void 0 : s.indexOf) == null ? void 0 : i.call(s, e)) ?? -1;
144
- o >= 0 ? (this.hubConnection.off(t, e), s.splice(o, 1), this.info(`Removed signal listener for signal "${t}"`)) : this.info(
145
- `Failed to remove signal listener for signal "${t}". Specified listener was not found.`
142
+ if (this.signalREvents.has(e)) {
143
+ const s = this.signalREvents.get(e), o = ((i = s == null ? void 0 : s.indexOf) == null ? void 0 : i.call(s, t)) ?? -1;
144
+ o >= 0 ? (this.hubConnection.off(e, t), s.splice(o, 1), this.info(`Removed signal listener for signal "${e}"`)) : this.info(
145
+ `Failed to remove signal listener for signal "${e}". Specified listener was not found.`
146
146
  );
147
147
  } else
148
148
  this.info(
149
- `Failed to remove signal listener for signal "${t}". Signal doesn't have any listeners.`
149
+ `Failed to remove signal listener for signal "${e}". Signal doesn't have any listeners.`
150
150
  );
151
151
  });
152
- n(this, "joinGroup", async (t) => {
153
- this.info(`Joining group "${t}"...`);
154
- const e = this.groups.push(t) - 1;
152
+ n(this, "joinGroup", async (e) => {
153
+ this.info(`Joining group "${e}"...`);
154
+ const t = this.groups.push(e) - 1;
155
155
  try {
156
- await this.hubConnection.invoke(h.JoinGroup, t), this.info(`Joined group "${t}"`);
156
+ await this.hubConnection.invoke(h.JoinGroup, e), this.info(`Joined group "${e}"`);
157
157
  } catch (i) {
158
- this.info(`Failed to join group "${t}"`, i), e >= 0 && this.groups.splice(e, 1);
158
+ this.info(`Failed to join group "${e}"`, i), t >= 0 && this.groups.splice(t, 1);
159
159
  }
160
160
  });
161
- n(this, "leaveGroup", async (t) => {
162
- this.info(`Leaving group "${t}"...`);
163
- const e = this.groups.indexOf(t);
164
- e >= 0 && this.groups.splice(e, 1);
161
+ n(this, "leaveGroup", async (e) => {
162
+ this.info(`Leaving group "${e}"...`);
163
+ const t = this.groups.indexOf(e);
164
+ t >= 0 && this.groups.splice(t, 1);
165
165
  try {
166
- await this.hubConnection.invoke(h.LeaveGroup, t), this.info(`Left group "${t}"`);
166
+ await this.hubConnection.invoke(h.LeaveGroup, e), this.info(`Left group "${e}"`);
167
167
  } catch (i) {
168
- this.groups.indexOf(t) < 0 && this.groups.push(t), this.info(`Failed to leave group "${t}"`, i);
168
+ this.groups.indexOf(e) < 0 && this.groups.push(e), this.info(`Failed to leave group "${e}"`, i);
169
169
  }
170
170
  });
171
171
  n(this, "leaveAllGroups", async () => {
172
172
  this.info(`Leaving all (${this.groups.length}) groups...`);
173
- const t = [...this.groups].map((e) => this.leaveGroup(e));
174
- await Promise.all(t), this.info("Left all groups");
173
+ const e = [...this.groups].map((t) => this.leaveGroup(t));
174
+ await Promise.all(e), this.info("Left all groups");
175
175
  });
176
176
  n(this, "getHubConnectionId", () => this.hubConnection.connectionId);
177
- this.internalEvents = /* @__PURE__ */ new Map(), this.signalREvents = /* @__PURE__ */ new Map(), this.groups = [], t.enableLogging && (this.logger = t.logger), this.hubConnection = new d().withUrl(`${t.signalRApiUrl}/${t.hub}`).configureLogging(u.None).build(), this.buildInitialListeners();
177
+ this.internalEvents = /* @__PURE__ */ new Map(), this.signalREvents = /* @__PURE__ */ new Map(), this.groups = [], e.enableLogging && (this.logger = e.logger), this.hubConnection = new d().withUrl(`${e.signalRApiUrl}/${e.hub}`).configureLogging(u.None).build(), e.serverTimeoutInMilliseconds && (this.hubConnection.serverTimeoutInMilliseconds = e.serverTimeoutInMilliseconds), this.buildInitialListeners();
178
178
  }
179
179
  }
180
180
  export {
@@ -10,5 +10,7 @@ export declare type SignalRConfig = {
10
10
  logger?: Logger;
11
11
  /** @default false */
12
12
  enableLogging?: boolean;
13
+ /** @default 30000 */
14
+ serverTimeoutInMilliseconds?: number;
13
15
  };
14
16
  export declare type SignalRHookConfig = Omit<SignalRConfig, 'hub'>;