effect 4.0.0-beta.31 → 4.0.0-beta.33
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 +7 -3
- 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 +4 -4
- 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/LanguageModel.d.ts +8 -0
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +112 -11
- 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/ResponseIdTracker.d.ts +38 -0
- package/dist/unstable/ai/ResponseIdTracker.d.ts.map +1 -0
- package/dist/unstable/ai/ResponseIdTracker.js +68 -0
- package/dist/unstable/ai/ResponseIdTracker.js.map +1 -0
- 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/ai/index.d.ts +4 -0
- package/dist/unstable/ai/index.d.ts.map +1 -1
- package/dist/unstable/ai/index.js +4 -0
- package/dist/unstable/ai/index.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 +2 -1
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +5 -3
- 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 +12 -23
- 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 +6 -6
- 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/LanguageModel.ts +192 -65
- package/src/unstable/ai/OpenAiStructuredOutput.ts +4 -0
- package/src/unstable/ai/ResponseIdTracker.ts +97 -0
- package/src/unstable/ai/Tool.ts +20 -0
- package/src/unstable/ai/index.ts +5 -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 +14 -9
- 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/internal/dateTime.ts
CHANGED
|
@@ -9,11 +9,11 @@ import type { LazyArg } from "../Function.ts"
|
|
|
9
9
|
import { dual } from "../Function.ts"
|
|
10
10
|
import * as Hash from "../Hash.ts"
|
|
11
11
|
import * as Inspectable from "../Inspectable.ts"
|
|
12
|
+
import * as Option from "../Option.ts"
|
|
12
13
|
import * as order from "../Order.ts"
|
|
13
14
|
import { pipeArguments } from "../Pipeable.ts"
|
|
14
15
|
import * as Predicate from "../Predicate.ts"
|
|
15
16
|
import type { Mutable } from "../Types.ts"
|
|
16
|
-
import * as UndefinedOr from "../UndefinedOr.ts"
|
|
17
17
|
import * as effect from "./effect.ts"
|
|
18
18
|
|
|
19
19
|
/** @internal */
|
|
@@ -264,10 +264,10 @@ export const makeZonedUnsafe = (input: DateTime.DateTime.Input, options?: {
|
|
|
264
264
|
zone = zoneMakeOffset(timeZoneOption)
|
|
265
265
|
} else {
|
|
266
266
|
const parsedZone = zoneFromString(timeZoneOption)
|
|
267
|
-
if (parsedZone
|
|
267
|
+
if (Option.isNone(parsedZone)) {
|
|
268
268
|
throw new IllegalArgumentError(`Invalid time zone: ${timeZoneOption}`)
|
|
269
269
|
}
|
|
270
|
-
zone = parsedZone
|
|
270
|
+
zone = parsedZone.value
|
|
271
271
|
}
|
|
272
272
|
if (options?.adjustForTimeZone !== true) {
|
|
273
273
|
return makeZonedProto(self.epochMilliseconds, zone, self.partsUtc)
|
|
@@ -283,20 +283,20 @@ export const makeZoned: (
|
|
|
283
283
|
readonly adjustForTimeZone?: boolean | undefined
|
|
284
284
|
readonly disambiguation?: DateTime.Disambiguation | undefined
|
|
285
285
|
}
|
|
286
|
-
) => DateTime.Zoned
|
|
286
|
+
) => Option.Option<DateTime.Zoned> = Option.liftThrowable(makeZonedUnsafe)
|
|
287
287
|
|
|
288
288
|
/** @internal */
|
|
289
|
-
export const make: <A extends DateTime.DateTime.Input>(input: A) => DateTime.DateTime.PreserveZone<A
|
|
290
|
-
|
|
289
|
+
export const make: <A extends DateTime.DateTime.Input>(input: A) => Option.Option<DateTime.DateTime.PreserveZone<A>> =
|
|
290
|
+
Option.liftThrowable(makeUnsafe)
|
|
291
291
|
|
|
292
292
|
const zonedStringRegExp = /^(.{17,35})\[(.+)\]$/
|
|
293
293
|
|
|
294
294
|
/** @internal */
|
|
295
|
-
export const makeZonedFromString = (input: string): DateTime.Zoned
|
|
295
|
+
export const makeZonedFromString = (input: string): Option.Option<DateTime.Zoned> => {
|
|
296
296
|
const match = zonedStringRegExp.exec(input)
|
|
297
297
|
if (match === null) {
|
|
298
298
|
const offset = parseOffset(input)
|
|
299
|
-
return offset !== null ? makeZoned(input, { timeZone: offset }) :
|
|
299
|
+
return offset !== null ? makeZoned(input, { timeZone: offset }) : Option.none()
|
|
300
300
|
}
|
|
301
301
|
const [, isoString, timeZone] = match
|
|
302
302
|
return makeZoned(isoString, { timeZone })
|
|
@@ -402,7 +402,7 @@ export const zoneMakeOffset = (offset: number): DateTime.TimeZone.Offset => {
|
|
|
402
402
|
}
|
|
403
403
|
|
|
404
404
|
/** @internal */
|
|
405
|
-
export const zoneMakeNamed: (zoneId: string) => DateTime.TimeZone.Named
|
|
405
|
+
export const zoneMakeNamed: (zoneId: string) => Option.Option<DateTime.TimeZone.Named> = Option.liftThrowable(
|
|
406
406
|
zoneMakeNamedUnsafe
|
|
407
407
|
)
|
|
408
408
|
|
|
@@ -420,10 +420,10 @@ export const zoneMakeLocal = (): DateTime.TimeZone.Named =>
|
|
|
420
420
|
const offsetZoneRegExp = /^(?:GMT|[+-])/
|
|
421
421
|
|
|
422
422
|
/** @internal */
|
|
423
|
-
export const zoneFromString = (zone: string): DateTime.TimeZone
|
|
423
|
+
export const zoneFromString = (zone: string): Option.Option<DateTime.TimeZone> => {
|
|
424
424
|
if (offsetZoneRegExp.test(zone)) {
|
|
425
425
|
const offset = parseOffset(zone)
|
|
426
|
-
return offset === null ?
|
|
426
|
+
return offset === null ? Option.none() : Option.some(zoneMakeOffset(offset))
|
|
427
427
|
}
|
|
428
428
|
return zoneMakeNamed(zone)
|
|
429
429
|
}
|
|
@@ -441,17 +441,17 @@ export const setZoneNamed: {
|
|
|
441
441
|
(zoneId: string, options?: {
|
|
442
442
|
readonly adjustForTimeZone?: boolean | undefined
|
|
443
443
|
readonly disambiguation?: DateTime.Disambiguation | undefined
|
|
444
|
-
}): (self: DateTime.DateTime) => DateTime.Zoned
|
|
444
|
+
}): (self: DateTime.DateTime) => Option.Option<DateTime.Zoned>
|
|
445
445
|
(self: DateTime.DateTime, zoneId: string, options?: {
|
|
446
446
|
readonly adjustForTimeZone?: boolean | undefined
|
|
447
447
|
readonly disambiguation?: DateTime.Disambiguation | undefined
|
|
448
|
-
}): DateTime.Zoned
|
|
448
|
+
}): Option.Option<DateTime.Zoned>
|
|
449
449
|
} = dual(
|
|
450
450
|
isDateTimeArgs,
|
|
451
451
|
(self: DateTime.DateTime, zoneId: string, options?: {
|
|
452
452
|
readonly adjustForTimeZone?: boolean | undefined
|
|
453
453
|
readonly disambiguation?: DateTime.Disambiguation | undefined
|
|
454
|
-
}): DateTime.Zoned
|
|
454
|
+
}): Option.Option<DateTime.Zoned> => Option.map(zoneMakeNamed(zoneId), (zone) => setZone(self, zone, options))
|
|
455
455
|
)
|
|
456
456
|
|
|
457
457
|
/** @internal */
|
package/src/internal/effect.ts
CHANGED
|
@@ -540,6 +540,11 @@ export class FiberImpl<A = any, E = any> implements Fiber.Fiber<A, E> {
|
|
|
540
540
|
maxOpsBeforeYield!: number
|
|
541
541
|
currentPreventYield!: boolean
|
|
542
542
|
|
|
543
|
+
_dispatcher: Scheduler.SchedulerDispatcher | undefined = undefined
|
|
544
|
+
get currentDispatcher(): Scheduler.SchedulerDispatcher {
|
|
545
|
+
return this._dispatcher ??= this.currentScheduler.makeDispatcher()
|
|
546
|
+
}
|
|
547
|
+
|
|
543
548
|
getRef<X>(ref: ServiceMap.Reference<X>): X {
|
|
544
549
|
return ServiceMap.getReferenceUnsafe(this.services, ref)
|
|
545
550
|
}
|
|
@@ -675,7 +680,11 @@ export class FiberImpl<A = any, E = any> implements Fiber.Fiber<A, E> {
|
|
|
675
680
|
}
|
|
676
681
|
setServices(services: ServiceMap.ServiceMap<never>): void {
|
|
677
682
|
this.services = services
|
|
678
|
-
|
|
683
|
+
const scheduler = this.getRef(Scheduler.Scheduler)
|
|
684
|
+
if (scheduler !== this.currentScheduler) {
|
|
685
|
+
this.currentScheduler = scheduler
|
|
686
|
+
this._dispatcher = undefined
|
|
687
|
+
}
|
|
679
688
|
this.currentSpan = services.mapUnsafe.get(Tracer.ParentSpanKey)
|
|
680
689
|
this.currentLogLevel = this.getRef(CurrentLogLevel)
|
|
681
690
|
this.minimumLogLevel = this.getRef(MinimumLogLevel)
|
|
@@ -903,7 +912,7 @@ export const yieldNowWith: (priority?: number) => Effect.Effect<void> = makePrim
|
|
|
903
912
|
op: "Yield",
|
|
904
913
|
[evaluate](fiber) {
|
|
905
914
|
let resumed = false
|
|
906
|
-
fiber.
|
|
915
|
+
fiber.currentDispatcher.scheduleTask(() => {
|
|
907
916
|
if (resumed) return
|
|
908
917
|
fiber.evaluate(exitVoid as any)
|
|
909
918
|
}, this[args] ?? 0)
|
|
@@ -4849,7 +4858,7 @@ export const forkUnsafe = <FA, FE, A, E, R>(
|
|
|
4849
4858
|
if (immediate) {
|
|
4850
4859
|
child.evaluate(effect as any)
|
|
4851
4860
|
} else {
|
|
4852
|
-
parent.
|
|
4861
|
+
parent.currentDispatcher.scheduleTask(() => child.evaluate(effect as any), 0)
|
|
4853
4862
|
}
|
|
4854
4863
|
if (!daemon && !child._exit) {
|
|
4855
4864
|
parent.children().add(child)
|
|
@@ -4990,10 +4999,8 @@ export const runForkWith = <R>(services: ServiceMap.ServiceMap<R>) =>
|
|
|
4990
4999
|
effect: Effect.Effect<A, E, R>,
|
|
4991
5000
|
options?: Effect.RunOptions | undefined
|
|
4992
5001
|
): Fiber.Fiber<A, E> => {
|
|
4993
|
-
const scheduler = options?.scheduler ||
|
|
4994
|
-
(!services.mapUnsafe.has(Scheduler.Scheduler.key) && new Scheduler.MixedScheduler())
|
|
4995
5002
|
const fiber = new FiberImpl<A, E>(
|
|
4996
|
-
scheduler ? ServiceMap.add(services, Scheduler.Scheduler, scheduler) : services,
|
|
5003
|
+
options?.scheduler ? ServiceMap.add(services, Scheduler.Scheduler, options.scheduler) : services,
|
|
4997
5004
|
options?.uninterruptible !== true
|
|
4998
5005
|
)
|
|
4999
5006
|
fiber.evaluate(effect as any)
|
|
@@ -5113,7 +5120,7 @@ export const runSyncExitWith = <R>(services: ServiceMap.ServiceMap<R>) => {
|
|
|
5113
5120
|
if (effectIsExit(effect)) return effect
|
|
5114
5121
|
const scheduler = new Scheduler.MixedScheduler("sync")
|
|
5115
5122
|
const fiber = runFork(effect, { scheduler })
|
|
5116
|
-
|
|
5123
|
+
fiber.currentDispatcher?.flush()
|
|
5117
5124
|
return (fiber as FiberImpl<A, E>)._exit ?? exitDie(fiber)
|
|
5118
5125
|
}
|
|
5119
5126
|
}
|
|
@@ -5136,108 +5143,6 @@ export const runSyncWith = <R>(services: ServiceMap.ServiceMap<R>) => {
|
|
|
5136
5143
|
/** @internal */
|
|
5137
5144
|
export const runSync: <A, E>(effect: Effect.Effect<A, E>) => A = runSyncWith(ServiceMap.empty())
|
|
5138
5145
|
|
|
5139
|
-
// ----------------------------------------------------------------------------
|
|
5140
|
-
// Semaphore
|
|
5141
|
-
// ----------------------------------------------------------------------------
|
|
5142
|
-
|
|
5143
|
-
/** @internal */
|
|
5144
|
-
class Semaphore {
|
|
5145
|
-
public waiters = new Set<() => void>()
|
|
5146
|
-
public taken = 0
|
|
5147
|
-
public permits: number
|
|
5148
|
-
|
|
5149
|
-
constructor(permits: number) {
|
|
5150
|
-
this.permits = permits
|
|
5151
|
-
}
|
|
5152
|
-
|
|
5153
|
-
get free() {
|
|
5154
|
-
return this.permits - this.taken
|
|
5155
|
-
}
|
|
5156
|
-
|
|
5157
|
-
readonly take = (n: number): Effect.Effect<number> => {
|
|
5158
|
-
const take: Effect.Effect<number> = suspend(() => {
|
|
5159
|
-
if (this.free < n) {
|
|
5160
|
-
return callback((resume) => {
|
|
5161
|
-
if (this.free >= n) return resume(take)
|
|
5162
|
-
const observer = () => {
|
|
5163
|
-
if (this.free < n) return
|
|
5164
|
-
this.waiters.delete(observer)
|
|
5165
|
-
resume(take)
|
|
5166
|
-
}
|
|
5167
|
-
this.waiters.add(observer)
|
|
5168
|
-
return sync(() => {
|
|
5169
|
-
this.waiters.delete(observer)
|
|
5170
|
-
})
|
|
5171
|
-
})
|
|
5172
|
-
}
|
|
5173
|
-
this.taken += n
|
|
5174
|
-
return succeed(n)
|
|
5175
|
-
})
|
|
5176
|
-
return take
|
|
5177
|
-
}
|
|
5178
|
-
|
|
5179
|
-
updateTakenUnsafe(fiber: Fiber.Fiber<any, any>, f: (n: number) => number): Effect.Effect<number> {
|
|
5180
|
-
this.taken = f(this.taken)
|
|
5181
|
-
if (this.waiters.size > 0) {
|
|
5182
|
-
fiber.currentScheduler.scheduleTask(() => {
|
|
5183
|
-
const iter = this.waiters.values()
|
|
5184
|
-
let item = iter.next()
|
|
5185
|
-
while (item.done === false && this.free > 0) {
|
|
5186
|
-
item.value()
|
|
5187
|
-
item = iter.next()
|
|
5188
|
-
}
|
|
5189
|
-
}, 0)
|
|
5190
|
-
}
|
|
5191
|
-
return succeed(this.free)
|
|
5192
|
-
}
|
|
5193
|
-
|
|
5194
|
-
updateTaken(f: (n: number) => number): Effect.Effect<number> {
|
|
5195
|
-
return withFiber((fiber) => this.updateTakenUnsafe(fiber, f))
|
|
5196
|
-
}
|
|
5197
|
-
|
|
5198
|
-
readonly resize = (permits: number) =>
|
|
5199
|
-
asVoid(
|
|
5200
|
-
withFiber((fiber) => {
|
|
5201
|
-
this.permits = permits
|
|
5202
|
-
if (this.free < 0) {
|
|
5203
|
-
return void_
|
|
5204
|
-
}
|
|
5205
|
-
return this.updateTakenUnsafe(fiber, (taken) => taken)
|
|
5206
|
-
})
|
|
5207
|
-
)
|
|
5208
|
-
|
|
5209
|
-
readonly release = (n: number): Effect.Effect<number> => this.updateTaken((taken) => taken - n)
|
|
5210
|
-
|
|
5211
|
-
readonly releaseAll: Effect.Effect<number> = this.updateTaken((_) => 0)
|
|
5212
|
-
|
|
5213
|
-
readonly withPermits = (n: number) => <A, E, R>(self: Effect.Effect<A, E, R>) =>
|
|
5214
|
-
uninterruptibleMask((restore) =>
|
|
5215
|
-
flatMap(
|
|
5216
|
-
restore(this.take(n)),
|
|
5217
|
-
(permits) => onExitPrimitive(restore(self), () => this.release(permits), true)
|
|
5218
|
-
)
|
|
5219
|
-
)
|
|
5220
|
-
|
|
5221
|
-
readonly withPermit = this.withPermits(1)
|
|
5222
|
-
|
|
5223
|
-
readonly withPermitsIfAvailable = (n: number) => <A, E, R>(self: Effect.Effect<A, E, R>) =>
|
|
5224
|
-
uninterruptibleMask((restore) =>
|
|
5225
|
-
suspend(() => {
|
|
5226
|
-
if (this.free < n) {
|
|
5227
|
-
return succeedNone
|
|
5228
|
-
}
|
|
5229
|
-
this.taken += n
|
|
5230
|
-
return ensuring(restore(asSome(self)), this.release(n))
|
|
5231
|
-
})
|
|
5232
|
-
)
|
|
5233
|
-
}
|
|
5234
|
-
|
|
5235
|
-
/** @internal */
|
|
5236
|
-
export const makeSemaphoreUnsafe = (permits: number): Semaphore => new Semaphore(permits)
|
|
5237
|
-
|
|
5238
|
-
/** @internal */
|
|
5239
|
-
export const makeSemaphore = (permits: number) => sync(() => makeSemaphoreUnsafe(permits))
|
|
5240
|
-
|
|
5241
5146
|
const succeedTrue = succeed(true)
|
|
5242
5147
|
const succeedFalse = succeed(false)
|
|
5243
5148
|
|
|
@@ -5255,7 +5160,7 @@ class Latch implements _Latch.Latch {
|
|
|
5255
5160
|
return succeedTrue
|
|
5256
5161
|
}
|
|
5257
5162
|
this.scheduled = true
|
|
5258
|
-
fiber.
|
|
5163
|
+
fiber.currentDispatcher.scheduleTask(this.flushWaiters, 0)
|
|
5259
5164
|
return succeedTrue
|
|
5260
5165
|
}
|
|
5261
5166
|
private flushWaiters = () => {
|
|
@@ -5297,7 +5202,7 @@ class Latch implements _Latch.Latch {
|
|
|
5297
5202
|
return true
|
|
5298
5203
|
}
|
|
5299
5204
|
close = sync(() => this.closeUnsafe())
|
|
5300
|
-
whenOpen = <A, E, R>(self: Effect.Effect<A, E, R>): Effect.Effect<A, E, R> =>
|
|
5205
|
+
whenOpen = <A, E, R>(self: Effect.Effect<A, E, R>): Effect.Effect<A, E, R> => flatMap(this.await, () => self)
|
|
5301
5206
|
}
|
|
5302
5207
|
|
|
5303
5208
|
/** @internal */
|
|
@@ -5360,16 +5265,15 @@ const NoopSpanProto: Omit<Tracer.Span, "parent" | "name" | "annotations" | "leve
|
|
|
5360
5265
|
/** @internal */
|
|
5361
5266
|
export const noopSpan = (options: {
|
|
5362
5267
|
readonly name: string
|
|
5363
|
-
readonly parent: Tracer.AnySpan
|
|
5268
|
+
readonly parent: Option.Option<Tracer.AnySpan>
|
|
5364
5269
|
readonly annotations: ServiceMap.ServiceMap<never>
|
|
5365
5270
|
}): Tracer.Span => Object.assign(Object.create(NoopSpanProto), options)
|
|
5366
5271
|
|
|
5367
|
-
const filterDisablePropagation = (span: Tracer.AnySpan | undefined): Tracer.AnySpan
|
|
5368
|
-
if (span)
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
}
|
|
5272
|
+
const filterDisablePropagation = (span: Tracer.AnySpan | undefined): Option.Option<Tracer.AnySpan> => {
|
|
5273
|
+
if (!span) return Option.none()
|
|
5274
|
+
return ServiceMap.get(span.annotations, Tracer.DisablePropagation)
|
|
5275
|
+
? span._tag === "Span" ? filterDisablePropagation(Option.getOrUndefined(span.parent)) : Option.none()
|
|
5276
|
+
: Option.some(span)
|
|
5373
5277
|
}
|
|
5374
5278
|
|
|
5375
5279
|
/** @internal */
|
|
@@ -5380,7 +5284,11 @@ export const makeSpanUnsafe = <XA, XE>(
|
|
|
5380
5284
|
) => {
|
|
5381
5285
|
const disablePropagation = !fiber.getRef(TracerEnabled) ||
|
|
5382
5286
|
(options?.annotations && ServiceMap.get(options.annotations, Tracer.DisablePropagation))
|
|
5383
|
-
const parent = options?.parent
|
|
5287
|
+
const parent = options?.parent !== undefined
|
|
5288
|
+
? Option.some(options.parent)
|
|
5289
|
+
: options?.root
|
|
5290
|
+
? Option.none<Tracer.AnySpan>()
|
|
5291
|
+
: filterDisablePropagation(fiber.currentSpan)
|
|
5384
5292
|
|
|
5385
5293
|
let span: Tracer.Span
|
|
5386
5294
|
|
|
@@ -5413,9 +5321,9 @@ export const makeSpanUnsafe = <XA, XE>(
|
|
|
5413
5321
|
links,
|
|
5414
5322
|
startTime: timingEnabled ? clock.currentTimeNanosUnsafe() : 0n,
|
|
5415
5323
|
kind: options?.kind ?? "internal",
|
|
5416
|
-
root: options?.root ??
|
|
5324
|
+
root: options?.root ?? Option.isNone(parent),
|
|
5417
5325
|
sampled: options?.sampled ??
|
|
5418
|
-
(parent
|
|
5326
|
+
(Option.isSome(parent) && parent.value.sampled === false
|
|
5419
5327
|
? false
|
|
5420
5328
|
: !isLogLevelGreaterThan(fiber.getRef(Tracer.MinimumTraceLevel), level))
|
|
5421
5329
|
})
|
package/src/internal/hashMap.ts
CHANGED
|
@@ -1271,14 +1271,15 @@ export const filterMap = dual<
|
|
|
1271
1271
|
|
|
1272
1272
|
/** @internal */
|
|
1273
1273
|
export const findFirst = dual<
|
|
1274
|
-
<K, A>(predicate: (a: NoInfer<A>, k: K) => boolean) => (self: HashMap<K, A>) => [K, A]
|
|
1275
|
-
<K, A>(self: HashMap<K, A>, predicate: (a: A, k: K) => boolean) => [K, A]
|
|
1274
|
+
<K, A>(predicate: (a: NoInfer<A>, k: K) => boolean) => (self: HashMap<K, A>) => Option.Option<[K, A]>,
|
|
1275
|
+
<K, A>(self: HashMap<K, A>, predicate: (a: A, k: K) => boolean) => Option.Option<[K, A]>
|
|
1276
1276
|
>(2, <K, A>(self: HashMap<K, A>, predicate: (a: A, k: K) => boolean) => {
|
|
1277
1277
|
for (const [key, value] of self) {
|
|
1278
1278
|
if (predicate(value, key)) {
|
|
1279
|
-
return [key, value]
|
|
1279
|
+
return Option.some([key, value])
|
|
1280
1280
|
}
|
|
1281
1281
|
}
|
|
1282
|
+
return Option.none()
|
|
1282
1283
|
})
|
|
1283
1284
|
|
|
1284
1285
|
/** @internal */
|
package/src/internal/option.ts
CHANGED
|
@@ -45,10 +45,17 @@ const SomeProto = Object.assign(Object.create(CommonProto), {
|
|
|
45
45
|
}
|
|
46
46
|
})
|
|
47
47
|
|
|
48
|
+
Object.defineProperty(SomeProto, "valueOrUndefined", {
|
|
49
|
+
get() {
|
|
50
|
+
return this.value
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
|
|
48
54
|
const NoneHash = Hash.hash("None")
|
|
49
55
|
const NoneProto = Object.assign(Object.create(CommonProto), {
|
|
50
56
|
_tag: "None",
|
|
51
57
|
_op: "None",
|
|
58
|
+
valueOrUndefined: undefined,
|
|
52
59
|
[Equal.symbol]<A>(this: Option.None<A>, that: unknown): boolean {
|
|
53
60
|
return isOption(that) && isNone(that)
|
|
54
61
|
},
|
package/src/internal/trie.ts
CHANGED
|
@@ -682,19 +682,19 @@ export const modify = dual<
|
|
|
682
682
|
|
|
683
683
|
/** @internal */
|
|
684
684
|
export const longestPrefixOf = dual<
|
|
685
|
-
(key: string) => <V>(self: TR.Trie<V>) => [string, V]
|
|
686
|
-
<V>(self: TR.Trie<V>, key: string) => [string, V]
|
|
685
|
+
(key: string) => <V>(self: TR.Trie<V>) => Option.Option<[string, V]>,
|
|
686
|
+
<V>(self: TR.Trie<V>, key: string) => Option.Option<[string, V]>
|
|
687
687
|
>(
|
|
688
688
|
2,
|
|
689
|
-
<V>(self: TR.Trie<V>, key: string): [string, V]
|
|
689
|
+
<V>(self: TR.Trie<V>, key: string): Option.Option<[string, V]> => {
|
|
690
690
|
let n: Node<V> | undefined = (self as TrieImpl<V>)._root
|
|
691
|
-
if (n === undefined || key.length === 0) return
|
|
692
|
-
let longestPrefixNode: [string, V]
|
|
691
|
+
if (n === undefined || key.length === 0) return Option.none()
|
|
692
|
+
let longestPrefixNode: Option.Option<[string, V]> = Option.none()
|
|
693
693
|
let cIndex = 0
|
|
694
694
|
while (cIndex < key.length) {
|
|
695
695
|
const c = key[cIndex]
|
|
696
696
|
if (n.value !== undefined) {
|
|
697
|
-
longestPrefixNode = [key.slice(0, cIndex + 1), n.value]
|
|
697
|
+
longestPrefixNode = Option.some([key.slice(0, cIndex + 1), n.value])
|
|
698
698
|
}
|
|
699
699
|
|
|
700
700
|
if (c > n.key) {
|
|
@@ -183,7 +183,7 @@ export class NetworkError extends Schema.ErrorClass<NetworkError>(
|
|
|
183
183
|
description: error.description,
|
|
184
184
|
reason: error._tag,
|
|
185
185
|
request: {
|
|
186
|
-
hash: error.request.hash,
|
|
186
|
+
hash: Option.getOrUndefined(error.request.hash),
|
|
187
187
|
headers: redactHeaders(error.request.headers),
|
|
188
188
|
method: error.request.method,
|
|
189
189
|
url: error.request.url,
|
|
@@ -22,6 +22,7 @@ import * as Predicate from "../../Predicate.ts"
|
|
|
22
22
|
import * as Schema from "../../Schema.ts"
|
|
23
23
|
import * as AST from "../../SchemaAST.ts"
|
|
24
24
|
import * as Transformation from "../../SchemaTransformation.ts"
|
|
25
|
+
import * as Tool from "./Tool.ts"
|
|
25
26
|
|
|
26
27
|
/**
|
|
27
28
|
* Transforms a `Schema.Codec` into a form compatible with Anthropic's
|
|
@@ -225,6 +226,9 @@ function recur(ast: AST.AST): AST.AST {
|
|
|
225
226
|
}
|
|
226
227
|
} else if (ast.indexSignatures.length === 1 && ast.propertySignatures.length === 0) {
|
|
227
228
|
const is = ast.indexSignatures[0]
|
|
229
|
+
if (Tool.isEmptyParamsRecord(is)) {
|
|
230
|
+
return ast
|
|
231
|
+
}
|
|
228
232
|
// records are not supported by Anthropic, so we translate them to arrays of key-value pairs
|
|
229
233
|
if (annotations !== undefined && typeof annotations.description === "string") {
|
|
230
234
|
annotations.description = `${RECORD_DESCRIPTION}; ${annotations.description}`
|
package/src/unstable/ai/Chat.ts
CHANGED
|
@@ -696,7 +696,9 @@ export const makePersisted = Effect.fnUntraced(function*(options: {
|
|
|
696
696
|
yield* Ref.set(chat.history, history)
|
|
697
697
|
// Export the chat history
|
|
698
698
|
const exported = yield* Effect.orDie(chat.export)
|
|
699
|
-
const timeToLive = Predicate.isNotUndefined(ttl)
|
|
699
|
+
const timeToLive = Predicate.isNotUndefined(ttl)
|
|
700
|
+
? Option.getOrUndefined(Duration.fromInput(ttl))
|
|
701
|
+
: undefined
|
|
700
702
|
// Save the chat to the backing store
|
|
701
703
|
yield* store.set(chatId, exported as object, timeToLive)
|
|
702
704
|
}
|
|
@@ -738,7 +740,9 @@ export const makePersisted = Effect.fnUntraced(function*(options: {
|
|
|
738
740
|
// Export the chat history
|
|
739
741
|
const history = yield* Effect.orDie(chat.export)
|
|
740
742
|
// Save the history for the newly created chat
|
|
741
|
-
const timeToLive = Predicate.isNotUndefined(ttl)
|
|
743
|
+
const timeToLive = Predicate.isNotUndefined(ttl)
|
|
744
|
+
? Option.getOrUndefined(Duration.fromInput(ttl))
|
|
745
|
+
: undefined
|
|
742
746
|
yield* store.set(chatId, history as object, timeToLive)
|
|
743
747
|
// Convert the chat to a persisted chat
|
|
744
748
|
return yield* toPersisted(chatId, chat, ttl)
|