Bump cockatiel from 2.0.2 to 3.0.0
Bumps cockatiel from 2.0.2 to 3.0.0.
Changelog
Sourced from cockatiel's changelog.
3.0.0
- breaking: please see the breaking changes for the two 3.0.0-beta releases
- feat: expose
wrap()
ed policies in the merged policy (#61)3.0.0-beta.1
breaking: refactor: create policies as free-floating functions rather than Policy methods
Previously, all policies were created via something like
Policy.handleAll().retry(...)
. However, as a result, it was hard for bundlers to tree-shake Cockatiel, since thePolicy
class was used and referenced every mechanism provided in this library.Instead, policies are now created via functions that consume the base
Policy
configuration--and that configuration is started as free functions rather than static methods. For example, where you previously wrote:import { Policy } from 'cockatiel'; Policy.handleAll().retry().attempts(3);
You instead write
import { handleAll, retry } from 'cockatiel'; retry(handleAll, { attempts: 3 );
The full changes are:
Policy.retry()
->retry(policy, options)
Policy.circuitBreaker(halfOpenAfter, breaker)
->retry(policy, { halfOpenAfter: number, breaker: IBreaker })
Policy.fallback(valueOrFactory)
->fallback(policy, valueOrFactory)
Policy.wrap(...)
->wrap(...)
Policy.timeout(duration, strategy)
->timeout(duration, strategy)
Policy.bulkhead(limit[, quue])
->bulkhead(limit[, quue])
Policy.use()
->usePolicy(policy)
This resolves #50
breaking: refactor: remove confusing Retry builder.
Previously, this package had a builder interface on
Policy.retry()...
. However, it was confusing how the different options of the builder interacted in more complex cases. For example, both the retry policy itself and the backoff could have different max attempts.We simplified it to be a simple options object given in
policy
, where the max attempts is also given. For the backoff itself, you pass the underlying backoff generator (or a custom one)Instead of:
Policy.retry().attempts(2).delay(5)
, you can writeretry(policy, { maxAttempts: 2, backoff: new ConstantBackoff(5) })
Policy.retry().delay([100, 200, 300])
, you can writeretry(policy, { maxAttempts: 3, backoff: new IterableBackoff(100, 200, 300) })
Policy.retry().exponential(opts)
, you can writeretry(policy, { backoff: new ExponentialBackoff(opts) })
Policy.retry().delegate(fn)
, you can writeretry(policy, { backoff: new DelegateBackoff(fn) })
... (truncated)
Commits
-
ae2917f
3.0.0 -
0d7a40b
docs: prep for 3.0.0 -
f390faa
docs: fix location of docblocks for editors -
ec7e703
chore: remove outdated tsconfig -
e409dcc
feat: expose wrapped policies in merged policy -
7525ad8
chore(deps): bump path-parse from 1.0.6 to 1.0.7 (#48) -
26c8d98
3.0.0-beta.1 -
dfdc25f
refactor: make policies free floating, refactor retry -
385f5a7
fix: sourcemap parse warnings -
8bafff0
fix: AbortSignal types gore, update dependencies - Additional commits viewable in compare view
Dependabot commands
You can trigger Dependabot actions by commenting on this MR
-
$dependabot rebase
will rebase this MR -
$dependabot recreate
will recreate this MR rewriting all the manual changes and resolving conflicts