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/Duration.ts
CHANGED
|
@@ -20,12 +20,12 @@ import { dual, identity } from "./Function.ts"
|
|
|
20
20
|
import * as Hash from "./Hash.ts"
|
|
21
21
|
import type * as Inspectable from "./Inspectable.ts"
|
|
22
22
|
import { NodeInspectSymbol } from "./Inspectable.ts"
|
|
23
|
+
import * as Option from "./Option.ts"
|
|
23
24
|
import * as order from "./Order.ts"
|
|
24
25
|
import type { Pipeable } from "./Pipeable.ts"
|
|
25
26
|
import { pipeArguments } from "./Pipeable.ts"
|
|
26
27
|
import { hasProperty, isNumber } from "./Predicate.ts"
|
|
27
28
|
import * as Reducer from "./Reducer.ts"
|
|
28
|
-
import * as UndefinedOr from "./UndefinedOr.ts"
|
|
29
29
|
|
|
30
30
|
const TypeId = "~effect/time/Duration"
|
|
31
31
|
|
|
@@ -228,22 +228,22 @@ const invalid = (input: unknown): never => {
|
|
|
228
228
|
|
|
229
229
|
/**
|
|
230
230
|
* Safely decodes a `Input` value into a `Duration`, returning
|
|
231
|
-
* `
|
|
231
|
+
* `Option.none()` if decoding fails.
|
|
232
232
|
*
|
|
233
233
|
* **Example**
|
|
234
234
|
*
|
|
235
235
|
* ```ts
|
|
236
|
-
* import { Duration } from "effect"
|
|
236
|
+
* import { Duration, Option } from "effect"
|
|
237
237
|
*
|
|
238
|
-
* Duration.fromInput(1000)
|
|
238
|
+
* Duration.fromInput(1000).pipe(Option.map(Duration.toSeconds)) // Some(1)
|
|
239
239
|
*
|
|
240
|
-
* Duration.fromInput("invalid" as any) //
|
|
240
|
+
* Duration.fromInput("invalid" as any) // None
|
|
241
241
|
* ```
|
|
242
242
|
*
|
|
243
243
|
* @category constructors
|
|
244
244
|
* @since 4.0.0
|
|
245
245
|
*/
|
|
246
|
-
export const fromInput: (u: Input) => Duration
|
|
246
|
+
export const fromInput: (u: Input) => Option.Option<Duration> = Option.liftThrowable(
|
|
247
247
|
fromInputUnsafe
|
|
248
248
|
)
|
|
249
249
|
|
|
@@ -823,22 +823,23 @@ export const toNanosUnsafe = (self: Duration): bigint => {
|
|
|
823
823
|
/**
|
|
824
824
|
* Get the duration in nanoseconds as a bigint.
|
|
825
825
|
*
|
|
826
|
-
* If the duration is infinite, returns `
|
|
826
|
+
* If the duration is infinite, returns `Option.none()`.
|
|
827
827
|
*
|
|
828
828
|
* **Example**
|
|
829
829
|
*
|
|
830
830
|
* ```ts
|
|
831
|
-
* import { Duration } from "effect"
|
|
831
|
+
* import { Duration, Option } from "effect"
|
|
832
832
|
*
|
|
833
|
-
* Duration.toNanos(Duration.seconds(1)) // 1000000000n
|
|
833
|
+
* Duration.toNanos(Duration.seconds(1)) // Some(1000000000n)
|
|
834
834
|
*
|
|
835
|
-
* Duration.toNanos(Duration.infinity) //
|
|
835
|
+
* Duration.toNanos(Duration.infinity) // None
|
|
836
|
+
* Option.getOrUndefined(Duration.toNanos(Duration.infinity)) // undefined
|
|
836
837
|
* ```
|
|
837
838
|
*
|
|
838
839
|
* @category getters
|
|
839
840
|
* @since 4.0.0
|
|
840
841
|
*/
|
|
841
|
-
export const toNanos: (self: Duration) => bigint
|
|
842
|
+
export const toNanos: (self: Duration) => Option.Option<bigint> = Option.liftThrowable(toNanosUnsafe)
|
|
842
843
|
|
|
843
844
|
/**
|
|
844
845
|
* Converts a Duration to high-resolution time format [seconds, nanoseconds].
|
|
@@ -1334,17 +1335,17 @@ export const clamp: {
|
|
|
1334
1335
|
} = order.clamp(Order)
|
|
1335
1336
|
|
|
1336
1337
|
/**
|
|
1337
|
-
* Divides a Duration by a number, returning `
|
|
1338
|
+
* Divides a Duration by a number, returning `Option.none()` if division is invalid.
|
|
1338
1339
|
*
|
|
1339
1340
|
* **Example**
|
|
1340
1341
|
*
|
|
1341
1342
|
* ```ts
|
|
1342
|
-
* import { Duration } from "effect"
|
|
1343
|
+
* import { Duration, Option } from "effect"
|
|
1343
1344
|
*
|
|
1344
1345
|
* const d = Duration.divide(Duration.seconds(10), 2)
|
|
1345
|
-
* console.log(d
|
|
1346
|
+
* console.log(Option.map(d, Duration.toSeconds)) // Some(5)
|
|
1346
1347
|
*
|
|
1347
|
-
* Duration.divide(Duration.seconds(10), 0) //
|
|
1348
|
+
* Duration.divide(Duration.seconds(10), 0) // None
|
|
1348
1349
|
* ```
|
|
1349
1350
|
*
|
|
1350
1351
|
* @since 4.0.0
|
|
@@ -1352,57 +1353,57 @@ export const clamp: {
|
|
|
1352
1353
|
*/
|
|
1353
1354
|
export const divide: {
|
|
1354
1355
|
/**
|
|
1355
|
-
* Divides a Duration by a number, returning `
|
|
1356
|
+
* Divides a Duration by a number, returning `Option.none()` if division is invalid.
|
|
1356
1357
|
*
|
|
1357
1358
|
* **Example**
|
|
1358
1359
|
*
|
|
1359
1360
|
* ```ts
|
|
1360
|
-
* import { Duration } from "effect"
|
|
1361
|
+
* import { Duration, Option } from "effect"
|
|
1361
1362
|
*
|
|
1362
1363
|
* const d = Duration.divide(Duration.seconds(10), 2)
|
|
1363
|
-
* console.log(d
|
|
1364
|
+
* console.log(Option.map(d, Duration.toSeconds)) // Some(5)
|
|
1364
1365
|
*
|
|
1365
|
-
* Duration.divide(Duration.seconds(10), 0) //
|
|
1366
|
+
* Duration.divide(Duration.seconds(10), 0) // None
|
|
1366
1367
|
* ```
|
|
1367
1368
|
*
|
|
1368
1369
|
* @since 4.0.0
|
|
1369
1370
|
* @category math
|
|
1370
1371
|
*/
|
|
1371
|
-
(by: number): (self: Duration) => Duration
|
|
1372
|
+
(by: number): (self: Duration) => Option.Option<Duration>
|
|
1372
1373
|
/**
|
|
1373
|
-
* Divides a Duration by a number, returning `
|
|
1374
|
+
* Divides a Duration by a number, returning `Option.none()` if division is invalid.
|
|
1374
1375
|
*
|
|
1375
1376
|
* **Example**
|
|
1376
1377
|
*
|
|
1377
1378
|
* ```ts
|
|
1378
|
-
* import { Duration } from "effect"
|
|
1379
|
+
* import { Duration, Option } from "effect"
|
|
1379
1380
|
*
|
|
1380
1381
|
* const d = Duration.divide(Duration.seconds(10), 2)
|
|
1381
|
-
* console.log(d
|
|
1382
|
+
* console.log(Option.map(d, Duration.toSeconds)) // Some(5)
|
|
1382
1383
|
*
|
|
1383
|
-
* Duration.divide(Duration.seconds(10), 0) //
|
|
1384
|
+
* Duration.divide(Duration.seconds(10), 0) // None
|
|
1384
1385
|
* ```
|
|
1385
1386
|
*
|
|
1386
1387
|
* @since 4.0.0
|
|
1387
1388
|
* @category math
|
|
1388
1389
|
*/
|
|
1389
|
-
(self: Duration, by: number): Duration
|
|
1390
|
+
(self: Duration, by: number): Option.Option<Duration>
|
|
1390
1391
|
} = dual(
|
|
1391
1392
|
2,
|
|
1392
|
-
(self: Duration, by: number): Duration
|
|
1393
|
-
if (!Number.isFinite(by)) return
|
|
1394
|
-
if (by === 0 || Object.is(by, -0)) return
|
|
1393
|
+
(self: Duration, by: number): Option.Option<Duration> => {
|
|
1394
|
+
if (!Number.isFinite(by)) return Option.none()
|
|
1395
|
+
if (by === 0 || Object.is(by, -0)) return Option.none()
|
|
1395
1396
|
return match(self, {
|
|
1396
|
-
onMillis: (millis) => make(millis / by),
|
|
1397
|
+
onMillis: (millis) => Option.some(make(millis / by)),
|
|
1397
1398
|
onNanos: (nanos) => {
|
|
1398
1399
|
try {
|
|
1399
|
-
return make(nanos / BigInt(by))
|
|
1400
|
+
return Option.some(make(nanos / BigInt(by)))
|
|
1400
1401
|
} catch {
|
|
1401
|
-
return
|
|
1402
|
+
return Option.none()
|
|
1402
1403
|
}
|
|
1403
1404
|
},
|
|
1404
|
-
onInfinity: () => by > 0 ? infinity : negativeInfinity,
|
|
1405
|
-
onNegativeInfinity: () => by > 0 ? negativeInfinity : infinity
|
|
1405
|
+
onInfinity: () => Option.some(by > 0 ? infinity : negativeInfinity),
|
|
1406
|
+
onNegativeInfinity: () => Option.some(by > 0 ? negativeInfinity : infinity)
|
|
1406
1407
|
})
|
|
1407
1408
|
}
|
|
1408
1409
|
)
|
package/src/Effect.ts
CHANGED
|
@@ -22729,7 +22729,6 @@ export const transactionWith = <A, E, R>(
|
|
|
22729
22729
|
withFiber((fiber) => {
|
|
22730
22730
|
// Always create a new transaction state, never compose with parent
|
|
22731
22731
|
const state: Transaction["Service"] = { journal: new Map(), retry: false }
|
|
22732
|
-
const scheduler = fiber.currentScheduler
|
|
22733
22732
|
let result: Exit.Exit<A, E> | undefined
|
|
22734
22733
|
return uninterruptibleMask((restore) =>
|
|
22735
22734
|
flatMap(
|
|
@@ -22750,7 +22749,7 @@ export const transactionWith = <A, E, R>(
|
|
|
22750
22749
|
return clearTransaction(state)
|
|
22751
22750
|
}
|
|
22752
22751
|
if (Exit.isSuccess(exit)) {
|
|
22753
|
-
commitTransaction(
|
|
22752
|
+
commitTransaction(fiber, state)
|
|
22754
22753
|
} else {
|
|
22755
22754
|
clearTransaction(state)
|
|
22756
22755
|
}
|
|
@@ -22792,14 +22791,14 @@ const awaitPendingTransaction = (state: Transaction["Service"]) =>
|
|
|
22792
22791
|
})
|
|
22793
22792
|
})
|
|
22794
22793
|
|
|
22795
|
-
function commitTransaction(
|
|
22794
|
+
function commitTransaction(fiber: Fiber<unknown, unknown>, state: Transaction["Service"]) {
|
|
22796
22795
|
for (const [ref, { value }] of state.journal) {
|
|
22797
22796
|
if (value !== ref.value) {
|
|
22798
22797
|
ref.version = ref.version + 1
|
|
22799
22798
|
ref.value = value
|
|
22800
22799
|
}
|
|
22801
22800
|
for (const pending of ref.pending.values()) {
|
|
22802
|
-
|
|
22801
|
+
fiber.currentDispatcher.scheduleTask(pending, 0)
|
|
22803
22802
|
}
|
|
22804
22803
|
ref.pending.clear()
|
|
22805
22804
|
}
|
package/src/Fiber.ts
CHANGED
|
@@ -81,7 +81,7 @@ import type { LogLevel } from "./LogLevel.ts"
|
|
|
81
81
|
import type { Pipeable } from "./Pipeable.ts"
|
|
82
82
|
import { hasProperty } from "./Predicate.ts"
|
|
83
83
|
import type { StackFrame } from "./References.ts"
|
|
84
|
-
import type { Scheduler } from "./Scheduler.ts"
|
|
84
|
+
import type { Scheduler, SchedulerDispatcher } from "./Scheduler.ts"
|
|
85
85
|
import type { Scope } from "./Scope.ts"
|
|
86
86
|
import type * as ServiceMap from "./ServiceMap.ts"
|
|
87
87
|
import type { AnySpan } from "./Tracer.ts"
|
|
@@ -123,6 +123,7 @@ export interface Fiber<out A, out E = never> extends Pipeable {
|
|
|
123
123
|
readonly services: ServiceMap.ServiceMap<never>
|
|
124
124
|
setServices(services: ServiceMap.ServiceMap<never>): void
|
|
125
125
|
readonly currentScheduler: Scheduler
|
|
126
|
+
readonly currentDispatcher: SchedulerDispatcher
|
|
126
127
|
readonly currentSpan?: AnySpan | undefined
|
|
127
128
|
readonly currentLogLevel: LogLevel
|
|
128
129
|
readonly minimumLogLevel: LogLevel
|
package/src/FiberHandle.ts
CHANGED
|
@@ -10,6 +10,7 @@ import * as Filter from "./Filter.ts"
|
|
|
10
10
|
import { dual } from "./Function.ts"
|
|
11
11
|
import type * as Inspectable from "./Inspectable.ts"
|
|
12
12
|
import { PipeInspectableProto } from "./internal/core.ts"
|
|
13
|
+
import * as Option from "./Option.ts"
|
|
13
14
|
import type { Pipeable } from "./Pipeable.ts"
|
|
14
15
|
import * as Predicate from "./Predicate.ts"
|
|
15
16
|
import type { Scheduler } from "./Scheduler.ts"
|
|
@@ -467,20 +468,20 @@ export const set: {
|
|
|
467
468
|
*
|
|
468
469
|
* // No fiber initially
|
|
469
470
|
* const emptyFiber = FiberHandle.getUnsafe(handle)
|
|
470
|
-
* console.log(emptyFiber ===
|
|
471
|
+
* console.log(emptyFiber._tag === "None") // true
|
|
471
472
|
*
|
|
472
473
|
* // Add a fiber
|
|
473
474
|
* yield* FiberHandle.run(handle, Effect.succeed("hello"))
|
|
474
475
|
* const fiber = FiberHandle.getUnsafe(handle)
|
|
475
|
-
* console.log(fiber
|
|
476
|
+
* console.log(fiber._tag === "Some") // true
|
|
476
477
|
* })
|
|
477
478
|
* ```
|
|
478
479
|
*
|
|
479
480
|
* @since 2.0.0
|
|
480
481
|
* @category combinators
|
|
481
482
|
*/
|
|
482
|
-
export function getUnsafe<A, E>(self: FiberHandle<A, E>): Fiber.Fiber<A, E
|
|
483
|
-
return self.state._tag === "Closed" ?
|
|
483
|
+
export function getUnsafe<A, E>(self: FiberHandle<A, E>): Option.Option<Fiber.Fiber<A, E>> {
|
|
484
|
+
return self.state._tag === "Closed" ? Option.none() : Option.fromUndefinedOr(self.state.fiber)
|
|
484
485
|
}
|
|
485
486
|
|
|
486
487
|
/**
|
|
@@ -496,10 +497,10 @@ export function getUnsafe<A, E>(self: FiberHandle<A, E>): Fiber.Fiber<A, E> | un
|
|
|
496
497
|
* // Add a fiber
|
|
497
498
|
* yield* FiberHandle.run(handle, Effect.succeed("hello"))
|
|
498
499
|
*
|
|
499
|
-
* // Get the fiber
|
|
500
|
+
* // Get the current fiber if present
|
|
500
501
|
* const fiber = yield* FiberHandle.get(handle)
|
|
501
|
-
* if (fiber) {
|
|
502
|
-
* const result = yield* Fiber.await(fiber)
|
|
502
|
+
* if (fiber._tag === "Some") {
|
|
503
|
+
* const result = yield* Fiber.await(fiber.value)
|
|
503
504
|
* console.log(result) // "hello"
|
|
504
505
|
* }
|
|
505
506
|
* })
|
|
@@ -508,7 +509,7 @@ export function getUnsafe<A, E>(self: FiberHandle<A, E>): Fiber.Fiber<A, E> | un
|
|
|
508
509
|
* @since 2.0.0
|
|
509
510
|
* @category combinators
|
|
510
511
|
*/
|
|
511
|
-
export function get<A, E>(self: FiberHandle<A, E>): Effect.Effect<Fiber.Fiber<A, E
|
|
512
|
+
export function get<A, E>(self: FiberHandle<A, E>): Effect.Effect<Option.Option<Fiber.Fiber<A, E>>> {
|
|
512
513
|
return Effect.suspend(() => Effect.succeed(getUnsafe(self)))
|
|
513
514
|
}
|
|
514
515
|
|
|
@@ -528,7 +529,7 @@ export function get<A, E>(self: FiberHandle<A, E>): Effect.Effect<Fiber.Fiber<A,
|
|
|
528
529
|
*
|
|
529
530
|
* // The handle is now empty
|
|
530
531
|
* const fiber = FiberHandle.getUnsafe(handle)
|
|
531
|
-
* console.log(fiber) //
|
|
532
|
+
* console.log(fiber) // Option.none()
|
|
532
533
|
* })
|
|
533
534
|
* ```
|
|
534
535
|
*
|
package/src/FiberMap.ts
CHANGED
|
@@ -500,8 +500,8 @@ export const set: {
|
|
|
500
500
|
*
|
|
501
501
|
* // Retrieve the fiber
|
|
502
502
|
* const retrieved = FiberMap.getUnsafe(map, "greeting")
|
|
503
|
-
* if (retrieved) {
|
|
504
|
-
* const result = yield* Fiber.await(retrieved)
|
|
503
|
+
* if (retrieved._tag === "Some") {
|
|
504
|
+
* const result = yield* Fiber.await(retrieved.value)
|
|
505
505
|
* console.log(result) // "Hello"
|
|
506
506
|
* }
|
|
507
507
|
* })
|
|
@@ -527,8 +527,8 @@ export const getUnsafe: {
|
|
|
527
527
|
*
|
|
528
528
|
* // Retrieve the fiber
|
|
529
529
|
* const retrieved = FiberMap.getUnsafe(map, "greeting")
|
|
530
|
-
* if (retrieved) {
|
|
531
|
-
* const result = yield* Fiber.await(retrieved)
|
|
530
|
+
* if (retrieved._tag === "Some") {
|
|
531
|
+
* const result = yield* Fiber.await(retrieved.value)
|
|
532
532
|
* console.log(result) // "Hello"
|
|
533
533
|
* }
|
|
534
534
|
* })
|
|
@@ -537,7 +537,7 @@ export const getUnsafe: {
|
|
|
537
537
|
* @since 2.0.0
|
|
538
538
|
* @category combinators
|
|
539
539
|
*/
|
|
540
|
-
<K>(key: K): <A, E>(self: FiberMap<K, A, E>) => Fiber.Fiber<A, E
|
|
540
|
+
<K>(key: K): <A, E>(self: FiberMap<K, A, E>) => Option.Option<Fiber.Fiber<A, E>>
|
|
541
541
|
/**
|
|
542
542
|
* Retrieve a fiber from the FiberMap.
|
|
543
543
|
*
|
|
@@ -554,8 +554,8 @@ export const getUnsafe: {
|
|
|
554
554
|
*
|
|
555
555
|
* // Retrieve the fiber
|
|
556
556
|
* const retrieved = FiberMap.getUnsafe(map, "greeting")
|
|
557
|
-
* if (retrieved) {
|
|
558
|
-
* const result = yield* Fiber.await(retrieved)
|
|
557
|
+
* if (retrieved._tag === "Some") {
|
|
558
|
+
* const result = yield* Fiber.await(retrieved.value)
|
|
559
559
|
* console.log(result) // "Hello"
|
|
560
560
|
* }
|
|
561
561
|
* })
|
|
@@ -564,18 +564,18 @@ export const getUnsafe: {
|
|
|
564
564
|
* @since 2.0.0
|
|
565
565
|
* @category combinators
|
|
566
566
|
*/
|
|
567
|
-
<K, A, E>(self: FiberMap<K, A, E>, key: K): Fiber.Fiber<A, E
|
|
567
|
+
<K, A, E>(self: FiberMap<K, A, E>, key: K): Option.Option<Fiber.Fiber<A, E>>
|
|
568
568
|
} = dual(
|
|
569
569
|
2,
|
|
570
|
-
<K, A, E>(self: FiberMap<K, A, E>, key: K): Fiber.Fiber<A, E
|
|
571
|
-
return self.state._tag === "Closed" ?
|
|
570
|
+
<K, A, E>(self: FiberMap<K, A, E>, key: K): Option.Option<Fiber.Fiber<A, E>> => {
|
|
571
|
+
return self.state._tag === "Closed" ? Option.none() : MutableHashMap.get(self.state.backing, key)
|
|
572
572
|
}
|
|
573
573
|
)
|
|
574
574
|
|
|
575
575
|
/**
|
|
576
576
|
* Retrieve a fiber from the FiberMap.
|
|
577
577
|
*
|
|
578
|
-
* Returns an
|
|
578
|
+
* Returns an `Option` wrapped in `Effect`.
|
|
579
579
|
*
|
|
580
580
|
* @example
|
|
581
581
|
* ```ts
|
|
@@ -590,8 +590,8 @@ export const getUnsafe: {
|
|
|
590
590
|
*
|
|
591
591
|
* // Retrieve the fiber with error handling
|
|
592
592
|
* const retrieved = yield* FiberMap.get(map, "greeting")
|
|
593
|
-
* if (retrieved) {
|
|
594
|
-
* const result = yield* Fiber.await(retrieved)
|
|
593
|
+
* if (retrieved._tag === "Some") {
|
|
594
|
+
* const result = yield* Fiber.await(retrieved.value)
|
|
595
595
|
* console.log(result) // "Hello"
|
|
596
596
|
* }
|
|
597
597
|
* })
|
|
@@ -604,7 +604,7 @@ export const get: {
|
|
|
604
604
|
/**
|
|
605
605
|
* Retrieve a fiber from the FiberMap.
|
|
606
606
|
*
|
|
607
|
-
* Returns an
|
|
607
|
+
* Returns an `Option` wrapped in `Effect`.
|
|
608
608
|
*
|
|
609
609
|
* @example
|
|
610
610
|
* ```ts
|
|
@@ -619,8 +619,8 @@ export const get: {
|
|
|
619
619
|
*
|
|
620
620
|
* // Retrieve the fiber with error handling
|
|
621
621
|
* const retrieved = yield* FiberMap.get(map, "greeting")
|
|
622
|
-
* if (retrieved) {
|
|
623
|
-
* const result = yield* Fiber.await(retrieved)
|
|
622
|
+
* if (retrieved._tag === "Some") {
|
|
623
|
+
* const result = yield* Fiber.await(retrieved.value)
|
|
624
624
|
* console.log(result) // "Hello"
|
|
625
625
|
* }
|
|
626
626
|
* })
|
|
@@ -629,11 +629,11 @@ export const get: {
|
|
|
629
629
|
* @since 2.0.0
|
|
630
630
|
* @category combinators
|
|
631
631
|
*/
|
|
632
|
-
<K>(key: K): <A, E>(self: FiberMap<K, A, E>) => Effect.Effect<Fiber.Fiber<A, E
|
|
632
|
+
<K>(key: K): <A, E>(self: FiberMap<K, A, E>) => Effect.Effect<Option.Option<Fiber.Fiber<A, E>>>
|
|
633
633
|
/**
|
|
634
634
|
* Retrieve a fiber from the FiberMap.
|
|
635
635
|
*
|
|
636
|
-
* Returns an
|
|
636
|
+
* Returns an `Option` wrapped in `Effect`.
|
|
637
637
|
*
|
|
638
638
|
* @example
|
|
639
639
|
* ```ts
|
|
@@ -648,8 +648,8 @@ export const get: {
|
|
|
648
648
|
*
|
|
649
649
|
* // Retrieve the fiber with error handling
|
|
650
650
|
* const retrieved = yield* FiberMap.get(map, "greeting")
|
|
651
|
-
* if (retrieved) {
|
|
652
|
-
* const result = yield* Fiber.await(retrieved)
|
|
651
|
+
* if (retrieved._tag === "Some") {
|
|
652
|
+
* const result = yield* Fiber.await(retrieved.value)
|
|
653
653
|
* console.log(result) // "Hello"
|
|
654
654
|
* }
|
|
655
655
|
* })
|
|
@@ -658,10 +658,10 @@ export const get: {
|
|
|
658
658
|
* @since 2.0.0
|
|
659
659
|
* @category combinators
|
|
660
660
|
*/
|
|
661
|
-
<K, A, E>(self: FiberMap<K, A, E>, key: K): Effect.Effect<Fiber.Fiber<A, E
|
|
661
|
+
<K, A, E>(self: FiberMap<K, A, E>, key: K): Effect.Effect<Option.Option<Fiber.Fiber<A, E>>>
|
|
662
662
|
} = dual(
|
|
663
663
|
2,
|
|
664
|
-
<K, A, E>(self: FiberMap<K, A, E>, key: K): Effect.Effect<Fiber.Fiber<A, E
|
|
664
|
+
<K, A, E>(self: FiberMap<K, A, E>, key: K): Effect.Effect<Option.Option<Fiber.Fiber<A, E>>> =>
|
|
665
665
|
Effect.suspend(() => Effect.succeed(getUnsafe(self, key)))
|
|
666
666
|
)
|
|
667
667
|
|
package/src/FileSystem.ts
CHANGED
|
@@ -41,6 +41,7 @@ import * as Cause from "./Cause.ts"
|
|
|
41
41
|
import * as Effect from "./Effect.ts"
|
|
42
42
|
import { pipe } from "./Function.ts"
|
|
43
43
|
import * as Layer from "./Layer.ts"
|
|
44
|
+
import * as Option from "./Option.ts"
|
|
44
45
|
import { badArgument, type PlatformError, systemError } from "./PlatformError.ts"
|
|
45
46
|
import type * as Pull from "./Pull.ts"
|
|
46
47
|
import type { Scope } from "./Scope.ts"
|
|
@@ -759,7 +760,7 @@ export const make = (
|
|
|
759
760
|
const readChunk = file.readAlloc(chunkSize)
|
|
760
761
|
return Stream.fromPull(Effect.succeed(
|
|
761
762
|
Effect.flatMap(
|
|
762
|
-
Effect.suspend((): Pull.Pull<Uint8Array
|
|
763
|
+
Effect.suspend((): Pull.Pull<Option.Option<Uint8Array>, PlatformError> => {
|
|
763
764
|
if (bytesToRead !== undefined && bytesToRead <= totalBytesRead) {
|
|
764
765
|
return Cause.done()
|
|
765
766
|
}
|
|
@@ -767,11 +768,13 @@ export const make = (
|
|
|
767
768
|
? file.readAlloc(bytesToRead - totalBytesRead)
|
|
768
769
|
: readChunk
|
|
769
770
|
}),
|
|
770
|
-
(
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
771
|
+
Option.match({
|
|
772
|
+
onNone: () => Cause.done(),
|
|
773
|
+
onSome: (buf) => {
|
|
774
|
+
totalBytesRead += BigInt(buf.length)
|
|
775
|
+
return Effect.succeed(Arr.of(buf))
|
|
776
|
+
}
|
|
777
|
+
})
|
|
775
778
|
)
|
|
776
779
|
))
|
|
777
780
|
}, Stream.unwrap),
|
|
@@ -1046,7 +1049,7 @@ export interface File {
|
|
|
1046
1049
|
readonly seek: (offset: SizeInput, from: SeekMode) => Effect.Effect<void>
|
|
1047
1050
|
readonly sync: Effect.Effect<void, PlatformError>
|
|
1048
1051
|
readonly read: (buffer: Uint8Array) => Effect.Effect<Size, PlatformError>
|
|
1049
|
-
readonly readAlloc: (size: SizeInput) => Effect.Effect<Uint8Array
|
|
1052
|
+
readonly readAlloc: (size: SizeInput) => Effect.Effect<Option.Option<Uint8Array>, PlatformError>
|
|
1050
1053
|
readonly truncate: (length?: SizeInput) => Effect.Effect<void, PlatformError>
|
|
1051
1054
|
readonly write: (buffer: Uint8Array) => Effect.Effect<Size, PlatformError>
|
|
1052
1055
|
readonly writeAll: (buffer: Uint8Array) => Effect.Effect<void, PlatformError>
|
|
@@ -1096,7 +1099,7 @@ export declare namespace File {
|
|
|
1096
1099
|
*
|
|
1097
1100
|
* @example
|
|
1098
1101
|
* ```ts
|
|
1099
|
-
* import { Console, Effect, FileSystem } from "effect"
|
|
1102
|
+
* import { Console, Effect, FileSystem, Option } from "effect"
|
|
1100
1103
|
*
|
|
1101
1104
|
* const program = Effect.gen(function*() {
|
|
1102
1105
|
* const fs = yield* FileSystem.FileSystem
|
|
@@ -1108,7 +1111,7 @@ export declare namespace File {
|
|
|
1108
1111
|
* yield* Console.log(`Mode: ${info.mode.toString(8)}`) // Octal permissions
|
|
1109
1112
|
*
|
|
1110
1113
|
* // Handle optional timestamps
|
|
1111
|
-
* const mtime = info.mtime
|
|
1114
|
+
* const mtime = Option.getOrElse(info.mtime, () => new Date(0))
|
|
1112
1115
|
* yield* Console.log(`Modified: ${mtime.toISOString()}`)
|
|
1113
1116
|
*
|
|
1114
1117
|
* // Check if it's a regular file
|
|
@@ -1123,19 +1126,19 @@ export declare namespace File {
|
|
|
1123
1126
|
*/
|
|
1124
1127
|
export interface Info {
|
|
1125
1128
|
readonly type: Type
|
|
1126
|
-
readonly mtime: Date
|
|
1127
|
-
readonly atime: Date
|
|
1128
|
-
readonly birthtime: Date
|
|
1129
|
+
readonly mtime: Option.Option<Date>
|
|
1130
|
+
readonly atime: Option.Option<Date>
|
|
1131
|
+
readonly birthtime: Option.Option<Date>
|
|
1129
1132
|
readonly dev: number
|
|
1130
|
-
readonly ino: number
|
|
1133
|
+
readonly ino: Option.Option<number>
|
|
1131
1134
|
readonly mode: number
|
|
1132
|
-
readonly nlink: number
|
|
1133
|
-
readonly uid: number
|
|
1134
|
-
readonly gid: number
|
|
1135
|
-
readonly rdev: number
|
|
1135
|
+
readonly nlink: Option.Option<number>
|
|
1136
|
+
readonly uid: Option.Option<number>
|
|
1137
|
+
readonly gid: Option.Option<number>
|
|
1138
|
+
readonly rdev: Option.Option<number>
|
|
1136
1139
|
readonly size: Size
|
|
1137
|
-
readonly blksize: Size
|
|
1138
|
-
readonly blocks: number
|
|
1140
|
+
readonly blksize: Option.Option<Size>
|
|
1141
|
+
readonly blocks: Option.Option<number>
|
|
1139
1142
|
}
|
|
1140
1143
|
}
|
|
1141
1144
|
|
|
@@ -1226,13 +1229,13 @@ export declare namespace WatchEvent {
|
|
|
1226
1229
|
*
|
|
1227
1230
|
* @example
|
|
1228
1231
|
* ```ts
|
|
1229
|
-
* import { Effect, FileSystem, Stream } from "effect"
|
|
1232
|
+
* import { Effect, FileSystem, Option, Stream } from "effect"
|
|
1230
1233
|
*
|
|
1231
1234
|
* // Custom watch backend implementation
|
|
1232
1235
|
* const customWatchBackend = {
|
|
1233
1236
|
* register: (path: string, stat: FileSystem.File.Info) => {
|
|
1234
1237
|
* // Implementation would depend on platform
|
|
1235
|
-
* return Stream.empty // Placeholder implementation
|
|
1238
|
+
* return Option.some(Stream.empty) // Placeholder implementation
|
|
1236
1239
|
* }
|
|
1237
1240
|
* }
|
|
1238
1241
|
*
|
|
@@ -1255,5 +1258,5 @@ export declare namespace WatchEvent {
|
|
|
1255
1258
|
* @category file watcher
|
|
1256
1259
|
*/
|
|
1257
1260
|
export class WatchBackend extends ServiceMap.Service<WatchBackend, {
|
|
1258
|
-
readonly register: (path: string, stat: File.Info) => Stream.Stream<WatchEvent, PlatformError
|
|
1261
|
+
readonly register: (path: string, stat: File.Info) => Option.Option<Stream.Stream<WatchEvent, PlatformError>>
|
|
1259
1262
|
}>()("effect/platform/FileSystem/WatchBackend") {}
|