Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⬆️ Update dependency effect to v2.4.19 #69

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Feb 9, 2024

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
effect (source) 2.2.5 -> 2.4.19 age adoption passing confidence

Release Notes

Effect-TS/effect (effect)

v2.4.19

Compare Source

Patch Changes
  • #​2503 41c8102 Thanks @​gcanti! - Centralize error messages for bugs

  • #​2493 776ef2b Thanks @​gcanti! - add a RegExp module to packages/effect, closes #​2488

  • #​2499 217147e Thanks @​tim-smart! - ensure FIFO ordering when a Deferred is resolved

  • #​2502 90776ec Thanks @​tim-smart! - make tracing spans cheaper to construct

  • #​2472 8709856 Thanks @​tim-smart! - add Subscribable trait / module

    Subscribable represents a resource that has a current value and can be subscribed to for updates.

    The following data types are subscribable:

    • A SubscriptionRef
    • An Actor from the experimental Machine module
  • #​2500 232c353 Thanks @​tim-smart! - simplify scope internals

  • #​2507 0ca835c Thanks @​gcanti! - ensure correct value is passed to mapping function in mapAccum loop, closes #​2506

  • #​2472 8709856 Thanks @​tim-smart! - add Readable module / trait

    Readable is a common interface for objects that can be read from using a get
    Effect.

    For example, Ref's implement Readable:

    import { Effect, Readable, Ref } from "effect";
    import assert from "assert";
    
    Effect.gen(function* (_) {
      const ref = yield* _(Ref.make(123));
      assert(Readable.isReadable(ref));
    
      const result = yield* _(ref.get);
      assert(result === 123);
    });
  • #​2498 e983740 Thanks @​jessekelly881! - added {Readable, Subscribable}.unwrap

  • #​2494 e3e0924 Thanks @​thewilkybarkid! - Add Duration.divide and Duration.unsafeDivide.

    import { Duration, Option } from "effect";
    import assert from "assert";
    
    assert.deepStrictEqual(
      Duration.divide("10 seconds", 2),
      Option.some(Duration.decode("5 seconds")),
    );
    assert.deepStrictEqual(Duration.divide("10 seconds", 0), Option.none());
    assert.deepStrictEqual(Duration.divide("1 nano", 1.5), Option.none());
    
    assert.deepStrictEqual(
      Duration.unsafeDivide("10 seconds", 2),
      Duration.decode("5 seconds"),
    );
    assert.deepStrictEqual(
      Duration.unsafeDivide("10 seconds", 0),
      Duration.infinity,
    );
    assert.throws(() => Duration.unsafeDivide("1 nano", 1.5));

v2.4.18

Compare Source

Patch Changes
  • #​2473 dadc690 Thanks @​tim-smart! - add Logger.withConsoleLog/withConsoleError apis

    These apis send a Logger's output to console.log/console.error respectively.

    import { Logger } from "effect";
    
    // send output to stderr
    const stderrLogger = Logger.withConsoleError(Logger.stringLogger);

v2.4.17

Compare Source

