effect 4.0.0-beta.6 → 4.0.0-beta.60
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 +105 -52
- 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 +36 -33
- package/dist/BigInt.js.map +1 -1
- package/dist/Brand.d.ts +3 -5
- 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 +53 -22
- 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 +176 -87
- 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 +189 -29
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +85 -35
- 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 +533 -365
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js +125 -73
- 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 +74 -40
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +126 -87
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +1391 -927
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +472 -328
- package/dist/Effect.js.map +1 -1
- package/dist/Effectable.d.ts +29 -0
- package/dist/Effectable.d.ts.map +1 -0
- package/dist/Effectable.js +31 -0
- package/dist/Effectable.js.map +1 -0
- package/dist/Encoding.d.ts +1 -1
- 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 +15 -11
- 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 +243 -55
- 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 +58 -60
- 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/Inspectable.d.ts +0 -4
- package/dist/Inspectable.d.ts.map +1 -1
- package/dist/Inspectable.js +4 -13
- package/dist/Inspectable.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 +69 -3
- package/dist/Latch.d.ts.map +1 -1
- package/dist/Latch.js +58 -0
- package/dist/Latch.js.map +1 -1
- 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 +183 -0
- package/dist/PartitionedSemaphore.d.ts.map +1 -0
- package/dist/PartitionedSemaphore.js +231 -0
- package/dist/PartitionedSemaphore.js.map +1 -0
- 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/PlatformError.d.ts +2 -2
- package/dist/Pool.d.ts +1 -1
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +5 -5
- package/dist/Pool.js.map +1 -1
- package/dist/Predicate.d.ts +1 -1
- package/dist/Predicate.d.ts.map +1 -1
- package/dist/PubSub.d.ts +5 -4
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +15 -8
- 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 +5 -5
- package/dist/Request.d.ts.map +1 -1
- package/dist/Request.js.map +1 -1
- package/dist/RequestResolver.d.ts +25 -25
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/RequestResolver.js +15 -16
- 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 +174 -291
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +132 -120
- 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 +3213 -392
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +2058 -252
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +13 -2
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +340 -257
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +55 -13
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +73 -11
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js +29 -11
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.d.ts +44 -54
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +69 -4
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +2 -2
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +63 -39
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +245 -3
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +297 -33
- 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 +148 -52
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js +135 -117
- package/dist/Semaphore.js.map +1 -1
- 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 +329 -145
- 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 +7 -7
- package/dist/Struct.d.ts.map +1 -1
- package/dist/SubscriptionRef.d.ts +1 -2
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +83 -116
- package/dist/SubscriptionRef.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 +80 -22
- 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 +886 -71
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +886 -71
- package/dist/index.js.map +1 -1
- 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 +488 -326
- 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 +9 -9
- 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 +87 -109
- 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 +59 -1
- package/dist/internal/schema/schema.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 +5 -5
- package/dist/testing/TestClock.d.ts.map +1 -1
- package/dist/testing/TestClock.js +2 -2
- 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 +127 -45
- 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 +40 -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 +207 -112
- 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 +225 -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 +17 -17
- 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 +24 -24
- 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 +51 -63
- 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 +10 -0
- package/dist/unstable/cli/index.d.ts.map +1 -1
- package/dist/unstable/cli/index.js +10 -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 +96 -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 +17 -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 +6 -6
- 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 +3 -3
- package/dist/unstable/cluster/HttpRunner.js +2 -2
- package/dist/unstable/cluster/HttpRunner.js.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.d.ts +4 -4
- 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 +16 -10
- 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 +40 -25
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts +7 -6
- 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 +1 -1
- 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 +16 -14
- 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 +59 -49
- 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 +24 -20
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js +7 -7
- package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +30 -24
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/cluster/internal/entityReaper.js +2 -2
- 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/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 +4 -4
- 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 +3 -3
- 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 +27 -10
- 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 -151
- 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} +28 -21
- 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} +69 -27
- 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 +355 -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 +51 -6
- 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 +18 -3
- 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 +51 -51
- 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 +6 -10
- 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 +7 -7
- 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 +18 -9
- 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 +59 -40
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +82 -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 +210 -105
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.js +52 -47
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +66 -29
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.js +138 -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 -17
- 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/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 +17 -25
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +59 -60
- 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 +2 -2
- 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/observability/internal/protobuf.js +4 -4
- package/dist/unstable/observability/internal/protobuf.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 +144 -2
- 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 +1 -2
- package/dist/unstable/persistence/PersistedCache.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedCache.js +10 -11
- 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 +9 -9
- 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 +83 -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/AsyncResult.d.ts +37 -17
- package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.js +9 -0
- package/dist/unstable/reactivity/AsyncResult.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 +25 -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/rpc/Rpc.d.ts +137 -19
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js +99 -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 +117 -75
- 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 +13 -2
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +60 -27
- 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 +73 -43
- 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 +46 -5
- 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 +35 -15
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +34 -27
- 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 +24 -6
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +37 -32
- 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.js +24 -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 +3 -5
- package/dist/unstable/sql/Statement.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.js +14 -13
- 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 +6 -3
- 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 +8 -3
- package/dist/unstable/workflow/Activity.d.ts.map +1 -1
- package/dist/unstable/workflow/Activity.js +25 -11
- 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 +2 -5
- package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.js +33 -15
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +12 -14
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js +30 -26
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +24 -7
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +165 -16
- 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 -10
- package/src/Array.ts +304 -447
- package/src/BigDecimal.ts +137 -82
- package/src/BigInt.ts +53 -45
- package/src/Brand.ts +3 -5
- package/src/Cache.ts +27 -54
- package/src/Cause.ts +57 -22
- package/src/Channel.ts +687 -220
- package/src/Chunk.ts +149 -331
- package/src/Clock.ts +2 -2
- package/src/Combiner.ts +280 -13
- package/src/Config.ts +214 -52
- 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 +530 -368
- package/src/DateTime.ts +77 -258
- package/src/Deferred.ts +15 -6
- package/src/Duration.ts +151 -81
- package/src/Effect.ts +1581 -1050
- package/src/Effectable.ts +47 -0
- package/src/Equal.ts +293 -109
- 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 +30 -26
- package/src/Filter.ts +4 -62
- package/src/Formatter.ts +268 -60
- package/src/Function.ts +2 -10
- package/src/Graph.ts +123 -112
- package/src/Hash.ts +2 -2
- package/src/HashMap.ts +26 -19
- package/src/Inspectable.ts +2 -22
- package/src/Iterable.ts +117 -63
- package/src/JsonSchema.ts +383 -10
- package/src/Latch.ts +85 -3
- 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 +414 -0
- package/src/Path.ts +2 -2
- package/src/Pool.ts +9 -9
- package/src/Predicate.ts +1 -1
- package/src/PubSub.ts +20 -11
- 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 +5 -5
- package/src/RequestResolver.ts +34 -35
- package/src/Resource.ts +6 -5
- package/src/Result.ts +2 -4
- package/src/Runtime.ts +102 -6
- package/src/Schedule.ts +243 -336
- package/src/Scheduler.ts +52 -129
- package/src/Schema.ts +3769 -597
- package/src/SchemaAST.ts +480 -302
- package/src/SchemaGetter.ts +80 -24
- package/src/SchemaIssue.ts +28 -15
- package/src/SchemaParser.ts +100 -29
- package/src/SchemaRepresentation.ts +57 -33
- package/src/SchemaTransformation.ts +321 -32
- package/src/Scope.ts +2 -2
- package/src/ScopedCache.ts +8 -8
- package/src/Semaphore.ts +268 -182
- package/src/Sink.ts +89 -34
- package/src/Stdio.ts +29 -6
- package/src/Stream.ts +908 -752
- package/src/String.ts +122 -69
- package/src/Struct.ts +7 -7
- package/src/SubscriptionRef.ts +98 -118
- 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 +75 -23
- package/src/Unify.ts +26 -2
- package/src/Utils.ts +137 -111
- package/src/index.ts +896 -73
- package/src/internal/core.ts +9 -10
- package/src/internal/dateTime.ts +91 -96
- package/src/internal/effect.ts +1168 -621
- 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 +12 -12
- 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 +82 -97
- package/src/internal/schema/schema.ts +68 -1
- package/src/internal/trie.ts +21 -15
- package/src/testing/TestClock.ts +6 -6
- package/src/testing/TestSchema.ts +333 -36
- package/src/testing/index.ts +64 -1
- package/src/unstable/ai/AiError.ts +111 -53
- package/src/unstable/ai/AnthropicStructuredOutput.ts +7 -3
- package/src/unstable/ai/Chat.ts +136 -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 +307 -87
- package/src/unstable/ai/Model.ts +44 -13
- package/src/unstable/ai/OpenAiStructuredOutput.ts +9 -2
- package/src/unstable/ai/Prompt.ts +23 -29
- package/src/unstable/ai/Response.ts +29 -31
- 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 +12 -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 +142 -80
- package/src/unstable/cluster/DeliverAt.ts +1 -1
- package/src/unstable/cluster/Entity.ts +58 -45
- package/src/unstable/cluster/EntityAddress.ts +1 -1
- package/src/unstable/cluster/EntityProxy.ts +3 -3
- package/src/unstable/cluster/EntityProxyServer.ts +6 -6
- package/src/unstable/cluster/EntityResource.ts +6 -6
- 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 +74 -45
- 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 +22 -18
- package/src/unstable/cluster/ShardId.ts +84 -74
- package/src/unstable/cluster/Sharding.ts +75 -60
- package/src/unstable/cluster/ShardingConfig.ts +39 -40
- package/src/unstable/cluster/Snowflake.ts +2 -2
- package/src/unstable/cluster/SqlMessageStorage.ts +29 -20
- package/src/unstable/cluster/SqlRunnerStorage.ts +13 -7
- package/src/unstable/cluster/internal/entityManager.ts +60 -41
- package/src/unstable/cluster/internal/entityReaper.ts +2 -2
- package/src/unstable/cluster/internal/resourceMap.ts +3 -3
- 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 -234
- 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} +38 -22
- package/src/unstable/eventlog/{SqlEventLogServer.ts → SqlEventLogServerEncrypted.ts} +110 -43
- package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +506 -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 +24 -8
- package/src/unstable/http/HttpEffect.ts +71 -77
- package/src/unstable/http/HttpIncomingMessage.ts +9 -8
- 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 +8 -8
- package/src/unstable/http/Url.ts +650 -0
- package/src/unstable/http/UrlParams.ts +30 -18
- package/src/unstable/http/index.ts +10 -0
- package/src/unstable/http/internal/preResponseHandler.ts +15 -0
- package/src/unstable/httpapi/HttpApi.ts +22 -22
- package/src/unstable/httpapi/HttpApiBuilder.ts +134 -54
- package/src/unstable/httpapi/HttpApiClient.ts +185 -34
- package/src/unstable/httpapi/HttpApiEndpoint.ts +225 -114
- package/src/unstable/httpapi/HttpApiError.ts +129 -30
- package/src/unstable/httpapi/HttpApiGroup.ts +18 -17
- package/src/unstable/httpapi/HttpApiMiddleware.ts +95 -32
- package/src/unstable/httpapi/HttpApiSchema.ts +106 -11
- package/src/unstable/httpapi/HttpApiSecurity.ts +13 -13
- package/src/unstable/httpapi/OpenApi.ts +74 -73
- 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 +6 -6
- 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/observability/internal/protobuf.ts +4 -4
- package/src/unstable/persistence/KeyValueStore.ts +226 -3
- package/src/unstable/persistence/Persistable.ts +3 -3
- package/src/unstable/persistence/PersistedCache.ts +20 -17
- package/src/unstable/persistence/PersistedQueue.ts +21 -21
- 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 +114 -15
- package/src/unstable/reactivity/AsyncResult.ts +59 -17
- package/src/unstable/reactivity/Atom.ts +280 -124
- package/src/unstable/reactivity/AtomHttpApi.ts +127 -61
- 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/rpc/Rpc.ts +212 -32
- package/src/unstable/rpc/RpcClient.ts +161 -142
- 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 +97 -54
- package/src/unstable/rpc/RpcServer.ts +91 -65
- package/src/unstable/rpc/RpcWorker.ts +5 -5
- package/src/unstable/rpc/Utils.ts +63 -4
- package/src/unstable/schema/Model.ts +35 -6
- package/src/unstable/schema/VariantSchema.ts +14 -27
- package/src/unstable/socket/Socket.ts +102 -62
- package/src/unstable/socket/SocketServer.ts +2 -2
- package/src/unstable/sql/Migrator.ts +7 -5
- package/src/unstable/sql/SqlClient.ts +48 -19
- 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 +28 -20
- package/src/unstable/sql/SqlSchema.ts +42 -26
- package/src/unstable/sql/Statement.ts +21 -25
- package/src/unstable/workers/Transferable.ts +17 -19
- package/src/unstable/workers/Worker.ts +4 -4
- package/src/unstable/workers/WorkerRunner.ts +2 -2
- package/src/unstable/workflow/Activity.ts +36 -13
- package/src/unstable/workflow/DurableClock.ts +11 -11
- package/src/unstable/workflow/DurableDeferred.ts +36 -18
- package/src/unstable/workflow/Workflow.ts +46 -35
- package/src/unstable/workflow/WorkflowEngine.ts +236 -23
- 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/internal/schema/to-codec.d.ts +0 -2
- package/dist/internal/schema/to-codec.d.ts.map +0 -1
- package/dist/internal/schema/to-codec.js +0 -129
- package/dist/internal/schema/to-codec.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/internal/schema/to-codec.ts +0 -148
- 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"
|
|
@@ -22,7 +23,7 @@ import { addSpanStackTrace } from "./internal/tracer.ts"
|
|
|
22
23
|
import * as Iterable from "./Iterable.ts"
|
|
23
24
|
import * as Latch from "./Latch.ts"
|
|
24
25
|
import type * as Layer from "./Layer.ts"
|
|
25
|
-
import type {
|
|
26
|
+
import type { Severity } from "./LogLevel.ts"
|
|
26
27
|
import * as MutableHashMap from "./MutableHashMap.ts"
|
|
27
28
|
import * as MutableList from "./MutableList.ts"
|
|
28
29
|
import * as Option from "./Option.ts"
|
|
@@ -37,7 +38,6 @@ import * as RcRef from "./RcRef.ts"
|
|
|
37
38
|
import * as Result from "./Result.ts"
|
|
38
39
|
import * as Schedule from "./Schedule.ts"
|
|
39
40
|
import * as Scope from "./Scope.ts"
|
|
40
|
-
import * as ServiceMap from "./ServiceMap.ts"
|
|
41
41
|
import * as Sink from "./Sink.ts"
|
|
42
42
|
import { isString } from "./String.ts"
|
|
43
43
|
import type * as Take from "./Take.ts"
|
|
@@ -48,14 +48,26 @@ import type {
|
|
|
48
48
|
ExcludeTag,
|
|
49
49
|
ExtractReason,
|
|
50
50
|
ExtractTag,
|
|
51
|
+
NarrowReason,
|
|
51
52
|
NoInfer,
|
|
53
|
+
OmitReason,
|
|
52
54
|
ReasonTags,
|
|
53
55
|
Tags,
|
|
54
56
|
unassigned
|
|
55
57
|
} from "./Types.ts"
|
|
56
58
|
import type * as Unify from "./Unify.ts"
|
|
57
59
|
|
|
58
|
-
|
|
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"
|
|
59
71
|
|
|
60
72
|
/**
|
|
61
73
|
* A `Stream<A, E, R>` describes a program that can emit many `A` values, fail
|
|
@@ -130,7 +142,7 @@ export interface StreamUnify<A extends { [Unify.typeSymbol]?: any }> extends Eff
|
|
|
130
142
|
* @category Models
|
|
131
143
|
* @since 2.0.0
|
|
132
144
|
*/
|
|
133
|
-
export interface StreamUnifyIgnore
|
|
145
|
+
export interface StreamUnifyIgnore {
|
|
134
146
|
Effect?: true
|
|
135
147
|
}
|
|
136
148
|
|
|
@@ -342,6 +354,79 @@ export const fromChannel: <Arr extends Arr.NonEmptyReadonlyArray<any>, E, R>(
|
|
|
342
354
|
export const fromEffect = <A, E, R>(effect: Effect.Effect<A, E, R>): Stream<A, E, R> =>
|
|
343
355
|
fromChannel(Channel.fromEffect(Effect.map(effect, Arr.of)))
|
|
344
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
|
+
|
|
345
430
|
/**
|
|
346
431
|
* Creates a stream that runs the effect and emits no elements.
|
|
347
432
|
*
|
|
@@ -472,7 +557,7 @@ export const fromEffectSchedule = <A, E, R, X, AS extends A, ES, RS>(
|
|
|
472
557
|
* @since 2.0.0
|
|
473
558
|
* @category Constructors
|
|
474
559
|
*/
|
|
475
|
-
export const tick = (interval: Duration.
|
|
560
|
+
export const tick = (interval: Duration.Input): Stream<void> =>
|
|
476
561
|
fromPull(Effect.sync(() => {
|
|
477
562
|
let first = true
|
|
478
563
|
const effect = Effect.succeed(Arr.of<void>(undefined))
|
|
@@ -961,6 +1046,10 @@ export const fromIteratorSucceed = <A>(iterator: IterableIterator<A>, maxChunkSi
|
|
|
961
1046
|
/**
|
|
962
1047
|
* Creates a new `Stream` from an iterable collection of values.
|
|
963
1048
|
*
|
|
1049
|
+
* **Options**
|
|
1050
|
+
*
|
|
1051
|
+
* - `chunkSize`: Maximum number of values emitted per chunk.
|
|
1052
|
+
*
|
|
964
1053
|
* @example
|
|
965
1054
|
* ```ts
|
|
966
1055
|
* import { Console, Effect, Stream } from "effect"
|
|
@@ -980,19 +1069,24 @@ export const fromIteratorSucceed = <A>(iterator: IterableIterator<A>, maxChunkSi
|
|
|
980
1069
|
* @since 2.0.0
|
|
981
1070
|
* @category Constructors
|
|
982
1071
|
*/
|
|
983
|
-
export const fromIterable = <A>(
|
|
984
|
-
|
|
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
|
|
985
1079
|
? fromArray(iterable)
|
|
986
|
-
: fromChannel(Channel.fromIterableArray(iterable))
|
|
1080
|
+
: fromChannel(Channel.fromIterableArray(iterable, options?.chunkSize))
|
|
987
1081
|
|
|
988
1082
|
/**
|
|
989
1083
|
* Creates a stream from an effect producing an iterable of values.
|
|
990
1084
|
*
|
|
991
1085
|
* @example
|
|
992
1086
|
* ```ts
|
|
993
|
-
* import { Console, Effect,
|
|
1087
|
+
* import { Console, Effect, Context, Stream } from "effect"
|
|
994
1088
|
*
|
|
995
|
-
* class UserRepo extends
|
|
1089
|
+
* class UserRepo extends Context.Service<UserRepo, {
|
|
996
1090
|
* readonly list: Effect.Effect<ReadonlyArray<string>>
|
|
997
1091
|
* }>()("UserRepo") {}
|
|
998
1092
|
*
|
|
@@ -1243,7 +1337,9 @@ export const fromPubSubTake = <A, E>(pubsub: PubSub.PubSub<Take.Take<A, E>>): St
|
|
|
1243
1337
|
*
|
|
1244
1338
|
* @example
|
|
1245
1339
|
* ```ts
|
|
1246
|
-
* 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 }> {}
|
|
1247
1343
|
*
|
|
1248
1344
|
* const readableStream = new ReadableStream({
|
|
1249
1345
|
* start(controller) {
|
|
@@ -1257,7 +1353,7 @@ export const fromPubSubTake = <A, E>(pubsub: PubSub.PubSub<Take.Take<A, E>>): St
|
|
|
1257
1353
|
* const program = Effect.gen(function*() {
|
|
1258
1354
|
* const stream = Stream.fromReadableStream({
|
|
1259
1355
|
* evaluate: () => readableStream,
|
|
1260
|
-
* onError: (
|
|
1356
|
+
* onError: (cause) => new StreamError({ cause })
|
|
1261
1357
|
* })
|
|
1262
1358
|
* const values = yield* Stream.runCollect(stream)
|
|
1263
1359
|
* yield* Console.log(values)
|
|
@@ -1299,7 +1395,9 @@ export const fromReadableStream = <A, E>(
|
|
|
1299
1395
|
*
|
|
1300
1396
|
* @example
|
|
1301
1397
|
* ```ts
|
|
1302
|
-
* 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 }> {}
|
|
1303
1401
|
*
|
|
1304
1402
|
* const iterable = (async function*() {
|
|
1305
1403
|
* yield 1
|
|
@@ -1308,7 +1406,7 @@ export const fromReadableStream = <A, E>(
|
|
|
1308
1406
|
* })()
|
|
1309
1407
|
*
|
|
1310
1408
|
* const program = Effect.gen(function*() {
|
|
1311
|
-
* const stream = Stream.fromAsyncIterable(iterable, (
|
|
1409
|
+
* const stream = Stream.fromAsyncIterable(iterable, (cause) => new StreamError({ cause }))
|
|
1312
1410
|
* const values = yield* Stream.runCollect(stream)
|
|
1313
1411
|
* yield* Console.log(values)
|
|
1314
1412
|
* })
|
|
@@ -1335,7 +1433,7 @@ export const fromAsyncIterable = <A, E>(
|
|
|
1335
1433
|
*
|
|
1336
1434
|
* const program = Effect.gen(function*() {
|
|
1337
1435
|
* const schedule = Schedule.spaced("50 millis").pipe(
|
|
1338
|
-
* Schedule.
|
|
1436
|
+
* Schedule.both(Schedule.recurs(2))
|
|
1339
1437
|
* )
|
|
1340
1438
|
* const stream = Stream.fromSchedule(schedule)
|
|
1341
1439
|
* const values = yield* Stream.runCollect(stream)
|
|
@@ -3317,7 +3415,7 @@ export const timeout: {
|
|
|
3317
3415
|
* @since 2.0.0
|
|
3318
3416
|
* @category Rate Limiting
|
|
3319
3417
|
*/
|
|
3320
|
-
(duration: Duration.
|
|
3418
|
+
(duration: Duration.Input): <A, E, R>(self: Stream<A, E, R>) => Stream<A, E, R>
|
|
3321
3419
|
/**
|
|
3322
3420
|
* Ends the stream if it does not produce a value within the specified duration.
|
|
3323
3421
|
*
|
|
@@ -3341,15 +3439,97 @@ export const timeout: {
|
|
|
3341
3439
|
* @since 2.0.0
|
|
3342
3440
|
* @category Rate Limiting
|
|
3343
3441
|
*/
|
|
3344
|
-
<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>
|
|
3345
3443
|
} = dual(
|
|
3346
3444
|
2,
|
|
3347
|
-
<A, E, R>(self: Stream<A, E, R>, duration: Duration.
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
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
|
+
}
|
|
3353
3533
|
)
|
|
3354
3534
|
|
|
3355
3535
|
/**
|
|
@@ -3802,7 +3982,7 @@ export const merge: {
|
|
|
3802
3982
|
} | undefined
|
|
3803
3983
|
): Stream<A | A2, E | E2, R | R2>
|
|
3804
3984
|
} = dual(
|
|
3805
|
-
|
|
3985
|
+
(args) => isStream(args[0]) && isStream(args[1]),
|
|
3806
3986
|
<A, E, R, A2, E2, R2>(
|
|
3807
3987
|
self: Stream<A, E, R>,
|
|
3808
3988
|
that: Stream<A2, E2, R2>,
|
|
@@ -5764,7 +5944,7 @@ export const filter: {
|
|
|
5764
5944
|
* @since 2.0.0
|
|
5765
5945
|
* @category Filtering
|
|
5766
5946
|
*/
|
|
5767
|
-
<A
|
|
5947
|
+
<A>(predicate: Predicate<NoInfer<A>>): <E, R>(self: Stream<A, E, R>) => Stream<A, E, R>
|
|
5768
5948
|
/**
|
|
5769
5949
|
* Filters a stream to the elements that satisfy a predicate.
|
|
5770
5950
|
*
|
|
@@ -5810,27 +5990,52 @@ export const filter: {
|
|
|
5810
5990
|
* @since 2.0.0
|
|
5811
5991
|
* @category Filtering
|
|
5812
5992
|
*/
|
|
5813
|
-
<A, E, R
|
|
5993
|
+
<A, E, R>(self: Stream<A, E, R>, predicate: Predicate<A>): Stream<A, E, R>
|
|
5814
5994
|
} = dual(
|
|
5815
5995
|
2,
|
|
5816
|
-
<A, E, R
|
|
5996
|
+
<A, E, R>(
|
|
5817
5997
|
self: Stream<A, E, R>,
|
|
5818
|
-
|
|
5819
|
-
): Stream<
|
|
5998
|
+
predicate: Predicate<A>
|
|
5999
|
+
): Stream<A, E, R> => fromChannel(Channel.filterArray(toChannel(self), predicate))
|
|
5820
6000
|
)
|
|
5821
6001
|
|
|
5822
6002
|
/**
|
|
5823
|
-
*
|
|
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.
|
|
5824
6033
|
*
|
|
5825
6034
|
* @example
|
|
5826
6035
|
* ```ts
|
|
5827
|
-
* import { Console, Effect,
|
|
5828
|
-
*
|
|
5829
|
-
* const filter = Filter.makeEffect((n: number) =>
|
|
5830
|
-
* Effect.succeed(n > 2 ? Result.succeed(n + 1) : Result.fail(n))
|
|
5831
|
-
* )
|
|
6036
|
+
* import { Console, Effect, Stream } from "effect"
|
|
5832
6037
|
*
|
|
5833
|
-
* 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)))
|
|
5834
6039
|
*
|
|
5835
6040
|
* const program = Effect.gen(function*() {
|
|
5836
6041
|
* const result = yield* Stream.runCollect(stream)
|
|
@@ -5838,7 +6043,7 @@ export const filter: {
|
|
|
5838
6043
|
* })
|
|
5839
6044
|
*
|
|
5840
6045
|
* Effect.runPromise(program)
|
|
5841
|
-
* // Output: [
|
|
6046
|
+
* // Output: [ 3, 4 ]
|
|
5842
6047
|
* ```
|
|
5843
6048
|
*
|
|
5844
6049
|
* @since 2.0.0
|
|
@@ -5846,17 +6051,13 @@ export const filter: {
|
|
|
5846
6051
|
*/
|
|
5847
6052
|
export const filterEffect: {
|
|
5848
6053
|
/**
|
|
5849
|
-
* Effectfully filters
|
|
6054
|
+
* Effectfully filters elements in a single pass.
|
|
5850
6055
|
*
|
|
5851
6056
|
* @example
|
|
5852
6057
|
* ```ts
|
|
5853
|
-
* import { Console, Effect,
|
|
5854
|
-
*
|
|
5855
|
-
* const filter = Filter.makeEffect((n: number) =>
|
|
5856
|
-
* Effect.succeed(n > 2 ? Result.succeed(n + 1) : Result.fail(n))
|
|
5857
|
-
* )
|
|
6058
|
+
* import { Console, Effect, Stream } from "effect"
|
|
5858
6059
|
*
|
|
5859
|
-
* 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)))
|
|
5860
6061
|
*
|
|
5861
6062
|
* const program = Effect.gen(function*() {
|
|
5862
6063
|
* const result = yield* Stream.runCollect(stream)
|
|
@@ -5864,25 +6065,21 @@ export const filterEffect: {
|
|
|
5864
6065
|
* })
|
|
5865
6066
|
*
|
|
5866
6067
|
* Effect.runPromise(program)
|
|
5867
|
-
* // Output: [
|
|
6068
|
+
* // Output: [ 3, 4 ]
|
|
5868
6069
|
* ```
|
|
5869
6070
|
*
|
|
5870
6071
|
* @since 2.0.0
|
|
5871
6072
|
* @category Filtering
|
|
5872
6073
|
*/
|
|
5873
|
-
<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>
|
|
5874
6075
|
/**
|
|
5875
|
-
* Effectfully filters
|
|
6076
|
+
* Effectfully filters elements in a single pass.
|
|
5876
6077
|
*
|
|
5877
6078
|
* @example
|
|
5878
6079
|
* ```ts
|
|
5879
|
-
* import { Console, Effect,
|
|
5880
|
-
*
|
|
5881
|
-
* const filter = Filter.makeEffect((n: number) =>
|
|
5882
|
-
* Effect.succeed(n > 2 ? Result.succeed(n + 1) : Result.fail(n))
|
|
5883
|
-
* )
|
|
6080
|
+
* import { Console, Effect, Stream } from "effect"
|
|
5884
6081
|
*
|
|
5885
|
-
* 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)))
|
|
5886
6083
|
*
|
|
5887
6084
|
* const program = Effect.gen(function*() {
|
|
5888
6085
|
* const result = yield* Stream.runCollect(stream)
|
|
@@ -5890,35 +6087,65 @@ export const filterEffect: {
|
|
|
5890
6087
|
* })
|
|
5891
6088
|
*
|
|
5892
6089
|
* Effect.runPromise(program)
|
|
5893
|
-
* // Output: [
|
|
6090
|
+
* // Output: [ 3, 4 ]
|
|
5894
6091
|
* ```
|
|
5895
6092
|
*
|
|
5896
6093
|
* @since 2.0.0
|
|
5897
6094
|
* @category Filtering
|
|
5898
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
|
+
*/
|
|
5899
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>
|
|
5900
6129
|
} = dual(
|
|
5901
6130
|
2,
|
|
5902
6131
|
<A, E, R, B, X, EX, RX>(
|
|
5903
6132
|
self: Stream<A, E, R>,
|
|
5904
6133
|
filter: Filter.FilterEffect<A, B, X, EX, RX>
|
|
5905
|
-
): Stream<B, E | EX, R | RX> => fromChannel(Channel.
|
|
6134
|
+
): Stream<B, E | EX, R | RX> => fromChannel(Channel.filterMapArrayEffect(toChannel(self), filter))
|
|
5906
6135
|
)
|
|
5907
6136
|
|
|
5908
6137
|
/**
|
|
5909
|
-
* 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.
|
|
5910
6139
|
*
|
|
5911
6140
|
* Each queue fails with the stream error or `Cause.Done` when the source ends.
|
|
5912
6141
|
*
|
|
5913
6142
|
* @example
|
|
5914
6143
|
* ```ts
|
|
5915
|
-
* import { Console, Effect,
|
|
6144
|
+
* import { Console, Effect, Result, Stream } from "effect"
|
|
5916
6145
|
*
|
|
5917
6146
|
* const program = Effect.gen(function*() {
|
|
5918
6147
|
* const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
5919
|
-
* Stream.partitionQueue(
|
|
5920
|
-
* Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
|
|
5921
|
-
* )
|
|
6148
|
+
* Stream.partitionQueue((n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
|
|
5922
6149
|
* )
|
|
5923
6150
|
*
|
|
5924
6151
|
* const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
|
|
@@ -5938,63 +6165,17 @@ export const filterEffect: {
|
|
|
5938
6165
|
*/
|
|
5939
6166
|
export const partitionQueue: {
|
|
5940
6167
|
/**
|
|
5941
|
-
* Partitions a stream using a Filter and exposes passing and failing values as queues.
|
|
5942
|
-
*
|
|
5943
|
-
* Each queue fails with the stream error or `Cause.Done` when the source ends.
|
|
5944
|
-
*
|
|
5945
|
-
* @example
|
|
5946
|
-
* ```ts
|
|
5947
|
-
* import { Console, Effect, Filter, Result, Stream } from "effect"
|
|
5948
|
-
*
|
|
5949
|
-
* const program = Effect.gen(function*() {
|
|
5950
|
-
* const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
5951
|
-
* Stream.partitionQueue(
|
|
5952
|
-
* Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
|
|
5953
|
-
* )
|
|
5954
|
-
* )
|
|
5955
|
-
*
|
|
5956
|
-
* const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
|
|
5957
|
-
* const failValues = yield* Stream.fromQueue(fails).pipe(Stream.runCollect)
|
|
5958
|
-
*
|
|
5959
|
-
* yield* Console.log(passValues)
|
|
5960
|
-
* // Output: [ 2, 4 ]
|
|
5961
|
-
* yield* Console.log(failValues)
|
|
5962
|
-
* // Output: [ 1, 3 ]
|
|
5963
|
-
* })
|
|
5964
|
-
*
|
|
5965
|
-
* Effect.runPromise(Effect.scoped(program))
|
|
5966
|
-
* ```
|
|
5967
|
-
*
|
|
5968
|
-
* @since 4.0.0
|
|
5969
|
-
* @category Filtering
|
|
5970
|
-
*/
|
|
5971
|
-
<A, B extends A>(
|
|
5972
|
-
refinement: Refinement<NoInfer<A>, B>,
|
|
5973
|
-
options?: {
|
|
5974
|
-
readonly capacity?: number | "unbounded" | undefined
|
|
5975
|
-
}
|
|
5976
|
-
): <E, R>(self: Stream<A, E, R>) => Effect.Effect<
|
|
5977
|
-
[
|
|
5978
|
-
passes: Queue.Dequeue<B, E | Cause.Done>,
|
|
5979
|
-
fails: Queue.Dequeue<Exclude<A, B>, E | Cause.Done>
|
|
5980
|
-
],
|
|
5981
|
-
never,
|
|
5982
|
-
R | Scope.Scope
|
|
5983
|
-
>
|
|
5984
|
-
/**
|
|
5985
|
-
* 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.
|
|
5986
6169
|
*
|
|
5987
6170
|
* Each queue fails with the stream error or `Cause.Done` when the source ends.
|
|
5988
6171
|
*
|
|
5989
6172
|
* @example
|
|
5990
6173
|
* ```ts
|
|
5991
|
-
* import { Console, Effect,
|
|
6174
|
+
* import { Console, Effect, Result, Stream } from "effect"
|
|
5992
6175
|
*
|
|
5993
6176
|
* const program = Effect.gen(function*() {
|
|
5994
6177
|
* const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
5995
|
-
* Stream.partitionQueue(
|
|
5996
|
-
* Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
|
|
5997
|
-
* )
|
|
6178
|
+
* Stream.partitionQueue((n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
|
|
5998
6179
|
* )
|
|
5999
6180
|
*
|
|
6000
6181
|
* const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
|
|
@@ -6012,78 +6193,31 @@ export const partitionQueue: {
|
|
|
6012
6193
|
* @since 4.0.0
|
|
6013
6194
|
* @category Filtering
|
|
6014
6195
|
*/
|
|
6015
|
-
<A,
|
|
6016
|
-
filter: Filter.
|
|
6196
|
+
<A, Pass, Fail>(
|
|
6197
|
+
filter: Filter.Filter<NoInfer<A>, Pass, Fail>,
|
|
6017
6198
|
options?: {
|
|
6018
6199
|
readonly capacity?: number | "unbounded" | undefined
|
|
6019
6200
|
}
|
|
6020
6201
|
): <E, R>(self: Stream<A, E, R>) => Effect.Effect<
|
|
6021
6202
|
[
|
|
6022
|
-
passes: Queue.Dequeue<
|
|
6023
|
-
fails: Queue.Dequeue<
|
|
6203
|
+
passes: Queue.Dequeue<Pass, E | Cause.Done>,
|
|
6204
|
+
fails: Queue.Dequeue<Fail, E | Cause.Done>
|
|
6024
6205
|
],
|
|
6025
6206
|
never,
|
|
6026
6207
|
R | Scope.Scope
|
|
6027
6208
|
>
|
|
6028
6209
|
/**
|
|
6029
|
-
* 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.
|
|
6030
6211
|
*
|
|
6031
6212
|
* Each queue fails with the stream error or `Cause.Done` when the source ends.
|
|
6032
6213
|
*
|
|
6033
6214
|
* @example
|
|
6034
6215
|
* ```ts
|
|
6035
|
-
* import { Console, Effect,
|
|
6036
|
-
*
|
|
6037
|
-
* const program = Effect.gen(function*() {
|
|
6038
|
-
* const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
6039
|
-
* Stream.partitionQueue(
|
|
6040
|
-
* Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
|
|
6041
|
-
* )
|
|
6042
|
-
* )
|
|
6043
|
-
*
|
|
6044
|
-
* const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
|
|
6045
|
-
* const failValues = yield* Stream.fromQueue(fails).pipe(Stream.runCollect)
|
|
6046
|
-
*
|
|
6047
|
-
* yield* Console.log(passValues)
|
|
6048
|
-
* // Output: [ 2, 4 ]
|
|
6049
|
-
* yield* Console.log(failValues)
|
|
6050
|
-
* // Output: [ 1, 3 ]
|
|
6051
|
-
* })
|
|
6052
|
-
*
|
|
6053
|
-
* Effect.runPromise(Effect.scoped(program))
|
|
6054
|
-
* ```
|
|
6055
|
-
*
|
|
6056
|
-
* @since 4.0.0
|
|
6057
|
-
* @category Filtering
|
|
6058
|
-
*/
|
|
6059
|
-
<A, E, R, B extends A>(
|
|
6060
|
-
self: Stream<A, E, R>,
|
|
6061
|
-
refinement: Refinement<A, B>,
|
|
6062
|
-
options?: {
|
|
6063
|
-
readonly capacity?: number | "unbounded" | undefined
|
|
6064
|
-
}
|
|
6065
|
-
): Effect.Effect<
|
|
6066
|
-
[
|
|
6067
|
-
passes: Queue.Dequeue<B, E | Cause.Done>,
|
|
6068
|
-
fails: Queue.Dequeue<Exclude<A, B>, E | Cause.Done>
|
|
6069
|
-
],
|
|
6070
|
-
never,
|
|
6071
|
-
R | Scope.Scope
|
|
6072
|
-
>
|
|
6073
|
-
/**
|
|
6074
|
-
* Partitions a stream using a Filter and exposes passing and failing values as queues.
|
|
6075
|
-
*
|
|
6076
|
-
* Each queue fails with the stream error or `Cause.Done` when the source ends.
|
|
6077
|
-
*
|
|
6078
|
-
* @example
|
|
6079
|
-
* ```ts
|
|
6080
|
-
* import { Console, Effect, Filter, Result, Stream } from "effect"
|
|
6216
|
+
* import { Console, Effect, Result, Stream } from "effect"
|
|
6081
6217
|
*
|
|
6082
6218
|
* const program = Effect.gen(function*() {
|
|
6083
6219
|
* const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
6084
|
-
* Stream.partitionQueue(
|
|
6085
|
-
* Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
|
|
6086
|
-
* )
|
|
6220
|
+
* Stream.partitionQueue((n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
|
|
6087
6221
|
* )
|
|
6088
6222
|
*
|
|
6089
6223
|
* const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
|
|
@@ -6101,16 +6235,16 @@ export const partitionQueue: {
|
|
|
6101
6235
|
* @since 4.0.0
|
|
6102
6236
|
* @category Filtering
|
|
6103
6237
|
*/
|
|
6104
|
-
<A, E, R,
|
|
6238
|
+
<A, E, R, Pass, Fail>(
|
|
6105
6239
|
self: Stream<A, E, R>,
|
|
6106
|
-
filter: Filter.
|
|
6240
|
+
filter: Filter.Filter<NoInfer<A>, Pass, Fail>,
|
|
6107
6241
|
options?: {
|
|
6108
6242
|
readonly capacity?: number | "unbounded" | undefined
|
|
6109
6243
|
}
|
|
6110
6244
|
): Effect.Effect<
|
|
6111
6245
|
[
|
|
6112
|
-
passes: Queue.Dequeue<
|
|
6113
|
-
fails: Queue.Dequeue<
|
|
6246
|
+
passes: Queue.Dequeue<Pass, E | Cause.Done>,
|
|
6247
|
+
fails: Queue.Dequeue<Fail, E | Cause.Done>
|
|
6114
6248
|
],
|
|
6115
6249
|
never,
|
|
6116
6250
|
R | Scope.Scope
|
|
@@ -6118,16 +6252,16 @@ export const partitionQueue: {
|
|
|
6118
6252
|
} = dual(
|
|
6119
6253
|
(args) => isStream(args[0]),
|
|
6120
6254
|
Effect.fnUntraced(
|
|
6121
|
-
function*<A, E, R,
|
|
6255
|
+
function*<A, E, R, Pass, Fail>(
|
|
6122
6256
|
self: Stream<A, E, R>,
|
|
6123
|
-
filter: Filter.
|
|
6257
|
+
filter: Filter.Filter<NoInfer<A>, Pass, Fail>,
|
|
6124
6258
|
options?: {
|
|
6125
6259
|
readonly capacity?: number | "unbounded" | undefined
|
|
6126
6260
|
}
|
|
6127
6261
|
): Effect.fn.Return<
|
|
6128
6262
|
[
|
|
6129
|
-
passes: Queue.Dequeue<
|
|
6130
|
-
fails: Queue.Dequeue<
|
|
6263
|
+
passes: Queue.Dequeue<Pass, E | Cause.Done>,
|
|
6264
|
+
fails: Queue.Dequeue<Fail, E | Cause.Done>
|
|
6131
6265
|
],
|
|
6132
6266
|
never,
|
|
6133
6267
|
R | Scope.Scope
|
|
@@ -6136,19 +6270,17 @@ export const partitionQueue: {
|
|
|
6136
6270
|
const pull = yield* Channel.toPullScoped(self.channel, scope)
|
|
6137
6271
|
const capacity = options?.capacity === "unbounded" ? undefined : options?.capacity ?? DefaultChunkSize
|
|
6138
6272
|
const passes = yield* Queue.make</**
|
|
6139
|
-
* 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.
|
|
6140
6274
|
*
|
|
6141
6275
|
* Each queue fails with the stream error or `Cause.Done` when the source ends.
|
|
6142
6276
|
*
|
|
6143
6277
|
* @example
|
|
6144
6278
|
* ```ts
|
|
6145
|
-
* import { Console, Effect,
|
|
6279
|
+
* import { Console, Effect, Result, Stream } from "effect"
|
|
6146
6280
|
*
|
|
6147
6281
|
* const program = Effect.gen(function*() {
|
|
6148
6282
|
* const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
6149
|
-
* Stream.partitionQueue(
|
|
6150
|
-
* Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
|
|
6151
|
-
* )
|
|
6283
|
+
* Stream.partitionQueue((n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
|
|
6152
6284
|
* )
|
|
6153
6285
|
*
|
|
6154
6286
|
* const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
|
|
@@ -6166,20 +6298,18 @@ export const partitionQueue: {
|
|
|
6166
6298
|
* @since 4.0.0
|
|
6167
6299
|
* @category Filtering
|
|
6168
6300
|
*/
|
|
6169
|
-
|
|
6170
|
-
* 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.
|
|
6171
6303
|
*
|
|
6172
6304
|
* Each queue fails with the stream error or `Cause.Done` when the source ends.
|
|
6173
6305
|
*
|
|
6174
6306
|
* @example
|
|
6175
6307
|
* ```ts
|
|
6176
|
-
* import { Console, Effect,
|
|
6308
|
+
* import { Console, Effect, Result, Stream } from "effect"
|
|
6177
6309
|
*
|
|
6178
6310
|
* const program = Effect.gen(function*() {
|
|
6179
6311
|
* const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
6180
|
-
* Stream.partitionQueue(
|
|
6181
|
-
* Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
|
|
6182
|
-
* )
|
|
6312
|
+
* Stream.partitionQueue((n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
|
|
6183
6313
|
* )
|
|
6184
6314
|
*
|
|
6185
6315
|
* const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
|
|
@@ -6199,19 +6329,17 @@ export const partitionQueue: {
|
|
|
6199
6329
|
*/
|
|
6200
6330
|
E | Cause.Done>({ capacity })
|
|
6201
6331
|
const fails = yield* Queue.make</**
|
|
6202
|
-
* 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.
|
|
6203
6333
|
*
|
|
6204
6334
|
* Each queue fails with the stream error or `Cause.Done` when the source ends.
|
|
6205
6335
|
*
|
|
6206
6336
|
* @example
|
|
6207
6337
|
* ```ts
|
|
6208
|
-
* import { Console, Effect,
|
|
6338
|
+
* import { Console, Effect, Result, Stream } from "effect"
|
|
6209
6339
|
*
|
|
6210
6340
|
* const program = Effect.gen(function*() {
|
|
6211
6341
|
* const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
6212
|
-
* Stream.partitionQueue(
|
|
6213
|
-
* Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
|
|
6214
|
-
* )
|
|
6342
|
+
* Stream.partitionQueue((n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
|
|
6215
6343
|
* )
|
|
6216
6344
|
*
|
|
6217
6345
|
* const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
|
|
@@ -6229,20 +6357,18 @@ export const partitionQueue: {
|
|
|
6229
6357
|
* @since 4.0.0
|
|
6230
6358
|
* @category Filtering
|
|
6231
6359
|
*/
|
|
6232
|
-
|
|
6233
|
-
* 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.
|
|
6234
6362
|
*
|
|
6235
6363
|
* Each queue fails with the stream error or `Cause.Done` when the source ends.
|
|
6236
6364
|
*
|
|
6237
6365
|
* @example
|
|
6238
6366
|
* ```ts
|
|
6239
|
-
* import { Console, Effect,
|
|
6367
|
+
* import { Console, Effect, Result, Stream } from "effect"
|
|
6240
6368
|
*
|
|
6241
6369
|
* const program = Effect.gen(function*() {
|
|
6242
6370
|
* const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
6243
|
-
* Stream.partitionQueue(
|
|
6244
|
-
* Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
|
|
6245
|
-
* )
|
|
6371
|
+
* Stream.partitionQueue((n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
|
|
6246
6372
|
* )
|
|
6247
6373
|
*
|
|
6248
6374
|
* const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
|
|
@@ -6262,12 +6388,19 @@ export const partitionQueue: {
|
|
|
6262
6388
|
*/
|
|
6263
6389
|
E | Cause.Done>({ capacity })
|
|
6264
6390
|
|
|
6265
|
-
const partitionArr = Arr.partition(filter as any)
|
|
6266
|
-
|
|
6267
6391
|
yield* Effect.gen(function*() {
|
|
6268
6392
|
while (true) {
|
|
6269
6393
|
const chunk = yield* pull
|
|
6270
|
-
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
|
+
}
|
|
6271
6404
|
let passFiber: Fiber.Fiber<any> | undefined = undefined
|
|
6272
6405
|
if (satisfying.length > 0) {
|
|
6273
6406
|
const leftover = Queue.offerAllUnsafe(passes, satisfying)
|
|
@@ -6298,147 +6431,112 @@ export const partitionQueue: {
|
|
|
6298
6431
|
)
|
|
6299
6432
|
|
|
6300
6433
|
/**
|
|
6301
|
-
* Splits a stream using an effectful
|
|
6434
|
+
* Splits a stream using an effectful `Filter`, producing pass and fail streams.
|
|
6302
6435
|
*
|
|
6303
6436
|
* @since 4.0.0
|
|
6304
6437
|
* @category Filtering
|
|
6305
|
-
*
|
|
6306
|
-
* @example
|
|
6307
|
-
* ```ts
|
|
6308
|
-
* import { Console, Effect, Result, Stream } from "effect"
|
|
6309
|
-
*
|
|
6310
|
-
* const program = Effect.scoped(
|
|
6311
|
-
* Effect.gen(function*() {
|
|
6312
|
-
* const [evens, odds] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
6313
|
-
* Stream.partitionEffect((n) =>
|
|
6314
|
-
* Effect.succeed(n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
|
|
6315
|
-
* )
|
|
6316
|
-
* )
|
|
6317
|
-
* const result = yield* Effect.all({
|
|
6318
|
-
* evens: Stream.runCollect(evens),
|
|
6319
|
-
* odds: Stream.runCollect(odds)
|
|
6320
|
-
* })
|
|
6321
|
-
* yield* Console.log(result)
|
|
6322
|
-
* })
|
|
6323
|
-
* )
|
|
6324
|
-
*
|
|
6325
|
-
* Effect.runPromise(program)
|
|
6326
|
-
* // Output: { evens: [ 2, 4 ], odds: [ 1, 3 ] }
|
|
6327
|
-
* ```
|
|
6328
6438
|
*/
|
|
6329
6439
|
export const partitionEffect: {
|
|
6330
6440
|
/**
|
|
6331
|
-
* Splits a stream using an effectful
|
|
6441
|
+
* Splits a stream using an effectful `Filter`, producing pass and fail streams.
|
|
6332
6442
|
*
|
|
6333
6443
|
* @since 4.0.0
|
|
6334
6444
|
* @category Filtering
|
|
6335
|
-
*
|
|
6336
|
-
* @example
|
|
6337
|
-
* ```ts
|
|
6338
|
-
* import { Console, Effect, Result, Stream } from "effect"
|
|
6339
|
-
*
|
|
6340
|
-
* const program = Effect.scoped(
|
|
6341
|
-
* Effect.gen(function*() {
|
|
6342
|
-
* const [evens, odds] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
6343
|
-
* Stream.partitionEffect((n) =>
|
|
6344
|
-
* Effect.succeed(n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
|
|
6345
|
-
* )
|
|
6346
|
-
* )
|
|
6347
|
-
* const result = yield* Effect.all({
|
|
6348
|
-
* evens: Stream.runCollect(evens),
|
|
6349
|
-
* odds: Stream.runCollect(odds)
|
|
6350
|
-
* })
|
|
6351
|
-
* yield* Console.log(result)
|
|
6352
|
-
* })
|
|
6353
|
-
* )
|
|
6354
|
-
*
|
|
6355
|
-
* Effect.runPromise(program)
|
|
6356
|
-
* // Output: { evens: [ 2, 4 ], odds: [ 1, 3 ] }
|
|
6357
|
-
* ```
|
|
6358
6445
|
*/
|
|
6359
|
-
<A,
|
|
6360
|
-
filter: Filter.FilterEffect<A
|
|
6446
|
+
<A, Pass, Fail, EX, RX>(
|
|
6447
|
+
filter: Filter.FilterEffect<NoInfer<A>, Pass, Fail, EX, RX>,
|
|
6361
6448
|
options?: {
|
|
6362
6449
|
readonly capacity?: number | "unbounded" | undefined
|
|
6363
6450
|
readonly concurrency?: number | "unbounded" | undefined
|
|
6364
6451
|
}
|
|
6365
6452
|
): <E, R>(self: Stream<A, E, R>) => Effect.Effect<
|
|
6366
6453
|
[
|
|
6367
|
-
passes: Stream<
|
|
6368
|
-
fails: Stream<
|
|
6454
|
+
passes: Stream<Pass, E | EX>,
|
|
6455
|
+
fails: Stream<Fail, E | EX>
|
|
6369
6456
|
],
|
|
6370
6457
|
never,
|
|
6371
6458
|
R | RX | Scope.Scope
|
|
6372
6459
|
>
|
|
6373
6460
|
/**
|
|
6374
|
-
* Splits a stream using an effectful
|
|
6461
|
+
* Splits a stream using an effectful `Filter`, producing pass and fail streams.
|
|
6375
6462
|
*
|
|
6376
6463
|
* @since 4.0.0
|
|
6377
6464
|
* @category Filtering
|
|
6378
|
-
*
|
|
6379
|
-
* @example
|
|
6380
|
-
* ```ts
|
|
6381
|
-
* import { Console, Effect, Result, Stream } from "effect"
|
|
6382
|
-
*
|
|
6383
|
-
* const program = Effect.scoped(
|
|
6384
|
-
* Effect.gen(function*() {
|
|
6385
|
-
* const [evens, odds] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
6386
|
-
* Stream.partitionEffect((n) =>
|
|
6387
|
-
* Effect.succeed(n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
|
|
6388
|
-
* )
|
|
6389
|
-
* )
|
|
6390
|
-
* const result = yield* Effect.all({
|
|
6391
|
-
* evens: Stream.runCollect(evens),
|
|
6392
|
-
* odds: Stream.runCollect(odds)
|
|
6393
|
-
* })
|
|
6394
|
-
* yield* Console.log(result)
|
|
6395
|
-
* })
|
|
6396
|
-
* )
|
|
6397
|
-
*
|
|
6398
|
-
* Effect.runPromise(program)
|
|
6399
|
-
* // Output: { evens: [ 2, 4 ], odds: [ 1, 3 ] }
|
|
6400
|
-
* ```
|
|
6401
6465
|
*/
|
|
6402
|
-
<A, E, R,
|
|
6466
|
+
<A, E, R, Pass, Fail, EX, RX>(
|
|
6403
6467
|
self: Stream<A, E, R>,
|
|
6404
|
-
filter: Filter.FilterEffect<A
|
|
6468
|
+
filter: Filter.FilterEffect<NoInfer<A>, Pass, Fail, EX, RX>,
|
|
6405
6469
|
options?: {
|
|
6406
6470
|
readonly capacity?: number | "unbounded" | undefined
|
|
6407
6471
|
readonly concurrency?: number | "unbounded" | undefined
|
|
6408
6472
|
}
|
|
6409
6473
|
): Effect.Effect<
|
|
6410
6474
|
[
|
|
6411
|
-
passes: Stream<
|
|
6412
|
-
fails: Stream<
|
|
6475
|
+
passes: Stream<Pass, E | EX>,
|
|
6476
|
+
fails: Stream<Fail, E | EX>
|
|
6413
6477
|
],
|
|
6414
6478
|
never,
|
|
6415
6479
|
R | RX | Scope.Scope
|
|
6416
6480
|
>
|
|
6417
6481
|
} = dual(
|
|
6418
6482
|
(args) => isStream(args[0]),
|
|
6419
|
-
<A, E, R,
|
|
6420
|
-
|
|
6421
|
-
|
|
6422
|
-
|
|
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<
|
|
6423
6491
|
[
|
|
6424
|
-
passes: Stream<
|
|
6425
|
-
fails: Stream<
|
|
6492
|
+
passes: Stream<Pass, E | EX>,
|
|
6493
|
+
fails: Stream<Fail, E | EX>
|
|
6426
6494
|
],
|
|
6427
6495
|
never,
|
|
6428
6496
|
R | RX | Scope.Scope
|
|
6429
6497
|
> =>
|
|
6430
6498
|
Effect.map(
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
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
|
|
6434
6533
|
),
|
|
6435
|
-
([passes, fails]) => [fromQueue(passes), fromQueue(fails)]
|
|
6436
|
-
)
|
|
6534
|
+
([passes, fails]) => [fromQueue(passes), fromQueue(fails)] as const
|
|
6535
|
+
)
|
|
6437
6536
|
)
|
|
6438
6537
|
|
|
6439
6538
|
/**
|
|
6440
|
-
* Splits a stream into excluded and satisfying substreams using a
|
|
6441
|
-
* refinement, or Filter.
|
|
6539
|
+
* Splits a stream into excluded and satisfying substreams using a `Filter`.
|
|
6442
6540
|
*
|
|
6443
6541
|
* The faster stream may advance up to `bufferSize` elements ahead of the slower
|
|
6444
6542
|
* one.
|
|
@@ -6448,12 +6546,12 @@ export const partitionEffect: {
|
|
|
6448
6546
|
*
|
|
6449
6547
|
* @example
|
|
6450
6548
|
* ```ts
|
|
6451
|
-
* import { Console, Effect, Stream } from "effect"
|
|
6549
|
+
* import { Console, Effect, Result, Stream } from "effect"
|
|
6452
6550
|
*
|
|
6453
6551
|
* const program = Effect.gen(function*() {
|
|
6454
6552
|
* const [excluded, satisfying] = yield* Stream.partition(
|
|
6455
6553
|
* Stream.make(1, 2, 3, 4),
|
|
6456
|
-
* (n) => n % 2 === 0
|
|
6554
|
+
* (n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n)
|
|
6457
6555
|
* )
|
|
6458
6556
|
* const left = yield* Stream.runCollect(excluded)
|
|
6459
6557
|
* const right = yield* Stream.runCollect(satisfying)
|
|
@@ -6466,46 +6564,7 @@ export const partitionEffect: {
|
|
|
6466
6564
|
*/
|
|
6467
6565
|
export const partition: {
|
|
6468
6566
|
/**
|
|
6469
|
-
* Splits a stream into excluded and satisfying substreams using a
|
|
6470
|
-
* refinement, or Filter.
|
|
6471
|
-
*
|
|
6472
|
-
* The faster stream may advance up to `bufferSize` elements ahead of the slower
|
|
6473
|
-
* one.
|
|
6474
|
-
*
|
|
6475
|
-
* @since 4.0.0
|
|
6476
|
-
* @category Filtering
|
|
6477
|
-
*
|
|
6478
|
-
* @example
|
|
6479
|
-
* ```ts
|
|
6480
|
-
* import { Console, Effect, Stream } from "effect"
|
|
6481
|
-
*
|
|
6482
|
-
* const program = Effect.gen(function*() {
|
|
6483
|
-
* const [excluded, satisfying] = yield* Stream.partition(
|
|
6484
|
-
* Stream.make(1, 2, 3, 4),
|
|
6485
|
-
* (n) => n % 2 === 0
|
|
6486
|
-
* )
|
|
6487
|
-
* const left = yield* Stream.runCollect(excluded)
|
|
6488
|
-
* const right = yield* Stream.runCollect(satisfying)
|
|
6489
|
-
* yield* Console.log(left)
|
|
6490
|
-
* // Output: [ 1, 3 ]
|
|
6491
|
-
* yield* Console.log(right)
|
|
6492
|
-
* // Output: [ 2, 4 ]
|
|
6493
|
-
* })
|
|
6494
|
-
* ```
|
|
6495
|
-
*/
|
|
6496
|
-
<C extends A, B extends A, A = C>(
|
|
6497
|
-
refinement: Refinement<NoInfer<A>, B>,
|
|
6498
|
-
options?: { readonly bufferSize?: number | undefined }
|
|
6499
|
-
): <E, R>(
|
|
6500
|
-
self: Stream<C, E, R>
|
|
6501
|
-
) => Effect.Effect<
|
|
6502
|
-
[excluded: Stream<Exclude<C, B>, E>, satisfying: Stream<B, E>],
|
|
6503
|
-
never,
|
|
6504
|
-
R | Scope.Scope
|
|
6505
|
-
>
|
|
6506
|
-
/**
|
|
6507
|
-
* Splits a stream into excluded and satisfying substreams using a predicate,
|
|
6508
|
-
* refinement, or Filter.
|
|
6567
|
+
* Splits a stream into excluded and satisfying substreams using a `Filter`.
|
|
6509
6568
|
*
|
|
6510
6569
|
* The faster stream may advance up to `bufferSize` elements ahead of the slower
|
|
6511
6570
|
* one.
|
|
@@ -6515,12 +6574,12 @@ export const partition: {
|
|
|
6515
6574
|
*
|
|
6516
6575
|
* @example
|
|
6517
6576
|
* ```ts
|
|
6518
|
-
* import { Console, Effect, Stream } from "effect"
|
|
6577
|
+
* import { Console, Effect, Result, Stream } from "effect"
|
|
6519
6578
|
*
|
|
6520
6579
|
* const program = Effect.gen(function*() {
|
|
6521
6580
|
* const [excluded, satisfying] = yield* Stream.partition(
|
|
6522
6581
|
* Stream.make(1, 2, 3, 4),
|
|
6523
|
-
* (n) => n % 2 === 0
|
|
6582
|
+
* (n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n)
|
|
6524
6583
|
* )
|
|
6525
6584
|
* const left = yield* Stream.runCollect(excluded)
|
|
6526
6585
|
* const right = yield* Stream.runCollect(satisfying)
|
|
@@ -6531,56 +6590,18 @@ export const partition: {
|
|
|
6531
6590
|
* })
|
|
6532
6591
|
* ```
|
|
6533
6592
|
*/
|
|
6534
|
-
<A,
|
|
6535
|
-
filter: Filter.
|
|
6593
|
+
<A, Pass, Fail>(
|
|
6594
|
+
filter: Filter.Filter<NoInfer<A>, Pass, Fail>,
|
|
6536
6595
|
options?: { readonly bufferSize?: number | undefined }
|
|
6537
6596
|
): <E, R>(
|
|
6538
6597
|
self: Stream<A, E, R>
|
|
6539
6598
|
) => Effect.Effect<
|
|
6540
|
-
[excluded: Stream<
|
|
6541
|
-
never,
|
|
6542
|
-
R | Scope.Scope
|
|
6543
|
-
>
|
|
6544
|
-
/**
|
|
6545
|
-
* Splits a stream into excluded and satisfying substreams using a predicate,
|
|
6546
|
-
* refinement, or Filter.
|
|
6547
|
-
*
|
|
6548
|
-
* The faster stream may advance up to `bufferSize` elements ahead of the slower
|
|
6549
|
-
* one.
|
|
6550
|
-
*
|
|
6551
|
-
* @since 4.0.0
|
|
6552
|
-
* @category Filtering
|
|
6553
|
-
*
|
|
6554
|
-
* @example
|
|
6555
|
-
* ```ts
|
|
6556
|
-
* import { Console, Effect, Stream } from "effect"
|
|
6557
|
-
*
|
|
6558
|
-
* const program = Effect.gen(function*() {
|
|
6559
|
-
* const [excluded, satisfying] = yield* Stream.partition(
|
|
6560
|
-
* Stream.make(1, 2, 3, 4),
|
|
6561
|
-
* (n) => n % 2 === 0
|
|
6562
|
-
* )
|
|
6563
|
-
* const left = yield* Stream.runCollect(excluded)
|
|
6564
|
-
* const right = yield* Stream.runCollect(satisfying)
|
|
6565
|
-
* yield* Console.log(left)
|
|
6566
|
-
* // Output: [ 1, 3 ]
|
|
6567
|
-
* yield* Console.log(right)
|
|
6568
|
-
* // Output: [ 2, 4 ]
|
|
6569
|
-
* })
|
|
6570
|
-
* ```
|
|
6571
|
-
*/
|
|
6572
|
-
<C extends A, E, R, B extends A, A = C>(
|
|
6573
|
-
self: Stream<C, E, R>,
|
|
6574
|
-
refinement: Refinement<A, B>,
|
|
6575
|
-
options?: { readonly bufferSize?: number | undefined }
|
|
6576
|
-
): Effect.Effect<
|
|
6577
|
-
[excluded: Stream<Exclude<C, B>, E>, satisfying: Stream<B, E>],
|
|
6599
|
+
[excluded: Stream<Fail, E>, satisfying: Stream<Pass, E>],
|
|
6578
6600
|
never,
|
|
6579
6601
|
R | Scope.Scope
|
|
6580
6602
|
>
|
|
6581
6603
|
/**
|
|
6582
|
-
* Splits a stream into excluded and satisfying substreams using a
|
|
6583
|
-
* refinement, or Filter.
|
|
6604
|
+
* Splits a stream into excluded and satisfying substreams using a `Filter`.
|
|
6584
6605
|
*
|
|
6585
6606
|
* The faster stream may advance up to `bufferSize` elements ahead of the slower
|
|
6586
6607
|
* one.
|
|
@@ -6590,12 +6611,12 @@ export const partition: {
|
|
|
6590
6611
|
*
|
|
6591
6612
|
* @example
|
|
6592
6613
|
* ```ts
|
|
6593
|
-
* import { Console, Effect, Stream } from "effect"
|
|
6614
|
+
* import { Console, Effect, Result, Stream } from "effect"
|
|
6594
6615
|
*
|
|
6595
6616
|
* const program = Effect.gen(function*() {
|
|
6596
6617
|
* const [excluded, satisfying] = yield* Stream.partition(
|
|
6597
6618
|
* Stream.make(1, 2, 3, 4),
|
|
6598
|
-
* (n) => n % 2 === 0
|
|
6619
|
+
* (n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n)
|
|
6599
6620
|
* )
|
|
6600
6621
|
* const left = yield* Stream.runCollect(excluded)
|
|
6601
6622
|
* const right = yield* Stream.runCollect(satisfying)
|
|
@@ -6606,28 +6627,28 @@ export const partition: {
|
|
|
6606
6627
|
* })
|
|
6607
6628
|
* ```
|
|
6608
6629
|
*/
|
|
6609
|
-
<A, E, R,
|
|
6630
|
+
<A, E, R, Pass, Fail>(
|
|
6610
6631
|
self: Stream<A, E, R>,
|
|
6611
|
-
filter: Filter.
|
|
6632
|
+
filter: Filter.Filter<NoInfer<A>, Pass, Fail>,
|
|
6612
6633
|
options?: { readonly bufferSize?: number | undefined }
|
|
6613
6634
|
): Effect.Effect<
|
|
6614
|
-
[excluded: Stream<
|
|
6635
|
+
[excluded: Stream<Fail, E>, satisfying: Stream<Pass, E>],
|
|
6615
6636
|
never,
|
|
6616
6637
|
R | Scope.Scope
|
|
6617
6638
|
>
|
|
6618
6639
|
} = dual(
|
|
6619
6640
|
(args) => isStream(args[0]),
|
|
6620
|
-
<A, E, R,
|
|
6641
|
+
<A, E, R, Pass, Fail>(
|
|
6621
6642
|
self: Stream<A, E, R>,
|
|
6622
|
-
filter: Filter.
|
|
6643
|
+
filter: Filter.Filter<NoInfer<A>, Pass, Fail>,
|
|
6623
6644
|
options?: { readonly bufferSize?: number | undefined }
|
|
6624
6645
|
): Effect.Effect<
|
|
6625
|
-
[excluded: Stream<
|
|
6646
|
+
[excluded: Stream<Fail, E>, satisfying: Stream<Pass, E>],
|
|
6626
6647
|
never,
|
|
6627
6648
|
R | Scope.Scope
|
|
6628
6649
|
> =>
|
|
6629
6650
|
Effect.map(
|
|
6630
|
-
partitionQueue(filter, { capacity: options?.bufferSize ?? 16 })
|
|
6651
|
+
partitionQueue(self, filter, { capacity: options?.bufferSize ?? 16 }),
|
|
6631
6652
|
([passes, fails]) => [fromQueue(fails), fromQueue(passes)] as const
|
|
6632
6653
|
)
|
|
6633
6654
|
)
|
|
@@ -7409,7 +7430,7 @@ export const tapError: {
|
|
|
7409
7430
|
))
|
|
7410
7431
|
|
|
7411
7432
|
/**
|
|
7412
|
-
* Recovers from errors that match a
|
|
7433
|
+
* Recovers from errors that match a predicate by switching to a recovery stream.
|
|
7413
7434
|
*
|
|
7414
7435
|
* When a failure matches the filter, the stream switches to the recovery
|
|
7415
7436
|
* stream. Non-matching failures propagate downstream, so the error type is
|
|
@@ -7423,12 +7444,12 @@ export const tapError: {
|
|
|
7423
7444
|
*
|
|
7424
7445
|
* @example
|
|
7425
7446
|
* ```ts
|
|
7426
|
-
* import { Console, Effect,
|
|
7447
|
+
* import { Console, Effect, Stream } from "effect"
|
|
7427
7448
|
*
|
|
7428
7449
|
* const stream = Stream.make(1, 2).pipe(
|
|
7429
7450
|
* Stream.concat(Stream.fail(42)),
|
|
7430
7451
|
* Stream.catchIf(
|
|
7431
|
-
*
|
|
7452
|
+
* (error): error is 42 => error === 42,
|
|
7432
7453
|
* () => Stream.make(999)
|
|
7433
7454
|
* )
|
|
7434
7455
|
* )
|
|
@@ -7447,7 +7468,7 @@ export const tapError: {
|
|
|
7447
7468
|
*/
|
|
7448
7469
|
export const catchIf: {
|
|
7449
7470
|
/**
|
|
7450
|
-
* Recovers from errors that match a
|
|
7471
|
+
* Recovers from errors that match a predicate by switching to a recovery stream.
|
|
7451
7472
|
*
|
|
7452
7473
|
* When a failure matches the filter, the stream switches to the recovery
|
|
7453
7474
|
* stream. Non-matching failures propagate downstream, so the error type is
|
|
@@ -7461,12 +7482,12 @@ export const catchIf: {
|
|
|
7461
7482
|
*
|
|
7462
7483
|
* @example
|
|
7463
7484
|
* ```ts
|
|
7464
|
-
* import { Console, Effect,
|
|
7485
|
+
* import { Console, Effect, Stream } from "effect"
|
|
7465
7486
|
*
|
|
7466
7487
|
* const stream = Stream.make(1, 2).pipe(
|
|
7467
7488
|
* Stream.concat(Stream.fail(42)),
|
|
7468
7489
|
* Stream.catchIf(
|
|
7469
|
-
*
|
|
7490
|
+
* (error): error is 42 => error === 42,
|
|
7470
7491
|
* () => Stream.make(999)
|
|
7471
7492
|
* )
|
|
7472
7493
|
* )
|
|
@@ -7489,7 +7510,7 @@ export const catchIf: {
|
|
|
7489
7510
|
orElse?: ((e: Exclude<E, EB>) => Stream<A3, E3, R3>) | undefined
|
|
7490
7511
|
): <A, R>(self: Stream<A, E, R>) => Stream<A2 | A | A3, E2 | E3, R2 | R | R3>
|
|
7491
7512
|
/**
|
|
7492
|
-
* Recovers from errors that match a
|
|
7513
|
+
* Recovers from errors that match a predicate by switching to a recovery stream.
|
|
7493
7514
|
*
|
|
7494
7515
|
* When a failure matches the filter, the stream switches to the recovery
|
|
7495
7516
|
* stream. Non-matching failures propagate downstream, so the error type is
|
|
@@ -7503,12 +7524,12 @@ export const catchIf: {
|
|
|
7503
7524
|
*
|
|
7504
7525
|
* @example
|
|
7505
7526
|
* ```ts
|
|
7506
|
-
* import { Console, Effect,
|
|
7527
|
+
* import { Console, Effect, Stream } from "effect"
|
|
7507
7528
|
*
|
|
7508
7529
|
* const stream = Stream.make(1, 2).pipe(
|
|
7509
7530
|
* Stream.concat(Stream.fail(42)),
|
|
7510
7531
|
* Stream.catchIf(
|
|
7511
|
-
*
|
|
7532
|
+
* (error): error is 42 => error === 42,
|
|
7512
7533
|
* () => Stream.make(999)
|
|
7513
7534
|
* )
|
|
7514
7535
|
* )
|
|
@@ -7525,13 +7546,13 @@ export const catchIf: {
|
|
|
7525
7546
|
* @since 4.0.0
|
|
7526
7547
|
* @category Error Handling
|
|
7527
7548
|
*/
|
|
7528
|
-
<E,
|
|
7529
|
-
|
|
7530
|
-
f: (
|
|
7531
|
-
orElse?: ((
|
|
7532
|
-
): <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>
|
|
7533
7554
|
/**
|
|
7534
|
-
* Recovers from errors that match a
|
|
7555
|
+
* Recovers from errors that match a predicate by switching to a recovery stream.
|
|
7535
7556
|
*
|
|
7536
7557
|
* When a failure matches the filter, the stream switches to the recovery
|
|
7537
7558
|
* stream. Non-matching failures propagate downstream, so the error type is
|
|
@@ -7545,12 +7566,12 @@ export const catchIf: {
|
|
|
7545
7566
|
*
|
|
7546
7567
|
* @example
|
|
7547
7568
|
* ```ts
|
|
7548
|
-
* import { Console, Effect,
|
|
7569
|
+
* import { Console, Effect, Stream } from "effect"
|
|
7549
7570
|
*
|
|
7550
7571
|
* const stream = Stream.make(1, 2).pipe(
|
|
7551
7572
|
* Stream.concat(Stream.fail(42)),
|
|
7552
7573
|
* Stream.catchIf(
|
|
7553
|
-
*
|
|
7574
|
+
* (error): error is 42 => error === 42,
|
|
7554
7575
|
* () => Stream.make(999)
|
|
7555
7576
|
* )
|
|
7556
7577
|
* )
|
|
@@ -7574,7 +7595,7 @@ export const catchIf: {
|
|
|
7574
7595
|
orElse?: ((e: Exclude<E, EB>) => Stream<A3, E3, R3>) | undefined
|
|
7575
7596
|
): Stream<A | A2 | A3, E2 | E3, R | R2 | R3>
|
|
7576
7597
|
/**
|
|
7577
|
-
* Recovers from errors that match a
|
|
7598
|
+
* Recovers from errors that match a predicate by switching to a recovery stream.
|
|
7578
7599
|
*
|
|
7579
7600
|
* When a failure matches the filter, the stream switches to the recovery
|
|
7580
7601
|
* stream. Non-matching failures propagate downstream, so the error type is
|
|
@@ -7588,12 +7609,12 @@ export const catchIf: {
|
|
|
7588
7609
|
*
|
|
7589
7610
|
* @example
|
|
7590
7611
|
* ```ts
|
|
7591
|
-
* import { Console, Effect,
|
|
7612
|
+
* import { Console, Effect, Stream } from "effect"
|
|
7592
7613
|
*
|
|
7593
7614
|
* const stream = Stream.make(1, 2).pipe(
|
|
7594
7615
|
* Stream.concat(Stream.fail(42)),
|
|
7595
7616
|
* Stream.catchIf(
|
|
7596
|
-
*
|
|
7617
|
+
* (error): error is 42 => error === 42,
|
|
7597
7618
|
* () => Stream.make(999)
|
|
7598
7619
|
* )
|
|
7599
7620
|
* )
|
|
@@ -7610,37 +7631,96 @@ export const catchIf: {
|
|
|
7610
7631
|
* @since 4.0.0
|
|
7611
7632
|
* @category Error Handling
|
|
7612
7633
|
*/
|
|
7613
|
-
<A, E, R,
|
|
7634
|
+
<A, E, R, A2, E2, R2, A3 = never, E3 = E, R3 = never>(
|
|
7614
7635
|
self: Stream<A, E, R>,
|
|
7615
|
-
|
|
7616
|
-
f: (
|
|
7617
|
-
orElse?: ((
|
|
7636
|
+
predicate: Predicate<E>,
|
|
7637
|
+
f: (e: E) => Stream<A2, E2, R2>,
|
|
7638
|
+
orElse?: ((e: E) => Stream<A3, E3, R3>) | undefined
|
|
7618
7639
|
): Stream<A | A2 | A3, E2 | E3, R | R2 | R3>
|
|
7619
7640
|
} = dual((args) => isStream(args[0]), <
|
|
7620
7641
|
A,
|
|
7621
7642
|
E,
|
|
7622
7643
|
R,
|
|
7623
|
-
Result extends Filter.ResultOrBool,
|
|
7624
7644
|
A2,
|
|
7625
7645
|
E2,
|
|
7626
7646
|
R2,
|
|
7627
7647
|
A3 = never,
|
|
7628
|
-
E3 =
|
|
7648
|
+
E3 = E,
|
|
7629
7649
|
R3 = never
|
|
7630
7650
|
>(
|
|
7631
7651
|
self: Stream<A, E, R>,
|
|
7632
|
-
|
|
7633
|
-
f: (failure:
|
|
7634
|
-
orElse?: ((failure:
|
|
7652
|
+
predicate: Predicate<E>,
|
|
7653
|
+
f: (failure: E) => Stream<A2, E2, R2>,
|
|
7654
|
+
orElse?: ((failure: E) => Stream<A3, E3, R3>) | undefined
|
|
7635
7655
|
): Stream<A | A2 | A3, E2 | E3, R | R2 | R3> =>
|
|
7636
7656
|
fromChannel(
|
|
7637
7657
|
Channel.catchIf(
|
|
7638
7658
|
toChannel(self),
|
|
7639
|
-
|
|
7640
|
-
(e
|
|
7641
|
-
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)
|
|
7642
7722
|
)
|
|
7643
|
-
)
|
|
7723
|
+
))
|
|
7644
7724
|
|
|
7645
7725
|
/**
|
|
7646
7726
|
* Recovers from failures whose `_tag` matches the provided value by switching to
|
|
@@ -7979,7 +8059,7 @@ export const catchTags: {
|
|
|
7979
8059
|
>
|
|
7980
8060
|
} = dual((args) => isStream(args[0]), (self, cases, orElse) => {
|
|
7981
8061
|
let keys: Array<string>
|
|
7982
|
-
return
|
|
8062
|
+
return catchFilter(
|
|
7983
8063
|
self,
|
|
7984
8064
|
(e: any) => {
|
|
7985
8065
|
keys ??= Object.keys(cases)
|
|
@@ -8092,8 +8172,16 @@ export const catchReason: {
|
|
|
8092
8172
|
>(
|
|
8093
8173
|
errorTag: K,
|
|
8094
8174
|
reasonTag: RK,
|
|
8095
|
-
f: (
|
|
8096
|
-
|
|
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
|
|
8097
8185
|
): <A, R>(
|
|
8098
8186
|
self: Stream<A, E, R>
|
|
8099
8187
|
) => Stream<A | A2 | Exclude<A3, unassigned>, (A3 extends unassigned ? E : ExcludeTag<E, K>) | E2 | E3, R | R2 | R3>
|
|
@@ -8156,8 +8244,10 @@ export const catchReason: {
|
|
|
8156
8244
|
self: Stream<A, E, R>,
|
|
8157
8245
|
errorTag: K,
|
|
8158
8246
|
reasonTag: RK,
|
|
8159
|
-
f: (reason: ExtractReason<ExtractTag<E, K>, RK>) => Stream<A2, E2, R2>,
|
|
8160
|
-
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
|
|
8161
8251
|
): Stream<A | A2 | Exclude<A3, unassigned>, (A3 extends unassigned ? E : ExcludeTag<E, K>) | E2 | E3, R | R2 | R3>
|
|
8162
8252
|
} = dual(
|
|
8163
8253
|
(args) => isStream(args[0]),
|
|
@@ -8177,16 +8267,18 @@ export const catchReason: {
|
|
|
8177
8267
|
self: Stream<A, E, R>,
|
|
8178
8268
|
errorTag: K,
|
|
8179
8269
|
reasonTag: RK,
|
|
8180
|
-
f: (reason: ExtractReason<ExtractTag<E, K>, RK>) => Stream<A2, E2, R2>,
|
|
8181
|
-
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
|
|
8182
8274
|
): Stream<A | A2 | Exclude<A3, unassigned>, (A3 extends unassigned ? E : ExcludeTag<E, K>) | E2 | E3, R | R2 | R3> =>
|
|
8183
8275
|
fromChannel(
|
|
8184
8276
|
Channel.catchReason(
|
|
8185
8277
|
toChannel(self),
|
|
8186
8278
|
errorTag,
|
|
8187
8279
|
reasonTag,
|
|
8188
|
-
(reason) => f(reason).channel,
|
|
8189
|
-
orElse && ((reason) => orElse(reason).channel)
|
|
8280
|
+
(reason, error) => f(reason, error).channel,
|
|
8281
|
+
orElse && ((reason, error) => orElse(reason, error).channel)
|
|
8190
8282
|
)
|
|
8191
8283
|
) as any
|
|
8192
8284
|
)
|
|
@@ -8279,7 +8371,8 @@ export const catchReasons: {
|
|
|
8279
8371
|
E,
|
|
8280
8372
|
Cases extends {
|
|
8281
8373
|
[RK in ReasonTags<ExtractTag<NoInfer<E>, K>>]+?: (
|
|
8282
|
-
reason: ExtractReason<ExtractTag<NoInfer<E>, K>, RK
|
|
8374
|
+
reason: ExtractReason<ExtractTag<NoInfer<E>, K>, RK>,
|
|
8375
|
+
error: NarrowReason<ExtractTag<NoInfer<E>, K>, RK>
|
|
8283
8376
|
) => Stream<any, any, any>
|
|
8284
8377
|
},
|
|
8285
8378
|
A2 = unassigned,
|
|
@@ -8289,7 +8382,10 @@ export const catchReasons: {
|
|
|
8289
8382
|
errorTag: K,
|
|
8290
8383
|
cases: Cases,
|
|
8291
8384
|
orElse?:
|
|
8292
|
-
| ((
|
|
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>)
|
|
8293
8389
|
| undefined
|
|
8294
8390
|
): <A, R>(self: Stream<A, E, R>) => Stream<
|
|
8295
8391
|
| A
|
|
@@ -8356,7 +8452,8 @@ export const catchReasons: {
|
|
|
8356
8452
|
K extends Tags<E>,
|
|
8357
8453
|
Cases extends {
|
|
8358
8454
|
[RK in ReasonTags<ExtractTag<E, K>>]+?: (
|
|
8359
|
-
reason: ExtractReason<ExtractTag<E, K>, RK
|
|
8455
|
+
reason: ExtractReason<ExtractTag<E, K>, RK>,
|
|
8456
|
+
error: NarrowReason<ExtractTag<E, K>, RK>
|
|
8360
8457
|
) => Stream<any, any, any>
|
|
8361
8458
|
},
|
|
8362
8459
|
A2 = unassigned,
|
|
@@ -8367,7 +8464,10 @@ export const catchReasons: {
|
|
|
8367
8464
|
errorTag: K,
|
|
8368
8465
|
cases: Cases,
|
|
8369
8466
|
orElse?:
|
|
8370
|
-
| ((
|
|
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>)
|
|
8371
8471
|
| undefined
|
|
8372
8472
|
): Stream<
|
|
8373
8473
|
| A
|
|
@@ -8387,12 +8487,12 @@ export const catchReasons: {
|
|
|
8387
8487
|
}[keyof Cases]
|
|
8388
8488
|
>
|
|
8389
8489
|
} = dual((args) => isStream(args[0]), (self, errorTag, cases, orElse) => {
|
|
8390
|
-
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>> = {}
|
|
8391
8491
|
for (const key of Object.keys(cases)) {
|
|
8392
8492
|
const handler = (cases as any)[key]
|
|
8393
|
-
handlers[key] = (reason) => handler(reason).channel
|
|
8493
|
+
handlers[key] = (reason, error) => handler(reason, error).channel
|
|
8394
8494
|
}
|
|
8395
|
-
const orElseHandler = orElse && ((reason: any) => orElse(reason).channel)
|
|
8495
|
+
const orElseHandler = orElse && ((reason: any, error: any) => orElse(reason, error).channel)
|
|
8396
8496
|
return fromChannel(
|
|
8397
8497
|
Channel.catchReasons(self.channel, errorTag as any, handlers as any, orElseHandler as any) as Channel.Channel<
|
|
8398
8498
|
Arr.NonEmptyReadonlyArray<any>,
|
|
@@ -8550,12 +8650,12 @@ export const catchCauseIf: {
|
|
|
8550
8650
|
* @since 4.0.0
|
|
8551
8651
|
* @category Error Handling
|
|
8552
8652
|
*/
|
|
8553
|
-
<E,
|
|
8554
|
-
|
|
8555
|
-
f: (
|
|
8653
|
+
<E, A2, E2, R2>(
|
|
8654
|
+
predicate: Predicate<Cause.Cause<E>>,
|
|
8655
|
+
f: (cause: Cause.Cause<E>) => Stream<A2, E2, R2>
|
|
8556
8656
|
): <A, R>(
|
|
8557
8657
|
self: Stream<A, E, R>
|
|
8558
|
-
) => Stream<A | A2,
|
|
8658
|
+
) => Stream<A | A2, E | E2, R2 | R>
|
|
8559
8659
|
/**
|
|
8560
8660
|
* Recovers from stream failures by filtering the `Cause` and switching to a recovery stream.
|
|
8561
8661
|
* Non-matching causes are re-emitted as failures.
|
|
@@ -8589,19 +8689,68 @@ export const catchCauseIf: {
|
|
|
8589
8689
|
* @since 4.0.0
|
|
8590
8690
|
* @category Error Handling
|
|
8591
8691
|
*/
|
|
8592
|
-
<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>>(
|
|
8593
8739
|
self: Stream<A, E, R>,
|
|
8594
|
-
filter: Filter.
|
|
8595
|
-
f: (failure:
|
|
8596
|
-
): Stream<A | A2, Cause.Cause.Error<
|
|
8597
|
-
} = 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>>(
|
|
8598
8744
|
self: Stream<A, E, R>,
|
|
8599
|
-
filter: Filter.
|
|
8600
|
-
f: (failure:
|
|
8601
|
-
): 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> =>
|
|
8602
8748
|
fromChannel(
|
|
8603
|
-
Channel.
|
|
8604
|
-
|
|
8749
|
+
Channel.catchCauseFilter(
|
|
8750
|
+
self.channel,
|
|
8751
|
+
filter,
|
|
8752
|
+
(failure, cause) => f(failure, cause).channel
|
|
8753
|
+
)
|
|
8605
8754
|
))
|
|
8606
8755
|
|
|
8607
8756
|
/**
|
|
@@ -8820,12 +8969,12 @@ export const orDie = <A, E, R>(self: Stream<A, E, R>): Stream<A, never, R> => fr
|
|
|
8820
8969
|
*/
|
|
8821
8970
|
export const ignore: <
|
|
8822
8971
|
Arg extends Stream<any, any, any> | {
|
|
8823
|
-
readonly log?: boolean |
|
|
8972
|
+
readonly log?: boolean | Severity | undefined
|
|
8824
8973
|
} | undefined
|
|
8825
8974
|
>(
|
|
8826
8975
|
selfOrOptions: Arg,
|
|
8827
8976
|
options?: {
|
|
8828
|
-
readonly log?: boolean |
|
|
8977
|
+
readonly log?: boolean | Severity | undefined
|
|
8829
8978
|
} | undefined
|
|
8830
8979
|
) => [Arg] extends [Stream<infer A, infer _E, infer R>] ? Stream<A, never, R>
|
|
8831
8980
|
: <A, E, R>(self: Stream<A, E, R>) => Stream<A, never, R> = dual(
|
|
@@ -8833,7 +8982,7 @@ export const ignore: <
|
|
|
8833
8982
|
<A, E, R>(
|
|
8834
8983
|
self: Stream<A, E, R>,
|
|
8835
8984
|
options?: {
|
|
8836
|
-
readonly log?: boolean |
|
|
8985
|
+
readonly log?: boolean | Severity | undefined
|
|
8837
8986
|
} | undefined
|
|
8838
8987
|
): Stream<A, never, R> => fromChannel(Channel.ignore(self.channel, options))
|
|
8839
8988
|
)
|
|
@@ -8860,19 +9009,19 @@ export const ignore: <
|
|
|
8860
9009
|
*/
|
|
8861
9010
|
export const ignoreCause: <
|
|
8862
9011
|
Arg extends Stream<any, any, any> | {
|
|
8863
|
-
readonly log?: boolean |
|
|
9012
|
+
readonly log?: boolean | Severity | undefined
|
|
8864
9013
|
} | undefined
|
|
8865
9014
|
>(
|
|
8866
9015
|
streamOrOptions: Arg,
|
|
8867
9016
|
options?: {
|
|
8868
|
-
readonly log?: boolean |
|
|
9017
|
+
readonly log?: boolean | Severity | undefined
|
|
8869
9018
|
} | undefined
|
|
8870
9019
|
) => [Arg] extends [Stream<infer A, infer _E, infer R>] ? Stream<A, never, R>
|
|
8871
9020
|
: <A, E, R>(self: Stream<A, E, R>) => Stream<A, never, R> = dual(
|
|
8872
9021
|
(args) => isStream(args[0]),
|
|
8873
9022
|
<A, E, R>(
|
|
8874
9023
|
self: Stream<A, E, R>,
|
|
8875
|
-
options?: { readonly log?: boolean |
|
|
9024
|
+
options?: { readonly log?: boolean | Severity | undefined } | undefined
|
|
8876
9025
|
): Stream<A, never, R> => fromChannel(Channel.ignoreCause(self.channel, options))
|
|
8877
9026
|
)
|
|
8878
9027
|
|
|
@@ -9007,9 +9156,9 @@ export const retry: {
|
|
|
9007
9156
|
*
|
|
9008
9157
|
* @example
|
|
9009
9158
|
* ```ts
|
|
9010
|
-
* import { Console, Effect, ExecutionPlan, Layer,
|
|
9159
|
+
* import { Console, Effect, ExecutionPlan, Layer, Context, Stream } from "effect"
|
|
9011
9160
|
*
|
|
9012
|
-
* class Service extends
|
|
9161
|
+
* class Service extends Context.Service<Service>()("Service", {
|
|
9013
9162
|
* make: Effect.succeed({
|
|
9014
9163
|
* stream: Stream.fail("A") as Stream.Stream<number, string>
|
|
9015
9164
|
* })
|
|
@@ -9049,9 +9198,9 @@ export const withExecutionPlan: {
|
|
|
9049
9198
|
*
|
|
9050
9199
|
* @example
|
|
9051
9200
|
* ```ts
|
|
9052
|
-
* import { Console, Effect, ExecutionPlan, Layer,
|
|
9201
|
+
* import { Console, Effect, ExecutionPlan, Layer, Context, Stream } from "effect"
|
|
9053
9202
|
*
|
|
9054
|
-
* class Service extends
|
|
9203
|
+
* class Service extends Context.Service<Service>()("Service", {
|
|
9055
9204
|
* make: Effect.succeed({
|
|
9056
9205
|
* stream: Stream.fail("A") as Stream.Stream<number, string>
|
|
9057
9206
|
* })
|
|
@@ -9094,9 +9243,9 @@ export const withExecutionPlan: {
|
|
|
9094
9243
|
*
|
|
9095
9244
|
* @example
|
|
9096
9245
|
* ```ts
|
|
9097
|
-
* import { Console, Effect, ExecutionPlan, Layer,
|
|
9246
|
+
* import { Console, Effect, ExecutionPlan, Layer, Context, Stream } from "effect"
|
|
9098
9247
|
*
|
|
9099
|
-
* class Service extends
|
|
9248
|
+
* class Service extends Context.Service<Service>()("Service", {
|
|
9100
9249
|
* make: Effect.succeed({
|
|
9101
9250
|
* stream: Stream.fail("A") as Stream.Stream<number, string>
|
|
9102
9251
|
* })
|
|
@@ -9169,9 +9318,9 @@ export const withExecutionPlan: {
|
|
|
9169
9318
|
*
|
|
9170
9319
|
* @example
|
|
9171
9320
|
* ```ts
|
|
9172
|
-
* import { Console, Effect, ExecutionPlan, Layer,
|
|
9321
|
+
* import { Console, Effect, ExecutionPlan, Layer, Context, Stream } from "effect"
|
|
9173
9322
|
*
|
|
9174
|
-
* class Service extends
|
|
9323
|
+
* class Service extends Context.Service<Service>()("Service", {
|
|
9175
9324
|
* make: Effect.succeed({
|
|
9176
9325
|
* stream: Stream.fail("A") as Stream.Stream<number, string>
|
|
9177
9326
|
* })
|
|
@@ -9742,7 +9891,7 @@ export const takeWhile: {
|
|
|
9742
9891
|
* @since 2.0.0
|
|
9743
9892
|
* @category Filtering
|
|
9744
9893
|
*/
|
|
9745
|
-
<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>
|
|
9746
9895
|
/**
|
|
9747
9896
|
* Takes the longest initial prefix of elements that satisfy the predicate.
|
|
9748
9897
|
*
|
|
@@ -9766,71 +9915,71 @@ export const takeWhile: {
|
|
|
9766
9915
|
* @since 2.0.0
|
|
9767
9916
|
* @category Filtering
|
|
9768
9917
|
*/
|
|
9769
|
-
<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: {
|
|
9770
9954
|
/**
|
|
9771
|
-
* Takes the longest initial prefix of elements that satisfy the
|
|
9772
|
-
*
|
|
9773
|
-
* @example
|
|
9774
|
-
* ```ts
|
|
9775
|
-
* import { Console, Effect, Stream } from "effect"
|
|
9776
|
-
*
|
|
9777
|
-
* const stream = Stream.range(1, 5).pipe(
|
|
9778
|
-
* Stream.takeWhile((n) => n % 3 !== 0)
|
|
9779
|
-
* )
|
|
9780
|
-
*
|
|
9781
|
-
* const program = Effect.gen(function*() {
|
|
9782
|
-
* const result = yield* Stream.runCollect(stream)
|
|
9783
|
-
* yield* Console.log(result)
|
|
9784
|
-
* })
|
|
9785
|
-
*
|
|
9786
|
-
* Effect.runPromise(program)
|
|
9787
|
-
* // Output: [ 1, 2 ]
|
|
9788
|
-
* ```
|
|
9955
|
+
* Takes the longest initial prefix of elements that satisfy the filter.
|
|
9789
9956
|
*
|
|
9790
|
-
* @since
|
|
9957
|
+
* @since 4.0.0
|
|
9791
9958
|
* @category Filtering
|
|
9792
9959
|
*/
|
|
9793
|
-
<A,
|
|
9960
|
+
<A, B, X>(f: Filter.Filter<NoInfer<A>, B, X>): <E, R>(self: Stream<A, E, R>) => Stream<B, E, R>
|
|
9794
9961
|
/**
|
|
9795
|
-
* Takes the longest initial prefix of elements that satisfy the
|
|
9796
|
-
*
|
|
9797
|
-
* @example
|
|
9798
|
-
* ```ts
|
|
9799
|
-
* import { Console, Effect, Stream } from "effect"
|
|
9800
|
-
*
|
|
9801
|
-
* const stream = Stream.range(1, 5).pipe(
|
|
9802
|
-
* Stream.takeWhile((n) => n % 3 !== 0)
|
|
9803
|
-
* )
|
|
9804
|
-
*
|
|
9805
|
-
* const program = Effect.gen(function*() {
|
|
9806
|
-
* const result = yield* Stream.runCollect(stream)
|
|
9807
|
-
* yield* Console.log(result)
|
|
9808
|
-
* })
|
|
9809
|
-
*
|
|
9810
|
-
* Effect.runPromise(program)
|
|
9811
|
-
* // Output: [ 1, 2 ]
|
|
9812
|
-
* ```
|
|
9962
|
+
* Takes the longest initial prefix of elements that satisfy the filter.
|
|
9813
9963
|
*
|
|
9814
|
-
* @since
|
|
9964
|
+
* @since 4.0.0
|
|
9815
9965
|
* @category Filtering
|
|
9816
9966
|
*/
|
|
9817
9967
|
<A, E, R, B, X>(self: Stream<A, E, R>, f: Filter.Filter<NoInfer<A>, B, X>): Stream<B, E, R>
|
|
9818
9968
|
} = dual(
|
|
9819
9969
|
2,
|
|
9820
|
-
<A, E, R>(
|
|
9970
|
+
<A, E, R, B, X>(
|
|
9821
9971
|
self: Stream<A, E, R>,
|
|
9822
|
-
|
|
9823
|
-
): Stream<
|
|
9972
|
+
filter: Filter.Filter<NoInfer<A>, B, X>
|
|
9973
|
+
): Stream<B, E, R> =>
|
|
9824
9974
|
transformPull(self, (pull, _scope) =>
|
|
9825
9975
|
Effect.sync(() => {
|
|
9826
|
-
let i = 0
|
|
9827
9976
|
let done = false
|
|
9828
|
-
const pump: Pull.Pull<Arr.NonEmptyReadonlyArray<
|
|
9977
|
+
const pump: Pull.Pull<Arr.NonEmptyReadonlyArray<B>, E, void, R> = Effect.flatMap(
|
|
9829
9978
|
Effect.suspend(() => done ? Cause.done() : pull),
|
|
9830
9979
|
(chunk) => {
|
|
9831
|
-
const out: Array<
|
|
9980
|
+
const out: Array<B> = []
|
|
9832
9981
|
for (let j = 0; j < chunk.length; j++) {
|
|
9833
|
-
const result =
|
|
9982
|
+
const result = filter(chunk[j])
|
|
9834
9983
|
if (Result.isFailure(result)) {
|
|
9835
9984
|
done = true
|
|
9836
9985
|
break
|
|
@@ -10225,29 +10374,6 @@ export const dropWhile: {
|
|
|
10225
10374
|
* @category Filtering
|
|
10226
10375
|
*/
|
|
10227
10376
|
<A>(predicate: (a: NoInfer<A>, index: number) => boolean): <E, R>(self: Stream<A, E, R>) => Stream<A, E, R>
|
|
10228
|
-
/**
|
|
10229
|
-
* Drops elements from the stream while the specified predicate evaluates to `true`.
|
|
10230
|
-
*
|
|
10231
|
-
* @example
|
|
10232
|
-
* ```ts
|
|
10233
|
-
* import { Console, Effect, Stream } from "effect"
|
|
10234
|
-
*
|
|
10235
|
-
* const program = Effect.gen(function*() {
|
|
10236
|
-
* const values = yield* Stream.make(1, 2, 3, 4, 5).pipe(
|
|
10237
|
-
* Stream.dropWhile((n) => n < 3),
|
|
10238
|
-
* Stream.runCollect
|
|
10239
|
-
* )
|
|
10240
|
-
* yield* Console.log(values)
|
|
10241
|
-
* })
|
|
10242
|
-
*
|
|
10243
|
-
* Effect.runPromise(program)
|
|
10244
|
-
* // Output: [ 3, 4, 5 ]
|
|
10245
|
-
* ```
|
|
10246
|
-
*
|
|
10247
|
-
* @since 2.0.0
|
|
10248
|
-
* @category Filtering
|
|
10249
|
-
*/
|
|
10250
|
-
<A, B, X>(f: Filter.Filter<NoInfer<A>, B, X>): <E, R>(self: Stream<A, E, R>) => Stream<A, E, R>
|
|
10251
10377
|
/**
|
|
10252
10378
|
* Drops elements from the stream while the specified predicate evaluates to `true`.
|
|
10253
10379
|
*
|
|
@@ -10274,39 +10400,53 @@ export const dropWhile: {
|
|
|
10274
10400
|
self: Stream<A, E, R>,
|
|
10275
10401
|
predicate: (a: NoInfer<A>, index: number) => boolean
|
|
10276
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: {
|
|
10277
10427
|
/**
|
|
10278
|
-
* Drops elements
|
|
10279
|
-
*
|
|
10280
|
-
* @example
|
|
10281
|
-
* ```ts
|
|
10282
|
-
* import { Console, Effect, Stream } from "effect"
|
|
10283
|
-
*
|
|
10284
|
-
* const program = Effect.gen(function*() {
|
|
10285
|
-
* const values = yield* Stream.make(1, 2, 3, 4, 5).pipe(
|
|
10286
|
-
* Stream.dropWhile((n) => n < 3),
|
|
10287
|
-
* Stream.runCollect
|
|
10288
|
-
* )
|
|
10289
|
-
* yield* Console.log(values)
|
|
10290
|
-
* })
|
|
10428
|
+
* Drops elements while the filter succeeds.
|
|
10291
10429
|
*
|
|
10292
|
-
*
|
|
10293
|
-
*
|
|
10294
|
-
|
|
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.
|
|
10295
10436
|
*
|
|
10296
|
-
* @since
|
|
10437
|
+
* @since 4.0.0
|
|
10297
10438
|
* @category Filtering
|
|
10298
10439
|
*/
|
|
10299
|
-
<A, E, R, B, X>(self: Stream<A, E, R>,
|
|
10300
|
-
} = 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>(
|
|
10301
10442
|
self: Stream<A, E, R>,
|
|
10302
|
-
|
|
10443
|
+
filter: Filter.Filter<NoInfer<A>, B, X>
|
|
10303
10444
|
): Stream<A, E, R> =>
|
|
10304
10445
|
transformPull(self, (pull, _scope) =>
|
|
10305
10446
|
Effect.sync(() => {
|
|
10306
10447
|
let dropping = true
|
|
10307
|
-
let index = 0
|
|
10308
10448
|
const filtered: Pull.Pull<Arr.NonEmptyReadonlyArray<A>, E> = Effect.flatMap(pull, (arr) => {
|
|
10309
|
-
const found = arr.findIndex((a) => Result.isFailure(
|
|
10449
|
+
const found = arr.findIndex((a) => Result.isFailure(filter(a)))
|
|
10310
10450
|
if (found === -1) return filtered
|
|
10311
10451
|
dropping = false
|
|
10312
10452
|
return Effect.succeed(arr.slice(found) as Arr.NonEmptyArray<A>)
|
|
@@ -12175,7 +12315,7 @@ export const debounce: {
|
|
|
12175
12315
|
* @since 2.0.0
|
|
12176
12316
|
* @category Rate Limiting
|
|
12177
12317
|
*/
|
|
12178
|
-
(duration: Duration.
|
|
12318
|
+
(duration: Duration.Input): <A, E, R>(self: Stream<A, E, R>) => Stream<A, E, R>
|
|
12179
12319
|
/**
|
|
12180
12320
|
* Drops earlier elements within the debounce window and emits only the latest element after the pause.
|
|
12181
12321
|
*
|
|
@@ -12199,15 +12339,15 @@ export const debounce: {
|
|
|
12199
12339
|
* @since 2.0.0
|
|
12200
12340
|
* @category Rate Limiting
|
|
12201
12341
|
*/
|
|
12202
|
-
<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>
|
|
12203
12343
|
} = dual(
|
|
12204
12344
|
2,
|
|
12205
|
-
<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> =>
|
|
12206
12346
|
transformPull(
|
|
12207
12347
|
self,
|
|
12208
12348
|
Effect.fnUntraced(function*(pull, scope) {
|
|
12209
12349
|
const clock = yield* Clock
|
|
12210
|
-
const durationMs = Duration.toMillis(Duration.
|
|
12350
|
+
const durationMs = Duration.toMillis(Duration.fromInputUnsafe(duration))
|
|
12211
12351
|
let lastArr: Arr.NonEmptyReadonlyArray<A> | undefined
|
|
12212
12352
|
let cause: Cause.Cause<Cause.Done | E> | undefined
|
|
12213
12353
|
let emitAtMs = Infinity
|
|
@@ -12347,7 +12487,7 @@ export const throttleEffect: {
|
|
|
12347
12487
|
options: {
|
|
12348
12488
|
readonly cost: (arr: Arr.NonEmptyReadonlyArray<A>) => Effect.Effect<number, E2, R2>
|
|
12349
12489
|
readonly units: number
|
|
12350
|
-
readonly duration: Duration.
|
|
12490
|
+
readonly duration: Duration.Input
|
|
12351
12491
|
readonly burst?: number | undefined
|
|
12352
12492
|
readonly strategy?: "enforce" | "shape" | undefined
|
|
12353
12493
|
}
|
|
@@ -12393,7 +12533,7 @@ export const throttleEffect: {
|
|
|
12393
12533
|
options: {
|
|
12394
12534
|
readonly cost: (arr: Arr.NonEmptyReadonlyArray<A>) => Effect.Effect<number, E2, R2>
|
|
12395
12535
|
readonly units: number
|
|
12396
|
-
readonly duration: Duration.
|
|
12536
|
+
readonly duration: Duration.Input
|
|
12397
12537
|
readonly burst?: number | undefined
|
|
12398
12538
|
readonly strategy?: "enforce" | "shape" | undefined
|
|
12399
12539
|
}
|
|
@@ -12405,7 +12545,7 @@ export const throttleEffect: {
|
|
|
12405
12545
|
options: {
|
|
12406
12546
|
readonly cost: (arr: Arr.NonEmptyReadonlyArray<A>) => Effect.Effect<number, E2, R2>
|
|
12407
12547
|
readonly units: number
|
|
12408
|
-
readonly duration: Duration.
|
|
12548
|
+
readonly duration: Duration.Input
|
|
12409
12549
|
readonly burst?: number | undefined
|
|
12410
12550
|
readonly strategy?: "enforce" | "shape" | undefined
|
|
12411
12551
|
}
|
|
@@ -12422,12 +12562,12 @@ const throttleEnforceEffect = <A, E, R, E2, R2>(
|
|
|
12422
12562
|
self: Stream<A, E, R>,
|
|
12423
12563
|
cost: (arr: Arr.NonEmptyReadonlyArray<A>) => Effect.Effect<number, E2, R2>,
|
|
12424
12564
|
units: number,
|
|
12425
|
-
duration: Duration.
|
|
12565
|
+
duration: Duration.Input,
|
|
12426
12566
|
burst: number
|
|
12427
12567
|
): Stream<A, E | E2, R | R2> =>
|
|
12428
12568
|
transformPull(self, (pull) =>
|
|
12429
12569
|
Effect.clockWith((clock) => {
|
|
12430
|
-
const durationMs = Duration.toMillis(Duration.
|
|
12570
|
+
const durationMs = Duration.toMillis(Duration.fromInputUnsafe(duration))
|
|
12431
12571
|
const max = units + burst < 0 ? Number.POSITIVE_INFINITY : units + burst
|
|
12432
12572
|
let tokens = units
|
|
12433
12573
|
let timestampMs = clock.currentTimeMillisUnsafe()
|
|
@@ -12458,12 +12598,12 @@ const throttleShapeEffect = <A, E, R, E2, R2>(
|
|
|
12458
12598
|
self: Stream<A, E, R>,
|
|
12459
12599
|
cost: (arr: Arr.NonEmptyReadonlyArray<A>) => Effect.Effect<number, E2, R2>,
|
|
12460
12600
|
units: number,
|
|
12461
|
-
duration: Duration.
|
|
12601
|
+
duration: Duration.Input,
|
|
12462
12602
|
burst: number
|
|
12463
12603
|
): Stream<A, E | E2, R | R2> =>
|
|
12464
12604
|
transformPull(self, (pull) =>
|
|
12465
12605
|
Effect.clockWith((clock) => {
|
|
12466
|
-
const durationMs = Duration.toMillis(Duration.
|
|
12606
|
+
const durationMs = Duration.toMillis(Duration.fromInputUnsafe(duration))
|
|
12467
12607
|
const max = units + burst < 0 ? Number.POSITIVE_INFINITY : units + burst
|
|
12468
12608
|
let tokens = units
|
|
12469
12609
|
let timestampMs = clock.currentTimeMillisUnsafe()
|
|
@@ -12576,7 +12716,7 @@ export const throttle: {
|
|
|
12576
12716
|
options: {
|
|
12577
12717
|
readonly cost: (arr: Arr.NonEmptyReadonlyArray<A>) => number
|
|
12578
12718
|
readonly units: number
|
|
12579
|
-
readonly duration: Duration.
|
|
12719
|
+
readonly duration: Duration.Input
|
|
12580
12720
|
readonly burst?: number | undefined
|
|
12581
12721
|
readonly strategy?: "enforce" | "shape" | undefined
|
|
12582
12722
|
}
|
|
@@ -12621,7 +12761,7 @@ export const throttle: {
|
|
|
12621
12761
|
options: {
|
|
12622
12762
|
readonly cost: (arr: Arr.NonEmptyReadonlyArray<A>) => number
|
|
12623
12763
|
readonly units: number
|
|
12624
|
-
readonly duration: Duration.
|
|
12764
|
+
readonly duration: Duration.Input
|
|
12625
12765
|
readonly burst?: number | undefined
|
|
12626
12766
|
readonly strategy?: "enforce" | "shape" | undefined
|
|
12627
12767
|
}
|
|
@@ -12633,7 +12773,7 @@ export const throttle: {
|
|
|
12633
12773
|
options: {
|
|
12634
12774
|
readonly cost: (arr: Arr.NonEmptyReadonlyArray<A>) => number
|
|
12635
12775
|
readonly units: number
|
|
12636
|
-
readonly duration: Duration.
|
|
12776
|
+
readonly duration: Duration.Input
|
|
12637
12777
|
readonly burst?: number | undefined
|
|
12638
12778
|
readonly strategy?: "enforce" | "shape" | undefined
|
|
12639
12779
|
}
|
|
@@ -12771,7 +12911,7 @@ export const groupedWithin: {
|
|
|
12771
12911
|
* @since 2.0.0
|
|
12772
12912
|
* @category Grouping
|
|
12773
12913
|
*/
|
|
12774
|
-
(chunkSize: number, duration: Duration.
|
|
12914
|
+
(chunkSize: number, duration: Duration.Input): <A, E, R>(self: Stream<A, E, R>) => Stream<Array<A>, E, R>
|
|
12775
12915
|
/**
|
|
12776
12916
|
* Partitions the stream into arrays, emitting when the chunk size is reached
|
|
12777
12917
|
* or the duration passes.
|
|
@@ -12795,11 +12935,11 @@ export const groupedWithin: {
|
|
|
12795
12935
|
* @since 2.0.0
|
|
12796
12936
|
* @category Grouping
|
|
12797
12937
|
*/
|
|
12798
|
-
<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>
|
|
12799
12939
|
} = dual(3, <A, E, R>(
|
|
12800
12940
|
self: Stream<A, E, R>,
|
|
12801
12941
|
chunkSize: number,
|
|
12802
|
-
duration: Duration.
|
|
12942
|
+
duration: Duration.Input
|
|
12803
12943
|
): Stream<Array<A>, E, R> =>
|
|
12804
12944
|
aggregateWithin(
|
|
12805
12945
|
self,
|
|
@@ -12874,7 +13014,7 @@ export const groupBy: {
|
|
|
12874
13014
|
f: (a: NoInfer<A>) => Effect.Effect<readonly [K, V], E2, R2>,
|
|
12875
13015
|
options?: {
|
|
12876
13016
|
readonly bufferSize?: number | undefined
|
|
12877
|
-
readonly idleTimeToLive?: Duration.
|
|
13017
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
12878
13018
|
}
|
|
12879
13019
|
): <E, R>(self: Stream<A, E, R>) => Stream<readonly [K, Stream<V>], E | E2, R | R2>
|
|
12880
13020
|
/**
|
|
@@ -12913,7 +13053,7 @@ export const groupBy: {
|
|
|
12913
13053
|
f: (a: NoInfer<A>) => Effect.Effect<readonly [K, V], E2, R2>,
|
|
12914
13054
|
options?: {
|
|
12915
13055
|
readonly bufferSize?: number | undefined
|
|
12916
|
-
readonly idleTimeToLive?: Duration.
|
|
13056
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
12917
13057
|
}
|
|
12918
13058
|
): Stream<readonly [K, Stream<V>], E | E2, R | R2>
|
|
12919
13059
|
} = dual((args) => isStream(args[0]), <A, E, R, K, V, E2, R2>(
|
|
@@ -12921,7 +13061,7 @@ export const groupBy: {
|
|
|
12921
13061
|
f: (a: NoInfer<A>) => Effect.Effect<readonly [K, V], E2, R2>,
|
|
12922
13062
|
options?: {
|
|
12923
13063
|
readonly bufferSize?: number | undefined
|
|
12924
|
-
readonly idleTimeToLive?: Duration.
|
|
13064
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
12925
13065
|
}
|
|
12926
13066
|
): Stream<readonly [K, Stream<V>], E | E2, R | R2> =>
|
|
12927
13067
|
groupByImpl(
|
|
@@ -13003,7 +13143,7 @@ export const groupByKey: {
|
|
|
13003
13143
|
f: (a: NoInfer<A>) => K,
|
|
13004
13144
|
options?: {
|
|
13005
13145
|
readonly bufferSize?: number | undefined
|
|
13006
|
-
readonly idleTimeToLive?: Duration.
|
|
13146
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
13007
13147
|
}
|
|
13008
13148
|
): <E, R>(self: Stream<A, E, R>) => Stream<readonly [K, Stream<A>], E, R>
|
|
13009
13149
|
/**
|
|
@@ -13040,7 +13180,7 @@ export const groupByKey: {
|
|
|
13040
13180
|
f: (a: NoInfer<A>) => K,
|
|
13041
13181
|
options?: {
|
|
13042
13182
|
readonly bufferSize?: number | undefined
|
|
13043
|
-
readonly idleTimeToLive?: Duration.
|
|
13183
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
13044
13184
|
}
|
|
13045
13185
|
): Stream<readonly [K, Stream<A>], E, R>
|
|
13046
13186
|
} = dual((args) => isStream(args[0]), <A, E, R, K>(
|
|
@@ -13048,7 +13188,7 @@ export const groupByKey: {
|
|
|
13048
13188
|
f: (a: NoInfer<A>) => K,
|
|
13049
13189
|
options?: {
|
|
13050
13190
|
readonly bufferSize?: number | undefined
|
|
13051
|
-
readonly idleTimeToLive?: Duration.
|
|
13191
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
13052
13192
|
}
|
|
13053
13193
|
): Stream<readonly [K, Stream<A>], E, R> =>
|
|
13054
13194
|
suspend(() => {
|
|
@@ -13146,7 +13286,7 @@ const groupByImpl = <A, E, R, K, V, E2, R2>(
|
|
|
13146
13286
|
) => Effect.Effect<void, E2, R2>,
|
|
13147
13287
|
options?: {
|
|
13148
13288
|
readonly bufferSize?: number | undefined
|
|
13149
|
-
readonly idleTimeToLive?: Duration.
|
|
13289
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
13150
13290
|
}
|
|
13151
13291
|
): Stream<readonly [K, Stream<V>], E | E2, R | R2> =>
|
|
13152
13292
|
transformPullBracket(
|
|
@@ -13597,11 +13737,9 @@ export const aggregateWithin: {
|
|
|
13597
13737
|
})
|
|
13598
13738
|
|
|
13599
13739
|
// upstream -> buffer
|
|
13600
|
-
let hadChunk = false
|
|
13601
13740
|
yield* pull.pipe(
|
|
13602
13741
|
pullLatch.whenOpen,
|
|
13603
13742
|
Effect.flatMap((arr) => {
|
|
13604
|
-
hadChunk = true
|
|
13605
13743
|
pullLatch.closeUnsafe()
|
|
13606
13744
|
return Queue.offer(buffer, arr)
|
|
13607
13745
|
}),
|
|
@@ -13638,35 +13776,44 @@ export const aggregateWithin: {
|
|
|
13638
13776
|
* @category Aggregation
|
|
13639
13777
|
*/
|
|
13640
13778
|
B>()
|
|
13779
|
+
let leftover: Arr.NonEmptyReadonlyArray<A2> | undefined
|
|
13780
|
+
let sinkHasInput = false
|
|
13641
13781
|
const step = yield* Schedule.toStepWithSleep(schedule)
|
|
13642
|
-
const stepToBuffer = Effect.suspend(()
|
|
13643
|
-
|
|
13644
|
-
|
|
13645
|
-
|
|
13646
|
-
|
|
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
|
+
})
|
|
13647
13789
|
|
|
13648
13790
|
// buffer -> sink
|
|
13649
13791
|
const pullFromBuffer: Pull.Pull<
|
|
13650
13792
|
Arr.NonEmptyReadonlyArray<A>,
|
|
13651
13793
|
E
|
|
13652
13794
|
> = Queue.take(buffer).pipe(
|
|
13653
|
-
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
|
+
})
|
|
13654
13802
|
)
|
|
13655
13803
|
|
|
13656
|
-
let leftover: Arr.NonEmptyReadonlyArray<A2> | undefined
|
|
13657
13804
|
const sinkUpstream = Effect.suspend((): Pull.Pull<Arr.NonEmptyReadonlyArray<A | A2>, E> => {
|
|
13658
13805
|
if (leftover !== undefined) {
|
|
13659
13806
|
const chunk = leftover
|
|
13660
13807
|
leftover = undefined
|
|
13808
|
+
sinkHasInput = true
|
|
13661
13809
|
return Effect.succeed(chunk)
|
|
13662
13810
|
}
|
|
13663
|
-
hadChunk = false
|
|
13664
13811
|
pullLatch.openUnsafe()
|
|
13665
13812
|
return pullFromBuffer
|
|
13666
13813
|
})
|
|
13667
13814
|
const catchSinkHalt = Effect.flatMap(([value, leftover_]: Sink.End<B, A2>) => {
|
|
13668
|
-
// ignore the last output if the
|
|
13669
|
-
if (!
|
|
13815
|
+
// ignore the last output if the upstream only pulled a halt
|
|
13816
|
+
if (!sinkHasInput && buffer.state._tag === "Done") return Cause.done()
|
|
13670
13817
|
lastOutput = Option.some(value)
|
|
13671
13818
|
leftover = leftover_
|
|
13672
13819
|
return Effect.succeed(Arr.of(value))
|
|
@@ -13674,9 +13821,10 @@ export const aggregateWithin: {
|
|
|
13674
13821
|
|
|
13675
13822
|
return Effect.suspend(() => {
|
|
13676
13823
|
// if the buffer has exited and there is no more data to process
|
|
13677
|
-
if (buffer.state._tag === "Done") {
|
|
13824
|
+
if (buffer.state._tag === "Done" && leftover === undefined) {
|
|
13678
13825
|
return buffer.state.exit as Exit.Exit<never, Cause.Done<void> | E>
|
|
13679
13826
|
}
|
|
13827
|
+
sinkHasInput = leftover !== undefined
|
|
13680
13828
|
return Effect.succeed(Effect.suspend(() => sink.transform(sinkUpstream as any, scope)))
|
|
13681
13829
|
}).pipe(
|
|
13682
13830
|
Effect.flatMap((pull) => Effect.raceFirst(catchSinkHalt(pull), stepToBuffer))
|
|
@@ -13880,12 +14028,12 @@ export const share: {
|
|
|
13880
14028
|
options: {
|
|
13881
14029
|
readonly capacity: "unbounded"
|
|
13882
14030
|
readonly replay?: number | undefined
|
|
13883
|
-
readonly idleTimeToLive?: Duration.
|
|
14031
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
13884
14032
|
} | {
|
|
13885
14033
|
readonly capacity: number
|
|
13886
14034
|
readonly strategy?: "sliding" | "dropping" | "suspend" | undefined
|
|
13887
14035
|
readonly replay?: number | undefined
|
|
13888
|
-
readonly idleTimeToLive?: Duration.
|
|
14036
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
13889
14037
|
}
|
|
13890
14038
|
): <A, E, R>(self: Stream<A, E, R>) => Effect.Effect<Stream<A, E>, never, Scope.Scope | R>
|
|
13891
14039
|
/**
|
|
@@ -13924,12 +14072,12 @@ export const share: {
|
|
|
13924
14072
|
options: {
|
|
13925
14073
|
readonly capacity: "unbounded"
|
|
13926
14074
|
readonly replay?: number | undefined
|
|
13927
|
-
readonly idleTimeToLive?: Duration.
|
|
14075
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
13928
14076
|
} | {
|
|
13929
14077
|
readonly capacity: number
|
|
13930
14078
|
readonly strategy?: "sliding" | "dropping" | "suspend" | undefined
|
|
13931
14079
|
readonly replay?: number | undefined
|
|
13932
|
-
readonly idleTimeToLive?: Duration.
|
|
14080
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
13933
14081
|
}
|
|
13934
14082
|
): Effect.Effect<Stream<A, E>, never, Scope.Scope | R>
|
|
13935
14083
|
} = dual(2, <A, E, R>(
|
|
@@ -13937,12 +14085,12 @@ export const share: {
|
|
|
13937
14085
|
options: {
|
|
13938
14086
|
readonly capacity: "unbounded"
|
|
13939
14087
|
readonly replay?: number | undefined
|
|
13940
|
-
readonly idleTimeToLive?: Duration.
|
|
14088
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
13941
14089
|
} | {
|
|
13942
14090
|
readonly capacity: number
|
|
13943
14091
|
readonly strategy?: "sliding" | "dropping" | "suspend" | undefined
|
|
13944
14092
|
readonly replay?: number | undefined
|
|
13945
|
-
readonly idleTimeToLive?: Duration.
|
|
14093
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
13946
14094
|
}
|
|
13947
14095
|
): Effect.Effect<Stream<A, E>, never, Scope.Scope | R> =>
|
|
13948
14096
|
Effect.map(
|
|
@@ -15807,7 +15955,7 @@ export const ensuring: {
|
|
|
15807
15955
|
)
|
|
15808
15956
|
|
|
15809
15957
|
/**
|
|
15810
|
-
* Provides a layer or
|
|
15958
|
+
* Provides a layer or context to the stream, removing the corresponding
|
|
15811
15959
|
* service requirements. Use `options.local` to build the layer every time; by
|
|
15812
15960
|
* default, layers are shared between provide calls.
|
|
15813
15961
|
*
|
|
@@ -15815,9 +15963,9 @@ export const ensuring: {
|
|
|
15815
15963
|
*
|
|
15816
15964
|
* @example
|
|
15817
15965
|
* ```ts
|
|
15818
|
-
* import { Console, Effect, Layer,
|
|
15966
|
+
* import { Console, Effect, Layer, Context, Stream } from "effect"
|
|
15819
15967
|
*
|
|
15820
|
-
* class Env extends
|
|
15968
|
+
* class Env extends Context.Service<Env, { readonly name: string }>()("Env") {}
|
|
15821
15969
|
*
|
|
15822
15970
|
* const layer = Layer.succeed(Env)({ name: "Ada" })
|
|
15823
15971
|
*
|
|
@@ -15844,7 +15992,7 @@ export const ensuring: {
|
|
|
15844
15992
|
*/
|
|
15845
15993
|
export const provide: {
|
|
15846
15994
|
/**
|
|
15847
|
-
* Provides a layer or
|
|
15995
|
+
* Provides a layer or context to the stream, removing the corresponding
|
|
15848
15996
|
* service requirements. Use `options.local` to build the layer every time; by
|
|
15849
15997
|
* default, layers are shared between provide calls.
|
|
15850
15998
|
*
|
|
@@ -15852,9 +16000,9 @@ export const provide: {
|
|
|
15852
16000
|
*
|
|
15853
16001
|
* @example
|
|
15854
16002
|
* ```ts
|
|
15855
|
-
* import { Console, Effect, Layer,
|
|
16003
|
+
* import { Console, Effect, Layer, Context, Stream } from "effect"
|
|
15856
16004
|
*
|
|
15857
|
-
* class Env extends
|
|
16005
|
+
* class Env extends Context.Service<Env, { readonly name: string }>()("Env") {}
|
|
15858
16006
|
*
|
|
15859
16007
|
* const layer = Layer.succeed(Env)({ name: "Ada" })
|
|
15860
16008
|
*
|
|
@@ -15880,7 +16028,7 @@ export const provide: {
|
|
|
15880
16028
|
* @category Services
|
|
15881
16029
|
*/
|
|
15882
16030
|
<AL, EL = never, RL = never>(
|
|
15883
|
-
layer: Layer.Layer<AL, EL, RL> |
|
|
16031
|
+
layer: Layer.Layer<AL, EL, RL> | Context.Context<AL>,
|
|
15884
16032
|
options?: {
|
|
15885
16033
|
readonly local?: boolean | undefined
|
|
15886
16034
|
} | undefined
|
|
@@ -15888,7 +16036,7 @@ export const provide: {
|
|
|
15888
16036
|
self: Stream<A, E, R>
|
|
15889
16037
|
) => Stream<A, E | EL, Exclude<R, AL> | RL>
|
|
15890
16038
|
/**
|
|
15891
|
-
* Provides a layer or
|
|
16039
|
+
* Provides a layer or context to the stream, removing the corresponding
|
|
15892
16040
|
* service requirements. Use `options.local` to build the layer every time; by
|
|
15893
16041
|
* default, layers are shared between provide calls.
|
|
15894
16042
|
*
|
|
@@ -15896,9 +16044,9 @@ export const provide: {
|
|
|
15896
16044
|
*
|
|
15897
16045
|
* @example
|
|
15898
16046
|
* ```ts
|
|
15899
|
-
* import { Console, Effect, Layer,
|
|
16047
|
+
* import { Console, Effect, Layer, Context, Stream } from "effect"
|
|
15900
16048
|
*
|
|
15901
|
-
* class Env extends
|
|
16049
|
+
* class Env extends Context.Service<Env, { readonly name: string }>()("Env") {}
|
|
15902
16050
|
*
|
|
15903
16051
|
* const layer = Layer.succeed(Env)({ name: "Ada" })
|
|
15904
16052
|
*
|
|
@@ -15925,31 +16073,31 @@ export const provide: {
|
|
|
15925
16073
|
*/
|
|
15926
16074
|
<A, E, R, AL, EL = never, RL = never>(
|
|
15927
16075
|
self: Stream<A, E, R>,
|
|
15928
|
-
layer: Layer.Layer<AL, EL, RL> |
|
|
16076
|
+
layer: Layer.Layer<AL, EL, RL> | Context.Context<AL>,
|
|
15929
16077
|
options?: {
|
|
15930
16078
|
readonly local?: boolean | undefined
|
|
15931
16079
|
} | undefined
|
|
15932
16080
|
): Stream<A, E | EL, Exclude<R, AL> | RL>
|
|
15933
16081
|
} = dual((args) => isStream(args[0]), <A, E, R, AL, EL = never, RL = never>(
|
|
15934
16082
|
self: Stream<A, E, R>,
|
|
15935
|
-
layer: Layer.Layer<AL, EL, RL> |
|
|
16083
|
+
layer: Layer.Layer<AL, EL, RL> | Context.Context<AL>,
|
|
15936
16084
|
options?: {
|
|
15937
16085
|
readonly local?: boolean | undefined
|
|
15938
16086
|
} | undefined
|
|
15939
16087
|
): Stream<A, E | EL, Exclude<R, AL> | RL> => fromChannel(Channel.provide(self.channel, layer, options)))
|
|
15940
16088
|
|
|
15941
16089
|
/**
|
|
15942
|
-
* Provides multiple services to the stream using a
|
|
16090
|
+
* Provides multiple services to the stream using a context.
|
|
15943
16091
|
*
|
|
15944
16092
|
* @example
|
|
15945
16093
|
* ```ts
|
|
15946
|
-
* import { Console, Effect,
|
|
16094
|
+
* import { Console, Effect, Context, Stream } from "effect"
|
|
15947
16095
|
*
|
|
15948
|
-
* class Config extends
|
|
15949
|
-
* 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") {}
|
|
15950
16098
|
*
|
|
15951
|
-
* const
|
|
15952
|
-
*
|
|
16099
|
+
* const context = Context.make(Config, { prefix: "Hello" }).pipe(
|
|
16100
|
+
* Context.add(Greeter, { greet: (name: string) => `${name}!` })
|
|
15953
16101
|
* )
|
|
15954
16102
|
*
|
|
15955
16103
|
* const stream = Stream.fromEffect(
|
|
@@ -15961,7 +16109,7 @@ export const provide: {
|
|
|
15961
16109
|
* )
|
|
15962
16110
|
*
|
|
15963
16111
|
* const program = Effect.gen(function*() {
|
|
15964
|
-
* const result = yield* Stream.runCollect(Stream.
|
|
16112
|
+
* const result = yield* Stream.runCollect(Stream.provideContext(stream, context))
|
|
15965
16113
|
* yield* Console.log(result)
|
|
15966
16114
|
* })
|
|
15967
16115
|
*
|
|
@@ -15972,19 +16120,19 @@ export const provide: {
|
|
|
15972
16120
|
* @since 4.0.0
|
|
15973
16121
|
* @category Services
|
|
15974
16122
|
*/
|
|
15975
|
-
export const
|
|
16123
|
+
export const provideContext: {
|
|
15976
16124
|
/**
|
|
15977
|
-
* Provides multiple services to the stream using a
|
|
16125
|
+
* Provides multiple services to the stream using a context.
|
|
15978
16126
|
*
|
|
15979
16127
|
* @example
|
|
15980
16128
|
* ```ts
|
|
15981
|
-
* import { Console, Effect,
|
|
16129
|
+
* import { Console, Effect, Context, Stream } from "effect"
|
|
15982
16130
|
*
|
|
15983
|
-
* class Config extends
|
|
15984
|
-
* 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") {}
|
|
15985
16133
|
*
|
|
15986
|
-
* const
|
|
15987
|
-
*
|
|
16134
|
+
* const context = Context.make(Config, { prefix: "Hello" }).pipe(
|
|
16135
|
+
* Context.add(Greeter, { greet: (name: string) => `${name}!` })
|
|
15988
16136
|
* )
|
|
15989
16137
|
*
|
|
15990
16138
|
* const stream = Stream.fromEffect(
|
|
@@ -15996,7 +16144,7 @@ export const provideServices: {
|
|
|
15996
16144
|
* )
|
|
15997
16145
|
*
|
|
15998
16146
|
* const program = Effect.gen(function*() {
|
|
15999
|
-
* const result = yield* Stream.runCollect(Stream.
|
|
16147
|
+
* const result = yield* Stream.runCollect(Stream.provideContext(stream, context))
|
|
16000
16148
|
* yield* Console.log(result)
|
|
16001
16149
|
* })
|
|
16002
16150
|
*
|
|
@@ -16007,19 +16155,19 @@ export const provideServices: {
|
|
|
16007
16155
|
* @since 4.0.0
|
|
16008
16156
|
* @category Services
|
|
16009
16157
|
*/
|
|
16010
|
-
<R2>(
|
|
16158
|
+
<R2>(context: Context.Context<R2>): <A, E, R>(self: Stream<A, E, R>) => Stream<A, E, Exclude<R, R2>>
|
|
16011
16159
|
/**
|
|
16012
|
-
* Provides multiple services to the stream using a
|
|
16160
|
+
* Provides multiple services to the stream using a context.
|
|
16013
16161
|
*
|
|
16014
16162
|
* @example
|
|
16015
16163
|
* ```ts
|
|
16016
|
-
* import { Console, Effect,
|
|
16164
|
+
* import { Console, Effect, Context, Stream } from "effect"
|
|
16017
16165
|
*
|
|
16018
|
-
* class Config extends
|
|
16019
|
-
* 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") {}
|
|
16020
16168
|
*
|
|
16021
|
-
* const
|
|
16022
|
-
*
|
|
16169
|
+
* const context = Context.make(Config, { prefix: "Hello" }).pipe(
|
|
16170
|
+
* Context.add(Greeter, { greet: (name: string) => `${name}!` })
|
|
16023
16171
|
* )
|
|
16024
16172
|
*
|
|
16025
16173
|
* const stream = Stream.fromEffect(
|
|
@@ -16031,7 +16179,7 @@ export const provideServices: {
|
|
|
16031
16179
|
* )
|
|
16032
16180
|
*
|
|
16033
16181
|
* const program = Effect.gen(function*() {
|
|
16034
|
-
* const result = yield* Stream.runCollect(Stream.
|
|
16182
|
+
* const result = yield* Stream.runCollect(Stream.provideContext(stream, context))
|
|
16035
16183
|
* yield* Console.log(result)
|
|
16036
16184
|
* })
|
|
16037
16185
|
*
|
|
@@ -16042,11 +16190,11 @@ export const provideServices: {
|
|
|
16042
16190
|
* @since 4.0.0
|
|
16043
16191
|
* @category Services
|
|
16044
16192
|
*/
|
|
16045
|
-
<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>>
|
|
16046
16194
|
} = dual(
|
|
16047
16195
|
2,
|
|
16048
|
-
<A, E, R, R2>(self: Stream<A, E, R>,
|
|
16049
|
-
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))
|
|
16050
16198
|
)
|
|
16051
16199
|
|
|
16052
16200
|
/**
|
|
@@ -16055,9 +16203,9 @@ export const provideServices: {
|
|
|
16055
16203
|
*
|
|
16056
16204
|
* @example
|
|
16057
16205
|
* ```ts
|
|
16058
|
-
* import { Console, Effect,
|
|
16206
|
+
* import { Console, Effect, Context, Stream } from "effect"
|
|
16059
16207
|
*
|
|
16060
|
-
* class Greeter extends
|
|
16208
|
+
* class Greeter extends Context.Service<Greeter, {
|
|
16061
16209
|
* greet: (name: string) => string
|
|
16062
16210
|
* }>()("Greeter") {}
|
|
16063
16211
|
*
|
|
@@ -16092,9 +16240,9 @@ export const provideService: {
|
|
|
16092
16240
|
*
|
|
16093
16241
|
* @example
|
|
16094
16242
|
* ```ts
|
|
16095
|
-
* import { Console, Effect,
|
|
16243
|
+
* import { Console, Effect, Context, Stream } from "effect"
|
|
16096
16244
|
*
|
|
16097
|
-
* class Greeter extends
|
|
16245
|
+
* class Greeter extends Context.Service<Greeter, {
|
|
16098
16246
|
* greet: (name: string) => string
|
|
16099
16247
|
* }>()("Greeter") {}
|
|
16100
16248
|
*
|
|
@@ -16122,7 +16270,7 @@ export const provideService: {
|
|
|
16122
16270
|
* @since 4.0.0
|
|
16123
16271
|
* @category Services
|
|
16124
16272
|
*/
|
|
16125
|
-
<I, S>(key:
|
|
16273
|
+
<I, S>(key: Context.Key<I, S>, service: NoInfer<S>): <A, E, R>(
|
|
16126
16274
|
self: Stream<A, E, R>
|
|
16127
16275
|
) => Stream<A, E, Exclude<R, I>>
|
|
16128
16276
|
/**
|
|
@@ -16131,9 +16279,9 @@ export const provideService: {
|
|
|
16131
16279
|
*
|
|
16132
16280
|
* @example
|
|
16133
16281
|
* ```ts
|
|
16134
|
-
* import { Console, Effect,
|
|
16282
|
+
* import { Console, Effect, Context, Stream } from "effect"
|
|
16135
16283
|
*
|
|
16136
|
-
* class Greeter extends
|
|
16284
|
+
* class Greeter extends Context.Service<Greeter, {
|
|
16137
16285
|
* greet: (name: string) => string
|
|
16138
16286
|
* }>()("Greeter") {}
|
|
16139
16287
|
*
|
|
@@ -16161,10 +16309,10 @@ export const provideService: {
|
|
|
16161
16309
|
* @since 4.0.0
|
|
16162
16310
|
* @category Services
|
|
16163
16311
|
*/
|
|
16164
|
-
<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>>
|
|
16165
16313
|
} = dual(3, <A, E, R, I, S>(
|
|
16166
16314
|
self: Stream<A, E, R>,
|
|
16167
|
-
key:
|
|
16315
|
+
key: Context.Key<I, S>,
|
|
16168
16316
|
service: NoInfer<S>
|
|
16169
16317
|
): Stream<A, E, Exclude<R, I>> => fromChannel(Channel.provideService(self.channel, key, service)))
|
|
16170
16318
|
|
|
@@ -16173,9 +16321,9 @@ export const provideService: {
|
|
|
16173
16321
|
*
|
|
16174
16322
|
* @example
|
|
16175
16323
|
* ```ts
|
|
16176
|
-
* import { Console, Effect,
|
|
16324
|
+
* import { Console, Effect, Context, Stream } from "effect"
|
|
16177
16325
|
*
|
|
16178
|
-
* class ApiConfig extends
|
|
16326
|
+
* class ApiConfig extends Context.Service<ApiConfig, { readonly baseUrl: string }>()("ApiConfig") {}
|
|
16179
16327
|
*
|
|
16180
16328
|
* const stream = Stream.fromEffect(
|
|
16181
16329
|
* Effect.gen(function*() {
|
|
@@ -16212,9 +16360,9 @@ export const provideServiceEffect: {
|
|
|
16212
16360
|
*
|
|
16213
16361
|
* @example
|
|
16214
16362
|
* ```ts
|
|
16215
|
-
* import { Console, Effect,
|
|
16363
|
+
* import { Console, Effect, Context, Stream } from "effect"
|
|
16216
16364
|
*
|
|
16217
|
-
* class ApiConfig extends
|
|
16365
|
+
* class ApiConfig extends Context.Service<ApiConfig, { readonly baseUrl: string }>()("ApiConfig") {}
|
|
16218
16366
|
*
|
|
16219
16367
|
* const stream = Stream.fromEffect(
|
|
16220
16368
|
* Effect.gen(function*() {
|
|
@@ -16245,7 +16393,7 @@ export const provideServiceEffect: {
|
|
|
16245
16393
|
* @since 4.0.0
|
|
16246
16394
|
* @category Services
|
|
16247
16395
|
*/
|
|
16248
|
-
<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>(
|
|
16249
16397
|
self: Stream<A, E, R>
|
|
16250
16398
|
) => Stream<A, E | ES, Exclude<R, I> | RS>
|
|
16251
16399
|
/**
|
|
@@ -16253,9 +16401,9 @@ export const provideServiceEffect: {
|
|
|
16253
16401
|
*
|
|
16254
16402
|
* @example
|
|
16255
16403
|
* ```ts
|
|
16256
|
-
* import { Console, Effect,
|
|
16404
|
+
* import { Console, Effect, Context, Stream } from "effect"
|
|
16257
16405
|
*
|
|
16258
|
-
* class ApiConfig extends
|
|
16406
|
+
* class ApiConfig extends Context.Service<ApiConfig, { readonly baseUrl: string }>()("ApiConfig") {}
|
|
16259
16407
|
*
|
|
16260
16408
|
* const stream = Stream.fromEffect(
|
|
16261
16409
|
* Effect.gen(function*() {
|
|
@@ -16288,25 +16436,25 @@ export const provideServiceEffect: {
|
|
|
16288
16436
|
*/
|
|
16289
16437
|
<A, E, R, I, S, ES, RS>(
|
|
16290
16438
|
self: Stream<A, E, R>,
|
|
16291
|
-
key:
|
|
16439
|
+
key: Context.Key<I, S>,
|
|
16292
16440
|
service: Effect.Effect<NoInfer<S>, ES, RS>
|
|
16293
16441
|
): Stream<A, E | ES, Exclude<R, I> | RS>
|
|
16294
16442
|
} = dual(3, <A, E, R, I, S, ES, RS>(
|
|
16295
16443
|
self: Stream<A, E, R>,
|
|
16296
|
-
key:
|
|
16444
|
+
key: Context.Key<I, S>,
|
|
16297
16445
|
service: Effect.Effect<NoInfer<S>, ES, RS>
|
|
16298
16446
|
): Stream<A, E | ES, Exclude<R, I> | RS> => fromChannel(Channel.provideServiceEffect(self.channel, key, service)))
|
|
16299
16447
|
|
|
16300
16448
|
/**
|
|
16301
|
-
* Transforms the stream's required services by mapping the current
|
|
16449
|
+
* Transforms the stream's required services by mapping the current context
|
|
16302
16450
|
* to a new one.
|
|
16303
16451
|
*
|
|
16304
16452
|
* @example
|
|
16305
16453
|
* ```ts
|
|
16306
|
-
* import { Console, Effect,
|
|
16454
|
+
* import { Console, Effect, Context, Stream } from "effect"
|
|
16307
16455
|
*
|
|
16308
|
-
* class Logger extends
|
|
16309
|
-
* class Config extends
|
|
16456
|
+
* class Logger extends Context.Service<Logger, { prefix: string }>()("Logger") {}
|
|
16457
|
+
* class Config extends Context.Service<Config, { name: string }>()("Config") {}
|
|
16310
16458
|
*
|
|
16311
16459
|
* const stream = Stream.fromEffect(
|
|
16312
16460
|
* Effect.gen(function*() {
|
|
@@ -16317,8 +16465,8 @@ export const provideServiceEffect: {
|
|
|
16317
16465
|
* )
|
|
16318
16466
|
*
|
|
16319
16467
|
* const updated = stream.pipe(
|
|
16320
|
-
* Stream.
|
|
16321
|
-
*
|
|
16468
|
+
* Stream.updateContext((context: Context.Context<Logger>) =>
|
|
16469
|
+
* Context.add(context, Config, { name: "World" })
|
|
16322
16470
|
* )
|
|
16323
16471
|
* )
|
|
16324
16472
|
*
|
|
@@ -16336,17 +16484,17 @@ export const provideServiceEffect: {
|
|
|
16336
16484
|
* @since 2.0.0
|
|
16337
16485
|
* @category Services
|
|
16338
16486
|
*/
|
|
16339
|
-
export const
|
|
16487
|
+
export const updateContext: {
|
|
16340
16488
|
/**
|
|
16341
|
-
* Transforms the stream's required services by mapping the current
|
|
16489
|
+
* Transforms the stream's required services by mapping the current context
|
|
16342
16490
|
* to a new one.
|
|
16343
16491
|
*
|
|
16344
16492
|
* @example
|
|
16345
16493
|
* ```ts
|
|
16346
|
-
* import { Console, Effect,
|
|
16494
|
+
* import { Console, Effect, Context, Stream } from "effect"
|
|
16347
16495
|
*
|
|
16348
|
-
* class Logger extends
|
|
16349
|
-
* class Config extends
|
|
16496
|
+
* class Logger extends Context.Service<Logger, { prefix: string }>()("Logger") {}
|
|
16497
|
+
* class Config extends Context.Service<Config, { name: string }>()("Config") {}
|
|
16350
16498
|
*
|
|
16351
16499
|
* const stream = Stream.fromEffect(
|
|
16352
16500
|
* Effect.gen(function*() {
|
|
@@ -16357,8 +16505,8 @@ export const updateServices: {
|
|
|
16357
16505
|
* )
|
|
16358
16506
|
*
|
|
16359
16507
|
* const updated = stream.pipe(
|
|
16360
|
-
* Stream.
|
|
16361
|
-
*
|
|
16508
|
+
* Stream.updateContext((context: Context.Context<Logger>) =>
|
|
16509
|
+
* Context.add(context, Config, { name: "World" })
|
|
16362
16510
|
* )
|
|
16363
16511
|
* )
|
|
16364
16512
|
*
|
|
@@ -16376,19 +16524,19 @@ export const updateServices: {
|
|
|
16376
16524
|
* @since 2.0.0
|
|
16377
16525
|
* @category Services
|
|
16378
16526
|
*/
|
|
16379
|
-
<R, R2>(f: (
|
|
16527
|
+
<R, R2>(f: (context: Context.Context<R2>) => Context.Context<R>): <A, E>(
|
|
16380
16528
|
self: Stream<A, E, R>
|
|
16381
16529
|
) => Stream<A, E, R2>
|
|
16382
16530
|
/**
|
|
16383
|
-
* Transforms the stream's required services by mapping the current
|
|
16531
|
+
* Transforms the stream's required services by mapping the current context
|
|
16384
16532
|
* to a new one.
|
|
16385
16533
|
*
|
|
16386
16534
|
* @example
|
|
16387
16535
|
* ```ts
|
|
16388
|
-
* import { Console, Effect,
|
|
16536
|
+
* import { Console, Effect, Context, Stream } from "effect"
|
|
16389
16537
|
*
|
|
16390
|
-
* class Logger extends
|
|
16391
|
-
* class Config extends
|
|
16538
|
+
* class Logger extends Context.Service<Logger, { prefix: string }>()("Logger") {}
|
|
16539
|
+
* class Config extends Context.Service<Config, { name: string }>()("Config") {}
|
|
16392
16540
|
*
|
|
16393
16541
|
* const stream = Stream.fromEffect(
|
|
16394
16542
|
* Effect.gen(function*() {
|
|
@@ -16399,8 +16547,8 @@ export const updateServices: {
|
|
|
16399
16547
|
* )
|
|
16400
16548
|
*
|
|
16401
16549
|
* const updated = stream.pipe(
|
|
16402
|
-
* Stream.
|
|
16403
|
-
*
|
|
16550
|
+
* Stream.updateContext((context: Context.Context<Logger>) =>
|
|
16551
|
+
* Context.add(context, Config, { name: "World" })
|
|
16404
16552
|
* )
|
|
16405
16553
|
* )
|
|
16406
16554
|
*
|
|
@@ -16420,21 +16568,21 @@ export const updateServices: {
|
|
|
16420
16568
|
*/
|
|
16421
16569
|
<A, E, R, R2>(
|
|
16422
16570
|
self: Stream<A, E, R>,
|
|
16423
|
-
f: (
|
|
16571
|
+
f: (context: Context.Context<R2>) => Context.Context<R>
|
|
16424
16572
|
): Stream<A, E, R2>
|
|
16425
16573
|
} = dual(2, <A, E, R, R2>(
|
|
16426
16574
|
self: Stream<A, E, R>,
|
|
16427
|
-
f: (
|
|
16428
|
-
): 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)))
|
|
16429
16577
|
|
|
16430
16578
|
/**
|
|
16431
16579
|
* Updates a single service in the stream environment by applying a function.
|
|
16432
16580
|
*
|
|
16433
16581
|
* @example
|
|
16434
16582
|
* ```ts
|
|
16435
|
-
* import { Console, Effect,
|
|
16583
|
+
* import { Console, Effect, Context, Stream } from "effect"
|
|
16436
16584
|
*
|
|
16437
|
-
* class Counter extends
|
|
16585
|
+
* class Counter extends Context.Service<Counter, { count: number }>()("Counter") {}
|
|
16438
16586
|
*
|
|
16439
16587
|
* const stream = Stream.fromEffect(Effect.service(Counter)).pipe(
|
|
16440
16588
|
* Stream.updateService(Counter, (counter) => ({ count: counter.count + 1 }))
|
|
@@ -16458,9 +16606,9 @@ export const updateService: {
|
|
|
16458
16606
|
*
|
|
16459
16607
|
* @example
|
|
16460
16608
|
* ```ts
|
|
16461
|
-
* import { Console, Effect,
|
|
16609
|
+
* import { Console, Effect, Context, Stream } from "effect"
|
|
16462
16610
|
*
|
|
16463
|
-
* class Counter extends
|
|
16611
|
+
* class Counter extends Context.Service<Counter, { count: number }>()("Counter") {}
|
|
16464
16612
|
*
|
|
16465
16613
|
* const stream = Stream.fromEffect(Effect.service(Counter)).pipe(
|
|
16466
16614
|
* Stream.updateService(Counter, (counter) => ({ count: counter.count + 1 }))
|
|
@@ -16478,7 +16626,7 @@ export const updateService: {
|
|
|
16478
16626
|
* @since 2.0.0
|
|
16479
16627
|
* @category Services
|
|
16480
16628
|
*/
|
|
16481
|
-
<I, S>(key:
|
|
16629
|
+
<I, S>(key: Context.Key<I, S>, f: (service: NoInfer<S>) => S): <A, E, R>(
|
|
16482
16630
|
self: Stream<A, E, R>
|
|
16483
16631
|
) => Stream<A, E, R | I>
|
|
16484
16632
|
/**
|
|
@@ -16486,9 +16634,9 @@ export const updateService: {
|
|
|
16486
16634
|
*
|
|
16487
16635
|
* @example
|
|
16488
16636
|
* ```ts
|
|
16489
|
-
* import { Console, Effect,
|
|
16637
|
+
* import { Console, Effect, Context, Stream } from "effect"
|
|
16490
16638
|
*
|
|
16491
|
-
* class Counter extends
|
|
16639
|
+
* class Counter extends Context.Service<Counter, { count: number }>()("Counter") {}
|
|
16492
16640
|
*
|
|
16493
16641
|
* const stream = Stream.fromEffect(Effect.service(Counter)).pipe(
|
|
16494
16642
|
* Stream.updateService(Counter, (counter) => ({ count: counter.count + 1 }))
|
|
@@ -16508,19 +16656,19 @@ export const updateService: {
|
|
|
16508
16656
|
*/
|
|
16509
16657
|
<A, E, R, I, S>(
|
|
16510
16658
|
self: Stream<A, E, R>,
|
|
16511
|
-
key:
|
|
16659
|
+
key: Context.Key<I, S>,
|
|
16512
16660
|
f: (service: NoInfer<S>) => S
|
|
16513
16661
|
): Stream<A, E, R | I>
|
|
16514
16662
|
} = dual(3, <A, E, R, I, S>(
|
|
16515
16663
|
self: Stream<A, E, R>,
|
|
16516
|
-
service:
|
|
16664
|
+
service: Context.Key<I, S>,
|
|
16517
16665
|
f: (service: NoInfer<S>) => S
|
|
16518
16666
|
): Stream<A, E, R | I> =>
|
|
16519
|
-
|
|
16520
|
-
|
|
16521
|
-
|
|
16667
|
+
updateContext(self, (context) =>
|
|
16668
|
+
Context.add(
|
|
16669
|
+
context,
|
|
16522
16670
|
service,
|
|
16523
|
-
f(
|
|
16671
|
+
f(Context.get(context, service))
|
|
16524
16672
|
)))
|
|
16525
16673
|
|
|
16526
16674
|
/**
|
|
@@ -16592,7 +16740,7 @@ export const withSpan: {
|
|
|
16592
16740
|
} = function() {
|
|
16593
16741
|
const dataFirst = isStream(arguments[0])
|
|
16594
16742
|
const name = dataFirst ? arguments[1] : arguments[0]
|
|
16595
|
-
const options = addSpanStackTrace(dataFirst ? arguments[
|
|
16743
|
+
const options = addSpanStackTrace(dataFirst ? arguments[2] : arguments[1])
|
|
16596
16744
|
if (dataFirst) {
|
|
16597
16745
|
const self = arguments[0] as Stream<any, any, any>
|
|
16598
16746
|
return fromChannel(Channel.withSpan(self.channel, name, options))
|
|
@@ -17662,20 +17810,31 @@ export const mkString = <E, R>(self: Stream<string, E, R>): Effect.Effect<string
|
|
|
17662
17810
|
* @category Destructors
|
|
17663
17811
|
*/
|
|
17664
17812
|
export const mkUint8Array = <E, R>(self: Stream<Uint8Array, E, R>): Effect.Effect<Uint8Array, E, R> =>
|
|
17665
|
-
|
|
17666
|
-
|
|
17667
|
-
|
|
17668
|
-
|
|
17669
|
-
|
|
17670
|
-
|
|
17671
|
-
|
|
17813
|
+
Effect.map(
|
|
17814
|
+
Channel.runFold(
|
|
17815
|
+
self.channel,
|
|
17816
|
+
(): {
|
|
17817
|
+
bytes: number
|
|
17818
|
+
readonly arrays: Array<Uint8Array>
|
|
17819
|
+
} => ({
|
|
17820
|
+
bytes: 0,
|
|
17821
|
+
arrays: []
|
|
17822
|
+
}),
|
|
17823
|
+
(acc, chunk) => {
|
|
17824
|
+
for (let i = 0; i < chunk.length; i++) {
|
|
17825
|
+
acc.bytes += chunk[i].length
|
|
17826
|
+
acc.arrays.push(chunk[i])
|
|
17827
|
+
}
|
|
17828
|
+
return acc
|
|
17672
17829
|
}
|
|
17673
|
-
|
|
17674
|
-
|
|
17675
|
-
|
|
17676
|
-
|
|
17677
|
-
|
|
17678
|
-
|
|
17830
|
+
),
|
|
17831
|
+
({ arrays, bytes }) => {
|
|
17832
|
+
const result = new Uint8Array(bytes)
|
|
17833
|
+
let offset = 0
|
|
17834
|
+
for (let i = 0; i < arrays.length; i++) {
|
|
17835
|
+
const array = arrays[i]
|
|
17836
|
+
result.set(array, offset)
|
|
17837
|
+
offset += array.length
|
|
17679
17838
|
}
|
|
17680
17839
|
return result
|
|
17681
17840
|
}
|
|
@@ -17688,10 +17847,10 @@ export const mkUint8Array = <E, R>(self: Stream<Uint8Array, E, R>): Effect.Effec
|
|
|
17688
17847
|
*
|
|
17689
17848
|
* @example
|
|
17690
17849
|
* ```ts
|
|
17691
|
-
* import {
|
|
17850
|
+
* import { Context, Stream } from "effect"
|
|
17692
17851
|
*
|
|
17693
17852
|
* const stream = Stream.make(1, 2, 3, 4, 5)
|
|
17694
|
-
* const readableStream = Stream.toReadableStreamWith(stream,
|
|
17853
|
+
* const readableStream = Stream.toReadableStreamWith(stream, Context.empty())
|
|
17695
17854
|
* ```
|
|
17696
17855
|
*
|
|
17697
17856
|
* @since 2.0.0
|
|
@@ -17705,17 +17864,17 @@ export const toReadableStreamWith = dual<
|
|
|
17705
17864
|
*
|
|
17706
17865
|
* @example
|
|
17707
17866
|
* ```ts
|
|
17708
|
-
* import {
|
|
17867
|
+
* import { Context, Stream } from "effect"
|
|
17709
17868
|
*
|
|
17710
17869
|
* const stream = Stream.make(1, 2, 3, 4, 5)
|
|
17711
|
-
* const readableStream = Stream.toReadableStreamWith(stream,
|
|
17870
|
+
* const readableStream = Stream.toReadableStreamWith(stream, Context.empty())
|
|
17712
17871
|
* ```
|
|
17713
17872
|
*
|
|
17714
17873
|
* @since 2.0.0
|
|
17715
17874
|
* @category Destructors
|
|
17716
17875
|
*/
|
|
17717
17876
|
<A, XR>(
|
|
17718
|
-
|
|
17877
|
+
context: Context.Context<XR>,
|
|
17719
17878
|
options?: { readonly strategy?: QueuingStrategy<A> | undefined }
|
|
17720
17879
|
) => <E, R extends XR>(self: Stream<A, E, R>) => ReadableStream<A>,
|
|
17721
17880
|
/**
|
|
@@ -17725,10 +17884,10 @@ export const toReadableStreamWith = dual<
|
|
|
17725
17884
|
*
|
|
17726
17885
|
* @example
|
|
17727
17886
|
* ```ts
|
|
17728
|
-
* import {
|
|
17887
|
+
* import { Context, Stream } from "effect"
|
|
17729
17888
|
*
|
|
17730
17889
|
* const stream = Stream.make(1, 2, 3, 4, 5)
|
|
17731
|
-
* const readableStream = Stream.toReadableStreamWith(stream,
|
|
17890
|
+
* const readableStream = Stream.toReadableStreamWith(stream, Context.empty())
|
|
17732
17891
|
* ```
|
|
17733
17892
|
*
|
|
17734
17893
|
* @since 2.0.0
|
|
@@ -17736,14 +17895,14 @@ export const toReadableStreamWith = dual<
|
|
|
17736
17895
|
*/
|
|
17737
17896
|
<A, E, XR, R extends XR>(
|
|
17738
17897
|
self: Stream<A, E, R>,
|
|
17739
|
-
|
|
17898
|
+
context: Context.Context<XR>,
|
|
17740
17899
|
options?: { readonly strategy?: QueuingStrategy<A> | undefined }
|
|
17741
17900
|
) => ReadableStream<A>
|
|
17742
17901
|
>(
|
|
17743
17902
|
(args) => isStream(args[0]),
|
|
17744
17903
|
<A, E, XR, R extends XR>(
|
|
17745
17904
|
self: Stream<A, E, R>,
|
|
17746
|
-
|
|
17905
|
+
context: Context.Context<XR>,
|
|
17747
17906
|
options?: { readonly strategy?: QueuingStrategy<A> | undefined }
|
|
17748
17907
|
): ReadableStream<A> => {
|
|
17749
17908
|
let currentResolve: (() => void) | undefined = undefined
|
|
@@ -17752,7 +17911,7 @@ export const toReadableStreamWith = dual<
|
|
|
17752
17911
|
|
|
17753
17912
|
return new ReadableStream<A>({
|
|
17754
17913
|
start(controller) {
|
|
17755
|
-
fiber = Effect.runFork(Effect.
|
|
17914
|
+
fiber = Effect.runFork(Effect.provideContext(
|
|
17756
17915
|
runForEachArray(self, (chunk) =>
|
|
17757
17916
|
latch.whenOpen(Effect.sync(() => {
|
|
17758
17917
|
latch.closeUnsafe()
|
|
@@ -17762,7 +17921,7 @@ export const toReadableStreamWith = dual<
|
|
|
17762
17921
|
currentResolve!()
|
|
17763
17922
|
currentResolve = undefined
|
|
17764
17923
|
}))),
|
|
17765
|
-
|
|
17924
|
+
context
|
|
17766
17925
|
))
|
|
17767
17926
|
fiber.addObserver((exit) => {
|
|
17768
17927
|
if (exit._tag === "Failure") {
|
|
@@ -17847,7 +18006,7 @@ export const toReadableStream: {
|
|
|
17847
18006
|
<A, E>(
|
|
17848
18007
|
self: Stream<A, E>,
|
|
17849
18008
|
options?: { readonly strategy?: QueuingStrategy<A> | undefined }
|
|
17850
|
-
): ReadableStream<A> => toReadableStreamWith(self,
|
|
18009
|
+
): ReadableStream<A> => toReadableStreamWith(self, Context.empty(), options)
|
|
17851
18010
|
)
|
|
17852
18011
|
|
|
17853
18012
|
/**
|
|
@@ -17931,7 +18090,7 @@ export const toReadableStreamEffect: {
|
|
|
17931
18090
|
options?: { readonly strategy?: QueuingStrategy<A> | undefined }
|
|
17932
18091
|
): Effect.Effect<ReadableStream<A>, never, R> =>
|
|
17933
18092
|
Effect.map(
|
|
17934
|
-
Effect.
|
|
18093
|
+
Effect.context</**
|
|
17935
18094
|
* Creates an Effect that builds a ReadableStream from the stream.
|
|
17936
18095
|
*
|
|
17937
18096
|
* See https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream.
|
|
@@ -17963,10 +18122,10 @@ export const toReadableStreamEffect: {
|
|
|
17963
18122
|
*
|
|
17964
18123
|
* @example
|
|
17965
18124
|
* ```ts
|
|
17966
|
-
* import {
|
|
18125
|
+
* import { Context, Stream } from "effect"
|
|
17967
18126
|
*
|
|
17968
18127
|
* const stream = Stream.make(1, 2, 3)
|
|
17969
|
-
* const iterable = Stream.toAsyncIterableWith(stream,
|
|
18128
|
+
* const iterable = Stream.toAsyncIterableWith(stream, Context.empty())
|
|
17970
18129
|
*
|
|
17971
18130
|
* const collect = async () => {
|
|
17972
18131
|
* const results: Array<number> = []
|
|
@@ -17986,10 +18145,10 @@ export const toAsyncIterableWith: {
|
|
|
17986
18145
|
*
|
|
17987
18146
|
* @example
|
|
17988
18147
|
* ```ts
|
|
17989
|
-
* import {
|
|
18148
|
+
* import { Context, Stream } from "effect"
|
|
17990
18149
|
*
|
|
17991
18150
|
* const stream = Stream.make(1, 2, 3)
|
|
17992
|
-
* const iterable = Stream.toAsyncIterableWith(stream,
|
|
18151
|
+
* const iterable = Stream.toAsyncIterableWith(stream, Context.empty())
|
|
17993
18152
|
*
|
|
17994
18153
|
* const collect = async () => {
|
|
17995
18154
|
* const results: Array<number> = []
|
|
@@ -18003,16 +18162,16 @@ export const toAsyncIterableWith: {
|
|
|
18003
18162
|
* @since 2.0.0
|
|
18004
18163
|
* @category Destructors
|
|
18005
18164
|
*/
|
|
18006
|
-
<XR>(
|
|
18165
|
+
<XR>(context: Context.Context<XR>): <A, E, R extends XR>(self: Stream<A, E, R>) => AsyncIterable<A>
|
|
18007
18166
|
/**
|
|
18008
18167
|
* Converts the stream to an `AsyncIterable` using the provided services.
|
|
18009
18168
|
*
|
|
18010
18169
|
* @example
|
|
18011
18170
|
* ```ts
|
|
18012
|
-
* import {
|
|
18171
|
+
* import { Context, Stream } from "effect"
|
|
18013
18172
|
*
|
|
18014
18173
|
* const stream = Stream.make(1, 2, 3)
|
|
18015
|
-
* const iterable = Stream.toAsyncIterableWith(stream,
|
|
18174
|
+
* const iterable = Stream.toAsyncIterableWith(stream, Context.empty())
|
|
18016
18175
|
*
|
|
18017
18176
|
* const collect = async () => {
|
|
18018
18177
|
* const results: Array<number> = []
|
|
@@ -18026,16 +18185,16 @@ export const toAsyncIterableWith: {
|
|
|
18026
18185
|
* @since 2.0.0
|
|
18027
18186
|
* @category Destructors
|
|
18028
18187
|
*/
|
|
18029
|
-
<A, E, XR, R extends XR>(self: Stream<A, E, R>,
|
|
18188
|
+
<A, E, XR, R extends XR>(self: Stream<A, E, R>, context: Context.Context<XR>): AsyncIterable<A>
|
|
18030
18189
|
} = dual(
|
|
18031
18190
|
2,
|
|
18032
18191
|
<A, E, XR, R extends XR>(
|
|
18033
18192
|
self: Stream<A, E, R>,
|
|
18034
|
-
|
|
18193
|
+
context: Context.Context<XR>
|
|
18035
18194
|
): AsyncIterable<A> => ({
|
|
18036
18195
|
[Symbol.asyncIterator]() {
|
|
18037
|
-
const runPromise = Effect.runPromiseWith(
|
|
18038
|
-
const runPromiseExit = Effect.runPromiseExitWith(
|
|
18196
|
+
const runPromise = Effect.runPromiseWith(context)
|
|
18197
|
+
const runPromiseExit = Effect.runPromiseExitWith(context)
|
|
18039
18198
|
const scope = Scope.makeUnsafe()
|
|
18040
18199
|
let pull: Pull.Pull<Arr.NonEmptyReadonlyArray<A>, E, void, R> | undefined
|
|
18041
18200
|
let currentIter: Iterator<A> | undefined
|
|
@@ -18097,8 +18256,8 @@ export const toAsyncIterableWith: {
|
|
|
18097
18256
|
*/
|
|
18098
18257
|
export const toAsyncIterableEffect = <A, E, R>(self: Stream<A, E, R>): Effect.Effect<AsyncIterable<A>, never, R> =>
|
|
18099
18258
|
Effect.map(
|
|
18100
|
-
Effect.
|
|
18101
|
-
(
|
|
18259
|
+
Effect.context<R>(),
|
|
18260
|
+
(context) => toAsyncIterableWith(self, context)
|
|
18102
18261
|
)
|
|
18103
18262
|
|
|
18104
18263
|
/**
|
|
@@ -18127,7 +18286,7 @@ export const toAsyncIterableEffect = <A, E, R>(self: Stream<A, E, R>): Effect.Ef
|
|
|
18127
18286
|
* @category Destructors
|
|
18128
18287
|
*/
|
|
18129
18288
|
export const toAsyncIterable = <A, E>(self: Stream<A, E>): AsyncIterable<A> =>
|
|
18130
|
-
toAsyncIterableWith(self,
|
|
18289
|
+
toAsyncIterableWith(self, Context.empty())
|
|
18131
18290
|
|
|
18132
18291
|
/**
|
|
18133
18292
|
* Runs the stream, publishing elements into the provided PubSub.
|
|
@@ -18473,16 +18632,16 @@ export const toPubSubTake: {
|
|
|
18473
18632
|
)
|
|
18474
18633
|
|
|
18475
18634
|
/**
|
|
18476
|
-
* Converts a stream to a
|
|
18635
|
+
* Converts a stream to a Queue for concurrent consumption.
|
|
18477
18636
|
*
|
|
18478
18637
|
* @example
|
|
18479
18638
|
* ```ts
|
|
18480
|
-
* import { Effect,
|
|
18639
|
+
* import { Effect, Queue, Stream } from "effect"
|
|
18481
18640
|
*
|
|
18482
18641
|
* const program = Effect.gen(function* () {
|
|
18483
|
-
* const
|
|
18484
|
-
* const
|
|
18485
|
-
* return
|
|
18642
|
+
* const queue = yield* Stream.toQueue(Stream.fromIterable([1, 2, 3]), { capacity: 8 })
|
|
18643
|
+
* const chunk = yield* Queue.takeBetween(queue, 1, 3)
|
|
18644
|
+
* return chunk
|
|
18486
18645
|
* })
|
|
18487
18646
|
* ```
|
|
18488
18647
|
*
|
|
@@ -18491,16 +18650,16 @@ export const toPubSubTake: {
|
|
|
18491
18650
|
*/
|
|
18492
18651
|
export const toQueue: {
|
|
18493
18652
|
/**
|
|
18494
|
-
* Converts a stream to a
|
|
18653
|
+
* Converts a stream to a Queue for concurrent consumption.
|
|
18495
18654
|
*
|
|
18496
18655
|
* @example
|
|
18497
18656
|
* ```ts
|
|
18498
|
-
* import { Effect,
|
|
18657
|
+
* import { Effect, Queue, Stream } from "effect"
|
|
18499
18658
|
*
|
|
18500
18659
|
* const program = Effect.gen(function* () {
|
|
18501
|
-
* const
|
|
18502
|
-
* const
|
|
18503
|
-
* return
|
|
18660
|
+
* const queue = yield* Stream.toQueue(Stream.fromIterable([1, 2, 3]), { capacity: 8 })
|
|
18661
|
+
* const chunk = yield* Queue.takeBetween(queue, 1, 3)
|
|
18662
|
+
* return chunk
|
|
18504
18663
|
* })
|
|
18505
18664
|
* ```
|
|
18506
18665
|
*
|
|
@@ -18516,16 +18675,16 @@ export const toQueue: {
|
|
|
18516
18675
|
}
|
|
18517
18676
|
): <A, E, R>(self: Stream<A, E, R>) => Effect.Effect<Queue.Dequeue<A, E | Cause.Done>, never, R | Scope.Scope>
|
|
18518
18677
|
/**
|
|
18519
|
-
* Converts a stream to a
|
|
18678
|
+
* Converts a stream to a Queue for concurrent consumption.
|
|
18520
18679
|
*
|
|
18521
18680
|
* @example
|
|
18522
18681
|
* ```ts
|
|
18523
|
-
* import { Effect,
|
|
18682
|
+
* import { Effect, Queue, Stream } from "effect"
|
|
18524
18683
|
*
|
|
18525
18684
|
* const program = Effect.gen(function* () {
|
|
18526
|
-
* const
|
|
18527
|
-
* const
|
|
18528
|
-
* return
|
|
18685
|
+
* const queue = yield* Stream.toQueue(Stream.fromIterable([1, 2, 3]), { capacity: 8 })
|
|
18686
|
+
* const chunk = yield* Queue.takeBetween(queue, 1, 3)
|
|
18687
|
+
* return chunk
|
|
18529
18688
|
* })
|
|
18530
18689
|
* ```
|
|
18531
18690
|
*
|
|
@@ -18540,22 +18699,19 @@ export const toQueue: {
|
|
|
18540
18699
|
readonly capacity: number
|
|
18541
18700
|
readonly strategy?: "dropping" | "sliding" | "suspend" | undefined
|
|
18542
18701
|
}
|
|
18543
|
-
): Effect.Effect<
|
|
18702
|
+
): Effect.Effect<Queue.Dequeue<A, E | Cause.Done>, never, R | Scope.Scope>
|
|
18544
18703
|
} = dual(
|
|
18545
18704
|
2,
|
|
18546
18705
|
<A, E, R>(
|
|
18547
18706
|
self: Stream<A, E, R>,
|
|
18548
18707
|
options: {
|
|
18549
18708
|
readonly capacity: "unbounded"
|
|
18550
|
-
readonly replay?: number | undefined
|
|
18551
|
-
readonly shutdownOnEnd?: boolean | undefined
|
|
18552
18709
|
} | {
|
|
18553
18710
|
readonly capacity: number
|
|
18554
18711
|
readonly strategy?: "dropping" | "sliding" | "suspend" | undefined
|
|
18555
|
-
readonly replay?: number | undefined
|
|
18556
|
-
readonly shutdownOnEnd?: boolean | undefined
|
|
18557
18712
|
}
|
|
18558
|
-
): Effect.Effect<
|
|
18713
|
+
): Effect.Effect<Queue.Dequeue<A, E | Cause.Done>, never, R | Scope.Scope> =>
|
|
18714
|
+
Channel.toQueueArray(self.channel, options)
|
|
18559
18715
|
)
|
|
18560
18716
|
|
|
18561
18717
|
/**
|