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
|
@@ -100,7 +100,8 @@ const generateFunction = (
|
|
|
100
100
|
|
|
101
101
|
lines.push(`${funcName}()`)
|
|
102
102
|
lines.push(`{`)
|
|
103
|
-
lines.push(` local cur prev words cword`)
|
|
103
|
+
lines.push(` local cur prev words cword i`)
|
|
104
|
+
lines.push(parentPath.length === 0 ? ` local _command_index=0` : ` local _command_index="$1"`)
|
|
104
105
|
lines.push(` _init_completion || return`)
|
|
105
106
|
lines.push(``)
|
|
106
107
|
|
|
@@ -129,13 +130,23 @@ const generateFunction = (
|
|
|
129
130
|
// Subcommand dispatch
|
|
130
131
|
if (descriptor.subcommands.length > 0) {
|
|
131
132
|
lines.push(` # Subcommand dispatch`)
|
|
132
|
-
lines.push(` local
|
|
133
|
-
lines.push(` for ((i = 1; i < cword; i++)); do`)
|
|
133
|
+
lines.push(` local cmd _skip_next=0`)
|
|
134
|
+
lines.push(` for ((i = _command_index + 1; i < cword; i++)); do`)
|
|
135
|
+
lines.push(` if (( _skip_next )); then`)
|
|
136
|
+
lines.push(` _skip_next=0`)
|
|
137
|
+
lines.push(` continue`)
|
|
138
|
+
lines.push(` fi`)
|
|
134
139
|
lines.push(` case "\${words[i]}" in`)
|
|
140
|
+
for (const flag of descriptor.flags) {
|
|
141
|
+
if (flag.type._tag === "Boolean") continue
|
|
142
|
+
const forms = flagNamesForWordlist(flag)
|
|
143
|
+
lines.push(` ${forms.join("|")}) _skip_next=1 ;;`)
|
|
144
|
+
lines.push(` ${forms.map((form) => `${form}=*`).join("|")}) ;;`)
|
|
145
|
+
}
|
|
135
146
|
for (const sub of descriptor.subcommands) {
|
|
136
147
|
const subFuncName = `_${[...currentPath, sub.name].map(sanitizeFunctionName).join("_")}`
|
|
137
148
|
lines.push(` ${sub.name})`)
|
|
138
|
-
lines.push(` ${subFuncName}`)
|
|
149
|
+
lines.push(` ${subFuncName} "$i"`)
|
|
139
150
|
lines.push(` return`)
|
|
140
151
|
lines.push(` ;;`)
|
|
141
152
|
}
|
|
@@ -159,13 +170,52 @@ const generateFunction = (
|
|
|
159
170
|
}
|
|
160
171
|
|
|
161
172
|
// Positional argument completion
|
|
162
|
-
const argsWithCompletions = descriptor.arguments.
|
|
173
|
+
const argsWithCompletions = descriptor.arguments.flatMap((argument, index) => {
|
|
174
|
+
const completion = argCompletion(argument.type)
|
|
175
|
+
return completion === undefined ? [] : [{ argument, completion, index }]
|
|
176
|
+
})
|
|
163
177
|
if (argsWithCompletions.length > 0) {
|
|
164
178
|
lines.push(` # Positional argument completions`)
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
179
|
+
lines.push(` local _position=0 _skip_next=0 _end_of_options=0`)
|
|
180
|
+
lines.push(` for ((i = _command_index + 1; i < cword; i++)); do`)
|
|
181
|
+
lines.push(` if (( _skip_next )); then`)
|
|
182
|
+
lines.push(` _skip_next=0`)
|
|
183
|
+
lines.push(` continue`)
|
|
184
|
+
lines.push(` fi`)
|
|
185
|
+
lines.push(` if (( _end_of_options )); then`)
|
|
186
|
+
lines.push(` ((_position += 1))`)
|
|
187
|
+
lines.push(` continue`)
|
|
188
|
+
lines.push(` fi`)
|
|
189
|
+
lines.push(` case "\${words[i]}" in`)
|
|
190
|
+
lines.push(` --) _end_of_options=1 ;;`)
|
|
191
|
+
for (const flag of descriptor.flags) {
|
|
192
|
+
const forms = flagNamesForWordlist(flag)
|
|
193
|
+
if (flag.type._tag === "Boolean") {
|
|
194
|
+
lines.push(` ${forms.join("|")}) ;;`)
|
|
195
|
+
} else {
|
|
196
|
+
lines.push(` ${forms.join("|")}) _skip_next=1 ;;`)
|
|
197
|
+
lines.push(` ${forms.map((form) => `${form}=*`).join("|")}) ;;`)
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
lines.push(` -*) ;;`)
|
|
201
|
+
lines.push(` *) ((_position += 1)) ;;`)
|
|
202
|
+
lines.push(` esac`)
|
|
203
|
+
lines.push(` done`)
|
|
204
|
+
lines.push(` case "$_position" in`)
|
|
205
|
+
for (const { argument, completion, index } of argsWithCompletions) {
|
|
206
|
+
if (argument.variadic) continue
|
|
207
|
+
lines.push(` ${index})`)
|
|
208
|
+
lines.push(` ${completion}`)
|
|
209
|
+
lines.push(` return`)
|
|
210
|
+
lines.push(` ;;`)
|
|
211
|
+
}
|
|
212
|
+
lines.push(` esac`)
|
|
213
|
+
const variadic = argsWithCompletions.find(({ argument }) => argument.variadic)
|
|
214
|
+
if (variadic !== undefined) {
|
|
215
|
+
lines.push(` if (( _position >= ${variadic.index} )); then`)
|
|
216
|
+
lines.push(` ${variadic.completion}`)
|
|
217
|
+
lines.push(` return`)
|
|
218
|
+
lines.push(` fi`)
|
|
169
219
|
}
|
|
170
220
|
} else if (descriptor.subcommands.length > 0) {
|
|
171
221
|
const subNames = descriptor.subcommands.map((s) => s.name)
|
|
@@ -30,15 +30,12 @@ const toFlagType = (single: Param.Single<"flag", unknown>): Completions.FlagType
|
|
|
30
30
|
const keys = Primitive.getChoiceKeys(single.primitiveType)
|
|
31
31
|
return { _tag: "Choice", values: keys ?? [] }
|
|
32
32
|
}
|
|
33
|
-
case "Path":
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
: "either"
|
|
40
|
-
return { _tag: "Path", pathType }
|
|
41
|
-
}
|
|
33
|
+
case "Path":
|
|
34
|
+
return { _tag: "Path", pathType: Primitive.getPathType(single.primitiveType) ?? "either" }
|
|
35
|
+
case "FileText":
|
|
36
|
+
case "FileParse":
|
|
37
|
+
case "FileSchema":
|
|
38
|
+
return { _tag: "Path", pathType: "file" }
|
|
42
39
|
default:
|
|
43
40
|
return { _tag: "String" }
|
|
44
41
|
}
|
|
@@ -57,15 +54,12 @@ const toArgumentType = (single: Param.Single<"argument", unknown>): Completions.
|
|
|
57
54
|
const keys = Primitive.getChoiceKeys(single.primitiveType)
|
|
58
55
|
return { _tag: "Choice", values: keys ?? [] }
|
|
59
56
|
}
|
|
60
|
-
case "Path":
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
: "either"
|
|
67
|
-
return { _tag: "Path", pathType }
|
|
68
|
-
}
|
|
57
|
+
case "Path":
|
|
58
|
+
return { _tag: "Path", pathType: Primitive.getPathType(single.primitiveType) ?? "either" }
|
|
59
|
+
case "FileText":
|
|
60
|
+
case "FileParse":
|
|
61
|
+
case "FileSchema":
|
|
62
|
+
return { _tag: "Path", pathType: "file" }
|
|
69
63
|
default:
|
|
70
64
|
return { _tag: "String" }
|
|
71
65
|
}
|
|
@@ -116,9 +110,9 @@ export const fromCommand = (cmd: Command.Any): Completions.CommandDescriptor =>
|
|
|
116
110
|
const subcommands: Array<Completions.CommandDescriptor> = []
|
|
117
111
|
for (const group of cmd.subcommands) {
|
|
118
112
|
for (const subcommand of group.commands) {
|
|
119
|
-
// Omit
|
|
113
|
+
// Omit unlisted subcommands from completion scripts so tab-completion in
|
|
120
114
|
// the shell does not advertise commands that are absent from --help.
|
|
121
|
-
if (subcommand.
|
|
115
|
+
if (subcommand.unlisted) continue
|
|
122
116
|
subcommands.push(fromCommand(subcommand))
|
|
123
117
|
}
|
|
124
118
|
}
|
|
@@ -18,7 +18,7 @@ const escapeFishString = (s: string): string => s.replace(/'/g, "\\'")
|
|
|
18
18
|
* Build a Fish condition that checks the current subcommand context.
|
|
19
19
|
*
|
|
20
20
|
* For root-level completions with subcommands: `__fish_use_subcommand`
|
|
21
|
-
* For nested commands: verify the parent
|
|
21
|
+
* For nested commands: verify the full parent path is active AND none of its
|
|
22
22
|
* child subcommands have been entered yet.
|
|
23
23
|
*/
|
|
24
24
|
const subcommandCondition = (
|
|
@@ -31,14 +31,12 @@ const subcommandCondition = (
|
|
|
31
31
|
}
|
|
32
32
|
return ``
|
|
33
33
|
}
|
|
34
|
-
const
|
|
34
|
+
const parentCondition = parentPath.map((parent) => `__fish_seen_subcommand_from ${parent}`).join("; and ")
|
|
35
35
|
if (childSubcommandNames.length > 0) {
|
|
36
|
-
// Show only when parent is active but no child subcommand has been entered
|
|
37
|
-
return
|
|
38
|
-
childSubcommandNames.join(" ")
|
|
39
|
-
}`
|
|
36
|
+
// Show only when the parent path is active but no child subcommand has been entered
|
|
37
|
+
return `${parentCondition}; and not __fish_seen_subcommand_from ${childSubcommandNames.join(" ")}`
|
|
40
38
|
}
|
|
41
|
-
return
|
|
39
|
+
return parentCondition
|
|
42
40
|
}
|
|
43
41
|
|
|
44
42
|
/**
|
|
@@ -111,6 +111,7 @@ const getSharedFlagsForCommandPath = (
|
|
|
111
111
|
const ancestorImpl = toImpl(ancestor)
|
|
112
112
|
for (const flag of ancestorImpl.contextConfig.flags) {
|
|
113
113
|
const singles = Param.extractSingleParams(flag)
|
|
114
|
+
const metadata = Param.getParamMetadata(flag)
|
|
114
115
|
for (const single of singles) {
|
|
115
116
|
if (seen.has(single.name)) {
|
|
116
117
|
continue
|
|
@@ -122,7 +123,7 @@ const getSharedFlagsForCommandPath = (
|
|
|
122
123
|
continue
|
|
123
124
|
}
|
|
124
125
|
seen.add(single.name)
|
|
125
|
-
sharedFlags.push(toFlagDoc(single))
|
|
126
|
+
sharedFlags.push(toFlagDoc(single, metadata))
|
|
126
127
|
}
|
|
127
128
|
}
|
|
128
129
|
}
|
|
@@ -165,13 +166,14 @@ export const getHelpForCommandPath = <Name extends string, Input, E, R, ContextI
|
|
|
165
166
|
const globalFlagDocs: Array<FlagDoc> = []
|
|
166
167
|
for (const flag of flags) {
|
|
167
168
|
const singles = Param.extractSingleParams(flag.flag)
|
|
169
|
+
const metadata = Param.getParamMetadata(flag.flag)
|
|
168
170
|
for (const single of singles) {
|
|
169
171
|
// Same rule as command-local flags: hidden globals are still parsed
|
|
170
172
|
// and still trigger their handlers, they just don't appear under
|
|
171
173
|
// "GLOBAL FLAGS" in --help.
|
|
172
174
|
if (single.hidden) continue
|
|
173
175
|
globalFlagDocs.push({
|
|
174
|
-
...toFlagDoc(single),
|
|
176
|
+
...toFlagDoc(single, metadata),
|
|
175
177
|
required: false
|
|
176
178
|
})
|
|
177
179
|
}
|
|
@@ -826,12 +826,12 @@ const resolveFirstValue = (
|
|
|
826
826
|
// Not a subcommand. Check if this looks like a typo.
|
|
827
827
|
const expectsArgs = toImpl(command).config.arguments.length > 0
|
|
828
828
|
if (!expectsArgs && subIndex.size > 0) {
|
|
829
|
-
// Exclude
|
|
830
|
-
// that was intentionally kept out of --help.
|
|
829
|
+
// Exclude unlisted subcommands so a typo cannot reveal a subcommand name
|
|
830
|
+
// that was intentionally kept out of --help. Unlisted commands still
|
|
831
831
|
// resolve via subIndex when invoked by exact name.
|
|
832
832
|
const visibleKeys: Array<string> = []
|
|
833
833
|
for (const [key, sub] of subIndex) {
|
|
834
|
-
if (!sub.
|
|
834
|
+
if (!sub.unlisted) visibleKeys.push(key)
|
|
835
835
|
}
|
|
836
836
|
const suggestions = suggest(value, visibleKeys)
|
|
837
837
|
state.errors.push(
|
|
@@ -54,7 +54,7 @@ const promptCommand: (
|
|
|
54
54
|
) => Effect.Effect<void, CliError.CliError | Terminal.QuitError, Command.Environment> = Effect.fnUntraced(
|
|
55
55
|
function*(command, commandLine, sectionName) {
|
|
56
56
|
const impl = toImpl(command)
|
|
57
|
-
const visibleSubcommands = command.subcommands.flatMap((group) => group.commands.filter((child) => !child.
|
|
57
|
+
const visibleSubcommands = command.subcommands.flatMap((group) => group.commands.filter((child) => !child.unlisted))
|
|
58
58
|
const config = visibleSubcommands.length === 0 ? impl.config : impl.contextConfig
|
|
59
59
|
|
|
60
60
|
if (config.flags.length > 0) {
|
|
@@ -103,7 +103,7 @@ const promptCommand: (
|
|
|
103
103
|
)
|
|
104
104
|
|
|
105
105
|
const hasWizardSteps = (command: Command.Command.Any): boolean => {
|
|
106
|
-
const hasVisibleSubcommands = command.subcommands.some((group) => group.commands.some((child) => !child.
|
|
106
|
+
const hasVisibleSubcommands = command.subcommands.some((group) => group.commands.some((child) => !child.unlisted))
|
|
107
107
|
return hasVisibleSubcommands || toImpl(command).config.orderedParams.length > 0
|
|
108
108
|
}
|
|
109
109
|
|
|
@@ -26,7 +26,7 @@ const TypeId = "~effect/cluster/ClusterError"
|
|
|
26
26
|
* @since 4.0.0
|
|
27
27
|
*/
|
|
28
28
|
export class EntityNotAssignedToRunner
|
|
29
|
-
extends Schema.
|
|
29
|
+
extends Schema.Error<EntityNotAssignedToRunner>(`${TypeId}/EntityNotAssignedToRunner`)({
|
|
30
30
|
_tag: Schema.tag("EntityNotAssignedToRunner"),
|
|
31
31
|
address: EntityAddress
|
|
32
32
|
})
|
|
@@ -60,7 +60,7 @@ export class EntityNotAssignedToRunner
|
|
|
60
60
|
* @category errors
|
|
61
61
|
* @since 4.0.0
|
|
62
62
|
*/
|
|
63
|
-
export class MalformedMessage extends Schema.
|
|
63
|
+
export class MalformedMessage extends Schema.Error<MalformedMessage>(`${TypeId}/MalformedMessage`)({
|
|
64
64
|
_tag: Schema.tag("MalformedMessage"),
|
|
65
65
|
cause: Schema.Defect()
|
|
66
66
|
}) {
|
|
@@ -99,7 +99,7 @@ export class MalformedMessage extends Schema.ErrorClass<MalformedMessage>(`${Typ
|
|
|
99
99
|
* @category errors
|
|
100
100
|
* @since 4.0.0
|
|
101
101
|
*/
|
|
102
|
-
export class PersistenceError extends Schema.
|
|
102
|
+
export class PersistenceError extends Schema.Error<PersistenceError>(`${TypeId}/PersistenceError`)({
|
|
103
103
|
_tag: Schema.tag("PersistenceError"),
|
|
104
104
|
cause: Schema.Defect()
|
|
105
105
|
}) {
|
|
@@ -127,7 +127,7 @@ export class PersistenceError extends Schema.ErrorClass<PersistenceError>(`${Typ
|
|
|
127
127
|
* @category errors
|
|
128
128
|
* @since 4.0.0
|
|
129
129
|
*/
|
|
130
|
-
export class RunnerNotRegistered extends Schema.
|
|
130
|
+
export class RunnerNotRegistered extends Schema.Error<RunnerNotRegistered>(`${TypeId}/RunnerNotRegistered`)({
|
|
131
131
|
_tag: Schema.tag("RunnerNotRegistered"),
|
|
132
132
|
address: RunnerAddress
|
|
133
133
|
}) {
|
|
@@ -145,7 +145,7 @@ export class RunnerNotRegistered extends Schema.ErrorClass<RunnerNotRegistered>(
|
|
|
145
145
|
* @category errors
|
|
146
146
|
* @since 4.0.0
|
|
147
147
|
*/
|
|
148
|
-
export class RunnerUnavailable extends Schema.
|
|
148
|
+
export class RunnerUnavailable extends Schema.Error<RunnerUnavailable>(`${TypeId}/RunnerUnavailable`)({
|
|
149
149
|
_tag: Schema.tag("RunnerUnavailable"),
|
|
150
150
|
address: RunnerAddress
|
|
151
151
|
}) {
|
|
@@ -181,7 +181,7 @@ export class RunnerUnavailable extends Schema.ErrorClass<RunnerUnavailable>(`${T
|
|
|
181
181
|
* @category errors
|
|
182
182
|
* @since 4.0.0
|
|
183
183
|
*/
|
|
184
|
-
export class MailboxFull extends Schema.
|
|
184
|
+
export class MailboxFull extends Schema.Error<MailboxFull>(`${TypeId}/MailboxFull`)({
|
|
185
185
|
_tag: Schema.tag("MailboxFull"),
|
|
186
186
|
address: EntityAddress
|
|
187
187
|
}) {
|
|
@@ -214,7 +214,7 @@ export class MailboxFull extends Schema.ErrorClass<MailboxFull>(`${TypeId}/Mailb
|
|
|
214
214
|
* @since 4.0.0
|
|
215
215
|
*/
|
|
216
216
|
export class AlreadyProcessingMessage
|
|
217
|
-
extends Schema.
|
|
217
|
+
extends Schema.Error<AlreadyProcessingMessage>(`${TypeId}/AlreadyProcessingMessage`)({
|
|
218
218
|
_tag: Schema.tag("AlreadyProcessingMessage"),
|
|
219
219
|
envelopeId: SnowflakeFromString,
|
|
220
220
|
address: EntityAddress
|
|
@@ -618,7 +618,10 @@ export const make = Effect.gen(function*() {
|
|
|
618
618
|
payload: {
|
|
619
619
|
name: options.clock.name,
|
|
620
620
|
workflowName: workflow._tag,
|
|
621
|
-
wakeUp: DateTime.
|
|
621
|
+
wakeUp: DateTime.mapEpochMillis(
|
|
622
|
+
DateTime.addDuration(now, options.clock.duration),
|
|
623
|
+
Math.ceil
|
|
624
|
+
)
|
|
622
625
|
}
|
|
623
626
|
})
|
|
624
627
|
),
|
|
@@ -606,11 +606,7 @@ export const makeEncoded: (encoded: Encoded) => Effect.Effect<
|
|
|
606
606
|
),
|
|
607
607
|
Effect.asVoid
|
|
608
608
|
),
|
|
609
|
-
saveReply: (reply) =>
|
|
610
|
-
Effect.flatMap(
|
|
611
|
-
Reply.serialize(reply),
|
|
612
|
-
encoded.saveReply
|
|
613
|
-
),
|
|
609
|
+
saveReply: (reply) => Effect.flatMap(Reply.serializeOrDefect(reply), encoded.saveReply),
|
|
614
610
|
clearReplies: encoded.clearReplies,
|
|
615
611
|
repliesFor: Effect.fnUntraced(function*(messages) {
|
|
616
612
|
const requestIds = Arr.empty<string>()
|
|
@@ -995,6 +991,14 @@ export class MemoryDriver extends Context.Service<MemoryDriver>()("effect/cluste
|
|
|
995
991
|
resetAddress: () => Effect.void,
|
|
996
992
|
clearAddress: (address) =>
|
|
997
993
|
Effect.sync(() => {
|
|
994
|
+
for (const [primaryKey, entry] of requestsByPrimaryKey) {
|
|
995
|
+
const envelope = entry.envelope
|
|
996
|
+
const sameAddress = address.entityType === envelope.address.entityType &&
|
|
997
|
+
address.entityId === envelope.address.entityId
|
|
998
|
+
if (sameAddress) {
|
|
999
|
+
requestsByPrimaryKey.delete(primaryKey)
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
998
1002
|
for (let i = journal.length - 1; i >= 0; i--) {
|
|
999
1003
|
const envelope = journal[i]
|
|
1000
1004
|
const sameAddress = address.entityType === envelope.address.entityType &&
|
|
@@ -242,10 +242,10 @@ export class Chunk<R extends Rpc.Any> extends Data.TaggedClass("Chunk")<{
|
|
|
242
242
|
[success],
|
|
243
243
|
([success]) => (input, ast, options) => {
|
|
244
244
|
if (!isReply(input) || input._tag !== "Chunk") {
|
|
245
|
-
return Effect.fail(new SchemaIssue.InvalidType(ast))
|
|
245
|
+
return Effect.fail(new SchemaIssue.InvalidType(ast, input, options))
|
|
246
246
|
}
|
|
247
247
|
return Effect.mapBothEager(SchemaParser.decodeEffect(Schema.NonEmptyArray(success))(input.values, options), {
|
|
248
|
-
onFailure: (issue) =>
|
|
248
|
+
onFailure: (issue) => SchemaIssue.makeCompositeAtKey(ast, "values", issue, input, options),
|
|
249
249
|
onSuccess: (values) => new Chunk({ ...input, values } as any)
|
|
250
250
|
})
|
|
251
251
|
},
|
|
@@ -351,10 +351,10 @@ export class WithExit<R extends Rpc.Any> extends Data.TaggedClass("WithExit")<{
|
|
|
351
351
|
[exitSchema],
|
|
352
352
|
([exit]) => (input, ast, options) => {
|
|
353
353
|
if (!isReply(input) || input._tag !== "WithExit") {
|
|
354
|
-
return Effect.fail(new SchemaIssue.InvalidType(ast))
|
|
354
|
+
return Effect.fail(new SchemaIssue.InvalidType(ast, input, options))
|
|
355
355
|
}
|
|
356
356
|
return Effect.mapBothEager(SchemaParser.decodeEffect(exit)(input.exit, options), {
|
|
357
|
-
onFailure: (issue) =>
|
|
357
|
+
onFailure: (issue) => SchemaIssue.makeCompositeAtKey(ast, "exit", issue, input, options),
|
|
358
358
|
onSuccess: (exit) => new WithExit({ ...input, exit: exit as any })
|
|
359
359
|
})
|
|
360
360
|
},
|
|
@@ -433,6 +433,27 @@ export const serialize = <R extends Rpc.Any>(
|
|
|
433
433
|
)
|
|
434
434
|
}
|
|
435
435
|
|
|
436
|
+
/**
|
|
437
|
+
* Serializes a `ReplyWithContext`, falling back to a serializable defect reply
|
|
438
|
+
* when the original reply cannot be encoded.
|
|
439
|
+
*
|
|
440
|
+
* @category serialization
|
|
441
|
+
* @since 4.0.0
|
|
442
|
+
*/
|
|
443
|
+
export const serializeOrDefect = <R extends Rpc.Any>(
|
|
444
|
+
self: ReplyWithContext<R>
|
|
445
|
+
): Effect.Effect<Encoded> =>
|
|
446
|
+
Effect.catchTag(
|
|
447
|
+
serialize(self),
|
|
448
|
+
"MalformedMessage",
|
|
449
|
+
(error) =>
|
|
450
|
+
Effect.orDie(serialize(ReplyWithContext.fromDefect({
|
|
451
|
+
id: self.reply.id,
|
|
452
|
+
requestId: self.reply.requestId,
|
|
453
|
+
defect: error
|
|
454
|
+
})))
|
|
455
|
+
)
|
|
456
|
+
|
|
436
457
|
/**
|
|
437
458
|
* Serializes an outgoing request's last received reply when one exists, returning
|
|
438
459
|
* `None` when no reply has been received and refailing encoding errors as
|
|
@@ -42,15 +42,6 @@ const serializeDefectReply = <R extends Rpc.Any>(
|
|
|
42
42
|
defect
|
|
43
43
|
})))
|
|
44
44
|
|
|
45
|
-
const serializeReply = <R extends Rpc.Any>(
|
|
46
|
-
reply: Reply.ReplyWithContext<R>
|
|
47
|
-
): Effect.Effect<Reply.Encoded> =>
|
|
48
|
-
Effect.catchTag(
|
|
49
|
-
Reply.serialize(reply),
|
|
50
|
-
"MalformedMessage",
|
|
51
|
-
(error) => serializeDefectReply(reply, error)
|
|
52
|
-
)
|
|
53
|
-
|
|
54
45
|
/**
|
|
55
46
|
* Layer that handles runner protocol RPCs by forwarding requests to `Sharding`
|
|
56
47
|
* and `MessageStorage`.
|
|
@@ -84,7 +75,7 @@ export const layerHandlers = Runners.Rpcs.toLayer(Effect.gen(function*() {
|
|
|
84
75
|
envelope: request,
|
|
85
76
|
lastSentReply: Option.none(),
|
|
86
77
|
respond(reply) {
|
|
87
|
-
resume(
|
|
78
|
+
resume(Reply.serializeOrDefect(reply))
|
|
88
79
|
return Effect.void
|
|
89
80
|
}
|
|
90
81
|
})
|
|
@@ -138,6 +129,9 @@ export const layerHandlers = Runners.Rpcs.toLayer(Effect.gen(function*() {
|
|
|
138
129
|
return Reply.serialize(reply).pipe(
|
|
139
130
|
Effect.flatMap((reply) => {
|
|
140
131
|
Queue.offerUnsafe(queue, reply)
|
|
132
|
+
if (reply._tag === "WithExit") {
|
|
133
|
+
Queue.endUnsafe(queue)
|
|
134
|
+
}
|
|
141
135
|
return Effect.void
|
|
142
136
|
}),
|
|
143
137
|
Effect.catchTag("MalformedMessage", (error) =>
|
|
@@ -195,29 +195,31 @@ export const makeEncoded = (encoded: Encoded) =>
|
|
|
195
195
|
*
|
|
196
196
|
* **Details**
|
|
197
197
|
*
|
|
198
|
-
*
|
|
199
|
-
* process memory.
|
|
198
|
+
* Runner health and shard acquisition are kept only in process memory.
|
|
200
199
|
*
|
|
201
200
|
* @category constructors
|
|
202
201
|
* @since 4.0.0
|
|
203
202
|
*/
|
|
204
203
|
export const makeMemory = Effect.gen(function*() {
|
|
205
|
-
const runners = MutableHashMap.empty<RunnerAddress, Runner>()
|
|
204
|
+
const runners = MutableHashMap.empty<RunnerAddress, readonly [runner: Runner, healthy: boolean]>()
|
|
206
205
|
let acquired: Array<ShardId.ShardId> = []
|
|
207
206
|
let id = 0
|
|
208
207
|
|
|
209
208
|
return RunnerStorage.of({
|
|
210
|
-
getRunners: Effect.sync(() => Array.from(MutableHashMap.values(runners)
|
|
211
|
-
register: (runner) =>
|
|
209
|
+
getRunners: Effect.sync(() => Array.from(MutableHashMap.values(runners))),
|
|
210
|
+
register: (runner, healthy) =>
|
|
212
211
|
Effect.sync(() => {
|
|
213
|
-
MutableHashMap.set(runners, runner.address, runner)
|
|
212
|
+
MutableHashMap.set(runners, runner.address, [runner, healthy])
|
|
214
213
|
return MachineId.make(id++)
|
|
215
214
|
}),
|
|
216
215
|
unregister: (address) =>
|
|
217
216
|
Effect.sync(() => {
|
|
218
217
|
MutableHashMap.remove(runners, address)
|
|
219
218
|
}),
|
|
220
|
-
setRunnerHealth: () =>
|
|
219
|
+
setRunnerHealth: (address, healthy) =>
|
|
220
|
+
Effect.sync(() => {
|
|
221
|
+
MutableHashMap.modify(runners, address, ([runner]) => [runner, healthy] as const)
|
|
222
|
+
}),
|
|
221
223
|
acquire: (_address, shardIds) => {
|
|
222
224
|
acquired = Array.from(shardIds)
|
|
223
225
|
return Effect.succeed(acquired)
|
|
@@ -240,6 +240,8 @@ const make = Effect.gen(function*() {
|
|
|
240
240
|
const runnerStorage = yield* RunnerStorage
|
|
241
241
|
|
|
242
242
|
const entityManagers = new Map<string, EntityManagerState>()
|
|
243
|
+
let entityRegistrationStartMillis: number | undefined
|
|
244
|
+
let entityRegistrationFallbackStartMillis: number | undefined
|
|
243
245
|
|
|
244
246
|
const shardAssignments = MutableHashMap.empty<ShardId, RunnerAddress>()
|
|
245
247
|
const selfShards = MutableHashSet.empty<ShardId>()
|
|
@@ -591,7 +593,6 @@ const make = Effect.gen(function*() {
|
|
|
591
593
|
const entityRegistrationTimeoutMillis = Duration.toMillis(
|
|
592
594
|
Duration.fromInputUnsafe(config.entityRegistrationTimeout)
|
|
593
595
|
)
|
|
594
|
-
const storageStartMillis = clock.currentTimeMillisUnsafe()
|
|
595
596
|
|
|
596
597
|
yield* Effect.gen(function*() {
|
|
597
598
|
yield* Effect.logDebug("Starting")
|
|
@@ -617,8 +618,15 @@ const make = Effect.gen(function*() {
|
|
|
617
618
|
}
|
|
618
619
|
const state = entityManagers.get(address.entityType)
|
|
619
620
|
if (!state) {
|
|
620
|
-
const
|
|
621
|
-
|
|
621
|
+
const now = clock.currentTimeMillisUnsafe()
|
|
622
|
+
const registrationStarted = entityRegistrationStartMillis !== undefined
|
|
623
|
+
const timeoutStartMillis = entityRegistrationStartMillis ??
|
|
624
|
+
(entityRegistrationFallbackStartMillis ??= now)
|
|
625
|
+
// If registration never starts, allow two intervals from the first missing read before failing.
|
|
626
|
+
const timeoutMillis = registrationStarted
|
|
627
|
+
? entityRegistrationTimeoutMillis
|
|
628
|
+
: entityRegistrationTimeoutMillis * 2
|
|
629
|
+
if (now - timeoutStartMillis < timeoutMillis) {
|
|
622
630
|
// reset address in the case that the entity is slow to register
|
|
623
631
|
MutableHashSet.add(resetAddresses, address)
|
|
624
632
|
return Effect.void
|
|
@@ -961,13 +969,13 @@ const make = Effect.gen(function*() {
|
|
|
961
969
|
void,
|
|
962
970
|
MailboxFull | AlreadyProcessingMessage | PersistenceError
|
|
963
971
|
> {
|
|
972
|
+
const isPersisted = Context.get(
|
|
973
|
+
message._tag === "OutgoingRequest" ? message.annotations : message.rpc.annotations,
|
|
974
|
+
Persisted
|
|
975
|
+
)
|
|
964
976
|
return Effect.catchFilter(
|
|
965
977
|
Effect.suspend(() => {
|
|
966
978
|
const address = message.envelope.address
|
|
967
|
-
const isPersisted = Context.get(
|
|
968
|
-
message._tag === "OutgoingRequest" ? message.annotations : message.rpc.annotations,
|
|
969
|
-
Persisted
|
|
970
|
-
)
|
|
971
979
|
if (isPersisted && !storageEnabled) {
|
|
972
980
|
return Effect.die("Sharding.sendOutgoing: Persisted messages require MessageStorage")
|
|
973
981
|
}
|
|
@@ -989,6 +997,25 @@ const make = Effect.gen(function*() {
|
|
|
989
997
|
? Result.succeed(error)
|
|
990
998
|
: Result.fail(error),
|
|
991
999
|
(error) => {
|
|
1000
|
+
// Abandon the message during teardown: retrying would loop forever once the runner is shutting down
|
|
1001
|
+
if (error._tag === "EntityNotAssignedToRunner") {
|
|
1002
|
+
const targetManager = entityManagers.get(message.envelope.address.entityType)
|
|
1003
|
+
const cannotRecover = MutableRef.get(isShutdown) ||
|
|
1004
|
+
(targetManager !== undefined && targetManager.status !== "alive")
|
|
1005
|
+
if (cannotRecover) {
|
|
1006
|
+
if (!isPersisted) {
|
|
1007
|
+
return Effect.logDebug("Abandoning outgoing message during shutdown", message.envelope.address)
|
|
1008
|
+
}
|
|
1009
|
+
const persist = message._tag === "OutgoingRequest"
|
|
1010
|
+
? storage.saveRequest(message)
|
|
1011
|
+
: storage.saveEnvelope(message)
|
|
1012
|
+
return Effect.catchTag(persist, "MalformedMessage", Effect.die).pipe(
|
|
1013
|
+
Effect.andThen(
|
|
1014
|
+
Effect.logWarning("Persisting outgoing message abandoned during shutdown", message.envelope.address)
|
|
1015
|
+
)
|
|
1016
|
+
)
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
992
1019
|
if (retries === 0) {
|
|
993
1020
|
return Effect.die(error)
|
|
994
1021
|
}
|
|
@@ -1461,6 +1488,7 @@ const make = Effect.gen(function*() {
|
|
|
1461
1488
|
// register entities while storage is idle
|
|
1462
1489
|
// this ensures message order is preserved
|
|
1463
1490
|
yield* withStorageReadLock(Effect.sync(() => {
|
|
1491
|
+
entityRegistrationStartMillis ??= clock.currentTimeMillisUnsafe()
|
|
1464
1492
|
entityManagers.set(entity.type, state)
|
|
1465
1493
|
if (entityManagerLatches.has(entity.type)) {
|
|
1466
1494
|
entityManagerLatches.get(entity.type)!.openUnsafe()
|
|
@@ -110,7 +110,7 @@ export const make = Effect.fnUntraced(function*<
|
|
|
110
110
|
const clock = yield* Clock
|
|
111
111
|
const context = yield* Effect.context<Rpc.Services<Rpcs> | Rpc.Middleware<Rpcs> | RX>()
|
|
112
112
|
const defectRetryPolicy = options.defectRetryPolicy
|
|
113
|
-
? Schedule.
|
|
113
|
+
? Schedule.concat(options.defectRetryPolicy, defaultRetryPolicy)
|
|
114
114
|
: defaultRetryPolicy
|
|
115
115
|
const retryDriver = yield* Schedule.toStepWithSleep(defectRetryPolicy)
|
|
116
116
|
const entityRpcs = new Map(entity.protocol.requests)
|
|
@@ -65,7 +65,7 @@ export class ResourceMap<K, A, E> {
|
|
|
65
65
|
if (existing) {
|
|
66
66
|
return Deferred.await(existing.deferred)
|
|
67
67
|
}
|
|
68
|
-
const scope =
|
|
68
|
+
const scope = Scope.makeUnsafe()
|
|
69
69
|
const deferred = Deferred.makeUnsafe<A, E>()
|
|
70
70
|
backingSet(this.entries, key, { scope, deferred })
|
|
71
71
|
return Effect.onExit(this.lookup(key, scope), (exit) => {
|
|
@@ -73,7 +73,10 @@ export class ResourceMap<K, A, E> {
|
|
|
73
73
|
return Deferred.done(deferred, exit)
|
|
74
74
|
}
|
|
75
75
|
backingDelete(this.entries, key)
|
|
76
|
-
return
|
|
76
|
+
return Effect.andThen(
|
|
77
|
+
Deferred.done(deferred, exit),
|
|
78
|
+
Scope.close(scope, exit)
|
|
79
|
+
)
|
|
77
80
|
})
|
|
78
81
|
})
|
|
79
82
|
}
|