Every strategy is a separate, side-effect-free module ("sideEffects": false). Your bundler includes only the ones
you import. The one exception is the convenience builder, which references all of them.
ResiliencePipelineBuilder has an addX() method for every strategy, so importing it pulls in every strategy.
PipelineBuilder has only add(); you pass it strategy definitions, and only those are bundled:
ResiliencePipelineBuilder adds Polly-style addRetry() / addTimeout() / … shortcuts on top, at the cost of
bundling every strategy. Strategies run in the order they are added: the first one added is the outermost.
Options are validated and strategy state (e.g. circuit breaker) is created on build().
ResiliencePipelineBuilder adds Polly-style addRetry() / addTimeout() / … shortcuts on top, at the cost of
bundling every strategy. Strategies run in the order they are added: the first one added is the outermost.
Options are validated and strategy state (e.g. circuit breaker) is created on build().
CircuitBreakerOptions<T>.consecutiveFailures?: number |undefined
Break after this many failures in a row (a success resets the count). Simple and good for low traffic.
When set without failureRatio, the ratio check is off and only this rule applies.
One strategy, no pipeline:retry() and withTimeout() build their strategy directly, without a builder.
Code that only consumes results (a UI layer handling settle() outcomes): import from
@ylcnfrht/resilience/outcome. It has Outcome, the error classes and the guards, and no strategy.
Pass predicates as functions when size matters. PredicateBuilder is only bundled if you use it.
Circuit breaker extensions (circuitHealthCheck, sharedCircuitState) are separate modules, bundled only
when you pass them in extensions.
Integrations live in subpaths (/fetch, /otel, /nestjs…). The main entry never imports framework code.