Skip to content

Effect 3.10 (Release)

Effect 3.10 has been released! This release includes a number of new features and improvements. Here’s a summary of what’s new:

We are pleased to announce that @effect/schema has reached a level of maturity that allows us to merge it into the effect package.

This means that you no longer need to install @effect/schema separately, and it is now available as effect/Schema.

Here is where the various schema modules can now be found:

Before

import {
Arbitrary,
AST,
FastCheck,
JSONSchema,
ParseResult,
Pretty,
Schema
} from "@effect/schema"

After

import {
Arbitrary,
SchemaAST, // changed
FastCheck,
JSONSchema,
ParseResult,
Pretty,
Schema
} from "effect"

ArrayFormatter / TreeFormatter has been merged into the ParseResult module.

Before

import { ArrayFormatter, TreeFormatter } from "@effect/schema"

After

import { ArrayFormatter, TreeFormatter } from "effect/ParseResult"

Merged into the Schema module.

Merged into the Schema module.

Before

import { Equivalence } from "@effect/schema"
Equivalence.make(myschema)

After

import { Schema } from "effect"
Schema.equivalence(myschema)

The HttpApi modules have undergone a number of improvements:

  • HttpApi, HttpApiGroup & HttpApiEndpoint now use a chainable api instead of a pipeable api.
  • HttpApiMiddleware module has been added, with an updated way of defining security middleware.
  • You can now add multiple success schemas
  • A url search parameter schema has been added
  • Error schemas now support HttpApiSchema encoding apis
  • toWebHandler has been simplified

For more information, see the README.

The TSubscriptionRef module has been added. A TSubscriptionRef is from the STM family of modules, which allows you to create a subcribe-able Ref that also can be composed with the other STM modules, to create complex atomic operations.

These new apis allow you to create a stream from a TQueue or TPubSub.

import { Effect, Stream, TQueue } from "effect"
Effect.gen(function* () {
const queue = yield* TQueue.unbounded<number>()
const stream: Stream.Stream<number> = Stream.fromTQueue(queue)
})

The Redactable trait has been added to the Inspectable module. It is integrated with the Effect loggers, to allow you to create data types that can have sensitive data redacted when logged.

import { Headers } from "@effect/platform"
import { NodeRuntime } from "@effect/platform-node"
import { Effect } from "effect"
/*
Output:
[09:18:35.182] INFO (#0):
{ authorization: <redacted> }
*/
Effect.gen(function* () {
yield* Effect.log(
Headers.fromInput({
authorization: "Some secret key"
})
)
}).pipe(NodeRuntime.runMain)

There were several other smaller changes made. Take a look through the CHANGELOG to see them all: CHANGELOG.

Don’t forget to join our Discord Community to follow the last updates and discuss every tiny detail!