@cldmv/holdmytask 1.3.1 → 1.5.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/README.md CHANGED
@@ -304,7 +304,7 @@ Adds a task to the queue.
304
304
  - `start` (number) - Milliseconds from now when the task should be ready to run (convenience for timestamp calculation)
305
305
  - `coalescingKey` (string) - Tasks with the same coalescing key can be merged for efficiency
306
306
  - `mustRunBy` (number) - Absolute timestamp by which the task must execute (overrides coalescing delays)
307
- - `metadata` (any) - Custom metadata
307
+ - `metadata` (any) - Custom metadata attached to the task. Individual metadata is always directly accessible via the returned task handle
308
308
 
309
309
  **Returns:** TaskHandle object with:
310
310
 
@@ -315,9 +315,51 @@ Adds a task to the queue.
315
315
  - `finishedAt` - When task finished
316
316
  - `result` - Task result (if completed)
317
317
  - `error` - Task error (if failed)
318
+ - `metadata` - Custom metadata attached to this task
319
+ - `coalescingInfo` - Coalescing group information (null for non-coalesced tasks)
318
320
 
319
321
  When `callback` is omitted, returns a Promise that resolves with the task result or rejects with an error.
320
322
 
323
+ #### Accessing Task Metadata
324
+
325
+ Every task handle provides direct access to its metadata and coalescing information:
326
+
327
+ ```javascript
328
+ // Create a task with metadata
329
+ const task = queue.enqueue(
330
+ async () => {
331
+ return "task completed";
332
+ },
333
+ {
334
+ metadata: { userId: 123, action: "save", document: "report.pdf" },
335
+ coalescingKey: "user-actions"
336
+ }
337
+ );
338
+
339
+ // Direct access to metadata - works for both regular and coalesced tasks
340
+ console.log(task.metadata);
341
+ // Output: { userId: 123, action: 'save', document: 'report.pdf' }
342
+
343
+ // For coalesced tasks, get information about the coalescing group
344
+ if (task.coalescingInfo) {
345
+ console.log("Coalescing key:", task.coalescingInfo.coalescingKey);
346
+ console.log("Group size:", task.coalescingInfo.taskCount);
347
+ console.log("All task metadata in group:", task.coalescingInfo.allTaskMetadata);
348
+ }
349
+
350
+ // Works the same way with Promise API
351
+ const result = await task;
352
+ console.log("Still accessible after completion:", task.metadata);
353
+ ```
354
+
355
+ **Key Points:**
356
+
357
+ - `task.metadata` - Returns the original metadata you attached to the task
358
+ - `task.coalescingInfo` - Returns coalescing group details (null for non-coalesced tasks)
359
+ - Available on both callback-style task handles and Promise-style task handles
360
+ - Accessible before, during, and after task execution
361
+ - For coalesced tasks, each task retains its individual metadata
362
+
321
363
  #### Method Aliases
322
364
 
323
365
  For compatibility with common queue system naming conventions, the following aliases are available:
@@ -388,6 +430,152 @@ queue.enqueue(task2, { id: "duplicate" }); // throws: Task ID "duplicate" alread
388
430
  - `getCoalescingConfig(coalescingKey, taskOptions?)` - Get effective configuration for a specific coalescing key
389
431
  - `getCoalescingConfigurations()` - Get all configured coalescing keys and their settings
390
432
 
