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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @since 4.0.0
|
|
3
3
|
*/
|
|
4
|
+
import * as Option from "../../Option.ts"
|
|
4
5
|
import * as Tracer from "../../Tracer.ts"
|
|
5
6
|
import * as Headers from "./Headers.ts"
|
|
6
7
|
|
|
@@ -9,7 +10,7 @@ import * as Headers from "./Headers.ts"
|
|
|
9
10
|
* @category models
|
|
10
11
|
*/
|
|
11
12
|
export interface FromHeaders {
|
|
12
|
-
(headers: Headers.Headers): Tracer.ExternalSpan
|
|
13
|
+
(headers: Headers.Headers): Option.Option<Tracer.ExternalSpan>
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
/**
|
|
@@ -18,7 +19,12 @@ export interface FromHeaders {
|
|
|
18
19
|
*/
|
|
19
20
|
export const toHeaders = (span: Tracer.Span): Headers.Headers =>
|
|
20
21
|
Headers.fromRecordUnsafe({
|
|
21
|
-
b3: `${span.traceId}-${span.spanId}-${span.sampled ? "1" : "0"}${
|
|
22
|
+
b3: `${span.traceId}-${span.spanId}-${span.sampled ? "1" : "0"}${
|
|
23
|
+
Option.match(span.parent, {
|
|
24
|
+
onNone: () => "",
|
|
25
|
+
onSome: (parent) => `-${parent.spanId}`
|
|
26
|
+
})
|
|
27
|
+
}`,
|
|
22
28
|
traceparent: `00-${span.traceId}-${span.spanId}-${span.sampled ? "01" : "00"}`
|
|
23
29
|
})
|
|
24
30
|
|
|
@@ -26,8 +32,16 @@ export const toHeaders = (span: Tracer.Span): Headers.Headers =>
|
|
|
26
32
|
* @since 4.0.0
|
|
27
33
|
* @category decoding
|
|
28
34
|
*/
|
|
29
|
-
export const fromHeaders = (headers: Headers.Headers): Tracer.ExternalSpan
|
|
30
|
-
|
|
35
|
+
export const fromHeaders = (headers: Headers.Headers): Option.Option<Tracer.ExternalSpan> => {
|
|
36
|
+
let span = w3c(headers)
|
|
37
|
+
if (Option.isSome(span)) {
|
|
38
|
+
return span
|
|
39
|
+
}
|
|
40
|
+
span = b3(headers)
|
|
41
|
+
if (Option.isSome(span)) {
|
|
42
|
+
return span
|
|
43
|
+
}
|
|
44
|
+
return xb3(headers)
|
|
31
45
|
}
|
|
32
46
|
|
|
33
47
|
/**
|
|
@@ -36,17 +50,17 @@ export const fromHeaders = (headers: Headers.Headers): Tracer.ExternalSpan | und
|
|
|
36
50
|
*/
|
|
37
51
|
export const b3: FromHeaders = (headers) => {
|
|
38
52
|
if (!("b3" in headers)) {
|
|
39
|
-
return
|
|
53
|
+
return Option.none()
|
|
40
54
|
}
|
|
41
55
|
const parts = headers["b3"].split("-")
|
|
42
56
|
if (parts.length < 2) {
|
|
43
|
-
return
|
|
57
|
+
return Option.none()
|
|
44
58
|
}
|
|
45
|
-
return Tracer.externalSpan({
|
|
59
|
+
return Option.some(Tracer.externalSpan({
|
|
46
60
|
traceId: parts[0],
|
|
47
61
|
spanId: parts[1],
|
|
48
62
|
sampled: parts[2] ? parts[2] === "1" : true
|
|
49
|
-
})
|
|
63
|
+
}))
|
|
50
64
|
}
|
|
51
65
|
|
|
52
66
|
/**
|
|
@@ -55,13 +69,13 @@ export const b3: FromHeaders = (headers) => {
|
|
|
55
69
|
*/
|
|
56
70
|
export const xb3: FromHeaders = (headers) => {
|
|
57
71
|
if (!(headers["x-b3-traceid"]) || !(headers["x-b3-spanid"])) {
|
|
58
|
-
return
|
|
72
|
+
return Option.none()
|
|
59
73
|
}
|
|
60
|
-
return Tracer.externalSpan({
|
|
74
|
+
return Option.some(Tracer.externalSpan({
|
|
61
75
|
traceId: headers["x-b3-traceid"],
|
|
62
76
|
spanId: headers["x-b3-spanid"],
|
|
63
77
|
sampled: headers["x-b3-sampled"] ? headers["x-b3-sampled"] === "1" : true
|
|
64
|
-
})
|
|
78
|
+
}))
|
|
65
79
|
}
|
|
66
80
|
|
|
67
81
|
const w3cTraceId = /^[0-9a-f]{32}$/i
|
|
@@ -73,26 +87,26 @@ const w3cSpanId = /^[0-9a-f]{16}$/i
|
|
|
73
87
|
*/
|
|
74
88
|
export const w3c: FromHeaders = (headers) => {
|
|
75
89
|
if (!(headers["traceparent"])) {
|
|
76
|
-
return
|
|
90
|
+
return Option.none()
|
|
77
91
|
}
|
|
78
92
|
const parts = headers["traceparent"].split("-")
|
|
79
93
|
if (parts.length !== 4) {
|
|
80
|
-
return
|
|
94
|
+
return Option.none()
|
|
81
95
|
}
|
|
82
96
|
const [version, traceId, spanId, flags] = parts
|
|
83
97
|
switch (version) {
|
|
84
98
|
case "00": {
|
|
85
99
|
if (w3cTraceId.test(traceId) === false || w3cSpanId.test(spanId) === false) {
|
|
86
|
-
return
|
|
100
|
+
return Option.none()
|
|
87
101
|
}
|
|
88
|
-
return Tracer.externalSpan({
|
|
102
|
+
return Option.some(Tracer.externalSpan({
|
|
89
103
|
traceId,
|
|
90
104
|
spanId,
|
|
91
105
|
sampled: (parseInt(flags, 16) & 1) === 1
|
|
92
|
-
})
|
|
106
|
+
}))
|
|
93
107
|
}
|
|
94
108
|
default: {
|
|
95
|
-
return
|
|
109
|
+
return Option.none()
|
|
96
110
|
}
|
|
97
111
|
}
|
|
98
112
|
}
|
|
@@ -19,7 +19,6 @@ import * as Schema from "../../Schema.ts"
|
|
|
19
19
|
import * as Issue from "../../SchemaIssue.ts"
|
|
20
20
|
import * as Transformation from "../../SchemaTransformation.ts"
|
|
21
21
|
import * as Tuple from "../../Tuple.ts"
|
|
22
|
-
import * as UndefinedOr from "../../UndefinedOr.ts"
|
|
23
22
|
|
|
24
23
|
const TypeId = "~effect/http/UrlParams"
|
|
25
24
|
|
|
@@ -234,18 +233,17 @@ export const getFirst: {
|
|
|
234
233
|
* @since 4.0.0
|
|
235
234
|
* @category combinators
|
|
236
235
|
*/
|
|
237
|
-
(key: string): (self: UrlParams) => string
|
|
236
|
+
(key: string): (self: UrlParams) => Option.Option<string>
|
|
238
237
|
/**
|
|
239
238
|
* @since 4.0.0
|
|
240
239
|
* @category combinators
|
|
241
240
|
*/
|
|
242
|
-
(self: UrlParams, key: string): string
|
|
241
|
+
(self: UrlParams, key: string): Option.Option<string>
|
|
243
242
|
} = dual(
|
|
244
243
|
2,
|
|
245
|
-
(self: UrlParams, key: string): string
|
|
244
|
+
(self: UrlParams, key: string): Option.Option<string> =>
|
|
246
245
|
Arr.findFirst(self.params, ([k]) => k === key).pipe(
|
|
247
|
-
Option.map(([, value]) => value)
|
|
248
|
-
Option.getOrUndefined
|
|
246
|
+
Option.map(([, value]) => value)
|
|
249
247
|
)
|
|
250
248
|
)
|
|
251
249
|
|
|
@@ -258,16 +256,15 @@ export const getLast: {
|
|
|
258
256
|
* @since 4.0.0
|
|
259
257
|
* @category combinators
|
|
260
258
|
*/
|
|
261
|
-
(key: string): (self: UrlParams) => string
|
|
259
|
+
(key: string): (self: UrlParams) => Option.Option<string>
|
|
262
260
|
/**
|
|
263
261
|
* @since 4.0.0
|
|
264
262
|
* @category combinators
|
|
265
263
|
*/
|
|
266
|
-
(self: UrlParams, key: string): string
|
|
267
|
-
} = dual(2, (self: UrlParams, key: string): string
|
|
264
|
+
(self: UrlParams, key: string): Option.Option<string>
|
|
265
|
+
} = dual(2, (self: UrlParams, key: string): Option.Option<string> =>
|
|
268
266
|
Arr.findLast(self.params, ([k]) => k === key).pipe(
|
|
269
|
-
Option.map(([, value]) => value)
|
|
270
|
-
Option.getOrUndefined
|
|
267
|
+
Option.map(([, value]) => value)
|
|
271
268
|
))
|
|
272
269
|
|
|
273
270
|
/**
|
|
@@ -537,9 +534,9 @@ export const schemaJsonField = (field: string): schemaJsonField =>
|
|
|
537
534
|
Schema.UnknownFromJsonString,
|
|
538
535
|
Transformation.transformOrFail({
|
|
539
536
|
decode: (params) =>
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
537
|
+
Option.match(getFirst(params, field), {
|
|
538
|
+
onNone: () => Effect.fail(new Issue.Pointer([field], new Issue.MissingKey(undefined))),
|
|
539
|
+
onSome: Effect.succeed
|
|
543
540
|
}),
|
|
544
541
|
encode: (value) => Effect.succeed(make([[field, value]]))
|
|
545
542
|
})
|
|
@@ -72,10 +72,16 @@ export const layer = <Id extends string, Groups extends HttpApiGroup.Any>(
|
|
|
72
72
|
| Path
|
|
73
73
|
>()
|
|
74
74
|
const routes: Array<HttpRouter.Route<any, any>> = []
|
|
75
|
+
const availableGroups = Array.from(services.mapUnsafe.keys()).filter((key) =>
|
|
76
|
+
key.startsWith("effect/httpapi/HttpApiGroup/")
|
|
77
|
+
)
|
|
75
78
|
for (const group of Object.values(api.groups)) {
|
|
76
79
|
const groupRoutes = services.mapUnsafe.get(group.key) as Array<HttpRouter.Route<any, any>>
|
|
77
80
|
if (groupRoutes === undefined) {
|
|
78
|
-
|
|
81
|
+
const available = availableGroups.length === 0 ? "none" : availableGroups.join(", ")
|
|
82
|
+
return yield* Effect.die(
|
|
83
|
+
`HttpApiGroup "${group.identifier}" not found (key: "${group.key}"). Did you forget to provide HttpApiBuilder.group(api, "${group.identifier}", ...)? Available groups: ${available}`
|
|
84
|
+
)
|
|
79
85
|
}
|
|
80
86
|
routes.push(...groupRoutes)
|
|
81
87
|
}
|
|
@@ -166,11 +172,11 @@ export interface Handlers<
|
|
|
166
172
|
| R
|
|
167
173
|
| HttpApiEndpoint.MiddlewareWithName<Endpoints, Name>
|
|
168
174
|
| HttpApiEndpoint.MiddlewareServicesWithName<Endpoints, Name>
|
|
169
|
-
| HttpApiEndpoint.ExcludeProvidedWithName<
|
|
175
|
+
| (HttpApiEndpoint.ExcludeProvidedWithName<
|
|
170
176
|
Endpoints,
|
|
171
177
|
Name,
|
|
172
178
|
R1 | HttpApiEndpoint.ServerServicesWithName<Endpoints, Name>
|
|
173
|
-
|
|
179
|
+
> extends infer _R ? _R extends never ? never : HttpRouter.Request<"Requires", _R> : never),
|
|
174
180
|
HttpApiEndpoint.ExcludeName<Endpoints, Name>
|
|
175
181
|
>
|
|
176
182
|
|
|
@@ -186,11 +192,11 @@ export interface Handlers<
|
|
|
186
192
|
| R
|
|
187
193
|
| HttpApiEndpoint.MiddlewareWithName<Endpoints, Name>
|
|
188
194
|
| HttpApiEndpoint.MiddlewareServicesWithName<Endpoints, Name>
|
|
189
|
-
| HttpApiEndpoint.ExcludeProvidedWithName<
|
|
195
|
+
| (HttpApiEndpoint.ExcludeProvidedWithName<
|
|
190
196
|
Endpoints,
|
|
191
197
|
Name,
|
|
192
198
|
R1 | HttpApiEndpoint.ServerServicesWithName<Endpoints, Name>
|
|
193
|
-
|
|
199
|
+
> extends infer _R ? _R extends never ? never : HttpRouter.Request<"Requires", _R> : never),
|
|
194
200
|
HttpApiEndpoint.ExcludeName<Endpoints, Name>
|
|
195
201
|
>
|
|
196
202
|
}
|
|
@@ -630,13 +636,13 @@ const getRequestMediaType = (request: HttpServerRequest): string => {
|
|
|
630
636
|
const applyMiddleware = <A extends Effect.Effect<any, any, any>>(
|
|
631
637
|
group: HttpApiGroup.AnyWithProps,
|
|
632
638
|
endpoint: HttpApiEndpoint.AnyWithProps,
|
|
633
|
-
services: ServiceMap.ServiceMap<
|
|
639
|
+
services: ServiceMap.ServiceMap<any>,
|
|
634
640
|
handler: A
|
|
635
641
|
) => {
|
|
636
642
|
const options = { group, endpoint }
|
|
637
643
|
for (const key_ of endpoint.middlewares) {
|
|
638
644
|
const key = key_ as any as HttpApiMiddleware.AnyService
|
|
639
|
-
const service =
|
|
645
|
+
const service = ServiceMap.getUnsafe(services, key as any) as HttpApiMiddleware.HttpApiMiddleware<any, any, any>
|
|
640
646
|
const apply = HttpApiMiddleware.isSecurity(key)
|
|
641
647
|
? makeSecurityMiddleware(key, service as any)
|
|
642
648
|
: service
|
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @since 4.0.0
|
|
3
3
|
*/
|
|
4
|
+
import * as Effect from "../../Effect.ts"
|
|
4
5
|
import * as ErrorReporter from "../../ErrorReporter.ts"
|
|
5
6
|
import { identity } from "../../Function.ts"
|
|
6
7
|
import * as Schema from "../../Schema.ts"
|
|
7
8
|
import * as Transformation from "../../SchemaTransformation.ts"
|
|
9
|
+
import * as HttpServerRespondable from "../http/HttpServerRespondable.ts"
|
|
10
|
+
import * as HttpServerResponse from "../http/HttpServerResponse.ts"
|
|
8
11
|
import * as HttpApiSchema from "./HttpApiSchema.ts"
|
|
9
12
|
|
|
13
|
+
const badRequestResponse = HttpServerResponse.empty({ status: 400 })
|
|
14
|
+
const unauthorizedResponse = HttpServerResponse.empty({ status: 401 })
|
|
15
|
+
const forbiddenResponse = HttpServerResponse.empty({ status: 403 })
|
|
16
|
+
const notFoundResponse = HttpServerResponse.empty({ status: 404 })
|
|
17
|
+
const methodNotAllowedResponse = HttpServerResponse.empty({ status: 405 })
|
|
18
|
+
const notAcceptableResponse = HttpServerResponse.empty({ status: 406 })
|
|
19
|
+
const requestTimeoutResponse = HttpServerResponse.empty({ status: 408 })
|
|
20
|
+
const conflictResponse = HttpServerResponse.empty({ status: 409 })
|
|
21
|
+
const goneResponse = HttpServerResponse.empty({ status: 410 })
|
|
22
|
+
const internalServerErrorResponse = HttpServerResponse.empty({ status: 500 })
|
|
23
|
+
const notImplementedResponse = HttpServerResponse.empty({ status: 501 })
|
|
24
|
+
const serviceUnavailableResponse = HttpServerResponse.empty({ status: 503 })
|
|
25
|
+
|
|
10
26
|
/**
|
|
11
27
|
* @category Built-in errors
|
|
12
28
|
* @since 4.0.0
|
|
@@ -17,7 +33,10 @@ export class BadRequest extends Schema.ErrorClass<BadRequest>("effect/HttpApiErr
|
|
|
17
33
|
description: "BadRequest",
|
|
18
34
|
httpApiStatus: 400
|
|
19
35
|
}) {
|
|
20
|
-
override readonly [ErrorReporter.ignore] = true
|
|
36
|
+
override readonly [ErrorReporter.ignore] = true;
|
|
37
|
+
[HttpServerRespondable.symbol]() {
|
|
38
|
+
return Effect.succeed(badRequestResponse)
|
|
39
|
+
}
|
|
21
40
|
static readonly singleton = new BadRequest()
|
|
22
41
|
}
|
|
23
42
|
|
|
@@ -59,7 +78,10 @@ export class Unauthorized extends Schema.ErrorClass<Unauthorized>("effect/HttpAp
|
|
|
59
78
|
description: "Unauthorized",
|
|
60
79
|
httpApiStatus: 401
|
|
61
80
|
}) {
|
|
62
|
-
override readonly [ErrorReporter.ignore] = true
|
|
81
|
+
override readonly [ErrorReporter.ignore] = true;
|
|
82
|
+
[HttpServerRespondable.symbol]() {
|
|
83
|
+
return Effect.succeed(unauthorizedResponse)
|
|
84
|
+
}
|
|
63
85
|
}
|
|
64
86
|
|
|
65
87
|
/**
|
|
@@ -80,7 +102,10 @@ export class Forbidden extends Schema.ErrorClass<Forbidden>("effect/HttpApiError
|
|
|
80
102
|
description: "Forbidden",
|
|
81
103
|
httpApiStatus: 403
|
|
82
104
|
}) {
|
|
83
|
-
override readonly [ErrorReporter.ignore] = true
|
|
105
|
+
override readonly [ErrorReporter.ignore] = true;
|
|
106
|
+
[HttpServerRespondable.symbol]() {
|
|
107
|
+
return Effect.succeed(forbiddenResponse)
|
|
108
|
+
}
|
|
84
109
|
}
|
|
85
110
|
|
|
86
111
|
/**
|
|
@@ -101,7 +126,10 @@ export class NotFound extends Schema.ErrorClass<NotFound>("effect/HttpApiError/N
|
|
|
101
126
|
description: "NotFound",
|
|
102
127
|
httpApiStatus: 404
|
|
103
128
|
}) {
|
|
104
|
-
override readonly [ErrorReporter.ignore] = true
|
|
129
|
+
override readonly [ErrorReporter.ignore] = true;
|
|
130
|
+
[HttpServerRespondable.symbol]() {
|
|
131
|
+
return Effect.succeed(notFoundResponse)
|
|
132
|
+
}
|
|
105
133
|
}
|
|
106
134
|
|
|
107
135
|
/**
|
|
@@ -122,7 +150,10 @@ export class MethodNotAllowed extends Schema.ErrorClass<MethodNotAllowed>("effec
|
|
|
122
150
|
description: "MethodNotAllowed",
|
|
123
151
|
httpApiStatus: 405
|
|
124
152
|
}) {
|
|
125
|
-
override readonly [ErrorReporter.ignore] = true
|
|
153
|
+
override readonly [ErrorReporter.ignore] = true;
|
|
154
|
+
[HttpServerRespondable.symbol]() {
|
|
155
|
+
return Effect.succeed(methodNotAllowedResponse)
|
|
156
|
+
}
|
|
126
157
|
}
|
|
127
158
|
|
|
128
159
|
/**
|
|
@@ -143,7 +174,10 @@ export class NotAcceptable extends Schema.ErrorClass<NotAcceptable>("effect/Http
|
|
|
143
174
|
description: "NotAcceptable",
|
|
144
175
|
httpApiStatus: 406
|
|
145
176
|
}) {
|
|
146
|
-
override readonly [ErrorReporter.ignore] = true
|
|
177
|
+
override readonly [ErrorReporter.ignore] = true;
|
|
178
|
+
[HttpServerRespondable.symbol]() {
|
|
179
|
+
return Effect.succeed(notAcceptableResponse)
|
|
180
|
+
}
|
|
147
181
|
}
|
|
148
182
|
|
|
149
183
|
/**
|
|
@@ -164,7 +198,10 @@ export class RequestTimeout extends Schema.ErrorClass<RequestTimeout>("effect/Ht
|
|
|
164
198
|
description: "RequestTimeout",
|
|
165
199
|
httpApiStatus: 408
|
|
166
200
|
}) {
|
|
167
|
-
override readonly [ErrorReporter.ignore] = true
|
|
201
|
+
override readonly [ErrorReporter.ignore] = true;
|
|
202
|
+
[HttpServerRespondable.symbol]() {
|
|
203
|
+
return Effect.succeed(requestTimeoutResponse)
|
|
204
|
+
}
|
|
168
205
|
}
|
|
169
206
|
|
|
170
207
|
/**
|
|
@@ -185,7 +222,10 @@ export class Conflict extends Schema.ErrorClass<Conflict>("effect/HttpApiError/C
|
|
|
185
222
|
description: "Conflict",
|
|
186
223
|
httpApiStatus: 409
|
|
187
224
|
}) {
|
|
188
|
-
override readonly [ErrorReporter.ignore] = true
|
|
225
|
+
override readonly [ErrorReporter.ignore] = true;
|
|
226
|
+
[HttpServerRespondable.symbol]() {
|
|
227
|
+
return Effect.succeed(conflictResponse)
|
|
228
|
+
}
|
|
189
229
|
}
|
|
190
230
|
|
|
191
231
|
/**
|
|
@@ -206,7 +246,10 @@ export class Gone extends Schema.ErrorClass<Gone>("effect/HttpApiError/Gone")({
|
|
|
206
246
|
description: "Gone",
|
|
207
247
|
httpApiStatus: 410
|
|
208
248
|
}) {
|
|
209
|
-
override readonly [ErrorReporter.ignore] = true
|
|
249
|
+
override readonly [ErrorReporter.ignore] = true;
|
|
250
|
+
[HttpServerRespondable.symbol]() {
|
|
251
|
+
return Effect.succeed(goneResponse)
|
|
252
|
+
}
|
|
210
253
|
}
|
|
211
254
|
|
|
212
255
|
/**
|
|
@@ -228,7 +271,11 @@ export class InternalServerError
|
|
|
228
271
|
description: "InternalServerError",
|
|
229
272
|
httpApiStatus: 500
|
|
230
273
|
})
|
|
231
|
-
{
|
|
274
|
+
{
|
|
275
|
+
[HttpServerRespondable.symbol]() {
|
|
276
|
+
return Effect.succeed(internalServerErrorResponse)
|
|
277
|
+
}
|
|
278
|
+
}
|
|
232
279
|
|
|
233
280
|
/**
|
|
234
281
|
* @category NoContent errors
|
|
@@ -247,7 +294,11 @@ export class NotImplemented extends Schema.ErrorClass<NotImplemented>("effect/Ht
|
|
|
247
294
|
}, {
|
|
248
295
|
description: "NotImplemented",
|
|
249
296
|
httpApiStatus: 501
|
|
250
|
-
}) {
|
|
297
|
+
}) {
|
|
298
|
+
[HttpServerRespondable.symbol]() {
|
|
299
|
+
return Effect.succeed(notImplementedResponse)
|
|
300
|
+
}
|
|
301
|
+
}
|
|
251
302
|
|
|
252
303
|
/**
|
|
253
304
|
* @category NoContent errors
|
|
@@ -268,7 +319,11 @@ export class ServiceUnavailable
|
|
|
268
319
|
description: "ServiceUnavailable",
|
|
269
320
|
httpApiStatus: 503
|
|
270
321
|
})
|
|
271
|
-
{
|
|
322
|
+
{
|
|
323
|
+
[HttpServerRespondable.symbol]() {
|
|
324
|
+
return Effect.succeed(serviceUnavailableResponse)
|
|
325
|
+
}
|
|
326
|
+
}
|
|
272
327
|
|
|
273
328
|
/**
|
|
274
329
|
* @category NoContent errors
|
|
@@ -6,10 +6,10 @@ import * as Duration from "../../Duration.ts"
|
|
|
6
6
|
import * as Effect from "../../Effect.ts"
|
|
7
7
|
import * as Fiber from "../../Fiber.ts"
|
|
8
8
|
import * as Num from "../../Number.ts"
|
|
9
|
+
import * as Option from "../../Option.ts"
|
|
9
10
|
import * as Schedule from "../../Schedule.ts"
|
|
10
11
|
import * as Scope from "../../Scope.ts"
|
|
11
12
|
import * as ServiceMap from "../../ServiceMap.ts"
|
|
12
|
-
import * as UndefinedOr from "../../UndefinedOr.ts"
|
|
13
13
|
import * as Headers from "../../unstable/http/Headers.ts"
|
|
14
14
|
import * as HttpClient from "../../unstable/http/HttpClient.ts"
|
|
15
15
|
import * as HttpClientError from "../../unstable/http/HttpClientError.ts"
|
|
@@ -24,7 +24,10 @@ const policy = Schedule.forever.pipe(
|
|
|
24
24
|
&& error.reason._tag === "StatusCodeError"
|
|
25
25
|
&& error.reason.response.status === 429
|
|
26
26
|
) {
|
|
27
|
-
const retryAfter =
|
|
27
|
+
const retryAfter = Option.fromUndefinedOr(error.reason.response.headers["retry-after"]).pipe(
|
|
28
|
+
Option.flatMap(Num.parse),
|
|
29
|
+
Option.getOrElse(() => 5)
|
|
30
|
+
)
|
|
28
31
|
return Effect.succeed(Duration.seconds(retryAfter))
|
|
29
32
|
}
|
|
30
33
|
return Effect.succeed(Duration.seconds(1))
|
|
@@ -7,6 +7,7 @@ import * as Effect from "../../Effect.ts"
|
|
|
7
7
|
import type * as Exit from "../../Exit.ts"
|
|
8
8
|
import { flow } from "../../Function.ts"
|
|
9
9
|
import * as Layer from "../../Layer.ts"
|
|
10
|
+
import * as Option from "../../Option.ts"
|
|
10
11
|
import type * as Scope from "../../Scope.ts"
|
|
11
12
|
import type * as ServiceMap from "../../ServiceMap.ts"
|
|
12
13
|
import * as Tracer from "../../Tracer.ts"
|
|
@@ -150,7 +151,7 @@ type RemainingSpanImpl = Omit<Tracer.Span, (keyof typeof SpanProto) | "traceId"
|
|
|
150
151
|
|
|
151
152
|
const makeSpan = (options: {
|
|
152
153
|
readonly name: string
|
|
153
|
-
readonly parent: Tracer.AnySpan
|
|
154
|
+
readonly parent: Option.Option<Tracer.AnySpan>
|
|
154
155
|
readonly annotations: ServiceMap.ServiceMap<never>
|
|
155
156
|
readonly status: Tracer.SpanStatus
|
|
156
157
|
readonly attributes: ReadonlyMap<string, unknown>
|
|
@@ -163,8 +164,8 @@ const makeSpan = (options: {
|
|
|
163
164
|
Object.create(SpanProto),
|
|
164
165
|
options satisfies RemainingSpanImpl
|
|
165
166
|
)
|
|
166
|
-
if (self.parent) {
|
|
167
|
-
self.traceId = self.parent.traceId
|
|
167
|
+
if (Option.isSome(self.parent)) {
|
|
168
|
+
self.traceId = self.parent.value.traceId
|
|
168
169
|
} else {
|
|
169
170
|
self.traceId = generateId(32)
|
|
170
171
|
}
|
|
@@ -249,7 +250,10 @@ const makeOtlpSpan = (self: SpanImpl): OtlpSpan => {
|
|
|
249
250
|
return {
|
|
250
251
|
traceId: self.traceId,
|
|
251
252
|
spanId: self.spanId,
|
|
252
|
-
parentSpanId:
|
|
253
|
+
parentSpanId: Option.match(self.parent, {
|
|
254
|
+
onNone: () => undefined,
|
|
255
|
+
onSome: (parent) => parent.spanId
|
|
256
|
+
}),
|
|
253
257
|
name: self.name,
|
|
254
258
|
kind: SpanKind[self.kind],
|
|
255
259
|
startTimeUnixNano: String(status.startTime),
|
|
@@ -194,5 +194,5 @@ export const deserializeExit = <A extends Schema.Top, E extends Schema.Top>(
|
|
|
194
194
|
A["DecodingServices"] | E["DecodingServices"]
|
|
195
195
|
> => {
|
|
196
196
|
const schema = Schema.toCodecJson(exitSchema(self))
|
|
197
|
-
return Schema.
|
|
197
|
+
return Schema.decodeUnknownEffect(schema)(encoded)
|
|
198
198
|
}
|
|
@@ -607,11 +607,8 @@ function runCallbackSync<R, A, E, ER = never>(
|
|
|
607
607
|
return undefined
|
|
608
608
|
}
|
|
609
609
|
const runFork = Effect.runForkWith(services)
|
|
610
|
-
const scheduler = ServiceMap.get(services, Scheduler.Scheduler)
|
|
611
610
|
const fiber = runFork(effect)
|
|
612
|
-
|
|
613
|
-
;(scheduler as Scheduler.MixedScheduler).flush()
|
|
614
|
-
}
|
|
611
|
+
fiber.currentDispatcher?.flush()
|
|
615
612
|
const result = fiber.pollUnsafe()
|
|
616
613
|
if (result) {
|
|
617
614
|
onExit(result)
|
|
@@ -9,7 +9,7 @@ import * as Layer from "../../Layer.ts"
|
|
|
9
9
|
import * as Option from "../../Option.ts"
|
|
10
10
|
import { hasProperty } from "../../Predicate.ts"
|
|
11
11
|
import * as Queue from "../../Queue.ts"
|
|
12
|
-
import type { Scheduler } from "../../Scheduler.ts"
|
|
12
|
+
import type { Scheduler, SchedulerDispatcher } from "../../Scheduler.ts"
|
|
13
13
|
import { MixedScheduler } from "../../Scheduler.ts"
|
|
14
14
|
import * as Scope from "../../Scope.ts"
|
|
15
15
|
import * as ServiceMap from "../../ServiceMap.ts"
|
|
@@ -296,6 +296,7 @@ class RegistryImpl implements AtomRegistry {
|
|
|
296
296
|
readonly defaultIdleTTL: number | undefined
|
|
297
297
|
readonly scheduler: Scheduler
|
|
298
298
|
readonly schedulerAsync: Scheduler
|
|
299
|
+
readonly dispatcher: SchedulerDispatcher
|
|
299
300
|
onNodeAdded?: ((node: Node<any>) => void) | undefined
|
|
300
301
|
onNodeRemoved?: ((node: Node<any>) => void) | undefined
|
|
301
302
|
|
|
@@ -308,6 +309,7 @@ class RegistryImpl implements AtomRegistry {
|
|
|
308
309
|
this[TypeId] = TypeId
|
|
309
310
|
this.scheduler = new MixedScheduler("sync", scheduleTask)
|
|
310
311
|
this.schedulerAsync = new MixedScheduler("async", scheduleTask)
|
|
312
|
+
this.dispatcher = this.schedulerAsync.makeDispatcher()
|
|
311
313
|
this.defaultIdleTTL = defaultIdleTTL
|
|
312
314
|
|
|
313
315
|
if (timeoutResolution === undefined && defaultIdleTTL !== undefined) {
|
|
@@ -427,7 +429,7 @@ class RegistryImpl implements AtomRegistry {
|
|
|
427
429
|
}
|
|
428
430
|
|
|
429
431
|
scheduleAtomRemoval(atom: Atom.Atom<any>): void {
|
|
430
|
-
this.
|
|
432
|
+
this.dispatcher.scheduleTask(() => {
|
|
431
433
|
const node = this.nodes.get(atomKey(atom))
|
|
432
434
|
if (node !== undefined && node.canBeRemoved) {
|
|
433
435
|
this.removeNode(node)
|
|
@@ -436,7 +438,7 @@ class RegistryImpl implements AtomRegistry {
|
|
|
436
438
|
}
|
|
437
439
|
|
|
438
440
|
scheduleNodeRemoval(node: NodeImpl<any>): void {
|
|
439
|
-
this.
|
|
441
|
+
this.dispatcher.scheduleTask(() => {
|
|
440
442
|
if (node.canBeRemoved) {
|
|
441
443
|
this.removeNode(node)
|
|
442
444
|
}
|
package/src/unstable/rpc/Rpc.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import type * as Cause from "../../Cause.ts"
|
|
5
5
|
import type { Effect } from "../../Effect.ts"
|
|
6
6
|
import type { Exit as Exit_ } from "../../Exit.ts"
|
|
7
|
+
import * as Option from "../../Option.ts"
|
|
7
8
|
import { type Pipeable, pipeArguments } from "../../Pipeable.ts"
|
|
8
9
|
import * as Predicate from "../../Predicate.ts"
|
|
9
10
|
import * as PrimaryKey from "../../PrimaryKey.ts"
|
|
@@ -780,14 +781,14 @@ export const exitSchema = <R extends Any>(
|
|
|
780
781
|
const rpc = self as any as AnyWithProps
|
|
781
782
|
const failures = new Set<Schema.Top>([rpc.errorSchema])
|
|
782
783
|
const streamSchemas = RpcSchema.getStreamSchemas(rpc.successSchema)
|
|
783
|
-
if (streamSchemas) {
|
|
784
|
-
failures.add(streamSchemas.error)
|
|
784
|
+
if (Option.isSome(streamSchemas)) {
|
|
785
|
+
failures.add(streamSchemas.value.error)
|
|
785
786
|
}
|
|
786
787
|
for (const middleware of rpc.middlewares) {
|
|
787
788
|
failures.add(middleware.error)
|
|
788
789
|
}
|
|
789
790
|
const schema = Schema.Exit(
|
|
790
|
-
streamSchemas ? Schema.Void : rpc.successSchema,
|
|
791
|
+
Option.isSome(streamSchemas) ? Schema.Void : rpc.successSchema,
|
|
791
792
|
Schema.Union([...failures]),
|
|
792
793
|
rpc.defectSchema
|
|
793
794
|
)
|
|
@@ -366,7 +366,7 @@ export const makeNoSerialization: <Rpcs extends Rpc.Any, E, const Flatten extend
|
|
|
366
366
|
resume(exit) {
|
|
367
367
|
resume(exit)
|
|
368
368
|
if (fiber && !fiber.pollUnsafe()) {
|
|
369
|
-
parentFiber.
|
|
369
|
+
parentFiber.currentDispatcher.scheduleTask(() => {
|
|
370
370
|
fiber.interruptUnsafe(parentFiber.id)
|
|
371
371
|
}, 0)
|
|
372
372
|
}
|
|
@@ -683,8 +683,8 @@ export const make: <Rpcs extends Rpc.Any, const Flatten extends boolean = false>
|
|
|
683
683
|
case "Chunk": {
|
|
684
684
|
const requestId = RequestId(message.requestId)
|
|
685
685
|
const entry = entries.get(requestId)
|
|
686
|
-
if (!entry ||
|
|
687
|
-
return entry.schemas.decodeChunk(message.values).pipe(
|
|
686
|
+
if (!entry || Option.isNone(entry.schemas.decodeChunk)) return Effect.void
|
|
687
|
+
return entry.schemas.decodeChunk.value(message.values).pipe(
|
|
688
688
|
Effect.provideServices(entry.context),
|
|
689
689
|
Effect.orDie,
|
|
690
690
|
Effect.flatMap((chunk) =>
|
|
@@ -738,9 +738,9 @@ export const make: <Rpcs extends Rpc.Any, const Flatten extends boolean = false>
|
|
|
738
738
|
})
|
|
739
739
|
|
|
740
740
|
interface RpcSchemas {
|
|
741
|
-
readonly decodeChunk:
|
|
742
|
-
|
|
743
|
-
|
|
741
|
+
readonly decodeChunk: Option.Option<
|
|
742
|
+
(chunk: ReadonlyArray<unknown>) => Effect.Effect<NonEmptyReadonlyArray<any>, Schema.SchemaError, unknown>
|
|
743
|
+
>
|
|
744
744
|
readonly encodePayload: (payload: any) => Effect.Effect<any, Schema.SchemaError, unknown>
|
|
745
745
|
readonly decodeExit: (encoded: unknown) => Effect.Effect<Exit.Exit<any, any>, Schema.SchemaError, unknown>
|
|
746
746
|
}
|
|
@@ -752,9 +752,10 @@ const rpcSchemas = (rpc: Rpc.AnyWithProps) => {
|
|
|
752
752
|
}
|
|
753
753
|
const streamSchemas = RpcSchema.getStreamSchemas(rpc.successSchema)
|
|
754
754
|
entry = {
|
|
755
|
-
decodeChunk:
|
|
756
|
-
|
|
757
|
-
|
|
755
|
+
decodeChunk: Option.map(
|
|
756
|
+
streamSchemas,
|
|
757
|
+
(streamSchemas) => Schema.decodeUnknownEffect(Schema.toCodecJson(Schema.NonEmptyArray(streamSchemas.success)))
|
|
758
|
+
),
|
|
758
759
|
encodePayload: Schema.encodeEffect(Schema.toCodecJson(rpc.payloadSchema)),
|
|
759
760
|
decodeExit: Schema.decodeUnknownEffect(Schema.toCodecJson(Rpc.exitSchema(rpc as any)))
|
|
760
761
|
}
|
|
@@ -184,8 +184,8 @@ export type HandlersServices<Rpcs extends Rpc.Any, Handlers> = keyof Handlers ex
|
|
|
184
184
|
* @since 4.0.0
|
|
185
185
|
* @category groups
|
|
186
186
|
*/
|
|
187
|
-
export type HandlerServices<Rpcs extends Rpc.Any, K extends Rpcs["_tag"], Handler> =
|
|
188
|
-
|
|
187
|
+
export type HandlerServices<Rpcs extends Rpc.Any, K extends Rpcs["_tag"], Handler> = true extends
|
|
188
|
+
Rpc.IsStream<Rpcs, K> ? Handler extends (...args: any) =>
|
|
189
189
|
| Stream.Stream<infer _A, infer _E, infer _R>
|
|
190
190
|
| Rpc.Wrapper<Stream.Stream<infer _A, infer _E, infer _R>>
|
|
191
191
|
| Effect.Effect<
|
|
@@ -204,7 +204,7 @@ export type HandlerServices<Rpcs extends Rpc.Any, K extends Rpcs["_tag"], Handle
|
|
|
204
204
|
Handler extends (
|
|
205
205
|
...args: any
|
|
206
206
|
) => Effect.Effect<infer _A, infer _E, infer _R> | Rpc.Wrapper<Effect.Effect<infer _A, infer _E, infer _R>> ?
|
|
207
|
-
Rpc.ExcludeProvides<_R, Rpcs, K> | Rpc.ExtractRequires<Rpcs, K>
|
|
207
|
+
Exclude<Rpc.ExcludeProvides<_R, Rpcs, K>, Scope> | Rpc.ExtractRequires<Rpcs, K>
|
|
208
208
|
: never
|
|
209
209
|
|
|
210
210
|
/**
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as Cause from "../../Cause.ts"
|
|
5
5
|
import { constUndefined } from "../../Function.ts"
|
|
6
|
+
import * as Option from "../../Option.ts"
|
|
6
7
|
import * as Predicate from "../../Predicate.ts"
|
|
7
8
|
import * as Schema from "../../Schema.ts"
|
|
8
9
|
import type * as AST from "../../SchemaAST.ts"
|
|
@@ -20,16 +21,16 @@ export function isStreamSchema(schema: Schema.Top): schema is Stream<Schema.Top,
|
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
/** @internal */
|
|
23
|
-
export function getStreamSchemas(schema: Schema.Top): {
|
|
24
|
+
export function getStreamSchemas(schema: Schema.Top): Option.Option<{
|
|
24
25
|
readonly success: Schema.Top
|
|
25
26
|
readonly error: Schema.Top
|
|
26
|
-
}
|
|
27
|
+
}> {
|
|
27
28
|
return isStreamSchema(schema) ?
|
|
28
|
-
{
|
|
29
|
+
Option.some({
|
|
29
30
|
success: schema.success,
|
|
30
31
|
error: schema.error
|
|
31
|
-
} :
|
|
32
|
-
|
|
32
|
+
}) :
|
|
33
|
+
Option.none()
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
/**
|