effect 3.0.8 → 3.1.1
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 +43 -6
- package/dist/cjs/Effect.js.map +1 -1
- package/dist/cjs/Equal.js +26 -4
- package/dist/cjs/Equal.js.map +1 -1
- package/dist/cjs/Hash.js +29 -12
- package/dist/cjs/Hash.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/Utils.js +35 -1
- package/dist/cjs/Utils.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 +17 -4
- 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 +53 -52
- package/dist/dts/Effect.d.ts.map +1 -1
- package/dist/dts/Equal.d.ts.map +1 -1
- package/dist/dts/Hash.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/Utils.d.ts +19 -0
- package/dist/dts/Utils.d.ts.map +1 -1
- package/dist/dts/internal/core.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 +39 -2
- package/dist/esm/Effect.js.map +1 -1
- package/dist/esm/Equal.js +26 -4
- package/dist/esm/Equal.js.map +1 -1
- package/dist/esm/Hash.js +30 -13
- package/dist/esm/Hash.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/Utils.js +33 -0
- package/dist/esm/Utils.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 +17 -4
- 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 +55 -52
- package/src/Equal.ts +30 -9
- package/src/Hash.ts +30 -13
- 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/Utils.ts +38 -0
- package/src/internal/channel.ts +2 -14
- package/src/internal/core-effect.ts +19 -43
- package/src/internal/core.ts +21 -4
- 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
|
@@ -2123,9 +2123,8 @@ export declare const timedWith: {
|
|
|
2123
2123
|
<A, E, R, E1, R1>(self: Effect<A, E, R>, nanoseconds: Effect<bigint, E1, R1>): Effect<[Duration.Duration, A], E | E1, R | R1>;
|
|
2124
2124
|
};
|
|
2125
2125
|
/**
|
|
2126
|
-
* Returns an effect that will timeout this effect,
|
|
2127
|
-
* timeout elapses before the effect has produced a value
|
|
2128
|
-
* `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.
|
|
2129
2128
|
*
|
|
2130
2129
|
* If the timeout elapses without producing a value, the running effect will
|
|
2131
2130
|
* be safely interrupted.
|
|
@@ -2145,6 +2144,29 @@ export declare const timeout: {
|
|
|
2145
2144
|
(duration: Duration.DurationInput): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E | Cause.TimeoutException, R>;
|
|
2146
2145
|
<A, E, R>(self: Effect<A, E, R>, duration: Duration.DurationInput): Effect<A, Cause.TimeoutException | E, R>;
|
|
2147
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
|
+
};
|
|
2148
2170
|
/**
|
|
2149
2171
|
* The same as `timeout`, but instead of producing a `None` in the event of
|
|
2150
2172
|
* timeout, it will produce the specified error.
|
|
@@ -3240,6 +3262,27 @@ export declare const annotateLogs: {
|
|
|
3240
3262
|
<A, E, R>(effect: Effect<A, E, R>, key: string, value: unknown): Effect<A, E, R>;
|
|
3241
3263
|
<A, E, R>(effect: Effect<A, E, R>, values: Record<string, unknown>): Effect<A, E, R>;
|
|
3242
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
|
+
};
|
|
3243
3286
|
/**
|
|
3244
3287
|
* Retrieves the log annotations associated with the current scope.
|
|
3245
3288
|
*
|
|
@@ -3801,13 +3844,7 @@ export declare const linkSpans: {
|
|
|
3801
3844
|
* @since 2.0.0
|
|
3802
3845
|
* @category tracing
|
|
3803
3846
|
*/
|
|
3804
|
-
export declare const makeSpan: (name: string, options?:
|
|
3805
|
-
readonly attributes?: Record<string, unknown> | undefined;
|
|
3806
|
-
readonly links?: ReadonlyArray<Tracer.SpanLink> | undefined;
|
|
3807
|
-
readonly parent?: Tracer.AnySpan | undefined;
|
|
3808
|
-
readonly root?: boolean | undefined;
|
|
3809
|
-
readonly context?: Context.Context<never> | undefined;
|
|
3810
|
-
}) => Effect<Tracer.Span>;
|
|
3847
|
+
export declare const makeSpan: (name: string, options?: Tracer.SpanOptions) => Effect<Tracer.Span>;
|
|
3811
3848
|
/**
|
|
3812
3849
|
* Create a new span for tracing, and automatically close it when the Scope
|
|
3813
3850
|
* finalizes.
|
|
@@ -3818,13 +3855,7 @@ export declare const makeSpan: (name: string, options?: {
|
|
|
3818
3855
|
* @since 2.0.0
|
|
3819
3856
|
* @category tracing
|
|
3820
3857
|
*/
|
|
3821
|
-
export declare const makeSpanScoped: (name: string, options?:
|
|
3822
|
-
readonly attributes?: Record<string, unknown> | undefined;
|
|
3823
|
-
readonly links?: ReadonlyArray<Tracer.SpanLink> | undefined;
|
|
3824
|
-
readonly parent?: Tracer.AnySpan | undefined;
|
|
3825
|
-
readonly root?: boolean | undefined;
|
|
3826
|
-
readonly context?: Context.Context<never> | undefined;
|
|
3827
|
-
} | undefined) => Effect<Tracer.Span, never, Scope.Scope>;
|
|
3858
|
+
export declare const makeSpanScoped: (name: string, options?: Tracer.SpanOptions | undefined) => Effect<Tracer.Span, never, Scope.Scope>;
|
|
3828
3859
|
/**
|
|
3829
3860
|
* Create a new span for tracing, and automatically close it when the effect
|
|
3830
3861
|
* completes.
|
|
@@ -3837,13 +3868,7 @@ export declare const makeSpanScoped: (name: string, options?: {
|
|
|
3837
3868
|
*/
|
|
3838
3869
|
export declare const useSpan: {
|
|
3839
3870
|
<A, E, R>(name: string, evaluate: (span: Tracer.Span) => Effect<A, E, R>): Effect<A, E, R>;
|
|
3840
|
-
<A, E, R>(name: string, options:
|
|
3841
|
-
readonly attributes?: Record<string, unknown> | undefined;
|
|
3842
|
-
readonly links?: ReadonlyArray<Tracer.SpanLink> | undefined;
|
|
3843
|
-
readonly parent?: Tracer.AnySpan | undefined;
|
|
3844
|
-
readonly root?: boolean | undefined;
|
|
3845
|
-
readonly context?: Context.Context<never> | undefined;
|
|
3846
|
-
}, 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>;
|
|
3847
3872
|
};
|
|
3848
3873
|
/**
|
|
3849
3874
|
* Wraps the effect with a new span for tracing.
|
|
@@ -3852,20 +3877,8 @@ export declare const useSpan: {
|
|
|
3852
3877
|
* @category tracing
|
|
3853
3878
|
*/
|
|
3854
3879
|
export declare const withSpan: {
|
|
3855
|
-
(name: string, options?:
|
|
3856
|
-
|
|
3857
|
-
readonly links?: ReadonlyArray<Tracer.SpanLink> | undefined;
|
|
3858
|
-
readonly parent?: Tracer.AnySpan | undefined;
|
|
3859
|
-
readonly root?: boolean | undefined;
|
|
3860
|
-
readonly context?: Context.Context<never> | undefined;
|
|
3861
|
-
} | undefined): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, Tracer.ParentSpan>>;
|
|
3862
|
-
<A, E, R>(self: Effect<A, E, R>, name: string, options?: {
|
|
3863
|
-
readonly attributes?: Record<string, unknown> | undefined;
|
|
3864
|
-
readonly links?: ReadonlyArray<Tracer.SpanLink> | undefined;
|
|
3865
|
-
readonly parent?: Tracer.AnySpan | undefined;
|
|
3866
|
-
readonly root?: boolean | undefined;
|
|
3867
|
-
readonly context?: Context.Context<never> | undefined;
|
|
3868
|
-
} | 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>>;
|
|
3869
3882
|
};
|
|
3870
3883
|
/**
|
|
3871
3884
|
* Wraps the effect with a new span for tracing.
|
|
@@ -3876,20 +3889,8 @@ export declare const withSpan: {
|
|
|
3876
3889
|
* @category tracing
|
|
3877
3890
|
*/
|
|
3878
3891
|
export declare const withSpanScoped: {
|
|
3879
|
-
(name: string, options?:
|
|
3880
|
-
|
|
3881
|
-
readonly links?: ReadonlyArray<Tracer.SpanLink> | undefined;
|
|
3882
|
-
readonly parent?: Tracer.AnySpan | undefined;
|
|
3883
|
-
readonly root?: boolean | undefined;
|
|
3884
|
-
readonly context?: Context.Context<never> | undefined;
|
|
3885
|
-
}): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, Tracer.ParentSpan> | Scope.Scope>;
|
|
3886
|
-
<A, E, R>(self: Effect<A, E, R>, name: string, options?: {
|
|
3887
|
-
readonly attributes?: Record<string, unknown> | undefined;
|
|
3888
|
-
readonly links?: ReadonlyArray<Tracer.SpanLink> | undefined;
|
|
3889
|
-
readonly parent?: Tracer.AnySpan | undefined;
|
|
3890
|
-
readonly root?: boolean | undefined;
|
|
3891
|
-
readonly context?: Context.Context<never> | undefined;
|
|
3892
|
-
}): 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>;
|
|
3893
3894
|
};
|
|
3894
3895
|
/**
|
|
3895
3896
|
* Adds the provided span to the current span stack.
|