Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cockatiel

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cockatiel - npm Package Versions

23

3.2.1

Diff

Changelog

Source

3.2.1

  • fix: restore breaker state when circuit state is restored
connor.peet
published 3.2.0 •

Changelog

Source

3.2.0

  • feat: allow hydration of circuit breaker initialState (#89)
  • feat: allow passing a backoff algorithm to circuit breakers' halfOpenAfter (#96)
  • feat: add new CountBreaker (#93)
  • feat: provide the attempt number to retry's context (#95)
  • fix: event listener leak in timeout
connor.peet
published 3.1.3 •

Changelog

Source

3.1.3

  • fix: decorrelatedJitter backoff returning NaN after many iterations (#86)
connor.peet
published 3.1.2 •

Changelog

Source

3.1.2

  • chore: remove test files from dist package (#84)
connor.peet
published 3.1.1 •

Changelog

Source

3.1.1

  • fix: memory leak when using timeout() in wrap() (#69)
connor.peet
published 3.1.0 •

Changelog

Source

3.1.0

  • feat: add new option abortOnReturn to timeouts (#72)
connor.peet
published 3.0.0-anyengine.0 •

connor.peet
published 3.0.0 •

Changelog

Source

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)
connor.peet
published 3.0.0-beta.1 •

Changelog

Source

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 the Policy 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 write retry(policy, { maxAttempts: 2, backoff: new ConstantBackoff(5) })
    • Policy.retry().delay([100, 200, 300]), you can write retry(policy, { maxAttempts: 3, backoff: new IterableBackoff(100, 200, 300) })
    • Policy.retry().exponential(opts), you can write retry(policy, { backoff: new ExponentialBackoff(opts) })
    • Policy.retry().delegate(fn), you can write retry(policy, { backoff: new DelegateBackoff(fn) })

    This is a little more verbose, but should be more clear to readers, and it also tree-shakes better.

    As part of this, the CompositeBackoff has been removed. This was mostly an implementation detail of the retry builder internally, and can be better implemented as a custom function in a DelegateBackoff by most consumers.

    This resolves #58

  • fix: TypeScript warnings when using other providers of AbortSignal.

connor.peet
published 3.0.0-beta.0 •

Changelog

Source

3.0.0-beta.0

  • breaking: refactor: move to using native AbortSignal over CancellationToken.

    Previously, this package provided its own implementation of cancellation via the CancellationTokenSource and CancellationToken. Now, we use the native AbortSignal which is available in browsers and Node.js since Node 16. To migrate, instead of...

    • accessing context.cancellationToken, access context.signal which is an AbortSignal,
    • pass in an AbortSignal as the second argument to Policy.execute, instead of a CancellationToken,
    • use signal.aborted instead of signal.isCancellationRequested to check for cancellation,
    • use signal.addEventListener("abort", fn) instead of signal.onCancellationRequested(fn) to listen for cancellation,
    • use new AbortController() instead of new CancellationTokenSource(), and ctrl.abort() and ctrl.signal instead of ctrl.cancel() and ctrl.token(),
    • use the helper function deriveAbortController(signal) exported from this package instead of new CancellationTokenSource(parent).
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc