effect 4.0.0-beta.2 → 4.0.0-beta.20
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 +733 -687
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +233 -250
- 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 +91 -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 +3 -2
- 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 +123 -76
- 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 +225 -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 +33 -6
- 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/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/WorkflowEngine.d.ts +8 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +133 -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 +909 -817
- 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 +315 -160
- package/src/Schema.ts +661 -116
- package/src/SchemaAST.ts +3 -2
- 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 +565 -600
- 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 +660 -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 +46 -8
- 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/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 +1 -1
- package/src/unstable/workflow/WorkflowEngine.ts +181 -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/dist/Effect.d.ts
CHANGED
|
@@ -78,7 +78,7 @@ import { type LazyArg } from "./Function.ts";
|
|
|
78
78
|
import type { TypeLambda } from "./HKT.ts";
|
|
79
79
|
import type * as Layer from "./Layer.ts";
|
|
80
80
|
import type { Logger } from "./Logger.ts";
|
|
81
|
-
import type {
|
|
81
|
+
import type { Severity } from "./LogLevel.ts";
|
|
82
82
|
import * as Metric from "./Metric.ts";
|
|
83
83
|
import type { Option } from "./Option.ts";
|
|
84
84
|
import type { Pipeable } from "./Pipeable.ts";
|
|
@@ -92,7 +92,7 @@ import type { Scope } from "./Scope.ts";
|
|
|
92
92
|
import * as ServiceMap from "./ServiceMap.ts";
|
|
93
93
|
import type { AnySpan, ParentSpan, Span, SpanLink, SpanOptions, SpanOptionsNoTrace, TraceOptions, Tracer } from "./Tracer.ts";
|
|
94
94
|
import type { TxRef } from "./TxRef.ts";
|
|
95
|
-
import type { Concurrency, Covariant, EqualsWith, ExcludeReason, ExcludeTag, ExtractReason, ExtractTag, NoInfer, ReasonOf, ReasonTags, Tags, unassigned } from "./Types.ts";
|
|
95
|
+
import type { Concurrency, Covariant, EqualsWith, ExcludeReason, ExcludeTag, ExtractReason, ExtractTag, NarrowReason, NoInfer, OmitReason, ReasonOf, ReasonTags, Simplify, Tags, unassigned } from "./Types.ts";
|
|
96
96
|
import type * as Unify from "./Unify.ts";
|
|
97
97
|
declare const TypeId: "~effect/Effect";
|
|
98
98
|
/**
|
|
@@ -724,6 +724,199 @@ export declare const partition: {
|
|
|
724
724
|
readonly concurrency?: Concurrency | undefined;
|
|
725
725
|
}): Effect<[excluded: Array<E>, satisfying: Array<B>], never, R>;
|
|
726
726
|
};
|
|
727
|
+
/**
|
|
728
|
+
* Applies an effectful function to each element and accumulates all failures.
|
|
729
|
+
*
|
|
730
|
+
* This function always evaluates every element. If at least one effect fails,
|
|
731
|
+
* all failures are returned as a non-empty array and successes are discarded.
|
|
732
|
+
* If all effects succeed, it returns all collected successes.
|
|
733
|
+
*
|
|
734
|
+
* Use `discard: true` to ignore successful values while still validating all
|
|
735
|
+
* elements.
|
|
736
|
+
*
|
|
737
|
+
* @example
|
|
738
|
+
* ```ts
|
|
739
|
+
* import { Effect } from "effect"
|
|
740
|
+
*
|
|
741
|
+
* const program = Effect.validate([0, 1, 2, 3], (n) =>
|
|
742
|
+
* n % 2 === 0 ? Effect.fail(`${n} is even`) : Effect.succeed(n)
|
|
743
|
+
* )
|
|
744
|
+
*
|
|
745
|
+
* Effect.runPromiseExit(program).then(console.log)
|
|
746
|
+
* // {
|
|
747
|
+
* // _id: 'Exit',
|
|
748
|
+
* // _tag: 'Failure',
|
|
749
|
+
* // cause: {
|
|
750
|
+
* // _id: 'Cause',
|
|
751
|
+
* // reasons: [
|
|
752
|
+
* // { _id: 'Reason', _tag: 'Fail', error: '0 is even' },
|
|
753
|
+
* // { _id: 'Reason', _tag: 'Fail', error: '2 is even' }
|
|
754
|
+
* // ]
|
|
755
|
+
* // }
|
|
756
|
+
* // }
|
|
757
|
+
* ```
|
|
758
|
+
*
|
|
759
|
+
* @since 4.0.0
|
|
760
|
+
* @category Error Accumulation
|
|
761
|
+
*/
|
|
762
|
+
export declare const validate: {
|
|
763
|
+
/**
|
|
764
|
+
* Applies an effectful function to each element and accumulates all failures.
|
|
765
|
+
*
|
|
766
|
+
* This function always evaluates every element. If at least one effect fails,
|
|
767
|
+
* all failures are returned as a non-empty array and successes are discarded.
|
|
768
|
+
* If all effects succeed, it returns all collected successes.
|
|
769
|
+
*
|
|
770
|
+
* Use `discard: true` to ignore successful values while still validating all
|
|
771
|
+
* elements.
|
|
772
|
+
*
|
|
773
|
+
* @example
|
|
774
|
+
* ```ts
|
|
775
|
+
* import { Effect } from "effect"
|
|
776
|
+
*
|
|
777
|
+
* const program = Effect.validate([0, 1, 2, 3], (n) =>
|
|
778
|
+
* n % 2 === 0 ? Effect.fail(`${n} is even`) : Effect.succeed(n)
|
|
779
|
+
* )
|
|
780
|
+
*
|
|
781
|
+
* Effect.runPromiseExit(program).then(console.log)
|
|
782
|
+
* // {
|
|
783
|
+
* // _id: 'Exit',
|
|
784
|
+
* // _tag: 'Failure',
|
|
785
|
+
* // cause: {
|
|
786
|
+
* // _id: 'Cause',
|
|
787
|
+
* // reasons: [
|
|
788
|
+
* // { _id: 'Reason', _tag: 'Fail', error: '0 is even' },
|
|
789
|
+
* // { _id: 'Reason', _tag: 'Fail', error: '2 is even' }
|
|
790
|
+
* // ]
|
|
791
|
+
* // }
|
|
792
|
+
* // }
|
|
793
|
+
* ```
|
|
794
|
+
*
|
|
795
|
+
* @since 4.0.0
|
|
796
|
+
* @category Error Accumulation
|
|
797
|
+
*/
|
|
798
|
+
<A, B, E, R>(f: (a: A, i: number) => Effect<B, E, R>, options?: {
|
|
799
|
+
readonly concurrency?: Concurrency | undefined;
|
|
800
|
+
readonly discard?: false | undefined;
|
|
801
|
+
} | undefined): (elements: Iterable<A>) => Effect<Array<B>, Arr.NonEmptyArray<E>, R>;
|
|
802
|
+
/**
|
|
803
|
+
* Applies an effectful function to each element and accumulates all failures.
|
|
804
|
+
*
|
|
805
|
+
* This function always evaluates every element. If at least one effect fails,
|
|
806
|
+
* all failures are returned as a non-empty array and successes are discarded.
|
|
807
|
+
* If all effects succeed, it returns all collected successes.
|
|
808
|
+
*
|
|
809
|
+
* Use `discard: true` to ignore successful values while still validating all
|
|
810
|
+
* elements.
|
|
811
|
+
*
|
|
812
|
+
* @example
|
|
813
|
+
* ```ts
|
|
814
|
+
* import { Effect } from "effect"
|
|
815
|
+
*
|
|
816
|
+
* const program = Effect.validate([0, 1, 2, 3], (n) =>
|
|
817
|
+
* n % 2 === 0 ? Effect.fail(`${n} is even`) : Effect.succeed(n)
|
|
818
|
+
* )
|
|
819
|
+
*
|
|
820
|
+
* Effect.runPromiseExit(program).then(console.log)
|
|
821
|
+
* // {
|
|
822
|
+
* // _id: 'Exit',
|
|
823
|
+
* // _tag: 'Failure',
|
|
824
|
+
* // cause: {
|
|
825
|
+
* // _id: 'Cause',
|
|
826
|
+
* // reasons: [
|
|
827
|
+
* // { _id: 'Reason', _tag: 'Fail', error: '0 is even' },
|
|
828
|
+
* // { _id: 'Reason', _tag: 'Fail', error: '2 is even' }
|
|
829
|
+
* // ]
|
|
830
|
+
* // }
|
|
831
|
+
* // }
|
|
832
|
+
* ```
|
|
833
|
+
*
|
|
834
|
+
* @since 4.0.0
|
|
835
|
+
* @category Error Accumulation
|
|
836
|
+
*/
|
|
837
|
+
<A, B, E, R>(f: (a: A, i: number) => Effect<B, E, R>, options: {
|
|
838
|
+
readonly concurrency?: Concurrency | undefined;
|
|
839
|
+
readonly discard: true;
|
|
840
|
+
}): (elements: Iterable<A>) => Effect<void, Arr.NonEmptyArray<E>, R>;
|
|
841
|
+
/**
|
|
842
|
+
* Applies an effectful function to each element and accumulates all failures.
|
|
843
|
+
*
|
|
844
|
+
* This function always evaluates every element. If at least one effect fails,
|
|
845
|
+
* all failures are returned as a non-empty array and successes are discarded.
|
|
846
|
+
* If all effects succeed, it returns all collected successes.
|
|
847
|
+
*
|
|
848
|
+
* Use `discard: true` to ignore successful values while still validating all
|
|
849
|
+
* elements.
|
|
850
|
+
*
|
|
851
|
+
* @example
|
|
852
|
+
* ```ts
|
|
853
|
+
* import { Effect } from "effect"
|
|
854
|
+
*
|
|
855
|
+
* const program = Effect.validate([0, 1, 2, 3], (n) =>
|
|
856
|
+
* n % 2 === 0 ? Effect.fail(`${n} is even`) : Effect.succeed(n)
|
|
857
|
+
* )
|
|
858
|
+
*
|
|
859
|
+
* Effect.runPromiseExit(program).then(console.log)
|
|
860
|
+
* // {
|
|
861
|
+
* // _id: 'Exit',
|
|
862
|
+
* // _tag: 'Failure',
|
|
863
|
+
* // cause: {
|
|
864
|
+
* // _id: 'Cause',
|
|
865
|
+
* // reasons: [
|
|
866
|
+
* // { _id: 'Reason', _tag: 'Fail', error: '0 is even' },
|
|
867
|
+
* // { _id: 'Reason', _tag: 'Fail', error: '2 is even' }
|
|
868
|
+
* // ]
|
|
869
|
+
* // }
|
|
870
|
+
* // }
|
|
871
|
+
* ```
|
|
872
|
+
*
|
|
873
|
+
* @since 4.0.0
|
|
874
|
+
* @category Error Accumulation
|
|
875
|
+
*/
|
|
876
|
+
<A, B, E, R>(elements: Iterable<A>, f: (a: A, i: number) => Effect<B, E, R>, options?: {
|
|
877
|
+
readonly concurrency?: Concurrency | undefined;
|
|
878
|
+
readonly discard?: false | undefined;
|
|
879
|
+
} | undefined): Effect<Array<B>, Arr.NonEmptyArray<E>, R>;
|
|
880
|
+
/**
|
|
881
|
+
* Applies an effectful function to each element and accumulates all failures.
|
|
882
|
+
*
|
|
883
|
+
* This function always evaluates every element. If at least one effect fails,
|
|
884
|
+
* all failures are returned as a non-empty array and successes are discarded.
|
|
885
|
+
* If all effects succeed, it returns all collected successes.
|
|
886
|
+
*
|
|
887
|
+
* Use `discard: true` to ignore successful values while still validating all
|
|
888
|
+
* elements.
|
|
889
|
+
*
|
|
890
|
+
* @example
|
|
891
|
+
* ```ts
|
|
892
|
+
* import { Effect } from "effect"
|
|
893
|
+
*
|
|
894
|
+
* const program = Effect.validate([0, 1, 2, 3], (n) =>
|
|
895
|
+
* n % 2 === 0 ? Effect.fail(`${n} is even`) : Effect.succeed(n)
|
|
896
|
+
* )
|
|
897
|
+
*
|
|
898
|
+
* Effect.runPromiseExit(program).then(console.log)
|
|
899
|
+
* // {
|
|
900
|
+
* // _id: 'Exit',
|
|
901
|
+
* // _tag: 'Failure',
|
|
902
|
+
* // cause: {
|
|
903
|
+
* // _id: 'Cause',
|
|
904
|
+
* // reasons: [
|
|
905
|
+
* // { _id: 'Reason', _tag: 'Fail', error: '0 is even' },
|
|
906
|
+
* // { _id: 'Reason', _tag: 'Fail', error: '2 is even' }
|
|
907
|
+
* // ]
|
|
908
|
+
* // }
|
|
909
|
+
* // }
|
|
910
|
+
* ```
|
|
911
|
+
*
|
|
912
|
+
* @since 4.0.0
|
|
913
|
+
* @category Error Accumulation
|
|
914
|
+
*/
|
|
915
|
+
<A, B, E, R>(elements: Iterable<A>, f: (a: A, i: number) => Effect<B, E, R>, options: {
|
|
916
|
+
readonly concurrency?: Concurrency | undefined;
|
|
917
|
+
readonly discard: true;
|
|
918
|
+
}): Effect<void, Arr.NonEmptyArray<E>, R>;
|
|
919
|
+
};
|
|
727
920
|
/**
|
|
728
921
|
* Executes an effectful operation for each element in an `Iterable`.
|
|
729
922
|
*
|
|
@@ -1352,6 +1545,90 @@ export declare const callback: <A, E = never, R = never>(register: (this: Schedu
|
|
|
1352
1545
|
* @category Creating Effects
|
|
1353
1546
|
*/
|
|
1354
1547
|
export declare const never: Effect<never>;
|
|
1548
|
+
/**
|
|
1549
|
+
* An `Effect` containing an empty record `{}`, used as the starting point for
|
|
1550
|
+
* do notation chains.
|
|
1551
|
+
*
|
|
1552
|
+
* @example
|
|
1553
|
+
* ```ts
|
|
1554
|
+
* import { Effect } from "effect"
|
|
1555
|
+
* import { pipe } from "effect/Function"
|
|
1556
|
+
*
|
|
1557
|
+
* const program = pipe(
|
|
1558
|
+
* Effect.Do,
|
|
1559
|
+
* Effect.bind("x", () => Effect.succeed(2)),
|
|
1560
|
+
* Effect.bind("y", ({ x }) => Effect.succeed(x + 1)),
|
|
1561
|
+
* Effect.let("sum", ({ x, y }) => x + y)
|
|
1562
|
+
* )
|
|
1563
|
+
* ```
|
|
1564
|
+
*
|
|
1565
|
+
* @since 4.0.0
|
|
1566
|
+
* @category Do notation
|
|
1567
|
+
*/
|
|
1568
|
+
export declare const Do: Effect<{}>;
|
|
1569
|
+
/**
|
|
1570
|
+
* Gives a name to the success value of an `Effect`, creating a single-key
|
|
1571
|
+
* record used in do notation pipelines.
|
|
1572
|
+
*
|
|
1573
|
+
* @since 4.0.0
|
|
1574
|
+
* @category Do notation
|
|
1575
|
+
*/
|
|
1576
|
+
export declare const bindTo: {
|
|
1577
|
+
/**
|
|
1578
|
+
* Gives a name to the success value of an `Effect`, creating a single-key
|
|
1579
|
+
* record used in do notation pipelines.
|
|
1580
|
+
*
|
|
1581
|
+
* @since 4.0.0
|
|
1582
|
+
* @category Do notation
|
|
1583
|
+
*/
|
|
1584
|
+
<N extends string>(name: N): <A, E, R>(self: Effect<A, E, R>) => Effect<{
|
|
1585
|
+
[K in N]: A;
|
|
1586
|
+
}, E, R>;
|
|
1587
|
+
/**
|
|
1588
|
+
* Gives a name to the success value of an `Effect`, creating a single-key
|
|
1589
|
+
* record used in do notation pipelines.
|
|
1590
|
+
*
|
|
1591
|
+
* @since 4.0.0
|
|
1592
|
+
* @category Do notation
|
|
1593
|
+
*/
|
|
1594
|
+
<A, E, R, N extends string>(self: Effect<A, E, R>, name: N): Effect<{
|
|
1595
|
+
[K in N]: A;
|
|
1596
|
+
}, E, R>;
|
|
1597
|
+
};
|
|
1598
|
+
declare const let_: {
|
|
1599
|
+
<N extends string, A extends Record<string, any>, B>(name: N, f: (a: NoInfer<A>) => B): <E, R>(self: Effect<A, E, R>) => Effect<Simplify<Omit<A, N> & Record<N, B>>, E, R>;
|
|
1600
|
+
<A extends Record<string, any>, E, R, B, N extends string>(self: Effect<A, E, R>, name: N, f: (a: NoInfer<A>) => B): Effect<Simplify<Omit<A, N> & Record<N, B>>, E, R>;
|
|
1601
|
+
};
|
|
1602
|
+
export {
|
|
1603
|
+
/**
|
|
1604
|
+
* Adds a computed plain value to the do notation record.
|
|
1605
|
+
*
|
|
1606
|
+
* @since 4.0.0
|
|
1607
|
+
* @category Do notation
|
|
1608
|
+
*/
|
|
1609
|
+
let_ as let };
|
|
1610
|
+
/**
|
|
1611
|
+
* Adds an `Effect` value to the do notation record under a given name.
|
|
1612
|
+
*
|
|
1613
|
+
* @since 4.0.0
|
|
1614
|
+
* @category Do notation
|
|
1615
|
+
*/
|
|
1616
|
+
export declare const bind: {
|
|
1617
|
+
/**
|
|
1618
|
+
* Adds an `Effect` value to the do notation record under a given name.
|
|
1619
|
+
*
|
|
1620
|
+
* @since 4.0.0
|
|
1621
|
+
* @category Do notation
|
|
1622
|
+
*/
|
|
1623
|
+
<N extends string, A extends Record<string, any>, B, E2, R2>(name: N, f: (a: NoInfer<A>) => Effect<B, E2, R2>): <E, R>(self: Effect<A, E, R>) => Effect<Simplify<Omit<A, N> & Record<N, B>>, E | E2, R | R2>;
|
|
1624
|
+
/**
|
|
1625
|
+
* Adds an `Effect` value to the do notation record under a given name.
|
|
1626
|
+
*
|
|
1627
|
+
* @since 4.0.0
|
|
1628
|
+
* @category Do notation
|
|
1629
|
+
*/
|
|
1630
|
+
<A extends Record<string, any>, E, R, B, E2, R2, N extends string>(self: Effect<A, E, R>, name: N, f: (a: NoInfer<A>) => Effect<B, E2, R2>): Effect<Simplify<Omit<A, N> & Record<N, B>>, E | E2, R | R2>;
|
|
1631
|
+
};
|
|
1355
1632
|
/**
|
|
1356
1633
|
* Provides a way to write effectful code using generator functions, simplifying
|
|
1357
1634
|
* control flow and error handling.
|
|
@@ -3916,7 +4193,7 @@ export declare const catchReason: {
|
|
|
3916
4193
|
* @since 4.0.0
|
|
3917
4194
|
* @category Error Handling
|
|
3918
4195
|
*/
|
|
3919
|
-
<K extends Tags<E>, E, RK extends ReasonTags<ExtractTag<NoInfer<E>, K>>, A2, E2, R2, A3 = unassigned, E3 = never, R3 = never>(errorTag: K, reasonTag: RK, f: (reason: ExtractReason<ExtractTag<NoInfer<E>, K>, RK>) => Effect<A2, E2, R2>, orElse?: ((reasons: ExcludeReason<ExtractTag<NoInfer<E>, K>, RK>) => Effect<A3, E3, R3>) | undefined): <A, R>(self: Effect<A, E, R>) => Effect<A | A2 | Exclude<A3, unassigned>, (A3 extends unassigned ? E : ExcludeTag<E, K>) | E2 | E3, R | R2 | R3>;
|
|
4196
|
+
<K extends Tags<E>, E, RK extends ReasonTags<ExtractTag<NoInfer<E>, K>>, A2, E2, R2, A3 = unassigned, E3 = never, R3 = never>(errorTag: K, reasonTag: RK, f: (reason: ExtractReason<ExtractTag<NoInfer<E>, K>, RK>, error: NarrowReason<ExtractTag<NoInfer<E>, K>, RK>) => Effect<A2, E2, R2>, orElse?: ((reasons: ExcludeReason<ExtractTag<NoInfer<E>, K>, RK>, error: OmitReason<ExtractTag<NoInfer<E>, K>, RK>) => Effect<A3, E3, R3>) | undefined): <A, R>(self: Effect<A, E, R>) => Effect<A | A2 | Exclude<A3, unassigned>, (A3 extends unassigned ? E : ExcludeTag<E, K>) | E2 | E3, R | R2 | R3>;
|
|
3920
4197
|
/**
|
|
3921
4198
|
* Catches a specific reason within a tagged error.
|
|
3922
4199
|
*
|
|
@@ -3952,7 +4229,7 @@ export declare const catchReason: {
|
|
|
3952
4229
|
* @since 4.0.0
|
|
3953
4230
|
* @category Error Handling
|
|
3954
4231
|
*/
|
|
3955
|
-
<A, E, R, K extends Tags<E>, RK extends ReasonTags<ExtractTag<E, K>>, A2, E2, R2, A3 = unassigned, E3 = never, R3 = never>(self: Effect<A, E, R>, errorTag: K, reasonTag: RK, f: (reason: ExtractReason<ExtractTag<E, K>, RK>) => Effect<A2, E2, R2>, orElse?: ((reasons: ExcludeReason<ExtractTag<E, K>, RK>) => Effect<A3, E3, R3>) | undefined): Effect<A | A2 | Exclude<A3, unassigned>, (A3 extends unassigned ? E : ExcludeTag<E, K>) | E2 | E3, R | R2 | R3>;
|
|
4232
|
+
<A, E, R, K extends Tags<E>, RK extends ReasonTags<ExtractTag<E, K>>, A2, E2, R2, A3 = unassigned, E3 = never, R3 = never>(self: Effect<A, E, R>, errorTag: K, reasonTag: RK, f: (reason: ExtractReason<ExtractTag<E, K>, RK>, error: NarrowReason<ExtractTag<E, K>, RK>) => Effect<A2, E2, R2>, orElse?: ((reasons: ExcludeReason<ExtractTag<E, K>, RK>, error: OmitReason<ExtractTag<E, K>, RK>) => Effect<A3, E3, R3>) | undefined): Effect<A | A2 | Exclude<A3, unassigned>, (A3 extends unassigned ? E : ExcludeTag<E, K>) | E2 | E3, R | R2 | R3>;
|
|
3956
4233
|
};
|
|
3957
4234
|
/**
|
|
3958
4235
|
* Catches multiple reasons within a tagged error using an object of handlers.
|
|
@@ -4024,8 +4301,8 @@ export declare const catchReasons: {
|
|
|
4024
4301
|
* @category Error Handling
|
|
4025
4302
|
*/
|
|
4026
4303
|
<K extends Tags<E>, E, Cases extends {
|
|
4027
|
-
[RK in ReasonTags<ExtractTag<NoInfer<E>, K>>]+?: (reason: ExtractReason<ExtractTag<NoInfer<E>, K>, RK>) => Effect<any, any, any>;
|
|
4028
|
-
}, A2 = unassigned, E2 = never, R2 = never>(errorTag: K, cases: Cases, orElse?: ((reason: ExcludeReason<ExtractTag<NoInfer<E>, K>, Extract<keyof Cases, string>>) => Effect<A2, E2, R2>) | undefined): <A, R>(self: Effect<A, E, R>) => Effect<A | Exclude<A2, unassigned> | {
|
|
4304
|
+
[RK in ReasonTags<ExtractTag<NoInfer<E>, K>>]+?: (reason: ExtractReason<ExtractTag<NoInfer<E>, K>, RK>, error: NarrowReason<ExtractTag<NoInfer<E>, K>, RK>) => Effect<any, any, any>;
|
|
4305
|
+
}, A2 = unassigned, E2 = never, R2 = never>(errorTag: K, cases: Cases, orElse?: ((reason: ExcludeReason<ExtractTag<NoInfer<E>, K>, Extract<keyof Cases, string>>, error: OmitReason<ExtractTag<NoInfer<E>, K>, Extract<keyof Cases, string>>) => Effect<A2, E2, R2>) | undefined): <A, R>(self: Effect<A, E, R>) => Effect<A | Exclude<A2, unassigned> | {
|
|
4029
4306
|
[RK in keyof Cases]: Cases[RK] extends (...args: Array<any>) => Effect<infer A, any, any> ? A : never;
|
|
4030
4307
|
}[keyof Cases], (A2 extends unassigned ? E : ExcludeTag<E, K>) | E2 | {
|
|
4031
4308
|
[RK in keyof Cases]: Cases[RK] extends (...args: Array<any>) => Effect<any, infer E, any> ? E : never;
|
|
@@ -4067,8 +4344,8 @@ export declare const catchReasons: {
|
|
|
4067
4344
|
* @category Error Handling
|
|
4068
4345
|
*/
|
|
4069
4346
|
<A, E, R, K extends Tags<E>, Cases extends {
|
|
4070
|
-
[RK in ReasonTags<ExtractTag<E, K>>]+?: (reason: ExtractReason<ExtractTag<E, K>, RK>) => Effect<any, any, any>;
|
|
4071
|
-
}, A2 = unassigned, E2 = never, R2 = never>(self: Effect<A, E, R>, errorTag: K, cases: Cases, orElse?: ((reason: ExcludeReason<ExtractTag<NoInfer<E>, K>, Extract<keyof Cases, string>>) => Effect<A2, E2, R2>) | undefined): Effect<A | Exclude<A2, unassigned> | {
|
|
4347
|
+
[RK in ReasonTags<ExtractTag<E, K>>]+?: (reason: ExtractReason<ExtractTag<E, K>, RK>, error: NarrowReason<ExtractTag<E, K>, RK>) => Effect<any, any, any>;
|
|
4348
|
+
}, A2 = unassigned, E2 = never, R2 = never>(self: Effect<A, E, R>, errorTag: K, cases: Cases, orElse?: ((reason: ExcludeReason<ExtractTag<NoInfer<E>, K>, Extract<keyof Cases, string>>, error: OmitReason<ExtractTag<NoInfer<E>, K>, Extract<keyof Cases, string>>) => Effect<A2, E2, R2>) | undefined): Effect<A | Exclude<A2, unassigned> | {
|
|
4072
4349
|
[RK in keyof Cases]: Cases[RK] extends (...args: Array<any>) => Effect<infer A, any, any> ? A : never;
|
|
4073
4350
|
}[keyof Cases], (A2 extends unassigned ? E : ExcludeTag<E, K>) | E2 | {
|
|
4074
4351
|
[RK in keyof Cases]: Cases[RK] extends (...args: Array<any>) => Effect<any, infer E, any> ? E : never;
|
|
@@ -4469,15 +4746,14 @@ export declare const catchDefect: {
|
|
|
4469
4746
|
<A, E, R, A2, E2, R2>(self: Effect<A, E, R>, f: (defect: unknown) => Effect<A2, E2, R2>): Effect<A | A2, E | E2, R | R2>;
|
|
4470
4747
|
};
|
|
4471
4748
|
/**
|
|
4472
|
-
* Recovers from specific errors using a `
|
|
4473
|
-
* `Refinement`.
|
|
4749
|
+
* Recovers from specific errors using a `Predicate` or `Refinement`.
|
|
4474
4750
|
*
|
|
4475
4751
|
* **When to Use**
|
|
4476
4752
|
*
|
|
4477
|
-
* `catchIf` lets you recover from errors that match a condition.
|
|
4478
|
-
* `
|
|
4479
|
-
*
|
|
4480
|
-
*
|
|
4753
|
+
* `catchIf` lets you recover from errors that match a condition. Use a
|
|
4754
|
+
* `Refinement` for type narrowing or a `Predicate` for simple boolean
|
|
4755
|
+
* matching. Non-matching errors re-fail with the original cause. Defects and
|
|
4756
|
+
* interrupts are not caught.
|
|
4481
4757
|
*
|
|
4482
4758
|
* **Previously Known As**
|
|
4483
4759
|
*
|
|
@@ -4504,7 +4780,7 @@ export declare const catchDefect: {
|
|
|
4504
4780
|
*
|
|
4505
4781
|
* // With a Filter
|
|
4506
4782
|
* const recovered2 = program.pipe(
|
|
4507
|
-
* Effect.
|
|
4783
|
+
* Effect.catchFilter(
|
|
4508
4784
|
* Filter.tagged("NotFound"),
|
|
4509
4785
|
* (error) => Effect.succeed(`missing:${error.id}`)
|
|
4510
4786
|
* )
|
|
@@ -4516,15 +4792,14 @@ export declare const catchDefect: {
|
|
|
4516
4792
|
*/
|
|
4517
4793
|
export declare const catchIf: {
|
|
4518
4794
|
/**
|
|
4519
|
-
* Recovers from specific errors using a `
|
|
4520
|
-
* `Refinement`.
|
|
4795
|
+
* Recovers from specific errors using a `Predicate` or `Refinement`.
|
|
4521
4796
|
*
|
|
4522
4797
|
* **When to Use**
|
|
4523
4798
|
*
|
|
4524
|
-
* `catchIf` lets you recover from errors that match a condition.
|
|
4525
|
-
* `
|
|
4526
|
-
*
|
|
4527
|
-
*
|
|
4799
|
+
* `catchIf` lets you recover from errors that match a condition. Use a
|
|
4800
|
+
* `Refinement` for type narrowing or a `Predicate` for simple boolean
|
|
4801
|
+
* matching. Non-matching errors re-fail with the original cause. Defects and
|
|
4802
|
+
* interrupts are not caught.
|
|
4528
4803
|
*
|
|
4529
4804
|
* **Previously Known As**
|
|
4530
4805
|
*
|
|
@@ -4551,7 +4826,7 @@ export declare const catchIf: {
|
|
|
4551
4826
|
*
|
|
4552
4827
|
* // With a Filter
|
|
4553
4828
|
* const recovered2 = program.pipe(
|
|
4554
|
-
* Effect.
|
|
4829
|
+
* Effect.catchFilter(
|
|
4555
4830
|
* Filter.tagged("NotFound"),
|
|
4556
4831
|
* (error) => Effect.succeed(`missing:${error.id}`)
|
|
4557
4832
|
* )
|
|
@@ -4563,15 +4838,14 @@ export declare const catchIf: {
|
|
|
4563
4838
|
*/
|
|
4564
4839
|
<E, EB extends E, A2, E2, R2, A3 = never, E3 = Exclude<E, EB>, R3 = never>(refinement: Predicate.Refinement<NoInfer<E>, EB>, f: (e: EB) => Effect<A2, E2, R2>, orElse?: ((e: Exclude<E, EB>) => Effect<A3, E3, R3>) | undefined): <A, R>(self: Effect<A, E, R>) => Effect<A | A2 | A3, E2 | E3, R | R2 | R3>;
|
|
4565
4840
|
/**
|
|
4566
|
-
* Recovers from specific errors using a `
|
|
4567
|
-
* `Refinement`.
|
|
4841
|
+
* Recovers from specific errors using a `Predicate` or `Refinement`.
|
|
4568
4842
|
*
|
|
4569
4843
|
* **When to Use**
|
|
4570
4844
|
*
|
|
4571
|
-
* `catchIf` lets you recover from errors that match a condition.
|
|
4572
|
-
* `
|
|
4573
|
-
*
|
|
4574
|
-
*
|
|
4845
|
+
* `catchIf` lets you recover from errors that match a condition. Use a
|
|
4846
|
+
* `Refinement` for type narrowing or a `Predicate` for simple boolean
|
|
4847
|
+
* matching. Non-matching errors re-fail with the original cause. Defects and
|
|
4848
|
+
* interrupts are not caught.
|
|
4575
4849
|
*
|
|
4576
4850
|
* **Previously Known As**
|
|
4577
4851
|
*
|
|
@@ -4598,7 +4872,7 @@ export declare const catchIf: {
|
|
|
4598
4872
|
*
|
|
4599
4873
|
* // With a Filter
|
|
4600
4874
|
* const recovered2 = program.pipe(
|
|
4601
|
-
* Effect.
|
|
4875
|
+
* Effect.catchFilter(
|
|
4602
4876
|
* Filter.tagged("NotFound"),
|
|
4603
4877
|
* (error) => Effect.succeed(`missing:${error.id}`)
|
|
4604
4878
|
* )
|
|
@@ -4608,17 +4882,16 @@ export declare const catchIf: {
|
|
|
4608
4882
|
* @since 2.0.0
|
|
4609
4883
|
* @category Error Handling
|
|
4610
4884
|
*/
|
|
4611
|
-
<E,
|
|
4885
|
+
<E, A2, E2, R2, A3 = never, E3 = E, R3 = never>(predicate: Predicate.Predicate<NoInfer<E>>, f: (e: NoInfer<E>) => Effect<A2, E2, R2>, orElse?: ((e: NoInfer<E>) => Effect<A3, E3, R3>) | undefined): <A, R>(self: Effect<A, E, R>) => Effect<A | A2 | A3, E2 | E3, R | R2 | R3>;
|
|
4612
4886
|
/**
|
|
4613
|
-
* Recovers from specific errors using a `
|
|
4614
|
-
* `Refinement`.
|
|
4887
|
+
* Recovers from specific errors using a `Predicate` or `Refinement`.
|
|
4615
4888
|
*
|
|
4616
4889
|
* **When to Use**
|
|
4617
4890
|
*
|
|
4618
|
-
* `catchIf` lets you recover from errors that match a condition.
|
|
4619
|
-
* `
|
|
4620
|
-
*
|
|
4621
|
-
*
|
|
4891
|
+
* `catchIf` lets you recover from errors that match a condition. Use a
|
|
4892
|
+
* `Refinement` for type narrowing or a `Predicate` for simple boolean
|
|
4893
|
+
* matching. Non-matching errors re-fail with the original cause. Defects and
|
|
4894
|
+
* interrupts are not caught.
|
|
4622
4895
|
*
|
|
4623
4896
|
* **Previously Known As**
|
|
4624
4897
|
*
|
|
@@ -4645,7 +4918,7 @@ export declare const catchIf: {
|
|
|
4645
4918
|
*
|
|
4646
4919
|
* // With a Filter
|
|
4647
4920
|
* const recovered2 = program.pipe(
|
|
4648
|
-
* Effect.
|
|
4921
|
+
* Effect.catchFilter(
|
|
4649
4922
|
* Filter.tagged("NotFound"),
|
|
4650
4923
|
* (error) => Effect.succeed(`missing:${error.id}`)
|
|
4651
4924
|
* )
|
|
@@ -4657,15 +4930,14 @@ export declare const catchIf: {
|
|
|
4657
4930
|
*/
|
|
4658
4931
|
<A, E, R, EB extends E, A2, E2, R2, A3 = never, E3 = Exclude<E, EB>, R3 = never>(self: Effect<A, E, R>, refinement: Predicate.Refinement<E, EB>, f: (e: EB) => Effect<A2, E2, R2>, orElse?: ((e: Exclude<E, EB>) => Effect<A3, E3, R3>) | undefined): Effect<A | A2 | A3, E2 | E3, R | R2 | R3>;
|
|
4659
4932
|
/**
|
|
4660
|
-
* Recovers from specific errors using a `
|
|
4661
|
-
* `Refinement`.
|
|
4933
|
+
* Recovers from specific errors using a `Predicate` or `Refinement`.
|
|
4662
4934
|
*
|
|
4663
4935
|
* **When to Use**
|
|
4664
4936
|
*
|
|
4665
|
-
* `catchIf` lets you recover from errors that match a condition.
|
|
4666
|
-
* `
|
|
4667
|
-
*
|
|
4668
|
-
*
|
|
4937
|
+
* `catchIf` lets you recover from errors that match a condition. Use a
|
|
4938
|
+
* `Refinement` for type narrowing or a `Predicate` for simple boolean
|
|
4939
|
+
* matching. Non-matching errors re-fail with the original cause. Defects and
|
|
4940
|
+
* interrupts are not caught.
|
|
4669
4941
|
*
|
|
4670
4942
|
* **Previously Known As**
|
|
4671
4943
|
*
|
|
@@ -4692,7 +4964,7 @@ export declare const catchIf: {
|
|
|
4692
4964
|
*
|
|
4693
4965
|
* // With a Filter
|
|
4694
4966
|
* const recovered2 = program.pipe(
|
|
4695
|
-
* Effect.
|
|
4967
|
+
* Effect.catchFilter(
|
|
4696
4968
|
* Filter.tagged("NotFound"),
|
|
4697
4969
|
* (error) => Effect.succeed(`missing:${error.id}`)
|
|
4698
4970
|
* )
|
|
@@ -4702,7 +4974,29 @@ export declare const catchIf: {
|
|
|
4702
4974
|
* @since 2.0.0
|
|
4703
4975
|
* @category Error Handling
|
|
4704
4976
|
*/
|
|
4705
|
-
<A, E, R,
|
|
4977
|
+
<A, E, R, A2, E2, R2, A3 = never, E3 = E, R3 = never>(self: Effect<A, E, R>, predicate: Predicate.Predicate<E>, f: (e: E) => Effect<A2, E2, R2>, orElse?: ((e: E) => Effect<A3, E3, R3>) | undefined): Effect<A | A2 | A3, E2 | E3, R | R2 | R3>;
|
|
4978
|
+
};
|
|
4979
|
+
/**
|
|
4980
|
+
* Recovers from specific errors using a `Filter`.
|
|
4981
|
+
*
|
|
4982
|
+
* @since 4.0.0
|
|
4983
|
+
* @category Error Handling
|
|
4984
|
+
*/
|
|
4985
|
+
export declare const catchFilter: {
|
|
4986
|
+
/**
|
|
4987
|
+
* Recovers from specific errors using a `Filter`.
|
|
4988
|
+
*
|
|
4989
|
+
* @since 4.0.0
|
|
4990
|
+
* @category Error Handling
|
|
4991
|
+
*/
|
|
4992
|
+
<E, EB, A2, E2, R2, X, A3 = never, E3 = X, R3 = never>(filter: Filter.Filter<NoInfer<E>, EB, X>, f: (e: EB) => Effect<A2, E2, R2>, orElse?: ((e: X) => Effect<A3, E3, R3>) | undefined): <A, R>(self: Effect<A, E, R>) => Effect<A | A2 | A3, E2 | E3, R | R2 | R3>;
|
|
4993
|
+
/**
|
|
4994
|
+
* Recovers from specific errors using a `Filter`.
|
|
4995
|
+
*
|
|
4996
|
+
* @since 4.0.0
|
|
4997
|
+
* @category Error Handling
|
|
4998
|
+
*/
|
|
4999
|
+
<A, E, R, EB, A2, E2, R2, X, A3 = never, E3 = X, R3 = never>(self: Effect<A, E, R>, filter: Filter.Filter<NoInfer<E>, EB, X>, f: (e: EB) => Effect<A2, E2, R2>, orElse?: ((e: X) => Effect<A3, E3, R3>) | undefined): Effect<A | A2 | A3, E2 | E3, R | R2 | R3>;
|
|
4706
5000
|
};
|
|
4707
5001
|
/**
|
|
4708
5002
|
* Catches `NoSuchElementError` failures and converts them to `Option.none`.
|
|
@@ -4808,7 +5102,7 @@ export declare const catchCauseIf: {
|
|
|
4808
5102
|
* @since 4.0.0
|
|
4809
5103
|
* @category Error Handling
|
|
4810
5104
|
*/
|
|
4811
|
-
<E,
|
|
5105
|
+
<E, B, E2, R2>(predicate: Predicate.Predicate<Cause.Cause<E>>, f: (cause: Cause.Cause<E>) => Effect<B, E2, R2>): <A, R>(self: Effect<A, E, R>) => Effect<A | B, E | E2, R | R2>;
|
|
4812
5106
|
/**
|
|
4813
5107
|
* Recovers from specific failures based on a predicate.
|
|
4814
5108
|
*
|
|
@@ -4847,7 +5141,29 @@ export declare const catchCauseIf: {
|
|
|
4847
5141
|
* @since 4.0.0
|
|
4848
5142
|
* @category Error Handling
|
|
4849
5143
|
*/
|
|
4850
|
-
<A, E, R, B, E2, R2
|
|
5144
|
+
<A, E, R, B, E2, R2>(self: Effect<A, E, R>, predicate: Predicate.Predicate<Cause.Cause<E>>, f: (cause: Cause.Cause<E>) => Effect<B, E2, R2>): Effect<A | B, E | E2, R | R2>;
|
|
5145
|
+
};
|
|
5146
|
+
/**
|
|
5147
|
+
* Recovers from specific failures based on a `Filter`.
|
|
5148
|
+
*
|
|
5149
|
+
* @since 4.0.0
|
|
5150
|
+
* @category Error Handling
|
|
5151
|
+
*/
|
|
5152
|
+
export declare const catchCauseFilter: {
|
|
5153
|
+
/**
|
|
5154
|
+
* Recovers from specific failures based on a `Filter`.
|
|
5155
|
+
*
|
|
5156
|
+
* @since 4.0.0
|
|
5157
|
+
* @category Error Handling
|
|
5158
|
+
*/
|
|
5159
|
+
<E, B, E2, R2, EB, X extends Cause.Cause<any>>(filter: Filter.Filter<Cause.Cause<E>, EB, X>, f: (failure: EB, cause: Cause.Cause<E>) => Effect<B, E2, R2>): <A, R>(self: Effect<A, E, R>) => Effect<A | B, Cause.Cause.Error<X> | E2, R | R2>;
|
|
5160
|
+
/**
|
|
5161
|
+
* Recovers from specific failures based on a `Filter`.
|
|
5162
|
+
*
|
|
5163
|
+
* @since 4.0.0
|
|
5164
|
+
* @category Error Handling
|
|
5165
|
+
*/
|
|
5166
|
+
<A, E, R, B, E2, R2, EB, X extends Cause.Cause<any>>(self: Effect<A, E, R>, filter: Filter.Filter<Cause.Cause<E>, EB, X>, f: (failure: EB, cause: Cause.Cause<E>) => Effect<B, E2, R2>): Effect<A | B, Cause.Cause.Error<X> | E2, R | R2>;
|
|
4851
5167
|
};
|
|
4852
5168
|
/**
|
|
4853
5169
|
* The `mapError` function is used to transform or modify the error
|
|
@@ -5454,7 +5770,7 @@ export declare const tapCauseIf: {
|
|
|
5454
5770
|
* @since 4.0.0
|
|
5455
5771
|
* @category Sequencing
|
|
5456
5772
|
*/
|
|
5457
|
-
<E,
|
|
5773
|
+
<E, B, E2, R2>(predicate: Predicate.Predicate<Cause.Cause<E>>, f: (cause: Cause.Cause<E>) => Effect<B, E2, R2>): <A, R>(self: Effect<A, E, R>) => Effect<A, E | E2, R | R2>;
|
|
5458
5774
|
/**
|
|
5459
5775
|
* Conditionally executes a side effect based on the cause of a failed effect.
|
|
5460
5776
|
*
|
|
@@ -5483,7 +5799,29 @@ export declare const tapCauseIf: {
|
|
|
5483
5799
|
* @since 4.0.0
|
|
5484
5800
|
* @category Sequencing
|
|
5485
5801
|
*/
|
|
5486
|
-
<A, E, R,
|
|
5802
|
+
<A, E, R, B, E2, R2>(self: Effect<A, E, R>, predicate: Predicate.Predicate<Cause.Cause<E>>, f: (cause: Cause.Cause<E>) => Effect<B, E2, R2>): Effect<A, E | E2, R | R2>;
|
|
5803
|
+
};
|
|
5804
|
+
/**
|
|
5805
|
+
* Conditionally executes a side effect based on the cause of a failed effect.
|
|
5806
|
+
*
|
|
5807
|
+
* @since 4.0.0
|
|
5808
|
+
* @category Sequencing
|
|
5809
|
+
*/
|
|
5810
|
+
export declare const tapCauseFilter: {
|
|
5811
|
+
/**
|
|
5812
|
+
* Conditionally executes a side effect based on the cause of a failed effect.
|
|
5813
|
+
*
|
|
5814
|
+
* @since 4.0.0
|
|
5815
|
+
* @category Sequencing
|
|
5816
|
+
*/
|
|
5817
|
+
<E, B, E2, R2, EB, X extends Cause.Cause<any>>(filter: Filter.Filter<Cause.Cause<E>, EB, X>, f: (a: EB, cause: Cause.Cause<E>) => Effect<B, E2, R2>): <A, R>(self: Effect<A, E, R>) => Effect<A, E | E2, R | R2>;
|
|
5818
|
+
/**
|
|
5819
|
+
* Conditionally executes a side effect based on the cause of a failed effect.
|
|
5820
|
+
*
|
|
5821
|
+
* @since 4.0.0
|
|
5822
|
+
* @category Sequencing
|
|
5823
|
+
*/
|
|
5824
|
+
<A, E, R, B, E2, R2, EB, X extends Cause.Cause<any>>(self: Effect<A, E, R>, filter: Filter.Filter<Cause.Cause<E>, EB, X>, f: (a: EB, cause: Cause.Cause<E>) => Effect<B, E2, R2>): Effect<A, E | E2, R | R2>;
|
|
5487
5825
|
};
|
|
5488
5826
|
/**
|
|
5489
5827
|
* Inspect severe errors or defects (non-recoverable failures) in an effect.
|
|
@@ -6337,11 +6675,11 @@ export declare const sandbox: <A, E, R>(self: Effect<A, E, R>) => Effect<A, Caus
|
|
|
6337
6675
|
* @category Error Handling
|
|
6338
6676
|
*/
|
|
6339
6677
|
export declare const ignore: <Arg extends Effect<any, any, any> | {
|
|
6340
|
-
readonly log?: boolean |
|
|
6678
|
+
readonly log?: boolean | Severity | undefined;
|
|
6341
6679
|
} | undefined = {
|
|
6342
|
-
readonly log?: boolean |
|
|
6680
|
+
readonly log?: boolean | Severity | undefined;
|
|
6343
6681
|
}>(effectOrOptions?: Arg, options?: {
|
|
6344
|
-
readonly log?: boolean |
|
|
6682
|
+
readonly log?: boolean | Severity | undefined;
|
|
6345
6683
|
} | undefined) => [Arg] extends [Effect<infer _A, infer _E, infer _R>] ? Effect<void, never, _R> : <A, E, R>(self: Effect<A, E, R>) => Effect<void, never, R>;
|
|
6346
6684
|
/**
|
|
6347
6685
|
* Ignores the effect's failure cause, including defects and interruptions.
|
|
@@ -6362,11 +6700,11 @@ export declare const ignore: <Arg extends Effect<any, any, any> | {
|
|
|
6362
6700
|
* @category Error Handling
|
|
6363
6701
|
*/
|
|
6364
6702
|
export declare const ignoreCause: <Arg extends Effect<any, any, any> | {
|
|
6365
|
-
readonly log?: boolean |
|
|
6703
|
+
readonly log?: boolean | Severity | undefined;
|
|
6366
6704
|
} | undefined = {
|
|
6367
|
-
readonly log?: boolean |
|
|
6705
|
+
readonly log?: boolean | Severity | undefined;
|
|
6368
6706
|
}>(effectOrOptions?: Arg, options?: {
|
|
6369
|
-
readonly log?: boolean |
|
|
6707
|
+
readonly log?: boolean | Severity | undefined;
|
|
6370
6708
|
} | undefined) => [Arg] extends [Effect<infer _A, infer _E, infer _R>] ? Effect<void, never, _R> : <A, E, R>(self: Effect<A, E, R>) => Effect<void, never, R>;
|
|
6371
6709
|
/**
|
|
6372
6710
|
* Apply an `ExecutionPlan` to an effect, retrying with step-provided resources
|
|
@@ -6472,6 +6810,22 @@ export declare const withExecutionPlan: {
|
|
|
6472
6810
|
requirements: PlanR;
|
|
6473
6811
|
}>): Effect<A, E | PlanE, Exclude<R, Provides> | PlanR>;
|
|
6474
6812
|
};
|
|
6813
|
+
/**
|
|
6814
|
+
* Runs an effect and reports any errors to the configured `ErrorReporter`s.
|
|
6815
|
+
*
|
|
6816
|
+
* If the `defectsOnly` option is set to `true`, only defects (unrecoverable
|
|
6817
|
+
* errors) will be reported, while regular failures will be ignored.
|
|
6818
|
+
*
|
|
6819
|
+
* @since 4.0.0
|
|
6820
|
+
* @category Error Handling
|
|
6821
|
+
*/
|
|
6822
|
+
export declare const withErrorReporting: <Arg extends Effect<any, any, any> | {
|
|
6823
|
+
readonly defectsOnly?: boolean | undefined;
|
|
6824
|
+
} | undefined = {
|
|
6825
|
+
readonly defectsOnly?: boolean | undefined;
|
|
6826
|
+
}>(effectOrOptions: Arg, options?: {
|
|
6827
|
+
readonly defectsOnly?: boolean | undefined;
|
|
6828
|
+
} | undefined) => [Arg] extends [Effect<infer _A, infer _E, infer _R>] ? Arg : <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, R>;
|
|
6475
6829
|
/**
|
|
6476
6830
|
* Replaces the original failure with a success value, ensuring the effect
|
|
6477
6831
|
* cannot fail.
|
|
@@ -6692,7 +7046,7 @@ export declare const timeout: {
|
|
|
6692
7046
|
* @since 2.0.0
|
|
6693
7047
|
* @category Delays & Timeouts
|
|
6694
7048
|
*/
|
|
6695
|
-
(duration: Duration.
|
|
7049
|
+
(duration: Duration.Input): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E | Cause.TimeoutError, R>;
|
|
6696
7050
|
/**
|
|
6697
7051
|
* Adds a time limit to an effect, triggering a timeout if the effect exceeds
|
|
6698
7052
|
* the duration.
|
|
@@ -6739,7 +7093,7 @@ export declare const timeout: {
|
|
|
6739
7093
|
* @since 2.0.0
|
|
6740
7094
|
* @category Delays & Timeouts
|
|
6741
7095
|
*/
|
|
6742
|
-
<A, E, R>(self: Effect<A, E, R>, duration: Duration.
|
|
7096
|
+
<A, E, R>(self: Effect<A, E, R>, duration: Duration.Input): Effect<A, E | Cause.TimeoutError, R>;
|
|
6743
7097
|
};
|
|
6744
7098
|
/**
|
|
6745
7099
|
* Handles timeouts by returning an `Option` that represents either the result
|
|
@@ -6840,7 +7194,7 @@ export declare const timeoutOption: {
|
|
|
6840
7194
|
* @since 3.1.0
|
|
6841
7195
|
* @category Delays & Timeouts
|
|
6842
7196
|
*/
|
|
6843
|
-
(duration: Duration.
|
|
7197
|
+
(duration: Duration.Input): <A, E, R>(self: Effect<A, E, R>) => Effect<Option<A>, E, R>;
|
|
6844
7198
|
/**
|
|
6845
7199
|
* Handles timeouts by returning an `Option` that represents either the result
|
|
6846
7200
|
* or a timeout.
|
|
@@ -6890,7 +7244,7 @@ export declare const timeoutOption: {
|
|
|
6890
7244
|
* @since 3.1.0
|
|
6891
7245
|
* @category Delays & Timeouts
|
|
6892
7246
|
*/
|
|
6893
|
-
<A, E, R>(self: Effect<A, E, R>, duration: Duration.
|
|
7247
|
+
<A, E, R>(self: Effect<A, E, R>, duration: Duration.Input): Effect<Option<A>, E, R>;
|
|
6894
7248
|
};
|
|
6895
7249
|
/**
|
|
6896
7250
|
* Applies a timeout to an effect, with a fallback effect executed if the timeout is reached.
|
|
@@ -6966,7 +7320,7 @@ export declare const timeoutOrElse: {
|
|
|
6966
7320
|
* @category Delays & Timeouts
|
|
6967
7321
|
*/
|
|
6968
7322
|
<A2, E2, R2>(options: {
|
|
6969
|
-
readonly duration: Duration.
|
|
7323
|
+
readonly duration: Duration.Input;
|
|
6970
7324
|
readonly onTimeout: LazyArg<Effect<A2, E2, R2>>;
|
|
6971
7325
|
}): <A, E, R>(self: Effect<A, E, R>) => Effect<A | A2, E | E2, R | R2>;
|
|
6972
7326
|
/**
|
|
@@ -7006,7 +7360,7 @@ export declare const timeoutOrElse: {
|
|
|
7006
7360
|
* @category Delays & Timeouts
|
|
7007
7361
|
*/
|
|
7008
7362
|
<A, E, R, A2, E2, R2>(self: Effect<A, E, R>, options: {
|
|
7009
|
-
readonly duration: Duration.
|
|
7363
|
+
readonly duration: Duration.Input;
|
|
7010
7364
|
readonly onTimeout: LazyArg<Effect<A2, E2, R2>>;
|
|
7011
7365
|
}): Effect<A | A2, E | E2, R | R2>;
|
|
7012
7366
|
};
|
|
@@ -7051,7 +7405,7 @@ export declare const delay: {
|
|
|
7051
7405
|
* @since 2.0.0
|
|
7052
7406
|
* @category Delays & Timeouts
|
|
7053
7407
|
*/
|
|
7054
|
-
(duration: Duration.
|
|
7408
|
+
(duration: Duration.Input): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, R>;
|
|
7055
7409
|
/**
|
|
7056
7410
|
* Returns an effect that is delayed from this effect by the specified
|
|
7057
7411
|
* `Duration`.
|
|
@@ -7072,7 +7426,7 @@ export declare const delay: {
|
|
|
7072
7426
|
* @since 2.0.0
|
|
7073
7427
|
* @category Delays & Timeouts
|
|
7074
7428
|
*/
|
|
7075
|
-
<A, E, R>(self: Effect<A, E, R>, duration: Duration.
|
|
7429
|
+
<A, E, R>(self: Effect<A, E, R>, duration: Duration.Input): Effect<A, E, R>;
|
|
7076
7430
|
};
|
|
7077
7431
|
/**
|
|
7078
7432
|
* Returns an effect that suspends for the specified duration. This method is
|
|
@@ -7096,7 +7450,7 @@ export declare const delay: {
|
|
|
7096
7450
|
* @since 2.0.0
|
|
7097
7451
|
* @category Delays & Timeouts
|
|
7098
7452
|
*/
|
|
7099
|
-
export declare const sleep: (duration: Duration.
|
|
7453
|
+
export declare const sleep: (duration: Duration.Input) => Effect<void>;
|
|
7100
7454
|
/**
|
|
7101
7455
|
* Measures the runtime of an effect and returns the duration with its result.
|
|
7102
7456
|
*
|
|
@@ -7389,12 +7743,12 @@ export declare const raceFirst: {
|
|
|
7389
7743
|
}): Effect<A | A2, E | E2, R | R2>;
|
|
7390
7744
|
};
|
|
7391
7745
|
/**
|
|
7392
|
-
* Filters elements of an iterable using a predicate, refinement, effectful
|
|
7393
|
-
* predicate
|
|
7746
|
+
* Filters elements of an iterable using a predicate, refinement, or effectful
|
|
7747
|
+
* predicate.
|
|
7394
7748
|
*
|
|
7395
7749
|
* @example
|
|
7396
7750
|
* ```ts
|
|
7397
|
-
* import { Effect
|
|
7751
|
+
* import { Effect } from "effect"
|
|
7398
7752
|
*
|
|
7399
7753
|
* // Sync predicate
|
|
7400
7754
|
* const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
|
|
@@ -7402,10 +7756,7 @@ export declare const raceFirst: {
|
|
|
7402
7756
|
* // Effectful predicate
|
|
7403
7757
|
* const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
|
|
7404
7758
|
*
|
|
7405
|
-
* //
|
|
7406
|
-
* const mapped = Effect.filter([1, 2, 3, 4], (n) =>
|
|
7407
|
-
* Effect.succeed(n % 2 === 0 ? Result.succeed(n * 2) : Result.fail(n))
|
|
7408
|
-
* )
|
|
7759
|
+
* // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
|
|
7409
7760
|
* ```
|
|
7410
7761
|
*
|
|
7411
7762
|
* @since 2.0.0
|
|
@@ -7413,12 +7764,12 @@ export declare const raceFirst: {
|
|
|
7413
7764
|
*/
|
|
7414
7765
|
export declare const filter: {
|
|
7415
7766
|
/**
|
|
7416
|
-
* Filters elements of an iterable using a predicate, refinement, effectful
|
|
7417
|
-
* predicate
|
|
7767
|
+
* Filters elements of an iterable using a predicate, refinement, or effectful
|
|
7768
|
+
* predicate.
|
|
7418
7769
|
*
|
|
7419
7770
|
* @example
|
|
7420
7771
|
* ```ts
|
|
7421
|
-
* import { Effect
|
|
7772
|
+
* import { Effect } from "effect"
|
|
7422
7773
|
*
|
|
7423
7774
|
* // Sync predicate
|
|
7424
7775
|
* const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
|
|
@@ -7426,10 +7777,7 @@ export declare const filter: {
|
|
|
7426
7777
|
* // Effectful predicate
|
|
7427
7778
|
* const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
|
|
7428
7779
|
*
|
|
7429
|
-
* //
|
|
7430
|
-
* const mapped = Effect.filter([1, 2, 3, 4], (n) =>
|
|
7431
|
-
* Effect.succeed(n % 2 === 0 ? Result.succeed(n * 2) : Result.fail(n))
|
|
7432
|
-
* )
|
|
7780
|
+
* // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
|
|
7433
7781
|
* ```
|
|
7434
7782
|
*
|
|
7435
7783
|
* @since 2.0.0
|
|
@@ -7437,12 +7785,12 @@ export declare const filter: {
|
|
|
7437
7785
|
*/
|
|
7438
7786
|
<A, B extends A>(refinement: Predicate.Refinement<NoInfer<A>, B>): (elements: Iterable<A>) => Effect<Array<B>>;
|
|
7439
7787
|
/**
|
|
7440
|
-
* Filters elements of an iterable using a predicate, refinement, effectful
|
|
7441
|
-
* predicate
|
|
7788
|
+
* Filters elements of an iterable using a predicate, refinement, or effectful
|
|
7789
|
+
* predicate.
|
|
7442
7790
|
*
|
|
7443
7791
|
* @example
|
|
7444
7792
|
* ```ts
|
|
7445
|
-
* import { Effect
|
|
7793
|
+
* import { Effect } from "effect"
|
|
7446
7794
|
*
|
|
7447
7795
|
* // Sync predicate
|
|
7448
7796
|
* const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
|
|
@@ -7450,10 +7798,7 @@ export declare const filter: {
|
|
|
7450
7798
|
* // Effectful predicate
|
|
7451
7799
|
* const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
|
|
7452
7800
|
*
|
|
7453
|
-
* //
|
|
7454
|
-
* const mapped = Effect.filter([1, 2, 3, 4], (n) =>
|
|
7455
|
-
* Effect.succeed(n % 2 === 0 ? Result.succeed(n * 2) : Result.fail(n))
|
|
7456
|
-
* )
|
|
7801
|
+
* // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
|
|
7457
7802
|
* ```
|
|
7458
7803
|
*
|
|
7459
7804
|
* @since 2.0.0
|
|
@@ -7461,12 +7806,12 @@ export declare const filter: {
|
|
|
7461
7806
|
*/
|
|
7462
7807
|
<A>(predicate: Predicate.Predicate<NoInfer<A>>): (elements: Iterable<A>) => Effect<Array<A>>;
|
|
7463
7808
|
/**
|
|
7464
|
-
* Filters elements of an iterable using a predicate, refinement, effectful
|
|
7465
|
-
* predicate
|
|
7809
|
+
* Filters elements of an iterable using a predicate, refinement, or effectful
|
|
7810
|
+
* predicate.
|
|
7466
7811
|
*
|
|
7467
7812
|
* @example
|
|
7468
7813
|
* ```ts
|
|
7469
|
-
* import { Effect
|
|
7814
|
+
* import { Effect } from "effect"
|
|
7470
7815
|
*
|
|
7471
7816
|
* // Sync predicate
|
|
7472
7817
|
* const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
|
|
@@ -7474,25 +7819,22 @@ export declare const filter: {
|
|
|
7474
7819
|
* // Effectful predicate
|
|
7475
7820
|
* const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
|
|
7476
7821
|
*
|
|
7477
|
-
* //
|
|
7478
|
-
* const mapped = Effect.filter([1, 2, 3, 4], (n) =>
|
|
7479
|
-
* Effect.succeed(n % 2 === 0 ? Result.succeed(n * 2) : Result.fail(n))
|
|
7480
|
-
* )
|
|
7822
|
+
* // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
|
|
7481
7823
|
* ```
|
|
7482
7824
|
*
|
|
7483
7825
|
* @since 2.0.0
|
|
7484
7826
|
* @category Filtering
|
|
7485
7827
|
*/
|
|
7486
|
-
<A,
|
|
7828
|
+
<A, E, R>(predicate: (a: NoInfer<A>, i: number) => Effect<boolean, E, R>, options?: {
|
|
7487
7829
|
readonly concurrency?: Concurrency | undefined;
|
|
7488
|
-
}): (
|
|
7830
|
+
}): (iterable: Iterable<A>) => Effect<Array<A>, E, R>;
|
|
7489
7831
|
/**
|
|
7490
|
-
* Filters elements of an iterable using a predicate, refinement, effectful
|
|
7491
|
-
* predicate
|
|
7832
|
+
* Filters elements of an iterable using a predicate, refinement, or effectful
|
|
7833
|
+
* predicate.
|
|
7492
7834
|
*
|
|
7493
7835
|
* @example
|
|
7494
7836
|
* ```ts
|
|
7495
|
-
* import { Effect
|
|
7837
|
+
* import { Effect } from "effect"
|
|
7496
7838
|
*
|
|
7497
7839
|
* // Sync predicate
|
|
7498
7840
|
* const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
|
|
@@ -7500,25 +7842,20 @@ export declare const filter: {
|
|
|
7500
7842
|
* // Effectful predicate
|
|
7501
7843
|
* const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
|
|
7502
7844
|
*
|
|
7503
|
-
* //
|
|
7504
|
-
* const mapped = Effect.filter([1, 2, 3, 4], (n) =>
|
|
7505
|
-
* Effect.succeed(n % 2 === 0 ? Result.succeed(n * 2) : Result.fail(n))
|
|
7506
|
-
* )
|
|
7845
|
+
* // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
|
|
7507
7846
|
* ```
|
|
7508
7847
|
*
|
|
7509
7848
|
* @since 2.0.0
|
|
7510
7849
|
* @category Filtering
|
|
7511
7850
|
*/
|
|
7512
|
-
<A, B
|
|
7513
|
-
readonly concurrency?: Concurrency | undefined;
|
|
7514
|
-
}): (elements: Iterable<A>) => Effect<Array<B>, E, R>;
|
|
7851
|
+
<A, B extends A>(elements: Iterable<A>, refinement: Predicate.Refinement<A, B>): Effect<Array<B>>;
|
|
7515
7852
|
/**
|
|
7516
|
-
* Filters elements of an iterable using a predicate, refinement, effectful
|
|
7517
|
-
* predicate
|
|
7853
|
+
* Filters elements of an iterable using a predicate, refinement, or effectful
|
|
7854
|
+
* predicate.
|
|
7518
7855
|
*
|
|
7519
7856
|
* @example
|
|
7520
7857
|
* ```ts
|
|
7521
|
-
* import { Effect
|
|
7858
|
+
* import { Effect } from "effect"
|
|
7522
7859
|
*
|
|
7523
7860
|
* // Sync predicate
|
|
7524
7861
|
* const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
|
|
@@ -7526,25 +7863,20 @@ export declare const filter: {
|
|
|
7526
7863
|
* // Effectful predicate
|
|
7527
7864
|
* const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
|
|
7528
7865
|
*
|
|
7529
|
-
* //
|
|
7530
|
-
* const mapped = Effect.filter([1, 2, 3, 4], (n) =>
|
|
7531
|
-
* Effect.succeed(n % 2 === 0 ? Result.succeed(n * 2) : Result.fail(n))
|
|
7532
|
-
* )
|
|
7866
|
+
* // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
|
|
7533
7867
|
* ```
|
|
7534
7868
|
*
|
|
7535
7869
|
* @since 2.0.0
|
|
7536
7870
|
* @category Filtering
|
|
7537
7871
|
*/
|
|
7538
|
-
<A
|
|
7539
|
-
readonly concurrency?: Concurrency | undefined;
|
|
7540
|
-
}): (iterable: Iterable<A>) => Effect<Array<A>, E, R>;
|
|
7872
|
+
<A>(elements: Iterable<A>, predicate: Predicate.Predicate<A>): Effect<Array<A>>;
|
|
7541
7873
|
/**
|
|
7542
|
-
* Filters elements of an iterable using a predicate, refinement, effectful
|
|
7543
|
-
* predicate
|
|
7874
|
+
* Filters elements of an iterable using a predicate, refinement, or effectful
|
|
7875
|
+
* predicate.
|
|
7544
7876
|
*
|
|
7545
7877
|
* @example
|
|
7546
7878
|
* ```ts
|
|
7547
|
-
* import { Effect
|
|
7879
|
+
* import { Effect } from "effect"
|
|
7548
7880
|
*
|
|
7549
7881
|
* // Sync predicate
|
|
7550
7882
|
* const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
|
|
@@ -7552,116 +7884,63 @@ export declare const filter: {
|
|
|
7552
7884
|
* // Effectful predicate
|
|
7553
7885
|
* const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
|
|
7554
7886
|
*
|
|
7555
|
-
* //
|
|
7556
|
-
* const mapped = Effect.filter([1, 2, 3, 4], (n) =>
|
|
7557
|
-
* Effect.succeed(n % 2 === 0 ? Result.succeed(n * 2) : Result.fail(n))
|
|
7558
|
-
* )
|
|
7887
|
+
* // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
|
|
7559
7888
|
* ```
|
|
7560
7889
|
*
|
|
7561
7890
|
* @since 2.0.0
|
|
7562
7891
|
* @category Filtering
|
|
7563
7892
|
*/
|
|
7564
|
-
<A,
|
|
7893
|
+
<A, E, R>(iterable: Iterable<A>, predicate: (a: NoInfer<A>, i: number) => Effect<boolean, E, R>, options?: {
|
|
7894
|
+
readonly concurrency?: Concurrency | undefined;
|
|
7895
|
+
}): Effect<Array<A>, E, R>;
|
|
7896
|
+
};
|
|
7897
|
+
/**
|
|
7898
|
+
* Filters and maps elements of an iterable with a `Filter`.
|
|
7899
|
+
*
|
|
7900
|
+
* @since 4.0.0
|
|
7901
|
+
* @category Filtering
|
|
7902
|
+
*/
|
|
7903
|
+
export declare const filterMap: {
|
|
7565
7904
|
/**
|
|
7566
|
-
* Filters elements of an iterable
|
|
7567
|
-
* predicate, or `Filter.FilterEffect`.
|
|
7568
|
-
*
|
|
7569
|
-
* @example
|
|
7570
|
-
* ```ts
|
|
7571
|
-
* import { Effect, Filter, Result } from "effect"
|
|
7572
|
-
*
|
|
7573
|
-
* // Sync predicate
|
|
7574
|
-
* const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
|
|
7905
|
+
* Filters and maps elements of an iterable with a `Filter`.
|
|
7575
7906
|
*
|
|
7576
|
-
*
|
|
7577
|
-
* const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
|
|
7578
|
-
*
|
|
7579
|
-
* // FilterEffect
|
|
7580
|
-
* const mapped = Effect.filter([1, 2, 3, 4], (n) =>
|
|
7581
|
-
* Effect.succeed(n % 2 === 0 ? Result.succeed(n * 2) : Result.fail(n))
|
|
7582
|
-
* )
|
|
7583
|
-
* ```
|
|
7584
|
-
*
|
|
7585
|
-
* @since 2.0.0
|
|
7907
|
+
* @since 4.0.0
|
|
7586
7908
|
* @category Filtering
|
|
7587
7909
|
*/
|
|
7588
|
-
<A>(
|
|
7910
|
+
<A, B, X>(filter: Filter.Filter<NoInfer<A>, B, X>): (elements: Iterable<A>) => Effect<Array<B>>;
|
|
7589
7911
|
/**
|
|
7590
|
-
* Filters elements of an iterable
|
|
7591
|
-
* predicate, or `Filter.FilterEffect`.
|
|
7592
|
-
*
|
|
7593
|
-
* @example
|
|
7594
|
-
* ```ts
|
|
7595
|
-
* import { Effect, Filter, Result } from "effect"
|
|
7596
|
-
*
|
|
7597
|
-
* // Sync predicate
|
|
7598
|
-
* const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
|
|
7912
|
+
* Filters and maps elements of an iterable with a `Filter`.
|
|
7599
7913
|
*
|
|
7600
|
-
*
|
|
7601
|
-
* const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
|
|
7602
|
-
*
|
|
7603
|
-
* // FilterEffect
|
|
7604
|
-
* const mapped = Effect.filter([1, 2, 3, 4], (n) =>
|
|
7605
|
-
* Effect.succeed(n % 2 === 0 ? Result.succeed(n * 2) : Result.fail(n))
|
|
7606
|
-
* )
|
|
7607
|
-
* ```
|
|
7608
|
-
*
|
|
7609
|
-
* @since 2.0.0
|
|
7914
|
+
* @since 4.0.0
|
|
7610
7915
|
* @category Filtering
|
|
7611
7916
|
*/
|
|
7612
7917
|
<A, B, X>(elements: Iterable<A>, filter: Filter.Filter<NoInfer<A>, B, X>): Effect<Array<B>>;
|
|
7918
|
+
};
|
|
7919
|
+
/**
|
|
7920
|
+
* Effectfully filters and maps elements of an iterable with a `FilterEffect`.
|
|
7921
|
+
*
|
|
7922
|
+
* @since 4.0.0
|
|
7923
|
+
* @category Filtering
|
|
7924
|
+
*/
|
|
7925
|
+
export declare const filterMapEffect: {
|
|
7613
7926
|
/**
|
|
7614
|
-
*
|
|
7615
|
-
* predicate, or `Filter.FilterEffect`.
|
|
7927
|
+
* Effectfully filters and maps elements of an iterable with a `FilterEffect`.
|
|
7616
7928
|
*
|
|
7617
|
-
* @
|
|
7618
|
-
* ```ts
|
|
7619
|
-
* import { Effect, Filter, Result } from "effect"
|
|
7620
|
-
*
|
|
7621
|
-
* // Sync predicate
|
|
7622
|
-
* const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
|
|
7623
|
-
*
|
|
7624
|
-
* // Effectful predicate
|
|
7625
|
-
* const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
|
|
7626
|
-
*
|
|
7627
|
-
* // FilterEffect
|
|
7628
|
-
* const mapped = Effect.filter([1, 2, 3, 4], (n) =>
|
|
7629
|
-
* Effect.succeed(n % 2 === 0 ? Result.succeed(n * 2) : Result.fail(n))
|
|
7630
|
-
* )
|
|
7631
|
-
* ```
|
|
7632
|
-
*
|
|
7633
|
-
* @since 2.0.0
|
|
7929
|
+
* @since 4.0.0
|
|
7634
7930
|
* @category Filtering
|
|
7635
7931
|
*/
|
|
7636
|
-
<A, B, X, E, R>(
|
|
7932
|
+
<A, B, X, E, R>(filter: Filter.FilterEffect<NoInfer<A>, B, X, E, R>, options?: {
|
|
7637
7933
|
readonly concurrency?: Concurrency | undefined;
|
|
7638
|
-
}): Effect<Array<B>, E, R>;
|
|
7934
|
+
}): (elements: Iterable<A>) => Effect<Array<B>, E, R>;
|
|
7639
7935
|
/**
|
|
7640
|
-
*
|
|
7641
|
-
* predicate, or `Filter.FilterEffect`.
|
|
7642
|
-
*
|
|
7643
|
-
* @example
|
|
7644
|
-
* ```ts
|
|
7645
|
-
* import { Effect, Filter, Result } from "effect"
|
|
7646
|
-
*
|
|
7647
|
-
* // Sync predicate
|
|
7648
|
-
* const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
|
|
7649
|
-
*
|
|
7650
|
-
* // Effectful predicate
|
|
7651
|
-
* const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
|
|
7652
|
-
*
|
|
7653
|
-
* // FilterEffect
|
|
7654
|
-
* const mapped = Effect.filter([1, 2, 3, 4], (n) =>
|
|
7655
|
-
* Effect.succeed(n % 2 === 0 ? Result.succeed(n * 2) : Result.fail(n))
|
|
7656
|
-
* )
|
|
7657
|
-
* ```
|
|
7936
|
+
* Effectfully filters and maps elements of an iterable with a `FilterEffect`.
|
|
7658
7937
|
*
|
|
7659
|
-
* @since
|
|
7938
|
+
* @since 4.0.0
|
|
7660
7939
|
* @category Filtering
|
|
7661
7940
|
*/
|
|
7662
|
-
<A, E, R>(
|
|
7941
|
+
<A, B, X, E, R>(elements: Iterable<A>, filter: Filter.FilterEffect<NoInfer<A>, B, X, E, R>, options?: {
|
|
7663
7942
|
readonly concurrency?: Concurrency | undefined;
|
|
7664
|
-
}): Effect<Array<
|
|
7943
|
+
}): Effect<Array<B>, E, R>;
|
|
7665
7944
|
};
|
|
7666
7945
|
/**
|
|
7667
7946
|
* Filters an effect, providing an alternative effect if the predicate fails.
|
|
@@ -7755,7 +8034,7 @@ export declare const filterOrElse: {
|
|
|
7755
8034
|
* @since 2.0.0
|
|
7756
8035
|
* @category Filtering
|
|
7757
8036
|
*/
|
|
7758
|
-
<A,
|
|
8037
|
+
<A, C, E2, R2>(predicate: Predicate.Predicate<NoInfer<A>>, orElse: (a: NoInfer<A>) => Effect<C, E2, R2>): <E, R>(self: Effect<A, E, R>) => Effect<A | C, E2 | E, R2 | R>;
|
|
7759
8038
|
/**
|
|
7760
8039
|
* Filters an effect, providing an alternative effect if the predicate fails.
|
|
7761
8040
|
*
|
|
@@ -7817,7 +8096,29 @@ export declare const filterOrElse: {
|
|
|
7817
8096
|
* @since 2.0.0
|
|
7818
8097
|
* @category Filtering
|
|
7819
8098
|
*/
|
|
7820
|
-
<A, E, R,
|
|
8099
|
+
<A, E, R, C, E2, R2>(self: Effect<A, E, R>, predicate: Predicate.Predicate<NoInfer<A>>, orElse: (a: NoInfer<A>) => Effect<C, E2, R2>): Effect<A | C, E | E2, R | R2>;
|
|
8100
|
+
};
|
|
8101
|
+
/**
|
|
8102
|
+
* Filters an effect with a `Filter`, providing an alternative effect on failure.
|
|
8103
|
+
*
|
|
8104
|
+
* @since 4.0.0
|
|
8105
|
+
* @category Filtering
|
|
8106
|
+
*/
|
|
8107
|
+
export declare const filterMapOrElse: {
|
|
8108
|
+
/**
|
|
8109
|
+
* Filters an effect with a `Filter`, providing an alternative effect on failure.
|
|
8110
|
+
*
|
|
8111
|
+
* @since 4.0.0
|
|
8112
|
+
* @category Filtering
|
|
8113
|
+
*/
|
|
8114
|
+
<A, B, X, C, E2, R2>(filter: Filter.Filter<NoInfer<A>, B, X>, orElse: (x: X) => Effect<C, E2, R2>): <E, R>(self: Effect<A, E, R>) => Effect<B | C, E2 | E, R2 | R>;
|
|
8115
|
+
/**
|
|
8116
|
+
* Filters an effect with a `Filter`, providing an alternative effect on failure.
|
|
8117
|
+
*
|
|
8118
|
+
* @since 4.0.0
|
|
8119
|
+
* @category Filtering
|
|
8120
|
+
*/
|
|
8121
|
+
<A, E, R, B, X, C, E2, R2>(self: Effect<A, E, R>, filter: Filter.Filter<NoInfer<A>, B, X>, orElse: (x: X) => Effect<C, E2, R2>): Effect<B | C, E | E2, R | R2>;
|
|
7821
8122
|
};
|
|
7822
8123
|
/**
|
|
7823
8124
|
* Filters an effect, failing with a custom error if the predicate fails.
|
|
@@ -7938,7 +8239,7 @@ export declare const filterOrFail: {
|
|
|
7938
8239
|
* @since 2.0.0
|
|
7939
8240
|
* @category Filtering
|
|
7940
8241
|
*/
|
|
7941
|
-
<A, B
|
|
8242
|
+
<A, B extends A>(refinement: Predicate.Refinement<NoInfer<A>, B>): <E, R>(self: Effect<A, E, R>) => Effect<B, Cause.NoSuchElementError | E, R>;
|
|
7942
8243
|
/**
|
|
7943
8244
|
* Filters an effect, failing with a custom error if the predicate fails.
|
|
7944
8245
|
*
|
|
@@ -7968,7 +8269,7 @@ export declare const filterOrFail: {
|
|
|
7968
8269
|
* @since 2.0.0
|
|
7969
8270
|
* @category Filtering
|
|
7970
8271
|
*/
|
|
7971
|
-
<A
|
|
8272
|
+
<A>(predicate: Predicate.Predicate<NoInfer<A>>): <E, R>(self: Effect<A, E, R>) => Effect<A, Cause.NoSuchElementError | E, R>;
|
|
7972
8273
|
/**
|
|
7973
8274
|
* Filters an effect, failing with a custom error if the predicate fails.
|
|
7974
8275
|
*
|
|
@@ -7998,7 +8299,7 @@ export declare const filterOrFail: {
|
|
|
7998
8299
|
* @since 2.0.0
|
|
7999
8300
|
* @category Filtering
|
|
8000
8301
|
*/
|
|
8001
|
-
<A
|
|
8302
|
+
<A, E, R, E2, B extends A>(self: Effect<A, E, R>, refinement: Predicate.Refinement<NoInfer<A>, B>, orFailWith: (a: NoInfer<A>) => E2): Effect<B, E2 | E, R>;
|
|
8002
8303
|
/**
|
|
8003
8304
|
* Filters an effect, failing with a custom error if the predicate fails.
|
|
8004
8305
|
*
|
|
@@ -8028,7 +8329,7 @@ export declare const filterOrFail: {
|
|
|
8028
8329
|
* @since 2.0.0
|
|
8029
8330
|
* @category Filtering
|
|
8030
8331
|
*/
|
|
8031
|
-
<A,
|
|
8332
|
+
<A, E, R, E2>(self: Effect<A, E, R>, predicate: Predicate.Predicate<NoInfer<A>>, orFailWith: (a: NoInfer<A>) => E2): Effect<A, E2 | E, R>;
|
|
8032
8333
|
/**
|
|
8033
8334
|
* Filters an effect, failing with a custom error if the predicate fails.
|
|
8034
8335
|
*
|
|
@@ -8058,7 +8359,7 @@ export declare const filterOrFail: {
|
|
|
8058
8359
|
* @since 2.0.0
|
|
8059
8360
|
* @category Filtering
|
|
8060
8361
|
*/
|
|
8061
|
-
<A, E, R,
|
|
8362
|
+
<A, E, R, B extends A>(self: Effect<A, E, R>, refinement: Predicate.Refinement<NoInfer<A>, B>): Effect<B, E | Cause.NoSuchElementError, R>;
|
|
8062
8363
|
/**
|
|
8063
8364
|
* Filters an effect, failing with a custom error if the predicate fails.
|
|
8064
8365
|
*
|
|
@@ -8088,127 +8389,43 @@ export declare const filterOrFail: {
|
|
|
8088
8389
|
* @since 2.0.0
|
|
8089
8390
|
* @category Filtering
|
|
8090
8391
|
*/
|
|
8091
|
-
<A, E, R
|
|
8392
|
+
<A, E, R>(self: Effect<A, E, R>, predicate: Predicate.Predicate<NoInfer<A>>): Effect<A, E | Cause.NoSuchElementError, R>;
|
|
8393
|
+
};
|
|
8394
|
+
/**
|
|
8395
|
+
* Filters an effect with a `Filter`, failing when the filter fails.
|
|
8396
|
+
*
|
|
8397
|
+
* @since 4.0.0
|
|
8398
|
+
* @category Filtering
|
|
8399
|
+
*/
|
|
8400
|
+
export declare const filterMapOrFail: {
|
|
8092
8401
|
/**
|
|
8093
|
-
* Filters an effect
|
|
8094
|
-
*
|
|
8095
|
-
* **Details**
|
|
8096
|
-
*
|
|
8097
|
-
* This function applies a predicate to the result of an effect. If the
|
|
8098
|
-
* predicate evaluates to `false`, the effect fails with either a custom
|
|
8099
|
-
* error (if `orFailWith` is provided) or a `NoSuchElementError`.
|
|
8100
|
-
*
|
|
8101
|
-
* @example
|
|
8102
|
-
* ```ts
|
|
8103
|
-
* import { Effect } from "effect"
|
|
8104
|
-
*
|
|
8105
|
-
* // An effect that produces a number
|
|
8106
|
-
* const program = Effect.succeed(5)
|
|
8107
|
-
*
|
|
8108
|
-
* // Filter for even numbers, fail for odd numbers
|
|
8109
|
-
* const filtered = Effect.filterOrFail(
|
|
8110
|
-
* program,
|
|
8111
|
-
* (n) => n % 2 === 0,
|
|
8112
|
-
* (n) => `Expected even number, got ${n}`
|
|
8113
|
-
* )
|
|
8402
|
+
* Filters an effect with a `Filter`, failing when the filter fails.
|
|
8114
8403
|
*
|
|
8115
|
-
*
|
|
8116
|
-
* ```
|
|
8117
|
-
*
|
|
8118
|
-
* @since 2.0.0
|
|
8404
|
+
* @since 4.0.0
|
|
8119
8405
|
* @category Filtering
|
|
8120
8406
|
*/
|
|
8121
|
-
<A,
|
|
8407
|
+
<A, B, X, E2>(filter: Filter.Filter<NoInfer<A>, B, X>, orFailWith: (x: X) => E2): <E, R>(self: Effect<A, E, R>) => Effect<B, E2 | E, R>;
|
|
8122
8408
|
/**
|
|
8123
|
-
* Filters an effect
|
|
8124
|
-
*
|
|
8125
|
-
* **Details**
|
|
8126
|
-
*
|
|
8127
|
-
* This function applies a predicate to the result of an effect. If the
|
|
8128
|
-
* predicate evaluates to `false`, the effect fails with either a custom
|
|
8129
|
-
* error (if `orFailWith` is provided) or a `NoSuchElementError`.
|
|
8130
|
-
*
|
|
8131
|
-
* @example
|
|
8132
|
-
* ```ts
|
|
8133
|
-
* import { Effect } from "effect"
|
|
8134
|
-
*
|
|
8135
|
-
* // An effect that produces a number
|
|
8136
|
-
* const program = Effect.succeed(5)
|
|
8137
|
-
*
|
|
8138
|
-
* // Filter for even numbers, fail for odd numbers
|
|
8139
|
-
* const filtered = Effect.filterOrFail(
|
|
8140
|
-
* program,
|
|
8141
|
-
* (n) => n % 2 === 0,
|
|
8142
|
-
* (n) => `Expected even number, got ${n}`
|
|
8143
|
-
* )
|
|
8144
|
-
*
|
|
8145
|
-
* // Result: Effect.fail("Expected even number, got 5")
|
|
8146
|
-
* ```
|
|
8409
|
+
* Filters an effect with a `Filter`, failing when the filter fails.
|
|
8147
8410
|
*
|
|
8148
|
-
* @since
|
|
8411
|
+
* @since 4.0.0
|
|
8149
8412
|
* @category Filtering
|
|
8150
8413
|
*/
|
|
8151
|
-
<A,
|
|
8414
|
+
<A, B, X>(filter: Filter.Filter<NoInfer<A>, B, X>): <E, R>(self: Effect<A, E, R>) => Effect<B, Cause.NoSuchElementError | E, R>;
|
|
8152
8415
|
/**
|
|
8153
|
-
* Filters an effect
|
|
8154
|
-
*
|
|
8155
|
-
* **Details**
|
|
8156
|
-
*
|
|
8157
|
-
* This function applies a predicate to the result of an effect. If the
|
|
8158
|
-
* predicate evaluates to `false`, the effect fails with either a custom
|
|
8159
|
-
* error (if `orFailWith` is provided) or a `NoSuchElementError`.
|
|
8160
|
-
*
|
|
8161
|
-
* @example
|
|
8162
|
-
* ```ts
|
|
8163
|
-
* import { Effect } from "effect"
|
|
8164
|
-
*
|
|
8165
|
-
* // An effect that produces a number
|
|
8166
|
-
* const program = Effect.succeed(5)
|
|
8167
|
-
*
|
|
8168
|
-
* // Filter for even numbers, fail for odd numbers
|
|
8169
|
-
* const filtered = Effect.filterOrFail(
|
|
8170
|
-
* program,
|
|
8171
|
-
* (n) => n % 2 === 0,
|
|
8172
|
-
* (n) => `Expected even number, got ${n}`
|
|
8173
|
-
* )
|
|
8174
|
-
*
|
|
8175
|
-
* // Result: Effect.fail("Expected even number, got 5")
|
|
8176
|
-
* ```
|
|
8416
|
+
* Filters an effect with a `Filter`, failing when the filter fails.
|
|
8177
8417
|
*
|
|
8178
|
-
* @since
|
|
8418
|
+
* @since 4.0.0
|
|
8179
8419
|
* @category Filtering
|
|
8180
8420
|
*/
|
|
8181
|
-
<A, E, R>(self: Effect<A, E, R>,
|
|
8421
|
+
<A, E, R, B, X, E2>(self: Effect<A, E, R>, filter: Filter.Filter<A, B, X>, orFailWith: (x: X) => E2): Effect<B, E2 | E, R>;
|
|
8182
8422
|
/**
|
|
8183
|
-
* Filters an effect
|
|
8184
|
-
*
|
|
8185
|
-
* **Details**
|
|
8186
|
-
*
|
|
8187
|
-
* This function applies a predicate to the result of an effect. If the
|
|
8188
|
-
* predicate evaluates to `false`, the effect fails with either a custom
|
|
8189
|
-
* error (if `orFailWith` is provided) or a `NoSuchElementError`.
|
|
8190
|
-
*
|
|
8191
|
-
* @example
|
|
8192
|
-
* ```ts
|
|
8193
|
-
* import { Effect } from "effect"
|
|
8194
|
-
*
|
|
8195
|
-
* // An effect that produces a number
|
|
8196
|
-
* const program = Effect.succeed(5)
|
|
8197
|
-
*
|
|
8198
|
-
* // Filter for even numbers, fail for odd numbers
|
|
8199
|
-
* const filtered = Effect.filterOrFail(
|
|
8200
|
-
* program,
|
|
8201
|
-
* (n) => n % 2 === 0,
|
|
8202
|
-
* (n) => `Expected even number, got ${n}`
|
|
8203
|
-
* )
|
|
8204
|
-
*
|
|
8205
|
-
* // Result: Effect.fail("Expected even number, got 5")
|
|
8206
|
-
* ```
|
|
8423
|
+
* Filters an effect with a `Filter`, failing when the filter fails.
|
|
8207
8424
|
*
|
|
8208
|
-
* @since
|
|
8425
|
+
* @since 4.0.0
|
|
8209
8426
|
* @category Filtering
|
|
8210
8427
|
*/
|
|
8211
|
-
<A, E, R, B, X>(self: Effect<A, E, R>, filter: Filter.Filter<A, B, X>): Effect<B,
|
|
8428
|
+
<A, E, R, B, X>(self: Effect<A, E, R>, filter: Filter.Filter<A, B, X>): Effect<B, Cause.NoSuchElementError | E, R>;
|
|
8212
8429
|
};
|
|
8213
8430
|
/**
|
|
8214
8431
|
* Conditionally executes an effect based on a boolean condition.
|
|
@@ -9733,7 +9950,7 @@ export declare const provideServices: {
|
|
|
9733
9950
|
* @since 4.0.0
|
|
9734
9951
|
* @category ServiceMap
|
|
9735
9952
|
*/
|
|
9736
|
-
export declare const service: <I, S>(service: ServiceMap.
|
|
9953
|
+
export declare const service: <I, S>(service: ServiceMap.Key<I, S>) => Effect<S, never, I>;
|
|
9737
9954
|
/**
|
|
9738
9955
|
* Optionally accesses a service from the environment.
|
|
9739
9956
|
*
|
|
@@ -9768,7 +9985,7 @@ export declare const service: <I, S>(service: ServiceMap.Service<I, S>) => Effec
|
|
|
9768
9985
|
* @since 2.0.0
|
|
9769
9986
|
* @category ServiceMap
|
|
9770
9987
|
*/
|
|
9771
|
-
export declare const serviceOption: <I, S>(key: ServiceMap.
|
|
9988
|
+
export declare const serviceOption: <I, S>(key: ServiceMap.Key<I, S>) => Effect<Option<S>>;
|
|
9772
9989
|
/**
|
|
9773
9990
|
* Provides part of the required context while leaving the rest unchanged.
|
|
9774
9991
|
*
|
|
@@ -9950,7 +10167,7 @@ export declare const updateService: {
|
|
|
9950
10167
|
* @since 2.0.0
|
|
9951
10168
|
* @category ServiceMap
|
|
9952
10169
|
*/
|
|
9953
|
-
<I, A>(service: ServiceMap.
|
|
10170
|
+
<I, A>(service: ServiceMap.Key<I, A>, f: (value: A) => A): <XA, E, R>(self: Effect<XA, E, R>) => Effect<XA, E, R | I>;
|
|
9954
10171
|
/**
|
|
9955
10172
|
* Updates the service with the required service entry.
|
|
9956
10173
|
*
|
|
@@ -9979,7 +10196,7 @@ export declare const updateService: {
|
|
|
9979
10196
|
* @since 2.0.0
|
|
9980
10197
|
* @category ServiceMap
|
|
9981
10198
|
*/
|
|
9982
|
-
<XA, E, R, I, A>(self: Effect<XA, E, R>, service: ServiceMap.
|
|
10199
|
+
<XA, E, R, I, A>(self: Effect<XA, E, R>, service: ServiceMap.Key<I, A>, f: (value: A) => A): Effect<XA, E, R | I>;
|
|
9983
10200
|
};
|
|
9984
10201
|
/**
|
|
9985
10202
|
* The `provideService` function is used to provide an actual
|
|
@@ -10072,7 +10289,7 @@ export declare const provideService: {
|
|
|
10072
10289
|
* @since 2.0.0
|
|
10073
10290
|
* @category ServiceMap
|
|
10074
10291
|
*/
|
|
10075
|
-
<I, S>(service: ServiceMap.
|
|
10292
|
+
<I, S>(service: ServiceMap.Key<I, S>): {
|
|
10076
10293
|
/**
|
|
10077
10294
|
* The `provideService` function is used to provide an actual
|
|
10078
10295
|
* implementation for a service in the context of an effect.
|
|
@@ -10211,7 +10428,7 @@ export declare const provideService: {
|
|
|
10211
10428
|
* @since 2.0.0
|
|
10212
10429
|
* @category ServiceMap
|
|
10213
10430
|
*/
|
|
10214
|
-
<I, S>(service: ServiceMap.
|
|
10431
|
+
<I, S>(service: ServiceMap.Key<I, S>, implementation: S): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, I>>;
|
|
10215
10432
|
/**
|
|
10216
10433
|
* The `provideService` function is used to provide an actual
|
|
10217
10434
|
* implementation for a service in the context of an effect.
|
|
@@ -10257,7 +10474,7 @@ export declare const provideService: {
|
|
|
10257
10474
|
* @since 2.0.0
|
|
10258
10475
|
* @category ServiceMap
|
|
10259
10476
|
*/
|
|
10260
|
-
<A, E, R, I, S>(self: Effect<A, E, R>, service: ServiceMap.
|
|
10477
|
+
<A, E, R, I, S>(self: Effect<A, E, R>, service: ServiceMap.Key<I, S>, implementation: S): Effect<A, E, Exclude<R, I>>;
|
|
10261
10478
|
};
|
|
10262
10479
|
/**
|
|
10263
10480
|
* Provides the effect with the single service it requires. If the effect
|
|
@@ -10364,7 +10581,7 @@ export declare const provideServiceEffect: {
|
|
|
10364
10581
|
* @since 2.0.0
|
|
10365
10582
|
* @category ServiceMap
|
|
10366
10583
|
*/
|
|
10367
|
-
<I, S, E2, R2>(service: ServiceMap.
|
|
10584
|
+
<I, S, E2, R2>(service: ServiceMap.Key<I, S>, acquire: Effect<S, E2, R2>): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E | E2, Exclude<R, I> | R2>;
|
|
10368
10585
|
/**
|
|
10369
10586
|
* Provides the effect with the single service it requires. If the effect
|
|
10370
10587
|
* requires more than one service use `provide` instead.
|
|
@@ -10417,7 +10634,7 @@ export declare const provideServiceEffect: {
|
|
|
10417
10634
|
* @since 2.0.0
|
|
10418
10635
|
* @category ServiceMap
|
|
10419
10636
|
*/
|
|
10420
|
-
<A, E, R, I, S, E2, R2>(self: Effect<A, E, R>, service: ServiceMap.
|
|
10637
|
+
<A, E, R, I, S, E2, R2>(self: Effect<A, E, R>, service: ServiceMap.Key<I, S>, acquire: Effect<S, E2, R2>): Effect<A, E | E2, Exclude<R, I> | R2>;
|
|
10421
10638
|
};
|
|
10422
10639
|
/**
|
|
10423
10640
|
* Sets the concurrency level for parallel operations within an effect.
|
|
@@ -10986,7 +11203,7 @@ export declare const onError: {
|
|
|
10986
11203
|
};
|
|
10987
11204
|
/**
|
|
10988
11205
|
* Runs the finalizer only when this effect fails and the `Cause` matches the
|
|
10989
|
-
*
|
|
11206
|
+
* provided predicate.
|
|
10990
11207
|
*
|
|
10991
11208
|
* @example
|
|
10992
11209
|
* ```ts
|
|
@@ -11010,7 +11227,7 @@ export declare const onError: {
|
|
|
11010
11227
|
export declare const onErrorIf: {
|
|
11011
11228
|
/**
|
|
11012
11229
|
* Runs the finalizer only when this effect fails and the `Cause` matches the
|
|
11013
|
-
*
|
|
11230
|
+
* provided predicate.
|
|
11014
11231
|
*
|
|
11015
11232
|
* @example
|
|
11016
11233
|
* ```ts
|
|
@@ -11031,10 +11248,10 @@ export declare const onErrorIf: {
|
|
|
11031
11248
|
* @since 4.0.0
|
|
11032
11249
|
* @category Resource Management & Finalization
|
|
11033
11250
|
*/
|
|
11034
|
-
<E,
|
|
11251
|
+
<E, XE, XR>(predicate: Predicate.Predicate<Cause.Cause<E>>, f: (cause: Cause.Cause<E>) => Effect<void, XE, XR>): <A, R>(self: Effect<A, E, R>) => Effect<A, E | XE, R | XR>;
|
|
11035
11252
|
/**
|
|
11036
11253
|
* Runs the finalizer only when this effect fails and the `Cause` matches the
|
|
11037
|
-
*
|
|
11254
|
+
* provided predicate.
|
|
11038
11255
|
*
|
|
11039
11256
|
* @example
|
|
11040
11257
|
* ```ts
|
|
@@ -11055,7 +11272,29 @@ export declare const onErrorIf: {
|
|
|
11055
11272
|
* @since 4.0.0
|
|
11056
11273
|
* @category Resource Management & Finalization
|
|
11057
11274
|
*/
|
|
11058
|
-
<A, E, R, XE, XR
|
|
11275
|
+
<A, E, R, XE, XR>(self: Effect<A, E, R>, predicate: Predicate.Predicate<Cause.Cause<E>>, f: (cause: Cause.Cause<E>) => Effect<void, XE, XR>): Effect<A, E | XE, R | XR>;
|
|
11276
|
+
};
|
|
11277
|
+
/**
|
|
11278
|
+
* Runs the finalizer only when this effect fails and the cause matches the provided `Filter`.
|
|
11279
|
+
*
|
|
11280
|
+
* @since 4.0.0
|
|
11281
|
+
* @category Resource Management & Finalization
|
|
11282
|
+
*/
|
|
11283
|
+
export declare const onErrorFilter: {
|
|
11284
|
+
/**
|
|
11285
|
+
* Runs the finalizer only when this effect fails and the cause matches the provided `Filter`.
|
|
11286
|
+
*
|
|
11287
|
+
* @since 4.0.0
|
|
11288
|
+
* @category Resource Management & Finalization
|
|
11289
|
+
*/
|
|
11290
|
+
<A, E, EB, X, XE, XR>(filter: Filter.Filter<Cause.Cause<E>, EB, X>, f: (failure: EB, cause: Cause.Cause<E>) => Effect<void, XE, XR>): <R>(self: Effect<A, E, R>) => Effect<A, E | XE, R | XR>;
|
|
11291
|
+
/**
|
|
11292
|
+
* Runs the finalizer only when this effect fails and the cause matches the provided `Filter`.
|
|
11293
|
+
*
|
|
11294
|
+
* @since 4.0.0
|
|
11295
|
+
* @category Resource Management & Finalization
|
|
11296
|
+
*/
|
|
11297
|
+
<A, E, R, EB, X, XE, XR>(self: Effect<A, E, R>, filter: Filter.Filter<Cause.Cause<E>, EB, X>, f: (failure: EB, cause: Cause.Cause<E>) => Effect<void, XE, XR>): Effect<A, E | XE, R | XR>;
|
|
11059
11298
|
};
|
|
11060
11299
|
/**
|
|
11061
11300
|
* The low level primitive that powers `onExit`.
|
|
@@ -11149,20 +11388,20 @@ export declare const onExit: {
|
|
|
11149
11388
|
<A, E, R, XE = never, XR = never>(self: Effect<A, E, R>, f: (exit: Exit.Exit<A, E>) => Effect<void, XE, XR>): Effect<A, E | XE, R | XR>;
|
|
11150
11389
|
};
|
|
11151
11390
|
/**
|
|
11152
|
-
* Runs the cleanup effect only when the `Exit`
|
|
11153
|
-
*
|
|
11154
|
-
* The cleanup is skipped when the filter returns `Filter.fail`.
|
|
11391
|
+
* Runs the cleanup effect only when the `Exit` satisfies the provided
|
|
11392
|
+
* predicate.
|
|
11155
11393
|
*
|
|
11156
11394
|
* @example
|
|
11157
11395
|
* ```ts
|
|
11158
|
-
* import { Console, Effect, Exit
|
|
11159
|
-
*
|
|
11160
|
-
* const exitFilter = Filter.fromPredicate(Exit.isSuccess<number, never>)
|
|
11396
|
+
* import { Console, Effect, Exit } from "effect"
|
|
11161
11397
|
*
|
|
11162
11398
|
* const program = Effect.onExitIf(
|
|
11163
11399
|
* Effect.succeed(42),
|
|
11164
|
-
*
|
|
11165
|
-
* (
|
|
11400
|
+
* Exit.isSuccess,
|
|
11401
|
+
* (exit) =>
|
|
11402
|
+
* Exit.isSuccess(exit)
|
|
11403
|
+
* ? Console.log(`Succeeded with: ${exit.value}`)
|
|
11404
|
+
* : Effect.void
|
|
11166
11405
|
* )
|
|
11167
11406
|
* ```
|
|
11168
11407
|
*
|
|
@@ -11171,49 +11410,71 @@ export declare const onExit: {
|
|
|
11171
11410
|
*/
|
|
11172
11411
|
export declare const onExitIf: {
|
|
11173
11412
|
/**
|
|
11174
|
-
* Runs the cleanup effect only when the `Exit`
|
|
11175
|
-
*
|
|
11176
|
-
* The cleanup is skipped when the filter returns `Filter.fail`.
|
|
11413
|
+
* Runs the cleanup effect only when the `Exit` satisfies the provided
|
|
11414
|
+
* predicate.
|
|
11177
11415
|
*
|
|
11178
11416
|
* @example
|
|
11179
11417
|
* ```ts
|
|
11180
|
-
* import { Console, Effect, Exit
|
|
11181
|
-
*
|
|
11182
|
-
* const exitFilter = Filter.fromPredicate(Exit.isSuccess<number, never>)
|
|
11418
|
+
* import { Console, Effect, Exit } from "effect"
|
|
11183
11419
|
*
|
|
11184
11420
|
* const program = Effect.onExitIf(
|
|
11185
11421
|
* Effect.succeed(42),
|
|
11186
|
-
*
|
|
11187
|
-
* (
|
|
11422
|
+
* Exit.isSuccess,
|
|
11423
|
+
* (exit) =>
|
|
11424
|
+
* Exit.isSuccess(exit)
|
|
11425
|
+
* ? Console.log(`Succeeded with: ${exit.value}`)
|
|
11426
|
+
* : Effect.void
|
|
11188
11427
|
* )
|
|
11189
11428
|
* ```
|
|
11190
11429
|
*
|
|
11191
11430
|
* @since 4.0.0
|
|
11192
11431
|
* @category Resource Management & Finalization
|
|
11193
11432
|
*/
|
|
11194
|
-
<A, E, XE, XR
|
|
11433
|
+
<A, E, XE, XR>(predicate: Predicate.Predicate<Exit.Exit<NoInfer<A>, NoInfer<E>>>, f: (exit: Exit.Exit<NoInfer<A>, NoInfer<E>>) => Effect<void, XE, XR>): <R>(self: Effect<A, E, R>) => Effect<A, E | XE, R | XR>;
|
|
11195
11434
|
/**
|
|
11196
|
-
* Runs the cleanup effect only when the `Exit`
|
|
11197
|
-
*
|
|
11198
|
-
* The cleanup is skipped when the filter returns `Filter.fail`.
|
|
11435
|
+
* Runs the cleanup effect only when the `Exit` satisfies the provided
|
|
11436
|
+
* predicate.
|
|
11199
11437
|
*
|
|
11200
11438
|
* @example
|
|
11201
11439
|
* ```ts
|
|
11202
|
-
* import { Console, Effect, Exit
|
|
11203
|
-
*
|
|
11204
|
-
* const exitFilter = Filter.fromPredicate(Exit.isSuccess<number, never>)
|
|
11440
|
+
* import { Console, Effect, Exit } from "effect"
|
|
11205
11441
|
*
|
|
11206
11442
|
* const program = Effect.onExitIf(
|
|
11207
11443
|
* Effect.succeed(42),
|
|
11208
|
-
*
|
|
11209
|
-
* (
|
|
11444
|
+
* Exit.isSuccess,
|
|
11445
|
+
* (exit) =>
|
|
11446
|
+
* Exit.isSuccess(exit)
|
|
11447
|
+
* ? Console.log(`Succeeded with: ${exit.value}`)
|
|
11448
|
+
* : Effect.void
|
|
11210
11449
|
* )
|
|
11211
11450
|
* ```
|
|
11212
11451
|
*
|
|
11213
11452
|
* @since 4.0.0
|
|
11214
11453
|
* @category Resource Management & Finalization
|
|
11215
11454
|
*/
|
|
11216
|
-
<A, E, R, XE, XR
|
|
11455
|
+
<A, E, R, XE, XR>(self: Effect<A, E, R>, predicate: Predicate.Predicate<Exit.Exit<NoInfer<A>, NoInfer<E>>>, f: (exit: Exit.Exit<NoInfer<A>, NoInfer<E>>) => Effect<void, XE, XR>): Effect<A, E | XE, R | XR>;
|
|
11456
|
+
};
|
|
11457
|
+
/**
|
|
11458
|
+
* Runs the cleanup effect only when the `Exit` matches the provided `Filter`.
|
|
11459
|
+
*
|
|
11460
|
+
* @since 4.0.0
|
|
11461
|
+
* @category Resource Management & Finalization
|
|
11462
|
+
*/
|
|
11463
|
+
export declare const onExitFilter: {
|
|
11464
|
+
/**
|
|
11465
|
+
* Runs the cleanup effect only when the `Exit` matches the provided `Filter`.
|
|
11466
|
+
*
|
|
11467
|
+
* @since 4.0.0
|
|
11468
|
+
* @category Resource Management & Finalization
|
|
11469
|
+
*/
|
|
11470
|
+
<A, E, XE, XR, B, X>(filter: Filter.Filter<Exit.Exit<NoInfer<A>, NoInfer<E>>, B, X>, f: (b: B, exit: Exit.Exit<NoInfer<A>, NoInfer<E>>) => Effect<void, XE, XR>): <R>(self: Effect<A, E, R>) => Effect<A, E | XE, R | XR>;
|
|
11471
|
+
/**
|
|
11472
|
+
* Runs the cleanup effect only when the `Exit` matches the provided `Filter`.
|
|
11473
|
+
*
|
|
11474
|
+
* @since 4.0.0
|
|
11475
|
+
* @category Resource Management & Finalization
|
|
11476
|
+
*/
|
|
11477
|
+
<A, E, R, XE, XR, B, X>(self: Effect<A, E, R>, filter: Filter.Filter<Exit.Exit<NoInfer<A>, NoInfer<E>>, B, X>, f: (b: B, exit: Exit.Exit<NoInfer<A>, NoInfer<E>>) => Effect<void, XE, XR>): Effect<A, E | XE, R | XR>;
|
|
11217
11478
|
};
|
|
11218
11479
|
/**
|
|
11219
11480
|
* Returns an effect that lazily computes a result and caches it for subsequent
|
|
@@ -11412,7 +11673,7 @@ export declare const cachedWithTTL: {
|
|
|
11412
11673
|
* @since 2.0.0
|
|
11413
11674
|
* @category Caching
|
|
11414
11675
|
*/
|
|
11415
|
-
(timeToLive: Duration.
|
|
11676
|
+
(timeToLive: Duration.Input): <A, E, R>(self: Effect<A, E, R>) => Effect<Effect<A, E, R>>;
|
|
11416
11677
|
/**
|
|
11417
11678
|
* Returns an effect that caches its result for a specified `Duration`,
|
|
11418
11679
|
* known as "timeToLive" (TTL).
|
|
@@ -11479,7 +11740,7 @@ export declare const cachedWithTTL: {
|
|
|
11479
11740
|
* @since 2.0.0
|
|
11480
11741
|
* @category Caching
|
|
11481
11742
|
*/
|
|
11482
|
-
<A, E, R>(self: Effect<A, E, R>, timeToLive: Duration.
|
|
11743
|
+
<A, E, R>(self: Effect<A, E, R>, timeToLive: Duration.Input): Effect<Effect<A, E, R>>;
|
|
11483
11744
|
};
|
|
11484
11745
|
/**
|
|
11485
11746
|
* Caches an effect's result for a specified duration and allows manual
|
|
@@ -11620,7 +11881,7 @@ export declare const cachedInvalidateWithTTL: {
|
|
|
11620
11881
|
* @since 2.0.0
|
|
11621
11882
|
* @category Caching
|
|
11622
11883
|
*/
|
|
11623
|
-
(timeToLive: Duration.
|
|
11884
|
+
(timeToLive: Duration.Input): <A, E, R>(self: Effect<A, E, R>) => Effect<[Effect<A, E, R>, Effect<void>]>;
|
|
11624
11885
|
/**
|
|
11625
11886
|
* Caches an effect's result for a specified duration and allows manual
|
|
11626
11887
|
* invalidation before expiration.
|
|
@@ -11690,7 +11951,7 @@ export declare const cachedInvalidateWithTTL: {
|
|
|
11690
11951
|
* @since 2.0.0
|
|
11691
11952
|
* @category Caching
|
|
11692
11953
|
*/
|
|
11693
|
-
<A, E, R>(self: Effect<A, E, R>, timeToLive: Duration.
|
|
11954
|
+
<A, E, R>(self: Effect<A, E, R>, timeToLive: Duration.Input): Effect<[Effect<A, E, R>, Effect<void>]>;
|
|
11694
11955
|
};
|
|
11695
11956
|
/**
|
|
11696
11957
|
* Returns an effect that is immediately interrupted.
|
|
@@ -11890,232 +12151,6 @@ export declare const uninterruptibleMask: <A, E, R>(f: (restore: <AX, EX, RX>(ef
|
|
|
11890
12151
|
* @category Interruption
|
|
11891
12152
|
*/
|
|
11892
12153
|
export declare const interruptibleMask: <A, E, R>(f: (restore: <AX, EX, RX>(effect: Effect<AX, EX, RX>) => Effect<AX, EX, RX>) => Effect<A, E, R>) => Effect<A, E, R>;
|
|
11893
|
-
/**
|
|
11894
|
-
* @category Semaphore
|
|
11895
|
-
* @since 2.0.0
|
|
11896
|
-
* @example
|
|
11897
|
-
* ```ts
|
|
11898
|
-
* import { Effect } from "effect"
|
|
11899
|
-
*
|
|
11900
|
-
* // Create and use a semaphore for controlling concurrent access
|
|
11901
|
-
* const program = Effect.gen(function*() {
|
|
11902
|
-
* const semaphore = yield* Effect.makeSemaphore(2)
|
|
11903
|
-
*
|
|
11904
|
-
* return yield* semaphore.withPermits(1)(
|
|
11905
|
-
* Effect.succeed("Resource accessed")
|
|
11906
|
-
* )
|
|
11907
|
-
* })
|
|
11908
|
-
* ```
|
|
11909
|
-
*/
|
|
11910
|
-
export interface Semaphore {
|
|
11911
|
-
/**
|
|
11912
|
-
* Adjusts the number of permits available in the semaphore.
|
|
11913
|
-
*/
|
|
11914
|
-
resize(permits: number): Effect<void>;
|
|
11915
|
-
/**
|
|
11916
|
-
* Runs an effect with the given number of permits and releases the permits
|
|
11917
|
-
* when the effect completes.
|
|
11918
|
-
*
|
|
11919
|
-
* **Details**
|
|
11920
|
-
*
|
|
11921
|
-
* This function acquires the specified number of permits before executing
|
|
11922
|
-
* the provided effect. Once the effect finishes, the permits are released.
|
|
11923
|
-
* If insufficient permits are available, the function will wait until they
|
|
11924
|
-
* are released by other tasks.
|
|
11925
|
-
*/
|
|
11926
|
-
withPermits(permits: number): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, R>;
|
|
11927
|
-
/**
|
|
11928
|
-
* Runs an effect with the given number of permits and releases the permits
|
|
11929
|
-
* when the effect completes.
|
|
11930
|
-
*
|
|
11931
|
-
* **Details**
|
|
11932
|
-
*
|
|
11933
|
-
* This function acquires the specified number of permits before executing
|
|
11934
|
-
* the provided effect. Once the effect finishes, the permits are released.
|
|
11935
|
-
* If insufficient permits are available, the function will wait until they
|
|
11936
|
-
* are released by other tasks.
|
|
11937
|
-
*/
|
|
11938
|
-
withPermit<A, E, R>(self: Effect<A, E, R>): Effect<A, E, R>;
|
|
11939
|
-
/**
|
|
11940
|
-
* Runs an effect only if the specified number of permits are immediately
|
|
11941
|
-
* available.
|
|
11942
|
-
*
|
|
11943
|
-
* **Details**
|
|
11944
|
-
*
|
|
11945
|
-
* This function attempts to acquire the specified number of permits. If they
|
|
11946
|
-
* are available, it runs the effect and releases the permits after the effect
|
|
11947
|
-
* completes. If permits are not available, the effect does not execute, and
|
|
11948
|
-
* the result is `Option.none`.
|
|
11949
|
-
*/
|
|
11950
|
-
withPermitsIfAvailable(permits: number): <A, E, R>(self: Effect<A, E, R>) => Effect<Option<A>, E, R>;
|
|
11951
|
-
/**
|
|
11952
|
-
* Acquires the specified number of permits and returns the resulting
|
|
11953
|
-
* available permits, suspending the task if they are not yet available.
|
|
11954
|
-
* Concurrent pending `take` calls are processed in a first-in, first-out manner.
|
|
11955
|
-
*/
|
|
11956
|
-
take(permits: number): Effect<number>;
|
|
11957
|
-
/**
|
|
11958
|
-
* Releases the specified number of permits and returns the resulting
|
|
11959
|
-
* available permits.
|
|
11960
|
-
*/
|
|
11961
|
-
release(permits: number): Effect<number>;
|
|
11962
|
-
/**
|
|
11963
|
-
* Releases all permits held by this semaphore and returns the resulting available permits.
|
|
11964
|
-
*/
|
|
11965
|
-
releaseAll: Effect<number>;
|
|
11966
|
-
}
|
|
11967
|
-
/**
|
|
11968
|
-
* Unsafely creates a new Semaphore.
|
|
11969
|
-
*
|
|
11970
|
-
* @example
|
|
11971
|
-
* ```ts
|
|
11972
|
-
* import { Effect } from "effect"
|
|
11973
|
-
*
|
|
11974
|
-
* const semaphore = Effect.makeSemaphoreUnsafe(3)
|
|
11975
|
-
*
|
|
11976
|
-
* const task = (id: number) =>
|
|
11977
|
-
* semaphore.withPermits(1)(
|
|
11978
|
-
* Effect.gen(function*() {
|
|
11979
|
-
* yield* Effect.log(`Task ${id} started`)
|
|
11980
|
-
* yield* Effect.sleep("1 second")
|
|
11981
|
-
* yield* Effect.log(`Task ${id} completed`)
|
|
11982
|
-
* })
|
|
11983
|
-
* )
|
|
11984
|
-
*
|
|
11985
|
-
* // Only 3 tasks can run concurrently
|
|
11986
|
-
* const program = Effect.all([
|
|
11987
|
-
* task(1),
|
|
11988
|
-
* task(2),
|
|
11989
|
-
* task(3),
|
|
11990
|
-
* task(4),
|
|
11991
|
-
* task(5)
|
|
11992
|
-
* ], { concurrency: "unbounded" })
|
|
11993
|
-
* ```
|
|
11994
|
-
*
|
|
11995
|
-
* @since 2.0.0
|
|
11996
|
-
* @category Semaphore
|
|
11997
|
-
*/
|
|
11998
|
-
export declare const makeSemaphoreUnsafe: (permits: number) => Semaphore;
|
|
11999
|
-
/**
|
|
12000
|
-
* Creates a new Semaphore.
|
|
12001
|
-
*
|
|
12002
|
-
* @example
|
|
12003
|
-
* ```ts
|
|
12004
|
-
* import { Effect } from "effect"
|
|
12005
|
-
*
|
|
12006
|
-
* const program = Effect.gen(function*() {
|
|
12007
|
-
* const semaphore = yield* Effect.makeSemaphore(2)
|
|
12008
|
-
*
|
|
12009
|
-
* const task = (id: number) =>
|
|
12010
|
-
* semaphore.withPermits(1)(
|
|
12011
|
-
* Effect.gen(function*() {
|
|
12012
|
-
* yield* Effect.log(`Task ${id} acquired permit`)
|
|
12013
|
-
* yield* Effect.sleep("1 second")
|
|
12014
|
-
* yield* Effect.log(`Task ${id} releasing permit`)
|
|
12015
|
-
* })
|
|
12016
|
-
* )
|
|
12017
|
-
*
|
|
12018
|
-
* // Run 4 tasks, but only 2 can run concurrently
|
|
12019
|
-
* yield* Effect.all([task(1), task(2), task(3), task(4)])
|
|
12020
|
-
* })
|
|
12021
|
-
* ```
|
|
12022
|
-
*
|
|
12023
|
-
* @since 2.0.0
|
|
12024
|
-
* @category Semaphore
|
|
12025
|
-
*/
|
|
12026
|
-
export declare const makeSemaphore: (permits: number) => Effect<Semaphore>;
|
|
12027
|
-
/**
|
|
12028
|
-
* @category Latch
|
|
12029
|
-
* @since 3.8.0
|
|
12030
|
-
* @example
|
|
12031
|
-
* ```ts
|
|
12032
|
-
* import { Effect } from "effect"
|
|
12033
|
-
*
|
|
12034
|
-
* // Create and use a latch for coordination between fibers
|
|
12035
|
-
* const program = Effect.gen(function*() {
|
|
12036
|
-
* const latch = yield* Effect.makeLatch()
|
|
12037
|
-
*
|
|
12038
|
-
* // Wait for the latch to be opened
|
|
12039
|
-
* yield* latch.await
|
|
12040
|
-
*
|
|
12041
|
-
* return "Latch was opened!"
|
|
12042
|
-
* })
|
|
12043
|
-
* ```
|
|
12044
|
-
*/
|
|
12045
|
-
export interface Latch {
|
|
12046
|
-
/** open the latch, releasing all fibers waiting on it */
|
|
12047
|
-
readonly open: Effect<boolean>;
|
|
12048
|
-
/** open the latch, releasing all fibers waiting on it */
|
|
12049
|
-
readonly openUnsafe: () => boolean;
|
|
12050
|
-
/** release all fibers waiting on the latch, without opening it */
|
|
12051
|
-
readonly release: Effect<boolean>;
|
|
12052
|
-
/** wait for the latch to be opened */
|
|
12053
|
-
readonly await: Effect<void>;
|
|
12054
|
-
/** close the latch */
|
|
12055
|
-
readonly close: Effect<boolean>;
|
|
12056
|
-
/** close the latch */
|
|
12057
|
-
readonly closeUnsafe: () => boolean;
|
|
12058
|
-
/** only run the given effect when the latch is open */
|
|
12059
|
-
readonly whenOpen: <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, R>;
|
|
12060
|
-
}
|
|
12061
|
-
/**
|
|
12062
|
-
* Creates a new Latch.
|
|
12063
|
-
*
|
|
12064
|
-
* @example
|
|
12065
|
-
* ```ts
|
|
12066
|
-
* import { Effect } from "effect"
|
|
12067
|
-
*
|
|
12068
|
-
* const latch = Effect.makeLatchUnsafe(false)
|
|
12069
|
-
*
|
|
12070
|
-
* const waiter = Effect.gen(function*() {
|
|
12071
|
-
* yield* Effect.log("Waiting for latch to open...")
|
|
12072
|
-
* yield* latch.await
|
|
12073
|
-
* yield* Effect.log("Latch opened! Continuing...")
|
|
12074
|
-
* })
|
|
12075
|
-
*
|
|
12076
|
-
* const opener = Effect.gen(function*() {
|
|
12077
|
-
* yield* Effect.sleep("2 seconds")
|
|
12078
|
-
* yield* Effect.log("Opening latch...")
|
|
12079
|
-
* yield* latch.open
|
|
12080
|
-
* })
|
|
12081
|
-
*
|
|
12082
|
-
* const program = Effect.all([waiter, opener])
|
|
12083
|
-
* ```
|
|
12084
|
-
*
|
|
12085
|
-
* @category Latch
|
|
12086
|
-
* @since 3.8.0
|
|
12087
|
-
*/
|
|
12088
|
-
export declare const makeLatchUnsafe: (open?: boolean | undefined) => Latch;
|
|
12089
|
-
/**
|
|
12090
|
-
* Creates a new Latch.
|
|
12091
|
-
*
|
|
12092
|
-
* @example
|
|
12093
|
-
* ```ts
|
|
12094
|
-
* import { Effect } from "effect"
|
|
12095
|
-
*
|
|
12096
|
-
* const program = Effect.gen(function*() {
|
|
12097
|
-
* const latch = yield* Effect.makeLatch(false)
|
|
12098
|
-
*
|
|
12099
|
-
* const waiter = Effect.gen(function*() {
|
|
12100
|
-
* yield* Effect.log("Waiting for latch to open...")
|
|
12101
|
-
* yield* latch.await
|
|
12102
|
-
* yield* Effect.log("Latch opened! Continuing...")
|
|
12103
|
-
* })
|
|
12104
|
-
*
|
|
12105
|
-
* const opener = Effect.gen(function*() {
|
|
12106
|
-
* yield* Effect.sleep("2 seconds")
|
|
12107
|
-
* yield* Effect.log("Opening latch...")
|
|
12108
|
-
* yield* latch.open
|
|
12109
|
-
* })
|
|
12110
|
-
*
|
|
12111
|
-
* yield* Effect.all([waiter, opener])
|
|
12112
|
-
* })
|
|
12113
|
-
* ```
|
|
12114
|
-
*
|
|
12115
|
-
* @category Latch
|
|
12116
|
-
* @since 3.8.0
|
|
12117
|
-
*/
|
|
12118
|
-
export declare const makeLatch: (open?: boolean | undefined) => Effect<Latch>;
|
|
12119
12154
|
/**
|
|
12120
12155
|
* @since 2.0.0
|
|
12121
12156
|
* @category Repetition / Recursion
|
|
@@ -15772,7 +15807,7 @@ export declare const clockWith: <A, E, R>(f: (clock: Clock) => Effect<A, E, R>)
|
|
|
15772
15807
|
* @since 2.0.0
|
|
15773
15808
|
* @category Logging
|
|
15774
15809
|
*/
|
|
15775
|
-
export declare const logWithLevel: (level?:
|
|
15810
|
+
export declare const logWithLevel: (level?: Severity) => (...message: ReadonlyArray<any>) => Effect<void>;
|
|
15776
15811
|
/**
|
|
15777
15812
|
* Logs one or more messages using the default log level.
|
|
15778
15813
|
*
|
|
@@ -16039,6 +16074,85 @@ export declare const annotateLogs: {
|
|
|
16039
16074
|
<A, E, R>(effect: Effect<A, E, R>, key: string, value: unknown): Effect<A, E, R>;
|
|
16040
16075
|
<A, E, R>(effect: Effect<A, E, R>, values: Record<string, unknown>): Effect<A, E, R>;
|
|
16041
16076
|
};
|
|
16077
|
+
/**
|
|
16078
|
+
* Adds log annotations to the current scope.
|
|
16079
|
+
*
|
|
16080
|
+
* This differs from `annotateLogs`, which only annotates a specific effect.
|
|
16081
|
+
* `annotateLogsScoped` updates annotations for the entire current `Scope` and
|
|
16082
|
+
* restores the previous annotations when the scope closes.
|
|
16083
|
+
*
|
|
16084
|
+
* @example
|
|
16085
|
+
* ```ts
|
|
16086
|
+
* import { Effect } from "effect"
|
|
16087
|
+
*
|
|
16088
|
+
* const program = Effect.scoped(
|
|
16089
|
+
* Effect.gen(function*() {
|
|
16090
|
+
* yield* Effect.log("before")
|
|
16091
|
+
* yield* Effect.annotateLogsScoped({ requestId: "req-123" })
|
|
16092
|
+
* yield* Effect.log("inside scope")
|
|
16093
|
+
* })
|
|
16094
|
+
* )
|
|
16095
|
+
*
|
|
16096
|
+
* Effect.runPromise(program)
|
|
16097
|
+
* ```
|
|
16098
|
+
*
|
|
16099
|
+
* @since 4.0.0
|
|
16100
|
+
* @category Logging
|
|
16101
|
+
*/
|
|
16102
|
+
export declare const annotateLogsScoped: {
|
|
16103
|
+
/**
|
|
16104
|
+
* Adds log annotations to the current scope.
|
|
16105
|
+
*
|
|
16106
|
+
* This differs from `annotateLogs`, which only annotates a specific effect.
|
|
16107
|
+
* `annotateLogsScoped` updates annotations for the entire current `Scope` and
|
|
16108
|
+
* restores the previous annotations when the scope closes.
|
|
16109
|
+
*
|
|
16110
|
+
* @example
|
|
16111
|
+
* ```ts
|
|
16112
|
+
* import { Effect } from "effect"
|
|
16113
|
+
*
|
|
16114
|
+
* const program = Effect.scoped(
|
|
16115
|
+
* Effect.gen(function*() {
|
|
16116
|
+
* yield* Effect.log("before")
|
|
16117
|
+
* yield* Effect.annotateLogsScoped({ requestId: "req-123" })
|
|
16118
|
+
* yield* Effect.log("inside scope")
|
|
16119
|
+
* })
|
|
16120
|
+
* )
|
|
16121
|
+
*
|
|
16122
|
+
* Effect.runPromise(program)
|
|
16123
|
+
* ```
|
|
16124
|
+
*
|
|
16125
|
+
* @since 4.0.0
|
|
16126
|
+
* @category Logging
|
|
16127
|
+
*/
|
|
16128
|
+
(key: string, value: unknown): Effect<void, never, Scope>;
|
|
16129
|
+
/**
|
|
16130
|
+
* Adds log annotations to the current scope.
|
|
16131
|
+
*
|
|
16132
|
+
* This differs from `annotateLogs`, which only annotates a specific effect.
|
|
16133
|
+
* `annotateLogsScoped` updates annotations for the entire current `Scope` and
|
|
16134
|
+
* restores the previous annotations when the scope closes.
|
|
16135
|
+
*
|
|
16136
|
+
* @example
|
|
16137
|
+
* ```ts
|
|
16138
|
+
* import { Effect } from "effect"
|
|
16139
|
+
*
|
|
16140
|
+
* const program = Effect.scoped(
|
|
16141
|
+
* Effect.gen(function*() {
|
|
16142
|
+
* yield* Effect.log("before")
|
|
16143
|
+
* yield* Effect.annotateLogsScoped({ requestId: "req-123" })
|
|
16144
|
+
* yield* Effect.log("inside scope")
|
|
16145
|
+
* })
|
|
16146
|
+
* )
|
|
16147
|
+
*
|
|
16148
|
+
* Effect.runPromise(program)
|
|
16149
|
+
* ```
|
|
16150
|
+
*
|
|
16151
|
+
* @since 4.0.0
|
|
16152
|
+
* @category Logging
|
|
16153
|
+
*/
|
|
16154
|
+
(values: Record<string, unknown>): Effect<void, never, Scope>;
|
|
16155
|
+
};
|
|
16042
16156
|
/**
|
|
16043
16157
|
* Adds a span to each log line in this effect.
|
|
16044
16158
|
*
|
|
@@ -17281,118 +17395,63 @@ declare const Transaction_base: ServiceMap.ServiceClass<Transaction, "effect/Eff
|
|
|
17281
17395
|
export declare class Transaction extends Transaction_base {
|
|
17282
17396
|
}
|
|
17283
17397
|
/**
|
|
17284
|
-
*
|
|
17285
|
-
* transactional values (i.e. TxRef) that occur within the transaction body.
|
|
17286
|
-
*
|
|
17287
|
-
* In Effect transactions are optimistic with retry, that means transactions are retried when:
|
|
17288
|
-
*
|
|
17289
|
-
* - the body of the transaction explicitely calls to `Effect.retryTransaction` and any of the
|
|
17290
|
-
* accessed transactional values changes.
|
|
17291
|
-
*
|
|
17292
|
-
* - any of the accessed transactional values change during the execution of the transaction
|
|
17293
|
-
* due to a different transaction committing before the current.
|
|
17398
|
+
* Accesses the current transaction state within an active transaction.
|
|
17294
17399
|
*
|
|
17295
|
-
*
|
|
17296
|
-
*
|
|
17400
|
+
* This function requires `Transaction` in the context and does NOT create or strip
|
|
17401
|
+
* transaction boundaries. Use it to interact with the transaction journal (e.g. in
|
|
17402
|
+
* `TxRef` internals). To define a transaction boundary, use {@link transaction}.
|
|
17297
17403
|
*
|
|
17298
17404
|
* @example
|
|
17299
17405
|
* ```ts
|
|
17300
17406
|
* import { Effect, TxRef } from "effect"
|
|
17301
17407
|
*
|
|
17302
17408
|
* const program = Effect.gen(function*() {
|
|
17303
|
-
* const
|
|
17304
|
-
* const ref2 = yield* TxRef.make(0)
|
|
17305
|
-
*
|
|
17306
|
-
* // All operations within atomic block succeed or fail together
|
|
17307
|
-
* yield* Effect.atomic(Effect.gen(function*() {
|
|
17308
|
-
* yield* TxRef.set(ref1, 10)
|
|
17309
|
-
* yield* TxRef.set(ref2, 20)
|
|
17310
|
-
* const sum = (yield* TxRef.get(ref1)) + (yield* TxRef.get(ref2))
|
|
17311
|
-
* console.log(`Transaction sum: ${sum}`)
|
|
17312
|
-
* }))
|
|
17313
|
-
*
|
|
17314
|
-
* console.log(`Final ref1: ${yield* TxRef.get(ref1)}`) // 10
|
|
17315
|
-
* console.log(`Final ref2: ${yield* TxRef.get(ref2)}`) // 20
|
|
17316
|
-
* })
|
|
17317
|
-
* ```
|
|
17318
|
-
*
|
|
17319
|
-
* @since 4.0.0
|
|
17320
|
-
* @category Transactions
|
|
17321
|
-
*/
|
|
17322
|
-
export declare const atomic: <A, E, R>(effect: Effect<A, E, R>) => Effect<A, E, Exclude<R, Transaction>>;
|
|
17323
|
-
/**
|
|
17324
|
-
* Executes a function within a transaction context, providing access to the transaction state.
|
|
17325
|
-
*
|
|
17326
|
-
* @example
|
|
17327
|
-
* ```ts
|
|
17328
|
-
* import { Effect, TxRef } from "effect"
|
|
17329
|
-
*
|
|
17330
|
-
* const program = Effect.atomicWith((txState) =>
|
|
17331
|
-
* Effect.gen(function*() {
|
|
17332
|
-
* const ref = yield* TxRef.make(0)
|
|
17333
|
-
*
|
|
17334
|
-
* // Access transaction state for debugging
|
|
17335
|
-
* console.log(`Journal size: ${txState.journal.size}`)
|
|
17336
|
-
* console.log(`Retry flag: ${txState.retry}`)
|
|
17409
|
+
* const ref = yield* Effect.transaction(TxRef.make(0))
|
|
17337
17410
|
*
|
|
17411
|
+
* yield* Effect.transaction(Effect.gen(function*() {
|
|
17338
17412
|
* yield* TxRef.set(ref, 42)
|
|
17339
17413
|
* return yield* TxRef.get(ref)
|
|
17340
|
-
* })
|
|
17341
|
-
* )
|
|
17342
|
-
*
|
|
17343
|
-
* Effect.runPromise(program).then(console.log) // 42
|
|
17414
|
+
* }))
|
|
17415
|
+
* })
|
|
17344
17416
|
* ```
|
|
17345
17417
|
*
|
|
17346
17418
|
* @since 4.0.0
|
|
17347
17419
|
* @category Transactions
|
|
17348
17420
|
*/
|
|
17349
|
-
export declare const
|
|
17421
|
+
export declare const withTxState: <A, E, R>(f: (state: Transaction["Service"]) => Effect<A, E, R>) => Effect<A, E, R | Transaction>;
|
|
17350
17422
|
/**
|
|
17351
|
-
*
|
|
17423
|
+
* Defines a transaction boundary. Transactions are "all or nothing" with respect to changes
|
|
17424
|
+
* made to transactional values (i.e. TxRef) that occur within the transaction body.
|
|
17352
17425
|
*
|
|
17353
|
-
*
|
|
17426
|
+
* In Effect transactions are optimistic with retry, that means transactions are retried when:
|
|
17354
17427
|
*
|
|
17355
|
-
*
|
|
17356
|
-
*
|
|
17357
|
-
* This ensures complete isolation between different transaction scopes.
|
|
17428
|
+
* - the body of the transaction explicitely calls to `Effect.retryTransaction` and any of the
|
|
17429
|
+
* accessed transactional values changes.
|
|
17358
17430
|
*
|
|
17359
|
-
*
|
|
17360
|
-
*
|
|
17361
|
-
* - Parent transaction failures don't affect isolated transactions
|
|
17362
|
-
* - Isolated transaction failures don't affect parent transactions
|
|
17363
|
-
* - Each transaction has its own journal and retry logic
|
|
17431
|
+
* - any of the accessed transactional values change during the execution of the transaction
|
|
17432
|
+
* due to a different transaction committing before the current.
|
|
17364
17433
|
*
|
|
17365
|
-
*
|
|
17366
|
-
*
|
|
17367
|
-
* - For implementing independent operations that shouldn't be affected by outer transactions
|
|
17368
|
-
* - When building transaction-based systems where isolation is critical
|
|
17434
|
+
* Each call to `transaction` always creates a new isolated transaction boundary with its own
|
|
17435
|
+
* journal and retry logic.
|
|
17369
17436
|
*
|
|
17370
17437
|
* @example
|
|
17371
17438
|
* ```ts
|
|
17372
17439
|
* import { Effect, TxRef } from "effect"
|
|
17373
17440
|
*
|
|
17374
17441
|
* const program = Effect.gen(function*() {
|
|
17375
|
-
* const ref1 = yield* TxRef.make(0)
|
|
17376
|
-
* const ref2 = yield* TxRef.make(
|
|
17442
|
+
* const ref1 = yield* Effect.transaction(TxRef.make(0))
|
|
17443
|
+
* const ref2 = yield* Effect.transaction(TxRef.make(0))
|
|
17377
17444
|
*
|
|
17378
|
-
* //
|
|
17379
|
-
* yield* Effect.atomic(Effect.gen(function*() {
|
|
17380
|
-
* yield* TxRef.set(ref1, 10)
|
|
17381
|
-
*
|
|
17382
|
-
* // This atomic operation composes with the parent
|
|
17383
|
-
* yield* Effect.atomic(Effect.gen(function*() {
|
|
17384
|
-
* yield* TxRef.set(ref1, 20) // Part of same transaction
|
|
17385
|
-
* }))
|
|
17386
|
-
* }))
|
|
17387
|
-
*
|
|
17388
|
-
* // Isolated transaction - ref2 will be in its own transaction
|
|
17445
|
+
* // All operations within transaction block succeed or fail together
|
|
17389
17446
|
* yield* Effect.transaction(Effect.gen(function*() {
|
|
17390
|
-
* yield* TxRef.set(
|
|
17447
|
+
* yield* TxRef.set(ref1, 10)
|
|
17448
|
+
* yield* TxRef.set(ref2, 20)
|
|
17449
|
+
* const sum = (yield* TxRef.get(ref1)) + (yield* TxRef.get(ref2))
|
|
17450
|
+
* console.log(`Transaction sum: ${sum}`)
|
|
17391
17451
|
* }))
|
|
17392
17452
|
*
|
|
17393
|
-
*
|
|
17394
|
-
*
|
|
17395
|
-
* return { ref1: val1, ref2: val2 }
|
|
17453
|
+
* console.log(`Final ref1: ${yield* Effect.transaction(TxRef.get(ref1))}`) // 10
|
|
17454
|
+
* console.log(`Final ref2: ${yield* Effect.transaction(TxRef.get(ref2))}`) // 20
|
|
17396
17455
|
* })
|
|
17397
17456
|
* ```
|
|
17398
17457
|
*
|
|
@@ -17401,34 +17460,21 @@ export declare const atomicWith: <A, E, R>(f: (state: Transaction["Service"]) =>
|
|
|
17401
17460
|
*/
|
|
17402
17461
|
export declare const transaction: <A, E, R>(effect: Effect<A, E, R>) => Effect<A, E, Exclude<R, Transaction>>;
|
|
17403
17462
|
/**
|
|
17404
|
-
*
|
|
17463
|
+
* Like {@link transaction} but provides access to the transaction state.
|
|
17405
17464
|
*
|
|
17406
|
-
*
|
|
17407
|
-
* within another transaction. This ensures complete isolation between transaction scopes.
|
|
17465
|
+
* Always creates a new isolated transaction boundary with its own journal and retry logic.
|
|
17408
17466
|
*
|
|
17409
17467
|
* @example
|
|
17410
17468
|
* ```ts
|
|
17411
17469
|
* import { Effect, TxRef } from "effect"
|
|
17412
17470
|
*
|
|
17413
|
-
* const program = Effect.transactionWith((
|
|
17471
|
+
* const program = Effect.transactionWith((_txState) =>
|
|
17414
17472
|
* Effect.gen(function*() {
|
|
17415
17473
|
* const ref = yield* TxRef.make(0)
|
|
17416
|
-
*
|
|
17417
|
-
* // This transaction is isolated - it has its own journal
|
|
17418
|
-
* // txState.journal is independent of any parent transaction
|
|
17419
|
-
*
|
|
17420
17474
|
* yield* TxRef.set(ref, 42)
|
|
17421
17475
|
* return yield* TxRef.get(ref)
|
|
17422
17476
|
* })
|
|
17423
17477
|
* )
|
|
17424
|
-
*
|
|
17425
|
-
* // Even when nested in another atomic block, this transaction is isolated
|
|
17426
|
-
* const nestedProgram = Effect.atomic(
|
|
17427
|
-
* Effect.gen(function*() {
|
|
17428
|
-
* const result = yield* program // Runs in its own isolated transaction
|
|
17429
|
-
* return result
|
|
17430
|
-
* })
|
|
17431
|
-
* )
|
|
17432
17478
|
* ```
|
|
17433
17479
|
*
|
|
17434
17480
|
* @since 4.0.0
|
|
@@ -17450,16 +17496,16 @@ export declare const transactionWith: <A, E, R>(f: (state: Transaction["Service"
|
|
|
17450
17496
|
*
|
|
17451
17497
|
* const program = Effect.gen(function*() {
|
|
17452
17498
|
* // create a transactional reference
|
|
17453
|
-
* const ref = yield* TxRef.make(0)
|
|
17499
|
+
* const ref = yield* Effect.transaction(TxRef.make(0))
|
|
17454
17500
|
*
|
|
17455
17501
|
* // forks a fiber that increases the value of `ref` every 100 millis
|
|
17456
17502
|
* yield* Effect.forkChild(Effect.forever(
|
|
17457
17503
|
* // update to transactional value
|
|
17458
|
-
* TxRef.update(ref, (n) => n + 1).pipe(Effect.delay("100 millis"))
|
|
17504
|
+
* Effect.transaction(TxRef.update(ref, (n) => n + 1)).pipe(Effect.delay("100 millis"))
|
|
17459
17505
|
* ))
|
|
17460
17506
|
*
|
|
17461
17507
|
* // the following will retry 10 times until the `ref` value is 10
|
|
17462
|
-
* yield* Effect.
|
|
17508
|
+
* yield* Effect.transaction(Effect.gen(function*() {
|
|
17463
17509
|
* const value = yield* TxRef.get(ref)
|
|
17464
17510
|
* if (value < 10) {
|
|
17465
17511
|
* yield* Effect.log(`retry due to value: ${value}`)
|