Patch Changes
  • #​2461 8fdfda6 Thanks @​tim-smart! - add Inspectable.toStringUnknown/stringifyCircular

  • #​2462 607b2e7 Thanks @​tim-smart! - remove handled errors from Effect.retryOrElse

  • #​2461 8fdfda6 Thanks @​tim-smart! - improve formatting of Runtime failures

  • #​2415 8206caf Thanks @​tim-smart! - add Iterable module

    This module shares many apis compared to "effect/ReadonlyArray", but is fully lazy.

    import { Iterable, pipe } from "effect";
    
    // Only 5 items will be generated & transformed
    pipe(
      Iterable.range(1, 100),
      Iterable.map((i) => `item ${i}`),
      Iterable.take(5),
    );
  • #​2438 7ddd654 Thanks @​mikearnaldi! - Support Heterogeneous Effects in Effect Iterable apis

    Including:

    • Effect.allSuccesses
    • Effect.firstSuccessOf
    • Effect.mergeAll
    • Effect.reduceEffect
    • Effect.raceAll
    • Effect.forkAll

    For example:

    import { Effect } from "effect";
    
    class Foo extends Effect.Tag("Foo")<Foo, 3>() {}
    class Bar extends Effect.Tag("Bar")<Bar, 4>() {}
    
    // const program: Effect.Effect<(1 | 2 | 3 | 4)[], never, Foo | Bar>
    export const program = Effect.allSuccesses([
      Effect.succeed(1 as const),
      Effect.succeed(2 as const),
      Foo,
      Bar,
    ]);

    The above is now possible while before it was expecting all Effects to conform to the same type

  • #​2438 7ddd654 Thanks @​mikearnaldi! - add Effect.filterMap api

    Which allows you to filter and map an Iterable of Effects in one step.

    import { Effect, Option } from "effect";
    
    // resolves with `["even: 2"]
    Effect.filterMap(
      [Effect.succeed(1), Effect.succeed(2), Effect.succeed(3)],
      (i) => (i % 2 === 0 ? Option.some(`even: ${i}`) : Option.none()),
    );
  • #​2461 8fdfda6 Thanks @​tim-smart! - use Inspectable.toStringUnknown for absurd runtime errors

  • #​2460 f456ba2 Thanks @​tim-smart! - use const type parameter for Config.withDefault

    Which ensures that the fallback value type is not widened for literals.

v2.4.16

Compare Source

Patch Changes

v2.4.15

Compare Source

Patch Changes
  • #​2407 d7688c0 Thanks @​thewilkybarkid! - Add Config.duration

    This can be used to parse Duration's from environment variables:

    import { Config, Effect } from "effect"
    
    Config.duration("CACHE_TTL").pipe(
      Effect.andThen((duration) => ...)
    )
  • #​2416 b3a4fac Thanks @​mikearnaldi! - Collect exits on forEach interrupt of residual requests

v2.4.14

Compare Source

Patch Changes

v2.4.13

Compare Source

Patch Changes

v2.4.12

Compare Source

Patch Changes

v2.4.11

Compare Source

Patch Changes
  • #​2384 2f488c4 Thanks @​tim-smart! - update dependencies

  • #​2381 37ca592 Thanks @​tim-smart! - add fiber ref for disabling the tracer

    You can use it with the Effect.withTracerEnabled api:

    import { Effect } from "effect";
    
    Effect.succeed(42).pipe(
      Effect.withSpan("my-span"),
      // the span will not be registered with the tracer
      Effect.withTracerEnabled(false),
    );
  • #​2383 317b5b8 Thanks @​tim-smart! - add Duration.isFinite api, to determine if a duration is not Infinity

v2.4.10

Compare Source

Patch Changes

v2.4.9

Compare Source

Patch Changes

v2.4.8

Compare Source

Patch Changes

v2.4.7

Compare Source

Patch Changes

v2.4.6

Compare Source

Patch Changes

v2.4.5

Compare Source

Patch Changes

v2.4.4

Compare Source

Patch Changes
  • #​2172 5d47ee0 Thanks @​gcanti! - Brand: add refined overload

    export function refined<A extends Brand<any>>(
      f: (unbranded: Brand.Unbranded<A>) => Option.Option<Brand.BrandErrors>,
    ): Brand.Constructor<A>;
  • #​2285 817a04c Thanks @​tim-smart! - add support for AbortSignal's to runPromise

    If the signal is aborted, the effect execution will be interrupted.

    import { Effect } from "effect";
    
    const controller = new AbortController();
    
    Effect.runPromise(Effect.never, { signal: controller.signal });
    
    // abort after 1 second
    setTimeout(() => controller.abort(), 1000);
  • #​2293 d90a99d Thanks @​tim-smart! - add AbortSignal support to ManagedRuntime

  • #​2288 dd05faa Thanks @​tim-smart! - optimize addition of blocked requests to parallel collection

  • #​2288 dd05faa Thanks @​tim-smart! - use Chunk for request block collections

  • #​2280 802674b Thanks @​jessekelly881! - added support for PromiseLike

