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/Chunk.ts
CHANGED
|
@@ -88,7 +88,6 @@ import { hasProperty, type Predicate, type Refinement } from "./Predicate.ts"
|
|
|
88
88
|
import * as R from "./Result.ts"
|
|
89
89
|
import type { Result } from "./Result.ts"
|
|
90
90
|
import type { Covariant, NoInfer } from "./Types.ts"
|
|
91
|
-
import * as UndefinedOr from "./UndefinedOr.ts"
|
|
92
91
|
|
|
93
92
|
const TypeId = "~effect/collections/Chunk"
|
|
94
93
|
|
|
@@ -3467,7 +3466,7 @@ export const splitWhere: {
|
|
|
3467
3466
|
* @since 2.0.0
|
|
3468
3467
|
* @category elements
|
|
3469
3468
|
*/
|
|
3470
|
-
export const tail = <A>(self: Chunk<A>): Chunk<A
|
|
3469
|
+
export const tail = <A>(self: Chunk<A>): O.Option<Chunk<A>> => self.length > 0 ? O.some(drop(self, 1)) : O.none()
|
|
3471
3470
|
|
|
3472
3471
|
/**
|
|
3473
3472
|
* Returns every elements after the first.
|
|
@@ -4096,15 +4095,15 @@ export const remove: {
|
|
|
4096
4095
|
*
|
|
4097
4096
|
* const chunk = Chunk.make(1, 2, 3, 4)
|
|
4098
4097
|
* const result = Chunk.modify(chunk, 1, (n) => n * 10)
|
|
4099
|
-
* console.log(result) //
|
|
4098
|
+
* console.log(result) // Option.some(Chunk.make(1, 20, 3, 4))
|
|
4100
4099
|
*
|
|
4101
4100
|
* // Index out of bounds returns None
|
|
4102
|
-
* const outOfBounds = chunk
|
|
4103
|
-
* console.log(outOfBounds
|
|
4101
|
+
* const outOfBounds = chunk.pipe(Chunk.modify(10, (n) => n * 10))
|
|
4102
|
+
* console.log(outOfBounds) // Option.none()
|
|
4104
4103
|
*
|
|
4105
4104
|
* // Negative index returns None
|
|
4106
|
-
* const negative = chunk
|
|
4107
|
-
* console.log(negative
|
|
4105
|
+
* const negative = chunk.pipe(Chunk.modify(-1, (n) => n * 10))
|
|
4106
|
+
* console.log(negative) // Option.none()
|
|
4108
4107
|
* ```
|
|
4109
4108
|
*
|
|
4110
4109
|
* @category elements
|
|
@@ -4121,21 +4120,21 @@ export const modify: {
|
|
|
4121
4120
|
*
|
|
4122
4121
|
* const chunk = Chunk.make(1, 2, 3, 4)
|
|
4123
4122
|
* const result = Chunk.modify(chunk, 1, (n) => n * 10)
|
|
4124
|
-
* console.log(result) //
|
|
4123
|
+
* console.log(result) // Option.some(Chunk.make(1, 20, 3, 4))
|
|
4125
4124
|
*
|
|
4126
4125
|
* // Index out of bounds returns None
|
|
4127
|
-
* const outOfBounds = chunk
|
|
4128
|
-
* console.log(outOfBounds
|
|
4126
|
+
* const outOfBounds = chunk.pipe(Chunk.modify(10, (n) => n * 10))
|
|
4127
|
+
* console.log(outOfBounds) // Option.none()
|
|
4129
4128
|
*
|
|
4130
4129
|
* // Negative index returns None
|
|
4131
|
-
* const negative = chunk
|
|
4132
|
-
* console.log(negative
|
|
4130
|
+
* const negative = chunk.pipe(Chunk.modify(-1, (n) => n * 10))
|
|
4131
|
+
* console.log(negative) // Option.none()
|
|
4133
4132
|
* ```
|
|
4134
4133
|
*
|
|
4135
4134
|
* @category elements
|
|
4136
4135
|
* @since 2.0.0
|
|
4137
4136
|
*/
|
|
4138
|
-
<A, B>(i: number, f: (a: A) => B): (self: Chunk<A>) => Chunk<A | B
|
|
4137
|
+
<A, B>(i: number, f: (a: A) => B): (self: Chunk<A>) => O.Option<Chunk<A | B>>
|
|
4139
4138
|
/**
|
|
4140
4139
|
* Applies a function to the element at the specified index, creating a new `Chunk`,
|
|
4141
4140
|
* or returns `None` if the index is out of bounds.
|
|
@@ -4146,25 +4145,25 @@ export const modify: {
|
|
|
4146
4145
|
*
|
|
4147
4146
|
* const chunk = Chunk.make(1, 2, 3, 4)
|
|
4148
4147
|
* const result = Chunk.modify(chunk, 1, (n) => n * 10)
|
|
4149
|
-
* console.log(result) //
|
|
4148
|
+
* console.log(result) // Option.some(Chunk.make(1, 20, 3, 4))
|
|
4150
4149
|
*
|
|
4151
4150
|
* // Index out of bounds returns None
|
|
4152
|
-
* const outOfBounds = chunk
|
|
4153
|
-
* console.log(outOfBounds
|
|
4151
|
+
* const outOfBounds = chunk.pipe(Chunk.modify(10, (n) => n * 10))
|
|
4152
|
+
* console.log(outOfBounds) // Option.none()
|
|
4154
4153
|
*
|
|
4155
4154
|
* // Negative index returns None
|
|
4156
|
-
* const negative = chunk
|
|
4157
|
-
* console.log(negative
|
|
4155
|
+
* const negative = chunk.pipe(Chunk.modify(-1, (n) => n * 10))
|
|
4156
|
+
* console.log(negative) // Option.none()
|
|
4158
4157
|
* ```
|
|
4159
4158
|
*
|
|
4160
4159
|
* @category elements
|
|
4161
4160
|
* @since 2.0.0
|
|
4162
4161
|
*/
|
|
4163
|
-
<A, B>(self: Chunk<A>, i: number, f: (a: A) => B): Chunk<A | B
|
|
4162
|
+
<A, B>(self: Chunk<A>, i: number, f: (a: A) => B): O.Option<Chunk<A | B>>
|
|
4164
4163
|
} = dual(
|
|
4165
4164
|
3,
|
|
4166
|
-
<A, B>(self: Chunk<A>, i: number, f: (a: A) => B): Chunk<A | B
|
|
4167
|
-
|
|
4165
|
+
<A, B>(self: Chunk<A>, i: number, f: (a: A) => B): O.Option<Chunk<A | B>> =>
|
|
4166
|
+
pipe(RA.modify(toReadonlyArray(self), i, f), O.map(fromArrayUnsafe))
|
|
4168
4167
|
)
|
|
4169
4168
|
|
|
4170
4169
|
/**
|
|
@@ -4177,15 +4176,15 @@ export const modify: {
|
|
|
4177
4176
|
*
|
|
4178
4177
|
* const chunk = Chunk.make("a", "b", "c", "d")
|
|
4179
4178
|
* const result = Chunk.replace(chunk, 1, "X")
|
|
4180
|
-
* console.log(result) //
|
|
4179
|
+
* console.log(result) // Option.some(Chunk.make("a", "X", "c", "d"))
|
|
4181
4180
|
*
|
|
4182
4181
|
* // Index out of bounds returns None
|
|
4183
|
-
* const outOfBounds = chunk
|
|
4184
|
-
* console.log(outOfBounds
|
|
4182
|
+
* const outOfBounds = chunk.pipe(Chunk.replace(10, "Y"))
|
|
4183
|
+
* console.log(outOfBounds) // Option.none()
|
|
4185
4184
|
*
|
|
4186
4185
|
* // Negative index returns None
|
|
4187
|
-
* const negative = chunk
|
|
4188
|
-
* console.log(negative
|
|
4186
|
+
* const negative = chunk.pipe(Chunk.replace(-1, "Z"))
|
|
4187
|
+
* console.log(negative) // Option.none()
|
|
4189
4188
|
* ```
|
|
4190
4189
|
*
|
|
4191
4190
|
* @category elements
|
|
@@ -4202,21 +4201,21 @@ export const replace: {
|
|
|
4202
4201
|
*
|
|
4203
4202
|
* const chunk = Chunk.make("a", "b", "c", "d")
|
|
4204
4203
|
* const result = Chunk.replace(chunk, 1, "X")
|
|
4205
|
-
* console.log(result) //
|
|
4204
|
+
* console.log(result) // Option.some(Chunk.make("a", "X", "c", "d"))
|
|
4206
4205
|
*
|
|
4207
4206
|
* // Index out of bounds returns None
|
|
4208
|
-
* const outOfBounds = chunk
|
|
4209
|
-
* console.log(outOfBounds
|
|
4207
|
+
* const outOfBounds = chunk.pipe(Chunk.replace(10, "Y"))
|
|
4208
|
+
* console.log(outOfBounds) // Option.none()
|
|
4210
4209
|
*
|
|
4211
4210
|
* // Negative index returns None
|
|
4212
|
-
* const negative = chunk
|
|
4213
|
-
* console.log(negative
|
|
4211
|
+
* const negative = chunk.pipe(Chunk.replace(-1, "Z"))
|
|
4212
|
+
* console.log(negative) // Option.none()
|
|
4214
4213
|
* ```
|
|
4215
4214
|
*
|
|
4216
4215
|
* @category elements
|
|
4217
4216
|
* @since 2.0.0
|
|
4218
4217
|
*/
|
|
4219
|
-
<B>(i: number, b: B): <A>(self: Chunk<A>) => Chunk<B | A
|
|
4218
|
+
<B>(i: number, b: B): <A>(self: Chunk<A>) => O.Option<Chunk<B | A>>
|
|
4220
4219
|
/**
|
|
4221
4220
|
* Change the element at the specified index, creating a new `Chunk`,
|
|
4222
4221
|
* or returns `None` if the index is out of bounds.
|
|
@@ -4227,22 +4226,22 @@ export const replace: {
|
|
|
4227
4226
|
*
|
|
4228
4227
|
* const chunk = Chunk.make("a", "b", "c", "d")
|
|
4229
4228
|
* const result = Chunk.replace(chunk, 1, "X")
|
|
4230
|
-
* console.log(result) //
|
|
4229
|
+
* console.log(result) // Option.some(Chunk.make("a", "X", "c", "d"))
|
|
4231
4230
|
*
|
|
4232
4231
|
* // Index out of bounds returns None
|
|
4233
|
-
* const outOfBounds = chunk
|
|
4234
|
-
* console.log(outOfBounds
|
|
4232
|
+
* const outOfBounds = chunk.pipe(Chunk.replace(10, "Y"))
|
|
4233
|
+
* console.log(outOfBounds) // Option.none()
|
|
4235
4234
|
*
|
|
4236
4235
|
* // Negative index returns None
|
|
4237
|
-
* const negative = chunk
|
|
4238
|
-
* console.log(negative
|
|
4236
|
+
* const negative = chunk.pipe(Chunk.replace(-1, "Z"))
|
|
4237
|
+
* console.log(negative) // Option.none()
|
|
4239
4238
|
* ```
|
|
4240
4239
|
*
|
|
4241
4240
|
* @category elements
|
|
4242
4241
|
* @since 2.0.0
|
|
4243
4242
|
*/
|
|
4244
|
-
<A, B>(self: Chunk<A>, i: number, b: B): Chunk<B | A
|
|
4245
|
-
} = dual(3, <A, B>(self: Chunk<A>, i: number, b: B): Chunk<B | A
|
|
4243
|
+
<A, B>(self: Chunk<A>, i: number, b: B): O.Option<Chunk<B | A>>
|
|
4244
|
+
} = dual(3, <A, B>(self: Chunk<A>, i: number, b: B): O.Option<Chunk<B | A>> => modify(self, i, () => b))
|
|
4246
4245
|
|
|
4247
4246
|
/**
|
|
4248
4247
|
* Return a Chunk of length n with element i initialized with f(i).
|
|
@@ -4603,15 +4602,15 @@ export const findFirst: {
|
|
|
4603
4602
|
*
|
|
4604
4603
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
4605
4604
|
* const result = Chunk.findFirstIndex(chunk, (n) => n > 3)
|
|
4606
|
-
* console.log(result) // 3
|
|
4605
|
+
* console.log(result) // Option.some(3)
|
|
4607
4606
|
*
|
|
4608
4607
|
* // No match found
|
|
4609
4608
|
* const notFound = Chunk.findFirstIndex(chunk, (n) => n > 10)
|
|
4610
|
-
* console.log(notFound) //
|
|
4609
|
+
* console.log(notFound) // Option.none()
|
|
4611
4610
|
*
|
|
4612
4611
|
* // Find first even number
|
|
4613
4612
|
* const firstEven = Chunk.findFirstIndex(chunk, (n) => n % 2 === 0)
|
|
4614
|
-
* console.log(firstEven) // 1
|
|
4613
|
+
* console.log(firstEven) // Option.some(1)
|
|
4615
4614
|
* ```
|
|
4616
4615
|
*
|
|
4617
4616
|
* @category elements
|
|
@@ -4627,21 +4626,21 @@ export const findFirstIndex: {
|
|
|
4627
4626
|
*
|
|
4628
4627
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
4629
4628
|
* const result = Chunk.findFirstIndex(chunk, (n) => n > 3)
|
|
4630
|
-
* console.log(result) // 3
|
|
4629
|
+
* console.log(result) // Option.some(3)
|
|
4631
4630
|
*
|
|
4632
4631
|
* // No match found
|
|
4633
4632
|
* const notFound = Chunk.findFirstIndex(chunk, (n) => n > 10)
|
|
4634
|
-
* console.log(notFound) //
|
|
4633
|
+
* console.log(notFound) // Option.none()
|
|
4635
4634
|
*
|
|
4636
4635
|
* // Find first even number
|
|
4637
4636
|
* const firstEven = Chunk.findFirstIndex(chunk, (n) => n % 2 === 0)
|
|
4638
|
-
* console.log(firstEven) // 1
|
|
4637
|
+
* console.log(firstEven) // Option.some(1)
|
|
4639
4638
|
* ```
|
|
4640
4639
|
*
|
|
4641
4640
|
* @category elements
|
|
4642
4641
|
* @since 2.0.0
|
|
4643
4642
|
*/
|
|
4644
|
-
<A>(predicate: Predicate<A>): (self: Chunk<A>) => number
|
|
4643
|
+
<A>(predicate: Predicate<A>): (self: Chunk<A>) => O.Option<number>
|
|
4645
4644
|
/**
|
|
4646
4645
|
* Return the first index for which a predicate holds.
|
|
4647
4646
|
*
|
|
@@ -4651,22 +4650,25 @@ export const findFirstIndex: {
|
|
|
4651
4650
|
*
|
|
4652
4651
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
4653
4652
|
* const result = Chunk.findFirstIndex(chunk, (n) => n > 3)
|
|
4654
|
-
* console.log(result) // 3
|
|
4653
|
+
* console.log(result) // Option.some(3)
|
|
4655
4654
|
*
|
|
4656
4655
|
* // No match found
|
|
4657
4656
|
* const notFound = Chunk.findFirstIndex(chunk, (n) => n > 10)
|
|
4658
|
-
* console.log(notFound) //
|
|
4657
|
+
* console.log(notFound) // Option.none()
|
|
4659
4658
|
*
|
|
4660
4659
|
* // Find first even number
|
|
4661
4660
|
* const firstEven = Chunk.findFirstIndex(chunk, (n) => n % 2 === 0)
|
|
4662
|
-
* console.log(firstEven) // 1
|
|
4661
|
+
* console.log(firstEven) // Option.some(1)
|
|
4663
4662
|
* ```
|
|
4664
4663
|
*
|
|
4665
4664
|
* @category elements
|
|
4666
4665
|
* @since 2.0.0
|
|
4667
4666
|
*/
|
|
4668
|
-
<A>(self: Chunk<A>, predicate: Predicate<A>): number
|
|
4669
|
-
} =
|
|
4667
|
+
<A>(self: Chunk<A>, predicate: Predicate<A>): O.Option<number>
|
|
4668
|
+
} = dual(
|
|
4669
|
+
2,
|
|
4670
|
+
<A>(self: Chunk<A>, predicate: Predicate<A>): O.Option<number> => RA.findFirstIndex(self, predicate)
|
|
4671
|
+
)
|
|
4670
4672
|
|
|
4671
4673
|
/**
|
|
4672
4674
|
* Find the last element for which a predicate holds.
|
|
@@ -4809,15 +4811,15 @@ export const findLast: {
|
|
|
4809
4811
|
*
|
|
4810
4812
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
4811
4813
|
* const result = Chunk.findLastIndex(chunk, (n) => n < 4)
|
|
4812
|
-
* console.log(result) // 2
|
|
4814
|
+
* console.log(result) // Option.some(2)
|
|
4813
4815
|
*
|
|
4814
4816
|
* // No match found
|
|
4815
4817
|
* const notFound = Chunk.findLastIndex(chunk, (n) => n > 10)
|
|
4816
|
-
* console.log(notFound) //
|
|
4818
|
+
* console.log(notFound) // Option.none()
|
|
4817
4819
|
*
|
|
4818
4820
|
* // Find last even number index
|
|
4819
4821
|
* const lastEven = Chunk.findLastIndex(chunk, (n) => n % 2 === 0)
|
|
4820
|
-
* console.log(lastEven) // 3
|
|
4822
|
+
* console.log(lastEven) // Option.some(3)
|
|
4821
4823
|
* ```
|
|
4822
4824
|
*
|
|
4823
4825
|
* @category elements
|
|
@@ -4833,21 +4835,21 @@ export const findLastIndex: {
|
|
|
4833
4835
|
*
|
|
4834
4836
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
4835
4837
|
* const result = Chunk.findLastIndex(chunk, (n) => n < 4)
|
|
4836
|
-
* console.log(result) // 2
|
|
4838
|
+
* console.log(result) // Option.some(2)
|
|
4837
4839
|
*
|
|
4838
4840
|
* // No match found
|
|
4839
4841
|
* const notFound = Chunk.findLastIndex(chunk, (n) => n > 10)
|
|
4840
|
-
* console.log(notFound) //
|
|
4842
|
+
* console.log(notFound) // Option.none()
|
|
4841
4843
|
*
|
|
4842
4844
|
* // Find last even number index
|
|
4843
4845
|
* const lastEven = Chunk.findLastIndex(chunk, (n) => n % 2 === 0)
|
|
4844
|
-
* console.log(lastEven) // 3
|
|
4846
|
+
* console.log(lastEven) // Option.some(3)
|
|
4845
4847
|
* ```
|
|
4846
4848
|
*
|
|
4847
4849
|
* @category elements
|
|
4848
4850
|
* @since 2.0.0
|
|
4849
4851
|
*/
|
|
4850
|
-
<A>(predicate: Predicate<A>): (self: Chunk<A>) => number
|
|
4852
|
+
<A>(predicate: Predicate<A>): (self: Chunk<A>) => O.Option<number>
|
|
4851
4853
|
/**
|
|
4852
4854
|
* Return the last index for which a predicate holds.
|
|
4853
4855
|
*
|
|
@@ -4857,22 +4859,25 @@ export const findLastIndex: {
|
|
|
4857
4859
|
*
|
|
4858
4860
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
4859
4861
|
* const result = Chunk.findLastIndex(chunk, (n) => n < 4)
|
|
4860
|
-
* console.log(result) // 2
|
|
4862
|
+
* console.log(result) // Option.some(2)
|
|
4861
4863
|
*
|
|
4862
4864
|
* // No match found
|
|
4863
4865
|
* const notFound = Chunk.findLastIndex(chunk, (n) => n > 10)
|
|
4864
|
-
* console.log(notFound) //
|
|
4866
|
+
* console.log(notFound) // Option.none()
|
|
4865
4867
|
*
|
|
4866
4868
|
* // Find last even number index
|
|
4867
4869
|
* const lastEven = Chunk.findLastIndex(chunk, (n) => n % 2 === 0)
|
|
4868
|
-
* console.log(lastEven) // 3
|
|
4870
|
+
* console.log(lastEven) // Option.some(3)
|
|
4869
4871
|
* ```
|
|
4870
4872
|
*
|
|
4871
4873
|
* @category elements
|
|
4872
4874
|
* @since 2.0.0
|
|
4873
4875
|
*/
|
|
4874
|
-
<A>(self: Chunk<A>, predicate: Predicate<A>): number
|
|
4875
|
-
} =
|
|
4876
|
+
<A>(self: Chunk<A>, predicate: Predicate<A>): O.Option<number>
|
|
4877
|
+
} = dual(
|
|
4878
|
+
2,
|
|
4879
|
+
<A>(self: Chunk<A>, predicate: Predicate<A>): O.Option<number> => RA.findLastIndex(self, predicate)
|
|
4880
|
+
)
|
|
4876
4881
|
|
|
4877
4882
|
/**
|
|
4878
4883
|
* Check if a predicate holds true for every `Chunk` element.
|
package/src/Config.ts
CHANGED
|
@@ -950,7 +950,10 @@ export const Boolean = Schema.Literals([...TrueValues.literals, ...FalseValues.l
|
|
|
950
950
|
export const Duration = Schema.String.pipe(Schema.decodeTo(Schema.Duration, {
|
|
951
951
|
decode: Getter.transformOrFail((s) => {
|
|
952
952
|
const d = Duration_.fromInput(s as any)
|
|
953
|
-
return
|
|
953
|
+
return Option.match(d, {
|
|
954
|
+
onNone: () => Effect.fail(new Issue.InvalidValue(Option.some(s))),
|
|
955
|
+
onSome: Effect.succeed
|
|
956
|
+
})
|
|
954
957
|
}),
|
|
955
958
|
encode: Getter.forbidden(() => "Encoding Duration is not supported")
|
|
956
959
|
}))
|
package/src/Cron.ts
CHANGED
|
@@ -12,12 +12,12 @@ import * as Hash from "./Hash.ts"
|
|
|
12
12
|
import { type Inspectable, NodeInspectSymbol } from "./Inspectable.ts"
|
|
13
13
|
import * as dateTime from "./internal/dateTime.ts"
|
|
14
14
|
import * as N from "./Number.ts"
|
|
15
|
+
import * as Option from "./Option.ts"
|
|
15
16
|
import { type Pipeable, pipeArguments } from "./Pipeable.ts"
|
|
16
17
|
import { hasProperty } from "./Predicate.ts"
|
|
17
18
|
import * as Result from "./Result.ts"
|
|
18
19
|
import * as String from "./String.ts"
|
|
19
20
|
import type { Mutable } from "./Types.ts"
|
|
20
|
-
import * as UndefinedOr from "./UndefinedOr.ts"
|
|
21
21
|
|
|
22
22
|
const TypeId = "~effect/time/Cron"
|
|
23
23
|
|
|
@@ -83,7 +83,7 @@ const TypeId = "~effect/time/Cron"
|
|
|
83
83
|
*/
|
|
84
84
|
export interface Cron extends Pipeable, Equal.Equal, Inspectable {
|
|
85
85
|
readonly [TypeId]: typeof TypeId
|
|
86
|
-
readonly tz: DateTime.TimeZone
|
|
86
|
+
readonly tz: Option.Option<DateTime.TimeZone>
|
|
87
87
|
readonly seconds: ReadonlySet<number>
|
|
88
88
|
readonly minutes: ReadonlySet<number>
|
|
89
89
|
readonly hours: ReadonlySet<number>
|
|
@@ -307,7 +307,7 @@ export const make = (values: {
|
|
|
307
307
|
o.days = new Set(Arr.sort(values.days, N.Order))
|
|
308
308
|
o.months = new Set(Arr.sort(values.months, N.Order))
|
|
309
309
|
o.weekdays = new Set(Arr.sort(values.weekdays, N.Order))
|
|
310
|
-
o.tz = values.tz
|
|
310
|
+
o.tz = Option.fromUndefinedOr(values.tz)
|
|
311
311
|
|
|
312
312
|
const seconds = Array.from(o.seconds)
|
|
313
313
|
const minutes = Array.from(o.minutes)
|
|
@@ -379,15 +379,11 @@ const CronParseErrorTypeId = "~effect/time/Cron/CronParseError"
|
|
|
379
379
|
* @since 4.0.0
|
|
380
380
|
* @category models
|
|
381
381
|
*/
|
|
382
|
-
/**
|
|
383
|
-
* @category Models
|
|
384
|
-
* @since 4.0.0
|
|
385
|
-
*/
|
|
386
382
|
export class CronParseError extends Data.TaggedError("CronParseError")<{
|
|
387
383
|
readonly message: string
|
|
388
384
|
readonly input?: string
|
|
389
385
|
}> {
|
|
390
|
-
readonly [CronParseErrorTypeId] = CronParseErrorTypeId
|
|
386
|
+
readonly [CronParseErrorTypeId]: typeof CronParseErrorTypeId = CronParseErrorTypeId
|
|
391
387
|
}
|
|
392
388
|
|
|
393
389
|
/**
|
|
@@ -456,11 +452,10 @@ export const parse = (cron: string, tz?: DateTime.TimeZone | string): Result.Res
|
|
|
456
452
|
const [seconds, minutes, hours, days, months, weekdays] = segments
|
|
457
453
|
const zone = tz === undefined || dateTime.isTimeZone(tz) ?
|
|
458
454
|
Result.succeed(tz) :
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
})
|
|
455
|
+
Result.fromOption(
|
|
456
|
+
dateTime.zoneFromString(tz),
|
|
457
|
+
() => new CronParseError({ message: `Invalid time zone in cron expression`, input: tz })
|
|
458
|
+
)
|
|
464
459
|
|
|
465
460
|
return Result.all({
|
|
466
461
|
tz: zone,
|
|
@@ -528,7 +523,7 @@ export const parseUnsafe = (cron: string, tz?: DateTime.TimeZone | string): Cron
|
|
|
528
523
|
*/
|
|
529
524
|
export const match = (cron: Cron, date: DateTime.DateTime.Input): boolean => {
|
|
530
525
|
const parts = dateTime.makeZonedUnsafe(date, {
|
|
531
|
-
timeZone: cron.tz
|
|
526
|
+
timeZone: Option.getOrUndefined(cron.tz)
|
|
532
527
|
}).pipe(dateTime.toParts)
|
|
533
528
|
|
|
534
529
|
if (cron.seconds.size !== 0 && !cron.seconds.has(parts.second)) {
|
|
@@ -592,7 +587,7 @@ const daysInMonth = (date: Date): number =>
|
|
|
592
587
|
* @category utils
|
|
593
588
|
*/
|
|
594
589
|
export const next = (cron: Cron, now?: DateTime.DateTime.Input): Date => {
|
|
595
|
-
const tz = cron.tz
|
|
590
|
+
const tz = Option.getOrUndefined(cron.tz)
|
|
596
591
|
const zoned = dateTime.makeZonedUnsafe(now ?? new Date(), {
|
|
597
592
|
timeZone: tz
|
|
598
593
|
})
|
package/src/DateTime.ts
CHANGED
|
@@ -10,6 +10,7 @@ import type { Inspectable } from "./Inspectable.ts"
|
|
|
10
10
|
import * as Internal from "./internal/dateTime.ts"
|
|
11
11
|
import { provideService } from "./internal/effect.ts"
|
|
12
12
|
import * as Layer from "./Layer.ts"
|
|
13
|
+
import type * as Option from "./Option.ts"
|
|
13
14
|
import type * as order from "./Order.ts"
|
|
14
15
|
import type { Pipeable } from "./Pipeable.ts"
|
|
15
16
|
import * as ServiceMap from "./ServiceMap.ts"
|
|
@@ -557,7 +558,7 @@ export const makeZoned: (
|
|
|
557
558
|
readonly adjustForTimeZone?: boolean | undefined
|
|
558
559
|
readonly disambiguation?: Disambiguation | undefined
|
|
559
560
|
}
|
|
560
|
-
) => Zoned
|
|
561
|
+
) => Option.Option<Zoned> = Internal.makeZoned
|
|
561
562
|
|
|
562
563
|
/**
|
|
563
564
|
* Create a `DateTime` from one of the following:
|
|
@@ -586,7 +587,7 @@ export const makeZoned: (
|
|
|
586
587
|
* DateTime.make("2024-01-01")
|
|
587
588
|
* ```
|
|
588
589
|
*/
|
|
589
|
-
export const make: <A extends DateTime.Input>(input: A) => DateTime.PreserveZone<A
|
|
590
|
+
export const make: <A extends DateTime.Input>(input: A) => Option.Option<DateTime.PreserveZone<A>> = Internal.make
|
|
590
591
|
|
|
591
592
|
/**
|
|
592
593
|
* Create a `DateTime.Zoned` from a string.
|
|
@@ -600,19 +601,19 @@ export const make: <A extends DateTime.Input>(input: A) => DateTime.PreserveZone
|
|
|
600
601
|
* const result1 = DateTime.makeZonedFromString(
|
|
601
602
|
* "2024-01-01T12:00:00+02:00[Europe/Berlin]"
|
|
602
603
|
* )
|
|
603
|
-
* console.log(result1
|
|
604
|
+
* console.log(result1._tag === "Some") // true
|
|
604
605
|
*
|
|
605
606
|
* const result2 = DateTime.makeZonedFromString("2024-01-01T12:00:00Z")
|
|
606
|
-
* console.log(result2
|
|
607
|
+
* console.log(result2._tag === "Some") // true
|
|
607
608
|
*
|
|
608
609
|
* const invalid = DateTime.makeZonedFromString("invalid")
|
|
609
|
-
* console.log(invalid ===
|
|
610
|
+
* console.log(invalid._tag === "None") // true
|
|
610
611
|
* ```
|
|
611
612
|
*
|
|
612
613
|
* @since 3.6.0
|
|
613
614
|
* @category constructors
|
|
614
615
|
*/
|
|
615
|
-
export const makeZonedFromString: (input: string) => Zoned
|
|
616
|
+
export const makeZonedFromString: (input: string) => Option.Option<Zoned> = Internal.makeZonedFromString
|
|
616
617
|
|
|
617
618
|
/**
|
|
618
619
|
* Get the current time using the `Clock` service and convert it to a `DateTime`.
|
|
@@ -892,16 +893,16 @@ export const zoneMakeOffset: (offset: number) => TimeZone.Offset = Internal.zone
|
|
|
892
893
|
* import { DateTime } from "effect"
|
|
893
894
|
*
|
|
894
895
|
* const validZone = DateTime.zoneMakeNamed("Europe/London")
|
|
895
|
-
* console.log(validZone
|
|
896
|
+
* console.log(validZone._tag === "Some") // true
|
|
896
897
|
*
|
|
897
898
|
* const invalidZone = DateTime.zoneMakeNamed("Invalid/Zone")
|
|
898
|
-
* console.log(invalidZone ===
|
|
899
|
+
* console.log(invalidZone._tag === "None") // true
|
|
899
900
|
* ```
|
|
900
901
|
*
|
|
901
902
|
* @category time zones
|
|
902
903
|
* @since 3.6.0
|
|
903
904
|
*/
|
|
904
|
-
export const zoneMakeNamed: (zoneId: string) => TimeZone.Named
|
|
905
|
+
export const zoneMakeNamed: (zoneId: string) => Option.Option<TimeZone.Named> = Internal.zoneMakeNamed
|
|
905
906
|
|
|
906
907
|
/**
|
|
907
908
|
* Create a named time zone from a IANA time zone identifier.
|
|
@@ -960,15 +961,15 @@ export const zoneMakeLocal: () => TimeZone.Named = Internal.zoneMakeLocal
|
|
|
960
961
|
* const offsetZone = DateTime.zoneFromString("+03:00")
|
|
961
962
|
* const invalid = DateTime.zoneFromString("invalid")
|
|
962
963
|
*
|
|
963
|
-
* console.log(namedZone
|
|
964
|
-
* console.log(offsetZone
|
|
965
|
-
* console.log(invalid ===
|
|
964
|
+
* console.log(namedZone._tag === "Some") // true
|
|
965
|
+
* console.log(offsetZone._tag === "Some") // true
|
|
966
|
+
* console.log(invalid._tag === "None") // true
|
|
966
967
|
* ```
|
|
967
968
|
*
|
|
968
969
|
* @category time zones
|
|
969
970
|
* @since 3.6.0
|
|
970
971
|
*/
|
|
971
|
-
export const zoneFromString: (zone: string) => TimeZone
|
|
972
|
+
export const zoneFromString: (zone: string) => Option.Option<TimeZone> = Internal.zoneFromString
|
|
972
973
|
|
|
973
974
|
/**
|
|
974
975
|
* Format a `TimeZone` as a string.
|
|
@@ -1029,7 +1030,7 @@ export const setZoneNamed: {
|
|
|
1029
1030
|
readonly adjustForTimeZone?: boolean | undefined
|
|
1030
1031
|
readonly disambiguation?: Disambiguation | undefined
|
|
1031
1032
|
}
|
|
1032
|
-
): (self: DateTime) => Zoned
|
|
1033
|
+
): (self: DateTime) => Option.Option<Zoned>
|
|
1033
1034
|
/**
|
|
1034
1035
|
* Set the time zone of a `DateTime` from an IANA time zone identifier. If the
|
|
1035
1036
|
* time zone is invalid, `None` will be returned.
|
|
@@ -1054,7 +1055,7 @@ export const setZoneNamed: {
|
|
|
1054
1055
|
readonly adjustForTimeZone?: boolean | undefined
|
|
1055
1056
|
readonly disambiguation?: Disambiguation | undefined
|
|
1056
1057
|
}
|
|
1057
|
-
): Zoned
|
|
1058
|
+
): Option.Option<Zoned>
|
|
1058
1059
|
} = Internal.setZoneNamed
|
|
1059
1060
|
|
|
1060
1061
|
/**
|
package/src/Deferred.ts
CHANGED
|
@@ -72,6 +72,7 @@ import type * as Exit from "./Exit.ts"
|
|
|
72
72
|
import { dual, identity, type LazyArg } from "./Function.ts"
|
|
73
73
|
import * as core from "./internal/core.ts"
|
|
74
74
|
import * as internalEffect from "./internal/effect.ts"
|
|
75
|
+
import * as Option from "./Option.ts"
|
|
75
76
|
import type { Pipeable } from "./Pipeable.ts"
|
|
76
77
|
import { pipeArguments } from "./Pipeable.ts"
|
|
77
78
|
import type * as Types from "./Types.ts"
|
|
@@ -973,8 +974,9 @@ export const isDone = <A, E>(self: Deferred<A, E>): Effect<boolean> => internalE
|
|
|
973
974
|
export const isDoneUnsafe = <A, E>(self: Deferred<A, E>): boolean => self.effect !== undefined
|
|
974
975
|
|
|
975
976
|
/**
|
|
976
|
-
* Returns
|
|
977
|
-
*
|
|
977
|
+
* Returns the current completion effect as an `Option`. This returns
|
|
978
|
+
* `Option.some(effect)` when the `Deferred` is completed, `Option.none()`
|
|
979
|
+
* otherwise.
|
|
978
980
|
*
|
|
979
981
|
* @example
|
|
980
982
|
* ```ts
|
|
@@ -983,19 +985,19 @@ export const isDoneUnsafe = <A, E>(self: Deferred<A, E>): boolean => self.effect
|
|
|
983
985
|
* const program = Effect.gen(function*() {
|
|
984
986
|
* const deferred = yield* Deferred.make<number>()
|
|
985
987
|
* const beforeCompletion = yield* Deferred.poll(deferred)
|
|
986
|
-
* console.log(beforeCompletion ===
|
|
988
|
+
* console.log(beforeCompletion._tag === "None") // true
|
|
987
989
|
*
|
|
988
990
|
* yield* Deferred.succeed(deferred, 42)
|
|
989
991
|
* const afterCompletion = yield* Deferred.poll(deferred)
|
|
990
|
-
* console.log(afterCompletion
|
|
992
|
+
* console.log(afterCompletion._tag === "Some") // true
|
|
991
993
|
* })
|
|
992
994
|
* ```
|
|
993
995
|
*
|
|
994
996
|
* @since 2.0.0
|
|
995
997
|
* @category getters
|
|
996
998
|
*/
|
|
997
|
-
export function poll<A, E>(self: Deferred<A, E>): Effect<Effect<A, E
|
|
998
|
-
return internalEffect.sync(() => self.effect)
|
|
999
|
+
export function poll<A, E>(self: Deferred<A, E>): Effect<Option.Option<Effect<A, E>>> {
|
|
1000
|
+
return internalEffect.sync(() => Option.fromUndefinedOr(self.effect))
|
|
999
1001
|
}
|
|
1000
1002
|
|
|
1001
1003
|
/**
|