@mrjacket/ahko 0.6.0 → 1.0.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/CHANGELOG.md CHANGED
@@ -5,6 +5,31 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.0.0] - 2026-09-23 — Stable Scheduler Release
9
+
10
+ ### Added
11
+ - Comprehensive End-to-End stress and integration test suite (`src/__tests__/e2e.test.ts`) verifying:
12
+ - High-concurrency bursts under rate-limited temporal pacing (`minIntervalMs`) and jittered backoff retries.
13
+ - Interleaved interactive debounce and throttle streams under queue contention.
14
+ - Cooperative cancellation waves simulating document switches or build cancellations (VS Code / CLI scenarios).
15
+ - Graceful shutdown workflows clearing pending queues while allowing in-flight tasks to settle cleanly (`ahko.chill()`).
16
+ - Full lifecycle telemetry stream validation and microservice uncooperative timeout handling.
17
+ - Standalone runnable examples suite (`examples/`) with dedicated `examples/README.md`:
18
+ - `01-concurrency-and-pacing.mjs`: concurrency limits and temporal pacing.
19
+ - `02-debounce-search.mjs`: debounced interactive search with Promise coalescing.
20
+ - `03-throttle-events.mjs`: high-frequency event stream throttling.
21
+ - `04-retry-backoff-jitter.mjs`: resilient retries with exponential backoff and full jitter.
22
+ - `05-idle-telemetry.mjs`: non-blocking background tasks and lifecycle event logging.
23
+ - `06-graceful-shutdown.mjs`: safe process termination sequence.
24
+ - Dedicated npm script `"test:e2e"` for focused integration testing.
25
+ - Documentation restructuring into domain guides (`docs/guides/`) and specifications (`docs/architecture/`), including production architectural recipes (`recipes.md`).
26
+
27
+ ### Changed
28
+ - Connected `DebounceCoordinator` and `ThrottleCoordinator` settlement lifecycles directly to `TaskQueue.checkIdle()`, ensuring that window expirations and coordinator deletions deterministically resolve idle promises and emit `"idle"` events.
29
+ - Transitioned version to stable 1.0.0 baseline with frozen zero-dependency architecture.
30
+
31
+ ---
32
+
8
33
  ## [0.6.0] - 2026-09-23 — Telemetry & DX
9
34
 
10
35
  ### Added
package/README.md CHANGED
@@ -12,9 +12,6 @@
12
12
  <a href="https://www.npmjs.com/package/@mrjacket/ahko">
13
13
  <img src="https://img.shields.io/npm/v/@mrjacket/ahko.svg?color=success" alt="npm version">
14
14
  </a>
15
- <a href="https://www.npmjs.com/package/@mrjacket/ahko">
16
- <img src="https://img.shields.io/npm/dm/@mrjacket/ahko.svg" alt="npm downloads">
17
- </a>
18
15
  <a href="https://www.npmjs.com/package/@mrjacket/ahko">
19
16
  <img src="https://img.shields.io/node/v/@mrjacket/ahko.svg" alt="node">
20
17
  </a>
@@ -30,12 +27,6 @@
30
27
  <a href="https://www.npmjs.com/package/@mrjacket/ahko">
31
28
  <img src="https://img.shields.io/badge/dependencies-0-success" alt="zero dependencies">
32
29
  </a>
33
- <a href="https://bundlephobia.com/package/@mrjacket/ahko">
34
- <img src="https://img.shields.io/bundlephobia/minzip/@mrjacket/ahko?color=purple" alt="bundle size">
35
- </a>
36
- <a href="https://github.com/x-name15/ahko">
37
- <img src="https://img.shields.io/badge/TypeScript-Ready-3178C6?logo=typescript&logoColor=white" alt="TypeScript">
38
- </a>
39
30
  <a href="https://github.com/x-name15/ahko/issues">
40
31
  <img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs Welcome">
41
32
  </a>
