effect 4.1.4 → 4.1.5
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/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 +295 -0
- package/dist/Codegen.d.ts.map +1 -0
- package/dist/Codegen.js +521 -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 +869 -109
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +400 -47
- package/dist/Effect.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/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 +2 -2
- package/dist/Match.d.ts +12 -0
- 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 +7 -2
- 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 +49 -19
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +44 -27
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +11 -4
- 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 +2 -1
- 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.map +1 -1
- package/dist/Stream.js +55 -14
- 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 +62 -4
- 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/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/McpSchema.d.ts +88 -88
- package/dist/ai/McpSchema.d.ts.map +1 -1
- package/dist/ai/McpServer.d.ts +47 -2
- package/dist/ai/McpServer.d.ts.map +1 -1
- package/dist/ai/McpServer.js +135 -16
- package/dist/ai/McpServer.js.map +1 -1
- 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/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 +30 -22
- package/dist/cluster/ClusterWorkflowEngine.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 +13 -15
- 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/entityManager.js +12 -8
- 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 +77 -0
- 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 +1 -0
- 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 +117 -11
- package/dist/encoding/Xml.d.ts.map +1 -1
- package/dist/encoding/Xml.js +332 -42
- 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/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/HttpClient.d.ts.map +1 -1
- package/dist/http/HttpClient.js +1 -1
- package/dist/http/HttpClient.js.map +1 -1
- package/dist/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/http/HttpMiddleware.js +15 -8
- 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.map +1 -1
- package/dist/http/HttpServerResponse.js +24 -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/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 +138 -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-api/HttpApi.d.ts +13 -2
- package/dist/http-api/HttpApi.d.ts.map +1 -1
- package/dist/http-api/HttpApi.js +16 -2
- 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 +3 -2
- 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 +6 -6
- 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/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/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 +26 -12
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/effect.js +21 -7
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/hashMap.js +7 -7
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/matcher.js +2 -1
- 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 +377 -0
- package/dist/internal/schema/schemaCodegen.js.map +1 -0
- 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/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/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/observability/OtlpExporter.js +12 -10
- package/dist/observability/OtlpExporter.js.map +1 -1
- package/dist/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/observability/OtlpLogger.js +5 -3
- package/dist/observability/OtlpLogger.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/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 +38 -13
- 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 +38 -21
- package/dist/rpc/RpcClient.js.map +1 -1
- package/dist/rpc/RpcGroup.d.ts +5 -0
- package/dist/rpc/RpcGroup.d.ts.map +1 -1
- 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 +10 -1
- package/dist/sql/Migrator.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/WorkflowEngine.d.ts.map +1 -1
- package/dist/workflow/WorkflowEngine.js +3 -1
- package/dist/workflow/WorkflowEngine.js.map +1 -1
- package/package.json +7 -4
- 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/Chunk.ts +7 -3
- package/src/Clock.ts +5 -2
- package/src/Codegen.ts +741 -0
- package/src/Config.ts +35 -4
- package/src/ConfigProvider.ts +24 -7
- package/src/Effect.ts +871 -109
- 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/LayerMap.ts +14 -4
- package/src/LayerRef.ts +2 -2
- package/src/Match.ts +16 -0
- package/src/Metric.ts +1 -1
- package/src/Option.ts +9 -5
- package/src/Order.ts +9 -4
- 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 +69 -32
- package/src/SchemaAST.ts +15 -4
- 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 +2 -1
- package/src/Semaphore.ts +18 -4
- package/src/Stream.ts +66 -20
- package/src/String.ts +83 -6
- package/src/Struct.ts +138 -5
- package/src/TextDiff.ts +186 -30
- package/src/TxPriorityQueue.ts +2 -2
- package/src/ai/LanguageModel.ts +2 -1
- package/src/ai/McpServer.ts +145 -22
- package/src/ai/Tool.ts +3 -2
- package/src/ai/Toolkit.ts +3 -1
- 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 +42 -23
- package/src/cluster/Sharding.ts +17 -3
- package/src/cluster/ShardingConfig.ts +3 -0
- package/src/cluster/SqlMessageStorage.ts +16 -20
- package/src/cluster/SqlRunnerStorage.ts +21 -8
- package/src/cluster/internal/entityManager.ts +19 -10
- 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 +79 -0
- package/src/encoding/Base64Url.ts +1 -0
- 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 +394 -47
- package/src/eventlog/EventJournal.ts +3 -8
- package/src/eventlog/SqlEventLogServerEncrypted.ts +9 -9
- package/src/http/FindMyWay/internal/router.ts +181 -129
- package/src/http/FindMyWay.ts +106 -0
- package/src/http/HttpClient.ts +2 -1
- package/src/http/HttpMiddleware.ts +22 -9
- package/src/http/HttpRouter.ts +84 -20
- package/src/http/HttpServerResponse.ts +33 -61
- package/src/http/Mime.ts +3 -2
- package/src/http/internal/compression.ts +2 -2
- package/src/{http-api → http}/internal/mediaType.ts +4 -0
- package/src/http/internal/redactedPath.ts +144 -0
- package/src/http/internal/requestState.ts +2 -0
- package/src/http-api/HttpApi.ts +25 -2
- package/src/http-api/HttpApiBuilder.ts +5 -2
- package/src/http-api/HttpApiClient.ts +10 -6
- 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/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/codegen.ts +53 -0
- package/src/internal/core.ts +3 -3
- package/src/internal/dateTime.ts +30 -13
- package/src/internal/effect.ts +25 -9
- package/src/internal/hashMap.ts +8 -7
- package/src/internal/matcher.ts +2 -1
- 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 +543 -0
- 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/Jwks.ts +23 -4
- package/src/observability/OtlpExporter.ts +12 -10
- package/src/observability/OtlpLogger.ts +5 -3
- package/src/observability/internal/otlpProtobuf.ts +386 -457
- 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 +55 -16
- 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 +30 -21
- package/src/rpc/RpcGroup.ts +5 -0
- 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 +8 -1
- 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/WorkflowEngine.ts +3 -1
- 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
|
*/
|
|
@@ -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
|
*
|
|
@@ -5171,8 +5242,7 @@ export declare const unwrapReason: {
|
|
|
5171
5242
|
<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
5243
|
};
|
|
5173
5244
|
/**
|
|
5174
|
-
*
|
|
5175
|
-
* effect.
|
|
5245
|
+
* Runs a recovery effect with the full cause of failure.
|
|
5176
5246
|
*
|
|
5177
5247
|
* **When to use**
|
|
5178
5248
|
*
|
|
@@ -5182,7 +5252,15 @@ export declare const unwrapReason: {
|
|
|
5182
5252
|
*
|
|
5183
5253
|
* **Details**
|
|
5184
5254
|
*
|
|
5185
|
-
*
|
|
5255
|
+
* The handler can recover from an interruption in the cause, such as one from
|
|
5256
|
+
* `Effect.interrupt` or from joining an interrupted fiber.
|
|
5257
|
+
*
|
|
5258
|
+
* Interruption of the fiber running `catchCause` is different. In an
|
|
5259
|
+
* interruptible region, the handler is skipped and the fiber runs its cleanup
|
|
5260
|
+
* before exiting. A handler in an uninterruptible region can handle an
|
|
5261
|
+
* interruption delivered in an inner interruptible region. A pending request
|
|
5262
|
+
* alone neither invokes that handler nor adds an interruption to an unrelated
|
|
5263
|
+
* failure while the fiber remains uninterruptible.
|
|
5186
5264
|
*
|
|
5187
5265
|
* Defects are unexpected errors that typically shouldn't be recovered from, as
|
|
5188
5266
|
* they often indicate serious issues. However, in some cases, such as
|
|
@@ -5217,8 +5295,7 @@ export declare const unwrapReason: {
|
|
|
5217
5295
|
*/
|
|
5218
5296
|
export declare const catchCause: {
|
|
5219
5297
|
/**
|
|
5220
|
-
*
|
|
5221
|
-
* effect.
|
|
5298
|
+
* Runs a recovery effect with the full cause of failure.
|
|
5222
5299
|
*
|
|
5223
5300
|
* **When to use**
|
|
5224
5301
|
*
|
|
@@ -5228,7 +5305,15 @@ export declare const catchCause: {
|
|
|
5228
5305
|
*
|
|
5229
5306
|
* **Details**
|
|
5230
5307
|
*
|
|
5231
|
-
*
|
|
5308
|
+
* The handler can recover from an interruption in the cause, such as one from
|
|
5309
|
+
* `Effect.interrupt` or from joining an interrupted fiber.
|
|
5310
|
+
*
|
|
5311
|
+
* Interruption of the fiber running `catchCause` is different. In an
|
|
5312
|
+
* interruptible region, the handler is skipped and the fiber runs its cleanup
|
|
5313
|
+
* before exiting. A handler in an uninterruptible region can handle an
|
|
5314
|
+
* interruption delivered in an inner interruptible region. A pending request
|
|
5315
|
+
* alone neither invokes that handler nor adds an interruption to an unrelated
|
|
5316
|
+
* failure while the fiber remains uninterruptible.
|
|
5232
5317
|
*
|
|
5233
5318
|
* Defects are unexpected errors that typically shouldn't be recovered from, as
|
|
5234
5319
|
* they often indicate serious issues. However, in some cases, such as
|
|
@@ -5263,8 +5348,7 @@ export declare const catchCause: {
|
|
|
5263
5348
|
*/
|
|
5264
5349
|
<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
5350
|
/**
|
|
5266
|
-
*
|
|
5267
|
-
* effect.
|
|
5351
|
+
* Runs a recovery effect with the full cause of failure.
|
|
5268
5352
|
*
|
|
5269
5353
|
* **When to use**
|
|
5270
5354
|
*
|
|
@@ -5274,7 +5358,15 @@ export declare const catchCause: {
|
|
|
5274
5358
|
*
|
|
5275
5359
|
* **Details**
|
|
5276
5360
|
*
|
|
5277
|
-
*
|
|
5361
|
+
* The handler can recover from an interruption in the cause, such as one from
|
|
5362
|
+
* `Effect.interrupt` or from joining an interrupted fiber.
|
|
5363
|
+
*
|
|
5364
|
+
* Interruption of the fiber running `catchCause` is different. In an
|
|
5365
|
+
* interruptible region, the handler is skipped and the fiber runs its cleanup
|
|
5366
|
+
* before exiting. A handler in an uninterruptible region can handle an
|
|
5367
|
+
* interruption delivered in an inner interruptible region. A pending request
|
|
5368
|
+
* alone neither invokes that handler nor adds an interruption to an unrelated
|
|
5369
|
+
* failure while the fiber remains uninterruptible.
|
|
5278
5370
|
*
|
|
5279
5371
|
* Defects are unexpected errors that typically shouldn't be recovered from, as
|
|
5280
5372
|
* they often indicate serious issues. However, in some cases, such as
|
|
@@ -5870,6 +5962,9 @@ export declare const catchNoSuchElement: <A, E, R>(self: Effect<A, E, R>) => Eff
|
|
|
5870
5962
|
* that match a specific predicate. This is useful when you want to handle
|
|
5871
5963
|
* only certain types of errors while letting others propagate.
|
|
5872
5964
|
*
|
|
5965
|
+
* The failure handler is skipped if the running fiber is interrupted in an
|
|
5966
|
+
* interruptible region.
|
|
5967
|
+
*
|
|
5873
5968
|
* **Example** (Recovering from selected causes)
|
|
5874
5969
|
*
|
|
5875
5970
|
* ```ts import.meta.vitest
|
|
@@ -5915,6 +6010,9 @@ export declare const catchCauseIf: {
|
|
|
5915
6010
|
* that match a specific predicate. This is useful when you want to handle
|
|
5916
6011
|
* only certain types of errors while letting others propagate.
|
|
5917
6012
|
*
|
|
6013
|
+
* The failure handler is skipped if the running fiber is interrupted in an
|
|
6014
|
+
* interruptible region.
|
|
6015
|
+
*
|
|
5918
6016
|
* **Example** (Recovering from selected causes)
|
|
5919
6017
|
*
|
|
5920
6018
|
* ```ts import.meta.vitest
|
|
@@ -5960,6 +6058,9 @@ export declare const catchCauseIf: {
|
|
|
5960
6058
|
* that match a specific predicate. This is useful when you want to handle
|
|
5961
6059
|
* only certain types of errors while letting others propagate.
|
|
5962
6060
|
*
|
|
6061
|
+
* The failure handler is skipped if the running fiber is interrupted in an
|
|
6062
|
+
* interruptible region.
|
|
6063
|
+
*
|
|
5963
6064
|
* **Example** (Recovering from selected causes)
|
|
5964
6065
|
*
|
|
5965
6066
|
* ```ts import.meta.vitest
|
|
@@ -6008,6 +6109,9 @@ export declare const catchCauseIf: {
|
|
|
6008
6109
|
* receives the selected value and the original cause. When it fails, the effect
|
|
6009
6110
|
* re-fails with the residual cause returned by the filter.
|
|
6010
6111
|
*
|
|
6112
|
+
* The failure handler is skipped if the running fiber is interrupted in an
|
|
6113
|
+
* interruptible region.
|
|
6114
|
+
*
|
|
6011
6115
|
* @see {@link catchCauseIf} for predicate-based cause selection
|
|
6012
6116
|
* @see {@link catchFilter} for filtering typed error values instead of full causes
|
|
6013
6117
|
* @see {@link catchCause} for recovering from every cause without filtering
|
|
@@ -6032,6 +6136,9 @@ export declare const catchCauseFilter: {
|
|
|
6032
6136
|
* receives the selected value and the original cause. When it fails, the effect
|
|
6033
6137
|
* re-fails with the residual cause returned by the filter.
|
|
6034
6138
|
*
|
|
6139
|
+
* The failure handler is skipped if the running fiber is interrupted in an
|
|
6140
|
+
* interruptible region.
|
|
6141
|
+
*
|
|
6035
6142
|
* @see {@link catchCauseIf} for predicate-based cause selection
|
|
6036
6143
|
* @see {@link catchFilter} for filtering typed error values instead of full causes
|
|
6037
6144
|
* @see {@link catchCause} for recovering from every cause without filtering
|
|
@@ -6056,6 +6163,9 @@ export declare const catchCauseFilter: {
|
|
|
6056
6163
|
* receives the selected value and the original cause. When it fails, the effect
|
|
6057
6164
|
* re-fails with the residual cause returned by the filter.
|
|
6058
6165
|
*
|
|
6166
|
+
* The failure handler is skipped if the running fiber is interrupted in an
|
|
6167
|
+
* interruptible region.
|
|
6168
|
+
*
|
|
6059
6169
|
* @see {@link catchCauseIf} for predicate-based cause selection
|
|
6060
6170
|
* @see {@link catchFilter} for filtering typed error values instead of full causes
|
|
6061
6171
|
* @see {@link catchCause} for recovering from every cause without filtering
|
|
@@ -6613,6 +6723,9 @@ export declare const tapErrorTag: {
|
|
|
6613
6723
|
* the operation succeeds, the original cause is preserved. If the operation
|
|
6614
6724
|
* fails, its error is also represented in the returned effect.
|
|
6615
6725
|
*
|
|
6726
|
+
* The observer is skipped if the running fiber is interrupted in an
|
|
6727
|
+
* interruptible region.
|
|
6728
|
+
*
|
|
6616
6729
|
* **Example** (Observing full failure causes)
|
|
6617
6730
|
*
|
|
6618
6731
|
* ```ts import.meta.vitest
|
|
@@ -6630,6 +6743,8 @@ export declare const tapErrorTag: {
|
|
|
6630
6743
|
* output // => ["Logging cause: Something went wrong", Exit.fail("Something went wrong")]
|
|
6631
6744
|
* ```
|
|
6632
6745
|
*
|
|
6746
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
6747
|
+
*
|
|
6633
6748
|
* @stability stable
|
|
6634
6749
|
* @category error handling
|
|
6635
6750
|
* @since 4.0.0
|
|
@@ -6650,6 +6765,9 @@ export declare const tapCause: {
|
|
|
6650
6765
|
* the operation succeeds, the original cause is preserved. If the operation
|
|
6651
6766
|
* fails, its error is also represented in the returned effect.
|
|
6652
6767
|
*
|
|
6768
|
+
* The observer is skipped if the running fiber is interrupted in an
|
|
6769
|
+
* interruptible region.
|
|
6770
|
+
*
|
|
6653
6771
|
* **Example** (Observing full failure causes)
|
|
6654
6772
|
*
|
|
6655
6773
|
* ```ts import.meta.vitest
|
|
@@ -6667,6 +6785,8 @@ export declare const tapCause: {
|
|
|
6667
6785
|
* output // => ["Logging cause: Something went wrong", Exit.fail("Something went wrong")]
|
|
6668
6786
|
* ```
|
|
6669
6787
|
*
|
|
6788
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
6789
|
+
*
|
|
6670
6790
|
* @stability stable
|
|
6671
6791
|
* @category error handling
|
|
6672
6792
|
* @since 4.0.0
|
|
@@ -6687,6 +6807,9 @@ export declare const tapCause: {
|
|
|
6687
6807
|
* the operation succeeds, the original cause is preserved. If the operation
|
|
6688
6808
|
* fails, its error is also represented in the returned effect.
|
|
6689
6809
|
*
|
|
6810
|
+
* The observer is skipped if the running fiber is interrupted in an
|
|
6811
|
+
* interruptible region.
|
|
6812
|
+
*
|
|
6690
6813
|
* **Example** (Observing full failure causes)
|
|
6691
6814
|
*
|
|
6692
6815
|
* ```ts import.meta.vitest
|
|
@@ -6704,6 +6827,8 @@ export declare const tapCause: {
|
|
|
6704
6827
|
* output // => ["Logging cause: Something went wrong", Exit.fail("Something went wrong")]
|
|
6705
6828
|
* ```
|
|
6706
6829
|
*
|
|
6830
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
6831
|
+
*
|
|
6707
6832
|
* @stability stable
|
|
6708
6833
|
* @category error handling
|
|
6709
6834
|
* @since 4.0.0
|
|
@@ -6719,6 +6844,9 @@ export declare const tapCause: {
|
|
|
6719
6844
|
* the cause matches a specific predicate. This is useful for conditional logging,
|
|
6720
6845
|
* monitoring, or other side effects based on the type of failure.
|
|
6721
6846
|
*
|
|
6847
|
+
* The observer is skipped if the running fiber is interrupted in an
|
|
6848
|
+
* interruptible region.
|
|
6849
|
+
*
|
|
6722
6850
|
* **Example** (Observing selected failure causes)
|
|
6723
6851
|
*
|
|
6724
6852
|
* ```ts import.meta.vitest
|
|
@@ -6738,6 +6866,8 @@ export declare const tapCause: {
|
|
|
6738
6866
|
* output // => ["Logging failure cause: Network timeout", Exit.fail("Network timeout")]
|
|
6739
6867
|
* ```
|
|
6740
6868
|
*
|
|
6869
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
6870
|
+
*
|
|
6741
6871
|
* @stability stable
|
|
6742
6872
|
* @category error handling
|
|
6743
6873
|
* @since 4.0.0
|
|
@@ -6752,6 +6882,9 @@ export declare const tapCauseIf: {
|
|
|
6752
6882
|
* the cause matches a specific predicate. This is useful for conditional logging,
|
|
6753
6883
|
* monitoring, or other side effects based on the type of failure.
|
|
6754
6884
|
*
|
|
6885
|
+
* The observer is skipped if the running fiber is interrupted in an
|
|
6886
|
+
* interruptible region.
|
|
6887
|
+
*
|
|
6755
6888
|
* **Example** (Observing selected failure causes)
|
|
6756
6889
|
*
|
|
6757
6890
|
* ```ts import.meta.vitest
|
|
@@ -6771,6 +6904,8 @@ export declare const tapCauseIf: {
|
|
|
6771
6904
|
* output // => ["Logging failure cause: Network timeout", Exit.fail("Network timeout")]
|
|
6772
6905
|
* ```
|
|
6773
6906
|
*
|
|
6907
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
6908
|
+
*
|
|
6774
6909
|
* @stability stable
|
|
6775
6910
|
* @category error handling
|
|
6776
6911
|
* @since 4.0.0
|
|
@@ -6785,6 +6920,9 @@ export declare const tapCauseIf: {
|
|
|
6785
6920
|
* the cause matches a specific predicate. This is useful for conditional logging,
|
|
6786
6921
|
* monitoring, or other side effects based on the type of failure.
|
|
6787
6922
|
*
|
|
6923
|
+
* The observer is skipped if the running fiber is interrupted in an
|
|
6924
|
+
* interruptible region.
|
|
6925
|
+
*
|
|
6788
6926
|
* **Example** (Observing selected failure causes)
|
|
6789
6927
|
*
|
|
6790
6928
|
* ```ts import.meta.vitest
|
|
@@ -6804,6 +6942,8 @@ export declare const tapCauseIf: {
|
|
|
6804
6942
|
* output // => ["Logging failure cause: Network timeout", Exit.fail("Network timeout")]
|
|
6805
6943
|
* ```
|
|
6806
6944
|
*
|
|
6945
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
6946
|
+
*
|
|
6807
6947
|
* @stability stable
|
|
6808
6948
|
* @category error handling
|
|
6809
6949
|
* @since 4.0.0
|
|
@@ -6825,6 +6965,10 @@ export declare const tapCauseIf: {
|
|
|
6825
6965
|
* original cause. A failed filter result skips the side effect and preserves the
|
|
6826
6966
|
* original cause.
|
|
6827
6967
|
*
|
|
6968
|
+
* The observer is skipped if the running fiber is interrupted in an
|
|
6969
|
+
* interruptible region.
|
|
6970
|
+
*
|
|
6971
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
6828
6972
|
* @see {@link tapCauseIf} for selecting causes with a boolean predicate
|
|
6829
6973
|
* @see {@link tapCause} for observing every failure cause
|
|
6830
6974
|
* @see {@link catchCauseFilter} for recovering from selected causes instead of only observing them
|
|
@@ -6849,6 +6993,10 @@ export declare const tapCauseFilter: {
|
|
|
6849
6993
|
* original cause. A failed filter result skips the side effect and preserves the
|
|
6850
6994
|
* original cause.
|
|
6851
6995
|
*
|
|
6996
|
+
* The observer is skipped if the running fiber is interrupted in an
|
|
6997
|
+
* interruptible region.
|
|
6998
|
+
*
|
|
6999
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
6852
7000
|
* @see {@link tapCauseIf} for selecting causes with a boolean predicate
|
|
6853
7001
|
* @see {@link tapCause} for observing every failure cause
|
|
6854
7002
|
* @see {@link catchCauseFilter} for recovering from selected causes instead of only observing them
|
|
@@ -6873,6 +7021,10 @@ export declare const tapCauseFilter: {
|
|
|
6873
7021
|
* original cause. A failed filter result skips the side effect and preserves the
|
|
6874
7022
|
* original cause.
|
|
6875
7023
|
*
|
|
7024
|
+
* The observer is skipped if the running fiber is interrupted in an
|
|
7025
|
+
* interruptible region.
|
|
7026
|
+
*
|
|
7027
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
6876
7028
|
* @see {@link tapCauseIf} for selecting causes with a boolean predicate
|
|
6877
7029
|
* @see {@link tapCause} for observing every failure cause
|
|
6878
7030
|
* @see {@link catchCauseFilter} for recovering from selected causes instead of only observing them
|
|
@@ -7090,6 +7242,8 @@ export declare namespace Retry {
|
|
|
7090
7242
|
* succeeds, the returned effect succeeds with that value. If the policy stops
|
|
7091
7243
|
* while the effect is still failing, the last failure is propagated.
|
|
7092
7244
|
*
|
|
7245
|
+
* Scheduled delays use the context's `Clock`.
|
|
7246
|
+
*
|
|
7093
7247
|
* **Gotchas**
|
|
7094
7248
|
*
|
|
7095
7249
|
* The source effect is always evaluated once before any retry policy is
|
|
@@ -7145,6 +7299,8 @@ export declare const retry: {
|
|
|
7145
7299
|
* succeeds, the returned effect succeeds with that value. If the policy stops
|
|
7146
7300
|
* while the effect is still failing, the last failure is propagated.
|
|
7147
7301
|
*
|
|
7302
|
+
* Scheduled delays use the context's `Clock`.
|
|
7303
|
+
*
|
|
7148
7304
|
* **Gotchas**
|
|
7149
7305
|
*
|
|
7150
7306
|
* The source effect is always evaluated once before any retry policy is
|
|
@@ -7200,6 +7356,8 @@ export declare const retry: {
|
|
|
7200
7356
|
* succeeds, the returned effect succeeds with that value. If the policy stops
|
|
7201
7357
|
* while the effect is still failing, the last failure is propagated.
|
|
7202
7358
|
*
|
|
7359
|
+
* Scheduled delays use the context's `Clock`.
|
|
7360
|
+
*
|
|
7203
7361
|
* **Gotchas**
|
|
7204
7362
|
*
|
|
7205
7363
|
* The source effect is always evaluated once before any retry policy is
|
|
@@ -7255,6 +7413,8 @@ export declare const retry: {
|
|
|
7255
7413
|
* succeeds, the returned effect succeeds with that value. If the policy stops
|
|
7256
7414
|
* while the effect is still failing, the last failure is propagated.
|
|
7257
7415
|
*
|
|
7416
|
+
* Scheduled delays use the context's `Clock`.
|
|
7417
|
+
*
|
|
7258
7418
|
* **Gotchas**
|
|
7259
7419
|
*
|
|
7260
7420
|
* The source effect is always evaluated once before any retry policy is
|
|
@@ -7310,6 +7470,8 @@ export declare const retry: {
|
|
|
7310
7470
|
* succeeds, the returned effect succeeds with that value. If the policy stops
|
|
7311
7471
|
* while the effect is still failing, the last failure is propagated.
|
|
7312
7472
|
*
|
|
7473
|
+
* Scheduled delays use the context's `Clock`.
|
|
7474
|
+
*
|
|
7313
7475
|
* **Gotchas**
|
|
7314
7476
|
*
|
|
7315
7477
|
* The source effect is always evaluated once before any retry policy is
|
|
@@ -7365,6 +7527,8 @@ export declare const retry: {
|
|
|
7365
7527
|
* succeeds, the returned effect succeeds with that value. If the policy stops
|
|
7366
7528
|
* while the effect is still failing, the last failure is propagated.
|
|
7367
7529
|
*
|
|
7530
|
+
* Scheduled delays use the context's `Clock`.
|
|
7531
|
+
*
|
|
7368
7532
|
* **Gotchas**
|
|
7369
7533
|
*
|
|
7370
7534
|
* The source effect is always evaluated once before any retry policy is
|
|
@@ -7420,6 +7584,8 @@ export declare const retry: {
|
|
|
7420
7584
|
* succeeds, the returned effect succeeds with that value. If the policy stops
|
|
7421
7585
|
* while the effect is still failing, the last failure is propagated.
|
|
7422
7586
|
*
|
|
7587
|
+
* Scheduled delays use the context's `Clock`.
|
|
7588
|
+
*
|
|
7423
7589
|
* **Gotchas**
|
|
7424
7590
|
*
|
|
7425
7591
|
* The source effect is always evaluated once before any retry policy is
|
|
@@ -7477,6 +7643,8 @@ export declare const retry: {
|
|
|
7477
7643
|
* If the retries are exhausted and the effect still fails, it runs a fallback
|
|
7478
7644
|
* effect instead.
|
|
7479
7645
|
*
|
|
7646
|
+
* Scheduled delays use the context's `Clock`.
|
|
7647
|
+
*
|
|
7480
7648
|
* **Gotchas**
|
|
7481
7649
|
*
|
|
7482
7650
|
* Defects take precedence over typed errors. A failure whose cause contains a
|
|
@@ -7540,6 +7708,8 @@ export declare const retryOrElse: {
|
|
|
7540
7708
|
* If the retries are exhausted and the effect still fails, it runs a fallback
|
|
7541
7709
|
* effect instead.
|
|
7542
7710
|
*
|
|
7711
|
+
* Scheduled delays use the context's `Clock`.
|
|
7712
|
+
*
|
|
7543
7713
|
* **Gotchas**
|
|
7544
7714
|
*
|
|
7545
7715
|
* Defects take precedence over typed errors. A failure whose cause contains a
|
|
@@ -7603,6 +7773,8 @@ export declare const retryOrElse: {
|
|
|
7603
7773
|
* If the retries are exhausted and the effect still fails, it runs a fallback
|
|
7604
7774
|
* effect instead.
|
|
7605
7775
|
*
|
|
7776
|
+
* Scheduled delays use the context's `Clock`.
|
|
7777
|
+
*
|
|
7606
7778
|
* **Gotchas**
|
|
7607
7779
|
*
|
|
7608
7780
|
* Defects take precedence over typed errors. A failure whose cause contains a
|
|
@@ -7660,6 +7832,9 @@ export declare const retryOrElse: {
|
|
|
7660
7832
|
* failures, defects, and interruptions. Use `Effect.catch(Effect.failCause)` to
|
|
7661
7833
|
* restore the original typed error channel after cause-level handling.
|
|
7662
7834
|
*
|
|
7835
|
+
* Interrupting the running fiber in an interruptible region bypasses the
|
|
7836
|
+
* error channel.
|
|
7837
|
+
*
|
|
7663
7838
|
* **Example** (Exposing failures as causes)
|
|
7664
7839
|
*
|
|
7665
7840
|
* ```ts import.meta.vitest
|
|
@@ -7676,6 +7851,8 @@ export declare const retryOrElse: {
|
|
|
7676
7851
|
* Effect.runSync(program) // => "Caught cause: Something went wrong"
|
|
7677
7852
|
* ```
|
|
7678
7853
|
*
|
|
7854
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
7855
|
+
*
|
|
7679
7856
|
* @stability stable
|
|
7680
7857
|
* @category error handling
|
|
7681
7858
|
* @since 2.0.0
|
|
@@ -8238,13 +8415,24 @@ export declare const firstSuccessOf: <Eff extends Effect<any, any, any>>(effects
|
|
|
8238
8415
|
*
|
|
8239
8416
|
* The `timeout` function allows you to specify a time limit for an
|
|
8240
8417
|
* effect's execution. If the effect does not complete within the given time, a
|
|
8241
|
-
* `TimeoutError` is raised
|
|
8242
|
-
*
|
|
8243
|
-
*
|
|
8418
|
+
* `TimeoutError` is raised after the source fiber finishes its cleanup.
|
|
8419
|
+
*
|
|
8420
|
+
* Any contender the timeout starts (source or timer) is initially
|
|
8421
|
+
* interruptible, even when the timeout runs in an uninterruptible region. The
|
|
8422
|
+
* timer uses the context's `Clock`.
|
|
8244
8423
|
*
|
|
8245
8424
|
* **Gotchas**
|
|
8246
8425
|
*
|
|
8247
|
-
* If the timeout wins, the source
|
|
8426
|
+
* If the timeout wins, the source is interrupted and the returned effect waits
|
|
8427
|
+
* for the source fiber to finish, including its finalizers. The duration
|
|
8428
|
+
* determines when interruption is requested, not a deadline for completion.
|
|
8429
|
+
* If the source enters its own uninterruptible region, completion can be
|
|
8430
|
+
* delayed until that region finishes. The eventual source result is
|
|
8431
|
+
* discarded and the timeout failure is still returned.
|
|
8432
|
+
*
|
|
8433
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
8434
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
8435
|
+
* with `forkDetach` are not awaited.
|
|
8248
8436
|
*
|
|
8249
8437
|
* **Example** (Failing when work takes too long)
|
|
8250
8438
|
*
|
|
@@ -8277,13 +8465,24 @@ export declare const timeout: {
|
|
|
8277
8465
|
*
|
|
8278
8466
|
* The `timeout` function allows you to specify a time limit for an
|
|
8279
8467
|
* effect's execution. If the effect does not complete within the given time, a
|
|
8280
|
-
* `TimeoutError` is raised
|
|
8281
|
-
*
|
|
8282
|
-
*
|
|
8468
|
+
* `TimeoutError` is raised after the source fiber finishes its cleanup.
|
|
8469
|
+
*
|
|
8470
|
+
* Any contender the timeout starts (source or timer) is initially
|
|
8471
|
+
* interruptible, even when the timeout runs in an uninterruptible region. The
|
|
8472
|
+
* timer uses the context's `Clock`.
|
|
8283
8473
|
*
|
|
8284
8474
|
* **Gotchas**
|
|
8285
8475
|
*
|
|
8286
|
-
* If the timeout wins, the source
|
|
8476
|
+
* If the timeout wins, the source is interrupted and the returned effect waits
|
|
8477
|
+
* for the source fiber to finish, including its finalizers. The duration
|
|
8478
|
+
* determines when interruption is requested, not a deadline for completion.
|
|
8479
|
+
* If the source enters its own uninterruptible region, completion can be
|
|
8480
|
+
* delayed until that region finishes. The eventual source result is
|
|
8481
|
+
* discarded and the timeout failure is still returned.
|
|
8482
|
+
*
|
|
8483
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
8484
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
8485
|
+
* with `forkDetach` are not awaited.
|
|
8287
8486
|
*
|
|
8288
8487
|
* **Example** (Failing when work takes too long)
|
|
8289
8488
|
*
|
|
@@ -8316,13 +8515,24 @@ export declare const timeout: {
|
|
|
8316
8515
|
*
|
|
8317
8516
|
* The `timeout` function allows you to specify a time limit for an
|
|
8318
8517
|
* effect's execution. If the effect does not complete within the given time, a
|
|
8319
|
-
* `TimeoutError` is raised
|
|
8320
|
-
*
|
|
8321
|
-
*
|
|
8518
|
+
* `TimeoutError` is raised after the source fiber finishes its cleanup.
|
|
8519
|
+
*
|
|
8520
|
+
* Any contender the timeout starts (source or timer) is initially
|
|
8521
|
+
* interruptible, even when the timeout runs in an uninterruptible region. The
|
|
8522
|
+
* timer uses the context's `Clock`.
|
|
8322
8523
|
*
|
|
8323
8524
|
* **Gotchas**
|
|
8324
8525
|
*
|
|
8325
|
-
* If the timeout wins, the source
|
|
8526
|
+
* If the timeout wins, the source is interrupted and the returned effect waits
|
|
8527
|
+
* for the source fiber to finish, including its finalizers. The duration
|
|
8528
|
+
* determines when interruption is requested, not a deadline for completion.
|
|
8529
|
+
* If the source enters its own uninterruptible region, completion can be
|
|
8530
|
+
* delayed until that region finishes. The eventual source result is
|
|
8531
|
+
* discarded and the timeout failure is still returned.
|
|
8532
|
+
*
|
|
8533
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
8534
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
8535
|
+
* with `forkDetach` are not awaited.
|
|
8326
8536
|
*
|
|
8327
8537
|
* **Example** (Failing when work takes too long)
|
|
8328
8538
|
*
|
|
@@ -8358,6 +8568,23 @@ export declare const timeout: {
|
|
|
8358
8568
|
* interrupted and the returned effect succeeds with `Option.none`. If the
|
|
8359
8569
|
* source effect fails before the timeout, that failure is preserved.
|
|
8360
8570
|
*
|
|
8571
|
+
* Any contender the timeout starts (source or timer) is initially
|
|
8572
|
+
* interruptible, even when the timeout runs in an uninterruptible region. The
|
|
8573
|
+
* timer uses the context's `Clock`.
|
|
8574
|
+
*
|
|
8575
|
+
* **Gotchas**
|
|
8576
|
+
*
|
|
8577
|
+
* If the timeout wins, the source is interrupted and the returned effect waits
|
|
8578
|
+
* for the source fiber to finish, including its finalizers. The duration
|
|
8579
|
+
* determines when interruption is requested, not a deadline for completion.
|
|
8580
|
+
* If the source enters its own uninterruptible region, completion can be
|
|
8581
|
+
* delayed until that region finishes. The eventual source result is
|
|
8582
|
+
* discarded and the timeout still produces `Option.none`.
|
|
8583
|
+
*
|
|
8584
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
8585
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
8586
|
+
* with `forkDetach` are not awaited.
|
|
8587
|
+
*
|
|
8361
8588
|
* **Example** (Returning None on timeout)
|
|
8362
8589
|
*
|
|
8363
8590
|
* ```ts import.meta.vitest
|
|
@@ -8390,6 +8617,23 @@ export declare const timeoutOption: {
|
|
|
8390
8617
|
* interrupted and the returned effect succeeds with `Option.none`. If the
|
|
8391
8618
|
* source effect fails before the timeout, that failure is preserved.
|
|
8392
8619
|
*
|
|
8620
|
+
* Any contender the timeout starts (source or timer) is initially
|
|
8621
|
+
* interruptible, even when the timeout runs in an uninterruptible region. The
|
|
8622
|
+
* timer uses the context's `Clock`.
|
|
8623
|
+
*
|
|
8624
|
+
* **Gotchas**
|
|
8625
|
+
*
|
|
8626
|
+
* If the timeout wins, the source is interrupted and the returned effect waits
|
|
8627
|
+
* for the source fiber to finish, including its finalizers. The duration
|
|
8628
|
+
* determines when interruption is requested, not a deadline for completion.
|
|
8629
|
+
* If the source enters its own uninterruptible region, completion can be
|
|
8630
|
+
* delayed until that region finishes. The eventual source result is
|
|
8631
|
+
* discarded and the timeout still produces `Option.none`.
|
|
8632
|
+
*
|
|
8633
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
8634
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
8635
|
+
* with `forkDetach` are not awaited.
|
|
8636
|
+
*
|
|
8393
8637
|
* **Example** (Returning None on timeout)
|
|
8394
8638
|
*
|
|
8395
8639
|
* ```ts import.meta.vitest
|
|
@@ -8422,6 +8666,23 @@ export declare const timeoutOption: {
|
|
|
8422
8666
|
* interrupted and the returned effect succeeds with `Option.none`. If the
|
|
8423
8667
|
* source effect fails before the timeout, that failure is preserved.
|
|
8424
8668
|
*
|
|
8669
|
+
* Any contender the timeout starts (source or timer) is initially
|
|
8670
|
+
* interruptible, even when the timeout runs in an uninterruptible region. The
|
|
8671
|
+
* timer uses the context's `Clock`.
|
|
8672
|
+
*
|
|
8673
|
+
* **Gotchas**
|
|
8674
|
+
*
|
|
8675
|
+
* If the timeout wins, the source is interrupted and the returned effect waits
|
|
8676
|
+
* for the source fiber to finish, including its finalizers. The duration
|
|
8677
|
+
* determines when interruption is requested, not a deadline for completion.
|
|
8678
|
+
* If the source enters its own uninterruptible region, completion can be
|
|
8679
|
+
* delayed until that region finishes. The eventual source result is
|
|
8680
|
+
* discarded and the timeout still produces `Option.none`.
|
|
8681
|
+
*
|
|
8682
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
8683
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
8684
|
+
* with `forkDetach` are not awaited.
|
|
8685
|
+
*
|
|
8425
8686
|
* **Example** (Returning None on timeout)
|
|
8426
8687
|
*
|
|
8427
8688
|
* ```ts import.meta.vitest
|
|
@@ -8442,7 +8703,26 @@ export declare const timeoutOption: {
|
|
|
8442
8703
|
};
|
|
8443
8704
|
/**
|
|
8444
8705
|
* Applies a timeout to an effect, lazily evaluating `orElse` after interrupting
|
|
8445
|
-
* the source if the timeout is reached.
|
|
8706
|
+
* the source and waiting for its cleanup if the timeout is reached.
|
|
8707
|
+
*
|
|
8708
|
+
* **Details**
|
|
8709
|
+
*
|
|
8710
|
+
* Any contender the timeout starts (source or timer) is initially
|
|
8711
|
+
* interruptible, even when the timeout runs in an uninterruptible region. The
|
|
8712
|
+
* timer uses the context's `Clock`.
|
|
8713
|
+
*
|
|
8714
|
+
* **Gotchas**
|
|
8715
|
+
*
|
|
8716
|
+
* If the timeout wins, the source is interrupted and the returned effect waits
|
|
8717
|
+
* for the source fiber to finish, including its finalizers. The duration
|
|
8718
|
+
* determines when interruption is requested, not a deadline for completion.
|
|
8719
|
+
* If the source enters its own uninterruptible region, completion can be
|
|
8720
|
+
* delayed until that region finishes. The eventual source result is
|
|
8721
|
+
* discarded and the timeout still selects `orElse`.
|
|
8722
|
+
*
|
|
8723
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
8724
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
8725
|
+
* with `forkDetach` are not awaited.
|
|
8446
8726
|
*
|
|
8447
8727
|
* **Example** (Falling back on timeout)
|
|
8448
8728
|
*
|
|
@@ -8471,7 +8751,26 @@ export declare const timeoutOption: {
|
|
|
8471
8751
|
export declare const timeoutOrElse: {
|
|
8472
8752
|
/**
|
|
8473
8753
|
* Applies a timeout to an effect, lazily evaluating `orElse` after interrupting
|
|
8474
|
-
* the source if the timeout is reached.
|
|
8754
|
+
* the source and waiting for its cleanup if the timeout is reached.
|
|
8755
|
+
*
|
|
8756
|
+
* **Details**
|
|
8757
|
+
*
|
|
8758
|
+
* Any contender the timeout starts (source or timer) is initially
|
|
8759
|
+
* interruptible, even when the timeout runs in an uninterruptible region. The
|
|
8760
|
+
* timer uses the context's `Clock`.
|
|
8761
|
+
*
|
|
8762
|
+
* **Gotchas**
|
|
8763
|
+
*
|
|
8764
|
+
* If the timeout wins, the source is interrupted and the returned effect waits
|
|
8765
|
+
* for the source fiber to finish, including its finalizers. The duration
|
|
8766
|
+
* determines when interruption is requested, not a deadline for completion.
|
|
8767
|
+
* If the source enters its own uninterruptible region, completion can be
|
|
8768
|
+
* delayed until that region finishes. The eventual source result is
|
|
8769
|
+
* discarded and the timeout still selects `orElse`.
|
|
8770
|
+
*
|
|
8771
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
8772
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
8773
|
+
* with `forkDetach` are not awaited.
|
|
8475
8774
|
*
|
|
8476
8775
|
* **Example** (Falling back on timeout)
|
|
8477
8776
|
*
|
|
@@ -8503,7 +8802,26 @@ export declare const timeoutOrElse: {
|
|
|
8503
8802
|
}): <A, E, R>(self: Effect<A, E, R>) => Effect<A | A2, E | E2, R | R2>;
|
|
8504
8803
|
/**
|
|
8505
8804
|
* Applies a timeout to an effect, lazily evaluating `orElse` after interrupting
|
|
8506
|
-
* the source if the timeout is reached.
|
|
8805
|
+
* the source and waiting for its cleanup if the timeout is reached.
|
|
8806
|
+
*
|
|
8807
|
+
* **Details**
|
|
8808
|
+
*
|
|
8809
|
+
* Any contender the timeout starts (source or timer) is initially
|
|
8810
|
+
* interruptible, even when the timeout runs in an uninterruptible region. The
|
|
8811
|
+
* timer uses the context's `Clock`.
|
|
8812
|
+
*
|
|
8813
|
+
* **Gotchas**
|
|
8814
|
+
*
|
|
8815
|
+
* If the timeout wins, the source is interrupted and the returned effect waits
|
|
8816
|
+
* for the source fiber to finish, including its finalizers. The duration
|
|
8817
|
+
* determines when interruption is requested, not a deadline for completion.
|
|
8818
|
+
* If the source enters its own uninterruptible region, completion can be
|
|
8819
|
+
* delayed until that region finishes. The eventual source result is
|
|
8820
|
+
* discarded and the timeout still selects `orElse`.
|
|
8821
|
+
*
|
|
8822
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
8823
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
8824
|
+
* with `forkDetach` are not awaited.
|
|
8507
8825
|
*
|
|
8508
8826
|
* **Example** (Falling back on timeout)
|
|
8509
8827
|
*
|
|
@@ -8535,8 +8853,8 @@ export declare const timeoutOrElse: {
|
|
|
8535
8853
|
}): Effect<A | A2, E | E2, R | R2>;
|
|
8536
8854
|
};
|
|
8537
8855
|
/**
|
|
8538
|
-
*
|
|
8539
|
-
* `
|
|
8856
|
+
* Delays the start of an effect by the specified duration using the context's
|
|
8857
|
+
* `Clock`.
|
|
8540
8858
|
*
|
|
8541
8859
|
* **Example** (Delaying an effect)
|
|
8542
8860
|
*
|
|
@@ -8550,14 +8868,15 @@ export declare const timeoutOrElse: {
|
|
|
8550
8868
|
* output // => ["Delayed message"]
|
|
8551
8869
|
* ```
|
|
8552
8870
|
*
|
|
8871
|
+
* @see {@link sleep} for waiting with the current clock
|
|
8553
8872
|
* @stability stable
|
|
8554
8873
|
* @category delays & timeouts
|
|
8555
8874
|
* @since 2.0.0
|
|
8556
8875
|
*/
|
|
8557
8876
|
export declare const delay: {
|
|
8558
8877
|
/**
|
|
8559
|
-
*
|
|
8560
|
-
* `
|
|
8878
|
+
* Delays the start of an effect by the specified duration using the context's
|
|
8879
|
+
* `Clock`.
|
|
8561
8880
|
*
|
|
8562
8881
|
* **Example** (Delaying an effect)
|
|
8563
8882
|
*
|
|
@@ -8571,14 +8890,15 @@ export declare const delay: {
|
|
|
8571
8890
|
* output // => ["Delayed message"]
|
|
8572
8891
|
* ```
|
|
8573
8892
|
*
|
|
8893
|
+
* @see {@link sleep} for waiting with the current clock
|
|
8574
8894
|
* @stability stable
|
|
8575
8895
|
* @category delays & timeouts
|
|
8576
8896
|
* @since 2.0.0
|
|
8577
8897
|
*/
|
|
8578
8898
|
(duration: Duration.Input): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, R>;
|
|
8579
8899
|
/**
|
|
8580
|
-
*
|
|
8581
|
-
* `
|
|
8900
|
+
* Delays the start of an effect by the specified duration using the context's
|
|
8901
|
+
* `Clock`.
|
|
8582
8902
|
*
|
|
8583
8903
|
* **Example** (Delaying an effect)
|
|
8584
8904
|
*
|
|
@@ -8592,6 +8912,7 @@ export declare const delay: {
|
|
|
8592
8912
|
* output // => ["Delayed message"]
|
|
8593
8913
|
* ```
|
|
8594
8914
|
*
|
|
8915
|
+
* @see {@link sleep} for waiting with the current clock
|
|
8595
8916
|
* @stability stable
|
|
8596
8917
|
* @category delays & timeouts
|
|
8597
8918
|
* @since 2.0.0
|
|
@@ -8600,7 +8921,7 @@ export declare const delay: {
|
|
|
8600
8921
|
};
|
|
8601
8922
|
/**
|
|
8602
8923
|
* Returns an effect that suspends the current fiber for the specified duration
|
|
8603
|
-
* without blocking a JavaScript thread.
|
|
8924
|
+
* using the context's `Clock`, without blocking a JavaScript thread.
|
|
8604
8925
|
*
|
|
8605
8926
|
* **Example** (Pausing without blocking)
|
|
8606
8927
|
*
|
|
@@ -8660,9 +8981,24 @@ export declare const timed: <A, E, R>(self: Effect<A, E, R>) => Effect<[duration
|
|
|
8660
8981
|
* **Details**
|
|
8661
8982
|
*
|
|
8662
8983
|
* 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.
|
|
8984
|
+
* effect succeeds or every effect has failed. If one succeeds, any
|
|
8985
|
+
* still-running contenders are interrupted. If every effect fails, the
|
|
8986
|
+
* returned effect fails with a cause containing the collected failure reasons.
|
|
8987
|
+
*
|
|
8988
|
+
* Any contender the race starts is initially interruptible, even when the race
|
|
8989
|
+
* runs in an uninterruptible region.
|
|
8990
|
+
*
|
|
8991
|
+
* The returned effect completes only after the interrupted participants have
|
|
8992
|
+
* finished, including their finalizers.
|
|
8993
|
+
*
|
|
8994
|
+
* **Gotchas**
|
|
8995
|
+
*
|
|
8996
|
+
* If a losing effect enters its own uninterruptible region, the race waits
|
|
8997
|
+
* for that region to finish. The losing result is discarded.
|
|
8998
|
+
*
|
|
8999
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
9000
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
9001
|
+
* with `forkDetach` are not awaited.
|
|
8666
9002
|
*
|
|
8667
9003
|
* **Example** (Racing many effects)
|
|
8668
9004
|
*
|
|
@@ -8694,9 +9030,24 @@ export declare const raceAll: <Eff extends Effect<any, any, any>>(all: Iterable<
|
|
|
8694
9030
|
*
|
|
8695
9031
|
* **Details**
|
|
8696
9032
|
*
|
|
8697
|
-
*
|
|
8698
|
-
*
|
|
8699
|
-
*
|
|
9033
|
+
* The race requests interruption of any still-running losers. Use `raceAll`
|
|
9034
|
+
* when early failures should be ignored until a success occurs or all effects
|
|
9035
|
+
* fail.
|
|
9036
|
+
*
|
|
9037
|
+
* Any contender the race starts is initially interruptible, even when the race
|
|
9038
|
+
* runs in an uninterruptible region.
|
|
9039
|
+
*
|
|
9040
|
+
* The returned effect completes only after the interrupted participants have
|
|
9041
|
+
* finished, including their finalizers.
|
|
9042
|
+
*
|
|
9043
|
+
* **Gotchas**
|
|
9044
|
+
*
|
|
9045
|
+
* If a losing effect enters its own uninterruptible region, the race waits
|
|
9046
|
+
* for that region to finish. The losing result is discarded.
|
|
9047
|
+
*
|
|
9048
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
9049
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
9050
|
+
* with `forkDetach` are not awaited.
|
|
8700
9051
|
*
|
|
8701
9052
|
* **Example** (Taking the first settled result)
|
|
8702
9053
|
*
|
|
@@ -8726,8 +9077,23 @@ export declare const raceAllFirst: <Eff extends Effect<any, any, any>>(all: Iter
|
|
|
8726
9077
|
*
|
|
8727
9078
|
* **Details**
|
|
8728
9079
|
*
|
|
8729
|
-
* If one effect succeeds,
|
|
8730
|
-
*
|
|
9080
|
+
* If one effect succeeds, `onWinner` can observe the winning fiber. The other
|
|
9081
|
+
* effect is interrupted if it is still running. If both fail, the race fails.
|
|
9082
|
+
*
|
|
9083
|
+
* Any contender the race starts is initially interruptible, even when the race
|
|
9084
|
+
* runs in an uninterruptible region.
|
|
9085
|
+
*
|
|
9086
|
+
* The returned effect completes only after the interrupted participants have
|
|
9087
|
+
* finished, including their finalizers.
|
|
9088
|
+
*
|
|
9089
|
+
* **Gotchas**
|
|
9090
|
+
*
|
|
9091
|
+
* If a losing effect enters its own uninterruptible region, the race waits
|
|
9092
|
+
* for that region to finish. The losing result is discarded.
|
|
9093
|
+
*
|
|
9094
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
9095
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
9096
|
+
* with `forkDetach` are not awaited.
|
|
8731
9097
|
*
|
|
8732
9098
|
* **Example** (Racing two effects)
|
|
8733
9099
|
*
|
|
@@ -8757,8 +9123,23 @@ export declare const race: {
|
|
|
8757
9123
|
*
|
|
8758
9124
|
* **Details**
|
|
8759
9125
|
*
|
|
8760
|
-
* If one effect succeeds,
|
|
8761
|
-
*
|
|
9126
|
+
* If one effect succeeds, `onWinner` can observe the winning fiber. The other
|
|
9127
|
+
* effect is interrupted if it is still running. If both fail, the race fails.
|
|
9128
|
+
*
|
|
9129
|
+
* Any contender the race starts is initially interruptible, even when the race
|
|
9130
|
+
* runs in an uninterruptible region.
|
|
9131
|
+
*
|
|
9132
|
+
* The returned effect completes only after the interrupted participants have
|
|
9133
|
+
* finished, including their finalizers.
|
|
9134
|
+
*
|
|
9135
|
+
* **Gotchas**
|
|
9136
|
+
*
|
|
9137
|
+
* If a losing effect enters its own uninterruptible region, the race waits
|
|
9138
|
+
* for that region to finish. The losing result is discarded.
|
|
9139
|
+
*
|
|
9140
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
9141
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
9142
|
+
* with `forkDetach` are not awaited.
|
|
8762
9143
|
*
|
|
8763
9144
|
* **Example** (Racing two effects)
|
|
8764
9145
|
*
|
|
@@ -8794,8 +9175,23 @@ export declare const race: {
|
|
|
8794
9175
|
*
|
|
8795
9176
|
* **Details**
|
|
8796
9177
|
*
|
|
8797
|
-
* If one effect succeeds,
|
|
8798
|
-
*
|
|
9178
|
+
* If one effect succeeds, `onWinner` can observe the winning fiber. The other
|
|
9179
|
+
* effect is interrupted if it is still running. If both fail, the race fails.
|
|
9180
|
+
*
|
|
9181
|
+
* Any contender the race starts is initially interruptible, even when the race
|
|
9182
|
+
* runs in an uninterruptible region.
|
|
9183
|
+
*
|
|
9184
|
+
* The returned effect completes only after the interrupted participants have
|
|
9185
|
+
* finished, including their finalizers.
|
|
9186
|
+
*
|
|
9187
|
+
* **Gotchas**
|
|
9188
|
+
*
|
|
9189
|
+
* If a losing effect enters its own uninterruptible region, the race waits
|
|
9190
|
+
* for that region to finish. The losing result is discarded.
|
|
9191
|
+
*
|
|
9192
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
9193
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
9194
|
+
* with `forkDetach` are not awaited.
|
|
8799
9195
|
*
|
|
8800
9196
|
* **Example** (Racing two effects)
|
|
8801
9197
|
*
|
|
@@ -8833,12 +9229,27 @@ export declare const race: {
|
|
|
8833
9229
|
*
|
|
8834
9230
|
* **When to use**
|
|
8835
9231
|
*
|
|
8836
|
-
* Use when any completion, including failure, should decide the race
|
|
8837
|
-
* interrupt the losing effect.
|
|
9232
|
+
* Use when any completion, including failure, should decide the race.
|
|
8838
9233
|
*
|
|
8839
9234
|
* **Details**
|
|
8840
9235
|
*
|
|
8841
|
-
* The losing effect is interrupted
|
|
9236
|
+
* The losing effect is interrupted if it is still running. `onWinner` can
|
|
9237
|
+
* observe the winning fiber.
|
|
9238
|
+
*
|
|
9239
|
+
* Any contender the race starts is initially interruptible, even when the race
|
|
9240
|
+
* runs in an uninterruptible region.
|
|
9241
|
+
*
|
|
9242
|
+
* The returned effect completes only after the interrupted participants have
|
|
9243
|
+
* finished, including their finalizers.
|
|
9244
|
+
*
|
|
9245
|
+
* **Gotchas**
|
|
9246
|
+
*
|
|
9247
|
+
* If a losing effect enters its own uninterruptible region, the race waits
|
|
9248
|
+
* for that region to finish. The losing result is discarded.
|
|
9249
|
+
*
|
|
9250
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
9251
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
9252
|
+
* with `forkDetach` are not awaited.
|
|
8842
9253
|
*
|
|
8843
9254
|
* **Example** (Observing the winning fiber)
|
|
8844
9255
|
*
|
|
@@ -8872,12 +9283,27 @@ export declare const raceFirst: {
|
|
|
8872
9283
|
*
|
|
8873
9284
|
* **When to use**
|
|
8874
9285
|
*
|
|
8875
|
-
* Use when any completion, including failure, should decide the race
|
|
8876
|
-
* interrupt the losing effect.
|
|
9286
|
+
* Use when any completion, including failure, should decide the race.
|
|
8877
9287
|
*
|
|
8878
9288
|
* **Details**
|
|
8879
9289
|
*
|
|
8880
|
-
* The losing effect is interrupted
|
|
9290
|
+
* The losing effect is interrupted if it is still running. `onWinner` can
|
|
9291
|
+
* observe the winning fiber.
|
|
9292
|
+
*
|
|
9293
|
+
* Any contender the race starts is initially interruptible, even when the race
|
|
9294
|
+
* runs in an uninterruptible region.
|
|
9295
|
+
*
|
|
9296
|
+
* The returned effect completes only after the interrupted participants have
|
|
9297
|
+
* finished, including their finalizers.
|
|
9298
|
+
*
|
|
9299
|
+
* **Gotchas**
|
|
9300
|
+
*
|
|
9301
|
+
* If a losing effect enters its own uninterruptible region, the race waits
|
|
9302
|
+
* for that region to finish. The losing result is discarded.
|
|
9303
|
+
*
|
|
9304
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
9305
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
9306
|
+
* with `forkDetach` are not awaited.
|
|
8881
9307
|
*
|
|
8882
9308
|
* **Example** (Observing the winning fiber)
|
|
8883
9309
|
*
|
|
@@ -8917,12 +9343,27 @@ export declare const raceFirst: {
|
|
|
8917
9343
|
*
|
|
8918
9344
|
* **When to use**
|
|
8919
9345
|
*
|
|
8920
|
-
* Use when any completion, including failure, should decide the race
|
|
8921
|
-
* interrupt the losing effect.
|
|
9346
|
+
* Use when any completion, including failure, should decide the race.
|
|
8922
9347
|
*
|
|
8923
9348
|
* **Details**
|
|
8924
9349
|
*
|
|
8925
|
-
* The losing effect is interrupted
|
|
9350
|
+
* The losing effect is interrupted if it is still running. `onWinner` can
|
|
9351
|
+
* observe the winning fiber.
|
|
9352
|
+
*
|
|
9353
|
+
* Any contender the race starts is initially interruptible, even when the race
|
|
9354
|
+
* runs in an uninterruptible region.
|
|
9355
|
+
*
|
|
9356
|
+
* The returned effect completes only after the interrupted participants have
|
|
9357
|
+
* finished, including their finalizers.
|
|
9358
|
+
*
|
|
9359
|
+
* **Gotchas**
|
|
9360
|
+
*
|
|
9361
|
+
* If a losing effect enters its own uninterruptible region, the race waits
|
|
9362
|
+
* for that region to finish. The losing result is discarded.
|
|
9363
|
+
*
|
|
9364
|
+
* Waiting for fiber cleanup does not ensure external work stops: a Promise
|
|
9365
|
+
* can keep running unless the operation honors cancellation. Fibers started
|
|
9366
|
+
* with `forkDetach` are not awaited.
|
|
8926
9367
|
*
|
|
8927
9368
|
* **Example** (Observing the winning fiber)
|
|
8928
9369
|
*
|
|
@@ -10406,6 +10847,9 @@ export declare const matchEager: {
|
|
|
10406
10847
|
* The `matchCause` function allows you to handle failures with access to the
|
|
10407
10848
|
* full cause of the failure within a fiber.
|
|
10408
10849
|
*
|
|
10850
|
+
* The failure handler is skipped if the running fiber is interrupted in an
|
|
10851
|
+
* interruptible region.
|
|
10852
|
+
*
|
|
10409
10853
|
* **Example** (Matching on success or failure causes)
|
|
10410
10854
|
*
|
|
10411
10855
|
* ```ts import.meta.vitest
|
|
@@ -10421,6 +10865,7 @@ export declare const matchEager: {
|
|
|
10421
10865
|
* Effect.runSync(program) // => "Failed: Something went wrong"
|
|
10422
10866
|
* ```
|
|
10423
10867
|
*
|
|
10868
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
10424
10869
|
* @see {@link matchCauseEffect} if you need to perform side effects in the
|
|
10425
10870
|
* handlers.
|
|
10426
10871
|
* @see {@link match} if you don't need to handle the cause of the failure.
|
|
@@ -10442,6 +10887,9 @@ export declare const matchCause: {
|
|
|
10442
10887
|
* The `matchCause` function allows you to handle failures with access to the
|
|
10443
10888
|
* full cause of the failure within a fiber.
|
|
10444
10889
|
*
|
|
10890
|
+
* The failure handler is skipped if the running fiber is interrupted in an
|
|
10891
|
+
* interruptible region.
|
|
10892
|
+
*
|
|
10445
10893
|
* **Example** (Matching on success or failure causes)
|
|
10446
10894
|
*
|
|
10447
10895
|
* ```ts import.meta.vitest
|
|
@@ -10457,6 +10905,7 @@ export declare const matchCause: {
|
|
|
10457
10905
|
* Effect.runSync(program) // => "Failed: Something went wrong"
|
|
10458
10906
|
* ```
|
|
10459
10907
|
*
|
|
10908
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
10460
10909
|
* @see {@link matchCauseEffect} if you need to perform side effects in the
|
|
10461
10910
|
* handlers.
|
|
10462
10911
|
* @see {@link match} if you don't need to handle the cause of the failure.
|
|
@@ -10481,6 +10930,9 @@ export declare const matchCause: {
|
|
|
10481
10930
|
* The `matchCause` function allows you to handle failures with access to the
|
|
10482
10931
|
* full cause of the failure within a fiber.
|
|
10483
10932
|
*
|
|
10933
|
+
* The failure handler is skipped if the running fiber is interrupted in an
|
|
10934
|
+
* interruptible region.
|
|
10935
|
+
*
|
|
10484
10936
|
* **Example** (Matching on success or failure causes)
|
|
10485
10937
|
*
|
|
10486
10938
|
* ```ts import.meta.vitest
|
|
@@ -10496,6 +10948,7 @@ export declare const matchCause: {
|
|
|
10496
10948
|
* Effect.runSync(program) // => "Failed: Something went wrong"
|
|
10497
10949
|
* ```
|
|
10498
10950
|
*
|
|
10951
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
10499
10952
|
* @see {@link matchCauseEffect} if you need to perform side effects in the
|
|
10500
10953
|
* handlers.
|
|
10501
10954
|
* @see {@link match} if you don't need to handle the cause of the failure.
|
|
@@ -10522,6 +10975,9 @@ export declare const matchCause: {
|
|
|
10522
10975
|
* effects by immediately applying the matching function instead of deferring it
|
|
10523
10976
|
* through the effect pipeline.
|
|
10524
10977
|
*
|
|
10978
|
+
* Unless the effect is already an `Exit`, the failure handler is skipped if
|
|
10979
|
+
* the running fiber is interrupted in an interruptible region.
|
|
10980
|
+
*
|
|
10525
10981
|
* **Example** (Eagerly matching already completed effects)
|
|
10526
10982
|
*
|
|
10527
10983
|
* ```ts import.meta.vitest
|
|
@@ -10534,6 +10990,8 @@ export declare const matchCause: {
|
|
|
10534
10990
|
* Effect.runSync(handleResult) // => "Success: 42"
|
|
10535
10991
|
* ```
|
|
10536
10992
|
*
|
|
10993
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
10994
|
+
*
|
|
10537
10995
|
* @stability stable
|
|
10538
10996
|
* @category pattern matching
|
|
10539
10997
|
* @since 4.0.0
|
|
@@ -10553,6 +11011,9 @@ export declare const matchCauseEager: {
|
|
|
10553
11011
|
* effects by immediately applying the matching function instead of deferring it
|
|
10554
11012
|
* through the effect pipeline.
|
|
10555
11013
|
*
|
|
11014
|
+
* Unless the effect is already an `Exit`, the failure handler is skipped if
|
|
11015
|
+
* the running fiber is interrupted in an interruptible region.
|
|
11016
|
+
*
|
|
10556
11017
|
* **Example** (Eagerly matching already completed effects)
|
|
10557
11018
|
*
|
|
10558
11019
|
* ```ts import.meta.vitest
|
|
@@ -10565,6 +11026,8 @@ export declare const matchCauseEager: {
|
|
|
10565
11026
|
* Effect.runSync(handleResult) // => "Success: 42"
|
|
10566
11027
|
* ```
|
|
10567
11028
|
*
|
|
11029
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
11030
|
+
*
|
|
10568
11031
|
* @stability stable
|
|
10569
11032
|
* @category pattern matching
|
|
10570
11033
|
* @since 4.0.0
|
|
@@ -10587,6 +11050,9 @@ export declare const matchCauseEager: {
|
|
|
10587
11050
|
* effects by immediately applying the matching function instead of deferring it
|
|
10588
11051
|
* through the effect pipeline.
|
|
10589
11052
|
*
|
|
11053
|
+
* Unless the effect is already an `Exit`, the failure handler is skipped if
|
|
11054
|
+
* the running fiber is interrupted in an interruptible region.
|
|
11055
|
+
*
|
|
10590
11056
|
* **Example** (Eagerly matching already completed effects)
|
|
10591
11057
|
*
|
|
10592
11058
|
* ```ts import.meta.vitest
|
|
@@ -10599,6 +11065,8 @@ export declare const matchCauseEager: {
|
|
|
10599
11065
|
* Effect.runSync(handleResult) // => "Success: 42"
|
|
10600
11066
|
* ```
|
|
10601
11067
|
*
|
|
11068
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
11069
|
+
*
|
|
10602
11070
|
* @stability stable
|
|
10603
11071
|
* @category pattern matching
|
|
10604
11072
|
* @since 4.0.0
|
|
@@ -10621,6 +11089,10 @@ export declare const matchCauseEager: {
|
|
|
10621
11089
|
* If the effect is an `Exit`, the matching handler runs immediately; otherwise it behaves like
|
|
10622
11090
|
* {@link matchCauseEffect}.
|
|
10623
11091
|
*
|
|
11092
|
+
* Unless the effect is already an `Exit`, the failure handler is skipped if
|
|
11093
|
+
* the running fiber is interrupted in an interruptible region.
|
|
11094
|
+
*
|
|
11095
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
10624
11096
|
* @see {@link matchCauseEffect} for the non-eager effectful variant
|
|
10625
11097
|
* @see {@link matchCauseEager} for eager cause matching with pure handlers
|
|
10626
11098
|
* @see {@link matchEffect} for effectful matching on typed failures instead of full causes
|
|
@@ -10643,6 +11115,10 @@ export declare const matchCauseEffectEager: {
|
|
|
10643
11115
|
* If the effect is an `Exit`, the matching handler runs immediately; otherwise it behaves like
|
|
10644
11116
|
* {@link matchCauseEffect}.
|
|
10645
11117
|
*
|
|
11118
|
+
* Unless the effect is already an `Exit`, the failure handler is skipped if
|
|
11119
|
+
* the running fiber is interrupted in an interruptible region.
|
|
11120
|
+
*
|
|
11121
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
10646
11122
|
* @see {@link matchCauseEffect} for the non-eager effectful variant
|
|
10647
11123
|
* @see {@link matchCauseEager} for eager cause matching with pure handlers
|
|
10648
11124
|
* @see {@link matchEffect} for effectful matching on typed failures instead of full causes
|
|
@@ -10668,6 +11144,10 @@ export declare const matchCauseEffectEager: {
|
|
|
10668
11144
|
* If the effect is an `Exit`, the matching handler runs immediately; otherwise it behaves like
|
|
10669
11145
|
* {@link matchCauseEffect}.
|
|
10670
11146
|
*
|
|
11147
|
+
* Unless the effect is already an `Exit`, the failure handler is skipped if
|
|
11148
|
+
* the running fiber is interrupted in an interruptible region.
|
|
11149
|
+
*
|
|
11150
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
10671
11151
|
* @see {@link matchCauseEffect} for the non-eager effectful variant
|
|
10672
11152
|
* @see {@link matchCauseEager} for eager cause matching with pure handlers
|
|
10673
11153
|
* @see {@link matchEffect} for effectful matching on typed failures instead of full causes
|
|
@@ -10698,6 +11178,9 @@ export declare const matchCauseEffectEager: {
|
|
|
10698
11178
|
* you to respond accordingly while performing side effects (like logging or
|
|
10699
11179
|
* other operations).
|
|
10700
11180
|
*
|
|
11181
|
+
* The failure handler is skipped if the running fiber is interrupted in an
|
|
11182
|
+
* interruptible region.
|
|
11183
|
+
*
|
|
10701
11184
|
* **Example** (Effectfully matching on causes)
|
|
10702
11185
|
*
|
|
10703
11186
|
* ```ts import.meta.vitest
|
|
@@ -10733,6 +11216,7 @@ export declare const matchCauseEffectEager: {
|
|
|
10733
11216
|
* output // => ["Handling error: Task failed", "recovered from error"]
|
|
10734
11217
|
* ```
|
|
10735
11218
|
*
|
|
11219
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
10736
11220
|
* @see {@link matchCause} if you don't need side effects and only want to handle the result or failure.
|
|
10737
11221
|
* @see {@link matchEffect} if you don't need to handle the cause of the failure.
|
|
10738
11222
|
*
|
|
@@ -10758,6 +11242,9 @@ export declare const matchCauseEffect: {
|
|
|
10758
11242
|
* you to respond accordingly while performing side effects (like logging or
|
|
10759
11243
|
* other operations).
|
|
10760
11244
|
*
|
|
11245
|
+
* The failure handler is skipped if the running fiber is interrupted in an
|
|
11246
|
+
* interruptible region.
|
|
11247
|
+
*
|
|
10761
11248
|
* **Example** (Effectfully matching on causes)
|
|
10762
11249
|
*
|
|
10763
11250
|
* ```ts import.meta.vitest
|
|
@@ -10793,6 +11280,7 @@ export declare const matchCauseEffect: {
|
|
|
10793
11280
|
* output // => ["Handling error: Task failed", "recovered from error"]
|
|
10794
11281
|
* ```
|
|
10795
11282
|
*
|
|
11283
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
10796
11284
|
* @see {@link matchCause} if you don't need side effects and only want to handle the result or failure.
|
|
10797
11285
|
* @see {@link matchEffect} if you don't need to handle the cause of the failure.
|
|
10798
11286
|
*
|
|
@@ -10821,6 +11309,9 @@ export declare const matchCauseEffect: {
|
|
|
10821
11309
|
* you to respond accordingly while performing side effects (like logging or
|
|
10822
11310
|
* other operations).
|
|
10823
11311
|
*
|
|
11312
|
+
* The failure handler is skipped if the running fiber is interrupted in an
|
|
11313
|
+
* interruptible region.
|
|
11314
|
+
*
|
|
10824
11315
|
* **Example** (Effectfully matching on causes)
|
|
10825
11316
|
*
|
|
10826
11317
|
* ```ts import.meta.vitest
|
|
@@ -10856,6 +11347,7 @@ export declare const matchCauseEffect: {
|
|
|
10856
11347
|
* output // => ["Handling error: Task failed", "recovered from error"]
|
|
10857
11348
|
* ```
|
|
10858
11349
|
*
|
|
11350
|
+
* @see {@link catchCause} for fiber interruption versus interruption in a cause
|
|
10859
11351
|
* @see {@link matchCause} if you don't need side effects and only want to handle the result or failure.
|
|
10860
11352
|
* @see {@link matchEffect} if you don't need to handle the cause of the failure.
|
|
10861
11353
|
*
|
|
@@ -12617,9 +13109,10 @@ export declare const scopedWith: <A, E, R>(f: (scope: Scope) => Effect<A, E, R>)
|
|
|
12617
13109
|
*
|
|
12618
13110
|
* **Details**
|
|
12619
13111
|
*
|
|
12620
|
-
*
|
|
12621
|
-
*
|
|
12622
|
-
* `Exit
|
|
13112
|
+
* After successful acquisition, release is registered on the scope. If the
|
|
13113
|
+
* scope is open, `Scope.close` runs it according to the scope's finalizer
|
|
13114
|
+
* strategy and passes it the closing `Exit`. If the scope is already closed,
|
|
13115
|
+
* release runs immediately with that `Exit`.
|
|
12623
13116
|
*
|
|
12624
13117
|
* By default, acquisition is protected by an uninterruptible region. Pass
|
|
12625
13118
|
* `{ interruptible: true }` to allow the acquisition effect to be interrupted.
|
|
@@ -12744,8 +13237,12 @@ export declare const acquireDisposable: <A extends AsyncDisposable | Disposable,
|
|
|
12744
13237
|
* and will be executed as long as the acquisition `Effect` value
|
|
12745
13238
|
* successfully acquires the resource.
|
|
12746
13239
|
*
|
|
12747
|
-
*
|
|
12748
|
-
*
|
|
13240
|
+
* `use` runs with the interruptibility of the surrounding region. In an
|
|
13241
|
+
* interruptible region, it can be interrupted, and `release` receives an `Exit`
|
|
13242
|
+
* whose cause contains the interruption. In an uninterruptible region, `use`
|
|
13243
|
+
* runs to completion unless it explicitly restores interruptibility.
|
|
13244
|
+
*
|
|
13245
|
+
* The returned effect waits for release to finish, including when interrupted.
|
|
12749
13246
|
*
|
|
12750
13247
|
* If the `release` `Effect` value fails, then the entire `Effect` value will
|
|
12751
13248
|
* fail, even if the `use` `Effect` value succeeds. If this fail-fast behavior
|
|
@@ -12811,8 +13308,9 @@ export declare const acquireUseRelease: <Resource, E, R, A, E2, R2, E3, R3>(acqu
|
|
|
12811
13308
|
*
|
|
12812
13309
|
* **Details**
|
|
12813
13310
|
*
|
|
12814
|
-
*
|
|
12815
|
-
*
|
|
13311
|
+
* If the scope is open, `Scope.close` runs the finalizer according to the
|
|
13312
|
+
* scope's finalizer strategy and passes it the closing `Exit`. If the scope is
|
|
13313
|
+
* already closed, the finalizer runs immediately with that `Exit`.
|
|
12816
13314
|
*
|
|
12817
13315
|
* **Example** (Registering scope finalizers)
|
|
12818
13316
|
*
|
|
@@ -12857,12 +13355,12 @@ export declare const addFinalizer: <R>(finalizer: (exit: Exit.Exit<unknown, unkn
|
|
|
12857
13355
|
*
|
|
12858
13356
|
* **Details**
|
|
12859
13357
|
*
|
|
12860
|
-
* For use cases that need access to the effect's result, see `onExit`.
|
|
12861
|
-
*
|
|
12862
13358
|
* Finalizers offer very powerful guarantees, but they are low-level, and
|
|
12863
13359
|
* should generally not be used for releasing resources. For higher-level
|
|
12864
13360
|
* logic built on `ensuring`, see the `acquireRelease` family of methods.
|
|
12865
13361
|
*
|
|
13362
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
13363
|
+
*
|
|
12866
13364
|
* **Example** (Always running cleanup)
|
|
12867
13365
|
*
|
|
12868
13366
|
* ```ts import.meta.vitest
|
|
@@ -12897,12 +13395,12 @@ export declare const ensuring: {
|
|
|
12897
13395
|
*
|
|
12898
13396
|
* **Details**
|
|
12899
13397
|
*
|
|
12900
|
-
* For use cases that need access to the effect's result, see `onExit`.
|
|
12901
|
-
*
|
|
12902
13398
|
* Finalizers offer very powerful guarantees, but they are low-level, and
|
|
12903
13399
|
* should generally not be used for releasing resources. For higher-level
|
|
12904
13400
|
* logic built on `ensuring`, see the `acquireRelease` family of methods.
|
|
12905
13401
|
*
|
|
13402
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
13403
|
+
*
|
|
12906
13404
|
* **Example** (Always running cleanup)
|
|
12907
13405
|
*
|
|
12908
13406
|
* ```ts import.meta.vitest
|
|
@@ -12937,12 +13435,12 @@ export declare const ensuring: {
|
|
|
12937
13435
|
*
|
|
12938
13436
|
* **Details**
|
|
12939
13437
|
*
|
|
12940
|
-
* For use cases that need access to the effect's result, see `onExit`.
|
|
12941
|
-
*
|
|
12942
13438
|
* Finalizers offer very powerful guarantees, but they are low-level, and
|
|
12943
13439
|
* should generally not be used for releasing resources. For higher-level
|
|
12944
13440
|
* logic built on `ensuring`, see the `acquireRelease` family of methods.
|
|
12945
13441
|
*
|
|
13442
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
13443
|
+
*
|
|
12946
13444
|
* **Example** (Always running cleanup)
|
|
12947
13445
|
*
|
|
12948
13446
|
* ```ts import.meta.vitest
|
|
@@ -13063,6 +13561,10 @@ export declare const onError: {
|
|
|
13063
13561
|
* Runs the finalizer only when this effect fails and the `Cause` matches the
|
|
13064
13562
|
* provided predicate.
|
|
13065
13563
|
*
|
|
13564
|
+
* **Details**
|
|
13565
|
+
*
|
|
13566
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
13567
|
+
*
|
|
13066
13568
|
* **Example** (Running cleanup for selected failures)
|
|
13067
13569
|
*
|
|
13068
13570
|
* ```ts import.meta.vitest
|
|
@@ -13093,6 +13595,10 @@ export declare const onErrorIf: {
|
|
|
13093
13595
|
* Runs the finalizer only when this effect fails and the `Cause` matches the
|
|
13094
13596
|
* provided predicate.
|
|
13095
13597
|
*
|
|
13598
|
+
* **Details**
|
|
13599
|
+
*
|
|
13600
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
13601
|
+
*
|
|
13096
13602
|
* **Example** (Running cleanup for selected failures)
|
|
13097
13603
|
*
|
|
13098
13604
|
* ```ts import.meta.vitest
|
|
@@ -13123,6 +13629,10 @@ export declare const onErrorIf: {
|
|
|
13123
13629
|
* Runs the finalizer only when this effect fails and the `Cause` matches the
|
|
13124
13630
|
* provided predicate.
|
|
13125
13631
|
*
|
|
13632
|
+
* **Details**
|
|
13633
|
+
*
|
|
13634
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
13635
|
+
*
|
|
13126
13636
|
* **Example** (Running cleanup for selected failures)
|
|
13127
13637
|
*
|
|
13128
13638
|
* ```ts import.meta.vitest
|
|
@@ -13159,6 +13669,10 @@ export declare const onErrorIf: {
|
|
|
13159
13669
|
* `Cause` is accepted or transformed by a `Filter`, and the finalizer needs the
|
|
13160
13670
|
* filter's pass value plus the original cause.
|
|
13161
13671
|
*
|
|
13672
|
+
* **Details**
|
|
13673
|
+
*
|
|
13674
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
13675
|
+
*
|
|
13162
13676
|
* @see {@link onError} for cleanup on every failure
|
|
13163
13677
|
* @see {@link onErrorIf} for selecting failures with a boolean predicate
|
|
13164
13678
|
* @see {@link onExitFilter} for selecting from every exit instead of only failures
|
|
@@ -13177,6 +13691,10 @@ export declare const onErrorFilter: {
|
|
|
13177
13691
|
* `Cause` is accepted or transformed by a `Filter`, and the finalizer needs the
|
|
13178
13692
|
* filter's pass value plus the original cause.
|
|
13179
13693
|
*
|
|
13694
|
+
* **Details**
|
|
13695
|
+
*
|
|
13696
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
13697
|
+
*
|
|
13180
13698
|
* @see {@link onError} for cleanup on every failure
|
|
13181
13699
|
* @see {@link onErrorIf} for selecting failures with a boolean predicate
|
|
13182
13700
|
* @see {@link onExitFilter} for selecting from every exit instead of only failures
|
|
@@ -13195,6 +13713,10 @@ export declare const onErrorFilter: {
|
|
|
13195
13713
|
* `Cause` is accepted or transformed by a `Filter`, and the finalizer needs the
|
|
13196
13714
|
* filter's pass value plus the original cause.
|
|
13197
13715
|
*
|
|
13716
|
+
* **Details**
|
|
13717
|
+
*
|
|
13718
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
13719
|
+
*
|
|
13198
13720
|
* @see {@link onError} for cleanup on every failure
|
|
13199
13721
|
* @see {@link onErrorIf} for selecting failures with a boolean predicate
|
|
13200
13722
|
* @see {@link onExitFilter} for selecting from every exit instead of only failures
|
|
@@ -13236,6 +13758,15 @@ export declare const onExitPrimitive: <A, E, R, XE = never, XR = never>(self: Ef
|
|
|
13236
13758
|
*
|
|
13237
13759
|
* If both the effect and the cleanup function fail, the two causes are merged.
|
|
13238
13760
|
*
|
|
13761
|
+
* Cleanup runs in an uninterruptible region. `Fiber.interrupt` waits for it
|
|
13762
|
+
* to finish. Wrap a part of cleanup in `Effect.interruptible` to allow that
|
|
13763
|
+
* part to be interrupted.
|
|
13764
|
+
*
|
|
13765
|
+
* **Gotchas**
|
|
13766
|
+
*
|
|
13767
|
+
* If interruption is already pending, a part of cleanup wrapped in
|
|
13768
|
+
* `Effect.interruptible` is interrupted before it starts.
|
|
13769
|
+
*
|
|
13239
13770
|
* **Example** (Observing every exit)
|
|
13240
13771
|
*
|
|
13241
13772
|
* ```ts import.meta.vitest
|
|
@@ -13268,6 +13799,15 @@ export declare const onExit: {
|
|
|
13268
13799
|
*
|
|
13269
13800
|
* If both the effect and the cleanup function fail, the two causes are merged.
|
|
13270
13801
|
*
|
|
13802
|
+
* Cleanup runs in an uninterruptible region. `Fiber.interrupt` waits for it
|
|
13803
|
+
* to finish. Wrap a part of cleanup in `Effect.interruptible` to allow that
|
|
13804
|
+
* part to be interrupted.
|
|
13805
|
+
*
|
|
13806
|
+
* **Gotchas**
|
|
13807
|
+
*
|
|
13808
|
+
* If interruption is already pending, a part of cleanup wrapped in
|
|
13809
|
+
* `Effect.interruptible` is interrupted before it starts.
|
|
13810
|
+
*
|
|
13271
13811
|
* **Example** (Observing every exit)
|
|
13272
13812
|
*
|
|
13273
13813
|
* ```ts import.meta.vitest
|
|
@@ -13300,6 +13840,15 @@ export declare const onExit: {
|
|
|
13300
13840
|
*
|
|
13301
13841
|
* If both the effect and the cleanup function fail, the two causes are merged.
|
|
13302
13842
|
*
|
|
13843
|
+
* Cleanup runs in an uninterruptible region. `Fiber.interrupt` waits for it
|
|
13844
|
+
* to finish. Wrap a part of cleanup in `Effect.interruptible` to allow that
|
|
13845
|
+
* part to be interrupted.
|
|
13846
|
+
*
|
|
13847
|
+
* **Gotchas**
|
|
13848
|
+
*
|
|
13849
|
+
* If interruption is already pending, a part of cleanup wrapped in
|
|
13850
|
+
* `Effect.interruptible` is interrupted before it starts.
|
|
13851
|
+
*
|
|
13303
13852
|
* **Example** (Observing every exit)
|
|
13304
13853
|
*
|
|
13305
13854
|
* ```ts import.meta.vitest
|
|
@@ -13329,6 +13878,10 @@ export declare const onExit: {
|
|
|
13329
13878
|
* Runs the cleanup effect only when the `Exit` satisfies the provided
|
|
13330
13879
|
* predicate.
|
|
13331
13880
|
*
|
|
13881
|
+
* **Details**
|
|
13882
|
+
*
|
|
13883
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
13884
|
+
*
|
|
13332
13885
|
* **Example** (Observing selected exits)
|
|
13333
13886
|
*
|
|
13334
13887
|
* ```ts import.meta.vitest
|
|
@@ -13357,6 +13910,10 @@ export declare const onExitIf: {
|
|
|
13357
13910
|
* Runs the cleanup effect only when the `Exit` satisfies the provided
|
|
13358
13911
|
* predicate.
|
|
13359
13912
|
*
|
|
13913
|
+
* **Details**
|
|
13914
|
+
*
|
|
13915
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
13916
|
+
*
|
|
13360
13917
|
* **Example** (Observing selected exits)
|
|
13361
13918
|
*
|
|
13362
13919
|
* ```ts import.meta.vitest
|
|
@@ -13385,6 +13942,10 @@ export declare const onExitIf: {
|
|
|
13385
13942
|
* Runs the cleanup effect only when the `Exit` satisfies the provided
|
|
13386
13943
|
* predicate.
|
|
13387
13944
|
*
|
|
13945
|
+
* **Details**
|
|
13946
|
+
*
|
|
13947
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
13948
|
+
*
|
|
13388
13949
|
* **Example** (Observing selected exits)
|
|
13389
13950
|
*
|
|
13390
13951
|
* ```ts import.meta.vitest
|
|
@@ -13424,6 +13985,8 @@ export declare const onExitIf: {
|
|
|
13424
13985
|
* `Result.fail` skips cleanup, and `Result.succeed` runs cleanup with the
|
|
13425
13986
|
* selected value and the original `Exit`.
|
|
13426
13987
|
*
|
|
13988
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
13989
|
+
*
|
|
13427
13990
|
* @see {@link onExit} for cleanup on every exit
|
|
13428
13991
|
* @see {@link onExitIf} for selecting exits with a boolean predicate
|
|
13429
13992
|
* @see {@link onErrorFilter} for selecting only failure causes
|
|
@@ -13447,6 +14010,8 @@ export declare const onExitFilter: {
|
|
|
13447
14010
|
* `Result.fail` skips cleanup, and `Result.succeed` runs cleanup with the
|
|
13448
14011
|
* selected value and the original `Exit`.
|
|
13449
14012
|
*
|
|
14013
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
14014
|
+
*
|
|
13450
14015
|
* @see {@link onExit} for cleanup on every exit
|
|
13451
14016
|
* @see {@link onExitIf} for selecting exits with a boolean predicate
|
|
13452
14017
|
* @see {@link onErrorFilter} for selecting only failure causes
|
|
@@ -13470,6 +14035,8 @@ export declare const onExitFilter: {
|
|
|
13470
14035
|
* `Result.fail` skips cleanup, and `Result.succeed` runs cleanup with the
|
|
13471
14036
|
* selected value and the original `Exit`.
|
|
13472
14037
|
*
|
|
14038
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
14039
|
+
*
|
|
13473
14040
|
* @see {@link onExit} for cleanup on every exit
|
|
13474
14041
|
* @see {@link onExitIf} for selecting exits with a boolean predicate
|
|
13475
14042
|
* @see {@link onErrorFilter} for selecting only failure causes
|
|
@@ -14270,7 +14837,8 @@ export declare const cachedInvalidateWithTTL: {
|
|
|
14270
14837
|
<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
14838
|
};
|
|
14272
14839
|
/**
|
|
14273
|
-
*
|
|
14840
|
+
* Fails with an `Interrupt` reason that names the current fiber. This does not
|
|
14841
|
+
* request interruption of the fiber itself, so a cause handler can recover.
|
|
14274
14842
|
*
|
|
14275
14843
|
* **Example** (Creating an interrupted effect)
|
|
14276
14844
|
*
|
|
@@ -14285,13 +14853,20 @@ export declare const cachedInvalidateWithTTL: {
|
|
|
14285
14853
|
* Effect.runSyncExit(program)._tag // => "Failure"
|
|
14286
14854
|
* ```
|
|
14287
14855
|
*
|
|
14856
|
+
* @see {@link catchCause} for recovering from an interruption in the cause
|
|
14857
|
+
*
|
|
14288
14858
|
* @stability stable
|
|
14289
14859
|
* @category interruption
|
|
14290
14860
|
* @since 2.0.0
|
|
14291
14861
|
*/
|
|
14292
14862
|
export declare const interrupt: Effect<never>;
|
|
14293
14863
|
/**
|
|
14294
|
-
*
|
|
14864
|
+
* Runs an effect in an interruptible region.
|
|
14865
|
+
*
|
|
14866
|
+
* **Details**
|
|
14867
|
+
*
|
|
14868
|
+
* If interruption is pending when the fiber enters this region, it takes
|
|
14869
|
+
* effect before the wrapped effect starts.
|
|
14295
14870
|
*
|
|
14296
14871
|
* **Example** (Allowing interruption)
|
|
14297
14872
|
*
|
|
@@ -14304,6 +14879,8 @@ export declare const interrupt: Effect<never>;
|
|
|
14304
14879
|
* await Effect.runPromise(program) // => Option.none()
|
|
14305
14880
|
* ```
|
|
14306
14881
|
*
|
|
14882
|
+
* @see {@link uninterruptible} for how regions defer interruption
|
|
14883
|
+
*
|
|
14307
14884
|
* @stability stable
|
|
14308
14885
|
* @category interruption
|
|
14309
14886
|
* @since 2.0.0
|
|
@@ -14312,6 +14889,10 @@ export declare const interruptible: <A, E, R>(self: Effect<A, E, R>) => Effect<A
|
|
|
14312
14889
|
/**
|
|
14313
14890
|
* Runs the specified finalizer effect if this effect is interrupted.
|
|
14314
14891
|
*
|
|
14892
|
+
* **Details**
|
|
14893
|
+
*
|
|
14894
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
14895
|
+
*
|
|
14315
14896
|
* **Example** (Running cleanup on interruption)
|
|
14316
14897
|
*
|
|
14317
14898
|
* ```ts import.meta.vitest
|
|
@@ -14338,6 +14919,10 @@ export declare const onInterrupt: {
|
|
|
14338
14919
|
/**
|
|
14339
14920
|
* Runs the specified finalizer effect if this effect is interrupted.
|
|
14340
14921
|
*
|
|
14922
|
+
* **Details**
|
|
14923
|
+
*
|
|
14924
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
14925
|
+
*
|
|
14341
14926
|
* **Example** (Running cleanup on interruption)
|
|
14342
14927
|
*
|
|
14343
14928
|
* ```ts import.meta.vitest
|
|
@@ -14364,6 +14949,10 @@ export declare const onInterrupt: {
|
|
|
14364
14949
|
/**
|
|
14365
14950
|
* Runs the specified finalizer effect if this effect is interrupted.
|
|
14366
14951
|
*
|
|
14952
|
+
* **Details**
|
|
14953
|
+
*
|
|
14954
|
+
* Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
|
|
14955
|
+
*
|
|
14367
14956
|
* **Example** (Running cleanup on interruption)
|
|
14368
14957
|
*
|
|
14369
14958
|
* ```ts import.meta.vitest
|
|
@@ -14389,7 +14978,13 @@ export declare const onInterrupt: {
|
|
|
14389
14978
|
<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
14979
|
};
|
|
14391
14980
|
/**
|
|
14392
|
-
*
|
|
14981
|
+
* Runs an effect in an uninterruptible region.
|
|
14982
|
+
*
|
|
14983
|
+
* **Details**
|
|
14984
|
+
*
|
|
14985
|
+
* An interruption request remains pending while the fiber is uninterruptible.
|
|
14986
|
+
* It takes effect when the fiber returns to an interruptible region or enters
|
|
14987
|
+
* one explicitly with `interruptible`.
|
|
14393
14988
|
*
|
|
14394
14989
|
* **Example** (Preventing interruption)
|
|
14395
14990
|
*
|
|
@@ -14417,6 +15012,12 @@ export declare const uninterruptible: <A, E, R>(self: Effect<A, E, R>) => Effect
|
|
|
14417
15012
|
* Disables interruption and provides a restore function to restore the
|
|
14418
15013
|
* interruptible state within the effect.
|
|
14419
15014
|
*
|
|
15015
|
+
* **Details**
|
|
15016
|
+
*
|
|
15017
|
+
* `restore(effect)` runs `effect` in the surrounding region. If that region
|
|
15018
|
+
* was interruptible, a pending interruption takes effect before `effect`
|
|
15019
|
+
* starts; if it was uninterruptible, the request remains pending.
|
|
15020
|
+
*
|
|
14420
15021
|
* **Example** (Restoring interruption in protected regions)
|
|
14421
15022
|
*
|
|
14422
15023
|
* ```ts import.meta.vitest
|
|
@@ -14441,6 +15042,8 @@ export declare const uninterruptible: <A, E, R>(self: Effect<A, E, R>) => Effect
|
|
|
14441
15042
|
* output // => ["Uninterruptible phase...", "Interruptible phase...", "Back to uninterruptible"]
|
|
14442
15043
|
* ```
|
|
14443
15044
|
*
|
|
15045
|
+
* @see {@link uninterruptible} for how regions defer interruption
|
|
15046
|
+
*
|
|
14444
15047
|
* @stability stable
|
|
14445
15048
|
* @category interruption
|
|
14446
15049
|
* @since 2.0.0
|
|
@@ -14450,6 +15053,11 @@ export declare const uninterruptibleMask: <A, E, R>(f: (restore: <AX, EX, RX>(ef
|
|
|
14450
15053
|
* Runs an effect in an interruptible region while providing `restore` for
|
|
14451
15054
|
* locally restoring the previous interruptibility.
|
|
14452
15055
|
*
|
|
15056
|
+
* **Details**
|
|
15057
|
+
*
|
|
15058
|
+
* A pending interruption takes effect when the fiber enters the interruptible
|
|
15059
|
+
* region. Otherwise, `restore` can run a section in the surrounding region.
|
|
15060
|
+
*
|
|
14453
15061
|
* **Example** (Controlling interruptibility locally)
|
|
14454
15062
|
*
|
|
14455
15063
|
* ```ts import.meta.vitest
|
|
@@ -14470,10 +15078,12 @@ export declare const uninterruptibleMask: <A, E, R>(f: (restore: <AX, EX, RX>(ef
|
|
|
14470
15078
|
* })
|
|
14471
15079
|
* )
|
|
14472
15080
|
*
|
|
14473
|
-
* Effect.runSync(program)
|
|
15081
|
+
* Effect.runSync(Effect.uninterruptible(program))
|
|
14474
15082
|
* output // => ["Interruptible phase...", "Uninterruptible phase...", "Back to interruptible"]
|
|
14475
15083
|
* ```
|
|
14476
15084
|
*
|
|
15085
|
+
* @see {@link uninterruptible} for how regions defer interruption
|
|
15086
|
+
*
|
|
14477
15087
|
* @stability stable
|
|
14478
15088
|
* @category interruption
|
|
14479
15089
|
* @since 2.0.0
|
|
@@ -14590,9 +15200,7 @@ export declare const forever: <Arg extends Effect<any, any, any> | {
|
|
|
14590
15200
|
* If the effect succeeds, it is repeated according to the schedule. If it
|
|
14591
15201
|
* fails, the repetition stops immediately, and the failure is returned.
|
|
14592
15202
|
*
|
|
14593
|
-
*
|
|
14594
|
-
* for tasks like retrying operations with backoff, periodic execution, or
|
|
14595
|
-
* performing a series of dependent actions.
|
|
15203
|
+
* Delays between repetitions use the context's `Clock`.
|
|
14596
15204
|
*
|
|
14597
15205
|
* You can combine schedules for more advanced repetition logic, such as adding
|
|
14598
15206
|
* delays, limiting recursions, or dynamically adjusting based on the outcome of
|
|
@@ -14676,9 +15284,7 @@ export declare const repeat: {
|
|
|
14676
15284
|
* If the effect succeeds, it is repeated according to the schedule. If it
|
|
14677
15285
|
* fails, the repetition stops immediately, and the failure is returned.
|
|
14678
15286
|
*
|
|
14679
|
-
*
|
|
14680
|
-
* for tasks like retrying operations with backoff, periodic execution, or
|
|
14681
|
-
* performing a series of dependent actions.
|
|
15287
|
+
* Delays between repetitions use the context's `Clock`.
|
|
14682
15288
|
*
|
|
14683
15289
|
* You can combine schedules for more advanced repetition logic, such as adding
|
|
14684
15290
|
* delays, limiting recursions, or dynamically adjusting based on the outcome of
|
|
@@ -14762,9 +15368,7 @@ export declare const repeat: {
|
|
|
14762
15368
|
* If the effect succeeds, it is repeated according to the schedule. If it
|
|
14763
15369
|
* fails, the repetition stops immediately, and the failure is returned.
|
|
14764
15370
|
*
|
|
14765
|
-
*
|
|
14766
|
-
* for tasks like retrying operations with backoff, periodic execution, or
|
|
14767
|
-
* performing a series of dependent actions.
|
|
15371
|
+
* Delays between repetitions use the context's `Clock`.
|
|
14768
15372
|
*
|
|
14769
15373
|
* You can combine schedules for more advanced repetition logic, such as adding
|
|
14770
15374
|
* delays, limiting recursions, or dynamically adjusting based on the outcome of
|
|
@@ -14848,9 +15452,7 @@ export declare const repeat: {
|
|
|
14848
15452
|
* If the effect succeeds, it is repeated according to the schedule. If it
|
|
14849
15453
|
* fails, the repetition stops immediately, and the failure is returned.
|
|
14850
15454
|
*
|
|
14851
|
-
*
|
|
14852
|
-
* for tasks like retrying operations with backoff, periodic execution, or
|
|
14853
|
-
* performing a series of dependent actions.
|
|
15455
|
+
* Delays between repetitions use the context's `Clock`.
|
|
14854
15456
|
*
|
|
14855
15457
|
* You can combine schedules for more advanced repetition logic, such as adding
|
|
14856
15458
|
* delays, limiting recursions, or dynamically adjusting based on the outcome of
|
|
@@ -14934,9 +15536,7 @@ export declare const repeat: {
|
|
|
14934
15536
|
* If the effect succeeds, it is repeated according to the schedule. If it
|
|
14935
15537
|
* fails, the repetition stops immediately, and the failure is returned.
|
|
14936
15538
|
*
|
|
14937
|
-
*
|
|
14938
|
-
* for tasks like retrying operations with backoff, periodic execution, or
|
|
14939
|
-
* performing a series of dependent actions.
|
|
15539
|
+
* Delays between repetitions use the context's `Clock`.
|
|
14940
15540
|
*
|
|
14941
15541
|
* You can combine schedules for more advanced repetition logic, such as adding
|
|
14942
15542
|
* delays, limiting recursions, or dynamically adjusting based on the outcome of
|
|
@@ -15020,9 +15620,7 @@ export declare const repeat: {
|
|
|
15020
15620
|
* If the effect succeeds, it is repeated according to the schedule. If it
|
|
15021
15621
|
* fails, the repetition stops immediately, and the failure is returned.
|
|
15022
15622
|
*
|
|
15023
|
-
*
|
|
15024
|
-
* for tasks like retrying operations with backoff, periodic execution, or
|
|
15025
|
-
* performing a series of dependent actions.
|
|
15623
|
+
* Delays between repetitions use the context's `Clock`.
|
|
15026
15624
|
*
|
|
15027
15625
|
* You can combine schedules for more advanced repetition logic, such as adding
|
|
15028
15626
|
* delays, limiting recursions, or dynamically adjusting based on the outcome of
|
|
@@ -15106,9 +15704,7 @@ export declare const repeat: {
|
|
|
15106
15704
|
* If the effect succeeds, it is repeated according to the schedule. If it
|
|
15107
15705
|
* fails, the repetition stops immediately, and the failure is returned.
|
|
15108
15706
|
*
|
|
15109
|
-
*
|
|
15110
|
-
* for tasks like retrying operations with backoff, periodic execution, or
|
|
15111
|
-
* performing a series of dependent actions.
|
|
15707
|
+
* Delays between repetitions use the context's `Clock`.
|
|
15112
15708
|
*
|
|
15113
15709
|
* You can combine schedules for more advanced repetition logic, such as adding
|
|
15114
15710
|
* delays, limiting recursions, or dynamically adjusting based on the outcome of
|
|
@@ -15191,6 +15787,8 @@ export declare const repeat: {
|
|
|
15191
15787
|
* otherwise it receives `None`. If the schedule completes normally, the
|
|
15192
15788
|
* returned effect succeeds with the schedule's output.
|
|
15193
15789
|
*
|
|
15790
|
+
* Scheduled delays use the context's `Clock`.
|
|
15791
|
+
*
|
|
15194
15792
|
* **Gotchas**
|
|
15195
15793
|
*
|
|
15196
15794
|
* Defects take precedence over typed errors from either the effect or policy.
|
|
@@ -15251,6 +15849,8 @@ export declare const repeatOrElse: {
|
|
|
15251
15849
|
* otherwise it receives `None`. If the schedule completes normally, the
|
|
15252
15850
|
* returned effect succeeds with the schedule's output.
|
|
15253
15851
|
*
|
|
15852
|
+
* Scheduled delays use the context's `Clock`.
|
|
15853
|
+
*
|
|
15254
15854
|
* **Gotchas**
|
|
15255
15855
|
*
|
|
15256
15856
|
* Defects take precedence over typed errors from either the effect or policy.
|
|
@@ -15311,6 +15911,8 @@ export declare const repeatOrElse: {
|
|
|
15311
15911
|
* otherwise it receives `None`. If the schedule completes normally, the
|
|
15312
15912
|
* returned effect succeeds with the schedule's output.
|
|
15313
15913
|
*
|
|
15914
|
+
* Scheduled delays use the context's `Clock`.
|
|
15915
|
+
*
|
|
15314
15916
|
* **Gotchas**
|
|
15315
15917
|
*
|
|
15316
15918
|
* Defects take precedence over typed errors from either the effect or policy.
|
|
@@ -15607,6 +16209,8 @@ export declare const replicateEffect: {
|
|
|
15607
16209
|
* fails, and otherwise succeeds with the schedule output when the schedule
|
|
15608
16210
|
* completes.
|
|
15609
16211
|
*
|
|
16212
|
+
* Scheduled delays use the context's `Clock`.
|
|
16213
|
+
*
|
|
15610
16214
|
* **Example** (Scheduling repeated execution)
|
|
15611
16215
|
*
|
|
15612
16216
|
* ```ts import.meta.vitest
|
|
@@ -15649,6 +16253,8 @@ export declare const schedule: {
|
|
|
15649
16253
|
* fails, and otherwise succeeds with the schedule output when the schedule
|
|
15650
16254
|
* completes.
|
|
15651
16255
|
*
|
|
16256
|
+
* Scheduled delays use the context's `Clock`.
|
|
16257
|
+
*
|
|
15652
16258
|
* **Example** (Scheduling repeated execution)
|
|
15653
16259
|
*
|
|
15654
16260
|
* ```ts import.meta.vitest
|
|
@@ -15691,6 +16297,8 @@ export declare const schedule: {
|
|
|
15691
16297
|
* fails, and otherwise succeeds with the schedule output when the schedule
|
|
15692
16298
|
* completes.
|
|
15693
16299
|
*
|
|
16300
|
+
* Scheduled delays use the context's `Clock`.
|
|
16301
|
+
*
|
|
15694
16302
|
* **Example** (Scheduling repeated execution)
|
|
15695
16303
|
*
|
|
15696
16304
|
* ```ts import.meta.vitest
|
|
@@ -15729,6 +16337,8 @@ export declare const schedule: {
|
|
|
15729
16337
|
* succeeds with the schedule output when the schedule completes and fails if
|
|
15730
16338
|
* the effect or schedule fails.
|
|
15731
16339
|
*
|
|
16340
|
+
* Scheduled delays use the context's `Clock`.
|
|
16341
|
+
*
|
|
15732
16342
|
* **Example** (Scheduling from an initial value)
|
|
15733
16343
|
*
|
|
15734
16344
|
* ```ts import.meta.vitest
|
|
@@ -15769,6 +16379,8 @@ export declare const scheduleFrom: {
|
|
|
15769
16379
|
* succeeds with the schedule output when the schedule completes and fails if
|
|
15770
16380
|
* the effect or schedule fails.
|
|
15771
16381
|
*
|
|
16382
|
+
* Scheduled delays use the context's `Clock`.
|
|
16383
|
+
*
|
|
15772
16384
|
* **Example** (Scheduling from an initial value)
|
|
15773
16385
|
*
|
|
15774
16386
|
* ```ts import.meta.vitest
|
|
@@ -15809,6 +16421,8 @@ export declare const scheduleFrom: {
|
|
|
15809
16421
|
* succeeds with the schedule output when the schedule completes and fails if
|
|
15810
16422
|
* the effect or schedule fails.
|
|
15811
16423
|
*
|
|
16424
|
+
* Scheduled delays use the context's `Clock`.
|
|
16425
|
+
*
|
|
15812
16426
|
* **Example** (Scheduling from an initial value)
|
|
15813
16427
|
*
|
|
15814
16428
|
* ```ts import.meta.vitest
|
|
@@ -17044,9 +17658,7 @@ export declare const requestUnsafe: <A extends Request.Any>(self: A, options: {
|
|
|
17044
17658
|
readonly context: Context.Context<never>;
|
|
17045
17659
|
}) => () => void;
|
|
17046
17660
|
/**
|
|
17047
|
-
*
|
|
17048
|
-
* returning the fiber immediately, without waiting for it to begin executing
|
|
17049
|
-
* the effect.
|
|
17661
|
+
* Forks this effect into a child fiber and returns its handle.
|
|
17050
17662
|
*
|
|
17051
17663
|
* **Details**
|
|
17052
17664
|
*
|
|
@@ -17066,6 +17678,18 @@ export declare const requestUnsafe: <A extends Request.Any>(self: A, options: {
|
|
|
17066
17678
|
* fibers leak. This behavior is called "auto supervision", and if this
|
|
17067
17679
|
* behavior is not desired, you may use the `forkDetach` or `forkIn` methods.
|
|
17068
17680
|
*
|
|
17681
|
+
* Fork options:
|
|
17682
|
+
*
|
|
17683
|
+
* - `startImmediately` defaults to `false`: the fork returns before the new
|
|
17684
|
+
* fiber runs, without promising a scheduler turn. With `true`, the fiber
|
|
17685
|
+
* runs synchronously until it suspends, yields, or completes before the fork
|
|
17686
|
+
* returns.
|
|
17687
|
+
* - `uninterruptible` defaults to `false`, even in an uninterruptible caller.
|
|
17688
|
+
* With `true`, the fiber starts uninterruptible: `Fiber.interrupt` waits for
|
|
17689
|
+
* completion without replacing its result. Explicit `Effect.interruptible`
|
|
17690
|
+
* regions can still be interrupted. `"inherit"` copies the caller's
|
|
17691
|
+
* interruptibility at the fork.
|
|
17692
|
+
*
|
|
17069
17693
|
* **Example** (Forking a child fiber)
|
|
17070
17694
|
*
|
|
17071
17695
|
* ```ts import.meta.vitest
|
|
@@ -17100,6 +17724,33 @@ export declare const forkChild: <Arg extends Effect<any, any, any> | {
|
|
|
17100
17724
|
* Forks the effect in the specified scope. The fiber will be interrupted
|
|
17101
17725
|
* when the scope is closed.
|
|
17102
17726
|
*
|
|
17727
|
+
* **Details**
|
|
17728
|
+
*
|
|
17729
|
+
* The scope owns the fiber, not the forker: it can outlive the forker's
|
|
17730
|
+
* completion or interruption. Closing the scope from another fiber interrupts
|
|
17731
|
+
* it and waits for completion, including finalizers.
|
|
17732
|
+
*
|
|
17733
|
+
* Forking and registration are interruption-safe: interrupting the forker
|
|
17734
|
+
* cannot leave the new fiber outside the scope. If the scope is already
|
|
17735
|
+
* closed, the effect is not started and the returned fiber is interrupted.
|
|
17736
|
+
*
|
|
17737
|
+
* Fork options:
|
|
17738
|
+
*
|
|
17739
|
+
* - `startImmediately` defaults to `false`: the fork returns before the new
|
|
17740
|
+
* fiber runs, without promising a scheduler turn. With `true`, the fiber
|
|
17741
|
+
* runs synchronously until it suspends, yields, or completes before the fork
|
|
17742
|
+
* returns.
|
|
17743
|
+
* - `uninterruptible` defaults to `false`, even in an uninterruptible caller.
|
|
17744
|
+
* With `true`, the fiber starts uninterruptible: `Fiber.interrupt` waits for
|
|
17745
|
+
* completion without replacing its result. Explicit `Effect.interruptible`
|
|
17746
|
+
* regions can still be interrupted. `"inherit"` copies the caller's
|
|
17747
|
+
* interruptibility at the fork.
|
|
17748
|
+
*
|
|
17749
|
+
* **Gotchas**
|
|
17750
|
+
*
|
|
17751
|
+
* A fiber that closes its own scope is not interrupted or awaited by that
|
|
17752
|
+
* close. An uninterruptible fiber can delay scope closure.
|
|
17753
|
+
*
|
|
17103
17754
|
* **Example** (Forking into a supplied scope)
|
|
17104
17755
|
*
|
|
17105
17756
|
* ```ts import.meta.vitest
|
|
@@ -17128,6 +17779,33 @@ export declare const forkIn: {
|
|
|
17128
17779
|
* Forks the effect in the specified scope. The fiber will be interrupted
|
|
17129
17780
|
* when the scope is closed.
|
|
17130
17781
|
*
|
|
17782
|
+
* **Details**
|
|
17783
|
+
*
|
|
17784
|
+
* The scope owns the fiber, not the forker: it can outlive the forker's
|
|
17785
|
+
* completion or interruption. Closing the scope from another fiber interrupts
|
|
17786
|
+
* it and waits for completion, including finalizers.
|
|
17787
|
+
*
|
|
17788
|
+
* Forking and registration are interruption-safe: interrupting the forker
|
|
17789
|
+
* cannot leave the new fiber outside the scope. If the scope is already
|
|
17790
|
+
* closed, the effect is not started and the returned fiber is interrupted.
|
|
17791
|
+
*
|
|
17792
|
+
* Fork options:
|
|
17793
|
+
*
|
|
17794
|
+
* - `startImmediately` defaults to `false`: the fork returns before the new
|
|
17795
|
+
* fiber runs, without promising a scheduler turn. With `true`, the fiber
|
|
17796
|
+
* runs synchronously until it suspends, yields, or completes before the fork
|
|
17797
|
+
* returns.
|
|
17798
|
+
* - `uninterruptible` defaults to `false`, even in an uninterruptible caller.
|
|
17799
|
+
* With `true`, the fiber starts uninterruptible: `Fiber.interrupt` waits for
|
|
17800
|
+
* completion without replacing its result. Explicit `Effect.interruptible`
|
|
17801
|
+
* regions can still be interrupted. `"inherit"` copies the caller's
|
|
17802
|
+
* interruptibility at the fork.
|
|
17803
|
+
*
|
|
17804
|
+
* **Gotchas**
|
|
17805
|
+
*
|
|
17806
|
+
* A fiber that closes its own scope is not interrupted or awaited by that
|
|
17807
|
+
* close. An uninterruptible fiber can delay scope closure.
|
|
17808
|
+
*
|
|
17131
17809
|
* **Example** (Forking into a supplied scope)
|
|
17132
17810
|
*
|
|
17133
17811
|
* ```ts import.meta.vitest
|
|
@@ -17159,6 +17837,33 @@ export declare const forkIn: {
|
|
|
17159
17837
|
* Forks the effect in the specified scope. The fiber will be interrupted
|
|
17160
17838
|
* when the scope is closed.
|
|
17161
17839
|
*
|
|
17840
|
+
* **Details**
|
|
17841
|
+
*
|
|
17842
|
+
* The scope owns the fiber, not the forker: it can outlive the forker's
|
|
17843
|
+
* completion or interruption. Closing the scope from another fiber interrupts
|
|
17844
|
+
* it and waits for completion, including finalizers.
|
|
17845
|
+
*
|
|
17846
|
+
* Forking and registration are interruption-safe: interrupting the forker
|
|
17847
|
+
* cannot leave the new fiber outside the scope. If the scope is already
|
|
17848
|
+
* closed, the effect is not started and the returned fiber is interrupted.
|
|
17849
|
+
*
|
|
17850
|
+
* Fork options:
|
|
17851
|
+
*
|
|
17852
|
+
* - `startImmediately` defaults to `false`: the fork returns before the new
|
|
17853
|
+
* fiber runs, without promising a scheduler turn. With `true`, the fiber
|
|
17854
|
+
* runs synchronously until it suspends, yields, or completes before the fork
|
|
17855
|
+
* returns.
|
|
17856
|
+
* - `uninterruptible` defaults to `false`, even in an uninterruptible caller.
|
|
17857
|
+
* With `true`, the fiber starts uninterruptible: `Fiber.interrupt` waits for
|
|
17858
|
+
* completion without replacing its result. Explicit `Effect.interruptible`
|
|
17859
|
+
* regions can still be interrupted. `"inherit"` copies the caller's
|
|
17860
|
+
* interruptibility at the fork.
|
|
17861
|
+
*
|
|
17862
|
+
* **Gotchas**
|
|
17863
|
+
*
|
|
17864
|
+
* A fiber that closes its own scope is not interrupted or awaited by that
|
|
17865
|
+
* close. An uninterruptible fiber can delay scope closure.
|
|
17866
|
+
*
|
|
17162
17867
|
* **Example** (Forking into a supplied scope)
|
|
17163
17868
|
*
|
|
17164
17869
|
* ```ts import.meta.vitest
|
|
@@ -17190,6 +17895,33 @@ export declare const forkIn: {
|
|
|
17190
17895
|
/**
|
|
17191
17896
|
* Forks the fiber in a `Scope`, interrupting it when the scope is closed.
|
|
17192
17897
|
*
|
|
17898
|
+
* **Details**
|
|
17899
|
+
*
|
|
17900
|
+
* The scope owns the fiber, not the forker: it can outlive the forker's
|
|
17901
|
+
* completion or interruption. Closing the scope from another fiber interrupts
|
|
17902
|
+
* it and waits for completion, including finalizers.
|
|
17903
|
+
*
|
|
17904
|
+
* Forking and registration are interruption-safe: interrupting the forker
|
|
17905
|
+
* cannot leave the new fiber outside the scope. If the scope is already
|
|
17906
|
+
* closed, the effect is not started and the returned fiber is interrupted.
|
|
17907
|
+
*
|
|
17908
|
+
* Fork options:
|
|
17909
|
+
*
|
|
17910
|
+
* - `startImmediately` defaults to `false`: the fork returns before the new
|
|
17911
|
+
* fiber runs, without promising a scheduler turn. With `true`, the fiber
|
|
17912
|
+
* runs synchronously until it suspends, yields, or completes before the fork
|
|
17913
|
+
* returns.
|
|
17914
|
+
* - `uninterruptible` defaults to `false`, even in an uninterruptible caller.
|
|
17915
|
+
* With `true`, the fiber starts uninterruptible: `Fiber.interrupt` waits for
|
|
17916
|
+
* completion without replacing its result. Explicit `Effect.interruptible`
|
|
17917
|
+
* regions can still be interrupted. `"inherit"` copies the caller's
|
|
17918
|
+
* interruptibility at the fork.
|
|
17919
|
+
*
|
|
17920
|
+
* **Gotchas**
|
|
17921
|
+
*
|
|
17922
|
+
* A fiber that closes its own scope is not interrupted or awaited by that
|
|
17923
|
+
* close. An uninterruptible fiber can delay scope closure.
|
|
17924
|
+
*
|
|
17193
17925
|
* **Example** (Forking into the current scope)
|
|
17194
17926
|
*
|
|
17195
17927
|
* ```ts import.meta.vitest
|
|
@@ -17233,6 +17965,18 @@ export declare const forkScoped: <Arg extends Effect<any, any, any> | {
|
|
|
17233
17965
|
* until it completes or is explicitly interrupted through the returned handle,
|
|
17234
17966
|
* even after the forking fiber terminates.
|
|
17235
17967
|
*
|
|
17968
|
+
* Fork options:
|
|
17969
|
+
*
|
|
17970
|
+
* - `startImmediately` defaults to `false`: the fork returns before the new
|
|
17971
|
+
* fiber runs, without promising a scheduler turn. With `true`, the fiber
|
|
17972
|
+
* runs synchronously until it suspends, yields, or completes before the fork
|
|
17973
|
+
* returns.
|
|
17974
|
+
* - `uninterruptible` defaults to `false`, even in an uninterruptible caller.
|
|
17975
|
+
* With `true`, the fiber starts uninterruptible: `Fiber.interrupt` waits for
|
|
17976
|
+
* completion without replacing its result. Explicit `Effect.interruptible`
|
|
17977
|
+
* regions can still be interrupted. `"inherit"` copies the caller's
|
|
17978
|
+
* interruptibility at the fork.
|
|
17979
|
+
*
|
|
17236
17980
|
* **Example** (Forking a detached fiber)
|
|
17237
17981
|
*
|
|
17238
17982
|
* ```ts import.meta.vitest
|
|
@@ -17341,9 +18085,9 @@ export declare const fiberId: Effect<number>;
|
|
|
17341
18085
|
*
|
|
17342
18086
|
* **Details**
|
|
17343
18087
|
*
|
|
17344
|
-
* `signal`
|
|
17345
|
-
*
|
|
17346
|
-
*
|
|
18088
|
+
* `signal` can interrupt the fiber, and `scheduler` provides the scheduler
|
|
18089
|
+
* service. The fiber starts interruptible unless `uninterruptible: true` is
|
|
18090
|
+
* set.
|
|
17347
18091
|
*
|
|
17348
18092
|
* @see {@link runFork} for starting a fiber with these options
|
|
17349
18093
|
* @see {@link runCallback} for callback-based running with these options
|
|
@@ -17368,6 +18112,12 @@ export interface RunOptions {
|
|
|
17368
18112
|
*
|
|
17369
18113
|
* Use when you need to start an effect in the background and receive a fiber.
|
|
17370
18114
|
*
|
|
18115
|
+
* **Details**
|
|
18116
|
+
*
|
|
18117
|
+
* The fiber starts immediately and runs synchronously until it suspends,
|
|
18118
|
+
* yields, or completes. It starts interruptible unless `uninterruptible: true`
|
|
18119
|
+
* is set.
|
|
18120
|
+
*
|
|
17371
18121
|
* **Example** (Running an effect in the background)
|
|
17372
18122
|
*
|
|
17373
18123
|
* ```ts import.meta.vitest
|
|
@@ -17386,6 +18136,8 @@ export interface RunOptions {
|
|
|
17386
18136
|
* output // => ["running...", "done"]
|
|
17387
18137
|
* ```
|
|
17388
18138
|
*
|
|
18139
|
+
* @see {@link RunOptions} for configuring the fiber
|
|
18140
|
+
* @see {@link forkChild} for starting a child of the current fiber
|
|
17389
18141
|
* @stability stable
|
|
17390
18142
|
* @category running
|
|
17391
18143
|
* @since 2.0.0
|
|
@@ -17399,6 +18151,12 @@ export declare const runFork: <A, E>(effect: Effect<A, E, never>, options?: RunO
|
|
|
17399
18151
|
* Use when an effect still requires services, you already have a `Context`, and
|
|
17400
18152
|
* you want a background fiber.
|
|
17401
18153
|
*
|
|
18154
|
+
* **Details**
|
|
18155
|
+
*
|
|
18156
|
+
* The fiber starts immediately and runs synchronously until it suspends,
|
|
18157
|
+
* yields, or completes. It starts interruptible unless `uninterruptible: true`
|
|
18158
|
+
* is set.
|
|
18159
|
+
*
|
|
17402
18160
|
* **Example** (Running with services in the background)
|
|
17403
18161
|
*
|
|
17404
18162
|
* ```ts import.meta.vitest
|
|
@@ -17426,6 +18184,8 @@ export declare const runFork: <A, E>(effect: Effect<A, E, never>, options?: RunO
|
|
|
17426
18184
|
* output // => ["Hello from service!", "done"]
|
|
17427
18185
|
* ```
|
|
17428
18186
|
*
|
|
18187
|
+
* @see {@link RunOptions} for configuring the fiber
|
|
18188
|
+
* @see {@link forkChild} for starting a child of the current fiber
|
|
17429
18189
|
* @stability stable
|
|
17430
18190
|
* @category running
|
|
17431
18191
|
* @since 4.0.0
|