effect 2.3.8 → 2.4.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/BigInt.js +14 -1
- package/dist/cjs/BigInt.js.map +1 -1
- package/dist/cjs/Effect.js +48 -61
- package/dist/cjs/Effect.js.map +1 -1
- package/dist/cjs/Either.js +35 -6
- package/dist/cjs/Either.js.map +1 -1
- package/dist/cjs/Equal.js +1 -1
- package/dist/cjs/Equal.js.map +1 -1
- package/dist/cjs/Exit.js +1 -1
- package/dist/cjs/Number.js +25 -1
- package/dist/cjs/Number.js.map +1 -1
- package/dist/cjs/Predicate.js +40 -3
- package/dist/cjs/Predicate.js.map +1 -1
- package/dist/cjs/ReadonlyArray.js +2 -2
- package/dist/cjs/ReadonlyArray.js.map +1 -1
- package/dist/cjs/ReadonlyRecord.js +71 -76
- package/dist/cjs/ReadonlyRecord.js.map +1 -1
- package/dist/cjs/STM.js.map +1 -1
- package/dist/cjs/Schedule.js.map +1 -1
- package/dist/cjs/Sink.js.map +1 -1
- package/dist/cjs/Stream.js +3 -23
- package/dist/cjs/Stream.js.map +1 -1
- package/dist/cjs/Struct.js +3 -1
- package/dist/cjs/Struct.js.map +1 -1
- package/dist/cjs/TestAnnotation.js.map +1 -1
- package/dist/cjs/internal/channel/channelExecutor.js +5 -5
- package/dist/cjs/internal/channel/channelExecutor.js.map +1 -1
- package/dist/cjs/internal/channel/channelState.js +5 -5
- package/dist/cjs/internal/channel/channelState.js.map +1 -1
- package/dist/cjs/internal/channel.js.map +1 -1
- package/dist/cjs/internal/clock.js +3 -4
- package/dist/cjs/internal/clock.js.map +1 -1
- package/dist/cjs/internal/core-effect.js +6 -23
- package/dist/cjs/internal/core-effect.js.map +1 -1
- package/dist/cjs/internal/core.js +11 -27
- package/dist/cjs/internal/core.js.map +1 -1
- package/dist/cjs/internal/effect/circular.js +4 -5
- package/dist/cjs/internal/effect/circular.js.map +1 -1
- package/dist/cjs/internal/either.js +3 -3
- package/dist/cjs/internal/either.js.map +1 -1
- package/dist/cjs/internal/groupBy.js.map +1 -1
- package/dist/cjs/internal/layer.js +0 -2
- package/dist/cjs/internal/layer.js.map +1 -1
- package/dist/cjs/internal/runtime.js +12 -1
- package/dist/cjs/internal/runtime.js.map +1 -1
- package/dist/cjs/internal/schedule.js +4 -4
- package/dist/cjs/internal/schedule.js.map +1 -1
- package/dist/cjs/internal/sink.js +0 -2
- package/dist/cjs/internal/sink.js.map +1 -1
- package/dist/cjs/internal/stm/stm.js +1 -0
- package/dist/cjs/internal/stm/stm.js.map +1 -1
- package/dist/cjs/internal/stream.js +51 -64
- package/dist/cjs/internal/stream.js.map +1 -1
- package/dist/cjs/internal/version.js +1 -1
- package/dist/dts/BigInt.d.ts +7 -0
- package/dist/dts/BigInt.d.ts.map +1 -1
- package/dist/dts/Brand.d.ts +1 -1
- package/dist/dts/Brand.d.ts.map +1 -1
- package/dist/dts/Cause.d.ts +1 -1
- package/dist/dts/Cause.d.ts.map +1 -1
- package/dist/dts/Channel.d.ts +11 -11
- package/dist/dts/Channel.d.ts.map +1 -1
- package/dist/dts/Chunk.d.ts +3 -3
- package/dist/dts/Config.d.ts +4 -4
- package/dist/dts/Config.d.ts.map +1 -1
- package/dist/dts/Cron.d.ts +1 -1
- package/dist/dts/Cron.d.ts.map +1 -1
- package/dist/dts/Differ.d.ts +2 -2
- package/dist/dts/Differ.d.ts.map +1 -1
- package/dist/dts/Effect.d.ts +84 -108
- package/dist/dts/Effect.d.ts.map +1 -1
- package/dist/dts/Either.d.ts +126 -83
- package/dist/dts/Either.d.ts.map +1 -1
- package/dist/dts/Encoding.d.ts +6 -6
- package/dist/dts/Encoding.d.ts.map +1 -1
- package/dist/dts/Equal.d.ts.map +1 -1
- package/dist/dts/Exit.d.ts +2 -2
- package/dist/dts/Fiber.d.ts +2 -2
- package/dist/dts/Fiber.d.ts.map +1 -1
- package/dist/dts/GroupBy.d.ts +12 -12
- package/dist/dts/GroupBy.d.ts.map +1 -1
- package/dist/dts/Layer.d.ts +26 -26
- package/dist/dts/Layer.d.ts.map +1 -1
- package/dist/dts/List.d.ts +2 -2
- package/dist/dts/Logger.d.ts +4 -4
- package/dist/dts/Match.d.ts +2 -2
- package/dist/dts/Match.d.ts.map +1 -1
- package/dist/dts/MergeDecision.d.ts +1 -1
- package/dist/dts/MergeState.d.ts +5 -5
- package/dist/dts/MergeState.d.ts.map +1 -1
- package/dist/dts/Metric.d.ts +13 -13
- package/dist/dts/Metric.d.ts.map +1 -1
- package/dist/dts/MetricPolling.d.ts +4 -4
- package/dist/dts/MetricPolling.d.ts.map +1 -1
- package/dist/dts/Number.d.ts +8 -0
- package/dist/dts/Number.d.ts.map +1 -1
- package/dist/dts/Option.d.ts +11 -11
- package/dist/dts/Predicate.d.ts +37 -2
- package/dist/dts/Predicate.d.ts.map +1 -1
- package/dist/dts/ReadonlyArray.d.ts +9 -8
- package/dist/dts/ReadonlyArray.d.ts.map +1 -1
- package/dist/dts/ReadonlyRecord.d.ts +111 -94
- package/dist/dts/ReadonlyRecord.d.ts.map +1 -1
- package/dist/dts/Reloadable.d.ts +4 -4
- package/dist/dts/Reloadable.d.ts.map +1 -1
- package/dist/dts/RequestResolver.d.ts +13 -13
- package/dist/dts/RequestResolver.d.ts.map +1 -1
- package/dist/dts/Resource.d.ts +1 -1
- package/dist/dts/Resource.d.ts.map +1 -1
- package/dist/dts/STM.d.ts +144 -139
- package/dist/dts/STM.d.ts.map +1 -1
- package/dist/dts/Schedule.d.ts +171 -179
- package/dist/dts/Schedule.d.ts.map +1 -1
- package/dist/dts/SingleProducerAsyncInput.d.ts +1 -1
- package/dist/dts/SingleProducerAsyncInput.d.ts.map +1 -1
- package/dist/dts/Sink.d.ts +13 -13
- package/dist/dts/Sink.d.ts.map +1 -1
- package/dist/dts/Stream.d.ts +355 -366
- package/dist/dts/Stream.d.ts.map +1 -1
- package/dist/dts/Struct.d.ts +3 -3
- package/dist/dts/Struct.d.ts.map +1 -1
- package/dist/dts/SubscriptionRef.d.ts +2 -2
- package/dist/dts/TArray.d.ts +2 -2
- package/dist/dts/TDeferred.d.ts +3 -3
- package/dist/dts/TMap.d.ts +10 -10
- package/dist/dts/TSet.d.ts +4 -4
- package/dist/dts/Take.d.ts +2 -2
- package/dist/dts/TestAnnotation.d.ts +2 -2
- package/dist/dts/TestAnnotation.d.ts.map +1 -1
- package/dist/dts/Types.d.ts +7 -0
- package/dist/dts/Types.d.ts.map +1 -1
- package/dist/dts/internal/stm/stm.d.ts +2 -15
- package/dist/dts/internal/stm/stm.d.ts.map +1 -1
- package/dist/esm/BigInt.js +12 -0
- package/dist/esm/BigInt.js.map +1 -1
- package/dist/esm/Effect.js +45 -58
- package/dist/esm/Effect.js.map +1 -1
- package/dist/esm/Either.js +42 -5
- package/dist/esm/Either.js.map +1 -1
- package/dist/esm/Equal.js +1 -1
- package/dist/esm/Equal.js.map +1 -1
- package/dist/esm/Exit.js +1 -1
- package/dist/esm/Number.js +23 -0
- package/dist/esm/Number.js.map +1 -1
- package/dist/esm/Predicate.js +37 -2
- package/dist/esm/Predicate.js.map +1 -1
- package/dist/esm/ReadonlyArray.js +2 -2
- package/dist/esm/ReadonlyArray.js.map +1 -1
- package/dist/esm/ReadonlyRecord.js +70 -75
- package/dist/esm/ReadonlyRecord.js.map +1 -1
- package/dist/esm/STM.js.map +1 -1
- package/dist/esm/Schedule.js.map +1 -1
- package/dist/esm/Sink.js.map +1 -1
- package/dist/esm/Stream.js +5 -22
- package/dist/esm/Stream.js.map +1 -1
- package/dist/esm/Struct.js +3 -1
- package/dist/esm/Struct.js.map +1 -1
- package/dist/esm/TestAnnotation.js.map +1 -1
- package/dist/esm/internal/channel/channelExecutor.js +5 -5
- package/dist/esm/internal/channel/channelExecutor.js.map +1 -1
- package/dist/esm/internal/channel/channelState.js +3 -3
- package/dist/esm/internal/channel/channelState.js.map +1 -1
- package/dist/esm/internal/channel.js.map +1 -1
- package/dist/esm/internal/clock.js +3 -4
- package/dist/esm/internal/clock.js.map +1 -1
- package/dist/esm/internal/core-effect.js +4 -20
- package/dist/esm/internal/core-effect.js.map +1 -1
- package/dist/esm/internal/core.js +8 -22
- package/dist/esm/internal/core.js.map +1 -1
- package/dist/esm/internal/effect/circular.js +4 -5
- package/dist/esm/internal/effect/circular.js.map +1 -1
- package/dist/esm/internal/either.js +3 -3
- package/dist/esm/internal/either.js.map +1 -1
- package/dist/esm/internal/groupBy.js.map +1 -1
- package/dist/esm/internal/layer.js +0 -2
- package/dist/esm/internal/layer.js.map +1 -1
- package/dist/esm/internal/runtime.js +12 -1
- package/dist/esm/internal/runtime.js.map +1 -1
- package/dist/esm/internal/schedule.js +4 -4
- package/dist/esm/internal/schedule.js.map +1 -1
- package/dist/esm/internal/sink.js +0 -2
- package/dist/esm/internal/sink.js.map +1 -1
- package/dist/esm/internal/stm/stm.js +1 -0
- package/dist/esm/internal/stm/stm.js.map +1 -1
- package/dist/esm/internal/stream.js +49 -59
- package/dist/esm/internal/stream.js.map +1 -1
- package/dist/esm/internal/version.js +1 -1
- package/package.json +1 -1
- package/src/BigInt.ts +13 -0
- package/src/Brand.ts +4 -4
- package/src/Cause.ts +1 -1
- package/src/Channel.ts +17 -17
- package/src/Chunk.ts +4 -4
- package/src/Config.ts +4 -4
- package/src/Cron.ts +2 -2
- package/src/Differ.ts +2 -2
- package/src/Effect.ts +100 -145
- package/src/Either.ts +215 -133
- package/src/Encoding.ts +3 -3
- package/src/Equal.ts +1 -1
- package/src/Exit.ts +2 -2
- package/src/Fiber.ts +2 -2
- package/src/GroupBy.ts +16 -16
- package/src/Layer.ts +32 -32
- package/src/List.ts +3 -3
- package/src/Logger.ts +4 -4
- package/src/Match.ts +3 -3
- package/src/MergeDecision.ts +1 -1
- package/src/MergeState.ts +8 -8
- package/src/Metric.ts +13 -13
- package/src/MetricPolling.ts +9 -9
- package/src/Number.ts +26 -0
- package/src/Option.ts +17 -17
- package/src/Predicate.ts +39 -2
- package/src/ReadonlyArray.ts +23 -15
- package/src/ReadonlyRecord.ts +421 -265
- package/src/Reloadable.ts +4 -4
- package/src/RequestResolver.ts +19 -19
- package/src/Resource.ts +3 -3
- package/src/STM.ts +166 -213
- package/src/Schedule.ts +331 -361
- package/src/SingleProducerAsyncInput.ts +1 -1
- package/src/Sink.ts +19 -19
- package/src/Stream.ts +449 -456
- package/src/Struct.ts +8 -5
- package/src/SubscriptionRef.ts +2 -2
- package/src/TArray.ts +2 -2
- package/src/TDeferred.ts +4 -4
- package/src/TMap.ts +10 -10
- package/src/TSet.ts +4 -4
- package/src/Take.ts +4 -4
- package/src/TestAnnotation.ts +5 -8
- package/src/Types.ts +11 -0
- package/src/internal/blockedRequests.ts +2 -2
- package/src/internal/cause.ts +2 -2
- package/src/internal/channel/channelExecutor.ts +26 -26
- package/src/internal/channel/channelState.ts +13 -13
- package/src/internal/channel/mergeDecision.ts +1 -1
- package/src/internal/channel/mergeState.ts +6 -6
- package/src/internal/channel/singleProducerAsyncInput.ts +5 -5
- package/src/internal/channel.ts +43 -43
- package/src/internal/clock.ts +3 -4
- package/src/internal/config.ts +7 -7
- package/src/internal/configError.ts +1 -1
- package/src/internal/configProvider/pathPatch.ts +2 -2
- package/src/internal/configProvider.ts +1 -1
- package/src/internal/core-effect.ts +28 -43
- package/src/internal/core.ts +15 -40
- package/src/internal/dataSource.ts +26 -26
- package/src/internal/differ/orPatch.ts +7 -7
- package/src/internal/differ.ts +2 -2
- package/src/internal/effect/circular.ts +9 -10
- package/src/internal/either.ts +25 -22
- package/src/internal/encoding/base64.ts +1 -1
- package/src/internal/encoding/base64Url.ts +1 -1
- package/src/internal/encoding/hex.ts +1 -1
- package/src/internal/fiber.ts +2 -2
- package/src/internal/fiberRuntime.ts +9 -9
- package/src/internal/groupBy.ts +40 -40
- package/src/internal/layer/circular.ts +4 -4
- package/src/internal/layer.ts +52 -54
- package/src/internal/matcher.ts +5 -5
- package/src/internal/metric/polling.ts +8 -8
- package/src/internal/metric.ts +6 -6
- package/src/internal/reloadable.ts +4 -4
- package/src/internal/resource.ts +2 -2
- package/src/internal/runtime.ts +32 -19
- package/src/internal/schedule.ts +430 -500
- package/src/internal/sink.ts +27 -29
- package/src/internal/stm/core.ts +23 -23
- package/src/internal/stm/stm.ts +158 -157
- package/src/internal/stm/tArray.ts +3 -3
- package/src/internal/stm/tDeferred.ts +5 -5
- package/src/internal/stm/tMap.ts +13 -13
- package/src/internal/stm/tSet.ts +4 -4
- package/src/internal/stream.ts +688 -723
- package/src/internal/subscriptionRef.ts +3 -3
- package/src/internal/take.ts +6 -6
- package/src/internal/version.ts +1 -1
package/src/internal/groupBy.ts
CHANGED
|
@@ -13,7 +13,7 @@ import * as Queue from "../Queue.js"
|
|
|
13
13
|
import * as Ref from "../Ref.js"
|
|
14
14
|
import type * as Stream from "../Stream.js"
|
|
15
15
|
import type * as Take from "../Take.js"
|
|
16
|
-
import type { NoInfer } from "../Types.js"
|
|
16
|
+
import type { MergeRecord, NoInfer } from "../Types.js"
|
|
17
17
|
import * as channel from "./channel.js"
|
|
18
18
|
import * as channelExecutor from "./channel/channelExecutor.js"
|
|
19
19
|
import * as core from "./core-stream.js"
|
|
@@ -45,14 +45,14 @@ export const isGroupBy = (u: unknown): u is GroupBy.GroupBy<unknown, unknown, un
|
|
|
45
45
|
|
|
46
46
|
/** @internal */
|
|
47
47
|
export const evaluate = dual<
|
|
48
|
-
<K,
|
|
48
|
+
<K, V, E, A, E2, R2>(
|
|
49
49
|
f: (key: K, stream: Stream.Stream<V, E>) => Stream.Stream<A, E2, R2>,
|
|
50
50
|
options?: {
|
|
51
51
|
readonly bufferSize?: number | undefined
|
|
52
52
|
}
|
|
53
|
-
) => <R>(self: GroupBy.GroupBy<
|
|
54
|
-
<
|
|
55
|
-
self: GroupBy.GroupBy<
|
|
53
|
+
) => <R>(self: GroupBy.GroupBy<K, V, E, R>) => Stream.Stream<A, E | E2, R2 | R>,
|
|
54
|
+
<K, V, E, R, A, E2, R2>(
|
|
55
|
+
self: GroupBy.GroupBy<K, V, E, R>,
|
|
56
56
|
f: (key: K, stream: Stream.Stream<V, E>) => Stream.Stream<A, E2, R2>,
|
|
57
57
|
options?: {
|
|
58
58
|
readonly bufferSize?: number | undefined
|
|
@@ -60,8 +60,8 @@ export const evaluate = dual<
|
|
|
60
60
|
) => Stream.Stream<A, E | E2, R2 | R>
|
|
61
61
|
>(
|
|
62
62
|
(args) => isGroupBy(args[0]),
|
|
63
|
-
<
|
|
64
|
-
self: GroupBy.GroupBy<
|
|
63
|
+
<K, V, E, R, A, E2, R2>(
|
|
64
|
+
self: GroupBy.GroupBy<K, V, E, R>,
|
|
65
65
|
f: (key: K, stream: Stream.Stream<V, E>) => Stream.Stream<A, E2, R2>,
|
|
66
66
|
options?: {
|
|
67
67
|
readonly bufferSize?: number | undefined
|
|
@@ -76,9 +76,9 @@ export const evaluate = dual<
|
|
|
76
76
|
|
|
77
77
|
/** @internal */
|
|
78
78
|
export const filter = dual<
|
|
79
|
-
<K>(predicate: Predicate<NoInfer<K>>) => <
|
|
80
|
-
<
|
|
81
|
-
>(2, <
|
|
79
|
+
<K>(predicate: Predicate<NoInfer<K>>) => <V, E, R>(self: GroupBy.GroupBy<K, V, E, R>) => GroupBy.GroupBy<K, V, E, R>,
|
|
80
|
+
<K, V, E, R>(self: GroupBy.GroupBy<K, V, E, R>, predicate: Predicate<K>) => GroupBy.GroupBy<K, V, E, R>
|
|
81
|
+
>(2, <K, V, E, R>(self: GroupBy.GroupBy<K, V, E, R>, predicate: Predicate<K>): GroupBy.GroupBy<K, V, E, R> =>
|
|
82
82
|
make(
|
|
83
83
|
pipe(
|
|
84
84
|
self.grouped,
|
|
@@ -93,9 +93,9 @@ export const filter = dual<
|
|
|
93
93
|
|
|
94
94
|
/** @internal */
|
|
95
95
|
export const first = dual<
|
|
96
|
-
(n: number) => <
|
|
97
|
-
<
|
|
98
|
-
>(2, <
|
|
96
|
+
(n: number) => <K, V, E, R>(self: GroupBy.GroupBy<K, V, E, R>) => GroupBy.GroupBy<K, V, E, R>,
|
|
97
|
+
<K, V, E, R>(self: GroupBy.GroupBy<K, V, E, R>, n: number) => GroupBy.GroupBy<K, V, E, R>
|
|
98
|
+
>(2, <K, V, E, R>(self: GroupBy.GroupBy<K, V, E, R>, n: number): GroupBy.GroupBy<K, V, E, R> =>
|
|
99
99
|
make(
|
|
100
100
|
pipe(
|
|
101
101
|
stream.zipWithIndex(self.grouped),
|
|
@@ -112,9 +112,9 @@ export const first = dual<
|
|
|
112
112
|
))
|
|
113
113
|
|
|
114
114
|
/** @internal */
|
|
115
|
-
export const make = <
|
|
115
|
+
export const make = <K, V, E, R>(
|
|
116
116
|
grouped: Stream.Stream<readonly [K, Queue.Dequeue<Take.Take<V, E>>], E, R>
|
|
117
|
-
): GroupBy.GroupBy<
|
|
117
|
+
): GroupBy.GroupBy<K, V, E, R> => ({
|
|
118
118
|
[GroupByTypeId]: groupByVariance,
|
|
119
119
|
pipe() {
|
|
120
120
|
return pipeArguments(this, arguments)
|
|
@@ -126,28 +126,28 @@ export const make = <R, E, K, V>(
|
|
|
126
126
|
|
|
127
127
|
/** @internal */
|
|
128
128
|
export const groupBy = dual<
|
|
129
|
-
<A,
|
|
129
|
+
<A, K, V, E2, R2>(
|
|
130
130
|
f: (a: A) => Effect.Effect<readonly [K, V], E2, R2>,
|
|
131
131
|
options?: {
|
|
132
132
|
readonly bufferSize?: number | undefined
|
|
133
133
|
}
|
|
134
|
-
) => <
|
|
135
|
-
<
|
|
134
|
+
) => <E, R>(self: Stream.Stream<A, E, R>) => GroupBy.GroupBy<K, V, E2 | E, R2 | R>,
|
|
135
|
+
<A, E, R, K, V, E2, R2>(
|
|
136
136
|
self: Stream.Stream<A, E, R>,
|
|
137
137
|
f: (a: A) => Effect.Effect<readonly [K, V], E2, R2>,
|
|
138
138
|
options?: {
|
|
139
139
|
readonly bufferSize?: number | undefined
|
|
140
140
|
}
|
|
141
|
-
) => GroupBy.GroupBy<
|
|
141
|
+
) => GroupBy.GroupBy<K, V, E2 | E, R2 | R>
|
|
142
142
|
>(
|
|
143
143
|
(args) => stream.isStream(args[0]),
|
|
144
|
-
<
|
|
144
|
+
<A, E, R, K, V, E2, R2>(
|
|
145
145
|
self: Stream.Stream<A, E, R>,
|
|
146
146
|
f: (a: A) => Effect.Effect<readonly [K, V], E2, R2>,
|
|
147
147
|
options?: {
|
|
148
148
|
readonly bufferSize?: number | undefined
|
|
149
149
|
}
|
|
150
|
-
): GroupBy.GroupBy<
|
|
150
|
+
): GroupBy.GroupBy<K, V, E | E2, R | R2> =>
|
|
151
151
|
make(
|
|
152
152
|
stream.unwrapScoped(
|
|
153
153
|
Effect.gen(function*($) {
|
|
@@ -209,23 +209,23 @@ export const groupBy = dual<
|
|
|
209
209
|
/** @internal */
|
|
210
210
|
export const mapEffectOptions = dual<
|
|
211
211
|
{
|
|
212
|
-
<A,
|
|
212
|
+
<A, A2, E2, R2>(
|
|
213
213
|
f: (a: A) => Effect.Effect<A2, E2, R2>,
|
|
214
214
|
options?: {
|
|
215
215
|
readonly concurrency?: number | "unbounded" | undefined
|
|
216
216
|
readonly unordered?: boolean | undefined
|
|
217
217
|
}
|
|
218
|
-
): <
|
|
219
|
-
<A,
|
|
218
|
+
): <E, R>(self: Stream.Stream<A, E, R>) => Stream.Stream<A2, E2 | E, R2 | R>
|
|
219
|
+
<A, A2, E2, R2, K>(
|
|
220
220
|
f: (a: A) => Effect.Effect<A2, E2, R2>,
|
|
221
221
|
options: {
|
|
222
222
|
readonly key: (a: A) => K
|
|
223
223
|
readonly bufferSize?: number | undefined
|
|
224
224
|
}
|
|
225
|
-
): <
|
|
225
|
+
): <E, R>(self: Stream.Stream<A, E, R>) => Stream.Stream<A2, E2 | E, R2 | R>
|
|
226
226
|
},
|
|
227
227
|
{
|
|
228
|
-
<
|
|
228
|
+
<A, E, R, A2, E2, R2>(
|
|
229
229
|
self: Stream.Stream<A, E, R>,
|
|
230
230
|
f: (a: A) => Effect.Effect<A2, E2, R2>,
|
|
231
231
|
options?: {
|
|
@@ -233,7 +233,7 @@ export const mapEffectOptions = dual<
|
|
|
233
233
|
readonly unordered?: boolean | undefined
|
|
234
234
|
}
|
|
235
235
|
): Stream.Stream<A2, E2 | E, R2 | R>
|
|
236
|
-
<
|
|
236
|
+
<A, E, R, A2, E2, R2, K>(
|
|
237
237
|
self: Stream.Stream<A, E, R>,
|
|
238
238
|
f: (a: A) => Effect.Effect<A2, E2, R2>,
|
|
239
239
|
options: {
|
|
@@ -244,7 +244,7 @@ export const mapEffectOptions = dual<
|
|
|
244
244
|
}
|
|
245
245
|
>(
|
|
246
246
|
(args) => typeof args[0] !== "function",
|
|
247
|
-
(<
|
|
247
|
+
(<A, E, R, A2, E2, R2, K>(
|
|
248
248
|
self: Stream.Stream<A, E, R>,
|
|
249
249
|
f: (a: A) => Effect.Effect<A2, E2, R2>,
|
|
250
250
|
options?: {
|
|
@@ -274,19 +274,19 @@ export const mapEffectOptions = dual<
|
|
|
274
274
|
|
|
275
275
|
/** @internal */
|
|
276
276
|
export const bindEffect = dual<
|
|
277
|
-
<N extends string, K,
|
|
277
|
+
<N extends string, K, A, E2, R2>(
|
|
278
278
|
tag: Exclude<N, keyof K>,
|
|
279
279
|
f: (_: K) => Effect.Effect<A, E2, R2>,
|
|
280
280
|
options?: {
|
|
281
281
|
readonly concurrency?: number | "unbounded" | undefined
|
|
282
282
|
readonly bufferSize?: number | undefined
|
|
283
283
|
}
|
|
284
|
-
) => <
|
|
285
|
-
|
|
284
|
+
) => <E, R>(self: Stream.Stream<K, E, R>) => Stream.Stream<
|
|
285
|
+
MergeRecord<K, { [k in N]: A }>,
|
|
286
286
|
E | E2,
|
|
287
287
|
R | R2
|
|
288
288
|
>,
|
|
289
|
-
<
|
|
289
|
+
<K, E, R, N extends string, A, E2, R2>(
|
|
290
290
|
self: Stream.Stream<K, E, R>,
|
|
291
291
|
tag: Exclude<N, keyof K>,
|
|
292
292
|
f: (_: K) => Effect.Effect<A, E2, R2>,
|
|
@@ -295,11 +295,11 @@ export const bindEffect = dual<
|
|
|
295
295
|
readonly unordered?: boolean | undefined
|
|
296
296
|
}
|
|
297
297
|
) => Stream.Stream<
|
|
298
|
-
|
|
298
|
+
MergeRecord<K, { [k in N]: A }>,
|
|
299
299
|
E | E2,
|
|
300
300
|
R | R2
|
|
301
301
|
>
|
|
302
|
-
>((args) => typeof args[0] !== "string", <
|
|
302
|
+
>((args) => typeof args[0] !== "string", <K, E, R, N extends string, A, E2, R2>(
|
|
303
303
|
self: Stream.Stream<K, E, R>,
|
|
304
304
|
tag: Exclude<N, keyof K>,
|
|
305
305
|
f: (_: K) => Effect.Effect<A, E2, R2>,
|
|
@@ -311,7 +311,7 @@ export const bindEffect = dual<
|
|
|
311
311
|
mapEffectOptions(self, (k) =>
|
|
312
312
|
Effect.map(
|
|
313
313
|
f(k),
|
|
314
|
-
(a):
|
|
314
|
+
(a): MergeRecord<K, { [k in N]: A }> => ({ ...k, [tag]: a } as any)
|
|
315
315
|
), options))
|
|
316
316
|
|
|
317
317
|
const mapDequeue = <A, B>(dequeue: Queue.Dequeue<A>, f: (a: A) => B): Queue.Dequeue<B> => new MapDequeue(dequeue, f)
|
|
@@ -399,23 +399,23 @@ export const groupByKey = dual<
|
|
|
399
399
|
options?: {
|
|
400
400
|
readonly bufferSize?: number | undefined
|
|
401
401
|
}
|
|
402
|
-
) => <
|
|
403
|
-
<
|
|
402
|
+
) => <E, R>(self: Stream.Stream<A, E, R>) => GroupBy.GroupBy<K, A, E, R>,
|
|
403
|
+
<A, E, R, K>(
|
|
404
404
|
self: Stream.Stream<A, E, R>,
|
|
405
405
|
f: (a: A) => K,
|
|
406
406
|
options?: {
|
|
407
407
|
readonly bufferSize?: number | undefined
|
|
408
408
|
}
|
|
409
|
-
) => GroupBy.GroupBy<
|
|
409
|
+
) => GroupBy.GroupBy<K, A, E, R>
|
|
410
410
|
>(
|
|
411
411
|
(args) => typeof args[0] !== "function",
|
|
412
|
-
<
|
|
412
|
+
<A, E, R, K>(
|
|
413
413
|
self: Stream.Stream<A, E, R>,
|
|
414
414
|
f: (a: A) => K,
|
|
415
415
|
options?: {
|
|
416
416
|
readonly bufferSize?: number | undefined
|
|
417
417
|
}
|
|
418
|
-
): GroupBy.GroupBy<
|
|
418
|
+
): GroupBy.GroupBy<K, A, E, R> => {
|
|
419
419
|
const loop = (
|
|
420
420
|
map: Map<K, Queue.Queue<Take.Take<A, E>>>,
|
|
421
421
|
outerQueue: Queue.Queue<Take.Take<readonly [K, Queue.Queue<Take.Take<A, E>>], E>>
|
|
@@ -81,10 +81,10 @@ export const replaceLogger = dual<
|
|
|
81
81
|
|
|
82
82
|
/** @internal */
|
|
83
83
|
export const replaceLoggerEffect = dual<
|
|
84
|
-
<
|
|
84
|
+
<B, E, R>(
|
|
85
85
|
that: Effect.Effect<Logger.Logger<unknown, B>, E, R>
|
|
86
86
|
) => <A>(self: Logger.Logger<unknown, A>) => Layer.Layer<never, E, R>,
|
|
87
|
-
<A,
|
|
87
|
+
<A, B, E, R>(
|
|
88
88
|
self: Logger.Logger<unknown, A>,
|
|
89
89
|
that: Effect.Effect<Logger.Logger<unknown, B>, E, R>
|
|
90
90
|
) => Layer.Layer<never, E, R>
|
|
@@ -92,10 +92,10 @@ export const replaceLoggerEffect = dual<
|
|
|
92
92
|
|
|
93
93
|
/** @internal */
|
|
94
94
|
export const replaceLoggerScoped = dual<
|
|
95
|
-
<
|
|
95
|
+
<B, E, R>(
|
|
96
96
|
that: Effect.Effect<Logger.Logger<unknown, B>, E, R>
|
|
97
97
|
) => <A>(self: Logger.Logger<unknown, A>) => Layer.Layer<never, E, Exclude<R, Scope>>,
|
|
98
|
-
<A,
|
|
98
|
+
<A, B, E, R>(
|
|
99
99
|
self: Logger.Logger<unknown, A>,
|
|
100
100
|
that: Effect.Effect<Logger.Logger<unknown, B>, E, R>
|
|
101
101
|
) => Layer.Layer<never, E, Exclude<R, Scope>>
|
package/src/internal/layer.ts
CHANGED
|
@@ -504,10 +504,10 @@ export const failCauseSync = <E>(evaluate: LazyArg<Cause.Cause<E>>): Layer.Layer
|
|
|
504
504
|
|
|
505
505
|
/** @internal */
|
|
506
506
|
export const flatMap = dual<
|
|
507
|
-
<A,
|
|
507
|
+
<A, A2, E2, R2>(
|
|
508
508
|
f: (context: Context.Context<A>) => Layer.Layer<A2, E2, R2>
|
|
509
|
-
) => <
|
|
510
|
-
<
|
|
509
|
+
) => <E, R>(self: Layer.Layer<A, E, R>) => Layer.Layer<A2, E | E2, R | R2>,
|
|
510
|
+
<A, E, R, A2, E2, R2>(
|
|
511
511
|
self: Layer.Layer<A, E, R>,
|
|
512
512
|
f: (context: Context.Context<A>) => Layer.Layer<A2, E2, R2>
|
|
513
513
|
) => Layer.Layer<A2, E | E2, R | R2>
|
|
@@ -515,12 +515,12 @@ export const flatMap = dual<
|
|
|
515
515
|
|
|
516
516
|
/** @internal */
|
|
517
517
|
export const flatten = dual<
|
|
518
|
-
<
|
|
518
|
+
<I, A, E2, R2>(
|
|
519
519
|
tag: Context.Tag<I, Layer.Layer<A, E2, R2>>
|
|
520
|
-
) => <
|
|
520
|
+
) => <E, R>(
|
|
521
521
|
self: Layer.Layer<I, E, R>
|
|
522
522
|
) => Layer.Layer<A, E | E2, R | R2>,
|
|
523
|
-
<
|
|
523
|
+
<I, E, R, A, E2, R2>(
|
|
524
524
|
self: Layer.Layer<I, E, R>,
|
|
525
525
|
tag: Context.Tag<I, Layer.Layer<A, E2, R2>>
|
|
526
526
|
) => Layer.Layer<A, E | E2, R | R2>
|
|
@@ -553,7 +553,7 @@ export const fromEffect = dual<
|
|
|
553
553
|
})
|
|
554
554
|
|
|
555
555
|
/** @internal */
|
|
556
|
-
export const fromEffectDiscard = <
|
|
556
|
+
export const fromEffectDiscard = <X, E, R>(effect: Effect.Effect<X, E, R>) =>
|
|
557
557
|
fromEffectContext(core.map(effect, () => Context.empty()))
|
|
558
558
|
|
|
559
559
|
/** @internal */
|
|
@@ -569,7 +569,7 @@ export function fromEffectContext<A, E, R>(
|
|
|
569
569
|
/** @internal */
|
|
570
570
|
export const fiberRefLocally = dual<
|
|
571
571
|
<X>(ref: FiberRef<X>, value: X) => <A, E, R>(self: Layer.Layer<A, E, R>) => Layer.Layer<A, E, R>,
|
|
572
|
-
<
|
|
572
|
+
<A, E, R, X>(self: Layer.Layer<A, E, R>, ref: FiberRef<X>, value: X) => Layer.Layer<A, E, R>
|
|
573
573
|
>(3, (self, ref, value) => locallyEffect(self, core.fiberRefLocally(ref, value)))
|
|
574
574
|
|
|
575
575
|
/** @internal */
|
|
@@ -592,7 +592,7 @@ export const locallyEffect = dual<
|
|
|
592
592
|
/** @internal */
|
|
593
593
|
export const fiberRefLocallyWith = dual<
|
|
594
594
|
<X>(ref: FiberRef<X>, value: (_: X) => X) => <A, E, R>(self: Layer.Layer<A, E, R>) => Layer.Layer<A, E, R>,
|
|
595
|
-
<
|
|
595
|
+
<A, E, R, X>(self: Layer.Layer<A, E, R>, ref: FiberRef<X>, value: (_: X) => X) => Layer.Layer<A, E, R>
|
|
596
596
|
>(3, (self, ref, value) => locallyEffect(self, core.fiberRefLocallyWith(ref, value)))
|
|
597
597
|
|
|
598
598
|
/** @internal */
|
|
@@ -624,8 +624,8 @@ export const launch = <RIn, E, ROut>(self: Layer.Layer<ROut, E, RIn>): Effect.Ef
|
|
|
624
624
|
export const map = dual<
|
|
625
625
|
<A, B>(
|
|
626
626
|
f: (context: Context.Context<A>) => Context.Context<B>
|
|
627
|
-
) => <
|
|
628
|
-
<
|
|
627
|
+
) => <E, R>(self: Layer.Layer<A, E, R>) => Layer.Layer<B, E, R>,
|
|
628
|
+
<A, E, R, B>(
|
|
629
629
|
self: Layer.Layer<A, E, R>,
|
|
630
630
|
f: (context: Context.Context<A>) => Context.Context<B>
|
|
631
631
|
) => Layer.Layer<B, E, R>
|
|
@@ -633,19 +633,19 @@ export const map = dual<
|
|
|
633
633
|
|
|
634
634
|
/** @internal */
|
|
635
635
|
export const mapError = dual<
|
|
636
|
-
<E, E2>(f: (error: E) => E2) => <
|
|
637
|
-
<
|
|
636
|
+
<E, E2>(f: (error: E) => E2) => <A, R>(self: Layer.Layer<A, E, R>) => Layer.Layer<A, E2, R>,
|
|
637
|
+
<A, E, R, E2>(self: Layer.Layer<A, E, R>, f: (error: E) => E2) => Layer.Layer<A, E2, R>
|
|
638
638
|
>(2, (self, f) => catchAll(self, (error) => failSync(() => f(error))))
|
|
639
639
|
|
|
640
640
|
/** @internal */
|
|
641
641
|
export const matchCause = dual<
|
|
642
|
-
<E,
|
|
642
|
+
<E, A2, E2, R2, A, A3, E3, R3>(
|
|
643
643
|
options: {
|
|
644
644
|
readonly onFailure: (cause: Cause.Cause<E>) => Layer.Layer<A2, E2, R2>
|
|
645
645
|
readonly onSuccess: (context: Context.Context<A>) => Layer.Layer<A3, E3, R3>
|
|
646
646
|
}
|
|
647
647
|
) => <R>(self: Layer.Layer<A, E, R>) => Layer.Layer<A2 & A3, E2 | E3, R | R2 | R3>,
|
|
648
|
-
<
|
|
648
|
+
<A, E, R, A2, E2, R2, A3, E3, R3>(
|
|
649
649
|
self: Layer.Layer<A, E, R>,
|
|
650
650
|
options: {
|
|
651
651
|
readonly onFailure: (cause: Cause.Cause<E>) => Layer.Layer<A2, E2, R2>
|
|
@@ -663,13 +663,13 @@ export const matchCause = dual<
|
|
|
663
663
|
|
|
664
664
|
/** @internal */
|
|
665
665
|
export const match = dual<
|
|
666
|
-
<E,
|
|
666
|
+
<E, A2, E2, R2, A, A3, E3, R3>(
|
|
667
667
|
options: {
|
|
668
668
|
readonly onFailure: (error: E) => Layer.Layer<A2, E2, R2>
|
|
669
669
|
readonly onSuccess: (context: Context.Context<A>) => Layer.Layer<A3, E3, R3>
|
|
670
670
|
}
|
|
671
671
|
) => <R>(self: Layer.Layer<A, E, R>) => Layer.Layer<A2 & A3, E2 | E3, R | R2 | R3>,
|
|
672
|
-
<
|
|
672
|
+
<A, E, R, A2, E2, R2, A3, E3, R3>(
|
|
673
673
|
self: Layer.Layer<A, E, R>,
|
|
674
674
|
options: {
|
|
675
675
|
readonly onFailure: (error: E) => Layer.Layer<A2, E2, R2>
|
|
@@ -740,10 +740,10 @@ export const orDie = <A, E, R>(self: Layer.Layer<A, E, R>): Layer.Layer<A, never
|
|
|
740
740
|
|
|
741
741
|
/** @internal */
|
|
742
742
|
export const orElse = dual<
|
|
743
|
-
<
|
|
743
|
+
<A2, E2, R2>(
|
|
744
744
|
that: LazyArg<Layer.Layer<A2, E2, R2>>
|
|
745
745
|
) => <A, E, R>(self: Layer.Layer<A, E, R>) => Layer.Layer<A & A2, E | E2, R | R2>,
|
|
746
|
-
<
|
|
746
|
+
<A, E, R, A2, E2, R2>(
|
|
747
747
|
self: Layer.Layer<A, E, R>,
|
|
748
748
|
that: LazyArg<Layer.Layer<A2, E2, R2>>
|
|
749
749
|
) => Layer.Layer<A & A2, E | E2, R | R2>
|
|
@@ -770,14 +770,14 @@ export const project = dual<
|
|
|
770
770
|
|
|
771
771
|
/** @internal */
|
|
772
772
|
export const retry = dual<
|
|
773
|
-
<
|
|
774
|
-
schedule: Schedule.Schedule<
|
|
775
|
-
) => <
|
|
773
|
+
<X, E, RIn2>(
|
|
774
|
+
schedule: Schedule.Schedule<X, E, RIn2>
|
|
775
|
+
) => <ROut, RIn>(
|
|
776
776
|
self: Layer.Layer<ROut, E, RIn>
|
|
777
777
|
) => Layer.Layer<ROut, E, RIn | RIn2>,
|
|
778
|
-
<
|
|
778
|
+
<ROut, E, RIn, X, RIn2>(
|
|
779
779
|
self: Layer.Layer<ROut, E, RIn>,
|
|
780
|
-
schedule: Schedule.Schedule<
|
|
780
|
+
schedule: Schedule.Schedule<X, E, RIn2>
|
|
781
781
|
) => Layer.Layer<ROut, E, RIn | RIn2>
|
|
782
782
|
>(2, (self, schedule) =>
|
|
783
783
|
suspend(() => {
|
|
@@ -790,10 +790,9 @@ export const retry = dual<
|
|
|
790
790
|
)
|
|
791
791
|
}))
|
|
792
792
|
|
|
793
|
-
|
|
794
|
-
const retryLoop = <RIn, E, ROut, RIn2, X>(
|
|
793
|
+
const retryLoop = <ROut, E, RIn, X, RIn2>(
|
|
795
794
|
self: Layer.Layer<ROut, E, RIn>,
|
|
796
|
-
schedule: Schedule.Schedule<
|
|
795
|
+
schedule: Schedule.Schedule<X, E, RIn2>,
|
|
797
796
|
stateTag: Context.Tag<{ state: unknown }, { state: unknown }>,
|
|
798
797
|
state: unknown
|
|
799
798
|
): Layer.Layer<ROut, E, RIn | RIn2> => {
|
|
@@ -808,9 +807,8 @@ const retryLoop = <RIn, E, ROut, RIn2, X>(
|
|
|
808
807
|
)
|
|
809
808
|
}
|
|
810
809
|
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
schedule: Schedule.Schedule<RIn, E, X>,
|
|
810
|
+
const retryUpdate = <X, E, RIn>(
|
|
811
|
+
schedule: Schedule.Schedule<X, E, RIn>,
|
|
814
812
|
stateTag: Context.Tag<{ state: unknown }, { state: unknown }>,
|
|
815
813
|
error: E,
|
|
816
814
|
state: unknown
|
|
@@ -840,10 +838,10 @@ const retryUpdate = <RIn, E, X>(
|
|
|
840
838
|
export const scoped = dual<
|
|
841
839
|
<T extends Context.Tag<any, any>>(
|
|
842
840
|
tag: T
|
|
843
|
-
) => <
|
|
841
|
+
) => <E, R>(
|
|
844
842
|
effect: Effect.Effect<Context.Tag.Service<T>, E, R>
|
|
845
843
|
) => Layer.Layer<Context.Tag.Identifier<T>, E, Exclude<R, Scope.Scope>>,
|
|
846
|
-
<T extends Context.Tag<any, any>,
|
|
844
|
+
<T extends Context.Tag<any, any>, E, R>(
|
|
847
845
|
tag: T,
|
|
848
846
|
effect: Effect.Effect<Context.Tag.Service<T>, E, R>
|
|
849
847
|
) => Layer.Layer<Context.Tag.Identifier<T>, E, Exclude<R, Scope.Scope>>
|
|
@@ -855,8 +853,8 @@ export const scoped = dual<
|
|
|
855
853
|
})
|
|
856
854
|
|
|
857
855
|
/** @internal */
|
|
858
|
-
export const scopedDiscard = <
|
|
859
|
-
effect: Effect.Effect<
|
|
856
|
+
export const scopedDiscard = <X, E, R>(
|
|
857
|
+
effect: Effect.Effect<X, E, R>
|
|
860
858
|
): Layer.Layer<never, E, Exclude<R, Scope.Scope>> => scopedContext(pipe(effect, core.as(Context.empty())))
|
|
861
859
|
|
|
862
860
|
/** @internal */
|
|
@@ -1054,11 +1052,11 @@ export const provideMerge = dual<
|
|
|
1054
1052
|
|
|
1055
1053
|
/** @internal */
|
|
1056
1054
|
export const zipWith = dual<
|
|
1057
|
-
<
|
|
1055
|
+
<B, E2, R2, A, C>(
|
|
1058
1056
|
that: Layer.Layer<B, E2, R2>,
|
|
1059
1057
|
f: (a: Context.Context<A>, b: Context.Context<B>) => Context.Context<C>
|
|
1060
|
-
) => <
|
|
1061
|
-
<
|
|
1058
|
+
) => <E, R>(self: Layer.Layer<A, E, R>) => Layer.Layer<C, E | E2, R | R2>,
|
|
1059
|
+
<A, E, R, B, E2, R2, C>(
|
|
1062
1060
|
self: Layer.Layer<A, E, R>,
|
|
1063
1061
|
that: Layer.Layer<B, E2, R2>,
|
|
1064
1062
|
f: (a: Context.Context<A>, b: Context.Context<B>) => Context.Context<C>
|
|
@@ -1074,7 +1072,7 @@ export const zipWith = dual<
|
|
|
1074
1072
|
}))
|
|
1075
1073
|
|
|
1076
1074
|
/** @internal */
|
|
1077
|
-
export const unwrapEffect = <
|
|
1075
|
+
export const unwrapEffect = <A, E1, R1, E, R>(
|
|
1078
1076
|
self: Effect.Effect<Layer.Layer<A, E1, R1>, E, R>
|
|
1079
1077
|
): Layer.Layer<A, E | E1, R | R1> => {
|
|
1080
1078
|
const tag = Context.GenericTag<Layer.Layer<A, E1, R1>>("effect/Layer/unwrapEffect/Layer.Layer<R1, E1, A>")
|
|
@@ -1082,7 +1080,7 @@ export const unwrapEffect = <R, E, R1, E1, A>(
|
|
|
1082
1080
|
}
|
|
1083
1081
|
|
|
1084
1082
|
/** @internal */
|
|
1085
|
-
export const unwrapScoped = <
|
|
1083
|
+
export const unwrapScoped = <A, E1, R1, E, R>(
|
|
1086
1084
|
self: Effect.Effect<Layer.Layer<A, E1, R1>, E, R>
|
|
1087
1085
|
): Layer.Layer<A, E | E1, R1 | Exclude<R, Scope.Scope>> => {
|
|
1088
1086
|
const tag = Context.GenericTag<Layer.Layer<A, E1, R1>>("effect/Layer/unwrapScoped/Layer.Layer<R1, E1, A>")
|
|
@@ -1139,10 +1137,10 @@ export const withParentSpan = dual<
|
|
|
1139
1137
|
// circular with Effect
|
|
1140
1138
|
|
|
1141
1139
|
const provideSomeLayer = dual<
|
|
1142
|
-
<
|
|
1140
|
+
<A2, E2, R2>(
|
|
1143
1141
|
layer: Layer.Layer<A2, E2, R2>
|
|
1144
1142
|
) => <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E | E2, R2 | Exclude<R, A2>>,
|
|
1145
|
-
<
|
|
1143
|
+
<A, E, R, A2, E2, R2>(
|
|
1146
1144
|
self: Effect.Effect<A, E, R>,
|
|
1147
1145
|
layer: Layer.Layer<A2, E2, R2>
|
|
1148
1146
|
) => Effect.Effect<A, E | E2, R2 | Exclude<R, A2>>
|
|
@@ -1188,9 +1186,9 @@ const provideSomeRuntime = dual<
|
|
|
1188
1186
|
/** @internal */
|
|
1189
1187
|
export const effect_provide = dual<
|
|
1190
1188
|
{
|
|
1191
|
-
<
|
|
1192
|
-
layer: Layer.Layer<
|
|
1193
|
-
): <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E | E2,
|
|
1189
|
+
<ROut, E2, RIn>(
|
|
1190
|
+
layer: Layer.Layer<ROut, E2, RIn>
|
|
1191
|
+
): <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E | E2, RIn | Exclude<R, ROut>>
|
|
1194
1192
|
<R2>(
|
|
1195
1193
|
context: Context.Context<R2>
|
|
1196
1194
|
): <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, R2>>
|
|
@@ -1199,28 +1197,28 @@ export const effect_provide = dual<
|
|
|
1199
1197
|
): <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, R2>>
|
|
1200
1198
|
},
|
|
1201
1199
|
{
|
|
1202
|
-
<A, E, R,
|
|
1200
|
+
<A, E, R, ROut, E2, RIn>(
|
|
1203
1201
|
self: Effect.Effect<A, E, R>,
|
|
1204
|
-
layer: Layer.Layer<
|
|
1205
|
-
): Effect.Effect<A, E | E2,
|
|
1206
|
-
<
|
|
1202
|
+
layer: Layer.Layer<ROut, E2, RIn>
|
|
1203
|
+
): Effect.Effect<A, E | E2, RIn | Exclude<R, ROut>>
|
|
1204
|
+
<A, E, R, R2>(
|
|
1207
1205
|
self: Effect.Effect<A, E, R>,
|
|
1208
1206
|
context: Context.Context<R2>
|
|
1209
1207
|
): Effect.Effect<A, E, Exclude<R, R2>>
|
|
1210
|
-
<
|
|
1208
|
+
<A, E, R, R2>(
|
|
1211
1209
|
self: Effect.Effect<A, E, R>,
|
|
1212
1210
|
runtime: Runtime.Runtime<R2>
|
|
1213
1211
|
): Effect.Effect<A, E, Exclude<R, R2>>
|
|
1214
1212
|
}
|
|
1215
1213
|
>(
|
|
1216
1214
|
2,
|
|
1217
|
-
<A, E, R,
|
|
1215
|
+
<A, E, R, ROut>(
|
|
1218
1216
|
self: Effect.Effect<A, E, R>,
|
|
1219
|
-
source: Layer.Layer<
|
|
1220
|
-
): Effect.Effect<any, any, Exclude<R,
|
|
1217
|
+
source: Layer.Layer<ROut, any, any> | Context.Context<ROut> | Runtime.Runtime<ROut>
|
|
1218
|
+
): Effect.Effect<any, any, Exclude<R, ROut>> =>
|
|
1221
1219
|
isLayer(source)
|
|
1222
|
-
? provideSomeLayer(self, source as Layer.Layer<
|
|
1220
|
+
? provideSomeLayer(self, source as Layer.Layer<ROut, any, any>)
|
|
1223
1221
|
: Context.isContext(source)
|
|
1224
1222
|
? core.provideSomeContext(self, source)
|
|
1225
|
-
: provideSomeRuntime(self, source as Runtime.Runtime<
|
|
1223
|
+
: provideSomeRuntime(self, source as Runtime.Runtime<ROut>)
|
|
1226
1224
|
)
|
package/src/internal/matcher.ts
CHANGED
|
@@ -87,7 +87,7 @@ const ValueMatcherProto: Omit<
|
|
|
87
87
|
|
|
88
88
|
function makeValueMatcher<I, R, RA, A, Pr>(
|
|
89
89
|
provided: Pr,
|
|
90
|
-
value: Either.Either<
|
|
90
|
+
value: Either.Either<Pr, RA>
|
|
91
91
|
): ValueMatcher<I, R, RA, A, Pr> {
|
|
92
92
|
const matcher = Object.create(ValueMatcherProto)
|
|
93
93
|
matcher.provided = provided
|
|
@@ -514,8 +514,8 @@ export const orElseAbsurd = <I, R, RA, A, Pr>(
|
|
|
514
514
|
/** @internal */
|
|
515
515
|
export const either: <I, F, R, A, Pr>(
|
|
516
516
|
self: Matcher<I, F, R, A, Pr>
|
|
517
|
-
) => [Pr] extends [never] ? (input: I) => Either.Either<
|
|
518
|
-
: Either.Either<
|
|
517
|
+
) => [Pr] extends [never] ? (input: I) => Either.Either<Unify<A>, R>
|
|
518
|
+
: Either.Either<Unify<A>, R> = (<I, R, RA, A>(self: Matcher<I, R, RA, A, I>) => {
|
|
519
519
|
if (self._tag === "ValueMatcher") {
|
|
520
520
|
return self.value
|
|
521
521
|
}
|
|
@@ -523,7 +523,7 @@ export const either: <I, F, R, A, Pr>(
|
|
|
523
523
|
const len = self.cases.length
|
|
524
524
|
if (len === 1) {
|
|
525
525
|
const _case = self.cases[0]
|
|
526
|
-
return (input: I): Either.Either<
|
|
526
|
+
return (input: I): Either.Either<A, RA> => {
|
|
527
527
|
if (_case._tag === "When" && _case.guard(input) === true) {
|
|
528
528
|
return Either.right(_case.evaluate(input))
|
|
529
529
|
} else if (_case._tag === "Not" && _case.guard(input) === false) {
|
|
@@ -532,7 +532,7 @@ export const either: <I, F, R, A, Pr>(
|
|
|
532
532
|
return Either.left(input as any)
|
|
533
533
|
}
|
|
534
534
|
}
|
|
535
|
-
return (input: I): Either.Either<
|
|
535
|
+
return (input: I): Either.Either<A, RA> => {
|
|
536
536
|
for (let i = 0; i < len; i++) {
|
|
537
537
|
const _case = self.cases[i]
|
|
538
538
|
if (_case._tag === "When" && _case.guard(input) === true) {
|
|
@@ -64,14 +64,14 @@ export const collectAll = <R, E, Out>(
|
|
|
64
64
|
|
|
65
65
|
/** @internal */
|
|
66
66
|
export const launch = dual<
|
|
67
|
-
<
|
|
68
|
-
schedule: Schedule.Schedule<
|
|
67
|
+
<A2, R2>(
|
|
68
|
+
schedule: Schedule.Schedule<A2, unknown, R2>
|
|
69
69
|
) => <Type, In, R, E, Out>(
|
|
70
70
|
self: MetricPolling.MetricPolling<Type, In, R, E, Out>
|
|
71
71
|
) => Effect.Effect<Fiber.Fiber<A2, E>, never, R | R2 | Scope.Scope>,
|
|
72
|
-
<Type, In, R, E, Out,
|
|
72
|
+
<Type, In, R, E, Out, A2, R2>(
|
|
73
73
|
self: MetricPolling.MetricPolling<Type, In, R, E, Out>,
|
|
74
|
-
schedule: Schedule.Schedule<
|
|
74
|
+
schedule: Schedule.Schedule<A2, unknown, R2>
|
|
75
75
|
) => Effect.Effect<Fiber.Fiber<A2, E>, never, R | R2 | Scope.Scope>
|
|
76
76
|
>(2, (self, schedule) =>
|
|
77
77
|
pipe(
|
|
@@ -92,14 +92,14 @@ export const pollAndUpdate = <Type, In, R, E, Out>(
|
|
|
92
92
|
|
|
93
93
|
/** @internal */
|
|
94
94
|
export const retry = dual<
|
|
95
|
-
<
|
|
96
|
-
policy: Schedule.Schedule<
|
|
95
|
+
<X, E, R2>(
|
|
96
|
+
policy: Schedule.Schedule<X, E, R2>
|
|
97
97
|
) => <Type, In, R, Out>(
|
|
98
98
|
self: MetricPolling.MetricPolling<Type, In, R, E, Out>
|
|
99
99
|
) => MetricPolling.MetricPolling<Type, In, R | R2, E, Out>,
|
|
100
|
-
<Type, In, R,
|
|
100
|
+
<Type, In, R, E, Out, X, R2>(
|
|
101
101
|
self: MetricPolling.MetricPolling<Type, In, R, E, Out>,
|
|
102
|
-
policy: Schedule.Schedule<
|
|
102
|
+
policy: Schedule.Schedule<X, E, R2>
|
|
103
103
|
) => MetricPolling.MetricPolling<Type, In, R | R2, E, Out>
|
|
104
104
|
>(2, (self, policy) => ({
|
|
105
105
|
[MetricPollingTypeId]: MetricPollingTypeId,
|
package/src/internal/metric.ts
CHANGED
|
@@ -425,12 +425,12 @@ export const trackDurationWith = dual<
|
|
|
425
425
|
export const trackError = dual<
|
|
426
426
|
<Type, In, Out>(
|
|
427
427
|
metric: Metric.Metric<Type, In, Out>
|
|
428
|
-
) => <
|
|
429
|
-
<
|
|
428
|
+
) => <A, E extends In, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>,
|
|
429
|
+
<A, E extends In, R, Type, In, Out>(
|
|
430
430
|
self: Effect.Effect<A, E, R>,
|
|
431
431
|
metric: Metric.Metric<Type, In, Out>
|
|
432
432
|
) => Effect.Effect<A, E, R>
|
|
433
|
-
>(2, <
|
|
433
|
+
>(2, <A, E extends In, R, Type, In, Out>(
|
|
434
434
|
self: Effect.Effect<A, E, R>,
|
|
435
435
|
metric: Metric.Metric<Type, In, Out>
|
|
436
436
|
) => trackErrorWith(self, metric, (a: In) => a))
|
|
@@ -440,13 +440,13 @@ export const trackErrorWith = dual<
|
|
|
440
440
|
<Type, In, Out, In2>(
|
|
441
441
|
metric: Metric.Metric<Type, In, Out>,
|
|
442
442
|
f: (error: In2) => In
|
|
443
|
-
) => <
|
|
444
|
-
<
|
|
443
|
+
) => <A, E extends In2, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>,
|
|
444
|
+
<A, E extends In2, R, Type, In, Out, In2>(
|
|
445
445
|
self: Effect.Effect<A, E, R>,
|
|
446
446
|
metric: Metric.Metric<Type, In, Out>,
|
|
447
447
|
f: (error: In2) => In
|
|
448
448
|
) => Effect.Effect<A, E, R>
|
|
449
|
-
>(3, <
|
|
449
|
+
>(3, <A, E extends In2, R, Type, In, Out, In2>(
|
|
450
450
|
self: Effect.Effect<A, E, R>,
|
|
451
451
|
metric: Metric.Metric<Type, In, Out>,
|
|
452
452
|
f: (error: In2) => In
|