v2.4.3

Compare Source

Patch Changes
  • #​2211 20e63fb Thanks @​tim-smart! - add ManagedRuntime module, to make incremental adoption easier

    You can use a ManagedRuntime to run Effect's that can use the
    dependencies from the given Layer. For example:

    import { Console, Effect, Layer, ManagedRuntime } from "effect";
    
    class Notifications extends Effect.Tag("Notifications")<
      Notifications,
      { readonly notify: (message: string) => Effect.Effect<void> }
    >() {
      static Live = Layer.succeed(this, {
        notify: (message) => Console.log(message),
      });
    }
    
    async function main() {
      const runtime = ManagedRuntime.make(Notifications.Live);
      await runtime.runPromise(Notifications.notify("Hello, world!"));
      await runtime.dispose();
    }
    
    main();
  • #​2211 20e63fb Thanks @​tim-smart! - add Layer.toRuntimeWithMemoMap api

    Similar to Layer.toRuntime, but allows you to share a Layer.MemoMap between
    layer builds.

    By sharing the MemoMap, layers are shared between each build - ensuring layers
    are only built once between multiple calls to Layer.toRuntimeWithMemoMap.

v2.4.2

Compare Source

Patch Changes
  • #​2264 e03811e Thanks @​patroza! - fix: unmatched function fallthrough in andThen and tap

  • #​2225 ac41d84 Thanks @​mikearnaldi! - Add Effect.Tag to simplify access to service.

    This change allows to define tags in the following way:

    class DemoTag extends Effect.Tag("DemoTag")<
      DemoTag,
      {
        readonly getNumbers: () => Array<number>;
        readonly strings: Array<string>;
      }
    >() {}

    And use them like:

    DemoTag.getNumbers();
    DemoTag.strings;

    This fuses together serviceFunctions and serviceConstants in the static side of the tag.

    Additionally it allows using the service like:

    DemoTag.use((_) => _.getNumbers());

    This is especially useful when having functions that contain generics in the service given that those can't be reliably transformed at the type level and because of that we can't put them on the tag.

  • #​2238 6137533 Thanks @​JJayet! - Request: swap Success and Error params

  • #​2270 f373529 Thanks @​tim-smart! - add structured logging apis

    • Logger.json / Logger.jsonLogger
    • Logger.structured / Logger.structuredLogger

    Logger.json logs JSON serialized strings to the console.

    Logger.structured logs structured objects, which is useful in the browser
    where you can inspect objects logged to the console.

  • #​2257 1bf9f31 Thanks @​mikearnaldi! - Make sure Effect.Tag works on primitives.

    This change allows the following to work just fine:

    import { Effect, Layer } from "effect";
    
    class DateTag extends Effect.Tag("DateTag")<DateTag, Date>() {
      static date = new Date(1970, 1, 1);
      static Live = Layer.succeed(this, this.date);
    }
    
    class MapTag extends Effect.Tag("MapTag")<MapTag, Map<string, string>>() {
      static Live = Layer.effect(
        this,
        Effect.sync(() => new Map()),
      );
    }
    
    class NumberTag extends Effect.Tag("NumberTag")<NumberTag, number>() {
      static Live = Layer.succeed(this, 100);
    }
  • #​2244 e3ff789 Thanks @​tim-smart! - add FiberMap/FiberSet.join api

    This api can be used to propogate failures back to a parent fiber, in case any of the fibers added to the FiberMap/FiberSet fail with an error.

    Example:

    import { Effect, FiberSet } from "effect";
    
    Effect.gen(function* (_) {
      const set = yield* _(FiberSet.make());
      yield* _(FiberSet.add(set, Effect.runFork(Effect.fail("error"))));
    
      // parent fiber will fail with "error"
      yield* _(FiberSet.join(set));
    });
  • #​2238 6137533 Thanks @​JJayet! - make Effect.request dual

  • #​2263 507ba40 Thanks @​thewilkybarkid! - Allow duration inputs to be singular

  • #​2255 e466afe Thanks @​jessekelly881! - added Either.Either.{Left,Right} and Option.Option.Value type utils

  • #​2270 f373529 Thanks @​tim-smart! - add Logger.batched, for batching logger output

    It takes a duration window and an effectful function that processes the batched output.

    Example:

    import { Console, Effect, Logger } from "effect";
    
    const LoggerLive = Logger.replaceScoped(
      Logger.defaultLogger,
      Logger.logfmtLogger.pipe(
        Logger.batched("500 millis", (messages) =>
          Console.log("BATCH", messages.join("\n")),
        ),
      ),
    );
    
    Effect.gen(function* (_) {
      yield* _(Effect.log("one"));
      yield* _(Effect.log("two"));
      yield* _(Effect.log("three"));
    }).pipe(Effect.provide(LoggerLive), Effect.runFork);
  • #​2233 de74eb8 Thanks @​gcanti! - Struct: make pick / omit dual

