effect 4.0.0-beta.42 → 4.0.0-beta.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Cache.d.ts +12 -43
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +15 -42
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +21 -21
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Cause.js +89 -10
- package/dist/Cause.js.map +1 -1
- package/dist/Channel.d.ts +42 -19
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +86 -46
- package/dist/Channel.js.map +1 -1
- package/dist/Clock.d.ts +2 -2
- package/dist/Clock.d.ts.map +1 -1
- package/dist/Clock.js.map +1 -1
- package/dist/Config.d.ts +2 -2
- package/dist/ConfigProvider.d.ts +5 -5
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +5 -5
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Console.d.ts +2 -2
- package/dist/Console.d.ts.map +1 -1
- package/dist/Console.js.map +1 -1
- package/dist/Context.d.ts +1150 -0
- package/dist/Context.d.ts.map +1 -0
- package/dist/{ServiceMap.js → Context.js} +139 -139
- package/dist/Context.js.map +1 -0
- package/dist/DateTime.d.ts +2 -2
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +2 -2
- package/dist/DateTime.js.map +1 -1
- package/dist/Effect.d.ts +177 -177
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +81 -81
- package/dist/Effect.js.map +1 -1
- package/dist/ErrorReporter.d.ts +3 -3
- package/dist/ErrorReporter.d.ts.map +1 -1
- package/dist/ErrorReporter.js +1 -1
- package/dist/ErrorReporter.js.map +1 -1
- package/dist/ExecutionPlan.d.ts +6 -6
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/ExecutionPlan.js +4 -4
- package/dist/ExecutionPlan.js.map +1 -1
- package/dist/Fiber.d.ts +7 -7
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.d.ts +2 -2
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +4 -4
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +2 -2
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +4 -4
- package/dist/FiberMap.js.map +1 -1
- package/dist/FiberSet.d.ts +2 -2
- package/dist/FiberSet.d.ts.map +1 -1
- package/dist/FiberSet.js +4 -4
- package/dist/FiberSet.js.map +1 -1
- package/dist/FileSystem.d.ts +3 -3
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +3 -3
- package/dist/FileSystem.js.map +1 -1
- package/dist/Layer.d.ts +309 -266
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +156 -132
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +18 -18
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +18 -15
- package/dist/LayerMap.js.map +1 -1
- package/dist/Logger.d.ts +3 -3
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.d.ts +6 -6
- package/dist/ManagedRuntime.d.ts.map +1 -1
- package/dist/ManagedRuntime.js +18 -21
- package/dist/ManagedRuntime.js.map +1 -1
- package/dist/Metric.d.ts +19 -19
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +21 -21
- package/dist/Metric.js.map +1 -1
- package/dist/Path.d.ts +2 -2
- package/dist/Path.d.ts.map +1 -1
- package/dist/Path.js +2 -2
- package/dist/Path.js.map +1 -1
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +4 -4
- package/dist/Pool.js.map +1 -1
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +3 -3
- package/dist/PubSub.js.map +1 -1
- package/dist/Random.d.ts +2 -2
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +0 -23
- package/dist/Random.js.map +1 -1
- package/dist/RcMap.d.ts +2 -2
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +12 -12
- package/dist/RcMap.js.map +1 -1
- package/dist/Redactable.d.ts +139 -62
- package/dist/Redactable.d.ts.map +1 -1
- package/dist/Redactable.js +59 -55
- package/dist/Redactable.js.map +1 -1
- package/dist/References.d.ts +26 -14
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +0 -12
- package/dist/References.js.map +1 -1
- package/dist/Request.d.ts +5 -5
- package/dist/Request.d.ts.map +1 -1
- package/dist/Request.js.map +1 -1
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/RequestResolver.js +6 -7
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Resource.d.ts +0 -3
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +3 -3
- package/dist/Resource.js.map +1 -1
- package/dist/Schedule.d.ts +2 -2
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +2 -2
- package/dist/Schedule.js.map +1 -1
- package/dist/Scheduler.d.ts +4 -4
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +7 -4
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +531 -214
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +304 -103
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +5 -15
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +49 -5
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +64 -5
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +145 -0
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +146 -0
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/Scope.d.ts +2 -2
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js.map +1 -1
- package/dist/ScopedCache.d.ts.map +1 -1
- package/dist/ScopedCache.js +4 -4
- package/dist/ScopedCache.js.map +1 -1
- package/dist/Sink.d.ts +6 -6
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +1 -1
- package/dist/Sink.js.map +1 -1
- package/dist/Stdio.d.ts +2 -2
- package/dist/Stdio.d.ts.map +1 -1
- package/dist/Stdio.js +2 -2
- package/dist/Stdio.js.map +1 -1
- package/dist/Stream.d.ts +187 -117
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +133 -57
- package/dist/Stream.js.map +1 -1
- package/dist/Terminal.d.ts +3 -3
- package/dist/Terminal.d.ts.map +1 -1
- package/dist/Terminal.js +2 -2
- package/dist/Terminal.js.map +1 -1
- package/dist/Tracer.d.ts +16 -16
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +11 -8
- package/dist/Tracer.js.map +1 -1
- package/dist/Unify.d.ts +8 -2
- package/dist/Unify.d.ts.map +1 -1
- package/dist/Unify.js.map +1 -1
- package/dist/index.d.ts +81 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +81 -15
- package/dist/index.js.map +1 -1
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/effect.js +74 -74
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/layer.js +3 -3
- package/dist/internal/layer.js.map +1 -1
- package/dist/internal/random.js +2 -2
- package/dist/internal/random.js.map +1 -1
- package/dist/internal/rcRef.js +9 -9
- package/dist/internal/rcRef.js.map +1 -1
- package/dist/internal/references.js +13 -13
- package/dist/internal/references.js.map +1 -1
- package/dist/internal/request.js +6 -6
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/schedule.js +1 -1
- package/dist/internal/schedule.js.map +1 -1
- package/dist/internal/schema/representation.js +11 -1
- package/dist/internal/schema/representation.js.map +1 -1
- package/dist/internal/schema/schema.d.ts +10 -1
- package/dist/internal/schema/schema.d.ts.map +1 -1
- package/dist/internal/schema/schema.js +21 -1
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +3 -3
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +19 -19
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +2 -1
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +5 -2
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +4 -4
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +3 -3
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.d.ts +6 -6
- package/dist/unstable/ai/EmbeddingModel.d.ts.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.js +3 -3
- package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
- package/dist/unstable/ai/IdGenerator.d.ts +2 -2
- package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
- package/dist/unstable/ai/IdGenerator.js +2 -2
- package/dist/unstable/ai/IdGenerator.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +2 -2
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +2 -2
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpSchema.d.ts +54 -54
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +15 -8
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +22 -22
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +25 -25
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Model.d.ts +3 -3
- package/dist/unstable/ai/Model.d.ts.map +1 -1
- package/dist/unstable/ai/Model.js +5 -5
- package/dist/unstable/ai/Model.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +2 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Prompt.js +6 -9
- package/dist/unstable/ai/Prompt.js.map +1 -1
- package/dist/unstable/ai/Response.d.ts +1 -1
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js +6 -7
- package/dist/unstable/ai/Response.js.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.d.ts +2 -2
- package/dist/unstable/ai/ResponseIdTracker.d.ts.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.js +2 -2
- package/dist/unstable/ai/ResponseIdTracker.js.map +1 -1
- package/dist/unstable/ai/Telemetry.d.ts +35 -2
- package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
- package/dist/unstable/ai/Telemetry.js +2 -2
- package/dist/unstable/ai/Telemetry.js.map +1 -1
- package/dist/unstable/ai/Tokenizer.d.ts +2 -2
- package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
- package/dist/unstable/ai/Tokenizer.js +2 -2
- package/dist/unstable/ai/Tokenizer.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +16 -16
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +41 -13
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +3 -3
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +10 -10
- package/dist/unstable/ai/Toolkit.js.map +1 -1
- package/dist/unstable/ai/internal/codec-transformer.js +5 -2
- package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
- package/dist/unstable/cli/Argument.d.ts +2 -3
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +29 -8
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +8 -1
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/CliOutput.d.ts +2 -2
- package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
- package/dist/unstable/cli/CliOutput.js +2 -2
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +14 -14
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +11 -10
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Flag.d.ts +2 -3
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +2 -2
- package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -1
- package/dist/unstable/cli/GlobalFlag.js +2 -2
- package/dist/unstable/cli/GlobalFlag.js.map +1 -1
- package/dist/unstable/cli/HelpDoc.d.ts +8 -8
- package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
- package/dist/unstable/cli/Param.d.ts +30 -2
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +17 -7
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Prompt.js +8 -2
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/internal/command.d.ts +5 -5
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.js +3 -3
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/parser.js +94 -15
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cluster/ClusterError.d.ts +7 -7
- package/dist/unstable/cluster/ClusterSchema.d.ts +12 -9
- package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.js +9 -9
- package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +1 -0
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +68 -40
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +10 -10
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +25 -20
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/EntityAddress.d.ts +2 -2
- package/dist/unstable/cluster/EntityProxy.js +3 -3
- package/dist/unstable/cluster/EntityProxy.js.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.js +4 -4
- package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
- package/dist/unstable/cluster/EntityResource.d.ts +2 -2
- package/dist/unstable/cluster/EntityResource.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityResource.js +2 -2
- package/dist/unstable/cluster/EntityResource.js.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts +3 -3
- package/dist/unstable/cluster/HttpRunner.js +2 -2
- package/dist/unstable/cluster/HttpRunner.js.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.d.ts +4 -4
- package/dist/unstable/cluster/K8sHttpClient.d.ts.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.js +2 -2
- package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +7 -4
- package/dist/unstable/cluster/Message.d.ts.map +1 -1
- package/dist/unstable/cluster/Message.js +5 -5
- package/dist/unstable/cluster/Message.js.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts +14 -14
- package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/MessageStorage.js +8 -8
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts +2 -2
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +5 -5
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/Runner.d.ts +1 -1
- package/dist/unstable/cluster/RunnerAddress.d.ts +1 -1
- package/dist/unstable/cluster/RunnerHealth.d.ts +2 -2
- package/dist/unstable/cluster/RunnerHealth.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.js +2 -2
- package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.js +1 -1
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.d.ts +12 -12
- package/dist/unstable/cluster/RunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.js +3 -3
- package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +3 -3
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +7 -7
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/ShardId.d.ts +35 -49
- package/dist/unstable/cluster/ShardId.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardId.js +65 -67
- package/dist/unstable/cluster/ShardId.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts +2 -2
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +21 -21
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +2 -2
- package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.js +5 -5
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/SingletonAddress.d.ts +2 -2
- package/dist/unstable/cluster/Snowflake.d.ts +2 -2
- package/dist/unstable/cluster/Snowflake.d.ts.map +1 -1
- package/dist/unstable/cluster/Snowflake.js +2 -2
- package/dist/unstable/cluster/Snowflake.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +15 -14
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/cluster/internal/entityReaper.js +2 -2
- package/dist/unstable/cluster/internal/entityReaper.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceMap.js +3 -3
- package/dist/unstable/cluster/internal/resourceMap.js.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.d.ts +2 -2
- package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.js +5 -5
- package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +4 -4
- package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventJournal.js +2 -2
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts +5 -5
- package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLog.js +18 -18
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.d.ts +2 -2
- package/dist/unstable/eventlog/EventLogEncryption.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js +2 -2
- package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +15 -12
- package/dist/unstable/eventlog/EventLogRemote.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.js +2 -2
- package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.d.ts +3 -3
- package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.js +2 -2
- package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
- package/dist/unstable/http/Etag.d.ts +2 -2
- package/dist/unstable/http/Etag.d.ts.map +1 -1
- package/dist/unstable/http/Etag.js +2 -2
- package/dist/unstable/http/Etag.js.map +1 -1
- package/dist/unstable/http/FetchHttpClient.d.ts +6 -3
- package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
- package/dist/unstable/http/FetchHttpClient.js +5 -5
- package/dist/unstable/http/FetchHttpClient.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts +5 -2
- package/dist/unstable/http/Headers.d.ts.map +1 -1
- package/dist/unstable/http/Headers.js +3 -3
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpClient.d.ts +8 -6
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +6 -6
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientError.d.ts +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts +2 -2
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +4 -4
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts +6 -6
- package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
- package/dist/unstable/http/HttpEffect.js +24 -24
- package/dist/unstable/http/HttpEffect.js.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.d.ts +2 -2
- package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js +2 -2
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts +3 -3
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +26 -14
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/http/HttpPlatform.d.ts +2 -2
- package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
- package/dist/unstable/http/HttpPlatform.js +2 -2
- package/dist/unstable/http/HttpPlatform.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +7 -7
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js +29 -29
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServer.d.ts +2 -2
- package/dist/unstable/http/HttpServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpServer.js +2 -2
- package/dist/unstable/http/HttpServer.js.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +3 -3
- package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerError.js +3 -3
- package/dist/unstable/http/HttpServerError.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts +4 -4
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +6 -6
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +2 -2
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +6 -6
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/Multipart.d.ts +6 -6
- package/dist/unstable/http/Multipart.d.ts.map +1 -1
- package/dist/unstable/http/Multipart.js +7 -7
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/httpapi/HttpApi.d.ts +9 -9
- package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js +8 -8
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +0 -3
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +20 -20
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +7 -7
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.js +4 -4
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +13 -13
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.d.ts +8 -8
- package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.js +4 -4
- package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +6 -6
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js +5 -5
- package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts +9 -6
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.js +6 -6
- package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts +15 -15
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +23 -23
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +5 -5
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.js +1 -1
- package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.d.ts +2 -2
- package/dist/unstable/observability/OtlpSerialization.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.js +2 -2
- package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
- package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.d.ts +3 -3
- package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.js +4 -33
- package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts +23 -2
- package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.js +144 -2
- package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
- package/dist/unstable/persistence/PersistedCache.d.ts +1 -2
- package/dist/unstable/persistence/PersistedCache.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedCache.js +10 -11
- package/dist/unstable/persistence/PersistedCache.js.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts +4 -4
- package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.js +3 -3
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/persistence/Persistence.d.ts +4 -4
- package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistence.js +3 -3
- package/dist/unstable/persistence/Persistence.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +6 -6
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +3 -3
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/persistence/Redis.d.ts +3 -3
- package/dist/unstable/persistence/Redis.d.ts.map +1 -1
- package/dist/unstable/persistence/Redis.js +2 -2
- package/dist/unstable/persistence/Redis.js.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.d.ts +45 -2
- package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js +2 -2
- package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +36 -36
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +9 -9
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +3 -3
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.js +2 -2
- package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.d.ts +2 -2
- package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +3 -3
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts +3 -3
- package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.js +2 -2
- package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
- package/dist/unstable/reactivity/Reactivity.d.ts +2 -2
- package/dist/unstable/reactivity/Reactivity.d.ts.map +1 -1
- package/dist/unstable/reactivity/Reactivity.js +6 -6
- package/dist/unstable/reactivity/Reactivity.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +11 -11
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js +4 -4
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts +18 -8
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +27 -18
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcClientError.d.ts +2 -2
- package/dist/unstable/rpc/RpcGroup.d.ts +7 -7
- package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcGroup.js +20 -20
- package/dist/unstable/rpc/RpcGroup.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts +6 -6
- package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js +5 -5
- package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts +3 -3
- package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSchema.js +3 -3
- package/dist/unstable/rpc/RpcSchema.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts +2 -2
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +7 -7
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +2 -2
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +18 -18
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/rpc/RpcWorker.d.ts +2 -2
- package/dist/unstable/rpc/RpcWorker.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcWorker.js +4 -4
- package/dist/unstable/rpc/RpcWorker.js.map +1 -1
- package/dist/unstable/rpc/Utils.d.ts +0 -3
- package/dist/unstable/rpc/Utils.d.ts.map +1 -1
- package/dist/unstable/rpc/Utils.js +2 -5
- package/dist/unstable/rpc/Utils.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +10 -10
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +9 -9
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/socket/SocketServer.d.ts +5 -2
- package/dist/unstable/socket/SocketServer.d.ts.map +1 -1
- package/dist/unstable/socket/SocketServer.js +2 -2
- package/dist/unstable/socket/SocketServer.js.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts +5 -5
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +7 -7
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/sql/SqlConnection.d.ts +2 -2
- package/dist/unstable/sql/SqlConnection.d.ts.map +1 -1
- package/dist/unstable/sql/SqlConnection.js +5 -2
- package/dist/unstable/sql/SqlConnection.js.map +1 -1
- package/dist/unstable/sql/SqlError.d.ts +12 -12
- package/dist/unstable/sql/SqlModel.d.ts +8 -9
- package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
- package/dist/unstable/sql/SqlModel.js +9 -35
- package/dist/unstable/sql/SqlModel.js.map +1 -1
- package/dist/unstable/sql/SqlResolver.js +11 -11
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/sql/Statement.d.ts +2 -2
- package/dist/unstable/sql/Statement.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.js +2 -2
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/workers/Transferable.d.ts +2 -2
- package/dist/unstable/workers/Transferable.d.ts.map +1 -1
- package/dist/unstable/workers/Transferable.js +6 -6
- package/dist/unstable/workers/Transferable.js.map +1 -1
- package/dist/unstable/workers/Worker.d.ts +3 -3
- package/dist/unstable/workers/Worker.d.ts.map +1 -1
- package/dist/unstable/workers/Worker.js +6 -3
- package/dist/unstable/workers/Worker.js.map +1 -1
- package/dist/unstable/workers/WorkerError.d.ts +5 -5
- package/dist/unstable/workers/WorkerRunner.d.ts +2 -2
- package/dist/unstable/workers/WorkerRunner.d.ts.map +1 -1
- package/dist/unstable/workers/WorkerRunner.js +5 -2
- package/dist/unstable/workers/WorkerRunner.js.map +1 -1
- package/dist/unstable/workflow/Activity.d.ts +7 -7
- package/dist/unstable/workflow/Activity.d.ts.map +1 -1
- package/dist/unstable/workflow/Activity.js +7 -7
- package/dist/unstable/workflow/Activity.js.map +1 -1
- package/dist/unstable/workflow/DurableClock.d.ts +0 -3
- package/dist/unstable/workflow/DurableClock.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableClock.js +3 -3
- package/dist/unstable/workflow/DurableClock.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.d.ts +1 -1
- package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.js +7 -7
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +9 -9
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js +18 -18
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +9 -3
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +14 -5
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.js +4 -4
- package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
- package/package.json +1 -1
- package/src/Cache.ts +18 -46
- package/src/Cause.ts +21 -21
- package/src/Channel.ts +120 -79
- package/src/Clock.ts +2 -2
- package/src/Config.ts +2 -2
- package/src/ConfigProvider.ts +5 -5
- package/src/Console.ts +2 -2
- package/src/{ServiceMap.ts → Context.ts} +337 -340
- package/src/DateTime.ts +2 -2
- package/src/Effect.ts +182 -184
- package/src/ErrorReporter.ts +3 -3
- package/src/ExecutionPlan.ts +8 -9
- package/src/Fiber.ts +7 -7
- package/src/FiberHandle.ts +5 -5
- package/src/FiberMap.ts +5 -5
- package/src/FiberSet.ts +5 -5
- package/src/FileSystem.ts +3 -3
- package/src/Layer.ts +358 -305
- package/src/LayerMap.ts +27 -26
- package/src/Logger.ts +3 -3
- package/src/ManagedRuntime.ts +32 -32
- package/src/Metric.ts +58 -58
- package/src/Path.ts +2 -2
- package/src/Pool.ts +5 -5
- package/src/PubSub.ts +3 -3
- package/src/Random.ts +2 -2
- package/src/RcMap.ts +14 -14
- package/src/Redactable.ts +146 -72
- package/src/References.ts +14 -14
- package/src/Request.ts +5 -5
- package/src/RequestResolver.ts +6 -7
- package/src/Resource.ts +4 -4
- package/src/Schedule.ts +2 -2
- package/src/Scheduler.ts +4 -4
- package/src/Schema.ts +837 -397
- package/src/SchemaAST.ts +5 -14
- package/src/SchemaGetter.ts +69 -11
- package/src/SchemaTransformation.ts +166 -0
- package/src/Scope.ts +2 -2
- package/src/ScopedCache.ts +5 -5
- package/src/Sink.ts +9 -9
- package/src/Stdio.ts +2 -2
- package/src/Stream.ts +234 -158
- package/src/Terminal.ts +3 -3
- package/src/Tracer.ts +17 -17
- package/src/Unify.ts +26 -2
- package/src/index.ts +82 -16
- package/src/internal/core.ts +7 -7
- package/src/internal/effect.ts +106 -106
- package/src/internal/layer.ts +7 -7
- package/src/internal/random.ts +2 -2
- package/src/internal/rcRef.ts +10 -10
- package/src/internal/references.ts +13 -13
- package/src/internal/request.ts +8 -8
- package/src/internal/schedule.ts +3 -1
- package/src/internal/schema/representation.ts +8 -1
- package/src/internal/schema/schema.ts +24 -1
- package/src/testing/TestSchema.ts +3 -3
- package/src/unstable/ai/AiError.ts +3 -2
- package/src/unstable/ai/AnthropicStructuredOutput.ts +3 -3
- package/src/unstable/ai/Chat.ts +3 -3
- package/src/unstable/ai/EmbeddingModel.ts +3 -3
- package/src/unstable/ai/IdGenerator.ts +2 -2
- package/src/unstable/ai/LanguageModel.ts +2 -2
- package/src/unstable/ai/McpSchema.ts +11 -9
- package/src/unstable/ai/McpServer.ts +44 -44
- package/src/unstable/ai/Model.ts +8 -8
- package/src/unstable/ai/OpenAiStructuredOutput.ts +2 -2
- package/src/unstable/ai/Prompt.ts +6 -12
- package/src/unstable/ai/Response.ts +6 -8
- package/src/unstable/ai/ResponseIdTracker.ts +2 -4
- package/src/unstable/ai/Telemetry.ts +2 -2
- package/src/unstable/ai/Tokenizer.ts +2 -2
- package/src/unstable/ai/Tool.ts +25 -25
- package/src/unstable/ai/Toolkit.ts +12 -12
- package/src/unstable/ai/internal/codec-transformer.ts +3 -2
- package/src/unstable/cli/Argument.ts +3 -4
- package/src/unstable/cli/CliError.ts +22 -9
- package/src/unstable/cli/CliOutput.ts +2 -2
- package/src/unstable/cli/Command.ts +36 -30
- package/src/unstable/cli/Flag.ts +3 -4
- package/src/unstable/cli/GlobalFlag.ts +3 -3
- package/src/unstable/cli/HelpDoc.ts +8 -8
- package/src/unstable/cli/Param.ts +39 -16
- package/src/unstable/cli/Prompt.ts +13 -6
- package/src/unstable/cli/internal/command.ts +7 -7
- package/src/unstable/cli/internal/parser.ts +130 -21
- package/src/unstable/cluster/ClusterSchema.ts +12 -12
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +91 -53
- package/src/unstable/cluster/Entity.ts +43 -32
- package/src/unstable/cluster/EntityProxy.ts +3 -3
- package/src/unstable/cluster/EntityProxyServer.ts +4 -4
- package/src/unstable/cluster/EntityResource.ts +2 -2
- package/src/unstable/cluster/HttpRunner.ts +2 -2
- package/src/unstable/cluster/K8sHttpClient.ts +2 -2
- package/src/unstable/cluster/Message.ts +8 -8
- package/src/unstable/cluster/MessageStorage.ts +11 -11
- package/src/unstable/cluster/Reply.ts +7 -7
- package/src/unstable/cluster/RunnerHealth.ts +2 -2
- package/src/unstable/cluster/RunnerServer.ts +1 -1
- package/src/unstable/cluster/RunnerStorage.ts +9 -9
- package/src/unstable/cluster/Runners.ts +7 -7
- package/src/unstable/cluster/ShardId.ts +84 -74
- package/src/unstable/cluster/Sharding.ts +26 -26
- package/src/unstable/cluster/ShardingConfig.ts +5 -5
- package/src/unstable/cluster/Snowflake.ts +2 -2
- package/src/unstable/cluster/SqlMessageStorage.ts +1 -1
- package/src/unstable/cluster/internal/entityManager.ts +27 -23
- package/src/unstable/cluster/internal/entityReaper.ts +2 -2
- package/src/unstable/cluster/internal/resourceMap.ts +3 -3
- package/src/unstable/devtools/DevToolsClient.ts +5 -5
- package/src/unstable/eventlog/EventJournal.ts +2 -2
- package/src/unstable/eventlog/EventLog.ts +21 -21
- package/src/unstable/eventlog/EventLogEncryption.ts +2 -2
- package/src/unstable/eventlog/EventLogRemote.ts +2 -2
- package/src/unstable/eventlog/EventLogServer.ts +2 -2
- package/src/unstable/http/Etag.ts +2 -2
- package/src/unstable/http/FetchHttpClient.ts +5 -5
- package/src/unstable/http/Headers.ts +4 -4
- package/src/unstable/http/HttpClient.ts +9 -8
- package/src/unstable/http/HttpClientRequest.ts +5 -5
- package/src/unstable/http/HttpEffect.ts +35 -35
- package/src/unstable/http/HttpIncomingMessage.ts +2 -2
- package/src/unstable/http/HttpMiddleware.ts +28 -14
- package/src/unstable/http/HttpPlatform.ts +2 -2
- package/src/unstable/http/HttpRouter.ts +37 -37
- package/src/unstable/http/HttpServer.ts +2 -2
- package/src/unstable/http/HttpServerError.ts +4 -4
- package/src/unstable/http/HttpServerRequest.ts +7 -7
- package/src/unstable/http/HttpServerResponse.ts +8 -8
- package/src/unstable/http/Multipart.ts +8 -8
- package/src/unstable/httpapi/HttpApi.ts +18 -18
- package/src/unstable/httpapi/HttpApiBuilder.ts +20 -20
- package/src/unstable/httpapi/HttpApiClient.ts +4 -4
- package/src/unstable/httpapi/HttpApiEndpoint.ts +14 -14
- package/src/unstable/httpapi/HttpApiGroup.ts +16 -16
- package/src/unstable/httpapi/HttpApiMiddleware.ts +14 -14
- package/src/unstable/httpapi/HttpApiSecurity.ts +13 -13
- package/src/unstable/httpapi/OpenApi.ts +29 -31
- package/src/unstable/observability/OtlpExporter.ts +5 -5
- package/src/unstable/observability/OtlpMetrics.ts +1 -1
- package/src/unstable/observability/OtlpSerialization.ts +2 -2
- package/src/unstable/observability/OtlpTracer.ts +2 -2
- package/src/unstable/observability/PrometheusMetrics.ts +5 -5
- package/src/unstable/persistence/KeyValueStore.ts +226 -3
- package/src/unstable/persistence/PersistedCache.ts +20 -17
- package/src/unstable/persistence/PersistedQueue.ts +3 -3
- package/src/unstable/persistence/Persistence.ts +4 -4
- package/src/unstable/persistence/RateLimiter.ts +3 -3
- package/src/unstable/persistence/Redis.ts +2 -2
- package/src/unstable/process/ChildProcessSpawner.ts +46 -2
- package/src/unstable/reactivity/Atom.ts +79 -79
- package/src/unstable/reactivity/AtomHttpApi.ts +4 -4
- package/src/unstable/reactivity/AtomRegistry.ts +4 -4
- package/src/unstable/reactivity/AtomRpc.ts +4 -4
- package/src/unstable/reactivity/Reactivity.ts +6 -6
- package/src/unstable/rpc/Rpc.ts +17 -17
- package/src/unstable/rpc/RpcClient.ts +44 -30
- package/src/unstable/rpc/RpcGroup.ts +30 -30
- package/src/unstable/rpc/RpcMiddleware.ts +14 -14
- package/src/unstable/rpc/RpcSchema.ts +4 -4
- package/src/unstable/rpc/RpcSerialization.ts +7 -7
- package/src/unstable/rpc/RpcServer.ts +19 -19
- package/src/unstable/rpc/RpcWorker.ts +5 -5
- package/src/unstable/rpc/Utils.ts +4 -4
- package/src/unstable/socket/Socket.ts +9 -9
- package/src/unstable/socket/SocketServer.ts +2 -2
- package/src/unstable/sql/SqlClient.ts +11 -11
- package/src/unstable/sql/SqlConnection.ts +2 -2
- package/src/unstable/sql/SqlModel.ts +54 -82
- package/src/unstable/sql/SqlResolver.ts +11 -11
- package/src/unstable/sql/Statement.ts +2 -2
- package/src/unstable/workers/Transferable.ts +6 -6
- package/src/unstable/workers/Worker.ts +4 -4
- package/src/unstable/workers/WorkerRunner.ts +2 -2
- package/src/unstable/workflow/Activity.ts +14 -14
- package/src/unstable/workflow/DurableClock.ts +3 -3
- package/src/unstable/workflow/DurableDeferred.ts +8 -8
- package/src/unstable/workflow/Workflow.ts +23 -23
- package/src/unstable/workflow/WorkflowEngine.ts +28 -6
- package/src/unstable/workflow/WorkflowProxyServer.ts +4 -4
- package/dist/ServiceMap.d.ts +0 -1150
- package/dist/ServiceMap.d.ts.map +0 -1
- package/dist/ServiceMap.js.map +0 -1
package/src/Effect.ts
CHANGED
|
@@ -71,6 +71,7 @@
|
|
|
71
71
|
import type * as Arr from "./Array.ts"
|
|
72
72
|
import type * as Cause from "./Cause.ts"
|
|
73
73
|
import type { Clock } from "./Clock.ts"
|
|
74
|
+
import * as Context from "./Context.ts"
|
|
74
75
|
import * as Duration from "./Duration.ts"
|
|
75
76
|
import type { ExecutionPlan } from "./ExecutionPlan.ts"
|
|
76
77
|
import * as Exit from "./Exit.ts"
|
|
@@ -98,7 +99,6 @@ import type * as Result from "./Result.ts"
|
|
|
98
99
|
import type { Schedule } from "./Schedule.ts"
|
|
99
100
|
import type { Scheduler } from "./Scheduler.ts"
|
|
100
101
|
import type { Scope } from "./Scope.ts"
|
|
101
|
-
import * as ServiceMap from "./ServiceMap.ts"
|
|
102
102
|
import type {
|
|
103
103
|
AnySpan,
|
|
104
104
|
ParentSpan,
|
|
@@ -6760,6 +6760,7 @@ export declare namespace Retry {
|
|
|
6760
6760
|
export type Return<R, E, A, O extends Options<E>> = Effect<
|
|
6761
6761
|
A,
|
|
6762
6762
|
| (O extends { schedule: Schedule<infer _O, infer _I, infer _E1, infer _R> } ? E
|
|
6763
|
+
: O extends { times: number } ? E
|
|
6763
6764
|
: O extends { until: Predicate.Refinement<E, infer E2> } ? E2
|
|
6764
6765
|
: O extends { while: Predicate.Refinement<E, infer E2> } ? Exclude<E, E2>
|
|
6765
6766
|
: E)
|
|
@@ -7498,9 +7499,9 @@ export const ignoreCause: <
|
|
|
7498
7499
|
*
|
|
7499
7500
|
* @example
|
|
7500
7501
|
* ```ts
|
|
7501
|
-
* import { Effect, ExecutionPlan, Layer,
|
|
7502
|
+
* import { Effect, ExecutionPlan, Layer, Context } from "effect"
|
|
7502
7503
|
*
|
|
7503
|
-
* const Endpoint =
|
|
7504
|
+
* const Endpoint = Context.Service<{ url: string }>("Endpoint")
|
|
7504
7505
|
*
|
|
7505
7506
|
* const fetchUrl = Effect.gen(function*() {
|
|
7506
7507
|
* const endpoint = yield* Effect.service(Endpoint)
|
|
@@ -7532,9 +7533,9 @@ export const withExecutionPlan: {
|
|
|
7532
7533
|
*
|
|
7533
7534
|
* @example
|
|
7534
7535
|
* ```ts
|
|
7535
|
-
* import { Effect, ExecutionPlan, Layer,
|
|
7536
|
+
* import { Effect, ExecutionPlan, Layer, Context } from "effect"
|
|
7536
7537
|
*
|
|
7537
|
-
* const Endpoint =
|
|
7538
|
+
* const Endpoint = Context.Service<{ url: string }>("Endpoint")
|
|
7538
7539
|
*
|
|
7539
7540
|
* const fetchUrl = Effect.gen(function*() {
|
|
7540
7541
|
* const endpoint = yield* Effect.service(Endpoint)
|
|
@@ -7570,9 +7571,9 @@ export const withExecutionPlan: {
|
|
|
7570
7571
|
*
|
|
7571
7572
|
* @example
|
|
7572
7573
|
* ```ts
|
|
7573
|
-
* import { Effect, ExecutionPlan, Layer,
|
|
7574
|
+
* import { Effect, ExecutionPlan, Layer, Context } from "effect"
|
|
7574
7575
|
*
|
|
7575
|
-
* const Endpoint =
|
|
7576
|
+
* const Endpoint = Context.Service<{ url: string }>("Endpoint")
|
|
7576
7577
|
*
|
|
7577
7578
|
* const fetchUrl = Effect.gen(function*() {
|
|
7578
7579
|
* const endpoint = yield* Effect.service(Endpoint)
|
|
@@ -10501,7 +10502,7 @@ export const isSuccess: <A, E, R>(self: Effect<A, E, R>) => Effect<boolean, neve
|
|
|
10501
10502
|
// -----------------------------------------------------------------------------
|
|
10502
10503
|
|
|
10503
10504
|
/**
|
|
10504
|
-
* Returns the complete
|
|
10505
|
+
* Returns the complete context.
|
|
10505
10506
|
*
|
|
10506
10507
|
* This function allows you to access all services that are currently available
|
|
10507
10508
|
* in the effect's environment. This can be useful for debugging, introspection,
|
|
@@ -10509,57 +10510,57 @@ export const isSuccess: <A, E, R>(self: Effect<A, E, R>) => Effect<boolean, neve
|
|
|
10509
10510
|
*
|
|
10510
10511
|
* @example
|
|
10511
10512
|
* ```ts
|
|
10512
|
-
* import { Console, Effect, Option,
|
|
10513
|
+
* import { Console, Effect, Option, Context } from "effect"
|
|
10513
10514
|
*
|
|
10514
|
-
* const Logger =
|
|
10515
|
+
* const Logger = Context.Service<{
|
|
10515
10516
|
* log: (msg: string) => void
|
|
10516
10517
|
* }>("Logger")
|
|
10517
|
-
* const Database =
|
|
10518
|
+
* const Database = Context.Service<{
|
|
10518
10519
|
* query: (sql: string) => string
|
|
10519
10520
|
* }>("Database")
|
|
10520
10521
|
*
|
|
10521
10522
|
* const program = Effect.gen(function*() {
|
|
10522
|
-
* const allServices = yield* Effect.
|
|
10523
|
+
* const allServices = yield* Effect.context()
|
|
10523
10524
|
*
|
|
10524
10525
|
* // Check if specific services are available
|
|
10525
|
-
* const loggerOption =
|
|
10526
|
-
* const databaseOption =
|
|
10526
|
+
* const loggerOption = Context.getOption(allServices, Logger)
|
|
10527
|
+
* const databaseOption = Context.getOption(allServices, Database)
|
|
10527
10528
|
*
|
|
10528
10529
|
* yield* Console.log(`Logger available: ${Option.isSome(loggerOption)}`)
|
|
10529
10530
|
* yield* Console.log(`Database available: ${Option.isSome(databaseOption)}`)
|
|
10530
10531
|
* })
|
|
10531
10532
|
*
|
|
10532
|
-
* const
|
|
10533
|
-
* .pipe(
|
|
10533
|
+
* const context = Context.make(Logger, { log: console.log })
|
|
10534
|
+
* .pipe(Context.add(Database, { query: () => "result" }))
|
|
10534
10535
|
*
|
|
10535
|
-
* const provided = Effect.
|
|
10536
|
+
* const provided = Effect.provideContext(program, context)
|
|
10536
10537
|
* ```
|
|
10537
10538
|
*
|
|
10538
10539
|
* @since 2.0.0
|
|
10539
10540
|
* @category Environment
|
|
10540
10541
|
*/
|
|
10541
|
-
export const
|
|
10542
|
+
export const context: <R = never>() => Effect<Context.Context<R>, never, R> = internal.context
|
|
10542
10543
|
|
|
10543
10544
|
/**
|
|
10544
|
-
* Transforms the current
|
|
10545
|
+
* Transforms the current context using the provided function.
|
|
10545
10546
|
*
|
|
10546
|
-
* This function allows you to access the complete
|
|
10547
|
+
* This function allows you to access the complete context and perform
|
|
10547
10548
|
* computations based on all available services. This is useful when you need
|
|
10548
10549
|
* to conditionally execute logic based on what services are available.
|
|
10549
10550
|
*
|
|
10550
10551
|
* @example
|
|
10551
10552
|
* ```ts
|
|
10552
|
-
* import { Console, Effect, Option,
|
|
10553
|
+
* import { Console, Effect, Option, Context } from "effect"
|
|
10553
10554
|
*
|
|
10554
|
-
* const Logger =
|
|
10555
|
+
* const Logger = Context.Service<{
|
|
10555
10556
|
* log: (msg: string) => void
|
|
10556
10557
|
* }>("Logger")
|
|
10557
|
-
* const Cache =
|
|
10558
|
+
* const Cache = Context.Service<{
|
|
10558
10559
|
* get: (key: string) => string | null
|
|
10559
10560
|
* }>("Cache")
|
|
10560
10561
|
*
|
|
10561
|
-
* const program = Effect.
|
|
10562
|
-
* const cacheOption =
|
|
10562
|
+
* const program = Effect.contextWith((services) => {
|
|
10563
|
+
* const cacheOption = Context.getOption(services, Cache)
|
|
10563
10564
|
* const hasCache = Option.isSome(cacheOption)
|
|
10564
10565
|
*
|
|
10565
10566
|
* if (hasCache) {
|
|
@@ -10584,9 +10585,9 @@ export const services: <R = never>() => Effect<ServiceMap.ServiceMap<R>, never,
|
|
|
10584
10585
|
* @since 2.0.0
|
|
10585
10586
|
* @category Environment
|
|
10586
10587
|
*/
|
|
10587
|
-
export const
|
|
10588
|
-
f: (
|
|
10589
|
-
) => Effect<A, E, R | R2> = internal.
|
|
10588
|
+
export const contextWith: <R, A, E, R2>(
|
|
10589
|
+
f: (context: Context.Context<R>) => Effect<A, E, R2>
|
|
10590
|
+
) => Effect<A, E, R | R2> = internal.contextWith
|
|
10590
10591
|
|
|
10591
10592
|
/**
|
|
10592
10593
|
* Provides dependencies to an effect using layers or a context. Use `options.local`
|
|
@@ -10595,13 +10596,13 @@ export const servicesWith: <R, A, E, R2>(
|
|
|
10595
10596
|
*
|
|
10596
10597
|
* @example
|
|
10597
10598
|
* ```ts
|
|
10598
|
-
* import { Effect, Layer,
|
|
10599
|
+
* import { Effect, Layer, Context } from "effect"
|
|
10599
10600
|
*
|
|
10600
10601
|
* interface Database {
|
|
10601
10602
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
10602
10603
|
* }
|
|
10603
10604
|
*
|
|
10604
|
-
* const Database =
|
|
10605
|
+
* const Database = Context.Service<Database>("Database")
|
|
10605
10606
|
*
|
|
10606
10607
|
* const DatabaseLive = Layer.succeed(Database)({
|
|
10607
10608
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result for: ${sql}`))
|
|
@@ -10629,13 +10630,13 @@ export const provide: {
|
|
|
10629
10630
|
*
|
|
10630
10631
|
* @example
|
|
10631
10632
|
* ```ts
|
|
10632
|
-
* import { Effect, Layer,
|
|
10633
|
+
* import { Effect, Layer, Context } from "effect"
|
|
10633
10634
|
*
|
|
10634
10635
|
* interface Database {
|
|
10635
10636
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
10636
10637
|
* }
|
|
10637
10638
|
*
|
|
10638
|
-
* const Database =
|
|
10639
|
+
* const Database = Context.Service<Database>("Database")
|
|
10639
10640
|
*
|
|
10640
10641
|
* const DatabaseLive = Layer.succeed(Database)({
|
|
10641
10642
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result for: ${sql}`))
|
|
@@ -10674,13 +10675,13 @@ export const provide: {
|
|
|
10674
10675
|
*
|
|
10675
10676
|
* @example
|
|
10676
10677
|
* ```ts
|
|
10677
|
-
* import { Effect, Layer,
|
|
10678
|
+
* import { Effect, Layer, Context } from "effect"
|
|
10678
10679
|
*
|
|
10679
10680
|
* interface Database {
|
|
10680
10681
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
10681
10682
|
* }
|
|
10682
10683
|
*
|
|
10683
|
-
* const Database =
|
|
10684
|
+
* const Database = Context.Service<Database>("Database")
|
|
10684
10685
|
*
|
|
10685
10686
|
* const DatabaseLive = Layer.succeed(Database)({
|
|
10686
10687
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result for: ${sql}`))
|
|
@@ -10715,13 +10716,13 @@ export const provide: {
|
|
|
10715
10716
|
*
|
|
10716
10717
|
* @example
|
|
10717
10718
|
* ```ts
|
|
10718
|
-
* import { Effect, Layer,
|
|
10719
|
+
* import { Effect, Layer, Context } from "effect"
|
|
10719
10720
|
*
|
|
10720
10721
|
* interface Database {
|
|
10721
10722
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
10722
10723
|
* }
|
|
10723
10724
|
*
|
|
10724
|
-
* const Database =
|
|
10725
|
+
* const Database = Context.Service<Database>("Database")
|
|
10725
10726
|
*
|
|
10726
10727
|
* const DatabaseLive = Layer.succeed(Database)({
|
|
10727
10728
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result for: ${sql}`))
|
|
@@ -10741,7 +10742,7 @@ export const provide: {
|
|
|
10741
10742
|
* @since 2.0.0
|
|
10742
10743
|
* @category Environment
|
|
10743
10744
|
*/
|
|
10744
|
-
<R2>(context:
|
|
10745
|
+
<R2>(context: Context.Context<R2>): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, R2>>
|
|
10745
10746
|
/**
|
|
10746
10747
|
* Provides dependencies to an effect using layers or a context. Use `options.local`
|
|
10747
10748
|
* to build the layer every time; by default, layers are shared between provide
|
|
@@ -10749,13 +10750,13 @@ export const provide: {
|
|
|
10749
10750
|
*
|
|
10750
10751
|
* @example
|
|
10751
10752
|
* ```ts
|
|
10752
|
-
* import { Effect, Layer,
|
|
10753
|
+
* import { Effect, Layer, Context } from "effect"
|
|
10753
10754
|
*
|
|
10754
10755
|
* interface Database {
|
|
10755
10756
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
10756
10757
|
* }
|
|
10757
10758
|
*
|
|
10758
|
-
* const Database =
|
|
10759
|
+
* const Database = Context.Service<Database>("Database")
|
|
10759
10760
|
*
|
|
10760
10761
|
* const DatabaseLive = Layer.succeed(Database)({
|
|
10761
10762
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result for: ${sql}`))
|
|
@@ -10793,13 +10794,13 @@ export const provide: {
|
|
|
10793
10794
|
*
|
|
10794
10795
|
* @example
|
|
10795
10796
|
* ```ts
|
|
10796
|
-
* import { Effect, Layer,
|
|
10797
|
+
* import { Effect, Layer, Context } from "effect"
|
|
10797
10798
|
*
|
|
10798
10799
|
* interface Database {
|
|
10799
10800
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
10800
10801
|
* }
|
|
10801
10802
|
*
|
|
10802
|
-
* const Database =
|
|
10803
|
+
* const Database = Context.Service<Database>("Database")
|
|
10803
10804
|
*
|
|
10804
10805
|
* const DatabaseLive = Layer.succeed(Database)({
|
|
10805
10806
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result for: ${sql}`))
|
|
@@ -10833,13 +10834,13 @@ export const provide: {
|
|
|
10833
10834
|
*
|
|
10834
10835
|
* @example
|
|
10835
10836
|
* ```ts
|
|
10836
|
-
* import { Effect, Layer,
|
|
10837
|
+
* import { Effect, Layer, Context } from "effect"
|
|
10837
10838
|
*
|
|
10838
10839
|
* interface Database {
|
|
10839
10840
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
10840
10841
|
* }
|
|
10841
10842
|
*
|
|
10842
|
-
* const Database =
|
|
10843
|
+
* const Database = Context.Service<Database>("Database")
|
|
10843
10844
|
*
|
|
10844
10845
|
* const DatabaseLive = Layer.succeed(Database)({
|
|
10845
10846
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result for: ${sql}`))
|
|
@@ -10859,33 +10860,33 @@ export const provide: {
|
|
|
10859
10860
|
* @since 2.0.0
|
|
10860
10861
|
* @category Environment
|
|
10861
10862
|
*/
|
|
10862
|
-
<A, E, R, R2>(self: Effect<A, E, R>, context:
|
|
10863
|
+
<A, E, R, R2>(self: Effect<A, E, R>, context: Context.Context<R2>): Effect<A, E, Exclude<R, R2>>
|
|
10863
10864
|
} = internalLayer.provide
|
|
10864
10865
|
|
|
10865
10866
|
/**
|
|
10866
|
-
* Provides a
|
|
10867
|
+
* Provides a context to an effect, fulfilling its service requirements.
|
|
10867
10868
|
*
|
|
10868
10869
|
* **Details**
|
|
10869
10870
|
*
|
|
10870
|
-
* This function provides multiple services at once by supplying a
|
|
10871
|
+
* This function provides multiple services at once by supplying a context
|
|
10871
10872
|
* that contains all the required services. It removes the provided services
|
|
10872
10873
|
* from the effect's requirements, making them available to the effect.
|
|
10873
10874
|
*
|
|
10874
10875
|
* @example
|
|
10875
10876
|
* ```ts
|
|
10876
|
-
* import { Effect,
|
|
10877
|
+
* import { Effect, Context } from "effect"
|
|
10877
10878
|
*
|
|
10878
10879
|
* // Define service keys
|
|
10879
|
-
* const Logger =
|
|
10880
|
+
* const Logger = Context.Service<{
|
|
10880
10881
|
* log: (msg: string) => void
|
|
10881
10882
|
* }>("Logger")
|
|
10882
|
-
* const Database =
|
|
10883
|
+
* const Database = Context.Service<{
|
|
10883
10884
|
* query: (sql: string) => string
|
|
10884
10885
|
* }>("Database")
|
|
10885
10886
|
*
|
|
10886
|
-
* // Create
|
|
10887
|
-
* const
|
|
10888
|
-
* .pipe(
|
|
10887
|
+
* // Create a context with multiple services
|
|
10888
|
+
* const context = Context.make(Logger, { log: console.log })
|
|
10889
|
+
* .pipe(Context.add(Database, { query: () => "result" }))
|
|
10889
10890
|
*
|
|
10890
10891
|
* // An effect that requires both services
|
|
10891
10892
|
* const program = Effect.gen(function*() {
|
|
@@ -10895,37 +10896,37 @@ export const provide: {
|
|
|
10895
10896
|
* return db.query("SELECT * FROM users")
|
|
10896
10897
|
* })
|
|
10897
10898
|
*
|
|
10898
|
-
* const provided = Effect.
|
|
10899
|
+
* const provided = Effect.provideContext(program, context)
|
|
10899
10900
|
* ```
|
|
10900
10901
|
*
|
|
10901
10902
|
* @since 2.0.0
|
|
10902
10903
|
* @category Environment
|
|
10903
10904
|
*/
|
|
10904
|
-
export const
|
|
10905
|
+
export const provideContext: {
|
|
10905
10906
|
/**
|
|
10906
|
-
* Provides a
|
|
10907
|
+
* Provides a context to an effect, fulfilling its service requirements.
|
|
10907
10908
|
*
|
|
10908
10909
|
* **Details**
|
|
10909
10910
|
*
|
|
10910
|
-
* This function provides multiple services at once by supplying a
|
|
10911
|
+
* This function provides multiple services at once by supplying a context
|
|
10911
10912
|
* that contains all the required services. It removes the provided services
|
|
10912
10913
|
* from the effect's requirements, making them available to the effect.
|
|
10913
10914
|
*
|
|
10914
10915
|
* @example
|
|
10915
10916
|
* ```ts
|
|
10916
|
-
* import { Effect,
|
|
10917
|
+
* import { Effect, Context } from "effect"
|
|
10917
10918
|
*
|
|
10918
10919
|
* // Define service keys
|
|
10919
|
-
* const Logger =
|
|
10920
|
+
* const Logger = Context.Service<{
|
|
10920
10921
|
* log: (msg: string) => void
|
|
10921
10922
|
* }>("Logger")
|
|
10922
|
-
* const Database =
|
|
10923
|
+
* const Database = Context.Service<{
|
|
10923
10924
|
* query: (sql: string) => string
|
|
10924
10925
|
* }>("Database")
|
|
10925
10926
|
*
|
|
10926
|
-
* // Create
|
|
10927
|
-
* const
|
|
10928
|
-
* .pipe(
|
|
10927
|
+
* // Create a context with multiple services
|
|
10928
|
+
* const context = Context.make(Logger, { log: console.log })
|
|
10929
|
+
* .pipe(Context.add(Database, { query: () => "result" }))
|
|
10929
10930
|
*
|
|
10930
10931
|
* // An effect that requires both services
|
|
10931
10932
|
* const program = Effect.gen(function*() {
|
|
@@ -10935,37 +10936,37 @@ export const provideServices: {
|
|
|
10935
10936
|
* return db.query("SELECT * FROM users")
|
|
10936
10937
|
* })
|
|
10937
10938
|
*
|
|
10938
|
-
* const provided = Effect.
|
|
10939
|
+
* const provided = Effect.provideContext(program, context)
|
|
10939
10940
|
* ```
|
|
10940
10941
|
*
|
|
10941
10942
|
* @since 2.0.0
|
|
10942
10943
|
* @category Environment
|
|
10943
10944
|
*/
|
|
10944
|
-
<XR>(context:
|
|
10945
|
+
<XR>(context: Context.Context<XR>): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, XR>>
|
|
10945
10946
|
/**
|
|
10946
|
-
* Provides a
|
|
10947
|
+
* Provides a context to an effect, fulfilling its service requirements.
|
|
10947
10948
|
*
|
|
10948
10949
|
* **Details**
|
|
10949
10950
|
*
|
|
10950
|
-
* This function provides multiple services at once by supplying a
|
|
10951
|
+
* This function provides multiple services at once by supplying a context
|
|
10951
10952
|
* that contains all the required services. It removes the provided services
|
|
10952
10953
|
* from the effect's requirements, making them available to the effect.
|
|
10953
10954
|
*
|
|
10954
10955
|
* @example
|
|
10955
10956
|
* ```ts
|
|
10956
|
-
* import { Effect,
|
|
10957
|
+
* import { Effect, Context } from "effect"
|
|
10957
10958
|
*
|
|
10958
10959
|
* // Define service keys
|
|
10959
|
-
* const Logger =
|
|
10960
|
+
* const Logger = Context.Service<{
|
|
10960
10961
|
* log: (msg: string) => void
|
|
10961
10962
|
* }>("Logger")
|
|
10962
|
-
* const Database =
|
|
10963
|
+
* const Database = Context.Service<{
|
|
10963
10964
|
* query: (sql: string) => string
|
|
10964
10965
|
* }>("Database")
|
|
10965
10966
|
*
|
|
10966
|
-
* // Create
|
|
10967
|
-
* const
|
|
10968
|
-
* .pipe(
|
|
10967
|
+
* // Create a context with multiple services
|
|
10968
|
+
* const context = Context.make(Logger, { log: console.log })
|
|
10969
|
+
* .pipe(Context.add(Database, { query: () => "result" }))
|
|
10969
10970
|
*
|
|
10970
10971
|
* // An effect that requires both services
|
|
10971
10972
|
* const program = Effect.gen(function*() {
|
|
@@ -10975,27 +10976,27 @@ export const provideServices: {
|
|
|
10975
10976
|
* return db.query("SELECT * FROM users")
|
|
10976
10977
|
* })
|
|
10977
10978
|
*
|
|
10978
|
-
* const provided = Effect.
|
|
10979
|
+
* const provided = Effect.provideContext(program, context)
|
|
10979
10980
|
* ```
|
|
10980
10981
|
*
|
|
10981
10982
|
* @since 2.0.0
|
|
10982
10983
|
* @category Environment
|
|
10983
10984
|
*/
|
|
10984
|
-
<A, E, R, XR>(self: Effect<A, E, R>, context:
|
|
10985
|
-
} = internal.
|
|
10985
|
+
<A, E, R, XR>(self: Effect<A, E, R>, context: Context.Context<XR>): Effect<A, E, Exclude<R, XR>>
|
|
10986
|
+
} = internal.provideContext
|
|
10986
10987
|
|
|
10987
10988
|
/**
|
|
10988
10989
|
* Accesses a service from the context.
|
|
10989
10990
|
*
|
|
10990
10991
|
* @example
|
|
10991
10992
|
* ```ts
|
|
10992
|
-
* import { Effect,
|
|
10993
|
+
* import { Effect, Context } from "effect"
|
|
10993
10994
|
*
|
|
10994
10995
|
* interface Database {
|
|
10995
10996
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
10996
10997
|
* }
|
|
10997
10998
|
*
|
|
10998
|
-
* const Database =
|
|
10999
|
+
* const Database = Context.Service<Database>("Database")
|
|
10999
11000
|
*
|
|
11000
11001
|
* const program = Effect.gen(function*() {
|
|
11001
11002
|
* const db = yield* Effect.service(Database)
|
|
@@ -11004,9 +11005,9 @@ export const provideServices: {
|
|
|
11004
11005
|
* ```
|
|
11005
11006
|
*
|
|
11006
11007
|
* @since 4.0.0
|
|
11007
|
-
* @category
|
|
11008
|
+
* @category Context
|
|
11008
11009
|
*/
|
|
11009
|
-
export const service: <I, S>(service:
|
|
11010
|
+
export const service: <I, S>(service: Context.Key<I, S>) => Effect<S, never, I> = internal.service
|
|
11010
11011
|
|
|
11011
11012
|
/**
|
|
11012
11013
|
* Optionally accesses a service from the environment.
|
|
@@ -11020,10 +11021,10 @@ export const service: <I, S>(service: ServiceMap.Key<I, S>) => Effect<S, never,
|
|
|
11020
11021
|
*
|
|
11021
11022
|
* @example
|
|
11022
11023
|
* ```ts
|
|
11023
|
-
* import { Effect, Option,
|
|
11024
|
+
* import { Effect, Option, Context } from "effect"
|
|
11024
11025
|
*
|
|
11025
11026
|
* // Define a service key
|
|
11026
|
-
* const Logger =
|
|
11027
|
+
* const Logger = Context.Service<{
|
|
11027
11028
|
* log: (msg: string) => void
|
|
11028
11029
|
* }>("Logger")
|
|
11029
11030
|
*
|
|
@@ -11040,9 +11041,9 @@ export const service: <I, S>(service: ServiceMap.Key<I, S>) => Effect<S, never,
|
|
|
11040
11041
|
* ```
|
|
11041
11042
|
*
|
|
11042
11043
|
* @since 2.0.0
|
|
11043
|
-
* @category
|
|
11044
|
+
* @category Context
|
|
11044
11045
|
*/
|
|
11045
|
-
export const serviceOption: <I, S>(key:
|
|
11046
|
+
export const serviceOption: <I, S>(key: Context.Key<I, S>) => Effect<Option<S>> = internal.serviceOption
|
|
11046
11047
|
|
|
11047
11048
|
/**
|
|
11048
11049
|
* Provides part of the required context while leaving the rest unchanged.
|
|
@@ -11054,13 +11055,13 @@ export const serviceOption: <I, S>(key: ServiceMap.Key<I, S>) => Effect<Option<S
|
|
|
11054
11055
|
*
|
|
11055
11056
|
* @example
|
|
11056
11057
|
* ```ts
|
|
11057
|
-
* import { Effect,
|
|
11058
|
+
* import { Effect, Context } from "effect"
|
|
11058
11059
|
*
|
|
11059
11060
|
* // Define services
|
|
11060
|
-
* const Logger =
|
|
11061
|
+
* const Logger = Context.Service<{
|
|
11061
11062
|
* log: (msg: string) => void
|
|
11062
11063
|
* }>("Logger")
|
|
11063
|
-
* const Config =
|
|
11064
|
+
* const Config = Context.Service<{
|
|
11064
11065
|
* name: string
|
|
11065
11066
|
* }>("Config")
|
|
11066
11067
|
*
|
|
@@ -11070,8 +11071,8 @@ export const serviceOption: <I, S>(key: ServiceMap.Key<I, S>) => Effect<Option<S
|
|
|
11070
11071
|
*
|
|
11071
11072
|
* // Transform services by providing Config while keeping Logger requirement
|
|
11072
11073
|
* const configured = program.pipe(
|
|
11073
|
-
* Effect.
|
|
11074
|
-
*
|
|
11074
|
+
* Effect.updateContext((context: Context.Context<typeof Logger>) =>
|
|
11075
|
+
* Context.add(context, Config, { name: "World" })
|
|
11075
11076
|
* )
|
|
11076
11077
|
* )
|
|
11077
11078
|
*
|
|
@@ -11082,9 +11083,9 @@ export const serviceOption: <I, S>(key: ServiceMap.Key<I, S>) => Effect<Option<S
|
|
|
11082
11083
|
* ```
|
|
11083
11084
|
*
|
|
11084
11085
|
* @since 4.0.0
|
|
11085
|
-
* @category
|
|
11086
|
+
* @category Context
|
|
11086
11087
|
*/
|
|
11087
|
-
export const
|
|
11088
|
+
export const updateContext: {
|
|
11088
11089
|
/**
|
|
11089
11090
|
* Provides part of the required context while leaving the rest unchanged.
|
|
11090
11091
|
*
|
|
@@ -11095,13 +11096,13 @@ export const updateServices: {
|
|
|
11095
11096
|
*
|
|
11096
11097
|
* @example
|
|
11097
11098
|
* ```ts
|
|
11098
|
-
* import { Effect,
|
|
11099
|
+
* import { Effect, Context } from "effect"
|
|
11099
11100
|
*
|
|
11100
11101
|
* // Define services
|
|
11101
|
-
* const Logger =
|
|
11102
|
+
* const Logger = Context.Service<{
|
|
11102
11103
|
* log: (msg: string) => void
|
|
11103
11104
|
* }>("Logger")
|
|
11104
|
-
* const Config =
|
|
11105
|
+
* const Config = Context.Service<{
|
|
11105
11106
|
* name: string
|
|
11106
11107
|
* }>("Config")
|
|
11107
11108
|
*
|
|
@@ -11111,8 +11112,8 @@ export const updateServices: {
|
|
|
11111
11112
|
*
|
|
11112
11113
|
* // Transform services by providing Config while keeping Logger requirement
|
|
11113
11114
|
* const configured = program.pipe(
|
|
11114
|
-
* Effect.
|
|
11115
|
-
*
|
|
11115
|
+
* Effect.updateContext((context: Context.Context<typeof Logger>) =>
|
|
11116
|
+
* Context.add(context, Config, { name: "World" })
|
|
11116
11117
|
* )
|
|
11117
11118
|
* )
|
|
11118
11119
|
*
|
|
@@ -11123,11 +11124,9 @@ export const updateServices: {
|
|
|
11123
11124
|
* ```
|
|
11124
11125
|
*
|
|
11125
11126
|
* @since 4.0.0
|
|
11126
|
-
* @category
|
|
11127
|
+
* @category Context
|
|
11127
11128
|
*/
|
|
11128
|
-
<R2, R>(
|
|
11129
|
-
f: (services: ServiceMap.ServiceMap<R2>) => ServiceMap.ServiceMap<NoInfer<R>>
|
|
11130
|
-
): <A, E>(self: Effect<A, E, R>) => Effect<A, E, R2>
|
|
11129
|
+
<R2, R>(f: (context: Context.Context<R2>) => Context.Context<NoInfer<R>>): <A, E>(self: Effect<A, E, R>) => Effect<A, E, R2>
|
|
11131
11130
|
/**
|
|
11132
11131
|
* Provides part of the required context while leaving the rest unchanged.
|
|
11133
11132
|
*
|
|
@@ -11138,13 +11137,13 @@ export const updateServices: {
|
|
|
11138
11137
|
*
|
|
11139
11138
|
* @example
|
|
11140
11139
|
* ```ts
|
|
11141
|
-
* import { Effect,
|
|
11140
|
+
* import { Effect, Context } from "effect"
|
|
11142
11141
|
*
|
|
11143
11142
|
* // Define services
|
|
11144
|
-
* const Logger =
|
|
11143
|
+
* const Logger = Context.Service<{
|
|
11145
11144
|
* log: (msg: string) => void
|
|
11146
11145
|
* }>("Logger")
|
|
11147
|
-
* const Config =
|
|
11146
|
+
* const Config = Context.Service<{
|
|
11148
11147
|
* name: string
|
|
11149
11148
|
* }>("Config")
|
|
11150
11149
|
*
|
|
@@ -11154,8 +11153,8 @@ export const updateServices: {
|
|
|
11154
11153
|
*
|
|
11155
11154
|
* // Transform services by providing Config while keeping Logger requirement
|
|
11156
11155
|
* const configured = program.pipe(
|
|
11157
|
-
* Effect.
|
|
11158
|
-
*
|
|
11156
|
+
* Effect.updateContext((context: Context.Context<typeof Logger>) =>
|
|
11157
|
+
* Context.add(context, Config, { name: "World" })
|
|
11159
11158
|
* )
|
|
11160
11159
|
* )
|
|
11161
11160
|
*
|
|
@@ -11166,23 +11165,23 @@ export const updateServices: {
|
|
|
11166
11165
|
* ```
|
|
11167
11166
|
*
|
|
11168
11167
|
* @since 4.0.0
|
|
11169
|
-
* @category
|
|
11168
|
+
* @category Context
|
|
11170
11169
|
*/
|
|
11171
11170
|
<A, E, R, R2>(
|
|
11172
11171
|
self: Effect<A, E, R>,
|
|
11173
|
-
f: (
|
|
11172
|
+
f: (context: Context.Context<R2>) => Context.Context<NoInfer<R>>
|
|
11174
11173
|
): Effect<A, E, R2>
|
|
11175
|
-
} = internal.
|
|
11174
|
+
} = internal.updateContext
|
|
11176
11175
|
|
|
11177
11176
|
/**
|
|
11178
11177
|
* Updates the service with the required service entry.
|
|
11179
11178
|
*
|
|
11180
11179
|
* @example
|
|
11181
11180
|
* ```ts
|
|
11182
|
-
* import { Console, Effect,
|
|
11181
|
+
* import { Console, Effect, Context } from "effect"
|
|
11183
11182
|
*
|
|
11184
11183
|
* // Define a counter service
|
|
11185
|
-
* const Counter =
|
|
11184
|
+
* const Counter = Context.Service<{ count: number }>("Counter")
|
|
11186
11185
|
*
|
|
11187
11186
|
* const program = Effect.gen(function*() {
|
|
11188
11187
|
* const updatedCounter = yield* Effect.service(Counter)
|
|
@@ -11200,7 +11199,7 @@ export const updateServices: {
|
|
|
11200
11199
|
* ```
|
|
11201
11200
|
*
|
|
11202
11201
|
* @since 2.0.0
|
|
11203
|
-
* @category
|
|
11202
|
+
* @category Context
|
|
11204
11203
|
*/
|
|
11205
11204
|
export const updateService: {
|
|
11206
11205
|
/**
|
|
@@ -11208,10 +11207,10 @@ export const updateService: {
|
|
|
11208
11207
|
*
|
|
11209
11208
|
* @example
|
|
11210
11209
|
* ```ts
|
|
11211
|
-
* import { Console, Effect,
|
|
11210
|
+
* import { Console, Effect, Context } from "effect"
|
|
11212
11211
|
*
|
|
11213
11212
|
* // Define a counter service
|
|
11214
|
-
* const Counter =
|
|
11213
|
+
* const Counter = Context.Service<{ count: number }>("Counter")
|
|
11215
11214
|
*
|
|
11216
11215
|
* const program = Effect.gen(function*() {
|
|
11217
11216
|
* const updatedCounter = yield* Effect.service(Counter)
|
|
@@ -11229,18 +11228,18 @@ export const updateService: {
|
|
|
11229
11228
|
* ```
|
|
11230
11229
|
*
|
|
11231
11230
|
* @since 2.0.0
|
|
11232
|
-
* @category
|
|
11231
|
+
* @category Context
|
|
11233
11232
|
*/
|
|
11234
|
-
<I, A>(service:
|
|
11233
|
+
<I, A>(service: Context.Key<I, A>, f: (value: A) => A): <XA, E, R>(self: Effect<XA, E, R>) => Effect<XA, E, R | I>
|
|
11235
11234
|
/**
|
|
11236
11235
|
* Updates the service with the required service entry.
|
|
11237
11236
|
*
|
|
11238
11237
|
* @example
|
|
11239
11238
|
* ```ts
|
|
11240
|
-
* import { Console, Effect,
|
|
11239
|
+
* import { Console, Effect, Context } from "effect"
|
|
11241
11240
|
*
|
|
11242
11241
|
* // Define a counter service
|
|
11243
|
-
* const Counter =
|
|
11242
|
+
* const Counter = Context.Service<{ count: number }>("Counter")
|
|
11244
11243
|
*
|
|
11245
11244
|
* const program = Effect.gen(function*() {
|
|
11246
11245
|
* const updatedCounter = yield* Effect.service(Counter)
|
|
@@ -11258,9 +11257,9 @@ export const updateService: {
|
|
|
11258
11257
|
* ```
|
|
11259
11258
|
*
|
|
11260
11259
|
* @since 2.0.0
|
|
11261
|
-
* @category
|
|
11260
|
+
* @category Context
|
|
11262
11261
|
*/
|
|
11263
|
-
<XA, E, R, I, A>(self: Effect<XA, E, R>, service:
|
|
11262
|
+
<XA, E, R, I, A>(self: Effect<XA, E, R>, service: Context.Key<I, A>, f: (value: A) => A): Effect<XA, E, R | I>
|
|
11264
11263
|
} = internal.updateService
|
|
11265
11264
|
|
|
11266
11265
|
/**
|
|
@@ -11277,10 +11276,10 @@ export const updateService: {
|
|
|
11277
11276
|
*
|
|
11278
11277
|
* @example
|
|
11279
11278
|
* ```ts
|
|
11280
|
-
* import { Console, Effect,
|
|
11279
|
+
* import { Console, Effect, Context } from "effect"
|
|
11281
11280
|
*
|
|
11282
11281
|
* // Define a service for configuration
|
|
11283
|
-
* const Config =
|
|
11282
|
+
* const Config = Context.Service<{
|
|
11284
11283
|
* apiUrl: string
|
|
11285
11284
|
* timeout: number
|
|
11286
11285
|
* }>("Config")
|
|
@@ -11306,7 +11305,7 @@ export const updateService: {
|
|
|
11306
11305
|
* ```
|
|
11307
11306
|
*
|
|
11308
11307
|
* @since 2.0.0
|
|
11309
|
-
* @category
|
|
11308
|
+
* @category Context
|
|
11310
11309
|
*/
|
|
11311
11310
|
export const provideService: {
|
|
11312
11311
|
/**
|
|
@@ -11323,10 +11322,10 @@ export const provideService: {
|
|
|
11323
11322
|
*
|
|
11324
11323
|
* @example
|
|
11325
11324
|
* ```ts
|
|
11326
|
-
* import { Console, Effect,
|
|
11325
|
+
* import { Console, Effect, Context } from "effect"
|
|
11327
11326
|
*
|
|
11328
11327
|
* // Define a service for configuration
|
|
11329
|
-
* const Config =
|
|
11328
|
+
* const Config = Context.Service<{
|
|
11330
11329
|
* apiUrl: string
|
|
11331
11330
|
* timeout: number
|
|
11332
11331
|
* }>("Config")
|
|
@@ -11352,9 +11351,9 @@ export const provideService: {
|
|
|
11352
11351
|
* ```
|
|
11353
11352
|
*
|
|
11354
11353
|
* @since 2.0.0
|
|
11355
|
-
* @category
|
|
11354
|
+
* @category Context
|
|
11356
11355
|
*/
|
|
11357
|
-
<I, S>(service:
|
|
11356
|
+
<I, S>(service: Context.Key<I, S>): {
|
|
11358
11357
|
/**
|
|
11359
11358
|
* The `provideService` function is used to provide an actual
|
|
11360
11359
|
* implementation for a service in the context of an effect.
|
|
@@ -11369,10 +11368,10 @@ export const provideService: {
|
|
|
11369
11368
|
*
|
|
11370
11369
|
* @example
|
|
11371
11370
|
* ```ts
|
|
11372
|
-
* import { Console, Effect,
|
|
11371
|
+
* import { Console, Effect, Context } from "effect"
|
|
11373
11372
|
*
|
|
11374
11373
|
* // Define a service for configuration
|
|
11375
|
-
* const Config =
|
|
11374
|
+
* const Config = Context.Service<{
|
|
11376
11375
|
* apiUrl: string
|
|
11377
11376
|
* timeout: number
|
|
11378
11377
|
* }>("Config")
|
|
@@ -11398,7 +11397,7 @@ export const provideService: {
|
|
|
11398
11397
|
* ```
|
|
11399
11398
|
*
|
|
11400
11399
|
* @since 2.0.0
|
|
11401
|
-
* @category
|
|
11400
|
+
* @category Context
|
|
11402
11401
|
*/
|
|
11403
11402
|
(implementation: S): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, I>>
|
|
11404
11403
|
/**
|
|
@@ -11415,10 +11414,10 @@ export const provideService: {
|
|
|
11415
11414
|
*
|
|
11416
11415
|
* @example
|
|
11417
11416
|
* ```ts
|
|
11418
|
-
* import { Console, Effect,
|
|
11417
|
+
* import { Console, Effect, Context } from "effect"
|
|
11419
11418
|
*
|
|
11420
11419
|
* // Define a service for configuration
|
|
11421
|
-
* const Config =
|
|
11420
|
+
* const Config = Context.Service<{
|
|
11422
11421
|
* apiUrl: string
|
|
11423
11422
|
* timeout: number
|
|
11424
11423
|
* }>("Config")
|
|
@@ -11444,7 +11443,7 @@ export const provideService: {
|
|
|
11444
11443
|
* ```
|
|
11445
11444
|
*
|
|
11446
11445
|
* @since 2.0.0
|
|
11447
|
-
* @category
|
|
11446
|
+
* @category Context
|
|
11448
11447
|
*/
|
|
11449
11448
|
<A, E, R>(self: Effect<A, E, R>, implementation: S): Effect<A, E, Exclude<R, I>>
|
|
11450
11449
|
}
|
|
@@ -11462,10 +11461,10 @@ export const provideService: {
|
|
|
11462
11461
|
*
|
|
11463
11462
|
* @example
|
|
11464
11463
|
* ```ts
|
|
11465
|
-
* import { Console, Effect,
|
|
11464
|
+
* import { Console, Effect, Context } from "effect"
|
|
11466
11465
|
*
|
|
11467
11466
|
* // Define a service for configuration
|
|
11468
|
-
* const Config =
|
|
11467
|
+
* const Config = Context.Service<{
|
|
11469
11468
|
* apiUrl: string
|
|
11470
11469
|
* timeout: number
|
|
11471
11470
|
* }>("Config")
|
|
@@ -11491,9 +11490,9 @@ export const provideService: {
|
|
|
11491
11490
|
* ```
|
|
11492
11491
|
*
|
|
11493
11492
|
* @since 2.0.0
|
|
11494
|
-
* @category
|
|
11493
|
+
* @category Context
|
|
11495
11494
|
*/
|
|
11496
|
-
<I, S>(service:
|
|
11495
|
+
<I, S>(service: Context.Key<I, S>, implementation: S): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, I>>
|
|
11497
11496
|
/**
|
|
11498
11497
|
* The `provideService` function is used to provide an actual
|
|
11499
11498
|
* implementation for a service in the context of an effect.
|
|
@@ -11508,10 +11507,10 @@ export const provideService: {
|
|
|
11508
11507
|
*
|
|
11509
11508
|
* @example
|
|
11510
11509
|
* ```ts
|
|
11511
|
-
* import { Console, Effect,
|
|
11510
|
+
* import { Console, Effect, Context } from "effect"
|
|
11512
11511
|
*
|
|
11513
11512
|
* // Define a service for configuration
|
|
11514
|
-
* const Config =
|
|
11513
|
+
* const Config = Context.Service<{
|
|
11515
11514
|
* apiUrl: string
|
|
11516
11515
|
* timeout: number
|
|
11517
11516
|
* }>("Config")
|
|
@@ -11537,9 +11536,9 @@ export const provideService: {
|
|
|
11537
11536
|
* ```
|
|
11538
11537
|
*
|
|
11539
11538
|
* @since 2.0.0
|
|
11540
|
-
* @category
|
|
11539
|
+
* @category Context
|
|
11541
11540
|
*/
|
|
11542
|
-
<A, E, R, I, S>(self: Effect<A, E, R>, service:
|
|
11541
|
+
<A, E, R, I, S>(self: Effect<A, E, R>, service: Context.Key<I, S>, implementation: S): Effect<A, E, Exclude<R, I>>
|
|
11543
11542
|
} = internal.provideService
|
|
11544
11543
|
|
|
11545
11544
|
/**
|
|
@@ -11554,13 +11553,13 @@ export const provideService: {
|
|
|
11554
11553
|
*
|
|
11555
11554
|
* @example
|
|
11556
11555
|
* ```ts
|
|
11557
|
-
* import { Console, Effect,
|
|
11556
|
+
* import { Console, Effect, Context } from "effect"
|
|
11558
11557
|
*
|
|
11559
11558
|
* // Define a database connection service
|
|
11560
11559
|
* interface DatabaseConnection {
|
|
11561
11560
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
11562
11561
|
* }
|
|
11563
|
-
* const Database =
|
|
11562
|
+
* const Database = Context.Service<DatabaseConnection>("Database")
|
|
11564
11563
|
*
|
|
11565
11564
|
* // Effect that creates a database connection
|
|
11566
11565
|
* const createConnection = Effect.gen(function*() {
|
|
@@ -11592,7 +11591,7 @@ export const provideService: {
|
|
|
11592
11591
|
* ```
|
|
11593
11592
|
*
|
|
11594
11593
|
* @since 2.0.0
|
|
11595
|
-
* @category
|
|
11594
|
+
* @category Context
|
|
11596
11595
|
*/
|
|
11597
11596
|
export const provideServiceEffect: {
|
|
11598
11597
|
/**
|
|
@@ -11607,13 +11606,13 @@ export const provideServiceEffect: {
|
|
|
11607
11606
|
*
|
|
11608
11607
|
* @example
|
|
11609
11608
|
* ```ts
|
|
11610
|
-
* import { Console, Effect,
|
|
11609
|
+
* import { Console, Effect, Context } from "effect"
|
|
11611
11610
|
*
|
|
11612
11611
|
* // Define a database connection service
|
|
11613
11612
|
* interface DatabaseConnection {
|
|
11614
11613
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
11615
11614
|
* }
|
|
11616
|
-
* const Database =
|
|
11615
|
+
* const Database = Context.Service<DatabaseConnection>("Database")
|
|
11617
11616
|
*
|
|
11618
11617
|
* // Effect that creates a database connection
|
|
11619
11618
|
* const createConnection = Effect.gen(function*() {
|
|
@@ -11645,9 +11644,9 @@ export const provideServiceEffect: {
|
|
|
11645
11644
|
* ```
|
|
11646
11645
|
*
|
|
11647
11646
|
* @since 2.0.0
|
|
11648
|
-
* @category
|
|
11647
|
+
* @category Context
|
|
11649
11648
|
*/
|
|
11650
|
-
<I, S, E2, R2>(service:
|
|
11649
|
+
<I, S, E2, R2>(service: Context.Key<I, S>, acquire: Effect<S, E2, R2>): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E | E2, Exclude<R, I> | R2>
|
|
11651
11650
|
/**
|
|
11652
11651
|
* Provides the effect with the single service it requires. If the effect
|
|
11653
11652
|
* requires more than one service use `provide` instead.
|
|
@@ -11660,13 +11659,13 @@ export const provideServiceEffect: {
|
|
|
11660
11659
|
*
|
|
11661
11660
|
* @example
|
|
11662
11661
|
* ```ts
|
|
11663
|
-
* import { Console, Effect,
|
|
11662
|
+
* import { Console, Effect, Context } from "effect"
|
|
11664
11663
|
*
|
|
11665
11664
|
* // Define a database connection service
|
|
11666
11665
|
* interface DatabaseConnection {
|
|
11667
11666
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
11668
11667
|
* }
|
|
11669
|
-
* const Database =
|
|
11668
|
+
* const Database = Context.Service<DatabaseConnection>("Database")
|
|
11670
11669
|
*
|
|
11671
11670
|
* // Effect that creates a database connection
|
|
11672
11671
|
* const createConnection = Effect.gen(function*() {
|
|
@@ -11698,11 +11697,11 @@ export const provideServiceEffect: {
|
|
|
11698
11697
|
* ```
|
|
11699
11698
|
*
|
|
11700
11699
|
* @since 2.0.0
|
|
11701
|
-
* @category
|
|
11700
|
+
* @category Context
|
|
11702
11701
|
*/
|
|
11703
11702
|
<A, E, R, I, S, E2, R2>(
|
|
11704
11703
|
self: Effect<A, E, R>,
|
|
11705
|
-
service:
|
|
11704
|
+
service: Context.Key<I, S>,
|
|
11706
11705
|
acquire: Effect<S, E2, R2>
|
|
11707
11706
|
): Effect<A, E | E2, Exclude<R, I> | R2>
|
|
11708
11707
|
} = internal.provideServiceEffect
|
|
@@ -13372,8 +13371,7 @@ export declare namespace Repeat {
|
|
|
13372
13371
|
* ```
|
|
13373
13372
|
*/
|
|
13374
13373
|
export type Return<R, E, A, O extends Options<A>> = Effect<
|
|
13375
|
-
O extends {
|
|
13376
|
-
: O extends { until: Predicate.Refinement<A, infer B> } ? B
|
|
13374
|
+
O extends { until: Predicate.Refinement<A, infer B> } ? B
|
|
13377
13375
|
: O extends { while: Predicate.Refinement<A, infer B> } ? Exclude<A, B>
|
|
13378
13376
|
: A,
|
|
13379
13377
|
| E
|
|
@@ -15602,7 +15600,7 @@ export const request: {
|
|
|
15602
15600
|
|
|
15603
15601
|
/**
|
|
15604
15602
|
* Low-level entry point that registers a request with a resolver and delivers the exit value via `onExit`.
|
|
15605
|
-
* Use this when you already have a `
|
|
15603
|
+
* Use this when you already have a `Context` and need to enqueue a request outside an `Effect`.
|
|
15606
15604
|
*
|
|
15607
15605
|
* It returns a canceler that removes the pending request entry.
|
|
15608
15606
|
*
|
|
@@ -15614,7 +15612,7 @@ export const requestUnsafe: <A extends Request.Any>(
|
|
|
15614
15612
|
options: {
|
|
15615
15613
|
readonly resolver: RequestResolver<A>
|
|
15616
15614
|
readonly onExit: (exit: Exit.Exit<Request.Success<A>, Request.Error<A>>) => void
|
|
15617
|
-
readonly
|
|
15615
|
+
readonly context: Context.Context<never>
|
|
15618
15616
|
}
|
|
15619
15617
|
) => () => void = internalRequest.requestUnsafe
|
|
15620
15618
|
|
|
@@ -16017,15 +16015,15 @@ export const runFork: <A, E>(effect: Effect<A, E, never>, options?: RunOptions |
|
|
|
16017
16015
|
*
|
|
16018
16016
|
* @example
|
|
16019
16017
|
* ```ts
|
|
16020
|
-
* import { Effect,
|
|
16018
|
+
* import { Effect, Context } from "effect"
|
|
16021
16019
|
*
|
|
16022
16020
|
* interface Logger {
|
|
16023
16021
|
* log: (message: string) => void
|
|
16024
16022
|
* }
|
|
16025
16023
|
*
|
|
16026
|
-
* const Logger =
|
|
16024
|
+
* const Logger = Context.Service<Logger>("Logger")
|
|
16027
16025
|
*
|
|
16028
|
-
* const services =
|
|
16026
|
+
* const services = Context.make(Logger, {
|
|
16029
16027
|
* log: (message) => console.log(message)
|
|
16030
16028
|
* })
|
|
16031
16029
|
*
|
|
@@ -16042,7 +16040,7 @@ export const runFork: <A, E>(effect: Effect<A, E, never>, options?: RunOptions |
|
|
|
16042
16040
|
* @category Running Effects
|
|
16043
16041
|
*/
|
|
16044
16042
|
export const runForkWith: <R>(
|
|
16045
|
-
|
|
16043
|
+
context: Context.Context<R>
|
|
16046
16044
|
) => <A, E>(effect: Effect<A, E, R>, options?: RunOptions | undefined) => Fiber<A, E> = internal.runForkWith
|
|
16047
16045
|
|
|
16048
16046
|
/**
|
|
@@ -16052,15 +16050,15 @@ export const runForkWith: <R>(
|
|
|
16052
16050
|
*
|
|
16053
16051
|
* @example
|
|
16054
16052
|
* ```ts
|
|
16055
|
-
* import { Console, Effect, Exit,
|
|
16053
|
+
* import { Console, Effect, Exit, Context } from "effect"
|
|
16056
16054
|
*
|
|
16057
16055
|
* interface Logger {
|
|
16058
16056
|
* log: (message: string) => Effect.Effect<void>
|
|
16059
16057
|
* }
|
|
16060
16058
|
*
|
|
16061
|
-
* const Logger =
|
|
16059
|
+
* const Logger = Context.Service<Logger>("Logger")
|
|
16062
16060
|
*
|
|
16063
|
-
* const services =
|
|
16061
|
+
* const services = Context.make(Logger, {
|
|
16064
16062
|
* log: (message) => Console.log(message)
|
|
16065
16063
|
* })
|
|
16066
16064
|
*
|
|
@@ -16086,7 +16084,7 @@ export const runForkWith: <R>(
|
|
|
16086
16084
|
* @category Running Effects
|
|
16087
16085
|
*/
|
|
16088
16086
|
export const runCallbackWith: <R>(
|
|
16089
|
-
|
|
16087
|
+
context: Context.Context<R>
|
|
16090
16088
|
) => <A, E>(
|
|
16091
16089
|
effect: Effect<A, E, R>,
|
|
16092
16090
|
options?: (RunOptions & { readonly onExit: (exit: Exit.Exit<A, E>) => void }) | undefined
|
|
@@ -16178,15 +16176,15 @@ export const runPromise: <A, E>(
|
|
|
16178
16176
|
*
|
|
16179
16177
|
* @example
|
|
16180
16178
|
* ```ts
|
|
16181
|
-
* import { Effect,
|
|
16179
|
+
* import { Effect, Context } from "effect"
|
|
16182
16180
|
*
|
|
16183
16181
|
* interface Config {
|
|
16184
16182
|
* apiUrl: string
|
|
16185
16183
|
* }
|
|
16186
16184
|
*
|
|
16187
|
-
* const Config =
|
|
16185
|
+
* const Config = Context.Service<Config>("Config")
|
|
16188
16186
|
*
|
|
16189
|
-
* const
|
|
16187
|
+
* const context = Context.make(Config, {
|
|
16190
16188
|
* apiUrl: "https://api.example.com"
|
|
16191
16189
|
* })
|
|
16192
16190
|
*
|
|
@@ -16195,14 +16193,14 @@ export const runPromise: <A, E>(
|
|
|
16195
16193
|
* return `Connecting to ${config.apiUrl}`
|
|
16196
16194
|
* })
|
|
16197
16195
|
*
|
|
16198
|
-
* Effect.runPromiseWith(
|
|
16196
|
+
* Effect.runPromiseWith(context)(program).then(console.log)
|
|
16199
16197
|
* ```
|
|
16200
16198
|
*
|
|
16201
16199
|
* @since 4.0.0
|
|
16202
16200
|
* @category Running Effects
|
|
16203
16201
|
*/
|
|
16204
16202
|
export const runPromiseWith: <R>(
|
|
16205
|
-
|
|
16203
|
+
context: Context.Context<R>
|
|
16206
16204
|
) => <A, E>(effect: Effect<A, E, R>, options?: RunOptions | undefined) => Promise<A> = internal.runPromiseWith
|
|
16207
16205
|
|
|
16208
16206
|
/**
|
|
@@ -16262,15 +16260,15 @@ export const runPromiseExit: <A, E>(
|
|
|
16262
16260
|
*
|
|
16263
16261
|
* @example
|
|
16264
16262
|
* ```ts
|
|
16265
|
-
* import { Effect, Exit,
|
|
16263
|
+
* import { Effect, Exit, Context } from "effect"
|
|
16266
16264
|
*
|
|
16267
16265
|
* interface Database {
|
|
16268
16266
|
* query: (sql: string) => string
|
|
16269
16267
|
* }
|
|
16270
16268
|
*
|
|
16271
|
-
* const Database =
|
|
16269
|
+
* const Database = Context.Service<Database>("Database")
|
|
16272
16270
|
*
|
|
16273
|
-
* const services =
|
|
16271
|
+
* const services = Context.make(Database, {
|
|
16274
16272
|
* query: (sql) => `Result for: ${sql}`
|
|
16275
16273
|
* })
|
|
16276
16274
|
*
|
|
@@ -16290,7 +16288,7 @@ export const runPromiseExit: <A, E>(
|
|
|
16290
16288
|
* @category Running Effects
|
|
16291
16289
|
*/
|
|
16292
16290
|
export const runPromiseExitWith: <R>(
|
|
16293
|
-
|
|
16291
|
+
context: Context.Context<R>
|
|
16294
16292
|
) => <A, E>(effect: Effect<A, E, R>, options?: RunOptions | undefined) => Promise<Exit.Exit<A, E>> =
|
|
16295
16293
|
internal.runPromiseExitWith
|
|
16296
16294
|
|
|
@@ -16358,15 +16356,15 @@ export const runSync: <A, E>(effect: Effect<A, E>) => A = internal.runSync
|
|
|
16358
16356
|
*
|
|
16359
16357
|
* @example
|
|
16360
16358
|
* ```ts
|
|
16361
|
-
* import { Effect,
|
|
16359
|
+
* import { Effect, Context } from "effect"
|
|
16362
16360
|
*
|
|
16363
16361
|
* interface MathService {
|
|
16364
16362
|
* add: (a: number, b: number) => number
|
|
16365
16363
|
* }
|
|
16366
16364
|
*
|
|
16367
|
-
* const MathService =
|
|
16365
|
+
* const MathService = Context.Service<MathService>("MathService")
|
|
16368
16366
|
*
|
|
16369
|
-
* const
|
|
16367
|
+
* const context = Context.make(MathService, {
|
|
16370
16368
|
* add: (a, b) => a + b
|
|
16371
16369
|
* })
|
|
16372
16370
|
*
|
|
@@ -16375,7 +16373,7 @@ export const runSync: <A, E>(effect: Effect<A, E>) => A = internal.runSync
|
|
|
16375
16373
|
* return math.add(2, 3)
|
|
16376
16374
|
* })
|
|
16377
16375
|
*
|
|
16378
|
-
* const result = Effect.runSyncWith(
|
|
16376
|
+
* const result = Effect.runSyncWith(context)(program)
|
|
16379
16377
|
* console.log(result) // 5
|
|
16380
16378
|
* ```
|
|
16381
16379
|
*
|
|
@@ -16383,7 +16381,7 @@ export const runSync: <A, E>(effect: Effect<A, E>) => A = internal.runSync
|
|
|
16383
16381
|
* @category Running Effects
|
|
16384
16382
|
*/
|
|
16385
16383
|
export const runSyncWith: <R>(
|
|
16386
|
-
|
|
16384
|
+
context: Context.Context<R>
|
|
16387
16385
|
) => <A, E>(effect: Effect<A, E, R>) => A = internal.runSyncWith
|
|
16388
16386
|
|
|
16389
16387
|
/**
|
|
@@ -16462,10 +16460,10 @@ export const runSyncExit: <A, E>(effect: Effect<A, E>) => Exit.Exit<A, E> = inte
|
|
|
16462
16460
|
*
|
|
16463
16461
|
* @example
|
|
16464
16462
|
* ```ts
|
|
16465
|
-
* import { Effect, Exit,
|
|
16463
|
+
* import { Effect, Exit, Context } from "effect"
|
|
16466
16464
|
*
|
|
16467
16465
|
* // Define a logger service
|
|
16468
|
-
* const Logger =
|
|
16466
|
+
* const Logger = Context.Service<{
|
|
16469
16467
|
* log: (msg: string) => void
|
|
16470
16468
|
* }>("Logger")
|
|
16471
16469
|
*
|
|
@@ -16475,12 +16473,12 @@ export const runSyncExit: <A, E>(effect: Effect<A, E>) => Exit.Exit<A, E> = inte
|
|
|
16475
16473
|
* return 42
|
|
16476
16474
|
* })
|
|
16477
16475
|
*
|
|
16478
|
-
* // Prepare
|
|
16479
|
-
* const
|
|
16476
|
+
* // Prepare context
|
|
16477
|
+
* const context = Context.make(Logger, {
|
|
16480
16478
|
* log: (msg) => console.log(`[LOG] ${msg}`)
|
|
16481
16479
|
* })
|
|
16482
16480
|
*
|
|
16483
|
-
* const exit = Effect.runSyncExitWith(
|
|
16481
|
+
* const exit = Effect.runSyncExitWith(context)(program)
|
|
16484
16482
|
*
|
|
16485
16483
|
* if (Exit.isSuccess(exit)) {
|
|
16486
16484
|
* console.log(`Success: ${exit.value}`)
|
|
@@ -16496,7 +16494,7 @@ export const runSyncExit: <A, E>(effect: Effect<A, E>) => Exit.Exit<A, E> = inte
|
|
|
16496
16494
|
* @category Running Effects
|
|
16497
16495
|
*/
|
|
16498
16496
|
export const runSyncExitWith: <R>(
|
|
16499
|
-
|
|
16497
|
+
context: Context.Context<R>
|
|
16500
16498
|
) => <A, E>(effect: Effect<A, E, R>) => Exit.Exit<A, E> = internal.runSyncExitWith
|
|
16501
16499
|
|
|
16502
16500
|
// -----------------------------------------------------------------------------
|
|
@@ -22590,7 +22588,7 @@ export const trackDuration: {
|
|
|
22590
22588
|
* @since 4.0.0
|
|
22591
22589
|
* @category Transactions
|
|
22592
22590
|
*/
|
|
22593
|
-
export class Transaction extends
|
|
22591
|
+
export class Transaction extends Context.Service<
|
|
22594
22592
|
Transaction,
|
|
22595
22593
|
{
|
|
22596
22594
|
retry: boolean
|
|
@@ -22650,7 +22648,7 @@ export const tx = <A, E, R>(
|
|
|
22650
22648
|
effect: Effect<A, E, R>
|
|
22651
22649
|
): Effect<A, E, Exclude<R, Transaction>> =>
|
|
22652
22650
|
withFiber((fiber) => {
|
|
22653
|
-
if (fiber.
|
|
22651
|
+
if (fiber.context.mapUnsafe.has(Transaction.key)) {
|
|
22654
22652
|
return effect as Effect<A, E, Exclude<R, Transaction>>
|
|
22655
22653
|
}
|
|
22656
22654
|
// Create transaction state only at the outermost boundary
|