effect 4.0.0-beta.30 → 4.0.0-beta.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Array.d.ts +87 -86
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +47 -40
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +46 -45
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +35 -38
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts +39 -32
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +32 -29
- package/dist/BigInt.js.map +1 -1
- package/dist/Channel.d.ts +2 -2
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js.map +1 -1
- package/dist/Chunk.d.ts +58 -57
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +20 -21
- package/dist/Chunk.js.map +1 -1
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +4 -1
- package/dist/Config.js.map +1 -1
- package/dist/Cron.d.ts +3 -6
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +11 -18
- package/dist/Cron.js.map +1 -1
- package/dist/DateTime.d.ts +49 -92
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +9 -9
- package/dist/DateTime.js.map +1 -1
- package/dist/Deferred.d.ts +7 -5
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +7 -5
- package/dist/Deferred.js.map +1 -1
- package/dist/Duration.d.ts +55 -25
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +100 -70
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +3 -4
- package/dist/Effect.js.map +1 -1
- package/dist/Fiber.d.ts +2 -1
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.d.ts +9 -8
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +8 -7
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +20 -19
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +6 -6
- package/dist/FiberMap.js.map +1 -1
- package/dist/FileSystem.d.ts +17 -16
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +10 -7
- package/dist/FileSystem.js.map +1 -1
- package/dist/Graph.d.ts +64 -64
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +53 -53
- package/dist/Graph.js.map +1 -1
- package/dist/HashMap.d.ts +11 -5
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashMap.js +3 -1
- package/dist/HashMap.js.map +1 -1
- package/dist/Iterable.d.ts +11 -11
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +12 -12
- package/dist/Iterable.js.map +1 -1
- package/dist/Latch.d.ts +69 -3
- package/dist/Latch.d.ts.map +1 -1
- package/dist/Latch.js +58 -0
- package/dist/Latch.js.map +1 -1
- package/dist/Layer.d.ts +181 -2
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +35 -2
- package/dist/Layer.js.map +1 -1
- package/dist/Number.d.ts +74 -18
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +34 -15
- package/dist/Number.js.map +1 -1
- package/dist/Option.d.ts +2 -0
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js.map +1 -1
- package/dist/PartitionedSemaphore.d.ts +183 -0
- package/dist/PartitionedSemaphore.d.ts.map +1 -0
- package/dist/PartitionedSemaphore.js +231 -0
- package/dist/PartitionedSemaphore.js.map +1 -0
- package/dist/PubSub.d.ts +5 -4
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +6 -5
- package/dist/PubSub.js.map +1 -1
- package/dist/Queue.d.ts +3 -3
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +2 -2
- package/dist/Queue.js.map +1 -1
- package/dist/Record.d.ts +40 -40
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +16 -15
- package/dist/Record.js.map +1 -1
- package/dist/Scheduler.d.ts +25 -123
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +20 -123
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +2346 -114
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +1359 -68
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +2 -2
- package/dist/SchemaAST.js +2 -2
- package/dist/SchemaGetter.js +6 -4
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +2 -2
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +32 -27
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/Semaphore.d.ts +149 -53
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js +137 -117
- package/dist/Semaphore.js.map +1 -1
- package/dist/ServiceMap.d.ts +26 -0
- package/dist/ServiceMap.d.ts.map +1 -1
- package/dist/ServiceMap.js +36 -21
- package/dist/ServiceMap.js.map +1 -1
- package/dist/Stream.js +1 -1
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +114 -47
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +29 -47
- package/dist/String.js.map +1 -1
- package/dist/SubscriptionRef.d.ts +1 -2
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +81 -115
- package/dist/SubscriptionRef.js.map +1 -1
- package/dist/Terminal.d.ts +2 -1
- package/dist/Terminal.d.ts.map +1 -1
- package/dist/Terminal.js.map +1 -1
- package/dist/Tracer.d.ts +5 -4
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +2 -1
- package/dist/Tracer.js.map +1 -1
- package/dist/Trie.d.ts +26 -14
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Trie.js +8 -4
- package/dist/Trie.js.map +1 -1
- package/dist/TxHashMap.d.ts +77 -59
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js +25 -19
- package/dist/TxHashMap.js.map +1 -1
- package/dist/TxSemaphore.d.ts +162 -2
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +16 -2
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/index.d.ts +88 -32
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +88 -32
- package/dist/index.js.map +1 -1
- package/dist/internal/dateTime.js +66 -59
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/effect.js +21 -90
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/hashMap.js +2 -1
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/option.js +6 -0
- package/dist/internal/option.js.map +1 -1
- package/dist/internal/trie.js +3 -3
- package/dist/internal/trie.js.map +1 -1
- package/dist/unstable/ai/AiError.js +1 -1
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +4 -0
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +3 -4
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +2 -2
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +30 -16
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +10 -87
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +4 -0
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +14 -0
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +13 -0
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/cli/Argument.d.ts +2 -4
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js +1 -3
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/CliOutput.d.ts +3 -2
- package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
- package/dist/unstable/cli/CliOutput.js +4 -3
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +3 -2
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +3 -3
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Completions.d.ts +16 -0
- package/dist/unstable/cli/Completions.d.ts.map +1 -0
- package/dist/unstable/cli/Completions.js +23 -0
- package/dist/unstable/cli/Completions.js.map +1 -0
- package/dist/unstable/cli/Flag.d.ts +2 -2
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js +1 -1
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -1
- package/dist/unstable/cli/GlobalFlag.js +4 -4
- package/dist/unstable/cli/GlobalFlag.js.map +1 -1
- package/dist/unstable/cli/HelpDoc.d.ts +14 -12
- package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
- package/dist/unstable/cli/Param.d.ts +4 -4
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +7 -7
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +1 -1
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/Prompt.js +71 -67
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/index.d.ts +4 -0
- package/dist/unstable/cli/index.d.ts.map +1 -1
- package/dist/unstable/cli/index.js +4 -0
- package/dist/unstable/cli/index.js.map +1 -1
- package/dist/unstable/cli/internal/completions/CommandDescriptor.js +9 -2
- package/dist/unstable/cli/internal/completions/CommandDescriptor.js.map +1 -1
- package/dist/unstable/cli/internal/parser.js +8 -3
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +3 -2
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +25 -23
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/DeliverAt.js +1 -1
- package/dist/unstable/cluster/DeliverAt.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +3 -2
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +7 -7
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +4 -3
- package/dist/unstable/cluster/Message.d.ts.map +1 -1
- package/dist/unstable/cluster/Message.js +3 -2
- package/dist/unstable/cluster/Message.js.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts +10 -10
- package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/MessageStorage.js +12 -12
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts +2 -1
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +4 -3
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.js +9 -8
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +2 -1
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +7 -6
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +19 -13
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +5 -4
- package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.js +4 -4
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +19 -18
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +9 -10
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.d.ts +2 -1
- package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.js +1 -4
- package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
- package/dist/unstable/encoding/Ndjson.d.ts +8 -8
- package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
- package/dist/unstable/encoding/Ndjson.js.map +1 -1
- package/dist/unstable/http/Cookies.d.ts +5 -4
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +3 -4
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Etag.d.ts.map +1 -1
- package/dist/unstable/http/Etag.js +5 -1
- package/dist/unstable/http/Etag.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts +3 -2
- package/dist/unstable/http/Headers.d.ts.map +1 -1
- package/dist/unstable/http/Headers.js +2 -1
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +2 -1
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts +4 -3
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +8 -6
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientResponse.js +2 -1
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.d.ts +3 -2
- package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +16 -15
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
- package/dist/unstable/http/HttpPlatform.js +3 -2
- package/dist/unstable/http/HttpPlatform.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +2 -1
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js +7 -7
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpServer.js +2 -2
- package/dist/unstable/http/HttpServer.js.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +2 -1
- package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerError.js +2 -1
- package/dist/unstable/http/HttpServerError.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts +3 -2
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +14 -10
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +4 -3
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpTraceContext.d.ts +3 -2
- package/dist/unstable/http/HttpTraceContext.d.ts.map +1 -1
- package/dist/unstable/http/HttpTraceContext.js +27 -15
- package/dist/unstable/http/HttpTraceContext.js.map +1 -1
- package/dist/unstable/http/UrlParams.d.ts +5 -4
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +5 -6
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +2 -2
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +4 -2
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +15 -0
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.js +81 -3
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +2 -2
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js +7 -3
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/persistence/Persistable.js +1 -1
- package/dist/unstable/persistence/Persistable.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +1 -5
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +4 -2
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js +4 -3
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +4 -4
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcGroup.d.ts +1 -3
- package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSchema.js +3 -2
- package/dist/unstable/rpc/RpcSchema.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +4 -1
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +3 -2
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +2 -1
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +1 -1
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.js +6 -6
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +2 -1
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +5 -4
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +19 -14
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/package.json +1 -1
- package/src/Array.ts +112 -105
- package/src/BigDecimal.ts +63 -66
- package/src/BigInt.ts +49 -41
- package/src/Channel.ts +3 -3
- package/src/Chunk.ts +68 -63
- package/src/Config.ts +4 -1
- package/src/Cron.ts +13 -18
- package/src/DateTime.ts +51 -92
- package/src/Deferred.ts +8 -6
- package/src/Duration.ts +112 -56
- package/src/Effect.ts +3 -4
- package/src/Fiber.ts +2 -1
- package/src/FiberHandle.ts +10 -9
- package/src/FiberMap.ts +22 -22
- package/src/FileSystem.ts +25 -22
- package/src/Graph.ts +105 -105
- package/src/HashMap.ts +11 -5
- package/src/Iterable.ts +13 -13
- package/src/Latch.ts +85 -3
- package/src/Layer.ts +244 -19
- package/src/Number.ts +85 -26
- package/src/Option.ts +2 -0
- package/src/PartitionedSemaphore.ts +414 -0
- package/src/PubSub.ts +7 -6
- package/src/Queue.ts +5 -5
- package/src/Record.ts +52 -47
- package/src/Scheduler.ts +37 -126
- package/src/Schema.ts +2366 -116
- package/src/SchemaAST.ts +2 -2
- package/src/SchemaGetter.ts +4 -4
- package/src/SchemaRepresentation.ts +2 -2
- package/src/SchemaTransformation.ts +27 -27
- package/src/Semaphore.ts +271 -183
- package/src/ServiceMap.ts +83 -31
- package/src/Stream.ts +1 -1
- package/src/String.ts +122 -69
- package/src/SubscriptionRef.ts +96 -117
- package/src/Terminal.ts +2 -1
- package/src/Tracer.ts +6 -5
- package/src/Trie.ts +26 -14
- package/src/TxHashMap.ts +78 -60
- package/src/TxSemaphore.ts +186 -11
- package/src/index.ts +89 -33
- package/src/internal/dateTime.ts +74 -65
- package/src/internal/effect.ts +30 -122
- package/src/internal/hashMap.ts +4 -3
- package/src/internal/option.ts +7 -0
- package/src/internal/trie.ts +6 -6
- package/src/unstable/ai/AiError.ts +1 -1
- package/src/unstable/ai/AnthropicStructuredOutput.ts +4 -0
- package/src/unstable/ai/Chat.ts +17 -15
- package/src/unstable/ai/LanguageModel.ts +148 -97
- package/src/unstable/ai/OpenAiStructuredOutput.ts +4 -0
- package/src/unstable/ai/Tool.ts +20 -0
- package/src/unstable/cli/Argument.ts +2 -4
- package/src/unstable/cli/CliOutput.ts +7 -5
- package/src/unstable/cli/Command.ts +5 -5
- package/src/unstable/cli/Completions.ts +36 -0
- package/src/unstable/cli/Flag.ts +2 -2
- package/src/unstable/cli/GlobalFlag.ts +4 -5
- package/src/unstable/cli/HelpDoc.ts +14 -12
- package/src/unstable/cli/Param.ts +15 -11
- package/src/unstable/cli/Primitive.ts +1 -1
- package/src/unstable/cli/Prompt.ts +81 -83
- package/src/unstable/cli/index.ts +5 -0
- package/src/unstable/cli/internal/completions/CommandDescriptor.ts +3 -2
- package/src/unstable/cli/internal/parser.ts +7 -4
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +35 -30
- package/src/unstable/cluster/DeliverAt.ts +1 -1
- package/src/unstable/cluster/Entity.ts +13 -12
- package/src/unstable/cluster/Message.ts +6 -5
- package/src/unstable/cluster/MessageStorage.ts +26 -25
- package/src/unstable/cluster/Reply.ts +7 -4
- package/src/unstable/cluster/RunnerServer.ts +10 -13
- package/src/unstable/cluster/Runners.ts +8 -7
- package/src/unstable/cluster/Sharding.ts +24 -17
- package/src/unstable/cluster/ShardingConfig.ts +6 -6
- package/src/unstable/cluster/SqlMessageStorage.ts +21 -18
- package/src/unstable/cluster/internal/entityManager.ts +27 -21
- package/src/unstable/devtools/DevToolsSchema.ts +3 -2
- package/src/unstable/encoding/Ndjson.ts +17 -17
- package/src/unstable/http/Cookies.ts +7 -8
- package/src/unstable/http/Etag.ts +5 -3
- package/src/unstable/http/Headers.ts +6 -5
- package/src/unstable/http/HttpClient.ts +2 -1
- package/src/unstable/http/HttpClientRequest.ts +11 -9
- package/src/unstable/http/HttpClientResponse.ts +5 -4
- package/src/unstable/http/HttpIncomingMessage.ts +3 -2
- package/src/unstable/http/HttpMiddleware.ts +16 -15
- package/src/unstable/http/HttpPlatform.ts +3 -2
- package/src/unstable/http/HttpRouter.ts +9 -9
- package/src/unstable/http/HttpServer.ts +3 -9
- package/src/unstable/http/HttpServerError.ts +3 -2
- package/src/unstable/http/HttpServerRequest.ts +29 -25
- package/src/unstable/http/HttpServerResponse.ts +7 -6
- package/src/unstable/http/HttpTraceContext.ts +31 -17
- package/src/unstable/http/UrlParams.ts +11 -14
- package/src/unstable/httpapi/HttpApiBuilder.ts +13 -7
- package/src/unstable/httpapi/HttpApiError.ts +67 -12
- package/src/unstable/observability/OtlpExporter.ts +5 -2
- package/src/unstable/observability/OtlpTracer.ts +8 -4
- package/src/unstable/persistence/Persistable.ts +1 -1
- package/src/unstable/reactivity/Atom.ts +1 -4
- package/src/unstable/reactivity/AtomRegistry.ts +5 -3
- package/src/unstable/rpc/Rpc.ts +4 -3
- package/src/unstable/rpc/RpcClient.ts +10 -9
- package/src/unstable/rpc/RpcGroup.ts +3 -3
- package/src/unstable/rpc/RpcSchema.ts +6 -5
- package/src/unstable/rpc/RpcSerialization.ts +4 -1
- package/src/unstable/rpc/RpcServer.ts +3 -3
- package/src/unstable/socket/Socket.ts +2 -1
- package/src/unstable/sql/SqlClient.ts +5 -3
- package/src/unstable/workflow/DurableDeferred.ts +6 -6
- package/src/unstable/workflow/Workflow.ts +1 -1
- package/src/unstable/workflow/WorkflowEngine.ts +29 -20
- package/dist/NullOr.d.ts +0 -149
- package/dist/NullOr.d.ts.map +0 -1
- package/dist/NullOr.js +0 -152
- package/dist/NullOr.js.map +0 -1
- package/dist/unstable/cli/internal/completions/Completions.d.ts +0 -2
- package/dist/unstable/cli/internal/completions/Completions.d.ts.map +0 -1
- package/dist/unstable/cli/internal/completions/Completions.js +0 -23
- package/dist/unstable/cli/internal/completions/Completions.js.map +0 -1
- package/src/NullOr.ts +0 -204
- package/src/unstable/cli/internal/completions/Completions.ts +0 -31
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"
|
|
@@ -21,70 +22,30 @@ const TimeZoneTypeId = Internal.TimeZoneTypeId
|
|
|
21
22
|
* A `DateTime` represents a point in time. It can optionally have a time zone
|
|
22
23
|
* associated with it.
|
|
23
24
|
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```ts
|
|
26
|
-
* import { DateTime } from "effect"
|
|
27
|
-
*
|
|
28
|
-
* // Create a UTC DateTime
|
|
29
|
-
* const utc: DateTime.DateTime = DateTime.nowUnsafe()
|
|
30
|
-
*
|
|
31
|
-
* // Create a zoned DateTime
|
|
32
|
-
* const zoned: DateTime.DateTime = DateTime.makeZonedUnsafe(new Date(), {
|
|
33
|
-
* timeZone: "Europe/London"
|
|
34
|
-
* })
|
|
35
|
-
* ```
|
|
36
|
-
*
|
|
37
25
|
* @since 3.6.0
|
|
38
26
|
* @category models
|
|
39
27
|
*/
|
|
40
28
|
export type DateTime = Utc | Zoned
|
|
41
29
|
|
|
42
30
|
/**
|
|
43
|
-
* @example
|
|
44
|
-
* ```ts
|
|
45
|
-
* import { DateTime } from "effect"
|
|
46
|
-
*
|
|
47
|
-
* const utc = DateTime.nowUnsafe()
|
|
48
|
-
*
|
|
49
|
-
* if (DateTime.isUtc(utc)) {
|
|
50
|
-
* console.log(utc._tag) // "Utc"
|
|
51
|
-
* console.log(utc.epochMillis) // timestamp in milliseconds
|
|
52
|
-
* }
|
|
53
|
-
* ```
|
|
54
|
-
*
|
|
55
31
|
* @since 3.6.0
|
|
56
32
|
* @category models
|
|
57
33
|
*/
|
|
58
34
|
export interface Utc extends DateTime.Proto {
|
|
59
35
|
readonly _tag: "Utc"
|
|
60
|
-
readonly
|
|
36
|
+
readonly epochMilliseconds: number
|
|
61
37
|
partsUtc: DateTime.PartsWithWeekday | undefined
|
|
62
38
|
}
|
|
63
39
|
|
|
64
40
|
/**
|
|
65
|
-
* @example
|
|
66
|
-
* ```ts
|
|
67
|
-
* import { DateTime } from "effect"
|
|
68
|
-
*
|
|
69
|
-
* const zoned = DateTime.makeZonedUnsafe(new Date(), {
|
|
70
|
-
* timeZone: "Europe/London"
|
|
71
|
-
* })
|
|
72
|
-
*
|
|
73
|
-
* if (DateTime.isZoned(zoned)) {
|
|
74
|
-
* console.log(zoned._tag) // "Zoned"
|
|
75
|
-
* console.log(zoned.epochMillis) // timestamp in milliseconds
|
|
76
|
-
* console.log(DateTime.zoneToString(zoned.zone)) // "Europe/London"
|
|
77
|
-
* }
|
|
78
|
-
* ```
|
|
79
|
-
*
|
|
80
41
|
* @since 3.6.0
|
|
81
42
|
* @category models
|
|
82
43
|
*/
|
|
83
44
|
export interface Zoned extends DateTime.Proto {
|
|
84
45
|
readonly _tag: "Zoned"
|
|
85
|
-
readonly
|
|
46
|
+
readonly epochMilliseconds: number
|
|
86
47
|
readonly zone: TimeZone
|
|
87
|
-
|
|
48
|
+
adjustedEpochMilliseconds: number | undefined
|
|
88
49
|
partsAdjusted: DateTime.PartsWithWeekday | undefined
|
|
89
50
|
partsUtc: DateTime.PartsWithWeekday | undefined
|
|
90
51
|
}
|
|
@@ -95,29 +56,10 @@ export interface Zoned extends DateTime.Proto {
|
|
|
95
56
|
*/
|
|
96
57
|
export declare namespace DateTime {
|
|
97
58
|
/**
|
|
98
|
-
* @example
|
|
99
|
-
* ```ts
|
|
100
|
-
* import { DateTime } from "effect"
|
|
101
|
-
*
|
|
102
|
-
* // All valid inputs for DateTime constructors
|
|
103
|
-
* const date = new Date()
|
|
104
|
-
* const stringDate = "2024-01-01"
|
|
105
|
-
* const epochMillis = 1704067200000
|
|
106
|
-
* const partsObj = { year: 2024, month: 1, day: 1 }
|
|
107
|
-
* const existing = DateTime.nowUnsafe()
|
|
108
|
-
*
|
|
109
|
-
* // All these can be used as DateTime.Input
|
|
110
|
-
* const dt1 = DateTime.makeUnsafe(date)
|
|
111
|
-
* const dt2 = DateTime.makeUnsafe(stringDate)
|
|
112
|
-
* const dt3 = DateTime.makeUnsafe(epochMillis)
|
|
113
|
-
* const dt4 = DateTime.makeUnsafe(partsObj)
|
|
114
|
-
* const dt5 = DateTime.makeUnsafe(existing)
|
|
115
|
-
* ```
|
|
116
|
-
*
|
|
117
59
|
* @since 3.6.0
|
|
118
60
|
* @category models
|
|
119
61
|
*/
|
|
120
|
-
export type Input = DateTime | Partial<Parts> | Date | number | string
|
|
62
|
+
export type Input = DateTime | Partial<Parts> | Instant | InstantWithZone | Date | number | string
|
|
121
63
|
|
|
122
64
|
/**
|
|
123
65
|
* @since 3.6.0
|
|
@@ -136,7 +78,7 @@ export declare namespace DateTime {
|
|
|
136
78
|
* @category models
|
|
137
79
|
*/
|
|
138
80
|
export type UnitSingular =
|
|
139
|
-
| "
|
|
81
|
+
| "millisecond"
|
|
140
82
|
| "second"
|
|
141
83
|
| "minute"
|
|
142
84
|
| "hour"
|
|
@@ -150,7 +92,7 @@ export declare namespace DateTime {
|
|
|
150
92
|
* @category models
|
|
151
93
|
*/
|
|
152
94
|
export type UnitPlural =
|
|
153
|
-
| "
|
|
95
|
+
| "milliseconds"
|
|
154
96
|
| "seconds"
|
|
155
97
|
| "minutes"
|
|
156
98
|
| "hours"
|
|
@@ -164,10 +106,10 @@ export declare namespace DateTime {
|
|
|
164
106
|
* @category models
|
|
165
107
|
*/
|
|
166
108
|
export interface PartsWithWeekday {
|
|
167
|
-
readonly
|
|
168
|
-
readonly
|
|
169
|
-
readonly
|
|
170
|
-
readonly
|
|
109
|
+
readonly millisecond: number
|
|
110
|
+
readonly second: number
|
|
111
|
+
readonly minute: number
|
|
112
|
+
readonly hour: number
|
|
171
113
|
readonly day: number
|
|
172
114
|
readonly weekDay: number
|
|
173
115
|
readonly month: number
|
|
@@ -179,10 +121,10 @@ export declare namespace DateTime {
|
|
|
179
121
|
* @category models
|
|
180
122
|
*/
|
|
181
123
|
export interface Parts {
|
|
182
|
-
readonly
|
|
183
|
-
readonly
|
|
184
|
-
readonly
|
|
185
|
-
readonly
|
|
124
|
+
readonly millisecond: number
|
|
125
|
+
readonly second: number
|
|
126
|
+
readonly minute: number
|
|
127
|
+
readonly hour: number
|
|
186
128
|
readonly day: number
|
|
187
129
|
readonly month: number
|
|
188
130
|
readonly year: number
|
|
@@ -193,7 +135,7 @@ export declare namespace DateTime {
|
|
|
193
135
|
* @category models
|
|
194
136
|
*/
|
|
195
137
|
export interface PartsForMath {
|
|
196
|
-
readonly
|
|
138
|
+
readonly milliseconds: number
|
|
197
139
|
readonly seconds: number
|
|
198
140
|
readonly minutes: number
|
|
199
141
|
readonly hours: number
|
|
@@ -203,6 +145,23 @@ export declare namespace DateTime {
|
|
|
203
145
|
readonly years: number
|
|
204
146
|
}
|
|
205
147
|
|
|
148
|
+
/**
|
|
149
|
+
* @since 4.0.0
|
|
150
|
+
* @category models
|
|
151
|
+
*/
|
|
152
|
+
export interface Instant {
|
|
153
|
+
readonly epochMilliseconds: number
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* @since 4.0.0
|
|
158
|
+
* @category models
|
|
159
|
+
*/
|
|
160
|
+
export interface InstantWithZone {
|
|
161
|
+
readonly timeZoneId: string
|
|
162
|
+
readonly epochMilliseconds: number
|
|
163
|
+
}
|
|
164
|
+
|
|
206
165
|
/**
|
|
207
166
|
* @since 3.6.0
|
|
208
167
|
* @category models
|
|
@@ -599,7 +558,7 @@ export const makeZoned: (
|
|
|
599
558
|
readonly adjustForTimeZone?: boolean | undefined
|
|
600
559
|
readonly disambiguation?: Disambiguation | undefined
|
|
601
560
|
}
|
|
602
|
-
) => Zoned
|
|
561
|
+
) => Option.Option<Zoned> = Internal.makeZoned
|
|
603
562
|
|
|
604
563
|
/**
|
|
605
564
|
* Create a `DateTime` from one of the following:
|
|
@@ -628,7 +587,7 @@ export const makeZoned: (
|
|
|
628
587
|
* DateTime.make("2024-01-01")
|
|
629
588
|
* ```
|
|
630
589
|
*/
|
|
631
|
-
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
|
|
632
591
|
|
|
633
592
|
/**
|
|
634
593
|
* Create a `DateTime.Zoned` from a string.
|
|
@@ -642,19 +601,19 @@ export const make: <A extends DateTime.Input>(input: A) => DateTime.PreserveZone
|
|
|
642
601
|
* const result1 = DateTime.makeZonedFromString(
|
|
643
602
|
* "2024-01-01T12:00:00+02:00[Europe/Berlin]"
|
|
644
603
|
* )
|
|
645
|
-
* console.log(result1
|
|
604
|
+
* console.log(result1._tag === "Some") // true
|
|
646
605
|
*
|
|
647
606
|
* const result2 = DateTime.makeZonedFromString("2024-01-01T12:00:00Z")
|
|
648
|
-
* console.log(result2
|
|
607
|
+
* console.log(result2._tag === "Some") // true
|
|
649
608
|
*
|
|
650
609
|
* const invalid = DateTime.makeZonedFromString("invalid")
|
|
651
|
-
* console.log(invalid ===
|
|
610
|
+
* console.log(invalid._tag === "None") // true
|
|
652
611
|
* ```
|
|
653
612
|
*
|
|
654
613
|
* @since 3.6.0
|
|
655
614
|
* @category constructors
|
|
656
615
|
*/
|
|
657
|
-
export const makeZonedFromString: (input: string) => Zoned
|
|
616
|
+
export const makeZonedFromString: (input: string) => Option.Option<Zoned> = Internal.makeZonedFromString
|
|
658
617
|
|
|
659
618
|
/**
|
|
660
619
|
* Get the current time using the `Clock` service and convert it to a `DateTime`.
|
|
@@ -934,16 +893,16 @@ export const zoneMakeOffset: (offset: number) => TimeZone.Offset = Internal.zone
|
|
|
934
893
|
* import { DateTime } from "effect"
|
|
935
894
|
*
|
|
936
895
|
* const validZone = DateTime.zoneMakeNamed("Europe/London")
|
|
937
|
-
* console.log(validZone
|
|
896
|
+
* console.log(validZone._tag === "Some") // true
|
|
938
897
|
*
|
|
939
898
|
* const invalidZone = DateTime.zoneMakeNamed("Invalid/Zone")
|
|
940
|
-
* console.log(invalidZone ===
|
|
899
|
+
* console.log(invalidZone._tag === "None") // true
|
|
941
900
|
* ```
|
|
942
901
|
*
|
|
943
902
|
* @category time zones
|
|
944
903
|
* @since 3.6.0
|
|
945
904
|
*/
|
|
946
|
-
export const zoneMakeNamed: (zoneId: string) => TimeZone.Named
|
|
905
|
+
export const zoneMakeNamed: (zoneId: string) => Option.Option<TimeZone.Named> = Internal.zoneMakeNamed
|
|
947
906
|
|
|
948
907
|
/**
|
|
949
908
|
* Create a named time zone from a IANA time zone identifier.
|
|
@@ -1002,15 +961,15 @@ export const zoneMakeLocal: () => TimeZone.Named = Internal.zoneMakeLocal
|
|
|
1002
961
|
* const offsetZone = DateTime.zoneFromString("+03:00")
|
|
1003
962
|
* const invalid = DateTime.zoneFromString("invalid")
|
|
1004
963
|
*
|
|
1005
|
-
* console.log(namedZone
|
|
1006
|
-
* console.log(offsetZone
|
|
1007
|
-
* console.log(invalid ===
|
|
964
|
+
* console.log(namedZone._tag === "Some") // true
|
|
965
|
+
* console.log(offsetZone._tag === "Some") // true
|
|
966
|
+
* console.log(invalid._tag === "None") // true
|
|
1008
967
|
* ```
|
|
1009
968
|
*
|
|
1010
969
|
* @category time zones
|
|
1011
970
|
* @since 3.6.0
|
|
1012
971
|
*/
|
|
1013
|
-
export const zoneFromString: (zone: string) => TimeZone
|
|
972
|
+
export const zoneFromString: (zone: string) => Option.Option<TimeZone> = Internal.zoneFromString
|
|
1014
973
|
|
|
1015
974
|
/**
|
|
1016
975
|
* Format a `TimeZone` as a string.
|
|
@@ -1071,7 +1030,7 @@ export const setZoneNamed: {
|
|
|
1071
1030
|
readonly adjustForTimeZone?: boolean | undefined
|
|
1072
1031
|
readonly disambiguation?: Disambiguation | undefined
|
|
1073
1032
|
}
|
|
1074
|
-
): (self: DateTime) => Zoned
|
|
1033
|
+
): (self: DateTime) => Option.Option<Zoned>
|
|
1075
1034
|
/**
|
|
1076
1035
|
* Set the time zone of a `DateTime` from an IANA time zone identifier. If the
|
|
1077
1036
|
* time zone is invalid, `None` will be returned.
|
|
@@ -1096,7 +1055,7 @@ export const setZoneNamed: {
|
|
|
1096
1055
|
readonly adjustForTimeZone?: boolean | undefined
|
|
1097
1056
|
readonly disambiguation?: Disambiguation | undefined
|
|
1098
1057
|
}
|
|
1099
|
-
): Zoned
|
|
1058
|
+
): Option.Option<Zoned>
|
|
1100
1059
|
} = Internal.setZoneNamed
|
|
1101
1060
|
|
|
1102
1061
|
/**
|
|
@@ -2138,7 +2097,7 @@ export const setParts: {
|
|
|
2138
2097
|
* const dt = DateTime.makeUnsafe("2024-01-01T12:00:00Z")
|
|
2139
2098
|
* const updated = DateTime.setPartsUtc(dt, {
|
|
2140
2099
|
* year: 2025,
|
|
2141
|
-
*
|
|
2100
|
+
* hour: 18
|
|
2142
2101
|
* })
|
|
2143
2102
|
*
|
|
2144
2103
|
* console.log(DateTime.formatIso(updated)) // "2025-01-01T18:00:00.000Z"
|
|
@@ -2160,7 +2119,7 @@ export const setPartsUtc: {
|
|
|
2160
2119
|
* const dt = DateTime.makeUnsafe("2024-01-01T12:00:00Z")
|
|
2161
2120
|
* const updated = DateTime.setPartsUtc(dt, {
|
|
2162
2121
|
* year: 2025,
|
|
2163
|
-
*
|
|
2122
|
+
* hour: 18
|
|
2164
2123
|
* })
|
|
2165
2124
|
*
|
|
2166
2125
|
* console.log(DateTime.formatIso(updated)) // "2025-01-01T18:00:00.000Z"
|
|
@@ -2182,7 +2141,7 @@ export const setPartsUtc: {
|
|
|
2182
2141
|
* const dt = DateTime.makeUnsafe("2024-01-01T12:00:00Z")
|
|
2183
2142
|
* const updated = DateTime.setPartsUtc(dt, {
|
|
2184
2143
|
* year: 2025,
|
|
2185
|
-
*
|
|
2144
|
+
* hour: 18
|
|
2186
2145
|
* })
|
|
2187
2146
|
*
|
|
2188
2147
|
* console.log(DateTime.formatIso(updated)) // "2025-01-01T18:00:00.000Z"
|
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
|
/**
|
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
|
-
import { hasProperty,
|
|
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
|
|
|
@@ -96,6 +96,36 @@ export type Input =
|
|
|
96
96
|
| bigint // nanos
|
|
97
97
|
| readonly [seconds: number, nanos: number]
|
|
98
98
|
| `${number} ${Unit}`
|
|
99
|
+
| DurationObject
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* An object with optional duration components that can be combined to create
|
|
103
|
+
* a Duration. All fields are optional and additive.
|
|
104
|
+
*
|
|
105
|
+
* Compatible with Temporal.Duration-like objects.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```ts
|
|
109
|
+
* import { Duration } from "effect"
|
|
110
|
+
*
|
|
111
|
+
* Duration.fromInputUnsafe({ seconds: 30 })
|
|
112
|
+
* Duration.fromInputUnsafe({ days: 1 })
|
|
113
|
+
* Duration.fromInputUnsafe({ seconds: 1, nanoseconds: 500 })
|
|
114
|
+
* ```
|
|
115
|
+
*
|
|
116
|
+
* @since 4.0.0
|
|
117
|
+
* @category models
|
|
118
|
+
*/
|
|
119
|
+
export interface DurationObject {
|
|
120
|
+
readonly weeks?: number | undefined
|
|
121
|
+
readonly days?: number | undefined
|
|
122
|
+
readonly hours?: number | undefined
|
|
123
|
+
readonly minutes?: number | undefined
|
|
124
|
+
readonly seconds?: number | undefined
|
|
125
|
+
readonly milliseconds?: number | undefined
|
|
126
|
+
readonly microseconds?: number | undefined
|
|
127
|
+
readonly nanoseconds?: number | undefined
|
|
128
|
+
}
|
|
99
129
|
|
|
100
130
|
const DURATION_REGEXP = /^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/
|
|
101
131
|
|
|
@@ -117,27 +147,14 @@ const DURATION_REGEXP = /^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|m
|
|
|
117
147
|
* @category constructors
|
|
118
148
|
*/
|
|
119
149
|
export const fromInputUnsafe = (input: Input): Duration => {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
if (input[0] === -Infinity || input[1] === -Infinity) {
|
|
129
|
-
return negativeInfinity
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
if (input[0] === Infinity || input[1] === Infinity) {
|
|
133
|
-
return infinity
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
return nanos(BigInt(Math.round(input[0] * 1_000_000_000)) + BigInt(Math.round(input[1])))
|
|
137
|
-
}
|
|
138
|
-
if (isString(input)) {
|
|
139
|
-
const match = DURATION_REGEXP.exec(input)
|
|
140
|
-
if (match) {
|
|
150
|
+
switch (typeof input) {
|
|
151
|
+
case "number":
|
|
152
|
+
return millis(input)
|
|
153
|
+
case "bigint":
|
|
154
|
+
return nanos(input)
|
|
155
|
+
case "string": {
|
|
156
|
+
const match = DURATION_REGEXP.exec(input)
|
|
157
|
+
if (!match) break
|
|
141
158
|
const [_, valueStr, unit] = match
|
|
142
159
|
const value = Number(valueStr)
|
|
143
160
|
switch (unit) {
|
|
@@ -166,29 +183,67 @@ export const fromInputUnsafe = (input: Input): Duration => {
|
|
|
166
183
|
case "weeks":
|
|
167
184
|
return weeks(value)
|
|
168
185
|
}
|
|
186
|
+
break
|
|
187
|
+
}
|
|
188
|
+
case "object": {
|
|
189
|
+
if (input === null) break
|
|
190
|
+
if (TypeId in input) return input as Duration
|
|
191
|
+
if (Array.isArray(input)) {
|
|
192
|
+
if (input.length !== 2 || !input.every(isNumber)) {
|
|
193
|
+
return invalid(input)
|
|
194
|
+
}
|
|
195
|
+
if (Number.isNaN(input[0]) || Number.isNaN(input[1])) {
|
|
196
|
+
return zero
|
|
197
|
+
}
|
|
198
|
+
if (input[0] === -Infinity || input[1] === -Infinity) {
|
|
199
|
+
return negativeInfinity
|
|
200
|
+
}
|
|
201
|
+
if (input[0] === Infinity || input[1] === Infinity) {
|
|
202
|
+
return infinity
|
|
203
|
+
}
|
|
204
|
+
return make(BigInt(Math.round(input[0] * 1_000_000_000)) + BigInt(Math.round(input[1])))
|
|
205
|
+
}
|
|
206
|
+
const obj = input as DurationObject
|
|
207
|
+
let millis = 0
|
|
208
|
+
// we can use truthy checks here, because 0 can be ignored
|
|
209
|
+
if (obj.weeks) millis += obj.weeks * 604_800_000
|
|
210
|
+
if (obj.days) millis += obj.days * 86_400_000
|
|
211
|
+
if (obj.hours) millis += obj.hours * 3_600_000
|
|
212
|
+
if (obj.minutes) millis += obj.minutes * 60_000
|
|
213
|
+
if (obj.seconds) millis += obj.seconds * 1_000
|
|
214
|
+
if (obj.milliseconds) millis += obj.milliseconds
|
|
215
|
+
if (!obj.microseconds && !obj.nanoseconds) return make(millis)
|
|
216
|
+
let nanos = BigInt(millis) * bigint1e6
|
|
217
|
+
if (obj.microseconds) nanos += BigInt(obj.microseconds) * bigint1e3
|
|
218
|
+
if (obj.nanoseconds) nanos += BigInt(obj.nanoseconds)
|
|
219
|
+
return make(nanos)
|
|
169
220
|
}
|
|
170
221
|
}
|
|
222
|
+
return invalid(input)
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
const invalid = (input: unknown): never => {
|
|
171
226
|
throw new Error(`Invalid Input: ${input}`)
|
|
172
227
|
}
|
|
173
228
|
|
|
174
229
|
/**
|
|
175
230
|
* Safely decodes a `Input` value into a `Duration`, returning
|
|
176
|
-
* `
|
|
231
|
+
* `Option.none()` if decoding fails.
|
|
177
232
|
*
|
|
178
233
|
* **Example**
|
|
179
234
|
*
|
|
180
235
|
* ```ts
|
|
181
|
-
* import { Duration } from "effect"
|
|
236
|
+
* import { Duration, Option } from "effect"
|
|
182
237
|
*
|
|
183
|
-
* Duration.fromInput(1000)
|
|
238
|
+
* Duration.fromInput(1000).pipe(Option.map(Duration.toSeconds)) // Some(1)
|
|
184
239
|
*
|
|
185
|
-
* Duration.fromInput("invalid" as any) //
|
|
240
|
+
* Duration.fromInput("invalid" as any) // None
|
|
186
241
|
* ```
|
|
187
242
|
*
|
|
188
243
|
* @category constructors
|
|
189
244
|
* @since 4.0.0
|
|
190
245
|
*/
|
|
191
|
-
export const fromInput: (u: Input) => Duration
|
|
246
|
+
export const fromInput: (u: Input) => Option.Option<Duration> = Option.liftThrowable(
|
|
192
247
|
fromInputUnsafe
|
|
193
248
|
)
|
|
194
249
|
|
|
@@ -238,7 +293,7 @@ const DurationProto: Omit<Duration, "value"> = {
|
|
|
238
293
|
|
|
239
294
|
const make = (input: number | bigint): Duration => {
|
|
240
295
|
const duration = Object.create(DurationProto)
|
|
241
|
-
if (
|
|
296
|
+
if (typeof input === "number") {
|
|
242
297
|
if (isNaN(input) || input === 0 || Object.is(input, -0)) {
|
|
243
298
|
duration.value = zeroDurationValue
|
|
244
299
|
} else if (!Number.isFinite(input)) {
|
|
@@ -768,22 +823,23 @@ export const toNanosUnsafe = (self: Duration): bigint => {
|
|
|
768
823
|
/**
|
|
769
824
|
* Get the duration in nanoseconds as a bigint.
|
|
770
825
|
*
|
|
771
|
-
* If the duration is infinite, returns `
|
|
826
|
+
* If the duration is infinite, returns `Option.none()`.
|
|
772
827
|
*
|
|
773
828
|
* **Example**
|
|
774
829
|
*
|
|
775
830
|
* ```ts
|
|
776
|
-
* import { Duration } from "effect"
|
|
831
|
+
* import { Duration, Option } from "effect"
|
|
777
832
|
*
|
|
778
|
-
* Duration.toNanos(Duration.seconds(1)) // 1000000000n
|
|
833
|
+
* Duration.toNanos(Duration.seconds(1)) // Some(1000000000n)
|
|
779
834
|
*
|
|
780
|
-
* Duration.toNanos(Duration.infinity) //
|
|
835
|
+
* Duration.toNanos(Duration.infinity) // None
|
|
836
|
+
* Option.getOrUndefined(Duration.toNanos(Duration.infinity)) // undefined
|
|
781
837
|
* ```
|
|
782
838
|
*
|
|
783
839
|
* @category getters
|
|
784
840
|
* @since 4.0.0
|
|
785
841
|
*/
|
|
786
|
-
export const toNanos: (self: Duration) => bigint
|
|
842
|
+
export const toNanos: (self: Duration) => Option.Option<bigint> = Option.liftThrowable(toNanosUnsafe)
|
|
787
843
|
|
|
788
844
|
/**
|
|
789
845
|
* Converts a Duration to high-resolution time format [seconds, nanoseconds].
|
|
@@ -1279,17 +1335,17 @@ export const clamp: {
|
|
|
1279
1335
|
} = order.clamp(Order)
|
|
1280
1336
|
|
|
1281
1337
|
/**
|
|
1282
|
-
* Divides a Duration by a number, returning `
|
|
1338
|
+
* Divides a Duration by a number, returning `Option.none()` if division is invalid.
|
|
1283
1339
|
*
|
|
1284
1340
|
* **Example**
|
|
1285
1341
|
*
|
|
1286
1342
|
* ```ts
|
|
1287
|
-
* import { Duration } from "effect"
|
|
1343
|
+
* import { Duration, Option } from "effect"
|
|
1288
1344
|
*
|
|
1289
1345
|
* const d = Duration.divide(Duration.seconds(10), 2)
|
|
1290
|
-
* console.log(d
|
|
1346
|
+
* console.log(Option.map(d, Duration.toSeconds)) // Some(5)
|
|
1291
1347
|
*
|
|
1292
|
-
* Duration.divide(Duration.seconds(10), 0) //
|
|
1348
|
+
* Duration.divide(Duration.seconds(10), 0) // None
|
|
1293
1349
|
* ```
|
|
1294
1350
|
*
|
|
1295
1351
|
* @since 4.0.0
|
|
@@ -1297,57 +1353,57 @@ export const clamp: {
|
|
|
1297
1353
|
*/
|
|
1298
1354
|
export const divide: {
|
|
1299
1355
|
/**
|
|
1300
|
-
* Divides a Duration by a number, returning `
|
|
1356
|
+
* Divides a Duration by a number, returning `Option.none()` if division is invalid.
|
|
1301
1357
|
*
|
|
1302
1358
|
* **Example**
|
|
1303
1359
|
*
|
|
1304
1360
|
* ```ts
|
|
1305
|
-
* import { Duration } from "effect"
|
|
1361
|
+
* import { Duration, Option } from "effect"
|
|
1306
1362
|
*
|
|
1307
1363
|
* const d = Duration.divide(Duration.seconds(10), 2)
|
|
1308
|
-
* console.log(d
|
|
1364
|
+
* console.log(Option.map(d, Duration.toSeconds)) // Some(5)
|
|
1309
1365
|
*
|
|
1310
|
-
* Duration.divide(Duration.seconds(10), 0) //
|
|
1366
|
+
* Duration.divide(Duration.seconds(10), 0) // None
|
|
1311
1367
|
* ```
|
|
1312
1368
|
*
|
|
1313
1369
|
* @since 4.0.0
|
|
1314
1370
|
* @category math
|
|
1315
1371
|
*/
|
|
1316
|
-
(by: number): (self: Duration) => Duration
|
|
1372
|
+
(by: number): (self: Duration) => Option.Option<Duration>
|
|
1317
1373
|
/**
|
|
1318
|
-
* Divides a Duration by a number, returning `
|
|
1374
|
+
* Divides a Duration by a number, returning `Option.none()` if division is invalid.
|
|
1319
1375
|
*
|
|
1320
1376
|
* **Example**
|
|
1321
1377
|
*
|
|
1322
1378
|
* ```ts
|
|
1323
|
-
* import { Duration } from "effect"
|
|
1379
|
+
* import { Duration, Option } from "effect"
|
|
1324
1380
|
*
|
|
1325
1381
|
* const d = Duration.divide(Duration.seconds(10), 2)
|
|
1326
|
-
* console.log(d
|
|
1382
|
+
* console.log(Option.map(d, Duration.toSeconds)) // Some(5)
|
|
1327
1383
|
*
|
|
1328
|
-
* Duration.divide(Duration.seconds(10), 0) //
|
|
1384
|
+
* Duration.divide(Duration.seconds(10), 0) // None
|
|
1329
1385
|
* ```
|
|
1330
1386
|
*
|
|
1331
1387
|
* @since 4.0.0
|
|
1332
1388
|
* @category math
|
|
1333
1389
|
*/
|
|
1334
|
-
(self: Duration, by: number): Duration
|
|
1390
|
+
(self: Duration, by: number): Option.Option<Duration>
|
|
1335
1391
|
} = dual(
|
|
1336
1392
|
2,
|
|
1337
|
-
(self: Duration, by: number): Duration
|
|
1338
|
-
if (!Number.isFinite(by)) return
|
|
1339
|
-
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()
|
|
1340
1396
|
return match(self, {
|
|
1341
|
-
onMillis: (millis) => make(millis / by),
|
|
1397
|
+
onMillis: (millis) => Option.some(make(millis / by)),
|
|
1342
1398
|
onNanos: (nanos) => {
|
|
1343
1399
|
try {
|
|
1344
|
-
return make(nanos / BigInt(by))
|
|
1400
|
+
return Option.some(make(nanos / BigInt(by)))
|
|
1345
1401
|
} catch {
|
|
1346
|
-
return
|
|
1402
|
+
return Option.none()
|
|
1347
1403
|
}
|
|
1348
1404
|
},
|
|
1349
|
-
onInfinity: () => by > 0 ? infinity : negativeInfinity,
|
|
1350
|
-
onNegativeInfinity: () => by > 0 ? negativeInfinity : infinity
|
|
1405
|
+
onInfinity: () => Option.some(by > 0 ? infinity : negativeInfinity),
|
|
1406
|
+
onNegativeInfinity: () => Option.some(by > 0 ? negativeInfinity : infinity)
|
|
1351
1407
|
})
|
|
1352
1408
|
}
|
|
1353
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
|
}
|