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
package/src/SchemaAST.ts
CHANGED
|
@@ -532,7 +532,7 @@ export const defaultParseOptions: ParseOptions = {}
|
|
|
532
532
|
*
|
|
533
533
|
* - `isOptional` — the property key may be absent from the input.
|
|
534
534
|
* - `isMutable` — the property is `readonly` when `false`.
|
|
535
|
-
* - `
|
|
535
|
+
* - `constructorDefault` — a {@link Link} applied during construction to
|
|
536
536
|
* supply missing values.
|
|
537
537
|
* - `annotations` — key-level annotations (e.g. description of the key
|
|
538
538
|
* itself).
|
|
@@ -546,19 +546,19 @@ export class Context {
|
|
|
546
546
|
readonly isOptional: boolean
|
|
547
547
|
readonly isMutable: boolean
|
|
548
548
|
/** Used for constructor default values (e.g. `withConstructorDefault` API) */
|
|
549
|
-
readonly
|
|
549
|
+
readonly constructorDefault: Link | undefined
|
|
550
550
|
readonly annotations: Schema.Annotations.Key<unknown> | undefined
|
|
551
551
|
|
|
552
552
|
constructor(
|
|
553
553
|
isOptional: boolean,
|
|
554
554
|
isMutable: boolean,
|
|
555
555
|
/** Used for constructor default values (e.g. `withConstructorDefault` API) */
|
|
556
|
-
|
|
556
|
+
constructorDefault: Link | undefined = undefined,
|
|
557
557
|
annotations: Schema.Annotations.Key<unknown> | undefined = undefined
|
|
558
558
|
) {
|
|
559
559
|
this.isOptional = isOptional
|
|
560
560
|
this.isMutable = isMutable
|
|
561
|
-
this.
|
|
561
|
+
this.constructorDefault = constructorDefault
|
|
562
562
|
this.annotations = annotations
|
|
563
563
|
}
|
|
564
564
|
}
|
|
@@ -1141,8 +1141,8 @@ export class TemplateLiteral extends Base {
|
|
|
1141
1141
|
this.suffixLengths = suffixLengths
|
|
1142
1142
|
}
|
|
1143
1143
|
/** @internal */
|
|
1144
|
-
getParser(
|
|
1145
|
-
const parser =
|
|
1144
|
+
getParser(compile: SchemaParser.Compiler): SchemaParser.Parser {
|
|
1145
|
+
const parser = compile(this.asTemplateLiteralParser())
|
|
1146
1146
|
return (input, options) => {
|
|
1147
1147
|
if (input === InternalParser.missing) return InternalParser.missingExit
|
|
1148
1148
|
const result = parser(input, options)
|
|
@@ -1684,7 +1684,10 @@ export class Arrays extends Base {
|
|
|
1684
1684
|
}
|
|
1685
1685
|
}
|
|
1686
1686
|
/** @internal */
|
|
1687
|
-
getParser(
|
|
1687
|
+
getParser(
|
|
1688
|
+
compile: SchemaParser.Compiler,
|
|
1689
|
+
compileConstructorDefault: SchemaParser.Compiler = compile
|
|
1690
|
+
): SchemaParser.Parser {
|
|
1688
1691
|
// oxlint-disable-next-line @typescript-eslint/no-this-alias
|
|
1689
1692
|
const ast = this
|
|
1690
1693
|
type ElementParser = { readonly ast: AST; readonly parser: SchemaParser.Parser }
|
|
@@ -1715,8 +1718,8 @@ export class Arrays extends Base {
|
|
|
1715
1718
|
return yield* Effect.fail(new SchemaIssue.InvalidType(ast))
|
|
1716
1719
|
}
|
|
1717
1720
|
if (!elements) {
|
|
1718
|
-
elements = ast.elements.map((ast) => ({ ast, parser:
|
|
1719
|
-
rest = ast.rest.map((ast) => ({ ast, parser:
|
|
1721
|
+
elements = ast.elements.map((ast) => ({ ast, parser: compileConstructorDefault(ast) }))
|
|
1722
|
+
rest = ast.rest.map((ast) => ({ ast, parser: compileConstructorDefault(ast) }))
|
|
1720
1723
|
}
|
|
1721
1724
|
|
|
1722
1725
|
const len = input.length
|
|
@@ -2076,7 +2079,10 @@ export class Objects extends Base {
|
|
|
2076
2079
|
}
|
|
2077
2080
|
}
|
|
2078
2081
|
/** @internal */
|
|
2079
|
-
getParser(
|
|
2082
|
+
getParser(
|
|
2083
|
+
compile: SchemaParser.Compiler,
|
|
2084
|
+
compileConstructorDefault: SchemaParser.Compiler = compile
|
|
2085
|
+
): SchemaParser.Parser {
|
|
2080
2086
|
// oxlint-disable-next-line @typescript-eslint/no-this-alias
|
|
2081
2087
|
const ast = this
|
|
2082
2088
|
const expectedKeys: Array<PropertyKey> = []
|
|
@@ -2175,15 +2181,15 @@ export class Objects extends Base {
|
|
|
2175
2181
|
}
|
|
2176
2182
|
if (!properties) {
|
|
2177
2183
|
properties = ast.propertySignatures.map((ps) => ({
|
|
2178
|
-
parser:
|
|
2184
|
+
parser: compileConstructorDefault(ps.type),
|
|
2179
2185
|
name: ps.name,
|
|
2180
2186
|
type: ps.type
|
|
2181
2187
|
}))
|
|
2182
2188
|
indexes = indexCount
|
|
2183
2189
|
? ast.indexSignatures.map((is) => ({
|
|
2184
2190
|
is,
|
|
2185
|
-
parserKey:
|
|
2186
|
-
parserValue:
|
|
2191
|
+
parserKey: compile(parameterFromPropertyKey(is.parameter)),
|
|
2192
|
+
parserValue: compileConstructorDefault(is.type)
|
|
2187
2193
|
}))
|
|
2188
2194
|
: undefined
|
|
2189
2195
|
}
|
|
@@ -2577,7 +2583,7 @@ export function collectSentinels(ast: AST): Array<Sentinel> {
|
|
|
2577
2583
|
}
|
|
2578
2584
|
|
|
2579
2585
|
type CandidateIndex =
|
|
2580
|
-
| ((input: any) => ReadonlyArray<AST>)
|
|
2586
|
+
| ((input: any, isConstructor: boolean) => ReadonlyArray<AST>)
|
|
2581
2587
|
| {
|
|
2582
2588
|
bySentinel?: Map<PropertyKey, Map<LiteralValue | symbol, Array<number>>>
|
|
2583
2589
|
otherwise?: { [K in Type]?: Array<number> }
|
|
@@ -2636,10 +2642,14 @@ function getIndex(types: ReadonlyArray<AST>): CandidateIndex {
|
|
|
2636
2642
|
for (const [literal, indexes] of byValue) {
|
|
2637
2643
|
candidates.set(literal, Object.freeze(indexes.map((index) => types[index])))
|
|
2638
2644
|
}
|
|
2639
|
-
idx = (input) =>
|
|
2640
|
-
Predicate.isObjectKeyword(input)
|
|
2641
|
-
|
|
2642
|
-
|
|
2645
|
+
idx = (input, isConstructor) => {
|
|
2646
|
+
if (Predicate.isObjectKeyword(input)) {
|
|
2647
|
+
const value = Object.hasOwn(input, key) ? (input as any)[key] : undefined
|
|
2648
|
+
if (value !== undefined) return candidates.get(value) ?? emptyCandidates
|
|
2649
|
+
if (isConstructor) return types
|
|
2650
|
+
}
|
|
2651
|
+
return emptyCandidates
|
|
2652
|
+
}
|
|
2643
2653
|
}
|
|
2644
2654
|
}
|
|
2645
2655
|
|
|
@@ -2664,9 +2674,13 @@ function filterLiterals(input: any) {
|
|
|
2664
2674
|
*
|
|
2665
2675
|
* @internal
|
|
2666
2676
|
*/
|
|
2667
|
-
export function getCandidates(
|
|
2677
|
+
export function getCandidates(
|
|
2678
|
+
input: any,
|
|
2679
|
+
types: ReadonlyArray<AST>,
|
|
2680
|
+
isConstructor = false
|
|
2681
|
+
): ReadonlyArray<AST> {
|
|
2668
2682
|
const idx = getIndex(types)
|
|
2669
|
-
if (typeof idx === "function") return idx(input)
|
|
2683
|
+
if (typeof idx === "function") return idx(input, isConstructor)
|
|
2670
2684
|
|
|
2671
2685
|
const runtimeType: Type = input === null ? "null" : Array.isArray(input) ? "array" : typeof input
|
|
2672
2686
|
|
|
@@ -2676,11 +2690,16 @@ export function getCandidates(input: any, types: ReadonlyArray<AST>): ReadonlyAr
|
|
|
2676
2690
|
if (Predicate.isObjectKeyword(input)) {
|
|
2677
2691
|
const selected = new Set(base)
|
|
2678
2692
|
for (const [k, m] of idx.bySentinel) {
|
|
2679
|
-
|
|
2680
|
-
|
|
2693
|
+
const value = Object.hasOwn(input, k) ? (input as any)[k] : undefined
|
|
2694
|
+
if (value !== undefined) {
|
|
2695
|
+
const match = m.get(value)
|
|
2681
2696
|
if (match) {
|
|
2682
2697
|
for (const candidate of match) selected.add(candidate)
|
|
2683
2698
|
}
|
|
2699
|
+
} else if (isConstructor) {
|
|
2700
|
+
for (const indexes of m.values()) {
|
|
2701
|
+
for (const candidate of indexes) selected.add(candidate)
|
|
2702
|
+
}
|
|
2684
2703
|
}
|
|
2685
2704
|
}
|
|
2686
2705
|
return Array.from(selected).sort((a, b) => a - b).map((i) => types[i])
|
|
@@ -2743,7 +2762,10 @@ export class Union<A extends AST = AST> extends Base {
|
|
|
2743
2762
|
this.encodingChecks = encodingChecks
|
|
2744
2763
|
}
|
|
2745
2764
|
/** @internal */
|
|
2746
|
-
getParser(
|
|
2765
|
+
getParser(
|
|
2766
|
+
compile: SchemaParser.Compiler,
|
|
2767
|
+
compileConstructorDefault?: SchemaParser.Compiler
|
|
2768
|
+
): SchemaParser.Parser {
|
|
2747
2769
|
// oxlint-disable-next-line @typescript-eslint/no-this-alias
|
|
2748
2770
|
const ast = this
|
|
2749
2771
|
|
|
@@ -2751,10 +2773,10 @@ export class Union<A extends AST = AST> extends Base {
|
|
|
2751
2773
|
if (input === InternalParser.missing) {
|
|
2752
2774
|
return InternalParser.missingExit
|
|
2753
2775
|
}
|
|
2754
|
-
const candidates = getCandidates(input, ast.types)
|
|
2776
|
+
const candidates = getCandidates(input, ast.types, compileConstructorDefault !== undefined)
|
|
2755
2777
|
|
|
2756
2778
|
if (candidates.length === 1) {
|
|
2757
|
-
const result =
|
|
2779
|
+
const result = compile(candidates[0])(input, options)
|
|
2758
2780
|
if ((result as Exit.Exit<unknown, SchemaIssue.Issue>)._tag === "Success") return result
|
|
2759
2781
|
return effectIsExit(result)
|
|
2760
2782
|
? failSingleUnionCandidate(ast, (result as Exit.Failure<unknown, SchemaIssue.Issue>).cause)
|
|
@@ -2763,7 +2785,7 @@ export class Union<A extends AST = AST> extends Base {
|
|
|
2763
2785
|
|
|
2764
2786
|
const state = {
|
|
2765
2787
|
ast,
|
|
2766
|
-
|
|
2788
|
+
compile,
|
|
2767
2789
|
input,
|
|
2768
2790
|
out: undefined,
|
|
2769
2791
|
successes: ast.mode === "oneOf" ? [] : undefined,
|
|
@@ -2854,7 +2876,7 @@ function failSingleUnionCandidate(
|
|
|
2854
2876
|
}
|
|
2855
2877
|
|
|
2856
2878
|
const parseUnion = iterateEager<{
|
|
2857
|
-
readonly
|
|
2879
|
+
readonly compile: (ast: AST) => SchemaParser.Parser
|
|
2858
2880
|
readonly ast: Union
|
|
2859
2881
|
readonly input: unknown
|
|
2860
2882
|
readonly options: ParseOptions
|
|
@@ -2863,7 +2885,7 @@ const parseUnion = iterateEager<{
|
|
|
2863
2885
|
issues: Array<SchemaIssue.Issue> | undefined
|
|
2864
2886
|
}, AST>()({
|
|
2865
2887
|
onItem(s, ast) {
|
|
2866
|
-
const parser = s.
|
|
2888
|
+
const parser = s.compile(ast)
|
|
2867
2889
|
return parser(s.input, s.options)
|
|
2868
2890
|
},
|
|
2869
2891
|
step(s, candidate, exit) {
|
|
@@ -2966,9 +2988,9 @@ export class Suspend extends Base {
|
|
|
2966
2988
|
this.thunk = memoizeThunk(thunk)
|
|
2967
2989
|
}
|
|
2968
2990
|
/** @internal */
|
|
2969
|
-
getParser(
|
|
2991
|
+
getParser(compile: SchemaParser.Compiler): SchemaParser.Parser {
|
|
2970
2992
|
let parser: SchemaParser.Parser
|
|
2971
|
-
return (input, options) => (parser ??=
|
|
2993
|
+
return (input, options) => (parser ??= compile(this.thunk()))(input, options)
|
|
2972
2994
|
}
|
|
2973
2995
|
/** @internal */
|
|
2974
2996
|
recur(recur: (ast: AST) => AST) {
|
|
@@ -3364,7 +3386,7 @@ export function annotateKey<A extends AST>(ast: A, annotations: Schema.Annotatio
|
|
|
3364
3386
|
new Context(
|
|
3365
3387
|
ast.context.isOptional,
|
|
3366
3388
|
ast.context.isMutable,
|
|
3367
|
-
ast.context.
|
|
3389
|
+
ast.context.constructorDefault,
|
|
3368
3390
|
{ ...ast.context.annotations, ...annotations }
|
|
3369
3391
|
) :
|
|
3370
3392
|
new Context(false, false, undefined, annotations)
|
|
@@ -3390,7 +3412,7 @@ const optionalKeyLastLink = applyToLastLink(optionalKey)
|
|
|
3390
3412
|
export function optionalKey<A extends AST>(ast: A): A {
|
|
3391
3413
|
const context = ast.context ?
|
|
3392
3414
|
ast.context.isOptional === false ?
|
|
3393
|
-
new Context(true, ast.context.isMutable, ast.context.
|
|
3415
|
+
new Context(true, ast.context.isMutable, ast.context.constructorDefault, ast.context.annotations) :
|
|
3394
3416
|
ast.context :
|
|
3395
3417
|
new Context(true, false)
|
|
3396
3418
|
return optionalKeyLastLink(replaceContext(ast, context))
|
|
@@ -3402,7 +3424,7 @@ const mutableKeyLastLink = applyToLastLink(mutableKey)
|
|
|
3402
3424
|
export function mutableKey<A extends AST>(ast: A): A {
|
|
3403
3425
|
const context = ast.context ?
|
|
3404
3426
|
ast.context.isMutable === false ?
|
|
3405
|
-
new Context(ast.context.isOptional, true, ast.context.
|
|
3427
|
+
new Context(ast.context.isOptional, true, ast.context.constructorDefault, ast.context.annotations) :
|
|
3406
3428
|
ast.context :
|
|
3407
3429
|
new Context(false, true)
|
|
3408
3430
|
return mutableKeyLastLink(replaceContext(ast, context))
|
|
@@ -3417,10 +3439,10 @@ export function withConstructorDefault<A extends AST>(
|
|
|
3417
3439
|
SchemaGetter.withDefault(defaultValue),
|
|
3418
3440
|
SchemaGetter.passthrough()
|
|
3419
3441
|
)
|
|
3420
|
-
const
|
|
3442
|
+
const constructorDefault = new Link(unknown, transformation)
|
|
3421
3443
|
const context = ast.context ?
|
|
3422
|
-
new Context(ast.context.isOptional, ast.context.isMutable,
|
|
3423
|
-
new Context(false, false,
|
|
3444
|
+
new Context(ast.context.isOptional, ast.context.isMutable, constructorDefault, ast.context.annotations) :
|
|
3445
|
+
new Context(false, false, constructorDefault)
|
|
3424
3446
|
return replaceContext(ast, context)
|
|
3425
3447
|
}
|
|
3426
3448
|
|
|
@@ -3949,7 +3971,17 @@ export function runChecks<T>(
|
|
|
3949
3971
|
}
|
|
3950
3972
|
|
|
3951
3973
|
/** @internal */
|
|
3952
|
-
export
|
|
3974
|
+
export interface ConstructorDescriptor {
|
|
3975
|
+
readonly isConstructed: Predicate.Predicate<unknown>
|
|
3976
|
+
readonly link: Link
|
|
3977
|
+
}
|
|
3978
|
+
|
|
3979
|
+
/** @internal */
|
|
3980
|
+
export function getConstructorDescriptor(ast: AST): ConstructorDescriptor | undefined {
|
|
3981
|
+
if (!isDeclaration(ast)) return undefined
|
|
3982
|
+
const getDescriptor = ast.annotations?.[InternalAnnotations.CONSTRUCTOR_ANNOTATION_KEY]
|
|
3983
|
+
return Predicate.isFunction(getDescriptor) ? getDescriptor(ast.typeParameters) : undefined
|
|
3984
|
+
}
|
|
3953
3985
|
|
|
3954
3986
|
/**
|
|
3955
3987
|
* Returns all annotations from the AST node.
|
package/src/SchemaParser.ts
CHANGED
|
@@ -18,41 +18,11 @@ import { effectIsExit } from "./internal/effect.ts"
|
|
|
18
18
|
import * as InternalSchemaCause from "./internal/schema/cause.ts"
|
|
19
19
|
import * as InternalParser from "./internal/schema/parser.ts"
|
|
20
20
|
import * as Option from "./Option.ts"
|
|
21
|
-
import * as Predicate from "./Predicate.ts"
|
|
22
21
|
import * as Result from "./Result.ts"
|
|
23
22
|
import type * as Schema from "./Schema.ts"
|
|
24
23
|
import * as SchemaAST from "./SchemaAST.ts"
|
|
25
24
|
import * as SchemaIssue from "./SchemaIssue.ts"
|
|
26
25
|
|
|
27
|
-
// Converts a type-side AST into its constructor form by recursively restoring
|
|
28
|
-
// constructor encodings for nested classes and fields with constructor defaults.
|
|
29
|
-
const toConstructorAST = memoize((ast: SchemaAST.AST): SchemaAST.AST => {
|
|
30
|
-
switch (ast._tag) {
|
|
31
|
-
case "Declaration": {
|
|
32
|
-
const getLink = ast.annotations?.[SchemaAST.ClassTypeId]
|
|
33
|
-
if (Predicate.isFunction(getLink)) {
|
|
34
|
-
const link = getLink(ast.typeParameters)
|
|
35
|
-
return SchemaAST.replaceEncoding(ast, [SchemaAST.mapLink(link, toConstructorAST)])
|
|
36
|
-
}
|
|
37
|
-
return ast
|
|
38
|
-
}
|
|
39
|
-
case "Objects":
|
|
40
|
-
case "Arrays":
|
|
41
|
-
return ast.recur((ast) => {
|
|
42
|
-
const defaultValue = ast.context?.defaultValue
|
|
43
|
-
if (defaultValue) {
|
|
44
|
-
const out = toConstructorAST(ast)
|
|
45
|
-
return SchemaAST.replaceEncoding(out, out.encoding ? [...out.encoding, ...defaultValue] : defaultValue)
|
|
46
|
-
}
|
|
47
|
-
return toConstructorAST(ast)
|
|
48
|
-
})
|
|
49
|
-
case "Suspend":
|
|
50
|
-
return ast.recur(toConstructorAST)
|
|
51
|
-
default:
|
|
52
|
-
return ast
|
|
53
|
-
}
|
|
54
|
-
})
|
|
55
|
-
|
|
56
26
|
/**
|
|
57
27
|
* Creates an effectful maker for the schema's decoded type side.
|
|
58
28
|
*
|
|
@@ -71,8 +41,7 @@ const toConstructorAST = memoize((ast: SchemaAST.AST): SchemaAST.AST => {
|
|
|
71
41
|
* @since 4.0.0
|
|
72
42
|
*/
|
|
73
43
|
export function makeEffect<S extends Schema.Constraint>(schema: S) {
|
|
74
|
-
const
|
|
75
|
-
const parser = run<S["Type"], never>(ast)
|
|
44
|
+
const parser = runWithCompiler<S["Type"], never>(constructorCompiler, SchemaAST.toType(schema.ast))
|
|
76
45
|
return (input: S["~type.make.in"], options?: Schema.MakeOptions): Effect.Effect<S["Type"], SchemaIssue.Issue> => {
|
|
77
46
|
return parser(
|
|
78
47
|
input,
|
|
@@ -923,9 +892,13 @@ const getValue = (value: unknown): Effect.Effect<any, SchemaIssue.Issue> => {
|
|
|
923
892
|
|
|
924
893
|
/** @internal */
|
|
925
894
|
export function run<T, R>(ast: SchemaAST.AST) {
|
|
895
|
+
return runWithCompiler<T, R>(normalCompiler, ast)
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
function runWithCompiler<T, R>(compiler: Compiler, ast: SchemaAST.AST) {
|
|
926
899
|
let parser: Parser
|
|
927
900
|
return (input: unknown, options?: SchemaAST.ParseOptions): Effect.Effect<T, SchemaIssue.Issue, R> => {
|
|
928
|
-
const result = (parser ??=
|
|
901
|
+
const result = (parser ??= compiler(ast))(
|
|
929
902
|
input,
|
|
930
903
|
options ?? SchemaAST.defaultParseOptions
|
|
931
904
|
)
|
|
@@ -1016,20 +989,79 @@ export interface Parser {
|
|
|
1016
989
|
): Effect.Effect<unknown, SchemaIssue.Issue, any>
|
|
1017
990
|
}
|
|
1018
991
|
|
|
1019
|
-
|
|
992
|
+
/** @internal */
|
|
993
|
+
export interface Compiler {
|
|
994
|
+
(ast: SchemaAST.AST): Parser
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
const normalCompiler: Compiler = memoize((ast) => makeParser(ast, normalCompiler))
|
|
998
|
+
const constructorCompiler: Compiler = memoize((ast) => makeParser(ast, constructorCompiler, compileConstructorDefault))
|
|
999
|
+
const compileDefaulted = memoize((ast: SchemaAST.AST) =>
|
|
1000
|
+
makeParser(ast, constructorCompiler, compileConstructorDefault, ast.context?.constructorDefault)
|
|
1001
|
+
)
|
|
1002
|
+
|
|
1003
|
+
function compileConstructorDefault(ast: SchemaAST.AST): Parser {
|
|
1004
|
+
return ast.context?.constructorDefault ? compileDefaulted(ast) : constructorCompiler(ast)
|
|
1005
|
+
}
|
|
1020
1006
|
|
|
1021
|
-
function
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1007
|
+
function applyTransformation(
|
|
1008
|
+
result: Effect.Effect<unknown, SchemaIssue.Issue, unknown>,
|
|
1009
|
+
current: unknown,
|
|
1010
|
+
transformation: SchemaAST.Link["transformation"],
|
|
1011
|
+
options: SchemaAST.ParseOptions
|
|
1012
|
+
): Effect.Effect<unknown, SchemaIssue.Issue, unknown> {
|
|
1013
|
+
let transformed: Effect.Effect<Option.Option<unknown>, SchemaIssue.Issue, unknown>
|
|
1014
|
+
if (effectIsExit(result) && result._tag === "Success") {
|
|
1015
|
+
const optional = InternalParser.toOption(
|
|
1016
|
+
result === InternalParser.sameExit
|
|
1017
|
+
? current
|
|
1018
|
+
: (result as InternalParser.Success<unknown, SchemaIssue.Issue>)[InternalParser.args]
|
|
1019
|
+
)
|
|
1020
|
+
transformed = transformation._tag === "Transformation"
|
|
1021
|
+
? transformation.decode.run(optional, options)
|
|
1022
|
+
: transformation.decode(InternalParser.succeed(optional), options)
|
|
1023
|
+
} else if (transformation._tag === "Transformation") {
|
|
1024
|
+
transformed = Effect.flatMapEager(
|
|
1025
|
+
result,
|
|
1026
|
+
(value) => transformation.decode.run(InternalParser.toOption(value), options)
|
|
1027
|
+
)
|
|
1028
|
+
} else {
|
|
1029
|
+
transformed = transformation.decode(
|
|
1030
|
+
Effect.mapEager(result, InternalParser.toOption),
|
|
1031
|
+
options
|
|
1032
|
+
)
|
|
1025
1033
|
}
|
|
1026
|
-
return
|
|
1034
|
+
return effectIsExit(transformed) && transformed._tag === "Success"
|
|
1035
|
+
? InternalParser.fromOptionExit(
|
|
1036
|
+
(transformed as InternalParser.Success<Option.Option<unknown>, SchemaIssue.Issue>)[InternalParser.args]
|
|
1037
|
+
)
|
|
1038
|
+
: Effect.flatMapEager(transformed, InternalParser.fromOptionExit)
|
|
1027
1039
|
}
|
|
1028
1040
|
|
|
1029
|
-
function
|
|
1030
|
-
|
|
1041
|
+
function makeConstructorParser(descriptor: SchemaAST.ConstructorDescriptor, compile: Compiler): Parser {
|
|
1042
|
+
let sourceParser: Parser
|
|
1043
|
+
return (input, options) => {
|
|
1044
|
+
if (input === InternalParser.missing) return InternalParser.missingExit
|
|
1045
|
+
if (descriptor.isConstructed(input)) return InternalParser.sameExit
|
|
1046
|
+
const result = (sourceParser ??= compile(descriptor.link.to))(input, options)
|
|
1047
|
+
return applyTransformation(result, input, descriptor.link.transformation, options)
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
function makeParser(
|
|
1052
|
+
ast: SchemaAST.AST,
|
|
1053
|
+
compile: Compiler,
|
|
1054
|
+
compileConstructorDefault?: Compiler,
|
|
1055
|
+
constructorDefault?: SchemaAST.Link
|
|
1056
|
+
): Parser {
|
|
1057
|
+
const descriptor = compileConstructorDefault ? SchemaAST.getConstructorDescriptor(ast) : undefined
|
|
1058
|
+
const parser = descriptor
|
|
1059
|
+
? makeConstructorParser(descriptor, compile)
|
|
1060
|
+
: ast.getParser(compile, compileConstructorDefault)
|
|
1031
1061
|
const checks = ast.checks
|
|
1032
|
-
const links =
|
|
1062
|
+
const links = constructorDefault
|
|
1063
|
+
? ast.encoding ? [...ast.encoding, constructorDefault] : [constructorDefault]
|
|
1064
|
+
: ast.encoding
|
|
1033
1065
|
const encodingChecks = (ast as any).encodingChecks
|
|
1034
1066
|
const astOptions = (checks ? checks[checks.length - 1].annotations : ast.annotations)
|
|
1035
1067
|
?.["parseOptions"]
|
|
@@ -1122,33 +1154,7 @@ function makeParser(ast: SchemaAST.AST): Parser {
|
|
|
1122
1154
|
let current = input
|
|
1123
1155
|
let result = parsers[parsers.length - 1](input, options)
|
|
1124
1156
|
for (let i = links.length - 1; i >= 0; i--) {
|
|
1125
|
-
|
|
1126
|
-
let transformed: Effect.Effect<Option.Option<unknown>, SchemaIssue.Issue, unknown>
|
|
1127
|
-
if (effectIsExit(result) && result._tag === "Success") {
|
|
1128
|
-
const optional = InternalParser.toOption(
|
|
1129
|
-
result === InternalParser.sameExit
|
|
1130
|
-
? current
|
|
1131
|
-
: (result as InternalParser.Success<unknown, SchemaIssue.Issue>)[InternalParser.args]
|
|
1132
|
-
)
|
|
1133
|
-
transformed = transformation._tag === "Transformation"
|
|
1134
|
-
? transformation.decode.run(optional, options)
|
|
1135
|
-
: transformation.decode(InternalParser.succeed(optional), options)
|
|
1136
|
-
} else if (transformation._tag === "Transformation") {
|
|
1137
|
-
transformed = Effect.flatMapEager(
|
|
1138
|
-
result,
|
|
1139
|
-
(value) => transformation.decode.run(InternalParser.toOption(value), options)
|
|
1140
|
-
)
|
|
1141
|
-
} else {
|
|
1142
|
-
transformed = transformation.decode(
|
|
1143
|
-
Effect.mapEager(result, InternalParser.toOption),
|
|
1144
|
-
options
|
|
1145
|
-
)
|
|
1146
|
-
}
|
|
1147
|
-
result = effectIsExit(transformed) && transformed._tag === "Success"
|
|
1148
|
-
? InternalParser.fromOptionExit(
|
|
1149
|
-
(transformed as InternalParser.Success<Option.Option<unknown>, SchemaIssue.Issue>)[InternalParser.args]
|
|
1150
|
-
)
|
|
1151
|
-
: Effect.flatMapEager(transformed, InternalParser.fromOptionExit)
|
|
1157
|
+
result = applyTransformation(result, current, links[i].transformation, options)
|
|
1152
1158
|
if (i !== 0) {
|
|
1153
1159
|
const next = parsers[i - 1]
|
|
1154
1160
|
if ((result as Exit.Exit<unknown, unknown>)._tag === "Success") {
|
package/src/ScopedCache.ts
CHANGED
|
@@ -211,7 +211,7 @@ export const make = <
|
|
|
211
211
|
> =>
|
|
212
212
|
makeWith<Key, A, E, R, ServiceMode>({
|
|
213
213
|
...options,
|
|
214
|
-
timeToLive: options.timeToLive ? () => options.timeToLive! : defaultTimeToLive
|
|
214
|
+
timeToLive: options.timeToLive !== undefined ? () => options.timeToLive! : defaultTimeToLive
|
|
215
215
|
})
|
|
216
216
|
|
|
217
217
|
const Proto = {
|
package/src/Sink.ts
CHANGED
|
@@ -2529,7 +2529,7 @@ export const catchCause: {
|
|
|
2529
2529
|
const catch_: {
|
|
2530
2530
|
<E, A2, E2, R2>(
|
|
2531
2531
|
f: (error: Types.NoInfer<E>) => Effect.Effect<A2, E2, R2>
|
|
2532
|
-
): <A, In, L, R>(self: Sink<A, In, L, E, R>) => Sink<A2 | A, In, L,
|
|
2532
|
+
): <A, In, L, R>(self: Sink<A, In, L, E, R>) => Sink<A2 | A, In, L, E2, R2 | R>
|
|
2533
2533
|
<A, In, L, E, R, A2, E2, R2>(
|
|
2534
2534
|
self: Sink<A, In, L, E, R>,
|
|
2535
2535
|
f: (error: E) => Effect.Effect<A2, E2, R2>
|
package/src/Stream.ts
CHANGED
|
@@ -9657,6 +9657,13 @@ const retryWithoutReset = <A, E, R, X, E2, R2>(
|
|
|
9657
9657
|
* `preventFallbackOnPartialStream` to fail instead of mixing partial output with
|
|
9658
9658
|
* a later fallback.
|
|
9659
9659
|
*
|
|
9660
|
+
* Attempts can be observed from outside the stream by passing
|
|
9661
|
+
* `options.onEvent`, which receives an `ExecutionPlan.Event` before each
|
|
9662
|
+
* attempt and after it settles; see `Effect.withExecutionPlan` for the handler
|
|
9663
|
+
* semantics. When a downstream consumer stops pulling early (for example
|
|
9664
|
+
* `Stream.take` outside the plan), the truncated attempt reports
|
|
9665
|
+
* `AttemptSuccess`: the consumer stopped, not the source.
|
|
9666
|
+
*
|
|
9660
9667
|
* **Example** (Applying an execution plan)
|
|
9661
9668
|
*
|
|
9662
9669
|
* ```ts import.meta.vitest
|
|
@@ -9700,6 +9707,13 @@ export const withExecutionPlan: {
|
|
|
9700
9707
|
* `preventFallbackOnPartialStream` to fail instead of mixing partial output with
|
|
9701
9708
|
* a later fallback.
|
|
9702
9709
|
*
|
|
9710
|
+
* Attempts can be observed from outside the stream by passing
|
|
9711
|
+
* `options.onEvent`, which receives an `ExecutionPlan.Event` before each
|
|
9712
|
+
* attempt and after it settles; see `Effect.withExecutionPlan` for the handler
|
|
9713
|
+
* semantics. When a downstream consumer stops pulling early (for example
|
|
9714
|
+
* `Stream.take` outside the plan), the truncated attempt reports
|
|
9715
|
+
* `AttemptSuccess`: the consumer stopped, not the source.
|
|
9716
|
+
*
|
|
9703
9717
|
* **Example** (Applying an execution plan)
|
|
9704
9718
|
*
|
|
9705
9719
|
* ```ts import.meta.vitest
|
|
@@ -9732,10 +9746,13 @@ export const withExecutionPlan: {
|
|
|
9732
9746
|
* @category error handling
|
|
9733
9747
|
* @since 3.16.0
|
|
9734
9748
|
*/
|
|
9735
|
-
<Input, R2, Provides, PolicyE>(
|
|
9749
|
+
<Input, R2, Provides, PolicyE, RX = never>(
|
|
9736
9750
|
policy: ExecutionPlan.ExecutionPlan<{ provides: Provides; input: Input; error: PolicyE; requirements: R2 }>,
|
|
9737
|
-
options?: {
|
|
9738
|
-
|
|
9751
|
+
options?: {
|
|
9752
|
+
readonly preventFallbackOnPartialStream?: boolean | undefined
|
|
9753
|
+
readonly onEvent?: ((event: ExecutionPlan.Event<Input | PolicyE>) => Effect.Effect<void, never, RX>) | undefined
|
|
9754
|
+
}
|
|
9755
|
+
): <A, E extends Input, R>(self: Stream<A, E, R>) => Stream<A, E | PolicyE, R2 | Exclude<R, Provides> | RX>
|
|
9739
9756
|
/**
|
|
9740
9757
|
* Applies an `ExecutionPlan` to a stream, retrying with step-provided resources
|
|
9741
9758
|
* until it succeeds or the plan is exhausted.
|
|
@@ -9746,6 +9763,13 @@ export const withExecutionPlan: {
|
|
|
9746
9763
|
* `preventFallbackOnPartialStream` to fail instead of mixing partial output with
|
|
9747
9764
|
* a later fallback.
|
|
9748
9765
|
*
|
|
9766
|
+
* Attempts can be observed from outside the stream by passing
|
|
9767
|
+
* `options.onEvent`, which receives an `ExecutionPlan.Event` before each
|
|
9768
|
+
* attempt and after it settles; see `Effect.withExecutionPlan` for the handler
|
|
9769
|
+
* semantics. When a downstream consumer stops pulling early (for example
|
|
9770
|
+
* `Stream.take` outside the plan), the truncated attempt reports
|
|
9771
|
+
* `AttemptSuccess`: the consumer stopped, not the source.
|
|
9772
|
+
*
|
|
9749
9773
|
* **Example** (Applying an execution plan)
|
|
9750
9774
|
*
|
|
9751
9775
|
* ```ts import.meta.vitest
|
|
@@ -9778,12 +9802,15 @@ export const withExecutionPlan: {
|
|
|
9778
9802
|
* @category error handling
|
|
9779
9803
|
* @since 3.16.0
|
|
9780
9804
|
*/
|
|
9781
|
-
<A, E extends Input, R, R2, Input, Provides, PolicyE>(
|
|
9805
|
+
<A, E extends Input, R, R2, Input, Provides, PolicyE, RX = never>(
|
|
9782
9806
|
self: Stream<A, E, R>,
|
|
9783
9807
|
policy: ExecutionPlan.ExecutionPlan<{ provides: Provides; input: Input; error: PolicyE; requirements: R2 }>,
|
|
9784
|
-
options?: {
|
|
9785
|
-
|
|
9786
|
-
|
|
9808
|
+
options?: {
|
|
9809
|
+
readonly preventFallbackOnPartialStream?: boolean | undefined
|
|
9810
|
+
readonly onEvent?: ((event: ExecutionPlan.Event<E | PolicyE>) => Effect.Effect<void, never, RX>) | undefined
|
|
9811
|
+
}
|
|
9812
|
+
): Stream<A, E | PolicyE, R2 | Exclude<R, Provides> | RX>
|
|
9813
|
+
} = dual((args) => isStream(args[0]), <A, E extends Input, R, R2, Input, Provides, PolicyE, RX>(
|
|
9787
9814
|
self: Stream<A, E, R>,
|
|
9788
9815
|
policy: ExecutionPlan.ExecutionPlan<{
|
|
9789
9816
|
provides: Provides
|
|
@@ -9793,8 +9820,9 @@ export const withExecutionPlan: {
|
|
|
9793
9820
|
}>,
|
|
9794
9821
|
options?: {
|
|
9795
9822
|
readonly preventFallbackOnPartialStream?: boolean | undefined
|
|
9823
|
+
readonly onEvent?: ((event: ExecutionPlan.Event<E | PolicyE>) => Effect.Effect<void, never, RX>) | undefined
|
|
9796
9824
|
}
|
|
9797
|
-
): Stream<A, E | PolicyE, R2 | Exclude<R, Provides
|
|
9825
|
+
): Stream<A, E | PolicyE, R2 | Exclude<R, Provides> | RX> =>
|
|
9798
9826
|
suspend(() => {
|
|
9799
9827
|
const preventFallbackOnPartialStream = options?.preventFallbackOnPartialStream ?? false
|
|
9800
9828
|
let i = 0
|
|
@@ -9812,6 +9840,28 @@ export const withExecutionPlan: {
|
|
|
9812
9840
|
return meta
|
|
9813
9841
|
})
|
|
9814
9842
|
)
|
|
9843
|
+
const emitter = options?.onEvent === undefined
|
|
9844
|
+
? undefined
|
|
9845
|
+
: internalExecutionPlan.makeEventEmitter(options.onEvent, () => meta)
|
|
9846
|
+
let attemptState: internalExecutionPlan.AttemptState | undefined
|
|
9847
|
+
const instrument: (attempt: Stream<A, E | PolicyE, any>) => Stream<A, E | PolicyE, any> = emitter === undefined
|
|
9848
|
+
? identity
|
|
9849
|
+
: (attempt) =>
|
|
9850
|
+
onExit(
|
|
9851
|
+
onStart(
|
|
9852
|
+
attempt,
|
|
9853
|
+
Effect.map(emitter.begin, (state) => {
|
|
9854
|
+
attemptState = state
|
|
9855
|
+
})
|
|
9856
|
+
),
|
|
9857
|
+
(exit) =>
|
|
9858
|
+
Effect.suspend(() => {
|
|
9859
|
+
if (attemptState === undefined) return Effect.void
|
|
9860
|
+
const state = attemptState
|
|
9861
|
+
attemptState = undefined
|
|
9862
|
+
return emitter.end(state, exit)
|
|
9863
|
+
})
|
|
9864
|
+
)
|
|
9815
9865
|
let lastError = Option.none</**
|
|
9816
9866
|
* Applies an `ExecutionPlan` to a stream, retrying with step-provided resources
|
|
9817
9867
|
* until it succeeds or the plan is exhausted.
|
|
@@ -9822,6 +9872,13 @@ export const withExecutionPlan: {
|
|
|
9822
9872
|
* `preventFallbackOnPartialStream` to fail instead of mixing partial output with
|
|
9823
9873
|
* a later fallback.
|
|
9824
9874
|
*
|
|
9875
|
+
* Attempts can be observed from outside the stream by passing
|
|
9876
|
+
* `options.onEvent`, which receives an `ExecutionPlan.Event` before each
|
|
9877
|
+
* attempt and after it settles; see `Effect.withExecutionPlan` for the handler
|
|
9878
|
+
* semantics. When a downstream consumer stops pulling early (for example
|
|
9879
|
+
* `Stream.take` outside the plan), the truncated attempt reports
|
|
9880
|
+
* `AttemptSuccess`: the consumer stopped, not the source.
|
|
9881
|
+
*
|
|
9825
9882
|
* **Example** (Applying an execution plan)
|
|
9826
9883
|
*
|
|
9827
9884
|
* ```ts import.meta.vitest
|
|
@@ -9865,7 +9922,9 @@ export const withExecutionPlan: {
|
|
|
9865
9922
|
return fail(Option.getOrThrow(lastError))
|
|
9866
9923
|
}
|
|
9867
9924
|
|
|
9868
|
-
let nextStream: Stream<A, E | PolicyE, R2 | Exclude<R, Provides>> = provideMeta(
|
|
9925
|
+
let nextStream: Stream<A, E | PolicyE, R2 | Exclude<R, Provides>> = provideMeta(
|
|
9926
|
+
instrument(provide(self, step.provide))
|
|
9927
|
+
)
|
|
9869
9928
|
let receivedElements = false
|
|
9870
9929
|
|
|
9871
9930
|
if (Option.isSome(lastError)) {
|
|
@@ -11776,12 +11835,18 @@ export const slidingSize: {
|
|
|
11776
11835
|
*/
|
|
11777
11836
|
A>()
|
|
11778
11837
|
let emitted = false
|
|
11838
|
+
let skip = 0
|
|
11779
11839
|
const pull: Pull.Pull<
|
|
11780
11840
|
Arr.NonEmptyReadonlyArray<Arr.NonEmptyReadonlyArray<A>>,
|
|
11781
11841
|
E | Cause.Done
|
|
11782
11842
|
> = Effect.matchCauseEffect(upstream, {
|
|
11783
11843
|
onSuccess(arr) {
|
|
11784
11844
|
MutableList.appendAllUnsafe(list, arr)
|
|
11845
|
+
if (skip > 0) {
|
|
11846
|
+
const length = list.length
|
|
11847
|
+
MutableList.takeNVoid(list, skip)
|
|
11848
|
+
skip = Math.max(0, skip - length)
|
|
11849
|
+
}
|
|
11785
11850
|
if (list.length < chunkSize) return pull
|
|
11786
11851
|
emitted = true
|
|
11787
11852
|
const chunks = [] as any as Arr.NonEmptyArray<Arr.NonEmptyReadonlyArray<A>>
|
|
@@ -11790,10 +11855,12 @@ export const slidingSize: {
|
|
|
11790
11855
|
chunks.push(MutableList.takeN(list, chunkSize) as any)
|
|
11791
11856
|
} else {
|
|
11792
11857
|
chunks.push(MutableList.toArrayN(list, chunkSize) as any)
|
|
11793
|
-
if (chunkSize === 1) {
|
|
11858
|
+
if (chunkSize === 1 && stepSize <= 0) {
|
|
11794
11859
|
MutableList.take(list)
|
|
11795
11860
|
} else {
|
|
11861
|
+
const length = list.length
|
|
11796
11862
|
MutableList.takeNVoid(list, stepSize)
|
|
11863
|
+
skip = Math.max(0, stepSize - length)
|
|
11797
11864
|
}
|
|
11798
11865
|
}
|
|
11799
11866
|
}
|
package/src/SynchronizedRef.ts
CHANGED
|
@@ -358,7 +358,7 @@ export const getAndUpdateSome: {
|
|
|
358
358
|
} = dual(
|
|
359
359
|
2,
|
|
360
360
|
<A>(self: SynchronizedRef<A>, pf: (a: A) => Option.Option<A>): Effect.Effect<A> =>
|
|
361
|
-
self.semaphore.withPermit(Ref.getAndUpdateSome(self, pf))
|
|
361
|
+
self.semaphore.withPermit(Ref.getAndUpdateSome(self.backing, pf))
|
|
362
362
|
)
|
|
363
363
|
|
|
364
364
|
/**
|