@contello/sdk-client 8.14.0 → 8.15.0-next.1752677404

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/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
- function k(e) {
1
+ function P(e) {
2
2
  return e === null ? "null" : Array.isArray(e) ? "array" : typeof e;
3
3
  }
4
- function I(e) {
5
- return k(e) === "object";
4
+ function R(e) {
5
+ return P(e) === "object";
6
6
  }
7
- function he(e) {
7
+ function be(e) {
8
8
  return Array.isArray(e) && // must be at least one error
9
9
  e.length > 0 && // error has at least a message
10
10
  e.every((t) => "message" in t);
@@ -12,18 +12,18 @@ function he(e) {
12
12
  function re(e, t) {
13
13
  return e.length < 124 ? e : t;
14
14
  }
15
- const be = "graphql-transport-ws";
16
- var v = /* @__PURE__ */ ((e) => (e[e.InternalServerError = 4500] = "InternalServerError", e[e.InternalClientError = 4005] = "InternalClientError", e[e.BadRequest = 4400] = "BadRequest", e[e.BadResponse = 4004] = "BadResponse", e[e.Unauthorized = 4401] = "Unauthorized", e[e.Forbidden = 4403] = "Forbidden", e[e.SubprotocolNotAcceptable = 4406] = "SubprotocolNotAcceptable", e[e.ConnectionInitialisationTimeout = 4408] = "ConnectionInitialisationTimeout", e[e.ConnectionAcknowledgementTimeout = 4504] = "ConnectionAcknowledgementTimeout", e[e.SubscriberAlreadyExists = 4409] = "SubscriberAlreadyExists", e[e.TooManyInitialisationRequests = 4429] = "TooManyInitialisationRequests", e))(v || {}), _ = /* @__PURE__ */ ((e) => (e.ConnectionInit = "connection_init", e.ConnectionAck = "connection_ack", e.Ping = "ping", e.Pong = "pong", e.Subscribe = "subscribe", e.Next = "next", e.Error = "error", e.Complete = "complete", e))(_ || {});
15
+ const me = "graphql-transport-ws";
16
+ var _ = /* @__PURE__ */ ((e) => (e[e.InternalServerError = 4500] = "InternalServerError", e[e.InternalClientError = 4005] = "InternalClientError", e[e.BadRequest = 4400] = "BadRequest", e[e.BadResponse = 4004] = "BadResponse", e[e.Unauthorized = 4401] = "Unauthorized", e[e.Forbidden = 4403] = "Forbidden", e[e.SubprotocolNotAcceptable = 4406] = "SubprotocolNotAcceptable", e[e.ConnectionInitialisationTimeout = 4408] = "ConnectionInitialisationTimeout", e[e.ConnectionAcknowledgementTimeout = 4504] = "ConnectionAcknowledgementTimeout", e[e.SubscriberAlreadyExists = 4409] = "SubscriberAlreadyExists", e[e.TooManyInitialisationRequests = 4429] = "TooManyInitialisationRequests", e))(_ || {}), O = /* @__PURE__ */ ((e) => (e.ConnectionInit = "connection_init", e.ConnectionAck = "connection_ack", e.Ping = "ping", e.Pong = "pong", e.Subscribe = "subscribe", e.Next = "next", e.Error = "error", e.Complete = "complete", e))(O || {});
17
17
  function ue(e) {
18
- if (!I(e))
18
+ if (!R(e))
19
19
  throw new Error(
20
- `Message is expected to be an object, but got ${k(e)}`
20
+ `Message is expected to be an object, but got ${P(e)}`
21
21
  );
22
22
  if (!e.type)
23
23
  throw new Error("Message is missing the 'type' property");
24
24
  if (typeof e.type != "string")
25
25
  throw new Error(
26
- `Message is expects the 'type' property to be a string, but got ${k(
26
+ `Message is expects the 'type' property to be a string, but got ${P(
27
27
  e.type
28
28
  )}`
29
29
  );
@@ -32,7 +32,7 @@ function ue(e) {
32
32
  case "connection_ack":
33
33
  case "ping":
34
34
  case "pong": {
35
- if (e.payload != null && !I(e.payload))
35
+ if (e.payload != null && !R(e.payload))
36
36
  throw new Error(
37
37
  `"${e.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${e.payload}"`
38
38
  );
@@ -41,7 +41,7 @@ function ue(e) {
41
41
  case "subscribe": {
42
42
  if (typeof e.id != "string")
43
43
  throw new Error(
44
- `"${e.type}" message expects the 'id' property to be a string, but got ${k(
44
+ `"${e.type}" message expects the 'id' property to be a string, but got ${P(
45
45
  e.id
46
46
  )}`
47
47
  );
@@ -49,33 +49,33 @@ function ue(e) {
49
49
  throw new Error(
50
50
  `"${e.type}" message requires a non-empty 'id' property`
51
51
  );
52
- if (!I(e.payload))
52
+ if (!R(e.payload))
53
53
  throw new Error(
54
- `"${e.type}" message expects the 'payload' property to be an object, but got ${k(
54
+ `"${e.type}" message expects the 'payload' property to be an object, but got ${P(
55
55
  e.payload
56
56
  )}`
57
57
  );
58
58
  if (typeof e.payload.query != "string")
59
59
  throw new Error(
60
- `"${e.type}" message payload expects the 'query' property to be a string, but got ${k(
60
+ `"${e.type}" message payload expects the 'query' property to be a string, but got ${P(
61
61
  e.payload.query
62
62
  )}`
63
63
  );
64
- if (e.payload.variables != null && !I(e.payload.variables))
64
+ if (e.payload.variables != null && !R(e.payload.variables))
65
65
  throw new Error(
66
- `"${e.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${k(
66
+ `"${e.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${P(
67
67
  e.payload.variables
68
68
  )}`
69
69
  );
70
- if (e.payload.operationName != null && k(e.payload.operationName) !== "string")
70
+ if (e.payload.operationName != null && P(e.payload.operationName) !== "string")
71
71
  throw new Error(
72
- `"${e.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${k(
72
+ `"${e.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${P(
73
73
  e.payload.operationName
74
74
  )}`
75
75
  );
76
- if (e.payload.extensions != null && !I(e.payload.extensions))
76
+ if (e.payload.extensions != null && !R(e.payload.extensions))
77
77
  throw new Error(
78
- `"${e.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${k(
78
+ `"${e.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${P(
79
79
  e.payload.extensions
80
80
  )}`
81
81
  );
@@ -84,7 +84,7 @@ function ue(e) {
84
84
  case "next": {
85
85
  if (typeof e.id != "string")
86
86
  throw new Error(
87
- `"${e.type}" message expects the 'id' property to be a string, but got ${k(
87
+ `"${e.type}" message expects the 'id' property to be a string, but got ${P(
88
88
  e.id
89
89
  )}`
90
90
  );
@@ -92,9 +92,9 @@ function ue(e) {
92
92
  throw new Error(
93
93
  `"${e.type}" message requires a non-empty 'id' property`
94
94
  );
95
- if (!I(e.payload))
95
+ if (!R(e.payload))
96
96
  throw new Error(
97
- `"${e.type}" message expects the 'payload' property to be an object, but got ${k(
97
+ `"${e.type}" message expects the 'payload' property to be an object, but got ${P(
98
98
  e.payload
99
99
  )}`
100
100
  );
@@ -103,7 +103,7 @@ function ue(e) {
103
103
  case "error": {
104
104
  if (typeof e.id != "string")
105
105
  throw new Error(
106
- `"${e.type}" message expects the 'id' property to be a string, but got ${k(
106
+ `"${e.type}" message expects the 'id' property to be a string, but got ${P(
107
107
  e.id
108
108
  )}`
109
109
  );
@@ -111,7 +111,7 @@ function ue(e) {
111
111
  throw new Error(
112
112
  `"${e.type}" message requires a non-empty 'id' property`
113
113
  );
114
- if (!he(e.payload))
114
+ if (!be(e.payload))
115
115
  throw new Error(
116
116
  `"${e.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(
117
117
  e.payload
@@ -122,7 +122,7 @@ function ue(e) {
122
122
  case "complete": {
123
123
  if (typeof e.id != "string")
124
124
  throw new Error(
125
- `"${e.type}" message expects the 'id' property to be a string, but got ${k(
125
+ `"${e.type}" message expects the 'id' property to be a string, but got ${P(
126
126
  e.id
127
127
  )}`
128
128
  );
@@ -137,38 +137,38 @@ function ue(e) {
137
137
  }
138
138
  return e;
139
139
  }
140
- function me(e, t) {
140
+ function ge(e, t) {
141
141
  return ue(
142
142
  typeof e == "string" ? JSON.parse(e, t) : e
143
143
  );
144
144
  }
145
- function z(e, t) {
145
+ function F(e, t) {
146
146
  return ue(e), JSON.stringify(e, t);
147
147
  }
148
- function ge(e) {
148
+ function we(e) {
149
149
  const {
150
150
  url: t,
151
151
  connectionParams: r,
152
152
  lazy: n = !0,
153
- onNonLazyError: c = console.error,
153
+ onNonLazyError: s = console.error,
154
154
  lazyCloseTimeout: i = 0,
155
155
  keepAlive: o = 0,
156
156
  disablePong: h,
157
- connectionAckWaitTimeout: y = 0,
158
- retryAttempts: P = 5,
159
- retryWait: m = async function(f) {
160
- const s = Math.pow(2, f);
157
+ connectionAckWaitTimeout: b = 0,
158
+ retryAttempts: A = 5,
159
+ retryWait: w = async function(f) {
160
+ const c = Math.pow(2, f);
161
161
  await new Promise(
162
162
  (u) => setTimeout(
163
163
  u,
164
- s * 1e3 + // add random timeout from 300ms to 3s
164
+ c * 1e3 + // add random timeout from 300ms to 3s
165
165
  Math.floor(Math.random() * 2700 + 300)
166
166
  )
167
167
  );
168
168
  },
169
- shouldRetry: g = C,
169
+ shouldRetry: E = G,
170
170
  on: l,
171
- webSocketImpl: T,
171
+ webSocketImpl: d,
172
172
  /**
173
173
  * Generates a v4 UUID to be used as the ID using `Math`
174
174
  * as the random number generator. Supply your own generator
@@ -176,20 +176,20 @@ function ge(e) {
176
176
  *
177
177
  * Reference: https://gist.github.com/jed/982883
178
178
  */
179
- generateID: L = function() {
179
+ generateID: v = function() {
180
180
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (f) => {
181
- const s = Math.random() * 16 | 0;
182
- return (f == "x" ? s : s & 3 | 8).toString(16);
181
+ const c = Math.random() * 16 | 0;
182
+ return (f == "x" ? c : c & 3 | 8).toString(16);
183
183
  });
184
184
  },
185
- jsonMessageReplacer: S,
186
- jsonMessageReviver: de
185
+ jsonMessageReplacer: m,
186
+ jsonMessageReviver: ye
187
187
  } = e;
188
188
  let N;
189
- if (T) {
190
- if (!xe(T))
189
+ if (d) {
190
+ if (!xe(d))
191
191
  throw new Error("Invalid WebSocket implementation provided");
192
- N = T;
192
+ N = d;
193
193
  } else typeof WebSocket < "u" ? N = WebSocket : typeof global < "u" ? N = global.WebSocket || // @ts-expect-error: Support more browsers
194
194
  global.MozWebSocket : typeof window < "u" && (N = window.WebSocket || // @ts-expect-error: Support more browsers
195
195
  window.MozWebSocket);
@@ -197,17 +197,17 @@ function ge(e) {
197
197
  throw new Error(
198
198
  "WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`"
199
199
  );
200
- const R = N, w = (() => {
200
+ const q = N, x = (() => {
201
201
  const a = /* @__PURE__ */ (() => {
202
- const s = {};
202
+ const c = {};
203
203
  return {
204
- on(u, d) {
205
- return s[u] = d, () => {
206
- delete s[u];
204
+ on(u, y) {
205
+ return c[u] = y, () => {
206
+ delete c[u];
207
207
  };
208
208
  },
209
209
  emit(u) {
210
- "id" in u && s[u.id]?.(u);
210
+ "id" in u && c[u.id]?.(u);
211
211
  }
212
212
  };
213
213
  })(), f = {
@@ -222,117 +222,117 @@ function ge(e) {
222
222
  };
223
223
  return {
224
224
  onMessage: a.on,
225
- on(s, u) {
226
- const d = f[s];
227
- return d.push(u), () => {
228
- d.splice(d.indexOf(u), 1);
225
+ on(c, u) {
226
+ const y = f[c];
227
+ return y.push(u), () => {
228
+ y.splice(y.indexOf(u), 1);
229
229
  };
230
230
  },
231
- emit(s, ...u) {
232
- for (const d of [...f[s]])
233
- d(...u);
231
+ emit(c, ...u) {
232
+ for (const y of [...f[c]])
233
+ y(...u);
234
234
  }
235
235
  };
236
236
  })();
237
- function V(a) {
237
+ function H(a) {
238
238
  const f = [
239
239
  // errors are fatal and more critical than close events, throw them first
240
- w.on("error", (s) => {
241
- f.forEach((u) => u()), a(s);
240
+ x.on("error", (c) => {
241
+ f.forEach((u) => u()), a(c);
242
242
  }),
243
243
  // closes can be graceful and not fatal, throw them second (if error didnt throw)
244
- w.on("closed", (s) => {
245
- f.forEach((u) => u()), a(s);
244
+ x.on("closed", (c) => {
245
+ f.forEach((u) => u()), a(c);
246
246
  })
247
247
  ];
248
248
  }
249
- let O, $ = 0, K, M = !1, F = 0, X = !1;
249
+ let $, I = 0, K, W = !1, B = 0, X = !1;
250
250
  async function Z() {
251
251
  clearTimeout(K);
252
- const [a, f] = await (O ?? (O = new Promise(
253
- (d, E) => (async () => {
254
- if (M) {
255
- if (await m(F), !$)
256
- return O = void 0, E({ code: 1e3, reason: "All Subscriptions Gone" });
257
- F++;
252
+ const [a, f] = await ($ ?? ($ = new Promise(
253
+ (y, k) => (async () => {
254
+ if (W) {
255
+ if (await w(B), !I)
256
+ return $ = void 0, k({ code: 1e3, reason: "All Subscriptions Gone" });
257
+ B++;
258
258
  }
259
- w.emit("connecting", M);
260
- const p = new R(
259
+ x.emit("connecting", W);
260
+ const p = new q(
261
261
  typeof t == "function" ? await t() : t,
262
- be
262
+ me
263
263
  );
264
- let q, W;
265
- function B() {
266
- isFinite(o) && o > 0 && (clearTimeout(W), W = setTimeout(() => {
267
- p.readyState === R.OPEN && (p.send(z({ type: _.Ping })), w.emit("ping", !1, void 0));
264
+ let M, z;
265
+ function U() {
266
+ isFinite(o) && o > 0 && (clearTimeout(z), z = setTimeout(() => {
267
+ p.readyState === q.OPEN && (p.send(F({ type: O.Ping })), x.emit("ping", !1, void 0));
268
268
  }, o));
269
269
  }
270
- V((x) => {
271
- O = void 0, clearTimeout(q), clearTimeout(W), E(x), x instanceof ne && (p.close(4499, "Terminated"), p.onerror = null, p.onclose = null);
272
- }), p.onerror = (x) => w.emit("error", x), p.onclose = (x) => w.emit("closed", x), p.onopen = async () => {
270
+ H((S) => {
271
+ $ = void 0, clearTimeout(M), clearTimeout(z), k(S), S instanceof ne && (p.close(4499, "Terminated"), p.onerror = null, p.onclose = null);
272
+ }), p.onerror = (S) => x.emit("error", S), p.onclose = (S) => x.emit("closed", S), p.onopen = async () => {
273
273
  try {
274
- w.emit("opened", p);
275
- const x = typeof r == "function" ? await r() : r;
276
- if (p.readyState !== R.OPEN) return;
274
+ x.emit("opened", p);
275
+ const S = typeof r == "function" ? await r() : r;
276
+ if (p.readyState !== q.OPEN) return;
277
277
  p.send(
278
- z(
279
- x ? {
280
- type: _.ConnectionInit,
281
- payload: x
278
+ F(
279
+ S ? {
280
+ type: O.ConnectionInit,
281
+ payload: S
282
282
  } : {
283
- type: _.ConnectionInit
283
+ type: O.ConnectionInit
284
284
  // payload is completely absent if not provided
285
285
  },
286
- S
286
+ m
287
287
  )
288
- ), isFinite(y) && y > 0 && (q = setTimeout(() => {
288
+ ), isFinite(b) && b > 0 && (M = setTimeout(() => {
289
289
  p.close(
290
- v.ConnectionAcknowledgementTimeout,
290
+ _.ConnectionAcknowledgementTimeout,
291
291
  "Connection acknowledgement timeout"
292
292
  );
293
- }, y)), B();
294
- } catch (x) {
295
- w.emit("error", x), p.close(
296
- v.InternalClientError,
293
+ }, b)), U();
294
+ } catch (S) {
295
+ x.emit("error", S), p.close(
296
+ _.InternalClientError,
297
297
  re(
298
- x instanceof Error ? x.message : String(x),
298
+ S instanceof Error ? S.message : String(S),
299
299
  "Internal client error"
300
300
  )
301
301
  );
302
302
  }
303
303
  };
304
304
  let j = !1;
305
- p.onmessage = ({ data: x }) => {
305
+ p.onmessage = ({ data: S }) => {
306
306
  try {
307
- const b = me(x, de);
308
- if (w.emit("message", b), b.type === "ping" || b.type === "pong") {
309
- w.emit(b.type, !0, b.payload), b.type === "pong" ? B() : h || (p.send(
310
- z(
311
- b.payload ? {
312
- type: _.Pong,
313
- payload: b.payload
307
+ const g = ge(S, ye);
308
+ if (x.emit("message", g), g.type === "ping" || g.type === "pong") {
309
+ x.emit(g.type, !0, g.payload), g.type === "pong" ? U() : h || (p.send(
310
+ F(
311
+ g.payload ? {
312
+ type: O.Pong,
313
+ payload: g.payload
314
314
  } : {
315
- type: _.Pong
315
+ type: O.Pong
316
316
  // payload is completely absent if not provided
317
317
  }
318
318
  )
319
- ), w.emit("pong", !1, b.payload));
319
+ ), x.emit("pong", !1, g.payload));
320
320
  return;
321
321
  }
322
322
  if (j) return;
323
- if (b.type !== _.ConnectionAck)
323
+ if (g.type !== O.ConnectionAck)
324
324
  throw new Error(
325
- `First message cannot be of type ${b.type}`
325
+ `First message cannot be of type ${g.type}`
326
326
  );
327
- clearTimeout(q), j = !0, w.emit("connected", p, b.payload, M), M = !1, F = 0, d([
327
+ clearTimeout(M), j = !0, x.emit("connected", p, g.payload, W), W = !1, B = 0, y([
328
328
  p,
329
- new Promise((We, ye) => V(ye))
329
+ new Promise((Fe, he) => H(he))
330
330
  ]);
331
- } catch (b) {
332
- p.onmessage = null, w.emit("error", b), p.close(
333
- v.BadResponse,
331
+ } catch (g) {
332
+ p.onmessage = null, x.emit("error", g), p.close(
333
+ _.BadResponse,
334
334
  re(
335
- b instanceof Error ? b.message : String(b),
335
+ g instanceof Error ? g.message : String(g),
336
336
  "Bad response"
337
337
  )
338
338
  );
@@ -340,21 +340,21 @@ function ge(e) {
340
340
  };
341
341
  })()
342
342
  )));
343
- a.readyState === R.CLOSING && await f;
344
- let s = () => {
343
+ a.readyState === q.CLOSING && await f;
344
+ let c = () => {
345
345
  };
346
- const u = new Promise((d) => s = d);
346
+ const u = new Promise((y) => c = y);
347
347
  return [
348
348
  a,
349
- s,
349
+ c,
350
350
  Promise.race([
351
351
  // wait for
352
352
  u.then(() => {
353
- if (!$) {
354
- const d = () => a.close(1e3, "Normal Closure");
353
+ if (!I) {
354
+ const y = () => a.close(1e3, "Normal Closure");
355
355
  isFinite(i) && i > 0 ? K = setTimeout(() => {
356
- a.readyState === R.OPEN && d();
357
- }, i) : d();
356
+ a.readyState === q.OPEN && y();
357
+ }, i) : y();
358
358
  }
359
359
  }),
360
360
  // or
@@ -363,29 +363,29 @@ function ge(e) {
363
363
  ];
364
364
  }
365
365
  function ee(a) {
366
- if (C(a) && (we(a.code) || [
367
- v.InternalServerError,
368
- v.InternalClientError,
369
- v.BadRequest,
370
- v.BadResponse,
371
- v.Unauthorized,
366
+ if (G(a) && (Ee(a.code) || [
367
+ _.InternalServerError,
368
+ _.InternalClientError,
369
+ _.BadRequest,
370
+ _.BadResponse,
371
+ _.Unauthorized,
372
372
  // CloseCode.Forbidden, might grant access out after retry
373
- v.SubprotocolNotAcceptable,
373
+ _.SubprotocolNotAcceptable,
374
374
  // CloseCode.ConnectionInitialisationTimeout, might not time out after retry
375
375
  // CloseCode.ConnectionAcknowledgementTimeout, might not time out after retry
376
- v.SubscriberAlreadyExists,
377
- v.TooManyInitialisationRequests
376
+ _.SubscriberAlreadyExists,
377
+ _.TooManyInitialisationRequests
378
378
  // 4499, // Terminated, probably because the socket froze, we want to retry
379
379
  ].includes(a.code)))
380
380
  throw a;
381
381
  if (X) return !1;
382
- if (C(a) && a.code === 1e3)
383
- return $ > 0;
384
- if (!P || F >= P || !g(a)) throw a;
385
- return M = !0;
382
+ if (G(a) && a.code === 1e3)
383
+ return I > 0;
384
+ if (!A || B >= A || !E(a)) throw a;
385
+ return W = !0;
386
386
  }
387
387
  n || (async () => {
388
- for ($++; ; )
388
+ for (I++; ; )
389
389
  try {
390
390
  const [, , a] = await Z();
391
391
  await a;
@@ -393,107 +393,107 @@ function ge(e) {
393
393
  try {
394
394
  if (!ee(a)) return;
395
395
  } catch (f) {
396
- return c?.(f);
396
+ return s?.(f);
397
397
  }
398
398
  }
399
399
  })();
400
400
  function te(a, f) {
401
- const s = L(a);
402
- let u = !1, d = !1, E = () => {
403
- $--, u = !0;
401
+ const c = v(a);
402
+ let u = !1, y = !1, k = () => {
403
+ I--, u = !0;
404
404
  };
405
405
  return (async () => {
406
- for ($++; ; )
406
+ for (I++; ; )
407
407
  try {
408
- const [p, q, W] = await Z();
409
- if (u) return q();
410
- const B = w.onMessage(s, (j) => {
408
+ const [p, M, z] = await Z();
409
+ if (u) return M();
410
+ const U = x.onMessage(c, (j) => {
411
411
  switch (j.type) {
412
- case _.Next: {
412
+ case O.Next: {
413
413
  f.next(j.payload);
414
414
  return;
415
415
  }
416
- case _.Error: {
417
- d = !0, u = !0, f.error(j.payload), E();
416
+ case O.Error: {
417
+ y = !0, u = !0, f.error(j.payload), k();
418
418
  return;
419
419
  }
420
- case _.Complete: {
421
- u = !0, E();
420
+ case O.Complete: {
421
+ u = !0, k();
422
422
  return;
423
423
  }
424
424
  }
425
425
  });
426
426
  p.send(
427
- z(
427
+ F(
428
428
  {
429
- id: s,
430
- type: _.Subscribe,
429
+ id: c,
430
+ type: O.Subscribe,
431
431
  payload: a
432
432
  },
433
- S
433
+ m
434
434
  )
435
- ), E = () => {
436
- !u && p.readyState === R.OPEN && p.send(
437
- z(
435
+ ), k = () => {
436
+ !u && p.readyState === q.OPEN && p.send(
437
+ F(
438
438
  {
439
- id: s,
440
- type: _.Complete
439
+ id: c,
440
+ type: O.Complete
441
441
  },
442
- S
442
+ m
443
443
  )
444
- ), $--, u = !0, q();
445
- }, await W.finally(B);
444
+ ), I--, u = !0, M();
445
+ }, await z.finally(U);
446
446
  return;
447
447
  } catch (p) {
448
448
  if (!ee(p)) return;
449
449
  }
450
450
  })().then(() => {
451
- d || f.complete();
451
+ y || f.complete();
452
452
  }).catch((p) => {
453
453
  f.error(p);
454
454
  }), () => {
455
- u || E();
455
+ u || k();
456
456
  };
457
457
  }
458
458
  return {
459
- on: w.on,
459
+ on: x.on,
460
460
  subscribe: te,
461
461
  iterate(a) {
462
- const f = [], s = {
462
+ const f = [], c = {
463
463
  done: !1,
464
464
  error: null,
465
465
  resolve: () => {
466
466
  }
467
467
  }, u = te(a, {
468
- next(E) {
469
- f.push(E), s.resolve();
468
+ next(k) {
469
+ f.push(k), c.resolve();
470
470
  },
471
- error(E) {
472
- s.done = !0, s.error = E, s.resolve();
471
+ error(k) {
472
+ c.done = !0, c.error = k, c.resolve();
473
473
  },
474
474
  complete() {
475
- s.done = !0, s.resolve();
475
+ c.done = !0, c.resolve();
476
476
  }
477
- }), d = async function* () {
477
+ }), y = async function* () {
478
478
  for (; ; ) {
479
- for (f.length || await new Promise((p) => s.resolve = p); f.length; )
479
+ for (f.length || await new Promise((p) => c.resolve = p); f.length; )
480
480
  yield f.shift();
481
- if (s.error)
482
- throw s.error;
483
- if (s.done)
481
+ if (c.error)
482
+ throw c.error;
483
+ if (c.done)
484
484
  return;
485
485
  }
486
486
  }();
487
- return d.throw = async (E) => (s.done || (s.done = !0, s.error = E, s.resolve()), { done: !0, value: void 0 }), d.return = async () => (u(), { done: !0, value: void 0 }), d;
487
+ return y.throw = async (k) => (c.done || (c.done = !0, c.error = k, c.resolve()), { done: !0, value: void 0 }), y.return = async () => (u(), { done: !0, value: void 0 }), y;
488
488
  },
489
489
  async dispose() {
490
- if (X = !0, O) {
491
- const [a] = await O;
490
+ if (X = !0, $) {
491
+ const [a] = await $;
492
492
  a.close(1e3, "Normal Closure");
493
493
  }
494
494
  },
495
495
  terminate() {
496
- O && w.emit("closed", new ne());
496
+ $ && x.emit("closed", new ne());
497
497
  }
498
498
  };
499
499
  }
@@ -504,10 +504,10 @@ class ne extends Error {
504
504
  reason = "Terminated";
505
505
  wasClean = !1;
506
506
  }
507
- function C(e) {
508
- return I(e) && "code" in e && "reason" in e;
507
+ function G(e) {
508
+ return R(e) && "code" in e && "reason" in e;
509
509
  }
510
- function we(e) {
510
+ function Ee(e) {
511
511
  return [
512
512
  1e3,
513
513
  // Normal Closure is not an erroneous close code
@@ -528,39 +528,17 @@ function we(e) {
528
528
  function xe(e) {
529
529
  return typeof e == "function" && "constructor" in e && "CLOSED" in e && "CLOSING" in e && "CONNECTING" in e && "OPEN" in e;
530
530
  }
531
- class Se {
532
- constructor(t, r) {
533
- this.createClient = t, this.poolSize = r;
534
- }
535
- clients = [];
536
- currentIndex = 0;
537
- connect() {
538
- for (let t = 0; t < this.poolSize; t++)
539
- this.clients.push(this.createClient(`${t + 1}`));
540
- }
541
- get() {
542
- if (this.clients.length === 0)
543
- throw new Error("Connection pool is empty. Please call connect() first.");
544
- const t = this.clients[this.currentIndex];
545
- if (this.currentIndex = (this.currentIndex + 1) % this.poolSize, !t)
546
- throw new Error("No available WebSocket client");
547
- return t;
548
- }
549
- disconnect() {
550
- this.clients.forEach((t) => t.dispose()), this.clients = [];
551
- }
552
- }
553
- var D = function(e, t) {
554
- return D = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, n) {
531
+ var J = function(e, t) {
532
+ return J = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, n) {
555
533
  r.__proto__ = n;
556
534
  } || function(r, n) {
557
- for (var c in n) Object.prototype.hasOwnProperty.call(n, c) && (r[c] = n[c]);
558
- }, D(e, t);
535
+ for (var s in n) Object.prototype.hasOwnProperty.call(n, s) && (r[s] = n[s]);
536
+ }, J(e, t);
559
537
  };
560
538
  function pe(e, t) {
561
539
  if (typeof t != "function" && t !== null)
562
540
  throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
563
- D(e, t);
541
+ J(e, t);
564
542
  function r() {
565
543
  this.constructor = e;
566
544
  }
@@ -576,42 +554,42 @@ function oe(e) {
576
554
  };
577
555
  throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
578
556
  }
579
- function J(e, t) {
557
+ function Q(e, t) {
580
558
  var r = typeof Symbol == "function" && e[Symbol.iterator];
581
559
  if (!r) return e;
582
- var n = r.call(e), c, i = [], o;
560
+ var n = r.call(e), s, i = [], o;
583
561
  try {
584
- for (; (t === void 0 || t-- > 0) && !(c = n.next()).done; ) i.push(c.value);
562
+ for (; (t === void 0 || t-- > 0) && !(s = n.next()).done; ) i.push(s.value);
585
563
  } catch (h) {
586
564
  o = { error: h };
587
565
  } finally {
588
566
  try {
589
- c && !c.done && (r = n.return) && r.call(n);
567
+ s && !s.done && (r = n.return) && r.call(n);
590
568
  } finally {
591
569
  if (o) throw o.error;
592
570
  }
593
571
  }
594
572
  return i;
595
573
  }
596
- function Q(e, t, r) {
597
- if (r || arguments.length === 2) for (var n = 0, c = t.length, i; n < c; n++)
574
+ function V(e, t, r) {
575
+ if (r || arguments.length === 2) for (var n = 0, s = t.length, i; n < s; n++)
598
576
  (i || !(n in t)) && (i || (i = Array.prototype.slice.call(t, 0, n)), i[n] = t[n]);
599
577
  return e.concat(i || Array.prototype.slice.call(t));
600
578
  }
601
- function A(e) {
579
+ function T(e) {
602
580
  return typeof e == "function";
603
581
  }
604
- function Ee(e) {
582
+ function le(e) {
605
583
  var t = function(n) {
606
584
  Error.call(n), n.stack = new Error().stack;
607
585
  }, r = e(t);
608
586
  return r.prototype = Object.create(Error.prototype), r.prototype.constructor = r, r;
609
587
  }
610
- var G = Ee(function(e) {
588
+ var D = le(function(e) {
611
589
  return function(r) {
612
590
  e(this), this.message = r ? r.length + ` errors occurred during unsubscription:
613
- ` + r.map(function(n, c) {
614
- return c + 1 + ") " + n.toString();
591
+ ` + r.map(function(n, s) {
592
+ return s + 1 + ") " + n.toString();
615
593
  }).join(`
616
594
  `) : "", this.name = "UnsubscriptionError", this.errors = r;
617
595
  };
@@ -622,64 +600,64 @@ function ie(e, t) {
622
600
  0 <= r && e.splice(r, 1);
623
601
  }
624
602
  }
625
- var H = function() {
603
+ var Y = function() {
626
604
  function e(t) {
627
605
  this.initialTeardown = t, this.closed = !1, this._parentage = null, this._finalizers = null;
628
606
  }
629
607
  return e.prototype.unsubscribe = function() {
630
- var t, r, n, c, i;
608
+ var t, r, n, s, i;
631
609
  if (!this.closed) {
632
610
  this.closed = !0;
633
611
  var o = this._parentage;
634
612
  if (o)
635
613
  if (this._parentage = null, Array.isArray(o))
636
614
  try {
637
- for (var h = oe(o), y = h.next(); !y.done; y = h.next()) {
638
- var P = y.value;
639
- P.remove(this);
615
+ for (var h = oe(o), b = h.next(); !b.done; b = h.next()) {
616
+ var A = b.value;
617
+ A.remove(this);
640
618
  }
641
- } catch (S) {
642
- t = { error: S };
619
+ } catch (m) {
620
+ t = { error: m };
643
621
  } finally {
644
622
  try {
645
- y && !y.done && (r = h.return) && r.call(h);
623
+ b && !b.done && (r = h.return) && r.call(h);
646
624
  } finally {
647
625
  if (t) throw t.error;
648
626
  }
649
627
  }
650
628
  else
651
629
  o.remove(this);
652
- var m = this.initialTeardown;
653
- if (A(m))
630
+ var w = this.initialTeardown;
631
+ if (T(w))
654
632
  try {
655
- m();
656
- } catch (S) {
657
- i = S instanceof G ? S.errors : [S];
633
+ w();
634
+ } catch (m) {
635
+ i = m instanceof D ? m.errors : [m];
658
636
  }
659
- var g = this._finalizers;
660
- if (g) {
637
+ var E = this._finalizers;
638
+ if (E) {
661
639
  this._finalizers = null;
662
640
  try {
663
- for (var l = oe(g), T = l.next(); !T.done; T = l.next()) {
664
- var L = T.value;
641
+ for (var l = oe(E), d = l.next(); !d.done; d = l.next()) {
642
+ var v = d.value;
665
643
  try {
666
- se(L);
667
- } catch (S) {
668
- i = i ?? [], S instanceof G ? i = Q(Q([], J(i)), J(S.errors)) : i.push(S);
644
+ se(v);
645
+ } catch (m) {
646
+ i = i ?? [], m instanceof D ? i = V(V([], Q(i)), Q(m.errors)) : i.push(m);
669
647
  }
670
648
  }
671
- } catch (S) {
672
- n = { error: S };
649
+ } catch (m) {
650
+ n = { error: m };
673
651
  } finally {
674
652
  try {
675
- T && !T.done && (c = l.return) && c.call(l);
653
+ d && !d.done && (s = l.return) && s.call(l);
676
654
  } finally {
677
655
  if (n) throw n.error;
678
656
  }
679
657
  }
680
658
  }
681
659
  if (i)
682
- throw new G(i);
660
+ throw new D(i);
683
661
  }
684
662
  }, e.prototype.add = function(t) {
685
663
  var r;
@@ -711,44 +689,44 @@ var H = function() {
711
689
  return t.closed = !0, t;
712
690
  }(), e;
713
691
  }();
714
- H.EMPTY;
715
- function le(e) {
716
- return e instanceof H || e && "closed" in e && A(e.remove) && A(e.add) && A(e.unsubscribe);
692
+ Y.EMPTY;
693
+ function fe(e) {
694
+ return e instanceof Y || e && "closed" in e && T(e.remove) && T(e.add) && T(e.unsubscribe);
717
695
  }
718
696
  function se(e) {
719
- A(e) ? e() : e.unsubscribe();
697
+ T(e) ? e() : e.unsubscribe();
720
698
  }
721
- var ke = {
699
+ var Se = {
722
700
  Promise: void 0
723
- }, Pe = {
701
+ }, ke = {
724
702
  setTimeout: function(e, t) {
725
703
  for (var r = [], n = 2; n < arguments.length; n++)
726
704
  r[n - 2] = arguments[n];
727
- return setTimeout.apply(void 0, Q([e, t], J(r)));
705
+ return setTimeout.apply(void 0, V([e, t], Q(r)));
728
706
  },
729
707
  clearTimeout: function(e) {
730
708
  return clearTimeout(e);
731
709
  },
732
710
  delegate: void 0
733
711
  };
734
- function ve(e) {
735
- Pe.setTimeout(function() {
712
+ function Pe(e) {
713
+ ke.setTimeout(function() {
736
714
  throw e;
737
715
  });
738
716
  }
739
717
  function ce() {
740
718
  }
741
- function _e(e) {
719
+ function ve(e) {
742
720
  e();
743
721
  }
744
- var fe = function(e) {
722
+ var de = function(e) {
745
723
  pe(t, e);
746
724
  function t(r) {
747
725
  var n = e.call(this) || this;
748
- return n.isStopped = !1, r ? (n.destination = r, le(r) && r.add(n)) : n.destination = Oe, n;
726
+ return n.isStopped = !1, r ? (n.destination = r, fe(r) && r.add(n)) : n.destination = Te, n;
749
727
  }
750
- return t.create = function(r, n, c) {
751
- return new Y(r, n, c);
728
+ return t.create = function(r, n, s) {
729
+ return new C(r, n, s);
752
730
  }, t.prototype.next = function(r) {
753
731
  this.isStopped || this._next(r);
754
732
  }, t.prototype.error = function(r) {
@@ -772,7 +750,7 @@ var fe = function(e) {
772
750
  this.unsubscribe();
773
751
  }
774
752
  }, t;
775
- }(H), Te = function() {
753
+ }(Y), _e = function() {
776
754
  function e(t) {
777
755
  this.partialObserver = t;
778
756
  }
@@ -782,7 +760,7 @@ var fe = function(e) {
782
760
  try {
783
761
  r.next(t);
784
762
  } catch (n) {
785
- U(n);
763
+ L(n);
786
764
  }
787
765
  }, e.prototype.error = function(t) {
788
766
  var r = this.partialObserver;
@@ -790,52 +768,52 @@ var fe = function(e) {
790
768
  try {
791
769
  r.error(t);
792
770
  } catch (n) {
793
- U(n);
771
+ L(n);
794
772
  }
795
773
  else
796
- U(t);
774
+ L(t);
797
775
  }, e.prototype.complete = function() {
798
776
  var t = this.partialObserver;
799
777
  if (t.complete)
800
778
  try {
801
779
  t.complete();
802
780
  } catch (r) {
803
- U(r);
781
+ L(r);
804
782
  }
805
783
  }, e;
806
- }(), Y = function(e) {
784
+ }(), C = function(e) {
807
785
  pe(t, e);
808
- function t(r, n, c) {
786
+ function t(r, n, s) {
809
787
  var i = e.call(this) || this, o;
810
- return A(r) || !r ? o = {
788
+ return T(r) || !r ? o = {
811
789
  next: r ?? void 0,
812
790
  error: n ?? void 0,
813
- complete: c ?? void 0
814
- } : o = r, i.destination = new Te(o), i;
791
+ complete: s ?? void 0
792
+ } : o = r, i.destination = new _e(o), i;
815
793
  }
816
794
  return t;
817
- }(fe);
818
- function U(e) {
819
- ve(e);
795
+ }(de);
796
+ function L(e) {
797
+ Pe(e);
820
798
  }
821
- function Ae(e) {
799
+ function Oe(e) {
822
800
  throw e;
823
801
  }
824
- var Oe = {
802
+ var Te = {
825
803
  closed: !0,
826
804
  next: ce,
827
- error: Ae,
805
+ error: Oe,
828
806
  complete: ce
829
- }, $e = function() {
807
+ }, Ae = function() {
830
808
  return typeof Symbol == "function" && Symbol.observable || "@@observable";
831
809
  }();
832
- function Ie(e) {
810
+ function $e(e) {
833
811
  return e;
834
812
  }
835
- function Ne(e) {
836
- return e.length === 0 ? Ie : e.length === 1 ? e[0] : function(r) {
837
- return e.reduce(function(n, c) {
838
- return c(n);
813
+ function Ie(e) {
814
+ return e.length === 0 ? $e : e.length === 1 ? e[0] : function(r) {
815
+ return e.reduce(function(n, s) {
816
+ return s(n);
839
817
  }, r);
840
818
  };
841
819
  }
@@ -847,10 +825,10 @@ var Re = function() {
847
825
  var r = new e();
848
826
  return r.source = this, r.operator = t, r;
849
827
  }, e.prototype.subscribe = function(t, r, n) {
850
- var c = this, i = je(t) ? t : new Y(t, r, n);
851
- return _e(function() {
852
- var o = c, h = o.operator, y = o.source;
853
- i.add(h ? h.call(i, y) : y ? c._subscribe(i) : c._trySubscribe(i));
828
+ var s = this, i = qe(t) ? t : new C(t, r, n);
829
+ return ve(function() {
830
+ var o = s, h = o.operator, b = o.source;
831
+ i.add(h ? h.call(i, b) : b ? s._subscribe(i) : s._trySubscribe(i));
854
832
  }), i;
855
833
  }, e.prototype._trySubscribe = function(t) {
856
834
  try {
@@ -860,37 +838,37 @@ var Re = function() {
860
838
  }
861
839
  }, e.prototype.forEach = function(t, r) {
862
840
  var n = this;
863
- return r = ae(r), new r(function(c, i) {
864
- var o = new Y({
841
+ return r = ae(r), new r(function(s, i) {
842
+ var o = new C({
865
843
  next: function(h) {
866
844
  try {
867
845
  t(h);
868
- } catch (y) {
869
- i(y), o.unsubscribe();
846
+ } catch (b) {
847
+ i(b), o.unsubscribe();
870
848
  }
871
849
  },
872
850
  error: i,
873
- complete: c
851
+ complete: s
874
852
  });
875
853
  n.subscribe(o);
876
854
  });
877
855
  }, e.prototype._subscribe = function(t) {
878
856
  var r;
879
857
  return (r = this.source) === null || r === void 0 ? void 0 : r.subscribe(t);
880
- }, e.prototype[$e] = function() {
858
+ }, e.prototype[Ae] = function() {
881
859
  return this;
882
860
  }, e.prototype.pipe = function() {
883
861
  for (var t = [], r = 0; r < arguments.length; r++)
884
862
  t[r] = arguments[r];
885
- return Ne(t)(this);
863
+ return Ie(t)(this);
886
864
  }, e.prototype.toPromise = function(t) {
887
865
  var r = this;
888
- return t = ae(t), new t(function(n, c) {
866
+ return t = ae(t), new t(function(n, s) {
889
867
  var i;
890
868
  r.subscribe(function(o) {
891
869
  return i = o;
892
870
  }, function(o) {
893
- return c(o);
871
+ return s(o);
894
872
  }, function() {
895
873
  return n(i);
896
874
  });
@@ -901,85 +879,131 @@ var Re = function() {
901
879
  }();
902
880
  function ae(e) {
903
881
  var t;
904
- return (t = e ?? ke.Promise) !== null && t !== void 0 ? t : Promise;
882
+ return (t = e ?? Se.Promise) !== null && t !== void 0 ? t : Promise;
883
+ }
884
+ function Ne(e) {
885
+ return e && T(e.next) && T(e.error) && T(e.complete);
905
886
  }
906
887
  function qe(e) {
907
- return e && A(e.next) && A(e.error) && A(e.complete);
888
+ return e && e instanceof de || Ne(e) && fe(e);
908
889
  }
909
- function je(e) {
910
- return e && e instanceof fe || qe(e) && le(e);
890
+ var Me = le(function(e) {
891
+ return function() {
892
+ e(this), this.name = "EmptyError", this.message = "no elements in sequence";
893
+ };
894
+ });
895
+ function je(e, t) {
896
+ return new Promise(function(r, n) {
897
+ var s = new C({
898
+ next: function(i) {
899
+ r(i), s.unsubscribe();
900
+ },
901
+ error: n,
902
+ complete: function() {
903
+ n(new Me());
904
+ }
905
+ });
906
+ e.subscribe(s);
907
+ });
911
908
  }
912
- const Me = (e, t) => t((r, n, c) => {
913
- c && console.warn("options are not supported yet");
914
- const i = r.loc?.source.body;
915
- if (!i)
909
+ class We {
910
+ constructor(t, r) {
911
+ this.createClient = t, this.poolSize = r;
912
+ }
913
+ clients = [];
914
+ currentIndex = 0;
915
+ connect() {
916
+ for (let t = 0; t < this.poolSize; t++)
917
+ this.clients.push(this.createClient(`${t + 1}`));
918
+ }
919
+ get() {
920
+ if (this.clients.length === 0)
921
+ throw new Error("Connection pool is empty. Please call connect() first.");
922
+ const t = this.clients[this.currentIndex];
923
+ if (this.currentIndex = (this.currentIndex + 1) % this.poolSize, !t)
924
+ throw new Error("No available WebSocket client");
925
+ return t;
926
+ }
927
+ disconnect() {
928
+ this.clients.forEach((t) => t.dispose()), this.clients = [];
929
+ }
930
+ }
931
+ const ze = (e, t, r) => r((n, s, i) => {
932
+ i && console.warn("options are not supported yet");
933
+ const o = n.loc?.source.body;
934
+ if (!o)
916
935
  throw new Error("No query provided");
917
- if (n && typeof n != "object")
936
+ if (s && typeof s != "object")
918
937
  throw new Error("Variables must be an object");
919
- const o = r.definitions.find((P) => P.kind === "OperationDefinition");
920
- if (!o)
938
+ const h = n.definitions.find((d) => d.kind === "OperationDefinition");
939
+ if (!h)
921
940
  throw new Error("No operation definition found");
922
- const h = o.operation, y = e();
923
- return h !== "subscription" ? new Promise((P, m) => {
924
- let g = !1;
925
- y.subscribe(
926
- { query: i, variables: n },
927
- {
928
- next: (l) => {
929
- g || (P(l), g = !0);
930
- },
931
- error: (l) => {
932
- g || (m(l), g = !0);
933
- },
934
- complete: () => {
935
- if (!g)
936
- throw new Error("Subscription completed unexpectedly");
937
- }
938
- }
939
- );
940
- }) : new Re((P) => y.subscribe({ query: i, variables: n }, P));
941
+ const b = h.operation, A = () => {
942
+ const d = e();
943
+ return new Re((v) => d.subscribe({ query: o, variables: s }, v));
944
+ }, w = {
945
+ kind: b,
946
+ operationName: h.name?.value ?? "",
947
+ query: o,
948
+ variables: s || {}
949
+ }, E = (d, v) => {
950
+ if (v >= d.length)
951
+ return A();
952
+ const m = d[v];
953
+ return m?.onRequest ? m.onRequest(w, () => E(d, v + 1)) : E(d, v + 1);
954
+ }, l = E(t, 0);
955
+ return b !== "subscription" ? je(l) : l;
941
956
  });
942
- class ze {
957
+ class Be {
943
958
  _pool;
944
959
  _sdk;
945
960
  constructor(t, r) {
946
- const { url: n, project: c, token: i, client: o, pooling: h } = r, y = `${n}/graphql/projects/${c}`.replace(/^http/i, "ws");
947
- this._pool = new Se(
948
- (P) => {
949
- const m = Object.freeze({ id: P });
950
- return ge({
951
- url: y,
961
+ const { url: n, project: s, token: i, client: o, pooling: h } = r, b = `${n}/graphql/projects/${s}`.replace(/^http/i, "ws");
962
+ this._pool = new We(
963
+ (A) => {
964
+ const w = Object.freeze({ connectionId: A, websocketUrl: b });
965
+ return we({
966
+ url: b,
952
967
  connectionParams: { authorization: `Bearer ${i}` },
953
968
  lazy: !1,
954
969
  keepAlive: 3e4,
955
970
  retryAttempts: o?.retryAttempts ?? 3,
956
971
  shouldRetry: () => !0,
957
- ...o?.onError ? { onNonLazyError: (g) => o.onError(m, g) } : {},
972
+ jsonMessageReplacer: (E, l) => {
973
+ if (!E) {
974
+ let d = l;
975
+ for (const v of r.middlewares ?? [])
976
+ v.onOutgoingMessage && (d = v.onOutgoingMessage(d));
977
+ return d;
978
+ }
979
+ return l;
980
+ },
981
+ ...o?.onError ? { onNonLazyError: (E) => o.onError(w, E) } : {},
958
982
  on: {
959
- ...o?.onError ? { error: (g) => o.onError(m, g) } : {},
960
- ...o?.onConnected ? { connected: () => o.onConnected(m) } : {},
961
- ...o?.onClosed ? { closed: () => o.onClosed(m) } : {},
962
- ...o?.onConnecting ? { connecting: () => o.onConnecting(m) } : {},
963
- ...o?.onOpened ? { opened: () => o.onOpened(m) } : {},
964
- ...o?.onMessage ? { message: (g) => o.onMessage(m, g) } : {},
965
- ...o?.onPing ? { ping: () => o.onPing(m) } : {},
966
- ...o?.onPong ? { pong: () => o.onPong(m) } : {}
983
+ ...o?.onError ? { error: (E) => o.onError(w, E) } : {},
984
+ ...o?.onConnected ? { connected: () => o.onConnected(w) } : {},
985
+ ...o?.onClosed ? { closed: () => o.onClosed(w) } : {},
986
+ ...o?.onConnecting ? { connecting: () => o.onConnecting(w) } : {},
987
+ ...o?.onOpened ? { opened: () => o.onOpened(w) } : {},
988
+ ...o?.onMessage ? { message: (E) => o.onMessage(w, E) } : {},
989
+ ...o?.onPing ? { ping: () => o.onPing(w) } : {},
990
+ ...o?.onPong ? { pong: () => o.onPong(w) } : {}
967
991
  }
968
992
  });
969
993
  },
970
994
  h?.enabled === !1 ? 1 : h?.size ?? 5
971
- ), this._sdk = { sdk: Me(() => this._pool.get(), t) };
995
+ ), this._sdk = { sdk: ze(() => this._pool.get(), r.middlewares ?? [], t) };
972
996
  }
973
997
  get sdk() {
974
998
  return this._sdk.sdk;
975
999
  }
976
- connect() {
1000
+ async connect() {
977
1001
  this._pool.connect();
978
1002
  }
979
- disconnect() {
1003
+ async disconnect() {
980
1004
  this._pool.disconnect();
981
1005
  }
982
1006
  }
983
1007
  export {
984
- ze as ContelloSdkClient
1008
+ Be as ContelloSdkClient
985
1009
  };