effect 4.0.0-beta.66 → 4.0.0-beta.68
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 +151 -106
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +50 -40
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +620 -553
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +298 -254
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts +342 -274
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +168 -126
- package/dist/BigInt.js.map +1 -1
- package/dist/Boolean.d.ts +189 -156
- package/dist/Boolean.d.ts.map +1 -1
- package/dist/Boolean.js +85 -68
- package/dist/Boolean.js.map +1 -1
- package/dist/Brand.d.ts +30 -5
- package/dist/Brand.d.ts.map +1 -1
- package/dist/Brand.js +19 -2
- package/dist/Brand.js.map +1 -1
- package/dist/Cache.d.ts +239 -135
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +135 -59
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +84 -73
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Cause.js +51 -44
- package/dist/Cause.js.map +1 -1
- package/dist/Channel.d.ts +1568 -632
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +685 -315
- package/dist/Channel.js.map +1 -1
- package/dist/ChannelSchema.d.ts +119 -10
- package/dist/ChannelSchema.d.ts.map +1 -1
- package/dist/ChannelSchema.js +45 -6
- package/dist/ChannelSchema.js.map +1 -1
- package/dist/Chunk.d.ts +574 -428
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +250 -191
- package/dist/Chunk.js.map +1 -1
- package/dist/Clock.d.ts +16 -9
- package/dist/Clock.d.ts.map +1 -1
- package/dist/Clock.js +9 -5
- package/dist/Clock.js.map +1 -1
- package/dist/Combiner.d.ts +11 -5
- package/dist/Combiner.d.ts.map +1 -1
- package/dist/Combiner.js +10 -4
- package/dist/Combiner.js.map +1 -1
- package/dist/Config.d.ts +80 -68
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +53 -49
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +33 -32
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +19 -18
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Console.d.ts +76 -50
- package/dist/Console.d.ts.map +1 -1
- package/dist/Console.js +69 -46
- package/dist/Console.js.map +1 -1
- package/dist/Context.d.ts +400 -189
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js +143 -77
- package/dist/Context.js.map +1 -1
- package/dist/Cron.d.ts +67 -48
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +94 -36
- package/dist/Cron.js.map +1 -1
- package/dist/Crypto.d.ts +208 -0
- package/dist/Crypto.d.ts.map +1 -0
- package/dist/Crypto.js +157 -0
- package/dist/Crypto.js.map +1 -0
- package/dist/Data.d.ts +9 -3
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js.map +1 -1
- package/dist/DateTime.d.ts +893 -464
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +387 -228
- package/dist/DateTime.js.map +1 -1
- package/dist/Deferred.d.ts +367 -175
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +146 -72
- package/dist/Deferred.js.map +1 -1
- package/dist/Differ.d.ts +44 -2
- package/dist/Differ.d.ts.map +1 -1
- package/dist/Differ.js +36 -0
- package/dist/Duration.d.ts +333 -186
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +178 -107
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +2181 -2275
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +935 -850
- package/dist/Effect.js.map +1 -1
- package/dist/Effectable.d.ts +38 -3
- package/dist/Effectable.d.ts.map +1 -1
- package/dist/Effectable.js +3 -3
- package/dist/Effectable.js.map +1 -1
- package/dist/Encoding.d.ts +78 -28
- package/dist/Encoding.d.ts.map +1 -1
- package/dist/Encoding.js +75 -27
- package/dist/Encoding.js.map +1 -1
- package/dist/Equal.d.ts +4 -3
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +4 -3
- package/dist/Equal.js.map +1 -1
- package/dist/Equivalence.d.ts +18 -24
- package/dist/Equivalence.d.ts.map +1 -1
- package/dist/Equivalence.js +16 -21
- package/dist/Equivalence.js.map +1 -1
- package/dist/ErrorReporter.d.ts +66 -82
- package/dist/ErrorReporter.d.ts.map +1 -1
- package/dist/ErrorReporter.js +38 -29
- package/dist/ErrorReporter.js.map +1 -1
- package/dist/ExecutionPlan.d.ts +106 -12
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/ExecutionPlan.js +23 -6
- package/dist/ExecutionPlan.js.map +1 -1
- package/dist/Exit.d.ts +6 -5
- package/dist/Exit.d.ts.map +1 -1
- package/dist/Exit.js.map +1 -1
- package/dist/Fiber.d.ts +71 -40
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js +39 -21
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.d.ts +118 -57
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +121 -39
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +287 -159
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +175 -73
- package/dist/FiberMap.js.map +1 -1
- package/dist/FiberSet.d.ts +93 -52
- package/dist/FiberSet.d.ts.map +1 -1
- package/dist/FiberSet.js +97 -34
- package/dist/FiberSet.js.map +1 -1
- package/dist/FileSystem.d.ts +102 -73
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +53 -39
- package/dist/FileSystem.js.map +1 -1
- package/dist/Filter.d.ts +166 -88
- package/dist/Filter.d.ts.map +1 -1
- package/dist/Filter.js +68 -42
- package/dist/Filter.js.map +1 -1
- package/dist/Formatter.d.ts +4 -2
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js +3 -69
- package/dist/Formatter.js.map +1 -1
- package/dist/Function.d.ts +218 -151
- package/dist/Function.d.ts.map +1 -1
- package/dist/Function.js +94 -78
- package/dist/Function.js.map +1 -1
- package/dist/Graph.d.ts +714 -415
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +325 -182
- package/dist/Graph.js.map +1 -1
- package/dist/HKT.d.ts +29 -13
- package/dist/HKT.d.ts.map +1 -1
- package/dist/Hash.d.ts +35 -24
- package/dist/Hash.d.ts.map +1 -1
- package/dist/Hash.js +27 -17
- package/dist/Hash.js.map +1 -1
- package/dist/HashMap.d.ts +540 -388
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashMap.js +262 -156
- package/dist/HashMap.js.map +1 -1
- package/dist/HashRing.d.ts +53 -34
- package/dist/HashRing.d.ts.map +1 -1
- package/dist/HashRing.js +83 -16
- package/dist/HashRing.js.map +1 -1
- package/dist/HashSet.d.ts +239 -153
- package/dist/HashSet.d.ts.map +1 -1
- package/dist/HashSet.js +110 -56
- package/dist/HashSet.js.map +1 -1
- package/dist/Inspectable.d.ts +26 -13
- package/dist/Inspectable.d.ts.map +1 -1
- package/dist/Inspectable.js +22 -10
- package/dist/Inspectable.js.map +1 -1
- package/dist/Iterable.d.ts +336 -222
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +146 -100
- package/dist/Iterable.js.map +1 -1
- package/dist/JsonPatch.d.ts +12 -9
- package/dist/JsonPatch.d.ts.map +1 -1
- package/dist/JsonPatch.js +9 -6
- package/dist/JsonPatch.js.map +1 -1
- package/dist/JsonPointer.d.ts +13 -11
- package/dist/JsonPointer.d.ts.map +1 -1
- package/dist/JsonPointer.js +13 -11
- package/dist/JsonPointer.js.map +1 -1
- package/dist/JsonSchema.d.ts +16 -0
- package/dist/JsonSchema.d.ts.map +1 -1
- package/dist/JsonSchema.js +10 -0
- package/dist/JsonSchema.js.map +1 -1
- package/dist/Latch.d.ts +97 -26
- package/dist/Latch.d.ts.map +1 -1
- package/dist/Latch.js +39 -20
- package/dist/Latch.js.map +1 -1
- package/dist/Layer.d.ts +472 -410
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +290 -226
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +99 -26
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +58 -14
- package/dist/LayerMap.js.map +1 -1
- package/dist/LogLevel.d.ts +92 -131
- package/dist/LogLevel.d.ts.map +1 -1
- package/dist/LogLevel.js +25 -15
- package/dist/LogLevel.js.map +1 -1
- package/dist/Logger.d.ts +159 -104
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +215 -189
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.d.ts +78 -19
- package/dist/ManagedRuntime.d.ts.map +1 -1
- package/dist/ManagedRuntime.js +24 -17
- package/dist/ManagedRuntime.js.map +1 -1
- package/dist/Match.d.ts +135 -161
- package/dist/Match.d.ts.map +1 -1
- package/dist/Match.js +86 -78
- package/dist/Match.js.map +1 -1
- package/dist/Metric.d.ts +330 -291
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +219 -214
- package/dist/Metric.js.map +1 -1
- package/dist/MutableHashMap.d.ts +146 -87
- package/dist/MutableHashMap.d.ts.map +1 -1
- package/dist/MutableHashMap.js +67 -43
- package/dist/MutableHashMap.js.map +1 -1
- package/dist/MutableHashSet.d.ts +52 -30
- package/dist/MutableHashSet.d.ts.map +1 -1
- package/dist/MutableHashSet.js +92 -38
- package/dist/MutableHashSet.js.map +1 -1
- package/dist/MutableList.d.ts +110 -68
- package/dist/MutableList.d.ts.map +1 -1
- package/dist/MutableList.js +135 -85
- package/dist/MutableList.js.map +1 -1
- package/dist/MutableRef.d.ts +99 -62
- package/dist/MutableRef.d.ts.map +1 -1
- package/dist/MutableRef.js +78 -60
- package/dist/MutableRef.js.map +1 -1
- package/dist/Newtype.d.ts +15 -2
- package/dist/Newtype.d.ts.map +1 -1
- package/dist/Newtype.js +8 -2
- package/dist/Newtype.js.map +1 -1
- package/dist/NonEmptyIterable.d.ts +38 -48
- package/dist/NonEmptyIterable.d.ts.map +1 -1
- package/dist/NonEmptyIterable.js +34 -25
- package/dist/NonEmptyIterable.js.map +1 -1
- package/dist/Number.d.ts +261 -205
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +119 -91
- package/dist/Number.js.map +1 -1
- package/dist/Optic.d.ts +6 -7
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js +5 -6
- package/dist/Optic.js.map +1 -1
- package/dist/Option.d.ts +133 -156
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +64 -64
- package/dist/Option.js.map +1 -1
- package/dist/Order.d.ts +6 -6
- package/dist/Order.js +6 -6
- package/dist/Ordering.d.ts +56 -45
- package/dist/Ordering.d.ts.map +1 -1
- package/dist/Ordering.js +10 -8
- package/dist/Ordering.js.map +1 -1
- package/dist/PartitionedSemaphore.d.ts +225 -40
- package/dist/PartitionedSemaphore.d.ts.map +1 -1
- package/dist/PartitionedSemaphore.js +113 -17
- package/dist/PartitionedSemaphore.js.map +1 -1
- package/dist/Path.d.ts +77 -13
- package/dist/Path.d.ts.map +1 -1
- package/dist/Path.js +49 -4
- package/dist/Path.js.map +1 -1
- package/dist/Pipeable.d.ts +77 -18
- package/dist/Pipeable.d.ts.map +1 -1
- package/dist/Pipeable.js +63 -14
- package/dist/Pipeable.js.map +1 -1
- package/dist/PlatformError.d.ts +74 -6
- package/dist/PlatformError.d.ts.map +1 -1
- package/dist/PlatformError.js +68 -5
- package/dist/PlatformError.js.map +1 -1
- package/dist/Pool.d.ts +66 -31
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +26 -24
- package/dist/Pool.js.map +1 -1
- package/dist/Predicate.d.ts +16 -23
- package/dist/Predicate.d.ts.map +1 -1
- package/dist/Predicate.js +12 -17
- package/dist/Predicate.js.map +1 -1
- package/dist/PrimaryKey.d.ts +11 -3
- package/dist/PrimaryKey.d.ts.map +1 -1
- package/dist/PrimaryKey.js +9 -2
- package/dist/PrimaryKey.js.map +1 -1
- package/dist/PubSub.d.ts +385 -309
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +260 -207
- package/dist/PubSub.js.map +1 -1
- package/dist/Pull.d.ts +94 -25
- package/dist/Pull.d.ts.map +1 -1
- package/dist/Pull.js +61 -13
- package/dist/Pull.js.map +1 -1
- package/dist/Queue.d.ts +303 -184
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +231 -134
- package/dist/Queue.js.map +1 -1
- package/dist/Random.d.ts +65 -57
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +41 -66
- package/dist/Random.js.map +1 -1
- package/dist/RcMap.d.ts +151 -141
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +66 -20
- package/dist/RcMap.js.map +1 -1
- package/dist/RcRef.d.ts +68 -32
- package/dist/RcRef.d.ts.map +1 -1
- package/dist/RcRef.js +33 -16
- package/dist/RcRef.js.map +1 -1
- package/dist/Record.d.ts +282 -137
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +124 -62
- package/dist/Record.js.map +1 -1
- package/dist/Redactable.d.ts +7 -5
- package/dist/Redactable.d.ts.map +1 -1
- package/dist/Redactable.js +5 -3
- package/dist/Redactable.js.map +1 -1
- package/dist/Redacted.d.ts +63 -34
- package/dist/Redacted.d.ts.map +1 -1
- package/dist/Redacted.js +31 -15
- package/dist/Redacted.js.map +1 -1
- package/dist/Reducer.d.ts +3 -1
- package/dist/Reducer.d.ts.map +1 -1
- package/dist/Reducer.js +2 -0
- package/dist/Reducer.js.map +1 -1
- package/dist/Ref.d.ts +85 -66
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +57 -45
- package/dist/Ref.js.map +1 -1
- package/dist/References.d.ts +73 -31
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +66 -30
- package/dist/References.js.map +1 -1
- package/dist/RegExp.d.ts +12 -6
- package/dist/RegExp.d.ts.map +1 -1
- package/dist/RegExp.js +12 -6
- package/dist/RegExp.js.map +1 -1
- package/dist/Request.d.ts +159 -34
- package/dist/Request.d.ts.map +1 -1
- package/dist/Request.js +68 -12
- package/dist/Request.js.map +1 -1
- package/dist/RequestResolver.d.ts +262 -118
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/RequestResolver.js +78 -42
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Resource.d.ts +13 -7
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +44 -6
- package/dist/Resource.js.map +1 -1
- package/dist/Result.d.ts +135 -151
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +56 -68
- package/dist/Result.js.map +1 -1
- package/dist/Runtime.d.ts +40 -20
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +34 -17
- package/dist/Runtime.js.map +1 -1
- package/dist/Schedule.d.ts +556 -590
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +265 -253
- package/dist/Schedule.js.map +1 -1
- package/dist/Scheduler.d.ts +44 -7
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +34 -5
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +1293 -602
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +501 -361
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +122 -92
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +102 -77
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +49 -36
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +42 -29
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaIssue.d.ts +19 -24
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js +16 -14
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.d.ts +231 -63
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +266 -75
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +89 -77
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +47 -37
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +97 -46
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +89 -38
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/SchemaUtils.d.ts +8 -1
- package/dist/SchemaUtils.d.ts.map +1 -1
- package/dist/SchemaUtils.js +24 -1
- package/dist/SchemaUtils.js.map +1 -1
- package/dist/Scope.d.ts +107 -65
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +61 -32
- package/dist/Scope.js.map +1 -1
- package/dist/ScopedCache.d.ts +141 -49
- package/dist/ScopedCache.d.ts.map +1 -1
- package/dist/ScopedCache.js +82 -21
- package/dist/ScopedCache.js.map +1 -1
- package/dist/ScopedRef.d.ts +28 -8
- package/dist/ScopedRef.d.ts.map +1 -1
- package/dist/ScopedRef.js +25 -5
- package/dist/ScopedRef.js.map +1 -1
- package/dist/Semaphore.d.ts +61 -37
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js +18 -21
- package/dist/Semaphore.js.map +1 -1
- package/dist/Sink.d.ts +461 -206
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +241 -90
- package/dist/Sink.js.map +1 -1
- package/dist/Stdio.d.ts +43 -6
- package/dist/Stdio.d.ts.map +1 -1
- package/dist/Stdio.js +33 -4
- package/dist/Stdio.js.map +1 -1
- package/dist/Stream.d.ts +2117 -1541
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +951 -682
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +174 -97
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +128 -69
- package/dist/String.js.map +1 -1
- package/dist/Struct.d.ts +20 -18
- package/dist/Struct.d.ts.map +1 -1
- package/dist/Struct.js +10 -8
- package/dist/Struct.js.map +1 -1
- package/dist/SubscriptionRef.d.ts +309 -204
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +126 -77
- package/dist/SubscriptionRef.js.map +1 -1
- package/dist/Symbol.d.ts +13 -5
- package/dist/Symbol.d.ts.map +1 -1
- package/dist/Symbol.js +13 -5
- package/dist/Symbol.js.map +1 -1
- package/dist/SynchronizedRef.d.ts +278 -62
- package/dist/SynchronizedRef.d.ts.map +1 -1
- package/dist/SynchronizedRef.js +116 -23
- package/dist/SynchronizedRef.js.map +1 -1
- package/dist/Take.d.ts +26 -2
- package/dist/Take.d.ts.map +1 -1
- package/dist/Take.js +4 -1
- package/dist/Take.js.map +1 -1
- package/dist/Terminal.d.ts +39 -7
- package/dist/Terminal.d.ts.map +1 -1
- package/dist/Terminal.js +10 -4
- package/dist/Terminal.js.map +1 -1
- package/dist/Tracer.d.ts +233 -59
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +94 -18
- package/dist/Tracer.js.map +1 -1
- package/dist/Trie.d.ts +280 -245
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Trie.js +116 -102
- package/dist/Trie.js.map +1 -1
- package/dist/Tuple.d.ts +34 -32
- package/dist/Tuple.d.ts.map +1 -1
- package/dist/Tuple.js +16 -14
- package/dist/Tuple.js.map +1 -1
- package/dist/TxChunk.d.ts +200 -155
- package/dist/TxChunk.d.ts.map +1 -1
- package/dist/TxChunk.js +83 -61
- package/dist/TxChunk.js.map +1 -1
- package/dist/TxDeferred.d.ts +43 -29
- package/dist/TxDeferred.d.ts.map +1 -1
- package/dist/TxDeferred.js +22 -15
- package/dist/TxDeferred.js.map +1 -1
- package/dist/TxHashMap.d.ts +362 -223
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js +171 -98
- package/dist/TxHashMap.js.map +1 -1
- package/dist/TxHashSet.d.ts +181 -111
- package/dist/TxHashSet.d.ts.map +1 -1
- package/dist/TxHashSet.js +87 -49
- package/dist/TxHashSet.js.map +1 -1
- package/dist/TxPriorityQueue.d.ts +94 -63
- package/dist/TxPriorityQueue.d.ts.map +1 -1
- package/dist/TxPriorityQueue.js +55 -37
- package/dist/TxPriorityQueue.js.map +1 -1
- package/dist/TxPubSub.d.ts +77 -49
- package/dist/TxPubSub.d.ts.map +1 -1
- package/dist/TxPubSub.js +60 -37
- package/dist/TxPubSub.js.map +1 -1
- package/dist/TxQueue.d.ts +277 -242
- package/dist/TxQueue.d.ts.map +1 -1
- package/dist/TxQueue.js +147 -101
- package/dist/TxQueue.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +69 -46
- package/dist/TxReentrantLock.d.ts.map +1 -1
- package/dist/TxReentrantLock.js +48 -32
- package/dist/TxReentrantLock.js.map +1 -1
- package/dist/TxRef.d.ts +69 -40
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +34 -19
- package/dist/TxRef.js.map +1 -1
- package/dist/TxSemaphore.d.ts +101 -115
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +76 -77
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/TxSubscriptionRef.d.ts +74 -50
- package/dist/TxSubscriptionRef.d.ts.map +1 -1
- package/dist/TxSubscriptionRef.js +34 -23
- package/dist/TxSubscriptionRef.js.map +1 -1
- package/dist/Types.d.ts +31 -34
- package/dist/Types.d.ts.map +1 -1
- package/dist/UndefinedOr.d.ts +62 -25
- package/dist/UndefinedOr.d.ts.map +1 -1
- package/dist/UndefinedOr.js +36 -25
- package/dist/UndefinedOr.js.map +1 -1
- package/dist/Unify.d.ts +72 -117
- package/dist/Unify.d.ts.map +1 -1
- package/dist/Unify.js +20 -6
- package/dist/Unify.js.map +1 -1
- package/dist/Utils.d.ts +5 -2
- package/dist/Utils.d.ts.map +1 -1
- package/dist/Utils.js +4 -0
- package/dist/Utils.js.map +1 -1
- package/dist/index.d.ts +1973 -418
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1973 -418
- package/dist/index.js.map +1 -1
- package/dist/internal/schema/schema.js +1 -1
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/testing/FastCheck.d.ts +9 -6
- package/dist/testing/FastCheck.d.ts.map +1 -1
- package/dist/testing/FastCheck.js +9 -6
- package/dist/testing/FastCheck.js.map +1 -1
- package/dist/testing/TestClock.d.ts +39 -35
- package/dist/testing/TestClock.d.ts.map +1 -1
- package/dist/testing/TestClock.js +42 -12
- package/dist/testing/TestClock.js.map +1 -1
- package/dist/testing/TestConsole.d.ts +44 -36
- package/dist/testing/TestConsole.d.ts.map +1 -1
- package/dist/testing/TestConsole.js +30 -15
- package/dist/testing/TestConsole.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +2 -0
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/testing/TestSchema.js +9 -7
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/testing/index.d.ts +34 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +34 -0
- package/dist/testing/index.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +205 -147
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +164 -109
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +2 -2
- package/dist/unstable/ai/Chat.d.ts +64 -41
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +51 -33
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.d.ts +12 -11
- package/dist/unstable/ai/EmbeddingModel.d.ts.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.js +9 -8
- package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
- package/dist/unstable/ai/IdGenerator.d.ts +28 -18
- package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
- package/dist/unstable/ai/IdGenerator.js +18 -11
- package/dist/unstable/ai/IdGenerator.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +31 -25
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +20 -14
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpSchema.d.ts +342 -119
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +266 -98
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +56 -20
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +64 -16
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Model.d.ts +10 -12
- package/dist/unstable/ai/Model.d.ts.map +1 -1
- package/dist/unstable/ai/Model.js +9 -7
- package/dist/unstable/ai/Model.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +2 -2
- package/dist/unstable/ai/Prompt.d.ts +200 -176
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Prompt.js +77 -68
- package/dist/unstable/ai/Prompt.js.map +1 -1
- package/dist/unstable/ai/Response.d.ts +173 -160
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js +43 -48
- package/dist/unstable/ai/Response.js.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.d.ts +43 -4
- package/dist/unstable/ai/ResponseIdTracker.d.ts.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.js +27 -2
- package/dist/unstable/ai/ResponseIdTracker.js.map +1 -1
- package/dist/unstable/ai/Telemetry.d.ts +43 -33
- package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
- package/dist/unstable/ai/Telemetry.js +15 -11
- package/dist/unstable/ai/Telemetry.js.map +1 -1
- package/dist/unstable/ai/Tokenizer.d.ts +14 -9
- package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
- package/dist/unstable/ai/Tokenizer.js +10 -6
- package/dist/unstable/ai/Tokenizer.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +167 -96
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +107 -53
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +32 -39
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +7 -5
- package/dist/unstable/ai/Toolkit.js.map +1 -1
- package/dist/unstable/ai/index.d.ts +121 -29
- package/dist/unstable/ai/index.d.ts.map +1 -1
- package/dist/unstable/ai/index.js +121 -29
- package/dist/unstable/ai/index.js.map +1 -1
- package/dist/unstable/cli/Argument.d.ts +226 -134
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js +101 -65
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +72 -26
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +86 -23
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/CliOutput.d.ts +48 -19
- package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
- package/dist/unstable/cli/CliOutput.js +32 -9
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +196 -115
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +45 -31
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Completions.d.ts +7 -7
- package/dist/unstable/cli/Completions.js +1 -1
- package/dist/unstable/cli/Flag.d.ts +235 -142
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js +111 -71
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +41 -13
- package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -1
- package/dist/unstable/cli/GlobalFlag.js +30 -7
- package/dist/unstable/cli/GlobalFlag.js.map +1 -1
- package/dist/unstable/cli/HelpDoc.d.ts +39 -14
- package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
- package/dist/unstable/cli/HelpDoc.js +21 -0
- package/dist/unstable/cli/Param.d.ts +110 -32
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +196 -135
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +79 -42
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js +66 -35
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/Prompt.d.ts +183 -59
- package/dist/unstable/cli/Prompt.d.ts.map +1 -1
- package/dist/unstable/cli/Prompt.js +105 -23
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/index.d.ts +182 -0
- package/dist/unstable/cli/index.d.ts.map +1 -1
- package/dist/unstable/cli/index.js +205 -6
- package/dist/unstable/cli/index.js.map +1 -1
- package/dist/unstable/cli/internal/ansi.d.ts.map +1 -1
- package/dist/unstable/cli/internal/ansi.js +13 -0
- package/dist/unstable/cli/internal/ansi.js.map +1 -1
- package/dist/unstable/cli/internal/command.d.ts +5 -1
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.js +5 -1
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/config.d.ts +3 -0
- package/dist/unstable/cli/internal/config.d.ts.map +1 -1
- package/dist/unstable/cli/internal/config.js.map +1 -1
- package/dist/unstable/cli/internal/lexer.js.map +1 -1
- package/dist/unstable/cli/internal/parser.js +0 -1
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cluster/ClusterCron.d.ts +35 -1
- package/dist/unstable/cluster/ClusterCron.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterCron.js +35 -1
- package/dist/unstable/cluster/ClusterCron.js.map +1 -1
- package/dist/unstable/cluster/ClusterError.d.ts +56 -7
- package/dist/unstable/cluster/ClusterError.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterError.js +56 -7
- package/dist/unstable/cluster/ClusterError.js.map +1 -1
- package/dist/unstable/cluster/ClusterMetrics.d.ts +39 -5
- package/dist/unstable/cluster/ClusterMetrics.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterMetrics.js +39 -5
- package/dist/unstable/cluster/ClusterMetrics.js.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.d.ts +61 -8
- package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.js +61 -8
- package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +14 -2
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +35 -2
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/DeliverAt.d.ts +39 -4
- package/dist/unstable/cluster/DeliverAt.d.ts.map +1 -1
- package/dist/unstable/cluster/DeliverAt.js +11 -3
- package/dist/unstable/cluster/DeliverAt.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +74 -16
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +75 -10
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/EntityAddress.d.ts +30 -2
- package/dist/unstable/cluster/EntityAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityAddress.js +30 -2
- package/dist/unstable/cluster/EntityAddress.js.map +1 -1
- package/dist/unstable/cluster/EntityId.d.ts +18 -3
- package/dist/unstable/cluster/EntityId.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityId.js +15 -2
- package/dist/unstable/cluster/EntityId.js.map +1 -1
- package/dist/unstable/cluster/EntityProxy.d.ts +42 -14
- package/dist/unstable/cluster/EntityProxy.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxy.js +30 -14
- package/dist/unstable/cluster/EntityProxy.js.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.d.ts +18 -2
- package/dist/unstable/cluster/EntityProxyServer.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.js +40 -8
- package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
- package/dist/unstable/cluster/EntityResource.d.ts +43 -6
- package/dist/unstable/cluster/EntityResource.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityResource.js +11 -4
- package/dist/unstable/cluster/EntityResource.js.map +1 -1
- package/dist/unstable/cluster/EntityType.d.ts +27 -3
- package/dist/unstable/cluster/EntityType.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityType.js +24 -2
- package/dist/unstable/cluster/EntityType.js.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts +105 -23
- package/dist/unstable/cluster/Envelope.d.ts.map +1 -1
- package/dist/unstable/cluster/Envelope.js +88 -14
- package/dist/unstable/cluster/Envelope.js.map +1 -1
- package/dist/unstable/cluster/HttpRunner.d.ts +88 -13
- package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/HttpRunner.js +88 -13
- package/dist/unstable/cluster/HttpRunner.js.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.d.ts +49 -6
- package/dist/unstable/cluster/K8sHttpClient.d.ts.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.js +31 -6
- package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
- package/dist/unstable/cluster/MachineId.d.ts +24 -3
- package/dist/unstable/cluster/MachineId.d.ts.map +1 -1
- package/dist/unstable/cluster/MachineId.js +21 -2
- package/dist/unstable/cluster/MachineId.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +102 -13
- package/dist/unstable/cluster/Message.d.ts.map +1 -1
- package/dist/unstable/cluster/Message.js +86 -10
- package/dist/unstable/cluster/Message.js.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts +126 -21
- package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/MessageStorage.js +70 -10
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts +101 -12
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +64 -8
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/Runner.d.ts +47 -17
- package/dist/unstable/cluster/Runner.d.ts.map +1 -1
- package/dist/unstable/cluster/Runner.js +47 -17
- package/dist/unstable/cluster/Runner.js.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.d.ts +34 -2
- package/dist/unstable/cluster/RunnerAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.js +34 -2
- package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.d.ts +40 -12
- package/dist/unstable/cluster/RunnerHealth.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.js +40 -12
- package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts +7 -4
- package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.js +31 -4
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.d.ts +42 -5
- package/dist/unstable/cluster/RunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.js +38 -4
- package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +76 -13
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +73 -12
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/ShardId.d.ts +53 -5
- package/dist/unstable/cluster/ShardId.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardId.js +49 -4
- package/dist/unstable/cluster/ShardId.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts +10 -2
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +35 -4
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +65 -9
- package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.js +66 -9
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/ShardingRegistrationEvent.d.ts +27 -6
- package/dist/unstable/cluster/ShardingRegistrationEvent.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardingRegistrationEvent.js +28 -4
- package/dist/unstable/cluster/ShardingRegistrationEvent.js.map +1 -1
- package/dist/unstable/cluster/SingleRunner.d.ts +23 -1
- package/dist/unstable/cluster/SingleRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/SingleRunner.js +23 -1
- package/dist/unstable/cluster/SingleRunner.js.map +1 -1
- package/dist/unstable/cluster/Singleton.d.ts +15 -1
- package/dist/unstable/cluster/Singleton.d.ts.map +1 -1
- package/dist/unstable/cluster/Singleton.js +15 -1
- package/dist/unstable/cluster/Singleton.js.map +1 -1
- package/dist/unstable/cluster/SingletonAddress.d.ts +21 -1
- package/dist/unstable/cluster/SingletonAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/SingletonAddress.js +21 -1
- package/dist/unstable/cluster/SingletonAddress.js.map +1 -1
- package/dist/unstable/cluster/Snowflake.d.ts +90 -19
- package/dist/unstable/cluster/Snowflake.d.ts.map +1 -1
- package/dist/unstable/cluster/Snowflake.js +49 -13
- package/dist/unstable/cluster/Snowflake.js.map +1 -1
- package/dist/unstable/cluster/SocketRunner.d.ts +8 -2
- package/dist/unstable/cluster/SocketRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/SocketRunner.js +29 -2
- package/dist/unstable/cluster/SocketRunner.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.d.ts +11 -3
- package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +27 -3
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts +11 -3
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js +46 -7
- package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/TestRunner.d.ts +18 -1
- package/dist/unstable/cluster/TestRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/TestRunner.js +18 -1
- package/dist/unstable/cluster/TestRunner.js.map +1 -1
- package/dist/unstable/cluster/index.d.ts +790 -0
- package/dist/unstable/cluster/index.d.ts.map +1 -1
- package/dist/unstable/cluster/index.js +790 -0
- package/dist/unstable/cluster/index.js.map +1 -1
- package/dist/unstable/cluster/internal/hash.js +12 -0
- package/dist/unstable/cluster/internal/hash.js.map +1 -1
- package/dist/unstable/devtools/DevTools.d.ts +26 -3
- package/dist/unstable/devtools/DevTools.d.ts.map +1 -1
- package/dist/unstable/devtools/DevTools.js +26 -3
- package/dist/unstable/devtools/DevTools.js.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.d.ts +20 -5
- package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.js +32 -5
- package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.d.ts +184 -44
- package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.js +102 -20
- package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
- package/dist/unstable/devtools/DevToolsServer.d.ts +27 -2
- package/dist/unstable/devtools/DevToolsServer.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsServer.js +21 -1
- package/dist/unstable/devtools/DevToolsServer.js.map +1 -1
- package/dist/unstable/devtools/index.d.ts +58 -0
- package/dist/unstable/devtools/index.d.ts.map +1 -1
- package/dist/unstable/devtools/index.js +58 -0
- package/dist/unstable/devtools/index.js.map +1 -1
- package/dist/unstable/encoding/Msgpack.d.ts +81 -12
- package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
- package/dist/unstable/encoding/Msgpack.js +75 -9
- package/dist/unstable/encoding/Msgpack.js.map +1 -1
- package/dist/unstable/encoding/Ndjson.d.ts +149 -21
- package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
- package/dist/unstable/encoding/Ndjson.js +97 -13
- package/dist/unstable/encoding/Ndjson.js.map +1 -1
- package/dist/unstable/encoding/Sse.d.ts +109 -18
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.js +69 -13
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/encoding/index.d.ts +49 -0
- package/dist/unstable/encoding/index.d.ts.map +1 -1
- package/dist/unstable/encoding/index.js +49 -0
- package/dist/unstable/encoding/index.js.map +1 -1
- package/dist/unstable/eventlog/Event.d.ts +115 -30
- package/dist/unstable/eventlog/Event.d.ts.map +1 -1
- package/dist/unstable/eventlog/Event.js +22 -2
- package/dist/unstable/eventlog/Event.js.map +1 -1
- package/dist/unstable/eventlog/EventGroup.d.ts +50 -17
- package/dist/unstable/eventlog/EventGroup.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventGroup.js +24 -6
- package/dist/unstable/eventlog/EventGroup.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +104 -20
- package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventJournal.js +108 -16
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts +150 -31
- package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLog.js +111 -20
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.d.ts +42 -6
- package/dist/unstable/eventlog/EventLogEncryption.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js +38 -5
- package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +92 -18
- package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.js +72 -16
- package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +35 -8
- package/dist/unstable/eventlog/EventLogRemote.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.js +54 -8
- package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.d.ts +17 -3
- package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.js +17 -3
- package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +32 -6
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.js +52 -6
- package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +74 -16
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js +90 -16
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +59 -15
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.js +73 -14
- package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.d.ts +10 -2
- package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.js +28 -2
- package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts +32 -3
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js +32 -3
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts +10 -2
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +28 -2
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/index.d.ts +240 -0
- package/dist/unstable/eventlog/index.d.ts.map +1 -1
- package/dist/unstable/eventlog/index.js +240 -0
- package/dist/unstable/eventlog/index.js.map +1 -1
- package/dist/unstable/http/Cookies.d.ts +156 -77
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +93 -39
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Etag.d.ts +40 -7
- package/dist/unstable/http/Etag.d.ts.map +1 -1
- package/dist/unstable/http/Etag.js +27 -4
- package/dist/unstable/http/Etag.js.map +1 -1
- package/dist/unstable/http/FetchHttpClient.d.ts +29 -3
- package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
- package/dist/unstable/http/FetchHttpClient.js +33 -4
- package/dist/unstable/http/FetchHttpClient.js.map +1 -1
- package/dist/unstable/http/FindMyWay.d.ts +1 -1
- package/dist/unstable/http/FindMyWay.js +1 -1
- package/dist/unstable/http/Headers.d.ts +182 -36
- package/dist/unstable/http/Headers.d.ts.map +1 -1
- package/dist/unstable/http/Headers.js +86 -16
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpBody.d.ts +114 -26
- package/dist/unstable/http/HttpBody.d.ts.map +1 -1
- package/dist/unstable/http/HttpBody.js +98 -20
- package/dist/unstable/http/HttpBody.js.map +1 -1
- package/dist/unstable/http/HttpClient.d.ts +204 -96
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +85 -38
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientError.d.ts +68 -12
- package/dist/unstable/http/HttpClientError.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientError.js +71 -9
- package/dist/unstable/http/HttpClientError.js.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts +318 -100
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +151 -45
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts +59 -16
- package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientResponse.js +44 -11
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts +42 -16
- package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
- package/dist/unstable/http/HttpEffect.js +33 -13
- package/dist/unstable/http/HttpEffect.js.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.d.ts +48 -7
- package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js +45 -6
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpMethod.d.ts +38 -6
- package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
- package/dist/unstable/http/HttpMethod.js +27 -2
- package/dist/unstable/http/HttpMethod.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts +38 -11
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +52 -10
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/http/HttpPlatform.d.ts +34 -3
- package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
- package/dist/unstable/http/HttpPlatform.js +34 -3
- package/dist/unstable/http/HttpPlatform.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +209 -62
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js +136 -41
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServer.d.ts +151 -22
- package/dist/unstable/http/HttpServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpServer.js +76 -11
- package/dist/unstable/http/HttpServer.js.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +93 -10
- package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerError.js +85 -8
- package/dist/unstable/http/HttpServerError.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts +125 -21
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +101 -20
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.d.ts +32 -6
- package/dist/unstable/http/HttpServerRespondable.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.js +43 -5
- package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +391 -67
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +205 -33
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpStaticServer.d.ts +24 -8
- package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpStaticServer.js +24 -8
- package/dist/unstable/http/HttpStaticServer.js.map +1 -1
- package/dist/unstable/http/HttpTraceContext.d.ts +53 -6
- package/dist/unstable/http/HttpTraceContext.d.ts.map +1 -1
- package/dist/unstable/http/HttpTraceContext.js +47 -5
- package/dist/unstable/http/HttpTraceContext.js.map +1 -1
- package/dist/unstable/http/Multipart.d.ts +179 -28
- package/dist/unstable/http/Multipart.d.ts.map +1 -1
- package/dist/unstable/http/Multipart.js +131 -19
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/Multipasta/HeadersParser.d.ts +1 -1
- package/dist/unstable/http/Multipasta/HeadersParser.js +1 -1
- package/dist/unstable/http/Multipasta/Node.d.ts +1 -1
- package/dist/unstable/http/Multipasta/Node.js +1 -1
- package/dist/unstable/http/Multipasta/Search.d.ts +1 -1
- package/dist/unstable/http/Multipasta/Search.js +1 -1
- package/dist/unstable/http/Multipasta/Web.d.ts +1 -1
- package/dist/unstable/http/Multipasta/Web.js +1 -1
- package/dist/unstable/http/Multipasta.d.ts +1 -1
- package/dist/unstable/http/Multipasta.js +1 -1
- package/dist/unstable/http/Template.d.ts +53 -1
- package/dist/unstable/http/Template.d.ts.map +1 -1
- package/dist/unstable/http/Template.js +26 -0
- package/dist/unstable/http/Template.js.map +1 -1
- package/dist/unstable/http/Url.d.ts +70 -56
- package/dist/unstable/http/Url.d.ts.map +1 -1
- package/dist/unstable/http/Url.js +35 -21
- package/dist/unstable/http/Url.js.map +1 -1
- package/dist/unstable/http/UrlParams.d.ts +237 -51
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +120 -25
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/http/index.d.ts +452 -0
- package/dist/unstable/http/index.d.ts.map +1 -1
- package/dist/unstable/http/index.js +452 -0
- package/dist/unstable/http/index.js.map +1 -1
- package/dist/unstable/httpapi/HttpApi.d.ts +49 -14
- package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js +14 -8
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +54 -16
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +44 -6
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +57 -15
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +42 -6
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +214 -59
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.js +53 -9
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +81 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.js +98 -1
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.d.ts +87 -20
- package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.js +5 -2
- package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +113 -22
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js +49 -5
- package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts +19 -4
- package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.js +32 -2
- package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +86 -38
- package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.js +59 -35
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts +73 -17
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.js +38 -5
- package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.d.ts +4 -3
- package/dist/unstable/httpapi/HttpApiSwagger.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.js +23 -3
- package/dist/unstable/httpapi/HttpApiSwagger.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiTest.d.ts +6 -1
- package/dist/unstable/httpapi/HttpApiTest.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiTest.js +26 -1
- package/dist/unstable/httpapi/HttpApiTest.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts +86 -15
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +73 -15
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/httpapi/index.d.ts +310 -25
- package/dist/unstable/httpapi/index.d.ts.map +1 -1
- package/dist/unstable/httpapi/index.js +310 -25
- package/dist/unstable/httpapi/index.js.map +1 -1
- package/dist/unstable/observability/Otlp.d.ts +33 -3
- package/dist/unstable/observability/Otlp.d.ts.map +1 -1
- package/dist/unstable/observability/Otlp.js +14 -3
- package/dist/unstable/observability/Otlp.js.map +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts +8 -1
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +32 -1
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.d.ts +15 -2
- package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpLogger.js +29 -2
- package/dist/unstable/observability/OtlpLogger.js.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts +17 -5
- package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.js +32 -2
- package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
- package/dist/unstable/observability/OtlpResource.d.ts +49 -12
- package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpResource.js +47 -5
- package/dist/unstable/observability/OtlpResource.js.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.d.ts +28 -3
- package/dist/unstable/observability/OtlpSerialization.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.js +28 -3
- package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
- package/dist/unstable/observability/OtlpTracer.d.ts +19 -2
- package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js +32 -2
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.d.ts +36 -16
- package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.js +9 -7
- package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
- package/dist/unstable/observability/index.d.ts +160 -3
- package/dist/unstable/observability/index.d.ts.map +1 -1
- package/dist/unstable/observability/index.js +160 -3
- package/dist/unstable/observability/index.js.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts +93 -18
- package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.js +81 -21
- package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
- package/dist/unstable/persistence/Persistable.d.ts +76 -15
- package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistable.js +22 -5
- package/dist/unstable/persistence/Persistable.js.map +1 -1
- package/dist/unstable/persistence/PersistedCache.d.ts +27 -2
- package/dist/unstable/persistence/PersistedCache.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedCache.js +24 -1
- package/dist/unstable/persistence/PersistedCache.js.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts +73 -16
- package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.js +60 -13
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/persistence/Persistence.d.ts +98 -16
- package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistence.js +91 -14
- package/dist/unstable/persistence/Persistence.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +101 -21
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +85 -16
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/persistence/Redis.d.ts +26 -5
- package/dist/unstable/persistence/Redis.d.ts.map +1 -1
- package/dist/unstable/persistence/Redis.js +36 -4
- package/dist/unstable/persistence/Redis.js.map +1 -1
- package/dist/unstable/persistence/index.d.ts +147 -0
- package/dist/unstable/persistence/index.d.ts.map +1 -1
- package/dist/unstable/persistence/index.js +147 -0
- package/dist/unstable/persistence/index.js.map +1 -1
- package/dist/unstable/process/ChildProcess.d.ts +87 -64
- package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcess.js +25 -18
- package/dist/unstable/process/ChildProcess.js.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.d.ts +23 -12
- package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js +11 -6
- package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
- package/dist/unstable/process/index.d.ts +2 -1
- package/dist/unstable/process/index.d.ts.map +1 -1
- package/dist/unstable/process/index.js +2 -1
- package/dist/unstable/process/index.js.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.d.ts +198 -59
- package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.js +121 -36
- package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +544 -130
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +252 -58
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +41 -2
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.js +35 -1
- package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/unstable/reactivity/AtomRef.d.ts +51 -7
- package/dist/unstable/reactivity/AtomRef.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRef.js +29 -3
- package/dist/unstable/reactivity/AtomRef.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.d.ts +135 -21
- package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +69 -10
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts +36 -2
- package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.js +29 -1
- package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
- package/dist/unstable/reactivity/Hydration.d.ts +28 -5
- package/dist/unstable/reactivity/Hydration.d.ts.map +1 -1
- package/dist/unstable/reactivity/Hydration.js +35 -3
- package/dist/unstable/reactivity/Hydration.js.map +1 -1
- package/dist/unstable/reactivity/Reactivity.d.ts +94 -13
- package/dist/unstable/reactivity/Reactivity.d.ts.map +1 -1
- package/dist/unstable/reactivity/Reactivity.js +60 -7
- package/dist/unstable/reactivity/Reactivity.js.map +1 -1
- package/dist/unstable/reactivity/index.d.ts +167 -0
- package/dist/unstable/reactivity/index.d.ts.map +1 -1
- package/dist/unstable/reactivity/index.js +167 -0
- package/dist/unstable/reactivity/index.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +254 -56
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js +44 -11
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts +80 -19
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +52 -12
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcClientError.d.ts +26 -2
- package/dist/unstable/rpc/RpcClientError.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClientError.js +26 -2
- package/dist/unstable/rpc/RpcClientError.js.map +1 -1
- package/dist/unstable/rpc/RpcGroup.d.ts +51 -8
- package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcGroup.js +3 -1
- package/dist/unstable/rpc/RpcGroup.js.map +1 -1
- package/dist/unstable/rpc/RpcMessage.d.ts +128 -32
- package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMessage.js +23 -7
- package/dist/unstable/rpc/RpcMessage.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts +100 -20
- package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js +39 -3
- package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts +38 -4
- package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSchema.js +34 -3
- package/dist/unstable/rpc/RpcSchema.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts +60 -13
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +56 -12
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +73 -23
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +69 -22
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/rpc/RpcTest.d.ts +20 -1
- package/dist/unstable/rpc/RpcTest.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcTest.js +20 -1
- package/dist/unstable/rpc/RpcTest.js.map +1 -1
- package/dist/unstable/rpc/RpcWorker.d.ts +39 -6
- package/dist/unstable/rpc/RpcWorker.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcWorker.js +16 -4
- package/dist/unstable/rpc/RpcWorker.js.map +1 -1
- package/dist/unstable/rpc/Utils.d.ts +10 -0
- package/dist/unstable/rpc/Utils.d.ts.map +1 -1
- package/dist/unstable/rpc/Utils.js +10 -0
- package/dist/unstable/rpc/Utils.js.map +1 -1
- package/dist/unstable/rpc/index.d.ts +272 -0
- package/dist/unstable/rpc/index.d.ts.map +1 -1
- package/dist/unstable/rpc/index.js +272 -0
- package/dist/unstable/rpc/index.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts +192 -59
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js +122 -38
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +101 -24
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.js +22 -6
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/schema/index.d.ts +37 -0
- package/dist/unstable/schema/index.d.ts.map +1 -1
- package/dist/unstable/schema/index.js +37 -0
- package/dist/unstable/schema/index.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +168 -34
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +124 -28
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/socket/SocketServer.d.ts +58 -10
- package/dist/unstable/socket/SocketServer.d.ts.map +1 -1
- package/dist/unstable/socket/SocketServer.js +43 -5
- package/dist/unstable/socket/SocketServer.js.map +1 -1
- package/dist/unstable/socket/index.d.ts +44 -0
- package/dist/unstable/socket/index.d.ts.map +1 -1
- package/dist/unstable/socket/index.js +44 -0
- package/dist/unstable/socket/index.js.map +1 -1
- package/dist/unstable/sql/Migrator.d.ts +40 -9
- package/dist/unstable/sql/Migrator.d.ts.map +1 -1
- package/dist/unstable/sql/Migrator.js +45 -5
- package/dist/unstable/sql/Migrator.js.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts +38 -2
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +40 -1
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/sql/SqlConnection.d.ts +34 -3
- package/dist/unstable/sql/SqlConnection.d.ts.map +1 -1
- package/dist/unstable/sql/SqlConnection.js +22 -0
- package/dist/unstable/sql/SqlConnection.js.map +1 -1
- package/dist/unstable/sql/SqlError.d.ts +117 -0
- package/dist/unstable/sql/SqlError.d.ts.map +1 -1
- package/dist/unstable/sql/SqlError.js +131 -0
- package/dist/unstable/sql/SqlError.js.map +1 -1
- package/dist/unstable/sql/SqlModel.d.ts +25 -5
- package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
- package/dist/unstable/sql/SqlModel.js +8 -4
- package/dist/unstable/sql/SqlModel.js.map +1 -1
- package/dist/unstable/sql/SqlResolver.d.ts +56 -13
- package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
- package/dist/unstable/sql/SqlResolver.js +44 -10
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/sql/SqlSchema.d.ts +29 -8
- package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
- package/dist/unstable/sql/SqlSchema.js +29 -8
- package/dist/unstable/sql/SqlSchema.js.map +1 -1
- package/dist/unstable/sql/SqlStream.d.ts +4 -0
- package/dist/unstable/sql/SqlStream.d.ts.map +1 -1
- package/dist/unstable/sql/SqlStream.js +24 -0
- package/dist/unstable/sql/SqlStream.js.map +1 -1
- package/dist/unstable/sql/Statement.d.ts +151 -24
- package/dist/unstable/sql/Statement.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.js +91 -6
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/sql/index.d.ts +179 -1
- package/dist/unstable/sql/index.d.ts.map +1 -1
- package/dist/unstable/sql/index.js +179 -1
- package/dist/unstable/sql/index.js.map +1 -1
- package/dist/unstable/workers/Transferable.d.ts +72 -20
- package/dist/unstable/workers/Transferable.d.ts.map +1 -1
- package/dist/unstable/workers/Transferable.js +57 -14
- package/dist/unstable/workers/Transferable.js.map +1 -1
- package/dist/unstable/workers/Worker.d.ts +61 -8
- package/dist/unstable/workers/Worker.d.ts.map +1 -1
- package/dist/unstable/workers/Worker.js +44 -4
- package/dist/unstable/workers/Worker.js.map +1 -1
- package/dist/unstable/workers/WorkerError.d.ts +31 -9
- package/dist/unstable/workers/WorkerError.d.ts.map +1 -1
- package/dist/unstable/workers/WorkerError.js +44 -7
- package/dist/unstable/workers/WorkerError.js.map +1 -1
- package/dist/unstable/workers/WorkerRunner.d.ts +32 -3
- package/dist/unstable/workers/WorkerRunner.d.ts.map +1 -1
- package/dist/unstable/workers/WorkerRunner.js +24 -1
- package/dist/unstable/workers/WorkerRunner.js.map +1 -1
- package/dist/unstable/workers/index.d.ts +81 -1
- package/dist/unstable/workers/index.d.ts.map +1 -1
- package/dist/unstable/workers/index.js +81 -1
- package/dist/unstable/workers/index.js.map +1 -1
- package/dist/unstable/workflow/Activity.d.ts +61 -10
- package/dist/unstable/workflow/Activity.d.ts.map +1 -1
- package/dist/unstable/workflow/Activity.js +20 -5
- package/dist/unstable/workflow/Activity.js.map +1 -1
- package/dist/unstable/workflow/DurableClock.d.ts +12 -3
- package/dist/unstable/workflow/DurableClock.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableClock.js +22 -2
- package/dist/unstable/workflow/DurableClock.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.d.ts +128 -31
- package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.js +77 -13
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/DurableQueue.d.ts +33 -8
- package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableQueue.js +26 -6
- package/dist/unstable/workflow/DurableQueue.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +102 -31
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js +75 -19
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +40 -5
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +16 -4
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.d.ts +40 -12
- package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.js +8 -12
- package/dist/unstable/workflow/WorkflowProxy.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.d.ts +37 -2
- package/dist/unstable/workflow/WorkflowProxyServer.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.js +12 -6
- package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
- package/dist/unstable/workflow/index.d.ts +160 -0
- package/dist/unstable/workflow/index.d.ts.map +1 -1
- package/dist/unstable/workflow/index.js +160 -0
- package/dist/unstable/workflow/index.js.map +1 -1
- package/package.json +11 -11
- package/src/Array.ts +151 -106
- package/src/BigDecimal.ts +620 -553
- package/src/BigInt.ts +342 -274
- package/src/Boolean.ts +189 -156
- package/src/Brand.ts +30 -5
- package/src/Cache.ts +334 -167
- package/src/Cause.ts +84 -73
- package/src/Channel.ts +1639 -667
- package/src/ChannelSchema.ts +137 -12
- package/src/Chunk.ts +575 -429
- package/src/Clock.ts +16 -9
- package/src/Combiner.ts +11 -5
- package/src/Config.ts +80 -68
- package/src/ConfigProvider.ts +33 -32
- package/src/Console.ts +88 -58
- package/src/Context.ts +401 -190
- package/src/Cron.ts +109 -48
- package/src/Crypto.ts +327 -0
- package/src/Data.ts +9 -3
- package/src/DateTime.ts +893 -464
- package/src/Deferred.ts +367 -175
- package/src/Differ.ts +44 -2
- package/src/Duration.ts +333 -186
- package/src/Effect.ts +2201 -2289
- package/src/Effectable.ts +38 -3
- package/src/Encoding.ts +78 -28
- package/src/Equal.ts +4 -3
- package/src/Equivalence.ts +18 -24
- package/src/ErrorReporter.ts +66 -82
- package/src/ExecutionPlan.ts +106 -12
- package/src/Exit.ts +6 -5
- package/src/Fiber.ts +71 -40
- package/src/FiberHandle.ts +157 -57
- package/src/FiberMap.ts +328 -163
- package/src/FiberSet.ts +130 -52
- package/src/FileSystem.ts +104 -74
- package/src/Filter.ts +166 -88
- package/src/Formatter.ts +4 -70
- package/src/Function.ts +218 -151
- package/src/Graph.ts +714 -415
- package/src/HKT.ts +29 -13
- package/src/Hash.ts +35 -24
- package/src/HashMap.ts +540 -388
- package/src/HashRing.ts +111 -34
- package/src/HashSet.ts +239 -153
- package/src/Inspectable.ts +30 -17
- package/src/Iterable.ts +336 -222
- package/src/JsonPatch.ts +13 -10
- package/src/JsonPointer.ts +13 -11
- package/src/JsonSchema.ts +16 -0
- package/src/Latch.ts +97 -26
- package/src/Layer.ts +547 -445
- package/src/LayerMap.ts +99 -26
- package/src/LogLevel.ts +92 -131
- package/src/Logger.ts +365 -297
- package/src/ManagedRuntime.ts +78 -19
- package/src/Match.ts +135 -161
- package/src/Metric.ts +362 -313
- package/src/MutableHashMap.ts +202 -127
- package/src/MutableHashSet.ts +120 -52
- package/src/MutableList.ts +157 -100
- package/src/MutableRef.ts +129 -90
- package/src/Newtype.ts +15 -2
- package/src/NonEmptyIterable.ts +38 -48
- package/src/Number.ts +261 -205
- package/src/Optic.ts +6 -7
- package/src/Option.ts +133 -156
- package/src/Order.ts +6 -6
- package/src/Ordering.ts +56 -45
- package/src/PartitionedSemaphore.ts +225 -40
- package/src/Path.ts +77 -13
- package/src/Pipeable.ts +82 -24
- package/src/PlatformError.ts +74 -6
- package/src/Pool.ts +94 -31
- package/src/Predicate.ts +17 -24
- package/src/PrimaryKey.ts +11 -3
- package/src/PubSub.ts +385 -309
- package/src/Pull.ts +94 -25
- package/src/Queue.ts +303 -184
- package/src/Random.ts +69 -93
- package/src/RcMap.ts +151 -141
- package/src/RcRef.ts +68 -32
- package/src/Record.ts +282 -137
- package/src/Redactable.ts +7 -5
- package/src/Redacted.ts +63 -34
- package/src/Reducer.ts +3 -1
- package/src/Ref.ts +173 -134
- package/src/References.ts +73 -31
- package/src/RegExp.ts +12 -6
- package/src/Request.ts +159 -34
- package/src/RequestResolver.ts +278 -121
- package/src/Resource.ts +45 -7
- package/src/Result.ts +137 -153
- package/src/Runtime.ts +42 -21
- package/src/Schedule.ts +585 -613
- package/src/Scheduler.ts +44 -7
- package/src/Schema.ts +1309 -615
- package/src/SchemaAST.ts +123 -93
- package/src/SchemaGetter.ts +52 -37
- package/src/SchemaIssue.ts +19 -24
- package/src/SchemaParser.ts +306 -85
- package/src/SchemaRepresentation.ts +89 -77
- package/src/SchemaTransformation.ts +97 -46
- package/src/SchemaUtils.ts +24 -1
- package/src/Scope.ts +107 -65
- package/src/ScopedCache.ts +195 -59
- package/src/ScopedRef.ts +28 -8
- package/src/Semaphore.ts +61 -37
- package/src/Sink.ts +461 -206
- package/src/Stdio.ts +43 -6
- package/src/Stream.ts +2361 -1613
- package/src/String.ts +174 -97
- package/src/Struct.ts +20 -18
- package/src/SubscriptionRef.ts +309 -204
- package/src/Symbol.ts +13 -5
- package/src/SynchronizedRef.ts +278 -62
- package/src/Take.ts +26 -2
- package/src/Terminal.ts +40 -7
- package/src/Tracer.ts +233 -59
- package/src/Trie.ts +280 -245
- package/src/Tuple.ts +34 -32
- package/src/TxChunk.ts +200 -155
- package/src/TxDeferred.ts +43 -29
- package/src/TxHashMap.ts +370 -231
- package/src/TxHashSet.ts +253 -159
- package/src/TxPriorityQueue.ts +97 -65
- package/src/TxPubSub.ts +77 -49
- package/src/TxQueue.ts +277 -242
- package/src/TxReentrantLock.ts +70 -47
- package/src/TxRef.ts +69 -40
- package/src/TxSemaphore.ts +101 -115
- package/src/TxSubscriptionRef.ts +74 -50
- package/src/Types.ts +31 -34
- package/src/UndefinedOr.ts +62 -25
- package/src/Unify.ts +72 -117
- package/src/Utils.ts +5 -2
- package/src/index.ts +1976 -420
- package/src/internal/schema/schema.ts +1 -1
- package/src/testing/FastCheck.ts +9 -6
- package/src/testing/TestClock.ts +63 -35
- package/src/testing/TestConsole.ts +54 -36
- package/src/testing/TestSchema.ts +10 -8
- package/src/testing/index.ts +34 -0
- package/src/unstable/ai/AiError.ts +195 -137
- package/src/unstable/ai/AnthropicStructuredOutput.ts +2 -2
- package/src/unstable/ai/Chat.ts +68 -43
- package/src/unstable/ai/EmbeddingModel.ts +12 -11
- package/src/unstable/ai/IdGenerator.ts +28 -18
- package/src/unstable/ai/LanguageModel.ts +35 -27
- package/src/unstable/ai/McpSchema.ts +342 -119
- package/src/unstable/ai/McpServer.ts +79 -20
- package/src/unstable/ai/Model.ts +10 -12
- package/src/unstable/ai/OpenAiStructuredOutput.ts +2 -2
- package/src/unstable/ai/Prompt.ts +216 -192
- package/src/unstable/ai/Response.ts +179 -167
- package/src/unstable/ai/ResponseIdTracker.ts +43 -4
- package/src/unstable/ai/Telemetry.ts +43 -33
- package/src/unstable/ai/Tokenizer.ts +14 -9
- package/src/unstable/ai/Tool.ts +168 -97
- package/src/unstable/ai/Toolkit.ts +51 -46
- package/src/unstable/ai/index.ts +121 -29
- package/src/unstable/cli/Argument.ts +226 -134
- package/src/unstable/cli/CliError.ts +96 -26
- package/src/unstable/cli/CliOutput.ts +48 -19
- package/src/unstable/cli/Command.ts +196 -115
- package/src/unstable/cli/Completions.ts +7 -7
- package/src/unstable/cli/Flag.ts +235 -142
- package/src/unstable/cli/GlobalFlag.ts +41 -13
- package/src/unstable/cli/HelpDoc.ts +39 -14
- package/src/unstable/cli/Param.ts +395 -260
- package/src/unstable/cli/Primitive.ts +79 -42
- package/src/unstable/cli/Prompt.ts +207 -59
- package/src/unstable/cli/index.ts +205 -6
- package/src/unstable/cli/internal/ansi.ts +13 -0
- package/src/unstable/cli/internal/command.ts +5 -1
- package/src/unstable/cli/internal/config.ts +3 -0
- package/src/unstable/cli/internal/lexer.ts +11 -0
- package/src/unstable/cli/internal/parser.ts +0 -1
- package/src/unstable/cluster/ClusterCron.ts +35 -1
- package/src/unstable/cluster/ClusterError.ts +56 -7
- package/src/unstable/cluster/ClusterMetrics.ts +39 -5
- package/src/unstable/cluster/ClusterSchema.ts +61 -8
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +35 -2
- package/src/unstable/cluster/DeliverAt.ts +39 -4
- package/src/unstable/cluster/Entity.ts +106 -16
- package/src/unstable/cluster/EntityAddress.ts +30 -2
- package/src/unstable/cluster/EntityId.ts +18 -3
- package/src/unstable/cluster/EntityProxy.ts +42 -14
- package/src/unstable/cluster/EntityProxyServer.ts +45 -8
- package/src/unstable/cluster/EntityResource.ts +43 -6
- package/src/unstable/cluster/EntityType.ts +27 -3
- package/src/unstable/cluster/Envelope.ts +128 -23
- package/src/unstable/cluster/HttpRunner.ts +88 -13
- package/src/unstable/cluster/K8sHttpClient.ts +49 -6
- package/src/unstable/cluster/MachineId.ts +24 -3
- package/src/unstable/cluster/Message.ts +102 -13
- package/src/unstable/cluster/MessageStorage.ts +126 -21
- package/src/unstable/cluster/Reply.ts +101 -12
- package/src/unstable/cluster/Runner.ts +47 -17
- package/src/unstable/cluster/RunnerAddress.ts +34 -2
- package/src/unstable/cluster/RunnerHealth.ts +40 -12
- package/src/unstable/cluster/RunnerServer.ts +31 -4
- package/src/unstable/cluster/RunnerStorage.ts +42 -5
- package/src/unstable/cluster/Runners.ts +76 -13
- package/src/unstable/cluster/ShardId.ts +53 -5
- package/src/unstable/cluster/Sharding.ts +35 -4
- package/src/unstable/cluster/ShardingConfig.ts +75 -10
- package/src/unstable/cluster/ShardingRegistrationEvent.ts +31 -7
- package/src/unstable/cluster/SingleRunner.ts +23 -1
- package/src/unstable/cluster/Singleton.ts +15 -1
- package/src/unstable/cluster/SingletonAddress.ts +21 -1
- package/src/unstable/cluster/Snowflake.ts +90 -19
- package/src/unstable/cluster/SocketRunner.ts +29 -2
- package/src/unstable/cluster/SqlMessageStorage.ts +27 -3
- package/src/unstable/cluster/SqlRunnerStorage.ts +46 -7
- package/src/unstable/cluster/TestRunner.ts +18 -1
- package/src/unstable/cluster/index.ts +790 -0
- package/src/unstable/cluster/internal/hash.ts +12 -0
- package/src/unstable/devtools/DevTools.ts +26 -3
- package/src/unstable/devtools/DevToolsClient.ts +32 -5
- package/src/unstable/devtools/DevToolsSchema.ts +201 -44
- package/src/unstable/devtools/DevToolsServer.ts +27 -2
- package/src/unstable/devtools/index.ts +58 -0
- package/src/unstable/encoding/Msgpack.ts +97 -12
- package/src/unstable/encoding/Ndjson.ts +149 -21
- package/src/unstable/encoding/Sse.ts +109 -18
- package/src/unstable/encoding/index.ts +49 -0
- package/src/unstable/eventlog/Event.ts +131 -30
- package/src/unstable/eventlog/EventGroup.ts +50 -17
- package/src/unstable/eventlog/EventJournal.ts +120 -20
- package/src/unstable/eventlog/EventLog.ts +150 -31
- package/src/unstable/eventlog/EventLogEncryption.ts +42 -6
- package/src/unstable/eventlog/EventLogMessage.ts +92 -18
- package/src/unstable/eventlog/EventLogRemote.ts +54 -8
- package/src/unstable/eventlog/EventLogServer.ts +33 -3
- package/src/unstable/eventlog/EventLogServerEncrypted.ts +52 -6
- package/src/unstable/eventlog/EventLogServerUnencrypted.ts +90 -16
- package/src/unstable/eventlog/EventLogSessionAuth.ts +77 -15
- package/src/unstable/eventlog/SqlEventJournal.ts +28 -2
- package/src/unstable/eventlog/SqlEventLogServerEncrypted.ts +32 -3
- package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +28 -2
- package/src/unstable/eventlog/index.ts +240 -0
- package/src/unstable/http/Cookies.ts +156 -77
- package/src/unstable/http/Etag.ts +40 -7
- package/src/unstable/http/FetchHttpClient.ts +33 -4
- package/src/unstable/http/FindMyWay.ts +1 -1
- package/src/unstable/http/Headers.ts +252 -50
- package/src/unstable/http/HttpBody.ts +128 -26
- package/src/unstable/http/HttpClient.ts +204 -96
- package/src/unstable/http/HttpClientError.ts +80 -12
- package/src/unstable/http/HttpClientRequest.ts +318 -100
- package/src/unstable/http/HttpClientResponse.ts +59 -16
- package/src/unstable/http/HttpEffect.ts +66 -18
- package/src/unstable/http/HttpIncomingMessage.ts +48 -7
- package/src/unstable/http/HttpMethod.ts +38 -6
- package/src/unstable/http/HttpMiddleware.ts +60 -11
- package/src/unstable/http/HttpPlatform.ts +34 -3
- package/src/unstable/http/HttpRouter.ts +232 -69
- package/src/unstable/http/HttpServer.ts +151 -22
- package/src/unstable/http/HttpServerError.ts +93 -10
- package/src/unstable/http/HttpServerRequest.ts +125 -21
- package/src/unstable/http/HttpServerRespondable.ts +49 -6
- package/src/unstable/http/HttpServerResponse.ts +391 -67
- package/src/unstable/http/HttpStaticServer.ts +24 -8
- package/src/unstable/http/HttpTraceContext.ts +53 -6
- package/src/unstable/http/Multipart.ts +179 -28
- package/src/unstable/http/Multipasta/HeadersParser.ts +1 -1
- package/src/unstable/http/Multipasta/Node.ts +1 -1
- package/src/unstable/http/Multipasta/Search.ts +1 -1
- package/src/unstable/http/Multipasta/Web.ts +1 -1
- package/src/unstable/http/Multipasta.ts +1 -1
- package/src/unstable/http/Template.ts +53 -1
- package/src/unstable/http/Url.ts +70 -56
- package/src/unstable/http/UrlParams.ts +237 -51
- package/src/unstable/http/index.ts +452 -0
- package/src/unstable/httpapi/HttpApi.ts +49 -14
- package/src/unstable/httpapi/HttpApiBuilder.ts +81 -16
- package/src/unstable/httpapi/HttpApiClient.ts +78 -15
- package/src/unstable/httpapi/HttpApiEndpoint.ts +238 -59
- package/src/unstable/httpapi/HttpApiError.ts +100 -1
- package/src/unstable/httpapi/HttpApiGroup.ts +87 -20
- package/src/unstable/httpapi/HttpApiMiddleware.ts +113 -22
- package/src/unstable/httpapi/HttpApiScalar.ts +38 -4
- package/src/unstable/httpapi/HttpApiSchema.ts +86 -38
- package/src/unstable/httpapi/HttpApiSecurity.ts +73 -17
- package/src/unstable/httpapi/HttpApiSwagger.ts +23 -3
- package/src/unstable/httpapi/HttpApiTest.ts +26 -1
- package/src/unstable/httpapi/OpenApi.ts +115 -15
- package/src/unstable/httpapi/index.ts +310 -25
- package/src/unstable/observability/Otlp.ts +33 -3
- package/src/unstable/observability/OtlpExporter.ts +32 -1
- package/src/unstable/observability/OtlpLogger.ts +32 -2
- package/src/unstable/observability/OtlpMetrics.ts +39 -5
- package/src/unstable/observability/OtlpResource.ts +68 -12
- package/src/unstable/observability/OtlpSerialization.ts +28 -3
- package/src/unstable/observability/OtlpTracer.ts +41 -2
- package/src/unstable/observability/PrometheusMetrics.ts +36 -16
- package/src/unstable/observability/index.ts +160 -3
- package/src/unstable/persistence/KeyValueStore.ts +108 -28
- package/src/unstable/persistence/Persistable.ts +76 -15
- package/src/unstable/persistence/PersistedCache.ts +27 -2
- package/src/unstable/persistence/PersistedQueue.ts +98 -16
- package/src/unstable/persistence/Persistence.ts +98 -16
- package/src/unstable/persistence/RateLimiter.ts +101 -21
- package/src/unstable/persistence/Redis.ts +42 -5
- package/src/unstable/persistence/index.ts +147 -0
- package/src/unstable/process/ChildProcess.ts +90 -66
- package/src/unstable/process/ChildProcessSpawner.ts +23 -12
- package/src/unstable/process/index.ts +2 -1
- package/src/unstable/reactivity/AsyncResult.ts +204 -61
- package/src/unstable/reactivity/Atom.ts +598 -139
- package/src/unstable/reactivity/AtomHttpApi.ts +41 -2
- package/src/unstable/reactivity/AtomRef.ts +51 -7
- package/src/unstable/reactivity/AtomRegistry.ts +141 -22
- package/src/unstable/reactivity/AtomRpc.ts +36 -2
- package/src/unstable/reactivity/Hydration.ts +45 -5
- package/src/unstable/reactivity/Reactivity.ts +94 -13
- package/src/unstable/reactivity/index.ts +167 -0
- package/src/unstable/rpc/Rpc.ts +254 -56
- package/src/unstable/rpc/RpcClient.ts +106 -19
- package/src/unstable/rpc/RpcClientError.ts +26 -2
- package/src/unstable/rpc/RpcGroup.ts +51 -8
- package/src/unstable/rpc/RpcMessage.ts +128 -32
- package/src/unstable/rpc/RpcMiddleware.ts +100 -20
- package/src/unstable/rpc/RpcSchema.ts +38 -4
- package/src/unstable/rpc/RpcSerialization.ts +60 -13
- package/src/unstable/rpc/RpcServer.ts +107 -23
- package/src/unstable/rpc/RpcTest.ts +20 -1
- package/src/unstable/rpc/RpcWorker.ts +39 -6
- package/src/unstable/rpc/Utils.ts +33 -0
- package/src/unstable/rpc/index.ts +272 -0
- package/src/unstable/schema/Model.ts +245 -61
- package/src/unstable/schema/VariantSchema.ts +101 -24
- package/src/unstable/schema/index.ts +37 -0
- package/src/unstable/socket/Socket.ts +168 -34
- package/src/unstable/socket/SocketServer.ts +58 -10
- package/src/unstable/socket/index.ts +44 -0
- package/src/unstable/sql/Migrator.ts +61 -9
- package/src/unstable/sql/SqlClient.ts +59 -2
- package/src/unstable/sql/SqlConnection.ts +34 -3
- package/src/unstable/sql/SqlError.ts +135 -0
- package/src/unstable/sql/SqlModel.ts +25 -5
- package/src/unstable/sql/SqlResolver.ts +56 -13
- package/src/unstable/sql/SqlSchema.ts +29 -8
- package/src/unstable/sql/SqlStream.ts +24 -0
- package/src/unstable/sql/Statement.ts +168 -24
- package/src/unstable/sql/index.ts +179 -1
- package/src/unstable/workers/Transferable.ts +72 -20
- package/src/unstable/workers/Worker.ts +61 -8
- package/src/unstable/workers/WorkerError.ts +50 -9
- package/src/unstable/workers/WorkerRunner.ts +32 -3
- package/src/unstable/workers/index.ts +81 -1
- package/src/unstable/workflow/Activity.ts +61 -10
- package/src/unstable/workflow/DurableClock.ts +26 -3
- package/src/unstable/workflow/DurableDeferred.ts +148 -31
- package/src/unstable/workflow/DurableQueue.ts +33 -8
- package/src/unstable/workflow/Workflow.ts +123 -31
- package/src/unstable/workflow/WorkflowEngine.ts +40 -5
- package/src/unstable/workflow/WorkflowProxy.ts +40 -12
- package/src/unstable/workflow/WorkflowProxyServer.ts +41 -6
- package/src/unstable/workflow/index.ts +160 -0
package/dist/Stream.js
CHANGED
|
@@ -1,4 +1,41 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* The `Stream` module provides a typed, composable way to describe effectful
|
|
3
|
+
* sequences of values. A `Stream<A, E, R>` can emit zero or more `A` values,
|
|
4
|
+
* fail with an `E`, and require services from `R` while preserving
|
|
5
|
+
* backpressure and resource safety.
|
|
6
|
+
*
|
|
7
|
+
* **Mental model**
|
|
8
|
+
*
|
|
9
|
+
* - A stream is a lazy description; it runs only when consumed with a `run*` function
|
|
10
|
+
* - Streams are pull-based and emit chunks internally for efficient throughput
|
|
11
|
+
* - `A` is the element type, `E` is the failure type, and `R` is the required context
|
|
12
|
+
* - Stream composition mirrors `Effect`: use `map`, `flatMap`, error handling, and `pipe`
|
|
13
|
+
* - Resource scopes, interruption, and finalizers are tracked by the Effect runtime
|
|
14
|
+
* - Interop functions connect streams to queues, pub/subs, web streams, async iterables, and channels
|
|
15
|
+
*
|
|
16
|
+
* **Common tasks**
|
|
17
|
+
*
|
|
18
|
+
* - Create streams: {@link make}, {@link fromIterable}, {@link fromEffect}, {@link fromQueue}
|
|
19
|
+
* - Transform values: {@link map}, {@link mapEffect}, {@link flatMap}, {@link filter}
|
|
20
|
+
* - Combine streams: {@link concat}, {@link merge}, {@link zip}, {@link race}
|
|
21
|
+
* - Control demand and timing: {@link take}, {@link drop}, {@link debounce}, {@link throttle}
|
|
22
|
+
* - Manage errors: {@link catchCause}, {@link catchIf}, {@link mapError}, {@link retry}
|
|
23
|
+
* - Manage resources and services: {@link scoped}, {@link ensuring}, {@link provide}
|
|
24
|
+
* - Consume streams: {@link runCollect}, {@link runForEach}, {@link runFold}, {@link runDrain}
|
|
25
|
+
*
|
|
26
|
+
* **Gotchas**
|
|
27
|
+
*
|
|
28
|
+
* - A stream is not a collection; constructors and operators build a description until it is run
|
|
29
|
+
* - Re-running a stream re-executes its effects unless it is explicitly shared or backed by external state
|
|
30
|
+
* - Operators such as {@link merge}, {@link race}, and {@link broadcast} introduce concurrency and interruption semantics
|
|
31
|
+
* - Prefer bounded constructors and sinks for large or infinite streams instead of collecting everything into memory
|
|
32
|
+
*
|
|
33
|
+
* **See also**
|
|
34
|
+
*
|
|
35
|
+
* - {@link Effect.Effect} for single-result effectful programs
|
|
36
|
+
* - {@link Sink.Sink} for consuming and folding streams
|
|
37
|
+
* - {@link Channel.Channel} for the lower-level primitive underlying streams
|
|
38
|
+
*
|
|
2
39
|
* @since 2.0.0
|
|
3
40
|
*/
|
|
4
41
|
// @effect-diagnostics returnEffectInGen:off
|
|
@@ -23,6 +60,7 @@ import * as MutableHashMap from "./MutableHashMap.js";
|
|
|
23
60
|
import * as MutableList from "./MutableList.js";
|
|
24
61
|
import * as Option from "./Option.js";
|
|
25
62
|
import { hasProperty, isNotUndefined, isTagged } from "./Predicate.js";
|
|
63
|
+
import * as PubSub from "./PubSub.js";
|
|
26
64
|
import * as Pull from "./Pull.js";
|
|
27
65
|
import * as Queue from "./Queue.js";
|
|
28
66
|
import * as RcMap from "./RcMap.js";
|
|
@@ -33,14 +71,18 @@ import * as Scope from "./Scope.js";
|
|
|
33
71
|
import * as Sink from "./Sink.js";
|
|
34
72
|
import { isString } from "./String.js";
|
|
35
73
|
/**
|
|
36
|
-
*
|
|
74
|
+
* Runtime identifier stored on `Stream` values and used by `isStream` to
|
|
75
|
+
* recognize them.
|
|
76
|
+
*
|
|
37
77
|
* @category Type Identifiers
|
|
78
|
+
* @since 4.0.0
|
|
38
79
|
*/
|
|
39
80
|
export const TypeId = "~effect/Stream";
|
|
40
81
|
/**
|
|
41
82
|
* Checks whether a value is a Stream.
|
|
42
83
|
*
|
|
43
|
-
*
|
|
84
|
+
* **Example** (Checking whether a value is a Stream)
|
|
85
|
+
*
|
|
44
86
|
* ```ts
|
|
45
87
|
* import { Console, Effect, Stream } from "effect"
|
|
46
88
|
*
|
|
@@ -57,14 +99,15 @@ export const TypeId = "~effect/Stream";
|
|
|
57
99
|
* Effect.runPromise(program)
|
|
58
100
|
* ```
|
|
59
101
|
*
|
|
60
|
-
* @
|
|
61
|
-
* @
|
|
102
|
+
* @category guards
|
|
103
|
+
* @since 4.0.0
|
|
62
104
|
*/
|
|
63
105
|
export const isStream = u => hasProperty(u, TypeId);
|
|
64
106
|
/**
|
|
65
107
|
* The default chunk size used by Stream constructors and combinators.
|
|
66
108
|
*
|
|
67
|
-
*
|
|
109
|
+
* **Example** (Reading the default chunk size)
|
|
110
|
+
*
|
|
68
111
|
* ```ts
|
|
69
112
|
* import { Console, Effect, Stream } from "effect"
|
|
70
113
|
*
|
|
@@ -83,7 +126,8 @@ export const DefaultChunkSize = Channel.DefaultChunkSize;
|
|
|
83
126
|
/**
|
|
84
127
|
* Creates a stream from a array-emitting `Channel`.
|
|
85
128
|
*
|
|
86
|
-
*
|
|
129
|
+
* **Example** (Creating a stream from an array-emitting channel)
|
|
130
|
+
*
|
|
87
131
|
* ```ts
|
|
88
132
|
* import { Channel, Console, Effect, Stream } from "effect"
|
|
89
133
|
*
|
|
@@ -97,15 +141,16 @@ export const DefaultChunkSize = Channel.DefaultChunkSize;
|
|
|
97
141
|
* // Output: [ 1, 2, 3 ]
|
|
98
142
|
* ```
|
|
99
143
|
*
|
|
144
|
+
* @category constructors
|
|
100
145
|
* @since 2.0.0
|
|
101
|
-
* @category Constructors
|
|
102
146
|
*/
|
|
103
147
|
export const fromChannel = internal.fromChannel;
|
|
104
148
|
/**
|
|
105
149
|
* Either emits the success value of this effect or terminates the stream
|
|
106
150
|
* with the failure value of this effect.
|
|
107
151
|
*
|
|
108
|
-
*
|
|
152
|
+
* **Example** (Creating a stream from an effect)
|
|
153
|
+
*
|
|
109
154
|
* ```ts
|
|
110
155
|
* import { Console, Effect, Stream } from "effect"
|
|
111
156
|
*
|
|
@@ -119,16 +164,17 @@ export const fromChannel = internal.fromChannel;
|
|
|
119
164
|
* // Output: [ 42 ]
|
|
120
165
|
* ```
|
|
121
166
|
*
|
|
167
|
+
* @category constructors
|
|
122
168
|
* @since 2.0.0
|
|
123
|
-
* @category Constructors
|
|
124
169
|
*/
|
|
125
170
|
export const fromEffect = effect => fromChannel(Channel.fromEffect(Effect.map(effect, Arr.of)));
|
|
126
171
|
/**
|
|
127
172
|
* Accesses a service from the context and emits it as a single element.
|
|
128
173
|
*
|
|
129
|
-
*
|
|
174
|
+
* **Example** (Accessing a service as a stream)
|
|
175
|
+
*
|
|
130
176
|
* ```ts
|
|
131
|
-
* import {
|
|
177
|
+
* import { Context, Effect, Stream } from "effect"
|
|
132
178
|
*
|
|
133
179
|
* class Greeter extends Context.Service<Greeter, {
|
|
134
180
|
* readonly greet: (name: string) => string
|
|
@@ -151,17 +197,18 @@ export const fromEffect = effect => fromChannel(Channel.fromEffect(Effect.map(ef
|
|
|
151
197
|
* // Output: [ "Hello, World!" ]
|
|
152
198
|
* ```
|
|
153
199
|
*
|
|
154
|
-
* @since 4.0.0
|
|
155
200
|
* @category Context
|
|
201
|
+
* @since 4.0.0
|
|
156
202
|
*/
|
|
157
203
|
export const service = service => fromEffect(Effect.service(service));
|
|
158
204
|
/**
|
|
159
205
|
* Optionally accesses a service from the context and emits the result as a
|
|
160
206
|
* single element.
|
|
161
207
|
*
|
|
162
|
-
*
|
|
208
|
+
* **Example** (Accessing an optional service as a stream)
|
|
209
|
+
*
|
|
163
210
|
* ```ts
|
|
164
|
-
* import { Effect, Option,
|
|
211
|
+
* import { Context, Effect, Option, Stream } from "effect"
|
|
165
212
|
*
|
|
166
213
|
* class Greeter extends Context.Service<Greeter, {
|
|
167
214
|
* readonly greet: (name: string) => string
|
|
@@ -189,14 +236,15 @@ export const service = service => fromEffect(Effect.service(service));
|
|
|
189
236
|
* // Output: [ "Hello, World!" ]
|
|
190
237
|
* ```
|
|
191
238
|
*
|
|
192
|
-
* @since 4.0.0
|
|
193
239
|
* @category Context
|
|
240
|
+
* @since 4.0.0
|
|
194
241
|
*/
|
|
195
242
|
export const serviceOption = service => fromEffect(Effect.serviceOption(service));
|
|
196
243
|
/**
|
|
197
244
|
* Creates a stream that runs the effect and emits no elements.
|
|
198
245
|
*
|
|
199
|
-
*
|
|
246
|
+
* **Example** (Draining an effect into a stream)
|
|
247
|
+
*
|
|
200
248
|
* ```ts
|
|
201
249
|
* import { Console, Effect, Stream } from "effect"
|
|
202
250
|
*
|
|
@@ -210,20 +258,15 @@ export const serviceOption = service => fromEffect(Effect.serviceOption(service)
|
|
|
210
258
|
* // Output: Draining side effect
|
|
211
259
|
* ```
|
|
212
260
|
*
|
|
261
|
+
* @category constructors
|
|
213
262
|
* @since 4.0.0
|
|
214
|
-
* @category Constructors
|
|
215
263
|
*/
|
|
216
264
|
export const fromEffectDrain = effect => fromPull(Effect.succeed(Effect.flatMap(effect, () => Cause.done())));
|
|
217
265
|
/**
|
|
218
266
|
* Creates a stream from an effect producing a value of type `A` which repeats forever.
|
|
219
267
|
*
|
|
220
|
-
* **
|
|
221
|
-
*
|
|
222
|
-
* This API replaces the following from Effect 3.x:
|
|
268
|
+
* **Example** (Repeating an effect forever)
|
|
223
269
|
*
|
|
224
|
-
* - `Stream.repeatEffect`
|
|
225
|
-
*
|
|
226
|
-
* @example
|
|
227
270
|
* ```ts
|
|
228
271
|
* import { Console, Effect, Random, Stream } from "effect"
|
|
229
272
|
*
|
|
@@ -239,21 +282,16 @@ export const fromEffectDrain = effect => fromPull(Effect.succeed(Effect.flatMap(
|
|
|
239
282
|
* // Output: [ 3891571149, 4239494205, 2352981603, 2339111046, 1488052210 ]
|
|
240
283
|
* ```
|
|
241
284
|
*
|
|
285
|
+
* @category constructors
|
|
242
286
|
* @since 4.0.0
|
|
243
|
-
* @category Constructors
|
|
244
287
|
*/
|
|
245
288
|
export const fromEffectRepeat = effect => fromPull(Effect.succeed(Effect.map(effect, Arr.of)));
|
|
246
289
|
/**
|
|
247
290
|
* Creates a stream from an effect producing a value of type `A`, which is
|
|
248
291
|
* repeated using the specified schedule.
|
|
249
292
|
*
|
|
250
|
-
* **
|
|
251
|
-
*
|
|
252
|
-
* This API replaces the following from Effect 3.x:
|
|
293
|
+
* **Example** (Repeating an effect with a schedule)
|
|
253
294
|
*
|
|
254
|
-
* - `Stream.repeatEffectWithSchedule`
|
|
255
|
-
*
|
|
256
|
-
* @example
|
|
257
295
|
* ```ts
|
|
258
296
|
* import { Console, Effect, Schedule, Stream } from "effect"
|
|
259
297
|
*
|
|
@@ -270,8 +308,8 @@ export const fromEffectRepeat = effect => fromPull(Effect.succeed(Effect.map(eff
|
|
|
270
308
|
* // Output: [ "ping", "ping", "ping" ]
|
|
271
309
|
* ```
|
|
272
310
|
*
|
|
273
|
-
* @
|
|
274
|
-
* @
|
|
311
|
+
* @category constructors
|
|
312
|
+
* @since 4.0.0
|
|
275
313
|
*/
|
|
276
314
|
export const fromEffectSchedule = (effect, schedule) => fromPull(Effect.gen(function* () {
|
|
277
315
|
const step = yield* Schedule.toStepWithMetadata(schedule);
|
|
@@ -290,9 +328,11 @@ export const fromEffectSchedule = (effect, schedule) => fromPull(Effect.gen(func
|
|
|
290
328
|
});
|
|
291
329
|
}));
|
|
292
330
|
/**
|
|
293
|
-
* Creates a stream that emits void
|
|
331
|
+
* Creates a stream that emits `void` immediately once, then emits another
|
|
332
|
+
* `void` after each specified interval.
|
|
333
|
+
*
|
|
334
|
+
* **Example** (Emitting ticks on an interval)
|
|
294
335
|
*
|
|
295
|
-
* @example
|
|
296
336
|
* ```ts
|
|
297
337
|
* import { Console, Effect, Stream } from "effect"
|
|
298
338
|
*
|
|
@@ -308,8 +348,8 @@ export const fromEffectSchedule = (effect, schedule) => fromPull(Effect.gen(func
|
|
|
308
348
|
* // Output: [ undefined, undefined, undefined ]
|
|
309
349
|
* ```
|
|
310
350
|
*
|
|
351
|
+
* @category constructors
|
|
311
352
|
* @since 2.0.0
|
|
312
|
-
* @category Constructors
|
|
313
353
|
*/
|
|
314
354
|
export const tick = interval => fromPull(Effect.sync(() => {
|
|
315
355
|
let first = true;
|
|
@@ -329,7 +369,8 @@ export const tick = interval => fromPull(Effect.sync(() => {
|
|
|
329
369
|
* A pull effect yields chunks on demand and completes when the upstream stream ends.
|
|
330
370
|
* See `Stream.toPull` for a matching producer.
|
|
331
371
|
*
|
|
332
|
-
*
|
|
372
|
+
* **Example** (Creating a stream from a pull effect)
|
|
373
|
+
*
|
|
333
374
|
* ```ts
|
|
334
375
|
* import { Console, Effect, Stream } from "effect"
|
|
335
376
|
*
|
|
@@ -347,14 +388,15 @@ export const tick = interval => fromPull(Effect.sync(() => {
|
|
|
347
388
|
* // Output: [1, 2, 3]
|
|
348
389
|
* ```
|
|
349
390
|
*
|
|
391
|
+
* @category constructors
|
|
350
392
|
* @since 2.0.0
|
|
351
|
-
* @category Constructors
|
|
352
393
|
*/
|
|
353
394
|
export const fromPull = pull => fromChannel(Channel.fromPull(pull));
|
|
354
395
|
/**
|
|
355
396
|
* Derive a stream by transforming its pull effect.
|
|
356
397
|
*
|
|
357
|
-
*
|
|
398
|
+
* **Example** (Transforming a pull effect)
|
|
399
|
+
*
|
|
358
400
|
* ```ts
|
|
359
401
|
* import { Console, Effect, Stream } from "effect"
|
|
360
402
|
*
|
|
@@ -371,8 +413,8 @@ export const fromPull = pull => fromChannel(Channel.fromPull(pull));
|
|
|
371
413
|
* // Output: [ 1, 2, 3 ]
|
|
372
414
|
* ```
|
|
373
415
|
*
|
|
416
|
+
* @category constructors
|
|
374
417
|
* @since 4.0.0
|
|
375
|
-
* @category Constructors
|
|
376
418
|
*/
|
|
377
419
|
export const transformPull = (self, f) => fromChannel(Channel.fromTransform((_, scope) => Effect.flatMap(Channel.toPullScoped(self.channel, scope), pull => f(pull, scope))));
|
|
378
420
|
/**
|
|
@@ -381,7 +423,8 @@ export const transformPull = (self, f) => fromChannel(Channel.fromTransform((_,
|
|
|
381
423
|
* A forked scope is also provided to the transformation function, which is
|
|
382
424
|
* closed once the resulting stream has finished processing.
|
|
383
425
|
*
|
|
384
|
-
*
|
|
426
|
+
* **Example** (Transforming a stream by effectfully transforming its pull effect)
|
|
427
|
+
*
|
|
385
428
|
* ```ts
|
|
386
429
|
* import { Console, Effect, Scope, Stream } from "effect"
|
|
387
430
|
*
|
|
@@ -406,14 +449,15 @@ export const transformPull = (self, f) => fromChannel(Channel.fromTransform((_,
|
|
|
406
449
|
* // Releasing scope
|
|
407
450
|
* ```
|
|
408
451
|
*
|
|
452
|
+
* @category constructors
|
|
409
453
|
* @since 4.0.0
|
|
410
|
-
* @category Constructors
|
|
411
454
|
*/
|
|
412
455
|
export const transformPullBracket = (self, f) => fromChannel(Channel.fromTransformBracket((_, scope, forkedScope) => Effect.flatMap(Channel.toPullScoped(self.channel, scope), pull => f(pull, scope, forkedScope))));
|
|
413
456
|
/**
|
|
414
457
|
* Creates a channel from a stream.
|
|
415
458
|
*
|
|
416
|
-
*
|
|
459
|
+
* **Example** (Converting a stream to a channel)
|
|
460
|
+
*
|
|
417
461
|
* ```ts
|
|
418
462
|
* import { Channel, Console, Effect, Stream } from "effect"
|
|
419
463
|
*
|
|
@@ -428,8 +472,8 @@ export const transformPullBracket = (self, f) => fromChannel(Channel.fromTransfo
|
|
|
428
472
|
* // Output: [ 1, 2, 3 ]
|
|
429
473
|
* ```
|
|
430
474
|
*
|
|
475
|
+
* @category constructors
|
|
431
476
|
* @since 2.0.0
|
|
432
|
-
* @category Constructors
|
|
433
477
|
*/
|
|
434
478
|
export const toChannel = stream => stream.channel;
|
|
435
479
|
/**
|
|
@@ -442,16 +486,8 @@ export const toChannel = stream => stream.channel;
|
|
|
442
486
|
* You can customize the buffer size and strategy by passing an object as the
|
|
443
487
|
* second argument with the `bufferSize` and `strategy` fields.
|
|
444
488
|
*
|
|
445
|
-
* **
|
|
489
|
+
* **Example** (Creating a stream from a callback that can emit values into a queue)
|
|
446
490
|
*
|
|
447
|
-
* This API replaces the following from Effect 3.x:
|
|
448
|
-
*
|
|
449
|
-
* - `Stream.async`
|
|
450
|
-
* - `Stream.asyncEffect`
|
|
451
|
-
* - `Stream.asyncPush`
|
|
452
|
-
* - `Stream.asyncScoped`
|
|
453
|
-
*
|
|
454
|
-
* @example
|
|
455
491
|
* ```ts
|
|
456
492
|
* import { Console, Effect, Queue, Stream } from "effect"
|
|
457
493
|
*
|
|
@@ -475,14 +511,15 @@ export const toChannel = stream => stream.channel;
|
|
|
475
511
|
* Effect.runPromise(program)
|
|
476
512
|
* ```
|
|
477
513
|
*
|
|
478
|
-
* @
|
|
479
|
-
* @
|
|
514
|
+
* @category constructors
|
|
515
|
+
* @since 4.0.0
|
|
480
516
|
*/
|
|
481
517
|
export const callback = (f, options) => fromChannel(Channel.callbackArray(f, options));
|
|
482
518
|
/**
|
|
483
519
|
* Creates an empty stream.
|
|
484
520
|
*
|
|
485
|
-
*
|
|
521
|
+
* **Example** (Creating an empty stream)
|
|
522
|
+
*
|
|
486
523
|
* ```ts
|
|
487
524
|
* import { Console, Effect, Stream } from "effect"
|
|
488
525
|
*
|
|
@@ -495,14 +532,15 @@ export const callback = (f, options) => fromChannel(Channel.callbackArray(f, opt
|
|
|
495
532
|
* // []
|
|
496
533
|
* ```
|
|
497
534
|
*
|
|
498
|
-
* @
|
|
499
|
-
* @
|
|
535
|
+
* @category constructors
|
|
536
|
+
* @since 2.0.0
|
|
500
537
|
*/
|
|
501
538
|
export const empty = /*#__PURE__*/fromChannel(Channel.empty);
|
|
502
539
|
/**
|
|
503
540
|
* Creates a single-valued pure stream.
|
|
504
541
|
*
|
|
505
|
-
*
|
|
542
|
+
* **Example** (Creating a single-valued pure stream)
|
|
543
|
+
*
|
|
506
544
|
* ```ts
|
|
507
545
|
* import { Console, Effect, Stream } from "effect"
|
|
508
546
|
*
|
|
@@ -515,14 +553,15 @@ export const empty = /*#__PURE__*/fromChannel(Channel.empty);
|
|
|
515
553
|
* // [ 3 ]
|
|
516
554
|
* ```
|
|
517
555
|
*
|
|
556
|
+
* @category constructors
|
|
518
557
|
* @since 2.0.0
|
|
519
|
-
* @category Constructors
|
|
520
558
|
*/
|
|
521
559
|
export const succeed = value => fromChannel(Channel.succeed(Arr.of(value)));
|
|
522
560
|
/**
|
|
523
561
|
* Creates a stream from a sequence of values.
|
|
524
562
|
*
|
|
525
|
-
*
|
|
563
|
+
* **Example** (Creating a stream from a sequence of values)
|
|
564
|
+
*
|
|
526
565
|
* ```ts
|
|
527
566
|
* import { Console, Effect, Stream } from "effect"
|
|
528
567
|
*
|
|
@@ -536,8 +575,8 @@ export const succeed = value => fromChannel(Channel.succeed(Arr.of(value)));
|
|
|
536
575
|
* Effect.runPromise(program)
|
|
537
576
|
* ```
|
|
538
577
|
*
|
|
578
|
+
* @category constructors
|
|
539
579
|
* @since 2.0.0
|
|
540
|
-
* @category Constructors
|
|
541
580
|
*/
|
|
542
581
|
export const make = (...values) => fromArray(values);
|
|
543
582
|
/**
|
|
@@ -545,7 +584,8 @@ export const make = (...values) => fromArray(values);
|
|
|
545
584
|
*
|
|
546
585
|
* The function is evaluated each time the stream is run.
|
|
547
586
|
*
|
|
548
|
-
*
|
|
587
|
+
* **Example** (Evaluating a value synchronously)
|
|
588
|
+
*
|
|
549
589
|
* ```ts
|
|
550
590
|
* import { Console, Effect, Stream } from "effect"
|
|
551
591
|
*
|
|
@@ -558,8 +598,8 @@ export const make = (...values) => fromArray(values);
|
|
|
558
598
|
* // Output: [ 3 ]
|
|
559
599
|
* ```
|
|
560
600
|
*
|
|
601
|
+
* @category constructors
|
|
561
602
|
* @since 2.0.0
|
|
562
|
-
* @category Constructors
|
|
563
603
|
*/
|
|
564
604
|
export const sync = evaluate => fromChannel(Channel.sync(() => Arr.of(evaluate())));
|
|
565
605
|
/**
|
|
@@ -567,7 +607,8 @@ export const sync = evaluate => fromChannel(Channel.sync(() => Arr.of(evaluate()
|
|
|
567
607
|
*
|
|
568
608
|
* The stream factory is evaluated each time the stream is run.
|
|
569
609
|
*
|
|
570
|
-
*
|
|
610
|
+
* **Example** (Creating a lazily constructed stream)
|
|
611
|
+
*
|
|
571
612
|
* ```ts
|
|
572
613
|
* import { Console, Effect, Stream } from "effect"
|
|
573
614
|
*
|
|
@@ -580,14 +621,15 @@ export const sync = evaluate => fromChannel(Channel.sync(() => Arr.of(evaluate()
|
|
|
580
621
|
* // Output: [ 1, 2, 3 ]
|
|
581
622
|
* ```
|
|
582
623
|
*
|
|
624
|
+
* @category constructors
|
|
583
625
|
* @since 2.0.0
|
|
584
|
-
* @category Constructors
|
|
585
626
|
*/
|
|
586
627
|
export const suspend = stream => fromChannel(Channel.suspend(() => stream().channel));
|
|
587
628
|
/**
|
|
588
629
|
* Terminates with the specified error.
|
|
589
630
|
*
|
|
590
|
-
*
|
|
631
|
+
* **Example** (Failing a stream)
|
|
632
|
+
*
|
|
591
633
|
* ```ts
|
|
592
634
|
* import { Console, Effect, Stream } from "effect"
|
|
593
635
|
*
|
|
@@ -601,14 +643,15 @@ export const suspend = stream => fromChannel(Channel.suspend(() => stream().chan
|
|
|
601
643
|
* Effect.runPromise(program)
|
|
602
644
|
* ```
|
|
603
645
|
*
|
|
646
|
+
* @category constructors
|
|
604
647
|
* @since 2.0.0
|
|
605
|
-
* @category Constructors
|
|
606
648
|
*/
|
|
607
649
|
export const fail = error => fromChannel(Channel.fail(error));
|
|
608
650
|
/**
|
|
609
651
|
* Terminates with the specified lazily evaluated error.
|
|
610
652
|
*
|
|
611
|
-
*
|
|
653
|
+
* **Example** (Failing a stream lazily)
|
|
654
|
+
*
|
|
612
655
|
* ```ts
|
|
613
656
|
* import { Console, Effect, Stream } from "effect"
|
|
614
657
|
*
|
|
@@ -624,14 +667,15 @@ export const fail = error => fromChannel(Channel.fail(error));
|
|
|
624
667
|
* // { _id: 'Exit', _tag: 'Failure', cause: { _id: 'Cause', _tag: 'Fail', failure: 'Uh oh!' } }
|
|
625
668
|
* ```
|
|
626
669
|
*
|
|
670
|
+
* @category constructors
|
|
627
671
|
* @since 2.0.0
|
|
628
|
-
* @category Constructors
|
|
629
672
|
*/
|
|
630
673
|
export const failSync = evaluate => fromChannel(Channel.failSync(evaluate));
|
|
631
674
|
/**
|
|
632
675
|
* Creates a stream that fails with the specified `Cause`.
|
|
633
676
|
*
|
|
634
|
-
*
|
|
677
|
+
* **Example** (Failing with a cause)
|
|
678
|
+
*
|
|
635
679
|
* ```ts
|
|
636
680
|
* import { Cause, Console, Effect, Stream } from "effect"
|
|
637
681
|
*
|
|
@@ -648,14 +692,15 @@ export const failSync = evaluate => fromChannel(Channel.failSync(evaluate));
|
|
|
648
692
|
* Effect.runPromise(program)
|
|
649
693
|
* ```
|
|
650
694
|
*
|
|
695
|
+
* @category constructors
|
|
651
696
|
* @since 2.0.0
|
|
652
|
-
* @category Constructors
|
|
653
697
|
*/
|
|
654
698
|
export const failCause = cause => fromChannel(Channel.failCause(cause));
|
|
655
699
|
/**
|
|
656
700
|
* The stream that dies with the specified defect.
|
|
657
701
|
*
|
|
658
|
-
*
|
|
702
|
+
* **Example** (Dying with a defect)
|
|
703
|
+
*
|
|
659
704
|
* ```ts
|
|
660
705
|
* import { Cause, Console, Effect, Exit, Stream } from "effect"
|
|
661
706
|
*
|
|
@@ -679,14 +724,15 @@ export const failCause = cause => fromChannel(Channel.failCause(cause));
|
|
|
679
724
|
* // Output: Exit.Failure(Error: Boom)
|
|
680
725
|
* ```
|
|
681
726
|
*
|
|
727
|
+
* @category constructors
|
|
682
728
|
* @since 2.0.0
|
|
683
|
-
* @category Constructors
|
|
684
729
|
*/
|
|
685
730
|
export const die = defect => fromChannel(Channel.die(defect));
|
|
686
731
|
/**
|
|
687
732
|
* The stream that always fails with the specified lazily evaluated `Cause`.
|
|
688
733
|
*
|
|
689
|
-
*
|
|
734
|
+
* **Example** (Failing with a lazy cause)
|
|
735
|
+
*
|
|
690
736
|
* ```ts
|
|
691
737
|
* import { Cause, Console, Effect, Stream } from "effect"
|
|
692
738
|
*
|
|
@@ -704,8 +750,8 @@ export const die = defect => fromChannel(Channel.die(defect));
|
|
|
704
750
|
* // { _id: 'Exit', _tag: 'Failure', cause: { _id: 'Cause', _tag: 'Fail', failure: 'Connection timeout after retries' } }
|
|
705
751
|
* ```
|
|
706
752
|
*
|
|
753
|
+
* @category constructors
|
|
707
754
|
* @since 2.0.0
|
|
708
|
-
* @category Constructors
|
|
709
755
|
*/
|
|
710
756
|
export const failCauseSync = evaluate => fromChannel(Channel.failCauseSync(evaluate));
|
|
711
757
|
/**
|
|
@@ -713,7 +759,8 @@ export const failCauseSync = evaluate => fromChannel(Channel.failCauseSync(evalu
|
|
|
713
759
|
*
|
|
714
760
|
* The `maxChunkSize` parameter controls how many values are pulled per chunk.
|
|
715
761
|
*
|
|
716
|
-
*
|
|
762
|
+
* **Example** (Consuming values from an iterator)
|
|
763
|
+
*
|
|
717
764
|
* ```ts
|
|
718
765
|
* import { Console, Effect, Stream } from "effect"
|
|
719
766
|
*
|
|
@@ -734,8 +781,8 @@ export const failCauseSync = evaluate => fromChannel(Channel.failCauseSync(evalu
|
|
|
734
781
|
* // Output: [ 1, 2, 3 ]
|
|
735
782
|
* ```
|
|
736
783
|
*
|
|
784
|
+
* @category constructors
|
|
737
785
|
* @since 2.0.0
|
|
738
|
-
* @category Constructors
|
|
739
786
|
*/
|
|
740
787
|
export const fromIteratorSucceed = (iterator, maxChunkSize) => fromChannel(Channel.fromIteratorArray(() => iterator, maxChunkSize));
|
|
741
788
|
/**
|
|
@@ -745,7 +792,8 @@ export const fromIteratorSucceed = (iterator, maxChunkSize) => fromChannel(Chann
|
|
|
745
792
|
*
|
|
746
793
|
* - `chunkSize`: Maximum number of values emitted per chunk.
|
|
747
794
|
*
|
|
748
|
-
*
|
|
795
|
+
* **Example** (Creating a stream from an iterable)
|
|
796
|
+
*
|
|
749
797
|
* ```ts
|
|
750
798
|
* import { Console, Effect, Stream } from "effect"
|
|
751
799
|
*
|
|
@@ -761,16 +809,17 @@ export const fromIteratorSucceed = (iterator, maxChunkSize) => fromChannel(Chann
|
|
|
761
809
|
* // Output: [ 1, 2, 3 ]
|
|
762
810
|
* ```
|
|
763
811
|
*
|
|
812
|
+
* @category constructors
|
|
764
813
|
* @since 2.0.0
|
|
765
|
-
* @category Constructors
|
|
766
814
|
*/
|
|
767
815
|
export const fromIterable = (iterable, options) => Array.isArray(iterable) && options?.chunkSize === undefined ? fromArray(iterable) : fromChannel(Channel.fromIterableArray(iterable, options?.chunkSize));
|
|
768
816
|
/**
|
|
769
817
|
* Creates a stream from an effect producing an iterable of values.
|
|
770
818
|
*
|
|
771
|
-
*
|
|
819
|
+
* **Example** (Creating a stream from an iterable effect)
|
|
820
|
+
*
|
|
772
821
|
* ```ts
|
|
773
|
-
* import { Console,
|
|
822
|
+
* import { Console, Context, Effect, Stream } from "effect"
|
|
774
823
|
*
|
|
775
824
|
* class UserRepo extends Context.Service<UserRepo, {
|
|
776
825
|
* readonly list: Effect.Effect<ReadonlyArray<string>>
|
|
@@ -796,20 +845,15 @@ export const fromIterable = (iterable, options) => Array.isArray(iterable) && op
|
|
|
796
845
|
* // Output: [ "user1", "user2" ]
|
|
797
846
|
* ```
|
|
798
847
|
*
|
|
848
|
+
* @category constructors
|
|
799
849
|
* @since 2.0.0
|
|
800
|
-
* @category Constructors
|
|
801
850
|
*/
|
|
802
851
|
export const fromIterableEffect = iterable => unwrap(Effect.map(iterable, fromIterable));
|
|
803
852
|
/**
|
|
804
853
|
* Creates a stream by repeatedly running an effect that yields an iterable of values.
|
|
805
854
|
*
|
|
806
|
-
* **
|
|
807
|
-
*
|
|
808
|
-
* This API replaces the following from Effect 3.x:
|
|
855
|
+
* **Example** (Repeating an iterable effect)
|
|
809
856
|
*
|
|
810
|
-
* - `Stream.repeatEffectChunk`
|
|
811
|
-
*
|
|
812
|
-
* @example
|
|
813
857
|
* ```ts
|
|
814
858
|
* import { Console, Effect, Stream } from "effect"
|
|
815
859
|
*
|
|
@@ -825,20 +869,15 @@ export const fromIterableEffect = iterable => unwrap(Effect.map(iterable, fromIt
|
|
|
825
869
|
* // Output: [ 1, 2, 1, 2, 1 ]
|
|
826
870
|
* ```
|
|
827
871
|
*
|
|
872
|
+
* @category constructors
|
|
828
873
|
* @since 4.0.0
|
|
829
|
-
* @category Constructors
|
|
830
874
|
*/
|
|
831
875
|
export const fromIterableEffectRepeat = iterable => flatMap(fromEffectRepeat(iterable), fromIterable);
|
|
832
876
|
/**
|
|
833
877
|
* Creates a stream from an array of values.
|
|
834
878
|
*
|
|
835
|
-
* **
|
|
836
|
-
*
|
|
837
|
-
* This API replaces the following from Effect 3.x:
|
|
879
|
+
* **Example** (Creating a stream from an array of values)
|
|
838
880
|
*
|
|
839
|
-
* - `Stream.fromChunk`
|
|
840
|
-
*
|
|
841
|
-
* @example
|
|
842
881
|
* ```ts
|
|
843
882
|
* import { Console, Effect, Stream } from "effect"
|
|
844
883
|
*
|
|
@@ -852,14 +891,15 @@ export const fromIterableEffectRepeat = iterable => flatMap(fromEffectRepeat(ite
|
|
|
852
891
|
* // Output: [ 1, 2, 3 ]
|
|
853
892
|
* ```
|
|
854
893
|
*
|
|
894
|
+
* @category constructors
|
|
855
895
|
* @since 4.0.0
|
|
856
|
-
* @category Constructors
|
|
857
896
|
*/
|
|
858
897
|
export const fromArray = array => Arr.isReadonlyArrayNonEmpty(array) ? fromChannel(Channel.succeed(array)) : empty;
|
|
859
898
|
/**
|
|
860
899
|
* Creates a stream from an effect that produces an array of values.
|
|
861
900
|
*
|
|
862
|
-
*
|
|
901
|
+
* **Example** (Creating a stream from an effect that produces an array of values)
|
|
902
|
+
*
|
|
863
903
|
* ```ts
|
|
864
904
|
* import { Console, Effect, Stream } from "effect"
|
|
865
905
|
*
|
|
@@ -873,20 +913,15 @@ export const fromArray = array => Arr.isReadonlyArrayNonEmpty(array) ? fromChann
|
|
|
873
913
|
* // Output: [ "Ada", "Grace" ]
|
|
874
914
|
* ```
|
|
875
915
|
*
|
|
916
|
+
* @category constructors
|
|
876
917
|
* @since 4.0.0
|
|
877
|
-
* @category Constructors
|
|
878
918
|
*/
|
|
879
919
|
export const fromArrayEffect = effect => unwrap(Effect.map(effect, fromArray));
|
|
880
920
|
/**
|
|
881
921
|
* Creates a stream from an arbitrary number of arrays.
|
|
882
922
|
*
|
|
883
|
-
* **
|
|
923
|
+
* **Example** (Creating a stream from an arbitrary number of arrays)
|
|
884
924
|
*
|
|
885
|
-
* This API replaces the following from Effect 3.x:
|
|
886
|
-
*
|
|
887
|
-
* - `Stream.fromChunks`
|
|
888
|
-
*
|
|
889
|
-
* @example
|
|
890
925
|
* ```ts
|
|
891
926
|
* import { Console, Effect, Stream } from "effect"
|
|
892
927
|
*
|
|
@@ -900,19 +935,18 @@ export const fromArrayEffect = effect => unwrap(Effect.map(effect, fromArray));
|
|
|
900
935
|
* // Output: [ 1, 2, 3, 4 ]
|
|
901
936
|
* ```
|
|
902
937
|
*
|
|
938
|
+
* @category constructors
|
|
903
939
|
* @since 4.0.0
|
|
904
|
-
* @category Constructors
|
|
905
940
|
*/
|
|
906
941
|
export const fromArrays = (...arrays) => fromChannel(Channel.fromArray(Arr.filter(arrays, Arr.isReadonlyArrayNonEmpty)));
|
|
907
942
|
/**
|
|
908
|
-
* Creates a stream from a
|
|
943
|
+
* Creates a stream that pulls values from a `Queue.Dequeue`.
|
|
909
944
|
*
|
|
910
|
-
*
|
|
945
|
+
* The stream emits non-empty batches of queued values and ends when the queue
|
|
946
|
+
* fails with `Cause.Done`; other queue failures are propagated.
|
|
911
947
|
*
|
|
912
|
-
*
|
|
913
|
-
* - `shutdown`: If `true`, the queue will be shutdown after the stream is evaluated (defaults to `false`)
|
|
948
|
+
* **Example** (Creating a stream from a queue of values)
|
|
914
949
|
*
|
|
915
|
-
* @example
|
|
916
950
|
* ```ts
|
|
917
951
|
* import { Console, Effect, Queue, Stream } from "effect"
|
|
918
952
|
*
|
|
@@ -932,14 +966,15 @@ export const fromArrays = (...arrays) => fromChannel(Channel.fromArray(Arr.filte
|
|
|
932
966
|
* // Output: [ 1, 2, 3 ]
|
|
933
967
|
* ```
|
|
934
968
|
*
|
|
935
|
-
* @
|
|
936
|
-
* @
|
|
969
|
+
* @category constructors
|
|
970
|
+
* @since 2.0.0
|
|
937
971
|
*/
|
|
938
972
|
export const fromQueue = queue => fromChannel(Channel.fromQueueArray(queue));
|
|
939
973
|
/**
|
|
940
974
|
* Creates a stream from a subscription to a `PubSub`.
|
|
941
975
|
*
|
|
942
|
-
*
|
|
976
|
+
* **Example** (Creating a stream from a subscription to a PubSub)
|
|
977
|
+
*
|
|
943
978
|
* ```ts
|
|
944
979
|
* import { Console, Effect, Fiber, PubSub, Stream } from "effect"
|
|
945
980
|
*
|
|
@@ -964,8 +999,8 @@ export const fromQueue = queue => fromChannel(Channel.fromQueueArray(queue));
|
|
|
964
999
|
* // Output: [ 1, 2, 3 ]
|
|
965
1000
|
* ```
|
|
966
1001
|
*
|
|
967
|
-
* @
|
|
968
|
-
* @
|
|
1002
|
+
* @category constructors
|
|
1003
|
+
* @since 2.0.0
|
|
969
1004
|
*/
|
|
970
1005
|
export const fromPubSub = pubsub => fromChannel(Channel.fromPubSubArray(pubsub));
|
|
971
1006
|
/**
|
|
@@ -973,7 +1008,8 @@ export const fromPubSub = pubsub => fromChannel(Channel.fromPubSubArray(pubsub))
|
|
|
973
1008
|
*
|
|
974
1009
|
* `Take` values include end and failure signals.
|
|
975
1010
|
*
|
|
976
|
-
*
|
|
1011
|
+
* **Example** (Creating a stream from PubSub takes)
|
|
1012
|
+
*
|
|
977
1013
|
* ```ts
|
|
978
1014
|
* import { Console, Effect, Exit, PubSub, Stream, Take } from "effect"
|
|
979
1015
|
*
|
|
@@ -994,16 +1030,19 @@ export const fromPubSub = pubsub => fromChannel(Channel.fromPubSubArray(pubsub))
|
|
|
994
1030
|
* // Output: [ 1, 2 ]
|
|
995
1031
|
* ```
|
|
996
1032
|
*
|
|
1033
|
+
* @category constructors
|
|
997
1034
|
* @since 4.0.0
|
|
998
|
-
* @category Constructors
|
|
999
1035
|
*/
|
|
1000
1036
|
export const fromPubSubTake = pubsub => fromChannel(Channel.fromPubSubTake(pubsub));
|
|
1001
1037
|
/**
|
|
1002
|
-
* Creates a stream from a `ReadableStream`.
|
|
1038
|
+
* Creates a stream from a lazily supplied Web `ReadableStream`.
|
|
1003
1039
|
*
|
|
1004
|
-
*
|
|
1040
|
+
* The stream reads from a `ReadableStreamDefaultReader`, maps read failures
|
|
1041
|
+
* with `onError`, and closes the reader when the stream finalizes. By default
|
|
1042
|
+
* the reader is canceled; set `releaseLockOnEnd` to release the lock instead.
|
|
1043
|
+
*
|
|
1044
|
+
* **Example** (Creating a stream from a ReadableStream)
|
|
1005
1045
|
*
|
|
1006
|
-
* @example
|
|
1007
1046
|
* ```ts
|
|
1008
1047
|
* import { Console, Data, Effect, Stream } from "effect"
|
|
1009
1048
|
*
|
|
@@ -1031,8 +1070,8 @@ export const fromPubSubTake = pubsub => fromChannel(Channel.fromPubSubTake(pubsu
|
|
|
1031
1070
|
* // Output: [ 1, 2, 3 ]
|
|
1032
1071
|
* ```
|
|
1033
1072
|
*
|
|
1073
|
+
* @category constructors
|
|
1034
1074
|
* @since 2.0.0
|
|
1035
|
-
* @category Constructors
|
|
1036
1075
|
*/
|
|
1037
1076
|
export const fromReadableStream = options => fromChannel(Channel.fromTransform(Effect.fnUntraced(function* (_, scope) {
|
|
1038
1077
|
const reader = options.evaluate().getReader();
|
|
@@ -1048,9 +1087,10 @@ export const fromReadableStream = options => fromChannel(Channel.fromTransform(E
|
|
|
1048
1087
|
/**
|
|
1049
1088
|
* Creates a stream from an AsyncIterable.
|
|
1050
1089
|
*
|
|
1051
|
-
*
|
|
1090
|
+
* **Example** (Creating a stream from an AsyncIterable)
|
|
1091
|
+
*
|
|
1052
1092
|
* ```ts
|
|
1053
|
-
* import {
|
|
1093
|
+
* import { Data, Effect, Stream } from "effect"
|
|
1054
1094
|
*
|
|
1055
1095
|
* class StreamError extends Data.TaggedError("StreamError")<{ readonly cause: unknown }> {}
|
|
1056
1096
|
*
|
|
@@ -1060,25 +1100,25 @@ export const fromReadableStream = options => fromChannel(Channel.fromTransform(E
|
|
|
1060
1100
|
* yield 3
|
|
1061
1101
|
* })()
|
|
1062
1102
|
*
|
|
1063
|
-
*
|
|
1103
|
+
* Effect.runPromise(Effect.gen(function*() {
|
|
1064
1104
|
* const stream = Stream.fromAsyncIterable(iterable, (cause) => new StreamError({ cause }))
|
|
1065
1105
|
* const values = yield* Stream.runCollect(stream)
|
|
1066
|
-
* yield*
|
|
1067
|
-
* })
|
|
1106
|
+
* yield* Effect.sync(() => console.log(values))
|
|
1107
|
+
* }))
|
|
1068
1108
|
*
|
|
1069
|
-
*
|
|
1070
|
-
* // Output: [ 1, 2, 3 ]
|
|
1109
|
+
* // [ 1, 2, 3 ]
|
|
1071
1110
|
* ```
|
|
1072
1111
|
*
|
|
1112
|
+
* @category constructors
|
|
1073
1113
|
* @since 2.0.0
|
|
1074
|
-
* @category Constructors
|
|
1075
1114
|
*/
|
|
1076
1115
|
export const fromAsyncIterable = (iterable, onError) => fromChannel(Channel.fromAsyncIterableArray(iterable, onError));
|
|
1077
1116
|
/**
|
|
1078
1117
|
* Creates a stream that emits each output of a schedule that does not require input,
|
|
1079
1118
|
* for as long as the schedule continues.
|
|
1080
1119
|
*
|
|
1081
|
-
*
|
|
1120
|
+
* **Example** (Creating a stream from a schedule)
|
|
1121
|
+
*
|
|
1082
1122
|
* ```ts
|
|
1083
1123
|
* import { Console, Effect, Schedule, Stream } from "effect"
|
|
1084
1124
|
*
|
|
@@ -1095,8 +1135,8 @@ export const fromAsyncIterable = (iterable, onError) => fromChannel(Channel.from
|
|
|
1095
1135
|
* // Output: [ 0, 1, 2 ]
|
|
1096
1136
|
* ```
|
|
1097
1137
|
*
|
|
1138
|
+
* @category constructors
|
|
1098
1139
|
* @since 2.0.0
|
|
1099
|
-
* @category Constructors
|
|
1100
1140
|
*/
|
|
1101
1141
|
export const fromSchedule = schedule => fromPull(Effect.map(Schedule.toStepWithSleep(schedule), step => Pull.catchDone(Effect.map(step(void 0), Arr.of), () => Cause.done())));
|
|
1102
1142
|
/**
|
|
@@ -1105,7 +1145,8 @@ export const fromSchedule = schedule => fromPull(Effect.map(Schedule.toStepWithS
|
|
|
1105
1145
|
* Use `PubSub.subscribe` to create the subscription and `Stream.take` or
|
|
1106
1146
|
* cancellation to control how many values are consumed.
|
|
1107
1147
|
*
|
|
1108
|
-
*
|
|
1148
|
+
* **Example** (Creating a stream from a PubSub subscription)
|
|
1149
|
+
*
|
|
1109
1150
|
* ```ts
|
|
1110
1151
|
* import { Console, Effect, PubSub, Stream } from "effect"
|
|
1111
1152
|
*
|
|
@@ -1125,33 +1166,42 @@ export const fromSchedule = schedule => fromPull(Effect.map(Schedule.toStepWithS
|
|
|
1125
1166
|
* // Output: [ 1, 2 ]
|
|
1126
1167
|
* ```
|
|
1127
1168
|
*
|
|
1169
|
+
* @category constructors
|
|
1128
1170
|
* @since 4.0.0
|
|
1129
|
-
* @category Constructors
|
|
1130
1171
|
*/
|
|
1131
1172
|
export const fromSubscription = pubsub => fromChannel(Channel.fromSubscriptionArray(pubsub));
|
|
1132
1173
|
/**
|
|
1133
1174
|
* Creates a stream from an event listener.
|
|
1134
1175
|
*
|
|
1135
|
-
*
|
|
1176
|
+
* **Example** (Creating a stream from an event listener)
|
|
1177
|
+
*
|
|
1136
1178
|
* ```ts
|
|
1137
|
-
* import {
|
|
1179
|
+
* import { Effect, Stream } from "effect"
|
|
1138
1180
|
*
|
|
1139
|
-
*
|
|
1181
|
+
* class NumberTarget implements Stream.EventListener<number> {
|
|
1182
|
+
* addEventListener(event: string, f: (event: number) => void) {
|
|
1183
|
+
* if (event === "data") {
|
|
1184
|
+
* f(1)
|
|
1185
|
+
* f(2)
|
|
1186
|
+
* f(3)
|
|
1187
|
+
* }
|
|
1188
|
+
* }
|
|
1189
|
+
* removeEventListener(_event: string, _f: (event: number) => void) {}
|
|
1190
|
+
* }
|
|
1140
1191
|
*
|
|
1141
|
-
*
|
|
1142
|
-
* const stream = Stream.fromEventListener(
|
|
1192
|
+
* Effect.runPromise(Effect.gen(function*() {
|
|
1193
|
+
* const stream = Stream.fromEventListener(new NumberTarget(), "data").pipe(
|
|
1143
1194
|
* Stream.take(3)
|
|
1144
1195
|
* )
|
|
1145
1196
|
* const values = yield* Stream.runCollect(stream)
|
|
1146
|
-
* yield*
|
|
1147
|
-
* })
|
|
1197
|
+
* yield* Effect.sync(() => console.log(values))
|
|
1198
|
+
* }))
|
|
1148
1199
|
*
|
|
1149
|
-
*
|
|
1150
|
-
* // Output: [ 1, 2, 3 ]
|
|
1200
|
+
* // [ 1, 2, 3 ]
|
|
1151
1201
|
* ```
|
|
1152
1202
|
*
|
|
1203
|
+
* @category constructors
|
|
1153
1204
|
* @since 3.1.0
|
|
1154
|
-
* @category Constructors
|
|
1155
1205
|
*/
|
|
1156
1206
|
export const fromEventListener = (target, type, options) => callback(queue => {
|
|
1157
1207
|
function emit(event) {
|
|
@@ -1162,9 +1212,14 @@ export const fromEventListener = (target, type, options) => callback(queue => {
|
|
|
1162
1212
|
bufferSize: typeof options === "object" ? options.bufferSize : undefined
|
|
1163
1213
|
});
|
|
1164
1214
|
/**
|
|
1165
|
-
* Creates a stream by
|
|
1215
|
+
* Creates a stream by repeatedly applying an effectful step function to a
|
|
1216
|
+
* state.
|
|
1217
|
+
*
|
|
1218
|
+
* Each `readonly [value, nextState]` result emits `value` and continues with
|
|
1219
|
+
* `nextState`; returning `undefined` ends the stream.
|
|
1220
|
+
*
|
|
1221
|
+
* **Example** (Unfolding stream state)
|
|
1166
1222
|
*
|
|
1167
|
-
* @example
|
|
1168
1223
|
* ```ts
|
|
1169
1224
|
* import { Console, Effect, Stream } from "effect"
|
|
1170
1225
|
*
|
|
@@ -1178,8 +1233,8 @@ export const fromEventListener = (target, type, options) => callback(queue => {
|
|
|
1178
1233
|
* // Output: [ 1, 2, 3, 4, 5 ]
|
|
1179
1234
|
* ```
|
|
1180
1235
|
*
|
|
1236
|
+
* @category constructors
|
|
1181
1237
|
* @since 2.0.0
|
|
1182
|
-
* @category Constructors
|
|
1183
1238
|
*/
|
|
1184
1239
|
export const unfold = (s, f) => fromPull(Effect.sync(() => {
|
|
1185
1240
|
let state = s;
|
|
@@ -1194,10 +1249,10 @@ export const unfold = (s, f) => fromPull(Effect.sync(() => {
|
|
|
1194
1249
|
* than the unfolding of the state. This is useful for embedding paginated APIs,
|
|
1195
1250
|
* hence the name.
|
|
1196
1251
|
*
|
|
1197
|
-
*
|
|
1252
|
+
* **Example** (Paginating stream state)
|
|
1253
|
+
*
|
|
1198
1254
|
* ```ts
|
|
1199
|
-
* import { Console, Effect, Stream } from "effect"
|
|
1200
|
-
* import * as Option from "effect/Option"
|
|
1255
|
+
* import { Console, Effect, Option, Stream } from "effect"
|
|
1201
1256
|
*
|
|
1202
1257
|
* const stream = Stream.paginate(0, (n: number) =>
|
|
1203
1258
|
* Effect.succeed(
|
|
@@ -1211,8 +1266,8 @@ export const unfold = (s, f) => fromPull(Effect.sync(() => {
|
|
|
1211
1266
|
* // Output: [ 0, 1, 2, 3 ]
|
|
1212
1267
|
* ```
|
|
1213
1268
|
*
|
|
1269
|
+
* @category constructors
|
|
1214
1270
|
* @since 2.0.0
|
|
1215
|
-
* @category Constructors
|
|
1216
1271
|
*/
|
|
1217
1272
|
export const paginate = (s, f) => fromPull(Effect.sync(() => {
|
|
1218
1273
|
let state = s;
|
|
@@ -1233,7 +1288,8 @@ export const paginate = (s, f) => fromPull(Effect.sync(() => {
|
|
|
1233
1288
|
/**
|
|
1234
1289
|
* Creates an infinite stream by repeatedly applying a function to a seed value.
|
|
1235
1290
|
*
|
|
1236
|
-
*
|
|
1291
|
+
* **Example** (Iterating from a seed value)
|
|
1292
|
+
*
|
|
1237
1293
|
* ```ts
|
|
1238
1294
|
* import { Console, Effect, Stream } from "effect"
|
|
1239
1295
|
*
|
|
@@ -1248,8 +1304,8 @@ export const paginate = (s, f) => fromPull(Effect.sync(() => {
|
|
|
1248
1304
|
* // Output: [ 1, 2, 3 ]
|
|
1249
1305
|
* ```
|
|
1250
1306
|
*
|
|
1307
|
+
* @category constructors
|
|
1251
1308
|
* @since 2.0.0
|
|
1252
|
-
* @category Constructors
|
|
1253
1309
|
*/
|
|
1254
1310
|
export const iterate = (value, next) => unfold(value, a => Effect.succeed([a, next(a)]));
|
|
1255
1311
|
/**
|
|
@@ -1258,7 +1314,8 @@ export const iterate = (value, next) => unfold(value, a => Effect.succeed([a, ne
|
|
|
1258
1314
|
* If the provided `min` is greater than `max`, the stream will not emit any
|
|
1259
1315
|
* values.
|
|
1260
1316
|
*
|
|
1261
|
-
*
|
|
1317
|
+
* **Example** (Creating a numeric range)
|
|
1318
|
+
*
|
|
1262
1319
|
* ```ts
|
|
1263
1320
|
* import { Console, Effect, Stream } from "effect"
|
|
1264
1321
|
*
|
|
@@ -1270,8 +1327,8 @@ export const iterate = (value, next) => unfold(value, a => Effect.succeed([a, ne
|
|
|
1270
1327
|
* Effect.runPromise(program)
|
|
1271
1328
|
* // Output: [ 1, 2, 3, 4, 5 ]
|
|
1272
1329
|
* ```
|
|
1273
|
-
* @
|
|
1274
|
-
* @
|
|
1330
|
+
* @category constructors
|
|
1331
|
+
* @since 2.0.0
|
|
1275
1332
|
*/
|
|
1276
1333
|
export const range = (min, max, chunkSize = Channel.DefaultChunkSize) => min > max ? empty : fromPull(Effect.sync(() => {
|
|
1277
1334
|
let start = min;
|
|
@@ -1292,7 +1349,8 @@ export const range = (min, max, chunkSize = Channel.DefaultChunkSize) => min > m
|
|
|
1292
1349
|
/**
|
|
1293
1350
|
* The stream that never produces any value or fails with any error.
|
|
1294
1351
|
*
|
|
1295
|
-
*
|
|
1352
|
+
* **Example** (Creating a never-ending stream)
|
|
1353
|
+
*
|
|
1296
1354
|
* ```ts
|
|
1297
1355
|
* import { Effect, Stream } from "effect"
|
|
1298
1356
|
*
|
|
@@ -1305,14 +1363,15 @@ export const range = (min, max, chunkSize = Channel.DefaultChunkSize) => min > m
|
|
|
1305
1363
|
* // []
|
|
1306
1364
|
* ```
|
|
1307
1365
|
*
|
|
1308
|
-
* @
|
|
1309
|
-
* @
|
|
1366
|
+
* @category constructors
|
|
1367
|
+
* @since 2.0.0
|
|
1310
1368
|
*/
|
|
1311
1369
|
export const never = /*#__PURE__*/fromChannel(Channel.never);
|
|
1312
1370
|
/**
|
|
1313
1371
|
* Creates a stream produced from an `Effect`.
|
|
1314
1372
|
*
|
|
1315
|
-
*
|
|
1373
|
+
* **Example** (Unwrapping a stream effect)
|
|
1374
|
+
*
|
|
1316
1375
|
* ```ts
|
|
1317
1376
|
* import { Console, Effect, Stream } from "effect"
|
|
1318
1377
|
*
|
|
@@ -1327,15 +1386,16 @@ export const never = /*#__PURE__*/fromChannel(Channel.never);
|
|
|
1327
1386
|
* // [1, 2, 3]
|
|
1328
1387
|
* ```
|
|
1329
1388
|
*
|
|
1389
|
+
* @category constructors
|
|
1330
1390
|
* @since 2.0.0
|
|
1331
|
-
* @category Constructors
|
|
1332
1391
|
*/
|
|
1333
1392
|
export const unwrap = effect => fromChannel(Channel.unwrap(Effect.map(effect, toChannel)));
|
|
1334
1393
|
/**
|
|
1335
1394
|
* Runs a stream that requires `Scope` in a managed scope, ensuring its
|
|
1336
1395
|
* finalizers are run when the stream completes.
|
|
1337
1396
|
*
|
|
1338
|
-
*
|
|
1397
|
+
* **Example** (Scoping a stream)
|
|
1398
|
+
*
|
|
1339
1399
|
* ```ts
|
|
1340
1400
|
* import { Console, Effect, Stream } from "effect"
|
|
1341
1401
|
*
|
|
@@ -1354,14 +1414,15 @@ export const unwrap = effect => fromChannel(Channel.unwrap(Effect.map(effect, to
|
|
|
1354
1414
|
* // [ "resource" ]
|
|
1355
1415
|
* ```
|
|
1356
1416
|
*
|
|
1417
|
+
* @category constructors
|
|
1357
1418
|
* @since 2.0.0
|
|
1358
|
-
* @category Constructors
|
|
1359
1419
|
*/
|
|
1360
1420
|
export const scoped = self => fromChannel(Channel.scoped(self.channel));
|
|
1361
1421
|
/**
|
|
1362
1422
|
* Transforms the elements of this stream using the supplied function.
|
|
1363
1423
|
*
|
|
1364
|
-
*
|
|
1424
|
+
* **Example** (Mapping stream values)
|
|
1425
|
+
*
|
|
1365
1426
|
* ```ts
|
|
1366
1427
|
* import { Console, Effect, Stream } from "effect"
|
|
1367
1428
|
*
|
|
@@ -1374,8 +1435,8 @@ export const scoped = self => fromChannel(Channel.scoped(self.channel));
|
|
|
1374
1435
|
* // [ 1, 3, 5 ]
|
|
1375
1436
|
* ```
|
|
1376
1437
|
*
|
|
1438
|
+
* @category mapping
|
|
1377
1439
|
* @since 2.0.0
|
|
1378
|
-
* @category Mapping
|
|
1379
1440
|
*/
|
|
1380
1441
|
export const map = /*#__PURE__*/dual(2, (self, f) => suspend(() => {
|
|
1381
1442
|
let i = 0;
|
|
@@ -1384,7 +1445,8 @@ export const map = /*#__PURE__*/dual(2, (self, f) => suspend(() => {
|
|
|
1384
1445
|
/**
|
|
1385
1446
|
* Maps both the failure and success channels of a stream.
|
|
1386
1447
|
*
|
|
1387
|
-
*
|
|
1448
|
+
* **Example** (Mapping both the failure and success channels of a stream)
|
|
1449
|
+
*
|
|
1388
1450
|
* ```ts
|
|
1389
1451
|
* import { Console, Effect, Stream } from "effect"
|
|
1390
1452
|
*
|
|
@@ -1413,20 +1475,15 @@ export const map = /*#__PURE__*/dual(2, (self, f) => suspend(() => {
|
|
|
1413
1475
|
* // Output: [ "error: boom" ]
|
|
1414
1476
|
* ```
|
|
1415
1477
|
*
|
|
1478
|
+
* @category mapping
|
|
1416
1479
|
* @since 2.0.0
|
|
1417
|
-
* @category Mapping
|
|
1418
1480
|
*/
|
|
1419
1481
|
export const mapBoth = /*#__PURE__*/dual(2, (self, options) => self.pipe(map(options.onSuccess), mapError(options.onFailure)));
|
|
1420
1482
|
/**
|
|
1421
1483
|
* Transforms each emitted chunk using the provided function, which receives the chunk and its index.
|
|
1422
1484
|
*
|
|
1423
|
-
* **
|
|
1424
|
-
*
|
|
1425
|
-
* This API replaces the following from Effect 3.x:
|
|
1485
|
+
* **Example** (Mapping stream chunks)
|
|
1426
1486
|
*
|
|
1427
|
-
* - `Stream.mapChunks`
|
|
1428
|
-
*
|
|
1429
|
-
* @example
|
|
1430
1487
|
* ```ts
|
|
1431
1488
|
* import { Array, Console, Effect, Stream } from "effect"
|
|
1432
1489
|
*
|
|
@@ -1443,14 +1500,15 @@ export const mapBoth = /*#__PURE__*/dual(2, (self, options) => self.pipe(map(opt
|
|
|
1443
1500
|
* // Output: [ 1, 2, 4, 5 ]
|
|
1444
1501
|
* ```
|
|
1445
1502
|
*
|
|
1446
|
-
* @
|
|
1447
|
-
* @
|
|
1503
|
+
* @category mapping
|
|
1504
|
+
* @since 4.0.0
|
|
1448
1505
|
*/
|
|
1449
1506
|
export const mapArray = /*#__PURE__*/dual(2, (self, f) => fromChannel(Channel.map(self.channel, f)));
|
|
1450
1507
|
/**
|
|
1451
1508
|
* Maps over elements of the stream with the specified effectful function.
|
|
1452
1509
|
*
|
|
1453
|
-
*
|
|
1510
|
+
* **Example** (Effectfully mapping stream values)
|
|
1511
|
+
*
|
|
1454
1512
|
* ```ts
|
|
1455
1513
|
* import { Console, Effect, Stream } from "effect"
|
|
1456
1514
|
*
|
|
@@ -1478,14 +1536,15 @@ export const mapArray = /*#__PURE__*/dual(2, (self, f) => fromChannel(Channel.ma
|
|
|
1478
1536
|
* // [2, 4, 6]
|
|
1479
1537
|
* ```
|
|
1480
1538
|
*
|
|
1539
|
+
* @category mapping
|
|
1481
1540
|
* @since 2.0.0
|
|
1482
|
-
* @category Mapping
|
|
1483
1541
|
*/
|
|
1484
1542
|
export const mapEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self, f, options) => self.channel.pipe(Channel.flattenArray, Channel.mapEffect(f, options), Channel.map(Arr.of), fromChannel));
|
|
1485
1543
|
/**
|
|
1486
1544
|
* Flattens a stream of `Effect` values into a stream of their results.
|
|
1487
1545
|
*
|
|
1488
|
-
*
|
|
1546
|
+
* **Example** (Flattening a stream of Effect values into a stream of their results)
|
|
1547
|
+
*
|
|
1489
1548
|
* ```ts
|
|
1490
1549
|
* import { Console, Effect, Stream } from "effect"
|
|
1491
1550
|
*
|
|
@@ -1500,20 +1559,15 @@ export const mapEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self, f,
|
|
|
1500
1559
|
* // Output: [1, 2, 3]
|
|
1501
1560
|
* ```
|
|
1502
1561
|
*
|
|
1562
|
+
* @category mapping
|
|
1503
1563
|
* @since 2.0.0
|
|
1504
|
-
* @category Mapping
|
|
1505
1564
|
*/
|
|
1506
1565
|
export const flattenEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self, options) => mapEffect(self, identity, options));
|
|
1507
1566
|
/**
|
|
1508
1567
|
* Effectfully maps over non-empty array chunks emitted by the stream.
|
|
1509
1568
|
*
|
|
1510
|
-
* **
|
|
1511
|
-
*
|
|
1512
|
-
* This API replaces the following from Effect 3.x:
|
|
1569
|
+
* **Example** (Effectfully mapping stream chunks)
|
|
1513
1570
|
*
|
|
1514
|
-
* - `Stream.mapChunksEffect`
|
|
1515
|
-
*
|
|
1516
|
-
* @example
|
|
1517
1571
|
* ```ts
|
|
1518
1572
|
* import { Array, Console, Effect, Stream } from "effect"
|
|
1519
1573
|
*
|
|
@@ -1532,8 +1586,8 @@ export const flattenEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self,
|
|
|
1532
1586
|
* // Output: [1, 2, 13, 14]
|
|
1533
1587
|
* ```
|
|
1534
1588
|
*
|
|
1589
|
+
* @category mapping
|
|
1535
1590
|
* @since 4.0.0
|
|
1536
|
-
* @category Mapping
|
|
1537
1591
|
*/
|
|
1538
1592
|
export const mapArrayEffect = /*#__PURE__*/dual(2, (self, f) => fromChannel(Channel.mapEffect(self.channel, f)));
|
|
1539
1593
|
/**
|
|
@@ -1541,13 +1595,8 @@ export const mapArrayEffect = /*#__PURE__*/dual(2, (self, f) => fromChannel(Chan
|
|
|
1541
1595
|
*
|
|
1542
1596
|
* The stream ends after the first failure, emitting a `Result.fail` value.
|
|
1543
1597
|
*
|
|
1544
|
-
* **
|
|
1545
|
-
*
|
|
1546
|
-
* This API replaces the following from Effect 3.x:
|
|
1598
|
+
* **Example** (Converting failures to results)
|
|
1547
1599
|
*
|
|
1548
|
-
* - `Stream.either`
|
|
1549
|
-
*
|
|
1550
|
-
* @example
|
|
1551
1600
|
* ```ts
|
|
1552
1601
|
* import { Console, Effect, Result, Stream } from "effect"
|
|
1553
1602
|
*
|
|
@@ -1568,14 +1617,15 @@ export const mapArrayEffect = /*#__PURE__*/dual(2, (self, f) => fromChannel(Chan
|
|
|
1568
1617
|
* // Output: [ "success: 1", "success: 2", "failure: boom" ]
|
|
1569
1618
|
* ```
|
|
1570
1619
|
*
|
|
1620
|
+
* @category error handling
|
|
1571
1621
|
* @since 4.0.0
|
|
1572
|
-
* @category Error Handling
|
|
1573
1622
|
*/
|
|
1574
1623
|
export const result = self => self.pipe(map(Result.succeed), catch_(e => succeed(Result.fail(e))));
|
|
1575
1624
|
/**
|
|
1576
1625
|
* Runs the provided effect for each element while preserving the elements.
|
|
1577
1626
|
*
|
|
1578
|
-
*
|
|
1627
|
+
* **Example** (Tapping stream values)
|
|
1628
|
+
*
|
|
1579
1629
|
* ```ts
|
|
1580
1630
|
* import { Console, Effect, Stream } from "effect"
|
|
1581
1631
|
*
|
|
@@ -1601,14 +1651,15 @@ export const result = self => self.pipe(map(Result.succeed), catch_(e => succeed
|
|
|
1601
1651
|
* // [ 2, 4, 6 ]
|
|
1602
1652
|
* ```
|
|
1603
1653
|
*
|
|
1654
|
+
* @category sequencing
|
|
1604
1655
|
* @since 2.0.0
|
|
1605
|
-
* @category Sequencing
|
|
1606
1656
|
*/
|
|
1607
1657
|
export const tap = /*#__PURE__*/dual(args => isStream(args[0]), (self, f, options) => mapEffect(self, a => Effect.as(f(a), a), options));
|
|
1608
1658
|
/**
|
|
1609
1659
|
* Returns a stream that effectfully "peeks" at elements and failures.
|
|
1610
1660
|
*
|
|
1611
|
-
*
|
|
1661
|
+
* **Example** (Tapping values and errors)
|
|
1662
|
+
*
|
|
1612
1663
|
* ```ts
|
|
1613
1664
|
* import { Console, Effect, Stream } from "effect"
|
|
1614
1665
|
*
|
|
@@ -1633,8 +1684,8 @@ export const tap = /*#__PURE__*/dual(args => isStream(args[0]), (self, f, option
|
|
|
1633
1684
|
* // [ 1, 2, 3 ]
|
|
1634
1685
|
* ```
|
|
1635
1686
|
*
|
|
1687
|
+
* @category sequencing
|
|
1636
1688
|
* @since 2.0.0
|
|
1637
|
-
* @category Sequencing
|
|
1638
1689
|
*/
|
|
1639
1690
|
export const tapBoth = /*#__PURE__*/dual(2, (self, options) => self.pipe(tapError(options.onError), tap(options.onElement, {
|
|
1640
1691
|
concurrency: options.concurrency
|
|
@@ -1643,7 +1694,8 @@ export const tapBoth = /*#__PURE__*/dual(2, (self, options) => self.pipe(tapErro
|
|
|
1643
1694
|
* Sends all elements emitted by this stream to the specified sink in addition
|
|
1644
1695
|
* to emitting them.
|
|
1645
1696
|
*
|
|
1646
|
-
*
|
|
1697
|
+
* **Example** (Tapping values with a sink)
|
|
1698
|
+
*
|
|
1647
1699
|
* ```ts
|
|
1648
1700
|
* import { Console, Effect, Ref, Sink, Stream } from "effect"
|
|
1649
1701
|
*
|
|
@@ -1666,8 +1718,8 @@ export const tapBoth = /*#__PURE__*/dual(2, (self, options) => self.pipe(tapErro
|
|
|
1666
1718
|
* // Output: [1, 2, 3]
|
|
1667
1719
|
* ```
|
|
1668
1720
|
*
|
|
1721
|
+
* @category sequencing
|
|
1669
1722
|
* @since 2.0.0
|
|
1670
|
-
* @category Sequencing
|
|
1671
1723
|
*/
|
|
1672
1724
|
export const tapSink = /*#__PURE__*/dual(2, (self, sink) => transformPullBracket(self, Effect.fnUntraced(function* (pull, _, scope) {
|
|
1673
1725
|
const upstreamLatch = Latch.makeUnsafe();
|
|
@@ -1713,9 +1765,15 @@ export const tapSink = /*#__PURE__*/dual(2, (self, sink) => transformPullBracket
|
|
|
1713
1765
|
});
|
|
1714
1766
|
})));
|
|
1715
1767
|
/**
|
|
1716
|
-
* Maps each element to a stream and
|
|
1768
|
+
* Maps each element to a stream and flattens the resulting streams.
|
|
1769
|
+
*
|
|
1770
|
+
* With the default sequential concurrency, inner streams are concatenated in
|
|
1771
|
+
* input order. When `concurrency` is greater than `1` or `"unbounded"`,
|
|
1772
|
+
* multiple inner streams may run at the same time and their outputs are merged
|
|
1773
|
+
* as they arrive.
|
|
1774
|
+
*
|
|
1775
|
+
* **Example** (FlatMapping stream values)
|
|
1717
1776
|
*
|
|
1718
|
-
* @example
|
|
1719
1777
|
* ```ts
|
|
1720
1778
|
* import { Console, Effect, Stream } from "effect"
|
|
1721
1779
|
*
|
|
@@ -1731,15 +1789,16 @@ export const tapSink = /*#__PURE__*/dual(2, (self, sink) => transformPullBracket
|
|
|
1731
1789
|
* // Output: [ 1, 2, 2, 4, 3, 6 ]
|
|
1732
1790
|
* ```
|
|
1733
1791
|
*
|
|
1792
|
+
* @category mapping
|
|
1734
1793
|
* @since 2.0.0
|
|
1735
|
-
* @category Mapping
|
|
1736
1794
|
*/
|
|
1737
1795
|
export const flatMap = /*#__PURE__*/dual(args => isStream(args[0]), (self, f, options) => self.channel.pipe(Channel.flattenArray, Channel.flatMap(a => f(a).channel, options), fromChannel));
|
|
1738
1796
|
/**
|
|
1739
1797
|
* Switches to the latest stream produced by the mapping function, interrupting
|
|
1740
1798
|
* the previous stream when a new element arrives.
|
|
1741
1799
|
*
|
|
1742
|
-
*
|
|
1800
|
+
* **Example** (Switching to the latest stream)
|
|
1801
|
+
*
|
|
1743
1802
|
* ```ts
|
|
1744
1803
|
* import { Console, Effect, Stream } from "effect"
|
|
1745
1804
|
*
|
|
@@ -1755,15 +1814,20 @@ export const flatMap = /*#__PURE__*/dual(args => isStream(args[0]), (self, f, op
|
|
|
1755
1814
|
* })
|
|
1756
1815
|
* ```
|
|
1757
1816
|
*
|
|
1817
|
+
* @category sequencing
|
|
1758
1818
|
* @since 4.0.0
|
|
1759
|
-
* @category Sequencing
|
|
1760
1819
|
*/
|
|
1761
1820
|
export const switchMap = /*#__PURE__*/dual(args => isStream(args[0]), (self, f, options) => self.channel.pipe(Channel.flattenArray, Channel.switchMap(a => f(a).channel, options), fromChannel));
|
|
1762
1821
|
/**
|
|
1763
|
-
* Flattens a stream of streams into a single stream
|
|
1764
|
-
*
|
|
1822
|
+
* Flattens a stream of streams into a single stream.
|
|
1823
|
+
*
|
|
1824
|
+
* With the default sequential concurrency, inner streams are concatenated in
|
|
1825
|
+
* strict order. When `concurrency` is greater than `1` or `"unbounded"`,
|
|
1826
|
+
* multiple inner streams may run at the same time and their outputs are merged
|
|
1827
|
+
* as they arrive.
|
|
1828
|
+
*
|
|
1829
|
+
* **Example** (Flattening nested streams)
|
|
1765
1830
|
*
|
|
1766
|
-
* @example
|
|
1767
1831
|
* ```ts
|
|
1768
1832
|
* import { Console, Effect, Stream } from "effect"
|
|
1769
1833
|
*
|
|
@@ -1782,20 +1846,15 @@ export const switchMap = /*#__PURE__*/dual(args => isStream(args[0]), (self, f,
|
|
|
1782
1846
|
* // Output: [ 1, 2, 3, 4, 5, 6 ]
|
|
1783
1847
|
* ```
|
|
1784
1848
|
*
|
|
1849
|
+
* @category mapping
|
|
1785
1850
|
* @since 2.0.0
|
|
1786
|
-
* @category Mapping
|
|
1787
1851
|
*/
|
|
1788
1852
|
export const flatten = /*#__PURE__*/dual(args => isStream(args[0]), (self, options) => flatMap(self, identity, options));
|
|
1789
1853
|
/**
|
|
1790
1854
|
* Flattens a stream of non-empty arrays into a stream of elements.
|
|
1791
1855
|
*
|
|
1792
|
-
* **
|
|
1793
|
-
*
|
|
1794
|
-
* This API replaces the following from Effect 3.x:
|
|
1856
|
+
* **Example** (Flattening a stream of non-empty arrays into a stream of elements)
|
|
1795
1857
|
*
|
|
1796
|
-
* - `Stream.flattenChunks`
|
|
1797
|
-
*
|
|
1798
|
-
* @example
|
|
1799
1858
|
* ```ts
|
|
1800
1859
|
* import { Array, Console, Effect, Stream } from "effect"
|
|
1801
1860
|
*
|
|
@@ -1810,14 +1869,15 @@ export const flatten = /*#__PURE__*/dual(args => isStream(args[0]), (self, optio
|
|
|
1810
1869
|
* // Output: [ 1, 2, 3 ]
|
|
1811
1870
|
* ```
|
|
1812
1871
|
*
|
|
1872
|
+
* @category sequencing
|
|
1813
1873
|
* @since 4.0.0
|
|
1814
|
-
* @category Sequencing
|
|
1815
1874
|
*/
|
|
1816
1875
|
export const flattenArray = self => fromChannel(Channel.flattenArray(self.channel));
|
|
1817
1876
|
/**
|
|
1818
1877
|
* Converts this stream to one that runs its effects but emits no elements.
|
|
1819
1878
|
*
|
|
1820
|
-
*
|
|
1879
|
+
* **Example** (Draining stream values)
|
|
1880
|
+
*
|
|
1821
1881
|
* ```ts
|
|
1822
1882
|
* import { Console, Effect, Stream } from "effect"
|
|
1823
1883
|
*
|
|
@@ -1830,15 +1890,16 @@ export const flattenArray = self => fromChannel(Channel.flattenArray(self.channe
|
|
|
1830
1890
|
* // Output: []
|
|
1831
1891
|
* ```
|
|
1832
1892
|
*
|
|
1893
|
+
* @category sequencing
|
|
1833
1894
|
* @since 2.0.0
|
|
1834
|
-
* @category Sequencing
|
|
1835
1895
|
*/
|
|
1836
1896
|
export const drain = self => fromChannel(Channel.drain(self.channel));
|
|
1837
1897
|
/**
|
|
1838
1898
|
* Runs the provided stream in the background while this stream runs, interrupting it
|
|
1839
1899
|
* when this stream completes and failing if the background stream fails or defects.
|
|
1840
1900
|
*
|
|
1841
|
-
*
|
|
1901
|
+
* **Example** (Draining a stream in the background)
|
|
1902
|
+
*
|
|
1842
1903
|
* ```ts
|
|
1843
1904
|
* import { Console, Effect, Stream } from "effect"
|
|
1844
1905
|
*
|
|
@@ -1858,14 +1919,15 @@ export const drain = self => fromChannel(Channel.drain(self.channel));
|
|
|
1858
1919
|
* // Output: [ 1, 2 ]
|
|
1859
1920
|
* ```
|
|
1860
1921
|
*
|
|
1922
|
+
* @category sequencing
|
|
1861
1923
|
* @since 2.0.0
|
|
1862
|
-
* @category Sequencing
|
|
1863
1924
|
*/
|
|
1864
1925
|
export const drainFork = /*#__PURE__*/dual(2, (self, that) => mergeEffect(self, runDrain(that)));
|
|
1865
1926
|
/**
|
|
1866
1927
|
* Repeats the entire stream according to the provided schedule.
|
|
1867
1928
|
*
|
|
1868
|
-
*
|
|
1929
|
+
* **Example** (Repeating a stream on a schedule)
|
|
1930
|
+
*
|
|
1869
1931
|
* ```ts
|
|
1870
1932
|
* import { Console, Effect, Schedule, Stream } from "effect"
|
|
1871
1933
|
*
|
|
@@ -1882,14 +1944,15 @@ export const drainFork = /*#__PURE__*/dual(2, (self, that) => mergeEffect(self,
|
|
|
1882
1944
|
* // Output: [ 1, 1, 1, 1, 1 ]
|
|
1883
1945
|
* ```
|
|
1884
1946
|
*
|
|
1947
|
+
* @category sequencing
|
|
1885
1948
|
* @since 2.0.0
|
|
1886
|
-
* @category Sequencing
|
|
1887
1949
|
*/
|
|
1888
1950
|
export const repeat = /*#__PURE__*/dual(2, (self, schedule) => fromChannel(Channel.repeat(self.channel, schedule)));
|
|
1889
1951
|
/**
|
|
1890
1952
|
* Spaces the stream's elements according to the provided `schedule`.
|
|
1891
1953
|
*
|
|
1892
|
-
*
|
|
1954
|
+
* **Example** (Scheduling stream elements)
|
|
1955
|
+
*
|
|
1893
1956
|
* ```ts
|
|
1894
1957
|
* import { Console, Effect, Schedule, Stream } from "effect"
|
|
1895
1958
|
*
|
|
@@ -1906,14 +1969,15 @@ export const repeat = /*#__PURE__*/dual(2, (self, schedule) => fromChannel(Chann
|
|
|
1906
1969
|
* // Output: [ 1, 2, 3 ]
|
|
1907
1970
|
* ```
|
|
1908
1971
|
*
|
|
1909
|
-
* @since 2.0.0
|
|
1910
1972
|
* @category Rate Limiting
|
|
1973
|
+
* @since 2.0.0
|
|
1911
1974
|
*/
|
|
1912
1975
|
export const schedule = /*#__PURE__*/dual(2, (self, schedule) => self.channel.pipe(Channel.flattenArray, Channel.schedule(schedule), Channel.map(Arr.of), fromChannel));
|
|
1913
1976
|
/**
|
|
1914
1977
|
* Ends the stream if it does not produce a value within the specified duration.
|
|
1915
1978
|
*
|
|
1916
|
-
*
|
|
1979
|
+
* **Example** (Timing out a stream)
|
|
1980
|
+
*
|
|
1917
1981
|
* ```ts
|
|
1918
1982
|
* import { Console, Effect, Stream } from "effect"
|
|
1919
1983
|
*
|
|
@@ -1930,16 +1994,23 @@ export const schedule = /*#__PURE__*/dual(2, (self, schedule) => self.channel.pi
|
|
|
1930
1994
|
* // Output: [ 1 ]
|
|
1931
1995
|
* ```
|
|
1932
1996
|
*
|
|
1933
|
-
* @since 2.0.0
|
|
1934
1997
|
* @category Rate Limiting
|
|
1998
|
+
* @since 2.0.0
|
|
1935
1999
|
*/
|
|
1936
2000
|
export const timeout = /*#__PURE__*/dual(2, (self, duration) => timeoutOrElse(self, {
|
|
1937
2001
|
duration,
|
|
1938
2002
|
orElse: () => empty
|
|
1939
2003
|
}));
|
|
1940
2004
|
/**
|
|
1941
|
-
*
|
|
2005
|
+
* Switches to a fallback stream if this stream does not emit a value within
|
|
2006
|
+
* the specified duration.
|
|
2007
|
+
*
|
|
2008
|
+
* The timeout is checked for each pull. A zero duration uses `orElse`
|
|
2009
|
+
* immediately, while an infinite duration leaves the original stream
|
|
2010
|
+
* unchanged.
|
|
2011
|
+
*
|
|
1942
2012
|
* @category Rate Limiting
|
|
2013
|
+
* @since 4.0.0
|
|
1943
2014
|
*/
|
|
1944
2015
|
export const timeoutOrElse = /*#__PURE__*/dual(2, (self, options) => {
|
|
1945
2016
|
const duration = Duration.fromInputUnsafe(options.duration);
|
|
@@ -1983,9 +2054,8 @@ export const timeoutOrElse = /*#__PURE__*/dual(2, (self, options) => {
|
|
|
1983
2054
|
* Repeats each element of the stream according to the provided schedule,
|
|
1984
2055
|
* including the original emission.
|
|
1985
2056
|
*
|
|
1986
|
-
*
|
|
1987
|
-
*
|
|
1988
|
-
* @example
|
|
2057
|
+
* **Example** (Repeating stream elements)
|
|
2058
|
+
*
|
|
1989
2059
|
* ```ts
|
|
1990
2060
|
* import { Console, Effect, Schedule, Stream } from "effect"
|
|
1991
2061
|
*
|
|
@@ -2000,6 +2070,9 @@ export const timeoutOrElse = /*#__PURE__*/dual(2, (self, options) => {
|
|
|
2000
2070
|
* Effect.runPromise(program)
|
|
2001
2071
|
* // Output: [ "A", "A", "B", "B", "C", "C" ]
|
|
2002
2072
|
* ```
|
|
2073
|
+
*
|
|
2074
|
+
* @category sequencing
|
|
2075
|
+
* @since 2.0.0
|
|
2003
2076
|
*/
|
|
2004
2077
|
export const repeatElements = /*#__PURE__*/dual(2, (self, schedule) => fromChannel(Channel.fromTransform((upstream, scope) => Effect.map(Channel.toTransform(Channel.flattenArray(self.channel))(upstream, scope), pullElement => {
|
|
2005
2078
|
let pullRepeat = undefined;
|
|
@@ -2018,7 +2091,8 @@ export const repeatElements = /*#__PURE__*/dual(2, (self, schedule) => fromChann
|
|
|
2018
2091
|
/**
|
|
2019
2092
|
* Repeats this stream forever.
|
|
2020
2093
|
*
|
|
2021
|
-
*
|
|
2094
|
+
* **Example** (Repeating a stream forever)
|
|
2095
|
+
*
|
|
2022
2096
|
* ```ts
|
|
2023
2097
|
* import { Console, Effect, Stream } from "effect"
|
|
2024
2098
|
*
|
|
@@ -2036,20 +2110,15 @@ export const repeatElements = /*#__PURE__*/dual(2, (self, schedule) => fromChann
|
|
|
2036
2110
|
* // Output: [ "A", "B", "A", "B", "A" ]
|
|
2037
2111
|
* ```
|
|
2038
2112
|
*
|
|
2113
|
+
* @category sequencing
|
|
2039
2114
|
* @since 2.0.0
|
|
2040
|
-
* @category Sequencing
|
|
2041
2115
|
*/
|
|
2042
2116
|
export const forever = self => fromChannel(Channel.forever(self.channel));
|
|
2043
2117
|
/**
|
|
2044
2118
|
* Submerges the iterables emitted by this stream into the stream's structure.
|
|
2045
2119
|
*
|
|
2046
|
-
* **
|
|
2047
|
-
*
|
|
2048
|
-
* This API replaces the following from Effect 3.x:
|
|
2120
|
+
* **Example** (Flattening iterable values)
|
|
2049
2121
|
*
|
|
2050
|
-
* - `Stream.flattenIterables`
|
|
2051
|
-
*
|
|
2052
|
-
* @example
|
|
2053
2122
|
* ```ts
|
|
2054
2123
|
* import { Console, Effect, Stream } from "effect"
|
|
2055
2124
|
*
|
|
@@ -2063,15 +2132,16 @@ export const forever = self => fromChannel(Channel.forever(self.channel));
|
|
|
2063
2132
|
* // Output: [ 1, 2, 3, 4 ]
|
|
2064
2133
|
* ```
|
|
2065
2134
|
*
|
|
2135
|
+
* @category mapping
|
|
2066
2136
|
* @since 4.0.0
|
|
2067
|
-
* @category Mapping
|
|
2068
2137
|
*/
|
|
2069
2138
|
export const flattenIterable = self => flatMap(self, fromIterable);
|
|
2070
2139
|
/**
|
|
2071
2140
|
* Unwraps `Take` values, emitting elements from non-empty arrays and ending or
|
|
2072
2141
|
* failing when the `Exit` signals completion.
|
|
2073
2142
|
*
|
|
2074
|
-
*
|
|
2143
|
+
* **Example** (Flattening Take values)
|
|
2144
|
+
*
|
|
2075
2145
|
* ```ts
|
|
2076
2146
|
* import { Array, Console, Effect, Exit, Stream } from "effect"
|
|
2077
2147
|
*
|
|
@@ -2090,15 +2160,16 @@ export const flattenIterable = self => flatMap(self, fromIterable);
|
|
|
2090
2160
|
* // Output: [ 1, 2, 3 ]
|
|
2091
2161
|
* ```
|
|
2092
2162
|
*
|
|
2093
|
-
* @
|
|
2094
|
-
* @
|
|
2163
|
+
* @category sequencing
|
|
2164
|
+
* @since 2.0.0
|
|
2095
2165
|
*/
|
|
2096
2166
|
export const flattenTake = self => self.channel.pipe(Channel.flattenArray, Channel.flattenTake, fromChannel);
|
|
2097
2167
|
/**
|
|
2098
2168
|
* Concatenates two streams, emitting all elements from the first stream
|
|
2099
2169
|
* followed by all elements from the second stream.
|
|
2100
2170
|
*
|
|
2101
|
-
*
|
|
2171
|
+
* **Example** (Concatenating streams)
|
|
2172
|
+
*
|
|
2102
2173
|
* ```ts
|
|
2103
2174
|
* import { Console, Effect, Stream } from "effect"
|
|
2104
2175
|
*
|
|
@@ -2111,14 +2182,15 @@ export const flattenTake = self => self.channel.pipe(Channel.flattenArray, Chann
|
|
|
2111
2182
|
* // Output: [ 1, 2, 3, 4, 5, 6 ]
|
|
2112
2183
|
* ```
|
|
2113
2184
|
*
|
|
2185
|
+
* @category sequencing
|
|
2114
2186
|
* @since 2.0.0
|
|
2115
|
-
* @category Sequencing
|
|
2116
2187
|
*/
|
|
2117
2188
|
export const concat = /*#__PURE__*/dual(2, (self, that) => flatten(fromArray([self, that])));
|
|
2118
2189
|
/**
|
|
2119
2190
|
* Prepends the values from the provided iterable before the stream's elements.
|
|
2120
2191
|
*
|
|
2121
|
-
*
|
|
2192
|
+
* **Example** (Prepending values)
|
|
2193
|
+
*
|
|
2122
2194
|
* ```ts
|
|
2123
2195
|
* import { Console, Effect, Stream } from "effect"
|
|
2124
2196
|
*
|
|
@@ -2135,8 +2207,8 @@ export const concat = /*#__PURE__*/dual(2, (self, that) => flatten(fromArray([se
|
|
|
2135
2207
|
* Effect.runPromise(program)
|
|
2136
2208
|
* ```
|
|
2137
2209
|
*
|
|
2210
|
+
* @category sequencing
|
|
2138
2211
|
* @since 2.0.0
|
|
2139
|
-
* @category Sequencing
|
|
2140
2212
|
*/
|
|
2141
2213
|
export const prepend = /*#__PURE__*/dual(2, (self, values) => concat(fromIterable(values), self));
|
|
2142
2214
|
/**
|
|
@@ -2145,7 +2217,8 @@ export const prepend = /*#__PURE__*/dual(2, (self, values) => concat(fromIterabl
|
|
|
2145
2217
|
* By default, the merged stream ends when both streams end. Use
|
|
2146
2218
|
* `haltStrategy` to change the termination behavior.
|
|
2147
2219
|
*
|
|
2148
|
-
*
|
|
2220
|
+
* **Example** (Merging stream values)
|
|
2221
|
+
*
|
|
2149
2222
|
* ```ts
|
|
2150
2223
|
* import { Console, Effect, Stream } from "effect"
|
|
2151
2224
|
*
|
|
@@ -2161,8 +2234,8 @@ export const prepend = /*#__PURE__*/dual(2, (self, values) => concat(fromIterabl
|
|
|
2161
2234
|
* // Output: [ 1, 2, 3, 4 ]
|
|
2162
2235
|
* ```
|
|
2163
2236
|
*
|
|
2164
|
-
* @since 2.0.0
|
|
2165
2237
|
* @category Merging
|
|
2238
|
+
* @since 2.0.0
|
|
2166
2239
|
*/
|
|
2167
2240
|
export const merge = /*#__PURE__*/dual(args => isStream(args[0]) && isStream(args[1]), (self, that, options) => fromChannel(Channel.merge(toChannel(self), toChannel(that), options)));
|
|
2168
2241
|
/**
|
|
@@ -2171,9 +2244,8 @@ export const merge = /*#__PURE__*/dual(args => isStream(args[0]) && isStream(arg
|
|
|
2171
2244
|
* The effect runs concurrently, fails the stream if it fails, and is interrupted
|
|
2172
2245
|
* when the stream completes.
|
|
2173
2246
|
*
|
|
2174
|
-
*
|
|
2175
|
-
*
|
|
2176
|
-
* @example
|
|
2247
|
+
* **Example** (Merging with a background effect)
|
|
2248
|
+
*
|
|
2177
2249
|
* ```ts
|
|
2178
2250
|
* import { Console, Effect, Stream } from "effect"
|
|
2179
2251
|
*
|
|
@@ -2190,19 +2262,17 @@ export const merge = /*#__PURE__*/dual(args => isStream(args[0]) && isStream(arg
|
|
|
2190
2262
|
* // Output: side task
|
|
2191
2263
|
* // Output: [ 1, 2, 3 ]
|
|
2192
2264
|
* ```
|
|
2265
|
+
*
|
|
2266
|
+
* @category Merging
|
|
2267
|
+
* @since 4.0.0
|
|
2193
2268
|
*/
|
|
2194
2269
|
export const mergeEffect = /*#__PURE__*/dual(2, (self, effect) => self.channel.pipe(Channel.mergeEffect(effect), fromChannel));
|
|
2195
2270
|
/**
|
|
2196
2271
|
* Merges this stream and the specified stream together, tagging values from the
|
|
2197
2272
|
* left stream as `Result.succeed` and values from the right stream as `Result.fail`.
|
|
2198
2273
|
*
|
|
2199
|
-
* **
|
|
2200
|
-
*
|
|
2201
|
-
* This API replaces the following from Effect 3.x:
|
|
2274
|
+
* **Example** (Merging streams into results)
|
|
2202
2275
|
*
|
|
2203
|
-
* - `Stream.mergeEither`
|
|
2204
|
-
*
|
|
2205
|
-
* @example
|
|
2206
2276
|
* ```ts
|
|
2207
2277
|
* import { Console, Effect, Result, Stream } from "effect"
|
|
2208
2278
|
*
|
|
@@ -2228,8 +2298,8 @@ export const mergeEffect = /*#__PURE__*/dual(2, (self, effect) => self.channel.p
|
|
|
2228
2298
|
* // Output: [ "left:left", "right:right" ]
|
|
2229
2299
|
* ```
|
|
2230
2300
|
*
|
|
2231
|
-
* @since 2.0.0
|
|
2232
2301
|
* @category Merging
|
|
2302
|
+
* @since 4.0.0
|
|
2233
2303
|
*/
|
|
2234
2304
|
export const mergeResult = /*#__PURE__*/dual(2, (self, that) => merge(map(self, Result.succeed), map(that, Result.fail)));
|
|
2235
2305
|
/**
|
|
@@ -2239,7 +2309,8 @@ export const mergeResult = /*#__PURE__*/dual(2, (self, that) => merge(map(self,
|
|
|
2239
2309
|
* stream are propagated. The merged stream completes when the left stream
|
|
2240
2310
|
* completes, interrupting the right stream.
|
|
2241
2311
|
*
|
|
2242
|
-
*
|
|
2312
|
+
* **Example** (Merging streams while keeping left values)
|
|
2313
|
+
*
|
|
2243
2314
|
* ```ts
|
|
2244
2315
|
* import { Console, Effect, Stream } from "effect"
|
|
2245
2316
|
*
|
|
@@ -2254,8 +2325,8 @@ export const mergeResult = /*#__PURE__*/dual(2, (self, that) => merge(map(self,
|
|
|
2254
2325
|
* // Output: [ 1, 2 ]
|
|
2255
2326
|
* ```
|
|
2256
2327
|
*
|
|
2257
|
-
* @since 2.0.0
|
|
2258
2328
|
* @category Merging
|
|
2329
|
+
* @since 2.0.0
|
|
2259
2330
|
*/
|
|
2260
2331
|
export const mergeLeft = /*#__PURE__*/dual(2, (left, right) => mergeEffect(left, runDrain(right)));
|
|
2261
2332
|
/**
|
|
@@ -2265,7 +2336,8 @@ export const mergeLeft = /*#__PURE__*/dual(2, (left, right) => mergeEffect(left,
|
|
|
2265
2336
|
* The merged stream ends when the right stream completes, interrupting the
|
|
2266
2337
|
* left stream. Failures from the left stream still fail the merged stream.
|
|
2267
2338
|
*
|
|
2268
|
-
*
|
|
2339
|
+
* **Example** (Merging streams while keeping right values)
|
|
2340
|
+
*
|
|
2269
2341
|
* ```ts
|
|
2270
2342
|
* import { Console, Effect, Stream } from "effect"
|
|
2271
2343
|
*
|
|
@@ -2285,17 +2357,18 @@ export const mergeLeft = /*#__PURE__*/dual(2, (left, right) => mergeEffect(left,
|
|
|
2285
2357
|
* // Output: [ 1, 2 ]
|
|
2286
2358
|
* ```
|
|
2287
2359
|
*
|
|
2288
|
-
* @since 2.0.0
|
|
2289
2360
|
* @category Merging
|
|
2361
|
+
* @since 2.0.0
|
|
2290
2362
|
*/
|
|
2291
2363
|
export const mergeRight = /*#__PURE__*/dual(2, (left, right) => mergeEffect(right, runDrain(left)));
|
|
2292
2364
|
/**
|
|
2293
2365
|
* Merges a collection of streams, running up to the specified number concurrently.
|
|
2294
2366
|
*
|
|
2295
|
-
* @since 2.0.0
|
|
2296
2367
|
* @category Merging
|
|
2368
|
+
* @since 2.0.0
|
|
2369
|
+
*
|
|
2370
|
+
* **Example** (Merging streams with bounded concurrency)
|
|
2297
2371
|
*
|
|
2298
|
-
* @example
|
|
2299
2372
|
* ```ts
|
|
2300
2373
|
* import { Console, Effect, Stream } from "effect"
|
|
2301
2374
|
*
|
|
@@ -2322,7 +2395,8 @@ export const mergeAll = /*#__PURE__*/dual(2, (streams, options) => flatten(fromI
|
|
|
2322
2395
|
*
|
|
2323
2396
|
* See also `Stream.zip` for the more common point-wise variant.
|
|
2324
2397
|
*
|
|
2325
|
-
*
|
|
2398
|
+
* **Example** (Computing cartesian products)
|
|
2399
|
+
*
|
|
2326
2400
|
* ```ts
|
|
2327
2401
|
* import { Console, Effect, Stream } from "effect"
|
|
2328
2402
|
*
|
|
@@ -2337,8 +2411,8 @@ export const mergeAll = /*#__PURE__*/dual(2, (streams, options) => flatten(fromI
|
|
|
2337
2411
|
* // Output: [ [ 1, "a" ], [ 1, "b" ], [ 2, "a" ], [ 2, "b" ] ]
|
|
2338
2412
|
* ```
|
|
2339
2413
|
*
|
|
2414
|
+
* @category zipping
|
|
2340
2415
|
* @since 2.0.0
|
|
2341
|
-
* @category Zipping
|
|
2342
2416
|
*/
|
|
2343
2417
|
export const cross = /*#__PURE__*/dual(2, (left, right) => crossWith(left, right, (l, r) => [l, r]));
|
|
2344
2418
|
/**
|
|
@@ -2348,7 +2422,8 @@ export const cross = /*#__PURE__*/dual(2, (left, right) => crossWith(left, right
|
|
|
2348
2422
|
*
|
|
2349
2423
|
* See also `Stream.zipWith` for the more common point-wise variant.
|
|
2350
2424
|
*
|
|
2351
|
-
*
|
|
2425
|
+
* **Example** (Combining cartesian products)
|
|
2426
|
+
*
|
|
2352
2427
|
* ```ts
|
|
2353
2428
|
* import { Console, Effect, Stream } from "effect"
|
|
2354
2429
|
*
|
|
@@ -2364,14 +2439,15 @@ export const cross = /*#__PURE__*/dual(2, (left, right) => crossWith(left, right
|
|
|
2364
2439
|
* // Output: [ "1-a", "1-b", "2-a", "2-b" ]
|
|
2365
2440
|
* ```
|
|
2366
2441
|
*
|
|
2442
|
+
* @category zipping
|
|
2367
2443
|
* @since 2.0.0
|
|
2368
|
-
* @category Zipping
|
|
2369
2444
|
*/
|
|
2370
2445
|
export const crossWith = /*#__PURE__*/dual(3, (left, right, f) => flatMap(left, l => map(right, r => f(l, r))));
|
|
2371
2446
|
/**
|
|
2372
2447
|
* Zips two streams point-wise with a combining function, ending when either stream ends.
|
|
2373
2448
|
*
|
|
2374
|
-
*
|
|
2449
|
+
* **Example** (Zipping streams with a function)
|
|
2450
|
+
*
|
|
2375
2451
|
* ```ts
|
|
2376
2452
|
* import { Console, Effect, Stream } from "effect"
|
|
2377
2453
|
*
|
|
@@ -2389,8 +2465,8 @@ export const crossWith = /*#__PURE__*/dual(3, (left, right, f) => flatMap(left,
|
|
|
2389
2465
|
* // Output: [ "1-a", "2-b", "3-c" ]
|
|
2390
2466
|
* ```
|
|
2391
2467
|
*
|
|
2468
|
+
* @category zipping
|
|
2392
2469
|
* @since 2.0.0
|
|
2393
|
-
* @category Zipping
|
|
2394
2470
|
*/
|
|
2395
2471
|
export const zipWith = /*#__PURE__*/dual(3, (left, right, f) => zipWithArray(left, right, zipArrays(f)));
|
|
2396
2472
|
const zipArrays = f => (leftArr, rightArr) => {
|
|
@@ -2406,13 +2482,8 @@ const zipArrays = f => (leftArr, rightArr) => {
|
|
|
2406
2482
|
*
|
|
2407
2483
|
* The function returns output plus leftover arrays that carry into the next pull.
|
|
2408
2484
|
*
|
|
2409
|
-
* **
|
|
2410
|
-
*
|
|
2411
|
-
* This API replaces the following from Effect 3.x:
|
|
2485
|
+
* **Example** (Zipping stream chunks)
|
|
2412
2486
|
*
|
|
2413
|
-
* - `Stream.zipWithChunks`
|
|
2414
|
-
*
|
|
2415
|
-
* @example
|
|
2416
2487
|
* ```ts
|
|
2417
2488
|
* import { Array, Console, Effect, Stream } from "effect"
|
|
2418
2489
|
*
|
|
@@ -2435,8 +2506,8 @@ const zipArrays = f => (leftArr, rightArr) => {
|
|
|
2435
2506
|
* // Output: [[1, "a"], [2, "b"], [3, "c"], [4, "d"], [5, "e"]]
|
|
2436
2507
|
* ```
|
|
2437
2508
|
*
|
|
2438
|
-
* @
|
|
2439
|
-
* @
|
|
2509
|
+
* @category zipping
|
|
2510
|
+
* @since 4.0.0
|
|
2440
2511
|
*/
|
|
2441
2512
|
export const zipWithArray = /*#__PURE__*/dual(3, (left, right, f) => fromChannel(Channel.fromTransformBracket(Effect.fnUntraced(function* (_, scope) {
|
|
2442
2513
|
const pullLeft = yield* Channel.toPullScoped(left.channel, scope);
|
|
@@ -2475,7 +2546,8 @@ export const zipWithArray = /*#__PURE__*/dual(3, (left, right, f) => fromChannel
|
|
|
2475
2546
|
* Zips this stream with another point-wise and emits tuples of elements from
|
|
2476
2547
|
* both streams. The new stream ends when either stream ends.
|
|
2477
2548
|
*
|
|
2478
|
-
*
|
|
2549
|
+
* **Example** (Zipping streams)
|
|
2550
|
+
*
|
|
2479
2551
|
* ```ts
|
|
2480
2552
|
* import { Console, Effect, Stream } from "effect"
|
|
2481
2553
|
*
|
|
@@ -2493,8 +2565,8 @@ export const zipWithArray = /*#__PURE__*/dual(3, (left, right, f) => fromChannel
|
|
|
2493
2565
|
* // Output: [[1, "a"], [2, "b"], [3, "c"]]
|
|
2494
2566
|
* ```
|
|
2495
2567
|
*
|
|
2568
|
+
* @category zipping
|
|
2496
2569
|
* @since 2.0.0
|
|
2497
|
-
* @category Zipping
|
|
2498
2570
|
*/
|
|
2499
2571
|
export const zip = /*#__PURE__*/dual(2, (self, that) => zipWith(self, that, (a, a2) => [a, a2]));
|
|
2500
2572
|
/**
|
|
@@ -2503,7 +2575,8 @@ export const zip = /*#__PURE__*/dual(2, (self, that) => zipWith(self, that, (a,
|
|
|
2503
2575
|
*
|
|
2504
2576
|
* The resulting stream ends when either side ends.
|
|
2505
2577
|
*
|
|
2506
|
-
*
|
|
2578
|
+
* **Example** (Zipping streams while keeping left values)
|
|
2579
|
+
*
|
|
2507
2580
|
* ```ts
|
|
2508
2581
|
* import { Console, Effect, Stream } from "effect"
|
|
2509
2582
|
*
|
|
@@ -2519,8 +2592,8 @@ export const zip = /*#__PURE__*/dual(2, (self, that) => zipWith(self, that, (a,
|
|
|
2519
2592
|
* // Output: [1, 2]
|
|
2520
2593
|
* ```
|
|
2521
2594
|
*
|
|
2595
|
+
* @category zipping
|
|
2522
2596
|
* @since 2.0.0
|
|
2523
|
-
* @category Zipping
|
|
2524
2597
|
*/
|
|
2525
2598
|
export const zipLeft = /*#__PURE__*/dual(2, (left, right) => zipWithArray(left, right, (leftArr, rightArr) => {
|
|
2526
2599
|
const minLength = Math.min(leftArr.length, rightArr.length);
|
|
@@ -2532,7 +2605,8 @@ export const zipLeft = /*#__PURE__*/dual(2, (left, right) => zipWithArray(left,
|
|
|
2532
2605
|
/**
|
|
2533
2606
|
* Zips this stream with another point-wise, keeping only right values and ending when either stream ends.
|
|
2534
2607
|
*
|
|
2535
|
-
*
|
|
2608
|
+
* **Example** (Zipping streams while keeping right values)
|
|
2609
|
+
*
|
|
2536
2610
|
* ```ts
|
|
2537
2611
|
* import { Console, Effect, Stream } from "effect"
|
|
2538
2612
|
*
|
|
@@ -2548,8 +2622,8 @@ export const zipLeft = /*#__PURE__*/dual(2, (left, right) => zipWithArray(left,
|
|
|
2548
2622
|
* // Output: ["a", "b"]
|
|
2549
2623
|
* ```
|
|
2550
2624
|
*
|
|
2625
|
+
* @category zipping
|
|
2551
2626
|
* @since 2.0.0
|
|
2552
|
-
* @category Zipping
|
|
2553
2627
|
*/
|
|
2554
2628
|
export const zipRight = /*#__PURE__*/dual(2, (left, right) => zipWithArray(left, right, (leftArr, rightArr) => {
|
|
2555
2629
|
const minLength = Math.min(leftArr.length, rightArr.length);
|
|
@@ -2564,7 +2638,8 @@ export const zipRight = /*#__PURE__*/dual(2, (left, right) => zipWithArray(left,
|
|
|
2564
2638
|
*
|
|
2565
2639
|
* The new stream will end when one of the sides ends.
|
|
2566
2640
|
*
|
|
2567
|
-
*
|
|
2641
|
+
* **Example** (Zipping and flattening tuples)
|
|
2642
|
+
*
|
|
2568
2643
|
* ```ts
|
|
2569
2644
|
* import { Console, Effect, Stream } from "effect"
|
|
2570
2645
|
*
|
|
@@ -2584,14 +2659,15 @@ export const zipRight = /*#__PURE__*/dual(2, (left, right) => zipWithArray(left,
|
|
|
2584
2659
|
* // Output: [[1, "a", "x"], [2, "b", "y"], [3, "c", "z"]]
|
|
2585
2660
|
* ```
|
|
2586
2661
|
*
|
|
2662
|
+
* @category zipping
|
|
2587
2663
|
* @since 2.0.0
|
|
2588
|
-
* @category Zipping
|
|
2589
2664
|
*/
|
|
2590
2665
|
export const zipFlatten = /*#__PURE__*/dual(2, (self, that) => zipWith(self, that, (a, a2) => [...a, a2]));
|
|
2591
2666
|
/**
|
|
2592
2667
|
* Zips this stream together with the index of elements.
|
|
2593
2668
|
*
|
|
2594
|
-
*
|
|
2669
|
+
* **Example** (Zipping elements with indices)
|
|
2670
|
+
*
|
|
2595
2671
|
* ```ts
|
|
2596
2672
|
* import { Console, Effect, Stream } from "effect"
|
|
2597
2673
|
*
|
|
@@ -2607,15 +2683,16 @@ export const zipFlatten = /*#__PURE__*/dual(2, (self, that) => zipWith(self, tha
|
|
|
2607
2683
|
* // Output: [["a", 0], ["b", 1], ["c", 2], ["d", 3]]
|
|
2608
2684
|
* ```
|
|
2609
2685
|
*
|
|
2686
|
+
* @category zipping
|
|
2610
2687
|
* @since 2.0.0
|
|
2611
|
-
* @category Zipping
|
|
2612
2688
|
*/
|
|
2613
2689
|
export const zipWithIndex = self => map(self, (a, i) => [a, i]);
|
|
2614
2690
|
/**
|
|
2615
2691
|
* Zips each element with the next element, pairing the final element with
|
|
2616
2692
|
* `Option.none()`.
|
|
2617
2693
|
*
|
|
2618
|
-
*
|
|
2694
|
+
* **Example** (Zipping elements with next values)
|
|
2695
|
+
*
|
|
2619
2696
|
* ```ts
|
|
2620
2697
|
* import { Console, Effect, Stream } from "effect"
|
|
2621
2698
|
*
|
|
@@ -2633,8 +2710,8 @@ export const zipWithIndex = self => map(self, (a, i) => [a, i]);
|
|
|
2633
2710
|
* // ]
|
|
2634
2711
|
* ```
|
|
2635
2712
|
*
|
|
2713
|
+
* @category zipping
|
|
2636
2714
|
* @since 2.0.0
|
|
2637
|
-
* @category Zipping
|
|
2638
2715
|
*/
|
|
2639
2716
|
export const zipWithNext = self => mapAccumArray(self, Option.none, (acc, arr) => {
|
|
2640
2717
|
let i = 0;
|
|
@@ -2657,7 +2734,8 @@ export const zipWithNext = self => mapAccumArray(self, Option.none, (acc, arr) =
|
|
|
2657
2734
|
/**
|
|
2658
2735
|
* Zips each element with its previous element, starting with `None`.
|
|
2659
2736
|
*
|
|
2660
|
-
*
|
|
2737
|
+
* **Example** (Zipping elements with previous values)
|
|
2738
|
+
*
|
|
2661
2739
|
* ```ts
|
|
2662
2740
|
* import { Console, Effect, Stream } from "effect"
|
|
2663
2741
|
*
|
|
@@ -2677,8 +2755,8 @@ export const zipWithNext = self => mapAccumArray(self, Option.none, (acc, arr) =
|
|
|
2677
2755
|
* // ]
|
|
2678
2756
|
* ```
|
|
2679
2757
|
*
|
|
2758
|
+
* @category zipping
|
|
2680
2759
|
* @since 2.0.0
|
|
2681
|
-
* @category Zipping
|
|
2682
2760
|
*/
|
|
2683
2761
|
export const zipWithPrevious = self => mapAccumArray(self, Option.none, (acc, arr) => {
|
|
2684
2762
|
const pairs = Arr.empty();
|
|
@@ -2692,7 +2770,8 @@ export const zipWithPrevious = self => mapAccumArray(self, Option.none, (acc, ar
|
|
|
2692
2770
|
/**
|
|
2693
2771
|
* Zips each element with its previous and next values.
|
|
2694
2772
|
*
|
|
2695
|
-
*
|
|
2773
|
+
* **Example** (Zipping elements with neighbors)
|
|
2774
|
+
*
|
|
2696
2775
|
* ```ts
|
|
2697
2776
|
* import { Console, Effect, Option, Stream } from "effect"
|
|
2698
2777
|
*
|
|
@@ -2708,8 +2787,8 @@ export const zipWithPrevious = self => mapAccumArray(self, Option.none, (acc, ar
|
|
|
2708
2787
|
* // Output: [ [Option.none(), 1, Option.some(2)], [Option.some(1), 2, Option.some(3)], [Option.some(2), 3, Option.none()] ]
|
|
2709
2788
|
* ```
|
|
2710
2789
|
*
|
|
2790
|
+
* @category zipping
|
|
2711
2791
|
* @since 2.0.0
|
|
2712
|
-
* @category Zipping
|
|
2713
2792
|
*/
|
|
2714
2793
|
export const zipWithPreviousAndNext = self => mapAccumArray(self, () => ({
|
|
2715
2794
|
prev: Option.none(),
|
|
@@ -2746,7 +2825,8 @@ export const zipWithPreviousAndNext = self => mapAccumArray(self, () => ({
|
|
|
2746
2825
|
* that emitted elements that are not the last value in arrays will never be
|
|
2747
2826
|
* used for zipping.
|
|
2748
2827
|
*
|
|
2749
|
-
*
|
|
2828
|
+
* **Example** (Zipping latest values from many streams)
|
|
2829
|
+
*
|
|
2750
2830
|
* ```ts
|
|
2751
2831
|
* import { Console, Effect, Stream } from "effect"
|
|
2752
2832
|
*
|
|
@@ -2765,8 +2845,8 @@ export const zipWithPreviousAndNext = self => mapAccumArray(self, () => ({
|
|
|
2765
2845
|
* // Output: [ [ 1, "a", true ], [ 2, "a", true ], [ 3, "a", true ], [ 3, "b", true ], [ 3, "c", true ], [ 3, "c", false ], [ 3, "c", true ] ]
|
|
2766
2846
|
* ```
|
|
2767
2847
|
*
|
|
2768
|
-
* @
|
|
2769
|
-
* @
|
|
2848
|
+
* @category zipping
|
|
2849
|
+
* @since 3.3.0
|
|
2770
2850
|
*/
|
|
2771
2851
|
export const zipLatestAll = (...streams) => fromChannel(Channel.suspend(() => {
|
|
2772
2852
|
const latest = [];
|
|
@@ -2794,7 +2874,8 @@ export const zipLatestAll = (...streams) => fromChannel(Channel.suspend(() => {
|
|
|
2794
2874
|
* that emitted elements that are not the last value in arrays will never be
|
|
2795
2875
|
* used for zipping.
|
|
2796
2876
|
*
|
|
2797
|
-
*
|
|
2877
|
+
* **Example** (Zipping latest values)
|
|
2878
|
+
*
|
|
2798
2879
|
* ```ts
|
|
2799
2880
|
* import { Console, Effect, Stream } from "effect"
|
|
2800
2881
|
*
|
|
@@ -2809,8 +2890,8 @@ export const zipLatestAll = (...streams) => fromChannel(Channel.suspend(() => {
|
|
|
2809
2890
|
* // Output: [ [1, "a"] ]
|
|
2810
2891
|
* ```
|
|
2811
2892
|
*
|
|
2893
|
+
* @category zipping
|
|
2812
2894
|
* @since 2.0.0
|
|
2813
|
-
* @category Zipping
|
|
2814
2895
|
*/
|
|
2815
2896
|
export const zipLatest = /*#__PURE__*/dual(2, (left, right) => zipLatestAll(left, right));
|
|
2816
2897
|
/**
|
|
@@ -2821,7 +2902,8 @@ export const zipLatest = /*#__PURE__*/dual(2, (left, right) => zipLatestAll(left
|
|
|
2821
2902
|
* that emitted elements that are not the last value in arrays will never be
|
|
2822
2903
|
* used for zipping.
|
|
2823
2904
|
*
|
|
2824
|
-
*
|
|
2905
|
+
* **Example** (Zipping latest values with a function)
|
|
2906
|
+
*
|
|
2825
2907
|
* ```ts
|
|
2826
2908
|
* import { Console, Effect, Stream } from "effect"
|
|
2827
2909
|
*
|
|
@@ -2840,17 +2922,23 @@ export const zipLatest = /*#__PURE__*/dual(2, (left, right) => zipLatestAll(left
|
|
|
2840
2922
|
* })
|
|
2841
2923
|
* ```
|
|
2842
2924
|
*
|
|
2925
|
+
* @category zipping
|
|
2843
2926
|
* @since 2.0.0
|
|
2844
|
-
* @category Zipping
|
|
2845
2927
|
*/
|
|
2846
2928
|
export const zipLatestWith = /*#__PURE__*/dual(3, (left, right, f) => map(zipLatestAll(left, right), ([a, a2]) => f(a, a2)));
|
|
2847
2929
|
/**
|
|
2848
|
-
*
|
|
2930
|
+
* Runs all streams concurrently until one stream emits its first value, then
|
|
2931
|
+
* mirrors that winning stream and interrupts the rest.
|
|
2932
|
+
*
|
|
2933
|
+
* Failures or completion from losing streams before a winner is chosen are
|
|
2934
|
+
* ignored unless every stream fails or completes before emitting. After a
|
|
2935
|
+
* winner is chosen, that stream's later failures are propagated.
|
|
2849
2936
|
*
|
|
2850
|
-
* @since 3.7.0
|
|
2851
2937
|
* @category Racing
|
|
2938
|
+
* @since 3.5.0
|
|
2939
|
+
*
|
|
2940
|
+
* **Example** (Racing multiple streams)
|
|
2852
2941
|
*
|
|
2853
|
-
* @example
|
|
2854
2942
|
* ```ts
|
|
2855
2943
|
* import { Console, Effect, Schedule, Stream } from "effect"
|
|
2856
2944
|
*
|
|
@@ -2884,10 +2972,15 @@ export const raceAll = (...streams) => fromChannel(Channel.fromTransform((_, sco
|
|
|
2884
2972
|
return Effect.suspend(() => winner ?? race);
|
|
2885
2973
|
})));
|
|
2886
2974
|
/**
|
|
2887
|
-
*
|
|
2888
|
-
*
|
|
2975
|
+
* Runs both streams concurrently until one stream emits its first value, then
|
|
2976
|
+
* mirrors that winning stream and interrupts the other.
|
|
2977
|
+
*
|
|
2978
|
+
* A failure or completion from one side before the other side emits does not
|
|
2979
|
+
* win the race unless both sides fail or complete before emitting. After a
|
|
2980
|
+
* winner is chosen, that stream's later failures are propagated.
|
|
2981
|
+
*
|
|
2982
|
+
* **Example** (Racing two streams)
|
|
2889
2983
|
*
|
|
2890
|
-
* @example
|
|
2891
2984
|
* ```ts
|
|
2892
2985
|
* import { Console, Effect, Schedule, Stream } from "effect"
|
|
2893
2986
|
*
|
|
@@ -2905,14 +2998,15 @@ export const raceAll = (...streams) => fromChannel(Channel.fromTransform((_, sco
|
|
|
2905
2998
|
* // Output: [ 0, 1, 2 ]
|
|
2906
2999
|
* ```
|
|
2907
3000
|
*
|
|
2908
|
-
* @since 3.7.0
|
|
2909
3001
|
* @category Racing
|
|
3002
|
+
* @since 3.7.0
|
|
2910
3003
|
*/
|
|
2911
3004
|
export const race = /*#__PURE__*/dual(2, (left, right) => raceAll(left, right));
|
|
2912
3005
|
/**
|
|
2913
3006
|
* Filters a stream to the elements that satisfy a predicate.
|
|
2914
3007
|
*
|
|
2915
|
-
*
|
|
3008
|
+
* **Example** (Filtering stream values)
|
|
3009
|
+
*
|
|
2916
3010
|
* ```ts
|
|
2917
3011
|
* import { Console, Effect, Stream } from "effect"
|
|
2918
3012
|
*
|
|
@@ -2928,21 +3022,22 @@ export const race = /*#__PURE__*/dual(2, (left, right) => raceAll(left, right));
|
|
|
2928
3022
|
* // Output: [ 2, 4 ]
|
|
2929
3023
|
* ```
|
|
2930
3024
|
*
|
|
3025
|
+
* @category filtering
|
|
2931
3026
|
* @since 2.0.0
|
|
2932
|
-
* @category Filtering
|
|
2933
3027
|
*/
|
|
2934
3028
|
export const filter = /*#__PURE__*/dual(2, (self, predicate) => fromChannel(Channel.filterArray(toChannel(self), predicate)));
|
|
2935
3029
|
/**
|
|
2936
3030
|
* Filters and maps stream elements in one pass using a `Filter`.
|
|
2937
3031
|
*
|
|
2938
|
-
* @
|
|
2939
|
-
* @
|
|
3032
|
+
* @category filtering
|
|
3033
|
+
* @since 2.0.0
|
|
2940
3034
|
*/
|
|
2941
3035
|
export const filterMap = /*#__PURE__*/dual(2, (self, filter) => fromChannel(Channel.filterMapArray(toChannel(self), filter)));
|
|
2942
3036
|
/**
|
|
2943
3037
|
* Effectfully filters elements in a single pass.
|
|
2944
3038
|
*
|
|
2945
|
-
*
|
|
3039
|
+
* **Example** (Effectfully filtering stream values)
|
|
3040
|
+
*
|
|
2946
3041
|
* ```ts
|
|
2947
3042
|
* import { Console, Effect, Stream } from "effect"
|
|
2948
3043
|
*
|
|
@@ -2957,23 +3052,27 @@ export const filterMap = /*#__PURE__*/dual(2, (self, filter) => fromChannel(Chan
|
|
|
2957
3052
|
* // Output: [ 3, 4 ]
|
|
2958
3053
|
* ```
|
|
2959
3054
|
*
|
|
3055
|
+
* @category filtering
|
|
2960
3056
|
* @since 2.0.0
|
|
2961
|
-
* @category Filtering
|
|
2962
3057
|
*/
|
|
2963
3058
|
export const filterEffect = /*#__PURE__*/dual(2, (self, predicate) => fromChannel(Channel.filterArrayEffect(toChannel(self), predicate)));
|
|
2964
3059
|
/**
|
|
2965
3060
|
* Effectfully filters and maps elements in a single pass.
|
|
2966
3061
|
*
|
|
2967
|
-
* @
|
|
2968
|
-
* @
|
|
3062
|
+
* @category filtering
|
|
3063
|
+
* @since 2.0.0
|
|
2969
3064
|
*/
|
|
2970
3065
|
export const filterMapEffect = /*#__PURE__*/dual(2, (self, filter) => fromChannel(Channel.filterMapArrayEffect(toChannel(self), filter)));
|
|
2971
3066
|
/**
|
|
2972
|
-
* Partitions a stream using a `Filter` and exposes passing and failing values
|
|
3067
|
+
* Partitions a stream using a `Filter` and exposes passing and failing values
|
|
3068
|
+
* as scoped queues.
|
|
2973
3069
|
*
|
|
2974
|
-
*
|
|
3070
|
+
* The queues are backed by a fiber in the current scope and should be consumed
|
|
3071
|
+
* while that scope remains open. Each queue fails with the stream error or
|
|
3072
|
+
* `Cause.Done` when the source ends.
|
|
3073
|
+
*
|
|
3074
|
+
* **Example** (Partitioning a stream into queues)
|
|
2975
3075
|
*
|
|
2976
|
-
* @example
|
|
2977
3076
|
* ```ts
|
|
2978
3077
|
* import { Console, Effect, Result, Stream } from "effect"
|
|
2979
3078
|
*
|
|
@@ -2994,8 +3093,8 @@ export const filterMapEffect = /*#__PURE__*/dual(2, (self, filter) => fromChanne
|
|
|
2994
3093
|
* Effect.runPromise(Effect.scoped(program))
|
|
2995
3094
|
* ```
|
|
2996
3095
|
*
|
|
3096
|
+
* @category filtering
|
|
2997
3097
|
* @since 4.0.0
|
|
2998
|
-
* @category Filtering
|
|
2999
3098
|
*/
|
|
3000
3099
|
export const partitionQueue = /*#__PURE__*/dual(args => isStream(args[0]), /*#__PURE__*/Effect.fnUntraced(function* (self, filter, options) {
|
|
3001
3100
|
const scope = yield* Effect.scope;
|
|
@@ -3043,22 +3142,30 @@ export const partitionQueue = /*#__PURE__*/dual(args => isStream(args[0]), /*#__
|
|
|
3043
3142
|
return [passes, fails];
|
|
3044
3143
|
}));
|
|
3045
3144
|
/**
|
|
3046
|
-
* Splits a stream
|
|
3145
|
+
* Splits a stream with an effectful `Filter`, returning scoped streams for
|
|
3146
|
+
* filter successes and failures.
|
|
3147
|
+
*
|
|
3148
|
+
* The returned streams are backed by queues in the current scope and should be
|
|
3149
|
+
* consumed while that scope remains open. The first stream emits success values
|
|
3150
|
+
* from the filter, and the second emits failure values.
|
|
3047
3151
|
*
|
|
3152
|
+
* @category filtering
|
|
3048
3153
|
* @since 4.0.0
|
|
3049
|
-
* @category Filtering
|
|
3050
3154
|
*/
|
|
3051
3155
|
export const partitionEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self, filter, options) => Effect.map(partitionQueue(mapEffect(self, a => filter(a), options), result => result, options), ([passes, fails]) => [fromQueue(passes), fromQueue(fails)]));
|
|
3052
3156
|
/**
|
|
3053
|
-
* Splits a stream into excluded and satisfying substreams using a
|
|
3157
|
+
* Splits a stream into scoped excluded and satisfying substreams using a
|
|
3158
|
+
* `Filter`.
|
|
3054
3159
|
*
|
|
3055
|
-
* The
|
|
3056
|
-
*
|
|
3160
|
+
* The returned streams are backed by queues in the current scope and should be
|
|
3161
|
+
* consumed while that scope remains open. The faster stream may advance up to
|
|
3162
|
+
* `bufferSize` elements ahead of the slower one.
|
|
3057
3163
|
*
|
|
3058
|
-
* @
|
|
3059
|
-
* @
|
|
3164
|
+
* @category filtering
|
|
3165
|
+
* @since 2.0.0
|
|
3166
|
+
*
|
|
3167
|
+
* **Example** (Partitioning a stream)
|
|
3060
3168
|
*
|
|
3061
|
-
* @example
|
|
3062
3169
|
* ```ts
|
|
3063
3170
|
* import { Console, Effect, Result, Stream } from "effect"
|
|
3064
3171
|
*
|
|
@@ -3083,7 +3190,8 @@ export const partition = /*#__PURE__*/dual(args => isStream(args[0]), (self, fil
|
|
|
3083
3190
|
* Returns the specified stream if the given condition is satisfied, otherwise
|
|
3084
3191
|
* returns an empty stream.
|
|
3085
3192
|
*
|
|
3086
|
-
*
|
|
3193
|
+
* **Example** (Conditionally keeping a stream)
|
|
3194
|
+
*
|
|
3087
3195
|
* ```ts
|
|
3088
3196
|
* import { Console, Effect, Stream } from "effect"
|
|
3089
3197
|
*
|
|
@@ -3098,8 +3206,8 @@ export const partition = /*#__PURE__*/dual(args => isStream(args[0]), (self, fil
|
|
|
3098
3206
|
* // Output: []
|
|
3099
3207
|
* ```
|
|
3100
3208
|
*
|
|
3209
|
+
* @category filtering
|
|
3101
3210
|
* @since 2.0.0
|
|
3102
|
-
* @category Filtering
|
|
3103
3211
|
*/
|
|
3104
3212
|
export const when = /*#__PURE__*/dual(2, (self, test) => test.pipe(Effect.map(pass => pass ? self : empty), unwrap));
|
|
3105
3213
|
/**
|
|
@@ -3108,7 +3216,8 @@ export const when = /*#__PURE__*/dual(2, (self, test) => test.pipe(Effect.map(pa
|
|
|
3108
3216
|
*
|
|
3109
3217
|
* The returned stream is only valid within the scope.
|
|
3110
3218
|
*
|
|
3111
|
-
*
|
|
3219
|
+
* **Example** (Peeling a stream with a sink)
|
|
3220
|
+
*
|
|
3112
3221
|
* ```ts
|
|
3113
3222
|
* import { Console, Effect, Sink, Stream } from "effect"
|
|
3114
3223
|
*
|
|
@@ -3127,8 +3236,8 @@ export const when = /*#__PURE__*/dual(2, (self, test) => test.pipe(Effect.map(pa
|
|
|
3127
3236
|
* // Output: [ [1, 2, 3], [4, 5, 6] ]
|
|
3128
3237
|
* ```
|
|
3129
3238
|
*
|
|
3239
|
+
* @category destructors
|
|
3130
3240
|
* @since 2.0.0
|
|
3131
|
-
* @category Destructors
|
|
3132
3241
|
*/
|
|
3133
3242
|
export const peel = /*#__PURE__*/dual(2, /*#__PURE__*/Effect.fnUntraced(function* (self, sink) {
|
|
3134
3243
|
let cause = undefined;
|
|
@@ -3147,10 +3256,13 @@ export const peel = /*#__PURE__*/dual(2, /*#__PURE__*/Effect.fnUntraced(function
|
|
|
3147
3256
|
* Buffers up to `capacity` elements so a faster producer can progress
|
|
3148
3257
|
* independently of a slower consumer.
|
|
3149
3258
|
*
|
|
3150
|
-
*
|
|
3151
|
-
*
|
|
3259
|
+
* Finite buffers use the configured queue strategy: `"suspend"` applies
|
|
3260
|
+
* backpressure, while `"dropping"` and `"sliding"` may discard elements when
|
|
3261
|
+
* the buffer is full. This combinator destroys chunking; use `Stream.rechunk`
|
|
3262
|
+
* afterward if you need fixed chunk sizes.
|
|
3263
|
+
*
|
|
3264
|
+
* **Example** (Buffering stream elements)
|
|
3152
3265
|
*
|
|
3153
|
-
* @example
|
|
3154
3266
|
* ```ts
|
|
3155
3267
|
* import { Console, Effect, Stream } from "effect"
|
|
3156
3268
|
*
|
|
@@ -3166,23 +3278,21 @@ export const peel = /*#__PURE__*/dual(2, /*#__PURE__*/Effect.fnUntraced(function
|
|
|
3166
3278
|
* // Output: [ 1, 2, 3 ]
|
|
3167
3279
|
* ```
|
|
3168
3280
|
*
|
|
3169
|
-
* @since 2.0.0
|
|
3170
3281
|
* @category Rate Limiting
|
|
3282
|
+
* @since 2.0.0
|
|
3171
3283
|
*/
|
|
3172
3284
|
export const buffer = /*#__PURE__*/dual(2, (self, options) => fromChannel(Channel.bufferArray(self.channel, options)));
|
|
3173
3285
|
/**
|
|
3174
3286
|
* Allows a faster producer to progress independently of a slower consumer by
|
|
3175
3287
|
* buffering up to `capacity` chunks in a queue.
|
|
3176
3288
|
*
|
|
3177
|
-
*
|
|
3178
|
-
*
|
|
3179
|
-
*
|
|
3180
|
-
*
|
|
3181
|
-
* This API replaces the following from Effect 3.x:
|
|
3289
|
+
* Finite buffers use the configured queue strategy: `"suspend"` applies
|
|
3290
|
+
* backpressure, while `"dropping"` and `"sliding"` may discard chunks when the
|
|
3291
|
+
* buffer is full. This combinator preserves chunking and is best with
|
|
3292
|
+
* power-of-2 capacities.
|
|
3182
3293
|
*
|
|
3183
|
-
*
|
|
3294
|
+
* **Example** (Buffering stream chunks)
|
|
3184
3295
|
*
|
|
3185
|
-
* @example
|
|
3186
3296
|
* ```ts
|
|
3187
3297
|
* import { Console, Effect, Stream } from "effect"
|
|
3188
3298
|
*
|
|
@@ -3197,8 +3307,8 @@ export const buffer = /*#__PURE__*/dual(2, (self, options) => fromChannel(Channe
|
|
|
3197
3307
|
* // Output: [ 1, 2, 3, 4 ]
|
|
3198
3308
|
* ```
|
|
3199
3309
|
*
|
|
3200
|
-
* @since 2.0.0
|
|
3201
3310
|
* @category Rate Limiting
|
|
3311
|
+
* @since 4.0.0
|
|
3202
3312
|
*/
|
|
3203
3313
|
export const bufferArray = /*#__PURE__*/dual(2, (self, options) => fromChannel(Channel.buffer(self.channel, options)));
|
|
3204
3314
|
/**
|
|
@@ -3206,13 +3316,8 @@ export const bufferArray = /*#__PURE__*/dual(2, (self, options) => fromChannel(C
|
|
|
3206
3316
|
* one fails. Allows recovery from all causes of failure, including
|
|
3207
3317
|
* interruption if the stream is uninterruptible.
|
|
3208
3318
|
*
|
|
3209
|
-
* **
|
|
3210
|
-
*
|
|
3211
|
-
* This API replaces the following from Effect 3.x:
|
|
3212
|
-
*
|
|
3213
|
-
* - `Stream.catchAllCause`
|
|
3319
|
+
* **Example** (Catching stream causes)
|
|
3214
3320
|
*
|
|
3215
|
-
* @example
|
|
3216
3321
|
* ```ts
|
|
3217
3322
|
* import { Console, Effect, Stream } from "effect"
|
|
3218
3323
|
*
|
|
@@ -3234,21 +3339,16 @@ export const bufferArray = /*#__PURE__*/dual(2, (self, options) => fromChannel(C
|
|
|
3234
3339
|
* // Output: [ 1, 2, 999 ]
|
|
3235
3340
|
* ```
|
|
3236
3341
|
*
|
|
3237
|
-
* @
|
|
3238
|
-
* @
|
|
3342
|
+
* @category error handling
|
|
3343
|
+
* @since 2.0.0
|
|
3239
3344
|
*/
|
|
3240
3345
|
export const catchCause = /*#__PURE__*/dual(2, (self, f) => self.channel.pipe(Channel.catchCause(cause => f(cause).channel), fromChannel));
|
|
3241
3346
|
/**
|
|
3242
3347
|
* Runs an effect when the stream fails without changing its values or error,
|
|
3243
3348
|
* unless the tap effect itself fails.
|
|
3244
3349
|
*
|
|
3245
|
-
* **
|
|
3246
|
-
*
|
|
3247
|
-
* This API replaces the following from Effect 3.x:
|
|
3248
|
-
*
|
|
3249
|
-
* - `Stream.tapErrorCause`
|
|
3350
|
+
* **Example** (Tapping stream causes)
|
|
3250
3351
|
*
|
|
3251
|
-
* @example
|
|
3252
3352
|
* ```ts
|
|
3253
3353
|
* import { Cause, Console, Effect, Stream } from "effect"
|
|
3254
3354
|
*
|
|
@@ -3268,8 +3368,8 @@ export const catchCause = /*#__PURE__*/dual(2, (self, f) => self.channel.pipe(Ch
|
|
|
3268
3368
|
* // Output: [ 1, 2, 0 ]
|
|
3269
3369
|
* ```
|
|
3270
3370
|
*
|
|
3271
|
-
* @
|
|
3272
|
-
* @
|
|
3371
|
+
* @category error handling
|
|
3372
|
+
* @since 2.0.0
|
|
3273
3373
|
*/
|
|
3274
3374
|
export const tapCause = /*#__PURE__*/dual(2, (self, f) => self.channel.pipe(Channel.tapCause(f), fromChannel));
|
|
3275
3375
|
const catch_ = /*#__PURE__*/dual(2, (self, f) => fromChannel(Channel.catch(self.channel, error => f(error).channel)));
|
|
@@ -3277,13 +3377,8 @@ export {
|
|
|
3277
3377
|
/**
|
|
3278
3378
|
* Switches over to the stream produced by the provided function if this one fails.
|
|
3279
3379
|
*
|
|
3280
|
-
* **
|
|
3281
|
-
*
|
|
3282
|
-
* This API replaces the following from Effect 3.x:
|
|
3283
|
-
*
|
|
3284
|
-
* - `Stream.catchAll`
|
|
3380
|
+
* **Example** (Catching stream failures)
|
|
3285
3381
|
*
|
|
3286
|
-
* @example
|
|
3287
3382
|
* ```ts
|
|
3288
3383
|
* import { Console, Effect, Stream } from "effect"
|
|
3289
3384
|
*
|
|
@@ -3301,14 +3396,15 @@ export {
|
|
|
3301
3396
|
* // Output: [ 1, 2, 999 ]
|
|
3302
3397
|
* ```
|
|
3303
3398
|
*
|
|
3399
|
+
* @category error handling
|
|
3304
3400
|
* @since 4.0.0
|
|
3305
|
-
* @category Error Handling
|
|
3306
3401
|
*/
|
|
3307
3402
|
catch_ as catch };
|
|
3308
3403
|
/**
|
|
3309
3404
|
* Effectfully peeks at errors without changing the stream unless the tap fails.
|
|
3310
3405
|
*
|
|
3311
|
-
*
|
|
3406
|
+
* **Example** (Effectfully peeking at errors)
|
|
3407
|
+
*
|
|
3312
3408
|
* ```ts
|
|
3313
3409
|
* import { Console, Effect, Stream } from "effect"
|
|
3314
3410
|
*
|
|
@@ -3329,8 +3425,8 @@ catch_ as catch };
|
|
|
3329
3425
|
* // [ 1, 2, 999 ]
|
|
3330
3426
|
* ```
|
|
3331
3427
|
*
|
|
3332
|
-
* @
|
|
3333
|
-
* @
|
|
3428
|
+
* @category error handling
|
|
3429
|
+
* @since 2.0.0
|
|
3334
3430
|
*/
|
|
3335
3431
|
export const tapError = /*#__PURE__*/dual(2, (self, f) => self.channel.pipe(Channel.tapError(f), fromChannel));
|
|
3336
3432
|
/**
|
|
@@ -3340,13 +3436,8 @@ export const tapError = /*#__PURE__*/dual(2, (self, f) => self.channel.pipe(Chan
|
|
|
3340
3436
|
* stream. Non-matching failures propagate downstream, so the error type is
|
|
3341
3437
|
* preserved unless the filter narrows it.
|
|
3342
3438
|
*
|
|
3343
|
-
* **
|
|
3344
|
-
*
|
|
3345
|
-
* This API replaces the following from Effect 3.x:
|
|
3439
|
+
* **Example** (Catching matching failures)
|
|
3346
3440
|
*
|
|
3347
|
-
* - `Stream.catchSome`
|
|
3348
|
-
*
|
|
3349
|
-
* @example
|
|
3350
3441
|
* ```ts
|
|
3351
3442
|
* import { Console, Effect, Stream } from "effect"
|
|
3352
3443
|
*
|
|
@@ -3367,16 +3458,16 @@ export const tapError = /*#__PURE__*/dual(2, (self, f) => self.channel.pipe(Chan
|
|
|
3367
3458
|
* Effect.runPromise(program)
|
|
3368
3459
|
* ```
|
|
3369
3460
|
*
|
|
3461
|
+
* @category error handling
|
|
3370
3462
|
* @since 4.0.0
|
|
3371
|
-
* @category Error Handling
|
|
3372
3463
|
*/
|
|
3373
3464
|
export const catchIf = /*#__PURE__*/dual(args => isStream(args[0]), (self, predicate, f, orElse) => fromChannel(Channel.catchIf(toChannel(self), predicate, e => f(e).channel, orElse && (e => orElse(e).channel))));
|
|
3374
3465
|
/**
|
|
3375
3466
|
* Recovers from errors that match a `Filter` by switching to a recovery
|
|
3376
3467
|
* stream.
|
|
3377
3468
|
*
|
|
3469
|
+
* @category error handling
|
|
3378
3470
|
* @since 4.0.0
|
|
3379
|
-
* @category Error Handling
|
|
3380
3471
|
*/
|
|
3381
3472
|
export const catchFilter = /*#__PURE__*/dual(args => isStream(args[0]), (self, filter, f, orElse) => fromChannel(Channel.catchFilter(toChannel(self), filter, e => f(e).channel, orElse && (e => orElse(e).channel))));
|
|
3382
3473
|
/**
|
|
@@ -3388,7 +3479,8 @@ export const catchFilter = /*#__PURE__*/dual(args => isStream(args[0]), (self, f
|
|
|
3388
3479
|
* Use `catchTag` when your error type is a tagged union with a readonly `_tag`
|
|
3389
3480
|
* field and you want to handle a specific error case.
|
|
3390
3481
|
*
|
|
3391
|
-
*
|
|
3482
|
+
* **Example** (Catching tagged failures)
|
|
3483
|
+
*
|
|
3392
3484
|
* ```ts
|
|
3393
3485
|
* import { Console, Data, Effect, Stream } from "effect"
|
|
3394
3486
|
*
|
|
@@ -3409,8 +3501,8 @@ export const catchFilter = /*#__PURE__*/dual(args => isStream(args[0]), (self, f
|
|
|
3409
3501
|
* Effect.runPromise(program)
|
|
3410
3502
|
* ```
|
|
3411
3503
|
*
|
|
3412
|
-
* @
|
|
3413
|
-
* @
|
|
3504
|
+
* @category error handling
|
|
3505
|
+
* @since 2.0.0
|
|
3414
3506
|
*/
|
|
3415
3507
|
export const catchTag = /*#__PURE__*/dual(args => isStream(args[0]), (self, k, f, orElse) => {
|
|
3416
3508
|
const pred = Array.isArray(k) ? e => hasProperty(e, "_tag") && k.includes(e._tag) : isTagged(k);
|
|
@@ -3419,7 +3511,8 @@ export const catchTag = /*#__PURE__*/dual(args => isStream(args[0]), (self, k, f
|
|
|
3419
3511
|
/**
|
|
3420
3512
|
* Switches to a recovery stream based on matching `_tag` handlers.
|
|
3421
3513
|
*
|
|
3422
|
-
*
|
|
3514
|
+
* **Example** (Catching tagged failures with handlers)
|
|
3515
|
+
*
|
|
3423
3516
|
* ```ts
|
|
3424
3517
|
* import { Console, Effect, Stream } from "effect"
|
|
3425
3518
|
*
|
|
@@ -3449,8 +3542,8 @@ export const catchTag = /*#__PURE__*/dual(args => isStream(args[0]), (self, k, f
|
|
|
3449
3542
|
* // Output: [ "fallback" ]
|
|
3450
3543
|
* ```
|
|
3451
3544
|
*
|
|
3452
|
-
* @
|
|
3453
|
-
* @
|
|
3545
|
+
* @category error handling
|
|
3546
|
+
* @since 2.0.0
|
|
3454
3547
|
*/
|
|
3455
3548
|
export const catchTags = /*#__PURE__*/dual(args => isStream(args[0]), (self, cases, orElse) => {
|
|
3456
3549
|
let keys;
|
|
@@ -3465,7 +3558,8 @@ export const catchTags = /*#__PURE__*/dual(args => isStream(args[0]), (self, cas
|
|
|
3465
3558
|
* Use this to handle nested error causes without removing the parent error
|
|
3466
3559
|
* from the error channel. The handler receives the unwrapped reason.
|
|
3467
3560
|
*
|
|
3468
|
-
*
|
|
3561
|
+
* **Example** (Catching a tagged error reason)
|
|
3562
|
+
*
|
|
3469
3563
|
* ```ts
|
|
3470
3564
|
* import { Console, Data, Effect, Stream } from "effect"
|
|
3471
3565
|
*
|
|
@@ -3499,14 +3593,15 @@ export const catchTags = /*#__PURE__*/dual(args => isStream(args[0]), (self, cas
|
|
|
3499
3593
|
* // Output: [ "retry: 60" ]
|
|
3500
3594
|
* ```
|
|
3501
3595
|
*
|
|
3596
|
+
* @category error handling
|
|
3502
3597
|
* @since 4.0.0
|
|
3503
|
-
* @category Error Handling
|
|
3504
3598
|
*/
|
|
3505
3599
|
export const catchReason = /*#__PURE__*/dual(args => isStream(args[0]), (self, errorTag, reasonTag, f, orElse) => fromChannel(Channel.catchReason(toChannel(self), errorTag, reasonTag, (reason, error) => f(reason, error).channel, orElse && ((reason, error) => orElse(reason, error).channel))));
|
|
3506
3600
|
/**
|
|
3507
3601
|
* Catches multiple reasons within a tagged error using an object of handlers.
|
|
3508
3602
|
*
|
|
3509
|
-
*
|
|
3603
|
+
* **Example** (Catching tagged error reasons)
|
|
3604
|
+
*
|
|
3510
3605
|
* ```ts
|
|
3511
3606
|
* import { Console, Data, Effect, Stream } from "effect"
|
|
3512
3607
|
*
|
|
@@ -3541,8 +3636,8 @@ export const catchReason = /*#__PURE__*/dual(args => isStream(args[0]), (self, e
|
|
|
3541
3636
|
* // Output: [ "retry: 60" ]
|
|
3542
3637
|
* ```
|
|
3543
3638
|
*
|
|
3639
|
+
* @category error handling
|
|
3544
3640
|
* @since 4.0.0
|
|
3545
|
-
* @category Error Handling
|
|
3546
3641
|
*/
|
|
3547
3642
|
export const catchReasons = /*#__PURE__*/dual(args => isStream(args[0]), (self, errorTag, cases, orElse) => {
|
|
3548
3643
|
const handlers = {};
|
|
@@ -3556,7 +3651,8 @@ export const catchReasons = /*#__PURE__*/dual(args => isStream(args[0]), (self,
|
|
|
3556
3651
|
/**
|
|
3557
3652
|
* Transforms the errors emitted by this stream using `f`.
|
|
3558
3653
|
*
|
|
3559
|
-
*
|
|
3654
|
+
* **Example** (Mapping stream errors)
|
|
3655
|
+
*
|
|
3560
3656
|
* ```ts
|
|
3561
3657
|
* import { Console, Effect, Stream } from "effect"
|
|
3562
3658
|
*
|
|
@@ -3573,21 +3669,16 @@ export const catchReasons = /*#__PURE__*/dual(args => isStream(args[0]), (self,
|
|
|
3573
3669
|
* // Output: [ "recovered from mapped: bad" ]
|
|
3574
3670
|
* ```
|
|
3575
3671
|
*
|
|
3672
|
+
* @category error handling
|
|
3576
3673
|
* @since 2.0.0
|
|
3577
|
-
* @category Error Handling
|
|
3578
3674
|
*/
|
|
3579
3675
|
export const mapError = /*#__PURE__*/dual(2, (self, f) => fromChannel(Channel.mapError(self.channel, f)));
|
|
3580
3676
|
/**
|
|
3581
3677
|
* Recovers from stream failures by filtering the `Cause` and switching to a recovery stream.
|
|
3582
3678
|
* Non-matching causes are re-emitted as failures.
|
|
3583
3679
|
*
|
|
3584
|
-
* **
|
|
3585
|
-
*
|
|
3586
|
-
* This API replaces the following from Effect 3.x:
|
|
3587
|
-
*
|
|
3588
|
-
* - `Stream.catchSomeCause`
|
|
3680
|
+
* **Example** (Catching matching causes)
|
|
3589
3681
|
*
|
|
3590
|
-
* @example
|
|
3591
3682
|
* ```ts
|
|
3592
3683
|
* import { Cause, Console, Effect, Stream } from "effect"
|
|
3593
3684
|
*
|
|
@@ -3607,22 +3698,23 @@ export const mapError = /*#__PURE__*/dual(2, (self, f) => fromChannel(Channel.ma
|
|
|
3607
3698
|
* // Output: [ "Recovered: NetworkError" ]
|
|
3608
3699
|
* ```
|
|
3609
3700
|
*
|
|
3701
|
+
* @category error handling
|
|
3610
3702
|
* @since 4.0.0
|
|
3611
|
-
* @category Error Handling
|
|
3612
3703
|
*/
|
|
3613
3704
|
export const catchCauseIf = /*#__PURE__*/dual(3, (self, predicate, f) => fromChannel(Channel.catchCauseIf(self.channel, predicate, cause => f(cause).channel)));
|
|
3614
3705
|
/**
|
|
3615
3706
|
* Recovers from stream failures by filtering the `Cause` and switching to a
|
|
3616
3707
|
* recovery stream.
|
|
3617
3708
|
*
|
|
3709
|
+
* @category error handling
|
|
3618
3710
|
* @since 4.0.0
|
|
3619
|
-
* @category Error Handling
|
|
3620
3711
|
*/
|
|
3621
3712
|
export const catchCauseFilter = /*#__PURE__*/dual(3, (self, filter, f) => fromChannel(Channel.catchCauseFilter(self.channel, filter, (failure, cause) => f(failure, cause).channel)));
|
|
3622
3713
|
/**
|
|
3623
3714
|
* Switches to a fallback stream if this stream is empty.
|
|
3624
3715
|
*
|
|
3625
|
-
*
|
|
3716
|
+
* **Example** (Switching on empty streams)
|
|
3717
|
+
*
|
|
3626
3718
|
* ```ts
|
|
3627
3719
|
* import { Console, Effect, Stream } from "effect"
|
|
3628
3720
|
*
|
|
@@ -3638,14 +3730,15 @@ export const catchCauseFilter = /*#__PURE__*/dual(3, (self, filter, f) => fromCh
|
|
|
3638
3730
|
* // Output: [ 1, 2 ]
|
|
3639
3731
|
* ```
|
|
3640
3732
|
*
|
|
3733
|
+
* @category error handling
|
|
3641
3734
|
* @since 2.0.0
|
|
3642
|
-
* @category Error Handling
|
|
3643
3735
|
*/
|
|
3644
3736
|
export const orElseIfEmpty = /*#__PURE__*/dual(2, (self, orElse) => fromChannel(Channel.orElseIfEmpty(self.channel, _ => toChannel(orElse()))));
|
|
3645
3737
|
/**
|
|
3646
3738
|
* Returns a stream that emits a fallback value when this stream fails.
|
|
3647
3739
|
*
|
|
3648
|
-
*
|
|
3740
|
+
* **Example** (Recovering with a fallback value)
|
|
3741
|
+
*
|
|
3649
3742
|
* ```ts
|
|
3650
3743
|
* import { Console, Effect, Stream } from "effect"
|
|
3651
3744
|
*
|
|
@@ -3662,14 +3755,15 @@ export const orElseIfEmpty = /*#__PURE__*/dual(2, (self, orElse) => fromChannel(
|
|
|
3662
3755
|
* // Output: [ "Recovered: NetworkError" ]
|
|
3663
3756
|
* ```
|
|
3664
3757
|
*
|
|
3758
|
+
* @category error handling
|
|
3665
3759
|
* @since 2.0.0
|
|
3666
|
-
* @category Error Handling
|
|
3667
3760
|
*/
|
|
3668
3761
|
export const orElseSucceed = /*#__PURE__*/dual(2, (self, f) => catch_(self, e => succeed(f(e))));
|
|
3669
3762
|
/**
|
|
3670
3763
|
* Turns typed failures into defects, making the stream infallible.
|
|
3671
3764
|
*
|
|
3672
|
-
*
|
|
3765
|
+
* **Example** (Turning failures into defects)
|
|
3766
|
+
*
|
|
3673
3767
|
* ```ts
|
|
3674
3768
|
* import { Console, Effect, Stream } from "effect"
|
|
3675
3769
|
*
|
|
@@ -3686,8 +3780,8 @@ export const orElseSucceed = /*#__PURE__*/dual(2, (self, f) => catch_(self, e =>
|
|
|
3686
3780
|
* // Output: [ 1, 2, 3 ]
|
|
3687
3781
|
* ```
|
|
3688
3782
|
*
|
|
3783
|
+
* @category error handling
|
|
3689
3784
|
* @since 2.0.0
|
|
3690
|
-
* @category Error Handling
|
|
3691
3785
|
*/
|
|
3692
3786
|
export const orDie = self => fromChannel(Channel.orDie(self.channel));
|
|
3693
3787
|
/**
|
|
@@ -3695,7 +3789,8 @@ export const orDie = self => fromChannel(Channel.orDie(self.channel));
|
|
|
3695
3789
|
*
|
|
3696
3790
|
* Use the `log` option to emit the full {@link Cause} when the stream fails.
|
|
3697
3791
|
*
|
|
3698
|
-
*
|
|
3792
|
+
* **Example** (Ignoring stream failures)
|
|
3793
|
+
*
|
|
3699
3794
|
* ```ts
|
|
3700
3795
|
* import { Console, Effect, Stream } from "effect"
|
|
3701
3796
|
*
|
|
@@ -3712,17 +3807,24 @@ export const orDie = self => fromChannel(Channel.orDie(self.channel));
|
|
|
3712
3807
|
* // Output: [ 1, 2, 3 ]
|
|
3713
3808
|
* ```
|
|
3714
3809
|
*
|
|
3715
|
-
*
|
|
3810
|
+
* **Example** (Configuring ignore logging)
|
|
3811
|
+
*
|
|
3716
3812
|
* ```ts
|
|
3717
|
-
* import { Stream } from "effect"
|
|
3813
|
+
* import { Effect, Stream } from "effect"
|
|
3718
3814
|
*
|
|
3719
|
-
*
|
|
3815
|
+
* Effect.runPromise(Effect.gen(function*() {
|
|
3816
|
+
* const values = yield* Stream.fail("boom").pipe(
|
|
3817
|
+
* Stream.ignore({ log: false }),
|
|
3818
|
+
* Stream.runCollect
|
|
3819
|
+
* )
|
|
3820
|
+
* yield* Effect.sync(() => console.log(values))
|
|
3821
|
+
* }))
|
|
3720
3822
|
*
|
|
3721
|
-
*
|
|
3823
|
+
* // []
|
|
3722
3824
|
* ```
|
|
3723
3825
|
*
|
|
3826
|
+
* @category error handling
|
|
3724
3827
|
* @since 4.0.0
|
|
3725
|
-
* @category Error Handling
|
|
3726
3828
|
*/
|
|
3727
3829
|
export const ignore = /*#__PURE__*/dual(args => isStream(args[0]), (self, options) => fromChannel(Channel.ignore(self.channel, options)));
|
|
3728
3830
|
/**
|
|
@@ -3730,20 +3832,25 @@ export const ignore = /*#__PURE__*/dual(args => isStream(args[0]), (self, option
|
|
|
3730
3832
|
*
|
|
3731
3833
|
* Use the `log` option to emit the full {@link Cause} when the stream fails.
|
|
3732
3834
|
*
|
|
3733
|
-
*
|
|
3835
|
+
* **Example** (Ignoring stream failure causes)
|
|
3836
|
+
*
|
|
3734
3837
|
* ```ts
|
|
3735
3838
|
* import { Effect, Stream } from "effect"
|
|
3736
3839
|
*
|
|
3737
|
-
*
|
|
3738
|
-
* Stream.
|
|
3739
|
-
*
|
|
3740
|
-
* )
|
|
3840
|
+
* Effect.runPromise(Effect.gen(function*() {
|
|
3841
|
+
* const values = yield* Stream.make(1, 2).pipe(
|
|
3842
|
+
* Stream.concat(Stream.die("boom")),
|
|
3843
|
+
* Stream.ignoreCause({ log: false }),
|
|
3844
|
+
* Stream.runCollect
|
|
3845
|
+
* )
|
|
3846
|
+
* yield* Effect.sync(() => console.log(values))
|
|
3847
|
+
* }))
|
|
3741
3848
|
*
|
|
3742
|
-
*
|
|
3849
|
+
* // [ 1, 2 ]
|
|
3743
3850
|
* ```
|
|
3744
3851
|
*
|
|
3852
|
+
* @category error handling
|
|
3745
3853
|
* @since 4.0.0
|
|
3746
|
-
* @category Error Handling
|
|
3747
3854
|
*/
|
|
3748
3855
|
export const ignoreCause = /*#__PURE__*/dual(args => isStream(args[0]), (self, options) => fromChannel(Channel.ignoreCause(self.channel, options)));
|
|
3749
3856
|
/**
|
|
@@ -3755,7 +3862,8 @@ export const ignoreCause = /*#__PURE__*/dual(args => isStream(args[0]), (self, o
|
|
|
3755
3862
|
* The schedule is reset as soon as the first element passes through the
|
|
3756
3863
|
* stream again.
|
|
3757
3864
|
*
|
|
3758
|
-
*
|
|
3865
|
+
* **Example** (Retrying stream failures)
|
|
3866
|
+
*
|
|
3759
3867
|
* ```ts
|
|
3760
3868
|
* import { Console, Effect, Schedule, Stream } from "effect"
|
|
3761
3869
|
*
|
|
@@ -3774,8 +3882,8 @@ export const ignoreCause = /*#__PURE__*/dual(args => isStream(args[0]), (self, o
|
|
|
3774
3882
|
* // Output: [ 1, 1 ]
|
|
3775
3883
|
* ```
|
|
3776
3884
|
*
|
|
3885
|
+
* @category error handling
|
|
3777
3886
|
* @since 2.0.0
|
|
3778
|
-
* @category Error Handling
|
|
3779
3887
|
*/
|
|
3780
3888
|
export const retry = /*#__PURE__*/dual(2, (self, policy) => fromChannel(Channel.retry(self.channel, policy)));
|
|
3781
3889
|
/**
|
|
@@ -3786,9 +3894,10 @@ export const retry = /*#__PURE__*/dual(2, (self, policy) => fromChannel(Channel.
|
|
|
3786
3894
|
* `preventFallbackOnPartialStream` to fail instead of mixing partial output with
|
|
3787
3895
|
* a later fallback.
|
|
3788
3896
|
*
|
|
3789
|
-
*
|
|
3897
|
+
* **Example** (Applying an execution plan)
|
|
3898
|
+
*
|
|
3790
3899
|
* ```ts
|
|
3791
|
-
* import { Console, Effect, ExecutionPlan, Layer,
|
|
3900
|
+
* import { Console, Context, Effect, ExecutionPlan, Layer, Stream } from "effect"
|
|
3792
3901
|
*
|
|
3793
3902
|
* class Service extends Context.Service<Service>()("Service", {
|
|
3794
3903
|
* make: Effect.succeed({
|
|
@@ -3815,9 +3924,8 @@ export const retry = /*#__PURE__*/dual(2, (self, policy) => fromChannel(Channel.
|
|
|
3815
3924
|
* // Output: [ 1, 2, 3 ]
|
|
3816
3925
|
* ```
|
|
3817
3926
|
*
|
|
3927
|
+
* @category error handling
|
|
3818
3928
|
* @since 3.16.0
|
|
3819
|
-
* @category Error Handling
|
|
3820
|
-
* @experimental
|
|
3821
3929
|
*/
|
|
3822
3930
|
export const withExecutionPlan = /*#__PURE__*/dual(args => isStream(args[0]), (self, policy, options) => suspend(() => {
|
|
3823
3931
|
const preventFallbackOnPartialStream = options?.preventFallbackOnPartialStream ?? false;
|
|
@@ -3873,7 +3981,8 @@ export const withExecutionPlan = /*#__PURE__*/dual(args => isStream(args[0]), (s
|
|
|
3873
3981
|
/**
|
|
3874
3982
|
* Takes the first `n` elements from this stream, returning `Stream.empty` when `n < 1`.
|
|
3875
3983
|
*
|
|
3876
|
-
*
|
|
3984
|
+
* **Example** (Taking values from the left)
|
|
3985
|
+
*
|
|
3877
3986
|
* ```ts
|
|
3878
3987
|
* import { Console, Effect, Stream } from "effect"
|
|
3879
3988
|
*
|
|
@@ -3889,14 +3998,15 @@ export const withExecutionPlan = /*#__PURE__*/dual(args => isStream(args[0]), (s
|
|
|
3889
3998
|
* // Output: [ 1, 2, 3 ]
|
|
3890
3999
|
* ```
|
|
3891
4000
|
*
|
|
4001
|
+
* @category filtering
|
|
3892
4002
|
* @since 2.0.0
|
|
3893
|
-
* @category Filtering
|
|
3894
4003
|
*/
|
|
3895
4004
|
export const take = /*#__PURE__*/dual(2, (self, n) => n < 1 ? empty : takeUntil(self, (_, i) => i === n - 1));
|
|
3896
4005
|
/**
|
|
3897
4006
|
* Keeps the last `n` elements from this stream.
|
|
3898
4007
|
*
|
|
3899
|
-
*
|
|
4008
|
+
* **Example** (Taking elements from the right)
|
|
4009
|
+
*
|
|
3900
4010
|
* ```ts
|
|
3901
4011
|
* import { Console, Effect, Stream } from "effect"
|
|
3902
4012
|
*
|
|
@@ -3912,8 +4022,8 @@ export const take = /*#__PURE__*/dual(2, (self, n) => n < 1 ? empty : takeUntil(
|
|
|
3912
4022
|
* // Output: [ 4, 5, 6 ]
|
|
3913
4023
|
* ```
|
|
3914
4024
|
*
|
|
4025
|
+
* @category filtering
|
|
3915
4026
|
* @since 2.0.0
|
|
3916
|
-
* @category Filtering
|
|
3917
4027
|
*/
|
|
3918
4028
|
export const takeRight = /*#__PURE__*/dual(2, (self, n) => mapAccumArray(self, MutableList.make, (list, arr) => {
|
|
3919
4029
|
MutableList.appendAll(list, arr);
|
|
@@ -3931,7 +4041,8 @@ export const takeRight = /*#__PURE__*/dual(2, (self, n) => mapAccumArray(self, M
|
|
|
3931
4041
|
*
|
|
3932
4042
|
* When `excludeLast` is `true`, the matching element is dropped.
|
|
3933
4043
|
*
|
|
3934
|
-
*
|
|
4044
|
+
* **Example** (Taking until a predicate matches)
|
|
4045
|
+
*
|
|
3935
4046
|
* ```ts
|
|
3936
4047
|
* import { Console, Effect, Stream } from "effect"
|
|
3937
4048
|
*
|
|
@@ -3954,8 +4065,8 @@ export const takeRight = /*#__PURE__*/dual(2, (self, n) => mapAccumArray(self, M
|
|
|
3954
4065
|
* })
|
|
3955
4066
|
* ```
|
|
3956
4067
|
*
|
|
4068
|
+
* @category filtering
|
|
3957
4069
|
* @since 2.0.0
|
|
3958
|
-
* @category Filtering
|
|
3959
4070
|
*/
|
|
3960
4071
|
export const takeUntil = /*#__PURE__*/dual(args => isStream(args[0]), (self, predicate, options) => transformPull(self, (pull, _scope) => Effect.sync(() => {
|
|
3961
4072
|
let i = 0;
|
|
@@ -3974,7 +4085,8 @@ export const takeUntil = /*#__PURE__*/dual(args => isStream(args[0]), (self, pre
|
|
|
3974
4085
|
/**
|
|
3975
4086
|
* Effectful predicate version of `takeUntil`.
|
|
3976
4087
|
*
|
|
3977
|
-
*
|
|
4088
|
+
* **Example** (Taking until an effectful predicate matches)
|
|
4089
|
+
*
|
|
3978
4090
|
* ```ts
|
|
3979
4091
|
* import { Console, Effect, Stream } from "effect"
|
|
3980
4092
|
*
|
|
@@ -3990,8 +4102,8 @@ export const takeUntil = /*#__PURE__*/dual(args => isStream(args[0]), (self, pre
|
|
|
3990
4102
|
* // Output: [ 1, 2, 3 ]
|
|
3991
4103
|
* ```
|
|
3992
4104
|
*
|
|
4105
|
+
* @category filtering
|
|
3993
4106
|
* @since 2.0.0
|
|
3994
|
-
* @category Filtering
|
|
3995
4107
|
*/
|
|
3996
4108
|
export const takeUntilEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self, predicate, options) => transformPull(self, (pull, _scope) => Effect.sync(() => {
|
|
3997
4109
|
let i = 0;
|
|
@@ -4012,7 +4124,8 @@ export const takeUntilEffect = /*#__PURE__*/dual(args => isStream(args[0]), (sel
|
|
|
4012
4124
|
/**
|
|
4013
4125
|
* Takes the longest initial prefix of elements that satisfy the predicate.
|
|
4014
4126
|
*
|
|
4015
|
-
*
|
|
4127
|
+
* **Example** (Taking while a predicate holds)
|
|
4128
|
+
*
|
|
4016
4129
|
* ```ts
|
|
4017
4130
|
* import { Console, Effect, Stream } from "effect"
|
|
4018
4131
|
*
|
|
@@ -4029,8 +4142,8 @@ export const takeUntilEffect = /*#__PURE__*/dual(args => isStream(args[0]), (sel
|
|
|
4029
4142
|
* // Output: [ 1, 2 ]
|
|
4030
4143
|
* ```
|
|
4031
4144
|
*
|
|
4145
|
+
* @category filtering
|
|
4032
4146
|
* @since 2.0.0
|
|
4033
|
-
* @category Filtering
|
|
4034
4147
|
*/
|
|
4035
4148
|
export const takeWhile = /*#__PURE__*/dual(2, (self, predicate) => transformPull(self, (pull, _scope) => Effect.sync(() => {
|
|
4036
4149
|
let i = 0;
|
|
@@ -4049,10 +4162,13 @@ export const takeWhile = /*#__PURE__*/dual(2, (self, predicate) => transformPull
|
|
|
4049
4162
|
return pump;
|
|
4050
4163
|
})));
|
|
4051
4164
|
/**
|
|
4052
|
-
* Takes the longest initial prefix
|
|
4165
|
+
* Takes the longest initial prefix accepted by a `Filter` and emits the
|
|
4166
|
+
* filter's success values.
|
|
4053
4167
|
*
|
|
4168
|
+
* The stream stops at the first `Result.fail` returned by the filter.
|
|
4169
|
+
*
|
|
4170
|
+
* @category filtering
|
|
4054
4171
|
* @since 4.0.0
|
|
4055
|
-
* @category Filtering
|
|
4056
4172
|
*/
|
|
4057
4173
|
export const takeWhileFilter = /*#__PURE__*/dual(2, (self, filter) => transformPull(self, (pull, _scope) => Effect.sync(() => {
|
|
4058
4174
|
let done = false;
|
|
@@ -4073,7 +4189,8 @@ export const takeWhileFilter = /*#__PURE__*/dual(2, (self, filter) => transformP
|
|
|
4073
4189
|
/**
|
|
4074
4190
|
* Takes elements from the stream while the effectful predicate is `true`.
|
|
4075
4191
|
*
|
|
4076
|
-
*
|
|
4192
|
+
* **Example** (Effectfully taking while a predicate holds)
|
|
4193
|
+
*
|
|
4077
4194
|
* ```ts
|
|
4078
4195
|
* import { Console, Effect, Stream } from "effect"
|
|
4079
4196
|
*
|
|
@@ -4089,8 +4206,8 @@ export const takeWhileFilter = /*#__PURE__*/dual(2, (self, filter) => transformP
|
|
|
4089
4206
|
* // Output: [ 1, 2 ]
|
|
4090
4207
|
* ```
|
|
4091
4208
|
*
|
|
4092
|
-
* @
|
|
4093
|
-
* @
|
|
4209
|
+
* @category filtering
|
|
4210
|
+
* @since 4.0.0
|
|
4094
4211
|
*/
|
|
4095
4212
|
export const takeWhileEffect = /*#__PURE__*/dual(2, (self, predicate) => takeUntilEffect(self, (a, n) => Effect.map(predicate(a, n), b => !b), {
|
|
4096
4213
|
excludeLast: true
|
|
@@ -4098,7 +4215,8 @@ export const takeWhileEffect = /*#__PURE__*/dual(2, (self, predicate) => takeUnt
|
|
|
4098
4215
|
/**
|
|
4099
4216
|
* Drops the first `n` elements from this stream.
|
|
4100
4217
|
*
|
|
4101
|
-
*
|
|
4218
|
+
* **Example** (Dropping values from the left)
|
|
4219
|
+
*
|
|
4102
4220
|
* ```ts
|
|
4103
4221
|
* import { Console, Effect, Stream } from "effect"
|
|
4104
4222
|
*
|
|
@@ -4114,8 +4232,8 @@ export const takeWhileEffect = /*#__PURE__*/dual(2, (self, predicate) => takeUnt
|
|
|
4114
4232
|
* // Output: [ 3, 4, 5 ]
|
|
4115
4233
|
* ```
|
|
4116
4234
|
*
|
|
4235
|
+
* @category filtering
|
|
4117
4236
|
* @since 2.0.0
|
|
4118
|
-
* @category Filtering
|
|
4119
4237
|
*/
|
|
4120
4238
|
export const drop = /*#__PURE__*/dual(2, (self, n) => transformPull(self, (pull, _scope) => Effect.sync(() => {
|
|
4121
4239
|
let dropped = 0;
|
|
@@ -4131,7 +4249,8 @@ export const drop = /*#__PURE__*/dual(2, (self, n) => transformPull(self, (pull,
|
|
|
4131
4249
|
* Drops elements until the specified predicate evaluates to `true`, then drops
|
|
4132
4250
|
* that matching element.
|
|
4133
4251
|
*
|
|
4134
|
-
*
|
|
4252
|
+
* **Example** (Dropping until a predicate matches)
|
|
4253
|
+
*
|
|
4135
4254
|
* ```ts
|
|
4136
4255
|
* import { Console, Effect, Stream } from "effect"
|
|
4137
4256
|
*
|
|
@@ -4144,8 +4263,8 @@ export const drop = /*#__PURE__*/dual(2, (self, n) => transformPull(self, (pull,
|
|
|
4144
4263
|
* })
|
|
4145
4264
|
* ```
|
|
4146
4265
|
*
|
|
4266
|
+
* @category filtering
|
|
4147
4267
|
* @since 2.0.0
|
|
4148
|
-
* @category Filtering
|
|
4149
4268
|
*/
|
|
4150
4269
|
export const dropUntil = /*#__PURE__*/dual(2, (self, predicate) => drop(dropWhile(self, (a, i) => !predicate(a, i)), 1));
|
|
4151
4270
|
/**
|
|
@@ -4154,7 +4273,8 @@ export const dropUntil = /*#__PURE__*/dual(2, (self, predicate) => drop(dropWhil
|
|
|
4154
4273
|
*
|
|
4155
4274
|
* The first element that satisfies the predicate is also dropped.
|
|
4156
4275
|
*
|
|
4157
|
-
*
|
|
4276
|
+
* **Example** (Dropping until an effectful predicate matches)
|
|
4277
|
+
*
|
|
4158
4278
|
* ```ts
|
|
4159
4279
|
* import { Console, Effect, Stream } from "effect"
|
|
4160
4280
|
*
|
|
@@ -4170,14 +4290,15 @@ export const dropUntil = /*#__PURE__*/dual(2, (self, predicate) => drop(dropWhil
|
|
|
4170
4290
|
* // Output: [ 4, 5 ]
|
|
4171
4291
|
* ```
|
|
4172
4292
|
*
|
|
4293
|
+
* @category filtering
|
|
4173
4294
|
* @since 2.0.0
|
|
4174
|
-
* @category Filtering
|
|
4175
4295
|
*/
|
|
4176
4296
|
export const dropUntilEffect = /*#__PURE__*/dual(2, (self, predicate) => drop(dropWhileEffect(self, (a, i) => Effect.map(predicate(a, i), b => !b)), 1));
|
|
4177
4297
|
/**
|
|
4178
4298
|
* Drops elements from the stream while the specified predicate evaluates to `true`.
|
|
4179
4299
|
*
|
|
4180
|
-
*
|
|
4300
|
+
* **Example** (Dropping while a predicate holds)
|
|
4301
|
+
*
|
|
4181
4302
|
* ```ts
|
|
4182
4303
|
* import { Console, Effect, Stream } from "effect"
|
|
4183
4304
|
*
|
|
@@ -4193,8 +4314,8 @@ export const dropUntilEffect = /*#__PURE__*/dual(2, (self, predicate) => drop(dr
|
|
|
4193
4314
|
* // Output: [ 3, 4, 5 ]
|
|
4194
4315
|
* ```
|
|
4195
4316
|
*
|
|
4317
|
+
* @category filtering
|
|
4196
4318
|
* @since 2.0.0
|
|
4197
|
-
* @category Filtering
|
|
4198
4319
|
*/
|
|
4199
4320
|
export const dropWhile = /*#__PURE__*/dual(2, (self, predicate) => transformPull(self, (pull, _scope) => Effect.sync(() => {
|
|
4200
4321
|
let dropping = true;
|
|
@@ -4210,8 +4331,8 @@ export const dropWhile = /*#__PURE__*/dual(2, (self, predicate) => transformPull
|
|
|
4210
4331
|
/**
|
|
4211
4332
|
* Drops elements while the filter succeeds.
|
|
4212
4333
|
*
|
|
4334
|
+
* @category filtering
|
|
4213
4335
|
* @since 4.0.0
|
|
4214
|
-
* @category Filtering
|
|
4215
4336
|
*/
|
|
4216
4337
|
export const dropWhileFilter = /*#__PURE__*/dual(2, (self, filter) => transformPull(self, (pull, _scope) => Effect.sync(() => {
|
|
4217
4338
|
let dropping = true;
|
|
@@ -4226,7 +4347,8 @@ export const dropWhileFilter = /*#__PURE__*/dual(2, (self, filter) => transformP
|
|
|
4226
4347
|
/**
|
|
4227
4348
|
* Drops elements while the specified effectful predicate evaluates to `true`.
|
|
4228
4349
|
*
|
|
4229
|
-
*
|
|
4350
|
+
* **Example** (Effectfully dropping while a predicate holds)
|
|
4351
|
+
*
|
|
4230
4352
|
* ```ts
|
|
4231
4353
|
* import { Console, Effect, Stream } from "effect"
|
|
4232
4354
|
*
|
|
@@ -4242,8 +4364,8 @@ export const dropWhileFilter = /*#__PURE__*/dual(2, (self, filter) => transformP
|
|
|
4242
4364
|
* // Output: [ 3, 4, 5 ]
|
|
4243
4365
|
* ```
|
|
4244
4366
|
*
|
|
4367
|
+
* @category filtering
|
|
4245
4368
|
* @since 2.0.0
|
|
4246
|
-
* @category Filtering
|
|
4247
4369
|
*/
|
|
4248
4370
|
export const dropWhileEffect = /*#__PURE__*/dual(2, (self, predicate) => transformPull(self, (pull, _scope) => Effect.sync(() => {
|
|
4249
4371
|
let dropping = true;
|
|
@@ -4266,7 +4388,8 @@ export const dropWhileEffect = /*#__PURE__*/dual(2, (self, predicate) => transfo
|
|
|
4266
4388
|
*
|
|
4267
4389
|
* Keeps the last `n` elements in memory to drop them on completion.
|
|
4268
4390
|
*
|
|
4269
|
-
*
|
|
4391
|
+
* **Example** (Dropping values from the right)
|
|
4392
|
+
*
|
|
4270
4393
|
* ```ts
|
|
4271
4394
|
* import { Console, Effect, Stream } from "effect"
|
|
4272
4395
|
*
|
|
@@ -4282,8 +4405,8 @@ export const dropWhileEffect = /*#__PURE__*/dual(2, (self, predicate) => transfo
|
|
|
4282
4405
|
* // Output: [ 1, 2, 3 ]
|
|
4283
4406
|
* ```
|
|
4284
4407
|
*
|
|
4408
|
+
* @category filtering
|
|
4285
4409
|
* @since 2.0.0
|
|
4286
|
-
* @category Filtering
|
|
4287
4410
|
*/
|
|
4288
4411
|
export const dropRight = /*#__PURE__*/dual(2, (self, n) => {
|
|
4289
4412
|
if (n <= 0) return self;
|
|
@@ -4301,7 +4424,8 @@ export const dropRight = /*#__PURE__*/dual(2, (self, n) => {
|
|
|
4301
4424
|
/**
|
|
4302
4425
|
* Exposes the underlying chunks as a stream of non-empty arrays.
|
|
4303
4426
|
*
|
|
4304
|
-
*
|
|
4427
|
+
* **Example** (Exposing stream chunks)
|
|
4428
|
+
*
|
|
4305
4429
|
* ```ts
|
|
4306
4430
|
* import { Console, Effect, Stream } from "effect"
|
|
4307
4431
|
*
|
|
@@ -4318,8 +4442,8 @@ export const dropRight = /*#__PURE__*/dual(2, (self, n) => {
|
|
|
4318
4442
|
* // Output: [ [ 1, 2 ], [ 3, 4 ] ]
|
|
4319
4443
|
* ```
|
|
4320
4444
|
*
|
|
4321
|
-
* @since 2.0.0
|
|
4322
4445
|
* @category Grouping
|
|
4446
|
+
* @since 2.0.0
|
|
4323
4447
|
*/
|
|
4324
4448
|
export const chunks = self => self.channel.pipe(Channel.map(Arr.of), fromChannel);
|
|
4325
4449
|
/**
|
|
@@ -4327,7 +4451,8 @@ export const chunks = self => self.channel.pipe(Channel.map(Arr.of), fromChannel
|
|
|
4327
4451
|
*
|
|
4328
4452
|
* The size is clamped to at least 1.
|
|
4329
4453
|
*
|
|
4330
|
-
*
|
|
4454
|
+
* **Example** (Rechunking stream elements)
|
|
4455
|
+
*
|
|
4331
4456
|
* ```ts
|
|
4332
4457
|
* import { Console, Effect, Stream } from "effect"
|
|
4333
4458
|
*
|
|
@@ -4344,8 +4469,8 @@ export const chunks = self => self.channel.pipe(Channel.map(Arr.of), fromChannel
|
|
|
4344
4469
|
* // Output: [ [ 1, 2 ], [ 3, 4 ], [ 5 ] ]
|
|
4345
4470
|
* ```
|
|
4346
4471
|
*
|
|
4347
|
-
* @since 2.0.0
|
|
4348
4472
|
* @category Grouping
|
|
4473
|
+
* @since 2.0.0
|
|
4349
4474
|
*/
|
|
4350
4475
|
export const rechunk = /*#__PURE__*/dual(2, (self, target) => {
|
|
4351
4476
|
target = Math.max(1, target);
|
|
@@ -4390,9 +4515,10 @@ export const rechunk = /*#__PURE__*/dual(2, (self, target) => {
|
|
|
4390
4515
|
/**
|
|
4391
4516
|
* Emits a sliding window of `n` elements.
|
|
4392
4517
|
*
|
|
4393
|
-
*
|
|
4518
|
+
* **Example** (Emitting sliding windows)
|
|
4519
|
+
*
|
|
4394
4520
|
* ```ts
|
|
4395
|
-
* import { Console, Effect,
|
|
4521
|
+
* import { Console, Effect, pipe, Stream } from "effect"
|
|
4396
4522
|
*
|
|
4397
4523
|
* Effect.gen(function*() {
|
|
4398
4524
|
* const result = yield* pipe(
|
|
@@ -4405,13 +4531,15 @@ export const rechunk = /*#__PURE__*/dual(2, (self, target) => {
|
|
|
4405
4531
|
* // Output: [ [1, 2], [2, 3], [3, 4], [4, 5] ]
|
|
4406
4532
|
* ```
|
|
4407
4533
|
*
|
|
4408
|
-
* @since 2.0.0
|
|
4409
4534
|
* @category Grouping
|
|
4535
|
+
* @since 2.0.0
|
|
4410
4536
|
*/
|
|
4411
4537
|
export const sliding = /*#__PURE__*/dual(2, (self, chunkSize) => slidingSize(self, chunkSize, 1));
|
|
4412
4538
|
/**
|
|
4413
4539
|
* Emits sliding windows of `chunkSize` elements, advancing by `stepSize`.
|
|
4414
4540
|
*
|
|
4541
|
+
* **Example** (Emitting sliding windows with a step size)
|
|
4542
|
+
*
|
|
4415
4543
|
* ```ts
|
|
4416
4544
|
* import { Console, Effect, Stream } from "effect"
|
|
4417
4545
|
*
|
|
@@ -4427,8 +4555,8 @@ export const sliding = /*#__PURE__*/dual(2, (self, chunkSize) => slidingSize(sel
|
|
|
4427
4555
|
* // Output: [ [ 1, 2, 3 ], [ 3, 4, 5 ] ]
|
|
4428
4556
|
* ```
|
|
4429
4557
|
*
|
|
4430
|
-
* @since 2.0.0
|
|
4431
4558
|
* @category Grouping
|
|
4559
|
+
* @since 2.0.0
|
|
4432
4560
|
*/
|
|
4433
4561
|
export const slidingSize = /*#__PURE__*/dual(3, (self, chunkSize, stepSize) => transformPull(self, (upstream, _scope) => Effect.sync(() => {
|
|
4434
4562
|
let cause = null;
|
|
@@ -4468,7 +4596,8 @@ export const slidingSize = /*#__PURE__*/dual(3, (self, chunkSize, stepSize) => t
|
|
|
4468
4596
|
*
|
|
4469
4597
|
* Matching elements act as delimiters and are not included in the output.
|
|
4470
4598
|
*
|
|
4471
|
-
*
|
|
4599
|
+
* **Example** (Splitting on matching values)
|
|
4600
|
+
*
|
|
4472
4601
|
* ```ts
|
|
4473
4602
|
* import { Console, Effect, Stream } from "effect"
|
|
4474
4603
|
*
|
|
@@ -4484,8 +4613,8 @@ export const slidingSize = /*#__PURE__*/dual(3, (self, chunkSize, stepSize) => t
|
|
|
4484
4613
|
* // Output: [ [1, 2, 3], [5, 6, 7], [9] ]
|
|
4485
4614
|
* ```
|
|
4486
4615
|
*
|
|
4487
|
-
* @since 2.0.0
|
|
4488
4616
|
* @category Grouping
|
|
4617
|
+
* @since 2.0.0
|
|
4489
4618
|
*/
|
|
4490
4619
|
export const split = /*#__PURE__*/dual(2, (self, predicate) => mapAccumArray(self, Arr.empty, (acc, arr) => {
|
|
4491
4620
|
const out = Arr.empty();
|
|
@@ -4512,7 +4641,8 @@ export const split = /*#__PURE__*/dual(2, (self, predicate) => mapAccumArray(sel
|
|
|
4512
4641
|
* Where possible, prefer `Stream.combineArray` for a more efficient
|
|
4513
4642
|
* implementation.
|
|
4514
4643
|
*
|
|
4515
|
-
*
|
|
4644
|
+
* **Example** (Combining streams with state)
|
|
4645
|
+
*
|
|
4516
4646
|
* ```ts
|
|
4517
4647
|
* import { Console, Effect, Stream } from "effect"
|
|
4518
4648
|
*
|
|
@@ -4535,8 +4665,8 @@ export const split = /*#__PURE__*/dual(2, (self, predicate) => mapAccumArray(sel
|
|
|
4535
4665
|
* // Output: [ "L:A", "R:1", "L:B", "R:2", "L:C", "R:3" ]
|
|
4536
4666
|
* ```
|
|
4537
4667
|
*
|
|
4538
|
-
* @since 2.0.0
|
|
4539
4668
|
* @category Merging
|
|
4669
|
+
* @since 2.0.0
|
|
4540
4670
|
*/
|
|
4541
4671
|
export const combine = /*#__PURE__*/dual(4, (self, that, s, f) => Channel.combine(Channel.flattenArray(self.channel), Channel.flattenArray(that.channel), s, f).pipe(Channel.map(Arr.of), fromChannel));
|
|
4542
4672
|
/**
|
|
@@ -4546,13 +4676,8 @@ export const combine = /*#__PURE__*/dual(4, (self, that, s, f) => Channel.combin
|
|
|
4546
4676
|
* internal state to control the combining process, with the initial state
|
|
4547
4677
|
* being specified by `s`.
|
|
4548
4678
|
*
|
|
4549
|
-
* **
|
|
4550
|
-
*
|
|
4551
|
-
* This API replaces the following from Effect 3.x:
|
|
4679
|
+
* **Example** (Combining stream chunks with state)
|
|
4552
4680
|
*
|
|
4553
|
-
* - `Stream.combineChunks`
|
|
4554
|
-
*
|
|
4555
|
-
* @example
|
|
4556
4681
|
* ```ts
|
|
4557
4682
|
* import { Console, Effect, Stream } from "effect"
|
|
4558
4683
|
*
|
|
@@ -4577,14 +4702,15 @@ export const combine = /*#__PURE__*/dual(4, (self, that, s, f) => Channel.combin
|
|
|
4577
4702
|
* // Output: [ 1, 2, 10, 20 ]
|
|
4578
4703
|
* ```
|
|
4579
4704
|
*
|
|
4580
|
-
* @
|
|
4581
|
-
* @
|
|
4705
|
+
* @category sequencing
|
|
4706
|
+
* @since 4.0.0
|
|
4582
4707
|
*/
|
|
4583
4708
|
export const combineArray = /*#__PURE__*/dual(4, (self, that, s, f) => fromChannel(Channel.combine(self.channel, that.channel, s, f)));
|
|
4584
4709
|
/**
|
|
4585
4710
|
* Statefully maps elements, emitting zero or more outputs per input.
|
|
4586
4711
|
*
|
|
4587
|
-
*
|
|
4712
|
+
* **Example** (Statefully mapping stream values)
|
|
4713
|
+
*
|
|
4588
4714
|
* ```ts
|
|
4589
4715
|
* import { Console, Effect, Stream } from "effect"
|
|
4590
4716
|
*
|
|
@@ -4604,8 +4730,8 @@ export const combineArray = /*#__PURE__*/dual(4, (self, that, s, f) => fromChann
|
|
|
4604
4730
|
* // Output: [ 0, 1, 3, 6, 10, 15, 21 ]
|
|
4605
4731
|
* ```
|
|
4606
4732
|
*
|
|
4733
|
+
* @category mapping
|
|
4607
4734
|
* @since 2.0.0
|
|
4608
|
-
* @category Mapping
|
|
4609
4735
|
*/
|
|
4610
4736
|
export const mapAccum = /*#__PURE__*/dual(args => isStream(args[0]), (self, initial, f, options) => fromChannel(Channel.mapAccum(self.channel, initial, (state, arr) => {
|
|
4611
4737
|
const acc = Arr.empty();
|
|
@@ -4626,7 +4752,8 @@ export const mapAccum = /*#__PURE__*/dual(args => isStream(args[0]), (self, init
|
|
|
4626
4752
|
*
|
|
4627
4753
|
* The mapping function runs once per chunk and the state is threaded across chunks.
|
|
4628
4754
|
*
|
|
4629
|
-
*
|
|
4755
|
+
* **Example** (Statefully mapping stream chunks)
|
|
4756
|
+
*
|
|
4630
4757
|
* ```ts
|
|
4631
4758
|
* import { Console, Effect, Stream } from "effect"
|
|
4632
4759
|
*
|
|
@@ -4646,8 +4773,8 @@ export const mapAccum = /*#__PURE__*/dual(args => isStream(args[0]), (self, init
|
|
|
4646
4773
|
* // Output: [ 3, 10, 21 ]
|
|
4647
4774
|
* ```
|
|
4648
4775
|
*
|
|
4649
|
-
* @
|
|
4650
|
-
* @
|
|
4776
|
+
* @category mapping
|
|
4777
|
+
* @since 4.0.0
|
|
4651
4778
|
*/
|
|
4652
4779
|
export const mapAccumArray = /*#__PURE__*/dual(args => isStream(args[0]), (self, initial, f, options) => fromChannel(Channel.mapAccum(self.channel, initial, (state, arr) => {
|
|
4653
4780
|
const [newState, values] = f(state, arr);
|
|
@@ -4661,9 +4788,15 @@ export const mapAccumArray = /*#__PURE__*/dual(args => isStream(args[0]), (self,
|
|
|
4661
4788
|
} : undefined)));
|
|
4662
4789
|
const emptyArr = /*#__PURE__*/Arr.empty();
|
|
4663
4790
|
/**
|
|
4664
|
-
* Statefully and effectfully maps
|
|
4791
|
+
* Statefully and effectfully maps each element, emitting zero or more output
|
|
4792
|
+
* values per input.
|
|
4793
|
+
*
|
|
4794
|
+
* The mapping effect receives the current state and element, then returns the
|
|
4795
|
+
* next state plus the values to emit. The state is threaded through the
|
|
4796
|
+
* stream.
|
|
4797
|
+
*
|
|
4798
|
+
* **Example** (Effectfully mapping stream values with state)
|
|
4665
4799
|
*
|
|
4666
|
-
* @example
|
|
4667
4800
|
* ```ts
|
|
4668
4801
|
* import { Console, Effect, Stream } from "effect"
|
|
4669
4802
|
*
|
|
@@ -4682,8 +4815,8 @@ const emptyArr = /*#__PURE__*/Arr.empty();
|
|
|
4682
4815
|
* // Output: [ 1, 2, 3 ]
|
|
4683
4816
|
* ```
|
|
4684
4817
|
*
|
|
4818
|
+
* @category mapping
|
|
4685
4819
|
* @since 2.0.0
|
|
4686
|
-
* @category Mapping
|
|
4687
4820
|
*/
|
|
4688
4821
|
export const mapAccumEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self, initial, f, options) => self.channel.pipe(Channel.flattenArray, Channel.mapAccum(initial, (state, a) => Effect.map(f(state, a), ([state, values]) => [state, Arr.isReadonlyArrayNonEmpty(values) ? Arr.of(values) : Arr.empty()]), options?.onHalt ? {
|
|
4689
4822
|
onHalt(state) {
|
|
@@ -4692,9 +4825,14 @@ export const mapAccumEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self
|
|
|
4692
4825
|
}
|
|
4693
4826
|
} : undefined), fromChannel));
|
|
4694
4827
|
/**
|
|
4695
|
-
* Statefully and effectfully maps
|
|
4828
|
+
* Statefully and effectfully maps each non-empty input chunk, emitting zero or
|
|
4829
|
+
* more output values per chunk.
|
|
4830
|
+
*
|
|
4831
|
+
* The mapping effect receives the current state and chunk, then returns the
|
|
4832
|
+
* next state plus the values to emit. The state is threaded across chunks.
|
|
4833
|
+
*
|
|
4834
|
+
* **Example** (Effectfully mapping stream chunks with state)
|
|
4696
4835
|
*
|
|
4697
|
-
* @example
|
|
4698
4836
|
* ```ts
|
|
4699
4837
|
* import { Console, Effect, Stream } from "effect"
|
|
4700
4838
|
*
|
|
@@ -4716,8 +4854,8 @@ export const mapAccumEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self
|
|
|
4716
4854
|
* // Output: [ 3, 10 ]
|
|
4717
4855
|
* ```
|
|
4718
4856
|
*
|
|
4719
|
-
* @
|
|
4720
|
-
* @
|
|
4857
|
+
* @category mapping
|
|
4858
|
+
* @since 4.0.0
|
|
4721
4859
|
*/
|
|
4722
4860
|
export const mapAccumArrayEffect = /*#__PURE__*/dual(args => isStream(args), (self, initial, f, options) => self.channel.pipe(Channel.mapAccum(initial, (state, a) => Effect.map(f(state, a), ([state, values]) => [state, Arr.isReadonlyArrayNonEmpty(values) ? Arr.of(values) : emptyArr]), options?.onHalt ? {
|
|
4723
4861
|
onHalt(state) {
|
|
@@ -4728,7 +4866,8 @@ export const mapAccumArrayEffect = /*#__PURE__*/dual(args => isStream(args), (se
|
|
|
4728
4866
|
/**
|
|
4729
4867
|
* Accumulates state across the stream, emitting the initial state and each updated state.
|
|
4730
4868
|
*
|
|
4731
|
-
*
|
|
4869
|
+
* **Example** (Scanning stream state)
|
|
4870
|
+
*
|
|
4732
4871
|
* ```ts
|
|
4733
4872
|
* import { Console, Effect, Stream } from "effect"
|
|
4734
4873
|
*
|
|
@@ -4744,8 +4883,8 @@ export const mapAccumArrayEffect = /*#__PURE__*/dual(args => isStream(args), (se
|
|
|
4744
4883
|
* // Output: [ 0, 1, 3, 6 ]
|
|
4745
4884
|
* ```
|
|
4746
4885
|
*
|
|
4747
|
-
* @since 2.0.0
|
|
4748
4886
|
* @category Accumulation
|
|
4887
|
+
* @since 2.0.0
|
|
4749
4888
|
*/
|
|
4750
4889
|
export const scan = /*#__PURE__*/dual(3, (self, initial, f) => suspend(() => {
|
|
4751
4890
|
let isFirst = true;
|
|
@@ -4765,7 +4904,8 @@ export const scan = /*#__PURE__*/dual(3, (self, initial, f) => suspend(() => {
|
|
|
4765
4904
|
/**
|
|
4766
4905
|
* Effectfully accumulates state and emits the initial state plus each accumulated state.
|
|
4767
4906
|
*
|
|
4768
|
-
*
|
|
4907
|
+
* **Example** (Effectfully scanning stream state)
|
|
4908
|
+
*
|
|
4769
4909
|
* ```ts
|
|
4770
4910
|
* import { Console, Effect, Stream } from "effect"
|
|
4771
4911
|
*
|
|
@@ -4779,14 +4919,15 @@ export const scan = /*#__PURE__*/dual(3, (self, initial, f) => suspend(() => {
|
|
|
4779
4919
|
* })
|
|
4780
4920
|
* ```
|
|
4781
4921
|
*
|
|
4782
|
-
* @since 2.0.0
|
|
4783
4922
|
* @category Accumulation
|
|
4923
|
+
* @since 2.0.0
|
|
4784
4924
|
*/
|
|
4785
4925
|
export const scanEffect = /*#__PURE__*/dual(3, (self, initial, f) => self.channel.pipe(Channel.flattenArray, Channel.scanEffect(initial, f), Channel.map(Arr.of), fromChannel));
|
|
4786
4926
|
/**
|
|
4787
4927
|
* Drops earlier elements within the debounce window and emits only the latest element after the pause.
|
|
4788
4928
|
*
|
|
4789
|
-
*
|
|
4929
|
+
* **Example** (Debouncing stream elements)
|
|
4930
|
+
*
|
|
4790
4931
|
* ```ts
|
|
4791
4932
|
* import { Console, Duration, Effect, Stream } from "effect"
|
|
4792
4933
|
*
|
|
@@ -4803,8 +4944,8 @@ export const scanEffect = /*#__PURE__*/dual(3, (self, initial, f) => self.channe
|
|
|
4803
4944
|
* })
|
|
4804
4945
|
* ```
|
|
4805
4946
|
*
|
|
4806
|
-
* @since 2.0.0
|
|
4807
4947
|
* @category Rate Limiting
|
|
4948
|
+
* @since 2.0.0
|
|
4808
4949
|
*/
|
|
4809
4950
|
export const debounce = /*#__PURE__*/dual(2, (self, duration) => transformPull(self, Effect.fnUntraced(function* (pull, scope) {
|
|
4810
4951
|
const clock = yield* Clock;
|
|
@@ -4873,7 +5014,8 @@ export const debounce = /*#__PURE__*/dual(2, (self, duration) => transformPull(s
|
|
|
4873
5014
|
*
|
|
4874
5015
|
* Defaults to the "shape" strategy.
|
|
4875
5016
|
*
|
|
4876
|
-
*
|
|
5017
|
+
* **Example** (Throttling stream chunks effectfully)
|
|
5018
|
+
*
|
|
4877
5019
|
* ```ts
|
|
4878
5020
|
* import { Console, Effect, Schedule, Stream } from "effect"
|
|
4879
5021
|
*
|
|
@@ -4894,8 +5036,8 @@ export const debounce = /*#__PURE__*/dual(2, (self, duration) => transformPull(s
|
|
|
4894
5036
|
* // Output: [0, 1, 2, 3, 4, 5]
|
|
4895
5037
|
* ```
|
|
4896
5038
|
*
|
|
4897
|
-
* @since 2.0.0
|
|
4898
5039
|
* @category Rate Limiting
|
|
5040
|
+
* @since 2.0.0
|
|
4899
5041
|
*/
|
|
4900
5042
|
export const throttleEffect = /*#__PURE__*/dual(2, (self, options) => {
|
|
4901
5043
|
const burst = options.burst ?? 0;
|
|
@@ -4969,7 +5111,8 @@ const throttleShapeEffect = (self, cost, units, duration, burst) => transformPul
|
|
|
4969
5111
|
*
|
|
4970
5112
|
* Defaults to the "shape" strategy.
|
|
4971
5113
|
*
|
|
4972
|
-
*
|
|
5114
|
+
* **Example** (Throttling stream chunks)
|
|
5115
|
+
*
|
|
4973
5116
|
* ```ts
|
|
4974
5117
|
* import { Console, Effect, Schedule, Stream } from "effect"
|
|
4975
5118
|
*
|
|
@@ -4990,8 +5133,8 @@ const throttleShapeEffect = (self, cost, units, duration, burst) => transformPul
|
|
|
4990
5133
|
* })
|
|
4991
5134
|
* ```
|
|
4992
5135
|
*
|
|
4993
|
-
* @since 2.0.0
|
|
4994
5136
|
* @category Rate Limiting
|
|
5137
|
+
* @since 2.0.0
|
|
4995
5138
|
*/
|
|
4996
5139
|
export const throttle = /*#__PURE__*/dual(2, (self, options) => throttleEffect(self, {
|
|
4997
5140
|
...options,
|
|
@@ -5002,7 +5145,8 @@ export const throttle = /*#__PURE__*/dual(2, (self, options) => throttleEffect(s
|
|
|
5002
5145
|
*
|
|
5003
5146
|
* The final array may be smaller if there are not enough elements to fill it.
|
|
5004
5147
|
*
|
|
5005
|
-
*
|
|
5148
|
+
* **Example** (Grouping elements by size)
|
|
5149
|
+
*
|
|
5006
5150
|
* ```ts
|
|
5007
5151
|
* import { Console, Effect, Stream } from "effect"
|
|
5008
5152
|
*
|
|
@@ -5018,15 +5162,16 @@ export const throttle = /*#__PURE__*/dual(2, (self, options) => throttleEffect(s
|
|
|
5018
5162
|
* // Output: [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8 ] ]
|
|
5019
5163
|
* ```
|
|
5020
5164
|
*
|
|
5021
|
-
* @since 2.0.0
|
|
5022
5165
|
* @category Grouping
|
|
5166
|
+
* @since 2.0.0
|
|
5023
5167
|
*/
|
|
5024
5168
|
export const grouped = /*#__PURE__*/dual(2, (self, n) => chunks(rechunk(self, n)));
|
|
5025
5169
|
/**
|
|
5026
5170
|
* Partitions the stream into arrays, emitting when the chunk size is reached
|
|
5027
5171
|
* or the duration passes.
|
|
5028
5172
|
*
|
|
5029
|
-
*
|
|
5173
|
+
* **Example** (Grouping elements by size or time)
|
|
5174
|
+
*
|
|
5030
5175
|
* ```ts
|
|
5031
5176
|
* import { Console, Effect, Stream } from "effect"
|
|
5032
5177
|
*
|
|
@@ -5042,14 +5187,15 @@ export const grouped = /*#__PURE__*/dual(2, (self, n) => chunks(rechunk(self, n)
|
|
|
5042
5187
|
* // Output: [ [ 1, 2 ], [ 3 ] ]
|
|
5043
5188
|
* ```
|
|
5044
5189
|
*
|
|
5045
|
-
* @since 2.0.0
|
|
5046
5190
|
* @category Grouping
|
|
5191
|
+
* @since 2.0.0
|
|
5047
5192
|
*/
|
|
5048
5193
|
export const groupedWithin = /*#__PURE__*/dual(3, (self, chunkSize, duration) => aggregateWithin(self, Sink.take(chunkSize), Schedule.spaced(duration)));
|
|
5049
5194
|
/**
|
|
5050
5195
|
* Groups elements into keyed substreams using an effectful classifier.
|
|
5051
5196
|
*
|
|
5052
|
-
*
|
|
5197
|
+
* **Example** (Grouping elements into keyed substreams using an effectful classifier)
|
|
5198
|
+
*
|
|
5053
5199
|
* ```ts
|
|
5054
5200
|
* import { Console, Effect, Stream } from "effect"
|
|
5055
5201
|
*
|
|
@@ -5074,8 +5220,8 @@ export const groupedWithin = /*#__PURE__*/dual(3, (self, chunkSize, duration) =>
|
|
|
5074
5220
|
* // Output: [ [ "odd", [ 1, 3, 5 ] ], [ "even", [ 2, 4 ] ] ]
|
|
5075
5221
|
* ```
|
|
5076
5222
|
*
|
|
5077
|
-
* @since 2.0.0
|
|
5078
5223
|
* @category Grouping
|
|
5224
|
+
* @since 2.0.0
|
|
5079
5225
|
*/
|
|
5080
5226
|
export const groupBy = /*#__PURE__*/dual(args => isStream(args[0]), (self, f, options) => groupByImpl(self, Effect.fnUntraced(function* (arr, queues, queueMap) {
|
|
5081
5227
|
for (let i = 0; i < arr.length; i++) {
|
|
@@ -5089,7 +5235,8 @@ export const groupBy = /*#__PURE__*/dual(args => isStream(args[0]), (self, f, op
|
|
|
5089
5235
|
/**
|
|
5090
5236
|
* Groups elements by a key and emits a stream per key.
|
|
5091
5237
|
*
|
|
5092
|
-
*
|
|
5238
|
+
* **Example** (Grouping elements by key)
|
|
5239
|
+
*
|
|
5093
5240
|
* ```ts
|
|
5094
5241
|
* import { Console, Effect, Stream } from "effect"
|
|
5095
5242
|
*
|
|
@@ -5112,8 +5259,8 @@ export const groupBy = /*#__PURE__*/dual(args => isStream(args[0]), (self, f, op
|
|
|
5112
5259
|
* // Output: [ [ "odd", [ 1, 3, 5 ] ], [ "even", [ 2, 4 ] ] ]
|
|
5113
5260
|
* ```
|
|
5114
5261
|
*
|
|
5115
|
-
* @since 2.0.0
|
|
5116
5262
|
* @category Grouping
|
|
5263
|
+
* @since 2.0.0
|
|
5117
5264
|
*/
|
|
5118
5265
|
export const groupByKey = /*#__PURE__*/dual(args => isStream(args[0]), (self, f, options) => suspend(() => {
|
|
5119
5266
|
const batch = MutableHashMap.empty();
|
|
@@ -5160,8 +5307,14 @@ const groupByImpl = (self, f, options) => transformPullBracket(self, Effect.fnUn
|
|
|
5160
5307
|
return Queue.takeAll(out);
|
|
5161
5308
|
}));
|
|
5162
5309
|
/**
|
|
5163
|
-
*
|
|
5310
|
+
* Groups consecutive elements that have equal keys into non-empty arrays.
|
|
5311
|
+
*
|
|
5312
|
+
* The key is computed with `f`; adjacent elements whose keys are equal by
|
|
5313
|
+
* `Equal.equals` are emitted as one `[key, group]`. Later non-adjacent runs
|
|
5314
|
+
* with the same key are emitted separately.
|
|
5315
|
+
*
|
|
5164
5316
|
* @category Grouping
|
|
5317
|
+
* @since 2.0.0
|
|
5165
5318
|
*/
|
|
5166
5319
|
export const groupAdjacentBy = /*#__PURE__*/dual(2, (self, f) => transformPull(self, (pull, _scope) => Effect.sync(() => {
|
|
5167
5320
|
let currentKey = undefined;
|
|
@@ -5201,7 +5354,8 @@ export const groupAdjacentBy = /*#__PURE__*/dual(2, (self, f) => transformPull(s
|
|
|
5201
5354
|
/**
|
|
5202
5355
|
* Applies a sink transducer to the stream and emits each sink result.
|
|
5203
5356
|
*
|
|
5204
|
-
*
|
|
5357
|
+
* **Example** (Transducing with a sink)
|
|
5358
|
+
*
|
|
5205
5359
|
* ```ts
|
|
5206
5360
|
* import { Console, Effect, Sink, Stream } from "effect"
|
|
5207
5361
|
*
|
|
@@ -5216,8 +5370,8 @@ export const groupAdjacentBy = /*#__PURE__*/dual(2, (self, f) => transformPull(s
|
|
|
5216
5370
|
* })
|
|
5217
5371
|
* ```
|
|
5218
5372
|
*
|
|
5219
|
-
* @since 2.0.0
|
|
5220
5373
|
* @category Aggregation
|
|
5374
|
+
* @since 2.0.0
|
|
5221
5375
|
*/
|
|
5222
5376
|
export const transduce = /*#__PURE__*/dual(2, (self, sink) => transformPull(self, (upstream, scope) => Effect.sync(() => {
|
|
5223
5377
|
let done;
|
|
@@ -5245,7 +5399,8 @@ export const transduce = /*#__PURE__*/dual(2, (self, sink) => transformPull(self
|
|
|
5245
5399
|
* The stream runs the upstream and downstream in separate fibers, so the sink can keep
|
|
5246
5400
|
* consuming input while downstream is busy processing the previous output.
|
|
5247
5401
|
*
|
|
5248
|
-
*
|
|
5402
|
+
* **Example** (Aggregating with a sink)
|
|
5403
|
+
*
|
|
5249
5404
|
* ```ts
|
|
5250
5405
|
* import { Console, Effect, Sink, Stream } from "effect"
|
|
5251
5406
|
*
|
|
@@ -5262,8 +5417,8 @@ export const transduce = /*#__PURE__*/dual(2, (self, sink) => transformPull(self
|
|
|
5262
5417
|
* // [ 6, 15 ]
|
|
5263
5418
|
* ```
|
|
5264
5419
|
*
|
|
5265
|
-
* @since 2.0.0
|
|
5266
5420
|
* @category Aggregation
|
|
5421
|
+
* @since 2.0.0
|
|
5267
5422
|
*/
|
|
5268
5423
|
export const aggregate = /*#__PURE__*/dual(2, (self, sink) => aggregateWithin(self, sink, Schedule.forever));
|
|
5269
5424
|
/**
|
|
@@ -5271,7 +5426,8 @@ export const aggregate = /*#__PURE__*/dual(2, (self, sink) => aggregateWithin(se
|
|
|
5271
5426
|
*
|
|
5272
5427
|
* The schedule can flush the current aggregation even if the sink has not finished.
|
|
5273
5428
|
*
|
|
5274
|
-
*
|
|
5429
|
+
* **Example** (Aggregating with a sink and schedule)
|
|
5430
|
+
*
|
|
5275
5431
|
* ```ts
|
|
5276
5432
|
* import { Console, Effect, Schedule, Sink, Stream } from "effect"
|
|
5277
5433
|
*
|
|
@@ -5289,8 +5445,8 @@ export const aggregate = /*#__PURE__*/dual(2, (self, sink) => aggregateWithin(se
|
|
|
5289
5445
|
* // Output: [ 6, 15 ]
|
|
5290
5446
|
* ```
|
|
5291
5447
|
*
|
|
5292
|
-
* @since 2.0.0
|
|
5293
5448
|
* @category Aggregation
|
|
5449
|
+
* @since 2.0.0
|
|
5294
5450
|
*/
|
|
5295
5451
|
export const aggregateWithin = /*#__PURE__*/dual(3, (self, sink, schedule) => fromChannel(Channel.fromTransformBracket(Effect.fnUntraced(function* (_upstream, _, scope) {
|
|
5296
5452
|
const pull = yield* Channel.toPullScoped(self.channel, _);
|
|
@@ -5348,12 +5504,63 @@ export const aggregateWithin = /*#__PURE__*/dual(3, (self, sink, schedule) => fr
|
|
|
5348
5504
|
return Effect.succeed(Effect.suspend(() => sink.transform(sinkUpstream, scope)));
|
|
5349
5505
|
}).pipe(Effect.flatMap(pull => Effect.raceFirst(catchSinkHalt(pull), stepToBuffer)));
|
|
5350
5506
|
}))));
|
|
5507
|
+
/**
|
|
5508
|
+
* Fan out the stream, producing a fixed-size tuple of streams that each emit
|
|
5509
|
+
* the same elements as the source stream.
|
|
5510
|
+
*
|
|
5511
|
+
* The source stream starts after all downstream streams have been subscribed.
|
|
5512
|
+
* With the default suspend strategy, the source can only advance `capacity`
|
|
5513
|
+
* chunks ahead of the slowest downstream stream. If a downstream stream is
|
|
5514
|
+
* interrupted, it unsubscribes from the broadcast so it no longer contributes
|
|
5515
|
+
* backpressure.
|
|
5516
|
+
*
|
|
5517
|
+
* **Example** (Broadcasting to two consumers)
|
|
5518
|
+
*
|
|
5519
|
+
* ```ts
|
|
5520
|
+
* import { Console, Effect, Stream } from "effect"
|
|
5521
|
+
*
|
|
5522
|
+
* const program = Effect.scoped(
|
|
5523
|
+
* Effect.gen(function*() {
|
|
5524
|
+
* const [left, right] = yield* Stream.make(1, 2, 3).pipe(
|
|
5525
|
+
* Stream.broadcastN({ n: 2, capacity: 8 })
|
|
5526
|
+
* )
|
|
5527
|
+
*
|
|
5528
|
+
* const values = yield* Effect.all([
|
|
5529
|
+
* Stream.runCollect(left),
|
|
5530
|
+
* Stream.runCollect(right)
|
|
5531
|
+
* ], { concurrency: "unbounded" })
|
|
5532
|
+
*
|
|
5533
|
+
* yield* Console.log(values)
|
|
5534
|
+
* })
|
|
5535
|
+
* )
|
|
5536
|
+
*
|
|
5537
|
+
* Effect.runPromise(program)
|
|
5538
|
+
* // Output: [[1, 2, 3], [1, 2, 3]]
|
|
5539
|
+
* ```
|
|
5540
|
+
*
|
|
5541
|
+
* @category Broadcast
|
|
5542
|
+
* @since 4.0.0
|
|
5543
|
+
*/
|
|
5544
|
+
export const broadcastN = /*#__PURE__*/dual(2, /*#__PURE__*/Effect.fnUntraced(function* (self, options) {
|
|
5545
|
+
const pubsub = yield* makePubSub(options);
|
|
5546
|
+
const streams = new Array(options.n);
|
|
5547
|
+
const parentScope = yield* Scope.Scope;
|
|
5548
|
+
for (let i = 0; i < options.n; i++) {
|
|
5549
|
+
const scope = Scope.forkUnsafe(parentScope);
|
|
5550
|
+
const subscription = yield* PubSub.subscribe(pubsub).pipe(Effect.provideService(Scope.Scope, scope));
|
|
5551
|
+
streams[i] = Channel.fromEffectTake(PubSub.take(subscription)).pipe(Channel.onExit(exit => Scope.close(scope, exit)), fromChannel);
|
|
5552
|
+
}
|
|
5553
|
+
yield* Channel.runForEach(self.channel, value => PubSub.publish(pubsub, value)).pipe(Effect.onExit(exit => PubSub.publish(pubsub, exit)), Effect.forkScoped);
|
|
5554
|
+
return streams;
|
|
5555
|
+
}));
|
|
5556
|
+
const makePubSub = options => Effect.acquireRelease(options.capacity === "unbounded" ? PubSub.unbounded(options) : options.strategy === "dropping" ? PubSub.dropping(options) : options.strategy === "sliding" ? PubSub.sliding(options) : PubSub.bounded(options), PubSub.shutdown);
|
|
5351
5557
|
/**
|
|
5352
5558
|
* Creates a PubSub-backed stream that multicasts the source to all subscribers.
|
|
5353
5559
|
*
|
|
5354
5560
|
* The returned stream is scoped and uses the provided PubSub capacity and replay settings.
|
|
5355
5561
|
*
|
|
5356
|
-
*
|
|
5562
|
+
* **Example** (Broadcasting a stream)
|
|
5563
|
+
*
|
|
5357
5564
|
* ```ts
|
|
5358
5565
|
* import { Console, Effect, Stream } from "effect"
|
|
5359
5566
|
*
|
|
@@ -5377,8 +5584,8 @@ export const aggregateWithin = /*#__PURE__*/dual(3, (self, sink, schedule) => fr
|
|
|
5377
5584
|
* // Output: [[1, 2, 3], [1, 2, 3]]
|
|
5378
5585
|
* ```
|
|
5379
5586
|
*
|
|
5380
|
-
* @since 2.0.0
|
|
5381
5587
|
* @category Broadcast
|
|
5588
|
+
* @since 2.0.0
|
|
5382
5589
|
*/
|
|
5383
5590
|
export const broadcast = /*#__PURE__*/dual(2, (self, options) => Effect.map(toPubSubTake(self, options), fromPubSubTake));
|
|
5384
5591
|
/**
|
|
@@ -5388,7 +5595,8 @@ export const broadcast = /*#__PURE__*/dual(2, (self, options) => Effect.map(toPu
|
|
|
5388
5595
|
* If `idleTimeToLive` is set, the upstream is kept alive for that duration so a later subscriber can continue from
|
|
5389
5596
|
* the next element instead of restarting.
|
|
5390
5597
|
*
|
|
5391
|
-
*
|
|
5598
|
+
* **Example** (Sharing a stream)
|
|
5599
|
+
*
|
|
5392
5600
|
* ```ts
|
|
5393
5601
|
* import { Console, Effect, Stream } from "effect"
|
|
5394
5602
|
*
|
|
@@ -5409,8 +5617,8 @@ export const broadcast = /*#__PURE__*/dual(2, (self, options) => Effect.map(toPu
|
|
|
5409
5617
|
* // output: [[1], [1]]
|
|
5410
5618
|
* ```
|
|
5411
5619
|
*
|
|
5412
|
-
* @since 2.0.0
|
|
5413
5620
|
* @category Broadcast
|
|
5621
|
+
* @since 3.8.0
|
|
5414
5622
|
*/
|
|
5415
5623
|
export const share = /*#__PURE__*/dual(2, (self, options) => Effect.map(RcRef.make({
|
|
5416
5624
|
acquire: broadcast(self, options),
|
|
@@ -5422,7 +5630,8 @@ export const share = /*#__PURE__*/dual(2, (self, options) => Effect.map(RcRef.ma
|
|
|
5422
5630
|
* The channel receives `NonEmptyReadonlyArray` chunks and can transform both the
|
|
5423
5631
|
* output elements and error type.
|
|
5424
5632
|
*
|
|
5425
|
-
*
|
|
5633
|
+
* **Example** (Piping through a channel)
|
|
5634
|
+
*
|
|
5426
5635
|
* ```ts
|
|
5427
5636
|
* import { Array, Channel, Console, Effect, Stream } from "effect"
|
|
5428
5637
|
*
|
|
@@ -5445,8 +5654,8 @@ export const share = /*#__PURE__*/dual(2, (self, options) => Effect.map(RcRef.ma
|
|
|
5445
5654
|
* // => [2, 4, 6]
|
|
5446
5655
|
* ```
|
|
5447
5656
|
*
|
|
5448
|
-
* @since 2.0.0
|
|
5449
5657
|
* @category Pipe
|
|
5658
|
+
* @since 2.0.0
|
|
5450
5659
|
*/
|
|
5451
5660
|
export const pipeThroughChannel = /*#__PURE__*/dual(2, (self, channel) => fromChannel(Channel.pipeTo(self.channel, channel)));
|
|
5452
5661
|
/**
|
|
@@ -5456,35 +5665,31 @@ export const pipeThroughChannel = /*#__PURE__*/dual(2, (self, channel) => fromCh
|
|
|
5456
5665
|
* Upstream failures are not passed to the channel, so the resulting stream can
|
|
5457
5666
|
* fail with either the original stream error or the channel error.
|
|
5458
5667
|
*
|
|
5459
|
-
*
|
|
5668
|
+
* **Example** (Piping through a channel with failures)
|
|
5669
|
+
*
|
|
5460
5670
|
* ```ts
|
|
5461
|
-
* import
|
|
5462
|
-
* import { Console, Effect, Stream } from "effect"
|
|
5671
|
+
* import { Array, Channel, Effect, Stream } from "effect"
|
|
5463
5672
|
*
|
|
5464
|
-
*
|
|
5465
|
-
*
|
|
5466
|
-
*
|
|
5467
|
-
*
|
|
5468
|
-
*
|
|
5469
|
-
* "StreamError",
|
|
5470
|
-
* unknown,
|
|
5471
|
-
* never
|
|
5472
|
-
* >
|
|
5673
|
+
* type NumberChunk = readonly [number, ...Array<number>]
|
|
5674
|
+
*
|
|
5675
|
+
* const stringifyChunks = Channel.identity<NumberChunk, "StreamError", unknown>().pipe(
|
|
5676
|
+
* Channel.map((chunk) => Array.map(chunk, String))
|
|
5677
|
+
* )
|
|
5473
5678
|
*
|
|
5474
5679
|
* Effect.runPromise(Effect.gen(function*() {
|
|
5475
5680
|
* const result = yield* Stream.make(1, 2, 3).pipe(
|
|
5476
|
-
* Stream.
|
|
5681
|
+
* Stream.rechunk(2),
|
|
5682
|
+
* Stream.pipeThroughChannelOrFail(stringifyChunks),
|
|
5477
5683
|
* Stream.runCollect
|
|
5478
5684
|
* )
|
|
5479
5685
|
*
|
|
5480
|
-
* yield*
|
|
5686
|
+
* yield* Effect.sync(() => console.log(result))
|
|
5481
5687
|
* }))
|
|
5482
|
-
* //
|
|
5483
|
-
* // ["1", "2", "3"]
|
|
5688
|
+
* // [ "1", "2", "3" ]
|
|
5484
5689
|
* ```
|
|
5485
5690
|
*
|
|
5486
|
-
* @since 2.0.0
|
|
5487
5691
|
* @category Pipe
|
|
5692
|
+
* @since 2.0.0
|
|
5488
5693
|
*/
|
|
5489
5694
|
export const pipeThroughChannelOrFail = /*#__PURE__*/dual(2, (self, channel) => fromChannel(Channel.pipeToOrFail(self.channel, channel)));
|
|
5490
5695
|
/**
|
|
@@ -5492,7 +5697,8 @@ export const pipeThroughChannelOrFail = /*#__PURE__*/dual(2, (self, channel) =>
|
|
|
5492
5697
|
*
|
|
5493
5698
|
* If the sink completes mid-chunk, the remaining elements become the output stream.
|
|
5494
5699
|
*
|
|
5495
|
-
*
|
|
5700
|
+
* **Example** (Piping through a sink)
|
|
5701
|
+
*
|
|
5496
5702
|
* ```ts
|
|
5497
5703
|
* import { Console, Effect, Sink, Stream } from "effect"
|
|
5498
5704
|
*
|
|
@@ -5509,14 +5715,15 @@ export const pipeThroughChannelOrFail = /*#__PURE__*/dual(2, (self, channel) =>
|
|
|
5509
5715
|
* //=> [ 3, 4 ]
|
|
5510
5716
|
* ```
|
|
5511
5717
|
*
|
|
5512
|
-
* @since 2.0.0
|
|
5513
5718
|
* @category Pipe
|
|
5719
|
+
* @since 2.0.0
|
|
5514
5720
|
*/
|
|
5515
5721
|
export const pipeThrough = /*#__PURE__*/dual(2, (self, sink) => self.channel.pipe(Channel.pipeToOrFail(Sink.toChannel(sink)), Channel.concatWith(([_, leftover]) => leftover ? Channel.succeed(leftover) : Channel.empty), fromChannel));
|
|
5516
5722
|
/**
|
|
5517
5723
|
* Collects all elements into an array and emits it as a single element.
|
|
5518
5724
|
*
|
|
5519
|
-
*
|
|
5725
|
+
* **Example** (Collecting values into a stream element)
|
|
5726
|
+
*
|
|
5520
5727
|
* ```ts
|
|
5521
5728
|
* import { Console, Effect, Stream } from "effect"
|
|
5522
5729
|
*
|
|
@@ -5531,14 +5738,15 @@ export const pipeThrough = /*#__PURE__*/dual(2, (self, sink) => self.channel.pip
|
|
|
5531
5738
|
* // [1, 2, 3]
|
|
5532
5739
|
* ```
|
|
5533
5740
|
*
|
|
5534
|
-
* @since 2.0.0
|
|
5535
5741
|
* @category Accumulation
|
|
5742
|
+
* @since 4.0.0
|
|
5536
5743
|
*/
|
|
5537
5744
|
export const collect = self => fromEffect(runCollect(self));
|
|
5538
5745
|
/**
|
|
5539
5746
|
* Accumulates elements into a growing array, emitting the cumulative array for each input chunk.
|
|
5540
5747
|
*
|
|
5541
|
-
*
|
|
5748
|
+
* **Example** (Accumulating stream elements)
|
|
5749
|
+
*
|
|
5542
5750
|
* ```ts
|
|
5543
5751
|
* import { Console, Effect, Stream } from "effect"
|
|
5544
5752
|
*
|
|
@@ -5556,8 +5764,8 @@ export const collect = self => fromEffect(runCollect(self));
|
|
|
5556
5764
|
* //=> { _id: 'Chunk', values: [ [ 1 ], [ 1, 2 ], [ 1, 2, 3 ] ] }
|
|
5557
5765
|
* ```
|
|
5558
5766
|
*
|
|
5559
|
-
* @since 2.0.0
|
|
5560
5767
|
* @category Accumulation
|
|
5768
|
+
* @since 2.0.0
|
|
5561
5769
|
*/
|
|
5562
5770
|
export const accumulate = self => mapAccumArray(self, Arr.empty, (acc, as) => {
|
|
5563
5771
|
const combined = Arr.appendAll(acc, as);
|
|
@@ -5566,7 +5774,8 @@ export const accumulate = self => mapAccumArray(self, Arr.empty, (acc, as) => {
|
|
|
5566
5774
|
/**
|
|
5567
5775
|
* Emits only elements that differ from the previous one.
|
|
5568
5776
|
*
|
|
5569
|
-
*
|
|
5777
|
+
* **Example** (Emitting changed values)
|
|
5778
|
+
*
|
|
5570
5779
|
* ```ts
|
|
5571
5780
|
* import { Console, Effect, Stream } from "effect"
|
|
5572
5781
|
*
|
|
@@ -5583,14 +5792,15 @@ export const accumulate = self => mapAccumArray(self, Arr.empty, (acc, as) => {
|
|
|
5583
5792
|
* // [1, 2, 3]
|
|
5584
5793
|
* ```
|
|
5585
5794
|
*
|
|
5586
|
-
* @since 2.0.0
|
|
5587
5795
|
* @category Deduplication
|
|
5796
|
+
* @since 2.0.0
|
|
5588
5797
|
*/
|
|
5589
5798
|
export const changes = self => changesWith(self, Equal.equals);
|
|
5590
5799
|
/**
|
|
5591
5800
|
* Returns a stream that only emits elements that are not equal to the previously emitted element, as determined by the specified predicate.
|
|
5592
5801
|
*
|
|
5593
|
-
*
|
|
5802
|
+
* **Example** (Emitting values that changed by equivalence)
|
|
5803
|
+
*
|
|
5594
5804
|
* ```ts
|
|
5595
5805
|
* import { Console, Effect, Stream } from "effect"
|
|
5596
5806
|
*
|
|
@@ -5607,8 +5817,8 @@ export const changes = self => changesWith(self, Equal.equals);
|
|
|
5607
5817
|
* // ["A", "B"]
|
|
5608
5818
|
* ```
|
|
5609
5819
|
*
|
|
5610
|
-
* @since 2.0.0
|
|
5611
5820
|
* @category Deduplication
|
|
5821
|
+
* @since 2.0.0
|
|
5612
5822
|
*/
|
|
5613
5823
|
export const changesWith = /*#__PURE__*/dual(2, (self, f) => transformPull(self, (pull, _scope) => Effect.sync(() => {
|
|
5614
5824
|
let first = true;
|
|
@@ -5636,7 +5846,8 @@ export const changesWith = /*#__PURE__*/dual(2, (self, f) => transformPull(self,
|
|
|
5636
5846
|
*
|
|
5637
5847
|
* The predicate runs for each element after the first; returning `true` treats it as equal and skips it.
|
|
5638
5848
|
*
|
|
5639
|
-
*
|
|
5849
|
+
* **Example** (Effectfully emitting changed values)
|
|
5850
|
+
*
|
|
5640
5851
|
* ```ts
|
|
5641
5852
|
* import { Console, Effect, Stream } from "effect"
|
|
5642
5853
|
*
|
|
@@ -5652,8 +5863,8 @@ export const changesWith = /*#__PURE__*/dual(2, (self, f) => transformPull(self,
|
|
|
5652
5863
|
* // { _id: "Chunk", values: [ 1, 2, 3 ] }
|
|
5653
5864
|
* ```
|
|
5654
5865
|
*
|
|
5655
|
-
* @since 2.0.0
|
|
5656
5866
|
* @category Deduplication
|
|
5867
|
+
* @since 2.0.0
|
|
5657
5868
|
*/
|
|
5658
5869
|
export const changesWithEffect = /*#__PURE__*/dual(2, (self, f) => transformPull(self, (pull, _scope) => Effect.sync(() => {
|
|
5659
5870
|
let first = true;
|
|
@@ -5679,7 +5890,8 @@ export const changesWithEffect = /*#__PURE__*/dual(2, (self, f) => transformPull
|
|
|
5679
5890
|
/**
|
|
5680
5891
|
* Decodes Uint8Array chunks into strings using TextDecoder with an optional encoding.
|
|
5681
5892
|
*
|
|
5682
|
-
*
|
|
5893
|
+
* **Example** (Decoding Uint8Array chunks into strings using TextDecoder with an optional encoding)
|
|
5894
|
+
*
|
|
5683
5895
|
* ```ts
|
|
5684
5896
|
* import { Console, Effect, Stream } from "effect"
|
|
5685
5897
|
*
|
|
@@ -5701,8 +5913,8 @@ export const changesWithEffect = /*#__PURE__*/dual(2, (self, f) => transformPull
|
|
|
5701
5913
|
* // ["Hello", " World"]
|
|
5702
5914
|
* ```
|
|
5703
5915
|
*
|
|
5916
|
+
* @category encoding
|
|
5704
5917
|
* @since 2.0.0
|
|
5705
|
-
* @category Encoding
|
|
5706
5918
|
*/
|
|
5707
5919
|
export const decodeText = /*#__PURE__*/dual(args => isStream(args[0]), (self, options) => suspend(() => {
|
|
5708
5920
|
const decoder = new TextDecoder(options?.encoding);
|
|
@@ -5713,7 +5925,8 @@ export const decodeText = /*#__PURE__*/dual(args => isStream(args[0]), (self, op
|
|
|
5713
5925
|
/**
|
|
5714
5926
|
* Encodes a stream of strings into UTF-8 `Uint8Array` chunks.
|
|
5715
5927
|
*
|
|
5716
|
-
*
|
|
5928
|
+
* **Example** (Encoding a stream of strings into UTF-8 Uint8Array chunks)
|
|
5929
|
+
*
|
|
5717
5930
|
* ```ts
|
|
5718
5931
|
* import { Console, Effect, Stream } from "effect"
|
|
5719
5932
|
*
|
|
@@ -5729,8 +5942,8 @@ export const decodeText = /*#__PURE__*/dual(args => isStream(args[0]), (self, op
|
|
|
5729
5942
|
* // [[72, 101, 108, 108, 111], [32], [87, 111, 114, 108, 100]]
|
|
5730
5943
|
* ```
|
|
5731
5944
|
*
|
|
5945
|
+
* @category encoding
|
|
5732
5946
|
* @since 2.0.0
|
|
5733
|
-
* @category Encoding
|
|
5734
5947
|
*/
|
|
5735
5948
|
export const encodeText = self => suspend(() => {
|
|
5736
5949
|
const encoder = new TextEncoder();
|
|
@@ -5739,7 +5952,8 @@ export const encodeText = self => suspend(() => {
|
|
|
5739
5952
|
/**
|
|
5740
5953
|
* Splits a stream of strings into lines, handling `\n`, `\r`, and `\r\n` delimiters across chunks.
|
|
5741
5954
|
*
|
|
5742
|
-
*
|
|
5955
|
+
* **Example** (Splitting streamed text into lines)
|
|
5956
|
+
*
|
|
5743
5957
|
* ```ts
|
|
5744
5958
|
* import { Console, Effect, Stream } from "effect"
|
|
5745
5959
|
*
|
|
@@ -5752,14 +5966,15 @@ export const encodeText = self => suspend(() => {
|
|
|
5752
5966
|
* // ["a", "b", "c"]
|
|
5753
5967
|
* ```
|
|
5754
5968
|
*
|
|
5969
|
+
* @category encoding
|
|
5755
5970
|
* @since 2.0.0
|
|
5756
|
-
* @category Encoding
|
|
5757
5971
|
*/
|
|
5758
5972
|
export const splitLines = self => self.channel.pipe(Channel.pipeTo(Channel.splitLines()), fromChannel);
|
|
5759
5973
|
/**
|
|
5760
5974
|
* Inserts the provided element between emitted elements.
|
|
5761
5975
|
*
|
|
5762
|
-
*
|
|
5976
|
+
* **Example** (Interspersing stream elements)
|
|
5977
|
+
*
|
|
5763
5978
|
* ```ts
|
|
5764
5979
|
* import { Console, Effect, Stream } from "effect"
|
|
5765
5980
|
*
|
|
@@ -5773,8 +5988,8 @@ export const splitLines = self => self.channel.pipe(Channel.pipeTo(Channel.split
|
|
|
5773
5988
|
* // [1, 0, 2, 0, 3, 0, 4]
|
|
5774
5989
|
* ```
|
|
5775
5990
|
*
|
|
5991
|
+
* @category sequencing
|
|
5776
5992
|
* @since 2.0.0
|
|
5777
|
-
* @category Sequencing
|
|
5778
5993
|
*/
|
|
5779
5994
|
export const intersperse = /*#__PURE__*/dual(2, (self, element) => mapArray(self, (arr, i) => {
|
|
5780
5995
|
const out = i === 0 ? [] : [element];
|
|
@@ -5793,7 +6008,8 @@ export const intersperse = /*#__PURE__*/dual(2, (self, element) => mapArray(self
|
|
|
5793
6008
|
*
|
|
5794
6009
|
* The start and end values are always emitted, even when the stream is empty.
|
|
5795
6010
|
*
|
|
5796
|
-
*
|
|
6011
|
+
* **Example** (Interspersing stream affixes)
|
|
6012
|
+
*
|
|
5797
6013
|
* ```ts
|
|
5798
6014
|
* import { Console, Effect, Stream } from "effect"
|
|
5799
6015
|
*
|
|
@@ -5810,8 +6026,8 @@ export const intersperse = /*#__PURE__*/dual(2, (self, element) => mapArray(self
|
|
|
5810
6026
|
* // [ "[", "a", ",", "b", ",", "c", "]" ]
|
|
5811
6027
|
* ```
|
|
5812
6028
|
*
|
|
6029
|
+
* @category sequencing
|
|
5813
6030
|
* @since 2.0.0
|
|
5814
|
-
* @category Sequencing
|
|
5815
6031
|
*/
|
|
5816
6032
|
export const intersperseAffixes = /*#__PURE__*/dual(2, (self, options) => succeed(options.start).pipe(concat(intersperse(self, options.middle)), concat(succeed(options.end))));
|
|
5817
6033
|
/**
|
|
@@ -5819,7 +6035,8 @@ export const intersperseAffixes = /*#__PURE__*/dual(2, (self, options) => succee
|
|
|
5819
6035
|
* each stream; when one ends, the remaining values from the other stream are
|
|
5820
6036
|
* emitted.
|
|
5821
6037
|
*
|
|
5822
|
-
*
|
|
6038
|
+
* **Example** (Interleaving streams)
|
|
6039
|
+
*
|
|
5823
6040
|
* ```ts
|
|
5824
6041
|
* import { Console, Effect, Stream } from "effect"
|
|
5825
6042
|
*
|
|
@@ -5836,8 +6053,8 @@ export const intersperseAffixes = /*#__PURE__*/dual(2, (self, options) => succee
|
|
|
5836
6053
|
* Effect.runPromise(program)
|
|
5837
6054
|
* // [2, 5, 3, 6, 7]
|
|
5838
6055
|
* ```
|
|
5839
|
-
* @since 2.0.0
|
|
5840
6056
|
* @category Merging
|
|
6057
|
+
* @since 2.0.0
|
|
5841
6058
|
*/
|
|
5842
6059
|
export const interleave = /*#__PURE__*/dual(2, (self, that) => interleaveWith(self, that, fromIterable(Iterable.forever([true, false]))));
|
|
5843
6060
|
/**
|
|
@@ -5846,7 +6063,8 @@ export const interleave = /*#__PURE__*/dual(2, (self, that) => interleaveWith(se
|
|
|
5846
6063
|
* The decider controls how many elements are pulled; if one side ends, pulls for
|
|
5847
6064
|
* that side are ignored.
|
|
5848
6065
|
*
|
|
5849
|
-
*
|
|
6066
|
+
* **Example** (Interleaving two streams deterministically by following a boolean decider stream)
|
|
6067
|
+
*
|
|
5850
6068
|
* ```ts
|
|
5851
6069
|
* import { Console, Effect, Stream } from "effect"
|
|
5852
6070
|
*
|
|
@@ -5866,8 +6084,8 @@ export const interleave = /*#__PURE__*/dual(2, (self, that) => interleaveWith(se
|
|
|
5866
6084
|
* // [ 1, 2, 4, 3, 5 ]
|
|
5867
6085
|
* ```
|
|
5868
6086
|
*
|
|
5869
|
-
* @since 2.0.0
|
|
5870
6087
|
* @category Merging
|
|
6088
|
+
* @since 2.0.0
|
|
5871
6089
|
*/
|
|
5872
6090
|
export const interleaveWith = /*#__PURE__*/dual(3, (self, that, decider) => fromChannel(Channel.fromTransform(Effect.fnUntraced(function* (upstream, scope) {
|
|
5873
6091
|
const pullDecider = yield* Channel.toTransform(Channel.flattenArray(decider.channel))(upstream, scope);
|
|
@@ -5905,7 +6123,8 @@ export const interleaveWith = /*#__PURE__*/dual(3, (self, that, decider) => from
|
|
|
5905
6123
|
* If the effect completes with a failure before the stream completes, the
|
|
5906
6124
|
* returned stream will emit that failure.
|
|
5907
6125
|
*
|
|
5908
|
-
*
|
|
6126
|
+
* **Example** (Interrupting when an effect completes)
|
|
6127
|
+
*
|
|
5909
6128
|
* ```ts
|
|
5910
6129
|
* import { Console, Deferred, Effect, Stream } from "effect"
|
|
5911
6130
|
*
|
|
@@ -5928,14 +6147,15 @@ export const interleaveWith = /*#__PURE__*/dual(3, (self, that, decider) => from
|
|
|
5928
6147
|
* // => [1, 2]
|
|
5929
6148
|
* ```
|
|
5930
6149
|
*
|
|
5931
|
-
* @since 2.0.0
|
|
5932
6150
|
* @category Interruption
|
|
6151
|
+
* @since 2.0.0
|
|
5933
6152
|
*/
|
|
5934
6153
|
export const interruptWhen = /*#__PURE__*/dual(2, (self, effect) => fromChannel(Channel.interruptWhen(self.channel, effect)));
|
|
5935
6154
|
/**
|
|
5936
6155
|
* Halts evaluation after the current element once the provided effect completes; the effect is forked, its success is discarded, failures fail the stream, and it does not interrupt an in-progress pull (use `interruptWhen` for that).
|
|
5937
6156
|
*
|
|
5938
|
-
*
|
|
6157
|
+
* **Example** (Halting a stream after an effect completes)
|
|
6158
|
+
*
|
|
5939
6159
|
* ```ts
|
|
5940
6160
|
* import { Console, Deferred, Effect, Stream } from "effect"
|
|
5941
6161
|
*
|
|
@@ -5954,14 +6174,15 @@ export const interruptWhen = /*#__PURE__*/dual(2, (self, effect) => fromChannel(
|
|
|
5954
6174
|
* // [1, 2]
|
|
5955
6175
|
* ```
|
|
5956
6176
|
*
|
|
5957
|
-
* @since 2.0.0
|
|
5958
6177
|
* @category Interruption
|
|
6178
|
+
* @since 2.0.0
|
|
5959
6179
|
*/
|
|
5960
6180
|
export const haltWhen = /*#__PURE__*/dual(2, (self, effect) => fromChannel(Channel.haltWhen(self.channel, effect)));
|
|
5961
6181
|
/**
|
|
5962
6182
|
* Runs the provided finalizer when the stream exits, passing the exit value.
|
|
5963
6183
|
*
|
|
5964
|
-
*
|
|
6184
|
+
* **Example** (Running a finalizer on exit)
|
|
6185
|
+
*
|
|
5965
6186
|
* ```ts
|
|
5966
6187
|
* import { Console, Effect, Exit, Stream } from "effect"
|
|
5967
6188
|
*
|
|
@@ -5980,8 +6201,8 @@ export const haltWhen = /*#__PURE__*/dual(2, (self, effect) => fromChannel(Chann
|
|
|
5980
6201
|
* // Stream completed successfully
|
|
5981
6202
|
* ```
|
|
5982
6203
|
*
|
|
5983
|
-
* @since 4.0.0
|
|
5984
6204
|
* @category Finalization
|
|
6205
|
+
* @since 4.0.0
|
|
5985
6206
|
*/
|
|
5986
6207
|
export const onExit = /*#__PURE__*/dual(2, (self, finalizer) => fromChannel(Channel.onExit(self.channel, finalizer)));
|
|
5987
6208
|
/**
|
|
@@ -5990,7 +6211,8 @@ export const onExit = /*#__PURE__*/dual(2, (self, finalizer) => fromChannel(Chan
|
|
|
5990
6211
|
* Note: Unlike `Effect.onError` there is no guarantee that the provided
|
|
5991
6212
|
* effect will not be interrupted.
|
|
5992
6213
|
*
|
|
5993
|
-
*
|
|
6214
|
+
* **Example** (Running an effect on errors)
|
|
6215
|
+
*
|
|
5994
6216
|
* ```ts
|
|
5995
6217
|
* import { Cause, Console, Effect, Stream } from "effect"
|
|
5996
6218
|
*
|
|
@@ -6008,14 +6230,15 @@ export const onExit = /*#__PURE__*/dual(2, (self, finalizer) => fromChannel(Chan
|
|
|
6008
6230
|
* // Stream failed: boom
|
|
6009
6231
|
* ```
|
|
6010
6232
|
*
|
|
6233
|
+
* @category error handling
|
|
6011
6234
|
* @since 2.0.0
|
|
6012
|
-
* @category Error Handling
|
|
6013
6235
|
*/
|
|
6014
6236
|
export const onError = /*#__PURE__*/dual(2, (self, cleanup) => fromChannel(Channel.onError(self.channel, cleanup)));
|
|
6015
6237
|
/**
|
|
6016
6238
|
* Runs the provided effect before this stream starts.
|
|
6017
6239
|
*
|
|
6018
|
-
*
|
|
6240
|
+
* **Example** (Running an effect on start)
|
|
6241
|
+
*
|
|
6019
6242
|
* ```ts
|
|
6020
6243
|
* import { Console, Effect, Stream } from "effect"
|
|
6021
6244
|
*
|
|
@@ -6034,14 +6257,15 @@ export const onError = /*#__PURE__*/dual(2, (self, cleanup) => fromChannel(Chann
|
|
|
6034
6257
|
* // [1, 2, 3]
|
|
6035
6258
|
* ```
|
|
6036
6259
|
*
|
|
6037
|
-
* @
|
|
6038
|
-
* @
|
|
6260
|
+
* @category sequencing
|
|
6261
|
+
* @since 3.6.0
|
|
6039
6262
|
*/
|
|
6040
6263
|
export const onStart = /*#__PURE__*/dual(2, (self, onStart) => fromChannel(Channel.onStart(self.channel, onStart)));
|
|
6041
6264
|
/**
|
|
6042
6265
|
* Runs the provided effect with the first element emitted by the stream.
|
|
6043
6266
|
*
|
|
6044
|
-
*
|
|
6267
|
+
* **Example** (Running an effect on the first value)
|
|
6268
|
+
*
|
|
6045
6269
|
* ```ts
|
|
6046
6270
|
* import { Console, Effect, Stream } from "effect"
|
|
6047
6271
|
*
|
|
@@ -6054,14 +6278,15 @@ export const onStart = /*#__PURE__*/dual(2, (self, onStart) => fromChannel(Chann
|
|
|
6054
6278
|
* // Output: first=1
|
|
6055
6279
|
* ```
|
|
6056
6280
|
*
|
|
6281
|
+
* @category sequencing
|
|
6057
6282
|
* @since 4.0.0
|
|
6058
|
-
* @category Sequencing
|
|
6059
6283
|
*/
|
|
6060
6284
|
export const onFirst = /*#__PURE__*/dual(2, (self, onFirst) => fromChannel(Channel.onFirst(self.channel, arr => onFirst(arr[0]))));
|
|
6061
6285
|
/**
|
|
6062
6286
|
* Runs the provided effect when the stream ends successfully.
|
|
6063
6287
|
*
|
|
6064
|
-
*
|
|
6288
|
+
* **Example** (Running an effect on end)
|
|
6289
|
+
*
|
|
6065
6290
|
* ```ts
|
|
6066
6291
|
* import { Console, Effect, Stream } from "effect"
|
|
6067
6292
|
*
|
|
@@ -6078,14 +6303,15 @@ export const onFirst = /*#__PURE__*/dual(2, (self, onFirst) => fromChannel(Chann
|
|
|
6078
6303
|
* // [1, 2, 3]
|
|
6079
6304
|
* ```
|
|
6080
6305
|
*
|
|
6081
|
-
* @
|
|
6082
|
-
* @
|
|
6306
|
+
* @category sequencing
|
|
6307
|
+
* @since 3.6.0
|
|
6083
6308
|
*/
|
|
6084
6309
|
export const onEnd = /*#__PURE__*/dual(2, (self, onEnd) => fromChannel(Channel.onEnd(self.channel, onEnd)));
|
|
6085
6310
|
/**
|
|
6086
6311
|
* Executes the provided finalizer after this stream's finalizers run.
|
|
6087
6312
|
*
|
|
6088
|
-
*
|
|
6313
|
+
* **Example** (Ensuring finalization)
|
|
6314
|
+
*
|
|
6089
6315
|
* ```ts
|
|
6090
6316
|
* import { Console, Effect, Stream } from "effect"
|
|
6091
6317
|
*
|
|
@@ -6103,8 +6329,8 @@ export const onEnd = /*#__PURE__*/dual(2, (self, onEnd) => fromChannel(Channel.o
|
|
|
6103
6329
|
* //=> [1, 2]
|
|
6104
6330
|
* ```
|
|
6105
6331
|
*
|
|
6106
|
-
* @since 4.0.0
|
|
6107
6332
|
* @category Finalization
|
|
6333
|
+
* @since 2.0.0
|
|
6108
6334
|
*/
|
|
6109
6335
|
export const ensuring = /*#__PURE__*/dual(2, (self, finalizer) => fromChannel(Channel.ensuring(self.channel, finalizer)));
|
|
6110
6336
|
/**
|
|
@@ -6112,11 +6338,10 @@ export const ensuring = /*#__PURE__*/dual(2, (self, finalizer) => fromChannel(Ch
|
|
|
6112
6338
|
* service requirements. Use `options.local` to build the layer every time; by
|
|
6113
6339
|
* default, layers are shared between provide calls.
|
|
6114
6340
|
*
|
|
6115
|
-
* **
|
|
6341
|
+
* **Example** (Providing stream requirements)
|
|
6116
6342
|
*
|
|
6117
|
-
* @example
|
|
6118
6343
|
* ```ts
|
|
6119
|
-
* import { Console, Effect, Layer,
|
|
6344
|
+
* import { Console, Context, Effect, Layer, Stream } from "effect"
|
|
6120
6345
|
*
|
|
6121
6346
|
* class Env extends Context.Service<Env, { readonly name: string }>()("Env") {}
|
|
6122
6347
|
*
|
|
@@ -6140,16 +6365,17 @@ export const ensuring = /*#__PURE__*/dual(2, (self, finalizer) => fromChannel(Ch
|
|
|
6140
6365
|
* // ["Hello, Ada"]
|
|
6141
6366
|
* ```
|
|
6142
6367
|
*
|
|
6368
|
+
* @category services
|
|
6143
6369
|
* @since 4.0.0
|
|
6144
|
-
* @category Services
|
|
6145
6370
|
*/
|
|
6146
6371
|
export const provide = /*#__PURE__*/dual(args => isStream(args[0]), (self, layer, options) => fromChannel(Channel.provide(self.channel, layer, options)));
|
|
6147
6372
|
/**
|
|
6148
6373
|
* Provides multiple services to the stream using a context.
|
|
6149
6374
|
*
|
|
6150
|
-
*
|
|
6375
|
+
* **Example** (Providing multiple services to the stream using a context)
|
|
6376
|
+
*
|
|
6151
6377
|
* ```ts
|
|
6152
|
-
* import { Console,
|
|
6378
|
+
* import { Console, Context, Effect, Stream } from "effect"
|
|
6153
6379
|
*
|
|
6154
6380
|
* class Config extends Context.Service<Config, { readonly prefix: string }>()("Config") {}
|
|
6155
6381
|
* class Greeter extends Context.Service<Greeter, { greet: (name: string) => string }>()("Greeter") {}
|
|
@@ -6175,17 +6401,18 @@ export const provide = /*#__PURE__*/dual(args => isStream(args[0]), (self, layer
|
|
|
6175
6401
|
* // ["Hello!"]
|
|
6176
6402
|
* ```
|
|
6177
6403
|
*
|
|
6178
|
-
* @
|
|
6179
|
-
* @
|
|
6404
|
+
* @category services
|
|
6405
|
+
* @since 2.0.0
|
|
6180
6406
|
*/
|
|
6181
6407
|
export const provideContext = /*#__PURE__*/dual(2, (self, context) => fromChannel(Channel.provideContext(self.channel, context)));
|
|
6182
6408
|
/**
|
|
6183
6409
|
* Provides the stream with a single required service, eliminating that
|
|
6184
6410
|
* requirement from its environment.
|
|
6185
6411
|
*
|
|
6186
|
-
*
|
|
6412
|
+
* **Example** (Providing a stream service)
|
|
6413
|
+
*
|
|
6187
6414
|
* ```ts
|
|
6188
|
-
* import { Console,
|
|
6415
|
+
* import { Console, Context, Effect, Stream } from "effect"
|
|
6189
6416
|
*
|
|
6190
6417
|
* class Greeter extends Context.Service<Greeter, {
|
|
6191
6418
|
* greet: (name: string) => string
|
|
@@ -6212,16 +6439,17 @@ export const provideContext = /*#__PURE__*/dual(2, (self, context) => fromChanne
|
|
|
6212
6439
|
* //=> ["Hello, Ada"]
|
|
6213
6440
|
* ```
|
|
6214
6441
|
*
|
|
6215
|
-
* @
|
|
6216
|
-
* @
|
|
6442
|
+
* @category services
|
|
6443
|
+
* @since 2.0.0
|
|
6217
6444
|
*/
|
|
6218
6445
|
export const provideService = /*#__PURE__*/dual(3, (self, key, service) => fromChannel(Channel.provideService(self.channel, key, service)));
|
|
6219
6446
|
/**
|
|
6220
6447
|
* Provides a service to the stream using an effect, removing the requirement and adding the effect's error and environment.
|
|
6221
6448
|
*
|
|
6222
|
-
*
|
|
6449
|
+
* **Example** (Providing a stream service effectfully)
|
|
6450
|
+
*
|
|
6223
6451
|
* ```ts
|
|
6224
|
-
* import { Console,
|
|
6452
|
+
* import { Console, Context, Effect, Stream } from "effect"
|
|
6225
6453
|
*
|
|
6226
6454
|
* class ApiConfig extends Context.Service<ApiConfig, { readonly baseUrl: string }>()("ApiConfig") {}
|
|
6227
6455
|
*
|
|
@@ -6251,17 +6479,18 @@ export const provideService = /*#__PURE__*/dual(3, (self, key, service) => fromC
|
|
|
6251
6479
|
* // ["https://example.com"]
|
|
6252
6480
|
* ```
|
|
6253
6481
|
*
|
|
6254
|
-
* @
|
|
6255
|
-
* @
|
|
6482
|
+
* @category services
|
|
6483
|
+
* @since 2.0.0
|
|
6256
6484
|
*/
|
|
6257
6485
|
export const provideServiceEffect = /*#__PURE__*/dual(3, (self, key, service) => fromChannel(Channel.provideServiceEffect(self.channel, key, service)));
|
|
6258
6486
|
/**
|
|
6259
6487
|
* Transforms the stream's required services by mapping the current context
|
|
6260
6488
|
* to a new one.
|
|
6261
6489
|
*
|
|
6262
|
-
*
|
|
6490
|
+
* **Example** (Updating the stream context)
|
|
6491
|
+
*
|
|
6263
6492
|
* ```ts
|
|
6264
|
-
* import { Console,
|
|
6493
|
+
* import { Console, Context, Effect, Stream } from "effect"
|
|
6265
6494
|
*
|
|
6266
6495
|
* class Logger extends Context.Service<Logger, { prefix: string }>()("Logger") {}
|
|
6267
6496
|
* class Config extends Context.Service<Config, { name: string }>()("Config") {}
|
|
@@ -6291,16 +6520,17 @@ export const provideServiceEffect = /*#__PURE__*/dual(3, (self, key, service) =>
|
|
|
6291
6520
|
* //=> [ "Hello World" ]
|
|
6292
6521
|
* ```
|
|
6293
6522
|
*
|
|
6294
|
-
* @
|
|
6295
|
-
* @
|
|
6523
|
+
* @category services
|
|
6524
|
+
* @since 4.0.0
|
|
6296
6525
|
*/
|
|
6297
6526
|
export const updateContext = /*#__PURE__*/dual(2, (self, f) => fromChannel(Channel.updateContext(self.channel, f)));
|
|
6298
6527
|
/**
|
|
6299
6528
|
* Updates a single service in the stream environment by applying a function.
|
|
6300
6529
|
*
|
|
6301
|
-
*
|
|
6530
|
+
* **Example** (Updating a stream service)
|
|
6531
|
+
*
|
|
6302
6532
|
* ```ts
|
|
6303
|
-
* import { Console,
|
|
6533
|
+
* import { Console, Context, Effect, Stream } from "effect"
|
|
6304
6534
|
*
|
|
6305
6535
|
* class Counter extends Context.Service<Counter, { count: number }>()("Counter") {}
|
|
6306
6536
|
*
|
|
@@ -6317,14 +6547,15 @@ export const updateContext = /*#__PURE__*/dual(2, (self, f) => fromChannel(Chann
|
|
|
6317
6547
|
* // Output: Updated count: 1
|
|
6318
6548
|
* ```
|
|
6319
6549
|
*
|
|
6550
|
+
* @category services
|
|
6320
6551
|
* @since 2.0.0
|
|
6321
|
-
* @category Services
|
|
6322
6552
|
*/
|
|
6323
6553
|
export const updateService = /*#__PURE__*/dual(3, (self, service, f) => updateContext(self, context => Context.add(context, service, f(Context.get(context, service)))));
|
|
6324
6554
|
/**
|
|
6325
6555
|
* Wraps the stream with a new span for tracing.
|
|
6326
6556
|
*
|
|
6327
|
-
*
|
|
6557
|
+
* **Example** (Wrapping a stream in a span)
|
|
6558
|
+
*
|
|
6328
6559
|
* ```ts
|
|
6329
6560
|
* import { Console, Effect, Stream } from "effect"
|
|
6330
6561
|
*
|
|
@@ -6339,8 +6570,8 @@ export const updateService = /*#__PURE__*/dual(3, (self, service, f) => updateCo
|
|
|
6339
6570
|
* // [1, 2, 3]
|
|
6340
6571
|
* ```
|
|
6341
6572
|
*
|
|
6342
|
-
* @
|
|
6343
|
-
* @
|
|
6573
|
+
* @category tracing
|
|
6574
|
+
* @since 2.0.0
|
|
6344
6575
|
*/
|
|
6345
6576
|
export const withSpan = function () {
|
|
6346
6577
|
const dataFirst = isStream(arguments[0]);
|
|
@@ -6355,9 +6586,10 @@ export const withSpan = function () {
|
|
|
6355
6586
|
/**
|
|
6356
6587
|
* Provides the entry point for do-notation style stream composition.
|
|
6357
6588
|
*
|
|
6358
|
-
*
|
|
6589
|
+
* **Example** (Starting stream do notation)
|
|
6590
|
+
*
|
|
6359
6591
|
* ```ts
|
|
6360
|
-
* import { Console, Effect,
|
|
6592
|
+
* import { Console, Effect, pipe, Stream } from "effect"
|
|
6361
6593
|
*
|
|
6362
6594
|
* const program = pipe(
|
|
6363
6595
|
* Stream.Do,
|
|
@@ -6374,8 +6606,8 @@ export const withSpan = function () {
|
|
|
6374
6606
|
* //=> [{ value: 1, next: 2 }, { value: 2, next: 3 }]
|
|
6375
6607
|
* ```
|
|
6376
6608
|
*
|
|
6377
|
-
* @since 4.0.0
|
|
6378
6609
|
* @category Do Notation
|
|
6610
|
+
* @since 2.0.0
|
|
6379
6611
|
*/
|
|
6380
6612
|
export const Do = /*#__PURE__*/succeed({});
|
|
6381
6613
|
const let_ = /*#__PURE__*/dual(3, (self, name, f) => map(self, a => ({
|
|
@@ -6386,7 +6618,8 @@ export {
|
|
|
6386
6618
|
/**
|
|
6387
6619
|
* Adds a computed field to the current Do-notation record.
|
|
6388
6620
|
*
|
|
6389
|
-
*
|
|
6621
|
+
* **Example** (Adding a computed field)
|
|
6622
|
+
*
|
|
6390
6623
|
* ```ts
|
|
6391
6624
|
* import { Console, Effect, Stream } from "effect"
|
|
6392
6625
|
*
|
|
@@ -6404,14 +6637,15 @@ export {
|
|
|
6404
6637
|
* // [{ x: 2, y: 6 }]
|
|
6405
6638
|
* ```
|
|
6406
6639
|
*
|
|
6407
|
-
* @since 4.0.0
|
|
6408
6640
|
* @category Do Notation
|
|
6641
|
+
* @since 2.0.0
|
|
6409
6642
|
*/
|
|
6410
6643
|
let_ as let };
|
|
6411
6644
|
/**
|
|
6412
6645
|
* Binds the result of a stream to a field in the do-notation record.
|
|
6413
6646
|
*
|
|
6414
|
-
*
|
|
6647
|
+
* **Example** (Binding a stream value)
|
|
6648
|
+
*
|
|
6415
6649
|
* ```ts
|
|
6416
6650
|
* import { Console, Effect, Stream } from "effect"
|
|
6417
6651
|
*
|
|
@@ -6426,8 +6660,8 @@ let_ as let };
|
|
|
6426
6660
|
* // [{ a: 1, b: 2 }, { a: 2, b: 3 }]
|
|
6427
6661
|
* ```
|
|
6428
6662
|
*
|
|
6429
|
-
* @since 4.0.0
|
|
6430
6663
|
* @category Do Notation
|
|
6664
|
+
* @since 2.0.0
|
|
6431
6665
|
*/
|
|
6432
6666
|
export const bind = /*#__PURE__*/dual(args => isStream(args[0]), (self, tag, f, options) => flatMap(self, a => map(f(a), b => ({
|
|
6433
6667
|
...a,
|
|
@@ -6436,7 +6670,8 @@ export const bind = /*#__PURE__*/dual(args => isStream(args[0]), (self, tag, f,
|
|
|
6436
6670
|
/**
|
|
6437
6671
|
* Binds an Effect-produced value into the do-notation record for each stream element.
|
|
6438
6672
|
*
|
|
6439
|
-
*
|
|
6673
|
+
* **Example** (Binding an effect value)
|
|
6674
|
+
*
|
|
6440
6675
|
* ```ts
|
|
6441
6676
|
* import { Console, Effect, Stream } from "effect"
|
|
6442
6677
|
*
|
|
@@ -6454,8 +6689,8 @@ export const bind = /*#__PURE__*/dual(args => isStream(args[0]), (self, tag, f,
|
|
|
6454
6689
|
* // [{ value: 1, double: 2 }, { value: 2, double: 4 }]
|
|
6455
6690
|
* ```
|
|
6456
6691
|
*
|
|
6457
|
-
* @since 4.0.0
|
|
6458
6692
|
* @category Do Notation
|
|
6693
|
+
* @since 2.0.0
|
|
6459
6694
|
*/
|
|
6460
6695
|
export const bindEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self, tag, f, options) => mapEffect(self, a => Effect.map(f(a), b => ({
|
|
6461
6696
|
...a,
|
|
@@ -6464,7 +6699,8 @@ export const bindEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self, ta
|
|
|
6464
6699
|
/**
|
|
6465
6700
|
* Maps each element into a record keyed by the provided name.
|
|
6466
6701
|
*
|
|
6467
|
-
*
|
|
6702
|
+
* **Example** (Binding values to a record key)
|
|
6703
|
+
*
|
|
6468
6704
|
* ```ts
|
|
6469
6705
|
* import { Console, Effect, Stream } from "effect"
|
|
6470
6706
|
*
|
|
@@ -6477,7 +6713,7 @@ export const bindEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self, ta
|
|
|
6477
6713
|
* ```
|
|
6478
6714
|
*
|
|
6479
6715
|
* @category Do Notation
|
|
6480
|
-
* @since
|
|
6716
|
+
* @since 2.0.0
|
|
6481
6717
|
*/
|
|
6482
6718
|
export const bindTo = /*#__PURE__*/dual(2, (self, name) => map(self, a => ({
|
|
6483
6719
|
[name]: a
|
|
@@ -6485,7 +6721,8 @@ export const bindTo = /*#__PURE__*/dual(2, (self, name) => map(self, a => ({
|
|
|
6485
6721
|
/**
|
|
6486
6722
|
* Runs a stream with a sink and returns the sink result.
|
|
6487
6723
|
*
|
|
6488
|
-
*
|
|
6724
|
+
* **Example** (Running a stream with a sink)
|
|
6725
|
+
*
|
|
6489
6726
|
* ```ts
|
|
6490
6727
|
* import { Console, Effect, Sink, Stream } from "effect"
|
|
6491
6728
|
*
|
|
@@ -6495,14 +6732,15 @@ export const bindTo = /*#__PURE__*/dual(2, (self, name) => map(self, a => ({
|
|
|
6495
6732
|
* // 6
|
|
6496
6733
|
* ```
|
|
6497
6734
|
*
|
|
6735
|
+
* @category destructors
|
|
6498
6736
|
* @since 2.0.0
|
|
6499
|
-
* @category Destructors
|
|
6500
6737
|
*/
|
|
6501
6738
|
export const run = /*#__PURE__*/dual(2, (self, sink) => Effect.scopedWith(scope => Channel.toPullScoped(self.channel, scope).pipe(Effect.flatMap(upstream => sink.transform(upstream, scope)), Effect.map(([a]) => a))));
|
|
6502
6739
|
/**
|
|
6503
6740
|
* Runs the stream and collects all elements into an array.
|
|
6504
6741
|
*
|
|
6505
|
-
*
|
|
6742
|
+
* **Example** (Collecting stream values)
|
|
6743
|
+
*
|
|
6506
6744
|
* ```ts
|
|
6507
6745
|
* import { Console, Effect, Stream } from "effect"
|
|
6508
6746
|
*
|
|
@@ -6517,8 +6755,8 @@ export const run = /*#__PURE__*/dual(2, (self, sink) => Effect.scopedWith(scope
|
|
|
6517
6755
|
* // [1, 2, 3, 4, 5]
|
|
6518
6756
|
* ```
|
|
6519
6757
|
*
|
|
6758
|
+
* @category destructors
|
|
6520
6759
|
* @since 2.0.0
|
|
6521
|
-
* @category Destructors
|
|
6522
6760
|
*/
|
|
6523
6761
|
export const runCollect = self => Channel.runFold(self.channel, () => [], (acc, chunk) => {
|
|
6524
6762
|
for (let i = 0; i < chunk.length; i++) {
|
|
@@ -6529,7 +6767,8 @@ export const runCollect = self => Channel.runFold(self.channel, () => [], (acc,
|
|
|
6529
6767
|
/**
|
|
6530
6768
|
* Runs the stream and returns the number of elements emitted.
|
|
6531
6769
|
*
|
|
6532
|
-
*
|
|
6770
|
+
* **Example** (Counting stream values)
|
|
6771
|
+
*
|
|
6533
6772
|
* ```ts
|
|
6534
6773
|
* import { Console, Effect, Stream } from "effect"
|
|
6535
6774
|
*
|
|
@@ -6544,14 +6783,15 @@ export const runCollect = self => Channel.runFold(self.channel, () => [], (acc,
|
|
|
6544
6783
|
* // 5
|
|
6545
6784
|
* ```
|
|
6546
6785
|
*
|
|
6786
|
+
* @category destructors
|
|
6547
6787
|
* @since 2.0.0
|
|
6548
|
-
* @category Destructors
|
|
6549
6788
|
*/
|
|
6550
6789
|
export const runCount = self => Channel.runFold(self.channel, () => 0, (acc, chunk) => acc + chunk.length);
|
|
6551
6790
|
/**
|
|
6552
6791
|
* Runs the stream and returns the numeric sum of its elements.
|
|
6553
6792
|
*
|
|
6554
|
-
*
|
|
6793
|
+
* **Example** (Summing stream values)
|
|
6794
|
+
*
|
|
6555
6795
|
* ```ts
|
|
6556
6796
|
* import { Console, Effect, Stream } from "effect"
|
|
6557
6797
|
*
|
|
@@ -6564,8 +6804,8 @@ export const runCount = self => Channel.runFold(self.channel, () => 0, (acc, chu
|
|
|
6564
6804
|
* // 6
|
|
6565
6805
|
* ```
|
|
6566
6806
|
*
|
|
6807
|
+
* @category destructors
|
|
6567
6808
|
* @since 2.0.0
|
|
6568
|
-
* @category Destructors
|
|
6569
6809
|
*/
|
|
6570
6810
|
export const runSum = self => Channel.runFold(self.channel, () => 0, (acc, chunk) => {
|
|
6571
6811
|
for (let i = 0; i < chunk.length; i++) {
|
|
@@ -6576,7 +6816,8 @@ export const runSum = self => Channel.runFold(self.channel, () => 0, (acc, chunk
|
|
|
6576
6816
|
/**
|
|
6577
6817
|
* Runs the stream and folds elements using a pure reducer.
|
|
6578
6818
|
*
|
|
6579
|
-
*
|
|
6819
|
+
* **Example** (Folding stream values)
|
|
6820
|
+
*
|
|
6580
6821
|
* ```ts
|
|
6581
6822
|
* import { Console, Effect, Stream } from "effect"
|
|
6582
6823
|
*
|
|
@@ -6593,8 +6834,8 @@ export const runSum = self => Channel.runFold(self.channel, () => 0, (acc, chunk
|
|
|
6593
6834
|
* // 6
|
|
6594
6835
|
* ```
|
|
6595
6836
|
*
|
|
6837
|
+
* @category destructors
|
|
6596
6838
|
* @since 2.0.0
|
|
6597
|
-
* @category Destructors
|
|
6598
6839
|
*/
|
|
6599
6840
|
export const runFold = /*#__PURE__*/dual(3, (self, initial, f) => Channel.runFold(self.channel, initial, (acc, arr) => {
|
|
6600
6841
|
for (let i = 0; i < arr.length; i++) {
|
|
@@ -6605,7 +6846,8 @@ export const runFold = /*#__PURE__*/dual(3, (self, initial, f) => Channel.runFol
|
|
|
6605
6846
|
/**
|
|
6606
6847
|
* Runs the stream and folds elements using an effectful reducer.
|
|
6607
6848
|
*
|
|
6608
|
-
*
|
|
6849
|
+
* **Example** (Effectfully folding stream values)
|
|
6850
|
+
*
|
|
6609
6851
|
* ```ts
|
|
6610
6852
|
* import { Console, Effect, Stream } from "effect"
|
|
6611
6853
|
*
|
|
@@ -6622,8 +6864,8 @@ export const runFold = /*#__PURE__*/dual(3, (self, initial, f) => Channel.runFol
|
|
|
6622
6864
|
* // 6
|
|
6623
6865
|
* ```
|
|
6624
6866
|
*
|
|
6867
|
+
* @category destructors
|
|
6625
6868
|
* @since 2.0.0
|
|
6626
|
-
* @category Destructors
|
|
6627
6869
|
*/
|
|
6628
6870
|
export const runFoldEffect = /*#__PURE__*/dual(3, (self, initial, f) => Channel.runFoldEffect(self.channel, initial, (acc, arr) => {
|
|
6629
6871
|
let i = 0;
|
|
@@ -6640,7 +6882,8 @@ export const runFoldEffect = /*#__PURE__*/dual(3, (self, initial, f) => Channel.
|
|
|
6640
6882
|
/**
|
|
6641
6883
|
* Runs the stream and returns the first element as an `Option`.
|
|
6642
6884
|
*
|
|
6643
|
-
*
|
|
6885
|
+
* **Example** (Getting the first stream value)
|
|
6886
|
+
*
|
|
6644
6887
|
* ```ts
|
|
6645
6888
|
* import { Console, Effect, Option, Stream } from "effect"
|
|
6646
6889
|
*
|
|
@@ -6653,21 +6896,22 @@ export const runFoldEffect = /*#__PURE__*/dual(3, (self, initial, f) => Channel.
|
|
|
6653
6896
|
* // 1
|
|
6654
6897
|
* ```
|
|
6655
6898
|
*
|
|
6899
|
+
* @category destructors
|
|
6656
6900
|
* @since 2.0.0
|
|
6657
|
-
* @category Destructors
|
|
6658
6901
|
*/
|
|
6659
6902
|
export const runHead = self => Effect.map(Channel.runHead(self.channel), Option.map(Arr.getUnsafe(0)));
|
|
6660
6903
|
/**
|
|
6661
6904
|
* Runs the stream and returns the last element as an `Option`.
|
|
6662
6905
|
*
|
|
6906
|
+
* @category destructors
|
|
6663
6907
|
* @since 2.0.0
|
|
6664
|
-
* @category Destructors
|
|
6665
6908
|
*/
|
|
6666
6909
|
export const runLast = self => Effect.map(Channel.runLast(self.channel), Option.map(Arr.lastNonEmpty));
|
|
6667
6910
|
/**
|
|
6668
6911
|
* Runs the provided effectful callback for each element of the stream.
|
|
6669
6912
|
*
|
|
6670
|
-
*
|
|
6913
|
+
* **Example** (Running an effect for each value)
|
|
6914
|
+
*
|
|
6671
6915
|
* ```ts
|
|
6672
6916
|
* import { Console, Effect, Stream } from "effect"
|
|
6673
6917
|
*
|
|
@@ -6683,8 +6927,8 @@ export const runLast = self => Effect.map(Channel.runLast(self.channel), Option.
|
|
|
6683
6927
|
* // Processing: 3
|
|
6684
6928
|
* ```
|
|
6685
6929
|
*
|
|
6930
|
+
* @category destructors
|
|
6686
6931
|
* @since 2.0.0
|
|
6687
|
-
* @category Destructors
|
|
6688
6932
|
*/
|
|
6689
6933
|
export const runForEach = /*#__PURE__*/dual(2, (self, f) => Channel.runForEach(self.channel, arr => {
|
|
6690
6934
|
let i = 0;
|
|
@@ -6698,7 +6942,8 @@ export const runForEach = /*#__PURE__*/dual(2, (self, f) => Channel.runForEach(s
|
|
|
6698
6942
|
* Runs the stream, applying the effectful predicate to each element and
|
|
6699
6943
|
* stopping when it returns `false`.
|
|
6700
6944
|
*
|
|
6701
|
-
*
|
|
6945
|
+
* **Example** (Running effects while a predicate holds)
|
|
6946
|
+
*
|
|
6702
6947
|
* ```ts
|
|
6703
6948
|
* import { Console, Effect, Stream } from "effect"
|
|
6704
6949
|
*
|
|
@@ -6719,8 +6964,8 @@ export const runForEach = /*#__PURE__*/dual(2, (self, f) => Channel.runForEach(s
|
|
|
6719
6964
|
* // Processing: 3
|
|
6720
6965
|
* ```
|
|
6721
6966
|
*
|
|
6967
|
+
* @category destructors
|
|
6722
6968
|
* @since 2.0.0
|
|
6723
|
-
* @category Destructors
|
|
6724
6969
|
*/
|
|
6725
6970
|
export const runForEachWhile = /*#__PURE__*/dual(2, (self, f) => Channel.runForEachWhile(self.channel, arr => {
|
|
6726
6971
|
let done = false;
|
|
@@ -6737,7 +6982,8 @@ export const runForEachWhile = /*#__PURE__*/dual(2, (self, f) => Channel.runForE
|
|
|
6737
6982
|
/**
|
|
6738
6983
|
* Consumes the stream in chunks, passing each non-empty array to the callback.
|
|
6739
6984
|
*
|
|
6740
|
-
*
|
|
6985
|
+
* **Example** (Consuming stream chunks)
|
|
6986
|
+
*
|
|
6741
6987
|
* ```ts
|
|
6742
6988
|
* import { Console, Effect, Stream } from "effect"
|
|
6743
6989
|
*
|
|
@@ -6753,14 +6999,15 @@ export const runForEachWhile = /*#__PURE__*/dual(2, (self, f) => Channel.runForE
|
|
|
6753
6999
|
* // Processing chunk: 1, 2, 3, 4, 5
|
|
6754
7000
|
* ```
|
|
6755
7001
|
*
|
|
6756
|
-
* @
|
|
6757
|
-
* @
|
|
7002
|
+
* @category destructors
|
|
7003
|
+
* @since 4.0.0
|
|
6758
7004
|
*/
|
|
6759
7005
|
export const runForEachArray = /*#__PURE__*/dual(2, (self, f) => Channel.runForEach(self.channel, f));
|
|
6760
7006
|
/**
|
|
6761
7007
|
* Runs the stream for its effects, discarding emitted elements.
|
|
6762
7008
|
*
|
|
6763
|
-
*
|
|
7009
|
+
* **Example** (Draining a stream run)
|
|
7010
|
+
*
|
|
6764
7011
|
* ```ts
|
|
6765
7012
|
* import { Console, Effect, Stream } from "effect"
|
|
6766
7013
|
*
|
|
@@ -6778,8 +7025,8 @@ export const runForEachArray = /*#__PURE__*/dual(2, (self, f) => Channel.runForE
|
|
|
6778
7025
|
* // Processing: 3
|
|
6779
7026
|
* ```
|
|
6780
7027
|
*
|
|
7028
|
+
* @category destructors
|
|
6781
7029
|
* @since 2.0.0
|
|
6782
|
-
* @category Destructors
|
|
6783
7030
|
*/
|
|
6784
7031
|
export const runDrain = self => Channel.runDrain(self.channel);
|
|
6785
7032
|
/**
|
|
@@ -6788,7 +7035,8 @@ export const runDrain = self => Channel.runDrain(self.channel);
|
|
|
6788
7035
|
* The pull fails with `Cause.Done` when the stream ends and with the stream
|
|
6789
7036
|
* error on failure.
|
|
6790
7037
|
*
|
|
6791
|
-
*
|
|
7038
|
+
* **Example** (Creating a scoped pull)
|
|
7039
|
+
*
|
|
6792
7040
|
* ```ts
|
|
6793
7041
|
* import { Console, Effect, Stream } from "effect"
|
|
6794
7042
|
*
|
|
@@ -6806,14 +7054,15 @@ export const runDrain = self => Channel.runDrain(self.channel);
|
|
|
6806
7054
|
* // [1, 2, 3]
|
|
6807
7055
|
* ```
|
|
6808
7056
|
*
|
|
7057
|
+
* @category destructors
|
|
6809
7058
|
* @since 2.0.0
|
|
6810
|
-
* @category Destructors
|
|
6811
7059
|
*/
|
|
6812
7060
|
export const toPull = self => Channel.toPull(self.channel);
|
|
6813
7061
|
/**
|
|
6814
7062
|
* Concatenates all emitted strings into a single string.
|
|
6815
7063
|
*
|
|
6816
|
-
*
|
|
7064
|
+
* **Example** (Joining strings from a stream)
|
|
7065
|
+
*
|
|
6817
7066
|
* ```ts
|
|
6818
7067
|
* import { Console, Effect, Stream } from "effect"
|
|
6819
7068
|
*
|
|
@@ -6827,14 +7076,15 @@ export const toPull = self => Channel.toPull(self.channel);
|
|
|
6827
7076
|
* // Hello World!
|
|
6828
7077
|
* ```
|
|
6829
7078
|
*
|
|
7079
|
+
* @category destructors
|
|
6830
7080
|
* @since 2.0.0
|
|
6831
|
-
* @category Destructors
|
|
6832
7081
|
*/
|
|
6833
7082
|
export const mkString = self => Channel.runFold(self.channel, () => "", (acc, chunk) => acc + chunk.join(""));
|
|
6834
7083
|
/**
|
|
6835
7084
|
* Concatenates the stream's `Uint8Array` chunks into a single `Uint8Array`.
|
|
6836
7085
|
*
|
|
6837
|
-
*
|
|
7086
|
+
* **Example** (Joining Uint8Array chunks)
|
|
7087
|
+
*
|
|
6838
7088
|
* ```ts
|
|
6839
7089
|
* import { Console, Effect, Stream } from "effect"
|
|
6840
7090
|
*
|
|
@@ -6848,8 +7098,8 @@ export const mkString = self => Channel.runFold(self.channel, () => "", (acc, ch
|
|
|
6848
7098
|
* // [1, 2, 3, 4]
|
|
6849
7099
|
* ```
|
|
6850
7100
|
*
|
|
7101
|
+
* @category destructors
|
|
6851
7102
|
* @since 4.0.0
|
|
6852
|
-
* @category Destructors
|
|
6853
7103
|
*/
|
|
6854
7104
|
export const mkUint8Array = self => Effect.map(Channel.runFold(self.channel, () => ({
|
|
6855
7105
|
bytes: 0,
|
|
@@ -6878,7 +7128,8 @@ export const mkUint8Array = self => Effect.map(Channel.runFold(self.channel, ()
|
|
|
6878
7128
|
*
|
|
6879
7129
|
* See https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream.
|
|
6880
7130
|
*
|
|
6881
|
-
*
|
|
7131
|
+
* **Example** (Converting to a ReadableStream with services)
|
|
7132
|
+
*
|
|
6882
7133
|
* ```ts
|
|
6883
7134
|
* import { Context, Stream } from "effect"
|
|
6884
7135
|
*
|
|
@@ -6886,8 +7137,8 @@ export const mkUint8Array = self => Effect.map(Channel.runFold(self.channel, ()
|
|
|
6886
7137
|
* const readableStream = Stream.toReadableStreamWith(stream, Context.empty())
|
|
6887
7138
|
* ```
|
|
6888
7139
|
*
|
|
6889
|
-
* @
|
|
6890
|
-
* @
|
|
7140
|
+
* @category destructors
|
|
7141
|
+
* @since 4.0.0
|
|
6891
7142
|
*/
|
|
6892
7143
|
export const toReadableStreamWith = /*#__PURE__*/dual(args => isStream(args[0]), (self, context, options) => {
|
|
6893
7144
|
let currentResolve = undefined;
|
|
@@ -6928,7 +7179,8 @@ export const toReadableStreamWith = /*#__PURE__*/dual(args => isStream(args[0]),
|
|
|
6928
7179
|
*
|
|
6929
7180
|
* See https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream.
|
|
6930
7181
|
*
|
|
6931
|
-
*
|
|
7182
|
+
* **Example** (Converting a stream to a ReadableStream)
|
|
7183
|
+
*
|
|
6932
7184
|
* ```ts
|
|
6933
7185
|
* import { Stream } from "effect"
|
|
6934
7186
|
*
|
|
@@ -6936,8 +7188,8 @@ export const toReadableStreamWith = /*#__PURE__*/dual(args => isStream(args[0]),
|
|
|
6936
7188
|
* const reader = readableStream.getReader()
|
|
6937
7189
|
* ```
|
|
6938
7190
|
*
|
|
7191
|
+
* @category destructors
|
|
6939
7192
|
* @since 2.0.0
|
|
6940
|
-
* @category Destructors
|
|
6941
7193
|
*/
|
|
6942
7194
|
export const toReadableStream = /*#__PURE__*/dual(args => isStream(args[0]), (self, options) => toReadableStreamWith(self, Context.empty(), options));
|
|
6943
7195
|
/**
|
|
@@ -6945,7 +7197,8 @@ export const toReadableStream = /*#__PURE__*/dual(args => isStream(args[0]), (se
|
|
|
6945
7197
|
*
|
|
6946
7198
|
* See https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream.
|
|
6947
7199
|
*
|
|
6948
|
-
*
|
|
7200
|
+
* **Example** (Creating a ReadableStream effect)
|
|
7201
|
+
*
|
|
6949
7202
|
* ```ts
|
|
6950
7203
|
* import { Console, Effect, Stream } from "effect"
|
|
6951
7204
|
*
|
|
@@ -6959,14 +7212,15 @@ export const toReadableStream = /*#__PURE__*/dual(args => isStream(args[0]), (se
|
|
|
6959
7212
|
* Effect.runPromise(effect)
|
|
6960
7213
|
* ```
|
|
6961
7214
|
*
|
|
7215
|
+
* @category destructors
|
|
6962
7216
|
* @since 2.0.0
|
|
6963
|
-
* @category Destructors
|
|
6964
7217
|
*/
|
|
6965
7218
|
export const toReadableStreamEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self, options) => Effect.map(Effect.context(), context => toReadableStreamWith(self, context, options)));
|
|
6966
7219
|
/**
|
|
6967
7220
|
* Converts the stream to an `AsyncIterable` using the provided services.
|
|
6968
7221
|
*
|
|
6969
|
-
*
|
|
7222
|
+
* **Example** (Converting to an AsyncIterable with services)
|
|
7223
|
+
*
|
|
6970
7224
|
* ```ts
|
|
6971
7225
|
* import { Context, Stream } from "effect"
|
|
6972
7226
|
*
|
|
@@ -6978,12 +7232,15 @@ export const toReadableStreamEffect = /*#__PURE__*/dual(args => isStream(args[0]
|
|
|
6978
7232
|
* for await (const value of iterable) {
|
|
6979
7233
|
* results.push(value)
|
|
6980
7234
|
* }
|
|
6981
|
-
*
|
|
7235
|
+
* console.log(results)
|
|
6982
7236
|
* }
|
|
7237
|
+
*
|
|
7238
|
+
* collect()
|
|
7239
|
+
* // [ 1, 2, 3 ]
|
|
6983
7240
|
* ```
|
|
6984
7241
|
*
|
|
6985
|
-
* @
|
|
6986
|
-
* @
|
|
7242
|
+
* @category destructors
|
|
7243
|
+
* @since 4.0.0
|
|
6987
7244
|
*/
|
|
6988
7245
|
export const toAsyncIterableWith = /*#__PURE__*/dual(2, (self, context) => ({
|
|
6989
7246
|
[Symbol.asyncIterator]() {
|
|
@@ -7024,9 +7281,10 @@ export const toAsyncIterableWith = /*#__PURE__*/dual(2, (self, context) => ({
|
|
|
7024
7281
|
/**
|
|
7025
7282
|
* Creates an effect that yields an `AsyncIterable` using the current services.
|
|
7026
7283
|
*
|
|
7027
|
-
*
|
|
7284
|
+
* **Example** (Creating an AsyncIterable effect)
|
|
7285
|
+
*
|
|
7028
7286
|
* ```ts
|
|
7029
|
-
* import {
|
|
7287
|
+
* import { Effect, Stream } from "effect"
|
|
7030
7288
|
*
|
|
7031
7289
|
* const stream = Stream.make(1, 2, 3)
|
|
7032
7290
|
*
|
|
@@ -7039,41 +7297,42 @@ export const toAsyncIterableWith = /*#__PURE__*/dual(2, (self, context) => ({
|
|
|
7039
7297
|
* }
|
|
7040
7298
|
* return collected
|
|
7041
7299
|
* })
|
|
7042
|
-
* yield*
|
|
7300
|
+
* yield* Effect.sync(() => console.log(values))
|
|
7043
7301
|
* })
|
|
7044
7302
|
*
|
|
7045
7303
|
* Effect.runPromise(program)
|
|
7046
|
-
*
|
|
7304
|
+
* // [ 1, 2, 3 ]
|
|
7047
7305
|
* ```
|
|
7048
7306
|
*
|
|
7049
|
-
* @
|
|
7050
|
-
* @
|
|
7307
|
+
* @category destructors
|
|
7308
|
+
* @since 3.15.0
|
|
7051
7309
|
*/
|
|
7052
7310
|
export const toAsyncIterableEffect = self => Effect.map(Effect.context(), context => toAsyncIterableWith(self, context));
|
|
7053
7311
|
/**
|
|
7054
7312
|
* Converts a stream to an `AsyncIterable` for `for await...of` consumption.
|
|
7055
7313
|
*
|
|
7056
|
-
*
|
|
7314
|
+
* **Example** (Converting to an async iterable)
|
|
7315
|
+
*
|
|
7057
7316
|
* ```ts
|
|
7058
|
-
* import {
|
|
7317
|
+
* import { Stream } from "effect"
|
|
7059
7318
|
*
|
|
7060
7319
|
* const stream = Stream.make(1, 2, 3)
|
|
7061
7320
|
*
|
|
7062
|
-
* const
|
|
7321
|
+
* const collect = async () => {
|
|
7063
7322
|
* const iterable = Stream.toAsyncIterable(stream)
|
|
7064
|
-
* const
|
|
7065
|
-
*
|
|
7066
|
-
*
|
|
7067
|
-
*
|
|
7068
|
-
*
|
|
7069
|
-
*
|
|
7070
|
-
*
|
|
7071
|
-
*
|
|
7072
|
-
*
|
|
7323
|
+
* const values: Array<number> = []
|
|
7324
|
+
* for await (const value of iterable) {
|
|
7325
|
+
* values.push(value)
|
|
7326
|
+
* }
|
|
7327
|
+
* console.log(values)
|
|
7328
|
+
* }
|
|
7329
|
+
*
|
|
7330
|
+
* collect()
|
|
7331
|
+
* // [ 1, 2, 3 ]
|
|
7073
7332
|
* ```
|
|
7074
7333
|
*
|
|
7075
|
-
* @
|
|
7076
|
-
* @
|
|
7334
|
+
* @category destructors
|
|
7335
|
+
* @since 3.15.0
|
|
7077
7336
|
*/
|
|
7078
7337
|
export const toAsyncIterable = self => toAsyncIterableWith(self, Context.empty());
|
|
7079
7338
|
/**
|
|
@@ -7082,7 +7341,8 @@ export const toAsyncIterable = self => toAsyncIterableWith(self, Context.empty()
|
|
|
7082
7341
|
* `shutdownOnEnd` controls whether the PubSub is shut down when the stream ends.
|
|
7083
7342
|
* It only shuts down when set to `true`.
|
|
7084
7343
|
*
|
|
7085
|
-
*
|
|
7344
|
+
* **Example** (Running a stream into a PubSub)
|
|
7345
|
+
*
|
|
7086
7346
|
* ```ts
|
|
7087
7347
|
* import { Console, Effect, PubSub, Stream } from "effect"
|
|
7088
7348
|
*
|
|
@@ -7104,8 +7364,8 @@ export const toAsyncIterable = self => toAsyncIterableWith(self, Context.empty()
|
|
|
7104
7364
|
* //=> 2
|
|
7105
7365
|
* ```
|
|
7106
7366
|
*
|
|
7367
|
+
* @category destructors
|
|
7107
7368
|
* @since 2.0.0
|
|
7108
|
-
* @category Destructors
|
|
7109
7369
|
*/
|
|
7110
7370
|
export const runIntoPubSub = /*#__PURE__*/dual(args => isStream(args[0]), (self, pubsub, options) => Channel.runIntoPubSubArray(self.channel, pubsub, options));
|
|
7111
7371
|
/**
|
|
@@ -7114,7 +7374,8 @@ export const runIntoPubSub = /*#__PURE__*/dual(args => isStream(args[0]), (self,
|
|
|
7114
7374
|
* `shutdownOnEnd` indicates whether the PubSub should be shut down when the
|
|
7115
7375
|
* stream ends. By default this is `true`.
|
|
7116
7376
|
*
|
|
7117
|
-
*
|
|
7377
|
+
* **Example** (Converting a stream to a PubSub for concurrent consumption)
|
|
7378
|
+
*
|
|
7118
7379
|
* ```ts
|
|
7119
7380
|
* import { Console, Effect, PubSub, Stream } from "effect"
|
|
7120
7381
|
*
|
|
@@ -7129,8 +7390,8 @@ export const runIntoPubSub = /*#__PURE__*/dual(args => isStream(args[0]), (self,
|
|
|
7129
7390
|
* }))
|
|
7130
7391
|
* ```
|
|
7131
7392
|
*
|
|
7393
|
+
* @category destructors
|
|
7132
7394
|
* @since 2.0.0
|
|
7133
|
-
* @category Destructors
|
|
7134
7395
|
*/
|
|
7135
7396
|
export const toPubSub = /*#__PURE__*/dual(2, (self, options) => Channel.toPubSubArray(self.channel, options));
|
|
7136
7397
|
/**
|
|
@@ -7138,7 +7399,8 @@ export const toPubSub = /*#__PURE__*/dual(2, (self, options) => Channel.toPubSub
|
|
|
7138
7399
|
*
|
|
7139
7400
|
* `Take` values include the stream's end and failure signals.
|
|
7140
7401
|
*
|
|
7141
|
-
*
|
|
7402
|
+
* **Example** (Converting to a PubSub of takes)
|
|
7403
|
+
*
|
|
7142
7404
|
* ```ts
|
|
7143
7405
|
* import { Console, Effect, PubSub, Stream } from "effect"
|
|
7144
7406
|
*
|
|
@@ -7155,14 +7417,20 @@ export const toPubSub = /*#__PURE__*/dual(2, (self, options) => Channel.toPubSub
|
|
|
7155
7417
|
* })
|
|
7156
7418
|
* ```
|
|
7157
7419
|
*
|
|
7420
|
+
* @category destructors
|
|
7158
7421
|
* @since 4.0.0
|
|
7159
|
-
* @category Destructors
|
|
7160
7422
|
*/
|
|
7161
7423
|
export const toPubSubTake = /*#__PURE__*/dual(2, (self, options) => Channel.toPubSubTake(self.channel, options));
|
|
7162
7424
|
/**
|
|
7163
|
-
*
|
|
7425
|
+
* Creates a scoped dequeue that is fed by the stream for concurrent
|
|
7426
|
+
* consumption.
|
|
7427
|
+
*
|
|
7428
|
+
* Elements are offered to the queue as the stream runs. Stream completion is
|
|
7429
|
+
* signaled with `Cause.Done`, stream failures fail the queue, and the queue is
|
|
7430
|
+
* shut down when the surrounding scope closes.
|
|
7431
|
+
*
|
|
7432
|
+
* **Example** (Converting a stream to a Queue for concurrent consumption)
|
|
7164
7433
|
*
|
|
7165
|
-
* @example
|
|
7166
7434
|
* ```ts
|
|
7167
7435
|
* import { Effect, Queue, Stream } from "effect"
|
|
7168
7436
|
*
|
|
@@ -7173,15 +7441,16 @@ export const toPubSubTake = /*#__PURE__*/dual(2, (self, options) => Channel.toPu
|
|
|
7173
7441
|
* })
|
|
7174
7442
|
* ```
|
|
7175
7443
|
*
|
|
7444
|
+
* @category destructors
|
|
7176
7445
|
* @since 2.0.0
|
|
7177
|
-
* @category Destructors
|
|
7178
7446
|
*/
|
|
7179
7447
|
export const toQueue = /*#__PURE__*/dual(2, (self, options) => Channel.toQueueArray(self.channel, options));
|
|
7180
7448
|
/**
|
|
7181
7449
|
* Runs the stream, offering each element to the provided queue and ending it
|
|
7182
7450
|
* with `Cause.Done` when the stream completes.
|
|
7183
7451
|
*
|
|
7184
|
-
*
|
|
7452
|
+
* **Example** (Running a stream into a queue)
|
|
7453
|
+
*
|
|
7185
7454
|
* ```ts
|
|
7186
7455
|
* import { Cause, Effect, Queue, Stream } from "effect"
|
|
7187
7456
|
*
|
|
@@ -7203,8 +7472,8 @@ export const toQueue = /*#__PURE__*/dual(2, (self, options) => Channel.toQueueAr
|
|
|
7203
7472
|
* })
|
|
7204
7473
|
* ```
|
|
7205
7474
|
*
|
|
7475
|
+
* @category destructors
|
|
7206
7476
|
* @since 2.0.0
|
|
7207
|
-
* @category Destructors
|
|
7208
7477
|
*/
|
|
7209
7478
|
export const runIntoQueue = /*#__PURE__*/dual(2, (self, queue) => Channel.runIntoQueueArray(self.channel, queue));
|
|
7210
7479
|
//# sourceMappingURL=Stream.js.map
|