@dawntech/dispatcher 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/dist/index.d.mts +550 -11
  2. package/dist/index.js +1 -1
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.mjs +1 -1
  5. package/dist/index.mjs.map +1 -1
  6. package/package.json +13 -1
  7. package/dist/chunk-4LYB64T2.mjs +0 -2
  8. package/dist/chunk-4LYB64T2.mjs.map +0 -1
  9. package/dist/chunk-64334IMD.mjs +0 -2
  10. package/dist/chunk-64334IMD.mjs.map +0 -1
  11. package/dist/chunk-B7IDVU6T.mjs +0 -2
  12. package/dist/chunk-B7IDVU6T.mjs.map +0 -1
  13. package/dist/chunk-CVPGUSFU.mjs +0 -2
  14. package/dist/chunk-CVPGUSFU.mjs.map +0 -1
  15. package/dist/chunk-HYW2O7ZX.mjs +0 -2
  16. package/dist/chunk-HYW2O7ZX.mjs.map +0 -1
  17. package/dist/chunk-JD53PFR4.mjs +0 -2
  18. package/dist/chunk-JD53PFR4.mjs.map +0 -1
  19. package/dist/chunk-OXXLVJVC.mjs +0 -2
  20. package/dist/chunk-OXXLVJVC.mjs.map +0 -1
  21. package/dist/chunk-PAKGTHKD.mjs +0 -2
  22. package/dist/chunk-PAKGTHKD.mjs.map +0 -1
  23. package/dist/chunk-QA6PFVGP.mjs +0 -2
  24. package/dist/chunk-QA6PFVGP.mjs.map +0 -1
  25. package/dist/chunk-UFUGEIFL.mjs +0 -2
  26. package/dist/chunk-UFUGEIFL.mjs.map +0 -1
  27. package/dist/chunk-VTJMLZE3.mjs +0 -2
  28. package/dist/chunk-VTJMLZE3.mjs.map +0 -1
  29. package/dist/core/Blip.d.mts +0 -84
  30. package/dist/core/Blip.js +0 -2
  31. package/dist/core/Blip.js.map +0 -1
  32. package/dist/core/Blip.mjs +0 -2
  33. package/dist/core/Blip.mjs.map +0 -1
  34. package/dist/core/Dispatcher.d.mts +0 -52
  35. package/dist/core/Dispatcher.js +0 -2
  36. package/dist/core/Dispatcher.js.map +0 -1
  37. package/dist/core/Dispatcher.mjs +0 -2
  38. package/dist/core/Dispatcher.mjs.map +0 -1
  39. package/dist/core/DispatcherDescriptor.d.mts +0 -23
  40. package/dist/core/DispatcherDescriptor.js +0 -2
  41. package/dist/core/DispatcherDescriptor.js.map +0 -1
  42. package/dist/core/DispatcherDescriptor.mjs +0 -2
  43. package/dist/core/DispatcherDescriptor.mjs.map +0 -1
  44. package/dist/core/DispatcherMonitor.d.mts +0 -52
  45. package/dist/core/DispatcherMonitor.js +0 -2
  46. package/dist/core/DispatcherMonitor.js.map +0 -1
  47. package/dist/core/DispatcherMonitor.mjs +0 -2
  48. package/dist/core/DispatcherMonitor.mjs.map +0 -1
  49. package/dist/core/DispatcherQuery.d.mts +0 -14
  50. package/dist/core/DispatcherQuery.js +0 -2
  51. package/dist/core/DispatcherQuery.js.map +0 -1
  52. package/dist/core/DispatcherQuery.mjs +0 -2
  53. package/dist/core/DispatcherQuery.mjs.map +0 -1
  54. package/dist/core/DispatcherRepository.d.mts +0 -50
  55. package/dist/core/DispatcherRepository.js +0 -2
  56. package/dist/core/DispatcherRepository.js.map +0 -1
  57. package/dist/core/DispatcherRepository.mjs +0 -2
  58. package/dist/core/DispatcherRepository.mjs.map +0 -1
  59. package/dist/core/DispatcherStateMachine.d.mts +0 -20
  60. package/dist/core/DispatcherStateMachine.js +0 -2
  61. package/dist/core/DispatcherStateMachine.js.map +0 -1
  62. package/dist/core/DispatcherStateMachine.mjs +0 -2
  63. package/dist/core/DispatcherStateMachine.mjs.map +0 -1
  64. package/dist/errors/index.d.mts +0 -54
  65. package/dist/errors/index.js +0 -2
  66. package/dist/errors/index.js.map +0 -1
  67. package/dist/errors/index.mjs +0 -2
  68. package/dist/errors/index.mjs.map +0 -1
  69. package/dist/server.d.mts +0 -2
  70. package/dist/server.js +0 -2
  71. package/dist/server.js.map +0 -1
  72. package/dist/server.mjs +0 -2
  73. package/dist/server.mjs.map +0 -1
  74. package/dist/types/blip.d.mts +0 -127
  75. package/dist/types/blip.js +0 -2
  76. package/dist/types/blip.js.map +0 -1
  77. package/dist/types/blip.mjs +0 -2
  78. package/dist/types/blip.mjs.map +0 -1
  79. package/dist/types/index.d.mts +0 -160
  80. package/dist/types/index.js +0 -2
  81. package/dist/types/index.js.map +0 -1
  82. package/dist/types/index.mjs +0 -2
  83. package/dist/types/index.mjs.map +0 -1
  84. package/dist/utils/logger.d.mts +0 -73
  85. package/dist/utils/logger.js +0 -2
  86. package/dist/utils/logger.js.map +0 -1
  87. package/dist/utils/logger.mjs +0 -2
  88. package/dist/utils/logger.mjs.map +0 -1
