Skip to content

Releases: Effect-TS/effect

@effect/[email protected]

01 Oct 07:09
823e04e
Compare
Choose a tag to compare

Patch Changes

@effect/[email protected]

01 Oct 07:26
9131e6d
Compare
Choose a tag to compare

Patch Changes

  • #3705 534abce Thanks @Schniz! - add withActiveSpan function to attach Effect to current Span

    This function allows you to connect the Effect spans into a parent span
    that was created outside of Effect, using the OpenTelemetry context propagation:

    Effect.gen(function* () {
      yield* Effect.sleep("100 millis").pipe(Effect.withSpan("sleep"))
      yield* Console.log("done")
    }).pipe(
      Effect.withSpan("program"),
      // This connects child spans to the current OpenTelemetry context
      Tracer.withActiveSpan
    )

@effect/[email protected]

27 Sep 00:02
3b5b332
Compare
Choose a tag to compare

Patch Changes

  • #3689 4d91f41 Thanks @tim-smart! - add layer api to @effect/vitest

    This allows you to share a Layer between multiple tests, optionally wrapping
    the tests in a describe block.

    import { expect, layer } from "@effect/vitest"
    import { Context, Effect, Layer } from "effect"
    
    class Foo extends Context.Tag("Foo")<Foo, "foo">() {
      static Live = Layer.succeed(Foo, "foo")
    }
    
    class Bar extends Context.Tag("Bar")<Bar, "bar">() {
      static Live = Layer.effect(
        Bar,
        Effect.map(Foo, () => "bar" as const)
      )
    }
    
    layer(Foo.Live)("layer", (it) => {
      it.effect("adds context", () =>
        Effect.gen(function* () {
          const foo = yield* Foo
          expect(foo).toEqual("foo")
        })
      )
    
      it.layer(Bar.Live)("nested", (it) => {
        it.effect("adds context", () =>
          Effect.gen(function* () {
            const foo = yield* Foo
            const bar = yield* Bar
            expect(foo).toEqual("foo")
            expect(bar).toEqual("bar")
          })
        )
      })
    })

[email protected]

25 Sep 03:21
46efdc6
Compare
Choose a tag to compare

Patch Changes

@effect/[email protected]

25 Sep 03:22
46efdc6
Compare
Choose a tag to compare

Patch Changes

@effect/[email protected]

25 Sep 03:22
46efdc6
Compare
Choose a tag to compare

Patch Changes

@effect/[email protected]

25 Sep 07:57
ce8b810
Compare
Choose a tag to compare

Minor Changes

@effect/[email protected]

25 Sep 04:15
0f262fc
Compare
Choose a tag to compare

Patch Changes

@effect/[email protected]

25 Sep 03:21
46efdc6
Compare
Choose a tag to compare

Patch Changes

  • #3676 0a68746 Thanks @tomglaize! - Add VariantSchema fieldFromKey utility to rename the encoded side of a field by variant.

    Example usage:

    import { Schema } from "@effect/schema"
    import { VariantSchema } from "@effect/experimental"
    
    const { Class, fieldFromKey } = VariantSchema.make({
      variants: ["domain", "json"],
      defaultVariant: "domain"
    })
    
    class User extends Class<User>("User")({
      id: Schema.Int,
      firstName: Schema.String.pipe(fieldFromKey({ json: "first_name" }))
    }) {}
    
    console.log(
      Schema.encodeSync(User.json)({
        id: 1,
        firstName: "Bob"
      })
    )
    /*
    { id: 1, first_name: 'Bob' }
    */
  • Updated dependencies [0a68746, 734eae6, fd83d0e, 4509656, ad7e1de, 090e41c, 090e41c]:

@effect/[email protected]

25 Sep 07:58
ce8b810
Compare
Choose a tag to compare

Patch Changes