effect 4.0.0-beta.103 → 4.0.0-beta.105
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/AGENTS.md +381 -0
- package/CLAUDE.md +381 -0
- package/ai-docs/README.md +44 -0
- package/ai-docs/package.json +36 -0
- package/ai-docs/src/01_effect/01_basics/01_effect-gen.ts +30 -0
- package/ai-docs/src/01_effect/01_basics/02_effect-fn.ts +39 -0
- package/ai-docs/src/01_effect/01_basics/10_creating-effects.ts +74 -0
- package/ai-docs/src/01_effect/01_basics/index.md +5 -0
- package/ai-docs/src/01_effect/02_schema/10_schema-basics.ts +43 -0
- package/ai-docs/src/01_effect/02_schema/index.md +7 -0
- package/ai-docs/src/01_effect/03_services/01_service.ts +45 -0
- package/ai-docs/src/01_effect/03_services/10_reference.ts +10 -0
- package/ai-docs/src/01_effect/03_services/20_layer-composition.ts +70 -0
- package/ai-docs/src/01_effect/03_services/20_layer-unwrap.ts +66 -0
- package/ai-docs/src/01_effect/03_services/index.md +5 -0
- package/ai-docs/src/01_effect/04_errors/01_error-handling.ts +30 -0
- package/ai-docs/src/01_effect/04_errors/10_catch-tags.ts +24 -0
- package/ai-docs/src/01_effect/04_errors/20_reason-errors.ts +64 -0
- package/ai-docs/src/01_effect/04_errors/index.md +1 -0
- package/ai-docs/src/01_effect/05_resources/10_acquire-release.ts +105 -0
- package/ai-docs/src/01_effect/05_resources/20_layer-side-effects.ts +31 -0
- package/ai-docs/src/01_effect/05_resources/30_layer-map.ts +86 -0
- package/ai-docs/src/01_effect/05_resources/index.md +3 -0
- package/ai-docs/src/01_effect/06_running/10_run-main.ts +30 -0
- package/ai-docs/src/01_effect/06_running/20_layer-launch.ts +27 -0
- package/ai-docs/src/01_effect/06_running/index.md +1 -0
- package/ai-docs/src/01_effect/07_pubsub/10_pubsub.ts +56 -0
- package/ai-docs/src/01_effect/07_pubsub/index.md +3 -0
- package/ai-docs/src/03_stream/10_creating-streams.ts +103 -0
- package/ai-docs/src/03_stream/20_consuming-streams.ts +137 -0
- package/ai-docs/src/03_stream/30_encoding.ts +165 -0
- package/ai-docs/src/03_stream/index.md +4 -0
- package/ai-docs/src/04_integration/10_managed-runtime.ts +129 -0
- package/ai-docs/src/04_integration/index.md +5 -0
- package/ai-docs/src/05_batching/10_request-resolver.ts +89 -0
- package/ai-docs/src/05_batching/index.md +3 -0
- package/ai-docs/src/06_schedule/10_schedules.ts +110 -0
- package/ai-docs/src/06_schedule/index.md +3 -0
- package/ai-docs/src/07_datetime/10_creating-and-formatting.ts +30 -0
- package/ai-docs/src/07_datetime/20_time-zones.ts +44 -0
- package/ai-docs/src/07_datetime/index.md +5 -0
- package/ai-docs/src/08_observability/10_logging.ts +66 -0
- package/ai-docs/src/08_observability/20_otlp-tracing.ts +95 -0
- package/ai-docs/src/08_observability/index.md +7 -0
- package/ai-docs/src/09_testing/10_effect-tests.ts +55 -0
- package/ai-docs/src/09_testing/20_layer-tests.ts +138 -0
- package/ai-docs/src/09_testing/index.md +1 -0
- package/ai-docs/src/10_predicate/01_basics.ts +14 -0
- package/ai-docs/src/10_predicate/index.md +9 -0
- package/ai-docs/src/50_http-client/10_basics.ts +102 -0
- package/ai-docs/src/50_http-client/index.md +3 -0
- package/ai-docs/src/51_http-server/10_basics.ts +116 -0
- package/ai-docs/src/51_http-server/fixtures/api/Api.ts +14 -0
- package/ai-docs/src/51_http-server/fixtures/api/Authorization.ts +36 -0
- package/ai-docs/src/51_http-server/fixtures/api/System.ts +10 -0
- package/ai-docs/src/51_http-server/fixtures/api/Users.ts +91 -0
- package/ai-docs/src/51_http-server/fixtures/domain/User.ts +12 -0
- package/ai-docs/src/51_http-server/fixtures/domain/UserErrors.ts +22 -0
- package/ai-docs/src/51_http-server/fixtures/server/Authorization.ts +36 -0
- package/ai-docs/src/51_http-server/fixtures/server/Users/http.ts +71 -0
- package/ai-docs/src/51_http-server/fixtures/server/Users.ts +62 -0
- package/ai-docs/src/51_http-server/index.md +3 -0
- package/ai-docs/src/60_child-process/10_working-with-child-processes.ts +117 -0
- package/ai-docs/src/60_child-process/index.md +3 -0
- package/ai-docs/src/70_cli/10_basics.ts +136 -0
- package/ai-docs/src/70_cli/index.md +5 -0
- package/ai-docs/src/71_ai/10_language-model.ts +156 -0
- package/ai-docs/src/71_ai/20_tools.ts +226 -0
- package/ai-docs/src/71_ai/30_chat.ts +158 -0
- package/ai-docs/src/71_ai/fixtures/domain/LaunchPlan.ts +9 -0
- package/ai-docs/src/71_ai/index.md +5 -0
- package/ai-docs/src/80_cluster/10_entities.ts +97 -0
- package/ai-docs/src/80_cluster/index.md +4 -0
- package/ai-docs/src/index.md +10 -0
- package/ai-docs/tsconfig.json +24 -0
- package/dist/Brand.d.ts +3 -3
- package/dist/Brand.d.ts.map +1 -1
- package/dist/Brand.js +4 -3
- package/dist/Brand.js.map +1 -1
- 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 +30 -8
- 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 -3
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js +1 -22
- package/dist/Context.js.map +1 -1
- package/dist/Cron.d.ts +31 -0
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +58 -2
- package/dist/Cron.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/Optic.d.ts +35 -21
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js +33 -34
- package/dist/Optic.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 +105 -57
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +105 -67
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +33 -3
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +87 -63
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaError.d.ts +8 -8
- package/dist/SchemaError.d.ts.map +1 -1
- package/dist/SchemaError.js +7 -6
- package/dist/SchemaError.js.map +1 -1
- package/dist/SchemaGetter.d.ts +8 -5
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +41 -37
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaIssue.d.ts +195 -38
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js +243 -68
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.d.ts +30 -0
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +74 -62
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +2 -2
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +26 -26
- package/dist/SchemaTransformation.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/Stdio.d.ts +17 -4
- package/dist/Stdio.d.ts.map +1 -1
- package/dist/Stdio.js +6 -3
- package/dist/Stdio.js.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/schema.js +1 -9
- package/dist/internal/schema/schema.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 +2 -2
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/testing/TestSchema.js +8 -7
- package/dist/testing/TestSchema.js.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 +10 -7
- 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 +16 -4
- 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 +27 -13
- 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/HttpClient.d.ts +59 -3
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +33 -19
- package/dist/unstable/http/HttpClient.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 +73 -20
- 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 +74 -34
- 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/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.js +4 -4
- package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +26 -11
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +9 -22
- package/dist/unstable/reactivity/Atom.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 +21 -10
- 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/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +3 -2
- package/dist/unstable/rpc/RpcServer.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/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js +2 -2
- package/dist/unstable/workflow/Workflow.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 +6 -9
- package/src/Brand.ts +4 -4
- package/src/Cache.ts +1 -1
- package/src/Channel.ts +1 -1
- package/src/Config.ts +31 -8
- package/src/ConfigProvider.ts +4 -1
- package/src/Context.ts +6 -28
- package/src/Cron.ts +65 -2
- 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/Optic.ts +59 -58
- package/src/Schedule.ts +13 -13
- package/src/Schema.ts +195 -112
- package/src/SchemaAST.ts +154 -85
- package/src/SchemaError.ts +9 -9
- package/src/SchemaGetter.ts +89 -30
- package/src/SchemaIssue.ts +285 -80
- package/src/SchemaParser.ts +126 -86
- package/src/SchemaTransformation.ts +66 -18
- package/src/ScopedCache.ts +1 -1
- package/src/Sink.ts +1 -1
- package/src/Stdio.ts +23 -4
- 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/schema.ts +1 -17
- 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 +9 -9
- 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 +35 -10
- 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 +25 -4
- 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 +59 -36
- 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/HttpClient.ts +132 -23
- 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 +142 -25
- package/src/unstable/httpapi/HttpApiClient.ts +130 -49
- 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/reactivity/AsyncResult.ts +11 -6
- package/src/unstable/reactivity/Atom.ts +44 -25
- package/src/unstable/rpc/RpcClient.ts +42 -13
- package/src/unstable/rpc/RpcClientError.ts +2 -2
- package/src/unstable/rpc/RpcSerialization.ts +1 -1
- package/src/unstable/rpc/RpcServer.ts +4 -2
- 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/Workflow.ts +2 -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/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
|
/**
|
package/src/Terminal.ts
CHANGED
|
@@ -121,7 +121,7 @@ const QuitErrorTypeId = "effect/platform/Terminal/QuitError"
|
|
|
121
121
|
* @category errors
|
|
122
122
|
* @since 4.0.0
|
|
123
123
|
*/
|
|
124
|
-
export class QuitError extends Schema.
|
|
124
|
+
export class QuitError extends Schema.Error<QuitError>("QuitError")({
|
|
125
125
|
_tag: Schema.tag("QuitError")
|
|
126
126
|
}) {
|
|
127
127
|
/**
|
package/src/Tuple.ts
CHANGED
|
@@ -43,7 +43,8 @@ import type { Apply, Lambda } from "./Struct.ts"
|
|
|
43
43
|
* @category constructors
|
|
44
44
|
* @since 2.0.0
|
|
45
45
|
*/
|
|
46
|
-
export const make = <Elements extends ReadonlyArray<unknown>>(...elements: Elements): Elements =>
|
|
46
|
+
export const make = <const Elements extends ReadonlyArray<unknown>>(...elements: [...Elements]): [...Elements] =>
|
|
47
|
+
elements
|
|
47
48
|
|
|
48
49
|
type Indices<T extends ReadonlyArray<unknown>> = Exclude<Partial<T>["length"], T["length"]>
|
|
49
50
|
|
|
@@ -138,7 +139,9 @@ type _BuildTuple<
|
|
|
138
139
|
[...I, unknown]
|
|
139
140
|
>
|
|
140
141
|
|
|
141
|
-
type PickTuple<T extends ReadonlyArray<unknown>,
|
|
142
|
+
type PickTuple<T extends ReadonlyArray<unknown>, I extends ReadonlyArray<Indices<T>>> = {
|
|
143
|
+
-readonly [K in keyof I]: T[I[K] & keyof T]
|
|
144
|
+
}
|
|
142
145
|
|
|
143
146
|
/**
|
|
144
147
|
* Creates a new tuple containing only the elements at the specified indices.
|
|
@@ -189,7 +192,7 @@ export const pick: {
|
|
|
189
192
|
* @category filtering
|
|
190
193
|
* @since 4.0.0
|
|
191
194
|
*/
|
|
192
|
-
<const T extends ReadonlyArray<unknown>, const I extends ReadonlyArray<Indices<T>>>(indices: I): (self: T) => PickTuple<T, I
|
|
195
|
+
<const T extends ReadonlyArray<unknown>, const I extends ReadonlyArray<Indices<T>>>(indices: I): (self: T) => PickTuple<T, I>
|
|
193
196
|
/**
|
|
194
197
|
* Creates a new tuple containing only the elements at the specified indices.
|
|
195
198
|
*
|
|
@@ -214,7 +217,7 @@ export const pick: {
|
|
|
214
217
|
* @category filtering
|
|
215
218
|
* @since 4.0.0
|
|
216
219
|
*/
|
|
217
|
-
<const T extends ReadonlyArray<unknown>, const I extends ReadonlyArray<Indices<T>>>(self: T, indices: I): PickTuple<T, I
|
|
220
|
+
<const T extends ReadonlyArray<unknown>, const I extends ReadonlyArray<Indices<T>>>(self: T, indices: I): PickTuple<T, I>
|
|
218
221
|
} = dual(
|
|
219
222
|
2,
|
|
220
223
|
<const T extends ReadonlyArray<unknown>>(
|
package/src/TxReentrantLock.ts
CHANGED
|
@@ -266,24 +266,24 @@ export const acquireWrite = (self: TxReentrantLock): Effect.Effect<number> =>
|
|
|
266
266
|
* @category mutations
|
|
267
267
|
* @since 2.0.0
|
|
268
268
|
*/
|
|
269
|
-
|
|
270
|
-
Effect.
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
const fiberId = fiber.id
|
|
274
|
-
const currentCount = Option.getOrElse(HashMap.get(state.readers, fiberId), () => 0)
|
|
269
|
+
const releaseReadFor = (self: TxReentrantLock, fiberId: number): Effect.Effect<number> =>
|
|
270
|
+
Effect.gen(function*() {
|
|
271
|
+
const state = yield* TxRef.get(self.stateRef)
|
|
272
|
+
const currentCount = Option.getOrElse(HashMap.get(state.readers, fiberId), () => 0)
|
|
275
273
|
|
|
276
|
-
|
|
274
|
+
if (currentCount <= 0) return 0
|
|
277
275
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
276
|
+
const newCount = currentCount - 1
|
|
277
|
+
const newReaders = newCount === 0
|
|
278
|
+
? HashMap.remove(state.readers, fiberId)
|
|
279
|
+
: HashMap.set(state.readers, fiberId, newCount)
|
|
282
280
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
281
|
+
yield* TxRef.set(self.stateRef, { ...state, readers: newReaders })
|
|
282
|
+
return newCount
|
|
283
|
+
}).pipe(Effect.tx)
|
|
284
|
+
|
|
285
|
+
export const releaseRead = (self: TxReentrantLock): Effect.Effect<number> =>
|
|
286
|
+
Effect.withFiber((fiber) => releaseReadFor(self, fiber.id))
|
|
287
287
|
|
|
288
288
|
/**
|
|
289
289
|
* Releases one write lock held by the current fiber.
|
|
@@ -313,23 +313,23 @@ export const releaseRead = (self: TxReentrantLock): Effect.Effect<number> =>
|
|
|
313
313
|
* @category mutations
|
|
314
314
|
* @since 2.0.0
|
|
315
315
|
*/
|
|
316
|
-
|
|
317
|
-
Effect.
|
|
318
|
-
|
|
319
|
-
const state = yield* TxRef.get(self.stateRef)
|
|
320
|
-
const fiberId = fiber.id
|
|
316
|
+
const releaseWriteFor = (self: TxReentrantLock, fiberId: number): Effect.Effect<number> =>
|
|
317
|
+
Effect.gen(function*() {
|
|
318
|
+
const state = yield* TxRef.get(self.stateRef)
|
|
321
319
|
|
|
322
|
-
|
|
320
|
+
if (Option.isNone(state.writer) || state.writer.value[0] !== fiberId) return 0
|
|
323
321
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
322
|
+
const newCount = state.writer.value[1] - 1
|
|
323
|
+
const newWriter = newCount <= 0
|
|
324
|
+
? Option.none<readonly [number, number]>()
|
|
325
|
+
: Option.some([fiberId, newCount] as const)
|
|
328
326
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
327
|
+
yield* TxRef.set(self.stateRef, { ...state, writer: newWriter })
|
|
328
|
+
return newCount
|
|
329
|
+
}).pipe(Effect.tx)
|
|
330
|
+
|
|
331
|
+
export const releaseWrite = (self: TxReentrantLock): Effect.Effect<number> =>
|
|
332
|
+
Effect.withFiber((fiber) => releaseWriteFor(self, fiber.id))
|
|
333
333
|
|
|
334
334
|
/**
|
|
335
335
|
* Acquires a read lock for the duration of the scope.
|
|
@@ -361,9 +361,11 @@ export const releaseWrite = (self: TxReentrantLock): Effect.Effect<number> =>
|
|
|
361
361
|
* @since 2.0.0
|
|
362
362
|
*/
|
|
363
363
|
export const readLock = (self: TxReentrantLock): Effect.Effect<number, never, Scope.Scope> =>
|
|
364
|
-
Effect.
|
|
365
|
-
|
|
366
|
-
|
|
364
|
+
Effect.withFiber((fiber) =>
|
|
365
|
+
Effect.acquireRelease(
|
|
366
|
+
acquireRead(self),
|
|
367
|
+
() => releaseReadFor(self, fiber.id)
|
|
368
|
+
)
|
|
367
369
|
)
|
|
368
370
|
|
|
369
371
|
/**
|
|
@@ -396,9 +398,11 @@ export const readLock = (self: TxReentrantLock): Effect.Effect<number, never, Sc
|
|
|
396
398
|
* @since 2.0.0
|
|
397
399
|
*/
|
|
398
400
|
export const writeLock = (self: TxReentrantLock): Effect.Effect<number, never, Scope.Scope> =>
|
|
399
|
-
Effect.
|
|
400
|
-
|
|
401
|
-
|
|
401
|
+
Effect.withFiber((fiber) =>
|
|
402
|
+
Effect.acquireRelease(
|
|
403
|
+
acquireWrite(self),
|
|
404
|
+
() => releaseWriteFor(self, fiber.id)
|
|
405
|
+
)
|
|
402
406
|
)
|
|
403
407
|
|
|
404
408
|
/**
|
package/src/internal/dateTime.ts
CHANGED
|
@@ -221,7 +221,7 @@ export const makeUnsafe = <A extends DateTime.DateTime.Input>(input: A): DateTim
|
|
|
221
221
|
return fromDateUnsafe(input) as DateTime.DateTime.PreserveZone<A>
|
|
222
222
|
} else if (typeof input === "object") {
|
|
223
223
|
if ("epochMilliseconds" in input) {
|
|
224
|
-
return
|
|
224
|
+
return fromDateUnsafe(new Date(input.epochMilliseconds)) as DateTime.DateTime.PreserveZone<A>
|
|
225
225
|
}
|
|
226
226
|
const date = new Date(0)
|
|
227
227
|
setPartsDate(date, input)
|
|
@@ -1,47 +1,131 @@
|
|
|
1
|
+
import * as Duration from "../Duration.ts"
|
|
1
2
|
import type { Effect } from "../Effect.ts"
|
|
2
3
|
import * as Api from "../ExecutionPlan.ts"
|
|
3
|
-
import
|
|
4
|
+
import type * as Exit from "../Exit.ts"
|
|
5
|
+
import { dual, identity } from "../Function.ts"
|
|
4
6
|
import * as Result from "../Result.ts"
|
|
5
7
|
import * as Schedule from "../Schedule.ts"
|
|
8
|
+
import { isEffect } from "./core.ts"
|
|
6
9
|
import * as effect from "./effect.ts"
|
|
7
10
|
import * as internalLayer from "./layer.ts"
|
|
8
11
|
import * as internalSchedule from "./schedule.ts"
|
|
9
12
|
|
|
13
|
+
/** @internal */
|
|
14
|
+
export interface AttemptState {
|
|
15
|
+
readonly attempt: number
|
|
16
|
+
readonly stepAttempt: number
|
|
17
|
+
readonly stepIndex: number
|
|
18
|
+
readonly startNanos: bigint
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** @internal */
|
|
22
|
+
export interface EventEmitter {
|
|
23
|
+
readonly begin: Effect<AttemptState, never, any>
|
|
24
|
+
readonly end: (state: AttemptState, exit: Exit.Exit<any, any>) => Effect<void, never, any>
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** @internal */
|
|
28
|
+
export const makeEventEmitter = (
|
|
29
|
+
onEvent: (event: Api.Event<any>) => Effect<void, never, any>,
|
|
30
|
+
currentMetadata: () => Api.Metadata
|
|
31
|
+
): EventEmitter => {
|
|
32
|
+
let lastStepIndex = -1
|
|
33
|
+
let stepAttempt = 0
|
|
34
|
+
return {
|
|
35
|
+
begin: effect.clockWith((clock) =>
|
|
36
|
+
effect.suspend(() => {
|
|
37
|
+
const meta = currentMetadata()
|
|
38
|
+
if (meta.stepIndex !== lastStepIndex) {
|
|
39
|
+
lastStepIndex = meta.stepIndex
|
|
40
|
+
stepAttempt = 0
|
|
41
|
+
}
|
|
42
|
+
stepAttempt++
|
|
43
|
+
const state: AttemptState = {
|
|
44
|
+
attempt: meta.attempt,
|
|
45
|
+
stepAttempt,
|
|
46
|
+
stepIndex: meta.stepIndex,
|
|
47
|
+
startNanos: clock.monotonicTimeNanosUnsafe()
|
|
48
|
+
}
|
|
49
|
+
return effect.as(
|
|
50
|
+
onEvent({
|
|
51
|
+
_tag: "AttemptStart",
|
|
52
|
+
attempt: state.attempt,
|
|
53
|
+
stepAttempt: state.stepAttempt,
|
|
54
|
+
stepIndex: state.stepIndex
|
|
55
|
+
}),
|
|
56
|
+
state
|
|
57
|
+
)
|
|
58
|
+
})
|
|
59
|
+
),
|
|
60
|
+
end: (state, exit) =>
|
|
61
|
+
effect.clockWith((clock) => {
|
|
62
|
+
const duration = Duration.nanos(clock.monotonicTimeNanosUnsafe() - state.startNanos)
|
|
63
|
+
return onEvent(
|
|
64
|
+
exit._tag === "Success"
|
|
65
|
+
? {
|
|
66
|
+
_tag: "AttemptSuccess",
|
|
67
|
+
attempt: state.attempt,
|
|
68
|
+
stepAttempt: state.stepAttempt,
|
|
69
|
+
stepIndex: state.stepIndex,
|
|
70
|
+
duration
|
|
71
|
+
}
|
|
72
|
+
: {
|
|
73
|
+
_tag: "AttemptFailure",
|
|
74
|
+
attempt: state.attempt,
|
|
75
|
+
stepAttempt: state.stepAttempt,
|
|
76
|
+
stepIndex: state.stepIndex,
|
|
77
|
+
duration,
|
|
78
|
+
cause: exit.cause
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
})
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
10
85
|
/** @internal */
|
|
11
86
|
export const withExecutionPlan: {
|
|
12
|
-
<Input, Provides, PlanE, PlanR>(
|
|
87
|
+
<Input, Provides, PlanE, PlanR, RX = never>(
|
|
13
88
|
plan: Api.ExecutionPlan<{
|
|
14
89
|
provides: Provides
|
|
15
90
|
input: Input
|
|
16
91
|
error: PlanE
|
|
17
92
|
requirements: PlanR
|
|
18
|
-
}
|
|
93
|
+
}>,
|
|
94
|
+
options?: {
|
|
95
|
+
readonly onEvent?: ((event: Api.Event<Input | PlanE>) => Effect<void, never, RX>) | undefined
|
|
96
|
+
}
|
|
19
97
|
): <A, E extends Input, R>(effect: Effect<A, E, R>) => Effect<
|
|
20
98
|
A,
|
|
21
99
|
E | PlanE,
|
|
22
|
-
Exclude<R, Provides> | PlanR
|
|
100
|
+
Exclude<R, Provides> | PlanR | RX
|
|
23
101
|
>
|
|
24
|
-
<A, E extends Input, R, Provides, Input, PlanE, PlanR>(
|
|
102
|
+
<A, E extends Input, R, Provides, Input, PlanE, PlanR, RX = never>(
|
|
25
103
|
effect: Effect<A, E, R>,
|
|
26
104
|
plan: Api.ExecutionPlan<{
|
|
27
105
|
provides: Provides
|
|
28
106
|
input: Input
|
|
29
107
|
error: PlanE
|
|
30
108
|
requirements: PlanR
|
|
31
|
-
}
|
|
109
|
+
}>,
|
|
110
|
+
options?: {
|
|
111
|
+
readonly onEvent?: ((event: Api.Event<E | PlanE>) => Effect<void, never, RX>) | undefined
|
|
112
|
+
}
|
|
32
113
|
): Effect<
|
|
33
114
|
A,
|
|
34
115
|
E | PlanE,
|
|
35
|
-
Exclude<R, Provides> | PlanR
|
|
116
|
+
Exclude<R, Provides> | PlanR | RX
|
|
36
117
|
>
|
|
37
|
-
} = dual(
|
|
118
|
+
} = dual((args) => isEffect(args[0]), <A, E extends Input, R, Provides, Input, PlanE, PlanR, RX>(
|
|
38
119
|
self: Effect<A, E, R>,
|
|
39
120
|
plan: Api.ExecutionPlan<{
|
|
40
121
|
provides: Provides
|
|
41
122
|
input: Input
|
|
42
123
|
error: PlanE
|
|
43
124
|
requirements: PlanR
|
|
44
|
-
}
|
|
125
|
+
}>,
|
|
126
|
+
options?: {
|
|
127
|
+
readonly onEvent?: ((event: Api.Event<E | PlanE>) => Effect<void, never, RX>) | undefined
|
|
128
|
+
}
|
|
45
129
|
) =>
|
|
46
130
|
effect.suspend(() => {
|
|
47
131
|
let i = 0
|
|
@@ -59,13 +143,24 @@ export const withExecutionPlan: {
|
|
|
59
143
|
return meta
|
|
60
144
|
})
|
|
61
145
|
)
|
|
146
|
+
const emitter = options?.onEvent === undefined
|
|
147
|
+
? undefined
|
|
148
|
+
: makeEventEmitter(options.onEvent, () => meta)
|
|
149
|
+
const instrument: (attempt: Effect<A, any, any>) => Effect<A, any, any> = emitter === undefined
|
|
150
|
+
? identity
|
|
151
|
+
: (attempt) =>
|
|
152
|
+
effect.uninterruptibleMask((restore) =>
|
|
153
|
+
effect.flatMap(emitter.begin, (state) => effect.onExit(restore(attempt), (exit) => emitter.end(state, exit)))
|
|
154
|
+
)
|
|
62
155
|
let result: Result.Result<A, any> | undefined
|
|
63
156
|
return effect.flatMap(
|
|
64
157
|
effect.whileLoop({
|
|
65
158
|
while: () => i < plan.steps.length && (result === undefined || Result.isFailure(result)),
|
|
66
159
|
body() {
|
|
67
160
|
const step = plan.steps[i]
|
|
68
|
-
let nextEffect: Effect<A, any, any> = provideMeta(
|
|
161
|
+
let nextEffect: Effect<A, any, any> = provideMeta(
|
|
162
|
+
instrument(internalLayer.provide(self, step.provide as any))
|
|
163
|
+
)
|
|
69
164
|
if (result) {
|
|
70
165
|
let attempted = false
|
|
71
166
|
const wrapped = nextEffect
|
package/src/internal/hashMap.ts
CHANGED
|
@@ -977,13 +977,8 @@ export const hasBy = dual<
|
|
|
977
977
|
return false
|
|
978
978
|
})
|
|
979
979
|
|
|
980
|
-
|
|
981
|
-
export const set = dual<
|
|
982
|
-
<K, V>(key: K, value: V) => (self: HashMap<K, V>) => HashMap<K, V>,
|
|
983
|
-
<K, V>(self: HashMap<K, V>, key: K, value: V) => HashMap<K, V>
|
|
984
|
-
>(3, <K, V>(self: HashMap<K, V>, key: K, value: V): HashMap<K, V> => {
|
|
980
|
+
const setHash = <K, V>(self: HashMap<K, V>, key: K, hash: number, value: V): HashMap<K, V> => {
|
|
985
981
|
const impl = self as HashMapImpl<K, V>
|
|
986
|
-
const hash = Hash.hash(key)
|
|
987
982
|
const added = { value: false }
|
|
988
983
|
|
|
989
984
|
// Pass edit context: use current edit if editable, otherwise NaN (never matches any edit)
|
|
@@ -1005,6 +1000,14 @@ export const set = dual<
|
|
|
1005
1000
|
}
|
|
1006
1001
|
|
|
1007
1002
|
return new HashMapImpl(false, impl._edit, newRoot, impl._size + (added.value ? 1 : 0))
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
/** @internal */
|
|
1006
|
+
export const set = dual<
|
|
1007
|
+
<K, V>(key: K, value: V) => (self: HashMap<K, V>) => HashMap<K, V>,
|
|
1008
|
+
<K, V>(self: HashMap<K, V>, key: K, value: V) => HashMap<K, V>
|
|
1009
|
+
>(3, <K, V>(self: HashMap<K, V>, key: K, value: V): HashMap<K, V> => {
|
|
1010
|
+
return setHash(self, key, Hash.hash(key), value)
|
|
1008
1011
|
})
|
|
1009
1012
|
|
|
1010
1013
|
/** @internal */
|
|
@@ -1104,10 +1107,10 @@ export const modifyHash = dual<
|
|
|
1104
1107
|
const updated = f(current)
|
|
1105
1108
|
|
|
1106
1109
|
if (Option.isNone(updated)) {
|
|
1107
|
-
return hasHash(self, key, hash) ?
|
|
1110
|
+
return hasHash(self, key, hash) ? removeHash(self, key, hash) : self
|
|
1108
1111
|
}
|
|
1109
1112
|
|
|
1110
|
-
return
|
|
1113
|
+
return setHash(self, key, hash, updated.value)
|
|
1111
1114
|
})
|
|
1112
1115
|
|
|
1113
1116
|
/** @internal */
|
|
@@ -1130,13 +1133,8 @@ export const union = dual<
|
|
|
1130
1133
|
return result
|
|
1131
1134
|
})
|
|
1132
1135
|
|
|
1133
|
-
|
|
1134
|
-
export const remove = dual<
|
|
1135
|
-
<K>(key: K) => <V>(self: HashMap<K, V>) => HashMap<K, V>,
|
|
1136
|
-
<K, V>(self: HashMap<K, V>, key: K) => HashMap<K, V>
|
|
1137
|
-
>(2, <K, V>(self: HashMap<K, V>, key: K): HashMap<K, V> => {
|
|
1136
|
+
const removeHash = <K, V>(self: HashMap<K, V>, key: K, hash: number): HashMap<K, V> => {
|
|
1138
1137
|
const impl = self as HashMapImpl<K, V>
|
|
1139
|
-
const hash = Hash.hash(key)
|
|
1140
1138
|
const removed = { value: false }
|
|
1141
1139
|
|
|
1142
1140
|
const edit = impl._editable ? impl._edit : NaN
|
|
@@ -1157,6 +1155,14 @@ export const remove = dual<
|
|
|
1157
1155
|
}
|
|
1158
1156
|
|
|
1159
1157
|
return new HashMapImpl(false, impl._edit, newRoot, impl._size - 1)
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
/** @internal */
|
|
1161
|
+
export const remove = dual<
|
|
1162
|
+
<K>(key: K) => <V>(self: HashMap<K, V>) => HashMap<K, V>,
|
|
1163
|
+
<K, V>(self: HashMap<K, V>, key: K) => HashMap<K, V>
|
|
1164
|
+
>(2, <K, V>(self: HashMap<K, V>, key: K): HashMap<K, V> => {
|
|
1165
|
+
return removeHash(self, key, Hash.hash(key))
|
|
1160
1166
|
})
|
|
1161
1167
|
|
|
1162
1168
|
/** @internal */
|
package/src/internal/matcher.ts
CHANGED
|
@@ -124,8 +124,8 @@ const makePredicate = (pattern: unknown): Predicate.Predicate<unknown> => {
|
|
|
124
124
|
return true
|
|
125
125
|
}
|
|
126
126
|
} else if (pattern !== null && typeof pattern === "object") {
|
|
127
|
-
const keysAndPredicates =
|
|
128
|
-
(
|
|
127
|
+
const keysAndPredicates = Reflect.ownKeys(pattern).map(
|
|
128
|
+
(key) => [key, makePredicate((pattern as any)[key])] as const
|
|
129
129
|
)
|
|
130
130
|
const len = keysAndPredicates.length
|
|
131
131
|
|
package/src/internal/schedule.ts
CHANGED
|
@@ -184,17 +184,17 @@ export const scheduleFrom = dual<
|
|
|
184
184
|
schedule: Schedule.Schedule<Output, Input, Error, Env>
|
|
185
185
|
) => <E, R>(
|
|
186
186
|
self: Effect<Input, E, R>
|
|
187
|
-
) => Effect<Output, E, R | Env>,
|
|
187
|
+
) => Effect<Output, E | Error, R | Env>,
|
|
188
188
|
<Input, E, R, Output, Error, Env>(
|
|
189
189
|
self: Effect<Input, E, R>,
|
|
190
190
|
initial: Input,
|
|
191
191
|
schedule: Schedule.Schedule<Output, Input, Error, Env>
|
|
192
|
-
) => Effect<Output, E, R | Env>
|
|
192
|
+
) => Effect<Output, E | Error, R | Env>
|
|
193
193
|
>(3, <Input, E, R, Output, Error, Env>(
|
|
194
194
|
self: Effect<Input, E, R>,
|
|
195
195
|
initial: Input,
|
|
196
196
|
schedule: Schedule.Schedule<Output, Input, Error, Env>
|
|
197
|
-
): Effect<Output, E, R | Env> =>
|
|
197
|
+
): Effect<Output, E | Error, R | Env> =>
|
|
198
198
|
effect.flatMap(Schedule.toStepWithMetadata(schedule), (step) => {
|
|
199
199
|
let meta = Schedule.CurrentMetadata.defaultValue()
|
|
200
200
|
const selfWithMeta = effect.suspend(() => effect.provideService(self, Schedule.CurrentMetadata, meta))
|
|
@@ -213,7 +213,7 @@ export const scheduleFrom = dual<
|
|
|
213
213
|
}) as Effect<never, E, R | Env>
|
|
214
214
|
}
|
|
215
215
|
),
|
|
216
|
-
(error) => core.isDone(error) ? effect.succeed(error.value as Output) : effect.fail(error as E)
|
|
216
|
+
(error) => core.isDone(error) ? effect.succeed(error.value as Output) : effect.fail(error as E | Error)
|
|
217
217
|
)
|
|
218
218
|
}))
|
|
219
219
|
|
|
@@ -21,6 +21,9 @@ export const IDENTIFIER_FALLBACK_KEY = "~identifier"
|
|
|
21
21
|
/** @internal */
|
|
22
22
|
export const SENTINELS_ANNOTATION_KEY = "~sentinels"
|
|
23
23
|
|
|
24
|
+
/** @internal */
|
|
25
|
+
export const CONSTRUCTOR_ANNOTATION_KEY = "~constructor"
|
|
26
|
+
|
|
24
27
|
/** @internal */
|
|
25
28
|
export const jsonSchemaAnnotationKeys = [
|
|
26
29
|
"title",
|