effect 4.0.6 → 4.1.0
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/README.md +1 -1
- package/dist/Arbitrary.d.ts +10 -2
- package/dist/Arbitrary.d.ts.map +1 -1
- package/dist/Arbitrary.js +2 -1
- package/dist/Arbitrary.js.map +1 -1
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +3 -0
- package/dist/BigDecimal.js.map +1 -1
- package/dist/Channel.d.ts +12 -6
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +30 -9
- package/dist/Channel.js.map +1 -1
- package/dist/Config.d.ts +7 -1
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js.map +1 -1
- package/dist/Context.d.ts +18 -1
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js +27 -8
- package/dist/Context.js.map +1 -1
- package/dist/Cron.d.ts +81 -11
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +101 -26
- package/dist/Cron.js.map +1 -1
- package/dist/Data.d.ts +54 -235
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js.map +1 -1
- package/dist/Duration.d.ts +78 -0
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +123 -0
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +165 -8
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +12 -2
- package/dist/Effect.js.map +1 -1
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +8 -1
- package/dist/Equal.js.map +1 -1
- package/dist/Exit.d.ts +3 -3
- package/dist/Exit.d.ts.map +1 -1
- package/dist/Exit.js.map +1 -1
- package/dist/FileSystem.d.ts +59 -4
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +9 -2
- package/dist/FileSystem.js.map +1 -1
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js +27 -13
- package/dist/Formatter.js.map +1 -1
- package/dist/Glob.d.ts +165 -0
- package/dist/Glob.d.ts.map +1 -0
- package/dist/Glob.js +127 -0
- package/dist/Glob.js.map +1 -0
- package/dist/Hash.d.ts.map +1 -1
- package/dist/Hash.js +4 -1
- package/dist/Hash.js.map +1 -1
- package/dist/JsonPatch.js +4 -0
- package/dist/JsonPatch.js.map +1 -1
- package/dist/JsonSchema.d.ts.map +1 -1
- package/dist/JsonSchema.js +13 -40
- package/dist/JsonSchema.js.map +1 -1
- package/dist/Match.d.ts +86 -0
- package/dist/Match.d.ts.map +1 -1
- package/dist/Match.js +72 -0
- package/dist/Match.js.map +1 -1
- package/dist/Metric.d.ts +3 -3
- package/dist/MutableList.d.ts +5 -2
- package/dist/MutableList.d.ts.map +1 -1
- package/dist/MutableList.js +7 -5
- package/dist/MutableList.js.map +1 -1
- package/dist/MutableRef.d.ts.map +1 -1
- package/dist/MutableRef.js +7 -0
- package/dist/MutableRef.js.map +1 -1
- package/dist/PartitionedSemaphore.d.ts +2 -1
- package/dist/PartitionedSemaphore.d.ts.map +1 -1
- package/dist/PartitionedSemaphore.js +22 -12
- package/dist/PartitionedSemaphore.js.map +1 -1
- package/dist/Pool.d.ts +51 -0
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +136 -36
- package/dist/Pool.js.map +1 -1
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +5 -6
- package/dist/PubSub.js.map +1 -1
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +3 -3
- package/dist/Random.js.map +1 -1
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +8 -2
- package/dist/RcMap.js.map +1 -1
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +8 -0
- package/dist/Ref.js.map +1 -1
- package/dist/Schedule.d.ts +18 -1
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +8 -3
- package/dist/Schedule.js.map +1 -1
- package/dist/Schema.d.ts +690 -49
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +687 -28
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +4 -2
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +14 -17
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +6 -1
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +22 -11
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +48 -22
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +33 -10
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +39 -13
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +12 -4
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +15 -5
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/ScopedCache.d.ts.map +1 -1
- package/dist/ScopedCache.js +5 -7
- package/dist/ScopedCache.js.map +1 -1
- package/dist/Semaphore.d.ts +130 -0
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js +94 -35
- package/dist/Semaphore.js.map +1 -1
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +7 -2
- package/dist/Sink.js.map +1 -1
- package/dist/Stream.d.ts +13 -4
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +31 -10
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +3 -0
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +3 -0
- package/dist/String.js.map +1 -1
- package/dist/Terminal.d.ts +18 -1
- package/dist/Terminal.d.ts.map +1 -1
- package/dist/Terminal.js +1 -1
- package/dist/Terminal.js.map +1 -1
- package/dist/Tracer.d.ts +11 -1
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +6 -1
- package/dist/Tracer.js.map +1 -1
- package/dist/ai/AiError.d.ts +43 -116
- package/dist/ai/AiError.d.ts.map +1 -1
- package/dist/ai/AiError.js +53 -72
- package/dist/ai/AiError.js.map +1 -1
- package/dist/ai/Decision.d.ts +196 -15
- package/dist/ai/Decision.d.ts.map +1 -1
- package/dist/ai/Decision.js +130 -0
- package/dist/ai/Decision.js.map +1 -1
- package/dist/ai/DecisionModel.d.ts +54 -13
- package/dist/ai/DecisionModel.d.ts.map +1 -1
- package/dist/ai/DecisionModel.js +123 -12
- package/dist/ai/DecisionModel.js.map +1 -1
- package/dist/ai/LanguageModel.d.ts.map +1 -1
- package/dist/ai/LanguageModel.js +9 -0
- 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 +630 -29
- package/dist/ai/McpServer.d.ts.map +1 -1
- package/dist/ai/McpServer.js +583 -131
- package/dist/ai/McpServer.js.map +1 -1
- package/dist/ai/McpTest.d.ts +130 -0
- package/dist/ai/McpTest.d.ts.map +1 -0
- package/dist/ai/McpTest.js +237 -0
- package/dist/ai/McpTest.js.map +1 -0
- package/dist/ai/Prompt.d.ts +52 -0
- package/dist/ai/Prompt.d.ts.map +1 -1
- package/dist/ai/Prompt.js +38 -0
- package/dist/ai/Prompt.js.map +1 -1
- package/dist/ai/Response.d.ts +17 -28
- package/dist/ai/Response.d.ts.map +1 -1
- package/dist/ai/Response.js +5 -10
- package/dist/ai/Response.js.map +1 -1
- package/dist/ai/Tool.d.ts +43 -1
- package/dist/ai/Tool.d.ts.map +1 -1
- package/dist/ai/Tool.js +5 -2
- package/dist/ai/Tool.js.map +1 -1
- package/dist/ai/Toolkit.d.ts.map +1 -1
- package/dist/ai/Toolkit.js +8 -1
- package/dist/ai/Toolkit.js.map +1 -1
- package/dist/ai/index.d.ts +5 -0
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +5 -0
- package/dist/ai/index.js.map +1 -1
- package/dist/ai/internal/mcpCore.js +17 -12
- package/dist/ai/internal/mcpCore.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2024_11_05.js +4 -5
- package/dist/ai/internal/mcpProtocol/v2024_11_05.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_03_26.js +4 -5
- package/dist/ai/internal/mcpProtocol/v2025_03_26.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_06_18.js +4 -5
- package/dist/ai/internal/mcpProtocol/v2025_06_18.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_11_25.js +4 -5
- package/dist/ai/internal/mcpProtocol/v2025_11_25.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2026_07_28.js +18 -10
- package/dist/ai/internal/mcpProtocol/v2026_07_28.js.map +1 -1
- package/dist/ai/internal/mcpProtocol.js +13 -0
- package/dist/ai/internal/mcpProtocol.js.map +1 -1
- package/dist/ai/internal/mcpRuntime.js +5 -3
- package/dist/ai/internal/mcpRuntime.js.map +1 -1
- package/dist/ai/internal/mcpStatefulRuntime.js +6 -1
- package/dist/ai/internal/mcpStatefulRuntime.js.map +1 -1
- package/dist/cli/Argument.d.ts +21 -0
- package/dist/cli/Argument.d.ts.map +1 -1
- package/dist/cli/Argument.js +7 -0
- package/dist/cli/Argument.js.map +1 -1
- package/dist/cli/CliError.d.ts +78 -0
- package/dist/cli/CliError.d.ts.map +1 -1
- package/dist/cli/CliError.js +65 -3
- package/dist/cli/CliError.js.map +1 -1
- package/dist/cli/CliOutput.d.ts +220 -7
- package/dist/cli/CliOutput.d.ts.map +1 -1
- package/dist/cli/CliOutput.js +156 -43
- package/dist/cli/CliOutput.js.map +1 -1
- package/dist/cli/Command.d.ts +47 -16
- package/dist/cli/Command.d.ts.map +1 -1
- package/dist/cli/Command.js +67 -29
- package/dist/cli/Command.js.map +1 -1
- package/dist/cli/Completions.d.ts +58 -0
- package/dist/cli/Completions.d.ts.map +1 -1
- package/dist/cli/Completions.js +49 -9
- package/dist/cli/Completions.js.map +1 -1
- package/dist/cli/Flag.d.ts +122 -0
- package/dist/cli/Flag.d.ts.map +1 -1
- package/dist/cli/Flag.js +42 -0
- package/dist/cli/Flag.js.map +1 -1
- package/dist/cli/GlobalFlag.d.ts.map +1 -1
- package/dist/cli/GlobalFlag.js +15 -7
- package/dist/cli/GlobalFlag.js.map +1 -1
- package/dist/cli/HelpDoc.d.ts +15 -1
- package/dist/cli/HelpDoc.d.ts.map +1 -1
- package/dist/cli/Param.d.ts +15 -0
- package/dist/cli/Param.d.ts.map +1 -1
- package/dist/cli/Param.js +23 -2
- package/dist/cli/Param.js.map +1 -1
- package/dist/cli/Primitive.d.ts +14 -0
- package/dist/cli/Primitive.d.ts.map +1 -1
- package/dist/cli/Primitive.js +15 -1
- package/dist/cli/Primitive.js.map +1 -1
- package/dist/cli/Prompt.d.ts +1 -0
- package/dist/cli/Prompt.d.ts.map +1 -1
- package/dist/cli/Prompt.js +1 -0
- package/dist/cli/Prompt.js.map +1 -1
- package/dist/cli/TerminalCapabilities.d.ts +3 -2
- package/dist/cli/TerminalCapabilities.d.ts.map +1 -1
- package/dist/cli/TerminalCapabilities.js +3 -1
- package/dist/cli/TerminalCapabilities.js.map +1 -1
- package/dist/cli/internal/completions/bash.js +73 -27
- package/dist/cli/internal/completions/bash.js.map +1 -1
- package/dist/cli/internal/help.d.ts.map +1 -1
- package/dist/cli/internal/help.js +17 -10
- package/dist/cli/internal/help.js.map +1 -1
- package/dist/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/cluster/ClusterWorkflowEngine.js +45 -10
- package/dist/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/cluster/MessageStorage.d.ts +23 -45
- package/dist/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/cluster/MessageStorage.js +6 -7
- package/dist/cluster/MessageStorage.js.map +1 -1
- package/dist/cluster/Sharding.d.ts.map +1 -1
- package/dist/cluster/Sharding.js +151 -49
- package/dist/cluster/Sharding.js.map +1 -1
- package/dist/cluster/ShardingConfig.d.ts +76 -0
- package/dist/cluster/ShardingConfig.d.ts.map +1 -1
- package/dist/cluster/ShardingConfig.js +4 -0
- package/dist/cluster/ShardingConfig.js.map +1 -1
- package/dist/cluster/SingleRunner.d.ts +3 -3
- package/dist/cluster/SingleRunner.d.ts.map +1 -1
- package/dist/cluster/SingleRunner.js +1 -1
- package/dist/cluster/Snowflake.d.ts.map +1 -1
- package/dist/cluster/Snowflake.js +3 -7
- package/dist/cluster/Snowflake.js.map +1 -1
- package/dist/cluster/SqlMessageStorage.d.ts +37 -6
- package/dist/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/cluster/SqlMessageStorage.js +34 -7
- package/dist/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/cluster/SqlRunnerStorage.js +109 -46
- package/dist/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/cluster/internal/entityManager.js +54 -20
- package/dist/cluster/internal/entityManager.js.map +1 -1
- package/dist/crypto/Aead.d.ts +322 -0
- package/dist/crypto/Aead.d.ts.map +1 -0
- package/dist/crypto/Aead.js +331 -0
- package/dist/crypto/Aead.js.map +1 -0
- package/dist/crypto/Cipher.d.ts +235 -0
- package/dist/crypto/Cipher.d.ts.map +1 -0
- package/dist/crypto/Cipher.js +233 -0
- package/dist/crypto/Cipher.js.map +1 -0
- package/dist/crypto/CryptoError.d.ts +212 -0
- package/dist/crypto/CryptoError.d.ts.map +1 -0
- package/dist/crypto/CryptoError.js +202 -0
- package/dist/crypto/CryptoError.js.map +1 -0
- package/dist/crypto/Digest.d.ts +143 -0
- package/dist/crypto/Digest.d.ts.map +1 -0
- package/dist/crypto/Digest.js +146 -0
- package/dist/crypto/Digest.js.map +1 -0
- package/dist/crypto/Kdf.d.ts +220 -0
- package/dist/crypto/Kdf.d.ts.map +1 -0
- package/dist/crypto/Kdf.js +212 -0
- package/dist/crypto/Kdf.js.map +1 -0
- package/dist/crypto/KeyAgreement.d.ts +323 -0
- package/dist/crypto/KeyAgreement.d.ts.map +1 -0
- package/dist/crypto/KeyAgreement.js +303 -0
- package/dist/crypto/KeyAgreement.js.map +1 -0
- package/dist/crypto/KeyFormat.d.ts +309 -0
- package/dist/crypto/KeyFormat.d.ts.map +1 -0
- package/dist/crypto/KeyFormat.js +556 -0
- package/dist/crypto/KeyFormat.js.map +1 -0
- package/dist/crypto/KeyWrap.d.ts +389 -0
- package/dist/crypto/KeyWrap.d.ts.map +1 -0
- package/dist/crypto/KeyWrap.js +381 -0
- package/dist/crypto/KeyWrap.js.map +1 -0
- package/dist/crypto/Mac.d.ts +277 -0
- package/dist/crypto/Mac.d.ts.map +1 -0
- package/dist/crypto/Mac.js +288 -0
- package/dist/crypto/Mac.js.map +1 -0
- package/dist/crypto/SecureRandom.d.ts +340 -0
- package/dist/crypto/SecureRandom.d.ts.map +1 -0
- package/dist/crypto/SecureRandom.js +257 -0
- package/dist/crypto/SecureRandom.js.map +1 -0
- package/dist/crypto/Signature.d.ts +448 -0
- package/dist/crypto/Signature.d.ts.map +1 -0
- package/dist/crypto/Signature.js +484 -0
- package/dist/crypto/Signature.js.map +1 -0
- package/dist/crypto/WebCrypto.d.ts +61 -0
- package/dist/crypto/WebCrypto.d.ts.map +1 -0
- package/dist/crypto/WebCrypto.js +63 -0
- package/dist/crypto/WebCrypto.js.map +1 -0
- package/dist/crypto/index.d.ts +65 -0
- package/dist/crypto/index.d.ts.map +1 -0
- package/dist/crypto/index.js +66 -0
- package/dist/crypto/index.js.map +1 -0
- package/dist/crypto/internal/asymmetric.d.ts +2 -0
- package/dist/crypto/internal/asymmetric.d.ts.map +1 -0
- package/dist/crypto/internal/asymmetric.js +210 -0
- package/dist/crypto/internal/asymmetric.js.map +1 -0
- package/dist/crypto/internal/chacha.d.ts +46 -0
- package/dist/crypto/internal/chacha.d.ts.map +1 -0
- package/dist/crypto/internal/chacha.js +885 -0
- package/dist/crypto/internal/chacha.js.map +1 -0
- package/dist/crypto/internal/der.d.ts +6 -0
- package/dist/crypto/internal/der.d.ts.map +1 -0
- package/dist/crypto/internal/der.js +86 -0
- package/dist/crypto/internal/der.js.map +1 -0
- package/dist/crypto/internal/digest.d.ts +2 -0
- package/dist/crypto/internal/digest.d.ts.map +1 -0
- package/dist/crypto/internal/digest.js +15 -0
- package/dist/crypto/internal/digest.js.map +1 -0
- package/dist/crypto/internal/key.d.ts +2 -0
- package/dist/crypto/internal/key.d.ts.map +1 -0
- package/dist/crypto/internal/key.js +170 -0
- package/dist/crypto/internal/key.js.map +1 -0
- package/dist/crypto/internal/md5.d.ts +39 -0
- package/dist/crypto/internal/md5.d.ts.map +1 -0
- package/dist/crypto/internal/md5.js +179 -0
- package/dist/crypto/internal/md5.js.map +1 -0
- package/dist/crypto/internal/webCrypto.d.ts +2 -0
- package/dist/crypto/internal/webCrypto.d.ts.map +1 -0
- package/dist/crypto/internal/webCrypto.js +111 -0
- package/dist/crypto/internal/webCrypto.js.map +1 -0
- package/dist/devtools/DevToolsClient.d.ts.map +1 -1
- package/dist/devtools/DevToolsClient.js +2 -0
- package/dist/devtools/DevToolsClient.js.map +1 -1
- package/dist/encoding/Base64.js +36 -0
- package/dist/encoding/Base64.js.map +1 -1
- package/dist/encoding/Base64Url.d.ts.map +1 -1
- package/dist/encoding/Base64Url.js +3 -2
- package/dist/encoding/Base64Url.js.map +1 -1
- package/dist/encoding/Csv.d.ts +608 -0
- package/dist/encoding/Csv.d.ts.map +1 -0
- package/dist/encoding/Csv.js +718 -0
- package/dist/encoding/Csv.js.map +1 -0
- package/dist/encoding/Hex.d.ts +3 -2
- package/dist/encoding/Hex.d.ts.map +1 -1
- package/dist/encoding/Hex.js +3 -2
- package/dist/encoding/Hex.js.map +1 -1
- package/dist/encoding/SchemaBinary.d.ts.map +1 -1
- package/dist/encoding/SchemaBinary.js +42 -4
- package/dist/encoding/SchemaBinary.js.map +1 -1
- package/dist/encoding/Sse.d.ts.map +1 -1
- package/dist/encoding/Sse.js +3 -3
- package/dist/encoding/Sse.js.map +1 -1
- package/dist/encoding/Toml.d.ts +17 -3
- package/dist/encoding/Toml.d.ts.map +1 -1
- package/dist/encoding/Toml.js +124 -31
- package/dist/encoding/Toml.js.map +1 -1
- package/dist/encoding/Yaml.d.ts +8 -1
- package/dist/encoding/Yaml.d.ts.map +1 -1
- package/dist/encoding/Yaml.js +54 -18
- package/dist/encoding/Yaml.js.map +1 -1
- package/dist/encoding/index.d.ts +5 -0
- package/dist/encoding/index.d.ts.map +1 -1
- package/dist/encoding/index.js +5 -0
- package/dist/encoding/index.js.map +1 -1
- package/dist/eventlog/EventJournal.d.ts.map +1 -1
- package/dist/eventlog/EventJournal.js +6 -3
- package/dist/eventlog/EventJournal.js.map +1 -1
- package/dist/eventlog/EventLog.d.ts +119 -4
- package/dist/eventlog/EventLog.d.ts.map +1 -1
- package/dist/eventlog/EventLog.js +200 -12
- package/dist/eventlog/EventLog.js.map +1 -1
- package/dist/eventlog/EventLogEncryption.d.ts +41 -4
- package/dist/eventlog/EventLogEncryption.d.ts.map +1 -1
- package/dist/eventlog/EventLogEncryption.js +83 -64
- package/dist/eventlog/EventLogEncryption.js.map +1 -1
- package/dist/eventlog/EventLogMessage.d.ts +279 -0
- package/dist/eventlog/EventLogMessage.d.ts.map +1 -1
- package/dist/eventlog/EventLogMessage.js +217 -1
- package/dist/eventlog/EventLogMessage.js.map +1 -1
- package/dist/eventlog/EventLogRemote.d.ts +200 -28
- package/dist/eventlog/EventLogRemote.d.ts.map +1 -1
- package/dist/eventlog/EventLogRemote.js +186 -16
- package/dist/eventlog/EventLogRemote.js.map +1 -1
- package/dist/eventlog/EventLogServer.d.ts +3 -0
- package/dist/eventlog/EventLogServer.d.ts.map +1 -1
- package/dist/eventlog/EventLogServer.js +18 -10
- package/dist/eventlog/EventLogServer.js.map +1 -1
- package/dist/eventlog/EventLogServerEncrypted.d.ts +326 -5
- package/dist/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
- package/dist/eventlog/EventLogServerEncrypted.js +769 -14
- package/dist/eventlog/EventLogServerEncrypted.js.map +1 -1
- package/dist/eventlog/EventLogSessionAuth.d.ts +5 -3
- package/dist/eventlog/EventLogSessionAuth.d.ts.map +1 -1
- package/dist/eventlog/EventLogSessionAuth.js +41 -64
- package/dist/eventlog/EventLogSessionAuth.js.map +1 -1
- package/dist/eventlog/EventRow.d.ts +4 -0
- package/dist/eventlog/EventRow.d.ts.map +1 -1
- package/dist/eventlog/EventRow.js +12 -2
- package/dist/eventlog/EventRow.js.map +1 -1
- package/dist/eventlog/SqlEventJournal.d.ts.map +1 -1
- package/dist/eventlog/SqlEventJournal.js +47 -27
- package/dist/eventlog/SqlEventJournal.js.map +1 -1
- package/dist/eventlog/SqlEventLogServerEncrypted.d.ts +21 -5
- package/dist/eventlog/SqlEventLogServerEncrypted.d.ts.map +1 -1
- package/dist/eventlog/SqlEventLogServerEncrypted.js +1048 -113
- package/dist/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
- package/dist/eventlog/SqlEventLogServerUnencrypted.js +2 -2
- package/dist/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
- package/dist/eventlog/internal/batches.d.ts +12 -0
- package/dist/eventlog/internal/batches.d.ts.map +1 -0
- package/dist/eventlog/internal/batches.js +26 -0
- package/dist/eventlog/internal/batches.js.map +1 -0
- package/dist/eventlog/internal/compaction.d.ts +38 -0
- package/dist/eventlog/internal/compaction.d.ts.map +1 -0
- package/dist/eventlog/internal/compaction.js +33 -0
- package/dist/eventlog/internal/compaction.js.map +1 -0
- package/dist/eventlog/internal/conflicts.d.ts +0 -1
- package/dist/eventlog/internal/conflicts.d.ts.map +1 -1
- package/dist/eventlog/internal/conflicts.js +0 -3
- package/dist/eventlog/internal/conflicts.js.map +1 -1
- package/dist/eventlog/internal/identityRootSecretDerivation.js +66 -67
- package/dist/eventlog/internal/identityRootSecretDerivation.js.map +1 -1
- package/dist/eventlog/internal/remoteCompaction.d.ts +31 -0
- package/dist/eventlog/internal/remoteCompaction.d.ts.map +1 -0
- package/dist/eventlog/internal/remoteCompaction.js +76 -0
- package/dist/eventlog/internal/remoteCompaction.js.map +1 -0
- package/dist/http/Cookies.d.ts +172 -0
- package/dist/http/Cookies.d.ts.map +1 -1
- package/dist/http/Cookies.js +153 -10
- package/dist/http/Cookies.js.map +1 -1
- package/dist/http/FetchHttpClient.d.ts +26 -2
- package/dist/http/FetchHttpClient.d.ts.map +1 -1
- package/dist/http/FetchHttpClient.js +78 -15
- package/dist/http/FetchHttpClient.js.map +1 -1
- package/dist/http/HttpClient.d.ts +502 -8
- package/dist/http/HttpClient.d.ts.map +1 -1
- package/dist/http/HttpClient.js +296 -12
- package/dist/http/HttpClient.js.map +1 -1
- package/dist/http/HttpClientError.d.ts +8 -1
- package/dist/http/HttpClientError.d.ts.map +1 -1
- package/dist/http/HttpClientError.js +37 -1
- package/dist/http/HttpClientError.js.map +1 -1
- package/dist/http/HttpClientRequest.d.ts +9 -5
- package/dist/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/http/HttpClientRequest.js +3 -4
- package/dist/http/HttpClientRequest.js.map +1 -1
- package/dist/http/HttpClientResponse.d.ts.map +1 -1
- package/dist/http/HttpClientResponse.js +3 -2
- package/dist/http/HttpClientResponse.js.map +1 -1
- package/dist/http/HttpMethod.d.ts +7 -1
- package/dist/http/HttpMethod.d.ts.map +1 -1
- package/dist/http/HttpMethod.js +3 -8
- package/dist/http/HttpMethod.js.map +1 -1
- package/dist/http/HttpMiddleware.d.ts +1 -1
- package/dist/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/http/HttpMiddleware.js +14 -16
- package/dist/http/HttpMiddleware.js.map +1 -1
- package/dist/http/HttpRouter.d.ts.map +1 -1
- package/dist/http/HttpRouter.js +2 -1
- package/dist/http/HttpRouter.js.map +1 -1
- package/dist/http/HttpServerError.js +2 -2
- package/dist/http/HttpServerError.js.map +1 -1
- package/dist/http/HttpServerRequest.d.ts +11 -3
- package/dist/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/http/HttpServerRequest.js +77 -25
- package/dist/http/HttpServerRequest.js.map +1 -1
- package/dist/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/http/HttpServerResponse.js +3 -2
- package/dist/http/HttpServerResponse.js.map +1 -1
- package/dist/http/HttpStaticServer.d.ts.map +1 -1
- package/dist/http/HttpStaticServer.js +48 -21
- package/dist/http/HttpStaticServer.js.map +1 -1
- package/dist/http/HttpTraceContext.d.ts +2 -1
- package/dist/http/HttpTraceContext.d.ts.map +1 -1
- package/dist/http/HttpTraceContext.js +7 -5
- package/dist/http/HttpTraceContext.js.map +1 -1
- package/dist/http/MultipartParser/internal/contentType.js +3 -3
- package/dist/http/ProblemDetails.d.ts +96 -0
- package/dist/http/ProblemDetails.d.ts.map +1 -0
- package/dist/http/ProblemDetails.js +98 -0
- package/dist/http/ProblemDetails.js.map +1 -0
- package/dist/http/UrlParams.d.ts +3 -1
- package/dist/http/UrlParams.d.ts.map +1 -1
- package/dist/http/UrlParams.js +4 -2
- package/dist/http/UrlParams.js.map +1 -1
- package/dist/http/index.d.ts +5 -0
- package/dist/http/index.d.ts.map +1 -1
- package/dist/http/index.js +5 -0
- package/dist/http/index.js.map +1 -1
- package/dist/http/internal/compression.js +4 -5
- package/dist/http/internal/compression.js.map +1 -1
- package/dist/http/internal/decompression.js +6 -2
- package/dist/http/internal/decompression.js.map +1 -1
- package/dist/http/internal/httpBody.js +8 -1
- package/dist/http/internal/httpBody.js.map +1 -1
- package/dist/http/internal/urlParams.js +33 -0
- package/dist/http/internal/urlParams.js.map +1 -1
- package/dist/http-api/HttpApi.d.ts +3 -6
- package/dist/http-api/HttpApi.d.ts.map +1 -1
- package/dist/http-api/HttpApi.js +3 -6
- 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 +43 -13
- package/dist/http-api/HttpApiBuilder.js.map +1 -1
- package/dist/http-api/HttpApiClient.d.ts +140 -7
- package/dist/http-api/HttpApiClient.d.ts.map +1 -1
- package/dist/http-api/HttpApiClient.js +193 -44
- package/dist/http-api/HttpApiClient.js.map +1 -1
- package/dist/http-api/HttpApiEndpoint.d.ts +24 -7
- package/dist/http-api/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/http-api/HttpApiEndpoint.js +123 -32
- package/dist/http-api/HttpApiEndpoint.js.map +1 -1
- package/dist/http-api/HttpApiError.d.ts +185 -13
- package/dist/http-api/HttpApiError.d.ts.map +1 -1
- package/dist/http-api/HttpApiError.js +128 -0
- package/dist/http-api/HttpApiError.js.map +1 -1
- package/dist/http-api/HttpApiMiddleware.d.ts +64 -17
- package/dist/http-api/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/http-api/HttpApiMiddleware.js +85 -1
- package/dist/http-api/HttpApiMiddleware.js.map +1 -1
- package/dist/http-api/HttpApiSchema.d.ts +142 -33
- package/dist/http-api/HttpApiSchema.d.ts.map +1 -1
- package/dist/http-api/HttpApiSchema.js +123 -59
- package/dist/http-api/HttpApiSchema.js.map +1 -1
- package/dist/http-api/HttpApiTest.d.ts.map +1 -1
- package/dist/http-api/HttpApiTest.js +3 -2
- package/dist/http-api/HttpApiTest.js.map +1 -1
- package/dist/http-api/OpenApi.d.ts.map +1 -1
- package/dist/http-api/OpenApi.js +25 -16
- package/dist/http-api/OpenApi.js.map +1 -1
- package/dist/http-api/internal/toCodecHttpProperties.d.ts +2 -0
- package/dist/http-api/internal/toCodecHttpProperties.d.ts.map +1 -0
- package/dist/http-api/internal/toCodecHttpProperties.js +38 -0
- package/dist/http-api/internal/toCodecHttpProperties.js.map +1 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/internal/arbitrary/runner.d.ts.map +1 -1
- package/dist/internal/arbitrary/runner.js +120 -44
- package/dist/internal/arbitrary/runner.js.map +1 -1
- package/dist/internal/core.js +2 -0
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/effect.js +46 -27
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/equal.js +14 -0
- package/dist/internal/equal.js.map +1 -1
- package/dist/internal/glob.d.ts +2 -0
- package/dist/internal/glob.d.ts.map +1 -0
- package/dist/internal/glob.js +630 -0
- package/dist/internal/glob.js.map +1 -0
- package/dist/internal/jsonSchema.d.ts +2 -0
- package/dist/internal/jsonSchema.d.ts.map +1 -0
- package/dist/internal/jsonSchema.js +28 -0
- package/dist/internal/jsonSchema.js.map +1 -0
- package/dist/internal/matcher.js +11 -1
- package/dist/internal/matcher.js.map +1 -1
- package/dist/internal/persistence.js +9 -0
- package/dist/internal/persistence.js.map +1 -1
- package/dist/internal/rcRef.js +4 -1
- package/dist/internal/rcRef.js.map +1 -1
- package/dist/internal/schema/compilerRegistry.js +4 -1
- package/dist/internal/schema/compilerRegistry.js.map +1 -1
- package/dist/internal/schema/content.d.ts +2 -0
- package/dist/internal/schema/content.d.ts.map +1 -0
- package/dist/internal/schema/content.js +13 -0
- package/dist/internal/schema/content.js.map +1 -0
- package/dist/internal/schema/fromJsonSchemaDocument.js +173 -185
- package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -1
- package/dist/internal/schema/fromRepresentation.js +2 -1
- package/dist/internal/schema/fromRepresentation.js.map +1 -1
- package/dist/internal/schema/standardSchema.js +8 -2
- package/dist/internal/schema/standardSchema.js.map +1 -1
- package/dist/internal/schema/toCodeDocument.js +9 -6
- package/dist/internal/schema/toCodeDocument.js.map +1 -1
- package/dist/internal/schema/toCodec.js +21 -24
- package/dist/internal/schema/toCodec.js.map +1 -1
- package/dist/internal/schema/toJsonSchemaDocument.js +205 -140
- package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -1
- package/dist/internal/schema/toRepresentation.js +107 -129
- package/dist/internal/schema/toRepresentation.js.map +1 -1
- package/dist/internal/sql.d.ts +2 -0
- package/dist/internal/sql.d.ts.map +1 -0
- package/dist/internal/sql.js +13 -0
- package/dist/internal/sql.js.map +1 -0
- package/dist/internal/trie.js +42 -13
- package/dist/internal/trie.js.map +1 -1
- package/dist/internal/ulid.js +41 -0
- package/dist/internal/ulid.js.map +1 -1
- package/dist/internal/uuid.js +52 -8
- package/dist/internal/uuid.js.map +1 -1
- package/dist/internal/version.js +1 -1
- package/dist/observability/Otlp.d.ts +15 -4
- package/dist/observability/Otlp.d.ts.map +1 -1
- package/dist/observability/Otlp.js +10 -0
- package/dist/observability/Otlp.js.map +1 -1
- package/dist/observability/OtlpProxy.d.ts +154 -0
- package/dist/observability/OtlpProxy.d.ts.map +1 -0
- package/dist/observability/OtlpProxy.js +235 -0
- package/dist/observability/OtlpProxy.js.map +1 -0
- package/dist/observability/OtlpResource.d.ts +7 -0
- package/dist/observability/OtlpResource.d.ts.map +1 -1
- package/dist/observability/OtlpResource.js +11 -1
- package/dist/observability/OtlpResource.js.map +1 -1
- package/dist/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/observability/OtlpTracer.js +4 -0
- package/dist/observability/OtlpTracer.js.map +1 -1
- package/dist/observability/index.d.ts +5 -0
- package/dist/observability/index.d.ts.map +1 -1
- package/dist/observability/index.js +5 -0
- package/dist/observability/index.js.map +1 -1
- package/dist/persistence/CircuitBreaker.d.ts +897 -0
- package/dist/persistence/CircuitBreaker.d.ts.map +1 -0
- package/dist/persistence/CircuitBreaker.js +1165 -0
- package/dist/persistence/CircuitBreaker.js.map +1 -0
- package/dist/persistence/KeyValueStore.d.ts +47 -2
- package/dist/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/persistence/KeyValueStore.js +129 -18
- package/dist/persistence/KeyValueStore.js.map +1 -1
- package/dist/persistence/PersistedQueue.d.ts +9 -0
- package/dist/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/persistence/PersistedQueue.js +94 -52
- package/dist/persistence/PersistedQueue.js.map +1 -1
- package/dist/persistence/Persistence.d.ts +10 -4
- package/dist/persistence/Persistence.d.ts.map +1 -1
- package/dist/persistence/Persistence.js +18 -11
- package/dist/persistence/Persistence.js.map +1 -1
- package/dist/persistence/Redis.d.ts +78 -2
- package/dist/persistence/Redis.d.ts.map +1 -1
- package/dist/persistence/Redis.js +62 -7
- package/dist/persistence/Redis.js.map +1 -1
- package/dist/persistence/index.d.ts +5 -0
- package/dist/persistence/index.d.ts.map +1 -1
- package/dist/persistence/index.js +5 -0
- package/dist/persistence/index.js.map +1 -1
- package/dist/process/ChildProcess.d.ts +237 -71
- package/dist/process/ChildProcess.d.ts.map +1 -1
- package/dist/process/ChildProcess.js +56 -158
- package/dist/process/ChildProcess.js.map +1 -1
- package/dist/process/ChildProcessSpawner.d.ts +35 -0
- package/dist/process/ChildProcessSpawner.d.ts.map +1 -1
- package/dist/process/ChildProcessSpawner.js +5 -2
- package/dist/process/ChildProcessSpawner.js.map +1 -1
- package/dist/process/CommandLine.d.ts +294 -0
- package/dist/process/CommandLine.d.ts.map +1 -0
- package/dist/process/CommandLine.js +481 -0
- package/dist/process/CommandLine.js.map +1 -0
- package/dist/process/index.d.ts +5 -0
- package/dist/process/index.d.ts.map +1 -1
- package/dist/process/index.js +5 -0
- package/dist/process/index.js.map +1 -1
- package/dist/reactivity/AsyncResult.d.ts +1 -1
- package/dist/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/reactivity/Atom.d.ts +2 -1
- package/dist/reactivity/Atom.d.ts.map +1 -1
- package/dist/reactivity/Atom.js +3 -4
- package/dist/reactivity/Atom.js.map +1 -1
- package/dist/reactivity/AtomRegistry.js.map +1 -1
- package/dist/rpc/RpcClient.d.ts +16 -1
- package/dist/rpc/RpcClient.d.ts.map +1 -1
- package/dist/rpc/RpcClient.js +59 -24
- package/dist/rpc/RpcClient.js.map +1 -1
- package/dist/rpc/RpcMessage.d.ts +10 -1
- package/dist/rpc/RpcMessage.d.ts.map +1 -1
- package/dist/rpc/RpcMessage.js +1 -0
- package/dist/rpc/RpcMessage.js.map +1 -1
- package/dist/rpc/RpcSerialization.d.ts +14 -0
- package/dist/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/rpc/RpcSerialization.js +26 -8
- package/dist/rpc/RpcSerialization.js.map +1 -1
- package/dist/rpc/RpcServer.d.ts +31 -0
- package/dist/rpc/RpcServer.d.ts.map +1 -1
- package/dist/rpc/RpcServer.js +139 -56
- package/dist/rpc/RpcServer.js.map +1 -1
- package/dist/rpc/RpcTest.d.ts +1 -0
- package/dist/rpc/RpcTest.d.ts.map +1 -1
- package/dist/rpc/RpcTest.js +1 -0
- package/dist/rpc/RpcTest.js.map +1 -1
- package/dist/schema/Model.d.ts +14 -0
- package/dist/schema/Model.d.ts.map +1 -1
- package/dist/schema/Model.js +18 -3
- package/dist/schema/Model.js.map +1 -1
- package/dist/sql/Migrator.d.ts +2 -20
- package/dist/sql/Migrator.d.ts.map +1 -1
- package/dist/sql/Migrator.js +13 -55
- package/dist/sql/Migrator.js.map +1 -1
- package/dist/sql/MigratorFileSystem.d.ts +21 -0
- package/dist/sql/MigratorFileSystem.d.ts.map +1 -0
- package/dist/sql/MigratorFileSystem.js +57 -0
- package/dist/sql/MigratorFileSystem.js.map +1 -0
- package/dist/sql/SqlClient.d.ts +9 -4
- package/dist/sql/SqlClient.d.ts.map +1 -1
- package/dist/sql/SqlClient.js +13 -10
- package/dist/sql/SqlClient.js.map +1 -1
- package/dist/sql/SqlResolver.d.ts +4 -0
- package/dist/sql/SqlResolver.d.ts.map +1 -1
- package/dist/sql/SqlResolver.js +18 -4
- package/dist/sql/SqlResolver.js.map +1 -1
- package/dist/sql/Statement.d.ts +27 -6
- package/dist/sql/Statement.d.ts.map +1 -1
- package/dist/sql/Statement.js +21 -15
- package/dist/sql/Statement.js.map +1 -1
- package/dist/sql/index.js +1 -1
- package/dist/testing/index.d.ts +0 -5
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +0 -5
- package/dist/testing/index.js.map +1 -1
- package/dist/workflow/DurableDeferred.d.ts.map +1 -1
- package/dist/workflow/DurableDeferred.js +21 -2
- package/dist/workflow/DurableDeferred.js.map +1 -1
- package/dist/workflow/internal/crypto.js +9 -8
- package/dist/workflow/internal/crypto.js.map +1 -1
- package/package.json +3 -1
- package/src/Arbitrary.ts +10 -2
- package/src/BigDecimal.ts +3 -0
- package/src/Channel.ts +64 -29
- package/src/Config.ts +7 -1
- package/src/Context.ts +34 -10
- package/src/Cron.ts +178 -29
- package/src/Data.ts +60 -265
- package/src/Duration.ts +140 -0
- package/src/Effect.ts +915 -86
- package/src/Equal.ts +8 -1
- package/src/Exit.ts +3 -3
- package/src/FileSystem.ts +65 -4
- package/src/Formatter.ts +28 -13
- package/src/Glob.ts +205 -0
- package/src/Hash.ts +4 -1
- package/src/JsonPatch.ts +4 -0
- package/src/JsonSchema.ts +12 -40
- package/src/Match.ts +127 -0
- package/src/Metric.ts +3 -3
- package/src/MutableList.ts +7 -5
- package/src/MutableRef.ts +8 -1
- package/src/PartitionedSemaphore.ts +24 -13
- package/src/Pool.ts +182 -52
- package/src/PubSub.ts +5 -6
- package/src/Random.ts +3 -3
- package/src/RcMap.ts +5 -1
- package/src/Ref.ts +8 -0
- package/src/Schedule.ts +27 -4
- package/src/Schema.ts +1237 -87
- package/src/SchemaAST.ts +20 -20
- package/src/SchemaGetter.ts +27 -11
- package/src/SchemaParser.ts +51 -18
- package/src/SchemaRepresentation.ts +50 -34
- package/src/SchemaTransformation.ts +17 -5
- package/src/ScopedCache.ts +5 -9
- package/src/Semaphore.ts +208 -40
- package/src/Sink.ts +15 -2
- package/src/Stream.ts +48 -22
- package/src/String.ts +3 -0
- package/src/Terminal.ts +19 -1
- package/src/Tracer.ts +15 -1
- package/src/ai/AiError.ts +56 -80
- package/src/ai/Decision.ts +257 -6
- package/src/ai/DecisionModel.ts +171 -28
- package/src/ai/LanguageModel.ts +9 -0
- package/src/ai/McpServer.ts +1283 -299
- package/src/ai/McpTest.ts +380 -0
- package/src/ai/Prompt.ts +65 -0
- package/src/ai/Response.ts +36 -31
- package/src/ai/Tool.ts +65 -10
- package/src/ai/Toolkit.ts +4 -1
- package/src/ai/index.ts +6 -0
- package/src/ai/internal/mcpCore.ts +78 -44
- package/src/ai/internal/mcpProtocol/v2024_11_05.ts +4 -7
- package/src/ai/internal/mcpProtocol/v2025_03_26.ts +4 -7
- package/src/ai/internal/mcpProtocol/v2025_06_18.ts +4 -7
- package/src/ai/internal/mcpProtocol/v2025_11_25.ts +4 -7
- package/src/ai/internal/mcpProtocol/v2026_07_28.ts +15 -10
- package/src/ai/internal/mcpProtocol.ts +29 -0
- package/src/ai/internal/mcpRuntime.ts +9 -5
- package/src/ai/internal/mcpStatefulRuntime.ts +14 -2
- package/src/cli/Argument.ts +21 -0
- package/src/cli/CliError.ts +90 -3
- package/src/cli/CliOutput.ts +300 -55
- package/src/cli/Command.ts +76 -41
- package/src/cli/Completions.ts +51 -0
- package/src/cli/Flag.ts +122 -0
- package/src/cli/GlobalFlag.ts +6 -7
- package/src/cli/HelpDoc.ts +18 -1
- package/src/cli/Param.ts +35 -6
- package/src/cli/Primitive.ts +16 -1
- package/src/cli/Prompt.ts +1 -0
- package/src/cli/TerminalCapabilities.ts +6 -3
- package/src/cli/internal/completions/bash.ts +79 -29
- package/src/cli/internal/help.ts +21 -9
- package/src/cluster/ClusterWorkflowEngine.ts +46 -16
- package/src/cluster/MessageStorage.ts +19 -14
- package/src/cluster/Sharding.ts +176 -47
- package/src/cluster/ShardingConfig.ts +43 -0
- package/src/cluster/SingleRunner.ts +3 -3
- package/src/cluster/Snowflake.ts +3 -7
- package/src/cluster/SqlMessageStorage.ts +49 -17
- package/src/cluster/SqlRunnerStorage.ts +143 -70
- package/src/cluster/internal/entityManager.ts +75 -22
- package/src/crypto/Aead.ts +517 -0
- package/src/crypto/Cipher.ts +326 -0
- package/src/crypto/CryptoError.ts +242 -0
- package/src/crypto/Digest.ts +167 -0
- package/src/crypto/Kdf.ts +315 -0
- package/src/crypto/KeyAgreement.ts +489 -0
- package/src/crypto/KeyFormat.ts +712 -0
- package/src/crypto/KeyWrap.ts +639 -0
- package/src/crypto/Mac.ts +386 -0
- package/src/crypto/SecureRandom.ts +459 -0
- package/src/crypto/Signature.ts +673 -0
- package/src/crypto/WebCrypto.ts +64 -0
- package/src/crypto/index.ts +78 -0
- package/src/crypto/internal/asymmetric.ts +329 -0
- package/src/crypto/internal/chacha.ts +1088 -0
- package/src/crypto/internal/der.ts +110 -0
- package/src/crypto/internal/digest.ts +16 -0
- package/src/crypto/internal/key.ts +235 -0
- package/src/crypto/internal/md5.ts +170 -0
- package/src/crypto/internal/webCrypto.ts +150 -0
- package/src/devtools/DevToolsClient.ts +2 -0
- package/src/encoding/Base64.ts +38 -0
- package/src/encoding/Base64Url.ts +5 -2
- package/src/encoding/Csv.ts +1298 -0
- package/src/encoding/Hex.ts +3 -2
- package/src/encoding/SchemaBinary.ts +40 -4
- package/src/encoding/Sse.ts +4 -3
- package/src/encoding/Toml.ts +117 -35
- package/src/encoding/Yaml.ts +61 -18
- package/src/encoding/index.ts +6 -0
- package/src/eventlog/EventJournal.ts +4 -3
- package/src/eventlog/EventLog.ts +340 -15
- package/src/eventlog/EventLogEncryption.ts +118 -110
- package/src/eventlog/EventLogMessage.ts +273 -1
- package/src/eventlog/EventLogRemote.ts +367 -23
- package/src/eventlog/EventLogServer.ts +23 -8
- package/src/eventlog/EventLogServerEncrypted.ts +1130 -67
- package/src/eventlog/EventLogSessionAuth.ts +56 -70
- package/src/eventlog/EventRow.ts +12 -3
- package/src/eventlog/SqlEventJournal.ts +68 -45
- package/src/eventlog/SqlEventLogServerEncrypted.ts +1244 -136
- package/src/eventlog/SqlEventLogServerUnencrypted.ts +2 -2
- package/src/eventlog/internal/batches.ts +30 -0
- package/src/eventlog/internal/compaction.ts +64 -0
- package/src/eventlog/internal/conflicts.ts +0 -4
- package/src/eventlog/internal/identityRootSecretDerivation.ts +93 -123
- package/src/eventlog/internal/remoteCompaction.ts +92 -0
- package/src/http/Cookies.ts +291 -12
- package/src/http/FetchHttpClient.ts +88 -16
- package/src/http/HttpClient.ts +636 -29
- package/src/http/HttpClientError.ts +35 -1
- package/src/http/HttpClientRequest.ts +21 -10
- package/src/http/HttpClientResponse.ts +3 -2
- package/src/http/HttpMethod.ts +10 -2
- package/src/http/HttpMiddleware.ts +15 -18
- package/src/http/HttpRouter.ts +2 -1
- package/src/http/HttpServerError.ts +2 -2
- package/src/http/HttpServerRequest.ts +101 -30
- package/src/http/HttpServerResponse.ts +3 -2
- package/src/http/HttpStaticServer.ts +51 -22
- package/src/http/HttpTraceContext.ts +7 -4
- package/src/http/MultipartParser/internal/contentType.ts +3 -3
- package/src/http/ProblemDetails.ts +149 -0
- package/src/http/UrlParams.ts +6 -1
- package/src/http/index.ts +6 -0
- package/src/http/internal/compression.ts +4 -5
- package/src/http/internal/decompression.ts +10 -4
- package/src/http/internal/httpBody.ts +10 -2
- package/src/http/internal/urlParams.ts +37 -0
- package/src/http-api/HttpApi.ts +3 -6
- package/src/http-api/HttpApiBuilder.ts +61 -19
- package/src/http-api/HttpApiClient.ts +284 -72
- package/src/http-api/HttpApiEndpoint.ts +135 -35
- package/src/http-api/HttpApiError.ts +250 -0
- package/src/http-api/HttpApiMiddleware.ts +95 -1
- package/src/http-api/HttpApiSchema.ts +236 -52
- package/src/http-api/HttpApiTest.ts +3 -2
- package/src/http-api/OpenApi.ts +20 -17
- package/src/http-api/internal/toCodecHttpProperties.ts +56 -0
- package/src/index.ts +6 -6
- package/src/internal/arbitrary/runner.ts +133 -36
- package/src/internal/core.ts +2 -0
- package/src/internal/effect.ts +58 -34
- package/src/internal/equal.ts +17 -0
- package/src/internal/glob.ts +736 -0
- package/src/internal/jsonSchema.ts +27 -0
- package/src/internal/matcher.ts +18 -1
- package/src/internal/persistence.ts +11 -0
- package/src/internal/rcRef.ts +4 -1
- package/src/internal/schema/compilerRegistry.ts +6 -1
- package/src/internal/schema/content.ts +18 -0
- package/src/internal/schema/fromJsonSchemaDocument.ts +228 -190
- package/src/internal/schema/fromRepresentation.ts +2 -1
- package/src/internal/schema/standardSchema.ts +2 -2
- package/src/internal/schema/toCodeDocument.ts +11 -7
- package/src/internal/schema/toCodec.ts +26 -22
- package/src/internal/schema/toJsonSchemaDocument.ts +189 -167
- package/src/internal/schema/toRepresentation.ts +122 -140
- package/src/internal/sql.ts +14 -0
- package/src/internal/trie.ts +43 -14
- package/src/internal/ulid.ts +44 -0
- package/src/internal/uuid.ts +57 -16
- package/src/internal/version.ts +1 -1
- package/src/observability/Otlp.ts +21 -4
- package/src/observability/OtlpProxy.ts +314 -0
- package/src/observability/OtlpResource.ts +9 -1
- package/src/observability/OtlpTracer.ts +4 -0
- package/src/observability/index.ts +6 -0
- package/src/persistence/CircuitBreaker.ts +1678 -0
- package/src/persistence/KeyValueStore.ts +219 -22
- package/src/persistence/PersistedQueue.ts +128 -59
- package/src/persistence/Persistence.ts +20 -13
- package/src/persistence/Redis.ts +129 -8
- package/src/persistence/index.ts +6 -0
- package/src/process/ChildProcess.ts +285 -264
- package/src/process/ChildProcessSpawner.ts +46 -2
- package/src/process/CommandLine.ts +630 -0
- package/src/process/index.ts +6 -0
- package/src/reactivity/AsyncResult.ts +1 -1
- package/src/reactivity/Atom.ts +5 -5
- package/src/reactivity/AtomRegistry.ts +1 -1
- package/src/rpc/RpcClient.ts +75 -36
- package/src/rpc/RpcMessage.ts +10 -1
- package/src/rpc/RpcSerialization.ts +35 -9
- package/src/rpc/RpcServer.ts +176 -63
- package/src/rpc/RpcTest.ts +3 -0
- package/src/schema/Model.ts +26 -3
- package/src/sql/Migrator.ts +15 -69
- package/src/sql/MigratorFileSystem.ts +71 -0
- package/src/sql/SqlClient.ts +13 -20
- package/src/sql/SqlResolver.ts +23 -9
- package/src/sql/Statement.ts +38 -9
- package/src/sql/index.ts +1 -1
- package/src/testing/index.ts +0 -6
- package/src/workflow/DurableDeferred.ts +23 -6
- package/src/workflow/internal/crypto.ts +15 -11
- package/dist/Crypto.d.ts +0 -244
- package/dist/Crypto.d.ts.map +0 -1
- package/dist/Crypto.js +0 -139
- package/dist/Crypto.js.map +0 -1
- package/dist/testing/TestCrypto.d.ts +0 -73
- package/dist/testing/TestCrypto.d.ts.map +0 -1
- package/dist/testing/TestCrypto.js +0 -87
- package/dist/testing/TestCrypto.js.map +0 -1
- package/src/Crypto.ts +0 -347
- package/src/testing/TestCrypto.ts +0 -94
|
@@ -9,6 +9,62 @@
|
|
|
9
9
|
* constructors, payload and response schema helpers, and type utilities used by
|
|
10
10
|
* builders and generated clients.
|
|
11
11
|
*
|
|
12
|
+
* **Request variants**
|
|
13
|
+
*
|
|
14
|
+
* A server needs a distinct method and path per endpoint.
|
|
15
|
+
* `HttpApiBuilder.layer` rejects two endpoints that share them, even when their
|
|
16
|
+
* query, headers or payload differ. Declare the variants of one operation as a
|
|
17
|
+
* single endpoint instead:
|
|
18
|
+
*
|
|
19
|
+
* - discriminate with a `query` or `headers` field, such as `stream: Schema.Boolean`
|
|
20
|
+
* - list several `payload` schemas, chosen by the request `Content-Type`
|
|
21
|
+
* - list several `success` schemas with distinct content types or statuses. One
|
|
22
|
+
* of them can be a stream. The server encodes whichever value the handler
|
|
23
|
+
* returns, and the client decodes by the response `Content-Type`
|
|
24
|
+
*
|
|
25
|
+
* The handler branches on the decoded request, and OpenAPI documents one
|
|
26
|
+
* operation with every alternative. The generated client returns the union of
|
|
27
|
+
* the success types. Wrap the client method to narrow the result per variant
|
|
28
|
+
* when callers need it.
|
|
29
|
+
*
|
|
30
|
+
* **Example** (Buffered and streaming variants of one operation)
|
|
31
|
+
*
|
|
32
|
+
* ```ts import.meta.vitest
|
|
33
|
+
* import { Effect, Schema, Stream } from "effect"
|
|
34
|
+
* import { HttpApi, HttpApiBuilder, HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/http-api"
|
|
35
|
+
*
|
|
36
|
+
* const Stats = Schema.Struct({ cpu: Schema.Number })
|
|
37
|
+
*
|
|
38
|
+
* const Api = HttpApi.make("Docker").add(
|
|
39
|
+
* HttpApiGroup.make("containers").add(
|
|
40
|
+
* // GET /stats?stream=false returns JSON, ?stream=true returns NDJSON
|
|
41
|
+
* HttpApiEndpoint.get("stats", "/stats", {
|
|
42
|
+
* query: { stream: Schema.Boolean },
|
|
43
|
+
* success: [Stats, HttpApiSchema.StreamNdjson({ schema: Stats })]
|
|
44
|
+
* }),
|
|
45
|
+
* // POST /images accepts a JSON pull request or a tar archive
|
|
46
|
+
* HttpApiEndpoint.post("createImage", "/images", {
|
|
47
|
+
* payload: [
|
|
48
|
+
* Schema.Struct({ fromImage: Schema.String }),
|
|
49
|
+
* HttpApiSchema.StreamUint8Array({ contentType: "application/x-tar" })
|
|
50
|
+
* ],
|
|
51
|
+
* success: Schema.String
|
|
52
|
+
* })
|
|
53
|
+
* )
|
|
54
|
+
* )
|
|
55
|
+
*
|
|
56
|
+
* const ContainersLive = HttpApiBuilder.group(Api, "containers", (handlers) =>
|
|
57
|
+
* handlers
|
|
58
|
+
* .handle("stats", ({ query }) =>
|
|
59
|
+
* Effect.succeed(query.stream ? Stream.make({ cpu: 1 }, { cpu: 2 }) : { cpu: 1 })
|
|
60
|
+
* )
|
|
61
|
+
* .handle("createImage", ({ payload }) =>
|
|
62
|
+
* Stream.isStream(payload)
|
|
63
|
+
* ? Effect.as(Stream.runDrain(payload), "imported")
|
|
64
|
+
* : Effect.succeed(`pulled ${payload.fromImage}`)
|
|
65
|
+
* ))
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
12
68
|
* @stability unstable
|
|
13
69
|
* @since 4.0.0
|
|
14
70
|
*/
|
|
@@ -36,6 +92,7 @@ import type * as HttpApiGroup from "./HttpApiGroup.ts"
|
|
|
36
92
|
import type * as HttpApiMiddleware from "./HttpApiMiddleware.ts"
|
|
37
93
|
import * as HttpApiSchema from "./HttpApiSchema.ts"
|
|
38
94
|
import * as MediaType from "./internal/mediaType.ts"
|
|
95
|
+
import { toCodecHttpProperties } from "./internal/toCodecHttpProperties.ts"
|
|
39
96
|
|
|
40
97
|
const TypeId = "~effect/http-api/HttpApiEndpoint"
|
|
41
98
|
|
|
@@ -71,6 +128,7 @@ type SuccessEncodingServices<S> = S extends HttpApiSchema.StreamSse<
|
|
|
71
128
|
> ? _Events["EncodingServices"] | _Error["EncodingServices"]
|
|
72
129
|
: S extends HttpApiSchema.StreamUint8Array ? never
|
|
73
130
|
: S extends HttpApiSchema.StreamNdjson<infer _S> ? _S["EncodingServices"]
|
|
131
|
+
: S extends HttpApiSchema.Upgrade<infer _Headers> ? _Headers["EncodingServices"]
|
|
74
132
|
: S extends Schema.Constraint ? S["EncodingServices"]
|
|
75
133
|
: never
|
|
76
134
|
|
|
@@ -81,6 +139,7 @@ type SuccessDecodingServices<S> = S extends HttpApiSchema.StreamSse<
|
|
|
81
139
|
> ? _Events["DecodingServices"] | _Error["DecodingServices"]
|
|
82
140
|
: S extends HttpApiSchema.StreamUint8Array ? never
|
|
83
141
|
: S extends HttpApiSchema.StreamNdjson<infer _S> ? _S["DecodingServices"]
|
|
142
|
+
: S extends HttpApiSchema.Upgrade<infer _Headers> ? _Headers["DecodingServices"]
|
|
84
143
|
: S extends Schema.Constraint ? S["DecodingServices"]
|
|
85
144
|
: never
|
|
86
145
|
|
|
@@ -95,10 +154,19 @@ type ExtractStreamSuccess<S extends SuccessConstraint> = UnwrapReadonlyArray<S>
|
|
|
95
154
|
Success extends HttpApiSchema.StreamSchema ? Success : never
|
|
96
155
|
: never
|
|
97
156
|
|
|
98
|
-
type ExtractUpgradeSuccess<S extends SuccessConstraint> =
|
|
157
|
+
type ExtractUpgradeSuccess<S extends SuccessConstraint> = UnwrapReadonlyArray<S> extends infer Success ?
|
|
158
|
+
Success extends HttpApiSchema.Upgrade<infer _Headers> ?
|
|
159
|
+
[_Headers] extends [never] ? Success : HttpApiSchema.Upgrade<Schema.toCodecStringTree<_Headers>>
|
|
160
|
+
: never
|
|
161
|
+
: never
|
|
162
|
+
|
|
163
|
+
type UpgradeRequest<Success> = [Extract<Success, HttpApiSchema.Upgrade>] extends [never] ? {}
|
|
164
|
+
: { readonly upgrade: UpgradeFunction<Extract<Success, HttpApiSchema.Upgrade>> }
|
|
99
165
|
|
|
100
|
-
type
|
|
101
|
-
|
|
166
|
+
type UpgradeFunction<S> = S extends HttpApiSchema.Upgrade<infer _Headers> ?
|
|
167
|
+
[_Headers] extends [never] ? () => Effect<Socket.Socket>
|
|
168
|
+
: (options: { readonly headers: _Headers["Type"] }) => Effect<Socket.Socket>
|
|
169
|
+
: never
|
|
102
170
|
|
|
103
171
|
type ExtractWithHeadersSuccess<S extends SuccessConstraint> = UnwrapReadonlyArray<S> extends infer Success ?
|
|
104
172
|
Success extends HttpApiSchema.WithHeaders<infer _Inner, infer _Headers> ? HttpApiSchema.WithHeaders<
|
|
@@ -148,7 +216,7 @@ type PayloadError<Payload> = Payload extends HttpApiSchema.StreamUint8Array ? Ht
|
|
|
148
216
|
: never
|
|
149
217
|
|
|
150
218
|
type RequestFromParts<Endpoint, ParamsType, QueryType, Payload, HeadersType, Success> =
|
|
151
|
-
&
|
|
219
|
+
& UpgradeRequest<Success>
|
|
152
220
|
& ([ParamsType] extends [never] ? {} : { readonly params: Simplify<ParamsType> })
|
|
153
221
|
& ([QueryType] extends [never] ? {} : { readonly query: Simplify<QueryType> })
|
|
154
222
|
& ([Payload] extends [never] ? {} : { readonly payload: RequestPayload<Payload> })
|
|
@@ -160,7 +228,7 @@ type RequestFromParts<Endpoint, ParamsType, QueryType, Payload, HeadersType, Suc
|
|
|
160
228
|
}
|
|
161
229
|
|
|
162
230
|
type RequestRawFromParts<Endpoint, ParamsType, QueryType, HeadersType, Success> =
|
|
163
|
-
&
|
|
231
|
+
& UpgradeRequest<Success>
|
|
164
232
|
& ([ParamsType] extends [never] ? {} : { readonly params: Simplify<ParamsType> })
|
|
165
233
|
& ([QueryType] extends [never] ? {} : { readonly query: Simplify<QueryType> })
|
|
166
234
|
& ([HeadersType] extends [never] ? {} : { readonly headers: Simplify<HeadersType> })
|
|
@@ -1111,6 +1179,16 @@ type ErrorNoStream<S extends ErrorConstraint> = [
|
|
|
1111
1179
|
* and response schemas, applying automatic JSON or string-tree codecs unless
|
|
1112
1180
|
* `disableCodecs` is enabled.
|
|
1113
1181
|
*
|
|
1182
|
+
* **Gotchas**
|
|
1183
|
+
*
|
|
1184
|
+
* URL parameters are flat on the server: each `query` field, each field of a
|
|
1185
|
+
* no-body `payload` and each field of a form-urlencoded `payload` should encode
|
|
1186
|
+
* to a string or an array of strings. A field that encodes to a nested object
|
|
1187
|
+
* is sent as bracket keys (`meta[k]=v`) that the server does not read back, so
|
|
1188
|
+
* it is dropped, or reported missing when required. Send structured values with
|
|
1189
|
+
* an explicit codec such as `Schema.fromJsonString(...)`, or declare bracket
|
|
1190
|
+
* keys literally, for example `"page[size]": Schema.String`.
|
|
1191
|
+
*
|
|
1114
1192
|
* @stability unstable
|
|
1115
1193
|
* @category constructors
|
|
1116
1194
|
* @since 4.0.0
|
|
@@ -1217,16 +1295,17 @@ export const make = <Method extends HttpMethod>(method: Method): {
|
|
|
1217
1295
|
Error extends ReadonlyArray<Schema.Constraint> ? Error[number] : Error
|
|
1218
1296
|
> => {
|
|
1219
1297
|
const disableCodecs = options?.disableCodecs ?? false
|
|
1220
|
-
const
|
|
1298
|
+
const transformProperties = disableCodecs ? identity : toCodecHttpProperties
|
|
1299
|
+
const payload = getPayload(options?.payload, method, disableCodecs)
|
|
1221
1300
|
return makeProto({
|
|
1222
1301
|
identifier,
|
|
1223
1302
|
path,
|
|
1224
1303
|
method,
|
|
1225
|
-
params: ensureStruct(options?.params,
|
|
1226
|
-
query: ensureStruct(options?.query,
|
|
1227
|
-
headers: ensureStruct(options?.headers,
|
|
1228
|
-
payload
|
|
1229
|
-
success: getSuccessResponse(options?.success, method,
|
|
1304
|
+
params: ensureStruct(options?.params, transformProperties),
|
|
1305
|
+
query: ensureStruct(options?.query, transformProperties),
|
|
1306
|
+
headers: ensureStruct(options?.headers, transformProperties),
|
|
1307
|
+
payload,
|
|
1308
|
+
success: getSuccessResponse(options?.success, method, payload, disableCodecs),
|
|
1230
1309
|
error: getErrorResponse(options?.error, disableCodecs),
|
|
1231
1310
|
annotations: Context.empty(),
|
|
1232
1311
|
middlewares: new Set(),
|
|
@@ -1281,11 +1360,13 @@ function getPayload(
|
|
|
1281
1360
|
throw new Error("Multiple streaming payloads are not supported")
|
|
1282
1361
|
}
|
|
1283
1362
|
hasStream = true
|
|
1284
|
-
const
|
|
1285
|
-
|
|
1286
|
-
|
|
1363
|
+
for (const declared of schema.contentTypes) {
|
|
1364
|
+
const contentType = MediaType.normalize(declared)
|
|
1365
|
+
if (result.has(contentType)) {
|
|
1366
|
+
throw new Error(`Cannot combine buffered and streaming payloads for content-type: ${declared}`)
|
|
1367
|
+
}
|
|
1368
|
+
result.set(contentType, { encoding: { _tag: "Stream", contentType: declared }, schemas: [schema] })
|
|
1287
1369
|
}
|
|
1288
|
-
result.set(contentType, { encoding: { _tag: "Stream", contentType: schema.contentType }, schemas: [schema] })
|
|
1289
1370
|
continue
|
|
1290
1371
|
}
|
|
1291
1372
|
const encoding = HttpApiSchema.getPayloadEncoding(schema.ast, method)
|
|
@@ -1314,22 +1395,27 @@ const reservedStreamFailureEvent = "effect/http-api/stream/failure"
|
|
|
1314
1395
|
function getSuccessResponse(
|
|
1315
1396
|
success: Schema.Top | ReadonlyArray<Schema.Top> | undefined,
|
|
1316
1397
|
method: HttpMethod,
|
|
1317
|
-
|
|
1398
|
+
payload: PayloadMap,
|
|
1318
1399
|
disableCodecs: boolean
|
|
1319
1400
|
): Set<Schema.Top> {
|
|
1320
1401
|
if (success === undefined) return new Set()
|
|
1321
1402
|
const schemas = Arr.ensure(success)
|
|
1322
|
-
validateSuccessResponse(schemas, method,
|
|
1403
|
+
validateSuccessResponse(schemas, method, payload)
|
|
1323
1404
|
return new Set(disableCodecs ? schemas : schemas.map(transformResponseSchema))
|
|
1324
1405
|
}
|
|
1325
1406
|
|
|
1326
1407
|
const transformResponseSchema = memoize((schema: Schema.Top): Schema.Top => {
|
|
1327
|
-
if (HttpApiSchema.isStreamSchema(schema)
|
|
1408
|
+
if (HttpApiSchema.isStreamSchema(schema)) return schema
|
|
1409
|
+
if (HttpApiSchema.isUpgrade(schema)) {
|
|
1410
|
+
return schema.headers === undefined
|
|
1411
|
+
? schema
|
|
1412
|
+
: HttpApiSchema.rebuildUpgrade(schema.protocol, toCodecHttpProperties(schema.headers))
|
|
1413
|
+
}
|
|
1328
1414
|
if (HttpApiSchema.isWithHeaders(schema)) {
|
|
1329
1415
|
const inner = HttpApiSchema.isStreamSchema(schema.schema)
|
|
1330
1416
|
? schema.schema
|
|
1331
1417
|
: applyResponseEncoding(schema.schema, HttpApiSchema.getResponseEncodingSchema(schema))
|
|
1332
|
-
return HttpApiSchema.rebuildWithHeaders(schema, inner,
|
|
1418
|
+
return HttpApiSchema.rebuildWithHeaders(schema, inner, toCodecHttpProperties(schema.headers))
|
|
1333
1419
|
}
|
|
1334
1420
|
return transformResponse(schema)
|
|
1335
1421
|
})
|
|
@@ -1353,18 +1439,22 @@ function getErrorResponse(
|
|
|
1353
1439
|
return new Set(disableCodecs ? schemas : schemas.map(transformResponseSchema))
|
|
1354
1440
|
}
|
|
1355
1441
|
|
|
1356
|
-
function validateSuccessResponse(schemas: ReadonlyArray<Schema.Constraint>, method: HttpMethod,
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1442
|
+
function validateSuccessResponse(schemas: ReadonlyArray<Schema.Constraint>, method: HttpMethod, payload: PayloadMap) {
|
|
1443
|
+
const upgrades = schemas.filter(HttpApiSchema.isUpgrade)
|
|
1444
|
+
if (upgrades.length > 1) {
|
|
1445
|
+
throw new Error("Cannot declare more than one upgrade")
|
|
1446
|
+
}
|
|
1447
|
+
const hasUpgrade = upgrades.length === 1
|
|
1448
|
+
if (hasUpgrade) {
|
|
1361
1449
|
if (method === "HEAD") {
|
|
1362
1450
|
throw new Error("HEAD endpoints cannot declare an upgrade")
|
|
1363
1451
|
}
|
|
1364
|
-
|
|
1365
|
-
|
|
1452
|
+
// The 101 can only follow the end of the request, so the body is read before the upgrade.
|
|
1453
|
+
for (const { encoding } of payload.values()) {
|
|
1454
|
+
if (encoding._tag === "Stream" || (encoding._tag === "Multipart" && encoding.mode === "stream")) {
|
|
1455
|
+
throw new Error("Upgrade endpoints cannot declare a streaming payload")
|
|
1456
|
+
}
|
|
1366
1457
|
}
|
|
1367
|
-
return
|
|
1368
1458
|
}
|
|
1369
1459
|
let hasStream = false
|
|
1370
1460
|
const statuses = new Map<number, {
|
|
@@ -1374,9 +1464,17 @@ function validateSuccessResponse(schemas: ReadonlyArray<Schema.Constraint>, meth
|
|
|
1374
1464
|
}>()
|
|
1375
1465
|
|
|
1376
1466
|
for (const schema of schemas) {
|
|
1467
|
+
// The server may decline the upgrade (RFC 9110 §7.8) and answer with one of the other successes.
|
|
1468
|
+
if (HttpApiSchema.isUpgrade(schema)) continue
|
|
1377
1469
|
const inner = HttpApiSchema.isWithHeaders(schema) ? schema.schema : schema
|
|
1378
1470
|
const status = HttpApiSchema.getStatusSuccessSchema(schema)
|
|
1471
|
+
if (hasUpgrade && status === 101) {
|
|
1472
|
+
throw new Error("Cannot combine an upgrade with another success response for status: 101")
|
|
1473
|
+
}
|
|
1379
1474
|
if (HttpApiSchema.isStreamSchema(inner)) {
|
|
1475
|
+
if (hasUpgrade) {
|
|
1476
|
+
throw new Error("Cannot combine an upgrade with a streaming success response")
|
|
1477
|
+
}
|
|
1380
1478
|
validateStreamSuccess(inner, method)
|
|
1381
1479
|
if (hasStream) {
|
|
1382
1480
|
throw new Error("Multiple streaming success responses are not supported")
|
|
@@ -1386,10 +1484,12 @@ function validateSuccessResponse(schemas: ReadonlyArray<Schema.Constraint>, meth
|
|
|
1386
1484
|
if (entry.noContent) {
|
|
1387
1485
|
throw new Error(`Cannot combine no-content and streaming success responses for status: ${status}`)
|
|
1388
1486
|
}
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1487
|
+
for (const declared of inner.contentTypes) {
|
|
1488
|
+
if (entry.bufferedContentTypes.has(MediaType.normalize(declared))) {
|
|
1489
|
+
throw new Error(
|
|
1490
|
+
`Cannot combine buffered and streaming success responses for status ${status} and content-type: ${declared}`
|
|
1491
|
+
)
|
|
1492
|
+
}
|
|
1393
1493
|
}
|
|
1394
1494
|
statuses.set(status, { ...entry, stream: inner })
|
|
1395
1495
|
} else {
|
|
@@ -1400,9 +1500,8 @@ function validateSuccessResponse(schemas: ReadonlyArray<Schema.Constraint>, meth
|
|
|
1400
1500
|
throw new Error(`Cannot combine no-content and streaming success responses for status: ${status}`)
|
|
1401
1501
|
}
|
|
1402
1502
|
const encoding = HttpApiSchema.getResponseEncodingSchema(schema)
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
) {
|
|
1503
|
+
const contentType = MediaType.normalize(encoding.contentType)
|
|
1504
|
+
if (entry.stream.contentTypes.some((declared) => MediaType.normalize(declared) === contentType)) {
|
|
1406
1505
|
throw new Error(
|
|
1407
1506
|
`Cannot combine buffered and streaming success responses for status ${status} and content-type: ${encoding.contentType}`
|
|
1408
1507
|
)
|
|
@@ -1535,7 +1634,7 @@ function transformResponse(schema: Schema.Top): Schema.Top {
|
|
|
1535
1634
|
"~httpApiWithHeaders": {
|
|
1536
1635
|
...withHeaders,
|
|
1537
1636
|
bodyCodec: applyResponseEncoding(withHeaders.body, encoding),
|
|
1538
|
-
headersCodec:
|
|
1637
|
+
headersCodec: toCodecHttpProperties(withHeaders.headers)
|
|
1539
1638
|
}
|
|
1540
1639
|
})
|
|
1541
1640
|
}
|
|
@@ -1553,6 +1652,7 @@ function applyResponseEncoding(schema: Schema.Top, encoding: HttpApiSchema.Respo
|
|
|
1553
1652
|
}
|
|
1554
1653
|
|
|
1555
1654
|
function transformPayload(schema: Schema.Top, method: HttpMethod): Schema.Top {
|
|
1655
|
+
if (!hasBody(method)) return toCodecHttpProperties(schema)
|
|
1556
1656
|
const encoding = HttpApiSchema.getPayloadEncoding(schema.ast, method)
|
|
1557
1657
|
switch (encoding._tag) {
|
|
1558
1658
|
case "Json":
|
|
@@ -11,13 +11,16 @@
|
|
|
11
11
|
* @since 4.0.0
|
|
12
12
|
*/
|
|
13
13
|
import type * as ByteSize from "../ByteSize.ts"
|
|
14
|
+
import type * as Cause from "../Cause.ts"
|
|
14
15
|
import * as Data from "../Data.ts"
|
|
15
16
|
import * as Effect from "../Effect.ts"
|
|
16
17
|
import * as ErrorReporter from "../ErrorReporter.ts"
|
|
17
18
|
import * as HttpServerRespondable from "../http/HttpServerRespondable.ts"
|
|
18
19
|
import * as HttpServerResponse from "../http/HttpServerResponse.ts"
|
|
20
|
+
import * as ProblemDetails from "../http/ProblemDetails.ts"
|
|
19
21
|
import { hasProperty } from "../Predicate.ts"
|
|
20
22
|
import * as Schema from "../Schema.ts"
|
|
23
|
+
import type { Simplify } from "../Struct.ts"
|
|
21
24
|
import * as HttpApiSchema from "./HttpApiSchema.ts"
|
|
22
25
|
|
|
23
26
|
const badRequestResponse = HttpServerResponse.empty({ status: 400 })
|
|
@@ -449,6 +452,253 @@ export const ServiceUnavailableNoContent = ServiceUnavailable.pipe(HttpApiSchema
|
|
|
449
452
|
decode: () => new ServiceUnavailable({})
|
|
450
453
|
}))
|
|
451
454
|
|
|
455
|
+
/**
|
|
456
|
+
* The constant members of a typed problem declaration.
|
|
457
|
+
*
|
|
458
|
+
* @stability unstable
|
|
459
|
+
* @category models
|
|
460
|
+
* @since 4.0.6
|
|
461
|
+
*/
|
|
462
|
+
export interface ProblemDeclaration<Type extends string, Status extends number> {
|
|
463
|
+
/**
|
|
464
|
+
* The problem type URI. It is the discriminator between problem classes that
|
|
465
|
+
* share a status.
|
|
466
|
+
*/
|
|
467
|
+
readonly type: Type
|
|
468
|
+
/**
|
|
469
|
+
* The HTTP status of the response.
|
|
470
|
+
*/
|
|
471
|
+
readonly status: Status
|
|
472
|
+
/**
|
|
473
|
+
* The short human-readable summary of the problem type.
|
|
474
|
+
*/
|
|
475
|
+
readonly title: string
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* The standard problem members of a typed problem class.
|
|
480
|
+
*
|
|
481
|
+
* **Details**
|
|
482
|
+
*
|
|
483
|
+
* `type`, `status` and `title` are fixed by the declaration and are constructor
|
|
484
|
+
* defaults that are always encoded. `type` is the discriminator: a body with a
|
|
485
|
+
* different `type` is rejected. `status` and `title` decode to the declared
|
|
486
|
+
* value whatever the body carries, so the HTTP status stays authoritative.
|
|
487
|
+
* `detail` and `instance` are optional per-instance members that declared
|
|
488
|
+
* fields may replace.
|
|
489
|
+
*
|
|
490
|
+
* @stability unstable
|
|
491
|
+
* @category models
|
|
492
|
+
* @since 4.0.6
|
|
493
|
+
*/
|
|
494
|
+
export interface ProblemMembers<Type extends string, Status extends number> {
|
|
495
|
+
readonly type: Schema.tag<Type>
|
|
496
|
+
readonly status: FixedMember<Status>
|
|
497
|
+
readonly title: FixedMember<string>
|
|
498
|
+
readonly detail: OptionalMember<Schema.String>
|
|
499
|
+
readonly instance: OptionalMember<Schema.String>
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
type FixedMember<L extends string | number> = Schema.middlewareDecoding<
|
|
503
|
+
Schema.withDecodingDefaultKey<Schema.tag<L>>,
|
|
504
|
+
never
|
|
505
|
+
>
|
|
506
|
+
|
|
507
|
+
type OptionalMember<S extends Schema.Constraint> = Schema.middlewareDecoding<Schema.optionalKey<S>, never>
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* The fields of a typed problem class: the standard members plus the declared
|
|
511
|
+
* extension fields.
|
|
512
|
+
*
|
|
513
|
+
* @stability unstable
|
|
514
|
+
* @category models
|
|
515
|
+
* @since 4.0.6
|
|
516
|
+
*/
|
|
517
|
+
export type ProblemFields<Type extends string, Status extends number, Fields extends Schema.Struct.Fields> = Simplify<
|
|
518
|
+
Omit<ProblemMembers<Type, Status>, keyof Fields> & Fields
|
|
519
|
+
>
|
|
520
|
+
|
|
521
|
+
/**
|
|
522
|
+
* The extension fields a typed problem may declare. The fixed members `type`,
|
|
523
|
+
* `status` and `title` are reserved.
|
|
524
|
+
*
|
|
525
|
+
* @stability unstable
|
|
526
|
+
* @category models
|
|
527
|
+
* @since 4.0.6
|
|
528
|
+
*/
|
|
529
|
+
export type ProblemExtensionFields = Schema.Struct.Fields & {
|
|
530
|
+
readonly type?: never
|
|
531
|
+
readonly status?: never
|
|
532
|
+
readonly title?: never
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
const problemEncoding: HttpApiSchema.ResponseEncoding = { _tag: "Json", contentType: ProblemDetails.contentType }
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* The class returned by {@link Problem}.
|
|
539
|
+
*
|
|
540
|
+
* @stability unstable
|
|
541
|
+
* @category models
|
|
542
|
+
* @since 4.0.6
|
|
543
|
+
*/
|
|
544
|
+
export interface ProblemClass<
|
|
545
|
+
Self,
|
|
546
|
+
Tag extends string,
|
|
547
|
+
Type extends string,
|
|
548
|
+
Status extends number,
|
|
549
|
+
Fields extends Schema.Struct.Fields,
|
|
550
|
+
Brand
|
|
551
|
+
> extends
|
|
552
|
+
Schema.Class<
|
|
553
|
+
Self,
|
|
554
|
+
Schema.Struct<ProblemFields<Type, Status, Fields>>,
|
|
555
|
+
Cause.YieldableError & HttpServerRespondable.Respondable & Brand & { readonly _tag: Tag }
|
|
556
|
+
>
|
|
557
|
+
{}
|
|
558
|
+
|
|
559
|
+
type MissingSelfGeneric = "Missing `Self` generic - use `class Self extends HttpApiError.Problem<Self>()(...)`"
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* Declares a typed RFC 9457 problem as a yieldable error class.
|
|
563
|
+
*
|
|
564
|
+
* **Details**
|
|
565
|
+
*
|
|
566
|
+
* The class is a `Schema.Error` whose `_tag` is the given tag, so `Effect.catchTag`
|
|
567
|
+
* works without `_tag` on the wire. It carries the `httpApiStatus` and
|
|
568
|
+
* `application/problem+json` annotations, so endpoints that declare it as an
|
|
569
|
+
* error render, document and decode it as a problem. Problem classes that
|
|
570
|
+
* share a status are told apart by `type`. The extension fields are validated
|
|
571
|
+
* on both sides and cannot replace `type`, `status` or `title`; unknown
|
|
572
|
+
* extensions are not kept. An undeclared instance still renders as a problem
|
|
573
|
+
* through `HttpServerRespondable`.
|
|
574
|
+
*
|
|
575
|
+
* **Example** (Declaring and using a typed problem)
|
|
576
|
+
*
|
|
577
|
+
* ```ts
|
|
578
|
+
* import { Effect, Schema } from "effect"
|
|
579
|
+
* import { HttpApiEndpoint, HttpApiError } from "effect/http-api"
|
|
580
|
+
*
|
|
581
|
+
* class OutOfCredit extends HttpApiError.Problem<OutOfCredit>()("OutOfCredit", {
|
|
582
|
+
* type: "https://example.com/probs/out-of-credit",
|
|
583
|
+
* status: 403,
|
|
584
|
+
* title: "You do not have enough credit."
|
|
585
|
+
* }, {
|
|
586
|
+
* balance: Schema.Number
|
|
587
|
+
* }) {}
|
|
588
|
+
*
|
|
589
|
+
* const buy = HttpApiEndpoint.post("buy", "/buy", { error: OutOfCredit })
|
|
590
|
+
*
|
|
591
|
+
* const failing = Effect.fail(new OutOfCredit({ balance: 30 }))
|
|
592
|
+
* // Responds with 403 and { "type": "https://example.com/probs/out-of-credit",
|
|
593
|
+
* // "status": 403, "title": "You do not have enough credit.", "balance": 30 }
|
|
594
|
+
* ```
|
|
595
|
+
*
|
|
596
|
+
* @stability unstable
|
|
597
|
+
* @category constructors
|
|
598
|
+
* @since 4.0.6
|
|
599
|
+
*/
|
|
600
|
+
export const Problem = <Self = never, Brand = {}>() =>
|
|
601
|
+
<
|
|
602
|
+
const Tag extends string,
|
|
603
|
+
const Type extends string,
|
|
604
|
+
const Status extends number,
|
|
605
|
+
const Fields extends ProblemExtensionFields = {}
|
|
606
|
+
>(
|
|
607
|
+
tag: Tag,
|
|
608
|
+
declaration: ProblemDeclaration<Type, Status>,
|
|
609
|
+
fields?: Fields,
|
|
610
|
+
annotations?: Schema.Annotations.Declaration<Self, readonly [Schema.Struct<ProblemFields<Type, Status, Fields>>]>
|
|
611
|
+
): [Self] extends [never] ? MissingSelfGeneric
|
|
612
|
+
: ProblemClass<Self, Tag, Type, Status, Fields, Brand> =>
|
|
613
|
+
{
|
|
614
|
+
const struct = Schema.Struct({
|
|
615
|
+
detail: ProblemDetails.optionalMember(Schema.String),
|
|
616
|
+
instance: ProblemDetails.optionalMember(Schema.String),
|
|
617
|
+
...fields,
|
|
618
|
+
type: Schema.tag(declaration.type),
|
|
619
|
+
status: ProblemDetails.fixedMember(declaration.status),
|
|
620
|
+
title: ProblemDetails.fixedMember(declaration.title)
|
|
621
|
+
})
|
|
622
|
+
const encode = Schema.encodeUnknownEffect(struct)
|
|
623
|
+
const Base = Schema.Error<any, {}>(tag)(struct, {
|
|
624
|
+
description: declaration.title,
|
|
625
|
+
httpApiStatus: declaration.status,
|
|
626
|
+
"~httpApiEncoding": problemEncoding,
|
|
627
|
+
...annotations as {}
|
|
628
|
+
})
|
|
629
|
+
Object.assign(Base.prototype, {
|
|
630
|
+
_tag: tag,
|
|
631
|
+
[ErrorReporter.ignore]: declaration.status < 500,
|
|
632
|
+
[HttpServerRespondable.symbol](this: object) {
|
|
633
|
+
return Effect.map(
|
|
634
|
+
encode(this),
|
|
635
|
+
(body) =>
|
|
636
|
+
HttpServerResponse.jsonUnsafe(body, { status: declaration.status, contentType: ProblemDetails.contentType })
|
|
637
|
+
)
|
|
638
|
+
}
|
|
639
|
+
})
|
|
640
|
+
Object.defineProperty(Base.prototype, "message", {
|
|
641
|
+
get(this: { readonly detail?: string }) {
|
|
642
|
+
return this.detail ?? declaration.title
|
|
643
|
+
},
|
|
644
|
+
configurable: true
|
|
645
|
+
})
|
|
646
|
+
return Base as any
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* One entry of `BadRequestProblem.errors`: the location of a request value
|
|
651
|
+
* that failed decoding and the reason.
|
|
652
|
+
*
|
|
653
|
+
* **Details**
|
|
654
|
+
*
|
|
655
|
+
* The first path segment names the request slot (`params`, `headers`, `query`
|
|
656
|
+
* or `payload`).
|
|
657
|
+
*
|
|
658
|
+
* @stability unstable
|
|
659
|
+
* @category schemas
|
|
660
|
+
* @since 4.0.6
|
|
661
|
+
*/
|
|
662
|
+
export const ProblemIssue = Schema.Struct({
|
|
663
|
+
path: Schema.Array(Schema.Union([Schema.String, Schema.Number])),
|
|
664
|
+
message: Schema.String
|
|
665
|
+
})
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
* The problem rendered by `HttpApiMiddleware.layerProblemDetails` when a
|
|
669
|
+
* request fails decoding.
|
|
670
|
+
*
|
|
671
|
+
* **Details**
|
|
672
|
+
*
|
|
673
|
+
* The body is generic by default. `errors` is only filled when the layer is
|
|
674
|
+
* built with `includeDetails: true`.
|
|
675
|
+
*
|
|
676
|
+
* @stability unstable
|
|
677
|
+
* @category errors
|
|
678
|
+
* @since 4.0.6
|
|
679
|
+
*/
|
|
680
|
+
export class BadRequestProblem extends Problem<BadRequestProblem>()("BadRequestProblem", {
|
|
681
|
+
type: ProblemDetails.blankType,
|
|
682
|
+
status: 400,
|
|
683
|
+
title: "Bad Request"
|
|
684
|
+
}, {
|
|
685
|
+
errors: Schema.optionalKey(Schema.Array(ProblemIssue))
|
|
686
|
+
}) {}
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* The problem rendered by `HttpApiMiddleware.layerProblemDetails` when a
|
|
690
|
+
* response fails encoding.
|
|
691
|
+
*
|
|
692
|
+
* @stability unstable
|
|
693
|
+
* @category errors
|
|
694
|
+
* @since 4.0.6
|
|
695
|
+
*/
|
|
696
|
+
export class InternalServerErrorProblem extends Problem<InternalServerErrorProblem>()("InternalServerErrorProblem", {
|
|
697
|
+
type: ProblemDetails.blankType,
|
|
698
|
+
status: 500,
|
|
699
|
+
title: "Internal Server Error"
|
|
700
|
+
}) {}
|
|
701
|
+
|
|
452
702
|
/**
|
|
453
703
|
* Type-level identifier used to mark `HttpApiSchemaError` values.
|
|
454
704
|
*
|