v2.4.1

Compare Source

Patch Changes
  • #​2503 41c8102 Thanks @​gcanti! - Centralize error messages for bugs

  • #​2493 776ef2b Thanks @​gcanti! - add a RegExp module to packages/effect, closes #​2488

  • #​2499 217147e Thanks @​tim-smart! - ensure FIFO ordering when a Deferred is resolved

  • #​2502 90776ec Thanks @​tim-smart! - make tracing spans cheaper to construct

  • #​2472 8709856 Thanks @​tim-smart! - add Subscribable trait / module

    Subscribable represents a resource that has a current value and can be subscribed to for updates.

    The following data types are subscribable:

    • A SubscriptionRef
    • An Actor from the experimental Machine module
  • #​2500 232c353 Thanks @​tim-smart! - simplify scope internals

  • #​2507 0ca835c Thanks @​gcanti! - ensure correct value is passed to mapping function in mapAccum loop, closes #​2506

  • #​2472 8709856 Thanks @​tim-smart! - add Readable module / trait

    Readable is a common interface for objects that can be read from using a get
    Effect.

    For example, Ref's implement Readable:

    import { Effect, Readable, Ref } from "effect";
    import assert from "assert";
    
    Effect.gen(function* (_) {
      const ref = yield* _(Ref.make(123));
      assert(Readable.isReadable(ref));
    
      const result = yield* _(ref.get);
      assert(result === 123);
    });
  • #​2498 e983740 Thanks @​jessekelly881! - added {Readable, Subscribable}.unwrap

  • #​2494 e3e0924 Thanks @​thewilkybarkid! - Add Duration.divide and Duration.unsafeDivide.

    import { Duration, Option } from "effect";
    import assert from "assert";
    
    assert.deepStrictEqual(
      Duration.divide("10 seconds", 2),
      Option.some(Duration.decode("5 seconds")),
    );
    assert.deepStrictEqual(Duration.divide("10 seconds", 0), Option.none());
    assert.deepStrictEqual(Duration.divide("1 nano", 1.5), Option.none());
    
    assert.deepStrictEqual(
      Duration.unsafeDivide("10 seconds", 2),
      Duration.decode("5 seconds"),
    );
    assert.deepStrictEqual(
      Duration.unsafeDivide("10 seconds", 0),
      Duration.infinity,
    );
    assert.throws(() => Duration.unsafeDivide("1 nano", 1.5));

v2.4.0

Compare Source

