@btravstack/core 0.28.0 → 0.29.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/dist/index.cjs CHANGED
@@ -520,6 +520,7 @@ const createUnitRegistry = () => {
520
520
  } finally {
521
521
  open.delete(controller);
522
522
  closedCount += 1;
523
+ controller.abort(new DOMException("The unit has settled", "AbortError"));
523
524
  settleIfIdle();
524
525
  }
525
526
  })).flatMap((result) => result);
package/dist/index.d.cts CHANGED
@@ -340,7 +340,11 @@ export declare const systemClock: Clock;
340
340
  * record of **data about this unit**, and never a service.
341
341
  *
342
342
  * `signal` is the same `AbortSignal` the work callback receives — aborted at
343
- * the drain deadline, or at once on a path that skips the drain. It is here
343
+ * the drain deadline, at once on a path that skips the drain, and once the
344
+ * unit has settled, so work that outlives its unit — an HTTP handler whose
345
+ * client disconnected — is told to stop. The settle abort's `reason` is an
346
+ * `AbortError` `DOMException` whose message is `"The unit has settled"`; the
347
+ * kernel's own aborts keep the default reason. It is here
344
348
  * because the callback is not always where the work is: a middleware-shaped
345
349
  * runtime opens the unit around a call whose arguments it does not own. A
346
350
  * transport's own cancellation is a different clock, not this one.
@@ -481,6 +485,11 @@ export declare class RuntimeStartFailed extends RuntimeStartFailed_base<{
481
485
  * moment it holds the unit's input; the kernel closes that scope when the
482
486
  * unit settles, after the response is flushed. Work that subscribes to an
483
487
  * event after a `fork` must first check whether it already fired.
488
+ *
489
+ * `signal` aborts at the drain deadline, at once when the drain is skipped,
490
+ * and once the unit settles — after its scope has closed — so work the
491
+ * runtime left running past the unit, such as an HTTP handler whose client
492
+ * disconnected, is told to stop. Only the first two count as `abandoned`.
484
493
  */
485
494
  type RunUnit<Resolves extends AnyPort> = <T, E>(meta: UnitMeta, work: (unit: UnitHost<Resolves>, signal: AbortSignal) => ReturnType<UnitWork<T, E>>) => AsyncResult<T, E>;
486
495
  /**
package/dist/index.d.mts CHANGED
@@ -340,7 +340,11 @@ export declare const systemClock: Clock;
340
340
  * record of **data about this unit**, and never a service.
341
341
  *
342
342
  * `signal` is the same `AbortSignal` the work callback receives — aborted at
343
- * the drain deadline, or at once on a path that skips the drain. It is here
343
+ * the drain deadline, at once on a path that skips the drain, and once the
344
+ * unit has settled, so work that outlives its unit — an HTTP handler whose
345
+ * client disconnected — is told to stop. The settle abort's `reason` is an
346
+ * `AbortError` `DOMException` whose message is `"The unit has settled"`; the
347
+ * kernel's own aborts keep the default reason. It is here
344
348
  * because the callback is not always where the work is: a middleware-shaped
345
349
  * runtime opens the unit around a call whose arguments it does not own. A
346
350
  * transport's own cancellation is a different clock, not this one.
@@ -481,6 +485,11 @@ export declare class RuntimeStartFailed extends RuntimeStartFailed_base<{
481
485
  * moment it holds the unit's input; the kernel closes that scope when the
482
486
  * unit settles, after the response is flushed. Work that subscribes to an
483
487
  * event after a `fork` must first check whether it already fired.
488
+ *
489
+ * `signal` aborts at the drain deadline, at once when the drain is skipped,
490
+ * and once the unit settles — after its scope has closed — so work the
491
+ * runtime left running past the unit, such as an HTTP handler whose client
492
+ * disconnected, is told to stop. Only the first two count as `abandoned`.
484
493
  */
485
494
  type RunUnit<Resolves extends AnyPort> = <T, E>(meta: UnitMeta, work: (unit: UnitHost<Resolves>, signal: AbortSignal) => ReturnType<UnitWork<T, E>>) => AsyncResult<T, E>;
486
495
  /**
package/dist/index.mjs CHANGED
@@ -519,6 +519,7 @@ const createUnitRegistry = () => {
519
519
  } finally {
520
520
  open.delete(controller);
521
521
  closedCount += 1;
522
+ controller.abort(new DOMException("The unit has settled", "AbortError"));
522
523
  settleIfIdle();
523
524
  }
524
525
  })).flatMap((result) => result);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@btravstack/core",
3
- "version": "0.28.0",
3
+ "version": "0.29.0",
4
4
  "description": "The application kernel: boot a di module into a running process, and stop it without losing work",
5
5
  "keywords": [
6
6
  "application",
@@ -45,8 +45,8 @@
45
45
  "./package.json": "./package.json"
46
46
  },
47
47
  "devDependencies": {
48
- "@btravstack/config": "0.28.0",
49
- "@btravstack/di": "0.28.0",
48
+ "@btravstack/config": "0.29.0",
49
+ "@btravstack/di": "0.29.0",
50
50
  "@btravstack/tsconfig": "0.4.0",
51
51
  "@stryker-mutator/core": "10.0.0",
52
52
  "@stryker-mutator/vitest-runner": "10.0.0",
@@ -60,8 +60,8 @@
60
60
  "vitest": "5.0.3"
61
61
  },
62
62
  "peerDependencies": {
63
- "@btravstack/config": "^0.28.0",
64
- "@btravstack/di": "^0.28.0",
63
+ "@btravstack/config": "^0.29.0",
64
+ "@btravstack/di": "^0.29.0",
65
65
  "unthrown": "^5.0.0"
66
66
  },
67
67
  "engines": {