Packages

effect

4.1.4 · 11 Nov 2026MIT67.1M / weekRepositoryHomepagenpmAtom feed

Your version

3.11.0

2 Dec 2024Where it was published

3.22.5 is the newest release of 3.x.

In short

15 new3 fixed

Security

2 advisories affect 3.11.0; 3.22.1 fixes them

Release note

Minor Changes

  • Ensure scopes are preserved by stream / sink / channel operations

    NOTE: This change does modify the public signature of several Stream / Sink / Channel methods. Namely, certain run methods that previously removed a Scope from the environment will no longer do so. This was a bug with the previous implementation of how scopes were propagated, and is why this change is being made in a minor release.

  • Add Context.Reference - a Tag with a default value

  • Add Effect.scopedWith to run an effect that depends on a Scope, and then closes the Scope after the effect has completed

    import { Effect, Scope } from "effect"
    
    const program: Effect.Effect<void> = Effect.scopedWith((scope) =>
      Effect.acquireRelease(Effect.log("Acquiring..."), () =>
        Effect.log("Releasing...")
      ).pipe(Scope.extend(scope))
    )
    
    Effect.runPromise(program)
    // Output:
    // timestamp=2024-11-26T16:44:54.158Z level=INFO fiber=#0 message=Acquiring...
    // timestamp=2024-11-26T16:44:54.165Z level=INFO fiber=#0 message=Releasing...
  • Remove Env, EnvRef & FiberFlags from Micro

  • Config.url constructor has been added, which parses a string using new URL()

  • Use fiber based runtime for Micro module

    • Improved performance

    • Improved interruption model

    • Consistency with the Effect data type

  • New methods extractAll and extractSchema to UrlParams (added Schema.BooleanFromString).

  • Integrated DateTime with Cron to add timezone support for cron expressions.

  • URL and URLFromSelf schemas have been added

  • Added BigDecimal.toExponential for scientific notation formatting of BigDecimal values.

    The implementation of BigDecimal.format now uses scientific notation for values with
    at least 16 decimal places or trailing zeroes. Previously, extremely large or small values
    could cause OutOfMemory errors when formatting.

  • JSONSchema module

    • add format?: string optional field to JsonSchema7String interface

    • Schema module

      • add custom json schema annotation to UUID schema including format: "uuid"

    • OpenApiJsonSchema module

      • add format?: string optional field to String and Numeric interfaces

  • Implement Effect.fn to define traced functions.

    import { Effect } from "effect"
    
    const logExample = Effect.fn("example")(function* <N extends number>(n: N) {
      yield* Effect.annotateCurrentSpan("n", n)
      yield* Effect.logInfo(`got: ${n}`)
      yield* Effect.fail(new Error())
    }, Effect.delay("1 second"))
    
    Effect.runFork(logExample(100).pipe(Effect.catchAllCause(Effect.logError)))
  • Config.redacted has been made more flexible and can now wrap any other config. This allows to transform or validate config values before it’s hidden.

    import { Config } from "effect"
    
    Effect.gen(function* () {
      // can be any string including empty
      const pass1 = yield* Config.redacted("PASSWORD")
      //    ^? Redacted<string>
    
      // can't be empty string
      const pass2 = yield* Config.redacted(Config.nonEmptyString("PASSWORD"))
      //    ^? Redacted<string>
    
      const pass2 = yield* Config.redacted(Config.number("SECRET_NUMBER"))
      //    ^? Redacted<number>
    })
  • Added BigDecimal.unsafeFromNumber and BigDecimal.safeFromNumber.

    Deprecated BigDecimal.fromNumber in favour of BigDecimal.unsafeFromNumber.

    The current implementation of BigDecimal.fromNumber and BigDecimal.unsafeFromNumber now throws
    a RangeError for numbers that are not finite such as NaN, +Infinity or -Infinity.

Patch Changes

  • Fix multipart support for bun http server

  • Inherit child fibers created by merged streams

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.