clutchit 0.0.6 → 0.0.8

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
@@ -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