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
|
@@ -710,7 +710,7 @@ export const date = (options: DateOptions): Prompt<Date> => {
|
|
|
710
710
|
typed: "",
|
|
711
711
|
cursor: initialCursorPosition,
|
|
712
712
|
value: opts.initial,
|
|
713
|
-
error:
|
|
713
|
+
error: Option.none()
|
|
714
714
|
}
|
|
715
715
|
return custom(initialState, {
|
|
716
716
|
render: handleDateRender(opts),
|
|
@@ -727,7 +727,7 @@ export const file = (options: FileOptions = {}): Prompt<string> => {
|
|
|
727
727
|
const opts: FileOptionsReq = {
|
|
728
728
|
type: options.type ?? "file",
|
|
729
729
|
message: options.message ?? `Choose a file`,
|
|
730
|
-
startingPath: options.startingPath,
|
|
730
|
+
startingPath: Option.fromUndefinedOr(options.startingPath),
|
|
731
731
|
maxPerPage: options.maxPerPage ?? 10,
|
|
732
732
|
filter: options.filter ?? (() => Effect.succeed(true))
|
|
733
733
|
}
|
|
@@ -736,10 +736,10 @@ export const file = (options: FileOptions = {}): Prompt<string> => {
|
|
|
736
736
|
never,
|
|
737
737
|
Environment
|
|
738
738
|
> = Effect.gen(function*() {
|
|
739
|
-
const currentPath = yield* resolveCurrentPath(
|
|
739
|
+
const currentPath = yield* resolveCurrentPath(Option.none(), opts)
|
|
740
740
|
const files = yield* getFileList(currentPath, opts)
|
|
741
741
|
const confirm = Confirm.Hide()
|
|
742
|
-
return { cursor: 0, files, path:
|
|
742
|
+
return { cursor: 0, files, path: Option.none(), confirm }
|
|
743
743
|
})
|
|
744
744
|
return custom(initialState, {
|
|
745
745
|
render: handleFileRender(opts),
|
|
@@ -799,7 +799,7 @@ export const float = (options: FloatOptions): Prompt<number> => {
|
|
|
799
799
|
const initialState: NumberState = {
|
|
800
800
|
cursor: 0,
|
|
801
801
|
value: "",
|
|
802
|
-
error:
|
|
802
|
+
error: Option.none()
|
|
803
803
|
}
|
|
804
804
|
return custom(initialState, {
|
|
805
805
|
render: handleRenderFloat(opts),
|
|
@@ -839,7 +839,7 @@ export const integer = (options: IntegerOptions): Prompt<number> => {
|
|
|
839
839
|
const initialState: NumberState = {
|
|
840
840
|
cursor: 0,
|
|
841
841
|
value: "",
|
|
842
|
-
error:
|
|
842
|
+
error: Option.none()
|
|
843
843
|
}
|
|
844
844
|
return custom(initialState, {
|
|
845
845
|
render: handleRenderInteger(opts),
|
|
@@ -1009,7 +1009,7 @@ export const multiSelect = <const A>(
|
|
|
1009
1009
|
initialSelected.add(i)
|
|
1010
1010
|
}
|
|
1011
1011
|
}
|
|
1012
|
-
const initialState: MultiSelectState = { index: 0, selectedIndices: initialSelected, error:
|
|
1012
|
+
const initialState: MultiSelectState = { index: 0, selectedIndices: initialSelected, error: Option.none() }
|
|
1013
1013
|
return custom(initialState, {
|
|
1014
1014
|
render: handleMultiSelectRender(opts),
|
|
1015
1015
|
process: handleMultiSelectProcess(opts),
|
|
@@ -1289,7 +1289,7 @@ const TRUE_VALUE_REGEXP = /^y|t$/
|
|
|
1289
1289
|
const FALSE_VALUE_REGEXP = /^n|f$/
|
|
1290
1290
|
|
|
1291
1291
|
const handleConfirmProcess = (input: Terminal.UserInput, defaultValue: boolean) => {
|
|
1292
|
-
const value = input.input
|
|
1292
|
+
const value = Option.getOrElse(input.input, () => "")
|
|
1293
1293
|
if (input.key.name === "enter" || input.key.name === "return") {
|
|
1294
1294
|
return Effect.succeed(Action.Submit({ value: defaultValue }))
|
|
1295
1295
|
}
|
|
@@ -1309,7 +1309,7 @@ interface DateState {
|
|
|
1309
1309
|
readonly cursor: number
|
|
1310
1310
|
readonly value: globalThis.Date
|
|
1311
1311
|
readonly dateParts: ReadonlyArray<DatePart>
|
|
1312
|
-
readonly error: string
|
|
1312
|
+
readonly error: Option.Option<string>
|
|
1313
1313
|
}
|
|
1314
1314
|
|
|
1315
1315
|
const handleDateClear = (options: DateOptionsReq) => {
|
|
@@ -1320,8 +1320,8 @@ const handleDateClear = (options: DateOptionsReq) => {
|
|
|
1320
1320
|
const resetCurrentLine = Ansi.eraseLine + Ansi.cursorLeft
|
|
1321
1321
|
const parts = Arr.reduce(state.dateParts, "", (doc, part) => doc + part.toString())
|
|
1322
1322
|
const promptText = renderDateOutput("?", figures.pointerSmall, parts, options, { plain: true })
|
|
1323
|
-
const errorText = state.error
|
|
1324
|
-
? Arr.match(state.error.split(NEWLINE_REGEXP), {
|
|
1323
|
+
const errorText = Option.isSome(state.error)
|
|
1324
|
+
? Arr.match(state.error.value.split(NEWLINE_REGEXP), {
|
|
1325
1325
|
onEmpty: () => "",
|
|
1326
1326
|
onNonEmpty: (errorLines) => `${figures.pointerSmall} ${errorLines.join("\n")}`
|
|
1327
1327
|
})
|
|
@@ -1332,8 +1332,8 @@ const handleDateClear = (options: DateOptionsReq) => {
|
|
|
1332
1332
|
}
|
|
1333
1333
|
|
|
1334
1334
|
const renderDateError = (state: DateState, pointer: string): string => {
|
|
1335
|
-
if (state.error
|
|
1336
|
-
const errorLines = state.error.split(NEWLINE_REGEXP)
|
|
1335
|
+
if (Option.isSome(state.error)) {
|
|
1336
|
+
const errorLines = state.error.value.split(NEWLINE_REGEXP)
|
|
1337
1337
|
if (Arr.isReadonlyArrayNonEmpty(errorLines)) {
|
|
1338
1338
|
const prefix = Ansi.annotate(pointer, Ansi.red) + " "
|
|
1339
1339
|
const lines = Arr.map(errorLines, (str) => annotateErrorLine(str))
|
|
@@ -1401,12 +1401,12 @@ const processDown = (state: DateState) => {
|
|
|
1401
1401
|
|
|
1402
1402
|
const processDateCursorLeft = (state: DateState) => {
|
|
1403
1403
|
const previous = state.dateParts[state.cursor].previousPart()
|
|
1404
|
-
if (previous
|
|
1404
|
+
if (Option.isSome(previous)) {
|
|
1405
1405
|
return Action.NextFrame({
|
|
1406
1406
|
state: {
|
|
1407
1407
|
...state,
|
|
1408
1408
|
typed: "",
|
|
1409
|
-
cursor: state.dateParts.indexOf(previous)
|
|
1409
|
+
cursor: state.dateParts.indexOf(previous.value)
|
|
1410
1410
|
}
|
|
1411
1411
|
})
|
|
1412
1412
|
}
|
|
@@ -1415,12 +1415,12 @@ const processDateCursorLeft = (state: DateState) => {
|
|
|
1415
1415
|
|
|
1416
1416
|
const processDateCursorRight = (state: DateState) => {
|
|
1417
1417
|
const next = state.dateParts[state.cursor].nextPart()
|
|
1418
|
-
if (next
|
|
1418
|
+
if (Option.isSome(next)) {
|
|
1419
1419
|
return Action.NextFrame({
|
|
1420
1420
|
state: {
|
|
1421
1421
|
...state,
|
|
1422
1422
|
typed: "",
|
|
1423
|
-
cursor: state.dateParts.indexOf(next)
|
|
1423
|
+
cursor: state.dateParts.indexOf(next.value)
|
|
1424
1424
|
}
|
|
1425
1425
|
})
|
|
1426
1426
|
}
|
|
@@ -1429,9 +1429,10 @@ const processDateCursorRight = (state: DateState) => {
|
|
|
1429
1429
|
|
|
1430
1430
|
const processDateNext = (state: DateState) => {
|
|
1431
1431
|
const next = state.dateParts[state.cursor].nextPart()
|
|
1432
|
-
const cursor = next
|
|
1433
|
-
|
|
1434
|
-
:
|
|
1432
|
+
const cursor = Option.match(next, {
|
|
1433
|
+
onNone: () => state.dateParts.findIndex((part) => !part.isToken()),
|
|
1434
|
+
onSome: (next) => state.dateParts.indexOf(next)
|
|
1435
|
+
})
|
|
1435
1436
|
return Action.NextFrame({
|
|
1436
1437
|
state: { ...state, cursor }
|
|
1437
1438
|
})
|
|
@@ -1505,14 +1506,14 @@ const handleDateProcess = (options: DateOptionsReq) => {
|
|
|
1505
1506
|
Action.NextFrame({
|
|
1506
1507
|
state: {
|
|
1507
1508
|
...state,
|
|
1508
|
-
error
|
|
1509
|
+
error: Option.some(error)
|
|
1509
1510
|
}
|
|
1510
1511
|
}),
|
|
1511
1512
|
onSuccess: (value) => Action.Submit({ value })
|
|
1512
1513
|
})
|
|
1513
1514
|
}
|
|
1514
1515
|
default: {
|
|
1515
|
-
return Effect.succeed(defaultDateProcessor(input.input
|
|
1516
|
+
return Effect.succeed(defaultDateProcessor(Option.getOrElse(input.input, () => ""), state))
|
|
1516
1517
|
}
|
|
1517
1518
|
}
|
|
1518
1519
|
}
|
|
@@ -1609,23 +1610,20 @@ abstract class DatePart {
|
|
|
1609
1610
|
/**
|
|
1610
1611
|
* Retrieves the next date part in the list of parts.
|
|
1611
1612
|
*/
|
|
1612
|
-
nextPart(): DatePart
|
|
1613
|
-
const currentPartIndex = Arr.findFirstIndex(this.parts, (part) => part === this)
|
|
1614
|
-
return
|
|
1615
|
-
Arr.findFirst(this.parts.slice(currentPartIndex + 1), (part) => !part.isToken())
|
|
1616
|
-
)
|
|
1613
|
+
nextPart(): Option.Option<DatePart> {
|
|
1614
|
+
const currentPartIndex = Option.getOrElse(Arr.findFirstIndex(this.parts, (part) => part === this), () => 0)
|
|
1615
|
+
return Arr.findFirst(this.parts.slice(currentPartIndex + 1), (part) => !part.isToken())
|
|
1617
1616
|
}
|
|
1618
1617
|
|
|
1619
1618
|
/**
|
|
1620
1619
|
* Retrieves the previous date part in the list of parts.
|
|
1621
1620
|
*/
|
|
1622
|
-
previousPart(): DatePart
|
|
1621
|
+
previousPart(): Option.Option<DatePart> {
|
|
1623
1622
|
const currentPartIndex = Arr.findFirstIndex(this.parts, (part) => part === this)
|
|
1624
|
-
if (currentPartIndex
|
|
1625
|
-
return
|
|
1626
|
-
Arr.findLast(this.parts.slice(0, currentPartIndex), (part) => !part.isToken())
|
|
1627
|
-
)
|
|
1623
|
+
if (Option.isSome(currentPartIndex)) {
|
|
1624
|
+
return Arr.findLast(this.parts.slice(0, currentPartIndex.value), (part) => !part.isToken())
|
|
1628
1625
|
}
|
|
1626
|
+
return Option.none()
|
|
1629
1627
|
}
|
|
1630
1628
|
|
|
1631
1629
|
toString() {
|
|
@@ -1851,13 +1849,13 @@ class Meridiem extends DatePart {
|
|
|
1851
1849
|
}
|
|
1852
1850
|
|
|
1853
1851
|
interface FileOptionsReq extends Required<Omit<FileOptions, "startingPath">> {
|
|
1854
|
-
readonly startingPath: string
|
|
1852
|
+
readonly startingPath: Option.Option<string>
|
|
1855
1853
|
}
|
|
1856
1854
|
|
|
1857
1855
|
interface FileState {
|
|
1858
1856
|
readonly cursor: number
|
|
1859
1857
|
readonly files: ReadonlyArray<string>
|
|
1860
|
-
readonly path: string
|
|
1858
|
+
readonly path: Option.Option<string>
|
|
1861
1859
|
readonly confirm: Confirm
|
|
1862
1860
|
}
|
|
1863
1861
|
|
|
@@ -1871,14 +1869,14 @@ const Confirm = Data.taggedEnum<Confirm>()
|
|
|
1871
1869
|
const showConfirmation = Confirm.$is("Show")
|
|
1872
1870
|
|
|
1873
1871
|
const resolveCurrentPath = (
|
|
1874
|
-
path: string
|
|
1872
|
+
path: Option.Option<string>,
|
|
1875
1873
|
options: FileOptionsReq
|
|
1876
1874
|
): Effect.Effect<string, never, FileSystem.FileSystem> => {
|
|
1877
|
-
if (path
|
|
1878
|
-
return Effect.succeed(path)
|
|
1875
|
+
if (Option.isSome(path)) {
|
|
1876
|
+
return Effect.succeed(path.value)
|
|
1879
1877
|
}
|
|
1880
|
-
|
|
1881
|
-
|
|
1878
|
+
if (Option.isSome(options.startingPath)) {
|
|
1879
|
+
const startingPath = options.startingPath.value
|
|
1882
1880
|
return Effect.flatMap(FileSystem.FileSystem.asEffect(), (fs) =>
|
|
1883
1881
|
// Ensure the user provided starting path exists
|
|
1884
1882
|
Effect.orDie(fs.exists(startingPath)).pipe(
|
|
@@ -2099,7 +2097,7 @@ const processSelection = Effect.fnUntraced(function*(state: FileState, options:
|
|
|
2099
2097
|
state: {
|
|
2100
2098
|
cursor: 0,
|
|
2101
2099
|
files,
|
|
2102
|
-
path: resolvedPath,
|
|
2100
|
+
path: Option.some(resolvedPath),
|
|
2103
2101
|
confirm: Confirm.Hide()
|
|
2104
2102
|
}
|
|
2105
2103
|
})
|
|
@@ -2135,7 +2133,7 @@ const handleFileProcess = (options: FileOptionsReq) => {
|
|
|
2135
2133
|
state: {
|
|
2136
2134
|
cursor: 0,
|
|
2137
2135
|
files,
|
|
2138
|
-
path: resolvedPath,
|
|
2136
|
+
path: Option.some(resolvedPath),
|
|
2139
2137
|
confirm: Confirm.Hide()
|
|
2140
2138
|
}
|
|
2141
2139
|
})
|
|
@@ -2166,7 +2164,7 @@ interface MultiSelectOptionsReq extends MultiSelectOptions {}
|
|
|
2166
2164
|
type MultiSelectState = {
|
|
2167
2165
|
index: number
|
|
2168
2166
|
selectedIndices: Set<number>
|
|
2169
|
-
error: string
|
|
2167
|
+
error: Option.Option<string>
|
|
2170
2168
|
}
|
|
2171
2169
|
|
|
2172
2170
|
const renderMultiSelectError = (
|
|
@@ -2174,8 +2172,8 @@ const renderMultiSelectError = (
|
|
|
2174
2172
|
pointer: string,
|
|
2175
2173
|
renderOptions?: RenderOptions | undefined
|
|
2176
2174
|
): string => {
|
|
2177
|
-
if (state.error
|
|
2178
|
-
return Arr.match(state.error.split(NEWLINE_REGEXP), {
|
|
2175
|
+
if (Option.isSome(state.error)) {
|
|
2176
|
+
return Arr.match(state.error.value.split(NEWLINE_REGEXP), {
|
|
2179
2177
|
onEmpty: () => "",
|
|
2180
2178
|
onNonEmpty: (errorLines) => {
|
|
2181
2179
|
if (renderOptions?.plain === true) {
|
|
@@ -2347,12 +2345,12 @@ const handleMultiSelectProcess = <A>(options: SelectOptionsReq<A> & MultiSelectO
|
|
|
2347
2345
|
switch (input.key.name) {
|
|
2348
2346
|
case "k":
|
|
2349
2347
|
case "up": {
|
|
2350
|
-
return processMultiSelectCursorUp({ ...state, error:
|
|
2348
|
+
return processMultiSelectCursorUp({ ...state, error: Option.none() }, totalChoices)
|
|
2351
2349
|
}
|
|
2352
2350
|
case "j":
|
|
2353
2351
|
case "down":
|
|
2354
2352
|
case "tab": {
|
|
2355
|
-
return processMultiSelectCursorDown({ ...state, error:
|
|
2353
|
+
return processMultiSelectCursorDown({ ...state, error: Option.none() }, totalChoices)
|
|
2356
2354
|
}
|
|
2357
2355
|
case "space": {
|
|
2358
2356
|
return processSpace(state, options)
|
|
@@ -2362,12 +2360,12 @@ const handleMultiSelectProcess = <A>(options: SelectOptionsReq<A> & MultiSelectO
|
|
|
2362
2360
|
const selectedCount = state.selectedIndices.size
|
|
2363
2361
|
if (options.min !== undefined && selectedCount < options.min) {
|
|
2364
2362
|
return Effect.succeed(
|
|
2365
|
-
Action.NextFrame({ state: { ...state, error: `At least ${options.min} are required` } })
|
|
2363
|
+
Action.NextFrame({ state: { ...state, error: Option.some(`At least ${options.min} are required`) } })
|
|
2366
2364
|
)
|
|
2367
2365
|
}
|
|
2368
2366
|
if (options.max !== undefined && selectedCount > options.max) {
|
|
2369
2367
|
return Effect.succeed(
|
|
2370
|
-
Action.NextFrame({ state: { ...state, error: `At most ${options.max} choices are allowed` } })
|
|
2368
|
+
Action.NextFrame({ state: { ...state, error: Option.some(`At most ${options.max} choices are allowed`) } })
|
|
2371
2369
|
)
|
|
2372
2370
|
}
|
|
2373
2371
|
const selectedValues = Array.from(state.selectedIndices).sort(EffectNumber.Order).map((index) =>
|
|
@@ -2398,7 +2396,7 @@ interface FloatOptionsReq extends Required<FloatOptions> {}
|
|
|
2398
2396
|
interface NumberState {
|
|
2399
2397
|
readonly cursor: number
|
|
2400
2398
|
readonly value: string
|
|
2401
|
-
readonly error: string
|
|
2399
|
+
readonly error: Option.Option<string>
|
|
2402
2400
|
}
|
|
2403
2401
|
|
|
2404
2402
|
const handleNumberClear = (options: IntegerOptionsReq) => {
|
|
@@ -2423,7 +2421,7 @@ const renderNumberInput = (
|
|
|
2423
2421
|
if (submitted || renderOptions?.plain === true) {
|
|
2424
2422
|
return value
|
|
2425
2423
|
}
|
|
2426
|
-
const annotation = state.error
|
|
2424
|
+
const annotation = Option.isSome(state.error) ?
|
|
2427
2425
|
Ansi.red :
|
|
2428
2426
|
Ansi.combine(Ansi.underlined, Ansi.cyanBright)
|
|
2429
2427
|
return Ansi.annotate(value, annotation)
|
|
@@ -2434,8 +2432,8 @@ const renderNumberError = (
|
|
|
2434
2432
|
pointer: string,
|
|
2435
2433
|
renderOptions?: RenderOptions | undefined
|
|
2436
2434
|
) => {
|
|
2437
|
-
if (state.error
|
|
2438
|
-
return Arr.match(state.error.split(NEWLINE_REGEXP), {
|
|
2435
|
+
if (Option.isSome(state.error)) {
|
|
2436
|
+
return Arr.match(state.error.value.split(NEWLINE_REGEXP), {
|
|
2439
2437
|
onEmpty: () => "",
|
|
2440
2438
|
onNonEmpty: (errorLines) => {
|
|
2441
2439
|
if (renderOptions?.plain === true) {
|
|
@@ -2485,19 +2483,19 @@ const processNumberBackspace = (state: NumberState) => {
|
|
|
2485
2483
|
}
|
|
2486
2484
|
const value = state.value.slice(0, state.value.length - 1)
|
|
2487
2485
|
return Effect.succeed(Action.NextFrame({
|
|
2488
|
-
state: { ...state, value, error:
|
|
2486
|
+
state: { ...state, value, error: Option.none() }
|
|
2489
2487
|
}))
|
|
2490
2488
|
}
|
|
2491
2489
|
|
|
2492
2490
|
const processNumberClear = (state: NumberState) =>
|
|
2493
2491
|
Effect.succeed(Action.NextFrame({
|
|
2494
|
-
state: { ...state, cursor: 0, value: "", error:
|
|
2492
|
+
state: { ...state, cursor: 0, value: "", error: Option.none() }
|
|
2495
2493
|
}))
|
|
2496
2494
|
|
|
2497
2495
|
const defaultIntProcessor = (input: string, state: NumberState) => {
|
|
2498
2496
|
if (state.value.length === 0 && input === "-") {
|
|
2499
2497
|
return Effect.succeed(Action.NextFrame({
|
|
2500
|
-
state: { ...state, value: "-", error:
|
|
2498
|
+
state: { ...state, value: "-", error: Option.none() }
|
|
2501
2499
|
}))
|
|
2502
2500
|
}
|
|
2503
2501
|
|
|
@@ -2506,7 +2504,7 @@ const defaultIntProcessor = (input: string, state: NumberState) => {
|
|
|
2506
2504
|
return Effect.succeed(Action.Beep())
|
|
2507
2505
|
} else {
|
|
2508
2506
|
return Effect.succeed(Action.NextFrame({
|
|
2509
|
-
state: { ...state, value: `${parsed}`, error:
|
|
2507
|
+
state: { ...state, value: `${parsed}`, error: Option.none() }
|
|
2510
2508
|
}))
|
|
2511
2509
|
}
|
|
2512
2510
|
}
|
|
@@ -2517,7 +2515,7 @@ const defaultFloatProcessor = (input: string, state: NumberState) => {
|
|
|
2517
2515
|
}
|
|
2518
2516
|
if (state.value.length === 0 && input === "-") {
|
|
2519
2517
|
return Effect.succeed(Action.NextFrame({
|
|
2520
|
-
state: { ...state, value: "-", error:
|
|
2518
|
+
state: { ...state, value: "-", error: Option.none() }
|
|
2521
2519
|
}))
|
|
2522
2520
|
}
|
|
2523
2521
|
|
|
@@ -2529,7 +2527,7 @@ const defaultFloatProcessor = (input: string, state: NumberState) => {
|
|
|
2529
2527
|
state: {
|
|
2530
2528
|
...state,
|
|
2531
2529
|
value: input === "." ? `${parsed}.` : `${parsed}`,
|
|
2532
|
-
error:
|
|
2530
|
+
error: Option.none()
|
|
2533
2531
|
}
|
|
2534
2532
|
}))
|
|
2535
2533
|
}
|
|
@@ -2562,7 +2560,7 @@ const handleProcessInteger = (options: IntegerOptionsReq) => {
|
|
|
2562
2560
|
value: state.value === "" || state.value === "-"
|
|
2563
2561
|
? `${options.incrementBy}`
|
|
2564
2562
|
: `${Number.parseInt(state.value) + options.incrementBy}`,
|
|
2565
|
-
error:
|
|
2563
|
+
error: Option.none()
|
|
2566
2564
|
}
|
|
2567
2565
|
}))
|
|
2568
2566
|
}
|
|
@@ -2574,7 +2572,7 @@ const handleProcessInteger = (options: IntegerOptionsReq) => {
|
|
|
2574
2572
|
value: state.value === "" || state.value === "-"
|
|
2575
2573
|
? `-${options.decrementBy}`
|
|
2576
2574
|
: `${Number.parseInt(state.value) - options.decrementBy}`,
|
|
2577
|
-
error:
|
|
2575
|
+
error: Option.none()
|
|
2578
2576
|
}
|
|
2579
2577
|
}))
|
|
2580
2578
|
}
|
|
@@ -2585,7 +2583,7 @@ const handleProcessInteger = (options: IntegerOptionsReq) => {
|
|
|
2585
2583
|
return Effect.succeed(Action.NextFrame({
|
|
2586
2584
|
state: {
|
|
2587
2585
|
...state,
|
|
2588
|
-
error: "Must provide an integer value"
|
|
2586
|
+
error: Option.some("Must provide an integer value")
|
|
2589
2587
|
}
|
|
2590
2588
|
}))
|
|
2591
2589
|
} else {
|
|
@@ -2594,7 +2592,7 @@ const handleProcessInteger = (options: IntegerOptionsReq) => {
|
|
|
2594
2592
|
Action.NextFrame({
|
|
2595
2593
|
state: {
|
|
2596
2594
|
...state,
|
|
2597
|
-
error
|
|
2595
|
+
error: Option.some(error)
|
|
2598
2596
|
}
|
|
2599
2597
|
}),
|
|
2600
2598
|
onSuccess: (value) => Action.Submit({ value })
|
|
@@ -2602,7 +2600,7 @@ const handleProcessInteger = (options: IntegerOptionsReq) => {
|
|
|
2602
2600
|
}
|
|
2603
2601
|
}
|
|
2604
2602
|
default: {
|
|
2605
|
-
return defaultIntProcessor(input.input
|
|
2603
|
+
return defaultIntProcessor(Option.getOrElse(input.input, () => ""), state)
|
|
2606
2604
|
}
|
|
2607
2605
|
}
|
|
2608
2606
|
}
|
|
@@ -2635,7 +2633,7 @@ const handleProcessFloat = (options: FloatOptionsReq) => {
|
|
|
2635
2633
|
value: state.value === "" || state.value === "-"
|
|
2636
2634
|
? `${options.incrementBy}`
|
|
2637
2635
|
: `${Number.parseFloat(state.value) + options.incrementBy}`,
|
|
2638
|
-
error:
|
|
2636
|
+
error: Option.none()
|
|
2639
2637
|
}
|
|
2640
2638
|
}))
|
|
2641
2639
|
}
|
|
@@ -2647,7 +2645,7 @@ const handleProcessFloat = (options: FloatOptionsReq) => {
|
|
|
2647
2645
|
value: state.value === "" || state.value === "-"
|
|
2648
2646
|
? `-${options.decrementBy}`
|
|
2649
2647
|
: `${Number.parseFloat(state.value) - options.decrementBy}`,
|
|
2650
|
-
error:
|
|
2648
|
+
error: Option.none()
|
|
2651
2649
|
}
|
|
2652
2650
|
}))
|
|
2653
2651
|
}
|
|
@@ -2658,7 +2656,7 @@ const handleProcessFloat = (options: FloatOptionsReq) => {
|
|
|
2658
2656
|
return Effect.succeed(Action.NextFrame({
|
|
2659
2657
|
state: {
|
|
2660
2658
|
...state,
|
|
2661
|
-
error: "Must provide a floating point value"
|
|
2659
|
+
error: Option.some("Must provide a floating point value")
|
|
2662
2660
|
}
|
|
2663
2661
|
}))
|
|
2664
2662
|
} else {
|
|
@@ -2670,7 +2668,7 @@ const handleProcessFloat = (options: FloatOptionsReq) => {
|
|
|
2670
2668
|
Action.NextFrame({
|
|
2671
2669
|
state: {
|
|
2672
2670
|
...state,
|
|
2673
|
-
error
|
|
2671
|
+
error: Option.some(error)
|
|
2674
2672
|
}
|
|
2675
2673
|
}),
|
|
2676
2674
|
onSuccess: (value) => Action.Submit({ value })
|
|
@@ -2679,7 +2677,7 @@ const handleProcessFloat = (options: FloatOptionsReq) => {
|
|
|
2679
2677
|
}
|
|
2680
2678
|
}
|
|
2681
2679
|
default: {
|
|
2682
|
-
return defaultFloatProcessor(input.input
|
|
2680
|
+
return defaultFloatProcessor(Option.getOrElse(input.input, () => ""), state)
|
|
2683
2681
|
}
|
|
2684
2682
|
}
|
|
2685
2683
|
}
|
|
@@ -2723,7 +2721,7 @@ const updateAutoCompleteState = <A>(
|
|
|
2723
2721
|
}
|
|
2724
2722
|
|
|
2725
2723
|
const autoCompleteCursor = (state: AutoCompleteState) =>
|
|
2726
|
-
Arr.findFirstIndex(state.filtered, (index) => index === state.index)
|
|
2724
|
+
Option.getOrElse(Arr.findFirstIndex(state.filtered, (index) => index === state.index), () => 0)
|
|
2727
2725
|
|
|
2728
2726
|
const renderSelectOutput = <A>(
|
|
2729
2727
|
leadingSymbol: string,
|
|
@@ -3089,7 +3087,7 @@ const handleAutoCompleteProcess = <A>(options: AutoCompleteOptionsReq<A>) => {
|
|
|
3089
3087
|
return Effect.succeed(Action.Submit({ value: selected.value }))
|
|
3090
3088
|
}
|
|
3091
3089
|
default: {
|
|
3092
|
-
return processAutoCompleteInput(input.input
|
|
3090
|
+
return processAutoCompleteInput(Option.getOrElse(input.input, () => ""), state, options)
|
|
3093
3091
|
}
|
|
3094
3092
|
}
|
|
3095
3093
|
}
|
|
@@ -3105,7 +3103,7 @@ interface TextOptionsReq extends Required<TextOptions> {
|
|
|
3105
3103
|
interface TextState {
|
|
3106
3104
|
readonly cursor: number
|
|
3107
3105
|
readonly value: string
|
|
3108
|
-
readonly error: string
|
|
3106
|
+
readonly error: Option.Option<string>
|
|
3109
3107
|
}
|
|
3110
3108
|
|
|
3111
3109
|
const renderClearScreen = Effect.fnUntraced(function*(state: TextState, options: TextOptionsReq) {
|
|
@@ -3143,7 +3141,7 @@ const renderTextInput = (
|
|
|
3143
3141
|
}
|
|
3144
3142
|
}
|
|
3145
3143
|
|
|
3146
|
-
const annotation = nextState.error
|
|
3144
|
+
const annotation = Option.isSome(nextState.error) ?
|
|
3147
3145
|
Ansi.red
|
|
3148
3146
|
: submitted ?
|
|
3149
3147
|
Ansi.white
|
|
@@ -3169,8 +3167,8 @@ const renderTextError = (
|
|
|
3169
3167
|
pointer: string,
|
|
3170
3168
|
renderOptions?: RenderOptions | undefined
|
|
3171
3169
|
): string => {
|
|
3172
|
-
if (nextState.error
|
|
3173
|
-
return Arr.match(nextState.error.split(NEWLINE_REGEXP), {
|
|
3170
|
+
if (Option.isSome(nextState.error)) {
|
|
3171
|
+
return Arr.match(nextState.error.value.split(NEWLINE_REGEXP), {
|
|
3174
3172
|
onEmpty: () => "",
|
|
3175
3173
|
onNonEmpty: (errorLines) => {
|
|
3176
3174
|
if (renderOptions?.plain === true) {
|
|
@@ -3225,7 +3223,7 @@ const processTextBackspace = (state: TextState) => {
|
|
|
3225
3223
|
const value = `${beforeCursor}${afterCursor}`
|
|
3226
3224
|
return Effect.succeed(
|
|
3227
3225
|
Action.NextFrame({
|
|
3228
|
-
state: { ...state, cursor, value, error:
|
|
3226
|
+
state: { ...state, cursor, value, error: Option.none() }
|
|
3229
3227
|
})
|
|
3230
3228
|
)
|
|
3231
3229
|
}
|
|
@@ -3233,7 +3231,7 @@ const processTextBackspace = (state: TextState) => {
|
|
|
3233
3231
|
const processTextClear = (state: TextState) =>
|
|
3234
3232
|
Effect.succeed(
|
|
3235
3233
|
Action.NextFrame({
|
|
3236
|
-
state: { ...state, cursor: 0, value: "", error:
|
|
3234
|
+
state: { ...state, cursor: 0, value: "", error: Option.none() }
|
|
3237
3235
|
})
|
|
3238
3236
|
)
|
|
3239
3237
|
|
|
@@ -3244,7 +3242,7 @@ const processTextCursorLeft = (state: TextState) => {
|
|
|
3244
3242
|
const cursor = state.cursor - 1
|
|
3245
3243
|
return Effect.succeed(
|
|
3246
3244
|
Action.NextFrame({
|
|
3247
|
-
state: { ...state, cursor, error:
|
|
3245
|
+
state: { ...state, cursor, error: Option.none() }
|
|
3248
3246
|
})
|
|
3249
3247
|
)
|
|
3250
3248
|
}
|
|
@@ -3256,7 +3254,7 @@ const processTextCursorRight = (state: TextState) => {
|
|
|
3256
3254
|
const cursor = Math.min(state.cursor + 1, state.value.length)
|
|
3257
3255
|
return Effect.succeed(
|
|
3258
3256
|
Action.NextFrame({
|
|
3259
|
-
state: { ...state, cursor, error:
|
|
3257
|
+
state: { ...state, cursor, error: Option.none() }
|
|
3260
3258
|
})
|
|
3261
3259
|
)
|
|
3262
3260
|
}
|
|
@@ -3268,7 +3266,7 @@ const processTab = (state: TextState, options: TextOptionsReq) => {
|
|
|
3268
3266
|
const value = state.value.length === 0 ? options.default : state.value
|
|
3269
3267
|
return Effect.succeed(
|
|
3270
3268
|
Action.NextFrame({
|
|
3271
|
-
state: { ...state, value, cursor: value.length, error:
|
|
3269
|
+
state: { ...state, value, cursor: value.length, error: Option.none() }
|
|
3272
3270
|
})
|
|
3273
3271
|
)
|
|
3274
3272
|
}
|
|
@@ -3280,7 +3278,7 @@ const defaultTextProcessor = (input: string, state: TextState) => {
|
|
|
3280
3278
|
const cursor = state.cursor + input.length
|
|
3281
3279
|
return Effect.succeed(
|
|
3282
3280
|
Action.NextFrame({
|
|
3283
|
-
state: { ...state, cursor, value, error:
|
|
3281
|
+
state: { ...state, cursor, value, error: Option.none() }
|
|
3284
3282
|
})
|
|
3285
3283
|
)
|
|
3286
3284
|
}
|
|
@@ -3316,7 +3314,7 @@ const handleTextProcess = (options: TextOptionsReq) => {
|
|
|
3316
3314
|
return Effect.match(options.validate(value), {
|
|
3317
3315
|
onFailure: (error) =>
|
|
3318
3316
|
Action.NextFrame({
|
|
3319
|
-
state: { ...state, value, error }
|
|
3317
|
+
state: { ...state, value, error: Option.some(error) }
|
|
3320
3318
|
}),
|
|
3321
3319
|
onSuccess: (value) => Action.Submit({ value })
|
|
3322
3320
|
})
|
|
@@ -3325,7 +3323,7 @@ const handleTextProcess = (options: TextOptionsReq) => {
|
|
|
3325
3323
|
return processTab(state, options)
|
|
3326
3324
|
}
|
|
3327
3325
|
default: {
|
|
3328
|
-
return defaultTextProcessor(input.input
|
|
3326
|
+
return defaultTextProcessor(Option.getOrElse(input.input, () => ""), state)
|
|
3329
3327
|
}
|
|
3330
3328
|
}
|
|
3331
3329
|
}
|
|
@@ -3351,7 +3349,7 @@ const basePrompt = (
|
|
|
3351
3349
|
const initialState: TextState = {
|
|
3352
3350
|
cursor: opts.default.length,
|
|
3353
3351
|
value: opts.default,
|
|
3354
|
-
error:
|
|
3352
|
+
error: Option.none()
|
|
3355
3353
|
}
|
|
3356
3354
|
return custom(initialState, {
|
|
3357
3355
|
render: handleTextRender(opts),
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
7
|
+
import * as Option from "../../../../Option.ts"
|
|
7
8
|
import type { Command } from "../../Command.ts"
|
|
8
9
|
import * as Param from "../../Param.ts"
|
|
9
10
|
import * as Primitive from "../../Primitive.ts"
|
|
@@ -135,7 +136,7 @@ export const fromCommand = (cmd: Command.Any): CommandDescriptor => {
|
|
|
135
136
|
flags.push({
|
|
136
137
|
name: single.name,
|
|
137
138
|
aliases: single.aliases,
|
|
138
|
-
description: single.description,
|
|
139
|
+
description: Option.getOrUndefined(single.description),
|
|
139
140
|
type: toFlagType(single as Param.Single<"flag", unknown>)
|
|
140
141
|
})
|
|
141
142
|
}
|
|
@@ -149,7 +150,7 @@ export const fromCommand = (cmd: Command.Any): CommandDescriptor => {
|
|
|
149
150
|
if (single.kind !== "argument") continue
|
|
150
151
|
args.push({
|
|
151
152
|
name: single.name,
|
|
152
|
-
description: single.description,
|
|
153
|
+
description: Option.getOrUndefined(single.description),
|
|
153
154
|
required: !metadata.isOptional,
|
|
154
155
|
variadic: metadata.isVariadic,
|
|
155
156
|
type: toArgumentType(single as Param.Single<"argument", unknown>)
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
* - Errors accumulate rather than throwing exceptions
|
|
26
26
|
*/
|
|
27
27
|
import * as Effect from "../../../Effect.ts"
|
|
28
|
+
import * as Option from "../../../Option.ts"
|
|
28
29
|
import * as CliError from "../CliError.ts"
|
|
29
30
|
import type { Command, ParsedTokens } from "../Command.ts"
|
|
30
31
|
import * as Param from "../Param.ts"
|
|
@@ -39,9 +40,10 @@ import type { LexResult, Token } from "./lexer.ts"
|
|
|
39
40
|
|
|
40
41
|
/** @internal */
|
|
41
42
|
export const getCommandPath = (parsedInput: ParsedTokens): ReadonlyArray<string> =>
|
|
42
|
-
parsedInput.subcommand
|
|
43
|
-
|
|
44
|
-
: []
|
|
43
|
+
Option.match(parsedInput.subcommand, {
|
|
44
|
+
onNone: () => [],
|
|
45
|
+
onSome: (subcommand) => [subcommand.name, ...getCommandPath(subcommand.parsedInput)]
|
|
46
|
+
})
|
|
45
47
|
|
|
46
48
|
/** @internal */
|
|
47
49
|
export const parseArgs = (
|
|
@@ -77,6 +79,7 @@ export const parseArgs = (
|
|
|
77
79
|
return {
|
|
78
80
|
flags: result.flags,
|
|
79
81
|
arguments: [...result.arguments, ...afterEndOfOptions],
|
|
82
|
+
subcommand: Option.none(),
|
|
80
83
|
...(result.errors.length > 0 && { errors: result.errors })
|
|
81
84
|
}
|
|
82
85
|
}
|
|
@@ -92,7 +95,7 @@ export const parseArgs = (
|
|
|
92
95
|
return {
|
|
93
96
|
flags: result.flags,
|
|
94
97
|
arguments: afterEndOfOptions,
|
|
95
|
-
subcommand: { name: result.sub.name, parsedInput: subParsed },
|
|
98
|
+
subcommand: Option.some({ name: result.sub.name, parsedInput: subParsed }),
|
|
96
99
|
...(allErrors.length > 0 && { errors: allErrors })
|
|
97
100
|
}
|
|
98
101
|
})
|