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
|
@@ -29,10 +29,27 @@ declare module "../../Schema.ts" {
|
|
|
29
29
|
* @internal
|
|
30
30
|
*/
|
|
31
31
|
readonly "~httpApiEncoding"?: Encoding | undefined
|
|
32
|
+
/**
|
|
33
|
+
* Marks schemas produced by `encodeToWithHeaders`, carrying the body and
|
|
34
|
+
* headers schemas so integrations can split the encoded pair.
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
readonly "~httpApiWithHeaders"?: WithHeadersAnnotation | undefined
|
|
32
38
|
}
|
|
33
39
|
}
|
|
34
40
|
}
|
|
35
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Annotation payload attached by `encodeToWithHeaders`.
|
|
44
|
+
*
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
export interface WithHeadersAnnotation {
|
|
48
|
+
readonly body: Schema.Top
|
|
49
|
+
readonly headers: Schema.Top
|
|
50
|
+
readonly headersCodec: Schema.Top
|
|
51
|
+
}
|
|
52
|
+
|
|
36
53
|
/**
|
|
37
54
|
* HTTP API body encoding metadata used by payloads and responses.
|
|
38
55
|
*
|
|
@@ -483,6 +500,315 @@ function defaultStreamContentType(mode: StreamMode): string {
|
|
|
483
500
|
}
|
|
484
501
|
}
|
|
485
502
|
|
|
503
|
+
/**
|
|
504
|
+
* Runtime brand key used to mark `WithHeaders` response schemas.
|
|
505
|
+
*
|
|
506
|
+
* @category type IDs
|
|
507
|
+
* @since 4.0.0
|
|
508
|
+
*/
|
|
509
|
+
export const WithHeadersTypeId = "~effect/httpapi/HttpApiSchema/WithHeaders"
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* Type-level brand identifier used by `WithHeaders`.
|
|
513
|
+
*
|
|
514
|
+
* @category type IDs
|
|
515
|
+
* @since 4.0.0
|
|
516
|
+
*/
|
|
517
|
+
export type WithHeadersTypeId = typeof WithHeadersTypeId
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* Runtime brand key used to mark `WithHeaders` response values.
|
|
521
|
+
*
|
|
522
|
+
* @category type IDs
|
|
523
|
+
* @since 4.0.0
|
|
524
|
+
*/
|
|
525
|
+
export const WithHeadersValueTypeId = "~effect/httpapi/HttpApiSchema/WithHeadersValue"
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* Type-level brand identifier used by `WithHeaders` response values.
|
|
529
|
+
*
|
|
530
|
+
* @category type IDs
|
|
531
|
+
* @since 4.0.0
|
|
532
|
+
*/
|
|
533
|
+
export type WithHeadersValueTypeId = typeof WithHeadersValueTypeId
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* A response schema wrapping a body schema together with a response headers
|
|
537
|
+
* schema.
|
|
538
|
+
*
|
|
539
|
+
* **Details**
|
|
540
|
+
*
|
|
541
|
+
* `WithHeaders` is a branded declaration schema: it carries the inner success
|
|
542
|
+
* schema and the headers schema as properties, and server, client, and OpenAPI
|
|
543
|
+
* integrations detect the brand and handle body and headers separately. It is
|
|
544
|
+
* supported for error responses, though {@link encodeToWithHeaders} is usually
|
|
545
|
+
* more convenient there because handlers can fail with the domain error value.
|
|
546
|
+
*
|
|
547
|
+
* - `schema` is the inner response schema. Success responses may wrap
|
|
548
|
+
* `StreamSse` and `StreamUint8Array`; error responses remain non-streaming.
|
|
549
|
+
* Nesting `WithHeaders` is rejected at construction.
|
|
550
|
+
* - `headers` is any schema; endpoint construction applies
|
|
551
|
+
* `Schema.toCodecStringTree` unless codecs are disabled, so leaves become
|
|
552
|
+
* `string | undefined` on the wire and `undefined` leaves are omitted from the response.
|
|
553
|
+
* - Status and response-encoding annotations are resolved from the wrapper
|
|
554
|
+
* first, falling through to the inner schema.
|
|
555
|
+
* - A header-carrying response cannot share its status and content type with
|
|
556
|
+
* another response in the same success or error union. Endpoint construction
|
|
557
|
+
* rejects ambiguous declarations, including those made with
|
|
558
|
+
* {@link encodeToWithHeaders}.
|
|
559
|
+
* - `Rebuild` preserves the brand and both parts, so `.annotate` keeps the
|
|
560
|
+
* wrapper intact.
|
|
561
|
+
*
|
|
562
|
+
* @category models
|
|
563
|
+
* @since 4.0.0
|
|
564
|
+
*/
|
|
565
|
+
export interface WithHeaders<S extends Schema.Top, H extends Schema.Top> extends
|
|
566
|
+
Schema.Bottom<
|
|
567
|
+
withHeaders<S["Type"], H["Type"]>,
|
|
568
|
+
withHeaders<S["Encoded"], Schema.StringTree>,
|
|
569
|
+
S["DecodingServices"] | H["DecodingServices"],
|
|
570
|
+
S["EncodingServices"] | H["EncodingServices"],
|
|
571
|
+
SchemaAST.Declaration,
|
|
572
|
+
WithHeaders<S, H>
|
|
573
|
+
>
|
|
574
|
+
{
|
|
575
|
+
readonly "Rebuild": WithHeaders<S, H>
|
|
576
|
+
readonly [WithHeadersTypeId]: typeof WithHeadersTypeId
|
|
577
|
+
readonly schema: S
|
|
578
|
+
readonly headers: H
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* The Type of a `WithHeaders` schema: what handlers return and what the
|
|
583
|
+
* client resolves to, constructed via {@link withHeaders}.
|
|
584
|
+
*
|
|
585
|
+
* `body` is the inner success value. For stream success schemas it is the
|
|
586
|
+
* `Stream` itself, so headers are decided before the body starts streaming.
|
|
587
|
+
*
|
|
588
|
+
* @category models
|
|
589
|
+
* @since 4.0.0
|
|
590
|
+
*/
|
|
591
|
+
export interface withHeaders<A, H> {
|
|
592
|
+
readonly [WithHeadersValueTypeId]: WithHeadersValueTypeId
|
|
593
|
+
readonly body: A
|
|
594
|
+
readonly headers: H
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
/** @internal */
|
|
598
|
+
export const isWithHeadersValue = (u: unknown): u is withHeaders<unknown, unknown> =>
|
|
599
|
+
Predicate.hasProperty(u, WithHeadersValueTypeId)
|
|
600
|
+
|
|
601
|
+
const withHeadersValueSchema = Schema.declare(isWithHeadersValue)
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Wraps a success schema with a response headers schema.
|
|
605
|
+
*
|
|
606
|
+
* Headers accept either a schema or a fields shorthand, mirroring the
|
|
607
|
+
* request-side headers option.
|
|
608
|
+
*
|
|
609
|
+
* ```ts import.meta.vitest
|
|
610
|
+
* import { Schema } from "effect"
|
|
611
|
+
* import { HttpApiSchema } from "effect/unstable/httpapi"
|
|
612
|
+
*
|
|
613
|
+
* const schema = HttpApiSchema.WithHeaders(Schema.String, {
|
|
614
|
+
* "x-total-count": Schema.FiniteFromString
|
|
615
|
+
* })
|
|
616
|
+
* const response: typeof schema.Type = HttpApiSchema.withHeaders({
|
|
617
|
+
* body: "created",
|
|
618
|
+
* headers: { "x-total-count": 1 }
|
|
619
|
+
* })
|
|
620
|
+
*
|
|
621
|
+
* HttpApiSchema.isWithHeaders(schema) // => true
|
|
622
|
+
* response.body // => "created"
|
|
623
|
+
* response.headers // => { "x-total-count": 1 }
|
|
624
|
+
* ```
|
|
625
|
+
*
|
|
626
|
+
* @category constructors
|
|
627
|
+
* @since 4.0.0
|
|
628
|
+
*/
|
|
629
|
+
export function WithHeaders<S extends Schema.Top, H extends Schema.Struct.Fields>(
|
|
630
|
+
schema: S,
|
|
631
|
+
headers: H
|
|
632
|
+
): WithHeaders<S, Schema.Struct<H>>
|
|
633
|
+
export function WithHeaders<S extends Schema.Top, H extends Schema.Top>(
|
|
634
|
+
schema: S,
|
|
635
|
+
headers: H
|
|
636
|
+
): WithHeaders<S, H>
|
|
637
|
+
export function WithHeaders(
|
|
638
|
+
schema: Schema.Top,
|
|
639
|
+
headers: Schema.Top | Schema.Struct.Fields
|
|
640
|
+
): WithHeaders<Schema.Top, Schema.Top> {
|
|
641
|
+
if (isWithHeaders(schema)) {
|
|
642
|
+
throw new Error("WithHeaders schemas cannot be nested")
|
|
643
|
+
}
|
|
644
|
+
return Schema.make<WithHeaders<Schema.Top, Schema.Top>>(withHeadersValueSchema.ast, {
|
|
645
|
+
[WithHeadersTypeId]: WithHeadersTypeId,
|
|
646
|
+
schema,
|
|
647
|
+
headers: Schema.isSchema(headers) ? headers : Schema.Struct(headers)
|
|
648
|
+
})
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
/**
|
|
652
|
+
* Constructs a `WithHeaders` response value from a body and headers.
|
|
653
|
+
*
|
|
654
|
+
* The returned value is branded so servers and clients can detect it exactly,
|
|
655
|
+
* including in mixed success unions. The same shape is used on both sides: a
|
|
656
|
+
* value received from a client can be returned from another handler unchanged.
|
|
657
|
+
*
|
|
658
|
+
* See {@link WithHeaders} for an example that constructs a schema and its
|
|
659
|
+
* corresponding response value.
|
|
660
|
+
*
|
|
661
|
+
* @category constructors
|
|
662
|
+
* @since 4.0.0
|
|
663
|
+
*/
|
|
664
|
+
export const withHeaders = <A, H>(options: {
|
|
665
|
+
readonly body: A
|
|
666
|
+
readonly headers: H
|
|
667
|
+
}): withHeaders<A, H> => ({
|
|
668
|
+
[WithHeadersValueTypeId]: WithHeadersValueTypeId,
|
|
669
|
+
body: options.body,
|
|
670
|
+
headers: options.headers
|
|
671
|
+
})
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
* Returns `true` when a schema is a `WithHeaders` response schema.
|
|
675
|
+
*
|
|
676
|
+
* ```ts import.meta.vitest
|
|
677
|
+
* import { Schema } from "effect"
|
|
678
|
+
* import { HttpApiSchema } from "effect/unstable/httpapi"
|
|
679
|
+
*
|
|
680
|
+
* const schema = HttpApiSchema.WithHeaders(Schema.String, {
|
|
681
|
+
* "x-request-id": Schema.String
|
|
682
|
+
* })
|
|
683
|
+
*
|
|
684
|
+
* HttpApiSchema.isWithHeaders(schema) // => true
|
|
685
|
+
* HttpApiSchema.isWithHeaders(Schema.String) // => false
|
|
686
|
+
* ```
|
|
687
|
+
*
|
|
688
|
+
* @category predicates
|
|
689
|
+
* @since 4.0.0
|
|
690
|
+
*/
|
|
691
|
+
export const isWithHeaders = (u: unknown): u is WithHeaders<Schema.Top, Schema.Top> =>
|
|
692
|
+
Schema.isSchema(u) && Predicate.hasProperty(u, WithHeadersTypeId)
|
|
693
|
+
|
|
694
|
+
/** @internal */
|
|
695
|
+
export function rebuildWithHeaders(
|
|
696
|
+
self: WithHeaders<Schema.Top, Schema.Top>,
|
|
697
|
+
schema: Schema.Top,
|
|
698
|
+
headers: Schema.Top
|
|
699
|
+
): WithHeaders<Schema.Top, Schema.Top> {
|
|
700
|
+
return Schema.make<WithHeaders<Schema.Top, Schema.Top>>(self.ast, {
|
|
701
|
+
[WithHeadersTypeId]: WithHeadersTypeId,
|
|
702
|
+
schema,
|
|
703
|
+
headers
|
|
704
|
+
})
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
/**
|
|
708
|
+
* Schema type returned by `encodeToWithHeaders`, encoding as a `{ body, headers }`
|
|
709
|
+
* pair while decoding to the source schema type.
|
|
710
|
+
*
|
|
711
|
+
* @category schemas
|
|
712
|
+
* @since 4.0.0
|
|
713
|
+
*/
|
|
714
|
+
export interface encodeToWithHeaders<
|
|
715
|
+
S extends Schema.Top,
|
|
716
|
+
Body extends Schema.Top,
|
|
717
|
+
Headers extends Schema.Struct.Fields
|
|
718
|
+
> extends
|
|
719
|
+
Schema.decodeTo<
|
|
720
|
+
Schema.toType<S>,
|
|
721
|
+
Schema.Struct<{
|
|
722
|
+
readonly body: Body
|
|
723
|
+
readonly headers: Schema.Struct<Headers>
|
|
724
|
+
}>
|
|
725
|
+
>
|
|
726
|
+
{}
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
* Encodes a schema as a `{ body, headers }` pair, folding response headers into
|
|
730
|
+
* an opaque domain type such as an error class.
|
|
731
|
+
*
|
|
732
|
+
* **Details**
|
|
733
|
+
*
|
|
734
|
+
* The encoded side is the pair of the body schema and the headers fields; the
|
|
735
|
+
* Type stays the source schema's Type. The body schema is authoritative for
|
|
736
|
+
* everything wire-level: status, content type, and response encoding resolve
|
|
737
|
+
* from the body schema's annotations.
|
|
738
|
+
*
|
|
739
|
+
* The mappings are pure total functions: validation lives in the body and
|
|
740
|
+
* header schemas, the mappings only reshape valid data.
|
|
741
|
+
*
|
|
742
|
+
* Streams used as the body schema turn mid-stream transport errors into
|
|
743
|
+
* defects on the client. Stream responses should use {@link WithHeaders},
|
|
744
|
+
* which preserves the body stream's error channel in the generated client.
|
|
745
|
+
*
|
|
746
|
+
* ```ts import.meta.vitest
|
|
747
|
+
* import { Schema } from "effect"
|
|
748
|
+
* import { HttpApiSchema } from "effect/unstable/httpapi"
|
|
749
|
+
*
|
|
750
|
+
* class UserNotFound extends Schema.TaggedError<UserNotFound>()("UserNotFound", {
|
|
751
|
+
* userId: Schema.Int
|
|
752
|
+
* }) {}
|
|
753
|
+
*
|
|
754
|
+
* const UserNotFoundWithHeaders = UserNotFound.pipe(
|
|
755
|
+
* HttpApiSchema.encodeToWithHeaders({
|
|
756
|
+
* body: HttpApiSchema.Empty(404),
|
|
757
|
+
* headers: {
|
|
758
|
+
* "x-user-id": Schema.Int
|
|
759
|
+
* }
|
|
760
|
+
* }, {
|
|
761
|
+
* decode: ({ headers }) => new UserNotFound({ userId: headers["x-user-id"] }),
|
|
762
|
+
* encode: (error) => ({
|
|
763
|
+
* headers: { "x-user-id": error.userId },
|
|
764
|
+
* body: undefined
|
|
765
|
+
* })
|
|
766
|
+
* })
|
|
767
|
+
* )
|
|
768
|
+
*
|
|
769
|
+
* const encoded = Schema.encodeSync(UserNotFoundWithHeaders)(new UserNotFound({ userId: 123 }))
|
|
770
|
+
* encoded // => { body: undefined, headers: { "x-user-id": 123 } }
|
|
771
|
+
* ```
|
|
772
|
+
*
|
|
773
|
+
* @see {@link WithHeaders} for the structural wrapper recommended for success
|
|
774
|
+
* responses, including streams.
|
|
775
|
+
*
|
|
776
|
+
* @category encoding
|
|
777
|
+
* @since 4.0.0
|
|
778
|
+
*/
|
|
779
|
+
export function encodeToWithHeaders<
|
|
780
|
+
S extends Schema.Top,
|
|
781
|
+
Body extends Schema.Top,
|
|
782
|
+
Headers extends Schema.Struct.Fields
|
|
783
|
+
>(options: {
|
|
784
|
+
readonly body: Body
|
|
785
|
+
readonly headers: Headers
|
|
786
|
+
}, transformation: {
|
|
787
|
+
readonly decode: (
|
|
788
|
+
value: Schema.Struct.Type<{ readonly body: Body; readonly headers: Schema.Struct<Headers> }>
|
|
789
|
+
) => S["Type"]
|
|
790
|
+
readonly encode: (
|
|
791
|
+
value: S["Type"]
|
|
792
|
+
) => Schema.Struct.Type<{ readonly body: Body; readonly headers: Schema.Struct<Headers> }>
|
|
793
|
+
}) {
|
|
794
|
+
return (self: S): encodeToWithHeaders<S, Body, Headers> => {
|
|
795
|
+
const body = options.body
|
|
796
|
+
const headers = Schema.Struct(options.headers)
|
|
797
|
+
const status = resolveHttpApiStatus(body.ast)
|
|
798
|
+
const encoding = resolveHttpApiEncoding(body.ast)
|
|
799
|
+
return Schema.Struct({ body, headers }).pipe(
|
|
800
|
+
Schema.decodeTo(
|
|
801
|
+
Schema.toType(self),
|
|
802
|
+
SchemaTransformation.transform(transformation)
|
|
803
|
+
)
|
|
804
|
+
).annotate({
|
|
805
|
+
"~httpApiWithHeaders": { body, headers, headersCodec: Schema.toEncoded(headers) },
|
|
806
|
+
...(status !== undefined ? { httpApiStatus: status } : undefined),
|
|
807
|
+
...(encoding !== undefined ? { "~httpApiEncoding": encoding } : undefined)
|
|
808
|
+
})
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
|
|
486
812
|
/**
|
|
487
813
|
* Runtime brand key used to mark schemas as buffered multipart payloads.
|
|
488
814
|
*
|
|
@@ -683,6 +1009,9 @@ export const isNoContent = (ast: SchemaAST.AST): boolean => {
|
|
|
683
1009
|
|
|
684
1010
|
const resolveHttpApiEncoding = SchemaAST.resolveAt<Encoding>("~httpApiEncoding")
|
|
685
1011
|
|
|
1012
|
+
/** @internal */
|
|
1013
|
+
export const getWithHeadersAnnotation = SchemaAST.resolveAt<WithHeadersAnnotation>("~httpApiWithHeaders")
|
|
1014
|
+
|
|
686
1015
|
const resolveHttpApiStatus = SchemaAST.resolveAt<number>("httpApiStatus")
|
|
687
1016
|
|
|
688
1017
|
const defaultJsonEncoding: Encoding = {
|
|
@@ -719,6 +1048,22 @@ export function getStatusSuccess(self: SchemaAST.AST): number {
|
|
|
719
1048
|
return resolveHttpApiStatus(self) ?? 200
|
|
720
1049
|
}
|
|
721
1050
|
|
|
1051
|
+
/** @internal */
|
|
1052
|
+
export function getStatusSuccessSchema(schema: Schema.Constraint): number {
|
|
1053
|
+
if (isWithHeaders(schema)) {
|
|
1054
|
+
return resolveHttpApiStatus(schema.ast) ?? getStatusSuccess(schema.schema.ast)
|
|
1055
|
+
}
|
|
1056
|
+
return getStatusSuccess(schema.ast)
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
/** @internal */
|
|
1060
|
+
export function getResponseEncodingSchema(schema: Schema.Constraint): ResponseEncoding {
|
|
1061
|
+
if (isWithHeaders(schema) && resolveHttpApiEncoding(schema.ast) === undefined) {
|
|
1062
|
+
return getResponseEncoding(schema.schema.ast)
|
|
1063
|
+
}
|
|
1064
|
+
return getResponseEncoding(schema.ast)
|
|
1065
|
+
}
|
|
1066
|
+
|
|
722
1067
|
/** @internal */
|
|
723
1068
|
export function getStatusStream(self: StreamSchema): number {
|
|
724
1069
|
return getStatusSuccess(self.ast)
|
|
@@ -728,3 +1073,11 @@ export function getStatusStream(self: StreamSchema): number {
|
|
|
728
1073
|
export function getStatusError(self: SchemaAST.AST): number {
|
|
729
1074
|
return resolveHttpApiStatus(self) ?? 500
|
|
730
1075
|
}
|
|
1076
|
+
|
|
1077
|
+
/** @internal */
|
|
1078
|
+
export function getStatusErrorSchema(schema: Schema.Constraint): number {
|
|
1079
|
+
if (isWithHeaders(schema)) {
|
|
1080
|
+
return resolveHttpApiStatus(schema.ast) ?? getStatusError(schema.schema.ast)
|
|
1081
|
+
}
|
|
1082
|
+
return getStatusError(schema.ast)
|
|
1083
|
+
}
|
|
@@ -369,11 +369,30 @@ function fromApiWith<Id extends string, Groups extends HttpApiGroup.Constraint>(
|
|
|
369
369
|
const method = endpoint.method.toLowerCase() as OpenAPISpecMethodName
|
|
370
370
|
|
|
371
371
|
function processResponseBodies(bodies: ResponseBodies, defaultDescription: () => string) {
|
|
372
|
-
for (const [status, { content, descriptions, streamContent }] of bodies) {
|
|
372
|
+
for (const [status, { content, descriptions, headers, streamContent }] of bodies) {
|
|
373
373
|
const description = descriptions.size > 0 ? Array.from(descriptions).join(" | ") : defaultDescription()
|
|
374
374
|
InternalRecord.assignProperty(op.responses, status, {
|
|
375
375
|
description
|
|
376
376
|
})
|
|
377
|
+
for (const schema of headers) {
|
|
378
|
+
const ast = SchemaAST.getLastEncoding(schema.ast)
|
|
379
|
+
if (SchemaAST.isObjects(ast)) {
|
|
380
|
+
for (const ps of ast.propertySignatures) {
|
|
381
|
+
const name = String(ps.name).toLowerCase()
|
|
382
|
+
if (name === "content-type") continue
|
|
383
|
+
op.responses[status].headers ??= {}
|
|
384
|
+
InternalRecord.assignProperty(op.responses[status].headers, name, {
|
|
385
|
+
schema: {},
|
|
386
|
+
required: !SchemaAST.isOptional(ps.type)
|
|
387
|
+
})
|
|
388
|
+
pathOps.push({
|
|
389
|
+
_tag: "parameter",
|
|
390
|
+
ast: ps.type,
|
|
391
|
+
path: ["paths", path, method, "responses", String(status), "headers", name, "schema"]
|
|
392
|
+
})
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
377
396
|
if (content !== undefined) {
|
|
378
397
|
content.forEach((map, encoding) => {
|
|
379
398
|
map.forEach((schemas, contentType) => {
|
|
@@ -568,7 +587,7 @@ function fromApiWith<Id extends string, Groups extends HttpApiGroup.Constraint>(
|
|
|
568
587
|
processResponseBodies(
|
|
569
588
|
extractResponseBodies(
|
|
570
589
|
HttpApiEndpoint.getErrorSchemas(endpoint),
|
|
571
|
-
HttpApiSchema.
|
|
590
|
+
HttpApiSchema.getStatusErrorSchema,
|
|
572
591
|
resolveDescriptionOrIdentifier
|
|
573
592
|
),
|
|
574
593
|
() => "Error"
|
|
@@ -673,6 +692,7 @@ type ResponseBodies = Map<
|
|
|
673
692
|
{
|
|
674
693
|
descriptions: Set<string>
|
|
675
694
|
content: Content | undefined // undefined means no content
|
|
695
|
+
headers: Array<Schema.Constraint>
|
|
676
696
|
streamContent: StreamContent | undefined
|
|
677
697
|
}
|
|
678
698
|
>
|
|
@@ -682,19 +702,20 @@ const reservedStreamFailureEvent = "effect/httpapi/stream/failure"
|
|
|
682
702
|
function extractSuccessResponseBodies(endpoint: HttpApiEndpoint.Top): ResponseBodies {
|
|
683
703
|
return extractResponseBodies(
|
|
684
704
|
HttpApiEndpoint.getSuccessSchemas(endpoint),
|
|
685
|
-
HttpApiSchema.
|
|
705
|
+
HttpApiSchema.getStatusSuccessSchema,
|
|
686
706
|
resolveDescriptionOrIdentifier
|
|
687
707
|
)
|
|
688
708
|
}
|
|
689
709
|
|
|
690
710
|
function extractResponseBodies(
|
|
691
711
|
schemas: Array<Schema.Constraint>,
|
|
692
|
-
getStatus: (
|
|
712
|
+
getStatus: (schema: Schema.Constraint) => number,
|
|
693
713
|
getDescription: (ast: SchemaAST.AST) => string | undefined
|
|
694
714
|
): ResponseBodies {
|
|
695
715
|
const map = new Map<number, {
|
|
696
716
|
descriptions: Set<string>
|
|
697
717
|
content: Content | undefined
|
|
718
|
+
headers: Array<Schema.Constraint>
|
|
698
719
|
streamContent: StreamContent | undefined
|
|
699
720
|
}>()
|
|
700
721
|
|
|
@@ -703,16 +724,25 @@ function extractResponseBodies(
|
|
|
703
724
|
return map
|
|
704
725
|
|
|
705
726
|
function process(schema: Schema.Constraint) {
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
const ast =
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
727
|
+
const annotation = HttpApiSchema.getWithHeadersAnnotation(schema.ast)
|
|
728
|
+
const body = HttpApiSchema.isWithHeaders(schema) ? schema.schema : annotation?.body ?? schema
|
|
729
|
+
const headers = HttpApiSchema.isWithHeaders(schema) ? schema.headers : annotation?.headersCodec
|
|
730
|
+
const status = getStatus(schema)
|
|
731
|
+
const ast = body.ast
|
|
732
|
+
if (HttpApiSchema.isStreamSchema(body)) {
|
|
733
|
+
addStreamContent(body, status)
|
|
734
|
+
} else if (HttpApiSchema.isNoContent(ast)) {
|
|
735
|
+
addNoContent(status, getDescription(schema.ast) ?? getDescription(ast) ?? "<No Content>")
|
|
714
736
|
} else {
|
|
715
|
-
addContent(
|
|
737
|
+
addContent(
|
|
738
|
+
body,
|
|
739
|
+
status,
|
|
740
|
+
HttpApiSchema.getResponseEncodingSchema(schema),
|
|
741
|
+
getDescription(schema.ast) ?? getDescription(ast)
|
|
742
|
+
)
|
|
743
|
+
}
|
|
744
|
+
if (headers !== undefined) {
|
|
745
|
+
map.get(status)!.headers.push(headers)
|
|
716
746
|
}
|
|
717
747
|
}
|
|
718
748
|
|
|
@@ -722,6 +752,7 @@ function extractResponseBodies(
|
|
|
722
752
|
map.set(status, {
|
|
723
753
|
descriptions: new Set([description]),
|
|
724
754
|
content: undefined,
|
|
755
|
+
headers: [],
|
|
725
756
|
streamContent: undefined
|
|
726
757
|
})
|
|
727
758
|
} else {
|
|
@@ -731,14 +762,19 @@ function extractResponseBodies(
|
|
|
731
762
|
}
|
|
732
763
|
}
|
|
733
764
|
|
|
734
|
-
function addContent(
|
|
735
|
-
|
|
765
|
+
function addContent(
|
|
766
|
+
schema: Schema.Constraint,
|
|
767
|
+
status: number,
|
|
768
|
+
encoding: HttpApiSchema.Encoding,
|
|
769
|
+
description: string | undefined
|
|
770
|
+
) {
|
|
736
771
|
const statusMap = map.get(status)
|
|
737
772
|
const { _tag, contentType } = encoding
|
|
738
773
|
if (statusMap === undefined) {
|
|
739
774
|
map.set(status, {
|
|
740
775
|
descriptions: new Set(description !== undefined ? [description] : []),
|
|
741
776
|
content: new Map([[_tag, new Map([[contentType, new Set([schema])]])]]),
|
|
777
|
+
headers: [],
|
|
742
778
|
streamContent: undefined
|
|
743
779
|
})
|
|
744
780
|
} else {
|
|
@@ -765,19 +801,24 @@ function extractResponseBodies(
|
|
|
765
801
|
}
|
|
766
802
|
}
|
|
767
803
|
|
|
768
|
-
function addStreamContent(
|
|
769
|
-
|
|
804
|
+
function addStreamContent(
|
|
805
|
+
stream: HttpApiSchema.StreamSchema,
|
|
806
|
+
status: number
|
|
807
|
+
) {
|
|
770
808
|
const statusMap = map.get(status)
|
|
771
809
|
if (statusMap === undefined) {
|
|
772
810
|
map.set(status, {
|
|
773
811
|
descriptions: new Set(),
|
|
774
812
|
content: undefined,
|
|
813
|
+
headers: [],
|
|
775
814
|
streamContent: new Map([[stream.contentType, stream]])
|
|
776
815
|
})
|
|
777
|
-
} else if (statusMap.streamContent === undefined) {
|
|
778
|
-
statusMap.streamContent = new Map([[stream.contentType, stream]])
|
|
779
816
|
} else {
|
|
780
|
-
statusMap.streamContent
|
|
817
|
+
if (statusMap.streamContent === undefined) {
|
|
818
|
+
statusMap.streamContent = new Map([[stream.contentType, stream]])
|
|
819
|
+
} else {
|
|
820
|
+
statusMap.streamContent.set(stream.contentType, stream)
|
|
821
|
+
}
|
|
781
822
|
}
|
|
782
823
|
}
|
|
783
824
|
}
|
|
@@ -1042,8 +1083,17 @@ export type OpenApiSpecContent = {
|
|
|
1042
1083
|
export interface OpenApiSpecResponse {
|
|
1043
1084
|
description: string
|
|
1044
1085
|
content?: OpenApiSpecContent
|
|
1086
|
+
headers?: Record<string, OpenAPISpecHeader>
|
|
1045
1087
|
}
|
|
1046
1088
|
|
|
1089
|
+
/**
|
|
1090
|
+
* Generated OpenAPI response header object.
|
|
1091
|
+
*
|
|
1092
|
+
* @category models
|
|
1093
|
+
* @since 4.0.0
|
|
1094
|
+
*/
|
|
1095
|
+
export type OpenAPISpecHeader = Omit<OpenAPISpecParameter, "name" | "in">
|
|
1096
|
+
|
|
1047
1097
|
/**
|
|
1048
1098
|
* Generated OpenAPI media type object containing the JSON Schema for a request or response body.
|
|
1049
1099
|
*
|
|
@@ -167,7 +167,7 @@ export const make: (
|
|
|
167
167
|
readonly label: string
|
|
168
168
|
readonly exportInterval: Duration.Input
|
|
169
169
|
readonly maxBatchSize: number | "disabled"
|
|
170
|
-
readonly body: (data: Array<any>) => HttpBody
|
|
170
|
+
readonly body: (data: Array<any>) => readonly [body: HttpBody, onSuccess: Effect.Effect<void>]
|
|
171
171
|
readonly shutdownTimeout: Duration.Input
|
|
172
172
|
}
|
|
173
173
|
) => Effect.Effect<
|
|
@@ -208,9 +208,11 @@ export const make: (
|
|
|
208
208
|
}
|
|
209
209
|
buffer = []
|
|
210
210
|
}
|
|
211
|
+
const [body, onSuccess] = options.body(items)
|
|
211
212
|
return client.execute(
|
|
212
|
-
HttpClientRequest.setBody(request,
|
|
213
|
+
HttpClientRequest.setBody(request, body)
|
|
213
214
|
).pipe(
|
|
215
|
+
Effect.andThen(onSuccess),
|
|
214
216
|
Effect.asVoid,
|
|
215
217
|
Effect.withTracerEnabled(false)
|
|
216
218
|
)
|
|
@@ -71,7 +71,7 @@ export const make: (
|
|
|
71
71
|
headers: options.headers,
|
|
72
72
|
maxBatchSize: options.maxBatchSize ?? 1000,
|
|
73
73
|
exportInterval: options.exportInterval ?? Duration.seconds(1),
|
|
74
|
-
body: (data) =>
|
|
74
|
+
body: (data) => [
|
|
75
75
|
serialization.logs({
|
|
76
76
|
resourceLogs: [{
|
|
77
77
|
resource: otelResource,
|
|
@@ -81,6 +81,8 @@ export const make: (
|
|
|
81
81
|
}]
|
|
82
82
|
}]
|
|
83
83
|
}),
|
|
84
|
+
Effect.void
|
|
85
|
+
],
|
|
84
86
|
shutdownTimeout: options.shutdownTimeout ?? Duration.seconds(3)
|
|
85
87
|
})
|
|
86
88
|
|