effect 4.0.4 → 4.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ai-docs/package.json +1 -1
- package/ai-docs/src/06_schedule/10_schedules.ts +5 -4
- package/ai-docs/src/52_graphql/10_basics.ts +19 -13
- package/ai-docs/src/52_graphql/30_batching.ts +6 -4
- package/ai-docs/src/52_graphql/40_aliased-batching.ts +6 -4
- package/ai-docs/tsconfig.json +3 -1
- package/dist/Array.d.ts +207 -58
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +45 -22
- package/dist/Array.js.map +1 -1
- package/dist/Bytes.d.ts +79 -0
- package/dist/Bytes.d.ts.map +1 -0
- package/dist/Bytes.js +109 -0
- package/dist/Bytes.js.map +1 -0
- package/dist/Channel.d.ts +187 -14
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +142 -33
- package/dist/Channel.js.map +1 -1
- package/dist/ChannelSchema.d.ts.map +1 -1
- package/dist/ChannelSchema.js.map +1 -1
- package/dist/Chunk.d.ts +39 -21
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +26 -17
- package/dist/Chunk.js.map +1 -1
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +8 -3
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +34 -32
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Cron.d.ts +2 -2
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +6 -3
- package/dist/Cron.js.map +1 -1
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +58 -21
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +548 -182
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +261 -76
- package/dist/Effect.js.map +1 -1
- package/dist/Equivalence.d.ts +2 -1
- package/dist/Equivalence.d.ts.map +1 -1
- package/dist/Equivalence.js +12 -8
- package/dist/Equivalence.js.map +1 -1
- package/dist/Exit.d.ts +24 -9
- package/dist/Exit.d.ts.map +1 -1
- package/dist/Exit.js +8 -3
- package/dist/Exit.js.map +1 -1
- package/dist/FiberHandle.d.ts +2 -0
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +9 -4
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +2 -0
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +5 -2
- package/dist/FiberMap.js.map +1 -1
- package/dist/FileSystem.d.ts +28 -9
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +3 -0
- package/dist/FileSystem.js.map +1 -1
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js.map +1 -1
- package/dist/HashSet.d.ts.map +1 -1
- package/dist/HashSet.js.map +1 -1
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +18 -17
- package/dist/Iterable.js.map +1 -1
- package/dist/JsonSchema.d.ts +9 -3
- package/dist/JsonSchema.d.ts.map +1 -1
- package/dist/JsonSchema.js +19 -3
- package/dist/JsonSchema.js.map +1 -1
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +2 -2
- package/dist/Layer.js.map +1 -1
- package/dist/ManagedRuntime.d.ts +19 -1
- package/dist/ManagedRuntime.d.ts.map +1 -1
- package/dist/ManagedRuntime.js +62 -6
- package/dist/ManagedRuntime.js.map +1 -1
- package/dist/Match.d.ts +20 -6
- package/dist/Match.d.ts.map +1 -1
- package/dist/Match.js +2 -2
- package/dist/Match.js.map +1 -1
- package/dist/Metric.d.ts +132 -0
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +197 -25
- package/dist/Metric.js.map +1 -1
- package/dist/MutableHashMap.d.ts.map +1 -1
- package/dist/MutableHashMap.js.map +1 -1
- package/dist/Number.js +2 -2
- package/dist/Number.js.map +1 -1
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js.map +1 -1
- package/dist/Path.d.ts +37 -5
- package/dist/Path.d.ts.map +1 -1
- package/dist/Path.js +44 -6
- package/dist/Path.js.map +1 -1
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +12 -7
- package/dist/PubSub.js.map +1 -1
- package/dist/Queue.d.ts +4 -1
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +4 -1
- package/dist/Queue.js.map +1 -1
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +1 -1
- package/dist/Random.js.map +1 -1
- package/dist/RcMap.d.ts +12 -7
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +9 -6
- package/dist/RcMap.js.map +1 -1
- package/dist/Record.d.ts +51 -0
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +17 -0
- package/dist/Record.js.map +1 -1
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js.map +1 -1
- package/dist/References.d.ts +5 -4
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +5 -4
- package/dist/References.js.map +1 -1
- package/dist/RequestResolver.d.ts +31 -1
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/RequestResolver.js +39 -4
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Resource.js +1 -1
- package/dist/Resource.js.map +1 -1
- package/dist/Runtime.d.ts +3 -3
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +18 -15
- package/dist/Runtime.js.map +1 -1
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js.map +1 -1
- package/dist/Schema.d.ts +383 -326
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +338 -17
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +5 -5
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +24 -8
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +8 -3
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +15 -5
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaIssue.d.ts +4 -4
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js +29 -51
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +56 -1
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +18 -0
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +1 -1
- package/dist/SchemaTransformation.js +1 -1
- package/dist/Scope.d.ts +12 -2
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +5 -0
- package/dist/Scope.js.map +1 -1
- package/dist/ScopedCache.d.ts +10 -7
- package/dist/ScopedCache.d.ts.map +1 -1
- package/dist/ScopedCache.js +9 -5
- package/dist/ScopedCache.js.map +1 -1
- package/dist/SemVer.d.ts +1196 -0
- package/dist/SemVer.d.ts.map +1 -0
- package/dist/SemVer.js +756 -0
- package/dist/SemVer.js.map +1 -0
- package/dist/SemVerRange.d.ts +559 -0
- package/dist/SemVerRange.d.ts.map +1 -0
- package/dist/SemVerRange.js +551 -0
- package/dist/SemVerRange.js.map +1 -0
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +6 -2
- package/dist/Sink.js.map +1 -1
- package/dist/Stream.d.ts +235 -8
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +145 -60
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +16 -2
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +25 -10
- package/dist/String.js.map +1 -1
- package/dist/TextDiff.d.ts +399 -0
- package/dist/TextDiff.d.ts.map +1 -0
- package/dist/TextDiff.js +634 -0
- package/dist/TextDiff.js.map +1 -0
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js.map +1 -1
- package/dist/TxHashSet.d.ts.map +1 -1
- package/dist/TxHashSet.js.map +1 -1
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +3 -2
- package/dist/TxRef.js.map +1 -1
- package/dist/ai/AiError.d.ts +78 -14
- package/dist/ai/AiError.d.ts.map +1 -1
- package/dist/ai/AiError.js +51 -3
- package/dist/ai/AiError.js.map +1 -1
- package/dist/ai/Chat.d.ts +1 -2
- package/dist/ai/Chat.d.ts.map +1 -1
- package/dist/ai/Chat.js +6 -3
- package/dist/ai/Chat.js.map +1 -1
- package/dist/ai/Decision.d.ts +116 -20
- package/dist/ai/Decision.d.ts.map +1 -1
- package/dist/ai/Decision.js +37 -3
- package/dist/ai/Decision.js.map +1 -1
- package/dist/ai/DecisionModel.d.ts +129 -11
- package/dist/ai/DecisionModel.d.ts.map +1 -1
- package/dist/ai/DecisionModel.js +183 -95
- package/dist/ai/DecisionModel.js.map +1 -1
- package/dist/ai/EmbeddingModel.d.ts +10 -0
- package/dist/ai/EmbeddingModel.d.ts.map +1 -1
- package/dist/ai/EmbeddingModel.js +21 -7
- package/dist/ai/EmbeddingModel.js.map +1 -1
- package/dist/ai/LanguageModel.d.ts.map +1 -1
- package/dist/ai/LanguageModel.js +47 -35
- package/dist/ai/LanguageModel.js.map +1 -1
- package/dist/ai/McpClient.d.ts +289 -0
- package/dist/ai/McpClient.d.ts.map +1 -0
- package/dist/ai/McpClient.js +819 -0
- package/dist/ai/McpClient.js.map +1 -0
- package/dist/ai/McpClientError.d.ts +254 -0
- package/dist/ai/McpClientError.d.ts.map +1 -0
- package/dist/ai/McpClientError.js +260 -0
- package/dist/ai/McpClientError.js.map +1 -0
- package/dist/ai/McpProtocol.d.ts +2 -2
- package/dist/ai/McpProtocol.d.ts.map +1 -1
- package/dist/ai/McpSchema.d.ts +368 -235
- package/dist/ai/McpSchema.d.ts.map +1 -1
- package/dist/ai/McpSchema.js +94 -24
- package/dist/ai/McpSchema.js.map +1 -1
- package/dist/ai/McpServer.d.ts +6 -52
- package/dist/ai/McpServer.d.ts.map +1 -1
- package/dist/ai/McpServer.js +27 -50
- package/dist/ai/McpServer.js.map +1 -1
- package/dist/ai/Prompt.d.ts +22 -20
- package/dist/ai/Prompt.d.ts.map +1 -1
- package/dist/ai/Prompt.js +23 -1
- package/dist/ai/Prompt.js.map +1 -1
- package/dist/ai/Response.d.ts +148 -4
- package/dist/ai/Response.d.ts.map +1 -1
- package/dist/ai/Response.js +35 -37
- package/dist/ai/Response.js.map +1 -1
- package/dist/ai/Tool.d.ts +12 -4
- package/dist/ai/Tool.d.ts.map +1 -1
- package/dist/ai/Tool.js.map +1 -1
- package/dist/ai/Toolkit.d.ts +48 -1
- package/dist/ai/Toolkit.d.ts.map +1 -1
- package/dist/ai/Toolkit.js +65 -12
- package/dist/ai/Toolkit.js.map +1 -1
- package/dist/ai/index.d.ts +10 -0
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +10 -0
- package/dist/ai/index.js.map +1 -1
- package/dist/ai/internal/mcpCore.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2024_11_05.js +1 -1
- package/dist/ai/internal/mcpProtocol/v2024_11_05.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_03_26.js +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_03_26.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_06_18.js +2 -2
- package/dist/ai/internal/mcpProtocol/v2025_06_18.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_11_25.js +2 -2
- package/dist/ai/internal/mcpProtocol/v2025_11_25.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2026_07_28.js +4 -7
- package/dist/ai/internal/mcpProtocol/v2026_07_28.js.map +1 -1
- package/dist/ai/internal/mcpProtocol.js +16 -2
- package/dist/ai/internal/mcpProtocol.js.map +1 -1
- package/dist/ai/internal/mcpRuntime.js +3 -4
- package/dist/ai/internal/mcpRuntime.js.map +1 -1
- package/dist/ai/internal/mcpSchema/v2024_11_05.js +19 -13
- package/dist/ai/internal/mcpSchema/v2024_11_05.js.map +1 -1
- package/dist/ai/internal/mcpSchema/v2025_03_26.js +3 -2
- package/dist/ai/internal/mcpSchema/v2025_03_26.js.map +1 -1
- package/dist/ai/internal/mcpSchema/v2025_06_18.js +7 -7
- package/dist/ai/internal/mcpSchema/v2025_06_18.js.map +1 -1
- package/dist/ai/internal/mcpSchema/v2025_11_25.js +8 -8
- package/dist/ai/internal/mcpSchema/v2025_11_25.js.map +1 -1
- package/dist/ai/internal/mcpSchema/v2026_07_28.js +43 -42
- package/dist/ai/internal/mcpSchema/v2026_07_28.js.map +1 -1
- package/dist/cli/CliError.d.ts +42 -2
- package/dist/cli/CliError.d.ts.map +1 -1
- package/dist/cli/CliError.js +44 -5
- package/dist/cli/CliError.js.map +1 -1
- package/dist/cli/Command.d.ts +286 -2
- package/dist/cli/Command.d.ts.map +1 -1
- package/dist/cli/Command.js +107 -6
- package/dist/cli/Command.js.map +1 -1
- package/dist/cli/Completions.d.ts +10 -0
- package/dist/cli/Completions.d.ts.map +1 -1
- package/dist/cli/Completions.js.map +1 -1
- package/dist/cli/Flag.d.ts +215 -0
- package/dist/cli/Flag.d.ts.map +1 -1
- package/dist/cli/Flag.js +89 -0
- package/dist/cli/Flag.js.map +1 -1
- package/dist/cli/GlobalFlag.d.ts.map +1 -1
- package/dist/cli/GlobalFlag.js +3 -3
- package/dist/cli/GlobalFlag.js.map +1 -1
- package/dist/cli/Param.d.ts +194 -0
- package/dist/cli/Param.d.ts.map +1 -1
- package/dist/cli/Param.js +86 -0
- package/dist/cli/Param.js.map +1 -1
- package/dist/cli/TerminalCapabilities.d.ts +84 -0
- package/dist/cli/TerminalCapabilities.d.ts.map +1 -0
- package/dist/cli/TerminalCapabilities.js +122 -0
- package/dist/cli/TerminalCapabilities.js.map +1 -0
- package/dist/cli/index.d.ts +5 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +5 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/internal/command.d.ts +2 -1
- package/dist/cli/internal/command.d.ts.map +1 -1
- package/dist/cli/internal/command.js +7 -3
- package/dist/cli/internal/command.js.map +1 -1
- package/dist/cli/internal/completions/bash.js +7 -5
- package/dist/cli/internal/completions/bash.js.map +1 -1
- package/dist/cli/internal/completions/descriptor.js +16 -1
- package/dist/cli/internal/completions/descriptor.js.map +1 -1
- package/dist/cli/internal/completions/fish.js +12 -10
- package/dist/cli/internal/completions/fish.js.map +1 -1
- package/dist/cli/internal/completions/powershell.js +20 -10
- package/dist/cli/internal/completions/powershell.js.map +1 -1
- package/dist/cli/internal/completions/zsh.js +15 -8
- package/dist/cli/internal/completions/zsh.js.map +1 -1
- package/dist/cli/internal/formatter.d.ts +2 -0
- package/dist/cli/internal/formatter.d.ts.map +1 -0
- package/dist/cli/internal/formatter.js +15 -0
- package/dist/cli/internal/formatter.js.map +1 -0
- package/dist/cli/internal/lexer.js +24 -10
- package/dist/cli/internal/lexer.js.map +1 -1
- package/dist/cli/internal/parser.js +35 -15
- package/dist/cli/internal/parser.js.map +1 -1
- package/dist/cli/internal/wizard.d.ts.map +1 -1
- package/dist/cli/internal/wizard.js +2 -1
- package/dist/cli/internal/wizard.js.map +1 -1
- package/dist/cluster/ClusterCron.d.ts +29 -1
- package/dist/cluster/ClusterCron.d.ts.map +1 -1
- package/dist/cluster/ClusterCron.js +64 -32
- package/dist/cluster/ClusterCron.js.map +1 -1
- package/dist/cluster/ClusterMetrics.d.ts +143 -7
- package/dist/cluster/ClusterMetrics.d.ts.map +1 -1
- package/dist/cluster/ClusterMetrics.js +151 -7
- package/dist/cluster/ClusterMetrics.js.map +1 -1
- package/dist/cluster/ClusterWorkflowEngine.d.ts +2 -1
- package/dist/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/cluster/ClusterWorkflowEngine.js +98 -18
- package/dist/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/cluster/Entity.d.ts +2 -0
- package/dist/cluster/Entity.d.ts.map +1 -1
- package/dist/cluster/Entity.js.map +1 -1
- package/dist/cluster/MessageStorage.d.ts +21 -0
- package/dist/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/cluster/MessageStorage.js +20 -12
- package/dist/cluster/MessageStorage.js.map +1 -1
- package/dist/cluster/Runners.d.ts.map +1 -1
- package/dist/cluster/Runners.js +96 -37
- package/dist/cluster/Runners.js.map +1 -1
- package/dist/cluster/Sharding.d.ts +1 -0
- package/dist/cluster/Sharding.d.ts.map +1 -1
- package/dist/cluster/Sharding.js +95 -32
- package/dist/cluster/Sharding.js.map +1 -1
- package/dist/cluster/ShardingConfig.d.ts +20 -0
- package/dist/cluster/ShardingConfig.d.ts.map +1 -1
- package/dist/cluster/ShardingConfig.js +4 -0
- package/dist/cluster/ShardingConfig.js.map +1 -1
- package/dist/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/cluster/SqlMessageStorage.js +40 -50
- package/dist/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/cluster/SqlRunnerStorage.d.ts +2 -2
- package/dist/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/cluster/SqlRunnerStorage.js +10 -4
- package/dist/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/cluster/internal/entityManager.js +66 -9
- package/dist/cluster/internal/entityManager.js.map +1 -1
- package/dist/devtools/DevTools.d.ts +3 -2
- package/dist/devtools/DevTools.d.ts.map +1 -1
- package/dist/devtools/DevTools.js +3 -2
- package/dist/devtools/DevTools.js.map +1 -1
- package/dist/devtools/DevToolsClient.d.ts +11 -0
- package/dist/devtools/DevToolsClient.d.ts.map +1 -1
- package/dist/devtools/DevToolsClient.js +31 -4
- package/dist/devtools/DevToolsClient.js.map +1 -1
- package/dist/encoding/Base64Url.d.ts +29 -0
- package/dist/encoding/Base64Url.d.ts.map +1 -1
- package/dist/encoding/Base64Url.js +29 -0
- package/dist/encoding/Base64Url.js.map +1 -1
- package/dist/encoding/Ini.d.ts.map +1 -1
- package/dist/encoding/Ini.js +3 -0
- package/dist/encoding/Ini.js.map +1 -1
- package/dist/encoding/JsonArray.d.ts +270 -0
- package/dist/encoding/JsonArray.d.ts.map +1 -0
- package/dist/encoding/JsonArray.js +691 -0
- package/dist/encoding/JsonArray.js.map +1 -0
- package/dist/encoding/Ndjson.d.ts +43 -4
- package/dist/encoding/Ndjson.d.ts.map +1 -1
- package/dist/encoding/Ndjson.js +169 -18
- package/dist/encoding/Ndjson.js.map +1 -1
- package/dist/encoding/SchemaBinary.d.ts +9 -1
- package/dist/encoding/SchemaBinary.d.ts.map +1 -1
- package/dist/encoding/SchemaBinary.js +12 -19
- package/dist/encoding/SchemaBinary.js.map +1 -1
- package/dist/encoding/Sse.js +1 -1
- package/dist/encoding/Sse.js.map +1 -1
- package/dist/encoding/Tar.d.ts +309 -0
- package/dist/encoding/Tar.d.ts.map +1 -0
- package/dist/encoding/Tar.js +1182 -0
- package/dist/encoding/Tar.js.map +1 -0
- package/dist/encoding/Toml.js +3 -3
- package/dist/encoding/Toml.js.map +1 -1
- package/dist/encoding/Xml.d.ts +464 -0
- package/dist/encoding/Xml.d.ts.map +1 -0
- package/dist/encoding/Xml.js +1619 -0
- package/dist/encoding/Xml.js.map +1 -0
- package/dist/encoding/Yaml.d.ts +6 -2
- package/dist/encoding/Yaml.d.ts.map +1 -1
- package/dist/encoding/Yaml.js +97 -34
- package/dist/encoding/Yaml.js.map +1 -1
- package/dist/encoding/Zip.d.ts +413 -0
- package/dist/encoding/Zip.d.ts.map +1 -0
- package/dist/encoding/Zip.js +1255 -0
- package/dist/encoding/Zip.js.map +1 -0
- package/dist/encoding/index.d.ts +20 -0
- package/dist/encoding/index.d.ts.map +1 -1
- package/dist/encoding/index.js +20 -0
- package/dist/encoding/index.js.map +1 -1
- package/dist/eventlog/EventJournal.d.ts +90 -5
- package/dist/eventlog/EventJournal.d.ts.map +1 -1
- package/dist/eventlog/EventJournal.js +488 -228
- package/dist/eventlog/EventJournal.js.map +1 -1
- package/dist/eventlog/EventLog.d.ts +180 -12
- package/dist/eventlog/EventLog.d.ts.map +1 -1
- package/dist/eventlog/EventLog.js +394 -146
- package/dist/eventlog/EventLog.js.map +1 -1
- package/dist/eventlog/EventLogEncryption.d.ts +36 -30
- package/dist/eventlog/EventLogEncryption.d.ts.map +1 -1
- package/dist/eventlog/EventLogEncryption.js +97 -38
- package/dist/eventlog/EventLogEncryption.js.map +1 -1
- package/dist/eventlog/EventLogMessage.d.ts +74 -34
- package/dist/eventlog/EventLogMessage.d.ts.map +1 -1
- package/dist/eventlog/EventLogMessage.js +45 -11
- package/dist/eventlog/EventLogMessage.js.map +1 -1
- package/dist/eventlog/EventLogRemote.d.ts +45 -8
- package/dist/eventlog/EventLogRemote.d.ts.map +1 -1
- package/dist/eventlog/EventLogRemote.js +51 -14
- package/dist/eventlog/EventLogRemote.js.map +1 -1
- package/dist/eventlog/EventLogServer.d.ts +46 -3
- package/dist/eventlog/EventLogServer.d.ts.map +1 -1
- package/dist/eventlog/EventLogServer.js +119 -19
- package/dist/eventlog/EventLogServer.js.map +1 -1
- package/dist/eventlog/EventLogServerEncrypted.d.ts +23 -33
- package/dist/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
- package/dist/eventlog/EventLogServerEncrypted.js +97 -70
- package/dist/eventlog/EventLogServerEncrypted.js.map +1 -1
- package/dist/eventlog/EventLogServerUnencrypted.d.ts +39 -5
- package/dist/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/eventlog/EventLogServerUnencrypted.js +151 -69
- package/dist/eventlog/EventLogServerUnencrypted.js.map +1 -1
- package/dist/eventlog/EventRow.d.ts +288 -0
- package/dist/eventlog/EventRow.d.ts.map +1 -0
- package/dist/eventlog/EventRow.js +435 -0
- package/dist/eventlog/EventRow.js.map +1 -0
- package/dist/eventlog/SqlEventJournal.d.ts +18 -18
- package/dist/eventlog/SqlEventJournal.d.ts.map +1 -1
- package/dist/eventlog/SqlEventJournal.js +387 -159
- package/dist/eventlog/SqlEventJournal.js.map +1 -1
- package/dist/eventlog/SqlEventLogServerEncrypted.d.ts +10 -18
- package/dist/eventlog/SqlEventLogServerEncrypted.d.ts.map +1 -1
- package/dist/eventlog/SqlEventLogServerEncrypted.js +179 -69
- package/dist/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
- package/dist/eventlog/SqlEventLogServerUnencrypted.d.ts +23 -3
- package/dist/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/eventlog/SqlEventLogServerUnencrypted.js +102 -51
- package/dist/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
- package/dist/eventlog/index.d.ts +5 -0
- package/dist/eventlog/index.d.ts.map +1 -1
- package/dist/eventlog/index.js +5 -0
- package/dist/eventlog/index.js.map +1 -1
- package/dist/eventlog/internal/conflicts.d.ts +47 -0
- package/dist/eventlog/internal/conflicts.d.ts.map +1 -0
- package/dist/eventlog/internal/conflicts.js +92 -0
- package/dist/eventlog/internal/conflicts.js.map +1 -0
- package/dist/graphql/GraphQLClient.d.ts.map +1 -1
- package/dist/graphql/GraphQLClient.js +12 -5
- package/dist/graphql/GraphQLClient.js.map +1 -1
- package/dist/graphql/GraphQLClientError.d.ts +2 -2
- package/dist/graphql/GraphQLClientError.d.ts.map +1 -1
- package/dist/graphql/GraphQLClientError.js +4 -18
- package/dist/graphql/GraphQLClientError.js.map +1 -1
- package/dist/graphql/GraphQLProtocol.d.ts +252 -11
- package/dist/graphql/GraphQLProtocol.d.ts.map +1 -1
- package/dist/graphql/GraphQLProtocol.js +99 -8
- package/dist/graphql/GraphQLProtocol.js.map +1 -1
- package/dist/graphql/GraphQLResolver.d.ts +3 -1
- package/dist/graphql/GraphQLResolver.d.ts.map +1 -1
- package/dist/graphql/GraphQLResolver.js +91 -19
- package/dist/graphql/GraphQLResolver.js.map +1 -1
- package/dist/http/FetchHttpClient.d.ts +13 -3
- package/dist/http/FetchHttpClient.d.ts.map +1 -1
- package/dist/http/FetchHttpClient.js +56 -6
- package/dist/http/FetchHttpClient.js.map +1 -1
- package/dist/http/FindMyWay/internal/router.js +12 -1
- package/dist/http/FindMyWay/internal/router.js.map +1 -1
- package/dist/http/Headers.d.ts +230 -3
- package/dist/http/Headers.d.ts.map +1 -1
- package/dist/http/Headers.js +267 -5
- package/dist/http/Headers.js.map +1 -1
- package/dist/http/HttpClient.d.ts +105 -0
- package/dist/http/HttpClient.d.ts.map +1 -1
- package/dist/http/HttpClient.js +69 -17
- package/dist/http/HttpClient.js.map +1 -1
- package/dist/http/HttpClientError.d.ts.map +1 -1
- package/dist/http/HttpClientError.js +8 -6
- package/dist/http/HttpClientError.js.map +1 -1
- package/dist/http/HttpClientRequest.d.ts +274 -7
- package/dist/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/http/HttpClientRequest.js +91 -3
- package/dist/http/HttpClientRequest.js.map +1 -1
- package/dist/http/HttpClientResponse.d.ts +53 -0
- package/dist/http/HttpClientResponse.d.ts.map +1 -1
- package/dist/http/HttpClientResponse.js +47 -0
- package/dist/http/HttpClientResponse.js.map +1 -1
- package/dist/http/HttpEffect.d.ts +6 -2
- package/dist/http/HttpEffect.d.ts.map +1 -1
- package/dist/http/HttpEffect.js +21 -17
- package/dist/http/HttpEffect.js.map +1 -1
- package/dist/http/HttpIncomingMessage.d.ts +2 -1
- package/dist/http/HttpIncomingMessage.d.ts.map +1 -1
- package/dist/http/HttpIncomingMessage.js +3 -23
- package/dist/http/HttpIncomingMessage.js.map +1 -1
- package/dist/http/HttpMiddleware.d.ts +179 -2
- package/dist/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/http/HttpMiddleware.js +226 -18
- package/dist/http/HttpMiddleware.js.map +1 -1
- package/dist/http/HttpRouter.d.ts.map +1 -1
- package/dist/http/HttpRouter.js +58 -14
- package/dist/http/HttpRouter.js.map +1 -1
- package/dist/http/HttpServerError.d.ts +5 -2
- package/dist/http/HttpServerError.d.ts.map +1 -1
- package/dist/http/HttpServerError.js +11 -7
- package/dist/http/HttpServerError.js.map +1 -1
- package/dist/http/HttpServerRequest.d.ts +25 -5
- package/dist/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/http/HttpServerRequest.js +38 -12
- package/dist/http/HttpServerRequest.js.map +1 -1
- package/dist/http/HttpServerResponse.d.ts +17 -8
- package/dist/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/http/HttpServerResponse.js +37 -21
- package/dist/http/HttpServerResponse.js.map +1 -1
- package/dist/http/HttpStaticServer.d.ts +0 -12
- package/dist/http/HttpStaticServer.d.ts.map +1 -1
- package/dist/http/HttpStaticServer.js +25 -17
- package/dist/http/HttpStaticServer.js.map +1 -1
- package/dist/http/HttpTraceContext.js +1 -1
- package/dist/http/HttpTraceContext.js.map +1 -1
- package/dist/http/MultipartParser/internal/contentType.d.ts +15 -1
- package/dist/http/MultipartParser/internal/contentType.d.ts.map +1 -1
- package/dist/http/MultipartParser/internal/contentType.js +87 -5
- package/dist/http/MultipartParser/internal/contentType.js.map +1 -1
- package/dist/http/MultipartParser/internal/headers.d.ts.map +1 -1
- package/dist/http/MultipartParser/internal/headers.js +4 -12
- package/dist/http/MultipartParser/internal/headers.js.map +1 -1
- package/dist/http/MultipartParser/internal/multipart.d.ts.map +1 -1
- package/dist/http/MultipartParser/internal/multipart.js +6 -27
- package/dist/http/MultipartParser/internal/multipart.js.map +1 -1
- package/dist/http/Url.d.ts.map +1 -1
- package/dist/http/Url.js +8 -2
- package/dist/http/Url.js.map +1 -1
- package/dist/http/UrlParams.d.ts +112 -8
- package/dist/http/UrlParams.d.ts.map +1 -1
- package/dist/http/UrlParams.js +141 -14
- package/dist/http/UrlParams.js.map +1 -1
- package/dist/http/internal/compression.d.ts +1 -1
- package/dist/http/internal/compression.d.ts.map +1 -1
- package/dist/http/internal/compression.js +2 -10
- package/dist/http/internal/compression.js.map +1 -1
- package/dist/http/internal/compressionBody.d.ts +2 -0
- package/dist/http/internal/compressionBody.d.ts.map +1 -0
- package/dist/http/internal/compressionBody.js +36 -0
- package/dist/http/internal/compressionBody.js.map +1 -0
- package/dist/http/internal/decompression.d.ts +2 -0
- package/dist/http/internal/decompression.d.ts.map +1 -0
- package/dist/http/internal/decompression.js +168 -0
- package/dist/http/internal/decompression.js.map +1 -0
- package/dist/http/internal/lazyStream.d.ts +2 -0
- package/dist/http/internal/lazyStream.d.ts.map +1 -0
- package/dist/http/internal/lazyStream.js +18 -0
- package/dist/http/internal/lazyStream.js.map +1 -0
- package/dist/http/internal/requestState.d.ts +2 -0
- package/dist/http/internal/requestState.d.ts.map +1 -0
- package/dist/http/internal/requestState.js +28 -0
- package/dist/http/internal/requestState.js.map +1 -0
- package/dist/http/internal/tracing.js +14 -4
- package/dist/http/internal/tracing.js.map +1 -1
- package/dist/http/internal/urlParams.d.ts +2 -0
- package/dist/http/internal/urlParams.d.ts.map +1 -0
- package/dist/http/internal/urlParams.js +4 -0
- package/dist/http/internal/urlParams.js.map +1 -0
- package/dist/http/internal/webResponse.d.ts +2 -0
- package/dist/http/internal/webResponse.d.ts.map +1 -0
- package/dist/http/internal/webResponse.js +12 -0
- package/dist/http/internal/webResponse.js.map +1 -0
- package/dist/http-api/HttpApi.js +1 -1
- 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 +121 -18
- package/dist/http-api/HttpApiBuilder.js.map +1 -1
- package/dist/http-api/HttpApiClient.d.ts +29 -4
- package/dist/http-api/HttpApiClient.d.ts.map +1 -1
- package/dist/http-api/HttpApiClient.js +85 -24
- package/dist/http-api/HttpApiClient.js.map +1 -1
- package/dist/http-api/HttpApiEndpoint.d.ts +55 -29
- package/dist/http-api/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/http-api/HttpApiEndpoint.js +49 -5
- package/dist/http-api/HttpApiEndpoint.js.map +1 -1
- package/dist/http-api/HttpApiError.d.ts +58 -0
- package/dist/http-api/HttpApiError.d.ts.map +1 -1
- package/dist/http-api/HttpApiError.js +38 -12
- package/dist/http-api/HttpApiError.js.map +1 -1
- package/dist/http-api/HttpApiScalar.d.ts +2 -1
- package/dist/http-api/HttpApiScalar.d.ts.map +1 -1
- package/dist/http-api/HttpApiScalar.js +6 -3
- package/dist/http-api/HttpApiScalar.js.map +1 -1
- package/dist/http-api/HttpApiSchema.d.ts +191 -9
- package/dist/http-api/HttpApiSchema.d.ts.map +1 -1
- package/dist/http-api/HttpApiSchema.js +137 -4
- package/dist/http-api/HttpApiSchema.js.map +1 -1
- package/dist/http-api/HttpApiSwagger.d.ts +5 -0
- package/dist/http-api/HttpApiSwagger.d.ts.map +1 -1
- package/dist/http-api/HttpApiSwagger.js +14 -4
- package/dist/http-api/HttpApiSwagger.js.map +1 -1
- package/dist/http-api/HttpApiTest.d.ts +13 -2
- package/dist/http-api/HttpApiTest.d.ts.map +1 -1
- package/dist/http-api/HttpApiTest.js +30 -9
- package/dist/http-api/HttpApiTest.js.map +1 -1
- package/dist/http-api/OpenApi.d.ts +17 -3
- package/dist/http-api/OpenApi.d.ts.map +1 -1
- package/dist/http-api/OpenApi.js +57 -32
- package/dist/http-api/OpenApi.js.map +1 -1
- package/dist/http-api/internal/path.js +35 -10
- package/dist/http-api/internal/path.js.map +1 -1
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/core.js +18 -2
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/dateTime.js +19 -7
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/effect.js +89 -76
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/graphql.js +12 -2
- package/dist/internal/graphql.js.map +1 -1
- package/dist/internal/hashMap.js +2 -2
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/hydration.d.ts +2 -0
- package/dist/internal/hydration.d.ts.map +1 -0
- package/dist/internal/hydration.js +15 -0
- package/dist/internal/hydration.js.map +1 -0
- package/dist/internal/inflate.d.ts +2 -0
- package/dist/internal/inflate.d.ts.map +1 -0
- package/dist/internal/inflate.js +680 -0
- package/dist/internal/inflate.js.map +1 -0
- package/dist/internal/record.js +6 -0
- package/dist/internal/record.js.map +1 -1
- package/dist/internal/request.js +20 -7
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/schedule.js +17 -22
- package/dist/internal/schedule.js.map +1 -1
- package/dist/internal/schema/fromJsonSchemaDocument.js +136 -126
- package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -1
- package/dist/internal/schema/interpreter.js +51 -36
- package/dist/internal/schema/interpreter.js.map +1 -1
- package/dist/internal/schema/standardSchema.js +34 -33
- package/dist/internal/schema/standardSchema.js.map +1 -1
- package/dist/internal/schema/toCodeDocument.js +7 -2
- package/dist/internal/schema/toCodeDocument.js.map +1 -1
- package/dist/internal/schema/toCodec.js +86 -1
- package/dist/internal/schema/toCodec.js.map +1 -1
- package/dist/internal/schema/toFormatter.js +5 -5
- package/dist/internal/schema/toFormatter.js.map +1 -1
- package/dist/internal/schema/toJsonSchemaDocument.js +60 -38
- package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -1
- package/dist/internal/trie.js +1 -3
- package/dist/internal/trie.js.map +1 -1
- package/dist/internal/uuid.js +7 -3
- package/dist/internal/uuid.js.map +1 -1
- package/dist/internal/version.js +1 -1
- package/dist/net/NetAddress.d.ts.map +1 -1
- package/dist/net/NetAddress.js +2 -8
- package/dist/net/NetAddress.js.map +1 -1
- package/dist/observability/Otlp.d.ts +15 -0
- package/dist/observability/Otlp.d.ts.map +1 -1
- package/dist/observability/Otlp.js +3 -0
- package/dist/observability/Otlp.js.map +1 -1
- package/dist/observability/OtlpExporter.d.ts +8 -0
- package/dist/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/observability/OtlpExporter.js +15 -13
- package/dist/observability/OtlpExporter.js.map +1 -1
- package/dist/observability/OtlpLogger.d.ts +17 -0
- package/dist/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/observability/OtlpLogger.js +14 -1
- package/dist/observability/OtlpLogger.js.map +1 -1
- package/dist/observability/OtlpMetrics.d.ts +17 -0
- package/dist/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/observability/OtlpMetrics.js +18 -3
- package/dist/observability/OtlpMetrics.js.map +1 -1
- package/dist/observability/OtlpResource.d.ts +3 -1
- package/dist/observability/OtlpResource.d.ts.map +1 -1
- package/dist/observability/OtlpResource.js +11 -4
- package/dist/observability/OtlpResource.js.map +1 -1
- package/dist/observability/OtlpSerialization.d.ts +5 -0
- package/dist/observability/OtlpSerialization.d.ts.map +1 -1
- package/dist/observability/OtlpSerialization.js +14 -3
- package/dist/observability/OtlpSerialization.js.map +1 -1
- package/dist/observability/OtlpTracer.d.ts +17 -0
- package/dist/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/observability/OtlpTracer.js +15 -2
- package/dist/observability/OtlpTracer.js.map +1 -1
- package/dist/observability/internal/protobuf.d.ts +0 -9
- package/dist/observability/internal/protobuf.d.ts.map +1 -1
- package/dist/observability/internal/protobuf.js +2 -10
- package/dist/observability/internal/protobuf.js.map +1 -1
- package/dist/persistence/PersistedCache.d.ts.map +1 -1
- package/dist/persistence/PersistedCache.js +1 -1
- package/dist/persistence/PersistedCache.js.map +1 -1
- package/dist/persistence/PersistedQueue.d.ts +6 -2
- package/dist/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/persistence/PersistedQueue.js +162 -84
- package/dist/persistence/PersistedQueue.js.map +1 -1
- package/dist/persistence/Persistence.d.ts +28 -0
- package/dist/persistence/Persistence.d.ts.map +1 -1
- package/dist/persistence/Persistence.js +36 -8
- package/dist/persistence/Persistence.js.map +1 -1
- package/dist/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/persistence/RateLimiter.js +8 -12
- package/dist/persistence/RateLimiter.js.map +1 -1
- package/dist/persistence/UserDirectories.d.ts +129 -0
- package/dist/persistence/UserDirectories.d.ts.map +1 -0
- package/dist/persistence/UserDirectories.js +178 -0
- package/dist/persistence/UserDirectories.js.map +1 -0
- package/dist/persistence/index.d.ts +5 -0
- package/dist/persistence/index.d.ts.map +1 -1
- package/dist/persistence/index.js +5 -0
- package/dist/persistence/index.js.map +1 -1
- package/dist/process/ChildProcess.d.ts +2 -1
- package/dist/process/ChildProcess.d.ts.map +1 -1
- package/dist/process/ChildProcess.js.map +1 -1
- package/dist/reactivity/AsyncResult.d.ts +6 -0
- package/dist/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/reactivity/AsyncResult.js +28 -1
- package/dist/reactivity/AsyncResult.js.map +1 -1
- package/dist/reactivity/Atom.d.ts +69 -30
- package/dist/reactivity/Atom.d.ts.map +1 -1
- package/dist/reactivity/Atom.js +40 -15
- package/dist/reactivity/Atom.js.map +1 -1
- package/dist/reactivity/AtomHttpApi.d.ts +5 -5
- package/dist/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/reactivity/AtomHttpApi.js +1 -1
- package/dist/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/reactivity/AtomRegistry.d.ts +2 -2
- package/dist/reactivity/AtomRegistry.d.ts.map +1 -1
- package/dist/reactivity/AtomRegistry.js +47 -10
- package/dist/reactivity/AtomRegistry.js.map +1 -1
- package/dist/reactivity/AtomRpc.d.ts +3 -3
- package/dist/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/reactivity/AtomRpc.js +1 -1
- package/dist/reactivity/AtomRpc.js.map +1 -1
- package/dist/reactivity/Hydration.d.ts.map +1 -1
- package/dist/reactivity/Hydration.js +46 -12
- package/dist/reactivity/Hydration.js.map +1 -1
- package/dist/reactivity/Reactivity.d.ts +71 -7
- package/dist/reactivity/Reactivity.d.ts.map +1 -1
- package/dist/reactivity/Reactivity.js +21 -12
- package/dist/reactivity/Reactivity.js.map +1 -1
- package/dist/rpc/Rpc.d.ts +18 -0
- package/dist/rpc/Rpc.d.ts.map +1 -1
- package/dist/rpc/Rpc.js +20 -0
- package/dist/rpc/Rpc.js.map +1 -1
- package/dist/rpc/RpcClient.d.ts +26 -2
- package/dist/rpc/RpcClient.d.ts.map +1 -1
- package/dist/rpc/RpcClient.js +202 -61
- package/dist/rpc/RpcClient.js.map +1 -1
- package/dist/rpc/RpcSerialization.d.ts +15 -0
- package/dist/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/rpc/RpcSerialization.js +21 -5
- package/dist/rpc/RpcSerialization.js.map +1 -1
- package/dist/rpc/RpcServer.d.ts.map +1 -1
- package/dist/rpc/RpcServer.js +9 -18
- package/dist/rpc/RpcServer.js.map +1 -1
- package/dist/schema/Model.d.ts +1 -1
- package/dist/schema/VariantSchema.d.ts +22 -3
- package/dist/schema/VariantSchema.d.ts.map +1 -1
- package/dist/schema/VariantSchema.js +32 -18
- package/dist/schema/VariantSchema.js.map +1 -1
- package/dist/socket/Socket.d.ts +23 -1
- package/dist/socket/Socket.d.ts.map +1 -1
- package/dist/socket/Socket.js +36 -3
- package/dist/socket/Socket.js.map +1 -1
- package/dist/sql/Migrator.d.ts.map +1 -1
- package/dist/sql/Migrator.js +15 -3
- package/dist/sql/Migrator.js.map +1 -1
- package/dist/sql/SqlClient.d.ts +151 -12
- package/dist/sql/SqlClient.d.ts.map +1 -1
- package/dist/sql/SqlClient.js +156 -34
- package/dist/sql/SqlClient.js.map +1 -1
- package/dist/sql/SqlResolver.d.ts +9 -0
- package/dist/sql/SqlResolver.d.ts.map +1 -1
- package/dist/sql/SqlResolver.js +9 -0
- package/dist/sql/SqlResolver.js.map +1 -1
- package/dist/sql/Statement.d.ts +3 -1
- package/dist/sql/Statement.d.ts.map +1 -1
- package/dist/sql/Statement.js +24 -5
- package/dist/sql/Statement.js.map +1 -1
- package/dist/testing/TestClock.d.ts +16 -3
- package/dist/testing/TestClock.d.ts.map +1 -1
- package/dist/testing/TestClock.js +115 -23
- package/dist/testing/TestClock.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +7 -1
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/testing/TestSchema.js +9 -3
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/workflow/Activity.js +1 -0
- package/dist/workflow/Activity.js.map +1 -1
- package/dist/workflow/Workflow.d.ts +22 -0
- package/dist/workflow/Workflow.d.ts.map +1 -1
- package/dist/workflow/Workflow.js +15 -3
- package/dist/workflow/Workflow.js.map +1 -1
- package/dist/workflow/WorkflowEngine.d.ts +20 -1
- package/dist/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/workflow/WorkflowEngine.js +52 -24
- package/dist/workflow/WorkflowEngine.js.map +1 -1
- package/package.json +13 -3
- package/src/Array.ts +223 -61
- package/src/Bytes.ts +111 -0
- package/src/Channel.ts +287 -439
- package/src/ChannelSchema.ts +1 -49
- package/src/Chunk.ts +55 -61
- package/src/Config.ts +12 -86
- package/src/ConfigProvider.ts +41 -44
- package/src/Cron.ts +6 -3
- package/src/Duration.ts +70 -21
- package/src/Effect.ts +642 -220
- package/src/Equivalence.ts +7 -4
- package/src/Exit.ts +24 -9
- package/src/FiberHandle.ts +10 -9
- package/src/FiberMap.ts +13 -66
- package/src/FileSystem.ts +33 -9
- package/src/Graph.ts +171 -1263
- package/src/HashSet.ts +0 -60
- package/src/Iterable.ts +15 -14
- package/src/JsonSchema.ts +28 -3
- package/src/Layer.ts +2 -2
- package/src/ManagedRuntime.ts +72 -6
- package/src/Match.ts +65 -12
- package/src/Metric.ts +249 -507
- package/src/MutableHashMap.ts +4 -473
- package/src/Number.ts +2 -2
- package/src/Optic.ts +17 -332
- package/src/Path.ts +61 -8
- package/src/PubSub.ts +12 -7
- package/src/Queue.ts +5 -37
- package/src/Random.ts +1 -1
- package/src/RcMap.ts +14 -8
- package/src/Record.ts +51 -0
- package/src/Ref.ts +7 -104
- package/src/References.ts +5 -4
- package/src/RequestResolver.ts +46 -87
- package/src/Resource.ts +1 -1
- package/src/Runtime.ts +19 -18
- package/src/Schedule.ts +2 -94
- package/src/Schema.ts +596 -348
- package/src/SchemaAST.ts +20 -9
- package/src/SchemaGetter.ts +22 -5
- package/src/SchemaIssue.ts +44 -53
- package/src/SchemaRepresentation.ts +64 -1
- package/src/SchemaTransformation.ts +1 -1
- package/src/Scope.ts +12 -2
- package/src/ScopedCache.ts +17 -142
- package/src/SemVer.ts +1528 -0
- package/src/SemVerRange.ts +883 -0
- package/src/Sink.ts +6 -2
- package/src/Stream.ts +334 -1011
- package/src/String.ts +25 -12
- package/src/TextDiff.ts +766 -0
- package/src/TxHashMap.ts +1 -103
- package/src/TxHashSet.ts +48 -753
- package/src/TxRef.ts +4 -2
- package/src/ai/AiError.ts +69 -5
- package/src/ai/Chat.ts +10 -5
- package/src/ai/Decision.ts +119 -22
- package/src/ai/DecisionModel.ts +265 -109
- package/src/ai/EmbeddingModel.ts +25 -13
- package/src/ai/LanguageModel.ts +57 -51
- package/src/ai/McpClient.ts +1211 -0
- package/src/ai/McpClientError.ts +329 -0
- package/src/ai/McpProtocol.ts +2 -2
- package/src/ai/McpSchema.ts +153 -35
- package/src/ai/McpServer.ts +232 -275
- package/src/ai/Prompt.ts +49 -35
- package/src/ai/Response.ts +195 -65
- package/src/ai/Tool.ts +12 -4
- package/src/ai/Toolkit.ts +78 -10
- package/src/ai/index.ts +12 -0
- package/src/ai/internal/mcpCore.ts +13 -14
- package/src/ai/internal/mcpProtocol/v2024_11_05.ts +1 -1
- package/src/ai/internal/mcpProtocol/v2025_03_26.ts +1 -1
- package/src/ai/internal/mcpProtocol/v2025_06_18.ts +3 -3
- package/src/ai/internal/mcpProtocol/v2025_11_25.ts +3 -3
- package/src/ai/internal/mcpProtocol/v2026_07_28.ts +12 -14
- package/src/ai/internal/mcpProtocol.ts +22 -2
- package/src/ai/internal/mcpRuntime.ts +3 -4
- package/src/ai/internal/mcpSchema/v2024_11_05.ts +20 -13
- package/src/ai/internal/mcpSchema/v2025_03_26.ts +4 -2
- package/src/ai/internal/mcpSchema/v2025_06_18.ts +7 -7
- package/src/ai/internal/mcpSchema/v2025_11_25.ts +8 -8
- package/src/ai/internal/mcpSchema/v2026_07_28.ts +44 -42
- package/src/cli/CliError.ts +49 -4
- package/src/cli/Command.ts +316 -9
- package/src/cli/Completions.ts +10 -0
- package/src/cli/Flag.ts +218 -0
- package/src/cli/GlobalFlag.ts +3 -3
- package/src/cli/Param.ts +218 -0
- package/src/cli/TerminalCapabilities.ts +156 -0
- package/src/cli/index.ts +6 -0
- package/src/cli/internal/command.ts +10 -4
- package/src/cli/internal/completions/bash.ts +7 -5
- package/src/cli/internal/completions/descriptor.ts +20 -1
- package/src/cli/internal/completions/fish.ts +12 -10
- package/src/cli/internal/completions/powershell.ts +25 -13
- package/src/cli/internal/completions/zsh.ts +15 -8
- package/src/cli/internal/formatter.ts +18 -0
- package/src/cli/internal/lexer.ts +12 -5
- package/src/cli/internal/parser.ts +43 -14
- package/src/cli/internal/wizard.ts +2 -1
- package/src/cluster/ClusterCron.ts +94 -35
- package/src/cluster/ClusterMetrics.ts +149 -7
- package/src/cluster/ClusterWorkflowEngine.ts +164 -53
- package/src/cluster/Entity.ts +4 -0
- package/src/cluster/MessageStorage.ts +21 -3
- package/src/cluster/Runners.ts +145 -72
- package/src/cluster/Sharding.ts +118 -38
- package/src/cluster/ShardingConfig.ts +15 -0
- package/src/cluster/SqlMessageStorage.ts +58 -55
- package/src/cluster/SqlRunnerStorage.ts +10 -4
- package/src/cluster/internal/entityManager.ts +81 -11
- package/src/devtools/DevTools.ts +3 -2
- package/src/devtools/DevToolsClient.ts +27 -10
- package/src/encoding/Base64Url.ts +31 -0
- package/src/encoding/Ini.ts +3 -0
- package/src/encoding/JsonArray.ts +849 -0
- package/src/encoding/Ndjson.ts +211 -20
- package/src/encoding/SchemaBinary.ts +14 -48
- package/src/encoding/Sse.ts +1 -1
- package/src/encoding/Tar.ts +1417 -0
- package/src/encoding/Toml.ts +3 -3
- package/src/encoding/Xml.ts +2037 -0
- package/src/encoding/Yaml.ts +108 -36
- package/src/encoding/Zip.ts +1558 -0
- package/src/encoding/index.ts +24 -0
- package/src/eventlog/EventJournal.ts +611 -227
- package/src/eventlog/EventLog.ts +496 -196
- package/src/eventlog/EventLogEncryption.ts +128 -43
- package/src/eventlog/EventLogMessage.ts +62 -11
- package/src/eventlog/EventLogRemote.ts +77 -21
- package/src/eventlog/EventLogServer.ts +162 -20
- package/src/eventlog/EventLogServerEncrypted.ts +121 -80
- package/src/eventlog/EventLogServerUnencrypted.ts +180 -77
- package/src/eventlog/EventRow.ts +706 -0
- package/src/eventlog/SqlEventJournal.ts +453 -173
- package/src/eventlog/SqlEventLogServerEncrypted.ts +212 -83
- package/src/eventlog/SqlEventLogServerUnencrypted.ts +141 -62
- package/src/eventlog/index.ts +6 -0
- package/src/eventlog/internal/conflicts.ts +123 -0
- package/src/graphql/GraphQLClient.ts +17 -5
- package/src/graphql/GraphQLClientError.ts +5 -12
- package/src/graphql/GraphQLProtocol.ts +277 -20
- package/src/graphql/GraphQLResolver.ts +109 -230
- package/src/http/FetchHttpClient.ts +61 -8
- package/src/http/FindMyWay/internal/router.ts +13 -1
- package/src/http/Headers.ts +343 -163
- package/src/http/HttpClient.ts +144 -136
- package/src/http/HttpClientError.ts +10 -6
- package/src/http/HttpClientRequest.ts +315 -11
- package/src/http/HttpClientResponse.ts +71 -0
- package/src/http/HttpEffect.ts +25 -33
- package/src/http/HttpIncomingMessage.ts +3 -23
- package/src/http/HttpMiddleware.ts +265 -28
- package/src/http/HttpRouter.ts +67 -14
- package/src/http/HttpServerError.ts +14 -7
- package/src/http/HttpServerRequest.ts +73 -14
- package/src/http/HttpServerResponse.ts +49 -23
- package/src/http/HttpStaticServer.ts +29 -19
- package/src/http/HttpTraceContext.ts +1 -1
- package/src/http/MultipartParser/internal/contentType.ts +107 -6
- package/src/http/MultipartParser/internal/headers.ts +4 -16
- package/src/http/MultipartParser/internal/multipart.ts +10 -32
- package/src/http/Url.ts +8 -2
- package/src/http/UrlParams.ts +225 -26
- package/src/http/internal/compression.ts +3 -17
- package/src/http/internal/compressionBody.ts +56 -0
- package/src/http/internal/decompression.ts +235 -0
- package/src/http/internal/lazyStream.ts +25 -0
- package/src/http/internal/requestState.ts +33 -0
- package/src/http/internal/tracing.ts +21 -4
- package/src/http/internal/urlParams.ts +5 -0
- package/src/http/internal/webResponse.ts +20 -0
- package/src/http-api/HttpApi.ts +1 -1
- package/src/http-api/HttpApiBuilder.ts +151 -23
- package/src/http-api/HttpApiClient.ts +160 -31
- package/src/http-api/HttpApiEndpoint.ts +144 -33
- package/src/http-api/HttpApiError.ts +55 -0
- package/src/http-api/HttpApiScalar.ts +4 -3
- package/src/http-api/HttpApiSchema.ts +275 -13
- package/src/http-api/HttpApiSwagger.ts +11 -4
- package/src/http-api/HttpApiTest.ts +33 -9
- package/src/http-api/OpenApi.ts +84 -42
- package/src/http-api/internal/path.ts +40 -12
- package/src/index.ts +24 -0
- package/src/internal/core.ts +22 -2
- package/src/internal/dateTime.ts +20 -7
- package/src/internal/effect.ts +125 -88
- package/src/internal/graphql.ts +30 -7
- package/src/internal/hashMap.ts +2 -2
- package/src/internal/hydration.ts +15 -0
- package/src/internal/inflate.ts +710 -0
- package/src/internal/record.ts +6 -0
- package/src/internal/request.ts +21 -6
- package/src/internal/schedule.ts +20 -39
- package/src/internal/schema/fromJsonSchemaDocument.ts +262 -193
- package/src/internal/schema/interpreter.ts +58 -45
- package/src/internal/schema/standardSchema.ts +32 -30
- package/src/internal/schema/toCodeDocument.ts +8 -3
- package/src/internal/schema/toCodec.ts +116 -1
- package/src/internal/schema/toFormatter.ts +6 -6
- package/src/internal/schema/toJsonSchemaDocument.ts +69 -39
- package/src/internal/trie.ts +1 -3
- package/src/internal/uuid.ts +15 -10
- package/src/internal/version.ts +1 -1
- package/src/net/NetAddress.ts +2 -9
- package/src/observability/Otlp.ts +18 -0
- package/src/observability/OtlpExporter.ts +19 -15
- package/src/observability/OtlpLogger.ts +31 -2
- package/src/observability/OtlpMetrics.ts +35 -4
- package/src/observability/OtlpResource.ts +16 -6
- package/src/observability/OtlpSerialization.ts +17 -3
- package/src/observability/OtlpTracer.ts +32 -3
- package/src/observability/internal/protobuf.ts +2 -10
- package/src/persistence/PersistedCache.ts +3 -1
- package/src/persistence/PersistedQueue.ts +223 -153
- package/src/persistence/Persistence.ts +64 -30
- package/src/persistence/RateLimiter.ts +18 -21
- package/src/persistence/UserDirectories.ts +273 -0
- package/src/persistence/index.ts +6 -0
- package/src/process/ChildProcess.ts +2 -1
- package/src/reactivity/AsyncResult.ts +35 -38
- package/src/reactivity/Atom.ts +134 -166
- package/src/reactivity/AtomHttpApi.ts +10 -16
- package/src/reactivity/AtomRegistry.ts +53 -30
- package/src/reactivity/AtomRpc.ts +6 -22
- package/src/reactivity/Hydration.ts +53 -12
- package/src/reactivity/Reactivity.ts +97 -39
- package/src/rpc/Rpc.ts +21 -0
- package/src/rpc/RpcClient.ts +285 -104
- package/src/rpc/RpcSerialization.ts +21 -5
- package/src/rpc/RpcServer.ts +11 -20
- package/src/schema/VariantSchema.ts +86 -22
- package/src/socket/Socket.ts +45 -20
- package/src/sql/Migrator.ts +19 -9
- package/src/sql/SqlClient.ts +275 -36
- package/src/sql/SqlResolver.ts +9 -0
- package/src/sql/Statement.ts +35 -8
- package/src/testing/TestClock.ts +147 -29
- package/src/testing/TestSchema.ts +9 -3
- package/src/workflow/Activity.ts +1 -0
- package/src/workflow/Workflow.ts +31 -5
- package/src/workflow/WorkflowEngine.ts +93 -31
- package/dist/http/internal/preResponseHandler.d.ts +0 -2
- package/dist/http/internal/preResponseHandler.d.ts.map +0 -1
- package/dist/http/internal/preResponseHandler.js +0 -14
- package/dist/http/internal/preResponseHandler.js.map +0 -1
- package/src/http/internal/preResponseHandler.ts +0 -19
package/src/Effect.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/// <reference lib="esnext.disposable" preserve="true" />
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Describes workflows that run only when executed by the Effect runtime.
|
|
3
5
|
*
|
|
@@ -20,7 +22,7 @@ import type * as ExecutionPlan from "./ExecutionPlan.ts"
|
|
|
20
22
|
import * as Exit from "./Exit.ts"
|
|
21
23
|
import type { Fiber } from "./Fiber.ts"
|
|
22
24
|
import type * as Filter from "./Filter.ts"
|
|
23
|
-
import {
|
|
25
|
+
import { dual, type LazyArg } from "./Function.ts"
|
|
24
26
|
import type { TypeLambda } from "./HKT.ts"
|
|
25
27
|
import type { Inspectable } from "./Inspectable.ts"
|
|
26
28
|
import * as core from "./internal/core.ts"
|
|
@@ -1333,8 +1335,9 @@ export const whileLoop: <A, E, R>(options: {
|
|
|
1333
1335
|
*
|
|
1334
1336
|
* **Details**
|
|
1335
1337
|
*
|
|
1336
|
-
*
|
|
1337
|
-
*
|
|
1338
|
+
* If `evaluate` declares a parameter, it receives an `AbortSignal` that is
|
|
1339
|
+
* aborted if the effect is interrupted. Zero-argument thunks do not allocate
|
|
1340
|
+
* an `AbortController`.
|
|
1338
1341
|
*
|
|
1339
1342
|
* **Gotchas**
|
|
1340
1343
|
*
|
|
@@ -1344,6 +1347,13 @@ export const whileLoop: <A, E, R>(options: {
|
|
|
1344
1347
|
* Interruption aborts the provided `AbortSignal`, but the underlying
|
|
1345
1348
|
* asynchronous operation only stops if it observes that signal.
|
|
1346
1349
|
*
|
|
1350
|
+
* The parameter check reads the `length` property of `evaluate`, which does
|
|
1351
|
+
* not count a rest parameter or any parameter from the first default value
|
|
1352
|
+
* onward. `(...args) => ...` and `(signal = fallback) => ...` therefore
|
|
1353
|
+
* receive `undefined` instead of a signal, as do wrappers that forward
|
|
1354
|
+
* arguments through rest parameters. Declare the signal as an ordinary
|
|
1355
|
+
* parameter: `(signal) => ...`.
|
|
1356
|
+
*
|
|
1347
1357
|
* **Example** (Wrapping a non-rejecting Promise)
|
|
1348
1358
|
*
|
|
1349
1359
|
* ```ts import.meta.vitest
|
|
@@ -1388,9 +1398,10 @@ export const promise: <A>(
|
|
|
1388
1398
|
* Passing `{ try, catch }` uses `catch` to map failures to an error of type
|
|
1389
1399
|
* `E`.
|
|
1390
1400
|
*
|
|
1391
|
-
*
|
|
1392
|
-
* interrupted. The underlying asynchronous operation
|
|
1393
|
-
* that signal.
|
|
1401
|
+
* If the thunk declares a parameter, it receives an `AbortSignal` that is
|
|
1402
|
+
* aborted if the effect is interrupted. The underlying asynchronous operation
|
|
1403
|
+
* only stops if it observes that signal. Zero-argument thunks do not allocate
|
|
1404
|
+
* an `AbortController`.
|
|
1394
1405
|
*
|
|
1395
1406
|
* **Gotchas**
|
|
1396
1407
|
*
|
|
@@ -1398,6 +1409,13 @@ export const promise: <A>(
|
|
|
1398
1409
|
* defect. Return the error value you want in the error channel instead of
|
|
1399
1410
|
* throwing it.
|
|
1400
1411
|
*
|
|
1412
|
+
* The parameter check reads the thunk's `length` property, which does not
|
|
1413
|
+
* count a rest parameter or any parameter from the first default value
|
|
1414
|
+
* onward. `(...args) => ...` and `(signal = fallback) => ...` therefore
|
|
1415
|
+
* receive `undefined` instead of a signal, as do wrappers that forward
|
|
1416
|
+
* arguments through rest parameters. Declare the signal as an ordinary
|
|
1417
|
+
* parameter: `(signal) => ...`.
|
|
1418
|
+
*
|
|
1401
1419
|
* **Example** (Wrapping a fetch request that may fail)
|
|
1402
1420
|
*
|
|
1403
1421
|
* ```ts import.meta.vitest
|
|
@@ -1460,9 +1478,10 @@ export const tryPromise: {
|
|
|
1460
1478
|
* Passing `{ try, catch }` uses `catch` to map failures to an error of type
|
|
1461
1479
|
* `E`.
|
|
1462
1480
|
*
|
|
1463
|
-
*
|
|
1464
|
-
* interrupted. The underlying asynchronous operation
|
|
1465
|
-
* that signal.
|
|
1481
|
+
* If the thunk declares a parameter, it receives an `AbortSignal` that is
|
|
1482
|
+
* aborted if the effect is interrupted. The underlying asynchronous operation
|
|
1483
|
+
* only stops if it observes that signal. Zero-argument thunks do not allocate
|
|
1484
|
+
* an `AbortController`.
|
|
1466
1485
|
*
|
|
1467
1486
|
* **Gotchas**
|
|
1468
1487
|
*
|
|
@@ -1470,6 +1489,13 @@ export const tryPromise: {
|
|
|
1470
1489
|
* defect. Return the error value you want in the error channel instead of
|
|
1471
1490
|
* throwing it.
|
|
1472
1491
|
*
|
|
1492
|
+
* The parameter check reads the thunk's `length` property, which does not
|
|
1493
|
+
* count a rest parameter or any parameter from the first default value
|
|
1494
|
+
* onward. `(...args) => ...` and `(signal = fallback) => ...` therefore
|
|
1495
|
+
* receive `undefined` instead of a signal, as do wrappers that forward
|
|
1496
|
+
* arguments through rest parameters. Declare the signal as an ordinary
|
|
1497
|
+
* parameter: `(signal) => ...`.
|
|
1498
|
+
*
|
|
1473
1499
|
* **Example** (Wrapping a fetch request that may fail)
|
|
1474
1500
|
*
|
|
1475
1501
|
* ```ts import.meta.vitest
|
|
@@ -1532,9 +1558,10 @@ export const tryPromise: {
|
|
|
1532
1558
|
* Passing `{ try, catch }` uses `catch` to map failures to an error of type
|
|
1533
1559
|
* `E`.
|
|
1534
1560
|
*
|
|
1535
|
-
*
|
|
1536
|
-
* interrupted. The underlying asynchronous operation
|
|
1537
|
-
* that signal.
|
|
1561
|
+
* If the thunk declares a parameter, it receives an `AbortSignal` that is
|
|
1562
|
+
* aborted if the effect is interrupted. The underlying asynchronous operation
|
|
1563
|
+
* only stops if it observes that signal. Zero-argument thunks do not allocate
|
|
1564
|
+
* an `AbortController`.
|
|
1538
1565
|
*
|
|
1539
1566
|
* **Gotchas**
|
|
1540
1567
|
*
|
|
@@ -1542,6 +1569,13 @@ export const tryPromise: {
|
|
|
1542
1569
|
* defect. Return the error value you want in the error channel instead of
|
|
1543
1570
|
* throwing it.
|
|
1544
1571
|
*
|
|
1572
|
+
* The parameter check reads the thunk's `length` property, which does not
|
|
1573
|
+
* count a rest parameter or any parameter from the first default value
|
|
1574
|
+
* onward. `(...args) => ...` and `(signal = fallback) => ...` therefore
|
|
1575
|
+
* receive `undefined` instead of a signal, as do wrappers that forward
|
|
1576
|
+
* arguments through rest parameters. Declare the signal as an ordinary
|
|
1577
|
+
* parameter: `(signal) => ...`.
|
|
1578
|
+
*
|
|
1545
1579
|
* **Example** (Wrapping a fetch request that may fail)
|
|
1546
1580
|
*
|
|
1547
1581
|
* ```ts import.meta.vitest
|
|
@@ -1823,10 +1857,20 @@ export {
|
|
|
1823
1857
|
*
|
|
1824
1858
|
* **Details**
|
|
1825
1859
|
*
|
|
1826
|
-
* The registration function receives a `resume` callback and,
|
|
1827
|
-
* an `AbortSignal
|
|
1828
|
-
*
|
|
1829
|
-
*
|
|
1860
|
+
* The registration function receives a `resume` callback and, if it declares
|
|
1861
|
+
* a second parameter, an `AbortSignal` that is aborted if the fiber is
|
|
1862
|
+
* interrupted. Call `resume` at most once with the effect that should complete
|
|
1863
|
+
* the fiber; later calls are ignored. Return an optional cleanup effect from
|
|
1864
|
+
* the registration function to run if the fiber is interrupted.
|
|
1865
|
+
*
|
|
1866
|
+
* **Gotchas**
|
|
1867
|
+
*
|
|
1868
|
+
* The parameter check reads the registration function's `length` property,
|
|
1869
|
+
* which must be at least `2` and does not count a rest parameter or any
|
|
1870
|
+
* parameter from the first default value onward. `(...args) => ...` and
|
|
1871
|
+
* `(resume, signal = fallback) => ...` therefore receive `undefined` instead
|
|
1872
|
+
* of a signal, as do wrappers that forward arguments through rest parameters.
|
|
1873
|
+
* Declare both as ordinary parameters: `(resume, signal) => ...`.
|
|
1830
1874
|
*
|
|
1831
1875
|
* **Example** (Integrating callback APIs)
|
|
1832
1876
|
*
|
|
@@ -2667,7 +2711,9 @@ export const fromResult: <A, E>(result: Result.Result<A, E>) => Effect<A, E> = i
|
|
|
2667
2711
|
* `Option.some` becomes a successful effect with the contained value, while
|
|
2668
2712
|
* `Option.none` becomes a failed effect. By default the failure is a
|
|
2669
2713
|
* `NoSuchElementError`, but you can provide an `onNone` callback to customize
|
|
2670
|
-
* the error value.
|
|
2714
|
+
* the error value. For `Option.none`, `onNone` is evaluated on each execution,
|
|
2715
|
+
* not when the effect is constructed. It is never called for `Option.some`.
|
|
2716
|
+
* If `onNone` throws, the effect dies with the thrown value as a defect.
|
|
2671
2717
|
*
|
|
2672
2718
|
* **Example** (Converting an Option into an Effect)
|
|
2673
2719
|
*
|
|
@@ -3747,9 +3793,12 @@ export const tap: {
|
|
|
3747
3793
|
*
|
|
3748
3794
|
* **Gotchas**
|
|
3749
3795
|
*
|
|
3750
|
-
* `result` only captures typed, recoverable failures.
|
|
3751
|
-
*
|
|
3752
|
-
*
|
|
3796
|
+
* `result` only captures typed, recoverable failures. If the cause contains a
|
|
3797
|
+
* defect, nothing is captured and every typed error is converted to a defect,
|
|
3798
|
+
* preserving reason order and interrupts. A cause with only interruptions
|
|
3799
|
+
* still fails the effect, but an interruption alongside a typed error does not
|
|
3800
|
+
* prevent capture. The first typed error becomes a `Result.Failure` and the
|
|
3801
|
+
* interruption is discarded.
|
|
3753
3802
|
*
|
|
3754
3803
|
* **Example** (Capturing success or failure as Result)
|
|
3755
3804
|
*
|
|
@@ -3791,9 +3840,12 @@ export const result: <A, E, R>(self: Effect<A, E, R>) => Effect<Result.Result<A,
|
|
|
3791
3840
|
*
|
|
3792
3841
|
* **Gotchas**
|
|
3793
3842
|
*
|
|
3794
|
-
* `option` only captures typed, recoverable failures as `Option.none`.
|
|
3795
|
-
*
|
|
3796
|
-
*
|
|
3843
|
+
* `option` only captures typed, recoverable failures as `Option.none`. If the
|
|
3844
|
+
* cause contains a defect, nothing is captured and every typed error is
|
|
3845
|
+
* converted to a defect, preserving reason order and interrupts. A cause with
|
|
3846
|
+
* only interruptions still fails the effect, but an interruption alongside a
|
|
3847
|
+
* typed error does not prevent capture. The effect succeeds with
|
|
3848
|
+
* `Option.none()` and the interruption is discarded.
|
|
3797
3849
|
*
|
|
3798
3850
|
* `option` also discards typed failure values. Use `result` if the failure
|
|
3799
3851
|
* value matters.
|
|
@@ -4579,6 +4631,11 @@ export {
|
|
|
4579
4631
|
* `catch` only handles recoverable errors. It will not recover from
|
|
4580
4632
|
* unrecoverable defects.
|
|
4581
4633
|
*
|
|
4634
|
+
* Defects take precedence over typed errors. If the cause also contains a
|
|
4635
|
+
* defect, the handler does not run and the failure is propagated with every
|
|
4636
|
+
* typed error converted to a defect. An interruption alongside a typed error
|
|
4637
|
+
* does not prevent recovery.
|
|
4638
|
+
*
|
|
4582
4639
|
* @see {@link catchCause} for a version that can recover from both recoverable and unrecoverable errors.
|
|
4583
4640
|
*
|
|
4584
4641
|
* @stability stable
|
|
@@ -4602,6 +4659,12 @@ export {
|
|
|
4602
4659
|
* The error type must have a readonly `_tag` field. `catchTag` matches that
|
|
4603
4660
|
* field and only handles errors with the requested tag.
|
|
4604
4661
|
*
|
|
4662
|
+
* **Gotchas**
|
|
4663
|
+
*
|
|
4664
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
4665
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
4666
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
4667
|
+
*
|
|
4605
4668
|
* **Example** (Handling a tagged error)
|
|
4606
4669
|
*
|
|
4607
4670
|
* ```ts import.meta.vitest
|
|
@@ -4651,6 +4714,12 @@ export const catchTag: {
|
|
|
4651
4714
|
* The error type must have a readonly `_tag` field. `catchTag` matches that
|
|
4652
4715
|
* field and only handles errors with the requested tag.
|
|
4653
4716
|
*
|
|
4717
|
+
* **Gotchas**
|
|
4718
|
+
*
|
|
4719
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
4720
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
4721
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
4722
|
+
*
|
|
4654
4723
|
* **Example** (Handling a tagged error)
|
|
4655
4724
|
*
|
|
4656
4725
|
* ```ts import.meta.vitest
|
|
@@ -4723,6 +4792,12 @@ export const catchTag: {
|
|
|
4723
4792
|
* The error type must have a readonly `_tag` field. `catchTag` matches that
|
|
4724
4793
|
* field and only handles errors with the requested tag.
|
|
4725
4794
|
*
|
|
4795
|
+
* **Gotchas**
|
|
4796
|
+
*
|
|
4797
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
4798
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
4799
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
4800
|
+
*
|
|
4726
4801
|
* **Example** (Handling a tagged error)
|
|
4727
4802
|
*
|
|
4728
4803
|
* ```ts import.meta.vitest
|
|
@@ -4800,6 +4875,12 @@ export const catchTag: {
|
|
|
4800
4875
|
* The error type must have a readonly `_tag` field to use `catchTags`. This
|
|
4801
4876
|
* field is used to identify and match errors.
|
|
4802
4877
|
*
|
|
4878
|
+
* **Gotchas**
|
|
4879
|
+
*
|
|
4880
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
4881
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
4882
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
4883
|
+
*
|
|
4803
4884
|
* **Example** (Handling multiple tagged errors)
|
|
4804
4885
|
*
|
|
4805
4886
|
* ```ts import.meta.vitest
|
|
@@ -4849,6 +4930,12 @@ export const catchTags: {
|
|
|
4849
4930
|
* The error type must have a readonly `_tag` field to use `catchTags`. This
|
|
4850
4931
|
* field is used to identify and match errors.
|
|
4851
4932
|
*
|
|
4933
|
+
* **Gotchas**
|
|
4934
|
+
*
|
|
4935
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
4936
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
4937
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
4938
|
+
*
|
|
4852
4939
|
* **Example** (Handling multiple tagged errors)
|
|
4853
4940
|
*
|
|
4854
4941
|
* ```ts import.meta.vitest
|
|
@@ -4927,6 +5014,12 @@ export const catchTags: {
|
|
|
4927
5014
|
* The error type must have a readonly `_tag` field to use `catchTags`. This
|
|
4928
5015
|
* field is used to identify and match errors.
|
|
4929
5016
|
*
|
|
5017
|
+
* **Gotchas**
|
|
5018
|
+
*
|
|
5019
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
5020
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
5021
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
5022
|
+
*
|
|
4930
5023
|
* **Example** (Handling multiple tagged errors)
|
|
4931
5024
|
*
|
|
4932
5025
|
* ```ts import.meta.vitest
|
|
@@ -5005,6 +5098,12 @@ export const catchTags: {
|
|
|
5005
5098
|
* Use this to handle nested error causes without removing the parent error
|
|
5006
5099
|
* from the error channel. The handler receives the unwrapped reason.
|
|
5007
5100
|
*
|
|
5101
|
+
* **Gotchas**
|
|
5102
|
+
*
|
|
5103
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
5104
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
5105
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
5106
|
+
*
|
|
5008
5107
|
* **Example** (Handling an error reason)
|
|
5009
5108
|
*
|
|
5010
5109
|
* ```ts import.meta.vitest
|
|
@@ -5056,6 +5155,12 @@ export const catchReason: {
|
|
|
5056
5155
|
* Use this to handle nested error causes without removing the parent error
|
|
5057
5156
|
* from the error channel. The handler receives the unwrapped reason.
|
|
5058
5157
|
*
|
|
5158
|
+
* **Gotchas**
|
|
5159
|
+
*
|
|
5160
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
5161
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
5162
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
5163
|
+
*
|
|
5059
5164
|
* **Example** (Handling an error reason)
|
|
5060
5165
|
*
|
|
5061
5166
|
* ```ts import.meta.vitest
|
|
@@ -5136,6 +5241,12 @@ export const catchReason: {
|
|
|
5136
5241
|
* Use this to handle nested error causes without removing the parent error
|
|
5137
5242
|
* from the error channel. The handler receives the unwrapped reason.
|
|
5138
5243
|
*
|
|
5244
|
+
* **Gotchas**
|
|
5245
|
+
*
|
|
5246
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
5247
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
5248
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
5249
|
+
*
|
|
5139
5250
|
* **Example** (Handling an error reason)
|
|
5140
5251
|
*
|
|
5141
5252
|
* ```ts import.meta.vitest
|
|
@@ -5203,6 +5314,12 @@ export const catchReason: {
|
|
|
5203
5314
|
/**
|
|
5204
5315
|
* Catches multiple reasons within a tagged error using an object of handlers.
|
|
5205
5316
|
*
|
|
5317
|
+
* **Gotchas**
|
|
5318
|
+
*
|
|
5319
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
5320
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
5321
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
5322
|
+
*
|
|
5206
5323
|
* **Example** (Handling multiple error reasons)
|
|
5207
5324
|
*
|
|
5208
5325
|
* ```ts import.meta.vitest
|
|
@@ -5244,6 +5361,12 @@ export const catchReasons: {
|
|
|
5244
5361
|
/**
|
|
5245
5362
|
* Catches multiple reasons within a tagged error using an object of handlers.
|
|
5246
5363
|
*
|
|
5364
|
+
* **Gotchas**
|
|
5365
|
+
*
|
|
5366
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
5367
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
5368
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
5369
|
+
*
|
|
5247
5370
|
* **Example** (Handling multiple error reasons)
|
|
5248
5371
|
*
|
|
5249
5372
|
* ```ts import.meta.vitest
|
|
@@ -5325,6 +5448,12 @@ export const catchReasons: {
|
|
|
5325
5448
|
/**
|
|
5326
5449
|
* Catches multiple reasons within a tagged error using an object of handlers.
|
|
5327
5450
|
*
|
|
5451
|
+
* **Gotchas**
|
|
5452
|
+
*
|
|
5453
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
5454
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
5455
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
5456
|
+
*
|
|
5328
5457
|
* **Example** (Handling multiple error reasons)
|
|
5329
5458
|
*
|
|
5330
5459
|
* ```ts import.meta.vitest
|
|
@@ -5707,6 +5836,12 @@ export const catchCause: {
|
|
|
5707
5836
|
* they often indicate serious issues. In some cases, such as dynamically loaded
|
|
5708
5837
|
* plugins, controlled recovery may be needed.
|
|
5709
5838
|
*
|
|
5839
|
+
* **Gotchas**
|
|
5840
|
+
*
|
|
5841
|
+
* `catchDefect` recovers any cause that contains a defect, including causes
|
|
5842
|
+
* that also contain typed errors. Typed error handlers such as `catch` skip
|
|
5843
|
+
* those causes, so defects always take precedence.
|
|
5844
|
+
*
|
|
5710
5845
|
* **Example** (Recovering from defects)
|
|
5711
5846
|
*
|
|
5712
5847
|
* ```ts import.meta.vitest
|
|
@@ -5752,6 +5887,12 @@ export const catchDefect: {
|
|
|
5752
5887
|
* they often indicate serious issues. In some cases, such as dynamically loaded
|
|
5753
5888
|
* plugins, controlled recovery may be needed.
|
|
5754
5889
|
*
|
|
5890
|
+
* **Gotchas**
|
|
5891
|
+
*
|
|
5892
|
+
* `catchDefect` recovers any cause that contains a defect, including causes
|
|
5893
|
+
* that also contain typed errors. Typed error handlers such as `catch` skip
|
|
5894
|
+
* those causes, so defects always take precedence.
|
|
5895
|
+
*
|
|
5755
5896
|
* **Example** (Recovering from defects)
|
|
5756
5897
|
*
|
|
5757
5898
|
* ```ts import.meta.vitest
|
|
@@ -5797,6 +5938,12 @@ export const catchDefect: {
|
|
|
5797
5938
|
* they often indicate serious issues. In some cases, such as dynamically loaded
|
|
5798
5939
|
* plugins, controlled recovery may be needed.
|
|
5799
5940
|
*
|
|
5941
|
+
* **Gotchas**
|
|
5942
|
+
*
|
|
5943
|
+
* `catchDefect` recovers any cause that contains a defect, including causes
|
|
5944
|
+
* that also contain typed errors. Typed error handlers such as `catch` skip
|
|
5945
|
+
* those causes, so defects always take precedence.
|
|
5946
|
+
*
|
|
5800
5947
|
* **Example** (Recovering from defects)
|
|
5801
5948
|
*
|
|
5802
5949
|
* ```ts import.meta.vitest
|
|
@@ -5839,6 +5986,12 @@ export const catchDefect: {
|
|
|
5839
5986
|
* matching. Non-matching errors re-fail with the original cause. Defects and
|
|
5840
5987
|
* interrupts are not caught.
|
|
5841
5988
|
*
|
|
5989
|
+
* **Gotchas**
|
|
5990
|
+
*
|
|
5991
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
5992
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
5993
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
5994
|
+
*
|
|
5842
5995
|
* **Example** (Recovering when a predicate matches)
|
|
5843
5996
|
*
|
|
5844
5997
|
* ```ts import.meta.vitest
|
|
@@ -5885,6 +6038,12 @@ export const catchIf: {
|
|
|
5885
6038
|
* matching. Non-matching errors re-fail with the original cause. Defects and
|
|
5886
6039
|
* interrupts are not caught.
|
|
5887
6040
|
*
|
|
6041
|
+
* **Gotchas**
|
|
6042
|
+
*
|
|
6043
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
6044
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
6045
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
6046
|
+
*
|
|
5888
6047
|
* **Example** (Recovering when a predicate matches)
|
|
5889
6048
|
*
|
|
5890
6049
|
* ```ts import.meta.vitest
|
|
@@ -5937,6 +6096,12 @@ export const catchIf: {
|
|
|
5937
6096
|
* matching. Non-matching errors re-fail with the original cause. Defects and
|
|
5938
6097
|
* interrupts are not caught.
|
|
5939
6098
|
*
|
|
6099
|
+
* **Gotchas**
|
|
6100
|
+
*
|
|
6101
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
6102
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
6103
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
6104
|
+
*
|
|
5940
6105
|
* **Example** (Recovering when a predicate matches)
|
|
5941
6106
|
*
|
|
5942
6107
|
* ```ts import.meta.vitest
|
|
@@ -5989,6 +6154,12 @@ export const catchIf: {
|
|
|
5989
6154
|
* matching. Non-matching errors re-fail with the original cause. Defects and
|
|
5990
6155
|
* interrupts are not caught.
|
|
5991
6156
|
*
|
|
6157
|
+
* **Gotchas**
|
|
6158
|
+
*
|
|
6159
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
6160
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
6161
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
6162
|
+
*
|
|
5992
6163
|
* **Example** (Recovering when a predicate matches)
|
|
5993
6164
|
*
|
|
5994
6165
|
* ```ts import.meta.vitest
|
|
@@ -6023,7 +6194,7 @@ export const catchIf: {
|
|
|
6023
6194
|
*/
|
|
6024
6195
|
<A, E, R, EB extends E, A2, E2, R2, A3 = unassigned, E3 = never, R3 = never>(
|
|
6025
6196
|
self: Effect<A, E, R>,
|
|
6026
|
-
refinement: Predicate.Refinement<E
|
|
6197
|
+
refinement: Predicate.Refinement<NoInfer<E>, EB>,
|
|
6027
6198
|
f: (e: EB) => Effect<A2, E2, R2>,
|
|
6028
6199
|
orElse?: ((e: Exclude<E, EB>) => Effect<A3, E3, R3>) | undefined
|
|
6029
6200
|
): Effect<A | A2 | Exclude<A3, unassigned>, E2 | E3 | (A3 extends unassigned ? Exclude<E, EB> : never), R | R2 | R3>
|
|
@@ -6040,6 +6211,12 @@ export const catchIf: {
|
|
|
6040
6211
|
* matching. Non-matching errors re-fail with the original cause. Defects and
|
|
6041
6212
|
* interrupts are not caught.
|
|
6042
6213
|
*
|
|
6214
|
+
* **Gotchas**
|
|
6215
|
+
*
|
|
6216
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
6217
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
6218
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
6219
|
+
*
|
|
6043
6220
|
* **Example** (Recovering when a predicate matches)
|
|
6044
6221
|
*
|
|
6045
6222
|
* ```ts import.meta.vitest
|
|
@@ -6096,6 +6273,12 @@ export const catchIf: {
|
|
|
6096
6273
|
* `orElse` when provided. Without `orElse`, the original failure cause is
|
|
6097
6274
|
* preserved.
|
|
6098
6275
|
*
|
|
6276
|
+
* **Gotchas**
|
|
6277
|
+
*
|
|
6278
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
6279
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
6280
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
6281
|
+
*
|
|
6099
6282
|
* @see {@link catchIf} for predicate-based recovery from typed errors
|
|
6100
6283
|
* @see {@link catchTag} for recovering from a single tagged error
|
|
6101
6284
|
* @see {@link catchTags} for recovering from several tagged errors
|
|
@@ -6122,6 +6305,12 @@ export const catchFilter: {
|
|
|
6122
6305
|
* `orElse` when provided. Without `orElse`, the original failure cause is
|
|
6123
6306
|
* preserved.
|
|
6124
6307
|
*
|
|
6308
|
+
* **Gotchas**
|
|
6309
|
+
*
|
|
6310
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
6311
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
6312
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
6313
|
+
*
|
|
6125
6314
|
* @see {@link catchIf} for predicate-based recovery from typed errors
|
|
6126
6315
|
* @see {@link catchTag} for recovering from a single tagged error
|
|
6127
6316
|
* @see {@link catchTags} for recovering from several tagged errors
|
|
@@ -6154,6 +6343,12 @@ export const catchFilter: {
|
|
|
6154
6343
|
* `orElse` when provided. Without `orElse`, the original failure cause is
|
|
6155
6344
|
* preserved.
|
|
6156
6345
|
*
|
|
6346
|
+
* **Gotchas**
|
|
6347
|
+
*
|
|
6348
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
6349
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
6350
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
6351
|
+
*
|
|
6157
6352
|
* @see {@link catchIf} for predicate-based recovery from typed errors
|
|
6158
6353
|
* @see {@link catchTag} for recovering from a single tagged error
|
|
6159
6354
|
* @see {@link catchTags} for recovering from several tagged errors
|
|
@@ -6448,6 +6643,9 @@ export const catchCauseFilter: {
|
|
|
6448
6643
|
* Only the failure channel is transformed. The success channel and requirements
|
|
6449
6644
|
* are preserved.
|
|
6450
6645
|
*
|
|
6646
|
+
* Maps every typed error in the cause, preserving defects, interrupts and
|
|
6647
|
+
* reason order. Unlike typed recovery, mapping does not convert errors to defects.
|
|
6648
|
+
*
|
|
6451
6649
|
* **Example** (Transforming the error channel)
|
|
6452
6650
|
*
|
|
6453
6651
|
* ```ts import.meta.vitest
|
|
@@ -6489,6 +6687,9 @@ export const mapError: {
|
|
|
6489
6687
|
* Only the failure channel is transformed. The success channel and requirements
|
|
6490
6688
|
* are preserved.
|
|
6491
6689
|
*
|
|
6690
|
+
* Maps every typed error in the cause, preserving defects, interrupts and
|
|
6691
|
+
* reason order. Unlike typed recovery, mapping does not convert errors to defects.
|
|
6692
|
+
*
|
|
6492
6693
|
* **Example** (Transforming the error channel)
|
|
6493
6694
|
*
|
|
6494
6695
|
* ```ts import.meta.vitest
|
|
@@ -6530,6 +6731,9 @@ export const mapError: {
|
|
|
6530
6731
|
* Only the failure channel is transformed. The success channel and requirements
|
|
6531
6732
|
* are preserved.
|
|
6532
6733
|
*
|
|
6734
|
+
* Maps every typed error in the cause, preserving defects, interrupts and
|
|
6735
|
+
* reason order. Unlike typed recovery, mapping does not convert errors to defects.
|
|
6736
|
+
*
|
|
6533
6737
|
* **Example** (Transforming the error channel)
|
|
6534
6738
|
*
|
|
6535
6739
|
* ```ts import.meta.vitest
|
|
@@ -6575,6 +6779,9 @@ export const mapError: {
|
|
|
6575
6779
|
* the error and the success values without altering the overall success or
|
|
6576
6780
|
* failure status of the effect.
|
|
6577
6781
|
*
|
|
6782
|
+
* Maps every typed error in the cause, preserving defects, interrupts and
|
|
6783
|
+
* reason order. Unlike typed recovery, mapping does not convert errors to defects.
|
|
6784
|
+
*
|
|
6578
6785
|
* **Example** (Transforming success and failure channels)
|
|
6579
6786
|
*
|
|
6580
6787
|
* ```ts import.meta.vitest
|
|
@@ -6618,6 +6825,9 @@ export const mapBoth: {
|
|
|
6618
6825
|
* the error and the success values without altering the overall success or
|
|
6619
6826
|
* failure status of the effect.
|
|
6620
6827
|
*
|
|
6828
|
+
* Maps every typed error in the cause, preserving defects, interrupts and
|
|
6829
|
+
* reason order. Unlike typed recovery, mapping does not convert errors to defects.
|
|
6830
|
+
*
|
|
6621
6831
|
* **Example** (Transforming success and failure channels)
|
|
6622
6832
|
*
|
|
6623
6833
|
* ```ts import.meta.vitest
|
|
@@ -6663,6 +6873,9 @@ export const mapBoth: {
|
|
|
6663
6873
|
* the error and the success values without altering the overall success or
|
|
6664
6874
|
* failure status of the effect.
|
|
6665
6875
|
*
|
|
6876
|
+
* Maps every typed error in the cause, preserving defects, interrupts and
|
|
6877
|
+
* reason order. Unlike typed recovery, mapping does not convert errors to defects.
|
|
6878
|
+
*
|
|
6666
6879
|
* **Example** (Transforming success and failure channels)
|
|
6667
6880
|
*
|
|
6668
6881
|
* ```ts import.meta.vitest
|
|
@@ -7492,7 +7705,9 @@ export declare namespace Retry {
|
|
|
7492
7705
|
* applied. For example, `Schedule.recurs(3)` allows up to three retries after
|
|
7493
7706
|
* the initial attempt.
|
|
7494
7707
|
*
|
|
7495
|
-
* Defects
|
|
7708
|
+
* Defects take precedence over typed errors. A failure whose cause contains a
|
|
7709
|
+
* defect is not retried and is propagated with every typed error converted to a
|
|
7710
|
+
* defect. A typed error alongside an interruption is retried.
|
|
7496
7711
|
*
|
|
7497
7712
|
* **Example** (Retrying with a schedule)
|
|
7498
7713
|
*
|
|
@@ -7545,7 +7760,9 @@ export const retry: {
|
|
|
7545
7760
|
* applied. For example, `Schedule.recurs(3)` allows up to three retries after
|
|
7546
7761
|
* the initial attempt.
|
|
7547
7762
|
*
|
|
7548
|
-
* Defects
|
|
7763
|
+
* Defects take precedence over typed errors. A failure whose cause contains a
|
|
7764
|
+
* defect is not retried and is propagated with every typed error converted to a
|
|
7765
|
+
* defect. A typed error alongside an interruption is retried.
|
|
7549
7766
|
*
|
|
7550
7767
|
* **Example** (Retrying with a schedule)
|
|
7551
7768
|
*
|
|
@@ -7598,7 +7815,9 @@ export const retry: {
|
|
|
7598
7815
|
* applied. For example, `Schedule.recurs(3)` allows up to three retries after
|
|
7599
7816
|
* the initial attempt.
|
|
7600
7817
|
*
|
|
7601
|
-
* Defects
|
|
7818
|
+
* Defects take precedence over typed errors. A failure whose cause contains a
|
|
7819
|
+
* defect is not retried and is propagated with every typed error converted to a
|
|
7820
|
+
* defect. A typed error alongside an interruption is retried.
|
|
7602
7821
|
*
|
|
7603
7822
|
* **Example** (Retrying with a schedule)
|
|
7604
7823
|
*
|
|
@@ -7651,7 +7870,9 @@ export const retry: {
|
|
|
7651
7870
|
* applied. For example, `Schedule.recurs(3)` allows up to three retries after
|
|
7652
7871
|
* the initial attempt.
|
|
7653
7872
|
*
|
|
7654
|
-
* Defects
|
|
7873
|
+
* Defects take precedence over typed errors. A failure whose cause contains a
|
|
7874
|
+
* defect is not retried and is propagated with every typed error converted to a
|
|
7875
|
+
* defect. A typed error alongside an interruption is retried.
|
|
7655
7876
|
*
|
|
7656
7877
|
* **Example** (Retrying with a schedule)
|
|
7657
7878
|
*
|
|
@@ -7708,7 +7929,9 @@ export const retry: {
|
|
|
7708
7929
|
* applied. For example, `Schedule.recurs(3)` allows up to three retries after
|
|
7709
7930
|
* the initial attempt.
|
|
7710
7931
|
*
|
|
7711
|
-
* Defects
|
|
7932
|
+
* Defects take precedence over typed errors. A failure whose cause contains a
|
|
7933
|
+
* defect is not retried and is propagated with every typed error converted to a
|
|
7934
|
+
* defect. A typed error alongside an interruption is retried.
|
|
7712
7935
|
*
|
|
7713
7936
|
* **Example** (Retrying with a schedule)
|
|
7714
7937
|
*
|
|
@@ -7761,7 +7984,9 @@ export const retry: {
|
|
|
7761
7984
|
* applied. For example, `Schedule.recurs(3)` allows up to three retries after
|
|
7762
7985
|
* the initial attempt.
|
|
7763
7986
|
*
|
|
7764
|
-
* Defects
|
|
7987
|
+
* Defects take precedence over typed errors. A failure whose cause contains a
|
|
7988
|
+
* defect is not retried and is propagated with every typed error converted to a
|
|
7989
|
+
* defect. A typed error alongside an interruption is retried.
|
|
7765
7990
|
*
|
|
7766
7991
|
* **Example** (Retrying with a schedule)
|
|
7767
7992
|
*
|
|
@@ -7814,7 +8039,9 @@ export const retry: {
|
|
|
7814
8039
|
* applied. For example, `Schedule.recurs(3)` allows up to three retries after
|
|
7815
8040
|
* the initial attempt.
|
|
7816
8041
|
*
|
|
7817
|
-
* Defects
|
|
8042
|
+
* Defects take precedence over typed errors. A failure whose cause contains a
|
|
8043
|
+
* defect is not retried and is propagated with every typed error converted to a
|
|
8044
|
+
* defect. A typed error alongside an interruption is retried.
|
|
7818
8045
|
*
|
|
7819
8046
|
* **Example** (Retrying with a schedule)
|
|
7820
8047
|
*
|
|
@@ -7869,6 +8096,14 @@ export const retry: {
|
|
|
7869
8096
|
* If the retries are exhausted and the effect still fails, it runs a fallback
|
|
7870
8097
|
* effect instead.
|
|
7871
8098
|
*
|
|
8099
|
+
* **Gotchas**
|
|
8100
|
+
*
|
|
8101
|
+
* Defects take precedence over typed errors. A failure whose cause contains a
|
|
8102
|
+
* defect is not retried and is propagated with every typed error converted to a
|
|
8103
|
+
* defect. A typed error alongside an interruption is retried. When the cause
|
|
8104
|
+
* contains a defect, `orElse` does not run.
|
|
8105
|
+
* This applies to source failures only; policy failures propagate unchanged.
|
|
8106
|
+
*
|
|
7872
8107
|
* **Example** (Falling back after retries are exhausted)
|
|
7873
8108
|
*
|
|
7874
8109
|
* ```ts import.meta.vitest
|
|
@@ -7924,6 +8159,14 @@ export const retryOrElse: {
|
|
|
7924
8159
|
* If the retries are exhausted and the effect still fails, it runs a fallback
|
|
7925
8160
|
* effect instead.
|
|
7926
8161
|
*
|
|
8162
|
+
* **Gotchas**
|
|
8163
|
+
*
|
|
8164
|
+
* Defects take precedence over typed errors. A failure whose cause contains a
|
|
8165
|
+
* defect is not retried and is propagated with every typed error converted to a
|
|
8166
|
+
* defect. A typed error alongside an interruption is retried. When the cause
|
|
8167
|
+
* contains a defect, `orElse` does not run.
|
|
8168
|
+
* This applies to source failures only; policy failures propagate unchanged.
|
|
8169
|
+
*
|
|
7927
8170
|
* **Example** (Falling back after retries are exhausted)
|
|
7928
8171
|
*
|
|
7929
8172
|
* ```ts import.meta.vitest
|
|
@@ -7982,6 +8225,14 @@ export const retryOrElse: {
|
|
|
7982
8225
|
* If the retries are exhausted and the effect still fails, it runs a fallback
|
|
7983
8226
|
* effect instead.
|
|
7984
8227
|
*
|
|
8228
|
+
* **Gotchas**
|
|
8229
|
+
*
|
|
8230
|
+
* Defects take precedence over typed errors. A failure whose cause contains a
|
|
8231
|
+
* defect is not retried and is propagated with every typed error converted to a
|
|
8232
|
+
* defect. A typed error alongside an interruption is retried. When the cause
|
|
8233
|
+
* contains a defect, `orElse` does not run.
|
|
8234
|
+
* This applies to source failures only; policy failures propagate unchanged.
|
|
8235
|
+
*
|
|
7985
8236
|
* **Example** (Falling back after retries are exhausted)
|
|
7986
8237
|
*
|
|
7987
8238
|
* ```ts import.meta.vitest
|
|
@@ -8033,8 +8284,8 @@ export const retryOrElse: {
|
|
|
8033
8284
|
* **Details**
|
|
8034
8285
|
*
|
|
8035
8286
|
* Use `sandbox` when downstream error handling needs to distinguish typed
|
|
8036
|
-
* failures, defects, and interruptions. Use `
|
|
8037
|
-
* typed error channel after cause-level handling.
|
|
8287
|
+
* failures, defects, and interruptions. Use `Effect.catch(Effect.failCause)` to
|
|
8288
|
+
* restore the original typed error channel after cause-level handling.
|
|
8038
8289
|
*
|
|
8039
8290
|
* **Example** (Exposing failures as causes)
|
|
8040
8291
|
*
|
|
@@ -8073,6 +8324,13 @@ export const sandbox: <A, E, R>(
|
|
|
8073
8324
|
* Use the `log` option to emit the full {@link Cause} when the effect fails,
|
|
8074
8325
|
* and `message` to prepend a custom log message.
|
|
8075
8326
|
*
|
|
8327
|
+
* **Gotchas**
|
|
8328
|
+
*
|
|
8329
|
+
* Defects take precedence over typed errors. If the cause also contains a
|
|
8330
|
+
* defect, the failure is not ignored and is propagated with every typed error
|
|
8331
|
+
* converted to a defect. An interruption alongside a typed error does not
|
|
8332
|
+
* prevent the error from being ignored.
|
|
8333
|
+
*
|
|
8076
8334
|
* **Example** (Discarding success and failure values)
|
|
8077
8335
|
*
|
|
8078
8336
|
* ```ts import.meta.vitest
|
|
@@ -8449,6 +8707,12 @@ export const withErrorReporting: <
|
|
|
8449
8707
|
*
|
|
8450
8708
|
* Defects and interruptions are not recovered by this operator.
|
|
8451
8709
|
*
|
|
8710
|
+
* **Gotchas**
|
|
8711
|
+
*
|
|
8712
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
8713
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
8714
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
8715
|
+
*
|
|
8452
8716
|
* **Example** (Replacing failures with a value)
|
|
8453
8717
|
*
|
|
8454
8718
|
* ```ts import.meta.vitest
|
|
@@ -8490,6 +8754,12 @@ export const orElseSucceed: {
|
|
|
8490
8754
|
*
|
|
8491
8755
|
* Defects and interruptions are not recovered by this operator.
|
|
8492
8756
|
*
|
|
8757
|
+
* **Gotchas**
|
|
8758
|
+
*
|
|
8759
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
8760
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
8761
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
8762
|
+
*
|
|
8493
8763
|
* **Example** (Replacing failures with a value)
|
|
8494
8764
|
*
|
|
8495
8765
|
* ```ts import.meta.vitest
|
|
@@ -8531,6 +8801,12 @@ export const orElseSucceed: {
|
|
|
8531
8801
|
*
|
|
8532
8802
|
* Defects and interruptions are not recovered by this operator.
|
|
8533
8803
|
*
|
|
8804
|
+
* **Gotchas**
|
|
8805
|
+
*
|
|
8806
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
8807
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
8808
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
8809
|
+
*
|
|
8534
8810
|
* **Example** (Replacing failures with a value)
|
|
8535
8811
|
*
|
|
8536
8812
|
* ```ts import.meta.vitest
|
|
@@ -10602,6 +10878,12 @@ export const when: {
|
|
|
10602
10878
|
* to process the result if the effect succeeds, or handle the error if the
|
|
10603
10879
|
* effect fails.
|
|
10604
10880
|
*
|
|
10881
|
+
* **Gotchas**
|
|
10882
|
+
*
|
|
10883
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
10884
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
10885
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
10886
|
+
*
|
|
10605
10887
|
* **Example** (Matching success and failure values)
|
|
10606
10888
|
*
|
|
10607
10889
|
* ```ts import.meta.vitest
|
|
@@ -10658,6 +10940,12 @@ export const match: {
|
|
|
10658
10940
|
* to process the result if the effect succeeds, or handle the error if the
|
|
10659
10941
|
* effect fails.
|
|
10660
10942
|
*
|
|
10943
|
+
* **Gotchas**
|
|
10944
|
+
*
|
|
10945
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
10946
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
10947
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
10948
|
+
*
|
|
10661
10949
|
* **Example** (Matching success and failure values)
|
|
10662
10950
|
*
|
|
10663
10951
|
* ```ts import.meta.vitest
|
|
@@ -10719,6 +11007,12 @@ export const match: {
|
|
|
10719
11007
|
* to process the result if the effect succeeds, or handle the error if the
|
|
10720
11008
|
* effect fails.
|
|
10721
11009
|
*
|
|
11010
|
+
* **Gotchas**
|
|
11011
|
+
*
|
|
11012
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
11013
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
11014
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
11015
|
+
*
|
|
10722
11016
|
* **Example** (Matching success and failure values)
|
|
10723
11017
|
*
|
|
10724
11018
|
* ```ts import.meta.vitest
|
|
@@ -10779,6 +11073,12 @@ export const match: {
|
|
|
10779
11073
|
* the handlers immediately without fiber scheduling. For unresolved effects,
|
|
10780
11074
|
* it falls back to the regular `match` behavior.
|
|
10781
11075
|
*
|
|
11076
|
+
* **Gotchas**
|
|
11077
|
+
*
|
|
11078
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
11079
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
11080
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
11081
|
+
*
|
|
10782
11082
|
* **Example** (Pattern matching eagerly when possible)
|
|
10783
11083
|
*
|
|
10784
11084
|
* ```ts import.meta.vitest
|
|
@@ -10820,6 +11120,12 @@ export const matchEager: {
|
|
|
10820
11120
|
* the handlers immediately without fiber scheduling. For unresolved effects,
|
|
10821
11121
|
* it falls back to the regular `match` behavior.
|
|
10822
11122
|
*
|
|
11123
|
+
* **Gotchas**
|
|
11124
|
+
*
|
|
11125
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
11126
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
11127
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
11128
|
+
*
|
|
10823
11129
|
* **Example** (Pattern matching eagerly when possible)
|
|
10824
11130
|
*
|
|
10825
11131
|
* ```ts import.meta.vitest
|
|
@@ -10866,6 +11172,12 @@ export const matchEager: {
|
|
|
10866
11172
|
* the handlers immediately without fiber scheduling. For unresolved effects,
|
|
10867
11173
|
* it falls back to the regular `match` behavior.
|
|
10868
11174
|
*
|
|
11175
|
+
* **Gotchas**
|
|
11176
|
+
*
|
|
11177
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
11178
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
11179
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
11180
|
+
*
|
|
10869
11181
|
* **Example** (Pattern matching eagerly when possible)
|
|
10870
11182
|
*
|
|
10871
11183
|
* ```ts import.meta.vitest
|
|
@@ -11412,6 +11724,12 @@ export const matchCauseEffect: {
|
|
|
11412
11724
|
* performing logging, recovery, notification, or other effectful work. The
|
|
11413
11725
|
* returned effect succeeds or fails according to the handler that is run.
|
|
11414
11726
|
*
|
|
11727
|
+
* **Gotchas**
|
|
11728
|
+
*
|
|
11729
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
11730
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
11731
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
11732
|
+
*
|
|
11415
11733
|
* **Example** (Matching success and failure with effectful handlers)
|
|
11416
11734
|
*
|
|
11417
11735
|
* ```ts import.meta.vitest
|
|
@@ -11464,6 +11782,12 @@ export const matchEffect: {
|
|
|
11464
11782
|
* performing logging, recovery, notification, or other effectful work. The
|
|
11465
11783
|
* returned effect succeeds or fails according to the handler that is run.
|
|
11466
11784
|
*
|
|
11785
|
+
* **Gotchas**
|
|
11786
|
+
*
|
|
11787
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
11788
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
11789
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
11790
|
+
*
|
|
11467
11791
|
* **Example** (Matching success and failure with effectful handlers)
|
|
11468
11792
|
*
|
|
11469
11793
|
* ```ts import.meta.vitest
|
|
@@ -11521,6 +11845,12 @@ export const matchEffect: {
|
|
|
11521
11845
|
* performing logging, recovery, notification, or other effectful work. The
|
|
11522
11846
|
* returned effect succeeds or fails according to the handler that is run.
|
|
11523
11847
|
*
|
|
11848
|
+
* **Gotchas**
|
|
11849
|
+
*
|
|
11850
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
11851
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
11852
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
11853
|
+
*
|
|
11524
11854
|
* **Example** (Matching success and failure with effectful handlers)
|
|
11525
11855
|
*
|
|
11526
11856
|
* ```ts import.meta.vitest
|
|
@@ -11751,9 +12081,9 @@ export const contextWith: <R, A, E, R2>(
|
|
|
11751
12081
|
) => Effect<A, E, R | R2> = internal.contextWith
|
|
11752
12082
|
|
|
11753
12083
|
/**
|
|
11754
|
-
* Provides dependencies to an effect using layers or a context.
|
|
11755
|
-
*
|
|
11756
|
-
*
|
|
12084
|
+
* Provides dependencies to an effect using layers or a context. A layer already
|
|
12085
|
+
* built by an enclosing `provide` or runtime is reused. Sibling `provide` calls
|
|
12086
|
+
* build their own copies. Use `options.local` to build a fresh layer subtree.
|
|
11757
12087
|
*
|
|
11758
12088
|
* **Example** (Providing dependencies with a layer)
|
|
11759
12089
|
*
|
|
@@ -11786,9 +12116,9 @@ export const contextWith: <R, A, E, R2>(
|
|
|
11786
12116
|
*/
|
|
11787
12117
|
export const provide: {
|
|
11788
12118
|
/**
|
|
11789
|
-
* Provides dependencies to an effect using layers or a context.
|
|
11790
|
-
*
|
|
11791
|
-
*
|
|
12119
|
+
* Provides dependencies to an effect using layers or a context. A layer already
|
|
12120
|
+
* built by an enclosing `provide` or runtime is reused. Sibling `provide` calls
|
|
12121
|
+
* build their own copies. Use `options.local` to build a fresh layer subtree.
|
|
11792
12122
|
*
|
|
11793
12123
|
* **Example** (Providing dependencies with a layer)
|
|
11794
12124
|
*
|
|
@@ -11832,9 +12162,9 @@ export const provide: {
|
|
|
11832
12162
|
Layer.Services<Layers[number]> | Exclude<R, Layer.Success<Layers[number]>>
|
|
11833
12163
|
>
|
|
11834
12164
|
/**
|
|
11835
|
-
* Provides dependencies to an effect using layers or a context.
|
|
11836
|
-
*
|
|
11837
|
-
*
|
|
12165
|
+
* Provides dependencies to an effect using layers or a context. A layer already
|
|
12166
|
+
* built by an enclosing `provide` or runtime is reused. Sibling `provide` calls
|
|
12167
|
+
* build their own copies. Use `options.local` to build a fresh layer subtree.
|
|
11838
12168
|
*
|
|
11839
12169
|
* **Example** (Providing dependencies with a layer)
|
|
11840
12170
|
*
|
|
@@ -11874,9 +12204,9 @@ export const provide: {
|
|
|
11874
12204
|
self: Effect<A, E, R>
|
|
11875
12205
|
) => Effect<A, E | E2, RIn | Exclude<R, ROut>>
|
|
11876
12206
|
/**
|
|
11877
|
-
* Provides dependencies to an effect using layers or a context.
|
|
11878
|
-
*
|
|
11879
|
-
*
|
|
12207
|
+
* Provides dependencies to an effect using layers or a context. A layer already
|
|
12208
|
+
* built by an enclosing `provide` or runtime is reused. Sibling `provide` calls
|
|
12209
|
+
* build their own copies. Use `options.local` to build a fresh layer subtree.
|
|
11880
12210
|
*
|
|
11881
12211
|
* **Example** (Providing dependencies with a layer)
|
|
11882
12212
|
*
|
|
@@ -11909,9 +12239,9 @@ export const provide: {
|
|
|
11909
12239
|
*/
|
|
11910
12240
|
<R2>(context: Context.Context<R2>): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, R2>>
|
|
11911
12241
|
/**
|
|
11912
|
-
* Provides dependencies to an effect using layers or a context.
|
|
11913
|
-
*
|
|
11914
|
-
*
|
|
12242
|
+
* Provides dependencies to an effect using layers or a context. A layer already
|
|
12243
|
+
* built by an enclosing `provide` or runtime is reused. Sibling `provide` calls
|
|
12244
|
+
* build their own copies. Use `options.local` to build a fresh layer subtree.
|
|
11915
12245
|
*
|
|
11916
12246
|
* **Example** (Providing dependencies with a layer)
|
|
11917
12247
|
*
|
|
@@ -11954,9 +12284,9 @@ export const provide: {
|
|
|
11954
12284
|
Layer.Services<Layers[number]> | Exclude<R, Layer.Success<Layers[number]>>
|
|
11955
12285
|
>
|
|
11956
12286
|
/**
|
|
11957
|
-
* Provides dependencies to an effect using layers or a context.
|
|
11958
|
-
*
|
|
11959
|
-
*
|
|
12287
|
+
* Provides dependencies to an effect using layers or a context. A layer already
|
|
12288
|
+
* built by an enclosing `provide` or runtime is reused. Sibling `provide` calls
|
|
12289
|
+
* build their own copies. Use `options.local` to build a fresh layer subtree.
|
|
11960
12290
|
*
|
|
11961
12291
|
* **Example** (Providing dependencies with a layer)
|
|
11962
12292
|
*
|
|
@@ -11995,9 +12325,9 @@ export const provide: {
|
|
|
11995
12325
|
} | undefined
|
|
11996
12326
|
): Effect<A, E | E2, RIn | Exclude<R, ROut>>
|
|
11997
12327
|
/**
|
|
11998
|
-
* Provides dependencies to an effect using layers or a context.
|
|
11999
|
-
*
|
|
12000
|
-
*
|
|
12328
|
+
* Provides dependencies to an effect using layers or a context. A layer already
|
|
12329
|
+
* built by an enclosing `provide` or runtime is reused. Sibling `provide` calls
|
|
12330
|
+
* build their own copies. Use `options.local` to build a fresh layer subtree.
|
|
12001
12331
|
*
|
|
12002
12332
|
* **Example** (Providing dependencies with a layer)
|
|
12003
12333
|
*
|
|
@@ -12797,103 +13127,7 @@ export const provideService: {
|
|
|
12797
13127
|
* @since 2.0.0
|
|
12798
13128
|
*/
|
|
12799
13129
|
<I, S>(service: Context.Key<I, S>): {
|
|
12800
|
-
/**
|
|
12801
|
-
* Provides one concrete service implementation to an effect.
|
|
12802
|
-
*
|
|
12803
|
-
* **When to use**
|
|
12804
|
-
*
|
|
12805
|
-
* Use to satisfy one service requirement with an already-built implementation.
|
|
12806
|
-
*
|
|
12807
|
-
* **Details**
|
|
12808
|
-
*
|
|
12809
|
-
* The service requirement identified by the `Context.Key` is removed from the
|
|
12810
|
-
* effect requirements after the implementation is provided.
|
|
12811
|
-
*
|
|
12812
|
-
* **Example** (Providing a service value)
|
|
12813
|
-
*
|
|
12814
|
-
* ```ts import.meta.vitest
|
|
12815
|
-
* import { Context, Effect } from "effect"
|
|
12816
|
-
* const output: Array<unknown> = []
|
|
12817
|
-
*
|
|
12818
|
-
* // Define a service for configuration
|
|
12819
|
-
* const Config = Context.Service<{
|
|
12820
|
-
* apiUrl: string
|
|
12821
|
-
* timeout: number
|
|
12822
|
-
* }>("Config")
|
|
12823
|
-
*
|
|
12824
|
-
* const fetchData = Effect.gen(function*() {
|
|
12825
|
-
* const config = yield* Effect.service(Config)
|
|
12826
|
-
* yield* Effect.sync(() => { output.push(`Fetching from: ${config.apiUrl}`) })
|
|
12827
|
-
* yield* Effect.sync(() => { output.push(`Timeout: ${config.timeout}ms`) })
|
|
12828
|
-
* return "data"
|
|
12829
|
-
* })
|
|
12830
|
-
*
|
|
12831
|
-
* // Provide the service implementation
|
|
12832
|
-
* const program = Effect.provideService(fetchData, Config, {
|
|
12833
|
-
* apiUrl: "https://api.example.com",
|
|
12834
|
-
* timeout: 5000
|
|
12835
|
-
* })
|
|
12836
|
-
*
|
|
12837
|
-
* void output.push(Effect.runSync(program))
|
|
12838
|
-
* output // => ["Fetching from: https://api.example.com", "Timeout: 5000ms", "data"]
|
|
12839
|
-
* ```
|
|
12840
|
-
*
|
|
12841
|
-
* @see {@link provide} for providing multiple layers to an effect.
|
|
12842
|
-
* @see {@link provideServiceEffect} for acquiring the service implementation effectfully.
|
|
12843
|
-
* @see {@link provideContext} for providing a complete context.
|
|
12844
|
-
* @stability stable
|
|
12845
|
-
* @category providing services
|
|
12846
|
-
* @since 2.0.0
|
|
12847
|
-
*/
|
|
12848
13130
|
(implementation: S): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, I>>
|
|
12849
|
-
/**
|
|
12850
|
-
* Provides one concrete service implementation to an effect.
|
|
12851
|
-
*
|
|
12852
|
-
* **When to use**
|
|
12853
|
-
*
|
|
12854
|
-
* Use to satisfy one service requirement with an already-built implementation.
|
|
12855
|
-
*
|
|
12856
|
-
* **Details**
|
|
12857
|
-
*
|
|
12858
|
-
* The service requirement identified by the `Context.Key` is removed from the
|
|
12859
|
-
* effect requirements after the implementation is provided.
|
|
12860
|
-
*
|
|
12861
|
-
* **Example** (Providing a service value)
|
|
12862
|
-
*
|
|
12863
|
-
* ```ts import.meta.vitest
|
|
12864
|
-
* import { Context, Effect } from "effect"
|
|
12865
|
-
* const output: Array<unknown> = []
|
|
12866
|
-
*
|
|
12867
|
-
* // Define a service for configuration
|
|
12868
|
-
* const Config = Context.Service<{
|
|
12869
|
-
* apiUrl: string
|
|
12870
|
-
* timeout: number
|
|
12871
|
-
* }>("Config")
|
|
12872
|
-
*
|
|
12873
|
-
* const fetchData = Effect.gen(function*() {
|
|
12874
|
-
* const config = yield* Effect.service(Config)
|
|
12875
|
-
* yield* Effect.sync(() => { output.push(`Fetching from: ${config.apiUrl}`) })
|
|
12876
|
-
* yield* Effect.sync(() => { output.push(`Timeout: ${config.timeout}ms`) })
|
|
12877
|
-
* return "data"
|
|
12878
|
-
* })
|
|
12879
|
-
*
|
|
12880
|
-
* // Provide the service implementation
|
|
12881
|
-
* const program = Effect.provideService(fetchData, Config, {
|
|
12882
|
-
* apiUrl: "https://api.example.com",
|
|
12883
|
-
* timeout: 5000
|
|
12884
|
-
* })
|
|
12885
|
-
*
|
|
12886
|
-
* void output.push(Effect.runSync(program))
|
|
12887
|
-
* output // => ["Fetching from: https://api.example.com", "Timeout: 5000ms", "data"]
|
|
12888
|
-
* ```
|
|
12889
|
-
*
|
|
12890
|
-
* @see {@link provide} for providing multiple layers to an effect.
|
|
12891
|
-
* @see {@link provideServiceEffect} for acquiring the service implementation effectfully.
|
|
12892
|
-
* @see {@link provideContext} for providing a complete context.
|
|
12893
|
-
* @stability stable
|
|
12894
|
-
* @category providing services
|
|
12895
|
-
* @since 2.0.0
|
|
12896
|
-
*/
|
|
12897
13131
|
<A, E, R>(self: Effect<A, E, R>, implementation: S): Effect<A, E, Exclude<R, I>>
|
|
12898
13132
|
}
|
|
12899
13133
|
/**
|
|
@@ -15412,6 +15646,10 @@ export const forever: <
|
|
|
15412
15646
|
* The source effect is always evaluated once before the schedule is stepped.
|
|
15413
15647
|
* The schedule controls additional repetitions, not the initial execution.
|
|
15414
15648
|
*
|
|
15649
|
+
* If the effect or policy fails with a cause that contains a defect, the
|
|
15650
|
+
* failure is propagated with every typed error converted to a defect.
|
|
15651
|
+
* An interruption alongside a typed error does not block the typed error path.
|
|
15652
|
+
*
|
|
15415
15653
|
* **Example** (Repeating successful effects with a schedule)
|
|
15416
15654
|
*
|
|
15417
15655
|
* ```ts import.meta.vitest
|
|
@@ -15494,6 +15732,10 @@ export const repeat: {
|
|
|
15494
15732
|
* The source effect is always evaluated once before the schedule is stepped.
|
|
15495
15733
|
* The schedule controls additional repetitions, not the initial execution.
|
|
15496
15734
|
*
|
|
15735
|
+
* If the effect or policy fails with a cause that contains a defect, the
|
|
15736
|
+
* failure is propagated with every typed error converted to a defect.
|
|
15737
|
+
* An interruption alongside a typed error does not block the typed error path.
|
|
15738
|
+
*
|
|
15497
15739
|
* **Example** (Repeating successful effects with a schedule)
|
|
15498
15740
|
*
|
|
15499
15741
|
* ```ts import.meta.vitest
|
|
@@ -15576,6 +15818,10 @@ export const repeat: {
|
|
|
15576
15818
|
* The source effect is always evaluated once before the schedule is stepped.
|
|
15577
15819
|
* The schedule controls additional repetitions, not the initial execution.
|
|
15578
15820
|
*
|
|
15821
|
+
* If the effect or policy fails with a cause that contains a defect, the
|
|
15822
|
+
* failure is propagated with every typed error converted to a defect.
|
|
15823
|
+
* An interruption alongside a typed error does not block the typed error path.
|
|
15824
|
+
*
|
|
15579
15825
|
* **Example** (Repeating successful effects with a schedule)
|
|
15580
15826
|
*
|
|
15581
15827
|
* ```ts import.meta.vitest
|
|
@@ -15658,6 +15904,10 @@ export const repeat: {
|
|
|
15658
15904
|
* The source effect is always evaluated once before the schedule is stepped.
|
|
15659
15905
|
* The schedule controls additional repetitions, not the initial execution.
|
|
15660
15906
|
*
|
|
15907
|
+
* If the effect or policy fails with a cause that contains a defect, the
|
|
15908
|
+
* failure is propagated with every typed error converted to a defect.
|
|
15909
|
+
* An interruption alongside a typed error does not block the typed error path.
|
|
15910
|
+
*
|
|
15661
15911
|
* **Example** (Repeating successful effects with a schedule)
|
|
15662
15912
|
*
|
|
15663
15913
|
* ```ts import.meta.vitest
|
|
@@ -15744,6 +15994,10 @@ export const repeat: {
|
|
|
15744
15994
|
* The source effect is always evaluated once before the schedule is stepped.
|
|
15745
15995
|
* The schedule controls additional repetitions, not the initial execution.
|
|
15746
15996
|
*
|
|
15997
|
+
* If the effect or policy fails with a cause that contains a defect, the
|
|
15998
|
+
* failure is propagated with every typed error converted to a defect.
|
|
15999
|
+
* An interruption alongside a typed error does not block the typed error path.
|
|
16000
|
+
*
|
|
15747
16001
|
* **Example** (Repeating successful effects with a schedule)
|
|
15748
16002
|
*
|
|
15749
16003
|
* ```ts import.meta.vitest
|
|
@@ -15826,6 +16080,10 @@ export const repeat: {
|
|
|
15826
16080
|
* The source effect is always evaluated once before the schedule is stepped.
|
|
15827
16081
|
* The schedule controls additional repetitions, not the initial execution.
|
|
15828
16082
|
*
|
|
16083
|
+
* If the effect or policy fails with a cause that contains a defect, the
|
|
16084
|
+
* failure is propagated with every typed error converted to a defect.
|
|
16085
|
+
* An interruption alongside a typed error does not block the typed error path.
|
|
16086
|
+
*
|
|
15829
16087
|
* **Example** (Repeating successful effects with a schedule)
|
|
15830
16088
|
*
|
|
15831
16089
|
* ```ts import.meta.vitest
|
|
@@ -15911,6 +16169,10 @@ export const repeat: {
|
|
|
15911
16169
|
* The source effect is always evaluated once before the schedule is stepped.
|
|
15912
16170
|
* The schedule controls additional repetitions, not the initial execution.
|
|
15913
16171
|
*
|
|
16172
|
+
* If the effect or policy fails with a cause that contains a defect, the
|
|
16173
|
+
* failure is propagated with every typed error converted to a defect.
|
|
16174
|
+
* An interruption alongside a typed error does not block the typed error path.
|
|
16175
|
+
*
|
|
15914
16176
|
* **Example** (Repeating successful effects with a schedule)
|
|
15915
16177
|
*
|
|
15916
16178
|
* ```ts import.meta.vitest
|
|
@@ -15985,6 +16247,13 @@ export const repeat: {
|
|
|
15985
16247
|
* otherwise it receives `None`. If the schedule completes normally, the
|
|
15986
16248
|
* returned effect succeeds with the schedule's output.
|
|
15987
16249
|
*
|
|
16250
|
+
* **Gotchas**
|
|
16251
|
+
*
|
|
16252
|
+
* Defects take precedence over typed errors from either the effect or policy.
|
|
16253
|
+
* If the cause contains a defect, `orElse` does not run and every typed error
|
|
16254
|
+
* is converted to a defect. An interruption alongside a typed error does not
|
|
16255
|
+
* prevent `orElse` from running.
|
|
16256
|
+
*
|
|
15988
16257
|
* **Example** (Recovering after repetition stops)
|
|
15989
16258
|
*
|
|
15990
16259
|
* ```ts import.meta.vitest
|
|
@@ -16038,6 +16307,13 @@ export const repeatOrElse: {
|
|
|
16038
16307
|
* otherwise it receives `None`. If the schedule completes normally, the
|
|
16039
16308
|
* returned effect succeeds with the schedule's output.
|
|
16040
16309
|
*
|
|
16310
|
+
* **Gotchas**
|
|
16311
|
+
*
|
|
16312
|
+
* Defects take precedence over typed errors from either the effect or policy.
|
|
16313
|
+
* If the cause contains a defect, `orElse` does not run and every typed error
|
|
16314
|
+
* is converted to a defect. An interruption alongside a typed error does not
|
|
16315
|
+
* prevent `orElse` from running.
|
|
16316
|
+
*
|
|
16041
16317
|
* **Example** (Recovering after repetition stops)
|
|
16042
16318
|
*
|
|
16043
16319
|
* ```ts import.meta.vitest
|
|
@@ -16094,6 +16370,13 @@ export const repeatOrElse: {
|
|
|
16094
16370
|
* otherwise it receives `None`. If the schedule completes normally, the
|
|
16095
16371
|
* returned effect succeeds with the schedule's output.
|
|
16096
16372
|
*
|
|
16373
|
+
* **Gotchas**
|
|
16374
|
+
*
|
|
16375
|
+
* Defects take precedence over typed errors from either the effect or policy.
|
|
16376
|
+
* If the cause contains a defect, `orElse` does not run and every typed error
|
|
16377
|
+
* is converted to a defect. An interruption alongside a typed error does not
|
|
16378
|
+
* prevent `orElse` from running.
|
|
16379
|
+
*
|
|
16097
16380
|
* **Example** (Recovering after repetition stops)
|
|
16098
16381
|
*
|
|
16099
16382
|
* ```ts import.meta.vitest
|
|
@@ -17912,8 +18195,8 @@ export const requestUnsafe: <A extends Request.Any>(
|
|
|
17912
18195
|
* You can use the `forkChild` method whenever you want to execute an effect in a
|
|
17913
18196
|
* new fiber, concurrently and without "blocking" the fiber executing other
|
|
17914
18197
|
* effects. Using fibers can be tricky, so instead of using this method
|
|
17915
|
-
* directly, consider
|
|
17916
|
-
* `
|
|
18198
|
+
* directly, consider higher-level methods such as `Effect.race`,
|
|
18199
|
+
* `Effect.raceFirst`, or `Effect.all` with a concurrency option.
|
|
17917
18200
|
*
|
|
17918
18201
|
* The fiber returned by this method has methods to interrupt the fiber and to
|
|
17919
18202
|
* wait for it to finish executing the effect. See `Fiber` for more
|
|
@@ -18105,9 +18388,14 @@ export const forkScoped: <
|
|
|
18105
18388
|
: <A, E, R>(self: Effect<A, E, R>) => Effect<Fiber<A, E>, never, R | Scope> = internal.forkScoped
|
|
18106
18389
|
|
|
18107
18390
|
/**
|
|
18108
|
-
* Forks the effect into a new fiber
|
|
18109
|
-
*
|
|
18110
|
-
*
|
|
18391
|
+
* Forks the effect into a new fiber with no parent and no scope, so its lifetime
|
|
18392
|
+
* is independent of the forking fiber.
|
|
18393
|
+
*
|
|
18394
|
+
* **Details**
|
|
18395
|
+
*
|
|
18396
|
+
* The detached fiber inherits the forking fiber's context. It continues running
|
|
18397
|
+
* until it completes or is explicitly interrupted through the returned handle,
|
|
18398
|
+
* even after the forking fiber terminates.
|
|
18111
18399
|
*
|
|
18112
18400
|
* **Example** (Forking a detached fiber)
|
|
18113
18401
|
*
|
|
@@ -18265,11 +18553,11 @@ export interface RunOptions {
|
|
|
18265
18553
|
* import { Effect, Fiber } from "effect"
|
|
18266
18554
|
* const output: Array<unknown> = []
|
|
18267
18555
|
*
|
|
18268
|
-
* // ┌─── Effect<
|
|
18556
|
+
* // ┌─── Effect<string, never, never>
|
|
18269
18557
|
* // ▼
|
|
18270
18558
|
* const program = Effect.sync(() => { output.push("running...") }).pipe(Effect.as("done"))
|
|
18271
18559
|
*
|
|
18272
|
-
* // ┌───
|
|
18560
|
+
* // ┌─── Fiber<string, never>
|
|
18273
18561
|
* // ▼
|
|
18274
18562
|
* const fiber = Effect.runFork(program)
|
|
18275
18563
|
*
|
|
@@ -18604,9 +18892,10 @@ export const runPromiseExitWith: <R>(
|
|
|
18604
18892
|
*
|
|
18605
18893
|
* **Details**
|
|
18606
18894
|
*
|
|
18607
|
-
* If the effect fails, dies, is interrupted,
|
|
18608
|
-
*
|
|
18609
|
-
*
|
|
18895
|
+
* If the effect fails, dies, or is interrupted, `runSync` throws the squashed
|
|
18896
|
+
* cause instead of returning a value. Typed errors can be thrown directly,
|
|
18897
|
+
* including non-Error values. Asynchronous work throws `Cause.AsyncFiberError`.
|
|
18898
|
+
* Use `runSyncExit` when you want the failure captured as an `Exit`.
|
|
18610
18899
|
*
|
|
18611
18900
|
* **Example** (Running a synchronous effect)
|
|
18612
18901
|
*
|
|
@@ -25245,50 +25534,113 @@ export const trackDuration: {
|
|
|
25245
25534
|
// Transactions
|
|
25246
25535
|
// -----------------------------------------------------------------------------
|
|
25247
25536
|
|
|
25537
|
+
/**
|
|
25538
|
+
* Why the current transaction attempt started after a previous attempt did not commit.
|
|
25539
|
+
*
|
|
25540
|
+
* **Details**
|
|
25541
|
+
*
|
|
25542
|
+
* `"retry"` means the previous attempt called {@link txRetry}. `"conflict"`
|
|
25543
|
+
* means an accessed `TxRef` changed before commit. The first attempt has no
|
|
25544
|
+
* retry reason.
|
|
25545
|
+
*
|
|
25546
|
+
* @stability stable
|
|
25547
|
+
* @category models
|
|
25548
|
+
* @since 4.0.0
|
|
25549
|
+
*/
|
|
25550
|
+
export type TransactionRetryReason = "retry" | "conflict"
|
|
25551
|
+
|
|
25552
|
+
/**
|
|
25553
|
+
* Journal and attempt metadata for an Effect transaction.
|
|
25554
|
+
*
|
|
25555
|
+
* **When to use**
|
|
25556
|
+
*
|
|
25557
|
+
* Use to type the value provided by {@link Transaction}.
|
|
25558
|
+
*
|
|
25559
|
+
* **Details**
|
|
25560
|
+
*
|
|
25561
|
+
* `attempt` starts at `1` and counts each run of the outermost transaction body.
|
|
25562
|
+
* `retryReason` is `"retry"` after {@link txRetry} and `"conflict"` after an
|
|
25563
|
+
* accessed `TxRef` changes before commit; it is unset on the first attempt.
|
|
25564
|
+
* `start`, `now`, `elapsed`, and `elapsedSincePrevious` are millisecond
|
|
25565
|
+
* timestamps and durations for the current attempt, matching {@link Schedule}
|
|
25566
|
+
* metadata. Each journal entry stores the observed version and value of a
|
|
25567
|
+
* `TxRef`. `written` is true when this transaction has updated that ref.
|
|
25568
|
+
*
|
|
25569
|
+
* @see {@link Transaction} for the context service that provides this metadata
|
|
25570
|
+
* @see {@link TransactionRetryReason} for the retry-reason tags recorded on later attempts
|
|
25571
|
+
*
|
|
25572
|
+
* @stability stable
|
|
25573
|
+
* @category models
|
|
25574
|
+
* @since 4.0.0
|
|
25575
|
+
*/
|
|
25576
|
+
export interface TransactionMeta {
|
|
25577
|
+
readonly journal: ReadonlyMap<
|
|
25578
|
+
TxRef<any>,
|
|
25579
|
+
{
|
|
25580
|
+
readonly version: number
|
|
25581
|
+
readonly value: any
|
|
25582
|
+
readonly written: boolean
|
|
25583
|
+
}
|
|
25584
|
+
>
|
|
25585
|
+
readonly attempt: number
|
|
25586
|
+
readonly retryReason: TransactionRetryReason | undefined
|
|
25587
|
+
readonly start: number
|
|
25588
|
+
readonly now: number
|
|
25589
|
+
readonly elapsed: number
|
|
25590
|
+
readonly elapsedSincePrevious: number
|
|
25591
|
+
}
|
|
25592
|
+
|
|
25593
|
+
/** @internal */
|
|
25594
|
+
export interface TransactionMetaInner {
|
|
25595
|
+
retry: boolean
|
|
25596
|
+
journal: Map<
|
|
25597
|
+
TxRef<any>,
|
|
25598
|
+
{
|
|
25599
|
+
readonly version: number
|
|
25600
|
+
value: any
|
|
25601
|
+
written: boolean
|
|
25602
|
+
}
|
|
25603
|
+
>
|
|
25604
|
+
attempt: number
|
|
25605
|
+
retryReason: TransactionRetryReason | undefined
|
|
25606
|
+
start: number
|
|
25607
|
+
now: number
|
|
25608
|
+
elapsed: number
|
|
25609
|
+
elapsedSincePrevious: number
|
|
25610
|
+
}
|
|
25611
|
+
|
|
25248
25612
|
/**
|
|
25249
25613
|
* Service that holds the current transaction state.
|
|
25250
25614
|
*
|
|
25251
25615
|
* **Details**
|
|
25252
25616
|
*
|
|
25253
|
-
*
|
|
25254
|
-
*
|
|
25617
|
+
* Nested {@link tx} calls reuse this same service instance. Yield it inside a
|
|
25618
|
+
* transaction body to read {@link TransactionMeta} fields such as `attempt`
|
|
25619
|
+
* and `retryReason`.
|
|
25255
25620
|
*
|
|
25256
|
-
* **Example** (
|
|
25621
|
+
* **Example** (Reading transaction metadata)
|
|
25257
25622
|
*
|
|
25258
25623
|
* ```ts import.meta.vitest
|
|
25259
25624
|
* import { Effect } from "effect"
|
|
25260
25625
|
*
|
|
25261
|
-
*
|
|
25262
|
-
* const txEffect = Effect.gen(function*() {
|
|
25626
|
+
* const program = Effect.tx(Effect.gen(function*() {
|
|
25263
25627
|
* const tx = yield* Effect.Transaction
|
|
25264
|
-
*
|
|
25265
|
-
*
|
|
25266
|
-
* })
|
|
25628
|
+
* return [tx.attempt, tx.retryReason, tx.elapsed, tx.elapsedSincePrevious]
|
|
25629
|
+
* }))
|
|
25267
25630
|
*
|
|
25268
|
-
*
|
|
25269
|
-
* retry: false,
|
|
25270
|
-
* journal: new Map()
|
|
25271
|
-
* })
|
|
25272
|
-
* Effect.runSync(runnable) // => "Transaction complete"
|
|
25631
|
+
* Effect.runSync(program) // => [1, undefined, 0, 0]
|
|
25273
25632
|
* ```
|
|
25274
25633
|
*
|
|
25634
|
+
* @see {@link tx} for the outermost transaction boundary that creates this service
|
|
25635
|
+
* @see {@link TransactionMeta} for the journal and attempt metadata
|
|
25636
|
+
*
|
|
25275
25637
|
* @stability stable
|
|
25276
25638
|
* @category transactions
|
|
25277
25639
|
* @since 4.0.0
|
|
25278
25640
|
*/
|
|
25279
25641
|
export class Transaction extends Context.Service<
|
|
25280
25642
|
Transaction,
|
|
25281
|
-
|
|
25282
|
-
retry: boolean
|
|
25283
|
-
readonly journal: Map<
|
|
25284
|
-
TxRef<any>,
|
|
25285
|
-
{
|
|
25286
|
-
readonly version: number
|
|
25287
|
-
value: any
|
|
25288
|
-
written: boolean
|
|
25289
|
-
}
|
|
25290
|
-
>
|
|
25291
|
-
}
|
|
25643
|
+
TransactionMeta
|
|
25292
25644
|
>()("effect/Effect/Transaction") {}
|
|
25293
25645
|
|
|
25294
25646
|
/**
|
|
@@ -25342,52 +25694,75 @@ export const tx = <A, E, R>(
|
|
|
25342
25694
|
effect: Effect<A, E, R>
|
|
25343
25695
|
): Effect<A, E, Exclude<R, Transaction>> =>
|
|
25344
25696
|
withFiber((fiber) => {
|
|
25345
|
-
|
|
25697
|
+
const state = Context.getOrUndefined(fiber.context, Transaction)
|
|
25346
25698
|
if (state && !completedTransactions.has(state)) {
|
|
25347
25699
|
return effect as Effect<A, E, Exclude<R, Transaction>>
|
|
25348
25700
|
}
|
|
25701
|
+
const clock = fiber.getRef(internal.ClockRef)
|
|
25702
|
+
const now = clock.currentTimeMillisUnsafe()
|
|
25349
25703
|
// Create transaction state only at the outermost boundary
|
|
25350
|
-
|
|
25704
|
+
const mutable: TransactionMetaInner = {
|
|
25705
|
+
journal: new Map(),
|
|
25706
|
+
retry: false,
|
|
25707
|
+
attempt: 1,
|
|
25708
|
+
retryReason: undefined,
|
|
25709
|
+
start: now,
|
|
25710
|
+
now,
|
|
25711
|
+
elapsed: 0,
|
|
25712
|
+
elapsedSincePrevious: 0
|
|
25713
|
+
}
|
|
25351
25714
|
let result: Exit.Exit<A, E> | undefined
|
|
25352
|
-
return uninterruptibleMask((restore) =>
|
|
25353
|
-
|
|
25715
|
+
return uninterruptibleMask((restore) => {
|
|
25716
|
+
const run = restore(effect).pipe(
|
|
25717
|
+
provideService(Transaction, mutable),
|
|
25718
|
+
tapCause((cause) => {
|
|
25719
|
+
if (!mutable.retry) return void_
|
|
25720
|
+
// txRetry interrupts the body; any other reason in the cause is a real failure.
|
|
25721
|
+
// Roll back now so the step below fails instead of waiting or rerunning.
|
|
25722
|
+
if (!internal.hasInterruptsOnly(cause)) return sync(() => clearTransaction(mutable))
|
|
25723
|
+
return restore(awaitPendingTransaction(mutable))
|
|
25724
|
+
}),
|
|
25725
|
+
exit
|
|
25726
|
+
)
|
|
25727
|
+
return flatMap(
|
|
25354
25728
|
whileLoop({
|
|
25355
25729
|
while: () => !result,
|
|
25356
|
-
body:
|
|
25357
|
-
|
|
25358
|
-
|
|
25359
|
-
|
|
25360
|
-
|
|
25361
|
-
|
|
25362
|
-
// Roll back now so the step below fails instead of waiting or rerunning.
|
|
25363
|
-
if (!internal.hasInterruptsOnly(cause)) return sync(() => clearTransaction(state))
|
|
25364
|
-
return restore(awaitPendingTransaction(state))
|
|
25365
|
-
}),
|
|
25366
|
-
exit
|
|
25367
|
-
)
|
|
25368
|
-
),
|
|
25730
|
+
body: () => {
|
|
25731
|
+
if (mutable.attempt > 1) {
|
|
25732
|
+
stampTransaction(mutable, clock.currentTimeMillisUnsafe())
|
|
25733
|
+
}
|
|
25734
|
+
return run
|
|
25735
|
+
},
|
|
25369
25736
|
step(exit: Exit.Exit<A, E>) {
|
|
25370
|
-
if (
|
|
25371
|
-
|
|
25737
|
+
if (mutable.retry || !isTransactionConsistent(mutable)) {
|
|
25738
|
+
mutable.attempt++
|
|
25739
|
+
mutable.retryReason = mutable.retry ? "retry" : "conflict"
|
|
25740
|
+
return clearTransaction(mutable)
|
|
25372
25741
|
}
|
|
25373
25742
|
if (Exit.isSuccess(exit)) {
|
|
25374
|
-
commitTransaction(fiber,
|
|
25743
|
+
commitTransaction(fiber, mutable)
|
|
25375
25744
|
}
|
|
25376
|
-
clearTransaction(
|
|
25377
|
-
completedTransactions.add(
|
|
25745
|
+
clearTransaction(mutable)
|
|
25746
|
+
completedTransactions.add(mutable)
|
|
25378
25747
|
result = exit
|
|
25379
25748
|
}
|
|
25380
25749
|
}),
|
|
25381
25750
|
() => result!
|
|
25382
25751
|
)
|
|
25383
|
-
)
|
|
25752
|
+
})
|
|
25384
25753
|
})
|
|
25385
25754
|
|
|
25386
25755
|
// Child fibers inherit the boundary's state, so mark it completed once the
|
|
25387
25756
|
// boundary finishes and let later `tx` calls start a fresh boundary.
|
|
25388
25757
|
const completedTransactions = new WeakSet<Transaction["Service"]>()
|
|
25389
25758
|
|
|
25390
|
-
const
|
|
25759
|
+
const stampTransaction = (state: TransactionMetaInner, now: number) => {
|
|
25760
|
+
state.elapsedSincePrevious = now - state.now
|
|
25761
|
+
state.now = now
|
|
25762
|
+
state.elapsed = now - state.start
|
|
25763
|
+
}
|
|
25764
|
+
|
|
25765
|
+
const isTransactionConsistent = (state: TransactionMeta) => {
|
|
25391
25766
|
for (const [ref, { version }] of state.journal) {
|
|
25392
25767
|
if (ref.version !== version) {
|
|
25393
25768
|
return false
|
|
@@ -25396,7 +25771,7 @@ const isTransactionConsistent = (state: Transaction["Service"]) => {
|
|
|
25396
25771
|
return true
|
|
25397
25772
|
}
|
|
25398
25773
|
|
|
25399
|
-
const awaitPendingTransaction = (state:
|
|
25774
|
+
const awaitPendingTransaction = (state: TransactionMeta) =>
|
|
25400
25775
|
callback<void>((resume) => {
|
|
25401
25776
|
// Validate the read set and register the waiter in one synchronous step.
|
|
25402
25777
|
// A commit that landed after the reads has already signalled its waiters
|
|
@@ -25421,7 +25796,7 @@ const awaitPendingTransaction = (state: Transaction["Service"]) =>
|
|
|
25421
25796
|
return sync(clearPending)
|
|
25422
25797
|
})
|
|
25423
25798
|
|
|
25424
|
-
function commitTransaction(fiber: Fiber<unknown, unknown>, state:
|
|
25799
|
+
function commitTransaction(fiber: Fiber<unknown, unknown>, state: TransactionMeta) {
|
|
25425
25800
|
for (const [ref, { value, written }] of state.journal) {
|
|
25426
25801
|
if (!written) continue
|
|
25427
25802
|
if (!Object.is(value, ref.value)) {
|
|
@@ -25435,7 +25810,7 @@ function commitTransaction(fiber: Fiber<unknown, unknown>, state: Transaction["S
|
|
|
25435
25810
|
}
|
|
25436
25811
|
}
|
|
25437
25812
|
|
|
25438
|
-
function clearTransaction(state:
|
|
25813
|
+
function clearTransaction(state: TransactionMetaInner) {
|
|
25439
25814
|
state.retry = false
|
|
25440
25815
|
state.journal.clear()
|
|
25441
25816
|
}
|
|
@@ -25480,7 +25855,8 @@ function clearTransaction(state: Transaction["Service"]) {
|
|
|
25480
25855
|
export const txRetry: Effect<never, never, Transaction> = flatMap(
|
|
25481
25856
|
Transaction,
|
|
25482
25857
|
(state) => {
|
|
25483
|
-
|
|
25858
|
+
const mutable = state as TransactionMetaInner
|
|
25859
|
+
mutable.retry = true
|
|
25484
25860
|
return interrupt
|
|
25485
25861
|
}
|
|
25486
25862
|
)
|
|
@@ -25742,7 +26118,7 @@ type EffectifyArgs<F extends (...args: Array<any>) => any> = Parameters<F> exten
|
|
|
25742
26118
|
* **Details**
|
|
25743
26119
|
*
|
|
25744
26120
|
* The original function is called with the supplied arguments plus a final
|
|
25745
|
-
* callback. A
|
|
26121
|
+
* callback. A truthy callback error fails the returned effect, while a
|
|
25746
26122
|
* successful callback value becomes the effect success. Use `onError` to map
|
|
25747
26123
|
* callback errors and `onSyncError` to turn synchronous throws into typed
|
|
25748
26124
|
* failures; otherwise synchronous throws become defects.
|
|
@@ -25796,7 +26172,7 @@ export const effectify: {
|
|
|
25796
26172
|
* **Details**
|
|
25797
26173
|
*
|
|
25798
26174
|
* The original function is called with the supplied arguments plus a final
|
|
25799
|
-
* callback. A
|
|
26175
|
+
* callback. A truthy callback error fails the returned effect, while a
|
|
25800
26176
|
* successful callback value becomes the effect success. Use `onError` to map
|
|
25801
26177
|
* callback errors and `onSyncError` to turn synchronous throws into typed
|
|
25802
26178
|
* failures; otherwise synchronous throws become defects.
|
|
@@ -25850,7 +26226,7 @@ export const effectify: {
|
|
|
25850
26226
|
* **Details**
|
|
25851
26227
|
*
|
|
25852
26228
|
* The original function is called with the supplied arguments plus a final
|
|
25853
|
-
* callback. A
|
|
26229
|
+
* callback. A truthy callback error fails the returned effect, while a
|
|
25854
26230
|
* successful callback value becomes the effect success. Use `onError` to map
|
|
25855
26231
|
* callback errors and `onSyncError` to turn synchronous throws into typed
|
|
25856
26232
|
* failures; otherwise synchronous throws become defects.
|
|
@@ -25907,7 +26283,7 @@ export const effectify: {
|
|
|
25907
26283
|
* **Details**
|
|
25908
26284
|
*
|
|
25909
26285
|
* The original function is called with the supplied arguments plus a final
|
|
25910
|
-
* callback. A
|
|
26286
|
+
* callback. A truthy callback error fails the returned effect, while a
|
|
25911
26287
|
* successful callback value becomes the effect success. Use `onError` to map
|
|
25912
26288
|
* callback errors and `onSyncError` to turn synchronous throws into typed
|
|
25913
26289
|
* failures; otherwise synchronous throws become defects.
|
|
@@ -25962,16 +26338,26 @@ export const effectify: {
|
|
|
25962
26338
|
(<A>(fn: Function, onError?: (e: any, args: any) => any, onSyncError?: (e: any, args: any) => any) =>
|
|
25963
26339
|
(...args: Array<any>) =>
|
|
25964
26340
|
callback<A, globalThis.Error>((resume) => {
|
|
26341
|
+
let synchronous = true
|
|
26342
|
+
let pending: Effect<A, globalThis.Error> | undefined
|
|
25965
26343
|
try {
|
|
25966
26344
|
fn(...args, (err: globalThis.Error | null, result: A) => {
|
|
25967
|
-
|
|
25968
|
-
|
|
26345
|
+
const effect = err
|
|
26346
|
+
? onError ? suspend(() => fail(onError(err, args))) : fail(err)
|
|
26347
|
+
: succeed(result)
|
|
26348
|
+
if (synchronous) {
|
|
26349
|
+
// Keep the first callback result until registration succeeds.
|
|
26350
|
+
pending ??= effect
|
|
25969
26351
|
} else {
|
|
25970
|
-
resume(
|
|
26352
|
+
resume(effect)
|
|
25971
26353
|
}
|
|
25972
26354
|
})
|
|
25973
26355
|
} catch (err) {
|
|
25974
|
-
|
|
26356
|
+
pending = onSyncError ? fail(onSyncError(err, args)) : die(err)
|
|
26357
|
+
}
|
|
26358
|
+
synchronous = false
|
|
26359
|
+
if (pending) {
|
|
26360
|
+
resume(pending)
|
|
25975
26361
|
}
|
|
25976
26362
|
})) as any
|
|
25977
26363
|
|
|
@@ -26195,6 +26581,9 @@ export const mapEager: {
|
|
|
26195
26581
|
* transform. Failure effects apply the mapping function immediately, and
|
|
26196
26582
|
* pending effects fall back to regular `mapError` behavior.
|
|
26197
26583
|
*
|
|
26584
|
+
* Maps every typed error in the cause, preserving defects, interrupts and
|
|
26585
|
+
* reason order. Unlike typed recovery, mapping does not convert errors to defects.
|
|
26586
|
+
*
|
|
26198
26587
|
* **Example** (Mapping errors eagerly when possible)
|
|
26199
26588
|
*
|
|
26200
26589
|
* ```ts import.meta.vitest
|
|
@@ -26239,6 +26628,9 @@ export const mapErrorEager: {
|
|
|
26239
26628
|
* transform. Failure effects apply the mapping function immediately, and
|
|
26240
26629
|
* pending effects fall back to regular `mapError` behavior.
|
|
26241
26630
|
*
|
|
26631
|
+
* Maps every typed error in the cause, preserving defects, interrupts and
|
|
26632
|
+
* reason order. Unlike typed recovery, mapping does not convert errors to defects.
|
|
26633
|
+
*
|
|
26242
26634
|
* **Example** (Mapping errors eagerly when possible)
|
|
26243
26635
|
*
|
|
26244
26636
|
* ```ts import.meta.vitest
|
|
@@ -26283,6 +26675,9 @@ export const mapErrorEager: {
|
|
|
26283
26675
|
* transform. Failure effects apply the mapping function immediately, and
|
|
26284
26676
|
* pending effects fall back to regular `mapError` behavior.
|
|
26285
26677
|
*
|
|
26678
|
+
* Maps every typed error in the cause, preserving defects, interrupts and
|
|
26679
|
+
* reason order. Unlike typed recovery, mapping does not convert errors to defects.
|
|
26680
|
+
*
|
|
26286
26681
|
* **Example** (Mapping errors eagerly when possible)
|
|
26287
26682
|
*
|
|
26288
26683
|
* ```ts import.meta.vitest
|
|
@@ -26328,6 +26723,9 @@ export const mapErrorEager: {
|
|
|
26328
26723
|
* `onFailure` immediately. Pending effects fall back to regular `mapBoth`
|
|
26329
26724
|
* behavior.
|
|
26330
26725
|
*
|
|
26726
|
+
* Maps every typed error in the cause, preserving defects, interrupts and
|
|
26727
|
+
* reason order. Unlike typed recovery, mapping does not convert errors to defects.
|
|
26728
|
+
*
|
|
26331
26729
|
* **Example** (Mapping both channels eagerly when possible)
|
|
26332
26730
|
*
|
|
26333
26731
|
* ```ts import.meta.vitest
|
|
@@ -26371,6 +26769,9 @@ export const mapBothEager: {
|
|
|
26371
26769
|
* `onFailure` immediately. Pending effects fall back to regular `mapBoth`
|
|
26372
26770
|
* behavior.
|
|
26373
26771
|
*
|
|
26772
|
+
* Maps every typed error in the cause, preserving defects, interrupts and
|
|
26773
|
+
* reason order. Unlike typed recovery, mapping does not convert errors to defects.
|
|
26774
|
+
*
|
|
26374
26775
|
* **Example** (Mapping both channels eagerly when possible)
|
|
26375
26776
|
*
|
|
26376
26777
|
* ```ts import.meta.vitest
|
|
@@ -26416,6 +26817,9 @@ export const mapBothEager: {
|
|
|
26416
26817
|
* `onFailure` immediately. Pending effects fall back to regular `mapBoth`
|
|
26417
26818
|
* behavior.
|
|
26418
26819
|
*
|
|
26820
|
+
* Maps every typed error in the cause, preserving defects, interrupts and
|
|
26821
|
+
* reason order. Unlike typed recovery, mapping does not convert errors to defects.
|
|
26822
|
+
*
|
|
26419
26823
|
* **Example** (Mapping both channels eagerly when possible)
|
|
26420
26824
|
*
|
|
26421
26825
|
* ```ts import.meta.vitest
|
|
@@ -26580,6 +26984,12 @@ export const flatMapEager: {
|
|
|
26580
26984
|
* Failure effects apply the catch function immediately, and pending effects
|
|
26581
26985
|
* fall back to regular `catch` behavior.
|
|
26582
26986
|
*
|
|
26987
|
+
* **Gotchas**
|
|
26988
|
+
*
|
|
26989
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
26990
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
26991
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
26992
|
+
*
|
|
26583
26993
|
* **Example** (Catching failures eagerly when possible)
|
|
26584
26994
|
*
|
|
26585
26995
|
* ```ts import.meta.vitest
|
|
@@ -26634,6 +27044,12 @@ export const catchEager: {
|
|
|
26634
27044
|
* Failure effects apply the catch function immediately, and pending effects
|
|
26635
27045
|
* fall back to regular `catch` behavior.
|
|
26636
27046
|
*
|
|
27047
|
+
* **Gotchas**
|
|
27048
|
+
*
|
|
27049
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
27050
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
27051
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
27052
|
+
*
|
|
26637
27053
|
* **Example** (Catching failures eagerly when possible)
|
|
26638
27054
|
*
|
|
26639
27055
|
* ```ts import.meta.vitest
|
|
@@ -26688,6 +27104,12 @@ export const catchEager: {
|
|
|
26688
27104
|
* Failure effects apply the catch function immediately, and pending effects
|
|
26689
27105
|
* fall back to regular `catch` behavior.
|
|
26690
27106
|
*
|
|
27107
|
+
* **Gotchas**
|
|
27108
|
+
*
|
|
27109
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
27110
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
27111
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
27112
|
+
*
|
|
26691
27113
|
* **Example** (Catching failures eagerly when possible)
|
|
26692
27114
|
*
|
|
26693
27115
|
* ```ts import.meta.vitest
|