Minor Changes
  • #​2101 5de7be5 Thanks @​github-actions! - remove ReadonlyRecord.fromIterable (duplicate of fromEntries)

  • #​2101 489fcf3 Thanks @​github-actions! - - swap Schedule type parameters from Schedule<out Env, in In, out Out> to Schedule<out Out, in In = unknown, out R = never>, closes #​2154

    • swap ScheduleDriver type parameters from ScheduleDriver<out Env, in In, out Out> to ScheduleDriver<out Out, in In = unknown, out R = never>
  • #​2101 7d9c3bf Thanks @​github-actions! - Consolidate Effect.asyncOption, Effect.asyncEither, Stream.asyncOption, Stream.asyncEither, and Stream.asyncInterrupt

    This PR removes Effect.asyncOption and Effect.asyncEither as their behavior can be entirely implemented with the new signature of Effect.async, which optionally returns a cleanup Effect from the registration callback.

    declare const async: <A, E = never, R = never>(
      register: (
        callback: (_: Effect<A, E, R>) => void,
        signal: AbortSignal,
      ) => void | Effect<void, never, R>,
      blockingOn?: FiberId,
    ) => Effect<A, E, R>;

    Additionally, this PR removes Stream.asyncOption, Stream.asyncEither, and Stream.asyncInterrupt as their behavior can be entirely implemented with the new signature of Stream.async, which can optionally return a cleanup Effect from the registration callback.

    declare const async: <A, E = never, R = never>(
      register: (emit: Emit<R, E, A, void>) => Effect<void, never, R> | void,
      outputBuffer?: number,
    ) => Stream<A, E, R>;
  • #​2101 d8d278b Thanks @​github-actions! - swap GroupBy type parameters from GroupBy<out R, out E, out K, out V> to GroupBy<out K, out V, out E = never, out R = never>

  • #​2101 14c5711 Thanks @​github-actions! - Remove Effect.unified and Effect.unifiedFn in favour of Unify.unify.

    The Unify module fully replaces the need for specific unify functions, when before you did:

    import { Effect } from "effect";
    
    const effect = Effect.unified(
      Math.random() > 0.5 ? Effect.succeed("OK") : Effect.fail("NO"),
    );
    const effectFn = Effect.unifiedFn((n: number) =>
      Math.random() > 0.5 ? Effect.succeed("OK") : Effect.fail("NO"),
    );

    You can now do:

    import { Effect, Unify } from "effect";
    
    const effect = Unify.unify(
      Math.random() > 0.5 ? Effect.succeed("OK") : Effect.fail("NO"),
    );
    const effectFn = Unify.unify((n: number) =>
      Math.random() > 0.5 ? Effect.succeed("OK") : Effect.fail("NO"),
    );
  • #​2101 5de7be5 Thanks @​github-actions! - add key type to ReadonlyRecord

  • #​2101 585fcce Thanks @​github-actions! - add support for optional property keys to pick, omit and get

    Before:

    import { pipe } from "effect/Function";
    import * as S from "effect/Struct";
    
    const struct: {
      a?: string;
      b: number;
      c: boolean;
    } = { b: 1, c: true };
    
    // error
    const x = pipe(struct, S.pick("a", "b"));
    
    const record: Record<string, number> = {};
    
    const y = pipe(record, S.pick("a", "b"));
    console.log(y); // => { a: undefined, b: undefined }
    
    // error
    console.log(pipe(struct, S.get("a")));

    Now

    import { pipe } from "effect/Function";
    import * as S from "effect/Struct";
    
    const struct: {
      a?: string;
      b: number;
      c: boolean;
    } = { b: 1, c: true };
    
    const x = pipe(struct, S.pick("a", "b"));
    console.log(x); // => { b: 1 }
    
    const record: Record<string, number> = {};
    
    const y = pipe(record, S.pick("a", "b"));
    console.log(y); // => {}
    
    console.log(pipe(struct, S.get("a"))); // => undefined
  • #​2101 a025b12 Thanks @​github-actions! - Swap type params of Either from Either<E, A> to Either<R, L = never>.

    Along the same line of the other changes this allows to shorten the most common types such as:

    import { Either } from "effect";
    
    const right: Either.Either<string> = Either.right("ok");
Patch Changes

v2.3.8

Compare Source

