effect 4.0.0-beta.5 → 4.0.0-beta.50
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/Array.d.ts +213 -385
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +149 -102
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +82 -45
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +87 -38
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts +39 -32
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +32 -29
- package/dist/BigInt.js.map +1 -1
- package/dist/Brand.d.ts +1 -1
- package/dist/Brand.d.ts.map +1 -1
- package/dist/Brand.js +1 -1
- package/dist/Brand.js.map +1 -1
- package/dist/Cache.d.ts +14 -45
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +21 -47
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +54 -23
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Cause.js +108 -10
- package/dist/Cause.js.map +1 -1
- package/dist/Channel.d.ts +166 -48
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +182 -91
- package/dist/Channel.js.map +1 -1
- package/dist/Chunk.d.ts +112 -304
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +56 -88
- package/dist/Chunk.js.map +1 -1
- package/dist/Clock.d.ts +2 -2
- package/dist/Clock.d.ts.map +1 -1
- package/dist/Clock.js.map +1 -1
- package/dist/Combiner.d.ts +280 -13
- package/dist/Combiner.d.ts.map +1 -1
- package/dist/Combiner.js +198 -7
- package/dist/Combiner.js.map +1 -1
- package/dist/Config.d.ts +171 -11
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +69 -11
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +6 -6
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +5 -5
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Console.d.ts +2 -2
- package/dist/Console.d.ts.map +1 -1
- package/dist/Console.js.map +1 -1
- package/dist/Context.d.ts +1150 -0
- package/dist/Context.d.ts.map +1 -0
- package/dist/{ServiceMap.js → Context.js} +181 -165
- package/dist/Context.js.map +1 -0
- package/dist/Cron.d.ts +11 -7
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +120 -63
- package/dist/Cron.js.map +1 -1
- package/dist/Data.d.ts +535 -366
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js +132 -79
- package/dist/Data.js.map +1 -1
- package/dist/DateTime.d.ts +74 -255
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +17 -62
- package/dist/DateTime.js.map +1 -1
- package/dist/Deferred.d.ts +12 -5
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +13 -5
- package/dist/Deferred.js.map +1 -1
- package/dist/Duration.d.ts +62 -32
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +108 -78
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +1377 -1147
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +465 -446
- package/dist/Effect.js.map +1 -1
- package/dist/Encoding.d.ts +194 -0
- package/dist/Encoding.d.ts.map +1 -0
- package/dist/Encoding.js +352 -0
- package/dist/Encoding.js.map +1 -0
- package/dist/Equal.d.ts +276 -109
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +140 -48
- package/dist/Equal.js.map +1 -1
- package/dist/Equivalence.d.ts +60 -3
- package/dist/Equivalence.d.ts.map +1 -1
- package/dist/Equivalence.js +70 -13
- package/dist/Equivalence.js.map +1 -1
- package/dist/ErrorReporter.d.ts +374 -0
- package/dist/ErrorReporter.d.ts.map +1 -0
- package/dist/ErrorReporter.js +245 -0
- package/dist/ErrorReporter.js.map +1 -0
- package/dist/ExecutionPlan.d.ts +6 -6
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/ExecutionPlan.js +4 -4
- package/dist/ExecutionPlan.js.map +1 -1
- package/dist/Exit.d.ts +24 -12
- package/dist/Exit.d.ts.map +1 -1
- package/dist/Exit.js +8 -4
- package/dist/Exit.js.map +1 -1
- package/dist/Fiber.d.ts +10 -8
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.d.ts +11 -10
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +12 -11
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +22 -21
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +10 -10
- package/dist/FiberMap.js.map +1 -1
- package/dist/FiberSet.d.ts +2 -2
- package/dist/FiberSet.d.ts.map +1 -1
- package/dist/FiberSet.js +4 -4
- package/dist/FiberSet.js.map +1 -1
- package/dist/FileSystem.d.ts +20 -19
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +17 -13
- package/dist/FileSystem.js.map +1 -1
- package/dist/Filter.d.ts +4 -37
- package/dist/Filter.d.ts.map +1 -1
- package/dist/Filter.js +0 -13
- package/dist/Filter.js.map +1 -1
- package/dist/Formatter.d.ts +131 -47
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js +229 -51
- package/dist/Formatter.js.map +1 -1
- package/dist/Function.d.ts +1 -9
- package/dist/Function.d.ts.map +1 -1
- package/dist/Function.js +2 -10
- package/dist/Function.js.map +1 -1
- package/dist/Graph.d.ts +65 -65
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +60 -62
- package/dist/Graph.js.map +1 -1
- package/dist/Hash.js +1 -1
- package/dist/Hash.js.map +1 -1
- package/dist/HashMap.d.ts +26 -19
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashMap.js +7 -5
- package/dist/HashMap.js.map +1 -1
- package/dist/Iterable.d.ts +50 -50
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +106 -34
- package/dist/Iterable.js.map +1 -1
- package/dist/JsonSchema.d.ts +299 -10
- package/dist/JsonSchema.d.ts.map +1 -1
- package/dist/JsonSchema.js +323 -4
- package/dist/JsonSchema.js.map +1 -1
- package/dist/Latch.d.ts +175 -0
- package/dist/Latch.d.ts.map +1 -0
- package/dist/Latch.js +130 -0
- package/dist/Latch.js.map +1 -0
- package/dist/Layer.d.ts +599 -379
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +249 -180
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +27 -26
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +21 -18
- package/dist/LayerMap.js.map +1 -1
- package/dist/LogLevel.d.ts +32 -0
- package/dist/LogLevel.d.ts.map +1 -1
- package/dist/LogLevel.js +28 -100
- package/dist/LogLevel.js.map +1 -1
- package/dist/Logger.d.ts +31 -97
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +2 -3
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.d.ts +8 -8
- package/dist/ManagedRuntime.d.ts.map +1 -1
- package/dist/ManagedRuntime.js +34 -25
- package/dist/ManagedRuntime.js.map +1 -1
- package/dist/Metric.d.ts +23 -25
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +24 -26
- package/dist/Metric.js.map +1 -1
- package/dist/MutableHashMap.d.ts +7 -0
- package/dist/MutableHashMap.d.ts.map +1 -1
- package/dist/MutableHashMap.js +8 -0
- package/dist/MutableHashMap.js.map +1 -1
- package/dist/MutableHashSet.d.ts +7 -0
- package/dist/MutableHashSet.d.ts.map +1 -1
- package/dist/MutableHashSet.js +8 -0
- package/dist/MutableHashSet.js.map +1 -1
- package/dist/MutableList.d.ts.map +1 -1
- package/dist/MutableList.js +3 -0
- package/dist/MutableList.js.map +1 -1
- package/dist/Newtype.d.ts +291 -0
- package/dist/Newtype.d.ts.map +1 -0
- package/dist/Newtype.js +161 -0
- package/dist/Newtype.js.map +1 -0
- package/dist/Number.d.ts +74 -18
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +46 -18
- package/dist/Number.js.map +1 -1
- package/dist/Optic.d.ts +947 -18
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js +454 -5
- package/dist/Optic.js.map +1 -1
- package/dist/Option.d.ts +25 -16
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +15 -9
- package/dist/Option.js.map +1 -1
- package/dist/Order.d.ts +6 -1
- package/dist/Order.d.ts.map +1 -1
- package/dist/Order.js +19 -14
- package/dist/Order.js.map +1 -1
- package/dist/PartitionedSemaphore.d.ts +146 -15
- package/dist/PartitionedSemaphore.d.ts.map +1 -1
- package/dist/PartitionedSemaphore.js +174 -61
- package/dist/PartitionedSemaphore.js.map +1 -1
- package/dist/Path.d.ts +2 -2
- package/dist/Path.d.ts.map +1 -1
- package/dist/Path.js +2 -2
- package/dist/Path.js.map +1 -1
- package/dist/Pipeable.d.ts +17 -0
- package/dist/Pipeable.d.ts.map +1 -1
- package/dist/Pipeable.js +19 -1
- package/dist/Pipeable.js.map +1 -1
- package/dist/PlatformError.d.ts +2 -2
- package/dist/Pool.d.ts +6 -4
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +11 -9
- package/dist/Pool.js.map +1 -1
- package/dist/PubSub.d.ts +8 -6
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +18 -10
- package/dist/PubSub.js.map +1 -1
- package/dist/Pull.d.ts.map +1 -1
- package/dist/Pull.js +1 -1
- package/dist/Pull.js.map +1 -1
- package/dist/Queue.d.ts +9 -6
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +7 -5
- package/dist/Queue.js.map +1 -1
- package/dist/Random.d.ts +36 -2
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +46 -35
- package/dist/Random.js.map +1 -1
- package/dist/RcMap.d.ts +4 -4
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +13 -13
- package/dist/RcMap.js.map +1 -1
- package/dist/RcRef.d.ts +1 -1
- package/dist/RcRef.d.ts.map +1 -1
- package/dist/Record.d.ts +63 -160
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +37 -56
- package/dist/Record.js.map +1 -1
- package/dist/Redactable.d.ts +139 -62
- package/dist/Redactable.d.ts.map +1 -1
- package/dist/Redactable.js +59 -55
- package/dist/Redactable.js.map +1 -1
- package/dist/Reducer.d.ts +166 -7
- package/dist/Reducer.d.ts.map +1 -1
- package/dist/Reducer.js +135 -1
- package/dist/Reducer.js.map +1 -1
- package/dist/References.d.ts +257 -229
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +240 -259
- package/dist/References.js.map +1 -1
- package/dist/Request.d.ts +6 -6
- package/dist/Request.d.ts.map +1 -1
- package/dist/Request.js +2 -1
- package/dist/Request.js.map +1 -1
- package/dist/RequestResolver.d.ts +25 -45
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/RequestResolver.js +15 -36
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Resource.d.ts +0 -3
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +5 -4
- package/dist/Resource.js.map +1 -1
- package/dist/Result.d.ts +1 -1
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +1 -2
- package/dist/Result.js.map +1 -1
- package/dist/Runtime.d.ts +66 -0
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +79 -6
- package/dist/Runtime.js.map +1 -1
- package/dist/Schedule.d.ts +176 -293
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +162 -136
- package/dist/Schedule.js.map +1 -1
- package/dist/Scheduler.d.ts +36 -125
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +37 -126
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +3269 -394
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +2284 -282
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +7 -2
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +136 -40
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +54 -10
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +82 -23
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaParser.d.ts +44 -54
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +55 -2
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +46 -45
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +65 -38
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +252 -3
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +319 -13
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/Scope.d.ts +2 -2
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js.map +1 -1
- package/dist/ScopedCache.d.ts +2 -2
- package/dist/ScopedCache.d.ts.map +1 -1
- package/dist/ScopedCache.js +5 -5
- package/dist/ScopedCache.js.map +1 -1
- package/dist/Semaphore.d.ts +307 -0
- package/dist/Semaphore.d.ts.map +1 -0
- package/dist/Semaphore.js +220 -0
- package/dist/Semaphore.js.map +1 -0
- package/dist/Sink.d.ts +22 -19
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +54 -7
- package/dist/Sink.js.map +1 -1
- package/dist/Stdio.d.ts +18 -6
- package/dist/Stdio.d.ts.map +1 -1
- package/dist/Stdio.js +20 -2
- package/dist/Stdio.js.map +1 -1
- package/dist/Stream.d.ts +465 -542
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +321 -144
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +114 -47
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +29 -47
- package/dist/String.js.map +1 -1
- package/dist/Struct.d.ts +23 -7
- package/dist/Struct.d.ts.map +1 -1
- package/dist/Struct.js +22 -0
- package/dist/Struct.js.map +1 -1
- package/dist/SubscriptionRef.d.ts +3 -3
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +85 -117
- package/dist/SubscriptionRef.js.map +1 -1
- package/dist/SynchronizedRef.d.ts +2 -1
- package/dist/SynchronizedRef.d.ts.map +1 -1
- package/dist/SynchronizedRef.js +2 -1
- package/dist/SynchronizedRef.js.map +1 -1
- package/dist/Terminal.d.ts +5 -4
- package/dist/Terminal.d.ts.map +1 -1
- package/dist/Terminal.js +2 -2
- package/dist/Terminal.js.map +1 -1
- package/dist/Tracer.d.ts +21 -20
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +13 -9
- package/dist/Tracer.js.map +1 -1
- package/dist/Trie.d.ts +44 -31
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Trie.js +13 -9
- package/dist/Trie.js.map +1 -1
- package/dist/TxChunk.d.ts +4 -4
- package/dist/TxChunk.d.ts.map +1 -1
- package/dist/TxChunk.js +4 -4
- package/dist/TxChunk.js.map +1 -1
- package/dist/TxDeferred.d.ts +328 -0
- package/dist/TxDeferred.d.ts.map +1 -0
- package/dist/TxDeferred.js +197 -0
- package/dist/TxDeferred.js.map +1 -0
- package/dist/TxHashMap.d.ts +105 -86
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js +51 -44
- package/dist/TxHashMap.js.map +1 -1
- package/dist/TxHashSet.d.ts +2 -2
- package/dist/TxHashSet.d.ts.map +1 -1
- package/dist/TxHashSet.js +16 -15
- package/dist/TxHashSet.js.map +1 -1
- package/dist/TxPriorityQueue.d.ts +609 -0
- package/dist/TxPriorityQueue.d.ts.map +1 -0
- package/dist/TxPriorityQueue.js +416 -0
- package/dist/TxPriorityQueue.js.map +1 -0
- package/dist/TxPubSub.d.ts +585 -0
- package/dist/TxPubSub.d.ts.map +1 -0
- package/dist/TxPubSub.js +521 -0
- package/dist/TxPubSub.js.map +1 -0
- package/dist/TxQueue.d.ts +1 -1
- package/dist/TxQueue.d.ts.map +1 -1
- package/dist/TxQueue.js +42 -57
- package/dist/TxQueue.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +500 -0
- package/dist/TxReentrantLock.d.ts.map +1 -0
- package/dist/TxReentrantLock.js +481 -0
- package/dist/TxReentrantLock.js.map +1 -0
- package/dist/TxRef.d.ts +14 -20
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +8 -10
- package/dist/TxRef.js.map +1 -1
- package/dist/TxSemaphore.d.ts +162 -2
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +25 -10
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/TxSubscriptionRef.d.ts +508 -0
- package/dist/TxSubscriptionRef.d.ts.map +1 -0
- package/dist/TxSubscriptionRef.js +293 -0
- package/dist/TxSubscriptionRef.js.map +1 -0
- package/dist/Types.d.ts +83 -17
- package/dist/Types.d.ts.map +1 -1
- package/dist/Unify.d.ts +8 -2
- package/dist/Unify.d.ts.map +1 -1
- package/dist/Unify.js.map +1 -1
- package/dist/Utils.d.ts +137 -65
- package/dist/Utils.d.ts.map +1 -1
- package/dist/Utils.js +38 -66
- package/dist/Utils.js.map +1 -1
- package/dist/index.d.ts +888 -71
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +888 -71
- package/dist/index.js.map +1 -1
- package/dist/internal/core.js +11 -3
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/dateTime.js +77 -71
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/effect.js +343 -260
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/hashMap.js +7 -5
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/layer.js +3 -3
- package/dist/internal/layer.js.map +1 -1
- package/dist/internal/option.js +6 -0
- package/dist/internal/option.js.map +1 -1
- package/dist/internal/random.d.ts +2 -0
- package/dist/internal/random.d.ts.map +1 -0
- package/dist/internal/random.js +13 -0
- package/dist/internal/random.js.map +1 -0
- package/dist/internal/rcRef.js +11 -10
- package/dist/internal/rcRef.js.map +1 -1
- package/dist/internal/references.d.ts +2 -0
- package/dist/internal/references.d.ts.map +1 -0
- package/dist/internal/references.js +51 -0
- package/dist/internal/references.js.map +1 -0
- package/dist/internal/request.js +6 -6
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/schedule.js +1 -1
- package/dist/internal/schedule.js.map +1 -1
- package/dist/internal/schema/annotations.js +2 -0
- package/dist/internal/schema/annotations.js.map +1 -1
- package/dist/internal/schema/representation.js +86 -107
- package/dist/internal/schema/representation.js.map +1 -1
- package/dist/internal/schema/schema.d.ts +10 -1
- package/dist/internal/schema/schema.d.ts.map +1 -1
- package/dist/internal/schema/schema.js +22 -1
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/internal/schema/to-codec.js +7 -10
- package/dist/internal/schema/to-codec.js.map +1 -1
- package/dist/internal/trie.js +8 -7
- package/dist/internal/trie.js.map +1 -1
- package/dist/testing/TestClock.d.ts +8 -7
- package/dist/testing/TestClock.d.ts.map +1 -1
- package/dist/testing/TestClock.js +6 -4
- package/dist/testing/TestClock.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +267 -33
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/testing/TestSchema.js +296 -23
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/testing/index.d.ts +64 -1
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +64 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +155 -73
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +29 -23
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +9 -2
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +39 -11
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +41 -47
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.d.ts +130 -0
- package/dist/unstable/ai/EmbeddingModel.d.ts.map +1 -0
- package/dist/unstable/ai/EmbeddingModel.js +127 -0
- package/dist/unstable/ai/EmbeddingModel.js.map +1 -0
- package/dist/unstable/ai/IdGenerator.d.ts +2 -2
- package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
- package/dist/unstable/ai/IdGenerator.js +2 -2
- package/dist/unstable/ai/IdGenerator.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +119 -49
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +260 -61
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpSchema.d.ts +236 -141
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +71 -19
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +68 -15
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +218 -73
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Model.d.ts +27 -9
- package/dist/unstable/ai/Model.d.ts.map +1 -1
- package/dist/unstable/ai/Model.js +25 -9
- package/dist/unstable/ai/Model.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +9 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Prompt.d.ts +20 -20
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Prompt.js +6 -9
- package/dist/unstable/ai/Prompt.js.map +1 -1
- package/dist/unstable/ai/Response.d.ts +27 -27
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js +7 -8
- package/dist/unstable/ai/Response.js.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.d.ts +38 -0
- package/dist/unstable/ai/ResponseIdTracker.d.ts.map +1 -0
- package/dist/unstable/ai/ResponseIdTracker.js +68 -0
- package/dist/unstable/ai/ResponseIdTracker.js.map +1 -0
- package/dist/unstable/ai/Telemetry.d.ts +35 -2
- package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
- package/dist/unstable/ai/Telemetry.js +2 -2
- package/dist/unstable/ai/Telemetry.js.map +1 -1
- package/dist/unstable/ai/Tokenizer.d.ts +2 -2
- package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
- package/dist/unstable/ai/Tokenizer.js +2 -2
- package/dist/unstable/ai/Tokenizer.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +46 -16
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +68 -22
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +4 -4
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +14 -21
- package/dist/unstable/ai/Toolkit.js.map +1 -1
- package/dist/unstable/ai/index.d.ts +22 -1
- package/dist/unstable/ai/index.d.ts.map +1 -1
- package/dist/unstable/ai/index.js +22 -1
- package/dist/unstable/ai/index.js.map +1 -1
- package/dist/unstable/ai/internal/codec-transformer.js +5 -7
- package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
- package/dist/unstable/cli/Argument.d.ts +4 -7
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js +1 -3
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +55 -67
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +32 -57
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/CliOutput.d.ts +5 -4
- package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
- package/dist/unstable/cli/CliOutput.js +67 -12
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +372 -59
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +328 -66
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Completions.d.ts +97 -0
- package/dist/unstable/cli/Completions.d.ts.map +1 -0
- package/dist/unstable/cli/Completions.js +25 -0
- package/dist/unstable/cli/Completions.js.map +1 -0
- package/dist/unstable/cli/Flag.d.ts +4 -5
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js +1 -1
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +125 -0
- package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -0
- package/dist/unstable/cli/GlobalFlag.js +118 -0
- package/dist/unstable/cli/GlobalFlag.js.map +1 -0
- package/dist/unstable/cli/HelpDoc.d.ts +81 -11
- package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
- package/dist/unstable/cli/Param.d.ts +34 -6
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +24 -14
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +2 -2
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js +1 -1
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/Prompt.js +266 -86
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/index.d.ts +8 -0
- package/dist/unstable/cli/index.d.ts.map +1 -1
- package/dist/unstable/cli/index.js +8 -0
- package/dist/unstable/cli/index.js.map +1 -1
- package/dist/unstable/cli/internal/command.d.ts +41 -15
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.js +84 -47
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/completions/bash.js.map +1 -1
- package/dist/unstable/cli/internal/completions/descriptor.d.ts +2 -0
- package/dist/unstable/cli/internal/completions/descriptor.d.ts.map +1 -0
- package/dist/unstable/cli/internal/completions/{CommandDescriptor.js → descriptor.js} +17 -5
- package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -0
- package/dist/unstable/cli/internal/completions/fish.js.map +1 -1
- package/dist/unstable/cli/internal/completions/zsh.js.map +1 -1
- package/dist/unstable/cli/internal/config.js +42 -0
- package/dist/unstable/cli/internal/config.js.map +1 -1
- package/dist/unstable/cli/internal/help.d.ts +33 -0
- package/dist/unstable/cli/internal/help.d.ts.map +1 -0
- package/dist/unstable/cli/internal/help.js +125 -0
- package/dist/unstable/cli/internal/help.js.map +1 -0
- package/dist/unstable/cli/internal/parser.js +155 -58
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cluster/ClusterCron.d.ts +1 -1
- package/dist/unstable/cluster/ClusterCron.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterCron.js +1 -1
- package/dist/unstable/cluster/ClusterCron.js.map +1 -1
- package/dist/unstable/cluster/ClusterError.d.ts +7 -7
- package/dist/unstable/cluster/ClusterSchema.d.ts +28 -7
- package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.js +28 -8
- package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +4 -2
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +97 -63
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/DeliverAt.js +1 -1
- package/dist/unstable/cluster/DeliverAt.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +18 -16
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +31 -25
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/EntityAddress.d.ts +2 -2
- package/dist/unstable/cluster/EntityAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityAddress.js +1 -1
- package/dist/unstable/cluster/EntityAddress.js.map +1 -1
- package/dist/unstable/cluster/EntityProxy.js +3 -3
- package/dist/unstable/cluster/EntityProxy.js.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.js +4 -4
- package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
- package/dist/unstable/cluster/EntityResource.d.ts +4 -4
- package/dist/unstable/cluster/EntityResource.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityResource.js +2 -2
- package/dist/unstable/cluster/EntityResource.js.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts +4 -4
- package/dist/unstable/cluster/HttpRunner.js +2 -2
- package/dist/unstable/cluster/HttpRunner.js.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.d.ts +5 -5
- package/dist/unstable/cluster/K8sHttpClient.d.ts.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.js +6 -6
- package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +21 -15
- package/dist/unstable/cluster/Message.d.ts.map +1 -1
- package/dist/unstable/cluster/Message.js +16 -8
- package/dist/unstable/cluster/Message.js.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts +46 -23
- package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/MessageStorage.js +42 -26
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts +10 -9
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +8 -7
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/Runner.d.ts +2 -2
- package/dist/unstable/cluster/Runner.d.ts.map +1 -1
- package/dist/unstable/cluster/Runner.js +1 -1
- package/dist/unstable/cluster/Runner.js.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.d.ts +1 -1
- package/dist/unstable/cluster/RunnerAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.js +1 -1
- package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.d.ts +2 -2
- package/dist/unstable/cluster/RunnerHealth.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.js +2 -2
- package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.js +10 -9
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.d.ts +12 -12
- package/dist/unstable/cluster/RunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.js +3 -3
- package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +5 -4
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +18 -16
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/ShardId.d.ts +35 -49
- package/dist/unstable/cluster/ShardId.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardId.js +65 -67
- package/dist/unstable/cluster/ShardId.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts +4 -4
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +66 -54
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +28 -27
- package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.js +27 -27
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/SingletonAddress.d.ts +2 -2
- package/dist/unstable/cluster/Snowflake.d.ts +2 -2
- package/dist/unstable/cluster/Snowflake.d.ts.map +1 -1
- package/dist/unstable/cluster/Snowflake.js +2 -2
- package/dist/unstable/cluster/Snowflake.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +23 -20
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +34 -27
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/cluster/internal/entityReaper.js +4 -3
- package/dist/unstable/cluster/internal/entityReaper.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceMap.js +3 -3
- package/dist/unstable/cluster/internal/resourceMap.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceRef.js +2 -1
- package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.d.ts +2 -2
- package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.js +9 -8
- package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.d.ts +40 -40
- package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.js +9 -2
- package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
- package/dist/unstable/encoding/Msgpack.d.ts +1 -1
- package/dist/unstable/encoding/Ndjson.d.ts +9 -9
- package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
- package/dist/unstable/encoding/Ndjson.js.map +1 -1
- package/dist/unstable/encoding/Sse.d.ts +4 -4
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.js +1 -1
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/eventlog/Event.d.ts +0 -6
- package/dist/unstable/eventlog/Event.d.ts.map +1 -1
- package/dist/unstable/eventlog/Event.js +0 -5
- package/dist/unstable/eventlog/Event.js.map +1 -1
- package/dist/unstable/eventlog/EventGroup.d.ts +0 -2
- package/dist/unstable/eventlog/EventGroup.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventGroup.js +0 -2
- package/dist/unstable/eventlog/EventGroup.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +28 -11
- package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventJournal.js +130 -71
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts +94 -37
- package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLog.js +225 -150
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.d.ts +11 -9
- package/dist/unstable/eventlog/EventLogEncryption.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js +15 -17
- package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +228 -0
- package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -0
- package/dist/unstable/eventlog/EventLogMessage.js +214 -0
- package/dist/unstable/eventlog/EventLogMessage.js.map +1 -0
- package/dist/unstable/eventlog/EventLogRemote.d.ts +112 -194
- package/dist/unstable/eventlog/EventLogRemote.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.js +168 -322
- package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.d.ts +26 -48
- package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.js +128 -199
- package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +60 -0
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -0
- package/dist/unstable/eventlog/EventLogServerEncrypted.js +166 -0
- package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -0
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +183 -0
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -0
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js +461 -0
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -0
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +117 -0
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts.map +1 -0
- package/dist/unstable/eventlog/EventLogSessionAuth.js +284 -0
- package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -0
- package/dist/unstable/eventlog/{SqlEventLogJournal.d.ts → SqlEventJournal.d.ts} +2 -2
- package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -0
- package/dist/unstable/eventlog/{SqlEventLogJournal.js → SqlEventJournal.js} +22 -16
- package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -0
- package/dist/unstable/eventlog/{SqlEventLogServer.d.ts → SqlEventLogServerEncrypted.d.ts} +5 -5
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts.map +1 -0
- package/dist/unstable/eventlog/{SqlEventLogServer.js → SqlEventLogServerEncrypted.js} +65 -24
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -0
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts +25 -0
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -0
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +354 -0
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -0
- package/dist/unstable/eventlog/index.d.ts +22 -2
- package/dist/unstable/eventlog/index.d.ts.map +1 -1
- package/dist/unstable/eventlog/index.js +22 -2
- package/dist/unstable/eventlog/index.js.map +1 -1
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.d.ts +2 -0
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.d.ts.map +1 -0
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.js +89 -0
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.js.map +1 -0
- package/dist/unstable/http/Cookies.d.ts +52 -7
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +27 -6
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Etag.d.ts +2 -2
- package/dist/unstable/http/Etag.d.ts.map +1 -1
- package/dist/unstable/http/Etag.js +7 -3
- package/dist/unstable/http/Etag.js.map +1 -1
- package/dist/unstable/http/FetchHttpClient.d.ts +6 -3
- package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
- package/dist/unstable/http/FetchHttpClient.js +5 -5
- package/dist/unstable/http/FetchHttpClient.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts +24 -4
- package/dist/unstable/http/Headers.d.ts.map +1 -1
- package/dist/unstable/http/Headers.js +42 -13
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpBody.d.ts +1 -1
- package/dist/unstable/http/HttpClient.d.ts +125 -21
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +197 -19
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientError.d.ts +8 -8
- package/dist/unstable/http/HttpClientRequest.d.ts +43 -15
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +131 -21
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts +2 -1
- package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientResponse.js +6 -1
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts +13 -11
- package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
- package/dist/unstable/http/HttpEffect.js +67 -75
- package/dist/unstable/http/HttpEffect.js.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.d.ts +5 -4
- package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js +2 -2
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpMethod.d.ts +4 -4
- package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
- package/dist/unstable/http/HttpMethod.js +3 -3
- package/dist/unstable/http/HttpMethod.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts +4 -9
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +47 -43
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/http/HttpPlatform.d.ts +2 -2
- package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
- package/dist/unstable/http/HttpPlatform.js +5 -4
- package/dist/unstable/http/HttpPlatform.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +9 -8
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js +36 -36
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServer.d.ts +2 -2
- package/dist/unstable/http/HttpServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpServer.js +4 -4
- package/dist/unstable/http/HttpServer.js.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +22 -34
- package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerError.js +39 -45
- package/dist/unstable/http/HttpServerError.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts +19 -7
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +307 -13
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.d.ts +2 -2
- package/dist/unstable/http/HttpServerRespondable.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.js +5 -5
- package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +52 -5
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +240 -5
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpStaticServer.d.ts +69 -0
- package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -0
- package/dist/unstable/http/HttpStaticServer.js +353 -0
- package/dist/unstable/http/HttpStaticServer.js.map +1 -0
- package/dist/unstable/http/HttpTraceContext.d.ts +3 -2
- package/dist/unstable/http/HttpTraceContext.d.ts.map +1 -1
- package/dist/unstable/http/HttpTraceContext.js +27 -15
- package/dist/unstable/http/HttpTraceContext.js.map +1 -1
- package/dist/unstable/http/Multipart.d.ts +9 -9
- package/dist/unstable/http/Multipart.d.ts.map +1 -1
- package/dist/unstable/http/Multipart.js +7 -7
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/Url.d.ts +604 -0
- package/dist/unstable/http/Url.d.ts.map +1 -0
- package/dist/unstable/http/Url.js +256 -0
- package/dist/unstable/http/Url.js.map +1 -0
- package/dist/unstable/http/UrlParams.d.ts +19 -10
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +6 -7
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/http/index.d.ts +8 -0
- package/dist/unstable/http/index.d.ts.map +1 -1
- package/dist/unstable/http/index.js +8 -0
- package/dist/unstable/http/index.js.map +1 -1
- package/dist/unstable/http/internal/preResponseHandler.d.ts +2 -0
- package/dist/unstable/http/internal/preResponseHandler.d.ts.map +1 -0
- package/dist/unstable/http/internal/preResponseHandler.js +10 -0
- package/dist/unstable/http/internal/preResponseHandler.js.map +1 -0
- package/dist/unstable/httpapi/HttpApi.d.ts +11 -11
- package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js +8 -8
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +12 -9
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +53 -39
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +83 -7
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +79 -11
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +211 -105
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.js +53 -47
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +43 -26
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.js +125 -32
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.d.ts +9 -8
- package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.js +4 -4
- package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +49 -18
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js +38 -8
- package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts +6 -0
- package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +88 -9
- package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.js +86 -11
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts +9 -6
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.js +6 -6
- package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts +16 -15
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +57 -49
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/observability/Otlp.d.ts +12 -12
- package/dist/unstable/observability/Otlp.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts +2 -2
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +8 -8
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.d.ts +4 -4
- package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpLogger.js +7 -4
- package/dist/unstable/observability/OtlpLogger.js.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts +4 -4
- package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.js +1 -1
- package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.d.ts +2 -2
- package/dist/unstable/observability/OtlpSerialization.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.js +2 -2
- package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
- package/dist/unstable/observability/OtlpTracer.d.ts +4 -4
- package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js +7 -3
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.d.ts +3 -3
- package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.js +4 -33
- package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts +24 -3
- package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.js +148 -6
- package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
- package/dist/unstable/persistence/Persistable.d.ts +2 -2
- package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistable.js +1 -1
- package/dist/unstable/persistence/Persistable.js.map +1 -1
- package/dist/unstable/persistence/PersistedCache.d.ts +6 -6
- package/dist/unstable/persistence/PersistedCache.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedCache.js +12 -12
- package/dist/unstable/persistence/PersistedCache.js.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts +16 -16
- package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.js +15 -14
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/persistence/Persistence.d.ts +5 -5
- package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistence.js +5 -5
- package/dist/unstable/persistence/Persistence.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +9 -9
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +4 -4
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/persistence/Redis.d.ts +3 -3
- package/dist/unstable/persistence/Redis.d.ts.map +1 -1
- package/dist/unstable/persistence/Redis.js +2 -2
- package/dist/unstable/persistence/Redis.js.map +1 -1
- package/dist/unstable/process/ChildProcess.d.ts +5 -128
- package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcess.js +1 -65
- package/dist/unstable/process/ChildProcess.js.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.d.ts +89 -8
- package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js +22 -2
- package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +108 -47
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +105 -25
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +22 -20
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.js +58 -26
- package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.d.ts +8 -2
- package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +57 -14
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts +12 -12
- package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.js +59 -31
- package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
- package/dist/unstable/reactivity/Reactivity.d.ts +2 -2
- package/dist/unstable/reactivity/Reactivity.d.ts.map +1 -1
- package/dist/unstable/reactivity/Reactivity.js +6 -6
- package/dist/unstable/reactivity/Reactivity.js.map +1 -1
- package/dist/unstable/reactivity/index.d.ts +2 -2
- package/dist/unstable/reactivity/index.d.ts.map +1 -1
- package/dist/unstable/reactivity/index.js +2 -2
- package/dist/unstable/reactivity/index.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +47 -19
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js +39 -7
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts +26 -47
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +120 -77
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcClientError.d.ts +2 -2
- package/dist/unstable/rpc/RpcGroup.d.ts +15 -11
- package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcGroup.js +30 -20
- package/dist/unstable/rpc/RpcGroup.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts +12 -12
- package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js +5 -5
- package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts +14 -1
- package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSchema.js +17 -2
- package/dist/unstable/rpc/RpcSchema.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts +2 -2
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +46 -18
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +8 -12
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +78 -46
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/rpc/RpcWorker.d.ts +2 -2
- package/dist/unstable/rpc/RpcWorker.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcWorker.js +4 -4
- package/dist/unstable/rpc/RpcWorker.js.map +1 -1
- package/dist/unstable/rpc/Utils.d.ts +6 -3
- package/dist/unstable/rpc/Utils.d.ts.map +1 -1
- package/dist/unstable/rpc/Utils.js +48 -6
- package/dist/unstable/rpc/Utils.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts +24 -3
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js +17 -4
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +7 -7
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.js +7 -18
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +16 -15
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +22 -19
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/socket/SocketServer.d.ts +8 -5
- package/dist/unstable/socket/SocketServer.d.ts.map +1 -1
- package/dist/unstable/socket/SocketServer.js +2 -2
- package/dist/unstable/socket/SocketServer.js.map +1 -1
- package/dist/unstable/sql/Migrator.d.ts +1 -1
- package/dist/unstable/sql/Migrator.d.ts.map +1 -1
- package/dist/unstable/sql/Migrator.js +2 -2
- package/dist/unstable/sql/Migrator.js.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts +5 -5
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +7 -7
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/sql/SqlConnection.d.ts +2 -2
- package/dist/unstable/sql/SqlConnection.d.ts.map +1 -1
- package/dist/unstable/sql/SqlConnection.js +5 -2
- package/dist/unstable/sql/SqlConnection.js.map +1 -1
- package/dist/unstable/sql/SqlError.d.ts +237 -17
- package/dist/unstable/sql/SqlError.d.ts.map +1 -1
- package/dist/unstable/sql/SqlError.js +260 -4
- package/dist/unstable/sql/SqlError.js.map +1 -1
- package/dist/unstable/sql/SqlModel.d.ts +8 -9
- package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
- package/dist/unstable/sql/SqlModel.js +12 -38
- package/dist/unstable/sql/SqlModel.js.map +1 -1
- package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
- package/dist/unstable/sql/SqlResolver.js +26 -17
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/sql/SqlSchema.d.ts +17 -6
- package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
- package/dist/unstable/sql/SqlSchema.js +17 -7
- package/dist/unstable/sql/SqlSchema.js.map +1 -1
- package/dist/unstable/sql/Statement.d.ts +2 -2
- package/dist/unstable/sql/Statement.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.js +2 -3
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/workers/Transferable.d.ts +4 -4
- package/dist/unstable/workers/Transferable.d.ts.map +1 -1
- package/dist/unstable/workers/Transferable.js +7 -7
- package/dist/unstable/workers/Transferable.js.map +1 -1
- package/dist/unstable/workers/Worker.d.ts +3 -3
- package/dist/unstable/workers/Worker.d.ts.map +1 -1
- package/dist/unstable/workers/Worker.js +8 -4
- package/dist/unstable/workers/Worker.js.map +1 -1
- package/dist/unstable/workers/WorkerError.d.ts +5 -5
- package/dist/unstable/workers/WorkerRunner.d.ts +2 -2
- package/dist/unstable/workers/WorkerRunner.d.ts.map +1 -1
- package/dist/unstable/workers/WorkerRunner.js +5 -2
- package/dist/unstable/workers/WorkerRunner.js.map +1 -1
- package/dist/unstable/workflow/Activity.d.ts +7 -2
- package/dist/unstable/workflow/Activity.d.ts.map +1 -1
- package/dist/unstable/workflow/Activity.js +17 -4
- package/dist/unstable/workflow/Activity.js.map +1 -1
- package/dist/unstable/workflow/DurableClock.d.ts +3 -6
- package/dist/unstable/workflow/DurableClock.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableClock.js +6 -6
- package/dist/unstable/workflow/DurableClock.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.d.ts +1 -1
- package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.js +15 -15
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +13 -12
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js +18 -18
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +26 -8
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +167 -17
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.js +4 -4
- package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
- package/package.json +11 -11
- package/src/Array.ts +304 -447
- package/src/BigDecimal.ts +117 -66
- package/src/BigInt.ts +49 -41
- package/src/Brand.ts +1 -1
- package/src/Cache.ts +27 -54
- package/src/Cause.ts +58 -23
- package/src/Channel.ts +693 -224
- package/src/Chunk.ts +149 -331
- package/src/Clock.ts +2 -2
- package/src/Combiner.ts +280 -13
- package/src/Config.ts +197 -27
- package/src/ConfigProvider.ts +5 -5
- package/src/Console.ts +2 -2
- package/src/Context.ts +1454 -0
- package/src/Cron.ts +155 -63
- package/src/Data.ts +539 -376
- package/src/DateTime.ts +77 -258
- package/src/Deferred.ts +15 -6
- package/src/Duration.ts +122 -66
- package/src/Effect.ts +1629 -1355
- package/src/Encoding.ts +879 -0
- package/src/Equal.ts +295 -111
- package/src/Equivalence.ts +114 -52
- package/src/ErrorReporter.ts +458 -0
- package/src/ExecutionPlan.ts +8 -9
- package/src/Exit.ts +24 -12
- package/src/Fiber.ts +17 -8
- package/src/FiberHandle.ts +15 -14
- package/src/FiberMap.ts +27 -27
- package/src/FiberSet.ts +5 -5
- package/src/FileSystem.ts +34 -30
- package/src/Filter.ts +4 -62
- package/src/Formatter.ts +253 -51
- package/src/Function.ts +2 -10
- package/src/Graph.ts +131 -117
- package/src/Hash.ts +2 -2
- package/src/HashMap.ts +26 -19
- package/src/Iterable.ts +117 -63
- package/src/JsonSchema.ts +383 -10
- package/src/Latch.ts +194 -0
- package/src/Layer.ts +728 -441
- package/src/LayerMap.ts +38 -35
- package/src/LogLevel.ts +37 -0
- package/src/Logger.ts +35 -102
- package/src/ManagedRuntime.ts +61 -48
- package/src/Metric.ts +64 -66
- package/src/MutableHashMap.ts +9 -0
- package/src/MutableHashSet.ts +9 -0
- package/src/MutableList.ts +3 -0
- package/src/Newtype.ts +308 -0
- package/src/Number.ts +98 -29
- package/src/Optic.ts +948 -19
- package/src/Option.ts +34 -24
- package/src/Order.ts +39 -32
- package/src/PartitionedSemaphore.ts +288 -56
- package/src/Path.ts +2 -2
- package/src/Pipeable.ts +32 -1
- package/src/Pool.ts +18 -16
- package/src/PubSub.ts +30 -20
- package/src/Pull.ts +1 -1
- package/src/Queue.ts +11 -9
- package/src/Random.ts +51 -14
- package/src/RcMap.ts +19 -19
- package/src/RcRef.ts +1 -1
- package/src/Record.ts +94 -199
- package/src/Redactable.ts +146 -72
- package/src/Reducer.ts +166 -7
- package/src/References.ts +283 -287
- package/src/Request.ts +8 -7
- package/src/RequestResolver.ts +34 -55
- package/src/Resource.ts +6 -5
- package/src/Result.ts +2 -4
- package/src/Runtime.ts +102 -6
- package/src/Schedule.ts +460 -451
- package/src/Scheduler.ts +52 -129
- package/src/Schema.ts +4102 -663
- package/src/SchemaAST.ts +177 -47
- package/src/SchemaGetter.ts +88 -32
- package/src/SchemaParser.ts +92 -27
- package/src/SchemaRepresentation.ts +59 -32
- package/src/SchemaTransformation.ts +364 -13
- package/src/Scope.ts +2 -2
- package/src/ScopedCache.ts +8 -8
- package/src/Semaphore.ts +442 -0
- package/src/Sink.ts +89 -34
- package/src/Stdio.ts +29 -6
- package/src/Stream.ts +898 -752
- package/src/String.ts +122 -69
- package/src/Struct.ts +33 -7
- package/src/SubscriptionRef.ts +101 -120
- package/src/SynchronizedRef.ts +3 -2
- package/src/Terminal.ts +5 -4
- package/src/Tracer.ts +23 -22
- package/src/Trie.ts +44 -31
- package/src/TxChunk.ts +26 -16
- package/src/TxDeferred.ts +391 -0
- package/src/TxHashMap.ts +347 -291
- package/src/TxHashSet.ts +54 -61
- package/src/TxPriorityQueue.ts +762 -0
- package/src/TxPubSub.ts +787 -0
- package/src/TxQueue.ts +221 -245
- package/src/TxReentrantLock.ts +729 -0
- package/src/TxRef.ts +31 -31
- package/src/TxSemaphore.ts +203 -31
- package/src/TxSubscriptionRef.ts +637 -0
- package/src/Types.ts +78 -17
- package/src/Unify.ts +26 -2
- package/src/Utils.ts +137 -111
- package/src/index.ts +898 -72
- package/src/internal/core.ts +19 -12
- package/src/internal/dateTime.ts +91 -96
- package/src/internal/effect.ts +918 -506
- package/src/internal/hashMap.ts +12 -10
- package/src/internal/layer.ts +7 -7
- package/src/internal/option.ts +7 -0
- package/src/internal/random.ts +20 -0
- package/src/internal/rcRef.ts +14 -13
- package/src/internal/references.ts +72 -0
- package/src/internal/request.ts +8 -8
- package/src/internal/schedule.ts +3 -1
- package/src/internal/schema/annotations.ts +2 -0
- package/src/internal/schema/representation.ts +81 -95
- package/src/internal/schema/schema.ts +25 -1
- package/src/internal/schema/to-codec.ts +7 -17
- package/src/internal/trie.ts +21 -15
- package/src/testing/TestClock.ts +13 -11
- package/src/testing/TestSchema.ts +333 -36
- package/src/testing/index.ts +64 -1
- package/src/unstable/ai/AiError.ts +112 -54
- package/src/unstable/ai/AnthropicStructuredOutput.ts +7 -3
- package/src/unstable/ai/Chat.ts +137 -88
- package/src/unstable/ai/EmbeddingModel.ts +209 -0
- package/src/unstable/ai/IdGenerator.ts +2 -2
- package/src/unstable/ai/LanguageModel.ts +685 -255
- package/src/unstable/ai/McpSchema.ts +84 -22
- package/src/unstable/ai/McpServer.ts +299 -87
- package/src/unstable/ai/Model.ts +44 -13
- package/src/unstable/ai/OpenAiStructuredOutput.ts +9 -2
- package/src/unstable/ai/Prompt.ts +43 -49
- package/src/unstable/ai/Response.ts +31 -33
- package/src/unstable/ai/ResponseIdTracker.ts +95 -0
- package/src/unstable/ai/Telemetry.ts +2 -2
- package/src/unstable/ai/Tokenizer.ts +2 -2
- package/src/unstable/ai/Tool.ts +62 -36
- package/src/unstable/ai/Toolkit.ts +17 -26
- package/src/unstable/ai/index.ts +24 -1
- package/src/unstable/ai/internal/codec-transformer.ts +3 -9
- package/src/unstable/cli/Argument.ts +5 -8
- package/src/unstable/cli/CliError.ts +67 -66
- package/src/unstable/cli/CliOutput.ts +87 -15
- package/src/unstable/cli/Command.ts +808 -193
- package/src/unstable/cli/Completions.ts +107 -0
- package/src/unstable/cli/Flag.ts +5 -6
- package/src/unstable/cli/GlobalFlag.ts +242 -0
- package/src/unstable/cli/HelpDoc.ts +91 -11
- package/src/unstable/cli/Param.ts +54 -27
- package/src/unstable/cli/Primitive.ts +2 -2
- package/src/unstable/cli/Prompt.ts +275 -104
- package/src/unstable/cli/index.ts +10 -0
- package/src/unstable/cli/internal/command.ts +125 -64
- package/src/unstable/cli/internal/completions/bash.ts +7 -7
- package/src/unstable/cli/internal/completions/{CommandDescriptor.ts → descriptor.ts} +16 -58
- package/src/unstable/cli/internal/completions/fish.ts +7 -7
- package/src/unstable/cli/internal/completions/zsh.ts +8 -14
- package/src/unstable/cli/internal/config.ts +49 -0
- package/src/unstable/cli/internal/help.ts +171 -0
- package/src/unstable/cli/internal/parser.ts +201 -84
- package/src/unstable/cluster/ClusterCron.ts +2 -2
- package/src/unstable/cluster/ClusterSchema.ts +38 -10
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +144 -81
- package/src/unstable/cluster/DeliverAt.ts +1 -1
- package/src/unstable/cluster/Entity.ts +59 -45
- package/src/unstable/cluster/EntityAddress.ts +1 -1
- package/src/unstable/cluster/EntityProxy.ts +3 -3
- package/src/unstable/cluster/EntityProxyServer.ts +4 -4
- package/src/unstable/cluster/EntityResource.ts +6 -6
- package/src/unstable/cluster/Envelope.ts +1 -1
- package/src/unstable/cluster/HttpRunner.ts +2 -2
- package/src/unstable/cluster/K8sHttpClient.ts +7 -7
- package/src/unstable/cluster/Message.ts +30 -17
- package/src/unstable/cluster/MessageStorage.ts +76 -46
- package/src/unstable/cluster/Reply.ts +13 -10
- package/src/unstable/cluster/Runner.ts +1 -1
- package/src/unstable/cluster/RunnerAddress.ts +1 -1
- package/src/unstable/cluster/RunnerHealth.ts +2 -2
- package/src/unstable/cluster/RunnerServer.ts +11 -14
- package/src/unstable/cluster/RunnerStorage.ts +9 -9
- package/src/unstable/cluster/Runners.ts +21 -19
- package/src/unstable/cluster/ShardId.ts +84 -74
- package/src/unstable/cluster/Sharding.ts +83 -66
- package/src/unstable/cluster/ShardingConfig.ts +39 -40
- package/src/unstable/cluster/Snowflake.ts +2 -2
- package/src/unstable/cluster/SqlMessageStorage.ts +28 -20
- package/src/unstable/cluster/SqlRunnerStorage.ts +1 -1
- package/src/unstable/cluster/internal/entityManager.ts +66 -46
- package/src/unstable/cluster/internal/entityReaper.ts +4 -3
- package/src/unstable/cluster/internal/resourceMap.ts +3 -3
- package/src/unstable/cluster/internal/resourceRef.ts +2 -1
- package/src/unstable/devtools/DevToolsClient.ts +26 -21
- package/src/unstable/devtools/DevToolsSchema.ts +16 -3
- package/src/unstable/encoding/Ndjson.ts +17 -17
- package/src/unstable/encoding/Sse.ts +3 -5
- package/src/unstable/eventlog/Event.ts +0 -8
- package/src/unstable/eventlog/EventGroup.ts +0 -4
- package/src/unstable/eventlog/EventJournal.ts +148 -80
- package/src/unstable/eventlog/EventLog.ts +360 -233
- package/src/unstable/eventlog/EventLogEncryption.ts +18 -32
- package/src/unstable/eventlog/EventLogMessage.ts +277 -0
- package/src/unstable/eventlog/EventLogRemote.ts +264 -410
- package/src/unstable/eventlog/EventLogServer.ts +183 -275
- package/src/unstable/eventlog/EventLogServerEncrypted.ts +206 -0
- package/src/unstable/eventlog/EventLogServerUnencrypted.ts +749 -0
- package/src/unstable/eventlog/EventLogSessionAuth.ts +437 -0
- package/src/unstable/eventlog/{SqlEventLogJournal.ts → SqlEventJournal.ts} +28 -20
- package/src/unstable/eventlog/{SqlEventLogServer.ts → SqlEventLogServerEncrypted.ts} +102 -40
- package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +500 -0
- package/src/unstable/eventlog/index.ts +27 -2
- package/src/unstable/eventlog/internal/identityRootSecretDerivation.ts +153 -0
- package/src/unstable/http/Cookies.ts +94 -11
- package/src/unstable/http/Etag.ts +7 -5
- package/src/unstable/http/FetchHttpClient.ts +5 -5
- package/src/unstable/http/Headers.ts +70 -20
- package/src/unstable/http/HttpClient.ts +385 -42
- package/src/unstable/http/HttpClientRequest.ts +151 -39
- package/src/unstable/http/HttpClientResponse.ts +12 -6
- package/src/unstable/http/HttpEffect.ts +86 -100
- package/src/unstable/http/HttpIncomingMessage.ts +5 -4
- package/src/unstable/http/HttpMethod.ts +16 -4
- package/src/unstable/http/HttpMiddleware.ts +50 -50
- package/src/unstable/http/HttpPlatform.ts +5 -4
- package/src/unstable/http/HttpRouter.ts +46 -46
- package/src/unstable/http/HttpServer.ts +5 -11
- package/src/unstable/http/HttpServerError.ts +45 -47
- package/src/unstable/http/HttpServerRequest.ts +414 -23
- package/src/unstable/http/HttpServerRespondable.ts +6 -6
- package/src/unstable/http/HttpServerResponse.ts +351 -13
- package/src/unstable/http/HttpStaticServer.ts +456 -0
- package/src/unstable/http/HttpTraceContext.ts +31 -17
- package/src/unstable/http/Multipart.ts +10 -10
- package/src/unstable/http/Url.ts +650 -0
- package/src/unstable/http/UrlParams.ts +31 -19
- package/src/unstable/http/index.ts +10 -0
- package/src/unstable/http/internal/preResponseHandler.ts +15 -0
- package/src/unstable/httpapi/HttpApi.ts +21 -21
- package/src/unstable/httpapi/HttpApiBuilder.ts +128 -55
- package/src/unstable/httpapi/HttpApiClient.ts +186 -34
- package/src/unstable/httpapi/HttpApiEndpoint.ts +225 -113
- package/src/unstable/httpapi/HttpApiError.ts +108 -30
- package/src/unstable/httpapi/HttpApiGroup.ts +18 -17
- package/src/unstable/httpapi/HttpApiMiddleware.ts +95 -33
- package/src/unstable/httpapi/HttpApiScalar.ts +6 -0
- package/src/unstable/httpapi/HttpApiSchema.ts +106 -11
- package/src/unstable/httpapi/HttpApiSecurity.ts +13 -13
- package/src/unstable/httpapi/OpenApi.ts +71 -58
- package/src/unstable/observability/Otlp.ts +12 -12
- package/src/unstable/observability/OtlpExporter.ts +14 -10
- package/src/unstable/observability/OtlpLogger.ts +13 -9
- package/src/unstable/observability/OtlpMetrics.ts +5 -5
- package/src/unstable/observability/OtlpSerialization.ts +2 -2
- package/src/unstable/observability/OtlpTracer.ts +14 -10
- package/src/unstable/observability/PrometheusMetrics.ts +5 -5
- package/src/unstable/persistence/KeyValueStore.ts +230 -7
- package/src/unstable/persistence/Persistable.ts +3 -3
- package/src/unstable/persistence/PersistedCache.ts +35 -21
- package/src/unstable/persistence/PersistedQueue.ts +28 -27
- package/src/unstable/persistence/Persistence.ts +7 -7
- package/src/unstable/persistence/RateLimiter.ts +7 -7
- package/src/unstable/persistence/Redis.ts +2 -2
- package/src/unstable/process/ChildProcess.ts +6 -208
- package/src/unstable/process/ChildProcessSpawner.ts +120 -15
- package/src/unstable/reactivity/Atom.ts +280 -124
- package/src/unstable/reactivity/AtomHttpApi.ts +115 -59
- package/src/unstable/reactivity/AtomRegistry.ts +70 -16
- package/src/unstable/reactivity/AtomRpc.ts +82 -37
- package/src/unstable/reactivity/Reactivity.ts +6 -6
- package/src/unstable/reactivity/index.ts +2 -2
- package/src/unstable/rpc/Rpc.ts +77 -32
- package/src/unstable/rpc/RpcClient.ts +165 -145
- package/src/unstable/rpc/RpcGroup.ts +51 -34
- package/src/unstable/rpc/RpcMiddleware.ts +28 -22
- package/src/unstable/rpc/RpcSchema.ts +24 -6
- package/src/unstable/rpc/RpcSerialization.ts +56 -18
- package/src/unstable/rpc/RpcServer.ts +97 -69
- package/src/unstable/rpc/RpcWorker.ts +5 -5
- package/src/unstable/rpc/Utils.ts +65 -5
- package/src/unstable/schema/Model.ts +35 -6
- package/src/unstable/schema/VariantSchema.ts +14 -27
- package/src/unstable/socket/Socket.ts +42 -38
- package/src/unstable/socket/SocketServer.ts +2 -2
- package/src/unstable/sql/Migrator.ts +7 -5
- package/src/unstable/sql/SqlClient.ts +13 -11
- package/src/unstable/sql/SqlConnection.ts +2 -2
- package/src/unstable/sql/SqlError.ts +365 -11
- package/src/unstable/sql/SqlModel.ts +57 -85
- package/src/unstable/sql/SqlResolver.ts +26 -16
- package/src/unstable/sql/SqlSchema.ts +42 -26
- package/src/unstable/sql/Statement.ts +2 -3
- package/src/unstable/workers/Transferable.ts +17 -19
- package/src/unstable/workers/Worker.ts +6 -5
- package/src/unstable/workers/WorkerRunner.ts +2 -2
- package/src/unstable/workflow/Activity.ts +27 -4
- package/src/unstable/workflow/DurableClock.ts +11 -11
- package/src/unstable/workflow/DurableDeferred.ts +16 -16
- package/src/unstable/workflow/Workflow.ts +32 -25
- package/src/unstable/workflow/WorkflowEngine.ts +239 -25
- package/src/unstable/workflow/WorkflowProxyServer.ts +4 -4
- package/dist/NullOr.d.ts +0 -149
- package/dist/NullOr.d.ts.map +0 -1
- package/dist/NullOr.js +0 -152
- package/dist/NullOr.js.map +0 -1
- package/dist/ServiceMap.d.ts +0 -1126
- package/dist/ServiceMap.d.ts.map +0 -1
- package/dist/ServiceMap.js.map +0 -1
- package/dist/encoding/Base64.d.ts +0 -67
- package/dist/encoding/Base64.d.ts.map +0 -1
- package/dist/encoding/Base64.js +0 -146
- package/dist/encoding/Base64.js.map +0 -1
- package/dist/encoding/Base64Url.d.ts +0 -60
- package/dist/encoding/Base64Url.d.ts.map +0 -1
- package/dist/encoding/Base64Url.js +0 -89
- package/dist/encoding/Base64Url.js.map +0 -1
- package/dist/encoding/EncodingError.d.ts +0 -31
- package/dist/encoding/EncodingError.d.ts.map +0 -1
- package/dist/encoding/EncodingError.js +0 -22
- package/dist/encoding/EncodingError.js.map +0 -1
- package/dist/encoding/Hex.d.ts +0 -61
- package/dist/encoding/Hex.d.ts.map +0 -1
- package/dist/encoding/Hex.js +0 -115
- package/dist/encoding/Hex.js.map +0 -1
- package/dist/encoding/index.d.ts +0 -26
- package/dist/encoding/index.d.ts.map +0 -1
- package/dist/encoding/index.js +0 -27
- package/dist/encoding/index.js.map +0 -1
- package/dist/unstable/cli/internal/builtInFlags.d.ts +0 -7
- package/dist/unstable/cli/internal/builtInFlags.d.ts.map +0 -1
- package/dist/unstable/cli/internal/builtInFlags.js +0 -44
- package/dist/unstable/cli/internal/builtInFlags.js.map +0 -1
- package/dist/unstable/cli/internal/completions/CommandDescriptor.d.ts +0 -2
- package/dist/unstable/cli/internal/completions/CommandDescriptor.d.ts.map +0 -1
- package/dist/unstable/cli/internal/completions/CommandDescriptor.js.map +0 -1
- package/dist/unstable/cli/internal/completions/Completions.d.ts +0 -2
- package/dist/unstable/cli/internal/completions/Completions.d.ts.map +0 -1
- package/dist/unstable/cli/internal/completions/Completions.js +0 -23
- package/dist/unstable/cli/internal/completions/Completions.js.map +0 -1
- package/dist/unstable/eventlog/SqlEventLogJournal.d.ts.map +0 -1
- package/dist/unstable/eventlog/SqlEventLogJournal.js.map +0 -1
- package/dist/unstable/eventlog/SqlEventLogServer.d.ts.map +0 -1
- package/dist/unstable/eventlog/SqlEventLogServer.js.map +0 -1
- package/src/NullOr.ts +0 -204
- package/src/ServiceMap.ts +0 -1410
- package/src/encoding/Base64.ts +0 -366
- package/src/encoding/Base64Url.ts +0 -104
- package/src/encoding/EncodingError.ts +0 -35
- package/src/encoding/Hex.ts +0 -390
- package/src/encoding/index.ts +0 -31
- package/src/unstable/cli/internal/builtInFlags.ts +0 -78
- package/src/unstable/cli/internal/completions/Completions.ts +0 -31
package/src/Stream.ts
CHANGED
|
@@ -6,13 +6,14 @@ import * as Arr from "./Array.ts"
|
|
|
6
6
|
import * as Cause from "./Cause.ts"
|
|
7
7
|
import * as Channel from "./Channel.ts"
|
|
8
8
|
import { Clock } from "./Clock.ts"
|
|
9
|
+
import * as Context from "./Context.ts"
|
|
9
10
|
import * as Duration from "./Duration.ts"
|
|
10
11
|
import * as Effect from "./Effect.ts"
|
|
11
12
|
import * as Equal from "./Equal.ts"
|
|
12
13
|
import * as ExecutionPlan from "./ExecutionPlan.ts"
|
|
13
14
|
import * as Exit from "./Exit.ts"
|
|
14
15
|
import * as Fiber from "./Fiber.ts"
|
|
15
|
-
import * as Filter from "./Filter.ts"
|
|
16
|
+
import type * as Filter from "./Filter.ts"
|
|
16
17
|
import type { LazyArg } from "./Function.ts"
|
|
17
18
|
import { constant, constTrue, constVoid, dual, identity } from "./Function.ts"
|
|
18
19
|
import type { TypeLambda } from "./HKT.ts"
|
|
@@ -20,8 +21,9 @@ import * as internalExecutionPlan from "./internal/executionPlan.ts"
|
|
|
20
21
|
import * as internal from "./internal/stream.ts"
|
|
21
22
|
import { addSpanStackTrace } from "./internal/tracer.ts"
|
|
22
23
|
import * as Iterable from "./Iterable.ts"
|
|
24
|
+
import * as Latch from "./Latch.ts"
|
|
23
25
|
import type * as Layer from "./Layer.ts"
|
|
24
|
-
import type {
|
|
26
|
+
import type { Severity } from "./LogLevel.ts"
|
|
25
27
|
import * as MutableHashMap from "./MutableHashMap.ts"
|
|
26
28
|
import * as MutableList from "./MutableList.ts"
|
|
27
29
|
import * as Option from "./Option.ts"
|
|
@@ -36,7 +38,6 @@ import * as RcRef from "./RcRef.ts"
|
|
|
36
38
|
import * as Result from "./Result.ts"
|
|
37
39
|
import * as Schedule from "./Schedule.ts"
|
|
38
40
|
import * as Scope from "./Scope.ts"
|
|
39
|
-
import * as ServiceMap from "./ServiceMap.ts"
|
|
40
41
|
import * as Sink from "./Sink.ts"
|
|
41
42
|
import { isString } from "./String.ts"
|
|
42
43
|
import type * as Take from "./Take.ts"
|
|
@@ -47,14 +48,26 @@ import type {
|
|
|
47
48
|
ExcludeTag,
|
|
48
49
|
ExtractReason,
|
|
49
50
|
ExtractTag,
|
|
51
|
+
NarrowReason,
|
|
50
52
|
NoInfer,
|
|
53
|
+
OmitReason,
|
|
51
54
|
ReasonTags,
|
|
52
55
|
Tags,
|
|
53
56
|
unassigned
|
|
54
57
|
} from "./Types.ts"
|
|
55
58
|
import type * as Unify from "./Unify.ts"
|
|
56
59
|
|
|
57
|
-
|
|
60
|
+
/**
|
|
61
|
+
* @since 4.0.0
|
|
62
|
+
* @category Type Identifiers
|
|
63
|
+
*/
|
|
64
|
+
export type TypeId = "~effect/Stream"
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @since 4.0.0
|
|
68
|
+
* @category Type Identifiers
|
|
69
|
+
*/
|
|
70
|
+
export const TypeId: TypeId = "~effect/Stream"
|
|
58
71
|
|
|
59
72
|
/**
|
|
60
73
|
* A `Stream<A, E, R>` describes a program that can emit many `A` values, fail
|
|
@@ -129,7 +142,7 @@ export interface StreamUnify<A extends { [Unify.typeSymbol]?: any }> extends Eff
|
|
|
129
142
|
* @category Models
|
|
130
143
|
* @since 2.0.0
|
|
131
144
|
*/
|
|
132
|
-
export interface StreamUnifyIgnore
|
|
145
|
+
export interface StreamUnifyIgnore {
|
|
133
146
|
Effect?: true
|
|
134
147
|
}
|
|
135
148
|
|
|
@@ -341,6 +354,79 @@ export const fromChannel: <Arr extends Arr.NonEmptyReadonlyArray<any>, E, R>(
|
|
|
341
354
|
export const fromEffect = <A, E, R>(effect: Effect.Effect<A, E, R>): Stream<A, E, R> =>
|
|
342
355
|
fromChannel(Channel.fromEffect(Effect.map(effect, Arr.of)))
|
|
343
356
|
|
|
357
|
+
/**
|
|
358
|
+
* Accesses a service from the context and emits it as a single element.
|
|
359
|
+
*
|
|
360
|
+
* @example
|
|
361
|
+
* ```ts
|
|
362
|
+
* import { Effect, Context, Stream } from "effect"
|
|
363
|
+
*
|
|
364
|
+
* class Greeter extends Context.Service<Greeter, {
|
|
365
|
+
* readonly greet: (name: string) => string
|
|
366
|
+
* }>()("Greeter") {}
|
|
367
|
+
*
|
|
368
|
+
* const stream = Stream.service(Greeter).pipe(
|
|
369
|
+
* Stream.map((greeter) => greeter.greet("World"))
|
|
370
|
+
* )
|
|
371
|
+
*
|
|
372
|
+
* const program = Effect.gen(function*() {
|
|
373
|
+
* return yield* stream.pipe(
|
|
374
|
+
* Stream.provideService(Greeter, {
|
|
375
|
+
* greet: (name) => `Hello, ${name}!`
|
|
376
|
+
* }),
|
|
377
|
+
* Stream.runCollect
|
|
378
|
+
* )
|
|
379
|
+
* })
|
|
380
|
+
*
|
|
381
|
+
* Effect.runPromise(program)
|
|
382
|
+
* // Output: [ "Hello, World!" ]
|
|
383
|
+
* ```
|
|
384
|
+
*
|
|
385
|
+
* @since 4.0.0
|
|
386
|
+
* @category Context
|
|
387
|
+
*/
|
|
388
|
+
export const service = <I, S>(service: Context.Key<I, S>): Stream<S, never, I> => fromEffect(Effect.service(service))
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* Optionally accesses a service from the context and emits the result as a
|
|
392
|
+
* single element.
|
|
393
|
+
*
|
|
394
|
+
* @example
|
|
395
|
+
* ```ts
|
|
396
|
+
* import { Effect, Option, Context, Stream } from "effect"
|
|
397
|
+
*
|
|
398
|
+
* class Greeter extends Context.Service<Greeter, {
|
|
399
|
+
* readonly greet: (name: string) => string
|
|
400
|
+
* }>()("Greeter") {}
|
|
401
|
+
*
|
|
402
|
+
* const stream = Stream.serviceOption(Greeter).pipe(
|
|
403
|
+
* Stream.map((maybeGreeter) =>
|
|
404
|
+
* Option.match(maybeGreeter, {
|
|
405
|
+
* onNone: () => "No greeter",
|
|
406
|
+
* onSome: (greeter) => greeter.greet("World")
|
|
407
|
+
* })
|
|
408
|
+
* )
|
|
409
|
+
* )
|
|
410
|
+
*
|
|
411
|
+
* const program = Effect.gen(function*() {
|
|
412
|
+
* return yield* stream.pipe(
|
|
413
|
+
* Stream.provideService(Greeter, {
|
|
414
|
+
* greet: (name) => `Hello, ${name}!`
|
|
415
|
+
* }),
|
|
416
|
+
* Stream.runCollect
|
|
417
|
+
* )
|
|
418
|
+
* })
|
|
419
|
+
*
|
|
420
|
+
* Effect.runPromise(program)
|
|
421
|
+
* // Output: [ "Hello, World!" ]
|
|
422
|
+
* ```
|
|
423
|
+
*
|
|
424
|
+
* @since 4.0.0
|
|
425
|
+
* @category Context
|
|
426
|
+
*/
|
|
427
|
+
export const serviceOption = <I, S>(service: Context.Key<I, S>): Stream<Option.Option<S>> =>
|
|
428
|
+
fromEffect(Effect.serviceOption(service))
|
|
429
|
+
|
|
344
430
|
/**
|
|
345
431
|
* Creates a stream that runs the effect and emits no elements.
|
|
346
432
|
*
|
|
@@ -471,7 +557,7 @@ export const fromEffectSchedule = <A, E, R, X, AS extends A, ES, RS>(
|
|
|
471
557
|
* @since 2.0.0
|
|
472
558
|
* @category Constructors
|
|
473
559
|
*/
|
|
474
|
-
export const tick = (interval: Duration.
|
|
560
|
+
export const tick = (interval: Duration.Input): Stream<void> =>
|
|
475
561
|
fromPull(Effect.sync(() => {
|
|
476
562
|
let first = true
|
|
477
563
|
const effect = Effect.succeed(Arr.of<void>(undefined))
|
|
@@ -960,6 +1046,10 @@ export const fromIteratorSucceed = <A>(iterator: IterableIterator<A>, maxChunkSi
|
|
|
960
1046
|
/**
|
|
961
1047
|
* Creates a new `Stream` from an iterable collection of values.
|
|
962
1048
|
*
|
|
1049
|
+
* **Options**
|
|
1050
|
+
*
|
|
1051
|
+
* - `chunkSize`: Maximum number of values emitted per chunk.
|
|
1052
|
+
*
|
|
963
1053
|
* @example
|
|
964
1054
|
* ```ts
|
|
965
1055
|
* import { Console, Effect, Stream } from "effect"
|
|
@@ -979,19 +1069,24 @@ export const fromIteratorSucceed = <A>(iterator: IterableIterator<A>, maxChunkSi
|
|
|
979
1069
|
* @since 2.0.0
|
|
980
1070
|
* @category Constructors
|
|
981
1071
|
*/
|
|
982
|
-
export const fromIterable = <A>(
|
|
983
|
-
|
|
1072
|
+
export const fromIterable = <A>(
|
|
1073
|
+
iterable: Iterable<A>,
|
|
1074
|
+
options?: {
|
|
1075
|
+
readonly chunkSize?: number | undefined
|
|
1076
|
+
}
|
|
1077
|
+
): Stream<A> =>
|
|
1078
|
+
Array.isArray(iterable) && options?.chunkSize === undefined
|
|
984
1079
|
? fromArray(iterable)
|
|
985
|
-
: fromChannel(Channel.fromIterableArray(iterable))
|
|
1080
|
+
: fromChannel(Channel.fromIterableArray(iterable, options?.chunkSize))
|
|
986
1081
|
|
|
987
1082
|
/**
|
|
988
1083
|
* Creates a stream from an effect producing an iterable of values.
|
|
989
1084
|
*
|
|
990
1085
|
* @example
|
|
991
1086
|
* ```ts
|
|
992
|
-
* import { Console, Effect,
|
|
1087
|
+
* import { Console, Effect, Context, Stream } from "effect"
|
|
993
1088
|
*
|
|
994
|
-
* class UserRepo extends
|
|
1089
|
+
* class UserRepo extends Context.Service<UserRepo, {
|
|
995
1090
|
* readonly list: Effect.Effect<ReadonlyArray<string>>
|
|
996
1091
|
* }>()("UserRepo") {}
|
|
997
1092
|
*
|
|
@@ -1242,7 +1337,9 @@ export const fromPubSubTake = <A, E>(pubsub: PubSub.PubSub<Take.Take<A, E>>): St
|
|
|
1242
1337
|
*
|
|
1243
1338
|
* @example
|
|
1244
1339
|
* ```ts
|
|
1245
|
-
* import { Console, Effect, Stream } from "effect"
|
|
1340
|
+
* import { Console, Data, Effect, Stream } from "effect"
|
|
1341
|
+
*
|
|
1342
|
+
* class StreamError extends Data.TaggedError("StreamError")<{ readonly cause: unknown }> {}
|
|
1246
1343
|
*
|
|
1247
1344
|
* const readableStream = new ReadableStream({
|
|
1248
1345
|
* start(controller) {
|
|
@@ -1256,7 +1353,7 @@ export const fromPubSubTake = <A, E>(pubsub: PubSub.PubSub<Take.Take<A, E>>): St
|
|
|
1256
1353
|
* const program = Effect.gen(function*() {
|
|
1257
1354
|
* const stream = Stream.fromReadableStream({
|
|
1258
1355
|
* evaluate: () => readableStream,
|
|
1259
|
-
* onError: (
|
|
1356
|
+
* onError: (cause) => new StreamError({ cause })
|
|
1260
1357
|
* })
|
|
1261
1358
|
* const values = yield* Stream.runCollect(stream)
|
|
1262
1359
|
* yield* Console.log(values)
|
|
@@ -1298,7 +1395,9 @@ export const fromReadableStream = <A, E>(
|
|
|
1298
1395
|
*
|
|
1299
1396
|
* @example
|
|
1300
1397
|
* ```ts
|
|
1301
|
-
* import { Console, Effect, Stream } from "effect"
|
|
1398
|
+
* import { Console, Data, Effect, Stream } from "effect"
|
|
1399
|
+
*
|
|
1400
|
+
* class StreamError extends Data.TaggedError("StreamError")<{ readonly cause: unknown }> {}
|
|
1302
1401
|
*
|
|
1303
1402
|
* const iterable = (async function*() {
|
|
1304
1403
|
* yield 1
|
|
@@ -1307,7 +1406,7 @@ export const fromReadableStream = <A, E>(
|
|
|
1307
1406
|
* })()
|
|
1308
1407
|
*
|
|
1309
1408
|
* const program = Effect.gen(function*() {
|
|
1310
|
-
* const stream = Stream.fromAsyncIterable(iterable, (
|
|
1409
|
+
* const stream = Stream.fromAsyncIterable(iterable, (cause) => new StreamError({ cause }))
|
|
1311
1410
|
* const values = yield* Stream.runCollect(stream)
|
|
1312
1411
|
* yield* Console.log(values)
|
|
1313
1412
|
* })
|
|
@@ -1334,7 +1433,7 @@ export const fromAsyncIterable = <A, E>(
|
|
|
1334
1433
|
*
|
|
1335
1434
|
* const program = Effect.gen(function*() {
|
|
1336
1435
|
* const schedule = Schedule.spaced("50 millis").pipe(
|
|
1337
|
-
* Schedule.
|
|
1436
|
+
* Schedule.both(Schedule.recurs(2))
|
|
1338
1437
|
* )
|
|
1339
1438
|
* const stream = Stream.fromSchedule(schedule)
|
|
1340
1439
|
* const values = yield* Stream.runCollect(stream)
|
|
@@ -2648,8 +2747,8 @@ export const tapSink: {
|
|
|
2648
2747
|
transformPullBracket(
|
|
2649
2748
|
self,
|
|
2650
2749
|
Effect.fnUntraced(function*(pull, _, scope) {
|
|
2651
|
-
const upstreamLatch =
|
|
2652
|
-
const sinkLatch =
|
|
2750
|
+
const upstreamLatch = Latch.makeUnsafe()
|
|
2751
|
+
const sinkLatch = Latch.makeUnsafe()
|
|
2653
2752
|
let chunk: Arr.NonEmptyReadonlyArray<A> | undefined = undefined
|
|
2654
2753
|
let causeSink: Cause.Cause<E2> | undefined = undefined
|
|
2655
2754
|
let sinkDone = false
|
|
@@ -3316,7 +3415,7 @@ export const timeout: {
|
|
|
3316
3415
|
* @since 2.0.0
|
|
3317
3416
|
* @category Rate Limiting
|
|
3318
3417
|
*/
|
|
3319
|
-
(duration: Duration.
|
|
3418
|
+
(duration: Duration.Input): <A, E, R>(self: Stream<A, E, R>) => Stream<A, E, R>
|
|
3320
3419
|
/**
|
|
3321
3420
|
* Ends the stream if it does not produce a value within the specified duration.
|
|
3322
3421
|
*
|
|
@@ -3340,15 +3439,97 @@ export const timeout: {
|
|
|
3340
3439
|
* @since 2.0.0
|
|
3341
3440
|
* @category Rate Limiting
|
|
3342
3441
|
*/
|
|
3343
|
-
<A, E, R>(self: Stream<A, E, R>, duration: Duration.
|
|
3442
|
+
<A, E, R>(self: Stream<A, E, R>, duration: Duration.Input): Stream<A, E, R>
|
|
3344
3443
|
} = dual(
|
|
3345
3444
|
2,
|
|
3346
|
-
<A, E, R>(self: Stream<A, E, R>, duration: Duration.
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3445
|
+
<A, E, R>(self: Stream<A, E, R>, duration: Duration.Input): Stream<A, E, R> =>
|
|
3446
|
+
timeoutOrElse(self, {
|
|
3447
|
+
duration,
|
|
3448
|
+
orElse: () => empty
|
|
3449
|
+
})
|
|
3450
|
+
)
|
|
3451
|
+
|
|
3452
|
+
/**
|
|
3453
|
+
* @since 2.0.0
|
|
3454
|
+
* @category Rate Limiting
|
|
3455
|
+
*/
|
|
3456
|
+
export const timeoutOrElse: {
|
|
3457
|
+
/**
|
|
3458
|
+
* @since 2.0.0
|
|
3459
|
+
* @category Rate Limiting
|
|
3460
|
+
*/
|
|
3461
|
+
<B, E2, R2>(
|
|
3462
|
+
options: {
|
|
3463
|
+
readonly duration: Duration.Input
|
|
3464
|
+
readonly orElse: () => Stream<B, E2, R2>
|
|
3465
|
+
}
|
|
3466
|
+
): <A, E, R>(self: Stream<A, E, R>) => Stream<A | B, E | E2, R | R2>
|
|
3467
|
+
/**
|
|
3468
|
+
* @since 2.0.0
|
|
3469
|
+
* @category Rate Limiting
|
|
3470
|
+
*/
|
|
3471
|
+
<A, E, R, B, E2, R2>(
|
|
3472
|
+
self: Stream<A, E, R>,
|
|
3473
|
+
options: {
|
|
3474
|
+
readonly duration: Duration.Input
|
|
3475
|
+
readonly orElse: () => Stream<B, E2, R2>
|
|
3476
|
+
}
|
|
3477
|
+
): Stream<A | B, E | E2, R | R2>
|
|
3478
|
+
} = dual(
|
|
3479
|
+
2,
|
|
3480
|
+
<A, E, R, B, E2, R2>(
|
|
3481
|
+
self: Stream<A, E, R>,
|
|
3482
|
+
options: {
|
|
3483
|
+
readonly duration: Duration.Input
|
|
3484
|
+
readonly orElse: () => Stream<B, E2, R2>
|
|
3485
|
+
}
|
|
3486
|
+
): Stream<A | B, E | E2, R | R2> => {
|
|
3487
|
+
const duration = Duration.fromInputUnsafe(options.duration)
|
|
3488
|
+
if (!Duration.isFinite(duration)) return self
|
|
3489
|
+
if (Duration.isZero(duration)) return suspend(options.orElse)
|
|
3490
|
+
const timeoutSymbol = Symbol()
|
|
3491
|
+
return catchCause(
|
|
3492
|
+
suspend(() => {
|
|
3493
|
+
const parent = Fiber.getCurrent()!
|
|
3494
|
+
const clock = parent.getRef(Clock)
|
|
3495
|
+
const durationMs = Duration.toMillis(duration)
|
|
3496
|
+
let deadline: number | undefined = undefined
|
|
3497
|
+
const latch = Latch.makeUnsafe(false)
|
|
3498
|
+
return merge(
|
|
3499
|
+
transformPull(self, (pull, _scope) =>
|
|
3500
|
+
Effect.suspend(() => {
|
|
3501
|
+
deadline = clock.currentTimeMillisUnsafe() + durationMs
|
|
3502
|
+
latch.openUnsafe()
|
|
3503
|
+
return pull
|
|
3504
|
+
}).pipe(
|
|
3505
|
+
Effect.map((arr) => {
|
|
3506
|
+
latch.closeUnsafe()
|
|
3507
|
+
deadline = undefined
|
|
3508
|
+
return arr
|
|
3509
|
+
}),
|
|
3510
|
+
Effect.succeed
|
|
3511
|
+
)),
|
|
3512
|
+
fromEffectDrain(Effect.gen(function*() {
|
|
3513
|
+
while (true) {
|
|
3514
|
+
yield* latch.await
|
|
3515
|
+
if (deadline === undefined) continue
|
|
3516
|
+
yield* Effect.sleep(deadline - clock.currentTimeMillisUnsafe())
|
|
3517
|
+
if (deadline === undefined) continue
|
|
3518
|
+
const remaining = deadline - clock.currentTimeMillisUnsafe()
|
|
3519
|
+
if (remaining > 0) continue
|
|
3520
|
+
return yield* Effect.die(timeoutSymbol)
|
|
3521
|
+
}
|
|
3522
|
+
})),
|
|
3523
|
+
{ haltStrategy: "left" }
|
|
3524
|
+
)
|
|
3525
|
+
}),
|
|
3526
|
+
(cause): Stream<B, E | E2, R2> => {
|
|
3527
|
+
const isTimeout = cause.reasons.find((r) => r._tag === "Die" && r.defect === timeoutSymbol)
|
|
3528
|
+
if (isTimeout) return options.orElse()
|
|
3529
|
+
return failCause(cause as Cause.Cause<E>)
|
|
3530
|
+
}
|
|
3531
|
+
)
|
|
3532
|
+
}
|
|
3352
3533
|
)
|
|
3353
3534
|
|
|
3354
3535
|
/**
|
|
@@ -3801,7 +3982,7 @@ export const merge: {
|
|
|
3801
3982
|
} | undefined
|
|
3802
3983
|
): Stream<A | A2, E | E2, R | R2>
|
|
3803
3984
|
} = dual(
|
|
3804
|
-
|
|
3985
|
+
(args) => isStream(args[0]) && isStream(args[1]),
|
|
3805
3986
|
<A, E, R, A2, E2, R2>(
|
|
3806
3987
|
self: Stream<A, E, R>,
|
|
3807
3988
|
that: Stream<A2, E2, R2>,
|
|
@@ -5341,7 +5522,7 @@ export const zipLatestAll = <T extends ReadonlyArray<Stream<any, any, any>>>(
|
|
|
5341
5522
|
fromChannel(Channel.suspend(() => {
|
|
5342
5523
|
const latest: Array<any> = []
|
|
5343
5524
|
const emitted = new Set<number>()
|
|
5344
|
-
const readyLatch =
|
|
5525
|
+
const readyLatch = Latch.makeUnsafe()
|
|
5345
5526
|
return Channel.mergeAll(
|
|
5346
5527
|
Channel.fromArray(
|
|
5347
5528
|
streams.map((s, i) =>
|
|
@@ -5763,7 +5944,7 @@ export const filter: {
|
|
|
5763
5944
|
* @since 2.0.0
|
|
5764
5945
|
* @category Filtering
|
|
5765
5946
|
*/
|
|
5766
|
-
<A
|
|
5947
|
+
<A>(predicate: Predicate<NoInfer<A>>): <E, R>(self: Stream<A, E, R>) => Stream<A, E, R>
|
|
5767
5948
|
/**
|
|
5768
5949
|
* Filters a stream to the elements that satisfy a predicate.
|
|
5769
5950
|
*
|
|
@@ -5809,27 +5990,52 @@ export const filter: {
|
|
|
5809
5990
|
* @since 2.0.0
|
|
5810
5991
|
* @category Filtering
|
|
5811
5992
|
*/
|
|
5812
|
-
<A, E, R
|
|
5993
|
+
<A, E, R>(self: Stream<A, E, R>, predicate: Predicate<A>): Stream<A, E, R>
|
|
5813
5994
|
} = dual(
|
|
5814
5995
|
2,
|
|
5815
|
-
<A, E, R
|
|
5996
|
+
<A, E, R>(
|
|
5816
5997
|
self: Stream<A, E, R>,
|
|
5817
|
-
|
|
5818
|
-
): Stream<
|
|
5998
|
+
predicate: Predicate<A>
|
|
5999
|
+
): Stream<A, E, R> => fromChannel(Channel.filterArray(toChannel(self), predicate))
|
|
5819
6000
|
)
|
|
5820
6001
|
|
|
5821
6002
|
/**
|
|
5822
|
-
*
|
|
6003
|
+
* Filters and maps stream elements in one pass using a `Filter`.
|
|
6004
|
+
*
|
|
6005
|
+
* @since 4.0.0
|
|
6006
|
+
* @category Filtering
|
|
6007
|
+
*/
|
|
6008
|
+
export const filterMap: {
|
|
6009
|
+
/**
|
|
6010
|
+
* Filters and maps stream elements in one pass using a `Filter`.
|
|
6011
|
+
*
|
|
6012
|
+
* @since 4.0.0
|
|
6013
|
+
* @category Filtering
|
|
6014
|
+
*/
|
|
6015
|
+
<A, B, X>(filter: Filter.Filter<NoInfer<A>, B, X>): <E, R>(self: Stream<A, E, R>) => Stream<B, E, R>
|
|
6016
|
+
/**
|
|
6017
|
+
* Filters and maps stream elements in one pass using a `Filter`.
|
|
6018
|
+
*
|
|
6019
|
+
* @since 4.0.0
|
|
6020
|
+
* @category Filtering
|
|
6021
|
+
*/
|
|
6022
|
+
<A, E, R, B, X>(self: Stream<A, E, R>, filter: Filter.Filter<A, B, X>): Stream<B, E, R>
|
|
6023
|
+
} = dual(
|
|
6024
|
+
2,
|
|
6025
|
+
<A, E, R, B, X>(
|
|
6026
|
+
self: Stream<A, E, R>,
|
|
6027
|
+
filter: Filter.Filter<A, B, X>
|
|
6028
|
+
): Stream<B, E, R> => fromChannel(Channel.filterMapArray(toChannel(self), filter))
|
|
6029
|
+
)
|
|
6030
|
+
|
|
6031
|
+
/**
|
|
6032
|
+
* Effectfully filters elements in a single pass.
|
|
5823
6033
|
*
|
|
5824
6034
|
* @example
|
|
5825
6035
|
* ```ts
|
|
5826
|
-
* import { Console, Effect,
|
|
5827
|
-
*
|
|
5828
|
-
* const filter = Filter.makeEffect((n: number) =>
|
|
5829
|
-
* Effect.succeed(n > 2 ? Result.succeed(n + 1) : Result.fail(n))
|
|
5830
|
-
* )
|
|
6036
|
+
* import { Console, Effect, Stream } from "effect"
|
|
5831
6037
|
*
|
|
5832
|
-
* const stream = Stream.make(1, 2, 3, 4).pipe(Stream.filterEffect(
|
|
6038
|
+
* const stream = Stream.make(1, 2, 3, 4).pipe(Stream.filterEffect((n) => Effect.succeed(n > 2)))
|
|
5833
6039
|
*
|
|
5834
6040
|
* const program = Effect.gen(function*() {
|
|
5835
6041
|
* const result = yield* Stream.runCollect(stream)
|
|
@@ -5837,7 +6043,7 @@ export const filter: {
|
|
|
5837
6043
|
* })
|
|
5838
6044
|
*
|
|
5839
6045
|
* Effect.runPromise(program)
|
|
5840
|
-
* // Output: [
|
|
6046
|
+
* // Output: [ 3, 4 ]
|
|
5841
6047
|
* ```
|
|
5842
6048
|
*
|
|
5843
6049
|
* @since 2.0.0
|
|
@@ -5845,17 +6051,13 @@ export const filter: {
|
|
|
5845
6051
|
*/
|
|
5846
6052
|
export const filterEffect: {
|
|
5847
6053
|
/**
|
|
5848
|
-
* Effectfully filters
|
|
6054
|
+
* Effectfully filters elements in a single pass.
|
|
5849
6055
|
*
|
|
5850
6056
|
* @example
|
|
5851
6057
|
* ```ts
|
|
5852
|
-
* import { Console, Effect,
|
|
5853
|
-
*
|
|
5854
|
-
* const filter = Filter.makeEffect((n: number) =>
|
|
5855
|
-
* Effect.succeed(n > 2 ? Result.succeed(n + 1) : Result.fail(n))
|
|
5856
|
-
* )
|
|
6058
|
+
* import { Console, Effect, Stream } from "effect"
|
|
5857
6059
|
*
|
|
5858
|
-
* const stream = Stream.make(1, 2, 3, 4).pipe(Stream.filterEffect(
|
|
6060
|
+
* const stream = Stream.make(1, 2, 3, 4).pipe(Stream.filterEffect((n) => Effect.succeed(n > 2)))
|
|
5859
6061
|
*
|
|
5860
6062
|
* const program = Effect.gen(function*() {
|
|
5861
6063
|
* const result = yield* Stream.runCollect(stream)
|
|
@@ -5863,25 +6065,21 @@ export const filterEffect: {
|
|
|
5863
6065
|
* })
|
|
5864
6066
|
*
|
|
5865
6067
|
* Effect.runPromise(program)
|
|
5866
|
-
* // Output: [
|
|
6068
|
+
* // Output: [ 3, 4 ]
|
|
5867
6069
|
* ```
|
|
5868
6070
|
*
|
|
5869
6071
|
* @since 2.0.0
|
|
5870
6072
|
* @category Filtering
|
|
5871
6073
|
*/
|
|
5872
|
-
<A,
|
|
6074
|
+
<A, EX, RX>(predicate: (a: NoInfer<A>, i: number) => Effect.Effect<boolean, EX, RX>): <E, R>(self: Stream<A, E, R>) => Stream<A, E | EX, R | RX>
|
|
5873
6075
|
/**
|
|
5874
|
-
* Effectfully filters
|
|
6076
|
+
* Effectfully filters elements in a single pass.
|
|
5875
6077
|
*
|
|
5876
6078
|
* @example
|
|
5877
6079
|
* ```ts
|
|
5878
|
-
* import { Console, Effect,
|
|
5879
|
-
*
|
|
5880
|
-
* const filter = Filter.makeEffect((n: number) =>
|
|
5881
|
-
* Effect.succeed(n > 2 ? Result.succeed(n + 1) : Result.fail(n))
|
|
5882
|
-
* )
|
|
6080
|
+
* import { Console, Effect, Stream } from "effect"
|
|
5883
6081
|
*
|
|
5884
|
-
* const stream = Stream.make(1, 2, 3, 4).pipe(Stream.filterEffect(
|
|
6082
|
+
* const stream = Stream.make(1, 2, 3, 4).pipe(Stream.filterEffect((n) => Effect.succeed(n > 2)))
|
|
5885
6083
|
*
|
|
5886
6084
|
* const program = Effect.gen(function*() {
|
|
5887
6085
|
* const result = yield* Stream.runCollect(stream)
|
|
@@ -5889,35 +6087,65 @@ export const filterEffect: {
|
|
|
5889
6087
|
* })
|
|
5890
6088
|
*
|
|
5891
6089
|
* Effect.runPromise(program)
|
|
5892
|
-
* // Output: [
|
|
6090
|
+
* // Output: [ 3, 4 ]
|
|
5893
6091
|
* ```
|
|
5894
6092
|
*
|
|
5895
6093
|
* @since 2.0.0
|
|
5896
6094
|
* @category Filtering
|
|
5897
6095
|
*/
|
|
6096
|
+
<A, E, R, EX, RX>(
|
|
6097
|
+
self: Stream<A, E, R>,
|
|
6098
|
+
predicate: (a: NoInfer<A>, i: number) => Effect.Effect<boolean, EX, RX>
|
|
6099
|
+
): Stream<A, E | EX, R | RX>
|
|
6100
|
+
} = dual(
|
|
6101
|
+
2,
|
|
6102
|
+
<A, E, R, EX, RX>(
|
|
6103
|
+
self: Stream<A, E, R>,
|
|
6104
|
+
predicate: (a: NoInfer<A>, i: number) => Effect.Effect<boolean, EX, RX>
|
|
6105
|
+
): Stream<A, E | EX, R | RX> => fromChannel(Channel.filterArrayEffect(toChannel(self), predicate))
|
|
6106
|
+
)
|
|
6107
|
+
|
|
6108
|
+
/**
|
|
6109
|
+
* Effectfully filters and maps elements in a single pass.
|
|
6110
|
+
*
|
|
6111
|
+
* @since 4.0.0
|
|
6112
|
+
* @category Filtering
|
|
6113
|
+
*/
|
|
6114
|
+
export const filterMapEffect: {
|
|
6115
|
+
/**
|
|
6116
|
+
* Effectfully filters and maps elements in a single pass.
|
|
6117
|
+
*
|
|
6118
|
+
* @since 4.0.0
|
|
6119
|
+
* @category Filtering
|
|
6120
|
+
*/
|
|
6121
|
+
<A, B, X, EX, RX>(filter: Filter.FilterEffect<NoInfer<A>, B, X, EX, RX>): <E, R>(self: Stream<A, E, R>) => Stream<B, E | EX, R | RX>
|
|
6122
|
+
/**
|
|
6123
|
+
* Effectfully filters and maps elements in a single pass.
|
|
6124
|
+
*
|
|
6125
|
+
* @since 4.0.0
|
|
6126
|
+
* @category Filtering
|
|
6127
|
+
*/
|
|
5898
6128
|
<A, E, R, B, X, EX, RX>(self: Stream<A, E, R>, filter: Filter.FilterEffect<A, B, X, EX, RX>): Stream<B, E | EX, R | RX>
|
|
5899
6129
|
} = dual(
|
|
5900
6130
|
2,
|
|
5901
6131
|
<A, E, R, B, X, EX, RX>(
|
|
5902
6132
|
self: Stream<A, E, R>,
|
|
5903
6133
|
filter: Filter.FilterEffect<A, B, X, EX, RX>
|
|
5904
|
-
): Stream<B, E | EX, R | RX> => fromChannel(Channel.
|
|
6134
|
+
): Stream<B, E | EX, R | RX> => fromChannel(Channel.filterMapArrayEffect(toChannel(self), filter))
|
|
5905
6135
|
)
|
|
5906
6136
|
|
|
5907
6137
|
/**
|
|
5908
|
-
* Partitions a stream using a Filter and exposes passing and failing values as queues.
|
|
6138
|
+
* Partitions a stream using a `Filter` and exposes passing and failing values as queues.
|
|
5909
6139
|
*
|
|
5910
6140
|
* Each queue fails with the stream error or `Cause.Done` when the source ends.
|
|
5911
6141
|
*
|
|
5912
6142
|
* @example
|
|
5913
6143
|
* ```ts
|
|
5914
|
-
* import { Console, Effect,
|
|
6144
|
+
* import { Console, Effect, Result, Stream } from "effect"
|
|
5915
6145
|
*
|
|
5916
6146
|
* const program = Effect.gen(function*() {
|
|
5917
6147
|
* const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
5918
|
-
* Stream.partitionQueue(
|
|
5919
|
-
* Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
|
|
5920
|
-
* )
|
|
6148
|
+
* Stream.partitionQueue((n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
|
|
5921
6149
|
* )
|
|
5922
6150
|
*
|
|
5923
6151
|
* const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
|
|
@@ -5937,63 +6165,17 @@ export const filterEffect: {
|
|
|
5937
6165
|
*/
|
|
5938
6166
|
export const partitionQueue: {
|
|
5939
6167
|
/**
|
|
5940
|
-
* Partitions a stream using a Filter and exposes passing and failing values as queues.
|
|
5941
|
-
*
|
|
5942
|
-
* Each queue fails with the stream error or `Cause.Done` when the source ends.
|
|
5943
|
-
*
|
|
5944
|
-
* @example
|
|
5945
|
-
* ```ts
|
|
5946
|
-
* import { Console, Effect, Filter, Result, Stream } from "effect"
|
|
5947
|
-
*
|
|
5948
|
-
* const program = Effect.gen(function*() {
|
|
5949
|
-
* const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
5950
|
-
* Stream.partitionQueue(
|
|
5951
|
-
* Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
|
|
5952
|
-
* )
|
|
5953
|
-
* )
|
|
5954
|
-
*
|
|
5955
|
-
* const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
|
|
5956
|
-
* const failValues = yield* Stream.fromQueue(fails).pipe(Stream.runCollect)
|
|
5957
|
-
*
|
|
5958
|
-
* yield* Console.log(passValues)
|
|
5959
|
-
* // Output: [ 2, 4 ]
|
|
5960
|
-
* yield* Console.log(failValues)
|
|
5961
|
-
* // Output: [ 1, 3 ]
|
|
5962
|
-
* })
|
|
5963
|
-
*
|
|
5964
|
-
* Effect.runPromise(Effect.scoped(program))
|
|
5965
|
-
* ```
|
|
5966
|
-
*
|
|
5967
|
-
* @since 4.0.0
|
|
5968
|
-
* @category Filtering
|
|
5969
|
-
*/
|
|
5970
|
-
<A, B extends A>(
|
|
5971
|
-
refinement: Refinement<NoInfer<A>, B>,
|
|
5972
|
-
options?: {
|
|
5973
|
-
readonly capacity?: number | "unbounded" | undefined
|
|
5974
|
-
}
|
|
5975
|
-
): <E, R>(self: Stream<A, E, R>) => Effect.Effect<
|
|
5976
|
-
[
|
|
5977
|
-
passes: Queue.Dequeue<B, E | Cause.Done>,
|
|
5978
|
-
fails: Queue.Dequeue<Exclude<A, B>, E | Cause.Done>
|
|
5979
|
-
],
|
|
5980
|
-
never,
|
|
5981
|
-
R | Scope.Scope
|
|
5982
|
-
>
|
|
5983
|
-
/**
|
|
5984
|
-
* Partitions a stream using a Filter and exposes passing and failing values as queues.
|
|
6168
|
+
* Partitions a stream using a `Filter` and exposes passing and failing values as queues.
|
|
5985
6169
|
*
|
|
5986
6170
|
* Each queue fails with the stream error or `Cause.Done` when the source ends.
|
|
5987
6171
|
*
|
|
5988
6172
|
* @example
|
|
5989
6173
|
* ```ts
|
|
5990
|
-
* import { Console, Effect,
|
|
6174
|
+
* import { Console, Effect, Result, Stream } from "effect"
|
|
5991
6175
|
*
|
|
5992
6176
|
* const program = Effect.gen(function*() {
|
|
5993
6177
|
* const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
5994
|
-
* Stream.partitionQueue(
|
|
5995
|
-
* Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
|
|
5996
|
-
* )
|
|
6178
|
+
* Stream.partitionQueue((n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
|
|
5997
6179
|
* )
|
|
5998
6180
|
*
|
|
5999
6181
|
* const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
|
|
@@ -6011,78 +6193,31 @@ export const partitionQueue: {
|
|
|
6011
6193
|
* @since 4.0.0
|
|
6012
6194
|
* @category Filtering
|
|
6013
6195
|
*/
|
|
6014
|
-
<A,
|
|
6015
|
-
filter: Filter.
|
|
6196
|
+
<A, Pass, Fail>(
|
|
6197
|
+
filter: Filter.Filter<NoInfer<A>, Pass, Fail>,
|
|
6016
6198
|
options?: {
|
|
6017
6199
|
readonly capacity?: number | "unbounded" | undefined
|
|
6018
6200
|
}
|
|
6019
6201
|
): <E, R>(self: Stream<A, E, R>) => Effect.Effect<
|
|
6020
6202
|
[
|
|
6021
|
-
passes: Queue.Dequeue<
|
|
6022
|
-
fails: Queue.Dequeue<
|
|
6203
|
+
passes: Queue.Dequeue<Pass, E | Cause.Done>,
|
|
6204
|
+
fails: Queue.Dequeue<Fail, E | Cause.Done>
|
|
6023
6205
|
],
|
|
6024
6206
|
never,
|
|
6025
6207
|
R | Scope.Scope
|
|
6026
6208
|
>
|
|
6027
6209
|
/**
|
|
6028
|
-
* Partitions a stream using a Filter and exposes passing and failing values as queues.
|
|
6210
|
+
* Partitions a stream using a `Filter` and exposes passing and failing values as queues.
|
|
6029
6211
|
*
|
|
6030
6212
|
* Each queue fails with the stream error or `Cause.Done` when the source ends.
|
|
6031
6213
|
*
|
|
6032
6214
|
* @example
|
|
6033
6215
|
* ```ts
|
|
6034
|
-
* import { Console, Effect,
|
|
6035
|
-
*
|
|
6036
|
-
* const program = Effect.gen(function*() {
|
|
6037
|
-
* const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
6038
|
-
* Stream.partitionQueue(
|
|
6039
|
-
* Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
|
|
6040
|
-
* )
|
|
6041
|
-
* )
|
|
6042
|
-
*
|
|
6043
|
-
* const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
|
|
6044
|
-
* const failValues = yield* Stream.fromQueue(fails).pipe(Stream.runCollect)
|
|
6045
|
-
*
|
|
6046
|
-
* yield* Console.log(passValues)
|
|
6047
|
-
* // Output: [ 2, 4 ]
|
|
6048
|
-
* yield* Console.log(failValues)
|
|
6049
|
-
* // Output: [ 1, 3 ]
|
|
6050
|
-
* })
|
|
6051
|
-
*
|
|
6052
|
-
* Effect.runPromise(Effect.scoped(program))
|
|
6053
|
-
* ```
|
|
6054
|
-
*
|
|
6055
|
-
* @since 4.0.0
|
|
6056
|
-
* @category Filtering
|
|
6057
|
-
*/
|
|
6058
|
-
<A, E, R, B extends A>(
|
|
6059
|
-
self: Stream<A, E, R>,
|
|
6060
|
-
refinement: Refinement<A, B>,
|
|
6061
|
-
options?: {
|
|
6062
|
-
readonly capacity?: number | "unbounded" | undefined
|
|
6063
|
-
}
|
|
6064
|
-
): Effect.Effect<
|
|
6065
|
-
[
|
|
6066
|
-
passes: Queue.Dequeue<B, E | Cause.Done>,
|
|
6067
|
-
fails: Queue.Dequeue<Exclude<A, B>, E | Cause.Done>
|
|
6068
|
-
],
|
|
6069
|
-
never,
|
|
6070
|
-
R | Scope.Scope
|
|
6071
|
-
>
|
|
6072
|
-
/**
|
|
6073
|
-
* Partitions a stream using a Filter and exposes passing and failing values as queues.
|
|
6074
|
-
*
|
|
6075
|
-
* Each queue fails with the stream error or `Cause.Done` when the source ends.
|
|
6076
|
-
*
|
|
6077
|
-
* @example
|
|
6078
|
-
* ```ts
|
|
6079
|
-
* import { Console, Effect, Filter, Result, Stream } from "effect"
|
|
6216
|
+
* import { Console, Effect, Result, Stream } from "effect"
|
|
6080
6217
|
*
|
|
6081
6218
|
* const program = Effect.gen(function*() {
|
|
6082
6219
|
* const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
6083
|
-
* Stream.partitionQueue(
|
|
6084
|
-
* Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
|
|
6085
|
-
* )
|
|
6220
|
+
* Stream.partitionQueue((n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
|
|
6086
6221
|
* )
|
|
6087
6222
|
*
|
|
6088
6223
|
* const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
|
|
@@ -6100,16 +6235,16 @@ export const partitionQueue: {
|
|
|
6100
6235
|
* @since 4.0.0
|
|
6101
6236
|
* @category Filtering
|
|
6102
6237
|
*/
|
|
6103
|
-
<A, E, R,
|
|
6238
|
+
<A, E, R, Pass, Fail>(
|
|
6104
6239
|
self: Stream<A, E, R>,
|
|
6105
|
-
filter: Filter.
|
|
6240
|
+
filter: Filter.Filter<NoInfer<A>, Pass, Fail>,
|
|
6106
6241
|
options?: {
|
|
6107
6242
|
readonly capacity?: number | "unbounded" | undefined
|
|
6108
6243
|
}
|
|
6109
6244
|
): Effect.Effect<
|
|
6110
6245
|
[
|
|
6111
|
-
passes: Queue.Dequeue<
|
|
6112
|
-
fails: Queue.Dequeue<
|
|
6246
|
+
passes: Queue.Dequeue<Pass, E | Cause.Done>,
|
|
6247
|
+
fails: Queue.Dequeue<Fail, E | Cause.Done>
|
|
6113
6248
|
],
|
|
6114
6249
|
never,
|
|
6115
6250
|
R | Scope.Scope
|
|
@@ -6117,16 +6252,16 @@ export const partitionQueue: {
|
|
|
6117
6252
|
} = dual(
|
|
6118
6253
|
(args) => isStream(args[0]),
|
|
6119
6254
|
Effect.fnUntraced(
|
|
6120
|
-
function*<A, E, R,
|
|
6255
|
+
function*<A, E, R, Pass, Fail>(
|
|
6121
6256
|
self: Stream<A, E, R>,
|
|
6122
|
-
filter: Filter.
|
|
6257
|
+
filter: Filter.Filter<NoInfer<A>, Pass, Fail>,
|
|
6123
6258
|
options?: {
|
|
6124
6259
|
readonly capacity?: number | "unbounded" | undefined
|
|
6125
6260
|
}
|
|
6126
6261
|
): Effect.fn.Return<
|
|
6127
6262
|
[
|
|
6128
|
-
passes: Queue.Dequeue<
|
|
6129
|
-
fails: Queue.Dequeue<
|
|
6263
|
+
passes: Queue.Dequeue<Pass, E | Cause.Done>,
|
|
6264
|
+
fails: Queue.Dequeue<Fail, E | Cause.Done>
|
|
6130
6265
|
],
|
|
6131
6266
|
never,
|
|
6132
6267
|
R | Scope.Scope
|
|
@@ -6135,19 +6270,17 @@ export const partitionQueue: {
|
|
|
6135
6270
|
const pull = yield* Channel.toPullScoped(self.channel, scope)
|
|
6136
6271
|
const capacity = options?.capacity === "unbounded" ? undefined : options?.capacity ?? DefaultChunkSize
|
|
6137
6272
|
const passes = yield* Queue.make</**
|
|
6138
|
-
* Partitions a stream using a Filter and exposes passing and failing values as queues.
|
|
6273
|
+
* Partitions a stream using a `Filter` and exposes passing and failing values as queues.
|
|
6139
6274
|
*
|
|
6140
6275
|
* Each queue fails with the stream error or `Cause.Done` when the source ends.
|
|
6141
6276
|
*
|
|
6142
6277
|
* @example
|
|
6143
6278
|
* ```ts
|
|
6144
|
-
* import { Console, Effect,
|
|
6279
|
+
* import { Console, Effect, Result, Stream } from "effect"
|
|
6145
6280
|
*
|
|
6146
6281
|
* const program = Effect.gen(function*() {
|
|
6147
6282
|
* const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
6148
|
-
* Stream.partitionQueue(
|
|
6149
|
-
* Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
|
|
6150
|
-
* )
|
|
6283
|
+
* Stream.partitionQueue((n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
|
|
6151
6284
|
* )
|
|
6152
6285
|
*
|
|
6153
6286
|
* const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
|
|
@@ -6165,20 +6298,18 @@ export const partitionQueue: {
|
|
|
6165
6298
|
* @since 4.0.0
|
|
6166
6299
|
* @category Filtering
|
|
6167
6300
|
*/
|
|
6168
|
-
|
|
6169
|
-
* Partitions a stream using a Filter and exposes passing and failing values as queues.
|
|
6301
|
+
Pass, /**
|
|
6302
|
+
* Partitions a stream using a `Filter` and exposes passing and failing values as queues.
|
|
6170
6303
|
*
|
|
6171
6304
|
* Each queue fails with the stream error or `Cause.Done` when the source ends.
|
|
6172
6305
|
*
|
|
6173
6306
|
* @example
|
|
6174
6307
|
* ```ts
|
|
6175
|
-
* import { Console, Effect,
|
|
6308
|
+
* import { Console, Effect, Result, Stream } from "effect"
|
|
6176
6309
|
*
|
|
6177
6310
|
* const program = Effect.gen(function*() {
|
|
6178
6311
|
* const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
6179
|
-
* Stream.partitionQueue(
|
|
6180
|
-
* Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
|
|
6181
|
-
* )
|
|
6312
|
+
* Stream.partitionQueue((n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
|
|
6182
6313
|
* )
|
|
6183
6314
|
*
|
|
6184
6315
|
* const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
|
|
@@ -6198,19 +6329,17 @@ export const partitionQueue: {
|
|
|
6198
6329
|
*/
|
|
6199
6330
|
E | Cause.Done>({ capacity })
|
|
6200
6331
|
const fails = yield* Queue.make</**
|
|
6201
|
-
* Partitions a stream using a Filter and exposes passing and failing values as queues.
|
|
6332
|
+
* Partitions a stream using a `Filter` and exposes passing and failing values as queues.
|
|
6202
6333
|
*
|
|
6203
6334
|
* Each queue fails with the stream error or `Cause.Done` when the source ends.
|
|
6204
6335
|
*
|
|
6205
6336
|
* @example
|
|
6206
6337
|
* ```ts
|
|
6207
|
-
* import { Console, Effect,
|
|
6338
|
+
* import { Console, Effect, Result, Stream } from "effect"
|
|
6208
6339
|
*
|
|
6209
6340
|
* const program = Effect.gen(function*() {
|
|
6210
6341
|
* const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
6211
|
-
* Stream.partitionQueue(
|
|
6212
|
-
* Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
|
|
6213
|
-
* )
|
|
6342
|
+
* Stream.partitionQueue((n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
|
|
6214
6343
|
* )
|
|
6215
6344
|
*
|
|
6216
6345
|
* const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
|
|
@@ -6228,20 +6357,18 @@ export const partitionQueue: {
|
|
|
6228
6357
|
* @since 4.0.0
|
|
6229
6358
|
* @category Filtering
|
|
6230
6359
|
*/
|
|
6231
|
-
|
|
6232
|
-
* Partitions a stream using a Filter and exposes passing and failing values as queues.
|
|
6360
|
+
Fail, /**
|
|
6361
|
+
* Partitions a stream using a `Filter` and exposes passing and failing values as queues.
|
|
6233
6362
|
*
|
|
6234
6363
|
* Each queue fails with the stream error or `Cause.Done` when the source ends.
|
|
6235
6364
|
*
|
|
6236
6365
|
* @example
|
|
6237
6366
|
* ```ts
|
|
6238
|
-
* import { Console, Effect,
|
|
6367
|
+
* import { Console, Effect, Result, Stream } from "effect"
|
|
6239
6368
|
*
|
|
6240
6369
|
* const program = Effect.gen(function*() {
|
|
6241
6370
|
* const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
6242
|
-
* Stream.partitionQueue(
|
|
6243
|
-
* Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
|
|
6244
|
-
* )
|
|
6371
|
+
* Stream.partitionQueue((n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
|
|
6245
6372
|
* )
|
|
6246
6373
|
*
|
|
6247
6374
|
* const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
|
|
@@ -6261,12 +6388,19 @@ export const partitionQueue: {
|
|
|
6261
6388
|
*/
|
|
6262
6389
|
E | Cause.Done>({ capacity })
|
|
6263
6390
|
|
|
6264
|
-
const partitionArr = Arr.partition(filter as any)
|
|
6265
|
-
|
|
6266
6391
|
yield* Effect.gen(function*() {
|
|
6267
6392
|
while (true) {
|
|
6268
6393
|
const chunk = yield* pull
|
|
6269
|
-
const
|
|
6394
|
+
const excluded: Array<Fail> = []
|
|
6395
|
+
const satisfying: Array<Pass> = []
|
|
6396
|
+
for (let i = 0; i < chunk.length; i++) {
|
|
6397
|
+
const result = filter(chunk[i] as NoInfer<A>)
|
|
6398
|
+
if (Result.isFailure(result)) {
|
|
6399
|
+
excluded.push(result.failure)
|
|
6400
|
+
} else {
|
|
6401
|
+
satisfying.push(result.success)
|
|
6402
|
+
}
|
|
6403
|
+
}
|
|
6270
6404
|
let passFiber: Fiber.Fiber<any> | undefined = undefined
|
|
6271
6405
|
if (satisfying.length > 0) {
|
|
6272
6406
|
const leftover = Queue.offerAllUnsafe(passes, satisfying)
|
|
@@ -6297,147 +6431,112 @@ export const partitionQueue: {
|
|
|
6297
6431
|
)
|
|
6298
6432
|
|
|
6299
6433
|
/**
|
|
6300
|
-
* Splits a stream using an effectful
|
|
6434
|
+
* Splits a stream using an effectful `Filter`, producing pass and fail streams.
|
|
6301
6435
|
*
|
|
6302
6436
|
* @since 4.0.0
|
|
6303
6437
|
* @category Filtering
|
|
6304
|
-
*
|
|
6305
|
-
* @example
|
|
6306
|
-
* ```ts
|
|
6307
|
-
* import { Console, Effect, Result, Stream } from "effect"
|
|
6308
|
-
*
|
|
6309
|
-
* const program = Effect.scoped(
|
|
6310
|
-
* Effect.gen(function*() {
|
|
6311
|
-
* const [evens, odds] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
6312
|
-
* Stream.partitionEffect((n) =>
|
|
6313
|
-
* Effect.succeed(n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
|
|
6314
|
-
* )
|
|
6315
|
-
* )
|
|
6316
|
-
* const result = yield* Effect.all({
|
|
6317
|
-
* evens: Stream.runCollect(evens),
|
|
6318
|
-
* odds: Stream.runCollect(odds)
|
|
6319
|
-
* })
|
|
6320
|
-
* yield* Console.log(result)
|
|
6321
|
-
* })
|
|
6322
|
-
* )
|
|
6323
|
-
*
|
|
6324
|
-
* Effect.runPromise(program)
|
|
6325
|
-
* // Output: { evens: [ 2, 4 ], odds: [ 1, 3 ] }
|
|
6326
|
-
* ```
|
|
6327
6438
|
*/
|
|
6328
6439
|
export const partitionEffect: {
|
|
6329
6440
|
/**
|
|
6330
|
-
* Splits a stream using an effectful
|
|
6441
|
+
* Splits a stream using an effectful `Filter`, producing pass and fail streams.
|
|
6331
6442
|
*
|
|
6332
6443
|
* @since 4.0.0
|
|
6333
6444
|
* @category Filtering
|
|
6334
|
-
*
|
|
6335
|
-
* @example
|
|
6336
|
-
* ```ts
|
|
6337
|
-
* import { Console, Effect, Result, Stream } from "effect"
|
|
6338
|
-
*
|
|
6339
|
-
* const program = Effect.scoped(
|
|
6340
|
-
* Effect.gen(function*() {
|
|
6341
|
-
* const [evens, odds] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
6342
|
-
* Stream.partitionEffect((n) =>
|
|
6343
|
-
* Effect.succeed(n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
|
|
6344
|
-
* )
|
|
6345
|
-
* )
|
|
6346
|
-
* const result = yield* Effect.all({
|
|
6347
|
-
* evens: Stream.runCollect(evens),
|
|
6348
|
-
* odds: Stream.runCollect(odds)
|
|
6349
|
-
* })
|
|
6350
|
-
* yield* Console.log(result)
|
|
6351
|
-
* })
|
|
6352
|
-
* )
|
|
6353
|
-
*
|
|
6354
|
-
* Effect.runPromise(program)
|
|
6355
|
-
* // Output: { evens: [ 2, 4 ], odds: [ 1, 3 ] }
|
|
6356
|
-
* ```
|
|
6357
6445
|
*/
|
|
6358
|
-
<A,
|
|
6359
|
-
filter: Filter.FilterEffect<A
|
|
6446
|
+
<A, Pass, Fail, EX, RX>(
|
|
6447
|
+
filter: Filter.FilterEffect<NoInfer<A>, Pass, Fail, EX, RX>,
|
|
6360
6448
|
options?: {
|
|
6361
6449
|
readonly capacity?: number | "unbounded" | undefined
|
|
6362
6450
|
readonly concurrency?: number | "unbounded" | undefined
|
|
6363
6451
|
}
|
|
6364
6452
|
): <E, R>(self: Stream<A, E, R>) => Effect.Effect<
|
|
6365
6453
|
[
|
|
6366
|
-
passes: Stream<
|
|
6367
|
-
fails: Stream<
|
|
6454
|
+
passes: Stream<Pass, E | EX>,
|
|
6455
|
+
fails: Stream<Fail, E | EX>
|
|
6368
6456
|
],
|
|
6369
6457
|
never,
|
|
6370
6458
|
R | RX | Scope.Scope
|
|
6371
6459
|
>
|
|
6372
6460
|
/**
|
|
6373
|
-
* Splits a stream using an effectful
|
|
6461
|
+
* Splits a stream using an effectful `Filter`, producing pass and fail streams.
|
|
6374
6462
|
*
|
|
6375
6463
|
* @since 4.0.0
|
|
6376
6464
|
* @category Filtering
|
|
6377
|
-
*
|
|
6378
|
-
* @example
|
|
6379
|
-
* ```ts
|
|
6380
|
-
* import { Console, Effect, Result, Stream } from "effect"
|
|
6381
|
-
*
|
|
6382
|
-
* const program = Effect.scoped(
|
|
6383
|
-
* Effect.gen(function*() {
|
|
6384
|
-
* const [evens, odds] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
6385
|
-
* Stream.partitionEffect((n) =>
|
|
6386
|
-
* Effect.succeed(n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
|
|
6387
|
-
* )
|
|
6388
|
-
* )
|
|
6389
|
-
* const result = yield* Effect.all({
|
|
6390
|
-
* evens: Stream.runCollect(evens),
|
|
6391
|
-
* odds: Stream.runCollect(odds)
|
|
6392
|
-
* })
|
|
6393
|
-
* yield* Console.log(result)
|
|
6394
|
-
* })
|
|
6395
|
-
* )
|
|
6396
|
-
*
|
|
6397
|
-
* Effect.runPromise(program)
|
|
6398
|
-
* // Output: { evens: [ 2, 4 ], odds: [ 1, 3 ] }
|
|
6399
|
-
* ```
|
|
6400
6465
|
*/
|
|
6401
|
-
<A, E, R,
|
|
6466
|
+
<A, E, R, Pass, Fail, EX, RX>(
|
|
6402
6467
|
self: Stream<A, E, R>,
|
|
6403
|
-
filter: Filter.FilterEffect<A
|
|
6468
|
+
filter: Filter.FilterEffect<NoInfer<A>, Pass, Fail, EX, RX>,
|
|
6404
6469
|
options?: {
|
|
6405
6470
|
readonly capacity?: number | "unbounded" | undefined
|
|
6406
6471
|
readonly concurrency?: number | "unbounded" | undefined
|
|
6407
6472
|
}
|
|
6408
6473
|
): Effect.Effect<
|
|
6409
6474
|
[
|
|
6410
|
-
passes: Stream<
|
|
6411
|
-
fails: Stream<
|
|
6475
|
+
passes: Stream<Pass, E | EX>,
|
|
6476
|
+
fails: Stream<Fail, E | EX>
|
|
6412
6477
|
],
|
|
6413
6478
|
never,
|
|
6414
6479
|
R | RX | Scope.Scope
|
|
6415
6480
|
>
|
|
6416
6481
|
} = dual(
|
|
6417
6482
|
(args) => isStream(args[0]),
|
|
6418
|
-
<A, E, R,
|
|
6419
|
-
|
|
6420
|
-
|
|
6421
|
-
|
|
6483
|
+
<A, E, R, Pass, Fail, EX, RX>(
|
|
6484
|
+
self: Stream<A, E, R>,
|
|
6485
|
+
filter: Filter.FilterEffect<NoInfer<A>, Pass, Fail, EX, RX>,
|
|
6486
|
+
options?: {
|
|
6487
|
+
readonly capacity?: number | "unbounded" | undefined
|
|
6488
|
+
readonly concurrency?: number | "unbounded" | undefined
|
|
6489
|
+
}
|
|
6490
|
+
): Effect.Effect<
|
|
6422
6491
|
[
|
|
6423
|
-
passes: Stream<
|
|
6424
|
-
fails: Stream<
|
|
6492
|
+
passes: Stream<Pass, E | EX>,
|
|
6493
|
+
fails: Stream<Fail, E | EX>
|
|
6425
6494
|
],
|
|
6426
6495
|
never,
|
|
6427
6496
|
R | RX | Scope.Scope
|
|
6428
6497
|
> =>
|
|
6429
6498
|
Effect.map(
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6499
|
+
partitionQueue</**
|
|
6500
|
+
* Splits a stream using an effectful `Filter`, producing pass and fail streams.
|
|
6501
|
+
*
|
|
6502
|
+
* @since 4.0.0
|
|
6503
|
+
* @category Filtering
|
|
6504
|
+
*/
|
|
6505
|
+
Result.Result<Pass, Fail>, /**
|
|
6506
|
+
* Splits a stream using an effectful `Filter`, producing pass and fail streams.
|
|
6507
|
+
*
|
|
6508
|
+
* @since 4.0.0
|
|
6509
|
+
* @category Filtering
|
|
6510
|
+
*/
|
|
6511
|
+
E | EX, /**
|
|
6512
|
+
* Splits a stream using an effectful `Filter`, producing pass and fail streams.
|
|
6513
|
+
*
|
|
6514
|
+
* @since 4.0.0
|
|
6515
|
+
* @category Filtering
|
|
6516
|
+
*/
|
|
6517
|
+
R | RX, /**
|
|
6518
|
+
* Splits a stream using an effectful `Filter`, producing pass and fail streams.
|
|
6519
|
+
*
|
|
6520
|
+
* @since 4.0.0
|
|
6521
|
+
* @category Filtering
|
|
6522
|
+
*/
|
|
6523
|
+
Pass, /**
|
|
6524
|
+
* Splits a stream using an effectful `Filter`, producing pass and fail streams.
|
|
6525
|
+
*
|
|
6526
|
+
* @since 4.0.0
|
|
6527
|
+
* @category Filtering
|
|
6528
|
+
*/
|
|
6529
|
+
Fail>(
|
|
6530
|
+
mapEffect(self, (a) => filter(a as NoInfer<A>), options),
|
|
6531
|
+
(result) => result,
|
|
6532
|
+
options
|
|
6433
6533
|
),
|
|
6434
|
-
([passes, fails]) => [fromQueue(passes), fromQueue(fails)]
|
|
6435
|
-
)
|
|
6534
|
+
([passes, fails]) => [fromQueue(passes), fromQueue(fails)] as const
|
|
6535
|
+
)
|
|
6436
6536
|
)
|
|
6437
6537
|
|
|
6438
6538
|
/**
|
|
6439
|
-
* Splits a stream into excluded and satisfying substreams using a
|
|
6440
|
-
* refinement, or Filter.
|
|
6539
|
+
* Splits a stream into excluded and satisfying substreams using a `Filter`.
|
|
6441
6540
|
*
|
|
6442
6541
|
* The faster stream may advance up to `bufferSize` elements ahead of the slower
|
|
6443
6542
|
* one.
|
|
@@ -6447,12 +6546,12 @@ export const partitionEffect: {
|
|
|
6447
6546
|
*
|
|
6448
6547
|
* @example
|
|
6449
6548
|
* ```ts
|
|
6450
|
-
* import { Console, Effect, Stream } from "effect"
|
|
6549
|
+
* import { Console, Effect, Result, Stream } from "effect"
|
|
6451
6550
|
*
|
|
6452
6551
|
* const program = Effect.gen(function*() {
|
|
6453
6552
|
* const [excluded, satisfying] = yield* Stream.partition(
|
|
6454
6553
|
* Stream.make(1, 2, 3, 4),
|
|
6455
|
-
* (n) => n % 2 === 0
|
|
6554
|
+
* (n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n)
|
|
6456
6555
|
* )
|
|
6457
6556
|
* const left = yield* Stream.runCollect(excluded)
|
|
6458
6557
|
* const right = yield* Stream.runCollect(satisfying)
|
|
@@ -6462,87 +6561,10 @@ export const partitionEffect: {
|
|
|
6462
6561
|
* // Output: [ 2, 4 ]
|
|
6463
6562
|
* })
|
|
6464
6563
|
* ```
|
|
6465
|
-
*/
|
|
6466
|
-
export const partition: {
|
|
6467
|
-
/**
|
|
6468
|
-
* Splits a stream into excluded and satisfying substreams using a predicate,
|
|
6469
|
-
* refinement, or Filter.
|
|
6470
|
-
*
|
|
6471
|
-
* The faster stream may advance up to `bufferSize` elements ahead of the slower
|
|
6472
|
-
* one.
|
|
6473
|
-
*
|
|
6474
|
-
* @since 4.0.0
|
|
6475
|
-
* @category Filtering
|
|
6476
|
-
*
|
|
6477
|
-
* @example
|
|
6478
|
-
* ```ts
|
|
6479
|
-
* import { Console, Effect, Stream } from "effect"
|
|
6480
|
-
*
|
|
6481
|
-
* const program = Effect.gen(function*() {
|
|
6482
|
-
* const [excluded, satisfying] = yield* Stream.partition(
|
|
6483
|
-
* Stream.make(1, 2, 3, 4),
|
|
6484
|
-
* (n) => n % 2 === 0
|
|
6485
|
-
* )
|
|
6486
|
-
* const left = yield* Stream.runCollect(excluded)
|
|
6487
|
-
* const right = yield* Stream.runCollect(satisfying)
|
|
6488
|
-
* yield* Console.log(left)
|
|
6489
|
-
* // Output: [ 1, 3 ]
|
|
6490
|
-
* yield* Console.log(right)
|
|
6491
|
-
* // Output: [ 2, 4 ]
|
|
6492
|
-
* })
|
|
6493
|
-
* ```
|
|
6494
|
-
*/
|
|
6495
|
-
<C extends A, B extends A, A = C>(
|
|
6496
|
-
refinement: Refinement<NoInfer<A>, B>,
|
|
6497
|
-
options?: { readonly bufferSize?: number | undefined }
|
|
6498
|
-
): <E, R>(
|
|
6499
|
-
self: Stream<C, E, R>
|
|
6500
|
-
) => Effect.Effect<
|
|
6501
|
-
[excluded: Stream<Exclude<C, B>, E>, satisfying: Stream<B, E>],
|
|
6502
|
-
never,
|
|
6503
|
-
R | Scope.Scope
|
|
6504
|
-
>
|
|
6505
|
-
/**
|
|
6506
|
-
* Splits a stream into excluded and satisfying substreams using a predicate,
|
|
6507
|
-
* refinement, or Filter.
|
|
6508
|
-
*
|
|
6509
|
-
* The faster stream may advance up to `bufferSize` elements ahead of the slower
|
|
6510
|
-
* one.
|
|
6511
|
-
*
|
|
6512
|
-
* @since 4.0.0
|
|
6513
|
-
* @category Filtering
|
|
6514
|
-
*
|
|
6515
|
-
* @example
|
|
6516
|
-
* ```ts
|
|
6517
|
-
* import { Console, Effect, Stream } from "effect"
|
|
6518
|
-
*
|
|
6519
|
-
* const program = Effect.gen(function*() {
|
|
6520
|
-
* const [excluded, satisfying] = yield* Stream.partition(
|
|
6521
|
-
* Stream.make(1, 2, 3, 4),
|
|
6522
|
-
* (n) => n % 2 === 0
|
|
6523
|
-
* )
|
|
6524
|
-
* const left = yield* Stream.runCollect(excluded)
|
|
6525
|
-
* const right = yield* Stream.runCollect(satisfying)
|
|
6526
|
-
* yield* Console.log(left)
|
|
6527
|
-
* // Output: [ 1, 3 ]
|
|
6528
|
-
* yield* Console.log(right)
|
|
6529
|
-
* // Output: [ 2, 4 ]
|
|
6530
|
-
* })
|
|
6531
|
-
* ```
|
|
6532
|
-
*/
|
|
6533
|
-
<A, Result extends Filter.ResultOrBool>(
|
|
6534
|
-
filter: Filter.OrPredicate<NoInfer<A>, Result>,
|
|
6535
|
-
options?: { readonly bufferSize?: number | undefined }
|
|
6536
|
-
): <E, R>(
|
|
6537
|
-
self: Stream<A, E, R>
|
|
6538
|
-
) => Effect.Effect<
|
|
6539
|
-
[excluded: Stream<Filter.Fail<A, Result>, E>, satisfying: Stream<Filter.Pass<A, Result>, E>],
|
|
6540
|
-
never,
|
|
6541
|
-
R | Scope.Scope
|
|
6542
|
-
>
|
|
6564
|
+
*/
|
|
6565
|
+
export const partition: {
|
|
6543
6566
|
/**
|
|
6544
|
-
* Splits a stream into excluded and satisfying substreams using a
|
|
6545
|
-
* refinement, or Filter.
|
|
6567
|
+
* Splits a stream into excluded and satisfying substreams using a `Filter`.
|
|
6546
6568
|
*
|
|
6547
6569
|
* The faster stream may advance up to `bufferSize` elements ahead of the slower
|
|
6548
6570
|
* one.
|
|
@@ -6552,12 +6574,12 @@ export const partition: {
|
|
|
6552
6574
|
*
|
|
6553
6575
|
* @example
|
|
6554
6576
|
* ```ts
|
|
6555
|
-
* import { Console, Effect, Stream } from "effect"
|
|
6577
|
+
* import { Console, Effect, Result, Stream } from "effect"
|
|
6556
6578
|
*
|
|
6557
6579
|
* const program = Effect.gen(function*() {
|
|
6558
6580
|
* const [excluded, satisfying] = yield* Stream.partition(
|
|
6559
6581
|
* Stream.make(1, 2, 3, 4),
|
|
6560
|
-
* (n) => n % 2 === 0
|
|
6582
|
+
* (n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n)
|
|
6561
6583
|
* )
|
|
6562
6584
|
* const left = yield* Stream.runCollect(excluded)
|
|
6563
6585
|
* const right = yield* Stream.runCollect(satisfying)
|
|
@@ -6568,18 +6590,18 @@ export const partition: {
|
|
|
6568
6590
|
* })
|
|
6569
6591
|
* ```
|
|
6570
6592
|
*/
|
|
6571
|
-
<
|
|
6572
|
-
|
|
6573
|
-
refinement: Refinement<A, B>,
|
|
6593
|
+
<A, Pass, Fail>(
|
|
6594
|
+
filter: Filter.Filter<NoInfer<A>, Pass, Fail>,
|
|
6574
6595
|
options?: { readonly bufferSize?: number | undefined }
|
|
6575
|
-
):
|
|
6576
|
-
|
|
6596
|
+
): <E, R>(
|
|
6597
|
+
self: Stream<A, E, R>
|
|
6598
|
+
) => Effect.Effect<
|
|
6599
|
+
[excluded: Stream<Fail, E>, satisfying: Stream<Pass, E>],
|
|
6577
6600
|
never,
|
|
6578
6601
|
R | Scope.Scope
|
|
6579
6602
|
>
|
|
6580
6603
|
/**
|
|
6581
|
-
* Splits a stream into excluded and satisfying substreams using a
|
|
6582
|
-
* refinement, or Filter.
|
|
6604
|
+
* Splits a stream into excluded and satisfying substreams using a `Filter`.
|
|
6583
6605
|
*
|
|
6584
6606
|
* The faster stream may advance up to `bufferSize` elements ahead of the slower
|
|
6585
6607
|
* one.
|
|
@@ -6589,12 +6611,12 @@ export const partition: {
|
|
|
6589
6611
|
*
|
|
6590
6612
|
* @example
|
|
6591
6613
|
* ```ts
|
|
6592
|
-
* import { Console, Effect, Stream } from "effect"
|
|
6614
|
+
* import { Console, Effect, Result, Stream } from "effect"
|
|
6593
6615
|
*
|
|
6594
6616
|
* const program = Effect.gen(function*() {
|
|
6595
6617
|
* const [excluded, satisfying] = yield* Stream.partition(
|
|
6596
6618
|
* Stream.make(1, 2, 3, 4),
|
|
6597
|
-
* (n) => n % 2 === 0
|
|
6619
|
+
* (n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n)
|
|
6598
6620
|
* )
|
|
6599
6621
|
* const left = yield* Stream.runCollect(excluded)
|
|
6600
6622
|
* const right = yield* Stream.runCollect(satisfying)
|
|
@@ -6605,28 +6627,28 @@ export const partition: {
|
|
|
6605
6627
|
* })
|
|
6606
6628
|
* ```
|
|
6607
6629
|
*/
|
|
6608
|
-
<A, E, R,
|
|
6630
|
+
<A, E, R, Pass, Fail>(
|
|
6609
6631
|
self: Stream<A, E, R>,
|
|
6610
|
-
filter: Filter.
|
|
6632
|
+
filter: Filter.Filter<NoInfer<A>, Pass, Fail>,
|
|
6611
6633
|
options?: { readonly bufferSize?: number | undefined }
|
|
6612
6634
|
): Effect.Effect<
|
|
6613
|
-
[excluded: Stream<
|
|
6635
|
+
[excluded: Stream<Fail, E>, satisfying: Stream<Pass, E>],
|
|
6614
6636
|
never,
|
|
6615
6637
|
R | Scope.Scope
|
|
6616
6638
|
>
|
|
6617
6639
|
} = dual(
|
|
6618
6640
|
(args) => isStream(args[0]),
|
|
6619
|
-
<A, E, R,
|
|
6641
|
+
<A, E, R, Pass, Fail>(
|
|
6620
6642
|
self: Stream<A, E, R>,
|
|
6621
|
-
filter: Filter.
|
|
6643
|
+
filter: Filter.Filter<NoInfer<A>, Pass, Fail>,
|
|
6622
6644
|
options?: { readonly bufferSize?: number | undefined }
|
|
6623
6645
|
): Effect.Effect<
|
|
6624
|
-
[excluded: Stream<
|
|
6646
|
+
[excluded: Stream<Fail, E>, satisfying: Stream<Pass, E>],
|
|
6625
6647
|
never,
|
|
6626
6648
|
R | Scope.Scope
|
|
6627
6649
|
> =>
|
|
6628
6650
|
Effect.map(
|
|
6629
|
-
partitionQueue(filter, { capacity: options?.bufferSize ?? 16 })
|
|
6651
|
+
partitionQueue(self, filter, { capacity: options?.bufferSize ?? 16 }),
|
|
6630
6652
|
([passes, fails]) => [fromQueue(fails), fromQueue(passes)] as const
|
|
6631
6653
|
)
|
|
6632
6654
|
)
|
|
@@ -7408,7 +7430,7 @@ export const tapError: {
|
|
|
7408
7430
|
))
|
|
7409
7431
|
|
|
7410
7432
|
/**
|
|
7411
|
-
* Recovers from errors that match a
|
|
7433
|
+
* Recovers from errors that match a predicate by switching to a recovery stream.
|
|
7412
7434
|
*
|
|
7413
7435
|
* When a failure matches the filter, the stream switches to the recovery
|
|
7414
7436
|
* stream. Non-matching failures propagate downstream, so the error type is
|
|
@@ -7422,12 +7444,12 @@ export const tapError: {
|
|
|
7422
7444
|
*
|
|
7423
7445
|
* @example
|
|
7424
7446
|
* ```ts
|
|
7425
|
-
* import { Console, Effect,
|
|
7447
|
+
* import { Console, Effect, Stream } from "effect"
|
|
7426
7448
|
*
|
|
7427
7449
|
* const stream = Stream.make(1, 2).pipe(
|
|
7428
7450
|
* Stream.concat(Stream.fail(42)),
|
|
7429
7451
|
* Stream.catchIf(
|
|
7430
|
-
*
|
|
7452
|
+
* (error): error is 42 => error === 42,
|
|
7431
7453
|
* () => Stream.make(999)
|
|
7432
7454
|
* )
|
|
7433
7455
|
* )
|
|
@@ -7446,7 +7468,7 @@ export const tapError: {
|
|
|
7446
7468
|
*/
|
|
7447
7469
|
export const catchIf: {
|
|
7448
7470
|
/**
|
|
7449
|
-
* Recovers from errors that match a
|
|
7471
|
+
* Recovers from errors that match a predicate by switching to a recovery stream.
|
|
7450
7472
|
*
|
|
7451
7473
|
* When a failure matches the filter, the stream switches to the recovery
|
|
7452
7474
|
* stream. Non-matching failures propagate downstream, so the error type is
|
|
@@ -7460,12 +7482,12 @@ export const catchIf: {
|
|
|
7460
7482
|
*
|
|
7461
7483
|
* @example
|
|
7462
7484
|
* ```ts
|
|
7463
|
-
* import { Console, Effect,
|
|
7485
|
+
* import { Console, Effect, Stream } from "effect"
|
|
7464
7486
|
*
|
|
7465
7487
|
* const stream = Stream.make(1, 2).pipe(
|
|
7466
7488
|
* Stream.concat(Stream.fail(42)),
|
|
7467
7489
|
* Stream.catchIf(
|
|
7468
|
-
*
|
|
7490
|
+
* (error): error is 42 => error === 42,
|
|
7469
7491
|
* () => Stream.make(999)
|
|
7470
7492
|
* )
|
|
7471
7493
|
* )
|
|
@@ -7488,7 +7510,7 @@ export const catchIf: {
|
|
|
7488
7510
|
orElse?: ((e: Exclude<E, EB>) => Stream<A3, E3, R3>) | undefined
|
|
7489
7511
|
): <A, R>(self: Stream<A, E, R>) => Stream<A2 | A | A3, E2 | E3, R2 | R | R3>
|
|
7490
7512
|
/**
|
|
7491
|
-
* Recovers from errors that match a
|
|
7513
|
+
* Recovers from errors that match a predicate by switching to a recovery stream.
|
|
7492
7514
|
*
|
|
7493
7515
|
* When a failure matches the filter, the stream switches to the recovery
|
|
7494
7516
|
* stream. Non-matching failures propagate downstream, so the error type is
|
|
@@ -7502,12 +7524,12 @@ export const catchIf: {
|
|
|
7502
7524
|
*
|
|
7503
7525
|
* @example
|
|
7504
7526
|
* ```ts
|
|
7505
|
-
* import { Console, Effect,
|
|
7527
|
+
* import { Console, Effect, Stream } from "effect"
|
|
7506
7528
|
*
|
|
7507
7529
|
* const stream = Stream.make(1, 2).pipe(
|
|
7508
7530
|
* Stream.concat(Stream.fail(42)),
|
|
7509
7531
|
* Stream.catchIf(
|
|
7510
|
-
*
|
|
7532
|
+
* (error): error is 42 => error === 42,
|
|
7511
7533
|
* () => Stream.make(999)
|
|
7512
7534
|
* )
|
|
7513
7535
|
* )
|
|
@@ -7524,13 +7546,13 @@ export const catchIf: {
|
|
|
7524
7546
|
* @since 4.0.0
|
|
7525
7547
|
* @category Error Handling
|
|
7526
7548
|
*/
|
|
7527
|
-
<E,
|
|
7528
|
-
|
|
7529
|
-
f: (
|
|
7530
|
-
orElse?: ((
|
|
7531
|
-
): <A, R>(self: Stream<A, E, R>) => Stream<
|
|
7549
|
+
<E, A2, E2, R2, A3 = never, E3 = E, R3 = never>(
|
|
7550
|
+
predicate: Predicate<NoInfer<E>>,
|
|
7551
|
+
f: (e: NoInfer<E>) => Stream<A2, E2, R2>,
|
|
7552
|
+
orElse?: ((e: NoInfer<E>) => Stream<A3, E3, R3>) | undefined
|
|
7553
|
+
): <A, R>(self: Stream<A, E, R>) => Stream<A2 | A | A3, E2 | E3, R2 | R | R3>
|
|
7532
7554
|
/**
|
|
7533
|
-
* Recovers from errors that match a
|
|
7555
|
+
* Recovers from errors that match a predicate by switching to a recovery stream.
|
|
7534
7556
|
*
|
|
7535
7557
|
* When a failure matches the filter, the stream switches to the recovery
|
|
7536
7558
|
* stream. Non-matching failures propagate downstream, so the error type is
|
|
@@ -7544,12 +7566,12 @@ export const catchIf: {
|
|
|
7544
7566
|
*
|
|
7545
7567
|
* @example
|
|
7546
7568
|
* ```ts
|
|
7547
|
-
* import { Console, Effect,
|
|
7569
|
+
* import { Console, Effect, Stream } from "effect"
|
|
7548
7570
|
*
|
|
7549
7571
|
* const stream = Stream.make(1, 2).pipe(
|
|
7550
7572
|
* Stream.concat(Stream.fail(42)),
|
|
7551
7573
|
* Stream.catchIf(
|
|
7552
|
-
*
|
|
7574
|
+
* (error): error is 42 => error === 42,
|
|
7553
7575
|
* () => Stream.make(999)
|
|
7554
7576
|
* )
|
|
7555
7577
|
* )
|
|
@@ -7573,7 +7595,7 @@ export const catchIf: {
|
|
|
7573
7595
|
orElse?: ((e: Exclude<E, EB>) => Stream<A3, E3, R3>) | undefined
|
|
7574
7596
|
): Stream<A | A2 | A3, E2 | E3, R | R2 | R3>
|
|
7575
7597
|
/**
|
|
7576
|
-
* Recovers from errors that match a
|
|
7598
|
+
* Recovers from errors that match a predicate by switching to a recovery stream.
|
|
7577
7599
|
*
|
|
7578
7600
|
* When a failure matches the filter, the stream switches to the recovery
|
|
7579
7601
|
* stream. Non-matching failures propagate downstream, so the error type is
|
|
@@ -7587,12 +7609,12 @@ export const catchIf: {
|
|
|
7587
7609
|
*
|
|
7588
7610
|
* @example
|
|
7589
7611
|
* ```ts
|
|
7590
|
-
* import { Console, Effect,
|
|
7612
|
+
* import { Console, Effect, Stream } from "effect"
|
|
7591
7613
|
*
|
|
7592
7614
|
* const stream = Stream.make(1, 2).pipe(
|
|
7593
7615
|
* Stream.concat(Stream.fail(42)),
|
|
7594
7616
|
* Stream.catchIf(
|
|
7595
|
-
*
|
|
7617
|
+
* (error): error is 42 => error === 42,
|
|
7596
7618
|
* () => Stream.make(999)
|
|
7597
7619
|
* )
|
|
7598
7620
|
* )
|
|
@@ -7609,37 +7631,96 @@ export const catchIf: {
|
|
|
7609
7631
|
* @since 4.0.0
|
|
7610
7632
|
* @category Error Handling
|
|
7611
7633
|
*/
|
|
7612
|
-
<A, E, R,
|
|
7634
|
+
<A, E, R, A2, E2, R2, A3 = never, E3 = E, R3 = never>(
|
|
7613
7635
|
self: Stream<A, E, R>,
|
|
7614
|
-
|
|
7615
|
-
f: (
|
|
7616
|
-
orElse?: ((
|
|
7636
|
+
predicate: Predicate<E>,
|
|
7637
|
+
f: (e: E) => Stream<A2, E2, R2>,
|
|
7638
|
+
orElse?: ((e: E) => Stream<A3, E3, R3>) | undefined
|
|
7617
7639
|
): Stream<A | A2 | A3, E2 | E3, R | R2 | R3>
|
|
7618
7640
|
} = dual((args) => isStream(args[0]), <
|
|
7619
7641
|
A,
|
|
7620
7642
|
E,
|
|
7621
7643
|
R,
|
|
7622
|
-
Result extends Filter.ResultOrBool,
|
|
7623
7644
|
A2,
|
|
7624
7645
|
E2,
|
|
7625
7646
|
R2,
|
|
7626
7647
|
A3 = never,
|
|
7627
|
-
E3 =
|
|
7648
|
+
E3 = E,
|
|
7628
7649
|
R3 = never
|
|
7629
7650
|
>(
|
|
7630
7651
|
self: Stream<A, E, R>,
|
|
7631
|
-
|
|
7632
|
-
f: (failure:
|
|
7633
|
-
orElse?: ((failure:
|
|
7652
|
+
predicate: Predicate<E>,
|
|
7653
|
+
f: (failure: E) => Stream<A2, E2, R2>,
|
|
7654
|
+
orElse?: ((failure: E) => Stream<A3, E3, R3>) | undefined
|
|
7634
7655
|
): Stream<A | A2 | A3, E2 | E3, R | R2 | R3> =>
|
|
7635
7656
|
fromChannel(
|
|
7636
7657
|
Channel.catchIf(
|
|
7637
7658
|
toChannel(self),
|
|
7638
|
-
|
|
7639
|
-
(e
|
|
7640
|
-
orElse && ((e
|
|
7659
|
+
predicate,
|
|
7660
|
+
(e) => f(e).channel,
|
|
7661
|
+
orElse && ((e) => orElse(e).channel)
|
|
7662
|
+
)
|
|
7663
|
+
))
|
|
7664
|
+
|
|
7665
|
+
/**
|
|
7666
|
+
* Recovers from errors that match a `Filter` by switching to a recovery
|
|
7667
|
+
* stream.
|
|
7668
|
+
*
|
|
7669
|
+
* @since 4.0.0
|
|
7670
|
+
* @category Error Handling
|
|
7671
|
+
*/
|
|
7672
|
+
export const catchFilter: {
|
|
7673
|
+
/**
|
|
7674
|
+
* Recovers from errors that match a `Filter` by switching to a recovery
|
|
7675
|
+
* stream.
|
|
7676
|
+
*
|
|
7677
|
+
* @since 4.0.0
|
|
7678
|
+
* @category Error Handling
|
|
7679
|
+
*/
|
|
7680
|
+
<E, EB, A2, E2, R2, X, A3 = never, E3 = X, R3 = never>(
|
|
7681
|
+
filter: Filter.Filter<NoInfer<E>, EB, X>,
|
|
7682
|
+
f: (failure: EB) => Stream<A2, E2, R2>,
|
|
7683
|
+
orElse?: ((failure: X) => Stream<A3, E3, R3>) | undefined
|
|
7684
|
+
): <A, R>(self: Stream<A, E, R>) => Stream<A | A2 | A3, E2 | E3, R | R2 | R3>
|
|
7685
|
+
/**
|
|
7686
|
+
* Recovers from errors that match a `Filter` by switching to a recovery
|
|
7687
|
+
* stream.
|
|
7688
|
+
*
|
|
7689
|
+
* @since 4.0.0
|
|
7690
|
+
* @category Error Handling
|
|
7691
|
+
*/
|
|
7692
|
+
<A, E, R, EB, A2, E2, R2, X, A3 = never, E3 = X, R3 = never>(
|
|
7693
|
+
self: Stream<A, E, R>,
|
|
7694
|
+
filter: Filter.Filter<NoInfer<E>, EB, X>,
|
|
7695
|
+
f: (failure: EB) => Stream<A2, E2, R2>,
|
|
7696
|
+
orElse?: ((failure: X) => Stream<A3, E3, R3>) | undefined
|
|
7697
|
+
): Stream<A | A2 | A3, E2 | E3, R | R2 | R3>
|
|
7698
|
+
} = dual((args) => isStream(args[0]), <
|
|
7699
|
+
A,
|
|
7700
|
+
E,
|
|
7701
|
+
R,
|
|
7702
|
+
EB,
|
|
7703
|
+
A2,
|
|
7704
|
+
E2,
|
|
7705
|
+
R2,
|
|
7706
|
+
X,
|
|
7707
|
+
A3 = never,
|
|
7708
|
+
E3 = X,
|
|
7709
|
+
R3 = never
|
|
7710
|
+
>(
|
|
7711
|
+
self: Stream<A, E, R>,
|
|
7712
|
+
filter: Filter.Filter<NoInfer<E>, EB, X>,
|
|
7713
|
+
f: (failure: EB) => Stream<A2, E2, R2>,
|
|
7714
|
+
orElse?: ((failure: X) => Stream<A3, E3, R3>) | undefined
|
|
7715
|
+
): Stream<A | A2 | A3, E2 | E3, R | R2 | R3> =>
|
|
7716
|
+
fromChannel(
|
|
7717
|
+
Channel.catchFilter(
|
|
7718
|
+
toChannel(self),
|
|
7719
|
+
filter,
|
|
7720
|
+
(e) => f(e).channel,
|
|
7721
|
+
orElse && ((e) => orElse(e).channel)
|
|
7641
7722
|
)
|
|
7642
|
-
)
|
|
7723
|
+
))
|
|
7643
7724
|
|
|
7644
7725
|
/**
|
|
7645
7726
|
* Recovers from failures whose `_tag` matches the provided value by switching to
|
|
@@ -7978,7 +8059,7 @@ export const catchTags: {
|
|
|
7978
8059
|
>
|
|
7979
8060
|
} = dual((args) => isStream(args[0]), (self, cases, orElse) => {
|
|
7980
8061
|
let keys: Array<string>
|
|
7981
|
-
return
|
|
8062
|
+
return catchFilter(
|
|
7982
8063
|
self,
|
|
7983
8064
|
(e: any) => {
|
|
7984
8065
|
keys ??= Object.keys(cases)
|
|
@@ -8091,8 +8172,16 @@ export const catchReason: {
|
|
|
8091
8172
|
>(
|
|
8092
8173
|
errorTag: K,
|
|
8093
8174
|
reasonTag: RK,
|
|
8094
|
-
f: (
|
|
8095
|
-
|
|
8175
|
+
f: (
|
|
8176
|
+
reason: ExtractReason<ExtractTag<NoInfer<E>, K>, RK>,
|
|
8177
|
+
error: NarrowReason<ExtractTag<NoInfer<E>, K>, RK>
|
|
8178
|
+
) => Stream<A2, E2, R2>,
|
|
8179
|
+
orElse?:
|
|
8180
|
+
| ((
|
|
8181
|
+
reason: ExcludeReason<ExtractTag<NoInfer<E>, K>, RK>,
|
|
8182
|
+
error: OmitReason<ExtractTag<NoInfer<E>, K>, RK>
|
|
8183
|
+
) => Stream<A3, E3, R3>)
|
|
8184
|
+
| undefined
|
|
8096
8185
|
): <A, R>(
|
|
8097
8186
|
self: Stream<A, E, R>
|
|
8098
8187
|
) => Stream<A | A2 | Exclude<A3, unassigned>, (A3 extends unassigned ? E : ExcludeTag<E, K>) | E2 | E3, R | R2 | R3>
|
|
@@ -8155,8 +8244,10 @@ export const catchReason: {
|
|
|
8155
8244
|
self: Stream<A, E, R>,
|
|
8156
8245
|
errorTag: K,
|
|
8157
8246
|
reasonTag: RK,
|
|
8158
|
-
f: (reason: ExtractReason<ExtractTag<E, K>, RK>) => Stream<A2, E2, R2>,
|
|
8159
|
-
orElse?:
|
|
8247
|
+
f: (reason: ExtractReason<ExtractTag<E, K>, RK>, error: NarrowReason<ExtractTag<E, K>, RK>) => Stream<A2, E2, R2>,
|
|
8248
|
+
orElse?:
|
|
8249
|
+
| ((reason: ExcludeReason<ExtractTag<E, K>, RK>, error: OmitReason<ExtractTag<E, K>, RK>) => Stream<A3, E3, R3>)
|
|
8250
|
+
| undefined
|
|
8160
8251
|
): Stream<A | A2 | Exclude<A3, unassigned>, (A3 extends unassigned ? E : ExcludeTag<E, K>) | E2 | E3, R | R2 | R3>
|
|
8161
8252
|
} = dual(
|
|
8162
8253
|
(args) => isStream(args[0]),
|
|
@@ -8176,16 +8267,18 @@ export const catchReason: {
|
|
|
8176
8267
|
self: Stream<A, E, R>,
|
|
8177
8268
|
errorTag: K,
|
|
8178
8269
|
reasonTag: RK,
|
|
8179
|
-
f: (reason: ExtractReason<ExtractTag<E, K>, RK>) => Stream<A2, E2, R2>,
|
|
8180
|
-
orElse?:
|
|
8270
|
+
f: (reason: ExtractReason<ExtractTag<E, K>, RK>, error: NarrowReason<ExtractTag<E, K>, RK>) => Stream<A2, E2, R2>,
|
|
8271
|
+
orElse?:
|
|
8272
|
+
| ((reason: ExcludeReason<ExtractTag<E, K>, RK>, error: OmitReason<ExtractTag<E, K>, RK>) => Stream<A3, E3, R3>)
|
|
8273
|
+
| undefined
|
|
8181
8274
|
): Stream<A | A2 | Exclude<A3, unassigned>, (A3 extends unassigned ? E : ExcludeTag<E, K>) | E2 | E3, R | R2 | R3> =>
|
|
8182
8275
|
fromChannel(
|
|
8183
8276
|
Channel.catchReason(
|
|
8184
8277
|
toChannel(self),
|
|
8185
8278
|
errorTag,
|
|
8186
8279
|
reasonTag,
|
|
8187
|
-
(reason) => f(reason).channel,
|
|
8188
|
-
orElse && ((reason) => orElse(reason).channel)
|
|
8280
|
+
(reason, error) => f(reason, error).channel,
|
|
8281
|
+
orElse && ((reason, error) => orElse(reason, error).channel)
|
|
8189
8282
|
)
|
|
8190
8283
|
) as any
|
|
8191
8284
|
)
|
|
@@ -8278,7 +8371,8 @@ export const catchReasons: {
|
|
|
8278
8371
|
E,
|
|
8279
8372
|
Cases extends {
|
|
8280
8373
|
[RK in ReasonTags<ExtractTag<NoInfer<E>, K>>]+?: (
|
|
8281
|
-
reason: ExtractReason<ExtractTag<NoInfer<E>, K>, RK
|
|
8374
|
+
reason: ExtractReason<ExtractTag<NoInfer<E>, K>, RK>,
|
|
8375
|
+
error: NarrowReason<ExtractTag<NoInfer<E>, K>, RK>
|
|
8282
8376
|
) => Stream<any, any, any>
|
|
8283
8377
|
},
|
|
8284
8378
|
A2 = unassigned,
|
|
@@ -8288,7 +8382,10 @@ export const catchReasons: {
|
|
|
8288
8382
|
errorTag: K,
|
|
8289
8383
|
cases: Cases,
|
|
8290
8384
|
orElse?:
|
|
8291
|
-
| ((
|
|
8385
|
+
| ((
|
|
8386
|
+
reason: ExcludeReason<ExtractTag<NoInfer<E>, K>, Extract<keyof Cases, string>>,
|
|
8387
|
+
error: OmitReason<ExtractTag<NoInfer<E>, K>, Extract<keyof Cases, string>>
|
|
8388
|
+
) => Stream<A2, E2, R2>)
|
|
8292
8389
|
| undefined
|
|
8293
8390
|
): <A, R>(self: Stream<A, E, R>) => Stream<
|
|
8294
8391
|
| A
|
|
@@ -8355,7 +8452,8 @@ export const catchReasons: {
|
|
|
8355
8452
|
K extends Tags<E>,
|
|
8356
8453
|
Cases extends {
|
|
8357
8454
|
[RK in ReasonTags<ExtractTag<E, K>>]+?: (
|
|
8358
|
-
reason: ExtractReason<ExtractTag<E, K>, RK
|
|
8455
|
+
reason: ExtractReason<ExtractTag<E, K>, RK>,
|
|
8456
|
+
error: NarrowReason<ExtractTag<E, K>, RK>
|
|
8359
8457
|
) => Stream<any, any, any>
|
|
8360
8458
|
},
|
|
8361
8459
|
A2 = unassigned,
|
|
@@ -8366,7 +8464,10 @@ export const catchReasons: {
|
|
|
8366
8464
|
errorTag: K,
|
|
8367
8465
|
cases: Cases,
|
|
8368
8466
|
orElse?:
|
|
8369
|
-
| ((
|
|
8467
|
+
| ((
|
|
8468
|
+
reason: ExcludeReason<ExtractTag<NoInfer<E>, K>, Extract<keyof Cases, string>>,
|
|
8469
|
+
error: OmitReason<ExtractTag<NoInfer<E>, K>, Extract<keyof Cases, string>>
|
|
8470
|
+
) => Stream<A2, E2, R2>)
|
|
8370
8471
|
| undefined
|
|
8371
8472
|
): Stream<
|
|
8372
8473
|
| A
|
|
@@ -8386,12 +8487,12 @@ export const catchReasons: {
|
|
|
8386
8487
|
}[keyof Cases]
|
|
8387
8488
|
>
|
|
8388
8489
|
} = dual((args) => isStream(args[0]), (self, errorTag, cases, orElse) => {
|
|
8389
|
-
const handlers: Record<string, (reason: any) => Channel.Channel<any, any, any, any, any, any, any>> = {}
|
|
8490
|
+
const handlers: Record<string, (reason: any, error: any) => Channel.Channel<any, any, any, any, any, any, any>> = {}
|
|
8390
8491
|
for (const key of Object.keys(cases)) {
|
|
8391
8492
|
const handler = (cases as any)[key]
|
|
8392
|
-
handlers[key] = (reason) => handler(reason).channel
|
|
8493
|
+
handlers[key] = (reason, error) => handler(reason, error).channel
|
|
8393
8494
|
}
|
|
8394
|
-
const orElseHandler = orElse && ((reason: any) => orElse(reason).channel)
|
|
8495
|
+
const orElseHandler = orElse && ((reason: any, error: any) => orElse(reason, error).channel)
|
|
8395
8496
|
return fromChannel(
|
|
8396
8497
|
Channel.catchReasons(self.channel, errorTag as any, handlers as any, orElseHandler as any) as Channel.Channel<
|
|
8397
8498
|
Arr.NonEmptyReadonlyArray<any>,
|
|
@@ -8549,12 +8650,12 @@ export const catchCauseIf: {
|
|
|
8549
8650
|
* @since 4.0.0
|
|
8550
8651
|
* @category Error Handling
|
|
8551
8652
|
*/
|
|
8552
|
-
<E,
|
|
8553
|
-
|
|
8554
|
-
f: (
|
|
8653
|
+
<E, A2, E2, R2>(
|
|
8654
|
+
predicate: Predicate<Cause.Cause<E>>,
|
|
8655
|
+
f: (cause: Cause.Cause<E>) => Stream<A2, E2, R2>
|
|
8555
8656
|
): <A, R>(
|
|
8556
8657
|
self: Stream<A, E, R>
|
|
8557
|
-
) => Stream<A | A2,
|
|
8658
|
+
) => Stream<A | A2, E | E2, R2 | R>
|
|
8558
8659
|
/**
|
|
8559
8660
|
* Recovers from stream failures by filtering the `Cause` and switching to a recovery stream.
|
|
8560
8661
|
* Non-matching causes are re-emitted as failures.
|
|
@@ -8588,19 +8689,68 @@ export const catchCauseIf: {
|
|
|
8588
8689
|
* @since 4.0.0
|
|
8589
8690
|
* @category Error Handling
|
|
8590
8691
|
*/
|
|
8591
|
-
<A, E, R, A2, E2, R2
|
|
8692
|
+
<A, E, R, A2, E2, R2>(
|
|
8693
|
+
self: Stream<A, E, R>,
|
|
8694
|
+
predicate: Predicate<Cause.Cause<E>>,
|
|
8695
|
+
f: (cause: Cause.Cause<E>) => Stream<A2, E2, R2>
|
|
8696
|
+
): Stream<A | A2, E | E2, R | R2>
|
|
8697
|
+
} = dual(3, <A, E, R, A2, E2, R2>(
|
|
8698
|
+
self: Stream<A, E, R>,
|
|
8699
|
+
predicate: Predicate<Cause.Cause<E>>,
|
|
8700
|
+
f: (cause: Cause.Cause<E>) => Stream<A2, E2, R2>
|
|
8701
|
+
): Stream<A | A2, E | E2, R | R2> =>
|
|
8702
|
+
fromChannel(
|
|
8703
|
+
Channel.catchCauseIf(
|
|
8704
|
+
self.channel,
|
|
8705
|
+
predicate,
|
|
8706
|
+
(cause) => f(cause).channel
|
|
8707
|
+
)
|
|
8708
|
+
))
|
|
8709
|
+
|
|
8710
|
+
/**
|
|
8711
|
+
* Recovers from stream failures by filtering the `Cause` and switching to a
|
|
8712
|
+
* recovery stream.
|
|
8713
|
+
*
|
|
8714
|
+
* @since 4.0.0
|
|
8715
|
+
* @category Error Handling
|
|
8716
|
+
*/
|
|
8717
|
+
export const catchCauseFilter: {
|
|
8718
|
+
/**
|
|
8719
|
+
* Recovers from stream failures by filtering the `Cause` and switching to a
|
|
8720
|
+
* recovery stream.
|
|
8721
|
+
*
|
|
8722
|
+
* @since 4.0.0
|
|
8723
|
+
* @category Error Handling
|
|
8724
|
+
*/
|
|
8725
|
+
<E, EB, A2, E2, R2, X extends Cause.Cause<any>>(
|
|
8726
|
+
filter: Filter.Filter<Cause.Cause<E>, EB, X>,
|
|
8727
|
+
f: (failure: EB, cause: Cause.Cause<E>) => Stream<A2, E2, R2>
|
|
8728
|
+
): <A, R>(
|
|
8729
|
+
self: Stream<A, E, R>
|
|
8730
|
+
) => Stream<A | A2, Cause.Cause.Error<X> | E2, R2 | R>
|
|
8731
|
+
/**
|
|
8732
|
+
* Recovers from stream failures by filtering the `Cause` and switching to a
|
|
8733
|
+
* recovery stream.
|
|
8734
|
+
*
|
|
8735
|
+
* @since 4.0.0
|
|
8736
|
+
* @category Error Handling
|
|
8737
|
+
*/
|
|
8738
|
+
<A, E, R, EB, A2, E2, R2, X extends Cause.Cause<any>>(
|
|
8592
8739
|
self: Stream<A, E, R>,
|
|
8593
|
-
filter: Filter.
|
|
8594
|
-
f: (failure:
|
|
8595
|
-
): Stream<A | A2, Cause.Cause.Error<
|
|
8596
|
-
} = dual(3, <A, E, R, A2, E2, R2,
|
|
8740
|
+
filter: Filter.Filter<Cause.Cause<E>, EB, X>,
|
|
8741
|
+
f: (failure: EB, cause: Cause.Cause<E>) => Stream<A2, E2, R2>
|
|
8742
|
+
): Stream<A | A2, Cause.Cause.Error<X> | E2, R | R2>
|
|
8743
|
+
} = dual(3, <A, E, R, EB, A2, E2, R2, X extends Cause.Cause<any>>(
|
|
8597
8744
|
self: Stream<A, E, R>,
|
|
8598
|
-
filter: Filter.
|
|
8599
|
-
f: (failure:
|
|
8600
|
-
): Stream<A | A2, Cause.Cause.Error<
|
|
8745
|
+
filter: Filter.Filter<Cause.Cause<E>, EB, X>,
|
|
8746
|
+
f: (failure: EB, cause: Cause.Cause<E>) => Stream<A2, E2, R2>
|
|
8747
|
+
): Stream<A | A2, Cause.Cause.Error<X> | E2, R | R2> =>
|
|
8601
8748
|
fromChannel(
|
|
8602
|
-
Channel.
|
|
8603
|
-
|
|
8749
|
+
Channel.catchCauseFilter(
|
|
8750
|
+
self.channel,
|
|
8751
|
+
filter,
|
|
8752
|
+
(failure, cause) => f(failure, cause).channel
|
|
8753
|
+
)
|
|
8604
8754
|
))
|
|
8605
8755
|
|
|
8606
8756
|
/**
|
|
@@ -8819,12 +8969,12 @@ export const orDie = <A, E, R>(self: Stream<A, E, R>): Stream<A, never, R> => fr
|
|
|
8819
8969
|
*/
|
|
8820
8970
|
export const ignore: <
|
|
8821
8971
|
Arg extends Stream<any, any, any> | {
|
|
8822
|
-
readonly log?: boolean |
|
|
8972
|
+
readonly log?: boolean | Severity | undefined
|
|
8823
8973
|
} | undefined
|
|
8824
8974
|
>(
|
|
8825
8975
|
selfOrOptions: Arg,
|
|
8826
8976
|
options?: {
|
|
8827
|
-
readonly log?: boolean |
|
|
8977
|
+
readonly log?: boolean | Severity | undefined
|
|
8828
8978
|
} | undefined
|
|
8829
8979
|
) => [Arg] extends [Stream<infer A, infer _E, infer R>] ? Stream<A, never, R>
|
|
8830
8980
|
: <A, E, R>(self: Stream<A, E, R>) => Stream<A, never, R> = dual(
|
|
@@ -8832,7 +8982,7 @@ export const ignore: <
|
|
|
8832
8982
|
<A, E, R>(
|
|
8833
8983
|
self: Stream<A, E, R>,
|
|
8834
8984
|
options?: {
|
|
8835
|
-
readonly log?: boolean |
|
|
8985
|
+
readonly log?: boolean | Severity | undefined
|
|
8836
8986
|
} | undefined
|
|
8837
8987
|
): Stream<A, never, R> => fromChannel(Channel.ignore(self.channel, options))
|
|
8838
8988
|
)
|
|
@@ -8859,19 +9009,19 @@ export const ignore: <
|
|
|
8859
9009
|
*/
|
|
8860
9010
|
export const ignoreCause: <
|
|
8861
9011
|
Arg extends Stream<any, any, any> | {
|
|
8862
|
-
readonly log?: boolean |
|
|
9012
|
+
readonly log?: boolean | Severity | undefined
|
|
8863
9013
|
} | undefined
|
|
8864
9014
|
>(
|
|
8865
9015
|
streamOrOptions: Arg,
|
|
8866
9016
|
options?: {
|
|
8867
|
-
readonly log?: boolean |
|
|
9017
|
+
readonly log?: boolean | Severity | undefined
|
|
8868
9018
|
} | undefined
|
|
8869
9019
|
) => [Arg] extends [Stream<infer A, infer _E, infer R>] ? Stream<A, never, R>
|
|
8870
9020
|
: <A, E, R>(self: Stream<A, E, R>) => Stream<A, never, R> = dual(
|
|
8871
9021
|
(args) => isStream(args[0]),
|
|
8872
9022
|
<A, E, R>(
|
|
8873
9023
|
self: Stream<A, E, R>,
|
|
8874
|
-
options?: { readonly log?: boolean |
|
|
9024
|
+
options?: { readonly log?: boolean | Severity | undefined } | undefined
|
|
8875
9025
|
): Stream<A, never, R> => fromChannel(Channel.ignoreCause(self.channel, options))
|
|
8876
9026
|
)
|
|
8877
9027
|
|
|
@@ -9006,9 +9156,9 @@ export const retry: {
|
|
|
9006
9156
|
*
|
|
9007
9157
|
* @example
|
|
9008
9158
|
* ```ts
|
|
9009
|
-
* import { Console, Effect, ExecutionPlan, Layer,
|
|
9159
|
+
* import { Console, Effect, ExecutionPlan, Layer, Context, Stream } from "effect"
|
|
9010
9160
|
*
|
|
9011
|
-
* class Service extends
|
|
9161
|
+
* class Service extends Context.Service<Service>()("Service", {
|
|
9012
9162
|
* make: Effect.succeed({
|
|
9013
9163
|
* stream: Stream.fail("A") as Stream.Stream<number, string>
|
|
9014
9164
|
* })
|
|
@@ -9048,9 +9198,9 @@ export const withExecutionPlan: {
|
|
|
9048
9198
|
*
|
|
9049
9199
|
* @example
|
|
9050
9200
|
* ```ts
|
|
9051
|
-
* import { Console, Effect, ExecutionPlan, Layer,
|
|
9201
|
+
* import { Console, Effect, ExecutionPlan, Layer, Context, Stream } from "effect"
|
|
9052
9202
|
*
|
|
9053
|
-
* class Service extends
|
|
9203
|
+
* class Service extends Context.Service<Service>()("Service", {
|
|
9054
9204
|
* make: Effect.succeed({
|
|
9055
9205
|
* stream: Stream.fail("A") as Stream.Stream<number, string>
|
|
9056
9206
|
* })
|
|
@@ -9093,9 +9243,9 @@ export const withExecutionPlan: {
|
|
|
9093
9243
|
*
|
|
9094
9244
|
* @example
|
|
9095
9245
|
* ```ts
|
|
9096
|
-
* import { Console, Effect, ExecutionPlan, Layer,
|
|
9246
|
+
* import { Console, Effect, ExecutionPlan, Layer, Context, Stream } from "effect"
|
|
9097
9247
|
*
|
|
9098
|
-
* class Service extends
|
|
9248
|
+
* class Service extends Context.Service<Service>()("Service", {
|
|
9099
9249
|
* make: Effect.succeed({
|
|
9100
9250
|
* stream: Stream.fail("A") as Stream.Stream<number, string>
|
|
9101
9251
|
* })
|
|
@@ -9168,9 +9318,9 @@ export const withExecutionPlan: {
|
|
|
9168
9318
|
*
|
|
9169
9319
|
* @example
|
|
9170
9320
|
* ```ts
|
|
9171
|
-
* import { Console, Effect, ExecutionPlan, Layer,
|
|
9321
|
+
* import { Console, Effect, ExecutionPlan, Layer, Context, Stream } from "effect"
|
|
9172
9322
|
*
|
|
9173
|
-
* class Service extends
|
|
9323
|
+
* class Service extends Context.Service<Service>()("Service", {
|
|
9174
9324
|
* make: Effect.succeed({
|
|
9175
9325
|
* stream: Stream.fail("A") as Stream.Stream<number, string>
|
|
9176
9326
|
* })
|
|
@@ -9741,7 +9891,7 @@ export const takeWhile: {
|
|
|
9741
9891
|
* @since 2.0.0
|
|
9742
9892
|
* @category Filtering
|
|
9743
9893
|
*/
|
|
9744
|
-
<A,
|
|
9894
|
+
<A, E, R, B extends A>(self: Stream<A, E, R>, refinement: (a: NoInfer<A>, n: number) => a is B): Stream<B, E, R>
|
|
9745
9895
|
/**
|
|
9746
9896
|
* Takes the longest initial prefix of elements that satisfy the predicate.
|
|
9747
9897
|
*
|
|
@@ -9765,71 +9915,71 @@ export const takeWhile: {
|
|
|
9765
9915
|
* @since 2.0.0
|
|
9766
9916
|
* @category Filtering
|
|
9767
9917
|
*/
|
|
9768
|
-
<A, E, R
|
|
9918
|
+
<A, E, R>(self: Stream<A, E, R>, predicate: (a: NoInfer<A>, n: number) => boolean): Stream<A, E, R>
|
|
9919
|
+
} = dual(
|
|
9920
|
+
2,
|
|
9921
|
+
<A, E, R>(
|
|
9922
|
+
self: Stream<A, E, R>,
|
|
9923
|
+
predicate: (a: A, n: number) => boolean
|
|
9924
|
+
): Stream<A, E, R> =>
|
|
9925
|
+
transformPull(self, (pull, _scope) =>
|
|
9926
|
+
Effect.sync(() => {
|
|
9927
|
+
let i = 0
|
|
9928
|
+
let done = false
|
|
9929
|
+
const pump: Pull.Pull<Arr.NonEmptyReadonlyArray<A>, E, void, R> = Effect.flatMap(
|
|
9930
|
+
Effect.suspend(() => done ? Cause.done() : pull),
|
|
9931
|
+
(chunk) => {
|
|
9932
|
+
const out: Array<A> = []
|
|
9933
|
+
for (let j = 0; j < chunk.length; j++) {
|
|
9934
|
+
if (!predicate(chunk[j], i++)) {
|
|
9935
|
+
done = true
|
|
9936
|
+
break
|
|
9937
|
+
}
|
|
9938
|
+
out.push(chunk[j])
|
|
9939
|
+
}
|
|
9940
|
+
return Arr.isReadonlyArrayNonEmpty(out) ? Effect.succeed(out) : done ? Cause.done() : pump
|
|
9941
|
+
}
|
|
9942
|
+
)
|
|
9943
|
+
return pump
|
|
9944
|
+
}))
|
|
9945
|
+
)
|
|
9946
|
+
|
|
9947
|
+
/**
|
|
9948
|
+
* Takes the longest initial prefix of elements that satisfy the filter.
|
|
9949
|
+
*
|
|
9950
|
+
* @since 4.0.0
|
|
9951
|
+
* @category Filtering
|
|
9952
|
+
*/
|
|
9953
|
+
export const takeWhileFilter: {
|
|
9769
9954
|
/**
|
|
9770
|
-
* Takes the longest initial prefix of elements that satisfy the
|
|
9771
|
-
*
|
|
9772
|
-
* @example
|
|
9773
|
-
* ```ts
|
|
9774
|
-
* import { Console, Effect, Stream } from "effect"
|
|
9775
|
-
*
|
|
9776
|
-
* const stream = Stream.range(1, 5).pipe(
|
|
9777
|
-
* Stream.takeWhile((n) => n % 3 !== 0)
|
|
9778
|
-
* )
|
|
9779
|
-
*
|
|
9780
|
-
* const program = Effect.gen(function*() {
|
|
9781
|
-
* const result = yield* Stream.runCollect(stream)
|
|
9782
|
-
* yield* Console.log(result)
|
|
9783
|
-
* })
|
|
9784
|
-
*
|
|
9785
|
-
* Effect.runPromise(program)
|
|
9786
|
-
* // Output: [ 1, 2 ]
|
|
9787
|
-
* ```
|
|
9955
|
+
* Takes the longest initial prefix of elements that satisfy the filter.
|
|
9788
9956
|
*
|
|
9789
|
-
* @since
|
|
9957
|
+
* @since 4.0.0
|
|
9790
9958
|
* @category Filtering
|
|
9791
9959
|
*/
|
|
9792
|
-
<A,
|
|
9960
|
+
<A, B, X>(f: Filter.Filter<NoInfer<A>, B, X>): <E, R>(self: Stream<A, E, R>) => Stream<B, E, R>
|
|
9793
9961
|
/**
|
|
9794
|
-
* Takes the longest initial prefix of elements that satisfy the
|
|
9795
|
-
*
|
|
9796
|
-
* @example
|
|
9797
|
-
* ```ts
|
|
9798
|
-
* import { Console, Effect, Stream } from "effect"
|
|
9799
|
-
*
|
|
9800
|
-
* const stream = Stream.range(1, 5).pipe(
|
|
9801
|
-
* Stream.takeWhile((n) => n % 3 !== 0)
|
|
9802
|
-
* )
|
|
9803
|
-
*
|
|
9804
|
-
* const program = Effect.gen(function*() {
|
|
9805
|
-
* const result = yield* Stream.runCollect(stream)
|
|
9806
|
-
* yield* Console.log(result)
|
|
9807
|
-
* })
|
|
9808
|
-
*
|
|
9809
|
-
* Effect.runPromise(program)
|
|
9810
|
-
* // Output: [ 1, 2 ]
|
|
9811
|
-
* ```
|
|
9962
|
+
* Takes the longest initial prefix of elements that satisfy the filter.
|
|
9812
9963
|
*
|
|
9813
|
-
* @since
|
|
9964
|
+
* @since 4.0.0
|
|
9814
9965
|
* @category Filtering
|
|
9815
9966
|
*/
|
|
9816
9967
|
<A, E, R, B, X>(self: Stream<A, E, R>, f: Filter.Filter<NoInfer<A>, B, X>): Stream<B, E, R>
|
|
9817
9968
|
} = dual(
|
|
9818
9969
|
2,
|
|
9819
|
-
<A, E, R>(
|
|
9970
|
+
<A, E, R, B, X>(
|
|
9820
9971
|
self: Stream<A, E, R>,
|
|
9821
|
-
|
|
9822
|
-
): Stream<
|
|
9972
|
+
filter: Filter.Filter<NoInfer<A>, B, X>
|
|
9973
|
+
): Stream<B, E, R> =>
|
|
9823
9974
|
transformPull(self, (pull, _scope) =>
|
|
9824
9975
|
Effect.sync(() => {
|
|
9825
|
-
let i = 0
|
|
9826
9976
|
let done = false
|
|
9827
|
-
const pump: Pull.Pull<Arr.NonEmptyReadonlyArray<
|
|
9977
|
+
const pump: Pull.Pull<Arr.NonEmptyReadonlyArray<B>, E, void, R> = Effect.flatMap(
|
|
9828
9978
|
Effect.suspend(() => done ? Cause.done() : pull),
|
|
9829
9979
|
(chunk) => {
|
|
9830
|
-
const out: Array<
|
|
9980
|
+
const out: Array<B> = []
|
|
9831
9981
|
for (let j = 0; j < chunk.length; j++) {
|
|
9832
|
-
const result =
|
|
9982
|
+
const result = filter(chunk[j])
|
|
9833
9983
|
if (Result.isFailure(result)) {
|
|
9834
9984
|
done = true
|
|
9835
9985
|
break
|
|
@@ -10224,29 +10374,6 @@ export const dropWhile: {
|
|
|
10224
10374
|
* @category Filtering
|
|
10225
10375
|
*/
|
|
10226
10376
|
<A>(predicate: (a: NoInfer<A>, index: number) => boolean): <E, R>(self: Stream<A, E, R>) => Stream<A, E, R>
|
|
10227
|
-
/**
|
|
10228
|
-
* Drops elements from the stream while the specified predicate evaluates to `true`.
|
|
10229
|
-
*
|
|
10230
|
-
* @example
|
|
10231
|
-
* ```ts
|
|
10232
|
-
* import { Console, Effect, Stream } from "effect"
|
|
10233
|
-
*
|
|
10234
|
-
* const program = Effect.gen(function*() {
|
|
10235
|
-
* const values = yield* Stream.make(1, 2, 3, 4, 5).pipe(
|
|
10236
|
-
* Stream.dropWhile((n) => n < 3),
|
|
10237
|
-
* Stream.runCollect
|
|
10238
|
-
* )
|
|
10239
|
-
* yield* Console.log(values)
|
|
10240
|
-
* })
|
|
10241
|
-
*
|
|
10242
|
-
* Effect.runPromise(program)
|
|
10243
|
-
* // Output: [ 3, 4, 5 ]
|
|
10244
|
-
* ```
|
|
10245
|
-
*
|
|
10246
|
-
* @since 2.0.0
|
|
10247
|
-
* @category Filtering
|
|
10248
|
-
*/
|
|
10249
|
-
<A, B, X>(f: Filter.Filter<NoInfer<A>, B, X>): <E, R>(self: Stream<A, E, R>) => Stream<A, E, R>
|
|
10250
10377
|
/**
|
|
10251
10378
|
* Drops elements from the stream while the specified predicate evaluates to `true`.
|
|
10252
10379
|
*
|
|
@@ -10273,39 +10400,53 @@ export const dropWhile: {
|
|
|
10273
10400
|
self: Stream<A, E, R>,
|
|
10274
10401
|
predicate: (a: NoInfer<A>, index: number) => boolean
|
|
10275
10402
|
): Stream<A, E, R>
|
|
10403
|
+
} = dual(2, <A, E, R>(
|
|
10404
|
+
self: Stream<A, E, R>,
|
|
10405
|
+
predicate: (a: A, index: number) => boolean
|
|
10406
|
+
): Stream<A, E, R> =>
|
|
10407
|
+
transformPull(self, (pull, _scope) =>
|
|
10408
|
+
Effect.sync(() => {
|
|
10409
|
+
let dropping = true
|
|
10410
|
+
let index = 0
|
|
10411
|
+
const filtered: Pull.Pull<Arr.NonEmptyReadonlyArray<A>, E> = Effect.flatMap(pull, (arr) => {
|
|
10412
|
+
const found = arr.findIndex((a) => !predicate(a, index++))
|
|
10413
|
+
if (found === -1) return filtered
|
|
10414
|
+
dropping = false
|
|
10415
|
+
return Effect.succeed(arr.slice(found) as Arr.NonEmptyArray<A>)
|
|
10416
|
+
})
|
|
10417
|
+
return Effect.suspend(() => dropping ? filtered : pull)
|
|
10418
|
+
})))
|
|
10419
|
+
|
|
10420
|
+
/**
|
|
10421
|
+
* Drops elements while the filter succeeds.
|
|
10422
|
+
*
|
|
10423
|
+
* @since 4.0.0
|
|
10424
|
+
* @category Filtering
|
|
10425
|
+
*/
|
|
10426
|
+
export const dropWhileFilter: {
|
|
10276
10427
|
/**
|
|
10277
|
-
* Drops elements
|
|
10278
|
-
*
|
|
10279
|
-
* @example
|
|
10280
|
-
* ```ts
|
|
10281
|
-
* import { Console, Effect, Stream } from "effect"
|
|
10282
|
-
*
|
|
10283
|
-
* const program = Effect.gen(function*() {
|
|
10284
|
-
* const values = yield* Stream.make(1, 2, 3, 4, 5).pipe(
|
|
10285
|
-
* Stream.dropWhile((n) => n < 3),
|
|
10286
|
-
* Stream.runCollect
|
|
10287
|
-
* )
|
|
10288
|
-
* yield* Console.log(values)
|
|
10289
|
-
* })
|
|
10428
|
+
* Drops elements while the filter succeeds.
|
|
10290
10429
|
*
|
|
10291
|
-
*
|
|
10292
|
-
*
|
|
10293
|
-
|
|
10430
|
+
* @since 4.0.0
|
|
10431
|
+
* @category Filtering
|
|
10432
|
+
*/
|
|
10433
|
+
<A, B, X>(filter: Filter.Filter<NoInfer<A>, B, X>): <E, R>(self: Stream<A, E, R>) => Stream<A, E, R>
|
|
10434
|
+
/**
|
|
10435
|
+
* Drops elements while the filter succeeds.
|
|
10294
10436
|
*
|
|
10295
|
-
* @since
|
|
10437
|
+
* @since 4.0.0
|
|
10296
10438
|
* @category Filtering
|
|
10297
10439
|
*/
|
|
10298
|
-
<A, E, R, B, X>(self: Stream<A, E, R>,
|
|
10299
|
-
} = dual(2, <A, E, R>(
|
|
10440
|
+
<A, E, R, B, X>(self: Stream<A, E, R>, filter: Filter.Filter<NoInfer<A>, B, X>): Stream<A, E, R>
|
|
10441
|
+
} = dual(2, <A, E, R, B, X>(
|
|
10300
10442
|
self: Stream<A, E, R>,
|
|
10301
|
-
|
|
10443
|
+
filter: Filter.Filter<NoInfer<A>, B, X>
|
|
10302
10444
|
): Stream<A, E, R> =>
|
|
10303
10445
|
transformPull(self, (pull, _scope) =>
|
|
10304
10446
|
Effect.sync(() => {
|
|
10305
10447
|
let dropping = true
|
|
10306
|
-
let index = 0
|
|
10307
10448
|
const filtered: Pull.Pull<Arr.NonEmptyReadonlyArray<A>, E> = Effect.flatMap(pull, (arr) => {
|
|
10308
|
-
const found = arr.findIndex((a) => Result.isFailure(
|
|
10449
|
+
const found = arr.findIndex((a) => Result.isFailure(filter(a)))
|
|
10309
10450
|
if (found === -1) return filtered
|
|
10310
10451
|
dropping = false
|
|
10311
10452
|
return Effect.succeed(arr.slice(found) as Arr.NonEmptyArray<A>)
|
|
@@ -12174,7 +12315,7 @@ export const debounce: {
|
|
|
12174
12315
|
* @since 2.0.0
|
|
12175
12316
|
* @category Rate Limiting
|
|
12176
12317
|
*/
|
|
12177
|
-
(duration: Duration.
|
|
12318
|
+
(duration: Duration.Input): <A, E, R>(self: Stream<A, E, R>) => Stream<A, E, R>
|
|
12178
12319
|
/**
|
|
12179
12320
|
* Drops earlier elements within the debounce window and emits only the latest element after the pause.
|
|
12180
12321
|
*
|
|
@@ -12198,21 +12339,21 @@ export const debounce: {
|
|
|
12198
12339
|
* @since 2.0.0
|
|
12199
12340
|
* @category Rate Limiting
|
|
12200
12341
|
*/
|
|
12201
|
-
<A, E, R>(self: Stream<A, E, R>, duration: Duration.
|
|
12342
|
+
<A, E, R>(self: Stream<A, E, R>, duration: Duration.Input): Stream<A, E, R>
|
|
12202
12343
|
} = dual(
|
|
12203
12344
|
2,
|
|
12204
|
-
<A, E, R>(self: Stream<A, E, R>, duration: Duration.
|
|
12345
|
+
<A, E, R>(self: Stream<A, E, R>, duration: Duration.Input): Stream<A, E, R> =>
|
|
12205
12346
|
transformPull(
|
|
12206
12347
|
self,
|
|
12207
12348
|
Effect.fnUntraced(function*(pull, scope) {
|
|
12208
12349
|
const clock = yield* Clock
|
|
12209
|
-
const durationMs = Duration.toMillis(Duration.
|
|
12350
|
+
const durationMs = Duration.toMillis(Duration.fromInputUnsafe(duration))
|
|
12210
12351
|
let lastArr: Arr.NonEmptyReadonlyArray<A> | undefined
|
|
12211
12352
|
let cause: Cause.Cause<Cause.Done | E> | undefined
|
|
12212
12353
|
let emitAtMs = Infinity
|
|
12213
|
-
const pullLatch =
|
|
12214
|
-
const emitLatch =
|
|
12215
|
-
const endLatch =
|
|
12354
|
+
const pullLatch = Latch.makeUnsafe()
|
|
12355
|
+
const emitLatch = Latch.makeUnsafe()
|
|
12356
|
+
const endLatch = Latch.makeUnsafe()
|
|
12216
12357
|
|
|
12217
12358
|
yield* pull.pipe(
|
|
12218
12359
|
pullLatch.whenOpen,
|
|
@@ -12346,7 +12487,7 @@ export const throttleEffect: {
|
|
|
12346
12487
|
options: {
|
|
12347
12488
|
readonly cost: (arr: Arr.NonEmptyReadonlyArray<A>) => Effect.Effect<number, E2, R2>
|
|
12348
12489
|
readonly units: number
|
|
12349
|
-
readonly duration: Duration.
|
|
12490
|
+
readonly duration: Duration.Input
|
|
12350
12491
|
readonly burst?: number | undefined
|
|
12351
12492
|
readonly strategy?: "enforce" | "shape" | undefined
|
|
12352
12493
|
}
|
|
@@ -12392,7 +12533,7 @@ export const throttleEffect: {
|
|
|
12392
12533
|
options: {
|
|
12393
12534
|
readonly cost: (arr: Arr.NonEmptyReadonlyArray<A>) => Effect.Effect<number, E2, R2>
|
|
12394
12535
|
readonly units: number
|
|
12395
|
-
readonly duration: Duration.
|
|
12536
|
+
readonly duration: Duration.Input
|
|
12396
12537
|
readonly burst?: number | undefined
|
|
12397
12538
|
readonly strategy?: "enforce" | "shape" | undefined
|
|
12398
12539
|
}
|
|
@@ -12404,7 +12545,7 @@ export const throttleEffect: {
|
|
|
12404
12545
|
options: {
|
|
12405
12546
|
readonly cost: (arr: Arr.NonEmptyReadonlyArray<A>) => Effect.Effect<number, E2, R2>
|
|
12406
12547
|
readonly units: number
|
|
12407
|
-
readonly duration: Duration.
|
|
12548
|
+
readonly duration: Duration.Input
|
|
12408
12549
|
readonly burst?: number | undefined
|
|
12409
12550
|
readonly strategy?: "enforce" | "shape" | undefined
|
|
12410
12551
|
}
|
|
@@ -12421,12 +12562,12 @@ const throttleEnforceEffect = <A, E, R, E2, R2>(
|
|
|
12421
12562
|
self: Stream<A, E, R>,
|
|
12422
12563
|
cost: (arr: Arr.NonEmptyReadonlyArray<A>) => Effect.Effect<number, E2, R2>,
|
|
12423
12564
|
units: number,
|
|
12424
|
-
duration: Duration.
|
|
12565
|
+
duration: Duration.Input,
|
|
12425
12566
|
burst: number
|
|
12426
12567
|
): Stream<A, E | E2, R | R2> =>
|
|
12427
12568
|
transformPull(self, (pull) =>
|
|
12428
12569
|
Effect.clockWith((clock) => {
|
|
12429
|
-
const durationMs = Duration.toMillis(Duration.
|
|
12570
|
+
const durationMs = Duration.toMillis(Duration.fromInputUnsafe(duration))
|
|
12430
12571
|
const max = units + burst < 0 ? Number.POSITIVE_INFINITY : units + burst
|
|
12431
12572
|
let tokens = units
|
|
12432
12573
|
let timestampMs = clock.currentTimeMillisUnsafe()
|
|
@@ -12457,12 +12598,12 @@ const throttleShapeEffect = <A, E, R, E2, R2>(
|
|
|
12457
12598
|
self: Stream<A, E, R>,
|
|
12458
12599
|
cost: (arr: Arr.NonEmptyReadonlyArray<A>) => Effect.Effect<number, E2, R2>,
|
|
12459
12600
|
units: number,
|
|
12460
|
-
duration: Duration.
|
|
12601
|
+
duration: Duration.Input,
|
|
12461
12602
|
burst: number
|
|
12462
12603
|
): Stream<A, E | E2, R | R2> =>
|
|
12463
12604
|
transformPull(self, (pull) =>
|
|
12464
12605
|
Effect.clockWith((clock) => {
|
|
12465
|
-
const durationMs = Duration.toMillis(Duration.
|
|
12606
|
+
const durationMs = Duration.toMillis(Duration.fromInputUnsafe(duration))
|
|
12466
12607
|
const max = units + burst < 0 ? Number.POSITIVE_INFINITY : units + burst
|
|
12467
12608
|
let tokens = units
|
|
12468
12609
|
let timestampMs = clock.currentTimeMillisUnsafe()
|
|
@@ -12575,7 +12716,7 @@ export const throttle: {
|
|
|
12575
12716
|
options: {
|
|
12576
12717
|
readonly cost: (arr: Arr.NonEmptyReadonlyArray<A>) => number
|
|
12577
12718
|
readonly units: number
|
|
12578
|
-
readonly duration: Duration.
|
|
12719
|
+
readonly duration: Duration.Input
|
|
12579
12720
|
readonly burst?: number | undefined
|
|
12580
12721
|
readonly strategy?: "enforce" | "shape" | undefined
|
|
12581
12722
|
}
|
|
@@ -12620,7 +12761,7 @@ export const throttle: {
|
|
|
12620
12761
|
options: {
|
|
12621
12762
|
readonly cost: (arr: Arr.NonEmptyReadonlyArray<A>) => number
|
|
12622
12763
|
readonly units: number
|
|
12623
|
-
readonly duration: Duration.
|
|
12764
|
+
readonly duration: Duration.Input
|
|
12624
12765
|
readonly burst?: number | undefined
|
|
12625
12766
|
readonly strategy?: "enforce" | "shape" | undefined
|
|
12626
12767
|
}
|
|
@@ -12632,7 +12773,7 @@ export const throttle: {
|
|
|
12632
12773
|
options: {
|
|
12633
12774
|
readonly cost: (arr: Arr.NonEmptyReadonlyArray<A>) => number
|
|
12634
12775
|
readonly units: number
|
|
12635
|
-
readonly duration: Duration.
|
|
12776
|
+
readonly duration: Duration.Input
|
|
12636
12777
|
readonly burst?: number | undefined
|
|
12637
12778
|
readonly strategy?: "enforce" | "shape" | undefined
|
|
12638
12779
|
}
|
|
@@ -12770,7 +12911,7 @@ export const groupedWithin: {
|
|
|
12770
12911
|
* @since 2.0.0
|
|
12771
12912
|
* @category Grouping
|
|
12772
12913
|
*/
|
|
12773
|
-
(chunkSize: number, duration: Duration.
|
|
12914
|
+
(chunkSize: number, duration: Duration.Input): <A, E, R>(self: Stream<A, E, R>) => Stream<Array<A>, E, R>
|
|
12774
12915
|
/**
|
|
12775
12916
|
* Partitions the stream into arrays, emitting when the chunk size is reached
|
|
12776
12917
|
* or the duration passes.
|
|
@@ -12794,11 +12935,11 @@ export const groupedWithin: {
|
|
|
12794
12935
|
* @since 2.0.0
|
|
12795
12936
|
* @category Grouping
|
|
12796
12937
|
*/
|
|
12797
|
-
<A, E, R>(self: Stream<A, E, R>, chunkSize: number, duration: Duration.
|
|
12938
|
+
<A, E, R>(self: Stream<A, E, R>, chunkSize: number, duration: Duration.Input): Stream<Array<A>, E, R>
|
|
12798
12939
|
} = dual(3, <A, E, R>(
|
|
12799
12940
|
self: Stream<A, E, R>,
|
|
12800
12941
|
chunkSize: number,
|
|
12801
|
-
duration: Duration.
|
|
12942
|
+
duration: Duration.Input
|
|
12802
12943
|
): Stream<Array<A>, E, R> =>
|
|
12803
12944
|
aggregateWithin(
|
|
12804
12945
|
self,
|
|
@@ -12873,7 +13014,7 @@ export const groupBy: {
|
|
|
12873
13014
|
f: (a: NoInfer<A>) => Effect.Effect<readonly [K, V], E2, R2>,
|
|
12874
13015
|
options?: {
|
|
12875
13016
|
readonly bufferSize?: number | undefined
|
|
12876
|
-
readonly idleTimeToLive?: Duration.
|
|
13017
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
12877
13018
|
}
|
|
12878
13019
|
): <E, R>(self: Stream<A, E, R>) => Stream<readonly [K, Stream<V>], E | E2, R | R2>
|
|
12879
13020
|
/**
|
|
@@ -12912,7 +13053,7 @@ export const groupBy: {
|
|
|
12912
13053
|
f: (a: NoInfer<A>) => Effect.Effect<readonly [K, V], E2, R2>,
|
|
12913
13054
|
options?: {
|
|
12914
13055
|
readonly bufferSize?: number | undefined
|
|
12915
|
-
readonly idleTimeToLive?: Duration.
|
|
13056
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
12916
13057
|
}
|
|
12917
13058
|
): Stream<readonly [K, Stream<V>], E | E2, R | R2>
|
|
12918
13059
|
} = dual((args) => isStream(args[0]), <A, E, R, K, V, E2, R2>(
|
|
@@ -12920,7 +13061,7 @@ export const groupBy: {
|
|
|
12920
13061
|
f: (a: NoInfer<A>) => Effect.Effect<readonly [K, V], E2, R2>,
|
|
12921
13062
|
options?: {
|
|
12922
13063
|
readonly bufferSize?: number | undefined
|
|
12923
|
-
readonly idleTimeToLive?: Duration.
|
|
13064
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
12924
13065
|
}
|
|
12925
13066
|
): Stream<readonly [K, Stream<V>], E | E2, R | R2> =>
|
|
12926
13067
|
groupByImpl(
|
|
@@ -13002,7 +13143,7 @@ export const groupByKey: {
|
|
|
13002
13143
|
f: (a: NoInfer<A>) => K,
|
|
13003
13144
|
options?: {
|
|
13004
13145
|
readonly bufferSize?: number | undefined
|
|
13005
|
-
readonly idleTimeToLive?: Duration.
|
|
13146
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
13006
13147
|
}
|
|
13007
13148
|
): <E, R>(self: Stream<A, E, R>) => Stream<readonly [K, Stream<A>], E, R>
|
|
13008
13149
|
/**
|
|
@@ -13039,7 +13180,7 @@ export const groupByKey: {
|
|
|
13039
13180
|
f: (a: NoInfer<A>) => K,
|
|
13040
13181
|
options?: {
|
|
13041
13182
|
readonly bufferSize?: number | undefined
|
|
13042
|
-
readonly idleTimeToLive?: Duration.
|
|
13183
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
13043
13184
|
}
|
|
13044
13185
|
): Stream<readonly [K, Stream<A>], E, R>
|
|
13045
13186
|
} = dual((args) => isStream(args[0]), <A, E, R, K>(
|
|
@@ -13047,7 +13188,7 @@ export const groupByKey: {
|
|
|
13047
13188
|
f: (a: NoInfer<A>) => K,
|
|
13048
13189
|
options?: {
|
|
13049
13190
|
readonly bufferSize?: number | undefined
|
|
13050
|
-
readonly idleTimeToLive?: Duration.
|
|
13191
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
13051
13192
|
}
|
|
13052
13193
|
): Stream<readonly [K, Stream<A>], E, R> =>
|
|
13053
13194
|
suspend(() => {
|
|
@@ -13145,7 +13286,7 @@ const groupByImpl = <A, E, R, K, V, E2, R2>(
|
|
|
13145
13286
|
) => Effect.Effect<void, E2, R2>,
|
|
13146
13287
|
options?: {
|
|
13147
13288
|
readonly bufferSize?: number | undefined
|
|
13148
|
-
readonly idleTimeToLive?: Duration.
|
|
13289
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
13149
13290
|
}
|
|
13150
13291
|
): Stream<readonly [K, Stream<V>], E | E2, R | R2> =>
|
|
13151
13292
|
transformPullBracket(
|
|
@@ -13537,7 +13678,7 @@ export const aggregateWithin: {
|
|
|
13537
13678
|
fromChannel(Channel.fromTransformBracket(Effect.fnUntraced(function*(_upstream, _, scope) {
|
|
13538
13679
|
const pull = yield* Channel.toPullScoped(self.channel, _)
|
|
13539
13680
|
|
|
13540
|
-
const pullLatch =
|
|
13681
|
+
const pullLatch = Latch.makeUnsafe(false)
|
|
13541
13682
|
const scheduleStep = Symbol()
|
|
13542
13683
|
const buffer = yield* Queue.make</**
|
|
13543
13684
|
* Aggregates elements with a sink, emitting each result when the sink completes or the schedule triggers.
|
|
@@ -13596,11 +13737,9 @@ export const aggregateWithin: {
|
|
|
13596
13737
|
})
|
|
13597
13738
|
|
|
13598
13739
|
// upstream -> buffer
|
|
13599
|
-
let hadChunk = false
|
|
13600
13740
|
yield* pull.pipe(
|
|
13601
13741
|
pullLatch.whenOpen,
|
|
13602
13742
|
Effect.flatMap((arr) => {
|
|
13603
|
-
hadChunk = true
|
|
13604
13743
|
pullLatch.closeUnsafe()
|
|
13605
13744
|
return Queue.offer(buffer, arr)
|
|
13606
13745
|
}),
|
|
@@ -13637,35 +13776,44 @@ export const aggregateWithin: {
|
|
|
13637
13776
|
* @category Aggregation
|
|
13638
13777
|
*/
|
|
13639
13778
|
B>()
|
|
13779
|
+
let leftover: Arr.NonEmptyReadonlyArray<A2> | undefined
|
|
13780
|
+
let sinkHasInput = false
|
|
13640
13781
|
const step = yield* Schedule.toStepWithSleep(schedule)
|
|
13641
|
-
const stepToBuffer = Effect.suspend(()
|
|
13642
|
-
|
|
13643
|
-
|
|
13644
|
-
|
|
13645
|
-
|
|
13782
|
+
const stepToBuffer = Effect.suspend(function loop(): Pull.Pull<never, E3, void, R3> {
|
|
13783
|
+
return step(lastOutput).pipe(
|
|
13784
|
+
Effect.flatMap(() => !sinkHasInput ? loop() : Queue.offer(buffer, scheduleStep)),
|
|
13785
|
+
Effect.flatMap(() => Effect.never),
|
|
13786
|
+
Pull.catchDone(() => Cause.done())
|
|
13787
|
+
)
|
|
13788
|
+
})
|
|
13646
13789
|
|
|
13647
13790
|
// buffer -> sink
|
|
13648
13791
|
const pullFromBuffer: Pull.Pull<
|
|
13649
13792
|
Arr.NonEmptyReadonlyArray<A>,
|
|
13650
13793
|
E
|
|
13651
13794
|
> = Queue.take(buffer).pipe(
|
|
13652
|
-
Effect.flatMap((arr) =>
|
|
13795
|
+
Effect.flatMap((arr) => {
|
|
13796
|
+
if (arr === scheduleStep) {
|
|
13797
|
+
return Cause.done()
|
|
13798
|
+
}
|
|
13799
|
+
sinkHasInput = true
|
|
13800
|
+
return Effect.succeed(arr)
|
|
13801
|
+
})
|
|
13653
13802
|
)
|
|
13654
13803
|
|
|
13655
|
-
let leftover: Arr.NonEmptyReadonlyArray<A2> | undefined
|
|
13656
13804
|
const sinkUpstream = Effect.suspend((): Pull.Pull<Arr.NonEmptyReadonlyArray<A | A2>, E> => {
|
|
13657
13805
|
if (leftover !== undefined) {
|
|
13658
13806
|
const chunk = leftover
|
|
13659
13807
|
leftover = undefined
|
|
13808
|
+
sinkHasInput = true
|
|
13660
13809
|
return Effect.succeed(chunk)
|
|
13661
13810
|
}
|
|
13662
|
-
hadChunk = false
|
|
13663
13811
|
pullLatch.openUnsafe()
|
|
13664
13812
|
return pullFromBuffer
|
|
13665
13813
|
})
|
|
13666
13814
|
const catchSinkHalt = Effect.flatMap(([value, leftover_]: Sink.End<B, A2>) => {
|
|
13667
|
-
// ignore the last output if the
|
|
13668
|
-
if (!
|
|
13815
|
+
// ignore the last output if the upstream only pulled a halt
|
|
13816
|
+
if (!sinkHasInput && buffer.state._tag === "Done") return Cause.done()
|
|
13669
13817
|
lastOutput = Option.some(value)
|
|
13670
13818
|
leftover = leftover_
|
|
13671
13819
|
return Effect.succeed(Arr.of(value))
|
|
@@ -13673,9 +13821,10 @@ export const aggregateWithin: {
|
|
|
13673
13821
|
|
|
13674
13822
|
return Effect.suspend(() => {
|
|
13675
13823
|
// if the buffer has exited and there is no more data to process
|
|
13676
|
-
if (buffer.state._tag === "Done") {
|
|
13824
|
+
if (buffer.state._tag === "Done" && leftover === undefined) {
|
|
13677
13825
|
return buffer.state.exit as Exit.Exit<never, Cause.Done<void> | E>
|
|
13678
13826
|
}
|
|
13827
|
+
sinkHasInput = leftover !== undefined
|
|
13679
13828
|
return Effect.succeed(Effect.suspend(() => sink.transform(sinkUpstream as any, scope)))
|
|
13680
13829
|
}).pipe(
|
|
13681
13830
|
Effect.flatMap((pull) => Effect.raceFirst(catchSinkHalt(pull), stepToBuffer))
|
|
@@ -13879,12 +14028,12 @@ export const share: {
|
|
|
13879
14028
|
options: {
|
|
13880
14029
|
readonly capacity: "unbounded"
|
|
13881
14030
|
readonly replay?: number | undefined
|
|
13882
|
-
readonly idleTimeToLive?: Duration.
|
|
14031
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
13883
14032
|
} | {
|
|
13884
14033
|
readonly capacity: number
|
|
13885
14034
|
readonly strategy?: "sliding" | "dropping" | "suspend" | undefined
|
|
13886
14035
|
readonly replay?: number | undefined
|
|
13887
|
-
readonly idleTimeToLive?: Duration.
|
|
14036
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
13888
14037
|
}
|
|
13889
14038
|
): <A, E, R>(self: Stream<A, E, R>) => Effect.Effect<Stream<A, E>, never, Scope.Scope | R>
|
|
13890
14039
|
/**
|
|
@@ -13923,12 +14072,12 @@ export const share: {
|
|
|
13923
14072
|
options: {
|
|
13924
14073
|
readonly capacity: "unbounded"
|
|
13925
14074
|
readonly replay?: number | undefined
|
|
13926
|
-
readonly idleTimeToLive?: Duration.
|
|
14075
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
13927
14076
|
} | {
|
|
13928
14077
|
readonly capacity: number
|
|
13929
14078
|
readonly strategy?: "sliding" | "dropping" | "suspend" | undefined
|
|
13930
14079
|
readonly replay?: number | undefined
|
|
13931
|
-
readonly idleTimeToLive?: Duration.
|
|
14080
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
13932
14081
|
}
|
|
13933
14082
|
): Effect.Effect<Stream<A, E>, never, Scope.Scope | R>
|
|
13934
14083
|
} = dual(2, <A, E, R>(
|
|
@@ -13936,12 +14085,12 @@ export const share: {
|
|
|
13936
14085
|
options: {
|
|
13937
14086
|
readonly capacity: "unbounded"
|
|
13938
14087
|
readonly replay?: number | undefined
|
|
13939
|
-
readonly idleTimeToLive?: Duration.
|
|
14088
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
13940
14089
|
} | {
|
|
13941
14090
|
readonly capacity: number
|
|
13942
14091
|
readonly strategy?: "sliding" | "dropping" | "suspend" | undefined
|
|
13943
14092
|
readonly replay?: number | undefined
|
|
13944
|
-
readonly idleTimeToLive?: Duration.
|
|
14093
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
13945
14094
|
}
|
|
13946
14095
|
): Effect.Effect<Stream<A, E>, never, Scope.Scope | R> =>
|
|
13947
14096
|
Effect.map(
|
|
@@ -15806,7 +15955,7 @@ export const ensuring: {
|
|
|
15806
15955
|
)
|
|
15807
15956
|
|
|
15808
15957
|
/**
|
|
15809
|
-
* Provides a layer or
|
|
15958
|
+
* Provides a layer or context to the stream, removing the corresponding
|
|
15810
15959
|
* service requirements. Use `options.local` to build the layer every time; by
|
|
15811
15960
|
* default, layers are shared between provide calls.
|
|
15812
15961
|
*
|
|
@@ -15814,9 +15963,9 @@ export const ensuring: {
|
|
|
15814
15963
|
*
|
|
15815
15964
|
* @example
|
|
15816
15965
|
* ```ts
|
|
15817
|
-
* import { Console, Effect, Layer,
|
|
15966
|
+
* import { Console, Effect, Layer, Context, Stream } from "effect"
|
|
15818
15967
|
*
|
|
15819
|
-
* class Env extends
|
|
15968
|
+
* class Env extends Context.Service<Env, { readonly name: string }>()("Env") {}
|
|
15820
15969
|
*
|
|
15821
15970
|
* const layer = Layer.succeed(Env)({ name: "Ada" })
|
|
15822
15971
|
*
|
|
@@ -15843,7 +15992,7 @@ export const ensuring: {
|
|
|
15843
15992
|
*/
|
|
15844
15993
|
export const provide: {
|
|
15845
15994
|
/**
|
|
15846
|
-
* Provides a layer or
|
|
15995
|
+
* Provides a layer or context to the stream, removing the corresponding
|
|
15847
15996
|
* service requirements. Use `options.local` to build the layer every time; by
|
|
15848
15997
|
* default, layers are shared between provide calls.
|
|
15849
15998
|
*
|
|
@@ -15851,9 +16000,9 @@ export const provide: {
|
|
|
15851
16000
|
*
|
|
15852
16001
|
* @example
|
|
15853
16002
|
* ```ts
|
|
15854
|
-
* import { Console, Effect, Layer,
|
|
16003
|
+
* import { Console, Effect, Layer, Context, Stream } from "effect"
|
|
15855
16004
|
*
|
|
15856
|
-
* class Env extends
|
|
16005
|
+
* class Env extends Context.Service<Env, { readonly name: string }>()("Env") {}
|
|
15857
16006
|
*
|
|
15858
16007
|
* const layer = Layer.succeed(Env)({ name: "Ada" })
|
|
15859
16008
|
*
|
|
@@ -15879,7 +16028,7 @@ export const provide: {
|
|
|
15879
16028
|
* @category Services
|
|
15880
16029
|
*/
|
|
15881
16030
|
<AL, EL = never, RL = never>(
|
|
15882
|
-
layer: Layer.Layer<AL, EL, RL> |
|
|
16031
|
+
layer: Layer.Layer<AL, EL, RL> | Context.Context<AL>,
|
|
15883
16032
|
options?: {
|
|
15884
16033
|
readonly local?: boolean | undefined
|
|
15885
16034
|
} | undefined
|
|
@@ -15887,7 +16036,7 @@ export const provide: {
|
|
|
15887
16036
|
self: Stream<A, E, R>
|
|
15888
16037
|
) => Stream<A, E | EL, Exclude<R, AL> | RL>
|
|
15889
16038
|
/**
|
|
15890
|
-
* Provides a layer or
|
|
16039
|
+
* Provides a layer or context to the stream, removing the corresponding
|
|
15891
16040
|
* service requirements. Use `options.local` to build the layer every time; by
|
|
15892
16041
|
* default, layers are shared between provide calls.
|
|
15893
16042
|
*
|
|
@@ -15895,9 +16044,9 @@ export const provide: {
|
|
|
15895
16044
|
*
|
|
15896
16045
|
* @example
|
|
15897
16046
|
* ```ts
|
|
15898
|
-
* import { Console, Effect, Layer,
|
|
16047
|
+
* import { Console, Effect, Layer, Context, Stream } from "effect"
|
|
15899
16048
|
*
|
|
15900
|
-
* class Env extends
|
|
16049
|
+
* class Env extends Context.Service<Env, { readonly name: string }>()("Env") {}
|
|
15901
16050
|
*
|
|
15902
16051
|
* const layer = Layer.succeed(Env)({ name: "Ada" })
|
|
15903
16052
|
*
|
|
@@ -15924,31 +16073,31 @@ export const provide: {
|
|
|
15924
16073
|
*/
|
|
15925
16074
|
<A, E, R, AL, EL = never, RL = never>(
|
|
15926
16075
|
self: Stream<A, E, R>,
|
|
15927
|
-
layer: Layer.Layer<AL, EL, RL> |
|
|
16076
|
+
layer: Layer.Layer<AL, EL, RL> | Context.Context<AL>,
|
|
15928
16077
|
options?: {
|
|
15929
16078
|
readonly local?: boolean | undefined
|
|
15930
16079
|
} | undefined
|
|
15931
16080
|
): Stream<A, E | EL, Exclude<R, AL> | RL>
|
|
15932
16081
|
} = dual((args) => isStream(args[0]), <A, E, R, AL, EL = never, RL = never>(
|
|
15933
16082
|
self: Stream<A, E, R>,
|
|
15934
|
-
layer: Layer.Layer<AL, EL, RL> |
|
|
16083
|
+
layer: Layer.Layer<AL, EL, RL> | Context.Context<AL>,
|
|
15935
16084
|
options?: {
|
|
15936
16085
|
readonly local?: boolean | undefined
|
|
15937
16086
|
} | undefined
|
|
15938
16087
|
): Stream<A, E | EL, Exclude<R, AL> | RL> => fromChannel(Channel.provide(self.channel, layer, options)))
|
|
15939
16088
|
|
|
15940
16089
|
/**
|
|
15941
|
-
* Provides multiple services to the stream using a
|
|
16090
|
+
* Provides multiple services to the stream using a context.
|
|
15942
16091
|
*
|
|
15943
16092
|
* @example
|
|
15944
16093
|
* ```ts
|
|
15945
|
-
* import { Console, Effect,
|
|
16094
|
+
* import { Console, Effect, Context, Stream } from "effect"
|
|
15946
16095
|
*
|
|
15947
|
-
* class Config extends
|
|
15948
|
-
* class Greeter extends
|
|
16096
|
+
* class Config extends Context.Service<Config, { readonly prefix: string }>()("Config") {}
|
|
16097
|
+
* class Greeter extends Context.Service<Greeter, { greet: (name: string) => string }>()("Greeter") {}
|
|
15949
16098
|
*
|
|
15950
|
-
* const
|
|
15951
|
-
*
|
|
16099
|
+
* const context = Context.make(Config, { prefix: "Hello" }).pipe(
|
|
16100
|
+
* Context.add(Greeter, { greet: (name: string) => `${name}!` })
|
|
15952
16101
|
* )
|
|
15953
16102
|
*
|
|
15954
16103
|
* const stream = Stream.fromEffect(
|
|
@@ -15960,7 +16109,7 @@ export const provide: {
|
|
|
15960
16109
|
* )
|
|
15961
16110
|
*
|
|
15962
16111
|
* const program = Effect.gen(function*() {
|
|
15963
|
-
* const result = yield* Stream.runCollect(Stream.
|
|
16112
|
+
* const result = yield* Stream.runCollect(Stream.provideContext(stream, context))
|
|
15964
16113
|
* yield* Console.log(result)
|
|
15965
16114
|
* })
|
|
15966
16115
|
*
|
|
@@ -15971,19 +16120,19 @@ export const provide: {
|
|
|
15971
16120
|
* @since 4.0.0
|
|
15972
16121
|
* @category Services
|
|
15973
16122
|
*/
|
|
15974
|
-
export const
|
|
16123
|
+
export const provideContext: {
|
|
15975
16124
|
/**
|
|
15976
|
-
* Provides multiple services to the stream using a
|
|
16125
|
+
* Provides multiple services to the stream using a context.
|
|
15977
16126
|
*
|
|
15978
16127
|
* @example
|
|
15979
16128
|
* ```ts
|
|
15980
|
-
* import { Console, Effect,
|
|
16129
|
+
* import { Console, Effect, Context, Stream } from "effect"
|
|
15981
16130
|
*
|
|
15982
|
-
* class Config extends
|
|
15983
|
-
* class Greeter extends
|
|
16131
|
+
* class Config extends Context.Service<Config, { readonly prefix: string }>()("Config") {}
|
|
16132
|
+
* class Greeter extends Context.Service<Greeter, { greet: (name: string) => string }>()("Greeter") {}
|
|
15984
16133
|
*
|
|
15985
|
-
* const
|
|
15986
|
-
*
|
|
16134
|
+
* const context = Context.make(Config, { prefix: "Hello" }).pipe(
|
|
16135
|
+
* Context.add(Greeter, { greet: (name: string) => `${name}!` })
|
|
15987
16136
|
* )
|
|
15988
16137
|
*
|
|
15989
16138
|
* const stream = Stream.fromEffect(
|
|
@@ -15995,7 +16144,7 @@ export const provideServices: {
|
|
|
15995
16144
|
* )
|
|
15996
16145
|
*
|
|
15997
16146
|
* const program = Effect.gen(function*() {
|
|
15998
|
-
* const result = yield* Stream.runCollect(Stream.
|
|
16147
|
+
* const result = yield* Stream.runCollect(Stream.provideContext(stream, context))
|
|
15999
16148
|
* yield* Console.log(result)
|
|
16000
16149
|
* })
|
|
16001
16150
|
*
|
|
@@ -16006,19 +16155,19 @@ export const provideServices: {
|
|
|
16006
16155
|
* @since 4.0.0
|
|
16007
16156
|
* @category Services
|
|
16008
16157
|
*/
|
|
16009
|
-
<R2>(
|
|
16158
|
+
<R2>(context: Context.Context<R2>): <A, E, R>(self: Stream<A, E, R>) => Stream<A, E, Exclude<R, R2>>
|
|
16010
16159
|
/**
|
|
16011
|
-
* Provides multiple services to the stream using a
|
|
16160
|
+
* Provides multiple services to the stream using a context.
|
|
16012
16161
|
*
|
|
16013
16162
|
* @example
|
|
16014
16163
|
* ```ts
|
|
16015
|
-
* import { Console, Effect,
|
|
16164
|
+
* import { Console, Effect, Context, Stream } from "effect"
|
|
16016
16165
|
*
|
|
16017
|
-
* class Config extends
|
|
16018
|
-
* class Greeter extends
|
|
16166
|
+
* class Config extends Context.Service<Config, { readonly prefix: string }>()("Config") {}
|
|
16167
|
+
* class Greeter extends Context.Service<Greeter, { greet: (name: string) => string }>()("Greeter") {}
|
|
16019
16168
|
*
|
|
16020
|
-
* const
|
|
16021
|
-
*
|
|
16169
|
+
* const context = Context.make(Config, { prefix: "Hello" }).pipe(
|
|
16170
|
+
* Context.add(Greeter, { greet: (name: string) => `${name}!` })
|
|
16022
16171
|
* )
|
|
16023
16172
|
*
|
|
16024
16173
|
* const stream = Stream.fromEffect(
|
|
@@ -16030,7 +16179,7 @@ export const provideServices: {
|
|
|
16030
16179
|
* )
|
|
16031
16180
|
*
|
|
16032
16181
|
* const program = Effect.gen(function*() {
|
|
16033
|
-
* const result = yield* Stream.runCollect(Stream.
|
|
16182
|
+
* const result = yield* Stream.runCollect(Stream.provideContext(stream, context))
|
|
16034
16183
|
* yield* Console.log(result)
|
|
16035
16184
|
* })
|
|
16036
16185
|
*
|
|
@@ -16041,11 +16190,11 @@ export const provideServices: {
|
|
|
16041
16190
|
* @since 4.0.0
|
|
16042
16191
|
* @category Services
|
|
16043
16192
|
*/
|
|
16044
|
-
<A, E, R, R2>(self: Stream<A, E, R>,
|
|
16193
|
+
<A, E, R, R2>(self: Stream<A, E, R>, context: Context.Context<R2>): Stream<A, E, Exclude<R, R2>>
|
|
16045
16194
|
} = dual(
|
|
16046
16195
|
2,
|
|
16047
|
-
<A, E, R, R2>(self: Stream<A, E, R>,
|
|
16048
|
-
fromChannel(Channel.
|
|
16196
|
+
<A, E, R, R2>(self: Stream<A, E, R>, context: Context.Context<R2>): Stream<A, E, Exclude<R, R2>> =>
|
|
16197
|
+
fromChannel(Channel.provideContext(self.channel, context))
|
|
16049
16198
|
)
|
|
16050
16199
|
|
|
16051
16200
|
/**
|
|
@@ -16054,9 +16203,9 @@ export const provideServices: {
|
|
|
16054
16203
|
*
|
|
16055
16204
|
* @example
|
|
16056
16205
|
* ```ts
|
|
16057
|
-
* import { Console, Effect,
|
|
16206
|
+
* import { Console, Effect, Context, Stream } from "effect"
|
|
16058
16207
|
*
|
|
16059
|
-
* class Greeter extends
|
|
16208
|
+
* class Greeter extends Context.Service<Greeter, {
|
|
16060
16209
|
* greet: (name: string) => string
|
|
16061
16210
|
* }>()("Greeter") {}
|
|
16062
16211
|
*
|
|
@@ -16091,9 +16240,9 @@ export const provideService: {
|
|
|
16091
16240
|
*
|
|
16092
16241
|
* @example
|
|
16093
16242
|
* ```ts
|
|
16094
|
-
* import { Console, Effect,
|
|
16243
|
+
* import { Console, Effect, Context, Stream } from "effect"
|
|
16095
16244
|
*
|
|
16096
|
-
* class Greeter extends
|
|
16245
|
+
* class Greeter extends Context.Service<Greeter, {
|
|
16097
16246
|
* greet: (name: string) => string
|
|
16098
16247
|
* }>()("Greeter") {}
|
|
16099
16248
|
*
|
|
@@ -16121,7 +16270,7 @@ export const provideService: {
|
|
|
16121
16270
|
* @since 4.0.0
|
|
16122
16271
|
* @category Services
|
|
16123
16272
|
*/
|
|
16124
|
-
<I, S>(key:
|
|
16273
|
+
<I, S>(key: Context.Key<I, S>, service: NoInfer<S>): <A, E, R>(
|
|
16125
16274
|
self: Stream<A, E, R>
|
|
16126
16275
|
) => Stream<A, E, Exclude<R, I>>
|
|
16127
16276
|
/**
|
|
@@ -16130,9 +16279,9 @@ export const provideService: {
|
|
|
16130
16279
|
*
|
|
16131
16280
|
* @example
|
|
16132
16281
|
* ```ts
|
|
16133
|
-
* import { Console, Effect,
|
|
16282
|
+
* import { Console, Effect, Context, Stream } from "effect"
|
|
16134
16283
|
*
|
|
16135
|
-
* class Greeter extends
|
|
16284
|
+
* class Greeter extends Context.Service<Greeter, {
|
|
16136
16285
|
* greet: (name: string) => string
|
|
16137
16286
|
* }>()("Greeter") {}
|
|
16138
16287
|
*
|
|
@@ -16160,10 +16309,10 @@ export const provideService: {
|
|
|
16160
16309
|
* @since 4.0.0
|
|
16161
16310
|
* @category Services
|
|
16162
16311
|
*/
|
|
16163
|
-
<A, E, R, I, S>(self: Stream<A, E, R>, key:
|
|
16312
|
+
<A, E, R, I, S>(self: Stream<A, E, R>, key: Context.Key<I, S>, service: NoInfer<S>): Stream<A, E, Exclude<R, I>>
|
|
16164
16313
|
} = dual(3, <A, E, R, I, S>(
|
|
16165
16314
|
self: Stream<A, E, R>,
|
|
16166
|
-
key:
|
|
16315
|
+
key: Context.Key<I, S>,
|
|
16167
16316
|
service: NoInfer<S>
|
|
16168
16317
|
): Stream<A, E, Exclude<R, I>> => fromChannel(Channel.provideService(self.channel, key, service)))
|
|
16169
16318
|
|
|
@@ -16172,9 +16321,9 @@ export const provideService: {
|
|
|
16172
16321
|
*
|
|
16173
16322
|
* @example
|
|
16174
16323
|
* ```ts
|
|
16175
|
-
* import { Console, Effect,
|
|
16324
|
+
* import { Console, Effect, Context, Stream } from "effect"
|
|
16176
16325
|
*
|
|
16177
|
-
* class ApiConfig extends
|
|
16326
|
+
* class ApiConfig extends Context.Service<ApiConfig, { readonly baseUrl: string }>()("ApiConfig") {}
|
|
16178
16327
|
*
|
|
16179
16328
|
* const stream = Stream.fromEffect(
|
|
16180
16329
|
* Effect.gen(function*() {
|
|
@@ -16211,9 +16360,9 @@ export const provideServiceEffect: {
|
|
|
16211
16360
|
*
|
|
16212
16361
|
* @example
|
|
16213
16362
|
* ```ts
|
|
16214
|
-
* import { Console, Effect,
|
|
16363
|
+
* import { Console, Effect, Context, Stream } from "effect"
|
|
16215
16364
|
*
|
|
16216
|
-
* class ApiConfig extends
|
|
16365
|
+
* class ApiConfig extends Context.Service<ApiConfig, { readonly baseUrl: string }>()("ApiConfig") {}
|
|
16217
16366
|
*
|
|
16218
16367
|
* const stream = Stream.fromEffect(
|
|
16219
16368
|
* Effect.gen(function*() {
|
|
@@ -16244,7 +16393,7 @@ export const provideServiceEffect: {
|
|
|
16244
16393
|
* @since 4.0.0
|
|
16245
16394
|
* @category Services
|
|
16246
16395
|
*/
|
|
16247
|
-
<I, S, ES, RS>(key:
|
|
16396
|
+
<I, S, ES, RS>(key: Context.Key<I, S>, service: Effect.Effect<NoInfer<S>, ES, RS>): <A, E, R>(
|
|
16248
16397
|
self: Stream<A, E, R>
|
|
16249
16398
|
) => Stream<A, E | ES, Exclude<R, I> | RS>
|
|
16250
16399
|
/**
|
|
@@ -16252,9 +16401,9 @@ export const provideServiceEffect: {
|
|
|
16252
16401
|
*
|
|
16253
16402
|
* @example
|
|
16254
16403
|
* ```ts
|
|
16255
|
-
* import { Console, Effect,
|
|
16404
|
+
* import { Console, Effect, Context, Stream } from "effect"
|
|
16256
16405
|
*
|
|
16257
|
-
* class ApiConfig extends
|
|
16406
|
+
* class ApiConfig extends Context.Service<ApiConfig, { readonly baseUrl: string }>()("ApiConfig") {}
|
|
16258
16407
|
*
|
|
16259
16408
|
* const stream = Stream.fromEffect(
|
|
16260
16409
|
* Effect.gen(function*() {
|
|
@@ -16287,25 +16436,25 @@ export const provideServiceEffect: {
|
|
|
16287
16436
|
*/
|
|
16288
16437
|
<A, E, R, I, S, ES, RS>(
|
|
16289
16438
|
self: Stream<A, E, R>,
|
|
16290
|
-
key:
|
|
16439
|
+
key: Context.Key<I, S>,
|
|
16291
16440
|
service: Effect.Effect<NoInfer<S>, ES, RS>
|
|
16292
16441
|
): Stream<A, E | ES, Exclude<R, I> | RS>
|
|
16293
16442
|
} = dual(3, <A, E, R, I, S, ES, RS>(
|
|
16294
16443
|
self: Stream<A, E, R>,
|
|
16295
|
-
key:
|
|
16444
|
+
key: Context.Key<I, S>,
|
|
16296
16445
|
service: Effect.Effect<NoInfer<S>, ES, RS>
|
|
16297
16446
|
): Stream<A, E | ES, Exclude<R, I> | RS> => fromChannel(Channel.provideServiceEffect(self.channel, key, service)))
|
|
16298
16447
|
|
|
16299
16448
|
/**
|
|
16300
|
-
* Transforms the stream's required services by mapping the current
|
|
16449
|
+
* Transforms the stream's required services by mapping the current context
|
|
16301
16450
|
* to a new one.
|
|
16302
16451
|
*
|
|
16303
16452
|
* @example
|
|
16304
16453
|
* ```ts
|
|
16305
|
-
* import { Console, Effect,
|
|
16454
|
+
* import { Console, Effect, Context, Stream } from "effect"
|
|
16306
16455
|
*
|
|
16307
|
-
* class Logger extends
|
|
16308
|
-
* class Config extends
|
|
16456
|
+
* class Logger extends Context.Service<Logger, { prefix: string }>()("Logger") {}
|
|
16457
|
+
* class Config extends Context.Service<Config, { name: string }>()("Config") {}
|
|
16309
16458
|
*
|
|
16310
16459
|
* const stream = Stream.fromEffect(
|
|
16311
16460
|
* Effect.gen(function*() {
|
|
@@ -16316,8 +16465,8 @@ export const provideServiceEffect: {
|
|
|
16316
16465
|
* )
|
|
16317
16466
|
*
|
|
16318
16467
|
* const updated = stream.pipe(
|
|
16319
|
-
* Stream.
|
|
16320
|
-
*
|
|
16468
|
+
* Stream.updateContext((context: Context.Context<Logger>) =>
|
|
16469
|
+
* Context.add(context, Config, { name: "World" })
|
|
16321
16470
|
* )
|
|
16322
16471
|
* )
|
|
16323
16472
|
*
|
|
@@ -16335,17 +16484,17 @@ export const provideServiceEffect: {
|
|
|
16335
16484
|
* @since 2.0.0
|
|
16336
16485
|
* @category Services
|
|
16337
16486
|
*/
|
|
16338
|
-
export const
|
|
16487
|
+
export const updateContext: {
|
|
16339
16488
|
/**
|
|
16340
|
-
* Transforms the stream's required services by mapping the current
|
|
16489
|
+
* Transforms the stream's required services by mapping the current context
|
|
16341
16490
|
* to a new one.
|
|
16342
16491
|
*
|
|
16343
16492
|
* @example
|
|
16344
16493
|
* ```ts
|
|
16345
|
-
* import { Console, Effect,
|
|
16494
|
+
* import { Console, Effect, Context, Stream } from "effect"
|
|
16346
16495
|
*
|
|
16347
|
-
* class Logger extends
|
|
16348
|
-
* class Config extends
|
|
16496
|
+
* class Logger extends Context.Service<Logger, { prefix: string }>()("Logger") {}
|
|
16497
|
+
* class Config extends Context.Service<Config, { name: string }>()("Config") {}
|
|
16349
16498
|
*
|
|
16350
16499
|
* const stream = Stream.fromEffect(
|
|
16351
16500
|
* Effect.gen(function*() {
|
|
@@ -16356,8 +16505,8 @@ export const updateServices: {
|
|
|
16356
16505
|
* )
|
|
16357
16506
|
*
|
|
16358
16507
|
* const updated = stream.pipe(
|
|
16359
|
-
* Stream.
|
|
16360
|
-
*
|
|
16508
|
+
* Stream.updateContext((context: Context.Context<Logger>) =>
|
|
16509
|
+
* Context.add(context, Config, { name: "World" })
|
|
16361
16510
|
* )
|
|
16362
16511
|
* )
|
|
16363
16512
|
*
|
|
@@ -16375,19 +16524,19 @@ export const updateServices: {
|
|
|
16375
16524
|
* @since 2.0.0
|
|
16376
16525
|
* @category Services
|
|
16377
16526
|
*/
|
|
16378
|
-
<R, R2>(f: (
|
|
16527
|
+
<R, R2>(f: (context: Context.Context<R2>) => Context.Context<R>): <A, E>(
|
|
16379
16528
|
self: Stream<A, E, R>
|
|
16380
16529
|
) => Stream<A, E, R2>
|
|
16381
16530
|
/**
|
|
16382
|
-
* Transforms the stream's required services by mapping the current
|
|
16531
|
+
* Transforms the stream's required services by mapping the current context
|
|
16383
16532
|
* to a new one.
|
|
16384
16533
|
*
|
|
16385
16534
|
* @example
|
|
16386
16535
|
* ```ts
|
|
16387
|
-
* import { Console, Effect,
|
|
16536
|
+
* import { Console, Effect, Context, Stream } from "effect"
|
|
16388
16537
|
*
|
|
16389
|
-
* class Logger extends
|
|
16390
|
-
* class Config extends
|
|
16538
|
+
* class Logger extends Context.Service<Logger, { prefix: string }>()("Logger") {}
|
|
16539
|
+
* class Config extends Context.Service<Config, { name: string }>()("Config") {}
|
|
16391
16540
|
*
|
|
16392
16541
|
* const stream = Stream.fromEffect(
|
|
16393
16542
|
* Effect.gen(function*() {
|
|
@@ -16398,8 +16547,8 @@ export const updateServices: {
|
|
|
16398
16547
|
* )
|
|
16399
16548
|
*
|
|
16400
16549
|
* const updated = stream.pipe(
|
|
16401
|
-
* Stream.
|
|
16402
|
-
*
|
|
16550
|
+
* Stream.updateContext((context: Context.Context<Logger>) =>
|
|
16551
|
+
* Context.add(context, Config, { name: "World" })
|
|
16403
16552
|
* )
|
|
16404
16553
|
* )
|
|
16405
16554
|
*
|
|
@@ -16419,21 +16568,21 @@ export const updateServices: {
|
|
|
16419
16568
|
*/
|
|
16420
16569
|
<A, E, R, R2>(
|
|
16421
16570
|
self: Stream<A, E, R>,
|
|
16422
|
-
f: (
|
|
16571
|
+
f: (context: Context.Context<R2>) => Context.Context<R>
|
|
16423
16572
|
): Stream<A, E, R2>
|
|
16424
16573
|
} = dual(2, <A, E, R, R2>(
|
|
16425
16574
|
self: Stream<A, E, R>,
|
|
16426
|
-
f: (
|
|
16427
|
-
): Stream<A, E, R2> => fromChannel(Channel.
|
|
16575
|
+
f: (context: Context.Context<R2>) => Context.Context<R>
|
|
16576
|
+
): Stream<A, E, R2> => fromChannel(Channel.updateContext(self.channel, f)))
|
|
16428
16577
|
|
|
16429
16578
|
/**
|
|
16430
16579
|
* Updates a single service in the stream environment by applying a function.
|
|
16431
16580
|
*
|
|
16432
16581
|
* @example
|
|
16433
16582
|
* ```ts
|
|
16434
|
-
* import { Console, Effect,
|
|
16583
|
+
* import { Console, Effect, Context, Stream } from "effect"
|
|
16435
16584
|
*
|
|
16436
|
-
* class Counter extends
|
|
16585
|
+
* class Counter extends Context.Service<Counter, { count: number }>()("Counter") {}
|
|
16437
16586
|
*
|
|
16438
16587
|
* const stream = Stream.fromEffect(Effect.service(Counter)).pipe(
|
|
16439
16588
|
* Stream.updateService(Counter, (counter) => ({ count: counter.count + 1 }))
|
|
@@ -16457,9 +16606,9 @@ export const updateService: {
|
|
|
16457
16606
|
*
|
|
16458
16607
|
* @example
|
|
16459
16608
|
* ```ts
|
|
16460
|
-
* import { Console, Effect,
|
|
16609
|
+
* import { Console, Effect, Context, Stream } from "effect"
|
|
16461
16610
|
*
|
|
16462
|
-
* class Counter extends
|
|
16611
|
+
* class Counter extends Context.Service<Counter, { count: number }>()("Counter") {}
|
|
16463
16612
|
*
|
|
16464
16613
|
* const stream = Stream.fromEffect(Effect.service(Counter)).pipe(
|
|
16465
16614
|
* Stream.updateService(Counter, (counter) => ({ count: counter.count + 1 }))
|
|
@@ -16477,7 +16626,7 @@ export const updateService: {
|
|
|
16477
16626
|
* @since 2.0.0
|
|
16478
16627
|
* @category Services
|
|
16479
16628
|
*/
|
|
16480
|
-
<I, S>(key:
|
|
16629
|
+
<I, S>(key: Context.Key<I, S>, f: (service: NoInfer<S>) => S): <A, E, R>(
|
|
16481
16630
|
self: Stream<A, E, R>
|
|
16482
16631
|
) => Stream<A, E, R | I>
|
|
16483
16632
|
/**
|
|
@@ -16485,9 +16634,9 @@ export const updateService: {
|
|
|
16485
16634
|
*
|
|
16486
16635
|
* @example
|
|
16487
16636
|
* ```ts
|
|
16488
|
-
* import { Console, Effect,
|
|
16637
|
+
* import { Console, Effect, Context, Stream } from "effect"
|
|
16489
16638
|
*
|
|
16490
|
-
* class Counter extends
|
|
16639
|
+
* class Counter extends Context.Service<Counter, { count: number }>()("Counter") {}
|
|
16491
16640
|
*
|
|
16492
16641
|
* const stream = Stream.fromEffect(Effect.service(Counter)).pipe(
|
|
16493
16642
|
* Stream.updateService(Counter, (counter) => ({ count: counter.count + 1 }))
|
|
@@ -16507,19 +16656,19 @@ export const updateService: {
|
|
|
16507
16656
|
*/
|
|
16508
16657
|
<A, E, R, I, S>(
|
|
16509
16658
|
self: Stream<A, E, R>,
|
|
16510
|
-
key:
|
|
16659
|
+
key: Context.Key<I, S>,
|
|
16511
16660
|
f: (service: NoInfer<S>) => S
|
|
16512
16661
|
): Stream<A, E, R | I>
|
|
16513
16662
|
} = dual(3, <A, E, R, I, S>(
|
|
16514
16663
|
self: Stream<A, E, R>,
|
|
16515
|
-
service:
|
|
16664
|
+
service: Context.Key<I, S>,
|
|
16516
16665
|
f: (service: NoInfer<S>) => S
|
|
16517
16666
|
): Stream<A, E, R | I> =>
|
|
16518
|
-
|
|
16519
|
-
|
|
16520
|
-
|
|
16667
|
+
updateContext(self, (context) =>
|
|
16668
|
+
Context.add(
|
|
16669
|
+
context,
|
|
16521
16670
|
service,
|
|
16522
|
-
f(
|
|
16671
|
+
f(Context.get(context, service))
|
|
16523
16672
|
)))
|
|
16524
16673
|
|
|
16525
16674
|
/**
|
|
@@ -16591,7 +16740,7 @@ export const withSpan: {
|
|
|
16591
16740
|
} = function() {
|
|
16592
16741
|
const dataFirst = isStream(arguments[0])
|
|
16593
16742
|
const name = dataFirst ? arguments[1] : arguments[0]
|
|
16594
|
-
const options = addSpanStackTrace(dataFirst ? arguments[
|
|
16743
|
+
const options = addSpanStackTrace(dataFirst ? arguments[2] : arguments[1])
|
|
16595
16744
|
if (dataFirst) {
|
|
16596
16745
|
const self = arguments[0] as Stream<any, any, any>
|
|
16597
16746
|
return fromChannel(Channel.withSpan(self.channel, name, options))
|
|
@@ -17687,10 +17836,10 @@ export const mkUint8Array = <E, R>(self: Stream<Uint8Array, E, R>): Effect.Effec
|
|
|
17687
17836
|
*
|
|
17688
17837
|
* @example
|
|
17689
17838
|
* ```ts
|
|
17690
|
-
* import {
|
|
17839
|
+
* import { Context, Stream } from "effect"
|
|
17691
17840
|
*
|
|
17692
17841
|
* const stream = Stream.make(1, 2, 3, 4, 5)
|
|
17693
|
-
* const readableStream = Stream.toReadableStreamWith(stream,
|
|
17842
|
+
* const readableStream = Stream.toReadableStreamWith(stream, Context.empty())
|
|
17694
17843
|
* ```
|
|
17695
17844
|
*
|
|
17696
17845
|
* @since 2.0.0
|
|
@@ -17704,17 +17853,17 @@ export const toReadableStreamWith = dual<
|
|
|
17704
17853
|
*
|
|
17705
17854
|
* @example
|
|
17706
17855
|
* ```ts
|
|
17707
|
-
* import {
|
|
17856
|
+
* import { Context, Stream } from "effect"
|
|
17708
17857
|
*
|
|
17709
17858
|
* const stream = Stream.make(1, 2, 3, 4, 5)
|
|
17710
|
-
* const readableStream = Stream.toReadableStreamWith(stream,
|
|
17859
|
+
* const readableStream = Stream.toReadableStreamWith(stream, Context.empty())
|
|
17711
17860
|
* ```
|
|
17712
17861
|
*
|
|
17713
17862
|
* @since 2.0.0
|
|
17714
17863
|
* @category Destructors
|
|
17715
17864
|
*/
|
|
17716
17865
|
<A, XR>(
|
|
17717
|
-
|
|
17866
|
+
context: Context.Context<XR>,
|
|
17718
17867
|
options?: { readonly strategy?: QueuingStrategy<A> | undefined }
|
|
17719
17868
|
) => <E, R extends XR>(self: Stream<A, E, R>) => ReadableStream<A>,
|
|
17720
17869
|
/**
|
|
@@ -17724,10 +17873,10 @@ export const toReadableStreamWith = dual<
|
|
|
17724
17873
|
*
|
|
17725
17874
|
* @example
|
|
17726
17875
|
* ```ts
|
|
17727
|
-
* import {
|
|
17876
|
+
* import { Context, Stream } from "effect"
|
|
17728
17877
|
*
|
|
17729
17878
|
* const stream = Stream.make(1, 2, 3, 4, 5)
|
|
17730
|
-
* const readableStream = Stream.toReadableStreamWith(stream,
|
|
17879
|
+
* const readableStream = Stream.toReadableStreamWith(stream, Context.empty())
|
|
17731
17880
|
* ```
|
|
17732
17881
|
*
|
|
17733
17882
|
* @since 2.0.0
|
|
@@ -17735,23 +17884,23 @@ export const toReadableStreamWith = dual<
|
|
|
17735
17884
|
*/
|
|
17736
17885
|
<A, E, XR, R extends XR>(
|
|
17737
17886
|
self: Stream<A, E, R>,
|
|
17738
|
-
|
|
17887
|
+
context: Context.Context<XR>,
|
|
17739
17888
|
options?: { readonly strategy?: QueuingStrategy<A> | undefined }
|
|
17740
17889
|
) => ReadableStream<A>
|
|
17741
17890
|
>(
|
|
17742
17891
|
(args) => isStream(args[0]),
|
|
17743
17892
|
<A, E, XR, R extends XR>(
|
|
17744
17893
|
self: Stream<A, E, R>,
|
|
17745
|
-
|
|
17894
|
+
context: Context.Context<XR>,
|
|
17746
17895
|
options?: { readonly strategy?: QueuingStrategy<A> | undefined }
|
|
17747
17896
|
): ReadableStream<A> => {
|
|
17748
17897
|
let currentResolve: (() => void) | undefined = undefined
|
|
17749
17898
|
let fiber: Fiber.Fiber<void, E> | undefined = undefined
|
|
17750
|
-
const latch =
|
|
17899
|
+
const latch = Latch.makeUnsafe(false)
|
|
17751
17900
|
|
|
17752
17901
|
return new ReadableStream<A>({
|
|
17753
17902
|
start(controller) {
|
|
17754
|
-
fiber = Effect.runFork(Effect.
|
|
17903
|
+
fiber = Effect.runFork(Effect.provideContext(
|
|
17755
17904
|
runForEachArray(self, (chunk) =>
|
|
17756
17905
|
latch.whenOpen(Effect.sync(() => {
|
|
17757
17906
|
latch.closeUnsafe()
|
|
@@ -17761,7 +17910,7 @@ export const toReadableStreamWith = dual<
|
|
|
17761
17910
|
currentResolve!()
|
|
17762
17911
|
currentResolve = undefined
|
|
17763
17912
|
}))),
|
|
17764
|
-
|
|
17913
|
+
context
|
|
17765
17914
|
))
|
|
17766
17915
|
fiber.addObserver((exit) => {
|
|
17767
17916
|
if (exit._tag === "Failure") {
|
|
@@ -17846,7 +17995,7 @@ export const toReadableStream: {
|
|
|
17846
17995
|
<A, E>(
|
|
17847
17996
|
self: Stream<A, E>,
|
|
17848
17997
|
options?: { readonly strategy?: QueuingStrategy<A> | undefined }
|
|
17849
|
-
): ReadableStream<A> => toReadableStreamWith(self,
|
|
17998
|
+
): ReadableStream<A> => toReadableStreamWith(self, Context.empty(), options)
|
|
17850
17999
|
)
|
|
17851
18000
|
|
|
17852
18001
|
/**
|
|
@@ -17930,7 +18079,7 @@ export const toReadableStreamEffect: {
|
|
|
17930
18079
|
options?: { readonly strategy?: QueuingStrategy<A> | undefined }
|
|
17931
18080
|
): Effect.Effect<ReadableStream<A>, never, R> =>
|
|
17932
18081
|
Effect.map(
|
|
17933
|
-
Effect.
|
|
18082
|
+
Effect.context</**
|
|
17934
18083
|
* Creates an Effect that builds a ReadableStream from the stream.
|
|
17935
18084
|
*
|
|
17936
18085
|
* See https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream.
|
|
@@ -17962,10 +18111,10 @@ export const toReadableStreamEffect: {
|
|
|
17962
18111
|
*
|
|
17963
18112
|
* @example
|
|
17964
18113
|
* ```ts
|
|
17965
|
-
* import {
|
|
18114
|
+
* import { Context, Stream } from "effect"
|
|
17966
18115
|
*
|
|
17967
18116
|
* const stream = Stream.make(1, 2, 3)
|
|
17968
|
-
* const iterable = Stream.toAsyncIterableWith(stream,
|
|
18117
|
+
* const iterable = Stream.toAsyncIterableWith(stream, Context.empty())
|
|
17969
18118
|
*
|
|
17970
18119
|
* const collect = async () => {
|
|
17971
18120
|
* const results: Array<number> = []
|
|
@@ -17985,10 +18134,10 @@ export const toAsyncIterableWith: {
|
|
|
17985
18134
|
*
|
|
17986
18135
|
* @example
|
|
17987
18136
|
* ```ts
|
|
17988
|
-
* import {
|
|
18137
|
+
* import { Context, Stream } from "effect"
|
|
17989
18138
|
*
|
|
17990
18139
|
* const stream = Stream.make(1, 2, 3)
|
|
17991
|
-
* const iterable = Stream.toAsyncIterableWith(stream,
|
|
18140
|
+
* const iterable = Stream.toAsyncIterableWith(stream, Context.empty())
|
|
17992
18141
|
*
|
|
17993
18142
|
* const collect = async () => {
|
|
17994
18143
|
* const results: Array<number> = []
|
|
@@ -18002,16 +18151,16 @@ export const toAsyncIterableWith: {
|
|
|
18002
18151
|
* @since 2.0.0
|
|
18003
18152
|
* @category Destructors
|
|
18004
18153
|
*/
|
|
18005
|
-
<XR>(
|
|
18154
|
+
<XR>(context: Context.Context<XR>): <A, E, R extends XR>(self: Stream<A, E, R>) => AsyncIterable<A>
|
|
18006
18155
|
/**
|
|
18007
18156
|
* Converts the stream to an `AsyncIterable` using the provided services.
|
|
18008
18157
|
*
|
|
18009
18158
|
* @example
|
|
18010
18159
|
* ```ts
|
|
18011
|
-
* import {
|
|
18160
|
+
* import { Context, Stream } from "effect"
|
|
18012
18161
|
*
|
|
18013
18162
|
* const stream = Stream.make(1, 2, 3)
|
|
18014
|
-
* const iterable = Stream.toAsyncIterableWith(stream,
|
|
18163
|
+
* const iterable = Stream.toAsyncIterableWith(stream, Context.empty())
|
|
18015
18164
|
*
|
|
18016
18165
|
* const collect = async () => {
|
|
18017
18166
|
* const results: Array<number> = []
|
|
@@ -18025,16 +18174,16 @@ export const toAsyncIterableWith: {
|
|
|
18025
18174
|
* @since 2.0.0
|
|
18026
18175
|
* @category Destructors
|
|
18027
18176
|
*/
|
|
18028
|
-
<A, E, XR, R extends XR>(self: Stream<A, E, R>,
|
|
18177
|
+
<A, E, XR, R extends XR>(self: Stream<A, E, R>, context: Context.Context<XR>): AsyncIterable<A>
|
|
18029
18178
|
} = dual(
|
|
18030
18179
|
2,
|
|
18031
18180
|
<A, E, XR, R extends XR>(
|
|
18032
18181
|
self: Stream<A, E, R>,
|
|
18033
|
-
|
|
18182
|
+
context: Context.Context<XR>
|
|
18034
18183
|
): AsyncIterable<A> => ({
|
|
18035
18184
|
[Symbol.asyncIterator]() {
|
|
18036
|
-
const runPromise = Effect.runPromiseWith(
|
|
18037
|
-
const runPromiseExit = Effect.runPromiseExitWith(
|
|
18185
|
+
const runPromise = Effect.runPromiseWith(context)
|
|
18186
|
+
const runPromiseExit = Effect.runPromiseExitWith(context)
|
|
18038
18187
|
const scope = Scope.makeUnsafe()
|
|
18039
18188
|
let pull: Pull.Pull<Arr.NonEmptyReadonlyArray<A>, E, void, R> | undefined
|
|
18040
18189
|
let currentIter: Iterator<A> | undefined
|
|
@@ -18096,8 +18245,8 @@ export const toAsyncIterableWith: {
|
|
|
18096
18245
|
*/
|
|
18097
18246
|
export const toAsyncIterableEffect = <A, E, R>(self: Stream<A, E, R>): Effect.Effect<AsyncIterable<A>, never, R> =>
|
|
18098
18247
|
Effect.map(
|
|
18099
|
-
Effect.
|
|
18100
|
-
(
|
|
18248
|
+
Effect.context<R>(),
|
|
18249
|
+
(context) => toAsyncIterableWith(self, context)
|
|
18101
18250
|
)
|
|
18102
18251
|
|
|
18103
18252
|
/**
|
|
@@ -18126,7 +18275,7 @@ export const toAsyncIterableEffect = <A, E, R>(self: Stream<A, E, R>): Effect.Ef
|
|
|
18126
18275
|
* @category Destructors
|
|
18127
18276
|
*/
|
|
18128
18277
|
export const toAsyncIterable = <A, E>(self: Stream<A, E>): AsyncIterable<A> =>
|
|
18129
|
-
toAsyncIterableWith(self,
|
|
18278
|
+
toAsyncIterableWith(self, Context.empty())
|
|
18130
18279
|
|
|
18131
18280
|
/**
|
|
18132
18281
|
* Runs the stream, publishing elements into the provided PubSub.
|
|
@@ -18472,16 +18621,16 @@ export const toPubSubTake: {
|
|
|
18472
18621
|
)
|
|
18473
18622
|
|
|
18474
18623
|
/**
|
|
18475
|
-
* Converts a stream to a
|
|
18624
|
+
* Converts a stream to a Queue for concurrent consumption.
|
|
18476
18625
|
*
|
|
18477
18626
|
* @example
|
|
18478
18627
|
* ```ts
|
|
18479
|
-
* import { Effect,
|
|
18628
|
+
* import { Effect, Queue, Stream } from "effect"
|
|
18480
18629
|
*
|
|
18481
18630
|
* const program = Effect.gen(function* () {
|
|
18482
|
-
* const
|
|
18483
|
-
* const
|
|
18484
|
-
* return
|
|
18631
|
+
* const queue = yield* Stream.toQueue(Stream.fromIterable([1, 2, 3]), { capacity: 8 })
|
|
18632
|
+
* const chunk = yield* Queue.takeBetween(queue, 1, 3)
|
|
18633
|
+
* return chunk
|
|
18485
18634
|
* })
|
|
18486
18635
|
* ```
|
|
18487
18636
|
*
|
|
@@ -18490,16 +18639,16 @@ export const toPubSubTake: {
|
|
|
18490
18639
|
*/
|
|
18491
18640
|
export const toQueue: {
|
|
18492
18641
|
/**
|
|
18493
|
-
* Converts a stream to a
|
|
18642
|
+
* Converts a stream to a Queue for concurrent consumption.
|
|
18494
18643
|
*
|
|
18495
18644
|
* @example
|
|
18496
18645
|
* ```ts
|
|
18497
|
-
* import { Effect,
|
|
18646
|
+
* import { Effect, Queue, Stream } from "effect"
|
|
18498
18647
|
*
|
|
18499
18648
|
* const program = Effect.gen(function* () {
|
|
18500
|
-
* const
|
|
18501
|
-
* const
|
|
18502
|
-
* return
|
|
18649
|
+
* const queue = yield* Stream.toQueue(Stream.fromIterable([1, 2, 3]), { capacity: 8 })
|
|
18650
|
+
* const chunk = yield* Queue.takeBetween(queue, 1, 3)
|
|
18651
|
+
* return chunk
|
|
18503
18652
|
* })
|
|
18504
18653
|
* ```
|
|
18505
18654
|
*
|
|
@@ -18515,16 +18664,16 @@ export const toQueue: {
|
|
|
18515
18664
|
}
|
|
18516
18665
|
): <A, E, R>(self: Stream<A, E, R>) => Effect.Effect<Queue.Dequeue<A, E | Cause.Done>, never, R | Scope.Scope>
|
|
18517
18666
|
/**
|
|
18518
|
-
* Converts a stream to a
|
|
18667
|
+
* Converts a stream to a Queue for concurrent consumption.
|
|
18519
18668
|
*
|
|
18520
18669
|
* @example
|
|
18521
18670
|
* ```ts
|
|
18522
|
-
* import { Effect,
|
|
18671
|
+
* import { Effect, Queue, Stream } from "effect"
|
|
18523
18672
|
*
|
|
18524
18673
|
* const program = Effect.gen(function* () {
|
|
18525
|
-
* const
|
|
18526
|
-
* const
|
|
18527
|
-
* return
|
|
18674
|
+
* const queue = yield* Stream.toQueue(Stream.fromIterable([1, 2, 3]), { capacity: 8 })
|
|
18675
|
+
* const chunk = yield* Queue.takeBetween(queue, 1, 3)
|
|
18676
|
+
* return chunk
|
|
18528
18677
|
* })
|
|
18529
18678
|
* ```
|
|
18530
18679
|
*
|
|
@@ -18539,22 +18688,19 @@ export const toQueue: {
|
|
|
18539
18688
|
readonly capacity: number
|
|
18540
18689
|
readonly strategy?: "dropping" | "sliding" | "suspend" | undefined
|
|
18541
18690
|
}
|
|
18542
|
-
): Effect.Effect<
|
|
18691
|
+
): Effect.Effect<Queue.Dequeue<A, E | Cause.Done>, never, R | Scope.Scope>
|
|
18543
18692
|
} = dual(
|
|
18544
18693
|
2,
|
|
18545
18694
|
<A, E, R>(
|
|
18546
18695
|
self: Stream<A, E, R>,
|
|
18547
18696
|
options: {
|
|
18548
18697
|
readonly capacity: "unbounded"
|
|
18549
|
-
readonly replay?: number | undefined
|
|
18550
|
-
readonly shutdownOnEnd?: boolean | undefined
|
|
18551
18698
|
} | {
|
|
18552
18699
|
readonly capacity: number
|
|
18553
18700
|
readonly strategy?: "dropping" | "sliding" | "suspend" | undefined
|
|
18554
|
-
readonly replay?: number | undefined
|
|
18555
|
-
readonly shutdownOnEnd?: boolean | undefined
|
|
18556
18701
|
}
|
|
18557
|
-
): Effect.Effect<
|
|
18702
|
+
): Effect.Effect<Queue.Dequeue<A, E | Cause.Done>, never, R | Scope.Scope> =>
|
|
18703
|
+
Channel.toQueueArray(self.channel, options)
|
|
18558
18704
|
)
|
|
18559
18705
|
|
|
18560
18706
|
/**
|