effect 4.0.0-beta.103 → 4.0.0-beta.104
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/dist/Cache.js +1 -1
- package/dist/Cache.js.map +1 -1
- package/dist/Channel.d.ts +1 -1
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js.map +1 -1
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +28 -7
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +2 -1
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Context.d.ts +2 -2
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js.map +1 -1
- package/dist/Crypto.d.ts.map +1 -1
- package/dist/Crypto.js +13 -5
- package/dist/Crypto.js.map +1 -1
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +12 -1
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +132 -14
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +38 -0
- package/dist/Effect.js.map +1 -1
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +10 -2
- package/dist/Equal.js.map +1 -1
- package/dist/ExecutionPlan.d.ts +73 -0
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/ExecutionPlan.js +1 -1
- package/dist/ExecutionPlan.js.map +1 -1
- package/dist/FiberSet.js +1 -1
- package/dist/FileSystem.d.ts +2 -2
- package/dist/Function.d.ts +4 -3
- package/dist/Function.d.ts.map +1 -1
- package/dist/Function.js +5 -5
- package/dist/Function.js.map +1 -1
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +11 -10
- package/dist/Iterable.js.map +1 -1
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +7 -5
- package/dist/Layer.js.map +1 -1
- package/dist/Schedule.d.ts +8 -8
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +4 -4
- package/dist/Schedule.js.map +1 -1
- package/dist/Schema.d.ts +32 -32
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +23 -18
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +3 -3
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +47 -31
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +35 -53
- package/dist/SchemaParser.js.map +1 -1
- package/dist/ScopedCache.js +1 -1
- package/dist/ScopedCache.js.map +1 -1
- package/dist/Sink.d.ts +1 -1
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Stream.d.ts +27 -4
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +27 -2
- package/dist/Stream.js.map +1 -1
- package/dist/SynchronizedRef.js +1 -1
- package/dist/SynchronizedRef.js.map +1 -1
- package/dist/Terminal.js +1 -1
- package/dist/Terminal.js.map +1 -1
- package/dist/Tuple.d.ts +6 -4
- package/dist/Tuple.d.ts.map +1 -1
- package/dist/Tuple.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +0 -56
- package/dist/TxReentrantLock.d.ts.map +1 -1
- package/dist/TxReentrantLock.js +8 -8
- package/dist/TxReentrantLock.js.map +1 -1
- package/dist/internal/dateTime.js +1 -1
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/executionPlan.js +51 -3
- package/dist/internal/executionPlan.js.map +1 -1
- package/dist/internal/hashMap.js +12 -8
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/matcher.js +1 -1
- package/dist/internal/matcher.js.map +1 -1
- package/dist/internal/schedule.js.map +1 -1
- package/dist/internal/schema/annotations.js +2 -0
- package/dist/internal/schema/annotations.js.map +1 -1
- package/dist/internal/schema/toArbitrary.js +1 -1
- package/dist/internal/schema/toArbitrary.js.map +1 -1
- package/dist/internal/trie.js +13 -3
- package/dist/internal/trie.js.map +1 -1
- package/dist/testing/TestClock.d.ts.map +1 -1
- package/dist/testing/TestClock.js +11 -1
- package/dist/testing/TestClock.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +1 -1
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +19 -19
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/Chat.js +1 -1
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +4 -2
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpSchema.d.ts +132 -132
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +8 -8
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.js +1 -1
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Prompt.d.ts +15 -3
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Prompt.js +6 -3
- package/dist/unstable/ai/Prompt.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +3 -3
- package/dist/unstable/cli/CliError.js +11 -11
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +9 -9
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +8 -6
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Param.d.ts +7 -5
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +15 -11
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js +31 -24
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/Prompt.d.ts.map +1 -1
- package/dist/unstable/cli/Prompt.js +31 -17
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/internal/ansi.js +2 -2
- package/dist/unstable/cli/internal/ansi.js.map +1 -1
- package/dist/unstable/cli/internal/command.d.ts +2 -2
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.js +10 -9
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/completions/bash.js +69 -9
- package/dist/unstable/cli/internal/completions/bash.js.map +1 -1
- package/dist/unstable/cli/internal/completions/descriptor.js +24 -18
- package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -1
- package/dist/unstable/cli/internal/completions/fish.js +5 -5
- package/dist/unstable/cli/internal/completions/fish.js.map +1 -1
- package/dist/unstable/cli/internal/help.d.ts.map +1 -1
- package/dist/unstable/cli/internal/help.js +4 -2
- package/dist/unstable/cli/internal/help.js.map +1 -1
- package/dist/unstable/cli/internal/parser.js +3 -3
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cli/internal/wizard.js +2 -2
- package/dist/unstable/cli/internal/wizard.js.map +1 -1
- package/dist/unstable/cluster/ClusterError.js +7 -7
- package/dist/unstable/cluster/ClusterError.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/MessageStorage.js +8 -1
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts +8 -0
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +12 -0
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.js +4 -2
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.d.ts +1 -2
- package/dist/unstable/cluster/RunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.js +7 -6
- package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +22 -4
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +1 -1
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceMap.js +2 -2
- package/dist/unstable/cluster/internal/resourceMap.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceRef.js +17 -0
- package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.js +7 -2
- package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
- package/dist/unstable/encoding/Ini.d.ts +20 -0
- package/dist/unstable/encoding/Ini.d.ts.map +1 -0
- package/dist/unstable/encoding/Ini.js +153 -0
- package/dist/unstable/encoding/Ini.js.map +1 -0
- package/dist/unstable/encoding/Msgpack.d.ts +2 -1
- package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
- package/dist/unstable/encoding/Msgpack.js +21 -7
- package/dist/unstable/encoding/Msgpack.js.map +1 -1
- package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
- package/dist/unstable/encoding/Ndjson.js +7 -1
- package/dist/unstable/encoding/Ndjson.js.map +1 -1
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.js +14 -23
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/encoding/Toml.d.ts +19 -0
- package/dist/unstable/encoding/Toml.d.ts.map +1 -0
- package/dist/unstable/encoding/Toml.js +434 -0
- package/dist/unstable/encoding/Toml.js.map +1 -0
- package/dist/unstable/encoding/Yaml.d.ts +19 -0
- package/dist/unstable/encoding/Yaml.d.ts.map +1 -0
- package/dist/unstable/encoding/Yaml.js +461 -0
- package/dist/unstable/encoding/Yaml.js.map +1 -0
- package/dist/unstable/encoding/index.d.ts +12 -0
- package/dist/unstable/encoding/index.d.ts.map +1 -1
- package/dist/unstable/encoding/index.js +12 -0
- package/dist/unstable/encoding/index.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventJournal.js +13 -5
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.js +1 -1
- package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.js +1 -4
- package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
- package/dist/unstable/http/FindMyWay/internal/queryString.d.ts +11 -0
- package/dist/unstable/http/FindMyWay/internal/queryString.d.ts.map +1 -0
- package/dist/unstable/http/FindMyWay/internal/queryString.js +259 -0
- package/dist/unstable/http/FindMyWay/internal/queryString.js.map +1 -0
- package/dist/unstable/http/FindMyWay/internal/router.d.ts +2 -0
- package/dist/unstable/http/FindMyWay/internal/router.d.ts.map +1 -0
- package/dist/unstable/http/FindMyWay/internal/router.js +665 -0
- package/dist/unstable/http/FindMyWay/internal/router.js.map +1 -0
- package/dist/unstable/http/FindMyWay.d.ts +33 -8
- package/dist/unstable/http/FindMyWay.d.ts.map +1 -1
- package/dist/unstable/http/FindMyWay.js +4 -7
- package/dist/unstable/http/FindMyWay.js.map +1 -1
- package/dist/unstable/http/HttpClientError.js +1 -1
- package/dist/unstable/http/HttpClientError.js.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +2 -14
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.js +1 -16
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
- package/dist/unstable/http/HttpPlatform.js +21 -3
- package/dist/unstable/http/HttpPlatform.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +7 -6
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +8 -6
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/Multipart.d.ts +1 -1
- package/dist/unstable/http/Multipart.d.ts.map +1 -1
- package/dist/unstable/http/Multipart.js +9 -2
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/MultipartParser/HeadersParser.d.ts +53 -0
- package/dist/unstable/http/MultipartParser/HeadersParser.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser/HeadersParser.js +14 -0
- package/dist/unstable/http/MultipartParser/HeadersParser.js.map +1 -0
- package/dist/unstable/http/MultipartParser/Search.d.ts +11 -0
- package/dist/unstable/http/MultipartParser/Search.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser/Search.js +14 -0
- package/dist/unstable/http/MultipartParser/Search.js.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/contentType.d.ts +5 -0
- package/dist/unstable/http/MultipartParser/internal/contentType.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/contentType.js +82 -0
- package/dist/unstable/http/MultipartParser/internal/contentType.js.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/headers.d.ts +3 -0
- package/dist/unstable/http/MultipartParser/internal/headers.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/headers.js +194 -0
- package/dist/unstable/http/MultipartParser/internal/headers.js.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/multipart.d.ts +8 -0
- package/dist/unstable/http/MultipartParser/internal/multipart.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/multipart.js +226 -0
- package/dist/unstable/http/MultipartParser/internal/multipart.js.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/search.d.ts +5 -0
- package/dist/unstable/http/MultipartParser/internal/search.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/search.js +120 -0
- package/dist/unstable/http/MultipartParser/internal/search.js.map +1 -0
- package/dist/unstable/http/MultipartParser.d.ts +98 -0
- package/dist/unstable/http/MultipartParser.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser.js +23 -0
- package/dist/unstable/http/MultipartParser.js.map +1 -0
- package/dist/unstable/http/Template.d.ts.map +1 -1
- package/dist/unstable/http/Template.js +2 -2
- package/dist/unstable/http/Template.js.map +1 -1
- package/dist/unstable/http/index.d.ts +1 -1
- package/dist/unstable/http/index.d.ts.map +1 -1
- package/dist/unstable/http/index.js +1 -1
- package/dist/unstable/http/index.js.map +1 -1
- package/dist/unstable/http/internal/httpBody.d.ts +2 -0
- package/dist/unstable/http/internal/httpBody.d.ts.map +1 -0
- package/dist/unstable/http/internal/httpBody.js +10 -0
- package/dist/unstable/http/internal/httpBody.js.map +1 -0
- package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js +5 -5
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +68 -15
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +65 -25
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +6 -4
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.js +73 -16
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +5 -5
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.js +17 -17
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +219 -0
- package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.js +170 -0
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts +8 -0
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +45 -18
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +2 -1
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpLogger.js +2 -2
- package/dist/unstable/observability/OtlpLogger.js.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts +2 -2
- package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.js +28 -15
- package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js +1 -1
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.js +9 -9
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistence.js +17 -7
- package/dist/unstable/persistence/Persistence.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +22 -12
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +15 -42
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/persistence/Redis.js +1 -1
- package/dist/unstable/persistence/Redis.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts +14 -0
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +18 -9
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcClientError.js +2 -2
- package/dist/unstable/rpc/RpcClientError.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +3 -1
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts +1 -1
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +5 -5
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.js +17 -9
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +28 -12
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +7 -3
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/sql/SqlError.js +13 -13
- package/dist/unstable/sql/SqlError.js.map +1 -1
- package/dist/unstable/sql/SqlResolver.js +8 -6
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/sql/Statement.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.js +8 -6
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/workers/WorkerError.js +5 -5
- package/dist/unstable/workers/WorkerError.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +3 -3
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/package.json +2 -8
- package/src/Cache.ts +1 -1
- package/src/Channel.ts +1 -1
- package/src/Config.ts +28 -7
- package/src/ConfigProvider.ts +4 -1
- package/src/Context.ts +5 -5
- package/src/Crypto.ts +17 -8
- package/src/Duration.ts +16 -2
- package/src/Effect.ts +141 -17
- package/src/Equal.ts +10 -2
- package/src/ExecutionPlan.ts +78 -1
- package/src/FiberSet.ts +1 -1
- package/src/FileSystem.ts +2 -2
- package/src/Function.ts +6 -6
- package/src/Iterable.ts +11 -10
- package/src/Layer.ts +7 -5
- package/src/Schedule.ts +13 -13
- package/src/Schema.ts +50 -41
- package/src/SchemaAST.ts +69 -37
- package/src/SchemaParser.ts +75 -69
- package/src/ScopedCache.ts +1 -1
- package/src/Sink.ts +1 -1
- package/src/Stream.ts +77 -10
- package/src/SynchronizedRef.ts +1 -1
- package/src/Terminal.ts +1 -1
- package/src/Tuple.ts +7 -4
- package/src/TxReentrantLock.ts +39 -35
- package/src/internal/dateTime.ts +1 -1
- package/src/internal/executionPlan.ts +105 -10
- package/src/internal/hashMap.ts +20 -14
- package/src/internal/matcher.ts +2 -2
- package/src/internal/schedule.ts +4 -4
- package/src/internal/schema/annotations.ts +3 -0
- package/src/internal/schema/toArbitrary.ts +3 -1
- package/src/internal/trie.ts +12 -2
- package/src/testing/TestClock.ts +13 -1
- package/src/testing/TestSchema.ts +1 -1
- package/src/unstable/ai/AiError.ts +19 -19
- package/src/unstable/ai/Chat.ts +1 -1
- package/src/unstable/ai/LanguageModel.ts +4 -2
- package/src/unstable/ai/McpSchema.ts +17 -16
- package/src/unstable/ai/McpServer.ts +1 -1
- package/src/unstable/ai/Prompt.ts +21 -6
- package/src/unstable/cli/CliError.ts +12 -12
- package/src/unstable/cli/Command.ts +12 -10
- package/src/unstable/cli/Param.ts +41 -19
- package/src/unstable/cli/Primitive.ts +11 -5
- package/src/unstable/cli/Prompt.ts +36 -20
- package/src/unstable/cli/internal/ansi.ts +2 -2
- package/src/unstable/cli/internal/command.ts +15 -10
- package/src/unstable/cli/internal/completions/bash.ts +59 -9
- package/src/unstable/cli/internal/completions/descriptor.ts +14 -20
- package/src/unstable/cli/internal/completions/fish.ts +5 -7
- package/src/unstable/cli/internal/help.ts +4 -2
- package/src/unstable/cli/internal/parser.ts +3 -3
- package/src/unstable/cli/internal/wizard.ts +2 -2
- package/src/unstable/cluster/ClusterError.ts +7 -7
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +4 -1
- package/src/unstable/cluster/MessageStorage.ts +9 -5
- package/src/unstable/cluster/Reply.ts +21 -0
- package/src/unstable/cluster/RunnerServer.ts +4 -10
- package/src/unstable/cluster/RunnerStorage.ts +9 -7
- package/src/unstable/cluster/Sharding.ts +35 -7
- package/src/unstable/cluster/internal/entityManager.ts +1 -1
- package/src/unstable/cluster/internal/resourceMap.ts +5 -2
- package/src/unstable/cluster/internal/resourceRef.ts +27 -5
- package/src/unstable/devtools/DevToolsClient.ts +3 -2
- package/src/unstable/encoding/Ini.ts +174 -0
- package/src/unstable/encoding/Msgpack.ts +47 -28
- package/src/unstable/encoding/Ndjson.ts +9 -1
- package/src/unstable/encoding/Sse.ts +11 -21
- package/src/unstable/encoding/Toml.ts +504 -0
- package/src/unstable/encoding/Yaml.ts +541 -0
- package/src/unstable/encoding/index.ts +15 -0
- package/src/unstable/eventlog/EventJournal.ts +14 -6
- package/src/unstable/eventlog/EventLogMessage.ts +1 -1
- package/src/unstable/eventlog/EventLogServerUnencrypted.ts +1 -1
- package/src/unstable/eventlog/SqlEventJournal.ts +6 -4
- package/src/unstable/http/FindMyWay/internal/queryString.ts +420 -0
- package/src/unstable/http/FindMyWay/internal/router.ts +950 -0
- package/src/unstable/http/FindMyWay.ts +65 -6
- package/src/unstable/http/HttpClientError.ts +1 -1
- package/src/unstable/http/HttpClientRequest.ts +2 -14
- package/src/unstable/http/HttpClientResponse.ts +1 -17
- package/src/unstable/http/HttpPlatform.ts +34 -6
- package/src/unstable/http/HttpServerRequest.ts +14 -6
- package/src/unstable/http/HttpServerResponse.ts +9 -7
- package/src/unstable/http/Multipart.ts +9 -2
- package/src/unstable/http/MultipartParser/HeadersParser.ts +68 -0
- package/src/unstable/http/MultipartParser/Search.ts +17 -0
- package/src/unstable/http/MultipartParser/internal/contentType.ts +103 -0
- package/src/unstable/http/MultipartParser/internal/headers.ts +615 -0
- package/src/unstable/http/MultipartParser/internal/multipart.ts +262 -0
- package/src/unstable/http/MultipartParser/internal/search.ts +167 -0
- package/src/unstable/http/MultipartParser.ts +115 -0
- package/src/unstable/http/Template.ts +6 -5
- package/src/unstable/http/index.ts +1 -1
- package/src/unstable/http/internal/httpBody.ts +15 -0
- package/src/unstable/httpapi/HttpApi.ts +6 -7
- package/src/unstable/httpapi/HttpApiBuilder.ts +119 -21
- package/src/unstable/httpapi/HttpApiClient.ts +104 -41
- package/src/unstable/httpapi/HttpApiEndpoint.ts +117 -29
- package/src/unstable/httpapi/HttpApiError.ts +33 -39
- package/src/unstable/httpapi/HttpApiMiddleware.ts +1 -1
- package/src/unstable/httpapi/HttpApiSchema.ts +353 -0
- package/src/unstable/httpapi/OpenApi.ts +70 -20
- package/src/unstable/observability/OtlpExporter.ts +4 -2
- package/src/unstable/observability/OtlpLogger.ts +3 -1
- package/src/unstable/observability/OtlpMetrics.ts +32 -18
- package/src/unstable/observability/OtlpTracer.ts +1 -1
- package/src/unstable/persistence/PersistedQueue.ts +12 -9
- package/src/unstable/persistence/Persistence.ts +27 -7
- package/src/unstable/persistence/RateLimiter.ts +54 -31
- package/src/unstable/persistence/Redis.ts +1 -1
- package/src/unstable/rpc/RpcClient.ts +38 -12
- package/src/unstable/rpc/RpcClientError.ts +2 -2
- package/src/unstable/rpc/RpcSerialization.ts +1 -1
- package/src/unstable/schema/VariantSchema.ts +36 -18
- package/src/unstable/socket/Socket.ts +24 -14
- package/src/unstable/sql/SqlClient.ts +65 -56
- package/src/unstable/sql/SqlError.ts +13 -13
- package/src/unstable/sql/SqlResolver.ts +8 -6
- package/src/unstable/sql/Statement.ts +13 -8
- package/src/unstable/workers/WorkerError.ts +5 -5
- package/src/unstable/workflow/WorkflowEngine.ts +8 -3
- package/dist/unstable/http/Multipasta/HeadersParser.d.ts +0 -14
- package/dist/unstable/http/Multipasta/HeadersParser.d.ts.map +0 -1
- package/dist/unstable/http/Multipasta/HeadersParser.js +0 -14
- package/dist/unstable/http/Multipasta/HeadersParser.js.map +0 -1
- package/dist/unstable/http/Multipasta/Node.d.ts +0 -14
- package/dist/unstable/http/Multipasta/Node.d.ts.map +0 -1
- package/dist/unstable/http/Multipasta/Node.js +0 -14
- package/dist/unstable/http/Multipasta/Node.js.map +0 -1
- package/dist/unstable/http/Multipasta/Search.d.ts +0 -14
- package/dist/unstable/http/Multipasta/Search.d.ts.map +0 -1
- package/dist/unstable/http/Multipasta/Search.js +0 -14
- package/dist/unstable/http/Multipasta/Search.js.map +0 -1
- package/dist/unstable/http/Multipasta/Web.d.ts +0 -14
- package/dist/unstable/http/Multipasta/Web.d.ts.map +0 -1
- package/dist/unstable/http/Multipasta/Web.js +0 -14
- package/dist/unstable/http/Multipasta/Web.js.map +0 -1
- package/dist/unstable/http/Multipasta.d.ts +0 -15
- package/dist/unstable/http/Multipasta.d.ts.map +0 -1
- package/dist/unstable/http/Multipasta.js +0 -15
- package/dist/unstable/http/Multipasta.js.map +0 -1
- package/src/unstable/http/Multipasta/HeadersParser.ts +0 -14
- package/src/unstable/http/Multipasta/Node.ts +0 -14
- package/src/unstable/http/Multipasta/Search.ts +0 -14
- package/src/unstable/http/Multipasta/Web.ts +0 -14
- package/src/unstable/http/Multipasta.ts +0 -15
|
@@ -1022,6 +1022,13 @@ export const layerProtocolHttp = (options: {
|
|
|
1022
1022
|
export const makeProtocolSocket = (options?: {
|
|
1023
1023
|
readonly retryTransientErrors?: boolean | undefined
|
|
1024
1024
|
readonly retryPolicy?: Schedule.Schedule<any, Socket.SocketError> | undefined
|
|
1025
|
+
/**
|
|
1026
|
+
* Runs for each retried `SocketOpenError` when `retryTransientErrors` is enabled.
|
|
1027
|
+
* Ping timeouts are also reported because the protocol classifies them as
|
|
1028
|
+
* `SocketOpenError`. The returned `Effect<void>` cannot fail with a typed error
|
|
1029
|
+
* or require services; defects are logged and ignored so retries can continue.
|
|
1030
|
+
*/
|
|
1031
|
+
readonly onTransientError?: ((error: RpcClientError) => Effect.Effect<void>) | undefined
|
|
1025
1032
|
}): Effect.Effect<
|
|
1026
1033
|
Protocol["Service"],
|
|
1027
1034
|
never,
|
|
@@ -1046,6 +1053,13 @@ export const makeProtocolSocket = (options?: {
|
|
|
1046
1053
|
|
|
1047
1054
|
const broadcast = (response: FromServerEncoded) =>
|
|
1048
1055
|
Effect.forEach(clientIds, (clientId) => writeResponse(clientId, response))
|
|
1056
|
+
const broadcastError = (error: RpcClientError) => {
|
|
1057
|
+
currentError = error
|
|
1058
|
+
return broadcast({
|
|
1059
|
+
_tag: "ClientProtocolError",
|
|
1060
|
+
error
|
|
1061
|
+
})
|
|
1062
|
+
}
|
|
1049
1063
|
|
|
1050
1064
|
yield* Effect.suspend(() => {
|
|
1051
1065
|
parser = serialization.makeUnsafe()
|
|
@@ -1110,24 +1124,29 @@ export const makeProtocolSocket = (options?: {
|
|
|
1110
1124
|
Effect.tapCause((cause) => {
|
|
1111
1125
|
const error = Cause.findError(cause)
|
|
1112
1126
|
const hasError = Result.isSuccess(error)
|
|
1113
|
-
|
|
1114
|
-
options?.retryTransientErrors && hasError &&
|
|
1115
|
-
error.success.reason._tag === "SocketOpenError"
|
|
1116
|
-
) {
|
|
1117
|
-
return Effect.void
|
|
1118
|
-
}
|
|
1119
|
-
currentError = new RpcClientError({
|
|
1127
|
+
const rpcError = new RpcClientError({
|
|
1120
1128
|
reason: hasError ? error.success.reason : new RpcClientDefect({
|
|
1121
1129
|
message: "Unknown socket error",
|
|
1122
1130
|
cause: Cause.squash(cause)
|
|
1123
1131
|
})
|
|
1124
1132
|
})
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
error
|
|
1128
|
-
|
|
1133
|
+
if (
|
|
1134
|
+
options?.retryTransientErrors && hasError &&
|
|
1135
|
+
error.success.reason._tag === "SocketOpenError"
|
|
1136
|
+
) {
|
|
1137
|
+
return (options.onTransientError?.(rpcError) ?? Effect.void).pipe(
|
|
1138
|
+
Effect.ignoreCause({
|
|
1139
|
+
log: true,
|
|
1140
|
+
message: "RpcClient onTransientError hook failed"
|
|
1141
|
+
})
|
|
1142
|
+
)
|
|
1143
|
+
}
|
|
1144
|
+
return broadcastError(rpcError)
|
|
1129
1145
|
}),
|
|
1130
|
-
Effect.
|
|
1146
|
+
Effect.retryOrElse(
|
|
1147
|
+
options?.retryPolicy ?? defaultRetryPolicy,
|
|
1148
|
+
(error) => broadcastError(new RpcClientError({ reason: error.reason }))
|
|
1149
|
+
),
|
|
1131
1150
|
Effect.annotateLogs({
|
|
1132
1151
|
module: "RpcClient",
|
|
1133
1152
|
method: "makeProtocolSocket"
|
|
@@ -1190,6 +1209,13 @@ const makePinger = Effect.fnUntraced(function*<A, E, R>(writePing: Effect.Effect
|
|
|
1190
1209
|
*/
|
|
1191
1210
|
export const layerProtocolSocket = (options?: {
|
|
1192
1211
|
readonly retryTransientErrors?: boolean | undefined
|
|
1212
|
+
/**
|
|
1213
|
+
* Runs for each retried `SocketOpenError` when `retryTransientErrors` is enabled.
|
|
1214
|
+
* Ping timeouts are also reported because the protocol classifies them as
|
|
1215
|
+
* `SocketOpenError`. The returned `Effect<void>` cannot fail with a typed error
|
|
1216
|
+
* or require services; defects are logged and ignored so retries can continue.
|
|
1217
|
+
*/
|
|
1218
|
+
readonly onTransientError?: ((error: RpcClientError) => Effect.Effect<void>) | undefined
|
|
1193
1219
|
}): Layer.Layer<
|
|
1194
1220
|
Protocol,
|
|
1195
1221
|
never,
|
|
@@ -22,7 +22,7 @@ const TypeId = "~effect/rpc/RpcClientError"
|
|
|
22
22
|
* @category errors
|
|
23
23
|
* @since 4.0.0
|
|
24
24
|
*/
|
|
25
|
-
export class RpcClientDefect extends Schema.
|
|
25
|
+
export class RpcClientDefect extends Schema.Error<RpcClientDefect>("effect/rpc/RpcClientError/RpcClientDefect")({
|
|
26
26
|
_tag: Schema.tag("RpcClientDefect"),
|
|
27
27
|
message: Schema.String,
|
|
28
28
|
cause: Schema.Defect()
|
|
@@ -35,7 +35,7 @@ export class RpcClientDefect extends Schema.ErrorClass<RpcClientDefect>("effect/
|
|
|
35
35
|
* @category errors
|
|
36
36
|
* @since 4.0.0
|
|
37
37
|
*/
|
|
38
|
-
export class RpcClientError extends Schema.
|
|
38
|
+
export class RpcClientError extends Schema.Error<RpcClientError>(TypeId)({
|
|
39
39
|
_tag: Schema.tag("RpcClientError"),
|
|
40
40
|
reason: Schema.Union([
|
|
41
41
|
WorkerErrorReason,
|
|
@@ -128,7 +128,7 @@ export const makeNdjson = (options?: StreamOptions): RpcSerialization["Service"]
|
|
|
128
128
|
}
|
|
129
129
|
return ({
|
|
130
130
|
decode: (bytes) => {
|
|
131
|
-
buffer += typeof bytes === "string" ? bytes : decoder.decode(bytes)
|
|
131
|
+
buffer += typeof bytes === "string" ? bytes : decoder.decode(bytes, { stream: true })
|
|
132
132
|
let position = 0
|
|
133
133
|
let nlIndex = buffer.indexOf("\n", position)
|
|
134
134
|
const items: Array<unknown> = []
|
|
@@ -26,6 +26,7 @@ import * as Struct_ from "../../Struct.ts"
|
|
|
26
26
|
export const TypeId = "~effect/schema/VariantSchema"
|
|
27
27
|
|
|
28
28
|
const cacheSymbol = Symbol.for(`${TypeId}/cache`)
|
|
29
|
+
const defaultCacheSymbol = Symbol.for(`${TypeId}/defaultCache`)
|
|
29
30
|
|
|
30
31
|
/**
|
|
31
32
|
* Pipeable container of schema fields that can be extracted into per-variant
|
|
@@ -38,6 +39,8 @@ export interface Struct<in out A extends Field.Fields> extends Pipeable {
|
|
|
38
39
|
readonly [TypeId]: A
|
|
39
40
|
/** @internal */
|
|
40
41
|
[cacheSymbol]?: Record<string, Schema.Top>
|
|
42
|
+
/** @internal */
|
|
43
|
+
[defaultCacheSymbol]?: Record<string, Schema.Top>
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
/**
|
|
@@ -87,7 +90,7 @@ export declare namespace Struct {
|
|
|
87
90
|
export type Validate<A, Variant extends string> = {
|
|
88
91
|
readonly [K in keyof A]: A[K] extends { readonly [TypeId]: infer _ } ? Validate<A[K], Variant> :
|
|
89
92
|
A[K] extends Field<infer Config> ? [keyof Config] extends [Variant] ? {} : "field must have valid variants"
|
|
90
|
-
:
|
|
93
|
+
: unknown
|
|
91
94
|
}
|
|
92
95
|
}
|
|
93
96
|
|
|
@@ -144,7 +147,7 @@ export declare namespace Field {
|
|
|
144
147
|
* @since 4.0.0
|
|
145
148
|
*/
|
|
146
149
|
export type ConfigWithKeys<K extends string> = {
|
|
147
|
-
readonly [P in K]?: Schema.Top
|
|
150
|
+
readonly [P in K]?: Schema.Top | undefined
|
|
148
151
|
}
|
|
149
152
|
|
|
150
153
|
/**
|
|
@@ -214,14 +217,18 @@ const extract: {
|
|
|
214
217
|
readonly isDefault?: boolean | undefined
|
|
215
218
|
}
|
|
216
219
|
): Extract<V, A> => {
|
|
217
|
-
const cache =
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
220
|
+
const cache = options?.isDefault === true
|
|
221
|
+
? self[defaultCacheSymbol] ?? (self[defaultCacheSymbol] = Object.create(null))
|
|
222
|
+
: self[cacheSymbol] ?? (self[cacheSymbol] = Object.create(null))
|
|
223
|
+
if (Object.hasOwn(cache, variant)) {
|
|
224
|
+
return cache[variant] as any
|
|
221
225
|
}
|
|
222
226
|
const fields: Record<string, any> = {}
|
|
223
227
|
for (const key of Object.keys(self[TypeId])) {
|
|
224
228
|
const value = self[TypeId][key]
|
|
229
|
+
if (value === undefined) {
|
|
230
|
+
continue
|
|
231
|
+
}
|
|
225
232
|
if (TypeId in value) {
|
|
226
233
|
if (options?.isDefault === true && Schema.isSchema(value)) {
|
|
227
234
|
InternalRecord.assignProperty(fields, key, value)
|
|
@@ -230,14 +237,17 @@ const extract: {
|
|
|
230
237
|
}
|
|
231
238
|
} else if (FieldTypeId in value) {
|
|
232
239
|
if (Object.hasOwn(value.schemas, variant)) {
|
|
233
|
-
|
|
240
|
+
const schema = value.schemas[variant]
|
|
241
|
+
if (schema !== undefined) {
|
|
242
|
+
InternalRecord.assignProperty(fields, key, schema)
|
|
243
|
+
}
|
|
234
244
|
}
|
|
235
245
|
} else {
|
|
236
246
|
InternalRecord.assignProperty(fields, key, value)
|
|
237
247
|
}
|
|
238
248
|
}
|
|
239
249
|
const schema = Schema.Struct(fields)
|
|
240
|
-
cache[
|
|
250
|
+
cache[variant] = schema
|
|
241
251
|
return schema as any
|
|
242
252
|
}
|
|
243
253
|
)
|
|
@@ -296,12 +306,13 @@ type MissingSelfGeneric<Params extends string = ""> =
|
|
|
296
306
|
* @category models
|
|
297
307
|
* @since 4.0.0
|
|
298
308
|
*/
|
|
299
|
-
export interface Union<Members extends ReadonlyArray<Struct<any
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
309
|
+
export interface Union<Members extends ReadonlyArray<Struct<any>>, Default extends string = string>
|
|
310
|
+
extends
|
|
311
|
+
Schema.Union<
|
|
312
|
+
{
|
|
313
|
+
readonly [K in keyof Members]: Extract<Default, Members[K], true>
|
|
314
|
+
}
|
|
315
|
+
>
|
|
305
316
|
{}
|
|
306
317
|
|
|
307
318
|
/**
|
|
@@ -410,7 +421,7 @@ export const make = <
|
|
|
410
421
|
}
|
|
411
422
|
readonly Union: <const Members extends ReadonlyArray<Struct<any>>>(
|
|
412
423
|
members: Members
|
|
413
|
-
) => Union<Members> & Union.Variants<Members, Variants[number]>
|
|
424
|
+
) => Union<Members, Default> & Union.Variants<Members, Variants[number]>
|
|
414
425
|
readonly extract: {
|
|
415
426
|
<V extends Variants[number]>(
|
|
416
427
|
variant: V
|
|
@@ -469,7 +480,7 @@ export const make = <
|
|
|
469
480
|
}
|
|
470
481
|
}
|
|
471
482
|
function UnionVariants(members: ReadonlyArray<Struct<any>>) {
|
|
472
|
-
return Union(members, options.variants)
|
|
483
|
+
return Union(members, options.defaultVariant, options.variants)
|
|
473
484
|
}
|
|
474
485
|
const fieldEvolve = dual(
|
|
475
486
|
2,
|
|
@@ -582,11 +593,18 @@ const Field = <const A extends Field.Config>(schemas: A): Field<A> => {
|
|
|
582
593
|
return self
|
|
583
594
|
}
|
|
584
595
|
|
|
585
|
-
const Union = <
|
|
596
|
+
const Union = <
|
|
597
|
+
Members extends ReadonlyArray<Struct<any>>,
|
|
598
|
+
Default extends string,
|
|
599
|
+
Variants extends ReadonlyArray<string>
|
|
600
|
+
>(
|
|
586
601
|
members: Members,
|
|
602
|
+
defaultVariant: Default,
|
|
587
603
|
variants: Variants
|
|
588
604
|
) => {
|
|
589
|
-
const VariantUnion = Schema.Union(
|
|
605
|
+
const VariantUnion = Schema.Union(
|
|
606
|
+
members.map((member) => Schema.isSchema(member) ? member : extract(member, defaultVariant, { isDefault: true }))
|
|
607
|
+
) as any
|
|
590
608
|
for (const variant of variants) {
|
|
591
609
|
Object.defineProperty(VariantUnion, variant, {
|
|
592
610
|
value: Schema.Union(members.map((member) => extract(member, variant)))
|
|
@@ -220,7 +220,7 @@ export const isSocketError = (u: unknown): u is SocketError => Predicate.hasProp
|
|
|
220
220
|
* @category errors
|
|
221
221
|
* @since 4.0.0
|
|
222
222
|
*/
|
|
223
|
-
export class SocketReadError extends Schema.
|
|
223
|
+
export class SocketReadError extends Schema.Error<SocketReadError>("effect/socket/Socket/SocketReadError")({
|
|
224
224
|
_tag: Schema.tag("SocketReadError"),
|
|
225
225
|
cause: Schema.Defect()
|
|
226
226
|
}) {
|
|
@@ -238,7 +238,7 @@ export class SocketReadError extends Schema.ErrorClass<SocketReadError>("effect/
|
|
|
238
238
|
* @category errors
|
|
239
239
|
* @since 4.0.0
|
|
240
240
|
*/
|
|
241
|
-
export class SocketWriteError extends Schema.
|
|
241
|
+
export class SocketWriteError extends Schema.Error<SocketWriteError>("effect/socket/Socket/SocketWriteError")({
|
|
242
242
|
_tag: Schema.tag("SocketWriteError"),
|
|
243
243
|
cause: Schema.Defect()
|
|
244
244
|
}) {
|
|
@@ -257,7 +257,7 @@ export class SocketWriteError extends Schema.ErrorClass<SocketWriteError>("effec
|
|
|
257
257
|
* @category errors
|
|
258
258
|
* @since 4.0.0
|
|
259
259
|
*/
|
|
260
|
-
export class SocketOpenError extends Schema.
|
|
260
|
+
export class SocketOpenError extends Schema.Error<SocketOpenError>("effect/socket/Socket/SocketOpenError")({
|
|
261
261
|
_tag: Schema.tag("SocketOpenError"),
|
|
262
262
|
kind: Schema.Literals(["Unknown", "Timeout"]),
|
|
263
263
|
cause: Schema.Defect()
|
|
@@ -281,7 +281,7 @@ export class SocketOpenError extends Schema.ErrorClass<SocketOpenError>("effect/
|
|
|
281
281
|
* @category errors
|
|
282
282
|
* @since 4.0.0
|
|
283
283
|
*/
|
|
284
|
-
export class SocketCloseError extends Schema.
|
|
284
|
+
export class SocketCloseError extends Schema.Error<SocketCloseError>("effect/socket/Socket/SocketCloseError")({
|
|
285
285
|
_tag: Schema.tag("SocketCloseError"),
|
|
286
286
|
code: Schema.Int,
|
|
287
287
|
closeReason: Schema.optional(Schema.String)
|
|
@@ -339,7 +339,7 @@ export type SocketErrorReason =
|
|
|
339
339
|
* @category errors
|
|
340
340
|
* @since 4.0.0
|
|
341
341
|
*/
|
|
342
|
-
export class SocketError extends Schema.
|
|
342
|
+
export class SocketError extends Schema.TaggedError<SocketError>(SocketErrorTypeId)("SocketError", {
|
|
343
343
|
_tag: Schema.tag("SocketError"),
|
|
344
344
|
reason: SocketErrorReason
|
|
345
345
|
}) {
|
|
@@ -747,14 +747,21 @@ export const fromWebSocket = <RO>(
|
|
|
747
747
|
)
|
|
748
748
|
|
|
749
749
|
const write = (chunk: Uint8Array | string | CloseEvent) =>
|
|
750
|
-
latch.whenOpen(
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
750
|
+
latch.whenOpen(
|
|
751
|
+
Effect.suspend(() => {
|
|
752
|
+
try {
|
|
753
|
+
const ws = currentWS!
|
|
754
|
+
if (isCloseEvent(chunk)) {
|
|
755
|
+
ws.close(chunk.code, chunk.reason)
|
|
756
|
+
} else {
|
|
757
|
+
ws.send(chunk as string | Uint8Array<ArrayBuffer>)
|
|
758
|
+
}
|
|
759
|
+
return Effect.void
|
|
760
|
+
} catch (cause) {
|
|
761
|
+
return Effect.fail(new SocketError({ reason: new SocketWriteError({ cause }) }))
|
|
762
|
+
}
|
|
763
|
+
})
|
|
764
|
+
)
|
|
758
765
|
const writer = Effect.succeed(write)
|
|
759
766
|
|
|
760
767
|
return Effect.succeed(make({
|
|
@@ -917,7 +924,10 @@ export const fromTransformStream = <R>(acquire: Effect.Effect<InputTransformStre
|
|
|
917
924
|
})
|
|
918
925
|
)
|
|
919
926
|
}
|
|
920
|
-
return Effect.
|
|
927
|
+
return Effect.tryPromise({
|
|
928
|
+
try: () => getWriter(stream).write(typeof chunk === "string" ? encoder.encode(chunk) : chunk),
|
|
929
|
+
catch: (cause) => new SocketError({ reason: new SocketWriteError({ cause }) })
|
|
930
|
+
})
|
|
921
931
|
}))
|
|
922
932
|
const writer = Effect.acquireRelease(
|
|
923
933
|
Effect.succeed(write),
|
|
@@ -16,6 +16,7 @@ import * as Option from "../../Option.ts"
|
|
|
16
16
|
import type * as Queue from "../../Queue.ts"
|
|
17
17
|
import type { ReadonlyRecord } from "../../Record.ts"
|
|
18
18
|
import * as Scope from "../../Scope.ts"
|
|
19
|
+
import * as Semaphore from "../../Semaphore.ts"
|
|
19
20
|
import * as Stream from "../../Stream.ts"
|
|
20
21
|
import * as Tracer from "../../Tracer.ts"
|
|
21
22
|
import type { NoInfer } from "../../Types.ts"
|
|
@@ -126,6 +127,7 @@ export declare namespace SqlClient {
|
|
|
126
127
|
}
|
|
127
128
|
|
|
128
129
|
let clientIdCounter = 0
|
|
130
|
+
let transactionSemaphoreIdCounter = 0
|
|
129
131
|
|
|
130
132
|
/**
|
|
131
133
|
* Constructs a `SqlClient` from connection acquirers, a compiler, transaction
|
|
@@ -227,66 +229,73 @@ export const makeWithTransaction = <I, S>(options: {
|
|
|
227
229
|
readonly commit: (conn: NoInfer<S>) => Effect.Effect<void, SqlError>
|
|
228
230
|
readonly rollback: (conn: NoInfer<S>) => Effect.Effect<void, SqlError>
|
|
229
231
|
readonly rollbackSavepoint: (conn: NoInfer<S>, id: number) => Effect.Effect<void, SqlError>
|
|
230
|
-
}) =>
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
(
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
(
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
232
|
+
}) => {
|
|
233
|
+
const transactionSemaphore = Context.Service<Semaphore.Semaphore>(
|
|
234
|
+
`effect/sql/SqlClient/TransactionSemaphore/${transactionSemaphoreIdCounter++}`
|
|
235
|
+
)
|
|
236
|
+
return <R, E, A>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E | SqlError, R> =>
|
|
237
|
+
Effect.uninterruptibleMask((restore) =>
|
|
238
|
+
Effect.useSpan(
|
|
239
|
+
"sql.transaction",
|
|
240
|
+
{ kind: "client" },
|
|
241
|
+
(span) =>
|
|
242
|
+
Effect.withFiber<A, E | SqlError, R>((fiber) => {
|
|
243
|
+
for (const [key, value] of options.spanAttributes) {
|
|
244
|
+
span.attribute(key, value)
|
|
245
|
+
}
|
|
246
|
+
const services = fiber.context
|
|
247
|
+
const clock = fiber.getRef(Clock)
|
|
248
|
+
const connOption = Context.getOption(services, options.transactionService)
|
|
249
|
+
const conn = connOption._tag === "Some"
|
|
250
|
+
? Effect.succeed([undefined, connOption.value[0]] as const)
|
|
251
|
+
: options.acquireConnection
|
|
252
|
+
const id = connOption._tag === "Some" ? connOption.value[1] + 1 : 0
|
|
253
|
+
const transaction = Effect.flatMap(
|
|
254
|
+
conn,
|
|
255
|
+
(
|
|
256
|
+
[scope, conn]
|
|
257
|
+
) =>
|
|
258
|
+
(id === 0 ? options.begin(conn) : options.savepoint(conn, id)).pipe(
|
|
259
|
+
Effect.flatMap(() =>
|
|
260
|
+
Effect.provideContext(
|
|
261
|
+
restore(effect),
|
|
262
|
+
services.pipe(
|
|
263
|
+
Context.add(options.transactionService, [conn, id]),
|
|
264
|
+
Context.add(transactionSemaphore, Semaphore.makeUnsafe(1)),
|
|
265
|
+
Context.add(Tracer.ParentSpan, span)
|
|
266
|
+
)
|
|
260
267
|
)
|
|
261
|
-
)
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
268
|
+
),
|
|
269
|
+
Effect.exit,
|
|
270
|
+
Effect.flatMap((exit) => {
|
|
271
|
+
let effect: Effect.Effect<void>
|
|
272
|
+
if (Exit.isSuccess(exit)) {
|
|
273
|
+
if (id === 0) {
|
|
274
|
+
span.event("db.transaction.commit", clock.currentTimeNanosUnsafe())
|
|
275
|
+
effect = Effect.orDie(options.commit(conn))
|
|
276
|
+
} else {
|
|
277
|
+
span.event("db.transaction.savepoint", clock.currentTimeNanosUnsafe())
|
|
278
|
+
effect = Effect.void
|
|
279
|
+
}
|
|
270
280
|
} else {
|
|
271
|
-
span.event("db.transaction.
|
|
272
|
-
effect = Effect.
|
|
281
|
+
span.event("db.transaction.rollback", clock.currentTimeNanosUnsafe())
|
|
282
|
+
effect = Effect.orDie(
|
|
283
|
+
id > 0
|
|
284
|
+
? options.rollbackSavepoint(conn, id)
|
|
285
|
+
: options.rollback(conn)
|
|
286
|
+
)
|
|
273
287
|
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
})
|
|
285
|
-
)
|
|
286
|
-
)
|
|
287
|
-
})
|
|
288
|
+
const withScope = scope !== undefined ? Effect.ensuring(effect, Scope.close(scope, exit)) : effect
|
|
289
|
+
return Effect.flatMap(withScope, () => exit)
|
|
290
|
+
})
|
|
291
|
+
)
|
|
292
|
+
)
|
|
293
|
+
return id === 0
|
|
294
|
+
? transaction
|
|
295
|
+
: Context.getUnsafe(services, transactionSemaphore).withPermit(transaction)
|
|
296
|
+
})
|
|
297
|
+
)
|
|
288
298
|
)
|
|
289
|
-
)
|
|
290
299
|
}
|
|
291
300
|
|
|
292
301
|
/**
|
|
@@ -28,7 +28,7 @@ const ReasonFields = {
|
|
|
28
28
|
* @category errors
|
|
29
29
|
* @since 4.0.0
|
|
30
30
|
*/
|
|
31
|
-
export class ConnectionError extends Schema.
|
|
31
|
+
export class ConnectionError extends Schema.TaggedError<ConnectionError>("effect/sql/SqlError/ConnectionError")(
|
|
32
32
|
"ConnectionError",
|
|
33
33
|
ReasonFields
|
|
34
34
|
) {
|
|
@@ -56,7 +56,7 @@ export class ConnectionError extends Schema.TaggedErrorClass<ConnectionError>("e
|
|
|
56
56
|
* @category errors
|
|
57
57
|
* @since 4.0.0
|
|
58
58
|
*/
|
|
59
|
-
export class AuthenticationError extends Schema.
|
|
59
|
+
export class AuthenticationError extends Schema.TaggedError<AuthenticationError>(
|
|
60
60
|
"effect/sql/SqlError/AuthenticationError"
|
|
61
61
|
)("AuthenticationError", ReasonFields) {
|
|
62
62
|
/**
|
|
@@ -83,7 +83,7 @@ export class AuthenticationError extends Schema.TaggedErrorClass<AuthenticationE
|
|
|
83
83
|
* @category errors
|
|
84
84
|
* @since 4.0.0
|
|
85
85
|
*/
|
|
86
|
-
export class AuthorizationError extends Schema.
|
|
86
|
+
export class AuthorizationError extends Schema.TaggedError<AuthorizationError>(
|
|
87
87
|
"effect/sql/SqlError/AuthorizationError"
|
|
88
88
|
)("AuthorizationError", ReasonFields) {
|
|
89
89
|
/**
|
|
@@ -109,7 +109,7 @@ export class AuthorizationError extends Schema.TaggedErrorClass<AuthorizationErr
|
|
|
109
109
|
* @category errors
|
|
110
110
|
* @since 4.0.0
|
|
111
111
|
*/
|
|
112
|
-
export class SqlSyntaxError extends Schema.
|
|
112
|
+
export class SqlSyntaxError extends Schema.TaggedError<SqlSyntaxError>("effect/sql/SqlError/SqlSyntaxError")(
|
|
113
113
|
"SqlSyntaxError",
|
|
114
114
|
ReasonFields
|
|
115
115
|
) {
|
|
@@ -142,7 +142,7 @@ const UniqueViolationFields = {
|
|
|
142
142
|
* @category errors
|
|
143
143
|
* @since 4.0.0
|
|
144
144
|
*/
|
|
145
|
-
export class UniqueViolation extends Schema.
|
|
145
|
+
export class UniqueViolation extends Schema.TaggedError<UniqueViolation>("effect/sql/SqlError/UniqueViolation")(
|
|
146
146
|
"UniqueViolation",
|
|
147
147
|
UniqueViolationFields
|
|
148
148
|
) {
|
|
@@ -169,7 +169,7 @@ export class UniqueViolation extends Schema.TaggedErrorClass<UniqueViolation>("e
|
|
|
169
169
|
* @category errors
|
|
170
170
|
* @since 4.0.0
|
|
171
171
|
*/
|
|
172
|
-
export class ConstraintError extends Schema.
|
|
172
|
+
export class ConstraintError extends Schema.TaggedError<ConstraintError>("effect/sql/SqlError/ConstraintError")(
|
|
173
173
|
"ConstraintError",
|
|
174
174
|
ReasonFields
|
|
175
175
|
) {
|
|
@@ -196,7 +196,7 @@ export class ConstraintError extends Schema.TaggedErrorClass<ConstraintError>("e
|
|
|
196
196
|
* @category errors
|
|
197
197
|
* @since 4.0.0
|
|
198
198
|
*/
|
|
199
|
-
export class DeadlockError extends Schema.
|
|
199
|
+
export class DeadlockError extends Schema.TaggedError<DeadlockError>("effect/sql/SqlError/DeadlockError")(
|
|
200
200
|
"DeadlockError",
|
|
201
201
|
ReasonFields
|
|
202
202
|
) {
|
|
@@ -224,7 +224,7 @@ export class DeadlockError extends Schema.TaggedErrorClass<DeadlockError>("effec
|
|
|
224
224
|
* @category errors
|
|
225
225
|
* @since 4.0.0
|
|
226
226
|
*/
|
|
227
|
-
export class SerializationError extends Schema.
|
|
227
|
+
export class SerializationError extends Schema.TaggedError<SerializationError>(
|
|
228
228
|
"effect/sql/SqlError/SerializationError"
|
|
229
229
|
)("SerializationError", ReasonFields) {
|
|
230
230
|
/**
|
|
@@ -251,7 +251,7 @@ export class SerializationError extends Schema.TaggedErrorClass<SerializationErr
|
|
|
251
251
|
* @category errors
|
|
252
252
|
* @since 4.0.0
|
|
253
253
|
*/
|
|
254
|
-
export class LockTimeoutError extends Schema.
|
|
254
|
+
export class LockTimeoutError extends Schema.TaggedError<LockTimeoutError>("effect/sql/SqlError/LockTimeoutError")(
|
|
255
255
|
"LockTimeoutError",
|
|
256
256
|
ReasonFields
|
|
257
257
|
) {
|
|
@@ -278,7 +278,7 @@ export class LockTimeoutError extends Schema.TaggedErrorClass<LockTimeoutError>(
|
|
|
278
278
|
* @category errors
|
|
279
279
|
* @since 4.0.0
|
|
280
280
|
*/
|
|
281
|
-
export class StatementTimeoutError extends Schema.
|
|
281
|
+
export class StatementTimeoutError extends Schema.TaggedError<StatementTimeoutError>(
|
|
282
282
|
"effect/sql/SqlError/StatementTimeoutError"
|
|
283
283
|
)("StatementTimeoutError", ReasonFields) {
|
|
284
284
|
/**
|
|
@@ -304,7 +304,7 @@ export class StatementTimeoutError extends Schema.TaggedErrorClass<StatementTime
|
|
|
304
304
|
* @category errors
|
|
305
305
|
* @since 4.0.0
|
|
306
306
|
*/
|
|
307
|
-
export class UnknownError extends Schema.
|
|
307
|
+
export class UnknownError extends Schema.TaggedError<UnknownError>("effect/sql/SqlError/UnknownError")(
|
|
308
308
|
"UnknownError",
|
|
309
309
|
ReasonFields
|
|
310
310
|
) {
|
|
@@ -384,7 +384,7 @@ export const SqlErrorReason: Schema.Union<[
|
|
|
384
384
|
* @category errors
|
|
385
385
|
* @since 4.0.0
|
|
386
386
|
*/
|
|
387
|
-
export class SqlError extends Schema.
|
|
387
|
+
export class SqlError extends Schema.TaggedError<SqlError>("effect/sql/SqlError")("SqlError", {
|
|
388
388
|
reason: SqlErrorReason
|
|
389
389
|
}) {
|
|
390
390
|
/**
|
|
@@ -574,7 +574,7 @@ export const classifySqliteError = (
|
|
|
574
574
|
* @since 4.0.0
|
|
575
575
|
*/
|
|
576
576
|
export class ResultLengthMismatch
|
|
577
|
-
extends Schema.
|
|
577
|
+
extends Schema.TaggedError<ResultLengthMismatch>("effect/sql/ResultLengthMismatch")("ResultLengthMismatch", {
|
|
578
578
|
expected: Schema.Natural,
|
|
579
579
|
actual: Schema.Natural
|
|
580
580
|
})
|
|
@@ -133,7 +133,7 @@ export const ordered = <Req extends Schema.Constraint, Res extends Schema.Constr
|
|
|
133
133
|
>({
|
|
134
134
|
key: transactionKey,
|
|
135
135
|
resolver: Effect.fnUntraced(function*(entries) {
|
|
136
|
-
const inputs = yield* partitionRequests(entries, options.Request)
|
|
136
|
+
const [inputs, encodedEntries] = yield* partitionRequests(entries, options.Request)
|
|
137
137
|
const results = yield* options.execute(inputs as any).pipe(
|
|
138
138
|
Effect.provideContext(entries[0].context)
|
|
139
139
|
)
|
|
@@ -143,8 +143,8 @@ export const ordered = <Req extends Schema.Constraint, Res extends Schema.Constr
|
|
|
143
143
|
const decodedResults = yield* decodeArray(results).pipe(
|
|
144
144
|
Effect.provideContext(entries[0].context)
|
|
145
145
|
)
|
|
146
|
-
for (let i = 0; i <
|
|
147
|
-
|
|
146
|
+
for (let i = 0; i < encodedEntries.length; i++) {
|
|
147
|
+
encodedEntries[i].completeUnsafe(Exit.succeed(decodedResults[i]))
|
|
148
148
|
}
|
|
149
149
|
})
|
|
150
150
|
})
|
|
@@ -189,7 +189,7 @@ export const grouped = <Req extends Schema.Constraint, Res extends Schema.Constr
|
|
|
189
189
|
>({
|
|
190
190
|
key: transactionKey,
|
|
191
191
|
resolver: Effect.fnUntraced(function*(entries) {
|
|
192
|
-
const inputs = yield* partitionRequests(entries, options.Request)
|
|
192
|
+
const [inputs] = yield* partitionRequests(entries, options.Request)
|
|
193
193
|
const resultMap = MutableHashMap.empty<K, Arr.NonEmptyArray<Res["Type"]>>()
|
|
194
194
|
const results = yield* options.execute(inputs as any).pipe(
|
|
195
195
|
Effect.provideContext(entries[0].context)
|
|
@@ -310,7 +310,7 @@ const void_ = <Req extends Schema.Constraint, _, E, R>(
|
|
|
310
310
|
>({
|
|
311
311
|
key: transactionKey,
|
|
312
312
|
resolver: Effect.fnUntraced(function*(entries) {
|
|
313
|
-
const inputs = yield* partitionRequests(entries, options.Request)
|
|
313
|
+
const [inputs] = yield* partitionRequests(entries, options.Request)
|
|
314
314
|
yield* options.execute(inputs as any).pipe(
|
|
315
315
|
Effect.provideContext(entries[0].context)
|
|
316
316
|
)
|
|
@@ -338,6 +338,7 @@ const partitionRequests = function*<In, A, E, R, InE>(
|
|
|
338
338
|
) {
|
|
339
339
|
const len = requests.length
|
|
340
340
|
const inputs = Arr.empty<InE>()
|
|
341
|
+
const encodedEntries = Arr.empty<Request.Entry<SqlRequest<In, A, E, R>>>()
|
|
341
342
|
let entry!: Request.Entry<SqlRequest<In, A, E, R>>
|
|
342
343
|
const encode = Schema.encodeEffect(schema)
|
|
343
344
|
const handle = Effect.matchCauseEager({
|
|
@@ -346,6 +347,7 @@ const partitionRequests = function*<In, A, E, R, InE>(
|
|
|
346
347
|
},
|
|
347
348
|
onSuccess(value: InE) {
|
|
348
349
|
inputs.push(value)
|
|
350
|
+
encodedEntries.push(entry)
|
|
349
351
|
}
|
|
350
352
|
})
|
|
351
353
|
|
|
@@ -354,7 +356,7 @@ const partitionRequests = function*<In, A, E, R, InE>(
|
|
|
354
356
|
yield (Effect.provideContext(handle(encode(entry.request.payload)), entry.context) as Effect.Effect<void>)
|
|
355
357
|
}
|
|
356
358
|
|
|
357
|
-
return inputs
|
|
359
|
+
return [inputs, encodedEntries] as const
|
|
358
360
|
}
|
|
359
361
|
|
|
360
362
|
const partitionRequestsById = function*<In, A, E, R, InE>(
|