effect 4.0.0-beta.30 → 4.0.0-beta.32
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/Array.d.ts +87 -86
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +47 -40
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +46 -45
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +35 -38
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts +39 -32
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +32 -29
- package/dist/BigInt.js.map +1 -1
- package/dist/Channel.d.ts +2 -2
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js.map +1 -1
- package/dist/Chunk.d.ts +58 -57
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +20 -21
- package/dist/Chunk.js.map +1 -1
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +4 -1
- package/dist/Config.js.map +1 -1
- package/dist/Cron.d.ts +3 -6
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +11 -18
- package/dist/Cron.js.map +1 -1
- package/dist/DateTime.d.ts +49 -92
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +9 -9
- package/dist/DateTime.js.map +1 -1
- package/dist/Deferred.d.ts +7 -5
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +7 -5
- package/dist/Deferred.js.map +1 -1
- package/dist/Duration.d.ts +55 -25
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +100 -70
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +3 -4
- package/dist/Effect.js.map +1 -1
- package/dist/Fiber.d.ts +2 -1
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.d.ts +9 -8
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +8 -7
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +20 -19
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +6 -6
- package/dist/FiberMap.js.map +1 -1
- package/dist/FileSystem.d.ts +17 -16
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +10 -7
- package/dist/FileSystem.js.map +1 -1
- package/dist/Graph.d.ts +64 -64
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +53 -53
- package/dist/Graph.js.map +1 -1
- package/dist/HashMap.d.ts +11 -5
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashMap.js +3 -1
- package/dist/HashMap.js.map +1 -1
- package/dist/Iterable.d.ts +11 -11
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +12 -12
- package/dist/Iterable.js.map +1 -1
- package/dist/Latch.d.ts +69 -3
- package/dist/Latch.d.ts.map +1 -1
- package/dist/Latch.js +58 -0
- package/dist/Latch.js.map +1 -1
- package/dist/Layer.d.ts +181 -2
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +35 -2
- package/dist/Layer.js.map +1 -1
- package/dist/Number.d.ts +74 -18
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +34 -15
- package/dist/Number.js.map +1 -1
- package/dist/Option.d.ts +2 -0
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js.map +1 -1
- package/dist/PartitionedSemaphore.d.ts +183 -0
- package/dist/PartitionedSemaphore.d.ts.map +1 -0
- package/dist/PartitionedSemaphore.js +231 -0
- package/dist/PartitionedSemaphore.js.map +1 -0
- package/dist/PubSub.d.ts +5 -4
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +6 -5
- package/dist/PubSub.js.map +1 -1
- package/dist/Queue.d.ts +3 -3
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +2 -2
- package/dist/Queue.js.map +1 -1
- package/dist/Record.d.ts +40 -40
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +16 -15
- package/dist/Record.js.map +1 -1
- package/dist/Scheduler.d.ts +25 -123
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +20 -123
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +2346 -114
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +1359 -68
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +2 -2
- package/dist/SchemaAST.js +2 -2
- package/dist/SchemaGetter.js +6 -4
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +2 -2
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +32 -27
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/Semaphore.d.ts +149 -53
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js +137 -117
- package/dist/Semaphore.js.map +1 -1
- package/dist/ServiceMap.d.ts +26 -0
- package/dist/ServiceMap.d.ts.map +1 -1
- package/dist/ServiceMap.js +36 -21
- package/dist/ServiceMap.js.map +1 -1
- package/dist/Stream.js +1 -1
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +114 -47
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +29 -47
- package/dist/String.js.map +1 -1
- package/dist/SubscriptionRef.d.ts +1 -2
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +81 -115
- package/dist/SubscriptionRef.js.map +1 -1
- package/dist/Terminal.d.ts +2 -1
- package/dist/Terminal.d.ts.map +1 -1
- package/dist/Terminal.js.map +1 -1
- package/dist/Tracer.d.ts +5 -4
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +2 -1
- package/dist/Tracer.js.map +1 -1
- package/dist/Trie.d.ts +26 -14
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Trie.js +8 -4
- package/dist/Trie.js.map +1 -1
- package/dist/TxHashMap.d.ts +77 -59
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js +25 -19
- package/dist/TxHashMap.js.map +1 -1
- package/dist/TxSemaphore.d.ts +162 -2
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +16 -2
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/index.d.ts +88 -32
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +88 -32
- package/dist/index.js.map +1 -1
- package/dist/internal/dateTime.js +66 -59
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/effect.js +21 -90
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/hashMap.js +2 -1
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/option.js +6 -0
- package/dist/internal/option.js.map +1 -1
- package/dist/internal/trie.js +3 -3
- package/dist/internal/trie.js.map +1 -1
- package/dist/unstable/ai/AiError.js +1 -1
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +4 -0
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +3 -4
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +2 -2
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +30 -16
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +10 -87
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +4 -0
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +14 -0
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +13 -0
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/cli/Argument.d.ts +2 -4
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js +1 -3
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/CliOutput.d.ts +3 -2
- package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
- package/dist/unstable/cli/CliOutput.js +4 -3
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +3 -2
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +3 -3
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Completions.d.ts +16 -0
- package/dist/unstable/cli/Completions.d.ts.map +1 -0
- package/dist/unstable/cli/Completions.js +23 -0
- package/dist/unstable/cli/Completions.js.map +1 -0
- package/dist/unstable/cli/Flag.d.ts +2 -2
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js +1 -1
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -1
- package/dist/unstable/cli/GlobalFlag.js +4 -4
- package/dist/unstable/cli/GlobalFlag.js.map +1 -1
- package/dist/unstable/cli/HelpDoc.d.ts +14 -12
- package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
- package/dist/unstable/cli/Param.d.ts +4 -4
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +7 -7
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +1 -1
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/Prompt.js +71 -67
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/index.d.ts +4 -0
- package/dist/unstable/cli/index.d.ts.map +1 -1
- package/dist/unstable/cli/index.js +4 -0
- package/dist/unstable/cli/index.js.map +1 -1
- package/dist/unstable/cli/internal/completions/CommandDescriptor.js +9 -2
- package/dist/unstable/cli/internal/completions/CommandDescriptor.js.map +1 -1
- package/dist/unstable/cli/internal/parser.js +8 -3
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +3 -2
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +25 -23
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/DeliverAt.js +1 -1
- package/dist/unstable/cluster/DeliverAt.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +3 -2
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +7 -7
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +4 -3
- package/dist/unstable/cluster/Message.d.ts.map +1 -1
- package/dist/unstable/cluster/Message.js +3 -2
- package/dist/unstable/cluster/Message.js.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts +10 -10
- package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/MessageStorage.js +12 -12
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts +2 -1
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +4 -3
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.js +9 -8
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +2 -1
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +7 -6
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +19 -13
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +5 -4
- package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.js +4 -4
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +19 -18
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +9 -10
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.d.ts +2 -1
- package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.js +1 -4
- package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
- package/dist/unstable/encoding/Ndjson.d.ts +8 -8
- package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
- package/dist/unstable/encoding/Ndjson.js.map +1 -1
- package/dist/unstable/http/Cookies.d.ts +5 -4
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +3 -4
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Etag.d.ts.map +1 -1
- package/dist/unstable/http/Etag.js +5 -1
- package/dist/unstable/http/Etag.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts +3 -2
- package/dist/unstable/http/Headers.d.ts.map +1 -1
- package/dist/unstable/http/Headers.js +2 -1
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +2 -1
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts +4 -3
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +8 -6
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientResponse.js +2 -1
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.d.ts +3 -2
- package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +16 -15
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
- package/dist/unstable/http/HttpPlatform.js +3 -2
- package/dist/unstable/http/HttpPlatform.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +2 -1
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js +7 -7
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- 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 +2 -1
- package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerError.js +2 -1
- package/dist/unstable/http/HttpServerError.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts +3 -2
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +14 -10
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +4 -3
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpTraceContext.d.ts +3 -2
- package/dist/unstable/http/HttpTraceContext.d.ts.map +1 -1
- package/dist/unstable/http/HttpTraceContext.js +27 -15
- package/dist/unstable/http/HttpTraceContext.js.map +1 -1
- package/dist/unstable/http/UrlParams.d.ts +5 -4
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +5 -6
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +2 -2
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +4 -2
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +15 -0
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.js +81 -3
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +2 -2
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js +7 -3
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/persistence/Persistable.js +1 -1
- package/dist/unstable/persistence/Persistable.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +1 -5
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +4 -2
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js +4 -3
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +4 -4
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcGroup.d.ts +1 -3
- package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSchema.js +3 -2
- package/dist/unstable/rpc/RpcSchema.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +4 -1
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +3 -2
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +2 -1
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +1 -1
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.js +6 -6
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +2 -1
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +5 -4
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +19 -14
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/package.json +1 -1
- package/src/Array.ts +112 -105
- package/src/BigDecimal.ts +63 -66
- package/src/BigInt.ts +49 -41
- package/src/Channel.ts +3 -3
- package/src/Chunk.ts +68 -63
- package/src/Config.ts +4 -1
- package/src/Cron.ts +13 -18
- package/src/DateTime.ts +51 -92
- package/src/Deferred.ts +8 -6
- package/src/Duration.ts +112 -56
- package/src/Effect.ts +3 -4
- package/src/Fiber.ts +2 -1
- package/src/FiberHandle.ts +10 -9
- package/src/FiberMap.ts +22 -22
- package/src/FileSystem.ts +25 -22
- package/src/Graph.ts +105 -105
- package/src/HashMap.ts +11 -5
- package/src/Iterable.ts +13 -13
- package/src/Latch.ts +85 -3
- package/src/Layer.ts +244 -19
- package/src/Number.ts +85 -26
- package/src/Option.ts +2 -0
- package/src/PartitionedSemaphore.ts +414 -0
- package/src/PubSub.ts +7 -6
- package/src/Queue.ts +5 -5
- package/src/Record.ts +52 -47
- package/src/Scheduler.ts +37 -126
- package/src/Schema.ts +2366 -116
- package/src/SchemaAST.ts +2 -2
- package/src/SchemaGetter.ts +4 -4
- package/src/SchemaRepresentation.ts +2 -2
- package/src/SchemaTransformation.ts +27 -27
- package/src/Semaphore.ts +271 -183
- package/src/ServiceMap.ts +83 -31
- package/src/Stream.ts +1 -1
- package/src/String.ts +122 -69
- package/src/SubscriptionRef.ts +96 -117
- package/src/Terminal.ts +2 -1
- package/src/Tracer.ts +6 -5
- package/src/Trie.ts +26 -14
- package/src/TxHashMap.ts +78 -60
- package/src/TxSemaphore.ts +186 -11
- package/src/index.ts +89 -33
- package/src/internal/dateTime.ts +74 -65
- package/src/internal/effect.ts +30 -122
- package/src/internal/hashMap.ts +4 -3
- package/src/internal/option.ts +7 -0
- package/src/internal/trie.ts +6 -6
- package/src/unstable/ai/AiError.ts +1 -1
- package/src/unstable/ai/AnthropicStructuredOutput.ts +4 -0
- package/src/unstable/ai/Chat.ts +17 -15
- package/src/unstable/ai/LanguageModel.ts +148 -97
- package/src/unstable/ai/OpenAiStructuredOutput.ts +4 -0
- package/src/unstable/ai/Tool.ts +20 -0
- package/src/unstable/cli/Argument.ts +2 -4
- package/src/unstable/cli/CliOutput.ts +7 -5
- package/src/unstable/cli/Command.ts +5 -5
- package/src/unstable/cli/Completions.ts +36 -0
- package/src/unstable/cli/Flag.ts +2 -2
- package/src/unstable/cli/GlobalFlag.ts +4 -5
- package/src/unstable/cli/HelpDoc.ts +14 -12
- package/src/unstable/cli/Param.ts +15 -11
- package/src/unstable/cli/Primitive.ts +1 -1
- package/src/unstable/cli/Prompt.ts +81 -83
- package/src/unstable/cli/index.ts +5 -0
- package/src/unstable/cli/internal/completions/CommandDescriptor.ts +3 -2
- package/src/unstable/cli/internal/parser.ts +7 -4
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +35 -30
- package/src/unstable/cluster/DeliverAt.ts +1 -1
- package/src/unstable/cluster/Entity.ts +13 -12
- package/src/unstable/cluster/Message.ts +6 -5
- package/src/unstable/cluster/MessageStorage.ts +26 -25
- package/src/unstable/cluster/Reply.ts +7 -4
- package/src/unstable/cluster/RunnerServer.ts +10 -13
- package/src/unstable/cluster/Runners.ts +8 -7
- package/src/unstable/cluster/Sharding.ts +24 -17
- package/src/unstable/cluster/ShardingConfig.ts +6 -6
- package/src/unstable/cluster/SqlMessageStorage.ts +21 -18
- package/src/unstable/cluster/internal/entityManager.ts +27 -21
- package/src/unstable/devtools/DevToolsSchema.ts +3 -2
- package/src/unstable/encoding/Ndjson.ts +17 -17
- package/src/unstable/http/Cookies.ts +7 -8
- package/src/unstable/http/Etag.ts +5 -3
- package/src/unstable/http/Headers.ts +6 -5
- package/src/unstable/http/HttpClient.ts +2 -1
- package/src/unstable/http/HttpClientRequest.ts +11 -9
- package/src/unstable/http/HttpClientResponse.ts +5 -4
- package/src/unstable/http/HttpIncomingMessage.ts +3 -2
- package/src/unstable/http/HttpMiddleware.ts +16 -15
- package/src/unstable/http/HttpPlatform.ts +3 -2
- package/src/unstable/http/HttpRouter.ts +9 -9
- package/src/unstable/http/HttpServer.ts +3 -9
- package/src/unstable/http/HttpServerError.ts +3 -2
- package/src/unstable/http/HttpServerRequest.ts +29 -25
- package/src/unstable/http/HttpServerResponse.ts +7 -6
- package/src/unstable/http/HttpTraceContext.ts +31 -17
- package/src/unstable/http/UrlParams.ts +11 -14
- package/src/unstable/httpapi/HttpApiBuilder.ts +13 -7
- package/src/unstable/httpapi/HttpApiError.ts +67 -12
- package/src/unstable/observability/OtlpExporter.ts +5 -2
- package/src/unstable/observability/OtlpTracer.ts +8 -4
- package/src/unstable/persistence/Persistable.ts +1 -1
- package/src/unstable/reactivity/Atom.ts +1 -4
- package/src/unstable/reactivity/AtomRegistry.ts +5 -3
- package/src/unstable/rpc/Rpc.ts +4 -3
- package/src/unstable/rpc/RpcClient.ts +10 -9
- package/src/unstable/rpc/RpcGroup.ts +3 -3
- package/src/unstable/rpc/RpcSchema.ts +6 -5
- package/src/unstable/rpc/RpcSerialization.ts +4 -1
- package/src/unstable/rpc/RpcServer.ts +3 -3
- package/src/unstable/socket/Socket.ts +2 -1
- package/src/unstable/sql/SqlClient.ts +5 -3
- package/src/unstable/workflow/DurableDeferred.ts +6 -6
- package/src/unstable/workflow/Workflow.ts +1 -1
- package/src/unstable/workflow/WorkflowEngine.ts +29 -20
- package/dist/NullOr.d.ts +0 -149
- package/dist/NullOr.d.ts.map +0 -1
- package/dist/NullOr.js +0 -152
- package/dist/NullOr.js.map +0 -1
- package/dist/unstable/cli/internal/completions/Completions.d.ts +0 -2
- package/dist/unstable/cli/internal/completions/Completions.d.ts.map +0 -1
- package/dist/unstable/cli/internal/completions/Completions.js +0 -23
- package/dist/unstable/cli/internal/completions/Completions.js.map +0 -1
- package/src/NullOr.ts +0 -204
- package/src/unstable/cli/internal/completions/Completions.ts +0 -31
|
@@ -199,6 +199,7 @@ interface EntityManagerState {
|
|
|
199
199
|
|
|
200
200
|
const make = Effect.gen(function*() {
|
|
201
201
|
const config = yield* ShardingConfig
|
|
202
|
+
const getRunnerAddress = () => Option.getOrUndefined(config.runnerAddress)
|
|
202
203
|
const clock = yield* Clock
|
|
203
204
|
|
|
204
205
|
const runnersService = yield* Runners
|
|
@@ -228,7 +229,10 @@ const make = Effect.gen(function*() {
|
|
|
228
229
|
const events = yield* PubSub.unbounded<ShardingRegistrationEvent>()
|
|
229
230
|
const getRegistrationEvents: Stream.Stream<ShardingRegistrationEvent> = Stream.fromPubSub(events)
|
|
230
231
|
|
|
231
|
-
const isLocalRunner = (address: RunnerAddress) =>
|
|
232
|
+
const isLocalRunner = (address: RunnerAddress) => {
|
|
233
|
+
const runnerAddress = getRunnerAddress()
|
|
234
|
+
return runnerAddress !== undefined && Equal.equals(address, runnerAddress)
|
|
235
|
+
}
|
|
232
236
|
|
|
233
237
|
function getShardId(entityId: EntityId, group: string): ShardId {
|
|
234
238
|
const id = Math.abs(hashString(entityId) % config.shardsPerGroup) + 1
|
|
@@ -254,8 +258,9 @@ const make = Effect.gen(function*() {
|
|
|
254
258
|
// allow them to move to another runner.
|
|
255
259
|
|
|
256
260
|
const releasingShards = MutableHashSet.empty<ShardId>()
|
|
257
|
-
|
|
258
|
-
|
|
261
|
+
const initialRunnerAddress = getRunnerAddress()
|
|
262
|
+
if (initialRunnerAddress) {
|
|
263
|
+
const selfAddress = initialRunnerAddress
|
|
259
264
|
yield* Scope.addFinalizerExit(shardingScope, () => {
|
|
260
265
|
// the locks expire over time, so if this fails we ignore it
|
|
261
266
|
return Effect.ignore(runnerStorage.releaseAll(selfAddress))
|
|
@@ -437,8 +442,8 @@ const make = Effect.gen(function*() {
|
|
|
437
442
|
const storageReadLock = Semaphore.makeUnsafe(1)
|
|
438
443
|
const withStorageReadLock = storageReadLock.withPermits(1)
|
|
439
444
|
|
|
440
|
-
if (storageEnabled &&
|
|
441
|
-
const selfAddress =
|
|
445
|
+
if (storageEnabled && initialRunnerAddress) {
|
|
446
|
+
const selfAddress = initialRunnerAddress
|
|
442
447
|
const entityRegistrationTimeoutMillis = Duration.toMillis(
|
|
443
448
|
Duration.fromInputUnsafe(config.entityRegistrationTimeout)
|
|
444
449
|
)
|
|
@@ -824,7 +829,7 @@ const make = Effect.gen(function*() {
|
|
|
824
829
|
if (isPersisted) {
|
|
825
830
|
return runnerIsLocal
|
|
826
831
|
? notifyLocal(message, discard)
|
|
827
|
-
: runnersService.notify({ address:
|
|
832
|
+
: runnersService.notify({ address: maybeRunner, message, discard })
|
|
828
833
|
} else if (Option.isNone(maybeRunner)) {
|
|
829
834
|
return Effect.fail(new EntityNotAssignedToRunner({ address }))
|
|
830
835
|
}
|
|
@@ -860,9 +865,9 @@ const make = Effect.gen(function*() {
|
|
|
860
865
|
// shard assignments for outgoing messages (they could still be in use by
|
|
861
866
|
// entities that are shutting down).
|
|
862
867
|
|
|
863
|
-
const selfRunner =
|
|
868
|
+
const selfRunner = initialRunnerAddress ?
|
|
864
869
|
new Runner({
|
|
865
|
-
address:
|
|
870
|
+
address: initialRunnerAddress,
|
|
866
871
|
groups: config.shardGroups,
|
|
867
872
|
weight: config.runnerShardWeight
|
|
868
873
|
}) :
|
|
@@ -985,7 +990,7 @@ const make = Effect.gen(function*() {
|
|
|
985
990
|
Effect.annotateLogs({
|
|
986
991
|
module: "effect/cluster/Sharding",
|
|
987
992
|
fiber: "RunnerStorage sync",
|
|
988
|
-
runner:
|
|
993
|
+
runner: initialRunnerAddress
|
|
989
994
|
}),
|
|
990
995
|
Effect.forkIn(shardingScope)
|
|
991
996
|
)
|
|
@@ -1046,7 +1051,7 @@ const make = Effect.gen(function*() {
|
|
|
1046
1051
|
spanId: options.message.spanId,
|
|
1047
1052
|
sampled: options.message.sampled
|
|
1048
1053
|
}),
|
|
1049
|
-
lastReceivedReply:
|
|
1054
|
+
lastReceivedReply: Option.none(),
|
|
1050
1055
|
rpc,
|
|
1051
1056
|
services: fiber.services as ServiceMap.ServiceMap<any>,
|
|
1052
1057
|
respond
|
|
@@ -1259,7 +1264,8 @@ const make = Effect.gen(function*() {
|
|
|
1259
1264
|
|
|
1260
1265
|
const registerEntity: Sharding["Service"]["registerEntity"] = Effect.fnUntraced(
|
|
1261
1266
|
function*(entity, build, options) {
|
|
1262
|
-
|
|
1267
|
+
const runnerAddress = getRunnerAddress()
|
|
1268
|
+
if (!runnerAddress || entityManagers.has(entity.type)) return
|
|
1263
1269
|
const scope = yield* Effect.scope
|
|
1264
1270
|
yield* Scope.addFinalizer(
|
|
1265
1271
|
scope,
|
|
@@ -1270,14 +1276,15 @@ const make = Effect.gen(function*() {
|
|
|
1270
1276
|
const manager = yield* EntityManager.make(entity, build, {
|
|
1271
1277
|
...options,
|
|
1272
1278
|
storage,
|
|
1273
|
-
runnerAddress
|
|
1279
|
+
runnerAddress,
|
|
1274
1280
|
sharding
|
|
1275
1281
|
}).pipe(
|
|
1276
|
-
Effect.provideServices(
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1282
|
+
Effect.provideServices(ServiceMap.mutate(services, (services) =>
|
|
1283
|
+
services.pipe(
|
|
1284
|
+
ServiceMap.add(EntityReaper, reaper),
|
|
1285
|
+
ServiceMap.add(Scope.Scope, scope),
|
|
1286
|
+
ServiceMap.add(Snowflake.Generator, snowflakeGen)
|
|
1287
|
+
)))
|
|
1281
1288
|
) as Effect.Effect<EntityManager.EntityManager>
|
|
1282
1289
|
const state: EntityManagerState = {
|
|
1283
1290
|
entity,
|
|
@@ -25,13 +25,13 @@ export class ShardingConfig extends ServiceMap.Service<ShardingConfig, {
|
|
|
25
25
|
* If `None`, the runner is not part of the cluster and will be in a client-only
|
|
26
26
|
* mode.
|
|
27
27
|
*/
|
|
28
|
-
readonly runnerAddress: RunnerAddress
|
|
28
|
+
readonly runnerAddress: Option.Option<RunnerAddress>
|
|
29
29
|
/**
|
|
30
30
|
* The listen address for the current runner.
|
|
31
31
|
*
|
|
32
32
|
* Defaults to the `runnerAddress`.
|
|
33
33
|
*/
|
|
34
|
-
readonly runnerListenAddress: RunnerAddress
|
|
34
|
+
readonly runnerListenAddress: Option.Option<RunnerAddress>
|
|
35
35
|
/**
|
|
36
36
|
* A number that determines how many shards this runner will be assigned
|
|
37
37
|
* relative to other runners.
|
|
@@ -129,8 +129,8 @@ const defaultRunnerAddress = RunnerAddress.makeUnsafe({ host: "localhost", port:
|
|
|
129
129
|
* @category defaults
|
|
130
130
|
*/
|
|
131
131
|
export const defaults: ShardingConfig["Service"] = {
|
|
132
|
-
runnerAddress: defaultRunnerAddress,
|
|
133
|
-
runnerListenAddress:
|
|
132
|
+
runnerAddress: Option.some(defaultRunnerAddress),
|
|
133
|
+
runnerListenAddress: Option.none(),
|
|
134
134
|
runnerShardWeight: 1,
|
|
135
135
|
shardsPerGroup: 300,
|
|
136
136
|
shardGroups: ["default"],
|
|
@@ -177,7 +177,7 @@ export const config: Config.Config<ShardingConfig["Service"]> = Config.all({
|
|
|
177
177
|
Config.withDefault(defaultRunnerAddress.port)
|
|
178
178
|
// Config.withDescription("The port used for inter-runner communication.")
|
|
179
179
|
)
|
|
180
|
-
}).pipe(Config.map((options) => RunnerAddress.makeUnsafe(options)), Config.option
|
|
180
|
+
}).pipe(Config.map((options) => RunnerAddress.makeUnsafe(options)), Config.option),
|
|
181
181
|
runnerListenAddress: Config.all({
|
|
182
182
|
host: Config.string("listenHost"),
|
|
183
183
|
// Config.withDescription("The host to listen on.")
|
|
@@ -185,7 +185,7 @@ export const config: Config.Config<ShardingConfig["Service"]> = Config.all({
|
|
|
185
185
|
Config.withDefault(defaultRunnerAddress.port)
|
|
186
186
|
// Config.withDescription("The port to listen on.")
|
|
187
187
|
)
|
|
188
|
-
}).pipe(Config.map((options) => RunnerAddress.makeUnsafe(options)), Config.option
|
|
188
|
+
}).pipe(Config.map((options) => RunnerAddress.makeUnsafe(options)), Config.option),
|
|
189
189
|
runnerShardWeight: Config.int("runnerShardWeight").pipe(
|
|
190
190
|
Config.withDefault(defaults.runnerShardWeight)
|
|
191
191
|
// Config.withDescription("A number that determines how many shards this runner will be assigned relative to other runners.")
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
import * as Arr from "../../Array.ts"
|
|
5
5
|
import * as Effect from "../../Effect.ts"
|
|
6
6
|
import * as Layer from "../../Layer.ts"
|
|
7
|
+
import * as Option from "../../Option.ts"
|
|
7
8
|
import * as Schedule from "../../Schedule.ts"
|
|
8
|
-
import * as UndefinedOr from "../../UndefinedOr.ts"
|
|
9
9
|
import * as Migrator from "../sql/Migrator.ts"
|
|
10
10
|
import * as SqlClient from "../sql/SqlClient.ts"
|
|
11
11
|
import type { Row } from "../sql/SqlConnection.ts"
|
|
@@ -138,7 +138,7 @@ export const make: (options?: {
|
|
|
138
138
|
|
|
139
139
|
const messageFromRow = (row: MessageRow & ReplyJoinRow): {
|
|
140
140
|
readonly envelope: Envelope.Encoded
|
|
141
|
-
readonly lastSentReply: Reply.Encoded
|
|
141
|
+
readonly lastSentReply: Option.Option<Reply.Encoded>
|
|
142
142
|
} => {
|
|
143
143
|
switch (Number(row.kind) as 0 | 1 | 2) {
|
|
144
144
|
case 0:
|
|
@@ -163,14 +163,14 @@ export const make: (options?: {
|
|
|
163
163
|
undefined)
|
|
164
164
|
},
|
|
165
165
|
lastSentReply: row.reply_reply_id ?
|
|
166
|
-
{
|
|
166
|
+
Option.some({
|
|
167
167
|
_tag: "Chunk",
|
|
168
168
|
id: String(row.reply_reply_id),
|
|
169
169
|
requestId: String(row.request_id),
|
|
170
170
|
sequence: Number(row.reply_sequence!),
|
|
171
171
|
values: JSON.parse(row.reply_payload!)
|
|
172
|
-
} :
|
|
173
|
-
|
|
172
|
+
}) :
|
|
173
|
+
Option.none()
|
|
174
174
|
}
|
|
175
175
|
case 1:
|
|
176
176
|
return {
|
|
@@ -185,7 +185,7 @@ export const make: (options?: {
|
|
|
185
185
|
entityId: row.entity_id
|
|
186
186
|
}
|
|
187
187
|
},
|
|
188
|
-
lastSentReply:
|
|
188
|
+
lastSentReply: Option.none()
|
|
189
189
|
}
|
|
190
190
|
case 2:
|
|
191
191
|
return {
|
|
@@ -199,7 +199,7 @@ export const make: (options?: {
|
|
|
199
199
|
entityId: row.entity_id
|
|
200
200
|
}
|
|
201
201
|
},
|
|
202
|
-
lastSentReply:
|
|
202
|
+
lastSentReply: Option.none()
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
}
|
|
@@ -395,24 +395,27 @@ export const make: (options?: {
|
|
|
395
395
|
}
|
|
396
396
|
const row = rows[0]
|
|
397
397
|
const replyKindNum = typeof row.reply_kind === "bigint" ? Number(row.reply_kind) : row.reply_kind
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
{
|
|
398
|
+
const lastReceivedReply: Option.Option<Reply.Encoded> = row.reply_id
|
|
399
|
+
? Option.some(
|
|
400
|
+
replyKindNum === replyKind.WithExit
|
|
401
|
+
? {
|
|
403
402
|
id: String(row.reply_id),
|
|
404
403
|
requestId: String(row.id),
|
|
405
404
|
_tag: "WithExit",
|
|
406
405
|
exit: JSON.parse(row.reply_payload as string)
|
|
407
|
-
}
|
|
408
|
-
{
|
|
406
|
+
}
|
|
407
|
+
: {
|
|
409
408
|
id: String(row.reply_id),
|
|
410
409
|
requestId: String(row.id),
|
|
411
410
|
_tag: "Chunk",
|
|
412
411
|
sequence: Number(row.reply_sequence),
|
|
413
412
|
values: JSON.parse(row.reply_payload as string)
|
|
414
|
-
}
|
|
415
|
-
|
|
413
|
+
}
|
|
414
|
+
)
|
|
415
|
+
: Option.none()
|
|
416
|
+
return SaveResultEncoded.Duplicate({
|
|
417
|
+
originalId: Snowflake.Snowflake(row.id as any),
|
|
418
|
+
lastReceivedReply
|
|
416
419
|
})
|
|
417
420
|
})
|
|
418
421
|
)
|
|
@@ -455,7 +458,7 @@ export const make: (options?: {
|
|
|
455
458
|
|
|
456
459
|
requestIdForPrimaryKey: (primaryKey) =>
|
|
457
460
|
sql<{ id: string | bigint }>`SELECT id FROM ${messagesTableSql} WHERE message_id = ${primaryKey}`.pipe(
|
|
458
|
-
Effect.map((rows) =>
|
|
461
|
+
Effect.map((rows) => Option.map(Option.fromNullishOr(rows[0]?.id), Snowflake.Snowflake)),
|
|
459
462
|
Effect.provideService(SqlClient.SafeIntegers, true),
|
|
460
463
|
PersistenceError.refail,
|
|
461
464
|
withTracerDisabled
|
|
@@ -506,7 +509,7 @@ export const make: (options?: {
|
|
|
506
509
|
}
|
|
507
510
|
const messages: Array<{
|
|
508
511
|
readonly envelope: Envelope.Encoded
|
|
509
|
-
readonly lastSentReply: Reply.Encoded
|
|
512
|
+
readonly lastSentReply: Option.Option<Reply.Encoded>
|
|
510
513
|
}> = new Array(rows.length)
|
|
511
514
|
const ids = new Array<string>(rows.length)
|
|
512
515
|
for (let i = 0; i < rows.length; i++) {
|
|
@@ -17,7 +17,6 @@ import * as Schema from "../../../Schema.ts"
|
|
|
17
17
|
import * as Issue from "../../../SchemaIssue.ts"
|
|
18
18
|
import * as Scope from "../../../Scope.ts"
|
|
19
19
|
import * as ServiceMap from "../../../ServiceMap.ts"
|
|
20
|
-
import * as UndefinedOr from "../../../UndefinedOr.ts"
|
|
21
20
|
import type * as Rpc from "../../rpc/Rpc.ts"
|
|
22
21
|
import { RequestId } from "../../rpc/RpcMessage.ts"
|
|
23
22
|
import * as RpcServer from "../../rpc/RpcServer.ts"
|
|
@@ -71,7 +70,7 @@ export type EntityState = {
|
|
|
71
70
|
readonly rpc: Rpc.AnyWithProps
|
|
72
71
|
readonly message: Message.IncomingRequestLocal<any>
|
|
73
72
|
sentReply: boolean
|
|
74
|
-
lastSentChunk: Reply.Chunk<Rpc.Any
|
|
73
|
+
lastSentChunk: Option.Option<Reply.Chunk<Rpc.Any>>
|
|
75
74
|
sequence: number
|
|
76
75
|
}>
|
|
77
76
|
lastActiveCheck: number
|
|
@@ -156,12 +155,13 @@ export const make = Effect.fnUntraced(function*<
|
|
|
156
155
|
// Initiate the behavior for the entity
|
|
157
156
|
const handlers = yield* (entity.protocol.toHandlers(buildHandlers as any).pipe(
|
|
158
157
|
Effect.provideService(CurrentLogAnnotations, {}),
|
|
159
|
-
Effect.provideServices(
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
158
|
+
Effect.provideServices(ServiceMap.mutate(services, (services) =>
|
|
159
|
+
services.pipe(
|
|
160
|
+
ServiceMap.add(CurrentAddress, address),
|
|
161
|
+
ServiceMap.add(CurrentRunnerAddress, options.runnerAddress),
|
|
162
|
+
ServiceMap.add(KeepAliveLatch, keepAliveLatch),
|
|
163
|
+
ServiceMap.add(Scope.Scope, scope)
|
|
164
|
+
)))
|
|
165
165
|
) as Effect.Effect<ServiceMap.ServiceMap<Rpc.ToHandler<Rpcs>>>)
|
|
166
166
|
|
|
167
167
|
const server = yield* RpcServer.makeNoSerialization(entity.protocol, {
|
|
@@ -251,7 +251,7 @@ export const make = Effect.fnUntraced(function*<
|
|
|
251
251
|
sequence,
|
|
252
252
|
values: response.values
|
|
253
253
|
})
|
|
254
|
-
request.lastSentChunk = reply
|
|
254
|
+
request.lastSentChunk = Option.some(reply)
|
|
255
255
|
return request.message.respond(reply)
|
|
256
256
|
})
|
|
257
257
|
))
|
|
@@ -438,10 +438,13 @@ export const make = Effect.fnUntraced(function*<
|
|
|
438
438
|
rpc,
|
|
439
439
|
message,
|
|
440
440
|
sentReply: false,
|
|
441
|
-
lastSentChunk:
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
441
|
+
lastSentChunk: Option.filter(
|
|
442
|
+
message.lastSentReply,
|
|
443
|
+
(reply): reply is Reply.Chunk<Rpc.Any> => reply._tag === "Chunk"
|
|
444
|
+
),
|
|
445
|
+
sequence: Option.match(message.lastSentReply, {
|
|
446
|
+
onNone: () => 0,
|
|
447
|
+
onSome: (reply) => reply._tag === "Chunk" ? reply.sequence + 1 : 0
|
|
445
448
|
})
|
|
446
449
|
}
|
|
447
450
|
server.activeRequests.set(message.envelope.requestId, entry)
|
|
@@ -450,7 +453,10 @@ export const make = Effect.fnUntraced(function*<
|
|
|
450
453
|
id: RequestId(message.envelope.requestId),
|
|
451
454
|
payload: new Request({
|
|
452
455
|
...message.envelope,
|
|
453
|
-
lastSentChunk:
|
|
456
|
+
lastSentChunk: Option.filter(
|
|
457
|
+
message.lastSentReply,
|
|
458
|
+
(reply): reply is Reply.Chunk<R> => reply._tag === "Chunk"
|
|
459
|
+
)
|
|
454
460
|
})
|
|
455
461
|
})
|
|
456
462
|
}
|
|
@@ -460,8 +466,8 @@ export const make = Effect.fnUntraced(function*<
|
|
|
460
466
|
return Effect.void
|
|
461
467
|
} else if (
|
|
462
468
|
message.envelope._tag === "AckChunk" &&
|
|
463
|
-
entry.lastSentChunk
|
|
464
|
-
message.envelope.replyId !== entry.lastSentChunk.id
|
|
469
|
+
Option.isSome(entry.lastSentChunk) &&
|
|
470
|
+
message.envelope.replyId !== entry.lastSentChunk.value.id
|
|
465
471
|
) {
|
|
466
472
|
return Effect.void
|
|
467
473
|
}
|
|
@@ -585,9 +591,9 @@ const makeMessageDecode = <Type extends string, Rpcs extends Rpc.Any>(
|
|
|
585
591
|
rpc: Rpc.AnyWithProps
|
|
586
592
|
) {
|
|
587
593
|
const payload = yield* Schema.decodeEffect(Schema.toCodecJson(rpc.payloadSchema))(message.envelope.payload)
|
|
588
|
-
const lastSentReply = message.lastSentReply
|
|
589
|
-
|
|
590
|
-
|
|
594
|
+
const lastSentReply = Option.isNone(message.lastSentReply) ?
|
|
595
|
+
message.lastSentReply :
|
|
596
|
+
Option.some(yield* Schema.decodeEffect(Reply.Reply(rpc))(message.lastSentReply.value))
|
|
591
597
|
return {
|
|
592
598
|
_tag: "IncomingRequest",
|
|
593
599
|
envelope: {
|
|
@@ -602,7 +608,7 @@ const makeMessageDecode = <Type extends string, Rpcs extends Rpc.Any>(
|
|
|
602
608
|
{
|
|
603
609
|
readonly _tag: "IncomingRequest"
|
|
604
610
|
readonly envelope: Envelope.Request.Any
|
|
605
|
-
readonly lastSentReply: Reply.Reply<Rpcs
|
|
611
|
+
readonly lastSentReply: Option.Option<Reply.Reply<Rpcs>>
|
|
606
612
|
} | {
|
|
607
613
|
readonly _tag: "IncomingEnvelope"
|
|
608
614
|
readonly envelope: Envelope.AckChunk | Envelope.Interrupt
|
|
@@ -627,7 +633,7 @@ const makeMessageDecode = <Type extends string, Rpcs extends Rpc.Any>(
|
|
|
627
633
|
{
|
|
628
634
|
readonly _tag: "IncomingRequest"
|
|
629
635
|
readonly envelope: Envelope.Request.Any
|
|
630
|
-
readonly lastSentReply: Reply.Reply<Rpcs
|
|
636
|
+
readonly lastSentReply: Option.Option<Reply.Reply<Rpcs>>
|
|
631
637
|
},
|
|
632
638
|
Schema.SchemaError,
|
|
633
639
|
Rpc.ServicesServer<Rpcs>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @since 4.0.0
|
|
3
3
|
*/
|
|
4
|
+
import type * as Option from "../../Option.ts"
|
|
4
5
|
import * as Schema from "../../Schema.ts"
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -80,7 +81,7 @@ export interface Span {
|
|
|
80
81
|
readonly sampled: boolean
|
|
81
82
|
readonly attributes: ReadonlyMap<string, unknown>
|
|
82
83
|
readonly status: SpanStatus
|
|
83
|
-
readonly parent: ParentSpan
|
|
84
|
+
readonly parent: Option.Option<ParentSpan>
|
|
84
85
|
}
|
|
85
86
|
|
|
86
87
|
/**
|
|
@@ -95,7 +96,7 @@ export const Span: Schema.Codec<Span> = Schema.Struct({
|
|
|
95
96
|
sampled: Schema.Boolean,
|
|
96
97
|
attributes: Schema.ReadonlyMap(Schema.String, Schema.Any),
|
|
97
98
|
status: SpanStatus,
|
|
98
|
-
parent: Schema.
|
|
99
|
+
parent: Schema.Option(Schema.suspend(() => ParentSpan))
|
|
99
100
|
})
|
|
100
101
|
|
|
101
102
|
/**
|
|
@@ -61,13 +61,13 @@ export const encodeString = <IE = never, Done = unknown>(): Channel.Channel<
|
|
|
61
61
|
* @category constructors
|
|
62
62
|
*/
|
|
63
63
|
export const encode = <IE = never, Done = unknown>(): Channel.Channel<
|
|
64
|
-
Arr.NonEmptyReadonlyArray<Uint8Array
|
|
64
|
+
Arr.NonEmptyReadonlyArray<Uint8Array>,
|
|
65
65
|
IE | NdjsonError,
|
|
66
66
|
Done,
|
|
67
67
|
Arr.NonEmptyReadonlyArray<unknown>,
|
|
68
68
|
IE,
|
|
69
69
|
Done
|
|
70
|
-
> => Channel.map(encodeString(), Arr.map((_) => encoder.encode(_)
|
|
70
|
+
> => Channel.map(encodeString(), Arr.map((_) => encoder.encode(_)))
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* @since 4.0.0
|
|
@@ -77,7 +77,7 @@ export const encodeSchema = <S extends Schema.Top>(
|
|
|
77
77
|
schema: S
|
|
78
78
|
) =>
|
|
79
79
|
<IE = never, Done = unknown>(): Channel.Channel<
|
|
80
|
-
Arr.NonEmptyReadonlyArray<Uint8Array
|
|
80
|
+
Arr.NonEmptyReadonlyArray<Uint8Array>,
|
|
81
81
|
NdjsonError | Schema.SchemaError | IE,
|
|
82
82
|
Done,
|
|
83
83
|
Arr.NonEmptyReadonlyArray<S["Type"]>,
|
|
@@ -141,7 +141,7 @@ export const decode = <IE = never, Done = unknown>(options?: {
|
|
|
141
141
|
Arr.NonEmptyReadonlyArray<unknown>,
|
|
142
142
|
IE | NdjsonError,
|
|
143
143
|
Done,
|
|
144
|
-
Arr.NonEmptyReadonlyArray<Uint8Array
|
|
144
|
+
Arr.NonEmptyReadonlyArray<Uint8Array>,
|
|
145
145
|
IE,
|
|
146
146
|
Done
|
|
147
147
|
> => {
|
|
@@ -161,7 +161,7 @@ export const decodeSchema = <S extends Schema.Top>(
|
|
|
161
161
|
Arr.NonEmptyReadonlyArray<S["Type"]>,
|
|
162
162
|
Schema.SchemaError | NdjsonError | IE,
|
|
163
163
|
Done,
|
|
164
|
-
Arr.NonEmptyReadonlyArray<Uint8Array
|
|
164
|
+
Arr.NonEmptyReadonlyArray<Uint8Array>,
|
|
165
165
|
IE,
|
|
166
166
|
Done,
|
|
167
167
|
S["DecodingServices"]
|
|
@@ -201,10 +201,10 @@ export const duplex: {
|
|
|
201
201
|
}
|
|
202
202
|
): <R, IE, OE, OutDone, InDone>(
|
|
203
203
|
self: Channel.Channel<
|
|
204
|
-
Arr.NonEmptyReadonlyArray<Uint8Array
|
|
204
|
+
Arr.NonEmptyReadonlyArray<Uint8Array>,
|
|
205
205
|
OE,
|
|
206
206
|
OutDone,
|
|
207
|
-
Arr.NonEmptyReadonlyArray<Uint8Array
|
|
207
|
+
Arr.NonEmptyReadonlyArray<Uint8Array>,
|
|
208
208
|
IE | NdjsonError,
|
|
209
209
|
InDone,
|
|
210
210
|
R
|
|
@@ -224,10 +224,10 @@ export const duplex: {
|
|
|
224
224
|
*/
|
|
225
225
|
<R, IE, OE, OutDone, InDone>(
|
|
226
226
|
self: Channel.Channel<
|
|
227
|
-
Arr.NonEmptyReadonlyArray<Uint8Array
|
|
227
|
+
Arr.NonEmptyReadonlyArray<Uint8Array>,
|
|
228
228
|
OE,
|
|
229
229
|
OutDone,
|
|
230
|
-
Arr.NonEmptyReadonlyArray<Uint8Array
|
|
230
|
+
Arr.NonEmptyReadonlyArray<Uint8Array>,
|
|
231
231
|
IE | NdjsonError,
|
|
232
232
|
InDone,
|
|
233
233
|
R
|
|
@@ -246,10 +246,10 @@ export const duplex: {
|
|
|
246
246
|
>
|
|
247
247
|
} = dual((args) => Channel.isChannel(args[0]), <R, IE, OE, OutDone, InDone>(
|
|
248
248
|
self: Channel.Channel<
|
|
249
|
-
Arr.NonEmptyReadonlyArray<Uint8Array
|
|
249
|
+
Arr.NonEmptyReadonlyArray<Uint8Array>,
|
|
250
250
|
OE,
|
|
251
251
|
OutDone,
|
|
252
|
-
Arr.NonEmptyReadonlyArray<Uint8Array
|
|
252
|
+
Arr.NonEmptyReadonlyArray<Uint8Array>,
|
|
253
253
|
IE | NdjsonError,
|
|
254
254
|
InDone,
|
|
255
255
|
R
|
|
@@ -373,10 +373,10 @@ export const duplexSchema: {
|
|
|
373
373
|
}
|
|
374
374
|
): <OutErr, OutDone, InErr, InDone, R>(
|
|
375
375
|
self: Channel.Channel<
|
|
376
|
-
Arr.NonEmptyReadonlyArray<Uint8Array
|
|
376
|
+
Arr.NonEmptyReadonlyArray<Uint8Array>,
|
|
377
377
|
OutErr,
|
|
378
378
|
OutDone,
|
|
379
|
-
Arr.NonEmptyReadonlyArray<Uint8Array
|
|
379
|
+
Arr.NonEmptyReadonlyArray<Uint8Array>,
|
|
380
380
|
NdjsonError | Schema.SchemaError | InErr,
|
|
381
381
|
InDone,
|
|
382
382
|
R
|
|
@@ -396,10 +396,10 @@ export const duplexSchema: {
|
|
|
396
396
|
*/
|
|
397
397
|
<Out extends Schema.Top, In extends Schema.Top, OutErr, OutDone, InErr, InDone, R>(
|
|
398
398
|
self: Channel.Channel<
|
|
399
|
-
Arr.NonEmptyReadonlyArray<Uint8Array
|
|
399
|
+
Arr.NonEmptyReadonlyArray<Uint8Array>,
|
|
400
400
|
OutErr,
|
|
401
401
|
OutDone,
|
|
402
|
-
Arr.NonEmptyReadonlyArray<Uint8Array
|
|
402
|
+
Arr.NonEmptyReadonlyArray<Uint8Array>,
|
|
403
403
|
NdjsonError | Schema.SchemaError | InErr,
|
|
404
404
|
InDone,
|
|
405
405
|
R
|
|
@@ -420,10 +420,10 @@ export const duplexSchema: {
|
|
|
420
420
|
>
|
|
421
421
|
} = dual(2, <Out extends Schema.Top, In extends Schema.Top, OutErr, OutDone, InErr, InDone, R>(
|
|
422
422
|
self: Channel.Channel<
|
|
423
|
-
Arr.NonEmptyReadonlyArray<Uint8Array
|
|
423
|
+
Arr.NonEmptyReadonlyArray<Uint8Array>,
|
|
424
424
|
OutErr,
|
|
425
425
|
OutDone,
|
|
426
|
-
Arr.NonEmptyReadonlyArray<Uint8Array
|
|
426
|
+
Arr.NonEmptyReadonlyArray<Uint8Array>,
|
|
427
427
|
NdjsonError | Schema.SchemaError | InErr,
|
|
428
428
|
InDone,
|
|
429
429
|
R
|
|
@@ -5,6 +5,7 @@ import * as Data from "../../Data.ts"
|
|
|
5
5
|
import * as Duration from "../../Duration.ts"
|
|
6
6
|
import { dual } from "../../Function.ts"
|
|
7
7
|
import * as Inspectable from "../../Inspectable.ts"
|
|
8
|
+
import * as Option from "../../Option.ts"
|
|
8
9
|
import { type Pipeable, pipeArguments } from "../../Pipeable.ts"
|
|
9
10
|
import * as Predicate from "../../Predicate.ts"
|
|
10
11
|
import * as Record from "../../Record.ts"
|
|
@@ -566,17 +567,17 @@ export const get: {
|
|
|
566
567
|
* @since 4.0.0
|
|
567
568
|
* @category combinators
|
|
568
569
|
*/
|
|
569
|
-
(name: string): (self: Cookies) => Cookie
|
|
570
|
+
(name: string): (self: Cookies) => Option.Option<Cookie>
|
|
570
571
|
/**
|
|
571
572
|
* Get a cookie from a Cookies object
|
|
572
573
|
*
|
|
573
574
|
* @since 4.0.0
|
|
574
575
|
* @category combinators
|
|
575
576
|
*/
|
|
576
|
-
(self: Cookies, name: string): Cookie
|
|
577
|
+
(self: Cookies, name: string): Option.Option<Cookie>
|
|
577
578
|
} = dual(
|
|
578
579
|
(args) => isCookies(args[0]),
|
|
579
|
-
(self: Cookies, name: string): Cookie
|
|
580
|
+
(self: Cookies, name: string): Option.Option<Cookie> => Option.fromUndefinedOr(self.cookies[name])
|
|
580
581
|
)
|
|
581
582
|
|
|
582
583
|
/**
|
|
@@ -592,19 +593,17 @@ export const getValue: {
|
|
|
592
593
|
* @since 4.0.0
|
|
593
594
|
* @category combinators
|
|
594
595
|
*/
|
|
595
|
-
(name: string): (self: Cookies) => string
|
|
596
|
+
(name: string): (self: Cookies) => Option.Option<string>
|
|
596
597
|
/**
|
|
597
598
|
* Get a cookie from a Cookies object
|
|
598
599
|
*
|
|
599
600
|
* @since 4.0.0
|
|
600
601
|
* @category combinators
|
|
601
602
|
*/
|
|
602
|
-
(self: Cookies, name: string): string
|
|
603
|
+
(self: Cookies, name: string): Option.Option<string>
|
|
603
604
|
} = dual(
|
|
604
605
|
(args) => isCookies(args[0]),
|
|
605
|
-
(self: Cookies, name: string): string
|
|
606
|
-
return self.cookies[name]?.value
|
|
607
|
-
}
|
|
606
|
+
(self: Cookies, name: string): Option.Option<string> => Option.map(get(self, name), (cookie) => cookie.value)
|
|
608
607
|
)
|
|
609
608
|
|
|
610
609
|
/**
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import * as Effect from "../../Effect.ts"
|
|
5
5
|
import type * as FileSystem from "../../FileSystem.ts"
|
|
6
6
|
import * as Layer from "../../Layer.ts"
|
|
7
|
+
import * as Option from "../../Option.ts"
|
|
7
8
|
import * as ServiceMap from "../../ServiceMap.ts"
|
|
8
9
|
import type * as Body from "./HttpBody.ts"
|
|
9
10
|
|
|
@@ -54,9 +55,10 @@ export class Generator extends ServiceMap.Service<Generator, {
|
|
|
54
55
|
}>()("effect/http/Etag/Generator") {}
|
|
55
56
|
|
|
56
57
|
const fromFileInfo = (info: FileSystem.File.Info) => {
|
|
57
|
-
const mtime = info.mtime
|
|
58
|
-
|
|
59
|
-
:
|
|
58
|
+
const mtime = Option.match(info.mtime, {
|
|
59
|
+
onNone: () => "0",
|
|
60
|
+
onSome: (mtime) => mtime.getTime().toString(16)
|
|
61
|
+
})
|
|
60
62
|
return `${info.size.toString(16)}-${mtime}`
|
|
61
63
|
}
|
|
62
64
|
|
|
@@ -6,6 +6,7 @@ import * as Equ from "../../Equivalence.ts"
|
|
|
6
6
|
import { dual } from "../../Function.ts"
|
|
7
7
|
import * as Hash from "../../Hash.ts"
|
|
8
8
|
import * as Inspectable from "../../Inspectable.ts"
|
|
9
|
+
import * as Option from "../../Option.ts"
|
|
9
10
|
import * as Predicate from "../../Predicate.ts"
|
|
10
11
|
import * as Record from "../../Record.ts"
|
|
11
12
|
import * as Redactable from "../../Redactable.ts"
|
|
@@ -205,24 +206,24 @@ export const get: {
|
|
|
205
206
|
* @since 4.0.0
|
|
206
207
|
* @category combinators
|
|
207
208
|
*/
|
|
208
|
-
(key: string): (self: Headers) => string
|
|
209
|
+
(key: string): (self: Headers) => Option.Option<string>
|
|
209
210
|
/**
|
|
210
211
|
* @since 4.0.0
|
|
211
212
|
* @category combinators
|
|
212
213
|
*/
|
|
213
|
-
(self: Headers, key: string): string
|
|
214
|
+
(self: Headers, key: string): Option.Option<string>
|
|
214
215
|
} = dual<
|
|
215
216
|
/**
|
|
216
217
|
* @since 4.0.0
|
|
217
218
|
* @category combinators
|
|
218
219
|
*/
|
|
219
|
-
(key: string) => (self: Headers) => string
|
|
220
|
+
(key: string) => (self: Headers) => Option.Option<string>,
|
|
220
221
|
/**
|
|
221
222
|
* @since 4.0.0
|
|
222
223
|
* @category combinators
|
|
223
224
|
*/
|
|
224
|
-
(self: Headers, key: string) => string
|
|
225
|
-
>(2, (self, key) => self[key.toLowerCase()])
|
|
225
|
+
(self: Headers, key: string) => Option.Option<string>
|
|
226
|
+
>(2, (self, key) => Option.fromUndefinedOr(self[key.toLowerCase()]))
|
|
226
227
|
|
|
227
228
|
/**
|
|
228
229
|
* @since 4.0.0
|
|
@@ -10,6 +10,7 @@ import * as Fiber from "../../Fiber.ts"
|
|
|
10
10
|
import { constant, constFalse, constTrue, dual, flow, identity } from "../../Function.ts"
|
|
11
11
|
import * as Inspectable from "../../Inspectable.ts"
|
|
12
12
|
import * as Layer from "../../Layer.ts"
|
|
13
|
+
import * as Option from "../../Option.ts"
|
|
13
14
|
import { type Pipeable, pipeArguments } from "../../Pipeable.ts"
|
|
14
15
|
import * as Predicate from "../../Predicate.ts"
|
|
15
16
|
import * as Ref from "../../Ref.ts"
|
|
@@ -640,7 +641,7 @@ export const make = (
|
|
|
640
641
|
Effect.withFiber((fiber) => {
|
|
641
642
|
const scopedController = scopedRequests.get(request)
|
|
642
643
|
const controller = scopedController ?? new AbortController()
|
|
643
|
-
const urlResult = UrlParams.makeUrl(request.url, request.urlParams, request.hash)
|
|
644
|
+
const urlResult = UrlParams.makeUrl(request.url, request.urlParams, Option.getOrUndefined(request.hash))
|
|
644
645
|
if (Result.isFailure(urlResult)) {
|
|
645
646
|
return Effect.fail(
|
|
646
647
|
new Error.HttpClientError({
|