effect@3.11.0
Minor Changes
-
#3835
147434bThanks @IMax153! - Ensure scopes are preserved by stream / sink / channel operationsNOTE: This change does modify the public signature of several
Stream/Sink/Channelmethods. Namely, certain run methods that previously removed aScopefrom 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. -
#3835
6e69493Thanks @tim-smart! - add Context.Reference - a Tag with a default value -
#3835
147434bThanks @IMax153! - AddEffect.scopedWithto run an effect that depends on aScope, and then closes theScopeafter the effect has completedimport { 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...
-
#3835
d9fe79bThanks @tim-smart! - remove Env, EnvRef & FiberFlags from Micro -
#3835
251d189Thanks @KhraksMamtsov! -Config.urlconstructor has been added, which parses a string usingnew URL() -
#3835
5a259f3Thanks @tim-smart! - use fiber based runtime for Micro module- Improved performance
- Improved interruption model
- Consistency with the Effect data type
-
#3835
b4ce4eaThanks @SandroMaglione! - New methodsextractAllandextractSchematoUrlParams(addedSchema.BooleanFromString). -
#3835
15fcc5aThanks @fubhy! - IntegratedDateTimewithCronto add timezone support for cron expressions. -
#3835
9bc9a47Thanks @KhraksMamtsov! -URLandURLFromSelfschemas have been added -
#3835
aadb8a4Thanks @fubhy! - AddedBigDecimal.toExponentialfor scientific notation formatting ofBigDecimalvalues.The implementation of
BigDecimal.formatnow uses scientific notation for values with
at least 16 decimal places or trailing zeroes. Previously, extremely large or small values
could causeOutOfMemoryerrors when formatting. -
#3835
1e2747cThanks @KhraksMamtsov! - - JSONSchema module- add
format?: stringoptional field toJsonSchema7Stringinterface - Schema module
- add custom json schema annotation to
UUIDschema includingformat: "uuid"
- add custom json schema annotation to
- OpenApiJsonSchema module
- add
format?: stringoptional field toStringandNumericinterfaces
- add
- add
-
#3835
e0b9b09Thanks @mikearnaldi! - 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)))
-
#3835
c36f3b9Thanks @KhraksMamtsov! -Config.redactedhas 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> })
-
#3835
aadb8a4Thanks @fubhy! - AddedBigDecimal.unsafeFromNumberandBigDecimal.safeFromNumber.Deprecated
BigDecimal.fromNumberin favour ofBigDecimal.unsafeFromNumber.The current implementation of
BigDecimal.fromNumberandBigDecimal.unsafeFromNumbernow throws
aRangeErrorfor numbers that are not finite such asNaN,+Infinityor-Infinity.