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
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* @stability unstable
|
|
8
8
|
* @since 4.0.0
|
|
9
9
|
*/
|
|
10
|
+
import * as Cause from "../Cause.ts"
|
|
10
11
|
import * as Context from "../Context.ts"
|
|
11
12
|
import * as DateTime from "../DateTime.ts"
|
|
12
13
|
import * as Deferred from "../Deferred.ts"
|
|
@@ -539,9 +540,26 @@ export const make = Effect.gen(function*() {
|
|
|
539
540
|
!instance.abandoned &&
|
|
540
541
|
!(suspendOnFailure && exit._tag === "Failure")
|
|
541
542
|
) {
|
|
542
|
-
|
|
543
|
+
const resumeParent = parent && !parent.detached
|
|
543
544
|
? ensureSuccess(sendResumeParent(parent, executionId))
|
|
544
545
|
: Effect.void
|
|
546
|
+
if (exit._tag === "Success" || !Cause.hasInterruptsOnly(exit.cause)) {
|
|
547
|
+
return resumeParent
|
|
548
|
+
}
|
|
549
|
+
// `interruptUnsafe` cuts the run off without a result and
|
|
550
|
+
// its replay applies the interrupt. Retain the scope like a
|
|
551
|
+
// suspended run, so `closeRuns` supersedes it and only the
|
|
552
|
+
// final run's compensations observe the interrupt.
|
|
553
|
+
return engine.deferredResult(InterruptSignal).pipe(
|
|
554
|
+
Effect.flatMap((maybeExit) => {
|
|
555
|
+
if (Option.isNone(maybeExit)) {
|
|
556
|
+
return resumeParent
|
|
557
|
+
}
|
|
558
|
+
instance.suspended = true
|
|
559
|
+
return Effect.void
|
|
560
|
+
}),
|
|
561
|
+
Effect.orDie
|
|
562
|
+
)
|
|
545
563
|
}
|
|
546
564
|
return engine.deferredResult(InterruptSignal).pipe(
|
|
547
565
|
Effect.flatMap((maybeExit) => {
|
|
@@ -797,25 +815,28 @@ export const make = Effect.gen(function*() {
|
|
|
797
815
|
if (exit) {
|
|
798
816
|
return Option.some(exit)
|
|
799
817
|
}
|
|
800
|
-
|
|
818
|
+
const requestId = yield* requestIdFor({
|
|
801
819
|
workflow: instance.workflow,
|
|
802
820
|
entityType: `Workflow/${instance.workflow._tag}`,
|
|
803
821
|
executionId: instance.executionId,
|
|
804
822
|
tag: "deferred",
|
|
805
823
|
id: deferred.name
|
|
806
|
-
})
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
824
|
+
})
|
|
825
|
+
if (Option.isNone(requestId)) {
|
|
826
|
+
return Option.none<Exit.Exit<unknown, unknown>>()
|
|
827
|
+
}
|
|
828
|
+
const reply = yield* replyForRequestId(requestId.value)
|
|
829
|
+
if (Option.isSome(reply)) {
|
|
830
|
+
return Option.some(deferredReplyExit(reply.value))
|
|
831
|
+
}
|
|
832
|
+
// The first completion saved under the deferred name wins, so a
|
|
833
|
+
// request the owner has not processed yet already holds the result.
|
|
834
|
+
const [request] = yield* storage.unprocessedMessagesById([requestId.value])
|
|
835
|
+
if (request?.envelope._tag === "Request") {
|
|
836
|
+
return Option.some(decodeDeferredPayload(request.envelope.payload).exit)
|
|
837
|
+
}
|
|
838
|
+
// It was processed after the first read, so its reply is stored now.
|
|
839
|
+
return Option.map(yield* replyForRequestId(requestId.value), deferredReplyExit)
|
|
819
840
|
})),
|
|
820
841
|
Effect.retry({
|
|
821
842
|
while: (e) => e._tag === "PersistenceError",
|
|
@@ -896,10 +917,14 @@ const retryPolicy = Schedule.min([
|
|
|
896
917
|
Schedule.spaced("1 minute")
|
|
897
918
|
])
|
|
898
919
|
|
|
920
|
+
// A cluster abandonment means this owner can no longer complete the effect, so
|
|
921
|
+
// retrying it would only wait on a retired run. Re-raise it as an annotated
|
|
922
|
+
// interrupt, so the activation can unwind and its shard can be released.
|
|
899
923
|
const ensureSuccess = <A, E, R>(effect: Effect.Effect<A, E, R>) =>
|
|
900
924
|
effect.pipe(
|
|
901
925
|
Effect.sandbox,
|
|
902
|
-
Effect.retry(retryPolicy),
|
|
926
|
+
Effect.retry({ schedule: retryPolicy, while: (cause) => !ClusterAbandon.isCause(cause) }),
|
|
927
|
+
Effect.catchIf(ClusterAbandon.isCause, () => ClusterAbandon.interrupt),
|
|
903
928
|
Effect.orDie
|
|
904
929
|
)
|
|
905
930
|
|
|
@@ -959,6 +984,11 @@ const isFailedReply = (reply: WithExitEncoded<Workflow.ResultEncoded<any, any>>)
|
|
|
959
984
|
reply.exit._tag === "Success" && reply.exit.value._tag === "Suspended" && reply.exit.value.failed === true
|
|
960
985
|
|
|
961
986
|
const decodeDeferredWithExit = Schema.decodeSync(Schema.toCodecJson(Reply.WithExit.schema(DeferredRpc)))
|
|
987
|
+
const decodeDeferredPayload = Schema.decodeUnknownSync(Schema.toCodecJson(DeferredRpc.payloadSchema))
|
|
988
|
+
const deferredReplyExit = (reply: WithExitEncoded<Workflow.ResultEncoded<any, any>>): Exit.Exit<unknown, unknown> => {
|
|
989
|
+
const decoded = decodeDeferredWithExit(reply as any)
|
|
990
|
+
return decoded.exit._tag === "Success" ? decoded.exit.value : decoded.exit
|
|
991
|
+
}
|
|
962
992
|
|
|
963
993
|
const ResumeRpc = Rpc.make("resume", {
|
|
964
994
|
// Older persisted resume envelopes have an empty payload and use the empty key.
|
|
@@ -133,8 +133,15 @@ export class MessageStorage extends Context.Service<MessageStorage, {
|
|
|
133
133
|
|
|
134
134
|
/**
|
|
135
135
|
* Unregister the reply handler for the specified message.
|
|
136
|
+
*
|
|
137
|
+
* By default the waiters are resumed with `EntityNotAssignedToRunner`. With
|
|
138
|
+
* `interrupt: true` they are interrupted with a cluster-abandon annotation
|
|
139
|
+
* instead, for when the request will not be served by this runner.
|
|
136
140
|
*/
|
|
137
|
-
readonly unregisterReplyHandler: (
|
|
141
|
+
readonly unregisterReplyHandler: (
|
|
142
|
+
requestId: Snowflake.Snowflake,
|
|
143
|
+
options?: { readonly interrupt?: boolean | undefined }
|
|
144
|
+
) => Effect.Effect<void>
|
|
138
145
|
|
|
139
146
|
/**
|
|
140
147
|
* Unregister the reply handlers for the specified ShardId.
|
|
@@ -569,6 +576,14 @@ export const make = (
|
|
|
569
576
|
}
|
|
570
577
|
const replyHandlers = new Map<Snowflake.Snowflake, Array<ReplyHandler>>()
|
|
571
578
|
const replyHandlersShard = new Map<string, Set<ReplyHandler>>()
|
|
579
|
+
const resumeUnregistered = (handler: ReplyHandler, options?: { readonly interrupt?: boolean | undefined }) =>
|
|
580
|
+
handler.resume(
|
|
581
|
+
options?.interrupt ? ClusterAbandon.interrupt : Effect.fail(
|
|
582
|
+
new EntityNotAssignedToRunner({
|
|
583
|
+
address: handler.message.envelope.address
|
|
584
|
+
})
|
|
585
|
+
)
|
|
586
|
+
)
|
|
572
587
|
return MessageStorage.of({
|
|
573
588
|
...storage,
|
|
574
589
|
// Nested transactions defer notifications to the outermost commit.
|
|
@@ -614,7 +629,7 @@ export const make = (
|
|
|
614
629
|
})
|
|
615
630
|
})
|
|
616
631
|
},
|
|
617
|
-
unregisterReplyHandler: (requestId) =>
|
|
632
|
+
unregisterReplyHandler: (requestId, options) =>
|
|
618
633
|
Effect.sync(() => {
|
|
619
634
|
const handlers = replyHandlers.get(requestId)
|
|
620
635
|
if (!handlers) return
|
|
@@ -622,11 +637,7 @@ export const make = (
|
|
|
622
637
|
for (let i = 0; i < handlers.length; i++) {
|
|
623
638
|
const handler = handlers[i]
|
|
624
639
|
handler.shardSet.delete(handler)
|
|
625
|
-
handler
|
|
626
|
-
new EntityNotAssignedToRunner({
|
|
627
|
-
address: handler.message.envelope.address
|
|
628
|
-
})
|
|
629
|
-
))
|
|
640
|
+
resumeUnregistered(handler, options)
|
|
630
641
|
}
|
|
631
642
|
}),
|
|
632
643
|
unregisterShardReplyHandlers: (shardId, options) =>
|
|
@@ -637,13 +648,7 @@ export const make = (
|
|
|
637
648
|
replyHandlersShard.delete(id)
|
|
638
649
|
shardSet.forEach((handler) => {
|
|
639
650
|
replyHandlers.delete(handler.message.envelope.requestId)
|
|
640
|
-
handler
|
|
641
|
-
options?.interrupt ? ClusterAbandon.interrupt : Effect.fail(
|
|
642
|
-
new EntityNotAssignedToRunner({
|
|
643
|
-
address: handler.message.envelope.address
|
|
644
|
-
})
|
|
645
|
-
)
|
|
646
|
-
)
|
|
651
|
+
resumeUnregistered(handler, options)
|
|
647
652
|
})
|
|
648
653
|
}),
|
|
649
654
|
saveReply(reply) {
|
package/src/cluster/Sharding.ts
CHANGED
|
@@ -19,7 +19,7 @@ import type { Input } from "../Duration.ts"
|
|
|
19
19
|
import * as Duration from "../Duration.ts"
|
|
20
20
|
import * as Effect from "../Effect.ts"
|
|
21
21
|
import * as Equal from "../Equal.ts"
|
|
22
|
-
import
|
|
22
|
+
import * as Exit from "../Exit.ts"
|
|
23
23
|
import * as Fiber from "../Fiber.ts"
|
|
24
24
|
import * as FiberMap from "../FiberMap.ts"
|
|
25
25
|
import { constant, flow } from "../Function.ts"
|
|
@@ -281,6 +281,9 @@ const make = Effect.gen(function*() {
|
|
|
281
281
|
// shards still held by this runner while their entities stop and their locks
|
|
282
282
|
// are released
|
|
283
283
|
const releasingShards = MutableHashSet.empty<ShardId>()
|
|
284
|
+
// runners that joined after the first assignment, kept out of the hash rings
|
|
285
|
+
// until the healthy set settles (see `runnerJoinDebounce`)
|
|
286
|
+
const pendingRunners = MutableHashSet.empty<Runner>()
|
|
284
287
|
// The releasing gauge reports to the metric registry and attributes the
|
|
285
288
|
// layer was built with.
|
|
286
289
|
const updateReleasingShardsGauge = () =>
|
|
@@ -290,6 +293,24 @@ const make = Effect.gen(function*() {
|
|
|
290
293
|
updateReleasingShardsGauge()
|
|
291
294
|
}
|
|
292
295
|
const activeShardsLatch = yield* Latch.make(false)
|
|
296
|
+
|
|
297
|
+
// Applies the result of a lock refresh: refreshed shards it did not return,
|
|
298
|
+
// and returned shards no longer assigned to this runner, move from
|
|
299
|
+
// `acquiredShards` to `releasingShards`. Shards acquired during the refresh
|
|
300
|
+
// are absent from its response, so only the refreshed ones are considered.
|
|
301
|
+
const releaseLostShards = (refreshed: ReadonlyArray<ShardId>, acquired: ReadonlyArray<ShardId>) => {
|
|
302
|
+
for (const shardId of refreshed) {
|
|
303
|
+
if (
|
|
304
|
+
MutableHashSet.has(acquiredShards, shardId) &&
|
|
305
|
+
(!acquired.includes(shardId) || !MutableHashSet.has(selfShards, shardId))
|
|
306
|
+
) {
|
|
307
|
+
MutableHashSet.remove(acquiredShards, shardId)
|
|
308
|
+
MutableHashSet.add(releasingShards, shardId)
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
updateShardGauges()
|
|
312
|
+
if (MutableHashSet.size(releasingShards) > 0) activeShardsLatch.openUnsafe()
|
|
313
|
+
}
|
|
293
314
|
// open once shutdown starts handing every shard off
|
|
294
315
|
const handoffLatch = Latch.makeUnsafe(false)
|
|
295
316
|
// open once the handoff has released every shard lock
|
|
@@ -593,6 +614,13 @@ const make = Effect.gen(function*() {
|
|
|
593
614
|
continue
|
|
594
615
|
}
|
|
595
616
|
|
|
617
|
+
// While joins are pending the assignments are about to change, so take
|
|
618
|
+
// no new shards; otherwise a shard released for a joining runner could
|
|
619
|
+
// be taken here and handed off again. Publishing reopens the latch.
|
|
620
|
+
if (MutableHashSet.size(pendingRunners) > 0) {
|
|
621
|
+
continue
|
|
622
|
+
}
|
|
623
|
+
|
|
596
624
|
// if a shard has been assigned to this runner, we acquire it
|
|
597
625
|
const unacquiredShards = MutableHashSet.empty<ShardId>()
|
|
598
626
|
for (const shardId of selfShards) {
|
|
@@ -617,13 +645,16 @@ const make = Effect.gen(function*() {
|
|
|
617
645
|
Effect.ignore,
|
|
618
646
|
Effect.timeoutOption(shardLockInterval)
|
|
619
647
|
)
|
|
620
|
-
// A forced release can
|
|
621
|
-
//
|
|
648
|
+
// A forced release or a pending join can begin while `acquire` is in
|
|
649
|
+
// flight, so re-check both. Shards locked meanwhile are released
|
|
650
|
+
// without running anything on them.
|
|
622
651
|
const forcedReleasePending = forcedShardReleasePending()
|
|
652
|
+
const joinsPending = MutableHashSet.size(pendingRunners) > 0
|
|
623
653
|
for (const shardId of acquired) {
|
|
624
654
|
if (
|
|
625
655
|
!shardLocksHealthyLatch.isOpen() ||
|
|
626
656
|
forcedReleasePending ||
|
|
657
|
+
joinsPending ||
|
|
627
658
|
MutableHashSet.has(releasingShards, shardId) ||
|
|
628
659
|
!MutableHashSet.has(selfShards, shardId)
|
|
629
660
|
) {
|
|
@@ -690,27 +721,12 @@ const make = Effect.gen(function*() {
|
|
|
690
721
|
return Effect.logInfo("Shard lock storage has recovered")
|
|
691
722
|
})
|
|
692
723
|
|
|
693
|
-
const refreshShardLocks = Effect.
|
|
724
|
+
const refreshShardLocks = Effect.suspend(() => {
|
|
694
725
|
const refreshed = [...acquiredShards, ...releasingShards]
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
MutableHashSet.remove(acquiredShards, shardId)
|
|
700
|
-
MutableHashSet.add(releasingShards, shardId)
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
for (let i = 0; i < acquired.length; i++) {
|
|
704
|
-
const shardId = acquired[i]
|
|
705
|
-
if (!MutableHashSet.has(selfShards, shardId)) {
|
|
706
|
-
MutableHashSet.remove(acquiredShards, shardId)
|
|
707
|
-
MutableHashSet.add(releasingShards, shardId)
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
updateShardGauges()
|
|
711
|
-
if (MutableHashSet.size(releasingShards) > 0) {
|
|
712
|
-
yield* activeShardsLatch.open
|
|
713
|
-
}
|
|
726
|
+
return Effect.map(
|
|
727
|
+
runnerStorage.refresh(selfAddress, refreshed),
|
|
728
|
+
(acquired) => releaseLostShards(refreshed, acquired)
|
|
729
|
+
)
|
|
714
730
|
}).pipe(
|
|
715
731
|
Effect.retry({
|
|
716
732
|
times: 5,
|
|
@@ -1412,10 +1428,33 @@ const make = Effect.gen(function*() {
|
|
|
1412
1428
|
ClusterMetrics.runnersHealthy.updateUnsafe(BigInt(1), Context.empty())
|
|
1413
1429
|
}
|
|
1414
1430
|
|
|
1431
|
+
// Kept outside the loop so a restart after a storage failure does not drop
|
|
1432
|
+
// this state and publish pending joins early.
|
|
1433
|
+
const hashRings = new Map<string, HashRing.HashRing<RunnerAddress>>()
|
|
1434
|
+
let nextRunners = MutableHashMap.empty<Runner, boolean>()
|
|
1435
|
+
const healthyRunners = MutableHashSet.empty<Runner>()
|
|
1436
|
+
const joinDebounce = Duration.toMillis(Duration.fromInputUnsafe(config.runnerJoinDebounce))
|
|
1437
|
+
// when the first pending join and the latest pending change were observed
|
|
1438
|
+
let pendingSince = 0
|
|
1439
|
+
let pendingChangedAt = 0
|
|
1440
|
+
// the initial assignment never waits, even if this runner ends up with no shards
|
|
1441
|
+
let assignmentsPublished = false
|
|
1442
|
+
// stays set until the assignments are actually recomputed
|
|
1443
|
+
let changed = false
|
|
1444
|
+
|
|
1445
|
+
const addToRings = (runner: Runner) => {
|
|
1446
|
+
for (let i = 0; i < runner.groups.length; i++) {
|
|
1447
|
+
const group = runner.groups[i]
|
|
1448
|
+
let ring = hashRings.get(group)
|
|
1449
|
+
if (!ring) {
|
|
1450
|
+
ring = HashRing.make()
|
|
1451
|
+
hashRings.set(group, ring)
|
|
1452
|
+
}
|
|
1453
|
+
HashRing.add(ring, runner.address, { weight: runner.weight })
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1415
1457
|
yield* Effect.gen(function*() {
|
|
1416
|
-
const hashRings = new Map<string, HashRing.HashRing<RunnerAddress>>()
|
|
1417
|
-
let nextRunners = MutableHashMap.empty<Runner, boolean>()
|
|
1418
|
-
const healthyRunners = MutableHashSet.empty<Runner>()
|
|
1419
1458
|
const withTimeout = Effect.timeout(Duration.seconds(5))
|
|
1420
1459
|
|
|
1421
1460
|
while (true) {
|
|
@@ -1430,7 +1469,7 @@ const make = Effect.gen(function*() {
|
|
|
1430
1469
|
}
|
|
1431
1470
|
|
|
1432
1471
|
const runners = yield* withTimeout(runnerStorage.getRunners)
|
|
1433
|
-
|
|
1472
|
+
const now = clock.currentTimeMillisUnsafe()
|
|
1434
1473
|
for (let i = 0; i < runners.length; i++) {
|
|
1435
1474
|
const [runner, healthy] = runners[i]
|
|
1436
1475
|
MutableHashMap.set(nextRunners, runner, healthy)
|
|
@@ -1442,31 +1481,55 @@ const make = Effect.gen(function*() {
|
|
|
1442
1481
|
}
|
|
1443
1482
|
continue
|
|
1444
1483
|
}
|
|
1445
|
-
changed = true
|
|
1446
1484
|
MutableHashSet.add(healthyRunners, runner)
|
|
1447
1485
|
MutableHashMap.remove(allRunners, runner)
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
if (!ring) {
|
|
1452
|
-
ring = HashRing.make()
|
|
1453
|
-
hashRings.set(group, ring)
|
|
1486
|
+
if (joinDebounce > 0 && assignmentsPublished) {
|
|
1487
|
+
if (MutableHashSet.size(pendingRunners) === 0) {
|
|
1488
|
+
pendingSince = now
|
|
1454
1489
|
}
|
|
1455
|
-
|
|
1490
|
+
pendingChangedAt = now
|
|
1491
|
+
MutableHashSet.add(pendingRunners, runner)
|
|
1492
|
+
continue
|
|
1456
1493
|
}
|
|
1494
|
+
changed = true
|
|
1495
|
+
addToRings(runner)
|
|
1457
1496
|
}
|
|
1458
1497
|
|
|
1459
1498
|
// Remove runners that are no longer present or healthy
|
|
1460
1499
|
MutableHashMap.forEach(allRunners, (_, runner) => {
|
|
1461
|
-
changed = true
|
|
1462
1500
|
MutableHashMap.remove(allRunners, runner)
|
|
1463
1501
|
MutableHashSet.remove(healthyRunners, runner)
|
|
1464
1502
|
runFork(runnersService.onRunnerUnavailable(runner.address))
|
|
1503
|
+
// A pending runner owns no shards, so its departure only restarts the
|
|
1504
|
+
// quiet period instead of publishing the other joins mid-burst.
|
|
1505
|
+
if (MutableHashSet.has(pendingRunners, runner)) {
|
|
1506
|
+
MutableHashSet.remove(pendingRunners, runner)
|
|
1507
|
+
pendingChangedAt = now
|
|
1508
|
+
if (MutableHashSet.size(pendingRunners) === 0) {
|
|
1509
|
+
// let the acquisition loop take the shards it was holding off on
|
|
1510
|
+
activeShardsLatch.openUnsafe()
|
|
1511
|
+
}
|
|
1512
|
+
return
|
|
1513
|
+
}
|
|
1514
|
+
changed = true
|
|
1465
1515
|
for (let i = 0; i < runner.groups.length; i++) {
|
|
1466
1516
|
HashRing.remove(hashRings.get(runner.groups[i])!, runner.address)
|
|
1467
1517
|
}
|
|
1468
1518
|
})
|
|
1469
1519
|
|
|
1520
|
+
// Publish pending joins once the healthy set has settled, the cap is
|
|
1521
|
+
// reached, or the assignments are recomputed anyway.
|
|
1522
|
+
if (
|
|
1523
|
+
MutableHashSet.size(pendingRunners) > 0 &&
|
|
1524
|
+
(changed || now - pendingChangedAt >= joinDebounce || now - pendingSince >= joinDebounce * 4)
|
|
1525
|
+
) {
|
|
1526
|
+
changed = true
|
|
1527
|
+
for (const runner of pendingRunners) {
|
|
1528
|
+
addToRings(runner)
|
|
1529
|
+
}
|
|
1530
|
+
MutableHashSet.clear(pendingRunners)
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1470
1533
|
// swap allRunners and nextRunners
|
|
1471
1534
|
const prevRunners = allRunners
|
|
1472
1535
|
allRunners = nextRunners
|
|
@@ -1480,6 +1543,8 @@ const make = Effect.gen(function*() {
|
|
|
1480
1543
|
|
|
1481
1544
|
// Recompute shard assignments if the set of healthy runners has changed.
|
|
1482
1545
|
if (changed) {
|
|
1546
|
+
changed = false
|
|
1547
|
+
assignmentsPublished = true
|
|
1483
1548
|
MutableHashSet.clear(selfShards)
|
|
1484
1549
|
hashRings.forEach((ring, group) => {
|
|
1485
1550
|
const newAssignments = HashRing.getShards(ring, config.shardsPerGroup)
|
|
@@ -1541,6 +1606,27 @@ const make = Effect.gen(function*() {
|
|
|
1541
1606
|
}
|
|
1542
1607
|
const clientRequests = new Map<Snowflake.Snowflake, ClientRequestEntry>()
|
|
1543
1608
|
|
|
1609
|
+
// During shutdown, abandon local callers parked on persisted requests that a
|
|
1610
|
+
// retiring entity never started. They are served by the next owner. Callers
|
|
1611
|
+
// on a runner that keeps running are left waiting, so they stay durable.
|
|
1612
|
+
const abandonUndelivered = (
|
|
1613
|
+
address: EntityAddress,
|
|
1614
|
+
isDelivered: (requestId: Snowflake.Snowflake) => boolean
|
|
1615
|
+
): Effect.Effect<void> =>
|
|
1616
|
+
Effect.suspend(() => {
|
|
1617
|
+
if (!MutableRef.get(isShutdown)) return Effect.void
|
|
1618
|
+
const abandon: Array<Effect.Effect<void>> = []
|
|
1619
|
+
for (const [requestId, entry] of clientRequests) {
|
|
1620
|
+
if (
|
|
1621
|
+
!Context.get(entry.message.annotations, Persisted) ||
|
|
1622
|
+
!Equal.equals(entry.message.envelope.address, address) ||
|
|
1623
|
+
isDelivered(requestId)
|
|
1624
|
+
) continue
|
|
1625
|
+
abandon.push(storage.unregisterReplyHandler(requestId, { interrupt: true }))
|
|
1626
|
+
}
|
|
1627
|
+
return Effect.all(abandon, { discard: true })
|
|
1628
|
+
})
|
|
1629
|
+
|
|
1544
1630
|
const clients: ResourceMap<
|
|
1545
1631
|
Entity<any, any>,
|
|
1546
1632
|
(entityId: string) => RpcClient.RpcClient<
|
|
@@ -1595,18 +1681,23 @@ const make = Effect.gen(function*() {
|
|
|
1595
1681
|
envelope as any
|
|
1596
1682
|
)
|
|
1597
1683
|
})
|
|
1598
|
-
if (
|
|
1599
|
-
const entry: ClientRequestEntry = {
|
|
1600
|
-
rpc: rpc as any,
|
|
1601
|
-
context: fiber.context,
|
|
1602
|
-
message
|
|
1603
|
-
}
|
|
1604
|
-
clientRequests.set(id, entry)
|
|
1605
|
-
respond = makeClientRespond(entry, client.write)
|
|
1606
|
-
} else {
|
|
1684
|
+
if (options.message.discard === true) {
|
|
1607
1685
|
respond = clientRespondDiscard
|
|
1686
|
+
// a discarded call is acknowledged once its message is sent
|
|
1687
|
+
const requestId = options.message.id
|
|
1688
|
+
return Effect.flatMap(
|
|
1689
|
+
sendOutgoing(message, true),
|
|
1690
|
+
() => client.write({ _tag: "Exit", clientId: 0, requestId, exit: Exit.void as any })
|
|
1691
|
+
)
|
|
1608
1692
|
}
|
|
1609
|
-
|
|
1693
|
+
const entry: ClientRequestEntry = {
|
|
1694
|
+
rpc: rpc as any,
|
|
1695
|
+
context: fiber.context,
|
|
1696
|
+
message
|
|
1697
|
+
}
|
|
1698
|
+
clientRequests.set(id, entry)
|
|
1699
|
+
respond = makeClientRespond(entry, client.write)
|
|
1700
|
+
return sendOutgoing(message, false)
|
|
1610
1701
|
}
|
|
1611
1702
|
case "Ack": {
|
|
1612
1703
|
const requestId = Snowflake.Snowflake(options.message.requestId)
|
|
@@ -1878,6 +1969,42 @@ const make = Effect.gen(function*() {
|
|
|
1878
1969
|
const reaper = yield* EntityReaper
|
|
1879
1970
|
const entityManagerLatches = new Map<string, Latch.Latch>()
|
|
1880
1971
|
|
|
1972
|
+
// This runner's view of its shards lags lock storage by up to one refresh,
|
|
1973
|
+
// or longer while the process is paused. So the final reply of a persisted
|
|
1974
|
+
// request is stored only once a refresh of its shard's lock confirms it.
|
|
1975
|
+
// Anything short of that, including a refresh that failed, timed out, was
|
|
1976
|
+
// interrupted, or never started because shutdown closed the scope, leaves
|
|
1977
|
+
// the reply for the shard's next owner. Concurrent writers on a shard share
|
|
1978
|
+
// one refresh, which outlives an interrupted writer. Entities draining from
|
|
1979
|
+
// a released shard still hold its lock.
|
|
1980
|
+
const pendingLockChecks = new Map<ShardId, Fiber.Fiber<boolean>>()
|
|
1981
|
+
const confirmShardLock = (runnerAddress: RunnerAddress, shardId: ShardId): Effect.Effect<boolean> =>
|
|
1982
|
+
Effect.suspend(() => {
|
|
1983
|
+
if (!MutableHashSet.has(acquiredShards, shardId) && !MutableHashSet.has(releasingShards, shardId)) {
|
|
1984
|
+
return Effect.succeed(false)
|
|
1985
|
+
}
|
|
1986
|
+
const pending = pendingLockChecks.get(shardId)
|
|
1987
|
+
const check = pending ? Effect.succeed(pending) : runnerStorage.refresh(runnerAddress, [shardId]).pipe(
|
|
1988
|
+
Effect.map((acquired) => {
|
|
1989
|
+
releaseLostShards([shardId], acquired)
|
|
1990
|
+
return acquired.includes(shardId)
|
|
1991
|
+
}),
|
|
1992
|
+
Effect.timeoutOption(shardLockInterval),
|
|
1993
|
+
Effect.map(Option.getOrElse(() => false)),
|
|
1994
|
+
Effect.catch(() => Effect.succeed(false)),
|
|
1995
|
+
Effect.forkIn(shardingScope, { startImmediately: true }),
|
|
1996
|
+
Effect.map((fiber) => {
|
|
1997
|
+
pendingLockChecks.set(shardId, fiber)
|
|
1998
|
+
fiber.addObserver(() => pendingLockChecks.delete(shardId))
|
|
1999
|
+
return fiber
|
|
2000
|
+
})
|
|
2001
|
+
)
|
|
2002
|
+
return Effect.flatMap(
|
|
2003
|
+
check,
|
|
2004
|
+
(fiber) => Effect.map(Fiber.await(fiber), (exit) => exit._tag === "Success" && exit.value)
|
|
2005
|
+
)
|
|
2006
|
+
})
|
|
2007
|
+
|
|
1881
2008
|
const registerEntity: Sharding["Service"]["registerEntity"] = Effect.fnUntraced(
|
|
1882
2009
|
function*(entity, build, options) {
|
|
1883
2010
|
const runnerAddress = getRunnerAddress()
|
|
@@ -1895,7 +2022,9 @@ const make = Effect.gen(function*() {
|
|
|
1895
2022
|
storage,
|
|
1896
2023
|
runnerAddress,
|
|
1897
2024
|
residency,
|
|
1898
|
-
sharding
|
|
2025
|
+
sharding,
|
|
2026
|
+
abandonUndelivered,
|
|
2027
|
+
isShardOwned: (shardId) => confirmShardLock(runnerAddress, shardId)
|
|
1899
2028
|
}).pipe(
|
|
1900
2029
|
Effect.provideContext(services.pipe(
|
|
1901
2030
|
// Registration overrides construction fallbacks, except for runner-owned services.
|
|
@@ -81,6 +81,13 @@ export class ShardingConfig extends Context.Service<ShardingConfig, {
|
|
|
81
81
|
readonly shardLockRefreshInterval: Duration.Input
|
|
82
82
|
/**
|
|
83
83
|
* Shard lock expiration duration.
|
|
84
|
+
*
|
|
85
|
+
* With PostgreSQL (14+) or MySQL advisory locks, this also bounds how long a
|
|
86
|
+
* runner that stops refreshing, for example because its process is frozen,
|
|
87
|
+
* keeps its shards: the server ends its idle lock session after this
|
|
88
|
+
* duration, releasing the locks. On MySQL it is rounded up to whole
|
|
89
|
+
* seconds. Vitess ignores the MySQL session timeout, so behind Vitess the
|
|
90
|
+
* locks stay held until the runner's connection closes.
|
|
84
91
|
*/
|
|
85
92
|
readonly shardLockExpiration: Duration.Input
|
|
86
93
|
/**
|
|
@@ -160,6 +167,37 @@ export class ShardingConfig extends Context.Service<ShardingConfig, {
|
|
|
160
167
|
* assignments.
|
|
161
168
|
*/
|
|
162
169
|
readonly refreshAssignmentsInterval: Duration.Input
|
|
170
|
+
/**
|
|
171
|
+
* How long the healthy runners must stay unchanged before runners that
|
|
172
|
+
* joined are added to shard assignments. A burst of joins, such as a
|
|
173
|
+
* scale-up or a deployment with a large surge, is then published as one
|
|
174
|
+
* assignment and each shard is handed off once instead of once per join.
|
|
175
|
+
* In a rolling update that replaces one runner at a time, each departure is
|
|
176
|
+
* still published immediately, so shards still move at every step.
|
|
177
|
+
*
|
|
178
|
+
* Only joins wait. The initial assignment, departures and unhealthy runners
|
|
179
|
+
* are published immediately, together with any pending joins. A pending
|
|
180
|
+
* runner that leaves has no shards to move, so it only restarts the quiet
|
|
181
|
+
* period.
|
|
182
|
+
*
|
|
183
|
+
* While joins are pending, shards keep running where they are, the new
|
|
184
|
+
* runners stay idle and no runner takes shards it does not already hold.
|
|
185
|
+
* Runners publish on their own polls, so a shard released by one runner can
|
|
186
|
+
* stay unlocked until its new owner publishes, usually within two
|
|
187
|
+
* `refreshAssignmentsInterval`s. A runner that does not observe the joins,
|
|
188
|
+
* for example because it cannot read membership, can still take shards from
|
|
189
|
+
* its outdated assignment and hand them off again, as with `0`.
|
|
190
|
+
*
|
|
191
|
+
* Pending joins are published at most four times this duration after the
|
|
192
|
+
* first one, even if runners keep joining. The quiet period is checked once
|
|
193
|
+
* per `refreshAssignmentsInterval`, so the worst case delay is four times
|
|
194
|
+
* this duration plus one interval, and values shorter than the interval
|
|
195
|
+
* behave like a single quiet poll.
|
|
196
|
+
*
|
|
197
|
+
* Defaults to `0`, which publishes every change immediately. Leave it at
|
|
198
|
+
* `0` for scale-ups driven by load, where idle new runners are costly.
|
|
199
|
+
*/
|
|
200
|
+
readonly runnerJoinDebounce: Duration.Input
|
|
163
201
|
/**
|
|
164
202
|
* The interval to retry a send if EntityNotAssignedToRunner is returned.
|
|
165
203
|
*/
|
|
@@ -208,6 +246,7 @@ export const defaults: ShardingConfig["Service"] = {
|
|
|
208
246
|
entityReplyPollInterval: Duration.millis(200),
|
|
209
247
|
sendRetryInterval: Duration.millis(100),
|
|
210
248
|
refreshAssignmentsInterval: Duration.seconds(3),
|
|
249
|
+
runnerJoinDebounce: Duration.zero,
|
|
211
250
|
runnerHealthCheckInterval: Duration.minutes(1),
|
|
212
251
|
simulateRemoteSerialization: true
|
|
213
252
|
}
|
|
@@ -366,6 +405,10 @@ export const config: Config.Config<ShardingConfig["Service"]> = Config.all({
|
|
|
366
405
|
Config.withDefault(defaults.refreshAssignmentsInterval)
|
|
367
406
|
// Config.withDescription("The interval at which to refresh shard assignments.")
|
|
368
407
|
),
|
|
408
|
+
runnerJoinDebounce: Config.Duration("runnerJoinDebounce").pipe(
|
|
409
|
+
Config.withDefault(defaults.runnerJoinDebounce)
|
|
410
|
+
// Config.withDescription("How long the healthy runners must stay unchanged before joining runners are assigned shards.")
|
|
411
|
+
),
|
|
369
412
|
runnerHealthCheckInterval: Config.Duration("runnerHealthCheckInterval").pipe(
|
|
370
413
|
Config.withDefault(defaults.runnerHealthCheckInterval)
|
|
371
414
|
// Config.withDescription("The interval at which to check for unhealthy runners and report them.")
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import * as Layer from "effect/Layer"
|
|
15
15
|
import type { ConfigError } from "../Config.ts"
|
|
16
|
-
import type * as
|
|
16
|
+
import type * as Digest from "../crypto/Digest.ts"
|
|
17
17
|
import type * as SqlClient from "../sql/SqlClient.ts"
|
|
18
18
|
import type * as MessageStorage from "./MessageStorage.ts"
|
|
19
19
|
import * as RunnerHealth from "./RunnerHealth.ts"
|
|
@@ -44,7 +44,7 @@ import * as SqlRunnerStorage from "./SqlRunnerStorage.ts"
|
|
|
44
44
|
* **Gotchas**
|
|
45
45
|
*
|
|
46
46
|
* - Even when `runnerStorage` is `"memory"`, message storage remains
|
|
47
|
-
* SQL-backed, so callers must still provide `SqlClient` and `
|
|
47
|
+
* SQL-backed, so callers must still provide `SqlClient` and `Digest.Digest`
|
|
48
48
|
* (used to hash over-length message deduplication keys).
|
|
49
49
|
* - Runner communication and runner health are no-op services, so this layer is
|
|
50
50
|
* for single-process use rather than multi-runner coordination.
|
|
@@ -66,7 +66,7 @@ export const layer = (options?: {
|
|
|
66
66
|
| Runners.Runners
|
|
67
67
|
| MessageStorage.MessageStorage,
|
|
68
68
|
ConfigError,
|
|
69
|
-
SqlClient.SqlClient |
|
|
69
|
+
SqlClient.SqlClient | Digest.Digest
|
|
70
70
|
> =>
|
|
71
71
|
Sharding.layer.pipe(
|
|
72
72
|
Layer.provideMerge(Runners.layerNoop),
|
package/src/cluster/Snowflake.ts
CHANGED
|
@@ -257,18 +257,14 @@ export const makeGenerator: Effect.Effect<Snowflake.Generator> = Effect.gen(func
|
|
|
257
257
|
machineId = newMachineId
|
|
258
258
|
}),
|
|
259
259
|
nextUnsafe() {
|
|
260
|
-
|
|
260
|
+
const now = Math.floor(clock.currentTimeMillisUnsafe())
|
|
261
261
|
|
|
262
|
-
|
|
263
|
-
if (now < sequenceAt) {
|
|
264
|
-
now = sequenceAt
|
|
265
|
-
} else if (now > sequenceAt) {
|
|
262
|
+
if (now > sequenceAt) {
|
|
266
263
|
// reset sequence if we're in a new millisecond
|
|
267
264
|
sequence = 0
|
|
268
265
|
sequenceAt = now
|
|
269
266
|
} else if (sequence >= 4096) {
|
|
270
|
-
//
|
|
271
|
-
// millisecond
|
|
267
|
+
// sequence exhausted and the clock hasn't advanced, so borrow the next millisecond
|
|
272
268
|
sequenceAt++
|
|
273
269
|
sequence = 0
|
|
274
270
|
}
|