effect 3.0.7 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Channel.js.map +1 -1
- package/dist/cjs/Data.js +15 -1
- package/dist/cjs/Data.js.map +1 -1
- package/dist/cjs/Effect.js +44 -7
- package/dist/cjs/Effect.js.map +1 -1
- package/dist/cjs/Layer.js.map +1 -1
- package/dist/cjs/SortedMap.js +24 -1
- package/dist/cjs/SortedMap.js.map +1 -1
- package/dist/cjs/Stream.js +8 -3
- package/dist/cjs/Stream.js.map +1 -1
- package/dist/cjs/Tracer.js.map +1 -1
- package/dist/cjs/internal/cause.js +3 -3
- package/dist/cjs/internal/cause.js.map +1 -1
- package/dist/cjs/internal/channel.js.map +1 -1
- package/dist/cjs/internal/core-effect.js +1 -1
- package/dist/cjs/internal/core-effect.js.map +1 -1
- package/dist/cjs/internal/core.js +1 -0
- package/dist/cjs/internal/core.js.map +1 -1
- package/dist/cjs/internal/effect/circular.js +7 -1
- package/dist/cjs/internal/effect/circular.js.map +1 -1
- package/dist/cjs/internal/fiberRuntime.js +15 -1
- package/dist/cjs/internal/fiberRuntime.js.map +1 -1
- package/dist/cjs/internal/layer/circular.js.map +1 -1
- package/dist/cjs/internal/layer.js.map +1 -1
- package/dist/cjs/internal/stream.js +23 -3
- package/dist/cjs/internal/stream.js.map +1 -1
- package/dist/cjs/internal/tracer.js +4 -2
- package/dist/cjs/internal/tracer.js.map +1 -1
- package/dist/cjs/internal/version.js +1 -1
- package/dist/dts/Channel.d.ts +2 -14
- package/dist/dts/Channel.d.ts.map +1 -1
- package/dist/dts/Data.d.ts +20 -5
- package/dist/dts/Data.d.ts.map +1 -1
- package/dist/dts/Effect.d.ts +56 -60
- package/dist/dts/Effect.d.ts.map +1 -1
- package/dist/dts/Layer.d.ts +3 -18
- package/dist/dts/Layer.d.ts.map +1 -1
- package/dist/dts/SortedMap.d.ts +13 -0
- package/dist/dts/SortedMap.d.ts.map +1 -1
- package/dist/dts/Stream.d.ts +7 -14
- package/dist/dts/Stream.d.ts.map +1 -1
- package/dist/dts/Tracer.d.ts +19 -1
- package/dist/dts/Tracer.d.ts.map +1 -1
- package/dist/dts/Types.d.ts +18 -0
- package/dist/dts/Types.d.ts.map +1 -1
- package/dist/dts/internal/fiberRuntime.d.ts +6 -1
- package/dist/dts/internal/fiberRuntime.d.ts.map +1 -1
- package/dist/esm/Channel.js.map +1 -1
- package/dist/esm/Data.js +14 -0
- package/dist/esm/Data.js.map +1 -1
- package/dist/esm/Effect.js +40 -3
- package/dist/esm/Effect.js.map +1 -1
- package/dist/esm/Layer.js.map +1 -1
- package/dist/esm/SortedMap.js +22 -0
- package/dist/esm/SortedMap.js.map +1 -1
- package/dist/esm/Stream.js +5 -0
- package/dist/esm/Stream.js.map +1 -1
- package/dist/esm/Tracer.js.map +1 -1
- package/dist/esm/internal/cause.js +3 -3
- package/dist/esm/internal/cause.js.map +1 -1
- package/dist/esm/internal/channel.js.map +1 -1
- package/dist/esm/internal/core-effect.js +1 -1
- package/dist/esm/internal/core-effect.js.map +1 -1
- package/dist/esm/internal/core.js +1 -0
- package/dist/esm/internal/core.js.map +1 -1
- package/dist/esm/internal/effect/circular.js +6 -0
- package/dist/esm/internal/effect/circular.js.map +1 -1
- package/dist/esm/internal/fiberRuntime.js +13 -0
- package/dist/esm/internal/fiberRuntime.js.map +1 -1
- package/dist/esm/internal/layer/circular.js.map +1 -1
- package/dist/esm/internal/layer.js.map +1 -1
- package/dist/esm/internal/stream.js +19 -0
- package/dist/esm/internal/stream.js.map +1 -1
- package/dist/esm/internal/tracer.js +4 -2
- package/dist/esm/internal/tracer.js.map +1 -1
- package/dist/esm/internal/version.js +1 -1
- package/package.json +1 -1
- package/src/Channel.ts +2 -14
- package/src/Data.ts +39 -3
- package/src/Effect.ts +60 -66
- package/src/Layer.ts +3 -18
- package/src/SortedMap.ts +35 -0
- package/src/Stream.ts +12 -14
- package/src/Tracer.ts +22 -1
- package/src/Types.ts +21 -0
- package/src/internal/cause.ts +3 -3
- package/src/internal/channel.ts +2 -14
- package/src/internal/core-effect.ts +19 -43
- package/src/internal/core.ts +1 -0
- package/src/internal/effect/circular.ts +16 -0
- package/src/internal/fiberRuntime.ts +33 -21
- package/src/internal/layer/circular.ts +1 -6
- package/src/internal/layer.ts +17 -20
- package/src/internal/stream.ts +27 -14
- package/src/internal/tracer.ts +5 -3
- package/src/internal/version.ts +1 -1
package/dist/dts/Effect.d.ts
CHANGED
|
@@ -527,16 +527,11 @@ export declare const forEach: {
|
|
|
527
527
|
readonly batching?: boolean | "inherit" | undefined;
|
|
528
528
|
readonly discard: true;
|
|
529
529
|
}): (self: Iterable<A>) => Effect<void, E, R>;
|
|
530
|
-
<
|
|
530
|
+
<B, E, R, S extends Iterable<any>>(self: S, f: (a: RA.ReadonlyArray.Infer<S>, i: number) => Effect<B, E, R>, options?: {
|
|
531
531
|
readonly concurrency?: Concurrency | undefined;
|
|
532
532
|
readonly batching?: boolean | "inherit" | undefined;
|
|
533
533
|
readonly discard?: false | undefined;
|
|
534
|
-
} | undefined): Effect<RA.
|
|
535
|
-
<A, B, E, R>(self: Iterable<A>, f: (a: A, i: number) => Effect<B, E, R>, options?: {
|
|
536
|
-
readonly concurrency?: Concurrency | undefined;
|
|
537
|
-
readonly batching?: boolean | "inherit" | undefined;
|
|
538
|
-
readonly discard?: false | undefined;
|
|
539
|
-
} | undefined): Effect<Array<B>, E, R>;
|
|
534
|
+
} | undefined): Effect<RA.ReadonlyArray.With<S, B>, E, R>;
|
|
540
535
|
<A, B, E, R>(self: Iterable<A>, f: (a: A, i: number) => Effect<B, E, R>, options: {
|
|
541
536
|
readonly concurrency?: Concurrency | undefined;
|
|
542
537
|
readonly batching?: boolean | "inherit" | undefined;
|
|
@@ -909,7 +904,7 @@ export interface Adapter {
|
|
|
909
904
|
<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, _A, _E, _R>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P, pq: (p: P) => Q, qr: (q: Q) => R, rs: (r: R) => S, st: (s: S) => T, tu: (s: T) => Effect<_A, _E, _R>): Effect<_A, _E, _R>;
|
|
910
905
|
}
|
|
911
906
|
/**
|
|
912
|
-
* Returns
|
|
907
|
+
* Returns an effect that will never produce anything. The moral equivalent of
|
|
913
908
|
* `while(true) {}`, only without the wasted CPU cycles.
|
|
914
909
|
*
|
|
915
910
|
* @since 2.0.0
|
|
@@ -2128,9 +2123,8 @@ export declare const timedWith: {
|
|
|
2128
2123
|
<A, E, R, E1, R1>(self: Effect<A, E, R>, nanoseconds: Effect<bigint, E1, R1>): Effect<[Duration.Duration, A], E | E1, R | R1>;
|
|
2129
2124
|
};
|
|
2130
2125
|
/**
|
|
2131
|
-
* Returns an effect that will timeout this effect,
|
|
2132
|
-
* timeout elapses before the effect has produced a value
|
|
2133
|
-
* `Some` of the produced value otherwise.
|
|
2126
|
+
* Returns an effect that will timeout this effect, failing with a `Cause.TimeoutException`
|
|
2127
|
+
* if the timeout elapses before the effect has produced a value.
|
|
2134
2128
|
*
|
|
2135
2129
|
* If the timeout elapses without producing a value, the running effect will
|
|
2136
2130
|
* be safely interrupted.
|
|
@@ -2150,6 +2144,29 @@ export declare const timeout: {
|
|
|
2150
2144
|
(duration: Duration.DurationInput): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E | Cause.TimeoutException, R>;
|
|
2151
2145
|
<A, E, R>(self: Effect<A, E, R>, duration: Duration.DurationInput): Effect<A, Cause.TimeoutException | E, R>;
|
|
2152
2146
|
};
|
|
2147
|
+
/**
|
|
2148
|
+
* Returns an effect that will timeout this effect, returning `None` if the
|
|
2149
|
+
* timeout elapses before the effect has produced a value; and returning
|
|
2150
|
+
* `Some` of the produced value otherwise.
|
|
2151
|
+
*
|
|
2152
|
+
* If the timeout elapses without producing a value, the running effect will
|
|
2153
|
+
* be safely interrupted.
|
|
2154
|
+
*
|
|
2155
|
+
* WARNING: The effect returned by this method will not itself return until
|
|
2156
|
+
* the underlying effect is actually interrupted. This leads to more
|
|
2157
|
+
* predictable resource utilization. If early return is desired, then instead
|
|
2158
|
+
* of using `effect.timeout(d)`, use `effect.disconnect.timeout(d)`, which
|
|
2159
|
+
* first disconnects the effect's interruption signal before performing the
|
|
2160
|
+
* timeout, resulting in earliest possible return, before an underlying effect
|
|
2161
|
+
* has been successfully interrupted.
|
|
2162
|
+
*
|
|
2163
|
+
* @since 3.1.0
|
|
2164
|
+
* @category delays & timeouts
|
|
2165
|
+
*/
|
|
2166
|
+
export declare const timeoutOption: {
|
|
2167
|
+
(duration: Duration.DurationInput): <A, E, R>(self: Effect<A, E, R>) => Effect<Option.Option<A>, E, R>;
|
|
2168
|
+
<A, E, R>(self: Effect<A, E, R>, duration: Duration.DurationInput): Effect<Option.Option<A>, E, R>;
|
|
2169
|
+
};
|
|
2153
2170
|
/**
|
|
2154
2171
|
* The same as `timeout`, but instead of producing a `None` in the event of
|
|
2155
2172
|
* timeout, it will produce the specified error.
|
|
@@ -3245,6 +3262,27 @@ export declare const annotateLogs: {
|
|
|
3245
3262
|
<A, E, R>(effect: Effect<A, E, R>, key: string, value: unknown): Effect<A, E, R>;
|
|
3246
3263
|
<A, E, R>(effect: Effect<A, E, R>, values: Record<string, unknown>): Effect<A, E, R>;
|
|
3247
3264
|
};
|
|
3265
|
+
/**
|
|
3266
|
+
* Annotates each log with the specified log annotation(s), until the Scope is closed.
|
|
3267
|
+
*
|
|
3268
|
+
* @since 3.1.0
|
|
3269
|
+
* @category logging
|
|
3270
|
+
* @example
|
|
3271
|
+
* import { Effect } from "effect"
|
|
3272
|
+
*
|
|
3273
|
+
* Effect.gen(function*() {
|
|
3274
|
+
* yield* Effect.log("no annotations")
|
|
3275
|
+
* yield* Effect.annotateLogsScoped({ foo: "bar" })
|
|
3276
|
+
* yield* Effect.log("annotated with foo=bar")
|
|
3277
|
+
* }).pipe(
|
|
3278
|
+
* Effect.scoped,
|
|
3279
|
+
* Effect.andThen(Effect.log("no annotations again"))
|
|
3280
|
+
* )
|
|
3281
|
+
*/
|
|
3282
|
+
export declare const annotateLogsScoped: {
|
|
3283
|
+
(key: string, value: unknown): Effect<void, never, Scope.Scope>;
|
|
3284
|
+
(values: Record<string, unknown>): Effect<void, never, Scope.Scope>;
|
|
3285
|
+
};
|
|
3248
3286
|
/**
|
|
3249
3287
|
* Retrieves the log annotations associated with the current scope.
|
|
3250
3288
|
*
|
|
@@ -3806,13 +3844,7 @@ export declare const linkSpans: {
|
|
|
3806
3844
|
* @since 2.0.0
|
|
3807
3845
|
* @category tracing
|
|
3808
3846
|
*/
|
|
3809
|
-
export declare const makeSpan: (name: string, options?:
|
|
3810
|
-
readonly attributes?: Record<string, unknown> | undefined;
|
|
3811
|
-
readonly links?: ReadonlyArray<Tracer.SpanLink> | undefined;
|
|
3812
|
-
readonly parent?: Tracer.AnySpan | undefined;
|
|
3813
|
-
readonly root?: boolean | undefined;
|
|
3814
|
-
readonly context?: Context.Context<never> | undefined;
|
|
3815
|
-
}) => Effect<Tracer.Span>;
|
|
3847
|
+
export declare const makeSpan: (name: string, options?: Tracer.SpanOptions) => Effect<Tracer.Span>;
|
|
3816
3848
|
/**
|
|
3817
3849
|
* Create a new span for tracing, and automatically close it when the Scope
|
|
3818
3850
|
* finalizes.
|
|
@@ -3823,13 +3855,7 @@ export declare const makeSpan: (name: string, options?: {
|
|
|
3823
3855
|
* @since 2.0.0
|
|
3824
3856
|
* @category tracing
|
|
3825
3857
|
*/
|
|
3826
|
-
export declare const makeSpanScoped: (name: string, options?:
|
|
3827
|
-
readonly attributes?: Record<string, unknown> | undefined;
|
|
3828
|
-
readonly links?: ReadonlyArray<Tracer.SpanLink> | undefined;
|
|
3829
|
-
readonly parent?: Tracer.AnySpan | undefined;
|
|
3830
|
-
readonly root?: boolean | undefined;
|
|
3831
|
-
readonly context?: Context.Context<never> | undefined;
|
|
3832
|
-
} | undefined) => Effect<Tracer.Span, never, Scope.Scope>;
|
|
3858
|
+
export declare const makeSpanScoped: (name: string, options?: Tracer.SpanOptions | undefined) => Effect<Tracer.Span, never, Scope.Scope>;
|
|
3833
3859
|
/**
|
|
3834
3860
|
* Create a new span for tracing, and automatically close it when the effect
|
|
3835
3861
|
* completes.
|
|
@@ -3842,13 +3868,7 @@ export declare const makeSpanScoped: (name: string, options?: {
|
|
|
3842
3868
|
*/
|
|
3843
3869
|
export declare const useSpan: {
|
|
3844
3870
|
<A, E, R>(name: string, evaluate: (span: Tracer.Span) => Effect<A, E, R>): Effect<A, E, R>;
|
|
3845
|
-
<A, E, R>(name: string, options:
|
|
3846
|
-
readonly attributes?: Record<string, unknown> | undefined;
|
|
3847
|
-
readonly links?: ReadonlyArray<Tracer.SpanLink> | undefined;
|
|
3848
|
-
readonly parent?: Tracer.AnySpan | undefined;
|
|
3849
|
-
readonly root?: boolean | undefined;
|
|
3850
|
-
readonly context?: Context.Context<never> | undefined;
|
|
3851
|
-
}, evaluate: (span: Tracer.Span) => Effect<A, E, R>): Effect<A, E, R>;
|
|
3871
|
+
<A, E, R>(name: string, options: Tracer.SpanOptions, evaluate: (span: Tracer.Span) => Effect<A, E, R>): Effect<A, E, R>;
|
|
3852
3872
|
};
|
|
3853
3873
|
/**
|
|
3854
3874
|
* Wraps the effect with a new span for tracing.
|
|
@@ -3857,20 +3877,8 @@ export declare const useSpan: {
|
|
|
3857
3877
|
* @category tracing
|
|
3858
3878
|
*/
|
|
3859
3879
|
export declare const withSpan: {
|
|
3860
|
-
(name: string, options?:
|
|
3861
|
-
|
|
3862
|
-
readonly links?: ReadonlyArray<Tracer.SpanLink> | undefined;
|
|
3863
|
-
readonly parent?: Tracer.AnySpan | undefined;
|
|
3864
|
-
readonly root?: boolean | undefined;
|
|
3865
|
-
readonly context?: Context.Context<never> | undefined;
|
|
3866
|
-
} | undefined): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, Tracer.ParentSpan>>;
|
|
3867
|
-
<A, E, R>(self: Effect<A, E, R>, name: string, options?: {
|
|
3868
|
-
readonly attributes?: Record<string, unknown> | undefined;
|
|
3869
|
-
readonly links?: ReadonlyArray<Tracer.SpanLink> | undefined;
|
|
3870
|
-
readonly parent?: Tracer.AnySpan | undefined;
|
|
3871
|
-
readonly root?: boolean | undefined;
|
|
3872
|
-
readonly context?: Context.Context<never> | undefined;
|
|
3873
|
-
} | undefined): Effect<A, E, Exclude<R, Tracer.ParentSpan>>;
|
|
3880
|
+
(name: string, options?: Tracer.SpanOptions | undefined): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, Tracer.ParentSpan>>;
|
|
3881
|
+
<A, E, R>(self: Effect<A, E, R>, name: string, options?: Tracer.SpanOptions | undefined): Effect<A, E, Exclude<R, Tracer.ParentSpan>>;
|
|
3874
3882
|
};
|
|
3875
3883
|
/**
|
|
3876
3884
|
* Wraps the effect with a new span for tracing.
|
|
@@ -3881,20 +3889,8 @@ export declare const withSpan: {
|
|
|
3881
3889
|
* @category tracing
|
|
3882
3890
|
*/
|
|
3883
3891
|
export declare const withSpanScoped: {
|
|
3884
|
-
(name: string, options?:
|
|
3885
|
-
|
|
3886
|
-
readonly links?: ReadonlyArray<Tracer.SpanLink> | undefined;
|
|
3887
|
-
readonly parent?: Tracer.AnySpan | undefined;
|
|
3888
|
-
readonly root?: boolean | undefined;
|
|
3889
|
-
readonly context?: Context.Context<never> | undefined;
|
|
3890
|
-
}): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, Tracer.ParentSpan> | Scope.Scope>;
|
|
3891
|
-
<A, E, R>(self: Effect<A, E, R>, name: string, options?: {
|
|
3892
|
-
readonly attributes?: Record<string, unknown> | undefined;
|
|
3893
|
-
readonly links?: ReadonlyArray<Tracer.SpanLink> | undefined;
|
|
3894
|
-
readonly parent?: Tracer.AnySpan | undefined;
|
|
3895
|
-
readonly root?: boolean | undefined;
|
|
3896
|
-
readonly context?: Context.Context<never> | undefined;
|
|
3897
|
-
}): Effect<A, E, Exclude<R, Tracer.ParentSpan> | Scope.Scope>;
|
|
3892
|
+
(name: string, options?: Tracer.SpanOptions): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, Tracer.ParentSpan> | Scope.Scope>;
|
|
3893
|
+
<A, E, R>(self: Effect<A, E, R>, name: string, options?: Tracer.SpanOptions): Effect<A, E, Exclude<R, Tracer.ParentSpan> | Scope.Scope>;
|
|
3898
3894
|
};
|
|
3899
3895
|
/**
|
|
3900
3896
|
* Adds the provided span to the current span stack.
|