433
+ #### Coalescing Group Inspection Methods
434
+
435
+ - `getCoalescingGroup(coalescingKey, groupId?)` - Get detailed information about coalescing groups
436
+ - `coalescingKey` (string) - The coalescing key to query
437
+ - `groupId` (string, optional) - Specific group ID, or omit to get all groups for the key
438
+ - Returns group info with task details and metadata
439
+ - `getCoalescingGroupMetadata(coalescingKey, groupId?)` - Get metadata from all tasks in coalescing groups
440
+ - Returns array of `{ taskId, groupId, metadata }` objects
441
+ - `getCoalescingGroupsSummary()` - Get summary of all active coalescing groups
442
+ - Returns object with `{ [coalescingKey]: { groupCount, totalTasks } }`
443
+ - `findCoalescingGroupByTaskId(taskId)` - Find which coalescing group contains a specific task
444
+ - Returns group info including the task's metadata and other group members
445
+
446
+ **Note:** For most use cases, the direct `task.metadata` and `task.coalescingInfo` properties provide easier access to task information. The coalescing group inspection methods are useful for bulk operations, monitoring, debugging, or when you need to query groups by coalescing key without having individual task references.
447
+
448
+ ```javascript
449
+ // Example: Direct access to task metadata and coalescing info
450
+ const task1 = queue.enqueue(async () => "result", {
451
+ coalescingKey: "user-action",
452
+ metadata: { userId: 123, action: "save" }
453
+ });
454
+
455
+ const task2 = queue.enqueue(async () => "result", {
456
+ coalescingKey: "user-action",
457
+ metadata: { userId: 456, action: "delete" }
458
+ });
459
+
460
+ // Direct access - no additional API calls needed!
461
+ console.log("Task 1 metadata:", task1.metadata); // { userId: 123, action: 'save' }
462
+ console.log("Task 2 metadata:", task2.metadata); // { userId: 456, action: 'delete' }
463
+
464
+ // Access coalescing information directly from the task
465
+ console.log("Coalescing info:", task1.coalescingInfo);
466
+ // {
467
+ // coalescingKey: 'user-action',
468
+ // groupId: '1',
469
+ // representativeId: '3',
470
+ // taskCount: 2,
471
+ // allTaskMetadata: [
472
+ // { id: '1', metadata: { userId: 123, action: 'save' } },
473
+ // { id: '2', metadata: { userId: 456, action: 'delete' } }
474
+ // ]
475
+ // }
476
+
477
+ // Advanced: Use inspection methods for bulk operations
478
+ const metadata = queue.getCoalescingGroupMetadata("user-action");
479
+ const groupInfo = queue.getCoalescingGroup("user-action");
480
+ const taskGroup = queue.findCoalescingGroupByTaskId(task1.id);
481
+ ```
482
+
483
+ ### Debug and Inspection Methods
484
+
485
+ For debugging queue behavior, troubleshooting scheduler issues, or monitoring queue state in production, HoldMyTask provides comprehensive inspection methods:
486
+
487
+ #### Quick Debug Output
488
+
489
+ ```javascript
490
+ // Log comprehensive queue state to console
491
+ queue.debugLog(); // Basic summary
492
+ queue.debugLog(true); // Detailed task information
493
+
494
+ // Example output:
495
+ // === HoldMyTask Debug Information ===
496
+ // Timestamp: 2025-11-14T17:45:32.123Z
497
+ // Status: ACTIVE
498
+ // Smart Scheduling: ON
499
+ // Concurrency: 2/5
500
+ //
501
+ // --- Queue State ---
502
+ // Total Tasks: 7
503
+ // Pending: 3
504
+ // Ready: 2
505
+ // Running: 2
506
+ //
507
+ // --- Timer State ---
508
+ // Interval: None
509
+ // Timeout: Active (15)
510
+ // Next Run: 1250ms
511
+ ```
512
+
513
+ #### Detailed Inspection
514
+
515
+ ```javascript
516
+ // Get comprehensive queue state
517
+ const state = queue.inspect();
518
+ console.log("Total tasks:", state.totals.totalTasks);
519
+ console.log("Running tasks:", state.queues.running.tasks);
520
+ console.log("Next scheduled run:", state.timers.nextRunIn, "ms");
521
+
522
+ // Inspect just the tasks
523
+ const tasks = queue.inspectTasks();
524
+ console.log("Tasks by priority:", tasks.byPriority);
525
+ console.log("Tasks by coalescing key:", tasks.byCoalescingKey);
526
+
527
+ // Inspect scheduler state
528
+ const scheduler = queue.inspectScheduler();
529
+ console.log("Can run task now:", scheduler.nextTask?.canRunNow);
530
+ console.log("Available slots:", scheduler.availableSlots);
531
+ console.log("Active delays:", scheduler.delays.count);
532
+
533
+ // Inspect timers specifically
534
+ const timers = queue.inspectTimers();
535
+ console.log("Scheduler interval active:", timers.schedulerInterval.active);
536
+ console.log("Next run in:", timers.nextRunIn, "ms");
537
+ ```
538
+
539
+ #### Inspection Methods
540
+
541
+ - `inspect()` - Get comprehensive queue state including tasks, timers, scheduler, and coalescing information
542
+ - `inspectTasks()` - Get detailed task information grouped by status, priority, and coalescing key
543
+ - `inspectScheduler()` - Get scheduler state, timing information, and next task details
544
+ - `inspectTimers()` - Get timer state and scheduling information
545
+ - `debugLog(detailed?)` - Log formatted debug information to console
546
+
547
+ **Use Cases:**
548
+
549
+ - **Development**: Debug why tasks aren't running or understand queue behavior
550
+ - **Production Monitoring**: Track queue health and performance metrics
551
+ - **Troubleshooting**: Identify scheduler issues, timer problems, or concurrency bottlenecks
552
+ - **Testing**: Verify queue state in automated tests
553
+
554
+ ```javascript
555
+ // Example: Debug scheduler restart issue
556
+ const queue = new HoldMyTask({ concurrency: 2 });
557
+
558
+ // Add some tasks
559
+ queue.enqueue(async () => "task1");
560
+ queue.enqueue(async () => "task2", { priority: 2, start: 5000 });
561
+
562
+ // Check initial state
563
+ console.log("Initial state:");
564
+ queue.debugLog();
565
+
566
+ // Wait for drain
567
+ queue.on("drain", () => {
568
+ console.log("After drain:");
569
+ queue.debugLog();
570
+
571
+ // Add new task
572
+ queue.enqueue(async () => "task3");
573
+
574
+ console.log("After adding new task:");
575
+ queue.debugLog();
576
+ });
577
+ ```
578
+
391
579
  ### Events
392
580
 
