effect 4.0.0-beta.31 → 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/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 +8 -15
- package/dist/Cron.js.map +1 -1
- package/dist/DateTime.d.ts +16 -15
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +8 -8
- 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 +26 -24
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +23 -22
- 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 +84 -0
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +27 -0
- 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 +30 -0
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +28 -1
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaGetter.js +6 -4
- package/dist/SchemaGetter.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 +9 -9
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/effect.js +20 -89
- 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.map +1 -1
- package/dist/unstable/ai/Chat.js +2 -2
- package/dist/unstable/ai/Chat.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/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/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/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/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/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 +2 -1
- 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.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/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/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/Chunk.ts +68 -63
- package/src/Config.ts +4 -1
- package/src/Cron.ts +10 -15
- package/src/DateTime.ts +16 -15
- package/src/Deferred.ts +8 -6
- package/src/Duration.ts +34 -33
- 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 +121 -0
- 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 +49 -1
- package/src/SchemaGetter.ts +4 -4
- 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 +14 -14
- package/src/internal/effect.ts +29 -121
- 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 +6 -2
- 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/Flag.ts +2 -2
- 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/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/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/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 +3 -2
- package/src/unstable/http/HttpIncomingMessage.ts +2 -1
- 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 +25 -21
- package/src/unstable/http/HttpServerResponse.ts +5 -4
- package/src/unstable/http/HttpTraceContext.ts +31 -17
- package/src/unstable/http/UrlParams.ts +11 -14
- package/src/unstable/httpapi/HttpApiBuilder.ts +9 -3
- 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/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/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/src/NullOr.ts +0 -204
package/src/Record.ts
CHANGED
|
@@ -543,7 +543,7 @@ export const get: {
|
|
|
543
543
|
|
|
544
544
|
/**
|
|
545
545
|
* Apply a function to the element at the specified key, creating a new record,
|
|
546
|
-
* or return `
|
|
546
|
+
* or return `Option.none()` if the key doesn't exist.
|
|
547
547
|
*
|
|
548
548
|
* @example
|
|
549
549
|
* ```ts
|
|
@@ -553,8 +553,8 @@ export const get: {
|
|
|
553
553
|
*
|
|
554
554
|
* const input: Record<string, number> = { a: 3 }
|
|
555
555
|
*
|
|
556
|
-
* Record.modify(input, "a", f) // { a: 6 }
|
|
557
|
-
* Record.modify(input, "b", f) //
|
|
556
|
+
* Record.modify(input, "a", f) // Option.some({ a: 6 })
|
|
557
|
+
* Record.modify(input, "b", f) // Option.none()
|
|
558
558
|
* ```
|
|
559
559
|
*
|
|
560
560
|
* @category utils
|
|
@@ -563,7 +563,7 @@ export const get: {
|
|
|
563
563
|
export const modify: {
|
|
564
564
|
/**
|
|
565
565
|
* Apply a function to the element at the specified key, creating a new record,
|
|
566
|
-
* or return `
|
|
566
|
+
* or return `Option.none()` if the key doesn't exist.
|
|
567
567
|
*
|
|
568
568
|
* @example
|
|
569
569
|
* ```ts
|
|
@@ -573,17 +573,17 @@ export const modify: {
|
|
|
573
573
|
*
|
|
574
574
|
* const input: Record<string, number> = { a: 3 }
|
|
575
575
|
*
|
|
576
|
-
* Record.modify(input, "a", f) // { a: 6 }
|
|
577
|
-
* Record.modify(input, "b", f) //
|
|
576
|
+
* Record.modify(input, "a", f) // Option.some({ a: 6 })
|
|
577
|
+
* Record.modify(input, "b", f) // Option.none()
|
|
578
578
|
* ```
|
|
579
579
|
*
|
|
580
580
|
* @category utils
|
|
581
581
|
* @since 2.0.0
|
|
582
582
|
*/
|
|
583
|
-
<K extends string | symbol, A, B>(key: NoInfer<K>, f: (a: A) => B): (self: ReadonlyRecord<K, A>) => Record<K, A | B
|
|
583
|
+
<K extends string | symbol, A, B>(key: NoInfer<K>, f: (a: A) => B): (self: ReadonlyRecord<K, A>) => Option.Option<Record<K, A | B>>
|
|
584
584
|
/**
|
|
585
585
|
* Apply a function to the element at the specified key, creating a new record,
|
|
586
|
-
* or return `
|
|
586
|
+
* or return `Option.none()` if the key doesn't exist.
|
|
587
587
|
*
|
|
588
588
|
* @example
|
|
589
589
|
* ```ts
|
|
@@ -593,23 +593,23 @@ export const modify: {
|
|
|
593
593
|
*
|
|
594
594
|
* const input: Record<string, number> = { a: 3 }
|
|
595
595
|
*
|
|
596
|
-
* Record.modify(input, "a", f) // { a: 6 }
|
|
597
|
-
* Record.modify(input, "b", f) //
|
|
596
|
+
* Record.modify(input, "a", f) // Option.some({ a: 6 })
|
|
597
|
+
* Record.modify(input, "b", f) // Option.none()
|
|
598
598
|
* ```
|
|
599
599
|
*
|
|
600
600
|
* @category utils
|
|
601
601
|
* @since 2.0.0
|
|
602
602
|
*/
|
|
603
|
-
<K extends string | symbol, A, B>(self: ReadonlyRecord<K, A>, key: NoInfer<K>, f: (a: A) => B): Record<K, A | B
|
|
603
|
+
<K extends string | symbol, A, B>(self: ReadonlyRecord<K, A>, key: NoInfer<K>, f: (a: A) => B): Option.Option<Record<K, A | B>>
|
|
604
604
|
} = dual(
|
|
605
605
|
3,
|
|
606
606
|
<K extends string | symbol, A, B>(
|
|
607
607
|
self: ReadonlyRecord<K, A>,
|
|
608
608
|
key: NoInfer<K>,
|
|
609
609
|
f: (a: A) => B
|
|
610
|
-
): Record<K, A | B
|
|
611
|
-
if (!has(self, key)) return
|
|
612
|
-
return { ...self, [key]: f(self[key]) }
|
|
610
|
+
): Option.Option<Record<K, A | B>> => {
|
|
611
|
+
if (!has(self, key)) return Option.none()
|
|
612
|
+
return Option.some({ ...self, [key]: f(self[key]) })
|
|
613
613
|
}
|
|
614
614
|
)
|
|
615
615
|
|
|
@@ -620,8 +620,8 @@ export const modify: {
|
|
|
620
620
|
* ```ts
|
|
621
621
|
* import { Record } from "effect"
|
|
622
622
|
*
|
|
623
|
-
* Record.replace({ a: 1, b: 2, c: 3 }, "a", 10) // { a: 10, b: 2, c: 3 }
|
|
624
|
-
* Record.replace(Record.empty<string>(), "a", 10) //
|
|
623
|
+
* Record.replace({ a: 1, b: 2, c: 3 }, "a", 10) // Option.some({ a: 10, b: 2, c: 3 })
|
|
624
|
+
* Record.replace(Record.empty<string>(), "a", 10) // Option.none()
|
|
625
625
|
* ```
|
|
626
626
|
*
|
|
627
627
|
* @category utils
|
|
@@ -635,14 +635,14 @@ export const replace: {
|
|
|
635
635
|
* ```ts
|
|
636
636
|
* import { Record } from "effect"
|
|
637
637
|
*
|
|
638
|
-
* Record.replace({ a: 1, b: 2, c: 3 }, "a", 10) // { a: 10, b: 2, c: 3 }
|
|
639
|
-
* Record.replace(Record.empty<string>(), "a", 10) //
|
|
638
|
+
* Record.replace({ a: 1, b: 2, c: 3 }, "a", 10) // Option.some({ a: 10, b: 2, c: 3 })
|
|
639
|
+
* Record.replace(Record.empty<string>(), "a", 10) // Option.none()
|
|
640
640
|
* ```
|
|
641
641
|
*
|
|
642
642
|
* @category utils
|
|
643
643
|
* @since 2.0.0
|
|
644
644
|
*/
|
|
645
|
-
<K extends string | symbol, B>(key: NoInfer<K>, b: B): <A>(self: ReadonlyRecord<K, A>) => Record<K, A | B
|
|
645
|
+
<K extends string | symbol, B>(key: NoInfer<K>, b: B): <A>(self: ReadonlyRecord<K, A>) => Option.Option<Record<K, A | B>>
|
|
646
646
|
/**
|
|
647
647
|
* Replaces a value in the record with the new value passed as parameter.
|
|
648
648
|
*
|
|
@@ -650,26 +650,26 @@ export const replace: {
|
|
|
650
650
|
* ```ts
|
|
651
651
|
* import { Record } from "effect"
|
|
652
652
|
*
|
|
653
|
-
* Record.replace({ a: 1, b: 2, c: 3 }, "a", 10) // { a: 10, b: 2, c: 3 }
|
|
654
|
-
* Record.replace(Record.empty<string>(), "a", 10) //
|
|
653
|
+
* Record.replace({ a: 1, b: 2, c: 3 }, "a", 10) // Option.some({ a: 10, b: 2, c: 3 })
|
|
654
|
+
* Record.replace(Record.empty<string>(), "a", 10) // Option.none()
|
|
655
655
|
* ```
|
|
656
656
|
*
|
|
657
657
|
* @category utils
|
|
658
658
|
* @since 2.0.0
|
|
659
659
|
*/
|
|
660
|
-
<K extends string | symbol, A, B>(self: ReadonlyRecord<K, A>, key: NoInfer<K>, b: B): Record<K, A | B
|
|
660
|
+
<K extends string | symbol, A, B>(self: ReadonlyRecord<K, A>, key: NoInfer<K>, b: B): Option.Option<Record<K, A | B>>
|
|
661
661
|
} = dual(
|
|
662
662
|
3,
|
|
663
663
|
<K extends string | symbol, A, B>(
|
|
664
664
|
self: ReadonlyRecord<K, A>,
|
|
665
665
|
key: NoInfer<K>,
|
|
666
666
|
b: B
|
|
667
|
-
): Record<K, A | B
|
|
667
|
+
): Option.Option<Record<K, A | B>> => modify(self, key, () => b)
|
|
668
668
|
)
|
|
669
669
|
|
|
670
670
|
/**
|
|
671
|
-
* If the given key exists in the record, returns a new record with the key removed
|
|
672
|
-
*
|
|
671
|
+
* If the given key exists in the record, returns a new record with the key removed.
|
|
672
|
+
* If the key does not exist, returns a shallow copy of the original record.
|
|
673
673
|
*
|
|
674
674
|
* @example
|
|
675
675
|
* ```ts
|
|
@@ -684,8 +684,8 @@ export const replace: {
|
|
|
684
684
|
*/
|
|
685
685
|
export const remove: {
|
|
686
686
|
/**
|
|
687
|
-
* If the given key exists in the record, returns a new record with the key removed
|
|
688
|
-
*
|
|
687
|
+
* If the given key exists in the record, returns a new record with the key removed.
|
|
688
|
+
* If the key does not exist, returns a shallow copy of the original record.
|
|
689
689
|
*
|
|
690
690
|
* @example
|
|
691
691
|
* ```ts
|
|
@@ -700,8 +700,8 @@ export const remove: {
|
|
|
700
700
|
*/
|
|
701
701
|
<K extends string | symbol, X extends K>(key: X): <A>(self: ReadonlyRecord<K, A>) => Record<Exclude<K, X>, A>
|
|
702
702
|
/**
|
|
703
|
-
* If the given key exists in the record, returns a new record with the key removed
|
|
704
|
-
*
|
|
703
|
+
* If the given key exists in the record, returns a new record with the key removed.
|
|
704
|
+
* If the key does not exist, returns a shallow copy of the original record.
|
|
705
705
|
*
|
|
706
706
|
* @example
|
|
707
707
|
* ```ts
|
|
@@ -730,7 +730,7 @@ export const remove: {
|
|
|
730
730
|
/**
|
|
731
731
|
* Retrieves the value of the property with the given `key` from a record and returns an `Option`
|
|
732
732
|
* of a tuple with the value and the record with the removed property.
|
|
733
|
-
* If the key is not present, returns `
|
|
733
|
+
* If the key is not present, returns `Option.none()`.
|
|
734
734
|
*
|
|
735
735
|
* @example
|
|
736
736
|
* ```ts
|
|
@@ -738,8 +738,8 @@ export const remove: {
|
|
|
738
738
|
*
|
|
739
739
|
* const input: Record<string, number> = { a: 1, b: 2 }
|
|
740
740
|
*
|
|
741
|
-
* Record.pop(input, "a") // [1, { b: 2 }]
|
|
742
|
-
* Record.pop(input, "c") //
|
|
741
|
+
* Record.pop(input, "a") // Option.some([1, { b: 2 }])
|
|
742
|
+
* Record.pop(input, "c") // Option.none()
|
|
743
743
|
* ```
|
|
744
744
|
*
|
|
745
745
|
* @category utils
|
|
@@ -749,7 +749,7 @@ export const pop: {
|
|
|
749
749
|
/**
|
|
750
750
|
* Retrieves the value of the property with the given `key` from a record and returns an `Option`
|
|
751
751
|
* of a tuple with the value and the record with the removed property.
|
|
752
|
-
* If the key is not present, returns `
|
|
752
|
+
* If the key is not present, returns `Option.none()`.
|
|
753
753
|
*
|
|
754
754
|
* @example
|
|
755
755
|
* ```ts
|
|
@@ -757,18 +757,18 @@ export const pop: {
|
|
|
757
757
|
*
|
|
758
758
|
* const input: Record<string, number> = { a: 1, b: 2 }
|
|
759
759
|
*
|
|
760
|
-
* Record.pop(input, "a") // [1, { b: 2 }]
|
|
761
|
-
* Record.pop(input, "c") //
|
|
760
|
+
* Record.pop(input, "a") // Option.some([1, { b: 2 }])
|
|
761
|
+
* Record.pop(input, "c") // Option.none()
|
|
762
762
|
* ```
|
|
763
763
|
*
|
|
764
764
|
* @category utils
|
|
765
765
|
* @since 2.0.0
|
|
766
766
|
*/
|
|
767
|
-
<K extends string | symbol, X extends K>(key: X): <A>(self: ReadonlyRecord<K, A>) => [A, Record<Exclude<K, X>, A>]
|
|
767
|
+
<K extends string | symbol, X extends K>(key: X): <A>(self: ReadonlyRecord<K, A>) => Option.Option<[A, Record<Exclude<K, X>, A>]>
|
|
768
768
|
/**
|
|
769
769
|
* Retrieves the value of the property with the given `key` from a record and returns an `Option`
|
|
770
770
|
* of a tuple with the value and the record with the removed property.
|
|
771
|
-
* If the key is not present, returns `
|
|
771
|
+
* If the key is not present, returns `Option.none()`.
|
|
772
772
|
*
|
|
773
773
|
* @example
|
|
774
774
|
* ```ts
|
|
@@ -776,18 +776,19 @@ export const pop: {
|
|
|
776
776
|
*
|
|
777
777
|
* const input: Record<string, number> = { a: 1, b: 2 }
|
|
778
778
|
*
|
|
779
|
-
* Record.pop(input, "a") // [1, { b: 2 }]
|
|
780
|
-
* Record.pop(input, "c") //
|
|
779
|
+
* Record.pop(input, "a") // Option.some([1, { b: 2 }])
|
|
780
|
+
* Record.pop(input, "c") // Option.none()
|
|
781
781
|
* ```
|
|
782
782
|
*
|
|
783
783
|
* @category utils
|
|
784
784
|
* @since 2.0.0
|
|
785
785
|
*/
|
|
786
|
-
<K extends string | symbol, A, X extends K>(self: ReadonlyRecord<K, A>, key: X): [A, Record<Exclude<K, X>, A>]
|
|
786
|
+
<K extends string | symbol, A, X extends K>(self: ReadonlyRecord<K, A>, key: X): Option.Option<[A, Record<Exclude<K, X>, A>]>
|
|
787
787
|
} = dual(2, <K extends string | symbol, A, X extends K>(
|
|
788
788
|
self: ReadonlyRecord<K, A>,
|
|
789
789
|
key: X
|
|
790
|
-
): [A, Record<Exclude<K, X>, A>]
|
|
790
|
+
): Option.Option<[A, Record<Exclude<K, X>, A>]> =>
|
|
791
|
+
has(self, key) ? Option.some([self[key], remove(self, key)]) : Option.none())
|
|
791
792
|
|
|
792
793
|
/**
|
|
793
794
|
* Maps a record into another record by applying a transformation function to each of its values.
|
|
@@ -2158,7 +2159,7 @@ export const findFirst: {
|
|
|
2158
2159
|
* @category elements
|
|
2159
2160
|
* @since 3.14.0
|
|
2160
2161
|
*/
|
|
2161
|
-
<K extends string | symbol, V, V2 extends V>(refinement: (value: NoInfer<V>, key: NoInfer<K>) => value is V2): (self: ReadonlyRecord<K, V>) => [K, V2]
|
|
2162
|
+
<K extends string | symbol, V, V2 extends V>(refinement: (value: NoInfer<V>, key: NoInfer<K>) => value is V2): (self: ReadonlyRecord<K, V>) => Option.Option<[K, V2]>
|
|
2162
2163
|
/**
|
|
2163
2164
|
* Returns the first entry that satisfies the specified
|
|
2164
2165
|
* predicate, or `None` if no such entry exists.
|
|
@@ -2178,7 +2179,7 @@ export const findFirst: {
|
|
|
2178
2179
|
* @category elements
|
|
2179
2180
|
* @since 3.14.0
|
|
2180
2181
|
*/
|
|
2181
|
-
<K extends string | symbol, V>(predicate: (value: NoInfer<V>, key: NoInfer<K>) => boolean): (self: ReadonlyRecord<K, V>) => [K, V]
|
|
2182
|
+
<K extends string | symbol, V>(predicate: (value: NoInfer<V>, key: NoInfer<K>) => boolean): (self: ReadonlyRecord<K, V>) => Option.Option<[K, V]>
|
|
2182
2183
|
/**
|
|
2183
2184
|
* Returns the first entry that satisfies the specified
|
|
2184
2185
|
* predicate, or `None` if no such entry exists.
|
|
@@ -2201,7 +2202,7 @@ export const findFirst: {
|
|
|
2201
2202
|
<K extends string | symbol, V, V2 extends V>(
|
|
2202
2203
|
self: ReadonlyRecord<K, V>,
|
|
2203
2204
|
refinement: (value: NoInfer<V>, key: NoInfer<K>) => value is V2
|
|
2204
|
-
): [K, V2]
|
|
2205
|
+
): Option.Option<[K, V2]>
|
|
2205
2206
|
/**
|
|
2206
2207
|
* Returns the first entry that satisfies the specified
|
|
2207
2208
|
* predicate, or `None` if no such entry exists.
|
|
@@ -2224,16 +2225,20 @@ export const findFirst: {
|
|
|
2224
2225
|
<K extends string | symbol, V>(
|
|
2225
2226
|
self: ReadonlyRecord<K, V>,
|
|
2226
2227
|
predicate: (value: NoInfer<V>, key: NoInfer<K>) => boolean
|
|
2227
|
-
): [K, V]
|
|
2228
|
+
): Option.Option<[K, V]>
|
|
2228
2229
|
} = dual(
|
|
2229
2230
|
2,
|
|
2230
|
-
<K extends string | symbol, V>(
|
|
2231
|
+
<K extends string | symbol, V>(
|
|
2232
|
+
self: ReadonlyRecord<K, V>,
|
|
2233
|
+
f: (value: V, key: K) => boolean
|
|
2234
|
+
): Option.Option<[K, V]> => {
|
|
2231
2235
|
const k = keys(self)
|
|
2232
2236
|
for (let i = 0; i < k.length; i++) {
|
|
2233
2237
|
const key = k[i]
|
|
2234
2238
|
if (f(self[key], key)) {
|
|
2235
|
-
return [key, self[key]]
|
|
2239
|
+
return Option.some([key, self[key]])
|
|
2236
2240
|
}
|
|
2237
2241
|
}
|
|
2242
|
+
return Option.none()
|
|
2238
2243
|
}
|
|
2239
2244
|
)
|
package/src/Scheduler.ts
CHANGED
|
@@ -19,8 +19,17 @@ import * as ServiceMap from "./ServiceMap.ts"
|
|
|
19
19
|
*/
|
|
20
20
|
export interface Scheduler {
|
|
21
21
|
readonly executionMode: "sync" | "async"
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
shouldYield(fiber: Fiber.Fiber<unknown, unknown>): boolean
|
|
23
|
+
makeDispatcher(): SchedulerDispatcher
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @since 4.0.0
|
|
28
|
+
* @category models
|
|
29
|
+
*/
|
|
30
|
+
export interface SchedulerDispatcher {
|
|
31
|
+
scheduleTask(task: () => void, priority: number): void
|
|
32
|
+
flush(): void
|
|
24
33
|
}
|
|
25
34
|
|
|
26
35
|
/**
|
|
@@ -82,40 +91,10 @@ class PriorityBuckets {
|
|
|
82
91
|
* - Automatic yielding based on operation count
|
|
83
92
|
* - Optimized for high-throughput scenarios
|
|
84
93
|
*
|
|
85
|
-
* @example
|
|
86
|
-
* ```ts
|
|
87
|
-
* import { MixedScheduler } from "effect/Scheduler"
|
|
88
|
-
*
|
|
89
|
-
* // Create a mixed scheduler with async execution (default)
|
|
90
|
-
* const asyncScheduler = new MixedScheduler("async")
|
|
91
|
-
*
|
|
92
|
-
* // Create a mixed scheduler with sync execution
|
|
93
|
-
* const syncScheduler = new MixedScheduler("sync")
|
|
94
|
-
*
|
|
95
|
-
* // Schedule tasks with different priorities
|
|
96
|
-
* asyncScheduler.scheduleTask(() => console.log("High priority task"), 10)
|
|
97
|
-
* asyncScheduler.scheduleTask(() => console.log("Normal priority task"), 0)
|
|
98
|
-
* asyncScheduler.scheduleTask(() => console.log("Low priority task"), -1)
|
|
99
|
-
*
|
|
100
|
-
* // For sync scheduler, you can flush tasks immediately
|
|
101
|
-
* syncScheduler.scheduleTask(() => console.log("Task 1"), 0)
|
|
102
|
-
* syncScheduler.scheduleTask(() => console.log("Task 2"), 0)
|
|
103
|
-
*
|
|
104
|
-
* // Force flush all pending tasks in sync mode
|
|
105
|
-
* syncScheduler.flush()
|
|
106
|
-
* // Output: "Task 1", "Task 2"
|
|
107
|
-
*
|
|
108
|
-
* // Check execution mode
|
|
109
|
-
* console.log(asyncScheduler.executionMode) // "async"
|
|
110
|
-
* console.log(syncScheduler.executionMode) // "sync"
|
|
111
|
-
* ```
|
|
112
|
-
*
|
|
113
94
|
* @since 2.0.0
|
|
114
95
|
* @category schedulers
|
|
115
96
|
*/
|
|
116
97
|
export class MixedScheduler implements Scheduler {
|
|
117
|
-
private tasks = new PriorityBuckets()
|
|
118
|
-
private running: (() => void) | undefined = undefined
|
|
119
98
|
readonly executionMode: "sync" | "async"
|
|
120
99
|
readonly setImmediate: (f: () => void) => () => void
|
|
121
100
|
|
|
@@ -127,6 +106,32 @@ export class MixedScheduler implements Scheduler {
|
|
|
127
106
|
this.setImmediate = setImmediateFn
|
|
128
107
|
}
|
|
129
108
|
|
|
109
|
+
/**
|
|
110
|
+
* @since 2.0.0
|
|
111
|
+
*/
|
|
112
|
+
shouldYield(fiber: Fiber.Fiber<unknown, unknown>) {
|
|
113
|
+
return fiber.currentOpCount >= fiber.maxOpsBeforeYield
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* @since 2.0.0
|
|
118
|
+
*/
|
|
119
|
+
makeDispatcher() {
|
|
120
|
+
return new MixedSchedulerDispatcher(this.setImmediate)
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
class MixedSchedulerDispatcher implements SchedulerDispatcher {
|
|
125
|
+
private tasks = new PriorityBuckets()
|
|
126
|
+
private running: (() => void) | undefined = undefined
|
|
127
|
+
readonly setImmediate: (f: () => void) => () => void
|
|
128
|
+
|
|
129
|
+
constructor(
|
|
130
|
+
setImmediateFn: (f: () => void) => () => void = setImmediate
|
|
131
|
+
) {
|
|
132
|
+
this.setImmediate = setImmediateFn
|
|
133
|
+
}
|
|
134
|
+
|
|
130
135
|
/**
|
|
131
136
|
* @since 2.0.0
|
|
132
137
|
*/
|
|
@@ -158,13 +163,6 @@ export class MixedScheduler implements Scheduler {
|
|
|
158
163
|
}
|
|
159
164
|
}
|
|
160
165
|
|
|
161
|
-
/**
|
|
162
|
-
* @since 2.0.0
|
|
163
|
-
*/
|
|
164
|
-
shouldYield(fiber: Fiber.Fiber<unknown, unknown>) {
|
|
165
|
-
return fiber.currentOpCount >= fiber.maxOpsBeforeYield
|
|
166
|
-
}
|
|
167
|
-
|
|
168
166
|
/**
|
|
169
167
|
* @since 2.0.0
|
|
170
168
|
*/
|
|
@@ -187,93 +185,6 @@ export class MixedScheduler implements Scheduler {
|
|
|
187
185
|
* The default value is 2048 operations, which provides a good balance between
|
|
188
186
|
* performance and fairness in concurrent execution.
|
|
189
187
|
*
|
|
190
|
-
* @example
|
|
191
|
-
* ```ts
|
|
192
|
-
* import { Effect } from "effect"
|
|
193
|
-
* import { MaxOpsBeforeYield } from "effect/Scheduler"
|
|
194
|
-
*
|
|
195
|
-
* // Configure a fiber to yield more frequently
|
|
196
|
-
* const program = Effect.gen(function*() {
|
|
197
|
-
* // Get current max ops setting (default is 2048)
|
|
198
|
-
* const currentMax = yield* MaxOpsBeforeYield
|
|
199
|
-
* yield* Effect.log(`Default max ops before yield: ${currentMax}`)
|
|
200
|
-
*
|
|
201
|
-
* // Run with reduced max ops for more frequent yielding
|
|
202
|
-
* return yield* Effect.provideService(
|
|
203
|
-
* Effect.gen(function*() {
|
|
204
|
-
* const maxOps = yield* MaxOpsBeforeYield
|
|
205
|
-
* yield* Effect.log(`Max ops before yield: ${maxOps}`)
|
|
206
|
-
*
|
|
207
|
-
* // Run a compute-intensive task that will yield frequently
|
|
208
|
-
* let result = 0
|
|
209
|
-
* for (let i = 0; i < 10000; i++) {
|
|
210
|
-
* result += i
|
|
211
|
-
* // This will cause yielding every 100 operations
|
|
212
|
-
* yield* Effect.sync(() => result)
|
|
213
|
-
* }
|
|
214
|
-
* return result
|
|
215
|
-
* }),
|
|
216
|
-
* MaxOpsBeforeYield,
|
|
217
|
-
* 100
|
|
218
|
-
* )
|
|
219
|
-
* })
|
|
220
|
-
*
|
|
221
|
-
* // Configure for high-performance scenarios
|
|
222
|
-
* const highPerformanceProgram = Effect.gen(function*() {
|
|
223
|
-
* // Run with increased max ops for better performance (less yielding)
|
|
224
|
-
* return yield* Effect.provideService(
|
|
225
|
-
* Effect.gen(function*() {
|
|
226
|
-
* const maxOps = yield* MaxOpsBeforeYield
|
|
227
|
-
* yield* Effect.log(`High-performance max ops: ${maxOps}`)
|
|
228
|
-
*
|
|
229
|
-
* // Run multiple concurrent tasks
|
|
230
|
-
* const tasks = Array.from(
|
|
231
|
-
* { length: 100 },
|
|
232
|
-
* (_, i) =>
|
|
233
|
-
* Effect.gen(function*() {
|
|
234
|
-
* yield* Effect.sleep(`${i * 10} millis`)
|
|
235
|
-
* return `Task ${i} completed`
|
|
236
|
-
* })
|
|
237
|
-
* )
|
|
238
|
-
*
|
|
239
|
-
* return yield* Effect.all(tasks, { concurrency: "unbounded" })
|
|
240
|
-
* }),
|
|
241
|
-
* MaxOpsBeforeYield,
|
|
242
|
-
* 10000
|
|
243
|
-
* )
|
|
244
|
-
* })
|
|
245
|
-
*
|
|
246
|
-
* // Configure for fair scheduling
|
|
247
|
-
* const fairSchedulingProgram = Effect.gen(function*() {
|
|
248
|
-
* // Run with lower max ops for more frequent yielding
|
|
249
|
-
* return yield* Effect.provideService(
|
|
250
|
-
* Effect.gen(function*() {
|
|
251
|
-
* const maxOps = yield* MaxOpsBeforeYield
|
|
252
|
-
* yield* Effect.log(`Fair scheduling max ops: ${maxOps}`)
|
|
253
|
-
*
|
|
254
|
-
* const longRunningTask = Effect.gen(function*() {
|
|
255
|
-
* for (let i = 0; i < 1000; i++) {
|
|
256
|
-
* yield* Effect.sync(() => Math.random())
|
|
257
|
-
* }
|
|
258
|
-
* return "Long task completed"
|
|
259
|
-
* })
|
|
260
|
-
*
|
|
261
|
-
* const quickTask = Effect.gen(function*() {
|
|
262
|
-
* yield* Effect.sleep("10 millis")
|
|
263
|
-
* return "Quick task completed"
|
|
264
|
-
* })
|
|
265
|
-
*
|
|
266
|
-
* // Both tasks will execute fairly due to frequent yielding
|
|
267
|
-
* return yield* Effect.all([longRunningTask, quickTask], {
|
|
268
|
-
* concurrency: "unbounded"
|
|
269
|
-
* })
|
|
270
|
-
* }),
|
|
271
|
-
* MaxOpsBeforeYield,
|
|
272
|
-
* 50
|
|
273
|
-
* )
|
|
274
|
-
* })
|
|
275
|
-
* ```
|
|
276
|
-
*
|
|
277
188
|
* @since 4.0.0
|
|
278
189
|
* @category references
|
|
279
190
|
*/
|
package/src/Schema.ts
CHANGED
|
@@ -968,7 +968,7 @@ export function toStandardSchemaV1<
|
|
|
968
968
|
}),
|
|
969
969
|
{ scheduler }
|
|
970
970
|
)
|
|
971
|
-
|
|
971
|
+
fiber.currentDispatcher?.flush()
|
|
972
972
|
const exit = fiber.pollUnsafe()
|
|
973
973
|
if (exit) {
|
|
974
974
|
return makeStandardResult(exit)
|
|
@@ -6998,6 +6998,54 @@ export function OptionFromOptional<S extends Top>(schema: S): OptionFromOptional
|
|
|
6998
6998
|
))
|
|
6999
6999
|
}
|
|
7000
7000
|
|
|
7001
|
+
/**
|
|
7002
|
+
* Schema type for {@link OptionFromOptionalNullOr}.
|
|
7003
|
+
*
|
|
7004
|
+
* @category Option
|
|
7005
|
+
* @since 4.0.0
|
|
7006
|
+
*/
|
|
7007
|
+
export interface OptionFromOptionalNullOr<S extends Top> extends decodeTo<Option<toType<S>>, optional<NullOr<S>>> {}
|
|
7008
|
+
|
|
7009
|
+
/**
|
|
7010
|
+
* Decodes an optional or `null` or `undefined` value `A` to a required `Option<A>`
|
|
7011
|
+
* value.
|
|
7012
|
+
*
|
|
7013
|
+
* Decoding:
|
|
7014
|
+
* - a missing key is decoded as `None`
|
|
7015
|
+
* - a present key with an `undefined` value is decoded as `None`
|
|
7016
|
+
* - a present key with a `null` value is decoded as `None`
|
|
7017
|
+
* - all other values are decoded as `Some`
|
|
7018
|
+
*
|
|
7019
|
+
* Encoding (controlled by `options.onNoneEncoding`):
|
|
7020
|
+
* - `"omit"` (default): `None` is encoded as a missing key
|
|
7021
|
+
* - `null`: `None` is encoded as `null`
|
|
7022
|
+
* - `undefined`: `None` is encoded as `undefined`
|
|
7023
|
+
* - `Some` is always encoded as the value
|
|
7024
|
+
*
|
|
7025
|
+
* @category Option
|
|
7026
|
+
* @since 4.0.0
|
|
7027
|
+
*/
|
|
7028
|
+
export function OptionFromOptionalNullOr<S extends Top>(
|
|
7029
|
+
schema: S,
|
|
7030
|
+
options?: {
|
|
7031
|
+
readonly onNoneEncoding: "omit" | null | undefined
|
|
7032
|
+
}
|
|
7033
|
+
): OptionFromOptionalNullOr<S> {
|
|
7034
|
+
const onNoneEncoding = options === undefined ? "omit" : options.onNoneEncoding
|
|
7035
|
+
const noneValue = onNoneEncoding === null
|
|
7036
|
+
? null as S["Type"] | null | undefined
|
|
7037
|
+
: undefined as S["Type"] | null | undefined
|
|
7038
|
+
return optional(NullOr(schema)).pipe(decodeTo(
|
|
7039
|
+
Option(toType(schema)),
|
|
7040
|
+
Transformation.transformOptional<Option_.Option<S["Type"]>, S["Type"] | null | undefined>({
|
|
7041
|
+
decode: (oe) => oe.pipe(Option_.filter(Predicate.isNotNullish), Option_.some),
|
|
7042
|
+
encode: onNoneEncoding === "omit"
|
|
7043
|
+
? Option_.flatten
|
|
7044
|
+
: (ot) => Option_.some(Option_.getOrElse(Option_.flatten(ot), () => noneValue))
|
|
7045
|
+
})
|
|
7046
|
+
))
|
|
7047
|
+
}
|
|
7048
|
+
|
|
7001
7049
|
/**
|
|
7002
7050
|
* Schema for the `Result<A, E>` type, representing a computation that either
|
|
7003
7051
|
* succeeds with `A` or fails with `E`.
|
package/src/SchemaGetter.ts
CHANGED
|
@@ -1482,10 +1482,10 @@ export function decodeHexString<E extends string>(): Getter<string, E> {
|
|
|
1482
1482
|
*/
|
|
1483
1483
|
export function dateTimeUtcFromInput<E extends DateTime.DateTime.Input>(): Getter<DateTime.Utc, E> {
|
|
1484
1484
|
return transformOrFail((input) => {
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1485
|
+
return Option.match(DateTime.make(input), {
|
|
1486
|
+
onNone: () => Effect.fail(new Issue.InvalidValue(Option.some(input), { message: "Invalid DateTime input" })),
|
|
1487
|
+
onSome: (dt) => Effect.succeed(DateTime.toUtc(dt))
|
|
1488
|
+
})
|
|
1489
1489
|
})
|
|
1490
1490
|
}
|
|
1491
1491
|
|
|
@@ -907,15 +907,14 @@ export const bigintFromString = new Transformation(
|
|
|
907
907
|
*/
|
|
908
908
|
export const durationFromNanos: Transformation<Duration.Duration, bigint> = transformOrFail({
|
|
909
909
|
decode: (i) => Effect.succeed(Duration.nanos(i)),
|
|
910
|
-
encode: (a) =>
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
}
|
|
910
|
+
encode: (a) =>
|
|
911
|
+
Option.match(Duration.toNanos(a), {
|
|
912
|
+
onNone: () =>
|
|
913
|
+
Effect.fail(
|
|
914
|
+
new Issue.InvalidValue(Option.some(a), { message: `Unable to encode ${a} into a bigint` })
|
|
915
|
+
),
|
|
916
|
+
onSome: (nanos) => Effect.succeed(nanos)
|
|
917
|
+
})
|
|
919
918
|
})
|
|
920
919
|
|
|
921
920
|
/**
|
|
@@ -1239,9 +1238,9 @@ export const bigDecimalFromString: Transformation<BigDecimal.BigDecimal, string>
|
|
|
1239
1238
|
>({
|
|
1240
1239
|
decode: (s) => {
|
|
1241
1240
|
const result = BigDecimal.fromString(s)
|
|
1242
|
-
return result
|
|
1241
|
+
return Option.isNone(result)
|
|
1243
1242
|
? Effect.fail(new Issue.InvalidValue(Option.some(s), { message: `Invalid BigDecimal string: ${s}` }))
|
|
1244
|
-
: Effect.succeed(result)
|
|
1243
|
+
: Effect.succeed(result.value)
|
|
1245
1244
|
},
|
|
1246
1245
|
encode: (bd) => Effect.succeed(BigDecimal.format(bd))
|
|
1247
1246
|
})
|
|
@@ -1394,10 +1393,10 @@ export const timeZoneNamedFromString: Transformation<DateTime.TimeZone.Named, st
|
|
|
1394
1393
|
string
|
|
1395
1394
|
>({
|
|
1396
1395
|
decode: (s) => {
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1396
|
+
return Option.match(DateTime.zoneMakeNamed(s), {
|
|
1397
|
+
onNone: () => Effect.fail(new Issue.InvalidValue(Option.some(s), { message: `Invalid IANA time zone: ${s}` })),
|
|
1398
|
+
onSome: Effect.succeed
|
|
1399
|
+
})
|
|
1401
1400
|
},
|
|
1402
1401
|
encode: (tz) => Effect.succeed(tz.id)
|
|
1403
1402
|
})
|
|
@@ -1410,10 +1409,10 @@ export const timeZoneFromString: Transformation<DateTime.TimeZone, string> = tra
|
|
|
1410
1409
|
string
|
|
1411
1410
|
>({
|
|
1412
1411
|
decode: (s) => {
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1412
|
+
return Option.match(DateTime.zoneFromString(s), {
|
|
1413
|
+
onNone: () => Effect.fail(new Issue.InvalidValue(Option.some(s), { message: `Invalid time zone: ${s}` })),
|
|
1414
|
+
onSome: Effect.succeed
|
|
1415
|
+
})
|
|
1417
1416
|
},
|
|
1418
1417
|
encode: (tz) => Effect.succeed(DateTime.zoneToString(tz))
|
|
1419
1418
|
})
|
|
@@ -1426,10 +1425,10 @@ export const dateTimeUtcFromString: Transformation<DateTime.Utc, string> = trans
|
|
|
1426
1425
|
string
|
|
1427
1426
|
>({
|
|
1428
1427
|
decode: (s) => {
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1428
|
+
return Option.match(DateTime.make(s), {
|
|
1429
|
+
onNone: () => Effect.fail(new Issue.InvalidValue(Option.some(s), { message: "Invalid DateTime input" })),
|
|
1430
|
+
onSome: (result) => Effect.succeed(DateTime.toUtc(result))
|
|
1431
|
+
})
|
|
1433
1432
|
},
|
|
1434
1433
|
encode: (utc) => Effect.succeed(DateTime.formatIso(utc))
|
|
1435
1434
|
})
|
|
@@ -1442,10 +1441,11 @@ export const dateTimeZonedFromString: Transformation<DateTime.Zoned, string> = t
|
|
|
1442
1441
|
string
|
|
1443
1442
|
>({
|
|
1444
1443
|
decode: (s) => {
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
: Effect.succeed
|
|
1444
|
+
return Option.match(DateTime.makeZonedFromString(s), {
|
|
1445
|
+
onNone: () =>
|
|
1446
|
+
Effect.fail(new Issue.InvalidValue(Option.some(s), { message: `Invalid zoned DateTime string: ${s}` })),
|
|
1447
|
+
onSome: Effect.succeed
|
|
1448
|
+
})
|
|
1449
1449
|
},
|
|
1450
1450
|
encode: (zoned) => Effect.succeed(DateTime.formatIsoZoned(zoned))
|
|
1451
1451
|
})
|