Patch Changes
  • #​2167 5ad2eec Thanks @​tim-smart! - add Hash.cached

    This api assists with adding a layer of caching, when hashing immutable data structures.

    import { Data, Hash } from "effect";
    
    class User extends Data.Class<{
      id: number;
      name: string;
    }> {
      [Hash.symbol]() {
        return Hash.cached(this, Hash.string(`${this.id}-${this.name}`));
      }
    }
  • #​2187 e6d36c0 Thanks @​tim-smart! - update development dependencies

v2.3.7

Compare Source

Patch Changes
  • #​2142 bc8404d Thanks @​mikearnaldi! - Expose version control via ModuleVersion.

    This enables low level framework authors to run their own effect version which won't conflict with any other effect versions running on the same process.

    Imagine cases where for example a function runtime is built on effect, we don't want lifecycle of the runtime to clash with lifecycle of user-land provided code.

    To manually control the module version one can use:

    import * as ModuleVersion from "effect/ModuleVersion";
    
    ModuleVersion.setCurrentVersion(
      `my-effect-runtime-${ModuleVersion.getCurrentVersion()}`,
    );

    Note that this code performs side effects and should be executed before any module is imported ideally via an init script.

    The resulting order of execution has to be:

    import * as ModuleVersion from "effect/ModuleVersion";
    
    ModuleVersion.setCurrentVersion(
      `my-effect-runtime-${ModuleVersion.getCurrentVersion()}`,
    );
    
    import { Effect } from "effect";
    
    // rest of code
  • #​2159 2c5cbcd Thanks @​IMax153! - Avoid incrementing cache hits for expired entries

  • #​2165 6565916 Thanks @​tim-smart! - fix Hash implemention for Option.none

v2.3.6

Compare Source

Patch Changes
  • #​2145 b1163b2 Thanks @​tim-smart! - add RequestResolver.aroundRequests api

    This can be used to run side effects that introspect the requests being
    executed.

    Example:

    import { Effect, Request, RequestResolver } from "effect";
    
    interface GetUserById extends Request.Request<unknown> {
      readonly id: number;
    }
    
    declare const resolver: RequestResolver.RequestResolver<GetUserById>;
    
    RequestResolver.aroundRequests(
      resolver,
      (requests) => Effect.log(`got ${requests.length} requests`),
      (requests, _) => Effect.log(`finised running ${requests.length} requests`),
    );
  • #​2148 b46b869 Thanks @​riordanpawley! - Flipped scheduleForked types to match new <A, E, R> signature

  • #​2139 de1b226 Thanks @​mikearnaldi! - Introduce FiberId.Single, make FiberId.None behave like FiberId.Runtime, relax FiberRefs to use Single instead of Runtime.

    This change is a precursor to enable easier APIs to modify the Runtime when patching FiberRefs.

  • #​2137 a663390 Thanks @​mikearnaldi! - Expose Random Tag and functions to use a specific random service implementation

  • #​2143 ff88f80 Thanks @​mikearnaldi! - Fix Cause.pretty when toString is invalid

    import { Cause } from "effect";
    
    console.log(Cause.pretty(Cause.fail([{ toString: "" }])));

    The code above used to throw now it prints:

    Error: [{"toString":""}]
  • #​2080 11be07b Thanks @​KhraksMamtsov! - Add functional analogue of satisfies operator.
    This is a convenient operator to use in the pipe chain to localize type errors closer to their source.

    import { satisfies } from "effect/Function";
    
    const test1 = satisfies<number>()(5 as const);
    // ^? const test: 5
    
    // @&#8203;ts-expect-error
    const test2 = satisfies<string>()(5);
    // ^? Argument of type 'number' is not assignable to parameter of type 'string'
  • #​2147 c568645 Thanks @​tim-smart! - generate a random span id for the built-in tracer

    This ensures the same span id isn't used between application runs.

  • #​2144 88835e5 Thanks @​mikearnaldi! - Fix withRandom and withClock types

  • #​2138 b415577 Thanks @​mikearnaldi! - Fix internals of TestAnnotationsMap making it respect equality

  • #​2149 ff8046f Thanks @​tim-smart! - add Runtime.updateFiberRefs/setFiberRef/deleteFiberRef

    This change allows you to update fiber ref values inside a Runtime object.

    Example:

    import { Effect, FiberRef, Runtime } from "effect";
    
    const ref = FiberRef.unsafeMake(0);
    
    const updatedRuntime = Runtime.defaultRuntime.pipe(
      Runtime.setFiberRef(ref, 1),
    );
    
    // returns 1
    const result = Runtime.runSync(updatedRuntime)(FiberRef.get(ref));

