@adapt-arch/utiliti-es 0.1.0 → 0.2.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.
@@ -1,175 +1,232 @@
1
- var u = Object.defineProperty;
2
- var h = (t, e, s) => e in t ? u(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
3
- var r = (t, e, s) => (h(t, typeof e != "symbol" ? e + "" : e, s), s);
4
- class g {
5
- constructor() {
6
- r(this, "_subscriptions", /* @__PURE__ */ new Map());
1
+ var g = Object.defineProperty;
2
+ var p = (r, s, e) => s in r ? g(r, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[s] = e;
3
+ var i = (r, s, e) => (p(r, typeof s != "symbol" ? s + "" : s, e), e);
4
+ class m {
5
+ /**
6
+ *
7
+ */
8
+ constructor(s) {
9
+ i(this, "_subscriptions", /* @__PURE__ */ new Map());
10
+ i(this, "_options");
11
+ var e;
12
+ if (this._options = s, (e = this._options) != null && e.plugins)
13
+ for (const t of this._options.plugins)
14
+ t.init && t.init(this);
7
15
  }
8
16
  /** @inheritdoc */
9
- publish(e, s) {
10
- if (!e)
17
+ publish(s, e) {
18
+ var a;
19
+ const t = {
20
+ topic: s,
21
+ message: e
22
+ };
23
+ if ((a = this._options) != null && a.plugins)
24
+ for (const l of this._options.plugins)
25
+ l.onPublish && l.onPublish(t);
26
+ if (!t.topic)
11
27
  throw new Error("Invalid topic.");
12
- if (!s)
28
+ if (!t.message)
13
29
  throw new Error("Invalid message.");
14
- const i = this._subscriptions.get(e);
15
- if (i)
16
- for (const n of i.values()) {
17
- const a = structuredClone(e), l = structuredClone(s);
18
- setTimeout(() => n(a, l), 0);
30
+ const n = this._subscriptions.get(t.topic);
31
+ if (n)
32
+ for (const l of n.values()) {
33
+ const h = structuredClone(t.topic), u = structuredClone(t.message);
34
+ setTimeout(() => l(h, u), 0);
19
35
  }
20
36
  }
21
37
  /** @inheritdoc */
22
- subscribe(e, s) {
23
- if (!e)
24
- throw new Error("Invalid topic.");
38
+ subscribe(s, e) {
25
39
  if (!s)
40
+ throw new Error("Invalid topic.");
41
+ if (!e)
26
42
  throw new Error("Invalid handler.");
27
- let i = this._subscriptions.get(e);
28
- i || (i = /* @__PURE__ */ new Map(), this._subscriptions.set(structuredClone(e), i));
43
+ let t = this._subscriptions.get(s);
44
+ t || (t = /* @__PURE__ */ new Map(), this._subscriptions.set(structuredClone(s), t));
29
45
  const n = `sub-${Date.now()}`;
30
- return i.set(n, s), n;
46
+ return t.set(n, e), n;
31
47
  }
32
48
  /** @inheritdoc */
33
- unsubscribe(e) {
34
- if (e) {
35
- for (const s of this._subscriptions.values())
36
- if (s.delete(e))
49
+ unsubscribe(s) {
50
+ if (s) {
51
+ for (const e of this._subscriptions.values())
52
+ if (e.delete(s))
37
53
  return;
38
54
  }
39
55
  }
56
+ [Symbol.dispose]() {
57
+ var s;
58
+ if (this._subscriptions.clear(), (s = this._options) != null && s.plugins)
59
+ for (const e of this._options.plugins) {
60
+ const t = e[Symbol.dispose];
61
+ t && t.call(e);
62
+ }
63
+ return Promise.resolve();
64
+ }
40
65
  }
41
- function m(t = 1, e) {
42
- return new Promise((s, i) => {
43
- setTimeout(() => {
44
- e ? i(e) : s();
45
- }, t);
46
- });
66
+ class f {
67
+ /**
68
+ * Constructor.
69
+ *
70
+ * @param {Options} options The options.
71
+ */
72
+ constructor(s) {
73
+ i(this, "_options");
74
+ i(this, "_channel");
75
+ i(this, "_eventListeners", null);
76
+ i(this, "_broadcastEnabled", !0);
77
+ this._options = s, this._channel = new BroadcastChannel(this._options.channelName);
78
+ }
79
+ /** @inheritdoc */
80
+ init(s) {
81
+ this._eventListeners || (this._eventListeners = (e) => {
82
+ const t = e.data;
83
+ if (!(!t.topic || !t.message))
84
+ try {
85
+ this._broadcastEnabled = !1, s.publish(t.topic, t.message);
86
+ } finally {
87
+ this._broadcastEnabled = !0;
88
+ }
89
+ }, this._channel.addEventListener("message", this._eventListeners));
90
+ }
91
+ /** @inheritdoc */
92
+ onPublish(s) {
93
+ if (!this._broadcastEnabled || !s.topic || !s.message)
94
+ return;
95
+ const e = {
96
+ topic: s.topic,
97
+ message: s.message
98
+ };
99
+ this._channel.postMessage(e);
100
+ }
101
+ [Symbol.dispose]() {
102
+ this._eventListeners && this._channel.removeEventListener("message", this._eventListeners), this._channel.close();
103
+ }
47
104
  }
48
- class p {
105
+ class d {
49
106
  /**
50
107
  * Constructor.
51
108
  *
52
109
  * @param {ExtraParams} values The values to add to the log.
53
110
  * @param {boolean} overrideExisting Override a value if it already exists.
54
111
  */
55
- constructor(e, s) {
56
- r(this, "_values");
57
- r(this, "_overrideExisting");
58
- this._values = e, this._overrideExisting = s;
112
+ constructor(s, e) {
113
+ i(this, "_values");
114
+ i(this, "_overrideExisting");
115
+ this._values = s, this._overrideExisting = e;
59
116
  }
60
117
  /**
61
118
  * @inheritdoc
62
119
  */
63
- enrich(e) {
120
+ enrich(s) {
64
121
  if (!this._values)
65
122
  return;
66
- e.extraParams = e.extraParams || {};
67
- const s = Object.keys(e.extraParams);
68
- for (const i in this._values)
69
- s.indexOf(i) !== -1 && !this._overrideExisting || (e.extraParams[i] = this._values[i]);
123
+ s.extraParams = s.extraParams || {};
124
+ const e = Object.keys(s.extraParams);
125
+ for (const t in this._values)
126
+ e.indexOf(t) !== -1 && !this._overrideExisting || (s.extraParams[t] = this._values[t]);
70
127
  }
71
128
  }
72
- class f {
129
+ class b {
73
130
  /**
74
131
  * Constructor.
75
132
  *
76
133
  * @param {DynamicValuesFunction} valuesFunction The values to add to the log.
77
134
  * @param {boolean} overrideExisting Override a value if it already exists.
78
135
  */
79
- constructor(e, s) {
80
- r(this, "_valuesFn");
81
- r(this, "_overrideExisting");
82
- this._valuesFn = e, this._overrideExisting = s;
136
+ constructor(s, e) {
137
+ i(this, "_valuesFn");
138
+ i(this, "_overrideExisting");
139
+ this._valuesFn = s, this._overrideExisting = e;
83
140
  }
84
141
  /**
85
142
  * @inheritdoc
86
143
  */
87
- enrich(e) {
88
- const s = typeof this._valuesFn == "function" ? this._valuesFn() : void 0;
89
- if (!s)
144
+ enrich(s) {
145
+ const e = typeof this._valuesFn == "function" ? this._valuesFn() : void 0;
146
+ if (!e)
90
147
  return;
91
- e.extraParams = e.extraParams || {};
92
- const i = Object.keys(e.extraParams);
93
- for (const n in s)
94
- i.indexOf(n) !== -1 && !this._overrideExisting || (e.extraParams[n] = s[n]);
148
+ s.extraParams = s.extraParams || {};
149
+ const t = Object.keys(s.extraParams);
150
+ for (const n in e)
151
+ t.indexOf(n) !== -1 && !this._overrideExisting || (s.extraParams[n] = e[n]);
95
152
  }
96
153
  }
97
154
  var o;
98
- (function(t) {
99
- t[t.Trace = 0] = "Trace", t[t.Debug = 1] = "Debug", t[t.Information = 2] = "Information", t[t.Warning = 3] = "Warning", t[t.Error = 4] = "Error", t[t.Critical = 5] = "Critical", t[t.None = 6] = "None";
155
+ (function(r) {
156
+ r[r.Trace = 0] = "Trace", r[r.Debug = 1] = "Debug", r[r.Information = 2] = "Information", r[r.Warning = 3] = "Warning", r[r.Error = 4] = "Error", r[r.Critical = 5] = "Critical", r[r.None = 6] = "None";
100
157
  })(o || (o = {}));
101
158
  class c {
102
159
  constructor() {
103
160
  /**
104
161
  * The timestamp of the log message.
105
162
  */
106
- r(this, "timestamp", (/* @__PURE__ */ new Date()).getTime());
163
+ i(this, "timestamp", (/* @__PURE__ */ new Date()).getTime());
107
164
  /**
108
165
  * The level of the log message.
109
166
  */
110
- r(this, "level", o.None);
167
+ i(this, "level", o.None);
111
168
  /**
112
169
  * The name of the logger.
113
170
  */
114
- r(this, "name", "");
171
+ i(this, "name", "");
115
172
  /**
116
173
  * The message to log.
117
174
  */
118
- r(this, "message", "");
175
+ i(this, "message", "");
119
176
  /**
120
177
  * The error message.
121
178
  */
122
- r(this, "errorMessage");
179
+ i(this, "errorMessage");
123
180
  /**
124
181
  * The stack trace of the error.
125
182
  */
126
- r(this, "stackTrace");
183
+ i(this, "stackTrace");
127
184
  /**
128
185
  * Any extra parameters to log.
129
186
  */
130
- r(this, "extraParams");
187
+ i(this, "extraParams");
131
188
  }
132
189
  }
133
- class d {
190
+ class v {
134
191
  /**
135
192
  * Constructor.
136
193
  *
137
194
  * @param {Console} console The current console reference.
138
195
  */
139
- constructor(e) {
140
- r(this, "_console");
141
- this._console = e;
196
+ constructor(s) {
197
+ i(this, "_console");
198
+ this._console = s;
142
199
  }
143
200
  /**
144
201
  * @inheritdoc
145
202
  */
146
- register(e) {
147
- let s;
203
+ register(s) {
204
+ let e;
148
205
  if (this._console)
149
- switch (e.level) {
206
+ switch (s.level) {
150
207
  case o.Trace:
151
- s = this._console.trace || this._console.log;
208
+ e = this._console.trace || this._console.log;
152
209
  break;
153
210
  case o.Debug:
154
- s = this._console.debug || this._console.log;
211
+ e = this._console.debug || this._console.log;
155
212
  break;
156
213
  case o.Information:
157
- s = this._console.info || this._console.log;
214
+ e = this._console.info || this._console.log;
158
215
  break;
159
216
  case o.Warning:
160
- s = this._console.warn || this._console.log;
217
+ e = this._console.warn || this._console.log;
161
218
  break;
162
219
  case o.Error:
163
- s = this._console.error || this._console.log;
220
+ e = this._console.error || this._console.log;
164
221
  break;
165
222
  case o.Critical:
166
- s = this._console.error || this._console.log;
223
+ e = this._console.error || this._console.log;
167
224
  break;
168
225
  default:
169
- s = null;
226
+ e = null;
170
227
  break;
171
228
  }
172
- typeof s == "function" && s.call(this._console, e.message, e);
229
+ typeof e == "function" && e.call(this._console, s.message, s);
173
230
  }
174
231
  /**
175
232
  * @inheritdoc
@@ -178,46 +235,46 @@ class d {
178
235
  return Promise.resolve();
179
236
  }
180
237
  }
181
- class b {
238
+ class w {
182
239
  constructor() {
183
240
  /**
184
241
  * Endpoint that receives the logs.
185
242
  */
186
- r(this, "endpoint", "");
243
+ i(this, "endpoint", "");
187
244
  /**
188
245
  * HTTP verb used when calling the endpoint.
189
246
  */
190
- r(this, "verb", "POST");
247
+ i(this, "verb", "POST");
191
248
  /**
192
249
  * The number of items to send in a batch.
193
250
  */
194
- r(this, "batchSize", 20);
251
+ i(this, "batchSize", 20);
195
252
  /**
196
253
  * The maximum interval, in milliseconds, to wait for the batch size to be achieved before reporting.
197
254
  */
198
- r(this, "interval", 2e3);
255
+ i(this, "interval", 2e3);
199
256
  /**
200
257
  * A function that can be used to transform the request before sending it.
201
258
  */
202
- r(this, "requestTransform");
259
+ i(this, "requestTransform");
203
260
  }
204
261
  }
205
- class w {
206
- constructor(e) {
207
- r(this, "_messageQueue");
208
- r(this, "_options");
209
- r(this, "_reportActionTimeoutRef");
210
- r(this, "_reportActionPromise");
211
- r(this, "_disposed");
212
- if (!e)
262
+ class y {
263
+ constructor(s) {
264
+ i(this, "_messageQueue");
265
+ i(this, "_options");
266
+ i(this, "_reportActionTimeoutRef");
267
+ i(this, "_reportActionPromise");
268
+ i(this, "_disposed");
269
+ if (!s)
213
270
  throw new Error('Argument "options" is required');
214
- this._messageQueue = [], this._options = e, this._reportActionTimeoutRef = void 0, this._reportActionPromise = null, this._disposed = !1;
271
+ this._messageQueue = [], this._options = s, this._reportActionTimeoutRef = void 0, this._reportActionPromise = null, this._disposed = !1;
215
272
  }
216
273
  /**
217
274
  * @inheritdoc
218
275
  */
219
- register(e) {
220
- this._disposed || (this._messageQueue.push(e), this._scheduleNextProcessAction());
276
+ register(s) {
277
+ this._disposed || (this._messageQueue.push(s), this._scheduleNextProcessAction());
221
278
  }
222
279
  /**
223
280
  * @inheritdoc
@@ -230,36 +287,36 @@ class w {
230
287
  _scheduleNextProcessAction() {
231
288
  if (this._reportActionTimeoutRef)
232
289
  return;
233
- const e = this._messageQueue.length >= this._options.batchSize ? 0 : this._options.interval;
290
+ const s = this._messageQueue.length >= this._options.batchSize ? 0 : this._options.interval;
234
291
  this._reportActionTimeoutRef = setTimeout(() => {
235
292
  this._reportActionPromise = this._processMessages().then(() => {
236
- const s = this._reportActionTimeoutRef;
237
- this._reportActionTimeoutRef = void 0, clearTimeout(s), this._reportActionPromise = null, this._scheduleNextProcessAction();
293
+ const e = this._reportActionTimeoutRef;
294
+ this._reportActionTimeoutRef = void 0, clearTimeout(e), this._reportActionPromise = null, this._scheduleNextProcessAction();
238
295
  });
239
- }, e);
296
+ }, s);
240
297
  }
241
298
  async _processMessages() {
242
- let e, s;
299
+ let s, e;
243
300
  for (; this._messageQueue.length > 0; )
244
- if (e = this._messageQueue.splice(0, Math.min(this._messageQueue.length, this._options.batchSize)), s = await this._sendMessagesBatch(e), !s) {
245
- this._messageQueue.unshift(...e);
301
+ if (s = this._messageQueue.splice(0, Math.min(this._messageQueue.length, this._options.batchSize)), e = await this._sendMessagesBatch(s), !e) {
302
+ this._messageQueue.unshift(...s);
246
303
  return;
247
304
  }
248
305
  }
249
- _sendMessagesBatch(e) {
250
- return new Promise((s) => {
251
- const i = () => {
252
- s(!1);
306
+ _sendMessagesBatch(s) {
307
+ return new Promise((e) => {
308
+ const t = () => {
309
+ e(!1);
253
310
  }, n = new XMLHttpRequest();
254
311
  n.open(this._options.verb, this._options.endpoint), n.setRequestHeader("Content-Type", "application/json;charset=UTF-8"), this._options.requestTransform && this._options.requestTransform(n), n.onload = function() {
255
- s(this.status >= 200 && this.status < 300);
256
- }, n.onerror = i, n.onabort = i, n.send(JSON.stringify(e));
312
+ e(this.status >= 200 && this.status < 300);
313
+ }, n.onerror = t, n.onabort = t, n.send(JSON.stringify(s));
257
314
  });
258
315
  }
259
316
  }
260
- class v {
317
+ class P {
261
318
  constructor() {
262
- r(this, "_messages", []);
319
+ i(this, "_messages", []);
263
320
  }
264
321
  get messages() {
265
322
  return this._messages.slice();
@@ -267,8 +324,8 @@ class v {
267
324
  /**
268
325
  * @inheritdoc
269
326
  */
270
- register(e) {
271
- this._messages.push(e);
327
+ register(s) {
328
+ this._messages.push(s);
272
329
  }
273
330
  /**
274
331
  * @inheritdoc
@@ -277,26 +334,26 @@ class v {
277
334
  return Promise.resolve();
278
335
  }
279
336
  }
280
- class y {
281
- constructor(e) {
282
- r(this, "_reporters");
283
- this._reporters = e || [];
337
+ class E {
338
+ constructor(s) {
339
+ i(this, "_reporters");
340
+ this._reporters = s || [];
284
341
  }
285
342
  /**
286
343
  * @inheritdoc
287
344
  */
288
- register(e) {
289
- for (const s of this._reporters)
290
- s.register(e);
345
+ register(s) {
346
+ for (const e of this._reporters)
347
+ e.register(s);
291
348
  }
292
349
  /**
293
350
  * @inheritdoc
294
351
  */
295
352
  async [Symbol.asyncDispose]() {
296
- const e = new Array();
297
- for (const s of this._reporters)
298
- e.push(s[Symbol.asyncDispose]());
299
- e.length && await Promise.all(e);
353
+ const s = new Array();
354
+ for (const e of this._reporters)
355
+ s.push(e[Symbol.asyncDispose]());
356
+ s.length && await Promise.all(s);
300
357
  }
301
358
  }
302
359
  class T {
@@ -305,90 +362,90 @@ class T {
305
362
  *
306
363
  * @param {LoggerOptions} options The logger options.
307
364
  */
308
- constructor(e) {
309
- r(this, "_options");
310
- this._options = e;
365
+ constructor(s) {
366
+ i(this, "_options");
367
+ this._options = s;
311
368
  }
312
369
  /**
313
370
  * The core logging method.
314
371
  *
315
372
  * @param {LogMessage} message The message to log.
316
373
  */
317
- logMessageCore(e) {
318
- var s;
319
- e.name = this._options.name;
320
- for (const i of this._options.enrichers)
321
- i.enrich(e);
322
- (s = this._options.reporter) == null || s.register(e);
374
+ logMessageCore(s) {
375
+ var e;
376
+ s.name = this._options.name;
377
+ for (const t of this._options.enrichers)
378
+ t.enrich(s);
379
+ (e = this._options.reporter) == null || e.register(s);
323
380
  }
324
381
  /**
325
382
  * @inheritdoc
326
383
  */
327
384
  async [Symbol.asyncDispose]() {
328
- var e;
329
- await ((e = this._options.reporter) == null ? void 0 : e[Symbol.asyncDispose]());
385
+ var s;
386
+ await ((s = this._options.reporter) == null ? void 0 : s[Symbol.asyncDispose]());
330
387
  }
331
388
  /**
332
389
  * Indicates if the specified level will be logged.
333
390
  *
334
391
  * @param {LogLevel} level The log level.
335
392
  */
336
- isEnabled(e) {
337
- return e !== o.None && e >= this._options.minimumLevel;
393
+ isEnabled(s) {
394
+ return s !== o.None && s >= this._options.minimumLevel;
338
395
  }
339
396
  /**
340
397
  * Log trace.
341
398
  *
342
399
  * @param msg The message to log.
343
400
  */
344
- trace(e) {
345
- const s = new c();
346
- s.level = o.Trace, s.message = e, this.logMessage(s);
401
+ trace(s) {
402
+ const e = new c();
403
+ e.level = o.Trace, e.message = s, this.logMessage(e);
347
404
  }
348
405
  /**
349
406
  * Log debug.
350
407
  *
351
408
  * @param msg The message to log.
352
409
  */
353
- debug(e) {
354
- const s = new c();
355
- s.level = o.Debug, s.message = e, this.logMessage(s);
410
+ debug(s) {
411
+ const e = new c();
412
+ e.level = o.Debug, e.message = s, this.logMessage(e);
356
413
  }
357
414
  /**
358
415
  * Log information.
359
416
  *
360
417
  * @param msg The message to log.
361
418
  */
362
- info(e) {
363
- const s = new c();
364
- s.level = o.Information, s.message = e, this.logMessage(s);
419
+ info(s) {
420
+ const e = new c();
421
+ e.level = o.Information, e.message = s, this.logMessage(e);
365
422
  }
366
423
  /**
367
424
  * Log warning.
368
425
  *
369
426
  * @param msg The message to log.
370
427
  */
371
- warn(e) {
372
- const s = new c();
373
- s.level = o.Warning, s.message = e, this.logMessage(s);
428
+ warn(s) {
429
+ const e = new c();
430
+ e.level = o.Warning, e.message = s, this.logMessage(e);
374
431
  }
375
432
  /**
376
433
  * Log error.
377
434
  *
378
435
  * @param msg The message to log.
379
436
  */
380
- error(e) {
381
- const s = new c();
382
- s.level = o.Error, s.message = e, this.logMessage(s);
437
+ error(s) {
438
+ const e = new c();
439
+ e.level = o.Error, e.message = s, this.logMessage(e);
383
440
  }
384
441
  /**
385
442
  * Log error.
386
443
  *
387
444
  * @param msg The message to log.
388
445
  */
389
- crit(e) {
390
- const s = new c();
391
- s.level = o.Critical, s.message = e, this.logMessage(s);
446
+ crit(s) {
447
+ const e = new c();
448
+ e.level = o.Critical, e.message = s, this.logMessage(e);
392
449
  }
393
450
  /**
394
451
  * Log an event.
@@ -398,18 +455,18 @@ class T {
398
455
  * @param {Error} e The error associated with the event.
399
456
  * @param {ExtraParams} params Extra parameters.
400
457
  */
401
- log(e, s, i, n) {
458
+ log(s, e, t, n) {
402
459
  const a = new c();
403
- a.level = e, a.message = s, a.errorMessage = i == null ? void 0 : i.message, a.stackTrace = i == null ? void 0 : i.stack, a.extraParams = n, this.logMessage(a);
460
+ a.level = s, a.message = e, a.errorMessage = t == null ? void 0 : t.message, a.stackTrace = t == null ? void 0 : t.stack, a.extraParams = n, this.logMessage(a);
404
461
  }
405
462
  /**
406
463
  * Log a message.
407
464
  *
408
465
  * @param {LogMessage} message The message to log.
409
466
  */
410
- logMessage(e) {
411
- this.isEnabled(e.level) && setTimeout(() => {
412
- this.logMessageCore(e);
467
+ logMessage(s) {
468
+ this.isEnabled(s.level) && setTimeout(() => {
469
+ this.logMessageCore(s);
413
470
  }, 1);
414
471
  }
415
472
  }
@@ -418,27 +475,27 @@ class M {
418
475
  /**
419
476
  * The name of the logger.
420
477
  */
421
- r(this, "name", "");
478
+ i(this, "name", "");
422
479
  /**
423
480
  * The reporter for the messages.
424
481
  */
425
- r(this, "reporter", null);
482
+ i(this, "reporter", null);
426
483
  /**
427
484
  * The minimum log level.
428
485
  */
429
- r(this, "minimumLevel", o.Warning);
486
+ i(this, "minimumLevel", o.Warning);
430
487
  /**
431
488
  * Log enrichers.
432
489
  */
433
- r(this, "enrichers", []);
490
+ i(this, "enrichers", []);
434
491
  }
435
492
  /**
436
493
  * Get the LogLevel from a string value.
437
494
  *
438
495
  * @param {String} level The log level as string.
439
496
  */
440
- static getLevel(e) {
441
- switch ((e || "").toUpperCase()) {
497
+ static getLevel(s) {
498
+ switch ((s || "").toUpperCase()) {
442
499
  case "TRACE":
443
500
  return o.Trace;
444
501
  case "DEBUG":
@@ -458,18 +515,47 @@ class M {
458
515
  }
459
516
  }
460
517
  }
518
+ class R {
519
+ /**
520
+ * Constructor.
521
+ *
522
+ * @param {Logger} logger The logger.
523
+ * @param {LogLevel} logLevel The log level.
524
+ */
525
+ constructor(s, e = o.Information) {
526
+ i(this, "_logger");
527
+ i(this, "_logLevel");
528
+ this._logger = s, this._logLevel = e;
529
+ }
530
+ /** @inheritdoc */
531
+ onPublish(s) {
532
+ this._logger.log(this._logLevel, `Publishing message to topic: ${s.topic}`, void 0, {
533
+ topic: s.topic ?? null,
534
+ message: s.message ?? null
535
+ });
536
+ }
537
+ }
538
+ function x(r = 1, s) {
539
+ return new Promise((e, t) => {
540
+ setTimeout(() => {
541
+ s ? t(s) : e();
542
+ }, r);
543
+ });
544
+ }
461
545
  export {
462
- d as ConsoleReporter,
463
- f as DynamicValuesEnricher,
464
- v as InMemoryReporter,
546
+ f as BroadcastChannelPlugin,
547
+ v as ConsoleReporter,
548
+ b as DynamicValuesEnricher,
549
+ P as InMemoryReporter,
465
550
  o as LogLevel,
466
551
  c as LogMessage,
467
552
  T as Logger,
468
553
  M as LoggerOptions,
469
- y as MultipleReporter,
470
- g as PubSubHub,
471
- p as ValuesEnricher,
472
- w as XhrReporter,
473
- b as XhrReporterOptions,
474
- m as delay
554
+ R as LoggerPlugin,
555
+ E as MultipleReporter,
556
+ m as PubSubHub,
557
+ d as ValuesEnricher,
558
+ y as XhrReporter,
559
+ w as XhrReporterOptions,
560
+ x as delay
475
561
  };