effect 4.1.2 → 4.1.4
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/ai-docs/package.json +1 -1
- package/ai-docs/tsconfig.json +2 -1
- package/dist/DateTime.d.ts +33 -2
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +16 -0
- package/dist/DateTime.js.map +1 -1
- package/dist/Match.d.ts +6 -6
- package/dist/Match.d.ts.map +1 -1
- package/dist/Match.js.map +1 -1
- package/dist/Queue.d.ts +2 -1
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +16 -9
- package/dist/Queue.js.map +1 -1
- package/dist/Rational.d.ts +1214 -0
- package/dist/Rational.d.ts.map +1 -0
- package/dist/Rational.js +880 -0
- package/dist/Rational.js.map +1 -0
- package/dist/RcMap.d.ts +3 -0
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +13 -14
- package/dist/RcMap.js.map +1 -1
- package/dist/Runtime.d.ts +75 -3
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +81 -4
- package/dist/Runtime.js.map +1 -1
- package/dist/Schema.d.ts +131 -29
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +128 -22
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +24 -12
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaParser.js +2 -2
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +26 -3
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +13 -2
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/ScopedCache.d.ts +7 -0
- package/dist/ScopedCache.d.ts.map +1 -1
- package/dist/ScopedCache.js +18 -1
- package/dist/ScopedCache.js.map +1 -1
- package/dist/ai/AgUi.d.ts +109 -0
- package/dist/ai/AgUi.d.ts.map +1 -0
- package/dist/ai/AgUi.js +543 -0
- package/dist/ai/AgUi.js.map +1 -0
- package/dist/ai/AgUiSchema.d.ts +6965 -0
- package/dist/ai/AgUiSchema.d.ts.map +1 -0
- package/dist/ai/AgUiSchema.js +974 -0
- package/dist/ai/AgUiSchema.js.map +1 -0
- package/dist/ai/AgUiServer.d.ts +6400 -0
- package/dist/ai/AgUiServer.d.ts.map +1 -0
- package/dist/ai/AgUiServer.js +309 -0
- package/dist/ai/AgUiServer.js.map +1 -0
- package/dist/ai/Chat.d.ts +31 -5
- package/dist/ai/Chat.d.ts.map +1 -1
- package/dist/ai/Chat.js +34 -4
- package/dist/ai/Chat.js.map +1 -1
- package/dist/ai/LanguageModel.d.ts +24 -5
- package/dist/ai/LanguageModel.d.ts.map +1 -1
- package/dist/ai/LanguageModel.js +26 -12
- package/dist/ai/LanguageModel.js.map +1 -1
- package/dist/ai/McpSchema.d.ts +110 -110
- package/dist/ai/McpSchema.d.ts.map +1 -1
- package/dist/ai/McpServer.d.ts +15 -0
- package/dist/ai/McpServer.d.ts.map +1 -1
- package/dist/ai/McpServer.js +211 -33
- package/dist/ai/McpServer.js.map +1 -1
- package/dist/ai/Prompt.d.ts +6 -2
- package/dist/ai/Prompt.d.ts.map +1 -1
- package/dist/ai/Prompt.js.map +1 -1
- package/dist/ai/Response.d.ts +5 -2
- package/dist/ai/Response.d.ts.map +1 -1
- package/dist/ai/Response.js +5 -1
- package/dist/ai/Response.js.map +1 -1
- package/dist/ai/Tool.d.ts +265 -69
- package/dist/ai/Tool.d.ts.map +1 -1
- package/dist/ai/Tool.js +19 -2
- package/dist/ai/Tool.js.map +1 -1
- package/dist/ai/Toolkit.d.ts +32 -2
- package/dist/ai/Toolkit.d.ts.map +1 -1
- package/dist/ai/Toolkit.js +61 -8
- package/dist/ai/Toolkit.js.map +1 -1
- package/dist/ai/WorkloadIdentity.d.ts +111 -0
- package/dist/ai/WorkloadIdentity.d.ts.map +1 -0
- package/dist/ai/WorkloadIdentity.js +227 -0
- package/dist/ai/WorkloadIdentity.js.map +1 -0
- package/dist/ai/index.d.ts +20 -0
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +20 -0
- package/dist/ai/index.js.map +1 -1
- package/dist/ai/internal/mcpCore.d.ts +0 -2
- package/dist/ai/internal/mcpCore.d.ts.map +1 -1
- package/dist/ai/internal/mcpCore.js +2 -8
- package/dist/ai/internal/mcpCore.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2024_11_05.js +5 -8
- package/dist/ai/internal/mcpProtocol/v2024_11_05.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_03_26.js +5 -8
- package/dist/ai/internal/mcpProtocol/v2025_03_26.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_06_18.js +5 -5
- package/dist/ai/internal/mcpProtocol/v2025_06_18.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_11_25.js +5 -5
- package/dist/ai/internal/mcpProtocol/v2025_11_25.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2026_07_28.js +60 -51
- package/dist/ai/internal/mcpProtocol/v2026_07_28.js.map +1 -1
- package/dist/ai/internal/mcpProtocol.js +11 -1
- package/dist/ai/internal/mcpProtocol.js.map +1 -1
- package/dist/ai/internal/mcpProtocolRegistry.js +4 -0
- package/dist/ai/internal/mcpProtocolRegistry.js.map +1 -1
- package/dist/ai/internal/mcpRuntime.js +2 -0
- package/dist/ai/internal/mcpRuntime.js.map +1 -1
- package/dist/ai/internal/mcpSchema/v2024_11_05.js +0 -2
- package/dist/ai/internal/mcpSchema/v2024_11_05.js.map +1 -1
- package/dist/ai/internal/mcpSchema/v2025_03_26.d.ts.map +1 -1
- package/dist/ai/internal/mcpSchema/v2025_03_26.js +0 -2
- package/dist/ai/internal/mcpSchema/v2025_03_26.js.map +1 -1
- package/dist/ai/internal/mcpSchema/v2025_06_18.d.ts.map +1 -1
- package/dist/ai/internal/mcpSchema/v2025_06_18.js +0 -2
- package/dist/ai/internal/mcpSchema/v2025_06_18.js.map +1 -1
- package/dist/ai/internal/mcpSchema/v2025_11_25.d.ts.map +1 -1
- package/dist/ai/internal/mcpSchema/v2025_11_25.js +0 -2
- package/dist/ai/internal/mcpSchema/v2025_11_25.js.map +1 -1
- package/dist/ai/internal/mcpSchema/v2026_07_28.d.ts.map +1 -1
- package/dist/ai/internal/mcpSchema/v2026_07_28.js +0 -2
- package/dist/ai/internal/mcpSchema/v2026_07_28.js.map +1 -1
- package/dist/ai/internal/mcpSkills.js +5 -17
- package/dist/ai/internal/mcpSkills.js.map +1 -1
- package/dist/ai/internal/mcpStatefulRuntime.js +0 -2
- package/dist/ai/internal/mcpStatefulRuntime.js.map +1 -1
- package/dist/ai/internal/structured-output.js +5 -1
- package/dist/ai/internal/structured-output.js.map +1 -1
- package/dist/cli/Argument.d.ts +81 -0
- package/dist/cli/Argument.d.ts.map +1 -1
- package/dist/cli/Argument.js +26 -0
- package/dist/cli/Argument.js.map +1 -1
- package/dist/cli/CliError.d.ts +7 -4
- package/dist/cli/CliError.d.ts.map +1 -1
- package/dist/cli/CliError.js +7 -4
- package/dist/cli/CliError.js.map +1 -1
- package/dist/cli/Command.d.ts +241 -22
- package/dist/cli/Command.d.ts.map +1 -1
- package/dist/cli/Command.js +88 -10
- package/dist/cli/Command.js.map +1 -1
- package/dist/cli/CommandSpec.d.ts +287 -0
- package/dist/cli/CommandSpec.d.ts.map +1 -0
- package/dist/cli/CommandSpec.js +277 -0
- package/dist/cli/CommandSpec.js.map +1 -0
- package/dist/cli/Completions.d.ts +5 -0
- package/dist/cli/Completions.d.ts.map +1 -1
- package/dist/cli/Completions.js.map +1 -1
- package/dist/cli/Flag.d.ts +102 -0
- package/dist/cli/Flag.d.ts.map +1 -1
- package/dist/cli/Flag.js +47 -0
- package/dist/cli/Flag.js.map +1 -1
- package/dist/cli/Param.d.ts +154 -1
- package/dist/cli/Param.d.ts.map +1 -1
- package/dist/cli/Param.js +87 -29
- package/dist/cli/Param.js.map +1 -1
- package/dist/cli/index.d.ts +5 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +5 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/internal/command.d.ts +2 -2
- package/dist/cli/internal/command.d.ts.map +1 -1
- package/dist/cli/internal/command.js +1 -1
- package/dist/cli/internal/command.js.map +1 -1
- package/dist/cli/internal/completions/bash.js +6 -7
- package/dist/cli/internal/completions/bash.js.map +1 -1
- package/dist/cli/internal/completions/descriptor.js +21 -7
- package/dist/cli/internal/completions/descriptor.js.map +1 -1
- package/dist/cli/internal/completions/fish.js +3 -3
- package/dist/cli/internal/completions/fish.js.map +1 -1
- package/dist/cli/internal/completions/powershell.js +2 -2
- package/dist/cli/internal/completions/powershell.js.map +1 -1
- package/dist/cli/internal/completions/zsh.js +2 -2
- package/dist/cli/internal/completions/zsh.js.map +1 -1
- package/dist/cli/internal/lexer.js +13 -0
- package/dist/cli/internal/lexer.js.map +1 -1
- package/dist/cli/internal/parser.js +23 -16
- package/dist/cli/internal/parser.js.map +1 -1
- package/dist/cli/internal/wizard.d.ts.map +1 -1
- package/dist/cli/internal/wizard.js +4 -0
- package/dist/cli/internal/wizard.js.map +1 -1
- package/dist/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/cluster/ClusterWorkflowEngine.js +15 -13
- package/dist/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/cluster/Entity.d.ts +17 -0
- package/dist/cluster/Entity.d.ts.map +1 -1
- package/dist/cluster/Entity.js +20 -0
- package/dist/cluster/Entity.js.map +1 -1
- package/dist/cluster/MessageRetention.d.ts +71 -0
- package/dist/cluster/MessageRetention.d.ts.map +1 -0
- package/dist/cluster/MessageRetention.js +100 -0
- package/dist/cluster/MessageRetention.js.map +1 -0
- package/dist/cluster/MessageStorage.d.ts +81 -0
- package/dist/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/cluster/MessageStorage.js +34 -2
- package/dist/cluster/MessageStorage.js.map +1 -1
- package/dist/cluster/ShardingConfig.d.ts +24 -2
- package/dist/cluster/ShardingConfig.d.ts.map +1 -1
- package/dist/cluster/ShardingConfig.js.map +1 -1
- package/dist/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/cluster/SqlMessageStorage.js +187 -29
- package/dist/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/cluster/index.d.ts +5 -0
- package/dist/cluster/index.d.ts.map +1 -1
- package/dist/cluster/index.js +5 -0
- package/dist/cluster/index.js.map +1 -1
- package/dist/encoding/Base64.d.ts +0 -6
- package/dist/encoding/Base64.d.ts.map +1 -1
- package/dist/encoding/Base64.js +25 -5
- package/dist/encoding/Base64.js.map +1 -1
- package/dist/encoding/Base64Url.d.ts +0 -6
- package/dist/encoding/Base64Url.d.ts.map +1 -1
- package/dist/encoding/Base64Url.js +91 -8
- package/dist/encoding/Base64Url.js.map +1 -1
- package/dist/encoding/Csv.d.ts.map +1 -1
- package/dist/encoding/Csv.js +11 -5
- package/dist/encoding/Csv.js.map +1 -1
- package/dist/encoding/Hex.d.ts.map +1 -1
- package/dist/encoding/Hex.js +51 -34
- package/dist/encoding/Hex.js.map +1 -1
- package/dist/encoding/SchemaBinary.d.ts +14 -2
- package/dist/encoding/SchemaBinary.d.ts.map +1 -1
- package/dist/encoding/SchemaBinary.js +78 -5
- package/dist/encoding/SchemaBinary.js.map +1 -1
- package/dist/encoding/Xml.d.ts +25 -0
- package/dist/encoding/Xml.d.ts.map +1 -1
- package/dist/encoding/Xml.js +44 -19
- package/dist/encoding/Xml.js.map +1 -1
- package/dist/graphql/GraphQL.d.ts.map +1 -1
- package/dist/graphql/GraphQL.js +4 -1
- package/dist/graphql/GraphQL.js.map +1 -1
- package/dist/http/Headers.d.ts +5 -1
- package/dist/http/Headers.d.ts.map +1 -1
- package/dist/http/Headers.js +7 -2
- package/dist/http/Headers.js.map +1 -1
- package/dist/http/HttpClient.d.ts +57 -12
- package/dist/http/HttpClient.d.ts.map +1 -1
- package/dist/http/HttpClient.js +92 -54
- package/dist/http/HttpClient.js.map +1 -1
- package/dist/http/HttpClientError.d.ts +22 -8
- package/dist/http/HttpClientError.d.ts.map +1 -1
- package/dist/http/HttpClientError.js +68 -14
- package/dist/http/HttpClientError.js.map +1 -1
- package/dist/http/HttpEffect.d.ts +63 -4
- package/dist/http/HttpEffect.d.ts.map +1 -1
- package/dist/http/HttpEffect.js +89 -9
- package/dist/http/HttpEffect.js.map +1 -1
- package/dist/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/http/HttpMiddleware.js +5 -3
- package/dist/http/HttpMiddleware.js.map +1 -1
- package/dist/http/HttpServer.d.ts +80 -0
- package/dist/http/HttpServer.d.ts.map +1 -1
- package/dist/http/HttpServer.js +16 -0
- package/dist/http/HttpServer.js.map +1 -1
- package/dist/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/http/HttpServerRequest.js +1 -14
- package/dist/http/HttpServerRequest.js.map +1 -1
- package/dist/http/HttpStaticServer.js +10 -16
- package/dist/http/HttpStaticServer.js.map +1 -1
- package/dist/http/internal/requestState.js +15 -0
- package/dist/http/internal/requestState.js.map +1 -1
- package/dist/http-api/HttpApi.d.ts +47 -0
- package/dist/http-api/HttpApi.d.ts.map +1 -1
- package/dist/http-api/HttpApi.js +66 -0
- package/dist/http-api/HttpApi.js.map +1 -1
- package/dist/http-api/HttpApiBuilder.d.ts.map +1 -1
- package/dist/http-api/HttpApiBuilder.js +18 -2
- package/dist/http-api/HttpApiBuilder.js.map +1 -1
- package/dist/http-api/HttpApiClient.d.ts +1 -1
- package/dist/http-api/HttpApiClient.d.ts.map +1 -1
- package/dist/http-api/HttpApiClient.js +5 -1
- package/dist/http-api/HttpApiClient.js.map +1 -1
- package/dist/http-api/HttpApiSchema.d.ts +85 -0
- package/dist/http-api/HttpApiSchema.d.ts.map +1 -1
- package/dist/http-api/HttpApiSchema.js +74 -2
- package/dist/http-api/HttpApiSchema.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/base64.d.ts +2 -0
- package/dist/internal/base64.d.ts.map +1 -0
- package/dist/internal/base64.js +30 -0
- package/dist/internal/base64.js.map +1 -0
- package/dist/internal/core.js +3 -4
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/dateTime.js +18 -10
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/effect.js +41 -17
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/equal.js +7 -0
- package/dist/internal/equal.js.map +1 -1
- package/dist/internal/matcher.js +1 -1
- package/dist/internal/matcher.js.map +1 -1
- package/dist/internal/schema/codegen.js +7 -7
- package/dist/internal/schema/codegen.js.map +1 -1
- package/dist/internal/schema/fromJsonSchemaDocument.js +161 -36
- package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -1
- package/dist/internal/schema/interpreter.js +10 -10
- package/dist/internal/schema/interpreter.js.map +1 -1
- package/dist/internal/schema/parser.js +9 -4
- package/dist/internal/schema/parser.js.map +1 -1
- package/dist/internal/schema/toCodeDocument.js +3 -0
- package/dist/internal/schema/toCodeDocument.js.map +1 -1
- package/dist/internal/schema/toEquivalence.js +6 -5
- package/dist/internal/schema/toEquivalence.js.map +1 -1
- package/dist/internal/schema/toFormatter.js +3 -2
- package/dist/internal/schema/toFormatter.js.map +1 -1
- package/dist/internal/version.js +1 -1
- package/dist/observability/OtlpMetrics.js +1 -1
- package/dist/observability/OtlpMetrics.js.map +1 -1
- package/dist/observability/OtlpTracer.js +2 -2
- package/dist/observability/OtlpTracer.js.map +1 -1
- package/dist/persistence/PersistedQueue.d.ts +72 -3
- package/dist/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/persistence/PersistedQueue.js +142 -29
- package/dist/persistence/PersistedQueue.js.map +1 -1
- package/dist/persistence/RateLimiter.d.ts +12 -2
- package/dist/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/persistence/RateLimiter.js +11 -4
- package/dist/persistence/RateLimiter.js.map +1 -1
- package/dist/process/CommandLine.d.ts +9 -9
- package/dist/process/CommandLine.js +6 -6
- package/dist/process/index.d.ts +1 -1
- package/dist/process/index.js +1 -1
- package/dist/reactivity/Atom.d.ts.map +1 -1
- package/dist/reactivity/Atom.js +24 -3
- package/dist/reactivity/Atom.js.map +1 -1
- package/dist/reactivity/AtomRpc.d.ts +24 -6
- package/dist/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/reactivity/AtomRpc.js.map +1 -1
- package/dist/rpc/OpenRpc.d.ts +384 -0
- package/dist/rpc/OpenRpc.d.ts.map +1 -0
- package/dist/rpc/OpenRpc.js +490 -0
- package/dist/rpc/OpenRpc.js.map +1 -0
- package/dist/rpc/Rpc.d.ts +22 -3
- package/dist/rpc/Rpc.d.ts.map +1 -1
- package/dist/rpc/Rpc.js.map +1 -1
- package/dist/rpc/RpcClient.d.ts +20 -21
- package/dist/rpc/RpcClient.d.ts.map +1 -1
- package/dist/rpc/RpcClient.js.map +1 -1
- package/dist/rpc/RpcServer.d.ts +23 -2
- package/dist/rpc/RpcServer.d.ts.map +1 -1
- package/dist/rpc/RpcServer.js +67 -25
- package/dist/rpc/RpcServer.js.map +1 -1
- package/dist/rpc/index.d.ts +5 -0
- package/dist/rpc/index.d.ts.map +1 -1
- package/dist/rpc/index.js +5 -0
- package/dist/rpc/index.js.map +1 -1
- package/dist/schema/SchemaCompiler/runtime.js +3 -2
- package/dist/schema/SchemaCompiler/runtime.js.map +1 -1
- package/dist/sql/SqlClient.d.ts +59 -6
- package/dist/sql/SqlClient.d.ts.map +1 -1
- package/dist/sql/SqlClient.js +64 -17
- package/dist/sql/SqlClient.js.map +1 -1
- package/dist/sql/Statement.d.ts +1 -1
- package/dist/sql/Statement.d.ts.map +1 -1
- package/dist/sql/Statement.js +9 -16
- package/dist/sql/Statement.js.map +1 -1
- package/dist/testing/TestClock.d.ts +2 -12
- package/dist/testing/TestClock.d.ts.map +1 -1
- package/dist/testing/TestClock.js +179 -169
- package/dist/testing/TestClock.js.map +1 -1
- package/dist/workflow/DurableClock.d.ts +27 -0
- package/dist/workflow/DurableClock.d.ts.map +1 -1
- package/dist/workflow/DurableClock.js +18 -2
- package/dist/workflow/DurableClock.js.map +1 -1
- package/dist/workflow/Workflow.d.ts.map +1 -1
- package/dist/workflow/Workflow.js +5 -4
- package/dist/workflow/Workflow.js.map +1 -1
- package/dist/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/workflow/WorkflowEngine.js +14 -3
- package/dist/workflow/WorkflowEngine.js.map +1 -1
- package/package.json +3 -3
- package/src/DateTime.ts +35 -2
- package/src/Match.ts +10 -8
- package/src/Queue.ts +16 -11
- package/src/Rational.ts +1549 -0
- package/src/RcMap.ts +16 -14
- package/src/Runtime.ts +84 -4
- package/src/Schema.ts +188 -29
- package/src/SchemaAST.ts +29 -13
- package/src/SchemaParser.ts +2 -2
- package/src/SchemaRepresentation.ts +31 -3
- package/src/ScopedCache.ts +18 -1
- package/src/ai/AgUi.ts +485 -0
- package/src/ai/AgUiSchema.ts +1666 -0
- package/src/ai/AgUiServer.ts +451 -0
- package/src/ai/Chat.ts +87 -19
- package/src/ai/LanguageModel.ts +97 -23
- package/src/ai/McpServer.ts +244 -49
- package/src/ai/Prompt.ts +6 -2
- package/src/ai/Response.ts +19 -3
- package/src/ai/Tool.ts +426 -110
- package/src/ai/Toolkit.ts +71 -10
- package/src/ai/WorkloadIdentity.ts +318 -0
- package/src/ai/index.ts +24 -0
- package/src/ai/internal/mcpCore.ts +11 -15
- package/src/ai/internal/mcpProtocol/v2024_11_05.ts +8 -11
- package/src/ai/internal/mcpProtocol/v2025_03_26.ts +8 -11
- package/src/ai/internal/mcpProtocol/v2025_06_18.ts +8 -8
- package/src/ai/internal/mcpProtocol/v2025_11_25.ts +8 -8
- package/src/ai/internal/mcpProtocol/v2026_07_28.ts +76 -55
- package/src/ai/internal/mcpProtocol.ts +22 -3
- package/src/ai/internal/mcpProtocolRegistry.ts +5 -0
- package/src/ai/internal/mcpRuntime.ts +4 -2
- package/src/ai/internal/mcpSchema/v2024_11_05.ts +0 -2
- package/src/ai/internal/mcpSchema/v2025_03_26.ts +0 -2
- package/src/ai/internal/mcpSchema/v2025_06_18.ts +0 -2
- package/src/ai/internal/mcpSchema/v2025_11_25.ts +0 -2
- package/src/ai/internal/mcpSchema/v2026_07_28.ts +0 -2
- package/src/ai/internal/mcpSkills.ts +5 -20
- package/src/ai/internal/mcpStatefulRuntime.ts +0 -2
- package/src/ai/internal/structured-output.ts +7 -2
- package/src/cli/Argument.ts +86 -0
- package/src/cli/CliError.ts +7 -4
- package/src/cli/Command.ts +266 -36
- package/src/cli/CommandSpec.ts +508 -0
- package/src/cli/Completions.ts +5 -0
- package/src/cli/Flag.ts +106 -0
- package/src/cli/Param.ts +225 -23
- package/src/cli/index.ts +6 -0
- package/src/cli/internal/command.ts +3 -4
- package/src/cli/internal/completions/bash.ts +9 -7
- package/src/cli/internal/completions/descriptor.ts +37 -5
- package/src/cli/internal/completions/fish.ts +9 -3
- package/src/cli/internal/completions/powershell.ts +2 -1
- package/src/cli/internal/completions/zsh.ts +2 -2
- package/src/cli/internal/lexer.ts +14 -0
- package/src/cli/internal/parser.ts +28 -20
- package/src/cli/internal/wizard.ts +4 -0
- package/src/cluster/ClusterWorkflowEngine.ts +14 -15
- package/src/cluster/Entity.ts +24 -0
- package/src/cluster/MessageRetention.ts +111 -0
- package/src/cluster/MessageStorage.ts +73 -2
- package/src/cluster/ShardingConfig.ts +12 -1
- package/src/cluster/SqlMessageStorage.ts +271 -41
- package/src/cluster/index.ts +6 -0
- package/src/encoding/Base64.ts +26 -5
- package/src/encoding/Base64Url.ts +93 -10
- package/src/encoding/Csv.ts +11 -5
- package/src/encoding/Hex.ts +56 -42
- package/src/encoding/SchemaBinary.ts +76 -5
- package/src/encoding/Xml.ts +65 -16
- package/src/graphql/GraphQL.ts +7 -4
- package/src/http/Headers.ts +7 -2
- package/src/http/HttpClient.ts +118 -68
- package/src/http/HttpClientError.ts +82 -15
- package/src/http/HttpEffect.ts +101 -10
- package/src/http/HttpMiddleware.ts +15 -4
- package/src/http/HttpServer.ts +80 -0
- package/src/http/HttpServerRequest.ts +1 -19
- package/src/http/HttpStaticServer.ts +10 -16
- package/src/http/internal/requestState.ts +20 -0
- package/src/http-api/HttpApi.ts +80 -0
- package/src/http-api/HttpApiBuilder.ts +20 -2
- package/src/http-api/HttpApiClient.ts +13 -2
- package/src/http-api/HttpApiSchema.ts +90 -3
- package/src/index.ts +6 -0
- package/src/internal/base64.ts +42 -0
- package/src/internal/core.ts +3 -4
- package/src/internal/dateTime.ts +27 -13
- package/src/internal/effect.ts +45 -18
- package/src/internal/equal.ts +8 -0
- package/src/internal/matcher.ts +7 -3
- package/src/internal/schema/codegen.ts +8 -7
- package/src/internal/schema/fromJsonSchemaDocument.ts +175 -35
- package/src/internal/schema/interpreter.ts +10 -10
- package/src/internal/schema/parser.ts +8 -4
- package/src/internal/schema/toCodeDocument.ts +8 -0
- package/src/internal/schema/toEquivalence.ts +7 -5
- package/src/internal/schema/toFormatter.ts +3 -2
- package/src/internal/version.ts +1 -1
- package/src/observability/OtlpMetrics.ts +1 -1
- package/src/observability/OtlpTracer.ts +2 -2
- package/src/persistence/PersistedQueue.ts +199 -41
- package/src/persistence/RateLimiter.ts +17 -5
- package/src/process/CommandLine.ts +10 -10
- package/src/process/index.ts +1 -1
- package/src/reactivity/Atom.ts +25 -3
- package/src/reactivity/AtomRpc.ts +61 -45
- package/src/rpc/OpenRpc.ts +747 -0
- package/src/rpc/Rpc.ts +38 -6
- package/src/rpc/RpcClient.ts +45 -82
- package/src/rpc/RpcServer.ts +77 -28
- package/src/rpc/index.ts +6 -0
- package/src/schema/SchemaCompiler/runtime.ts +8 -3
- package/src/sql/SqlClient.ts +112 -26
- package/src/sql/Statement.ts +19 -23
- package/src/testing/TestClock.ts +204 -189
- package/src/workflow/DurableClock.ts +20 -3
- package/src/workflow/Workflow.ts +5 -3
- package/src/workflow/WorkflowEngine.ts +20 -5
|
@@ -113,10 +113,15 @@ interface ImportedObjectProperty {
|
|
|
113
113
|
interface ImportedObjectScope {
|
|
114
114
|
readonly properties: ReadonlyMap<string, ImportedObjectProperty>
|
|
115
115
|
readonly hasProperties: boolean
|
|
116
|
+
readonly implicitAdditionalProperties: boolean
|
|
116
117
|
readonly patterns: ReadonlyArray<ImportedObjectPattern>
|
|
117
118
|
readonly additionalProperties: ImportedJsonSchemaRepresentation
|
|
118
119
|
}
|
|
119
120
|
|
|
121
|
+
type DefinitionState =
|
|
122
|
+
| { readonly _tag: "Translating"; aliasPath?: Path | undefined }
|
|
123
|
+
| { readonly _tag: "Ready"; readonly value: ImportedJsonSchemaRepresentation }
|
|
124
|
+
|
|
120
125
|
const never: ImportedJsonSchemaRepresentation = { _tag: "Never", checks: [] }
|
|
121
126
|
const unknown: ImportedJsonSchemaRepresentation = { _tag: "Unknown", checks: [] }
|
|
122
127
|
const string: ImportedJsonSchemaRepresentation = { _tag: "String", checks: [] }
|
|
@@ -229,6 +234,23 @@ function addNumberCheck(
|
|
|
229
234
|
}
|
|
230
235
|
}
|
|
231
236
|
|
|
237
|
+
function hasReferences(schema: unknown): boolean {
|
|
238
|
+
if (!isObject(schema)) return false
|
|
239
|
+
if (typeof schema.$ref === "string" || typeof schema.$dynamicRef === "string") return true
|
|
240
|
+
return Object.entries(schema).some(([keyword, value]) => {
|
|
241
|
+
switch (InternalJsonSchema.getSubschemaKind(keyword)) {
|
|
242
|
+
case "schema":
|
|
243
|
+
return hasReferences(value)
|
|
244
|
+
case "array":
|
|
245
|
+
return Array.isArray(value) && value.some(hasReferences)
|
|
246
|
+
case "map":
|
|
247
|
+
return isObject(value) && Object.values(value).some(hasReferences)
|
|
248
|
+
default:
|
|
249
|
+
return false
|
|
250
|
+
}
|
|
251
|
+
})
|
|
252
|
+
}
|
|
253
|
+
|
|
232
254
|
function jsonSchemaAnnotations(
|
|
233
255
|
schema: JsonSchema.JsonSchema,
|
|
234
256
|
options: SchemaRepresentation.FromJsonSchemaOptions | undefined
|
|
@@ -243,7 +265,10 @@ function jsonSchemaAnnotations(
|
|
|
243
265
|
if (typeof schema.format === "string") annotations.format = schema.format
|
|
244
266
|
if (typeof schema.contentEncoding === "string") annotations.contentEncoding = schema.contentEncoding
|
|
245
267
|
if (typeof schema.contentMediaType === "string") annotations.contentMediaType = schema.contentMediaType
|
|
246
|
-
|
|
268
|
+
// Referenced definitions are not retained by the annotation.
|
|
269
|
+
if (InternalAST.isJson(schema.contentSchema) && !hasReferences(schema.contentSchema)) {
|
|
270
|
+
annotations.contentSchema = schema.contentSchema
|
|
271
|
+
}
|
|
247
272
|
let customAnnotations: Schema.Annotations.Annotations | undefined
|
|
248
273
|
if (options?.includeAnnotationKey !== undefined) {
|
|
249
274
|
for (const key of Object.keys(schema)) {
|
|
@@ -265,7 +290,11 @@ export function fromJsonSchemaMultiDocument(
|
|
|
265
290
|
options?: SchemaRepresentation.FromJsonSchemaOptions,
|
|
266
291
|
singleRoot = false
|
|
267
292
|
): readonly [Schema.Top, ...Array<Schema.Top>] {
|
|
268
|
-
const definitionCache = new Map<string,
|
|
293
|
+
const definitionCache = new Map<string, DefinitionState>()
|
|
294
|
+
const activeIntersections = new Map<
|
|
295
|
+
string | ImportedJsonSchemaRepresentation,
|
|
296
|
+
Set<string | ImportedJsonSchemaRepresentation>
|
|
297
|
+
>()
|
|
269
298
|
const validatedAliases = new Set<string>()
|
|
270
299
|
const resolvingChoices = new Set<string>()
|
|
271
300
|
const references = new Map<string, ReferenceSlot>()
|
|
@@ -327,7 +356,10 @@ export function fromJsonSchemaMultiDocument(
|
|
|
327
356
|
const type = finalize(property.type)
|
|
328
357
|
InternalRecord.assignProperty(fields, property.name, property.isOptional ? Schema.optionalKey(type) : type)
|
|
329
358
|
}
|
|
330
|
-
const index = input.
|
|
359
|
+
const index = options?.closeObjects && input.scopes.some((scope) => scope.hasProperties) &&
|
|
360
|
+
input.scopes.every((scope) => scope.implicitAdditionalProperties)
|
|
361
|
+
? undefined
|
|
362
|
+
: input.indexSignatures[0]
|
|
331
363
|
const record = index === undefined
|
|
332
364
|
? undefined
|
|
333
365
|
: Schema.Record(finalize(index.parameter) as Schema.Record.Key, finalize(index.type))
|
|
@@ -370,6 +402,12 @@ export function fromJsonSchemaMultiDocument(
|
|
|
370
402
|
}
|
|
371
403
|
}
|
|
372
404
|
|
|
405
|
+
function withoutExamples(representation: ImportedJsonSchemaRepresentation): ImportedJsonSchemaRepresentation {
|
|
406
|
+
if (representation.annotations?.examples === undefined) return representation
|
|
407
|
+
const { examples: _, ...annotations } = representation.annotations
|
|
408
|
+
return { ...representation, annotations: Object.keys(annotations).length === 0 ? undefined : annotations }
|
|
409
|
+
}
|
|
410
|
+
|
|
373
411
|
function translateDefinition(
|
|
374
412
|
key: string,
|
|
375
413
|
path: Path,
|
|
@@ -377,28 +415,36 @@ export function fromJsonSchemaMultiDocument(
|
|
|
377
415
|
): ImportedJsonSchemaRepresentation {
|
|
378
416
|
const cached = definitionCache.get(key)
|
|
379
417
|
if (cached !== undefined) {
|
|
380
|
-
if (cached ===
|
|
418
|
+
if (cached._tag === "Translating") {
|
|
381
419
|
throw errorWithPath(
|
|
382
420
|
recursiveReferenceError ??
|
|
383
|
-
`
|
|
421
|
+
`Cannot resolve recursive definition ${JSON.stringify(key)} during normalization.`,
|
|
384
422
|
[...path, "$ref"]
|
|
385
423
|
)
|
|
386
424
|
}
|
|
387
|
-
return cached
|
|
425
|
+
return cached.value
|
|
388
426
|
}
|
|
389
|
-
|
|
427
|
+
const state: DefinitionState = { _tag: "Translating" }
|
|
428
|
+
definitionCache.set(key, state)
|
|
390
429
|
const pointer = pointers.get(key)
|
|
391
430
|
const wasInNestedResource = inNestedResource
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
431
|
+
try {
|
|
432
|
+
if (pointer !== undefined) inNestedResource = pointer.crossesResource
|
|
433
|
+
const representation = pointer === undefined
|
|
434
|
+
? translateSchema(document.definitions[key], ["definitions", key])
|
|
435
|
+
: translateSchema(pointer.target, ["definitions", ...pointer.tokens])
|
|
436
|
+
definitionCache.set(key, { _tag: "Ready", value: representation })
|
|
437
|
+
if (pointer !== undefined || state.aliasPath !== undefined) {
|
|
438
|
+
validatePointerAliases(representation, state.aliasPath ?? path, recursiveReferenceError)
|
|
439
|
+
}
|
|
440
|
+
return representation
|
|
441
|
+
} catch (error) {
|
|
442
|
+
definitionCache.delete(key)
|
|
443
|
+
validatedAliases.delete(key)
|
|
444
|
+
throw error
|
|
445
|
+
} finally {
|
|
446
|
+
inNestedResource = wasInNestedResource
|
|
400
447
|
}
|
|
401
|
-
return representation
|
|
402
448
|
}
|
|
403
449
|
|
|
404
450
|
function validatePointerAliases(
|
|
@@ -648,7 +694,10 @@ export function fromJsonSchemaMultiDocument(
|
|
|
648
694
|
for (const name of scope.properties.keys()) names.add(name)
|
|
649
695
|
hasFiniteKeyDomain ||= scope.additionalProperties._tag === "Never" && scope.patterns.length === 0
|
|
650
696
|
requiresFiniteKeyDomain ||= scope.additionalProperties._tag === "Never" ||
|
|
651
|
-
scope.additionalProperties._tag !== "Unknown" && (scope.
|
|
697
|
+
scope.additionalProperties._tag !== "Unknown" && (scope.patterns.length > 0 ||
|
|
698
|
+
Array.from(scope.properties.values()).some((property) =>
|
|
699
|
+
property.type !== undefined && !isCoveredBy(property.type, scope.additionalProperties)
|
|
700
|
+
))
|
|
652
701
|
}
|
|
653
702
|
const closedPattern = scopes.length === 1 && names.size === 0 &&
|
|
654
703
|
scopes[0].additionalProperties._tag === "Never" && scopes[0].patterns.length === 1
|
|
@@ -713,6 +762,23 @@ export function fromJsonSchemaMultiDocument(
|
|
|
713
762
|
const jsonRootTags = ["Null", "String", "Number", "Boolean", "Objects", "Arrays"] as const
|
|
714
763
|
const allMasks = (1 << jsonRootTags.length) - 1
|
|
715
764
|
|
|
765
|
+
// A catch-all can also validate declared properties when it cannot narrow them.
|
|
766
|
+
function isCoveredBy(type: ImportedJsonSchemaRepresentation, covering: ImportedJsonSchemaRepresentation): boolean {
|
|
767
|
+
if (covering._tag === "Unknown" || type._tag === "Never" || type === covering) return true
|
|
768
|
+
if (type._tag === "Union") return type.types.every((member) => isCoveredBy(member, covering))
|
|
769
|
+
if (covering._tag === "Reference") return type._tag === "Reference" && type.$ref === covering.$ref
|
|
770
|
+
if (covering._tag === "Union") {
|
|
771
|
+
return covering.options?.mode !== "oneOf" && covering.checks.length === 0 &&
|
|
772
|
+
covering.types.some((member) => isCoveredBy(type, member))
|
|
773
|
+
}
|
|
774
|
+
return (covering._tag === "Null" || covering._tag === "String" || covering._tag === "Number" ||
|
|
775
|
+
covering._tag === "Boolean") &&
|
|
776
|
+
covering.checks.every((check) =>
|
|
777
|
+
check._tag === "Filter" && check.filter.annotations?.representation?.id === "effect/schema/isFinite"
|
|
778
|
+
) &&
|
|
779
|
+
(type._tag === covering._tag || type._tag === "Literal" && (rootMask(type) & rootMask(covering)) !== 0)
|
|
780
|
+
}
|
|
781
|
+
|
|
716
782
|
function rootMask(representation: ImportedJsonSchemaRepresentation): number {
|
|
717
783
|
switch (representation._tag) {
|
|
718
784
|
case "Never":
|
|
@@ -748,11 +814,13 @@ export function fromJsonSchemaMultiDocument(
|
|
|
748
814
|
case "Reference": {
|
|
749
815
|
const key = representation.$ref
|
|
750
816
|
const cached = definitionCache.get(key)
|
|
751
|
-
if (cached ===
|
|
817
|
+
if (cached?._tag === "Translating" || resolvingChoices.has(key)) return true
|
|
752
818
|
resolvingChoices.add(key)
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
819
|
+
try {
|
|
820
|
+
return hasChoices(cached?.value ?? translateDefinition(key, representation.path))
|
|
821
|
+
} finally {
|
|
822
|
+
resolvingChoices.delete(key)
|
|
823
|
+
}
|
|
756
824
|
}
|
|
757
825
|
case "Union":
|
|
758
826
|
// Finite primitive literal sets intersect without expansion, so they can be duplicated across branches.
|
|
@@ -831,13 +899,12 @@ export function fromJsonSchemaMultiDocument(
|
|
|
831
899
|
path: Path,
|
|
832
900
|
unionOnLeft: boolean
|
|
833
901
|
): ImportedJsonSchemaRepresentation {
|
|
834
|
-
const mask = rootMask(type)
|
|
835
902
|
const members = union.types
|
|
836
903
|
.map((member, index) => ({
|
|
837
904
|
index,
|
|
838
905
|
type: member
|
|
839
906
|
}))
|
|
840
|
-
.filter((member) => (
|
|
907
|
+
.filter((member) => !areDisjoint(member.type, type))
|
|
841
908
|
if (members.length > 1 && hasChoices(type)) {
|
|
842
909
|
return unsupportedIntersection(path)
|
|
843
910
|
}
|
|
@@ -847,6 +914,13 @@ export function fromJsonSchemaMultiDocument(
|
|
|
847
914
|
? intersect(member, type, [...path, "types", members[0].index])
|
|
848
915
|
: intersect(type, member, [...path, "types", members[0].index])
|
|
849
916
|
}
|
|
917
|
+
// Resolve the reference without changing the union's matching mode.
|
|
918
|
+
if (members.length > 1 && type._tag === "Reference") {
|
|
919
|
+
const resolved = annotate(resolveReference(type, path), type)
|
|
920
|
+
const out = intersectUnionWithType(union, withoutExamples(resolved), path, unionOnLeft)
|
|
921
|
+
const examples = resolved.annotations?.examples
|
|
922
|
+
return examples === undefined ? out : annotate(out, { annotations: { examples } })
|
|
923
|
+
}
|
|
850
924
|
return makeUnion(
|
|
851
925
|
union,
|
|
852
926
|
members
|
|
@@ -859,12 +933,33 @@ export function fromJsonSchemaMultiDocument(
|
|
|
859
933
|
)
|
|
860
934
|
}
|
|
861
935
|
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
936
|
+
// Prove disjointness without intersecting (and potentially expanding) branches.
|
|
937
|
+
function areDisjoint(left: ImportedJsonSchemaRepresentation, right: ImportedJsonSchemaRepresentation): boolean {
|
|
938
|
+
if ((rootMask(left) & rootMask(right)) === 0) return true
|
|
939
|
+
if (left._tag === "Reference" && definitionCache.get(left.$ref)?._tag !== "Translating") {
|
|
940
|
+
left = resolveReference(left, left.path)
|
|
941
|
+
}
|
|
942
|
+
if (right._tag === "Reference" && definitionCache.get(right.$ref)?._tag !== "Translating") {
|
|
943
|
+
right = resolveReference(right, right.path)
|
|
944
|
+
}
|
|
945
|
+
if ((rootMask(left) & rootMask(right)) === 0) return true
|
|
946
|
+
if (left._tag !== "Objects" || right._tag !== "Objects") return false
|
|
947
|
+
const rightProperties = right.propertySignatures
|
|
948
|
+
return left.propertySignatures.some((property) => {
|
|
949
|
+
if (property.isOptional) return false
|
|
950
|
+
const value = literalValue(property.type)
|
|
951
|
+
if (value === undefined) return false
|
|
952
|
+
const other = rightProperties.find((other) => other.name === property.name && !other.isOptional)
|
|
953
|
+
const otherValue = other === undefined ? undefined : literalValue(other.type)
|
|
954
|
+
return otherValue !== undefined && value !== otherValue
|
|
955
|
+
})
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
function isDisjointUnion(union: ImportedUnion): boolean {
|
|
959
|
+
for (let index = 0; index < union.types.length; index++) {
|
|
960
|
+
for (let other = 0; other < index; other++) {
|
|
961
|
+
if (!areDisjoint(union.types[index], union.types[other])) return false
|
|
962
|
+
}
|
|
868
963
|
}
|
|
869
964
|
return true
|
|
870
965
|
}
|
|
@@ -885,8 +980,8 @@ export function fromJsonSchemaMultiDocument(
|
|
|
885
980
|
const partitionTypes = partition.types
|
|
886
981
|
const otherTypes = other.types
|
|
887
982
|
for (const type of otherTypes) {
|
|
888
|
-
const
|
|
889
|
-
if (
|
|
983
|
+
const matches = partitionTypes.filter((member) => !areDisjoint(member, type)).length
|
|
984
|
+
if (matches > 1 && hasChoices(type)) {
|
|
890
985
|
return unsupportedIntersection(path)
|
|
891
986
|
}
|
|
892
987
|
}
|
|
@@ -906,8 +1001,8 @@ export function fromJsonSchemaMultiDocument(
|
|
|
906
1001
|
): ImportedJsonSchemaRepresentation {
|
|
907
1002
|
const literals = intersectLiteralUnions(left, right, path)
|
|
908
1003
|
if (literals !== undefined) return literals
|
|
909
|
-
if (
|
|
910
|
-
if (
|
|
1004
|
+
if (isDisjointUnion(left)) return intersectPartition(left, right, path, true)
|
|
1005
|
+
if (isDisjointUnion(right)) return intersectPartition(right, left, path, false)
|
|
911
1006
|
return unsupportedIntersection(path)
|
|
912
1007
|
}
|
|
913
1008
|
|
|
@@ -915,11 +1010,41 @@ export function fromJsonSchemaMultiDocument(
|
|
|
915
1010
|
left: ImportedJsonSchemaRepresentation,
|
|
916
1011
|
right: ImportedJsonSchemaRepresentation,
|
|
917
1012
|
path: Path
|
|
1013
|
+
): ImportedJsonSchemaRepresentation {
|
|
1014
|
+
// Annotation propagation can copy a reference without changing its definition.
|
|
1015
|
+
const leftKey = left._tag === "Reference" ? left.$ref : left
|
|
1016
|
+
const rightKey = right._tag === "Reference" ? right.$ref : right
|
|
1017
|
+
let active = activeIntersections.get(leftKey)
|
|
1018
|
+
if (active === undefined) {
|
|
1019
|
+
active = new Set()
|
|
1020
|
+
activeIntersections.set(leftKey, active)
|
|
1021
|
+
}
|
|
1022
|
+
if (active.has(rightKey)) throw errorWithPath("Cannot normalize this recursive intersection.", path)
|
|
1023
|
+
active.add(rightKey)
|
|
1024
|
+
try {
|
|
1025
|
+
return intersectNodes(left, right, path)
|
|
1026
|
+
} finally {
|
|
1027
|
+
active.delete(rightKey)
|
|
1028
|
+
if (active.size === 0) activeIntersections.delete(leftKey)
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
function intersectNodes(
|
|
1033
|
+
left: ImportedJsonSchemaRepresentation,
|
|
1034
|
+
right: ImportedJsonSchemaRepresentation,
|
|
1035
|
+
path: Path
|
|
918
1036
|
): ImportedJsonSchemaRepresentation {
|
|
919
1037
|
if (left._tag === "Never") return left
|
|
920
1038
|
if (right._tag === "Never") return right
|
|
921
1039
|
if (left._tag === "Unknown") return annotateIntersection(right, left, right)
|
|
922
1040
|
if (right._tag === "Unknown") return annotateIntersection(left, left, right)
|
|
1041
|
+
if (left._tag === "Reference" && right._tag === "Reference" && left.$ref === right.$ref) {
|
|
1042
|
+
// Identity does not need the body, but its aliases must be checked once the body is ready.
|
|
1043
|
+
const state = definitionCache.get(left.$ref)
|
|
1044
|
+
if (state?._tag === "Translating") state.aliasPath ??= path
|
|
1045
|
+
else validatePointerAliases(left, path)
|
|
1046
|
+
return annotateIntersection(left, left, right)
|
|
1047
|
+
}
|
|
923
1048
|
if (left._tag === "Reference") {
|
|
924
1049
|
// Resolve an unannotated reference first. An annotated empty definition
|
|
925
1050
|
// could otherwise leave the other reference unresolved during union partitioning.
|
|
@@ -934,6 +1059,12 @@ export function fromJsonSchemaMultiDocument(
|
|
|
934
1059
|
if (right._tag === "Reference") {
|
|
935
1060
|
return annotate(intersect(left, resolveReference(right, path), path), right)
|
|
936
1061
|
}
|
|
1062
|
+
// Operand examples describe the whole intersection, not each distributed branch.
|
|
1063
|
+
const examples = right.annotations?.examples ?? left.annotations?.examples
|
|
1064
|
+
if (examples !== undefined && (left._tag === "Union" || right._tag === "Union")) {
|
|
1065
|
+
const out = intersectNodes(withoutExamples(left), withoutExamples(right), path)
|
|
1066
|
+
return annotate(out, { annotations: { examples } })
|
|
1067
|
+
}
|
|
937
1068
|
if (left._tag === "Union" && right._tag === "Union") return intersectUnions(left, right, path)
|
|
938
1069
|
if (left._tag === "Union") return intersectUnionWithType(left, right, path, true)
|
|
939
1070
|
if (right._tag === "Union") return intersectUnionWithType(right, left, path, false)
|
|
@@ -1272,13 +1403,22 @@ export function fromJsonSchemaMultiDocument(
|
|
|
1272
1403
|
isOptional: !required.has(name)
|
|
1273
1404
|
}]))
|
|
1274
1405
|
const hasProperties = propertyNames.length > 0
|
|
1406
|
+
const implicitAdditionalProperties = schema.additionalProperties === undefined
|
|
1275
1407
|
const patterns: Array<ImportedObjectPattern> = []
|
|
1276
1408
|
if (
|
|
1277
1409
|
isObject(schema.patternProperties)
|
|
1278
1410
|
) {
|
|
1279
1411
|
for (const [pattern, value] of Object.entries(schema.patternProperties)) {
|
|
1280
1412
|
const check = importPatternCheck(pattern, [...path, "patternProperties", pattern])
|
|
1281
|
-
if (check === undefined)
|
|
1413
|
+
if (check === undefined) {
|
|
1414
|
+
return {
|
|
1415
|
+
properties,
|
|
1416
|
+
hasProperties,
|
|
1417
|
+
implicitAdditionalProperties: false,
|
|
1418
|
+
patterns: [],
|
|
1419
|
+
additionalProperties: unknown
|
|
1420
|
+
}
|
|
1421
|
+
}
|
|
1282
1422
|
patterns.push({
|
|
1283
1423
|
source: pattern,
|
|
1284
1424
|
parameter: {
|
|
@@ -1294,7 +1434,7 @@ export function fromJsonSchemaMultiDocument(
|
|
|
1294
1434
|
: isObject(schema.additionalProperties)
|
|
1295
1435
|
? translateSchema(schema.additionalProperties, [...path, "additionalProperties"])
|
|
1296
1436
|
: unknown
|
|
1297
|
-
return { properties, hasProperties, patterns, additionalProperties }
|
|
1437
|
+
return { properties, hasProperties, implicitAdditionalProperties, patterns, additionalProperties }
|
|
1298
1438
|
}
|
|
1299
1439
|
|
|
1300
1440
|
function collectObjectChecks(
|
|
@@ -19,7 +19,7 @@ const flatMapTransformation = (
|
|
|
19
19
|
current: unknown,
|
|
20
20
|
f: (value: unknown) => Effect.Effect<unknown, SchemaIssue.Issue, unknown>
|
|
21
21
|
): Effect.Effect<unknown, SchemaIssue.Issue, unknown> =>
|
|
22
|
-
|
|
22
|
+
InternalParser.isSameExit(result) ? f(current) : Effect.flatMapEager(result, f)
|
|
23
23
|
|
|
24
24
|
function compileTransformation(transformation: SchemaAST.Link["transformation"]): ApplyTransformation {
|
|
25
25
|
const apply = compileTransformationUnsafe(transformation)
|
|
@@ -35,7 +35,7 @@ function compileTransformation(transformation: SchemaAST.Link["transformation"])
|
|
|
35
35
|
function compileTransformationUnsafe(transformation: SchemaAST.Link["transformation"]): ApplyTransformation {
|
|
36
36
|
if (transformation._tag === "Middleware") {
|
|
37
37
|
return (result, current, options) => {
|
|
38
|
-
const transformed =
|
|
38
|
+
const transformed = InternalParser.isSameExit(result)
|
|
39
39
|
? transformation.decode(InternalParser.succeed(InternalParser.toOption(current)), options)
|
|
40
40
|
: transformation.decode(Effect.mapEager(result, InternalParser.toOption), options)
|
|
41
41
|
return fromOptionalEffect(transformed)
|
|
@@ -45,7 +45,7 @@ function compileTransformationUnsafe(transformation: SchemaAST.Link["transformat
|
|
|
45
45
|
const getter = transformation.decode
|
|
46
46
|
switch (getter._tag) {
|
|
47
47
|
case "Passthrough":
|
|
48
|
-
return (result, current) =>
|
|
48
|
+
return (result, current) => InternalParser.isSameExit(result) ? InternalParser.succeed(current) : result
|
|
49
49
|
case "Transform": {
|
|
50
50
|
const transform = (value: unknown) =>
|
|
51
51
|
value === InternalParser.missing
|
|
@@ -109,13 +109,13 @@ function withDefault(ast: SchemaAST.AST, parser: Parser): Parser {
|
|
|
109
109
|
const result = defaultValue
|
|
110
110
|
if (effectIsExit(result) && result._tag === "Success") {
|
|
111
111
|
const local = parser((result as InternalParser.Success<unknown>)[InternalParser.args], options)
|
|
112
|
-
return
|
|
112
|
+
return InternalParser.isSameExit(local) ? result : local
|
|
113
113
|
}
|
|
114
114
|
return Effect.flatMapEager(
|
|
115
115
|
wrapEncoding(ast, input, options, result),
|
|
116
116
|
(value) => {
|
|
117
117
|
const local = parser(value, options)
|
|
118
|
-
return
|
|
118
|
+
return InternalParser.isSameExit(local) ? InternalParser.succeed(value) : local
|
|
119
119
|
}
|
|
120
120
|
)
|
|
121
121
|
}
|
|
@@ -161,7 +161,7 @@ export function compile(
|
|
|
161
161
|
if (encodingChecks && !options.disableChecks) {
|
|
162
162
|
if (effectIsExit(result)) {
|
|
163
163
|
if (result._tag === "Success") {
|
|
164
|
-
const output =
|
|
164
|
+
const output = InternalParser.isSameExit(result)
|
|
165
165
|
? input
|
|
166
166
|
: (result as InternalParser.Success<unknown, SchemaIssue.Issue>)[InternalParser.args]
|
|
167
167
|
if (input !== InternalParser.missing && output !== InternalParser.missing) {
|
|
@@ -187,7 +187,7 @@ export function compile(
|
|
|
187
187
|
if (checks && !options.disableChecks) {
|
|
188
188
|
if (effectIsExit(result)) {
|
|
189
189
|
if (result._tag === "Success") {
|
|
190
|
-
const value =
|
|
190
|
+
const value = InternalParser.isSameExit(result)
|
|
191
191
|
? input
|
|
192
192
|
: (result as InternalParser.Success<unknown, SchemaIssue.Issue>)[InternalParser.args]
|
|
193
193
|
if (value === InternalParser.missing) return result
|
|
@@ -235,7 +235,7 @@ export function compile(
|
|
|
235
235
|
} else {
|
|
236
236
|
result = Effect.flatMapEager(result, (value) => {
|
|
237
237
|
const nextResult = next(value, options)
|
|
238
|
-
return
|
|
238
|
+
return InternalParser.isSameExit(nextResult) ? InternalParser.succeed(value) : nextResult
|
|
239
239
|
})
|
|
240
240
|
}
|
|
241
241
|
}
|
|
@@ -243,12 +243,12 @@ export function compile(
|
|
|
243
243
|
if ((result as Exit.Exit<unknown, unknown>)._tag === "Success") {
|
|
244
244
|
const value = (result as InternalParser.Success<unknown, SchemaIssue.Issue>)[InternalParser.args]
|
|
245
245
|
const local = parseLocal(value, options)
|
|
246
|
-
return
|
|
246
|
+
return InternalParser.isSameExit(local) ? result : local
|
|
247
247
|
}
|
|
248
248
|
result = wrapEncoding(ast, input, options, result)
|
|
249
249
|
return Effect.flatMapEager(result, (value) => {
|
|
250
250
|
const local = parseLocal(value, options)
|
|
251
|
-
return
|
|
251
|
+
return InternalParser.isSameExit(local) ? InternalParser.succeed(value) : local
|
|
252
252
|
})
|
|
253
253
|
}
|
|
254
254
|
}
|
|
@@ -3,7 +3,7 @@ import * as Option from "../../Option.ts"
|
|
|
3
3
|
import { args } from "../core.ts"
|
|
4
4
|
|
|
5
5
|
/** @internal */
|
|
6
|
-
export const missing = Symbol()
|
|
6
|
+
export const missing: unique symbol = Symbol.for("effect/schema/parser/missing")
|
|
7
7
|
|
|
8
8
|
/** @internal */
|
|
9
9
|
export { args }
|
|
@@ -17,10 +17,14 @@ export const succeed = Exit.succeed as <A>(value: A) => Success<A>
|
|
|
17
17
|
/** @internal */
|
|
18
18
|
export const missingExit = succeed(missing)
|
|
19
19
|
|
|
20
|
-
//
|
|
21
|
-
//
|
|
20
|
+
// Cached success for an unchanged input. The missing symbol also brands the
|
|
21
|
+
// result so module copies can recognize it without sharing the Exit object.
|
|
22
|
+
// Resolve it before crossing an asynchronous or transformation boundary.
|
|
22
23
|
/** @internal */
|
|
23
|
-
export const sameExit: Success<unknown> = succeed(missing)
|
|
24
|
+
export const sameExit: Success<unknown> = Object.assign(succeed(missing), { [missing]: true })
|
|
25
|
+
|
|
26
|
+
/** @internal */
|
|
27
|
+
export const isSameExit = (result: object): boolean => (result as { readonly [missing]?: boolean })[missing] === true
|
|
24
28
|
|
|
25
29
|
/** @internal */
|
|
26
30
|
export const toOption = <A>(value: A): Option.Option<A> => value === missing ? Option.none() : Option.some(value as A)
|
|
@@ -43,6 +43,14 @@ function renderEmittableAnnotation(input: unknown): string | undefined {
|
|
|
43
43
|
return `[${values.join(", ")}]`
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
const prototype = Object.getPrototypeOf(input)
|
|
47
|
+
// Plain objects from other realms also have a prototype whose prototype is null.
|
|
48
|
+
if (
|
|
49
|
+
prototype !== null &&
|
|
50
|
+
prototype !== Object.prototype &&
|
|
51
|
+
Object.getPrototypeOf(prototype) !== null
|
|
52
|
+
) return undefined
|
|
53
|
+
|
|
46
54
|
const entries: Array<string> = []
|
|
47
55
|
for (const [key, value] of Object.entries(input)) {
|
|
48
56
|
const rendered = renderEmittableAnnotation(value)
|
|
@@ -8,10 +8,12 @@ import * as SchemaAST from "../../SchemaAST.ts"
|
|
|
8
8
|
import * as SchemaParser from "../../SchemaParser.ts"
|
|
9
9
|
import * as InternalAnnotations from "./annotations.ts"
|
|
10
10
|
|
|
11
|
+
const recurMemo = memoize(recur)
|
|
12
|
+
|
|
11
13
|
/** @internal */
|
|
12
|
-
export const toEquivalence =
|
|
13
|
-
return
|
|
14
|
-
}
|
|
14
|
+
export const toEquivalence = (ast: SchemaAST.AST): Equivalence.Equivalence<any> => {
|
|
15
|
+
return recurMemo(SchemaAST.toType(ast))
|
|
16
|
+
}
|
|
15
17
|
|
|
16
18
|
function recur(ast: SchemaAST.AST): Equivalence.Equivalence<any> {
|
|
17
19
|
// ---------------------------------------------
|
|
@@ -135,9 +137,9 @@ function recur(ast: SchemaAST.AST): Equivalence.Equivalence<any> {
|
|
|
135
137
|
})
|
|
136
138
|
}
|
|
137
139
|
case "Union": {
|
|
138
|
-
const types =
|
|
140
|
+
const types = ast.types
|
|
139
141
|
const index = SchemaAST.getCandidateIndex(types)
|
|
140
|
-
const compiled = types.map((candidate
|
|
142
|
+
const compiled = types.map((candidate) => [SchemaParser._is(candidate), recur(candidate)] as const)
|
|
141
143
|
return Equivalence.make((a, b) => {
|
|
142
144
|
const candidates = index(a, false)
|
|
143
145
|
for (let i = 0; i < candidates.length; i++) {
|
|
@@ -40,6 +40,7 @@ export function toFormatter<T>(ast: SchemaAST.AST, options?: {
|
|
|
40
40
|
return recur(ast)
|
|
41
41
|
|
|
42
42
|
function recur(ast: SchemaAST.AST): Formatter<any> {
|
|
43
|
+
ast = SchemaAST.toType(ast)
|
|
43
44
|
let formatter = compiled.get(ast)
|
|
44
45
|
if (formatter === undefined) {
|
|
45
46
|
formatter = compile(ast)
|
|
@@ -216,9 +217,9 @@ export function toFormatter<T>(ast: SchemaAST.AST, options?: {
|
|
|
216
217
|
}
|
|
217
218
|
}
|
|
218
219
|
case "Union": {
|
|
219
|
-
const types =
|
|
220
|
+
const types = ast.types
|
|
220
221
|
const index = SchemaAST.getCandidateIndex(types)
|
|
221
|
-
const compiled = types.map((candidate
|
|
222
|
+
const compiled = types.map((candidate) => [SchemaParser._is(candidate), recur(candidate)] as const)
|
|
222
223
|
return (value) => {
|
|
223
224
|
const candidates = index(value, false)
|
|
224
225
|
for (let i = 0; i < candidates.length; i++) {
|
package/src/internal/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** @internal */
|
|
2
|
-
export const version = "4.1.
|
|
2
|
+
export const version = "4.1.4"
|
|
@@ -530,7 +530,7 @@ const ucumUnits = new Map([
|
|
|
530
530
|
["bytes", "By"]
|
|
531
531
|
])
|
|
532
532
|
|
|
533
|
-
const toUcumUnit = (unit
|
|
533
|
+
const toUcumUnit = (unit = ""): string => ucumUnits.get(unit) ?? unit
|
|
534
534
|
|
|
535
535
|
/** OTLP/JSON accepts int64 as a decimal string, which keeps values beyond 2^53 exact */
|
|
536
536
|
const bigintToInt64 = (value: bigint): number | string =>
|
|
@@ -328,7 +328,7 @@ const makeOtlpSpan = (self: SpanImpl): OtlpSpan => {
|
|
|
328
328
|
let otelStatus: Status
|
|
329
329
|
|
|
330
330
|
if (status.exit._tag === "Success") {
|
|
331
|
-
otelStatus = { code: StatusCode.
|
|
331
|
+
otelStatus = { code: StatusCode.Unset }
|
|
332
332
|
} else if (Cause.hasInterruptsOnly(status.exit.cause)) {
|
|
333
333
|
otelStatus = { code: StatusCode.Unset }
|
|
334
334
|
attributes.push({
|
|
@@ -341,7 +341,7 @@ const makeOtlpSpan = (self: SpanImpl): OtlpSpan => {
|
|
|
341
341
|
})
|
|
342
342
|
otelStatus = errors.length > 0
|
|
343
343
|
? { code: StatusCode.Error, message: errors[0].message }
|
|
344
|
-
: { code: StatusCode.
|
|
344
|
+
: { code: StatusCode.Unset }
|
|
345
345
|
for (const error of errors) {
|
|
346
346
|
events.push({
|
|
347
347
|
name: "exception",
|