393
581
  ```javascript
@@ -519,6 +519,12 @@ export class HoldMyTask extends EventEmitter {
519
519
  },
520
520
  get error() {
521
521
  return tasks.get(id)?.error;
522
+ },
523
+ get metadata() {
524
+ return tasks.get(id)?.metadata;
525
+ },
526
+ get coalescingInfo() {
527
+ return null; // Regular tasks don't have coalescing info
522
528
  }
523
529
  };
524
530
 
@@ -570,6 +576,17 @@ export class HoldMyTask extends EventEmitter {
570
576
  },
571
577
  enumerable: true
572
578
  });
579
+ Object.defineProperty(promise, "metadata", {
580
+ get: () => {
581
+ const currentItem = this.tasks.get(id);
582
+ return currentItem ? currentItem.metadata : undefined;
583
+ },
584
+ enumerable: true
585
+ });
586
+ Object.defineProperty(promise, "coalescingInfo", {
587
+ get: () => null, // Regular tasks don't have coalescing info
588
+ enumerable: true
589
+ });
573
590
 
574
591
  return promise;
575
592
  }
@@ -1110,6 +1127,29 @@ export class HoldMyTask extends EventEmitter {
1110
1127
  },
1111
1128
  get error() {
1112
1129
  return item.error;
1130
+ },
1131
+ get metadata() {
1132
+ // For coalescing tasks, get metadata from coalescing group
1133
+ if (item.coalescingKey) {
1134
+ const groupInfo = this.findCoalescingGroupByTaskId(item.id);
1135
+ return groupInfo ? groupInfo.task.metadata : item.metadata;
1136
+ }
1137
+ return item.metadata;
1138
+ },
1139
+ get coalescingInfo() {
1140
+ if (!item.coalescingKey) {
1141
+ return null;
1142
+ }
1143
+ const groupInfo = this.findCoalescingGroupByTaskId(item.id);
1144
+ return groupInfo
1145
+ ? {
1146
+ coalescingKey: groupInfo.coalescingKey,
1147
+ groupId: groupInfo.groupId,
1148
+ representativeId: groupInfo.representativeId,
1149
+ taskCount: groupInfo.groupTasks.length,
1150
+ allTaskMetadata: groupInfo.groupTasks.map((t) => ({ id: t.id, metadata: t.metadata }))
1151
+ }
1152
+ : null;
1113
1153
  }
1114
1154
  };
1115
1155
 
@@ -1143,6 +1183,35 @@ export class HoldMyTask extends EventEmitter {
1143
1183
  get: () => (promise._error !== undefined ? promise._error : item.error),
1144
1184
  enumerable: true
1145
1185
  });
1186
+ Object.defineProperty(promise, "metadata", {
1187
+ get: () => {
1188
+ // For coalescing tasks, get metadata from coalescing group
1189
+ if (item.coalescingKey) {
1190
+ const groupInfo = this.findCoalescingGroupByTaskId(item.id);
1191
+ return groupInfo ? groupInfo.task.metadata : item.metadata;
1192
+ }
1193
+ return item.metadata;
1194
+ },
1195
+ enumerable: true
1196
+ });
1197
+ Object.defineProperty(promise, "coalescingInfo", {
1198
+ get: () => {
1199
+ if (!item.coalescingKey) {
1200
+ return null;
1201
+ }
1202
+ const groupInfo = this.findCoalescingGroupByTaskId(item.id);
1203
+ return groupInfo
1204
+ ? {
1205
+ coalescingKey: groupInfo.coalescingKey,
1206
+ groupId: groupInfo.groupId,
1207
+ representativeId: groupInfo.representativeId,
1208
+ taskCount: groupInfo.groupTasks.length,
1209
+ allTaskMetadata: groupInfo.groupTasks.map((t) => ({ id: t.id, metadata: t.metadata }))
1210
+ }
1211
+ : null;
1212
+ },
1213
+ enumerable: true
1214
+ });
1146
1215
 
1147
1216
  return promise;
1148
1217
  }
@@ -1324,6 +1393,181 @@ export class HoldMyTask extends EventEmitter {
1324
1393
  return this.running.size;
1325
1394
  }
1326
1395
 
1396
+ /**
1397
+ * Gets information about a coalescing group by key and group ID.
1398
+ * @param {string} coalescingKey - The coalescing key
1399
+ * @param {string} [groupId] - Optional group ID. If omitted, returns all groups for the key
1400
+ * @returns {Object|Array|null} Group info object, array of groups, or null if not found
1401
+ * @example
1402
+ * // Get all groups for a coalescing key
1403
+ * const groups = queue.getCoalescingGroup('ui.update');
1404
+ *
1405
+ * // Get specific group by ID
1406
+ * const group = queue.getCoalescingGroup('ui.update', '1');
1407
+ * console.log(group.tasks.size); // Number of tasks in group
1408
+ *
1409
+ * // Access individual task metadata
1410
+ * for (const [taskId, task] of group.tasks) {
1411
+ * console.log(`Task ${taskId}:`, task.metadata);
1412
+ * }
1413
+ */
1414
+ getCoalescingGroup(coalescingKey, groupId = null) {
1415
+ const groups = this.coalescingGroups.get(coalescingKey);
1416
+ if (!groups || groups.length === 0) {
1417
+ return null;
1418
+ }
1419
+
1420
+ if (groupId === null) {
1421
+ // Return all groups for the key
1422
+ return groups.map((group) => ({
1423
+ coalescingKey: group.coalescingKey,
1424
+ groupId: group.groupId,
1425
+ representativeId: group.representativeId,
1426
+ windowEnd: group.windowEnd,
1427
+ mustRunBy: group.mustRunBy,
1428
+ taskCount: group.tasks.size,
1429
+ tasks: Array.from(group.tasks.entries()).map(([id, task]) => ({
1430
+ id,
1431
+ metadata: task.metadata,
1432
+ status: task.status,
1433
+ priority: task.priority,
1434
+ readyAt: task.readyAt,
1435
+ coalescingKey: task.coalescingKey
1436
+ }))
1437
+ }));
1438
+ }
1439
+
1440
+ // Find specific group by ID
1441
+ const group = groups.find((g) => g.groupId === groupId);
1442
+ if (!group) {
1443
+ return null;
1444
+ }
1445
+
1446
+ return {
1447
+ coalescingKey: group.coalescingKey,
1448
+ groupId: group.groupId,
1449
+ representativeId: group.representativeId,
1450
+ windowEnd: group.windowEnd,
1451
+ mustRunBy: group.mustRunBy,
1452
+ taskCount: group.tasks.size,
1453
+ tasks: Array.from(group.tasks.entries()).map(([id, task]) => ({
1454
+ id,
1455
+ metadata: task.metadata,
1456
+ status: task.status,
1457
+ priority: task.priority,
1458
+ readyAt: task.readyAt,
1459
+ coalescingKey: task.coalescingKey
1460
+ }))
1461
+ };
1462
+ }
1463
+
1464
+ /**
1465
+ * Gets metadata for all tasks in a coalescing group.
1466
+ * @param {string} coalescingKey - The coalescing key
1467
+ * @param {string} [groupId] - Optional group ID. If omitted, returns metadata from all groups for the key
1468
+ * @returns {Array} Array of metadata objects with task IDs
1469
+ * @example
1470
+ * // Get metadata from all groups for a key
1471
+ * const allMetadata = queue.getCoalescingGroupMetadata('ui.update');
1472
+ *
1473
+ * // Get metadata from specific group
1474
+ * const groupMetadata = queue.getCoalescingGroupMetadata('ui.update', '1');
1475
+ *
1476
+ * // Example output:
1477
+ * // [
1478
+ * // { taskId: '123', metadata: { userId: 100, action: 'save' } },
1479
+ * // { taskId: '124', metadata: { userId: 200, action: 'delete' } }
1480
+ * // ]
1481
+ */
1482
+ getCoalescingGroupMetadata(coalescingKey, groupId = null) {
1483
+ const groups = this.coalescingGroups.get(coalescingKey);
1484
+ if (!groups || groups.length === 0) {
1485
+ return [];
1486
+ }
1487
+
1488
+ const targetGroups = groupId ? groups.filter((g) => g.groupId === groupId) : groups;
1489
+ const metadata = [];
1490
+
1491
+ for (const group of targetGroups) {
1492
+ for (const [taskId, task] of group.tasks) {
1493
+ metadata.push({
1494
+ taskId,
1495
+ groupId: group.groupId,
1496
+ metadata: task.metadata
1497
+ });
1498
+ }
1499
+ }
1500
+
1501
+ return metadata;
1502
+ }
1503
+
1504
+ /**
1505
+ * Gets a summary of all active coalescing groups.
1506
+ * @returns {Object} Summary object with coalescing key stats
1507
+ * @example
1508
+ * const summary = queue.getCoalescingGroupsSummary();
1509
+ * console.log(summary);
1510
+ * // {
1511
+ * // 'ui.update': { groupCount: 2, totalTasks: 5 },
1512
+ * // 'api.batch': { groupCount: 1, totalTasks: 3 }
1513
+ * // }
1514
+ */
1515
+ getCoalescingGroupsSummary() {
1516
+ const summary = {};
1517
+
1518
+ for (const [coalescingKey, groups] of this.coalescingGroups) {
1519
+ const totalTasks = groups.reduce((sum, group) => sum + group.tasks.size, 0);
1520
+ summary[coalescingKey] = {
1521
+ groupCount: groups.length,
1522
+ totalTasks
1523
+ };
1524
+ }
1525
+
1526
+ return summary;
1527
+ }
1528
+
1529
+ /**
1530
+ * Finds the coalescing group that contains a specific task ID.
1531
+ * @param {string|number} taskId - The task ID to search for
1532
+ * @returns {Object|null} Group information including the task's metadata, or null if not found
1533
+ * @example
1534
+ * const groupInfo = queue.findCoalescingGroupByTaskId('123');
1535
+ * if (groupInfo) {
1536
+ * console.log('Task is in group:', groupInfo.groupId);
1537
+ * console.log('Task metadata:', groupInfo.task.metadata);
1538
+ * console.log('Other tasks in group:', groupInfo.groupTasks.length);
1539
+ * }
1540
+ */
1541
+ findCoalescingGroupByTaskId(taskId) {
1542
+ for (const [coalescingKey, groups] of this.coalescingGroups) {
1543
+ for (const group of groups) {
1544
+ const task = group.tasks.get(taskId);
1545
+ if (task) {
1546
+ return {
1547
+ coalescingKey,
1548
+ groupId: group.groupId,
1549
+ representativeId: group.representativeId,
1550
+ windowEnd: group.windowEnd,
1551
+ mustRunBy: group.mustRunBy,
1552
+ task: {
1553
+ id: taskId,
1554
+ metadata: task.metadata,
1555
+ status: task.status,
1556
+ priority: task.priority,
1557
+ readyAt: task.readyAt
1558
+ },
1559
+ groupTasks: Array.from(group.tasks.entries()).map(([id, t]) => ({
1560
+ id,
1561
+ metadata: t.metadata,
1562
+ status: t.status
1563
+ }))
1564
+ };
1565
+ }
1566
+ }
1567
+ }
1568
+ return null;
1569
+ }
1570
+
1327
1571
  /**
1328
1572
  * Destroys the queue, canceling all tasks and stopping the scheduler.
1329
1573
  * Once destroyed, the queue cannot be reused.
@@ -2122,4 +2366,396 @@ export class HoldMyTask extends EventEmitter {
2122
2366
  hasTask(id) {
2123
2367
  return this.has(id);
2124
2368
  }
2369
+
2370
+ // ========================================================================================
2371
+ // DEBUG AND INSPECTION METHODS
2372
+ // ========================================================================================
2373
+
2374
+ /**
2375
+ * Get detailed information about the current queue state for debugging.
2376
+ * @returns {Object} Comprehensive queue state information
2377
+ */
2378
+ inspect() {
2379
+ const now = this.now();
2380
+
2381
+ // Get all tasks from different queues
2382
+ const pendingTasks = [...this.pendingHeap.heap].map((task) => ({
2383
+ id: task.id,
2384
+ priority: task.priority,
2385
+ readyAt: task.readyAt,
2386
+ readyIn: task.readyAt - now,
2387
+ coalescingKey: task.coalescingKey,
2388
+ metadata: task.metadata,
2389
+ status: "pending"
2390
+ }));
2391
+
2392
+ const readyTasks = [...this.readyHeap.heap].map((task) => ({
2393
+ id: task.id,
2394
+ priority: task.priority,
2395
+ coalescingKey: task.coalescingKey,
2396
+ metadata: task.metadata,
2397
+ status: "ready"
2398
+ }));
2399
+
2400
+ const runningTasks = Array.from(this.running).map((task) => ({
2401
+ id: task.id,
2402
+ priority: task.priority,
2403
+ coalescingKey: task.coalescingKey,
2404
+ metadata: task.metadata,
2405
+ startedAt: task.startedAt,
2406
+ runningFor: now - task.startedAt,
2407
+ status: "running"
2408
+ }));
2409
+
2410
+ // Get timer information
2411
+ const timerInfo = this.inspectTimers();
2412
+
2413
+ // Get scheduler state
2414
+ const schedulerState = {
2415
+ isActive: this.isActive,
2416
+ isPaused: !this.isActive,
2417
+ smartScheduling: this.options.smartScheduling,
2418
+ concurrency: this.options.concurrency,
2419
+ currentConcurrency: this.running.size,
2420
+ tick: this.options.tick,
2421
+ nextActiveDelay: this.nextAvailableTime > now ? this.nextAvailableTime - now : null
2422
+ };
2423
+
2424
+ // Get coalescing information
2425
+ const coalescingInfo = {};
2426
+ for (const [key, groups] of this.coalescingGroups.entries()) {
2427
+ coalescingInfo[key] = {
2428
+ groupCount: groups.size,
2429
+ totalTasks: Array.from(groups.values()).reduce((sum, group) => sum + group.tasks.size, 0),
2430
+ groups: Array.from(groups.entries()).map(([groupId, group]) => ({
2431
+ groupId,
2432
+ taskCount: group.tasks.size,
2433
+ representativeId: group.representativeId,
2434
+ tasks: Array.from(group.tasks.entries()).map(([_, task]) => ({
2435
+ id: task.id,
2436
+ metadata: task.metadata
2437
+ }))
2438
+ }))
2439
+ };
2440
+ }
2441
+
2442
+ return {
2443
+ timestamp: now,
2444
+ scheduler: schedulerState,
2445
+ timers: timerInfo,
2446
+ queues: {
2447
+ pending: {
2448
+ count: pendingTasks.length,
2449
+ tasks: pendingTasks
2450
+ },
2451
+ ready: {
2452
+ count: readyTasks.length,
2453
+ tasks: readyTasks
2454
+ },
2455
+ running: {
2456
+ count: runningTasks.length,
2457
+ tasks: runningTasks
2458
+ }
2459
+ },
2460
+ totals: {
2461
+ totalTasks: pendingTasks.length + readyTasks.length + runningTasks.length,
2462
+ pendingTasks: pendingTasks.length,
2463
+ readyTasks: readyTasks.length,
2464
+ runningTasks: runningTasks.length
2465
+ },
2466
+ coalescing: coalescingInfo,
2467
+ delays: {
2468
+ activeDelays: this.nextAvailableTime > now ? 1 : 0,
2469
+ delayDetails:
2470
+ this.nextAvailableTime > now
2471
+ ? [
2472
+ {
2473
+ priority: this.lastCompletedPriority,
2474
+ expiresAt: this.nextAvailableTime,
2475
+ expiresIn: this.nextAvailableTime - now
2476
+ }
2477
+ ]
2478
+ : []
2479
+ }
2480
+ };
2481
+ }
2482
+
2483
+ /**
2484
+ * Get information about active timers and scheduler state.
2485
+ * @returns {Object} Timer and scheduler information
2486
+ */
2487
+ inspectTimers() {
2488
+ const now = this.now();
2489
+
2490
+ return {
2491
+ schedulerInterval: {
2492
+ id: this.schedulerInterval,
2493
+ active: this.schedulerInterval !== null,
2494
+ type: "interval"
2495
+ },
2496
+ schedulerTimeout: {
2497
+ id: this.schedulerTimeout,
2498
+ active: this.schedulerTimeout !== null,
2499
+ type: "timeout"
2500
+ },
2501
+ nextScheduledRun: this.nextScheduledRun,
2502
+ nextRunIn: this.nextScheduledRun ? this.nextScheduledRun - now : null,
2503
+ smartScheduling: this.options.smartScheduling,
2504
+ tickInterval: this.options.tick
2505
+ };
2506
+ }
2507
+
2508
+ /**
2509
+ * Get a summary of all queued tasks by status.
2510
+ * @returns {Object} Task summary by status
2511
+ */
2512
+ inspectTasks() {
2513
+ const now = this.now();
2514
+
2515
+ const summary = {
2516
+ pending: [],
2517
+ ready: [],
2518
+ running: [],
2519
+ byPriority: {},
2520
+ byCoalescingKey: {},
2521
+ total: 0
2522
+ };
2523
+
2524
+ // Process pending tasks
2525
+ [...this.pendingHeap.heap].forEach((task) => {
2526
+ const taskInfo = {
2527
+ id: task.id,
2528
+ priority: task.priority,
2529
+ readyAt: task.readyAt,
2530
+ readyIn: task.readyAt - now,
2531
+ coalescingKey: task.coalescingKey,
2532
+ metadata: task.metadata
2533
+ };
2534
+ summary.pending.push(taskInfo);
2535
+ summary.total++;
2536
+
2537
+ // Group by priority
2538
+ if (!summary.byPriority[task.priority]) {
2539
+ summary.byPriority[task.priority] = { pending: 0, ready: 0, running: 0 };
2540
+ }
2541
+ summary.byPriority[task.priority].pending++;
2542
+
2543
+ // Group by coalescing key
2544
+ if (task.coalescingKey) {
2545
+ if (!summary.byCoalescingKey[task.coalescingKey]) {
2546
+ summary.byCoalescingKey[task.coalescingKey] = { pending: 0, ready: 0, running: 0 };
2547
+ }
2548
+ summary.byCoalescingKey[task.coalescingKey].pending++;
2549
+ }
2550
+ });
2551
+
2552
+ // Process ready tasks
2553
+ [...this.readyHeap.heap].forEach((task) => {
2554
+ const taskInfo = {
2555
+ id: task.id,
2556
+ priority: task.priority,
2557
+ coalescingKey: task.coalescingKey,
2558
+ metadata: task.metadata
2559
+ };
2560
+ summary.ready.push(taskInfo);
2561
+ summary.total++;
2562
+
2563
+ // Group by priority
2564
+ if (!summary.byPriority[task.priority]) {
2565
+ summary.byPriority[task.priority] = { pending: 0, ready: 0, running: 0 };
2566
+ }
2567
+ summary.byPriority[task.priority].ready++;
2568
+
2569
+ // Group by coalescing key
2570
+ if (task.coalescingKey) {
2571
+ if (!summary.byCoalescingKey[task.coalescingKey]) {
2572
+ summary.byCoalescingKey[task.coalescingKey] = { pending: 0, ready: 0, running: 0 };
2573
+ }
2574
+ summary.byCoalescingKey[task.coalescingKey].ready++;
2575
+ }
2576
+ });
2577
+
2578
+ // Process running tasks
2579
+ Array.from(this.running).forEach((task) => {
2580
+ const taskInfo = {
2581
+ id: task.id,
2582
+ priority: task.priority,
2583
+ coalescingKey: task.coalescingKey,
2584
+ metadata: task.metadata,
2585
+ startedAt: task.startedAt,
2586
+ runningFor: now - task.startedAt
2587
+ };
2588
+ summary.running.push(taskInfo);
2589
+ summary.total++;
2590
+
2591
+ // Group by priority
2592
+ if (!summary.byPriority[task.priority]) {
2593
+ summary.byPriority[task.priority] = { pending: 0, ready: 0, running: 0 };
2594
+ }
2595
+ summary.byPriority[task.priority].running++;
2596
+
2597
+ // Group by coalescing key
2598
+ if (task.coalescingKey) {
2599
+ if (!summary.byCoalescingKey[task.coalescingKey]) {
2600
+ summary.byCoalescingKey[task.coalescingKey] = { pending: 0, ready: 0, running: 0 };
2601
+ }
2602
+ summary.byCoalescingKey[task.coalescingKey].running++;
2603
+ }
2604
+ });
2605
+
2606
+ return summary;
2607
+ }
2608
+
2609
+ /**
2610
+ * Get detailed information about the scheduler state and timing.
2611
+ * @returns {Object} Scheduler state information
2612
+ */
2613
+ inspectScheduler() {
2614
+ const now = this.now();
2615
+
2616
+ // Calculate next run time for different scenarios
2617
+ let nextTaskTime = Infinity;
2618
+ let nextTaskInfo = null;
2619
+
2620
+ // Check pending tasks
2621
+ if (this.pendingHeap.size() > 0) {
2622
+ const nextPending = this.pendingHeap.peek();
2623
+ if (nextPending && nextPending.readyAt < nextTaskTime) {
2624
+ nextTaskTime = nextPending.readyAt;
2625
+ nextTaskInfo = {
2626
+ id: nextPending.id,
2627
+ priority: nextPending.priority,
2628
+ readyAt: nextPending.readyAt,
2629
+ source: "pending"
2630
+ };
2631
+ }
2632
+ }
2633
+
2634
+ // Check ready tasks
2635
+ if (this.readyHeap.size() > 0) {
2636
+ const nextReady = this.readyHeap.peek();
2637
+ if (nextReady) {
2638
+ nextTaskTime = now;
2639
+ nextTaskInfo = {
2640
+ id: nextReady.id,
2641
+ priority: nextReady.priority,
2642
+ source: "ready"
2643
+ };
2644
+ }
2645
+ }
2646
+
2647
+ // Check active delays
2648
+ let delayInfo = null;
2649
+ if (this.nextAvailableTime > now) {
2650
+ delayInfo = {
2651
+ priority: this.lastCompletedPriority,
2652
+ expiresAt: this.nextAvailableTime
2653
+ };
2654
+ }
2655
+
2656
+ return {
2657
+ timestamp: now,
2658
+ isActive: this.isActive,
2659
+ smartScheduling: this.options.smartScheduling,
2660
+ concurrency: this.options.concurrency,
2661
+ currentConcurrency: this.running.size,
2662
+ availableSlots: this.options.concurrency - this.running.size,
2663
+ timers: {
2664
+ schedulerInterval: this.schedulerInterval,
2665
+ schedulerTimeout: this.schedulerTimeout,
2666
+ nextScheduledRun: this.nextScheduledRun,
2667
+ nextRunIn: this.nextScheduledRun ? this.nextScheduledRun - now : null
2668
+ },
2669
+ nextTask: nextTaskInfo
2670
+ ? {
2671
+ ...nextTaskInfo,
2672
+ readyIn: nextTaskTime - now,
2673
+ canRunNow: nextTaskTime <= now && this.running.size < this.options.concurrency
2674
+ }
2675
+ : null,
2676
+ delays: {
2677
+ hasActiveDelays: this.nextAvailableTime > now,
2678
+ count: this.nextAvailableTime > now ? 1 : 0,
2679
+ nextExpiry: delayInfo
2680
+ ? {
2681
+ ...delayInfo,
2682
+ expiresIn: delayInfo.expiresAt - now
2683
+ }
2684
+ : null
2685
+ },
2686
+ queueCounts: {
2687
+ pending: this.pendingHeap.size(),
2688
+ ready: this.readyHeap.size(),
2689
+ running: this.running.size,
2690
+ total: this.pendingHeap.size() + this.readyHeap.size() + this.running.size
2691
+ }
2692
+ };
2693
+ }
2694
+
2695
+ /**
2696
+ * Log comprehensive queue state to console for debugging.
2697
+ * @param {boolean} [detailed=false] - Whether to include detailed task information
2698
+ */
2699
+ debugLog(detailed = false) {
2700
+ const inspection = this.inspect();
2701
+
2702
+ console.log("\n=== HoldMyTask Debug Information ===");
2703
+ console.log(`Timestamp: ${new Date(inspection.timestamp).toISOString()}`);
2704
+ console.log(`Status: ${inspection.scheduler.isActive ? "ACTIVE" : "PAUSED"}`);
2705
+ console.log(`Smart Scheduling: ${inspection.scheduler.smartScheduling ? "ON" : "OFF"}`);
2706
+ console.log(`Concurrency: ${inspection.scheduler.currentConcurrency}/${inspection.scheduler.concurrency}`);
2707
+
2708
+ console.log("\n--- Queue State ---");
2709
+ console.log(`Total Tasks: ${inspection.totals.totalTasks}`);
2710
+ console.log(` Pending: ${inspection.totals.pendingTasks}`);
2711
+ console.log(` Ready: ${inspection.totals.readyTasks}`);
2712
+ console.log(` Running: ${inspection.totals.runningTasks}`);
2713
+
2714
+ console.log("\n--- Timer State ---");
2715
+ console.log(`Interval: ${inspection.timers.schedulerInterval.active ? `Active (${inspection.timers.schedulerInterval.id})` : "None"}`);
2716
+ console.log(`Timeout: ${inspection.timers.schedulerTimeout.active ? `Active (${inspection.timers.schedulerTimeout.id})` : "None"}`);
2717
+ if (inspection.timers.nextRunIn !== null) {
2718
+ console.log(`Next Run: ${inspection.timers.nextRunIn}ms`);
2719
+ }
2720
+
2721
+ if (inspection.delays.activeDelays > 0) {
2722
+ console.log("\n--- Active Delays ---");
2723
+ inspection.delays.delayDetails.forEach((delay) => {
2724
+ console.log(` Priority ${delay.priority}: expires in ${delay.expiresIn}ms`);
2725
+ });
2726
+ }
2727
+
2728
+ if (Object.keys(inspection.coalescing).length > 0) {
2729
+ console.log("\n--- Coalescing Groups ---");
2730
+ Object.entries(inspection.coalescing).forEach(([key, info]) => {
2731
+ console.log(` ${key}: ${info.groupCount} groups, ${info.totalTasks} tasks`);
2732
+ });
2733
+ }
2734
+
2735
+ if (detailed) {
2736
+ console.log("\n--- Detailed Task Information ---");
2737
+ if (inspection.queues.pending.count > 0) {
2738
+ console.log("\nPending Tasks:");
2739
+ inspection.queues.pending.tasks.forEach((task) => {
2740
+ console.log(` ${task.id}: priority ${task.priority}, ready in ${task.readyIn}ms`);
2741
+ });
2742
+ }
2743
+
2744
+ if (inspection.queues.ready.count > 0) {
2745
+ console.log("\nReady Tasks:");
2746
+ inspection.queues.ready.tasks.forEach((task) => {
2747
+ console.log(` ${task.id}: priority ${task.priority}`);
2748
+ });
2749
+ }
2750
+
2751
+ if (inspection.queues.running.count > 0) {
2752
+ console.log("\nRunning Tasks:");
2753
+ inspection.queues.running.tasks.forEach((task) => {
2754
+ console.log(` ${task.id}: priority ${task.priority}, running for ${task.runningFor}ms`);
2755
+ });
2756
+ }
2757
+ }
2758
+
2759
+ console.log("=====================================\n");
2760
+ }
2125
2761
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cldmv/holdmytask",
3
- "version": "1.3.1",
3
+ "version": "1.5.0",
4
4
  "description": "A tiny task queue that waits until your task is ready",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.mjs",
@@ -355,6 +355,69 @@ export class HoldMyTask extends EventEmitter<[never]> {
355
355
  * const runningTasks = queue.inflight(); // 2
356
356
  */
357
357
  inflight(): number;
358
+ /**
359
+ * Gets information about a coalescing group by key and group ID.
360
+ * @param {string} coalescingKey - The coalescing key
361
+ * @param {string} [groupId] - Optional group ID. If omitted, returns all groups for the key
362
+ * @returns {Object|Array|null} Group info object, array of groups, or null if not found
363
+ * @example
364
+ * // Get all groups for a coalescing key
365
+ * const groups = queue.getCoalescingGroup('ui.update');
366
+ *
367
+ * // Get specific group by ID
368
+ * const group = queue.getCoalescingGroup('ui.update', '1');
369
+ * console.log(group.tasks.size); // Number of tasks in group
370
+ *
371
+ * // Access individual task metadata
372
+ * for (const [taskId, task] of group.tasks) {
373
+ * console.log(`Task ${taskId}:`, task.metadata);
374
+ * }
375
+ */
376
+ getCoalescingGroup(coalescingKey: string, groupId?: string): any | any[] | null;
377
+ /**
378
+ * Gets metadata for all tasks in a coalescing group.
379
+ * @param {string} coalescingKey - The coalescing key
380
+ * @param {string} [groupId] - Optional group ID. If omitted, returns metadata from all groups for the key
381
+ * @returns {Array} Array of metadata objects with task IDs
382
+ * @example
383
+ * // Get metadata from all groups for a key
384
+ * const allMetadata = queue.getCoalescingGroupMetadata('ui.update');
385
+ *
386
+ * // Get metadata from specific group
387
+ * const groupMetadata = queue.getCoalescingGroupMetadata('ui.update', '1');
388
+ *
389
+ * // Example output:
390
+ * // [
391
+ * // { taskId: '123', metadata: { userId: 100, action: 'save' } },
392
+ * // { taskId: '124', metadata: { userId: 200, action: 'delete' } }
393
+ * // ]
394
+ */
395
+ getCoalescingGroupMetadata(coalescingKey: string, groupId?: string): any[];
396
+ /**
397
+ * Gets a summary of all active coalescing groups.
398
+ * @returns {Object} Summary object with coalescing key stats
399
+ * @example
400
+ * const summary = queue.getCoalescingGroupsSummary();
401
+ * console.log(summary);
402
+ * // {
403
+ * // 'ui.update': { groupCount: 2, totalTasks: 5 },
404
+ * // 'api.batch': { groupCount: 1, totalTasks: 3 }
405
+ * // }
406
+ */
407
+ getCoalescingGroupsSummary(): any;
408
+ /**
409
+ * Finds the coalescing group that contains a specific task ID.
410
+ * @param {string|number} taskId - The task ID to search for
411
+ * @returns {Object|null} Group information including the task's metadata, or null if not found
412
+ * @example
413
+ * const groupInfo = queue.findCoalescingGroupByTaskId('123');
414
+ * if (groupInfo) {
415
+ * console.log('Task is in group:', groupInfo.groupId);
416
+ * console.log('Task metadata:', groupInfo.task.metadata);
417
+ * console.log('Other tasks in group:', groupInfo.groupTasks.length);
418
+ * }
419
+ */
420
+ findCoalescingGroupByTaskId(taskId: string | number): any | null;
358
421
  /**
359
422
  * Destroys the queue, canceling all tasks and stopping the scheduler.
360
423
  * Once destroyed, the queue cannot be reused.
@@ -624,6 +687,31 @@ export class HoldMyTask extends EventEmitter<[never]> {
624
687
  * @returns {boolean} True if task exists, false otherwise
625
688
  */
626
689
  hasTask(id: string | number): boolean;
690
+ /**
691
+ * Get detailed information about the current queue state for debugging.
692
+ * @returns {Object} Comprehensive queue state information
693
+ */
694
+ inspect(): any;
695
+ /**
696
+ * Get information about active timers and scheduler state.
697
+ * @returns {Object} Timer and scheduler information
698
+ */
699
+ inspectTimers(): any;
700
+ /**
701
+ * Get a summary of all queued tasks by status.
702
+ * @returns {Object} Task summary by status
703
+ */
704
+ inspectTasks(): any;
705
+ /**
706
+ * Get detailed information about the scheduler state and timing.
707
+ * @returns {Object} Scheduler state information
708
+ */
709
+ inspectScheduler(): any;
710
+ /**
711
+ * Log comprehensive queue state to console for debugging.
712
+ * @param {boolean} [detailed=false] - Whether to include detailed task information
713
+ */
714
+ debugLog(detailed?: boolean): void;
627
715
  }
628
716
  import { EventEmitter } from "events";
629
717
  import { MinHeap } from "./utils.mjs";
@@ -1 +1 @@
1
- {"version":3,"file":"hold-my-task.d.mts","sourceRoot":"","sources":["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IAED;;;;;;;;;;;;;;;;OAgBG;IACH,mCAfW,MAAM,0BAmChB;IAED;;;;;;;;;;OAUG;IACH,mCAMC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,4BApBW,MAAM,UAEd;QAAwB,SAAS,GAAzB,MAAM;QACU,UAAU,GAA1B,MAAM;QACU,KAAK,GAArB,MAAM;QACU,KAAK,GAArB,MAAM;KACd,GAAU,IAAI,CA2ChB;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,4BAfW,MAAM,0BA6BhB;IAED;;;;;;;;;;OAUG;IACH,iCAMC;IAED;;;OAGG;IACH,YAFa,IAAI,CAIhB;IAED;;;;;;OAMG;IACH,4CAJW,cAAe,kBAEb,eAAQ,UAAU,CAI9B;IAED;;;;;;OAMG;IACH,uCAJW,cAAe,kBAEb,eAAQ,UAAU,CAI9B;IAED;;;;OAIG;IACH,QAHW,MAAM,GAAC,MAAM,GACX,MAAO,IAAI,CAIvB;IAED;;;;OAIG;IACH,QAHW,MAAM,GAAC,MAAM,GACX,OAAO,CAInB;IAED;;;;OAIG;IACH,YAHW,MAAM,GAAC,MAAM,GACX,MAAO,IAAI,CAIvB;IAED;;;;OAIG;IACH,YAHW,MAAM,GAAC,MAAM,GACX,OAAO,CAInB;CACD;6BA/jE4B,QAAQ;wBACb,aAAa"}
1
+ {"version":3,"file":"hold-my-task.d.mts","sourceRoot":"","sources":["../../dist/hold-my-task.mjs"],"names":[],"mappings":"AAgBA;;;;;GAKG;AACH;IACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6DG;IAEH;;;;;;;;OAQG;IACH,yCAwCC;IAwND;;;;;;;;;OASG;IACH,uBAGC;IAnOD,0BAaC;IAED;;;;OAIG;IACH,wBAGC;IAFA,mBAAqB;IAItB;;;;;OAKG;IACH,yBAUC;IAED;;;;OAIG;IACH,0BAoKC;IA1DA,aAuBC;IAGD,qBAA+D;IAC/D,mBAIE;IAEF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