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
package/src/internal/uuid.ts
CHANGED
|
@@ -18,30 +18,20 @@ export const stringify = (bytes: Uint8Array): string => {
|
|
|
18
18
|
hex[bytes[10]] + hex[bytes[11]] + hex[bytes[12]] + hex[bytes[13]] + hex[bytes[14]] + hex[bytes[15]]
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
const randomBytes = (): Uint8Array<ArrayBuffer> => globalThis.crypto.getRandomValues(new Uint8Array(16))
|
|
22
|
-
|
|
23
|
-
/** @internal */
|
|
24
|
-
export function v4Bytes(): Uint8Array<ArrayBuffer>
|
|
25
|
-
/** @internal */
|
|
26
|
-
export function v4Bytes<A extends ArrayBufferLike>(bytes: Uint8Array<A>): Uint8Array<A>
|
|
27
21
|
/** @internal */
|
|
28
|
-
export
|
|
22
|
+
export const v4Bytes = <A extends ArrayBufferLike>(bytes: Uint8Array<A>): Uint8Array<A> => {
|
|
29
23
|
bytes[6] = (bytes[6] & 0x0f) | 0x40
|
|
30
24
|
bytes[8] = (bytes[8] & 0x3f) | 0x80
|
|
31
25
|
return bytes
|
|
32
26
|
}
|
|
33
27
|
|
|
34
28
|
/** @internal */
|
|
35
|
-
export const v4String = (bytes
|
|
29
|
+
export const v4String = (bytes: Uint8Array): string => stringify(v4Bytes(bytes))
|
|
36
30
|
|
|
37
31
|
const maxV7Timestamp = 2 ** 48 - 1
|
|
38
32
|
|
|
39
33
|
/** @internal */
|
|
40
|
-
export
|
|
41
|
-
/** @internal */
|
|
42
|
-
export function v7Bytes<A extends ArrayBufferLike>(timestampMillis: number, bytes: Uint8Array<A>): Uint8Array<A>
|
|
43
|
-
/** @internal */
|
|
44
|
-
export function v7Bytes(timestampMillis: number, bytes: Uint8Array = randomBytes()): Uint8Array {
|
|
34
|
+
export const v7Bytes = <A extends ArrayBufferLike>(timestampMillis: number, bytes: Uint8Array<A>): Uint8Array<A> => {
|
|
45
35
|
const timestamp = Math.min(Math.max(0, Math.trunc(timestampMillis)), maxV7Timestamp)
|
|
46
36
|
|
|
47
37
|
bytes[0] = Math.floor(timestamp / 2 ** 40)
|
|
@@ -55,6 +45,57 @@ export function v7Bytes(timestampMillis: number, bytes: Uint8Array = randomBytes
|
|
|
55
45
|
return bytes
|
|
56
46
|
}
|
|
57
47
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
48
|
+
const clampV7Timestamp = (timestampMillis: number): number =>
|
|
49
|
+
timestampMillis >= 0 ? Math.min(Math.trunc(timestampMillis), maxV7Timestamp) : 0
|
|
50
|
+
|
|
51
|
+
const maxV7Counter = 2 ** 42 - 1
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Makes a UUIDv7 generator that orders the UUIDs it returns, following RFC
|
|
55
|
+
* 9562 §6.2 Method 1. A 42-bit counter fills the 12 bits of `rand_a` and the
|
|
56
|
+
* top 30 bits of `rand_b`; the last 32 bits stay random. The ordering ends at
|
|
57
|
+
* the maximum timestamp, 2^48 − 1 ms, which counter overflow cannot advance.
|
|
58
|
+
*
|
|
59
|
+
* @internal
|
|
60
|
+
*/
|
|
61
|
+
export const makeV7Monotonic = () => {
|
|
62
|
+
let lastTimestamp = -1
|
|
63
|
+
let counter = 0
|
|
64
|
+
return <A extends ArrayBufferLike>(timestampMillis: number, bytes: Uint8Array<A>): Uint8Array<A> => {
|
|
65
|
+
const timestamp = clampV7Timestamp(timestampMillis)
|
|
66
|
+
if (timestamp > lastTimestamp) {
|
|
67
|
+
lastTimestamp = timestamp
|
|
68
|
+
counter = seedV7Counter(bytes)
|
|
69
|
+
} else if (counter < maxV7Counter) {
|
|
70
|
+
// The clock stalled or moved back, so keep the last timestamp.
|
|
71
|
+
counter++
|
|
72
|
+
} else {
|
|
73
|
+
lastTimestamp = Math.min(lastTimestamp + 1, maxV7Timestamp)
|
|
74
|
+
counter = seedV7Counter(bytes)
|
|
75
|
+
}
|
|
76
|
+
v7Bytes(lastTimestamp, bytes)
|
|
77
|
+
const high = Math.floor(counter / 2 ** 30)
|
|
78
|
+
const low = counter - high * 2 ** 30
|
|
79
|
+
bytes[6] = 0x70 | (high >>> 8)
|
|
80
|
+
bytes[7] = high & 0xff
|
|
81
|
+
bytes[8] = 0x80 | (low >>> 24)
|
|
82
|
+
bytes[9] = (low >>> 16) & 0xff
|
|
83
|
+
bytes[10] = (low >>> 8) & 0xff
|
|
84
|
+
bytes[11] = low & 0xff
|
|
85
|
+
return bytes
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Clears the counter's top bit, so a millisecond has at least 2^41 increments
|
|
90
|
+
// before it overflows.
|
|
91
|
+
const seedV7Counter = (bytes: Uint8Array): number =>
|
|
92
|
+
(((bytes[6] & 0x07) << 8) | bytes[7]) * 2 ** 30 +
|
|
93
|
+
(((bytes[8] & 0x3f) << 24) | (bytes[9] << 16) | (bytes[10] << 8) | bytes[11])
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* The UUIDv7 ordering state shared by every `Date.now()` or `Clock` caller in
|
|
97
|
+
* the realm that has no `SecureRandom` instance of its own.
|
|
98
|
+
*
|
|
99
|
+
* @internal
|
|
100
|
+
*/
|
|
101
|
+
export const v7Monotonic = makeV7Monotonic()
|
package/src/internal/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** @internal */
|
|
2
|
-
export const version = "4.0
|
|
2
|
+
export const version = "4.1.0"
|
|
@@ -16,6 +16,7 @@ import type * as HttpClient from "../http/HttpClient.ts"
|
|
|
16
16
|
import * as HttpClientRequest from "../http/HttpClientRequest.ts"
|
|
17
17
|
import * as Layer from "../Layer.ts"
|
|
18
18
|
import type * as Tracer from "../Tracer.ts"
|
|
19
|
+
import type * as OtlpExporter from "./OtlpExporter.ts"
|
|
19
20
|
import * as OtlpLogger from "./OtlpLogger.ts"
|
|
20
21
|
import type { AggregationTemporality } from "./OtlpMetrics.ts"
|
|
21
22
|
import * as OtlpMetrics from "./OtlpMetrics.ts"
|
|
@@ -30,6 +31,10 @@ import * as OtlpTracer from "./OtlpTracer.ts"
|
|
|
30
31
|
* The layer sends data to `/v1/logs`, `/v1/metrics`, and `/v1/traces` below
|
|
31
32
|
* `baseUrl` and requires an `OtlpSerialization` implementation.
|
|
32
33
|
*
|
|
34
|
+
* The layer provides the `OtlpExporter.Flusher` shared by all three signals,
|
|
35
|
+
* so one `flush` exports their buffered telemetry, for example before a
|
|
36
|
+
* serverless instance is suspended.
|
|
37
|
+
*
|
|
33
38
|
* @stability unstable
|
|
34
39
|
* @category layers
|
|
35
40
|
* @since 4.0.0
|
|
@@ -56,7 +61,7 @@ export const layer = (options: {
|
|
|
56
61
|
readonly metricsTemporality?: AggregationTemporality | undefined
|
|
57
62
|
readonly tracerExportInterval?: Duration.Input | undefined
|
|
58
63
|
readonly shutdownTimeout?: Duration.Input | undefined
|
|
59
|
-
}): Layer.Layer<
|
|
64
|
+
}): Layer.Layer<OtlpExporter.Flusher, never, HttpClient.HttpClient | OtlpSerialization.OtlpSerialization> => {
|
|
60
65
|
const base = HttpClientRequest.get(options.baseUrl)
|
|
61
66
|
const url = (path: string) => HttpClientRequest.appendUrl(base, path).url
|
|
62
67
|
return Layer.mergeAll(
|
|
@@ -97,6 +102,12 @@ export const layer = (options: {
|
|
|
97
102
|
* Creates a combined OTLP layer for logs, metrics, and traces from
|
|
98
103
|
* OpenTelemetry configuration.
|
|
99
104
|
*
|
|
105
|
+
* **Details**
|
|
106
|
+
*
|
|
107
|
+
* The layer provides the `OtlpExporter.Flusher` shared by all enabled signals.
|
|
108
|
+
* It is provided even when configuration disables every signal, in which case
|
|
109
|
+
* `flush` is a no-op.
|
|
110
|
+
*
|
|
100
111
|
* @stability unstable
|
|
101
112
|
* @category layers
|
|
102
113
|
* @since 4.0.0
|
|
@@ -111,7 +122,7 @@ export const layerFromConfig = (options?: {
|
|
|
111
122
|
readonly tracerContext?: (<X>(primitive: Tracer.EffectPrimitive<X>, span: Tracer.AnySpan) => X) | undefined
|
|
112
123
|
readonly loggerExcludeLogSpans?: boolean | undefined
|
|
113
124
|
readonly loggerMergeWithExisting?: boolean | undefined
|
|
114
|
-
}): Layer.Layer<
|
|
125
|
+
}): Layer.Layer<OtlpExporter.Flusher, never, HttpClient.HttpClient | OtlpSerialization.OtlpSerialization> =>
|
|
115
126
|
Layer.mergeAll(
|
|
116
127
|
OtlpLogger.layerFromConfig({
|
|
117
128
|
resource: options?.resource,
|
|
@@ -160,7 +171,10 @@ export const layerJson: (options: {
|
|
|
160
171
|
readonly metricsTemporality?: AggregationTemporality | undefined
|
|
161
172
|
readonly tracerExportInterval?: Duration.Input | undefined
|
|
162
173
|
readonly shutdownTimeout?: Duration.Input | undefined
|
|
163
|
-
}) => Layer.Layer<
|
|
174
|
+
}) => Layer.Layer<OtlpExporter.Flusher, never, HttpClient.HttpClient> = flow(
|
|
175
|
+
layer,
|
|
176
|
+
Layer.provide(OtlpSerialization.layerJson)
|
|
177
|
+
)
|
|
164
178
|
|
|
165
179
|
/**
|
|
166
180
|
* Creates the combined OTLP logs, metrics, and traces layer using protobuf
|
|
@@ -192,4 +206,7 @@ export const layerProtobuf: (options: {
|
|
|
192
206
|
readonly metricsTemporality?: AggregationTemporality | undefined
|
|
193
207
|
readonly tracerExportInterval?: Duration.Input | undefined
|
|
194
208
|
readonly shutdownTimeout?: Duration.Input | undefined
|
|
195
|
-
}) => Layer.Layer<
|
|
209
|
+
}) => Layer.Layer<OtlpExporter.Flusher, never, HttpClient.HttpClient> = flow(
|
|
210
|
+
layer,
|
|
211
|
+
Layer.provide(OtlpSerialization.layerProtobuf)
|
|
212
|
+
)
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Proxies OTLP HTTP exports from browsers through an application's own HTTP
|
|
3
|
+
* server to an OpenTelemetry Collector or vendor endpoint.
|
|
4
|
+
*
|
|
5
|
+
* A browser exporting OTLP directly would need the vendor credentials in its
|
|
6
|
+
* bundle and a cross-origin collector. `OtlpProxy` mounts `POST /v1/traces`,
|
|
7
|
+
* `/v1/logs`, and `/v1/metrics` on an `HttpRouter`, adds the configured
|
|
8
|
+
* headers on the server, and forwards the payload unchanged. The browser can
|
|
9
|
+
* then use `Otlp.layer({ baseUrl: "/otlp" })` against its own origin.
|
|
10
|
+
*
|
|
11
|
+
* **Details**
|
|
12
|
+
*
|
|
13
|
+
* - The upstream URL comes only from configuration. The request path and query
|
|
14
|
+
* string never reach it.
|
|
15
|
+
* - Only `application/json` and `application/x-protobuf` bodies are accepted;
|
|
16
|
+
* other content types get `415`. Payloads are not decoded or validated.
|
|
17
|
+
* - Only `content-type` and `content-encoding` are forwarded from the client.
|
|
18
|
+
* Configured `headers` are applied last, so a client cannot override them.
|
|
19
|
+
* - Bodies are buffered up to `maxBodySize` and rejected with `413` beyond it.
|
|
20
|
+
* - Upstream requests send `accept-encoding: identity`, and the client's
|
|
21
|
+
* `accept-encoding` is never forwarded.
|
|
22
|
+
* - The upstream status and body are returned with only the `content-type` and
|
|
23
|
+
* `retry-after` headers, so client SDK back-off keeps working and upstream
|
|
24
|
+
* cookies are dropped. Transport failures return `502` and timeouts `504`.
|
|
25
|
+
* The proxy does not retry or batch.
|
|
26
|
+
*
|
|
27
|
+
* **Gotchas**
|
|
28
|
+
*
|
|
29
|
+
* - Anyone who can reach the routes can send telemetry with the configured
|
|
30
|
+
* credentials. Compose authentication, CORS, and rate limiting around the
|
|
31
|
+
* layer as the application requires.
|
|
32
|
+
* - The response body is returned as the `HttpClient` provides it, without a
|
|
33
|
+
* `content-encoding` header. Setting `accept-encoding` in `headers` can
|
|
34
|
+
* invalidate this, as can an upstream that compresses despite
|
|
35
|
+
* `accept-encoding: identity`: clients that do not decode responses, such as
|
|
36
|
+
* `NodeHttpClient.makeUndici`, then return compressed bytes.
|
|
37
|
+
* - Requests to the proxy routes are traced by the HTTP server like any other
|
|
38
|
+
* route. To suppress those spans, provide `HttpMiddleware.TracerDisabledWhen`
|
|
39
|
+
* with a predicate matching the routes, or use
|
|
40
|
+
* `HttpMiddleware.layerTracerDisabledForUrls`, which matches exact URLs, so
|
|
41
|
+
* list each route.
|
|
42
|
+
*
|
|
43
|
+
* @stability unstable
|
|
44
|
+
* @since 4.0.7
|
|
45
|
+
*/
|
|
46
|
+
import * as ByteSize from "../ByteSize.ts"
|
|
47
|
+
import * as Duration from "../Duration.ts"
|
|
48
|
+
import * as Effect from "../Effect.ts"
|
|
49
|
+
import { constTrue } from "../Function.ts"
|
|
50
|
+
import * as Headers from "../http/Headers.ts"
|
|
51
|
+
import * as HttpClient from "../http/HttpClient.ts"
|
|
52
|
+
import * as HttpClientRequest from "../http/HttpClientRequest.ts"
|
|
53
|
+
import type * as HttpClientResponse from "../http/HttpClientResponse.ts"
|
|
54
|
+
import * as HttpIncomingMessage from "../http/HttpIncomingMessage.ts"
|
|
55
|
+
import * as HttpRouter from "../http/HttpRouter.ts"
|
|
56
|
+
import * as HttpServerRequest from "../http/HttpServerRequest.ts"
|
|
57
|
+
import * as HttpServerRespondable from "../http/HttpServerRespondable.ts"
|
|
58
|
+
import * as HttpServerResponse from "../http/HttpServerResponse.ts"
|
|
59
|
+
import * as Layer from "../Layer.ts"
|
|
60
|
+
import * as OtlpEnv from "./internal/otlpEnv.ts"
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* OTLP signal type served by the proxy.
|
|
64
|
+
*
|
|
65
|
+
* @stability unstable
|
|
66
|
+
* @category models
|
|
67
|
+
* @since 4.0.7
|
|
68
|
+
*/
|
|
69
|
+
export type Signal = "traces" | "logs" | "metrics"
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Creates a record of request handlers, one for each OTLP signal, that forward
|
|
73
|
+
* to the configured upstream.
|
|
74
|
+
*
|
|
75
|
+
* **When to use**
|
|
76
|
+
*
|
|
77
|
+
* Use to mount the proxy on routes or a router other than the ones `layer`
|
|
78
|
+
* registers, such as an `HttpApi` endpoint.
|
|
79
|
+
*
|
|
80
|
+
* **Details**
|
|
81
|
+
*
|
|
82
|
+
* Each signal is sent to `urls[signal]` when set, otherwise to
|
|
83
|
+
* `/v1/<signal>` below `baseUrl`. `maxBodySize` defaults to the
|
|
84
|
+
* `HttpIncomingMessage.MaxBodySize` reference, then 10 MiB. `timeout` defaults
|
|
85
|
+
* to 10 seconds.
|
|
86
|
+
*
|
|
87
|
+
* @see {@link layer} for mounting the handlers on an `HttpRouter`.
|
|
88
|
+
* @stability unstable
|
|
89
|
+
* @category constructors
|
|
90
|
+
* @since 4.0.7
|
|
91
|
+
*/
|
|
92
|
+
export const make = (options: {
|
|
93
|
+
readonly baseUrl: string
|
|
94
|
+
readonly urls?: Partial<Record<Signal, string>> | undefined
|
|
95
|
+
readonly headers?: Headers.Input | undefined
|
|
96
|
+
readonly maxBodySize?: ByteSize.Input | undefined
|
|
97
|
+
readonly timeout?: Duration.Input | undefined
|
|
98
|
+
}): Effect.Effect<
|
|
99
|
+
Record<Signal, Effect.Effect<HttpServerResponse.HttpServerResponse, never, HttpServerRequest.HttpServerRequest>>,
|
|
100
|
+
never,
|
|
101
|
+
HttpClient.HttpClient
|
|
102
|
+
> =>
|
|
103
|
+
Effect.gen(function*() {
|
|
104
|
+
const client = yield* HttpClient.HttpClient
|
|
105
|
+
const base = HttpClientRequest.post(options.baseUrl)
|
|
106
|
+
const handlers = {} as Record<Signal, Handler>
|
|
107
|
+
for (const signal of allSignals) {
|
|
108
|
+
handlers[signal] = makeHandler(client, {
|
|
109
|
+
...options,
|
|
110
|
+
url: options.urls?.[signal] ?? HttpClientRequest.appendUrl(base, `/v1/${signal}`).url
|
|
111
|
+
})
|
|
112
|
+
}
|
|
113
|
+
return handlers
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Creates a layer that mounts the OTLP proxy routes on an `HttpRouter`.
|
|
118
|
+
*
|
|
119
|
+
* **Details**
|
|
120
|
+
*
|
|
121
|
+
* Registers `POST <prefix>/v1/<signal>` for each of `signals`, which defaults
|
|
122
|
+
* to traces, logs, and metrics. Without a `prefix` the routes are mounted at
|
|
123
|
+
* the router root.
|
|
124
|
+
*
|
|
125
|
+
* **Example** (Proxying browser telemetry to a vendor)
|
|
126
|
+
*
|
|
127
|
+
* ```ts import.meta.vitest
|
|
128
|
+
* import { Layer } from "effect"
|
|
129
|
+
* import { FetchHttpClient } from "effect/http"
|
|
130
|
+
* import { OtlpProxy } from "effect/observability"
|
|
131
|
+
*
|
|
132
|
+
* const OtlpProxyLayer = OtlpProxy.layer({
|
|
133
|
+
* baseUrl: "https://otlp.vendor.example",
|
|
134
|
+
* headers: { authorization: "Bearer server-side-key" },
|
|
135
|
+
* prefix: "/otlp"
|
|
136
|
+
* }).pipe(Layer.provide(FetchHttpClient.layer))
|
|
137
|
+
*
|
|
138
|
+
* Layer.isLayer(OtlpProxyLayer) // => true
|
|
139
|
+
* ```
|
|
140
|
+
*
|
|
141
|
+
* @see {@link layerFromConfig} for reading the upstream from OpenTelemetry environment variables.
|
|
142
|
+
* @stability unstable
|
|
143
|
+
* @category layers
|
|
144
|
+
* @since 4.0.7
|
|
145
|
+
*/
|
|
146
|
+
export const layer = (options: {
|
|
147
|
+
readonly baseUrl: string
|
|
148
|
+
readonly urls?: Partial<Record<Signal, string>> | undefined
|
|
149
|
+
readonly headers?: Headers.Input | undefined
|
|
150
|
+
readonly maxBodySize?: ByteSize.Input | undefined
|
|
151
|
+
readonly timeout?: Duration.Input | undefined
|
|
152
|
+
readonly prefix?: string | undefined
|
|
153
|
+
readonly signals?: ReadonlyArray<Signal> | undefined
|
|
154
|
+
}): Layer.Layer<never, never, HttpRouter.HttpRouter | HttpClient.HttpClient> =>
|
|
155
|
+
Layer.effectDiscard(Effect.gen(function*() {
|
|
156
|
+
const handlers = yield* make(options)
|
|
157
|
+
yield* addRoutes(
|
|
158
|
+
options.prefix,
|
|
159
|
+
(options.signals ?? allSignals).map((signal) => [signal, handlers[signal]] as const)
|
|
160
|
+
)
|
|
161
|
+
}))
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Creates a layer that mounts the OTLP proxy routes using the upstream from
|
|
165
|
+
* OpenTelemetry environment configuration.
|
|
166
|
+
*
|
|
167
|
+
* **Details**
|
|
168
|
+
*
|
|
169
|
+
* Each signal is sent to `OTEL_EXPORTER_OTLP_<SIGNAL>_ENDPOINT`, falling back
|
|
170
|
+
* to `/v1/<signal>` below `OTEL_EXPORTER_OTLP_ENDPOINT`, with headers from
|
|
171
|
+
* `OTEL_EXPORTER_OTLP_<SIGNAL>_HEADERS` or `OTEL_EXPORTER_OTLP_HEADERS`. The
|
|
172
|
+
* `headers` option replaces the configured headers. Signals without an
|
|
173
|
+
* endpoint get no route.
|
|
174
|
+
*
|
|
175
|
+
* @see {@link layer} for configuring the upstream directly.
|
|
176
|
+
* @stability unstable
|
|
177
|
+
* @category layers
|
|
178
|
+
* @since 4.0.7
|
|
179
|
+
*/
|
|
180
|
+
export const layerFromConfig = (options?: {
|
|
181
|
+
readonly headers?: Headers.Input | undefined
|
|
182
|
+
readonly maxBodySize?: ByteSize.Input | undefined
|
|
183
|
+
readonly timeout?: Duration.Input | undefined
|
|
184
|
+
readonly prefix?: string | undefined
|
|
185
|
+
readonly signals?: ReadonlyArray<Signal> | undefined
|
|
186
|
+
}): Layer.Layer<never, never, HttpRouter.HttpRouter | HttpClient.HttpClient> =>
|
|
187
|
+
Layer.effectDiscard(
|
|
188
|
+
Effect.gen(function*() {
|
|
189
|
+
const client = yield* HttpClient.HttpClient
|
|
190
|
+
const routes: Array<readonly [Signal, Handler]> = []
|
|
191
|
+
for (const signal of options?.signals ?? allSignals) {
|
|
192
|
+
const envSignal = signal.toUpperCase() as OtlpEnv.Signal
|
|
193
|
+
const url = yield* OtlpEnv.endpoint(envSignal)
|
|
194
|
+
if (url === undefined) continue
|
|
195
|
+
routes.push([
|
|
196
|
+
signal,
|
|
197
|
+
makeHandler(client, {
|
|
198
|
+
...options,
|
|
199
|
+
url: url.toString(),
|
|
200
|
+
headers: options?.headers ?? (yield* OtlpEnv.headers(envSignal))
|
|
201
|
+
})
|
|
202
|
+
])
|
|
203
|
+
}
|
|
204
|
+
yield* addRoutes(options?.prefix, routes)
|
|
205
|
+
}).pipe(Effect.orDie)
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
// internal
|
|
209
|
+
|
|
210
|
+
const allSignals: ReadonlyArray<Signal> = ["traces", "logs", "metrics"]
|
|
211
|
+
|
|
212
|
+
const contentTypes = new Set(["application/json", "application/x-protobuf"])
|
|
213
|
+
|
|
214
|
+
const defaultMaxBodySize = ByteSize.mebibytes(10)
|
|
215
|
+
|
|
216
|
+
type Handler = Effect.Effect<HttpServerResponse.HttpServerResponse, never, HttpServerRequest.HttpServerRequest>
|
|
217
|
+
|
|
218
|
+
const addRoutes = Effect.fnUntraced(function*(
|
|
219
|
+
prefix: string | undefined,
|
|
220
|
+
routes: Iterable<readonly [signal: Signal, handler: Handler]>
|
|
221
|
+
) {
|
|
222
|
+
const router = yield* HttpRouter.HttpRouter
|
|
223
|
+
const target = prefix === undefined ? router : router.prefixed(prefix)
|
|
224
|
+
for (const [signal, handler] of routes) {
|
|
225
|
+
yield* target.add("POST", `/v1/${signal}`, handler)
|
|
226
|
+
}
|
|
227
|
+
})
|
|
228
|
+
|
|
229
|
+
const makeHandler = (client: HttpClient.HttpClient, options: {
|
|
230
|
+
readonly url: string
|
|
231
|
+
readonly headers?: Headers.Input | undefined
|
|
232
|
+
readonly maxBodySize?: ByteSize.Input | undefined
|
|
233
|
+
readonly timeout?: Duration.Input | undefined
|
|
234
|
+
}): Handler => {
|
|
235
|
+
// Skips the outbound span and trace headers in one step.
|
|
236
|
+
const upstream = client.pipe(
|
|
237
|
+
HttpClient.transformResponse(Effect.provideService(HttpClient.TracerDisabledWhen, constTrue))
|
|
238
|
+
)
|
|
239
|
+
const headers = Headers.fromInput(options.headers)
|
|
240
|
+
const maxBodySize = options.maxBodySize === undefined ? undefined : ByteSize.fromInputUnsafe(options.maxBodySize)
|
|
241
|
+
const timeout = options.timeout ?? Duration.seconds(10)
|
|
242
|
+
|
|
243
|
+
return Effect.gen(function*() {
|
|
244
|
+
const request = yield* HttpServerRequest.HttpServerRequest
|
|
245
|
+
const contentType = request.headers["content-type"]
|
|
246
|
+
if (!isSupportedContentType(contentType)) {
|
|
247
|
+
return unsupportedMediaType
|
|
248
|
+
}
|
|
249
|
+
const limit = maxBodySize ?? (yield* HttpIncomingMessage.MaxBodySize) ?? defaultMaxBodySize
|
|
250
|
+
// Node's reader only counts bytes as they arrive, and would send
|
|
251
|
+
// 100 Continue first, so reject an over-limit declared length up front.
|
|
252
|
+
const contentLength = parseContentLength(request.headers["content-length"])
|
|
253
|
+
if (contentLength !== undefined && contentLength > Number(limit)) {
|
|
254
|
+
return contentTooLarge
|
|
255
|
+
}
|
|
256
|
+
const body = yield* request.arrayBuffer.pipe(
|
|
257
|
+
Effect.provideService(HttpIncomingMessage.MaxBodySize, limit),
|
|
258
|
+
Effect.catch(HttpServerRespondable.toResponse)
|
|
259
|
+
)
|
|
260
|
+
if (HttpServerResponse.isHttpServerResponse(body)) {
|
|
261
|
+
return body
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
let outbound = HttpClientRequest.bodyUint8Array(
|
|
265
|
+
HttpClientRequest.post(options.url),
|
|
266
|
+
new Uint8Array(body),
|
|
267
|
+
contentType
|
|
268
|
+
)
|
|
269
|
+
const contentEncoding = request.headers["content-encoding"]
|
|
270
|
+
if (contentEncoding !== undefined) {
|
|
271
|
+
outbound = HttpClientRequest.setHeader(outbound, "content-encoding", contentEncoding)
|
|
272
|
+
}
|
|
273
|
+
// The response is returned without content-encoding, so request it
|
|
274
|
+
// uncompressed. Configured headers can still override this.
|
|
275
|
+
outbound = HttpClientRequest.setHeader(outbound, "accept-encoding", "identity")
|
|
276
|
+
return yield* upstream.execute(HttpClientRequest.setHeaders(outbound, headers)).pipe(
|
|
277
|
+
Effect.flatMap((response) => Effect.map(response.arrayBuffer, (body) => toServerResponse(response, body))),
|
|
278
|
+
Effect.timeout(timeout),
|
|
279
|
+
Effect.catchTags({
|
|
280
|
+
TimeoutError: () => Effect.succeed(gatewayTimeout),
|
|
281
|
+
HttpClientError: () => Effect.succeed(badGateway)
|
|
282
|
+
})
|
|
283
|
+
)
|
|
284
|
+
})
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
const unsupportedMediaType = HttpServerResponse.empty({ status: 415 })
|
|
288
|
+
const contentTooLarge = HttpServerResponse.empty({ status: 413 })
|
|
289
|
+
const badGateway = HttpServerResponse.empty({ status: 502 })
|
|
290
|
+
const gatewayTimeout = HttpServerResponse.empty({ status: 504 })
|
|
291
|
+
|
|
292
|
+
const isSupportedContentType = (contentType: string | undefined): contentType is string =>
|
|
293
|
+
contentType !== undefined &&
|
|
294
|
+
(contentTypes.has(contentType) || contentTypes.has(contentType.split(";")[0].trim().toLowerCase()))
|
|
295
|
+
|
|
296
|
+
const parseContentLength = (contentLength: string | undefined): number | undefined =>
|
|
297
|
+
contentLength !== undefined && /^\d+$/.test(contentLength) ? Number(contentLength) : undefined
|
|
298
|
+
|
|
299
|
+
const toServerResponse = (
|
|
300
|
+
response: HttpClientResponse.HttpClientResponse,
|
|
301
|
+
body: ArrayBuffer
|
|
302
|
+
): HttpServerResponse.HttpServerResponse => {
|
|
303
|
+
const headers: Record<string, string> = {}
|
|
304
|
+
if (response.headers["retry-after"] !== undefined) {
|
|
305
|
+
headers["retry-after"] = response.headers["retry-after"]
|
|
306
|
+
}
|
|
307
|
+
return body.byteLength === 0
|
|
308
|
+
? HttpServerResponse.empty({ status: response.status, headers })
|
|
309
|
+
: HttpServerResponse.uint8Array(new Uint8Array(body), {
|
|
310
|
+
status: response.status,
|
|
311
|
+
headers,
|
|
312
|
+
contentType: response.headers["content-type"]
|
|
313
|
+
})
|
|
314
|
+
}
|
|
@@ -79,6 +79,13 @@ export const make = (options: {
|
|
|
79
79
|
* precedence over matching attributes in `OTEL_RESOURCE_ATTRIBUTES`. Missing
|
|
80
80
|
* required configuration is converted to a defect.
|
|
81
81
|
*
|
|
82
|
+
* Keys and values in `OTEL_RESOURCE_ATTRIBUTES` are trimmed, then
|
|
83
|
+
* percent-decoded. Entries with an empty value are kept as `""`; entries
|
|
84
|
+
* without `=` or with an empty key are skipped. When a key is repeated as
|
|
85
|
+
* written, the last entry wins and the earlier ones are not decoded. Invalid
|
|
86
|
+
* percent-encoding in the remaining entries is a `ConfigError` and is
|
|
87
|
+
* converted to a defect.
|
|
88
|
+
*
|
|
82
89
|
* @stability unstable
|
|
83
90
|
* @category constructors
|
|
84
91
|
* @since 4.0.0
|
|
@@ -97,7 +104,8 @@ export const fromConfig: (
|
|
|
97
104
|
const env = yield* Config.Record(
|
|
98
105
|
Schema.StringFromUriComponent,
|
|
99
106
|
Schema.StringFromUriComponent,
|
|
100
|
-
"OTEL_RESOURCE_ATTRIBUTES"
|
|
107
|
+
"OTEL_RESOURCE_ATTRIBUTES",
|
|
108
|
+
{ trim: true, keepEmptyValues: true }
|
|
101
109
|
).pipe(Config.withDefault(undefined))
|
|
102
110
|
|
|
103
111
|
const serviceName = options?.serviceName
|
|
@@ -281,6 +281,7 @@ class SpanImpl implements Tracer.Span {
|
|
|
281
281
|
}
|
|
282
282
|
|
|
283
283
|
end(endTime: bigint, exit: Exit.Exit<unknown, unknown>): void {
|
|
284
|
+
if (this.status._tag === "Ended") return
|
|
284
285
|
this.status = {
|
|
285
286
|
_tag: "Ended",
|
|
286
287
|
startTime: this.status.startTime,
|
|
@@ -291,14 +292,17 @@ class SpanImpl implements Tracer.Span {
|
|
|
291
292
|
}
|
|
292
293
|
|
|
293
294
|
attribute(key: string, value: unknown): void {
|
|
295
|
+
if (this.status._tag === "Ended") return
|
|
294
296
|
this.attributes.set(key, value)
|
|
295
297
|
}
|
|
296
298
|
|
|
297
299
|
event(name: string, startTime: bigint, attributes?: Record<string, unknown>): void {
|
|
300
|
+
if (this.status._tag === "Ended") return
|
|
298
301
|
this.events.push([name, startTime, attributes])
|
|
299
302
|
}
|
|
300
303
|
|
|
301
304
|
addLinks(links: ReadonlyArray<Tracer.SpanLink>): void {
|
|
305
|
+
if (this.status._tag === "Ended") return
|
|
302
306
|
// oxlint-disable-next-line no-restricted-syntax
|
|
303
307
|
this.links.push(...links)
|
|
304
308
|
}
|
|
@@ -29,6 +29,12 @@ export * as OtlpLogger from "./OtlpLogger.ts"
|
|
|
29
29
|
*/
|
|
30
30
|
export * as OtlpMetrics from "./OtlpMetrics.ts"
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* @stability unstable
|
|
34
|
+
* @since 4.0.7
|
|
35
|
+
*/
|
|
36
|
+
export * as OtlpProxy from "./OtlpProxy.ts"
|
|
37
|
+
|
|
32
38
|
/**
|
|
33
39
|
* @stability unstable
|
|
34
40
|
* @since 4.0.0
|