v2.3.5

Compare Source

Patch Changes

v2.3.4

Compare Source

Patch Changes

v2.3.3

Compare Source

Patch Changes
  • #​2090 efd41d8 Thanks @​hsubra89! - Update RateLimiter to support passing in a custom cost per effect. This is really useful for API(s) that have a "credit cost" per endpoint.

    Usage Example :

    import { Effect, RateLimiter } from "effect";
    import { compose } from "effect/Function";
    
    const program = Effect.scoped(
      Effect.gen(function* ($) {
        // Create a rate limiter that has an hourly limit of 1000 credits
        const rateLimiter = yield* $(RateLimiter.make(1000, "1 hours"));
        // Query API costs 1 credit per call ( 1 is the default cost )
        const queryAPIRL = compose(rateLimiter, RateLimiter.withCost(1));
        // Mutation API costs 5 credits per call
        const mutationAPIRL = compose(rateLimiter, RateLimiter.withCost(5));
        // ...
        // Use the pre-defined rate limiters
        yield* $(queryAPIRL(Effect.log("Sample Query")));
        yield* $(mutationAPIRL(Effect.log("Sample Mutation")));
    
        // Or set a cost on-the-fly
        yield* $(
          rateLimiter(Effect.log("Another query with a different cost")).pipe(
            RateLimiter.withCost(3),
          ),
        );
      }),
    );
  • #​2097 0f83515 Thanks @​IMax153! - Updates the RateLimiter.make constructor to take an object of RateLimiter.Options, which allows for specifying the rate-limiting algorithm to utilize:

    You can choose from either the token-bucket or the fixed-window algorithms for rate-limiting.

    export declare namespace RateLimiter {
      export interface Options {
        /**
         * The maximum number of requests that should be allowed.
         */
        readonly limit: number;
        /**
         * The interval to utilize for rate-limiting requests. The semantics of the
         * specified `interval` vary depending on the chosen `algorithm`:
         *
         * `token-bucket`: The maximum number of requests will be spread out over
         * the provided interval if no tokens are available.
         *
         * For example, for a `RateLimiter` using the `token-bucket` algorithm with
         * a `limit` of `10` and an `interval` of `1 seconds`, `1` request can be
         * made every `100 millis`.
         *
         * `fixed-window`: The maximum number of requests will be reset during each
         * interval. For example, for a `RateLimiter` using the `fixed-window`
         * algorithm with a `limit` of `10` and an `interval` of `1 seconds`, a
         * maximum of `10` requests can be made each second.
         */
        readonly interval: DurationInput;
        /**
         * The algorithm to utilize for rate-limiting requests.
         *
         * Defaults to `token-bucket`.
         */
        readonly algorithm?: "fixed-window" | "token-bucket";
      }
    }
  • #​2097 0f83515 Thanks @​IMax153! - return the resulting available permits from Semaphore.release

v2.3.2

Compare Source

