@hardlydifficult/queue 1.0.1 → 1.1.1
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 +194 -0
- package/dist/PriorityQueue.d.ts +18 -0
- package/dist/PriorityQueue.d.ts.map +1 -1
- package/dist/PriorityQueue.js +49 -0
- package/dist/PriorityQueue.js.map +1 -1
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# @hardlydifficult/queue
|
|
2
|
+
|
|
3
|
+
A high-performance priority queue with O(1) enqueue and dequeue operations, supporting FIFO ordering within priority levels.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @hardlydifficult/queue
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { createPriorityQueue } from "@hardlydifficult/queue";
|
|
15
|
+
|
|
16
|
+
const queue = createPriorityQueue<string>();
|
|
17
|
+
|
|
18
|
+
// Enqueue items with priorities
|
|
19
|
+
queue.enqueue("urgent task", "high");
|
|
20
|
+
queue.enqueue("normal task", "medium");
|
|
21
|
+
queue.enqueue("background task", "low");
|
|
22
|
+
|
|
23
|
+
// Dequeue in priority order (high → medium → low)
|
|
24
|
+
console.log(queue.dequeue()?.data); // "urgent task"
|
|
25
|
+
console.log(queue.dequeue()?.data); // "normal task"
|
|
26
|
+
console.log(queue.dequeue()?.data); // "background task"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Core Operations
|
|
30
|
+
|
|
31
|
+
### Enqueue and Dequeue
|
|
32
|
+
|
|
33
|
+
Add items to the queue with a priority level (defaults to `"medium"`). Items are dequeued in priority order, with FIFO ordering within the same priority level.
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
const queue = createPriorityQueue<string>();
|
|
37
|
+
|
|
38
|
+
// Enqueue with explicit priority
|
|
39
|
+
const item1 = queue.enqueue("task A", "high");
|
|
40
|
+
const item2 = queue.enqueue("task B", "high");
|
|
41
|
+
const item3 = queue.enqueue("task C", "medium");
|
|
42
|
+
|
|
43
|
+
// Dequeue returns highest priority first, FIFO within same priority
|
|
44
|
+
queue.dequeue()?.data; // "task A" (high, enqueued first)
|
|
45
|
+
queue.dequeue()?.data; // "task B" (high, enqueued second)
|
|
46
|
+
queue.dequeue()?.data; // "task C" (medium)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Peek
|
|
50
|
+
|
|
51
|
+
Inspect the next item without removing it from the queue.
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
const queue = createPriorityQueue<string>();
|
|
55
|
+
queue.enqueue("first", "high");
|
|
56
|
+
queue.enqueue("second", "low");
|
|
57
|
+
|
|
58
|
+
queue.peek()?.data; // "first" (highest priority)
|
|
59
|
+
queue.size; // Still 2
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Queue Status
|
|
63
|
+
|
|
64
|
+
Check the number of items and whether the queue is empty.
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
const queue = createPriorityQueue<string>();
|
|
68
|
+
|
|
69
|
+
queue.isEmpty; // true
|
|
70
|
+
queue.size; // 0
|
|
71
|
+
|
|
72
|
+
queue.enqueue("item");
|
|
73
|
+
queue.isEmpty; // false
|
|
74
|
+
queue.size; // 1
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Item Management
|
|
78
|
+
|
|
79
|
+
### Remove Items
|
|
80
|
+
|
|
81
|
+
Remove a specific item by its ID. Returns `true` if the item was found and removed.
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
const queue = createPriorityQueue<string>();
|
|
85
|
+
const item = queue.enqueue("task", "high");
|
|
86
|
+
|
|
87
|
+
queue.remove(item.id); // true
|
|
88
|
+
queue.size; // 0
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Update Priority
|
|
92
|
+
|
|
93
|
+
Change an item's priority level while keeping its data and enqueue timestamp intact.
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
const queue = createPriorityQueue<string>();
|
|
97
|
+
const item = queue.enqueue("task", "low");
|
|
98
|
+
|
|
99
|
+
queue.updatePriority(item.id, "high"); // true
|
|
100
|
+
queue.peek()?.data; // "task" (now highest priority)
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Reorder Within Priority
|
|
104
|
+
|
|
105
|
+
Move an item before another item in the same priority bucket, or move it to the end of its bucket.
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
const queue = createPriorityQueue<string>();
|
|
109
|
+
const a = queue.enqueue("A", "high");
|
|
110
|
+
const b = queue.enqueue("B", "high");
|
|
111
|
+
const c = queue.enqueue("C", "high");
|
|
112
|
+
|
|
113
|
+
// Move A before C
|
|
114
|
+
queue.moveBefore(a.id, c.id); // true
|
|
115
|
+
queue.toArray().map(i => i.data); // ["B", "A", "C"]
|
|
116
|
+
|
|
117
|
+
// Move B to the end
|
|
118
|
+
queue.moveToEnd(b.id); // true
|
|
119
|
+
queue.toArray().map(i => i.data); // ["A", "C", "B"]
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Snapshots and Listeners
|
|
123
|
+
|
|
124
|
+
### Get All Items
|
|
125
|
+
|
|
126
|
+
Retrieve all items in dequeue order without modifying the queue.
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
const queue = createPriorityQueue<string>();
|
|
130
|
+
queue.enqueue("low", "low");
|
|
131
|
+
queue.enqueue("high", "high");
|
|
132
|
+
queue.enqueue("medium", "medium");
|
|
133
|
+
|
|
134
|
+
const items = queue.toArray();
|
|
135
|
+
items.map(i => i.data); // ["high", "medium", "low"]
|
|
136
|
+
queue.size; // Still 3
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Listen for Enqueues
|
|
140
|
+
|
|
141
|
+
Register a callback that fires whenever an item is enqueued. Returns an unsubscribe function.
|
|
142
|
+
|
|
143
|
+
```typescript
|
|
144
|
+
const queue = createPriorityQueue<string>();
|
|
145
|
+
|
|
146
|
+
const unsubscribe = queue.onEnqueue((item) => {
|
|
147
|
+
console.log(`Enqueued: ${item.data} (priority: ${item.priority})`);
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
queue.enqueue("task", "high");
|
|
151
|
+
// Logs: "Enqueued: task (priority: high)"
|
|
152
|
+
|
|
153
|
+
unsubscribe();
|
|
154
|
+
queue.enqueue("another"); // No log
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Clear the Queue
|
|
158
|
+
|
|
159
|
+
Remove all items from the queue.
|
|
160
|
+
|
|
161
|
+
```typescript
|
|
162
|
+
const queue = createPriorityQueue<string>();
|
|
163
|
+
queue.enqueue("a");
|
|
164
|
+
queue.enqueue("b");
|
|
165
|
+
|
|
166
|
+
queue.clear();
|
|
167
|
+
queue.isEmpty; // true
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Item Metadata
|
|
171
|
+
|
|
172
|
+
Each enqueued item includes metadata accessible via the returned `QueueItem` object:
|
|
173
|
+
|
|
174
|
+
```typescript
|
|
175
|
+
const queue = createPriorityQueue<string>();
|
|
176
|
+
const item = queue.enqueue("my task", "high");
|
|
177
|
+
|
|
178
|
+
item.data; // "my task"
|
|
179
|
+
item.priority; // "high"
|
|
180
|
+
item.id; // "q_1" (unique identifier)
|
|
181
|
+
item.enqueuedAt; // 1699564800000 (epoch milliseconds)
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Priority Levels
|
|
185
|
+
|
|
186
|
+
The queue supports three priority levels, dequeued in this order:
|
|
187
|
+
|
|
188
|
+
| Priority | Dequeue Order |
|
|
189
|
+
|----------|---------------|
|
|
190
|
+
| `"high"` | 1st |
|
|
191
|
+
| `"medium"` | 2nd |
|
|
192
|
+
| `"low"` | 3rd |
|
|
193
|
+
|
|
194
|
+
When no priority is specified, `"medium"` is used as the default.
|
package/dist/PriorityQueue.d.ts
CHANGED
|
@@ -70,6 +70,24 @@ export interface PriorityQueue<T> {
|
|
|
70
70
|
toArray(): readonly QueueItem<T>[];
|
|
71
71
|
/** Clear all items from the queue. */
|
|
72
72
|
clear(): void;
|
|
73
|
+
/**
|
|
74
|
+
* Change the priority of an existing item.
|
|
75
|
+
* Removes it from its current bucket and appends to the new bucket.
|
|
76
|
+
* Preserves data and enqueuedAt; updates priority.
|
|
77
|
+
* @returns true if the item was found and updated
|
|
78
|
+
*/
|
|
79
|
+
updatePriority(id: string, newPriority: Priority): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Move an item before another item within the same priority bucket.
|
|
82
|
+
* Both items must exist and share the same priority.
|
|
83
|
+
* @returns true if the move succeeded
|
|
84
|
+
*/
|
|
85
|
+
moveBefore(itemId: string, beforeItemId: string): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Move an item to the end of its priority bucket.
|
|
88
|
+
* @returns true if the item was found and moved
|
|
89
|
+
*/
|
|
90
|
+
moveToEnd(itemId: string): boolean;
|
|
73
91
|
}
|
|
74
92
|
/**
|
|
75
93
|
* Create a new priority queue.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PriorityQueue.d.ts","sourceRoot":"","sources":["../src/PriorityQueue.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;AAKjD;;GAEG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC;IAC1B,sBAAsB;IACtB,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IACjB,qBAAqB;IACrB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,4CAA4C;IAC5C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,MAAM,WAAW,aAAa,CAAC,CAA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C,CAAC;IAC9B;;;;;OAKG;IACH,OAAO,CAAC,IAAI,EAAE,CAAC,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IAEpD;;;OAGG;IACH,OAAO,IAAI,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAEpC;;;OAGG;IACH,IAAI,IAAI,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAEjC;;;OAGG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;IAE5B,8CAA8C;IAC9C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,kCAAkC;IAClC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAE1B;;;OAGG;IACH,SAAS,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAE9D;;;OAGG;IACH,OAAO,IAAI,SAAS,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IAEnC,sCAAsC;IACtC,KAAK,IAAI,IAAI,CAAC;IAEd;;;;;OAKG;IACH,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,GAAG,OAAO,CAAC;IAE3D;;;;OAIG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC;IAE1D;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;CACpC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,KAAK,aAAa,CAAC,CAAC,CAAC,CAsIzD"}
|
package/dist/PriorityQueue.js
CHANGED
|
@@ -86,6 +86,55 @@ function createPriorityQueue() {
|
|
|
86
86
|
buckets.medium.length = 0;
|
|
87
87
|
buckets.low.length = 0;
|
|
88
88
|
},
|
|
89
|
+
updatePriority(id, newPriority) {
|
|
90
|
+
for (const p of PRIORITY_ORDER) {
|
|
91
|
+
const idx = buckets[p].findIndex((item) => item.id === id);
|
|
92
|
+
if (idx !== -1) {
|
|
93
|
+
const [item] = buckets[p].splice(idx, 1);
|
|
94
|
+
// Create new item with updated priority (preserves data + enqueuedAt)
|
|
95
|
+
const updated = {
|
|
96
|
+
data: item.data,
|
|
97
|
+
priority: newPriority,
|
|
98
|
+
enqueuedAt: item.enqueuedAt,
|
|
99
|
+
id: item.id,
|
|
100
|
+
};
|
|
101
|
+
buckets[newPriority].push(updated);
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return false;
|
|
106
|
+
},
|
|
107
|
+
moveBefore(itemId, beforeItemId) {
|
|
108
|
+
// Find both items - they must be in the same priority bucket
|
|
109
|
+
for (const p of PRIORITY_ORDER) {
|
|
110
|
+
const bucket = buckets[p];
|
|
111
|
+
const itemIdx = bucket.findIndex((i) => i.id === itemId);
|
|
112
|
+
const beforeIdx = bucket.findIndex((i) => i.id === beforeItemId);
|
|
113
|
+
if (itemIdx !== -1 && beforeIdx !== -1 && itemIdx !== beforeIdx) {
|
|
114
|
+
const [item] = bucket.splice(itemIdx, 1);
|
|
115
|
+
// Recalculate target index after removal
|
|
116
|
+
const newBeforeIdx = bucket.findIndex((i) => i.id === beforeItemId);
|
|
117
|
+
bucket.splice(newBeforeIdx, 0, item);
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return false;
|
|
122
|
+
},
|
|
123
|
+
moveToEnd(itemId) {
|
|
124
|
+
for (const p of PRIORITY_ORDER) {
|
|
125
|
+
const bucket = buckets[p];
|
|
126
|
+
const idx = bucket.findIndex((i) => i.id === itemId);
|
|
127
|
+
if (idx !== -1 && idx < bucket.length - 1) {
|
|
128
|
+
const [item] = bucket.splice(idx, 1);
|
|
129
|
+
bucket.push(item);
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
if (idx === bucket.length - 1) {
|
|
133
|
+
return true; // Already at end
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return false;
|
|
137
|
+
},
|
|
89
138
|
};
|
|
90
139
|
}
|
|
91
140
|
//# sourceMappingURL=PriorityQueue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PriorityQueue.js","sourceRoot":"","sources":["../src/PriorityQueue.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;
|
|
1
|
+
{"version":3,"file":"PriorityQueue.js","sourceRoot":"","sources":["../src/PriorityQueue.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AAwGH,kDAsIC;AAtOD,4DAA4D;AAC5D,MAAM,cAAc,GAAwB,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;AA4FtE;;GAEG;AACH,SAAgB,mBAAmB;IACjC,MAAM,OAAO,GAAqC;QAChD,IAAI,EAAE,EAAE;QACR,MAAM,EAAE,EAAE;QACV,GAAG,EAAE,EAAE;KACR,CAAC;IACF,MAAM,SAAS,GAAG,IAAI,GAAG,EAAgC,CAAC;IAC1D,IAAI,OAAO,GAAG,CAAC,CAAC;IAEhB,SAAS,OAAO;QACd,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;IAC1E,CAAC;IAED,OAAO;QACL,OAAO,CAAC,IAAO,EAAE,WAAqB,QAAQ;YAC5C,MAAM,IAAI,GAAiB;gBACzB,IAAI;gBACJ,QAAQ;gBACR,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE;gBACtB,EAAE,EAAE,KAAK,MAAM,CAAC,EAAE,OAAO,CAAC,EAAE;aAC7B,CAAC;YACF,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC7B,KAAK,MAAM,EAAE,IAAI,SAAS,EAAE,CAAC;gBAC3B,EAAE,CAAC,IAAI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