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
|
@@ -369,11 +369,30 @@ function fromApiWith<Id extends string, Groups extends HttpApiGroup.Constraint>(
|
|
|
369
369
|
const method = endpoint.method.toLowerCase() as OpenAPISpecMethodName
|
|
370
370
|
|
|
371
371
|
function processResponseBodies(bodies: ResponseBodies, defaultDescription: () => string) {
|
|
372
|
-
for (const [status, { content, descriptions, streamContent }] of bodies) {
|
|
372
|
+
for (const [status, { content, descriptions, headers, streamContent }] of bodies) {
|
|
373
373
|
const description = descriptions.size > 0 ? Array.from(descriptions).join(" | ") : defaultDescription()
|
|
374
374
|
InternalRecord.assignProperty(op.responses, status, {
|
|
375
375
|
description
|
|
376
376
|
})
|
|
377
|
+
for (const schema of headers) {
|
|
378
|
+
const ast = SchemaAST.getLastEncoding(schema.ast)
|
|
379
|
+
if (SchemaAST.isObjects(ast)) {
|
|
380
|
+
for (const ps of ast.propertySignatures) {
|
|
381
|
+
const name = String(ps.name).toLowerCase()
|
|
382
|
+
if (name === "content-type") continue
|
|
383
|
+
op.responses[status].headers ??= {}
|
|
384
|
+
InternalRecord.assignProperty(op.responses[status].headers, name, {
|
|
385
|
+
schema: {},
|
|
386
|
+
required: !SchemaAST.isOptional(ps.type)
|
|
387
|
+
})
|
|
388
|
+
pathOps.push({
|
|
389
|
+
_tag: "parameter",
|
|
390
|
+
ast: ps.type,
|
|
391
|
+
path: ["paths", path, method, "responses", String(status), "headers", name, "schema"]
|
|
392
|
+
})
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
377
396
|
if (content !== undefined) {
|
|
378
397
|
content.forEach((map, encoding) => {
|
|
379
398
|
map.forEach((schemas, contentType) => {
|
|
@@ -568,7 +587,7 @@ function fromApiWith<Id extends string, Groups extends HttpApiGroup.Constraint>(
|
|
|
568
587
|
processResponseBodies(
|
|
569
588
|
extractResponseBodies(
|
|
570
589
|
HttpApiEndpoint.getErrorSchemas(endpoint),
|
|
571
|
-
HttpApiSchema.
|
|
590
|
+
HttpApiSchema.getStatusErrorSchema,
|
|
572
591
|
resolveDescriptionOrIdentifier
|
|
573
592
|
),
|
|
574
593
|
() => "Error"
|
|
@@ -673,6 +692,7 @@ type ResponseBodies = Map<
|
|
|
673
692
|
{
|
|
674
693
|
descriptions: Set<string>
|
|
675
694
|
content: Content | undefined // undefined means no content
|
|
695
|
+
headers: Array<Schema.Constraint>
|
|
676
696
|
streamContent: StreamContent | undefined
|
|
677
697
|
}
|
|
678
698
|
>
|
|
@@ -682,19 +702,20 @@ const reservedStreamFailureEvent = "effect/httpapi/stream/failure"
|
|
|
682
702
|
function extractSuccessResponseBodies(endpoint: HttpApiEndpoint.Top): ResponseBodies {
|
|
683
703
|
return extractResponseBodies(
|
|
684
704
|
HttpApiEndpoint.getSuccessSchemas(endpoint),
|
|
685
|
-
HttpApiSchema.
|
|
705
|
+
HttpApiSchema.getStatusSuccessSchema,
|
|
686
706
|
resolveDescriptionOrIdentifier
|
|
687
707
|
)
|
|
688
708
|
}
|
|
689
709
|
|
|
690
710
|
function extractResponseBodies(
|
|
691
711
|
schemas: Array<Schema.Constraint>,
|
|
692
|
-
getStatus: (
|
|
712
|
+
getStatus: (schema: Schema.Constraint) => number,
|
|
693
713
|
getDescription: (ast: SchemaAST.AST) => string | undefined
|
|
694
714
|
): ResponseBodies {
|
|
695
715
|
const map = new Map<number, {
|
|
696
716
|
descriptions: Set<string>
|
|
697
717
|
content: Content | undefined
|
|
718
|
+
headers: Array<Schema.Constraint>
|
|
698
719
|
streamContent: StreamContent | undefined
|
|
699
720
|
}>()
|
|
700
721
|
|
|
@@ -703,16 +724,25 @@ function extractResponseBodies(
|
|
|
703
724
|
return map
|
|
704
725
|
|
|
705
726
|
function process(schema: Schema.Constraint) {
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
const ast =
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
727
|
+
const annotation = HttpApiSchema.getWithHeadersAnnotation(schema.ast)
|
|
728
|
+
const body = HttpApiSchema.isWithHeaders(schema) ? schema.schema : annotation?.body ?? schema
|
|
729
|
+
const headers = HttpApiSchema.isWithHeaders(schema) ? schema.headers : annotation?.headersCodec
|
|
730
|
+
const status = getStatus(schema)
|
|
731
|
+
const ast = body.ast
|
|
732
|
+
if (HttpApiSchema.isStreamSchema(body)) {
|
|
733
|
+
addStreamContent(body, status)
|
|
734
|
+
} else if (HttpApiSchema.isNoContent(ast)) {
|
|
735
|
+
addNoContent(status, getDescription(schema.ast) ?? getDescription(ast) ?? "<No Content>")
|
|
714
736
|
} else {
|
|
715
|
-
addContent(
|
|
737
|
+
addContent(
|
|
738
|
+
body,
|
|
739
|
+
status,
|
|
740
|
+
HttpApiSchema.getResponseEncodingSchema(schema),
|
|
741
|
+
getDescription(schema.ast) ?? getDescription(ast)
|
|
742
|
+
)
|
|
743
|
+
}
|
|
744
|
+
if (headers !== undefined) {
|
|
745
|
+
map.get(status)!.headers.push(headers)
|
|
716
746
|
}
|
|
717
747
|
}
|
|
718
748
|
|
|
@@ -722,6 +752,7 @@ function extractResponseBodies(
|
|
|
722
752
|
map.set(status, {
|
|
723
753
|
descriptions: new Set([description]),
|
|
724
754
|
content: undefined,
|
|
755
|
+
headers: [],
|
|
725
756
|
streamContent: undefined
|
|
726
757
|
})
|
|
727
758
|
} else {
|
|
@@ -731,14 +762,19 @@ function extractResponseBodies(
|
|
|
731
762
|
}
|
|
732
763
|
}
|
|
733
764
|
|
|
734
|
-
function addContent(
|
|
735
|
-
|
|
765
|
+
function addContent(
|
|
766
|
+
schema: Schema.Constraint,
|
|
767
|
+
status: number,
|
|
768
|
+
encoding: HttpApiSchema.Encoding,
|
|
769
|
+
description: string | undefined
|
|
770
|
+
) {
|
|
736
771
|
const statusMap = map.get(status)
|
|
737
772
|
const { _tag, contentType } = encoding
|
|
738
773
|
if (statusMap === undefined) {
|
|
739
774
|
map.set(status, {
|
|
740
775
|
descriptions: new Set(description !== undefined ? [description] : []),
|
|
741
776
|
content: new Map([[_tag, new Map([[contentType, new Set([schema])]])]]),
|
|
777
|
+
headers: [],
|
|
742
778
|
streamContent: undefined
|
|
743
779
|
})
|
|
744
780
|
} else {
|
|
@@ -765,19 +801,24 @@ function extractResponseBodies(
|
|
|
765
801
|
}
|
|
766
802
|
}
|
|
767
803
|
|
|
768
|
-
function addStreamContent(
|
|
769
|
-
|
|
804
|
+
function addStreamContent(
|
|
805
|
+
stream: HttpApiSchema.StreamSchema,
|
|
806
|
+
status: number
|
|
807
|
+
) {
|
|
770
808
|
const statusMap = map.get(status)
|
|
771
809
|
if (statusMap === undefined) {
|
|
772
810
|
map.set(status, {
|
|
773
811
|
descriptions: new Set(),
|
|
774
812
|
content: undefined,
|
|
813
|
+
headers: [],
|
|
775
814
|
streamContent: new Map([[stream.contentType, stream]])
|
|
776
815
|
})
|
|
777
|
-
} else if (statusMap.streamContent === undefined) {
|
|
778
|
-
statusMap.streamContent = new Map([[stream.contentType, stream]])
|
|
779
816
|
} else {
|
|
780
|
-
statusMap.streamContent
|
|
817
|
+
if (statusMap.streamContent === undefined) {
|
|
818
|
+
statusMap.streamContent = new Map([[stream.contentType, stream]])
|
|
819
|
+
} else {
|
|
820
|
+
statusMap.streamContent.set(stream.contentType, stream)
|
|
821
|
+
}
|
|
781
822
|
}
|
|
782
823
|
}
|
|
783
824
|
}
|
|
@@ -1042,8 +1083,17 @@ export type OpenApiSpecContent = {
|
|
|
1042
1083
|
export interface OpenApiSpecResponse {
|
|
1043
1084
|
description: string
|
|
1044
1085
|
content?: OpenApiSpecContent
|
|
1086
|
+
headers?: Record<string, OpenAPISpecHeader>
|
|
1045
1087
|
}
|
|
1046
1088
|
|
|
1089
|
+
/**
|
|
1090
|
+
* Generated OpenAPI response header object.
|
|
1091
|
+
*
|
|
1092
|
+
* @category models
|
|
1093
|
+
* @since 4.0.0
|
|
1094
|
+
*/
|
|
1095
|
+
export type OpenAPISpecHeader = Omit<OpenAPISpecParameter, "name" | "in">
|
|
1096
|
+
|
|
1047
1097
|
/**
|
|
1048
1098
|
* Generated OpenAPI media type object containing the JSON Schema for a request or response body.
|
|
1049
1099
|
*
|
|
@@ -167,7 +167,7 @@ export const make: (
|
|
|
167
167
|
readonly label: string
|
|
168
168
|
readonly exportInterval: Duration.Input
|
|
169
169
|
readonly maxBatchSize: number | "disabled"
|
|
170
|
-
readonly body: (data: Array<any>) => HttpBody
|
|
170
|
+
readonly body: (data: Array<any>) => readonly [body: HttpBody, onSuccess: Effect.Effect<void>]
|
|
171
171
|
readonly shutdownTimeout: Duration.Input
|
|
172
172
|
}
|
|
173
173
|
) => Effect.Effect<
|
|
@@ -208,9 +208,11 @@ export const make: (
|
|
|
208
208
|
}
|
|
209
209
|
buffer = []
|
|
210
210
|
}
|
|
211
|
+
const [body, onSuccess] = options.body(items)
|
|
211
212
|
return client.execute(
|
|
212
|
-
HttpClientRequest.setBody(request,
|
|
213
|
+
HttpClientRequest.setBody(request, body)
|
|
213
214
|
).pipe(
|
|
215
|
+
Effect.andThen(onSuccess),
|
|
214
216
|
Effect.asVoid,
|
|
215
217
|
Effect.withTracerEnabled(false)
|
|
216
218
|
)
|
|
@@ -71,7 +71,7 @@ export const make: (
|
|
|
71
71
|
headers: options.headers,
|
|
72
72
|
maxBatchSize: options.maxBatchSize ?? 1000,
|
|
73
73
|
exportInterval: options.exportInterval ?? Duration.seconds(1),
|
|
74
|
-
body: (data) =>
|
|
74
|
+
body: (data) => [
|
|
75
75
|
serialization.logs({
|
|
76
76
|
resourceLogs: [{
|
|
77
77
|
resource: otelResource,
|
|
@@ -81,6 +81,8 @@ export const make: (
|
|
|
81
81
|
}]
|
|
82
82
|
}]
|
|
83
83
|
}),
|
|
84
|
+
Effect.void
|
|
85
|
+
],
|
|
84
86
|
shutdownTimeout: options.shutdownTimeout ?? Duration.seconds(3)
|
|
85
87
|
})
|
|
86
88
|
|
|
@@ -71,8 +71,8 @@ export type AggregationTemporality = "cumulative" | "delta"
|
|
|
71
71
|
*
|
|
72
72
|
* The exporter snapshots registered Effect metrics on the configured interval, serializes them with the selected aggregation temporality, and flushes during scope finalization up to `shutdownTimeout`.
|
|
73
73
|
* Manual flushing also triggers a snapshot. With delta temporality, each
|
|
74
|
-
*
|
|
75
|
-
* delta aggregation windows.
|
|
74
|
+
* successful export advances the previous-export state, so frequent successful
|
|
75
|
+
* flushes narrow the delta aggregation windows.
|
|
76
76
|
*
|
|
77
77
|
* @category constructors
|
|
78
78
|
* @since 4.0.0
|
|
@@ -108,15 +108,22 @@ export const make: (options: {
|
|
|
108
108
|
|
|
109
109
|
// State for delta temporality tracking
|
|
110
110
|
let previousExportTimeNanos: bigint = startTimeNanos
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
111
|
+
let previousCounterState = new Map<string, number | bigint>()
|
|
112
|
+
let previousHistogramState = new Map<string, PreviousHistogramState>()
|
|
113
|
+
let previousFrequencyState = new Map<string, Map<string, number>>()
|
|
114
|
+
let previousSummaryState = new Map<string, PreviousSummaryState>()
|
|
115
|
+
let snapshotSequence = 0
|
|
116
|
+
let committedSnapshotSequence = -1
|
|
117
|
+
|
|
118
|
+
const snapshot = (): readonly [body: HttpBody, onSuccess: Effect.Effect<void>] => {
|
|
117
119
|
const snapshot = Metric.snapshotUnsafe(services)
|
|
120
|
+
const currentSnapshotSequence = snapshotSequence++
|
|
118
121
|
const nowNanos = clock.currentTimeNanosUnsafe()
|
|
119
122
|
const nowTime = String(nowNanos)
|
|
123
|
+
const nextCounterState = new Map(previousCounterState)
|
|
124
|
+
const nextHistogramState = new Map(previousHistogramState)
|
|
125
|
+
const nextFrequencyState = new Map(previousFrequencyState)
|
|
126
|
+
const nextSummaryState = new Map(previousSummaryState)
|
|
120
127
|
const metricData: Array<IMetric> = []
|
|
121
128
|
const metricDataByName = new Map<string, IMetric>()
|
|
122
129
|
const addMetricData = (data: IMetric) => {
|
|
@@ -162,7 +169,7 @@ export const make: (options: {
|
|
|
162
169
|
}
|
|
163
170
|
}
|
|
164
171
|
}
|
|
165
|
-
|
|
172
|
+
nextCounterState.set(metricKey, currentCount)
|
|
166
173
|
}
|
|
167
174
|
|
|
168
175
|
const dataPoint: INumberDataPoint = {
|
|
@@ -253,7 +260,7 @@ export const make: (options: {
|
|
|
253
260
|
// Note: This is a limitation - true delta min/max would require tracking
|
|
254
261
|
// observations within each interval
|
|
255
262
|
}
|
|
256
|
-
|
|
263
|
+
nextHistogramState.set(metricKey, {
|
|
257
264
|
count: state.state.count,
|
|
258
265
|
sum: state.state.sum,
|
|
259
266
|
bucketCounts: currentBuckets.counts.slice(),
|
|
@@ -314,7 +321,7 @@ export const make: (options: {
|
|
|
314
321
|
}
|
|
315
322
|
|
|
316
323
|
if (isDelta) {
|
|
317
|
-
|
|
324
|
+
nextFrequencyState.set(metricKey, currentOccurrences)
|
|
318
325
|
}
|
|
319
326
|
|
|
320
327
|
if (metricDataByName.has(state.id)) {
|
|
@@ -366,7 +373,7 @@ export const make: (options: {
|
|
|
366
373
|
reportCount = state.state.count - previousState.count
|
|
367
374
|
reportSum = state.state.sum - previousState.sum
|
|
368
375
|
}
|
|
369
|
-
|
|
376
|
+
nextSummaryState.set(metricKey, {
|
|
370
377
|
count: state.state.count,
|
|
371
378
|
sum: state.state.sum
|
|
372
379
|
})
|
|
@@ -426,12 +433,7 @@ export const make: (options: {
|
|
|
426
433
|
}
|
|
427
434
|
}
|
|
428
435
|
|
|
429
|
-
|
|
430
|
-
if (isDelta) {
|
|
431
|
-
previousExportTimeNanos = nowNanos
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
return serialization.metrics({
|
|
436
|
+
const body = serialization.metrics({
|
|
435
437
|
resourceMetrics: [{
|
|
436
438
|
resource,
|
|
437
439
|
scopeMetrics: [{
|
|
@@ -440,6 +442,18 @@ export const make: (options: {
|
|
|
440
442
|
}]
|
|
441
443
|
}]
|
|
442
444
|
})
|
|
445
|
+
const onSuccess = isDelta
|
|
446
|
+
? Effect.sync(() => {
|
|
447
|
+
if (currentSnapshotSequence < committedSnapshotSequence) return
|
|
448
|
+
previousCounterState = nextCounterState
|
|
449
|
+
previousHistogramState = nextHistogramState
|
|
450
|
+
previousFrequencyState = nextFrequencyState
|
|
451
|
+
previousSummaryState = nextSummaryState
|
|
452
|
+
previousExportTimeNanos = nowNanos
|
|
453
|
+
committedSnapshotSequence = currentSnapshotSequence
|
|
454
|
+
})
|
|
455
|
+
: Effect.void
|
|
456
|
+
return [body, onSuccess]
|
|
443
457
|
}
|
|
444
458
|
|
|
445
459
|
yield* Exporter.make({
|
|
@@ -217,7 +217,7 @@ export type ErrorTypeId = "~@effect/experimental/PersistedQueue/PersistedQueueEr
|
|
|
217
217
|
* @category errors
|
|
218
218
|
* @since 4.0.0
|
|
219
219
|
*/
|
|
220
|
-
export class PersistedQueueError extends Schema.
|
|
220
|
+
export class PersistedQueueError extends Schema.Error<PersistedQueueError>(
|
|
221
221
|
"effect/persistence/PersistedQueue/PersistedQueueError"
|
|
222
222
|
)({
|
|
223
223
|
_tag: Schema.tag("PersistedQueueError"),
|
|
@@ -294,9 +294,9 @@ export const layerStoreMemory: Layer.Layer<
|
|
|
294
294
|
attempts: number
|
|
295
295
|
readonly element: unknown
|
|
296
296
|
}
|
|
297
|
-
const ids = new Set<string>()
|
|
298
297
|
const queues = new Map<string, {
|
|
299
298
|
latch: Latch.Latch
|
|
299
|
+
ids: Set<string>
|
|
300
300
|
items: Set<Entry>
|
|
301
301
|
}>()
|
|
302
302
|
const getOrCreateQueue = (name: string) => {
|
|
@@ -304,6 +304,7 @@ export const layerStoreMemory: Layer.Layer<
|
|
|
304
304
|
if (!queue) {
|
|
305
305
|
queue = {
|
|
306
306
|
latch: Latch.makeUnsafe(false),
|
|
307
|
+
ids: new Set(),
|
|
307
308
|
items: new Set()
|
|
308
309
|
}
|
|
309
310
|
queues.set(name, queue)
|
|
@@ -314,9 +315,9 @@ export const layerStoreMemory: Layer.Layer<
|
|
|
314
315
|
return PersistedQueueStore.of({
|
|
315
316
|
offer: (options) =>
|
|
316
317
|
Effect.sync(() => {
|
|
317
|
-
if (ids.has(options.id)) return
|
|
318
|
-
ids.add(options.id)
|
|
319
318
|
const queue = getOrCreateQueue(options.name)
|
|
319
|
+
if (queue.ids.has(options.id)) return
|
|
320
|
+
queue.ids.add(options.id)
|
|
320
321
|
queue.items.add({ id: options.id, attempts: 0, element: options.element })
|
|
321
322
|
queue.latch.openUnsafe()
|
|
322
323
|
}),
|
|
@@ -857,9 +858,11 @@ export const makeStoreSql: (
|
|
|
857
858
|
yield* sql.onDialectOrElse({
|
|
858
859
|
mssql: () =>
|
|
859
860
|
sql`IF NOT EXISTS (SELECT * FROM sys.indexes WHERE name = N'idx_${tableName}_id')
|
|
860
|
-
CREATE UNIQUE INDEX idx_${tableNameSql}_id ON ${tableNameSql} (id)`,
|
|
861
|
-
mysql: () =>
|
|
862
|
-
|
|
861
|
+
CREATE UNIQUE INDEX idx_${tableNameSql}_id ON ${tableNameSql} (id, queue_name)`,
|
|
862
|
+
mysql: () =>
|
|
863
|
+
sql`CREATE UNIQUE INDEX ${sql(`idx_${tableName}_id`)} ON ${tableNameSql} (id, queue_name)`.pipe(Effect.ignore),
|
|
864
|
+
orElse: () =>
|
|
865
|
+
sql`CREATE UNIQUE INDEX IF NOT EXISTS ${sql(`idx_${tableName}_id`)} ON ${tableNameSql} (id, queue_name)`
|
|
863
866
|
})
|
|
864
867
|
|
|
865
868
|
yield* sql.onDialectOrElse({
|
|
@@ -894,7 +897,7 @@ export const makeStoreSql: (
|
|
|
894
897
|
sql`
|
|
895
898
|
INSERT INTO ${tableNameSql} (id, queue_name, element, completed, attempts, created_at, updated_at)
|
|
896
899
|
VALUES (${id}, ${name}, ${element}, FALSE, 0, ${sqlNow}, ${sqlNow})
|
|
897
|
-
ON CONFLICT (id) DO NOTHING
|
|
900
|
+
ON CONFLICT (id, queue_name) DO NOTHING
|
|
898
901
|
`,
|
|
899
902
|
mysql: () => (id: string, name: string, element: string) =>
|
|
900
903
|
sql`
|
|
@@ -903,7 +906,7 @@ export const makeStoreSql: (
|
|
|
903
906
|
`,
|
|
904
907
|
mssql: () => (id: string, name: string, element: string) =>
|
|
905
908
|
sql`
|
|
906
|
-
IF NOT EXISTS (SELECT 1 FROM ${tableNameSql} WHERE id = ${id})
|
|
909
|
+
IF NOT EXISTS (SELECT 1 FROM ${tableNameSql} WHERE id = ${id} AND queue_name = ${name})
|
|
907
910
|
BEGIN
|
|
908
911
|
INSERT INTO ${tableNameSql} (id, queue_name, element, completed, attempts, created_at, updated_at)
|
|
909
912
|
VALUES (${id}, ${name}, ${element}, 0, 0, ${sqlNow}, ${sqlNow})
|
|
@@ -35,7 +35,7 @@ const ErrorTypeId = "~effect/persistence/Persistence/PersistenceError" as const
|
|
|
35
35
|
* @category errors
|
|
36
36
|
* @since 4.0.0
|
|
37
37
|
*/
|
|
38
|
-
export class PersistenceError extends Schema.
|
|
38
|
+
export class PersistenceError extends Schema.Error<PersistenceError>(ErrorTypeId)({
|
|
39
39
|
_tag: Schema.tag("PersistenceError"),
|
|
40
40
|
message: Schema.String,
|
|
41
41
|
cause: Schema.optional(Schema.Defect())
|
|
@@ -304,7 +304,8 @@ export const layerBackingSqlMultiTable: Layer.Layer<
|
|
|
304
304
|
return BackingPersistence.of({
|
|
305
305
|
make: Effect.fnUntraced(function*(storeId) {
|
|
306
306
|
const clock = yield* Clock.Clock
|
|
307
|
-
const
|
|
307
|
+
const tableName = `effect_persistence_${storeId}`
|
|
308
|
+
const table = sql(tableName)
|
|
308
309
|
yield* sql.onDialectOrElse({
|
|
309
310
|
mysql: () =>
|
|
310
311
|
sql`
|
|
@@ -324,7 +325,7 @@ export const layerBackingSqlMultiTable: Layer.Layer<
|
|
|
324
325
|
`,
|
|
325
326
|
mssql: () =>
|
|
326
327
|
sql`
|
|
327
|
-
IF NOT EXISTS (SELECT * FROM sysobjects WHERE name=${
|
|
328
|
+
IF NOT EXISTS (SELECT * FROM sysobjects WHERE name=${tableName} AND xtype='U')
|
|
328
329
|
CREATE TABLE ${table} (
|
|
329
330
|
id NVARCHAR(450) PRIMARY KEY,
|
|
330
331
|
value NVARCHAR(MAX) NOT NULL,
|
|
@@ -362,6 +363,20 @@ export const layerBackingSqlMultiTable: Layer.Layer<
|
|
|
362
363
|
INSERT INTO ${table} ${sql.insert(entries)}
|
|
363
364
|
ON DUPLICATE KEY UPDATE value=VALUES(value), expires=VALUES(expires)
|
|
364
365
|
`.unprepared,
|
|
366
|
+
mssql: (): UpsertFn => (entries) =>
|
|
367
|
+
Effect.forEach(
|
|
368
|
+
entries,
|
|
369
|
+
(entry) =>
|
|
370
|
+
sql`
|
|
371
|
+
MERGE ${table} AS target
|
|
372
|
+
USING (SELECT ${entry.id} AS id, ${entry.value} AS value, ${entry.expires} AS expires) AS source
|
|
373
|
+
ON target.id = source.id
|
|
374
|
+
WHEN MATCHED THEN UPDATE SET value = source.value, expires = source.expires
|
|
375
|
+
WHEN NOT MATCHED THEN INSERT (id, value, expires)
|
|
376
|
+
VALUES (source.id, source.value, source.expires);
|
|
377
|
+
`,
|
|
378
|
+
{ discard: true }
|
|
379
|
+
),
|
|
365
380
|
// sqlite
|
|
366
381
|
orElse: (): UpsertFn => (entries) =>
|
|
367
382
|
sql`
|
|
@@ -538,7 +553,7 @@ export const layerBackingSql: Layer.Layer<
|
|
|
538
553
|
`,
|
|
539
554
|
mssql: () =>
|
|
540
555
|
sql`
|
|
541
|
-
IF NOT EXISTS (SELECT * FROM sysobjects WHERE name=${
|
|
556
|
+
IF NOT EXISTS (SELECT * FROM sysobjects WHERE name=${"effect_persistence"} AND xtype='U')
|
|
542
557
|
CREATE TABLE ${table} (
|
|
543
558
|
store_id NVARCHAR(191) NOT NULL,
|
|
544
559
|
id NVARCHAR(191) NOT NULL,
|
|
@@ -928,7 +943,13 @@ export const layerBackingRedis: Layer.Layer<
|
|
|
928
943
|
Effect.mapError(
|
|
929
944
|
ttl === undefined
|
|
930
945
|
? redis.send("SET", prefixed(key), JSON.stringify(value))
|
|
931
|
-
: redis.send(
|
|
946
|
+
: redis.send(
|
|
947
|
+
"SET",
|
|
948
|
+
prefixed(key),
|
|
949
|
+
JSON.stringify(value),
|
|
950
|
+
"PX",
|
|
951
|
+
String(Math.ceil(Duration.toMillis(ttl)))
|
|
952
|
+
),
|
|
932
953
|
({ cause }) =>
|
|
933
954
|
new PersistenceError({
|
|
934
955
|
message: `Failed to set key ${key} in Redis`,
|
|
@@ -943,7 +964,7 @@ export const layerBackingRedis: Layer.Layer<
|
|
|
943
964
|
const pkey = prefixed(key)
|
|
944
965
|
sets.set(pkey, JSON.stringify(value))
|
|
945
966
|
if (ttl) {
|
|
946
|
-
expires.set(pkey, Duration.toMillis(ttl))
|
|
967
|
+
expires.set(pkey, Math.ceil(Duration.toMillis(ttl)))
|
|
947
968
|
}
|
|
948
969
|
}
|
|
949
970
|
return Effect.mapError(
|
|
@@ -1090,7 +1111,6 @@ export const layerBackingKvs: Layer.Layer<
|
|
|
1090
1111
|
setMany: (entries) =>
|
|
1091
1112
|
Effect.forEach(entries, ([key, value, ttl]) => {
|
|
1092
1113
|
const expires = unsafeTtlToExpires(clock, ttl)
|
|
1093
|
-
if (expires === null) return Effect.void
|
|
1094
1114
|
const encoded = JSON.stringify([value, expires])
|
|
1095
1115
|
return store.set(key, encoded)
|
|
1096
1116
|
}, { concurrency: "unbounded", discard: true }).pipe(
|
|
@@ -285,7 +285,7 @@ export const makeWithRateLimiter: Effect.Effect<
|
|
|
285
285
|
)
|
|
286
286
|
|
|
287
287
|
/**
|
|
288
|
-
*
|
|
288
|
+
* Sleeps when the rate limit is exceeded.
|
|
289
289
|
*
|
|
290
290
|
* **Example** (Sleeping until rate limit permits)
|
|
291
291
|
*
|
|
@@ -294,52 +294,75 @@ export const makeWithRateLimiter: Effect.Effect<
|
|
|
294
294
|
* import { RateLimiter } from "effect/unstable/persistence"
|
|
295
295
|
*
|
|
296
296
|
* const program = Effect.gen(function*() {
|
|
297
|
-
*
|
|
298
|
-
* const
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
*
|
|
302
|
-
*
|
|
303
|
-
*
|
|
297
|
+
* const limiter = yield* RateLimiter.RateLimiter
|
|
298
|
+
* const partiallyApplied = RateLimiter.sleep(limiter)
|
|
299
|
+
* const partial = yield* partiallyApplied({
|
|
300
|
+
* key: "partial",
|
|
301
|
+
* limit: 10,
|
|
302
|
+
* window: "5 seconds",
|
|
303
|
+
* algorithm: "fixed-window"
|
|
304
|
+
* })
|
|
305
|
+
* const direct = yield* RateLimiter.sleep(limiter, {
|
|
306
|
+
* key: "direct",
|
|
304
307
|
* limit: 10,
|
|
305
308
|
* window: "5 seconds",
|
|
306
309
|
* algorithm: "fixed-window"
|
|
307
310
|
* })
|
|
308
|
-
* return
|
|
311
|
+
* return [partial.remaining, direct.remaining]
|
|
309
312
|
* }).pipe(
|
|
310
313
|
* Effect.provide(RateLimiter.layer.pipe(Layer.provide(RateLimiter.layerStoreMemory)))
|
|
311
314
|
* )
|
|
312
315
|
*
|
|
313
|
-
* await Effect.runPromise(program) // => 9
|
|
316
|
+
* await Effect.runPromise(program) // => [9, 9]
|
|
314
317
|
* ```
|
|
315
318
|
*
|
|
316
319
|
* @category accessors
|
|
317
320
|
* @since 4.0.0
|
|
318
321
|
*/
|
|
319
|
-
export
|
|
320
|
-
|
|
322
|
+
export function sleep(self: RateLimiter): (options: {
|
|
323
|
+
readonly algorithm?: "fixed-window" | "token-bucket" | undefined
|
|
324
|
+
readonly window: Duration.Input
|
|
325
|
+
readonly limit: number
|
|
326
|
+
readonly key: string
|
|
327
|
+
readonly tokens?: number | undefined
|
|
328
|
+
}) => Effect.Effect<ConsumeResult, RateLimiterError>
|
|
329
|
+
export function sleep(self: RateLimiter, options: {
|
|
330
|
+
readonly algorithm?: "fixed-window" | "token-bucket" | undefined
|
|
331
|
+
readonly window: Duration.Input
|
|
332
|
+
readonly limit: number
|
|
333
|
+
readonly key: string
|
|
334
|
+
readonly tokens?: number | undefined
|
|
335
|
+
}): Effect.Effect<ConsumeResult, RateLimiterError>
|
|
336
|
+
export function sleep(self: RateLimiter, options?: {
|
|
337
|
+
readonly algorithm?: "fixed-window" | "token-bucket" | undefined
|
|
338
|
+
readonly window: Duration.Input
|
|
339
|
+
readonly limit: number
|
|
340
|
+
readonly key: string
|
|
341
|
+
readonly tokens?: number | undefined
|
|
342
|
+
}):
|
|
343
|
+
| Effect.Effect<ConsumeResult, RateLimiterError>
|
|
344
|
+
| ((options: {
|
|
321
345
|
readonly algorithm?: "fixed-window" | "token-bucket" | undefined
|
|
322
346
|
readonly window: Duration.Input
|
|
323
347
|
readonly limit: number
|
|
324
348
|
readonly key: string
|
|
325
349
|
readonly tokens?: number | undefined
|
|
326
|
-
}) => Effect.Effect<ConsumeResult, RateLimiterError>)
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
)
|
|
350
|
+
}) => Effect.Effect<ConsumeResult, RateLimiterError>)
|
|
351
|
+
{
|
|
352
|
+
if (options === undefined) {
|
|
353
|
+
return (options) => sleep(self, options)
|
|
354
|
+
}
|
|
355
|
+
return Effect.flatMap(
|
|
356
|
+
self.consume({
|
|
357
|
+
...options,
|
|
358
|
+
onExceeded: "delay"
|
|
359
|
+
}),
|
|
360
|
+
(result) => {
|
|
361
|
+
if (Duration.isZero(result.delay)) return Effect.succeed(result)
|
|
362
|
+
return Effect.as(Effect.sleep(result.delay), result)
|
|
363
|
+
}
|
|
341
364
|
)
|
|
342
|
-
|
|
365
|
+
}
|
|
343
366
|
|
|
344
367
|
/**
|
|
345
368
|
* Runtime type identifier for `RateLimiterError`.
|
|
@@ -367,7 +390,7 @@ export type ErrorTypeId = "~@effect/experimental/RateLimiter/RateLimiterError"
|
|
|
367
390
|
* @category errors
|
|
368
391
|
* @since 4.0.0
|
|
369
392
|
*/
|
|
370
|
-
export class RateLimitExceeded extends Schema.
|
|
393
|
+
export class RateLimitExceeded extends Schema.Error<RateLimitExceeded>(
|
|
371
394
|
"effect/persistence/RateLimiter/RateLimitExceeded"
|
|
372
395
|
)({
|
|
373
396
|
_tag: Schema.tag("RateLimitExceeded"),
|
|
@@ -392,7 +415,7 @@ export class RateLimitExceeded extends Schema.ErrorClass<RateLimitExceeded>(
|
|
|
392
415
|
* @category errors
|
|
393
416
|
* @since 4.0.0
|
|
394
417
|
*/
|
|
395
|
-
export class RateLimitStoreError extends Schema.
|
|
418
|
+
export class RateLimitStoreError extends Schema.Error<RateLimitStoreError>(
|
|
396
419
|
"effect/persistence/RateLimiter/RateLimitStoreError"
|
|
397
420
|
)({
|
|
398
421
|
_tag: Schema.tag("RateLimitStoreError"),
|
|
@@ -426,7 +449,7 @@ export const RateLimiterErrorReason: Schema.Union<[
|
|
|
426
449
|
* @category errors
|
|
427
450
|
* @since 4.0.0
|
|
428
451
|
*/
|
|
429
|
-
export class RateLimiterError extends Schema.
|
|
452
|
+
export class RateLimiterError extends Schema.Error<RateLimiterError>(ErrorTypeId)({
|
|
430
453
|
_tag: Schema.tag("RateLimiterError"),
|
|
431
454
|
reason: RateLimiterErrorReason
|
|
432
455
|
}) {
|
|
@@ -100,7 +100,7 @@ const ErrorTypeId: ErrorTypeId = "~effect/persistence/Redis/RedisError"
|
|
|
100
100
|
* @category errors
|
|
101
101
|
* @since 4.0.0
|
|
102
102
|
*/
|
|
103
|
-
export class RedisError extends Schema.
|
|
103
|
+
export class RedisError extends Schema.Error<RedisError>(ErrorTypeId)({
|
|
104
104
|
_tag: Schema.tag("RedisError"),
|
|
105
105
|
cause: Schema.Defect()
|
|
106
106
|
}) {
|