Patch Changes
  • #​2096 6654f5f Thanks @​tim-smart! - default to never for Runtime returning functions

    This includes:

    • Effect.runtime
    • FiberSet.makeRuntime

    It prevents unknown from creeping into types, as well as never being a
    useful default type for propogating Fiber Refs and other context.

  • #​2094 2eb11b4 Thanks @​tim-smart! - revert some type param adjustments in FiberSet

    makeRuntime now has the R parameter first again.

    Default to unknown for the A and E parameters instead of never.

  • #​2103 56c09bd Thanks @​patroza! - Expand Either and Option andThen to support the map case like Effects' andThen

    For example:

    expect(pipe(Either.right(1), Either.andThen(2))).toStrictEqual(
      Either.right(2),
    );
    expect(
      pipe(
        Either.right(1),
        Either.andThen(() => 2),
      ),
    ).toStrictEqual(Either.right(2));
    
    expect(pipe(Option.some(1), Option.andThen(2))).toStrictEqual(Option.some(2));
    expect(
      pipe(
        Option.some(1),
        Option.andThen(() => 2),
      ),
    ).toStrictEqual(Option.some(2));
  • #​2098 71aa5b1 Thanks @​ethanniser! - removed ./internal/timeout and replaced all usages with setTimeout directly

    previously it was required to abstract away conditionally solving an bun had an issue with setTimeout, that caused incorrect behavior
    that bug has since been fixed, and the isBun check is no longer needed
    as such the timeout module is also no longer needed

  • #​2099 1700af8 Thanks @​tim-smart! - optimize Effect.zip{Left,Right}

    for the sequential case, avoid using Effect.all internally

v2.3.1

Compare Source

Patch Changes

v2.3.0

Compare Source

Minor Changes

Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Enabled.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot added renovate upgrade Any kind of dependency updates labels Feb 9, 2024
renovate-approve[bot]
renovate-approve bot previously approved these changes Feb 9, 2024
@renovate renovate bot changed the title ⬆️ Update dependency effect to v2.3.1 ⬆️ Update dependency effect to v2.3.2 Feb 11, 2024
renovate-approve[bot]
renovate-approve bot previously approved these changes Feb 11, 2024
@renovate renovate bot changed the title ⬆️ Update dependency effect to v2.3.2 ⬆️ Update dependency effect to v2.3.3 Feb 12, 2024
renovate-approve[bot]
renovate-approve bot previously approved these changes Feb 12, 2024
@renovate renovate bot changed the title ⬆️ Update dependency effect to v2.3.3 ⬆️ Update dependency effect to v2.3.4 Feb 13, 2024
renovate-approve[bot]
renovate-approve bot previously approved these changes Feb 13, 2024
@renovate renovate bot changed the title ⬆️ Update dependency effect to v2.3.4 ⬆️ Update dependency effect to v2.3.5 Feb 13, 2024
renovate-approve[bot]
renovate-approve bot previously approved these changes Feb 13, 2024
@renovate renovate bot changed the title ⬆️ Update dependency effect to v2.3.5 ⬆️ Update dependency effect to v2.3.6 Feb 15, 2024
renovate-approve[bot]
renovate-approve bot previously approved these changes Feb 15, 2024
@renovate renovate bot force-pushed the renovate/effect-2.x branch 2 times, most recently from f3c9102 to 02d1bdd Compare February 17, 2024 14:02
@renovate renovate bot changed the title ⬆️ Update dependency effect to v2.3.6 ⬆️ Update dependency effect to v2.3.7 Feb 18, 2024
@renovate renovate bot force-pushed the renovate/effect-2.x branch 4 times, most recently from a09e8f3 to 90f229c Compare August 12, 2024 03:52
@renovate renovate bot force-pushed the renovate/effect-2.x branch 6 times, most recently from 830d940 to d51cd1a Compare August 19, 2024 08:21
@renovate renovate bot force-pushed the renovate/effect-2.x branch 4 times, most recently from f708fd1 to a85adf7 Compare August 28, 2024 22:32
@renovate renovate bot force-pushed the renovate/effect-2.x branch 5 times, most recently from 8bca368 to 8fd9cb0 Compare September 8, 2024 09:10
@renovate renovate bot force-pushed the renovate/effect-2.x branch 9 times, most recently from 01f85f6 to 8a71d9d Compare September 16, 2024 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
renovate upgrade Any kind of dependency updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants