clutchit 0.0.6 → 0.0.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.
- package/CHANGELOG.md +58 -0
- package/README.md +225 -280
- package/package.json +1 -17
- package/dist/circuit/circuit.breaker.d.ts +0 -51
- package/dist/circuit/index.d.ts +0 -10
- package/dist/concurrency/bulkhead.d.ts +0 -28
- package/dist/concurrency/index.d.ts +0 -23
- package/dist/concurrency/rate-limiter.d.ts +0 -29
- package/dist/concurrency/ref.d.ts +0 -11
- package/dist/concurrency/semaphore.d.ts +0 -15
- package/dist/queue/base.queue.d.ts +0 -18
- package/dist/queue/bounded.queue.d.ts +0 -11
- package/dist/queue/dropping.queue.d.ts +0 -7
- package/dist/queue/faults.d.ts +0 -24
- package/dist/queue/index.d.ts +0 -15
- package/dist/queue/sliding.queue.d.ts +0 -7
- package/dist/retry/index.d.ts +0 -8
- package/dist/retry/retry.d.ts +0 -21
- package/dist/schedule/index.d.ts +0 -36
- package/dist/schedule/operators.d.ts +0 -22
- package/dist/schedule/runner.d.ts +0 -31
- package/dist/schedule/schedule.d.ts +0 -35
- package/dist/timeout/index.d.ts +0 -7
- package/dist/timeout/timeout.d.ts +0 -18
- package/dist/unthrow/do.d.ts +0 -5
- package/dist/unthrow/fault.d.ts +0 -22
- package/dist/unthrow/helpers.d.ts +0 -9
- package/dist/unthrow/index.d.ts +0 -33
- package/dist/unthrow/result.async.d.ts +0 -19
- package/dist/unthrow/result.d.ts +0 -38
package/CHANGELOG.md
CHANGED
|
@@ -4,3 +4,61 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [1.0.0] - TBD
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
#### `clutchit/unthrow`
|
|
13
|
+
|
|
14
|
+
- `Result<T, E>` — synchronous typed error container with `Ok` and `Err` variants
|
|
15
|
+
- `ResultAsync<T, E>` — async equivalent backed by `Promise<Result<T, E>>`, implements `PromiseLike`
|
|
16
|
+
- `Result.Do` / `ResultAsync.Do` — generator-based Do notation for ergonomic sequential chaining
|
|
17
|
+
- `Result.combine` / `ResultAsync.combine` — combine arrays of results, short-circuit on first error
|
|
18
|
+
- `Result.combineWithAllErrors` / `ResultAsync.combineWithAllErrors` — collect all errors instead of stopping at first
|
|
19
|
+
- `Result.fromThrowable` — wrap a throwing sync function into a `Result`
|
|
20
|
+
- `ResultAsync.fromPromise` — lift a `Promise` into a `ResultAsync` with typed error mapping
|
|
21
|
+
- `Fault.Tagged` — factory for structured, tagged error classes with `code`, `_category`, and `_transient`
|
|
22
|
+
- `Fault.isDomain` / `Fault.isInfrastructure` / `Fault.isTransient` — type guard helpers
|
|
23
|
+
|
|
24
|
+
#### `clutchit/schedule`
|
|
25
|
+
|
|
26
|
+
- `Schedule` — composable timing primitive with `.next(input, attempt)` and `.pipe(operator)` API
|
|
27
|
+
- Factories: `spaced`, `exponential`, `linear`, `constant`, `fixed`, `windowed`, `fibonacci`, `cron`, `forever`, `once`
|
|
28
|
+
- Operators: `recurs`, `cappedDelay`, `jittered`, `upTo`, `andThen`, `union`, `intersect`, `whileInput`, `whileOutput`, `map`
|
|
29
|
+
- `Schedule.repeat` — run a `ResultAsync`-returning function repeatedly on a schedule with abort signal support
|
|
30
|
+
- `ScheduleInterruptedFault` — returned when `repeat` is cancelled via `AbortSignal`
|
|
31
|
+
|
|
32
|
+
#### `clutchit/retry`
|
|
33
|
+
|
|
34
|
+
- `RetryPolicy` — policy-driven retry with configurable `Schedule`, `retryOn` predicate, `onRetry` callback, and `AbortSignal`
|
|
35
|
+
- Default behaviour: exponential backoff starting at 200 ms, up to 3 retries, retries transient faults automatically
|
|
36
|
+
|
|
37
|
+
#### `clutchit/timeout`
|
|
38
|
+
|
|
39
|
+
- `withTimeout(fn, duration)` — wrap a `ResultAsync`-returning function with a deadline
|
|
40
|
+
- `createTimeout(duration)` — create a reusable timeout wrapper
|
|
41
|
+
- `TimeoutFault` — transient infrastructure fault emitted on deadline exceeded; aborts the underlying operation
|
|
42
|
+
|
|
43
|
+
#### `clutchit/circuit`
|
|
44
|
+
|
|
45
|
+
- `Circuit.Breaker` — circuit breaker with `closed → open → half-open` state machine
|
|
46
|
+
- Options: `failureThreshold`, `resetSchedule`, `halfOpenAttempts`, `isFailure`, `onStateChange`
|
|
47
|
+
- `CircuitOpenFault` — emitted when calls are rejected in the open state with `remainingTimeout`
|
|
48
|
+
- `breaker.state`, `breaker.failureCount`, `breaker.reset()`
|
|
49
|
+
|
|
50
|
+
#### `clutchit/concurrency`
|
|
51
|
+
|
|
52
|
+
- `Concurrency.Semaphore` — counting semaphore; queues callers when permits are exhausted
|
|
53
|
+
- `Concurrency.Bulkhead` — bounded concurrency with optional queue; rejects overflow with `BulkheadRejectedFault`
|
|
54
|
+
- `Concurrency.RateLimiter` — sliding-window rate limiter; rejects over-limit calls with `RateLimitFault`
|
|
55
|
+
- `Concurrency.Ref` — atomic mutable reference serialised through an internal mutex; `get`, `set`, `update`, `modify`
|
|
56
|
+
- `BulkheadRejectedFault`, `RateLimitFault` — typed rejection faults
|
|
57
|
+
|
|
58
|
+
#### `clutchit/queue`
|
|
59
|
+
|
|
60
|
+
- `Queue.Bounded` — bounded async queue with backpressure; `put` blocks, `offer` returns `QueueFullFault` when full
|
|
61
|
+
- `Queue.Dropping` — drops newest items when full; `offer` returns `boolean`
|
|
62
|
+
- `Queue.Sliding` — drops oldest items when full; `offer` always succeeds
|
|
63
|
+
- Shared API: `take`, `takeBatch`, `poll`, `size`, `capacity` with `AbortSignal` support
|
|
64
|
+
- `QueueFullFault`, `QueueEmptyFault` — typed queue faults
|