@@ -306,13 +297,15 @@ Comprehensive guides and technical documentation are available in the [`docs/`](
306
297
  | [**Roadmap**](./docs/architecture/ROADMAP.md) | Milestone progression from 0.1.0 through 1.0.0. |
307
298
  | [**Engineering Log**](./docs/architecture/LOG.md) | Chronological log of engineering decisions and ADRs. |
308
299
 
300
+ > **Runnable Examples:** A comprehensive suite of standalone, runnable Node.js scripts is available in the [`examples/`](./examples/) folder. See [`examples/README.md`](./examples/README.md) for details.
301
+
309
302
  ---
310
303
 
311
304
  ## API Reference
312
305
 
313
306
  ### `new Ahko(options?: IAhkoOptions)`
314
307
 
315
- Creates an AHKO scheduler instance.
308
+ Creates an ahko scheduler instance.
316
309
 
317
310
  | Option | Type | Default | Description |
318
311
  |---|---|---|---|
package/dist/index.cjs CHANGED
@@ -150,6 +150,8 @@ var AhkoCancellationError = class extends AhkoError {
150
150
  // src/scheduler/debounce-coordinator.ts
151
151
  var DebounceCoordinator = class {
152
152
  entries = /* @__PURE__ */ new Map();
153
+ /** Optional callback invoked whenever entries are settled or removed from coordinator */
154
+ onSettled;
153
155
  /**
154
156
  * Schedules a task under the debounce strategy.
155
157
  *
@@ -236,6 +238,7 @@ var DebounceCoordinator = class {
236
238
  return;
237
239
  }
238
240
  this.entries.delete(key);
241
+ this.onSettled?.();
239
242
  if (entry.options?.signal && entry.abortListener) {
240
243
  entry.options.signal.removeEventListener("abort", entry.abortListener);
241
244
  }
@@ -259,6 +262,7 @@ var DebounceCoordinator = class {
259
262
  }
260
263
  clearTimeout(entry.timerId);
261
264
  this.entries.delete(key);
265
+ this.onSettled?.();
262
266
  if (entry.options?.signal && entry.abortListener) {
263
267
  entry.options.signal.removeEventListener("abort", entry.abortListener);
264
268
  }
@@ -286,6 +290,7 @@ var DebounceCoordinator = class {
286
290
  entry.reject(new AhkoCancellationError("Debounced tasks cleared"));
287
291
  }
288
292
  this.entries.clear();
293
+ this.onSettled?.();
289
294
  }
290
295
  };
291
296
 
@@ -331,6 +336,8 @@ var IdleScheduler = class {
331
336
  // src/scheduler/throttle-coordinator.ts
332
337
  var ThrottleCoordinator = class {
333
338
  entries = /* @__PURE__ */ new Map();
339
+ /** Optional callback invoked whenever entries are settled or removed from coordinator */
340
+ onSettled;
334
341
  /**
335
342
  * Schedules a task under the throttle strategy.
336
343
  *
@@ -416,6 +423,7 @@ var ThrottleCoordinator = class {
416
423
  return;
417
424
  }
418
425
  this.entries.delete(key);
426
+ this.onSettled?.();
419
427
  }
420
428
  /**
421
429
  * Cancels any pending trailing throttled task for a given key.
@@ -432,6 +440,7 @@ var ThrottleCoordinator = class {
432
440
  clearTimeout(entry.windowTimerId);
433
441
  }
434
442
  this.entries.delete(key);
443
+ this.onSettled?.();
435
444
  if (entry.trailingReject) {
436
445
  const cancelError = new AhkoCancellationError(
437
446
  typeof reason === "string" ? reason : "Throttled task was cancelled",
@@ -459,6 +468,7 @@ var ThrottleCoordinator = class {
459
468
  }
460
469
  }
461
470
  this.entries.clear();
471
+ this.onSettled?.();
462
472
  }
463
473
  };
464
474
 
@@ -592,6 +602,8 @@ var TaskQueue = class {
592
602
  }
593
603
  this.concurrency = concurrency;
594
604
  this.minIntervalMs = minIntervalMs;
605
+ this.debounceCoordinator.onSettled = () => this.checkIdle();
606
+ this.throttleCoordinator.onSettled = () => this.checkIdle();
595
607
  }
596
608
  /**
597
609
  * Enqueues a task runner according to the specified schedule options.
@@ -1590,7 +1602,7 @@ var Ahko = class {
1590
1602
  };
1591
1603
 
1592
1604
  // src/version.ts
1593
- var VERSION = "0.6.0";
1605
+ var VERSION = "1.0.0";
1594
1606
 
1595
1607
  // src/errors/queue.error.ts
1596
1608
  var AhkoQueueError = class extends AhkoError {