effect 4.0.0-beta.102 → 4.0.0-beta.103
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 +971 -1037
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +381 -407
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +433 -756
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +200 -325
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts +207 -267
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +107 -135
- package/dist/BigInt.js.map +1 -1
- package/dist/Boolean.d.ts +146 -188
- package/dist/Boolean.d.ts.map +1 -1
- package/dist/Boolean.js +64 -84
- package/dist/Boolean.js.map +1 -1
- package/dist/Brand.js.map +1 -1
- package/dist/Cache.d.ts +405 -254
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +166 -101
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +167 -277
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Cause.js +122 -176
- package/dist/Cause.js.map +1 -1
- package/dist/Channel.d.ts +729 -768
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +514 -440
- package/dist/Channel.js.map +1 -1
- package/dist/ChannelSchema.d.ts +1 -1
- package/dist/ChannelSchema.d.ts.map +1 -1
- package/dist/ChannelSchema.js.map +1 -1
- package/dist/Chunk.d.ts +834 -1173
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +326 -439
- package/dist/Chunk.js.map +1 -1
- package/dist/Clock.d.ts +180 -49
- package/dist/Clock.d.ts.map +1 -1
- package/dist/Clock.js +96 -31
- package/dist/Clock.js.map +1 -1
- package/dist/Combiner.d.ts +20 -33
- package/dist/Combiner.d.ts.map +1 -1
- package/dist/Combiner.js +18 -30
- package/dist/Combiner.js.map +1 -1
- package/dist/Config.d.ts +225 -173
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +336 -265
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +194 -68
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +115 -80
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Console.d.ts +233 -33
- package/dist/Console.d.ts.map +1 -1
- package/dist/Console.js +232 -32
- package/dist/Console.js.map +1 -1
- package/dist/Context.d.ts +151 -274
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js +171 -214
- package/dist/Context.js.map +1 -1
- package/dist/Cron.d.ts +68 -77
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +57 -66
- package/dist/Cron.js.map +1 -1
- package/dist/Crypto.d.ts +13 -15
- package/dist/Crypto.d.ts.map +1 -1
- package/dist/Crypto.js +9 -10
- package/dist/Crypto.js.map +1 -1
- package/dist/Data.d.ts +60 -80
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js +16 -23
- package/dist/Data.js.map +1 -1
- package/dist/DateTime.d.ts +562 -660
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +307 -362
- package/dist/DateTime.js.map +1 -1
- package/dist/Deferred.d.ts +253 -256
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +104 -96
- package/dist/Deferred.js.map +1 -1
- package/dist/Duration.d.ts +216 -308
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +132 -186
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +2841 -3247
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +1322 -1546
- package/dist/Effect.js.map +1 -1
- package/dist/Effectable.js.map +1 -1
- package/dist/Encoding.d.ts +22 -40
- package/dist/Encoding.d.ts.map +1 -1
- package/dist/Encoding.js +22 -40
- package/dist/Encoding.js.map +1 -1
- package/dist/Equal.d.ts +33 -37
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +29 -21
- package/dist/Equal.js.map +1 -1
- package/dist/Equivalence.d.ts +103 -105
- package/dist/Equivalence.d.ts.map +1 -1
- package/dist/Equivalence.js +77 -79
- package/dist/Equivalence.js.map +1 -1
- package/dist/ErrorReporter.d.ts +51 -27
- package/dist/ErrorReporter.d.ts.map +1 -1
- package/dist/ErrorReporter.js +50 -26
- package/dist/ErrorReporter.js.map +1 -1
- package/dist/ExecutionPlan.d.ts +13 -55
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/ExecutionPlan.js +7 -28
- package/dist/ExecutionPlan.js.map +1 -1
- package/dist/Exit.d.ts +116 -192
- package/dist/Exit.d.ts.map +1 -1
- package/dist/Exit.js +82 -130
- package/dist/Exit.js.map +1 -1
- package/dist/Fiber.d.ts +82 -146
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js +48 -87
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.d.ts +152 -105
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +106 -73
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +213 -168
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +114 -89
- package/dist/FiberMap.js.map +1 -1
- package/dist/FiberSet.d.ts +123 -81
- package/dist/FiberSet.d.ts.map +1 -1
- package/dist/FiberSet.js +85 -59
- package/dist/FiberSet.js.map +1 -1
- package/dist/FileSystem.d.ts +153 -264
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +42 -147
- package/dist/FileSystem.js.map +1 -1
- package/dist/Filter.d.ts +61 -33
- package/dist/Filter.d.ts.map +1 -1
- package/dist/Filter.js +26 -15
- package/dist/Filter.js.map +1 -1
- package/dist/Formatter.d.ts +25 -33
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js +48 -49
- package/dist/Formatter.js.map +1 -1
- package/dist/Function.d.ts +76 -145
- package/dist/Function.d.ts.map +1 -1
- package/dist/Function.js +40 -57
- package/dist/Function.js.map +1 -1
- package/dist/Graph.d.ts +360 -714
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +168 -297
- package/dist/Graph.js.map +1 -1
- package/dist/HKT.d.ts +12 -6
- package/dist/HKT.d.ts.map +1 -1
- package/dist/Hash.d.ts +47 -83
- package/dist/Hash.d.ts.map +1 -1
- package/dist/Hash.js +46 -68
- package/dist/Hash.js.map +1 -1
- package/dist/HashMap.d.ts +319 -411
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashMap.js +122 -166
- package/dist/HashMap.js.map +1 -1
- package/dist/HashRing.d.ts.map +1 -1
- package/dist/HashRing.js +1 -0
- package/dist/HashRing.js.map +1 -1
- package/dist/HashSet.d.ts +177 -284
- package/dist/HashSet.d.ts.map +1 -1
- package/dist/HashSet.js +68 -109
- package/dist/HashSet.js.map +1 -1
- package/dist/Inspectable.d.ts +12 -12
- package/dist/Inspectable.js +8 -8
- package/dist/Inspectable.js.map +1 -1
- package/dist/Iterable.d.ts +620 -786
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +228 -306
- package/dist/Iterable.js.map +1 -1
- package/dist/JsonPatch.d.ts +11 -13
- package/dist/JsonPatch.d.ts.map +1 -1
- package/dist/JsonPatch.js +44 -102
- package/dist/JsonPatch.js.map +1 -1
- package/dist/JsonPointer.d.ts +8 -8
- package/dist/JsonPointer.js +8 -8
- package/dist/JsonPointer.js.map +1 -1
- package/dist/JsonSchema.d.ts +98 -44
- package/dist/JsonSchema.d.ts.map +1 -1
- package/dist/JsonSchema.js +297 -234
- package/dist/JsonSchema.js.map +1 -1
- package/dist/Latch.d.ts +23 -35
- package/dist/Latch.d.ts.map +1 -1
- package/dist/Latch.js +16 -28
- package/dist/Latch.js.map +1 -1
- package/dist/Layer.d.ts +359 -260
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +195 -175
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +42 -29
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +31 -21
- package/dist/LayerMap.js.map +1 -1
- package/dist/LayerRef.d.ts +6 -2
- package/dist/LayerRef.d.ts.map +1 -1
- package/dist/LayerRef.js +6 -2
- package/dist/LayerRef.js.map +1 -1
- package/dist/LogLevel.d.ts +114 -214
- package/dist/LogLevel.d.ts.map +1 -1
- package/dist/LogLevel.js +41 -76
- package/dist/LogLevel.js.map +1 -1
- package/dist/Logger.d.ts +218 -467
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +204 -450
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.d.ts +7 -5
- package/dist/ManagedRuntime.d.ts.map +1 -1
- package/dist/ManagedRuntime.js +7 -5
- package/dist/ManagedRuntime.js.map +1 -1
- package/dist/Match.d.ts +217 -252
- package/dist/Match.d.ts.map +1 -1
- package/dist/Match.js +150 -183
- package/dist/Match.js.map +1 -1
- package/dist/Metric.d.ts +442 -993
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +198 -642
- package/dist/Metric.js.map +1 -1
- package/dist/MutableHashMap.d.ts +144 -173
- package/dist/MutableHashMap.d.ts.map +1 -1
- package/dist/MutableHashMap.js +68 -79
- package/dist/MutableHashMap.js.map +1 -1
- package/dist/MutableHashSet.d.ts +84 -89
- package/dist/MutableHashSet.d.ts.map +1 -1
- package/dist/MutableHashSet.js +44 -47
- package/dist/MutableHashSet.js.map +1 -1
- package/dist/MutableList.d.ts +71 -370
- package/dist/MutableList.d.ts.map +1 -1
- package/dist/MutableList.js +59 -284
- package/dist/MutableList.js.map +1 -1
- package/dist/MutableRef.d.ts +420 -243
- package/dist/MutableRef.d.ts.map +1 -1
- package/dist/MutableRef.js +209 -120
- package/dist/MutableRef.js.map +1 -1
- package/dist/Newtype.d.ts +21 -14
- package/dist/Newtype.d.ts.map +1 -1
- package/dist/Newtype.js +15 -13
- package/dist/Newtype.js.map +1 -1
- package/dist/NonEmptyIterable.d.ts +7 -137
- package/dist/NonEmptyIterable.d.ts.map +1 -1
- package/dist/NonEmptyIterable.js +5 -93
- package/dist/NonEmptyIterable.js.map +1 -1
- package/dist/Number.d.ts +196 -233
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +90 -109
- package/dist/Number.js.map +1 -1
- package/dist/Optic.d.ts +97 -189
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js +187 -290
- package/dist/Optic.js.map +1 -1
- package/dist/Option.d.ts +447 -812
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +211 -392
- package/dist/Option.js.map +1 -1
- package/dist/Order.d.ts +109 -109
- package/dist/Order.js +91 -91
- package/dist/Order.js.map +1 -1
- package/dist/Ordering.d.ts +20 -23
- package/dist/Ordering.d.ts.map +1 -1
- package/dist/Ordering.js +8 -9
- package/dist/Ordering.js.map +1 -1
- package/dist/PartitionedSemaphore.js.map +1 -1
- package/dist/Path.d.ts +38 -41
- package/dist/Path.d.ts.map +1 -1
- package/dist/Path.js +3 -4
- package/dist/Path.js.map +1 -1
- package/dist/Pipeable.d.ts +6 -5
- package/dist/Pipeable.d.ts.map +1 -1
- package/dist/Pipeable.js +2 -2
- package/dist/Pipeable.js.map +1 -1
- package/dist/PlatformError.d.ts +4 -4
- package/dist/PlatformError.js +3 -3
- package/dist/PlatformError.js.map +1 -1
- package/dist/Pool.d.ts +4 -2
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +4 -2
- package/dist/Pool.js.map +1 -1
- package/dist/Predicate.d.ts +200 -181
- package/dist/Predicate.d.ts.map +1 -1
- package/dist/Predicate.js +100 -108
- package/dist/Predicate.js.map +1 -1
- package/dist/PrimaryKey.d.ts +7 -7
- package/dist/PrimaryKey.js +5 -5
- package/dist/PrimaryKey.js.map +1 -1
- package/dist/PubSub.d.ts +425 -494
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +373 -362
- package/dist/PubSub.js.map +1 -1
- package/dist/Pull.d.ts +24 -18
- package/dist/Pull.d.ts.map +1 -1
- package/dist/Pull.js +11 -9
- package/dist/Pull.js.map +1 -1
- package/dist/Queue.d.ts +200 -159
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +162 -132
- package/dist/Queue.js.map +1 -1
- package/dist/Random.d.ts +49 -74
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +35 -54
- package/dist/Random.js.map +1 -1
- package/dist/RcMap.d.ts +121 -63
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +42 -21
- package/dist/RcMap.js.map +1 -1
- package/dist/RcRef.d.ts +24 -13
- package/dist/RcRef.d.ts.map +1 -1
- package/dist/RcRef.js +15 -9
- package/dist/RcRef.js.map +1 -1
- package/dist/Record.d.ts +291 -488
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +111 -202
- package/dist/Record.js.map +1 -1
- package/dist/Redactable.d.ts +6 -2
- package/dist/Redactable.d.ts.map +1 -1
- package/dist/Redactable.js +7 -2
- package/dist/Redactable.js.map +1 -1
- package/dist/Redacted.d.ts +25 -25
- package/dist/Redacted.d.ts.map +1 -1
- package/dist/Redacted.js +19 -20
- package/dist/Redacted.js.map +1 -1
- package/dist/Reducer.d.ts +8 -15
- package/dist/Reducer.d.ts.map +1 -1
- package/dist/Reducer.js +6 -12
- package/dist/Reducer.js.map +1 -1
- package/dist/Ref.d.ts +95 -165
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +75 -122
- package/dist/Ref.js.map +1 -1
- package/dist/References.d.ts +102 -168
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +102 -168
- package/dist/References.js.map +1 -1
- package/dist/RegExp.d.ts +10 -14
- package/dist/RegExp.d.ts.map +1 -1
- package/dist/RegExp.js +10 -14
- package/dist/RegExp.js.map +1 -1
- package/dist/Request.d.ts +31 -21
- package/dist/Request.d.ts.map +1 -1
- package/dist/Request.js +16 -13
- package/dist/Request.js.map +1 -1
- package/dist/RequestResolver.d.ts +201 -90
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/RequestResolver.js +87 -41
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Resource.js.map +1 -1
- package/dist/Result.d.ts +302 -470
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +133 -217
- package/dist/Result.js.map +1 -1
- package/dist/Runtime.d.ts +50 -75
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +39 -60
- package/dist/Runtime.js.map +1 -1
- package/dist/Schedule.d.ts +290 -1636
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +162 -803
- package/dist/Schedule.js.map +1 -1
- package/dist/Scheduler.d.ts +5 -5
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +18 -6
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +644 -642
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +491 -527
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +27 -50
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +366 -279
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaError.d.ts +7 -6
- package/dist/SchemaError.d.ts.map +1 -1
- package/dist/SchemaError.js +7 -6
- package/dist/SchemaError.js.map +1 -1
- package/dist/SchemaGetter.d.ts +217 -174
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +218 -185
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaIssue.d.ts +62 -190
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js +73 -265
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.d.ts +2 -2
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +123 -75
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +22 -36
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +20 -26
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +114 -74
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +120 -85
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/Scope.d.ts +123 -151
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +72 -92
- package/dist/Scope.js.map +1 -1
- package/dist/ScopedCache.js.map +1 -1
- package/dist/ScopedRef.d.ts +3 -3
- package/dist/ScopedRef.js +2 -2
- package/dist/ScopedRef.js.map +1 -1
- package/dist/Semaphore.d.ts +96 -10
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js +78 -39
- package/dist/Semaphore.js.map +1 -1
- package/dist/Sink.d.ts +117 -107
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +107 -100
- package/dist/Sink.js.map +1 -1
- package/dist/Stdio.d.ts +1 -1
- package/dist/Stdio.js.map +1 -1
- package/dist/Stream.d.ts +2415 -2949
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +1078 -1381
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +262 -308
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +184 -215
- package/dist/String.js.map +1 -1
- package/dist/Struct.d.ts +109 -114
- package/dist/Struct.d.ts.map +1 -1
- package/dist/Struct.js +41 -50
- package/dist/Struct.js.map +1 -1
- package/dist/SubscriptionRef.d.ts +282 -250
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +104 -92
- package/dist/SubscriptionRef.js.map +1 -1
- package/dist/Symbol.d.ts +3 -3
- package/dist/Symbol.js +3 -3
- package/dist/Symbol.js.map +1 -1
- package/dist/SynchronizedRef.js.map +1 -1
- package/dist/Take.js.map +1 -1
- package/dist/Terminal.d.ts +2 -2
- package/dist/Terminal.js +1 -1
- package/dist/Terminal.js.map +1 -1
- package/dist/Tracer.d.ts +100 -54
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +41 -24
- package/dist/Tracer.js.map +1 -1
- package/dist/Trie.d.ts +287 -679
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Trie.js +109 -251
- package/dist/Trie.js.map +1 -1
- package/dist/Tuple.d.ts +92 -127
- package/dist/Tuple.d.ts.map +1 -1
- package/dist/Tuple.js +42 -57
- package/dist/Tuple.js.map +1 -1
- package/dist/TxChunk.d.ts +201 -121
- package/dist/TxChunk.d.ts.map +1 -1
- package/dist/TxChunk.js +85 -56
- package/dist/TxChunk.js.map +1 -1
- package/dist/TxDeferred.d.ts +62 -46
- package/dist/TxDeferred.d.ts.map +1 -1
- package/dist/TxDeferred.js +30 -22
- package/dist/TxDeferred.js.map +1 -1
- package/dist/TxHashMap.d.ts +631 -779
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js +268 -330
- package/dist/TxHashMap.js.map +1 -1
- package/dist/TxHashSet.d.ts +297 -236
- package/dist/TxHashSet.d.ts.map +1 -1
- package/dist/TxHashSet.js +130 -100
- package/dist/TxHashSet.js.map +1 -1
- package/dist/TxPriorityQueue.d.ts +126 -95
- package/dist/TxPriorityQueue.d.ts.map +1 -1
- package/dist/TxPriorityQueue.js +74 -56
- package/dist/TxPriorityQueue.js.map +1 -1
- package/dist/TxPubSub.d.ts +101 -88
- package/dist/TxPubSub.d.ts.map +1 -1
- package/dist/TxPubSub.js +87 -66
- package/dist/TxPubSub.js.map +1 -1
- package/dist/TxQueue.d.ts +200 -180
- package/dist/TxQueue.d.ts.map +1 -1
- package/dist/TxQueue.js +160 -136
- package/dist/TxQueue.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +97 -66
- package/dist/TxReentrantLock.d.ts.map +1 -1
- package/dist/TxReentrantLock.js +67 -45
- package/dist/TxReentrantLock.js.map +1 -1
- package/dist/TxRef.d.ts +51 -32
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +23 -15
- package/dist/TxRef.js.map +1 -1
- package/dist/TxSemaphore.d.ts +129 -95
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +85 -70
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/TxSubscriptionRef.d.ts +97 -70
- package/dist/TxSubscriptionRef.d.ts.map +1 -1
- package/dist/TxSubscriptionRef.js +44 -34
- package/dist/TxSubscriptionRef.js.map +1 -1
- package/dist/Types.d.ts +126 -67
- package/dist/Types.d.ts.map +1 -1
- package/dist/UndefinedOr.js.map +1 -1
- package/dist/Unify.d.ts +45 -65
- package/dist/Unify.d.ts.map +1 -1
- package/dist/Unify.js +6 -9
- package/dist/Unify.js.map +1 -1
- package/dist/Utils.d.ts +23 -16
- package/dist/Utils.d.ts.map +1 -1
- package/dist/Utils.js +3 -7
- package/dist/Utils.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/array.js.map +1 -1
- package/dist/internal/core.js +1 -1
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/dateTime.js +4 -0
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/doNotation.js.map +1 -1
- package/dist/internal/effect.js +77 -40
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/equal.js.map +1 -1
- package/dist/internal/errors.js.map +1 -1
- package/dist/internal/executionPlan.js.map +1 -1
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/hashSet.js.map +1 -1
- package/dist/internal/layer.js.map +1 -1
- package/dist/internal/matcher.js.map +1 -1
- package/dist/internal/metric.js.map +1 -1
- package/dist/internal/option.js.map +1 -1
- package/dist/internal/persistence.d.ts +2 -0
- package/dist/internal/persistence.d.ts.map +1 -0
- package/dist/internal/persistence.js +3 -0
- package/dist/internal/persistence.js.map +1 -0
- package/dist/internal/random.js.map +1 -1
- package/dist/internal/rcRef.js.map +1 -1
- package/dist/internal/record.js.map +1 -1
- package/dist/internal/redacted.js.map +1 -1
- package/dist/internal/references.js +3 -0
- package/dist/internal/references.js.map +1 -1
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/result.js.map +1 -1
- package/dist/internal/schedule.js.map +1 -1
- package/dist/internal/schema/annotations.js.map +1 -1
- package/dist/internal/schema/cause.js.map +1 -1
- package/dist/internal/schema/fromJsonSchemaDocument.js +13 -11
- package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -1
- package/dist/internal/schema/fromRepresentation.js +8 -15
- package/dist/internal/schema/fromRepresentation.js.map +1 -1
- package/dist/internal/schema/parser.d.ts +14 -0
- package/dist/internal/schema/parser.d.ts.map +1 -0
- package/dist/internal/schema/parser.js +13 -0
- package/dist/internal/schema/parser.js.map +1 -0
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/internal/schema/toArbitrary.js.map +1 -1
- package/dist/internal/schema/toCodeDocument.js.map +1 -1
- package/dist/internal/schema/toEquivalence.js.map +1 -1
- package/dist/internal/schema/toJsonSchemaDocument.js +48 -6
- package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -1
- package/dist/internal/schema/toRepresentation.js +87 -107
- package/dist/internal/schema/toRepresentation.js.map +1 -1
- package/dist/internal/stackTraceLimit.js.map +1 -1
- package/dist/internal/stream.js.map +1 -1
- package/dist/internal/tracer.js.map +1 -1
- package/dist/internal/trie.js +13 -9
- package/dist/internal/trie.js.map +1 -1
- package/dist/testing/FastCheck.d.ts +8 -7
- package/dist/testing/FastCheck.d.ts.map +1 -1
- package/dist/testing/FastCheck.js +8 -7
- package/dist/testing/FastCheck.js.map +1 -1
- package/dist/testing/TestClock.d.ts +57 -28
- package/dist/testing/TestClock.d.ts.map +1 -1
- package/dist/testing/TestClock.js +50 -18
- package/dist/testing/TestClock.js.map +1 -1
- package/dist/testing/TestConsole.d.ts +32 -31
- package/dist/testing/TestConsole.d.ts.map +1 -1
- package/dist/testing/TestConsole.js +24 -22
- package/dist/testing/TestConsole.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +29 -29
- package/dist/testing/TestSchema.js +25 -25
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +95 -118
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +94 -117
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +132 -97
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +55 -51
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
- package/dist/unstable/ai/IdGenerator.d.ts +32 -28
- package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
- package/dist/unstable/ai/IdGenerator.js +26 -21
- package/dist/unstable/ai/IdGenerator.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +107 -67
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +104 -64
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpProtocol.d.ts +30 -0
- package/dist/unstable/ai/McpProtocol.d.ts.map +1 -0
- package/dist/unstable/ai/McpProtocol.js +20 -0
- package/dist/unstable/ai/McpProtocol.js.map +1 -0
- package/dist/unstable/ai/McpSchema.d.ts +141 -75
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +58 -50
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +68 -59
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +694 -241
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Model.d.ts +8 -19
- package/dist/unstable/ai/Model.d.ts.map +1 -1
- package/dist/unstable/ai/Model.js +9 -20
- package/dist/unstable/ai/Model.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Prompt.d.ts +112 -38
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Prompt.js +53 -17
- package/dist/unstable/ai/Prompt.js.map +1 -1
- package/dist/unstable/ai/Response.d.ts +28 -14
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js +9 -4
- package/dist/unstable/ai/Response.js.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.js.map +1 -1
- package/dist/unstable/ai/Telemetry.d.ts +46 -13
- package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
- package/dist/unstable/ai/Telemetry.js +18 -7
- package/dist/unstable/ai/Telemetry.js.map +1 -1
- package/dist/unstable/ai/Tokenizer.d.ts +14 -3
- package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
- package/dist/unstable/ai/Tokenizer.js +10 -2
- package/dist/unstable/ai/Tokenizer.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +59 -44
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +48 -39
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +26 -8
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +18 -4
- package/dist/unstable/ai/Toolkit.js.map +1 -1
- package/dist/unstable/ai/index.d.ts +4 -0
- package/dist/unstable/ai/index.d.ts.map +1 -1
- package/dist/unstable/ai/index.js +4 -0
- package/dist/unstable/ai/index.js.map +1 -1
- package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
- package/dist/unstable/ai/internal/mcpProtocol.d.ts +21 -0
- package/dist/unstable/ai/internal/mcpProtocol.d.ts.map +1 -0
- package/dist/unstable/ai/internal/mcpProtocol.js +22 -0
- package/dist/unstable/ai/internal/mcpProtocol.js.map +1 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.d.ts +2 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.d.ts.map +1 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.js +32 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.js.map +1 -0
- package/dist/unstable/ai/internal/structured-output.js +14 -15
- package/dist/unstable/ai/internal/structured-output.js.map +1 -1
- package/dist/unstable/cli/Argument.d.ts +273 -69
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js +111 -33
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/CliConfig.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +69 -76
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +57 -61
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/CliOutput.d.ts +35 -54
- package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
- package/dist/unstable/cli/CliOutput.js +26 -42
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +705 -107
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +238 -42
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Completions.js.map +1 -1
- package/dist/unstable/cli/Flag.d.ts +418 -138
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js +197 -71
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +1 -1
- package/dist/unstable/cli/GlobalFlag.js.map +1 -1
- package/dist/unstable/cli/HelpDoc.d.ts +12 -4
- package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
- package/dist/unstable/cli/Param.d.ts +292 -78
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +128 -46
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +370 -149
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js +344 -136
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/Prompt.d.ts +23 -14
- package/dist/unstable/cli/Prompt.d.ts.map +1 -1
- package/dist/unstable/cli/Prompt.js +23 -14
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/index.js.map +1 -1
- package/dist/unstable/cli/internal/ansi.js.map +1 -1
- package/dist/unstable/cli/internal/auto-suggest.js.map +1 -1
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/completions/bash.js.map +1 -1
- package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -1
- package/dist/unstable/cli/internal/completions/fish.js.map +1 -1
- package/dist/unstable/cli/internal/completions/zsh.js.map +1 -1
- package/dist/unstable/cli/internal/config.js.map +1 -1
- package/dist/unstable/cli/internal/help.js.map +1 -1
- package/dist/unstable/cli/internal/lexer.js +17 -7
- package/dist/unstable/cli/internal/lexer.js.map +1 -1
- package/dist/unstable/cli/internal/parser.js +2 -2
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cli/internal/wizard.js.map +1 -1
- package/dist/unstable/cluster/ClusterCron.js.map +1 -1
- package/dist/unstable/cluster/ClusterError.js.map +1 -1
- package/dist/unstable/cluster/ClusterMetrics.js.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.d.ts +8 -8
- package/dist/unstable/cluster/ClusterSchema.js +8 -8
- package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +5 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/DeliverAt.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +10 -10
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +8 -8
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/EntityAddress.js.map +1 -1
- package/dist/unstable/cluster/EntityId.js.map +1 -1
- package/dist/unstable/cluster/EntityProxy.d.ts +4 -2
- package/dist/unstable/cluster/EntityProxy.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxy.js +4 -2
- package/dist/unstable/cluster/EntityProxy.js.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
- package/dist/unstable/cluster/EntityResource.d.ts +2 -2
- package/dist/unstable/cluster/EntityResource.js +2 -2
- package/dist/unstable/cluster/EntityResource.js.map +1 -1
- package/dist/unstable/cluster/EntityType.js.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts +3 -3
- package/dist/unstable/cluster/Envelope.js +3 -3
- package/dist/unstable/cluster/Envelope.js.map +1 -1
- package/dist/unstable/cluster/HttpRunner.d.ts +2 -2
- package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/HttpRunner.js +6 -4
- package/dist/unstable/cluster/HttpRunner.js.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
- package/dist/unstable/cluster/MachineId.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +9 -9
- package/dist/unstable/cluster/Message.js +6 -6
- package/dist/unstable/cluster/Message.js.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts +15 -15
- package/dist/unstable/cluster/MessageStorage.js +5 -5
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +4 -4
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/Runner.js.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.d.ts +1 -1
- package/dist/unstable/cluster/RunnerHealth.js +1 -1
- package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts +2 -1
- package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.js +16 -16
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.d.ts +2 -2
- package/dist/unstable/cluster/RunnerStorage.js +1 -1
- package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +6 -6
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +19 -10
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/ShardId.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +3 -2
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +3 -3
- package/dist/unstable/cluster/ShardingConfig.js +3 -3
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/ShardingRegistrationEvent.js.map +1 -1
- package/dist/unstable/cluster/SingleRunner.js.map +1 -1
- package/dist/unstable/cluster/Singleton.js.map +1 -1
- package/dist/unstable/cluster/SingletonAddress.d.ts +1 -1
- package/dist/unstable/cluster/SingletonAddress.js +1 -1
- package/dist/unstable/cluster/SingletonAddress.js.map +1 -1
- package/dist/unstable/cluster/Snowflake.d.ts +8 -8
- package/dist/unstable/cluster/Snowflake.js +8 -8
- package/dist/unstable/cluster/Snowflake.js.map +1 -1
- package/dist/unstable/cluster/SocketRunner.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js +20 -5
- package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/TestRunner.js.map +1 -1
- package/dist/unstable/cluster/index.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +5 -5
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/cluster/internal/entityReaper.js.map +1 -1
- package/dist/unstable/cluster/internal/hash.js.map +1 -1
- package/dist/unstable/cluster/internal/interruptors.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceMap.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
- package/dist/unstable/cluster/internal/shardLock.js.map +1 -1
- package/dist/unstable/devtools/DevTools.js.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
- package/dist/unstable/devtools/DevToolsServer.js.map +1 -1
- package/dist/unstable/devtools/index.js.map +1 -1
- package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
- package/dist/unstable/encoding/Msgpack.js +6 -8
- package/dist/unstable/encoding/Msgpack.js.map +1 -1
- package/dist/unstable/encoding/Ndjson.js.map +1 -1
- package/dist/unstable/encoding/Sse.d.ts +72 -8
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.js +58 -8
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/encoding/index.js.map +1 -1
- package/dist/unstable/eventlog/Event.d.ts +20 -20
- package/dist/unstable/eventlog/Event.js.map +1 -1
- package/dist/unstable/eventlog/EventGroup.d.ts +4 -4
- package/dist/unstable/eventlog/EventGroup.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +15 -15
- package/dist/unstable/eventlog/EventJournal.js +13 -13
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts +3 -3
- package/dist/unstable/eventlog/EventLog.js +3 -3
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.d.ts +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +2 -2
- package/dist/unstable/eventlog/EventLogMessage.js +1 -1
- package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +15 -15
- package/dist/unstable/eventlog/EventLogRemote.js +1 -1
- package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.d.ts +11 -2
- package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.js +45 -21
- package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +4 -4
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.js +13 -5
- package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +5 -5
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js +14 -6
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.js +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/index.js.map +1 -1
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.js.map +1 -1
- package/dist/unstable/http/Cookies.d.ts +2 -2
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +30 -18
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Etag.d.ts +1 -1
- package/dist/unstable/http/Etag.js +1 -1
- package/dist/unstable/http/Etag.js.map +1 -1
- package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
- package/dist/unstable/http/FetchHttpClient.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts +2 -2
- package/dist/unstable/http/Headers.js +2 -2
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpBody.d.ts +5 -3
- package/dist/unstable/http/HttpBody.d.ts.map +1 -1
- package/dist/unstable/http/HttpBody.js +11 -5
- package/dist/unstable/http/HttpBody.js.map +1 -1
- package/dist/unstable/http/HttpClient.d.ts +51 -44
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +46 -17
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientError.js.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +2 -0
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts +4 -4
- package/dist/unstable/http/HttpClientResponse.js +2 -2
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts +6 -6
- package/dist/unstable/http/HttpEffect.js +3 -3
- package/dist/unstable/http/HttpEffect.js.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpMethod.d.ts +6 -9
- package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
- package/dist/unstable/http/HttpMethod.js +6 -9
- package/dist/unstable/http/HttpMethod.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts +75 -9
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +164 -39
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/http/HttpPlatform.d.ts +76 -0
- package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
- package/dist/unstable/http/HttpPlatform.js +32 -0
- package/dist/unstable/http/HttpPlatform.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +88 -89
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js +78 -79
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServer.d.ts +13 -13
- package/dist/unstable/http/HttpServer.js +6 -6
- package/dist/unstable/http/HttpServer.js.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +2 -2
- package/dist/unstable/http/HttpServerError.js +2 -2
- package/dist/unstable/http/HttpServerError.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts +4 -4
- package/dist/unstable/http/HttpServerRequest.js +4 -4
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +22 -0
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +10 -0
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpStaticServer.d.ts +35 -7
- package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpStaticServer.js +35 -7
- package/dist/unstable/http/HttpStaticServer.js.map +1 -1
- package/dist/unstable/http/HttpTraceContext.js.map +1 -1
- package/dist/unstable/http/Multipart.d.ts +6 -6
- package/dist/unstable/http/Multipart.js +5 -5
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/Template.js.map +1 -1
- package/dist/unstable/http/Url.d.ts +33 -63
- package/dist/unstable/http/Url.d.ts.map +1 -1
- package/dist/unstable/http/Url.js +14 -28
- package/dist/unstable/http/Url.js.map +1 -1
- package/dist/unstable/http/UrlParams.d.ts +10 -18
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +9 -17
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/http/index.js.map +1 -1
- package/dist/unstable/http/internal/compression.d.ts +2 -0
- package/dist/unstable/http/internal/compression.d.ts.map +1 -0
- package/dist/unstable/http/internal/compression.js +155 -0
- package/dist/unstable/http/internal/compression.js.map +1 -0
- package/dist/unstable/http/internal/preResponseHandler.js.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +10 -11
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +4 -5
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +11 -13
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +42 -42
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +13 -13
- package/dist/unstable/httpapi/HttpApiError.js +13 -13
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.d.ts +15 -15
- package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +71 -24
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js +57 -10
- package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts +0 -12
- package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +6 -6
- package/dist/unstable/httpapi/HttpApiSchema.js +4 -4
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiTest.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts +13 -13
- package/dist/unstable/httpapi/OpenApi.js +13 -13
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/httpapi/index.js.map +1 -1
- package/dist/unstable/httpapi/internal/html.js.map +1 -1
- package/dist/unstable/httpapi/internal/httpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/internal/httpApiSwagger.js.map +1 -1
- package/dist/unstable/httpapi/internal/mediaType.js.map +1 -1
- package/dist/unstable/observability/Otlp.js.map +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts +12 -14
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +17 -4
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.js.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts +4 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
- package/dist/unstable/observability/OtlpResource.d.ts +16 -7
- package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpResource.js +21 -12
- package/dist/unstable/observability/OtlpResource.js.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.d.ts +13 -4
- package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.js +10 -3
- package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
- package/dist/unstable/observability/index.js.map +1 -1
- package/dist/unstable/observability/internal/otlpEnv.js +1 -1
- package/dist/unstable/observability/internal/otlpEnv.js.map +1 -1
- package/dist/unstable/observability/internal/otlpProtobuf.js.map +1 -1
- package/dist/unstable/observability/internal/protobuf.js +3 -0
- package/dist/unstable/observability/internal/protobuf.js.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts +8 -3
- package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.js +22 -13
- package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
- package/dist/unstable/persistence/Persistable.d.ts +8 -8
- package/dist/unstable/persistence/Persistable.js.map +1 -1
- package/dist/unstable/persistence/PersistedCache.js.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts +6 -6
- package/dist/unstable/persistence/PersistedQueue.js +6 -6
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/persistence/Persistence.d.ts +3 -3
- package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistence.js +91 -15
- package/dist/unstable/persistence/Persistence.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +26 -15
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +24 -13
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/persistence/Redis.d.ts +2 -2
- package/dist/unstable/persistence/Redis.js +1 -1
- package/dist/unstable/persistence/Redis.js.map +1 -1
- package/dist/unstable/persistence/index.js.map +1 -1
- package/dist/unstable/process/ChildProcess.d.ts +64 -21
- package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcess.js +14 -5
- package/dist/unstable/process/ChildProcess.js.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.d.ts +21 -10
- package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
- package/dist/unstable/process/index.js.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.d.ts +8 -8
- package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.js +10 -10
- package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +25 -22
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +14 -13
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.js +4 -1
- package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/unstable/reactivity/AtomRef.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +24 -3
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.js +4 -1
- package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
- package/dist/unstable/reactivity/Hydration.d.ts +1 -1
- package/dist/unstable/reactivity/Hydration.js +1 -1
- package/dist/unstable/reactivity/Hydration.js.map +1 -1
- package/dist/unstable/reactivity/Reactivity.js.map +1 -1
- package/dist/unstable/reactivity/index.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +35 -33
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js +4 -2
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts +12 -12
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +12 -11
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcClientError.js.map +1 -1
- package/dist/unstable/rpc/RpcGroup.d.ts +8 -8
- package/dist/unstable/rpc/RpcGroup.js +1 -1
- package/dist/unstable/rpc/RpcGroup.js.map +1 -1
- package/dist/unstable/rpc/RpcMessage.d.ts +31 -30
- package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMessage.js +6 -6
- package/dist/unstable/rpc/RpcMessage.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts +10 -10
- package/dist/unstable/rpc/RpcMiddleware.js +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts +4 -4
- package/dist/unstable/rpc/RpcSchema.js +3 -3
- package/dist/unstable/rpc/RpcSchema.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts +58 -7
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +175 -96
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +13 -13
- package/dist/unstable/rpc/RpcServer.js +17 -13
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/rpc/RpcTest.js.map +1 -1
- package/dist/unstable/rpc/RpcWorker.d.ts +5 -5
- package/dist/unstable/rpc/RpcWorker.js +4 -4
- package/dist/unstable/rpc/RpcWorker.js.map +1 -1
- package/dist/unstable/rpc/Utils.js.map +1 -1
- package/dist/unstable/rpc/index.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts +52 -50
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js +35 -33
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +5 -5
- package/dist/unstable/schema/VariantSchema.js +2 -2
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/schema/index.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +11 -3
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +9 -4
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/socket/SocketServer.js.map +1 -1
- package/dist/unstable/socket/index.js.map +1 -1
- package/dist/unstable/sql/Migrator.js.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts +1 -1
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +2 -2
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/sql/SqlConnection.js.map +1 -1
- package/dist/unstable/sql/SqlError.js.map +1 -1
- package/dist/unstable/sql/SqlModel.d.ts +2 -2
- package/dist/unstable/sql/SqlModel.js +2 -2
- package/dist/unstable/sql/SqlModel.js.map +1 -1
- package/dist/unstable/sql/SqlResolver.d.ts +5 -5
- package/dist/unstable/sql/SqlResolver.js +2 -2
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/sql/SqlSchema.js.map +1 -1
- package/dist/unstable/sql/SqlStream.js.map +1 -1
- package/dist/unstable/sql/Statement.d.ts +6 -6
- package/dist/unstable/sql/Statement.js +15 -15
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/sql/index.js.map +1 -1
- package/dist/unstable/workers/Transferable.d.ts +1 -1
- package/dist/unstable/workers/Transferable.js +1 -1
- package/dist/unstable/workers/Transferable.js.map +1 -1
- package/dist/unstable/workers/Worker.d.ts +2 -2
- package/dist/unstable/workers/Worker.js +2 -2
- package/dist/unstable/workers/Worker.js.map +1 -1
- package/dist/unstable/workers/WorkerError.d.ts +7 -7
- package/dist/unstable/workers/WorkerError.js +6 -6
- package/dist/unstable/workers/WorkerError.js.map +1 -1
- package/dist/unstable/workers/WorkerRunner.d.ts +1 -1
- package/dist/unstable/workers/WorkerRunner.js +1 -1
- package/dist/unstable/workers/WorkerRunner.js.map +1 -1
- package/dist/unstable/workers/index.js.map +1 -1
- package/dist/unstable/workflow/Activity.d.ts +2 -2
- package/dist/unstable/workflow/Activity.js +2 -2
- package/dist/unstable/workflow/Activity.js.map +1 -1
- package/dist/unstable/workflow/DurableClock.d.ts +1 -1
- package/dist/unstable/workflow/DurableClock.js +1 -1
- package/dist/unstable/workflow/DurableClock.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.d.ts +10 -10
- package/dist/unstable/workflow/DurableDeferred.js +5 -5
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/DurableQueue.d.ts +22 -20
- package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableQueue.js +22 -20
- package/dist/unstable/workflow/DurableQueue.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +21 -21
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js +13 -14
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.d.ts +4 -2
- package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.js +4 -2
- package/dist/unstable/workflow/WorkflowProxy.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
- package/dist/unstable/workflow/index.js.map +1 -1
- package/dist/unstable/workflow/internal/crypto.js.map +1 -1
- package/package.json +5 -6
- package/src/Array.ts +982 -1045
- package/src/BigDecimal.ts +433 -756
- package/src/BigInt.ts +213 -269
- package/src/Boolean.ts +146 -188
- package/src/Cache.ts +409 -255
- package/src/Cause.ts +167 -277
- package/src/Channel.ts +891 -816
- package/src/ChannelSchema.ts +1 -1
- package/src/Chunk.ts +841 -1181
- package/src/Clock.ts +181 -49
- package/src/Combiner.ts +20 -33
- package/src/Config.ts +615 -332
- package/src/ConfigProvider.ts +214 -120
- package/src/Console.ts +289 -39
- package/src/Context.ts +319 -378
- package/src/Cron.ts +68 -77
- package/src/Crypto.ts +13 -15
- package/src/Data.ts +60 -80
- package/src/DateTime.ts +564 -660
- package/src/Deferred.ts +253 -256
- package/src/Duration.ts +216 -308
- package/src/Effect.ts +2893 -3279
- package/src/Encoding.ts +22 -40
- package/src/Equal.ts +49 -39
- package/src/Equivalence.ts +103 -105
- package/src/ErrorReporter.ts +51 -27
- package/src/ExecutionPlan.ts +13 -55
- package/src/Exit.ts +116 -192
- package/src/Fiber.ts +81 -148
- package/src/FiberHandle.ts +152 -105
- package/src/FiberMap.ts +225 -174
- package/src/FiberSet.ts +124 -82
- package/src/FileSystem.ts +155 -263
- package/src/Filter.ts +61 -33
- package/src/Formatter.ts +54 -56
- package/src/Function.ts +76 -145
- package/src/Graph.ts +416 -770
- package/src/HKT.ts +12 -6
- package/src/Hash.ts +52 -83
- package/src/HashMap.ts +319 -411
- package/src/HashRing.ts +1 -0
- package/src/HashSet.ts +177 -284
- package/src/Inspectable.ts +12 -12
- package/src/Iterable.ts +620 -786
- package/src/JsonPatch.ts +58 -112
- package/src/JsonPointer.ts +8 -8
- package/src/JsonSchema.ts +402 -244
- package/src/Latch.ts +23 -35
- package/src/Layer.ts +359 -260
- package/src/LayerMap.ts +49 -29
- package/src/LayerRef.ts +6 -2
- package/src/LogLevel.ts +114 -214
- package/src/Logger.ts +344 -697
- package/src/ManagedRuntime.ts +7 -5
- package/src/Match.ts +217 -252
- package/src/Metric.ts +516 -1089
- package/src/MutableHashMap.ts +218 -255
- package/src/MutableHashSet.ts +84 -89
- package/src/MutableList.ts +73 -370
- package/src/MutableRef.ts +420 -243
- package/src/Newtype.ts +21 -14
- package/src/NonEmptyIterable.ts +7 -137
- package/src/Number.ts +196 -233
- package/src/Optic.ts +243 -383
- package/src/Option.ts +447 -812
- package/src/Order.ts +109 -109
- package/src/Ordering.ts +20 -23
- package/src/Path.ts +38 -41
- package/src/Pipeable.ts +6 -5
- package/src/PlatformError.ts +4 -4
- package/src/Pool.ts +4 -2
- package/src/Predicate.ts +200 -181
- package/src/PrimaryKey.ts +7 -7
- package/src/PubSub.ts +526 -552
- package/src/Pull.ts +24 -18
- package/src/Queue.ts +200 -159
- package/src/Random.ts +49 -74
- package/src/RcMap.ts +121 -63
- package/src/RcRef.ts +24 -13
- package/src/Record.ts +291 -488
- package/src/Redactable.ts +10 -3
- package/src/Redacted.ts +25 -25
- package/src/Reducer.ts +8 -15
- package/src/Ref.ts +221 -361
- package/src/References.ts +102 -168
- package/src/RegExp.ts +10 -14
- package/src/Request.ts +31 -21
- package/src/RequestResolver.ts +202 -91
- package/src/Result.ts +312 -484
- package/src/Runtime.ts +50 -75
- package/src/Schedule.ts +308 -1734
- package/src/Scheduler.ts +20 -7
- package/src/Schema.ts +716 -745
- package/src/SchemaAST.ts +466 -358
- package/src/SchemaError.ts +7 -6
- package/src/SchemaGetter.ts +242 -190
- package/src/SchemaIssue.ts +89 -275
- package/src/SchemaParser.ts +180 -93
- package/src/SchemaRepresentation.ts +22 -40
- package/src/SchemaTransformation.ts +129 -88
- package/src/Scope.ts +123 -151
- package/src/ScopedRef.ts +4 -4
- package/src/Semaphore.ts +152 -51
- package/src/Sink.ts +128 -113
- package/src/Stdio.ts +1 -1
- package/src/Stream.ts +2602 -3123
- package/src/String.ts +275 -312
- package/src/Struct.ts +109 -114
- package/src/SubscriptionRef.ts +284 -252
- package/src/Symbol.ts +3 -3
- package/src/Terminal.ts +2 -2
- package/src/Tracer.ts +102 -55
- package/src/Trie.ts +287 -679
- package/src/Tuple.ts +92 -127
- package/src/TxChunk.ts +201 -121
- package/src/TxDeferred.ts +62 -46
- package/src/TxHashMap.ts +645 -799
- package/src/TxHashSet.ts +443 -356
- package/src/TxPriorityQueue.ts +130 -98
- package/src/TxPubSub.ts +107 -80
- package/src/TxQueue.ts +214 -183
- package/src/TxReentrantLock.ts +97 -66
- package/src/TxRef.ts +51 -32
- package/src/TxSemaphore.ts +129 -95
- package/src/TxSubscriptionRef.ts +97 -70
- package/src/Types.ts +126 -67
- package/src/Unify.ts +45 -65
- package/src/Utils.ts +23 -16
- package/src/internal/core.ts +2 -2
- package/src/internal/dateTime.ts +6 -0
- package/src/internal/effect.ts +93 -48
- package/src/internal/persistence.ts +2 -0
- package/src/internal/references.ts +3 -2
- package/src/internal/schema/fromJsonSchemaDocument.ts +15 -13
- package/src/internal/schema/fromRepresentation.ts +10 -16
- package/src/internal/schema/parser.ts +22 -0
- package/src/internal/schema/toJsonSchemaDocument.ts +60 -6
- package/src/internal/schema/toRepresentation.ts +104 -119
- package/src/internal/trie.ts +10 -11
- package/src/testing/FastCheck.ts +8 -7
- package/src/testing/TestClock.ts +72 -30
- package/src/testing/TestConsole.ts +32 -31
- package/src/testing/TestSchema.ts +29 -29
- package/src/unstable/ai/AiError.ts +95 -118
- package/src/unstable/ai/AnthropicStructuredOutput.ts +1 -1
- package/src/unstable/ai/Chat.ts +132 -97
- package/src/unstable/ai/IdGenerator.ts +32 -28
- package/src/unstable/ai/LanguageModel.ts +107 -67
- package/src/unstable/ai/McpProtocol.ts +48 -0
- package/src/unstable/ai/McpSchema.ts +60 -50
- package/src/unstable/ai/McpServer.ts +930 -304
- package/src/unstable/ai/Model.ts +9 -20
- package/src/unstable/ai/OpenAiStructuredOutput.ts +1 -1
- package/src/unstable/ai/Prompt.ts +145 -43
- package/src/unstable/ai/Response.ts +28 -14
- package/src/unstable/ai/Telemetry.ts +46 -13
- package/src/unstable/ai/Tokenizer.ts +14 -3
- package/src/unstable/ai/Tool.ts +59 -44
- package/src/unstable/ai/Toolkit.ts +26 -8
- package/src/unstable/ai/index.ts +5 -0
- package/src/unstable/ai/internal/mcpProtocol.ts +85 -0
- package/src/unstable/ai/internal/mcpProtocolRegistry.ts +70 -0
- package/src/unstable/ai/internal/structured-output.ts +13 -18
- package/src/unstable/cli/Argument.ts +273 -69
- package/src/unstable/cli/CliError.ts +69 -76
- package/src/unstable/cli/CliOutput.ts +44 -58
- package/src/unstable/cli/Command.ts +705 -107
- package/src/unstable/cli/Flag.ts +418 -138
- package/src/unstable/cli/GlobalFlag.ts +1 -1
- package/src/unstable/cli/HelpDoc.ts +12 -4
- package/src/unstable/cli/Param.ts +292 -78
- package/src/unstable/cli/Primitive.ts +370 -149
- package/src/unstable/cli/Prompt.ts +28 -14
- package/src/unstable/cli/internal/lexer.ts +8 -2
- package/src/unstable/cli/internal/parser.ts +2 -2
- package/src/unstable/cluster/ClusterSchema.ts +8 -8
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +5 -1
- package/src/unstable/cluster/Entity.ts +15 -16
- package/src/unstable/cluster/EntityProxy.ts +4 -2
- package/src/unstable/cluster/EntityResource.ts +2 -2
- package/src/unstable/cluster/Envelope.ts +3 -3
- package/src/unstable/cluster/HttpRunner.ts +6 -4
- package/src/unstable/cluster/Message.ts +9 -9
- package/src/unstable/cluster/MessageStorage.ts +15 -15
- package/src/unstable/cluster/Reply.ts +4 -6
- package/src/unstable/cluster/RunnerHealth.ts +1 -1
- package/src/unstable/cluster/RunnerServer.ts +41 -8
- package/src/unstable/cluster/RunnerStorage.ts +2 -2
- package/src/unstable/cluster/Runners.ts +23 -12
- package/src/unstable/cluster/Sharding.ts +7 -8
- package/src/unstable/cluster/ShardingConfig.ts +3 -3
- package/src/unstable/cluster/SingletonAddress.ts +1 -1
- package/src/unstable/cluster/Snowflake.ts +8 -8
- package/src/unstable/cluster/SqlMessageStorage.ts +1 -1
- package/src/unstable/cluster/SqlRunnerStorage.ts +21 -5
- package/src/unstable/cluster/internal/entityManager.ts +11 -15
- package/src/unstable/encoding/Msgpack.ts +6 -8
- package/src/unstable/encoding/Sse.ts +98 -16
- package/src/unstable/eventlog/Event.ts +20 -20
- package/src/unstable/eventlog/EventGroup.ts +4 -4
- package/src/unstable/eventlog/EventJournal.ts +15 -15
- package/src/unstable/eventlog/EventLog.ts +3 -3
- package/src/unstable/eventlog/EventLogEncryption.ts +1 -1
- package/src/unstable/eventlog/EventLogMessage.ts +2 -2
- package/src/unstable/eventlog/EventLogRemote.ts +1 -1
- package/src/unstable/eventlog/EventLogServer.ts +41 -7
- package/src/unstable/eventlog/EventLogServerEncrypted.ts +13 -5
- package/src/unstable/eventlog/EventLogServerUnencrypted.ts +14 -6
- package/src/unstable/eventlog/EventLogSessionAuth.ts +1 -1
- package/src/unstable/http/Cookies.ts +35 -21
- package/src/unstable/http/Etag.ts +1 -1
- package/src/unstable/http/FetchHttpClient.ts +3 -1
- package/src/unstable/http/Headers.ts +2 -2
- package/src/unstable/http/HttpBody.ts +20 -5
- package/src/unstable/http/HttpClient.ts +83 -55
- package/src/unstable/http/HttpClientRequest.ts +2 -0
- package/src/unstable/http/HttpClientResponse.ts +4 -4
- package/src/unstable/http/HttpEffect.ts +8 -8
- package/src/unstable/http/HttpMethod.ts +6 -9
- package/src/unstable/http/HttpMiddleware.ts +202 -39
- package/src/unstable/http/HttpPlatform.ts +95 -0
- package/src/unstable/http/HttpRouter.ts +102 -98
- package/src/unstable/http/HttpServer.ts +13 -13
- package/src/unstable/http/HttpServerError.ts +2 -2
- package/src/unstable/http/HttpServerRequest.ts +4 -4
- package/src/unstable/http/HttpServerResponse.ts +30 -0
- package/src/unstable/http/HttpStaticServer.ts +35 -7
- package/src/unstable/http/Multipart.ts +6 -6
- package/src/unstable/http/Url.ts +33 -63
- package/src/unstable/http/UrlParams.ts +10 -18
- package/src/unstable/http/internal/compression.ts +196 -0
- package/src/unstable/httpapi/HttpApiBuilder.ts +10 -9
- package/src/unstable/httpapi/HttpApiClient.ts +14 -14
- package/src/unstable/httpapi/HttpApiEndpoint.ts +42 -42
- package/src/unstable/httpapi/HttpApiError.ts +13 -13
- package/src/unstable/httpapi/HttpApiGroup.ts +15 -15
- package/src/unstable/httpapi/HttpApiMiddleware.ts +71 -24
- package/src/unstable/httpapi/HttpApiScalar.ts +0 -12
- package/src/unstable/httpapi/HttpApiSchema.ts +6 -6
- package/src/unstable/httpapi/OpenApi.ts +13 -13
- package/src/unstable/observability/OtlpExporter.ts +31 -19
- package/src/unstable/observability/OtlpMetrics.ts +4 -1
- package/src/unstable/observability/OtlpResource.ts +26 -17
- package/src/unstable/observability/PrometheusMetrics.ts +13 -4
- package/src/unstable/observability/internal/otlpEnv.ts +1 -1
- package/src/unstable/observability/internal/protobuf.ts +3 -0
- package/src/unstable/persistence/KeyValueStore.ts +72 -49
- package/src/unstable/persistence/Persistable.ts +8 -8
- package/src/unstable/persistence/PersistedQueue.ts +6 -6
- package/src/unstable/persistence/Persistence.ts +126 -19
- package/src/unstable/persistence/RateLimiter.ts +26 -15
- package/src/unstable/persistence/Redis.ts +2 -2
- package/src/unstable/process/ChildProcess.ts +64 -21
- package/src/unstable/process/ChildProcessSpawner.ts +21 -10
- package/src/unstable/reactivity/AsyncResult.ts +12 -13
- package/src/unstable/reactivity/Atom.ts +28 -25
- package/src/unstable/reactivity/AtomHttpApi.ts +5 -4
- package/src/unstable/reactivity/AtomRegistry.ts +24 -3
- package/src/unstable/reactivity/AtomRpc.ts +5 -4
- package/src/unstable/reactivity/Hydration.ts +1 -1
- package/src/unstable/rpc/Rpc.ts +35 -33
- package/src/unstable/rpc/RpcClient.ts +16 -15
- package/src/unstable/rpc/RpcGroup.ts +8 -8
- package/src/unstable/rpc/RpcMessage.ts +31 -30
- package/src/unstable/rpc/RpcMiddleware.ts +10 -10
- package/src/unstable/rpc/RpcSchema.ts +4 -4
- package/src/unstable/rpc/RpcSerialization.ts +167 -68
- package/src/unstable/rpc/RpcServer.ts +18 -15
- package/src/unstable/rpc/RpcWorker.ts +5 -5
- package/src/unstable/schema/Model.ts +52 -50
- package/src/unstable/schema/VariantSchema.ts +5 -5
- package/src/unstable/socket/Socket.ts +17 -4
- package/src/unstable/sql/SqlClient.ts +5 -6
- package/src/unstable/sql/SqlModel.ts +2 -2
- package/src/unstable/sql/SqlResolver.ts +5 -5
- package/src/unstable/sql/Statement.ts +24 -23
- package/src/unstable/workers/Transferable.ts +1 -1
- package/src/unstable/workers/Worker.ts +2 -2
- package/src/unstable/workers/WorkerError.ts +7 -7
- package/src/unstable/workers/WorkerRunner.ts +1 -1
- package/src/unstable/workflow/Activity.ts +2 -2
- package/src/unstable/workflow/DurableClock.ts +1 -1
- package/src/unstable/workflow/DurableDeferred.ts +10 -10
- package/src/unstable/workflow/DurableQueue.ts +22 -20
- package/src/unstable/workflow/Workflow.ts +23 -23
- package/src/unstable/workflow/WorkflowEngine.ts +1 -1
- package/src/unstable/workflow/WorkflowProxy.ts +4 -2
- package/dist/internal/version.d.ts +0 -3
- package/dist/internal/version.d.ts.map +0 -1
- package/dist/internal/version.js +0 -2
- package/dist/internal/version.js.map +0 -1
- package/src/internal/version.ts +0 -2
package/dist/Channel.d.ts
CHANGED
|
@@ -51,12 +51,12 @@ export declare const TypeId: TypeId;
|
|
|
51
51
|
*
|
|
52
52
|
* **Example** (Checking for channels)
|
|
53
53
|
*
|
|
54
|
-
* ```ts
|
|
54
|
+
* ```ts import.meta.vitest
|
|
55
55
|
* import { Channel } from "effect"
|
|
56
56
|
*
|
|
57
57
|
* const channel = Channel.succeed(42)
|
|
58
|
-
*
|
|
59
|
-
*
|
|
58
|
+
* Channel.isChannel(channel) // => true
|
|
59
|
+
* Channel.isChannel("not a channel") // => false
|
|
60
60
|
* ```
|
|
61
61
|
*
|
|
62
62
|
* @category guards
|
|
@@ -90,8 +90,8 @@ export declare const isChannel: (u: unknown) => u is Channel<unknown, unknown, u
|
|
|
90
90
|
*
|
|
91
91
|
* **Example** (Typing channels)
|
|
92
92
|
*
|
|
93
|
-
* ```ts
|
|
94
|
-
* import
|
|
93
|
+
* ```ts import.meta.vitest
|
|
94
|
+
* import { Channel, Effect } from "effect"
|
|
95
95
|
*
|
|
96
96
|
* // A channel that outputs numbers and requires no environment
|
|
97
97
|
* type NumberChannel = Channel.Channel<number>
|
|
@@ -109,6 +109,9 @@ export declare const isChannel: (u: unknown) => u is Channel<unknown, unknown, u
|
|
|
109
109
|
* boolean, // InDone - input completion
|
|
110
110
|
* { db: string } // Env - required environment
|
|
111
111
|
* >
|
|
112
|
+
*
|
|
113
|
+
* const channel: NumberChannel = Channel.succeed(1)
|
|
114
|
+
* Effect.runSync(Channel.runCollect(channel)) // => [1]
|
|
112
115
|
* ```
|
|
113
116
|
*
|
|
114
117
|
* @category models
|
|
@@ -198,12 +201,13 @@ export interface VarianceStruct<out OutElem, out OutErr, out OutDone, in InElem,
|
|
|
198
201
|
*
|
|
199
202
|
* **Example** (Creating channels from transforms)
|
|
200
203
|
*
|
|
201
|
-
* ```ts
|
|
204
|
+
* ```ts import.meta.vitest
|
|
202
205
|
* import { Channel, Effect } from "effect"
|
|
203
206
|
*
|
|
204
207
|
* const channel = Channel.fromTransform((upstream, scope) =>
|
|
205
208
|
* Effect.succeed(upstream)
|
|
206
209
|
* )
|
|
210
|
+
* await Effect.runPromise(Channel.runCollect(channel)) // => []
|
|
207
211
|
* ```
|
|
208
212
|
*
|
|
209
213
|
* @category constructors
|
|
@@ -215,7 +219,7 @@ export declare const fromTransform: <OutElem, OutErr, OutDone, InElem, InErr, In
|
|
|
215
219
|
*
|
|
216
220
|
* **Example** (Transforming pull behavior)
|
|
217
221
|
*
|
|
218
|
-
* ```ts
|
|
222
|
+
* ```ts import.meta.vitest
|
|
219
223
|
* import { Channel, Effect } from "effect"
|
|
220
224
|
*
|
|
221
225
|
* // Transform a channel by modifying its pull behavior
|
|
@@ -228,7 +232,7 @@ export declare const fromTransform: <OutElem, OutErr, OutDone, InElem, InErr, In
|
|
|
228
232
|
* Effect.map(pull, (value) => value * 2)
|
|
229
233
|
* )
|
|
230
234
|
* )
|
|
231
|
-
* //
|
|
235
|
+
* await Effect.runPromise(Channel.runCollect(transformedChannel)) // => [2, 4, 6]
|
|
232
236
|
* ```
|
|
233
237
|
*
|
|
234
238
|
* @category constructors
|
|
@@ -240,12 +244,18 @@ export declare const transformPull: <OutElem, OutErr, OutDone, InElem, InErr, In
|
|
|
240
244
|
*
|
|
241
245
|
* **Example** (Creating channels from pulls)
|
|
242
246
|
*
|
|
243
|
-
* ```ts
|
|
244
|
-
* import { Channel, Effect } from "effect"
|
|
247
|
+
* ```ts import.meta.vitest
|
|
248
|
+
* import { Cause, Channel, Effect } from "effect"
|
|
245
249
|
*
|
|
246
|
-
* const channel = Channel.fromPull(
|
|
247
|
-
*
|
|
248
|
-
* )
|
|
250
|
+
* const channel = Channel.fromPull(Effect.sync(() => {
|
|
251
|
+
* let emitted = false
|
|
252
|
+
* return Effect.suspend(() => {
|
|
253
|
+
* if (emitted) return Cause.done()
|
|
254
|
+
* emitted = true
|
|
255
|
+
* return Effect.succeed(42)
|
|
256
|
+
* })
|
|
257
|
+
* }))
|
|
258
|
+
* await Effect.runPromise(Channel.runCollect(channel)) // => [42]
|
|
249
259
|
* ```
|
|
250
260
|
*
|
|
251
261
|
* @category constructors
|
|
@@ -273,12 +283,13 @@ export declare const fromTransformBracket: <OutElem, OutErr, OutDone, InElem, In
|
|
|
273
283
|
*
|
|
274
284
|
* **Example** (Extracting channel transforms)
|
|
275
285
|
*
|
|
276
|
-
* ```ts
|
|
277
|
-
* import { Channel } from "effect"
|
|
286
|
+
* ```ts import.meta.vitest
|
|
287
|
+
* import { Channel, Effect } from "effect"
|
|
278
288
|
*
|
|
279
289
|
* const channel = Channel.succeed(42)
|
|
280
290
|
* const transform = Channel.toTransform(channel)
|
|
281
|
-
*
|
|
291
|
+
* typeof transform // => "function"
|
|
292
|
+
* Effect.runSync(Channel.runCollect(channel)) // => [42]
|
|
282
293
|
* ```
|
|
283
294
|
*
|
|
284
295
|
* @category destructors
|
|
@@ -290,10 +301,10 @@ export declare const toTransform: <OutElem, OutErr, OutDone, InElem, InErr, InDo
|
|
|
290
301
|
*
|
|
291
302
|
* **Example** (Reading the default chunk size)
|
|
292
303
|
*
|
|
293
|
-
* ```ts
|
|
304
|
+
* ```ts import.meta.vitest
|
|
294
305
|
* import { Channel } from "effect"
|
|
295
306
|
*
|
|
296
|
-
*
|
|
307
|
+
* Channel.DefaultChunkSize // => 4096
|
|
297
308
|
* ```
|
|
298
309
|
*
|
|
299
310
|
* @category constants
|
|
@@ -305,7 +316,7 @@ export declare const DefaultChunkSize: number;
|
|
|
305
316
|
*
|
|
306
317
|
* **Example** (Creating channels from callbacks)
|
|
307
318
|
*
|
|
308
|
-
* ```ts
|
|
319
|
+
* ```ts import.meta.vitest
|
|
309
320
|
* import { Channel, Effect, Queue } from "effect"
|
|
310
321
|
*
|
|
311
322
|
* const channel = Channel.callback<number>((queue) =>
|
|
@@ -313,8 +324,10 @@ export declare const DefaultChunkSize: number;
|
|
|
313
324
|
* yield* Queue.offer(queue, 1)
|
|
314
325
|
* yield* Queue.offer(queue, 2)
|
|
315
326
|
* yield* Queue.offer(queue, 3)
|
|
327
|
+
* yield* Queue.end(queue)
|
|
316
328
|
* })
|
|
317
329
|
* )
|
|
330
|
+
* await Effect.runPromise(Channel.runCollect(channel)) // => [1, 2, 3]
|
|
318
331
|
* ```
|
|
319
332
|
*
|
|
320
333
|
* @category constructors
|
|
@@ -329,14 +342,15 @@ export declare const callback: <A, E = never, R = never>(f: (queue: Queue.Queue<
|
|
|
329
342
|
*
|
|
330
343
|
* **Example** (Creating array channels from callbacks)
|
|
331
344
|
*
|
|
332
|
-
* ```ts
|
|
345
|
+
* ```ts import.meta.vitest
|
|
333
346
|
* import { Channel, Effect, Queue } from "effect"
|
|
334
347
|
*
|
|
335
348
|
* const channel = Channel.callbackArray<number>(Effect.fn(function*(queue) {
|
|
336
349
|
* yield* Queue.offer(queue, 1)
|
|
337
350
|
* yield* Queue.offer(queue, 2)
|
|
351
|
+
* yield* Queue.end(queue)
|
|
338
352
|
* }))
|
|
339
|
-
*
|
|
353
|
+
* await Effect.runPromise(Channel.runCollect(channel)) // => [[1, 2]]
|
|
340
354
|
* ```
|
|
341
355
|
*
|
|
342
356
|
* @category constructors
|
|
@@ -351,11 +365,11 @@ export declare const callbackArray: <A, E = never, R = never>(f: (queue: Queue.Q
|
|
|
351
365
|
*
|
|
352
366
|
* **Example** (Suspending channel creation)
|
|
353
367
|
*
|
|
354
|
-
* ```ts
|
|
355
|
-
* import { Channel } from "effect"
|
|
368
|
+
* ```ts import.meta.vitest
|
|
369
|
+
* import { Channel, Effect } from "effect"
|
|
356
370
|
*
|
|
357
371
|
* const channel = Channel.suspend(() => Channel.succeed(42))
|
|
358
|
-
*
|
|
372
|
+
* Effect.runSync(Channel.runCollect(channel)) // => [42]
|
|
359
373
|
* ```
|
|
360
374
|
*
|
|
361
375
|
* @category constructors
|
|
@@ -374,14 +388,16 @@ export declare const suspend: <OutElem, OutErr, OutDone, InElem, InErr, InDone,
|
|
|
374
388
|
*
|
|
375
389
|
* **Example** (Managing resources with acquire-use-release)
|
|
376
390
|
*
|
|
377
|
-
* ```ts
|
|
391
|
+
* ```ts import.meta.vitest
|
|
378
392
|
* import { Channel, Effect } from "effect"
|
|
379
393
|
*
|
|
394
|
+
* const released: Array<string> = []
|
|
380
395
|
* const channel = Channel.acquireUseRelease(
|
|
381
396
|
* Effect.succeed("resource"),
|
|
382
397
|
* (resource) => Channel.succeed(resource.toUpperCase()),
|
|
383
|
-
* (resource, exit) => Effect.
|
|
398
|
+
* (resource, exit) => Effect.sync(() => released.push(resource))
|
|
384
399
|
* )
|
|
400
|
+
* const observed = [await Effect.runPromise(Channel.runCollect(channel)), released] // => [["RESOURCE"], ["resource"]]
|
|
385
401
|
* ```
|
|
386
402
|
*
|
|
387
403
|
* @category constructors
|
|
@@ -400,13 +416,15 @@ export declare const acquireUseRelease: <A, E, R, OutElem, OutErr, OutDone, InEl
|
|
|
400
416
|
*
|
|
401
417
|
* **Example** (Managing resources with acquire-release)
|
|
402
418
|
*
|
|
403
|
-
* ```ts
|
|
419
|
+
* ```ts import.meta.vitest
|
|
404
420
|
* import { Channel, Effect } from "effect"
|
|
405
421
|
*
|
|
422
|
+
* const released: Array<string> = []
|
|
406
423
|
* const channel = Channel.acquireRelease(
|
|
407
424
|
* Effect.succeed("resource"),
|
|
408
|
-
* (resource, exit) => Effect.
|
|
425
|
+
* (resource, exit) => Effect.sync(() => released.push(resource))
|
|
409
426
|
* )
|
|
427
|
+
* const observed = [await Effect.runPromise(Channel.runCollect(channel)), released] // => [["resource"], ["resource"]]
|
|
410
428
|
* ```
|
|
411
429
|
*
|
|
412
430
|
* @category constructors
|
|
@@ -425,13 +443,15 @@ export declare const acquireRelease: {
|
|
|
425
443
|
*
|
|
426
444
|
* **Example** (Managing resources with acquire-release)
|
|
427
445
|
*
|
|
428
|
-
* ```ts
|
|
446
|
+
* ```ts import.meta.vitest
|
|
429
447
|
* import { Channel, Effect } from "effect"
|
|
430
448
|
*
|
|
449
|
+
* const released: Array<string> = []
|
|
431
450
|
* const channel = Channel.acquireRelease(
|
|
432
451
|
* Effect.succeed("resource"),
|
|
433
|
-
* (resource, exit) => Effect.
|
|
452
|
+
* (resource, exit) => Effect.sync(() => released.push(resource))
|
|
434
453
|
* )
|
|
454
|
+
* const observed = [await Effect.runPromise(Channel.runCollect(channel)), released] // => [["resource"], ["resource"]]
|
|
435
455
|
* ```
|
|
436
456
|
*
|
|
437
457
|
* @category constructors
|
|
@@ -450,13 +470,15 @@ export declare const acquireRelease: {
|
|
|
450
470
|
*
|
|
451
471
|
* **Example** (Managing resources with acquire-release)
|
|
452
472
|
*
|
|
453
|
-
* ```ts
|
|
473
|
+
* ```ts import.meta.vitest
|
|
454
474
|
* import { Channel, Effect } from "effect"
|
|
455
475
|
*
|
|
476
|
+
* const released: Array<string> = []
|
|
456
477
|
* const channel = Channel.acquireRelease(
|
|
457
478
|
* Effect.succeed("resource"),
|
|
458
|
-
* (resource, exit) => Effect.
|
|
479
|
+
* (resource, exit) => Effect.sync(() => released.push(resource))
|
|
459
480
|
* )
|
|
481
|
+
* const observed = [await Effect.runPromise(Channel.runCollect(channel)), released] // => [["resource"], ["resource"]]
|
|
460
482
|
* ```
|
|
461
483
|
*
|
|
462
484
|
* @category constructors
|
|
@@ -469,12 +491,12 @@ export declare const acquireRelease: {
|
|
|
469
491
|
*
|
|
470
492
|
* **Example** (Creating channels from iterators)
|
|
471
493
|
*
|
|
472
|
-
* ```ts
|
|
473
|
-
* import { Channel } from "effect"
|
|
494
|
+
* ```ts import.meta.vitest
|
|
495
|
+
* import { Channel, Effect } from "effect"
|
|
474
496
|
*
|
|
475
497
|
* const numbers = [1, 2, 3, 4, 5]
|
|
476
498
|
* const channel = Channel.fromIterator(() => numbers[Symbol.iterator]())
|
|
477
|
-
* //
|
|
499
|
+
* Effect.runSync(Channel.runCollect(channel)) // => [1, 2, 3, 4, 5]
|
|
478
500
|
* ```
|
|
479
501
|
*
|
|
480
502
|
* @category constructors
|
|
@@ -486,11 +508,11 @@ export declare const fromIterator: <A, L>(iterator: LazyArg<Iterator<A, L>>) =>
|
|
|
486
508
|
*
|
|
487
509
|
* **Example** (Creating channels from arrays)
|
|
488
510
|
*
|
|
489
|
-
* ```ts
|
|
490
|
-
* import { Channel } from "effect"
|
|
511
|
+
* ```ts import.meta.vitest
|
|
512
|
+
* import { Channel, Effect } from "effect"
|
|
491
513
|
*
|
|
492
514
|
* const channel = Channel.fromArray([1, 2, 3, 4, 5])
|
|
493
|
-
* //
|
|
515
|
+
* Effect.runSync(Channel.runCollect(channel)) // => [1, 2, 3, 4, 5]
|
|
494
516
|
* ```
|
|
495
517
|
*
|
|
496
518
|
* @category constructors
|
|
@@ -502,12 +524,12 @@ export declare const fromArray: <A>(array: ReadonlyArray<A>) => Channel<A>;
|
|
|
502
524
|
*
|
|
503
525
|
* **Example** (Creating channels from chunks)
|
|
504
526
|
*
|
|
505
|
-
* ```ts
|
|
506
|
-
* import { Channel, Chunk } from "effect"
|
|
527
|
+
* ```ts import.meta.vitest
|
|
528
|
+
* import { Channel, Chunk, Effect } from "effect"
|
|
507
529
|
*
|
|
508
530
|
* const chunk = Chunk.make(1, 2, 3)
|
|
509
531
|
* const channel = Channel.fromChunk(chunk)
|
|
510
|
-
* //
|
|
532
|
+
* Effect.runSync(Channel.runCollect(channel)) // => [1, 2, 3]
|
|
511
533
|
* ```
|
|
512
534
|
*
|
|
513
535
|
* @category constructors
|
|
@@ -519,8 +541,8 @@ export declare const fromChunk: <A>(chunk: Chunk.Chunk<A>) => Channel<A>;
|
|
|
519
541
|
*
|
|
520
542
|
* **Example** (Batching iterator output)
|
|
521
543
|
*
|
|
522
|
-
* ```ts
|
|
523
|
-
* import { Channel } from "effect"
|
|
544
|
+
* ```ts import.meta.vitest
|
|
545
|
+
* import { Channel, Effect } from "effect"
|
|
524
546
|
*
|
|
525
547
|
* // Create a channel from a simple iterator
|
|
526
548
|
* const numberIterator = (): Iterator<number, string> => {
|
|
@@ -536,13 +558,13 @@ export declare const fromChunk: <A>(chunk: Chunk.Chunk<A>) => Channel<A>;
|
|
|
536
558
|
* }
|
|
537
559
|
*
|
|
538
560
|
* const channel = Channel.fromIteratorArray(() => numberIterator(), 2)
|
|
539
|
-
* //
|
|
561
|
+
* Effect.runSync(Channel.runCollect(channel)) // => [[0, 1], [2]]
|
|
540
562
|
* ```
|
|
541
563
|
*
|
|
542
564
|
* **Example** (Batching generator output)
|
|
543
565
|
*
|
|
544
|
-
* ```ts
|
|
545
|
-
* import { Channel } from "effect"
|
|
566
|
+
* ```ts import.meta.vitest
|
|
567
|
+
* import { Channel, Effect } from "effect"
|
|
546
568
|
*
|
|
547
569
|
* // Create channel from a generator function
|
|
548
570
|
* function* fibonacci(): Generator<number, void, unknown> {
|
|
@@ -554,7 +576,7 @@ export declare const fromChunk: <A>(chunk: Chunk.Chunk<A>) => Channel<A>;
|
|
|
554
576
|
* }
|
|
555
577
|
*
|
|
556
578
|
* const fibChannel = Channel.fromIteratorArray(() => fibonacci(), 3)
|
|
557
|
-
* //
|
|
579
|
+
* Effect.runSync(Channel.runCollect(fibChannel)) // => [[0, 1, 1], [2, 3]]
|
|
558
580
|
* ```
|
|
559
581
|
*
|
|
560
582
|
* @category constructors
|
|
@@ -566,12 +588,12 @@ export declare const fromIteratorArray: <A, L>(iterator: LazyArg<Iterator<A, L>>
|
|
|
566
588
|
*
|
|
567
589
|
* **Example** (Creating channels from iterables)
|
|
568
590
|
*
|
|
569
|
-
* ```ts
|
|
570
|
-
* import { Channel } from "effect"
|
|
591
|
+
* ```ts import.meta.vitest
|
|
592
|
+
* import { Channel, Effect } from "effect"
|
|
571
593
|
*
|
|
572
594
|
* const set = new Set([1, 2, 3])
|
|
573
595
|
* const channel = Channel.fromIterable(set)
|
|
574
|
-
* //
|
|
596
|
+
* Effect.runSync(Channel.runCollect(channel)) // => [1, 2, 3]
|
|
575
597
|
* ```
|
|
576
598
|
*
|
|
577
599
|
* @category constructors
|
|
@@ -583,12 +605,12 @@ export declare const fromIterable: <A, L>(iterable: Iterable<A, L>) => Channel<A
|
|
|
583
605
|
*
|
|
584
606
|
* **Example** (Batching iterable output)
|
|
585
607
|
*
|
|
586
|
-
* ```ts
|
|
587
|
-
* import { Channel } from "effect"
|
|
608
|
+
* ```ts import.meta.vitest
|
|
609
|
+
* import { Channel, Effect } from "effect"
|
|
588
610
|
*
|
|
589
611
|
* const numbers = [1, 2, 3, 4, 5]
|
|
590
|
-
* const channel = Channel.fromIterableArray(numbers)
|
|
591
|
-
* //
|
|
612
|
+
* const channel = Channel.fromIterableArray(numbers, 4)
|
|
613
|
+
* Effect.runSync(Channel.runCollect(channel)) // => [[1, 2, 3, 4], [5]]
|
|
592
614
|
* ```
|
|
593
615
|
*
|
|
594
616
|
* @category constructors
|
|
@@ -600,11 +622,11 @@ export declare const fromIterableArray: <A, L>(iterable: Iterable<A, L>, chunkSi
|
|
|
600
622
|
*
|
|
601
623
|
* **Example** (Creating channels that succeed)
|
|
602
624
|
*
|
|
603
|
-
* ```ts
|
|
604
|
-
* import { Channel } from "effect"
|
|
625
|
+
* ```ts import.meta.vitest
|
|
626
|
+
* import { Channel, Effect } from "effect"
|
|
605
627
|
*
|
|
606
628
|
* const channel = Channel.succeed(42)
|
|
607
|
-
* //
|
|
629
|
+
* Effect.runSync(Channel.runCollect(channel)) // => [42]
|
|
608
630
|
* ```
|
|
609
631
|
*
|
|
610
632
|
* @category constructors
|
|
@@ -616,11 +638,11 @@ export declare const succeed: <A>(value: A) => Channel<A>;
|
|
|
616
638
|
*
|
|
617
639
|
* **Example** (Ending with a value)
|
|
618
640
|
*
|
|
619
|
-
* ```ts
|
|
620
|
-
* import { Channel } from "effect"
|
|
641
|
+
* ```ts import.meta.vitest
|
|
642
|
+
* import { Channel, Effect } from "effect"
|
|
621
643
|
*
|
|
622
644
|
* const channel = Channel.end("done")
|
|
623
|
-
* //
|
|
645
|
+
* Effect.runSync(Channel.runCollect(channel)) // => []
|
|
624
646
|
* ```
|
|
625
647
|
*
|
|
626
648
|
* @category constructors
|
|
@@ -639,8 +661,8 @@ export declare const endSync: <A>(evaluate: LazyArg<A>) => Channel<never, never,
|
|
|
639
661
|
*
|
|
640
662
|
* **Example** (Computing values lazily)
|
|
641
663
|
*
|
|
642
|
-
* ```ts
|
|
643
|
-
* import { Channel } from "effect"
|
|
664
|
+
* ```ts import.meta.vitest
|
|
665
|
+
* import { Channel, Effect } from "effect"
|
|
644
666
|
*
|
|
645
667
|
* let requests = 0
|
|
646
668
|
*
|
|
@@ -648,7 +670,7 @@ export declare const endSync: <A>(evaluate: LazyArg<A>) => Channel<never, never,
|
|
|
648
670
|
* requests += 1
|
|
649
671
|
* return `request-${requests}`
|
|
650
672
|
* })
|
|
651
|
-
* //
|
|
673
|
+
* Effect.runSync(Channel.runCollect(channel)) // => ["request-1"]
|
|
652
674
|
* ```
|
|
653
675
|
*
|
|
654
676
|
* @category constructors
|
|
@@ -660,8 +682,8 @@ export declare const sync: <A>(evaluate: LazyArg<A>) => Channel<A>;
|
|
|
660
682
|
*
|
|
661
683
|
* **Example** (Creating empty channels)
|
|
662
684
|
*
|
|
663
|
-
* ```ts
|
|
664
|
-
* import { Channel } from "effect"
|
|
685
|
+
* ```ts import.meta.vitest
|
|
686
|
+
* import { Channel, Effect } from "effect"
|
|
665
687
|
*
|
|
666
688
|
* // Create an empty channel
|
|
667
689
|
* const emptyChannel = Channel.empty
|
|
@@ -673,6 +695,8 @@ export declare const sync: <A>(evaluate: LazyArg<A>) => Channel<A>;
|
|
|
673
695
|
* // Empty channel can be used as a no-op in conditional logic
|
|
674
696
|
* const conditionalChannel = (shouldEmit: boolean) =>
|
|
675
697
|
* shouldEmit ? Channel.succeed("data") : Channel.empty
|
|
698
|
+
*
|
|
699
|
+
* Effect.runSync(Channel.runCollect(conditionalChannel(true))) // => ["data"]
|
|
676
700
|
* ```
|
|
677
701
|
*
|
|
678
702
|
* @category constructors
|
|
@@ -684,7 +708,7 @@ export declare const empty: Channel<never>;
|
|
|
684
708
|
*
|
|
685
709
|
* **Example** (Creating non-terminating channels)
|
|
686
710
|
*
|
|
687
|
-
* ```ts
|
|
711
|
+
* ```ts import.meta.vitest
|
|
688
712
|
* import { Channel } from "effect"
|
|
689
713
|
*
|
|
690
714
|
* // Create a channel that never completes
|
|
@@ -699,6 +723,8 @@ export declare const empty: Channel<never>;
|
|
|
699
723
|
* // Never channel is useful for testing or as a placeholder
|
|
700
724
|
* const conditionalChannel = (shouldComplete: boolean) =>
|
|
701
725
|
* shouldComplete ? Channel.succeed("done") : Channel.never
|
|
726
|
+
*
|
|
727
|
+
* Channel.isChannel(conditionalChannel(false)) // => true
|
|
702
728
|
* ```
|
|
703
729
|
*
|
|
704
730
|
* @category constructors
|
|
@@ -710,26 +736,11 @@ export declare const never: Channel<never, never, never>;
|
|
|
710
736
|
*
|
|
711
737
|
* **Example** (Failing with an error)
|
|
712
738
|
*
|
|
713
|
-
* ```ts
|
|
714
|
-
* import { Channel } from "effect"
|
|
739
|
+
* ```ts import.meta.vitest
|
|
740
|
+
* import { Channel, Effect, Exit } from "effect"
|
|
715
741
|
*
|
|
716
|
-
* // Create a channel that fails with a string error
|
|
717
742
|
* const failedChannel = Channel.fail("Something went wrong")
|
|
718
|
-
*
|
|
719
|
-
* // Create a channel that fails with a custom error
|
|
720
|
-
* class CustomError extends Error {
|
|
721
|
-
* constructor(message: string) {
|
|
722
|
-
* super(message)
|
|
723
|
-
* this.name = "CustomError"
|
|
724
|
-
* }
|
|
725
|
-
* }
|
|
726
|
-
* const customErrorChannel = Channel.fail(new CustomError("Custom error"))
|
|
727
|
-
*
|
|
728
|
-
* // Use in error handling by piping to another channel
|
|
729
|
-
* const channelWithFallback = Channel.concatWith(
|
|
730
|
-
* failedChannel,
|
|
731
|
-
* () => Channel.succeed("fallback value")
|
|
732
|
-
* )
|
|
743
|
+
* Effect.runSync(Effect.exit(Channel.runCollect(failedChannel))) // => Exit.fail("Something went wrong")
|
|
733
744
|
* ```
|
|
734
745
|
*
|
|
735
746
|
* @category constructors
|
|
@@ -747,27 +758,18 @@ export declare const fail: <E>(error: E) => Channel<never, E, never>;
|
|
|
747
758
|
*
|
|
748
759
|
* **Example** (Failing with a lazy error)
|
|
749
760
|
*
|
|
750
|
-
* ```ts
|
|
751
|
-
* import { Channel } from "effect"
|
|
752
|
-
*
|
|
753
|
-
* // Create a channel that fails with a lazily computed error
|
|
754
|
-
* const failedChannel = Channel.failSync(() => {
|
|
755
|
-
* console.log("Computing error...")
|
|
756
|
-
* return new Error("Computed at runtime")
|
|
757
|
-
* })
|
|
761
|
+
* ```ts import.meta.vitest
|
|
762
|
+
* import { Channel, Effect, Exit } from "effect"
|
|
758
763
|
*
|
|
759
|
-
* // The error computation is deferred until the channel runs
|
|
760
764
|
* let attempts = 0
|
|
761
765
|
* const conditionalError = Channel.failSync(() => {
|
|
762
766
|
* attempts += 1
|
|
763
767
|
* return `Error after attempt ${attempts}`
|
|
764
768
|
* })
|
|
765
|
-
*
|
|
766
|
-
*
|
|
767
|
-
*
|
|
768
|
-
*
|
|
769
|
-
* return new Error(`Failed while processing ${requestId}`)
|
|
770
|
-
* })
|
|
769
|
+
* const observed = [
|
|
770
|
+
* Effect.runSync(Effect.exit(Channel.runCollect(conditionalError))),
|
|
771
|
+
* attempts
|
|
772
|
+
* ] // => [Exit.fail("Error after attempt 1"), 1]
|
|
771
773
|
* ```
|
|
772
774
|
*
|
|
773
775
|
* @category constructors
|
|
@@ -784,20 +786,12 @@ export declare const failSync: <E>(evaluate: LazyArg<E>) => Channel<never, E, ne
|
|
|
784
786
|
*
|
|
785
787
|
* **Example** (Failing with causes)
|
|
786
788
|
*
|
|
787
|
-
* ```ts
|
|
788
|
-
* import { Cause, Channel } from "effect"
|
|
789
|
+
* ```ts import.meta.vitest
|
|
790
|
+
* import { Cause, Channel, Effect, Exit } from "effect"
|
|
789
791
|
*
|
|
790
|
-
* // Create a channel that fails with a simple cause
|
|
791
792
|
* const simpleCause = Cause.fail("Simple error")
|
|
792
793
|
* const failedChannel = Channel.failCause(simpleCause)
|
|
793
|
-
*
|
|
794
|
-
* // Create a channel with a die cause
|
|
795
|
-
* const dieCause = Cause.die(new Error("System error"))
|
|
796
|
-
* const dieFailure = Channel.failCause(dieCause)
|
|
797
|
-
*
|
|
798
|
-
* // Create a channel with a simple fail cause
|
|
799
|
-
* const failCause = Cause.fail("Simple error")
|
|
800
|
-
* const simpleFail = Channel.failCause(failCause)
|
|
794
|
+
* Effect.runSync(Effect.exit(Channel.runCollect(failedChannel))) // => Exit.failCause(simpleCause)
|
|
801
795
|
* ```
|
|
802
796
|
*
|
|
803
797
|
* @category constructors
|
|
@@ -810,8 +804,8 @@ export declare const failCause: <E>(cause: Cause.Cause<E>) => Channel<never, E,
|
|
|
810
804
|
*
|
|
811
805
|
* **Example** (Failing with lazy causes)
|
|
812
806
|
*
|
|
813
|
-
* ```ts
|
|
814
|
-
* import { Cause, Channel } from "effect"
|
|
807
|
+
* ```ts import.meta.vitest
|
|
808
|
+
* import { Cause, Channel, Effect, Exit } from "effect"
|
|
815
809
|
*
|
|
816
810
|
* // Create a channel that fails with a lazily computed cause
|
|
817
811
|
* let attempts = 0
|
|
@@ -820,11 +814,10 @@ export declare const failCause: <E>(cause: Cause.Cause<E>) => Channel<never, E,
|
|
|
820
814
|
* return Cause.fail(`Runtime error after attempt ${attempts}`)
|
|
821
815
|
* })
|
|
822
816
|
*
|
|
823
|
-
*
|
|
824
|
-
*
|
|
825
|
-
*
|
|
826
|
-
*
|
|
827
|
-
* })
|
|
817
|
+
* const observed = [
|
|
818
|
+
* Effect.runSync(Effect.exit(Channel.runCollect(failedChannel))),
|
|
819
|
+
* attempts
|
|
820
|
+
* ] // => [Exit.fail("Runtime error after attempt 1"), 1]
|
|
828
821
|
* ```
|
|
829
822
|
*
|
|
830
823
|
* @category constructors
|
|
@@ -836,20 +829,12 @@ export declare const failCauseSync: <E>(evaluate: LazyArg<Cause.Cause<E>>) => Ch
|
|
|
836
829
|
*
|
|
837
830
|
* **Example** (Dying with defects)
|
|
838
831
|
*
|
|
839
|
-
* ```ts
|
|
840
|
-
* import { Channel } from "effect"
|
|
841
|
-
*
|
|
842
|
-
* // Create a channel that dies with a string defect
|
|
843
|
-
* const diedChannel = Channel.die("Unrecoverable error")
|
|
832
|
+
* ```ts import.meta.vitest
|
|
833
|
+
* import { Cause, Channel, Effect, Exit } from "effect"
|
|
844
834
|
*
|
|
845
|
-
*
|
|
846
|
-
* const
|
|
847
|
-
*
|
|
848
|
-
* // Die with any value as a defect
|
|
849
|
-
* const objectDefect = Channel.die({
|
|
850
|
-
* code: "SYSTEM_FAILURE",
|
|
851
|
-
* details: "Critical system component failed"
|
|
852
|
-
* })
|
|
835
|
+
* const defect = "Unrecoverable error"
|
|
836
|
+
* const diedChannel = Channel.die(defect)
|
|
837
|
+
* Effect.runSync(Effect.exit(Channel.runCollect(diedChannel))) // => Exit.failCause(Cause.die(defect))
|
|
853
838
|
* ```
|
|
854
839
|
*
|
|
855
840
|
* @category constructors
|
|
@@ -861,33 +846,13 @@ export declare const die: (defect: unknown) => Channel<never, never, never>;
|
|
|
861
846
|
*
|
|
862
847
|
* **Example** (Creating channels from effects)
|
|
863
848
|
*
|
|
864
|
-
* ```ts
|
|
865
|
-
* import { Channel,
|
|
866
|
-
*
|
|
867
|
-
* class DatabaseError extends Data.TaggedError("DatabaseError")<{
|
|
868
|
-
* readonly message: string
|
|
869
|
-
* }> {}
|
|
849
|
+
* ```ts import.meta.vitest
|
|
850
|
+
* import { Channel, Effect } from "effect"
|
|
870
851
|
*
|
|
871
|
-
* // Create a channel from a successful effect
|
|
872
852
|
* const successChannel = Channel.fromEffect(
|
|
873
853
|
* Effect.succeed("Hello from effect!")
|
|
874
854
|
* )
|
|
875
|
-
*
|
|
876
|
-
* // Create a channel from an effect that might fail
|
|
877
|
-
* const fetchUserChannel = Channel.fromEffect(
|
|
878
|
-
* Effect.tryPromise({
|
|
879
|
-
* try: () => fetch("/api/user").then((res) => res.json()),
|
|
880
|
-
* catch: (error) => new DatabaseError({ message: String(error) })
|
|
881
|
-
* })
|
|
882
|
-
* )
|
|
883
|
-
*
|
|
884
|
-
* // Channel from effect with async computation
|
|
885
|
-
* const asyncChannel = Channel.fromEffect(
|
|
886
|
-
* Effect.gen(function*() {
|
|
887
|
-
* yield* Effect.sleep("100 millis")
|
|
888
|
-
* return "Async result"
|
|
889
|
-
* })
|
|
890
|
-
* )
|
|
855
|
+
* Effect.runSync(Channel.runCollect(successChannel)) // => ["Hello from effect!"]
|
|
891
856
|
* ```
|
|
892
857
|
*
|
|
893
858
|
* @category constructors
|
|
@@ -931,35 +896,17 @@ export declare const fromEffectTake: <A, E, Done, E2, R>(effect: Effect.Effect<T
|
|
|
931
896
|
*
|
|
932
897
|
* **Example** (Creating channels from queues)
|
|
933
898
|
*
|
|
934
|
-
* ```ts
|
|
935
|
-
* import {
|
|
936
|
-
*
|
|
937
|
-
* class QueueError extends Data.TaggedError("QueueError")<{
|
|
938
|
-
* readonly reason: string
|
|
939
|
-
* }> {}
|
|
899
|
+
* ```ts import.meta.vitest
|
|
900
|
+
* import { Cause, Channel, Effect, Queue } from "effect"
|
|
940
901
|
*
|
|
941
902
|
* const program = Effect.gen(function*() {
|
|
942
|
-
*
|
|
943
|
-
*
|
|
944
|
-
*
|
|
945
|
-
* // Add some items to the queue
|
|
946
|
-
* yield* Queue.offer(queue, "item1")
|
|
947
|
-
* yield* Queue.offer(queue, "item2")
|
|
948
|
-
* yield* Queue.offer(queue, "item3")
|
|
949
|
-
*
|
|
950
|
-
* // Create a channel from the queue
|
|
903
|
+
* const queue = yield* Queue.bounded<string, Cause.Done>(3)
|
|
904
|
+
* yield* Queue.offerAll(queue, ["item1", "item2", "item3"])
|
|
905
|
+
* yield* Queue.end(queue)
|
|
951
906
|
* const channel = Channel.fromQueue(queue)
|
|
952
|
-
*
|
|
953
|
-
* // The channel will read items from the queue one by one
|
|
954
|
-
* return channel
|
|
955
|
-
* })
|
|
956
|
-
*
|
|
957
|
-
* // Sliding queue example
|
|
958
|
-
* const slidingProgram = Effect.gen(function*() {
|
|
959
|
-
* const slidingQueue = yield* Queue.sliding<number, QueueError>(5)
|
|
960
|
-
* yield* Queue.offerAll(slidingQueue, [1, 2, 3, 4, 5, 6])
|
|
961
|
-
* return Channel.fromQueue(slidingQueue)
|
|
907
|
+
* return yield* Channel.runCollect(channel)
|
|
962
908
|
* })
|
|
909
|
+
* await Effect.runPromise(program) // => ["item1", "item2", "item3"]
|
|
963
910
|
* ```
|
|
964
911
|
*
|
|
965
912
|
* @category constructors
|
|
@@ -971,39 +918,17 @@ export declare const fromQueue: <A, E>(queue: Queue.Dequeue<A, E>) => Channel<A,
|
|
|
971
918
|
*
|
|
972
919
|
* **Example** (Creating batched channels from queues)
|
|
973
920
|
*
|
|
974
|
-
* ```ts
|
|
975
|
-
* import {
|
|
976
|
-
*
|
|
977
|
-
* class ProcessingError extends Data.TaggedError("ProcessingError")<{
|
|
978
|
-
* readonly stage: string
|
|
979
|
-
* }> {}
|
|
921
|
+
* ```ts import.meta.vitest
|
|
922
|
+
* import { Cause, Channel, Effect, Queue } from "effect"
|
|
980
923
|
*
|
|
981
924
|
* const program = Effect.gen(function*() {
|
|
982
|
-
*
|
|
983
|
-
*
|
|
984
|
-
*
|
|
985
|
-
* // Fill queue with data
|
|
986
|
-
* yield* Queue.offerAll(queue, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
|
|
987
|
-
*
|
|
988
|
-
* // Create a channel that reads arrays from the queue
|
|
925
|
+
* const queue = yield* Queue.bounded<number, Cause.Done>(4)
|
|
926
|
+
* yield* Queue.offerAll(queue, [1, 2, 3, 4])
|
|
927
|
+
* yield* Queue.end(queue)
|
|
989
928
|
* const arrayChannel = Channel.fromQueueArray(queue)
|
|
990
|
-
*
|
|
991
|
-
* // This will emit non-empty arrays of elements instead of individual items
|
|
992
|
-
* // Useful for batch processing scenarios
|
|
993
|
-
* return arrayChannel
|
|
994
|
-
* })
|
|
995
|
-
*
|
|
996
|
-
* // High-throughput processing example
|
|
997
|
-
* const batchProcessor = Effect.gen(function*() {
|
|
998
|
-
* const dataQueue = yield* Queue.dropping<string, ProcessingError>(1000)
|
|
999
|
-
* const batchChannel = Channel.fromQueueArray(dataQueue)
|
|
1000
|
-
*
|
|
1001
|
-
* // Process data in batches for better performance
|
|
1002
|
-
* return Channel.map(
|
|
1003
|
-
* batchChannel,
|
|
1004
|
-
* (batch) => batch.map((item) => item.toUpperCase())
|
|
1005
|
-
* )
|
|
929
|
+
* return yield* Channel.runCollect(arrayChannel)
|
|
1006
930
|
* })
|
|
931
|
+
* await Effect.runPromise(program) // => [[1, 2, 3, 4]]
|
|
1007
932
|
* ```
|
|
1008
933
|
*
|
|
1009
934
|
* @category constructors
|
|
@@ -1023,8 +948,8 @@ export declare const identity: <Elem, Err, Done>() => Channel<Elem, Err, Done, E
|
|
|
1023
948
|
*
|
|
1024
949
|
* **Example** (Creating channels from subscriptions)
|
|
1025
950
|
*
|
|
1026
|
-
* ```ts
|
|
1027
|
-
* import { Channel, Data, Effect, PubSub } from "effect"
|
|
951
|
+
* ```ts import.meta.vitest
|
|
952
|
+
* import { Channel, Data, Effect, Option, PubSub } from "effect"
|
|
1028
953
|
*
|
|
1029
954
|
* class SubscriptionError extends Data.TaggedError("SubscriptionError")<{
|
|
1030
955
|
* readonly reason: string
|
|
@@ -1049,6 +974,8 @@ export declare const identity: <Elem, Err, Done>() => Channel<Elem, Err, Done, E
|
|
|
1049
974
|
* // The channel will receive all published messages
|
|
1050
975
|
* return channel
|
|
1051
976
|
* })
|
|
977
|
+
* const result = Effect.scoped(Effect.flatMap(program, Channel.runHead))
|
|
978
|
+
* await Effect.runPromise(result) // => Option.some("Hello")
|
|
1052
979
|
*
|
|
1053
980
|
* // Real-time notifications example
|
|
1054
981
|
* const notificationChannel = Effect.gen(function*() {
|
|
@@ -1074,8 +1001,8 @@ export declare const fromSubscription: <A>(subscription: PubSub.Subscription<A>)
|
|
|
1074
1001
|
*
|
|
1075
1002
|
* **Example** (Batching subscription values)
|
|
1076
1003
|
*
|
|
1077
|
-
* ```ts
|
|
1078
|
-
* import { Channel, Data, Effect, PubSub } from "effect"
|
|
1004
|
+
* ```ts import.meta.vitest
|
|
1005
|
+
* import { Channel, Data, Effect, Option, PubSub } from "effect"
|
|
1079
1006
|
*
|
|
1080
1007
|
* class StreamError extends Data.TaggedError("StreamError")<{
|
|
1081
1008
|
* readonly message: string
|
|
@@ -1097,12 +1024,14 @@ export declare const fromSubscription: <A>(subscription: PubSub.Subscription<A>)
|
|
|
1097
1024
|
* // The channel will output arrays like [1, 2, 3] and [4]
|
|
1098
1025
|
* return channel
|
|
1099
1026
|
* })
|
|
1027
|
+
* const result = Effect.scoped(Effect.flatMap(program, Channel.runHead))
|
|
1028
|
+
* await Effect.runPromise(result) // => Option.some([1, 2, 3, 4])
|
|
1100
1029
|
* ```
|
|
1101
1030
|
*
|
|
1102
1031
|
* **Example** (Processing subscription values in batches)
|
|
1103
1032
|
*
|
|
1104
|
-
* ```ts
|
|
1105
|
-
* import { Channel, Data, Effect, PubSub } from "effect"
|
|
1033
|
+
* ```ts import.meta.vitest
|
|
1034
|
+
* import { Channel, Data, Effect, Option, PubSub } from "effect"
|
|
1106
1035
|
*
|
|
1107
1036
|
* class BatchProcessingError extends Data.TaggedError("BatchProcessingError")<{
|
|
1108
1037
|
* readonly reason: string
|
|
@@ -1116,19 +1045,21 @@ export declare const fromSubscription: <A>(subscription: PubSub.Subscription<A>)
|
|
|
1116
1045
|
* const batchChannel = Channel.fromSubscriptionArray(subscription)
|
|
1117
1046
|
*
|
|
1118
1047
|
* // Transform to process each batch
|
|
1119
|
-
* const processedChannel = Channel.map(batchChannel, (batch) =>
|
|
1120
|
-
*
|
|
1121
|
-
*
|
|
1122
|
-
* })
|
|
1048
|
+
* const processedChannel = Channel.map(batchChannel, (batch) =>
|
|
1049
|
+
* batch.map((item) => item.toUpperCase())
|
|
1050
|
+
* )
|
|
1123
1051
|
*
|
|
1052
|
+
* yield* PubSub.publishAll(pubsub, ["one", "two"])
|
|
1124
1053
|
* return processedChannel
|
|
1125
1054
|
* })
|
|
1055
|
+
* const batch = Effect.scoped(Effect.flatMap(batchProcessor, Channel.runHead))
|
|
1056
|
+
* await Effect.runPromise(batch) // => Option.some(["ONE", "TWO"])
|
|
1126
1057
|
* ```
|
|
1127
1058
|
*
|
|
1128
1059
|
* **Example** (Aggregating subscription metrics)
|
|
1129
1060
|
*
|
|
1130
|
-
* ```ts
|
|
1131
|
-
* import { Channel, Effect, PubSub } from "effect"
|
|
1061
|
+
* ```ts import.meta.vitest
|
|
1062
|
+
* import { Channel, Effect, Option, PubSub } from "effect"
|
|
1132
1063
|
*
|
|
1133
1064
|
* const metricsAggregator = Effect.gen(function*() {
|
|
1134
1065
|
* const metricsPubSub = yield* PubSub.bounded<
|
|
@@ -1158,8 +1089,12 @@ export declare const fromSubscription: <A>(subscription: PubSub.Subscription<A>)
|
|
|
1158
1089
|
* }
|
|
1159
1090
|
* })
|
|
1160
1091
|
*
|
|
1092
|
+
* yield* PubSub.publish(metricsPubSub, { timestamp: 1, value: 10 })
|
|
1161
1093
|
* return aggregatedChannel
|
|
1162
1094
|
* })
|
|
1095
|
+
* const metric = Effect.scoped(Effect.flatMap(metricsAggregator, Channel.runHead))
|
|
1096
|
+
* const result = await Effect.runPromise(metric)
|
|
1097
|
+
* Option.map(result, ({ count, sum, average, min, max }) => ({ count, sum, average, min, max })) // => Option.some({ count: 1, sum: 10, average: 10, min: 10, max: 10 })
|
|
1163
1098
|
* ```
|
|
1164
1099
|
*
|
|
1165
1100
|
* @category constructors
|
|
@@ -1177,15 +1112,15 @@ export declare const fromSubscriptionArray: <A>(subscription: PubSub.Subscriptio
|
|
|
1177
1112
|
*
|
|
1178
1113
|
* **Example** (Creating channels from PubSubs)
|
|
1179
1114
|
*
|
|
1180
|
-
* ```ts
|
|
1181
|
-
* import { Channel, Data, Effect, PubSub } from "effect"
|
|
1115
|
+
* ```ts import.meta.vitest
|
|
1116
|
+
* import { Channel, Data, Effect, Option, PubSub } from "effect"
|
|
1182
1117
|
*
|
|
1183
1118
|
* class StreamError extends Data.TaggedError("StreamError")<{
|
|
1184
1119
|
* readonly message: string
|
|
1185
1120
|
* }> {}
|
|
1186
1121
|
*
|
|
1187
1122
|
* const program = Effect.gen(function*() {
|
|
1188
|
-
* const pubsub = yield* PubSub.
|
|
1123
|
+
* const pubsub = yield* PubSub.unbounded<number>({ replay: 3 })
|
|
1189
1124
|
*
|
|
1190
1125
|
* // Create a channel that reads individual values
|
|
1191
1126
|
* const channel = Channel.fromPubSub(pubsub)
|
|
@@ -1198,15 +1133,17 @@ export declare const fromSubscriptionArray: <A>(subscription: PubSub.Subscriptio
|
|
|
1198
1133
|
* // The channel will output: 1, 2, 3 (individual values)
|
|
1199
1134
|
* return channel
|
|
1200
1135
|
* })
|
|
1136
|
+
* const result = Effect.scoped(Effect.flatMap(program, Channel.runHead))
|
|
1137
|
+
* await Effect.runPromise(result) // => Option.some(1)
|
|
1201
1138
|
* ```
|
|
1202
1139
|
*
|
|
1203
1140
|
* **Example** (Streaming PubSub notifications)
|
|
1204
1141
|
*
|
|
1205
|
-
* ```ts
|
|
1206
|
-
* import { Channel, Effect, PubSub } from "effect"
|
|
1142
|
+
* ```ts import.meta.vitest
|
|
1143
|
+
* import { Channel, Effect, Option, PubSub } from "effect"
|
|
1207
1144
|
*
|
|
1208
1145
|
* const notificationService = Effect.gen(function*() {
|
|
1209
|
-
* const notificationPubSub = yield* PubSub.
|
|
1146
|
+
* const notificationPubSub = yield* PubSub.unbounded<string>({ replay: 1 })
|
|
1210
1147
|
*
|
|
1211
1148
|
* // Create a channel for real-time notifications
|
|
1212
1149
|
* const notificationChannel = Channel.fromPubSub(notificationPubSub)
|
|
@@ -1219,14 +1156,17 @@ export declare const fromSubscriptionArray: <A>(subscription: PubSub.Subscriptio
|
|
|
1219
1156
|
* id: `notification:${message}`
|
|
1220
1157
|
* }))
|
|
1221
1158
|
*
|
|
1159
|
+
* yield* PubSub.publish(notificationPubSub, "ready")
|
|
1222
1160
|
* return timestampedChannel
|
|
1223
1161
|
* })
|
|
1162
|
+
* const notification = Effect.scoped(Effect.flatMap(notificationService, Channel.runHead))
|
|
1163
|
+
* await Effect.runPromise(notification) // => Option.some({ message: "ready", receivedAt: "2024-01-01T00:00:00.000Z", id: "notification:ready" })
|
|
1224
1164
|
* ```
|
|
1225
1165
|
*
|
|
1226
1166
|
* **Example** (Processing PubSub events)
|
|
1227
1167
|
*
|
|
1228
|
-
* ```ts
|
|
1229
|
-
* import { Channel, Effect, PubSub } from "effect"
|
|
1168
|
+
* ```ts import.meta.vitest
|
|
1169
|
+
* import { Channel, Effect, Option, PubSub } from "effect"
|
|
1230
1170
|
*
|
|
1231
1171
|
* interface DomainEvent {
|
|
1232
1172
|
* readonly type: string
|
|
@@ -1235,7 +1175,7 @@ export declare const fromSubscriptionArray: <A>(subscription: PubSub.Subscriptio
|
|
|
1235
1175
|
* }
|
|
1236
1176
|
*
|
|
1237
1177
|
* const eventProcessor = Effect.gen(function*() {
|
|
1238
|
-
* const eventPubSub = yield* PubSub.
|
|
1178
|
+
* const eventPubSub = yield* PubSub.unbounded<DomainEvent>({ replay: 1 })
|
|
1239
1179
|
*
|
|
1240
1180
|
* // Create a channel for processing domain events
|
|
1241
1181
|
* const eventChannel = Channel.fromPubSub(eventPubSub)
|
|
@@ -1252,8 +1192,11 @@ export declare const fromSubscriptionArray: <A>(subscription: PubSub.Subscriptio
|
|
|
1252
1192
|
* return event
|
|
1253
1193
|
* })
|
|
1254
1194
|
*
|
|
1195
|
+
* yield* PubSub.publish(eventPubSub, { type: "user.created", payload: {}, timestamp: 1 })
|
|
1255
1196
|
* return processedChannel
|
|
1256
1197
|
* })
|
|
1198
|
+
* const event = Effect.scoped(Effect.flatMap(eventProcessor, Channel.runHead))
|
|
1199
|
+
* const result = await Effect.runPromise(event) // => Option.some({ type: "user.created", payload: {}, timestamp: 1, processed: true, processedAt: 2 })
|
|
1257
1200
|
* ```
|
|
1258
1201
|
*
|
|
1259
1202
|
* @category constructors
|
|
@@ -1271,15 +1214,15 @@ export declare const fromPubSub: <A>(pubsub: PubSub.PubSub<A>) => Channel<A>;
|
|
|
1271
1214
|
*
|
|
1272
1215
|
* **Example** (Batching PubSub values)
|
|
1273
1216
|
*
|
|
1274
|
-
* ```ts
|
|
1275
|
-
* import { Channel, Data, Effect, PubSub } from "effect"
|
|
1217
|
+
* ```ts import.meta.vitest
|
|
1218
|
+
* import { Channel, Data, Effect, Option, PubSub } from "effect"
|
|
1276
1219
|
*
|
|
1277
1220
|
* class BatchError extends Data.TaggedError("BatchError")<{
|
|
1278
1221
|
* readonly message: string
|
|
1279
1222
|
* }> {}
|
|
1280
1223
|
*
|
|
1281
1224
|
* const program = Effect.gen(function*() {
|
|
1282
|
-
* const pubsub = yield* PubSub.
|
|
1225
|
+
* const pubsub = yield* PubSub.unbounded<number>({ replay: 4 })
|
|
1283
1226
|
*
|
|
1284
1227
|
* // Create a channel that reads arrays of values
|
|
1285
1228
|
* const channel = Channel.fromPubSubArray(pubsub)
|
|
@@ -1293,12 +1236,14 @@ export declare const fromPubSub: <A>(pubsub: PubSub.PubSub<A>) => Channel<A>;
|
|
|
1293
1236
|
* // The channel will output arrays like [1, 2, 3] and [4]
|
|
1294
1237
|
* return channel
|
|
1295
1238
|
* })
|
|
1239
|
+
* const result = Effect.scoped(Effect.flatMap(program, Channel.runHead))
|
|
1240
|
+
* await Effect.runPromise(result) // => Option.some([1, 2, 3, 4])
|
|
1296
1241
|
* ```
|
|
1297
1242
|
*
|
|
1298
1243
|
* **Example** (Processing PubSub orders in batches)
|
|
1299
1244
|
*
|
|
1300
|
-
* ```ts
|
|
1301
|
-
* import { Channel, Effect, PubSub } from "effect"
|
|
1245
|
+
* ```ts import.meta.vitest
|
|
1246
|
+
* import { Channel, Effect, Option, PubSub } from "effect"
|
|
1302
1247
|
*
|
|
1303
1248
|
* interface Order {
|
|
1304
1249
|
* readonly id: string
|
|
@@ -1309,7 +1254,7 @@ export declare const fromPubSub: <A>(pubsub: PubSub.PubSub<A>) => Channel<A>;
|
|
|
1309
1254
|
* }
|
|
1310
1255
|
*
|
|
1311
1256
|
* const orderBatchProcessor = Effect.gen(function*() {
|
|
1312
|
-
* const orderPubSub = yield* PubSub.
|
|
1257
|
+
* const orderPubSub = yield* PubSub.unbounded<Order>({ replay: 1 })
|
|
1313
1258
|
*
|
|
1314
1259
|
* // Create a channel that processes orders in batches
|
|
1315
1260
|
* const orderChannel = Channel.fromPubSubArray(orderPubSub)
|
|
@@ -1330,14 +1275,20 @@ export declare const fromPubSub: <A>(pubsub: PubSub.PubSub<A>) => Channel<A>;
|
|
|
1330
1275
|
* }
|
|
1331
1276
|
* })
|
|
1332
1277
|
*
|
|
1278
|
+
* yield* PubSub.publish(orderPubSub, {
|
|
1279
|
+
* id: "1", customerId: "a", items: ["book"], total: 10, submittedAt: 1
|
|
1280
|
+
* })
|
|
1333
1281
|
* return processedChannel
|
|
1334
1282
|
* })
|
|
1283
|
+
* const order = Effect.scoped(Effect.flatMap(orderBatchProcessor, Channel.runHead))
|
|
1284
|
+
* const result = await Effect.runPromise(order)
|
|
1285
|
+
* Option.map(result, (batch) => [batch.batchSize, batch.totalRevenue, batch.uniqueCustomers]) // => Option.some([1, 10, 1])
|
|
1335
1286
|
* ```
|
|
1336
1287
|
*
|
|
1337
1288
|
* **Example** (Processing PubSub logs in batches)
|
|
1338
1289
|
*
|
|
1339
|
-
* ```ts
|
|
1340
|
-
* import { Channel, Effect, PubSub } from "effect"
|
|
1290
|
+
* ```ts import.meta.vitest
|
|
1291
|
+
* import { Channel, Effect, Option, PubSub } from "effect"
|
|
1341
1292
|
*
|
|
1342
1293
|
* interface LogEntry {
|
|
1343
1294
|
* readonly timestamp: number
|
|
@@ -1347,7 +1298,7 @@ export declare const fromPubSub: <A>(pubsub: PubSub.PubSub<A>) => Channel<A>;
|
|
|
1347
1298
|
* }
|
|
1348
1299
|
*
|
|
1349
1300
|
* const logAggregator = Effect.gen(function*() {
|
|
1350
|
-
* const logPubSub = yield* PubSub.
|
|
1301
|
+
* const logPubSub = yield* PubSub.unbounded<LogEntry>({ replay: 1 })
|
|
1351
1302
|
*
|
|
1352
1303
|
* // Create a channel that collects logs in batches
|
|
1353
1304
|
* const logChannel = Channel.fromPubSubArray(logPubSub)
|
|
@@ -1374,8 +1325,17 @@ export declare const fromPubSub: <A>(pubsub: PubSub.PubSub<A>) => Channel<A>;
|
|
|
1374
1325
|
* }
|
|
1375
1326
|
* })
|
|
1376
1327
|
*
|
|
1328
|
+
* yield* PubSub.publish(logPubSub, {
|
|
1329
|
+
* timestamp: 1,
|
|
1330
|
+
* level: "info",
|
|
1331
|
+
* message: "ready",
|
|
1332
|
+
* source: "app"
|
|
1333
|
+
* } satisfies LogEntry)
|
|
1377
1334
|
* return analysisChannel
|
|
1378
1335
|
* })
|
|
1336
|
+
* const log = Effect.scoped(Effect.flatMap(logAggregator, Channel.runHead))
|
|
1337
|
+
* const result = await Effect.runPromise(log)
|
|
1338
|
+
* Option.map(result, (batch) => [batch.batchId, batch.totalEntries, batch.infoCount]) // => Option.some(["1-1", 1, 1])
|
|
1379
1339
|
* ```
|
|
1380
1340
|
*
|
|
1381
1341
|
* @category constructors
|
|
@@ -1401,6 +1361,106 @@ export declare const fromPubSubTake: <A, E, Done>(pubsub: PubSub.PubSub<Take.Tak
|
|
|
1401
1361
|
* @since 4.0.0
|
|
1402
1362
|
*/
|
|
1403
1363
|
export declare const fromSchedule: <O, E, R>(schedule: Schedule.Schedule<O, unknown, E, R>) => Channel<O, E, O, unknown, unknown, unknown, R>;
|
|
1364
|
+
/**
|
|
1365
|
+
* Creates a channel from a lazily supplied Web `ReadableStream`.
|
|
1366
|
+
*
|
|
1367
|
+
* **Example** (Reading from a Web stream)
|
|
1368
|
+
*
|
|
1369
|
+
* ```ts import.meta.vitest
|
|
1370
|
+
* import { Channel, Effect } from "effect"
|
|
1371
|
+
*
|
|
1372
|
+
* const channel = Channel.fromReadableStream({
|
|
1373
|
+
* evaluate: () => new ReadableStream({
|
|
1374
|
+
* start(controller) {
|
|
1375
|
+
* controller.enqueue(1)
|
|
1376
|
+
* controller.close()
|
|
1377
|
+
* }
|
|
1378
|
+
* }),
|
|
1379
|
+
* onError: (cause) => new Error(String(cause))
|
|
1380
|
+
* })
|
|
1381
|
+
*
|
|
1382
|
+
* await Effect.runPromise(Channel.runCollect(channel)) // => [[1]]
|
|
1383
|
+
* ```
|
|
1384
|
+
*
|
|
1385
|
+
* @category constructors
|
|
1386
|
+
* @since 4.0.0
|
|
1387
|
+
*/
|
|
1388
|
+
export declare const fromReadableStream: <A, E>(options: {
|
|
1389
|
+
readonly evaluate: LazyArg<ReadableStream<A>>;
|
|
1390
|
+
readonly onError: (error: unknown) => E;
|
|
1391
|
+
readonly releaseLockOnEnd?: boolean | undefined;
|
|
1392
|
+
}) => Channel<Arr.NonEmptyReadonlyArray<A>, E>;
|
|
1393
|
+
/**
|
|
1394
|
+
* Creates a channel that writes upstream values to a lazily supplied Web
|
|
1395
|
+
* `WritableStream`.
|
|
1396
|
+
*
|
|
1397
|
+
* **Example** (Writing channel input)
|
|
1398
|
+
*
|
|
1399
|
+
* ```ts import.meta.vitest
|
|
1400
|
+
* import { Channel, Effect } from "effect"
|
|
1401
|
+
*
|
|
1402
|
+
* const written: Array<number> = []
|
|
1403
|
+
* const sink = Channel.fromWritableStream<never, Error, number>({
|
|
1404
|
+
* evaluate: () => new WritableStream({
|
|
1405
|
+
* write(value) {
|
|
1406
|
+
* written.push(value)
|
|
1407
|
+
* }
|
|
1408
|
+
* }),
|
|
1409
|
+
* onError: (cause) => new Error(String(cause))
|
|
1410
|
+
* })
|
|
1411
|
+
*
|
|
1412
|
+
* const program = Channel.fromArray([[1, 2] as [number, number]]).pipe(
|
|
1413
|
+
* Channel.pipeTo(sink),
|
|
1414
|
+
* Channel.runDrain
|
|
1415
|
+
* )
|
|
1416
|
+
*
|
|
1417
|
+
* await Effect.runPromise(program)
|
|
1418
|
+
* written // => [1, 2]
|
|
1419
|
+
* ```
|
|
1420
|
+
*
|
|
1421
|
+
* @category constructors
|
|
1422
|
+
* @since 4.0.0
|
|
1423
|
+
*/
|
|
1424
|
+
export declare const fromWritableStream: <IE, E, A>(options: {
|
|
1425
|
+
readonly evaluate: LazyArg<WritableStream<A>>;
|
|
1426
|
+
readonly onError: (error: unknown) => E;
|
|
1427
|
+
readonly closeOnDone?: boolean | undefined;
|
|
1428
|
+
}) => Channel<never, IE | E, void, Arr.NonEmptyReadonlyArray<A>, IE>;
|
|
1429
|
+
/**
|
|
1430
|
+
* Creates a channel backed by a Web `TransformStream`, writing upstream values
|
|
1431
|
+
* while emitting transformed values from its readable side.
|
|
1432
|
+
*
|
|
1433
|
+
* **Example** (Transforming channel input)
|
|
1434
|
+
*
|
|
1435
|
+
* ```ts import.meta.vitest
|
|
1436
|
+
* import { Channel, Effect } from "effect"
|
|
1437
|
+
*
|
|
1438
|
+
* const transform = Channel.fromTransformStream<never, number, number, Error>({
|
|
1439
|
+
* evaluate: () => new TransformStream({
|
|
1440
|
+
* transform(value, controller) {
|
|
1441
|
+
* controller.enqueue(value * 2)
|
|
1442
|
+
* }
|
|
1443
|
+
* }),
|
|
1444
|
+
* onError: (cause) => new Error(String(cause))
|
|
1445
|
+
* })
|
|
1446
|
+
*
|
|
1447
|
+
* const program = Channel.fromArray([[1, 2] as [number, number]]).pipe(
|
|
1448
|
+
* Channel.pipeTo(transform),
|
|
1449
|
+
* Channel.runCollect
|
|
1450
|
+
* )
|
|
1451
|
+
*
|
|
1452
|
+
* await Effect.runPromise(program) // => [[2], [4]]
|
|
1453
|
+
* ```
|
|
1454
|
+
*
|
|
1455
|
+
* @category constructors
|
|
1456
|
+
* @since 4.0.0
|
|
1457
|
+
*/
|
|
1458
|
+
export declare const fromTransformStream: <IE, I, O, E>(options: {
|
|
1459
|
+
readonly evaluate: LazyArg<TransformStream<I, O>>;
|
|
1460
|
+
readonly onError: (error: unknown) => E;
|
|
1461
|
+
readonly closeOnDone?: boolean | undefined;
|
|
1462
|
+
readonly releaseLockOnEnd?: boolean | undefined;
|
|
1463
|
+
}) => Channel<Arr.NonEmptyReadonlyArray<O>, IE | E, void, Arr.NonEmptyReadonlyArray<I>, IE>;
|
|
1404
1464
|
/**
|
|
1405
1465
|
* Creates a channel that pulls values from an `AsyncIterable`.
|
|
1406
1466
|
*
|
|
@@ -1434,8 +1494,8 @@ export declare const fromAsyncIterableArray: <A, D, E>(iterable: AsyncIterable<A
|
|
|
1434
1494
|
*
|
|
1435
1495
|
* **Example** (Mapping channel output)
|
|
1436
1496
|
*
|
|
1437
|
-
* ```ts
|
|
1438
|
-
* import { Channel, Data } from "effect"
|
|
1497
|
+
* ```ts import.meta.vitest
|
|
1498
|
+
* import { Channel, Data, Effect } from "effect"
|
|
1439
1499
|
*
|
|
1440
1500
|
* class TransformError extends Data.TaggedError("TransformError")<{
|
|
1441
1501
|
* readonly reason: string
|
|
@@ -1444,12 +1504,12 @@ export declare const fromAsyncIterableArray: <A, D, E>(iterable: AsyncIterable<A
|
|
|
1444
1504
|
* // Basic mapping of channel values
|
|
1445
1505
|
* const numbersChannel = Channel.fromIterable([1, 2, 3, 4, 5])
|
|
1446
1506
|
* const doubledChannel = Channel.map(numbersChannel, (n) => n * 2)
|
|
1447
|
-
* //
|
|
1507
|
+
* Effect.runSync(Channel.runCollect(doubledChannel)) // => [2, 4, 6, 8, 10]
|
|
1448
1508
|
*
|
|
1449
1509
|
* // Transform string data
|
|
1450
1510
|
* const wordsChannel = Channel.fromIterable(["hello", "world", "effect"])
|
|
1451
1511
|
* const upperCaseChannel = Channel.map(wordsChannel, (word) => word.toUpperCase())
|
|
1452
|
-
* //
|
|
1512
|
+
* Effect.runSync(Channel.runCollect(upperCaseChannel)) // => ["HELLO", "WORLD", "EFFECT"]
|
|
1453
1513
|
*
|
|
1454
1514
|
* // Complex object transformation
|
|
1455
1515
|
* type User = { id: number; name: string }
|
|
@@ -1463,6 +1523,7 @@ export declare const fromAsyncIterableArray: <A, D, E>(iterable: AsyncIterable<A
|
|
|
1463
1523
|
* displayName: `User: ${user.name}`,
|
|
1464
1524
|
* isActive: true
|
|
1465
1525
|
* }))
|
|
1526
|
+
* Effect.runSync(Channel.runCollect(displayChannel)) // => [{ displayName: "User: Alice", isActive: true }, { displayName: "User: Bob", isActive: true }]
|
|
1466
1527
|
* ```
|
|
1467
1528
|
*
|
|
1468
1529
|
* @category sequencing
|
|
@@ -1474,8 +1535,8 @@ export declare const map: {
|
|
|
1474
1535
|
*
|
|
1475
1536
|
* **Example** (Mapping channel output)
|
|
1476
1537
|
*
|
|
1477
|
-
* ```ts
|
|
1478
|
-
* import { Channel, Data } from "effect"
|
|
1538
|
+
* ```ts import.meta.vitest
|
|
1539
|
+
* import { Channel, Data, Effect } from "effect"
|
|
1479
1540
|
*
|
|
1480
1541
|
* class TransformError extends Data.TaggedError("TransformError")<{
|
|
1481
1542
|
* readonly reason: string
|
|
@@ -1484,12 +1545,12 @@ export declare const map: {
|
|
|
1484
1545
|
* // Basic mapping of channel values
|
|
1485
1546
|
* const numbersChannel = Channel.fromIterable([1, 2, 3, 4, 5])
|
|
1486
1547
|
* const doubledChannel = Channel.map(numbersChannel, (n) => n * 2)
|
|
1487
|
-
* //
|
|
1548
|
+
* Effect.runSync(Channel.runCollect(doubledChannel)) // => [2, 4, 6, 8, 10]
|
|
1488
1549
|
*
|
|
1489
1550
|
* // Transform string data
|
|
1490
1551
|
* const wordsChannel = Channel.fromIterable(["hello", "world", "effect"])
|
|
1491
1552
|
* const upperCaseChannel = Channel.map(wordsChannel, (word) => word.toUpperCase())
|
|
1492
|
-
* //
|
|
1553
|
+
* Effect.runSync(Channel.runCollect(upperCaseChannel)) // => ["HELLO", "WORLD", "EFFECT"]
|
|
1493
1554
|
*
|
|
1494
1555
|
* // Complex object transformation
|
|
1495
1556
|
* type User = { id: number; name: string }
|
|
@@ -1503,6 +1564,7 @@ export declare const map: {
|
|
|
1503
1564
|
* displayName: `User: ${user.name}`,
|
|
1504
1565
|
* isActive: true
|
|
1505
1566
|
* }))
|
|
1567
|
+
* Effect.runSync(Channel.runCollect(displayChannel)) // => [{ displayName: "User: Alice", isActive: true }, { displayName: "User: Bob", isActive: true }]
|
|
1506
1568
|
* ```
|
|
1507
1569
|
*
|
|
1508
1570
|
* @category sequencing
|
|
@@ -1514,8 +1576,8 @@ export declare const map: {
|
|
|
1514
1576
|
*
|
|
1515
1577
|
* **Example** (Mapping channel output)
|
|
1516
1578
|
*
|
|
1517
|
-
* ```ts
|
|
1518
|
-
* import { Channel, Data } from "effect"
|
|
1579
|
+
* ```ts import.meta.vitest
|
|
1580
|
+
* import { Channel, Data, Effect } from "effect"
|
|
1519
1581
|
*
|
|
1520
1582
|
* class TransformError extends Data.TaggedError("TransformError")<{
|
|
1521
1583
|
* readonly reason: string
|
|
@@ -1524,12 +1586,12 @@ export declare const map: {
|
|
|
1524
1586
|
* // Basic mapping of channel values
|
|
1525
1587
|
* const numbersChannel = Channel.fromIterable([1, 2, 3, 4, 5])
|
|
1526
1588
|
* const doubledChannel = Channel.map(numbersChannel, (n) => n * 2)
|
|
1527
|
-
* //
|
|
1589
|
+
* Effect.runSync(Channel.runCollect(doubledChannel)) // => [2, 4, 6, 8, 10]
|
|
1528
1590
|
*
|
|
1529
1591
|
* // Transform string data
|
|
1530
1592
|
* const wordsChannel = Channel.fromIterable(["hello", "world", "effect"])
|
|
1531
1593
|
* const upperCaseChannel = Channel.map(wordsChannel, (word) => word.toUpperCase())
|
|
1532
|
-
* //
|
|
1594
|
+
* Effect.runSync(Channel.runCollect(upperCaseChannel)) // => ["HELLO", "WORLD", "EFFECT"]
|
|
1533
1595
|
*
|
|
1534
1596
|
* // Complex object transformation
|
|
1535
1597
|
* type User = { id: number; name: string }
|
|
@@ -1543,6 +1605,7 @@ export declare const map: {
|
|
|
1543
1605
|
* displayName: `User: ${user.name}`,
|
|
1544
1606
|
* isActive: true
|
|
1545
1607
|
* }))
|
|
1608
|
+
* Effect.runSync(Channel.runCollect(displayChannel)) // => [{ displayName: "User: Alice", isActive: true }, { displayName: "User: Bob", isActive: true }]
|
|
1546
1609
|
* ```
|
|
1547
1610
|
*
|
|
1548
1611
|
* @category sequencing
|
|
@@ -1627,40 +1690,15 @@ export declare const mapDoneEffect: {
|
|
|
1627
1690
|
*
|
|
1628
1691
|
* **Example** (Mapping channel output with effects)
|
|
1629
1692
|
*
|
|
1630
|
-
* ```ts
|
|
1631
|
-
* import { Channel,
|
|
1632
|
-
*
|
|
1633
|
-
* class NetworkError extends Data.TaggedError("NetworkError")<{
|
|
1634
|
-
* readonly url: string
|
|
1635
|
-
* }> {}
|
|
1636
|
-
*
|
|
1637
|
-
* // Transform values using effectful operations
|
|
1638
|
-
* const urlsChannel = Channel.fromIterable([
|
|
1639
|
-
* "/api/users/1",
|
|
1640
|
-
* "/api/users/2",
|
|
1641
|
-
* "/api/users/3"
|
|
1642
|
-
* ])
|
|
1643
|
-
*
|
|
1644
|
-
* const fetchDataChannel = Channel.mapEffect(
|
|
1645
|
-
* urlsChannel,
|
|
1646
|
-
* (url) =>
|
|
1647
|
-
* Effect.tryPromise({
|
|
1648
|
-
* try: () => fetch(url).then((res) => res.json()),
|
|
1649
|
-
* catch: () => new NetworkError({ url })
|
|
1650
|
-
* })
|
|
1651
|
-
* )
|
|
1693
|
+
* ```ts import.meta.vitest
|
|
1694
|
+
* import { Channel, Effect } from "effect"
|
|
1652
1695
|
*
|
|
1653
|
-
* // Concurrent processing with options
|
|
1654
1696
|
* const numbersChannel = Channel.fromIterable([1, 2, 3, 4, 5])
|
|
1655
1697
|
* const processedChannel = Channel.mapEffect(
|
|
1656
1698
|
* numbersChannel,
|
|
1657
|
-
* (n) =>
|
|
1658
|
-
* Effect.gen(function*() {
|
|
1659
|
-
* yield* Effect.sleep("100 millis") // Simulate async work
|
|
1660
|
-
* return n * n
|
|
1661
|
-
* }),
|
|
1662
|
-
* { concurrency: 3, unordered: true }
|
|
1699
|
+
* (n) => Effect.succeed(n * n)
|
|
1663
1700
|
* )
|
|
1701
|
+
* await Effect.runPromise(Channel.runCollect(processedChannel)) // => [1, 4, 9, 16, 25]
|
|
1664
1702
|
* ```
|
|
1665
1703
|
*
|
|
1666
1704
|
* @category sequencing
|
|
@@ -1685,40 +1723,15 @@ export declare const mapEffect: {
|
|
|
1685
1723
|
*
|
|
1686
1724
|
* **Example** (Mapping channel output with effects)
|
|
1687
1725
|
*
|
|
1688
|
-
* ```ts
|
|
1689
|
-
* import { Channel,
|
|
1690
|
-
*
|
|
1691
|
-
* class NetworkError extends Data.TaggedError("NetworkError")<{
|
|
1692
|
-
* readonly url: string
|
|
1693
|
-
* }> {}
|
|
1694
|
-
*
|
|
1695
|
-
* // Transform values using effectful operations
|
|
1696
|
-
* const urlsChannel = Channel.fromIterable([
|
|
1697
|
-
* "/api/users/1",
|
|
1698
|
-
* "/api/users/2",
|
|
1699
|
-
* "/api/users/3"
|
|
1700
|
-
* ])
|
|
1701
|
-
*
|
|
1702
|
-
* const fetchDataChannel = Channel.mapEffect(
|
|
1703
|
-
* urlsChannel,
|
|
1704
|
-
* (url) =>
|
|
1705
|
-
* Effect.tryPromise({
|
|
1706
|
-
* try: () => fetch(url).then((res) => res.json()),
|
|
1707
|
-
* catch: () => new NetworkError({ url })
|
|
1708
|
-
* })
|
|
1709
|
-
* )
|
|
1726
|
+
* ```ts import.meta.vitest
|
|
1727
|
+
* import { Channel, Effect } from "effect"
|
|
1710
1728
|
*
|
|
1711
|
-
* // Concurrent processing with options
|
|
1712
1729
|
* const numbersChannel = Channel.fromIterable([1, 2, 3, 4, 5])
|
|
1713
1730
|
* const processedChannel = Channel.mapEffect(
|
|
1714
1731
|
* numbersChannel,
|
|
1715
|
-
* (n) =>
|
|
1716
|
-
* Effect.gen(function*() {
|
|
1717
|
-
* yield* Effect.sleep("100 millis") // Simulate async work
|
|
1718
|
-
* return n * n
|
|
1719
|
-
* }),
|
|
1720
|
-
* { concurrency: 3, unordered: true }
|
|
1732
|
+
* (n) => Effect.succeed(n * n)
|
|
1721
1733
|
* )
|
|
1734
|
+
* await Effect.runPromise(Channel.runCollect(processedChannel)) // => [1, 4, 9, 16, 25]
|
|
1722
1735
|
* ```
|
|
1723
1736
|
*
|
|
1724
1737
|
* @category sequencing
|
|
@@ -1746,40 +1759,15 @@ export declare const mapEffect: {
|
|
|
1746
1759
|
*
|
|
1747
1760
|
* **Example** (Mapping channel output with effects)
|
|
1748
1761
|
*
|
|
1749
|
-
* ```ts
|
|
1750
|
-
* import { Channel,
|
|
1751
|
-
*
|
|
1752
|
-
* class NetworkError extends Data.TaggedError("NetworkError")<{
|
|
1753
|
-
* readonly url: string
|
|
1754
|
-
* }> {}
|
|
1755
|
-
*
|
|
1756
|
-
* // Transform values using effectful operations
|
|
1757
|
-
* const urlsChannel = Channel.fromIterable([
|
|
1758
|
-
* "/api/users/1",
|
|
1759
|
-
* "/api/users/2",
|
|
1760
|
-
* "/api/users/3"
|
|
1761
|
-
* ])
|
|
1762
|
-
*
|
|
1763
|
-
* const fetchDataChannel = Channel.mapEffect(
|
|
1764
|
-
* urlsChannel,
|
|
1765
|
-
* (url) =>
|
|
1766
|
-
* Effect.tryPromise({
|
|
1767
|
-
* try: () => fetch(url).then((res) => res.json()),
|
|
1768
|
-
* catch: () => new NetworkError({ url })
|
|
1769
|
-
* })
|
|
1770
|
-
* )
|
|
1762
|
+
* ```ts import.meta.vitest
|
|
1763
|
+
* import { Channel, Effect } from "effect"
|
|
1771
1764
|
*
|
|
1772
|
-
* // Concurrent processing with options
|
|
1773
1765
|
* const numbersChannel = Channel.fromIterable([1, 2, 3, 4, 5])
|
|
1774
1766
|
* const processedChannel = Channel.mapEffect(
|
|
1775
1767
|
* numbersChannel,
|
|
1776
|
-
* (n) =>
|
|
1777
|
-
* Effect.gen(function*() {
|
|
1778
|
-
* yield* Effect.sleep("100 millis") // Simulate async work
|
|
1779
|
-
* return n * n
|
|
1780
|
-
* }),
|
|
1781
|
-
* { concurrency: 3, unordered: true }
|
|
1768
|
+
* (n) => Effect.succeed(n * n)
|
|
1782
1769
|
* )
|
|
1770
|
+
* await Effect.runPromise(Channel.runCollect(processedChannel)) // => [1, 4, 9, 16, 25]
|
|
1783
1771
|
* ```
|
|
1784
1772
|
*
|
|
1785
1773
|
* @category sequencing
|
|
@@ -1852,8 +1840,8 @@ export declare const mapInputError: {
|
|
|
1852
1840
|
*
|
|
1853
1841
|
* **Example** (Tapping channel output)
|
|
1854
1842
|
*
|
|
1855
|
-
* ```ts
|
|
1856
|
-
* import { Channel,
|
|
1843
|
+
* ```ts import.meta.vitest
|
|
1844
|
+
* import { Channel, Data, Effect } from "effect"
|
|
1857
1845
|
*
|
|
1858
1846
|
* class LogError extends Data.TaggedError("LogError")<{
|
|
1859
1847
|
* readonly message: string
|
|
@@ -1863,13 +1851,13 @@ export declare const mapInputError: {
|
|
|
1863
1851
|
* const numberChannel = Channel.fromIterable([1, 2, 3])
|
|
1864
1852
|
*
|
|
1865
1853
|
* // Tap into each output element to perform side effects
|
|
1854
|
+
* const processed: Array<number> = []
|
|
1866
1855
|
* const tappedChannel = Channel.tap(
|
|
1867
1856
|
* numberChannel,
|
|
1868
|
-
* (n) =>
|
|
1857
|
+
* (n) => Effect.sync(() => processed.push(n))
|
|
1869
1858
|
* )
|
|
1870
1859
|
*
|
|
1871
|
-
*
|
|
1872
|
-
* // Outputs: 1, 2, 3 (while logging each)
|
|
1860
|
+
* const observed = [await Effect.runPromise(Channel.runCollect(tappedChannel)), processed] // => [[1, 2, 3], [1, 2, 3]]
|
|
1873
1861
|
* ```
|
|
1874
1862
|
*
|
|
1875
1863
|
* @category sequencing
|
|
@@ -1888,8 +1876,8 @@ export declare const tap: {
|
|
|
1888
1876
|
*
|
|
1889
1877
|
* **Example** (Tapping channel output)
|
|
1890
1878
|
*
|
|
1891
|
-
* ```ts
|
|
1892
|
-
* import { Channel,
|
|
1879
|
+
* ```ts import.meta.vitest
|
|
1880
|
+
* import { Channel, Data, Effect } from "effect"
|
|
1893
1881
|
*
|
|
1894
1882
|
* class LogError extends Data.TaggedError("LogError")<{
|
|
1895
1883
|
* readonly message: string
|
|
@@ -1899,13 +1887,13 @@ export declare const tap: {
|
|
|
1899
1887
|
* const numberChannel = Channel.fromIterable([1, 2, 3])
|
|
1900
1888
|
*
|
|
1901
1889
|
* // Tap into each output element to perform side effects
|
|
1890
|
+
* const processed: Array<number> = []
|
|
1902
1891
|
* const tappedChannel = Channel.tap(
|
|
1903
1892
|
* numberChannel,
|
|
1904
|
-
* (n) =>
|
|
1893
|
+
* (n) => Effect.sync(() => processed.push(n))
|
|
1905
1894
|
* )
|
|
1906
1895
|
*
|
|
1907
|
-
*
|
|
1908
|
-
* // Outputs: 1, 2, 3 (while logging each)
|
|
1896
|
+
* const observed = [await Effect.runPromise(Channel.runCollect(tappedChannel)), processed] // => [[1, 2, 3], [1, 2, 3]]
|
|
1909
1897
|
* ```
|
|
1910
1898
|
*
|
|
1911
1899
|
* @category sequencing
|
|
@@ -1926,8 +1914,8 @@ export declare const tap: {
|
|
|
1926
1914
|
*
|
|
1927
1915
|
* **Example** (Tapping channel output)
|
|
1928
1916
|
*
|
|
1929
|
-
* ```ts
|
|
1930
|
-
* import { Channel,
|
|
1917
|
+
* ```ts import.meta.vitest
|
|
1918
|
+
* import { Channel, Data, Effect } from "effect"
|
|
1931
1919
|
*
|
|
1932
1920
|
* class LogError extends Data.TaggedError("LogError")<{
|
|
1933
1921
|
* readonly message: string
|
|
@@ -1937,13 +1925,13 @@ export declare const tap: {
|
|
|
1937
1925
|
* const numberChannel = Channel.fromIterable([1, 2, 3])
|
|
1938
1926
|
*
|
|
1939
1927
|
* // Tap into each output element to perform side effects
|
|
1928
|
+
* const processed: Array<number> = []
|
|
1940
1929
|
* const tappedChannel = Channel.tap(
|
|
1941
1930
|
* numberChannel,
|
|
1942
|
-
* (n) =>
|
|
1931
|
+
* (n) => Effect.sync(() => processed.push(n))
|
|
1943
1932
|
* )
|
|
1944
1933
|
*
|
|
1945
|
-
*
|
|
1946
|
-
* // Outputs: 1, 2, 3 (while logging each)
|
|
1934
|
+
* const observed = [await Effect.runPromise(Channel.runCollect(tappedChannel)), processed] // => [[1, 2, 3], [1, 2, 3]]
|
|
1947
1935
|
* ```
|
|
1948
1936
|
*
|
|
1949
1937
|
* @category sequencing
|
|
@@ -1966,8 +1954,8 @@ export declare const tap: {
|
|
|
1966
1954
|
*
|
|
1967
1955
|
* **Example** (Flat mapping channel output)
|
|
1968
1956
|
*
|
|
1969
|
-
* ```ts
|
|
1970
|
-
* import { Channel, Data } from "effect"
|
|
1957
|
+
* ```ts import.meta.vitest
|
|
1958
|
+
* import { Channel, Data, Effect } from "effect"
|
|
1971
1959
|
*
|
|
1972
1960
|
* class ProcessError extends Data.TaggedError("ProcessError")<{
|
|
1973
1961
|
* readonly cause: string
|
|
@@ -1983,8 +1971,7 @@ export declare const tap: {
|
|
|
1983
1971
|
* Channel.fromIterable(Array.from({ length: n }, (_, i) => `item-${n}-${i}`))
|
|
1984
1972
|
* )
|
|
1985
1973
|
*
|
|
1986
|
-
* //
|
|
1987
|
-
* // Outputs: "item-1-0", "item-2-0", "item-2-1", "item-3-0", "item-3-1", "item-3-2"
|
|
1974
|
+
* Effect.runSync(Channel.runCollect(flatMappedChannel)) // => ["item-1-0", "item-2-0", "item-2-1", "item-3-0", "item-3-1", "item-3-2"]
|
|
1988
1975
|
* ```
|
|
1989
1976
|
*
|
|
1990
1977
|
* @category sequencing
|
|
@@ -2004,8 +1991,8 @@ export declare const flatMap: {
|
|
|
2004
1991
|
*
|
|
2005
1992
|
* **Example** (Flat mapping channel output)
|
|
2006
1993
|
*
|
|
2007
|
-
* ```ts
|
|
2008
|
-
* import { Channel, Data } from "effect"
|
|
1994
|
+
* ```ts import.meta.vitest
|
|
1995
|
+
* import { Channel, Data, Effect } from "effect"
|
|
2009
1996
|
*
|
|
2010
1997
|
* class ProcessError extends Data.TaggedError("ProcessError")<{
|
|
2011
1998
|
* readonly cause: string
|
|
@@ -2021,8 +2008,7 @@ export declare const flatMap: {
|
|
|
2021
2008
|
* Channel.fromIterable(Array.from({ length: n }, (_, i) => `item-${n}-${i}`))
|
|
2022
2009
|
* )
|
|
2023
2010
|
*
|
|
2024
|
-
* //
|
|
2025
|
-
* // Outputs: "item-1-0", "item-2-0", "item-2-1", "item-3-0", "item-3-1", "item-3-2"
|
|
2011
|
+
* Effect.runSync(Channel.runCollect(flatMappedChannel)) // => ["item-1-0", "item-2-0", "item-2-1", "item-3-0", "item-3-1", "item-3-2"]
|
|
2026
2012
|
* ```
|
|
2027
2013
|
*
|
|
2028
2014
|
* @category sequencing
|
|
@@ -2045,8 +2031,8 @@ export declare const flatMap: {
|
|
|
2045
2031
|
*
|
|
2046
2032
|
* **Example** (Flat mapping channel output)
|
|
2047
2033
|
*
|
|
2048
|
-
* ```ts
|
|
2049
|
-
* import { Channel, Data } from "effect"
|
|
2034
|
+
* ```ts import.meta.vitest
|
|
2035
|
+
* import { Channel, Data, Effect } from "effect"
|
|
2050
2036
|
*
|
|
2051
2037
|
* class ProcessError extends Data.TaggedError("ProcessError")<{
|
|
2052
2038
|
* readonly cause: string
|
|
@@ -2062,8 +2048,7 @@ export declare const flatMap: {
|
|
|
2062
2048
|
* Channel.fromIterable(Array.from({ length: n }, (_, i) => `item-${n}-${i}`))
|
|
2063
2049
|
* )
|
|
2064
2050
|
*
|
|
2065
|
-
* //
|
|
2066
|
-
* // Outputs: "item-1-0", "item-2-0", "item-2-1", "item-3-0", "item-3-1", "item-3-2"
|
|
2051
|
+
* Effect.runSync(Channel.runCollect(flatMappedChannel)) // => ["item-1-0", "item-2-0", "item-2-1", "item-3-0", "item-3-1", "item-3-2"]
|
|
2067
2052
|
* ```
|
|
2068
2053
|
*
|
|
2069
2054
|
* @category sequencing
|
|
@@ -2080,8 +2065,8 @@ export declare const flatMap: {
|
|
|
2080
2065
|
*
|
|
2081
2066
|
* **Example** (Concatenating with completion values)
|
|
2082
2067
|
*
|
|
2083
|
-
* ```ts
|
|
2084
|
-
* import { Channel, Data } from "effect"
|
|
2068
|
+
* ```ts import.meta.vitest
|
|
2069
|
+
* import { Channel, Data, Effect } from "effect"
|
|
2085
2070
|
*
|
|
2086
2071
|
* class ConcatError extends Data.TaggedError("ConcatError")<{
|
|
2087
2072
|
* readonly reason: string
|
|
@@ -2092,8 +2077,7 @@ export declare const flatMap: {
|
|
|
2092
2077
|
* Channel.concatWith((sum: void) => Channel.succeed(`Completed processing`))
|
|
2093
2078
|
* )
|
|
2094
2079
|
*
|
|
2095
|
-
* //
|
|
2096
|
-
* // Outputs: 1, 2, 3, then "Completed processing"
|
|
2080
|
+
* Effect.runSync(Channel.runCollect(numberChannel)) // => [1, 2, 3, "Completed processing"]
|
|
2097
2081
|
* ```
|
|
2098
2082
|
*
|
|
2099
2083
|
* @category sequencing
|
|
@@ -2106,8 +2090,8 @@ export declare const concatWith: {
|
|
|
2106
2090
|
*
|
|
2107
2091
|
* **Example** (Concatenating with completion values)
|
|
2108
2092
|
*
|
|
2109
|
-
* ```ts
|
|
2110
|
-
* import { Channel, Data } from "effect"
|
|
2093
|
+
* ```ts import.meta.vitest
|
|
2094
|
+
* import { Channel, Data, Effect } from "effect"
|
|
2111
2095
|
*
|
|
2112
2096
|
* class ConcatError extends Data.TaggedError("ConcatError")<{
|
|
2113
2097
|
* readonly reason: string
|
|
@@ -2118,8 +2102,7 @@ export declare const concatWith: {
|
|
|
2118
2102
|
* Channel.concatWith((sum: void) => Channel.succeed(`Completed processing`))
|
|
2119
2103
|
* )
|
|
2120
2104
|
*
|
|
2121
|
-
* //
|
|
2122
|
-
* // Outputs: 1, 2, 3, then "Completed processing"
|
|
2105
|
+
* Effect.runSync(Channel.runCollect(numberChannel)) // => [1, 2, 3, "Completed processing"]
|
|
2123
2106
|
* ```
|
|
2124
2107
|
*
|
|
2125
2108
|
* @category sequencing
|
|
@@ -2132,8 +2115,8 @@ export declare const concatWith: {
|
|
|
2132
2115
|
*
|
|
2133
2116
|
* **Example** (Concatenating with completion values)
|
|
2134
2117
|
*
|
|
2135
|
-
* ```ts
|
|
2136
|
-
* import { Channel, Data } from "effect"
|
|
2118
|
+
* ```ts import.meta.vitest
|
|
2119
|
+
* import { Channel, Data, Effect } from "effect"
|
|
2137
2120
|
*
|
|
2138
2121
|
* class ConcatError extends Data.TaggedError("ConcatError")<{
|
|
2139
2122
|
* readonly reason: string
|
|
@@ -2144,8 +2127,7 @@ export declare const concatWith: {
|
|
|
2144
2127
|
* Channel.concatWith((sum: void) => Channel.succeed(`Completed processing`))
|
|
2145
2128
|
* )
|
|
2146
2129
|
*
|
|
2147
|
-
* //
|
|
2148
|
-
* // Outputs: 1, 2, 3, then "Completed processing"
|
|
2130
|
+
* Effect.runSync(Channel.runCollect(numberChannel)) // => [1, 2, 3, "Completed processing"]
|
|
2149
2131
|
* ```
|
|
2150
2132
|
*
|
|
2151
2133
|
* @category sequencing
|
|
@@ -2159,8 +2141,8 @@ export declare const concatWith: {
|
|
|
2159
2141
|
*
|
|
2160
2142
|
* **Example** (Concatenating channels)
|
|
2161
2143
|
*
|
|
2162
|
-
* ```ts
|
|
2163
|
-
* import { Channel, Data } from "effect"
|
|
2144
|
+
* ```ts import.meta.vitest
|
|
2145
|
+
* import { Channel, Data, Effect } from "effect"
|
|
2164
2146
|
*
|
|
2165
2147
|
* class ConcatError extends Data.TaggedError("ConcatError")<{
|
|
2166
2148
|
* readonly reason: string
|
|
@@ -2173,7 +2155,7 @@ export declare const concatWith: {
|
|
|
2173
2155
|
* // Concatenate them
|
|
2174
2156
|
* const concatenatedChannel = Channel.concat(firstChannel, secondChannel)
|
|
2175
2157
|
*
|
|
2176
|
-
* //
|
|
2158
|
+
* Effect.runSync(Channel.runCollect(concatenatedChannel)) // => [1, 2, 3, "a", "b", "c"]
|
|
2177
2159
|
* ```
|
|
2178
2160
|
*
|
|
2179
2161
|
* @category sequencing
|
|
@@ -2186,8 +2168,8 @@ export declare const concat: {
|
|
|
2186
2168
|
*
|
|
2187
2169
|
* **Example** (Concatenating channels)
|
|
2188
2170
|
*
|
|
2189
|
-
* ```ts
|
|
2190
|
-
* import { Channel, Data } from "effect"
|
|
2171
|
+
* ```ts import.meta.vitest
|
|
2172
|
+
* import { Channel, Data, Effect } from "effect"
|
|
2191
2173
|
*
|
|
2192
2174
|
* class ConcatError extends Data.TaggedError("ConcatError")<{
|
|
2193
2175
|
* readonly reason: string
|
|
@@ -2200,7 +2182,7 @@ export declare const concat: {
|
|
|
2200
2182
|
* // Concatenate them
|
|
2201
2183
|
* const concatenatedChannel = Channel.concat(firstChannel, secondChannel)
|
|
2202
2184
|
*
|
|
2203
|
-
* //
|
|
2185
|
+
* Effect.runSync(Channel.runCollect(concatenatedChannel)) // => [1, 2, 3, "a", "b", "c"]
|
|
2204
2186
|
* ```
|
|
2205
2187
|
*
|
|
2206
2188
|
* @category sequencing
|
|
@@ -2213,8 +2195,8 @@ export declare const concat: {
|
|
|
2213
2195
|
*
|
|
2214
2196
|
* **Example** (Concatenating channels)
|
|
2215
2197
|
*
|
|
2216
|
-
* ```ts
|
|
2217
|
-
* import { Channel, Data } from "effect"
|
|
2198
|
+
* ```ts import.meta.vitest
|
|
2199
|
+
* import { Channel, Data, Effect } from "effect"
|
|
2218
2200
|
*
|
|
2219
2201
|
* class ConcatError extends Data.TaggedError("ConcatError")<{
|
|
2220
2202
|
* readonly reason: string
|
|
@@ -2227,7 +2209,7 @@ export declare const concat: {
|
|
|
2227
2209
|
* // Concatenate them
|
|
2228
2210
|
* const concatenatedChannel = Channel.concat(firstChannel, secondChannel)
|
|
2229
2211
|
*
|
|
2230
|
-
* //
|
|
2212
|
+
* Effect.runSync(Channel.runCollect(concatenatedChannel)) // => [1, 2, 3, "a", "b", "c"]
|
|
2231
2213
|
* ```
|
|
2232
2214
|
*
|
|
2233
2215
|
* @category sequencing
|
|
@@ -2338,8 +2320,8 @@ export declare const orElseIfEmpty: {
|
|
|
2338
2320
|
*
|
|
2339
2321
|
* **Example** (Flattening nested channels)
|
|
2340
2322
|
*
|
|
2341
|
-
* ```ts
|
|
2342
|
-
* import { Channel, Data } from "effect"
|
|
2323
|
+
* ```ts import.meta.vitest
|
|
2324
|
+
* import { Channel, Data, Effect } from "effect"
|
|
2343
2325
|
*
|
|
2344
2326
|
* class FlattenError extends Data.TaggedError("FlattenError")<{
|
|
2345
2327
|
* readonly cause: string
|
|
@@ -2355,7 +2337,7 @@ export declare const orElseIfEmpty: {
|
|
|
2355
2337
|
* // Flatten the nested channels
|
|
2356
2338
|
* const flattenedChannel = Channel.flatten(nestedChannels)
|
|
2357
2339
|
*
|
|
2358
|
-
* //
|
|
2340
|
+
* Effect.runSync(Channel.runCollect(flattenedChannel)) // => [1, 2, 3, 4, 5, 6]
|
|
2359
2341
|
* ```
|
|
2360
2342
|
*
|
|
2361
2343
|
* @category constructors
|
|
@@ -2367,8 +2349,8 @@ export declare const flatten: <OutElem, OutErr, OutDone, InElem, InErr, InDone,
|
|
|
2367
2349
|
*
|
|
2368
2350
|
* **Example** (Flattening arrays of channel output)
|
|
2369
2351
|
*
|
|
2370
|
-
* ```ts
|
|
2371
|
-
* import { Channel, Data } from "effect"
|
|
2352
|
+
* ```ts import.meta.vitest
|
|
2353
|
+
* import { Channel, Data, Effect } from "effect"
|
|
2372
2354
|
*
|
|
2373
2355
|
* class FlattenError extends Data.TaggedError("FlattenError")<{
|
|
2374
2356
|
* readonly message: string
|
|
@@ -2384,7 +2366,7 @@ export declare const flatten: <OutElem, OutErr, OutDone, InElem, InErr, InDone,
|
|
|
2384
2366
|
* // Flatten the arrays into individual elements
|
|
2385
2367
|
* const flattenedChannel = Channel.flattenArray(arrayChannel)
|
|
2386
2368
|
*
|
|
2387
|
-
* //
|
|
2369
|
+
* Effect.runSync(Channel.runCollect(flattenedChannel)) // => [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
2388
2370
|
* ```
|
|
2389
2371
|
*
|
|
2390
2372
|
* @category transforming
|
|
@@ -2410,8 +2392,8 @@ export declare const flattenTake: <OutElem, OutErr, OutDone, OutErr2, OutDone2,
|
|
|
2410
2392
|
*
|
|
2411
2393
|
* **Example** (Draining channel output)
|
|
2412
2394
|
*
|
|
2413
|
-
* ```ts
|
|
2414
|
-
* import { Channel } from "effect"
|
|
2395
|
+
* ```ts import.meta.vitest
|
|
2396
|
+
* import { Channel, Effect } from "effect"
|
|
2415
2397
|
*
|
|
2416
2398
|
* // Create a channel that outputs values
|
|
2417
2399
|
* const sourceChannel = Channel.fromIterable([1, 2, 3, 4, 5])
|
|
@@ -2419,8 +2401,7 @@ export declare const flattenTake: <OutElem, OutErr, OutDone, OutErr2, OutDone2,
|
|
|
2419
2401
|
* // Drain all output, keeping only the completion
|
|
2420
2402
|
* const drainedChannel = Channel.drain(sourceChannel)
|
|
2421
2403
|
*
|
|
2422
|
-
* //
|
|
2423
|
-
* // Useful for consuming side effects without collecting output
|
|
2404
|
+
* Effect.runSync(Channel.runCollect(drainedChannel)) // => []
|
|
2424
2405
|
* ```
|
|
2425
2406
|
*
|
|
2426
2407
|
* @category constructors
|
|
@@ -2508,15 +2489,15 @@ export declare const schedule: {
|
|
|
2508
2489
|
*
|
|
2509
2490
|
* **Example** (Filtering channel output)
|
|
2510
2491
|
*
|
|
2511
|
-
* ```ts
|
|
2512
|
-
* import { Channel } from "effect"
|
|
2492
|
+
* ```ts import.meta.vitest
|
|
2493
|
+
* import { Channel, Effect } from "effect"
|
|
2513
2494
|
*
|
|
2514
2495
|
* // Create a channel with mixed numbers
|
|
2515
2496
|
* const numbersChannel = Channel.fromIterable([1, 2, 3, 4, 5, 6, 7, 8])
|
|
2516
2497
|
*
|
|
2517
2498
|
* // Filter to keep only even numbers
|
|
2518
2499
|
* const evenChannel = Channel.filter(numbersChannel, (n) => n % 2 === 0)
|
|
2519
|
-
* //
|
|
2500
|
+
* Effect.runSync(Channel.runCollect(evenChannel)) // => [2, 4, 6, 8]
|
|
2520
2501
|
*
|
|
2521
2502
|
* // Filter with type refinement
|
|
2522
2503
|
* const mixedChannel = Channel.fromIterable([1, "hello", 2, "world", 3])
|
|
@@ -2524,7 +2505,7 @@ export declare const schedule: {
|
|
|
2524
2505
|
* mixedChannel,
|
|
2525
2506
|
* (value): value is number => typeof value === "number"
|
|
2526
2507
|
* )
|
|
2527
|
-
* //
|
|
2508
|
+
* Effect.runSync(Channel.runCollect(numbersOnlyChannel)) // => [1, 2, 3]
|
|
2528
2509
|
* ```
|
|
2529
2510
|
*
|
|
2530
2511
|
* @category filtering
|
|
@@ -2537,15 +2518,15 @@ export declare const filter: {
|
|
|
2537
2518
|
*
|
|
2538
2519
|
* **Example** (Filtering channel output)
|
|
2539
2520
|
*
|
|
2540
|
-
* ```ts
|
|
2541
|
-
* import { Channel } from "effect"
|
|
2521
|
+
* ```ts import.meta.vitest
|
|
2522
|
+
* import { Channel, Effect } from "effect"
|
|
2542
2523
|
*
|
|
2543
2524
|
* // Create a channel with mixed numbers
|
|
2544
2525
|
* const numbersChannel = Channel.fromIterable([1, 2, 3, 4, 5, 6, 7, 8])
|
|
2545
2526
|
*
|
|
2546
2527
|
* // Filter to keep only even numbers
|
|
2547
2528
|
* const evenChannel = Channel.filter(numbersChannel, (n) => n % 2 === 0)
|
|
2548
|
-
* //
|
|
2529
|
+
* Effect.runSync(Channel.runCollect(evenChannel)) // => [2, 4, 6, 8]
|
|
2549
2530
|
*
|
|
2550
2531
|
* // Filter with type refinement
|
|
2551
2532
|
* const mixedChannel = Channel.fromIterable([1, "hello", 2, "world", 3])
|
|
@@ -2553,7 +2534,7 @@ export declare const filter: {
|
|
|
2553
2534
|
* mixedChannel,
|
|
2554
2535
|
* (value): value is number => typeof value === "number"
|
|
2555
2536
|
* )
|
|
2556
|
-
* //
|
|
2537
|
+
* Effect.runSync(Channel.runCollect(numbersOnlyChannel)) // => [1, 2, 3]
|
|
2557
2538
|
* ```
|
|
2558
2539
|
*
|
|
2559
2540
|
* @category filtering
|
|
@@ -2566,15 +2547,15 @@ export declare const filter: {
|
|
|
2566
2547
|
*
|
|
2567
2548
|
* **Example** (Filtering channel output)
|
|
2568
2549
|
*
|
|
2569
|
-
* ```ts
|
|
2570
|
-
* import { Channel } from "effect"
|
|
2550
|
+
* ```ts import.meta.vitest
|
|
2551
|
+
* import { Channel, Effect } from "effect"
|
|
2571
2552
|
*
|
|
2572
2553
|
* // Create a channel with mixed numbers
|
|
2573
2554
|
* const numbersChannel = Channel.fromIterable([1, 2, 3, 4, 5, 6, 7, 8])
|
|
2574
2555
|
*
|
|
2575
2556
|
* // Filter to keep only even numbers
|
|
2576
2557
|
* const evenChannel = Channel.filter(numbersChannel, (n) => n % 2 === 0)
|
|
2577
|
-
* //
|
|
2558
|
+
* Effect.runSync(Channel.runCollect(evenChannel)) // => [2, 4, 6, 8]
|
|
2578
2559
|
*
|
|
2579
2560
|
* // Filter with type refinement
|
|
2580
2561
|
* const mixedChannel = Channel.fromIterable([1, "hello", 2, "world", 3])
|
|
@@ -2582,7 +2563,7 @@ export declare const filter: {
|
|
|
2582
2563
|
* mixedChannel,
|
|
2583
2564
|
* (value): value is number => typeof value === "number"
|
|
2584
2565
|
* )
|
|
2585
|
-
* //
|
|
2566
|
+
* Effect.runSync(Channel.runCollect(numbersOnlyChannel)) // => [1, 2, 3]
|
|
2586
2567
|
* ```
|
|
2587
2568
|
*
|
|
2588
2569
|
* @category filtering
|
|
@@ -2595,15 +2576,15 @@ export declare const filter: {
|
|
|
2595
2576
|
*
|
|
2596
2577
|
* **Example** (Filtering channel output)
|
|
2597
2578
|
*
|
|
2598
|
-
* ```ts
|
|
2599
|
-
* import { Channel } from "effect"
|
|
2579
|
+
* ```ts import.meta.vitest
|
|
2580
|
+
* import { Channel, Effect } from "effect"
|
|
2600
2581
|
*
|
|
2601
2582
|
* // Create a channel with mixed numbers
|
|
2602
2583
|
* const numbersChannel = Channel.fromIterable([1, 2, 3, 4, 5, 6, 7, 8])
|
|
2603
2584
|
*
|
|
2604
2585
|
* // Filter to keep only even numbers
|
|
2605
2586
|
* const evenChannel = Channel.filter(numbersChannel, (n) => n % 2 === 0)
|
|
2606
|
-
* //
|
|
2587
|
+
* Effect.runSync(Channel.runCollect(evenChannel)) // => [2, 4, 6, 8]
|
|
2607
2588
|
*
|
|
2608
2589
|
* // Filter with type refinement
|
|
2609
2590
|
* const mixedChannel = Channel.fromIterable([1, "hello", 2, "world", 3])
|
|
@@ -2611,7 +2592,7 @@ export declare const filter: {
|
|
|
2611
2592
|
* mixedChannel,
|
|
2612
2593
|
* (value): value is number => typeof value === "number"
|
|
2613
2594
|
* )
|
|
2614
|
-
* //
|
|
2595
|
+
* Effect.runSync(Channel.runCollect(numbersOnlyChannel)) // => [1, 2, 3]
|
|
2615
2596
|
* ```
|
|
2616
2597
|
*
|
|
2617
2598
|
* @category filtering
|
|
@@ -2624,15 +2605,15 @@ export declare const filter: {
|
|
|
2624
2605
|
*
|
|
2625
2606
|
* **Example** (Filtering channel output)
|
|
2626
2607
|
*
|
|
2627
|
-
* ```ts
|
|
2628
|
-
* import { Channel } from "effect"
|
|
2608
|
+
* ```ts import.meta.vitest
|
|
2609
|
+
* import { Channel, Effect } from "effect"
|
|
2629
2610
|
*
|
|
2630
2611
|
* // Create a channel with mixed numbers
|
|
2631
2612
|
* const numbersChannel = Channel.fromIterable([1, 2, 3, 4, 5, 6, 7, 8])
|
|
2632
2613
|
*
|
|
2633
2614
|
* // Filter to keep only even numbers
|
|
2634
2615
|
* const evenChannel = Channel.filter(numbersChannel, (n) => n % 2 === 0)
|
|
2635
|
-
* //
|
|
2616
|
+
* Effect.runSync(Channel.runCollect(evenChannel)) // => [2, 4, 6, 8]
|
|
2636
2617
|
*
|
|
2637
2618
|
* // Filter with type refinement
|
|
2638
2619
|
* const mixedChannel = Channel.fromIterable([1, "hello", 2, "world", 3])
|
|
@@ -2640,7 +2621,7 @@ export declare const filter: {
|
|
|
2640
2621
|
* mixedChannel,
|
|
2641
2622
|
* (value): value is number => typeof value === "number"
|
|
2642
2623
|
* )
|
|
2643
|
-
* //
|
|
2624
|
+
* Effect.runSync(Channel.runCollect(numbersOnlyChannel)) // => [1, 2, 3]
|
|
2644
2625
|
* ```
|
|
2645
2626
|
*
|
|
2646
2627
|
* @category filtering
|
|
@@ -2846,8 +2827,8 @@ export declare const filterMapEffect: {
|
|
|
2846
2827
|
*
|
|
2847
2828
|
* **Example** (Filtering array output)
|
|
2848
2829
|
*
|
|
2849
|
-
* ```ts
|
|
2850
|
-
* import { Array, Channel } from "effect"
|
|
2830
|
+
* ```ts import.meta.vitest
|
|
2831
|
+
* import { Array, Channel, Effect } from "effect"
|
|
2851
2832
|
*
|
|
2852
2833
|
* const nonEmptyArrayPredicate = Array.isReadonlyArrayNonEmpty
|
|
2853
2834
|
*
|
|
@@ -2860,7 +2841,7 @@ export declare const filterMapEffect: {
|
|
|
2860
2841
|
*
|
|
2861
2842
|
* // Filter arrays to keep only even numbers
|
|
2862
2843
|
* const evenArraysChannel = Channel.filterArray(arrayChannel, (n) => n % 2 === 0)
|
|
2863
|
-
* //
|
|
2844
|
+
* Effect.runSync(Channel.runCollect(evenArraysChannel)) // => [[2, 4], [6, 8, 10], [12, 14]]
|
|
2864
2845
|
* // Note: Only non-empty filtered arrays are emitted
|
|
2865
2846
|
*
|
|
2866
2847
|
* // Arrays that would become empty after filtering are discarded entirely
|
|
@@ -2870,7 +2851,7 @@ export declare const filterMapEffect: {
|
|
|
2870
2851
|
* Array.make(7, 9)
|
|
2871
2852
|
* ]).pipe(Channel.filter(nonEmptyArrayPredicate))
|
|
2872
2853
|
* const filteredOddChannel = Channel.filterArray(oddChannel, (n) => n % 2 === 0)
|
|
2873
|
-
* //
|
|
2854
|
+
* Effect.runSync(Channel.runCollect(filteredOddChannel)) // => [[2, 4]]
|
|
2874
2855
|
* ```
|
|
2875
2856
|
*
|
|
2876
2857
|
* @category filtering
|
|
@@ -2883,8 +2864,8 @@ export declare const filterArray: {
|
|
|
2883
2864
|
*
|
|
2884
2865
|
* **Example** (Filtering array output)
|
|
2885
2866
|
*
|
|
2886
|
-
* ```ts
|
|
2887
|
-
* import { Array, Channel } from "effect"
|
|
2867
|
+
* ```ts import.meta.vitest
|
|
2868
|
+
* import { Array, Channel, Effect } from "effect"
|
|
2888
2869
|
*
|
|
2889
2870
|
* const nonEmptyArrayPredicate = Array.isReadonlyArrayNonEmpty
|
|
2890
2871
|
*
|
|
@@ -2897,7 +2878,7 @@ export declare const filterArray: {
|
|
|
2897
2878
|
*
|
|
2898
2879
|
* // Filter arrays to keep only even numbers
|
|
2899
2880
|
* const evenArraysChannel = Channel.filterArray(arrayChannel, (n) => n % 2 === 0)
|
|
2900
|
-
* //
|
|
2881
|
+
* Effect.runSync(Channel.runCollect(evenArraysChannel)) // => [[2, 4], [6, 8, 10], [12, 14]]
|
|
2901
2882
|
* // Note: Only non-empty filtered arrays are emitted
|
|
2902
2883
|
*
|
|
2903
2884
|
* // Arrays that would become empty after filtering are discarded entirely
|
|
@@ -2907,7 +2888,7 @@ export declare const filterArray: {
|
|
|
2907
2888
|
* Array.make(7, 9)
|
|
2908
2889
|
* ]).pipe(Channel.filter(nonEmptyArrayPredicate))
|
|
2909
2890
|
* const filteredOddChannel = Channel.filterArray(oddChannel, (n) => n % 2 === 0)
|
|
2910
|
-
* //
|
|
2891
|
+
* Effect.runSync(Channel.runCollect(filteredOddChannel)) // => [[2, 4]]
|
|
2911
2892
|
* ```
|
|
2912
2893
|
*
|
|
2913
2894
|
* @category filtering
|
|
@@ -2920,8 +2901,8 @@ export declare const filterArray: {
|
|
|
2920
2901
|
*
|
|
2921
2902
|
* **Example** (Filtering array output)
|
|
2922
2903
|
*
|
|
2923
|
-
* ```ts
|
|
2924
|
-
* import { Array, Channel } from "effect"
|
|
2904
|
+
* ```ts import.meta.vitest
|
|
2905
|
+
* import { Array, Channel, Effect } from "effect"
|
|
2925
2906
|
*
|
|
2926
2907
|
* const nonEmptyArrayPredicate = Array.isReadonlyArrayNonEmpty
|
|
2927
2908
|
*
|
|
@@ -2934,7 +2915,7 @@ export declare const filterArray: {
|
|
|
2934
2915
|
*
|
|
2935
2916
|
* // Filter arrays to keep only even numbers
|
|
2936
2917
|
* const evenArraysChannel = Channel.filterArray(arrayChannel, (n) => n % 2 === 0)
|
|
2937
|
-
* //
|
|
2918
|
+
* Effect.runSync(Channel.runCollect(evenArraysChannel)) // => [[2, 4], [6, 8, 10], [12, 14]]
|
|
2938
2919
|
* // Note: Only non-empty filtered arrays are emitted
|
|
2939
2920
|
*
|
|
2940
2921
|
* // Arrays that would become empty after filtering are discarded entirely
|
|
@@ -2944,7 +2925,7 @@ export declare const filterArray: {
|
|
|
2944
2925
|
* Array.make(7, 9)
|
|
2945
2926
|
* ]).pipe(Channel.filter(nonEmptyArrayPredicate))
|
|
2946
2927
|
* const filteredOddChannel = Channel.filterArray(oddChannel, (n) => n % 2 === 0)
|
|
2947
|
-
* //
|
|
2928
|
+
* Effect.runSync(Channel.runCollect(filteredOddChannel)) // => [[2, 4]]
|
|
2948
2929
|
* ```
|
|
2949
2930
|
*
|
|
2950
2931
|
* @category filtering
|
|
@@ -2957,8 +2938,8 @@ export declare const filterArray: {
|
|
|
2957
2938
|
*
|
|
2958
2939
|
* **Example** (Filtering array output)
|
|
2959
2940
|
*
|
|
2960
|
-
* ```ts
|
|
2961
|
-
* import { Array, Channel } from "effect"
|
|
2941
|
+
* ```ts import.meta.vitest
|
|
2942
|
+
* import { Array, Channel, Effect } from "effect"
|
|
2962
2943
|
*
|
|
2963
2944
|
* const nonEmptyArrayPredicate = Array.isReadonlyArrayNonEmpty
|
|
2964
2945
|
*
|
|
@@ -2971,7 +2952,7 @@ export declare const filterArray: {
|
|
|
2971
2952
|
*
|
|
2972
2953
|
* // Filter arrays to keep only even numbers
|
|
2973
2954
|
* const evenArraysChannel = Channel.filterArray(arrayChannel, (n) => n % 2 === 0)
|
|
2974
|
-
* //
|
|
2955
|
+
* Effect.runSync(Channel.runCollect(evenArraysChannel)) // => [[2, 4], [6, 8, 10], [12, 14]]
|
|
2975
2956
|
* // Note: Only non-empty filtered arrays are emitted
|
|
2976
2957
|
*
|
|
2977
2958
|
* // Arrays that would become empty after filtering are discarded entirely
|
|
@@ -2981,7 +2962,7 @@ export declare const filterArray: {
|
|
|
2981
2962
|
* Array.make(7, 9)
|
|
2982
2963
|
* ]).pipe(Channel.filter(nonEmptyArrayPredicate))
|
|
2983
2964
|
* const filteredOddChannel = Channel.filterArray(oddChannel, (n) => n % 2 === 0)
|
|
2984
|
-
* //
|
|
2965
|
+
* Effect.runSync(Channel.runCollect(filteredOddChannel)) // => [[2, 4]]
|
|
2985
2966
|
* ```
|
|
2986
2967
|
*
|
|
2987
2968
|
* @category filtering
|
|
@@ -2994,8 +2975,8 @@ export declare const filterArray: {
|
|
|
2994
2975
|
*
|
|
2995
2976
|
* **Example** (Filtering array output)
|
|
2996
2977
|
*
|
|
2997
|
-
* ```ts
|
|
2998
|
-
* import { Array, Channel } from "effect"
|
|
2978
|
+
* ```ts import.meta.vitest
|
|
2979
|
+
* import { Array, Channel, Effect } from "effect"
|
|
2999
2980
|
*
|
|
3000
2981
|
* const nonEmptyArrayPredicate = Array.isReadonlyArrayNonEmpty
|
|
3001
2982
|
*
|
|
@@ -3008,7 +2989,7 @@ export declare const filterArray: {
|
|
|
3008
2989
|
*
|
|
3009
2990
|
* // Filter arrays to keep only even numbers
|
|
3010
2991
|
* const evenArraysChannel = Channel.filterArray(arrayChannel, (n) => n % 2 === 0)
|
|
3011
|
-
* //
|
|
2992
|
+
* Effect.runSync(Channel.runCollect(evenArraysChannel)) // => [[2, 4], [6, 8, 10], [12, 14]]
|
|
3012
2993
|
* // Note: Only non-empty filtered arrays are emitted
|
|
3013
2994
|
*
|
|
3014
2995
|
* // Arrays that would become empty after filtering are discarded entirely
|
|
@@ -3018,7 +2999,7 @@ export declare const filterArray: {
|
|
|
3018
2999
|
* Array.make(7, 9)
|
|
3019
3000
|
* ]).pipe(Channel.filter(nonEmptyArrayPredicate))
|
|
3020
3001
|
* const filteredOddChannel = Channel.filterArray(oddChannel, (n) => n % 2 === 0)
|
|
3021
|
-
* //
|
|
3002
|
+
* Effect.runSync(Channel.runCollect(filteredOddChannel)) // => [[2, 4]]
|
|
3022
3003
|
* ```
|
|
3023
3004
|
*
|
|
3024
3005
|
* @category filtering
|
|
@@ -3187,7 +3168,7 @@ export declare const filterMapArrayEffect: {
|
|
|
3187
3168
|
*
|
|
3188
3169
|
* **Example** (Mapping with accumulated state)
|
|
3189
3170
|
*
|
|
3190
|
-
* ```ts
|
|
3171
|
+
* ```ts import.meta.vitest
|
|
3191
3172
|
* import { Channel, Effect } from "effect"
|
|
3192
3173
|
*
|
|
3193
3174
|
* // Create a channel with numbers
|
|
@@ -3203,8 +3184,6 @@ export declare const filterMapArrayEffect: {
|
|
|
3203
3184
|
* return [newSum, [current, newSum]] as const
|
|
3204
3185
|
* }
|
|
3205
3186
|
* )
|
|
3206
|
-
* // Outputs: 1, 1, 2, 3, 3, 6, 4, 10
|
|
3207
|
-
*
|
|
3208
3187
|
* // Using with Effect for async processing
|
|
3209
3188
|
* const asyncMapAccum = Channel.mapAccum(
|
|
3210
3189
|
* numbersChannel,
|
|
@@ -3215,6 +3194,8 @@ export declare const filterMapArrayEffect: {
|
|
|
3215
3194
|
* return [newAcc, [`${value}-processed`, newAcc]] as const
|
|
3216
3195
|
* })
|
|
3217
3196
|
* )
|
|
3197
|
+
* Effect.runSync(Channel.runCollect(runningSum)) // => [1, 1, 2, 3, 3, 6, 4, 10]
|
|
3198
|
+
* Effect.runSync(Channel.runCollect(asyncMapAccum)) // => ["1-processed", "1", "2-processed", "12", "3-processed", "123", "4-processed", "1234"]
|
|
3218
3199
|
* ```
|
|
3219
3200
|
*
|
|
3220
3201
|
* @category sequencing
|
|
@@ -3226,7 +3207,7 @@ export declare const mapAccum: {
|
|
|
3226
3207
|
*
|
|
3227
3208
|
* **Example** (Mapping with accumulated state)
|
|
3228
3209
|
*
|
|
3229
|
-
* ```ts
|
|
3210
|
+
* ```ts import.meta.vitest
|
|
3230
3211
|
* import { Channel, Effect } from "effect"
|
|
3231
3212
|
*
|
|
3232
3213
|
* // Create a channel with numbers
|
|
@@ -3242,8 +3223,6 @@ export declare const mapAccum: {
|
|
|
3242
3223
|
* return [newSum, [current, newSum]] as const
|
|
3243
3224
|
* }
|
|
3244
3225
|
* )
|
|
3245
|
-
* // Outputs: 1, 1, 2, 3, 3, 6, 4, 10
|
|
3246
|
-
*
|
|
3247
3226
|
* // Using with Effect for async processing
|
|
3248
3227
|
* const asyncMapAccum = Channel.mapAccum(
|
|
3249
3228
|
* numbersChannel,
|
|
@@ -3254,6 +3233,8 @@ export declare const mapAccum: {
|
|
|
3254
3233
|
* return [newAcc, [`${value}-processed`, newAcc]] as const
|
|
3255
3234
|
* })
|
|
3256
3235
|
* )
|
|
3236
|
+
* Effect.runSync(Channel.runCollect(runningSum)) // => [1, 1, 2, 3, 3, 6, 4, 10]
|
|
3237
|
+
* Effect.runSync(Channel.runCollect(asyncMapAccum)) // => ["1-processed", "1", "2-processed", "12", "3-processed", "123", "4-processed", "1234"]
|
|
3257
3238
|
* ```
|
|
3258
3239
|
*
|
|
3259
3240
|
* @category sequencing
|
|
@@ -3267,7 +3248,7 @@ export declare const mapAccum: {
|
|
|
3267
3248
|
*
|
|
3268
3249
|
* **Example** (Mapping with accumulated state)
|
|
3269
3250
|
*
|
|
3270
|
-
* ```ts
|
|
3251
|
+
* ```ts import.meta.vitest
|
|
3271
3252
|
* import { Channel, Effect } from "effect"
|
|
3272
3253
|
*
|
|
3273
3254
|
* // Create a channel with numbers
|
|
@@ -3283,8 +3264,6 @@ export declare const mapAccum: {
|
|
|
3283
3264
|
* return [newSum, [current, newSum]] as const
|
|
3284
3265
|
* }
|
|
3285
3266
|
* )
|
|
3286
|
-
* // Outputs: 1, 1, 2, 3, 3, 6, 4, 10
|
|
3287
|
-
*
|
|
3288
3267
|
* // Using with Effect for async processing
|
|
3289
3268
|
* const asyncMapAccum = Channel.mapAccum(
|
|
3290
3269
|
* numbersChannel,
|
|
@@ -3295,6 +3274,8 @@ export declare const mapAccum: {
|
|
|
3295
3274
|
* return [newAcc, [`${value}-processed`, newAcc]] as const
|
|
3296
3275
|
* })
|
|
3297
3276
|
* )
|
|
3277
|
+
* Effect.runSync(Channel.runCollect(runningSum)) // => [1, 1, 2, 3, 3, 6, 4, 10]
|
|
3278
|
+
* Effect.runSync(Channel.runCollect(asyncMapAccum)) // => ["1-processed", "1", "2-processed", "12", "3-processed", "123", "4-processed", "1234"]
|
|
3298
3279
|
* ```
|
|
3299
3280
|
*
|
|
3300
3281
|
* @category sequencing
|
|
@@ -3310,15 +3291,15 @@ export declare const mapAccum: {
|
|
|
3310
3291
|
*
|
|
3311
3292
|
* **Example** (Scanning channel output)
|
|
3312
3293
|
*
|
|
3313
|
-
* ```ts
|
|
3314
|
-
* import { Channel } from "effect"
|
|
3294
|
+
* ```ts import.meta.vitest
|
|
3295
|
+
* import { Channel, Effect } from "effect"
|
|
3315
3296
|
*
|
|
3316
3297
|
* // Create a channel with numbers
|
|
3317
3298
|
* const numbersChannel = Channel.fromIterable([1, 2, 3, 4, 5])
|
|
3318
3299
|
*
|
|
3319
3300
|
* // Scan to create running sum
|
|
3320
3301
|
* const runningSumChannel = Channel.scan(numbersChannel, 0, (sum, n) => sum + n)
|
|
3321
|
-
* //
|
|
3302
|
+
* Effect.runSync(Channel.runCollect(runningSumChannel)) // => [0, 1, 3, 6, 10, 15]
|
|
3322
3303
|
* // Note: emits the initial value and each intermediate result
|
|
3323
3304
|
*
|
|
3324
3305
|
* // Scan with string concatenation
|
|
@@ -3328,7 +3309,7 @@ export declare const mapAccum: {
|
|
|
3328
3309
|
* "",
|
|
3329
3310
|
* (sentence, word) => sentence === "" ? word : `${sentence} ${word}`
|
|
3330
3311
|
* )
|
|
3331
|
-
* //
|
|
3312
|
+
* Effect.runSync(Channel.runCollect(sentenceChannel)) // => ["", "hello", "hello world", "hello world from", "hello world from effect"]
|
|
3332
3313
|
* ```
|
|
3333
3314
|
*
|
|
3334
3315
|
* @category sequencing
|
|
@@ -3341,15 +3322,15 @@ export declare const scan: {
|
|
|
3341
3322
|
*
|
|
3342
3323
|
* **Example** (Scanning channel output)
|
|
3343
3324
|
*
|
|
3344
|
-
* ```ts
|
|
3345
|
-
* import { Channel } from "effect"
|
|
3325
|
+
* ```ts import.meta.vitest
|
|
3326
|
+
* import { Channel, Effect } from "effect"
|
|
3346
3327
|
*
|
|
3347
3328
|
* // Create a channel with numbers
|
|
3348
3329
|
* const numbersChannel = Channel.fromIterable([1, 2, 3, 4, 5])
|
|
3349
3330
|
*
|
|
3350
3331
|
* // Scan to create running sum
|
|
3351
3332
|
* const runningSumChannel = Channel.scan(numbersChannel, 0, (sum, n) => sum + n)
|
|
3352
|
-
* //
|
|
3333
|
+
* Effect.runSync(Channel.runCollect(runningSumChannel)) // => [0, 1, 3, 6, 10, 15]
|
|
3353
3334
|
* // Note: emits the initial value and each intermediate result
|
|
3354
3335
|
*
|
|
3355
3336
|
* // Scan with string concatenation
|
|
@@ -3359,7 +3340,7 @@ export declare const scan: {
|
|
|
3359
3340
|
* "",
|
|
3360
3341
|
* (sentence, word) => sentence === "" ? word : `${sentence} ${word}`
|
|
3361
3342
|
* )
|
|
3362
|
-
* //
|
|
3343
|
+
* Effect.runSync(Channel.runCollect(sentenceChannel)) // => ["", "hello", "hello world", "hello world from", "hello world from effect"]
|
|
3363
3344
|
* ```
|
|
3364
3345
|
*
|
|
3365
3346
|
* @category sequencing
|
|
@@ -3372,15 +3353,15 @@ export declare const scan: {
|
|
|
3372
3353
|
*
|
|
3373
3354
|
* **Example** (Scanning channel output)
|
|
3374
3355
|
*
|
|
3375
|
-
* ```ts
|
|
3376
|
-
* import { Channel } from "effect"
|
|
3356
|
+
* ```ts import.meta.vitest
|
|
3357
|
+
* import { Channel, Effect } from "effect"
|
|
3377
3358
|
*
|
|
3378
3359
|
* // Create a channel with numbers
|
|
3379
3360
|
* const numbersChannel = Channel.fromIterable([1, 2, 3, 4, 5])
|
|
3380
3361
|
*
|
|
3381
3362
|
* // Scan to create running sum
|
|
3382
3363
|
* const runningSumChannel = Channel.scan(numbersChannel, 0, (sum, n) => sum + n)
|
|
3383
|
-
* //
|
|
3364
|
+
* Effect.runSync(Channel.runCollect(runningSumChannel)) // => [0, 1, 3, 6, 10, 15]
|
|
3384
3365
|
* // Note: emits the initial value and each intermediate result
|
|
3385
3366
|
*
|
|
3386
3367
|
* // Scan with string concatenation
|
|
@@ -3390,7 +3371,7 @@ export declare const scan: {
|
|
|
3390
3371
|
* "",
|
|
3391
3372
|
* (sentence, word) => sentence === "" ? word : `${sentence} ${word}`
|
|
3392
3373
|
* )
|
|
3393
|
-
* //
|
|
3374
|
+
* Effect.runSync(Channel.runCollect(sentenceChannel)) // => ["", "hello", "hello world", "hello world from", "hello world from effect"]
|
|
3394
3375
|
* ```
|
|
3395
3376
|
*
|
|
3396
3377
|
* @category sequencing
|
|
@@ -3409,7 +3390,7 @@ export declare const scan: {
|
|
|
3409
3390
|
*
|
|
3410
3391
|
* **Example** (Scanning channel output with effects)
|
|
3411
3392
|
*
|
|
3412
|
-
* ```ts
|
|
3393
|
+
* ```ts import.meta.vitest
|
|
3413
3394
|
* import { Channel, Data, Effect } from "effect"
|
|
3414
3395
|
*
|
|
3415
3396
|
* class ScanError extends Data.TaggedError("ScanError")<{
|
|
@@ -3425,12 +3406,10 @@ export declare const scan: {
|
|
|
3425
3406
|
* "",
|
|
3426
3407
|
* (acc, value) =>
|
|
3427
3408
|
* Effect.gen(function*() {
|
|
3428
|
-
* // Simulate async work
|
|
3429
|
-
* yield* Effect.sleep("10 millis")
|
|
3430
3409
|
* return acc + value.toString()
|
|
3431
3410
|
* })
|
|
3432
3411
|
* )
|
|
3433
|
-
* //
|
|
3412
|
+
* await Effect.runPromise(Channel.runCollect(asyncScanChannel)) // => ["", "1", "12", "123", "1234"]
|
|
3434
3413
|
*
|
|
3435
3414
|
* // Scan with error handling
|
|
3436
3415
|
* const errorHandlingScan = Channel.scanEffect(
|
|
@@ -3443,6 +3422,7 @@ export declare const scan: {
|
|
|
3443
3422
|
* return Effect.succeed(sum + n)
|
|
3444
3423
|
* }
|
|
3445
3424
|
* )
|
|
3425
|
+
* await Effect.runPromise(Channel.runCollect(errorHandlingScan)) // => [0, 1, 3, 6, 10]
|
|
3446
3426
|
* ```
|
|
3447
3427
|
*
|
|
3448
3428
|
* @category sequencing
|
|
@@ -3460,7 +3440,7 @@ export declare const scanEffect: {
|
|
|
3460
3440
|
*
|
|
3461
3441
|
* **Example** (Scanning channel output with effects)
|
|
3462
3442
|
*
|
|
3463
|
-
* ```ts
|
|
3443
|
+
* ```ts import.meta.vitest
|
|
3464
3444
|
* import { Channel, Data, Effect } from "effect"
|
|
3465
3445
|
*
|
|
3466
3446
|
* class ScanError extends Data.TaggedError("ScanError")<{
|
|
@@ -3476,12 +3456,10 @@ export declare const scanEffect: {
|
|
|
3476
3456
|
* "",
|
|
3477
3457
|
* (acc, value) =>
|
|
3478
3458
|
* Effect.gen(function*() {
|
|
3479
|
-
* // Simulate async work
|
|
3480
|
-
* yield* Effect.sleep("10 millis")
|
|
3481
3459
|
* return acc + value.toString()
|
|
3482
3460
|
* })
|
|
3483
3461
|
* )
|
|
3484
|
-
* //
|
|
3462
|
+
* await Effect.runPromise(Channel.runCollect(asyncScanChannel)) // => ["", "1", "12", "123", "1234"]
|
|
3485
3463
|
*
|
|
3486
3464
|
* // Scan with error handling
|
|
3487
3465
|
* const errorHandlingScan = Channel.scanEffect(
|
|
@@ -3494,6 +3472,7 @@ export declare const scanEffect: {
|
|
|
3494
3472
|
* return Effect.succeed(sum + n)
|
|
3495
3473
|
* }
|
|
3496
3474
|
* )
|
|
3475
|
+
* await Effect.runPromise(Channel.runCollect(errorHandlingScan)) // => [0, 1, 3, 6, 10]
|
|
3497
3476
|
* ```
|
|
3498
3477
|
*
|
|
3499
3478
|
* @category sequencing
|
|
@@ -3511,7 +3490,7 @@ export declare const scanEffect: {
|
|
|
3511
3490
|
*
|
|
3512
3491
|
* **Example** (Scanning channel output with effects)
|
|
3513
3492
|
*
|
|
3514
|
-
* ```ts
|
|
3493
|
+
* ```ts import.meta.vitest
|
|
3515
3494
|
* import { Channel, Data, Effect } from "effect"
|
|
3516
3495
|
*
|
|
3517
3496
|
* class ScanError extends Data.TaggedError("ScanError")<{
|
|
@@ -3527,12 +3506,10 @@ export declare const scanEffect: {
|
|
|
3527
3506
|
* "",
|
|
3528
3507
|
* (acc, value) =>
|
|
3529
3508
|
* Effect.gen(function*() {
|
|
3530
|
-
* // Simulate async work
|
|
3531
|
-
* yield* Effect.sleep("10 millis")
|
|
3532
3509
|
* return acc + value.toString()
|
|
3533
3510
|
* })
|
|
3534
3511
|
* )
|
|
3535
|
-
* //
|
|
3512
|
+
* await Effect.runPromise(Channel.runCollect(asyncScanChannel)) // => ["", "1", "12", "123", "1234"]
|
|
3536
3513
|
*
|
|
3537
3514
|
* // Scan with error handling
|
|
3538
3515
|
* const errorHandlingScan = Channel.scanEffect(
|
|
@@ -3545,6 +3522,7 @@ export declare const scanEffect: {
|
|
|
3545
3522
|
* return Effect.succeed(sum + n)
|
|
3546
3523
|
* }
|
|
3547
3524
|
* )
|
|
3525
|
+
* await Effect.runPromise(Channel.runCollect(errorHandlingScan)) // => [0, 1, 3, 6, 10]
|
|
3548
3526
|
* ```
|
|
3549
3527
|
*
|
|
3550
3528
|
* @category sequencing
|
|
@@ -3558,8 +3536,8 @@ export declare const scanEffect: {
|
|
|
3558
3536
|
*
|
|
3559
3537
|
* **Example** (Recovering from failure causes)
|
|
3560
3538
|
*
|
|
3561
|
-
* ```ts
|
|
3562
|
-
* import { Cause, Channel, Data } from "effect"
|
|
3539
|
+
* ```ts import.meta.vitest
|
|
3540
|
+
* import { Cause, Channel, Data, Effect } from "effect"
|
|
3563
3541
|
*
|
|
3564
3542
|
* class ProcessError extends Data.TaggedError("ProcessError")<{
|
|
3565
3543
|
* readonly reason: string
|
|
@@ -3582,7 +3560,7 @@ export declare const scanEffect: {
|
|
|
3582
3560
|
* return Channel.succeed("Recovered from interruption")
|
|
3583
3561
|
* })
|
|
3584
3562
|
*
|
|
3585
|
-
* //
|
|
3563
|
+
* Effect.runSync(Channel.runCollect(recoveredChannel)) // => ["Recovered from failure"]
|
|
3586
3564
|
* ```
|
|
3587
3565
|
*
|
|
3588
3566
|
* @category error handling
|
|
@@ -3595,8 +3573,8 @@ export declare const catchCause: {
|
|
|
3595
3573
|
*
|
|
3596
3574
|
* **Example** (Recovering from failure causes)
|
|
3597
3575
|
*
|
|
3598
|
-
* ```ts
|
|
3599
|
-
* import { Cause, Channel, Data } from "effect"
|
|
3576
|
+
* ```ts import.meta.vitest
|
|
3577
|
+
* import { Cause, Channel, Data, Effect } from "effect"
|
|
3600
3578
|
*
|
|
3601
3579
|
* class ProcessError extends Data.TaggedError("ProcessError")<{
|
|
3602
3580
|
* readonly reason: string
|
|
@@ -3619,7 +3597,7 @@ export declare const catchCause: {
|
|
|
3619
3597
|
* return Channel.succeed("Recovered from interruption")
|
|
3620
3598
|
* })
|
|
3621
3599
|
*
|
|
3622
|
-
* //
|
|
3600
|
+
* Effect.runSync(Channel.runCollect(recoveredChannel)) // => ["Recovered from failure"]
|
|
3623
3601
|
* ```
|
|
3624
3602
|
*
|
|
3625
3603
|
* @category error handling
|
|
@@ -3632,8 +3610,8 @@ export declare const catchCause: {
|
|
|
3632
3610
|
*
|
|
3633
3611
|
* **Example** (Recovering from failure causes)
|
|
3634
3612
|
*
|
|
3635
|
-
* ```ts
|
|
3636
|
-
* import { Cause, Channel, Data } from "effect"
|
|
3613
|
+
* ```ts import.meta.vitest
|
|
3614
|
+
* import { Cause, Channel, Data, Effect } from "effect"
|
|
3637
3615
|
*
|
|
3638
3616
|
* class ProcessError extends Data.TaggedError("ProcessError")<{
|
|
3639
3617
|
* readonly reason: string
|
|
@@ -3656,7 +3634,7 @@ export declare const catchCause: {
|
|
|
3656
3634
|
* return Channel.succeed("Recovered from interruption")
|
|
3657
3635
|
* })
|
|
3658
3636
|
*
|
|
3659
|
-
* //
|
|
3637
|
+
* Effect.runSync(Channel.runCollect(recoveredChannel)) // => ["Recovered from failure"]
|
|
3660
3638
|
* ```
|
|
3661
3639
|
*
|
|
3662
3640
|
* @category error handling
|
|
@@ -4139,8 +4117,8 @@ export declare const catchTag: {
|
|
|
4139
4117
|
*
|
|
4140
4118
|
* **Example** (Recovering from nested reasons)
|
|
4141
4119
|
*
|
|
4142
|
-
* ```ts
|
|
4143
|
-
* import { Channel, Data } from "effect"
|
|
4120
|
+
* ```ts import.meta.vitest
|
|
4121
|
+
* import { Channel, Data, Effect } from "effect"
|
|
4144
4122
|
*
|
|
4145
4123
|
* class RateLimitError extends Data.TaggedError("RateLimitError")<{
|
|
4146
4124
|
* retryAfter: number
|
|
@@ -4154,15 +4132,15 @@ export declare const catchTag: {
|
|
|
4154
4132
|
* reason: RateLimitError | QuotaExceededError
|
|
4155
4133
|
* }> {}
|
|
4156
4134
|
*
|
|
4157
|
-
* const
|
|
4158
|
-
*
|
|
4159
|
-
* )
|
|
4135
|
+
* const reason = new RateLimitError({ retryAfter: 60 })
|
|
4136
|
+
* const channel = Channel.fail(new AiError({ reason }))
|
|
4160
4137
|
*
|
|
4161
4138
|
* const recovered = channel.pipe(
|
|
4162
4139
|
* Channel.catchReason("AiError", "RateLimitError", (reason) =>
|
|
4163
4140
|
* Channel.succeed(`retry: ${reason.retryAfter}`)
|
|
4164
4141
|
* )
|
|
4165
4142
|
* )
|
|
4143
|
+
* Effect.runSync(Channel.runCollect(recovered)) // => ["retry: 60"]
|
|
4166
4144
|
* ```
|
|
4167
4145
|
*
|
|
4168
4146
|
* @category error handling
|
|
@@ -4174,8 +4152,8 @@ export declare const catchReason: {
|
|
|
4174
4152
|
*
|
|
4175
4153
|
* **Example** (Recovering from nested reasons)
|
|
4176
4154
|
*
|
|
4177
|
-
* ```ts
|
|
4178
|
-
* import { Channel, Data } from "effect"
|
|
4155
|
+
* ```ts import.meta.vitest
|
|
4156
|
+
* import { Channel, Data, Effect } from "effect"
|
|
4179
4157
|
*
|
|
4180
4158
|
* class RateLimitError extends Data.TaggedError("RateLimitError")<{
|
|
4181
4159
|
* retryAfter: number
|
|
@@ -4189,15 +4167,15 @@ export declare const catchReason: {
|
|
|
4189
4167
|
* reason: RateLimitError | QuotaExceededError
|
|
4190
4168
|
* }> {}
|
|
4191
4169
|
*
|
|
4192
|
-
* const
|
|
4193
|
-
*
|
|
4194
|
-
* )
|
|
4170
|
+
* const reason = new RateLimitError({ retryAfter: 60 })
|
|
4171
|
+
* const channel = Channel.fail(new AiError({ reason }))
|
|
4195
4172
|
*
|
|
4196
4173
|
* const recovered = channel.pipe(
|
|
4197
4174
|
* Channel.catchReason("AiError", "RateLimitError", (reason) =>
|
|
4198
4175
|
* Channel.succeed(`retry: ${reason.retryAfter}`)
|
|
4199
4176
|
* )
|
|
4200
4177
|
* )
|
|
4178
|
+
* Effect.runSync(Channel.runCollect(recovered)) // => ["retry: 60"]
|
|
4201
4179
|
* ```
|
|
4202
4180
|
*
|
|
4203
4181
|
* @category error handling
|
|
@@ -4209,8 +4187,8 @@ export declare const catchReason: {
|
|
|
4209
4187
|
*
|
|
4210
4188
|
* **Example** (Recovering from nested reasons)
|
|
4211
4189
|
*
|
|
4212
|
-
* ```ts
|
|
4213
|
-
* import { Channel, Data } from "effect"
|
|
4190
|
+
* ```ts import.meta.vitest
|
|
4191
|
+
* import { Channel, Data, Effect } from "effect"
|
|
4214
4192
|
*
|
|
4215
4193
|
* class RateLimitError extends Data.TaggedError("RateLimitError")<{
|
|
4216
4194
|
* retryAfter: number
|
|
@@ -4224,15 +4202,15 @@ export declare const catchReason: {
|
|
|
4224
4202
|
* reason: RateLimitError | QuotaExceededError
|
|
4225
4203
|
* }> {}
|
|
4226
4204
|
*
|
|
4227
|
-
* const
|
|
4228
|
-
*
|
|
4229
|
-
* )
|
|
4205
|
+
* const reason = new RateLimitError({ retryAfter: 60 })
|
|
4206
|
+
* const channel = Channel.fail(new AiError({ reason }))
|
|
4230
4207
|
*
|
|
4231
4208
|
* const recovered = channel.pipe(
|
|
4232
4209
|
* Channel.catchReason("AiError", "RateLimitError", (reason) =>
|
|
4233
4210
|
* Channel.succeed(`retry: ${reason.retryAfter}`)
|
|
4234
4211
|
* )
|
|
4235
4212
|
* )
|
|
4213
|
+
* Effect.runSync(Channel.runCollect(recovered)) // => ["retry: 60"]
|
|
4236
4214
|
* ```
|
|
4237
4215
|
*
|
|
4238
4216
|
* @category error handling
|
|
@@ -4299,8 +4277,8 @@ export declare const catchReasons: {
|
|
|
4299
4277
|
*
|
|
4300
4278
|
* **Example** (Promoting nested reasons)
|
|
4301
4279
|
*
|
|
4302
|
-
* ```ts
|
|
4303
|
-
* import { Channel, Data } from "effect"
|
|
4280
|
+
* ```ts import.meta.vitest
|
|
4281
|
+
* import { Channel, Data, Effect, Exit } from "effect"
|
|
4304
4282
|
*
|
|
4305
4283
|
* class RateLimitError extends Data.TaggedError("RateLimitError")<{
|
|
4306
4284
|
* retryAfter: number
|
|
@@ -4314,11 +4292,11 @@ export declare const catchReasons: {
|
|
|
4314
4292
|
* reason: RateLimitError | QuotaExceededError
|
|
4315
4293
|
* }> {}
|
|
4316
4294
|
*
|
|
4317
|
-
* const
|
|
4318
|
-
*
|
|
4319
|
-
* )
|
|
4295
|
+
* const reason = new RateLimitError({ retryAfter: 60 })
|
|
4296
|
+
* const channel = Channel.fail(new AiError({ reason }))
|
|
4320
4297
|
*
|
|
4321
4298
|
* const unwrapped = channel.pipe(Channel.unwrapReason("AiError"))
|
|
4299
|
+
* Effect.runSync(Effect.exit(Channel.runCollect(unwrapped))) // => Exit.fail(reason)
|
|
4322
4300
|
* ```
|
|
4323
4301
|
*
|
|
4324
4302
|
* @category error handling
|
|
@@ -4330,8 +4308,8 @@ export declare const unwrapReason: {
|
|
|
4330
4308
|
*
|
|
4331
4309
|
* **Example** (Promoting nested reasons)
|
|
4332
4310
|
*
|
|
4333
|
-
* ```ts
|
|
4334
|
-
* import { Channel, Data } from "effect"
|
|
4311
|
+
* ```ts import.meta.vitest
|
|
4312
|
+
* import { Channel, Data, Effect, Exit } from "effect"
|
|
4335
4313
|
*
|
|
4336
4314
|
* class RateLimitError extends Data.TaggedError("RateLimitError")<{
|
|
4337
4315
|
* retryAfter: number
|
|
@@ -4345,11 +4323,11 @@ export declare const unwrapReason: {
|
|
|
4345
4323
|
* reason: RateLimitError | QuotaExceededError
|
|
4346
4324
|
* }> {}
|
|
4347
4325
|
*
|
|
4348
|
-
* const
|
|
4349
|
-
*
|
|
4350
|
-
* )
|
|
4326
|
+
* const reason = new RateLimitError({ retryAfter: 60 })
|
|
4327
|
+
* const channel = Channel.fail(new AiError({ reason }))
|
|
4351
4328
|
*
|
|
4352
4329
|
* const unwrapped = channel.pipe(Channel.unwrapReason("AiError"))
|
|
4330
|
+
* Effect.runSync(Effect.exit(Channel.runCollect(unwrapped))) // => Exit.fail(reason)
|
|
4353
4331
|
* ```
|
|
4354
4332
|
*
|
|
4355
4333
|
* @category error handling
|
|
@@ -4361,8 +4339,8 @@ export declare const unwrapReason: {
|
|
|
4361
4339
|
*
|
|
4362
4340
|
* **Example** (Promoting nested reasons)
|
|
4363
4341
|
*
|
|
4364
|
-
* ```ts
|
|
4365
|
-
* import { Channel, Data } from "effect"
|
|
4342
|
+
* ```ts import.meta.vitest
|
|
4343
|
+
* import { Channel, Data, Effect, Exit } from "effect"
|
|
4366
4344
|
*
|
|
4367
4345
|
* class RateLimitError extends Data.TaggedError("RateLimitError")<{
|
|
4368
4346
|
* retryAfter: number
|
|
@@ -4376,11 +4354,11 @@ export declare const unwrapReason: {
|
|
|
4376
4354
|
* reason: RateLimitError | QuotaExceededError
|
|
4377
4355
|
* }> {}
|
|
4378
4356
|
*
|
|
4379
|
-
* const
|
|
4380
|
-
*
|
|
4381
|
-
* )
|
|
4357
|
+
* const reason = new RateLimitError({ retryAfter: 60 })
|
|
4358
|
+
* const channel = Channel.fail(new AiError({ reason }))
|
|
4382
4359
|
*
|
|
4383
4360
|
* const unwrapped = channel.pipe(Channel.unwrapReason("AiError"))
|
|
4361
|
+
* Effect.runSync(Effect.exit(Channel.runCollect(unwrapped))) // => Exit.fail(reason)
|
|
4384
4362
|
* ```
|
|
4385
4363
|
*
|
|
4386
4364
|
* @category error handling
|
|
@@ -4422,20 +4400,21 @@ export declare const mapError: {
|
|
|
4422
4400
|
*
|
|
4423
4401
|
* **Example** (Converting failures to defects)
|
|
4424
4402
|
*
|
|
4425
|
-
* ```ts
|
|
4426
|
-
* import { Channel, Data } from "effect"
|
|
4403
|
+
* ```ts import.meta.vitest
|
|
4404
|
+
* import { Cause, Channel, Data, Effect, Exit } from "effect"
|
|
4427
4405
|
*
|
|
4428
4406
|
* class ValidationError extends Data.TaggedError("ValidationError")<{
|
|
4429
4407
|
* readonly field: string
|
|
4430
4408
|
* }> {}
|
|
4431
4409
|
*
|
|
4432
4410
|
* // Create a channel that might fail
|
|
4433
|
-
* const
|
|
4411
|
+
* const error = new ValidationError({ field: "email" })
|
|
4412
|
+
* const failingChannel = Channel.fail(error)
|
|
4434
4413
|
*
|
|
4435
4414
|
* // Convert failures to defects
|
|
4436
4415
|
* const fatalChannel = Channel.orDie(failingChannel)
|
|
4437
4416
|
*
|
|
4438
|
-
* //
|
|
4417
|
+
* Effect.runSync(Effect.exit(Channel.runCollect(fatalChannel))) // => Exit.failCause(Cause.die(error))
|
|
4439
4418
|
* ```
|
|
4440
4419
|
*
|
|
4441
4420
|
* @category error handling
|
|
@@ -4522,8 +4501,8 @@ export declare const retry: {
|
|
|
4522
4501
|
*
|
|
4523
4502
|
* **Example** (Switching mapped channels)
|
|
4524
4503
|
*
|
|
4525
|
-
* ```ts
|
|
4526
|
-
* import { Channel, Data } from "effect"
|
|
4504
|
+
* ```ts import.meta.vitest
|
|
4505
|
+
* import { Channel, Data, Effect } from "effect"
|
|
4527
4506
|
*
|
|
4528
4507
|
* class SwitchError extends Data.TaggedError("SwitchError")<{
|
|
4529
4508
|
* readonly reason: string
|
|
@@ -4538,7 +4517,7 @@ export declare const retry: {
|
|
|
4538
4517
|
* (n) => Channel.fromIterable([`value-${n}`])
|
|
4539
4518
|
* )
|
|
4540
4519
|
*
|
|
4541
|
-
*
|
|
4520
|
+
* await Effect.runPromise(Channel.runCollect(switchedChannel)) // => ["value-3"]
|
|
4542
4521
|
* ```
|
|
4543
4522
|
*
|
|
4544
4523
|
* @category sequencing
|
|
@@ -4557,8 +4536,8 @@ export declare const switchMap: {
|
|
|
4557
4536
|
*
|
|
4558
4537
|
* **Example** (Switching mapped channels)
|
|
4559
4538
|
*
|
|
4560
|
-
* ```ts
|
|
4561
|
-
* import { Channel, Data } from "effect"
|
|
4539
|
+
* ```ts import.meta.vitest
|
|
4540
|
+
* import { Channel, Data, Effect } from "effect"
|
|
4562
4541
|
*
|
|
4563
4542
|
* class SwitchError extends Data.TaggedError("SwitchError")<{
|
|
4564
4543
|
* readonly reason: string
|
|
@@ -4573,7 +4552,7 @@ export declare const switchMap: {
|
|
|
4573
4552
|
* (n) => Channel.fromIterable([`value-${n}`])
|
|
4574
4553
|
* )
|
|
4575
4554
|
*
|
|
4576
|
-
*
|
|
4555
|
+
* await Effect.runPromise(Channel.runCollect(switchedChannel)) // => ["value-3"]
|
|
4577
4556
|
* ```
|
|
4578
4557
|
*
|
|
4579
4558
|
* @category sequencing
|
|
@@ -4595,8 +4574,8 @@ export declare const switchMap: {
|
|
|
4595
4574
|
*
|
|
4596
4575
|
* **Example** (Switching mapped channels)
|
|
4597
4576
|
*
|
|
4598
|
-
* ```ts
|
|
4599
|
-
* import { Channel, Data } from "effect"
|
|
4577
|
+
* ```ts import.meta.vitest
|
|
4578
|
+
* import { Channel, Data, Effect } from "effect"
|
|
4600
4579
|
*
|
|
4601
4580
|
* class SwitchError extends Data.TaggedError("SwitchError")<{
|
|
4602
4581
|
* readonly reason: string
|
|
@@ -4611,7 +4590,7 @@ export declare const switchMap: {
|
|
|
4611
4590
|
* (n) => Channel.fromIterable([`value-${n}`])
|
|
4612
4591
|
* )
|
|
4613
4592
|
*
|
|
4614
|
-
*
|
|
4593
|
+
* await Effect.runPromise(Channel.runCollect(switchedChannel)) // => ["value-3"]
|
|
4615
4594
|
* ```
|
|
4616
4595
|
*
|
|
4617
4596
|
* @category sequencing
|
|
@@ -4632,8 +4611,8 @@ export declare const switchMap: {
|
|
|
4632
4611
|
*
|
|
4633
4612
|
* **Example** (Merging nested channels)
|
|
4634
4613
|
*
|
|
4635
|
-
* ```ts
|
|
4636
|
-
* import { Channel, Data } from "effect"
|
|
4614
|
+
* ```ts import.meta.vitest
|
|
4615
|
+
* import { Channel, Data, Effect } from "effect"
|
|
4637
4616
|
*
|
|
4638
4617
|
* class MergeAllError extends Data.TaggedError("MergeAllError")<{
|
|
4639
4618
|
* readonly reason: string
|
|
@@ -4648,11 +4627,11 @@ export declare const switchMap: {
|
|
|
4648
4627
|
*
|
|
4649
4628
|
* // Merge all channels with bounded concurrency
|
|
4650
4629
|
* const mergedChannel = Channel.mergeAll({
|
|
4651
|
-
* concurrency:
|
|
4630
|
+
* concurrency: 1,
|
|
4652
4631
|
* bufferSize: 16
|
|
4653
4632
|
* })(nestedChannels)
|
|
4654
4633
|
*
|
|
4655
|
-
* //
|
|
4634
|
+
* await Effect.runPromise(Channel.runCollect(mergedChannel)) // => [1, 2, 3, 4, 5, 6]
|
|
4656
4635
|
* ```
|
|
4657
4636
|
*
|
|
4658
4637
|
* @category combining
|
|
@@ -4669,8 +4648,8 @@ export declare const mergeAll: {
|
|
|
4669
4648
|
*
|
|
4670
4649
|
* **Example** (Merging nested channels)
|
|
4671
4650
|
*
|
|
4672
|
-
* ```ts
|
|
4673
|
-
* import { Channel, Data } from "effect"
|
|
4651
|
+
* ```ts import.meta.vitest
|
|
4652
|
+
* import { Channel, Data, Effect } from "effect"
|
|
4674
4653
|
*
|
|
4675
4654
|
* class MergeAllError extends Data.TaggedError("MergeAllError")<{
|
|
4676
4655
|
* readonly reason: string
|
|
@@ -4685,11 +4664,11 @@ export declare const mergeAll: {
|
|
|
4685
4664
|
*
|
|
4686
4665
|
* // Merge all channels with bounded concurrency
|
|
4687
4666
|
* const mergedChannel = Channel.mergeAll({
|
|
4688
|
-
* concurrency:
|
|
4667
|
+
* concurrency: 1,
|
|
4689
4668
|
* bufferSize: 16
|
|
4690
4669
|
* })(nestedChannels)
|
|
4691
4670
|
*
|
|
4692
|
-
* //
|
|
4671
|
+
* await Effect.runPromise(Channel.runCollect(mergedChannel)) // => [1, 2, 3, 4, 5, 6]
|
|
4693
4672
|
* ```
|
|
4694
4673
|
*
|
|
4695
4674
|
* @category combining
|
|
@@ -4710,8 +4689,8 @@ export declare const mergeAll: {
|
|
|
4710
4689
|
*
|
|
4711
4690
|
* **Example** (Merging nested channels)
|
|
4712
4691
|
*
|
|
4713
|
-
* ```ts
|
|
4714
|
-
* import { Channel, Data } from "effect"
|
|
4692
|
+
* ```ts import.meta.vitest
|
|
4693
|
+
* import { Channel, Data, Effect } from "effect"
|
|
4715
4694
|
*
|
|
4716
4695
|
* class MergeAllError extends Data.TaggedError("MergeAllError")<{
|
|
4717
4696
|
* readonly reason: string
|
|
@@ -4726,11 +4705,11 @@ export declare const mergeAll: {
|
|
|
4726
4705
|
*
|
|
4727
4706
|
* // Merge all channels with bounded concurrency
|
|
4728
4707
|
* const mergedChannel = Channel.mergeAll({
|
|
4729
|
-
* concurrency:
|
|
4708
|
+
* concurrency: 1,
|
|
4730
4709
|
* bufferSize: 16
|
|
4731
4710
|
* })(nestedChannels)
|
|
4732
4711
|
*
|
|
4733
|
-
* //
|
|
4712
|
+
* await Effect.runPromise(Channel.runCollect(mergedChannel)) // => [1, 2, 3, 4, 5, 6]
|
|
4734
4713
|
* ```
|
|
4735
4714
|
*
|
|
4736
4715
|
* @category combining
|
|
@@ -4747,14 +4726,11 @@ export declare const mergeAll: {
|
|
|
4747
4726
|
*
|
|
4748
4727
|
* **Example** (Choosing merge halt strategies)
|
|
4749
4728
|
*
|
|
4750
|
-
* ```ts
|
|
4751
|
-
* import
|
|
4729
|
+
* ```ts import.meta.vitest
|
|
4730
|
+
* import { Channel } from "effect"
|
|
4752
4731
|
*
|
|
4753
4732
|
* // Different halt strategies for channel merging
|
|
4754
|
-
* const
|
|
4755
|
-
* const rightFirst: Channel.HaltStrategy = "right" // Stop when right channel halts
|
|
4756
|
-
* const both: Channel.HaltStrategy = "both" // Stop when both channels halt
|
|
4757
|
-
* const either: Channel.HaltStrategy = "either" // Stop when either channel halts
|
|
4733
|
+
* const strategies: Array<Channel.HaltStrategy> = ["left", "right", "both", "either"] // => ["left", "right", "both", "either"]
|
|
4758
4734
|
* ```
|
|
4759
4735
|
*
|
|
4760
4736
|
* @category models
|
|
@@ -4767,24 +4743,18 @@ export type HaltStrategy = "left" | "right" | "both" | "either";
|
|
|
4767
4743
|
*
|
|
4768
4744
|
* **Example** (Merging channels)
|
|
4769
4745
|
*
|
|
4770
|
-
* ```ts
|
|
4771
|
-
* import { Channel,
|
|
4772
|
-
*
|
|
4773
|
-
* class MergeError extends Data.TaggedError("MergeError")<{
|
|
4774
|
-
* readonly source: string
|
|
4775
|
-
* }> {}
|
|
4746
|
+
* ```ts import.meta.vitest
|
|
4747
|
+
* import { Channel, Effect } from "effect"
|
|
4776
4748
|
*
|
|
4777
4749
|
* // Create two channels
|
|
4778
4750
|
* const leftChannel = Channel.fromIterable([1, 2, 3])
|
|
4779
4751
|
* const rightChannel = Channel.fromIterable(["a", "b", "c"])
|
|
4780
4752
|
*
|
|
4781
|
-
* //
|
|
4782
|
-
* const mergedChannel = Channel.merge(leftChannel, rightChannel
|
|
4783
|
-
* haltStrategy: "either"
|
|
4784
|
-
* })
|
|
4753
|
+
* // The default "both" strategy waits for both channels to complete
|
|
4754
|
+
* const mergedChannel = Channel.merge(leftChannel, rightChannel)
|
|
4785
4755
|
*
|
|
4786
|
-
*
|
|
4787
|
-
* //
|
|
4756
|
+
* const values = await Effect.runPromise(Channel.runCollect(mergedChannel))
|
|
4757
|
+
* values.map(String).sort() // => ["1", "2", "3", "a", "b", "c"]
|
|
4788
4758
|
* ```
|
|
4789
4759
|
*
|
|
4790
4760
|
* @category combining
|
|
@@ -4797,24 +4767,18 @@ export declare const merge: {
|
|
|
4797
4767
|
*
|
|
4798
4768
|
* **Example** (Merging channels)
|
|
4799
4769
|
*
|
|
4800
|
-
* ```ts
|
|
4801
|
-
* import { Channel,
|
|
4802
|
-
*
|
|
4803
|
-
* class MergeError extends Data.TaggedError("MergeError")<{
|
|
4804
|
-
* readonly source: string
|
|
4805
|
-
* }> {}
|
|
4770
|
+
* ```ts import.meta.vitest
|
|
4771
|
+
* import { Channel, Effect } from "effect"
|
|
4806
4772
|
*
|
|
4807
4773
|
* // Create two channels
|
|
4808
4774
|
* const leftChannel = Channel.fromIterable([1, 2, 3])
|
|
4809
4775
|
* const rightChannel = Channel.fromIterable(["a", "b", "c"])
|
|
4810
4776
|
*
|
|
4811
|
-
* //
|
|
4812
|
-
* const mergedChannel = Channel.merge(leftChannel, rightChannel
|
|
4813
|
-
* haltStrategy: "either"
|
|
4814
|
-
* })
|
|
4777
|
+
* // The default "both" strategy waits for both channels to complete
|
|
4778
|
+
* const mergedChannel = Channel.merge(leftChannel, rightChannel)
|
|
4815
4779
|
*
|
|
4816
|
-
*
|
|
4817
|
-
* //
|
|
4780
|
+
* const values = await Effect.runPromise(Channel.runCollect(mergedChannel))
|
|
4781
|
+
* values.map(String).sort() // => ["1", "2", "3", "a", "b", "c"]
|
|
4818
4782
|
* ```
|
|
4819
4783
|
*
|
|
4820
4784
|
* @category combining
|
|
@@ -4829,24 +4793,18 @@ export declare const merge: {
|
|
|
4829
4793
|
*
|
|
4830
4794
|
* **Example** (Merging channels)
|
|
4831
4795
|
*
|
|
4832
|
-
* ```ts
|
|
4833
|
-
* import { Channel,
|
|
4834
|
-
*
|
|
4835
|
-
* class MergeError extends Data.TaggedError("MergeError")<{
|
|
4836
|
-
* readonly source: string
|
|
4837
|
-
* }> {}
|
|
4796
|
+
* ```ts import.meta.vitest
|
|
4797
|
+
* import { Channel, Effect } from "effect"
|
|
4838
4798
|
*
|
|
4839
4799
|
* // Create two channels
|
|
4840
4800
|
* const leftChannel = Channel.fromIterable([1, 2, 3])
|
|
4841
4801
|
* const rightChannel = Channel.fromIterable(["a", "b", "c"])
|
|
4842
4802
|
*
|
|
4843
|
-
* //
|
|
4844
|
-
* const mergedChannel = Channel.merge(leftChannel, rightChannel
|
|
4845
|
-
* haltStrategy: "either"
|
|
4846
|
-
* })
|
|
4803
|
+
* // The default "both" strategy waits for both channels to complete
|
|
4804
|
+
* const mergedChannel = Channel.merge(leftChannel, rightChannel)
|
|
4847
4805
|
*
|
|
4848
|
-
*
|
|
4849
|
-
* //
|
|
4806
|
+
* const values = await Effect.runPromise(Channel.runCollect(mergedChannel))
|
|
4807
|
+
* values.map(String).sort() // => ["1", "2", "3", "a", "b", "c"]
|
|
4850
4808
|
* ```
|
|
4851
4809
|
*
|
|
4852
4810
|
* @category combining
|
|
@@ -4925,19 +4883,16 @@ export declare const mergeEffect: {
|
|
|
4925
4883
|
*
|
|
4926
4884
|
* **Example** (Splitting string chunks into lines)
|
|
4927
4885
|
*
|
|
4928
|
-
* ```ts
|
|
4886
|
+
* ```ts import.meta.vitest
|
|
4929
4887
|
* import { Effect, Stream } from "effect"
|
|
4930
4888
|
*
|
|
4931
|
-
* Effect.runPromise(
|
|
4932
|
-
*
|
|
4933
|
-
*
|
|
4934
|
-
*
|
|
4935
|
-
* console.log(result)
|
|
4936
|
-
* // [ 'hello', 'world' ]
|
|
4937
|
-
* }))
|
|
4889
|
+
* const result = await Effect.runPromise(Stream.runCollect(
|
|
4890
|
+
* Stream.splitLines(Stream.make("hel", "lo\r\nwor", "ld\n"))
|
|
4891
|
+
* ))
|
|
4892
|
+
* result // => ["hello", "world"]
|
|
4938
4893
|
* ```
|
|
4939
4894
|
*
|
|
4940
|
-
* @category
|
|
4895
|
+
* @category splitting
|
|
4941
4896
|
* @since 2.0.0
|
|
4942
4897
|
*/
|
|
4943
4898
|
export declare const splitLines: <Err, Done>() => Channel<Arr.NonEmptyReadonlyArray<string>, Err, Done, Arr.NonEmptyReadonlyArray<string>, Err, Done>;
|
|
@@ -4950,7 +4905,7 @@ export declare const splitLines: <Err, Done>() => Channel<Arr.NonEmptyReadonlyAr
|
|
|
4950
4905
|
* span `Uint8Array` boundaries. The optional `encoding` and `options` are
|
|
4951
4906
|
* passed to `TextDecoder`.
|
|
4952
4907
|
*
|
|
4953
|
-
* @category
|
|
4908
|
+
* @category decoding
|
|
4954
4909
|
* @since 4.0.0
|
|
4955
4910
|
*/
|
|
4956
4911
|
export declare const decodeText: <Err, Done>(encoding?: string, options?: TextDecoderOptions) => Channel<Arr.NonEmptyReadonlyArray<string>, Err, Done, Arr.NonEmptyReadonlyArray<Uint8Array>, Err, Done>;
|
|
@@ -4961,7 +4916,7 @@ export declare const decodeText: <Err, Done>(encoding?: string, options?: TextDe
|
|
|
4961
4916
|
*
|
|
4962
4917
|
* Each string inside an emitted array is encoded independently.
|
|
4963
4918
|
*
|
|
4964
|
-
* @category
|
|
4919
|
+
* @category encoding
|
|
4965
4920
|
* @since 4.0.0
|
|
4966
4921
|
*/
|
|
4967
4922
|
export declare const encodeText: <Err, Done>() => Channel<Arr.NonEmptyReadonlyArray<Uint8Array>, Err, Done, Arr.NonEmptyReadonlyArray<string>, Err, Done>;
|
|
@@ -4973,8 +4928,8 @@ export declare const encodeText: <Err, Done>() => Channel<Arr.NonEmptyReadonlyAr
|
|
|
4973
4928
|
*
|
|
4974
4929
|
* **Example** (Piping one channel into another)
|
|
4975
4930
|
*
|
|
4976
|
-
* ```ts
|
|
4977
|
-
* import { Channel, Data } from "effect"
|
|
4931
|
+
* ```ts import.meta.vitest
|
|
4932
|
+
* import { Channel, Data, Effect } from "effect"
|
|
4978
4933
|
*
|
|
4979
4934
|
* class PipeError extends Data.TaggedError("PipeError")<{
|
|
4980
4935
|
* readonly stage: string
|
|
@@ -4987,7 +4942,7 @@ export declare const encodeText: <Err, Done>() => Channel<Arr.NonEmptyReadonlyAr
|
|
|
4987
4942
|
* // Pipe the source into the transform
|
|
4988
4943
|
* const pipedChannel = Channel.pipeTo(sourceChannel, transformChannel)
|
|
4989
4944
|
*
|
|
4990
|
-
* //
|
|
4945
|
+
* Effect.runSync(Channel.runCollect(pipedChannel)) // => [2, 4, 6]
|
|
4991
4946
|
* ```
|
|
4992
4947
|
*
|
|
4993
4948
|
* @category sequencing
|
|
@@ -5002,8 +4957,8 @@ export declare const pipeTo: {
|
|
|
5002
4957
|
*
|
|
5003
4958
|
* **Example** (Piping one channel into another)
|
|
5004
4959
|
*
|
|
5005
|
-
* ```ts
|
|
5006
|
-
* import { Channel, Data } from "effect"
|
|
4960
|
+
* ```ts import.meta.vitest
|
|
4961
|
+
* import { Channel, Data, Effect } from "effect"
|
|
5007
4962
|
*
|
|
5008
4963
|
* class PipeError extends Data.TaggedError("PipeError")<{
|
|
5009
4964
|
* readonly stage: string
|
|
@@ -5016,7 +4971,7 @@ export declare const pipeTo: {
|
|
|
5016
4971
|
* // Pipe the source into the transform
|
|
5017
4972
|
* const pipedChannel = Channel.pipeTo(sourceChannel, transformChannel)
|
|
5018
4973
|
*
|
|
5019
|
-
* //
|
|
4974
|
+
* Effect.runSync(Channel.runCollect(pipedChannel)) // => [2, 4, 6]
|
|
5020
4975
|
* ```
|
|
5021
4976
|
*
|
|
5022
4977
|
* @category sequencing
|
|
@@ -5031,8 +4986,8 @@ export declare const pipeTo: {
|
|
|
5031
4986
|
*
|
|
5032
4987
|
* **Example** (Piping one channel into another)
|
|
5033
4988
|
*
|
|
5034
|
-
* ```ts
|
|
5035
|
-
* import { Channel, Data } from "effect"
|
|
4989
|
+
* ```ts import.meta.vitest
|
|
4990
|
+
* import { Channel, Data, Effect } from "effect"
|
|
5036
4991
|
*
|
|
5037
4992
|
* class PipeError extends Data.TaggedError("PipeError")<{
|
|
5038
4993
|
* readonly stage: string
|
|
@@ -5045,7 +5000,7 @@ export declare const pipeTo: {
|
|
|
5045
5000
|
* // Pipe the source into the transform
|
|
5046
5001
|
* const pipedChannel = Channel.pipeTo(sourceChannel, transformChannel)
|
|
5047
5002
|
*
|
|
5048
|
-
* //
|
|
5003
|
+
* Effect.runSync(Channel.runCollect(pipedChannel)) // => [2, 4, 6]
|
|
5049
5004
|
* ```
|
|
5050
5005
|
*
|
|
5051
5006
|
* @category sequencing
|
|
@@ -5060,21 +5015,22 @@ export declare const pipeTo: {
|
|
|
5060
5015
|
*
|
|
5061
5016
|
* **Example** (Piping while preserving failures)
|
|
5062
5017
|
*
|
|
5063
|
-
* ```ts
|
|
5064
|
-
* import { Channel, Data } from "effect"
|
|
5018
|
+
* ```ts import.meta.vitest
|
|
5019
|
+
* import { Channel, Data, Effect, Exit } from "effect"
|
|
5065
5020
|
*
|
|
5066
5021
|
* class SourceError extends Data.TaggedError("SourceError")<{
|
|
5067
5022
|
* readonly code: number
|
|
5068
5023
|
* }> {}
|
|
5069
5024
|
*
|
|
5070
5025
|
* // Create a failing source channel
|
|
5071
|
-
* const
|
|
5072
|
-
* const
|
|
5026
|
+
* const error = new SourceError({ code: 404 })
|
|
5027
|
+
* const failingSource = Channel.fail(error)
|
|
5028
|
+
* const safeTransform = Channel.identity<never, never, never>()
|
|
5073
5029
|
*
|
|
5074
5030
|
* // Pipe while preserving source failures
|
|
5075
5031
|
* const safePipedChannel = Channel.pipeToOrFail(failingSource, safeTransform)
|
|
5076
5032
|
*
|
|
5077
|
-
* //
|
|
5033
|
+
* Effect.runSync(Effect.exit(Channel.runCollect(safePipedChannel))) // => Exit.fail(error)
|
|
5078
5034
|
* ```
|
|
5079
5035
|
*
|
|
5080
5036
|
* @category sequencing
|
|
@@ -5088,21 +5044,22 @@ export declare const pipeToOrFail: {
|
|
|
5088
5044
|
*
|
|
5089
5045
|
* **Example** (Piping while preserving failures)
|
|
5090
5046
|
*
|
|
5091
|
-
* ```ts
|
|
5092
|
-
* import { Channel, Data } from "effect"
|
|
5047
|
+
* ```ts import.meta.vitest
|
|
5048
|
+
* import { Channel, Data, Effect, Exit } from "effect"
|
|
5093
5049
|
*
|
|
5094
5050
|
* class SourceError extends Data.TaggedError("SourceError")<{
|
|
5095
5051
|
* readonly code: number
|
|
5096
5052
|
* }> {}
|
|
5097
5053
|
*
|
|
5098
5054
|
* // Create a failing source channel
|
|
5099
|
-
* const
|
|
5100
|
-
* const
|
|
5055
|
+
* const error = new SourceError({ code: 404 })
|
|
5056
|
+
* const failingSource = Channel.fail(error)
|
|
5057
|
+
* const safeTransform = Channel.identity<never, never, never>()
|
|
5101
5058
|
*
|
|
5102
5059
|
* // Pipe while preserving source failures
|
|
5103
5060
|
* const safePipedChannel = Channel.pipeToOrFail(failingSource, safeTransform)
|
|
5104
5061
|
*
|
|
5105
|
-
* //
|
|
5062
|
+
* Effect.runSync(Effect.exit(Channel.runCollect(safePipedChannel))) // => Exit.fail(error)
|
|
5106
5063
|
* ```
|
|
5107
5064
|
*
|
|
5108
5065
|
* @category sequencing
|
|
@@ -5116,21 +5073,22 @@ export declare const pipeToOrFail: {
|
|
|
5116
5073
|
*
|
|
5117
5074
|
* **Example** (Piping while preserving failures)
|
|
5118
5075
|
*
|
|
5119
|
-
* ```ts
|
|
5120
|
-
* import { Channel, Data } from "effect"
|
|
5076
|
+
* ```ts import.meta.vitest
|
|
5077
|
+
* import { Channel, Data, Effect, Exit } from "effect"
|
|
5121
5078
|
*
|
|
5122
5079
|
* class SourceError extends Data.TaggedError("SourceError")<{
|
|
5123
5080
|
* readonly code: number
|
|
5124
5081
|
* }> {}
|
|
5125
5082
|
*
|
|
5126
5083
|
* // Create a failing source channel
|
|
5127
|
-
* const
|
|
5128
|
-
* const
|
|
5084
|
+
* const error = new SourceError({ code: 404 })
|
|
5085
|
+
* const failingSource = Channel.fail(error)
|
|
5086
|
+
* const safeTransform = Channel.identity<never, never, never>()
|
|
5129
5087
|
*
|
|
5130
5088
|
* // Pipe while preserving source failures
|
|
5131
5089
|
* const safePipedChannel = Channel.pipeToOrFail(failingSource, safeTransform)
|
|
5132
5090
|
*
|
|
5133
|
-
* //
|
|
5091
|
+
* Effect.runSync(Effect.exit(Channel.runCollect(safePipedChannel))) // => Exit.fail(error)
|
|
5134
5092
|
* ```
|
|
5135
5093
|
*
|
|
5136
5094
|
* @category sequencing
|
|
@@ -5144,7 +5102,7 @@ export declare const pipeToOrFail: {
|
|
|
5144
5102
|
*
|
|
5145
5103
|
* **Example** (Unwrapping channel effects)
|
|
5146
5104
|
*
|
|
5147
|
-
* ```ts
|
|
5105
|
+
* ```ts import.meta.vitest
|
|
5148
5106
|
* import { Channel, Data, Effect } from "effect"
|
|
5149
5107
|
*
|
|
5150
5108
|
* class UnwrapError extends Data.TaggedError("UnwrapError")<{
|
|
@@ -5159,7 +5117,7 @@ export declare const pipeToOrFail: {
|
|
|
5159
5117
|
* // Unwrap the effect to get the channel
|
|
5160
5118
|
* const unwrappedChannel = Channel.unwrap(channelEffect)
|
|
5161
5119
|
*
|
|
5162
|
-
* //
|
|
5120
|
+
* Effect.runSync(Channel.runCollect(unwrappedChannel)) // => [1, 2, 3]
|
|
5163
5121
|
* ```
|
|
5164
5122
|
*
|
|
5165
5123
|
* @category constructors
|
|
@@ -5185,7 +5143,7 @@ export declare const scoped: <OutElem, OutErr, OutDone, InElem, InErr, InDone, E
|
|
|
5185
5143
|
*
|
|
5186
5144
|
* **Example** (Embedding custom input handling)
|
|
5187
5145
|
*
|
|
5188
|
-
* ```ts
|
|
5146
|
+
* ```ts import.meta.vitest
|
|
5189
5147
|
* import { Channel, Effect } from "effect"
|
|
5190
5148
|
*
|
|
5191
5149
|
* // Create a base channel
|
|
@@ -5196,13 +5154,11 @@ export declare const scoped: <OutElem, OutErr, OutDone, InElem, InErr, InDone, E
|
|
|
5196
5154
|
* baseChannel,
|
|
5197
5155
|
* (upstream) =>
|
|
5198
5156
|
* upstream.pipe(
|
|
5199
|
-
* Effect.tap((message) =>
|
|
5200
|
-
* Effect.sync(() => console.log(message))
|
|
5201
|
-
* ),
|
|
5202
5157
|
* Effect.forever,
|
|
5203
5158
|
* Effect.ignore
|
|
5204
5159
|
* )
|
|
5205
5160
|
* )
|
|
5161
|
+
* await Effect.runPromise(Channel.runCollect(embeddedChannel)) // => [1, 2, 3]
|
|
5206
5162
|
* ```
|
|
5207
5163
|
*
|
|
5208
5164
|
* @category sequencing
|
|
@@ -5220,7 +5176,7 @@ export declare const embedInput: {
|
|
|
5220
5176
|
*
|
|
5221
5177
|
* **Example** (Embedding custom input handling)
|
|
5222
5178
|
*
|
|
5223
|
-
* ```ts
|
|
5179
|
+
* ```ts import.meta.vitest
|
|
5224
5180
|
* import { Channel, Effect } from "effect"
|
|
5225
5181
|
*
|
|
5226
5182
|
* // Create a base channel
|
|
@@ -5231,13 +5187,11 @@ export declare const embedInput: {
|
|
|
5231
5187
|
* baseChannel,
|
|
5232
5188
|
* (upstream) =>
|
|
5233
5189
|
* upstream.pipe(
|
|
5234
|
-
* Effect.tap((message) =>
|
|
5235
|
-
* Effect.sync(() => console.log(message))
|
|
5236
|
-
* ),
|
|
5237
5190
|
* Effect.forever,
|
|
5238
5191
|
* Effect.ignore
|
|
5239
5192
|
* )
|
|
5240
5193
|
* )
|
|
5194
|
+
* await Effect.runPromise(Channel.runCollect(embeddedChannel)) // => [1, 2, 3]
|
|
5241
5195
|
* ```
|
|
5242
5196
|
*
|
|
5243
5197
|
* @category sequencing
|
|
@@ -5255,7 +5209,7 @@ export declare const embedInput: {
|
|
|
5255
5209
|
*
|
|
5256
5210
|
* **Example** (Embedding custom input handling)
|
|
5257
5211
|
*
|
|
5258
|
-
* ```ts
|
|
5212
|
+
* ```ts import.meta.vitest
|
|
5259
5213
|
* import { Channel, Effect } from "effect"
|
|
5260
5214
|
*
|
|
5261
5215
|
* // Create a base channel
|
|
@@ -5266,13 +5220,11 @@ export declare const embedInput: {
|
|
|
5266
5220
|
* baseChannel,
|
|
5267
5221
|
* (upstream) =>
|
|
5268
5222
|
* upstream.pipe(
|
|
5269
|
-
* Effect.tap((message) =>
|
|
5270
|
-
* Effect.sync(() => console.log(message))
|
|
5271
|
-
* ),
|
|
5272
5223
|
* Effect.forever,
|
|
5273
5224
|
* Effect.ignore
|
|
5274
5225
|
* )
|
|
5275
5226
|
* )
|
|
5227
|
+
* await Effect.runPromise(Channel.runCollect(embeddedChannel)) // => [1, 2, 3]
|
|
5276
5228
|
* ```
|
|
5277
5229
|
*
|
|
5278
5230
|
* @category sequencing
|
|
@@ -5302,7 +5254,7 @@ export declare const embedInput: {
|
|
|
5302
5254
|
*
|
|
5303
5255
|
* @see {@link bufferArray} for buffering elements from array outputs
|
|
5304
5256
|
*
|
|
5305
|
-
* @category
|
|
5257
|
+
* @category buffering
|
|
5306
5258
|
* @since 2.0.0
|
|
5307
5259
|
*/
|
|
5308
5260
|
export declare const buffer: {
|
|
@@ -5328,7 +5280,7 @@ export declare const buffer: {
|
|
|
5328
5280
|
*
|
|
5329
5281
|
* @see {@link bufferArray} for buffering elements from array outputs
|
|
5330
5282
|
*
|
|
5331
|
-
* @category
|
|
5283
|
+
* @category buffering
|
|
5332
5284
|
* @since 2.0.0
|
|
5333
5285
|
*/
|
|
5334
5286
|
(options: {
|
|
@@ -5359,7 +5311,7 @@ export declare const buffer: {
|
|
|
5359
5311
|
*
|
|
5360
5312
|
* @see {@link bufferArray} for buffering elements from array outputs
|
|
5361
5313
|
*
|
|
5362
|
-
* @category
|
|
5314
|
+
* @category buffering
|
|
5363
5315
|
* @since 2.0.0
|
|
5364
5316
|
*/
|
|
5365
5317
|
<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>(self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>, options: {
|
|
@@ -5393,7 +5345,7 @@ export declare const buffer: {
|
|
|
5393
5345
|
*
|
|
5394
5346
|
* @see {@link buffer} for buffering output elements without flattening arrays
|
|
5395
5347
|
*
|
|
5396
|
-
* @category
|
|
5348
|
+
* @category buffering
|
|
5397
5349
|
* @since 4.0.0
|
|
5398
5350
|
*/
|
|
5399
5351
|
export declare const bufferArray: {
|
|
@@ -5421,7 +5373,7 @@ export declare const bufferArray: {
|
|
|
5421
5373
|
*
|
|
5422
5374
|
* @see {@link buffer} for buffering output elements without flattening arrays
|
|
5423
5375
|
*
|
|
5424
|
-
* @category
|
|
5376
|
+
* @category buffering
|
|
5425
5377
|
* @since 4.0.0
|
|
5426
5378
|
*/
|
|
5427
5379
|
(options: {
|
|
@@ -5454,7 +5406,7 @@ export declare const bufferArray: {
|
|
|
5454
5406
|
*
|
|
5455
5407
|
* @see {@link buffer} for buffering output elements without flattening arrays
|
|
5456
5408
|
*
|
|
5457
|
-
* @category
|
|
5409
|
+
* @category buffering
|
|
5458
5410
|
* @since 4.0.0
|
|
5459
5411
|
*/
|
|
5460
5412
|
<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>(self: Channel<Arr.NonEmptyReadonlyArray<OutElem>, OutErr, OutDone, InElem, InErr, InDone, Env>, options: {
|
|
@@ -5605,8 +5557,8 @@ export declare const onError: {
|
|
|
5605
5557
|
*
|
|
5606
5558
|
* **Example** (Running exit finalizers)
|
|
5607
5559
|
*
|
|
5608
|
-
* ```ts
|
|
5609
|
-
* import { Channel,
|
|
5560
|
+
* ```ts import.meta.vitest
|
|
5561
|
+
* import { Channel, Data, Effect, Exit } from "effect"
|
|
5610
5562
|
*
|
|
5611
5563
|
* class ExitError extends Data.TaggedError("ExitError")<{
|
|
5612
5564
|
* readonly stage: string
|
|
@@ -5616,13 +5568,12 @@ export declare const onError: {
|
|
|
5616
5568
|
* const dataChannel = Channel.fromIterable([1, 2, 3])
|
|
5617
5569
|
*
|
|
5618
5570
|
* // Attach exit handler
|
|
5571
|
+
* const exits: Array<Exit.Exit<void, ExitError>> = []
|
|
5619
5572
|
* const channelWithExit = Channel.onExit(dataChannel, (exit) => {
|
|
5620
|
-
*
|
|
5621
|
-
*
|
|
5622
|
-
* } else {
|
|
5623
|
-
* return Console.log(`Channel failed with: ${exit.cause}`)
|
|
5624
|
-
* }
|
|
5573
|
+
* exits.push(exit)
|
|
5574
|
+
* return Effect.void
|
|
5625
5575
|
* })
|
|
5576
|
+
* const observed = [await Effect.runPromise(Channel.runCollect(channelWithExit)), exits] // => [[1, 2, 3], [Exit.void]]
|
|
5626
5577
|
* ```
|
|
5627
5578
|
*
|
|
5628
5579
|
* @category resource management
|
|
@@ -5635,8 +5586,8 @@ export declare const onExit: {
|
|
|
5635
5586
|
*
|
|
5636
5587
|
* **Example** (Running exit finalizers)
|
|
5637
5588
|
*
|
|
5638
|
-
* ```ts
|
|
5639
|
-
* import { Channel,
|
|
5589
|
+
* ```ts import.meta.vitest
|
|
5590
|
+
* import { Channel, Data, Effect, Exit } from "effect"
|
|
5640
5591
|
*
|
|
5641
5592
|
* class ExitError extends Data.TaggedError("ExitError")<{
|
|
5642
5593
|
* readonly stage: string
|
|
@@ -5646,13 +5597,12 @@ export declare const onExit: {
|
|
|
5646
5597
|
* const dataChannel = Channel.fromIterable([1, 2, 3])
|
|
5647
5598
|
*
|
|
5648
5599
|
* // Attach exit handler
|
|
5600
|
+
* const exits: Array<Exit.Exit<void, ExitError>> = []
|
|
5649
5601
|
* const channelWithExit = Channel.onExit(dataChannel, (exit) => {
|
|
5650
|
-
*
|
|
5651
|
-
*
|
|
5652
|
-
* } else {
|
|
5653
|
-
* return Console.log(`Channel failed with: ${exit.cause}`)
|
|
5654
|
-
* }
|
|
5602
|
+
* exits.push(exit)
|
|
5603
|
+
* return Effect.void
|
|
5655
5604
|
* })
|
|
5605
|
+
* const observed = [await Effect.runPromise(Channel.runCollect(channelWithExit)), exits] // => [[1, 2, 3], [Exit.void]]
|
|
5656
5606
|
* ```
|
|
5657
5607
|
*
|
|
5658
5608
|
* @category resource management
|
|
@@ -5665,8 +5615,8 @@ export declare const onExit: {
|
|
|
5665
5615
|
*
|
|
5666
5616
|
* **Example** (Running exit finalizers)
|
|
5667
5617
|
*
|
|
5668
|
-
* ```ts
|
|
5669
|
-
* import { Channel,
|
|
5618
|
+
* ```ts import.meta.vitest
|
|
5619
|
+
* import { Channel, Data, Effect, Exit } from "effect"
|
|
5670
5620
|
*
|
|
5671
5621
|
* class ExitError extends Data.TaggedError("ExitError")<{
|
|
5672
5622
|
* readonly stage: string
|
|
@@ -5676,13 +5626,12 @@ export declare const onExit: {
|
|
|
5676
5626
|
* const dataChannel = Channel.fromIterable([1, 2, 3])
|
|
5677
5627
|
*
|
|
5678
5628
|
* // Attach exit handler
|
|
5629
|
+
* const exits: Array<Exit.Exit<void, ExitError>> = []
|
|
5679
5630
|
* const channelWithExit = Channel.onExit(dataChannel, (exit) => {
|
|
5680
|
-
*
|
|
5681
|
-
*
|
|
5682
|
-
* } else {
|
|
5683
|
-
* return Console.log(`Channel failed with: ${exit.cause}`)
|
|
5684
|
-
* }
|
|
5631
|
+
* exits.push(exit)
|
|
5632
|
+
* return Effect.void
|
|
5685
5633
|
* })
|
|
5634
|
+
* const observed = [await Effect.runPromise(Channel.runCollect(channelWithExit)), exits] // => [[1, 2, 3], [Exit.void]]
|
|
5686
5635
|
* ```
|
|
5687
5636
|
*
|
|
5688
5637
|
* @category resource management
|
|
@@ -5828,8 +5777,8 @@ export declare const onEnd: {
|
|
|
5828
5777
|
*
|
|
5829
5778
|
* **Example** (Ensuring cleanup runs)
|
|
5830
5779
|
*
|
|
5831
|
-
* ```ts
|
|
5832
|
-
* import { Channel,
|
|
5780
|
+
* ```ts import.meta.vitest
|
|
5781
|
+
* import { Channel, Data, Effect } from "effect"
|
|
5833
5782
|
*
|
|
5834
5783
|
* class EnsureError extends Data.TaggedError("EnsureError")<{
|
|
5835
5784
|
* readonly operation: string
|
|
@@ -5839,10 +5788,12 @@ export declare const onEnd: {
|
|
|
5839
5788
|
* const dataChannel = Channel.fromIterable([1, 2, 3])
|
|
5840
5789
|
*
|
|
5841
5790
|
* // Ensure cleanup always runs
|
|
5791
|
+
* const events: Array<string> = []
|
|
5842
5792
|
* const channelWithCleanup = Channel.ensuring(
|
|
5843
5793
|
* dataChannel,
|
|
5844
|
-
*
|
|
5794
|
+
* Effect.sync(() => events.push("cleanup"))
|
|
5845
5795
|
* )
|
|
5796
|
+
* const observed = [await Effect.runPromise(Channel.runCollect(channelWithCleanup)), events] // => [[1, 2, 3], ["cleanup"]]
|
|
5846
5797
|
* ```
|
|
5847
5798
|
*
|
|
5848
5799
|
* @category resource management
|
|
@@ -5855,8 +5806,8 @@ export declare const ensuring: {
|
|
|
5855
5806
|
*
|
|
5856
5807
|
* **Example** (Ensuring cleanup runs)
|
|
5857
5808
|
*
|
|
5858
|
-
* ```ts
|
|
5859
|
-
* import { Channel,
|
|
5809
|
+
* ```ts import.meta.vitest
|
|
5810
|
+
* import { Channel, Data, Effect } from "effect"
|
|
5860
5811
|
*
|
|
5861
5812
|
* class EnsureError extends Data.TaggedError("EnsureError")<{
|
|
5862
5813
|
* readonly operation: string
|
|
@@ -5866,10 +5817,12 @@ export declare const ensuring: {
|
|
|
5866
5817
|
* const dataChannel = Channel.fromIterable([1, 2, 3])
|
|
5867
5818
|
*
|
|
5868
5819
|
* // Ensure cleanup always runs
|
|
5820
|
+
* const events: Array<string> = []
|
|
5869
5821
|
* const channelWithCleanup = Channel.ensuring(
|
|
5870
5822
|
* dataChannel,
|
|
5871
|
-
*
|
|
5823
|
+
* Effect.sync(() => events.push("cleanup"))
|
|
5872
5824
|
* )
|
|
5825
|
+
* const observed = [await Effect.runPromise(Channel.runCollect(channelWithCleanup)), events] // => [[1, 2, 3], ["cleanup"]]
|
|
5873
5826
|
* ```
|
|
5874
5827
|
*
|
|
5875
5828
|
* @category resource management
|
|
@@ -5882,8 +5835,8 @@ export declare const ensuring: {
|
|
|
5882
5835
|
*
|
|
5883
5836
|
* **Example** (Ensuring cleanup runs)
|
|
5884
5837
|
*
|
|
5885
|
-
* ```ts
|
|
5886
|
-
* import { Channel,
|
|
5838
|
+
* ```ts import.meta.vitest
|
|
5839
|
+
* import { Channel, Data, Effect } from "effect"
|
|
5887
5840
|
*
|
|
5888
5841
|
* class EnsureError extends Data.TaggedError("EnsureError")<{
|
|
5889
5842
|
* readonly operation: string
|
|
@@ -5893,10 +5846,12 @@ export declare const ensuring: {
|
|
|
5893
5846
|
* const dataChannel = Channel.fromIterable([1, 2, 3])
|
|
5894
5847
|
*
|
|
5895
5848
|
* // Ensure cleanup always runs
|
|
5849
|
+
* const events: Array<string> = []
|
|
5896
5850
|
* const channelWithCleanup = Channel.ensuring(
|
|
5897
5851
|
* dataChannel,
|
|
5898
|
-
*
|
|
5852
|
+
* Effect.sync(() => events.push("cleanup"))
|
|
5899
5853
|
* )
|
|
5854
|
+
* const observed = [await Effect.runPromise(Channel.runCollect(channelWithCleanup)), events] // => [[1, 2, 3], ["cleanup"]]
|
|
5900
5855
|
* ```
|
|
5901
5856
|
*
|
|
5902
5857
|
* @category resource management
|
|
@@ -5907,7 +5862,7 @@ export declare const ensuring: {
|
|
|
5907
5862
|
/**
|
|
5908
5863
|
* Creates a channel from the specified services.
|
|
5909
5864
|
*
|
|
5910
|
-
* @category
|
|
5865
|
+
* @category accessors
|
|
5911
5866
|
* @since 2.0.0
|
|
5912
5867
|
*/
|
|
5913
5868
|
export declare const contextWith: <Env, OutElem, OutErr, OutDone, InElem, InErr, InDone, Env2>(f: (context: Context.Context<Env>) => Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env2>) => Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env | Env2>;
|
|
@@ -5915,7 +5870,7 @@ export declare const contextWith: <Env, OutElem, OutErr, OutDone, InElem, InErr,
|
|
|
5915
5870
|
* Provides a `Context` to the channel, removing the corresponding service
|
|
5916
5871
|
* requirements from the returned channel.
|
|
5917
5872
|
*
|
|
5918
|
-
* @category services
|
|
5873
|
+
* @category providing services
|
|
5919
5874
|
* @since 2.0.0
|
|
5920
5875
|
*/
|
|
5921
5876
|
export declare const provideContext: {
|
|
@@ -5923,7 +5878,7 @@ export declare const provideContext: {
|
|
|
5923
5878
|
* Provides a `Context` to the channel, removing the corresponding service
|
|
5924
5879
|
* requirements from the returned channel.
|
|
5925
5880
|
*
|
|
5926
|
-
* @category services
|
|
5881
|
+
* @category providing services
|
|
5927
5882
|
* @since 2.0.0
|
|
5928
5883
|
*/
|
|
5929
5884
|
<R2>(context: Context.Context<R2>): <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>(self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>) => Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Exclude<Env, R2>>;
|
|
@@ -5931,7 +5886,7 @@ export declare const provideContext: {
|
|
|
5931
5886
|
* Provides a `Context` to the channel, removing the corresponding service
|
|
5932
5887
|
* requirements from the returned channel.
|
|
5933
5888
|
*
|
|
5934
|
-
* @category services
|
|
5889
|
+
* @category providing services
|
|
5935
5890
|
* @since 2.0.0
|
|
5936
5891
|
*/
|
|
5937
5892
|
<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env, R2>(self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>, context: Context.Context<R2>): Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Exclude<Env, R2>>;
|
|
@@ -5940,7 +5895,7 @@ export declare const provideContext: {
|
|
|
5940
5895
|
* Provides a concrete service for a context key, removing that service
|
|
5941
5896
|
* requirement from the returned channel.
|
|
5942
5897
|
*
|
|
5943
|
-
* @category services
|
|
5898
|
+
* @category providing services
|
|
5944
5899
|
* @since 2.0.0
|
|
5945
5900
|
*/
|
|
5946
5901
|
export declare const provideService: {
|
|
@@ -5948,7 +5903,7 @@ export declare const provideService: {
|
|
|
5948
5903
|
* Provides a concrete service for a context key, removing that service
|
|
5949
5904
|
* requirement from the returned channel.
|
|
5950
5905
|
*
|
|
5951
|
-
* @category services
|
|
5906
|
+
* @category providing services
|
|
5952
5907
|
* @since 2.0.0
|
|
5953
5908
|
*/
|
|
5954
5909
|
<I, S>(key: Context.Key<I, S>, service: NoInfer<S>): <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>(self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>) => Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Exclude<Env, I>>;
|
|
@@ -5956,7 +5911,7 @@ export declare const provideService: {
|
|
|
5956
5911
|
* Provides a concrete service for a context key, removing that service
|
|
5957
5912
|
* requirement from the returned channel.
|
|
5958
5913
|
*
|
|
5959
|
-
* @category services
|
|
5914
|
+
* @category providing services
|
|
5960
5915
|
* @since 2.0.0
|
|
5961
5916
|
*/
|
|
5962
5917
|
<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env, I, S>(self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>, key: Context.Key<I, S>, service: NoInfer<S>): Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Exclude<Env, I>>;
|
|
@@ -5974,7 +5929,7 @@ export declare const provideService: {
|
|
|
5974
5929
|
* If the service effect fails, the returned channel fails. The provided service
|
|
5975
5930
|
* removes the corresponding service requirement from the returned channel.
|
|
5976
5931
|
*
|
|
5977
|
-
* @category services
|
|
5932
|
+
* @category providing services
|
|
5978
5933
|
* @since 4.0.0
|
|
5979
5934
|
*/
|
|
5980
5935
|
export declare const provideServiceEffect: {
|
|
@@ -5991,7 +5946,7 @@ export declare const provideServiceEffect: {
|
|
|
5991
5946
|
* If the service effect fails, the returned channel fails. The provided service
|
|
5992
5947
|
* removes the corresponding service requirement from the returned channel.
|
|
5993
5948
|
*
|
|
5994
|
-
* @category services
|
|
5949
|
+
* @category providing services
|
|
5995
5950
|
* @since 4.0.0
|
|
5996
5951
|
*/
|
|
5997
5952
|
<I, S, ES, RS>(key: Context.Key<I, S>, service: Effect.Effect<NoInfer<S>, ES, RS>): <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>(self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>) => Channel<OutElem, OutErr | ES, OutDone, InElem, InErr, InDone, Exclude<Env, I> | RS>;
|
|
@@ -6008,7 +5963,7 @@ export declare const provideServiceEffect: {
|
|
|
6008
5963
|
* If the service effect fails, the returned channel fails. The provided service
|
|
6009
5964
|
* removes the corresponding service requirement from the returned channel.
|
|
6010
5965
|
*
|
|
6011
|
-
* @category services
|
|
5966
|
+
* @category providing services
|
|
6012
5967
|
* @since 4.0.0
|
|
6013
5968
|
*/
|
|
6014
5969
|
<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env, I, S, ES, RS>(self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>, key: Context.Key<I, S>, service: Effect.Effect<NoInfer<S>, ES, RS>): Channel<OutElem, OutErr | ES, OutDone, InElem, InErr, InDone, Exclude<Env, I> | RS>;
|
|
@@ -6023,7 +5978,7 @@ export declare const provideServiceEffect: {
|
|
|
6023
5978
|
* builds the layer in the channel scope. Use `options.local` to build a fresh
|
|
6024
5979
|
* layer instance for this provision.
|
|
6025
5980
|
*
|
|
6026
|
-
* @category services
|
|
5981
|
+
* @category providing services
|
|
6027
5982
|
* @since 4.0.0
|
|
6028
5983
|
*/
|
|
6029
5984
|
export declare const provide: {
|
|
@@ -6037,7 +5992,7 @@ export declare const provide: {
|
|
|
6037
5992
|
* builds the layer in the channel scope. Use `options.local` to build a fresh
|
|
6038
5993
|
* layer instance for this provision.
|
|
6039
5994
|
*
|
|
6040
|
-
* @category services
|
|
5995
|
+
* @category providing services
|
|
6041
5996
|
* @since 4.0.0
|
|
6042
5997
|
*/
|
|
6043
5998
|
<A, E = never, R = never>(layer: Layer.Layer<A, E, R> | Context.Context<A>, options?: {
|
|
@@ -6053,7 +6008,7 @@ export declare const provide: {
|
|
|
6053
6008
|
* builds the layer in the channel scope. Use `options.local` to build a fresh
|
|
6054
6009
|
* layer instance for this provision.
|
|
6055
6010
|
*
|
|
6056
|
-
* @category services
|
|
6011
|
+
* @category providing services
|
|
6057
6012
|
* @since 4.0.0
|
|
6058
6013
|
*/
|
|
6059
6014
|
<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env, A, E = never, R = never>(self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>, layer: Layer.Layer<A, E, R> | Context.Context<A>, options?: {
|
|
@@ -6069,7 +6024,7 @@ export declare const provide: {
|
|
|
6069
6024
|
* provide to the channel. The returned channel requires the services needed to
|
|
6070
6025
|
* build that context.
|
|
6071
6026
|
*
|
|
6072
|
-
* @category services
|
|
6027
|
+
* @category providing services
|
|
6073
6028
|
* @since 4.0.0
|
|
6074
6029
|
*/
|
|
6075
6030
|
export declare const updateContext: {
|
|
@@ -6082,7 +6037,7 @@ export declare const updateContext: {
|
|
|
6082
6037
|
* provide to the channel. The returned channel requires the services needed to
|
|
6083
6038
|
* build that context.
|
|
6084
6039
|
*
|
|
6085
|
-
* @category services
|
|
6040
|
+
* @category providing services
|
|
6086
6041
|
* @since 4.0.0
|
|
6087
6042
|
*/
|
|
6088
6043
|
<Env, R2>(f: (context: Context.Context<R2>) => Context.Context<Env>): <OutElem, OutErr, OutDone, InElem, InErr, InDone>(self: Channel<OutElem, InElem, OutErr, InErr, OutDone, InDone, Env>) => Channel<OutElem, InElem, OutErr, InErr, OutDone, InDone, R2>;
|
|
@@ -6095,7 +6050,7 @@ export declare const updateContext: {
|
|
|
6095
6050
|
* provide to the channel. The returned channel requires the services needed to
|
|
6096
6051
|
* build that context.
|
|
6097
6052
|
*
|
|
6098
|
-
* @category services
|
|
6053
|
+
* @category providing services
|
|
6099
6054
|
* @since 4.0.0
|
|
6100
6055
|
*/
|
|
6101
6056
|
<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env, R2>(self: Channel<OutElem, InElem, OutErr, InErr, OutDone, InDone, Env>, f: (context: Context.Context<R2>) => Context.Context<Env>): Channel<OutElem, InElem, OutErr, InErr, OutDone, InDone, R2>;
|
|
@@ -6108,7 +6063,7 @@ export declare const updateContext: {
|
|
|
6108
6063
|
* The existing service is read from the context. The updated service is
|
|
6109
6064
|
* provided to the channel under the same key.
|
|
6110
6065
|
*
|
|
6111
|
-
* @category services
|
|
6066
|
+
* @category providing services
|
|
6112
6067
|
* @since 2.0.0
|
|
6113
6068
|
*/
|
|
6114
6069
|
export declare const updateService: {
|
|
@@ -6120,7 +6075,7 @@ export declare const updateService: {
|
|
|
6120
6075
|
* The existing service is read from the context. The updated service is
|
|
6121
6076
|
* provided to the channel under the same key.
|
|
6122
6077
|
*
|
|
6123
|
-
* @category services
|
|
6078
|
+
* @category providing services
|
|
6124
6079
|
* @since 2.0.0
|
|
6125
6080
|
*/
|
|
6126
6081
|
<I, S>(key: Context.Key<I, S>, f: (service: NoInfer<S>) => S): <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>(self: Channel<OutElem, InElem, OutErr, InErr, OutDone, InDone, Env>) => Channel<OutElem, InElem, OutErr, InErr, OutDone, InDone, Env | I>;
|
|
@@ -6132,7 +6087,7 @@ export declare const updateService: {
|
|
|
6132
6087
|
* The existing service is read from the context. The updated service is
|
|
6133
6088
|
* provided to the channel under the same key.
|
|
6134
6089
|
*
|
|
6135
|
-
* @category services
|
|
6090
|
+
* @category providing services
|
|
6136
6091
|
* @since 2.0.0
|
|
6137
6092
|
*/
|
|
6138
6093
|
<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env, I, S>(self: Channel<OutElem, InElem, OutErr, InErr, OutDone, InDone, Env>, service: Context.Key<I, S>, f: (service: NoInfer<S>) => S): Channel<OutElem, InElem, OutErr, InErr, OutDone, InDone, Env | I>;
|
|
@@ -6177,7 +6132,7 @@ export declare const withSpan: {
|
|
|
6177
6132
|
/**
|
|
6178
6133
|
* The starting channel for Do notation, emitting an empty object.
|
|
6179
6134
|
*
|
|
6180
|
-
* @category
|
|
6135
|
+
* @category constructors
|
|
6181
6136
|
* @since 4.0.0
|
|
6182
6137
|
*/
|
|
6183
6138
|
export declare const Do: Channel<{}>;
|
|
@@ -6193,7 +6148,7 @@ export {
|
|
|
6193
6148
|
/**
|
|
6194
6149
|
* Adds a computed field to each object emitted by a channel.
|
|
6195
6150
|
*
|
|
6196
|
-
* @category
|
|
6151
|
+
* @category mapping
|
|
6197
6152
|
* @since 4.0.0
|
|
6198
6153
|
*/
|
|
6199
6154
|
let_ as let };
|
|
@@ -6207,7 +6162,7 @@ let_ as let };
|
|
|
6207
6162
|
* channel's output becomes the value of the new field. `options.concurrency`
|
|
6208
6163
|
* and `options.bufferSize` control how derived channels are flattened.
|
|
6209
6164
|
*
|
|
6210
|
-
* @category
|
|
6165
|
+
* @category sequencing
|
|
6211
6166
|
* @since 4.0.0
|
|
6212
6167
|
*/
|
|
6213
6168
|
export declare const bind: {
|
|
@@ -6221,7 +6176,7 @@ export declare const bind: {
|
|
|
6221
6176
|
* channel's output becomes the value of the new field. `options.concurrency`
|
|
6222
6177
|
* and `options.bufferSize` control how derived channels are flattened.
|
|
6223
6178
|
*
|
|
6224
|
-
* @category
|
|
6179
|
+
* @category sequencing
|
|
6225
6180
|
* @since 4.0.0
|
|
6226
6181
|
*/
|
|
6227
6182
|
<N extends string, OutElem extends object, B, OutErr2, OutDone2, InElem2, InErr2, InDone2, Env2>(name: Exclude<N, keyof OutElem>, f: (a: NoInfer<OutElem>) => Channel<B, OutErr2, OutDone2, InElem2, InErr2, InDone2, Env2>, options?: {
|
|
@@ -6240,7 +6195,7 @@ export declare const bind: {
|
|
|
6240
6195
|
* channel's output becomes the value of the new field. `options.concurrency`
|
|
6241
6196
|
* and `options.bufferSize` control how derived channels are flattened.
|
|
6242
6197
|
*
|
|
6243
|
-
* @category
|
|
6198
|
+
* @category sequencing
|
|
6244
6199
|
* @since 4.0.0
|
|
6245
6200
|
*/
|
|
6246
6201
|
<OutElem extends object, OutErr, OutDone, InElem, InErr, InDone, Env, N extends string, B, OutErr2, OutDone2, InElem2, InErr2, InDone2, Env2>(self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>, name: Exclude<N, keyof OutElem>, f: (a: NoInfer<OutElem>) => Channel<B, OutErr2, OutDone2, InElem2, InErr2, InDone2, Env2>, options?: {
|
|
@@ -6262,7 +6217,7 @@ export declare const bind: {
|
|
|
6262
6217
|
* @see {@link bind} for adding a field produced by another channel
|
|
6263
6218
|
* @see {@link let_ let} for adding a computed field
|
|
6264
6219
|
*
|
|
6265
|
-
* @category
|
|
6220
|
+
* @category mapping
|
|
6266
6221
|
* @since 4.0.0
|
|
6267
6222
|
*/
|
|
6268
6223
|
export declare const bindTo: {
|
|
@@ -6278,7 +6233,7 @@ export declare const bindTo: {
|
|
|
6278
6233
|
* @see {@link bind} for adding a field produced by another channel
|
|
6279
6234
|
* @see {@link let_ let} for adding a computed field
|
|
6280
6235
|
*
|
|
6281
|
-
* @category
|
|
6236
|
+
* @category mapping
|
|
6282
6237
|
* @since 4.0.0
|
|
6283
6238
|
*/
|
|
6284
6239
|
<N extends string>(name: N): <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>(self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>) => Channel<{
|
|
@@ -6296,7 +6251,7 @@ export declare const bindTo: {
|
|
|
6296
6251
|
* @see {@link bind} for adding a field produced by another channel
|
|
6297
6252
|
* @see {@link let_ let} for adding a computed field
|
|
6298
6253
|
*
|
|
6299
|
-
* @category
|
|
6254
|
+
* @category mapping
|
|
6300
6255
|
* @since 4.0.0
|
|
6301
6256
|
*/
|
|
6302
6257
|
<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env, N extends string>(self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>, name: N): Channel<{
|
|
@@ -6308,8 +6263,8 @@ export declare const bindTo: {
|
|
|
6308
6263
|
*
|
|
6309
6264
|
* **Example** (Counting channel output)
|
|
6310
6265
|
*
|
|
6311
|
-
* ```ts
|
|
6312
|
-
* import { Channel, Data } from "effect"
|
|
6266
|
+
* ```ts import.meta.vitest
|
|
6267
|
+
* import { Channel, Data, Effect } from "effect"
|
|
6313
6268
|
*
|
|
6314
6269
|
* class CountError extends Data.TaggedError("CountError")<{
|
|
6315
6270
|
* readonly reason: string
|
|
@@ -6321,10 +6276,10 @@ export declare const bindTo: {
|
|
|
6321
6276
|
* // Count the elements
|
|
6322
6277
|
* const countEffect = Channel.runCount(numbersChannel)
|
|
6323
6278
|
*
|
|
6324
|
-
*
|
|
6279
|
+
* Effect.runSync(countEffect) // => 5
|
|
6325
6280
|
* ```
|
|
6326
6281
|
*
|
|
6327
|
-
* @category
|
|
6282
|
+
* @category running
|
|
6328
6283
|
* @since 4.0.0
|
|
6329
6284
|
*/
|
|
6330
6285
|
export declare const runCount: <OutElem, OutErr, OutDone, Env>(self: Channel<OutElem, OutErr, OutDone, unknown, unknown, unknown, Env>) => Effect.Effect<void, OutErr, Env>;
|
|
@@ -6333,8 +6288,8 @@ export declare const runCount: <OutElem, OutErr, OutDone, Env>(self: Channel<Out
|
|
|
6333
6288
|
*
|
|
6334
6289
|
* **Example** (Draining channel output at runtime)
|
|
6335
6290
|
*
|
|
6336
|
-
* ```ts
|
|
6337
|
-
* import { Channel, Data } from "effect"
|
|
6291
|
+
* ```ts import.meta.vitest
|
|
6292
|
+
* import { Channel, Data, Effect } from "effect"
|
|
6338
6293
|
*
|
|
6339
6294
|
* class DrainError extends Data.TaggedError("DrainError")<{
|
|
6340
6295
|
* readonly stage: string
|
|
@@ -6342,18 +6297,15 @@ export declare const runCount: <OutElem, OutErr, OutDone, Env>(self: Channel<Out
|
|
|
6342
6297
|
*
|
|
6343
6298
|
* // Create a channel that outputs elements and completes with a result
|
|
6344
6299
|
* const resultChannel = Channel.fromIterable([1, 2, 3])
|
|
6345
|
-
* const completedChannel = Channel.
|
|
6346
|
-
* resultChannel,
|
|
6347
|
-
* () => Channel.succeed("completed")
|
|
6348
|
-
* )
|
|
6300
|
+
* const completedChannel = Channel.concat(resultChannel, Channel.end("completed"))
|
|
6349
6301
|
*
|
|
6350
6302
|
* // Drain all elements and get only the final result
|
|
6351
6303
|
* const drainEffect = Channel.runDrain(completedChannel)
|
|
6352
6304
|
*
|
|
6353
|
-
*
|
|
6305
|
+
* Effect.runSync(drainEffect) // => "completed"
|
|
6354
6306
|
* ```
|
|
6355
6307
|
*
|
|
6356
|
-
* @category
|
|
6308
|
+
* @category running
|
|
6357
6309
|
* @since 2.0.0
|
|
6358
6310
|
*/
|
|
6359
6311
|
export declare const runDrain: <OutElem, OutErr, OutDone, Env>(self: Channel<OutElem, OutErr, OutDone, unknown, unknown, unknown, Env>) => Effect.Effect<OutDone, OutErr, Env>;
|
|
@@ -6362,8 +6314,8 @@ export declare const runDrain: <OutElem, OutErr, OutDone, Env>(self: Channel<Out
|
|
|
6362
6314
|
*
|
|
6363
6315
|
* **Example** (Running effects for each output)
|
|
6364
6316
|
*
|
|
6365
|
-
* ```ts
|
|
6366
|
-
* import { Channel,
|
|
6317
|
+
* ```ts import.meta.vitest
|
|
6318
|
+
* import { Channel, Data, Effect } from "effect"
|
|
6367
6319
|
*
|
|
6368
6320
|
* class ForEachError extends Data.TaggedError("ForEachError")<{
|
|
6369
6321
|
* readonly element: unknown
|
|
@@ -6372,16 +6324,18 @@ export declare const runDrain: <OutElem, OutErr, OutDone, Env>(self: Channel<Out
|
|
|
6372
6324
|
* // Create a channel with numbers
|
|
6373
6325
|
* const numbersChannel = Channel.fromIterable([1, 2, 3])
|
|
6374
6326
|
*
|
|
6375
|
-
* // Run forEach to
|
|
6327
|
+
* // Run forEach to process each element
|
|
6328
|
+
* const processed: Array<number> = []
|
|
6376
6329
|
* const forEachEffect = Channel.runForEach(
|
|
6377
6330
|
* numbersChannel,
|
|
6378
|
-
* (n) =>
|
|
6331
|
+
* (n) => Effect.sync(() => processed.push(n))
|
|
6379
6332
|
* )
|
|
6380
6333
|
*
|
|
6381
|
-
*
|
|
6334
|
+
* await Effect.runPromise(forEachEffect)
|
|
6335
|
+
* processed // => [1, 2, 3]
|
|
6382
6336
|
* ```
|
|
6383
6337
|
*
|
|
6384
|
-
* @category
|
|
6338
|
+
* @category running
|
|
6385
6339
|
* @since 4.0.0
|
|
6386
6340
|
*/
|
|
6387
6341
|
export declare const runForEach: {
|
|
@@ -6390,8 +6344,8 @@ export declare const runForEach: {
|
|
|
6390
6344
|
*
|
|
6391
6345
|
* **Example** (Running effects for each output)
|
|
6392
6346
|
*
|
|
6393
|
-
* ```ts
|
|
6394
|
-
* import { Channel,
|
|
6347
|
+
* ```ts import.meta.vitest
|
|
6348
|
+
* import { Channel, Data, Effect } from "effect"
|
|
6395
6349
|
*
|
|
6396
6350
|
* class ForEachError extends Data.TaggedError("ForEachError")<{
|
|
6397
6351
|
* readonly element: unknown
|
|
@@ -6400,16 +6354,18 @@ export declare const runForEach: {
|
|
|
6400
6354
|
* // Create a channel with numbers
|
|
6401
6355
|
* const numbersChannel = Channel.fromIterable([1, 2, 3])
|
|
6402
6356
|
*
|
|
6403
|
-
* // Run forEach to
|
|
6357
|
+
* // Run forEach to process each element
|
|
6358
|
+
* const processed: Array<number> = []
|
|
6404
6359
|
* const forEachEffect = Channel.runForEach(
|
|
6405
6360
|
* numbersChannel,
|
|
6406
|
-
* (n) =>
|
|
6361
|
+
* (n) => Effect.sync(() => processed.push(n))
|
|
6407
6362
|
* )
|
|
6408
6363
|
*
|
|
6409
|
-
*
|
|
6364
|
+
* await Effect.runPromise(forEachEffect)
|
|
6365
|
+
* processed // => [1, 2, 3]
|
|
6410
6366
|
* ```
|
|
6411
6367
|
*
|
|
6412
|
-
* @category
|
|
6368
|
+
* @category running
|
|
6413
6369
|
* @since 4.0.0
|
|
6414
6370
|
*/
|
|
6415
6371
|
<OutElem, EX, RX>(f: (o: OutElem) => Effect.Effect<void, EX, RX>): <OutErr, OutDone, Env>(self: Channel<OutElem, OutErr, OutDone, unknown, unknown, unknown, Env>) => Effect.Effect<OutDone, OutErr | EX, Env | RX>;
|
|
@@ -6418,8 +6374,8 @@ export declare const runForEach: {
|
|
|
6418
6374
|
*
|
|
6419
6375
|
* **Example** (Running effects for each output)
|
|
6420
6376
|
*
|
|
6421
|
-
* ```ts
|
|
6422
|
-
* import { Channel,
|
|
6377
|
+
* ```ts import.meta.vitest
|
|
6378
|
+
* import { Channel, Data, Effect } from "effect"
|
|
6423
6379
|
*
|
|
6424
6380
|
* class ForEachError extends Data.TaggedError("ForEachError")<{
|
|
6425
6381
|
* readonly element: unknown
|
|
@@ -6428,16 +6384,18 @@ export declare const runForEach: {
|
|
|
6428
6384
|
* // Create a channel with numbers
|
|
6429
6385
|
* const numbersChannel = Channel.fromIterable([1, 2, 3])
|
|
6430
6386
|
*
|
|
6431
|
-
* // Run forEach to
|
|
6387
|
+
* // Run forEach to process each element
|
|
6388
|
+
* const processed: Array<number> = []
|
|
6432
6389
|
* const forEachEffect = Channel.runForEach(
|
|
6433
6390
|
* numbersChannel,
|
|
6434
|
-
* (n) =>
|
|
6391
|
+
* (n) => Effect.sync(() => processed.push(n))
|
|
6435
6392
|
* )
|
|
6436
6393
|
*
|
|
6437
|
-
*
|
|
6394
|
+
* await Effect.runPromise(forEachEffect)
|
|
6395
|
+
* processed // => [1, 2, 3]
|
|
6438
6396
|
* ```
|
|
6439
6397
|
*
|
|
6440
|
-
* @category
|
|
6398
|
+
* @category running
|
|
6441
6399
|
* @since 4.0.0
|
|
6442
6400
|
*/
|
|
6443
6401
|
<OutElem, OutErr, OutDone, Env, EX, RX>(self: Channel<OutElem, OutErr, OutDone, unknown, unknown, unknown, Env>, f: (o: OutElem) => Effect.Effect<void, EX, RX>): Effect.Effect<OutDone, OutErr | EX, Env | RX>;
|
|
@@ -6451,7 +6409,7 @@ export declare const runForEach: {
|
|
|
6451
6409
|
* Returning `true` continues consuming the channel. Returning `false` stops
|
|
6452
6410
|
* consumption early. The returned effect completes with `void`.
|
|
6453
6411
|
*
|
|
6454
|
-
* @category
|
|
6412
|
+
* @category running
|
|
6455
6413
|
* @since 4.0.0
|
|
6456
6414
|
*/
|
|
6457
6415
|
export declare const runForEachWhile: {
|
|
@@ -6464,7 +6422,7 @@ export declare const runForEachWhile: {
|
|
|
6464
6422
|
* Returning `true` continues consuming the channel. Returning `false` stops
|
|
6465
6423
|
* consumption early. The returned effect completes with `void`.
|
|
6466
6424
|
*
|
|
6467
|
-
* @category
|
|
6425
|
+
* @category running
|
|
6468
6426
|
* @since 4.0.0
|
|
6469
6427
|
*/
|
|
6470
6428
|
<OutElem, EX, RX>(f: (o: OutElem) => Effect.Effect<boolean, EX, RX>): <OutErr, OutDone, Env>(self: Channel<OutElem, OutErr, OutDone, unknown, unknown, unknown, Env>) => Effect.Effect<void, OutErr | EX, Env | RX>;
|
|
@@ -6477,7 +6435,7 @@ export declare const runForEachWhile: {
|
|
|
6477
6435
|
* Returning `true` continues consuming the channel. Returning `false` stops
|
|
6478
6436
|
* consumption early. The returned effect completes with `void`.
|
|
6479
6437
|
*
|
|
6480
|
-
* @category
|
|
6438
|
+
* @category running
|
|
6481
6439
|
* @since 4.0.0
|
|
6482
6440
|
*/
|
|
6483
6441
|
<OutElem, OutErr, OutDone, Env, EX, RX>(self: Channel<OutElem, OutErr, OutDone, unknown, unknown, unknown, Env>, f: (o: OutElem) => Effect.Effect<boolean, EX, RX>): Effect.Effect<void, OutErr | EX, Env | RX>;
|
|
@@ -6487,8 +6445,8 @@ export declare const runForEachWhile: {
|
|
|
6487
6445
|
*
|
|
6488
6446
|
* **Example** (Collecting channel output)
|
|
6489
6447
|
*
|
|
6490
|
-
* ```ts
|
|
6491
|
-
* import { Channel, Data } from "effect"
|
|
6448
|
+
* ```ts import.meta.vitest
|
|
6449
|
+
* import { Channel, Data, Effect } from "effect"
|
|
6492
6450
|
*
|
|
6493
6451
|
* class CollectError extends Data.TaggedError("CollectError")<{
|
|
6494
6452
|
* readonly reason: string
|
|
@@ -6500,17 +6458,17 @@ export declare const runForEachWhile: {
|
|
|
6500
6458
|
* // Collect all elements into an array
|
|
6501
6459
|
* const collectEffect = Channel.runCollect(numbersChannel)
|
|
6502
6460
|
*
|
|
6503
|
-
*
|
|
6461
|
+
* Effect.runSync(collectEffect) // => [1, 2, 3, 4, 5]
|
|
6504
6462
|
* ```
|
|
6505
6463
|
*
|
|
6506
|
-
* @category
|
|
6464
|
+
* @category running
|
|
6507
6465
|
* @since 2.0.0
|
|
6508
6466
|
*/
|
|
6509
6467
|
export declare const runCollect: <OutElem, OutErr, OutDone, Env>(self: Channel<OutElem, OutErr, OutDone, unknown, unknown, unknown, Env>) => Effect.Effect<Array<OutElem>, OutErr, Env>;
|
|
6510
6468
|
/**
|
|
6511
6469
|
* Runs a channel and outputs the done value.
|
|
6512
6470
|
*
|
|
6513
|
-
* @category
|
|
6471
|
+
* @category running
|
|
6514
6472
|
* @since 4.0.0
|
|
6515
6473
|
*/
|
|
6516
6474
|
export declare const runDone: <OutElem, OutErr, OutDone, Env>(self: Channel<OutElem, OutErr, OutDone, unknown, unknown, unknown, Env>) => Effect.Effect<OutDone, OutErr, Env>;
|
|
@@ -6523,7 +6481,7 @@ export declare const runDone: <OutElem, OutErr, OutDone, Env>(self: Channel<OutE
|
|
|
6523
6481
|
* Returns `Option.some` with the first output element, or `Option.none` if the
|
|
6524
6482
|
* channel completes without emitting output.
|
|
6525
6483
|
*
|
|
6526
|
-
* @category
|
|
6484
|
+
* @category running
|
|
6527
6485
|
* @since 4.0.0
|
|
6528
6486
|
*/
|
|
6529
6487
|
export declare const runHead: <OutElem, OutErr, OutDone, Env>(self: Channel<OutElem, OutErr, OutDone, unknown, unknown, unknown, Env>) => Effect.Effect<Option.Option<OutElem>, OutErr, Env>;
|
|
@@ -6536,7 +6494,7 @@ export declare const runHead: <OutElem, OutErr, OutDone, Env>(self: Channel<OutE
|
|
|
6536
6494
|
* Returns `Option.some` with the last emitted element, or `Option.none` if the
|
|
6537
6495
|
* channel completes without emitting output.
|
|
6538
6496
|
*
|
|
6539
|
-
* @category
|
|
6497
|
+
* @category running
|
|
6540
6498
|
* @since 4.0.0
|
|
6541
6499
|
*/
|
|
6542
6500
|
export declare const runLast: <OutElem, OutErr, OutDone, Env>(self: Channel<OutElem, OutErr, OutDone, unknown, unknown, unknown, Env>) => Effect.Effect<Option.Option<OutElem>, OutErr, Env>;
|
|
@@ -6545,8 +6503,8 @@ export declare const runLast: <OutElem, OutErr, OutDone, Env>(self: Channel<OutE
|
|
|
6545
6503
|
*
|
|
6546
6504
|
* **Example** (Folding channel output)
|
|
6547
6505
|
*
|
|
6548
|
-
* ```ts
|
|
6549
|
-
* import { Channel, Data } from "effect"
|
|
6506
|
+
* ```ts import.meta.vitest
|
|
6507
|
+
* import { Channel, Data, Effect } from "effect"
|
|
6550
6508
|
*
|
|
6551
6509
|
* class FoldError extends Data.TaggedError("FoldError")<{
|
|
6552
6510
|
* readonly operation: string
|
|
@@ -6558,10 +6516,10 @@ export declare const runLast: <OutElem, OutErr, OutDone, Env>(self: Channel<OutE
|
|
|
6558
6516
|
* // Fold to calculate sum
|
|
6559
6517
|
* const sumEffect = Channel.runFold(numbersChannel, () => 0, (acc, n) => acc + n)
|
|
6560
6518
|
*
|
|
6561
|
-
*
|
|
6519
|
+
* Effect.runSync(sumEffect) // => 15
|
|
6562
6520
|
* ```
|
|
6563
6521
|
*
|
|
6564
|
-
* @category
|
|
6522
|
+
* @category running
|
|
6565
6523
|
* @since 4.0.0
|
|
6566
6524
|
*/
|
|
6567
6525
|
export declare const runFold: {
|
|
@@ -6570,8 +6528,8 @@ export declare const runFold: {
|
|
|
6570
6528
|
*
|
|
6571
6529
|
* **Example** (Folding channel output)
|
|
6572
6530
|
*
|
|
6573
|
-
* ```ts
|
|
6574
|
-
* import { Channel, Data } from "effect"
|
|
6531
|
+
* ```ts import.meta.vitest
|
|
6532
|
+
* import { Channel, Data, Effect } from "effect"
|
|
6575
6533
|
*
|
|
6576
6534
|
* class FoldError extends Data.TaggedError("FoldError")<{
|
|
6577
6535
|
* readonly operation: string
|
|
@@ -6583,10 +6541,10 @@ export declare const runFold: {
|
|
|
6583
6541
|
* // Fold to calculate sum
|
|
6584
6542
|
* const sumEffect = Channel.runFold(numbersChannel, () => 0, (acc, n) => acc + n)
|
|
6585
6543
|
*
|
|
6586
|
-
*
|
|
6544
|
+
* Effect.runSync(sumEffect) // => 15
|
|
6587
6545
|
* ```
|
|
6588
6546
|
*
|
|
6589
|
-
* @category
|
|
6547
|
+
* @category running
|
|
6590
6548
|
* @since 4.0.0
|
|
6591
6549
|
*/
|
|
6592
6550
|
<Z, OutElem>(initial: LazyArg<Z>, f: (acc: Z, o: OutElem) => Z): <OutErr, OutDone, Env>(self: Channel<OutElem, OutErr, OutDone, unknown, unknown, unknown, Env>) => Effect.Effect<Z, OutErr, Env>;
|
|
@@ -6595,8 +6553,8 @@ export declare const runFold: {
|
|
|
6595
6553
|
*
|
|
6596
6554
|
* **Example** (Folding channel output)
|
|
6597
6555
|
*
|
|
6598
|
-
* ```ts
|
|
6599
|
-
* import { Channel, Data } from "effect"
|
|
6556
|
+
* ```ts import.meta.vitest
|
|
6557
|
+
* import { Channel, Data, Effect } from "effect"
|
|
6600
6558
|
*
|
|
6601
6559
|
* class FoldError extends Data.TaggedError("FoldError")<{
|
|
6602
6560
|
* readonly operation: string
|
|
@@ -6608,10 +6566,10 @@ export declare const runFold: {
|
|
|
6608
6566
|
* // Fold to calculate sum
|
|
6609
6567
|
* const sumEffect = Channel.runFold(numbersChannel, () => 0, (acc, n) => acc + n)
|
|
6610
6568
|
*
|
|
6611
|
-
*
|
|
6569
|
+
* Effect.runSync(sumEffect) // => 15
|
|
6612
6570
|
* ```
|
|
6613
6571
|
*
|
|
6614
|
-
* @category
|
|
6572
|
+
* @category running
|
|
6615
6573
|
* @since 4.0.0
|
|
6616
6574
|
*/
|
|
6617
6575
|
<OutElem, OutErr, OutDone, Env, Z>(self: Channel<OutElem, OutErr, OutDone, unknown, unknown, unknown, Env>, initial: LazyArg<Z>, f: (acc: Z, o: OutElem) => Z): Effect.Effect<Z, OutErr, Env>;
|
|
@@ -6630,7 +6588,7 @@ export declare const runFold: {
|
|
|
6630
6588
|
* the effectful accumulator function. The returned effect succeeds with the
|
|
6631
6589
|
* final accumulator value.
|
|
6632
6590
|
*
|
|
6633
|
-
* @category
|
|
6591
|
+
* @category running
|
|
6634
6592
|
* @since 4.0.0
|
|
6635
6593
|
*/
|
|
6636
6594
|
export declare const runFoldEffect: {
|
|
@@ -6648,7 +6606,7 @@ export declare const runFoldEffect: {
|
|
|
6648
6606
|
* the effectful accumulator function. The returned effect succeeds with the
|
|
6649
6607
|
* final accumulator value.
|
|
6650
6608
|
*
|
|
6651
|
-
* @category
|
|
6609
|
+
* @category running
|
|
6652
6610
|
* @since 4.0.0
|
|
6653
6611
|
*/
|
|
6654
6612
|
<OutElem, Z, E, R>(initial: LazyArg<Z>, f: (acc: Z, o: OutElem) => Effect.Effect<Z, E, R>): <OutErr, OutDone, Env>(self: Channel<OutElem, OutErr, OutDone, unknown, unknown, unknown, Env>) => Effect.Effect<Z, OutErr | E, Env | R>;
|
|
@@ -6666,7 +6624,7 @@ export declare const runFoldEffect: {
|
|
|
6666
6624
|
* the effectful accumulator function. The returned effect succeeds with the
|
|
6667
6625
|
* final accumulator value.
|
|
6668
6626
|
*
|
|
6669
|
-
* @category
|
|
6627
|
+
* @category running
|
|
6670
6628
|
* @since 4.0.0
|
|
6671
6629
|
*/
|
|
6672
6630
|
<OutElem, OutErr, OutDone, Env, Z, E, R>(self: Channel<OutElem, OutErr, OutDone, unknown, unknown, unknown, Env>, initial: LazyArg<Z>, f: (acc: Z, o: OutElem) => Effect.Effect<Z, E, R>): Effect.Effect<Z, OutErr | E, Env | R>;
|
|
@@ -6682,7 +6640,7 @@ export declare const runFoldEffect: {
|
|
|
6682
6640
|
*
|
|
6683
6641
|
* **Example** (Converting channels to pulls)
|
|
6684
6642
|
*
|
|
6685
|
-
* ```ts
|
|
6643
|
+
* ```ts import.meta.vitest
|
|
6686
6644
|
* import { Channel, Data, Effect } from "effect"
|
|
6687
6645
|
*
|
|
6688
6646
|
* class PullError extends Data.TaggedError("PullError")<{
|
|
@@ -6692,12 +6650,11 @@ export declare const runFoldEffect: {
|
|
|
6692
6650
|
* // Create a channel
|
|
6693
6651
|
* const numbersChannel = Channel.fromIterable([1, 2, 3])
|
|
6694
6652
|
*
|
|
6695
|
-
*
|
|
6696
|
-
*
|
|
6697
|
-
*
|
|
6698
|
-
* )
|
|
6699
|
-
*
|
|
6700
|
-
* // Use the Pull to manually consume elements
|
|
6653
|
+
* const program = Effect.scoped(Effect.gen(function*() {
|
|
6654
|
+
* const pull = yield* Channel.toPull(numbersChannel)
|
|
6655
|
+
* return [yield* pull, yield* pull, yield* pull]
|
|
6656
|
+
* }))
|
|
6657
|
+
* await Effect.runPromise(program) // => [1, 2, 3]
|
|
6701
6658
|
* ```
|
|
6702
6659
|
*
|
|
6703
6660
|
* @category destructors
|
|
@@ -6709,7 +6666,7 @@ export declare const toPull: <OutElem, OutErr, OutDone, Env>(self: Channel<OutEl
|
|
|
6709
6666
|
*
|
|
6710
6667
|
* **Example** (Converting channels to scoped pulls)
|
|
6711
6668
|
*
|
|
6712
|
-
* ```ts
|
|
6669
|
+
* ```ts import.meta.vitest
|
|
6713
6670
|
* import { Channel, Data, Effect, Scope } from "effect"
|
|
6714
6671
|
*
|
|
6715
6672
|
* class ScopedPullError extends Data.TaggedError("ScopedPullError")<{
|
|
@@ -6721,10 +6678,11 @@ export declare const toPull: <OutElem, OutErr, OutDone, Env>(self: Channel<OutEl
|
|
|
6721
6678
|
*
|
|
6722
6679
|
* // Convert to Pull with explicit scope
|
|
6723
6680
|
* const scopedPullEffect = Effect.gen(function*() {
|
|
6724
|
-
* const scope = yield*
|
|
6681
|
+
* const scope = yield* Effect.scope
|
|
6725
6682
|
* const pull = yield* Channel.toPullScoped(numbersChannel, scope)
|
|
6726
|
-
* return pull
|
|
6683
|
+
* return [yield* pull, yield* pull, yield* pull]
|
|
6727
6684
|
* })
|
|
6685
|
+
* await Effect.runPromise(Effect.scoped(scopedPullEffect)) // => [1, 2, 3]
|
|
6728
6686
|
* ```
|
|
6729
6687
|
*
|
|
6730
6688
|
* @category destructors
|
|
@@ -6826,8 +6784,8 @@ export declare const runIntoQueueArray: {
|
|
|
6826
6784
|
*
|
|
6827
6785
|
* **Example** (Converting channels to queues)
|
|
6828
6786
|
*
|
|
6829
|
-
* ```ts
|
|
6830
|
-
* import { Channel, Data } from "effect"
|
|
6787
|
+
* ```ts import.meta.vitest
|
|
6788
|
+
* import { Channel, Data, Effect, Queue } from "effect"
|
|
6831
6789
|
*
|
|
6832
6790
|
* class QueueError extends Data.TaggedError("QueueError")<{
|
|
6833
6791
|
* readonly operation: string
|
|
@@ -6837,10 +6795,11 @@ export declare const runIntoQueueArray: {
|
|
|
6837
6795
|
* const dataChannel = Channel.fromIterable([1, 2, 3, 4, 5])
|
|
6838
6796
|
*
|
|
6839
6797
|
* // Convert to queue for concurrent processing
|
|
6840
|
-
* const
|
|
6841
|
-
*
|
|
6842
|
-
*
|
|
6843
|
-
*
|
|
6798
|
+
* const program = Effect.scoped(Effect.gen(function*() {
|
|
6799
|
+
* const queue = yield* Channel.toQueue(dataChannel, { capacity: 32 })
|
|
6800
|
+
* return yield* Queue.takeBetween(queue, 5, 5)
|
|
6801
|
+
* }))
|
|
6802
|
+
* await Effect.runPromise(program) // => [1, 2, 3, 4, 5]
|
|
6844
6803
|
* ```
|
|
6845
6804
|
*
|
|
6846
6805
|
* @category destructors
|
|
@@ -6859,8 +6818,8 @@ export declare const toQueue: {
|
|
|
6859
6818
|
*
|
|
6860
6819
|
* **Example** (Converting channels to queues)
|
|
6861
6820
|
*
|
|
6862
|
-
* ```ts
|
|
6863
|
-
* import { Channel, Data } from "effect"
|
|
6821
|
+
* ```ts import.meta.vitest
|
|
6822
|
+
* import { Channel, Data, Effect, Queue } from "effect"
|
|
6864
6823
|
*
|
|
6865
6824
|
* class QueueError extends Data.TaggedError("QueueError")<{
|
|
6866
6825
|
* readonly operation: string
|
|
@@ -6870,10 +6829,11 @@ export declare const toQueue: {
|
|
|
6870
6829
|
* const dataChannel = Channel.fromIterable([1, 2, 3, 4, 5])
|
|
6871
6830
|
*
|
|
6872
6831
|
* // Convert to queue for concurrent processing
|
|
6873
|
-
* const
|
|
6874
|
-
*
|
|
6875
|
-
*
|
|
6876
|
-
*
|
|
6832
|
+
* const program = Effect.scoped(Effect.gen(function*() {
|
|
6833
|
+
* const queue = yield* Channel.toQueue(dataChannel, { capacity: 32 })
|
|
6834
|
+
* return yield* Queue.takeBetween(queue, 5, 5)
|
|
6835
|
+
* }))
|
|
6836
|
+
* await Effect.runPromise(program) // => [1, 2, 3, 4, 5]
|
|
6877
6837
|
* ```
|
|
6878
6838
|
*
|
|
6879
6839
|
* @category destructors
|
|
@@ -6897,8 +6857,8 @@ export declare const toQueue: {
|
|
|
6897
6857
|
*
|
|
6898
6858
|
* **Example** (Converting channels to queues)
|
|
6899
6859
|
*
|
|
6900
|
-
* ```ts
|
|
6901
|
-
* import { Channel, Data } from "effect"
|
|
6860
|
+
* ```ts import.meta.vitest
|
|
6861
|
+
* import { Channel, Data, Effect, Queue } from "effect"
|
|
6902
6862
|
*
|
|
6903
6863
|
* class QueueError extends Data.TaggedError("QueueError")<{
|
|
6904
6864
|
* readonly operation: string
|
|
@@ -6908,10 +6868,11 @@ export declare const toQueue: {
|
|
|
6908
6868
|
* const dataChannel = Channel.fromIterable([1, 2, 3, 4, 5])
|
|
6909
6869
|
*
|
|
6910
6870
|
* // Convert to queue for concurrent processing
|
|
6911
|
-
* const
|
|
6912
|
-
*
|
|
6913
|
-
*
|
|
6914
|
-
*
|
|
6871
|
+
* const program = Effect.scoped(Effect.gen(function*() {
|
|
6872
|
+
* const queue = yield* Channel.toQueue(dataChannel, { capacity: 32 })
|
|
6873
|
+
* return yield* Queue.takeBetween(queue, 5, 5)
|
|
6874
|
+
* }))
|
|
6875
|
+
* await Effect.runPromise(program) // => [1, 2, 3, 4, 5]
|
|
6915
6876
|
* ```
|
|
6916
6877
|
*
|
|
6917
6878
|
* @category destructors
|