effect 4.0.0-beta.2 → 4.0.0-beta.21
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 +127 -299
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +102 -62
- package/dist/Array.js.map +1 -1
- package/dist/Cache.d.ts +2 -2
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +6 -5
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +1 -1
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Channel.d.ts +116 -30
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +82 -37
- package/dist/Channel.js.map +1 -1
- package/dist/Chunk.d.ts +54 -247
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +36 -67
- package/dist/Chunk.js.map +1 -1
- package/dist/Combiner.d.ts +280 -13
- package/dist/Combiner.d.ts.map +1 -1
- package/dist/Combiner.js +198 -7
- package/dist/Combiner.js.map +1 -1
- package/dist/Config.d.ts +165 -9
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +62 -7
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +1 -1
- package/dist/Cron.d.ts +1 -1
- package/dist/Data.d.ts +534 -365
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js +132 -79
- package/dist/Data.js.map +1 -1
- package/dist/DateTime.d.ts +23 -161
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +6 -51
- package/dist/DateTime.js.map +1 -1
- package/dist/Duration.d.ts +12 -12
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +12 -12
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +829 -692
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +263 -251
- package/dist/Effect.js.map +1 -1
- package/dist/Encoding.d.ts +194 -0
- package/dist/Encoding.d.ts.map +1 -0
- package/dist/Encoding.js +352 -0
- package/dist/Encoding.js.map +1 -0
- package/dist/Equal.d.ts +276 -109
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +124 -48
- package/dist/Equal.js.map +1 -1
- package/dist/ErrorReporter.d.ts +376 -0
- package/dist/ErrorReporter.d.ts.map +1 -0
- package/dist/ErrorReporter.js +246 -0
- package/dist/ErrorReporter.js.map +1 -0
- package/dist/Fiber.d.ts +2 -2
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js.map +1 -1
- package/dist/FileSystem.d.ts +1 -1
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +5 -5
- package/dist/FileSystem.js.map +1 -1
- package/dist/Filter.d.ts +30 -34
- package/dist/Filter.d.ts.map +1 -1
- package/dist/Filter.js +15 -13
- package/dist/Filter.js.map +1 -1
- package/dist/Formatter.d.ts +131 -47
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js +229 -51
- package/dist/Formatter.js.map +1 -1
- package/dist/Graph.d.ts +1 -1
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +5 -8
- package/dist/Graph.js.map +1 -1
- package/dist/HashMap.d.ts +15 -14
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashMap.js +4 -4
- package/dist/HashMap.js.map +1 -1
- package/dist/Iterable.d.ts +40 -39
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +94 -22
- package/dist/Iterable.js.map +1 -1
- package/dist/JsonSchema.d.ts +299 -10
- package/dist/JsonSchema.d.ts.map +1 -1
- package/dist/JsonSchema.js +323 -4
- package/dist/JsonSchema.js.map +1 -1
- package/dist/Latch.d.ts +109 -0
- package/dist/Latch.d.ts.map +1 -0
- package/dist/Latch.js +72 -0
- package/dist/Latch.js.map +1 -0
- package/dist/Layer.d.ts +9 -9
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +4 -4
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LogLevel.d.ts +32 -0
- package/dist/LogLevel.d.ts.map +1 -1
- package/dist/LogLevel.js +28 -100
- package/dist/LogLevel.js.map +1 -1
- package/dist/Logger.d.ts +29 -95
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +2 -3
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.d.ts +1 -1
- package/dist/ManagedRuntime.js +1 -1
- package/dist/Metric.d.ts +2 -2
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +1 -1
- package/dist/Metric.js.map +1 -1
- package/dist/Optic.d.ts +947 -18
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js +454 -5
- package/dist/Optic.js.map +1 -1
- package/dist/Option.d.ts +22 -15
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +14 -7
- package/dist/Option.js.map +1 -1
- package/dist/Pipeable.d.ts +17 -0
- package/dist/Pipeable.d.ts.map +1 -1
- package/dist/Pipeable.js +19 -1
- package/dist/Pipeable.js.map +1 -1
- package/dist/PlatformError.d.ts +10 -9
- package/dist/PlatformError.d.ts.map +1 -1
- package/dist/PlatformError.js +2 -2
- package/dist/PlatformError.js.map +1 -1
- package/dist/Pool.d.ts +6 -4
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +7 -5
- package/dist/Pool.js.map +1 -1
- package/dist/PubSub.d.ts +3 -2
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +3 -2
- package/dist/PubSub.js.map +1 -1
- package/dist/Pull.d.ts.map +1 -1
- package/dist/Pull.js +1 -1
- package/dist/Pull.js.map +1 -1
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +0 -1
- package/dist/Queue.js.map +1 -1
- package/dist/Random.d.ts +35 -1
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +46 -12
- package/dist/Random.js.map +1 -1
- package/dist/RcMap.d.ts +2 -2
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +1 -1
- package/dist/RcMap.js.map +1 -1
- package/dist/RcRef.d.ts +1 -1
- package/dist/RcRef.d.ts.map +1 -1
- package/dist/Record.d.ts +24 -120
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +21 -41
- package/dist/Record.js.map +1 -1
- package/dist/Reducer.d.ts +166 -7
- package/dist/Reducer.d.ts.map +1 -1
- package/dist/Reducer.js +135 -1
- package/dist/Reducer.js.map +1 -1
- package/dist/References.d.ts +3 -3
- package/dist/References.d.ts.map +1 -1
- package/dist/Request.d.ts +1 -1
- package/dist/Request.d.ts.map +1 -1
- package/dist/Request.js +2 -1
- package/dist/Request.js.map +1 -1
- package/dist/RequestResolver.d.ts +6 -26
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/RequestResolver.js +0 -20
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Result.d.ts +12 -0
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +12 -0
- package/dist/Result.js.map +1 -1
- package/dist/Schedule.d.ts +47 -20
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +94 -34
- package/dist/Schedule.js.map +1 -1
- package/dist/Schema.d.ts +266 -50
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +426 -74
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +7 -6
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +2 -2
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +12 -14
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaParser.d.ts +5 -0
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +10 -0
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +44 -43
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +43 -24
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +107 -3
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +159 -4
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/ScopedCache.d.ts +2 -2
- package/dist/ScopedCache.d.ts.map +1 -1
- package/dist/ScopedCache.js +1 -1
- package/dist/ScopedCache.js.map +1 -1
- package/dist/Semaphore.d.ts +211 -0
- package/dist/Semaphore.d.ts.map +1 -0
- package/dist/{PartitionedSemaphore.js → Semaphore.js} +97 -13
- package/dist/Semaphore.js.map +1 -0
- package/dist/ServiceMap.d.ts +39 -30
- package/dist/ServiceMap.d.ts.map +1 -1
- package/dist/ServiceMap.js +3 -3
- package/dist/ServiceMap.js.map +1 -1
- package/dist/Sink.d.ts +13 -13
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +53 -6
- package/dist/Sink.js.map +1 -1
- package/dist/Stream.d.ts +235 -423
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +124 -77
- package/dist/Stream.js.map +1 -1
- package/dist/Struct.d.ts +16 -0
- package/dist/Struct.d.ts.map +1 -1
- package/dist/Struct.js +22 -0
- package/dist/Struct.js.map +1 -1
- package/dist/SubscriptionRef.d.ts +2 -1
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +2 -1
- package/dist/SubscriptionRef.js.map +1 -1
- package/dist/SynchronizedRef.d.ts +2 -1
- package/dist/SynchronizedRef.d.ts.map +1 -1
- package/dist/SynchronizedRef.js +2 -1
- package/dist/SynchronizedRef.js.map +1 -1
- package/dist/Trie.d.ts +18 -17
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Trie.js +5 -5
- package/dist/Trie.js.map +1 -1
- package/dist/TxChunk.d.ts +37 -37
- package/dist/TxChunk.d.ts.map +1 -1
- package/dist/TxChunk.js +3 -3
- package/dist/TxChunk.js.map +1 -1
- package/dist/TxDeferred.d.ts +328 -0
- package/dist/TxDeferred.d.ts.map +1 -0
- package/dist/TxDeferred.js +196 -0
- package/dist/TxDeferred.js.map +1 -0
- package/dist/TxHashMap.d.ts +84 -83
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js +24 -24
- package/dist/TxHashMap.js.map +1 -1
- package/dist/TxHashSet.d.ts +35 -35
- package/dist/TxHashSet.d.ts.map +1 -1
- package/dist/TxHashSet.js +14 -14
- package/dist/TxHashSet.js.map +1 -1
- package/dist/TxPriorityQueue.d.ts +609 -0
- package/dist/TxPriorityQueue.d.ts.map +1 -0
- package/dist/TxPriorityQueue.js +415 -0
- package/dist/TxPriorityQueue.js.map +1 -0
- package/dist/TxPubSub.d.ts +585 -0
- package/dist/TxPubSub.d.ts.map +1 -0
- package/dist/TxPubSub.js +521 -0
- package/dist/TxPubSub.js.map +1 -0
- package/dist/TxQueue.d.ts +32 -32
- package/dist/TxQueue.d.ts.map +1 -1
- package/dist/TxQueue.js +26 -26
- package/dist/TxQueue.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +523 -0
- package/dist/TxReentrantLock.d.ts.map +1 -0
- package/dist/TxReentrantLock.js +504 -0
- package/dist/TxReentrantLock.js.map +1 -0
- package/dist/TxRef.d.ts +34 -34
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +21 -14
- package/dist/TxRef.js.map +1 -1
- package/dist/TxSemaphore.d.ts +8 -8
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +7 -7
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/TxSubscriptionRef.d.ts +508 -0
- package/dist/TxSubscriptionRef.d.ts.map +1 -0
- package/dist/TxSubscriptionRef.js +293 -0
- package/dist/TxSubscriptionRef.js.map +1 -0
- package/dist/Types.d.ts +84 -6
- package/dist/Types.d.ts.map +1 -1
- package/dist/index.d.ts +591 -20
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +591 -20
- package/dist/index.js.map +1 -1
- package/dist/internal/core.js +11 -3
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/dateTime.js +3 -11
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/effect.js +263 -99
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/hashMap.js +5 -4
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/random.d.ts +2 -0
- package/dist/internal/random.d.ts.map +1 -0
- package/dist/internal/random.js +13 -0
- package/dist/internal/random.js.map +1 -0
- package/dist/internal/rcRef.js +3 -2
- package/dist/internal/rcRef.js.map +1 -1
- package/dist/internal/request.js +2 -2
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/schema/annotations.js +2 -0
- package/dist/internal/schema/annotations.js.map +1 -1
- package/dist/internal/schema/schema.js +1 -0
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/internal/trie.js +5 -4
- package/dist/internal/trie.js.map +1 -1
- package/dist/testing/TestClock.d.ts +7 -6
- package/dist/testing/TestClock.d.ts.map +1 -1
- package/dist/testing/TestClock.js +6 -4
- package/dist/testing/TestClock.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +8 -8
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +128 -48
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +11 -12
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +3 -3
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +4 -3
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +4 -2
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +86 -14
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpSchema.d.ts +163 -87
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +49 -12
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +1 -1
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +35 -7
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Model.d.ts +25 -7
- package/dist/unstable/ai/Model.d.ts.map +1 -1
- package/dist/unstable/ai/Model.js +22 -6
- package/dist/unstable/ai/Model.js.map +1 -1
- package/dist/unstable/ai/Prompt.d.ts +20 -20
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Response.d.ts +26 -26
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js +1 -1
- package/dist/unstable/ai/Response.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +19 -3
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +14 -9
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/ai/index.d.ts +1 -1
- package/dist/unstable/ai/index.js +1 -1
- package/dist/unstable/cli/CliError.d.ts +5 -5
- package/dist/unstable/cli/CliOutput.js +59 -6
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +276 -19
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +234 -36
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +125 -0
- package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -0
- package/dist/unstable/cli/GlobalFlag.js +118 -0
- package/dist/unstable/cli/GlobalFlag.js.map +1 -0
- package/dist/unstable/cli/HelpDoc.d.ts +70 -2
- package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
- package/dist/unstable/cli/index.d.ts +4 -0
- package/dist/unstable/cli/index.d.ts.map +1 -1
- package/dist/unstable/cli/index.js +4 -0
- package/dist/unstable/cli/index.js.map +1 -1
- package/dist/unstable/cli/internal/command.d.ts +17 -8
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.js +32 -23
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/completions/CommandDescriptor.js +7 -2
- package/dist/unstable/cli/internal/completions/CommandDescriptor.js.map +1 -1
- package/dist/unstable/cli/internal/help.d.ts +33 -0
- package/dist/unstable/cli/internal/help.d.ts.map +1 -0
- package/dist/unstable/cli/internal/help.js +107 -0
- package/dist/unstable/cli/internal/help.js.map +1 -0
- package/dist/unstable/cli/internal/parser.js +29 -36
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cluster/ClusterCron.d.ts +1 -1
- package/dist/unstable/cluster/ClusterCron.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterCron.js +1 -1
- package/dist/unstable/cluster/ClusterCron.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +4 -3
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +7 -6
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/EntityResource.d.ts +2 -2
- package/dist/unstable/cluster/EntityResource.d.ts.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts +1 -1
- package/dist/unstable/cluster/K8sHttpClient.d.ts +1 -1
- package/dist/unstable/cluster/K8sHttpClient.js +4 -4
- package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +10 -10
- package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/MessageStorage.js +2 -1
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts +6 -6
- package/dist/unstable/cluster/Runner.d.ts +1 -1
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +4 -3
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts +2 -2
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +9 -7
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +21 -21
- package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.js +20 -20
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +5 -4
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/cluster/internal/entityReaper.js +2 -1
- package/dist/unstable/cluster/internal/entityReaper.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceRef.js +2 -1
- package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.d.ts +36 -36
- package/dist/unstable/encoding/Msgpack.d.ts +1 -1
- package/dist/unstable/encoding/Ndjson.d.ts +1 -1
- package/dist/unstable/encoding/Sse.d.ts +4 -4
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.js +1 -1
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +2 -2
- package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLog.js +2 -1
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +6 -6
- package/dist/unstable/http/Cookies.d.ts +3 -3
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +2 -2
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts.map +1 -1
- package/dist/unstable/http/Headers.js +27 -10
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpBody.d.ts +17 -2
- package/dist/unstable/http/HttpBody.d.ts.map +1 -1
- package/dist/unstable/http/HttpBody.js +28 -1
- package/dist/unstable/http/HttpBody.js.map +1 -1
- package/dist/unstable/http/HttpClient.d.ts +37 -13
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +4 -4
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientError.d.ts +7 -7
- package/dist/unstable/http/HttpClientRequest.d.ts +27 -11
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +15 -3
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts +3 -8
- package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
- package/dist/unstable/http/HttpEffect.js +42 -56
- package/dist/unstable/http/HttpEffect.js.map +1 -1
- package/dist/unstable/http/HttpMethod.d.ts +4 -4
- package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
- package/dist/unstable/http/HttpMethod.js +3 -3
- package/dist/unstable/http/HttpMethod.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts +1 -6
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +8 -17
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +20 -33
- package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerError.js +37 -44
- package/dist/unstable/http/HttpServerError.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.d.ts +2 -2
- package/dist/unstable/http/HttpServerRespondable.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.js +5 -5
- package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +2 -1
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +3 -1
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/Multipart.d.ts +3 -3
- package/dist/unstable/http/UrlParams.d.ts +14 -6
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +1 -1
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/http/internal/preResponseHandler.d.ts +2 -0
- package/dist/unstable/http/internal/preResponseHandler.d.ts.map +1 -0
- package/dist/unstable/http/internal/preResponseHandler.js +10 -0
- package/dist/unstable/http/internal/preResponseHandler.js.map +1 -0
- package/dist/unstable/httpapi/HttpApi.d.ts +3 -3
- package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +11 -5
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +23 -12
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +7 -2
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +3 -3
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +31 -44
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.js +15 -24
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +11 -0
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.js +29 -9
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.d.ts +3 -3
- package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +4 -4
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts +6 -0
- package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts +2 -2
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +32 -21
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/observability/Otlp.d.ts +12 -12
- package/dist/unstable/observability/Otlp.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts +2 -2
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +1 -1
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.d.ts +4 -4
- package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpLogger.js +7 -4
- package/dist/unstable/observability/OtlpLogger.js.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts +4 -4
- package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpTracer.d.ts +4 -4
- package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts +1 -1
- package/dist/unstable/persistence/KeyValueStore.js +6 -6
- package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
- package/dist/unstable/persistence/Persistable.d.ts +2 -2
- package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedCache.d.ts +6 -5
- package/dist/unstable/persistence/PersistedCache.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedCache.js +2 -1
- package/dist/unstable/persistence/PersistedCache.js.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts +12 -12
- package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.js +12 -11
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/persistence/Persistence.d.ts +1 -1
- package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistence.js +2 -2
- package/dist/unstable/persistence/Persistence.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +3 -3
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +1 -1
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/process/ChildProcess.d.ts +5 -128
- package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcess.js +1 -65
- package/dist/unstable/process/ChildProcess.js.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.d.ts +45 -7
- package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js +21 -1
- package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +10 -10
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +16 -13
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +8 -8
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.js +3 -3
- package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.d.ts +6 -0
- package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +24 -7
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.js +1 -1
- package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
- package/dist/unstable/reactivity/Hydration.d.ts +39 -0
- package/dist/unstable/reactivity/Hydration.d.ts.map +1 -0
- package/dist/unstable/reactivity/Hydration.js +76 -0
- package/dist/unstable/reactivity/Hydration.js.map +1 -0
- package/dist/unstable/reactivity/index.d.ts +4 -0
- package/dist/unstable/reactivity/index.d.ts.map +1 -1
- package/dist/unstable/reactivity/index.js +4 -0
- package/dist/unstable/reactivity/index.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +4 -4
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts +5 -26
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +6 -13
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcGroup.d.ts +2 -2
- package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcGroup.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts +3 -3
- package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts +13 -0
- package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSchema.js +14 -0
- package/dist/unstable/rpc/RpcSchema.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +34 -9
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +0 -7
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +15 -15
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/rpc/Utils.d.ts.map +1 -1
- package/dist/unstable/rpc/Utils.js +2 -1
- package/dist/unstable/rpc/Utils.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts +1 -1
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +3 -3
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.js +3 -3
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +4 -4
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +6 -5
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/socket/SocketServer.d.ts +3 -3
- package/dist/unstable/sql/Migrator.d.ts +1 -1
- package/dist/unstable/sql/SqlClient.d.ts +1 -1
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlError.d.ts +14 -14
- package/dist/unstable/sql/SqlError.d.ts.map +1 -1
- package/dist/unstable/sql/SqlError.js +9 -3
- package/dist/unstable/sql/SqlError.js.map +1 -1
- package/dist/unstable/sql/SqlModel.d.ts +2 -2
- package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
- package/dist/unstable/sql/SqlModel.js +3 -3
- package/dist/unstable/sql/SqlModel.js.map +1 -1
- package/dist/unstable/sql/SqlSchema.d.ts +16 -5
- package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
- package/dist/unstable/sql/SqlSchema.js +17 -7
- package/dist/unstable/sql/SqlSchema.js.map +1 -1
- package/dist/unstable/sql/Statement.js +0 -1
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/workers/Worker.d.ts.map +1 -1
- package/dist/unstable/workers/Worker.js +2 -1
- package/dist/unstable/workers/Worker.js.map +1 -1
- package/dist/unstable/workflow/DurableClock.d.ts +3 -3
- package/dist/unstable/workflow/DurableClock.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableClock.js +3 -3
- package/dist/unstable/workflow/DurableClock.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.js +2 -2
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +3 -3
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js +1 -1
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +12 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +137 -1
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/package.json +2 -2
- package/src/Array.ts +190 -342
- package/src/Cache.ts +9 -8
- package/src/Cause.ts +1 -1
- package/src/Channel.ts +554 -138
- package/src/Chunk.ts +81 -268
- package/src/Combiner.ts +280 -13
- package/src/Config.ts +183 -21
- package/src/Data.ts +538 -374
- package/src/DateTime.ts +24 -164
- package/src/Duration.ts +15 -15
- package/src/Effect.ts +991 -800
- package/src/Encoding.ts +879 -0
- package/src/Equal.ts +278 -111
- package/src/ErrorReporter.ts +459 -0
- package/src/Fiber.ts +9 -2
- package/src/FileSystem.ts +7 -8
- package/src/Filter.ts +48 -58
- package/src/Formatter.ts +253 -51
- package/src/Graph.ts +24 -11
- package/src/HashMap.ts +15 -14
- package/src/Iterable.ts +105 -50
- package/src/JsonSchema.ts +383 -10
- package/src/Latch.ts +112 -0
- package/src/Layer.ts +11 -15
- package/src/LayerMap.ts +5 -5
- package/src/LogLevel.ts +37 -0
- package/src/Logger.ts +33 -100
- package/src/ManagedRuntime.ts +1 -1
- package/src/Metric.ts +4 -4
- package/src/Optic.ts +948 -19
- package/src/Option.ts +30 -20
- package/src/Pipeable.ts +32 -1
- package/src/PlatformError.ts +5 -5
- package/src/Pool.ts +13 -11
- package/src/PubSub.ts +10 -9
- package/src/Pull.ts +1 -1
- package/src/Queue.ts +0 -1
- package/src/Random.ts +51 -14
- package/src/RcMap.ts +5 -5
- package/src/RcRef.ts +1 -1
- package/src/Record.ts +43 -152
- package/src/Reducer.ts +166 -7
- package/src/References.ts +4 -4
- package/src/Request.ts +3 -2
- package/src/RequestResolver.ts +9 -29
- package/src/Result.ts +13 -0
- package/src/Schedule.ts +318 -160
- package/src/Schema.ts +661 -116
- package/src/SchemaAST.ts +7 -6
- package/src/SchemaGetter.ts +12 -14
- package/src/SchemaParser.ts +11 -0
- package/src/SchemaRepresentation.ts +43 -24
- package/src/SchemaTransformation.ts +189 -4
- package/src/ScopedCache.ts +3 -3
- package/src/Semaphore.ts +356 -0
- package/src/ServiceMap.ts +47 -38
- package/src/Sink.ts +78 -26
- package/src/Stream.ts +566 -601
- package/src/Struct.ts +26 -0
- package/src/SubscriptionRef.ts +3 -2
- package/src/SynchronizedRef.ts +3 -2
- package/src/Trie.ts +18 -17
- package/src/TxChunk.ts +72 -53
- package/src/TxDeferred.ts +394 -0
- package/src/TxHashMap.ts +332 -285
- package/src/TxHashSet.ts +111 -116
- package/src/TxPriorityQueue.ts +767 -0
- package/src/TxPubSub.ts +789 -0
- package/src/TxQueue.ts +241 -251
- package/src/TxReentrantLock.ts +753 -0
- package/src/TxRef.ts +50 -38
- package/src/TxSemaphore.ts +29 -32
- package/src/TxSubscriptionRef.ts +639 -0
- package/src/Types.ts +78 -2
- package/src/index.ts +600 -21
- package/src/internal/core.ts +12 -5
- package/src/internal/dateTime.ts +9 -30
- package/src/internal/effect.ts +744 -265
- package/src/internal/hashMap.ts +9 -7
- package/src/internal/random.ts +20 -0
- package/src/internal/rcRef.ts +4 -3
- package/src/internal/request.ts +2 -2
- package/src/internal/schema/annotations.ts +2 -0
- package/src/internal/schema/schema.ts +1 -0
- package/src/internal/trie.ts +16 -9
- package/src/testing/TestClock.ts +13 -11
- package/src/testing/TestSchema.ts +10 -10
- package/src/unstable/ai/AiError.ts +97 -44
- package/src/unstable/ai/Chat.ts +12 -11
- package/src/unstable/ai/LanguageModel.ts +129 -25
- package/src/unstable/ai/McpSchema.ts +59 -13
- package/src/unstable/ai/McpServer.ts +48 -9
- package/src/unstable/ai/Model.ts +40 -9
- package/src/unstable/ai/Prompt.ts +37 -37
- package/src/unstable/ai/Response.ts +25 -25
- package/src/unstable/ai/Tool.ts +19 -13
- package/src/unstable/ai/index.ts +1 -1
- package/src/unstable/cli/CliOutput.ts +75 -6
- package/src/unstable/cli/Command.ts +501 -60
- package/src/unstable/cli/GlobalFlag.ts +243 -0
- package/src/unstable/cli/HelpDoc.ts +80 -2
- package/src/unstable/cli/index.ts +5 -0
- package/src/unstable/cli/internal/command.ts +50 -34
- package/src/unstable/cli/internal/completions/CommandDescriptor.ts +7 -2
- package/src/unstable/cli/internal/help.ts +146 -0
- package/src/unstable/cli/internal/parser.ts +33 -54
- package/src/unstable/cluster/ClusterCron.ts +2 -2
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +5 -4
- package/src/unstable/cluster/Entity.ts +11 -10
- package/src/unstable/cluster/EntityResource.ts +4 -4
- package/src/unstable/cluster/Envelope.ts +1 -1
- package/src/unstable/cluster/K8sHttpClient.ts +5 -5
- package/src/unstable/cluster/MessageStorage.ts +3 -5
- package/src/unstable/cluster/Runners.ts +6 -5
- package/src/unstable/cluster/Sharding.ts +12 -10
- package/src/unstable/cluster/ShardingConfig.ts +30 -31
- package/src/unstable/cluster/SqlRunnerStorage.ts +1 -1
- package/src/unstable/cluster/internal/entityManager.ts +9 -8
- package/src/unstable/cluster/internal/entityReaper.ts +2 -1
- package/src/unstable/cluster/internal/resourceRef.ts +2 -1
- package/src/unstable/encoding/Sse.ts +3 -5
- package/src/unstable/eventlog/EventLog.ts +2 -1
- package/src/unstable/http/Cookies.ts +3 -3
- package/src/unstable/http/Headers.ts +28 -13
- package/src/unstable/http/HttpBody.ts +42 -1
- package/src/unstable/http/HttpClient.ts +58 -23
- package/src/unstable/http/HttpClientRequest.ts +38 -13
- package/src/unstable/http/HttpEffect.ts +46 -68
- package/src/unstable/http/HttpMethod.ts +16 -4
- package/src/unstable/http/HttpMiddleware.ts +9 -24
- package/src/unstable/http/HttpServerError.ts +42 -45
- package/src/unstable/http/HttpServerRequest.ts +1 -1
- package/src/unstable/http/HttpServerRespondable.ts +6 -6
- package/src/unstable/http/HttpServerResponse.ts +4 -2
- package/src/unstable/http/Multipart.ts +2 -2
- package/src/unstable/http/UrlParams.ts +20 -5
- package/src/unstable/http/internal/preResponseHandler.ts +15 -0
- package/src/unstable/httpapi/HttpApi.ts +5 -5
- package/src/unstable/httpapi/HttpApiBuilder.ts +77 -21
- package/src/unstable/httpapi/HttpApiClient.ts +14 -6
- package/src/unstable/httpapi/HttpApiEndpoint.ts +67 -83
- package/src/unstable/httpapi/HttpApiError.ts +30 -9
- package/src/unstable/httpapi/HttpApiGroup.ts +6 -6
- package/src/unstable/httpapi/HttpApiMiddleware.ts +4 -4
- package/src/unstable/httpapi/HttpApiScalar.ts +6 -0
- package/src/unstable/httpapi/HttpApiSecurity.ts +3 -3
- package/src/unstable/httpapi/OpenApi.ts +41 -23
- package/src/unstable/observability/Otlp.ts +12 -12
- package/src/unstable/observability/OtlpExporter.ts +3 -3
- package/src/unstable/observability/OtlpLogger.ts +13 -9
- package/src/unstable/observability/OtlpMetrics.ts +4 -4
- package/src/unstable/observability/OtlpTracer.ts +4 -4
- package/src/unstable/persistence/KeyValueStore.ts +6 -6
- package/src/unstable/persistence/Persistable.ts +2 -2
- package/src/unstable/persistence/PersistedCache.ts +20 -9
- package/src/unstable/persistence/PersistedQueue.ts +25 -24
- package/src/unstable/persistence/Persistence.ts +3 -3
- package/src/unstable/persistence/RateLimiter.ts +4 -4
- package/src/unstable/process/ChildProcess.ts +6 -208
- package/src/unstable/process/ChildProcessSpawner.ts +75 -14
- package/src/unstable/reactivity/Atom.ts +27 -25
- package/src/unstable/reactivity/AtomHttpApi.ts +21 -20
- package/src/unstable/reactivity/AtomRegistry.ts +31 -7
- package/src/unstable/reactivity/AtomRpc.ts +3 -3
- package/src/unstable/reactivity/Hydration.ts +112 -0
- package/src/unstable/reactivity/index.ts +5 -0
- package/src/unstable/rpc/Rpc.ts +6 -6
- package/src/unstable/rpc/RpcClient.ts +12 -54
- package/src/unstable/rpc/RpcGroup.ts +4 -4
- package/src/unstable/rpc/RpcMiddleware.ts +3 -3
- package/src/unstable/rpc/RpcSchema.ts +17 -0
- package/src/unstable/rpc/RpcSerialization.ts +44 -9
- package/src/unstable/rpc/RpcServer.ts +21 -30
- package/src/unstable/rpc/Utils.ts +2 -1
- package/src/unstable/schema/VariantSchema.ts +6 -6
- package/src/unstable/socket/Socket.ts +16 -17
- package/src/unstable/sql/SqlClient.ts +1 -1
- package/src/unstable/sql/SqlError.ts +11 -9
- package/src/unstable/sql/SqlModel.ts +5 -5
- package/src/unstable/sql/SqlSchema.ts +41 -25
- package/src/unstable/sql/Statement.ts +0 -1
- package/src/unstable/workers/Worker.ts +2 -1
- package/src/unstable/workflow/DurableClock.ts +8 -8
- package/src/unstable/workflow/DurableDeferred.ts +2 -2
- package/src/unstable/workflow/Workflow.ts +6 -2
- package/src/unstable/workflow/WorkflowEngine.ts +185 -2
- package/dist/PartitionedSemaphore.d.ts +0 -52
- package/dist/PartitionedSemaphore.d.ts.map +0 -1
- package/dist/PartitionedSemaphore.js.map +0 -1
- package/dist/encoding/Base64.d.ts +0 -67
- package/dist/encoding/Base64.d.ts.map +0 -1
- package/dist/encoding/Base64.js +0 -146
- package/dist/encoding/Base64.js.map +0 -1
- package/dist/encoding/Base64Url.d.ts +0 -60
- package/dist/encoding/Base64Url.d.ts.map +0 -1
- package/dist/encoding/Base64Url.js +0 -89
- package/dist/encoding/Base64Url.js.map +0 -1
- package/dist/encoding/EncodingError.d.ts +0 -31
- package/dist/encoding/EncodingError.d.ts.map +0 -1
- package/dist/encoding/EncodingError.js +0 -22
- package/dist/encoding/EncodingError.js.map +0 -1
- package/dist/encoding/Hex.d.ts +0 -61
- package/dist/encoding/Hex.d.ts.map +0 -1
- package/dist/encoding/Hex.js +0 -115
- package/dist/encoding/Hex.js.map +0 -1
- package/dist/encoding/index.d.ts +0 -26
- package/dist/encoding/index.d.ts.map +0 -1
- package/dist/encoding/index.js +0 -27
- package/dist/encoding/index.js.map +0 -1
- package/dist/unstable/cli/internal/builtInFlags.d.ts +0 -7
- package/dist/unstable/cli/internal/builtInFlags.d.ts.map +0 -1
- package/dist/unstable/cli/internal/builtInFlags.js +0 -44
- package/dist/unstable/cli/internal/builtInFlags.js.map +0 -1
- package/src/PartitionedSemaphore.ts +0 -182
- package/src/encoding/Base64.ts +0 -366
- package/src/encoding/Base64Url.ts +0 -104
- package/src/encoding/EncodingError.ts +0 -35
- package/src/encoding/Hex.ts +0 -390
- package/src/encoding/index.ts +0 -31
- package/src/unstable/cli/internal/builtInFlags.ts +0 -78
package/src/Stream.ts
CHANGED
|
@@ -12,7 +12,7 @@ import * as Equal from "./Equal.ts"
|
|
|
12
12
|
import * as ExecutionPlan from "./ExecutionPlan.ts"
|
|
13
13
|
import * as Exit from "./Exit.ts"
|
|
14
14
|
import * as Fiber from "./Fiber.ts"
|
|
15
|
-
import * as Filter from "./Filter.ts"
|
|
15
|
+
import type * as Filter from "./Filter.ts"
|
|
16
16
|
import type { LazyArg } from "./Function.ts"
|
|
17
17
|
import { constant, constTrue, constVoid, dual, identity } from "./Function.ts"
|
|
18
18
|
import type { TypeLambda } from "./HKT.ts"
|
|
@@ -20,8 +20,9 @@ import * as internalExecutionPlan from "./internal/executionPlan.ts"
|
|
|
20
20
|
import * as internal from "./internal/stream.ts"
|
|
21
21
|
import { addSpanStackTrace } from "./internal/tracer.ts"
|
|
22
22
|
import * as Iterable from "./Iterable.ts"
|
|
23
|
+
import * as Latch from "./Latch.ts"
|
|
23
24
|
import type * as Layer from "./Layer.ts"
|
|
24
|
-
import type {
|
|
25
|
+
import type { Severity } from "./LogLevel.ts"
|
|
25
26
|
import * as MutableHashMap from "./MutableHashMap.ts"
|
|
26
27
|
import * as MutableList from "./MutableList.ts"
|
|
27
28
|
import * as Option from "./Option.ts"
|
|
@@ -47,7 +48,9 @@ import type {
|
|
|
47
48
|
ExcludeTag,
|
|
48
49
|
ExtractReason,
|
|
49
50
|
ExtractTag,
|
|
51
|
+
NarrowReason,
|
|
50
52
|
NoInfer,
|
|
53
|
+
OmitReason,
|
|
51
54
|
ReasonTags,
|
|
52
55
|
Tags,
|
|
53
56
|
unassigned
|
|
@@ -471,7 +474,7 @@ export const fromEffectSchedule = <A, E, R, X, AS extends A, ES, RS>(
|
|
|
471
474
|
* @since 2.0.0
|
|
472
475
|
* @category Constructors
|
|
473
476
|
*/
|
|
474
|
-
export const tick = (interval: Duration.
|
|
477
|
+
export const tick = (interval: Duration.Input): Stream<void> =>
|
|
475
478
|
fromPull(Effect.sync(() => {
|
|
476
479
|
let first = true
|
|
477
480
|
const effect = Effect.succeed(Arr.of<void>(undefined))
|
|
@@ -2648,8 +2651,8 @@ export const tapSink: {
|
|
|
2648
2651
|
transformPullBracket(
|
|
2649
2652
|
self,
|
|
2650
2653
|
Effect.fnUntraced(function*(pull, _, scope) {
|
|
2651
|
-
const upstreamLatch =
|
|
2652
|
-
const sinkLatch =
|
|
2654
|
+
const upstreamLatch = Latch.makeUnsafe()
|
|
2655
|
+
const sinkLatch = Latch.makeUnsafe()
|
|
2653
2656
|
let chunk: Arr.NonEmptyReadonlyArray<A> | undefined = undefined
|
|
2654
2657
|
let causeSink: Cause.Cause<E2> | undefined = undefined
|
|
2655
2658
|
let sinkDone = false
|
|
@@ -3316,7 +3319,7 @@ export const timeout: {
|
|
|
3316
3319
|
* @since 2.0.0
|
|
3317
3320
|
* @category Rate Limiting
|
|
3318
3321
|
*/
|
|
3319
|
-
(duration: Duration.
|
|
3322
|
+
(duration: Duration.Input): <A, E, R>(self: Stream<A, E, R>) => Stream<A, E, R>
|
|
3320
3323
|
/**
|
|
3321
3324
|
* Ends the stream if it does not produce a value within the specified duration.
|
|
3322
3325
|
*
|
|
@@ -3340,10 +3343,10 @@ export const timeout: {
|
|
|
3340
3343
|
* @since 2.0.0
|
|
3341
3344
|
* @category Rate Limiting
|
|
3342
3345
|
*/
|
|
3343
|
-
<A, E, R>(self: Stream<A, E, R>, duration: Duration.
|
|
3346
|
+
<A, E, R>(self: Stream<A, E, R>, duration: Duration.Input): Stream<A, E, R>
|
|
3344
3347
|
} = dual(
|
|
3345
3348
|
2,
|
|
3346
|
-
<A, E, R>(self: Stream<A, E, R>, duration: Duration.
|
|
3349
|
+
<A, E, R>(self: Stream<A, E, R>, duration: Duration.Input): Stream<A, E, R> =>
|
|
3347
3350
|
transformPull(self, (pull, _scope) =>
|
|
3348
3351
|
Effect.succeed(Effect.timeoutOrElse(pull, {
|
|
3349
3352
|
duration,
|
|
@@ -5341,7 +5344,7 @@ export const zipLatestAll = <T extends ReadonlyArray<Stream<any, any, any>>>(
|
|
|
5341
5344
|
fromChannel(Channel.suspend(() => {
|
|
5342
5345
|
const latest: Array<any> = []
|
|
5343
5346
|
const emitted = new Set<number>()
|
|
5344
|
-
const readyLatch =
|
|
5347
|
+
const readyLatch = Latch.makeUnsafe()
|
|
5345
5348
|
return Channel.mergeAll(
|
|
5346
5349
|
Channel.fromArray(
|
|
5347
5350
|
streams.map((s, i) =>
|
|
@@ -5763,7 +5766,7 @@ export const filter: {
|
|
|
5763
5766
|
* @since 2.0.0
|
|
5764
5767
|
* @category Filtering
|
|
5765
5768
|
*/
|
|
5766
|
-
<A
|
|
5769
|
+
<A>(predicate: Predicate<NoInfer<A>>): <E, R>(self: Stream<A, E, R>) => Stream<A, E, R>
|
|
5767
5770
|
/**
|
|
5768
5771
|
* Filters a stream to the elements that satisfy a predicate.
|
|
5769
5772
|
*
|
|
@@ -5809,27 +5812,52 @@ export const filter: {
|
|
|
5809
5812
|
* @since 2.0.0
|
|
5810
5813
|
* @category Filtering
|
|
5811
5814
|
*/
|
|
5812
|
-
<A, E, R
|
|
5815
|
+
<A, E, R>(self: Stream<A, E, R>, predicate: Predicate<A>): Stream<A, E, R>
|
|
5813
5816
|
} = dual(
|
|
5814
5817
|
2,
|
|
5815
|
-
<A, E, R
|
|
5818
|
+
<A, E, R>(
|
|
5816
5819
|
self: Stream<A, E, R>,
|
|
5817
|
-
|
|
5818
|
-
): Stream<
|
|
5820
|
+
predicate: Predicate<A>
|
|
5821
|
+
): Stream<A, E, R> => fromChannel(Channel.filterArray(toChannel(self), predicate))
|
|
5819
5822
|
)
|
|
5820
5823
|
|
|
5821
5824
|
/**
|
|
5822
|
-
*
|
|
5825
|
+
* Filters and maps stream elements in one pass using a `Filter`.
|
|
5826
|
+
*
|
|
5827
|
+
* @since 4.0.0
|
|
5828
|
+
* @category Filtering
|
|
5829
|
+
*/
|
|
5830
|
+
export const filterMap: {
|
|
5831
|
+
/**
|
|
5832
|
+
* Filters and maps stream elements in one pass using a `Filter`.
|
|
5833
|
+
*
|
|
5834
|
+
* @since 4.0.0
|
|
5835
|
+
* @category Filtering
|
|
5836
|
+
*/
|
|
5837
|
+
<A, B, X>(filter: Filter.Filter<NoInfer<A>, B, X>): <E, R>(self: Stream<A, E, R>) => Stream<B, E, R>
|
|
5838
|
+
/**
|
|
5839
|
+
* Filters and maps stream elements in one pass using a `Filter`.
|
|
5840
|
+
*
|
|
5841
|
+
* @since 4.0.0
|
|
5842
|
+
* @category Filtering
|
|
5843
|
+
*/
|
|
5844
|
+
<A, E, R, B, X>(self: Stream<A, E, R>, filter: Filter.Filter<A, B, X>): Stream<B, E, R>
|
|
5845
|
+
} = dual(
|
|
5846
|
+
2,
|
|
5847
|
+
<A, E, R, B, X>(
|
|
5848
|
+
self: Stream<A, E, R>,
|
|
5849
|
+
filter: Filter.Filter<A, B, X>
|
|
5850
|
+
): Stream<B, E, R> => fromChannel(Channel.filterMapArray(toChannel(self), filter))
|
|
5851
|
+
)
|
|
5852
|
+
|
|
5853
|
+
/**
|
|
5854
|
+
* Effectfully filters elements in a single pass.
|
|
5823
5855
|
*
|
|
5824
5856
|
* @example
|
|
5825
5857
|
* ```ts
|
|
5826
|
-
* import { Console, Effect,
|
|
5827
|
-
*
|
|
5828
|
-
* const filter = Filter.makeEffect((n: number) =>
|
|
5829
|
-
* Effect.succeed(n > 2 ? Result.succeed(n + 1) : Result.fail(n))
|
|
5830
|
-
* )
|
|
5858
|
+
* import { Console, Effect, Stream } from "effect"
|
|
5831
5859
|
*
|
|
5832
|
-
* const stream = Stream.make(1, 2, 3, 4).pipe(Stream.filterEffect(
|
|
5860
|
+
* const stream = Stream.make(1, 2, 3, 4).pipe(Stream.filterEffect((n) => Effect.succeed(n > 2)))
|
|
5833
5861
|
*
|
|
5834
5862
|
* const program = Effect.gen(function*() {
|
|
5835
5863
|
* const result = yield* Stream.runCollect(stream)
|
|
@@ -5837,7 +5865,7 @@ export const filter: {
|
|
|
5837
5865
|
* })
|
|
5838
5866
|
*
|
|
5839
5867
|
* Effect.runPromise(program)
|
|
5840
|
-
* // Output: [
|
|
5868
|
+
* // Output: [ 3, 4 ]
|
|
5841
5869
|
* ```
|
|
5842
5870
|
*
|
|
5843
5871
|
* @since 2.0.0
|
|
@@ -5845,17 +5873,13 @@ export const filter: {
|
|
|
5845
5873
|
*/
|
|
5846
5874
|
export const filterEffect: {
|
|
5847
5875
|
/**
|
|
5848
|
-
* Effectfully filters
|
|
5876
|
+
* Effectfully filters elements in a single pass.
|
|
5849
5877
|
*
|
|
5850
5878
|
* @example
|
|
5851
5879
|
* ```ts
|
|
5852
|
-
* import { Console, Effect,
|
|
5853
|
-
*
|
|
5854
|
-
* const filter = Filter.makeEffect((n: number) =>
|
|
5855
|
-
* Effect.succeed(n > 2 ? Result.succeed(n + 1) : Result.fail(n))
|
|
5856
|
-
* )
|
|
5880
|
+
* import { Console, Effect, Stream } from "effect"
|
|
5857
5881
|
*
|
|
5858
|
-
* const stream = Stream.make(1, 2, 3, 4).pipe(Stream.filterEffect(
|
|
5882
|
+
* const stream = Stream.make(1, 2, 3, 4).pipe(Stream.filterEffect((n) => Effect.succeed(n > 2)))
|
|
5859
5883
|
*
|
|
5860
5884
|
* const program = Effect.gen(function*() {
|
|
5861
5885
|
* const result = yield* Stream.runCollect(stream)
|
|
@@ -5863,25 +5887,21 @@ export const filterEffect: {
|
|
|
5863
5887
|
* })
|
|
5864
5888
|
*
|
|
5865
5889
|
* Effect.runPromise(program)
|
|
5866
|
-
* // Output: [
|
|
5890
|
+
* // Output: [ 3, 4 ]
|
|
5867
5891
|
* ```
|
|
5868
5892
|
*
|
|
5869
5893
|
* @since 2.0.0
|
|
5870
5894
|
* @category Filtering
|
|
5871
5895
|
*/
|
|
5872
|
-
<A,
|
|
5896
|
+
<A, EX, RX>(predicate: (a: NoInfer<A>, i: number) => Effect.Effect<boolean, EX, RX>): <E, R>(self: Stream<A, E, R>) => Stream<A, E | EX, R | RX>
|
|
5873
5897
|
/**
|
|
5874
|
-
* Effectfully filters
|
|
5898
|
+
* Effectfully filters elements in a single pass.
|
|
5875
5899
|
*
|
|
5876
5900
|
* @example
|
|
5877
5901
|
* ```ts
|
|
5878
|
-
* import { Console, Effect,
|
|
5879
|
-
*
|
|
5880
|
-
* const filter = Filter.makeEffect((n: number) =>
|
|
5881
|
-
* Effect.succeed(n > 2 ? Result.succeed(n + 1) : Result.fail(n))
|
|
5882
|
-
* )
|
|
5902
|
+
* import { Console, Effect, Stream } from "effect"
|
|
5883
5903
|
*
|
|
5884
|
-
* const stream = Stream.make(1, 2, 3, 4).pipe(Stream.filterEffect(
|
|
5904
|
+
* const stream = Stream.make(1, 2, 3, 4).pipe(Stream.filterEffect((n) => Effect.succeed(n > 2)))
|
|
5885
5905
|
*
|
|
5886
5906
|
* const program = Effect.gen(function*() {
|
|
5887
5907
|
* const result = yield* Stream.runCollect(stream)
|
|
@@ -5889,35 +5909,65 @@ export const filterEffect: {
|
|
|
5889
5909
|
* })
|
|
5890
5910
|
*
|
|
5891
5911
|
* Effect.runPromise(program)
|
|
5892
|
-
* // Output: [
|
|
5912
|
+
* // Output: [ 3, 4 ]
|
|
5893
5913
|
* ```
|
|
5894
5914
|
*
|
|
5895
5915
|
* @since 2.0.0
|
|
5896
5916
|
* @category Filtering
|
|
5897
5917
|
*/
|
|
5918
|
+
<A, E, R, EX, RX>(
|
|
5919
|
+
self: Stream<A, E, R>,
|
|
5920
|
+
predicate: (a: NoInfer<A>, i: number) => Effect.Effect<boolean, EX, RX>
|
|
5921
|
+
): Stream<A, E | EX, R | RX>
|
|
5922
|
+
} = dual(
|
|
5923
|
+
2,
|
|
5924
|
+
<A, E, R, EX, RX>(
|
|
5925
|
+
self: Stream<A, E, R>,
|
|
5926
|
+
predicate: (a: NoInfer<A>, i: number) => Effect.Effect<boolean, EX, RX>
|
|
5927
|
+
): Stream<A, E | EX, R | RX> => fromChannel(Channel.filterArrayEffect(toChannel(self), predicate))
|
|
5928
|
+
)
|
|
5929
|
+
|
|
5930
|
+
/**
|
|
5931
|
+
* Effectfully filters and maps elements in a single pass.
|
|
5932
|
+
*
|
|
5933
|
+
* @since 4.0.0
|
|
5934
|
+
* @category Filtering
|
|
5935
|
+
*/
|
|
5936
|
+
export const filterMapEffect: {
|
|
5937
|
+
/**
|
|
5938
|
+
* Effectfully filters and maps elements in a single pass.
|
|
5939
|
+
*
|
|
5940
|
+
* @since 4.0.0
|
|
5941
|
+
* @category Filtering
|
|
5942
|
+
*/
|
|
5943
|
+
<A, B, X, EX, RX>(filter: Filter.FilterEffect<NoInfer<A>, B, X, EX, RX>): <E, R>(self: Stream<A, E, R>) => Stream<B, E | EX, R | RX>
|
|
5944
|
+
/**
|
|
5945
|
+
* Effectfully filters and maps elements in a single pass.
|
|
5946
|
+
*
|
|
5947
|
+
* @since 4.0.0
|
|
5948
|
+
* @category Filtering
|
|
5949
|
+
*/
|
|
5898
5950
|
<A, E, R, B, X, EX, RX>(self: Stream<A, E, R>, filter: Filter.FilterEffect<A, B, X, EX, RX>): Stream<B, E | EX, R | RX>
|
|
5899
5951
|
} = dual(
|
|
5900
5952
|
2,
|
|
5901
5953
|
<A, E, R, B, X, EX, RX>(
|
|
5902
5954
|
self: Stream<A, E, R>,
|
|
5903
5955
|
filter: Filter.FilterEffect<A, B, X, EX, RX>
|
|
5904
|
-
): Stream<B, E | EX, R | RX> => fromChannel(Channel.
|
|
5956
|
+
): Stream<B, E | EX, R | RX> => fromChannel(Channel.filterMapArrayEffect(toChannel(self), filter))
|
|
5905
5957
|
)
|
|
5906
5958
|
|
|
5907
5959
|
/**
|
|
5908
|
-
* Partitions a stream using a Filter and exposes passing and failing values as queues.
|
|
5960
|
+
* Partitions a stream using a `Filter` and exposes passing and failing values as queues.
|
|
5909
5961
|
*
|
|
5910
5962
|
* Each queue fails with the stream error or `Cause.Done` when the source ends.
|
|
5911
5963
|
*
|
|
5912
5964
|
* @example
|
|
5913
5965
|
* ```ts
|
|
5914
|
-
* import { Console, Effect,
|
|
5966
|
+
* import { Console, Effect, Result, Stream } from "effect"
|
|
5915
5967
|
*
|
|
5916
5968
|
* const program = Effect.gen(function*() {
|
|
5917
5969
|
* const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
5918
|
-
* Stream.partitionQueue(
|
|
5919
|
-
* Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
|
|
5920
|
-
* )
|
|
5970
|
+
* Stream.partitionQueue((n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
|
|
5921
5971
|
* )
|
|
5922
5972
|
*
|
|
5923
5973
|
* const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
|
|
@@ -5937,63 +5987,17 @@ export const filterEffect: {
|
|
|
5937
5987
|
*/
|
|
5938
5988
|
export const partitionQueue: {
|
|
5939
5989
|
/**
|
|
5940
|
-
* Partitions a stream using a Filter and exposes passing and failing values as queues.
|
|
5941
|
-
*
|
|
5942
|
-
* Each queue fails with the stream error or `Cause.Done` when the source ends.
|
|
5943
|
-
*
|
|
5944
|
-
* @example
|
|
5945
|
-
* ```ts
|
|
5946
|
-
* import { Console, Effect, Filter, Result, Stream } from "effect"
|
|
5947
|
-
*
|
|
5948
|
-
* const program = Effect.gen(function*() {
|
|
5949
|
-
* const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
5950
|
-
* Stream.partitionQueue(
|
|
5951
|
-
* Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
|
|
5952
|
-
* )
|
|
5953
|
-
* )
|
|
5954
|
-
*
|
|
5955
|
-
* const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
|
|
5956
|
-
* const failValues = yield* Stream.fromQueue(fails).pipe(Stream.runCollect)
|
|
5957
|
-
*
|
|
5958
|
-
* yield* Console.log(passValues)
|
|
5959
|
-
* // Output: [ 2, 4 ]
|
|
5960
|
-
* yield* Console.log(failValues)
|
|
5961
|
-
* // Output: [ 1, 3 ]
|
|
5962
|
-
* })
|
|
5963
|
-
*
|
|
5964
|
-
* Effect.runPromise(Effect.scoped(program))
|
|
5965
|
-
* ```
|
|
5966
|
-
*
|
|
5967
|
-
* @since 4.0.0
|
|
5968
|
-
* @category Filtering
|
|
5969
|
-
*/
|
|
5970
|
-
<A, B extends A>(
|
|
5971
|
-
refinement: Refinement<NoInfer<A>, B>,
|
|
5972
|
-
options?: {
|
|
5973
|
-
readonly capacity?: number | "unbounded" | undefined
|
|
5974
|
-
}
|
|
5975
|
-
): <E, R>(self: Stream<A, E, R>) => Effect.Effect<
|
|
5976
|
-
[
|
|
5977
|
-
passes: Queue.Dequeue<B, E | Cause.Done>,
|
|
5978
|
-
fails: Queue.Dequeue<Exclude<A, B>, E | Cause.Done>
|
|
5979
|
-
],
|
|
5980
|
-
never,
|
|
5981
|
-
R | Scope.Scope
|
|
5982
|
-
>
|
|
5983
|
-
/**
|
|
5984
|
-
* Partitions a stream using a Filter and exposes passing and failing values as queues.
|
|
5990
|
+
* Partitions a stream using a `Filter` and exposes passing and failing values as queues.
|
|
5985
5991
|
*
|
|
5986
5992
|
* Each queue fails with the stream error or `Cause.Done` when the source ends.
|
|
5987
5993
|
*
|
|
5988
5994
|
* @example
|
|
5989
5995
|
* ```ts
|
|
5990
|
-
* import { Console, Effect,
|
|
5996
|
+
* import { Console, Effect, Result, Stream } from "effect"
|
|
5991
5997
|
*
|
|
5992
5998
|
* const program = Effect.gen(function*() {
|
|
5993
5999
|
* const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
5994
|
-
* Stream.partitionQueue(
|
|
5995
|
-
* Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
|
|
5996
|
-
* )
|
|
6000
|
+
* Stream.partitionQueue((n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
|
|
5997
6001
|
* )
|
|
5998
6002
|
*
|
|
5999
6003
|
* const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
|
|
@@ -6011,78 +6015,31 @@ export const partitionQueue: {
|
|
|
6011
6015
|
* @since 4.0.0
|
|
6012
6016
|
* @category Filtering
|
|
6013
6017
|
*/
|
|
6014
|
-
<A,
|
|
6015
|
-
filter: Filter.
|
|
6018
|
+
<A, Pass, Fail>(
|
|
6019
|
+
filter: Filter.Filter<NoInfer<A>, Pass, Fail>,
|
|
6016
6020
|
options?: {
|
|
6017
6021
|
readonly capacity?: number | "unbounded" | undefined
|
|
6018
6022
|
}
|
|
6019
6023
|
): <E, R>(self: Stream<A, E, R>) => Effect.Effect<
|
|
6020
6024
|
[
|
|
6021
|
-
passes: Queue.Dequeue<
|
|
6022
|
-
fails: Queue.Dequeue<
|
|
6025
|
+
passes: Queue.Dequeue<Pass, E | Cause.Done>,
|
|
6026
|
+
fails: Queue.Dequeue<Fail, E | Cause.Done>
|
|
6023
6027
|
],
|
|
6024
6028
|
never,
|
|
6025
6029
|
R | Scope.Scope
|
|
6026
6030
|
>
|
|
6027
6031
|
/**
|
|
6028
|
-
* Partitions a stream using a Filter and exposes passing and failing values as queues.
|
|
6032
|
+
* Partitions a stream using a `Filter` and exposes passing and failing values as queues.
|
|
6029
6033
|
*
|
|
6030
6034
|
* Each queue fails with the stream error or `Cause.Done` when the source ends.
|
|
6031
6035
|
*
|
|
6032
6036
|
* @example
|
|
6033
6037
|
* ```ts
|
|
6034
|
-
* import { Console, Effect,
|
|
6035
|
-
*
|
|
6036
|
-
* const program = Effect.gen(function*() {
|
|
6037
|
-
* const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
6038
|
-
* Stream.partitionQueue(
|
|
6039
|
-
* Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
|
|
6040
|
-
* )
|
|
6041
|
-
* )
|
|
6042
|
-
*
|
|
6043
|
-
* const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
|
|
6044
|
-
* const failValues = yield* Stream.fromQueue(fails).pipe(Stream.runCollect)
|
|
6045
|
-
*
|
|
6046
|
-
* yield* Console.log(passValues)
|
|
6047
|
-
* // Output: [ 2, 4 ]
|
|
6048
|
-
* yield* Console.log(failValues)
|
|
6049
|
-
* // Output: [ 1, 3 ]
|
|
6050
|
-
* })
|
|
6051
|
-
*
|
|
6052
|
-
* Effect.runPromise(Effect.scoped(program))
|
|
6053
|
-
* ```
|
|
6054
|
-
*
|
|
6055
|
-
* @since 4.0.0
|
|
6056
|
-
* @category Filtering
|
|
6057
|
-
*/
|
|
6058
|
-
<A, E, R, B extends A>(
|
|
6059
|
-
self: Stream<A, E, R>,
|
|
6060
|
-
refinement: Refinement<A, B>,
|
|
6061
|
-
options?: {
|
|
6062
|
-
readonly capacity?: number | "unbounded" | undefined
|
|
6063
|
-
}
|
|
6064
|
-
): Effect.Effect<
|
|
6065
|
-
[
|
|
6066
|
-
passes: Queue.Dequeue<B, E | Cause.Done>,
|
|
6067
|
-
fails: Queue.Dequeue<Exclude<A, B>, E | Cause.Done>
|
|
6068
|
-
],
|
|
6069
|
-
never,
|
|
6070
|
-
R | Scope.Scope
|
|
6071
|
-
>
|
|
6072
|
-
/**
|
|
6073
|
-
* Partitions a stream using a Filter and exposes passing and failing values as queues.
|
|
6074
|
-
*
|
|
6075
|
-
* Each queue fails with the stream error or `Cause.Done` when the source ends.
|
|
6076
|
-
*
|
|
6077
|
-
* @example
|
|
6078
|
-
* ```ts
|
|
6079
|
-
* import { Console, Effect, Filter, Result, Stream } from "effect"
|
|
6038
|
+
* import { Console, Effect, Result, Stream } from "effect"
|
|
6080
6039
|
*
|
|
6081
6040
|
* const program = Effect.gen(function*() {
|
|
6082
6041
|
* const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
6083
|
-
* Stream.partitionQueue(
|
|
6084
|
-
* Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
|
|
6085
|
-
* )
|
|
6042
|
+
* Stream.partitionQueue((n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
|
|
6086
6043
|
* )
|
|
6087
6044
|
*
|
|
6088
6045
|
* const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
|
|
@@ -6100,16 +6057,16 @@ export const partitionQueue: {
|
|
|
6100
6057
|
* @since 4.0.0
|
|
6101
6058
|
* @category Filtering
|
|
6102
6059
|
*/
|
|
6103
|
-
<A, E, R,
|
|
6060
|
+
<A, E, R, Pass, Fail>(
|
|
6104
6061
|
self: Stream<A, E, R>,
|
|
6105
|
-
filter: Filter.
|
|
6062
|
+
filter: Filter.Filter<NoInfer<A>, Pass, Fail>,
|
|
6106
6063
|
options?: {
|
|
6107
6064
|
readonly capacity?: number | "unbounded" | undefined
|
|
6108
6065
|
}
|
|
6109
6066
|
): Effect.Effect<
|
|
6110
6067
|
[
|
|
6111
|
-
passes: Queue.Dequeue<
|
|
6112
|
-
fails: Queue.Dequeue<
|
|
6068
|
+
passes: Queue.Dequeue<Pass, E | Cause.Done>,
|
|
6069
|
+
fails: Queue.Dequeue<Fail, E | Cause.Done>
|
|
6113
6070
|
],
|
|
6114
6071
|
never,
|
|
6115
6072
|
R | Scope.Scope
|
|
@@ -6117,16 +6074,16 @@ export const partitionQueue: {
|
|
|
6117
6074
|
} = dual(
|
|
6118
6075
|
(args) => isStream(args[0]),
|
|
6119
6076
|
Effect.fnUntraced(
|
|
6120
|
-
function*<A, E, R,
|
|
6077
|
+
function*<A, E, R, Pass, Fail>(
|
|
6121
6078
|
self: Stream<A, E, R>,
|
|
6122
|
-
filter: Filter.
|
|
6079
|
+
filter: Filter.Filter<NoInfer<A>, Pass, Fail>,
|
|
6123
6080
|
options?: {
|
|
6124
6081
|
readonly capacity?: number | "unbounded" | undefined
|
|
6125
6082
|
}
|
|
6126
6083
|
): Effect.fn.Return<
|
|
6127
6084
|
[
|
|
6128
|
-
passes: Queue.Dequeue<
|
|
6129
|
-
fails: Queue.Dequeue<
|
|
6085
|
+
passes: Queue.Dequeue<Pass, E | Cause.Done>,
|
|
6086
|
+
fails: Queue.Dequeue<Fail, E | Cause.Done>
|
|
6130
6087
|
],
|
|
6131
6088
|
never,
|
|
6132
6089
|
R | Scope.Scope
|
|
@@ -6135,19 +6092,17 @@ export const partitionQueue: {
|
|
|
6135
6092
|
const pull = yield* Channel.toPullScoped(self.channel, scope)
|
|
6136
6093
|
const capacity = options?.capacity === "unbounded" ? undefined : options?.capacity ?? DefaultChunkSize
|
|
6137
6094
|
const passes = yield* Queue.make</**
|
|
6138
|
-
* Partitions a stream using a Filter and exposes passing and failing values as queues.
|
|
6095
|
+
* Partitions a stream using a `Filter` and exposes passing and failing values as queues.
|
|
6139
6096
|
*
|
|
6140
6097
|
* Each queue fails with the stream error or `Cause.Done` when the source ends.
|
|
6141
6098
|
*
|
|
6142
6099
|
* @example
|
|
6143
6100
|
* ```ts
|
|
6144
|
-
* import { Console, Effect,
|
|
6101
|
+
* import { Console, Effect, Result, Stream } from "effect"
|
|
6145
6102
|
*
|
|
6146
6103
|
* const program = Effect.gen(function*() {
|
|
6147
6104
|
* const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
6148
|
-
* Stream.partitionQueue(
|
|
6149
|
-
* Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
|
|
6150
|
-
* )
|
|
6105
|
+
* Stream.partitionQueue((n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
|
|
6151
6106
|
* )
|
|
6152
6107
|
*
|
|
6153
6108
|
* const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
|
|
@@ -6165,20 +6120,18 @@ export const partitionQueue: {
|
|
|
6165
6120
|
* @since 4.0.0
|
|
6166
6121
|
* @category Filtering
|
|
6167
6122
|
*/
|
|
6168
|
-
|
|
6169
|
-
* Partitions a stream using a Filter and exposes passing and failing values as queues.
|
|
6123
|
+
Pass, /**
|
|
6124
|
+
* Partitions a stream using a `Filter` and exposes passing and failing values as queues.
|
|
6170
6125
|
*
|
|
6171
6126
|
* Each queue fails with the stream error or `Cause.Done` when the source ends.
|
|
6172
6127
|
*
|
|
6173
6128
|
* @example
|
|
6174
6129
|
* ```ts
|
|
6175
|
-
* import { Console, Effect,
|
|
6130
|
+
* import { Console, Effect, Result, Stream } from "effect"
|
|
6176
6131
|
*
|
|
6177
6132
|
* const program = Effect.gen(function*() {
|
|
6178
6133
|
* const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
6179
|
-
* Stream.partitionQueue(
|
|
6180
|
-
* Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
|
|
6181
|
-
* )
|
|
6134
|
+
* Stream.partitionQueue((n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
|
|
6182
6135
|
* )
|
|
6183
6136
|
*
|
|
6184
6137
|
* const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
|
|
@@ -6198,19 +6151,17 @@ export const partitionQueue: {
|
|
|
6198
6151
|
*/
|
|
6199
6152
|
E | Cause.Done>({ capacity })
|
|
6200
6153
|
const fails = yield* Queue.make</**
|
|
6201
|
-
* Partitions a stream using a Filter and exposes passing and failing values as queues.
|
|
6154
|
+
* Partitions a stream using a `Filter` and exposes passing and failing values as queues.
|
|
6202
6155
|
*
|
|
6203
6156
|
* Each queue fails with the stream error or `Cause.Done` when the source ends.
|
|
6204
6157
|
*
|
|
6205
6158
|
* @example
|
|
6206
6159
|
* ```ts
|
|
6207
|
-
* import { Console, Effect,
|
|
6160
|
+
* import { Console, Effect, Result, Stream } from "effect"
|
|
6208
6161
|
*
|
|
6209
6162
|
* const program = Effect.gen(function*() {
|
|
6210
6163
|
* const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
6211
|
-
* Stream.partitionQueue(
|
|
6212
|
-
* Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
|
|
6213
|
-
* )
|
|
6164
|
+
* Stream.partitionQueue((n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
|
|
6214
6165
|
* )
|
|
6215
6166
|
*
|
|
6216
6167
|
* const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
|
|
@@ -6228,20 +6179,18 @@ export const partitionQueue: {
|
|
|
6228
6179
|
* @since 4.0.0
|
|
6229
6180
|
* @category Filtering
|
|
6230
6181
|
*/
|
|
6231
|
-
|
|
6232
|
-
* Partitions a stream using a Filter and exposes passing and failing values as queues.
|
|
6182
|
+
Fail, /**
|
|
6183
|
+
* Partitions a stream using a `Filter` and exposes passing and failing values as queues.
|
|
6233
6184
|
*
|
|
6234
6185
|
* Each queue fails with the stream error or `Cause.Done` when the source ends.
|
|
6235
6186
|
*
|
|
6236
6187
|
* @example
|
|
6237
6188
|
* ```ts
|
|
6238
|
-
* import { Console, Effect,
|
|
6189
|
+
* import { Console, Effect, Result, Stream } from "effect"
|
|
6239
6190
|
*
|
|
6240
6191
|
* const program = Effect.gen(function*() {
|
|
6241
6192
|
* const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
6242
|
-
* Stream.partitionQueue(
|
|
6243
|
-
* Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
|
|
6244
|
-
* )
|
|
6193
|
+
* Stream.partitionQueue((n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
|
|
6245
6194
|
* )
|
|
6246
6195
|
*
|
|
6247
6196
|
* const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
|
|
@@ -6261,12 +6210,19 @@ export const partitionQueue: {
|
|
|
6261
6210
|
*/
|
|
6262
6211
|
E | Cause.Done>({ capacity })
|
|
6263
6212
|
|
|
6264
|
-
const partitionArr = Arr.partition(filter as any)
|
|
6265
|
-
|
|
6266
6213
|
yield* Effect.gen(function*() {
|
|
6267
6214
|
while (true) {
|
|
6268
6215
|
const chunk = yield* pull
|
|
6269
|
-
const
|
|
6216
|
+
const excluded: Array<Fail> = []
|
|
6217
|
+
const satisfying: Array<Pass> = []
|
|
6218
|
+
for (let i = 0; i < chunk.length; i++) {
|
|
6219
|
+
const result = filter(chunk[i] as NoInfer<A>)
|
|
6220
|
+
if (Result.isFailure(result)) {
|
|
6221
|
+
excluded.push(result.failure)
|
|
6222
|
+
} else {
|
|
6223
|
+
satisfying.push(result.success)
|
|
6224
|
+
}
|
|
6225
|
+
}
|
|
6270
6226
|
let passFiber: Fiber.Fiber<any> | undefined = undefined
|
|
6271
6227
|
if (satisfying.length > 0) {
|
|
6272
6228
|
const leftover = Queue.offerAllUnsafe(passes, satisfying)
|
|
@@ -6297,147 +6253,112 @@ export const partitionQueue: {
|
|
|
6297
6253
|
)
|
|
6298
6254
|
|
|
6299
6255
|
/**
|
|
6300
|
-
* Splits a stream using an effectful
|
|
6256
|
+
* Splits a stream using an effectful `Filter`, producing pass and fail streams.
|
|
6301
6257
|
*
|
|
6302
6258
|
* @since 4.0.0
|
|
6303
6259
|
* @category Filtering
|
|
6304
|
-
*
|
|
6305
|
-
* @example
|
|
6306
|
-
* ```ts
|
|
6307
|
-
* import { Console, Effect, Result, Stream } from "effect"
|
|
6308
|
-
*
|
|
6309
|
-
* const program = Effect.scoped(
|
|
6310
|
-
* Effect.gen(function*() {
|
|
6311
|
-
* const [evens, odds] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
6312
|
-
* Stream.partitionEffect((n) =>
|
|
6313
|
-
* Effect.succeed(n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
|
|
6314
|
-
* )
|
|
6315
|
-
* )
|
|
6316
|
-
* const result = yield* Effect.all({
|
|
6317
|
-
* evens: Stream.runCollect(evens),
|
|
6318
|
-
* odds: Stream.runCollect(odds)
|
|
6319
|
-
* })
|
|
6320
|
-
* yield* Console.log(result)
|
|
6321
|
-
* })
|
|
6322
|
-
* )
|
|
6323
|
-
*
|
|
6324
|
-
* Effect.runPromise(program)
|
|
6325
|
-
* // Output: { evens: [ 2, 4 ], odds: [ 1, 3 ] }
|
|
6326
|
-
* ```
|
|
6327
6260
|
*/
|
|
6328
6261
|
export const partitionEffect: {
|
|
6329
6262
|
/**
|
|
6330
|
-
* Splits a stream using an effectful
|
|
6263
|
+
* Splits a stream using an effectful `Filter`, producing pass and fail streams.
|
|
6331
6264
|
*
|
|
6332
6265
|
* @since 4.0.0
|
|
6333
6266
|
* @category Filtering
|
|
6334
|
-
*
|
|
6335
|
-
* @example
|
|
6336
|
-
* ```ts
|
|
6337
|
-
* import { Console, Effect, Result, Stream } from "effect"
|
|
6338
|
-
*
|
|
6339
|
-
* const program = Effect.scoped(
|
|
6340
|
-
* Effect.gen(function*() {
|
|
6341
|
-
* const [evens, odds] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
6342
|
-
* Stream.partitionEffect((n) =>
|
|
6343
|
-
* Effect.succeed(n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
|
|
6344
|
-
* )
|
|
6345
|
-
* )
|
|
6346
|
-
* const result = yield* Effect.all({
|
|
6347
|
-
* evens: Stream.runCollect(evens),
|
|
6348
|
-
* odds: Stream.runCollect(odds)
|
|
6349
|
-
* })
|
|
6350
|
-
* yield* Console.log(result)
|
|
6351
|
-
* })
|
|
6352
|
-
* )
|
|
6353
|
-
*
|
|
6354
|
-
* Effect.runPromise(program)
|
|
6355
|
-
* // Output: { evens: [ 2, 4 ], odds: [ 1, 3 ] }
|
|
6356
|
-
* ```
|
|
6357
6267
|
*/
|
|
6358
|
-
<A,
|
|
6359
|
-
filter: Filter.FilterEffect<A
|
|
6268
|
+
<A, Pass, Fail, EX, RX>(
|
|
6269
|
+
filter: Filter.FilterEffect<NoInfer<A>, Pass, Fail, EX, RX>,
|
|
6360
6270
|
options?: {
|
|
6361
6271
|
readonly capacity?: number | "unbounded" | undefined
|
|
6362
6272
|
readonly concurrency?: number | "unbounded" | undefined
|
|
6363
6273
|
}
|
|
6364
6274
|
): <E, R>(self: Stream<A, E, R>) => Effect.Effect<
|
|
6365
6275
|
[
|
|
6366
|
-
passes: Stream<
|
|
6367
|
-
fails: Stream<
|
|
6276
|
+
passes: Stream<Pass, E | EX>,
|
|
6277
|
+
fails: Stream<Fail, E | EX>
|
|
6368
6278
|
],
|
|
6369
6279
|
never,
|
|
6370
6280
|
R | RX | Scope.Scope
|
|
6371
6281
|
>
|
|
6372
6282
|
/**
|
|
6373
|
-
* Splits a stream using an effectful
|
|
6283
|
+
* Splits a stream using an effectful `Filter`, producing pass and fail streams.
|
|
6374
6284
|
*
|
|
6375
6285
|
* @since 4.0.0
|
|
6376
6286
|
* @category Filtering
|
|
6377
|
-
*
|
|
6378
|
-
* @example
|
|
6379
|
-
* ```ts
|
|
6380
|
-
* import { Console, Effect, Result, Stream } from "effect"
|
|
6381
|
-
*
|
|
6382
|
-
* const program = Effect.scoped(
|
|
6383
|
-
* Effect.gen(function*() {
|
|
6384
|
-
* const [evens, odds] = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
6385
|
-
* Stream.partitionEffect((n) =>
|
|
6386
|
-
* Effect.succeed(n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
|
|
6387
|
-
* )
|
|
6388
|
-
* )
|
|
6389
|
-
* const result = yield* Effect.all({
|
|
6390
|
-
* evens: Stream.runCollect(evens),
|
|
6391
|
-
* odds: Stream.runCollect(odds)
|
|
6392
|
-
* })
|
|
6393
|
-
* yield* Console.log(result)
|
|
6394
|
-
* })
|
|
6395
|
-
* )
|
|
6396
|
-
*
|
|
6397
|
-
* Effect.runPromise(program)
|
|
6398
|
-
* // Output: { evens: [ 2, 4 ], odds: [ 1, 3 ] }
|
|
6399
|
-
* ```
|
|
6400
6287
|
*/
|
|
6401
|
-
<A, E, R,
|
|
6288
|
+
<A, E, R, Pass, Fail, EX, RX>(
|
|
6402
6289
|
self: Stream<A, E, R>,
|
|
6403
|
-
filter: Filter.FilterEffect<A
|
|
6290
|
+
filter: Filter.FilterEffect<NoInfer<A>, Pass, Fail, EX, RX>,
|
|
6404
6291
|
options?: {
|
|
6405
6292
|
readonly capacity?: number | "unbounded" | undefined
|
|
6406
6293
|
readonly concurrency?: number | "unbounded" | undefined
|
|
6407
6294
|
}
|
|
6408
6295
|
): Effect.Effect<
|
|
6409
6296
|
[
|
|
6410
|
-
passes: Stream<
|
|
6411
|
-
fails: Stream<
|
|
6297
|
+
passes: Stream<Pass, E | EX>,
|
|
6298
|
+
fails: Stream<Fail, E | EX>
|
|
6412
6299
|
],
|
|
6413
6300
|
never,
|
|
6414
6301
|
R | RX | Scope.Scope
|
|
6415
6302
|
>
|
|
6416
6303
|
} = dual(
|
|
6417
6304
|
(args) => isStream(args[0]),
|
|
6418
|
-
<A, E, R,
|
|
6419
|
-
|
|
6420
|
-
|
|
6421
|
-
|
|
6305
|
+
<A, E, R, Pass, Fail, EX, RX>(
|
|
6306
|
+
self: Stream<A, E, R>,
|
|
6307
|
+
filter: Filter.FilterEffect<NoInfer<A>, Pass, Fail, EX, RX>,
|
|
6308
|
+
options?: {
|
|
6309
|
+
readonly capacity?: number | "unbounded" | undefined
|
|
6310
|
+
readonly concurrency?: number | "unbounded" | undefined
|
|
6311
|
+
}
|
|
6312
|
+
): Effect.Effect<
|
|
6422
6313
|
[
|
|
6423
|
-
passes: Stream<
|
|
6424
|
-
fails: Stream<
|
|
6314
|
+
passes: Stream<Pass, E | EX>,
|
|
6315
|
+
fails: Stream<Fail, E | EX>
|
|
6425
6316
|
],
|
|
6426
6317
|
never,
|
|
6427
6318
|
R | RX | Scope.Scope
|
|
6428
6319
|
> =>
|
|
6429
6320
|
Effect.map(
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6321
|
+
partitionQueue</**
|
|
6322
|
+
* Splits a stream using an effectful `Filter`, producing pass and fail streams.
|
|
6323
|
+
*
|
|
6324
|
+
* @since 4.0.0
|
|
6325
|
+
* @category Filtering
|
|
6326
|
+
*/
|
|
6327
|
+
Result.Result<Pass, Fail>, /**
|
|
6328
|
+
* Splits a stream using an effectful `Filter`, producing pass and fail streams.
|
|
6329
|
+
*
|
|
6330
|
+
* @since 4.0.0
|
|
6331
|
+
* @category Filtering
|
|
6332
|
+
*/
|
|
6333
|
+
E | EX, /**
|
|
6334
|
+
* Splits a stream using an effectful `Filter`, producing pass and fail streams.
|
|
6335
|
+
*
|
|
6336
|
+
* @since 4.0.0
|
|
6337
|
+
* @category Filtering
|
|
6338
|
+
*/
|
|
6339
|
+
R | RX, /**
|
|
6340
|
+
* Splits a stream using an effectful `Filter`, producing pass and fail streams.
|
|
6341
|
+
*
|
|
6342
|
+
* @since 4.0.0
|
|
6343
|
+
* @category Filtering
|
|
6344
|
+
*/
|
|
6345
|
+
Pass, /**
|
|
6346
|
+
* Splits a stream using an effectful `Filter`, producing pass and fail streams.
|
|
6347
|
+
*
|
|
6348
|
+
* @since 4.0.0
|
|
6349
|
+
* @category Filtering
|
|
6350
|
+
*/
|
|
6351
|
+
Fail>(
|
|
6352
|
+
mapEffect(self, (a) => filter(a as NoInfer<A>), options),
|
|
6353
|
+
(result) => result,
|
|
6354
|
+
options
|
|
6433
6355
|
),
|
|
6434
|
-
([passes, fails]) => [fromQueue(passes), fromQueue(fails)]
|
|
6435
|
-
)
|
|
6356
|
+
([passes, fails]) => [fromQueue(passes), fromQueue(fails)] as const
|
|
6357
|
+
)
|
|
6436
6358
|
)
|
|
6437
6359
|
|
|
6438
6360
|
/**
|
|
6439
|
-
* Splits a stream into excluded and satisfying substreams using a
|
|
6440
|
-
* refinement, or Filter.
|
|
6361
|
+
* Splits a stream into excluded and satisfying substreams using a `Filter`.
|
|
6441
6362
|
*
|
|
6442
6363
|
* The faster stream may advance up to `bufferSize` elements ahead of the slower
|
|
6443
6364
|
* one.
|
|
@@ -6447,102 +6368,25 @@ export const partitionEffect: {
|
|
|
6447
6368
|
*
|
|
6448
6369
|
* @example
|
|
6449
6370
|
* ```ts
|
|
6450
|
-
* import { Console, Effect, Stream } from "effect"
|
|
6451
|
-
*
|
|
6452
|
-
* const program = Effect.gen(function*() {
|
|
6453
|
-
* const [excluded, satisfying] = yield* Stream.partition(
|
|
6454
|
-
* Stream.make(1, 2, 3, 4),
|
|
6455
|
-
* (n) => n % 2 === 0
|
|
6456
|
-
* )
|
|
6457
|
-
* const left = yield* Stream.runCollect(excluded)
|
|
6458
|
-
* const right = yield* Stream.runCollect(satisfying)
|
|
6459
|
-
* yield* Console.log(left)
|
|
6460
|
-
* // Output: [ 1, 3 ]
|
|
6461
|
-
* yield* Console.log(right)
|
|
6462
|
-
* // Output: [ 2, 4 ]
|
|
6463
|
-
* })
|
|
6464
|
-
* ```
|
|
6465
|
-
*/
|
|
6466
|
-
export const partition: {
|
|
6467
|
-
/**
|
|
6468
|
-
* Splits a stream into excluded and satisfying substreams using a predicate,
|
|
6469
|
-
* refinement, or Filter.
|
|
6470
|
-
*
|
|
6471
|
-
* The faster stream may advance up to `bufferSize` elements ahead of the slower
|
|
6472
|
-
* one.
|
|
6473
|
-
*
|
|
6474
|
-
* @since 4.0.0
|
|
6475
|
-
* @category Filtering
|
|
6476
|
-
*
|
|
6477
|
-
* @example
|
|
6478
|
-
* ```ts
|
|
6479
|
-
* import { Console, Effect, Stream } from "effect"
|
|
6480
|
-
*
|
|
6481
|
-
* const program = Effect.gen(function*() {
|
|
6482
|
-
* const [excluded, satisfying] = yield* Stream.partition(
|
|
6483
|
-
* Stream.make(1, 2, 3, 4),
|
|
6484
|
-
* (n) => n % 2 === 0
|
|
6485
|
-
* )
|
|
6486
|
-
* const left = yield* Stream.runCollect(excluded)
|
|
6487
|
-
* const right = yield* Stream.runCollect(satisfying)
|
|
6488
|
-
* yield* Console.log(left)
|
|
6489
|
-
* // Output: [ 1, 3 ]
|
|
6490
|
-
* yield* Console.log(right)
|
|
6491
|
-
* // Output: [ 2, 4 ]
|
|
6492
|
-
* })
|
|
6493
|
-
* ```
|
|
6494
|
-
*/
|
|
6495
|
-
<C extends A, B extends A, A = C>(
|
|
6496
|
-
refinement: Refinement<NoInfer<A>, B>,
|
|
6497
|
-
options?: { readonly bufferSize?: number | undefined }
|
|
6498
|
-
): <E, R>(
|
|
6499
|
-
self: Stream<C, E, R>
|
|
6500
|
-
) => Effect.Effect<
|
|
6501
|
-
[excluded: Stream<Exclude<C, B>, E>, satisfying: Stream<B, E>],
|
|
6502
|
-
never,
|
|
6503
|
-
R | Scope.Scope
|
|
6504
|
-
>
|
|
6505
|
-
/**
|
|
6506
|
-
* Splits a stream into excluded and satisfying substreams using a predicate,
|
|
6507
|
-
* refinement, or Filter.
|
|
6508
|
-
*
|
|
6509
|
-
* The faster stream may advance up to `bufferSize` elements ahead of the slower
|
|
6510
|
-
* one.
|
|
6511
|
-
*
|
|
6512
|
-
* @since 4.0.0
|
|
6513
|
-
* @category Filtering
|
|
6514
|
-
*
|
|
6515
|
-
* @example
|
|
6516
|
-
* ```ts
|
|
6517
|
-
* import { Console, Effect, Stream } from "effect"
|
|
6518
|
-
*
|
|
6519
|
-
* const program = Effect.gen(function*() {
|
|
6520
|
-
* const [excluded, satisfying] = yield* Stream.partition(
|
|
6521
|
-
* Stream.make(1, 2, 3, 4),
|
|
6522
|
-
* (n) => n % 2 === 0
|
|
6523
|
-
* )
|
|
6524
|
-
* const left = yield* Stream.runCollect(excluded)
|
|
6525
|
-
* const right = yield* Stream.runCollect(satisfying)
|
|
6526
|
-
* yield* Console.log(left)
|
|
6527
|
-
* // Output: [ 1, 3 ]
|
|
6528
|
-
* yield* Console.log(right)
|
|
6529
|
-
* // Output: [ 2, 4 ]
|
|
6530
|
-
* })
|
|
6531
|
-
* ```
|
|
6532
|
-
*/
|
|
6533
|
-
<A, Result extends Filter.ResultOrBool>(
|
|
6534
|
-
filter: Filter.OrPredicate<NoInfer<A>, Result>,
|
|
6535
|
-
options?: { readonly bufferSize?: number | undefined }
|
|
6536
|
-
): <E, R>(
|
|
6537
|
-
self: Stream<A, E, R>
|
|
6538
|
-
) => Effect.Effect<
|
|
6539
|
-
[excluded: Stream<Filter.Fail<A, Result>, E>, satisfying: Stream<Filter.Pass<A, Result>, E>],
|
|
6540
|
-
never,
|
|
6541
|
-
R | Scope.Scope
|
|
6542
|
-
>
|
|
6371
|
+
* import { Console, Effect, Result, Stream } from "effect"
|
|
6372
|
+
*
|
|
6373
|
+
* const program = Effect.gen(function*() {
|
|
6374
|
+
* const [excluded, satisfying] = yield* Stream.partition(
|
|
6375
|
+
* Stream.make(1, 2, 3, 4),
|
|
6376
|
+
* (n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n)
|
|
6377
|
+
* )
|
|
6378
|
+
* const left = yield* Stream.runCollect(excluded)
|
|
6379
|
+
* const right = yield* Stream.runCollect(satisfying)
|
|
6380
|
+
* yield* Console.log(left)
|
|
6381
|
+
* // Output: [ 1, 3 ]
|
|
6382
|
+
* yield* Console.log(right)
|
|
6383
|
+
* // Output: [ 2, 4 ]
|
|
6384
|
+
* })
|
|
6385
|
+
* ```
|
|
6386
|
+
*/
|
|
6387
|
+
export const partition: {
|
|
6543
6388
|
/**
|
|
6544
|
-
* Splits a stream into excluded and satisfying substreams using a
|
|
6545
|
-
* refinement, or Filter.
|
|
6389
|
+
* Splits a stream into excluded and satisfying substreams using a `Filter`.
|
|
6546
6390
|
*
|
|
6547
6391
|
* The faster stream may advance up to `bufferSize` elements ahead of the slower
|
|
6548
6392
|
* one.
|
|
@@ -6552,12 +6396,12 @@ export const partition: {
|
|
|
6552
6396
|
*
|
|
6553
6397
|
* @example
|
|
6554
6398
|
* ```ts
|
|
6555
|
-
* import { Console, Effect, Stream } from "effect"
|
|
6399
|
+
* import { Console, Effect, Result, Stream } from "effect"
|
|
6556
6400
|
*
|
|
6557
6401
|
* const program = Effect.gen(function*() {
|
|
6558
6402
|
* const [excluded, satisfying] = yield* Stream.partition(
|
|
6559
6403
|
* Stream.make(1, 2, 3, 4),
|
|
6560
|
-
* (n) => n % 2 === 0
|
|
6404
|
+
* (n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n)
|
|
6561
6405
|
* )
|
|
6562
6406
|
* const left = yield* Stream.runCollect(excluded)
|
|
6563
6407
|
* const right = yield* Stream.runCollect(satisfying)
|
|
@@ -6568,18 +6412,18 @@ export const partition: {
|
|
|
6568
6412
|
* })
|
|
6569
6413
|
* ```
|
|
6570
6414
|
*/
|
|
6571
|
-
<
|
|
6572
|
-
|
|
6573
|
-
refinement: Refinement<A, B>,
|
|
6415
|
+
<A, Pass, Fail>(
|
|
6416
|
+
filter: Filter.Filter<NoInfer<A>, Pass, Fail>,
|
|
6574
6417
|
options?: { readonly bufferSize?: number | undefined }
|
|
6575
|
-
):
|
|
6576
|
-
|
|
6418
|
+
): <E, R>(
|
|
6419
|
+
self: Stream<A, E, R>
|
|
6420
|
+
) => Effect.Effect<
|
|
6421
|
+
[excluded: Stream<Fail, E>, satisfying: Stream<Pass, E>],
|
|
6577
6422
|
never,
|
|
6578
6423
|
R | Scope.Scope
|
|
6579
6424
|
>
|
|
6580
6425
|
/**
|
|
6581
|
-
* Splits a stream into excluded and satisfying substreams using a
|
|
6582
|
-
* refinement, or Filter.
|
|
6426
|
+
* Splits a stream into excluded and satisfying substreams using a `Filter`.
|
|
6583
6427
|
*
|
|
6584
6428
|
* The faster stream may advance up to `bufferSize` elements ahead of the slower
|
|
6585
6429
|
* one.
|
|
@@ -6589,12 +6433,12 @@ export const partition: {
|
|
|
6589
6433
|
*
|
|
6590
6434
|
* @example
|
|
6591
6435
|
* ```ts
|
|
6592
|
-
* import { Console, Effect, Stream } from "effect"
|
|
6436
|
+
* import { Console, Effect, Result, Stream } from "effect"
|
|
6593
6437
|
*
|
|
6594
6438
|
* const program = Effect.gen(function*() {
|
|
6595
6439
|
* const [excluded, satisfying] = yield* Stream.partition(
|
|
6596
6440
|
* Stream.make(1, 2, 3, 4),
|
|
6597
|
-
* (n) => n % 2 === 0
|
|
6441
|
+
* (n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n)
|
|
6598
6442
|
* )
|
|
6599
6443
|
* const left = yield* Stream.runCollect(excluded)
|
|
6600
6444
|
* const right = yield* Stream.runCollect(satisfying)
|
|
@@ -6605,28 +6449,28 @@ export const partition: {
|
|
|
6605
6449
|
* })
|
|
6606
6450
|
* ```
|
|
6607
6451
|
*/
|
|
6608
|
-
<A, E, R,
|
|
6452
|
+
<A, E, R, Pass, Fail>(
|
|
6609
6453
|
self: Stream<A, E, R>,
|
|
6610
|
-
filter: Filter.
|
|
6454
|
+
filter: Filter.Filter<NoInfer<A>, Pass, Fail>,
|
|
6611
6455
|
options?: { readonly bufferSize?: number | undefined }
|
|
6612
6456
|
): Effect.Effect<
|
|
6613
|
-
[excluded: Stream<
|
|
6457
|
+
[excluded: Stream<Fail, E>, satisfying: Stream<Pass, E>],
|
|
6614
6458
|
never,
|
|
6615
6459
|
R | Scope.Scope
|
|
6616
6460
|
>
|
|
6617
6461
|
} = dual(
|
|
6618
6462
|
(args) => isStream(args[0]),
|
|
6619
|
-
<A, E, R,
|
|
6463
|
+
<A, E, R, Pass, Fail>(
|
|
6620
6464
|
self: Stream<A, E, R>,
|
|
6621
|
-
filter: Filter.
|
|
6465
|
+
filter: Filter.Filter<NoInfer<A>, Pass, Fail>,
|
|
6622
6466
|
options?: { readonly bufferSize?: number | undefined }
|
|
6623
6467
|
): Effect.Effect<
|
|
6624
|
-
[excluded: Stream<
|
|
6468
|
+
[excluded: Stream<Fail, E>, satisfying: Stream<Pass, E>],
|
|
6625
6469
|
never,
|
|
6626
6470
|
R | Scope.Scope
|
|
6627
6471
|
> =>
|
|
6628
6472
|
Effect.map(
|
|
6629
|
-
partitionQueue(filter, { capacity: options?.bufferSize ?? 16 })
|
|
6473
|
+
partitionQueue(self, filter, { capacity: options?.bufferSize ?? 16 }),
|
|
6630
6474
|
([passes, fails]) => [fromQueue(fails), fromQueue(passes)] as const
|
|
6631
6475
|
)
|
|
6632
6476
|
)
|
|
@@ -7408,7 +7252,7 @@ export const tapError: {
|
|
|
7408
7252
|
))
|
|
7409
7253
|
|
|
7410
7254
|
/**
|
|
7411
|
-
* Recovers from errors that match a
|
|
7255
|
+
* Recovers from errors that match a predicate by switching to a recovery stream.
|
|
7412
7256
|
*
|
|
7413
7257
|
* When a failure matches the filter, the stream switches to the recovery
|
|
7414
7258
|
* stream. Non-matching failures propagate downstream, so the error type is
|
|
@@ -7422,12 +7266,12 @@ export const tapError: {
|
|
|
7422
7266
|
*
|
|
7423
7267
|
* @example
|
|
7424
7268
|
* ```ts
|
|
7425
|
-
* import { Console, Effect,
|
|
7269
|
+
* import { Console, Effect, Stream } from "effect"
|
|
7426
7270
|
*
|
|
7427
7271
|
* const stream = Stream.make(1, 2).pipe(
|
|
7428
7272
|
* Stream.concat(Stream.fail(42)),
|
|
7429
7273
|
* Stream.catchIf(
|
|
7430
|
-
*
|
|
7274
|
+
* (error): error is 42 => error === 42,
|
|
7431
7275
|
* () => Stream.make(999)
|
|
7432
7276
|
* )
|
|
7433
7277
|
* )
|
|
@@ -7446,7 +7290,7 @@ export const tapError: {
|
|
|
7446
7290
|
*/
|
|
7447
7291
|
export const catchIf: {
|
|
7448
7292
|
/**
|
|
7449
|
-
* Recovers from errors that match a
|
|
7293
|
+
* Recovers from errors that match a predicate by switching to a recovery stream.
|
|
7450
7294
|
*
|
|
7451
7295
|
* When a failure matches the filter, the stream switches to the recovery
|
|
7452
7296
|
* stream. Non-matching failures propagate downstream, so the error type is
|
|
@@ -7460,12 +7304,12 @@ export const catchIf: {
|
|
|
7460
7304
|
*
|
|
7461
7305
|
* @example
|
|
7462
7306
|
* ```ts
|
|
7463
|
-
* import { Console, Effect,
|
|
7307
|
+
* import { Console, Effect, Stream } from "effect"
|
|
7464
7308
|
*
|
|
7465
7309
|
* const stream = Stream.make(1, 2).pipe(
|
|
7466
7310
|
* Stream.concat(Stream.fail(42)),
|
|
7467
7311
|
* Stream.catchIf(
|
|
7468
|
-
*
|
|
7312
|
+
* (error): error is 42 => error === 42,
|
|
7469
7313
|
* () => Stream.make(999)
|
|
7470
7314
|
* )
|
|
7471
7315
|
* )
|
|
@@ -7488,7 +7332,7 @@ export const catchIf: {
|
|
|
7488
7332
|
orElse?: ((e: Exclude<E, EB>) => Stream<A3, E3, R3>) | undefined
|
|
7489
7333
|
): <A, R>(self: Stream<A, E, R>) => Stream<A2 | A | A3, E2 | E3, R2 | R | R3>
|
|
7490
7334
|
/**
|
|
7491
|
-
* Recovers from errors that match a
|
|
7335
|
+
* Recovers from errors that match a predicate by switching to a recovery stream.
|
|
7492
7336
|
*
|
|
7493
7337
|
* When a failure matches the filter, the stream switches to the recovery
|
|
7494
7338
|
* stream. Non-matching failures propagate downstream, so the error type is
|
|
@@ -7502,12 +7346,12 @@ export const catchIf: {
|
|
|
7502
7346
|
*
|
|
7503
7347
|
* @example
|
|
7504
7348
|
* ```ts
|
|
7505
|
-
* import { Console, Effect,
|
|
7349
|
+
* import { Console, Effect, Stream } from "effect"
|
|
7506
7350
|
*
|
|
7507
7351
|
* const stream = Stream.make(1, 2).pipe(
|
|
7508
7352
|
* Stream.concat(Stream.fail(42)),
|
|
7509
7353
|
* Stream.catchIf(
|
|
7510
|
-
*
|
|
7354
|
+
* (error): error is 42 => error === 42,
|
|
7511
7355
|
* () => Stream.make(999)
|
|
7512
7356
|
* )
|
|
7513
7357
|
* )
|
|
@@ -7524,13 +7368,13 @@ export const catchIf: {
|
|
|
7524
7368
|
* @since 4.0.0
|
|
7525
7369
|
* @category Error Handling
|
|
7526
7370
|
*/
|
|
7527
|
-
<E,
|
|
7528
|
-
|
|
7529
|
-
f: (
|
|
7530
|
-
orElse?: ((
|
|
7531
|
-
): <A, R>(self: Stream<A, E, R>) => Stream<
|
|
7371
|
+
<E, A2, E2, R2, A3 = never, E3 = E, R3 = never>(
|
|
7372
|
+
predicate: Predicate<NoInfer<E>>,
|
|
7373
|
+
f: (e: NoInfer<E>) => Stream<A2, E2, R2>,
|
|
7374
|
+
orElse?: ((e: NoInfer<E>) => Stream<A3, E3, R3>) | undefined
|
|
7375
|
+
): <A, R>(self: Stream<A, E, R>) => Stream<A2 | A | A3, E2 | E3, R2 | R | R3>
|
|
7532
7376
|
/**
|
|
7533
|
-
* Recovers from errors that match a
|
|
7377
|
+
* Recovers from errors that match a predicate by switching to a recovery stream.
|
|
7534
7378
|
*
|
|
7535
7379
|
* When a failure matches the filter, the stream switches to the recovery
|
|
7536
7380
|
* stream. Non-matching failures propagate downstream, so the error type is
|
|
@@ -7544,12 +7388,12 @@ export const catchIf: {
|
|
|
7544
7388
|
*
|
|
7545
7389
|
* @example
|
|
7546
7390
|
* ```ts
|
|
7547
|
-
* import { Console, Effect,
|
|
7391
|
+
* import { Console, Effect, Stream } from "effect"
|
|
7548
7392
|
*
|
|
7549
7393
|
* const stream = Stream.make(1, 2).pipe(
|
|
7550
7394
|
* Stream.concat(Stream.fail(42)),
|
|
7551
7395
|
* Stream.catchIf(
|
|
7552
|
-
*
|
|
7396
|
+
* (error): error is 42 => error === 42,
|
|
7553
7397
|
* () => Stream.make(999)
|
|
7554
7398
|
* )
|
|
7555
7399
|
* )
|
|
@@ -7573,7 +7417,7 @@ export const catchIf: {
|
|
|
7573
7417
|
orElse?: ((e: Exclude<E, EB>) => Stream<A3, E3, R3>) | undefined
|
|
7574
7418
|
): Stream<A | A2 | A3, E2 | E3, R | R2 | R3>
|
|
7575
7419
|
/**
|
|
7576
|
-
* Recovers from errors that match a
|
|
7420
|
+
* Recovers from errors that match a predicate by switching to a recovery stream.
|
|
7577
7421
|
*
|
|
7578
7422
|
* When a failure matches the filter, the stream switches to the recovery
|
|
7579
7423
|
* stream. Non-matching failures propagate downstream, so the error type is
|
|
@@ -7587,12 +7431,12 @@ export const catchIf: {
|
|
|
7587
7431
|
*
|
|
7588
7432
|
* @example
|
|
7589
7433
|
* ```ts
|
|
7590
|
-
* import { Console, Effect,
|
|
7434
|
+
* import { Console, Effect, Stream } from "effect"
|
|
7591
7435
|
*
|
|
7592
7436
|
* const stream = Stream.make(1, 2).pipe(
|
|
7593
7437
|
* Stream.concat(Stream.fail(42)),
|
|
7594
7438
|
* Stream.catchIf(
|
|
7595
|
-
*
|
|
7439
|
+
* (error): error is 42 => error === 42,
|
|
7596
7440
|
* () => Stream.make(999)
|
|
7597
7441
|
* )
|
|
7598
7442
|
* )
|
|
@@ -7609,37 +7453,96 @@ export const catchIf: {
|
|
|
7609
7453
|
* @since 4.0.0
|
|
7610
7454
|
* @category Error Handling
|
|
7611
7455
|
*/
|
|
7612
|
-
<A, E, R,
|
|
7456
|
+
<A, E, R, A2, E2, R2, A3 = never, E3 = E, R3 = never>(
|
|
7613
7457
|
self: Stream<A, E, R>,
|
|
7614
|
-
|
|
7615
|
-
f: (
|
|
7616
|
-
orElse?: ((
|
|
7458
|
+
predicate: Predicate<E>,
|
|
7459
|
+
f: (e: E) => Stream<A2, E2, R2>,
|
|
7460
|
+
orElse?: ((e: E) => Stream<A3, E3, R3>) | undefined
|
|
7617
7461
|
): Stream<A | A2 | A3, E2 | E3, R | R2 | R3>
|
|
7618
7462
|
} = dual((args) => isStream(args[0]), <
|
|
7619
7463
|
A,
|
|
7620
7464
|
E,
|
|
7621
7465
|
R,
|
|
7622
|
-
Result extends Filter.ResultOrBool,
|
|
7623
7466
|
A2,
|
|
7624
7467
|
E2,
|
|
7625
7468
|
R2,
|
|
7626
7469
|
A3 = never,
|
|
7627
|
-
E3 =
|
|
7470
|
+
E3 = E,
|
|
7628
7471
|
R3 = never
|
|
7629
7472
|
>(
|
|
7630
7473
|
self: Stream<A, E, R>,
|
|
7631
|
-
|
|
7632
|
-
f: (failure:
|
|
7633
|
-
orElse?: ((failure:
|
|
7474
|
+
predicate: Predicate<E>,
|
|
7475
|
+
f: (failure: E) => Stream<A2, E2, R2>,
|
|
7476
|
+
orElse?: ((failure: E) => Stream<A3, E3, R3>) | undefined
|
|
7634
7477
|
): Stream<A | A2 | A3, E2 | E3, R | R2 | R3> =>
|
|
7635
7478
|
fromChannel(
|
|
7636
7479
|
Channel.catchIf(
|
|
7637
7480
|
toChannel(self),
|
|
7638
|
-
|
|
7639
|
-
(e
|
|
7640
|
-
orElse && ((e
|
|
7481
|
+
predicate,
|
|
7482
|
+
(e) => f(e).channel,
|
|
7483
|
+
orElse && ((e) => orElse(e).channel)
|
|
7484
|
+
)
|
|
7485
|
+
))
|
|
7486
|
+
|
|
7487
|
+
/**
|
|
7488
|
+
* Recovers from errors that match a `Filter` by switching to a recovery
|
|
7489
|
+
* stream.
|
|
7490
|
+
*
|
|
7491
|
+
* @since 4.0.0
|
|
7492
|
+
* @category Error Handling
|
|
7493
|
+
*/
|
|
7494
|
+
export const catchFilter: {
|
|
7495
|
+
/**
|
|
7496
|
+
* Recovers from errors that match a `Filter` by switching to a recovery
|
|
7497
|
+
* stream.
|
|
7498
|
+
*
|
|
7499
|
+
* @since 4.0.0
|
|
7500
|
+
* @category Error Handling
|
|
7501
|
+
*/
|
|
7502
|
+
<E, EB, A2, E2, R2, X, A3 = never, E3 = X, R3 = never>(
|
|
7503
|
+
filter: Filter.Filter<NoInfer<E>, EB, X>,
|
|
7504
|
+
f: (failure: EB) => Stream<A2, E2, R2>,
|
|
7505
|
+
orElse?: ((failure: X) => Stream<A3, E3, R3>) | undefined
|
|
7506
|
+
): <A, R>(self: Stream<A, E, R>) => Stream<A | A2 | A3, E2 | E3, R | R2 | R3>
|
|
7507
|
+
/**
|
|
7508
|
+
* Recovers from errors that match a `Filter` by switching to a recovery
|
|
7509
|
+
* stream.
|
|
7510
|
+
*
|
|
7511
|
+
* @since 4.0.0
|
|
7512
|
+
* @category Error Handling
|
|
7513
|
+
*/
|
|
7514
|
+
<A, E, R, EB, A2, E2, R2, X, A3 = never, E3 = X, R3 = never>(
|
|
7515
|
+
self: Stream<A, E, R>,
|
|
7516
|
+
filter: Filter.Filter<NoInfer<E>, EB, X>,
|
|
7517
|
+
f: (failure: EB) => Stream<A2, E2, R2>,
|
|
7518
|
+
orElse?: ((failure: X) => Stream<A3, E3, R3>) | undefined
|
|
7519
|
+
): Stream<A | A2 | A3, E2 | E3, R | R2 | R3>
|
|
7520
|
+
} = dual((args) => isStream(args[0]), <
|
|
7521
|
+
A,
|
|
7522
|
+
E,
|
|
7523
|
+
R,
|
|
7524
|
+
EB,
|
|
7525
|
+
A2,
|
|
7526
|
+
E2,
|
|
7527
|
+
R2,
|
|
7528
|
+
X,
|
|
7529
|
+
A3 = never,
|
|
7530
|
+
E3 = X,
|
|
7531
|
+
R3 = never
|
|
7532
|
+
>(
|
|
7533
|
+
self: Stream<A, E, R>,
|
|
7534
|
+
filter: Filter.Filter<NoInfer<E>, EB, X>,
|
|
7535
|
+
f: (failure: EB) => Stream<A2, E2, R2>,
|
|
7536
|
+
orElse?: ((failure: X) => Stream<A3, E3, R3>) | undefined
|
|
7537
|
+
): Stream<A | A2 | A3, E2 | E3, R | R2 | R3> =>
|
|
7538
|
+
fromChannel(
|
|
7539
|
+
Channel.catchFilter(
|
|
7540
|
+
toChannel(self),
|
|
7541
|
+
filter,
|
|
7542
|
+
(e) => f(e).channel,
|
|
7543
|
+
orElse && ((e) => orElse(e).channel)
|
|
7641
7544
|
)
|
|
7642
|
-
)
|
|
7545
|
+
))
|
|
7643
7546
|
|
|
7644
7547
|
/**
|
|
7645
7548
|
* Recovers from failures whose `_tag` matches the provided value by switching to
|
|
@@ -7978,7 +7881,7 @@ export const catchTags: {
|
|
|
7978
7881
|
>
|
|
7979
7882
|
} = dual((args) => isStream(args[0]), (self, cases, orElse) => {
|
|
7980
7883
|
let keys: Array<string>
|
|
7981
|
-
return
|
|
7884
|
+
return catchFilter(
|
|
7982
7885
|
self,
|
|
7983
7886
|
(e: any) => {
|
|
7984
7887
|
keys ??= Object.keys(cases)
|
|
@@ -8091,8 +7994,16 @@ export const catchReason: {
|
|
|
8091
7994
|
>(
|
|
8092
7995
|
errorTag: K,
|
|
8093
7996
|
reasonTag: RK,
|
|
8094
|
-
f: (
|
|
8095
|
-
|
|
7997
|
+
f: (
|
|
7998
|
+
reason: ExtractReason<ExtractTag<NoInfer<E>, K>, RK>,
|
|
7999
|
+
error: NarrowReason<ExtractTag<NoInfer<E>, K>, RK>
|
|
8000
|
+
) => Stream<A2, E2, R2>,
|
|
8001
|
+
orElse?:
|
|
8002
|
+
| ((
|
|
8003
|
+
reason: ExcludeReason<ExtractTag<NoInfer<E>, K>, RK>,
|
|
8004
|
+
error: OmitReason<ExtractTag<NoInfer<E>, K>, RK>
|
|
8005
|
+
) => Stream<A3, E3, R3>)
|
|
8006
|
+
| undefined
|
|
8096
8007
|
): <A, R>(
|
|
8097
8008
|
self: Stream<A, E, R>
|
|
8098
8009
|
) => Stream<A | A2 | Exclude<A3, unassigned>, (A3 extends unassigned ? E : ExcludeTag<E, K>) | E2 | E3, R | R2 | R3>
|
|
@@ -8155,8 +8066,10 @@ export const catchReason: {
|
|
|
8155
8066
|
self: Stream<A, E, R>,
|
|
8156
8067
|
errorTag: K,
|
|
8157
8068
|
reasonTag: RK,
|
|
8158
|
-
f: (reason: ExtractReason<ExtractTag<E, K>, RK>) => Stream<A2, E2, R2>,
|
|
8159
|
-
orElse?:
|
|
8069
|
+
f: (reason: ExtractReason<ExtractTag<E, K>, RK>, error: NarrowReason<ExtractTag<E, K>, RK>) => Stream<A2, E2, R2>,
|
|
8070
|
+
orElse?:
|
|
8071
|
+
| ((reason: ExcludeReason<ExtractTag<E, K>, RK>, error: OmitReason<ExtractTag<E, K>, RK>) => Stream<A3, E3, R3>)
|
|
8072
|
+
| undefined
|
|
8160
8073
|
): Stream<A | A2 | Exclude<A3, unassigned>, (A3 extends unassigned ? E : ExcludeTag<E, K>) | E2 | E3, R | R2 | R3>
|
|
8161
8074
|
} = dual(
|
|
8162
8075
|
(args) => isStream(args[0]),
|
|
@@ -8176,16 +8089,18 @@ export const catchReason: {
|
|
|
8176
8089
|
self: Stream<A, E, R>,
|
|
8177
8090
|
errorTag: K,
|
|
8178
8091
|
reasonTag: RK,
|
|
8179
|
-
f: (reason: ExtractReason<ExtractTag<E, K>, RK>) => Stream<A2, E2, R2>,
|
|
8180
|
-
orElse?:
|
|
8092
|
+
f: (reason: ExtractReason<ExtractTag<E, K>, RK>, error: NarrowReason<ExtractTag<E, K>, RK>) => Stream<A2, E2, R2>,
|
|
8093
|
+
orElse?:
|
|
8094
|
+
| ((reason: ExcludeReason<ExtractTag<E, K>, RK>, error: OmitReason<ExtractTag<E, K>, RK>) => Stream<A3, E3, R3>)
|
|
8095
|
+
| undefined
|
|
8181
8096
|
): Stream<A | A2 | Exclude<A3, unassigned>, (A3 extends unassigned ? E : ExcludeTag<E, K>) | E2 | E3, R | R2 | R3> =>
|
|
8182
8097
|
fromChannel(
|
|
8183
8098
|
Channel.catchReason(
|
|
8184
8099
|
toChannel(self),
|
|
8185
8100
|
errorTag,
|
|
8186
8101
|
reasonTag,
|
|
8187
|
-
(reason) => f(reason).channel,
|
|
8188
|
-
orElse && ((reason) => orElse(reason).channel)
|
|
8102
|
+
(reason, error) => f(reason, error).channel,
|
|
8103
|
+
orElse && ((reason, error) => orElse(reason, error).channel)
|
|
8189
8104
|
)
|
|
8190
8105
|
) as any
|
|
8191
8106
|
)
|
|
@@ -8278,7 +8193,8 @@ export const catchReasons: {
|
|
|
8278
8193
|
E,
|
|
8279
8194
|
Cases extends {
|
|
8280
8195
|
[RK in ReasonTags<ExtractTag<NoInfer<E>, K>>]+?: (
|
|
8281
|
-
reason: ExtractReason<ExtractTag<NoInfer<E>, K>, RK
|
|
8196
|
+
reason: ExtractReason<ExtractTag<NoInfer<E>, K>, RK>,
|
|
8197
|
+
error: NarrowReason<ExtractTag<NoInfer<E>, K>, RK>
|
|
8282
8198
|
) => Stream<any, any, any>
|
|
8283
8199
|
},
|
|
8284
8200
|
A2 = unassigned,
|
|
@@ -8288,7 +8204,10 @@ export const catchReasons: {
|
|
|
8288
8204
|
errorTag: K,
|
|
8289
8205
|
cases: Cases,
|
|
8290
8206
|
orElse?:
|
|
8291
|
-
| ((
|
|
8207
|
+
| ((
|
|
8208
|
+
reason: ExcludeReason<ExtractTag<NoInfer<E>, K>, Extract<keyof Cases, string>>,
|
|
8209
|
+
error: OmitReason<ExtractTag<NoInfer<E>, K>, Extract<keyof Cases, string>>
|
|
8210
|
+
) => Stream<A2, E2, R2>)
|
|
8292
8211
|
| undefined
|
|
8293
8212
|
): <A, R>(self: Stream<A, E, R>) => Stream<
|
|
8294
8213
|
| A
|
|
@@ -8355,7 +8274,8 @@ export const catchReasons: {
|
|
|
8355
8274
|
K extends Tags<E>,
|
|
8356
8275
|
Cases extends {
|
|
8357
8276
|
[RK in ReasonTags<ExtractTag<E, K>>]+?: (
|
|
8358
|
-
reason: ExtractReason<ExtractTag<E, K>, RK
|
|
8277
|
+
reason: ExtractReason<ExtractTag<E, K>, RK>,
|
|
8278
|
+
error: NarrowReason<ExtractTag<E, K>, RK>
|
|
8359
8279
|
) => Stream<any, any, any>
|
|
8360
8280
|
},
|
|
8361
8281
|
A2 = unassigned,
|
|
@@ -8366,7 +8286,10 @@ export const catchReasons: {
|
|
|
8366
8286
|
errorTag: K,
|
|
8367
8287
|
cases: Cases,
|
|
8368
8288
|
orElse?:
|
|
8369
|
-
| ((
|
|
8289
|
+
| ((
|
|
8290
|
+
reason: ExcludeReason<ExtractTag<NoInfer<E>, K>, Extract<keyof Cases, string>>,
|
|
8291
|
+
error: OmitReason<ExtractTag<NoInfer<E>, K>, Extract<keyof Cases, string>>
|
|
8292
|
+
) => Stream<A2, E2, R2>)
|
|
8370
8293
|
| undefined
|
|
8371
8294
|
): Stream<
|
|
8372
8295
|
| A
|
|
@@ -8386,12 +8309,12 @@ export const catchReasons: {
|
|
|
8386
8309
|
}[keyof Cases]
|
|
8387
8310
|
>
|
|
8388
8311
|
} = dual((args) => isStream(args[0]), (self, errorTag, cases, orElse) => {
|
|
8389
|
-
const handlers: Record<string, (reason: any) => Channel.Channel<any, any, any, any, any, any, any>> = {}
|
|
8312
|
+
const handlers: Record<string, (reason: any, error: any) => Channel.Channel<any, any, any, any, any, any, any>> = {}
|
|
8390
8313
|
for (const key of Object.keys(cases)) {
|
|
8391
8314
|
const handler = (cases as any)[key]
|
|
8392
|
-
handlers[key] = (reason) => handler(reason).channel
|
|
8315
|
+
handlers[key] = (reason, error) => handler(reason, error).channel
|
|
8393
8316
|
}
|
|
8394
|
-
const orElseHandler = orElse && ((reason: any) => orElse(reason).channel)
|
|
8317
|
+
const orElseHandler = orElse && ((reason: any, error: any) => orElse(reason, error).channel)
|
|
8395
8318
|
return fromChannel(
|
|
8396
8319
|
Channel.catchReasons(self.channel, errorTag as any, handlers as any, orElseHandler as any) as Channel.Channel<
|
|
8397
8320
|
Arr.NonEmptyReadonlyArray<any>,
|
|
@@ -8549,12 +8472,12 @@ export const catchCauseIf: {
|
|
|
8549
8472
|
* @since 4.0.0
|
|
8550
8473
|
* @category Error Handling
|
|
8551
8474
|
*/
|
|
8552
|
-
<E,
|
|
8553
|
-
|
|
8554
|
-
f: (
|
|
8475
|
+
<E, A2, E2, R2>(
|
|
8476
|
+
predicate: Predicate<Cause.Cause<E>>,
|
|
8477
|
+
f: (cause: Cause.Cause<E>) => Stream<A2, E2, R2>
|
|
8555
8478
|
): <A, R>(
|
|
8556
8479
|
self: Stream<A, E, R>
|
|
8557
|
-
) => Stream<A | A2,
|
|
8480
|
+
) => Stream<A | A2, E | E2, R2 | R>
|
|
8558
8481
|
/**
|
|
8559
8482
|
* Recovers from stream failures by filtering the `Cause` and switching to a recovery stream.
|
|
8560
8483
|
* Non-matching causes are re-emitted as failures.
|
|
@@ -8588,19 +8511,68 @@ export const catchCauseIf: {
|
|
|
8588
8511
|
* @since 4.0.0
|
|
8589
8512
|
* @category Error Handling
|
|
8590
8513
|
*/
|
|
8591
|
-
<A, E, R, A2, E2, R2
|
|
8514
|
+
<A, E, R, A2, E2, R2>(
|
|
8515
|
+
self: Stream<A, E, R>,
|
|
8516
|
+
predicate: Predicate<Cause.Cause<E>>,
|
|
8517
|
+
f: (cause: Cause.Cause<E>) => Stream<A2, E2, R2>
|
|
8518
|
+
): Stream<A | A2, E | E2, R | R2>
|
|
8519
|
+
} = dual(3, <A, E, R, A2, E2, R2>(
|
|
8520
|
+
self: Stream<A, E, R>,
|
|
8521
|
+
predicate: Predicate<Cause.Cause<E>>,
|
|
8522
|
+
f: (cause: Cause.Cause<E>) => Stream<A2, E2, R2>
|
|
8523
|
+
): Stream<A | A2, E | E2, R | R2> =>
|
|
8524
|
+
fromChannel(
|
|
8525
|
+
Channel.catchCauseIf(
|
|
8526
|
+
self.channel,
|
|
8527
|
+
predicate,
|
|
8528
|
+
(cause) => f(cause).channel
|
|
8529
|
+
)
|
|
8530
|
+
))
|
|
8531
|
+
|
|
8532
|
+
/**
|
|
8533
|
+
* Recovers from stream failures by filtering the `Cause` and switching to a
|
|
8534
|
+
* recovery stream.
|
|
8535
|
+
*
|
|
8536
|
+
* @since 4.0.0
|
|
8537
|
+
* @category Error Handling
|
|
8538
|
+
*/
|
|
8539
|
+
export const catchCauseFilter: {
|
|
8540
|
+
/**
|
|
8541
|
+
* Recovers from stream failures by filtering the `Cause` and switching to a
|
|
8542
|
+
* recovery stream.
|
|
8543
|
+
*
|
|
8544
|
+
* @since 4.0.0
|
|
8545
|
+
* @category Error Handling
|
|
8546
|
+
*/
|
|
8547
|
+
<E, EB, A2, E2, R2, X extends Cause.Cause<any>>(
|
|
8548
|
+
filter: Filter.Filter<Cause.Cause<E>, EB, X>,
|
|
8549
|
+
f: (failure: EB, cause: Cause.Cause<E>) => Stream<A2, E2, R2>
|
|
8550
|
+
): <A, R>(
|
|
8551
|
+
self: Stream<A, E, R>
|
|
8552
|
+
) => Stream<A | A2, Cause.Cause.Error<X> | E2, R2 | R>
|
|
8553
|
+
/**
|
|
8554
|
+
* Recovers from stream failures by filtering the `Cause` and switching to a
|
|
8555
|
+
* recovery stream.
|
|
8556
|
+
*
|
|
8557
|
+
* @since 4.0.0
|
|
8558
|
+
* @category Error Handling
|
|
8559
|
+
*/
|
|
8560
|
+
<A, E, R, EB, A2, E2, R2, X extends Cause.Cause<any>>(
|
|
8592
8561
|
self: Stream<A, E, R>,
|
|
8593
|
-
filter: Filter.
|
|
8594
|
-
f: (failure:
|
|
8595
|
-
): Stream<A | A2, Cause.Cause.Error<
|
|
8596
|
-
} = dual(3, <A, E, R, A2, E2, R2,
|
|
8562
|
+
filter: Filter.Filter<Cause.Cause<E>, EB, X>,
|
|
8563
|
+
f: (failure: EB, cause: Cause.Cause<E>) => Stream<A2, E2, R2>
|
|
8564
|
+
): Stream<A | A2, Cause.Cause.Error<X> | E2, R | R2>
|
|
8565
|
+
} = dual(3, <A, E, R, EB, A2, E2, R2, X extends Cause.Cause<any>>(
|
|
8597
8566
|
self: Stream<A, E, R>,
|
|
8598
|
-
filter: Filter.
|
|
8599
|
-
f: (failure:
|
|
8600
|
-
): Stream<A | A2, Cause.Cause.Error<
|
|
8567
|
+
filter: Filter.Filter<Cause.Cause<E>, EB, X>,
|
|
8568
|
+
f: (failure: EB, cause: Cause.Cause<E>) => Stream<A2, E2, R2>
|
|
8569
|
+
): Stream<A | A2, Cause.Cause.Error<X> | E2, R | R2> =>
|
|
8601
8570
|
fromChannel(
|
|
8602
|
-
Channel.
|
|
8603
|
-
|
|
8571
|
+
Channel.catchCauseFilter(
|
|
8572
|
+
self.channel,
|
|
8573
|
+
filter,
|
|
8574
|
+
(failure, cause) => f(failure, cause).channel
|
|
8575
|
+
)
|
|
8604
8576
|
))
|
|
8605
8577
|
|
|
8606
8578
|
/**
|
|
@@ -8819,12 +8791,12 @@ export const orDie = <A, E, R>(self: Stream<A, E, R>): Stream<A, never, R> => fr
|
|
|
8819
8791
|
*/
|
|
8820
8792
|
export const ignore: <
|
|
8821
8793
|
Arg extends Stream<any, any, any> | {
|
|
8822
|
-
readonly log?: boolean |
|
|
8794
|
+
readonly log?: boolean | Severity | undefined
|
|
8823
8795
|
} | undefined
|
|
8824
8796
|
>(
|
|
8825
8797
|
selfOrOptions: Arg,
|
|
8826
8798
|
options?: {
|
|
8827
|
-
readonly log?: boolean |
|
|
8799
|
+
readonly log?: boolean | Severity | undefined
|
|
8828
8800
|
} | undefined
|
|
8829
8801
|
) => [Arg] extends [Stream<infer A, infer _E, infer R>] ? Stream<A, never, R>
|
|
8830
8802
|
: <A, E, R>(self: Stream<A, E, R>) => Stream<A, never, R> = dual(
|
|
@@ -8832,7 +8804,7 @@ export const ignore: <
|
|
|
8832
8804
|
<A, E, R>(
|
|
8833
8805
|
self: Stream<A, E, R>,
|
|
8834
8806
|
options?: {
|
|
8835
|
-
readonly log?: boolean |
|
|
8807
|
+
readonly log?: boolean | Severity | undefined
|
|
8836
8808
|
} | undefined
|
|
8837
8809
|
): Stream<A, never, R> => fromChannel(Channel.ignore(self.channel, options))
|
|
8838
8810
|
)
|
|
@@ -8859,19 +8831,19 @@ export const ignore: <
|
|
|
8859
8831
|
*/
|
|
8860
8832
|
export const ignoreCause: <
|
|
8861
8833
|
Arg extends Stream<any, any, any> | {
|
|
8862
|
-
readonly log?: boolean |
|
|
8834
|
+
readonly log?: boolean | Severity | undefined
|
|
8863
8835
|
} | undefined
|
|
8864
8836
|
>(
|
|
8865
8837
|
streamOrOptions: Arg,
|
|
8866
8838
|
options?: {
|
|
8867
|
-
readonly log?: boolean |
|
|
8839
|
+
readonly log?: boolean | Severity | undefined
|
|
8868
8840
|
} | undefined
|
|
8869
8841
|
) => [Arg] extends [Stream<infer A, infer _E, infer R>] ? Stream<A, never, R>
|
|
8870
8842
|
: <A, E, R>(self: Stream<A, E, R>) => Stream<A, never, R> = dual(
|
|
8871
8843
|
(args) => isStream(args[0]),
|
|
8872
8844
|
<A, E, R>(
|
|
8873
8845
|
self: Stream<A, E, R>,
|
|
8874
|
-
options?: { readonly log?: boolean |
|
|
8846
|
+
options?: { readonly log?: boolean | Severity | undefined } | undefined
|
|
8875
8847
|
): Stream<A, never, R> => fromChannel(Channel.ignoreCause(self.channel, options))
|
|
8876
8848
|
)
|
|
8877
8849
|
|
|
@@ -9741,7 +9713,7 @@ export const takeWhile: {
|
|
|
9741
9713
|
* @since 2.0.0
|
|
9742
9714
|
* @category Filtering
|
|
9743
9715
|
*/
|
|
9744
|
-
<A,
|
|
9716
|
+
<A, E, R, B extends A>(self: Stream<A, E, R>, refinement: (a: NoInfer<A>, n: number) => a is B): Stream<B, E, R>
|
|
9745
9717
|
/**
|
|
9746
9718
|
* Takes the longest initial prefix of elements that satisfy the predicate.
|
|
9747
9719
|
*
|
|
@@ -9765,71 +9737,71 @@ export const takeWhile: {
|
|
|
9765
9737
|
* @since 2.0.0
|
|
9766
9738
|
* @category Filtering
|
|
9767
9739
|
*/
|
|
9768
|
-
<A, E, R
|
|
9740
|
+
<A, E, R>(self: Stream<A, E, R>, predicate: (a: NoInfer<A>, n: number) => boolean): Stream<A, E, R>
|
|
9741
|
+
} = dual(
|
|
9742
|
+
2,
|
|
9743
|
+
<A, E, R>(
|
|
9744
|
+
self: Stream<A, E, R>,
|
|
9745
|
+
predicate: (a: A, n: number) => boolean
|
|
9746
|
+
): Stream<A, E, R> =>
|
|
9747
|
+
transformPull(self, (pull, _scope) =>
|
|
9748
|
+
Effect.sync(() => {
|
|
9749
|
+
let i = 0
|
|
9750
|
+
let done = false
|
|
9751
|
+
const pump: Pull.Pull<Arr.NonEmptyReadonlyArray<A>, E, void, R> = Effect.flatMap(
|
|
9752
|
+
Effect.suspend(() => done ? Cause.done() : pull),
|
|
9753
|
+
(chunk) => {
|
|
9754
|
+
const out: Array<A> = []
|
|
9755
|
+
for (let j = 0; j < chunk.length; j++) {
|
|
9756
|
+
if (!predicate(chunk[j], i++)) {
|
|
9757
|
+
done = true
|
|
9758
|
+
break
|
|
9759
|
+
}
|
|
9760
|
+
out.push(chunk[j])
|
|
9761
|
+
}
|
|
9762
|
+
return Arr.isReadonlyArrayNonEmpty(out) ? Effect.succeed(out) : done ? Cause.done() : pump
|
|
9763
|
+
}
|
|
9764
|
+
)
|
|
9765
|
+
return pump
|
|
9766
|
+
}))
|
|
9767
|
+
)
|
|
9768
|
+
|
|
9769
|
+
/**
|
|
9770
|
+
* Takes the longest initial prefix of elements that satisfy the filter.
|
|
9771
|
+
*
|
|
9772
|
+
* @since 4.0.0
|
|
9773
|
+
* @category Filtering
|
|
9774
|
+
*/
|
|
9775
|
+
export const takeWhileFilter: {
|
|
9769
9776
|
/**
|
|
9770
|
-
* Takes the longest initial prefix of elements that satisfy the
|
|
9771
|
-
*
|
|
9772
|
-
* @example
|
|
9773
|
-
* ```ts
|
|
9774
|
-
* import { Console, Effect, Stream } from "effect"
|
|
9775
|
-
*
|
|
9776
|
-
* const stream = Stream.range(1, 5).pipe(
|
|
9777
|
-
* Stream.takeWhile((n) => n % 3 !== 0)
|
|
9778
|
-
* )
|
|
9779
|
-
*
|
|
9780
|
-
* const program = Effect.gen(function*() {
|
|
9781
|
-
* const result = yield* Stream.runCollect(stream)
|
|
9782
|
-
* yield* Console.log(result)
|
|
9783
|
-
* })
|
|
9784
|
-
*
|
|
9785
|
-
* Effect.runPromise(program)
|
|
9786
|
-
* // Output: [ 1, 2 ]
|
|
9787
|
-
* ```
|
|
9777
|
+
* Takes the longest initial prefix of elements that satisfy the filter.
|
|
9788
9778
|
*
|
|
9789
|
-
* @since
|
|
9779
|
+
* @since 4.0.0
|
|
9790
9780
|
* @category Filtering
|
|
9791
9781
|
*/
|
|
9792
|
-
<A,
|
|
9782
|
+
<A, B, X>(f: Filter.Filter<NoInfer<A>, B, X>): <E, R>(self: Stream<A, E, R>) => Stream<B, E, R>
|
|
9793
9783
|
/**
|
|
9794
|
-
* Takes the longest initial prefix of elements that satisfy the
|
|
9795
|
-
*
|
|
9796
|
-
* @example
|
|
9797
|
-
* ```ts
|
|
9798
|
-
* import { Console, Effect, Stream } from "effect"
|
|
9799
|
-
*
|
|
9800
|
-
* const stream = Stream.range(1, 5).pipe(
|
|
9801
|
-
* Stream.takeWhile((n) => n % 3 !== 0)
|
|
9802
|
-
* )
|
|
9803
|
-
*
|
|
9804
|
-
* const program = Effect.gen(function*() {
|
|
9805
|
-
* const result = yield* Stream.runCollect(stream)
|
|
9806
|
-
* yield* Console.log(result)
|
|
9807
|
-
* })
|
|
9808
|
-
*
|
|
9809
|
-
* Effect.runPromise(program)
|
|
9810
|
-
* // Output: [ 1, 2 ]
|
|
9811
|
-
* ```
|
|
9784
|
+
* Takes the longest initial prefix of elements that satisfy the filter.
|
|
9812
9785
|
*
|
|
9813
|
-
* @since
|
|
9786
|
+
* @since 4.0.0
|
|
9814
9787
|
* @category Filtering
|
|
9815
9788
|
*/
|
|
9816
9789
|
<A, E, R, B, X>(self: Stream<A, E, R>, f: Filter.Filter<NoInfer<A>, B, X>): Stream<B, E, R>
|
|
9817
9790
|
} = dual(
|
|
9818
9791
|
2,
|
|
9819
|
-
<A, E, R>(
|
|
9792
|
+
<A, E, R, B, X>(
|
|
9820
9793
|
self: Stream<A, E, R>,
|
|
9821
|
-
|
|
9822
|
-
): Stream<
|
|
9794
|
+
filter: Filter.Filter<NoInfer<A>, B, X>
|
|
9795
|
+
): Stream<B, E, R> =>
|
|
9823
9796
|
transformPull(self, (pull, _scope) =>
|
|
9824
9797
|
Effect.sync(() => {
|
|
9825
|
-
let i = 0
|
|
9826
9798
|
let done = false
|
|
9827
|
-
const pump: Pull.Pull<Arr.NonEmptyReadonlyArray<
|
|
9799
|
+
const pump: Pull.Pull<Arr.NonEmptyReadonlyArray<B>, E, void, R> = Effect.flatMap(
|
|
9828
9800
|
Effect.suspend(() => done ? Cause.done() : pull),
|
|
9829
9801
|
(chunk) => {
|
|
9830
|
-
const out: Array<
|
|
9802
|
+
const out: Array<B> = []
|
|
9831
9803
|
for (let j = 0; j < chunk.length; j++) {
|
|
9832
|
-
const result =
|
|
9804
|
+
const result = filter(chunk[j])
|
|
9833
9805
|
if (Result.isFailure(result)) {
|
|
9834
9806
|
done = true
|
|
9835
9807
|
break
|
|
@@ -10224,29 +10196,6 @@ export const dropWhile: {
|
|
|
10224
10196
|
* @category Filtering
|
|
10225
10197
|
*/
|
|
10226
10198
|
<A>(predicate: (a: NoInfer<A>, index: number) => boolean): <E, R>(self: Stream<A, E, R>) => Stream<A, E, R>
|
|
10227
|
-
/**
|
|
10228
|
-
* Drops elements from the stream while the specified predicate evaluates to `true`.
|
|
10229
|
-
*
|
|
10230
|
-
* @example
|
|
10231
|
-
* ```ts
|
|
10232
|
-
* import { Console, Effect, Stream } from "effect"
|
|
10233
|
-
*
|
|
10234
|
-
* const program = Effect.gen(function*() {
|
|
10235
|
-
* const values = yield* Stream.make(1, 2, 3, 4, 5).pipe(
|
|
10236
|
-
* Stream.dropWhile((n) => n < 3),
|
|
10237
|
-
* Stream.runCollect
|
|
10238
|
-
* )
|
|
10239
|
-
* yield* Console.log(values)
|
|
10240
|
-
* })
|
|
10241
|
-
*
|
|
10242
|
-
* Effect.runPromise(program)
|
|
10243
|
-
* // Output: [ 3, 4, 5 ]
|
|
10244
|
-
* ```
|
|
10245
|
-
*
|
|
10246
|
-
* @since 2.0.0
|
|
10247
|
-
* @category Filtering
|
|
10248
|
-
*/
|
|
10249
|
-
<A, B, X>(f: Filter.Filter<NoInfer<A>, B, X>): <E, R>(self: Stream<A, E, R>) => Stream<A, E, R>
|
|
10250
10199
|
/**
|
|
10251
10200
|
* Drops elements from the stream while the specified predicate evaluates to `true`.
|
|
10252
10201
|
*
|
|
@@ -10273,39 +10222,53 @@ export const dropWhile: {
|
|
|
10273
10222
|
self: Stream<A, E, R>,
|
|
10274
10223
|
predicate: (a: NoInfer<A>, index: number) => boolean
|
|
10275
10224
|
): Stream<A, E, R>
|
|
10225
|
+
} = dual(2, <A, E, R>(
|
|
10226
|
+
self: Stream<A, E, R>,
|
|
10227
|
+
predicate: (a: A, index: number) => boolean
|
|
10228
|
+
): Stream<A, E, R> =>
|
|
10229
|
+
transformPull(self, (pull, _scope) =>
|
|
10230
|
+
Effect.sync(() => {
|
|
10231
|
+
let dropping = true
|
|
10232
|
+
let index = 0
|
|
10233
|
+
const filtered: Pull.Pull<Arr.NonEmptyReadonlyArray<A>, E> = Effect.flatMap(pull, (arr) => {
|
|
10234
|
+
const found = arr.findIndex((a) => !predicate(a, index++))
|
|
10235
|
+
if (found === -1) return filtered
|
|
10236
|
+
dropping = false
|
|
10237
|
+
return Effect.succeed(arr.slice(found) as Arr.NonEmptyArray<A>)
|
|
10238
|
+
})
|
|
10239
|
+
return Effect.suspend(() => dropping ? filtered : pull)
|
|
10240
|
+
})))
|
|
10241
|
+
|
|
10242
|
+
/**
|
|
10243
|
+
* Drops elements while the filter succeeds.
|
|
10244
|
+
*
|
|
10245
|
+
* @since 4.0.0
|
|
10246
|
+
* @category Filtering
|
|
10247
|
+
*/
|
|
10248
|
+
export const dropWhileFilter: {
|
|
10276
10249
|
/**
|
|
10277
|
-
* Drops elements
|
|
10278
|
-
*
|
|
10279
|
-
* @example
|
|
10280
|
-
* ```ts
|
|
10281
|
-
* import { Console, Effect, Stream } from "effect"
|
|
10282
|
-
*
|
|
10283
|
-
* const program = Effect.gen(function*() {
|
|
10284
|
-
* const values = yield* Stream.make(1, 2, 3, 4, 5).pipe(
|
|
10285
|
-
* Stream.dropWhile((n) => n < 3),
|
|
10286
|
-
* Stream.runCollect
|
|
10287
|
-
* )
|
|
10288
|
-
* yield* Console.log(values)
|
|
10289
|
-
* })
|
|
10250
|
+
* Drops elements while the filter succeeds.
|
|
10290
10251
|
*
|
|
10291
|
-
*
|
|
10292
|
-
*
|
|
10293
|
-
|
|
10252
|
+
* @since 4.0.0
|
|
10253
|
+
* @category Filtering
|
|
10254
|
+
*/
|
|
10255
|
+
<A, B, X>(filter: Filter.Filter<NoInfer<A>, B, X>): <E, R>(self: Stream<A, E, R>) => Stream<A, E, R>
|
|
10256
|
+
/**
|
|
10257
|
+
* Drops elements while the filter succeeds.
|
|
10294
10258
|
*
|
|
10295
|
-
* @since
|
|
10259
|
+
* @since 4.0.0
|
|
10296
10260
|
* @category Filtering
|
|
10297
10261
|
*/
|
|
10298
|
-
<A, E, R, B, X>(self: Stream<A, E, R>,
|
|
10299
|
-
} = dual(2, <A, E, R>(
|
|
10262
|
+
<A, E, R, B, X>(self: Stream<A, E, R>, filter: Filter.Filter<NoInfer<A>, B, X>): Stream<A, E, R>
|
|
10263
|
+
} = dual(2, <A, E, R, B, X>(
|
|
10300
10264
|
self: Stream<A, E, R>,
|
|
10301
|
-
|
|
10265
|
+
filter: Filter.Filter<NoInfer<A>, B, X>
|
|
10302
10266
|
): Stream<A, E, R> =>
|
|
10303
10267
|
transformPull(self, (pull, _scope) =>
|
|
10304
10268
|
Effect.sync(() => {
|
|
10305
10269
|
let dropping = true
|
|
10306
|
-
let index = 0
|
|
10307
10270
|
const filtered: Pull.Pull<Arr.NonEmptyReadonlyArray<A>, E> = Effect.flatMap(pull, (arr) => {
|
|
10308
|
-
const found = arr.findIndex((a) => Result.isFailure(
|
|
10271
|
+
const found = arr.findIndex((a) => Result.isFailure(filter(a)))
|
|
10309
10272
|
if (found === -1) return filtered
|
|
10310
10273
|
dropping = false
|
|
10311
10274
|
return Effect.succeed(arr.slice(found) as Arr.NonEmptyArray<A>)
|
|
@@ -12174,7 +12137,7 @@ export const debounce: {
|
|
|
12174
12137
|
* @since 2.0.0
|
|
12175
12138
|
* @category Rate Limiting
|
|
12176
12139
|
*/
|
|
12177
|
-
(duration: Duration.
|
|
12140
|
+
(duration: Duration.Input): <A, E, R>(self: Stream<A, E, R>) => Stream<A, E, R>
|
|
12178
12141
|
/**
|
|
12179
12142
|
* Drops earlier elements within the debounce window and emits only the latest element after the pause.
|
|
12180
12143
|
*
|
|
@@ -12198,21 +12161,21 @@ export const debounce: {
|
|
|
12198
12161
|
* @since 2.0.0
|
|
12199
12162
|
* @category Rate Limiting
|
|
12200
12163
|
*/
|
|
12201
|
-
<A, E, R>(self: Stream<A, E, R>, duration: Duration.
|
|
12164
|
+
<A, E, R>(self: Stream<A, E, R>, duration: Duration.Input): Stream<A, E, R>
|
|
12202
12165
|
} = dual(
|
|
12203
12166
|
2,
|
|
12204
|
-
<A, E, R>(self: Stream<A, E, R>, duration: Duration.
|
|
12167
|
+
<A, E, R>(self: Stream<A, E, R>, duration: Duration.Input): Stream<A, E, R> =>
|
|
12205
12168
|
transformPull(
|
|
12206
12169
|
self,
|
|
12207
12170
|
Effect.fnUntraced(function*(pull, scope) {
|
|
12208
12171
|
const clock = yield* Clock
|
|
12209
|
-
const durationMs = Duration.toMillis(Duration.
|
|
12172
|
+
const durationMs = Duration.toMillis(Duration.fromInputUnsafe(duration))
|
|
12210
12173
|
let lastArr: Arr.NonEmptyReadonlyArray<A> | undefined
|
|
12211
12174
|
let cause: Cause.Cause<Cause.Done | E> | undefined
|
|
12212
12175
|
let emitAtMs = Infinity
|
|
12213
|
-
const pullLatch =
|
|
12214
|
-
const emitLatch =
|
|
12215
|
-
const endLatch =
|
|
12176
|
+
const pullLatch = Latch.makeUnsafe()
|
|
12177
|
+
const emitLatch = Latch.makeUnsafe()
|
|
12178
|
+
const endLatch = Latch.makeUnsafe()
|
|
12216
12179
|
|
|
12217
12180
|
yield* pull.pipe(
|
|
12218
12181
|
pullLatch.whenOpen,
|
|
@@ -12346,7 +12309,7 @@ export const throttleEffect: {
|
|
|
12346
12309
|
options: {
|
|
12347
12310
|
readonly cost: (arr: Arr.NonEmptyReadonlyArray<A>) => Effect.Effect<number, E2, R2>
|
|
12348
12311
|
readonly units: number
|
|
12349
|
-
readonly duration: Duration.
|
|
12312
|
+
readonly duration: Duration.Input
|
|
12350
12313
|
readonly burst?: number | undefined
|
|
12351
12314
|
readonly strategy?: "enforce" | "shape" | undefined
|
|
12352
12315
|
}
|
|
@@ -12392,7 +12355,7 @@ export const throttleEffect: {
|
|
|
12392
12355
|
options: {
|
|
12393
12356
|
readonly cost: (arr: Arr.NonEmptyReadonlyArray<A>) => Effect.Effect<number, E2, R2>
|
|
12394
12357
|
readonly units: number
|
|
12395
|
-
readonly duration: Duration.
|
|
12358
|
+
readonly duration: Duration.Input
|
|
12396
12359
|
readonly burst?: number | undefined
|
|
12397
12360
|
readonly strategy?: "enforce" | "shape" | undefined
|
|
12398
12361
|
}
|
|
@@ -12404,7 +12367,7 @@ export const throttleEffect: {
|
|
|
12404
12367
|
options: {
|
|
12405
12368
|
readonly cost: (arr: Arr.NonEmptyReadonlyArray<A>) => Effect.Effect<number, E2, R2>
|
|
12406
12369
|
readonly units: number
|
|
12407
|
-
readonly duration: Duration.
|
|
12370
|
+
readonly duration: Duration.Input
|
|
12408
12371
|
readonly burst?: number | undefined
|
|
12409
12372
|
readonly strategy?: "enforce" | "shape" | undefined
|
|
12410
12373
|
}
|
|
@@ -12421,12 +12384,12 @@ const throttleEnforceEffect = <A, E, R, E2, R2>(
|
|
|
12421
12384
|
self: Stream<A, E, R>,
|
|
12422
12385
|
cost: (arr: Arr.NonEmptyReadonlyArray<A>) => Effect.Effect<number, E2, R2>,
|
|
12423
12386
|
units: number,
|
|
12424
|
-
duration: Duration.
|
|
12387
|
+
duration: Duration.Input,
|
|
12425
12388
|
burst: number
|
|
12426
12389
|
): Stream<A, E | E2, R | R2> =>
|
|
12427
12390
|
transformPull(self, (pull) =>
|
|
12428
12391
|
Effect.clockWith((clock) => {
|
|
12429
|
-
const durationMs = Duration.toMillis(Duration.
|
|
12392
|
+
const durationMs = Duration.toMillis(Duration.fromInputUnsafe(duration))
|
|
12430
12393
|
const max = units + burst < 0 ? Number.POSITIVE_INFINITY : units + burst
|
|
12431
12394
|
let tokens = units
|
|
12432
12395
|
let timestampMs = clock.currentTimeMillisUnsafe()
|
|
@@ -12457,12 +12420,12 @@ const throttleShapeEffect = <A, E, R, E2, R2>(
|
|
|
12457
12420
|
self: Stream<A, E, R>,
|
|
12458
12421
|
cost: (arr: Arr.NonEmptyReadonlyArray<A>) => Effect.Effect<number, E2, R2>,
|
|
12459
12422
|
units: number,
|
|
12460
|
-
duration: Duration.
|
|
12423
|
+
duration: Duration.Input,
|
|
12461
12424
|
burst: number
|
|
12462
12425
|
): Stream<A, E | E2, R | R2> =>
|
|
12463
12426
|
transformPull(self, (pull) =>
|
|
12464
12427
|
Effect.clockWith((clock) => {
|
|
12465
|
-
const durationMs = Duration.toMillis(Duration.
|
|
12428
|
+
const durationMs = Duration.toMillis(Duration.fromInputUnsafe(duration))
|
|
12466
12429
|
const max = units + burst < 0 ? Number.POSITIVE_INFINITY : units + burst
|
|
12467
12430
|
let tokens = units
|
|
12468
12431
|
let timestampMs = clock.currentTimeMillisUnsafe()
|
|
@@ -12575,7 +12538,7 @@ export const throttle: {
|
|
|
12575
12538
|
options: {
|
|
12576
12539
|
readonly cost: (arr: Arr.NonEmptyReadonlyArray<A>) => number
|
|
12577
12540
|
readonly units: number
|
|
12578
|
-
readonly duration: Duration.
|
|
12541
|
+
readonly duration: Duration.Input
|
|
12579
12542
|
readonly burst?: number | undefined
|
|
12580
12543
|
readonly strategy?: "enforce" | "shape" | undefined
|
|
12581
12544
|
}
|
|
@@ -12620,7 +12583,7 @@ export const throttle: {
|
|
|
12620
12583
|
options: {
|
|
12621
12584
|
readonly cost: (arr: Arr.NonEmptyReadonlyArray<A>) => number
|
|
12622
12585
|
readonly units: number
|
|
12623
|
-
readonly duration: Duration.
|
|
12586
|
+
readonly duration: Duration.Input
|
|
12624
12587
|
readonly burst?: number | undefined
|
|
12625
12588
|
readonly strategy?: "enforce" | "shape" | undefined
|
|
12626
12589
|
}
|
|
@@ -12632,7 +12595,7 @@ export const throttle: {
|
|
|
12632
12595
|
options: {
|
|
12633
12596
|
readonly cost: (arr: Arr.NonEmptyReadonlyArray<A>) => number
|
|
12634
12597
|
readonly units: number
|
|
12635
|
-
readonly duration: Duration.
|
|
12598
|
+
readonly duration: Duration.Input
|
|
12636
12599
|
readonly burst?: number | undefined
|
|
12637
12600
|
readonly strategy?: "enforce" | "shape" | undefined
|
|
12638
12601
|
}
|
|
@@ -12770,7 +12733,7 @@ export const groupedWithin: {
|
|
|
12770
12733
|
* @since 2.0.0
|
|
12771
12734
|
* @category Grouping
|
|
12772
12735
|
*/
|
|
12773
|
-
(chunkSize: number, duration: Duration.
|
|
12736
|
+
(chunkSize: number, duration: Duration.Input): <A, E, R>(self: Stream<A, E, R>) => Stream<Array<A>, E, R>
|
|
12774
12737
|
/**
|
|
12775
12738
|
* Partitions the stream into arrays, emitting when the chunk size is reached
|
|
12776
12739
|
* or the duration passes.
|
|
@@ -12794,11 +12757,11 @@ export const groupedWithin: {
|
|
|
12794
12757
|
* @since 2.0.0
|
|
12795
12758
|
* @category Grouping
|
|
12796
12759
|
*/
|
|
12797
|
-
<A, E, R>(self: Stream<A, E, R>, chunkSize: number, duration: Duration.
|
|
12760
|
+
<A, E, R>(self: Stream<A, E, R>, chunkSize: number, duration: Duration.Input): Stream<Array<A>, E, R>
|
|
12798
12761
|
} = dual(3, <A, E, R>(
|
|
12799
12762
|
self: Stream<A, E, R>,
|
|
12800
12763
|
chunkSize: number,
|
|
12801
|
-
duration: Duration.
|
|
12764
|
+
duration: Duration.Input
|
|
12802
12765
|
): Stream<Array<A>, E, R> =>
|
|
12803
12766
|
aggregateWithin(
|
|
12804
12767
|
self,
|
|
@@ -12873,7 +12836,7 @@ export const groupBy: {
|
|
|
12873
12836
|
f: (a: NoInfer<A>) => Effect.Effect<readonly [K, V], E2, R2>,
|
|
12874
12837
|
options?: {
|
|
12875
12838
|
readonly bufferSize?: number | undefined
|
|
12876
|
-
readonly idleTimeToLive?: Duration.
|
|
12839
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
12877
12840
|
}
|
|
12878
12841
|
): <E, R>(self: Stream<A, E, R>) => Stream<readonly [K, Stream<V>], E | E2, R | R2>
|
|
12879
12842
|
/**
|
|
@@ -12912,7 +12875,7 @@ export const groupBy: {
|
|
|
12912
12875
|
f: (a: NoInfer<A>) => Effect.Effect<readonly [K, V], E2, R2>,
|
|
12913
12876
|
options?: {
|
|
12914
12877
|
readonly bufferSize?: number | undefined
|
|
12915
|
-
readonly idleTimeToLive?: Duration.
|
|
12878
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
12916
12879
|
}
|
|
12917
12880
|
): Stream<readonly [K, Stream<V>], E | E2, R | R2>
|
|
12918
12881
|
} = dual((args) => isStream(args[0]), <A, E, R, K, V, E2, R2>(
|
|
@@ -12920,7 +12883,7 @@ export const groupBy: {
|
|
|
12920
12883
|
f: (a: NoInfer<A>) => Effect.Effect<readonly [K, V], E2, R2>,
|
|
12921
12884
|
options?: {
|
|
12922
12885
|
readonly bufferSize?: number | undefined
|
|
12923
|
-
readonly idleTimeToLive?: Duration.
|
|
12886
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
12924
12887
|
}
|
|
12925
12888
|
): Stream<readonly [K, Stream<V>], E | E2, R | R2> =>
|
|
12926
12889
|
groupByImpl(
|
|
@@ -13002,7 +12965,7 @@ export const groupByKey: {
|
|
|
13002
12965
|
f: (a: NoInfer<A>) => K,
|
|
13003
12966
|
options?: {
|
|
13004
12967
|
readonly bufferSize?: number | undefined
|
|
13005
|
-
readonly idleTimeToLive?: Duration.
|
|
12968
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
13006
12969
|
}
|
|
13007
12970
|
): <E, R>(self: Stream<A, E, R>) => Stream<readonly [K, Stream<A>], E, R>
|
|
13008
12971
|
/**
|
|
@@ -13039,7 +13002,7 @@ export const groupByKey: {
|
|
|
13039
13002
|
f: (a: NoInfer<A>) => K,
|
|
13040
13003
|
options?: {
|
|
13041
13004
|
readonly bufferSize?: number | undefined
|
|
13042
|
-
readonly idleTimeToLive?: Duration.
|
|
13005
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
13043
13006
|
}
|
|
13044
13007
|
): Stream<readonly [K, Stream<A>], E, R>
|
|
13045
13008
|
} = dual((args) => isStream(args[0]), <A, E, R, K>(
|
|
@@ -13047,7 +13010,7 @@ export const groupByKey: {
|
|
|
13047
13010
|
f: (a: NoInfer<A>) => K,
|
|
13048
13011
|
options?: {
|
|
13049
13012
|
readonly bufferSize?: number | undefined
|
|
13050
|
-
readonly idleTimeToLive?: Duration.
|
|
13013
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
13051
13014
|
}
|
|
13052
13015
|
): Stream<readonly [K, Stream<A>], E, R> =>
|
|
13053
13016
|
suspend(() => {
|
|
@@ -13145,7 +13108,7 @@ const groupByImpl = <A, E, R, K, V, E2, R2>(
|
|
|
13145
13108
|
) => Effect.Effect<void, E2, R2>,
|
|
13146
13109
|
options?: {
|
|
13147
13110
|
readonly bufferSize?: number | undefined
|
|
13148
|
-
readonly idleTimeToLive?: Duration.
|
|
13111
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
13149
13112
|
}
|
|
13150
13113
|
): Stream<readonly [K, Stream<V>], E | E2, R | R2> =>
|
|
13151
13114
|
transformPullBracket(
|
|
@@ -13537,7 +13500,7 @@ export const aggregateWithin: {
|
|
|
13537
13500
|
fromChannel(Channel.fromTransformBracket(Effect.fnUntraced(function*(_upstream, _, scope) {
|
|
13538
13501
|
const pull = yield* Channel.toPullScoped(self.channel, _)
|
|
13539
13502
|
|
|
13540
|
-
const pullLatch =
|
|
13503
|
+
const pullLatch = Latch.makeUnsafe(false)
|
|
13541
13504
|
const scheduleStep = Symbol()
|
|
13542
13505
|
const buffer = yield* Queue.make</**
|
|
13543
13506
|
* Aggregates elements with a sink, emitting each result when the sink completes or the schedule triggers.
|
|
@@ -13637,12 +13600,15 @@ export const aggregateWithin: {
|
|
|
13637
13600
|
* @category Aggregation
|
|
13638
13601
|
*/
|
|
13639
13602
|
B>()
|
|
13603
|
+
let leftover: Arr.NonEmptyReadonlyArray<A2> | undefined
|
|
13640
13604
|
const step = yield* Schedule.toStepWithSleep(schedule)
|
|
13641
|
-
const stepToBuffer = Effect.suspend(()
|
|
13642
|
-
|
|
13643
|
-
|
|
13644
|
-
|
|
13645
|
-
|
|
13605
|
+
const stepToBuffer = Effect.suspend(function loop(): Pull.Pull<never, E3, void, R3> {
|
|
13606
|
+
return step(lastOutput).pipe(
|
|
13607
|
+
Effect.flatMap(() => !hadChunk && leftover === undefined ? loop() : Queue.offer(buffer, scheduleStep)),
|
|
13608
|
+
Effect.flatMap(() => Effect.never),
|
|
13609
|
+
Pull.catchDone(() => Cause.done())
|
|
13610
|
+
)
|
|
13611
|
+
})
|
|
13646
13612
|
|
|
13647
13613
|
// buffer -> sink
|
|
13648
13614
|
const pullFromBuffer: Pull.Pull<
|
|
@@ -13652,7 +13618,6 @@ export const aggregateWithin: {
|
|
|
13652
13618
|
Effect.flatMap((arr) => arr === scheduleStep ? Cause.done() : Effect.succeed(arr))
|
|
13653
13619
|
)
|
|
13654
13620
|
|
|
13655
|
-
let leftover: Arr.NonEmptyReadonlyArray<A2> | undefined
|
|
13656
13621
|
const sinkUpstream = Effect.suspend((): Pull.Pull<Arr.NonEmptyReadonlyArray<A | A2>, E> => {
|
|
13657
13622
|
if (leftover !== undefined) {
|
|
13658
13623
|
const chunk = leftover
|
|
@@ -13664,7 +13629,7 @@ export const aggregateWithin: {
|
|
|
13664
13629
|
return pullFromBuffer
|
|
13665
13630
|
})
|
|
13666
13631
|
const catchSinkHalt = Effect.flatMap(([value, leftover_]: Sink.End<B, A2>) => {
|
|
13667
|
-
// ignore the last output if the
|
|
13632
|
+
// ignore the last output if the upstream only pulled a halt
|
|
13668
13633
|
if (!hadChunk && buffer.state._tag === "Done") return Cause.done()
|
|
13669
13634
|
lastOutput = Option.some(value)
|
|
13670
13635
|
leftover = leftover_
|
|
@@ -13879,12 +13844,12 @@ export const share: {
|
|
|
13879
13844
|
options: {
|
|
13880
13845
|
readonly capacity: "unbounded"
|
|
13881
13846
|
readonly replay?: number | undefined
|
|
13882
|
-
readonly idleTimeToLive?: Duration.
|
|
13847
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
13883
13848
|
} | {
|
|
13884
13849
|
readonly capacity: number
|
|
13885
13850
|
readonly strategy?: "sliding" | "dropping" | "suspend" | undefined
|
|
13886
13851
|
readonly replay?: number | undefined
|
|
13887
|
-
readonly idleTimeToLive?: Duration.
|
|
13852
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
13888
13853
|
}
|
|
13889
13854
|
): <A, E, R>(self: Stream<A, E, R>) => Effect.Effect<Stream<A, E>, never, Scope.Scope | R>
|
|
13890
13855
|
/**
|
|
@@ -13923,12 +13888,12 @@ export const share: {
|
|
|
13923
13888
|
options: {
|
|
13924
13889
|
readonly capacity: "unbounded"
|
|
13925
13890
|
readonly replay?: number | undefined
|
|
13926
|
-
readonly idleTimeToLive?: Duration.
|
|
13891
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
13927
13892
|
} | {
|
|
13928
13893
|
readonly capacity: number
|
|
13929
13894
|
readonly strategy?: "sliding" | "dropping" | "suspend" | undefined
|
|
13930
13895
|
readonly replay?: number | undefined
|
|
13931
|
-
readonly idleTimeToLive?: Duration.
|
|
13896
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
13932
13897
|
}
|
|
13933
13898
|
): Effect.Effect<Stream<A, E>, never, Scope.Scope | R>
|
|
13934
13899
|
} = dual(2, <A, E, R>(
|
|
@@ -13936,12 +13901,12 @@ export const share: {
|
|
|
13936
13901
|
options: {
|
|
13937
13902
|
readonly capacity: "unbounded"
|
|
13938
13903
|
readonly replay?: number | undefined
|
|
13939
|
-
readonly idleTimeToLive?: Duration.
|
|
13904
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
13940
13905
|
} | {
|
|
13941
13906
|
readonly capacity: number
|
|
13942
13907
|
readonly strategy?: "sliding" | "dropping" | "suspend" | undefined
|
|
13943
13908
|
readonly replay?: number | undefined
|
|
13944
|
-
readonly idleTimeToLive?: Duration.
|
|
13909
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
13945
13910
|
}
|
|
13946
13911
|
): Effect.Effect<Stream<A, E>, never, Scope.Scope | R> =>
|
|
13947
13912
|
Effect.map(
|
|
@@ -16121,7 +16086,7 @@ export const provideService: {
|
|
|
16121
16086
|
* @since 4.0.0
|
|
16122
16087
|
* @category Services
|
|
16123
16088
|
*/
|
|
16124
|
-
<I, S>(key: ServiceMap.
|
|
16089
|
+
<I, S>(key: ServiceMap.Key<I, S>, service: NoInfer<S>): <A, E, R>(
|
|
16125
16090
|
self: Stream<A, E, R>
|
|
16126
16091
|
) => Stream<A, E, Exclude<R, I>>
|
|
16127
16092
|
/**
|
|
@@ -16160,10 +16125,10 @@ export const provideService: {
|
|
|
16160
16125
|
* @since 4.0.0
|
|
16161
16126
|
* @category Services
|
|
16162
16127
|
*/
|
|
16163
|
-
<A, E, R, I, S>(self: Stream<A, E, R>, key: ServiceMap.
|
|
16128
|
+
<A, E, R, I, S>(self: Stream<A, E, R>, key: ServiceMap.Key<I, S>, service: NoInfer<S>): Stream<A, E, Exclude<R, I>>
|
|
16164
16129
|
} = dual(3, <A, E, R, I, S>(
|
|
16165
16130
|
self: Stream<A, E, R>,
|
|
16166
|
-
key: ServiceMap.
|
|
16131
|
+
key: ServiceMap.Key<I, S>,
|
|
16167
16132
|
service: NoInfer<S>
|
|
16168
16133
|
): Stream<A, E, Exclude<R, I>> => fromChannel(Channel.provideService(self.channel, key, service)))
|
|
16169
16134
|
|
|
@@ -16244,7 +16209,7 @@ export const provideServiceEffect: {
|
|
|
16244
16209
|
* @since 4.0.0
|
|
16245
16210
|
* @category Services
|
|
16246
16211
|
*/
|
|
16247
|
-
<I, S, ES, RS>(key: ServiceMap.
|
|
16212
|
+
<I, S, ES, RS>(key: ServiceMap.Key<I, S>, service: Effect.Effect<NoInfer<S>, ES, RS>): <A, E, R>(
|
|
16248
16213
|
self: Stream<A, E, R>
|
|
16249
16214
|
) => Stream<A, E | ES, Exclude<R, I> | RS>
|
|
16250
16215
|
/**
|
|
@@ -16287,12 +16252,12 @@ export const provideServiceEffect: {
|
|
|
16287
16252
|
*/
|
|
16288
16253
|
<A, E, R, I, S, ES, RS>(
|
|
16289
16254
|
self: Stream<A, E, R>,
|
|
16290
|
-
key: ServiceMap.
|
|
16255
|
+
key: ServiceMap.Key<I, S>,
|
|
16291
16256
|
service: Effect.Effect<NoInfer<S>, ES, RS>
|
|
16292
16257
|
): Stream<A, E | ES, Exclude<R, I> | RS>
|
|
16293
16258
|
} = dual(3, <A, E, R, I, S, ES, RS>(
|
|
16294
16259
|
self: Stream<A, E, R>,
|
|
16295
|
-
key: ServiceMap.
|
|
16260
|
+
key: ServiceMap.Key<I, S>,
|
|
16296
16261
|
service: Effect.Effect<NoInfer<S>, ES, RS>
|
|
16297
16262
|
): Stream<A, E | ES, Exclude<R, I> | RS> => fromChannel(Channel.provideServiceEffect(self.channel, key, service)))
|
|
16298
16263
|
|
|
@@ -16477,7 +16442,7 @@ export const updateService: {
|
|
|
16477
16442
|
* @since 2.0.0
|
|
16478
16443
|
* @category Services
|
|
16479
16444
|
*/
|
|
16480
|
-
<I, S>(key: ServiceMap.
|
|
16445
|
+
<I, S>(key: ServiceMap.Key<I, S>, f: (service: NoInfer<S>) => S): <A, E, R>(
|
|
16481
16446
|
self: Stream<A, E, R>
|
|
16482
16447
|
) => Stream<A, E, R | I>
|
|
16483
16448
|
/**
|
|
@@ -16507,12 +16472,12 @@ export const updateService: {
|
|
|
16507
16472
|
*/
|
|
16508
16473
|
<A, E, R, I, S>(
|
|
16509
16474
|
self: Stream<A, E, R>,
|
|
16510
|
-
key: ServiceMap.
|
|
16475
|
+
key: ServiceMap.Key<I, S>,
|
|
16511
16476
|
f: (service: NoInfer<S>) => S
|
|
16512
16477
|
): Stream<A, E, R | I>
|
|
16513
16478
|
} = dual(3, <A, E, R, I, S>(
|
|
16514
16479
|
self: Stream<A, E, R>,
|
|
16515
|
-
service: ServiceMap.
|
|
16480
|
+
service: ServiceMap.Key<I, S>,
|
|
16516
16481
|
f: (service: NoInfer<S>) => S
|
|
16517
16482
|
): Stream<A, E, R | I> =>
|
|
16518
16483
|
updateServices(self, (services) =>
|
|
@@ -16591,7 +16556,7 @@ export const withSpan: {
|
|
|
16591
16556
|
} = function() {
|
|
16592
16557
|
const dataFirst = isStream(arguments[0])
|
|
16593
16558
|
const name = dataFirst ? arguments[1] : arguments[0]
|
|
16594
|
-
const options = addSpanStackTrace(dataFirst ? arguments[
|
|
16559
|
+
const options = addSpanStackTrace(dataFirst ? arguments[2] : arguments[1])
|
|
16595
16560
|
if (dataFirst) {
|
|
16596
16561
|
const self = arguments[0] as Stream<any, any, any>
|
|
16597
16562
|
return fromChannel(Channel.withSpan(self.channel, name, options))
|
|
@@ -17747,7 +17712,7 @@ export const toReadableStreamWith = dual<
|
|
|
17747
17712
|
): ReadableStream<A> => {
|
|
17748
17713
|
let currentResolve: (() => void) | undefined = undefined
|
|
17749
17714
|
let fiber: Fiber.Fiber<void, E> | undefined = undefined
|
|
17750
|
-
const latch =
|
|
17715
|
+
const latch = Latch.makeUnsafe(false)
|
|
17751
17716
|
|
|
17752
17717
|
return new ReadableStream<A>({
|
|
17753
17718
|
start(controller) {
|