effect 4.0.0-beta.31 → 4.0.0-beta.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Array.d.ts +87 -86
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +47 -40
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +46 -45
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +35 -38
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts +39 -32
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +32 -29
- package/dist/BigInt.js.map +1 -1
- package/dist/Chunk.d.ts +58 -57
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +20 -21
- package/dist/Chunk.js.map +1 -1
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +4 -1
- package/dist/Config.js.map +1 -1
- package/dist/Cron.d.ts +3 -6
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +8 -15
- package/dist/Cron.js.map +1 -1
- package/dist/DateTime.d.ts +16 -15
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +8 -8
- package/dist/DateTime.js.map +1 -1
- package/dist/Deferred.d.ts +7 -5
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +7 -5
- package/dist/Deferred.js.map +1 -1
- package/dist/Duration.d.ts +26 -24
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +23 -22
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +3 -4
- package/dist/Effect.js.map +1 -1
- package/dist/Fiber.d.ts +2 -1
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.d.ts +9 -8
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +8 -7
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +20 -19
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +6 -6
- package/dist/FiberMap.js.map +1 -1
- package/dist/FileSystem.d.ts +17 -16
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +10 -7
- package/dist/FileSystem.js.map +1 -1
- package/dist/Graph.d.ts +64 -64
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +53 -53
- package/dist/Graph.js.map +1 -1
- package/dist/HashMap.d.ts +11 -5
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashMap.js +3 -1
- package/dist/HashMap.js.map +1 -1
- package/dist/Iterable.d.ts +11 -11
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +12 -12
- package/dist/Iterable.js.map +1 -1
- package/dist/Latch.d.ts +69 -3
- package/dist/Latch.d.ts.map +1 -1
- package/dist/Latch.js +58 -0
- package/dist/Latch.js.map +1 -1
- package/dist/Layer.d.ts +84 -0
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +27 -0
- package/dist/Layer.js.map +1 -1
- package/dist/Number.d.ts +74 -18
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +34 -15
- package/dist/Number.js.map +1 -1
- package/dist/Option.d.ts +2 -0
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js.map +1 -1
- package/dist/PartitionedSemaphore.d.ts +183 -0
- package/dist/PartitionedSemaphore.d.ts.map +1 -0
- package/dist/PartitionedSemaphore.js +231 -0
- package/dist/PartitionedSemaphore.js.map +1 -0
- package/dist/PubSub.d.ts +5 -4
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +6 -5
- package/dist/PubSub.js.map +1 -1
- package/dist/Queue.d.ts +3 -3
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +2 -2
- package/dist/Queue.js.map +1 -1
- package/dist/Record.d.ts +40 -40
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +16 -15
- package/dist/Record.js.map +1 -1
- package/dist/Scheduler.d.ts +25 -123
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +20 -123
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +30 -0
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +28 -1
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaGetter.js +6 -4
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +32 -27
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/Semaphore.d.ts +149 -53
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js +137 -117
- package/dist/Semaphore.js.map +1 -1
- package/dist/ServiceMap.d.ts +26 -0
- package/dist/ServiceMap.d.ts.map +1 -1
- package/dist/ServiceMap.js +36 -21
- package/dist/ServiceMap.js.map +1 -1
- package/dist/Stream.js +1 -1
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +114 -47
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +29 -47
- package/dist/String.js.map +1 -1
- package/dist/SubscriptionRef.d.ts +1 -2
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +81 -115
- package/dist/SubscriptionRef.js.map +1 -1
- package/dist/Terminal.d.ts +2 -1
- package/dist/Terminal.d.ts.map +1 -1
- package/dist/Terminal.js.map +1 -1
- package/dist/Tracer.d.ts +5 -4
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +2 -1
- package/dist/Tracer.js.map +1 -1
- package/dist/Trie.d.ts +26 -14
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Trie.js +8 -4
- package/dist/Trie.js.map +1 -1
- package/dist/TxHashMap.d.ts +77 -59
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js +25 -19
- package/dist/TxHashMap.js.map +1 -1
- package/dist/TxSemaphore.d.ts +162 -2
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +16 -2
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/index.d.ts +88 -32
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +88 -32
- package/dist/index.js.map +1 -1
- package/dist/internal/dateTime.js +9 -9
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/effect.js +20 -89
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/hashMap.js +2 -1
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/option.js +6 -0
- package/dist/internal/option.js.map +1 -1
- package/dist/internal/trie.js +3 -3
- package/dist/internal/trie.js.map +1 -1
- package/dist/unstable/ai/AiError.js +1 -1
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +4 -0
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +2 -2
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +4 -0
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +14 -0
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +13 -0
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/cli/Argument.d.ts +2 -4
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js +1 -3
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/CliOutput.d.ts +3 -2
- package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
- package/dist/unstable/cli/CliOutput.js +4 -3
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +3 -2
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +3 -3
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Flag.d.ts +2 -2
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js +1 -1
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/HelpDoc.d.ts +14 -12
- package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
- package/dist/unstable/cli/Param.d.ts +4 -4
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +7 -7
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +1 -1
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/Prompt.js +71 -67
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/internal/completions/CommandDescriptor.js +9 -2
- package/dist/unstable/cli/internal/completions/CommandDescriptor.js.map +1 -1
- package/dist/unstable/cli/internal/parser.js +8 -3
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +3 -2
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +25 -23
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +3 -2
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +7 -7
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +4 -3
- package/dist/unstable/cluster/Message.d.ts.map +1 -1
- package/dist/unstable/cluster/Message.js +3 -2
- package/dist/unstable/cluster/Message.js.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts +10 -10
- package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/MessageStorage.js +12 -12
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts +2 -1
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +4 -3
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.js +9 -8
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +2 -1
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +7 -6
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +19 -13
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +5 -4
- package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.js +4 -4
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +19 -18
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +9 -10
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.d.ts +2 -1
- package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.js +1 -4
- package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
- package/dist/unstable/http/Cookies.d.ts +5 -4
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +3 -4
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Etag.d.ts.map +1 -1
- package/dist/unstable/http/Etag.js +5 -1
- package/dist/unstable/http/Etag.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts +3 -2
- package/dist/unstable/http/Headers.d.ts.map +1 -1
- package/dist/unstable/http/Headers.js +2 -1
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +2 -1
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts +4 -3
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +8 -6
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientResponse.js +2 -1
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.d.ts +2 -1
- package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +16 -15
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
- package/dist/unstable/http/HttpPlatform.js +3 -2
- package/dist/unstable/http/HttpPlatform.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +2 -1
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js +7 -7
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpServer.js +2 -2
- package/dist/unstable/http/HttpServer.js.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +2 -1
- package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerError.js +2 -1
- package/dist/unstable/http/HttpServerError.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts +3 -2
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +14 -10
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +4 -3
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpTraceContext.d.ts +3 -2
- package/dist/unstable/http/HttpTraceContext.d.ts.map +1 -1
- package/dist/unstable/http/HttpTraceContext.js +27 -15
- package/dist/unstable/http/HttpTraceContext.js.map +1 -1
- package/dist/unstable/http/UrlParams.d.ts +5 -4
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +5 -6
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +4 -2
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +15 -0
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.js +81 -3
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +2 -2
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js +7 -3
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +1 -5
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +4 -2
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js +4 -3
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +4 -4
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSchema.js +3 -2
- package/dist/unstable/rpc/RpcSchema.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +4 -1
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +3 -2
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +2 -1
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +1 -1
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.js +6 -6
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +2 -1
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +5 -4
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +19 -14
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/package.json +1 -1
- package/src/Array.ts +112 -105
- package/src/BigDecimal.ts +63 -66
- package/src/BigInt.ts +49 -41
- package/src/Chunk.ts +68 -63
- package/src/Config.ts +4 -1
- package/src/Cron.ts +10 -15
- package/src/DateTime.ts +16 -15
- package/src/Deferred.ts +8 -6
- package/src/Duration.ts +34 -33
- package/src/Effect.ts +3 -4
- package/src/Fiber.ts +2 -1
- package/src/FiberHandle.ts +10 -9
- package/src/FiberMap.ts +22 -22
- package/src/FileSystem.ts +25 -22
- package/src/Graph.ts +105 -105
- package/src/HashMap.ts +11 -5
- package/src/Iterable.ts +13 -13
- package/src/Latch.ts +85 -3
- package/src/Layer.ts +121 -0
- package/src/Number.ts +85 -26
- package/src/Option.ts +2 -0
- package/src/PartitionedSemaphore.ts +414 -0
- package/src/PubSub.ts +7 -6
- package/src/Queue.ts +5 -5
- package/src/Record.ts +52 -47
- package/src/Scheduler.ts +37 -126
- package/src/Schema.ts +49 -1
- package/src/SchemaGetter.ts +4 -4
- package/src/SchemaTransformation.ts +27 -27
- package/src/Semaphore.ts +271 -183
- package/src/ServiceMap.ts +83 -31
- package/src/Stream.ts +1 -1
- package/src/String.ts +122 -69
- package/src/SubscriptionRef.ts +96 -117
- package/src/Terminal.ts +2 -1
- package/src/Tracer.ts +6 -5
- package/src/Trie.ts +26 -14
- package/src/TxHashMap.ts +78 -60
- package/src/TxSemaphore.ts +186 -11
- package/src/index.ts +89 -33
- package/src/internal/dateTime.ts +14 -14
- package/src/internal/effect.ts +29 -121
- package/src/internal/hashMap.ts +4 -3
- package/src/internal/option.ts +7 -0
- package/src/internal/trie.ts +6 -6
- package/src/unstable/ai/AiError.ts +1 -1
- package/src/unstable/ai/AnthropicStructuredOutput.ts +4 -0
- package/src/unstable/ai/Chat.ts +6 -2
- package/src/unstable/ai/OpenAiStructuredOutput.ts +4 -0
- package/src/unstable/ai/Tool.ts +20 -0
- package/src/unstable/cli/Argument.ts +2 -4
- package/src/unstable/cli/CliOutput.ts +7 -5
- package/src/unstable/cli/Command.ts +5 -5
- package/src/unstable/cli/Flag.ts +2 -2
- package/src/unstable/cli/HelpDoc.ts +14 -12
- package/src/unstable/cli/Param.ts +15 -11
- package/src/unstable/cli/Primitive.ts +1 -1
- package/src/unstable/cli/Prompt.ts +81 -83
- package/src/unstable/cli/internal/completions/CommandDescriptor.ts +3 -2
- package/src/unstable/cli/internal/parser.ts +7 -4
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +35 -30
- package/src/unstable/cluster/Entity.ts +13 -12
- package/src/unstable/cluster/Message.ts +6 -5
- package/src/unstable/cluster/MessageStorage.ts +26 -25
- package/src/unstable/cluster/Reply.ts +7 -4
- package/src/unstable/cluster/RunnerServer.ts +10 -13
- package/src/unstable/cluster/Runners.ts +8 -7
- package/src/unstable/cluster/Sharding.ts +24 -17
- package/src/unstable/cluster/ShardingConfig.ts +6 -6
- package/src/unstable/cluster/SqlMessageStorage.ts +21 -18
- package/src/unstable/cluster/internal/entityManager.ts +27 -21
- package/src/unstable/devtools/DevToolsSchema.ts +3 -2
- package/src/unstable/http/Cookies.ts +7 -8
- package/src/unstable/http/Etag.ts +5 -3
- package/src/unstable/http/Headers.ts +6 -5
- package/src/unstable/http/HttpClient.ts +2 -1
- package/src/unstable/http/HttpClientRequest.ts +11 -9
- package/src/unstable/http/HttpClientResponse.ts +3 -2
- package/src/unstable/http/HttpIncomingMessage.ts +2 -1
- package/src/unstable/http/HttpMiddleware.ts +16 -15
- package/src/unstable/http/HttpPlatform.ts +3 -2
- package/src/unstable/http/HttpRouter.ts +9 -9
- package/src/unstable/http/HttpServer.ts +3 -9
- package/src/unstable/http/HttpServerError.ts +3 -2
- package/src/unstable/http/HttpServerRequest.ts +25 -21
- package/src/unstable/http/HttpServerResponse.ts +5 -4
- package/src/unstable/http/HttpTraceContext.ts +31 -17
- package/src/unstable/http/UrlParams.ts +11 -14
- package/src/unstable/httpapi/HttpApiBuilder.ts +9 -3
- package/src/unstable/httpapi/HttpApiError.ts +67 -12
- package/src/unstable/observability/OtlpExporter.ts +5 -2
- package/src/unstable/observability/OtlpTracer.ts +8 -4
- package/src/unstable/reactivity/Atom.ts +1 -4
- package/src/unstable/reactivity/AtomRegistry.ts +5 -3
- package/src/unstable/rpc/Rpc.ts +4 -3
- package/src/unstable/rpc/RpcClient.ts +10 -9
- package/src/unstable/rpc/RpcSchema.ts +6 -5
- package/src/unstable/rpc/RpcSerialization.ts +4 -1
- package/src/unstable/rpc/RpcServer.ts +3 -3
- package/src/unstable/socket/Socket.ts +2 -1
- package/src/unstable/sql/SqlClient.ts +5 -3
- package/src/unstable/workflow/DurableDeferred.ts +6 -6
- package/src/unstable/workflow/Workflow.ts +1 -1
- package/src/unstable/workflow/WorkflowEngine.ts +29 -20
- package/dist/NullOr.d.ts +0 -149
- package/dist/NullOr.d.ts.map +0 -1
- package/dist/NullOr.js +0 -152
- package/dist/NullOr.js.map +0 -1
- package/src/NullOr.ts +0 -204
package/src/Graph.ts
CHANGED
|
@@ -65,7 +65,7 @@ export interface Proto<out N, out E> extends Iterable<readonly [NodeIndex, N]>,
|
|
|
65
65
|
readonly reverseAdjacency: Map<NodeIndex, Array<EdgeIndex>>
|
|
66
66
|
nextNodeIndex: NodeIndex
|
|
67
67
|
nextEdgeIndex: EdgeIndex
|
|
68
|
-
acyclic: boolean
|
|
68
|
+
acyclic: Option.Option<boolean>
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
/**
|
|
@@ -253,7 +253,7 @@ export const directed = <N, E>(mutate?: (mutable: MutableDirectedGraph<N, E>) =>
|
|
|
253
253
|
graph.reverseAdjacency = new Map()
|
|
254
254
|
graph.nextNodeIndex = 0
|
|
255
255
|
graph.nextEdgeIndex = 0
|
|
256
|
-
graph.acyclic = true
|
|
256
|
+
graph.acyclic = Option.some(true)
|
|
257
257
|
graph.mutable = false
|
|
258
258
|
|
|
259
259
|
if (mutate) {
|
|
@@ -294,7 +294,7 @@ export const undirected = <N, E>(mutate?: (mutable: MutableUndirectedGraph<N, E>
|
|
|
294
294
|
graph.reverseAdjacency = new Map()
|
|
295
295
|
graph.nextNodeIndex = 0
|
|
296
296
|
graph.nextEdgeIndex = 0
|
|
297
|
-
graph.acyclic = true
|
|
297
|
+
graph.acyclic = Option.some(true)
|
|
298
298
|
graph.mutable = false
|
|
299
299
|
|
|
300
300
|
if (mutate) {
|
|
@@ -685,10 +685,10 @@ export const nodeCount = <N, E, T extends Kind = "directed">(
|
|
|
685
685
|
* })
|
|
686
686
|
*
|
|
687
687
|
* const result = Graph.findNode(graph, (data) => data.startsWith("Node B"))
|
|
688
|
-
* console.log(result) // 1
|
|
688
|
+
* console.log(result) // Option.some(1)
|
|
689
689
|
*
|
|
690
690
|
* const notFound = Graph.findNode(graph, (data) => data === "Node D")
|
|
691
|
-
* console.log(notFound) //
|
|
691
|
+
* console.log(notFound) // Option.none()
|
|
692
692
|
* ```
|
|
693
693
|
*
|
|
694
694
|
* @since 4.0.0
|
|
@@ -709,16 +709,16 @@ export const findNode: {
|
|
|
709
709
|
* })
|
|
710
710
|
*
|
|
711
711
|
* const result = Graph.findNode(graph, (data) => data.startsWith("Node B"))
|
|
712
|
-
* console.log(result) // 1
|
|
712
|
+
* console.log(result) // Option.some(1)
|
|
713
713
|
*
|
|
714
714
|
* const notFound = Graph.findNode(graph, (data) => data === "Node D")
|
|
715
|
-
* console.log(notFound) //
|
|
715
|
+
* console.log(notFound) // Option.none()
|
|
716
716
|
* ```
|
|
717
717
|
*
|
|
718
718
|
* @since 4.0.0
|
|
719
719
|
* @category getters
|
|
720
720
|
*/
|
|
721
|
-
<N>(predicate: (data: N) => boolean): <E, T extends Kind = "directed">(graph: Graph<N, E, T> | MutableGraph<N, E, T>) => NodeIndex
|
|
721
|
+
<N>(predicate: (data: N) => boolean): <E, T extends Kind = "directed">(graph: Graph<N, E, T> | MutableGraph<N, E, T>) => Option.Option<NodeIndex>
|
|
722
722
|
/**
|
|
723
723
|
* Finds the first node that matches the given predicate.
|
|
724
724
|
*
|
|
@@ -733,10 +733,10 @@ export const findNode: {
|
|
|
733
733
|
* })
|
|
734
734
|
*
|
|
735
735
|
* const result = Graph.findNode(graph, (data) => data.startsWith("Node B"))
|
|
736
|
-
* console.log(result) // 1
|
|
736
|
+
* console.log(result) // Option.some(1)
|
|
737
737
|
*
|
|
738
738
|
* const notFound = Graph.findNode(graph, (data) => data === "Node D")
|
|
739
|
-
* console.log(notFound) //
|
|
739
|
+
* console.log(notFound) // Option.none()
|
|
740
740
|
* ```
|
|
741
741
|
*
|
|
742
742
|
* @since 4.0.0
|
|
@@ -745,16 +745,17 @@ export const findNode: {
|
|
|
745
745
|
<N, E, T extends Kind = "directed">(
|
|
746
746
|
graph: Graph<N, E, T> | MutableGraph<N, E, T>,
|
|
747
747
|
predicate: (data: N) => boolean
|
|
748
|
-
): NodeIndex
|
|
748
|
+
): Option.Option<NodeIndex>
|
|
749
749
|
} = dual(2, <N, E, T extends Kind = "directed">(
|
|
750
750
|
graph: Graph<N, E, T> | MutableGraph<N, E, T>,
|
|
751
751
|
predicate: (data: N) => boolean
|
|
752
|
-
): NodeIndex
|
|
752
|
+
): Option.Option<NodeIndex> => {
|
|
753
753
|
for (const [index, data] of graph.nodes) {
|
|
754
754
|
if (predicate(data)) {
|
|
755
|
-
return index
|
|
755
|
+
return Option.some(index)
|
|
756
756
|
}
|
|
757
757
|
}
|
|
758
|
+
return Option.none()
|
|
758
759
|
})
|
|
759
760
|
|
|
760
761
|
/**
|
|
@@ -861,10 +862,10 @@ export const findNodes: {
|
|
|
861
862
|
* })
|
|
862
863
|
*
|
|
863
864
|
* const result = Graph.findEdge(graph, (data) => data > 15)
|
|
864
|
-
* console.log(result) // 1
|
|
865
|
+
* console.log(result) // Option.some(1)
|
|
865
866
|
*
|
|
866
867
|
* const notFound = Graph.findEdge(graph, (data) => data > 100)
|
|
867
|
-
* console.log(notFound) //
|
|
868
|
+
* console.log(notFound) // Option.none()
|
|
868
869
|
* ```
|
|
869
870
|
*
|
|
870
871
|
* @since 4.0.0
|
|
@@ -887,16 +888,16 @@ export const findEdge: {
|
|
|
887
888
|
* })
|
|
888
889
|
*
|
|
889
890
|
* const result = Graph.findEdge(graph, (data) => data > 15)
|
|
890
|
-
* console.log(result) // 1
|
|
891
|
+
* console.log(result) // Option.some(1)
|
|
891
892
|
*
|
|
892
893
|
* const notFound = Graph.findEdge(graph, (data) => data > 100)
|
|
893
|
-
* console.log(notFound) //
|
|
894
|
+
* console.log(notFound) // Option.none()
|
|
894
895
|
* ```
|
|
895
896
|
*
|
|
896
897
|
* @since 4.0.0
|
|
897
898
|
* @category getters
|
|
898
899
|
*/
|
|
899
|
-
<E>(predicate: (data: E, source: NodeIndex, target: NodeIndex) => boolean): <N, T extends Kind = "directed">(graph: Graph<N, E, T> | MutableGraph<N, E, T>) => EdgeIndex
|
|
900
|
+
<E>(predicate: (data: E, source: NodeIndex, target: NodeIndex) => boolean): <N, T extends Kind = "directed">(graph: Graph<N, E, T> | MutableGraph<N, E, T>) => Option.Option<EdgeIndex>
|
|
900
901
|
/**
|
|
901
902
|
* Finds the first edge that matches the given predicate.
|
|
902
903
|
*
|
|
@@ -913,10 +914,10 @@ export const findEdge: {
|
|
|
913
914
|
* })
|
|
914
915
|
*
|
|
915
916
|
* const result = Graph.findEdge(graph, (data) => data > 15)
|
|
916
|
-
* console.log(result) // 1
|
|
917
|
+
* console.log(result) // Option.some(1)
|
|
917
918
|
*
|
|
918
919
|
* const notFound = Graph.findEdge(graph, (data) => data > 100)
|
|
919
|
-
* console.log(notFound) //
|
|
920
|
+
* console.log(notFound) // Option.none()
|
|
920
921
|
* ```
|
|
921
922
|
*
|
|
922
923
|
* @since 4.0.0
|
|
@@ -925,16 +926,17 @@ export const findEdge: {
|
|
|
925
926
|
<N, E, T extends Kind = "directed">(
|
|
926
927
|
graph: Graph<N, E, T> | MutableGraph<N, E, T>,
|
|
927
928
|
predicate: (data: E, source: NodeIndex, target: NodeIndex) => boolean
|
|
928
|
-
): EdgeIndex
|
|
929
|
+
): Option.Option<EdgeIndex>
|
|
929
930
|
} = dual(2, <N, E, T extends Kind = "directed">(
|
|
930
931
|
graph: Graph<N, E, T> | MutableGraph<N, E, T>,
|
|
931
932
|
predicate: (data: E, source: NodeIndex, target: NodeIndex) => boolean
|
|
932
|
-
): EdgeIndex
|
|
933
|
+
): Option.Option<EdgeIndex> => {
|
|
933
934
|
for (const [edgeIndex, edgeData] of graph.edges) {
|
|
934
935
|
if (predicate(edgeData.data, edgeData.source, edgeData.target)) {
|
|
935
|
-
return edgeIndex
|
|
936
|
+
return Option.some(edgeIndex)
|
|
936
937
|
}
|
|
937
938
|
}
|
|
939
|
+
return Option.none()
|
|
938
940
|
})
|
|
939
941
|
|
|
940
942
|
/**
|
|
@@ -1228,7 +1230,7 @@ export const reverse = <N, E, T extends Kind = "directed">(
|
|
|
1228
1230
|
}
|
|
1229
1231
|
|
|
1230
1232
|
// Invalidate cycle flag since edge directions changed
|
|
1231
|
-
mutable.acyclic =
|
|
1233
|
+
mutable.acyclic = Option.none()
|
|
1232
1234
|
}
|
|
1233
1235
|
|
|
1234
1236
|
/**
|
|
@@ -1439,10 +1441,9 @@ export const filterEdges = <N, E, T extends Kind = "directed">(
|
|
|
1439
1441
|
const invalidateCycleFlagOnRemoval = <N, E, T extends Kind = "directed">(
|
|
1440
1442
|
mutable: MutableGraph<N, E, T>
|
|
1441
1443
|
): void => {
|
|
1442
|
-
// Only invalidate if the graph had cycles (removing edges/nodes cannot introduce cycles in acyclic graphs)
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
mutable.acyclic = undefined
|
|
1444
|
+
// Only invalidate if the graph had cycles (removing edges/nodes cannot introduce cycles in acyclic graphs).
|
|
1445
|
+
if (mutable.acyclic._tag === "Some" && mutable.acyclic.value === false) {
|
|
1446
|
+
mutable.acyclic = Option.none()
|
|
1446
1447
|
}
|
|
1447
1448
|
}
|
|
1448
1449
|
|
|
@@ -1450,10 +1451,9 @@ const invalidateCycleFlagOnRemoval = <N, E, T extends Kind = "directed">(
|
|
|
1450
1451
|
const invalidateCycleFlagOnAddition = <N, E, T extends Kind = "directed">(
|
|
1451
1452
|
mutable: MutableGraph<N, E, T>
|
|
1452
1453
|
): void => {
|
|
1453
|
-
// Only invalidate if the graph was acyclic (adding edges cannot remove cycles from cyclic graphs)
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
mutable.acyclic = undefined
|
|
1454
|
+
// Only invalidate if the graph was acyclic (adding edges cannot remove cycles from cyclic graphs).
|
|
1455
|
+
if (mutable.acyclic._tag === "Some" && mutable.acyclic.value === true) {
|
|
1456
|
+
mutable.acyclic = Option.none()
|
|
1457
1457
|
}
|
|
1458
1458
|
}
|
|
1459
1459
|
|
|
@@ -1704,10 +1704,10 @@ const removeEdgeInternal = <N, E, T extends Kind = "directed">(
|
|
|
1704
1704
|
* const edgeIndex = 0
|
|
1705
1705
|
* const edgeData = Graph.getEdge(graph, edgeIndex)
|
|
1706
1706
|
*
|
|
1707
|
-
* if (edgeData
|
|
1708
|
-
* console.log(edgeData.data) // 42
|
|
1709
|
-
* console.log(edgeData.source) // NodeIndex(0)
|
|
1710
|
-
* console.log(edgeData.target) // NodeIndex(1)
|
|
1707
|
+
* if (edgeData._tag === "Some") {
|
|
1708
|
+
* console.log(edgeData.value.data) // 42
|
|
1709
|
+
* console.log(edgeData.value.source) // NodeIndex(0)
|
|
1710
|
+
* console.log(edgeData.value.target) // NodeIndex(1)
|
|
1711
1711
|
* }
|
|
1712
1712
|
* ```
|
|
1713
1713
|
*
|
|
@@ -1735,17 +1735,17 @@ export const getEdge: {
|
|
|
1735
1735
|
* const edgeIndex = 0
|
|
1736
1736
|
* const edgeData = Graph.getEdge(graph, edgeIndex)
|
|
1737
1737
|
*
|
|
1738
|
-
* if (edgeData
|
|
1739
|
-
* console.log(edgeData.data) // 42
|
|
1740
|
-
* console.log(edgeData.source) // NodeIndex(0)
|
|
1741
|
-
* console.log(edgeData.target) // NodeIndex(1)
|
|
1738
|
+
* if (edgeData._tag === "Some") {
|
|
1739
|
+
* console.log(edgeData.value.data) // 42
|
|
1740
|
+
* console.log(edgeData.value.source) // NodeIndex(0)
|
|
1741
|
+
* console.log(edgeData.value.target) // NodeIndex(1)
|
|
1742
1742
|
* }
|
|
1743
1743
|
* ```
|
|
1744
1744
|
*
|
|
1745
1745
|
* @since 4.0.0
|
|
1746
1746
|
* @category getters
|
|
1747
1747
|
*/
|
|
1748
|
-
<E>(edgeIndex: EdgeIndex): <N, T extends Kind = "directed">(graph: Graph<N, E, T> | MutableGraph<N, E, T>) => Edge<E
|
|
1748
|
+
<E>(edgeIndex: EdgeIndex): <N, T extends Kind = "directed">(graph: Graph<N, E, T> | MutableGraph<N, E, T>) => Option.Option<Edge<E>>
|
|
1749
1749
|
// =============================================================================
|
|
1750
1750
|
// Edge Query Operations
|
|
1751
1751
|
// =============================================================================
|
|
@@ -1766,21 +1766,21 @@ export const getEdge: {
|
|
|
1766
1766
|
* const edgeIndex = 0
|
|
1767
1767
|
* const edgeData = Graph.getEdge(graph, edgeIndex)
|
|
1768
1768
|
*
|
|
1769
|
-
* if (edgeData
|
|
1770
|
-
* console.log(edgeData.data) // 42
|
|
1771
|
-
* console.log(edgeData.source) // NodeIndex(0)
|
|
1772
|
-
* console.log(edgeData.target) // NodeIndex(1)
|
|
1769
|
+
* if (edgeData._tag === "Some") {
|
|
1770
|
+
* console.log(edgeData.value.data) // 42
|
|
1771
|
+
* console.log(edgeData.value.source) // NodeIndex(0)
|
|
1772
|
+
* console.log(edgeData.value.target) // NodeIndex(1)
|
|
1773
1773
|
* }
|
|
1774
1774
|
* ```
|
|
1775
1775
|
*
|
|
1776
1776
|
* @since 4.0.0
|
|
1777
1777
|
* @category getters
|
|
1778
1778
|
*/
|
|
1779
|
-
<N, E, T extends Kind = "directed">(graph: Graph<N, E, T> | MutableGraph<N, E, T>, edgeIndex: EdgeIndex): Edge<E
|
|
1779
|
+
<N, E, T extends Kind = "directed">(graph: Graph<N, E, T> | MutableGraph<N, E, T>, edgeIndex: EdgeIndex): Option.Option<Edge<E>>
|
|
1780
1780
|
} = dual(2, <N, E, T extends Kind = "directed">(
|
|
1781
1781
|
graph: Graph<N, E, T> | MutableGraph<N, E, T>,
|
|
1782
1782
|
edgeIndex: EdgeIndex
|
|
1783
|
-
): Edge<E
|
|
1783
|
+
): Option.Option<Edge<E>> => Option.fromUndefinedOr(graph.edges.get(edgeIndex)))
|
|
1784
1784
|
|
|
1785
1785
|
/**
|
|
1786
1786
|
* Checks if an edge exists between two nodes in the graph.
|
|
@@ -3237,8 +3237,8 @@ export const isAcyclic = <N, E, T extends Kind = "directed">(
|
|
|
3237
3237
|
graph: Graph<N, E, T> | MutableGraph<N, E, T>
|
|
3238
3238
|
): boolean => {
|
|
3239
3239
|
// Use existing cycle flag if available
|
|
3240
|
-
if (graph.acyclic
|
|
3241
|
-
return graph.acyclic
|
|
3240
|
+
if (Option.isSome(graph.acyclic)) {
|
|
3241
|
+
return graph.acyclic.value
|
|
3242
3242
|
}
|
|
3243
3243
|
|
|
3244
3244
|
// Stack-safe DFS cycle detection using iterative approach
|
|
@@ -3264,7 +3264,7 @@ export const isAcyclic = <N, E, T extends Kind = "directed">(
|
|
|
3264
3264
|
if (isFirstVisit) {
|
|
3265
3265
|
if (recursionStack.has(node)) {
|
|
3266
3266
|
// Back edge found - cycle detected
|
|
3267
|
-
graph.acyclic = false
|
|
3267
|
+
graph.acyclic = Option.some(false)
|
|
3268
3268
|
return false
|
|
3269
3269
|
}
|
|
3270
3270
|
|
|
@@ -3289,7 +3289,7 @@ export const isAcyclic = <N, E, T extends Kind = "directed">(
|
|
|
3289
3289
|
|
|
3290
3290
|
if (recursionStack.has(neighbor)) {
|
|
3291
3291
|
// Back edge found - cycle detected
|
|
3292
|
-
graph.acyclic = false
|
|
3292
|
+
graph.acyclic = Option.some(false)
|
|
3293
3293
|
return false
|
|
3294
3294
|
}
|
|
3295
3295
|
|
|
@@ -3305,7 +3305,7 @@ export const isAcyclic = <N, E, T extends Kind = "directed">(
|
|
|
3305
3305
|
}
|
|
3306
3306
|
|
|
3307
3307
|
// Cache the result
|
|
3308
|
-
graph.acyclic = true
|
|
3308
|
+
graph.acyclic = Option.some(true)
|
|
3309
3309
|
return true
|
|
3310
3310
|
}
|
|
3311
3311
|
|
|
@@ -3649,9 +3649,9 @@ export interface DijkstraConfig<E> {
|
|
|
3649
3649
|
* cost: (edgeData) => edgeData
|
|
3650
3650
|
* })
|
|
3651
3651
|
*
|
|
3652
|
-
* if (result
|
|
3653
|
-
* console.log(result.path) // [0, 1, 2] - shortest path A->B->C
|
|
3654
|
-
* console.log(result.distance) // 7 - total distance
|
|
3652
|
+
* if (result._tag === "Some") {
|
|
3653
|
+
* console.log(result.value.path) // [0, 1, 2] - shortest path A->B->C
|
|
3654
|
+
* console.log(result.value.distance) // 7 - total distance
|
|
3655
3655
|
* }
|
|
3656
3656
|
* ```
|
|
3657
3657
|
*
|
|
@@ -3684,16 +3684,16 @@ export const dijkstra: {
|
|
|
3684
3684
|
* cost: (edgeData) => edgeData
|
|
3685
3685
|
* })
|
|
3686
3686
|
*
|
|
3687
|
-
* if (result
|
|
3688
|
-
* console.log(result.path) // [0, 1, 2] - shortest path A->B->C
|
|
3689
|
-
* console.log(result.distance) // 7 - total distance
|
|
3687
|
+
* if (result._tag === "Some") {
|
|
3688
|
+
* console.log(result.value.path) // [0, 1, 2] - shortest path A->B->C
|
|
3689
|
+
* console.log(result.value.distance) // 7 - total distance
|
|
3690
3690
|
* }
|
|
3691
3691
|
* ```
|
|
3692
3692
|
*
|
|
3693
3693
|
* @since 4.0.0
|
|
3694
3694
|
* @category algorithms
|
|
3695
3695
|
*/
|
|
3696
|
-
<E>(config: DijkstraConfig<E>): <N, T extends Kind = "directed">(graph: Graph<N, E, T> | MutableGraph<N, E, T>) => PathResult<E
|
|
3696
|
+
<E>(config: DijkstraConfig<E>): <N, T extends Kind = "directed">(graph: Graph<N, E, T> | MutableGraph<N, E, T>) => Option.Option<PathResult<E>>
|
|
3697
3697
|
/**
|
|
3698
3698
|
* Find the shortest path between two nodes using Dijkstra's algorithm.
|
|
3699
3699
|
*
|
|
@@ -3719,20 +3719,20 @@ export const dijkstra: {
|
|
|
3719
3719
|
* cost: (edgeData) => edgeData
|
|
3720
3720
|
* })
|
|
3721
3721
|
*
|
|
3722
|
-
* if (result
|
|
3723
|
-
* console.log(result.path) // [0, 1, 2] - shortest path A->B->C
|
|
3724
|
-
* console.log(result.distance) // 7 - total distance
|
|
3722
|
+
* if (result._tag === "Some") {
|
|
3723
|
+
* console.log(result.value.path) // [0, 1, 2] - shortest path A->B->C
|
|
3724
|
+
* console.log(result.value.distance) // 7 - total distance
|
|
3725
3725
|
* }
|
|
3726
3726
|
* ```
|
|
3727
3727
|
*
|
|
3728
3728
|
* @since 4.0.0
|
|
3729
3729
|
* @category algorithms
|
|
3730
3730
|
*/
|
|
3731
|
-
<N, E, T extends Kind = "directed">(graph: Graph<N, E, T> | MutableGraph<N, E, T>, config: DijkstraConfig<E>): PathResult<E
|
|
3731
|
+
<N, E, T extends Kind = "directed">(graph: Graph<N, E, T> | MutableGraph<N, E, T>, config: DijkstraConfig<E>): Option.Option<PathResult<E>>
|
|
3732
3732
|
} = dual(2, <N, E, T extends Kind = "directed">(
|
|
3733
3733
|
graph: Graph<N, E, T> | MutableGraph<N, E, T>,
|
|
3734
3734
|
config: DijkstraConfig<E>
|
|
3735
|
-
): PathResult<E
|
|
3735
|
+
): Option.Option<PathResult<E>> => {
|
|
3736
3736
|
// Validate that source and target nodes exist
|
|
3737
3737
|
if (!graph.nodes.has(config.source)) {
|
|
3738
3738
|
throw missingNode(config.source)
|
|
@@ -3743,11 +3743,11 @@ export const dijkstra: {
|
|
|
3743
3743
|
|
|
3744
3744
|
// Early return if source equals target
|
|
3745
3745
|
if (config.source === config.target) {
|
|
3746
|
-
return {
|
|
3746
|
+
return Option.some({
|
|
3747
3747
|
path: [config.source],
|
|
3748
3748
|
distance: 0,
|
|
3749
3749
|
costs: []
|
|
3750
|
-
}
|
|
3750
|
+
})
|
|
3751
3751
|
}
|
|
3752
3752
|
|
|
3753
3753
|
// Distance tracking and priority queue simulation
|
|
@@ -3829,7 +3829,7 @@ export const dijkstra: {
|
|
|
3829
3829
|
// Check if target is reachable
|
|
3830
3830
|
const distance = distances.get(config.target)!
|
|
3831
3831
|
if (distance === Infinity) {
|
|
3832
|
-
return
|
|
3832
|
+
return Option.none() // No path exists
|
|
3833
3833
|
}
|
|
3834
3834
|
|
|
3835
3835
|
// Reconstruct path
|
|
@@ -3848,11 +3848,11 @@ export const dijkstra: {
|
|
|
3848
3848
|
}
|
|
3849
3849
|
}
|
|
3850
3850
|
|
|
3851
|
-
return {
|
|
3851
|
+
return Option.some({
|
|
3852
3852
|
path,
|
|
3853
3853
|
distance,
|
|
3854
3854
|
costs
|
|
3855
|
-
}
|
|
3855
|
+
})
|
|
3856
3856
|
})
|
|
3857
3857
|
|
|
3858
3858
|
/**
|
|
@@ -4116,9 +4116,9 @@ export interface AstarConfig<E, N> {
|
|
|
4116
4116
|
* heuristic
|
|
4117
4117
|
* })
|
|
4118
4118
|
*
|
|
4119
|
-
* if (result
|
|
4120
|
-
* console.log(result.path) // [0, 1, 2] - shortest path
|
|
4121
|
-
* console.log(result.distance) // 2 - total distance
|
|
4119
|
+
* if (result._tag === "Some") {
|
|
4120
|
+
* console.log(result.value.path) // [0, 1, 2] - shortest path
|
|
4121
|
+
* console.log(result.value.distance) // 2 - total distance
|
|
4122
4122
|
* }
|
|
4123
4123
|
* ```
|
|
4124
4124
|
*
|
|
@@ -4158,16 +4158,16 @@ export const astar: {
|
|
|
4158
4158
|
* heuristic
|
|
4159
4159
|
* })
|
|
4160
4160
|
*
|
|
4161
|
-
* if (result
|
|
4162
|
-
* console.log(result.path) // [0, 1, 2] - shortest path
|
|
4163
|
-
* console.log(result.distance) // 2 - total distance
|
|
4161
|
+
* if (result._tag === "Some") {
|
|
4162
|
+
* console.log(result.value.path) // [0, 1, 2] - shortest path
|
|
4163
|
+
* console.log(result.value.distance) // 2 - total distance
|
|
4164
4164
|
* }
|
|
4165
4165
|
* ```
|
|
4166
4166
|
*
|
|
4167
4167
|
* @since 4.0.0
|
|
4168
4168
|
* @category algorithms
|
|
4169
4169
|
*/
|
|
4170
|
-
<E, N>(config: AstarConfig<E, N>): <T extends Kind = "directed">(graph: Graph<N, E, T> | MutableGraph<N, E, T>) => PathResult<E
|
|
4170
|
+
<E, N>(config: AstarConfig<E, N>): <T extends Kind = "directed">(graph: Graph<N, E, T> | MutableGraph<N, E, T>) => Option.Option<PathResult<E>>
|
|
4171
4171
|
/**
|
|
4172
4172
|
* Find the shortest path between two nodes using A* pathfinding algorithm.
|
|
4173
4173
|
*
|
|
@@ -4200,20 +4200,20 @@ export const astar: {
|
|
|
4200
4200
|
* heuristic
|
|
4201
4201
|
* })
|
|
4202
4202
|
*
|
|
4203
|
-
* if (result
|
|
4204
|
-
* console.log(result.path) // [0, 1, 2] - shortest path
|
|
4205
|
-
* console.log(result.distance) // 2 - total distance
|
|
4203
|
+
* if (result._tag === "Some") {
|
|
4204
|
+
* console.log(result.value.path) // [0, 1, 2] - shortest path
|
|
4205
|
+
* console.log(result.value.distance) // 2 - total distance
|
|
4206
4206
|
* }
|
|
4207
4207
|
* ```
|
|
4208
4208
|
*
|
|
4209
4209
|
* @since 4.0.0
|
|
4210
4210
|
* @category algorithms
|
|
4211
4211
|
*/
|
|
4212
|
-
<N, E, T extends Kind = "directed">(graph: Graph<N, E, T> | MutableGraph<N, E, T>, config: AstarConfig<E, N>): PathResult<E
|
|
4212
|
+
<N, E, T extends Kind = "directed">(graph: Graph<N, E, T> | MutableGraph<N, E, T>, config: AstarConfig<E, N>): Option.Option<PathResult<E>>
|
|
4213
4213
|
} = dual(2, <N, E, T extends Kind = "directed">(
|
|
4214
4214
|
graph: Graph<N, E, T> | MutableGraph<N, E, T>,
|
|
4215
4215
|
config: AstarConfig<E, N>
|
|
4216
|
-
): PathResult<E
|
|
4216
|
+
): Option.Option<PathResult<E>> => {
|
|
4217
4217
|
// Validate that source and target nodes exist
|
|
4218
4218
|
if (!graph.nodes.has(config.source)) {
|
|
4219
4219
|
throw missingNode(config.source)
|
|
@@ -4224,11 +4224,11 @@ export const astar: {
|
|
|
4224
4224
|
|
|
4225
4225
|
// Early return if source equals target
|
|
4226
4226
|
if (config.source === config.target) {
|
|
4227
|
-
return {
|
|
4227
|
+
return Option.some({
|
|
4228
4228
|
path: [config.source],
|
|
4229
4229
|
distance: 0,
|
|
4230
4230
|
costs: []
|
|
4231
|
-
}
|
|
4231
|
+
})
|
|
4232
4232
|
}
|
|
4233
4233
|
|
|
4234
4234
|
// Get target node data for heuristic calculations
|
|
@@ -4334,7 +4334,7 @@ export const astar: {
|
|
|
4334
4334
|
// Check if target is reachable
|
|
4335
4335
|
const distance = gScore.get(config.target)!
|
|
4336
4336
|
if (distance === Infinity) {
|
|
4337
|
-
return
|
|
4337
|
+
return Option.none() // No path exists
|
|
4338
4338
|
}
|
|
4339
4339
|
|
|
4340
4340
|
// Reconstruct path
|
|
@@ -4353,11 +4353,11 @@ export const astar: {
|
|
|
4353
4353
|
}
|
|
4354
4354
|
}
|
|
4355
4355
|
|
|
4356
|
-
return {
|
|
4356
|
+
return Option.some({
|
|
4357
4357
|
path,
|
|
4358
4358
|
distance,
|
|
4359
4359
|
costs
|
|
4360
|
-
}
|
|
4360
|
+
})
|
|
4361
4361
|
})
|
|
4362
4362
|
|
|
4363
4363
|
/**
|
|
@@ -4398,9 +4398,9 @@ export interface BellmanFordConfig<E> {
|
|
|
4398
4398
|
* cost: (edgeData) => edgeData
|
|
4399
4399
|
* })
|
|
4400
4400
|
*
|
|
4401
|
-
* if (result
|
|
4402
|
-
* console.log(result.path) // [0, 1, 2] - shortest path A->B->C
|
|
4403
|
-
* console.log(result.distance) // 2 - total distance
|
|
4401
|
+
* if (result._tag === "Some") {
|
|
4402
|
+
* console.log(result.value.path) // [0, 1, 2] - shortest path A->B->C
|
|
4403
|
+
* console.log(result.value.distance) // 2 - total distance
|
|
4404
4404
|
* }
|
|
4405
4405
|
* ```
|
|
4406
4406
|
*
|
|
@@ -4434,16 +4434,16 @@ export const bellmanFord: {
|
|
|
4434
4434
|
* cost: (edgeData) => edgeData
|
|
4435
4435
|
* })
|
|
4436
4436
|
*
|
|
4437
|
-
* if (result
|
|
4438
|
-
* console.log(result.path) // [0, 1, 2] - shortest path A->B->C
|
|
4439
|
-
* console.log(result.distance) // 2 - total distance
|
|
4437
|
+
* if (result._tag === "Some") {
|
|
4438
|
+
* console.log(result.value.path) // [0, 1, 2] - shortest path A->B->C
|
|
4439
|
+
* console.log(result.value.distance) // 2 - total distance
|
|
4440
4440
|
* }
|
|
4441
4441
|
* ```
|
|
4442
4442
|
*
|
|
4443
4443
|
* @since 4.0.0
|
|
4444
4444
|
* @category algorithms
|
|
4445
4445
|
*/
|
|
4446
|
-
<E>(config: BellmanFordConfig<E>): <N, T extends Kind = "directed">(graph: Graph<N, E, T> | MutableGraph<N, E, T>) => PathResult<E
|
|
4446
|
+
<E>(config: BellmanFordConfig<E>): <N, T extends Kind = "directed">(graph: Graph<N, E, T> | MutableGraph<N, E, T>) => Option.Option<PathResult<E>>
|
|
4447
4447
|
/**
|
|
4448
4448
|
* Find the shortest path between two nodes using Bellman-Ford algorithm.
|
|
4449
4449
|
*
|
|
@@ -4470,9 +4470,9 @@ export const bellmanFord: {
|
|
|
4470
4470
|
* cost: (edgeData) => edgeData
|
|
4471
4471
|
* })
|
|
4472
4472
|
*
|
|
4473
|
-
* if (result
|
|
4474
|
-
* console.log(result.path) // [0, 1, 2] - shortest path A->B->C
|
|
4475
|
-
* console.log(result.distance) // 2 - total distance
|
|
4473
|
+
* if (result._tag === "Some") {
|
|
4474
|
+
* console.log(result.value.path) // [0, 1, 2] - shortest path A->B->C
|
|
4475
|
+
* console.log(result.value.distance) // 2 - total distance
|
|
4476
4476
|
* }
|
|
4477
4477
|
* ```
|
|
4478
4478
|
*
|
|
@@ -4482,11 +4482,11 @@ export const bellmanFord: {
|
|
|
4482
4482
|
<N, E, T extends Kind = "directed">(
|
|
4483
4483
|
graph: Graph<N, E, T> | MutableGraph<N, E, T>,
|
|
4484
4484
|
config: BellmanFordConfig<E>
|
|
4485
|
-
): PathResult<E
|
|
4485
|
+
): Option.Option<PathResult<E>>
|
|
4486
4486
|
} = dual(2, <N, E, T extends Kind = "directed">(
|
|
4487
4487
|
graph: Graph<N, E, T> | MutableGraph<N, E, T>,
|
|
4488
4488
|
config: BellmanFordConfig<E>
|
|
4489
|
-
): PathResult<E
|
|
4489
|
+
): Option.Option<PathResult<E>> => {
|
|
4490
4490
|
// Validate that source and target nodes exist
|
|
4491
4491
|
if (!graph.nodes.has(config.source)) {
|
|
4492
4492
|
throw missingNode(config.source)
|
|
@@ -4497,11 +4497,11 @@ export const bellmanFord: {
|
|
|
4497
4497
|
|
|
4498
4498
|
// Early return if source equals target
|
|
4499
4499
|
if (config.source === config.target) {
|
|
4500
|
-
return {
|
|
4500
|
+
return Option.some({
|
|
4501
4501
|
path: [config.source],
|
|
4502
4502
|
distance: 0,
|
|
4503
4503
|
costs: []
|
|
4504
|
-
}
|
|
4504
|
+
})
|
|
4505
4505
|
}
|
|
4506
4506
|
|
|
4507
4507
|
// Initialize distances and predecessors
|
|
@@ -4576,9 +4576,9 @@ export const bellmanFord: {
|
|
|
4576
4576
|
}
|
|
4577
4577
|
}
|
|
4578
4578
|
|
|
4579
|
-
// If target is affected by negative cycle,
|
|
4579
|
+
// If target is affected by a negative cycle, no shortest path exists.
|
|
4580
4580
|
if (affectedNodes.has(config.target)) {
|
|
4581
|
-
return
|
|
4581
|
+
return Option.none()
|
|
4582
4582
|
}
|
|
4583
4583
|
}
|
|
4584
4584
|
}
|
|
@@ -4586,7 +4586,7 @@ export const bellmanFord: {
|
|
|
4586
4586
|
// Check if target is reachable
|
|
4587
4587
|
const distance = distances.get(config.target)!
|
|
4588
4588
|
if (distance === Infinity) {
|
|
4589
|
-
return
|
|
4589
|
+
return Option.none() // No path exists
|
|
4590
4590
|
}
|
|
4591
4591
|
|
|
4592
4592
|
// Reconstruct path
|
|
@@ -4605,11 +4605,11 @@ export const bellmanFord: {
|
|
|
4605
4605
|
}
|
|
4606
4606
|
}
|
|
4607
4607
|
|
|
4608
|
-
return {
|
|
4608
|
+
return Option.some({
|
|
4609
4609
|
path,
|
|
4610
4610
|
distance,
|
|
4611
4611
|
costs
|
|
4612
|
-
}
|
|
4612
|
+
})
|
|
4613
4613
|
})
|
|
4614
4614
|
|
|
4615
4615
|
/**
|
package/src/HashMap.ts
CHANGED
|
@@ -2092,10 +2092,12 @@ export const filterMap: {
|
|
|
2092
2092
|
* @example
|
|
2093
2093
|
* ```ts
|
|
2094
2094
|
* import * as HashMap from "effect/HashMap"
|
|
2095
|
+
* import * as Option from "effect/Option"
|
|
2095
2096
|
*
|
|
2096
2097
|
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
|
2097
2098
|
* const result = HashMap.findFirst(map, (value) => value > 1)
|
|
2098
|
-
* console.log(result) // [
|
|
2099
|
+
* console.log(result) // Option.some(["c", 3])
|
|
2100
|
+
* console.log(Option.getOrElse(result, () => ["", 0])) // ["c", 3]
|
|
2099
2101
|
* ```
|
|
2100
2102
|
*
|
|
2101
2103
|
* @category elements
|
|
@@ -2109,16 +2111,18 @@ export const findFirst: {
|
|
|
2109
2111
|
* @example
|
|
2110
2112
|
* ```ts
|
|
2111
2113
|
* import * as HashMap from "effect/HashMap"
|
|
2114
|
+
* import * as Option from "effect/Option"
|
|
2112
2115
|
*
|
|
2113
2116
|
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
|
2114
2117
|
* const result = HashMap.findFirst(map, (value) => value > 1)
|
|
2115
|
-
* console.log(result) // [
|
|
2118
|
+
* console.log(result) // Option.some(["c", 3])
|
|
2119
|
+
* console.log(Option.getOrElse(result, () => ["", 0])) // ["c", 3]
|
|
2116
2120
|
* ```
|
|
2117
2121
|
*
|
|
2118
2122
|
* @category elements
|
|
2119
2123
|
* @since 2.0.0
|
|
2120
2124
|
*/
|
|
2121
|
-
<K, A>(predicate: (a: NoInfer<A>, k: K) => boolean): (self: HashMap<K, A>) => [K, A]
|
|
2125
|
+
<K, A>(predicate: (a: NoInfer<A>, k: K) => boolean): (self: HashMap<K, A>) => Option<[K, A]>
|
|
2122
2126
|
/**
|
|
2123
2127
|
* Returns the first element that satisfies the specified
|
|
2124
2128
|
* predicate, or `None` if no such element exists.
|
|
@@ -2126,16 +2130,18 @@ export const findFirst: {
|
|
|
2126
2130
|
* @example
|
|
2127
2131
|
* ```ts
|
|
2128
2132
|
* import * as HashMap from "effect/HashMap"
|
|
2133
|
+
* import * as Option from "effect/Option"
|
|
2129
2134
|
*
|
|
2130
2135
|
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
|
2131
2136
|
* const result = HashMap.findFirst(map, (value) => value > 1)
|
|
2132
|
-
* console.log(result) // [
|
|
2137
|
+
* console.log(result) // Option.some(["c", 3])
|
|
2138
|
+
* console.log(Option.getOrElse(result, () => ["", 0])) // ["c", 3]
|
|
2133
2139
|
* ```
|
|
2134
2140
|
*
|
|
2135
2141
|
* @category elements
|
|
2136
2142
|
* @since 2.0.0
|
|
2137
2143
|
*/
|
|
2138
|
-
<K, A>(self: HashMap<K, A>, predicate: (a: A, k: K) => boolean): [K, A]
|
|
2144
|
+
<K, A>(self: HashMap<K, A>, predicate: (a: A, k: K) => boolean): Option<[K, A]>
|
|
2139
2145
|
} = internal.findFirst
|
|
2140
2146
|
|
|
2141
2147
|
/**
|