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/dist/Layer.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as Context from "./Context.js";
|
|
1
2
|
import * as Deferred from "./Deferred.js";
|
|
2
3
|
import { constant, constTrue, constUndefined, dual, identity } from "./Function.js";
|
|
3
4
|
import * as core from "./internal/core.js";
|
|
@@ -7,7 +8,6 @@ import { pipeArguments } from "./Pipeable.js";
|
|
|
7
8
|
import { hasProperty } from "./Predicate.js";
|
|
8
9
|
import { CurrentStackFrame } from "./References.js";
|
|
9
10
|
import * as Scope from "./Scope.js";
|
|
10
|
-
import * as ServiceMap from "./ServiceMap.js";
|
|
11
11
|
import * as Tracer from "./Tracer.js";
|
|
12
12
|
const TypeId = "~effect/Layer";
|
|
13
13
|
const MemoMapTypeId = "~effect/Layer/MemoMap";
|
|
@@ -16,9 +16,9 @@ const MemoMapTypeId = "~effect/Layer/MemoMap";
|
|
|
16
16
|
*
|
|
17
17
|
* @example
|
|
18
18
|
* ```ts
|
|
19
|
-
* import { Effect, Layer,
|
|
19
|
+
* import { Effect, Layer, Context } from "effect"
|
|
20
20
|
*
|
|
21
|
-
* class Database extends
|
|
21
|
+
* class Database extends Context.Service<Database, {
|
|
22
22
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
23
23
|
* }>()("Database") {}
|
|
24
24
|
*
|
|
@@ -58,15 +58,15 @@ const fromBuildUnsafe = build => {
|
|
|
58
58
|
*
|
|
59
59
|
* @example
|
|
60
60
|
* ```ts
|
|
61
|
-
* import { Effect, Layer,
|
|
61
|
+
* import { Effect, Layer, Context } from "effect"
|
|
62
62
|
*
|
|
63
|
-
* class Database extends
|
|
63
|
+
* class Database extends Context.Service<Database, {
|
|
64
64
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
65
65
|
* }>()("Database") {}
|
|
66
66
|
*
|
|
67
67
|
* const databaseLayer = Layer.fromBuild(() =>
|
|
68
68
|
* Effect.sync(() =>
|
|
69
|
-
*
|
|
69
|
+
* Context.make(Database, {
|
|
70
70
|
* query: (sql: string) => Effect.succeed("result")
|
|
71
71
|
* })
|
|
72
72
|
* )
|
|
@@ -89,15 +89,15 @@ export const fromBuild = build => fromBuildUnsafe((memoMap, scope) => {
|
|
|
89
89
|
*
|
|
90
90
|
* @example
|
|
91
91
|
* ```ts
|
|
92
|
-
* import { Effect, Layer,
|
|
92
|
+
* import { Effect, Layer, Context } from "effect"
|
|
93
93
|
*
|
|
94
|
-
* class Database extends
|
|
94
|
+
* class Database extends Context.Service<Database, {
|
|
95
95
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
96
96
|
* }>()("Database") {}
|
|
97
97
|
*
|
|
98
98
|
* const databaseLayer = Layer.fromBuildMemo(() =>
|
|
99
99
|
* Effect.sync(() =>
|
|
100
|
-
*
|
|
100
|
+
* Context.make(Database, {
|
|
101
101
|
* query: (sql: string) => Effect.succeed("result")
|
|
102
102
|
* })
|
|
103
103
|
* )
|
|
@@ -148,9 +148,9 @@ class MemoMapImpl {
|
|
|
148
148
|
*
|
|
149
149
|
* @example
|
|
150
150
|
* ```ts
|
|
151
|
-
* import { Effect, Layer,
|
|
151
|
+
* import { Effect, Layer, Context } from "effect"
|
|
152
152
|
*
|
|
153
|
-
* class Database extends
|
|
153
|
+
* class Database extends Context.Service<Database, {
|
|
154
154
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
155
155
|
* }>()("Database") {}
|
|
156
156
|
*
|
|
@@ -162,9 +162,9 @@ class MemoMapImpl {
|
|
|
162
162
|
* const dbLayer = Layer.succeed(Database)({
|
|
163
163
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
|
|
164
164
|
* })
|
|
165
|
-
* const
|
|
165
|
+
* const context = yield* Layer.buildWithMemoMap(dbLayer, memoMap, scope)
|
|
166
166
|
*
|
|
167
|
-
* return
|
|
167
|
+
* return Context.get(context, Database)
|
|
168
168
|
* })
|
|
169
169
|
* ```
|
|
170
170
|
*
|
|
@@ -177,9 +177,9 @@ export const makeMemoMapUnsafe = () => new MemoMapImpl();
|
|
|
177
177
|
*
|
|
178
178
|
* @example
|
|
179
179
|
* ```ts
|
|
180
|
-
* import { Effect, Layer,
|
|
180
|
+
* import { Effect, Layer, Context } from "effect"
|
|
181
181
|
*
|
|
182
|
-
* class Database extends
|
|
182
|
+
* class Database extends Context.Service<Database, {
|
|
183
183
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
184
184
|
* }>()("Database") {}
|
|
185
185
|
*
|
|
@@ -191,9 +191,9 @@ export const makeMemoMapUnsafe = () => new MemoMapImpl();
|
|
|
191
191
|
* const dbLayer = Layer.succeed(Database)({
|
|
192
192
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
|
|
193
193
|
* })
|
|
194
|
-
* const
|
|
194
|
+
* const context = yield* Layer.buildWithMemoMap(dbLayer, memoMap, scope)
|
|
195
195
|
*
|
|
196
|
-
* return
|
|
196
|
+
* return Context.get(context, Database)
|
|
197
197
|
* })
|
|
198
198
|
* ```
|
|
199
199
|
*
|
|
@@ -210,8 +210,8 @@ export const makeMemoMap = /*#__PURE__*/internalEffect.sync(makeMemoMapUnsafe);
|
|
|
210
210
|
* @since 3.13.0
|
|
211
211
|
* @category models
|
|
212
212
|
*/
|
|
213
|
-
export class CurrentMemoMap extends /*#__PURE__*/
|
|
214
|
-
static getOrCreate = /*#__PURE__*/
|
|
213
|
+
export class CurrentMemoMap extends /*#__PURE__*/Context.Service()("effect/Layer/CurrentMemoMap") {
|
|
214
|
+
static getOrCreate = /*#__PURE__*/Context.getOrElse(this, makeMemoMapUnsafe);
|
|
215
215
|
}
|
|
216
216
|
/**
|
|
217
217
|
* Builds a layer into an `Effect` value, using the specified `MemoMap` to memoize
|
|
@@ -219,13 +219,13 @@ export class CurrentMemoMap extends /*#__PURE__*/ServiceMap.Service()("effect/La
|
|
|
219
219
|
*
|
|
220
220
|
* @example
|
|
221
221
|
* ```ts
|
|
222
|
-
* import { Effect, Layer,
|
|
222
|
+
* import { Effect, Layer, Context } from "effect"
|
|
223
223
|
*
|
|
224
|
-
* class Database extends
|
|
224
|
+
* class Database extends Context.Service<Database, {
|
|
225
225
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
226
226
|
* }>()("Database") {}
|
|
227
227
|
*
|
|
228
|
-
* class Logger extends
|
|
228
|
+
* class Logger extends Context.Service<Logger, {
|
|
229
229
|
* readonly log: (msg: string) => Effect.Effect<void>
|
|
230
230
|
* }>()("Logger") {}
|
|
231
231
|
*
|
|
@@ -238,21 +238,21 @@ export class CurrentMemoMap extends /*#__PURE__*/ServiceMap.Service()("effect/La
|
|
|
238
238
|
* const dbLayer = Layer.succeed(Database)({
|
|
239
239
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
|
|
240
240
|
* })
|
|
241
|
-
* const
|
|
241
|
+
* const dbContext = yield* Layer.buildWithMemoMap(dbLayer, memoMap, scope)
|
|
242
242
|
*
|
|
243
243
|
* // Build logger layer with same memoization (reuses memo if same layer)
|
|
244
244
|
* const loggerLayer = Layer.succeed(Logger)({
|
|
245
245
|
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(msg)))
|
|
246
246
|
* })
|
|
247
|
-
* const
|
|
247
|
+
* const loggerContext = yield* Layer.buildWithMemoMap(
|
|
248
248
|
* loggerLayer,
|
|
249
249
|
* memoMap,
|
|
250
250
|
* scope
|
|
251
251
|
* )
|
|
252
252
|
*
|
|
253
253
|
* return {
|
|
254
|
-
* database:
|
|
255
|
-
* logger:
|
|
254
|
+
* database: Context.get(dbContext, Database),
|
|
255
|
+
* logger: Context.get(loggerContext, Logger)
|
|
256
256
|
* }
|
|
257
257
|
* })
|
|
258
258
|
* ```
|
|
@@ -260,15 +260,15 @@ export class CurrentMemoMap extends /*#__PURE__*/ServiceMap.Service()("effect/La
|
|
|
260
260
|
* @since 2.0.0
|
|
261
261
|
* @category memo map
|
|
262
262
|
*/
|
|
263
|
-
export const buildWithMemoMap = /*#__PURE__*/dual(3, (self, memoMap, scope) => internalEffect.provideService(internalEffect.map(self.build(memoMap, scope),
|
|
263
|
+
export const buildWithMemoMap = /*#__PURE__*/dual(3, (self, memoMap, scope) => internalEffect.provideService(internalEffect.map(self.build(memoMap, scope), Context.add(CurrentMemoMap, memoMap)), CurrentMemoMap, memoMap));
|
|
264
264
|
/**
|
|
265
265
|
* Builds a layer into a scoped value.
|
|
266
266
|
*
|
|
267
267
|
* @example
|
|
268
268
|
* ```ts
|
|
269
|
-
* import { Effect, Layer,
|
|
269
|
+
* import { Effect, Layer, Context } from "effect"
|
|
270
270
|
*
|
|
271
|
-
* class Database extends
|
|
271
|
+
* class Database extends Context.Service<Database, {
|
|
272
272
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
273
273
|
* }>()("Database") {}
|
|
274
274
|
*
|
|
@@ -278,11 +278,11 @@ export const buildWithMemoMap = /*#__PURE__*/dual(3, (self, memoMap, scope) => i
|
|
|
278
278
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
|
|
279
279
|
* })
|
|
280
280
|
*
|
|
281
|
-
* // Build the layer into
|
|
282
|
-
* const
|
|
281
|
+
* // Build the layer into Context - automatically manages scope and memoization
|
|
282
|
+
* const context = yield* Layer.build(dbLayer)
|
|
283
283
|
*
|
|
284
284
|
* // Extract the specific service from the built layer
|
|
285
|
-
* const database =
|
|
285
|
+
* const database = Context.get(context, Database)
|
|
286
286
|
*
|
|
287
287
|
* return yield* database.query("SELECT * FROM users")
|
|
288
288
|
* })
|
|
@@ -291,7 +291,7 @@ export const buildWithMemoMap = /*#__PURE__*/dual(3, (self, memoMap, scope) => i
|
|
|
291
291
|
* @since 2.0.0
|
|
292
292
|
* @category destructors
|
|
293
293
|
*/
|
|
294
|
-
export const build = self => core.withFiber(fiber => buildWithMemoMap(self, CurrentMemoMap.getOrCreate(fiber.
|
|
294
|
+
export const build = self => core.withFiber(fiber => buildWithMemoMap(self, CurrentMemoMap.getOrCreate(fiber.context), Context.getUnsafe(fiber.context, Scope.Scope)));
|
|
295
295
|
/**
|
|
296
296
|
* Builds a layer into an `Effect` value. Any resources associated with this
|
|
297
297
|
* layer will be released when the specified scope is closed unless their scope
|
|
@@ -301,9 +301,9 @@ export const build = self => core.withFiber(fiber => buildWithMemoMap(self, Curr
|
|
|
301
301
|
*
|
|
302
302
|
* @example
|
|
303
303
|
* ```ts
|
|
304
|
-
* import { Effect, Layer, Scope,
|
|
304
|
+
* import { Effect, Layer, Scope, Context } from "effect"
|
|
305
305
|
*
|
|
306
|
-
* class Database extends
|
|
306
|
+
* class Database extends Context.Service<Database, {
|
|
307
307
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
308
308
|
* }>()("Database") {}
|
|
309
309
|
*
|
|
@@ -321,8 +321,8 @@ export const build = self => core.withFiber(fiber => buildWithMemoMap(self, Curr
|
|
|
321
321
|
* }))
|
|
322
322
|
*
|
|
323
323
|
* // Build with specific scope - resources tied to this scope
|
|
324
|
-
* const
|
|
325
|
-
* const database =
|
|
324
|
+
* const context = yield* Layer.buildWithScope(dbLayer, scope)
|
|
325
|
+
* const database = Context.get(context, Database)
|
|
326
326
|
*
|
|
327
327
|
* return yield* database.query("SELECT * FROM users")
|
|
328
328
|
* // Database will be closed when scope is closed
|
|
@@ -332,19 +332,19 @@ export const build = self => core.withFiber(fiber => buildWithMemoMap(self, Curr
|
|
|
332
332
|
* @since 2.0.0
|
|
333
333
|
* @category destructors
|
|
334
334
|
*/
|
|
335
|
-
export const buildWithScope = /*#__PURE__*/dual(2, (self, scope) => core.withFiber(fiber => buildWithMemoMap(self, CurrentMemoMap.getOrCreate(fiber.
|
|
335
|
+
export const buildWithScope = /*#__PURE__*/dual(2, (self, scope) => core.withFiber(fiber => buildWithMemoMap(self, CurrentMemoMap.getOrCreate(fiber.context), scope)));
|
|
336
336
|
/**
|
|
337
337
|
* Constructs a layer from the specified value.
|
|
338
338
|
*
|
|
339
339
|
* @example
|
|
340
340
|
* ```ts
|
|
341
|
-
* import { Effect, Layer,
|
|
341
|
+
* import { Effect, Layer, Context } from "effect"
|
|
342
342
|
*
|
|
343
|
-
* class Database extends
|
|
343
|
+
* class Database extends Context.Service<Database, {
|
|
344
344
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
345
345
|
* }>()("Database") {}
|
|
346
346
|
*
|
|
347
|
-
* class Logger extends
|
|
347
|
+
* class Logger extends Context.Service<Logger, {
|
|
348
348
|
* readonly log: (msg: string) => Effect.Effect<void>
|
|
349
349
|
* }>()("Logger") {}
|
|
350
350
|
*
|
|
@@ -377,47 +377,46 @@ export const buildWithScope = /*#__PURE__*/dual(2, (self, scope) => core.withFib
|
|
|
377
377
|
*/
|
|
378
378
|
export const succeed = function () {
|
|
379
379
|
if (arguments.length === 1) {
|
|
380
|
-
return resource =>
|
|
380
|
+
return resource => succeedContext(Context.make(arguments[0], resource));
|
|
381
381
|
}
|
|
382
|
-
return
|
|
382
|
+
return succeedContext(Context.make(arguments[0], arguments[1]));
|
|
383
383
|
};
|
|
384
384
|
/**
|
|
385
385
|
* Constructs a layer from the specified value, which must return one or more
|
|
386
386
|
* services.
|
|
387
387
|
*
|
|
388
388
|
* This is a more general version of `succeed` that allows you to provide multiple
|
|
389
|
-
* services at once through a `
|
|
389
|
+
* services at once through a `Context`.
|
|
390
390
|
*
|
|
391
391
|
* @example
|
|
392
392
|
* ```ts
|
|
393
|
-
* import { Effect, Layer,
|
|
393
|
+
* import { Effect, Layer, Context } from "effect"
|
|
394
394
|
*
|
|
395
|
-
* class Database extends
|
|
395
|
+
* class Database extends Context.Service<Database, {
|
|
396
396
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
397
397
|
* }>()("Database") {}
|
|
398
398
|
*
|
|
399
|
-
* class Logger extends
|
|
399
|
+
* class Logger extends Context.Service<Logger, {
|
|
400
400
|
* readonly log: (msg: string) => Effect.Effect<void>
|
|
401
401
|
* }>()("Logger") {}
|
|
402
402
|
*
|
|
403
|
-
* const
|
|
403
|
+
* const context = Context.make(Database, {
|
|
404
404
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
|
|
405
|
-
* })
|
|
406
|
-
* .
|
|
407
|
-
*
|
|
408
|
-
*
|
|
409
|
-
*
|
|
410
|
-
* )
|
|
405
|
+
* }).pipe(
|
|
406
|
+
* Context.add(Logger, {
|
|
407
|
+
* log: (msg: string) => Effect.sync(() => console.log(msg))
|
|
408
|
+
* })
|
|
409
|
+
* )
|
|
411
410
|
*
|
|
412
|
-
* const layer = Layer.
|
|
411
|
+
* const layer = Layer.succeedContext(context)
|
|
413
412
|
* ```
|
|
414
413
|
*
|
|
415
414
|
* @since 2.0.0
|
|
416
415
|
* @category constructors
|
|
417
416
|
*/
|
|
418
|
-
export const
|
|
417
|
+
export const succeedContext = context => fromBuildUnsafe(constant(internalEffect.succeed(context)));
|
|
419
418
|
/**
|
|
420
|
-
* A Layer that constructs an empty
|
|
419
|
+
* A Layer that constructs an empty Context.
|
|
421
420
|
*
|
|
422
421
|
* This layer provides no services and can be used as a neutral element
|
|
423
422
|
* in layer composition or as a starting point for building layers.
|
|
@@ -432,7 +431,7 @@ export const succeedServices = services => fromBuildUnsafe(constant(internalEffe
|
|
|
432
431
|
* @since 2.0.0
|
|
433
432
|
* @category constructors
|
|
434
433
|
*/
|
|
435
|
-
export const empty = /*#__PURE__*/
|
|
434
|
+
export const empty = /*#__PURE__*/succeedContext(/*#__PURE__*/Context.empty());
|
|
436
435
|
/**
|
|
437
436
|
* Lazily constructs a layer from the specified value.
|
|
438
437
|
*
|
|
@@ -441,9 +440,9 @@ export const empty = /*#__PURE__*/succeedServices(/*#__PURE__*/ServiceMap.empty(
|
|
|
441
440
|
*
|
|
442
441
|
* @example
|
|
443
442
|
* ```ts
|
|
444
|
-
* import { Effect, Layer,
|
|
443
|
+
* import { Effect, Layer, Context } from "effect"
|
|
445
444
|
*
|
|
446
|
-
* class Database extends
|
|
445
|
+
* class Database extends Context.Service<Database, {
|
|
447
446
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
448
447
|
* }>()("Database") {}
|
|
449
448
|
*
|
|
@@ -457,27 +456,27 @@ export const empty = /*#__PURE__*/succeedServices(/*#__PURE__*/ServiceMap.empty(
|
|
|
457
456
|
*/
|
|
458
457
|
export const sync = function () {
|
|
459
458
|
if (arguments.length === 1) {
|
|
460
|
-
return evaluate =>
|
|
459
|
+
return evaluate => syncContext(() => Context.make(arguments[0], evaluate()));
|
|
461
460
|
}
|
|
462
|
-
return
|
|
461
|
+
return syncContext(() => Context.make(arguments[0], arguments[1]()));
|
|
463
462
|
};
|
|
464
463
|
/**
|
|
465
464
|
* Lazily constructs a layer from the specified value, which must return one or more
|
|
466
465
|
* services.
|
|
467
466
|
*
|
|
468
|
-
* This is a lazy version of `
|
|
467
|
+
* This is a lazy version of `succeedContext` where the Context is computed
|
|
469
468
|
* synchronously only when the layer is built.
|
|
470
469
|
*
|
|
471
470
|
* @example
|
|
472
471
|
* ```ts
|
|
473
|
-
* import { Effect, Layer,
|
|
472
|
+
* import { Effect, Layer, Context } from "effect"
|
|
474
473
|
*
|
|
475
|
-
* class Database extends
|
|
474
|
+
* class Database extends Context.Service<Database, {
|
|
476
475
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
477
476
|
* }>()("Database") {}
|
|
478
477
|
*
|
|
479
|
-
* const layer = Layer.
|
|
480
|
-
*
|
|
478
|
+
* const layer = Layer.syncContext(() =>
|
|
479
|
+
* Context.make(Database, {
|
|
481
480
|
* query: (sql: string) => Effect.succeed(`Query: ${sql}`)
|
|
482
481
|
* })
|
|
483
482
|
* )
|
|
@@ -486,7 +485,7 @@ export const sync = function () {
|
|
|
486
485
|
* @since 2.0.0
|
|
487
486
|
* @category constructors
|
|
488
487
|
*/
|
|
489
|
-
export const
|
|
488
|
+
export const syncContext = evaluate => fromBuildMemo(constant(internalEffect.sync(evaluate)));
|
|
490
489
|
/**
|
|
491
490
|
* Constructs a layer from the specified scoped effect.
|
|
492
491
|
*
|
|
@@ -502,9 +501,9 @@ export const syncServices = evaluate => fromBuildMemo(constant(internalEffect.sy
|
|
|
502
501
|
*
|
|
503
502
|
* @example
|
|
504
503
|
* ```ts
|
|
505
|
-
* import { Effect, Layer,
|
|
504
|
+
* import { Effect, Layer, Context } from "effect"
|
|
506
505
|
*
|
|
507
|
-
* class Database extends
|
|
506
|
+
* class Database extends Context.Service<Database, {
|
|
508
507
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
509
508
|
* }>()("Database") {}
|
|
510
509
|
*
|
|
@@ -524,7 +523,7 @@ export const effect = function () {
|
|
|
524
523
|
}
|
|
525
524
|
return effectImpl(arguments[0], arguments[1]);
|
|
526
525
|
};
|
|
527
|
-
const effectImpl = (service, effect) =>
|
|
526
|
+
const effectImpl = (service, effect) => effectContext(internalEffect.map(effect, value => Context.make(service, value)));
|
|
528
527
|
/**
|
|
529
528
|
* Constructs a layer from the specified scoped effect, which must return one
|
|
530
529
|
* or more services.
|
|
@@ -534,15 +533,15 @@ const effectImpl = (service, effect) => effectServices(internalEffect.map(effect
|
|
|
534
533
|
*
|
|
535
534
|
* @example
|
|
536
535
|
* ```ts
|
|
537
|
-
* import { Effect, Layer,
|
|
536
|
+
* import { Effect, Layer, Context } from "effect"
|
|
538
537
|
*
|
|
539
|
-
* class Database extends
|
|
538
|
+
* class Database extends Context.Service<
|
|
540
539
|
* Database,
|
|
541
540
|
* { readonly query: (sql: string) => Effect.Effect<string> }
|
|
542
541
|
* >()("Database") {}
|
|
543
542
|
*
|
|
544
|
-
* const layer = Layer.
|
|
545
|
-
* Effect.succeed(
|
|
543
|
+
* const layer = Layer.effectContext(
|
|
544
|
+
* Effect.succeed(Context.make(Database, {
|
|
546
545
|
* query: (sql: string) => Effect.succeed(`Query: ${sql}`)
|
|
547
546
|
* }))
|
|
548
547
|
* )
|
|
@@ -551,7 +550,7 @@ const effectImpl = (service, effect) => effectServices(internalEffect.map(effect
|
|
|
551
550
|
* @since 2.0.0
|
|
552
551
|
* @category constructors
|
|
553
552
|
*/
|
|
554
|
-
export const
|
|
553
|
+
export const effectContext = effect => fromBuildMemo((_, scope) => Scope.provide(effect, scope));
|
|
555
554
|
/**
|
|
556
555
|
* Constructs a layer from the specified scoped effect.
|
|
557
556
|
*
|
|
@@ -578,7 +577,32 @@ export const effectServices = effect => fromBuildMemo((_, scope) => Scope.provid
|
|
|
578
577
|
* @since 2.0.0
|
|
579
578
|
* @category constructors
|
|
580
579
|
*/
|
|
581
|
-
export const effectDiscard = effect =>
|
|
580
|
+
export const effectDiscard = effect => effectContext(internalEffect.as(effect, Context.empty()));
|
|
581
|
+
/**
|
|
582
|
+
* Lazily constructs a layer using the specified factory.
|
|
583
|
+
*
|
|
584
|
+
* The factory is evaluated only when the suspended layer is first built, and
|
|
585
|
+
* the result is memoized with normal layer sharing semantics.
|
|
586
|
+
*
|
|
587
|
+
* @example
|
|
588
|
+
* ```ts
|
|
589
|
+
* import { Layer, Context } from "effect"
|
|
590
|
+
*
|
|
591
|
+
* class Config extends Context.Service<Config, string>()("Config") {}
|
|
592
|
+
*
|
|
593
|
+
* const useProd = true
|
|
594
|
+
*
|
|
595
|
+
* const layer = Layer.suspend(() =>
|
|
596
|
+
* useProd
|
|
597
|
+
* ? Layer.succeed(Config)("https://api.example.com")
|
|
598
|
+
* : Layer.succeed(Config)("http://localhost:3000")
|
|
599
|
+
* )
|
|
600
|
+
* ```
|
|
601
|
+
*
|
|
602
|
+
* @since 4.0.0
|
|
603
|
+
* @category constructors
|
|
604
|
+
*/
|
|
605
|
+
export const suspend = evaluate => fromBuildMemo((memoMap, scope) => internalEffect.suspend(() => evaluate().build(memoMap, scope)));
|
|
582
606
|
/**
|
|
583
607
|
* Unwraps a Layer from an Effect, flattening the nested structure.
|
|
584
608
|
*
|
|
@@ -588,9 +612,9 @@ export const effectDiscard = effect => effectServices(internalEffect.as(effect,
|
|
|
588
612
|
*
|
|
589
613
|
* @example
|
|
590
614
|
* ```ts
|
|
591
|
-
* import { Effect, Layer,
|
|
615
|
+
* import { Effect, Layer, Context } from "effect"
|
|
592
616
|
*
|
|
593
|
-
* class Database extends
|
|
617
|
+
* class Database extends Context.Service<Database, {
|
|
594
618
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
595
619
|
* }>()("Database") {}
|
|
596
620
|
*
|
|
@@ -605,14 +629,14 @@ export const effectDiscard = effect => effectServices(internalEffect.as(effect,
|
|
|
605
629
|
* @category utils
|
|
606
630
|
*/
|
|
607
631
|
export const unwrap = self => {
|
|
608
|
-
const service =
|
|
609
|
-
return flatMap(effect(service)(self),
|
|
632
|
+
const service = Context.Service("effect/Layer/unwrap");
|
|
633
|
+
return flatMap(effect(service)(self), Context.get(service));
|
|
610
634
|
};
|
|
611
635
|
const mergeAllEffect = (layers, memoMap, scope) => {
|
|
612
636
|
const parentScope = Scope.forkUnsafe(scope, "parallel");
|
|
613
637
|
return internalEffect.forEach(layers, layer => layer.build(memoMap, Scope.forkUnsafe(parentScope, "sequential")), {
|
|
614
638
|
concurrency: layers.length
|
|
615
|
-
}).pipe(internalEffect.map(
|
|
639
|
+
}).pipe(internalEffect.map(context => Context.mergeAll(...context)));
|
|
616
640
|
};
|
|
617
641
|
/**
|
|
618
642
|
* Combines all the provided layers concurrently, creating a new layer with merged input, error, and output types.
|
|
@@ -622,13 +646,13 @@ const mergeAllEffect = (layers, memoMap, scope) => {
|
|
|
622
646
|
*
|
|
623
647
|
* @example
|
|
624
648
|
* ```ts
|
|
625
|
-
* import { Effect, Layer,
|
|
649
|
+
* import { Effect, Layer, Context } from "effect"
|
|
626
650
|
*
|
|
627
|
-
* class Database extends
|
|
651
|
+
* class Database extends Context.Service<Database, {
|
|
628
652
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
629
653
|
* }>()("Database") {}
|
|
630
654
|
*
|
|
631
|
-
* class Logger extends
|
|
655
|
+
* class Logger extends Context.Service<Logger, {
|
|
632
656
|
* readonly log: (msg: string) => Effect.Effect<void>
|
|
633
657
|
* }>()("Logger") {}
|
|
634
658
|
*
|
|
@@ -654,13 +678,13 @@ export const mergeAll = (...layers) => fromBuild((memoMap, scope) => mergeAllEff
|
|
|
654
678
|
*
|
|
655
679
|
* @example
|
|
656
680
|
* ```ts
|
|
657
|
-
* import { Effect, Layer,
|
|
681
|
+
* import { Effect, Layer, Context } from "effect"
|
|
658
682
|
*
|
|
659
|
-
* class Database extends
|
|
683
|
+
* class Database extends Context.Service<Database, {
|
|
660
684
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
661
685
|
* }>()("Database") {}
|
|
662
686
|
*
|
|
663
|
-
* class Logger extends
|
|
687
|
+
* class Logger extends Context.Service<Logger, {
|
|
664
688
|
* readonly log: (msg: string) => Effect.Effect<void>
|
|
665
689
|
* }>()("Logger") {}
|
|
666
690
|
*
|
|
@@ -678,7 +702,7 @@ export const mergeAll = (...layers) => fromBuild((memoMap, scope) => mergeAllEff
|
|
|
678
702
|
* @category zipping
|
|
679
703
|
*/
|
|
680
704
|
export const merge = /*#__PURE__*/dual(2, (self, that) => mergeAll(self, ...(Array.isArray(that) ? that : [that])));
|
|
681
|
-
const provideWith = (self, that, f) => fromBuild((memoMap, scope) => internalEffect.flatMap(Array.isArray(that) ? mergeAllEffect(that, memoMap, scope) : that.build(memoMap, scope), context => self.build(memoMap, scope).pipe(internalEffect.
|
|
705
|
+
const provideWith = (self, that, f) => fromBuild((memoMap, scope) => internalEffect.flatMap(Array.isArray(that) ? mergeAllEffect(that, memoMap, scope) : that.build(memoMap, scope), context => self.build(memoMap, scope).pipe(internalEffect.provideContext(context), internalEffect.map(merged => f(merged, context)))));
|
|
682
706
|
/**
|
|
683
707
|
* Feeds the output services of this builder into the input of the specified
|
|
684
708
|
* builder, resulting in a new builder with the inputs of this builder as
|
|
@@ -686,20 +710,20 @@ const provideWith = (self, that, f) => fromBuild((memoMap, scope) => internalEff
|
|
|
686
710
|
*
|
|
687
711
|
* @example
|
|
688
712
|
* ```ts
|
|
689
|
-
* import { Effect, Layer,
|
|
713
|
+
* import { Effect, Layer, Context } from "effect"
|
|
690
714
|
*
|
|
691
|
-
* class Database extends
|
|
715
|
+
* class Database extends Context.Service<Database, {
|
|
692
716
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
693
717
|
* }>()("Database") {}
|
|
694
718
|
*
|
|
695
|
-
* class UserService extends
|
|
719
|
+
* class UserService extends Context.Service<UserService, {
|
|
696
720
|
* readonly getUser: (id: string) => Effect.Effect<{
|
|
697
721
|
* id: string
|
|
698
722
|
* name: string
|
|
699
723
|
* }>
|
|
700
724
|
* }>()("UserService") {}
|
|
701
725
|
*
|
|
702
|
-
* class Logger extends
|
|
726
|
+
* class Logger extends Context.Service<Logger, {
|
|
703
727
|
* readonly log: (msg: string) => Effect.Effect<void>
|
|
704
728
|
* }>()("Logger") {}
|
|
705
729
|
*
|
|
@@ -753,17 +777,17 @@ export const provide = /*#__PURE__*/dual(2, (self, that) => provideWith(self, th
|
|
|
753
777
|
*
|
|
754
778
|
* @example
|
|
755
779
|
* ```ts
|
|
756
|
-
* import { Effect, Layer,
|
|
780
|
+
* import { Effect, Layer, Context } from "effect"
|
|
757
781
|
*
|
|
758
|
-
* class Database extends
|
|
782
|
+
* class Database extends Context.Service<Database, {
|
|
759
783
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
760
784
|
* }>()("Database") {}
|
|
761
785
|
*
|
|
762
|
-
* class Logger extends
|
|
786
|
+
* class Logger extends Context.Service<Logger, {
|
|
763
787
|
* readonly log: (msg: string) => Effect.Effect<void>
|
|
764
788
|
* }>()("Logger") {}
|
|
765
789
|
*
|
|
766
|
-
* class UserService extends
|
|
790
|
+
* class UserService extends Context.Service<UserService, {
|
|
767
791
|
* readonly getUser: (id: string) => Effect.Effect<{
|
|
768
792
|
* id: string
|
|
769
793
|
* name: string
|
|
@@ -818,24 +842,24 @@ export const provide = /*#__PURE__*/dual(2, (self, that) => provideWith(self, th
|
|
|
818
842
|
* @since 2.0.0
|
|
819
843
|
* @category utils
|
|
820
844
|
*/
|
|
821
|
-
export const provideMerge = /*#__PURE__*/dual(2, (self, that) => provideWith(self, that, (self, that) =>
|
|
845
|
+
export const provideMerge = /*#__PURE__*/dual(2, (self, that) => provideWith(self, that, (self, that) => Context.merge(that, self)));
|
|
822
846
|
/**
|
|
823
847
|
* Constructs a layer dynamically based on the output of this layer.
|
|
824
848
|
*
|
|
825
849
|
* @example
|
|
826
850
|
* ```ts
|
|
827
|
-
* import { Effect, Layer,
|
|
851
|
+
* import { Effect, Layer, Context } from "effect"
|
|
828
852
|
*
|
|
829
|
-
* class Config extends
|
|
853
|
+
* class Config extends Context.Service<Config, {
|
|
830
854
|
* readonly dbUrl: string
|
|
831
855
|
* readonly logLevel: string
|
|
832
856
|
* }>()("Config") {}
|
|
833
857
|
*
|
|
834
|
-
* class Database extends
|
|
858
|
+
* class Database extends Context.Service<Database, {
|
|
835
859
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
836
860
|
* }>()("Database") {}
|
|
837
861
|
*
|
|
838
|
-
* class Logger extends
|
|
862
|
+
* class Logger extends Context.Service<Logger, {
|
|
839
863
|
* readonly log: (msg: string) => Effect.Effect<void>
|
|
840
864
|
* }>()("Logger") {}
|
|
841
865
|
*
|
|
@@ -847,8 +871,8 @@ export const provideMerge = /*#__PURE__*/dual(2, (self, that) => provideWith(sel
|
|
|
847
871
|
*
|
|
848
872
|
* // Dynamically create services based on config
|
|
849
873
|
* const dynamicServiceLayer = configLayer.pipe(
|
|
850
|
-
* Layer.flatMap((
|
|
851
|
-
* const config =
|
|
874
|
+
* Layer.flatMap((context) => {
|
|
875
|
+
* const config = Context.get(context, Config)
|
|
852
876
|
*
|
|
853
877
|
* // Create database layer based on config
|
|
854
878
|
* const dbLayer = Layer.succeed(Database)({
|
|
@@ -923,13 +947,13 @@ export const tapCause = /*#__PURE__*/dual(2, (self, f) => fromBuild((memoMap, sc
|
|
|
923
947
|
*
|
|
924
948
|
* @example
|
|
925
949
|
* ```ts
|
|
926
|
-
* import { Data, Effect, Layer,
|
|
950
|
+
* import { Data, Effect, Layer, Context } from "effect"
|
|
927
951
|
*
|
|
928
952
|
* class DatabaseError extends Data.TaggedError("DatabaseError")<{
|
|
929
953
|
* message: string
|
|
930
954
|
* }> {}
|
|
931
955
|
*
|
|
932
|
-
* class Database extends
|
|
956
|
+
* class Database extends Context.Service<Database, {
|
|
933
957
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
934
958
|
* }>()("Database") {}
|
|
935
959
|
*
|
|
@@ -977,11 +1001,11 @@ catch_ as catch };
|
|
|
977
1001
|
*
|
|
978
1002
|
* @example
|
|
979
1003
|
* ```ts
|
|
980
|
-
* import { Data, Effect, Layer,
|
|
1004
|
+
* import { Data, Effect, Layer, Context } from "effect"
|
|
981
1005
|
*
|
|
982
1006
|
* class ConfigError extends Data.TaggedError("ConfigError") {}
|
|
983
1007
|
*
|
|
984
|
-
* class Config extends
|
|
1008
|
+
* class Config extends Context.Service<Config, {
|
|
985
1009
|
* readonly apiUrl: string
|
|
986
1010
|
* }>()("Config") {}
|
|
987
1011
|
*
|
|
@@ -1003,7 +1027,7 @@ export const catchTag = /*#__PURE__*/dual(3, (self, k, f) => fromBuildUnsafe((me
|
|
|
1003
1027
|
*
|
|
1004
1028
|
* @example
|
|
1005
1029
|
* ```ts
|
|
1006
|
-
* import { Data, Effect, Layer,
|
|
1030
|
+
* import { Data, Effect, Layer, Context } from "effect"
|
|
1007
1031
|
*
|
|
1008
1032
|
* class DatabaseError extends Data.TaggedError("DatabaseError")<{
|
|
1009
1033
|
* message: string
|
|
@@ -1013,11 +1037,11 @@ export const catchTag = /*#__PURE__*/dual(3, (self, k, f) => fromBuildUnsafe((me
|
|
|
1013
1037
|
* reason: string
|
|
1014
1038
|
* }> {}
|
|
1015
1039
|
*
|
|
1016
|
-
* class Database extends
|
|
1040
|
+
* class Database extends Context.Service<Database, {
|
|
1017
1041
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
1018
1042
|
* }>()("Database") {}
|
|
1019
1043
|
*
|
|
1020
|
-
* class Logger extends
|
|
1044
|
+
* class Logger extends Context.Service<Logger, {
|
|
1021
1045
|
* readonly log: (msg: string) => Effect.Effect<void>
|
|
1022
1046
|
* }>()("Logger") {}
|
|
1023
1047
|
*
|
|
@@ -1080,9 +1104,9 @@ export const updateService = /*#__PURE__*/dual(3, (layer, service, f) => provide
|
|
|
1080
1104
|
*
|
|
1081
1105
|
* @example
|
|
1082
1106
|
* ```ts
|
|
1083
|
-
* import { Effect, Layer, Ref,
|
|
1107
|
+
* import { Effect, Layer, Ref, Context } from "effect"
|
|
1084
1108
|
*
|
|
1085
|
-
* class Counter extends
|
|
1109
|
+
* class Counter extends Context.Service<Counter, {
|
|
1086
1110
|
* readonly count: number
|
|
1087
1111
|
* readonly increment: () => Effect.Effect<number>
|
|
1088
1112
|
* }>()("Counter") {}
|
|
@@ -1133,14 +1157,14 @@ export const fresh = self => fromBuildUnsafe((_, scope) => self.build(makeMemoMa
|
|
|
1133
1157
|
*
|
|
1134
1158
|
* @example
|
|
1135
1159
|
* ```ts
|
|
1136
|
-
* import { Console, Effect, Layer,
|
|
1160
|
+
* import { Console, Effect, Layer, Context } from "effect"
|
|
1137
1161
|
*
|
|
1138
|
-
* class HttpServer extends
|
|
1162
|
+
* class HttpServer extends Context.Service<HttpServer, {
|
|
1139
1163
|
* readonly start: () => Effect.Effect<string>
|
|
1140
1164
|
* readonly stop: () => Effect.Effect<string>
|
|
1141
1165
|
* }>()("HttpServer") {}
|
|
1142
1166
|
*
|
|
1143
|
-
* class Logger extends
|
|
1167
|
+
* class Logger extends Context.Service<Logger, {
|
|
1144
1168
|
* readonly log: (msg: string) => Effect.Effect<void>
|
|
1145
1169
|
* }>()("Logger") {}
|
|
1146
1170
|
*
|
|
@@ -1189,9 +1213,9 @@ export const launch = self => internalEffect.scoped(internalEffect.andThen(build
|
|
|
1189
1213
|
*
|
|
1190
1214
|
* @example
|
|
1191
1215
|
* ```ts
|
|
1192
|
-
* import { Effect, Layer,
|
|
1216
|
+
* import { Effect, Layer, Context } from "effect"
|
|
1193
1217
|
*
|
|
1194
|
-
* class UserService extends
|
|
1218
|
+
* class UserService extends Context.Service<UserService, {
|
|
1195
1219
|
* readonly config: { apiUrl: string }
|
|
1196
1220
|
* readonly getUser: (
|
|
1197
1221
|
* id: string
|
|
@@ -1374,9 +1398,9 @@ export const satisfiesServicesType = () => layer => layer;
|
|
|
1374
1398
|
*
|
|
1375
1399
|
* @example
|
|
1376
1400
|
* ```ts
|
|
1377
|
-
* import { Console, Effect, Layer,
|
|
1401
|
+
* import { Console, Effect, Layer, Context, type Tracer } from "effect"
|
|
1378
1402
|
*
|
|
1379
|
-
* class Database extends
|
|
1403
|
+
* class Database extends Context.Service<Database, {
|
|
1380
1404
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
1381
1405
|
* }>()("Database") {}
|
|
1382
1406
|
*
|
|
@@ -1423,9 +1447,9 @@ export const span = (name, options) => {
|
|
|
1423
1447
|
*
|
|
1424
1448
|
* @example
|
|
1425
1449
|
* ```ts
|
|
1426
|
-
* import { Console, Effect, Layer,
|
|
1450
|
+
* import { Console, Effect, Layer, Context, Tracer } from "effect"
|
|
1427
1451
|
*
|
|
1428
|
-
* class Database extends
|
|
1452
|
+
* class Database extends Context.Service<Database, {
|
|
1429
1453
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
1430
1454
|
* }>()("Database") {}
|
|
1431
1455
|
*
|
|
@@ -1451,7 +1475,7 @@ export const span = (name, options) => {
|
|
|
1451
1475
|
* @since 4.0.0
|
|
1452
1476
|
* @category tracing
|
|
1453
1477
|
*/
|
|
1454
|
-
export const parentSpan = span =>
|
|
1478
|
+
export const parentSpan = span => succeedContext(Tracer.ParentSpan.context(span));
|
|
1455
1479
|
/**
|
|
1456
1480
|
* Wraps a Layer with a new tracing span, making all operations in the layer
|
|
1457
1481
|
* constructor part of the named trace span.
|
|
@@ -1462,13 +1486,13 @@ export const parentSpan = span => succeedServices(Tracer.ParentSpan.serviceMap(s
|
|
|
1462
1486
|
*
|
|
1463
1487
|
* @example
|
|
1464
1488
|
* ```ts
|
|
1465
|
-
* import { Effect, Layer,
|
|
1489
|
+
* import { Effect, Layer, Context } from "effect"
|
|
1466
1490
|
*
|
|
1467
|
-
* class Database extends
|
|
1491
|
+
* class Database extends Context.Service<Database, {
|
|
1468
1492
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
1469
1493
|
* }>()("Database") {}
|
|
1470
1494
|
*
|
|
1471
|
-
* class Logger extends
|
|
1495
|
+
* class Logger extends Context.Service<Logger, {
|
|
1472
1496
|
* readonly log: (msg: string) => Effect.Effect<void>
|
|
1473
1497
|
* }>()("Logger") {}
|
|
1474
1498
|
*
|
|
@@ -1529,13 +1553,13 @@ export const withSpan = function () {
|
|
|
1529
1553
|
*
|
|
1530
1554
|
* @example
|
|
1531
1555
|
* ```ts
|
|
1532
|
-
* import { Effect, Layer,
|
|
1556
|
+
* import { Effect, Layer, Context, Tracer } from "effect"
|
|
1533
1557
|
*
|
|
1534
|
-
* class Database extends
|
|
1558
|
+
* class Database extends Context.Service<Database, {
|
|
1535
1559
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
1536
1560
|
* }>()("Database") {}
|
|
1537
1561
|
*
|
|
1538
|
-
* class Cache extends
|
|
1562
|
+
* class Cache extends Context.Service<Cache, {
|
|
1539
1563
|
* readonly get: (key: string) => Effect.Effect<string | null>
|
|
1540
1564
|
* }>()("Cache") {}
|
|
1541
1565
|
*
|
|
@@ -1564,9 +1588,9 @@ export const withSpan = function () {
|
|
|
1564
1588
|
* Layer.withParentSpan(parentSpan)
|
|
1565
1589
|
* )
|
|
1566
1590
|
*
|
|
1567
|
-
* const
|
|
1568
|
-
* const database =
|
|
1569
|
-
* const cache =
|
|
1591
|
+
* const context = yield* Layer.build(AppLayer)
|
|
1592
|
+
* const database = Context.get(context, Database)
|
|
1593
|
+
* const cache = Context.get(context, Cache)
|
|
1570
1594
|
*
|
|
1571
1595
|
* const dbResult = yield* database.query("SELECT * FROM users")
|
|
1572
1596
|
* const cacheResult = yield* cache.get("user:123")
|