github Effect-TS/effect effect@3.21.0

Minor Changes

  • #5780 f7bb09b Thanks @kitlangton! - Add Cron.prev and reverse iteration support, aligning next/prev lookup tables, fixing DST handling symmetry, and expanding cron backward/forward test coverage.

  • #5780 bd7552a Thanks @mattiamanzati! - Add type-level utils to asserting layer types

  • #5780 ad1a7eb Thanks @schickling! - RcMap: support dynamic idleTimeToLive values per key

    The idleTimeToLive option can now be a function that receives the key and returns a duration, allowing different TTL values for different resources.

    const map =
      yield *
      RcMap.make({
        lookup: (key: string) => acquireResource(key),
        idleTimeToLive: (key: string) => {
          if (key.startsWith("premium:")) return Duration.minutes(10)
          return Duration.minutes(1)
        }
      })
  • #5780 0d32048 Thanks @mikearnaldi! - Fix annotateCurrentSpan, add Effect.currentPropagatedSpan

Patch Changes

  • #5780 0d32048 Thanks @mikearnaldi! - Add logs to first propagated span, in the following case before this fix the log would not be added to the p span because Effect.fn adds a fake span for the purpose of adding a stack frame.

    import { Effect } from "effect"
    
    const f = Effect.fn(function* () {
      yield* Effect.logWarning("FooBar")
      return yield* Effect.fail("Oops")
    })
    
    const p = f().pipe(Effect.withSpan("p"))

Don't miss a new effect release

NewReleases is sending notifications on new releases.