@muspellheim/shared 0.14.0 → 0.16.0
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/shared.d.ts +20 -9
- package/dist/shared.js +133 -93
- package/dist/shared.js.map +1 -1
- package/dist/shared.umd.cjs +1 -1
- package/dist/shared.umd.cjs.map +1 -1
- package/package.json +5 -5
- package/src/common/log.ts +11 -1
- package/src/domain/messages.ts +6 -1
- package/src/infrastructure/console_log.ts +144 -0
- package/src/infrastructure/mod.ts +1 -1
- package/src/infrastructure/console_stub.ts +0 -72
package/dist/shared.d.ts
CHANGED
|
@@ -125,17 +125,17 @@ export declare class ConfigurableResponses<T = unknown> {
|
|
|
125
125
|
next(): T;
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
export declare interface ConsoleMessage {
|
|
129
|
-
level: "log" | "error" | "warn" | "info" | "debug" | "trace";
|
|
130
|
-
message: unknown[];
|
|
131
|
-
}
|
|
132
|
-
|
|
133
128
|
/**
|
|
134
|
-
*
|
|
129
|
+
* Wraps the console interface and allow setting the log level.
|
|
135
130
|
*
|
|
136
131
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Console_API
|
|
137
132
|
*/
|
|
138
|
-
export declare class
|
|
133
|
+
export declare class ConsoleLog extends EventTarget implements Log {
|
|
134
|
+
#private;
|
|
135
|
+
static create(): ConsoleLog;
|
|
136
|
+
static createNull(): ConsoleLog;
|
|
137
|
+
level: LogLevel;
|
|
138
|
+
private constructor();
|
|
139
139
|
log(...data: unknown[]): void;
|
|
140
140
|
error(...data: unknown[]): void;
|
|
141
141
|
warn(...data: unknown[]): void;
|
|
@@ -146,6 +146,12 @@ export declare class ConsoleStub extends EventTarget {
|
|
|
146
146
|
* Track the console messages.
|
|
147
147
|
*/
|
|
148
148
|
trackMessages(): OutputTracker<ConsoleMessage>;
|
|
149
|
+
isLoggable(level: LogLevel): boolean;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export declare interface ConsoleMessage {
|
|
153
|
+
level: LogLevel;
|
|
154
|
+
message: unknown[];
|
|
149
155
|
}
|
|
150
156
|
|
|
151
157
|
/**
|
|
@@ -222,7 +228,7 @@ export declare const HEARTBEAT_TYPE = "heartbeat";
|
|
|
222
228
|
/**
|
|
223
229
|
* A simple logging facade.
|
|
224
230
|
*
|
|
225
|
-
* This is a subset of the `
|
|
231
|
+
* This is a subset of the `Console` interface.
|
|
226
232
|
*
|
|
227
233
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Console_API
|
|
228
234
|
*/
|
|
@@ -235,6 +241,9 @@ export declare interface Log {
|
|
|
235
241
|
trace(...data: unknown[]): void;
|
|
236
242
|
}
|
|
237
243
|
|
|
244
|
+
/** Defines level for setting a log level in a `Log` implementation. */
|
|
245
|
+
export declare type LogLevel = "log" | "error" | "warn" | "info" | "debug" | "trace" | "off";
|
|
246
|
+
|
|
238
247
|
/**
|
|
239
248
|
* An interface for a streaming message client.
|
|
240
249
|
*
|
|
@@ -393,8 +402,10 @@ export declare class SseClient extends EventTarget implements MessageClient {
|
|
|
393
402
|
/**
|
|
394
403
|
* A successful status.
|
|
395
404
|
*/
|
|
396
|
-
export declare class Success {
|
|
405
|
+
export declare class Success<T = unknown> {
|
|
397
406
|
readonly isSuccess = true;
|
|
407
|
+
readonly result?: T;
|
|
408
|
+
constructor(result?: T);
|
|
398
409
|
}
|
|
399
410
|
|
|
400
411
|
/**
|
package/dist/shared.js
CHANGED
|
@@ -26,9 +26,9 @@ class c {
|
|
|
26
26
|
static offset(t, e) {
|
|
27
27
|
return new c(new Date(t.millis() + e));
|
|
28
28
|
}
|
|
29
|
-
#
|
|
29
|
+
#t;
|
|
30
30
|
constructor(t) {
|
|
31
|
-
this.#
|
|
31
|
+
this.#t = t;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* Return the current timestamp of the clock.
|
|
@@ -36,7 +36,7 @@ class c {
|
|
|
36
36
|
* @return The current timestamp.
|
|
37
37
|
*/
|
|
38
38
|
date() {
|
|
39
|
-
return this.#
|
|
39
|
+
return this.#t ? new Date(this.#t) : /* @__PURE__ */ new Date();
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* Return the current timestamp of the clock in milliseconds.
|
|
@@ -47,7 +47,7 @@ class c {
|
|
|
47
47
|
return this.date().getTime();
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
class
|
|
50
|
+
class f {
|
|
51
51
|
/**
|
|
52
52
|
* Create a tracker for a specific event of an event target.
|
|
53
53
|
*
|
|
@@ -55,10 +55,10 @@ class p {
|
|
|
55
55
|
* @param event The event name to track.
|
|
56
56
|
*/
|
|
57
57
|
static create(t, ...e) {
|
|
58
|
-
return new
|
|
58
|
+
return new f(t, e);
|
|
59
59
|
}
|
|
60
|
-
#e;
|
|
61
60
|
#t;
|
|
61
|
+
#e;
|
|
62
62
|
#s;
|
|
63
63
|
#r;
|
|
64
64
|
/**
|
|
@@ -68,8 +68,8 @@ class p {
|
|
|
68
68
|
* @param event The event name to track.
|
|
69
69
|
*/
|
|
70
70
|
constructor(t, e) {
|
|
71
|
-
this.#
|
|
72
|
-
(s) => this.#
|
|
71
|
+
this.#t = t, this.#e = e, this.#s = [], this.#r = (s) => this.#s.push(s), this.#e.forEach(
|
|
72
|
+
(s) => this.#t.addEventListener(s, this.#r)
|
|
73
73
|
);
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
@@ -93,8 +93,8 @@ class p {
|
|
|
93
93
|
* Stop tracking.
|
|
94
94
|
*/
|
|
95
95
|
stop() {
|
|
96
|
-
this.#
|
|
97
|
-
(t) => this.#
|
|
96
|
+
this.#e.forEach(
|
|
97
|
+
(t) => this.#t.removeEventListener(t, this.#r)
|
|
98
98
|
);
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
@@ -105,20 +105,24 @@ class p {
|
|
|
105
105
|
async waitFor(t = 1) {
|
|
106
106
|
return new Promise((e) => {
|
|
107
107
|
const s = () => {
|
|
108
|
-
this.#s.length >= t && (this.#
|
|
109
|
-
(r) => this.#
|
|
108
|
+
this.#s.length >= t && (this.#e.forEach(
|
|
109
|
+
(r) => this.#t.removeEventListener(r, s)
|
|
110
110
|
), e(this.events));
|
|
111
111
|
};
|
|
112
|
-
this.#
|
|
113
|
-
(r) => this.#
|
|
112
|
+
this.#e.forEach(
|
|
113
|
+
(r) => this.#t.addEventListener(r, s)
|
|
114
114
|
), s();
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
class
|
|
118
|
+
class S {
|
|
119
119
|
isSuccess = !0;
|
|
120
|
+
result;
|
|
121
|
+
constructor(t) {
|
|
122
|
+
this.result = t;
|
|
123
|
+
}
|
|
120
124
|
}
|
|
121
|
-
class
|
|
125
|
+
class L {
|
|
122
126
|
isSuccess = !1;
|
|
123
127
|
errorMessage;
|
|
124
128
|
/**
|
|
@@ -130,7 +134,7 @@ class S {
|
|
|
130
134
|
this.errorMessage = t;
|
|
131
135
|
}
|
|
132
136
|
}
|
|
133
|
-
class
|
|
137
|
+
class l {
|
|
134
138
|
/**
|
|
135
139
|
* Create a list of responses (by providing an array), or a single repeating
|
|
136
140
|
* response (by providing any other type). 'Name' is optional and used in
|
|
@@ -140,7 +144,7 @@ class u {
|
|
|
140
144
|
* @param name An optional name for the responses.
|
|
141
145
|
*/
|
|
142
146
|
static create(t, e) {
|
|
143
|
-
return new
|
|
147
|
+
return new l(t, e);
|
|
144
148
|
}
|
|
145
149
|
/**
|
|
146
150
|
* Convert all properties in an object into ConfigurableResponse instances.
|
|
@@ -152,13 +156,13 @@ class u {
|
|
|
152
156
|
*/
|
|
153
157
|
static mapObject(t, e) {
|
|
154
158
|
const r = Object.entries(t).map(([h, n]) => {
|
|
155
|
-
const
|
|
156
|
-
return [h,
|
|
159
|
+
const d = e === void 0 ? void 0 : `${e}: ${h}`;
|
|
160
|
+
return [h, l.create(n, d)];
|
|
157
161
|
});
|
|
158
162
|
return Object.fromEntries(r);
|
|
159
163
|
}
|
|
160
|
-
#e;
|
|
161
164
|
#t;
|
|
165
|
+
#e;
|
|
162
166
|
/**
|
|
163
167
|
* Create a list of responses (by providing an array), or a single repeating
|
|
164
168
|
* response (by providing any other type). 'Name' is optional and used in
|
|
@@ -168,7 +172,7 @@ class u {
|
|
|
168
172
|
* @param name An optional name for the responses.
|
|
169
173
|
*/
|
|
170
174
|
constructor(t, e) {
|
|
171
|
-
this.#
|
|
175
|
+
this.#t = e == null ? "" : ` in ${e}`, this.#e = Array.isArray(t) ? [...t] : t;
|
|
172
176
|
}
|
|
173
177
|
/**
|
|
174
178
|
* Get the next configured response. Throws an error when configured with a list
|
|
@@ -177,13 +181,13 @@ class u {
|
|
|
177
181
|
* @return The next response.
|
|
178
182
|
*/
|
|
179
183
|
next() {
|
|
180
|
-
const t = Array.isArray(this.#
|
|
184
|
+
const t = Array.isArray(this.#e) ? this.#e.shift() : this.#e;
|
|
181
185
|
if (t === void 0)
|
|
182
|
-
throw new Error(`No more responses configured${this.#
|
|
186
|
+
throw new Error(`No more responses configured${this.#t}.`);
|
|
183
187
|
return t;
|
|
184
188
|
}
|
|
185
189
|
}
|
|
186
|
-
class
|
|
190
|
+
class u {
|
|
187
191
|
/**
|
|
188
192
|
* Create a tracker for a specific event of an event target.
|
|
189
193
|
*
|
|
@@ -191,10 +195,10 @@ class d {
|
|
|
191
195
|
* @param event The event name to track.
|
|
192
196
|
*/
|
|
193
197
|
static create(t, e) {
|
|
194
|
-
return new
|
|
198
|
+
return new u(t, e);
|
|
195
199
|
}
|
|
196
|
-
#e;
|
|
197
200
|
#t;
|
|
201
|
+
#e;
|
|
198
202
|
#s;
|
|
199
203
|
#r;
|
|
200
204
|
/**
|
|
@@ -204,7 +208,7 @@ class d {
|
|
|
204
208
|
* @param event The event name to track.
|
|
205
209
|
*/
|
|
206
210
|
constructor(t, e) {
|
|
207
|
-
this.#
|
|
211
|
+
this.#t = t, this.#e = e, this.#s = [], this.#r = (s) => this.#s.push(s.detail), this.#t.addEventListener(this.#e, this.#r);
|
|
208
212
|
}
|
|
209
213
|
/**
|
|
210
214
|
* Return the tracked data.
|
|
@@ -227,84 +231,120 @@ class d {
|
|
|
227
231
|
* Stop tracking.
|
|
228
232
|
*/
|
|
229
233
|
stop() {
|
|
230
|
-
this.#
|
|
234
|
+
this.#t.removeEventListener(this.#e, this.#r);
|
|
231
235
|
}
|
|
232
236
|
}
|
|
233
237
|
const i = "message";
|
|
234
|
-
class
|
|
238
|
+
class E extends EventTarget {
|
|
239
|
+
static create() {
|
|
240
|
+
return new E(globalThis.console);
|
|
241
|
+
}
|
|
242
|
+
static createNull() {
|
|
243
|
+
return new E(new p());
|
|
244
|
+
}
|
|
245
|
+
level = "info";
|
|
246
|
+
#t;
|
|
247
|
+
constructor(t) {
|
|
248
|
+
super(), this.#t = t;
|
|
249
|
+
}
|
|
235
250
|
log(...t) {
|
|
236
|
-
this.dispatchEvent(
|
|
251
|
+
this.isLoggable("log") && (this.#t.log(...t), this.dispatchEvent(
|
|
237
252
|
new CustomEvent(i, {
|
|
238
253
|
detail: { level: "log", message: t }
|
|
239
254
|
})
|
|
240
|
-
);
|
|
255
|
+
));
|
|
241
256
|
}
|
|
242
257
|
error(...t) {
|
|
243
|
-
this.dispatchEvent(
|
|
258
|
+
this.isLoggable("error") && (this.#t.error(...t), this.dispatchEvent(
|
|
244
259
|
new CustomEvent(i, {
|
|
245
260
|
detail: { level: "error", message: t }
|
|
246
261
|
})
|
|
247
|
-
);
|
|
262
|
+
));
|
|
248
263
|
}
|
|
249
264
|
warn(...t) {
|
|
250
|
-
this.dispatchEvent(
|
|
265
|
+
this.isLoggable("warn") && (this.#t.warn(...t), this.dispatchEvent(
|
|
251
266
|
new CustomEvent(i, {
|
|
252
267
|
detail: { level: "warn", message: t }
|
|
253
268
|
})
|
|
254
|
-
);
|
|
269
|
+
));
|
|
255
270
|
}
|
|
256
271
|
info(...t) {
|
|
257
|
-
this.dispatchEvent(
|
|
272
|
+
this.isLoggable("info") && (this.#t.info(...t), this.dispatchEvent(
|
|
258
273
|
new CustomEvent(i, {
|
|
259
274
|
detail: { level: "info", message: t }
|
|
260
275
|
})
|
|
261
|
-
);
|
|
276
|
+
));
|
|
262
277
|
}
|
|
263
278
|
debug(...t) {
|
|
264
|
-
this.dispatchEvent(
|
|
279
|
+
this.isLoggable("debug") && (this.#t.debug(...t), this.dispatchEvent(
|
|
265
280
|
new CustomEvent(i, {
|
|
266
281
|
detail: { level: "debug", message: t }
|
|
267
282
|
})
|
|
268
|
-
);
|
|
283
|
+
));
|
|
269
284
|
}
|
|
270
285
|
trace(...t) {
|
|
271
|
-
this.dispatchEvent(
|
|
286
|
+
this.isLoggable("trace") && (this.#t.trace(...t), this.dispatchEvent(
|
|
272
287
|
new CustomEvent(i, {
|
|
273
288
|
detail: { level: "trace", message: t }
|
|
274
289
|
})
|
|
275
|
-
);
|
|
290
|
+
));
|
|
276
291
|
}
|
|
277
292
|
/**
|
|
278
293
|
* Track the console messages.
|
|
279
294
|
*/
|
|
280
295
|
trackMessages() {
|
|
281
|
-
return new
|
|
296
|
+
return new u(this, i);
|
|
297
|
+
}
|
|
298
|
+
isLoggable(t) {
|
|
299
|
+
const e = (n) => n === "log" ? "info" : n, s = [
|
|
300
|
+
"off",
|
|
301
|
+
"error",
|
|
302
|
+
"warn",
|
|
303
|
+
"info",
|
|
304
|
+
"debug",
|
|
305
|
+
"trace"
|
|
306
|
+
], r = s.indexOf(e(this.level));
|
|
307
|
+
return s.indexOf(e(t)) <= r;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
class p {
|
|
311
|
+
log(...t) {
|
|
312
|
+
}
|
|
313
|
+
error(...t) {
|
|
314
|
+
}
|
|
315
|
+
warn(...t) {
|
|
316
|
+
}
|
|
317
|
+
info(...t) {
|
|
318
|
+
}
|
|
319
|
+
debug(...t) {
|
|
320
|
+
}
|
|
321
|
+
trace(...t) {
|
|
282
322
|
}
|
|
283
323
|
}
|
|
284
324
|
function N(a) {
|
|
285
|
-
const t =
|
|
325
|
+
const t = l.create(a);
|
|
286
326
|
return async function() {
|
|
287
327
|
const e = t.next();
|
|
288
328
|
if (e instanceof Error)
|
|
289
329
|
throw e;
|
|
290
|
-
return new
|
|
330
|
+
return new y(e);
|
|
291
331
|
};
|
|
292
332
|
}
|
|
293
|
-
class
|
|
294
|
-
#e;
|
|
333
|
+
class y {
|
|
295
334
|
#t;
|
|
335
|
+
#e;
|
|
296
336
|
#s;
|
|
297
337
|
constructor({ status: t, statusText: e, body: s = null }) {
|
|
298
|
-
this.#
|
|
338
|
+
this.#t = t, this.#e = e, this.#s = s;
|
|
299
339
|
}
|
|
300
340
|
get ok() {
|
|
301
341
|
return this.status >= 200 && this.status < 300;
|
|
302
342
|
}
|
|
303
343
|
get status() {
|
|
304
|
-
return this.#
|
|
344
|
+
return this.#t;
|
|
305
345
|
}
|
|
306
346
|
get statusText() {
|
|
307
|
-
return this.#
|
|
347
|
+
return this.#e;
|
|
308
348
|
}
|
|
309
349
|
async blob() {
|
|
310
350
|
if (this.#s == null)
|
|
@@ -321,14 +361,14 @@ class g {
|
|
|
321
361
|
return this.#s == null ? "" : String(this.#s);
|
|
322
362
|
}
|
|
323
363
|
}
|
|
324
|
-
class
|
|
364
|
+
class v extends EventTarget {
|
|
325
365
|
/**
|
|
326
366
|
* Create an SSE client.
|
|
327
367
|
*
|
|
328
368
|
* @return A new SSE client.
|
|
329
369
|
*/
|
|
330
370
|
static create() {
|
|
331
|
-
return new
|
|
371
|
+
return new v(EventSource);
|
|
332
372
|
}
|
|
333
373
|
/**
|
|
334
374
|
* Create a nulled SSE client.
|
|
@@ -336,18 +376,18 @@ class E extends EventTarget {
|
|
|
336
376
|
* @return A new SSE client.
|
|
337
377
|
*/
|
|
338
378
|
static createNull() {
|
|
339
|
-
return new
|
|
379
|
+
return new v(o);
|
|
340
380
|
}
|
|
341
|
-
#e;
|
|
342
381
|
#t;
|
|
382
|
+
#e;
|
|
343
383
|
constructor(t) {
|
|
344
|
-
super(), this.#
|
|
384
|
+
super(), this.#t = t;
|
|
345
385
|
}
|
|
346
386
|
get isConnected() {
|
|
347
|
-
return this.#
|
|
387
|
+
return this.#e?.readyState === this.#t.OPEN;
|
|
348
388
|
}
|
|
349
389
|
get url() {
|
|
350
|
-
return this.#
|
|
390
|
+
return this.#e?.url;
|
|
351
391
|
}
|
|
352
392
|
async connect(t, e = "message", ...s) {
|
|
353
393
|
await new Promise((r, h) => {
|
|
@@ -356,18 +396,18 @@ class E extends EventTarget {
|
|
|
356
396
|
return;
|
|
357
397
|
}
|
|
358
398
|
try {
|
|
359
|
-
this.#
|
|
399
|
+
this.#e = new this.#t(t), this.#e.addEventListener("open", (n) => {
|
|
360
400
|
this.#s(n), r();
|
|
361
|
-
}), this.#
|
|
401
|
+
}), this.#e.addEventListener(
|
|
362
402
|
e,
|
|
363
403
|
(n) => this.#r(n)
|
|
364
404
|
);
|
|
365
405
|
for (const n of s)
|
|
366
|
-
this.#
|
|
406
|
+
this.#e.addEventListener(
|
|
367
407
|
n,
|
|
368
|
-
(
|
|
408
|
+
(d) => this.#r(d)
|
|
369
409
|
);
|
|
370
|
-
this.#
|
|
410
|
+
this.#e.addEventListener(
|
|
371
411
|
"error",
|
|
372
412
|
(n) => this.#n(n)
|
|
373
413
|
);
|
|
@@ -386,7 +426,7 @@ class E extends EventTarget {
|
|
|
386
426
|
return;
|
|
387
427
|
}
|
|
388
428
|
try {
|
|
389
|
-
this.#
|
|
429
|
+
this.#e.close(), t();
|
|
390
430
|
} catch (s) {
|
|
391
431
|
e(s);
|
|
392
432
|
}
|
|
@@ -439,8 +479,8 @@ class o extends EventTarget {
|
|
|
439
479
|
this.readyState = o.CLOSED;
|
|
440
480
|
}
|
|
441
481
|
}
|
|
442
|
-
const
|
|
443
|
-
class
|
|
482
|
+
const m = "heartbeat", w = "message-sent";
|
|
483
|
+
class g extends EventTarget {
|
|
444
484
|
/**
|
|
445
485
|
* Create a WebSocket client.
|
|
446
486
|
*
|
|
@@ -451,7 +491,7 @@ class v extends EventTarget {
|
|
|
451
491
|
heartbeat: t = 3e4,
|
|
452
492
|
retry: e = 1e3
|
|
453
493
|
} = {}) {
|
|
454
|
-
return new
|
|
494
|
+
return new g(t, e, WebSocket);
|
|
455
495
|
}
|
|
456
496
|
/**
|
|
457
497
|
* Create a nulled WebSocket client.
|
|
@@ -460,20 +500,20 @@ class v extends EventTarget {
|
|
|
460
500
|
* @return A new nulled WebSocket client.
|
|
461
501
|
*/
|
|
462
502
|
static createNull({ heartbeat: t = 0, retry: e = 0 } = {}) {
|
|
463
|
-
return new
|
|
503
|
+
return new g(
|
|
464
504
|
t,
|
|
465
505
|
e,
|
|
466
|
-
|
|
506
|
+
b
|
|
467
507
|
);
|
|
468
508
|
}
|
|
469
|
-
#e;
|
|
470
509
|
#t;
|
|
510
|
+
#e;
|
|
471
511
|
#s;
|
|
472
512
|
#r;
|
|
473
513
|
#n;
|
|
474
514
|
#i;
|
|
475
515
|
constructor(t, e, s) {
|
|
476
|
-
super(), this.#
|
|
516
|
+
super(), this.#t = t, this.#e = e, this.#s = s;
|
|
477
517
|
}
|
|
478
518
|
get isConnected() {
|
|
479
519
|
return this.#r?.readyState === WebSocket.OPEN;
|
|
@@ -489,7 +529,7 @@ class v extends EventTarget {
|
|
|
489
529
|
}
|
|
490
530
|
try {
|
|
491
531
|
this.#r = new this.#s(t), this.#r.addEventListener("open", (r) => {
|
|
492
|
-
this.#
|
|
532
|
+
this.#u(r), e();
|
|
493
533
|
}), this.#r.addEventListener(
|
|
494
534
|
"message",
|
|
495
535
|
(r) => this.#a(r)
|
|
@@ -512,7 +552,7 @@ class v extends EventTarget {
|
|
|
512
552
|
* @return A new output tracker.
|
|
513
553
|
*/
|
|
514
554
|
trackMessageSent() {
|
|
515
|
-
return
|
|
555
|
+
return u.create(this, w);
|
|
516
556
|
}
|
|
517
557
|
/**
|
|
518
558
|
* Close the connection.
|
|
@@ -543,7 +583,7 @@ class v extends EventTarget {
|
|
|
543
583
|
* Simulate a heartbeat.
|
|
544
584
|
*/
|
|
545
585
|
simulateHeartbeat() {
|
|
546
|
-
this.#
|
|
586
|
+
this.#l();
|
|
547
587
|
}
|
|
548
588
|
/**
|
|
549
589
|
* Simulate a close event.
|
|
@@ -560,7 +600,7 @@ class v extends EventTarget {
|
|
|
560
600
|
simulateError() {
|
|
561
601
|
this.#r?.close(), this.#o(new Event("error"));
|
|
562
602
|
}
|
|
563
|
-
#
|
|
603
|
+
#u(t) {
|
|
564
604
|
this.dispatchEvent(new Event(t.type, t)), this.#E();
|
|
565
605
|
}
|
|
566
606
|
#a(t) {
|
|
@@ -572,31 +612,31 @@ class v extends EventTarget {
|
|
|
572
612
|
this.#v(), this.dispatchEvent(new CloseEvent(t.type, t));
|
|
573
613
|
}
|
|
574
614
|
#o(t) {
|
|
575
|
-
this.dispatchEvent(new Event(t.type, t)), this.#
|
|
615
|
+
this.dispatchEvent(new Event(t.type, t)), this.#d();
|
|
576
616
|
}
|
|
577
|
-
#
|
|
578
|
-
this.#
|
|
617
|
+
#d() {
|
|
618
|
+
this.#e <= 0 || (this.#i = setInterval(
|
|
579
619
|
() => this.connect(this.#r.url),
|
|
580
|
-
this.#
|
|
620
|
+
this.#e
|
|
581
621
|
));
|
|
582
622
|
}
|
|
583
623
|
#c() {
|
|
584
624
|
clearInterval(this.#i), this.#i = void 0;
|
|
585
625
|
}
|
|
586
626
|
#E() {
|
|
587
|
-
this.#
|
|
588
|
-
() => this.#
|
|
589
|
-
this.#
|
|
627
|
+
this.#t <= 0 || (this.#n = setInterval(
|
|
628
|
+
() => this.#l(),
|
|
629
|
+
this.#t
|
|
590
630
|
));
|
|
591
631
|
}
|
|
592
632
|
#v() {
|
|
593
633
|
clearInterval(this.#n), this.#n = void 0;
|
|
594
634
|
}
|
|
595
|
-
#
|
|
596
|
-
this.#n != null && this.send(
|
|
635
|
+
#l() {
|
|
636
|
+
this.#n != null && this.send(m);
|
|
597
637
|
}
|
|
598
638
|
}
|
|
599
|
-
class
|
|
639
|
+
class b extends EventTarget {
|
|
600
640
|
url;
|
|
601
641
|
readyState = WebSocket.CONNECTING;
|
|
602
642
|
constructor(t) {
|
|
@@ -612,15 +652,15 @@ class f extends EventTarget {
|
|
|
612
652
|
}
|
|
613
653
|
export {
|
|
614
654
|
c as Clock,
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
655
|
+
l as ConfigurableResponses,
|
|
656
|
+
E as ConsoleLog,
|
|
657
|
+
f as EventTracker,
|
|
658
|
+
L as Failure,
|
|
659
|
+
m as HEARTBEAT_TYPE,
|
|
660
|
+
u as OutputTracker,
|
|
661
|
+
v as SseClient,
|
|
662
|
+
S as Success,
|
|
663
|
+
g as WebSocketClient,
|
|
624
664
|
N as createFetchStub
|
|
625
665
|
};
|
|
626
666
|
//# sourceMappingURL=shared.js.map
|