effect 4.1.4 → 4.1.6
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/THIRD_PARTY_NOTICES.md +88 -0
- package/ai-docs/package.json +2 -2
- package/dist/Arbitrary.d.ts +44 -2
- package/dist/Arbitrary.d.ts.map +1 -1
- package/dist/Arbitrary.js +9 -1
- package/dist/Arbitrary.js.map +1 -1
- package/dist/BigInt.d.ts +200 -1
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +105 -9
- package/dist/BigInt.js.map +1 -1
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +4 -2
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +3 -3
- package/dist/Cause.js +1 -1
- package/dist/Channel.d.ts +104 -7
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +73 -4
- package/dist/Channel.js.map +1 -1
- package/dist/Chunk.d.ts +5 -0
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +7 -2
- package/dist/Chunk.js.map +1 -1
- package/dist/Clock.d.ts +5 -2
- package/dist/Clock.d.ts.map +1 -1
- package/dist/Clock.js +2 -1
- package/dist/Clock.js.map +1 -1
- package/dist/Codegen.d.ts +300 -0
- package/dist/Codegen.d.ts.map +1 -0
- package/dist/Codegen.js +526 -0
- package/dist/Codegen.js.map +1 -0
- package/dist/Config.d.ts +31 -2
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +12 -1
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +11 -1
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +17 -6
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Effect.d.ts +1008 -127
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +410 -49
- package/dist/Effect.js.map +1 -1
- package/dist/Equal.d.ts +4 -4
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +78 -65
- package/dist/Equal.js.map +1 -1
- package/dist/Equivalence.d.ts +11 -9
- package/dist/Equivalence.d.ts.map +1 -1
- package/dist/Equivalence.js +15 -12
- package/dist/Equivalence.js.map +1 -1
- package/dist/Fiber.d.ts +58 -8
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js +28 -4
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.d.ts +81 -10
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +40 -8
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +80 -10
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +37 -6
- package/dist/FiberMap.js.map +1 -1
- package/dist/FiberSet.d.ts +93 -8
- package/dist/FiberSet.d.ts.map +1 -1
- package/dist/FiberSet.js +46 -4
- package/dist/FiberSet.js.map +1 -1
- package/dist/Formatter.d.ts +2 -0
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js +2 -0
- package/dist/Formatter.js.map +1 -1
- package/dist/Hash.d.ts.map +1 -1
- package/dist/Hash.js +24 -17
- package/dist/Hash.js.map +1 -1
- package/dist/LayerMap.d.ts +12 -3
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +12 -2
- package/dist/LayerMap.js.map +1 -1
- package/dist/LayerRef.d.ts +3 -3
- package/dist/LayerRef.d.ts.map +1 -1
- package/dist/LayerRef.js +3 -3
- package/dist/LayerRef.js.map +1 -1
- package/dist/Logger.d.ts +37 -13
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +39 -10
- package/dist/Logger.js.map +1 -1
- package/dist/Match.d.ts +35 -23
- package/dist/Match.d.ts.map +1 -1
- package/dist/Match.js +16 -0
- package/dist/Match.js.map +1 -1
- package/dist/Metric.js +1 -1
- package/dist/Metric.js.map +1 -1
- package/dist/Option.d.ts +4 -1
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +6 -2
- package/dist/Option.js.map +1 -1
- package/dist/Order.d.ts +7 -5
- package/dist/Order.d.ts.map +1 -1
- package/dist/Order.js +8 -3
- package/dist/Order.js.map +1 -1
- package/dist/Pool.d.ts +4 -3
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +21 -18
- package/dist/Pool.js.map +1 -1
- package/dist/Predicate.d.ts +4 -1
- package/dist/Predicate.d.ts.map +1 -1
- package/dist/Predicate.js +5 -1
- package/dist/Predicate.js.map +1 -1
- package/dist/Queue.d.ts +69 -22
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +40 -18
- package/dist/Queue.js.map +1 -1
- package/dist/Rational.d.ts +179 -0
- package/dist/Rational.d.ts.map +1 -1
- package/dist/Rational.js +63 -0
- package/dist/Rational.js.map +1 -1
- package/dist/Request.d.ts +20 -0
- package/dist/Request.d.ts.map +1 -1
- package/dist/Request.js +20 -0
- package/dist/Request.js.map +1 -1
- package/dist/Result.d.ts +3 -1
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +5 -2
- package/dist/Result.js.map +1 -1
- package/dist/Schema.d.ts +90 -19
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +92 -414
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +11 -7
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +5 -6
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +14 -10
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +19 -64
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +1 -28
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +11 -10
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +12 -11
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/Scope.d.ts +12 -6
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +12 -6
- package/dist/Scope.js.map +1 -1
- package/dist/ScopedCache.d.ts.map +1 -1
- package/dist/ScopedCache.js +8 -5
- package/dist/ScopedCache.js.map +1 -1
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js +18 -4
- package/dist/Semaphore.js.map +1 -1
- package/dist/Stream.d.ts +128 -5
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +179 -43
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +57 -3
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +63 -5
- package/dist/String.js.map +1 -1
- package/dist/Struct.d.ts +135 -1
- package/dist/Struct.d.ts.map +1 -1
- package/dist/Struct.js +64 -5
- package/dist/Struct.js.map +1 -1
- package/dist/TextDiff.d.ts +105 -0
- package/dist/TextDiff.d.ts.map +1 -1
- package/dist/TextDiff.js +137 -24
- package/dist/TextDiff.js.map +1 -1
- package/dist/Tracer.d.ts +10 -0
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +2 -0
- package/dist/Tracer.js.map +1 -1
- package/dist/TxPriorityQueue.js +2 -2
- package/dist/TxPriorityQueue.js.map +1 -1
- package/dist/ai/LanguageModel.d.ts.map +1 -1
- package/dist/ai/LanguageModel.js +1 -1
- package/dist/ai/LanguageModel.js.map +1 -1
- package/dist/ai/McpServer.d.ts +199 -4
- package/dist/ai/McpServer.d.ts.map +1 -1
- package/dist/ai/McpServer.js +143 -18
- package/dist/ai/McpServer.js.map +1 -1
- package/dist/ai/Prompt.d.ts +3 -1
- package/dist/ai/Prompt.d.ts.map +1 -1
- package/dist/ai/Prompt.js +17 -3
- package/dist/ai/Prompt.js.map +1 -1
- package/dist/ai/Skill.d.ts +172 -0
- package/dist/ai/Skill.d.ts.map +1 -0
- package/dist/ai/Skill.js +209 -0
- package/dist/ai/Skill.js.map +1 -0
- package/dist/ai/Tool.d.ts +3 -2
- package/dist/ai/Tool.d.ts.map +1 -1
- package/dist/ai/Tool.js +3 -2
- package/dist/ai/Tool.js.map +1 -1
- package/dist/ai/Toolkit.d.ts.map +1 -1
- package/dist/ai/Toolkit.js +5 -1
- package/dist/ai/Toolkit.js.map +1 -1
- package/dist/ai/index.d.ts +5 -0
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +5 -0
- package/dist/ai/index.js.map +1 -1
- package/dist/chat/Chat.d.ts +90 -0
- package/dist/chat/Chat.d.ts.map +1 -0
- package/dist/chat/Chat.js +127 -0
- package/dist/chat/Chat.js.map +1 -0
- package/dist/chat/ChatAdapter.d.ts +386 -0
- package/dist/chat/ChatAdapter.d.ts.map +1 -0
- package/dist/chat/ChatAdapter.js +110 -0
- package/dist/chat/ChatAdapter.js.map +1 -0
- package/dist/chat/ChatError.d.ts +500 -0
- package/dist/chat/ChatError.d.ts.map +1 -0
- package/dist/chat/ChatError.js +521 -0
- package/dist/chat/ChatError.js.map +1 -0
- package/dist/chat/ChatEvent.d.ts +321 -0
- package/dist/chat/ChatEvent.d.ts.map +1 -0
- package/dist/chat/ChatEvent.js +163 -0
- package/dist/chat/ChatEvent.js.map +1 -0
- package/dist/chat/ChatHandler.d.ts +81 -0
- package/dist/chat/ChatHandler.d.ts.map +1 -0
- package/dist/chat/ChatHandler.js +85 -0
- package/dist/chat/ChatHandler.js.map +1 -0
- package/dist/chat/ChatInteraction.d.ts +1519 -0
- package/dist/chat/ChatInteraction.d.ts.map +1 -0
- package/dist/chat/ChatInteraction.js +1052 -0
- package/dist/chat/ChatInteraction.js.map +1 -0
- package/dist/chat/ChatMarkdown.d.ts +280 -0
- package/dist/chat/ChatMarkdown.d.ts.map +1 -0
- package/dist/chat/ChatMarkdown.js +1172 -0
- package/dist/chat/ChatMarkdown.js.map +1 -0
- package/dist/chat/ChatMessage.d.ts +224 -0
- package/dist/chat/ChatMessage.d.ts.map +1 -0
- package/dist/chat/ChatMessage.js +172 -0
- package/dist/chat/ChatMessage.js.map +1 -0
- package/dist/chat/ChatTest.d.ts +407 -0
- package/dist/chat/ChatTest.d.ts.map +1 -0
- package/dist/chat/ChatTest.js +2145 -0
- package/dist/chat/ChatTest.js.map +1 -0
- package/dist/chat/ChatThread.d.ts +92 -0
- package/dist/chat/ChatThread.d.ts.map +1 -0
- package/dist/chat/ChatThread.js +116 -0
- package/dist/chat/ChatThread.js.map +1 -0
- package/dist/chat/ChatUi.d.ts +362 -0
- package/dist/chat/ChatUi.d.ts.map +1 -0
- package/dist/chat/ChatUi.js +209 -0
- package/dist/chat/ChatUi.js.map +1 -0
- package/dist/chat/index.d.ts +60 -0
- package/dist/chat/index.d.ts.map +1 -0
- package/dist/chat/index.js +61 -0
- package/dist/chat/index.js.map +1 -0
- package/dist/chat/internal/retries.d.ts +2 -0
- package/dist/chat/internal/retries.d.ts.map +1 -0
- package/dist/chat/internal/retries.js +7 -0
- package/dist/chat/internal/retries.js.map +1 -0
- package/dist/cli/CliOutput.d.ts.map +1 -1
- package/dist/cli/CliOutput.js +6 -7
- package/dist/cli/CliOutput.js.map +1 -1
- package/dist/cli/Command.d.ts +20 -2
- package/dist/cli/Command.d.ts.map +1 -1
- package/dist/cli/Command.js +4 -0
- package/dist/cli/Command.js.map +1 -1
- package/dist/cli/Prompt.d.ts +5 -6
- package/dist/cli/Prompt.d.ts.map +1 -1
- package/dist/cli/Prompt.js +9 -4
- package/dist/cli/Prompt.js.map +1 -1
- package/dist/cli/internal/command.d.ts +1 -1
- package/dist/cli/internal/command.d.ts.map +1 -1
- package/dist/cli/internal/config.d.ts +1 -1
- package/dist/cli/internal/config.d.ts.map +1 -1
- package/dist/cli/internal/config.js +3 -3
- package/dist/cli/internal/config.js.map +1 -1
- package/dist/cluster/ClusterCron.d.ts +21 -1
- package/dist/cluster/ClusterCron.d.ts.map +1 -1
- package/dist/cluster/ClusterCron.js +24 -6
- package/dist/cluster/ClusterCron.js.map +1 -1
- package/dist/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/cluster/ClusterWorkflowEngine.js +183 -103
- package/dist/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/cluster/MessageStorage.d.ts +56 -0
- package/dist/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/cluster/MessageStorage.js +18 -2
- package/dist/cluster/MessageStorage.js.map +1 -1
- package/dist/cluster/Sharding.d.ts.map +1 -1
- package/dist/cluster/Sharding.js +15 -3
- package/dist/cluster/Sharding.js.map +1 -1
- package/dist/cluster/ShardingConfig.d.ts +6 -0
- package/dist/cluster/ShardingConfig.d.ts.map +1 -1
- package/dist/cluster/ShardingConfig.js.map +1 -1
- package/dist/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/cluster/SqlMessageStorage.js +58 -37
- package/dist/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/cluster/SqlRunnerStorage.js +18 -8
- package/dist/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/cluster/internal/entityActivation.js +2 -0
- package/dist/cluster/internal/entityActivation.js.map +1 -1
- package/dist/cluster/internal/entityManager.js +20 -13
- package/dist/cluster/internal/entityManager.js.map +1 -1
- package/dist/cluster/internal/entityReaper.js +1 -1
- package/dist/cluster/internal/entityReaper.js.map +1 -1
- package/dist/crypto/Kdf.d.ts +2 -1
- package/dist/crypto/Kdf.d.ts.map +1 -1
- package/dist/crypto/Kdf.js +2 -1
- package/dist/crypto/Kdf.js.map +1 -1
- package/dist/crypto/Password.d.ts +162 -0
- package/dist/crypto/Password.d.ts.map +1 -0
- package/dist/crypto/Password.js +217 -0
- package/dist/crypto/Password.js.map +1 -0
- package/dist/crypto/index.d.ts +5 -0
- package/dist/crypto/index.d.ts.map +1 -1
- package/dist/crypto/index.js +5 -0
- package/dist/crypto/index.js.map +1 -1
- package/dist/encoding/Base64.d.ts +63 -0
- package/dist/encoding/Base64.d.ts.map +1 -1
- package/dist/encoding/Base64.js +82 -1
- package/dist/encoding/Base64.js.map +1 -1
- package/dist/encoding/Base64Url.d.ts +1 -0
- package/dist/encoding/Base64Url.d.ts.map +1 -1
- package/dist/encoding/Base64Url.js +7 -1
- package/dist/encoding/Base64Url.js.map +1 -1
- package/dist/encoding/Csv.d.ts.map +1 -1
- package/dist/encoding/Csv.js +44 -16
- package/dist/encoding/Csv.js.map +1 -1
- package/dist/encoding/Hex.d.ts +5 -0
- package/dist/encoding/Hex.d.ts.map +1 -1
- package/dist/encoding/Hex.js +5 -0
- package/dist/encoding/Hex.js.map +1 -1
- package/dist/encoding/SchemaBinary.d.ts.map +1 -1
- package/dist/encoding/SchemaBinary.js +13 -124
- package/dist/encoding/SchemaBinary.js.map +1 -1
- package/dist/encoding/Sse.d.ts +1 -0
- package/dist/encoding/Sse.d.ts.map +1 -1
- package/dist/encoding/Sse.js +7 -5
- package/dist/encoding/Sse.js.map +1 -1
- package/dist/encoding/Xml.d.ts +153 -18
- package/dist/encoding/Xml.d.ts.map +1 -1
- package/dist/encoding/Xml.js +379 -57
- package/dist/encoding/Xml.js.map +1 -1
- package/dist/eventlog/EventJournal.d.ts.map +1 -1
- package/dist/eventlog/EventJournal.js +3 -8
- package/dist/eventlog/EventJournal.js.map +1 -1
- package/dist/eventlog/SqlEventLogServerEncrypted.js +6 -8
- package/dist/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
- package/dist/http/FetchHttpClient.d.ts +2 -1
- package/dist/http/FetchHttpClient.d.ts.map +1 -1
- package/dist/http/FetchHttpClient.js +14 -10
- package/dist/http/FetchHttpClient.js.map +1 -1
- package/dist/http/FindMyWay/internal/router.js +163 -116
- package/dist/http/FindMyWay/internal/router.js.map +1 -1
- package/dist/http/FindMyWay.d.ts +99 -0
- package/dist/http/FindMyWay.d.ts.map +1 -1
- package/dist/http/FindMyWay.js +39 -0
- package/dist/http/FindMyWay.js.map +1 -1
- package/dist/http/Headers.d.ts +201 -3
- package/dist/http/Headers.d.ts.map +1 -1
- package/dist/http/Headers.js +205 -3
- package/dist/http/Headers.js.map +1 -1
- package/dist/http/HttpClient.d.ts.map +1 -1
- package/dist/http/HttpClient.js +12 -8
- package/dist/http/HttpClient.js.map +1 -1
- package/dist/http/HttpClientError.d.ts +1 -0
- package/dist/http/HttpClientError.d.ts.map +1 -1
- package/dist/http/HttpClientError.js +32 -9
- package/dist/http/HttpClientError.js.map +1 -1
- package/dist/http/HttpClientRequest.d.ts +46 -0
- package/dist/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/http/HttpClientRequest.js +15 -0
- package/dist/http/HttpClientRequest.js.map +1 -1
- package/dist/http/HttpClientResponse.d.ts +132 -0
- package/dist/http/HttpClientResponse.d.ts.map +1 -1
- package/dist/http/HttpClientResponse.js +83 -0
- package/dist/http/HttpClientResponse.js.map +1 -1
- package/dist/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/http/HttpMiddleware.js +16 -9
- package/dist/http/HttpMiddleware.js.map +1 -1
- package/dist/http/HttpRouter.d.ts +49 -1
- package/dist/http/HttpRouter.d.ts.map +1 -1
- package/dist/http/HttpRouter.js +70 -20
- package/dist/http/HttpRouter.js.map +1 -1
- package/dist/http/HttpServerResponse.d.ts +118 -0
- package/dist/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/http/HttpServerResponse.js +67 -58
- package/dist/http/HttpServerResponse.js.map +1 -1
- package/dist/http/Mime.d.ts.map +1 -1
- package/dist/http/Mime.js +3 -2
- package/dist/http/Mime.js.map +1 -1
- package/dist/http/Multipart.d.ts.map +1 -1
- package/dist/http/Multipart.js +0 -5
- package/dist/http/Multipart.js.map +1 -1
- package/dist/http/MultipartParser/internal/contentType.d.ts +6 -0
- package/dist/http/MultipartParser/internal/contentType.d.ts.map +1 -1
- package/dist/http/MultipartParser/internal/contentType.js +1 -1
- package/dist/http/MultipartParser/internal/contentType.js.map +1 -1
- package/dist/http/internal/clientPath.d.ts +2 -0
- package/dist/http/internal/clientPath.d.ts.map +1 -0
- package/dist/http/internal/clientPath.js +24 -0
- package/dist/http/internal/clientPath.js.map +1 -0
- package/dist/http/internal/compression.d.ts.map +1 -1
- package/dist/http/internal/compression.js +2 -2
- package/dist/http/internal/compression.js.map +1 -1
- package/dist/http/internal/mediaType.d.ts.map +1 -0
- package/dist/{http-api → http}/internal/mediaType.js +4 -0
- package/dist/{http-api → http}/internal/mediaType.js.map +1 -1
- package/dist/http/internal/redactedPath.d.ts +2 -0
- package/dist/http/internal/redactedPath.d.ts.map +1 -0
- package/dist/http/internal/redactedPath.js +140 -0
- package/dist/http/internal/redactedPath.js.map +1 -0
- package/dist/http/internal/requestState.js +1 -0
- package/dist/http/internal/requestState.js.map +1 -1
- package/dist/http/internal/tracing.js +5 -3
- package/dist/http/internal/tracing.js.map +1 -1
- package/dist/http-api/HttpApi.d.ts +13 -2
- package/dist/http-api/HttpApi.d.ts.map +1 -1
- package/dist/http-api/HttpApi.js +43 -6
- package/dist/http-api/HttpApi.js.map +1 -1
- package/dist/http-api/HttpApiBuilder.d.ts.map +1 -1
- package/dist/http-api/HttpApiBuilder.js +7 -3
- package/dist/http-api/HttpApiBuilder.js.map +1 -1
- package/dist/http-api/HttpApiClient.d.ts.map +1 -1
- package/dist/http-api/HttpApiClient.js +29 -12
- package/dist/http-api/HttpApiClient.js.map +1 -1
- package/dist/http-api/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/http-api/HttpApiEndpoint.js +1 -1
- package/dist/http-api/HttpApiEndpoint.js.map +1 -1
- package/dist/http-api/HttpApiScalar.d.ts +4 -0
- package/dist/http-api/HttpApiScalar.d.ts.map +1 -1
- package/dist/http-api/HttpApiScalar.js +10 -1
- package/dist/http-api/HttpApiScalar.js.map +1 -1
- package/dist/http-api/HttpApiSchema.d.ts.map +1 -1
- package/dist/http-api/HttpApiSchema.js +1 -1
- package/dist/http-api/HttpApiSchema.js.map +1 -1
- package/dist/http-api/OpenApi.d.ts +2 -0
- package/dist/http-api/OpenApi.d.ts.map +1 -1
- package/dist/http-api/internal/httpApiScalar.js +5 -2
- package/dist/http-api/internal/httpApiScalar.js.map +1 -1
- package/dist/http-api/internal/redactedKeys.d.ts +2 -0
- package/dist/http-api/internal/redactedKeys.d.ts.map +1 -0
- package/dist/http-api/internal/redactedKeys.js +37 -0
- package/dist/http-api/internal/redactedKeys.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/arbitrary/model.js +0 -5
- package/dist/internal/arbitrary/model.js.map +1 -1
- package/dist/internal/arbitrary/regexp.js +2 -1
- package/dist/internal/arbitrary/regexp.js.map +1 -1
- package/dist/internal/arbitrary/runner.d.ts.map +1 -1
- package/dist/internal/arbitrary/runner.js +21 -16
- package/dist/internal/arbitrary/runner.js.map +1 -1
- package/dist/internal/arbitrary/schema.js +140 -23
- package/dist/internal/arbitrary/schema.js.map +1 -1
- package/dist/internal/base64.js +34 -2
- package/dist/internal/base64.js.map +1 -1
- package/dist/internal/codegen.d.ts +2 -0
- package/dist/internal/codegen.d.ts.map +1 -0
- package/dist/internal/codegen.js +59 -0
- package/dist/internal/codegen.js.map +1 -0
- package/dist/internal/core.js +3 -3
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/dateTime.js +61 -29
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/effect.js +30 -8
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/equal.js +14 -13
- package/dist/internal/equal.js.map +1 -1
- package/dist/internal/hash.js +4 -1
- package/dist/internal/hash.js.map +1 -1
- package/dist/internal/hashMap.js +7 -7
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/matcher.js +19 -18
- package/dist/internal/matcher.js.map +1 -1
- package/dist/internal/record.js +18 -4
- package/dist/internal/record.js.map +1 -1
- package/dist/internal/result.js +1 -1
- package/dist/internal/result.js.map +1 -1
- package/dist/internal/schema/codeExpression.d.ts +4 -0
- package/dist/internal/schema/codeExpression.d.ts.map +1 -0
- package/dist/internal/schema/codeExpression.js +179 -0
- package/dist/internal/schema/codeExpression.js.map +1 -0
- package/dist/internal/schema/codeImports.d.ts +8 -0
- package/dist/internal/schema/codeImports.d.ts.map +1 -0
- package/dist/internal/schema/codeImports.js +135 -0
- package/dist/internal/schema/codeImports.js.map +1 -0
- package/dist/internal/schema/codeTokens.d.ts +8 -0
- package/dist/internal/schema/codeTokens.d.ts.map +1 -0
- package/dist/internal/schema/codeTokens.js +17 -0
- package/dist/internal/schema/codeTokens.js.map +1 -0
- package/dist/internal/schema/passthrough.d.ts +2 -0
- package/dist/internal/schema/passthrough.d.ts.map +1 -0
- package/dist/internal/schema/passthrough.js +8 -0
- package/dist/internal/schema/passthrough.js.map +1 -0
- package/dist/internal/schema/schemaCodegen.d.ts +2 -0
- package/dist/internal/schema/schemaCodegen.d.ts.map +1 -0
- package/dist/internal/schema/schemaCodegen.js +378 -0
- package/dist/internal/schema/schemaCodegen.js.map +1 -0
- package/dist/internal/schema/schemaCodegenBuiltIns.d.ts +2 -0
- package/dist/internal/schema/schemaCodegenBuiltIns.d.ts.map +1 -0
- package/dist/internal/schema/schemaCodegenBuiltIns.js +425 -0
- package/dist/internal/schema/schemaCodegenBuiltIns.js.map +1 -0
- package/dist/internal/schema/toEquivalence.js +3 -4
- package/dist/internal/schema/toEquivalence.js.map +1 -1
- package/dist/internal/schema/toJsonSchemaDocument.js +11 -4
- package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -1
- package/dist/internal/trie.js +51 -64
- package/dist/internal/trie.js.map +1 -1
- package/dist/internal/utf8.d.ts +2 -0
- package/dist/internal/utf8.d.ts.map +1 -0
- package/dist/internal/utf8.js +151 -0
- package/dist/internal/utf8.js.map +1 -0
- package/dist/internal/version.js +1 -1
- package/dist/jose/JoseError.d.ts +51 -1
- package/dist/jose/JoseError.d.ts.map +1 -1
- package/dist/jose/JoseError.js +25 -18
- package/dist/jose/JoseError.js.map +1 -1
- package/dist/jose/Jwks.d.ts +13 -0
- package/dist/jose/Jwks.d.ts.map +1 -1
- package/dist/jose/Jwks.js +10 -2
- package/dist/jose/Jwks.js.map +1 -1
- package/dist/jose/internal/compact.js +10 -5
- package/dist/jose/internal/compact.js.map +1 -1
- package/dist/observability/Otlp.d.ts +19 -0
- package/dist/observability/Otlp.d.ts.map +1 -1
- package/dist/observability/Otlp.js +10 -0
- package/dist/observability/Otlp.js.map +1 -1
- package/dist/observability/OtlpExporter.d.ts +49 -13
- package/dist/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/observability/OtlpExporter.js +133 -50
- package/dist/observability/OtlpExporter.js.map +1 -1
- package/dist/observability/OtlpLogger.d.ts +14 -0
- package/dist/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/observability/OtlpLogger.js +15 -5
- package/dist/observability/OtlpLogger.js.map +1 -1
- package/dist/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/observability/OtlpMetrics.js +2 -0
- package/dist/observability/OtlpMetrics.js.map +1 -1
- package/dist/observability/OtlpTracer.d.ts +14 -0
- package/dist/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/observability/OtlpTracer.js +10 -2
- package/dist/observability/OtlpTracer.js.map +1 -1
- package/dist/observability/internal/otlpProtobuf.d.ts +4 -2
- package/dist/observability/internal/otlpProtobuf.d.ts.map +1 -1
- package/dist/observability/internal/otlpProtobuf.js +238 -156
- package/dist/observability/internal/otlpProtobuf.js.map +1 -1
- package/dist/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/persistence/KeyValueStore.js +6 -4
- package/dist/persistence/KeyValueStore.js.map +1 -1
- package/dist/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/persistence/PersistedQueue.js +20 -3
- package/dist/persistence/PersistedQueue.js.map +1 -1
- package/dist/protobuf/ProtobufDescriptor.d.ts +377 -0
- package/dist/protobuf/ProtobufDescriptor.d.ts.map +1 -0
- package/dist/protobuf/ProtobufDescriptor.js +135 -0
- package/dist/protobuf/ProtobufDescriptor.js.map +1 -0
- package/dist/protobuf/ProtobufDescriptorProto.d.ts +2083 -0
- package/dist/protobuf/ProtobufDescriptorProto.d.ts.map +1 -0
- package/dist/protobuf/ProtobufDescriptorProto.js +2674 -0
- package/dist/protobuf/ProtobufDescriptorProto.js.map +1 -0
- package/dist/protobuf/ProtobufMessage.d.ts +183 -0
- package/dist/protobuf/ProtobufMessage.d.ts.map +1 -0
- package/dist/protobuf/ProtobufMessage.js +232 -0
- package/dist/protobuf/ProtobufMessage.js.map +1 -0
- package/dist/protobuf/ProtobufReader.d.ts +350 -0
- package/dist/protobuf/ProtobufReader.d.ts.map +1 -0
- package/dist/protobuf/ProtobufReader.js +698 -0
- package/dist/protobuf/ProtobufReader.js.map +1 -0
- package/dist/protobuf/ProtobufWriter.d.ts +224 -0
- package/dist/protobuf/ProtobufWriter.d.ts.map +1 -0
- package/dist/protobuf/ProtobufWriter.js +483 -0
- package/dist/protobuf/ProtobufWriter.js.map +1 -0
- package/dist/protobuf/index.d.ts +30 -0
- package/dist/protobuf/index.d.ts.map +1 -0
- package/dist/protobuf/index.js +31 -0
- package/dist/protobuf/index.js.map +1 -0
- package/dist/protobuf/internal/binary.d.ts +2 -0
- package/dist/protobuf/internal/binary.d.ts.map +1 -0
- package/dist/protobuf/internal/binary.js +966 -0
- package/dist/protobuf/internal/binary.js.map +1 -0
- package/dist/protobuf/internal/resolve.d.ts +2 -0
- package/dist/protobuf/internal/resolve.d.ts.map +1 -0
- package/dist/protobuf/internal/resolve.js +463 -0
- package/dist/protobuf/internal/resolve.js.map +1 -0
- package/dist/protobuf/internal/wireType.d.ts +2 -0
- package/dist/protobuf/internal/wireType.d.ts.map +1 -0
- package/dist/protobuf/internal/wireType.js +10 -0
- package/dist/protobuf/internal/wireType.js.map +1 -0
- package/dist/reactivity/AsyncResult.d.ts +3 -0
- package/dist/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/reactivity/AsyncResult.js +4 -1
- package/dist/reactivity/AsyncResult.js.map +1 -1
- package/dist/reactivity/Atom.d.ts +10 -4
- package/dist/reactivity/Atom.d.ts.map +1 -1
- package/dist/reactivity/Atom.js +48 -22
- package/dist/reactivity/Atom.js.map +1 -1
- package/dist/reactivity/AtomHttpApi.d.ts +5 -0
- package/dist/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/reactivity/AtomHttpApi.js +5 -1
- package/dist/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/reactivity/AtomRegistry.js +13 -0
- package/dist/reactivity/AtomRegistry.js.map +1 -1
- package/dist/reactivity/AtomRpc.d.ts +5 -0
- package/dist/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/reactivity/AtomRpc.js +6 -1
- package/dist/reactivity/AtomRpc.js.map +1 -1
- package/dist/rpc/Rpc.d.ts +25 -0
- package/dist/rpc/Rpc.d.ts.map +1 -1
- package/dist/rpc/Rpc.js +18 -0
- package/dist/rpc/Rpc.js.map +1 -1
- package/dist/rpc/RpcClient.d.ts.map +1 -1
- package/dist/rpc/RpcClient.js +70 -22
- package/dist/rpc/RpcClient.js.map +1 -1
- package/dist/rpc/RpcGroup.d.ts +6 -1
- package/dist/rpc/RpcGroup.d.ts.map +1 -1
- package/dist/rpc/RpcGroup.js +4 -0
- package/dist/rpc/RpcGroup.js.map +1 -1
- package/dist/rpc/RpcMiddleware.d.ts +9 -0
- package/dist/rpc/RpcMiddleware.d.ts.map +1 -1
- package/dist/rpc/RpcMiddleware.js.map +1 -1
- package/dist/rpc/RpcSerialization.d.ts +7 -1
- package/dist/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/rpc/RpcSerialization.js +22 -5
- package/dist/rpc/RpcSerialization.js.map +1 -1
- package/dist/rpc/RpcServer.d.ts.map +1 -1
- package/dist/rpc/RpcServer.js +33 -18
- package/dist/rpc/RpcServer.js.map +1 -1
- package/dist/schema/SchemaCompiler/runtime.js +2 -1
- package/dist/schema/SchemaCompiler/runtime.js.map +1 -1
- package/dist/schema/VariantSchema.d.ts +10 -2
- package/dist/schema/VariantSchema.d.ts.map +1 -1
- package/dist/schema/VariantSchema.js +7 -1
- package/dist/schema/VariantSchema.js.map +1 -1
- package/dist/socket/Socket.d.ts +24 -10
- package/dist/socket/Socket.d.ts.map +1 -1
- package/dist/socket/Socket.js +52 -17
- package/dist/socket/Socket.js.map +1 -1
- package/dist/sql/Migrator.d.ts +3 -0
- package/dist/sql/Migrator.d.ts.map +1 -1
- package/dist/sql/Migrator.js +12 -6
- package/dist/sql/Migrator.js.map +1 -1
- package/dist/sql/SqlClient.d.ts.map +1 -1
- package/dist/sql/SqlClient.js +5 -1
- package/dist/sql/SqlClient.js.map +1 -1
- package/dist/sql/SqlModel.d.ts.map +1 -1
- package/dist/sql/SqlModel.js +1 -0
- package/dist/sql/SqlModel.js.map +1 -1
- package/dist/testing/TestConsole.d.ts +96 -0
- package/dist/testing/TestConsole.d.ts.map +1 -1
- package/dist/testing/TestConsole.js +78 -6
- package/dist/testing/TestConsole.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +5 -1
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/testing/TestSchema.js +7 -2
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/workers/SharedMemory.d.ts +115 -0
- package/dist/workers/SharedMemory.d.ts.map +1 -0
- package/dist/workers/SharedMemory.js +149 -0
- package/dist/workers/SharedMemory.js.map +1 -0
- package/dist/workers/Transferable.d.ts.map +1 -1
- package/dist/workers/Transferable.js +1 -4
- package/dist/workers/Transferable.js.map +1 -1
- package/dist/workers/index.d.ts +5 -0
- package/dist/workers/index.d.ts.map +1 -1
- package/dist/workers/index.js +5 -0
- package/dist/workers/index.js.map +1 -1
- package/dist/workflow/Activity.d.ts +18 -0
- package/dist/workflow/Activity.d.ts.map +1 -1
- package/dist/workflow/Activity.js +13 -4
- package/dist/workflow/Activity.js.map +1 -1
- package/dist/workflow/Workflow.d.ts +10 -9
- package/dist/workflow/Workflow.d.ts.map +1 -1
- package/dist/workflow/Workflow.js +33 -22
- package/dist/workflow/Workflow.js.map +1 -1
- package/dist/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/workflow/WorkflowEngine.js +28 -12
- package/dist/workflow/WorkflowEngine.js.map +1 -1
- package/dist/workflow/internal/retry.d.ts +2 -0
- package/dist/workflow/internal/retry.d.ts.map +1 -0
- package/dist/workflow/internal/retry.js +11 -0
- package/dist/workflow/internal/retry.js.map +1 -0
- package/dist/workflow/internal/scope.d.ts +2 -0
- package/dist/workflow/internal/scope.d.ts.map +1 -0
- package/dist/workflow/internal/scope.js +26 -0
- package/dist/workflow/internal/scope.js.map +1 -0
- package/package.json +8 -5
- package/src/Arbitrary.ts +60 -3
- package/src/BigInt.ts +247 -9
- package/src/Cache.ts +4 -2
- package/src/Cause.ts +3 -3
- package/src/Channel.ts +105 -8
- package/src/Chunk.ts +7 -3
- package/src/Clock.ts +5 -2
- package/src/Codegen.ts +746 -0
- package/src/Config.ts +35 -4
- package/src/ConfigProvider.ts +24 -7
- package/src/Effect.ts +1095 -157
- package/src/Equal.ts +85 -79
- package/src/Equivalence.ts +16 -13
- package/src/Fiber.ts +58 -8
- package/src/FiberHandle.ts +86 -12
- package/src/FiberMap.ts +83 -10
- package/src/FiberSet.ts +96 -8
- package/src/Formatter.ts +2 -0
- package/src/Hash.ts +30 -22
- package/src/LayerMap.ts +14 -4
- package/src/LayerRef.ts +8 -6
- package/src/Logger.ts +68 -25
- package/src/Match.ts +94 -50
- package/src/Metric.ts +1 -1
- package/src/Option.ts +9 -5
- package/src/Order.ts +10 -5
- package/src/Pool.ts +22 -17
- package/src/Predicate.ts +7 -3
- package/src/Queue.ts +84 -31
- package/src/Rational.ts +198 -0
- package/src/Request.ts +20 -0
- package/src/Result.ts +9 -6
- package/src/Schema.ts +145 -325
- package/src/SchemaAST.ts +15 -5
- package/src/SchemaGetter.ts +17 -10
- package/src/SchemaRepresentation.ts +19 -74
- package/src/SchemaTransformation.ts +12 -11
- package/src/Scope.ts +12 -6
- package/src/ScopedCache.ts +8 -5
- package/src/Semaphore.ts +18 -4
- package/src/Stream.ts +233 -53
- package/src/String.ts +84 -7
- package/src/Struct.ts +138 -5
- package/src/TextDiff.ts +186 -30
- package/src/Tracer.ts +10 -0
- package/src/TxPriorityQueue.ts +2 -2
- package/src/ai/LanguageModel.ts +2 -1
- package/src/ai/McpServer.ts +306 -26
- package/src/ai/Prompt.ts +20 -3
- package/src/ai/Skill.ts +236 -0
- package/src/ai/Tool.ts +3 -2
- package/src/ai/Toolkit.ts +3 -1
- package/src/ai/index.ts +6 -0
- package/src/chat/Chat.ts +164 -0
- package/src/chat/ChatAdapter.ts +444 -0
- package/src/chat/ChatError.ts +684 -0
- package/src/chat/ChatEvent.ts +221 -0
- package/src/chat/ChatHandler.ts +102 -0
- package/src/chat/ChatInteraction.ts +1979 -0
- package/src/chat/ChatMarkdown.ts +1406 -0
- package/src/chat/ChatMessage.ts +213 -0
- package/src/chat/ChatTest.ts +2606 -0
- package/src/chat/ChatThread.ts +132 -0
- package/src/chat/ChatUi.ts +320 -0
- package/src/chat/index.ts +72 -0
- package/src/chat/internal/retries.ts +7 -0
- package/src/cli/CliOutput.ts +4 -5
- package/src/cli/Command.ts +20 -2
- package/src/cli/Prompt.ts +15 -9
- package/src/cli/internal/config.ts +8 -8
- package/src/cluster/ClusterCron.ts +33 -10
- package/src/cluster/ClusterWorkflowEngine.ts +214 -119
- package/src/cluster/MessageStorage.ts +51 -2
- package/src/cluster/Sharding.ts +17 -3
- package/src/cluster/ShardingConfig.ts +3 -0
- package/src/cluster/SqlMessageStorage.ts +97 -54
- package/src/cluster/SqlRunnerStorage.ts +21 -8
- package/src/cluster/internal/entityActivation.ts +6 -0
- package/src/cluster/internal/entityManager.ts +27 -14
- package/src/cluster/internal/entityReaper.ts +1 -1
- package/src/crypto/Kdf.ts +2 -1
- package/src/crypto/Password.ts +258 -0
- package/src/crypto/index.ts +6 -0
- package/src/encoding/Base64.ts +84 -1
- package/src/encoding/Base64Url.ts +7 -1
- package/src/encoding/Csv.ts +47 -20
- package/src/encoding/Hex.ts +5 -0
- package/src/encoding/SchemaBinary.ts +13 -79
- package/src/encoding/Sse.ts +7 -5
- package/src/encoding/Xml.ts +485 -68
- package/src/eventlog/EventJournal.ts +3 -8
- package/src/eventlog/SqlEventLogServerEncrypted.ts +9 -9
- package/src/http/FetchHttpClient.ts +8 -5
- package/src/http/FindMyWay/internal/router.ts +181 -129
- package/src/http/FindMyWay.ts +106 -0
- package/src/http/Headers.ts +309 -3
- package/src/http/HttpClient.ts +21 -8
- package/src/http/HttpClientError.ts +42 -9
- package/src/http/HttpClientRequest.ts +51 -0
- package/src/http/HttpClientResponse.ts +156 -0
- package/src/http/HttpMiddleware.ts +23 -10
- package/src/http/HttpRouter.ts +84 -20
- package/src/http/HttpServerResponse.ts +159 -61
- package/src/http/Mime.ts +3 -2
- package/src/http/Multipart.ts +0 -5
- package/src/http/MultipartParser/internal/contentType.ts +1 -1
- package/src/http/internal/clientPath.ts +39 -0
- package/src/http/internal/compression.ts +2 -2
- package/src/{http-api → http}/internal/mediaType.ts +4 -0
- package/src/http/internal/redactedPath.ts +148 -0
- package/src/http/internal/requestState.ts +2 -0
- package/src/http/internal/tracing.ts +6 -3
- package/src/http-api/HttpApi.ts +50 -6
- package/src/http-api/HttpApiBuilder.ts +11 -3
- package/src/http-api/HttpApiClient.ts +40 -13
- package/src/http-api/HttpApiEndpoint.ts +1 -1
- package/src/http-api/HttpApiScalar.ts +9 -1
- package/src/http-api/HttpApiSchema.ts +1 -1
- package/src/http-api/OpenApi.ts +2 -0
- package/src/http-api/internal/httpApiScalar.ts +5 -1
- package/src/http-api/internal/redactedKeys.ts +40 -0
- package/src/index.ts +6 -0
- package/src/internal/arbitrary/model.ts +3 -9
- package/src/internal/arbitrary/regexp.ts +3 -1
- package/src/internal/arbitrary/runner.ts +28 -14
- package/src/internal/arbitrary/schema.ts +140 -35
- package/src/internal/base64.ts +57 -2
- package/src/internal/codegen.ts +53 -0
- package/src/internal/core.ts +3 -3
- package/src/internal/dateTime.ts +73 -37
- package/src/internal/effect.ts +56 -111
- package/src/internal/equal.ts +37 -17
- package/src/internal/hash.ts +5 -1
- package/src/internal/hashMap.ts +8 -7
- package/src/internal/matcher.ts +36 -114
- package/src/internal/record.ts +19 -4
- package/src/internal/result.ts +1 -1
- package/src/internal/schema/codeExpression.ts +179 -0
- package/src/internal/schema/codeImports.ts +142 -0
- package/src/internal/schema/codeTokens.ts +39 -0
- package/src/internal/schema/passthrough.ts +8 -0
- package/src/internal/schema/schemaCodegen.ts +544 -0
- package/src/internal/schema/schemaCodegenBuiltIns.ts +343 -0
- package/src/internal/schema/toEquivalence.ts +3 -5
- package/src/internal/schema/toJsonSchemaDocument.ts +13 -4
- package/src/internal/trie.ts +46 -60
- package/src/internal/utf8.ts +106 -0
- package/src/internal/version.ts +1 -1
- package/src/jose/JoseError.ts +34 -0
- package/src/jose/Jwks.ts +23 -4
- package/src/jose/internal/compact.ts +14 -5
- package/src/observability/Otlp.ts +29 -0
- package/src/observability/OtlpExporter.ts +209 -76
- package/src/observability/OtlpLogger.ts +29 -5
- package/src/observability/OtlpMetrics.ts +2 -0
- package/src/observability/OtlpTracer.ts +24 -3
- package/src/observability/internal/otlpProtobuf.ts +386 -457
- package/src/persistence/KeyValueStore.ts +17 -14
- package/src/persistence/PersistedQueue.ts +21 -4
- package/src/protobuf/ProtobufDescriptor.ts +503 -0
- package/src/protobuf/ProtobufDescriptorProto.ts +3611 -0
- package/src/protobuf/ProtobufMessage.ts +277 -0
- package/src/protobuf/ProtobufReader.ts +756 -0
- package/src/protobuf/ProtobufWriter.ts +530 -0
- package/src/protobuf/index.ts +36 -0
- package/src/protobuf/internal/binary.ts +1215 -0
- package/src/protobuf/internal/resolve.ts +533 -0
- package/src/protobuf/internal/wireType.ts +9 -0
- package/src/reactivity/AsyncResult.ts +6 -1
- package/src/reactivity/Atom.ts +67 -34
- package/src/reactivity/AtomHttpApi.ts +10 -1
- package/src/reactivity/AtomRegistry.ts +16 -0
- package/src/reactivity/AtomRpc.ts +11 -1
- package/src/rpc/Rpc.ts +31 -0
- package/src/rpc/RpcClient.ts +56 -22
- package/src/rpc/RpcGroup.ts +9 -1
- package/src/rpc/RpcMiddleware.ts +9 -0
- package/src/rpc/RpcSerialization.ts +26 -6
- package/src/rpc/RpcServer.ts +33 -20
- package/src/schema/SchemaCompiler/runtime.ts +2 -3
- package/src/schema/VariantSchema.ts +12 -4
- package/src/socket/Socket.ts +67 -20
- package/src/sql/Migrator.ts +10 -12
- package/src/sql/SqlClient.ts +14 -8
- package/src/sql/SqlModel.ts +4 -0
- package/src/testing/TestConsole.ts +119 -9
- package/src/testing/TestSchema.ts +8 -3
- package/src/workers/SharedMemory.ts +227 -0
- package/src/workers/Transferable.ts +1 -5
- package/src/workers/index.ts +6 -0
- package/src/workflow/Activity.ts +28 -4
- package/src/workflow/Workflow.ts +68 -44
- package/src/workflow/WorkflowEngine.ts +41 -16
- package/src/workflow/internal/retry.ts +12 -0
- package/src/workflow/internal/scope.ts +36 -0
- package/dist/http-api/internal/mediaType.d.ts.map +0 -1
- package/dist/internal/schema/toCodeDocument.d.ts +0 -2
- package/dist/internal/schema/toCodeDocument.d.ts.map +0 -1
- package/dist/internal/schema/toCodeDocument.js +0 -447
- package/dist/internal/schema/toCodeDocument.js.map +0 -1
- package/dist/observability/internal/protobuf.d.ts +0 -2
- package/dist/observability/internal/protobuf.d.ts.map +0 -1
- package/dist/observability/internal/protobuf.js +0 -169
- package/dist/observability/internal/protobuf.js.map +0 -1
- package/src/internal/schema/toCodeDocument.ts +0 -578
- package/src/observability/internal/protobuf.ts +0 -225
- /package/dist/{http-api → http}/internal/mediaType.d.ts +0 -0
package/dist/Effect.d.ts
CHANGED
|
@@ -9,6 +9,25 @@
|
|
|
9
9
|
* creating effects, combining them, handling failures, managing resources, and
|
|
10
10
|
* running effect programs.
|
|
11
11
|
*
|
|
12
|
+
* A fiber runs in either an interruptible or an uninterruptible region.
|
|
13
|
+
* `interruptible`, `uninterruptible`, and `uninterruptibleMask` change the
|
|
14
|
+
* region for the effect they wrap.
|
|
15
|
+
*
|
|
16
|
+
* Interrupting a fiber records a request. In an interruptible region the
|
|
17
|
+
* fiber stops its current work. In an uninterruptible region it continues
|
|
18
|
+
* until it next enters an interruptible region, where the request takes effect.
|
|
19
|
+
*
|
|
20
|
+
* An interrupted fiber skips ordinary continuations and failure handlers in
|
|
21
|
+
* interruptible regions. By default, `onExit` runs cleanup and `Scope.close`
|
|
22
|
+
* runs registered finalizers in an uninterruptible region.
|
|
23
|
+
*
|
|
24
|
+
* Fork and run APIs start fibers in an interruptible region by default,
|
|
25
|
+
* regardless of the caller's region. Concurrent `all` and `forEach` effects
|
|
26
|
+
* inherit the caller's region. Any contender a race or timeout starts is
|
|
27
|
+
* initially interruptible.
|
|
28
|
+
*
|
|
29
|
+
* `Fiber.interrupt` waits for the fiber to finish, including its cleanup.
|
|
30
|
+
*
|
|
12
31
|
* @stability stable
|
|
13
32
|
* @since 2.0.0
|
|
14
33
|
*/
|
|
@@ -39,7 +58,7 @@ import type { Scheduler } from "./Scheduler.ts";
|
|
|
39
58
|
import type { Scope } from "./Scope.ts";
|
|
40
59
|
import type { AnySpan, ParentSpan, Span, SpanLink, SpanOptions, SpanOptionsNoTrace, TraceOptions, Tracer } from "./Tracer.ts";
|
|
41
60
|
import type { TxRef } from "./TxRef.ts";
|
|
42
|
-
import type { Concurrency, Covariant, EqualsWith, ExcludeReason, ExcludeTag, ExtractReason, ExtractTag, NarrowReason, NoInfer, OmitReason, ReasonOf, ReasonTags, Simplify, Tags, unassigned } from "./Types.ts";
|
|
61
|
+
import type { Concurrency, Covariant, EqualsWith, ExcludeReason, ExcludeTag, ExtractReason, ExtractTag, IsUnion, NarrowReason, NoInfer, OmitReason, ReasonOf, ReasonTags, Simplify, Tags, unassigned } from "./Types.ts";
|
|
43
62
|
import type * as Unify from "./Unify.ts";
|
|
44
63
|
/**
|
|
45
64
|
* Type-level identifier for `Effect` values.
|
|
@@ -248,7 +267,7 @@ export declare namespace All {
|
|
|
248
267
|
* @since 2.0.0
|
|
249
268
|
*/
|
|
250
269
|
type ReturnObject<T, Discard extends boolean, Mode extends boolean = false> = [T] extends [
|
|
251
|
-
Record<
|
|
270
|
+
Record<PropertyKey, EffectAny>
|
|
252
271
|
] ? Effect<Discard extends true ? void : {
|
|
253
272
|
-readonly [K in keyof T]: [T[K]] extends [
|
|
254
273
|
Effect<infer _A, infer _E, infer _R>
|
|
@@ -280,11 +299,11 @@ export declare namespace All {
|
|
|
280
299
|
* @category utility types
|
|
281
300
|
* @since 2.0.0
|
|
282
301
|
*/
|
|
283
|
-
type Return<Arg extends Iterable<EffectAny> | Record<
|
|
302
|
+
type Return<Arg extends Iterable<EffectAny> | Record<PropertyKey, EffectAny>, O extends {
|
|
284
303
|
readonly concurrency?: Concurrency | undefined;
|
|
285
304
|
readonly discard?: boolean | undefined;
|
|
286
305
|
readonly mode?: "default" | "result" | undefined;
|
|
287
|
-
}> = [Arg] extends [ReadonlyArray<EffectAny>] ? ReturnTuple<Arg, IsDiscard<O>, IsResult<O>> : [Arg] extends [Iterable<EffectAny>] ? ReturnIterable<Arg, IsDiscard<O>, IsResult<O>> : [Arg] extends [Record<
|
|
306
|
+
}> = [Arg] extends [ReadonlyArray<EffectAny>] ? ReturnTuple<Arg, IsDiscard<O>, IsResult<O>> : [Arg] extends [Iterable<EffectAny>] ? ReturnIterable<Arg, IsDiscard<O>, IsResult<O>> : [Arg] extends [Record<PropertyKey, EffectAny>] ? ReturnObject<Arg, IsDiscard<O>, IsResult<O>> : never;
|
|
288
307
|
type ObjectValues<T> = T extends unknown ? T[keyof T] : never;
|
|
289
308
|
}
|
|
290
309
|
/**
|
|
@@ -302,6 +321,8 @@ export declare namespace All {
|
|
|
302
321
|
* results under the same keys. By default, the combined effect fails on the
|
|
303
322
|
* first failure; with concurrent execution, effects that have already started
|
|
304
323
|
* may be interrupted, while effects not yet started are skipped.
|
|
324
|
+
* Record inputs use own enumerable string and symbol properties.
|
|
325
|
+
* Non-enumerable and inherited properties are ignored.
|
|
305
326
|
*
|
|
306
327
|
* Options:
|
|
307
328
|
*
|
|
@@ -310,6 +331,18 @@ export declare namespace All {
|
|
|
310
331
|
* `Result` in the same output shape. Use `discard: true` to ignore successful
|
|
311
332
|
* values and return `void`.
|
|
312
333
|
*
|
|
334
|
+
* With concurrent execution, a failure requests interruption of other effects
|
|
335
|
+
* that have already started. The returned effect waits for those fibers to finish,
|
|
336
|
+
* including their finalizers. Uninterruptible regions can delay completion.
|
|
337
|
+
* This fail-fast behavior does not apply to `mode: "result"`. Concurrent
|
|
338
|
+
* effects inherit the surrounding region's interruptibility.
|
|
339
|
+
*
|
|
340
|
+
* **Gotchas**
|
|
341
|
+
*
|
|
342
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
343
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
344
|
+
* with `forkDetach` are not awaited.
|
|
345
|
+
*
|
|
313
346
|
* **Example** (Collecting tuple results in order)
|
|
314
347
|
*
|
|
315
348
|
* ```ts import.meta.vitest
|
|
@@ -400,7 +433,7 @@ export declare namespace All {
|
|
|
400
433
|
* @category collecting
|
|
401
434
|
* @since 2.0.0
|
|
402
435
|
*/
|
|
403
|
-
export declare const all: <const Arg extends Iterable<Effect<any, any, any>> | Record<
|
|
436
|
+
export declare const all: <const Arg extends Iterable<Effect<any, any, any>> | Record<PropertyKey, Effect<any, any, any>>, O extends {
|
|
404
437
|
readonly concurrency?: Concurrency | undefined;
|
|
405
438
|
readonly discard?: boolean | undefined;
|
|
406
439
|
readonly mode?: "default" | "result" | undefined;
|
|
@@ -917,8 +950,8 @@ export declare const findFirstFilter: {
|
|
|
917
950
|
* The `forEach` function applies a provided operation to each element in the
|
|
918
951
|
* iterable, producing a new effect that returns an array of results.
|
|
919
952
|
*
|
|
920
|
-
* If any effect fails, the iteration
|
|
921
|
-
*
|
|
953
|
+
* If any effect fails, the iteration short-circuits and propagates the error
|
|
954
|
+
* after cleanup.
|
|
922
955
|
*
|
|
923
956
|
* Concurrency:
|
|
924
957
|
*
|
|
@@ -930,6 +963,17 @@ export declare const findFirstFilter: {
|
|
|
930
963
|
* If the `discard` option is set to `true`, the intermediate results are not
|
|
931
964
|
* collected, and the final result of the operation is `void`.
|
|
932
965
|
*
|
|
966
|
+
* With concurrent execution, a failure requests interruption of other effects
|
|
967
|
+
* that have already started. The returned effect waits for those fibers to finish,
|
|
968
|
+
* including their finalizers. Uninterruptible regions can delay completion.
|
|
969
|
+
* Concurrent effects inherit the surrounding region's interruptibility.
|
|
970
|
+
*
|
|
971
|
+
* **Gotchas**
|
|
972
|
+
*
|
|
973
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
974
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
975
|
+
* with `forkDetach` are not awaited.
|
|
976
|
+
*
|
|
933
977
|
* **Example** (Mapping over an iterable with effects)
|
|
934
978
|
*
|
|
935
979
|
* ```ts import.meta.vitest
|
|
@@ -983,8 +1027,8 @@ export declare const forEach: {
|
|
|
983
1027
|
* The `forEach` function applies a provided operation to each element in the
|
|
984
1028
|
* iterable, producing a new effect that returns an array of results.
|
|
985
1029
|
*
|
|
986
|
-
* If any effect fails, the iteration
|
|
987
|
-
*
|
|
1030
|
+
* If any effect fails, the iteration short-circuits and propagates the error
|
|
1031
|
+
* after cleanup.
|
|
988
1032
|
*
|
|
989
1033
|
* Concurrency:
|
|
990
1034
|
*
|
|
@@ -996,6 +1040,17 @@ export declare const forEach: {
|
|
|
996
1040
|
* If the `discard` option is set to `true`, the intermediate results are not
|
|
997
1041
|
* collected, and the final result of the operation is `void`.
|
|
998
1042
|
*
|
|
1043
|
+
* With concurrent execution, a failure requests interruption of other effects
|
|
1044
|
+
* that have already started. The returned effect waits for those fibers to finish,
|
|
1045
|
+
* including their finalizers. Uninterruptible regions can delay completion.
|
|
1046
|
+
* Concurrent effects inherit the surrounding region's interruptibility.
|
|
1047
|
+
*
|
|
1048
|
+
* **Gotchas**
|
|
1049
|
+
*
|
|
1050
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
1051
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
1052
|
+
* with `forkDetach` are not awaited.
|
|
1053
|
+
*
|
|
999
1054
|
* **Example** (Mapping over an iterable with effects)
|
|
1000
1055
|
*
|
|
1001
1056
|
* ```ts import.meta.vitest
|
|
@@ -1052,8 +1107,8 @@ export declare const forEach: {
|
|
|
1052
1107
|
* The `forEach` function applies a provided operation to each element in the
|
|
1053
1108
|
* iterable, producing a new effect that returns an array of results.
|
|
1054
1109
|
*
|
|
1055
|
-
* If any effect fails, the iteration
|
|
1056
|
-
*
|
|
1110
|
+
* If any effect fails, the iteration short-circuits and propagates the error
|
|
1111
|
+
* after cleanup.
|
|
1057
1112
|
*
|
|
1058
1113
|
* Concurrency:
|
|
1059
1114
|
*
|
|
@@ -1065,6 +1120,17 @@ export declare const forEach: {
|
|
|
1065
1120
|
* If the `discard` option is set to `true`, the intermediate results are not
|
|
1066
1121
|
* collected, and the final result of the operation is `void`.
|
|
1067
1122
|
*
|
|
1123
|
+
* With concurrent execution, a failure requests interruption of other effects
|
|
1124
|
+
* that have already started. The returned effect waits for those fibers to finish,
|
|
1125
|
+
* including their finalizers. Uninterruptible regions can delay completion.
|
|
1126
|
+
* Concurrent effects inherit the surrounding region's interruptibility.
|
|
1127
|
+
*
|
|
1128
|
+
* **Gotchas**
|
|
1129
|
+
*
|
|
1130
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
1131
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
1132
|
+
* with `forkDetach` are not awaited.
|
|
1133
|
+
*
|
|
1068
1134
|
* **Example** (Mapping over an iterable with effects)
|
|
1069
1135
|
*
|
|
1070
1136
|
* ```ts import.meta.vitest
|
|
@@ -1538,6 +1604,11 @@ export declare const succeedSome: <A>(value: A) => Effect<Option<A>>;
|
|
|
1538
1604
|
* different effects. Any side effects or scoped captures inside the thunk are
|
|
1539
1605
|
* re-executed on each invocation.
|
|
1540
1606
|
*
|
|
1607
|
+
* **Gotchas**
|
|
1608
|
+
*
|
|
1609
|
+
* If the thunk throws, the thrown value is treated as a defect, not as a typed
|
|
1610
|
+
* failure. Use `Effect.try` when a throw should become a typed failure.
|
|
1611
|
+
*
|
|
1541
1612
|
* **Example** (Lazily evaluating side effects)
|
|
1542
1613
|
*
|
|
1543
1614
|
* ```ts import.meta.vitest
|
|
@@ -3618,9 +3689,8 @@ export declare const option: <A, E, R>(self: Effect<A, E, R>) => Effect<Option<A
|
|
|
3618
3689
|
* `exit` wraps an effect's success or failure inside an `Exit` type, allowing
|
|
3619
3690
|
* you to handle both cases explicitly.
|
|
3620
3691
|
*
|
|
3621
|
-
*
|
|
3622
|
-
*
|
|
3623
|
-
* the effect is structured to never fail directly.
|
|
3692
|
+
* If the running fiber is interrupted in an interruptible region, `exit`
|
|
3693
|
+
* does not turn that interruption into an `Exit` value.
|
|
3624
3694
|
*
|
|
3625
3695
|
* **Example** (Capturing completion as Exit)
|
|
3626
3696
|
*
|
|
@@ -3638,6 +3708,7 @@ export declare const option: <A, E, R>(self: Effect<A, E, R>) => Effect<Option<A
|
|
|
3638
3708
|
* Effect.runSync(program2) // => Exit.fail("Something went wrong")
|
|
3639
3709
|
* ```
|
|
3640
3710
|
*
|
|
3711
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
3641
3712
|
* @see {@link option} for a version that uses `Option` instead.
|
|
3642
3713
|
* @see {@link result} for a version that uses `Result` instead.
|
|
3643
3714
|
*
|
|
@@ -4499,7 +4570,7 @@ export declare const catchTag: {
|
|
|
4499
4570
|
* @category error handling
|
|
4500
4571
|
* @since 2.0.0
|
|
4501
4572
|
*/
|
|
4502
|
-
<A, E, R, const K extends Tags<E> | Arr.NonEmptyReadonlyArray<Tags<E
|
|
4573
|
+
<A, E = any, R = unknown, const K extends Tags<E> | Arr.NonEmptyReadonlyArray<Tags<E>> = never, R1 = unknown, E1 = unknown, A1 = unknown, A2 = unassigned, E2 = never, R2 = never>(self: Effect<A, E, R>, k: K, f: (e: ExtractTag<E, K extends Arr.NonEmptyReadonlyArray<string> ? K[number] : K>) => Effect<A1, E1, R1>, orElse?: ((e: ExcludeTag<E, K extends Arr.NonEmptyReadonlyArray<string> ? K[number] : K>) => Effect<A2, E2, R2>) | undefined): Effect<A | A1 | Exclude<A2, unassigned>, E1 | E2 | (A2 extends unassigned ? ExcludeTag<E, K extends Arr.NonEmptyReadonlyArray<string> ? K[number] : K> : never), R | R1 | R2>;
|
|
4503
4574
|
};
|
|
4504
4575
|
/**
|
|
4505
4576
|
* Handles multiple errors in a single block of code using their `_tag` field.
|
|
@@ -4879,6 +4950,15 @@ export declare const catchReason: {
|
|
|
4879
4950
|
*/
|
|
4880
4951
|
<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>, ExcludeTag<E, K> | E2 | E3 | (A3 extends unassigned ? ExtractTag<E, K> : never), R | R2 | R3>;
|
|
4881
4952
|
};
|
|
4953
|
+
type RequiredCaseKeys<Cases> = {
|
|
4954
|
+
[RK in keyof Cases & string]: {} extends Record<RK, 1> ? never : [Cases] extends [Record<RK, (...args: Array<any>) => any>] ? RK : never;
|
|
4955
|
+
}[keyof Cases & string];
|
|
4956
|
+
type CaseReturn<Cases> = Cases extends unknown ? ReturnType<Extract<Cases[keyof Cases], (...args: Array<any>) => any>> : never;
|
|
4957
|
+
type UnhandledParent<E, K extends string, Handled extends string> = {} extends Record<K, 1> ? ExtractTag<E, K> : IsUnion<K> extends true ? ExtractTag<E, K> : ExtractTag<E, K> extends infer P ? P extends {
|
|
4958
|
+
readonly reason: {
|
|
4959
|
+
readonly _tag: string;
|
|
4960
|
+
};
|
|
4961
|
+
} ? [ExcludeReason<P, Handled>] extends [never] ? never : P : P : never;
|
|
4882
4962
|
/**
|
|
4883
4963
|
* Catches multiple reasons within a tagged error using an object of handlers.
|
|
4884
4964
|
*
|
|
@@ -4888,6 +4968,8 @@ export declare const catchReason: {
|
|
|
4888
4968
|
* is converted to a defect, preserving reason order and interrupts. An
|
|
4889
4969
|
* interruption alongside a typed error does not prevent recovery.
|
|
4890
4970
|
*
|
|
4971
|
+
* Only own enumerable properties of `cases` are matched; inherited properties are ignored.
|
|
4972
|
+
*
|
|
4891
4973
|
* **Example** (Handling multiple error reasons)
|
|
4892
4974
|
*
|
|
4893
4975
|
* ```ts import.meta.vitest
|
|
@@ -4935,6 +5017,8 @@ export declare const catchReasons: {
|
|
|
4935
5017
|
* is converted to a defect, preserving reason order and interrupts. An
|
|
4936
5018
|
* interruption alongside a typed error does not prevent recovery.
|
|
4937
5019
|
*
|
|
5020
|
+
* Only own enumerable properties of `cases` are matched; inherited properties are ignored.
|
|
5021
|
+
*
|
|
4938
5022
|
* **Example** (Handling multiple error reasons)
|
|
4939
5023
|
*
|
|
4940
5024
|
* ```ts import.meta.vitest
|
|
@@ -4974,13 +5058,7 @@ export declare const catchReasons: {
|
|
|
4974
5058
|
*/
|
|
4975
5059
|
<K extends Tags<E>, E, Cases extends {
|
|
4976
5060
|
[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>;
|
|
4977
|
-
}, A2 =
|
|
4978
|
-
[RK in keyof Cases]: Cases[RK] extends (...args: Array<any>) => Effect<infer A, any, any> ? A : never;
|
|
4979
|
-
}[keyof Cases], ExcludeTag<E, K> | E2 | (A2 extends unassigned ? ExtractTag<E, K> : never) | {
|
|
4980
|
-
[RK in keyof Cases]: Cases[RK] extends (...args: Array<any>) => Effect<any, infer E, any> ? E : never;
|
|
4981
|
-
}[keyof Cases], R | R2 | {
|
|
4982
|
-
[RK in keyof Cases]: Cases[RK] extends (...args: Array<any>) => Effect<any, any, infer R> ? R : never;
|
|
4983
|
-
}[keyof Cases]>;
|
|
5061
|
+
}, A2 = never, E2 = never, R2 = never, Ret extends Effect<any, any, any> = Effect<A2, E2, R2>>(errorTag: K, cases: Cases, orElse: (reason: ExcludeReason<ExtractTag<NoInfer<E>, K>, RequiredCaseKeys<Cases>>, error: OmitReason<ExtractTag<NoInfer<E>, K>, RequiredCaseKeys<Cases>>) => Ret): <A, R>(self: Effect<A, E, R>) => Effect<A | Success<Ret | CaseReturn<Cases>>, ExcludeTag<E, K> | UnhandledParent<E, K, string> | Error<Ret | CaseReturn<Cases>>, R | Services<Ret | CaseReturn<Cases>>>;
|
|
4984
5062
|
/**
|
|
4985
5063
|
* Catches multiple reasons within a tagged error using an object of handlers.
|
|
4986
5064
|
*
|
|
@@ -4990,6 +5068,59 @@ export declare const catchReasons: {
|
|
|
4990
5068
|
* is converted to a defect, preserving reason order and interrupts. An
|
|
4991
5069
|
* interruption alongside a typed error does not prevent recovery.
|
|
4992
5070
|
*
|
|
5071
|
+
* Only own enumerable properties of `cases` are matched; inherited properties are ignored.
|
|
5072
|
+
*
|
|
5073
|
+
* **Example** (Handling multiple error reasons)
|
|
5074
|
+
*
|
|
5075
|
+
* ```ts import.meta.vitest
|
|
5076
|
+
* import { Data, Effect } from "effect"
|
|
5077
|
+
*
|
|
5078
|
+
* class RateLimitError extends Data.TaggedError("RateLimitError")<{
|
|
5079
|
+
* retryAfter: number
|
|
5080
|
+
* }> {}
|
|
5081
|
+
*
|
|
5082
|
+
* class QuotaExceededError extends Data.TaggedError("QuotaExceededError")<{
|
|
5083
|
+
* limit: number
|
|
5084
|
+
* }> {}
|
|
5085
|
+
*
|
|
5086
|
+
* class AiError extends Data.TaggedError("AiError")<{
|
|
5087
|
+
* reason: RateLimitError | QuotaExceededError
|
|
5088
|
+
* }> {}
|
|
5089
|
+
*
|
|
5090
|
+
* const program: Effect.Effect<string, AiError> = Effect.fail(
|
|
5091
|
+
* new AiError({ reason: new QuotaExceededError({ limit: 100 }) })
|
|
5092
|
+
* )
|
|
5093
|
+
*
|
|
5094
|
+
* const handled = program.pipe(
|
|
5095
|
+
* Effect.catchReasons("AiError", {
|
|
5096
|
+
* RateLimitError: (reason) =>
|
|
5097
|
+
* Effect.succeed(`Retry after ${reason.retryAfter}s`),
|
|
5098
|
+
* QuotaExceededError: (reason) =>
|
|
5099
|
+
* Effect.succeed(`Quota exceeded: ${reason.limit}`)
|
|
5100
|
+
* })
|
|
5101
|
+
* )
|
|
5102
|
+
*
|
|
5103
|
+
* Effect.runSync(handled) // => "Quota exceeded: 100"
|
|
5104
|
+
* ```
|
|
5105
|
+
*
|
|
5106
|
+
* @stability stable
|
|
5107
|
+
* @category error handling
|
|
5108
|
+
* @since 4.0.0
|
|
5109
|
+
*/
|
|
5110
|
+
<K extends Tags<E>, E, Cases extends {
|
|
5111
|
+
[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>;
|
|
5112
|
+
}, A2 = never, E2 = never, R2 = never, Ret extends Effect<any, any, any> = Effect<A2, E2, R2>>(errorTag: K, cases: Cases, orElse?: ((reason: ExcludeReason<ExtractTag<NoInfer<E>, K>, RequiredCaseKeys<Cases>>, error: OmitReason<ExtractTag<NoInfer<E>, K>, RequiredCaseKeys<Cases>>) => Ret) | undefined): <A, R>(self: Effect<A, E, R>) => Effect<A | Success<Ret | CaseReturn<Cases>>, ExcludeTag<E, K> | UnhandledParent<E, K, RequiredCaseKeys<Cases>> | Error<Ret | CaseReturn<Cases>>, R | Services<Ret | CaseReturn<Cases>>>;
|
|
5113
|
+
/**
|
|
5114
|
+
* Catches multiple reasons within a tagged error using an object of handlers.
|
|
5115
|
+
*
|
|
5116
|
+
* **Gotchas**
|
|
5117
|
+
*
|
|
5118
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
5119
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
5120
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
5121
|
+
*
|
|
5122
|
+
* Only own enumerable properties of `cases` are matched; inherited properties are ignored.
|
|
5123
|
+
*
|
|
4993
5124
|
* **Example** (Handling multiple error reasons)
|
|
4994
5125
|
*
|
|
4995
5126
|
* ```ts import.meta.vitest
|
|
@@ -5029,13 +5160,58 @@ export declare const catchReasons: {
|
|
|
5029
5160
|
*/
|
|
5030
5161
|
<A, E, R, K extends Tags<E>, Cases extends {
|
|
5031
5162
|
[RK in ReasonTags<ExtractTag<E, K>>]+?: (reason: ExtractReason<ExtractTag<E, K>, RK>, error: NarrowReason<ExtractTag<E, K>, RK>) => Effect<any, any, any>;
|
|
5032
|
-
}, A2 =
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5163
|
+
}, A2 = never, E2 = never, R2 = never, Ret extends Effect<any, any, any> = Effect<A2, E2, R2>>(self: Effect<A, E, R>, errorTag: K, cases: Cases, orElse: (reason: ExcludeReason<ExtractTag<NoInfer<E>, K>, RequiredCaseKeys<Cases>>, error: OmitReason<ExtractTag<NoInfer<E>, K>, RequiredCaseKeys<Cases>>) => Ret): Effect<A | Success<Ret | CaseReturn<Cases>>, ExcludeTag<E, K> | UnhandledParent<E, K, string> | Error<Ret | CaseReturn<Cases>>, R | Services<Ret | CaseReturn<Cases>>>;
|
|
5164
|
+
/**
|
|
5165
|
+
* Catches multiple reasons within a tagged error using an object of handlers.
|
|
5166
|
+
*
|
|
5167
|
+
* **Gotchas**
|
|
5168
|
+
*
|
|
5169
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
5170
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
5171
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
5172
|
+
*
|
|
5173
|
+
* Only own enumerable properties of `cases` are matched; inherited properties are ignored.
|
|
5174
|
+
*
|
|
5175
|
+
* **Example** (Handling multiple error reasons)
|
|
5176
|
+
*
|
|
5177
|
+
* ```ts import.meta.vitest
|
|
5178
|
+
* import { Data, Effect } from "effect"
|
|
5179
|
+
*
|
|
5180
|
+
* class RateLimitError extends Data.TaggedError("RateLimitError")<{
|
|
5181
|
+
* retryAfter: number
|
|
5182
|
+
* }> {}
|
|
5183
|
+
*
|
|
5184
|
+
* class QuotaExceededError extends Data.TaggedError("QuotaExceededError")<{
|
|
5185
|
+
* limit: number
|
|
5186
|
+
* }> {}
|
|
5187
|
+
*
|
|
5188
|
+
* class AiError extends Data.TaggedError("AiError")<{
|
|
5189
|
+
* reason: RateLimitError | QuotaExceededError
|
|
5190
|
+
* }> {}
|
|
5191
|
+
*
|
|
5192
|
+
* const program: Effect.Effect<string, AiError> = Effect.fail(
|
|
5193
|
+
* new AiError({ reason: new QuotaExceededError({ limit: 100 }) })
|
|
5194
|
+
* )
|
|
5195
|
+
*
|
|
5196
|
+
* const handled = program.pipe(
|
|
5197
|
+
* Effect.catchReasons("AiError", {
|
|
5198
|
+
* RateLimitError: (reason) =>
|
|
5199
|
+
* Effect.succeed(`Retry after ${reason.retryAfter}s`),
|
|
5200
|
+
* QuotaExceededError: (reason) =>
|
|
5201
|
+
* Effect.succeed(`Quota exceeded: ${reason.limit}`)
|
|
5202
|
+
* })
|
|
5203
|
+
* )
|
|
5204
|
+
*
|
|
5205
|
+
* Effect.runSync(handled) // => "Quota exceeded: 100"
|
|
5206
|
+
* ```
|
|
5207
|
+
*
|
|
5208
|
+
* @stability stable
|
|
5209
|
+
* @category error handling
|
|
5210
|
+
* @since 4.0.0
|
|
5211
|
+
*/
|
|
5212
|
+
<A, E, R, K extends Tags<E>, Cases extends {
|
|
5213
|
+
[RK in ReasonTags<ExtractTag<E, K>>]+?: (reason: ExtractReason<ExtractTag<E, K>, RK>, error: NarrowReason<ExtractTag<E, K>, RK>) => Effect<any, any, any>;
|
|
5214
|
+
}, A2 = never, E2 = never, R2 = never, Ret extends Effect<any, any, any> = Effect<A2, E2, R2>>(self: Effect<A, E, R>, errorTag: K, cases: Cases, orElse?: ((reason: ExcludeReason<ExtractTag<NoInfer<E>, K>, RequiredCaseKeys<Cases>>, error: OmitReason<ExtractTag<NoInfer<E>, K>, RequiredCaseKeys<Cases>>) => Ret) | undefined): Effect<A | Success<Ret | CaseReturn<Cases>>, ExcludeTag<E, K> | UnhandledParent<E, K, RequiredCaseKeys<Cases>> | Error<Ret | CaseReturn<Cases>>, R | Services<Ret | CaseReturn<Cases>>>;
|
|
5039
5215
|
};
|
|
5040
5216
|
/**
|
|
5041
5217
|
* Type helper that keeps only error tags whose tagged error contains a tagged `reason` field.
|
|
@@ -5171,8 +5347,7 @@ export declare const unwrapReason: {
|
|
|
5171
5347
|
<A, E, R, K extends TagsWithReason<E>>(self: Effect<A, E, R>, errorTag: K): Effect<A, ExcludeTag<E, K> | ReasonOf<ExtractTag<E, K>>, R>;
|
|
5172
5348
|
};
|
|
5173
5349
|
/**
|
|
5174
|
-
*
|
|
5175
|
-
* effect.
|
|
5350
|
+
* Runs a recovery effect with the full cause of failure.
|
|
5176
5351
|
*
|
|
5177
5352
|
* **When to use**
|
|
5178
5353
|
*
|
|
@@ -5182,7 +5357,15 @@ export declare const unwrapReason: {
|
|
|
5182
5357
|
*
|
|
5183
5358
|
* **Details**
|
|
5184
5359
|
*
|
|
5185
|
-
*
|
|
5360
|
+
* The handler can recover from an interruption in the cause, such as one from
|
|
5361
|
+
* `Effect.interrupt` or from joining an interrupted fiber.
|
|
5362
|
+
*
|
|
5363
|
+
* Interruption of the fiber running `catchCause` is different. In an
|
|
5364
|
+
* interruptible region, the handler is skipped and the fiber runs its cleanup
|
|
5365
|
+
* before exiting. A handler in an uninterruptible region can handle an
|
|
5366
|
+
* interruption delivered in an inner interruptible region. A pending request
|
|
5367
|
+
* alone neither invokes that handler nor adds an interruption to an unrelated
|
|
5368
|
+
* failure while the fiber remains uninterruptible.
|
|
5186
5369
|
*
|
|
5187
5370
|
* Defects are unexpected errors that typically shouldn't be recovered from, as
|
|
5188
5371
|
* they often indicate serious issues. However, in some cases, such as
|
|
@@ -5217,8 +5400,7 @@ export declare const unwrapReason: {
|
|
|
5217
5400
|
*/
|
|
5218
5401
|
export declare const catchCause: {
|
|
5219
5402
|
/**
|
|
5220
|
-
*
|
|
5221
|
-
* effect.
|
|
5403
|
+
* Runs a recovery effect with the full cause of failure.
|
|
5222
5404
|
*
|
|
5223
5405
|
* **When to use**
|
|
5224
5406
|
*
|
|
@@ -5228,7 +5410,15 @@ export declare const catchCause: {
|
|
|
5228
5410
|
*
|
|
5229
5411
|
* **Details**
|
|
5230
5412
|
*
|
|
5231
|
-
*
|
|
5413
|
+
* The handler can recover from an interruption in the cause, such as one from
|
|
5414
|
+
* `Effect.interrupt` or from joining an interrupted fiber.
|
|
5415
|
+
*
|
|
5416
|
+
* Interruption of the fiber running `catchCause` is different. In an
|
|
5417
|
+
* interruptible region, the handler is skipped and the fiber runs its cleanup
|
|
5418
|
+
* before exiting. A handler in an uninterruptible region can handle an
|
|
5419
|
+
* interruption delivered in an inner interruptible region. A pending request
|
|
5420
|
+
* alone neither invokes that handler nor adds an interruption to an unrelated
|
|
5421
|
+
* failure while the fiber remains uninterruptible.
|
|
5232
5422
|
*
|
|
5233
5423
|
* Defects are unexpected errors that typically shouldn't be recovered from, as
|
|
5234
5424
|
* they often indicate serious issues. However, in some cases, such as
|
|
@@ -5263,8 +5453,7 @@ export declare const catchCause: {
|
|
|
5263
5453
|
*/
|
|
5264
5454
|
<E, A2, E2, R2>(f: (cause: Cause.Cause<E>) => Effect<A2, E2, R2>): <A, R>(self: Effect<A, E, R>) => Effect<A2 | A, E2, R2 | R>;
|
|
5265
5455
|
/**
|
|
5266
|
-
*
|
|
5267
|
-
* effect.
|
|
5456
|
+
* Runs a recovery effect with the full cause of failure.
|
|
5268
5457
|
*
|
|
5269
5458
|
* **When to use**
|
|
5270
5459
|
*
|
|
@@ -5274,7 +5463,15 @@ export declare const catchCause: {
|
|
|
5274
5463
|
*
|
|
5275
5464
|
* **Details**
|
|
5276
5465
|
*
|
|
5277
|
-
*
|
|
5466
|
+
* The handler can recover from an interruption in the cause, such as one from
|
|
5467
|
+
* `Effect.interrupt` or from joining an interrupted fiber.
|
|
5468
|
+
*
|
|
5469
|
+
* Interruption of the fiber running `catchCause` is different. In an
|
|
5470
|
+
* interruptible region, the handler is skipped and the fiber runs its cleanup
|
|
5471
|
+
* before exiting. A handler in an uninterruptible region can handle an
|
|
5472
|
+
* interruption delivered in an inner interruptible region. A pending request
|
|
5473
|
+
* alone neither invokes that handler nor adds an interruption to an unrelated
|
|
5474
|
+
* failure while the fiber remains uninterruptible.
|
|
5278
5475
|
*
|
|
5279
5476
|
* Defects are unexpected errors that typically shouldn't be recovered from, as
|
|
5280
5477
|
* they often indicate serious issues. However, in some cases, such as
|
|
@@ -5870,6 +6067,9 @@ export declare const catchNoSuchElement: <A, E, R>(self: Effect<A, E, R>) => Eff
|
|
|
5870
6067
|
* that match a specific predicate. This is useful when you want to handle
|
|
5871
6068
|
* only certain types of errors while letting others propagate.
|
|
5872
6069
|
*
|
|
6070
|
+
* The failure handler is skipped if the running fiber is interrupted in an
|
|
6071
|
+
* interruptible region.
|
|
6072
|
+
*
|
|
5873
6073
|
* **Example** (Recovering from selected causes)
|
|
5874
6074
|
*
|
|
5875
6075
|
* ```ts import.meta.vitest
|
|
@@ -5915,6 +6115,9 @@ export declare const catchCauseIf: {
|
|
|
5915
6115
|
* that match a specific predicate. This is useful when you want to handle
|
|
5916
6116
|
* only certain types of errors while letting others propagate.
|
|
5917
6117
|
*
|
|
6118
|
+
* The failure handler is skipped if the running fiber is interrupted in an
|
|
6119
|
+
* interruptible region.
|
|
6120
|
+
*
|
|
5918
6121
|
* **Example** (Recovering from selected causes)
|
|
5919
6122
|
*
|
|
5920
6123
|
* ```ts import.meta.vitest
|
|
@@ -5960,6 +6163,9 @@ export declare const catchCauseIf: {
|
|
|
5960
6163
|
* that match a specific predicate. This is useful when you want to handle
|
|
5961
6164
|
* only certain types of errors while letting others propagate.
|
|
5962
6165
|
*
|
|
6166
|
+
* The failure handler is skipped if the running fiber is interrupted in an
|
|
6167
|
+
* interruptible region.
|
|
6168
|
+
*
|
|
5963
6169
|
* **Example** (Recovering from selected causes)
|
|
5964
6170
|
*
|
|
5965
6171
|
* ```ts import.meta.vitest
|
|
@@ -6008,6 +6214,9 @@ export declare const catchCauseIf: {
|
|
|
6008
6214
|
* receives the selected value and the original cause. When it fails, the effect
|
|
6009
6215
|
* re-fails with the residual cause returned by the filter.
|
|
6010
6216
|
*
|
|
6217
|
+
* The failure handler is skipped if the running fiber is interrupted in an
|
|
6218
|
+
* interruptible region.
|
|
6219
|
+
*
|
|
6011
6220
|
* @see {@link catchCauseIf} for predicate-based cause selection
|
|
6012
6221
|
* @see {@link catchFilter} for filtering typed error values instead of full causes
|
|
6013
6222
|
* @see {@link catchCause} for recovering from every cause without filtering
|
|
@@ -6032,6 +6241,9 @@ export declare const catchCauseFilter: {
|
|
|
6032
6241
|
* receives the selected value and the original cause. When it fails, the effect
|
|
6033
6242
|
* re-fails with the residual cause returned by the filter.
|
|
6034
6243
|
*
|
|
6244
|
+
* The failure handler is skipped if the running fiber is interrupted in an
|
|
6245
|
+
* interruptible region.
|
|
6246
|
+
*
|
|
6035
6247
|
* @see {@link catchCauseIf} for predicate-based cause selection
|
|
6036
6248
|
* @see {@link catchFilter} for filtering typed error values instead of full causes
|
|
6037
6249
|
* @see {@link catchCause} for recovering from every cause without filtering
|
|
@@ -6056,6 +6268,9 @@ export declare const catchCauseFilter: {
|
|
|
6056
6268
|
* receives the selected value and the original cause. When it fails, the effect
|
|
6057
6269
|
* re-fails with the residual cause returned by the filter.
|
|
6058
6270
|
*
|
|
6271
|
+
* The failure handler is skipped if the running fiber is interrupted in an
|
|
6272
|
+
* interruptible region.
|
|
6273
|
+
*
|
|
6059
6274
|
* @see {@link catchCauseIf} for predicate-based cause selection
|
|
6060
6275
|
* @see {@link catchFilter} for filtering typed error values instead of full causes
|
|
6061
6276
|
* @see {@link catchCause} for recovering from every cause without filtering
|
|
@@ -6613,6 +6828,9 @@ export declare const tapErrorTag: {
|
|
|
6613
6828
|
* the operation succeeds, the original cause is preserved. If the operation
|
|
6614
6829
|
* fails, its error is also represented in the returned effect.
|
|
6615
6830
|
*
|
|
6831
|
+
* The observer is skipped if the running fiber is interrupted in an
|
|
6832
|
+
* interruptible region.
|
|
6833
|
+
*
|
|
6616
6834
|
* **Example** (Observing full failure causes)
|
|
6617
6835
|
*
|
|
6618
6836
|
* ```ts import.meta.vitest
|
|
@@ -6630,6 +6848,8 @@ export declare const tapErrorTag: {
|
|
|
6630
6848
|
* output // => ["Logging cause: Something went wrong", Exit.fail("Something went wrong")]
|
|
6631
6849
|
* ```
|
|
6632
6850
|
*
|
|
6851
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
6852
|
+
*
|
|
6633
6853
|
* @stability stable
|
|
6634
6854
|
* @category error handling
|
|
6635
6855
|
* @since 4.0.0
|
|
@@ -6650,6 +6870,9 @@ export declare const tapCause: {
|
|
|
6650
6870
|
* the operation succeeds, the original cause is preserved. If the operation
|
|
6651
6871
|
* fails, its error is also represented in the returned effect.
|
|
6652
6872
|
*
|
|
6873
|
+
* The observer is skipped if the running fiber is interrupted in an
|
|
6874
|
+
* interruptible region.
|
|
6875
|
+
*
|
|
6653
6876
|
* **Example** (Observing full failure causes)
|
|
6654
6877
|
*
|
|
6655
6878
|
* ```ts import.meta.vitest
|
|
@@ -6667,6 +6890,8 @@ export declare const tapCause: {
|
|
|
6667
6890
|
* output // => ["Logging cause: Something went wrong", Exit.fail("Something went wrong")]
|
|
6668
6891
|
* ```
|
|
6669
6892
|
*
|
|
6893
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
6894
|
+
*
|
|
6670
6895
|
* @stability stable
|
|
6671
6896
|
* @category error handling
|
|
6672
6897
|
* @since 4.0.0
|
|
@@ -6687,6 +6912,9 @@ export declare const tapCause: {
|
|
|
6687
6912
|
* the operation succeeds, the original cause is preserved. If the operation
|
|
6688
6913
|
* fails, its error is also represented in the returned effect.
|
|
6689
6914
|
*
|
|
6915
|
+
* The observer is skipped if the running fiber is interrupted in an
|
|
6916
|
+
* interruptible region.
|
|
6917
|
+
*
|
|
6690
6918
|
* **Example** (Observing full failure causes)
|
|
6691
6919
|
*
|
|
6692
6920
|
* ```ts import.meta.vitest
|
|
@@ -6704,6 +6932,8 @@ export declare const tapCause: {
|
|
|
6704
6932
|
* output // => ["Logging cause: Something went wrong", Exit.fail("Something went wrong")]
|
|
6705
6933
|
* ```
|
|
6706
6934
|
*
|
|
6935
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
6936
|
+
*
|
|
6707
6937
|
* @stability stable
|
|
6708
6938
|
* @category error handling
|
|
6709
6939
|
* @since 4.0.0
|
|
@@ -6719,6 +6949,9 @@ export declare const tapCause: {
|
|
|
6719
6949
|
* the cause matches a specific predicate. This is useful for conditional logging,
|
|
6720
6950
|
* monitoring, or other side effects based on the type of failure.
|
|
6721
6951
|
*
|
|
6952
|
+
* The observer is skipped if the running fiber is interrupted in an
|
|
6953
|
+
* interruptible region.
|
|
6954
|
+
*
|
|
6722
6955
|
* **Example** (Observing selected failure causes)
|
|
6723
6956
|
*
|
|
6724
6957
|
* ```ts import.meta.vitest
|
|
@@ -6738,6 +6971,8 @@ export declare const tapCause: {
|
|
|
6738
6971
|
* output // => ["Logging failure cause: Network timeout", Exit.fail("Network timeout")]
|
|
6739
6972
|
* ```
|
|
6740
6973
|
*
|
|
6974
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
6975
|
+
*
|
|
6741
6976
|
* @stability stable
|
|
6742
6977
|
* @category error handling
|
|
6743
6978
|
* @since 4.0.0
|
|
@@ -6752,6 +6987,9 @@ export declare const tapCauseIf: {
|
|
|
6752
6987
|
* the cause matches a specific predicate. This is useful for conditional logging,
|
|
6753
6988
|
* monitoring, or other side effects based on the type of failure.
|
|
6754
6989
|
*
|
|
6990
|
+
* The observer is skipped if the running fiber is interrupted in an
|
|
6991
|
+
* interruptible region.
|
|
6992
|
+
*
|
|
6755
6993
|
* **Example** (Observing selected failure causes)
|
|
6756
6994
|
*
|
|
6757
6995
|
* ```ts import.meta.vitest
|
|
@@ -6771,6 +7009,8 @@ export declare const tapCauseIf: {
|
|
|
6771
7009
|
* output // => ["Logging failure cause: Network timeout", Exit.fail("Network timeout")]
|
|
6772
7010
|
* ```
|
|
6773
7011
|
*
|
|
7012
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
7013
|
+
*
|
|
6774
7014
|
* @stability stable
|
|
6775
7015
|
* @category error handling
|
|
6776
7016
|
* @since 4.0.0
|
|
@@ -6785,6 +7025,9 @@ export declare const tapCauseIf: {
|
|
|
6785
7025
|
* the cause matches a specific predicate. This is useful for conditional logging,
|
|
6786
7026
|
* monitoring, or other side effects based on the type of failure.
|
|
6787
7027
|
*
|
|
7028
|
+
* The observer is skipped if the running fiber is interrupted in an
|
|
7029
|
+
* interruptible region.
|
|
7030
|
+
*
|
|
6788
7031
|
* **Example** (Observing selected failure causes)
|
|
6789
7032
|
*
|
|
6790
7033
|
* ```ts import.meta.vitest
|
|
@@ -6804,6 +7047,8 @@ export declare const tapCauseIf: {
|
|
|
6804
7047
|
* output // => ["Logging failure cause: Network timeout", Exit.fail("Network timeout")]
|
|
6805
7048
|
* ```
|
|
6806
7049
|
*
|
|
7050
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
7051
|
+
*
|
|
6807
7052
|
* @stability stable
|
|
6808
7053
|
* @category error handling
|
|
6809
7054
|
* @since 4.0.0
|
|
@@ -6825,6 +7070,10 @@ export declare const tapCauseIf: {
|
|
|
6825
7070
|
* original cause. A failed filter result skips the side effect and preserves the
|
|
6826
7071
|
* original cause.
|
|
6827
7072
|
*
|
|
7073
|
+
* The observer is skipped if the running fiber is interrupted in an
|
|
7074
|
+
* interruptible region.
|
|
7075
|
+
*
|
|
7076
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
6828
7077
|
* @see {@link tapCauseIf} for selecting causes with a boolean predicate
|
|
6829
7078
|
* @see {@link tapCause} for observing every failure cause
|
|
6830
7079
|
* @see {@link catchCauseFilter} for recovering from selected causes instead of only observing them
|
|
@@ -6849,6 +7098,10 @@ export declare const tapCauseFilter: {
|
|
|
6849
7098
|
* original cause. A failed filter result skips the side effect and preserves the
|
|
6850
7099
|
* original cause.
|
|
6851
7100
|
*
|
|
7101
|
+
* The observer is skipped if the running fiber is interrupted in an
|
|
7102
|
+
* interruptible region.
|
|
7103
|
+
*
|
|
7104
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
6852
7105
|
* @see {@link tapCauseIf} for selecting causes with a boolean predicate
|
|
6853
7106
|
* @see {@link tapCause} for observing every failure cause
|
|
6854
7107
|
* @see {@link catchCauseFilter} for recovering from selected causes instead of only observing them
|
|
@@ -6873,6 +7126,10 @@ export declare const tapCauseFilter: {
|
|
|
6873
7126
|
* original cause. A failed filter result skips the side effect and preserves the
|
|
6874
7127
|
* original cause.
|
|
6875
7128
|
*
|
|
7129
|
+
* The observer is skipped if the running fiber is interrupted in an
|
|
7130
|
+
* interruptible region.
|
|
7131
|
+
*
|
|
7132
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
6876
7133
|
* @see {@link tapCauseIf} for selecting causes with a boolean predicate
|
|
6877
7134
|
* @see {@link tapCause} for observing every failure cause
|
|
6878
7135
|
* @see {@link catchCauseFilter} for recovering from selected causes instead of only observing them
|
|
@@ -7090,6 +7347,8 @@ export declare namespace Retry {
|
|
|
7090
7347
|
* succeeds, the returned effect succeeds with that value. If the policy stops
|
|
7091
7348
|
* while the effect is still failing, the last failure is propagated.
|
|
7092
7349
|
*
|
|
7350
|
+
* Scheduled delays use the context's `Clock`.
|
|
7351
|
+
*
|
|
7093
7352
|
* **Gotchas**
|
|
7094
7353
|
*
|
|
7095
7354
|
* The source effect is always evaluated once before any retry policy is
|
|
@@ -7145,6 +7404,8 @@ export declare const retry: {
|
|
|
7145
7404
|
* succeeds, the returned effect succeeds with that value. If the policy stops
|
|
7146
7405
|
* while the effect is still failing, the last failure is propagated.
|
|
7147
7406
|
*
|
|
7407
|
+
* Scheduled delays use the context's `Clock`.
|
|
7408
|
+
*
|
|
7148
7409
|
* **Gotchas**
|
|
7149
7410
|
*
|
|
7150
7411
|
* The source effect is always evaluated once before any retry policy is
|
|
@@ -7200,6 +7461,8 @@ export declare const retry: {
|
|
|
7200
7461
|
* succeeds, the returned effect succeeds with that value. If the policy stops
|
|
7201
7462
|
* while the effect is still failing, the last failure is propagated.
|
|
7202
7463
|
*
|
|
7464
|
+
* Scheduled delays use the context's `Clock`.
|
|
7465
|
+
*
|
|
7203
7466
|
* **Gotchas**
|
|
7204
7467
|
*
|
|
7205
7468
|
* The source effect is always evaluated once before any retry policy is
|
|
@@ -7255,6 +7518,8 @@ export declare const retry: {
|
|
|
7255
7518
|
* succeeds, the returned effect succeeds with that value. If the policy stops
|
|
7256
7519
|
* while the effect is still failing, the last failure is propagated.
|
|
7257
7520
|
*
|
|
7521
|
+
* Scheduled delays use the context's `Clock`.
|
|
7522
|
+
*
|
|
7258
7523
|
* **Gotchas**
|
|
7259
7524
|
*
|
|
7260
7525
|
* The source effect is always evaluated once before any retry policy is
|
|
@@ -7310,6 +7575,8 @@ export declare const retry: {
|
|
|
7310
7575
|
* succeeds, the returned effect succeeds with that value. If the policy stops
|
|
7311
7576
|
* while the effect is still failing, the last failure is propagated.
|
|
7312
7577
|
*
|
|
7578
|
+
* Scheduled delays use the context's `Clock`.
|
|
7579
|
+
*
|
|
7313
7580
|
* **Gotchas**
|
|
7314
7581
|
*
|
|
7315
7582
|
* The source effect is always evaluated once before any retry policy is
|
|
@@ -7365,6 +7632,8 @@ export declare const retry: {
|
|
|
7365
7632
|
* succeeds, the returned effect succeeds with that value. If the policy stops
|
|
7366
7633
|
* while the effect is still failing, the last failure is propagated.
|
|
7367
7634
|
*
|
|
7635
|
+
* Scheduled delays use the context's `Clock`.
|
|
7636
|
+
*
|
|
7368
7637
|
* **Gotchas**
|
|
7369
7638
|
*
|
|
7370
7639
|
* The source effect is always evaluated once before any retry policy is
|
|
@@ -7420,6 +7689,8 @@ export declare const retry: {
|
|
|
7420
7689
|
* succeeds, the returned effect succeeds with that value. If the policy stops
|
|
7421
7690
|
* while the effect is still failing, the last failure is propagated.
|
|
7422
7691
|
*
|
|
7692
|
+
* Scheduled delays use the context's `Clock`.
|
|
7693
|
+
*
|
|
7423
7694
|
* **Gotchas**
|
|
7424
7695
|
*
|
|
7425
7696
|
* The source effect is always evaluated once before any retry policy is
|
|
@@ -7477,6 +7748,8 @@ export declare const retry: {
|
|
|
7477
7748
|
* If the retries are exhausted and the effect still fails, it runs a fallback
|
|
7478
7749
|
* effect instead.
|
|
7479
7750
|
*
|
|
7751
|
+
* Scheduled delays use the context's `Clock`.
|
|
7752
|
+
*
|
|
7480
7753
|
* **Gotchas**
|
|
7481
7754
|
*
|
|
7482
7755
|
* Defects take precedence over typed errors. A failure whose cause contains a
|
|
@@ -7540,6 +7813,8 @@ export declare const retryOrElse: {
|
|
|
7540
7813
|
* If the retries are exhausted and the effect still fails, it runs a fallback
|
|
7541
7814
|
* effect instead.
|
|
7542
7815
|
*
|
|
7816
|
+
* Scheduled delays use the context's `Clock`.
|
|
7817
|
+
*
|
|
7543
7818
|
* **Gotchas**
|
|
7544
7819
|
*
|
|
7545
7820
|
* Defects take precedence over typed errors. A failure whose cause contains a
|
|
@@ -7603,6 +7878,8 @@ export declare const retryOrElse: {
|
|
|
7603
7878
|
* If the retries are exhausted and the effect still fails, it runs a fallback
|
|
7604
7879
|
* effect instead.
|
|
7605
7880
|
*
|
|
7881
|
+
* Scheduled delays use the context's `Clock`.
|
|
7882
|
+
*
|
|
7606
7883
|
* **Gotchas**
|
|
7607
7884
|
*
|
|
7608
7885
|
* Defects take precedence over typed errors. A failure whose cause contains a
|
|
@@ -7660,6 +7937,9 @@ export declare const retryOrElse: {
|
|
|
7660
7937
|
* failures, defects, and interruptions. Use `Effect.catch(Effect.failCause)` to
|
|
7661
7938
|
* restore the original typed error channel after cause-level handling.
|
|
7662
7939
|
*
|
|
7940
|
+
* Interrupting the running fiber in an interruptible region bypasses the
|
|
7941
|
+
* error channel.
|
|
7942
|
+
*
|
|
7663
7943
|
* **Example** (Exposing failures as causes)
|
|
7664
7944
|
*
|
|
7665
7945
|
* ```ts import.meta.vitest
|
|
@@ -7676,6 +7956,8 @@ export declare const retryOrElse: {
|
|
|
7676
7956
|
* Effect.runSync(program) // => "Caught cause: Something went wrong"
|
|
7677
7957
|
* ```
|
|
7678
7958
|
*
|
|
7959
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
7960
|
+
*
|
|
7679
7961
|
* @stability stable
|
|
7680
7962
|
* @category error handling
|
|
7681
7963
|
* @since 2.0.0
|
|
@@ -8238,13 +8520,24 @@ export declare const firstSuccessOf: <Eff extends Effect<any, any, any>>(effects
|
|
|
8238
8520
|
*
|
|
8239
8521
|
* The `timeout` function allows you to specify a time limit for an
|
|
8240
8522
|
* effect's execution. If the effect does not complete within the given time, a
|
|
8241
|
-
* `TimeoutError` is raised
|
|
8242
|
-
*
|
|
8243
|
-
*
|
|
8523
|
+
* `TimeoutError` is raised after the source fiber finishes its cleanup.
|
|
8524
|
+
*
|
|
8525
|
+
* Any contender the timeout starts (source or timer) is initially
|
|
8526
|
+
* interruptible, even when the timeout runs in an uninterruptible region. The
|
|
8527
|
+
* timer uses the context's `Clock`.
|
|
8244
8528
|
*
|
|
8245
8529
|
* **Gotchas**
|
|
8246
8530
|
*
|
|
8247
|
-
* If the timeout wins, the source
|
|
8531
|
+
* If the timeout wins, the source is interrupted and the returned effect waits
|
|
8532
|
+
* for the source fiber to finish, including its finalizers. The duration
|
|
8533
|
+
* determines when interruption is requested, not a deadline for completion.
|
|
8534
|
+
* If the source enters its own uninterruptible region, completion can be
|
|
8535
|
+
* delayed until that region finishes. The eventual source result is
|
|
8536
|
+
* discarded and the timeout failure is still returned.
|
|
8537
|
+
*
|
|
8538
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
8539
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
8540
|
+
* with `forkDetach` are not awaited.
|
|
8248
8541
|
*
|
|
8249
8542
|
* **Example** (Failing when work takes too long)
|
|
8250
8543
|
*
|
|
@@ -8277,13 +8570,24 @@ export declare const timeout: {
|
|
|
8277
8570
|
*
|
|
8278
8571
|
* The `timeout` function allows you to specify a time limit for an
|
|
8279
8572
|
* effect's execution. If the effect does not complete within the given time, a
|
|
8280
|
-
* `TimeoutError` is raised
|
|
8281
|
-
*
|
|
8282
|
-
*
|
|
8573
|
+
* `TimeoutError` is raised after the source fiber finishes its cleanup.
|
|
8574
|
+
*
|
|
8575
|
+
* Any contender the timeout starts (source or timer) is initially
|
|
8576
|
+
* interruptible, even when the timeout runs in an uninterruptible region. The
|
|
8577
|
+
* timer uses the context's `Clock`.
|
|
8283
8578
|
*
|
|
8284
8579
|
* **Gotchas**
|
|
8285
8580
|
*
|
|
8286
|
-
* If the timeout wins, the source
|
|
8581
|
+
* If the timeout wins, the source is interrupted and the returned effect waits
|
|
8582
|
+
* for the source fiber to finish, including its finalizers. The duration
|
|
8583
|
+
* determines when interruption is requested, not a deadline for completion.
|
|
8584
|
+
* If the source enters its own uninterruptible region, completion can be
|
|
8585
|
+
* delayed until that region finishes. The eventual source result is
|
|
8586
|
+
* discarded and the timeout failure is still returned.
|
|
8587
|
+
*
|
|
8588
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
8589
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
8590
|
+
* with `forkDetach` are not awaited.
|
|
8287
8591
|
*
|
|
8288
8592
|
* **Example** (Failing when work takes too long)
|
|
8289
8593
|
*
|
|
@@ -8316,13 +8620,24 @@ export declare const timeout: {
|
|
|
8316
8620
|
*
|
|
8317
8621
|
* The `timeout` function allows you to specify a time limit for an
|
|
8318
8622
|
* effect's execution. If the effect does not complete within the given time, a
|
|
8319
|
-
* `TimeoutError` is raised
|
|
8320
|
-
*
|
|
8321
|
-
*
|
|
8623
|
+
* `TimeoutError` is raised after the source fiber finishes its cleanup.
|
|
8624
|
+
*
|
|
8625
|
+
* Any contender the timeout starts (source or timer) is initially
|
|
8626
|
+
* interruptible, even when the timeout runs in an uninterruptible region. The
|
|
8627
|
+
* timer uses the context's `Clock`.
|
|
8322
8628
|
*
|
|
8323
8629
|
* **Gotchas**
|
|
8324
8630
|
*
|
|
8325
|
-
* If the timeout wins, the source
|
|
8631
|
+
* If the timeout wins, the source is interrupted and the returned effect waits
|
|
8632
|
+
* for the source fiber to finish, including its finalizers. The duration
|
|
8633
|
+
* determines when interruption is requested, not a deadline for completion.
|
|
8634
|
+
* If the source enters its own uninterruptible region, completion can be
|
|
8635
|
+
* delayed until that region finishes. The eventual source result is
|
|
8636
|
+
* discarded and the timeout failure is still returned.
|
|
8637
|
+
*
|
|
8638
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
8639
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
8640
|
+
* with `forkDetach` are not awaited.
|
|
8326
8641
|
*
|
|
8327
8642
|
* **Example** (Failing when work takes too long)
|
|
8328
8643
|
*
|
|
@@ -8358,6 +8673,23 @@ export declare const timeout: {
|
|
|
8358
8673
|
* interrupted and the returned effect succeeds with `Option.none`. If the
|
|
8359
8674
|
* source effect fails before the timeout, that failure is preserved.
|
|
8360
8675
|
*
|
|
8676
|
+
* Any contender the timeout starts (source or timer) is initially
|
|
8677
|
+
* interruptible, even when the timeout runs in an uninterruptible region. The
|
|
8678
|
+
* timer uses the context's `Clock`.
|
|
8679
|
+
*
|
|
8680
|
+
* **Gotchas**
|
|
8681
|
+
*
|
|
8682
|
+
* If the timeout wins, the source is interrupted and the returned effect waits
|
|
8683
|
+
* for the source fiber to finish, including its finalizers. The duration
|
|
8684
|
+
* determines when interruption is requested, not a deadline for completion.
|
|
8685
|
+
* If the source enters its own uninterruptible region, completion can be
|
|
8686
|
+
* delayed until that region finishes. The eventual source result is
|
|
8687
|
+
* discarded and the timeout still produces `Option.none`.
|
|
8688
|
+
*
|
|
8689
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
8690
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
8691
|
+
* with `forkDetach` are not awaited.
|
|
8692
|
+
*
|
|
8361
8693
|
* **Example** (Returning None on timeout)
|
|
8362
8694
|
*
|
|
8363
8695
|
* ```ts import.meta.vitest
|
|
@@ -8390,6 +8722,23 @@ export declare const timeoutOption: {
|
|
|
8390
8722
|
* interrupted and the returned effect succeeds with `Option.none`. If the
|
|
8391
8723
|
* source effect fails before the timeout, that failure is preserved.
|
|
8392
8724
|
*
|
|
8725
|
+
* Any contender the timeout starts (source or timer) is initially
|
|
8726
|
+
* interruptible, even when the timeout runs in an uninterruptible region. The
|
|
8727
|
+
* timer uses the context's `Clock`.
|
|
8728
|
+
*
|
|
8729
|
+
* **Gotchas**
|
|
8730
|
+
*
|
|
8731
|
+
* If the timeout wins, the source is interrupted and the returned effect waits
|
|
8732
|
+
* for the source fiber to finish, including its finalizers. The duration
|
|
8733
|
+
* determines when interruption is requested, not a deadline for completion.
|
|
8734
|
+
* If the source enters its own uninterruptible region, completion can be
|
|
8735
|
+
* delayed until that region finishes. The eventual source result is
|
|
8736
|
+
* discarded and the timeout still produces `Option.none`.
|
|
8737
|
+
*
|
|
8738
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
8739
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
8740
|
+
* with `forkDetach` are not awaited.
|
|
8741
|
+
*
|
|
8393
8742
|
* **Example** (Returning None on timeout)
|
|
8394
8743
|
*
|
|
8395
8744
|
* ```ts import.meta.vitest
|
|
@@ -8422,6 +8771,23 @@ export declare const timeoutOption: {
|
|
|
8422
8771
|
* interrupted and the returned effect succeeds with `Option.none`. If the
|
|
8423
8772
|
* source effect fails before the timeout, that failure is preserved.
|
|
8424
8773
|
*
|
|
8774
|
+
* Any contender the timeout starts (source or timer) is initially
|
|
8775
|
+
* interruptible, even when the timeout runs in an uninterruptible region. The
|
|
8776
|
+
* timer uses the context's `Clock`.
|
|
8777
|
+
*
|
|
8778
|
+
* **Gotchas**
|
|
8779
|
+
*
|
|
8780
|
+
* If the timeout wins, the source is interrupted and the returned effect waits
|
|
8781
|
+
* for the source fiber to finish, including its finalizers. The duration
|
|
8782
|
+
* determines when interruption is requested, not a deadline for completion.
|
|
8783
|
+
* If the source enters its own uninterruptible region, completion can be
|
|
8784
|
+
* delayed until that region finishes. The eventual source result is
|
|
8785
|
+
* discarded and the timeout still produces `Option.none`.
|
|
8786
|
+
*
|
|
8787
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
8788
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
8789
|
+
* with `forkDetach` are not awaited.
|
|
8790
|
+
*
|
|
8425
8791
|
* **Example** (Returning None on timeout)
|
|
8426
8792
|
*
|
|
8427
8793
|
* ```ts import.meta.vitest
|
|
@@ -8442,7 +8808,26 @@ export declare const timeoutOption: {
|
|
|
8442
8808
|
};
|
|
8443
8809
|
/**
|
|
8444
8810
|
* Applies a timeout to an effect, lazily evaluating `orElse` after interrupting
|
|
8445
|
-
* the source if the timeout is reached.
|
|
8811
|
+
* the source and waiting for its cleanup if the timeout is reached.
|
|
8812
|
+
*
|
|
8813
|
+
* **Details**
|
|
8814
|
+
*
|
|
8815
|
+
* Any contender the timeout starts (source or timer) is initially
|
|
8816
|
+
* interruptible, even when the timeout runs in an uninterruptible region. The
|
|
8817
|
+
* timer uses the context's `Clock`.
|
|
8818
|
+
*
|
|
8819
|
+
* **Gotchas**
|
|
8820
|
+
*
|
|
8821
|
+
* If the timeout wins, the source is interrupted and the returned effect waits
|
|
8822
|
+
* for the source fiber to finish, including its finalizers. The duration
|
|
8823
|
+
* determines when interruption is requested, not a deadline for completion.
|
|
8824
|
+
* If the source enters its own uninterruptible region, completion can be
|
|
8825
|
+
* delayed until that region finishes. The eventual source result is
|
|
8826
|
+
* discarded and the timeout still selects `orElse`.
|
|
8827
|
+
*
|
|
8828
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
8829
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
8830
|
+
* with `forkDetach` are not awaited.
|
|
8446
8831
|
*
|
|
8447
8832
|
* **Example** (Falling back on timeout)
|
|
8448
8833
|
*
|
|
@@ -8471,7 +8856,26 @@ export declare const timeoutOption: {
|
|
|
8471
8856
|
export declare const timeoutOrElse: {
|
|
8472
8857
|
/**
|
|
8473
8858
|
* Applies a timeout to an effect, lazily evaluating `orElse` after interrupting
|
|
8474
|
-
* the source if the timeout is reached.
|
|
8859
|
+
* the source and waiting for its cleanup if the timeout is reached.
|
|
8860
|
+
*
|
|
8861
|
+
* **Details**
|
|
8862
|
+
*
|
|
8863
|
+
* Any contender the timeout starts (source or timer) is initially
|
|
8864
|
+
* interruptible, even when the timeout runs in an uninterruptible region. The
|
|
8865
|
+
* timer uses the context's `Clock`.
|
|
8866
|
+
*
|
|
8867
|
+
* **Gotchas**
|
|
8868
|
+
*
|
|
8869
|
+
* If the timeout wins, the source is interrupted and the returned effect waits
|
|
8870
|
+
* for the source fiber to finish, including its finalizers. The duration
|
|
8871
|
+
* determines when interruption is requested, not a deadline for completion.
|
|
8872
|
+
* If the source enters its own uninterruptible region, completion can be
|
|
8873
|
+
* delayed until that region finishes. The eventual source result is
|
|
8874
|
+
* discarded and the timeout still selects `orElse`.
|
|
8875
|
+
*
|
|
8876
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
8877
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
8878
|
+
* with `forkDetach` are not awaited.
|
|
8475
8879
|
*
|
|
8476
8880
|
* **Example** (Falling back on timeout)
|
|
8477
8881
|
*
|
|
@@ -8503,7 +8907,26 @@ export declare const timeoutOrElse: {
|
|
|
8503
8907
|
}): <A, E, R>(self: Effect<A, E, R>) => Effect<A | A2, E | E2, R | R2>;
|
|
8504
8908
|
/**
|
|
8505
8909
|
* Applies a timeout to an effect, lazily evaluating `orElse` after interrupting
|
|
8506
|
-
* the source if the timeout is reached.
|
|
8910
|
+
* the source and waiting for its cleanup if the timeout is reached.
|
|
8911
|
+
*
|
|
8912
|
+
* **Details**
|
|
8913
|
+
*
|
|
8914
|
+
* Any contender the timeout starts (source or timer) is initially
|
|
8915
|
+
* interruptible, even when the timeout runs in an uninterruptible region. The
|
|
8916
|
+
* timer uses the context's `Clock`.
|
|
8917
|
+
*
|
|
8918
|
+
* **Gotchas**
|
|
8919
|
+
*
|
|
8920
|
+
* If the timeout wins, the source is interrupted and the returned effect waits
|
|
8921
|
+
* for the source fiber to finish, including its finalizers. The duration
|
|
8922
|
+
* determines when interruption is requested, not a deadline for completion.
|
|
8923
|
+
* If the source enters its own uninterruptible region, completion can be
|
|
8924
|
+
* delayed until that region finishes. The eventual source result is
|
|
8925
|
+
* discarded and the timeout still selects `orElse`.
|
|
8926
|
+
*
|
|
8927
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
8928
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
8929
|
+
* with `forkDetach` are not awaited.
|
|
8507
8930
|
*
|
|
8508
8931
|
* **Example** (Falling back on timeout)
|
|
8509
8932
|
*
|
|
@@ -8535,8 +8958,8 @@ export declare const timeoutOrElse: {
|
|
|
8535
8958
|
}): Effect<A | A2, E | E2, R | R2>;
|
|
8536
8959
|
};
|
|
8537
8960
|
/**
|
|
8538
|
-
*
|
|
8539
|
-
* `
|
|
8961
|
+
* Delays the start of an effect by the specified duration using the context's
|
|
8962
|
+
* `Clock`.
|
|
8540
8963
|
*
|
|
8541
8964
|
* **Example** (Delaying an effect)
|
|
8542
8965
|
*
|
|
@@ -8550,14 +8973,15 @@ export declare const timeoutOrElse: {
|
|
|
8550
8973
|
* output // => ["Delayed message"]
|
|
8551
8974
|
* ```
|
|
8552
8975
|
*
|
|
8976
|
+
* @see {@link sleep} for waiting with the current clock
|
|
8553
8977
|
* @stability stable
|
|
8554
8978
|
* @category delays & timeouts
|
|
8555
8979
|
* @since 2.0.0
|
|
8556
8980
|
*/
|
|
8557
8981
|
export declare const delay: {
|
|
8558
8982
|
/**
|
|
8559
|
-
*
|
|
8560
|
-
* `
|
|
8983
|
+
* Delays the start of an effect by the specified duration using the context's
|
|
8984
|
+
* `Clock`.
|
|
8561
8985
|
*
|
|
8562
8986
|
* **Example** (Delaying an effect)
|
|
8563
8987
|
*
|
|
@@ -8571,14 +8995,15 @@ export declare const delay: {
|
|
|
8571
8995
|
* output // => ["Delayed message"]
|
|
8572
8996
|
* ```
|
|
8573
8997
|
*
|
|
8998
|
+
* @see {@link sleep} for waiting with the current clock
|
|
8574
8999
|
* @stability stable
|
|
8575
9000
|
* @category delays & timeouts
|
|
8576
9001
|
* @since 2.0.0
|
|
8577
9002
|
*/
|
|
8578
9003
|
(duration: Duration.Input): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, R>;
|
|
8579
9004
|
/**
|
|
8580
|
-
*
|
|
8581
|
-
* `
|
|
9005
|
+
* Delays the start of an effect by the specified duration using the context's
|
|
9006
|
+
* `Clock`.
|
|
8582
9007
|
*
|
|
8583
9008
|
* **Example** (Delaying an effect)
|
|
8584
9009
|
*
|
|
@@ -8592,6 +9017,7 @@ export declare const delay: {
|
|
|
8592
9017
|
* output // => ["Delayed message"]
|
|
8593
9018
|
* ```
|
|
8594
9019
|
*
|
|
9020
|
+
* @see {@link sleep} for waiting with the current clock
|
|
8595
9021
|
* @stability stable
|
|
8596
9022
|
* @category delays & timeouts
|
|
8597
9023
|
* @since 2.0.0
|
|
@@ -8600,7 +9026,7 @@ export declare const delay: {
|
|
|
8600
9026
|
};
|
|
8601
9027
|
/**
|
|
8602
9028
|
* Returns an effect that suspends the current fiber for the specified duration
|
|
8603
|
-
* without blocking a JavaScript thread.
|
|
9029
|
+
* using the context's `Clock`, without blocking a JavaScript thread.
|
|
8604
9030
|
*
|
|
8605
9031
|
* **Example** (Pausing without blocking)
|
|
8606
9032
|
*
|
|
@@ -8660,9 +9086,24 @@ export declare const timed: <A, E, R>(self: Effect<A, E, R>) => Effect<[duration
|
|
|
8660
9086
|
* **Details**
|
|
8661
9087
|
*
|
|
8662
9088
|
* Early failures do not finish the race; `raceAll` keeps waiting until one
|
|
8663
|
-
* effect succeeds or every effect has failed.
|
|
8664
|
-
*
|
|
8665
|
-
* fails with a cause containing the collected failure reasons.
|
|
9089
|
+
* effect succeeds or every effect has failed. If one succeeds, any
|
|
9090
|
+
* still-running contenders are interrupted. If every effect fails, the
|
|
9091
|
+
* returned effect fails with a cause containing the collected failure reasons.
|
|
9092
|
+
*
|
|
9093
|
+
* Any contender the race starts is initially interruptible, even when the race
|
|
9094
|
+
* runs in an uninterruptible region.
|
|
9095
|
+
*
|
|
9096
|
+
* The returned effect completes only after the interrupted participants have
|
|
9097
|
+
* finished, including their finalizers.
|
|
9098
|
+
*
|
|
9099
|
+
* **Gotchas**
|
|
9100
|
+
*
|
|
9101
|
+
* If a losing effect enters its own uninterruptible region, the race waits
|
|
9102
|
+
* for that region to finish. The losing result is discarded.
|
|
9103
|
+
*
|
|
9104
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
9105
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
9106
|
+
* with `forkDetach` are not awaited.
|
|
8666
9107
|
*
|
|
8667
9108
|
* **Example** (Racing many effects)
|
|
8668
9109
|
*
|
|
@@ -8694,9 +9135,24 @@ export declare const raceAll: <Eff extends Effect<any, any, any>>(all: Iterable<
|
|
|
8694
9135
|
*
|
|
8695
9136
|
* **Details**
|
|
8696
9137
|
*
|
|
8697
|
-
*
|
|
8698
|
-
*
|
|
8699
|
-
*
|
|
9138
|
+
* The race requests interruption of any still-running losers. Use `raceAll`
|
|
9139
|
+
* when early failures should be ignored until a success occurs or all effects
|
|
9140
|
+
* fail.
|
|
9141
|
+
*
|
|
9142
|
+
* Any contender the race starts is initially interruptible, even when the race
|
|
9143
|
+
* runs in an uninterruptible region.
|
|
9144
|
+
*
|
|
9145
|
+
* The returned effect completes only after the interrupted participants have
|
|
9146
|
+
* finished, including their finalizers.
|
|
9147
|
+
*
|
|
9148
|
+
* **Gotchas**
|
|
9149
|
+
*
|
|
9150
|
+
* If a losing effect enters its own uninterruptible region, the race waits
|
|
9151
|
+
* for that region to finish. The losing result is discarded.
|
|
9152
|
+
*
|
|
9153
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
9154
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
9155
|
+
* with `forkDetach` are not awaited.
|
|
8700
9156
|
*
|
|
8701
9157
|
* **Example** (Taking the first settled result)
|
|
8702
9158
|
*
|
|
@@ -8726,8 +9182,23 @@ export declare const raceAllFirst: <Eff extends Effect<any, any, any>>(all: Iter
|
|
|
8726
9182
|
*
|
|
8727
9183
|
* **Details**
|
|
8728
9184
|
*
|
|
8729
|
-
* If one effect succeeds,
|
|
8730
|
-
*
|
|
9185
|
+
* If one effect succeeds, `onWinner` can observe the winning fiber. The other
|
|
9186
|
+
* effect is interrupted if it is still running. If both fail, the race fails.
|
|
9187
|
+
*
|
|
9188
|
+
* Any contender the race starts is initially interruptible, even when the race
|
|
9189
|
+
* runs in an uninterruptible region.
|
|
9190
|
+
*
|
|
9191
|
+
* The returned effect completes only after the interrupted participants have
|
|
9192
|
+
* finished, including their finalizers.
|
|
9193
|
+
*
|
|
9194
|
+
* **Gotchas**
|
|
9195
|
+
*
|
|
9196
|
+
* If a losing effect enters its own uninterruptible region, the race waits
|
|
9197
|
+
* for that region to finish. The losing result is discarded.
|
|
9198
|
+
*
|
|
9199
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
9200
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
9201
|
+
* with `forkDetach` are not awaited.
|
|
8731
9202
|
*
|
|
8732
9203
|
* **Example** (Racing two effects)
|
|
8733
9204
|
*
|
|
@@ -8757,8 +9228,23 @@ export declare const race: {
|
|
|
8757
9228
|
*
|
|
8758
9229
|
* **Details**
|
|
8759
9230
|
*
|
|
8760
|
-
* If one effect succeeds,
|
|
8761
|
-
*
|
|
9231
|
+
* If one effect succeeds, `onWinner` can observe the winning fiber. The other
|
|
9232
|
+
* effect is interrupted if it is still running. If both fail, the race fails.
|
|
9233
|
+
*
|
|
9234
|
+
* Any contender the race starts is initially interruptible, even when the race
|
|
9235
|
+
* runs in an uninterruptible region.
|
|
9236
|
+
*
|
|
9237
|
+
* The returned effect completes only after the interrupted participants have
|
|
9238
|
+
* finished, including their finalizers.
|
|
9239
|
+
*
|
|
9240
|
+
* **Gotchas**
|
|
9241
|
+
*
|
|
9242
|
+
* If a losing effect enters its own uninterruptible region, the race waits
|
|
9243
|
+
* for that region to finish. The losing result is discarded.
|
|
9244
|
+
*
|
|
9245
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
9246
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
9247
|
+
* with `forkDetach` are not awaited.
|
|
8762
9248
|
*
|
|
8763
9249
|
* **Example** (Racing two effects)
|
|
8764
9250
|
*
|
|
@@ -8794,8 +9280,23 @@ export declare const race: {
|
|
|
8794
9280
|
*
|
|
8795
9281
|
* **Details**
|
|
8796
9282
|
*
|
|
8797
|
-
* If one effect succeeds,
|
|
8798
|
-
*
|
|
9283
|
+
* If one effect succeeds, `onWinner` can observe the winning fiber. The other
|
|
9284
|
+
* effect is interrupted if it is still running. If both fail, the race fails.
|
|
9285
|
+
*
|
|
9286
|
+
* Any contender the race starts is initially interruptible, even when the race
|
|
9287
|
+
* runs in an uninterruptible region.
|
|
9288
|
+
*
|
|
9289
|
+
* The returned effect completes only after the interrupted participants have
|
|
9290
|
+
* finished, including their finalizers.
|
|
9291
|
+
*
|
|
9292
|
+
* **Gotchas**
|
|
9293
|
+
*
|
|
9294
|
+
* If a losing effect enters its own uninterruptible region, the race waits
|
|
9295
|
+
* for that region to finish. The losing result is discarded.
|
|
9296
|
+
*
|
|
9297
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
9298
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
9299
|
+
* with `forkDetach` are not awaited.
|
|
8799
9300
|
*
|
|
8800
9301
|
* **Example** (Racing two effects)
|
|
8801
9302
|
*
|
|
@@ -8833,12 +9334,27 @@ export declare const race: {
|
|
|
8833
9334
|
*
|
|
8834
9335
|
* **When to use**
|
|
8835
9336
|
*
|
|
8836
|
-
* Use when any completion, including failure, should decide the race
|
|
8837
|
-
* interrupt the losing effect.
|
|
9337
|
+
* Use when any completion, including failure, should decide the race.
|
|
8838
9338
|
*
|
|
8839
9339
|
* **Details**
|
|
8840
9340
|
*
|
|
8841
|
-
* The losing effect is interrupted
|
|
9341
|
+
* The losing effect is interrupted if it is still running. `onWinner` can
|
|
9342
|
+
* observe the winning fiber.
|
|
9343
|
+
*
|
|
9344
|
+
* Any contender the race starts is initially interruptible, even when the race
|
|
9345
|
+
* runs in an uninterruptible region.
|
|
9346
|
+
*
|
|
9347
|
+
* The returned effect completes only after the interrupted participants have
|
|
9348
|
+
* finished, including their finalizers.
|
|
9349
|
+
*
|
|
9350
|
+
* **Gotchas**
|
|
9351
|
+
*
|
|
9352
|
+
* If a losing effect enters its own uninterruptible region, the race waits
|
|
9353
|
+
* for that region to finish. The losing result is discarded.
|
|
9354
|
+
*
|
|
9355
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
9356
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
9357
|
+
* with `forkDetach` are not awaited.
|
|
8842
9358
|
*
|
|
8843
9359
|
* **Example** (Observing the winning fiber)
|
|
8844
9360
|
*
|
|
@@ -8872,12 +9388,27 @@ export declare const raceFirst: {
|
|
|
8872
9388
|
*
|
|
8873
9389
|
* **When to use**
|
|
8874
9390
|
*
|
|
8875
|
-
* Use when any completion, including failure, should decide the race
|
|
8876
|
-
* interrupt the losing effect.
|
|
9391
|
+
* Use when any completion, including failure, should decide the race.
|
|
8877
9392
|
*
|
|
8878
9393
|
* **Details**
|
|
8879
9394
|
*
|
|
8880
|
-
* The losing effect is interrupted
|
|
9395
|
+
* The losing effect is interrupted if it is still running. `onWinner` can
|
|
9396
|
+
* observe the winning fiber.
|
|
9397
|
+
*
|
|
9398
|
+
* Any contender the race starts is initially interruptible, even when the race
|
|
9399
|
+
* runs in an uninterruptible region.
|
|
9400
|
+
*
|
|
9401
|
+
* The returned effect completes only after the interrupted participants have
|
|
9402
|
+
* finished, including their finalizers.
|
|
9403
|
+
*
|
|
9404
|
+
* **Gotchas**
|
|
9405
|
+
*
|
|
9406
|
+
* If a losing effect enters its own uninterruptible region, the race waits
|
|
9407
|
+
* for that region to finish. The losing result is discarded.
|
|
9408
|
+
*
|
|
9409
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
9410
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
9411
|
+
* with `forkDetach` are not awaited.
|
|
8881
9412
|
*
|
|
8882
9413
|
* **Example** (Observing the winning fiber)
|
|
8883
9414
|
*
|
|
@@ -8917,12 +9448,27 @@ export declare const raceFirst: {
|
|
|
8917
9448
|
*
|
|
8918
9449
|
* **When to use**
|
|
8919
9450
|
*
|
|
8920
|
-
* Use when any completion, including failure, should decide the race
|
|
8921
|
-
* interrupt the losing effect.
|
|
9451
|
+
* Use when any completion, including failure, should decide the race.
|
|
8922
9452
|
*
|
|
8923
9453
|
* **Details**
|
|
8924
9454
|
*
|
|
8925
|
-
* The losing effect is interrupted
|
|
9455
|
+
* The losing effect is interrupted if it is still running. `onWinner` can
|
|
9456
|
+
* observe the winning fiber.
|
|
9457
|
+
*
|
|
9458
|
+
* Any contender the race starts is initially interruptible, even when the race
|
|
9459
|
+
* runs in an uninterruptible region.
|
|
9460
|
+
*
|
|
9461
|
+
* The returned effect completes only after the interrupted participants have
|
|
9462
|
+
* finished, including their finalizers.
|
|
9463
|
+
*
|
|
9464
|
+
* **Gotchas**
|
|
9465
|
+
*
|
|
9466
|
+
* If a losing effect enters its own uninterruptible region, the race waits
|
|
9467
|
+
* for that region to finish. The losing result is discarded.
|
|
9468
|
+
*
|
|
9469
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
9470
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
9471
|
+
* with `forkDetach` are not awaited.
|
|
8926
9472
|
*
|
|
8927
9473
|
* **Example** (Observing the winning fiber)
|
|
8928
9474
|
*
|
|
@@ -10406,6 +10952,9 @@ export declare const matchEager: {
|
|
|
10406
10952
|
* The `matchCause` function allows you to handle failures with access to the
|
|
10407
10953
|
* full cause of the failure within a fiber.
|
|
10408
10954
|
*
|
|
10955
|
+
* The failure handler is skipped if the running fiber is interrupted in an
|
|
10956
|
+
* interruptible region.
|
|
10957
|
+
*
|
|
10409
10958
|
* **Example** (Matching on success or failure causes)
|
|
10410
10959
|
*
|
|
10411
10960
|
* ```ts import.meta.vitest
|
|
@@ -10421,6 +10970,7 @@ export declare const matchEager: {
|
|
|
10421
10970
|
* Effect.runSync(program) // => "Failed: Something went wrong"
|
|
10422
10971
|
* ```
|
|
10423
10972
|
*
|
|
10973
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
10424
10974
|
* @see {@link matchCauseEffect} if you need to perform side effects in the
|
|
10425
10975
|
* handlers.
|
|
10426
10976
|
* @see {@link match} if you don't need to handle the cause of the failure.
|
|
@@ -10442,6 +10992,9 @@ export declare const matchCause: {
|
|
|
10442
10992
|
* The `matchCause` function allows you to handle failures with access to the
|
|
10443
10993
|
* full cause of the failure within a fiber.
|
|
10444
10994
|
*
|
|
10995
|
+
* The failure handler is skipped if the running fiber is interrupted in an
|
|
10996
|
+
* interruptible region.
|
|
10997
|
+
*
|
|
10445
10998
|
* **Example** (Matching on success or failure causes)
|
|
10446
10999
|
*
|
|
10447
11000
|
* ```ts import.meta.vitest
|
|
@@ -10457,6 +11010,7 @@ export declare const matchCause: {
|
|
|
10457
11010
|
* Effect.runSync(program) // => "Failed: Something went wrong"
|
|
10458
11011
|
* ```
|
|
10459
11012
|
*
|
|
11013
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
10460
11014
|
* @see {@link matchCauseEffect} if you need to perform side effects in the
|
|
10461
11015
|
* handlers.
|
|
10462
11016
|
* @see {@link match} if you don't need to handle the cause of the failure.
|
|
@@ -10481,6 +11035,9 @@ export declare const matchCause: {
|
|
|
10481
11035
|
* The `matchCause` function allows you to handle failures with access to the
|
|
10482
11036
|
* full cause of the failure within a fiber.
|
|
10483
11037
|
*
|
|
11038
|
+
* The failure handler is skipped if the running fiber is interrupted in an
|
|
11039
|
+
* interruptible region.
|
|
11040
|
+
*
|
|
10484
11041
|
* **Example** (Matching on success or failure causes)
|
|
10485
11042
|
*
|
|
10486
11043
|
* ```ts import.meta.vitest
|
|
@@ -10496,6 +11053,7 @@ export declare const matchCause: {
|
|
|
10496
11053
|
* Effect.runSync(program) // => "Failed: Something went wrong"
|
|
10497
11054
|
* ```
|
|
10498
11055
|
*
|
|
11056
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
10499
11057
|
* @see {@link matchCauseEffect} if you need to perform side effects in the
|
|
10500
11058
|
* handlers.
|
|
10501
11059
|
* @see {@link match} if you don't need to handle the cause of the failure.
|
|
@@ -10522,6 +11080,9 @@ export declare const matchCause: {
|
|
|
10522
11080
|
* effects by immediately applying the matching function instead of deferring it
|
|
10523
11081
|
* through the effect pipeline.
|
|
10524
11082
|
*
|
|
11083
|
+
* Unless the effect is already an `Exit`, the failure handler is skipped if
|
|
11084
|
+
* the running fiber is interrupted in an interruptible region.
|
|
11085
|
+
*
|
|
10525
11086
|
* **Example** (Eagerly matching already completed effects)
|
|
10526
11087
|
*
|
|
10527
11088
|
* ```ts import.meta.vitest
|
|
@@ -10534,6 +11095,8 @@ export declare const matchCause: {
|
|
|
10534
11095
|
* Effect.runSync(handleResult) // => "Success: 42"
|
|
10535
11096
|
* ```
|
|
10536
11097
|
*
|
|
11098
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
11099
|
+
*
|
|
10537
11100
|
* @stability stable
|
|
10538
11101
|
* @category pattern matching
|
|
10539
11102
|
* @since 4.0.0
|
|
@@ -10553,6 +11116,9 @@ export declare const matchCauseEager: {
|
|
|
10553
11116
|
* effects by immediately applying the matching function instead of deferring it
|
|
10554
11117
|
* through the effect pipeline.
|
|
10555
11118
|
*
|
|
11119
|
+
* Unless the effect is already an `Exit`, the failure handler is skipped if
|
|
11120
|
+
* the running fiber is interrupted in an interruptible region.
|
|
11121
|
+
*
|
|
10556
11122
|
* **Example** (Eagerly matching already completed effects)
|
|
10557
11123
|
*
|
|
10558
11124
|
* ```ts import.meta.vitest
|
|
@@ -10565,6 +11131,8 @@ export declare const matchCauseEager: {
|
|
|
10565
11131
|
* Effect.runSync(handleResult) // => "Success: 42"
|
|
10566
11132
|
* ```
|
|
10567
11133
|
*
|
|
11134
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
11135
|
+
*
|
|
10568
11136
|
* @stability stable
|
|
10569
11137
|
* @category pattern matching
|
|
10570
11138
|
* @since 4.0.0
|
|
@@ -10587,6 +11155,9 @@ export declare const matchCauseEager: {
|
|
|
10587
11155
|
* effects by immediately applying the matching function instead of deferring it
|
|
10588
11156
|
* through the effect pipeline.
|
|
10589
11157
|
*
|
|
11158
|
+
* Unless the effect is already an `Exit`, the failure handler is skipped if
|
|
11159
|
+
* the running fiber is interrupted in an interruptible region.
|
|
11160
|
+
*
|
|
10590
11161
|
* **Example** (Eagerly matching already completed effects)
|
|
10591
11162
|
*
|
|
10592
11163
|
* ```ts import.meta.vitest
|
|
@@ -10599,6 +11170,8 @@ export declare const matchCauseEager: {
|
|
|
10599
11170
|
* Effect.runSync(handleResult) // => "Success: 42"
|
|
10600
11171
|
* ```
|
|
10601
11172
|
*
|
|
11173
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
11174
|
+
*
|
|
10602
11175
|
* @stability stable
|
|
10603
11176
|
* @category pattern matching
|
|
10604
11177
|
* @since 4.0.0
|
|
@@ -10621,6 +11194,10 @@ export declare const matchCauseEager: {
|
|
|
10621
11194
|
* If the effect is an `Exit`, the matching handler runs immediately; otherwise it behaves like
|
|
10622
11195
|
* {@link matchCauseEffect}.
|
|
10623
11196
|
*
|
|
11197
|
+
* Unless the effect is already an `Exit`, the failure handler is skipped if
|
|
11198
|
+
* the running fiber is interrupted in an interruptible region.
|
|
11199
|
+
*
|
|
11200
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
10624
11201
|
* @see {@link matchCauseEffect} for the non-eager effectful variant
|
|
10625
11202
|
* @see {@link matchCauseEager} for eager cause matching with pure handlers
|
|
10626
11203
|
* @see {@link matchEffect} for effectful matching on typed failures instead of full causes
|
|
@@ -10643,6 +11220,10 @@ export declare const matchCauseEffectEager: {
|
|
|
10643
11220
|
* If the effect is an `Exit`, the matching handler runs immediately; otherwise it behaves like
|
|
10644
11221
|
* {@link matchCauseEffect}.
|
|
10645
11222
|
*
|
|
11223
|
+
* Unless the effect is already an `Exit`, the failure handler is skipped if
|
|
11224
|
+
* the running fiber is interrupted in an interruptible region.
|
|
11225
|
+
*
|
|
11226
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
10646
11227
|
* @see {@link matchCauseEffect} for the non-eager effectful variant
|
|
10647
11228
|
* @see {@link matchCauseEager} for eager cause matching with pure handlers
|
|
10648
11229
|
* @see {@link matchEffect} for effectful matching on typed failures instead of full causes
|
|
@@ -10668,6 +11249,10 @@ export declare const matchCauseEffectEager: {
|
|
|
10668
11249
|
* If the effect is an `Exit`, the matching handler runs immediately; otherwise it behaves like
|
|
10669
11250
|
* {@link matchCauseEffect}.
|
|
10670
11251
|
*
|
|
11252
|
+
* Unless the effect is already an `Exit`, the failure handler is skipped if
|
|
11253
|
+
* the running fiber is interrupted in an interruptible region.
|
|
11254
|
+
*
|
|
11255
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
10671
11256
|
* @see {@link matchCauseEffect} for the non-eager effectful variant
|
|
10672
11257
|
* @see {@link matchCauseEager} for eager cause matching with pure handlers
|
|
10673
11258
|
* @see {@link matchEffect} for effectful matching on typed failures instead of full causes
|
|
@@ -10698,6 +11283,9 @@ export declare const matchCauseEffectEager: {
|
|
|
10698
11283
|
* you to respond accordingly while performing side effects (like logging or
|
|
10699
11284
|
* other operations).
|
|
10700
11285
|
*
|
|
11286
|
+
* The failure handler is skipped if the running fiber is interrupted in an
|
|
11287
|
+
* interruptible region.
|
|
11288
|
+
*
|
|
10701
11289
|
* **Example** (Effectfully matching on causes)
|
|
10702
11290
|
*
|
|
10703
11291
|
* ```ts import.meta.vitest
|
|
@@ -10733,6 +11321,7 @@ export declare const matchCauseEffectEager: {
|
|
|
10733
11321
|
* output // => ["Handling error: Task failed", "recovered from error"]
|
|
10734
11322
|
* ```
|
|
10735
11323
|
*
|
|
11324
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
10736
11325
|
* @see {@link matchCause} if you don't need side effects and only want to handle the result or failure.
|
|
10737
11326
|
* @see {@link matchEffect} if you don't need to handle the cause of the failure.
|
|
10738
11327
|
*
|
|
@@ -10758,6 +11347,9 @@ export declare const matchCauseEffect: {
|
|
|
10758
11347
|
* you to respond accordingly while performing side effects (like logging or
|
|
10759
11348
|
* other operations).
|
|
10760
11349
|
*
|
|
11350
|
+
* The failure handler is skipped if the running fiber is interrupted in an
|
|
11351
|
+
* interruptible region.
|
|
11352
|
+
*
|
|
10761
11353
|
* **Example** (Effectfully matching on causes)
|
|
10762
11354
|
*
|
|
10763
11355
|
* ```ts import.meta.vitest
|
|
@@ -10793,6 +11385,7 @@ export declare const matchCauseEffect: {
|
|
|
10793
11385
|
* output // => ["Handling error: Task failed", "recovered from error"]
|
|
10794
11386
|
* ```
|
|
10795
11387
|
*
|
|
11388
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
10796
11389
|
* @see {@link matchCause} if you don't need side effects and only want to handle the result or failure.
|
|
10797
11390
|
* @see {@link matchEffect} if you don't need to handle the cause of the failure.
|
|
10798
11391
|
*
|
|
@@ -10821,6 +11414,9 @@ export declare const matchCauseEffect: {
|
|
|
10821
11414
|
* you to respond accordingly while performing side effects (like logging or
|
|
10822
11415
|
* other operations).
|
|
10823
11416
|
*
|
|
11417
|
+
* The failure handler is skipped if the running fiber is interrupted in an
|
|
11418
|
+
* interruptible region.
|
|
11419
|
+
*
|
|
10824
11420
|
* **Example** (Effectfully matching on causes)
|
|
10825
11421
|
*
|
|
10826
11422
|
* ```ts import.meta.vitest
|
|
@@ -10856,6 +11452,7 @@ export declare const matchCauseEffect: {
|
|
|
10856
11452
|
* output // => ["Handling error: Task failed", "recovered from error"]
|
|
10857
11453
|
* ```
|
|
10858
11454
|
*
|
|
11455
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
10859
11456
|
* @see {@link matchCause} if you don't need side effects and only want to handle the result or failure.
|
|
10860
11457
|
* @see {@link matchEffect} if you don't need to handle the cause of the failure.
|
|
10861
11458
|
*
|
|
@@ -12617,9 +13214,10 @@ export declare const scopedWith: <A, E, R>(f: (scope: Scope) => Effect<A, E, R>)
|
|
|
12617
13214
|
*
|
|
12618
13215
|
* **Details**
|
|
12619
13216
|
*
|
|
12620
|
-
*
|
|
12621
|
-
*
|
|
12622
|
-
* `Exit
|
|
13217
|
+
* After successful acquisition, release is registered on the scope. If the
|
|
13218
|
+
* scope is open, `Scope.close` runs it according to the scope's finalizer
|
|
13219
|
+
* strategy and passes it the closing `Exit`. If the scope is already closed,
|
|
13220
|
+
* release runs immediately with that `Exit`.
|
|
12623
13221
|
*
|
|
12624
13222
|
* By default, acquisition is protected by an uninterruptible region. Pass
|
|
12625
13223
|
* `{ interruptible: true }` to allow the acquisition effect to be interrupted.
|
|
@@ -12744,8 +13342,12 @@ export declare const acquireDisposable: <A extends AsyncDisposable | Disposable,
|
|
|
12744
13342
|
* and will be executed as long as the acquisition `Effect` value
|
|
12745
13343
|
* successfully acquires the resource.
|
|
12746
13344
|
*
|
|
12747
|
-
*
|
|
12748
|
-
*
|
|
13345
|
+
* `use` runs with the interruptibility of the surrounding region. In an
|
|
13346
|
+
* interruptible region, it can be interrupted, and `release` receives an `Exit`
|
|
13347
|
+
* whose cause contains the interruption. In an uninterruptible region, `use`
|
|
13348
|
+
* runs to completion unless it explicitly restores interruptibility.
|
|
13349
|
+
*
|
|
13350
|
+
* The returned effect waits for release to finish, including when interrupted.
|
|
12749
13351
|
*
|
|
12750
13352
|
* If the `release` `Effect` value fails, then the entire `Effect` value will
|
|
12751
13353
|
* fail, even if the `use` `Effect` value succeeds. If this fail-fast behavior
|
|
@@ -12811,8 +13413,9 @@ export declare const acquireUseRelease: <Resource, E, R, A, E2, R2, E3, R3>(acqu
|
|
|
12811
13413
|
*
|
|
12812
13414
|
* **Details**
|
|
12813
13415
|
*
|
|
12814
|
-
*
|
|
12815
|
-
*
|
|
13416
|
+
* If the scope is open, `Scope.close` runs the finalizer according to the
|
|
13417
|
+
* scope's finalizer strategy and passes it the closing `Exit`. If the scope is
|
|
13418
|
+
* already closed, the finalizer runs immediately with that `Exit`.
|
|
12816
13419
|
*
|
|
12817
13420
|
* **Example** (Registering scope finalizers)
|
|
12818
13421
|
*
|
|
@@ -12857,12 +13460,12 @@ export declare const addFinalizer: <R>(finalizer: (exit: Exit.Exit<unknown, unkn
|
|
|
12857
13460
|
*
|
|
12858
13461
|
* **Details**
|
|
12859
13462
|
*
|
|
12860
|
-
* For use cases that need access to the effect's result, see `onExit`.
|
|
12861
|
-
*
|
|
12862
13463
|
* Finalizers offer very powerful guarantees, but they are low-level, and
|
|
12863
13464
|
* should generally not be used for releasing resources. For higher-level
|
|
12864
13465
|
* logic built on `ensuring`, see the `acquireRelease` family of methods.
|
|
12865
13466
|
*
|
|
13467
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
13468
|
+
*
|
|
12866
13469
|
* **Example** (Always running cleanup)
|
|
12867
13470
|
*
|
|
12868
13471
|
* ```ts import.meta.vitest
|
|
@@ -12897,12 +13500,12 @@ export declare const ensuring: {
|
|
|
12897
13500
|
*
|
|
12898
13501
|
* **Details**
|
|
12899
13502
|
*
|
|
12900
|
-
* For use cases that need access to the effect's result, see `onExit`.
|
|
12901
|
-
*
|
|
12902
13503
|
* Finalizers offer very powerful guarantees, but they are low-level, and
|
|
12903
13504
|
* should generally not be used for releasing resources. For higher-level
|
|
12904
13505
|
* logic built on `ensuring`, see the `acquireRelease` family of methods.
|
|
12905
13506
|
*
|
|
13507
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
13508
|
+
*
|
|
12906
13509
|
* **Example** (Always running cleanup)
|
|
12907
13510
|
*
|
|
12908
13511
|
* ```ts import.meta.vitest
|
|
@@ -12937,12 +13540,12 @@ export declare const ensuring: {
|
|
|
12937
13540
|
*
|
|
12938
13541
|
* **Details**
|
|
12939
13542
|
*
|
|
12940
|
-
* For use cases that need access to the effect's result, see `onExit`.
|
|
12941
|
-
*
|
|
12942
13543
|
* Finalizers offer very powerful guarantees, but they are low-level, and
|
|
12943
13544
|
* should generally not be used for releasing resources. For higher-level
|
|
12944
13545
|
* logic built on `ensuring`, see the `acquireRelease` family of methods.
|
|
12945
13546
|
*
|
|
13547
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
13548
|
+
*
|
|
12946
13549
|
* **Example** (Always running cleanup)
|
|
12947
13550
|
*
|
|
12948
13551
|
* ```ts import.meta.vitest
|
|
@@ -13063,6 +13666,10 @@ export declare const onError: {
|
|
|
13063
13666
|
* Runs the finalizer only when this effect fails and the `Cause` matches the
|
|
13064
13667
|
* provided predicate.
|
|
13065
13668
|
*
|
|
13669
|
+
* **Details**
|
|
13670
|
+
*
|
|
13671
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
13672
|
+
*
|
|
13066
13673
|
* **Example** (Running cleanup for selected failures)
|
|
13067
13674
|
*
|
|
13068
13675
|
* ```ts import.meta.vitest
|
|
@@ -13093,6 +13700,10 @@ export declare const onErrorIf: {
|
|
|
13093
13700
|
* Runs the finalizer only when this effect fails and the `Cause` matches the
|
|
13094
13701
|
* provided predicate.
|
|
13095
13702
|
*
|
|
13703
|
+
* **Details**
|
|
13704
|
+
*
|
|
13705
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
13706
|
+
*
|
|
13096
13707
|
* **Example** (Running cleanup for selected failures)
|
|
13097
13708
|
*
|
|
13098
13709
|
* ```ts import.meta.vitest
|
|
@@ -13123,6 +13734,10 @@ export declare const onErrorIf: {
|
|
|
13123
13734
|
* Runs the finalizer only when this effect fails and the `Cause` matches the
|
|
13124
13735
|
* provided predicate.
|
|
13125
13736
|
*
|
|
13737
|
+
* **Details**
|
|
13738
|
+
*
|
|
13739
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
13740
|
+
*
|
|
13126
13741
|
* **Example** (Running cleanup for selected failures)
|
|
13127
13742
|
*
|
|
13128
13743
|
* ```ts import.meta.vitest
|
|
@@ -13159,6 +13774,10 @@ export declare const onErrorIf: {
|
|
|
13159
13774
|
* `Cause` is accepted or transformed by a `Filter`, and the finalizer needs the
|
|
13160
13775
|
* filter's pass value plus the original cause.
|
|
13161
13776
|
*
|
|
13777
|
+
* **Details**
|
|
13778
|
+
*
|
|
13779
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
13780
|
+
*
|
|
13162
13781
|
* @see {@link onError} for cleanup on every failure
|
|
13163
13782
|
* @see {@link onErrorIf} for selecting failures with a boolean predicate
|
|
13164
13783
|
* @see {@link onExitFilter} for selecting from every exit instead of only failures
|
|
@@ -13177,6 +13796,10 @@ export declare const onErrorFilter: {
|
|
|
13177
13796
|
* `Cause` is accepted or transformed by a `Filter`, and the finalizer needs the
|
|
13178
13797
|
* filter's pass value plus the original cause.
|
|
13179
13798
|
*
|
|
13799
|
+
* **Details**
|
|
13800
|
+
*
|
|
13801
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
13802
|
+
*
|
|
13180
13803
|
* @see {@link onError} for cleanup on every failure
|
|
13181
13804
|
* @see {@link onErrorIf} for selecting failures with a boolean predicate
|
|
13182
13805
|
* @see {@link onExitFilter} for selecting from every exit instead of only failures
|
|
@@ -13195,6 +13818,10 @@ export declare const onErrorFilter: {
|
|
|
13195
13818
|
* `Cause` is accepted or transformed by a `Filter`, and the finalizer needs the
|
|
13196
13819
|
* filter's pass value plus the original cause.
|
|
13197
13820
|
*
|
|
13821
|
+
* **Details**
|
|
13822
|
+
*
|
|
13823
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
13824
|
+
*
|
|
13198
13825
|
* @see {@link onError} for cleanup on every failure
|
|
13199
13826
|
* @see {@link onErrorIf} for selecting failures with a boolean predicate
|
|
13200
13827
|
* @see {@link onExitFilter} for selecting from every exit instead of only failures
|
|
@@ -13236,6 +13863,15 @@ export declare const onExitPrimitive: <A, E, R, XE = never, XR = never>(self: Ef
|
|
|
13236
13863
|
*
|
|
13237
13864
|
* If both the effect and the cleanup function fail, the two causes are merged.
|
|
13238
13865
|
*
|
|
13866
|
+
* Cleanup runs in an uninterruptible region. `Fiber.interrupt` waits for it
|
|
13867
|
+
* to finish. Wrap a part of cleanup in `Effect.interruptible` to allow that
|
|
13868
|
+
* part to be interrupted.
|
|
13869
|
+
*
|
|
13870
|
+
* **Gotchas**
|
|
13871
|
+
*
|
|
13872
|
+
* If interruption is already pending, a part of cleanup wrapped in
|
|
13873
|
+
* `Effect.interruptible` is interrupted before it starts.
|
|
13874
|
+
*
|
|
13239
13875
|
* **Example** (Observing every exit)
|
|
13240
13876
|
*
|
|
13241
13877
|
* ```ts import.meta.vitest
|
|
@@ -13268,6 +13904,15 @@ export declare const onExit: {
|
|
|
13268
13904
|
*
|
|
13269
13905
|
* If both the effect and the cleanup function fail, the two causes are merged.
|
|
13270
13906
|
*
|
|
13907
|
+
* Cleanup runs in an uninterruptible region. `Fiber.interrupt` waits for it
|
|
13908
|
+
* to finish. Wrap a part of cleanup in `Effect.interruptible` to allow that
|
|
13909
|
+
* part to be interrupted.
|
|
13910
|
+
*
|
|
13911
|
+
* **Gotchas**
|
|
13912
|
+
*
|
|
13913
|
+
* If interruption is already pending, a part of cleanup wrapped in
|
|
13914
|
+
* `Effect.interruptible` is interrupted before it starts.
|
|
13915
|
+
*
|
|
13271
13916
|
* **Example** (Observing every exit)
|
|
13272
13917
|
*
|
|
13273
13918
|
* ```ts import.meta.vitest
|
|
@@ -13300,6 +13945,15 @@ export declare const onExit: {
|
|
|
13300
13945
|
*
|
|
13301
13946
|
* If both the effect and the cleanup function fail, the two causes are merged.
|
|
13302
13947
|
*
|
|
13948
|
+
* Cleanup runs in an uninterruptible region. `Fiber.interrupt` waits for it
|
|
13949
|
+
* to finish. Wrap a part of cleanup in `Effect.interruptible` to allow that
|
|
13950
|
+
* part to be interrupted.
|
|
13951
|
+
*
|
|
13952
|
+
* **Gotchas**
|
|
13953
|
+
*
|
|
13954
|
+
* If interruption is already pending, a part of cleanup wrapped in
|
|
13955
|
+
* `Effect.interruptible` is interrupted before it starts.
|
|
13956
|
+
*
|
|
13303
13957
|
* **Example** (Observing every exit)
|
|
13304
13958
|
*
|
|
13305
13959
|
* ```ts import.meta.vitest
|
|
@@ -13329,6 +13983,10 @@ export declare const onExit: {
|
|
|
13329
13983
|
* Runs the cleanup effect only when the `Exit` satisfies the provided
|
|
13330
13984
|
* predicate.
|
|
13331
13985
|
*
|
|
13986
|
+
* **Details**
|
|
13987
|
+
*
|
|
13988
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
13989
|
+
*
|
|
13332
13990
|
* **Example** (Observing selected exits)
|
|
13333
13991
|
*
|
|
13334
13992
|
* ```ts import.meta.vitest
|
|
@@ -13357,6 +14015,10 @@ export declare const onExitIf: {
|
|
|
13357
14015
|
* Runs the cleanup effect only when the `Exit` satisfies the provided
|
|
13358
14016
|
* predicate.
|
|
13359
14017
|
*
|
|
14018
|
+
* **Details**
|
|
14019
|
+
*
|
|
14020
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
14021
|
+
*
|
|
13360
14022
|
* **Example** (Observing selected exits)
|
|
13361
14023
|
*
|
|
13362
14024
|
* ```ts import.meta.vitest
|
|
@@ -13385,6 +14047,10 @@ export declare const onExitIf: {
|
|
|
13385
14047
|
* Runs the cleanup effect only when the `Exit` satisfies the provided
|
|
13386
14048
|
* predicate.
|
|
13387
14049
|
*
|
|
14050
|
+
* **Details**
|
|
14051
|
+
*
|
|
14052
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
14053
|
+
*
|
|
13388
14054
|
* **Example** (Observing selected exits)
|
|
13389
14055
|
*
|
|
13390
14056
|
* ```ts import.meta.vitest
|
|
@@ -13424,6 +14090,8 @@ export declare const onExitIf: {
|
|
|
13424
14090
|
* `Result.fail` skips cleanup, and `Result.succeed` runs cleanup with the
|
|
13425
14091
|
* selected value and the original `Exit`.
|
|
13426
14092
|
*
|
|
14093
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
14094
|
+
*
|
|
13427
14095
|
* @see {@link onExit} for cleanup on every exit
|
|
13428
14096
|
* @see {@link onExitIf} for selecting exits with a boolean predicate
|
|
13429
14097
|
* @see {@link onErrorFilter} for selecting only failure causes
|
|
@@ -13447,6 +14115,8 @@ export declare const onExitFilter: {
|
|
|
13447
14115
|
* `Result.fail` skips cleanup, and `Result.succeed` runs cleanup with the
|
|
13448
14116
|
* selected value and the original `Exit`.
|
|
13449
14117
|
*
|
|
14118
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
14119
|
+
*
|
|
13450
14120
|
* @see {@link onExit} for cleanup on every exit
|
|
13451
14121
|
* @see {@link onExitIf} for selecting exits with a boolean predicate
|
|
13452
14122
|
* @see {@link onErrorFilter} for selecting only failure causes
|
|
@@ -13470,6 +14140,8 @@ export declare const onExitFilter: {
|
|
|
13470
14140
|
* `Result.fail` skips cleanup, and `Result.succeed` runs cleanup with the
|
|
13471
14141
|
* selected value and the original `Exit`.
|
|
13472
14142
|
*
|
|
14143
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
14144
|
+
*
|
|
13473
14145
|
* @see {@link onExit} for cleanup on every exit
|
|
13474
14146
|
* @see {@link onExitIf} for selecting exits with a boolean predicate
|
|
13475
14147
|
* @see {@link onErrorFilter} for selecting only failure causes
|
|
@@ -14270,7 +14942,8 @@ export declare const cachedInvalidateWithTTL: {
|
|
|
14270
14942
|
<A, E, R>(self: Effect<A, E, R>, timeToLive: Duration.Input | ((exit: Exit.Exit<A, E>) => Duration.Input)): Effect<[Effect<A, E, R>, Effect<void>]>;
|
|
14271
14943
|
};
|
|
14272
14944
|
/**
|
|
14273
|
-
*
|
|
14945
|
+
* Fails with an `Interrupt` reason that names the current fiber. This does not
|
|
14946
|
+
* request interruption of the fiber itself, so a cause handler can recover.
|
|
14274
14947
|
*
|
|
14275
14948
|
* **Example** (Creating an interrupted effect)
|
|
14276
14949
|
*
|
|
@@ -14285,13 +14958,20 @@ export declare const cachedInvalidateWithTTL: {
|
|
|
14285
14958
|
* Effect.runSyncExit(program)._tag // => "Failure"
|
|
14286
14959
|
* ```
|
|
14287
14960
|
*
|
|
14961
|
+
* @see {@link catchCause} for recovering from an interruption in the cause
|
|
14962
|
+
*
|
|
14288
14963
|
* @stability stable
|
|
14289
14964
|
* @category interruption
|
|
14290
14965
|
* @since 2.0.0
|
|
14291
14966
|
*/
|
|
14292
14967
|
export declare const interrupt: Effect<never>;
|
|
14293
14968
|
/**
|
|
14294
|
-
*
|
|
14969
|
+
* Runs an effect in an interruptible region.
|
|
14970
|
+
*
|
|
14971
|
+
* **Details**
|
|
14972
|
+
*
|
|
14973
|
+
* If interruption is pending when the fiber enters this region, it takes
|
|
14974
|
+
* effect before the wrapped effect starts.
|
|
14295
14975
|
*
|
|
14296
14976
|
* **Example** (Allowing interruption)
|
|
14297
14977
|
*
|
|
@@ -14304,6 +14984,8 @@ export declare const interrupt: Effect<never>;
|
|
|
14304
14984
|
* await Effect.runPromise(program) // => Option.none()
|
|
14305
14985
|
* ```
|
|
14306
14986
|
*
|
|
14987
|
+
* @see {@link uninterruptible} for how regions defer interruption
|
|
14988
|
+
*
|
|
14307
14989
|
* @stability stable
|
|
14308
14990
|
* @category interruption
|
|
14309
14991
|
* @since 2.0.0
|
|
@@ -14312,6 +14994,10 @@ export declare const interruptible: <A, E, R>(self: Effect<A, E, R>) => Effect<A
|
|
|
14312
14994
|
/**
|
|
14313
14995
|
* Runs the specified finalizer effect if this effect is interrupted.
|
|
14314
14996
|
*
|
|
14997
|
+
* **Details**
|
|
14998
|
+
*
|
|
14999
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
15000
|
+
*
|
|
14315
15001
|
* **Example** (Running cleanup on interruption)
|
|
14316
15002
|
*
|
|
14317
15003
|
* ```ts import.meta.vitest
|
|
@@ -14338,6 +15024,10 @@ export declare const onInterrupt: {
|
|
|
14338
15024
|
/**
|
|
14339
15025
|
* Runs the specified finalizer effect if this effect is interrupted.
|
|
14340
15026
|
*
|
|
15027
|
+
* **Details**
|
|
15028
|
+
*
|
|
15029
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
15030
|
+
*
|
|
14341
15031
|
* **Example** (Running cleanup on interruption)
|
|
14342
15032
|
*
|
|
14343
15033
|
* ```ts import.meta.vitest
|
|
@@ -14364,6 +15054,10 @@ export declare const onInterrupt: {
|
|
|
14364
15054
|
/**
|
|
14365
15055
|
* Runs the specified finalizer effect if this effect is interrupted.
|
|
14366
15056
|
*
|
|
15057
|
+
* **Details**
|
|
15058
|
+
*
|
|
15059
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
15060
|
+
*
|
|
14367
15061
|
* **Example** (Running cleanup on interruption)
|
|
14368
15062
|
*
|
|
14369
15063
|
* ```ts import.meta.vitest
|
|
@@ -14389,7 +15083,13 @@ export declare const onInterrupt: {
|
|
|
14389
15083
|
<A, E, R, XE, XR>(self: Effect<A, E, R>, finalizer: (interruptors: ReadonlySet<number>) => Effect<void, XE, XR>): Effect<A, E | XE, R | XR>;
|
|
14390
15084
|
};
|
|
14391
15085
|
/**
|
|
14392
|
-
*
|
|
15086
|
+
* Runs an effect in an uninterruptible region.
|
|
15087
|
+
*
|
|
15088
|
+
* **Details**
|
|
15089
|
+
*
|
|
15090
|
+
* An interruption request remains pending while the fiber is uninterruptible.
|
|
15091
|
+
* It takes effect when the fiber returns to an interruptible region or enters
|
|
15092
|
+
* one explicitly with `interruptible`.
|
|
14393
15093
|
*
|
|
14394
15094
|
* **Example** (Preventing interruption)
|
|
14395
15095
|
*
|
|
@@ -14417,6 +15117,12 @@ export declare const uninterruptible: <A, E, R>(self: Effect<A, E, R>) => Effect
|
|
|
14417
15117
|
* Disables interruption and provides a restore function to restore the
|
|
14418
15118
|
* interruptible state within the effect.
|
|
14419
15119
|
*
|
|
15120
|
+
* **Details**
|
|
15121
|
+
*
|
|
15122
|
+
* `restore(effect)` runs `effect` in the surrounding region. If that region
|
|
15123
|
+
* was interruptible, a pending interruption takes effect before `effect`
|
|
15124
|
+
* starts; if it was uninterruptible, the request remains pending.
|
|
15125
|
+
*
|
|
14420
15126
|
* **Example** (Restoring interruption in protected regions)
|
|
14421
15127
|
*
|
|
14422
15128
|
* ```ts import.meta.vitest
|
|
@@ -14441,6 +15147,8 @@ export declare const uninterruptible: <A, E, R>(self: Effect<A, E, R>) => Effect
|
|
|
14441
15147
|
* output // => ["Uninterruptible phase...", "Interruptible phase...", "Back to uninterruptible"]
|
|
14442
15148
|
* ```
|
|
14443
15149
|
*
|
|
15150
|
+
* @see {@link uninterruptible} for how regions defer interruption
|
|
15151
|
+
*
|
|
14444
15152
|
* @stability stable
|
|
14445
15153
|
* @category interruption
|
|
14446
15154
|
* @since 2.0.0
|
|
@@ -14450,6 +15158,11 @@ export declare const uninterruptibleMask: <A, E, R>(f: (restore: <AX, EX, RX>(ef
|
|
|
14450
15158
|
* Runs an effect in an interruptible region while providing `restore` for
|
|
14451
15159
|
* locally restoring the previous interruptibility.
|
|
14452
15160
|
*
|
|
15161
|
+
* **Details**
|
|
15162
|
+
*
|
|
15163
|
+
* A pending interruption takes effect when the fiber enters the interruptible
|
|
15164
|
+
* region. Otherwise, `restore` can run a section in the surrounding region.
|
|
15165
|
+
*
|
|
14453
15166
|
* **Example** (Controlling interruptibility locally)
|
|
14454
15167
|
*
|
|
14455
15168
|
* ```ts import.meta.vitest
|
|
@@ -14470,10 +15183,12 @@ export declare const uninterruptibleMask: <A, E, R>(f: (restore: <AX, EX, RX>(ef
|
|
|
14470
15183
|
* })
|
|
14471
15184
|
* )
|
|
14472
15185
|
*
|
|
14473
|
-
* Effect.runSync(program)
|
|
15186
|
+
* Effect.runSync(Effect.uninterruptible(program))
|
|
14474
15187
|
* output // => ["Interruptible phase...", "Uninterruptible phase...", "Back to interruptible"]
|
|
14475
15188
|
* ```
|
|
14476
15189
|
*
|
|
15190
|
+
* @see {@link uninterruptible} for how regions defer interruption
|
|
15191
|
+
*
|
|
14477
15192
|
* @stability stable
|
|
14478
15193
|
* @category interruption
|
|
14479
15194
|
* @since 2.0.0
|
|
@@ -14590,9 +15305,7 @@ export declare const forever: <Arg extends Effect<any, any, any> | {
|
|
|
14590
15305
|
* If the effect succeeds, it is repeated according to the schedule. If it
|
|
14591
15306
|
* fails, the repetition stops immediately, and the failure is returned.
|
|
14592
15307
|
*
|
|
14593
|
-
*
|
|
14594
|
-
* for tasks like retrying operations with backoff, periodic execution, or
|
|
14595
|
-
* performing a series of dependent actions.
|
|
15308
|
+
* Delays between repetitions use the context's `Clock`.
|
|
14596
15309
|
*
|
|
14597
15310
|
* You can combine schedules for more advanced repetition logic, such as adding
|
|
14598
15311
|
* delays, limiting recursions, or dynamically adjusting based on the outcome of
|
|
@@ -14676,9 +15389,7 @@ export declare const repeat: {
|
|
|
14676
15389
|
* If the effect succeeds, it is repeated according to the schedule. If it
|
|
14677
15390
|
* fails, the repetition stops immediately, and the failure is returned.
|
|
14678
15391
|
*
|
|
14679
|
-
*
|
|
14680
|
-
* for tasks like retrying operations with backoff, periodic execution, or
|
|
14681
|
-
* performing a series of dependent actions.
|
|
15392
|
+
* Delays between repetitions use the context's `Clock`.
|
|
14682
15393
|
*
|
|
14683
15394
|
* You can combine schedules for more advanced repetition logic, such as adding
|
|
14684
15395
|
* delays, limiting recursions, or dynamically adjusting based on the outcome of
|
|
@@ -14762,9 +15473,7 @@ export declare const repeat: {
|
|
|
14762
15473
|
* If the effect succeeds, it is repeated according to the schedule. If it
|
|
14763
15474
|
* fails, the repetition stops immediately, and the failure is returned.
|
|
14764
15475
|
*
|
|
14765
|
-
*
|
|
14766
|
-
* for tasks like retrying operations with backoff, periodic execution, or
|
|
14767
|
-
* performing a series of dependent actions.
|
|
15476
|
+
* Delays between repetitions use the context's `Clock`.
|
|
14768
15477
|
*
|
|
14769
15478
|
* You can combine schedules for more advanced repetition logic, such as adding
|
|
14770
15479
|
* delays, limiting recursions, or dynamically adjusting based on the outcome of
|
|
@@ -14848,9 +15557,7 @@ export declare const repeat: {
|
|
|
14848
15557
|
* If the effect succeeds, it is repeated according to the schedule. If it
|
|
14849
15558
|
* fails, the repetition stops immediately, and the failure is returned.
|
|
14850
15559
|
*
|
|
14851
|
-
*
|
|
14852
|
-
* for tasks like retrying operations with backoff, periodic execution, or
|
|
14853
|
-
* performing a series of dependent actions.
|
|
15560
|
+
* Delays between repetitions use the context's `Clock`.
|
|
14854
15561
|
*
|
|
14855
15562
|
* You can combine schedules for more advanced repetition logic, such as adding
|
|
14856
15563
|
* delays, limiting recursions, or dynamically adjusting based on the outcome of
|
|
@@ -14934,9 +15641,7 @@ export declare const repeat: {
|
|
|
14934
15641
|
* If the effect succeeds, it is repeated according to the schedule. If it
|
|
14935
15642
|
* fails, the repetition stops immediately, and the failure is returned.
|
|
14936
15643
|
*
|
|
14937
|
-
*
|
|
14938
|
-
* for tasks like retrying operations with backoff, periodic execution, or
|
|
14939
|
-
* performing a series of dependent actions.
|
|
15644
|
+
* Delays between repetitions use the context's `Clock`.
|
|
14940
15645
|
*
|
|
14941
15646
|
* You can combine schedules for more advanced repetition logic, such as adding
|
|
14942
15647
|
* delays, limiting recursions, or dynamically adjusting based on the outcome of
|
|
@@ -15020,9 +15725,7 @@ export declare const repeat: {
|
|
|
15020
15725
|
* If the effect succeeds, it is repeated according to the schedule. If it
|
|
15021
15726
|
* fails, the repetition stops immediately, and the failure is returned.
|
|
15022
15727
|
*
|
|
15023
|
-
*
|
|
15024
|
-
* for tasks like retrying operations with backoff, periodic execution, or
|
|
15025
|
-
* performing a series of dependent actions.
|
|
15728
|
+
* Delays between repetitions use the context's `Clock`.
|
|
15026
15729
|
*
|
|
15027
15730
|
* You can combine schedules for more advanced repetition logic, such as adding
|
|
15028
15731
|
* delays, limiting recursions, or dynamically adjusting based on the outcome of
|
|
@@ -15106,9 +15809,7 @@ export declare const repeat: {
|
|
|
15106
15809
|
* If the effect succeeds, it is repeated according to the schedule. If it
|
|
15107
15810
|
* fails, the repetition stops immediately, and the failure is returned.
|
|
15108
15811
|
*
|
|
15109
|
-
*
|
|
15110
|
-
* for tasks like retrying operations with backoff, periodic execution, or
|
|
15111
|
-
* performing a series of dependent actions.
|
|
15812
|
+
* Delays between repetitions use the context's `Clock`.
|
|
15112
15813
|
*
|
|
15113
15814
|
* You can combine schedules for more advanced repetition logic, such as adding
|
|
15114
15815
|
* delays, limiting recursions, or dynamically adjusting based on the outcome of
|
|
@@ -15191,6 +15892,8 @@ export declare const repeat: {
|
|
|
15191
15892
|
* otherwise it receives `None`. If the schedule completes normally, the
|
|
15192
15893
|
* returned effect succeeds with the schedule's output.
|
|
15193
15894
|
*
|
|
15895
|
+
* Scheduled delays use the context's `Clock`.
|
|
15896
|
+
*
|
|
15194
15897
|
* **Gotchas**
|
|
15195
15898
|
*
|
|
15196
15899
|
* Defects take precedence over typed errors from either the effect or policy.
|
|
@@ -15251,6 +15954,8 @@ export declare const repeatOrElse: {
|
|
|
15251
15954
|
* otherwise it receives `None`. If the schedule completes normally, the
|
|
15252
15955
|
* returned effect succeeds with the schedule's output.
|
|
15253
15956
|
*
|
|
15957
|
+
* Scheduled delays use the context's `Clock`.
|
|
15958
|
+
*
|
|
15254
15959
|
* **Gotchas**
|
|
15255
15960
|
*
|
|
15256
15961
|
* Defects take precedence over typed errors from either the effect or policy.
|
|
@@ -15311,6 +16016,8 @@ export declare const repeatOrElse: {
|
|
|
15311
16016
|
* otherwise it receives `None`. If the schedule completes normally, the
|
|
15312
16017
|
* returned effect succeeds with the schedule's output.
|
|
15313
16018
|
*
|
|
16019
|
+
* Scheduled delays use the context's `Clock`.
|
|
16020
|
+
*
|
|
15314
16021
|
* **Gotchas**
|
|
15315
16022
|
*
|
|
15316
16023
|
* Defects take precedence over typed errors from either the effect or policy.
|
|
@@ -15607,6 +16314,8 @@ export declare const replicateEffect: {
|
|
|
15607
16314
|
* fails, and otherwise succeeds with the schedule output when the schedule
|
|
15608
16315
|
* completes.
|
|
15609
16316
|
*
|
|
16317
|
+
* Scheduled delays use the context's `Clock`.
|
|
16318
|
+
*
|
|
15610
16319
|
* **Example** (Scheduling repeated execution)
|
|
15611
16320
|
*
|
|
15612
16321
|
* ```ts import.meta.vitest
|
|
@@ -15649,6 +16358,8 @@ export declare const schedule: {
|
|
|
15649
16358
|
* fails, and otherwise succeeds with the schedule output when the schedule
|
|
15650
16359
|
* completes.
|
|
15651
16360
|
*
|
|
16361
|
+
* Scheduled delays use the context's `Clock`.
|
|
16362
|
+
*
|
|
15652
16363
|
* **Example** (Scheduling repeated execution)
|
|
15653
16364
|
*
|
|
15654
16365
|
* ```ts import.meta.vitest
|
|
@@ -15691,6 +16402,8 @@ export declare const schedule: {
|
|
|
15691
16402
|
* fails, and otherwise succeeds with the schedule output when the schedule
|
|
15692
16403
|
* completes.
|
|
15693
16404
|
*
|
|
16405
|
+
* Scheduled delays use the context's `Clock`.
|
|
16406
|
+
*
|
|
15694
16407
|
* **Example** (Scheduling repeated execution)
|
|
15695
16408
|
*
|
|
15696
16409
|
* ```ts import.meta.vitest
|
|
@@ -15729,6 +16442,8 @@ export declare const schedule: {
|
|
|
15729
16442
|
* succeeds with the schedule output when the schedule completes and fails if
|
|
15730
16443
|
* the effect or schedule fails.
|
|
15731
16444
|
*
|
|
16445
|
+
* Scheduled delays use the context's `Clock`.
|
|
16446
|
+
*
|
|
15732
16447
|
* **Example** (Scheduling from an initial value)
|
|
15733
16448
|
*
|
|
15734
16449
|
* ```ts import.meta.vitest
|
|
@@ -15769,6 +16484,8 @@ export declare const scheduleFrom: {
|
|
|
15769
16484
|
* succeeds with the schedule output when the schedule completes and fails if
|
|
15770
16485
|
* the effect or schedule fails.
|
|
15771
16486
|
*
|
|
16487
|
+
* Scheduled delays use the context's `Clock`.
|
|
16488
|
+
*
|
|
15772
16489
|
* **Example** (Scheduling from an initial value)
|
|
15773
16490
|
*
|
|
15774
16491
|
* ```ts import.meta.vitest
|
|
@@ -15809,6 +16526,8 @@ export declare const scheduleFrom: {
|
|
|
15809
16526
|
* succeeds with the schedule output when the schedule completes and fails if
|
|
15810
16527
|
* the effect or schedule fails.
|
|
15811
16528
|
*
|
|
16529
|
+
* Scheduled delays use the context's `Clock`.
|
|
16530
|
+
*
|
|
15812
16531
|
* **Example** (Scheduling from an initial value)
|
|
15813
16532
|
*
|
|
15814
16533
|
* ```ts import.meta.vitest
|
|
@@ -16210,6 +16929,11 @@ export declare const annotateSpans: {
|
|
|
16210
16929
|
/**
|
|
16211
16930
|
* Adds an annotation to the current span if available.
|
|
16212
16931
|
*
|
|
16932
|
+
* **Details**
|
|
16933
|
+
*
|
|
16934
|
+
* Does nothing when there is no current span or when the nearest parent span is
|
|
16935
|
+
* an `ExternalSpan`.
|
|
16936
|
+
*
|
|
16213
16937
|
* **Example** (Annotating the current span)
|
|
16214
16938
|
*
|
|
16215
16939
|
* ```ts import.meta.vitest
|
|
@@ -16235,6 +16959,11 @@ export declare const annotateCurrentSpan: {
|
|
|
16235
16959
|
/**
|
|
16236
16960
|
* Adds an annotation to the current span if available.
|
|
16237
16961
|
*
|
|
16962
|
+
* **Details**
|
|
16963
|
+
*
|
|
16964
|
+
* Does nothing when there is no current span or when the nearest parent span is
|
|
16965
|
+
* an `ExternalSpan`.
|
|
16966
|
+
*
|
|
16238
16967
|
* **Example** (Annotating the current span)
|
|
16239
16968
|
*
|
|
16240
16969
|
* ```ts import.meta.vitest
|
|
@@ -16260,6 +16989,11 @@ export declare const annotateCurrentSpan: {
|
|
|
16260
16989
|
/**
|
|
16261
16990
|
* Adds an annotation to the current span if available.
|
|
16262
16991
|
*
|
|
16992
|
+
* **Details**
|
|
16993
|
+
*
|
|
16994
|
+
* Does nothing when there is no current span or when the nearest parent span is
|
|
16995
|
+
* an `ExternalSpan`.
|
|
16996
|
+
*
|
|
16263
16997
|
* **Example** (Annotating the current span)
|
|
16264
16998
|
*
|
|
16265
16999
|
* ```ts import.meta.vitest
|
|
@@ -16288,8 +17022,9 @@ export declare const annotateCurrentSpan: {
|
|
|
16288
17022
|
*
|
|
16289
17023
|
* **Details**
|
|
16290
17024
|
*
|
|
16291
|
-
* The effect fails with `NoSuchElementError` when there is no
|
|
16292
|
-
* `
|
|
17025
|
+
* The effect fails with `NoSuchElementError` when there is no parent span or
|
|
17026
|
+
* when the nearest parent span is an `ExternalSpan`. Use `currentParentSpan` to
|
|
17027
|
+
* read either kind.
|
|
16293
17028
|
*
|
|
16294
17029
|
* **Example** (Reading the current span)
|
|
16295
17030
|
*
|
|
@@ -17044,9 +17779,7 @@ export declare const requestUnsafe: <A extends Request.Any>(self: A, options: {
|
|
|
17044
17779
|
readonly context: Context.Context<never>;
|
|
17045
17780
|
}) => () => void;
|
|
17046
17781
|
/**
|
|
17047
|
-
*
|
|
17048
|
-
* returning the fiber immediately, without waiting for it to begin executing
|
|
17049
|
-
* the effect.
|
|
17782
|
+
* Forks this effect into a child fiber and returns its handle.
|
|
17050
17783
|
*
|
|
17051
17784
|
* **Details**
|
|
17052
17785
|
*
|
|
@@ -17066,6 +17799,18 @@ export declare const requestUnsafe: <A extends Request.Any>(self: A, options: {
|
|
|
17066
17799
|
* fibers leak. This behavior is called "auto supervision", and if this
|
|
17067
17800
|
* behavior is not desired, you may use the `forkDetach` or `forkIn` methods.
|
|
17068
17801
|
*
|
|
17802
|
+
* Fork options:
|
|
17803
|
+
*
|
|
17804
|
+
* - `startImmediately` defaults to `false`: the fork returns before the new
|
|
17805
|
+
* fiber runs, without promising a scheduler turn. With `true`, the fiber
|
|
17806
|
+
* runs synchronously until it suspends, yields, or completes before the fork
|
|
17807
|
+
* returns.
|
|
17808
|
+
* - `uninterruptible` defaults to `false`, even in an uninterruptible caller.
|
|
17809
|
+
* With `true`, the fiber starts uninterruptible: `Fiber.interrupt` waits for
|
|
17810
|
+
* completion without replacing its result. Explicit `Effect.interruptible`
|
|
17811
|
+
* regions can still be interrupted. `"inherit"` copies the caller's
|
|
17812
|
+
* interruptibility at the fork.
|
|
17813
|
+
*
|
|
17069
17814
|
* **Example** (Forking a child fiber)
|
|
17070
17815
|
*
|
|
17071
17816
|
* ```ts import.meta.vitest
|
|
@@ -17100,6 +17845,33 @@ export declare const forkChild: <Arg extends Effect<any, any, any> | {
|
|
|
17100
17845
|
* Forks the effect in the specified scope. The fiber will be interrupted
|
|
17101
17846
|
* when the scope is closed.
|
|
17102
17847
|
*
|
|
17848
|
+
* **Details**
|
|
17849
|
+
*
|
|
17850
|
+
* The scope owns the fiber, not the forker: it can outlive the forker's
|
|
17851
|
+
* completion or interruption. Closing the scope from another fiber interrupts
|
|
17852
|
+
* it and waits for completion, including finalizers.
|
|
17853
|
+
*
|
|
17854
|
+
* Forking and registration are interruption-safe: interrupting the forker
|
|
17855
|
+
* cannot leave the new fiber outside the scope. If the scope is already
|
|
17856
|
+
* closed, the effect is not started and the returned fiber is interrupted.
|
|
17857
|
+
*
|
|
17858
|
+
* Fork options:
|
|
17859
|
+
*
|
|
17860
|
+
* - `startImmediately` defaults to `false`: the fork returns before the new
|
|
17861
|
+
* fiber runs, without promising a scheduler turn. With `true`, the fiber
|
|
17862
|
+
* runs synchronously until it suspends, yields, or completes before the fork
|
|
17863
|
+
* returns.
|
|
17864
|
+
* - `uninterruptible` defaults to `false`, even in an uninterruptible caller.
|
|
17865
|
+
* With `true`, the fiber starts uninterruptible: `Fiber.interrupt` waits for
|
|
17866
|
+
* completion without replacing its result. Explicit `Effect.interruptible`
|
|
17867
|
+
* regions can still be interrupted. `"inherit"` copies the caller's
|
|
17868
|
+
* interruptibility at the fork.
|
|
17869
|
+
*
|
|
17870
|
+
* **Gotchas**
|
|
17871
|
+
*
|
|
17872
|
+
* A fiber that closes its own scope is not interrupted or awaited by that
|
|
17873
|
+
* close. An uninterruptible fiber can delay scope closure.
|
|
17874
|
+
*
|
|
17103
17875
|
* **Example** (Forking into a supplied scope)
|
|
17104
17876
|
*
|
|
17105
17877
|
* ```ts import.meta.vitest
|
|
@@ -17128,6 +17900,33 @@ export declare const forkIn: {
|
|
|
17128
17900
|
* Forks the effect in the specified scope. The fiber will be interrupted
|
|
17129
17901
|
* when the scope is closed.
|
|
17130
17902
|
*
|
|
17903
|
+
* **Details**
|
|
17904
|
+
*
|
|
17905
|
+
* The scope owns the fiber, not the forker: it can outlive the forker's
|
|
17906
|
+
* completion or interruption. Closing the scope from another fiber interrupts
|
|
17907
|
+
* it and waits for completion, including finalizers.
|
|
17908
|
+
*
|
|
17909
|
+
* Forking and registration are interruption-safe: interrupting the forker
|
|
17910
|
+
* cannot leave the new fiber outside the scope. If the scope is already
|
|
17911
|
+
* closed, the effect is not started and the returned fiber is interrupted.
|
|
17912
|
+
*
|
|
17913
|
+
* Fork options:
|
|
17914
|
+
*
|
|
17915
|
+
* - `startImmediately` defaults to `false`: the fork returns before the new
|
|
17916
|
+
* fiber runs, without promising a scheduler turn. With `true`, the fiber
|
|
17917
|
+
* runs synchronously until it suspends, yields, or completes before the fork
|
|
17918
|
+
* returns.
|
|
17919
|
+
* - `uninterruptible` defaults to `false`, even in an uninterruptible caller.
|
|
17920
|
+
* With `true`, the fiber starts uninterruptible: `Fiber.interrupt` waits for
|
|
17921
|
+
* completion without replacing its result. Explicit `Effect.interruptible`
|
|
17922
|
+
* regions can still be interrupted. `"inherit"` copies the caller's
|
|
17923
|
+
* interruptibility at the fork.
|
|
17924
|
+
*
|
|
17925
|
+
* **Gotchas**
|
|
17926
|
+
*
|
|
17927
|
+
* A fiber that closes its own scope is not interrupted or awaited by that
|
|
17928
|
+
* close. An uninterruptible fiber can delay scope closure.
|
|
17929
|
+
*
|
|
17131
17930
|
* **Example** (Forking into a supplied scope)
|
|
17132
17931
|
*
|
|
17133
17932
|
* ```ts import.meta.vitest
|
|
@@ -17159,6 +17958,33 @@ export declare const forkIn: {
|
|
|
17159
17958
|
* Forks the effect in the specified scope. The fiber will be interrupted
|
|
17160
17959
|
* when the scope is closed.
|
|
17161
17960
|
*
|
|
17961
|
+
* **Details**
|
|
17962
|
+
*
|
|
17963
|
+
* The scope owns the fiber, not the forker: it can outlive the forker's
|
|
17964
|
+
* completion or interruption. Closing the scope from another fiber interrupts
|
|
17965
|
+
* it and waits for completion, including finalizers.
|
|
17966
|
+
*
|
|
17967
|
+
* Forking and registration are interruption-safe: interrupting the forker
|
|
17968
|
+
* cannot leave the new fiber outside the scope. If the scope is already
|
|
17969
|
+
* closed, the effect is not started and the returned fiber is interrupted.
|
|
17970
|
+
*
|
|
17971
|
+
* Fork options:
|
|
17972
|
+
*
|
|
17973
|
+
* - `startImmediately` defaults to `false`: the fork returns before the new
|
|
17974
|
+
* fiber runs, without promising a scheduler turn. With `true`, the fiber
|
|
17975
|
+
* runs synchronously until it suspends, yields, or completes before the fork
|
|
17976
|
+
* returns.
|
|
17977
|
+
* - `uninterruptible` defaults to `false`, even in an uninterruptible caller.
|
|
17978
|
+
* With `true`, the fiber starts uninterruptible: `Fiber.interrupt` waits for
|
|
17979
|
+
* completion without replacing its result. Explicit `Effect.interruptible`
|
|
17980
|
+
* regions can still be interrupted. `"inherit"` copies the caller's
|
|
17981
|
+
* interruptibility at the fork.
|
|
17982
|
+
*
|
|
17983
|
+
* **Gotchas**
|
|
17984
|
+
*
|
|
17985
|
+
* A fiber that closes its own scope is not interrupted or awaited by that
|
|
17986
|
+
* close. An uninterruptible fiber can delay scope closure.
|
|
17987
|
+
*
|
|
17162
17988
|
* **Example** (Forking into a supplied scope)
|
|
17163
17989
|
*
|
|
17164
17990
|
* ```ts import.meta.vitest
|
|
@@ -17190,6 +18016,33 @@ export declare const forkIn: {
|
|
|
17190
18016
|
/**
|
|
17191
18017
|
* Forks the fiber in a `Scope`, interrupting it when the scope is closed.
|
|
17192
18018
|
*
|
|
18019
|
+
* **Details**
|
|
18020
|
+
*
|
|
18021
|
+
* The scope owns the fiber, not the forker: it can outlive the forker's
|
|
18022
|
+
* completion or interruption. Closing the scope from another fiber interrupts
|
|
18023
|
+
* it and waits for completion, including finalizers.
|
|
18024
|
+
*
|
|
18025
|
+
* Forking and registration are interruption-safe: interrupting the forker
|
|
18026
|
+
* cannot leave the new fiber outside the scope. If the scope is already
|
|
18027
|
+
* closed, the effect is not started and the returned fiber is interrupted.
|
|
18028
|
+
*
|
|
18029
|
+
* Fork options:
|
|
18030
|
+
*
|
|
18031
|
+
* - `startImmediately` defaults to `false`: the fork returns before the new
|
|
18032
|
+
* fiber runs, without promising a scheduler turn. With `true`, the fiber
|
|
18033
|
+
* runs synchronously until it suspends, yields, or completes before the fork
|
|
18034
|
+
* returns.
|
|
18035
|
+
* - `uninterruptible` defaults to `false`, even in an uninterruptible caller.
|
|
18036
|
+
* With `true`, the fiber starts uninterruptible: `Fiber.interrupt` waits for
|
|
18037
|
+
* completion without replacing its result. Explicit `Effect.interruptible`
|
|
18038
|
+
* regions can still be interrupted. `"inherit"` copies the caller's
|
|
18039
|
+
* interruptibility at the fork.
|
|
18040
|
+
*
|
|
18041
|
+
* **Gotchas**
|
|
18042
|
+
*
|
|
18043
|
+
* A fiber that closes its own scope is not interrupted or awaited by that
|
|
18044
|
+
* close. An uninterruptible fiber can delay scope closure.
|
|
18045
|
+
*
|
|
17193
18046
|
* **Example** (Forking into the current scope)
|
|
17194
18047
|
*
|
|
17195
18048
|
* ```ts import.meta.vitest
|
|
@@ -17233,6 +18086,18 @@ export declare const forkScoped: <Arg extends Effect<any, any, any> | {
|
|
|
17233
18086
|
* until it completes or is explicitly interrupted through the returned handle,
|
|
17234
18087
|
* even after the forking fiber terminates.
|
|
17235
18088
|
*
|
|
18089
|
+
* Fork options:
|
|
18090
|
+
*
|
|
18091
|
+
* - `startImmediately` defaults to `false`: the fork returns before the new
|
|
18092
|
+
* fiber runs, without promising a scheduler turn. With `true`, the fiber
|
|
18093
|
+
* runs synchronously until it suspends, yields, or completes before the fork
|
|
18094
|
+
* returns.
|
|
18095
|
+
* - `uninterruptible` defaults to `false`, even in an uninterruptible caller.
|
|
18096
|
+
* With `true`, the fiber starts uninterruptible: `Fiber.interrupt` waits for
|
|
18097
|
+
* completion without replacing its result. Explicit `Effect.interruptible`
|
|
18098
|
+
* regions can still be interrupted. `"inherit"` copies the caller's
|
|
18099
|
+
* interruptibility at the fork.
|
|
18100
|
+
*
|
|
17236
18101
|
* **Example** (Forking a detached fiber)
|
|
17237
18102
|
*
|
|
17238
18103
|
* ```ts import.meta.vitest
|
|
@@ -17341,9 +18206,9 @@ export declare const fiberId: Effect<number>;
|
|
|
17341
18206
|
*
|
|
17342
18207
|
* **Details**
|
|
17343
18208
|
*
|
|
17344
|
-
* `signal`
|
|
17345
|
-
*
|
|
17346
|
-
*
|
|
18209
|
+
* `signal` can interrupt the fiber, and `scheduler` provides the scheduler
|
|
18210
|
+
* service. The fiber starts interruptible unless `uninterruptible: true` is
|
|
18211
|
+
* set.
|
|
17347
18212
|
*
|
|
17348
18213
|
* @see {@link runFork} for starting a fiber with these options
|
|
17349
18214
|
* @see {@link runCallback} for callback-based running with these options
|
|
@@ -17368,6 +18233,12 @@ export interface RunOptions {
|
|
|
17368
18233
|
*
|
|
17369
18234
|
* Use when you need to start an effect in the background and receive a fiber.
|
|
17370
18235
|
*
|
|
18236
|
+
* **Details**
|
|
18237
|
+
*
|
|
18238
|
+
* The fiber starts immediately and runs synchronously until it suspends,
|
|
18239
|
+
* yields, or completes. It starts interruptible unless `uninterruptible: true`
|
|
18240
|
+
* is set.
|
|
18241
|
+
*
|
|
17371
18242
|
* **Example** (Running an effect in the background)
|
|
17372
18243
|
*
|
|
17373
18244
|
* ```ts import.meta.vitest
|
|
@@ -17386,6 +18257,8 @@ export interface RunOptions {
|
|
|
17386
18257
|
* output // => ["running...", "done"]
|
|
17387
18258
|
* ```
|
|
17388
18259
|
*
|
|
18260
|
+
* @see {@link RunOptions} for configuring the fiber
|
|
18261
|
+
* @see {@link forkChild} for starting a child of the current fiber
|
|
17389
18262
|
* @stability stable
|
|
17390
18263
|
* @category running
|
|
17391
18264
|
* @since 2.0.0
|
|
@@ -17399,6 +18272,12 @@ export declare const runFork: <A, E>(effect: Effect<A, E, never>, options?: RunO
|
|
|
17399
18272
|
* Use when an effect still requires services, you already have a `Context`, and
|
|
17400
18273
|
* you want a background fiber.
|
|
17401
18274
|
*
|
|
18275
|
+
* **Details**
|
|
18276
|
+
*
|
|
18277
|
+
* The fiber starts immediately and runs synchronously until it suspends,
|
|
18278
|
+
* yields, or completes. It starts interruptible unless `uninterruptible: true`
|
|
18279
|
+
* is set.
|
|
18280
|
+
*
|
|
17402
18281
|
* **Example** (Running with services in the background)
|
|
17403
18282
|
*
|
|
17404
18283
|
* ```ts import.meta.vitest
|
|
@@ -17426,6 +18305,8 @@ export declare const runFork: <A, E>(effect: Effect<A, E, never>, options?: RunO
|
|
|
17426
18305
|
* output // => ["Hello from service!", "done"]
|
|
17427
18306
|
* ```
|
|
17428
18307
|
*
|
|
18308
|
+
* @see {@link RunOptions} for configuring the fiber
|
|
18309
|
+
* @see {@link forkChild} for starting a child of the current fiber
|
|
17429
18310
|
* @stability stable
|
|
17430
18311
|
* @category running
|
|
17431
18312
|
* @since 4.0.0
|