effect 4.0.0-beta.43 → 4.0.0-beta.45
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/Equal.d.ts.map +1 -1
- package/dist/Equal.js +16 -0
- package/dist/Equal.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/Hash.js +1 -1
- package/dist/Hash.js.map +1 -1
- package/dist/Layer.d.ts +286 -268
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +133 -134
- 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/Semaphore.d.ts +1 -1
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js +1 -3
- package/dist/Semaphore.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/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 +49 -46
- 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/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/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.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +13 -14
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +8 -8
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +12 -12
- 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/Event.d.ts +0 -6
- package/dist/unstable/eventlog/Event.d.ts.map +1 -1
- package/dist/unstable/eventlog/Event.js +0 -5
- package/dist/unstable/eventlog/Event.js.map +1 -1
- package/dist/unstable/eventlog/EventGroup.d.ts +0 -2
- package/dist/unstable/eventlog/EventGroup.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventGroup.js +0 -2
- package/dist/unstable/eventlog/EventGroup.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +26 -9
- package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventJournal.js +128 -69
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts +91 -37
- package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLog.js +223 -149
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.d.ts +11 -9
- package/dist/unstable/eventlog/EventLogEncryption.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js +15 -17
- package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +228 -0
- package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -0
- package/dist/unstable/eventlog/EventLogMessage.js +214 -0
- package/dist/unstable/eventlog/EventLogMessage.js.map +1 -0
- package/dist/unstable/eventlog/EventLogRemote.d.ts +111 -193
- package/dist/unstable/eventlog/EventLogRemote.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.js +167 -322
- package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.d.ts +26 -48
- package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.js +128 -199
- package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +60 -0
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -0
- package/dist/unstable/eventlog/EventLogServerEncrypted.js +166 -0
- package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -0
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +183 -0
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -0
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js +461 -0
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -0
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +117 -0
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts.map +1 -0
- package/dist/unstable/eventlog/EventLogSessionAuth.js +284 -0
- package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -0
- package/dist/unstable/eventlog/{SqlEventLogJournal.d.ts → SqlEventJournal.d.ts} +2 -2
- package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -0
- package/dist/unstable/eventlog/{SqlEventLogJournal.js → SqlEventJournal.js} +20 -14
- package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -0
- package/dist/unstable/eventlog/{SqlEventLogServer.d.ts → SqlEventLogServerEncrypted.d.ts} +5 -5
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts.map +1 -0
- package/dist/unstable/eventlog/{SqlEventLogServer.js → SqlEventLogServerEncrypted.js} +65 -24
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -0
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts +25 -0
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -0
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +354 -0
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -0
- package/dist/unstable/eventlog/index.d.ts +22 -2
- package/dist/unstable/eventlog/index.d.ts.map +1 -1
- package/dist/unstable/eventlog/index.js +22 -2
- package/dist/unstable/eventlog/index.js.map +1 -1
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.d.ts +2 -0
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.d.ts.map +1 -0
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.js +89 -0
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.js.map +1 -0
- 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 +4 -5
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.js +4 -4
- 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 +4 -5
- package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.js +5 -5
- 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 +35 -14
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js +30 -4
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts +21 -21
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +73 -40
- 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 +8 -8
- 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 +8 -8
- 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 +2 -2
- 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 +21 -20
- 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 +6 -3
- package/dist/unstable/rpc/Utils.d.ts.map +1 -1
- package/dist/unstable/rpc/Utils.js +46 -5
- package/dist/unstable/rpc/Utils.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts +2 -2
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js +2 -4
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.js +1 -12
- package/dist/unstable/schema/VariantSchema.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 +3 -3
- package/dist/unstable/workers/Transferable.d.ts.map +1 -1
- package/dist/unstable/workers/Transferable.js +7 -7
- 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 +3 -3
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +5 -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/Equal.ts +17 -0
- 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/Hash.ts +2 -2
- package/src/Layer.ts +333 -307
- 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/Semaphore.ts +2 -4
- 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/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 +68 -66
- package/src/unstable/ai/Model.ts +8 -8
- 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/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 +14 -15
- package/src/unstable/cluster/Entity.ts +25 -25
- 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/Event.ts +0 -8
- package/src/unstable/eventlog/EventGroup.ts +0 -4
- package/src/unstable/eventlog/EventJournal.ts +146 -78
- package/src/unstable/eventlog/EventLog.ts +353 -232
- package/src/unstable/eventlog/EventLogEncryption.ts +18 -32
- package/src/unstable/eventlog/EventLogMessage.ts +277 -0
- package/src/unstable/eventlog/EventLogRemote.ts +263 -410
- package/src/unstable/eventlog/EventLogServer.ts +183 -275
- package/src/unstable/eventlog/EventLogServerEncrypted.ts +206 -0
- package/src/unstable/eventlog/EventLogServerUnencrypted.ts +749 -0
- package/src/unstable/eventlog/EventLogSessionAuth.ts +437 -0
- package/src/unstable/eventlog/{SqlEventLogJournal.ts → SqlEventJournal.ts} +26 -18
- package/src/unstable/eventlog/{SqlEventLogServer.ts → SqlEventLogServerEncrypted.ts} +102 -40
- package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +500 -0
- package/src/unstable/eventlog/index.ts +27 -2
- package/src/unstable/eventlog/internal/identityRootSecretDerivation.ts +153 -0
- 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 +27 -12
- package/src/unstable/reactivity/AtomRegistry.ts +4 -4
- package/src/unstable/reactivity/AtomRpc.ts +20 -9
- package/src/unstable/reactivity/Reactivity.ts +6 -6
- package/src/unstable/rpc/Rpc.ts +59 -21
- package/src/unstable/rpc/RpcClient.ts +103 -54
- package/src/unstable/rpc/RpcGroup.ts +31 -31
- package/src/unstable/rpc/RpcMiddleware.ts +16 -16
- package/src/unstable/rpc/RpcSchema.ts +4 -4
- package/src/unstable/rpc/RpcSerialization.ts +2 -2
- package/src/unstable/rpc/RpcServer.ts +24 -22
- package/src/unstable/rpc/RpcWorker.ts +5 -5
- package/src/unstable/rpc/Utils.ts +63 -4
- package/src/unstable/schema/Model.ts +4 -6
- package/src/unstable/schema/VariantSchema.ts +4 -17
- 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 +15 -17
- 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 +6 -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/unstable/eventlog/SqlEventLogJournal.d.ts.map +0 -1
- package/dist/unstable/eventlog/SqlEventLogJournal.js.map +0 -1
- package/dist/unstable/eventlog/SqlEventLogServer.d.ts.map +0 -1
- package/dist/unstable/eventlog/SqlEventLogServer.js.map +0 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @since 4.0.0
|
|
3
3
|
*/
|
|
4
|
+
import * as Context from "../../Context.ts"
|
|
4
5
|
import * as Effect from "../../Effect.ts"
|
|
5
6
|
import * as FiberMap from "../../FiberMap.ts"
|
|
6
|
-
import { identity } from "../../Function.ts"
|
|
7
|
+
import { constant, identity } from "../../Function.ts"
|
|
7
8
|
import * as Layer from "../../Layer.ts"
|
|
8
9
|
import type { Pipeable } from "../../Pipeable.ts"
|
|
9
10
|
import { pipeArguments } from "../../Pipeable.ts"
|
|
@@ -12,25 +13,146 @@ import * as PubSub from "../../PubSub.ts"
|
|
|
12
13
|
import * as Queue from "../../Queue.ts"
|
|
13
14
|
import type * as Record from "../../Record.ts"
|
|
14
15
|
import * as Redacted from "../../Redacted.ts"
|
|
16
|
+
import * as Schedule from "../../Schedule.ts"
|
|
15
17
|
import * as Schema from "../../Schema.ts"
|
|
18
|
+
import * as SchemaGetter from "../../SchemaGetter.ts"
|
|
16
19
|
import type * as Scope from "../../Scope.ts"
|
|
17
|
-
import * as Semaphore from "../../Semaphore.ts"
|
|
18
|
-
import * as ServiceMap from "../../ServiceMap.ts"
|
|
19
20
|
import type { Covariant } from "../../Types.ts"
|
|
20
21
|
import { Reactivity } from "../reactivity/Reactivity.ts"
|
|
21
22
|
import * as ReactivityLayer from "../reactivity/Reactivity.ts"
|
|
22
|
-
import * as Event from "./Event.ts"
|
|
23
|
+
import type * as Event from "./Event.ts"
|
|
23
24
|
import type * as EventGroup from "./EventGroup.ts"
|
|
24
|
-
import {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
type EventJournalError,
|
|
28
|
-
makeEntryIdUnsafe,
|
|
29
|
-
type RemoteEntry,
|
|
30
|
-
type RemoteId
|
|
31
|
-
} from "./EventJournal.ts"
|
|
25
|
+
import { Entry, EventJournal, type EventJournalError, makeEntryIdUnsafe, type RemoteId } from "./EventJournal.ts"
|
|
26
|
+
import * as EventLogEncryption from "./EventLogEncryption.ts"
|
|
27
|
+
import { StoreId } from "./EventLogMessage.ts"
|
|
32
28
|
import type { EventLogRemote } from "./EventLogRemote.ts"
|
|
33
29
|
|
|
30
|
+
/**
|
|
31
|
+
* @since 4.0.0
|
|
32
|
+
* @category tags
|
|
33
|
+
*/
|
|
34
|
+
export class EventLog extends Context.Service<EventLog, {
|
|
35
|
+
readonly write: <Groups extends EventGroup.Any, Tag extends Event.Tag<EventGroup.Events<Groups>>>(options: {
|
|
36
|
+
readonly schema: EventLogSchema<Groups>
|
|
37
|
+
readonly event: Tag
|
|
38
|
+
readonly payload: Event.PayloadWithTag<EventGroup.Events<Groups>, Tag>
|
|
39
|
+
}) => Effect.Effect<
|
|
40
|
+
Event.SuccessWithTag<EventGroup.Events<Groups>, Tag>,
|
|
41
|
+
Event.ErrorWithTag<EventGroup.Events<Groups>, Tag> | EventJournalError
|
|
42
|
+
>
|
|
43
|
+
readonly entries: Effect.Effect<ReadonlyArray<Entry>, EventJournalError>
|
|
44
|
+
readonly destroy: Effect.Effect<void, EventJournalError>
|
|
45
|
+
}>()("effect/eventlog/EventLog") {}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @since 4.0.0
|
|
49
|
+
* @category Registry
|
|
50
|
+
*/
|
|
51
|
+
export class Registry extends Context.Service<Registry, {
|
|
52
|
+
readonly registerHandlerUnsafe: (options: {
|
|
53
|
+
readonly event: string
|
|
54
|
+
readonly handler: Handlers.Item<any>
|
|
55
|
+
}) => void
|
|
56
|
+
|
|
57
|
+
readonly handlers: ReadonlyMap<string, Handlers.Item<any>>
|
|
58
|
+
|
|
59
|
+
readonly registerCompaction: (options: {
|
|
60
|
+
readonly events: ReadonlyArray<string>
|
|
61
|
+
readonly effect: (options: {
|
|
62
|
+
readonly entries: ReadonlyArray<Entry>
|
|
63
|
+
readonly write: (entry: Entry) => Effect.Effect<void>
|
|
64
|
+
}) => Effect.Effect<void>
|
|
65
|
+
}) => Effect.Effect<void, never, Scope.Scope>
|
|
66
|
+
|
|
67
|
+
readonly compactors: ReadonlyMap<string, {
|
|
68
|
+
readonly events: ReadonlySet<string>
|
|
69
|
+
readonly effect: (options: {
|
|
70
|
+
readonly entries: ReadonlyArray<Entry>
|
|
71
|
+
readonly write: (entry: Entry) => Effect.Effect<void>
|
|
72
|
+
}) => Effect.Effect<void>
|
|
73
|
+
}>
|
|
74
|
+
|
|
75
|
+
readonly registerRemote: (remote: EventLogRemote["Service"]) => Effect.Effect<void, never, Scope.Scope>
|
|
76
|
+
readonly handleRemote: (handler: (remote: EventLogRemote["Service"]) => Effect.Effect<void>) => Effect.Effect<void>
|
|
77
|
+
|
|
78
|
+
readonly registerReactivity: (keys: Record<string, ReadonlyArray<string>>) => Effect.Effect<void, never, Scope.Scope>
|
|
79
|
+
|
|
80
|
+
readonly reactivityKeys: Record<string, ReadonlyArray<string>>
|
|
81
|
+
}>()("effect/unstable/eventlog/EventLog/Registry") {}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @since 4.0.0
|
|
85
|
+
* @category Registry
|
|
86
|
+
*/
|
|
87
|
+
export const layerRegistry = Layer.effect(
|
|
88
|
+
Registry,
|
|
89
|
+
Effect.gen(function*() {
|
|
90
|
+
const handlers = new Map<string, Handlers.Item<any>>()
|
|
91
|
+
const compactors = new Map<string, {
|
|
92
|
+
readonly events: ReadonlySet<string>
|
|
93
|
+
readonly effect: (options: {
|
|
94
|
+
readonly entries: ReadonlyArray<Entry>
|
|
95
|
+
readonly write: (entry: Entry) => Effect.Effect<void>
|
|
96
|
+
}) => Effect.Effect<void>
|
|
97
|
+
}>()
|
|
98
|
+
|
|
99
|
+
const remoteFiberMap = yield* FiberMap.make<RemoteId>()
|
|
100
|
+
const remotes = new Map<RemoteId, EventLogRemote["Service"]>()
|
|
101
|
+
let remoteHandler: (remote: EventLogRemote["Service"]) => Effect.Effect<void> = (_) => Effect.void
|
|
102
|
+
|
|
103
|
+
const reactivityKeys: Record<string, ReadonlyArray<string>> = {}
|
|
104
|
+
return Registry.of({
|
|
105
|
+
registerHandlerUnsafe(options) {
|
|
106
|
+
handlers.set(options.event, options.handler)
|
|
107
|
+
},
|
|
108
|
+
handlers,
|
|
109
|
+
registerCompaction: (options) =>
|
|
110
|
+
Effect.sync(() => {
|
|
111
|
+
const events = new Set(options.events)
|
|
112
|
+
const compactor = {
|
|
113
|
+
events,
|
|
114
|
+
effect: options.effect
|
|
115
|
+
}
|
|
116
|
+
for (const event of options.events) {
|
|
117
|
+
compactors.set(event, compactor)
|
|
118
|
+
}
|
|
119
|
+
}),
|
|
120
|
+
compactors,
|
|
121
|
+
registerRemote: (remote) =>
|
|
122
|
+
Effect.acquireRelease(
|
|
123
|
+
Effect.suspend(() => {
|
|
124
|
+
remotes.set(remote.id, remote)
|
|
125
|
+
return Effect.asVoid(FiberMap.run(remoteFiberMap, remote.id, remoteHandler(remote)))
|
|
126
|
+
}),
|
|
127
|
+
() => {
|
|
128
|
+
remotes.delete(remote.id)
|
|
129
|
+
return FiberMap.remove(remoteFiberMap, remote.id)
|
|
130
|
+
}
|
|
131
|
+
),
|
|
132
|
+
handleRemote(handler) {
|
|
133
|
+
remoteHandler = handler
|
|
134
|
+
return Effect.forEach(remotes, ([id, remote]) => FiberMap.run(remoteFiberMap, id, handler(remote)), {
|
|
135
|
+
discard: true
|
|
136
|
+
})
|
|
137
|
+
},
|
|
138
|
+
registerReactivity: (keys) =>
|
|
139
|
+
Effect.sync(() => {
|
|
140
|
+
Object.assign(reactivityKeys, keys)
|
|
141
|
+
}),
|
|
142
|
+
reactivityKeys
|
|
143
|
+
})
|
|
144
|
+
})
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* @since 4.0.0
|
|
149
|
+
* @category models
|
|
150
|
+
*/
|
|
151
|
+
export class Identity extends Context.Service<Identity, {
|
|
152
|
+
readonly publicKey: string
|
|
153
|
+
readonly privateKey: Redacted.Redacted<Uint8Array<ArrayBuffer>>
|
|
154
|
+
}>()("effect/eventlog/EventLog/Identity") {}
|
|
155
|
+
|
|
34
156
|
/**
|
|
35
157
|
* @since 4.0.0
|
|
36
158
|
* @category schema
|
|
@@ -100,23 +222,22 @@ export interface Handlers<
|
|
|
100
222
|
}
|
|
101
223
|
readonly group: EventGroup.AnyWithProps
|
|
102
224
|
readonly handlers: Record.ReadonlyRecord<string, Handlers.Item<R>>
|
|
103
|
-
readonly
|
|
225
|
+
readonly context: Context.Context<R>
|
|
104
226
|
|
|
105
227
|
/**
|
|
106
228
|
* Add the implementation for an `Event` to a `Handlers` group.
|
|
107
229
|
*/
|
|
108
230
|
handle<Tag extends Event.Tag<Events>, R1>(
|
|
109
231
|
name: Tag,
|
|
110
|
-
handler: (
|
|
111
|
-
|
|
112
|
-
|
|
232
|
+
handler: (options: {
|
|
233
|
+
readonly storeId: StoreId
|
|
234
|
+
readonly payload: Event.PayloadWithTag<Events, Tag>
|
|
235
|
+
readonly entry: Entry
|
|
236
|
+
readonly conflicts: ReadonlyArray<{
|
|
113
237
|
readonly entry: Entry
|
|
114
|
-
readonly
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}>
|
|
118
|
-
}
|
|
119
|
-
) => Effect.Effect<Event.SuccessWithTag<Events, Tag>, Event.ErrorWithTag<Events, Tag>, R1>
|
|
238
|
+
readonly payload: Event.PayloadWithTag<Events, Tag>
|
|
239
|
+
}>
|
|
240
|
+
}) => Effect.Effect<Event.SuccessWithTag<Events, Tag>, Event.ErrorWithTag<Events, Tag>, R1>
|
|
120
241
|
): Handlers<
|
|
121
242
|
R | R1,
|
|
122
243
|
Event.ExcludeTag<Events, Tag>
|
|
@@ -142,8 +263,9 @@ export declare namespace Handlers {
|
|
|
142
263
|
*/
|
|
143
264
|
export type Item<R> = {
|
|
144
265
|
readonly event: Event.AnyWithProps
|
|
145
|
-
readonly
|
|
266
|
+
readonly context: Context.Context<R>
|
|
146
267
|
readonly handler: (options: {
|
|
268
|
+
readonly storeId: StoreId
|
|
147
269
|
readonly payload: unknown
|
|
148
270
|
readonly entry: Entry
|
|
149
271
|
readonly conflicts: ReadonlyArray<{
|
|
@@ -211,10 +333,16 @@ export declare namespace Handlers {
|
|
|
211
333
|
* @since 4.0.0
|
|
212
334
|
* @category models
|
|
213
335
|
*/
|
|
214
|
-
export class
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
336
|
+
export class CurrentStoreId extends Context.Reference<StoreId>("effect/eventlog/EventLog/CurrentStoreId", {
|
|
337
|
+
defaultValue: constant(StoreId.make("default"))
|
|
338
|
+
}) {}
|
|
339
|
+
|
|
340
|
+
const RedactedUint8Array = Schema.Uint8ArrayFromBase64.pipe(
|
|
341
|
+
Schema.decodeTo(Schema.Redacted(Schema.Uint8Array), {
|
|
342
|
+
decode: SchemaGetter.transform((value) => Redacted.make(value)),
|
|
343
|
+
encode: SchemaGetter.transform((value) => Redacted.value(value))
|
|
344
|
+
})
|
|
345
|
+
)
|
|
218
346
|
|
|
219
347
|
/**
|
|
220
348
|
* @since 4.0.0
|
|
@@ -222,7 +350,7 @@ export class Identity extends ServiceMap.Service<Identity, {
|
|
|
222
350
|
*/
|
|
223
351
|
export const IdentitySchema = Schema.Struct({
|
|
224
352
|
publicKey: Schema.String,
|
|
225
|
-
privateKey:
|
|
353
|
+
privateKey: RedactedUint8Array
|
|
226
354
|
})
|
|
227
355
|
|
|
228
356
|
const IdentityEncodedSchema = Schema.Struct({
|
|
@@ -240,7 +368,7 @@ export const decodeIdentityString = (value: string): Identity["Service"] => {
|
|
|
240
368
|
const decoded = Schema.decodeUnknownSync(IdentityStringSchema)(value)
|
|
241
369
|
return {
|
|
242
370
|
publicKey: decoded.publicKey,
|
|
243
|
-
privateKey: Redacted.make(decoded.privateKey)
|
|
371
|
+
privateKey: Redacted.make(decoded.privateKey as Uint8Array<ArrayBuffer>)
|
|
244
372
|
}
|
|
245
373
|
}
|
|
246
374
|
|
|
@@ -258,10 +386,8 @@ export const encodeIdentityString = (identity: Identity["Service"]): string =>
|
|
|
258
386
|
* @since 4.0.0
|
|
259
387
|
* @category constructors
|
|
260
388
|
*/
|
|
261
|
-
export const
|
|
262
|
-
|
|
263
|
-
privateKey: Redacted.make(globalThis.crypto.getRandomValues(new Uint8Array(32)))
|
|
264
|
-
})
|
|
389
|
+
export const makeIdentity: Effect.Effect<Identity["Service"], never, EventLogEncryption.EventLogEncryption> =
|
|
390
|
+
EventLogEncryption.EventLogEncryption.use((_) => _.generateIdentity)
|
|
265
391
|
|
|
266
392
|
const handlersProto = {
|
|
267
393
|
[HandlersTypeId]: {
|
|
@@ -274,12 +400,12 @@ const handlersProto = {
|
|
|
274
400
|
): Handlers<any, any> {
|
|
275
401
|
return makeHandlers({
|
|
276
402
|
group: this.group,
|
|
277
|
-
|
|
403
|
+
context: this.context,
|
|
278
404
|
handlers: {
|
|
279
405
|
...this.handlers,
|
|
280
406
|
[tag]: {
|
|
281
407
|
event: this.group.events[tag],
|
|
282
|
-
|
|
408
|
+
context: this.context,
|
|
283
409
|
handler
|
|
284
410
|
}
|
|
285
411
|
}
|
|
@@ -293,7 +419,7 @@ const handlersProto = {
|
|
|
293
419
|
const makeHandlers = (options: {
|
|
294
420
|
readonly group: EventGroup.AnyWithProps
|
|
295
421
|
readonly handlers: Record.ReadonlyRecord<string, Handlers.Item<any>>
|
|
296
|
-
readonly
|
|
422
|
+
readonly context: Context.Context<any>
|
|
297
423
|
}): Handlers<any, any> => Object.assign(Object.create(handlersProto), options)
|
|
298
424
|
|
|
299
425
|
/**
|
|
@@ -303,26 +429,28 @@ const makeHandlers = (options: {
|
|
|
303
429
|
export const group = <Events extends Event.Any, Return>(
|
|
304
430
|
group: EventGroup.EventGroup<Events>,
|
|
305
431
|
f: (handlers: Handlers<never, Events>) => Handlers.ValidateReturn<Return>
|
|
306
|
-
): Layer.Layer<
|
|
307
|
-
|
|
432
|
+
): Layer.Layer<
|
|
433
|
+
Event.ToService<Events>,
|
|
434
|
+
Handlers.Error<Return>,
|
|
435
|
+
Exclude<Handlers.Services<Return>, Scope.Scope | Identity> | Registry
|
|
436
|
+
> =>
|
|
437
|
+
Layer.effectDiscard(
|
|
308
438
|
Effect.gen(function*() {
|
|
309
|
-
const
|
|
439
|
+
const registry = yield* Registry
|
|
440
|
+
const context = yield* Effect.context<Exclude<Handlers.Services<Return>, Scope.Scope | Identity>>()
|
|
310
441
|
const result = f(makeHandlers({
|
|
311
442
|
group: group as EventGroup.AnyWithProps,
|
|
312
443
|
handlers: {},
|
|
313
|
-
|
|
444
|
+
context
|
|
314
445
|
}) as unknown as Handlers<never, Events>)
|
|
315
446
|
const handlers = Effect.isEffect(result)
|
|
316
447
|
? (yield* (result as unknown as Effect.Effect<Handlers<any>>))
|
|
317
448
|
: (result as unknown as Handlers<any>)
|
|
318
|
-
const serviceMap = new Map<string, Handlers.Item<any>>()
|
|
319
449
|
for (const tag in handlers.handlers) {
|
|
320
|
-
|
|
321
|
-
serviceMap.set(handler.event.key, handlers.handlers[tag])
|
|
450
|
+
registry.registerHandlerUnsafe({ event: tag, handler: handlers.handlers[tag] })
|
|
322
451
|
}
|
|
323
|
-
return ServiceMap.makeUnsafe(serviceMap)
|
|
324
452
|
})
|
|
325
|
-
)
|
|
453
|
+
) as any
|
|
326
454
|
|
|
327
455
|
/**
|
|
328
456
|
* @since 4.0.0
|
|
@@ -339,19 +467,19 @@ export const groupCompaction = <Events extends Event.Any, R>(
|
|
|
339
467
|
payload: Event.PayloadWithTag<Events, Tag>
|
|
340
468
|
) => Effect.Effect<void, never, Event.PayloadSchemaWithTag<Events, Tag>["EncodingServices"]>
|
|
341
469
|
}) => Effect.Effect<void, never, R>
|
|
342
|
-
): Layer.Layer<never, never,
|
|
470
|
+
): Layer.Layer<never, never, R | Event.PayloadSchema<Events>["DecodingServices"] | Registry> =>
|
|
343
471
|
Layer.effectDiscard(
|
|
344
472
|
Effect.gen(function*() {
|
|
345
|
-
const
|
|
346
|
-
const services = yield* Effect.
|
|
473
|
+
const registry = yield* Registry
|
|
474
|
+
const services = yield* Effect.context<R | Event.PayloadSchema<Events>["DecodingServices"]>()
|
|
347
475
|
|
|
348
|
-
yield*
|
|
476
|
+
yield* registry.registerCompaction({
|
|
349
477
|
events: Object.keys(group.events),
|
|
350
478
|
effect: Effect.fnUntraced(function*({ entries, write }): Effect.fn.Return<void> {
|
|
351
479
|
const isEventTag = (tag: string): tag is Event.Tag<Events> => tag in group.events
|
|
352
480
|
const decodePayload = <Tag extends Event.Tag<Events>>(tag: Tag, payload: Uint8Array) =>
|
|
353
481
|
Schema.decodeUnknownEffect(group.events[tag].payloadMsgPack)(payload).pipe(
|
|
354
|
-
Effect.
|
|
482
|
+
Effect.updateContext((input) => Context.merge(services, input)),
|
|
355
483
|
Effect.orDie
|
|
356
484
|
) as unknown as Effect.Effect<Event.PayloadWithTag<Events, Tag>>
|
|
357
485
|
const writePayload = Effect.fnUntraced(function*<Tag extends Event.Tag<Events>>(
|
|
@@ -406,15 +534,13 @@ export const groupCompaction = <Events extends Event.Any, R>(
|
|
|
406
534
|
return Effect.orDie(writePayload(entries[0].createdAtMillis, tag, payload))
|
|
407
535
|
}
|
|
408
536
|
}).pipe(
|
|
409
|
-
Effect.
|
|
537
|
+
Effect.updateContext((input) => Context.merge(services, input))
|
|
410
538
|
)
|
|
411
539
|
) as any
|
|
412
540
|
}
|
|
413
541
|
})
|
|
414
542
|
})
|
|
415
543
|
})
|
|
416
|
-
).pipe(
|
|
417
|
-
Layer.provide(layerEventLog)
|
|
418
544
|
)
|
|
419
545
|
|
|
420
546
|
/**
|
|
@@ -426,175 +552,186 @@ export const groupReactivity = <Events extends Event.Any>(
|
|
|
426
552
|
keys:
|
|
427
553
|
| { readonly [Tag in Event.Tag<Events>]?: ReadonlyArray<string> }
|
|
428
554
|
| ReadonlyArray<string>
|
|
429
|
-
): Layer.Layer<never, never,
|
|
555
|
+
): Layer.Layer<never, never, Registry> =>
|
|
430
556
|
Effect.gen(function*() {
|
|
431
|
-
const
|
|
557
|
+
const registry = yield* Registry
|
|
432
558
|
if (!Array.isArray(keys)) {
|
|
433
|
-
yield*
|
|
559
|
+
yield* registry.registerReactivity(keys as Record.ReadonlyRecord<string, ReadonlyArray<string>>)
|
|
434
560
|
return
|
|
435
561
|
}
|
|
436
562
|
const obj: Record<string, ReadonlyArray<string>> = {}
|
|
437
563
|
for (const tag in group.events) {
|
|
438
564
|
obj[tag] = keys
|
|
439
565
|
}
|
|
440
|
-
yield*
|
|
566
|
+
yield* registry.registerReactivity(obj)
|
|
441
567
|
}).pipe(
|
|
442
|
-
Layer.effectDiscard
|
|
443
|
-
Layer.provide(layerEventLog)
|
|
568
|
+
Layer.effectDiscard
|
|
444
569
|
)
|
|
445
570
|
|
|
446
571
|
/**
|
|
447
572
|
* @since 4.0.0
|
|
448
|
-
* @category
|
|
573
|
+
* @category handlers
|
|
449
574
|
*/
|
|
450
|
-
export
|
|
451
|
-
readonly
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
575
|
+
export const makeReplayFromRemote = (options: {
|
|
576
|
+
readonly handlers: ReadonlyMap<string, Handlers.Item<any>>
|
|
577
|
+
readonly storeId: StoreId
|
|
578
|
+
readonly identity: Identity["Service"]
|
|
579
|
+
readonly reactivity: Reactivity["Service"]
|
|
580
|
+
readonly reactivityKeys: Record<string, ReadonlyArray<string>>
|
|
581
|
+
readonly logAnnotations: {
|
|
582
|
+
readonly service: string
|
|
583
|
+
readonly effect: string
|
|
584
|
+
}
|
|
585
|
+
}) =>
|
|
586
|
+
Effect.fnUntraced(
|
|
587
|
+
function*({ conflicts, entry }): Effect.fn.Return<void, Schema.SchemaError> {
|
|
588
|
+
const handler = options.handlers.get(entry.event) as Handlers.Item<any> | undefined
|
|
589
|
+
if (!handler) {
|
|
590
|
+
return yield* Effect.logDebug(`Event handler not found for: "${entry.event}"`)
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
const decodePayload = Schema.decodeUnknownEffect(handler.event.payloadMsgPack)
|
|
594
|
+
const decodedConflicts: Array<{ entry: Entry; payload: unknown }> = new Array(conflicts.length)
|
|
595
|
+
for (let i = 0; i < conflicts.length; i++) {
|
|
596
|
+
decodedConflicts[i] = {
|
|
597
|
+
entry: conflicts[i],
|
|
598
|
+
payload: yield* decodePayload(conflicts[i].payload).pipe(
|
|
599
|
+
Effect.updateContext((input) => Context.merge(handler.context, input))
|
|
600
|
+
) as any
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
yield* decodePayload(entry.payload).pipe(
|
|
605
|
+
Effect.flatMap((payload) =>
|
|
606
|
+
handler.handler({
|
|
607
|
+
storeId: options.storeId,
|
|
608
|
+
payload,
|
|
609
|
+
entry,
|
|
610
|
+
conflicts: decodedConflicts
|
|
611
|
+
})
|
|
612
|
+
),
|
|
613
|
+
Effect.provideService(Identity, options.identity),
|
|
614
|
+
Effect.updateContext((input) => Context.merge(handler.context, input)),
|
|
615
|
+
Effect.asVoid
|
|
616
|
+
) as any
|
|
617
|
+
|
|
618
|
+
const keys = options.reactivityKeys[entry.event]
|
|
619
|
+
if (keys) {
|
|
620
|
+
for (const key of keys) {
|
|
621
|
+
options.reactivity.invalidateUnsafe({
|
|
622
|
+
[key]: [entry.primaryKey]
|
|
623
|
+
})
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
},
|
|
627
|
+
Effect.catchCause(Effect.logError),
|
|
628
|
+
(effect, { entry }) =>
|
|
629
|
+
Effect.annotateLogs(effect, {
|
|
630
|
+
...options.logAnnotations,
|
|
631
|
+
entryId: entry.idString
|
|
632
|
+
})
|
|
633
|
+
)
|
|
471
634
|
|
|
472
635
|
const make = Effect.gen(function*() {
|
|
636
|
+
const storeId = yield* CurrentStoreId
|
|
473
637
|
const identity = yield* Identity
|
|
474
638
|
const journal = yield* EventJournal
|
|
475
|
-
const
|
|
476
|
-
|
|
477
|
-
const remotes = yield* FiberMap.make<RemoteId>()
|
|
478
|
-
const compactors = new Map<string, {
|
|
479
|
-
readonly events: ReadonlySet<string>
|
|
480
|
-
readonly effect: (options: {
|
|
481
|
-
readonly entries: ReadonlyArray<Entry>
|
|
482
|
-
readonly write: (entry: Entry) => Effect.Effect<void>
|
|
483
|
-
}) => Effect.Effect<void>
|
|
484
|
-
}>()
|
|
485
|
-
const journalSemaphore = yield* Semaphore.make(1)
|
|
639
|
+
const registry = yield* Registry
|
|
486
640
|
|
|
487
641
|
const reactivity = yield* Reactivity
|
|
488
|
-
const
|
|
642
|
+
const replayFromRemote = makeReplayFromRemote({
|
|
643
|
+
handlers: registry.handlers,
|
|
644
|
+
storeId,
|
|
645
|
+
identity,
|
|
646
|
+
reactivity,
|
|
647
|
+
reactivityKeys: registry.reactivityKeys,
|
|
648
|
+
logAnnotations: {
|
|
649
|
+
service: "EventLog",
|
|
650
|
+
effect: "writeFromRemote"
|
|
651
|
+
}
|
|
652
|
+
})
|
|
653
|
+
|
|
654
|
+
const invalidateReactivityEntries = (entries: ReadonlyArray<Entry>) =>
|
|
655
|
+
Effect.sync(() => {
|
|
656
|
+
for (const entry of entries) {
|
|
657
|
+
const keys = registry.reactivityKeys[entry.event]
|
|
658
|
+
if (!keys) {
|
|
659
|
+
continue
|
|
660
|
+
}
|
|
661
|
+
for (const key of keys) {
|
|
662
|
+
reactivity.invalidateUnsafe({
|
|
663
|
+
[key]: [entry.primaryKey]
|
|
664
|
+
})
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
})
|
|
489
668
|
|
|
490
669
|
const runRemote = Effect.fnUntraced(
|
|
491
670
|
function*(remote: EventLogRemote["Service"]) {
|
|
492
671
|
const startSequence = yield* journal.nextRemoteSequence(remote.id)
|
|
493
|
-
const changes = yield* remote.changes(identity, startSequence)
|
|
494
672
|
|
|
495
|
-
yield*
|
|
496
|
-
|
|
497
|
-
|
|
673
|
+
yield* Effect.gen(function*() {
|
|
674
|
+
const changes = yield* remote.changes({ identity, startSequence, storeId })
|
|
675
|
+
while (true) {
|
|
676
|
+
const entries = yield* Queue.takeAll(changes)
|
|
677
|
+
yield* journal.writeFromRemote({
|
|
498
678
|
remoteId: remote.id,
|
|
499
679
|
entries: entries.flat(),
|
|
500
|
-
compact: compactors.size > 0
|
|
680
|
+
compact: registry.compactors.size > 0
|
|
501
681
|
? Effect.fnUntraced(function*(remoteEntries) {
|
|
502
|
-
const
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
682
|
+
const finalEntries: Array<Entry> = []
|
|
683
|
+
const compactable = new Map<
|
|
684
|
+
(options: {
|
|
685
|
+
readonly entries: ReadonlyArray<Entry>
|
|
686
|
+
readonly write: (entry: Entry) => Effect.Effect<void>
|
|
687
|
+
}) => Effect.Effect<void>,
|
|
688
|
+
Array<Entry>
|
|
689
|
+
>()
|
|
690
|
+
|
|
691
|
+
for (let i = 0; i < remoteEntries.length; i++) {
|
|
692
|
+
const remoteEntry = remoteEntries[i]
|
|
693
|
+
const entry = remoteEntry.entry
|
|
694
|
+
const compactor = registry.compactors.get(entry.event)
|
|
509
695
|
if (!compactor) {
|
|
510
|
-
|
|
511
|
-
uncompactedRemote.push(remoteEntry)
|
|
512
|
-
index++
|
|
696
|
+
finalEntries.push(entry)
|
|
513
697
|
continue
|
|
514
698
|
}
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
}
|
|
520
|
-
const entries = [remoteEntry.entry]
|
|
521
|
-
const remoteGroup = [remoteEntry]
|
|
522
|
-
const compacted: Array<Entry> = []
|
|
523
|
-
index++
|
|
524
|
-
while (index < remoteEntries.length) {
|
|
525
|
-
const nextRemoteEntry = remoteEntries[index]
|
|
526
|
-
if (!compactor.events.has(nextRemoteEntry.entry.event)) {
|
|
527
|
-
break
|
|
528
|
-
}
|
|
529
|
-
entries.push(nextRemoteEntry.entry)
|
|
530
|
-
remoteGroup.push(nextRemoteEntry)
|
|
531
|
-
index++
|
|
699
|
+
let arr = compactable.get(compactor.effect)
|
|
700
|
+
if (!arr) {
|
|
701
|
+
arr = []
|
|
702
|
+
compactable.set(compactor.effect, arr)
|
|
532
703
|
}
|
|
533
|
-
|
|
704
|
+
arr.push(entry)
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
for (const [compact, entries] of compactable) {
|
|
708
|
+
yield* compact({
|
|
534
709
|
entries,
|
|
535
710
|
write(entry) {
|
|
536
711
|
return Effect.sync(() => {
|
|
537
|
-
|
|
712
|
+
finalEntries.push(entry)
|
|
538
713
|
})
|
|
539
714
|
}
|
|
540
|
-
})
|
|
541
|
-
brackets.push([compacted, remoteGroup])
|
|
542
|
-
}
|
|
543
|
-
if (uncompacted.length > 0) {
|
|
544
|
-
brackets.push([uncompacted, uncompactedRemote])
|
|
715
|
+
})
|
|
545
716
|
}
|
|
546
|
-
|
|
717
|
+
|
|
718
|
+
return finalEntries.sort(Entry.Order)
|
|
547
719
|
})
|
|
548
720
|
: undefined,
|
|
549
|
-
effect:
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
for (let i = 0; i < conflicts.length; i++) {
|
|
558
|
-
decodedConflicts[i] = {
|
|
559
|
-
entry: conflicts[i],
|
|
560
|
-
payload: yield* decodePayload(conflicts[i].payload).pipe(
|
|
561
|
-
Effect.updateServices((input) => ServiceMap.merge(handler.services, input))
|
|
562
|
-
) as any
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
yield* decodePayload(entry.payload).pipe(
|
|
566
|
-
Effect.flatMap((payload) =>
|
|
567
|
-
handler.handler({
|
|
568
|
-
payload,
|
|
569
|
-
entry,
|
|
570
|
-
conflicts: decodedConflicts
|
|
571
|
-
})
|
|
572
|
-
),
|
|
573
|
-
Effect.updateServices((input) => ServiceMap.merge(handler.services, input)),
|
|
574
|
-
Effect.asVoid
|
|
575
|
-
) as any
|
|
576
|
-
if (reactivityKeys[entry.event]) {
|
|
577
|
-
for (const key of reactivityKeys[entry.event]) {
|
|
578
|
-
yield* Effect.sync(() =>
|
|
579
|
-
reactivity.invalidateUnsafe({
|
|
580
|
-
[key]: [entry.primaryKey]
|
|
581
|
-
})
|
|
582
|
-
)
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
},
|
|
586
|
-
Effect.catchCause(Effect.logError),
|
|
587
|
-
(effect, { entry }) =>
|
|
588
|
-
Effect.annotateLogs(effect, {
|
|
589
|
-
service: "EventLog",
|
|
590
|
-
effect: "writeFromRemote",
|
|
591
|
-
entryId: entry.idString
|
|
592
|
-
})
|
|
593
|
-
)
|
|
594
|
-
}).pipe(journalSemaphore.withPermits(1))
|
|
595
|
-
),
|
|
721
|
+
effect: replayFromRemote
|
|
722
|
+
}).pipe(
|
|
723
|
+
Effect.tap(({ duplicateEntries }) => invalidateReactivityEntries(duplicateEntries)),
|
|
724
|
+
journal.withLock(storeId)
|
|
725
|
+
)
|
|
726
|
+
}
|
|
727
|
+
}).pipe(
|
|
728
|
+
Effect.scoped,
|
|
596
729
|
Effect.catchCause(Effect.logError),
|
|
597
|
-
Effect.
|
|
730
|
+
Effect.repeat(
|
|
731
|
+
Schedule.exponential(200, 1.5).pipe(
|
|
732
|
+
Schedule.either(Schedule.spaced({ seconds: 10 }))
|
|
733
|
+
)
|
|
734
|
+
),
|
|
598
735
|
Effect.annotateLogs({
|
|
599
736
|
service: "EventLog",
|
|
600
737
|
effect: "runRemote consume"
|
|
@@ -602,12 +739,11 @@ const make = Effect.gen(function*() {
|
|
|
602
739
|
Effect.forkScoped
|
|
603
740
|
)
|
|
604
741
|
|
|
605
|
-
const write = journal.withRemoteUncommited(remote.id, (entries) => remote.write(identity, entries))
|
|
742
|
+
const write = journal.withRemoteUncommited(remote.id, (entries) => remote.write({ identity, entries, storeId }))
|
|
606
743
|
yield* Effect.addFinalizer(() => Effect.ignore(write))
|
|
607
744
|
yield* write
|
|
608
745
|
const changesSub = yield* journal.changes
|
|
609
746
|
return yield* PubSub.takeAll(changesSub).pipe(
|
|
610
|
-
Effect.andThen(Effect.sleep("500 millis")),
|
|
611
747
|
Effect.andThen(write),
|
|
612
748
|
Effect.catchCause(Effect.logError),
|
|
613
749
|
Effect.forever
|
|
@@ -615,7 +751,7 @@ const make = Effect.gen(function*() {
|
|
|
615
751
|
},
|
|
616
752
|
Effect.scoped,
|
|
617
753
|
Effect.provideService(Identity, identity),
|
|
618
|
-
Effect.
|
|
754
|
+
Effect.orDie
|
|
619
755
|
)
|
|
620
756
|
|
|
621
757
|
const writeHandler = Effect.fnUntraced(function*(handler: Handlers.Item<any>, options: {
|
|
@@ -626,28 +762,29 @@ const make = Effect.gen(function*() {
|
|
|
626
762
|
const payload = yield* Schema.encodeUnknownEffect(handler.event.payloadMsgPack)(options.payload).pipe(
|
|
627
763
|
Effect.orDie
|
|
628
764
|
)
|
|
629
|
-
return yield*
|
|
765
|
+
return yield* journal.withLock(storeId)(journal.write({
|
|
630
766
|
event: options.event,
|
|
631
767
|
primaryKey: handler.event.primaryKey(options.payload as never),
|
|
632
768
|
payload,
|
|
633
769
|
effect: (entry) =>
|
|
634
770
|
handler.handler({
|
|
771
|
+
storeId,
|
|
635
772
|
payload: options.payload,
|
|
636
773
|
entry,
|
|
637
774
|
conflicts: []
|
|
638
775
|
}).pipe(
|
|
639
|
-
Effect.
|
|
640
|
-
Effect.
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
}
|
|
776
|
+
Effect.updateContext((input) => Context.merge(handler.context, input)),
|
|
777
|
+
Effect.provideService(Identity, identity),
|
|
778
|
+
Effect.tap(() => {
|
|
779
|
+
if (registry.reactivityKeys[entry.event]) {
|
|
780
|
+
for (const key of registry.reactivityKeys[entry.event]) {
|
|
781
|
+
reactivity.invalidateUnsafe({
|
|
782
|
+
[key]: [entry.primaryKey]
|
|
783
|
+
})
|
|
648
784
|
}
|
|
649
|
-
}
|
|
650
|
-
|
|
785
|
+
}
|
|
786
|
+
return Effect.void
|
|
787
|
+
})
|
|
651
788
|
)
|
|
652
789
|
}))
|
|
653
790
|
})
|
|
@@ -657,44 +794,18 @@ const make = Effect.gen(function*() {
|
|
|
657
794
|
readonly event: string
|
|
658
795
|
readonly payload: unknown
|
|
659
796
|
}) => {
|
|
660
|
-
const handler =
|
|
797
|
+
const handler = registry.handlers.get(options.event) as Handlers.Item<any> | undefined
|
|
661
798
|
if (handler === undefined) {
|
|
662
799
|
return Effect.die(`Event handler not found for: "${options.event}"`)
|
|
663
800
|
}
|
|
664
801
|
return writeHandler(handler, options)
|
|
665
802
|
}
|
|
666
803
|
|
|
804
|
+
yield* registry.handleRemote(runRemote)
|
|
805
|
+
|
|
667
806
|
return EventLog.of({
|
|
668
807
|
write: eventLogWrite as EventLog["Service"]["write"],
|
|
669
808
|
entries: journal.entries,
|
|
670
|
-
registerRemote: (remote) =>
|
|
671
|
-
Effect.acquireRelease(
|
|
672
|
-
FiberMap.run(remotes, remote.id, runRemote(remote)),
|
|
673
|
-
() => FiberMap.remove(remotes, remote.id)
|
|
674
|
-
).pipe(Effect.asVoid),
|
|
675
|
-
registerCompaction: (options) =>
|
|
676
|
-
Effect.acquireRelease(
|
|
677
|
-
Effect.sync(() => {
|
|
678
|
-
const events = new Set(options.events)
|
|
679
|
-
const compactor = {
|
|
680
|
-
events,
|
|
681
|
-
effect: options.effect
|
|
682
|
-
}
|
|
683
|
-
for (const event of options.events) {
|
|
684
|
-
compactors.set(event, compactor)
|
|
685
|
-
}
|
|
686
|
-
}),
|
|
687
|
-
() =>
|
|
688
|
-
Effect.sync(() => {
|
|
689
|
-
for (const event of options.events) {
|
|
690
|
-
compactors.delete(event)
|
|
691
|
-
}
|
|
692
|
-
})
|
|
693
|
-
),
|
|
694
|
-
registerReactivity: (keys) =>
|
|
695
|
-
Effect.sync(() => {
|
|
696
|
-
Object.assign(reactivityKeys, keys)
|
|
697
|
-
}),
|
|
698
809
|
destroy: journal.destroy
|
|
699
810
|
})
|
|
700
811
|
})
|
|
@@ -703,19 +814,29 @@ const make = Effect.gen(function*() {
|
|
|
703
814
|
* @since 4.0.0
|
|
704
815
|
* @category layers
|
|
705
816
|
*/
|
|
706
|
-
export const layerEventLog: Layer.Layer<EventLog, never, EventJournal | Identity> = Layer.effect(
|
|
707
|
-
|
|
817
|
+
export const layerEventLog: Layer.Layer<EventLog | Registry, never, EventJournal | Identity> = Layer.effect(
|
|
818
|
+
EventLog,
|
|
819
|
+
make
|
|
820
|
+
).pipe(
|
|
821
|
+
Layer.provide(ReactivityLayer.layer),
|
|
822
|
+
Layer.provideMerge(layerRegistry)
|
|
708
823
|
)
|
|
709
824
|
|
|
710
825
|
/**
|
|
711
826
|
* @since 4.0.0
|
|
712
827
|
* @category layers
|
|
713
828
|
*/
|
|
714
|
-
export const layer = <Groups extends EventGroup.Any>(
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
829
|
+
export const layer = <Groups extends EventGroup.Any, E, R>(
|
|
830
|
+
_schema: EventLogSchema<Groups>,
|
|
831
|
+
layer: Layer.Layer<EventGroup.ToService<Groups>, E, R>
|
|
832
|
+
): Layer.Layer<
|
|
833
|
+
EventLog | Registry,
|
|
834
|
+
E,
|
|
835
|
+
Exclude<R, EventLog | Registry> | EventJournal | Identity
|
|
836
|
+
> =>
|
|
837
|
+
layer.pipe(
|
|
838
|
+
Layer.provideMerge(layerEventLog)
|
|
839
|
+
)
|
|
719
840
|
|
|
720
841
|
/**
|
|
721
842
|
* @since 4.0.0
|