effect 4.0.0-beta.65 → 4.0.0-beta.67
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 +113 -67
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +28 -18
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +404 -337
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +190 -146
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts +167 -97
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +87 -47
- package/dist/BigInt.js.map +1 -1
- package/dist/Boolean.d.ts +62 -31
- package/dist/Boolean.d.ts.map +1 -1
- package/dist/Boolean.js +30 -15
- package/dist/Boolean.js.map +1 -1
- package/dist/Brand.d.ts +20 -1
- package/dist/Brand.d.ts.map +1 -1
- package/dist/Brand.js +16 -0
- package/dist/Brand.js.map +1 -1
- package/dist/Cache.d.ts +236 -132
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +133 -57
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +77 -65
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Cause.js +43 -36
- package/dist/Cause.js.map +1 -1
- package/dist/Channel.d.ts +1518 -575
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +661 -287
- package/dist/Channel.js.map +1 -1
- package/dist/ChannelSchema.d.ts +119 -10
- package/dist/ChannelSchema.d.ts.map +1 -1
- package/dist/ChannelSchema.js +45 -6
- package/dist/ChannelSchema.js.map +1 -1
- package/dist/Chunk.d.ts +548 -379
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +238 -170
- package/dist/Chunk.js.map +1 -1
- package/dist/Clock.d.ts +15 -8
- package/dist/Clock.d.ts.map +1 -1
- package/dist/Clock.js +8 -4
- package/dist/Clock.js.map +1 -1
- package/dist/Combiner.d.ts +2 -4
- package/dist/Combiner.d.ts.map +1 -1
- package/dist/Combiner.js +2 -4
- package/dist/Combiner.js.map +1 -1
- package/dist/Config.d.ts +5 -4
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +9 -8
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +1 -1
- package/dist/ConfigProvider.js +1 -1
- package/dist/Console.d.ts +76 -50
- package/dist/Console.d.ts.map +1 -1
- package/dist/Console.js +69 -46
- package/dist/Console.js.map +1 -1
- package/dist/Context.d.ts +386 -138
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js +144 -62
- package/dist/Context.js.map +1 -1
- package/dist/Cron.d.ts +69 -48
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +96 -36
- package/dist/Cron.js.map +1 -1
- package/dist/Data.d.ts +3 -2
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js.map +1 -1
- package/dist/DateTime.d.ts +875 -444
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +376 -217
- package/dist/DateTime.js.map +1 -1
- package/dist/Deferred.d.ts +367 -174
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +145 -71
- package/dist/Deferred.js.map +1 -1
- package/dist/Differ.d.ts +42 -0
- package/dist/Differ.d.ts.map +1 -1
- package/dist/Differ.js +36 -0
- package/dist/Duration.d.ts +329 -185
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +174 -106
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +2445 -2356
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +906 -758
- package/dist/Effect.js.map +1 -1
- package/dist/Effectable.d.ts +38 -3
- package/dist/Effectable.d.ts.map +1 -1
- package/dist/Effectable.js +3 -3
- package/dist/Effectable.js.map +1 -1
- package/dist/Encoding.d.ts +78 -28
- package/dist/Encoding.d.ts.map +1 -1
- package/dist/Encoding.js +75 -27
- package/dist/Encoding.js.map +1 -1
- package/dist/Equivalence.d.ts +14 -19
- package/dist/Equivalence.d.ts.map +1 -1
- package/dist/Equivalence.js +14 -19
- package/dist/Equivalence.js.map +1 -1
- package/dist/ErrorReporter.d.ts +66 -82
- package/dist/ErrorReporter.d.ts.map +1 -1
- package/dist/ErrorReporter.js +38 -29
- package/dist/ErrorReporter.js.map +1 -1
- package/dist/ExecutionPlan.d.ts +96 -12
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/ExecutionPlan.js +21 -6
- package/dist/ExecutionPlan.js.map +1 -1
- package/dist/Exit.d.ts +7 -5
- package/dist/Exit.d.ts.map +1 -1
- package/dist/Exit.js.map +1 -1
- package/dist/Fiber.d.ts +72 -40
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js +39 -21
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.d.ts +119 -58
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +122 -40
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +288 -160
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +176 -74
- package/dist/FiberMap.js.map +1 -1
- package/dist/FiberSet.d.ts +93 -52
- package/dist/FiberSet.d.ts.map +1 -1
- package/dist/FiberSet.js +97 -34
- package/dist/FiberSet.js.map +1 -1
- package/dist/FileSystem.d.ts +104 -73
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +53 -39
- package/dist/FileSystem.js.map +1 -1
- package/dist/Filter.d.ts +166 -88
- package/dist/Filter.d.ts.map +1 -1
- package/dist/Filter.js +68 -42
- package/dist/Filter.js.map +1 -1
- package/dist/Function.d.ts +154 -86
- package/dist/Function.d.ts.map +1 -1
- package/dist/Function.js +53 -37
- package/dist/Function.js.map +1 -1
- package/dist/Graph.d.ts +682 -365
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +308 -157
- package/dist/Graph.js.map +1 -1
- package/dist/HKT.d.ts +29 -13
- package/dist/HKT.d.ts.map +1 -1
- package/dist/Hash.d.ts +31 -18
- package/dist/Hash.d.ts.map +1 -1
- package/dist/Hash.js +25 -15
- package/dist/Hash.js.map +1 -1
- package/dist/HashMap.d.ts +444 -256
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashMap.js +223 -105
- package/dist/HashMap.js.map +1 -1
- package/dist/HashRing.d.ts +36 -17
- package/dist/HashRing.d.ts.map +1 -1
- package/dist/HashRing.js +75 -8
- package/dist/HashRing.js.map +1 -1
- package/dist/HashSet.d.ts +194 -104
- package/dist/HashSet.d.ts.map +1 -1
- package/dist/HashSet.js +93 -38
- package/dist/HashSet.js.map +1 -1
- package/dist/Inspectable.d.ts +20 -9
- package/dist/Inspectable.d.ts.map +1 -1
- package/dist/Inspectable.js +16 -6
- package/dist/Inspectable.js.map +1 -1
- package/dist/Iterable.d.ts +309 -149
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +129 -65
- package/dist/Iterable.js.map +1 -1
- package/dist/JsonPatch.d.ts +4 -3
- package/dist/JsonPatch.d.ts.map +1 -1
- package/dist/JsonPatch.js +4 -3
- package/dist/JsonPatch.js.map +1 -1
- package/dist/Latch.d.ts +98 -15
- package/dist/Latch.d.ts.map +1 -1
- package/dist/Latch.js +41 -10
- package/dist/Latch.js.map +1 -1
- package/dist/Layer.d.ts +412 -309
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +262 -181
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +95 -21
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +58 -14
- package/dist/LayerMap.js.map +1 -1
- package/dist/LogLevel.d.ts +92 -131
- package/dist/LogLevel.d.ts.map +1 -1
- package/dist/LogLevel.js +25 -15
- package/dist/LogLevel.js.map +1 -1
- package/dist/Logger.d.ts +155 -99
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +211 -184
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.d.ts +75 -17
- package/dist/ManagedRuntime.d.ts.map +1 -1
- package/dist/ManagedRuntime.js +22 -16
- package/dist/ManagedRuntime.js.map +1 -1
- package/dist/Match.d.ts +133 -157
- package/dist/Match.d.ts.map +1 -1
- package/dist/Match.js +85 -76
- package/dist/Match.js.map +1 -1
- package/dist/Metric.d.ts +325 -284
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +217 -212
- package/dist/Metric.js.map +1 -1
- package/dist/MutableHashMap.d.ts +117 -58
- package/dist/MutableHashMap.d.ts.map +1 -1
- package/dist/MutableHashMap.js +52 -29
- package/dist/MutableHashMap.js.map +1 -1
- package/dist/MutableHashSet.d.ts +52 -30
- package/dist/MutableHashSet.d.ts.map +1 -1
- package/dist/MutableHashSet.js +94 -38
- package/dist/MutableHashSet.js.map +1 -1
- package/dist/MutableList.d.ts +92 -49
- package/dist/MutableList.d.ts.map +1 -1
- package/dist/MutableList.js +123 -71
- package/dist/MutableList.js.map +1 -1
- package/dist/MutableRef.d.ts +99 -62
- package/dist/MutableRef.d.ts.map +1 -1
- package/dist/MutableRef.js +79 -60
- package/dist/MutableRef.js.map +1 -1
- package/dist/Newtype.d.ts +3 -0
- package/dist/Newtype.d.ts.map +1 -1
- package/dist/Newtype.js.map +1 -1
- package/dist/NonEmptyIterable.d.ts +36 -39
- package/dist/NonEmptyIterable.d.ts.map +1 -1
- package/dist/NonEmptyIterable.js +34 -20
- package/dist/NonEmptyIterable.js.map +1 -1
- package/dist/Number.d.ts +116 -64
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +54 -30
- package/dist/Number.js.map +1 -1
- package/dist/Optic.d.ts +1 -2
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js +0 -1
- package/dist/Optic.js.map +1 -1
- package/dist/Option.d.ts +38 -53
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +87 -11
- package/dist/Option.js.map +1 -1
- package/dist/Ordering.d.ts +43 -28
- package/dist/Ordering.d.ts.map +1 -1
- package/dist/Ordering.js +4 -2
- package/dist/Ordering.js.map +1 -1
- package/dist/PartitionedSemaphore.d.ts +225 -40
- package/dist/PartitionedSemaphore.d.ts.map +1 -1
- package/dist/PartitionedSemaphore.js +113 -17
- package/dist/PartitionedSemaphore.js.map +1 -1
- package/dist/Path.d.ts +77 -13
- package/dist/Path.d.ts.map +1 -1
- package/dist/Path.js +48 -4
- package/dist/Path.js.map +1 -1
- package/dist/Pipeable.d.ts +71 -15
- package/dist/Pipeable.d.ts.map +1 -1
- package/dist/Pipeable.js +59 -12
- package/dist/Pipeable.js.map +1 -1
- package/dist/PlatformError.d.ts +74 -6
- package/dist/PlatformError.d.ts.map +1 -1
- package/dist/PlatformError.js +68 -5
- package/dist/PlatformError.js.map +1 -1
- package/dist/Pool.d.ts +66 -31
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +26 -24
- package/dist/Pool.js.map +1 -1
- package/dist/Predicate.d.ts +16 -21
- package/dist/Predicate.d.ts.map +1 -1
- package/dist/Predicate.js +9 -14
- package/dist/Predicate.js.map +1 -1
- package/dist/PrimaryKey.d.ts +9 -2
- package/dist/PrimaryKey.d.ts.map +1 -1
- package/dist/PrimaryKey.js +7 -1
- package/dist/PrimaryKey.js.map +1 -1
- package/dist/PubSub.d.ts +364 -262
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +245 -174
- package/dist/PubSub.js.map +1 -1
- package/dist/Pull.d.ts +94 -25
- package/dist/Pull.d.ts.map +1 -1
- package/dist/Pull.js +61 -13
- package/dist/Pull.js.map +1 -1
- package/dist/Queue.d.ts +284 -150
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +216 -113
- package/dist/Queue.js.map +1 -1
- package/dist/Random.d.ts +54 -35
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +36 -24
- package/dist/Random.js.map +1 -1
- package/dist/RcMap.d.ts +151 -141
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +66 -20
- package/dist/RcMap.js.map +1 -1
- package/dist/RcRef.d.ts +69 -32
- package/dist/RcRef.d.ts.map +1 -1
- package/dist/RcRef.js +33 -16
- package/dist/RcRef.js.map +1 -1
- package/dist/Record.d.ts +273 -129
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +117 -57
- package/dist/Record.js.map +1 -1
- package/dist/Redactable.d.ts +3 -3
- package/dist/Redactable.js +2 -2
- package/dist/Redacted.d.ts +63 -33
- package/dist/Redacted.d.ts.map +1 -1
- package/dist/Redacted.js +30 -14
- package/dist/Redacted.js.map +1 -1
- package/dist/Ref.d.ts +81 -52
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +54 -35
- package/dist/Ref.js.map +1 -1
- package/dist/References.d.ts +73 -31
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +66 -30
- package/dist/References.js.map +1 -1
- package/dist/RegExp.d.ts +11 -5
- package/dist/RegExp.d.ts.map +1 -1
- package/dist/RegExp.js +11 -5
- package/dist/RegExp.js.map +1 -1
- package/dist/Request.d.ts +158 -34
- package/dist/Request.d.ts.map +1 -1
- package/dist/Request.js +67 -12
- package/dist/Request.js.map +1 -1
- package/dist/RequestResolver.d.ts +261 -116
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/RequestResolver.js +77 -41
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Resource.d.ts +13 -7
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +44 -6
- package/dist/Resource.js.map +1 -1
- package/dist/Result.d.ts +26 -16
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +6 -6
- package/dist/Result.js.map +1 -1
- package/dist/Runtime.d.ts +43 -18
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +35 -16
- package/dist/Runtime.js.map +1 -1
- package/dist/Schedule.d.ts +545 -576
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +261 -247
- package/dist/Schedule.js.map +1 -1
- package/dist/Scheduler.d.ts +43 -6
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +33 -4
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +815 -294
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +287 -193
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +24 -15
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +13 -9
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +26 -13
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +24 -11
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaIssue.d.ts +1 -8
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.d.ts +194 -25
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +220 -26
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +2 -2
- package/dist/SchemaTransformation.d.ts +61 -41
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +56 -33
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/SchemaUtils.d.ts +7 -0
- package/dist/SchemaUtils.d.ts.map +1 -1
- package/dist/SchemaUtils.js +23 -0
- package/dist/SchemaUtils.js.map +1 -1
- package/dist/Scope.d.ts +102 -43
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +57 -23
- package/dist/Scope.js.map +1 -1
- package/dist/ScopedCache.d.ts +138 -46
- package/dist/ScopedCache.d.ts.map +1 -1
- package/dist/ScopedCache.js +80 -19
- package/dist/ScopedCache.js.map +1 -1
- package/dist/ScopedRef.d.ts +28 -8
- package/dist/ScopedRef.d.ts.map +1 -1
- package/dist/ScopedRef.js +25 -5
- package/dist/ScopedRef.js.map +1 -1
- package/dist/Semaphore.d.ts +64 -28
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js +22 -13
- package/dist/Semaphore.js.map +1 -1
- package/dist/Sink.d.ts +458 -200
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +240 -89
- package/dist/Sink.js.map +1 -1
- package/dist/Stdio.d.ts +43 -6
- package/dist/Stdio.d.ts.map +1 -1
- package/dist/Stdio.js +33 -4
- package/dist/Stdio.js.map +1 -1
- package/dist/Stream.d.ts +1899 -1186
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +868 -525
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +171 -95
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +125 -67
- package/dist/String.js.map +1 -1
- package/dist/SubscriptionRef.d.ts +308 -203
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +125 -76
- package/dist/SubscriptionRef.js.map +1 -1
- package/dist/Symbol.d.ts +13 -5
- package/dist/Symbol.d.ts.map +1 -1
- package/dist/Symbol.js +13 -5
- package/dist/Symbol.js.map +1 -1
- package/dist/SynchronizedRef.d.ts +278 -62
- package/dist/SynchronizedRef.d.ts.map +1 -1
- package/dist/SynchronizedRef.js +116 -23
- package/dist/SynchronizedRef.js.map +1 -1
- package/dist/Take.d.ts +26 -2
- package/dist/Take.d.ts.map +1 -1
- package/dist/Take.js +4 -1
- package/dist/Take.js.map +1 -1
- package/dist/Terminal.d.ts +39 -7
- package/dist/Terminal.d.ts.map +1 -1
- package/dist/Terminal.js +10 -4
- package/dist/Terminal.js.map +1 -1
- package/dist/Tracer.d.ts +229 -55
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +94 -18
- package/dist/Tracer.js.map +1 -1
- package/dist/Trie.d.ts +213 -142
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Trie.js +88 -60
- package/dist/Trie.js.map +1 -1
- package/dist/TxChunk.d.ts +182 -146
- package/dist/TxChunk.d.ts.map +1 -1
- package/dist/TxChunk.js +73 -56
- package/dist/TxChunk.js.map +1 -1
- package/dist/TxDeferred.d.ts +43 -29
- package/dist/TxDeferred.d.ts.map +1 -1
- package/dist/TxDeferred.js +22 -15
- package/dist/TxDeferred.js.map +1 -1
- package/dist/TxHashMap.d.ts +362 -222
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js +171 -98
- package/dist/TxHashMap.js.map +1 -1
- package/dist/TxHashSet.d.ts +178 -104
- package/dist/TxHashSet.d.ts.map +1 -1
- package/dist/TxHashSet.js +84 -43
- package/dist/TxHashSet.js.map +1 -1
- package/dist/TxPriorityQueue.d.ts +93 -62
- package/dist/TxPriorityQueue.d.ts.map +1 -1
- package/dist/TxPriorityQueue.js +54 -36
- package/dist/TxPriorityQueue.js.map +1 -1
- package/dist/TxPubSub.d.ts +77 -49
- package/dist/TxPubSub.d.ts.map +1 -1
- package/dist/TxPubSub.js +60 -37
- package/dist/TxPubSub.js.map +1 -1
- package/dist/TxQueue.d.ts +279 -241
- package/dist/TxQueue.d.ts.map +1 -1
- package/dist/TxQueue.js +147 -101
- package/dist/TxQueue.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +69 -46
- package/dist/TxReentrantLock.d.ts.map +1 -1
- package/dist/TxReentrantLock.js +48 -32
- package/dist/TxReentrantLock.js.map +1 -1
- package/dist/TxRef.d.ts +69 -40
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +35 -20
- package/dist/TxRef.js.map +1 -1
- package/dist/TxSemaphore.d.ts +101 -54
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +76 -34
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/TxSubscriptionRef.d.ts +72 -48
- package/dist/TxSubscriptionRef.d.ts.map +1 -1
- package/dist/TxSubscriptionRef.js +33 -22
- package/dist/TxSubscriptionRef.js.map +1 -1
- package/dist/Types.d.ts +34 -34
- package/dist/UndefinedOr.d.ts +48 -25
- package/dist/UndefinedOr.d.ts.map +1 -1
- package/dist/UndefinedOr.js +28 -25
- package/dist/UndefinedOr.js.map +1 -1
- package/dist/Unify.d.ts +71 -116
- package/dist/Unify.d.ts.map +1 -1
- package/dist/Unify.js +20 -6
- package/dist/Unify.js.map +1 -1
- package/dist/Utils.d.ts +4 -0
- package/dist/Utils.d.ts.map +1 -1
- package/dist/Utils.js +4 -0
- package/dist/Utils.js.map +1 -1
- package/dist/index.d.ts +81 -32
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +81 -32
- package/dist/index.js.map +1 -1
- package/dist/internal/concurrency.js +2 -2
- package/dist/internal/concurrency.js.map +1 -1
- package/dist/internal/core.js +8 -20
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/effect.js +20 -19
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/executionPlan.js +2 -2
- package/dist/internal/executionPlan.js.map +1 -1
- package/dist/internal/option.js +5 -8
- package/dist/internal/option.js.map +1 -1
- package/dist/internal/result.js +5 -8
- package/dist/internal/result.js.map +1 -1
- package/dist/internal/schema/schema.js +1 -1
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/testing/FastCheck.d.ts +6 -3
- package/dist/testing/FastCheck.d.ts.map +1 -1
- package/dist/testing/FastCheck.js +6 -3
- package/dist/testing/FastCheck.js.map +1 -1
- package/dist/testing/TestClock.d.ts +39 -34
- package/dist/testing/TestClock.d.ts.map +1 -1
- package/dist/testing/TestClock.js +42 -12
- package/dist/testing/TestClock.js.map +1 -1
- package/dist/testing/TestConsole.d.ts +39 -30
- package/dist/testing/TestConsole.d.ts.map +1 -1
- package/dist/testing/TestConsole.js +25 -10
- package/dist/testing/TestConsole.js.map +1 -1
- package/dist/testing/TestSchema.js +7 -7
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +197 -130
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +166 -102
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +2 -2
- package/dist/unstable/ai/Chat.d.ts +65 -41
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +51 -33
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.d.ts +12 -11
- package/dist/unstable/ai/EmbeddingModel.d.ts.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.js +9 -8
- package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
- package/dist/unstable/ai/IdGenerator.d.ts +28 -18
- package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
- package/dist/unstable/ai/IdGenerator.js +18 -11
- package/dist/unstable/ai/IdGenerator.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +36 -30
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +21 -15
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpSchema.d.ts +339 -119
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +264 -98
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +53 -19
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +65 -17
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Model.d.ts +13 -7
- package/dist/unstable/ai/Model.d.ts.map +1 -1
- package/dist/unstable/ai/Model.js +11 -9
- package/dist/unstable/ai/Model.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +2 -2
- package/dist/unstable/ai/Prompt.d.ts +194 -168
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Prompt.js +75 -66
- package/dist/unstable/ai/Prompt.js.map +1 -1
- package/dist/unstable/ai/Response.d.ts +153 -140
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js +43 -48
- package/dist/unstable/ai/Response.js.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.d.ts +43 -4
- package/dist/unstable/ai/ResponseIdTracker.d.ts.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.js +27 -2
- package/dist/unstable/ai/ResponseIdTracker.js.map +1 -1
- package/dist/unstable/ai/Telemetry.d.ts +42 -32
- package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
- package/dist/unstable/ai/Telemetry.js +14 -10
- package/dist/unstable/ai/Telemetry.js.map +1 -1
- package/dist/unstable/ai/Tokenizer.d.ts +13 -8
- package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
- package/dist/unstable/ai/Tokenizer.js +10 -6
- package/dist/unstable/ai/Tokenizer.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +153 -84
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +97 -44
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +33 -42
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +35 -36
- package/dist/unstable/ai/Toolkit.js.map +1 -1
- package/dist/unstable/ai/index.d.ts +42 -24
- package/dist/unstable/ai/index.d.ts.map +1 -1
- package/dist/unstable/ai/index.js +42 -24
- package/dist/unstable/ai/index.js.map +1 -1
- package/dist/unstable/cli/Argument.d.ts +226 -134
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js +101 -65
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +72 -26
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +86 -23
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/CliOutput.d.ts +43 -13
- package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
- package/dist/unstable/cli/CliOutput.js +30 -6
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +218 -117
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +45 -31
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Completions.d.ts +7 -7
- package/dist/unstable/cli/Completions.js +1 -1
- package/dist/unstable/cli/Flag.d.ts +235 -142
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js +111 -71
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +42 -14
- package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -1
- package/dist/unstable/cli/GlobalFlag.js +30 -7
- package/dist/unstable/cli/GlobalFlag.js.map +1 -1
- package/dist/unstable/cli/HelpDoc.d.ts +35 -10
- package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
- package/dist/unstable/cli/HelpDoc.js +21 -0
- package/dist/unstable/cli/Param.d.ts +79 -31
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +161 -99
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +79 -42
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js +66 -35
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/Prompt.d.ts +178 -47
- package/dist/unstable/cli/Prompt.d.ts.map +1 -1
- package/dist/unstable/cli/Prompt.js +111 -31
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/internal/ansi.d.ts.map +1 -1
- package/dist/unstable/cli/internal/ansi.js +13 -0
- package/dist/unstable/cli/internal/ansi.js.map +1 -1
- package/dist/unstable/cli/internal/command.d.ts +7 -7
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.js +12 -10
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/config.d.ts +3 -0
- package/dist/unstable/cli/internal/config.d.ts.map +1 -1
- package/dist/unstable/cli/internal/config.js.map +1 -1
- package/dist/unstable/cli/internal/lexer.js.map +1 -1
- package/dist/unstable/cluster/ClusterCron.d.ts +35 -1
- package/dist/unstable/cluster/ClusterCron.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterCron.js +35 -1
- package/dist/unstable/cluster/ClusterCron.js.map +1 -1
- package/dist/unstable/cluster/ClusterError.d.ts +56 -7
- package/dist/unstable/cluster/ClusterError.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterError.js +56 -7
- package/dist/unstable/cluster/ClusterError.js.map +1 -1
- package/dist/unstable/cluster/ClusterMetrics.d.ts +39 -5
- package/dist/unstable/cluster/ClusterMetrics.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterMetrics.js +39 -5
- package/dist/unstable/cluster/ClusterMetrics.js.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.d.ts +61 -8
- package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.js +61 -8
- package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +14 -2
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +36 -3
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/DeliverAt.d.ts +39 -4
- package/dist/unstable/cluster/DeliverAt.d.ts.map +1 -1
- package/dist/unstable/cluster/DeliverAt.js +11 -3
- package/dist/unstable/cluster/DeliverAt.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +75 -16
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +78 -13
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/EntityAddress.d.ts +30 -2
- package/dist/unstable/cluster/EntityAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityAddress.js +30 -2
- package/dist/unstable/cluster/EntityAddress.js.map +1 -1
- package/dist/unstable/cluster/EntityId.d.ts +18 -3
- package/dist/unstable/cluster/EntityId.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityId.js +15 -2
- package/dist/unstable/cluster/EntityId.js.map +1 -1
- package/dist/unstable/cluster/EntityProxy.d.ts +34 -2
- package/dist/unstable/cluster/EntityProxy.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxy.js +24 -2
- package/dist/unstable/cluster/EntityProxy.js.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.d.ts +17 -2
- package/dist/unstable/cluster/EntityProxyServer.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.js +40 -8
- package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
- package/dist/unstable/cluster/EntityResource.d.ts +43 -6
- package/dist/unstable/cluster/EntityResource.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityResource.js +11 -4
- package/dist/unstable/cluster/EntityResource.js.map +1 -1
- package/dist/unstable/cluster/EntityType.d.ts +27 -3
- package/dist/unstable/cluster/EntityType.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityType.js +24 -2
- package/dist/unstable/cluster/EntityType.js.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts +105 -23
- package/dist/unstable/cluster/Envelope.d.ts.map +1 -1
- package/dist/unstable/cluster/Envelope.js +88 -14
- package/dist/unstable/cluster/Envelope.js.map +1 -1
- package/dist/unstable/cluster/HttpRunner.d.ts +88 -13
- package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/HttpRunner.js +88 -13
- package/dist/unstable/cluster/HttpRunner.js.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.d.ts +49 -6
- package/dist/unstable/cluster/K8sHttpClient.d.ts.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.js +31 -6
- package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
- package/dist/unstable/cluster/MachineId.d.ts +24 -3
- package/dist/unstable/cluster/MachineId.d.ts.map +1 -1
- package/dist/unstable/cluster/MachineId.js +21 -2
- package/dist/unstable/cluster/MachineId.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +102 -13
- package/dist/unstable/cluster/Message.d.ts.map +1 -1
- package/dist/unstable/cluster/Message.js +86 -10
- package/dist/unstable/cluster/Message.js.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts +127 -21
- package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/MessageStorage.js +71 -11
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts +101 -12
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +64 -8
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/Runner.d.ts +47 -17
- package/dist/unstable/cluster/Runner.d.ts.map +1 -1
- package/dist/unstable/cluster/Runner.js +47 -17
- package/dist/unstable/cluster/Runner.js.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.d.ts +34 -2
- package/dist/unstable/cluster/RunnerAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.js +34 -2
- package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.d.ts +40 -12
- package/dist/unstable/cluster/RunnerHealth.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.js +40 -12
- package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts +7 -4
- package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.js +31 -4
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.d.ts +42 -5
- package/dist/unstable/cluster/RunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.js +38 -4
- package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +73 -10
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +70 -9
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/ShardId.d.ts +51 -5
- package/dist/unstable/cluster/ShardId.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardId.js +47 -4
- package/dist/unstable/cluster/ShardId.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts +10 -2
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +35 -4
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +65 -9
- package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.js +67 -10
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/ShardingRegistrationEvent.d.ts +27 -6
- package/dist/unstable/cluster/ShardingRegistrationEvent.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardingRegistrationEvent.js +28 -4
- package/dist/unstable/cluster/ShardingRegistrationEvent.js.map +1 -1
- package/dist/unstable/cluster/SingleRunner.d.ts +23 -1
- package/dist/unstable/cluster/SingleRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/SingleRunner.js +23 -1
- package/dist/unstable/cluster/SingleRunner.js.map +1 -1
- package/dist/unstable/cluster/Singleton.d.ts +15 -1
- package/dist/unstable/cluster/Singleton.d.ts.map +1 -1
- package/dist/unstable/cluster/Singleton.js +15 -1
- package/dist/unstable/cluster/Singleton.js.map +1 -1
- package/dist/unstable/cluster/SingletonAddress.d.ts +21 -1
- package/dist/unstable/cluster/SingletonAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/SingletonAddress.js +21 -1
- package/dist/unstable/cluster/SingletonAddress.js.map +1 -1
- package/dist/unstable/cluster/Snowflake.d.ts +89 -19
- package/dist/unstable/cluster/Snowflake.d.ts.map +1 -1
- package/dist/unstable/cluster/Snowflake.js +48 -13
- package/dist/unstable/cluster/Snowflake.js.map +1 -1
- package/dist/unstable/cluster/SocketRunner.d.ts +8 -2
- package/dist/unstable/cluster/SocketRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/SocketRunner.js +29 -2
- package/dist/unstable/cluster/SocketRunner.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.d.ts +11 -3
- package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +27 -3
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts +11 -3
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js +46 -7
- package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/TestRunner.d.ts +18 -1
- package/dist/unstable/cluster/TestRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/TestRunner.js +18 -1
- package/dist/unstable/cluster/TestRunner.js.map +1 -1
- package/dist/unstable/cluster/internal/hash.js +12 -0
- package/dist/unstable/cluster/internal/hash.js.map +1 -1
- package/dist/unstable/devtools/DevTools.d.ts +26 -3
- package/dist/unstable/devtools/DevTools.d.ts.map +1 -1
- package/dist/unstable/devtools/DevTools.js +26 -3
- package/dist/unstable/devtools/DevTools.js.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.d.ts +20 -5
- package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.js +32 -5
- package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.d.ts +184 -44
- package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.js +102 -20
- package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
- package/dist/unstable/devtools/DevToolsServer.d.ts +27 -2
- package/dist/unstable/devtools/DevToolsServer.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsServer.js +21 -1
- package/dist/unstable/devtools/DevToolsServer.js.map +1 -1
- package/dist/unstable/encoding/Msgpack.d.ts +81 -12
- package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
- package/dist/unstable/encoding/Msgpack.js +75 -9
- package/dist/unstable/encoding/Msgpack.js.map +1 -1
- package/dist/unstable/encoding/Ndjson.d.ts +149 -21
- package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
- package/dist/unstable/encoding/Ndjson.js +97 -13
- package/dist/unstable/encoding/Ndjson.js.map +1 -1
- package/dist/unstable/encoding/Sse.d.ts +109 -18
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.js +69 -13
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/eventlog/Event.d.ts +115 -30
- package/dist/unstable/eventlog/Event.d.ts.map +1 -1
- package/dist/unstable/eventlog/Event.js +22 -2
- package/dist/unstable/eventlog/Event.js.map +1 -1
- package/dist/unstable/eventlog/EventGroup.d.ts +50 -17
- package/dist/unstable/eventlog/EventGroup.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventGroup.js +24 -6
- package/dist/unstable/eventlog/EventGroup.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +104 -20
- package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventJournal.js +108 -16
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts +151 -31
- package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLog.js +111 -20
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.d.ts +42 -6
- package/dist/unstable/eventlog/EventLogEncryption.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js +38 -5
- package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +96 -22
- package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.js +72 -16
- package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +35 -8
- package/dist/unstable/eventlog/EventLogRemote.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.js +54 -8
- package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.d.ts +17 -3
- package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.js +17 -3
- package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +32 -6
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.js +52 -6
- package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +74 -16
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js +90 -16
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +59 -15
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.js +73 -14
- package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.d.ts +10 -2
- package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.js +28 -2
- package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts +32 -3
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js +32 -3
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts +10 -2
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +28 -2
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/http/Cookies.d.ts +156 -77
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +93 -39
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Etag.d.ts +40 -7
- package/dist/unstable/http/Etag.d.ts.map +1 -1
- package/dist/unstable/http/Etag.js +27 -4
- package/dist/unstable/http/Etag.js.map +1 -1
- package/dist/unstable/http/FetchHttpClient.d.ts +29 -3
- package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
- package/dist/unstable/http/FetchHttpClient.js +33 -4
- package/dist/unstable/http/FetchHttpClient.js.map +1 -1
- package/dist/unstable/http/FindMyWay.d.ts +1 -1
- package/dist/unstable/http/FindMyWay.js +1 -1
- package/dist/unstable/http/Headers.d.ts +182 -36
- package/dist/unstable/http/Headers.d.ts.map +1 -1
- package/dist/unstable/http/Headers.js +86 -16
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpBody.d.ts +114 -26
- package/dist/unstable/http/HttpBody.d.ts.map +1 -1
- package/dist/unstable/http/HttpBody.js +100 -22
- package/dist/unstable/http/HttpBody.js.map +1 -1
- package/dist/unstable/http/HttpClient.d.ts +205 -96
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +85 -39
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientError.d.ts +68 -12
- package/dist/unstable/http/HttpClientError.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientError.js +71 -9
- package/dist/unstable/http/HttpClientError.js.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts +318 -100
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +153 -47
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts +59 -16
- package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientResponse.js +44 -11
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts +42 -16
- package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
- package/dist/unstable/http/HttpEffect.js +33 -13
- package/dist/unstable/http/HttpEffect.js.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.d.ts +47 -7
- package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js +44 -6
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpMethod.d.ts +35 -5
- package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
- package/dist/unstable/http/HttpMethod.js +23 -1
- package/dist/unstable/http/HttpMethod.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts +37 -11
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +70 -31
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/http/HttpPlatform.d.ts +34 -3
- package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
- package/dist/unstable/http/HttpPlatform.js +35 -4
- package/dist/unstable/http/HttpPlatform.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +194 -45
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js +122 -28
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServer.d.ts +151 -22
- package/dist/unstable/http/HttpServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpServer.js +77 -12
- package/dist/unstable/http/HttpServer.js.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +90 -10
- package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerError.js +82 -8
- package/dist/unstable/http/HttpServerError.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts +125 -21
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +112 -31
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.d.ts +32 -6
- package/dist/unstable/http/HttpServerRespondable.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.js +43 -5
- package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +390 -67
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +209 -38
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpStaticServer.d.ts +22 -4
- package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpStaticServer.js +22 -4
- package/dist/unstable/http/HttpStaticServer.js.map +1 -1
- package/dist/unstable/http/HttpTraceContext.d.ts +53 -6
- package/dist/unstable/http/HttpTraceContext.d.ts.map +1 -1
- package/dist/unstable/http/HttpTraceContext.js +47 -5
- package/dist/unstable/http/HttpTraceContext.js.map +1 -1
- package/dist/unstable/http/Multipart.d.ts +178 -28
- package/dist/unstable/http/Multipart.d.ts.map +1 -1
- package/dist/unstable/http/Multipart.js +130 -20
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/Multipasta/HeadersParser.d.ts +1 -1
- package/dist/unstable/http/Multipasta/HeadersParser.js +1 -1
- package/dist/unstable/http/Multipasta/Node.d.ts +1 -1
- package/dist/unstable/http/Multipasta/Node.js +1 -1
- package/dist/unstable/http/Multipasta/Search.d.ts +1 -1
- package/dist/unstable/http/Multipasta/Search.js +1 -1
- package/dist/unstable/http/Multipasta/Web.d.ts +1 -1
- package/dist/unstable/http/Multipasta/Web.js +1 -1
- package/dist/unstable/http/Multipasta.d.ts +1 -1
- package/dist/unstable/http/Multipasta.js +1 -1
- package/dist/unstable/http/Template.d.ts +53 -0
- package/dist/unstable/http/Template.d.ts.map +1 -1
- package/dist/unstable/http/Template.js +26 -0
- package/dist/unstable/http/Template.js.map +1 -1
- package/dist/unstable/http/Url.d.ts +56 -42
- package/dist/unstable/http/Url.d.ts.map +1 -1
- package/dist/unstable/http/Url.js +29 -15
- package/dist/unstable/http/Url.js.map +1 -1
- package/dist/unstable/http/UrlParams.d.ts +233 -49
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +116 -23
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/httpapi/HttpApi.d.ts +49 -14
- package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js +14 -8
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +55 -16
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +47 -9
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +58 -15
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +43 -7
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +214 -59
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.js +53 -9
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +81 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.js +98 -1
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.d.ts +87 -20
- package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.js +5 -2
- package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +113 -22
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js +49 -6
- package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts +19 -4
- package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.js +32 -2
- package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +67 -30
- package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.js +48 -27
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts +74 -17
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.js +38 -5
- package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.d.ts +5 -2
- package/dist/unstable/httpapi/HttpApiSwagger.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.js +24 -2
- package/dist/unstable/httpapi/HttpApiSwagger.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiTest.d.ts +9 -2
- package/dist/unstable/httpapi/HttpApiTest.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiTest.js +28 -3
- package/dist/unstable/httpapi/HttpApiTest.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts +86 -15
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +73 -15
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/observability/Otlp.d.ts +33 -3
- package/dist/unstable/observability/Otlp.d.ts.map +1 -1
- package/dist/unstable/observability/Otlp.js +14 -3
- package/dist/unstable/observability/Otlp.js.map +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts +8 -1
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +32 -1
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.d.ts +14 -2
- package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpLogger.js +29 -2
- package/dist/unstable/observability/OtlpLogger.js.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts +15 -4
- package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.js +32 -2
- package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
- package/dist/unstable/observability/OtlpResource.d.ts +49 -12
- package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpResource.js +47 -5
- package/dist/unstable/observability/OtlpResource.js.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.d.ts +28 -3
- package/dist/unstable/observability/OtlpSerialization.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.js +28 -3
- package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
- package/dist/unstable/observability/OtlpTracer.d.ts +16 -2
- package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js +32 -2
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.d.ts +32 -12
- package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.js +7 -5
- package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
- package/dist/unstable/observability/index.d.ts +2 -1
- package/dist/unstable/observability/index.d.ts.map +1 -1
- package/dist/unstable/observability/index.js +2 -1
- package/dist/unstable/observability/index.js.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts +93 -18
- package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.js +81 -21
- package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
- package/dist/unstable/persistence/Persistable.d.ts +76 -15
- package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistable.js +22 -5
- package/dist/unstable/persistence/Persistable.js.map +1 -1
- package/dist/unstable/persistence/PersistedCache.d.ts +27 -2
- package/dist/unstable/persistence/PersistedCache.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedCache.js +24 -1
- package/dist/unstable/persistence/PersistedCache.js.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts +73 -16
- package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.js +60 -13
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/persistence/Persistence.d.ts +97 -16
- package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistence.js +90 -14
- package/dist/unstable/persistence/Persistence.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +97 -21
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +82 -17
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/persistence/Redis.d.ts +26 -5
- package/dist/unstable/persistence/Redis.d.ts.map +1 -1
- package/dist/unstable/persistence/Redis.js +36 -4
- package/dist/unstable/persistence/Redis.js.map +1 -1
- package/dist/unstable/process/ChildProcess.d.ts +89 -109
- package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcess.js +74 -23
- package/dist/unstable/process/ChildProcess.js.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.d.ts +22 -11
- package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js +11 -6
- package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
- package/dist/unstable/process/index.d.ts +2 -1
- package/dist/unstable/process/index.d.ts.map +1 -1
- package/dist/unstable/process/index.js +2 -1
- package/dist/unstable/process/index.js.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.d.ts +196 -59
- package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.js +121 -36
- package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +539 -130
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +256 -62
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +41 -2
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.js +35 -1
- package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/unstable/reactivity/AtomRef.d.ts +51 -7
- package/dist/unstable/reactivity/AtomRef.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRef.js +29 -3
- package/dist/unstable/reactivity/AtomRef.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.d.ts +135 -21
- package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +69 -10
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts +36 -2
- package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.js +29 -1
- package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
- package/dist/unstable/reactivity/Hydration.d.ts +28 -5
- package/dist/unstable/reactivity/Hydration.d.ts.map +1 -1
- package/dist/unstable/reactivity/Hydration.js +35 -3
- package/dist/unstable/reactivity/Hydration.js.map +1 -1
- package/dist/unstable/reactivity/Reactivity.d.ts +95 -13
- package/dist/unstable/reactivity/Reactivity.d.ts.map +1 -1
- package/dist/unstable/reactivity/Reactivity.js +61 -7
- package/dist/unstable/reactivity/Reactivity.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +255 -56
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js +44 -11
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts +81 -19
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +53 -13
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcClientError.d.ts +26 -2
- package/dist/unstable/rpc/RpcClientError.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClientError.js +26 -2
- package/dist/unstable/rpc/RpcClientError.js.map +1 -1
- package/dist/unstable/rpc/RpcGroup.d.ts +51 -8
- package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcGroup.js +3 -1
- package/dist/unstable/rpc/RpcGroup.js.map +1 -1
- package/dist/unstable/rpc/RpcMessage.d.ts +128 -32
- package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMessage.js +23 -7
- package/dist/unstable/rpc/RpcMessage.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts +100 -20
- package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js +39 -3
- package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts +38 -4
- package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSchema.js +34 -3
- package/dist/unstable/rpc/RpcSchema.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts +60 -13
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +56 -12
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +73 -23
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +70 -23
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/rpc/RpcTest.d.ts +20 -1
- package/dist/unstable/rpc/RpcTest.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcTest.js +20 -1
- package/dist/unstable/rpc/RpcTest.js.map +1 -1
- package/dist/unstable/rpc/RpcWorker.d.ts +40 -6
- package/dist/unstable/rpc/RpcWorker.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcWorker.js +17 -5
- package/dist/unstable/rpc/RpcWorker.js.map +1 -1
- package/dist/unstable/rpc/Utils.d.ts +8 -0
- package/dist/unstable/rpc/Utils.d.ts.map +1 -1
- package/dist/unstable/rpc/Utils.js +8 -0
- package/dist/unstable/rpc/Utils.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts +130 -52
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js +79 -34
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +104 -24
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.js +22 -6
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +167 -34
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +124 -29
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/socket/SocketServer.d.ts +58 -10
- package/dist/unstable/socket/SocketServer.d.ts.map +1 -1
- package/dist/unstable/socket/SocketServer.js +43 -5
- package/dist/unstable/socket/SocketServer.js.map +1 -1
- package/dist/unstable/sql/Migrator.d.ts +35 -4
- package/dist/unstable/sql/Migrator.d.ts.map +1 -1
- package/dist/unstable/sql/Migrator.js +45 -5
- package/dist/unstable/sql/Migrator.js.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts +34 -2
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +38 -1
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/sql/SqlConnection.d.ts +31 -0
- package/dist/unstable/sql/SqlConnection.d.ts.map +1 -1
- package/dist/unstable/sql/SqlConnection.js +22 -0
- package/dist/unstable/sql/SqlConnection.js.map +1 -1
- package/dist/unstable/sql/SqlError.d.ts +99 -0
- package/dist/unstable/sql/SqlError.d.ts.map +1 -1
- package/dist/unstable/sql/SqlError.js +114 -0
- package/dist/unstable/sql/SqlError.js.map +1 -1
- package/dist/unstable/sql/SqlModel.d.ts +26 -5
- package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
- package/dist/unstable/sql/SqlModel.js +8 -4
- package/dist/unstable/sql/SqlModel.js.map +1 -1
- package/dist/unstable/sql/SqlResolver.d.ts +56 -13
- package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
- package/dist/unstable/sql/SqlResolver.js +44 -10
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/sql/SqlSchema.d.ts +29 -8
- package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
- package/dist/unstable/sql/SqlSchema.js +29 -8
- package/dist/unstable/sql/SqlSchema.js.map +1 -1
- package/dist/unstable/sql/SqlStream.d.ts +3 -0
- package/dist/unstable/sql/SqlStream.d.ts.map +1 -1
- package/dist/unstable/sql/SqlStream.js +23 -0
- package/dist/unstable/sql/SqlStream.js.map +1 -1
- package/dist/unstable/sql/Statement.d.ts +124 -0
- package/dist/unstable/sql/Statement.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.js +82 -0
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/sql/index.d.ts +1 -1
- package/dist/unstable/sql/index.js +1 -1
- package/dist/unstable/workers/Transferable.d.ts +65 -13
- package/dist/unstable/workers/Transferable.d.ts.map +1 -1
- package/dist/unstable/workers/Transferable.js +53 -10
- package/dist/unstable/workers/Transferable.js.map +1 -1
- package/dist/unstable/workers/Worker.d.ts +60 -8
- package/dist/unstable/workers/Worker.d.ts.map +1 -1
- package/dist/unstable/workers/Worker.js +43 -4
- package/dist/unstable/workers/Worker.js.map +1 -1
- package/dist/unstable/workers/WorkerError.d.ts +31 -9
- package/dist/unstable/workers/WorkerError.d.ts.map +1 -1
- package/dist/unstable/workers/WorkerError.js +44 -7
- package/dist/unstable/workers/WorkerError.js.map +1 -1
- package/dist/unstable/workers/WorkerRunner.d.ts +32 -3
- package/dist/unstable/workers/WorkerRunner.d.ts.map +1 -1
- package/dist/unstable/workers/WorkerRunner.js +24 -1
- package/dist/unstable/workers/WorkerRunner.js.map +1 -1
- package/dist/unstable/workers/index.d.ts +1 -1
- package/dist/unstable/workers/index.js +1 -1
- package/dist/unstable/workflow/Activity.d.ts +61 -10
- package/dist/unstable/workflow/Activity.d.ts.map +1 -1
- package/dist/unstable/workflow/Activity.js +21 -6
- package/dist/unstable/workflow/Activity.js.map +1 -1
- package/dist/unstable/workflow/DurableClock.d.ts +12 -3
- package/dist/unstable/workflow/DurableClock.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableClock.js +22 -2
- package/dist/unstable/workflow/DurableClock.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.d.ts +126 -31
- package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.js +76 -13
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/DurableQueue.d.ts +145 -0
- package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -0
- package/dist/unstable/workflow/DurableQueue.js +200 -0
- package/dist/unstable/workflow/DurableQueue.js.map +1 -0
- package/dist/unstable/workflow/Workflow.d.ts +100 -31
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js +76 -20
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +40 -5
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +16 -4
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.d.ts +32 -2
- package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.js +2 -2
- package/dist/unstable/workflow/WorkflowProxy.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.d.ts +36 -2
- package/dist/unstable/workflow/WorkflowProxyServer.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.js +12 -6
- package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
- package/dist/unstable/workflow/index.d.ts +4 -0
- package/dist/unstable/workflow/index.d.ts.map +1 -1
- package/dist/unstable/workflow/index.js +4 -0
- package/dist/unstable/workflow/index.js.map +1 -1
- package/package.json +11 -11
- package/src/Array.ts +113 -67
- package/src/BigDecimal.ts +404 -337
- package/src/BigInt.ts +167 -97
- package/src/Boolean.ts +62 -31
- package/src/Brand.ts +20 -1
- package/src/Cache.ts +331 -164
- package/src/Cause.ts +77 -65
- package/src/Channel.ts +1585 -607
- package/src/ChannelSchema.ts +137 -12
- package/src/Chunk.ts +549 -380
- package/src/Clock.ts +15 -8
- package/src/Combiner.ts +2 -4
- package/src/Config.ts +12 -10
- package/src/ConfigProvider.ts +1 -1
- package/src/Console.ts +88 -58
- package/src/Context.ts +397 -149
- package/src/Cron.ts +111 -48
- package/src/Data.ts +3 -2
- package/src/DateTime.ts +876 -445
- package/src/Deferred.ts +367 -174
- package/src/Differ.ts +42 -0
- package/src/Duration.ts +329 -185
- package/src/Effect.ts +2474 -2395
- package/src/Effectable.ts +39 -4
- package/src/Encoding.ts +78 -28
- package/src/Equivalence.ts +14 -19
- package/src/ErrorReporter.ts +66 -82
- package/src/ExecutionPlan.ts +97 -13
- package/src/Exit.ts +7 -5
- package/src/Fiber.ts +72 -40
- package/src/FiberHandle.ts +158 -58
- package/src/FiberMap.ts +329 -164
- package/src/FiberSet.ts +130 -52
- package/src/FileSystem.ts +106 -74
- package/src/Filter.ts +166 -88
- package/src/Function.ts +154 -86
- package/src/Graph.ts +682 -365
- package/src/HKT.ts +29 -13
- package/src/Hash.ts +31 -18
- package/src/HashMap.ts +444 -256
- package/src/HashRing.ts +94 -17
- package/src/HashSet.ts +194 -104
- package/src/Inspectable.ts +22 -10
- package/src/Iterable.ts +309 -149
- package/src/JsonPatch.ts +4 -3
- package/src/Latch.ts +98 -15
- package/src/Layer.ts +488 -345
- package/src/LayerMap.ts +98 -25
- package/src/LogLevel.ts +92 -131
- package/src/Logger.ts +357 -288
- package/src/ManagedRuntime.ts +75 -17
- package/src/Match.ts +133 -157
- package/src/Metric.ts +355 -304
- package/src/MutableHashMap.ts +161 -84
- package/src/MutableHashSet.ts +122 -52
- package/src/MutableList.ts +141 -81
- package/src/MutableRef.ts +130 -90
- package/src/Newtype.ts +3 -0
- package/src/NonEmptyIterable.ts +36 -39
- package/src/Number.ts +116 -64
- package/src/Optic.ts +1 -2
- package/src/Option.ts +41 -53
- package/src/Ordering.ts +43 -28
- package/src/PartitionedSemaphore.ts +225 -40
- package/src/Path.ts +77 -13
- package/src/Pipeable.ts +76 -21
- package/src/PlatformError.ts +74 -6
- package/src/Pool.ts +94 -31
- package/src/Predicate.ts +16 -21
- package/src/PrimaryKey.ts +9 -2
- package/src/PubSub.ts +364 -262
- package/src/Pull.ts +94 -25
- package/src/Queue.ts +284 -150
- package/src/Random.ts +54 -35
- package/src/RcMap.ts +151 -141
- package/src/RcRef.ts +69 -32
- package/src/Record.ts +273 -129
- package/src/Redactable.ts +3 -3
- package/src/Redacted.ts +63 -33
- package/src/Ref.ts +161 -104
- package/src/References.ts +73 -31
- package/src/RegExp.ts +11 -5
- package/src/Request.ts +158 -34
- package/src/RequestResolver.ts +277 -119
- package/src/Resource.ts +45 -7
- package/src/Result.ts +31 -18
- package/src/Runtime.ts +45 -19
- package/src/Schedule.ts +575 -600
- package/src/Scheduler.ts +43 -6
- package/src/Schema.ts +845 -319
- package/src/SchemaAST.ts +25 -16
- package/src/SchemaGetter.ts +32 -17
- package/src/SchemaIssue.ts +1 -8
- package/src/SchemaParser.ts +262 -38
- package/src/SchemaTransformation.ts +61 -41
- package/src/SchemaUtils.ts +23 -0
- package/src/Scope.ts +102 -43
- package/src/ScopedCache.ts +192 -56
- package/src/ScopedRef.ts +28 -8
- package/src/Semaphore.ts +64 -28
- package/src/Sink.ts +458 -200
- package/src/Stdio.ts +43 -6
- package/src/Stream.ts +2043 -1256
- package/src/String.ts +171 -95
- package/src/SubscriptionRef.ts +308 -203
- package/src/Symbol.ts +13 -5
- package/src/SynchronizedRef.ts +278 -62
- package/src/Take.ts +26 -2
- package/src/Terminal.ts +40 -7
- package/src/Tracer.ts +229 -55
- package/src/Trie.ts +213 -142
- package/src/TxChunk.ts +182 -146
- package/src/TxDeferred.ts +43 -29
- package/src/TxHashMap.ts +370 -230
- package/src/TxHashSet.ts +250 -152
- package/src/TxPriorityQueue.ts +96 -64
- package/src/TxPubSub.ts +77 -49
- package/src/TxQueue.ts +279 -241
- package/src/TxReentrantLock.ts +70 -47
- package/src/TxRef.ts +70 -41
- package/src/TxSemaphore.ts +101 -54
- package/src/TxSubscriptionRef.ts +72 -48
- package/src/Types.ts +34 -34
- package/src/UndefinedOr.ts +48 -25
- package/src/Unify.ts +71 -116
- package/src/Utils.ts +4 -0
- package/src/index.ts +81 -32
- package/src/internal/concurrency.ts +2 -2
- package/src/internal/core.ts +12 -23
- package/src/internal/effect.ts +25 -29
- package/src/internal/executionPlan.ts +2 -2
- package/src/internal/option.ts +5 -8
- package/src/internal/result.ts +5 -8
- package/src/internal/schema/schema.ts +1 -1
- package/src/testing/FastCheck.ts +6 -3
- package/src/testing/TestClock.ts +63 -34
- package/src/testing/TestConsole.ts +49 -30
- package/src/testing/TestSchema.ts +8 -8
- package/src/unstable/ai/AiError.ts +187 -120
- package/src/unstable/ai/AnthropicStructuredOutput.ts +2 -2
- package/src/unstable/ai/Chat.ts +69 -43
- package/src/unstable/ai/EmbeddingModel.ts +12 -11
- package/src/unstable/ai/IdGenerator.ts +28 -18
- package/src/unstable/ai/LanguageModel.ts +47 -46
- package/src/unstable/ai/McpSchema.ts +339 -119
- package/src/unstable/ai/McpServer.ts +78 -21
- package/src/unstable/ai/Model.ts +23 -18
- package/src/unstable/ai/OpenAiStructuredOutput.ts +2 -2
- package/src/unstable/ai/Prompt.ts +210 -184
- package/src/unstable/ai/Response.ts +159 -147
- package/src/unstable/ai/ResponseIdTracker.ts +43 -4
- package/src/unstable/ai/Telemetry.ts +42 -32
- package/src/unstable/ai/Tokenizer.ts +13 -8
- package/src/unstable/ai/Tool.ts +154 -85
- package/src/unstable/ai/Toolkit.ts +81 -84
- package/src/unstable/ai/index.ts +42 -24
- package/src/unstable/cli/Argument.ts +226 -134
- package/src/unstable/cli/CliError.ts +96 -26
- package/src/unstable/cli/CliOutput.ts +43 -13
- package/src/unstable/cli/Command.ts +225 -125
- package/src/unstable/cli/Completions.ts +7 -7
- package/src/unstable/cli/Flag.ts +235 -142
- package/src/unstable/cli/GlobalFlag.ts +42 -14
- package/src/unstable/cli/HelpDoc.ts +35 -10
- package/src/unstable/cli/Param.ts +328 -190
- package/src/unstable/cli/Primitive.ts +79 -42
- package/src/unstable/cli/Prompt.ts +210 -58
- package/src/unstable/cli/internal/ansi.ts +13 -0
- package/src/unstable/cli/internal/command.ts +17 -15
- package/src/unstable/cli/internal/config.ts +3 -0
- package/src/unstable/cli/internal/lexer.ts +11 -0
- package/src/unstable/cluster/ClusterCron.ts +35 -1
- package/src/unstable/cluster/ClusterError.ts +56 -7
- package/src/unstable/cluster/ClusterMetrics.ts +39 -5
- package/src/unstable/cluster/ClusterSchema.ts +61 -8
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +36 -3
- package/src/unstable/cluster/DeliverAt.ts +39 -4
- package/src/unstable/cluster/Entity.ts +110 -19
- package/src/unstable/cluster/EntityAddress.ts +30 -2
- package/src/unstable/cluster/EntityId.ts +18 -3
- package/src/unstable/cluster/EntityProxy.ts +34 -2
- package/src/unstable/cluster/EntityProxyServer.ts +44 -8
- package/src/unstable/cluster/EntityResource.ts +43 -6
- package/src/unstable/cluster/EntityType.ts +27 -3
- package/src/unstable/cluster/Envelope.ts +128 -23
- package/src/unstable/cluster/HttpRunner.ts +88 -13
- package/src/unstable/cluster/K8sHttpClient.ts +49 -6
- package/src/unstable/cluster/MachineId.ts +24 -3
- package/src/unstable/cluster/Message.ts +102 -13
- package/src/unstable/cluster/MessageStorage.ts +128 -22
- package/src/unstable/cluster/Reply.ts +101 -12
- package/src/unstable/cluster/Runner.ts +47 -17
- package/src/unstable/cluster/RunnerAddress.ts +34 -2
- package/src/unstable/cluster/RunnerHealth.ts +40 -12
- package/src/unstable/cluster/RunnerServer.ts +31 -4
- package/src/unstable/cluster/RunnerStorage.ts +42 -5
- package/src/unstable/cluster/Runners.ts +73 -10
- package/src/unstable/cluster/ShardId.ts +51 -5
- package/src/unstable/cluster/Sharding.ts +35 -4
- package/src/unstable/cluster/ShardingConfig.ts +76 -11
- package/src/unstable/cluster/ShardingRegistrationEvent.ts +31 -7
- package/src/unstable/cluster/SingleRunner.ts +23 -1
- package/src/unstable/cluster/Singleton.ts +15 -1
- package/src/unstable/cluster/SingletonAddress.ts +21 -1
- package/src/unstable/cluster/Snowflake.ts +89 -19
- package/src/unstable/cluster/SocketRunner.ts +29 -2
- package/src/unstable/cluster/SqlMessageStorage.ts +27 -3
- package/src/unstable/cluster/SqlRunnerStorage.ts +46 -7
- package/src/unstable/cluster/TestRunner.ts +18 -1
- package/src/unstable/cluster/internal/hash.ts +12 -0
- package/src/unstable/devtools/DevTools.ts +26 -3
- package/src/unstable/devtools/DevToolsClient.ts +32 -5
- package/src/unstable/devtools/DevToolsSchema.ts +201 -44
- package/src/unstable/devtools/DevToolsServer.ts +27 -2
- package/src/unstable/encoding/Msgpack.ts +97 -12
- package/src/unstable/encoding/Ndjson.ts +149 -21
- package/src/unstable/encoding/Sse.ts +109 -18
- package/src/unstable/eventlog/Event.ts +131 -30
- package/src/unstable/eventlog/EventGroup.ts +50 -17
- package/src/unstable/eventlog/EventJournal.ts +120 -20
- package/src/unstable/eventlog/EventLog.ts +151 -31
- package/src/unstable/eventlog/EventLogEncryption.ts +42 -6
- package/src/unstable/eventlog/EventLogMessage.ts +92 -18
- package/src/unstable/eventlog/EventLogRemote.ts +54 -8
- package/src/unstable/eventlog/EventLogServer.ts +33 -3
- package/src/unstable/eventlog/EventLogServerEncrypted.ts +52 -6
- package/src/unstable/eventlog/EventLogServerUnencrypted.ts +90 -16
- package/src/unstable/eventlog/EventLogSessionAuth.ts +77 -15
- package/src/unstable/eventlog/SqlEventJournal.ts +28 -2
- package/src/unstable/eventlog/SqlEventLogServerEncrypted.ts +32 -3
- package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +28 -2
- package/src/unstable/http/Cookies.ts +156 -77
- package/src/unstable/http/Etag.ts +40 -7
- package/src/unstable/http/FetchHttpClient.ts +33 -4
- package/src/unstable/http/FindMyWay.ts +1 -1
- package/src/unstable/http/Headers.ts +252 -50
- package/src/unstable/http/HttpBody.ts +130 -28
- package/src/unstable/http/HttpClient.ts +206 -97
- package/src/unstable/http/HttpClientError.ts +80 -12
- package/src/unstable/http/HttpClientRequest.ts +320 -102
- package/src/unstable/http/HttpClientResponse.ts +59 -16
- package/src/unstable/http/HttpEffect.ts +66 -18
- package/src/unstable/http/HttpIncomingMessage.ts +47 -7
- package/src/unstable/http/HttpMethod.ts +35 -5
- package/src/unstable/http/HttpMiddleware.ts +63 -16
- package/src/unstable/http/HttpPlatform.ts +35 -4
- package/src/unstable/http/HttpRouter.ts +221 -57
- package/src/unstable/http/HttpServer.ts +152 -23
- package/src/unstable/http/HttpServerError.ts +90 -10
- package/src/unstable/http/HttpServerRequest.ts +136 -32
- package/src/unstable/http/HttpServerRespondable.ts +49 -6
- package/src/unstable/http/HttpServerResponse.ts +395 -72
- package/src/unstable/http/HttpStaticServer.ts +22 -4
- package/src/unstable/http/HttpTraceContext.ts +53 -6
- package/src/unstable/http/Multipart.ts +179 -29
- package/src/unstable/http/Multipasta/HeadersParser.ts +1 -1
- package/src/unstable/http/Multipasta/Node.ts +1 -1
- package/src/unstable/http/Multipasta/Search.ts +1 -1
- package/src/unstable/http/Multipasta/Web.ts +1 -1
- package/src/unstable/http/Multipasta.ts +1 -1
- package/src/unstable/http/Template.ts +53 -0
- package/src/unstable/http/Url.ts +56 -42
- package/src/unstable/http/UrlParams.ts +233 -49
- package/src/unstable/httpapi/HttpApi.ts +49 -14
- package/src/unstable/httpapi/HttpApiBuilder.ts +86 -20
- package/src/unstable/httpapi/HttpApiClient.ts +80 -16
- package/src/unstable/httpapi/HttpApiEndpoint.ts +238 -59
- package/src/unstable/httpapi/HttpApiError.ts +100 -1
- package/src/unstable/httpapi/HttpApiGroup.ts +87 -20
- package/src/unstable/httpapi/HttpApiMiddleware.ts +113 -23
- package/src/unstable/httpapi/HttpApiScalar.ts +38 -4
- package/src/unstable/httpapi/HttpApiSchema.ts +67 -30
- package/src/unstable/httpapi/HttpApiSecurity.ts +74 -17
- package/src/unstable/httpapi/HttpApiSwagger.ts +24 -2
- package/src/unstable/httpapi/HttpApiTest.ts +31 -3
- package/src/unstable/httpapi/OpenApi.ts +115 -15
- package/src/unstable/observability/Otlp.ts +33 -3
- package/src/unstable/observability/OtlpExporter.ts +32 -1
- package/src/unstable/observability/OtlpLogger.ts +31 -2
- package/src/unstable/observability/OtlpMetrics.ts +37 -4
- package/src/unstable/observability/OtlpResource.ts +68 -12
- package/src/unstable/observability/OtlpSerialization.ts +28 -3
- package/src/unstable/observability/OtlpTracer.ts +38 -2
- package/src/unstable/observability/PrometheusMetrics.ts +32 -12
- package/src/unstable/observability/index.ts +2 -1
- package/src/unstable/persistence/KeyValueStore.ts +108 -28
- package/src/unstable/persistence/Persistable.ts +76 -15
- package/src/unstable/persistence/PersistedCache.ts +27 -2
- package/src/unstable/persistence/PersistedQueue.ts +98 -16
- package/src/unstable/persistence/Persistence.ts +97 -16
- package/src/unstable/persistence/RateLimiter.ts +98 -22
- package/src/unstable/persistence/Redis.ts +42 -5
- package/src/unstable/process/ChildProcess.ts +100 -79
- package/src/unstable/process/ChildProcessSpawner.ts +22 -11
- package/src/unstable/process/index.ts +2 -1
- package/src/unstable/reactivity/AsyncResult.ts +202 -61
- package/src/unstable/reactivity/Atom.ts +597 -143
- package/src/unstable/reactivity/AtomHttpApi.ts +41 -2
- package/src/unstable/reactivity/AtomRef.ts +51 -7
- package/src/unstable/reactivity/AtomRegistry.ts +141 -22
- package/src/unstable/reactivity/AtomRpc.ts +36 -2
- package/src/unstable/reactivity/Hydration.ts +45 -5
- package/src/unstable/reactivity/Reactivity.ts +95 -13
- package/src/unstable/rpc/Rpc.ts +255 -56
- package/src/unstable/rpc/RpcClient.ts +108 -20
- package/src/unstable/rpc/RpcClientError.ts +26 -2
- package/src/unstable/rpc/RpcGroup.ts +51 -8
- package/src/unstable/rpc/RpcMessage.ts +128 -32
- package/src/unstable/rpc/RpcMiddleware.ts +100 -20
- package/src/unstable/rpc/RpcSchema.ts +38 -4
- package/src/unstable/rpc/RpcSerialization.ts +60 -13
- package/src/unstable/rpc/RpcServer.ts +108 -25
- package/src/unstable/rpc/RpcTest.ts +20 -1
- package/src/unstable/rpc/RpcWorker.ts +42 -8
- package/src/unstable/rpc/Utils.ts +31 -0
- package/src/unstable/schema/Model.ts +148 -52
- package/src/unstable/schema/VariantSchema.ts +104 -24
- package/src/unstable/socket/Socket.ts +168 -35
- package/src/unstable/socket/SocketServer.ts +58 -10
- package/src/unstable/sql/Migrator.ts +57 -5
- package/src/unstable/sql/SqlClient.ts +55 -2
- package/src/unstable/sql/SqlConnection.ts +31 -0
- package/src/unstable/sql/SqlError.ts +117 -0
- package/src/unstable/sql/SqlModel.ts +26 -5
- package/src/unstable/sql/SqlResolver.ts +56 -13
- package/src/unstable/sql/SqlSchema.ts +29 -8
- package/src/unstable/sql/SqlStream.ts +23 -0
- package/src/unstable/sql/Statement.ts +141 -0
- package/src/unstable/sql/index.ts +1 -1
- package/src/unstable/workers/Transferable.ts +65 -13
- package/src/unstable/workers/Worker.ts +60 -8
- package/src/unstable/workers/WorkerError.ts +50 -9
- package/src/unstable/workers/WorkerRunner.ts +32 -3
- package/src/unstable/workers/index.ts +1 -1
- package/src/unstable/workflow/Activity.ts +62 -11
- package/src/unstable/workflow/DurableClock.ts +26 -3
- package/src/unstable/workflow/DurableDeferred.ts +146 -31
- package/src/unstable/workflow/DurableQueue.ts +366 -0
- package/src/unstable/workflow/Workflow.ts +122 -32
- package/src/unstable/workflow/WorkflowEngine.ts +40 -5
- package/src/unstable/workflow/WorkflowProxy.ts +32 -2
- package/src/unstable/workflow/WorkflowProxyServer.ts +40 -6
- package/src/unstable/workflow/index.ts +5 -0
package/dist/Stream.js
CHANGED
|
@@ -1,4 +1,41 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* The `Stream` module provides a typed, composable way to describe effectful
|
|
3
|
+
* sequences of values. A `Stream<A, E, R>` can emit zero or more `A` values,
|
|
4
|
+
* fail with an `E`, and require services from `R` while preserving
|
|
5
|
+
* backpressure and resource safety.
|
|
6
|
+
*
|
|
7
|
+
* **Mental model**
|
|
8
|
+
*
|
|
9
|
+
* - A stream is a lazy description; it runs only when consumed with a `run*` function
|
|
10
|
+
* - Streams are pull-based and emit chunks internally for efficient throughput
|
|
11
|
+
* - `A` is the element type, `E` is the failure type, and `R` is the required context
|
|
12
|
+
* - Stream composition mirrors `Effect`: use `map`, `flatMap`, error handling, and `pipe`
|
|
13
|
+
* - Resource scopes, interruption, and finalizers are tracked by the Effect runtime
|
|
14
|
+
* - Interop functions connect streams to queues, pub/subs, web streams, async iterables, and channels
|
|
15
|
+
*
|
|
16
|
+
* **Common tasks**
|
|
17
|
+
*
|
|
18
|
+
* - Create streams: {@link make}, {@link fromIterable}, {@link fromEffect}, {@link fromQueue}
|
|
19
|
+
* - Transform values: {@link map}, {@link mapEffect}, {@link flatMap}, {@link filter}
|
|
20
|
+
* - Combine streams: {@link concat}, {@link merge}, {@link zip}, {@link race}
|
|
21
|
+
* - Control demand and timing: {@link take}, {@link drop}, {@link debounce}, {@link throttle}
|
|
22
|
+
* - Manage errors: {@link catchCause}, {@link catchIf}, {@link mapError}, {@link retry}
|
|
23
|
+
* - Manage resources and services: {@link scoped}, {@link ensuring}, {@link provide}
|
|
24
|
+
* - Consume streams: {@link runCollect}, {@link runForEach}, {@link runFold}, {@link runDrain}
|
|
25
|
+
*
|
|
26
|
+
* **Gotchas**
|
|
27
|
+
*
|
|
28
|
+
* - A stream is not a collection; constructors and operators build a description until it is run
|
|
29
|
+
* - Re-running a stream re-executes its effects unless it is explicitly shared or backed by external state
|
|
30
|
+
* - Operators such as {@link merge}, {@link race}, and {@link broadcast} introduce concurrency and interruption semantics
|
|
31
|
+
* - Prefer bounded constructors and sinks for large or infinite streams instead of collecting everything into memory
|
|
32
|
+
*
|
|
33
|
+
* **See also**
|
|
34
|
+
*
|
|
35
|
+
* - {@link Effect.Effect} for single-result effectful programs
|
|
36
|
+
* - {@link Sink.Sink} for consuming and folding streams
|
|
37
|
+
* - {@link Channel.Channel} for the lower-level primitive underlying streams
|
|
38
|
+
*
|
|
2
39
|
* @since 2.0.0
|
|
3
40
|
*/
|
|
4
41
|
// @effect-diagnostics returnEffectInGen:off
|
|
@@ -33,14 +70,18 @@ import * as Scope from "./Scope.js";
|
|
|
33
70
|
import * as Sink from "./Sink.js";
|
|
34
71
|
import { isString } from "./String.js";
|
|
35
72
|
/**
|
|
36
|
-
*
|
|
73
|
+
* Runtime identifier stored on `Stream` values and used by `isStream` to
|
|
74
|
+
* recognize them.
|
|
75
|
+
*
|
|
37
76
|
* @category Type Identifiers
|
|
77
|
+
* @since 4.0.0
|
|
38
78
|
*/
|
|
39
79
|
export const TypeId = "~effect/Stream";
|
|
40
80
|
/**
|
|
41
81
|
* Checks whether a value is a Stream.
|
|
42
82
|
*
|
|
43
|
-
*
|
|
83
|
+
* **Example** (Checking whether a value is a Stream)
|
|
84
|
+
*
|
|
44
85
|
* ```ts
|
|
45
86
|
* import { Console, Effect, Stream } from "effect"
|
|
46
87
|
*
|
|
@@ -57,14 +98,15 @@ export const TypeId = "~effect/Stream";
|
|
|
57
98
|
* Effect.runPromise(program)
|
|
58
99
|
* ```
|
|
59
100
|
*
|
|
60
|
-
* @since 2.0.0
|
|
61
101
|
* @category Guards
|
|
102
|
+
* @since 2.0.0
|
|
62
103
|
*/
|
|
63
104
|
export const isStream = u => hasProperty(u, TypeId);
|
|
64
105
|
/**
|
|
65
106
|
* The default chunk size used by Stream constructors and combinators.
|
|
66
107
|
*
|
|
67
|
-
*
|
|
108
|
+
* **Example** (Reading the default chunk size)
|
|
109
|
+
*
|
|
68
110
|
* ```ts
|
|
69
111
|
* import { Console, Effect, Stream } from "effect"
|
|
70
112
|
*
|
|
@@ -83,7 +125,8 @@ export const DefaultChunkSize = Channel.DefaultChunkSize;
|
|
|
83
125
|
/**
|
|
84
126
|
* Creates a stream from a array-emitting `Channel`.
|
|
85
127
|
*
|
|
86
|
-
*
|
|
128
|
+
* **Example** (Creating a stream from an array-emitting channel)
|
|
129
|
+
*
|
|
87
130
|
* ```ts
|
|
88
131
|
* import { Channel, Console, Effect, Stream } from "effect"
|
|
89
132
|
*
|
|
@@ -97,15 +140,16 @@ export const DefaultChunkSize = Channel.DefaultChunkSize;
|
|
|
97
140
|
* // Output: [ 1, 2, 3 ]
|
|
98
141
|
* ```
|
|
99
142
|
*
|
|
100
|
-
* @since 2.0.0
|
|
101
143
|
* @category Constructors
|
|
144
|
+
* @since 2.0.0
|
|
102
145
|
*/
|
|
103
146
|
export const fromChannel = internal.fromChannel;
|
|
104
147
|
/**
|
|
105
148
|
* Either emits the success value of this effect or terminates the stream
|
|
106
149
|
* with the failure value of this effect.
|
|
107
150
|
*
|
|
108
|
-
*
|
|
151
|
+
* **Example** (Creating a stream from an effect)
|
|
152
|
+
*
|
|
109
153
|
* ```ts
|
|
110
154
|
* import { Console, Effect, Stream } from "effect"
|
|
111
155
|
*
|
|
@@ -119,14 +163,15 @@ export const fromChannel = internal.fromChannel;
|
|
|
119
163
|
* // Output: [ 42 ]
|
|
120
164
|
* ```
|
|
121
165
|
*
|
|
122
|
-
* @since 2.0.0
|
|
123
166
|
* @category Constructors
|
|
167
|
+
* @since 2.0.0
|
|
124
168
|
*/
|
|
125
169
|
export const fromEffect = effect => fromChannel(Channel.fromEffect(Effect.map(effect, Arr.of)));
|
|
126
170
|
/**
|
|
127
171
|
* Accesses a service from the context and emits it as a single element.
|
|
128
172
|
*
|
|
129
|
-
*
|
|
173
|
+
* **Example** (Accessing a service as a stream)
|
|
174
|
+
*
|
|
130
175
|
* ```ts
|
|
131
176
|
* import { Effect, Context, Stream } from "effect"
|
|
132
177
|
*
|
|
@@ -151,15 +196,16 @@ export const fromEffect = effect => fromChannel(Channel.fromEffect(Effect.map(ef
|
|
|
151
196
|
* // Output: [ "Hello, World!" ]
|
|
152
197
|
* ```
|
|
153
198
|
*
|
|
154
|
-
* @since 4.0.0
|
|
155
199
|
* @category Context
|
|
200
|
+
* @since 4.0.0
|
|
156
201
|
*/
|
|
157
202
|
export const service = service => fromEffect(Effect.service(service));
|
|
158
203
|
/**
|
|
159
204
|
* Optionally accesses a service from the context and emits the result as a
|
|
160
205
|
* single element.
|
|
161
206
|
*
|
|
162
|
-
*
|
|
207
|
+
* **Example** (Accessing an optional service as a stream)
|
|
208
|
+
*
|
|
163
209
|
* ```ts
|
|
164
210
|
* import { Effect, Option, Context, Stream } from "effect"
|
|
165
211
|
*
|
|
@@ -189,14 +235,15 @@ export const service = service => fromEffect(Effect.service(service));
|
|
|
189
235
|
* // Output: [ "Hello, World!" ]
|
|
190
236
|
* ```
|
|
191
237
|
*
|
|
192
|
-
* @since 4.0.0
|
|
193
238
|
* @category Context
|
|
239
|
+
* @since 4.0.0
|
|
194
240
|
*/
|
|
195
241
|
export const serviceOption = service => fromEffect(Effect.serviceOption(service));
|
|
196
242
|
/**
|
|
197
243
|
* Creates a stream that runs the effect and emits no elements.
|
|
198
244
|
*
|
|
199
|
-
*
|
|
245
|
+
* **Example** (Draining an effect into a stream)
|
|
246
|
+
*
|
|
200
247
|
* ```ts
|
|
201
248
|
* import { Console, Effect, Stream } from "effect"
|
|
202
249
|
*
|
|
@@ -210,8 +257,8 @@ export const serviceOption = service => fromEffect(Effect.serviceOption(service)
|
|
|
210
257
|
* // Output: Draining side effect
|
|
211
258
|
* ```
|
|
212
259
|
*
|
|
213
|
-
* @since 4.0.0
|
|
214
260
|
* @category Constructors
|
|
261
|
+
* @since 4.0.0
|
|
215
262
|
*/
|
|
216
263
|
export const fromEffectDrain = effect => fromPull(Effect.succeed(Effect.flatMap(effect, () => Cause.done())));
|
|
217
264
|
/**
|
|
@@ -223,7 +270,8 @@ export const fromEffectDrain = effect => fromPull(Effect.succeed(Effect.flatMap(
|
|
|
223
270
|
*
|
|
224
271
|
* - `Stream.repeatEffect`
|
|
225
272
|
*
|
|
226
|
-
*
|
|
273
|
+
* **Example** (Repeating an effect forever)
|
|
274
|
+
*
|
|
227
275
|
* ```ts
|
|
228
276
|
* import { Console, Effect, Random, Stream } from "effect"
|
|
229
277
|
*
|
|
@@ -239,8 +287,8 @@ export const fromEffectDrain = effect => fromPull(Effect.succeed(Effect.flatMap(
|
|
|
239
287
|
* // Output: [ 3891571149, 4239494205, 2352981603, 2339111046, 1488052210 ]
|
|
240
288
|
* ```
|
|
241
289
|
*
|
|
242
|
-
* @since 4.0.0
|
|
243
290
|
* @category Constructors
|
|
291
|
+
* @since 4.0.0
|
|
244
292
|
*/
|
|
245
293
|
export const fromEffectRepeat = effect => fromPull(Effect.succeed(Effect.map(effect, Arr.of)));
|
|
246
294
|
/**
|
|
@@ -253,7 +301,8 @@ export const fromEffectRepeat = effect => fromPull(Effect.succeed(Effect.map(eff
|
|
|
253
301
|
*
|
|
254
302
|
* - `Stream.repeatEffectWithSchedule`
|
|
255
303
|
*
|
|
256
|
-
*
|
|
304
|
+
* **Example** (Repeating an effect with a schedule)
|
|
305
|
+
*
|
|
257
306
|
* ```ts
|
|
258
307
|
* import { Console, Effect, Schedule, Stream } from "effect"
|
|
259
308
|
*
|
|
@@ -270,8 +319,8 @@ export const fromEffectRepeat = effect => fromPull(Effect.succeed(Effect.map(eff
|
|
|
270
319
|
* // Output: [ "ping", "ping", "ping" ]
|
|
271
320
|
* ```
|
|
272
321
|
*
|
|
273
|
-
* @since 2.0.0
|
|
274
322
|
* @category Constructors
|
|
323
|
+
* @since 2.0.0
|
|
275
324
|
*/
|
|
276
325
|
export const fromEffectSchedule = (effect, schedule) => fromPull(Effect.gen(function* () {
|
|
277
326
|
const step = yield* Schedule.toStepWithMetadata(schedule);
|
|
@@ -290,9 +339,11 @@ export const fromEffectSchedule = (effect, schedule) => fromPull(Effect.gen(func
|
|
|
290
339
|
});
|
|
291
340
|
}));
|
|
292
341
|
/**
|
|
293
|
-
* Creates a stream that emits void
|
|
342
|
+
* Creates a stream that emits `void` immediately once, then emits another
|
|
343
|
+
* `void` after each specified interval.
|
|
344
|
+
*
|
|
345
|
+
* **Example** (Emitting ticks on an interval)
|
|
294
346
|
*
|
|
295
|
-
* @example
|
|
296
347
|
* ```ts
|
|
297
348
|
* import { Console, Effect, Stream } from "effect"
|
|
298
349
|
*
|
|
@@ -308,8 +359,8 @@ export const fromEffectSchedule = (effect, schedule) => fromPull(Effect.gen(func
|
|
|
308
359
|
* // Output: [ undefined, undefined, undefined ]
|
|
309
360
|
* ```
|
|
310
361
|
*
|
|
311
|
-
* @since 2.0.0
|
|
312
362
|
* @category Constructors
|
|
363
|
+
* @since 2.0.0
|
|
313
364
|
*/
|
|
314
365
|
export const tick = interval => fromPull(Effect.sync(() => {
|
|
315
366
|
let first = true;
|
|
@@ -329,7 +380,8 @@ export const tick = interval => fromPull(Effect.sync(() => {
|
|
|
329
380
|
* A pull effect yields chunks on demand and completes when the upstream stream ends.
|
|
330
381
|
* See `Stream.toPull` for a matching producer.
|
|
331
382
|
*
|
|
332
|
-
*
|
|
383
|
+
* **Example** (Creating a stream from a pull effect)
|
|
384
|
+
*
|
|
333
385
|
* ```ts
|
|
334
386
|
* import { Console, Effect, Stream } from "effect"
|
|
335
387
|
*
|
|
@@ -347,14 +399,15 @@ export const tick = interval => fromPull(Effect.sync(() => {
|
|
|
347
399
|
* // Output: [1, 2, 3]
|
|
348
400
|
* ```
|
|
349
401
|
*
|
|
350
|
-
* @since 2.0.0
|
|
351
402
|
* @category Constructors
|
|
403
|
+
* @since 2.0.0
|
|
352
404
|
*/
|
|
353
405
|
export const fromPull = pull => fromChannel(Channel.fromPull(pull));
|
|
354
406
|
/**
|
|
355
407
|
* Derive a stream by transforming its pull effect.
|
|
356
408
|
*
|
|
357
|
-
*
|
|
409
|
+
* **Example** (Transforming a pull effect)
|
|
410
|
+
*
|
|
358
411
|
* ```ts
|
|
359
412
|
* import { Console, Effect, Stream } from "effect"
|
|
360
413
|
*
|
|
@@ -371,8 +424,8 @@ export const fromPull = pull => fromChannel(Channel.fromPull(pull));
|
|
|
371
424
|
* // Output: [ 1, 2, 3 ]
|
|
372
425
|
* ```
|
|
373
426
|
*
|
|
374
|
-
* @since 4.0.0
|
|
375
427
|
* @category Constructors
|
|
428
|
+
* @since 4.0.0
|
|
376
429
|
*/
|
|
377
430
|
export const transformPull = (self, f) => fromChannel(Channel.fromTransform((_, scope) => Effect.flatMap(Channel.toPullScoped(self.channel, scope), pull => f(pull, scope))));
|
|
378
431
|
/**
|
|
@@ -381,7 +434,8 @@ export const transformPull = (self, f) => fromChannel(Channel.fromTransform((_,
|
|
|
381
434
|
* A forked scope is also provided to the transformation function, which is
|
|
382
435
|
* closed once the resulting stream has finished processing.
|
|
383
436
|
*
|
|
384
|
-
*
|
|
437
|
+
* **Example** (Transforming a stream by effectfully transforming its pull effect)
|
|
438
|
+
*
|
|
385
439
|
* ```ts
|
|
386
440
|
* import { Console, Effect, Scope, Stream } from "effect"
|
|
387
441
|
*
|
|
@@ -406,14 +460,15 @@ export const transformPull = (self, f) => fromChannel(Channel.fromTransform((_,
|
|
|
406
460
|
* // Releasing scope
|
|
407
461
|
* ```
|
|
408
462
|
*
|
|
409
|
-
* @since 4.0.0
|
|
410
463
|
* @category Constructors
|
|
464
|
+
* @since 4.0.0
|
|
411
465
|
*/
|
|
412
466
|
export const transformPullBracket = (self, f) => fromChannel(Channel.fromTransformBracket((_, scope, forkedScope) => Effect.flatMap(Channel.toPullScoped(self.channel, scope), pull => f(pull, scope, forkedScope))));
|
|
413
467
|
/**
|
|
414
468
|
* Creates a channel from a stream.
|
|
415
469
|
*
|
|
416
|
-
*
|
|
470
|
+
* **Example** (Converting a stream to a channel)
|
|
471
|
+
*
|
|
417
472
|
* ```ts
|
|
418
473
|
* import { Channel, Console, Effect, Stream } from "effect"
|
|
419
474
|
*
|
|
@@ -428,8 +483,8 @@ export const transformPullBracket = (self, f) => fromChannel(Channel.fromTransfo
|
|
|
428
483
|
* // Output: [ 1, 2, 3 ]
|
|
429
484
|
* ```
|
|
430
485
|
*
|
|
431
|
-
* @since 2.0.0
|
|
432
486
|
* @category Constructors
|
|
487
|
+
* @since 2.0.0
|
|
433
488
|
*/
|
|
434
489
|
export const toChannel = stream => stream.channel;
|
|
435
490
|
/**
|
|
@@ -451,7 +506,8 @@ export const toChannel = stream => stream.channel;
|
|
|
451
506
|
* - `Stream.asyncPush`
|
|
452
507
|
* - `Stream.asyncScoped`
|
|
453
508
|
*
|
|
454
|
-
*
|
|
509
|
+
* **Example** (Creating a stream from a callback that can emit values into a queue)
|
|
510
|
+
*
|
|
455
511
|
* ```ts
|
|
456
512
|
* import { Console, Effect, Queue, Stream } from "effect"
|
|
457
513
|
*
|
|
@@ -475,14 +531,15 @@ export const toChannel = stream => stream.channel;
|
|
|
475
531
|
* Effect.runPromise(program)
|
|
476
532
|
* ```
|
|
477
533
|
*
|
|
478
|
-
* @since 2.0.0
|
|
479
534
|
* @category Constructors
|
|
535
|
+
* @since 2.0.0
|
|
480
536
|
*/
|
|
481
537
|
export const callback = (f, options) => fromChannel(Channel.callbackArray(f, options));
|
|
482
538
|
/**
|
|
483
539
|
* Creates an empty stream.
|
|
484
540
|
*
|
|
485
|
-
*
|
|
541
|
+
* **Example** (Creating an empty stream)
|
|
542
|
+
*
|
|
486
543
|
* ```ts
|
|
487
544
|
* import { Console, Effect, Stream } from "effect"
|
|
488
545
|
*
|
|
@@ -495,14 +552,15 @@ export const callback = (f, options) => fromChannel(Channel.callbackArray(f, opt
|
|
|
495
552
|
* // []
|
|
496
553
|
* ```
|
|
497
554
|
*
|
|
498
|
-
* @since 4.0.0
|
|
499
555
|
* @category Constructors
|
|
556
|
+
* @since 4.0.0
|
|
500
557
|
*/
|
|
501
558
|
export const empty = /*#__PURE__*/fromChannel(Channel.empty);
|
|
502
559
|
/**
|
|
503
560
|
* Creates a single-valued pure stream.
|
|
504
561
|
*
|
|
505
|
-
*
|
|
562
|
+
* **Example** (Creating a single-valued pure stream)
|
|
563
|
+
*
|
|
506
564
|
* ```ts
|
|
507
565
|
* import { Console, Effect, Stream } from "effect"
|
|
508
566
|
*
|
|
@@ -515,14 +573,15 @@ export const empty = /*#__PURE__*/fromChannel(Channel.empty);
|
|
|
515
573
|
* // [ 3 ]
|
|
516
574
|
* ```
|
|
517
575
|
*
|
|
518
|
-
* @since 2.0.0
|
|
519
576
|
* @category Constructors
|
|
577
|
+
* @since 2.0.0
|
|
520
578
|
*/
|
|
521
579
|
export const succeed = value => fromChannel(Channel.succeed(Arr.of(value)));
|
|
522
580
|
/**
|
|
523
581
|
* Creates a stream from a sequence of values.
|
|
524
582
|
*
|
|
525
|
-
*
|
|
583
|
+
* **Example** (Creating a stream from a sequence of values)
|
|
584
|
+
*
|
|
526
585
|
* ```ts
|
|
527
586
|
* import { Console, Effect, Stream } from "effect"
|
|
528
587
|
*
|
|
@@ -536,8 +595,8 @@ export const succeed = value => fromChannel(Channel.succeed(Arr.of(value)));
|
|
|
536
595
|
* Effect.runPromise(program)
|
|
537
596
|
* ```
|
|
538
597
|
*
|
|
539
|
-
* @since 2.0.0
|
|
540
598
|
* @category Constructors
|
|
599
|
+
* @since 2.0.0
|
|
541
600
|
*/
|
|
542
601
|
export const make = (...values) => fromArray(values);
|
|
543
602
|
/**
|
|
@@ -545,7 +604,8 @@ export const make = (...values) => fromArray(values);
|
|
|
545
604
|
*
|
|
546
605
|
* The function is evaluated each time the stream is run.
|
|
547
606
|
*
|
|
548
|
-
*
|
|
607
|
+
* **Example** (Evaluating a value synchronously)
|
|
608
|
+
*
|
|
549
609
|
* ```ts
|
|
550
610
|
* import { Console, Effect, Stream } from "effect"
|
|
551
611
|
*
|
|
@@ -558,8 +618,8 @@ export const make = (...values) => fromArray(values);
|
|
|
558
618
|
* // Output: [ 3 ]
|
|
559
619
|
* ```
|
|
560
620
|
*
|
|
561
|
-
* @since 2.0.0
|
|
562
621
|
* @category Constructors
|
|
622
|
+
* @since 2.0.0
|
|
563
623
|
*/
|
|
564
624
|
export const sync = evaluate => fromChannel(Channel.sync(() => Arr.of(evaluate())));
|
|
565
625
|
/**
|
|
@@ -567,7 +627,8 @@ export const sync = evaluate => fromChannel(Channel.sync(() => Arr.of(evaluate()
|
|
|
567
627
|
*
|
|
568
628
|
* The stream factory is evaluated each time the stream is run.
|
|
569
629
|
*
|
|
570
|
-
*
|
|
630
|
+
* **Example** (Creating a lazily constructed stream)
|
|
631
|
+
*
|
|
571
632
|
* ```ts
|
|
572
633
|
* import { Console, Effect, Stream } from "effect"
|
|
573
634
|
*
|
|
@@ -580,14 +641,15 @@ export const sync = evaluate => fromChannel(Channel.sync(() => Arr.of(evaluate()
|
|
|
580
641
|
* // Output: [ 1, 2, 3 ]
|
|
581
642
|
* ```
|
|
582
643
|
*
|
|
583
|
-
* @since 2.0.0
|
|
584
644
|
* @category Constructors
|
|
645
|
+
* @since 2.0.0
|
|
585
646
|
*/
|
|
586
647
|
export const suspend = stream => fromChannel(Channel.suspend(() => stream().channel));
|
|
587
648
|
/**
|
|
588
649
|
* Terminates with the specified error.
|
|
589
650
|
*
|
|
590
|
-
*
|
|
651
|
+
* **Example** (Failing a stream)
|
|
652
|
+
*
|
|
591
653
|
* ```ts
|
|
592
654
|
* import { Console, Effect, Stream } from "effect"
|
|
593
655
|
*
|
|
@@ -601,14 +663,15 @@ export const suspend = stream => fromChannel(Channel.suspend(() => stream().chan
|
|
|
601
663
|
* Effect.runPromise(program)
|
|
602
664
|
* ```
|
|
603
665
|
*
|
|
604
|
-
* @since 2.0.0
|
|
605
666
|
* @category Constructors
|
|
667
|
+
* @since 2.0.0
|
|
606
668
|
*/
|
|
607
669
|
export const fail = error => fromChannel(Channel.fail(error));
|
|
608
670
|
/**
|
|
609
671
|
* Terminates with the specified lazily evaluated error.
|
|
610
672
|
*
|
|
611
|
-
*
|
|
673
|
+
* **Example** (Failing a stream lazily)
|
|
674
|
+
*
|
|
612
675
|
* ```ts
|
|
613
676
|
* import { Console, Effect, Stream } from "effect"
|
|
614
677
|
*
|
|
@@ -624,14 +687,15 @@ export const fail = error => fromChannel(Channel.fail(error));
|
|
|
624
687
|
* // { _id: 'Exit', _tag: 'Failure', cause: { _id: 'Cause', _tag: 'Fail', failure: 'Uh oh!' } }
|
|
625
688
|
* ```
|
|
626
689
|
*
|
|
627
|
-
* @since 2.0.0
|
|
628
690
|
* @category Constructors
|
|
691
|
+
* @since 2.0.0
|
|
629
692
|
*/
|
|
630
693
|
export const failSync = evaluate => fromChannel(Channel.failSync(evaluate));
|
|
631
694
|
/**
|
|
632
695
|
* Creates a stream that fails with the specified `Cause`.
|
|
633
696
|
*
|
|
634
|
-
*
|
|
697
|
+
* **Example** (Failing with a cause)
|
|
698
|
+
*
|
|
635
699
|
* ```ts
|
|
636
700
|
* import { Cause, Console, Effect, Stream } from "effect"
|
|
637
701
|
*
|
|
@@ -648,14 +712,15 @@ export const failSync = evaluate => fromChannel(Channel.failSync(evaluate));
|
|
|
648
712
|
* Effect.runPromise(program)
|
|
649
713
|
* ```
|
|
650
714
|
*
|
|
651
|
-
* @since 2.0.0
|
|
652
715
|
* @category Constructors
|
|
716
|
+
* @since 2.0.0
|
|
653
717
|
*/
|
|
654
718
|
export const failCause = cause => fromChannel(Channel.failCause(cause));
|
|
655
719
|
/**
|
|
656
720
|
* The stream that dies with the specified defect.
|
|
657
721
|
*
|
|
658
|
-
*
|
|
722
|
+
* **Example** (Dying with a defect)
|
|
723
|
+
*
|
|
659
724
|
* ```ts
|
|
660
725
|
* import { Cause, Console, Effect, Exit, Stream } from "effect"
|
|
661
726
|
*
|
|
@@ -679,14 +744,15 @@ export const failCause = cause => fromChannel(Channel.failCause(cause));
|
|
|
679
744
|
* // Output: Exit.Failure(Error: Boom)
|
|
680
745
|
* ```
|
|
681
746
|
*
|
|
682
|
-
* @since 2.0.0
|
|
683
747
|
* @category Constructors
|
|
748
|
+
* @since 2.0.0
|
|
684
749
|
*/
|
|
685
750
|
export const die = defect => fromChannel(Channel.die(defect));
|
|
686
751
|
/**
|
|
687
752
|
* The stream that always fails with the specified lazily evaluated `Cause`.
|
|
688
753
|
*
|
|
689
|
-
*
|
|
754
|
+
* **Example** (Failing with a lazy cause)
|
|
755
|
+
*
|
|
690
756
|
* ```ts
|
|
691
757
|
* import { Cause, Console, Effect, Stream } from "effect"
|
|
692
758
|
*
|
|
@@ -704,8 +770,8 @@ export const die = defect => fromChannel(Channel.die(defect));
|
|
|
704
770
|
* // { _id: 'Exit', _tag: 'Failure', cause: { _id: 'Cause', _tag: 'Fail', failure: 'Connection timeout after retries' } }
|
|
705
771
|
* ```
|
|
706
772
|
*
|
|
707
|
-
* @since 2.0.0
|
|
708
773
|
* @category Constructors
|
|
774
|
+
* @since 2.0.0
|
|
709
775
|
*/
|
|
710
776
|
export const failCauseSync = evaluate => fromChannel(Channel.failCauseSync(evaluate));
|
|
711
777
|
/**
|
|
@@ -713,7 +779,8 @@ export const failCauseSync = evaluate => fromChannel(Channel.failCauseSync(evalu
|
|
|
713
779
|
*
|
|
714
780
|
* The `maxChunkSize` parameter controls how many values are pulled per chunk.
|
|
715
781
|
*
|
|
716
|
-
*
|
|
782
|
+
* **Example** (Consuming values from an iterator)
|
|
783
|
+
*
|
|
717
784
|
* ```ts
|
|
718
785
|
* import { Console, Effect, Stream } from "effect"
|
|
719
786
|
*
|
|
@@ -734,8 +801,8 @@ export const failCauseSync = evaluate => fromChannel(Channel.failCauseSync(evalu
|
|
|
734
801
|
* // Output: [ 1, 2, 3 ]
|
|
735
802
|
* ```
|
|
736
803
|
*
|
|
737
|
-
* @since 2.0.0
|
|
738
804
|
* @category Constructors
|
|
805
|
+
* @since 2.0.0
|
|
739
806
|
*/
|
|
740
807
|
export const fromIteratorSucceed = (iterator, maxChunkSize) => fromChannel(Channel.fromIteratorArray(() => iterator, maxChunkSize));
|
|
741
808
|
/**
|
|
@@ -745,7 +812,8 @@ export const fromIteratorSucceed = (iterator, maxChunkSize) => fromChannel(Chann
|
|
|
745
812
|
*
|
|
746
813
|
* - `chunkSize`: Maximum number of values emitted per chunk.
|
|
747
814
|
*
|
|
748
|
-
*
|
|
815
|
+
* **Example** (Creating a stream from an iterable)
|
|
816
|
+
*
|
|
749
817
|
* ```ts
|
|
750
818
|
* import { Console, Effect, Stream } from "effect"
|
|
751
819
|
*
|
|
@@ -761,14 +829,15 @@ export const fromIteratorSucceed = (iterator, maxChunkSize) => fromChannel(Chann
|
|
|
761
829
|
* // Output: [ 1, 2, 3 ]
|
|
762
830
|
* ```
|
|
763
831
|
*
|
|
764
|
-
* @since 2.0.0
|
|
765
832
|
* @category Constructors
|
|
833
|
+
* @since 2.0.0
|
|
766
834
|
*/
|
|
767
835
|
export const fromIterable = (iterable, options) => Array.isArray(iterable) && options?.chunkSize === undefined ? fromArray(iterable) : fromChannel(Channel.fromIterableArray(iterable, options?.chunkSize));
|
|
768
836
|
/**
|
|
769
837
|
* Creates a stream from an effect producing an iterable of values.
|
|
770
838
|
*
|
|
771
|
-
*
|
|
839
|
+
* **Example** (Creating a stream from an iterable effect)
|
|
840
|
+
*
|
|
772
841
|
* ```ts
|
|
773
842
|
* import { Console, Effect, Context, Stream } from "effect"
|
|
774
843
|
*
|
|
@@ -796,8 +865,8 @@ export const fromIterable = (iterable, options) => Array.isArray(iterable) && op
|
|
|
796
865
|
* // Output: [ "user1", "user2" ]
|
|
797
866
|
* ```
|
|
798
867
|
*
|
|
799
|
-
* @since 2.0.0
|
|
800
868
|
* @category Constructors
|
|
869
|
+
* @since 2.0.0
|
|
801
870
|
*/
|
|
802
871
|
export const fromIterableEffect = iterable => unwrap(Effect.map(iterable, fromIterable));
|
|
803
872
|
/**
|
|
@@ -809,7 +878,8 @@ export const fromIterableEffect = iterable => unwrap(Effect.map(iterable, fromIt
|
|
|
809
878
|
*
|
|
810
879
|
* - `Stream.repeatEffectChunk`
|
|
811
880
|
*
|
|
812
|
-
*
|
|
881
|
+
* **Example** (Repeating an iterable effect)
|
|
882
|
+
*
|
|
813
883
|
* ```ts
|
|
814
884
|
* import { Console, Effect, Stream } from "effect"
|
|
815
885
|
*
|
|
@@ -825,8 +895,8 @@ export const fromIterableEffect = iterable => unwrap(Effect.map(iterable, fromIt
|
|
|
825
895
|
* // Output: [ 1, 2, 1, 2, 1 ]
|
|
826
896
|
* ```
|
|
827
897
|
*
|
|
828
|
-
* @since 4.0.0
|
|
829
898
|
* @category Constructors
|
|
899
|
+
* @since 4.0.0
|
|
830
900
|
*/
|
|
831
901
|
export const fromIterableEffectRepeat = iterable => flatMap(fromEffectRepeat(iterable), fromIterable);
|
|
832
902
|
/**
|
|
@@ -838,7 +908,8 @@ export const fromIterableEffectRepeat = iterable => flatMap(fromEffectRepeat(ite
|
|
|
838
908
|
*
|
|
839
909
|
* - `Stream.fromChunk`
|
|
840
910
|
*
|
|
841
|
-
*
|
|
911
|
+
* **Example** (Creating a stream from an array of values)
|
|
912
|
+
*
|
|
842
913
|
* ```ts
|
|
843
914
|
* import { Console, Effect, Stream } from "effect"
|
|
844
915
|
*
|
|
@@ -852,14 +923,15 @@ export const fromIterableEffectRepeat = iterable => flatMap(fromEffectRepeat(ite
|
|
|
852
923
|
* // Output: [ 1, 2, 3 ]
|
|
853
924
|
* ```
|
|
854
925
|
*
|
|
855
|
-
* @since 4.0.0
|
|
856
926
|
* @category Constructors
|
|
927
|
+
* @since 4.0.0
|
|
857
928
|
*/
|
|
858
929
|
export const fromArray = array => Arr.isReadonlyArrayNonEmpty(array) ? fromChannel(Channel.succeed(array)) : empty;
|
|
859
930
|
/**
|
|
860
931
|
* Creates a stream from an effect that produces an array of values.
|
|
861
932
|
*
|
|
862
|
-
*
|
|
933
|
+
* **Example** (Creating a stream from an effect that produces an array of values)
|
|
934
|
+
*
|
|
863
935
|
* ```ts
|
|
864
936
|
* import { Console, Effect, Stream } from "effect"
|
|
865
937
|
*
|
|
@@ -873,8 +945,8 @@ export const fromArray = array => Arr.isReadonlyArrayNonEmpty(array) ? fromChann
|
|
|
873
945
|
* // Output: [ "Ada", "Grace" ]
|
|
874
946
|
* ```
|
|
875
947
|
*
|
|
876
|
-
* @since 4.0.0
|
|
877
948
|
* @category Constructors
|
|
949
|
+
* @since 4.0.0
|
|
878
950
|
*/
|
|
879
951
|
export const fromArrayEffect = effect => unwrap(Effect.map(effect, fromArray));
|
|
880
952
|
/**
|
|
@@ -886,7 +958,8 @@ export const fromArrayEffect = effect => unwrap(Effect.map(effect, fromArray));
|
|
|
886
958
|
*
|
|
887
959
|
* - `Stream.fromChunks`
|
|
888
960
|
*
|
|
889
|
-
*
|
|
961
|
+
* **Example** (Creating a stream from an arbitrary number of arrays)
|
|
962
|
+
*
|
|
890
963
|
* ```ts
|
|
891
964
|
* import { Console, Effect, Stream } from "effect"
|
|
892
965
|
*
|
|
@@ -900,19 +973,18 @@ export const fromArrayEffect = effect => unwrap(Effect.map(effect, fromArray));
|
|
|
900
973
|
* // Output: [ 1, 2, 3, 4 ]
|
|
901
974
|
* ```
|
|
902
975
|
*
|
|
903
|
-
* @since 4.0.0
|
|
904
976
|
* @category Constructors
|
|
977
|
+
* @since 4.0.0
|
|
905
978
|
*/
|
|
906
979
|
export const fromArrays = (...arrays) => fromChannel(Channel.fromArray(Arr.filter(arrays, Arr.isReadonlyArrayNonEmpty)));
|
|
907
980
|
/**
|
|
908
|
-
* Creates a stream from a
|
|
981
|
+
* Creates a stream that pulls values from a `Queue.Dequeue`.
|
|
909
982
|
*
|
|
910
|
-
*
|
|
983
|
+
* The stream emits non-empty batches of queued values and ends when the queue
|
|
984
|
+
* fails with `Cause.Done`; other queue failures are propagated.
|
|
911
985
|
*
|
|
912
|
-
*
|
|
913
|
-
* - `shutdown`: If `true`, the queue will be shutdown after the stream is evaluated (defaults to `false`)
|
|
986
|
+
* **Example** (Creating a stream from a queue of values)
|
|
914
987
|
*
|
|
915
|
-
* @example
|
|
916
988
|
* ```ts
|
|
917
989
|
* import { Console, Effect, Queue, Stream } from "effect"
|
|
918
990
|
*
|
|
@@ -932,14 +1004,15 @@ export const fromArrays = (...arrays) => fromChannel(Channel.fromArray(Arr.filte
|
|
|
932
1004
|
* // Output: [ 1, 2, 3 ]
|
|
933
1005
|
* ```
|
|
934
1006
|
*
|
|
935
|
-
* @since 4.0.0
|
|
936
1007
|
* @category Constructors
|
|
1008
|
+
* @since 4.0.0
|
|
937
1009
|
*/
|
|
938
1010
|
export const fromQueue = queue => fromChannel(Channel.fromQueueArray(queue));
|
|
939
1011
|
/**
|
|
940
1012
|
* Creates a stream from a subscription to a `PubSub`.
|
|
941
1013
|
*
|
|
942
|
-
*
|
|
1014
|
+
* **Example** (Creating a stream from a subscription to a PubSub)
|
|
1015
|
+
*
|
|
943
1016
|
* ```ts
|
|
944
1017
|
* import { Console, Effect, Fiber, PubSub, Stream } from "effect"
|
|
945
1018
|
*
|
|
@@ -964,8 +1037,8 @@ export const fromQueue = queue => fromChannel(Channel.fromQueueArray(queue));
|
|
|
964
1037
|
* // Output: [ 1, 2, 3 ]
|
|
965
1038
|
* ```
|
|
966
1039
|
*
|
|
967
|
-
* @since 4.0.0
|
|
968
1040
|
* @category Constructors
|
|
1041
|
+
* @since 4.0.0
|
|
969
1042
|
*/
|
|
970
1043
|
export const fromPubSub = pubsub => fromChannel(Channel.fromPubSubArray(pubsub));
|
|
971
1044
|
/**
|
|
@@ -973,7 +1046,8 @@ export const fromPubSub = pubsub => fromChannel(Channel.fromPubSubArray(pubsub))
|
|
|
973
1046
|
*
|
|
974
1047
|
* `Take` values include end and failure signals.
|
|
975
1048
|
*
|
|
976
|
-
*
|
|
1049
|
+
* **Example** (Creating a stream from PubSub takes)
|
|
1050
|
+
*
|
|
977
1051
|
* ```ts
|
|
978
1052
|
* import { Console, Effect, Exit, PubSub, Stream, Take } from "effect"
|
|
979
1053
|
*
|
|
@@ -994,16 +1068,19 @@ export const fromPubSub = pubsub => fromChannel(Channel.fromPubSubArray(pubsub))
|
|
|
994
1068
|
* // Output: [ 1, 2 ]
|
|
995
1069
|
* ```
|
|
996
1070
|
*
|
|
997
|
-
* @since 4.0.0
|
|
998
1071
|
* @category Constructors
|
|
1072
|
+
* @since 4.0.0
|
|
999
1073
|
*/
|
|
1000
1074
|
export const fromPubSubTake = pubsub => fromChannel(Channel.fromPubSubTake(pubsub));
|
|
1001
1075
|
/**
|
|
1002
|
-
* Creates a stream from a `ReadableStream`.
|
|
1076
|
+
* Creates a stream from a lazily supplied Web `ReadableStream`.
|
|
1003
1077
|
*
|
|
1004
|
-
*
|
|
1078
|
+
* The stream reads from a `ReadableStreamDefaultReader`, maps read failures
|
|
1079
|
+
* with `onError`, and closes the reader when the stream finalizes. By default
|
|
1080
|
+
* the reader is canceled; set `releaseLockOnEnd` to release the lock instead.
|
|
1081
|
+
*
|
|
1082
|
+
* **Example** (Creating a stream from a ReadableStream)
|
|
1005
1083
|
*
|
|
1006
|
-
* @example
|
|
1007
1084
|
* ```ts
|
|
1008
1085
|
* import { Console, Data, Effect, Stream } from "effect"
|
|
1009
1086
|
*
|
|
@@ -1031,8 +1108,8 @@ export const fromPubSubTake = pubsub => fromChannel(Channel.fromPubSubTake(pubsu
|
|
|
1031
1108
|
* // Output: [ 1, 2, 3 ]
|
|
1032
1109
|
* ```
|
|
1033
1110
|
*
|
|
1034
|
-
* @since 2.0.0
|
|
1035
1111
|
* @category Constructors
|
|
1112
|
+
* @since 2.0.0
|
|
1036
1113
|
*/
|
|
1037
1114
|
export const fromReadableStream = options => fromChannel(Channel.fromTransform(Effect.fnUntraced(function* (_, scope) {
|
|
1038
1115
|
const reader = options.evaluate().getReader();
|
|
@@ -1048,9 +1125,10 @@ export const fromReadableStream = options => fromChannel(Channel.fromTransform(E
|
|
|
1048
1125
|
/**
|
|
1049
1126
|
* Creates a stream from an AsyncIterable.
|
|
1050
1127
|
*
|
|
1051
|
-
*
|
|
1128
|
+
* **Example** (Creating a stream from an AsyncIterable)
|
|
1129
|
+
*
|
|
1052
1130
|
* ```ts
|
|
1053
|
-
* import {
|
|
1131
|
+
* import { Data, Effect, Stream } from "effect"
|
|
1054
1132
|
*
|
|
1055
1133
|
* class StreamError extends Data.TaggedError("StreamError")<{ readonly cause: unknown }> {}
|
|
1056
1134
|
*
|
|
@@ -1060,25 +1138,25 @@ export const fromReadableStream = options => fromChannel(Channel.fromTransform(E
|
|
|
1060
1138
|
* yield 3
|
|
1061
1139
|
* })()
|
|
1062
1140
|
*
|
|
1063
|
-
*
|
|
1141
|
+
* Effect.runPromise(Effect.gen(function*() {
|
|
1064
1142
|
* const stream = Stream.fromAsyncIterable(iterable, (cause) => new StreamError({ cause }))
|
|
1065
1143
|
* const values = yield* Stream.runCollect(stream)
|
|
1066
|
-
* yield*
|
|
1067
|
-
* })
|
|
1144
|
+
* yield* Effect.sync(() => console.log(values))
|
|
1145
|
+
* }))
|
|
1068
1146
|
*
|
|
1069
|
-
*
|
|
1070
|
-
* // Output: [ 1, 2, 3 ]
|
|
1147
|
+
* // [ 1, 2, 3 ]
|
|
1071
1148
|
* ```
|
|
1072
1149
|
*
|
|
1073
|
-
* @since 2.0.0
|
|
1074
1150
|
* @category Constructors
|
|
1151
|
+
* @since 2.0.0
|
|
1075
1152
|
*/
|
|
1076
1153
|
export const fromAsyncIterable = (iterable, onError) => fromChannel(Channel.fromAsyncIterableArray(iterable, onError));
|
|
1077
1154
|
/**
|
|
1078
1155
|
* Creates a stream that emits each output of a schedule that does not require input,
|
|
1079
1156
|
* for as long as the schedule continues.
|
|
1080
1157
|
*
|
|
1081
|
-
*
|
|
1158
|
+
* **Example** (Creating a stream from a schedule)
|
|
1159
|
+
*
|
|
1082
1160
|
* ```ts
|
|
1083
1161
|
* import { Console, Effect, Schedule, Stream } from "effect"
|
|
1084
1162
|
*
|
|
@@ -1095,8 +1173,8 @@ export const fromAsyncIterable = (iterable, onError) => fromChannel(Channel.from
|
|
|
1095
1173
|
* // Output: [ 0, 1, 2 ]
|
|
1096
1174
|
* ```
|
|
1097
1175
|
*
|
|
1098
|
-
* @since 2.0.0
|
|
1099
1176
|
* @category Constructors
|
|
1177
|
+
* @since 2.0.0
|
|
1100
1178
|
*/
|
|
1101
1179
|
export const fromSchedule = schedule => fromPull(Effect.map(Schedule.toStepWithSleep(schedule), step => Pull.catchDone(Effect.map(step(void 0), Arr.of), () => Cause.done())));
|
|
1102
1180
|
/**
|
|
@@ -1105,7 +1183,8 @@ export const fromSchedule = schedule => fromPull(Effect.map(Schedule.toStepWithS
|
|
|
1105
1183
|
* Use `PubSub.subscribe` to create the subscription and `Stream.take` or
|
|
1106
1184
|
* cancellation to control how many values are consumed.
|
|
1107
1185
|
*
|
|
1108
|
-
*
|
|
1186
|
+
* **Example** (Creating a stream from a PubSub subscription)
|
|
1187
|
+
*
|
|
1109
1188
|
* ```ts
|
|
1110
1189
|
* import { Console, Effect, PubSub, Stream } from "effect"
|
|
1111
1190
|
*
|
|
@@ -1125,33 +1204,42 @@ export const fromSchedule = schedule => fromPull(Effect.map(Schedule.toStepWithS
|
|
|
1125
1204
|
* // Output: [ 1, 2 ]
|
|
1126
1205
|
* ```
|
|
1127
1206
|
*
|
|
1128
|
-
* @since 4.0.0
|
|
1129
1207
|
* @category Constructors
|
|
1208
|
+
* @since 4.0.0
|
|
1130
1209
|
*/
|
|
1131
1210
|
export const fromSubscription = pubsub => fromChannel(Channel.fromSubscriptionArray(pubsub));
|
|
1132
1211
|
/**
|
|
1133
1212
|
* Creates a stream from an event listener.
|
|
1134
1213
|
*
|
|
1135
|
-
*
|
|
1214
|
+
* **Example** (Creating a stream from an event listener)
|
|
1215
|
+
*
|
|
1136
1216
|
* ```ts
|
|
1137
|
-
* import {
|
|
1217
|
+
* import { Effect, Stream } from "effect"
|
|
1138
1218
|
*
|
|
1139
|
-
*
|
|
1219
|
+
* class NumberTarget implements Stream.EventListener<number> {
|
|
1220
|
+
* addEventListener(event: string, f: (event: number) => void) {
|
|
1221
|
+
* if (event === "data") {
|
|
1222
|
+
* f(1)
|
|
1223
|
+
* f(2)
|
|
1224
|
+
* f(3)
|
|
1225
|
+
* }
|
|
1226
|
+
* }
|
|
1227
|
+
* removeEventListener(_event: string, _f: (event: number) => void) {}
|
|
1228
|
+
* }
|
|
1140
1229
|
*
|
|
1141
|
-
*
|
|
1142
|
-
* const stream = Stream.fromEventListener(
|
|
1230
|
+
* Effect.runPromise(Effect.gen(function*() {
|
|
1231
|
+
* const stream = Stream.fromEventListener(new NumberTarget(), "data").pipe(
|
|
1143
1232
|
* Stream.take(3)
|
|
1144
1233
|
* )
|
|
1145
1234
|
* const values = yield* Stream.runCollect(stream)
|
|
1146
|
-
* yield*
|
|
1147
|
-
* })
|
|
1235
|
+
* yield* Effect.sync(() => console.log(values))
|
|
1236
|
+
* }))
|
|
1148
1237
|
*
|
|
1149
|
-
*
|
|
1150
|
-
* // Output: [ 1, 2, 3 ]
|
|
1238
|
+
* // [ 1, 2, 3 ]
|
|
1151
1239
|
* ```
|
|
1152
1240
|
*
|
|
1153
|
-
* @since 3.1.0
|
|
1154
1241
|
* @category Constructors
|
|
1242
|
+
* @since 3.1.0
|
|
1155
1243
|
*/
|
|
1156
1244
|
export const fromEventListener = (target, type, options) => callback(queue => {
|
|
1157
1245
|
function emit(event) {
|
|
@@ -1162,9 +1250,14 @@ export const fromEventListener = (target, type, options) => callback(queue => {
|
|
|
1162
1250
|
bufferSize: typeof options === "object" ? options.bufferSize : undefined
|
|
1163
1251
|
});
|
|
1164
1252
|
/**
|
|
1165
|
-
* Creates a stream by
|
|
1253
|
+
* Creates a stream by repeatedly applying an effectful step function to a
|
|
1254
|
+
* state.
|
|
1255
|
+
*
|
|
1256
|
+
* Each `readonly [value, nextState]` result emits `value` and continues with
|
|
1257
|
+
* `nextState`; returning `undefined` ends the stream.
|
|
1258
|
+
*
|
|
1259
|
+
* **Example** (Unfolding stream state)
|
|
1166
1260
|
*
|
|
1167
|
-
* @example
|
|
1168
1261
|
* ```ts
|
|
1169
1262
|
* import { Console, Effect, Stream } from "effect"
|
|
1170
1263
|
*
|
|
@@ -1178,8 +1271,8 @@ export const fromEventListener = (target, type, options) => callback(queue => {
|
|
|
1178
1271
|
* // Output: [ 1, 2, 3, 4, 5 ]
|
|
1179
1272
|
* ```
|
|
1180
1273
|
*
|
|
1181
|
-
* @since 2.0.0
|
|
1182
1274
|
* @category Constructors
|
|
1275
|
+
* @since 2.0.0
|
|
1183
1276
|
*/
|
|
1184
1277
|
export const unfold = (s, f) => fromPull(Effect.sync(() => {
|
|
1185
1278
|
let state = s;
|
|
@@ -1194,7 +1287,8 @@ export const unfold = (s, f) => fromPull(Effect.sync(() => {
|
|
|
1194
1287
|
* than the unfolding of the state. This is useful for embedding paginated APIs,
|
|
1195
1288
|
* hence the name.
|
|
1196
1289
|
*
|
|
1197
|
-
*
|
|
1290
|
+
* **Example** (Paginating stream state)
|
|
1291
|
+
*
|
|
1198
1292
|
* ```ts
|
|
1199
1293
|
* import { Console, Effect, Stream } from "effect"
|
|
1200
1294
|
* import * as Option from "effect/Option"
|
|
@@ -1211,8 +1305,8 @@ export const unfold = (s, f) => fromPull(Effect.sync(() => {
|
|
|
1211
1305
|
* // Output: [ 0, 1, 2, 3 ]
|
|
1212
1306
|
* ```
|
|
1213
1307
|
*
|
|
1214
|
-
* @since 2.0.0
|
|
1215
1308
|
* @category Constructors
|
|
1309
|
+
* @since 2.0.0
|
|
1216
1310
|
*/
|
|
1217
1311
|
export const paginate = (s, f) => fromPull(Effect.sync(() => {
|
|
1218
1312
|
let state = s;
|
|
@@ -1233,7 +1327,8 @@ export const paginate = (s, f) => fromPull(Effect.sync(() => {
|
|
|
1233
1327
|
/**
|
|
1234
1328
|
* Creates an infinite stream by repeatedly applying a function to a seed value.
|
|
1235
1329
|
*
|
|
1236
|
-
*
|
|
1330
|
+
* **Example** (Iterating from a seed value)
|
|
1331
|
+
*
|
|
1237
1332
|
* ```ts
|
|
1238
1333
|
* import { Console, Effect, Stream } from "effect"
|
|
1239
1334
|
*
|
|
@@ -1248,8 +1343,8 @@ export const paginate = (s, f) => fromPull(Effect.sync(() => {
|
|
|
1248
1343
|
* // Output: [ 1, 2, 3 ]
|
|
1249
1344
|
* ```
|
|
1250
1345
|
*
|
|
1251
|
-
* @since 2.0.0
|
|
1252
1346
|
* @category Constructors
|
|
1347
|
+
* @since 2.0.0
|
|
1253
1348
|
*/
|
|
1254
1349
|
export const iterate = (value, next) => unfold(value, a => Effect.succeed([a, next(a)]));
|
|
1255
1350
|
/**
|
|
@@ -1258,7 +1353,8 @@ export const iterate = (value, next) => unfold(value, a => Effect.succeed([a, ne
|
|
|
1258
1353
|
* If the provided `min` is greater than `max`, the stream will not emit any
|
|
1259
1354
|
* values.
|
|
1260
1355
|
*
|
|
1261
|
-
*
|
|
1356
|
+
* **Example** (Creating a numeric range)
|
|
1357
|
+
*
|
|
1262
1358
|
* ```ts
|
|
1263
1359
|
* import { Console, Effect, Stream } from "effect"
|
|
1264
1360
|
*
|
|
@@ -1270,8 +1366,8 @@ export const iterate = (value, next) => unfold(value, a => Effect.succeed([a, ne
|
|
|
1270
1366
|
* Effect.runPromise(program)
|
|
1271
1367
|
* // Output: [ 1, 2, 3, 4, 5 ]
|
|
1272
1368
|
* ```
|
|
1273
|
-
* @since 4.0.0
|
|
1274
1369
|
* @category Constructors
|
|
1370
|
+
* @since 4.0.0
|
|
1275
1371
|
*/
|
|
1276
1372
|
export const range = (min, max, chunkSize = Channel.DefaultChunkSize) => min > max ? empty : fromPull(Effect.sync(() => {
|
|
1277
1373
|
let start = min;
|
|
@@ -1292,7 +1388,8 @@ export const range = (min, max, chunkSize = Channel.DefaultChunkSize) => min > m
|
|
|
1292
1388
|
/**
|
|
1293
1389
|
* The stream that never produces any value or fails with any error.
|
|
1294
1390
|
*
|
|
1295
|
-
*
|
|
1391
|
+
* **Example** (Creating a never-ending stream)
|
|
1392
|
+
*
|
|
1296
1393
|
* ```ts
|
|
1297
1394
|
* import { Effect, Stream } from "effect"
|
|
1298
1395
|
*
|
|
@@ -1305,14 +1402,15 @@ export const range = (min, max, chunkSize = Channel.DefaultChunkSize) => min > m
|
|
|
1305
1402
|
* // []
|
|
1306
1403
|
* ```
|
|
1307
1404
|
*
|
|
1308
|
-
* @since 4.0.0
|
|
1309
1405
|
* @category Constructors
|
|
1406
|
+
* @since 4.0.0
|
|
1310
1407
|
*/
|
|
1311
1408
|
export const never = /*#__PURE__*/fromChannel(Channel.never);
|
|
1312
1409
|
/**
|
|
1313
1410
|
* Creates a stream produced from an `Effect`.
|
|
1314
1411
|
*
|
|
1315
|
-
*
|
|
1412
|
+
* **Example** (Unwrapping a stream effect)
|
|
1413
|
+
*
|
|
1316
1414
|
* ```ts
|
|
1317
1415
|
* import { Console, Effect, Stream } from "effect"
|
|
1318
1416
|
*
|
|
@@ -1327,15 +1425,16 @@ export const never = /*#__PURE__*/fromChannel(Channel.never);
|
|
|
1327
1425
|
* // [1, 2, 3]
|
|
1328
1426
|
* ```
|
|
1329
1427
|
*
|
|
1330
|
-
* @since 2.0.0
|
|
1331
1428
|
* @category Constructors
|
|
1429
|
+
* @since 2.0.0
|
|
1332
1430
|
*/
|
|
1333
1431
|
export const unwrap = effect => fromChannel(Channel.unwrap(Effect.map(effect, toChannel)));
|
|
1334
1432
|
/**
|
|
1335
1433
|
* Runs a stream that requires `Scope` in a managed scope, ensuring its
|
|
1336
1434
|
* finalizers are run when the stream completes.
|
|
1337
1435
|
*
|
|
1338
|
-
*
|
|
1436
|
+
* **Example** (Scoping a stream)
|
|
1437
|
+
*
|
|
1339
1438
|
* ```ts
|
|
1340
1439
|
* import { Console, Effect, Stream } from "effect"
|
|
1341
1440
|
*
|
|
@@ -1354,14 +1453,15 @@ export const unwrap = effect => fromChannel(Channel.unwrap(Effect.map(effect, to
|
|
|
1354
1453
|
* // [ "resource" ]
|
|
1355
1454
|
* ```
|
|
1356
1455
|
*
|
|
1357
|
-
* @since 2.0.0
|
|
1358
1456
|
* @category Constructors
|
|
1457
|
+
* @since 2.0.0
|
|
1359
1458
|
*/
|
|
1360
1459
|
export const scoped = self => fromChannel(Channel.scoped(self.channel));
|
|
1361
1460
|
/**
|
|
1362
1461
|
* Transforms the elements of this stream using the supplied function.
|
|
1363
1462
|
*
|
|
1364
|
-
*
|
|
1463
|
+
* **Example** (Mapping stream values)
|
|
1464
|
+
*
|
|
1365
1465
|
* ```ts
|
|
1366
1466
|
* import { Console, Effect, Stream } from "effect"
|
|
1367
1467
|
*
|
|
@@ -1374,8 +1474,8 @@ export const scoped = self => fromChannel(Channel.scoped(self.channel));
|
|
|
1374
1474
|
* // [ 1, 3, 5 ]
|
|
1375
1475
|
* ```
|
|
1376
1476
|
*
|
|
1377
|
-
* @since 2.0.0
|
|
1378
1477
|
* @category Mapping
|
|
1478
|
+
* @since 2.0.0
|
|
1379
1479
|
*/
|
|
1380
1480
|
export const map = /*#__PURE__*/dual(2, (self, f) => suspend(() => {
|
|
1381
1481
|
let i = 0;
|
|
@@ -1384,7 +1484,8 @@ export const map = /*#__PURE__*/dual(2, (self, f) => suspend(() => {
|
|
|
1384
1484
|
/**
|
|
1385
1485
|
* Maps both the failure and success channels of a stream.
|
|
1386
1486
|
*
|
|
1387
|
-
*
|
|
1487
|
+
* **Example** (Mapping both the failure and success channels of a stream)
|
|
1488
|
+
*
|
|
1388
1489
|
* ```ts
|
|
1389
1490
|
* import { Console, Effect, Stream } from "effect"
|
|
1390
1491
|
*
|
|
@@ -1413,8 +1514,8 @@ export const map = /*#__PURE__*/dual(2, (self, f) => suspend(() => {
|
|
|
1413
1514
|
* // Output: [ "error: boom" ]
|
|
1414
1515
|
* ```
|
|
1415
1516
|
*
|
|
1416
|
-
* @since 2.0.0
|
|
1417
1517
|
* @category Mapping
|
|
1518
|
+
* @since 2.0.0
|
|
1418
1519
|
*/
|
|
1419
1520
|
export const mapBoth = /*#__PURE__*/dual(2, (self, options) => self.pipe(map(options.onSuccess), mapError(options.onFailure)));
|
|
1420
1521
|
/**
|
|
@@ -1426,7 +1527,8 @@ export const mapBoth = /*#__PURE__*/dual(2, (self, options) => self.pipe(map(opt
|
|
|
1426
1527
|
*
|
|
1427
1528
|
* - `Stream.mapChunks`
|
|
1428
1529
|
*
|
|
1429
|
-
*
|
|
1530
|
+
* **Example** (Mapping stream chunks)
|
|
1531
|
+
*
|
|
1430
1532
|
* ```ts
|
|
1431
1533
|
* import { Array, Console, Effect, Stream } from "effect"
|
|
1432
1534
|
*
|
|
@@ -1443,14 +1545,15 @@ export const mapBoth = /*#__PURE__*/dual(2, (self, options) => self.pipe(map(opt
|
|
|
1443
1545
|
* // Output: [ 1, 2, 4, 5 ]
|
|
1444
1546
|
* ```
|
|
1445
1547
|
*
|
|
1446
|
-
* @since 2.0.0
|
|
1447
1548
|
* @category Mapping
|
|
1549
|
+
* @since 2.0.0
|
|
1448
1550
|
*/
|
|
1449
1551
|
export const mapArray = /*#__PURE__*/dual(2, (self, f) => fromChannel(Channel.map(self.channel, f)));
|
|
1450
1552
|
/**
|
|
1451
1553
|
* Maps over elements of the stream with the specified effectful function.
|
|
1452
1554
|
*
|
|
1453
|
-
*
|
|
1555
|
+
* **Example** (Effectfully mapping stream values)
|
|
1556
|
+
*
|
|
1454
1557
|
* ```ts
|
|
1455
1558
|
* import { Console, Effect, Stream } from "effect"
|
|
1456
1559
|
*
|
|
@@ -1478,14 +1581,15 @@ export const mapArray = /*#__PURE__*/dual(2, (self, f) => fromChannel(Channel.ma
|
|
|
1478
1581
|
* // [2, 4, 6]
|
|
1479
1582
|
* ```
|
|
1480
1583
|
*
|
|
1481
|
-
* @since 2.0.0
|
|
1482
1584
|
* @category Mapping
|
|
1585
|
+
* @since 2.0.0
|
|
1483
1586
|
*/
|
|
1484
1587
|
export const mapEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self, f, options) => self.channel.pipe(Channel.flattenArray, Channel.mapEffect(f, options), Channel.map(Arr.of), fromChannel));
|
|
1485
1588
|
/**
|
|
1486
1589
|
* Flattens a stream of `Effect` values into a stream of their results.
|
|
1487
1590
|
*
|
|
1488
|
-
*
|
|
1591
|
+
* **Example** (Flattening a stream of Effect values into a stream of their results)
|
|
1592
|
+
*
|
|
1489
1593
|
* ```ts
|
|
1490
1594
|
* import { Console, Effect, Stream } from "effect"
|
|
1491
1595
|
*
|
|
@@ -1500,8 +1604,8 @@ export const mapEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self, f,
|
|
|
1500
1604
|
* // Output: [1, 2, 3]
|
|
1501
1605
|
* ```
|
|
1502
1606
|
*
|
|
1503
|
-
* @since 2.0.0
|
|
1504
1607
|
* @category Mapping
|
|
1608
|
+
* @since 2.0.0
|
|
1505
1609
|
*/
|
|
1506
1610
|
export const flattenEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self, options) => mapEffect(self, identity, options));
|
|
1507
1611
|
/**
|
|
@@ -1513,7 +1617,8 @@ export const flattenEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self,
|
|
|
1513
1617
|
*
|
|
1514
1618
|
* - `Stream.mapChunksEffect`
|
|
1515
1619
|
*
|
|
1516
|
-
*
|
|
1620
|
+
* **Example** (Effectfully mapping stream chunks)
|
|
1621
|
+
*
|
|
1517
1622
|
* ```ts
|
|
1518
1623
|
* import { Array, Console, Effect, Stream } from "effect"
|
|
1519
1624
|
*
|
|
@@ -1532,8 +1637,8 @@ export const flattenEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self,
|
|
|
1532
1637
|
* // Output: [1, 2, 13, 14]
|
|
1533
1638
|
* ```
|
|
1534
1639
|
*
|
|
1535
|
-
* @since 4.0.0
|
|
1536
1640
|
* @category Mapping
|
|
1641
|
+
* @since 4.0.0
|
|
1537
1642
|
*/
|
|
1538
1643
|
export const mapArrayEffect = /*#__PURE__*/dual(2, (self, f) => fromChannel(Channel.mapEffect(self.channel, f)));
|
|
1539
1644
|
/**
|
|
@@ -1547,7 +1652,8 @@ export const mapArrayEffect = /*#__PURE__*/dual(2, (self, f) => fromChannel(Chan
|
|
|
1547
1652
|
*
|
|
1548
1653
|
* - `Stream.either`
|
|
1549
1654
|
*
|
|
1550
|
-
*
|
|
1655
|
+
* **Example** (Converting failures to results)
|
|
1656
|
+
*
|
|
1551
1657
|
* ```ts
|
|
1552
1658
|
* import { Console, Effect, Result, Stream } from "effect"
|
|
1553
1659
|
*
|
|
@@ -1568,14 +1674,15 @@ export const mapArrayEffect = /*#__PURE__*/dual(2, (self, f) => fromChannel(Chan
|
|
|
1568
1674
|
* // Output: [ "success: 1", "success: 2", "failure: boom" ]
|
|
1569
1675
|
* ```
|
|
1570
1676
|
*
|
|
1571
|
-
* @since 4.0.0
|
|
1572
1677
|
* @category Error Handling
|
|
1678
|
+
* @since 4.0.0
|
|
1573
1679
|
*/
|
|
1574
1680
|
export const result = self => self.pipe(map(Result.succeed), catch_(e => succeed(Result.fail(e))));
|
|
1575
1681
|
/**
|
|
1576
1682
|
* Runs the provided effect for each element while preserving the elements.
|
|
1577
1683
|
*
|
|
1578
|
-
*
|
|
1684
|
+
* **Example** (Tapping stream values)
|
|
1685
|
+
*
|
|
1579
1686
|
* ```ts
|
|
1580
1687
|
* import { Console, Effect, Stream } from "effect"
|
|
1581
1688
|
*
|
|
@@ -1601,14 +1708,15 @@ export const result = self => self.pipe(map(Result.succeed), catch_(e => succeed
|
|
|
1601
1708
|
* // [ 2, 4, 6 ]
|
|
1602
1709
|
* ```
|
|
1603
1710
|
*
|
|
1604
|
-
* @since 2.0.0
|
|
1605
1711
|
* @category Sequencing
|
|
1712
|
+
* @since 2.0.0
|
|
1606
1713
|
*/
|
|
1607
1714
|
export const tap = /*#__PURE__*/dual(args => isStream(args[0]), (self, f, options) => mapEffect(self, a => Effect.as(f(a), a), options));
|
|
1608
1715
|
/**
|
|
1609
1716
|
* Returns a stream that effectfully "peeks" at elements and failures.
|
|
1610
1717
|
*
|
|
1611
|
-
*
|
|
1718
|
+
* **Example** (Tapping values and errors)
|
|
1719
|
+
*
|
|
1612
1720
|
* ```ts
|
|
1613
1721
|
* import { Console, Effect, Stream } from "effect"
|
|
1614
1722
|
*
|
|
@@ -1633,8 +1741,8 @@ export const tap = /*#__PURE__*/dual(args => isStream(args[0]), (self, f, option
|
|
|
1633
1741
|
* // [ 1, 2, 3 ]
|
|
1634
1742
|
* ```
|
|
1635
1743
|
*
|
|
1636
|
-
* @since 2.0.0
|
|
1637
1744
|
* @category Sequencing
|
|
1745
|
+
* @since 2.0.0
|
|
1638
1746
|
*/
|
|
1639
1747
|
export const tapBoth = /*#__PURE__*/dual(2, (self, options) => self.pipe(tapError(options.onError), tap(options.onElement, {
|
|
1640
1748
|
concurrency: options.concurrency
|
|
@@ -1643,7 +1751,8 @@ export const tapBoth = /*#__PURE__*/dual(2, (self, options) => self.pipe(tapErro
|
|
|
1643
1751
|
* Sends all elements emitted by this stream to the specified sink in addition
|
|
1644
1752
|
* to emitting them.
|
|
1645
1753
|
*
|
|
1646
|
-
*
|
|
1754
|
+
* **Example** (Tapping values with a sink)
|
|
1755
|
+
*
|
|
1647
1756
|
* ```ts
|
|
1648
1757
|
* import { Console, Effect, Ref, Sink, Stream } from "effect"
|
|
1649
1758
|
*
|
|
@@ -1666,8 +1775,8 @@ export const tapBoth = /*#__PURE__*/dual(2, (self, options) => self.pipe(tapErro
|
|
|
1666
1775
|
* // Output: [1, 2, 3]
|
|
1667
1776
|
* ```
|
|
1668
1777
|
*
|
|
1669
|
-
* @since 2.0.0
|
|
1670
1778
|
* @category Sequencing
|
|
1779
|
+
* @since 2.0.0
|
|
1671
1780
|
*/
|
|
1672
1781
|
export const tapSink = /*#__PURE__*/dual(2, (self, sink) => transformPullBracket(self, Effect.fnUntraced(function* (pull, _, scope) {
|
|
1673
1782
|
const upstreamLatch = Latch.makeUnsafe();
|
|
@@ -1713,9 +1822,15 @@ export const tapSink = /*#__PURE__*/dual(2, (self, sink) => transformPullBracket
|
|
|
1713
1822
|
});
|
|
1714
1823
|
})));
|
|
1715
1824
|
/**
|
|
1716
|
-
* Maps each element to a stream and
|
|
1825
|
+
* Maps each element to a stream and flattens the resulting streams.
|
|
1826
|
+
*
|
|
1827
|
+
* With the default sequential concurrency, inner streams are concatenated in
|
|
1828
|
+
* input order. When `concurrency` is greater than `1` or `"unbounded"`,
|
|
1829
|
+
* multiple inner streams may run at the same time and their outputs are merged
|
|
1830
|
+
* as they arrive.
|
|
1831
|
+
*
|
|
1832
|
+
* **Example** (FlatMapping stream values)
|
|
1717
1833
|
*
|
|
1718
|
-
* @example
|
|
1719
1834
|
* ```ts
|
|
1720
1835
|
* import { Console, Effect, Stream } from "effect"
|
|
1721
1836
|
*
|
|
@@ -1731,15 +1846,16 @@ export const tapSink = /*#__PURE__*/dual(2, (self, sink) => transformPullBracket
|
|
|
1731
1846
|
* // Output: [ 1, 2, 2, 4, 3, 6 ]
|
|
1732
1847
|
* ```
|
|
1733
1848
|
*
|
|
1734
|
-
* @since 2.0.0
|
|
1735
1849
|
* @category Mapping
|
|
1850
|
+
* @since 2.0.0
|
|
1736
1851
|
*/
|
|
1737
1852
|
export const flatMap = /*#__PURE__*/dual(args => isStream(args[0]), (self, f, options) => self.channel.pipe(Channel.flattenArray, Channel.flatMap(a => f(a).channel, options), fromChannel));
|
|
1738
1853
|
/**
|
|
1739
1854
|
* Switches to the latest stream produced by the mapping function, interrupting
|
|
1740
1855
|
* the previous stream when a new element arrives.
|
|
1741
1856
|
*
|
|
1742
|
-
*
|
|
1857
|
+
* **Example** (Switching to the latest stream)
|
|
1858
|
+
*
|
|
1743
1859
|
* ```ts
|
|
1744
1860
|
* import { Console, Effect, Stream } from "effect"
|
|
1745
1861
|
*
|
|
@@ -1755,15 +1871,20 @@ export const flatMap = /*#__PURE__*/dual(args => isStream(args[0]), (self, f, op
|
|
|
1755
1871
|
* })
|
|
1756
1872
|
* ```
|
|
1757
1873
|
*
|
|
1758
|
-
* @since 4.0.0
|
|
1759
1874
|
* @category Sequencing
|
|
1875
|
+
* @since 4.0.0
|
|
1760
1876
|
*/
|
|
1761
1877
|
export const switchMap = /*#__PURE__*/dual(args => isStream(args[0]), (self, f, options) => self.channel.pipe(Channel.flattenArray, Channel.switchMap(a => f(a).channel, options), fromChannel));
|
|
1762
1878
|
/**
|
|
1763
|
-
* Flattens a stream of streams into a single stream
|
|
1764
|
-
*
|
|
1879
|
+
* Flattens a stream of streams into a single stream.
|
|
1880
|
+
*
|
|
1881
|
+
* With the default sequential concurrency, inner streams are concatenated in
|
|
1882
|
+
* strict order. When `concurrency` is greater than `1` or `"unbounded"`,
|
|
1883
|
+
* multiple inner streams may run at the same time and their outputs are merged
|
|
1884
|
+
* as they arrive.
|
|
1885
|
+
*
|
|
1886
|
+
* **Example** (Flattening nested streams)
|
|
1765
1887
|
*
|
|
1766
|
-
* @example
|
|
1767
1888
|
* ```ts
|
|
1768
1889
|
* import { Console, Effect, Stream } from "effect"
|
|
1769
1890
|
*
|
|
@@ -1782,8 +1903,8 @@ export const switchMap = /*#__PURE__*/dual(args => isStream(args[0]), (self, f,
|
|
|
1782
1903
|
* // Output: [ 1, 2, 3, 4, 5, 6 ]
|
|
1783
1904
|
* ```
|
|
1784
1905
|
*
|
|
1785
|
-
* @since 2.0.0
|
|
1786
1906
|
* @category Mapping
|
|
1907
|
+
* @since 2.0.0
|
|
1787
1908
|
*/
|
|
1788
1909
|
export const flatten = /*#__PURE__*/dual(args => isStream(args[0]), (self, options) => flatMap(self, identity, options));
|
|
1789
1910
|
/**
|
|
@@ -1795,7 +1916,8 @@ export const flatten = /*#__PURE__*/dual(args => isStream(args[0]), (self, optio
|
|
|
1795
1916
|
*
|
|
1796
1917
|
* - `Stream.flattenChunks`
|
|
1797
1918
|
*
|
|
1798
|
-
*
|
|
1919
|
+
* **Example** (Flattening a stream of non-empty arrays into a stream of elements)
|
|
1920
|
+
*
|
|
1799
1921
|
* ```ts
|
|
1800
1922
|
* import { Array, Console, Effect, Stream } from "effect"
|
|
1801
1923
|
*
|
|
@@ -1810,14 +1932,15 @@ export const flatten = /*#__PURE__*/dual(args => isStream(args[0]), (self, optio
|
|
|
1810
1932
|
* // Output: [ 1, 2, 3 ]
|
|
1811
1933
|
* ```
|
|
1812
1934
|
*
|
|
1813
|
-
* @since 4.0.0
|
|
1814
1935
|
* @category Sequencing
|
|
1936
|
+
* @since 4.0.0
|
|
1815
1937
|
*/
|
|
1816
1938
|
export const flattenArray = self => fromChannel(Channel.flattenArray(self.channel));
|
|
1817
1939
|
/**
|
|
1818
1940
|
* Converts this stream to one that runs its effects but emits no elements.
|
|
1819
1941
|
*
|
|
1820
|
-
*
|
|
1942
|
+
* **Example** (Draining stream values)
|
|
1943
|
+
*
|
|
1821
1944
|
* ```ts
|
|
1822
1945
|
* import { Console, Effect, Stream } from "effect"
|
|
1823
1946
|
*
|
|
@@ -1830,15 +1953,16 @@ export const flattenArray = self => fromChannel(Channel.flattenArray(self.channe
|
|
|
1830
1953
|
* // Output: []
|
|
1831
1954
|
* ```
|
|
1832
1955
|
*
|
|
1833
|
-
* @since 2.0.0
|
|
1834
1956
|
* @category Sequencing
|
|
1957
|
+
* @since 2.0.0
|
|
1835
1958
|
*/
|
|
1836
1959
|
export const drain = self => fromChannel(Channel.drain(self.channel));
|
|
1837
1960
|
/**
|
|
1838
1961
|
* Runs the provided stream in the background while this stream runs, interrupting it
|
|
1839
1962
|
* when this stream completes and failing if the background stream fails or defects.
|
|
1840
1963
|
*
|
|
1841
|
-
*
|
|
1964
|
+
* **Example** (Draining a stream in the background)
|
|
1965
|
+
*
|
|
1842
1966
|
* ```ts
|
|
1843
1967
|
* import { Console, Effect, Stream } from "effect"
|
|
1844
1968
|
*
|
|
@@ -1858,14 +1982,15 @@ export const drain = self => fromChannel(Channel.drain(self.channel));
|
|
|
1858
1982
|
* // Output: [ 1, 2 ]
|
|
1859
1983
|
* ```
|
|
1860
1984
|
*
|
|
1861
|
-
* @since 2.0.0
|
|
1862
1985
|
* @category Sequencing
|
|
1986
|
+
* @since 2.0.0
|
|
1863
1987
|
*/
|
|
1864
1988
|
export const drainFork = /*#__PURE__*/dual(2, (self, that) => mergeEffect(self, runDrain(that)));
|
|
1865
1989
|
/**
|
|
1866
1990
|
* Repeats the entire stream according to the provided schedule.
|
|
1867
1991
|
*
|
|
1868
|
-
*
|
|
1992
|
+
* **Example** (Repeating a stream on a schedule)
|
|
1993
|
+
*
|
|
1869
1994
|
* ```ts
|
|
1870
1995
|
* import { Console, Effect, Schedule, Stream } from "effect"
|
|
1871
1996
|
*
|
|
@@ -1882,14 +2007,15 @@ export const drainFork = /*#__PURE__*/dual(2, (self, that) => mergeEffect(self,
|
|
|
1882
2007
|
* // Output: [ 1, 1, 1, 1, 1 ]
|
|
1883
2008
|
* ```
|
|
1884
2009
|
*
|
|
1885
|
-
* @since 2.0.0
|
|
1886
2010
|
* @category Sequencing
|
|
2011
|
+
* @since 2.0.0
|
|
1887
2012
|
*/
|
|
1888
2013
|
export const repeat = /*#__PURE__*/dual(2, (self, schedule) => fromChannel(Channel.repeat(self.channel, schedule)));
|
|
1889
2014
|
/**
|
|
1890
2015
|
* Spaces the stream's elements according to the provided `schedule`.
|
|
1891
2016
|
*
|
|
1892
|
-
*
|
|
2017
|
+
* **Example** (Scheduling stream elements)
|
|
2018
|
+
*
|
|
1893
2019
|
* ```ts
|
|
1894
2020
|
* import { Console, Effect, Schedule, Stream } from "effect"
|
|
1895
2021
|
*
|
|
@@ -1906,14 +2032,15 @@ export const repeat = /*#__PURE__*/dual(2, (self, schedule) => fromChannel(Chann
|
|
|
1906
2032
|
* // Output: [ 1, 2, 3 ]
|
|
1907
2033
|
* ```
|
|
1908
2034
|
*
|
|
1909
|
-
* @since 2.0.0
|
|
1910
2035
|
* @category Rate Limiting
|
|
2036
|
+
* @since 2.0.0
|
|
1911
2037
|
*/
|
|
1912
2038
|
export const schedule = /*#__PURE__*/dual(2, (self, schedule) => self.channel.pipe(Channel.flattenArray, Channel.schedule(schedule), Channel.map(Arr.of), fromChannel));
|
|
1913
2039
|
/**
|
|
1914
2040
|
* Ends the stream if it does not produce a value within the specified duration.
|
|
1915
2041
|
*
|
|
1916
|
-
*
|
|
2042
|
+
* **Example** (Timing out a stream)
|
|
2043
|
+
*
|
|
1917
2044
|
* ```ts
|
|
1918
2045
|
* import { Console, Effect, Stream } from "effect"
|
|
1919
2046
|
*
|
|
@@ -1930,16 +2057,23 @@ export const schedule = /*#__PURE__*/dual(2, (self, schedule) => self.channel.pi
|
|
|
1930
2057
|
* // Output: [ 1 ]
|
|
1931
2058
|
* ```
|
|
1932
2059
|
*
|
|
1933
|
-
* @since 2.0.0
|
|
1934
2060
|
* @category Rate Limiting
|
|
2061
|
+
* @since 2.0.0
|
|
1935
2062
|
*/
|
|
1936
2063
|
export const timeout = /*#__PURE__*/dual(2, (self, duration) => timeoutOrElse(self, {
|
|
1937
2064
|
duration,
|
|
1938
2065
|
orElse: () => empty
|
|
1939
2066
|
}));
|
|
1940
2067
|
/**
|
|
1941
|
-
*
|
|
2068
|
+
* Switches to a fallback stream if this stream does not emit a value within
|
|
2069
|
+
* the specified duration.
|
|
2070
|
+
*
|
|
2071
|
+
* The timeout is checked for each pull. A zero duration uses `orElse`
|
|
2072
|
+
* immediately, while an infinite duration leaves the original stream
|
|
2073
|
+
* unchanged.
|
|
2074
|
+
*
|
|
1942
2075
|
* @category Rate Limiting
|
|
2076
|
+
* @since 2.0.0
|
|
1943
2077
|
*/
|
|
1944
2078
|
export const timeoutOrElse = /*#__PURE__*/dual(2, (self, options) => {
|
|
1945
2079
|
const duration = Duration.fromInputUnsafe(options.duration);
|
|
@@ -1983,9 +2117,10 @@ export const timeoutOrElse = /*#__PURE__*/dual(2, (self, options) => {
|
|
|
1983
2117
|
* Repeats each element of the stream according to the provided schedule,
|
|
1984
2118
|
* including the original emission.
|
|
1985
2119
|
*
|
|
1986
|
-
* @since 2.0.0
|
|
1987
2120
|
* @category Sequencing
|
|
1988
|
-
* @
|
|
2121
|
+
* @since 2.0.0
|
|
2122
|
+
* **Example** (Repeating stream elements)
|
|
2123
|
+
*
|
|
1989
2124
|
* ```ts
|
|
1990
2125
|
* import { Console, Effect, Schedule, Stream } from "effect"
|
|
1991
2126
|
*
|
|
@@ -2018,7 +2153,8 @@ export const repeatElements = /*#__PURE__*/dual(2, (self, schedule) => fromChann
|
|
|
2018
2153
|
/**
|
|
2019
2154
|
* Repeats this stream forever.
|
|
2020
2155
|
*
|
|
2021
|
-
*
|
|
2156
|
+
* **Example** (Repeating a stream forever)
|
|
2157
|
+
*
|
|
2022
2158
|
* ```ts
|
|
2023
2159
|
* import { Console, Effect, Stream } from "effect"
|
|
2024
2160
|
*
|
|
@@ -2036,8 +2172,8 @@ export const repeatElements = /*#__PURE__*/dual(2, (self, schedule) => fromChann
|
|
|
2036
2172
|
* // Output: [ "A", "B", "A", "B", "A" ]
|
|
2037
2173
|
* ```
|
|
2038
2174
|
*
|
|
2039
|
-
* @since 2.0.0
|
|
2040
2175
|
* @category Sequencing
|
|
2176
|
+
* @since 2.0.0
|
|
2041
2177
|
*/
|
|
2042
2178
|
export const forever = self => fromChannel(Channel.forever(self.channel));
|
|
2043
2179
|
/**
|
|
@@ -2049,7 +2185,8 @@ export const forever = self => fromChannel(Channel.forever(self.channel));
|
|
|
2049
2185
|
*
|
|
2050
2186
|
* - `Stream.flattenIterables`
|
|
2051
2187
|
*
|
|
2052
|
-
*
|
|
2188
|
+
* **Example** (Flattening iterable values)
|
|
2189
|
+
*
|
|
2053
2190
|
* ```ts
|
|
2054
2191
|
* import { Console, Effect, Stream } from "effect"
|
|
2055
2192
|
*
|
|
@@ -2063,15 +2200,16 @@ export const forever = self => fromChannel(Channel.forever(self.channel));
|
|
|
2063
2200
|
* // Output: [ 1, 2, 3, 4 ]
|
|
2064
2201
|
* ```
|
|
2065
2202
|
*
|
|
2066
|
-
* @since 4.0.0
|
|
2067
2203
|
* @category Mapping
|
|
2204
|
+
* @since 4.0.0
|
|
2068
2205
|
*/
|
|
2069
2206
|
export const flattenIterable = self => flatMap(self, fromIterable);
|
|
2070
2207
|
/**
|
|
2071
2208
|
* Unwraps `Take` values, emitting elements from non-empty arrays and ending or
|
|
2072
2209
|
* failing when the `Exit` signals completion.
|
|
2073
2210
|
*
|
|
2074
|
-
*
|
|
2211
|
+
* **Example** (Flattening Take values)
|
|
2212
|
+
*
|
|
2075
2213
|
* ```ts
|
|
2076
2214
|
* import { Array, Console, Effect, Exit, Stream } from "effect"
|
|
2077
2215
|
*
|
|
@@ -2090,15 +2228,16 @@ export const flattenIterable = self => flatMap(self, fromIterable);
|
|
|
2090
2228
|
* // Output: [ 1, 2, 3 ]
|
|
2091
2229
|
* ```
|
|
2092
2230
|
*
|
|
2093
|
-
* @since 4.0.0
|
|
2094
2231
|
* @category Sequencing
|
|
2232
|
+
* @since 4.0.0
|
|
2095
2233
|
*/
|
|
2096
2234
|
export const flattenTake = self => self.channel.pipe(Channel.flattenArray, Channel.flattenTake, fromChannel);
|
|
2097
2235
|
/**
|
|
2098
2236
|
* Concatenates two streams, emitting all elements from the first stream
|
|
2099
2237
|
* followed by all elements from the second stream.
|
|
2100
2238
|
*
|
|
2101
|
-
*
|
|
2239
|
+
* **Example** (Concatenating streams)
|
|
2240
|
+
*
|
|
2102
2241
|
* ```ts
|
|
2103
2242
|
* import { Console, Effect, Stream } from "effect"
|
|
2104
2243
|
*
|
|
@@ -2111,14 +2250,15 @@ export const flattenTake = self => self.channel.pipe(Channel.flattenArray, Chann
|
|
|
2111
2250
|
* // Output: [ 1, 2, 3, 4, 5, 6 ]
|
|
2112
2251
|
* ```
|
|
2113
2252
|
*
|
|
2114
|
-
* @since 2.0.0
|
|
2115
2253
|
* @category Sequencing
|
|
2254
|
+
* @since 2.0.0
|
|
2116
2255
|
*/
|
|
2117
2256
|
export const concat = /*#__PURE__*/dual(2, (self, that) => flatten(fromArray([self, that])));
|
|
2118
2257
|
/**
|
|
2119
2258
|
* Prepends the values from the provided iterable before the stream's elements.
|
|
2120
2259
|
*
|
|
2121
|
-
*
|
|
2260
|
+
* **Example** (Prepending values)
|
|
2261
|
+
*
|
|
2122
2262
|
* ```ts
|
|
2123
2263
|
* import { Console, Effect, Stream } from "effect"
|
|
2124
2264
|
*
|
|
@@ -2135,8 +2275,8 @@ export const concat = /*#__PURE__*/dual(2, (self, that) => flatten(fromArray([se
|
|
|
2135
2275
|
* Effect.runPromise(program)
|
|
2136
2276
|
* ```
|
|
2137
2277
|
*
|
|
2138
|
-
* @since 2.0.0
|
|
2139
2278
|
* @category Sequencing
|
|
2279
|
+
* @since 2.0.0
|
|
2140
2280
|
*/
|
|
2141
2281
|
export const prepend = /*#__PURE__*/dual(2, (self, values) => concat(fromIterable(values), self));
|
|
2142
2282
|
/**
|
|
@@ -2145,7 +2285,8 @@ export const prepend = /*#__PURE__*/dual(2, (self, values) => concat(fromIterabl
|
|
|
2145
2285
|
* By default, the merged stream ends when both streams end. Use
|
|
2146
2286
|
* `haltStrategy` to change the termination behavior.
|
|
2147
2287
|
*
|
|
2148
|
-
*
|
|
2288
|
+
* **Example** (Merging stream values)
|
|
2289
|
+
*
|
|
2149
2290
|
* ```ts
|
|
2150
2291
|
* import { Console, Effect, Stream } from "effect"
|
|
2151
2292
|
*
|
|
@@ -2161,8 +2302,8 @@ export const prepend = /*#__PURE__*/dual(2, (self, values) => concat(fromIterabl
|
|
|
2161
2302
|
* // Output: [ 1, 2, 3, 4 ]
|
|
2162
2303
|
* ```
|
|
2163
2304
|
*
|
|
2164
|
-
* @since 2.0.0
|
|
2165
2305
|
* @category Merging
|
|
2306
|
+
* @since 2.0.0
|
|
2166
2307
|
*/
|
|
2167
2308
|
export const merge = /*#__PURE__*/dual(args => isStream(args[0]) && isStream(args[1]), (self, that, options) => fromChannel(Channel.merge(toChannel(self), toChannel(that), options)));
|
|
2168
2309
|
/**
|
|
@@ -2171,9 +2312,10 @@ export const merge = /*#__PURE__*/dual(args => isStream(args[0]) && isStream(arg
|
|
|
2171
2312
|
* The effect runs concurrently, fails the stream if it fails, and is interrupted
|
|
2172
2313
|
* when the stream completes.
|
|
2173
2314
|
*
|
|
2174
|
-
* @since 4.0.0
|
|
2175
2315
|
* @category Merging
|
|
2176
|
-
* @
|
|
2316
|
+
* @since 4.0.0
|
|
2317
|
+
* **Example** (Merging with a background effect)
|
|
2318
|
+
*
|
|
2177
2319
|
* ```ts
|
|
2178
2320
|
* import { Console, Effect, Stream } from "effect"
|
|
2179
2321
|
*
|
|
@@ -2202,7 +2344,8 @@ export const mergeEffect = /*#__PURE__*/dual(2, (self, effect) => self.channel.p
|
|
|
2202
2344
|
*
|
|
2203
2345
|
* - `Stream.mergeEither`
|
|
2204
2346
|
*
|
|
2205
|
-
*
|
|
2347
|
+
* **Example** (Merging streams into results)
|
|
2348
|
+
*
|
|
2206
2349
|
* ```ts
|
|
2207
2350
|
* import { Console, Effect, Result, Stream } from "effect"
|
|
2208
2351
|
*
|
|
@@ -2228,8 +2371,8 @@ export const mergeEffect = /*#__PURE__*/dual(2, (self, effect) => self.channel.p
|
|
|
2228
2371
|
* // Output: [ "left:left", "right:right" ]
|
|
2229
2372
|
* ```
|
|
2230
2373
|
*
|
|
2231
|
-
* @since 2.0.0
|
|
2232
2374
|
* @category Merging
|
|
2375
|
+
* @since 2.0.0
|
|
2233
2376
|
*/
|
|
2234
2377
|
export const mergeResult = /*#__PURE__*/dual(2, (self, that) => merge(map(self, Result.succeed), map(that, Result.fail)));
|
|
2235
2378
|
/**
|
|
@@ -2239,7 +2382,8 @@ export const mergeResult = /*#__PURE__*/dual(2, (self, that) => merge(map(self,
|
|
|
2239
2382
|
* stream are propagated. The merged stream completes when the left stream
|
|
2240
2383
|
* completes, interrupting the right stream.
|
|
2241
2384
|
*
|
|
2242
|
-
*
|
|
2385
|
+
* **Example** (Merging streams while keeping left values)
|
|
2386
|
+
*
|
|
2243
2387
|
* ```ts
|
|
2244
2388
|
* import { Console, Effect, Stream } from "effect"
|
|
2245
2389
|
*
|
|
@@ -2254,8 +2398,8 @@ export const mergeResult = /*#__PURE__*/dual(2, (self, that) => merge(map(self,
|
|
|
2254
2398
|
* // Output: [ 1, 2 ]
|
|
2255
2399
|
* ```
|
|
2256
2400
|
*
|
|
2257
|
-
* @since 2.0.0
|
|
2258
2401
|
* @category Merging
|
|
2402
|
+
* @since 2.0.0
|
|
2259
2403
|
*/
|
|
2260
2404
|
export const mergeLeft = /*#__PURE__*/dual(2, (left, right) => mergeEffect(left, runDrain(right)));
|
|
2261
2405
|
/**
|
|
@@ -2265,7 +2409,8 @@ export const mergeLeft = /*#__PURE__*/dual(2, (left, right) => mergeEffect(left,
|
|
|
2265
2409
|
* The merged stream ends when the right stream completes, interrupting the
|
|
2266
2410
|
* left stream. Failures from the left stream still fail the merged stream.
|
|
2267
2411
|
*
|
|
2268
|
-
*
|
|
2412
|
+
* **Example** (Merging streams while keeping right values)
|
|
2413
|
+
*
|
|
2269
2414
|
* ```ts
|
|
2270
2415
|
* import { Console, Effect, Stream } from "effect"
|
|
2271
2416
|
*
|
|
@@ -2285,17 +2430,18 @@ export const mergeLeft = /*#__PURE__*/dual(2, (left, right) => mergeEffect(left,
|
|
|
2285
2430
|
* // Output: [ 1, 2 ]
|
|
2286
2431
|
* ```
|
|
2287
2432
|
*
|
|
2288
|
-
* @since 2.0.0
|
|
2289
2433
|
* @category Merging
|
|
2434
|
+
* @since 2.0.0
|
|
2290
2435
|
*/
|
|
2291
2436
|
export const mergeRight = /*#__PURE__*/dual(2, (left, right) => mergeEffect(right, runDrain(left)));
|
|
2292
2437
|
/**
|
|
2293
2438
|
* Merges a collection of streams, running up to the specified number concurrently.
|
|
2294
2439
|
*
|
|
2295
|
-
* @since 2.0.0
|
|
2296
2440
|
* @category Merging
|
|
2441
|
+
* @since 2.0.0
|
|
2442
|
+
*
|
|
2443
|
+
* **Example** (Merging streams with bounded concurrency)
|
|
2297
2444
|
*
|
|
2298
|
-
* @example
|
|
2299
2445
|
* ```ts
|
|
2300
2446
|
* import { Console, Effect, Stream } from "effect"
|
|
2301
2447
|
*
|
|
@@ -2322,7 +2468,8 @@ export const mergeAll = /*#__PURE__*/dual(2, (streams, options) => flatten(fromI
|
|
|
2322
2468
|
*
|
|
2323
2469
|
* See also `Stream.zip` for the more common point-wise variant.
|
|
2324
2470
|
*
|
|
2325
|
-
*
|
|
2471
|
+
* **Example** (Computing cartesian products)
|
|
2472
|
+
*
|
|
2326
2473
|
* ```ts
|
|
2327
2474
|
* import { Console, Effect, Stream } from "effect"
|
|
2328
2475
|
*
|
|
@@ -2337,8 +2484,8 @@ export const mergeAll = /*#__PURE__*/dual(2, (streams, options) => flatten(fromI
|
|
|
2337
2484
|
* // Output: [ [ 1, "a" ], [ 1, "b" ], [ 2, "a" ], [ 2, "b" ] ]
|
|
2338
2485
|
* ```
|
|
2339
2486
|
*
|
|
2340
|
-
* @since 2.0.0
|
|
2341
2487
|
* @category Zipping
|
|
2488
|
+
* @since 2.0.0
|
|
2342
2489
|
*/
|
|
2343
2490
|
export const cross = /*#__PURE__*/dual(2, (left, right) => crossWith(left, right, (l, r) => [l, r]));
|
|
2344
2491
|
/**
|
|
@@ -2348,7 +2495,8 @@ export const cross = /*#__PURE__*/dual(2, (left, right) => crossWith(left, right
|
|
|
2348
2495
|
*
|
|
2349
2496
|
* See also `Stream.zipWith` for the more common point-wise variant.
|
|
2350
2497
|
*
|
|
2351
|
-
*
|
|
2498
|
+
* **Example** (Combining cartesian products)
|
|
2499
|
+
*
|
|
2352
2500
|
* ```ts
|
|
2353
2501
|
* import { Console, Effect, Stream } from "effect"
|
|
2354
2502
|
*
|
|
@@ -2364,14 +2512,15 @@ export const cross = /*#__PURE__*/dual(2, (left, right) => crossWith(left, right
|
|
|
2364
2512
|
* // Output: [ "1-a", "1-b", "2-a", "2-b" ]
|
|
2365
2513
|
* ```
|
|
2366
2514
|
*
|
|
2367
|
-
* @since 2.0.0
|
|
2368
2515
|
* @category Zipping
|
|
2516
|
+
* @since 2.0.0
|
|
2369
2517
|
*/
|
|
2370
2518
|
export const crossWith = /*#__PURE__*/dual(3, (left, right, f) => flatMap(left, l => map(right, r => f(l, r))));
|
|
2371
2519
|
/**
|
|
2372
2520
|
* Zips two streams point-wise with a combining function, ending when either stream ends.
|
|
2373
2521
|
*
|
|
2374
|
-
*
|
|
2522
|
+
* **Example** (Zipping streams with a function)
|
|
2523
|
+
*
|
|
2375
2524
|
* ```ts
|
|
2376
2525
|
* import { Console, Effect, Stream } from "effect"
|
|
2377
2526
|
*
|
|
@@ -2389,8 +2538,8 @@ export const crossWith = /*#__PURE__*/dual(3, (left, right, f) => flatMap(left,
|
|
|
2389
2538
|
* // Output: [ "1-a", "2-b", "3-c" ]
|
|
2390
2539
|
* ```
|
|
2391
2540
|
*
|
|
2392
|
-
* @since 2.0.0
|
|
2393
2541
|
* @category Zipping
|
|
2542
|
+
* @since 2.0.0
|
|
2394
2543
|
*/
|
|
2395
2544
|
export const zipWith = /*#__PURE__*/dual(3, (left, right, f) => zipWithArray(left, right, zipArrays(f)));
|
|
2396
2545
|
const zipArrays = f => (leftArr, rightArr) => {
|
|
@@ -2412,7 +2561,8 @@ const zipArrays = f => (leftArr, rightArr) => {
|
|
|
2412
2561
|
*
|
|
2413
2562
|
* - `Stream.zipWithChunks`
|
|
2414
2563
|
*
|
|
2415
|
-
*
|
|
2564
|
+
* **Example** (Zipping stream chunks)
|
|
2565
|
+
*
|
|
2416
2566
|
* ```ts
|
|
2417
2567
|
* import { Array, Console, Effect, Stream } from "effect"
|
|
2418
2568
|
*
|
|
@@ -2435,8 +2585,8 @@ const zipArrays = f => (leftArr, rightArr) => {
|
|
|
2435
2585
|
* // Output: [[1, "a"], [2, "b"], [3, "c"], [4, "d"], [5, "e"]]
|
|
2436
2586
|
* ```
|
|
2437
2587
|
*
|
|
2438
|
-
* @since 2.0.0
|
|
2439
2588
|
* @category Zipping
|
|
2589
|
+
* @since 2.0.0
|
|
2440
2590
|
*/
|
|
2441
2591
|
export const zipWithArray = /*#__PURE__*/dual(3, (left, right, f) => fromChannel(Channel.fromTransformBracket(Effect.fnUntraced(function* (_, scope) {
|
|
2442
2592
|
const pullLeft = yield* Channel.toPullScoped(left.channel, scope);
|
|
@@ -2475,7 +2625,8 @@ export const zipWithArray = /*#__PURE__*/dual(3, (left, right, f) => fromChannel
|
|
|
2475
2625
|
* Zips this stream with another point-wise and emits tuples of elements from
|
|
2476
2626
|
* both streams. The new stream ends when either stream ends.
|
|
2477
2627
|
*
|
|
2478
|
-
*
|
|
2628
|
+
* **Example** (Zipping streams)
|
|
2629
|
+
*
|
|
2479
2630
|
* ```ts
|
|
2480
2631
|
* import { Console, Effect, Stream } from "effect"
|
|
2481
2632
|
*
|
|
@@ -2493,8 +2644,8 @@ export const zipWithArray = /*#__PURE__*/dual(3, (left, right, f) => fromChannel
|
|
|
2493
2644
|
* // Output: [[1, "a"], [2, "b"], [3, "c"]]
|
|
2494
2645
|
* ```
|
|
2495
2646
|
*
|
|
2496
|
-
* @since 2.0.0
|
|
2497
2647
|
* @category Zipping
|
|
2648
|
+
* @since 2.0.0
|
|
2498
2649
|
*/
|
|
2499
2650
|
export const zip = /*#__PURE__*/dual(2, (self, that) => zipWith(self, that, (a, a2) => [a, a2]));
|
|
2500
2651
|
/**
|
|
@@ -2503,7 +2654,8 @@ export const zip = /*#__PURE__*/dual(2, (self, that) => zipWith(self, that, (a,
|
|
|
2503
2654
|
*
|
|
2504
2655
|
* The resulting stream ends when either side ends.
|
|
2505
2656
|
*
|
|
2506
|
-
*
|
|
2657
|
+
* **Example** (Zipping streams while keeping left values)
|
|
2658
|
+
*
|
|
2507
2659
|
* ```ts
|
|
2508
2660
|
* import { Console, Effect, Stream } from "effect"
|
|
2509
2661
|
*
|
|
@@ -2519,8 +2671,8 @@ export const zip = /*#__PURE__*/dual(2, (self, that) => zipWith(self, that, (a,
|
|
|
2519
2671
|
* // Output: [1, 2]
|
|
2520
2672
|
* ```
|
|
2521
2673
|
*
|
|
2522
|
-
* @since 2.0.0
|
|
2523
2674
|
* @category Zipping
|
|
2675
|
+
* @since 2.0.0
|
|
2524
2676
|
*/
|
|
2525
2677
|
export const zipLeft = /*#__PURE__*/dual(2, (left, right) => zipWithArray(left, right, (leftArr, rightArr) => {
|
|
2526
2678
|
const minLength = Math.min(leftArr.length, rightArr.length);
|
|
@@ -2532,7 +2684,8 @@ export const zipLeft = /*#__PURE__*/dual(2, (left, right) => zipWithArray(left,
|
|
|
2532
2684
|
/**
|
|
2533
2685
|
* Zips this stream with another point-wise, keeping only right values and ending when either stream ends.
|
|
2534
2686
|
*
|
|
2535
|
-
*
|
|
2687
|
+
* **Example** (Zipping streams while keeping right values)
|
|
2688
|
+
*
|
|
2536
2689
|
* ```ts
|
|
2537
2690
|
* import { Console, Effect, Stream } from "effect"
|
|
2538
2691
|
*
|
|
@@ -2548,8 +2701,8 @@ export const zipLeft = /*#__PURE__*/dual(2, (left, right) => zipWithArray(left,
|
|
|
2548
2701
|
* // Output: ["a", "b"]
|
|
2549
2702
|
* ```
|
|
2550
2703
|
*
|
|
2551
|
-
* @since 2.0.0
|
|
2552
2704
|
* @category Zipping
|
|
2705
|
+
* @since 2.0.0
|
|
2553
2706
|
*/
|
|
2554
2707
|
export const zipRight = /*#__PURE__*/dual(2, (left, right) => zipWithArray(left, right, (leftArr, rightArr) => {
|
|
2555
2708
|
const minLength = Math.min(leftArr.length, rightArr.length);
|
|
@@ -2564,7 +2717,8 @@ export const zipRight = /*#__PURE__*/dual(2, (left, right) => zipWithArray(left,
|
|
|
2564
2717
|
*
|
|
2565
2718
|
* The new stream will end when one of the sides ends.
|
|
2566
2719
|
*
|
|
2567
|
-
*
|
|
2720
|
+
* **Example** (Zipping and flattening tuples)
|
|
2721
|
+
*
|
|
2568
2722
|
* ```ts
|
|
2569
2723
|
* import { Console, Effect, Stream } from "effect"
|
|
2570
2724
|
*
|
|
@@ -2584,14 +2738,15 @@ export const zipRight = /*#__PURE__*/dual(2, (left, right) => zipWithArray(left,
|
|
|
2584
2738
|
* // Output: [[1, "a", "x"], [2, "b", "y"], [3, "c", "z"]]
|
|
2585
2739
|
* ```
|
|
2586
2740
|
*
|
|
2587
|
-
* @since 2.0.0
|
|
2588
2741
|
* @category Zipping
|
|
2742
|
+
* @since 2.0.0
|
|
2589
2743
|
*/
|
|
2590
2744
|
export const zipFlatten = /*#__PURE__*/dual(2, (self, that) => zipWith(self, that, (a, a2) => [...a, a2]));
|
|
2591
2745
|
/**
|
|
2592
2746
|
* Zips this stream together with the index of elements.
|
|
2593
2747
|
*
|
|
2594
|
-
*
|
|
2748
|
+
* **Example** (Zipping elements with indices)
|
|
2749
|
+
*
|
|
2595
2750
|
* ```ts
|
|
2596
2751
|
* import { Console, Effect, Stream } from "effect"
|
|
2597
2752
|
*
|
|
@@ -2607,15 +2762,16 @@ export const zipFlatten = /*#__PURE__*/dual(2, (self, that) => zipWith(self, tha
|
|
|
2607
2762
|
* // Output: [["a", 0], ["b", 1], ["c", 2], ["d", 3]]
|
|
2608
2763
|
* ```
|
|
2609
2764
|
*
|
|
2610
|
-
* @since 2.0.0
|
|
2611
2765
|
* @category Zipping
|
|
2766
|
+
* @since 2.0.0
|
|
2612
2767
|
*/
|
|
2613
2768
|
export const zipWithIndex = self => map(self, (a, i) => [a, i]);
|
|
2614
2769
|
/**
|
|
2615
2770
|
* Zips each element with the next element, pairing the final element with
|
|
2616
2771
|
* `Option.none()`.
|
|
2617
2772
|
*
|
|
2618
|
-
*
|
|
2773
|
+
* **Example** (Zipping elements with next values)
|
|
2774
|
+
*
|
|
2619
2775
|
* ```ts
|
|
2620
2776
|
* import { Console, Effect, Stream } from "effect"
|
|
2621
2777
|
*
|
|
@@ -2633,8 +2789,8 @@ export const zipWithIndex = self => map(self, (a, i) => [a, i]);
|
|
|
2633
2789
|
* // ]
|
|
2634
2790
|
* ```
|
|
2635
2791
|
*
|
|
2636
|
-
* @since 2.0.0
|
|
2637
2792
|
* @category Zipping
|
|
2793
|
+
* @since 2.0.0
|
|
2638
2794
|
*/
|
|
2639
2795
|
export const zipWithNext = self => mapAccumArray(self, Option.none, (acc, arr) => {
|
|
2640
2796
|
let i = 0;
|
|
@@ -2657,7 +2813,8 @@ export const zipWithNext = self => mapAccumArray(self, Option.none, (acc, arr) =
|
|
|
2657
2813
|
/**
|
|
2658
2814
|
* Zips each element with its previous element, starting with `None`.
|
|
2659
2815
|
*
|
|
2660
|
-
*
|
|
2816
|
+
* **Example** (Zipping elements with previous values)
|
|
2817
|
+
*
|
|
2661
2818
|
* ```ts
|
|
2662
2819
|
* import { Console, Effect, Stream } from "effect"
|
|
2663
2820
|
*
|
|
@@ -2677,8 +2834,8 @@ export const zipWithNext = self => mapAccumArray(self, Option.none, (acc, arr) =
|
|
|
2677
2834
|
* // ]
|
|
2678
2835
|
* ```
|
|
2679
2836
|
*
|
|
2680
|
-
* @since 2.0.0
|
|
2681
2837
|
* @category Zipping
|
|
2838
|
+
* @since 2.0.0
|
|
2682
2839
|
*/
|
|
2683
2840
|
export const zipWithPrevious = self => mapAccumArray(self, Option.none, (acc, arr) => {
|
|
2684
2841
|
const pairs = Arr.empty();
|
|
@@ -2692,7 +2849,8 @@ export const zipWithPrevious = self => mapAccumArray(self, Option.none, (acc, ar
|
|
|
2692
2849
|
/**
|
|
2693
2850
|
* Zips each element with its previous and next values.
|
|
2694
2851
|
*
|
|
2695
|
-
*
|
|
2852
|
+
* **Example** (Zipping elements with neighbors)
|
|
2853
|
+
*
|
|
2696
2854
|
* ```ts
|
|
2697
2855
|
* import { Console, Effect, Option, Stream } from "effect"
|
|
2698
2856
|
*
|
|
@@ -2708,8 +2866,8 @@ export const zipWithPrevious = self => mapAccumArray(self, Option.none, (acc, ar
|
|
|
2708
2866
|
* // Output: [ [Option.none(), 1, Option.some(2)], [Option.some(1), 2, Option.some(3)], [Option.some(2), 3, Option.none()] ]
|
|
2709
2867
|
* ```
|
|
2710
2868
|
*
|
|
2711
|
-
* @since 2.0.0
|
|
2712
2869
|
* @category Zipping
|
|
2870
|
+
* @since 2.0.0
|
|
2713
2871
|
*/
|
|
2714
2872
|
export const zipWithPreviousAndNext = self => mapAccumArray(self, () => ({
|
|
2715
2873
|
prev: Option.none(),
|
|
@@ -2746,7 +2904,8 @@ export const zipWithPreviousAndNext = self => mapAccumArray(self, () => ({
|
|
|
2746
2904
|
* that emitted elements that are not the last value in arrays will never be
|
|
2747
2905
|
* used for zipping.
|
|
2748
2906
|
*
|
|
2749
|
-
*
|
|
2907
|
+
* **Example** (Zipping latest values from many streams)
|
|
2908
|
+
*
|
|
2750
2909
|
* ```ts
|
|
2751
2910
|
* import { Console, Effect, Stream } from "effect"
|
|
2752
2911
|
*
|
|
@@ -2765,8 +2924,8 @@ export const zipWithPreviousAndNext = self => mapAccumArray(self, () => ({
|
|
|
2765
2924
|
* // Output: [ [ 1, "a", true ], [ 2, "a", true ], [ 3, "a", true ], [ 3, "b", true ], [ 3, "c", true ], [ 3, "c", false ], [ 3, "c", true ] ]
|
|
2766
2925
|
* ```
|
|
2767
2926
|
*
|
|
2768
|
-
* @since 2.0.0
|
|
2769
2927
|
* @category Zipping
|
|
2928
|
+
* @since 2.0.0
|
|
2770
2929
|
*/
|
|
2771
2930
|
export const zipLatestAll = (...streams) => fromChannel(Channel.suspend(() => {
|
|
2772
2931
|
const latest = [];
|
|
@@ -2794,7 +2953,8 @@ export const zipLatestAll = (...streams) => fromChannel(Channel.suspend(() => {
|
|
|
2794
2953
|
* that emitted elements that are not the last value in arrays will never be
|
|
2795
2954
|
* used for zipping.
|
|
2796
2955
|
*
|
|
2797
|
-
*
|
|
2956
|
+
* **Example** (Zipping latest values)
|
|
2957
|
+
*
|
|
2798
2958
|
* ```ts
|
|
2799
2959
|
* import { Console, Effect, Stream } from "effect"
|
|
2800
2960
|
*
|
|
@@ -2809,8 +2969,8 @@ export const zipLatestAll = (...streams) => fromChannel(Channel.suspend(() => {
|
|
|
2809
2969
|
* // Output: [ [1, "a"] ]
|
|
2810
2970
|
* ```
|
|
2811
2971
|
*
|
|
2812
|
-
* @since 2.0.0
|
|
2813
2972
|
* @category Zipping
|
|
2973
|
+
* @since 2.0.0
|
|
2814
2974
|
*/
|
|
2815
2975
|
export const zipLatest = /*#__PURE__*/dual(2, (left, right) => zipLatestAll(left, right));
|
|
2816
2976
|
/**
|
|
@@ -2821,7 +2981,8 @@ export const zipLatest = /*#__PURE__*/dual(2, (left, right) => zipLatestAll(left
|
|
|
2821
2981
|
* that emitted elements that are not the last value in arrays will never be
|
|
2822
2982
|
* used for zipping.
|
|
2823
2983
|
*
|
|
2824
|
-
*
|
|
2984
|
+
* **Example** (Zipping latest values with a function)
|
|
2985
|
+
*
|
|
2825
2986
|
* ```ts
|
|
2826
2987
|
* import { Console, Effect, Stream } from "effect"
|
|
2827
2988
|
*
|
|
@@ -2840,17 +3001,23 @@ export const zipLatest = /*#__PURE__*/dual(2, (left, right) => zipLatestAll(left
|
|
|
2840
3001
|
* })
|
|
2841
3002
|
* ```
|
|
2842
3003
|
*
|
|
2843
|
-
* @since 2.0.0
|
|
2844
3004
|
* @category Zipping
|
|
3005
|
+
* @since 2.0.0
|
|
2845
3006
|
*/
|
|
2846
3007
|
export const zipLatestWith = /*#__PURE__*/dual(3, (left, right, f) => map(zipLatestAll(left, right), ([a, a2]) => f(a, a2)));
|
|
2847
3008
|
/**
|
|
2848
|
-
*
|
|
3009
|
+
* Runs all streams concurrently until one stream emits its first value, then
|
|
3010
|
+
* mirrors that winning stream and interrupts the rest.
|
|
3011
|
+
*
|
|
3012
|
+
* Failures or completion from losing streams before a winner is chosen are
|
|
3013
|
+
* ignored unless every stream fails or completes before emitting. After a
|
|
3014
|
+
* winner is chosen, that stream's later failures are propagated.
|
|
2849
3015
|
*
|
|
2850
|
-
* @since 3.7.0
|
|
2851
3016
|
* @category Racing
|
|
3017
|
+
* @since 3.7.0
|
|
3018
|
+
*
|
|
3019
|
+
* **Example** (Racing multiple streams)
|
|
2852
3020
|
*
|
|
2853
|
-
* @example
|
|
2854
3021
|
* ```ts
|
|
2855
3022
|
* import { Console, Effect, Schedule, Stream } from "effect"
|
|
2856
3023
|
*
|
|
@@ -2884,10 +3051,15 @@ export const raceAll = (...streams) => fromChannel(Channel.fromTransform((_, sco
|
|
|
2884
3051
|
return Effect.suspend(() => winner ?? race);
|
|
2885
3052
|
})));
|
|
2886
3053
|
/**
|
|
2887
|
-
*
|
|
2888
|
-
*
|
|
3054
|
+
* Runs both streams concurrently until one stream emits its first value, then
|
|
3055
|
+
* mirrors that winning stream and interrupts the other.
|
|
3056
|
+
*
|
|
3057
|
+
* A failure or completion from one side before the other side emits does not
|
|
3058
|
+
* win the race unless both sides fail or complete before emitting. After a
|
|
3059
|
+
* winner is chosen, that stream's later failures are propagated.
|
|
3060
|
+
*
|
|
3061
|
+
* **Example** (Racing two streams)
|
|
2889
3062
|
*
|
|
2890
|
-
* @example
|
|
2891
3063
|
* ```ts
|
|
2892
3064
|
* import { Console, Effect, Schedule, Stream } from "effect"
|
|
2893
3065
|
*
|
|
@@ -2905,14 +3077,15 @@ export const raceAll = (...streams) => fromChannel(Channel.fromTransform((_, sco
|
|
|
2905
3077
|
* // Output: [ 0, 1, 2 ]
|
|
2906
3078
|
* ```
|
|
2907
3079
|
*
|
|
2908
|
-
* @since 3.7.0
|
|
2909
3080
|
* @category Racing
|
|
3081
|
+
* @since 3.7.0
|
|
2910
3082
|
*/
|
|
2911
3083
|
export const race = /*#__PURE__*/dual(2, (left, right) => raceAll(left, right));
|
|
2912
3084
|
/**
|
|
2913
3085
|
* Filters a stream to the elements that satisfy a predicate.
|
|
2914
3086
|
*
|
|
2915
|
-
*
|
|
3087
|
+
* **Example** (Filtering stream values)
|
|
3088
|
+
*
|
|
2916
3089
|
* ```ts
|
|
2917
3090
|
* import { Console, Effect, Stream } from "effect"
|
|
2918
3091
|
*
|
|
@@ -2928,21 +3101,22 @@ export const race = /*#__PURE__*/dual(2, (left, right) => raceAll(left, right));
|
|
|
2928
3101
|
* // Output: [ 2, 4 ]
|
|
2929
3102
|
* ```
|
|
2930
3103
|
*
|
|
2931
|
-
* @since 2.0.0
|
|
2932
3104
|
* @category Filtering
|
|
3105
|
+
* @since 2.0.0
|
|
2933
3106
|
*/
|
|
2934
3107
|
export const filter = /*#__PURE__*/dual(2, (self, predicate) => fromChannel(Channel.filterArray(toChannel(self), predicate)));
|
|
2935
3108
|
/**
|
|
2936
3109
|
* Filters and maps stream elements in one pass using a `Filter`.
|
|
2937
3110
|
*
|
|
2938
|
-
* @since 4.0.0
|
|
2939
3111
|
* @category Filtering
|
|
3112
|
+
* @since 4.0.0
|
|
2940
3113
|
*/
|
|
2941
3114
|
export const filterMap = /*#__PURE__*/dual(2, (self, filter) => fromChannel(Channel.filterMapArray(toChannel(self), filter)));
|
|
2942
3115
|
/**
|
|
2943
3116
|
* Effectfully filters elements in a single pass.
|
|
2944
3117
|
*
|
|
2945
|
-
*
|
|
3118
|
+
* **Example** (Effectfully filtering stream values)
|
|
3119
|
+
*
|
|
2946
3120
|
* ```ts
|
|
2947
3121
|
* import { Console, Effect, Stream } from "effect"
|
|
2948
3122
|
*
|
|
@@ -2957,23 +3131,27 @@ export const filterMap = /*#__PURE__*/dual(2, (self, filter) => fromChannel(Chan
|
|
|
2957
3131
|
* // Output: [ 3, 4 ]
|
|
2958
3132
|
* ```
|
|
2959
3133
|
*
|
|
2960
|
-
* @since 2.0.0
|
|
2961
3134
|
* @category Filtering
|
|
3135
|
+
* @since 2.0.0
|
|
2962
3136
|
*/
|
|
2963
3137
|
export const filterEffect = /*#__PURE__*/dual(2, (self, predicate) => fromChannel(Channel.filterArrayEffect(toChannel(self), predicate)));
|
|
2964
3138
|
/**
|
|
2965
3139
|
* Effectfully filters and maps elements in a single pass.
|
|
2966
3140
|
*
|
|
2967
|
-
* @since 4.0.0
|
|
2968
3141
|
* @category Filtering
|
|
3142
|
+
* @since 4.0.0
|
|
2969
3143
|
*/
|
|
2970
3144
|
export const filterMapEffect = /*#__PURE__*/dual(2, (self, filter) => fromChannel(Channel.filterMapArrayEffect(toChannel(self), filter)));
|
|
2971
3145
|
/**
|
|
2972
|
-
* Partitions a stream using a `Filter` and exposes passing and failing values
|
|
3146
|
+
* Partitions a stream using a `Filter` and exposes passing and failing values
|
|
3147
|
+
* as scoped queues.
|
|
3148
|
+
*
|
|
3149
|
+
* The queues are backed by a fiber in the current scope and should be consumed
|
|
3150
|
+
* while that scope remains open. Each queue fails with the stream error or
|
|
3151
|
+
* `Cause.Done` when the source ends.
|
|
2973
3152
|
*
|
|
2974
|
-
*
|
|
3153
|
+
* **Example** (Partitioning a stream into queues)
|
|
2975
3154
|
*
|
|
2976
|
-
* @example
|
|
2977
3155
|
* ```ts
|
|
2978
3156
|
* import { Console, Effect, Result, Stream } from "effect"
|
|
2979
3157
|
*
|
|
@@ -2994,8 +3172,8 @@ export const filterMapEffect = /*#__PURE__*/dual(2, (self, filter) => fromChanne
|
|
|
2994
3172
|
* Effect.runPromise(Effect.scoped(program))
|
|
2995
3173
|
* ```
|
|
2996
3174
|
*
|
|
2997
|
-
* @since 4.0.0
|
|
2998
3175
|
* @category Filtering
|
|
3176
|
+
* @since 4.0.0
|
|
2999
3177
|
*/
|
|
3000
3178
|
export const partitionQueue = /*#__PURE__*/dual(args => isStream(args[0]), /*#__PURE__*/Effect.fnUntraced(function* (self, filter, options) {
|
|
3001
3179
|
const scope = yield* Effect.scope;
|
|
@@ -3043,22 +3221,30 @@ export const partitionQueue = /*#__PURE__*/dual(args => isStream(args[0]), /*#__
|
|
|
3043
3221
|
return [passes, fails];
|
|
3044
3222
|
}));
|
|
3045
3223
|
/**
|
|
3046
|
-
* Splits a stream
|
|
3224
|
+
* Splits a stream with an effectful `Filter`, returning scoped streams for
|
|
3225
|
+
* filter successes and failures.
|
|
3226
|
+
*
|
|
3227
|
+
* The returned streams are backed by queues in the current scope and should be
|
|
3228
|
+
* consumed while that scope remains open. The first stream emits success values
|
|
3229
|
+
* from the filter, and the second emits failure values.
|
|
3047
3230
|
*
|
|
3048
|
-
* @since 4.0.0
|
|
3049
3231
|
* @category Filtering
|
|
3232
|
+
* @since 4.0.0
|
|
3050
3233
|
*/
|
|
3051
3234
|
export const partitionEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self, filter, options) => Effect.map(partitionQueue(mapEffect(self, a => filter(a), options), result => result, options), ([passes, fails]) => [fromQueue(passes), fromQueue(fails)]));
|
|
3052
3235
|
/**
|
|
3053
|
-
* Splits a stream into excluded and satisfying substreams using a
|
|
3236
|
+
* Splits a stream into scoped excluded and satisfying substreams using a
|
|
3237
|
+
* `Filter`.
|
|
3054
3238
|
*
|
|
3055
|
-
* The
|
|
3056
|
-
*
|
|
3239
|
+
* The returned streams are backed by queues in the current scope and should be
|
|
3240
|
+
* consumed while that scope remains open. The faster stream may advance up to
|
|
3241
|
+
* `bufferSize` elements ahead of the slower one.
|
|
3057
3242
|
*
|
|
3058
|
-
* @since 4.0.0
|
|
3059
3243
|
* @category Filtering
|
|
3244
|
+
* @since 4.0.0
|
|
3245
|
+
*
|
|
3246
|
+
* **Example** (Partitioning a stream)
|
|
3060
3247
|
*
|
|
3061
|
-
* @example
|
|
3062
3248
|
* ```ts
|
|
3063
3249
|
* import { Console, Effect, Result, Stream } from "effect"
|
|
3064
3250
|
*
|
|
@@ -3083,7 +3269,8 @@ export const partition = /*#__PURE__*/dual(args => isStream(args[0]), (self, fil
|
|
|
3083
3269
|
* Returns the specified stream if the given condition is satisfied, otherwise
|
|
3084
3270
|
* returns an empty stream.
|
|
3085
3271
|
*
|
|
3086
|
-
*
|
|
3272
|
+
* **Example** (Conditionally keeping a stream)
|
|
3273
|
+
*
|
|
3087
3274
|
* ```ts
|
|
3088
3275
|
* import { Console, Effect, Stream } from "effect"
|
|
3089
3276
|
*
|
|
@@ -3098,8 +3285,8 @@ export const partition = /*#__PURE__*/dual(args => isStream(args[0]), (self, fil
|
|
|
3098
3285
|
* // Output: []
|
|
3099
3286
|
* ```
|
|
3100
3287
|
*
|
|
3101
|
-
* @since 2.0.0
|
|
3102
3288
|
* @category Filtering
|
|
3289
|
+
* @since 2.0.0
|
|
3103
3290
|
*/
|
|
3104
3291
|
export const when = /*#__PURE__*/dual(2, (self, test) => test.pipe(Effect.map(pass => pass ? self : empty), unwrap));
|
|
3105
3292
|
/**
|
|
@@ -3108,7 +3295,8 @@ export const when = /*#__PURE__*/dual(2, (self, test) => test.pipe(Effect.map(pa
|
|
|
3108
3295
|
*
|
|
3109
3296
|
* The returned stream is only valid within the scope.
|
|
3110
3297
|
*
|
|
3111
|
-
*
|
|
3298
|
+
* **Example** (Peeling a stream with a sink)
|
|
3299
|
+
*
|
|
3112
3300
|
* ```ts
|
|
3113
3301
|
* import { Console, Effect, Sink, Stream } from "effect"
|
|
3114
3302
|
*
|
|
@@ -3127,8 +3315,8 @@ export const when = /*#__PURE__*/dual(2, (self, test) => test.pipe(Effect.map(pa
|
|
|
3127
3315
|
* // Output: [ [1, 2, 3], [4, 5, 6] ]
|
|
3128
3316
|
* ```
|
|
3129
3317
|
*
|
|
3130
|
-
* @since 2.0.0
|
|
3131
3318
|
* @category Destructors
|
|
3319
|
+
* @since 2.0.0
|
|
3132
3320
|
*/
|
|
3133
3321
|
export const peel = /*#__PURE__*/dual(2, /*#__PURE__*/Effect.fnUntraced(function* (self, sink) {
|
|
3134
3322
|
let cause = undefined;
|
|
@@ -3147,10 +3335,13 @@ export const peel = /*#__PURE__*/dual(2, /*#__PURE__*/Effect.fnUntraced(function
|
|
|
3147
3335
|
* Buffers up to `capacity` elements so a faster producer can progress
|
|
3148
3336
|
* independently of a slower consumer.
|
|
3149
3337
|
*
|
|
3150
|
-
*
|
|
3151
|
-
*
|
|
3338
|
+
* Finite buffers use the configured queue strategy: `"suspend"` applies
|
|
3339
|
+
* backpressure, while `"dropping"` and `"sliding"` may discard elements when
|
|
3340
|
+
* the buffer is full. This combinator destroys chunking; use `Stream.rechunk`
|
|
3341
|
+
* afterward if you need fixed chunk sizes.
|
|
3342
|
+
*
|
|
3343
|
+
* **Example** (Buffering stream elements)
|
|
3152
3344
|
*
|
|
3153
|
-
* @example
|
|
3154
3345
|
* ```ts
|
|
3155
3346
|
* import { Console, Effect, Stream } from "effect"
|
|
3156
3347
|
*
|
|
@@ -3166,15 +3357,18 @@ export const peel = /*#__PURE__*/dual(2, /*#__PURE__*/Effect.fnUntraced(function
|
|
|
3166
3357
|
* // Output: [ 1, 2, 3 ]
|
|
3167
3358
|
* ```
|
|
3168
3359
|
*
|
|
3169
|
-
* @since 2.0.0
|
|
3170
3360
|
* @category Rate Limiting
|
|
3361
|
+
* @since 2.0.0
|
|
3171
3362
|
*/
|
|
3172
3363
|
export const buffer = /*#__PURE__*/dual(2, (self, options) => fromChannel(Channel.bufferArray(self.channel, options)));
|
|
3173
3364
|
/**
|
|
3174
3365
|
* Allows a faster producer to progress independently of a slower consumer by
|
|
3175
3366
|
* buffering up to `capacity` chunks in a queue.
|
|
3176
3367
|
*
|
|
3177
|
-
*
|
|
3368
|
+
* Finite buffers use the configured queue strategy: `"suspend"` applies
|
|
3369
|
+
* backpressure, while `"dropping"` and `"sliding"` may discard chunks when the
|
|
3370
|
+
* buffer is full. This combinator preserves chunking and is best with
|
|
3371
|
+
* power-of-2 capacities.
|
|
3178
3372
|
*
|
|
3179
3373
|
* **Previously Known As**
|
|
3180
3374
|
*
|
|
@@ -3182,7 +3376,8 @@ export const buffer = /*#__PURE__*/dual(2, (self, options) => fromChannel(Channe
|
|
|
3182
3376
|
*
|
|
3183
3377
|
* - `Stream.bufferChunks`
|
|
3184
3378
|
*
|
|
3185
|
-
*
|
|
3379
|
+
* **Example** (Buffering stream chunks)
|
|
3380
|
+
*
|
|
3186
3381
|
* ```ts
|
|
3187
3382
|
* import { Console, Effect, Stream } from "effect"
|
|
3188
3383
|
*
|
|
@@ -3197,8 +3392,8 @@ export const buffer = /*#__PURE__*/dual(2, (self, options) => fromChannel(Channe
|
|
|
3197
3392
|
* // Output: [ 1, 2, 3, 4 ]
|
|
3198
3393
|
* ```
|
|
3199
3394
|
*
|
|
3200
|
-
* @since 2.0.0
|
|
3201
3395
|
* @category Rate Limiting
|
|
3396
|
+
* @since 2.0.0
|
|
3202
3397
|
*/
|
|
3203
3398
|
export const bufferArray = /*#__PURE__*/dual(2, (self, options) => fromChannel(Channel.buffer(self.channel, options)));
|
|
3204
3399
|
/**
|
|
@@ -3212,7 +3407,8 @@ export const bufferArray = /*#__PURE__*/dual(2, (self, options) => fromChannel(C
|
|
|
3212
3407
|
*
|
|
3213
3408
|
* - `Stream.catchAllCause`
|
|
3214
3409
|
*
|
|
3215
|
-
*
|
|
3410
|
+
* **Example** (Catching stream causes)
|
|
3411
|
+
*
|
|
3216
3412
|
* ```ts
|
|
3217
3413
|
* import { Console, Effect, Stream } from "effect"
|
|
3218
3414
|
*
|
|
@@ -3234,8 +3430,8 @@ export const bufferArray = /*#__PURE__*/dual(2, (self, options) => fromChannel(C
|
|
|
3234
3430
|
* // Output: [ 1, 2, 999 ]
|
|
3235
3431
|
* ```
|
|
3236
3432
|
*
|
|
3237
|
-
* @since 4.0.0
|
|
3238
3433
|
* @category Error Handling
|
|
3434
|
+
* @since 4.0.0
|
|
3239
3435
|
*/
|
|
3240
3436
|
export const catchCause = /*#__PURE__*/dual(2, (self, f) => self.channel.pipe(Channel.catchCause(cause => f(cause).channel), fromChannel));
|
|
3241
3437
|
/**
|
|
@@ -3248,7 +3444,8 @@ export const catchCause = /*#__PURE__*/dual(2, (self, f) => self.channel.pipe(Ch
|
|
|
3248
3444
|
*
|
|
3249
3445
|
* - `Stream.tapErrorCause`
|
|
3250
3446
|
*
|
|
3251
|
-
*
|
|
3447
|
+
* **Example** (Tapping stream causes)
|
|
3448
|
+
*
|
|
3252
3449
|
* ```ts
|
|
3253
3450
|
* import { Cause, Console, Effect, Stream } from "effect"
|
|
3254
3451
|
*
|
|
@@ -3268,8 +3465,8 @@ export const catchCause = /*#__PURE__*/dual(2, (self, f) => self.channel.pipe(Ch
|
|
|
3268
3465
|
* // Output: [ 1, 2, 0 ]
|
|
3269
3466
|
* ```
|
|
3270
3467
|
*
|
|
3271
|
-
* @since 4.0.0
|
|
3272
3468
|
* @category Error Handling
|
|
3469
|
+
* @since 4.0.0
|
|
3273
3470
|
*/
|
|
3274
3471
|
export const tapCause = /*#__PURE__*/dual(2, (self, f) => self.channel.pipe(Channel.tapCause(f), fromChannel));
|
|
3275
3472
|
const catch_ = /*#__PURE__*/dual(2, (self, f) => fromChannel(Channel.catch(self.channel, error => f(error).channel)));
|
|
@@ -3283,7 +3480,8 @@ export {
|
|
|
3283
3480
|
*
|
|
3284
3481
|
* - `Stream.catchAll`
|
|
3285
3482
|
*
|
|
3286
|
-
*
|
|
3483
|
+
* **Example** (Catching stream failures)
|
|
3484
|
+
*
|
|
3287
3485
|
* ```ts
|
|
3288
3486
|
* import { Console, Effect, Stream } from "effect"
|
|
3289
3487
|
*
|
|
@@ -3301,14 +3499,15 @@ export {
|
|
|
3301
3499
|
* // Output: [ 1, 2, 999 ]
|
|
3302
3500
|
* ```
|
|
3303
3501
|
*
|
|
3304
|
-
* @since 4.0.0
|
|
3305
3502
|
* @category Error Handling
|
|
3503
|
+
* @since 4.0.0
|
|
3306
3504
|
*/
|
|
3307
3505
|
catch_ as catch };
|
|
3308
3506
|
/**
|
|
3309
3507
|
* Effectfully peeks at errors without changing the stream unless the tap fails.
|
|
3310
3508
|
*
|
|
3311
|
-
*
|
|
3509
|
+
* **Example** (Effectfully peeking at errors)
|
|
3510
|
+
*
|
|
3312
3511
|
* ```ts
|
|
3313
3512
|
* import { Console, Effect, Stream } from "effect"
|
|
3314
3513
|
*
|
|
@@ -3329,8 +3528,8 @@ catch_ as catch };
|
|
|
3329
3528
|
* // [ 1, 2, 999 ]
|
|
3330
3529
|
* ```
|
|
3331
3530
|
*
|
|
3332
|
-
* @since 4.0.0
|
|
3333
3531
|
* @category Error Handling
|
|
3532
|
+
* @since 4.0.0
|
|
3334
3533
|
*/
|
|
3335
3534
|
export const tapError = /*#__PURE__*/dual(2, (self, f) => self.channel.pipe(Channel.tapError(f), fromChannel));
|
|
3336
3535
|
/**
|
|
@@ -3346,7 +3545,8 @@ export const tapError = /*#__PURE__*/dual(2, (self, f) => self.channel.pipe(Chan
|
|
|
3346
3545
|
*
|
|
3347
3546
|
* - `Stream.catchSome`
|
|
3348
3547
|
*
|
|
3349
|
-
*
|
|
3548
|
+
* **Example** (Catching matching failures)
|
|
3549
|
+
*
|
|
3350
3550
|
* ```ts
|
|
3351
3551
|
* import { Console, Effect, Stream } from "effect"
|
|
3352
3552
|
*
|
|
@@ -3367,16 +3567,16 @@ export const tapError = /*#__PURE__*/dual(2, (self, f) => self.channel.pipe(Chan
|
|
|
3367
3567
|
* Effect.runPromise(program)
|
|
3368
3568
|
* ```
|
|
3369
3569
|
*
|
|
3370
|
-
* @since 4.0.0
|
|
3371
3570
|
* @category Error Handling
|
|
3571
|
+
* @since 4.0.0
|
|
3372
3572
|
*/
|
|
3373
3573
|
export const catchIf = /*#__PURE__*/dual(args => isStream(args[0]), (self, predicate, f, orElse) => fromChannel(Channel.catchIf(toChannel(self), predicate, e => f(e).channel, orElse && (e => orElse(e).channel))));
|
|
3374
3574
|
/**
|
|
3375
3575
|
* Recovers from errors that match a `Filter` by switching to a recovery
|
|
3376
3576
|
* stream.
|
|
3377
3577
|
*
|
|
3378
|
-
* @since 4.0.0
|
|
3379
3578
|
* @category Error Handling
|
|
3579
|
+
* @since 4.0.0
|
|
3380
3580
|
*/
|
|
3381
3581
|
export const catchFilter = /*#__PURE__*/dual(args => isStream(args[0]), (self, filter, f, orElse) => fromChannel(Channel.catchFilter(toChannel(self), filter, e => f(e).channel, orElse && (e => orElse(e).channel))));
|
|
3382
3582
|
/**
|
|
@@ -3388,7 +3588,8 @@ export const catchFilter = /*#__PURE__*/dual(args => isStream(args[0]), (self, f
|
|
|
3388
3588
|
* Use `catchTag` when your error type is a tagged union with a readonly `_tag`
|
|
3389
3589
|
* field and you want to handle a specific error case.
|
|
3390
3590
|
*
|
|
3391
|
-
*
|
|
3591
|
+
* **Example** (Catching tagged failures)
|
|
3592
|
+
*
|
|
3392
3593
|
* ```ts
|
|
3393
3594
|
* import { Console, Data, Effect, Stream } from "effect"
|
|
3394
3595
|
*
|
|
@@ -3409,8 +3610,8 @@ export const catchFilter = /*#__PURE__*/dual(args => isStream(args[0]), (self, f
|
|
|
3409
3610
|
* Effect.runPromise(program)
|
|
3410
3611
|
* ```
|
|
3411
3612
|
*
|
|
3412
|
-
* @since 4.0.0
|
|
3413
3613
|
* @category Error Handling
|
|
3614
|
+
* @since 4.0.0
|
|
3414
3615
|
*/
|
|
3415
3616
|
export const catchTag = /*#__PURE__*/dual(args => isStream(args[0]), (self, k, f, orElse) => {
|
|
3416
3617
|
const pred = Array.isArray(k) ? e => hasProperty(e, "_tag") && k.includes(e._tag) : isTagged(k);
|
|
@@ -3419,7 +3620,8 @@ export const catchTag = /*#__PURE__*/dual(args => isStream(args[0]), (self, k, f
|
|
|
3419
3620
|
/**
|
|
3420
3621
|
* Switches to a recovery stream based on matching `_tag` handlers.
|
|
3421
3622
|
*
|
|
3422
|
-
*
|
|
3623
|
+
* **Example** (Catching tagged failures with handlers)
|
|
3624
|
+
*
|
|
3423
3625
|
* ```ts
|
|
3424
3626
|
* import { Console, Effect, Stream } from "effect"
|
|
3425
3627
|
*
|
|
@@ -3449,8 +3651,8 @@ export const catchTag = /*#__PURE__*/dual(args => isStream(args[0]), (self, k, f
|
|
|
3449
3651
|
* // Output: [ "fallback" ]
|
|
3450
3652
|
* ```
|
|
3451
3653
|
*
|
|
3452
|
-
* @since 4.0.0
|
|
3453
3654
|
* @category Error Handling
|
|
3655
|
+
* @since 4.0.0
|
|
3454
3656
|
*/
|
|
3455
3657
|
export const catchTags = /*#__PURE__*/dual(args => isStream(args[0]), (self, cases, orElse) => {
|
|
3456
3658
|
let keys;
|
|
@@ -3465,7 +3667,8 @@ export const catchTags = /*#__PURE__*/dual(args => isStream(args[0]), (self, cas
|
|
|
3465
3667
|
* Use this to handle nested error causes without removing the parent error
|
|
3466
3668
|
* from the error channel. The handler receives the unwrapped reason.
|
|
3467
3669
|
*
|
|
3468
|
-
*
|
|
3670
|
+
* **Example** (Catching a tagged error reason)
|
|
3671
|
+
*
|
|
3469
3672
|
* ```ts
|
|
3470
3673
|
* import { Console, Data, Effect, Stream } from "effect"
|
|
3471
3674
|
*
|
|
@@ -3499,14 +3702,15 @@ export const catchTags = /*#__PURE__*/dual(args => isStream(args[0]), (self, cas
|
|
|
3499
3702
|
* // Output: [ "retry: 60" ]
|
|
3500
3703
|
* ```
|
|
3501
3704
|
*
|
|
3502
|
-
* @since 4.0.0
|
|
3503
3705
|
* @category Error Handling
|
|
3706
|
+
* @since 4.0.0
|
|
3504
3707
|
*/
|
|
3505
3708
|
export const catchReason = /*#__PURE__*/dual(args => isStream(args[0]), (self, errorTag, reasonTag, f, orElse) => fromChannel(Channel.catchReason(toChannel(self), errorTag, reasonTag, (reason, error) => f(reason, error).channel, orElse && ((reason, error) => orElse(reason, error).channel))));
|
|
3506
3709
|
/**
|
|
3507
3710
|
* Catches multiple reasons within a tagged error using an object of handlers.
|
|
3508
3711
|
*
|
|
3509
|
-
*
|
|
3712
|
+
* **Example** (Catching tagged error reasons)
|
|
3713
|
+
*
|
|
3510
3714
|
* ```ts
|
|
3511
3715
|
* import { Console, Data, Effect, Stream } from "effect"
|
|
3512
3716
|
*
|
|
@@ -3541,8 +3745,8 @@ export const catchReason = /*#__PURE__*/dual(args => isStream(args[0]), (self, e
|
|
|
3541
3745
|
* // Output: [ "retry: 60" ]
|
|
3542
3746
|
* ```
|
|
3543
3747
|
*
|
|
3544
|
-
* @since 4.0.0
|
|
3545
3748
|
* @category Error Handling
|
|
3749
|
+
* @since 4.0.0
|
|
3546
3750
|
*/
|
|
3547
3751
|
export const catchReasons = /*#__PURE__*/dual(args => isStream(args[0]), (self, errorTag, cases, orElse) => {
|
|
3548
3752
|
const handlers = {};
|
|
@@ -3556,7 +3760,8 @@ export const catchReasons = /*#__PURE__*/dual(args => isStream(args[0]), (self,
|
|
|
3556
3760
|
/**
|
|
3557
3761
|
* Transforms the errors emitted by this stream using `f`.
|
|
3558
3762
|
*
|
|
3559
|
-
*
|
|
3763
|
+
* **Example** (Mapping stream errors)
|
|
3764
|
+
*
|
|
3560
3765
|
* ```ts
|
|
3561
3766
|
* import { Console, Effect, Stream } from "effect"
|
|
3562
3767
|
*
|
|
@@ -3573,8 +3778,8 @@ export const catchReasons = /*#__PURE__*/dual(args => isStream(args[0]), (self,
|
|
|
3573
3778
|
* // Output: [ "recovered from mapped: bad" ]
|
|
3574
3779
|
* ```
|
|
3575
3780
|
*
|
|
3576
|
-
* @since 2.0.0
|
|
3577
3781
|
* @category Error Handling
|
|
3782
|
+
* @since 2.0.0
|
|
3578
3783
|
*/
|
|
3579
3784
|
export const mapError = /*#__PURE__*/dual(2, (self, f) => fromChannel(Channel.mapError(self.channel, f)));
|
|
3580
3785
|
/**
|
|
@@ -3587,7 +3792,8 @@ export const mapError = /*#__PURE__*/dual(2, (self, f) => fromChannel(Channel.ma
|
|
|
3587
3792
|
*
|
|
3588
3793
|
* - `Stream.catchSomeCause`
|
|
3589
3794
|
*
|
|
3590
|
-
*
|
|
3795
|
+
* **Example** (Catching matching causes)
|
|
3796
|
+
*
|
|
3591
3797
|
* ```ts
|
|
3592
3798
|
* import { Cause, Console, Effect, Stream } from "effect"
|
|
3593
3799
|
*
|
|
@@ -3607,22 +3813,23 @@ export const mapError = /*#__PURE__*/dual(2, (self, f) => fromChannel(Channel.ma
|
|
|
3607
3813
|
* // Output: [ "Recovered: NetworkError" ]
|
|
3608
3814
|
* ```
|
|
3609
3815
|
*
|
|
3610
|
-
* @since 4.0.0
|
|
3611
3816
|
* @category Error Handling
|
|
3817
|
+
* @since 4.0.0
|
|
3612
3818
|
*/
|
|
3613
3819
|
export const catchCauseIf = /*#__PURE__*/dual(3, (self, predicate, f) => fromChannel(Channel.catchCauseIf(self.channel, predicate, cause => f(cause).channel)));
|
|
3614
3820
|
/**
|
|
3615
3821
|
* Recovers from stream failures by filtering the `Cause` and switching to a
|
|
3616
3822
|
* recovery stream.
|
|
3617
3823
|
*
|
|
3618
|
-
* @since 4.0.0
|
|
3619
3824
|
* @category Error Handling
|
|
3825
|
+
* @since 4.0.0
|
|
3620
3826
|
*/
|
|
3621
3827
|
export const catchCauseFilter = /*#__PURE__*/dual(3, (self, filter, f) => fromChannel(Channel.catchCauseFilter(self.channel, filter, (failure, cause) => f(failure, cause).channel)));
|
|
3622
3828
|
/**
|
|
3623
3829
|
* Switches to a fallback stream if this stream is empty.
|
|
3624
3830
|
*
|
|
3625
|
-
*
|
|
3831
|
+
* **Example** (Switching on empty streams)
|
|
3832
|
+
*
|
|
3626
3833
|
* ```ts
|
|
3627
3834
|
* import { Console, Effect, Stream } from "effect"
|
|
3628
3835
|
*
|
|
@@ -3638,14 +3845,15 @@ export const catchCauseFilter = /*#__PURE__*/dual(3, (self, filter, f) => fromCh
|
|
|
3638
3845
|
* // Output: [ 1, 2 ]
|
|
3639
3846
|
* ```
|
|
3640
3847
|
*
|
|
3641
|
-
* @since 2.0.0
|
|
3642
3848
|
* @category Error Handling
|
|
3849
|
+
* @since 2.0.0
|
|
3643
3850
|
*/
|
|
3644
3851
|
export const orElseIfEmpty = /*#__PURE__*/dual(2, (self, orElse) => fromChannel(Channel.orElseIfEmpty(self.channel, _ => toChannel(orElse()))));
|
|
3645
3852
|
/**
|
|
3646
3853
|
* Returns a stream that emits a fallback value when this stream fails.
|
|
3647
3854
|
*
|
|
3648
|
-
*
|
|
3855
|
+
* **Example** (Recovering with a fallback value)
|
|
3856
|
+
*
|
|
3649
3857
|
* ```ts
|
|
3650
3858
|
* import { Console, Effect, Stream } from "effect"
|
|
3651
3859
|
*
|
|
@@ -3662,14 +3870,15 @@ export const orElseIfEmpty = /*#__PURE__*/dual(2, (self, orElse) => fromChannel(
|
|
|
3662
3870
|
* // Output: [ "Recovered: NetworkError" ]
|
|
3663
3871
|
* ```
|
|
3664
3872
|
*
|
|
3665
|
-
* @since 2.0.0
|
|
3666
3873
|
* @category Error Handling
|
|
3874
|
+
* @since 2.0.0
|
|
3667
3875
|
*/
|
|
3668
3876
|
export const orElseSucceed = /*#__PURE__*/dual(2, (self, f) => catch_(self, e => succeed(f(e))));
|
|
3669
3877
|
/**
|
|
3670
3878
|
* Turns typed failures into defects, making the stream infallible.
|
|
3671
3879
|
*
|
|
3672
|
-
*
|
|
3880
|
+
* **Example** (Turning failures into defects)
|
|
3881
|
+
*
|
|
3673
3882
|
* ```ts
|
|
3674
3883
|
* import { Console, Effect, Stream } from "effect"
|
|
3675
3884
|
*
|
|
@@ -3686,8 +3895,8 @@ export const orElseSucceed = /*#__PURE__*/dual(2, (self, f) => catch_(self, e =>
|
|
|
3686
3895
|
* // Output: [ 1, 2, 3 ]
|
|
3687
3896
|
* ```
|
|
3688
3897
|
*
|
|
3689
|
-
* @since 2.0.0
|
|
3690
3898
|
* @category Error Handling
|
|
3899
|
+
* @since 2.0.0
|
|
3691
3900
|
*/
|
|
3692
3901
|
export const orDie = self => fromChannel(Channel.orDie(self.channel));
|
|
3693
3902
|
/**
|
|
@@ -3695,7 +3904,8 @@ export const orDie = self => fromChannel(Channel.orDie(self.channel));
|
|
|
3695
3904
|
*
|
|
3696
3905
|
* Use the `log` option to emit the full {@link Cause} when the stream fails.
|
|
3697
3906
|
*
|
|
3698
|
-
*
|
|
3907
|
+
* **Example** (Ignoring stream failures)
|
|
3908
|
+
*
|
|
3699
3909
|
* ```ts
|
|
3700
3910
|
* import { Console, Effect, Stream } from "effect"
|
|
3701
3911
|
*
|
|
@@ -3712,17 +3922,24 @@ export const orDie = self => fromChannel(Channel.orDie(self.channel));
|
|
|
3712
3922
|
* // Output: [ 1, 2, 3 ]
|
|
3713
3923
|
* ```
|
|
3714
3924
|
*
|
|
3715
|
-
*
|
|
3925
|
+
* **Example** (Configuring ignore logging)
|
|
3926
|
+
*
|
|
3716
3927
|
* ```ts
|
|
3717
|
-
* import { Stream } from "effect"
|
|
3928
|
+
* import { Effect, Stream } from "effect"
|
|
3718
3929
|
*
|
|
3719
|
-
*
|
|
3930
|
+
* Effect.runPromise(Effect.gen(function*() {
|
|
3931
|
+
* const values = yield* Stream.fail("boom").pipe(
|
|
3932
|
+
* Stream.ignore({ log: false }),
|
|
3933
|
+
* Stream.runCollect
|
|
3934
|
+
* )
|
|
3935
|
+
* yield* Effect.sync(() => console.log(values))
|
|
3936
|
+
* }))
|
|
3720
3937
|
*
|
|
3721
|
-
*
|
|
3938
|
+
* // []
|
|
3722
3939
|
* ```
|
|
3723
3940
|
*
|
|
3724
|
-
* @since 4.0.0
|
|
3725
3941
|
* @category Error Handling
|
|
3942
|
+
* @since 4.0.0
|
|
3726
3943
|
*/
|
|
3727
3944
|
export const ignore = /*#__PURE__*/dual(args => isStream(args[0]), (self, options) => fromChannel(Channel.ignore(self.channel, options)));
|
|
3728
3945
|
/**
|
|
@@ -3730,20 +3947,25 @@ export const ignore = /*#__PURE__*/dual(args => isStream(args[0]), (self, option
|
|
|
3730
3947
|
*
|
|
3731
3948
|
* Use the `log` option to emit the full {@link Cause} when the stream fails.
|
|
3732
3949
|
*
|
|
3733
|
-
*
|
|
3950
|
+
* **Example** (Ignoring stream failure causes)
|
|
3951
|
+
*
|
|
3734
3952
|
* ```ts
|
|
3735
3953
|
* import { Effect, Stream } from "effect"
|
|
3736
3954
|
*
|
|
3737
|
-
*
|
|
3738
|
-
* Stream.
|
|
3739
|
-
*
|
|
3740
|
-
* )
|
|
3955
|
+
* Effect.runPromise(Effect.gen(function*() {
|
|
3956
|
+
* const values = yield* Stream.make(1, 2).pipe(
|
|
3957
|
+
* Stream.concat(Stream.die("boom")),
|
|
3958
|
+
* Stream.ignoreCause({ log: false }),
|
|
3959
|
+
* Stream.runCollect
|
|
3960
|
+
* )
|
|
3961
|
+
* yield* Effect.sync(() => console.log(values))
|
|
3962
|
+
* }))
|
|
3741
3963
|
*
|
|
3742
|
-
*
|
|
3964
|
+
* // [ 1, 2 ]
|
|
3743
3965
|
* ```
|
|
3744
3966
|
*
|
|
3745
|
-
* @since 4.0.0
|
|
3746
3967
|
* @category Error Handling
|
|
3968
|
+
* @since 4.0.0
|
|
3747
3969
|
*/
|
|
3748
3970
|
export const ignoreCause = /*#__PURE__*/dual(args => isStream(args[0]), (self, options) => fromChannel(Channel.ignoreCause(self.channel, options)));
|
|
3749
3971
|
/**
|
|
@@ -3755,7 +3977,8 @@ export const ignoreCause = /*#__PURE__*/dual(args => isStream(args[0]), (self, o
|
|
|
3755
3977
|
* The schedule is reset as soon as the first element passes through the
|
|
3756
3978
|
* stream again.
|
|
3757
3979
|
*
|
|
3758
|
-
*
|
|
3980
|
+
* **Example** (Retrying stream failures)
|
|
3981
|
+
*
|
|
3759
3982
|
* ```ts
|
|
3760
3983
|
* import { Console, Effect, Schedule, Stream } from "effect"
|
|
3761
3984
|
*
|
|
@@ -3774,8 +3997,8 @@ export const ignoreCause = /*#__PURE__*/dual(args => isStream(args[0]), (self, o
|
|
|
3774
3997
|
* // Output: [ 1, 1 ]
|
|
3775
3998
|
* ```
|
|
3776
3999
|
*
|
|
3777
|
-
* @since 2.0.0
|
|
3778
4000
|
* @category Error Handling
|
|
4001
|
+
* @since 2.0.0
|
|
3779
4002
|
*/
|
|
3780
4003
|
export const retry = /*#__PURE__*/dual(2, (self, policy) => fromChannel(Channel.retry(self.channel, policy)));
|
|
3781
4004
|
/**
|
|
@@ -3786,7 +4009,8 @@ export const retry = /*#__PURE__*/dual(2, (self, policy) => fromChannel(Channel.
|
|
|
3786
4009
|
* `preventFallbackOnPartialStream` to fail instead of mixing partial output with
|
|
3787
4010
|
* a later fallback.
|
|
3788
4011
|
*
|
|
3789
|
-
*
|
|
4012
|
+
* **Example** (Applying an execution plan)
|
|
4013
|
+
*
|
|
3790
4014
|
* ```ts
|
|
3791
4015
|
* import { Console, Effect, ExecutionPlan, Layer, Context, Stream } from "effect"
|
|
3792
4016
|
*
|
|
@@ -3804,7 +4028,7 @@ export const retry = /*#__PURE__*/dual(2, (self, policy) => fromChannel(Channel.
|
|
|
3804
4028
|
* { provide: Service.Good }
|
|
3805
4029
|
* )
|
|
3806
4030
|
*
|
|
3807
|
-
* const stream = Stream.unwrap(Effect.map(Service
|
|
4031
|
+
* const stream = Stream.unwrap(Effect.map(Service, (_) => _.stream))
|
|
3808
4032
|
*
|
|
3809
4033
|
* const program = Effect.gen(function*() {
|
|
3810
4034
|
* const items = yield* stream.pipe(Stream.withExecutionPlan(plan), Stream.runCollect)
|
|
@@ -3815,8 +4039,8 @@ export const retry = /*#__PURE__*/dual(2, (self, policy) => fromChannel(Channel.
|
|
|
3815
4039
|
* // Output: [ 1, 2, 3 ]
|
|
3816
4040
|
* ```
|
|
3817
4041
|
*
|
|
3818
|
-
* @since 3.16.0
|
|
3819
4042
|
* @category Error Handling
|
|
4043
|
+
* @since 3.16.0
|
|
3820
4044
|
* @experimental
|
|
3821
4045
|
*/
|
|
3822
4046
|
export const withExecutionPlan = /*#__PURE__*/dual(args => isStream(args[0]), (self, policy, options) => suspend(() => {
|
|
@@ -3873,7 +4097,8 @@ export const withExecutionPlan = /*#__PURE__*/dual(args => isStream(args[0]), (s
|
|
|
3873
4097
|
/**
|
|
3874
4098
|
* Takes the first `n` elements from this stream, returning `Stream.empty` when `n < 1`.
|
|
3875
4099
|
*
|
|
3876
|
-
*
|
|
4100
|
+
* **Example** (Taking values from the left)
|
|
4101
|
+
*
|
|
3877
4102
|
* ```ts
|
|
3878
4103
|
* import { Console, Effect, Stream } from "effect"
|
|
3879
4104
|
*
|
|
@@ -3889,14 +4114,15 @@ export const withExecutionPlan = /*#__PURE__*/dual(args => isStream(args[0]), (s
|
|
|
3889
4114
|
* // Output: [ 1, 2, 3 ]
|
|
3890
4115
|
* ```
|
|
3891
4116
|
*
|
|
3892
|
-
* @since 2.0.0
|
|
3893
4117
|
* @category Filtering
|
|
4118
|
+
* @since 2.0.0
|
|
3894
4119
|
*/
|
|
3895
4120
|
export const take = /*#__PURE__*/dual(2, (self, n) => n < 1 ? empty : takeUntil(self, (_, i) => i === n - 1));
|
|
3896
4121
|
/**
|
|
3897
4122
|
* Keeps the last `n` elements from this stream.
|
|
3898
4123
|
*
|
|
3899
|
-
*
|
|
4124
|
+
* **Example** (Taking elements from the right)
|
|
4125
|
+
*
|
|
3900
4126
|
* ```ts
|
|
3901
4127
|
* import { Console, Effect, Stream } from "effect"
|
|
3902
4128
|
*
|
|
@@ -3912,8 +4138,8 @@ export const take = /*#__PURE__*/dual(2, (self, n) => n < 1 ? empty : takeUntil(
|
|
|
3912
4138
|
* // Output: [ 4, 5, 6 ]
|
|
3913
4139
|
* ```
|
|
3914
4140
|
*
|
|
3915
|
-
* @since 2.0.0
|
|
3916
4141
|
* @category Filtering
|
|
4142
|
+
* @since 2.0.0
|
|
3917
4143
|
*/
|
|
3918
4144
|
export const takeRight = /*#__PURE__*/dual(2, (self, n) => mapAccumArray(self, MutableList.make, (list, arr) => {
|
|
3919
4145
|
MutableList.appendAll(list, arr);
|
|
@@ -3931,7 +4157,8 @@ export const takeRight = /*#__PURE__*/dual(2, (self, n) => mapAccumArray(self, M
|
|
|
3931
4157
|
*
|
|
3932
4158
|
* When `excludeLast` is `true`, the matching element is dropped.
|
|
3933
4159
|
*
|
|
3934
|
-
*
|
|
4160
|
+
* **Example** (Taking until a predicate matches)
|
|
4161
|
+
*
|
|
3935
4162
|
* ```ts
|
|
3936
4163
|
* import { Console, Effect, Stream } from "effect"
|
|
3937
4164
|
*
|
|
@@ -3954,8 +4181,8 @@ export const takeRight = /*#__PURE__*/dual(2, (self, n) => mapAccumArray(self, M
|
|
|
3954
4181
|
* })
|
|
3955
4182
|
* ```
|
|
3956
4183
|
*
|
|
3957
|
-
* @since 2.0.0
|
|
3958
4184
|
* @category Filtering
|
|
4185
|
+
* @since 2.0.0
|
|
3959
4186
|
*/
|
|
3960
4187
|
export const takeUntil = /*#__PURE__*/dual(args => isStream(args[0]), (self, predicate, options) => transformPull(self, (pull, _scope) => Effect.sync(() => {
|
|
3961
4188
|
let i = 0;
|
|
@@ -3974,7 +4201,8 @@ export const takeUntil = /*#__PURE__*/dual(args => isStream(args[0]), (self, pre
|
|
|
3974
4201
|
/**
|
|
3975
4202
|
* Effectful predicate version of `takeUntil`.
|
|
3976
4203
|
*
|
|
3977
|
-
*
|
|
4204
|
+
* **Example** (Taking until an effectful predicate matches)
|
|
4205
|
+
*
|
|
3978
4206
|
* ```ts
|
|
3979
4207
|
* import { Console, Effect, Stream } from "effect"
|
|
3980
4208
|
*
|
|
@@ -3990,8 +4218,8 @@ export const takeUntil = /*#__PURE__*/dual(args => isStream(args[0]), (self, pre
|
|
|
3990
4218
|
* // Output: [ 1, 2, 3 ]
|
|
3991
4219
|
* ```
|
|
3992
4220
|
*
|
|
3993
|
-
* @since 2.0.0
|
|
3994
4221
|
* @category Filtering
|
|
4222
|
+
* @since 2.0.0
|
|
3995
4223
|
*/
|
|
3996
4224
|
export const takeUntilEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self, predicate, options) => transformPull(self, (pull, _scope) => Effect.sync(() => {
|
|
3997
4225
|
let i = 0;
|
|
@@ -4012,7 +4240,8 @@ export const takeUntilEffect = /*#__PURE__*/dual(args => isStream(args[0]), (sel
|
|
|
4012
4240
|
/**
|
|
4013
4241
|
* Takes the longest initial prefix of elements that satisfy the predicate.
|
|
4014
4242
|
*
|
|
4015
|
-
*
|
|
4243
|
+
* **Example** (Taking while a predicate holds)
|
|
4244
|
+
*
|
|
4016
4245
|
* ```ts
|
|
4017
4246
|
* import { Console, Effect, Stream } from "effect"
|
|
4018
4247
|
*
|
|
@@ -4029,8 +4258,8 @@ export const takeUntilEffect = /*#__PURE__*/dual(args => isStream(args[0]), (sel
|
|
|
4029
4258
|
* // Output: [ 1, 2 ]
|
|
4030
4259
|
* ```
|
|
4031
4260
|
*
|
|
4032
|
-
* @since 2.0.0
|
|
4033
4261
|
* @category Filtering
|
|
4262
|
+
* @since 2.0.0
|
|
4034
4263
|
*/
|
|
4035
4264
|
export const takeWhile = /*#__PURE__*/dual(2, (self, predicate) => transformPull(self, (pull, _scope) => Effect.sync(() => {
|
|
4036
4265
|
let i = 0;
|
|
@@ -4049,10 +4278,13 @@ export const takeWhile = /*#__PURE__*/dual(2, (self, predicate) => transformPull
|
|
|
4049
4278
|
return pump;
|
|
4050
4279
|
})));
|
|
4051
4280
|
/**
|
|
4052
|
-
* Takes the longest initial prefix
|
|
4281
|
+
* Takes the longest initial prefix accepted by a `Filter` and emits the
|
|
4282
|
+
* filter's success values.
|
|
4283
|
+
*
|
|
4284
|
+
* The stream stops at the first `Result.fail` returned by the filter.
|
|
4053
4285
|
*
|
|
4054
|
-
* @since 4.0.0
|
|
4055
4286
|
* @category Filtering
|
|
4287
|
+
* @since 4.0.0
|
|
4056
4288
|
*/
|
|
4057
4289
|
export const takeWhileFilter = /*#__PURE__*/dual(2, (self, filter) => transformPull(self, (pull, _scope) => Effect.sync(() => {
|
|
4058
4290
|
let done = false;
|
|
@@ -4073,7 +4305,8 @@ export const takeWhileFilter = /*#__PURE__*/dual(2, (self, filter) => transformP
|
|
|
4073
4305
|
/**
|
|
4074
4306
|
* Takes elements from the stream while the effectful predicate is `true`.
|
|
4075
4307
|
*
|
|
4076
|
-
*
|
|
4308
|
+
* **Example** (Effectfully taking while a predicate holds)
|
|
4309
|
+
*
|
|
4077
4310
|
* ```ts
|
|
4078
4311
|
* import { Console, Effect, Stream } from "effect"
|
|
4079
4312
|
*
|
|
@@ -4089,8 +4322,8 @@ export const takeWhileFilter = /*#__PURE__*/dual(2, (self, filter) => transformP
|
|
|
4089
4322
|
* // Output: [ 1, 2 ]
|
|
4090
4323
|
* ```
|
|
4091
4324
|
*
|
|
4092
|
-
* @since 2.0.0
|
|
4093
4325
|
* @category Filtering
|
|
4326
|
+
* @since 2.0.0
|
|
4094
4327
|
*/
|
|
4095
4328
|
export const takeWhileEffect = /*#__PURE__*/dual(2, (self, predicate) => takeUntilEffect(self, (a, n) => Effect.map(predicate(a, n), b => !b), {
|
|
4096
4329
|
excludeLast: true
|
|
@@ -4098,7 +4331,8 @@ export const takeWhileEffect = /*#__PURE__*/dual(2, (self, predicate) => takeUnt
|
|
|
4098
4331
|
/**
|
|
4099
4332
|
* Drops the first `n` elements from this stream.
|
|
4100
4333
|
*
|
|
4101
|
-
*
|
|
4334
|
+
* **Example** (Dropping values from the left)
|
|
4335
|
+
*
|
|
4102
4336
|
* ```ts
|
|
4103
4337
|
* import { Console, Effect, Stream } from "effect"
|
|
4104
4338
|
*
|
|
@@ -4114,8 +4348,8 @@ export const takeWhileEffect = /*#__PURE__*/dual(2, (self, predicate) => takeUnt
|
|
|
4114
4348
|
* // Output: [ 3, 4, 5 ]
|
|
4115
4349
|
* ```
|
|
4116
4350
|
*
|
|
4117
|
-
* @since 2.0.0
|
|
4118
4351
|
* @category Filtering
|
|
4352
|
+
* @since 2.0.0
|
|
4119
4353
|
*/
|
|
4120
4354
|
export const drop = /*#__PURE__*/dual(2, (self, n) => transformPull(self, (pull, _scope) => Effect.sync(() => {
|
|
4121
4355
|
let dropped = 0;
|
|
@@ -4131,7 +4365,8 @@ export const drop = /*#__PURE__*/dual(2, (self, n) => transformPull(self, (pull,
|
|
|
4131
4365
|
* Drops elements until the specified predicate evaluates to `true`, then drops
|
|
4132
4366
|
* that matching element.
|
|
4133
4367
|
*
|
|
4134
|
-
*
|
|
4368
|
+
* **Example** (Dropping until a predicate matches)
|
|
4369
|
+
*
|
|
4135
4370
|
* ```ts
|
|
4136
4371
|
* import { Console, Effect, Stream } from "effect"
|
|
4137
4372
|
*
|
|
@@ -4144,8 +4379,8 @@ export const drop = /*#__PURE__*/dual(2, (self, n) => transformPull(self, (pull,
|
|
|
4144
4379
|
* })
|
|
4145
4380
|
* ```
|
|
4146
4381
|
*
|
|
4147
|
-
* @since 2.0.0
|
|
4148
4382
|
* @category Filtering
|
|
4383
|
+
* @since 2.0.0
|
|
4149
4384
|
*/
|
|
4150
4385
|
export const dropUntil = /*#__PURE__*/dual(2, (self, predicate) => drop(dropWhile(self, (a, i) => !predicate(a, i)), 1));
|
|
4151
4386
|
/**
|
|
@@ -4154,7 +4389,8 @@ export const dropUntil = /*#__PURE__*/dual(2, (self, predicate) => drop(dropWhil
|
|
|
4154
4389
|
*
|
|
4155
4390
|
* The first element that satisfies the predicate is also dropped.
|
|
4156
4391
|
*
|
|
4157
|
-
*
|
|
4392
|
+
* **Example** (Dropping until an effectful predicate matches)
|
|
4393
|
+
*
|
|
4158
4394
|
* ```ts
|
|
4159
4395
|
* import { Console, Effect, Stream } from "effect"
|
|
4160
4396
|
*
|
|
@@ -4170,14 +4406,15 @@ export const dropUntil = /*#__PURE__*/dual(2, (self, predicate) => drop(dropWhil
|
|
|
4170
4406
|
* // Output: [ 4, 5 ]
|
|
4171
4407
|
* ```
|
|
4172
4408
|
*
|
|
4173
|
-
* @since 2.0.0
|
|
4174
4409
|
* @category Filtering
|
|
4410
|
+
* @since 2.0.0
|
|
4175
4411
|
*/
|
|
4176
4412
|
export const dropUntilEffect = /*#__PURE__*/dual(2, (self, predicate) => drop(dropWhileEffect(self, (a, i) => Effect.map(predicate(a, i), b => !b)), 1));
|
|
4177
4413
|
/**
|
|
4178
4414
|
* Drops elements from the stream while the specified predicate evaluates to `true`.
|
|
4179
4415
|
*
|
|
4180
|
-
*
|
|
4416
|
+
* **Example** (Dropping while a predicate holds)
|
|
4417
|
+
*
|
|
4181
4418
|
* ```ts
|
|
4182
4419
|
* import { Console, Effect, Stream } from "effect"
|
|
4183
4420
|
*
|
|
@@ -4193,8 +4430,8 @@ export const dropUntilEffect = /*#__PURE__*/dual(2, (self, predicate) => drop(dr
|
|
|
4193
4430
|
* // Output: [ 3, 4, 5 ]
|
|
4194
4431
|
* ```
|
|
4195
4432
|
*
|
|
4196
|
-
* @since 2.0.0
|
|
4197
4433
|
* @category Filtering
|
|
4434
|
+
* @since 2.0.0
|
|
4198
4435
|
*/
|
|
4199
4436
|
export const dropWhile = /*#__PURE__*/dual(2, (self, predicate) => transformPull(self, (pull, _scope) => Effect.sync(() => {
|
|
4200
4437
|
let dropping = true;
|
|
@@ -4210,8 +4447,8 @@ export const dropWhile = /*#__PURE__*/dual(2, (self, predicate) => transformPull
|
|
|
4210
4447
|
/**
|
|
4211
4448
|
* Drops elements while the filter succeeds.
|
|
4212
4449
|
*
|
|
4213
|
-
* @since 4.0.0
|
|
4214
4450
|
* @category Filtering
|
|
4451
|
+
* @since 4.0.0
|
|
4215
4452
|
*/
|
|
4216
4453
|
export const dropWhileFilter = /*#__PURE__*/dual(2, (self, filter) => transformPull(self, (pull, _scope) => Effect.sync(() => {
|
|
4217
4454
|
let dropping = true;
|
|
@@ -4226,7 +4463,8 @@ export const dropWhileFilter = /*#__PURE__*/dual(2, (self, filter) => transformP
|
|
|
4226
4463
|
/**
|
|
4227
4464
|
* Drops elements while the specified effectful predicate evaluates to `true`.
|
|
4228
4465
|
*
|
|
4229
|
-
*
|
|
4466
|
+
* **Example** (Effectfully dropping while a predicate holds)
|
|
4467
|
+
*
|
|
4230
4468
|
* ```ts
|
|
4231
4469
|
* import { Console, Effect, Stream } from "effect"
|
|
4232
4470
|
*
|
|
@@ -4242,8 +4480,8 @@ export const dropWhileFilter = /*#__PURE__*/dual(2, (self, filter) => transformP
|
|
|
4242
4480
|
* // Output: [ 3, 4, 5 ]
|
|
4243
4481
|
* ```
|
|
4244
4482
|
*
|
|
4245
|
-
* @since 2.0.0
|
|
4246
4483
|
* @category Filtering
|
|
4484
|
+
* @since 2.0.0
|
|
4247
4485
|
*/
|
|
4248
4486
|
export const dropWhileEffect = /*#__PURE__*/dual(2, (self, predicate) => transformPull(self, (pull, _scope) => Effect.sync(() => {
|
|
4249
4487
|
let dropping = true;
|
|
@@ -4266,7 +4504,8 @@ export const dropWhileEffect = /*#__PURE__*/dual(2, (self, predicate) => transfo
|
|
|
4266
4504
|
*
|
|
4267
4505
|
* Keeps the last `n` elements in memory to drop them on completion.
|
|
4268
4506
|
*
|
|
4269
|
-
*
|
|
4507
|
+
* **Example** (Dropping values from the right)
|
|
4508
|
+
*
|
|
4270
4509
|
* ```ts
|
|
4271
4510
|
* import { Console, Effect, Stream } from "effect"
|
|
4272
4511
|
*
|
|
@@ -4282,8 +4521,8 @@ export const dropWhileEffect = /*#__PURE__*/dual(2, (self, predicate) => transfo
|
|
|
4282
4521
|
* // Output: [ 1, 2, 3 ]
|
|
4283
4522
|
* ```
|
|
4284
4523
|
*
|
|
4285
|
-
* @since 2.0.0
|
|
4286
4524
|
* @category Filtering
|
|
4525
|
+
* @since 2.0.0
|
|
4287
4526
|
*/
|
|
4288
4527
|
export const dropRight = /*#__PURE__*/dual(2, (self, n) => {
|
|
4289
4528
|
if (n <= 0) return self;
|
|
@@ -4301,7 +4540,8 @@ export const dropRight = /*#__PURE__*/dual(2, (self, n) => {
|
|
|
4301
4540
|
/**
|
|
4302
4541
|
* Exposes the underlying chunks as a stream of non-empty arrays.
|
|
4303
4542
|
*
|
|
4304
|
-
*
|
|
4543
|
+
* **Example** (Exposing stream chunks)
|
|
4544
|
+
*
|
|
4305
4545
|
* ```ts
|
|
4306
4546
|
* import { Console, Effect, Stream } from "effect"
|
|
4307
4547
|
*
|
|
@@ -4318,8 +4558,8 @@ export const dropRight = /*#__PURE__*/dual(2, (self, n) => {
|
|
|
4318
4558
|
* // Output: [ [ 1, 2 ], [ 3, 4 ] ]
|
|
4319
4559
|
* ```
|
|
4320
4560
|
*
|
|
4321
|
-
* @since 2.0.0
|
|
4322
4561
|
* @category Grouping
|
|
4562
|
+
* @since 2.0.0
|
|
4323
4563
|
*/
|
|
4324
4564
|
export const chunks = self => self.channel.pipe(Channel.map(Arr.of), fromChannel);
|
|
4325
4565
|
/**
|
|
@@ -4327,7 +4567,8 @@ export const chunks = self => self.channel.pipe(Channel.map(Arr.of), fromChannel
|
|
|
4327
4567
|
*
|
|
4328
4568
|
* The size is clamped to at least 1.
|
|
4329
4569
|
*
|
|
4330
|
-
*
|
|
4570
|
+
* **Example** (Rechunking stream elements)
|
|
4571
|
+
*
|
|
4331
4572
|
* ```ts
|
|
4332
4573
|
* import { Console, Effect, Stream } from "effect"
|
|
4333
4574
|
*
|
|
@@ -4344,8 +4585,8 @@ export const chunks = self => self.channel.pipe(Channel.map(Arr.of), fromChannel
|
|
|
4344
4585
|
* // Output: [ [ 1, 2 ], [ 3, 4 ], [ 5 ] ]
|
|
4345
4586
|
* ```
|
|
4346
4587
|
*
|
|
4347
|
-
* @since 2.0.0
|
|
4348
4588
|
* @category Grouping
|
|
4589
|
+
* @since 2.0.0
|
|
4349
4590
|
*/
|
|
4350
4591
|
export const rechunk = /*#__PURE__*/dual(2, (self, target) => {
|
|
4351
4592
|
target = Math.max(1, target);
|
|
@@ -4390,7 +4631,8 @@ export const rechunk = /*#__PURE__*/dual(2, (self, target) => {
|
|
|
4390
4631
|
/**
|
|
4391
4632
|
* Emits a sliding window of `n` elements.
|
|
4392
4633
|
*
|
|
4393
|
-
*
|
|
4634
|
+
* **Example** (Emitting sliding windows)
|
|
4635
|
+
*
|
|
4394
4636
|
* ```ts
|
|
4395
4637
|
* import { Console, Effect, Stream, pipe } from "effect"
|
|
4396
4638
|
*
|
|
@@ -4405,13 +4647,15 @@ export const rechunk = /*#__PURE__*/dual(2, (self, target) => {
|
|
|
4405
4647
|
* // Output: [ [1, 2], [2, 3], [3, 4], [4, 5] ]
|
|
4406
4648
|
* ```
|
|
4407
4649
|
*
|
|
4408
|
-
* @since 2.0.0
|
|
4409
4650
|
* @category Grouping
|
|
4651
|
+
* @since 2.0.0
|
|
4410
4652
|
*/
|
|
4411
4653
|
export const sliding = /*#__PURE__*/dual(2, (self, chunkSize) => slidingSize(self, chunkSize, 1));
|
|
4412
4654
|
/**
|
|
4413
4655
|
* Emits sliding windows of `chunkSize` elements, advancing by `stepSize`.
|
|
4414
4656
|
*
|
|
4657
|
+
* **Example** (Emitting sliding windows with a step size)
|
|
4658
|
+
*
|
|
4415
4659
|
* ```ts
|
|
4416
4660
|
* import { Console, Effect, Stream } from "effect"
|
|
4417
4661
|
*
|
|
@@ -4427,8 +4671,8 @@ export const sliding = /*#__PURE__*/dual(2, (self, chunkSize) => slidingSize(sel
|
|
|
4427
4671
|
* // Output: [ [ 1, 2, 3 ], [ 3, 4, 5 ] ]
|
|
4428
4672
|
* ```
|
|
4429
4673
|
*
|
|
4430
|
-
* @since 2.0.0
|
|
4431
4674
|
* @category Grouping
|
|
4675
|
+
* @since 2.0.0
|
|
4432
4676
|
*/
|
|
4433
4677
|
export const slidingSize = /*#__PURE__*/dual(3, (self, chunkSize, stepSize) => transformPull(self, (upstream, _scope) => Effect.sync(() => {
|
|
4434
4678
|
let cause = null;
|
|
@@ -4468,7 +4712,8 @@ export const slidingSize = /*#__PURE__*/dual(3, (self, chunkSize, stepSize) => t
|
|
|
4468
4712
|
*
|
|
4469
4713
|
* Matching elements act as delimiters and are not included in the output.
|
|
4470
4714
|
*
|
|
4471
|
-
*
|
|
4715
|
+
* **Example** (Splitting on matching values)
|
|
4716
|
+
*
|
|
4472
4717
|
* ```ts
|
|
4473
4718
|
* import { Console, Effect, Stream } from "effect"
|
|
4474
4719
|
*
|
|
@@ -4484,8 +4729,8 @@ export const slidingSize = /*#__PURE__*/dual(3, (self, chunkSize, stepSize) => t
|
|
|
4484
4729
|
* // Output: [ [1, 2, 3], [5, 6, 7], [9] ]
|
|
4485
4730
|
* ```
|
|
4486
4731
|
*
|
|
4487
|
-
* @since 2.0.0
|
|
4488
4732
|
* @category Grouping
|
|
4733
|
+
* @since 2.0.0
|
|
4489
4734
|
*/
|
|
4490
4735
|
export const split = /*#__PURE__*/dual(2, (self, predicate) => mapAccumArray(self, Arr.empty, (acc, arr) => {
|
|
4491
4736
|
const out = Arr.empty();
|
|
@@ -4512,7 +4757,8 @@ export const split = /*#__PURE__*/dual(2, (self, predicate) => mapAccumArray(sel
|
|
|
4512
4757
|
* Where possible, prefer `Stream.combineArray` for a more efficient
|
|
4513
4758
|
* implementation.
|
|
4514
4759
|
*
|
|
4515
|
-
*
|
|
4760
|
+
* **Example** (Combining streams with state)
|
|
4761
|
+
*
|
|
4516
4762
|
* ```ts
|
|
4517
4763
|
* import { Console, Effect, Stream } from "effect"
|
|
4518
4764
|
*
|
|
@@ -4535,8 +4781,8 @@ export const split = /*#__PURE__*/dual(2, (self, predicate) => mapAccumArray(sel
|
|
|
4535
4781
|
* // Output: [ "L:A", "R:1", "L:B", "R:2", "L:C", "R:3" ]
|
|
4536
4782
|
* ```
|
|
4537
4783
|
*
|
|
4538
|
-
* @since 2.0.0
|
|
4539
4784
|
* @category Merging
|
|
4785
|
+
* @since 2.0.0
|
|
4540
4786
|
*/
|
|
4541
4787
|
export const combine = /*#__PURE__*/dual(4, (self, that, s, f) => Channel.combine(Channel.flattenArray(self.channel), Channel.flattenArray(that.channel), s, f).pipe(Channel.map(Arr.of), fromChannel));
|
|
4542
4788
|
/**
|
|
@@ -4552,7 +4798,8 @@ export const combine = /*#__PURE__*/dual(4, (self, that, s, f) => Channel.combin
|
|
|
4552
4798
|
*
|
|
4553
4799
|
* - `Stream.combineChunks`
|
|
4554
4800
|
*
|
|
4555
|
-
*
|
|
4801
|
+
* **Example** (Combining stream chunks with state)
|
|
4802
|
+
*
|
|
4556
4803
|
* ```ts
|
|
4557
4804
|
* import { Console, Effect, Stream } from "effect"
|
|
4558
4805
|
*
|
|
@@ -4577,14 +4824,15 @@ export const combine = /*#__PURE__*/dual(4, (self, that, s, f) => Channel.combin
|
|
|
4577
4824
|
* // Output: [ 1, 2, 10, 20 ]
|
|
4578
4825
|
* ```
|
|
4579
4826
|
*
|
|
4580
|
-
* @since 2.0.0
|
|
4581
4827
|
* @category Sequencing
|
|
4828
|
+
* @since 2.0.0
|
|
4582
4829
|
*/
|
|
4583
4830
|
export const combineArray = /*#__PURE__*/dual(4, (self, that, s, f) => fromChannel(Channel.combine(self.channel, that.channel, s, f)));
|
|
4584
4831
|
/**
|
|
4585
4832
|
* Statefully maps elements, emitting zero or more outputs per input.
|
|
4586
4833
|
*
|
|
4587
|
-
*
|
|
4834
|
+
* **Example** (Statefully mapping stream values)
|
|
4835
|
+
*
|
|
4588
4836
|
* ```ts
|
|
4589
4837
|
* import { Console, Effect, Stream } from "effect"
|
|
4590
4838
|
*
|
|
@@ -4604,8 +4852,8 @@ export const combineArray = /*#__PURE__*/dual(4, (self, that, s, f) => fromChann
|
|
|
4604
4852
|
* // Output: [ 0, 1, 3, 6, 10, 15, 21 ]
|
|
4605
4853
|
* ```
|
|
4606
4854
|
*
|
|
4607
|
-
* @since 2.0.0
|
|
4608
4855
|
* @category Mapping
|
|
4856
|
+
* @since 2.0.0
|
|
4609
4857
|
*/
|
|
4610
4858
|
export const mapAccum = /*#__PURE__*/dual(args => isStream(args[0]), (self, initial, f, options) => fromChannel(Channel.mapAccum(self.channel, initial, (state, arr) => {
|
|
4611
4859
|
const acc = Arr.empty();
|
|
@@ -4626,7 +4874,8 @@ export const mapAccum = /*#__PURE__*/dual(args => isStream(args[0]), (self, init
|
|
|
4626
4874
|
*
|
|
4627
4875
|
* The mapping function runs once per chunk and the state is threaded across chunks.
|
|
4628
4876
|
*
|
|
4629
|
-
*
|
|
4877
|
+
* **Example** (Statefully mapping stream chunks)
|
|
4878
|
+
*
|
|
4630
4879
|
* ```ts
|
|
4631
4880
|
* import { Console, Effect, Stream } from "effect"
|
|
4632
4881
|
*
|
|
@@ -4646,8 +4895,8 @@ export const mapAccum = /*#__PURE__*/dual(args => isStream(args[0]), (self, init
|
|
|
4646
4895
|
* // Output: [ 3, 10, 21 ]
|
|
4647
4896
|
* ```
|
|
4648
4897
|
*
|
|
4649
|
-
* @since 2.0.0
|
|
4650
4898
|
* @category Mapping
|
|
4899
|
+
* @since 2.0.0
|
|
4651
4900
|
*/
|
|
4652
4901
|
export const mapAccumArray = /*#__PURE__*/dual(args => isStream(args[0]), (self, initial, f, options) => fromChannel(Channel.mapAccum(self.channel, initial, (state, arr) => {
|
|
4653
4902
|
const [newState, values] = f(state, arr);
|
|
@@ -4661,9 +4910,15 @@ export const mapAccumArray = /*#__PURE__*/dual(args => isStream(args[0]), (self,
|
|
|
4661
4910
|
} : undefined)));
|
|
4662
4911
|
const emptyArr = /*#__PURE__*/Arr.empty();
|
|
4663
4912
|
/**
|
|
4664
|
-
* Statefully and effectfully maps
|
|
4913
|
+
* Statefully and effectfully maps each element, emitting zero or more output
|
|
4914
|
+
* values per input.
|
|
4915
|
+
*
|
|
4916
|
+
* The mapping effect receives the current state and element, then returns the
|
|
4917
|
+
* next state plus the values to emit. The state is threaded through the
|
|
4918
|
+
* stream.
|
|
4919
|
+
*
|
|
4920
|
+
* **Example** (Effectfully mapping stream values with state)
|
|
4665
4921
|
*
|
|
4666
|
-
* @example
|
|
4667
4922
|
* ```ts
|
|
4668
4923
|
* import { Console, Effect, Stream } from "effect"
|
|
4669
4924
|
*
|
|
@@ -4682,8 +4937,8 @@ const emptyArr = /*#__PURE__*/Arr.empty();
|
|
|
4682
4937
|
* // Output: [ 1, 2, 3 ]
|
|
4683
4938
|
* ```
|
|
4684
4939
|
*
|
|
4685
|
-
* @since 2.0.0
|
|
4686
4940
|
* @category Mapping
|
|
4941
|
+
* @since 2.0.0
|
|
4687
4942
|
*/
|
|
4688
4943
|
export const mapAccumEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self, initial, f, options) => self.channel.pipe(Channel.flattenArray, Channel.mapAccum(initial, (state, a) => Effect.map(f(state, a), ([state, values]) => [state, Arr.isReadonlyArrayNonEmpty(values) ? Arr.of(values) : Arr.empty()]), options?.onHalt ? {
|
|
4689
4944
|
onHalt(state) {
|
|
@@ -4692,9 +4947,14 @@ export const mapAccumEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self
|
|
|
4692
4947
|
}
|
|
4693
4948
|
} : undefined), fromChannel));
|
|
4694
4949
|
/**
|
|
4695
|
-
* Statefully and effectfully maps
|
|
4950
|
+
* Statefully and effectfully maps each non-empty input chunk, emitting zero or
|
|
4951
|
+
* more output values per chunk.
|
|
4952
|
+
*
|
|
4953
|
+
* The mapping effect receives the current state and chunk, then returns the
|
|
4954
|
+
* next state plus the values to emit. The state is threaded across chunks.
|
|
4955
|
+
*
|
|
4956
|
+
* **Example** (Effectfully mapping stream chunks with state)
|
|
4696
4957
|
*
|
|
4697
|
-
* @example
|
|
4698
4958
|
* ```ts
|
|
4699
4959
|
* import { Console, Effect, Stream } from "effect"
|
|
4700
4960
|
*
|
|
@@ -4716,8 +4976,8 @@ export const mapAccumEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self
|
|
|
4716
4976
|
* // Output: [ 3, 10 ]
|
|
4717
4977
|
* ```
|
|
4718
4978
|
*
|
|
4719
|
-
* @since 2.0.0
|
|
4720
4979
|
* @category Mapping
|
|
4980
|
+
* @since 2.0.0
|
|
4721
4981
|
*/
|
|
4722
4982
|
export const mapAccumArrayEffect = /*#__PURE__*/dual(args => isStream(args), (self, initial, f, options) => self.channel.pipe(Channel.mapAccum(initial, (state, a) => Effect.map(f(state, a), ([state, values]) => [state, Arr.isReadonlyArrayNonEmpty(values) ? Arr.of(values) : emptyArr]), options?.onHalt ? {
|
|
4723
4983
|
onHalt(state) {
|
|
@@ -4728,7 +4988,8 @@ export const mapAccumArrayEffect = /*#__PURE__*/dual(args => isStream(args), (se
|
|
|
4728
4988
|
/**
|
|
4729
4989
|
* Accumulates state across the stream, emitting the initial state and each updated state.
|
|
4730
4990
|
*
|
|
4731
|
-
*
|
|
4991
|
+
* **Example** (Scanning stream state)
|
|
4992
|
+
*
|
|
4732
4993
|
* ```ts
|
|
4733
4994
|
* import { Console, Effect, Stream } from "effect"
|
|
4734
4995
|
*
|
|
@@ -4744,8 +5005,8 @@ export const mapAccumArrayEffect = /*#__PURE__*/dual(args => isStream(args), (se
|
|
|
4744
5005
|
* // Output: [ 0, 1, 3, 6 ]
|
|
4745
5006
|
* ```
|
|
4746
5007
|
*
|
|
4747
|
-
* @since 2.0.0
|
|
4748
5008
|
* @category Accumulation
|
|
5009
|
+
* @since 2.0.0
|
|
4749
5010
|
*/
|
|
4750
5011
|
export const scan = /*#__PURE__*/dual(3, (self, initial, f) => suspend(() => {
|
|
4751
5012
|
let isFirst = true;
|
|
@@ -4765,7 +5026,8 @@ export const scan = /*#__PURE__*/dual(3, (self, initial, f) => suspend(() => {
|
|
|
4765
5026
|
/**
|
|
4766
5027
|
* Effectfully accumulates state and emits the initial state plus each accumulated state.
|
|
4767
5028
|
*
|
|
4768
|
-
*
|
|
5029
|
+
* **Example** (Effectfully scanning stream state)
|
|
5030
|
+
*
|
|
4769
5031
|
* ```ts
|
|
4770
5032
|
* import { Console, Effect, Stream } from "effect"
|
|
4771
5033
|
*
|
|
@@ -4779,14 +5041,15 @@ export const scan = /*#__PURE__*/dual(3, (self, initial, f) => suspend(() => {
|
|
|
4779
5041
|
* })
|
|
4780
5042
|
* ```
|
|
4781
5043
|
*
|
|
4782
|
-
* @since 2.0.0
|
|
4783
5044
|
* @category Accumulation
|
|
5045
|
+
* @since 2.0.0
|
|
4784
5046
|
*/
|
|
4785
5047
|
export const scanEffect = /*#__PURE__*/dual(3, (self, initial, f) => self.channel.pipe(Channel.flattenArray, Channel.scanEffect(initial, f), Channel.map(Arr.of), fromChannel));
|
|
4786
5048
|
/**
|
|
4787
5049
|
* Drops earlier elements within the debounce window and emits only the latest element after the pause.
|
|
4788
5050
|
*
|
|
4789
|
-
*
|
|
5051
|
+
* **Example** (Debouncing stream elements)
|
|
5052
|
+
*
|
|
4790
5053
|
* ```ts
|
|
4791
5054
|
* import { Console, Duration, Effect, Stream } from "effect"
|
|
4792
5055
|
*
|
|
@@ -4803,8 +5066,8 @@ export const scanEffect = /*#__PURE__*/dual(3, (self, initial, f) => self.channe
|
|
|
4803
5066
|
* })
|
|
4804
5067
|
* ```
|
|
4805
5068
|
*
|
|
4806
|
-
* @since 2.0.0
|
|
4807
5069
|
* @category Rate Limiting
|
|
5070
|
+
* @since 2.0.0
|
|
4808
5071
|
*/
|
|
4809
5072
|
export const debounce = /*#__PURE__*/dual(2, (self, duration) => transformPull(self, Effect.fnUntraced(function* (pull, scope) {
|
|
4810
5073
|
const clock = yield* Clock;
|
|
@@ -4873,7 +5136,8 @@ export const debounce = /*#__PURE__*/dual(2, (self, duration) => transformPull(s
|
|
|
4873
5136
|
*
|
|
4874
5137
|
* Defaults to the "shape" strategy.
|
|
4875
5138
|
*
|
|
4876
|
-
*
|
|
5139
|
+
* **Example** (Throttling stream chunks effectfully)
|
|
5140
|
+
*
|
|
4877
5141
|
* ```ts
|
|
4878
5142
|
* import { Console, Effect, Schedule, Stream } from "effect"
|
|
4879
5143
|
*
|
|
@@ -4894,8 +5158,8 @@ export const debounce = /*#__PURE__*/dual(2, (self, duration) => transformPull(s
|
|
|
4894
5158
|
* // Output: [0, 1, 2, 3, 4, 5]
|
|
4895
5159
|
* ```
|
|
4896
5160
|
*
|
|
4897
|
-
* @since 2.0.0
|
|
4898
5161
|
* @category Rate Limiting
|
|
5162
|
+
* @since 2.0.0
|
|
4899
5163
|
*/
|
|
4900
5164
|
export const throttleEffect = /*#__PURE__*/dual(2, (self, options) => {
|
|
4901
5165
|
const burst = options.burst ?? 0;
|
|
@@ -4969,7 +5233,8 @@ const throttleShapeEffect = (self, cost, units, duration, burst) => transformPul
|
|
|
4969
5233
|
*
|
|
4970
5234
|
* Defaults to the "shape" strategy.
|
|
4971
5235
|
*
|
|
4972
|
-
*
|
|
5236
|
+
* **Example** (Throttling stream chunks)
|
|
5237
|
+
*
|
|
4973
5238
|
* ```ts
|
|
4974
5239
|
* import { Console, Effect, Schedule, Stream } from "effect"
|
|
4975
5240
|
*
|
|
@@ -4990,8 +5255,8 @@ const throttleShapeEffect = (self, cost, units, duration, burst) => transformPul
|
|
|
4990
5255
|
* })
|
|
4991
5256
|
* ```
|
|
4992
5257
|
*
|
|
4993
|
-
* @since 2.0.0
|
|
4994
5258
|
* @category Rate Limiting
|
|
5259
|
+
* @since 2.0.0
|
|
4995
5260
|
*/
|
|
4996
5261
|
export const throttle = /*#__PURE__*/dual(2, (self, options) => throttleEffect(self, {
|
|
4997
5262
|
...options,
|
|
@@ -5002,7 +5267,8 @@ export const throttle = /*#__PURE__*/dual(2, (self, options) => throttleEffect(s
|
|
|
5002
5267
|
*
|
|
5003
5268
|
* The final array may be smaller if there are not enough elements to fill it.
|
|
5004
5269
|
*
|
|
5005
|
-
*
|
|
5270
|
+
* **Example** (Grouping elements by size)
|
|
5271
|
+
*
|
|
5006
5272
|
* ```ts
|
|
5007
5273
|
* import { Console, Effect, Stream } from "effect"
|
|
5008
5274
|
*
|
|
@@ -5018,15 +5284,16 @@ export const throttle = /*#__PURE__*/dual(2, (self, options) => throttleEffect(s
|
|
|
5018
5284
|
* // Output: [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8 ] ]
|
|
5019
5285
|
* ```
|
|
5020
5286
|
*
|
|
5021
|
-
* @since 2.0.0
|
|
5022
5287
|
* @category Grouping
|
|
5288
|
+
* @since 2.0.0
|
|
5023
5289
|
*/
|
|
5024
5290
|
export const grouped = /*#__PURE__*/dual(2, (self, n) => chunks(rechunk(self, n)));
|
|
5025
5291
|
/**
|
|
5026
5292
|
* Partitions the stream into arrays, emitting when the chunk size is reached
|
|
5027
5293
|
* or the duration passes.
|
|
5028
5294
|
*
|
|
5029
|
-
*
|
|
5295
|
+
* **Example** (Grouping elements by size or time)
|
|
5296
|
+
*
|
|
5030
5297
|
* ```ts
|
|
5031
5298
|
* import { Console, Effect, Stream } from "effect"
|
|
5032
5299
|
*
|
|
@@ -5042,14 +5309,15 @@ export const grouped = /*#__PURE__*/dual(2, (self, n) => chunks(rechunk(self, n)
|
|
|
5042
5309
|
* // Output: [ [ 1, 2 ], [ 3 ] ]
|
|
5043
5310
|
* ```
|
|
5044
5311
|
*
|
|
5045
|
-
* @since 2.0.0
|
|
5046
5312
|
* @category Grouping
|
|
5313
|
+
* @since 2.0.0
|
|
5047
5314
|
*/
|
|
5048
5315
|
export const groupedWithin = /*#__PURE__*/dual(3, (self, chunkSize, duration) => aggregateWithin(self, Sink.take(chunkSize), Schedule.spaced(duration)));
|
|
5049
5316
|
/**
|
|
5050
5317
|
* Groups elements into keyed substreams using an effectful classifier.
|
|
5051
5318
|
*
|
|
5052
|
-
*
|
|
5319
|
+
* **Example** (Grouping elements into keyed substreams using an effectful classifier)
|
|
5320
|
+
*
|
|
5053
5321
|
* ```ts
|
|
5054
5322
|
* import { Console, Effect, Stream } from "effect"
|
|
5055
5323
|
*
|
|
@@ -5074,8 +5342,8 @@ export const groupedWithin = /*#__PURE__*/dual(3, (self, chunkSize, duration) =>
|
|
|
5074
5342
|
* // Output: [ [ "odd", [ 1, 3, 5 ] ], [ "even", [ 2, 4 ] ] ]
|
|
5075
5343
|
* ```
|
|
5076
5344
|
*
|
|
5077
|
-
* @since 2.0.0
|
|
5078
5345
|
* @category Grouping
|
|
5346
|
+
* @since 2.0.0
|
|
5079
5347
|
*/
|
|
5080
5348
|
export const groupBy = /*#__PURE__*/dual(args => isStream(args[0]), (self, f, options) => groupByImpl(self, Effect.fnUntraced(function* (arr, queues, queueMap) {
|
|
5081
5349
|
for (let i = 0; i < arr.length; i++) {
|
|
@@ -5089,7 +5357,8 @@ export const groupBy = /*#__PURE__*/dual(args => isStream(args[0]), (self, f, op
|
|
|
5089
5357
|
/**
|
|
5090
5358
|
* Groups elements by a key and emits a stream per key.
|
|
5091
5359
|
*
|
|
5092
|
-
*
|
|
5360
|
+
* **Example** (Grouping elements by key)
|
|
5361
|
+
*
|
|
5093
5362
|
* ```ts
|
|
5094
5363
|
* import { Console, Effect, Stream } from "effect"
|
|
5095
5364
|
*
|
|
@@ -5112,8 +5381,8 @@ export const groupBy = /*#__PURE__*/dual(args => isStream(args[0]), (self, f, op
|
|
|
5112
5381
|
* // Output: [ [ "odd", [ 1, 3, 5 ] ], [ "even", [ 2, 4 ] ] ]
|
|
5113
5382
|
* ```
|
|
5114
5383
|
*
|
|
5115
|
-
* @since 2.0.0
|
|
5116
5384
|
* @category Grouping
|
|
5385
|
+
* @since 2.0.0
|
|
5117
5386
|
*/
|
|
5118
5387
|
export const groupByKey = /*#__PURE__*/dual(args => isStream(args[0]), (self, f, options) => suspend(() => {
|
|
5119
5388
|
const batch = MutableHashMap.empty();
|
|
@@ -5160,8 +5429,14 @@ const groupByImpl = (self, f, options) => transformPullBracket(self, Effect.fnUn
|
|
|
5160
5429
|
return Queue.takeAll(out);
|
|
5161
5430
|
}));
|
|
5162
5431
|
/**
|
|
5163
|
-
*
|
|
5432
|
+
* Groups consecutive elements that have equal keys into non-empty arrays.
|
|
5433
|
+
*
|
|
5434
|
+
* The key is computed with `f`; adjacent elements whose keys are equal by
|
|
5435
|
+
* `Equal.equals` are emitted as one `[key, group]`. Later non-adjacent runs
|
|
5436
|
+
* with the same key are emitted separately.
|
|
5437
|
+
*
|
|
5164
5438
|
* @category Grouping
|
|
5439
|
+
* @since 2.0.0
|
|
5165
5440
|
*/
|
|
5166
5441
|
export const groupAdjacentBy = /*#__PURE__*/dual(2, (self, f) => transformPull(self, (pull, _scope) => Effect.sync(() => {
|
|
5167
5442
|
let currentKey = undefined;
|
|
@@ -5201,7 +5476,8 @@ export const groupAdjacentBy = /*#__PURE__*/dual(2, (self, f) => transformPull(s
|
|
|
5201
5476
|
/**
|
|
5202
5477
|
* Applies a sink transducer to the stream and emits each sink result.
|
|
5203
5478
|
*
|
|
5204
|
-
*
|
|
5479
|
+
* **Example** (Transducing with a sink)
|
|
5480
|
+
*
|
|
5205
5481
|
* ```ts
|
|
5206
5482
|
* import { Console, Effect, Sink, Stream } from "effect"
|
|
5207
5483
|
*
|
|
@@ -5216,8 +5492,8 @@ export const groupAdjacentBy = /*#__PURE__*/dual(2, (self, f) => transformPull(s
|
|
|
5216
5492
|
* })
|
|
5217
5493
|
* ```
|
|
5218
5494
|
*
|
|
5219
|
-
* @since 2.0.0
|
|
5220
5495
|
* @category Aggregation
|
|
5496
|
+
* @since 2.0.0
|
|
5221
5497
|
*/
|
|
5222
5498
|
export const transduce = /*#__PURE__*/dual(2, (self, sink) => transformPull(self, (upstream, scope) => Effect.sync(() => {
|
|
5223
5499
|
let done;
|
|
@@ -5245,7 +5521,8 @@ export const transduce = /*#__PURE__*/dual(2, (self, sink) => transformPull(self
|
|
|
5245
5521
|
* The stream runs the upstream and downstream in separate fibers, so the sink can keep
|
|
5246
5522
|
* consuming input while downstream is busy processing the previous output.
|
|
5247
5523
|
*
|
|
5248
|
-
*
|
|
5524
|
+
* **Example** (Aggregating with a sink)
|
|
5525
|
+
*
|
|
5249
5526
|
* ```ts
|
|
5250
5527
|
* import { Console, Effect, Sink, Stream } from "effect"
|
|
5251
5528
|
*
|
|
@@ -5262,8 +5539,8 @@ export const transduce = /*#__PURE__*/dual(2, (self, sink) => transformPull(self
|
|
|
5262
5539
|
* // [ 6, 15 ]
|
|
5263
5540
|
* ```
|
|
5264
5541
|
*
|
|
5265
|
-
* @since 2.0.0
|
|
5266
5542
|
* @category Aggregation
|
|
5543
|
+
* @since 2.0.0
|
|
5267
5544
|
*/
|
|
5268
5545
|
export const aggregate = /*#__PURE__*/dual(2, (self, sink) => aggregateWithin(self, sink, Schedule.forever));
|
|
5269
5546
|
/**
|
|
@@ -5271,7 +5548,8 @@ export const aggregate = /*#__PURE__*/dual(2, (self, sink) => aggregateWithin(se
|
|
|
5271
5548
|
*
|
|
5272
5549
|
* The schedule can flush the current aggregation even if the sink has not finished.
|
|
5273
5550
|
*
|
|
5274
|
-
*
|
|
5551
|
+
* **Example** (Aggregating with a sink and schedule)
|
|
5552
|
+
*
|
|
5275
5553
|
* ```ts
|
|
5276
5554
|
* import { Console, Effect, Schedule, Sink, Stream } from "effect"
|
|
5277
5555
|
*
|
|
@@ -5289,8 +5567,8 @@ export const aggregate = /*#__PURE__*/dual(2, (self, sink) => aggregateWithin(se
|
|
|
5289
5567
|
* // Output: [ 6, 15 ]
|
|
5290
5568
|
* ```
|
|
5291
5569
|
*
|
|
5292
|
-
* @since 2.0.0
|
|
5293
5570
|
* @category Aggregation
|
|
5571
|
+
* @since 2.0.0
|
|
5294
5572
|
*/
|
|
5295
5573
|
export const aggregateWithin = /*#__PURE__*/dual(3, (self, sink, schedule) => fromChannel(Channel.fromTransformBracket(Effect.fnUntraced(function* (_upstream, _, scope) {
|
|
5296
5574
|
const pull = yield* Channel.toPullScoped(self.channel, _);
|
|
@@ -5353,7 +5631,8 @@ export const aggregateWithin = /*#__PURE__*/dual(3, (self, sink, schedule) => fr
|
|
|
5353
5631
|
*
|
|
5354
5632
|
* The returned stream is scoped and uses the provided PubSub capacity and replay settings.
|
|
5355
5633
|
*
|
|
5356
|
-
*
|
|
5634
|
+
* **Example** (Broadcasting a stream)
|
|
5635
|
+
*
|
|
5357
5636
|
* ```ts
|
|
5358
5637
|
* import { Console, Effect, Stream } from "effect"
|
|
5359
5638
|
*
|
|
@@ -5377,8 +5656,8 @@ export const aggregateWithin = /*#__PURE__*/dual(3, (self, sink, schedule) => fr
|
|
|
5377
5656
|
* // Output: [[1, 2, 3], [1, 2, 3]]
|
|
5378
5657
|
* ```
|
|
5379
5658
|
*
|
|
5380
|
-
* @since 2.0.0
|
|
5381
5659
|
* @category Broadcast
|
|
5660
|
+
* @since 2.0.0
|
|
5382
5661
|
*/
|
|
5383
5662
|
export const broadcast = /*#__PURE__*/dual(2, (self, options) => Effect.map(toPubSubTake(self, options), fromPubSubTake));
|
|
5384
5663
|
/**
|
|
@@ -5388,7 +5667,8 @@ export const broadcast = /*#__PURE__*/dual(2, (self, options) => Effect.map(toPu
|
|
|
5388
5667
|
* If `idleTimeToLive` is set, the upstream is kept alive for that duration so a later subscriber can continue from
|
|
5389
5668
|
* the next element instead of restarting.
|
|
5390
5669
|
*
|
|
5391
|
-
*
|
|
5670
|
+
* **Example** (Sharing a stream)
|
|
5671
|
+
*
|
|
5392
5672
|
* ```ts
|
|
5393
5673
|
* import { Console, Effect, Stream } from "effect"
|
|
5394
5674
|
*
|
|
@@ -5409,8 +5689,8 @@ export const broadcast = /*#__PURE__*/dual(2, (self, options) => Effect.map(toPu
|
|
|
5409
5689
|
* // output: [[1], [1]]
|
|
5410
5690
|
* ```
|
|
5411
5691
|
*
|
|
5412
|
-
* @since 2.0.0
|
|
5413
5692
|
* @category Broadcast
|
|
5693
|
+
* @since 2.0.0
|
|
5414
5694
|
*/
|
|
5415
5695
|
export const share = /*#__PURE__*/dual(2, (self, options) => Effect.map(RcRef.make({
|
|
5416
5696
|
acquire: broadcast(self, options),
|
|
@@ -5422,7 +5702,8 @@ export const share = /*#__PURE__*/dual(2, (self, options) => Effect.map(RcRef.ma
|
|
|
5422
5702
|
* The channel receives `NonEmptyReadonlyArray` chunks and can transform both the
|
|
5423
5703
|
* output elements and error type.
|
|
5424
5704
|
*
|
|
5425
|
-
*
|
|
5705
|
+
* **Example** (Piping through a channel)
|
|
5706
|
+
*
|
|
5426
5707
|
* ```ts
|
|
5427
5708
|
* import { Array, Channel, Console, Effect, Stream } from "effect"
|
|
5428
5709
|
*
|
|
@@ -5445,8 +5726,8 @@ export const share = /*#__PURE__*/dual(2, (self, options) => Effect.map(RcRef.ma
|
|
|
5445
5726
|
* // => [2, 4, 6]
|
|
5446
5727
|
* ```
|
|
5447
5728
|
*
|
|
5448
|
-
* @since 2.0.0
|
|
5449
5729
|
* @category Pipe
|
|
5730
|
+
* @since 2.0.0
|
|
5450
5731
|
*/
|
|
5451
5732
|
export const pipeThroughChannel = /*#__PURE__*/dual(2, (self, channel) => fromChannel(Channel.pipeTo(self.channel, channel)));
|
|
5452
5733
|
/**
|
|
@@ -5456,35 +5737,31 @@ export const pipeThroughChannel = /*#__PURE__*/dual(2, (self, channel) => fromCh
|
|
|
5456
5737
|
* Upstream failures are not passed to the channel, so the resulting stream can
|
|
5457
5738
|
* fail with either the original stream error or the channel error.
|
|
5458
5739
|
*
|
|
5459
|
-
*
|
|
5740
|
+
* **Example** (Piping through a channel with failures)
|
|
5741
|
+
*
|
|
5460
5742
|
* ```ts
|
|
5461
|
-
* import
|
|
5462
|
-
*
|
|
5743
|
+
* import { Array, Channel, Effect, Stream } from "effect"
|
|
5744
|
+
*
|
|
5745
|
+
* type NumberChunk = readonly [number, ...Array<number>]
|
|
5463
5746
|
*
|
|
5464
|
-
*
|
|
5465
|
-
*
|
|
5466
|
-
*
|
|
5467
|
-
* unknown,
|
|
5468
|
-
* readonly [number, ...Array<number>],
|
|
5469
|
-
* "StreamError",
|
|
5470
|
-
* unknown,
|
|
5471
|
-
* never
|
|
5472
|
-
* >
|
|
5747
|
+
* const stringifyChunks = Channel.identity<NumberChunk, "StreamError", unknown>().pipe(
|
|
5748
|
+
* Channel.map((chunk) => Array.map(chunk, String))
|
|
5749
|
+
* )
|
|
5473
5750
|
*
|
|
5474
5751
|
* Effect.runPromise(Effect.gen(function*() {
|
|
5475
5752
|
* const result = yield* Stream.make(1, 2, 3).pipe(
|
|
5476
|
-
* Stream.
|
|
5753
|
+
* Stream.rechunk(2),
|
|
5754
|
+
* Stream.pipeThroughChannelOrFail(stringifyChunks),
|
|
5477
5755
|
* Stream.runCollect
|
|
5478
5756
|
* )
|
|
5479
5757
|
*
|
|
5480
|
-
* yield*
|
|
5758
|
+
* yield* Effect.sync(() => console.log(result))
|
|
5481
5759
|
* }))
|
|
5482
|
-
* //
|
|
5483
|
-
* // ["1", "2", "3"]
|
|
5760
|
+
* // [ "1", "2", "3" ]
|
|
5484
5761
|
* ```
|
|
5485
5762
|
*
|
|
5486
|
-
* @since 2.0.0
|
|
5487
5763
|
* @category Pipe
|
|
5764
|
+
* @since 2.0.0
|
|
5488
5765
|
*/
|
|
5489
5766
|
export const pipeThroughChannelOrFail = /*#__PURE__*/dual(2, (self, channel) => fromChannel(Channel.pipeToOrFail(self.channel, channel)));
|
|
5490
5767
|
/**
|
|
@@ -5492,7 +5769,8 @@ export const pipeThroughChannelOrFail = /*#__PURE__*/dual(2, (self, channel) =>
|
|
|
5492
5769
|
*
|
|
5493
5770
|
* If the sink completes mid-chunk, the remaining elements become the output stream.
|
|
5494
5771
|
*
|
|
5495
|
-
*
|
|
5772
|
+
* **Example** (Piping through a sink)
|
|
5773
|
+
*
|
|
5496
5774
|
* ```ts
|
|
5497
5775
|
* import { Console, Effect, Sink, Stream } from "effect"
|
|
5498
5776
|
*
|
|
@@ -5509,14 +5787,15 @@ export const pipeThroughChannelOrFail = /*#__PURE__*/dual(2, (self, channel) =>
|
|
|
5509
5787
|
* //=> [ 3, 4 ]
|
|
5510
5788
|
* ```
|
|
5511
5789
|
*
|
|
5512
|
-
* @since 2.0.0
|
|
5513
5790
|
* @category Pipe
|
|
5791
|
+
* @since 2.0.0
|
|
5514
5792
|
*/
|
|
5515
5793
|
export const pipeThrough = /*#__PURE__*/dual(2, (self, sink) => self.channel.pipe(Channel.pipeToOrFail(Sink.toChannel(sink)), Channel.concatWith(([_, leftover]) => leftover ? Channel.succeed(leftover) : Channel.empty), fromChannel));
|
|
5516
5794
|
/**
|
|
5517
5795
|
* Collects all elements into an array and emits it as a single element.
|
|
5518
5796
|
*
|
|
5519
|
-
*
|
|
5797
|
+
* **Example** (Collecting values into a stream element)
|
|
5798
|
+
*
|
|
5520
5799
|
* ```ts
|
|
5521
5800
|
* import { Console, Effect, Stream } from "effect"
|
|
5522
5801
|
*
|
|
@@ -5531,14 +5810,15 @@ export const pipeThrough = /*#__PURE__*/dual(2, (self, sink) => self.channel.pip
|
|
|
5531
5810
|
* // [1, 2, 3]
|
|
5532
5811
|
* ```
|
|
5533
5812
|
*
|
|
5534
|
-
* @since 2.0.0
|
|
5535
5813
|
* @category Accumulation
|
|
5814
|
+
* @since 2.0.0
|
|
5536
5815
|
*/
|
|
5537
5816
|
export const collect = self => fromEffect(runCollect(self));
|
|
5538
5817
|
/**
|
|
5539
5818
|
* Accumulates elements into a growing array, emitting the cumulative array for each input chunk.
|
|
5540
5819
|
*
|
|
5541
|
-
*
|
|
5820
|
+
* **Example** (Accumulating stream elements)
|
|
5821
|
+
*
|
|
5542
5822
|
* ```ts
|
|
5543
5823
|
* import { Console, Effect, Stream } from "effect"
|
|
5544
5824
|
*
|
|
@@ -5556,8 +5836,8 @@ export const collect = self => fromEffect(runCollect(self));
|
|
|
5556
5836
|
* //=> { _id: 'Chunk', values: [ [ 1 ], [ 1, 2 ], [ 1, 2, 3 ] ] }
|
|
5557
5837
|
* ```
|
|
5558
5838
|
*
|
|
5559
|
-
* @since 2.0.0
|
|
5560
5839
|
* @category Accumulation
|
|
5840
|
+
* @since 2.0.0
|
|
5561
5841
|
*/
|
|
5562
5842
|
export const accumulate = self => mapAccumArray(self, Arr.empty, (acc, as) => {
|
|
5563
5843
|
const combined = Arr.appendAll(acc, as);
|
|
@@ -5566,7 +5846,8 @@ export const accumulate = self => mapAccumArray(self, Arr.empty, (acc, as) => {
|
|
|
5566
5846
|
/**
|
|
5567
5847
|
* Emits only elements that differ from the previous one.
|
|
5568
5848
|
*
|
|
5569
|
-
*
|
|
5849
|
+
* **Example** (Emitting changed values)
|
|
5850
|
+
*
|
|
5570
5851
|
* ```ts
|
|
5571
5852
|
* import { Console, Effect, Stream } from "effect"
|
|
5572
5853
|
*
|
|
@@ -5583,14 +5864,15 @@ export const accumulate = self => mapAccumArray(self, Arr.empty, (acc, as) => {
|
|
|
5583
5864
|
* // [1, 2, 3]
|
|
5584
5865
|
* ```
|
|
5585
5866
|
*
|
|
5586
|
-
* @since 2.0.0
|
|
5587
5867
|
* @category Deduplication
|
|
5868
|
+
* @since 2.0.0
|
|
5588
5869
|
*/
|
|
5589
5870
|
export const changes = self => changesWith(self, Equal.equals);
|
|
5590
5871
|
/**
|
|
5591
5872
|
* Returns a stream that only emits elements that are not equal to the previously emitted element, as determined by the specified predicate.
|
|
5592
5873
|
*
|
|
5593
|
-
*
|
|
5874
|
+
* **Example** (Emitting values that changed by equivalence)
|
|
5875
|
+
*
|
|
5594
5876
|
* ```ts
|
|
5595
5877
|
* import { Console, Effect, Stream } from "effect"
|
|
5596
5878
|
*
|
|
@@ -5607,8 +5889,8 @@ export const changes = self => changesWith(self, Equal.equals);
|
|
|
5607
5889
|
* // ["A", "B"]
|
|
5608
5890
|
* ```
|
|
5609
5891
|
*
|
|
5610
|
-
* @since 2.0.0
|
|
5611
5892
|
* @category Deduplication
|
|
5893
|
+
* @since 2.0.0
|
|
5612
5894
|
*/
|
|
5613
5895
|
export const changesWith = /*#__PURE__*/dual(2, (self, f) => transformPull(self, (pull, _scope) => Effect.sync(() => {
|
|
5614
5896
|
let first = true;
|
|
@@ -5636,7 +5918,8 @@ export const changesWith = /*#__PURE__*/dual(2, (self, f) => transformPull(self,
|
|
|
5636
5918
|
*
|
|
5637
5919
|
* The predicate runs for each element after the first; returning `true` treats it as equal and skips it.
|
|
5638
5920
|
*
|
|
5639
|
-
*
|
|
5921
|
+
* **Example** (Effectfully emitting changed values)
|
|
5922
|
+
*
|
|
5640
5923
|
* ```ts
|
|
5641
5924
|
* import { Console, Effect, Stream } from "effect"
|
|
5642
5925
|
*
|
|
@@ -5652,8 +5935,8 @@ export const changesWith = /*#__PURE__*/dual(2, (self, f) => transformPull(self,
|
|
|
5652
5935
|
* // { _id: "Chunk", values: [ 1, 2, 3 ] }
|
|
5653
5936
|
* ```
|
|
5654
5937
|
*
|
|
5655
|
-
* @since 2.0.0
|
|
5656
5938
|
* @category Deduplication
|
|
5939
|
+
* @since 2.0.0
|
|
5657
5940
|
*/
|
|
5658
5941
|
export const changesWithEffect = /*#__PURE__*/dual(2, (self, f) => transformPull(self, (pull, _scope) => Effect.sync(() => {
|
|
5659
5942
|
let first = true;
|
|
@@ -5679,7 +5962,8 @@ export const changesWithEffect = /*#__PURE__*/dual(2, (self, f) => transformPull
|
|
|
5679
5962
|
/**
|
|
5680
5963
|
* Decodes Uint8Array chunks into strings using TextDecoder with an optional encoding.
|
|
5681
5964
|
*
|
|
5682
|
-
*
|
|
5965
|
+
* **Example** (Decoding Uint8Array chunks into strings using TextDecoder with an optional encoding)
|
|
5966
|
+
*
|
|
5683
5967
|
* ```ts
|
|
5684
5968
|
* import { Console, Effect, Stream } from "effect"
|
|
5685
5969
|
*
|
|
@@ -5701,8 +5985,8 @@ export const changesWithEffect = /*#__PURE__*/dual(2, (self, f) => transformPull
|
|
|
5701
5985
|
* // ["Hello", " World"]
|
|
5702
5986
|
* ```
|
|
5703
5987
|
*
|
|
5704
|
-
* @since 2.0.0
|
|
5705
5988
|
* @category Encoding
|
|
5989
|
+
* @since 2.0.0
|
|
5706
5990
|
*/
|
|
5707
5991
|
export const decodeText = /*#__PURE__*/dual(args => isStream(args[0]), (self, options) => suspend(() => {
|
|
5708
5992
|
const decoder = new TextDecoder(options?.encoding);
|
|
@@ -5713,7 +5997,8 @@ export const decodeText = /*#__PURE__*/dual(args => isStream(args[0]), (self, op
|
|
|
5713
5997
|
/**
|
|
5714
5998
|
* Encodes a stream of strings into UTF-8 `Uint8Array` chunks.
|
|
5715
5999
|
*
|
|
5716
|
-
*
|
|
6000
|
+
* **Example** (Encoding a stream of strings into UTF-8 Uint8Array chunks)
|
|
6001
|
+
*
|
|
5717
6002
|
* ```ts
|
|
5718
6003
|
* import { Console, Effect, Stream } from "effect"
|
|
5719
6004
|
*
|
|
@@ -5729,8 +6014,8 @@ export const decodeText = /*#__PURE__*/dual(args => isStream(args[0]), (self, op
|
|
|
5729
6014
|
* // [[72, 101, 108, 108, 111], [32], [87, 111, 114, 108, 100]]
|
|
5730
6015
|
* ```
|
|
5731
6016
|
*
|
|
5732
|
-
* @since 2.0.0
|
|
5733
6017
|
* @category Encoding
|
|
6018
|
+
* @since 2.0.0
|
|
5734
6019
|
*/
|
|
5735
6020
|
export const encodeText = self => suspend(() => {
|
|
5736
6021
|
const encoder = new TextEncoder();
|
|
@@ -5739,7 +6024,8 @@ export const encodeText = self => suspend(() => {
|
|
|
5739
6024
|
/**
|
|
5740
6025
|
* Splits a stream of strings into lines, handling `\n`, `\r`, and `\r\n` delimiters across chunks.
|
|
5741
6026
|
*
|
|
5742
|
-
*
|
|
6027
|
+
* **Example** (Splitting streamed text into lines)
|
|
6028
|
+
*
|
|
5743
6029
|
* ```ts
|
|
5744
6030
|
* import { Console, Effect, Stream } from "effect"
|
|
5745
6031
|
*
|
|
@@ -5752,14 +6038,15 @@ export const encodeText = self => suspend(() => {
|
|
|
5752
6038
|
* // ["a", "b", "c"]
|
|
5753
6039
|
* ```
|
|
5754
6040
|
*
|
|
5755
|
-
* @since 2.0.0
|
|
5756
6041
|
* @category Encoding
|
|
6042
|
+
* @since 2.0.0
|
|
5757
6043
|
*/
|
|
5758
6044
|
export const splitLines = self => self.channel.pipe(Channel.pipeTo(Channel.splitLines()), fromChannel);
|
|
5759
6045
|
/**
|
|
5760
6046
|
* Inserts the provided element between emitted elements.
|
|
5761
6047
|
*
|
|
5762
|
-
*
|
|
6048
|
+
* **Example** (Interspersing stream elements)
|
|
6049
|
+
*
|
|
5763
6050
|
* ```ts
|
|
5764
6051
|
* import { Console, Effect, Stream } from "effect"
|
|
5765
6052
|
*
|
|
@@ -5773,8 +6060,8 @@ export const splitLines = self => self.channel.pipe(Channel.pipeTo(Channel.split
|
|
|
5773
6060
|
* // [1, 0, 2, 0, 3, 0, 4]
|
|
5774
6061
|
* ```
|
|
5775
6062
|
*
|
|
5776
|
-
* @since 2.0.0
|
|
5777
6063
|
* @category Sequencing
|
|
6064
|
+
* @since 2.0.0
|
|
5778
6065
|
*/
|
|
5779
6066
|
export const intersperse = /*#__PURE__*/dual(2, (self, element) => mapArray(self, (arr, i) => {
|
|
5780
6067
|
const out = i === 0 ? [] : [element];
|
|
@@ -5793,7 +6080,8 @@ export const intersperse = /*#__PURE__*/dual(2, (self, element) => mapArray(self
|
|
|
5793
6080
|
*
|
|
5794
6081
|
* The start and end values are always emitted, even when the stream is empty.
|
|
5795
6082
|
*
|
|
5796
|
-
*
|
|
6083
|
+
* **Example** (Interspersing stream affixes)
|
|
6084
|
+
*
|
|
5797
6085
|
* ```ts
|
|
5798
6086
|
* import { Console, Effect, Stream } from "effect"
|
|
5799
6087
|
*
|
|
@@ -5810,8 +6098,8 @@ export const intersperse = /*#__PURE__*/dual(2, (self, element) => mapArray(self
|
|
|
5810
6098
|
* // [ "[", "a", ",", "b", ",", "c", "]" ]
|
|
5811
6099
|
* ```
|
|
5812
6100
|
*
|
|
5813
|
-
* @since 2.0.0
|
|
5814
6101
|
* @category Sequencing
|
|
6102
|
+
* @since 2.0.0
|
|
5815
6103
|
*/
|
|
5816
6104
|
export const intersperseAffixes = /*#__PURE__*/dual(2, (self, options) => succeed(options.start).pipe(concat(intersperse(self, options.middle)), concat(succeed(options.end))));
|
|
5817
6105
|
/**
|
|
@@ -5819,7 +6107,8 @@ export const intersperseAffixes = /*#__PURE__*/dual(2, (self, options) => succee
|
|
|
5819
6107
|
* each stream; when one ends, the remaining values from the other stream are
|
|
5820
6108
|
* emitted.
|
|
5821
6109
|
*
|
|
5822
|
-
*
|
|
6110
|
+
* **Example** (Interleaving streams)
|
|
6111
|
+
*
|
|
5823
6112
|
* ```ts
|
|
5824
6113
|
* import { Console, Effect, Stream } from "effect"
|
|
5825
6114
|
*
|
|
@@ -5836,8 +6125,8 @@ export const intersperseAffixes = /*#__PURE__*/dual(2, (self, options) => succee
|
|
|
5836
6125
|
* Effect.runPromise(program)
|
|
5837
6126
|
* // [2, 5, 3, 6, 7]
|
|
5838
6127
|
* ```
|
|
5839
|
-
* @since 2.0.0
|
|
5840
6128
|
* @category Merging
|
|
6129
|
+
* @since 2.0.0
|
|
5841
6130
|
*/
|
|
5842
6131
|
export const interleave = /*#__PURE__*/dual(2, (self, that) => interleaveWith(self, that, fromIterable(Iterable.forever([true, false]))));
|
|
5843
6132
|
/**
|
|
@@ -5846,7 +6135,8 @@ export const interleave = /*#__PURE__*/dual(2, (self, that) => interleaveWith(se
|
|
|
5846
6135
|
* The decider controls how many elements are pulled; if one side ends, pulls for
|
|
5847
6136
|
* that side are ignored.
|
|
5848
6137
|
*
|
|
5849
|
-
*
|
|
6138
|
+
* **Example** (Interleaving two streams deterministically by following a boolean decider stream)
|
|
6139
|
+
*
|
|
5850
6140
|
* ```ts
|
|
5851
6141
|
* import { Console, Effect, Stream } from "effect"
|
|
5852
6142
|
*
|
|
@@ -5866,8 +6156,8 @@ export const interleave = /*#__PURE__*/dual(2, (self, that) => interleaveWith(se
|
|
|
5866
6156
|
* // [ 1, 2, 4, 3, 5 ]
|
|
5867
6157
|
* ```
|
|
5868
6158
|
*
|
|
5869
|
-
* @since 2.0.0
|
|
5870
6159
|
* @category Merging
|
|
6160
|
+
* @since 2.0.0
|
|
5871
6161
|
*/
|
|
5872
6162
|
export const interleaveWith = /*#__PURE__*/dual(3, (self, that, decider) => fromChannel(Channel.fromTransform(Effect.fnUntraced(function* (upstream, scope) {
|
|
5873
6163
|
const pullDecider = yield* Channel.toTransform(Channel.flattenArray(decider.channel))(upstream, scope);
|
|
@@ -5905,7 +6195,8 @@ export const interleaveWith = /*#__PURE__*/dual(3, (self, that, decider) => from
|
|
|
5905
6195
|
* If the effect completes with a failure before the stream completes, the
|
|
5906
6196
|
* returned stream will emit that failure.
|
|
5907
6197
|
*
|
|
5908
|
-
*
|
|
6198
|
+
* **Example** (Interrupting when an effect completes)
|
|
6199
|
+
*
|
|
5909
6200
|
* ```ts
|
|
5910
6201
|
* import { Console, Deferred, Effect, Stream } from "effect"
|
|
5911
6202
|
*
|
|
@@ -5928,14 +6219,15 @@ export const interleaveWith = /*#__PURE__*/dual(3, (self, that, decider) => from
|
|
|
5928
6219
|
* // => [1, 2]
|
|
5929
6220
|
* ```
|
|
5930
6221
|
*
|
|
5931
|
-
* @since 2.0.0
|
|
5932
6222
|
* @category Interruption
|
|
6223
|
+
* @since 2.0.0
|
|
5933
6224
|
*/
|
|
5934
6225
|
export const interruptWhen = /*#__PURE__*/dual(2, (self, effect) => fromChannel(Channel.interruptWhen(self.channel, effect)));
|
|
5935
6226
|
/**
|
|
5936
6227
|
* Halts evaluation after the current element once the provided effect completes; the effect is forked, its success is discarded, failures fail the stream, and it does not interrupt an in-progress pull (use `interruptWhen` for that).
|
|
5937
6228
|
*
|
|
5938
|
-
*
|
|
6229
|
+
* **Example** (Halting a stream after an effect completes)
|
|
6230
|
+
*
|
|
5939
6231
|
* ```ts
|
|
5940
6232
|
* import { Console, Deferred, Effect, Stream } from "effect"
|
|
5941
6233
|
*
|
|
@@ -5954,14 +6246,15 @@ export const interruptWhen = /*#__PURE__*/dual(2, (self, effect) => fromChannel(
|
|
|
5954
6246
|
* // [1, 2]
|
|
5955
6247
|
* ```
|
|
5956
6248
|
*
|
|
5957
|
-
* @since 2.0.0
|
|
5958
6249
|
* @category Interruption
|
|
6250
|
+
* @since 2.0.0
|
|
5959
6251
|
*/
|
|
5960
6252
|
export const haltWhen = /*#__PURE__*/dual(2, (self, effect) => fromChannel(Channel.haltWhen(self.channel, effect)));
|
|
5961
6253
|
/**
|
|
5962
6254
|
* Runs the provided finalizer when the stream exits, passing the exit value.
|
|
5963
6255
|
*
|
|
5964
|
-
*
|
|
6256
|
+
* **Example** (Running a finalizer on exit)
|
|
6257
|
+
*
|
|
5965
6258
|
* ```ts
|
|
5966
6259
|
* import { Console, Effect, Exit, Stream } from "effect"
|
|
5967
6260
|
*
|
|
@@ -5980,8 +6273,8 @@ export const haltWhen = /*#__PURE__*/dual(2, (self, effect) => fromChannel(Chann
|
|
|
5980
6273
|
* // Stream completed successfully
|
|
5981
6274
|
* ```
|
|
5982
6275
|
*
|
|
5983
|
-
* @since 4.0.0
|
|
5984
6276
|
* @category Finalization
|
|
6277
|
+
* @since 4.0.0
|
|
5985
6278
|
*/
|
|
5986
6279
|
export const onExit = /*#__PURE__*/dual(2, (self, finalizer) => fromChannel(Channel.onExit(self.channel, finalizer)));
|
|
5987
6280
|
/**
|
|
@@ -5990,7 +6283,8 @@ export const onExit = /*#__PURE__*/dual(2, (self, finalizer) => fromChannel(Chan
|
|
|
5990
6283
|
* Note: Unlike `Effect.onError` there is no guarantee that the provided
|
|
5991
6284
|
* effect will not be interrupted.
|
|
5992
6285
|
*
|
|
5993
|
-
*
|
|
6286
|
+
* **Example** (Running an effect on errors)
|
|
6287
|
+
*
|
|
5994
6288
|
* ```ts
|
|
5995
6289
|
* import { Cause, Console, Effect, Stream } from "effect"
|
|
5996
6290
|
*
|
|
@@ -6008,14 +6302,15 @@ export const onExit = /*#__PURE__*/dual(2, (self, finalizer) => fromChannel(Chan
|
|
|
6008
6302
|
* // Stream failed: boom
|
|
6009
6303
|
* ```
|
|
6010
6304
|
*
|
|
6011
|
-
* @since 2.0.0
|
|
6012
6305
|
* @category Error Handling
|
|
6306
|
+
* @since 2.0.0
|
|
6013
6307
|
*/
|
|
6014
6308
|
export const onError = /*#__PURE__*/dual(2, (self, cleanup) => fromChannel(Channel.onError(self.channel, cleanup)));
|
|
6015
6309
|
/**
|
|
6016
6310
|
* Runs the provided effect before this stream starts.
|
|
6017
6311
|
*
|
|
6018
|
-
*
|
|
6312
|
+
* **Example** (Running an effect on start)
|
|
6313
|
+
*
|
|
6019
6314
|
* ```ts
|
|
6020
6315
|
* import { Console, Effect, Stream } from "effect"
|
|
6021
6316
|
*
|
|
@@ -6034,14 +6329,15 @@ export const onError = /*#__PURE__*/dual(2, (self, cleanup) => fromChannel(Chann
|
|
|
6034
6329
|
* // [1, 2, 3]
|
|
6035
6330
|
* ```
|
|
6036
6331
|
*
|
|
6037
|
-
* @since 4.0.0
|
|
6038
6332
|
* @category Sequencing
|
|
6333
|
+
* @since 4.0.0
|
|
6039
6334
|
*/
|
|
6040
6335
|
export const onStart = /*#__PURE__*/dual(2, (self, onStart) => fromChannel(Channel.onStart(self.channel, onStart)));
|
|
6041
6336
|
/**
|
|
6042
6337
|
* Runs the provided effect with the first element emitted by the stream.
|
|
6043
6338
|
*
|
|
6044
|
-
*
|
|
6339
|
+
* **Example** (Running an effect on the first value)
|
|
6340
|
+
*
|
|
6045
6341
|
* ```ts
|
|
6046
6342
|
* import { Console, Effect, Stream } from "effect"
|
|
6047
6343
|
*
|
|
@@ -6054,14 +6350,15 @@ export const onStart = /*#__PURE__*/dual(2, (self, onStart) => fromChannel(Chann
|
|
|
6054
6350
|
* // Output: first=1
|
|
6055
6351
|
* ```
|
|
6056
6352
|
*
|
|
6057
|
-
* @since 4.0.0
|
|
6058
6353
|
* @category Sequencing
|
|
6354
|
+
* @since 4.0.0
|
|
6059
6355
|
*/
|
|
6060
6356
|
export const onFirst = /*#__PURE__*/dual(2, (self, onFirst) => fromChannel(Channel.onFirst(self.channel, arr => onFirst(arr[0]))));
|
|
6061
6357
|
/**
|
|
6062
6358
|
* Runs the provided effect when the stream ends successfully.
|
|
6063
6359
|
*
|
|
6064
|
-
*
|
|
6360
|
+
* **Example** (Running an effect on end)
|
|
6361
|
+
*
|
|
6065
6362
|
* ```ts
|
|
6066
6363
|
* import { Console, Effect, Stream } from "effect"
|
|
6067
6364
|
*
|
|
@@ -6078,14 +6375,15 @@ export const onFirst = /*#__PURE__*/dual(2, (self, onFirst) => fromChannel(Chann
|
|
|
6078
6375
|
* // [1, 2, 3]
|
|
6079
6376
|
* ```
|
|
6080
6377
|
*
|
|
6081
|
-
* @since 4.0.0
|
|
6082
6378
|
* @category Sequencing
|
|
6379
|
+
* @since 4.0.0
|
|
6083
6380
|
*/
|
|
6084
6381
|
export const onEnd = /*#__PURE__*/dual(2, (self, onEnd) => fromChannel(Channel.onEnd(self.channel, onEnd)));
|
|
6085
6382
|
/**
|
|
6086
6383
|
* Executes the provided finalizer after this stream's finalizers run.
|
|
6087
6384
|
*
|
|
6088
|
-
*
|
|
6385
|
+
* **Example** (Ensuring finalization)
|
|
6386
|
+
*
|
|
6089
6387
|
* ```ts
|
|
6090
6388
|
* import { Console, Effect, Stream } from "effect"
|
|
6091
6389
|
*
|
|
@@ -6103,8 +6401,8 @@ export const onEnd = /*#__PURE__*/dual(2, (self, onEnd) => fromChannel(Channel.o
|
|
|
6103
6401
|
* //=> [1, 2]
|
|
6104
6402
|
* ```
|
|
6105
6403
|
*
|
|
6106
|
-
* @since 4.0.0
|
|
6107
6404
|
* @category Finalization
|
|
6405
|
+
* @since 4.0.0
|
|
6108
6406
|
*/
|
|
6109
6407
|
export const ensuring = /*#__PURE__*/dual(2, (self, finalizer) => fromChannel(Channel.ensuring(self.channel, finalizer)));
|
|
6110
6408
|
/**
|
|
@@ -6114,7 +6412,8 @@ export const ensuring = /*#__PURE__*/dual(2, (self, finalizer) => fromChannel(Ch
|
|
|
6114
6412
|
*
|
|
6115
6413
|
* **Previously Known As:** `provideSomeLayer`, `provideSomeContext`.
|
|
6116
6414
|
*
|
|
6117
|
-
*
|
|
6415
|
+
* **Example** (Providing stream requirements)
|
|
6416
|
+
*
|
|
6118
6417
|
* ```ts
|
|
6119
6418
|
* import { Console, Effect, Layer, Context, Stream } from "effect"
|
|
6120
6419
|
*
|
|
@@ -6140,14 +6439,15 @@ export const ensuring = /*#__PURE__*/dual(2, (self, finalizer) => fromChannel(Ch
|
|
|
6140
6439
|
* // ["Hello, Ada"]
|
|
6141
6440
|
* ```
|
|
6142
6441
|
*
|
|
6143
|
-
* @since 4.0.0
|
|
6144
6442
|
* @category Services
|
|
6443
|
+
* @since 4.0.0
|
|
6145
6444
|
*/
|
|
6146
6445
|
export const provide = /*#__PURE__*/dual(args => isStream(args[0]), (self, layer, options) => fromChannel(Channel.provide(self.channel, layer, options)));
|
|
6147
6446
|
/**
|
|
6148
6447
|
* Provides multiple services to the stream using a context.
|
|
6149
6448
|
*
|
|
6150
|
-
*
|
|
6449
|
+
* **Example** (Providing multiple services to the stream using a context)
|
|
6450
|
+
*
|
|
6151
6451
|
* ```ts
|
|
6152
6452
|
* import { Console, Effect, Context, Stream } from "effect"
|
|
6153
6453
|
*
|
|
@@ -6175,15 +6475,16 @@ export const provide = /*#__PURE__*/dual(args => isStream(args[0]), (self, layer
|
|
|
6175
6475
|
* // ["Hello!"]
|
|
6176
6476
|
* ```
|
|
6177
6477
|
*
|
|
6178
|
-
* @since 4.0.0
|
|
6179
6478
|
* @category Services
|
|
6479
|
+
* @since 4.0.0
|
|
6180
6480
|
*/
|
|
6181
6481
|
export const provideContext = /*#__PURE__*/dual(2, (self, context) => fromChannel(Channel.provideContext(self.channel, context)));
|
|
6182
6482
|
/**
|
|
6183
6483
|
* Provides the stream with a single required service, eliminating that
|
|
6184
6484
|
* requirement from its environment.
|
|
6185
6485
|
*
|
|
6186
|
-
*
|
|
6486
|
+
* **Example** (Providing a stream service)
|
|
6487
|
+
*
|
|
6187
6488
|
* ```ts
|
|
6188
6489
|
* import { Console, Effect, Context, Stream } from "effect"
|
|
6189
6490
|
*
|
|
@@ -6212,14 +6513,15 @@ export const provideContext = /*#__PURE__*/dual(2, (self, context) => fromChanne
|
|
|
6212
6513
|
* //=> ["Hello, Ada"]
|
|
6213
6514
|
* ```
|
|
6214
6515
|
*
|
|
6215
|
-
* @since 4.0.0
|
|
6216
6516
|
* @category Services
|
|
6517
|
+
* @since 4.0.0
|
|
6217
6518
|
*/
|
|
6218
6519
|
export const provideService = /*#__PURE__*/dual(3, (self, key, service) => fromChannel(Channel.provideService(self.channel, key, service)));
|
|
6219
6520
|
/**
|
|
6220
6521
|
* Provides a service to the stream using an effect, removing the requirement and adding the effect's error and environment.
|
|
6221
6522
|
*
|
|
6222
|
-
*
|
|
6523
|
+
* **Example** (Providing a stream service effectfully)
|
|
6524
|
+
*
|
|
6223
6525
|
* ```ts
|
|
6224
6526
|
* import { Console, Effect, Context, Stream } from "effect"
|
|
6225
6527
|
*
|
|
@@ -6251,15 +6553,16 @@ export const provideService = /*#__PURE__*/dual(3, (self, key, service) => fromC
|
|
|
6251
6553
|
* // ["https://example.com"]
|
|
6252
6554
|
* ```
|
|
6253
6555
|
*
|
|
6254
|
-
* @since 4.0.0
|
|
6255
6556
|
* @category Services
|
|
6557
|
+
* @since 4.0.0
|
|
6256
6558
|
*/
|
|
6257
6559
|
export const provideServiceEffect = /*#__PURE__*/dual(3, (self, key, service) => fromChannel(Channel.provideServiceEffect(self.channel, key, service)));
|
|
6258
6560
|
/**
|
|
6259
6561
|
* Transforms the stream's required services by mapping the current context
|
|
6260
6562
|
* to a new one.
|
|
6261
6563
|
*
|
|
6262
|
-
*
|
|
6564
|
+
* **Example** (Updating the stream context)
|
|
6565
|
+
*
|
|
6263
6566
|
* ```ts
|
|
6264
6567
|
* import { Console, Effect, Context, Stream } from "effect"
|
|
6265
6568
|
*
|
|
@@ -6291,14 +6594,15 @@ export const provideServiceEffect = /*#__PURE__*/dual(3, (self, key, service) =>
|
|
|
6291
6594
|
* //=> [ "Hello World" ]
|
|
6292
6595
|
* ```
|
|
6293
6596
|
*
|
|
6294
|
-
* @since 2.0.0
|
|
6295
6597
|
* @category Services
|
|
6598
|
+
* @since 2.0.0
|
|
6296
6599
|
*/
|
|
6297
6600
|
export const updateContext = /*#__PURE__*/dual(2, (self, f) => fromChannel(Channel.updateContext(self.channel, f)));
|
|
6298
6601
|
/**
|
|
6299
6602
|
* Updates a single service in the stream environment by applying a function.
|
|
6300
6603
|
*
|
|
6301
|
-
*
|
|
6604
|
+
* **Example** (Updating a stream service)
|
|
6605
|
+
*
|
|
6302
6606
|
* ```ts
|
|
6303
6607
|
* import { Console, Effect, Context, Stream } from "effect"
|
|
6304
6608
|
*
|
|
@@ -6317,14 +6621,15 @@ export const updateContext = /*#__PURE__*/dual(2, (self, f) => fromChannel(Chann
|
|
|
6317
6621
|
* // Output: Updated count: 1
|
|
6318
6622
|
* ```
|
|
6319
6623
|
*
|
|
6320
|
-
* @since 2.0.0
|
|
6321
6624
|
* @category Services
|
|
6625
|
+
* @since 2.0.0
|
|
6322
6626
|
*/
|
|
6323
6627
|
export const updateService = /*#__PURE__*/dual(3, (self, service, f) => updateContext(self, context => Context.add(context, service, f(Context.get(context, service)))));
|
|
6324
6628
|
/**
|
|
6325
6629
|
* Wraps the stream with a new span for tracing.
|
|
6326
6630
|
*
|
|
6327
|
-
*
|
|
6631
|
+
* **Example** (Wrapping a stream in a span)
|
|
6632
|
+
*
|
|
6328
6633
|
* ```ts
|
|
6329
6634
|
* import { Console, Effect, Stream } from "effect"
|
|
6330
6635
|
*
|
|
@@ -6339,8 +6644,8 @@ export const updateService = /*#__PURE__*/dual(3, (self, service, f) => updateCo
|
|
|
6339
6644
|
* // [1, 2, 3]
|
|
6340
6645
|
* ```
|
|
6341
6646
|
*
|
|
6342
|
-
* @since 4.0.0
|
|
6343
6647
|
* @category Tracing
|
|
6648
|
+
* @since 4.0.0
|
|
6344
6649
|
*/
|
|
6345
6650
|
export const withSpan = function () {
|
|
6346
6651
|
const dataFirst = isStream(arguments[0]);
|
|
@@ -6355,7 +6660,8 @@ export const withSpan = function () {
|
|
|
6355
6660
|
/**
|
|
6356
6661
|
* Provides the entry point for do-notation style stream composition.
|
|
6357
6662
|
*
|
|
6358
|
-
*
|
|
6663
|
+
* **Example** (Starting stream do notation)
|
|
6664
|
+
*
|
|
6359
6665
|
* ```ts
|
|
6360
6666
|
* import { Console, Effect, Stream, pipe } from "effect"
|
|
6361
6667
|
*
|
|
@@ -6374,8 +6680,8 @@ export const withSpan = function () {
|
|
|
6374
6680
|
* //=> [{ value: 1, next: 2 }, { value: 2, next: 3 }]
|
|
6375
6681
|
* ```
|
|
6376
6682
|
*
|
|
6377
|
-
* @since 4.0.0
|
|
6378
6683
|
* @category Do Notation
|
|
6684
|
+
* @since 4.0.0
|
|
6379
6685
|
*/
|
|
6380
6686
|
export const Do = /*#__PURE__*/succeed({});
|
|
6381
6687
|
const let_ = /*#__PURE__*/dual(3, (self, name, f) => map(self, a => ({
|
|
@@ -6386,7 +6692,8 @@ export {
|
|
|
6386
6692
|
/**
|
|
6387
6693
|
* Adds a computed field to the current Do-notation record.
|
|
6388
6694
|
*
|
|
6389
|
-
*
|
|
6695
|
+
* **Example** (Adding a computed field)
|
|
6696
|
+
*
|
|
6390
6697
|
* ```ts
|
|
6391
6698
|
* import { Console, Effect, Stream } from "effect"
|
|
6392
6699
|
*
|
|
@@ -6404,14 +6711,15 @@ export {
|
|
|
6404
6711
|
* // [{ x: 2, y: 6 }]
|
|
6405
6712
|
* ```
|
|
6406
6713
|
*
|
|
6407
|
-
* @since 4.0.0
|
|
6408
6714
|
* @category Do Notation
|
|
6715
|
+
* @since 4.0.0
|
|
6409
6716
|
*/
|
|
6410
6717
|
let_ as let };
|
|
6411
6718
|
/**
|
|
6412
6719
|
* Binds the result of a stream to a field in the do-notation record.
|
|
6413
6720
|
*
|
|
6414
|
-
*
|
|
6721
|
+
* **Example** (Binding a stream value)
|
|
6722
|
+
*
|
|
6415
6723
|
* ```ts
|
|
6416
6724
|
* import { Console, Effect, Stream } from "effect"
|
|
6417
6725
|
*
|
|
@@ -6426,8 +6734,8 @@ let_ as let };
|
|
|
6426
6734
|
* // [{ a: 1, b: 2 }, { a: 2, b: 3 }]
|
|
6427
6735
|
* ```
|
|
6428
6736
|
*
|
|
6429
|
-
* @since 4.0.0
|
|
6430
6737
|
* @category Do Notation
|
|
6738
|
+
* @since 4.0.0
|
|
6431
6739
|
*/
|
|
6432
6740
|
export const bind = /*#__PURE__*/dual(args => isStream(args[0]), (self, tag, f, options) => flatMap(self, a => map(f(a), b => ({
|
|
6433
6741
|
...a,
|
|
@@ -6436,7 +6744,8 @@ export const bind = /*#__PURE__*/dual(args => isStream(args[0]), (self, tag, f,
|
|
|
6436
6744
|
/**
|
|
6437
6745
|
* Binds an Effect-produced value into the do-notation record for each stream element.
|
|
6438
6746
|
*
|
|
6439
|
-
*
|
|
6747
|
+
* **Example** (Binding an effect value)
|
|
6748
|
+
*
|
|
6440
6749
|
* ```ts
|
|
6441
6750
|
* import { Console, Effect, Stream } from "effect"
|
|
6442
6751
|
*
|
|
@@ -6454,8 +6763,8 @@ export const bind = /*#__PURE__*/dual(args => isStream(args[0]), (self, tag, f,
|
|
|
6454
6763
|
* // [{ value: 1, double: 2 }, { value: 2, double: 4 }]
|
|
6455
6764
|
* ```
|
|
6456
6765
|
*
|
|
6457
|
-
* @since 4.0.0
|
|
6458
6766
|
* @category Do Notation
|
|
6767
|
+
* @since 4.0.0
|
|
6459
6768
|
*/
|
|
6460
6769
|
export const bindEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self, tag, f, options) => mapEffect(self, a => Effect.map(f(a), b => ({
|
|
6461
6770
|
...a,
|
|
@@ -6464,7 +6773,8 @@ export const bindEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self, ta
|
|
|
6464
6773
|
/**
|
|
6465
6774
|
* Maps each element into a record keyed by the provided name.
|
|
6466
6775
|
*
|
|
6467
|
-
*
|
|
6776
|
+
* **Example** (Binding values to a record key)
|
|
6777
|
+
*
|
|
6468
6778
|
* ```ts
|
|
6469
6779
|
* import { Console, Effect, Stream } from "effect"
|
|
6470
6780
|
*
|
|
@@ -6485,7 +6795,8 @@ export const bindTo = /*#__PURE__*/dual(2, (self, name) => map(self, a => ({
|
|
|
6485
6795
|
/**
|
|
6486
6796
|
* Runs a stream with a sink and returns the sink result.
|
|
6487
6797
|
*
|
|
6488
|
-
*
|
|
6798
|
+
* **Example** (Running a stream with a sink)
|
|
6799
|
+
*
|
|
6489
6800
|
* ```ts
|
|
6490
6801
|
* import { Console, Effect, Sink, Stream } from "effect"
|
|
6491
6802
|
*
|
|
@@ -6495,14 +6806,15 @@ export const bindTo = /*#__PURE__*/dual(2, (self, name) => map(self, a => ({
|
|
|
6495
6806
|
* // 6
|
|
6496
6807
|
* ```
|
|
6497
6808
|
*
|
|
6498
|
-
* @since 2.0.0
|
|
6499
6809
|
* @category Destructors
|
|
6810
|
+
* @since 2.0.0
|
|
6500
6811
|
*/
|
|
6501
6812
|
export const run = /*#__PURE__*/dual(2, (self, sink) => Effect.scopedWith(scope => Channel.toPullScoped(self.channel, scope).pipe(Effect.flatMap(upstream => sink.transform(upstream, scope)), Effect.map(([a]) => a))));
|
|
6502
6813
|
/**
|
|
6503
6814
|
* Runs the stream and collects all elements into an array.
|
|
6504
6815
|
*
|
|
6505
|
-
*
|
|
6816
|
+
* **Example** (Collecting stream values)
|
|
6817
|
+
*
|
|
6506
6818
|
* ```ts
|
|
6507
6819
|
* import { Console, Effect, Stream } from "effect"
|
|
6508
6820
|
*
|
|
@@ -6517,8 +6829,8 @@ export const run = /*#__PURE__*/dual(2, (self, sink) => Effect.scopedWith(scope
|
|
|
6517
6829
|
* // [1, 2, 3, 4, 5]
|
|
6518
6830
|
* ```
|
|
6519
6831
|
*
|
|
6520
|
-
* @since 2.0.0
|
|
6521
6832
|
* @category Destructors
|
|
6833
|
+
* @since 2.0.0
|
|
6522
6834
|
*/
|
|
6523
6835
|
export const runCollect = self => Channel.runFold(self.channel, () => [], (acc, chunk) => {
|
|
6524
6836
|
for (let i = 0; i < chunk.length; i++) {
|
|
@@ -6529,7 +6841,8 @@ export const runCollect = self => Channel.runFold(self.channel, () => [], (acc,
|
|
|
6529
6841
|
/**
|
|
6530
6842
|
* Runs the stream and returns the number of elements emitted.
|
|
6531
6843
|
*
|
|
6532
|
-
*
|
|
6844
|
+
* **Example** (Counting stream values)
|
|
6845
|
+
*
|
|
6533
6846
|
* ```ts
|
|
6534
6847
|
* import { Console, Effect, Stream } from "effect"
|
|
6535
6848
|
*
|
|
@@ -6544,14 +6857,15 @@ export const runCollect = self => Channel.runFold(self.channel, () => [], (acc,
|
|
|
6544
6857
|
* // 5
|
|
6545
6858
|
* ```
|
|
6546
6859
|
*
|
|
6547
|
-
* @since 2.0.0
|
|
6548
6860
|
* @category Destructors
|
|
6861
|
+
* @since 2.0.0
|
|
6549
6862
|
*/
|
|
6550
6863
|
export const runCount = self => Channel.runFold(self.channel, () => 0, (acc, chunk) => acc + chunk.length);
|
|
6551
6864
|
/**
|
|
6552
6865
|
* Runs the stream and returns the numeric sum of its elements.
|
|
6553
6866
|
*
|
|
6554
|
-
*
|
|
6867
|
+
* **Example** (Summing stream values)
|
|
6868
|
+
*
|
|
6555
6869
|
* ```ts
|
|
6556
6870
|
* import { Console, Effect, Stream } from "effect"
|
|
6557
6871
|
*
|
|
@@ -6564,8 +6878,8 @@ export const runCount = self => Channel.runFold(self.channel, () => 0, (acc, chu
|
|
|
6564
6878
|
* // 6
|
|
6565
6879
|
* ```
|
|
6566
6880
|
*
|
|
6567
|
-
* @since 2.0.0
|
|
6568
6881
|
* @category Destructors
|
|
6882
|
+
* @since 2.0.0
|
|
6569
6883
|
*/
|
|
6570
6884
|
export const runSum = self => Channel.runFold(self.channel, () => 0, (acc, chunk) => {
|
|
6571
6885
|
for (let i = 0; i < chunk.length; i++) {
|
|
@@ -6576,7 +6890,8 @@ export const runSum = self => Channel.runFold(self.channel, () => 0, (acc, chunk
|
|
|
6576
6890
|
/**
|
|
6577
6891
|
* Runs the stream and folds elements using a pure reducer.
|
|
6578
6892
|
*
|
|
6579
|
-
*
|
|
6893
|
+
* **Example** (Folding stream values)
|
|
6894
|
+
*
|
|
6580
6895
|
* ```ts
|
|
6581
6896
|
* import { Console, Effect, Stream } from "effect"
|
|
6582
6897
|
*
|
|
@@ -6593,8 +6908,8 @@ export const runSum = self => Channel.runFold(self.channel, () => 0, (acc, chunk
|
|
|
6593
6908
|
* // 6
|
|
6594
6909
|
* ```
|
|
6595
6910
|
*
|
|
6596
|
-
* @since 2.0.0
|
|
6597
6911
|
* @category Destructors
|
|
6912
|
+
* @since 2.0.0
|
|
6598
6913
|
*/
|
|
6599
6914
|
export const runFold = /*#__PURE__*/dual(3, (self, initial, f) => Channel.runFold(self.channel, initial, (acc, arr) => {
|
|
6600
6915
|
for (let i = 0; i < arr.length; i++) {
|
|
@@ -6605,7 +6920,8 @@ export const runFold = /*#__PURE__*/dual(3, (self, initial, f) => Channel.runFol
|
|
|
6605
6920
|
/**
|
|
6606
6921
|
* Runs the stream and folds elements using an effectful reducer.
|
|
6607
6922
|
*
|
|
6608
|
-
*
|
|
6923
|
+
* **Example** (Effectfully folding stream values)
|
|
6924
|
+
*
|
|
6609
6925
|
* ```ts
|
|
6610
6926
|
* import { Console, Effect, Stream } from "effect"
|
|
6611
6927
|
*
|
|
@@ -6622,8 +6938,8 @@ export const runFold = /*#__PURE__*/dual(3, (self, initial, f) => Channel.runFol
|
|
|
6622
6938
|
* // 6
|
|
6623
6939
|
* ```
|
|
6624
6940
|
*
|
|
6625
|
-
* @since 2.0.0
|
|
6626
6941
|
* @category Destructors
|
|
6942
|
+
* @since 2.0.0
|
|
6627
6943
|
*/
|
|
6628
6944
|
export const runFoldEffect = /*#__PURE__*/dual(3, (self, initial, f) => Channel.runFoldEffect(self.channel, initial, (acc, arr) => {
|
|
6629
6945
|
let i = 0;
|
|
@@ -6640,7 +6956,8 @@ export const runFoldEffect = /*#__PURE__*/dual(3, (self, initial, f) => Channel.
|
|
|
6640
6956
|
/**
|
|
6641
6957
|
* Runs the stream and returns the first element as an `Option`.
|
|
6642
6958
|
*
|
|
6643
|
-
*
|
|
6959
|
+
* **Example** (Getting the first stream value)
|
|
6960
|
+
*
|
|
6644
6961
|
* ```ts
|
|
6645
6962
|
* import { Console, Effect, Option, Stream } from "effect"
|
|
6646
6963
|
*
|
|
@@ -6653,21 +6970,22 @@ export const runFoldEffect = /*#__PURE__*/dual(3, (self, initial, f) => Channel.
|
|
|
6653
6970
|
* // 1
|
|
6654
6971
|
* ```
|
|
6655
6972
|
*
|
|
6656
|
-
* @since 2.0.0
|
|
6657
6973
|
* @category Destructors
|
|
6974
|
+
* @since 2.0.0
|
|
6658
6975
|
*/
|
|
6659
6976
|
export const runHead = self => Effect.map(Channel.runHead(self.channel), Option.map(Arr.getUnsafe(0)));
|
|
6660
6977
|
/**
|
|
6661
6978
|
* Runs the stream and returns the last element as an `Option`.
|
|
6662
6979
|
*
|
|
6663
|
-
* @since 2.0.0
|
|
6664
6980
|
* @category Destructors
|
|
6981
|
+
* @since 2.0.0
|
|
6665
6982
|
*/
|
|
6666
6983
|
export const runLast = self => Effect.map(Channel.runLast(self.channel), Option.map(Arr.lastNonEmpty));
|
|
6667
6984
|
/**
|
|
6668
6985
|
* Runs the provided effectful callback for each element of the stream.
|
|
6669
6986
|
*
|
|
6670
|
-
*
|
|
6987
|
+
* **Example** (Running an effect for each value)
|
|
6988
|
+
*
|
|
6671
6989
|
* ```ts
|
|
6672
6990
|
* import { Console, Effect, Stream } from "effect"
|
|
6673
6991
|
*
|
|
@@ -6683,8 +7001,8 @@ export const runLast = self => Effect.map(Channel.runLast(self.channel), Option.
|
|
|
6683
7001
|
* // Processing: 3
|
|
6684
7002
|
* ```
|
|
6685
7003
|
*
|
|
6686
|
-
* @since 2.0.0
|
|
6687
7004
|
* @category Destructors
|
|
7005
|
+
* @since 2.0.0
|
|
6688
7006
|
*/
|
|
6689
7007
|
export const runForEach = /*#__PURE__*/dual(2, (self, f) => Channel.runForEach(self.channel, arr => {
|
|
6690
7008
|
let i = 0;
|
|
@@ -6698,7 +7016,8 @@ export const runForEach = /*#__PURE__*/dual(2, (self, f) => Channel.runForEach(s
|
|
|
6698
7016
|
* Runs the stream, applying the effectful predicate to each element and
|
|
6699
7017
|
* stopping when it returns `false`.
|
|
6700
7018
|
*
|
|
6701
|
-
*
|
|
7019
|
+
* **Example** (Running effects while a predicate holds)
|
|
7020
|
+
*
|
|
6702
7021
|
* ```ts
|
|
6703
7022
|
* import { Console, Effect, Stream } from "effect"
|
|
6704
7023
|
*
|
|
@@ -6719,8 +7038,8 @@ export const runForEach = /*#__PURE__*/dual(2, (self, f) => Channel.runForEach(s
|
|
|
6719
7038
|
* // Processing: 3
|
|
6720
7039
|
* ```
|
|
6721
7040
|
*
|
|
6722
|
-
* @since 2.0.0
|
|
6723
7041
|
* @category Destructors
|
|
7042
|
+
* @since 2.0.0
|
|
6724
7043
|
*/
|
|
6725
7044
|
export const runForEachWhile = /*#__PURE__*/dual(2, (self, f) => Channel.runForEachWhile(self.channel, arr => {
|
|
6726
7045
|
let done = false;
|
|
@@ -6737,7 +7056,8 @@ export const runForEachWhile = /*#__PURE__*/dual(2, (self, f) => Channel.runForE
|
|
|
6737
7056
|
/**
|
|
6738
7057
|
* Consumes the stream in chunks, passing each non-empty array to the callback.
|
|
6739
7058
|
*
|
|
6740
|
-
*
|
|
7059
|
+
* **Example** (Consuming stream chunks)
|
|
7060
|
+
*
|
|
6741
7061
|
* ```ts
|
|
6742
7062
|
* import { Console, Effect, Stream } from "effect"
|
|
6743
7063
|
*
|
|
@@ -6753,14 +7073,15 @@ export const runForEachWhile = /*#__PURE__*/dual(2, (self, f) => Channel.runForE
|
|
|
6753
7073
|
* // Processing chunk: 1, 2, 3, 4, 5
|
|
6754
7074
|
* ```
|
|
6755
7075
|
*
|
|
6756
|
-
* @since 2.0.0
|
|
6757
7076
|
* @category Destructors
|
|
7077
|
+
* @since 2.0.0
|
|
6758
7078
|
*/
|
|
6759
7079
|
export const runForEachArray = /*#__PURE__*/dual(2, (self, f) => Channel.runForEach(self.channel, f));
|
|
6760
7080
|
/**
|
|
6761
7081
|
* Runs the stream for its effects, discarding emitted elements.
|
|
6762
7082
|
*
|
|
6763
|
-
*
|
|
7083
|
+
* **Example** (Draining a stream run)
|
|
7084
|
+
*
|
|
6764
7085
|
* ```ts
|
|
6765
7086
|
* import { Console, Effect, Stream } from "effect"
|
|
6766
7087
|
*
|
|
@@ -6778,8 +7099,8 @@ export const runForEachArray = /*#__PURE__*/dual(2, (self, f) => Channel.runForE
|
|
|
6778
7099
|
* // Processing: 3
|
|
6779
7100
|
* ```
|
|
6780
7101
|
*
|
|
6781
|
-
* @since 2.0.0
|
|
6782
7102
|
* @category Destructors
|
|
7103
|
+
* @since 2.0.0
|
|
6783
7104
|
*/
|
|
6784
7105
|
export const runDrain = self => Channel.runDrain(self.channel);
|
|
6785
7106
|
/**
|
|
@@ -6788,7 +7109,8 @@ export const runDrain = self => Channel.runDrain(self.channel);
|
|
|
6788
7109
|
* The pull fails with `Cause.Done` when the stream ends and with the stream
|
|
6789
7110
|
* error on failure.
|
|
6790
7111
|
*
|
|
6791
|
-
*
|
|
7112
|
+
* **Example** (Creating a scoped pull)
|
|
7113
|
+
*
|
|
6792
7114
|
* ```ts
|
|
6793
7115
|
* import { Console, Effect, Stream } from "effect"
|
|
6794
7116
|
*
|
|
@@ -6806,14 +7128,15 @@ export const runDrain = self => Channel.runDrain(self.channel);
|
|
|
6806
7128
|
* // [1, 2, 3]
|
|
6807
7129
|
* ```
|
|
6808
7130
|
*
|
|
6809
|
-
* @since 2.0.0
|
|
6810
7131
|
* @category Destructors
|
|
7132
|
+
* @since 2.0.0
|
|
6811
7133
|
*/
|
|
6812
7134
|
export const toPull = self => Channel.toPull(self.channel);
|
|
6813
7135
|
/**
|
|
6814
7136
|
* Concatenates all emitted strings into a single string.
|
|
6815
7137
|
*
|
|
6816
|
-
*
|
|
7138
|
+
* **Example** (Joining strings from a stream)
|
|
7139
|
+
*
|
|
6817
7140
|
* ```ts
|
|
6818
7141
|
* import { Console, Effect, Stream } from "effect"
|
|
6819
7142
|
*
|
|
@@ -6827,14 +7150,15 @@ export const toPull = self => Channel.toPull(self.channel);
|
|
|
6827
7150
|
* // Hello World!
|
|
6828
7151
|
* ```
|
|
6829
7152
|
*
|
|
6830
|
-
* @since 2.0.0
|
|
6831
7153
|
* @category Destructors
|
|
7154
|
+
* @since 2.0.0
|
|
6832
7155
|
*/
|
|
6833
7156
|
export const mkString = self => Channel.runFold(self.channel, () => "", (acc, chunk) => acc + chunk.join(""));
|
|
6834
7157
|
/**
|
|
6835
7158
|
* Concatenates the stream's `Uint8Array` chunks into a single `Uint8Array`.
|
|
6836
7159
|
*
|
|
6837
|
-
*
|
|
7160
|
+
* **Example** (Joining Uint8Array chunks)
|
|
7161
|
+
*
|
|
6838
7162
|
* ```ts
|
|
6839
7163
|
* import { Console, Effect, Stream } from "effect"
|
|
6840
7164
|
*
|
|
@@ -6848,8 +7172,8 @@ export const mkString = self => Channel.runFold(self.channel, () => "", (acc, ch
|
|
|
6848
7172
|
* // [1, 2, 3, 4]
|
|
6849
7173
|
* ```
|
|
6850
7174
|
*
|
|
6851
|
-
* @since 4.0.0
|
|
6852
7175
|
* @category Destructors
|
|
7176
|
+
* @since 4.0.0
|
|
6853
7177
|
*/
|
|
6854
7178
|
export const mkUint8Array = self => Effect.map(Channel.runFold(self.channel, () => ({
|
|
6855
7179
|
bytes: 0,
|
|
@@ -6878,7 +7202,8 @@ export const mkUint8Array = self => Effect.map(Channel.runFold(self.channel, ()
|
|
|
6878
7202
|
*
|
|
6879
7203
|
* See https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream.
|
|
6880
7204
|
*
|
|
6881
|
-
*
|
|
7205
|
+
* **Example** (Converting to a ReadableStream with services)
|
|
7206
|
+
*
|
|
6882
7207
|
* ```ts
|
|
6883
7208
|
* import { Context, Stream } from "effect"
|
|
6884
7209
|
*
|
|
@@ -6886,8 +7211,8 @@ export const mkUint8Array = self => Effect.map(Channel.runFold(self.channel, ()
|
|
|
6886
7211
|
* const readableStream = Stream.toReadableStreamWith(stream, Context.empty())
|
|
6887
7212
|
* ```
|
|
6888
7213
|
*
|
|
6889
|
-
* @since 2.0.0
|
|
6890
7214
|
* @category Destructors
|
|
7215
|
+
* @since 2.0.0
|
|
6891
7216
|
*/
|
|
6892
7217
|
export const toReadableStreamWith = /*#__PURE__*/dual(args => isStream(args[0]), (self, context, options) => {
|
|
6893
7218
|
let currentResolve = undefined;
|
|
@@ -6928,7 +7253,8 @@ export const toReadableStreamWith = /*#__PURE__*/dual(args => isStream(args[0]),
|
|
|
6928
7253
|
*
|
|
6929
7254
|
* See https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream.
|
|
6930
7255
|
*
|
|
6931
|
-
*
|
|
7256
|
+
* **Example** (Converting a stream to a ReadableStream)
|
|
7257
|
+
*
|
|
6932
7258
|
* ```ts
|
|
6933
7259
|
* import { Stream } from "effect"
|
|
6934
7260
|
*
|
|
@@ -6936,8 +7262,8 @@ export const toReadableStreamWith = /*#__PURE__*/dual(args => isStream(args[0]),
|
|
|
6936
7262
|
* const reader = readableStream.getReader()
|
|
6937
7263
|
* ```
|
|
6938
7264
|
*
|
|
6939
|
-
* @since 2.0.0
|
|
6940
7265
|
* @category Destructors
|
|
7266
|
+
* @since 2.0.0
|
|
6941
7267
|
*/
|
|
6942
7268
|
export const toReadableStream = /*#__PURE__*/dual(args => isStream(args[0]), (self, options) => toReadableStreamWith(self, Context.empty(), options));
|
|
6943
7269
|
/**
|
|
@@ -6945,7 +7271,8 @@ export const toReadableStream = /*#__PURE__*/dual(args => isStream(args[0]), (se
|
|
|
6945
7271
|
*
|
|
6946
7272
|
* See https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream.
|
|
6947
7273
|
*
|
|
6948
|
-
*
|
|
7274
|
+
* **Example** (Creating a ReadableStream effect)
|
|
7275
|
+
*
|
|
6949
7276
|
* ```ts
|
|
6950
7277
|
* import { Console, Effect, Stream } from "effect"
|
|
6951
7278
|
*
|
|
@@ -6959,14 +7286,15 @@ export const toReadableStream = /*#__PURE__*/dual(args => isStream(args[0]), (se
|
|
|
6959
7286
|
* Effect.runPromise(effect)
|
|
6960
7287
|
* ```
|
|
6961
7288
|
*
|
|
6962
|
-
* @since 2.0.0
|
|
6963
7289
|
* @category Destructors
|
|
7290
|
+
* @since 2.0.0
|
|
6964
7291
|
*/
|
|
6965
7292
|
export const toReadableStreamEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self, options) => Effect.map(Effect.context(), context => toReadableStreamWith(self, context, options)));
|
|
6966
7293
|
/**
|
|
6967
7294
|
* Converts the stream to an `AsyncIterable` using the provided services.
|
|
6968
7295
|
*
|
|
6969
|
-
*
|
|
7296
|
+
* **Example** (Converting to an AsyncIterable with services)
|
|
7297
|
+
*
|
|
6970
7298
|
* ```ts
|
|
6971
7299
|
* import { Context, Stream } from "effect"
|
|
6972
7300
|
*
|
|
@@ -6978,12 +7306,15 @@ export const toReadableStreamEffect = /*#__PURE__*/dual(args => isStream(args[0]
|
|
|
6978
7306
|
* for await (const value of iterable) {
|
|
6979
7307
|
* results.push(value)
|
|
6980
7308
|
* }
|
|
6981
|
-
*
|
|
7309
|
+
* console.log(results)
|
|
6982
7310
|
* }
|
|
7311
|
+
*
|
|
7312
|
+
* collect()
|
|
7313
|
+
* // [ 1, 2, 3 ]
|
|
6983
7314
|
* ```
|
|
6984
7315
|
*
|
|
6985
|
-
* @since 2.0.0
|
|
6986
7316
|
* @category Destructors
|
|
7317
|
+
* @since 2.0.0
|
|
6987
7318
|
*/
|
|
6988
7319
|
export const toAsyncIterableWith = /*#__PURE__*/dual(2, (self, context) => ({
|
|
6989
7320
|
[Symbol.asyncIterator]() {
|
|
@@ -7024,9 +7355,10 @@ export const toAsyncIterableWith = /*#__PURE__*/dual(2, (self, context) => ({
|
|
|
7024
7355
|
/**
|
|
7025
7356
|
* Creates an effect that yields an `AsyncIterable` using the current services.
|
|
7026
7357
|
*
|
|
7027
|
-
*
|
|
7358
|
+
* **Example** (Creating an AsyncIterable effect)
|
|
7359
|
+
*
|
|
7028
7360
|
* ```ts
|
|
7029
|
-
* import {
|
|
7361
|
+
* import { Effect, Stream } from "effect"
|
|
7030
7362
|
*
|
|
7031
7363
|
* const stream = Stream.make(1, 2, 3)
|
|
7032
7364
|
*
|
|
@@ -7039,41 +7371,42 @@ export const toAsyncIterableWith = /*#__PURE__*/dual(2, (self, context) => ({
|
|
|
7039
7371
|
* }
|
|
7040
7372
|
* return collected
|
|
7041
7373
|
* })
|
|
7042
|
-
* yield*
|
|
7374
|
+
* yield* Effect.sync(() => console.log(values))
|
|
7043
7375
|
* })
|
|
7044
7376
|
*
|
|
7045
7377
|
* Effect.runPromise(program)
|
|
7046
|
-
*
|
|
7378
|
+
* // [ 1, 2, 3 ]
|
|
7047
7379
|
* ```
|
|
7048
7380
|
*
|
|
7049
|
-
* @since 2.0.0
|
|
7050
7381
|
* @category Destructors
|
|
7382
|
+
* @since 2.0.0
|
|
7051
7383
|
*/
|
|
7052
7384
|
export const toAsyncIterableEffect = self => Effect.map(Effect.context(), context => toAsyncIterableWith(self, context));
|
|
7053
7385
|
/**
|
|
7054
7386
|
* Converts a stream to an `AsyncIterable` for `for await...of` consumption.
|
|
7055
7387
|
*
|
|
7056
|
-
*
|
|
7388
|
+
* **Example** (Converting to an async iterable)
|
|
7389
|
+
*
|
|
7057
7390
|
* ```ts
|
|
7058
|
-
* import {
|
|
7391
|
+
* import { Stream } from "effect"
|
|
7059
7392
|
*
|
|
7060
7393
|
* const stream = Stream.make(1, 2, 3)
|
|
7061
7394
|
*
|
|
7062
|
-
* const
|
|
7395
|
+
* const collect = async () => {
|
|
7063
7396
|
* const iterable = Stream.toAsyncIterable(stream)
|
|
7064
|
-
* const
|
|
7065
|
-
*
|
|
7066
|
-
*
|
|
7067
|
-
*
|
|
7068
|
-
*
|
|
7069
|
-
*
|
|
7070
|
-
*
|
|
7071
|
-
*
|
|
7072
|
-
*
|
|
7397
|
+
* const values: Array<number> = []
|
|
7398
|
+
* for await (const value of iterable) {
|
|
7399
|
+
* values.push(value)
|
|
7400
|
+
* }
|
|
7401
|
+
* console.log(values)
|
|
7402
|
+
* }
|
|
7403
|
+
*
|
|
7404
|
+
* collect()
|
|
7405
|
+
* // [ 1, 2, 3 ]
|
|
7073
7406
|
* ```
|
|
7074
7407
|
*
|
|
7075
|
-
* @since 2.0.0
|
|
7076
7408
|
* @category Destructors
|
|
7409
|
+
* @since 2.0.0
|
|
7077
7410
|
*/
|
|
7078
7411
|
export const toAsyncIterable = self => toAsyncIterableWith(self, Context.empty());
|
|
7079
7412
|
/**
|
|
@@ -7082,7 +7415,8 @@ export const toAsyncIterable = self => toAsyncIterableWith(self, Context.empty()
|
|
|
7082
7415
|
* `shutdownOnEnd` controls whether the PubSub is shut down when the stream ends.
|
|
7083
7416
|
* It only shuts down when set to `true`.
|
|
7084
7417
|
*
|
|
7085
|
-
*
|
|
7418
|
+
* **Example** (Running a stream into a PubSub)
|
|
7419
|
+
*
|
|
7086
7420
|
* ```ts
|
|
7087
7421
|
* import { Console, Effect, PubSub, Stream } from "effect"
|
|
7088
7422
|
*
|
|
@@ -7104,8 +7438,8 @@ export const toAsyncIterable = self => toAsyncIterableWith(self, Context.empty()
|
|
|
7104
7438
|
* //=> 2
|
|
7105
7439
|
* ```
|
|
7106
7440
|
*
|
|
7107
|
-
* @since 2.0.0
|
|
7108
7441
|
* @category Destructors
|
|
7442
|
+
* @since 2.0.0
|
|
7109
7443
|
*/
|
|
7110
7444
|
export const runIntoPubSub = /*#__PURE__*/dual(args => isStream(args[0]), (self, pubsub, options) => Channel.runIntoPubSubArray(self.channel, pubsub, options));
|
|
7111
7445
|
/**
|
|
@@ -7114,7 +7448,8 @@ export const runIntoPubSub = /*#__PURE__*/dual(args => isStream(args[0]), (self,
|
|
|
7114
7448
|
* `shutdownOnEnd` indicates whether the PubSub should be shut down when the
|
|
7115
7449
|
* stream ends. By default this is `true`.
|
|
7116
7450
|
*
|
|
7117
|
-
*
|
|
7451
|
+
* **Example** (Converting a stream to a PubSub for concurrent consumption)
|
|
7452
|
+
*
|
|
7118
7453
|
* ```ts
|
|
7119
7454
|
* import { Console, Effect, PubSub, Stream } from "effect"
|
|
7120
7455
|
*
|
|
@@ -7129,8 +7464,8 @@ export const runIntoPubSub = /*#__PURE__*/dual(args => isStream(args[0]), (self,
|
|
|
7129
7464
|
* }))
|
|
7130
7465
|
* ```
|
|
7131
7466
|
*
|
|
7132
|
-
* @since 2.0.0
|
|
7133
7467
|
* @category Destructors
|
|
7468
|
+
* @since 2.0.0
|
|
7134
7469
|
*/
|
|
7135
7470
|
export const toPubSub = /*#__PURE__*/dual(2, (self, options) => Channel.toPubSubArray(self.channel, options));
|
|
7136
7471
|
/**
|
|
@@ -7138,7 +7473,8 @@ export const toPubSub = /*#__PURE__*/dual(2, (self, options) => Channel.toPubSub
|
|
|
7138
7473
|
*
|
|
7139
7474
|
* `Take` values include the stream's end and failure signals.
|
|
7140
7475
|
*
|
|
7141
|
-
*
|
|
7476
|
+
* **Example** (Converting to a PubSub of takes)
|
|
7477
|
+
*
|
|
7142
7478
|
* ```ts
|
|
7143
7479
|
* import { Console, Effect, PubSub, Stream } from "effect"
|
|
7144
7480
|
*
|
|
@@ -7155,14 +7491,20 @@ export const toPubSub = /*#__PURE__*/dual(2, (self, options) => Channel.toPubSub
|
|
|
7155
7491
|
* })
|
|
7156
7492
|
* ```
|
|
7157
7493
|
*
|
|
7158
|
-
* @since 4.0.0
|
|
7159
7494
|
* @category Destructors
|
|
7495
|
+
* @since 4.0.0
|
|
7160
7496
|
*/
|
|
7161
7497
|
export const toPubSubTake = /*#__PURE__*/dual(2, (self, options) => Channel.toPubSubTake(self.channel, options));
|
|
7162
7498
|
/**
|
|
7163
|
-
*
|
|
7499
|
+
* Creates a scoped dequeue that is fed by the stream for concurrent
|
|
7500
|
+
* consumption.
|
|
7501
|
+
*
|
|
7502
|
+
* Elements are offered to the queue as the stream runs. Stream completion is
|
|
7503
|
+
* signaled with `Cause.Done`, stream failures fail the queue, and the queue is
|
|
7504
|
+
* shut down when the surrounding scope closes.
|
|
7505
|
+
*
|
|
7506
|
+
* **Example** (Converting a stream to a Queue for concurrent consumption)
|
|
7164
7507
|
*
|
|
7165
|
-
* @example
|
|
7166
7508
|
* ```ts
|
|
7167
7509
|
* import { Effect, Queue, Stream } from "effect"
|
|
7168
7510
|
*
|
|
@@ -7173,15 +7515,16 @@ export const toPubSubTake = /*#__PURE__*/dual(2, (self, options) => Channel.toPu
|
|
|
7173
7515
|
* })
|
|
7174
7516
|
* ```
|
|
7175
7517
|
*
|
|
7176
|
-
* @since 2.0.0
|
|
7177
7518
|
* @category Destructors
|
|
7519
|
+
* @since 2.0.0
|
|
7178
7520
|
*/
|
|
7179
7521
|
export const toQueue = /*#__PURE__*/dual(2, (self, options) => Channel.toQueueArray(self.channel, options));
|
|
7180
7522
|
/**
|
|
7181
7523
|
* Runs the stream, offering each element to the provided queue and ending it
|
|
7182
7524
|
* with `Cause.Done` when the stream completes.
|
|
7183
7525
|
*
|
|
7184
|
-
*
|
|
7526
|
+
* **Example** (Running a stream into a queue)
|
|
7527
|
+
*
|
|
7185
7528
|
* ```ts
|
|
7186
7529
|
* import { Cause, Effect, Queue, Stream } from "effect"
|
|
7187
7530
|
*
|
|
@@ -7203,8 +7546,8 @@ export const toQueue = /*#__PURE__*/dual(2, (self, options) => Channel.toQueueAr
|
|
|
7203
7546
|
* })
|
|
7204
7547
|
* ```
|
|
7205
7548
|
*
|
|
7206
|
-
* @since 2.0.0
|
|
7207
7549
|
* @category Destructors
|
|
7550
|
+
* @since 2.0.0
|
|
7208
7551
|
*/
|
|
7209
7552
|
export const runIntoQueue = /*#__PURE__*/dual(2, (self, queue) => Channel.runIntoQueueArray(self.channel, queue));
|
|
7210
7553
|
//# sourceMappingURL=Stream.js.map
|