package/dist/index.d.mts CHANGED
@@ -1,11 +1,550 @@
1
- export { CallbackMap, DispatcherDescriptor, DispatcherDescriptorOptions } from './core/DispatcherDescriptor.mjs';
2
- export { Dispatcher } from './core/Dispatcher.mjs';
3
- export { Blip, BlipError } from './core/Blip.mjs';
4
- export { DispatcherMonitor, MonitorAlert, MonitorOptions, MonitorRule } from './core/DispatcherMonitor.mjs';
5
- export { DispatcherRepository } from './core/DispatcherRepository.mjs';
6
- export { enableLogger, getLogger } from './utils/logger.mjs';
7
- export { CallbackEvent, ConnectionConfig, Contact, DispatchMessageOptions, DispatchState, DispatcherManifest, DispatcherMetrics, DispatcherOptions, Intent, Message, MessageData, MessageDispatcherOptions, MessageOptions, MessagePayload, MessageState, MessageStatus, QueryFilter, Shift, Weekdays } from './types/index.mjs';
8
- export { BlipConfig, DateInterval, PartiallyOptional, PartiallyRequiredStrict, Vnd } from './types/blip.mjs';
9
- import './core/DispatcherQuery.mjs';
10
- import 'events';
11
- import 'ioredis';
1
+ import IORedis from 'ioredis';
2
+ import { EventEmitter } from 'events';
3
+
4
+ /**
5
+ * Type definitions for Blip Platform API
6
+ * Based on the LIME protocol and Blip extensions
7
+ */
8
+ declare namespace Vnd {
9
+ namespace Lime {
10
+ enum Method {
11
+ GET = "get",
12
+ SET = "set",
13
+ DELETE = "delete",
14
+ OBSERVE = "observe",
15
+ SUBSCRIBE = "subscribe",
16
+ MERGE = "merge"
17
+ }
18
+ enum Status {
19
+ SUCCESS = "success",
20
+ FAILURE = "failure"
21
+ }
22
+ namespace Transport {
23
+ namespace Payload {
24
+ interface Request<T = any> {
25
+ id?: string;
26
+ to?: string;
27
+ method: Method;
28
+ uri: string;
29
+ type?: string;
30
+ resource?: T;
31
+ }
32
+ interface Response<T = any> {
33
+ id?: string;
34
+ from?: string;
35
+ to?: string;
36
+ method?: Method;
37
+ status: Status;
38
+ type?: string;
39
+ resource?: T;
40
+ reason?: {
41
+ code: number;
42
+ description: string;
43
+ };
44
+ }
45
+ }
46
+ }
47
+ interface Message<T = any> {
48
+ id?: string;
49
+ to: string;
50
+ from?: string;
51
+ type: string;
52
+ content: T;
53
+ }
54
+ namespace Command {
55
+ interface Resource<T = any> {
56
+ [key: string]: T;
57
+ }
58
+ }
59
+ }
60
+ namespace Iris {
61
+ interface ThreadMessage {
62
+ id: string;
63
+ direction: 'sent' | 'received';
64
+ type: string;
65
+ content: any;
66
+ date: string;
67
+ status?: string;
68
+ [key: string]: any;
69
+ }
70
+ interface Contact {
71
+ identity: string;
72
+ name?: string;
73
+ email?: string;
74
+ phoneNumber?: string;
75
+ taxDocument?: string;
76
+ gender?: string;
77
+ city?: string;
78
+ extras?: Record<string, string>;
79
+ [key: string]: any;
80
+ }
81
+ interface EventTrack {
82
+ category: string;
83
+ action: string;
84
+ contact?: {
85
+ identity: string;
86
+ };
87
+ extras?: any;
88
+ count?: number;
89
+ }
90
+ interface Ticket {
91
+ id: string;
92
+ sequentialId: number;
93
+ ownerIdentity: string;
94
+ customerIdentity: string;
95
+ providerIdentity: string;
96
+ status: string;
97
+ storageDate: string;
98
+ externalId?: string;
99
+ rating?: number;
100
+ team?: string;
101
+ agentIdentity?: string;
102
+ closedDate?: string;
103
+ transfers?: number;
104
+ [key: string]: any;
105
+ }
106
+ namespace ActiveCampaign {
107
+ interface AudienceSummary {
108
+ total: number;
109
+ sent: number;
110
+ failed: number;
111
+ scheduled: number;
112
+ canceled: number;
113
+ }
114
+ }
115
+ }
116
+ }
117
+ interface BlipConfig {
118
+ botUrl: string;
119
+ botKey: string;
120
+ timeout?: number;
121
+ maxRetries?: number;
122
+ }
123
+ interface DateInterval {
124
+ from?: Date;
125
+ to: Date;
126
+ }
127
+ type PartiallyOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
128
+ type PartiallyRequiredStrict<T, K extends keyof T> = T & Required<Pick<T, K>>;
129
+
130
+ type Contact = Omit<Vnd.Iris.Contact, 'identity'>;
131
+ type MessageData = {
132
+ type: string;
133
+ content: Record<string, any> | string;
134
+ };
135
+ type MessagePayload = Record<string, any> | Array<any> | string;
136
+ declare enum MessageState {
137
+ INIT = "INIT",
138
+ DISPATCHED = "DISPATCHED",
139
+ SCHEDULED = "SCHEDULED",
140
+ QUEUED = "QUEUED",
141
+ FINAL = "FINAL"
142
+ }
143
+ declare enum MessageStatus {
144
+ INIT = "INIT",
145
+ PENDING = "PENDING",
146
+ SENDING = "SENDING",
147
+ DELIVERED = "DELIVERED",
148
+ READ = "READ",
149
+ REPLIED = "REPLIED",
150
+ FAILED = "FAILED",
151
+ CANCELED = "CANCELED"
152
+ }
153
+ declare enum DispatchState {
154
+ ACCEPTED = "accepted",
155
+ DISPATCHED = "dispatched",
156
+ RECEIVED = "received",
157
+ CONSUMED = "consumed",
158
+ FAILED = "failed"
159
+ }
160
+ interface Message {
161
+ messageId: string;
162
+ contactId: string;
163
+ descriptorId: string;
164
+ payload: MessageData;
165
+ status: MessageStatus;
166
+ state: MessageState;
167
+ attempts?: number;
168
+ retries?: number;
169
+ options?: MessageOptions;
170
+ expiresAt?: string;
171
+ scheduledTo?: string;
172
+ sentAt?: string;
173
+ acceptedAt?: string;
174
+ lastDispatchAttemptAt?: string;
175
+ createdAt: string;
176
+ deliveredAt?: string;
177
+ readAt?: string;
178
+ repliedAt?: string;
179
+ failedAt?: string;
180
+ error?: string;
181
+ }
182
+ interface Shift {
183
+ days: number;
184
+ start: string;
185
+ end: string;
186
+ gmt?: string;
187
+ }
188
+ declare enum Weekdays {
189
+ MONDAY = 1,
190
+ TUESDAY = 2,
191
+ WEDNESDAY = 4,
192
+ THURSDAY = 8,
193
+ FRIDAY = 16,
194
+ SATURDAY = 32,
195
+ SUNDAY = 64
196
+ }
197
+ interface Intent {
198
+ intent: string;
199
+ dueDate?: string;
200
+ event?: string;
201
+ payload?: any | null;
202
+ expired?: {
203
+ event?: string;
204
+ intent?: string;
205
+ };
206
+ }
207
+ type CallbackEvent = 'dispatch' | 'sending' | 'delivered' | 'failed' | 'read' | 'replied' | 'scheduled' | 'retry' | 'evicted' | 'canceled';
208
+ type ConnectionConfig = {
209
+ contract: string;
210
+ key: string;
211
+ };
212
+ interface MessageOptions {
213
+ shifts?: Array<Shift>;
214
+ contact?: Contact;
215
+ state?: {
216
+ stateId: string;
217
+ botId: string;
218
+ botIds?: Array<string>;
219
+ };
220
+ intent?: string | Intent;
221
+ finalStatus?: 'DELIVERED' | 'READ' | 'REPLIED';
222
+ }
223
+ interface DispatchMessageOptions extends MessageOptions {
224
+ schedule?: string;
225
+ }
226
+ interface DispatcherOptions {
227
+ maxRetries?: number;
228
+ retryIntervals?: number[];
229
+ retention?: number;
230
+ timeouts?: {
231
+ pending?: number;
232
+ sending?: number;
233
+ };
234
+ batchSize?: number;
235
+ pollingIntervals?: {
236
+ scheduled?: number;
237
+ pending?: number;
238
+ sending?: number;
239
+ delivered?: number;
240
+ read?: number;
241
+ queue?: number;
242
+ };
243
+ maxQueueSize?: number;
244
+ rateLimits?: {
245
+ global?: {
246
+ points: number;
247
+ duration: number;
248
+ };
249
+ message?: {
250
+ points: number;
251
+ duration: number;
252
+ };
253
+ };
254
+ }
255
+ interface QueryFilter {
256
+ contactId?: string;
257
+ descriptorId?: string;
258
+ status?: MessageStatus | MessageStatus[];
259
+ state?: MessageState | MessageState[];
260
+ size?: number;
261
+ skip?: number;
262
+ }
263
+ interface DispatcherMetrics {
264
+ total: number;
265
+ byState: {
266
+ [key in MessageState]?: number;
267
+ };
268
+ byStatus: {
269
+ [key in MessageStatus]?: number;
270
+ };
271
+ cumulative: {
272
+ dispatched: number;
273
+ delivered: number;
274
+ failed: number;
275
+ };
276
+ }
277
+ interface DispatcherManifest {
278
+ version: string;
279
+ createdAt: string;
280
+ updatedAt: string;
281
+ }
282
+ /**
283
+ * @deprecated Use DispatcherOptions instead
284
+ */
285
+ type MessageDispatcherOptions = DispatcherOptions;
286
+
287
+ /**
288
+ * Blip - Low-level client wrapper for Blip Platform API interactions
289
+ *
290
+ * Responsibilities:
291
+ * - Send messages to contacts via Blip HTTP API
292
+ * - Merge contact metadata (custom fields)
293
+ * - Send analytics events to Blip
294
+ * - Manage bot conversation state transitions
295
+ * - Check message delivery status
296
+ */
297
+
298
+ declare class Blip {
299
+ private client;
300
+ /**
301
+ * Create a new Blip instance
302
+ * @param contract - Blip contract ID (without https:// prefix)
303
+ * @param key - Blip API key
304
+ * @param timeout - Request timeout in milliseconds (default: 30000)
305
+ */
306
+ constructor(contract: string, key: string, timeout?: number);
307
+ /**
308
+ * Send a command to the Blip API
309
+ */
310
+ private postCommand;
311
+ /**
312
+ * Send a message through the Blip API
313
+ */
314
+ private postMessage;
315
+ /**
316
+ * Merge contact metadata (custom fields)
317
+ * @param contactId - Contact identifier
318
+ * @param data - Key-value pairs to merge into contact
319
+ */
320
+ mergeContact(contactId: string, data: Omit<Vnd.Iris.Contact, 'identity'>): Promise<void>;
321
+ /**
322
+ * Send a message to a contact
323
+ * @param contactId - Contact identifier
324
+ * @param message - Message data to send
325
+ * @param id - Optional message ID (if not provided, a new one is generated)
326
+ * @returns message ID
327
+ */
328
+ sendMessage(contactId: string, message: MessageData, id?: string): Promise<string>;
329
+ /**
330
+ * Get raw dispatch state from Blip notifications
331
+ * @param messageId - Message ID to check
332
+ * @param contactId - Contact identifier to filter notifications
333
+ * @returns DispatchState or null if not found
334
+ */
335
+ getDispatchState(messageId: string, contactId: string): Promise<DispatchState | null>;
336
+ /**
337
+ * Get the first message received after a specific message ID
338
+ * @param contactId - Contact identifier
339
+ * @param messageId - Message ID to use as anchor
340
+ * @returns ThreadMessage or null if no message found
341
+ */
342
+ getMessageAfter(contactId: string, messageId: string): Promise<Vnd.Iris.ThreadMessage | null>;
343
+ /**
344
+ * Send an analytics event to Blip
345
+ * @param contactId - Contact identifier
346
+ * @param category - Event category
347
+ * @param action - Event action
348
+ * @param extras - Additional event data
349
+ */
350
+ sendEvent(contactId: string, category: string, action: string, extras: Record<string, string>): Promise<void>;
351
+ /**
352
+ * Set the bot conversation state for a contact
353
+ * @param contactId - Contact identifier
354
+ * @param botId - Bot identifier (short name)
355
+ * @param stateId - State identifier (default: "onboarding")
356
+ */
357
+ setState(contactId: string, botId: string, stateId?: string): Promise<void>;
358
+ }
359
+ /**
360
+ * Custom error class for Blip errors
361
+ */
362
+ declare class BlipError extends Error {
363
+ code: number;
364
+ constructor(message: string, code: number);
365
+ }
366
+
367
+ type CallbackMap = Partial<Record<CallbackEvent, (message: Message, api: Blip, dispatcherId: string) => void>>;
368
+ interface DispatcherDescriptorOptions extends MessageOptions {
369
+ toContactId?: (contactId: string) => string;
370
+ }
371
+ declare class DispatcherDescriptor {
372
+ readonly id: string;
373
+ private transformFn;
374
+ private callbacks;
375
+ private options?;
376
+ private contactIdTransform;
377
+ constructor(id: string, transform: (payload: MessagePayload) => MessageData, options?: DispatcherDescriptorOptions);
378
+ transform(payload: MessagePayload): MessageData;
379
+ toContactId(contactId: string): string;
380
+ get messageOptions(): MessageOptions | undefined;
381
+ on(event: CallbackEvent, callback: (message: Message, api: Blip, dispatcherId: string) => void): this;
382
+ emit(event: CallbackEvent, message: Message, api: Blip, dispatcherId: string): void;
383
+ }
384
+
385
+ declare class DispatcherRepository {
386
+ private static readonly INDEXED_STATUSES;
387
+ private static readonly INDEXED_STATES;
388
+ private client;
389
+ private keyPrefix;
390
+ constructor(dispatcherId: string, redisUrl: string);
391
+ setup(): Promise<void>;
392
+ teardown(): Promise<void>;
393
+ get redis(): IORedis;
394
+ getManifestKey(): string;
395
+ getKey(messageId: string): string;
396
+ getStateKey(state: MessageState): string;
397
+ getStatusKey(status: MessageStatus): string;
398
+ getContactKey(contactId: string): string;
399
+ getDescriptorKey(descriptorId: string): string;
400
+ getQueueKey(name: 'scheduled' | 'queued' | 'dispatched' | 'expiration' | 'retention'): string;
401
+ upsertMessage(message: Message, ttl?: number): Promise<void>;
402
+ getMessage(messageId: string): Promise<Message | null>;
403
+ getMessages(filter: {
404
+ status?: MessageStatus;
405
+ state?: MessageState;
406
+ size?: number;
407
+ skip?: number;
408
+ }): Promise<Message[]>;
409
+ getQueueSize(): Promise<number>;
410
+ evictOldest(count: number): Promise<number>;
411
+ getExpiredMessages(count?: number): Promise<string[]>;
412
+ getRetentionMessages(count?: number): Promise<string[]>;
413
+ incrementMetric(key: string, value?: number): Promise<number>;
414
+ getMetric(key: string): Promise<number>;
415
+ deleteMessage(messageId: string): Promise<void>;
416
+ private deleteMessageData;
417
+ countMessages(filter: {
418
+ status?: MessageStatus;
419
+ state?: MessageState;
420
+ }): Promise<number>;
421
+ getMetrics(descriptorId?: string): Promise<any>;
422
+ getDescriptors(): Promise<{
423
+ id: string;
424
+ count: number;
425
+ }[]>;
426
+ writeManifest(manifest: DispatcherManifest): Promise<void>;
427
+ getManifest(): Promise<DispatcherManifest | null>;
428
+ }
429
+
430
+ declare class DispatcherQuery {
431
+ private repository;
432
+ constructor(repository: DispatcherRepository);
433
+ private get client();
434
+ query(filter: QueryFilter): Promise<Message[]>;
435
+ private cleanupIndices;
436
+ }
437
+
438
+ declare class Dispatcher {
439
+ readonly id: string;
440
+ private repository;
441
+ private stateMachine;
442
+ private api;
443
+ private callbacks;
444
+ private descriptors;
445
+ private queue;
446
+ private worker;
447
+ private redis;
448
+ private queueName;
449
+ private maxRetries;
450
+ private retryIntervals;
451
+ private timeouts;
452
+ private retention;
453
+ private timeoutTimer;
454
+ private pollingIntervals;
455
+ private isRunning;
456
+ private setupCompleted;
457
+ readonly query: DispatcherQuery;
458
+ constructor(id: string, repository: DispatcherRepository, connection: ConnectionConfig, options?: DispatcherOptions);
459
+ setup(): Promise<void>;
460
+ teardown(): Promise<void>;
461
+ on(event: CallbackEvent, callback: (message: Message, api: Blip, dispatcherId: string) => void): this;
462
+ getMetrics(): Promise<DispatcherMetrics>;
463
+ private emit;
464
+ send(descriptor: DispatcherDescriptor, contactId: string, payload: MessagePayload, options?: DispatchMessageOptions): Promise<Message>;
465
+ cancel(messageId: string): Promise<boolean>;
466
+ private processJob;
467
+ private handleSendJob;
468
+ private handlePostSendOperations;
469
+ private handleCheckJob;
470
+ private checkAndHandleTimeout;
471
+ private handleTimeout;
472
+ private startTimeoutMonitor;
473
+ private rescheduleCheck;
474
+ private handleDispatchFailure;
475
+ private calculateScheduledTime;
476
+ private isWithinShifts;
477
+ private findNextShiftTime;
478
+ private getStatusRank;
479
+ }
480
+
481
+ interface MonitorRule {
482
+ type: 'failure_rate' | 'queue_size';
483
+ threshold: number;
484
+ window?: number;
485
+ debounce?: number;
486
+ }
487
+ interface MonitorOptions {
488
+ interval?: number;
489
+ rules: MonitorRule[];
490
+ historySize?: number;
491
+ }
492
+ type MonitorAlert = {
493
+ type: string;
494
+ message: string;
495
+ level: 'warning' | 'critical';
496
+ details: any;
497
+ timestamp: string;
498
+ };
499
+ declare class DispatcherMonitor extends EventEmitter {
500
+ private id;
501
+ private repository;
502
+ private options;
503
+ private queue;
504
+ private worker;
505
+ private queueName;
506
+ private history;
507
+ private lastAlerts;
508
+ private activeAlerts;
509
+ private isRunning;
510
+ constructor(id: string, repository: DispatcherRepository, options: MonitorOptions);
511
+ start(): Promise<void>;
512
+ stop(): Promise<void>;
513
+ /**
514
+ * Independent metrics collection directly from Repository
515
+ */
516
+ private collectMetrics;
517
+ private check;
518
+ private cleanHistory;
519
+ private evaluateRule;
520
+ private isDebounced;
521
+ private emitAlert;
522
+ private resolveAlert;
523
+ private findSnapshotAt;
524
+ }
525
+
526
+ type LogFunction = (...args: any[]) => void;
527
+ interface Logger {
528
+ debug: LogFunction;
529
+ info: LogFunction;
530
+ warn: LogFunction;
531
+ error: LogFunction;
532
+ }
533
+ /**
534
+ * Creates a logger with a specific scope.
535
+ *
536
+ * @param scope - The scope for the logger (e.g., 'blip-api', 'dispatcher').
537
+ * @returns A logger object with methods for each log level.
538
+ */
539
+ declare function getLogger(scope: string): Logger;
540
+ /**
541
+ * Enables logging for a specific scope and level.
542
+ * This is a convenience function to programmatically enable logging,
543
+ * equivalent to setting the DEBUG environment variable.
544
+ *
545
+ * @param scope - The scope to enable (e.g., 'blip-api').
546
+ * @param level - The minimum log level to enable (e.g., 'info').
547
+ */
548
+ declare function enableLogger(namespaces: string): void;
549
+
550
+ export { Blip, type BlipConfig, BlipError, type CallbackEvent, type CallbackMap, type ConnectionConfig, type Contact, type DateInterval, type DispatchMessageOptions, DispatchState, Dispatcher, DispatcherDescriptor, type DispatcherDescriptorOptions, type DispatcherManifest, type DispatcherMetrics, DispatcherMonitor, type DispatcherOptions, DispatcherRepository, type Intent, type Message, type MessageData, type MessageDispatcherOptions, type MessageOptions, type MessagePayload, MessageState, MessageStatus, type MonitorAlert, type MonitorOptions, type MonitorRule, type PartiallyOptional, type PartiallyRequiredStrict, type QueryFilter, type Shift, Vnd, Weekdays, enableLogger, getLogger };