effect 4.0.7 → 4.1.1
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 +31 -1
- package/THIRD_PARTY_NOTICES.md +62 -0
- package/dist/BigDecimal.d.ts +139 -7
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +86 -14
- 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 +9 -3
- 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/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 +164 -7
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +11 -1
- package/dist/Effect.js.map +1 -1
- package/dist/Equal.d.ts +2 -2
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +3 -3
- package/dist/Equal.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/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 +3 -2
- package/dist/Hash.d.ts.map +1 -1
- package/dist/Hash.js +5 -4
- package/dist/Hash.js.map +1 -1
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +11 -8
- package/dist/Iterable.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/Path.d.ts.map +1 -1
- package/dist/Path.js +5 -1
- package/dist/Path.js.map +1 -1
- package/dist/Pool.d.ts +51 -0
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +61 -10
- package/dist/Pool.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/Schedule.d.ts +18 -1
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +7 -2
- package/dist/Schedule.js.map +1 -1
- package/dist/Schema.d.ts +668 -42
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +652 -1
- package/dist/Schema.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/SchemaRepresentation.d.ts +18 -2
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +20 -2
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +10 -5
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +8 -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 +40 -0
- package/dist/Semaphore.js.map +1 -1
- package/dist/Stream.d.ts +13 -4
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +9 -0
- package/dist/Stream.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/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/McpClient.d.ts +171 -19
- package/dist/ai/McpClient.d.ts.map +1 -1
- package/dist/ai/McpClient.js +277 -66
- package/dist/ai/McpClient.js.map +1 -1
- package/dist/ai/McpSchema.d.ts +108 -0
- package/dist/ai/McpSchema.d.ts.map +1 -1
- package/dist/ai/McpSchema.js +99 -0
- package/dist/ai/McpSchema.js.map +1 -1
- package/dist/ai/McpServer.d.ts +744 -29
- package/dist/ai/McpServer.d.ts.map +1 -1
- package/dist/ai/McpServer.js +763 -136
- 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.map +1 -1
- package/dist/ai/Prompt.js +20 -11
- package/dist/ai/Prompt.js.map +1 -1
- package/dist/ai/Response.d.ts +1 -25
- package/dist/ai/Response.d.ts.map +1 -1
- package/dist/ai/Response.js +1 -10
- package/dist/ai/Response.js.map +1 -1
- package/dist/ai/Tool.d.ts +19 -1
- package/dist/ai/Tool.d.ts.map +1 -1
- package/dist/ai/Tool.js +5 -7
- package/dist/ai/Tool.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 +89 -15
- package/dist/ai/internal/mcpCore.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2024_11_05.js +7 -6
- package/dist/ai/internal/mcpProtocol/v2024_11_05.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_03_26.js +7 -6
- package/dist/ai/internal/mcpProtocol/v2025_03_26.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_06_18.js +7 -6
- package/dist/ai/internal/mcpProtocol/v2025_06_18.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_11_25.js +7 -6
- package/dist/ai/internal/mcpProtocol/v2025_11_25.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2026_07_28.js +60 -17
- package/dist/ai/internal/mcpProtocol/v2026_07_28.js.map +1 -1
- package/dist/ai/internal/mcpProtocol.js +25 -0
- package/dist/ai/internal/mcpProtocol.js.map +1 -1
- package/dist/ai/internal/mcpRuntime.js +8 -6
- package/dist/ai/internal/mcpRuntime.js.map +1 -1
- package/dist/ai/internal/mcpSkills.d.ts +2 -0
- package/dist/ai/internal/mcpSkills.d.ts.map +1 -0
- package/dist/ai/internal/mcpSkills.js +428 -0
- package/dist/ai/internal/mcpSkills.js.map +1 -0
- package/dist/ai/internal/mcpStatefulRuntime.js +6 -1
- package/dist/ai/internal/mcpStatefulRuntime.js.map +1 -1
- package/dist/cli/Argument.d.ts +6 -0
- package/dist/cli/Argument.d.ts.map +1 -1
- package/dist/cli/Argument.js +2 -0
- package/dist/cli/Argument.js.map +1 -1
- package/dist/cli/CliOutput.d.ts +65 -1
- package/dist/cli/CliOutput.d.ts.map +1 -1
- package/dist/cli/CliOutput.js +94 -37
- package/dist/cli/CliOutput.js.map +1 -1
- package/dist/cli/Command.d.ts +23 -0
- package/dist/cli/Command.d.ts.map +1 -1
- package/dist/cli/Command.js +8 -0
- package/dist/cli/Command.js.map +1 -1
- package/dist/cli/Flag.d.ts +107 -0
- package/dist/cli/Flag.d.ts.map +1 -1
- package/dist/cli/Flag.js +37 -0
- package/dist/cli/Flag.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 +6 -0
- package/dist/cli/Param.d.ts.map +1 -1
- package/dist/cli/Param.js +2 -0
- 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/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 +15 -5
- package/dist/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/cluster/Reply.d.ts +1 -1
- package/dist/cluster/Reply.d.ts.map +1 -1
- package/dist/cluster/Reply.js.map +1 -1
- package/dist/cluster/Sharding.d.ts.map +1 -1
- package/dist/cluster/Sharding.js +93 -28
- package/dist/cluster/Sharding.js.map +1 -1
- package/dist/cluster/ShardingConfig.d.ts +72 -6
- 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/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 +23 -8
- package/dist/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/cluster/internal/entityManager.js +15 -7
- package/dist/cluster/internal/entityManager.js.map +1 -1
- package/dist/crypto/Aead.d.ts +323 -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 +236 -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 +324 -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 +341 -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 +390 -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 +278 -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 +449 -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 +80 -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 +171 -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/encoding/Base64Url.d.ts.map +1 -1
- package/dist/encoding/Base64Url.js +29 -5
- 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/Ndjson.d.ts +5 -4
- package/dist/encoding/Ndjson.d.ts.map +1 -1
- package/dist/encoding/Ndjson.js +6 -5
- package/dist/encoding/Ndjson.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 +3 -1
- package/dist/encoding/Sse.d.ts.map +1 -1
- package/dist/encoding/Sse.js +5 -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 +104 -16
- 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 +126 -4
- package/dist/eventlog/EventLog.d.ts.map +1 -1
- package/dist/eventlog/EventLog.js +207 -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 +10 -1
- package/dist/eventlog/EventLogServer.d.ts.map +1 -1
- package/dist/eventlog/EventLogServer.js +45 -22
- package/dist/eventlog/EventLogServer.js.map +1 -1
- package/dist/eventlog/EventLogServerEncrypted.d.ts +336 -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/EventLogServerUnencrypted.d.ts +17 -0
- package/dist/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/eventlog/EventLogServerUnencrypted.js +14 -2
- package/dist/eventlog/EventLogServerUnencrypted.js.map +1 -1
- package/dist/eventlog/EventLogSessionAuth.d.ts +26 -3
- package/dist/eventlog/EventLogSessionAuth.d.ts.map +1 -1
- package/dist/eventlog/EventLogSessionAuth.js +63 -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.js +2 -2
- 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/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/graphql/GraphQLClient.d.ts +3 -1
- package/dist/graphql/GraphQLClient.d.ts.map +1 -1
- package/dist/graphql/GraphQLClient.js.map +1 -1
- package/dist/graphql/GraphQLClientError.d.ts +14 -9
- package/dist/graphql/GraphQLClientError.d.ts.map +1 -1
- package/dist/graphql/GraphQLClientError.js +14 -21
- package/dist/graphql/GraphQLClientError.js.map +1 -1
- package/dist/graphql/GraphQLProtocol.d.ts +12 -3
- package/dist/graphql/GraphQLProtocol.d.ts.map +1 -1
- package/dist/graphql/GraphQLProtocol.js +4 -1
- package/dist/graphql/GraphQLProtocol.js.map +1 -1
- package/dist/http/Cookies.d.ts +172 -0
- package/dist/http/Cookies.d.ts.map +1 -1
- package/dist/http/Cookies.js +143 -1
- 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 +268 -15
- package/dist/http/HttpClient.d.ts.map +1 -1
- package/dist/http/HttpClient.js +140 -7
- package/dist/http/HttpClient.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 +2 -3
- 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/HttpServerRequest.d.ts +5 -2
- package/dist/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/http/HttpServerRequest.js +44 -39
- 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/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/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/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/decompression.js +3 -2
- package/dist/http/internal/decompression.js.map +1 -1
- package/dist/http/internal/mimeTypes.d.ts +4 -1
- package/dist/http/internal/mimeTypes.d.ts.map +1 -1
- package/dist/http/internal/mimeTypes.js +4 -1
- package/dist/http/internal/mimeTypes.js.map +1 -1
- package/dist/http/internal/urlParams.js +8 -0
- package/dist/http/internal/urlParams.js.map +1 -1
- package/dist/http-api/HttpApiBuilder.js +19 -5
- package/dist/http-api/HttpApiBuilder.js.map +1 -1
- package/dist/http-api/HttpApiClient.d.ts +63 -0
- package/dist/http-api/HttpApiClient.d.ts.map +1 -1
- package/dist/http-api/HttpApiClient.js +51 -0
- package/dist/http-api/HttpApiClient.js.map +1 -1
- package/dist/http-api/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/http-api/HttpApiEndpoint.js +14 -5
- 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 +76 -14
- package/dist/http-api/HttpApiSchema.d.ts.map +1 -1
- package/dist/http-api/HttpApiSchema.js +54 -1
- package/dist/http-api/HttpApiSchema.js.map +1 -1
- 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/dateTime.js +49 -24
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/effect.js +35 -14
- package/dist/internal/effect.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 +808 -0
- package/dist/internal/glob.js.map +1 -0
- package/dist/internal/graphql.js +21 -7
- package/dist/internal/graphql.js.map +1 -1
- package/dist/internal/graphqlHeaders.d.ts +7 -0
- package/dist/internal/graphqlHeaders.d.ts.map +1 -1
- package/dist/internal/graphqlHeaders.js +11 -0
- package/dist/internal/graphqlHeaders.js.map +1 -1
- package/dist/internal/matcher.js +10 -0
- 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/request.js +29 -42
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/schema/fromJsonSchemaDocument.js +7 -8
- package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -1
- package/dist/internal/schema/toCodeDocument.js +6 -3
- package/dist/internal/schema/toCodeDocument.js.map +1 -1
- 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/jose/JoseError.d.ts +285 -0
- package/dist/jose/JoseError.d.ts.map +1 -0
- package/dist/jose/JoseError.js +269 -0
- package/dist/jose/JoseError.js.map +1 -0
- package/dist/jose/Jwe.d.ts +128 -0
- package/dist/jose/Jwe.d.ts.map +1 -0
- package/dist/jose/Jwe.js +134 -0
- package/dist/jose/Jwe.js.map +1 -0
- package/dist/jose/Jwk.d.ts +597 -0
- package/dist/jose/Jwk.d.ts.map +1 -0
- package/dist/jose/Jwk.js +503 -0
- package/dist/jose/Jwk.js.map +1 -0
- package/dist/jose/Jwks.d.ts +236 -0
- package/dist/jose/Jwks.d.ts.map +1 -0
- package/dist/jose/Jwks.js +306 -0
- package/dist/jose/Jwks.js.map +1 -0
- package/dist/jose/Jws.d.ts +177 -0
- package/dist/jose/Jws.d.ts.map +1 -0
- package/dist/jose/Jws.js +183 -0
- package/dist/jose/Jws.js.map +1 -0
- package/dist/jose/Jwt.d.ts +270 -0
- package/dist/jose/Jwt.d.ts.map +1 -0
- package/dist/jose/Jwt.js +293 -0
- package/dist/jose/Jwt.js.map +1 -0
- package/dist/jose/index.d.ts +51 -0
- package/dist/jose/index.d.ts.map +1 -0
- package/dist/jose/index.js +52 -0
- package/dist/jose/index.js.map +1 -0
- package/dist/jose/internal/compact.d.ts +2 -0
- package/dist/jose/internal/compact.d.ts.map +1 -0
- package/dist/jose/internal/compact.js +179 -0
- package/dist/jose/internal/compact.js.map +1 -0
- package/dist/net/Host.d.ts.map +1 -1
- package/dist/net/Host.js +5 -10
- package/dist/net/Host.js.map +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/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/OtlpSerialization.d.ts +1 -1
- package/dist/observability/OtlpSerialization.d.ts.map +1 -1
- package/dist/observability/OtlpSerialization.js +10 -4
- package/dist/observability/OtlpSerialization.js.map +1 -1
- package/dist/observability/internal/otlpProtobuf.js +3 -3
- package/dist/observability/internal/otlpProtobuf.js.map +1 -1
- package/dist/observability/internal/protobuf.js +6 -0
- package/dist/observability/internal/protobuf.js.map +1 -1
- package/dist/persistence/CircuitBreaker.d.ts +98 -38
- package/dist/persistence/CircuitBreaker.d.ts.map +1 -1
- package/dist/persistence/CircuitBreaker.js +67 -29
- package/dist/persistence/CircuitBreaker.js.map +1 -1
- 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/RateLimiter.d.ts +8 -0
- package/dist/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/persistence/RateLimiter.js +63 -12
- package/dist/persistence/RateLimiter.js.map +1 -1
- package/dist/persistence/index.d.ts +1 -1
- package/dist/persistence/index.js +1 -1
- package/dist/process/ChildProcess.d.ts +207 -67
- 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 +5 -0
- package/dist/process/ChildProcessSpawner.d.ts.map +1 -1
- 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/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 +17 -7
- package/dist/reactivity/AtomRegistry.js.map +1 -1
- package/dist/rpc/Rpc.d.ts +1 -1
- package/dist/rpc/Rpc.d.ts.map +1 -1
- package/dist/rpc/Rpc.js.map +1 -1
- package/dist/rpc/RpcClient.d.ts +28 -1
- package/dist/rpc/RpcClient.d.ts.map +1 -1
- package/dist/rpc/RpcClient.js +78 -27
- package/dist/rpc/RpcClient.js.map +1 -1
- package/dist/rpc/RpcMessage.d.ts +13 -3
- 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.map +1 -1
- package/dist/rpc/RpcSerialization.js +6 -0
- 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 -66
- package/dist/rpc/RpcServer.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 +9 -20
- package/dist/sql/Migrator.d.ts.map +1 -1
- package/dist/sql/Migrator.js +20 -53
- 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 +38 -3
- package/dist/sql/SqlClient.d.ts.map +1 -1
- package/dist/sql/SqlClient.js +9 -12
- package/dist/sql/SqlClient.js.map +1 -1
- package/dist/sql/Statement.d.ts +61 -9
- package/dist/sql/Statement.d.ts.map +1 -1
- package/dist/sql/Statement.js +24 -33
- 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/Workflow.d.ts +4 -0
- package/dist/workflow/Workflow.d.ts.map +1 -1
- package/dist/workflow/Workflow.js.map +1 -1
- package/dist/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/workflow/WorkflowEngine.js +5 -0
- package/dist/workflow/WorkflowEngine.js.map +1 -1
- package/dist/workflow/internal/crypto.js +9 -8
- package/dist/workflow/internal/crypto.js.map +1 -1
- package/package.json +7 -1
- package/src/BigDecimal.ts +173 -16
- package/src/Channel.ts +17 -11
- package/src/Config.ts +7 -1
- package/src/Context.ts +34 -10
- package/src/Cron.ts +178 -29
- package/src/Duration.ts +140 -0
- package/src/Effect.ts +914 -85
- package/src/Equal.ts +3 -3
- package/src/FileSystem.ts +65 -4
- package/src/Glob.ts +205 -0
- package/src/Hash.ts +5 -4
- package/src/Iterable.ts +8 -5
- package/src/Match.ts +127 -0
- package/src/Path.ts +6 -1
- package/src/Pool.ts +75 -16
- package/src/Random.ts +3 -3
- package/src/RcMap.ts +5 -1
- package/src/Schedule.ts +26 -3
- package/src/Schema.ts +1191 -63
- package/src/SchemaGetter.ts +27 -11
- package/src/SchemaRepresentation.ts +23 -2
- package/src/SchemaTransformation.ts +10 -5
- package/src/ScopedCache.ts +5 -9
- package/src/Semaphore.ts +141 -0
- package/src/Stream.ts +15 -6
- package/src/Terminal.ts +19 -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/McpClient.ts +488 -91
- package/src/ai/McpSchema.ts +119 -0
- package/src/ai/McpServer.ts +1525 -319
- package/src/ai/McpTest.ts +380 -0
- package/src/ai/Prompt.ts +16 -11
- package/src/ai/Response.ts +2 -22
- package/src/ai/Tool.ts +32 -18
- package/src/ai/index.ts +6 -0
- package/src/ai/internal/mcpCore.ts +243 -56
- package/src/ai/internal/mcpProtocol/v2024_11_05.ts +7 -8
- package/src/ai/internal/mcpProtocol/v2025_03_26.ts +7 -8
- package/src/ai/internal/mcpProtocol/v2025_06_18.ts +7 -8
- package/src/ai/internal/mcpProtocol/v2025_11_25.ts +7 -8
- package/src/ai/internal/mcpProtocol/v2026_07_28.ts +56 -17
- package/src/ai/internal/mcpProtocol.ts +44 -0
- package/src/ai/internal/mcpRuntime.ts +15 -8
- package/src/ai/internal/mcpSkills.ts +480 -0
- package/src/ai/internal/mcpStatefulRuntime.ts +14 -2
- package/src/cli/Argument.ts +6 -0
- package/src/cli/CliOutput.ts +117 -49
- package/src/cli/Command.ts +23 -0
- package/src/cli/Flag.ts +107 -0
- package/src/cli/HelpDoc.ts +18 -1
- package/src/cli/Param.ts +6 -0
- package/src/cli/Primitive.ts +16 -1
- package/src/cli/Prompt.ts +1 -0
- package/src/cli/internal/help.ts +21 -9
- package/src/cluster/ClusterWorkflowEngine.ts +22 -8
- package/src/cluster/Reply.ts +1 -1
- package/src/cluster/Sharding.ts +96 -26
- package/src/cluster/ShardingConfig.ts +41 -3
- package/src/cluster/SingleRunner.ts +3 -3
- package/src/cluster/SqlMessageStorage.ts +49 -17
- package/src/cluster/SqlRunnerStorage.ts +37 -27
- package/src/cluster/internal/entityManager.ts +24 -10
- 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 +741 -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 +84 -0
- package/src/crypto/index.ts +78 -0
- package/src/crypto/internal/asymmetric.ts +330 -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 +242 -0
- package/src/crypto/internal/md5.ts +170 -0
- package/src/crypto/internal/webCrypto.ts +150 -0
- package/src/encoding/Base64Url.ts +32 -5
- package/src/encoding/Csv.ts +1298 -0
- package/src/encoding/Hex.ts +3 -2
- package/src/encoding/Ndjson.ts +6 -5
- package/src/encoding/SchemaBinary.ts +40 -4
- package/src/encoding/Sse.ts +5 -3
- package/src/encoding/Toml.ts +85 -20
- 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 +347 -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 +54 -20
- package/src/eventlog/EventLogServerEncrypted.ts +1135 -67
- package/src/eventlog/EventLogServerUnencrypted.ts +19 -2
- package/src/eventlog/EventLogSessionAuth.ts +82 -70
- package/src/eventlog/EventRow.ts +12 -3
- package/src/eventlog/SqlEventJournal.ts +2 -2
- 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/identityRootSecretDerivation.ts +93 -123
- package/src/eventlog/internal/remoteCompaction.ts +92 -0
- package/src/graphql/GraphQLClient.ts +3 -1
- package/src/graphql/GraphQLClientError.ts +15 -22
- package/src/graphql/GraphQLProtocol.ts +12 -3
- package/src/http/Cookies.ts +281 -1
- package/src/http/FetchHttpClient.ts +88 -16
- package/src/http/HttpClient.ts +299 -33
- package/src/http/HttpClientRequest.ts +12 -9
- package/src/http/HttpClientResponse.ts +3 -2
- package/src/http/HttpMethod.ts +10 -2
- package/src/http/HttpServerRequest.ts +76 -53
- package/src/http/HttpServerResponse.ts +3 -2
- package/src/http/HttpTraceContext.ts +7 -4
- package/src/http/ProblemDetails.ts +149 -0
- package/src/http/index.ts +6 -0
- package/src/http/internal/decompression.ts +4 -4
- package/src/http/internal/mimeTypes.ts +4 -1
- package/src/http/internal/urlParams.ts +8 -0
- package/src/http-api/HttpApiBuilder.ts +24 -12
- package/src/http-api/HttpApiClient.ts +67 -1
- package/src/http-api/HttpApiEndpoint.ts +14 -5
- package/src/http-api/HttpApiError.ts +250 -0
- package/src/http-api/HttpApiMiddleware.ts +95 -1
- package/src/http-api/HttpApiSchema.ts +106 -15
- package/src/index.ts +6 -6
- package/src/internal/dateTime.ts +54 -24
- package/src/internal/effect.ts +40 -18
- package/src/internal/glob.ts +952 -0
- package/src/internal/graphql.ts +27 -9
- package/src/internal/graphqlHeaders.ts +13 -0
- package/src/internal/matcher.ts +17 -0
- package/src/internal/persistence.ts +11 -0
- package/src/internal/rcRef.ts +4 -1
- package/src/internal/request.ts +51 -58
- package/src/internal/schema/fromJsonSchemaDocument.ts +11 -10
- package/src/internal/schema/toCodeDocument.ts +7 -3
- 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/jose/JoseError.ts +329 -0
- package/src/jose/Jwe.ts +196 -0
- package/src/jose/Jwk.ts +777 -0
- package/src/jose/Jwks.ts +418 -0
- package/src/jose/Jws.ts +312 -0
- package/src/jose/Jwt.ts +493 -0
- package/src/jose/index.ts +58 -0
- package/src/jose/internal/compact.ts +195 -0
- package/src/net/Host.ts +5 -10
- package/src/observability/Otlp.ts +21 -4
- package/src/observability/OtlpResource.ts +9 -1
- package/src/observability/OtlpSerialization.ts +13 -5
- package/src/observability/internal/otlpProtobuf.ts +6 -6
- package/src/observability/internal/protobuf.ts +10 -0
- package/src/persistence/CircuitBreaker.ts +113 -48
- package/src/persistence/KeyValueStore.ts +219 -22
- package/src/persistence/PersistedQueue.ts +128 -59
- package/src/persistence/Persistence.ts +20 -13
- package/src/persistence/RateLimiter.ts +84 -15
- package/src/persistence/index.ts +1 -1
- package/src/process/ChildProcess.ts +255 -260
- package/src/process/ChildProcessSpawner.ts +5 -0
- package/src/process/CommandLine.ts +630 -0
- package/src/process/index.ts +6 -0
- package/src/reactivity/Atom.ts +5 -5
- package/src/reactivity/AtomRegistry.ts +20 -9
- package/src/rpc/Rpc.ts +3 -1
- package/src/rpc/RpcClient.ts +94 -38
- package/src/rpc/RpcMessage.ts +13 -3
- package/src/rpc/RpcSerialization.ts +3 -0
- package/src/rpc/RpcServer.ts +176 -78
- package/src/schema/Model.ts +26 -3
- package/src/sql/Migrator.ts +38 -80
- package/src/sql/MigratorFileSystem.ts +71 -0
- package/src/sql/SqlClient.ts +45 -24
- package/src/sql/Statement.ts +60 -29
- package/src/sql/index.ts +1 -1
- package/src/testing/index.ts +0 -6
- package/src/workflow/Workflow.ts +4 -0
- package/src/workflow/WorkflowEngine.ts +5 -0
- 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/sql/Migrator.ts
CHANGED
|
@@ -12,11 +12,9 @@
|
|
|
12
12
|
import * as Arr from "../Array.ts"
|
|
13
13
|
import * as Data from "../Data.ts"
|
|
14
14
|
import * as Effect from "../Effect.ts"
|
|
15
|
-
import {
|
|
16
|
-
import { pipe } from "../Function.ts"
|
|
15
|
+
import { identity, pipe } from "../Function.ts"
|
|
17
16
|
import * as Option from "../Option.ts"
|
|
18
17
|
import * as Order from "../Order.ts"
|
|
19
|
-
import { Path } from "../Path.ts"
|
|
20
18
|
import * as Client from "./SqlClient.ts"
|
|
21
19
|
import type { SqlError } from "./SqlError.ts"
|
|
22
20
|
|
|
@@ -101,13 +99,22 @@ export class MigrationError extends Data.TaggedError("MigrationError")<{
|
|
|
101
99
|
* migrations. ClickHouse runs without a transaction and records each migration
|
|
102
100
|
* only after it succeeds.
|
|
103
101
|
*
|
|
102
|
+
* **Details**
|
|
103
|
+
*
|
|
104
|
+
* `transformWrites` transforms only the effects that create the migrations
|
|
105
|
+
* table and insert into it, for clients such as ClickHouse that run row-less
|
|
106
|
+
* statements differently from queries. Reads of the migrations table and the
|
|
107
|
+
* migrations themselves are not transformed. It defaults to `identity`.
|
|
108
|
+
*
|
|
104
109
|
* @stability unstable
|
|
105
110
|
* @category constructors
|
|
106
111
|
* @since 4.0.0
|
|
107
112
|
*/
|
|
108
113
|
export const make = <RD = never>({
|
|
114
|
+
transformWrites = identity,
|
|
109
115
|
dumpSchema = () => Effect.void
|
|
110
116
|
}: {
|
|
117
|
+
transformWrites?: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
|
|
111
118
|
dumpSchema?: (
|
|
112
119
|
path: string,
|
|
113
120
|
migrationsTable: string
|
|
@@ -125,7 +132,7 @@ export const make = <RD = never>({
|
|
|
125
132
|
Effect.gen(function*() {
|
|
126
133
|
const sql = yield* Client.SqlClient
|
|
127
134
|
|
|
128
|
-
const
|
|
135
|
+
const createMigrationsTable = transformWrites(sql.onDialectOrElse({
|
|
129
136
|
mssql: () =>
|
|
130
137
|
sql`IF OBJECT_ID(N'${sql.literal(table)}', N'U') IS NULL
|
|
131
138
|
CREATE TABLE ${sql(table)} (
|
|
@@ -149,14 +156,25 @@ export const make = <RD = never>({
|
|
|
149
156
|
) ENGINE = MergeTree
|
|
150
157
|
ORDER BY migration_id`,
|
|
151
158
|
pg: () =>
|
|
152
|
-
|
|
153
|
-
migrationsTableExists(sql, table),
|
|
154
|
-
(exists) =>
|
|
155
|
-
exists ? Effect.void : Effect.asVoid(sql`CREATE TABLE ${sql(table)} (
|
|
159
|
+
sql`CREATE TABLE ${sql(table)} (
|
|
156
160
|
migration_id integer primary key,
|
|
157
161
|
created_at timestamp with time zone not null default now(),
|
|
158
162
|
name text not null
|
|
159
|
-
)
|
|
163
|
+
)`,
|
|
164
|
+
orElse: () =>
|
|
165
|
+
sql`CREATE TABLE IF NOT EXISTS ${sql(table)} (
|
|
166
|
+
migration_id integer PRIMARY KEY NOT NULL,
|
|
167
|
+
created_at datetime NOT NULL DEFAULT current_timestamp,
|
|
168
|
+
name VARCHAR(255) NOT NULL
|
|
169
|
+
)`
|
|
170
|
+
}))
|
|
171
|
+
|
|
172
|
+
const ensureMigrationsTable = sql.onDialectOrElse({
|
|
173
|
+
pg: () =>
|
|
174
|
+
Effect.flatMap(
|
|
175
|
+
migrationsTableExists(sql, table),
|
|
176
|
+
(exists) =>
|
|
177
|
+
exists ? Effect.void : Effect.asVoid(createMigrationsTable).pipe(
|
|
160
178
|
Effect.catch((error) =>
|
|
161
179
|
Effect.flatMap(
|
|
162
180
|
migrationsTableExists(sql, table),
|
|
@@ -165,22 +183,19 @@ ORDER BY migration_id`,
|
|
|
165
183
|
)
|
|
166
184
|
)
|
|
167
185
|
),
|
|
168
|
-
orElse: () =>
|
|
169
|
-
sql`CREATE TABLE IF NOT EXISTS ${sql(table)} (
|
|
170
|
-
migration_id integer PRIMARY KEY NOT NULL,
|
|
171
|
-
created_at datetime NOT NULL DEFAULT current_timestamp,
|
|
172
|
-
name VARCHAR(255) NOT NULL
|
|
173
|
-
)`
|
|
186
|
+
orElse: () => createMigrationsTable
|
|
174
187
|
})
|
|
175
188
|
|
|
176
189
|
const insertMigrations = (
|
|
177
|
-
rows:
|
|
190
|
+
rows: Arr.NonEmptyReadonlyArray<[id: number, name: string]>
|
|
178
191
|
) =>
|
|
179
|
-
|
|
180
|
-
sql
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
192
|
+
transformWrites(
|
|
193
|
+
sql`INSERT INTO ${sql(table)} ${
|
|
194
|
+
sql.insert(
|
|
195
|
+
Arr.map(rows, ([migration_id, name]) => ({ migration_id, name }))
|
|
196
|
+
)
|
|
197
|
+
}`.withoutTransform
|
|
198
|
+
)
|
|
184
199
|
|
|
185
200
|
const latestMigration = Effect.map(
|
|
186
201
|
sql<{ migration_id: number; name: string; created_at: Date }>`SELECT migration_id, name, created_at FROM ${
|
|
@@ -287,9 +302,9 @@ ORDER BY migration_id`,
|
|
|
287
302
|
}
|
|
288
303
|
|
|
289
304
|
// rows recorded up front are only rolled back inside a transaction
|
|
290
|
-
if (transactional && required
|
|
305
|
+
if (transactional && Arr.isArrayNonEmpty(required)) {
|
|
291
306
|
yield* pipe(
|
|
292
|
-
insertMigrations(
|
|
307
|
+
insertMigrations(Arr.map(required, ([id, name]) => [id, name])),
|
|
293
308
|
Effect.mapError((error): MigrationError | SqlError =>
|
|
294
309
|
isConstraintConflict(error)
|
|
295
310
|
? new MigrationError({
|
|
@@ -436,60 +451,3 @@ export const fromRecord = (migrations: Record<string, Effect.Effect<void, unknow
|
|
|
436
451
|
Arr.sort(migrationOrder),
|
|
437
452
|
Effect.succeed
|
|
438
453
|
)
|
|
439
|
-
|
|
440
|
-
/**
|
|
441
|
-
* Creates a migration loader that reads a directory with `FileSystem`, imports
|
|
442
|
-
* files named `<id>_<name>.js`, `<id>_<name>.ts`,
|
|
443
|
-
* `<id>_<name>.mjs`, or `<id>_<name>.mts`, and sorts migrations by id.
|
|
444
|
-
*
|
|
445
|
-
* **Details**
|
|
446
|
-
*
|
|
447
|
-
* Requires a `Path` service appropriate for the migration directory's path
|
|
448
|
-
* syntax. On Windows, prefer a platform-aware implementation such as
|
|
449
|
-
* `NodePath.layer`; the core `Path.layer` uses POSIX semantics and does not
|
|
450
|
-
* preserve Windows drive-letter paths.
|
|
451
|
-
*
|
|
452
|
-
* @stability unstable
|
|
453
|
-
* @category loaders
|
|
454
|
-
* @since 4.0.0
|
|
455
|
-
*/
|
|
456
|
-
export const fromFileSystem: (directory: string) => Loader<FileSystem | Path> = Effect.fnUntraced(function*(directory) {
|
|
457
|
-
const Fs = yield* FileSystem
|
|
458
|
-
const path = yield* Path
|
|
459
|
-
const files = yield* Effect.mapError(
|
|
460
|
-
Fs.readDirectory(directory),
|
|
461
|
-
(cause) =>
|
|
462
|
-
new MigrationError({
|
|
463
|
-
kind: "Failed",
|
|
464
|
-
cause,
|
|
465
|
-
message: "Failed to read migrations directory"
|
|
466
|
-
})
|
|
467
|
-
)
|
|
468
|
-
return files
|
|
469
|
-
.map((file) => Option.fromNullishOr(file.match(/^(?:.*\/)?(\d+)_([^.]+)\.(js|ts|mjs|mts)$/)))
|
|
470
|
-
.flatMap(
|
|
471
|
-
Option.match({
|
|
472
|
-
onNone: () => [],
|
|
473
|
-
onSome: ([basename, id, name]): ReadonlyArray<ResolvedMigration> =>
|
|
474
|
-
[
|
|
475
|
-
[
|
|
476
|
-
Number(id),
|
|
477
|
-
name,
|
|
478
|
-
// `import` needs a file URL: on Windows an absolute path such as
|
|
479
|
-
// `D:\migrations\1_init.ts` is rejected by the ESM loader. `orDie` keeps the
|
|
480
|
-
// failure a defect so `loadMigration` reports it as an import error.
|
|
481
|
-
Effect.flatMap(Effect.orDie(path.toFileUrl(path.join(directory, basename))), (url) =>
|
|
482
|
-
Effect.promise(
|
|
483
|
-
() =>
|
|
484
|
-
import(
|
|
485
|
-
/* @vite-ignore */
|
|
486
|
-
/* webpackIgnore: true */
|
|
487
|
-
url.href
|
|
488
|
-
)
|
|
489
|
-
))
|
|
490
|
-
]
|
|
491
|
-
] as const
|
|
492
|
-
})
|
|
493
|
-
)
|
|
494
|
-
.sort(([a], [b]) => a - b);
|
|
495
|
-
})
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loads SQL migrations by reading a directory.
|
|
3
|
+
*
|
|
4
|
+
* @stability unstable
|
|
5
|
+
* @since 4.0.0
|
|
6
|
+
*/
|
|
7
|
+
import * as Effect from "../Effect.ts"
|
|
8
|
+
import { FileSystem } from "../FileSystem.ts"
|
|
9
|
+
import * as Option from "../Option.ts"
|
|
10
|
+
import { Path } from "../Path.ts"
|
|
11
|
+
import { type Loader, MigrationError, type ResolvedMigration } from "./Migrator.ts"
|
|
12
|
+
|
|
13
|
+
// Kept out of `Migrator.ts` and the `effect/sql` barrel: Metro rejects the
|
|
14
|
+
// non-literal `import()` below in any module it bundles.
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Creates a migration loader that reads a directory with `FileSystem`, imports
|
|
18
|
+
* files named `<id>_<name>.js`, `<id>_<name>.ts`,
|
|
19
|
+
* `<id>_<name>.mjs`, or `<id>_<name>.mts`, and sorts migrations by id.
|
|
20
|
+
*
|
|
21
|
+
* **Details**
|
|
22
|
+
*
|
|
23
|
+
* Requires a `Path` service appropriate for the migration directory's path
|
|
24
|
+
* syntax. On Windows, prefer a platform-aware implementation such as
|
|
25
|
+
* `NodePath.layer`; the core `Path.layer` uses POSIX semantics and does not
|
|
26
|
+
* preserve Windows drive-letter paths.
|
|
27
|
+
*
|
|
28
|
+
* @stability unstable
|
|
29
|
+
* @category loaders
|
|
30
|
+
* @since 4.0.0
|
|
31
|
+
*/
|
|
32
|
+
export const fromFileSystem: (directory: string) => Loader<FileSystem | Path> = Effect.fnUntraced(function*(directory) {
|
|
33
|
+
const Fs = yield* FileSystem
|
|
34
|
+
const path = yield* Path
|
|
35
|
+
const files = yield* Effect.mapError(
|
|
36
|
+
Fs.readDirectory(directory),
|
|
37
|
+
(cause) =>
|
|
38
|
+
new MigrationError({
|
|
39
|
+
kind: "Failed",
|
|
40
|
+
cause,
|
|
41
|
+
message: "Failed to read migrations directory"
|
|
42
|
+
})
|
|
43
|
+
)
|
|
44
|
+
return files
|
|
45
|
+
.map((file) => Option.fromNullishOr(file.match(/^(?:.*\/)?(\d+)_([^.]+)\.(js|ts|mjs|mts)$/)))
|
|
46
|
+
.flatMap(
|
|
47
|
+
Option.match({
|
|
48
|
+
onNone: () => [],
|
|
49
|
+
onSome: ([basename, id, name]): ReadonlyArray<ResolvedMigration> =>
|
|
50
|
+
[
|
|
51
|
+
[
|
|
52
|
+
Number(id),
|
|
53
|
+
name,
|
|
54
|
+
// `import` needs a file URL: on Windows an absolute path such as
|
|
55
|
+
// `D:\migrations\1_init.ts` is rejected by the ESM loader. `orDie` keeps the
|
|
56
|
+
// failure a defect so `loadMigration` reports it as an import error.
|
|
57
|
+
Effect.flatMap(Effect.orDie(path.toFileUrl(path.join(directory, basename))), (url) =>
|
|
58
|
+
Effect.promise(
|
|
59
|
+
() =>
|
|
60
|
+
import(
|
|
61
|
+
/* @vite-ignore */
|
|
62
|
+
/* webpackIgnore: true */
|
|
63
|
+
url.href
|
|
64
|
+
)
|
|
65
|
+
))
|
|
66
|
+
]
|
|
67
|
+
] as const
|
|
68
|
+
})
|
|
69
|
+
)
|
|
70
|
+
.sort(([a], [b]) => a - b);
|
|
71
|
+
})
|
package/src/sql/SqlClient.ts
CHANGED
|
@@ -21,7 +21,6 @@ import { hasProperty } from "../Predicate.ts"
|
|
|
21
21
|
import type * as Queue from "../Queue.ts"
|
|
22
22
|
import { type KeysInput, Reactivity } from "../reactivity/Reactivity.ts"
|
|
23
23
|
import type { ReadonlyRecord } from "../Record.ts"
|
|
24
|
-
import { UnhandledLogLevel } from "../References.ts"
|
|
25
24
|
import * as Scope from "../Scope.ts"
|
|
26
25
|
import * as Semaphore from "../Semaphore.ts"
|
|
27
26
|
import * as Stream from "../Stream.ts"
|
|
@@ -82,6 +81,10 @@ export interface SqlClient extends Constructor {
|
|
|
82
81
|
* client's, such as one that sets its isolation level, provide
|
|
83
82
|
* `BeginTransaction`.
|
|
84
83
|
*
|
|
84
|
+
* To retry serialization failures or deadlocks, wrap the outermost
|
|
85
|
+
* `withTransaction` in `Effect.retry`. Each attempt starts a fresh
|
|
86
|
+
* transaction and re-runs the whole effect, including `COMMIT`.
|
|
87
|
+
*
|
|
85
88
|
* **Gotchas**
|
|
86
89
|
*
|
|
87
90
|
* Deferred invalidations run individually after the commit and don't join an
|
|
@@ -89,6 +92,35 @@ export interface SqlClient extends Constructor {
|
|
|
89
92
|
* the transaction's context defers, and a fiber that outlives the
|
|
90
93
|
* transaction can't defer through it, as with `afterCommit`. Transactions
|
|
91
94
|
* that don't go through `makeWithTransaction` invalidate immediately.
|
|
95
|
+
*
|
|
96
|
+
* Retrying a nested transaction only retries its savepoint, which can't
|
|
97
|
+
* recover an outer transaction the database has aborted. Since a retried
|
|
98
|
+
* effect runs more than once, keep non-transactional side effects in
|
|
99
|
+
* `afterCommit`, which discards the callbacks of a failed attempt but
|
|
100
|
+
* doesn't guarantee they run exactly once. Don't retry `ConnectionError`: a
|
|
101
|
+
* `COMMIT` that lost its connection may have committed, and retrying would
|
|
102
|
+
* apply its writes twice.
|
|
103
|
+
*
|
|
104
|
+
* **Example** (Retrying serialization failures and deadlocks)
|
|
105
|
+
*
|
|
106
|
+
* ```ts
|
|
107
|
+
* import { Effect, Schedule } from "effect"
|
|
108
|
+
* import { SqlClient } from "effect/sql"
|
|
109
|
+
*
|
|
110
|
+
* const program = Effect.gen(function*() {
|
|
111
|
+
* const sql = yield* SqlClient.SqlClient
|
|
112
|
+
* return yield* sql.withTransaction(
|
|
113
|
+
* sql`UPDATE accounts SET balance = balance - 10 WHERE id = 1`
|
|
114
|
+
* ).pipe(
|
|
115
|
+
* Effect.provideService(SqlClient.BeginTransaction, "BEGIN ISOLATION LEVEL SERIALIZABLE"),
|
|
116
|
+
* Effect.retry({
|
|
117
|
+
* while: (error) => error.reason._tag === "SerializationError" || error.reason._tag === "DeadlockError",
|
|
118
|
+
* times: 5,
|
|
119
|
+
* schedule: Schedule.exponential("10 millis").pipe(Schedule.jittered)
|
|
120
|
+
* })
|
|
121
|
+
* )
|
|
122
|
+
* })
|
|
123
|
+
* ```
|
|
92
124
|
*/
|
|
93
125
|
readonly withTransaction: <R, E, A>(
|
|
94
126
|
self: Effect.Effect<A, E, R>
|
|
@@ -207,9 +239,8 @@ export declare namespace SqlClient {
|
|
|
207
239
|
readonly spanAttributes: ReadonlyArray<readonly [string, unknown]>
|
|
208
240
|
readonly transactionService?: Context.Service<TransactionConnection, TransactionConnection.Service>
|
|
209
241
|
/**
|
|
210
|
-
* Whether the transaction control statements - `BEGIN`, `COMMIT
|
|
211
|
-
* `
|
|
212
|
-
* statement.
|
|
242
|
+
* Whether the transaction control statements - `BEGIN`, `COMMIT` and
|
|
243
|
+
* `SAVEPOINT` - can be prepared like any other statement.
|
|
213
244
|
*
|
|
214
245
|
* **Details**
|
|
215
246
|
*
|
|
@@ -217,6 +248,9 @@ export declare namespace SqlClient {
|
|
|
217
248
|
* prepare them stops parsing them again each time. Off by default,
|
|
218
249
|
* because several databases refuse to prepare transaction control at all;
|
|
219
250
|
* a driver has to say that its own does not.
|
|
251
|
+
*
|
|
252
|
+
* Rollbacks and savepoint releases always run unprepared, so a prepared
|
|
253
|
+
* statement the backend has dropped cannot stop cleanup.
|
|
220
254
|
*/
|
|
221
255
|
readonly prepareTransactionControls?: boolean | undefined
|
|
222
256
|
readonly beginTransaction?: string | undefined
|
|
@@ -275,20 +309,20 @@ export const make = Effect.fnUntraced(function*(options: SqlClient.MakeOptions)
|
|
|
275
309
|
const rollback = options.rollback ?? "ROLLBACK"
|
|
276
310
|
const rollbackSavepoint = options.rollbackSavepoint ?? ((name: string) => `ROLLBACK TO SAVEPOINT ${name}`)
|
|
277
311
|
const transactionAcquirer = options.transactionAcquirer ?? options.acquirer
|
|
312
|
+
const unprepared = (conn: Connection.Connection, sql: string) => conn.executeUnprepared(sql, [], undefined)
|
|
278
313
|
const control = options.prepareTransactionControls === true
|
|
279
314
|
? (conn: Connection.Connection, sql: string) => conn.execute(sql, [], undefined)
|
|
280
|
-
:
|
|
315
|
+
: unprepared
|
|
281
316
|
const isTransaction = options.isTransaction
|
|
282
317
|
const cleanup = isTransaction
|
|
283
|
-
? (conn: Connection.Connection, sql: string) => isTransaction(conn) ?
|
|
284
|
-
:
|
|
318
|
+
? (conn: Connection.Connection, sql: string) => isTransaction(conn) ? unprepared(conn, sql) : Effect.void
|
|
319
|
+
: unprepared
|
|
285
320
|
const withTransaction = makeWithTransaction({
|
|
286
321
|
transactionService,
|
|
287
322
|
spanAttributes: options.spanAttributes,
|
|
288
323
|
acquireConnection: (restore) => restore(transactionAcquirer!),
|
|
289
324
|
// Unlike the client's own, a provided statement isn't fixed, so it isn't prepared.
|
|
290
|
-
begin: (conn, statement) =>
|
|
291
|
-
statement === undefined ? control(conn, beginTransaction) : conn.executeUnprepared(statement, [], undefined),
|
|
325
|
+
begin: (conn, statement) => statement === undefined ? control(conn, beginTransaction) : unprepared(conn, statement),
|
|
292
326
|
savepoint: (conn, id) => control(conn, savepoint(`effect_sql_${id}`)),
|
|
293
327
|
releaseSavepoint: releaseSavepoint
|
|
294
328
|
? (conn, id) => cleanup(conn, releaseSavepoint(`effect_sql_${id}`))
|
|
@@ -430,13 +464,7 @@ export const makeSqliteAcquirers = <C extends Connection.Connection>(options: {
|
|
|
430
464
|
})
|
|
431
465
|
})
|
|
432
466
|
|
|
433
|
-
const lease = Effect.uninterruptibleMask((restore) =>
|
|
434
|
-
Effect.flatMap(Effect.scope, (scope) =>
|
|
435
|
-
restore(semaphore.take(1)).pipe(
|
|
436
|
-
Effect.andThen(Scope.addFinalizer(scope, semaphore.release(1))),
|
|
437
|
-
Effect.andThen(available)
|
|
438
|
-
))
|
|
439
|
-
)
|
|
467
|
+
const lease = Effect.uninterruptibleMask((restore) => Effect.andThen(restore(semaphore.takeScoped(1)), available))
|
|
440
468
|
|
|
441
469
|
return {
|
|
442
470
|
acquirer: lease,
|
|
@@ -488,14 +516,7 @@ interface AfterCommitBuffer {
|
|
|
488
516
|
const afterCommitBuffers = new WeakMap<object, AfterCommitBuffer>()
|
|
489
517
|
|
|
490
518
|
const runAfterCommit = <R>(effect: Effect.Effect<void, never, R>): Effect.Effect<void, never, R> =>
|
|
491
|
-
Effect.
|
|
492
|
-
Effect.withFiber((fiber) => {
|
|
493
|
-
const unhandledLogLevel = fiber.getRef(UnhandledLogLevel)
|
|
494
|
-
if (unhandledLogLevel) {
|
|
495
|
-
return Effect.logWithLevel(unhandledLogLevel)("Unhandled error in SqlClient.afterCommit callback", cause)
|
|
496
|
-
}
|
|
497
|
-
return Effect.void
|
|
498
|
-
}))
|
|
519
|
+
Effect.ignoreCause(effect, { log: "Unhandled", message: "Unhandled error in SqlClient.afterCommit callback" })
|
|
499
520
|
|
|
500
521
|
const makeAfterCommit =
|
|
501
522
|
(transactionService: Context.Key<any, any>) =>
|
package/src/sql/Statement.ts
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* @stability unstable
|
|
12
12
|
* @since 4.0.0
|
|
13
13
|
*/
|
|
14
|
+
import type * as Arr from "../Array.ts"
|
|
14
15
|
import { Clock } from "../Clock.ts"
|
|
15
16
|
import * as Context from "../Context.ts"
|
|
16
17
|
import * as Effect from "../Effect.ts"
|
|
@@ -26,7 +27,41 @@ import * as Tracer from "../Tracer.ts"
|
|
|
26
27
|
import type { Acquirer, Borrower, Connection, Row } from "./SqlConnection.ts"
|
|
27
28
|
import type { SqlError } from "./SqlError.ts"
|
|
28
29
|
|
|
29
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Runtime type identifier for SQL `Fragment` values.
|
|
32
|
+
*
|
|
33
|
+
* @stability unstable
|
|
34
|
+
* @category Type ID
|
|
35
|
+
* @since 4.1.1
|
|
36
|
+
*/
|
|
37
|
+
export const FragmentTypeId: unique symbol = Symbol.for("~effect/sql/Statement/Fragment")
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Type of the unique symbol used to brand SQL `Fragment` values.
|
|
41
|
+
*
|
|
42
|
+
* @stability unstable
|
|
43
|
+
* @category Type ID
|
|
44
|
+
* @since 4.1.1
|
|
45
|
+
*/
|
|
46
|
+
export type FragmentTypeId = typeof FragmentTypeId
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Runtime type identifier for SQL `Segment` values.
|
|
50
|
+
*
|
|
51
|
+
* @stability unstable
|
|
52
|
+
* @category Type ID
|
|
53
|
+
* @since 4.1.1
|
|
54
|
+
*/
|
|
55
|
+
export const SegmentTypeId: unique symbol = Symbol.for("~effect/sql/Statement/Segment")
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Type of the unique symbol used to brand SQL `Segment` values.
|
|
59
|
+
*
|
|
60
|
+
* @stability unstable
|
|
61
|
+
* @category Type ID
|
|
62
|
+
* @since 4.1.1
|
|
63
|
+
*/
|
|
64
|
+
export type SegmentTypeId = typeof SegmentTypeId
|
|
30
65
|
|
|
31
66
|
/**
|
|
32
67
|
* Composable SQL fragment represented as low-level segments that can be
|
|
@@ -37,7 +72,7 @@ const FragmentTypeId = "~effect/sql/Statement/Fragment"
|
|
|
37
72
|
* @since 4.0.0
|
|
38
73
|
*/
|
|
39
74
|
export interface Fragment {
|
|
40
|
-
readonly [FragmentTypeId]:
|
|
75
|
+
readonly [FragmentTypeId]: FragmentTypeId
|
|
41
76
|
readonly segments: ReadonlyArray<Segment>
|
|
42
77
|
}
|
|
43
78
|
|
|
@@ -146,7 +181,7 @@ export const isFragment = (u: unknown): u is Fragment => hasProperty(u, Fragment
|
|
|
146
181
|
export const isCustom = <A extends Custom<any, any, any, any>>(
|
|
147
182
|
kind: A["kind"]
|
|
148
183
|
) =>
|
|
149
|
-
(u: unknown): u is A =>
|
|
184
|
+
(u: unknown): u is A => isSegment(u) && u._tag === "Custom" && u.kind === kind
|
|
150
185
|
|
|
151
186
|
/**
|
|
152
187
|
* Union of low-level segment types that make up a SQL `Fragment`.
|
|
@@ -174,6 +209,7 @@ export type Segment =
|
|
|
174
209
|
* @since 4.0.0
|
|
175
210
|
*/
|
|
176
211
|
export interface Literal {
|
|
212
|
+
readonly [SegmentTypeId]: SegmentTypeId
|
|
177
213
|
readonly _tag: "Literal"
|
|
178
214
|
readonly value: string
|
|
179
215
|
readonly params?: ReadonlyArray<unknown> | undefined
|
|
@@ -188,6 +224,7 @@ export interface Literal {
|
|
|
188
224
|
* @since 4.0.0
|
|
189
225
|
*/
|
|
190
226
|
export const literal = (value: string, params?: ReadonlyArray<unknown> | undefined): Literal => ({
|
|
227
|
+
[SegmentTypeId]: SegmentTypeId,
|
|
191
228
|
_tag: "Literal",
|
|
192
229
|
value,
|
|
193
230
|
params
|
|
@@ -201,6 +238,7 @@ export const literal = (value: string, params?: ReadonlyArray<unknown> | undefin
|
|
|
201
238
|
* @since 4.0.0
|
|
202
239
|
*/
|
|
203
240
|
export interface Identifier {
|
|
241
|
+
readonly [SegmentTypeId]: SegmentTypeId
|
|
204
242
|
readonly _tag: "Identifier"
|
|
205
243
|
readonly value: string
|
|
206
244
|
}
|
|
@@ -214,6 +252,7 @@ export interface Identifier {
|
|
|
214
252
|
* @since 4.0.0
|
|
215
253
|
*/
|
|
216
254
|
export const identifier = (value: string): Identifier => ({
|
|
255
|
+
[SegmentTypeId]: SegmentTypeId,
|
|
217
256
|
_tag: "Identifier",
|
|
218
257
|
value
|
|
219
258
|
})
|
|
@@ -227,6 +266,7 @@ export const identifier = (value: string): Identifier => ({
|
|
|
227
266
|
* @since 4.0.0
|
|
228
267
|
*/
|
|
229
268
|
export interface Parameter {
|
|
269
|
+
readonly [SegmentTypeId]: SegmentTypeId
|
|
230
270
|
readonly _tag: "Parameter"
|
|
231
271
|
readonly value: unknown
|
|
232
272
|
}
|
|
@@ -239,6 +279,7 @@ export interface Parameter {
|
|
|
239
279
|
* @since 4.0.0
|
|
240
280
|
*/
|
|
241
281
|
export const parameter = (value: unknown): Parameter => ({
|
|
282
|
+
[SegmentTypeId]: SegmentTypeId,
|
|
242
283
|
_tag: "Parameter",
|
|
243
284
|
value
|
|
244
285
|
})
|
|
@@ -252,6 +293,7 @@ export const parameter = (value: unknown): Parameter => ({
|
|
|
252
293
|
* @since 4.0.0
|
|
253
294
|
*/
|
|
254
295
|
export interface ArrayHelper {
|
|
296
|
+
readonly [SegmentTypeId]: SegmentTypeId
|
|
255
297
|
readonly _tag: "ArrayHelper"
|
|
256
298
|
readonly value: ReadonlyArray<unknown | Fragment>
|
|
257
299
|
}
|
|
@@ -264,6 +306,7 @@ export interface ArrayHelper {
|
|
|
264
306
|
* @since 4.0.0
|
|
265
307
|
*/
|
|
266
308
|
export const arrayHelper = (value: ReadonlyArray<unknown | Fragment>): ArrayHelper => ({
|
|
309
|
+
[SegmentTypeId]: SegmentTypeId,
|
|
267
310
|
_tag: "ArrayHelper",
|
|
268
311
|
value
|
|
269
312
|
})
|
|
@@ -277,8 +320,9 @@ export const arrayHelper = (value: ReadonlyArray<unknown | Fragment>): ArrayHelp
|
|
|
277
320
|
* @since 4.0.0
|
|
278
321
|
*/
|
|
279
322
|
export interface RecordInsertHelper {
|
|
323
|
+
readonly [SegmentTypeId]: SegmentTypeId
|
|
280
324
|
readonly _tag: "RecordInsertHelper"
|
|
281
|
-
readonly value:
|
|
325
|
+
readonly value: Arr.NonEmptyReadonlyArray<Record<string, unknown>>
|
|
282
326
|
/**
|
|
283
327
|
* @internal
|
|
284
328
|
*/
|
|
@@ -287,6 +331,7 @@ export interface RecordInsertHelper {
|
|
|
287
331
|
}
|
|
288
332
|
|
|
289
333
|
const RecordInsertHelperProto = {
|
|
334
|
+
[SegmentTypeId]: SegmentTypeId,
|
|
290
335
|
_tag: "RecordInsertHelper" as const,
|
|
291
336
|
returning(this: RecordInsertHelper, sql: string | Identifier | Fragment) {
|
|
292
337
|
const self = Object.create(Object.getPrototypeOf(this))
|
|
@@ -305,7 +350,7 @@ const RecordInsertHelperProto = {
|
|
|
305
350
|
* @since 4.0.0
|
|
306
351
|
*/
|
|
307
352
|
export const recordInsertHelper = (
|
|
308
|
-
value:
|
|
353
|
+
value: Arr.NonEmptyReadonlyArray<Record<string, unknown>>
|
|
309
354
|
): RecordInsertHelper =>
|
|
310
355
|
Object.assign(Object.create(RecordInsertHelperProto), {
|
|
311
356
|
value,
|
|
@@ -321,8 +366,9 @@ export const recordInsertHelper = (
|
|
|
321
366
|
* @since 4.0.0
|
|
322
367
|
*/
|
|
323
368
|
export interface RecordUpdateHelper {
|
|
369
|
+
readonly [SegmentTypeId]: SegmentTypeId
|
|
324
370
|
readonly _tag: "RecordUpdateHelper"
|
|
325
|
-
readonly value:
|
|
371
|
+
readonly value: Arr.NonEmptyReadonlyArray<Record<string, unknown>>
|
|
326
372
|
readonly alias: string
|
|
327
373
|
/**
|
|
328
374
|
* @internal
|
|
@@ -345,7 +391,7 @@ const RecordUpdateHelperProto = {
|
|
|
345
391
|
* @since 4.0.0
|
|
346
392
|
*/
|
|
347
393
|
export const recordUpdateHelper = (
|
|
348
|
-
value:
|
|
394
|
+
value: Arr.NonEmptyReadonlyArray<Record<string, unknown>>,
|
|
349
395
|
alias: string
|
|
350
396
|
): RecordUpdateHelper =>
|
|
351
397
|
Object.assign(Object.create(RecordUpdateHelperProto), {
|
|
@@ -363,6 +409,7 @@ export const recordUpdateHelper = (
|
|
|
363
409
|
* @since 4.0.0
|
|
364
410
|
*/
|
|
365
411
|
export interface RecordUpdateHelperSingle {
|
|
412
|
+
readonly [SegmentTypeId]: SegmentTypeId
|
|
366
413
|
readonly _tag: "RecordUpdateHelperSingle"
|
|
367
414
|
readonly value: Record<string, unknown>
|
|
368
415
|
readonly omit: ReadonlyArray<string>
|
|
@@ -410,6 +457,7 @@ export interface Custom<
|
|
|
410
457
|
B = void,
|
|
411
458
|
C = void
|
|
412
459
|
> {
|
|
460
|
+
readonly [SegmentTypeId]: SegmentTypeId
|
|
413
461
|
readonly _tag: "Custom"
|
|
414
462
|
readonly kind: T
|
|
415
463
|
readonly paramA: A
|
|
@@ -432,7 +480,7 @@ export const custom = <C extends Custom<any, any, any, any>>(
|
|
|
432
480
|
paramA: C["paramA"],
|
|
433
481
|
paramB: C["paramB"],
|
|
434
482
|
paramC: C["paramC"]
|
|
435
|
-
): C => ({ _tag: "Custom", kind, paramA, paramB, paramC } as C)
|
|
483
|
+
): C => ({ [SegmentTypeId]: SegmentTypeId, _tag: "Custom", kind, paramA, paramB, paramC } as C)
|
|
436
484
|
|
|
437
485
|
/**
|
|
438
486
|
* Names the primitive value categories recognized by SQL statement helpers and
|
|
@@ -502,7 +550,7 @@ export interface Constructor {
|
|
|
502
550
|
|
|
503
551
|
readonly insert: {
|
|
504
552
|
(
|
|
505
|
-
value:
|
|
553
|
+
value: Arr.NonEmptyReadonlyArray<Record<string, unknown>>
|
|
506
554
|
): RecordInsertHelper
|
|
507
555
|
(value: Record<string, unknown>): RecordInsertHelper
|
|
508
556
|
}
|
|
@@ -524,7 +572,7 @@ export interface Constructor {
|
|
|
524
572
|
* transforms.
|
|
525
573
|
*/
|
|
526
574
|
readonly updateValues: (
|
|
527
|
-
value:
|
|
575
|
+
value: Arr.NonEmptyReadonlyArray<Record<string, unknown>>,
|
|
528
576
|
alias: string
|
|
529
577
|
) => RecordUpdateHelper
|
|
530
578
|
|
|
@@ -631,7 +679,7 @@ export const make = (
|
|
|
631
679
|
in: in_,
|
|
632
680
|
insert(value: any) {
|
|
633
681
|
return recordInsertHelper(
|
|
634
|
-
Array.isArray(value) ? value : [value]
|
|
682
|
+
Array.isArray(value) ? value as Arr.NonEmptyArray<Record<string, unknown>> : [value]
|
|
635
683
|
)
|
|
636
684
|
},
|
|
637
685
|
update(value: any, omit: any) {
|
|
@@ -1612,24 +1660,7 @@ const withStatement = <A, X, E, R>(
|
|
|
1612
1660
|
)
|
|
1613
1661
|
})
|
|
1614
1662
|
|
|
1615
|
-
const isSegment = (u: unknown): u is Segment =>
|
|
1616
|
-
if (!hasProperty(u, "_tag")) {
|
|
1617
|
-
return false
|
|
1618
|
-
}
|
|
1619
|
-
switch (u._tag) {
|
|
1620
|
-
case "Literal":
|
|
1621
|
-
case "Parameter":
|
|
1622
|
-
case "ArrayHelper":
|
|
1623
|
-
case "RecordInsertHelper":
|
|
1624
|
-
case "RecordUpdateHelper":
|
|
1625
|
-
case "RecordUpdateHelperSingle":
|
|
1626
|
-
case "Identifier":
|
|
1627
|
-
case "Custom":
|
|
1628
|
-
return true
|
|
1629
|
-
default:
|
|
1630
|
-
return false
|
|
1631
|
-
}
|
|
1632
|
-
}
|
|
1663
|
+
const isSegment = (u: unknown): u is Segment => hasProperty(u, SegmentTypeId)
|
|
1633
1664
|
|
|
1634
1665
|
function convertLiteralOrFragment(clause: string | Fragment): Array<Segment> {
|
|
1635
1666
|
if (typeof clause === "string") {
|
package/src/sql/index.ts
CHANGED
package/src/testing/index.ts
CHANGED
|
@@ -17,12 +17,6 @@ export * as TestClock from "./TestClock.ts"
|
|
|
17
17
|
*/
|
|
18
18
|
export * as TestConsole from "./TestConsole.ts"
|
|
19
19
|
|
|
20
|
-
/**
|
|
21
|
-
* @stability unstable
|
|
22
|
-
* @since 4.0.0
|
|
23
|
-
*/
|
|
24
|
-
export * as TestCrypto from "./TestCrypto.ts"
|
|
25
|
-
|
|
26
20
|
/**
|
|
27
21
|
* @stability unstable
|
|
28
22
|
* @since 4.0.0
|
package/src/workflow/Workflow.ts
CHANGED
|
@@ -88,6 +88,10 @@ export interface Workflow<
|
|
|
88
88
|
* nor gets interrupted with it. The cluster engine retains the parent for
|
|
89
89
|
* observability.
|
|
90
90
|
*
|
|
91
|
+
* Inside a workflow, an awaited child that is interrupted fails the parent
|
|
92
|
+
* with a defect rather than an interrupt, so the parent can recover with
|
|
93
|
+
* `Effect.catchDefect` or `Effect.exit`.
|
|
94
|
+
*
|
|
91
95
|
* **Gotchas**
|
|
92
96
|
*
|
|
93
97
|
* Do not await a detached execution later. Executing the same payload joins
|
|
@@ -583,6 +583,11 @@ export const makeUnsafe = (options: Encoded): WorkflowEngine["Service"] =>
|
|
|
583
583
|
if (wrapped._tag === "Suspended") {
|
|
584
584
|
return yield* Workflow.suspend(parentInstance.value)
|
|
585
585
|
}
|
|
586
|
+
// A child's interrupt is an outcome for the parent, not an interrupt of
|
|
587
|
+
// the parent's run, so surface it as a defect the parent can observe.
|
|
588
|
+
if (Exit.isFailure(wrapped.exit) && Cause.hasInterruptsOnly(wrapped.exit.cause)) {
|
|
589
|
+
return yield* Effect.die(`${self._tag}.execute: execution "${executionId}" was interrupted`)
|
|
590
|
+
}
|
|
586
591
|
return yield* wrapped.exit
|
|
587
592
|
}
|
|
588
593
|
|