effect 4.0.0-beta.94 → 4.0.0-beta.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Array.d.ts.map +1 -1
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/Boolean.d.ts.map +1 -1
- package/dist/Brand.d.ts.map +1 -1
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Channel.d.ts.map +1 -1
- package/dist/ChannelSchema.d.ts.map +1 -1
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Combiner.d.ts.map +1 -1
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +44 -6
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +63 -24
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Console.d.ts.map +1 -1
- package/dist/Context.d.ts.map +1 -1
- package/dist/Cron.d.ts +4 -1
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +98 -53
- package/dist/Cron.js.map +1 -1
- package/dist/Crypto.d.ts.map +1 -1
- package/dist/Data.d.ts.map +1 -1
- package/dist/DateTime.d.ts +12 -12
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effectable.d.ts.map +1 -1
- package/dist/Encoding.d.ts.map +1 -1
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equivalence.d.ts.map +1 -1
- package/dist/ErrorReporter.d.ts.map +1 -1
- package/dist/ExecutionPlan.d.ts +2 -2
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/FiberHandle.d.ts +8 -8
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberMap.d.ts +8 -8
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberSet.d.ts +4 -4
- package/dist/FiberSet.d.ts.map +1 -1
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/Filter.d.ts.map +1 -1
- package/dist/Function.d.ts.map +1 -1
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js.map +1 -1
- package/dist/Hash.d.ts.map +1 -1
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashRing.d.ts.map +1 -1
- package/dist/Inspectable.d.ts.map +1 -1
- package/dist/Inspectable.js.map +1 -1
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Latch.d.ts.map +1 -1
- package/dist/Layer.d.ts.map +1 -1
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerRef.d.ts +5 -7
- package/dist/LayerRef.d.ts.map +1 -1
- package/dist/LayerRef.js +4 -6
- package/dist/LayerRef.js.map +1 -1
- package/dist/LogLevel.d.ts.map +1 -1
- package/dist/Logger.d.ts.map +1 -1
- package/dist/ManagedRuntime.d.ts.map +1 -1
- package/dist/Metric.d.ts.map +1 -1
- package/dist/MutableHashMap.d.ts.map +1 -1
- package/dist/MutableHashSet.d.ts.map +1 -1
- package/dist/MutableList.d.ts.map +1 -1
- package/dist/MutableRef.d.ts.map +1 -1
- package/dist/NonEmptyIterable.d.ts.map +1 -1
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +28 -10
- package/dist/Number.js.map +1 -1
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Option.d.ts.map +1 -1
- package/dist/Order.d.ts.map +1 -1
- package/dist/Ordering.d.ts.map +1 -1
- package/dist/PartitionedSemaphore.d.ts.map +1 -1
- package/dist/Pipeable.d.ts.map +1 -1
- package/dist/PlatformError.d.ts.map +1 -1
- package/dist/Pool.d.ts.map +1 -1
- package/dist/PrimaryKey.d.ts.map +1 -1
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/Pull.d.ts.map +1 -1
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Random.d.ts.map +1 -1
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/Record.d.ts.map +1 -1
- package/dist/Redactable.d.ts.map +1 -1
- package/dist/Redacted.d.ts.map +1 -1
- package/dist/Ref.d.ts.map +1 -1
- package/dist/RegExp.d.ts.map +1 -1
- package/dist/Request.d.ts +1 -1
- package/dist/Request.d.ts.map +1 -1
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Result.d.ts.map +1 -1
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Schedule.d.ts +1206 -4013
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +244 -1348
- package/dist/Schedule.js.map +1 -1
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +71 -22
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +76 -33
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +25 -10
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaError.d.ts +53 -0
- package/dist/SchemaError.d.ts.map +1 -0
- package/dist/SchemaError.js +61 -0
- package/dist/SchemaError.js.map +1 -0
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +17 -12
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaRepresentation.d.ts +106 -106
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +186 -224
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +38 -2
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +38 -2
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/ScopedCache.d.ts.map +1 -1
- package/dist/ScopedRef.d.ts.map +1 -1
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Stdio.d.ts.map +1 -1
- package/dist/Stream.d.ts +2 -2
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +1 -1
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js.map +1 -1
- package/dist/Struct.d.ts.map +1 -1
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SynchronizedRef.d.ts.map +1 -1
- package/dist/Take.d.ts.map +1 -1
- package/dist/Terminal.d.ts.map +1 -1
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Tuple.d.ts.map +1 -1
- package/dist/TxChunk.d.ts.map +1 -1
- package/dist/TxDeferred.d.ts.map +1 -1
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashSet.d.ts.map +1 -1
- package/dist/TxPriorityQueue.d.ts.map +1 -1
- package/dist/TxPubSub.d.ts.map +1 -1
- package/dist/TxQueue.d.ts.map +1 -1
- package/dist/TxReentrantLock.d.ts.map +1 -1
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSubscriptionRef.d.ts.map +1 -1
- package/dist/Types.d.ts +1 -1
- package/dist/Types.d.ts.map +1 -1
- package/dist/UndefinedOr.d.ts.map +1 -1
- package/dist/Utils.d.ts.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/effect.js +26 -8
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/schema/equivalence.js +1 -2
- package/dist/internal/schema/equivalence.js.map +1 -1
- package/dist/internal/schema/representation.js +1 -3
- package/dist/internal/schema/representation.js.map +1 -1
- package/dist/internal/schema/schema.d.ts +0 -13
- package/dist/internal/schema/schema.d.ts.map +1 -1
- package/dist/internal/schema/schema.js +4 -29
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/testing/TestClock.d.ts.map +1 -1
- package/dist/testing/TestConsole.d.ts.map +1 -1
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +1 -1
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +1 -1
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.d.ts +278 -278
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/Model.d.ts.map +1 -1
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
- package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +8 -16
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +8 -16
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
- package/dist/unstable/cli/Command.d.ts +4 -3
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +3 -3
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Completions.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +6 -8
- package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -1
- package/dist/unstable/cli/GlobalFlag.js +6 -6
- package/dist/unstable/cli/GlobalFlag.js.map +1 -1
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Prompt.d.ts.map +1 -1
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/internal/ansi.d.ts.map +1 -1
- package/dist/unstable/cli/internal/ansi.js.map +1 -1
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/help.d.ts.map +1 -1
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cluster/ClusterCron.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterCron.js +1 -1
- package/dist/unstable/cluster/ClusterCron.js.map +1 -1
- package/dist/unstable/cluster/ClusterError.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.d.ts +1 -1
- package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +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/DeliverAt.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityId.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxy.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.d.ts +1 -1
- package/dist/unstable/cluster/EntityProxyServer.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.js +2 -4
- package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
- package/dist/unstable/cluster/EntityType.d.ts.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts.map +1 -1
- package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/MachineId.d.ts.map +1 -1
- package/dist/unstable/cluster/Message.d.ts.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts +25 -29
- package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Runner.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts +1 -1
- package/dist/unstable/cluster/RunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +8 -8
- package/dist/unstable/cluster/ShardId.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +3 -4
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardingRegistrationEvent.d.ts +6 -8
- package/dist/unstable/cluster/ShardingRegistrationEvent.d.ts.map +1 -1
- package/dist/unstable/cluster/SingleRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/Singleton.d.ts.map +1 -1
- package/dist/unstable/cluster/SingletonAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/Snowflake.d.ts +1 -1
- package/dist/unstable/cluster/Snowflake.d.ts.map +1 -1
- package/dist/unstable/cluster/Snowflake.js +1 -1
- package/dist/unstable/cluster/Snowflake.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +26 -24
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/devtools/DevTools.d.ts.map +1 -1
- package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
- package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/eventlog/Event.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventGroup.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLog.js +2 -2
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +21 -21
- package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +3 -4
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.d.ts +1 -1
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Etag.d.ts.map +1 -1
- package/dist/unstable/http/Headers.d.ts.map +1 -1
- package/dist/unstable/http/HttpBody.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientError.d.ts +1 -1
- package/dist/unstable/http/HttpClientError.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
- package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +1 -1
- package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts +2 -2
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpTraceContext.d.ts.map +1 -1
- package/dist/unstable/http/Multipart.d.ts +2 -1
- package/dist/unstable/http/Multipart.d.ts.map +1 -1
- package/dist/unstable/http/Url.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApi.d.ts +36 -15
- package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js +19 -20
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +51 -62
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +68 -58
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +53 -53
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +40 -30
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +171 -170
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.js +31 -19
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +23 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.js +31 -0
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.d.ts +55 -30
- package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.js +22 -29
- package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +8 -8
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts +2 -2
- package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.js +4 -3
- package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +8 -0
- package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.d.ts +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiTest.d.ts +4 -4
- package/dist/unstable/httpapi/HttpApiTest.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiTest.js +9 -8
- package/dist/unstable/httpapi/HttpApiTest.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +77 -37
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/httpapi/internal/html.js +6 -2
- package/dist/unstable/httpapi/internal/html.js.map +1 -1
- package/dist/unstable/httpapi/internal/mediaType.d.ts +2 -0
- package/dist/unstable/httpapi/internal/mediaType.d.ts.map +1 -0
- package/dist/unstable/httpapi/internal/mediaType.js +7 -0
- package/dist/unstable/httpapi/internal/mediaType.js.map +1 -0
- package/dist/unstable/observability/Otlp.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +3 -1
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/internal/otlpEnv.d.ts.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
- package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.js +16 -12
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/Redis.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcess.js.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.d.ts +2 -2
- package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +1 -1
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +7 -7
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.js +3 -2
- package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/unstable/reactivity/AtomRef.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.d.ts +2 -2
- package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +28 -37
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/unstable/reactivity/Hydration.d.ts.map +1 -1
- package/dist/unstable/reactivity/Reactivity.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts +2 -1
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +5 -5
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMessage.d.ts +7 -7
- package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMessage.js +2 -2
- package/dist/unstable/rpc/RpcMessage.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +8 -8
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +5 -3
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +11 -8
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/rpc/RpcWorker.d.ts.map +1 -1
- package/dist/unstable/rpc/Utils.d.ts.map +1 -1
- package/dist/unstable/schema/Model.d.ts +24 -38
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +1 -1
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/SocketServer.d.ts.map +1 -1
- package/dist/unstable/sql/Migrator.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlError.d.ts +2 -2
- package/dist/unstable/sql/SqlError.d.ts.map +1 -1
- package/dist/unstable/sql/SqlError.js.map +1 -1
- package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
- package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
- package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
- package/dist/unstable/sql/SqlStream.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.d.ts.map +1 -1
- package/dist/unstable/workers/Transferable.d.ts.map +1 -1
- package/dist/unstable/workers/Worker.d.ts.map +1 -1
- package/dist/unstable/workers/WorkerError.d.ts.map +1 -1
- package/dist/unstable/workflow/Activity.d.ts +1 -1
- package/dist/unstable/workflow/Activity.d.ts.map +1 -1
- package/dist/unstable/workflow/Activity.js +1 -1
- package/dist/unstable/workflow/Activity.js.map +1 -1
- package/dist/unstable/workflow/DurableClock.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.js +1 -1
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableQueue.js +1 -1
- package/dist/unstable/workflow/DurableQueue.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.d.ts +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.js +1 -2
- package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
- package/package.json +11 -12
- package/src/ConfigProvider.ts +79 -27
- package/src/Cron.ts +109 -57
- package/src/LayerRef.ts +4 -6
- package/src/Number.ts +29 -10
- package/src/Schedule.ts +1437 -4445
- package/src/Schema.ts +95 -34
- package/src/SchemaAST.ts +25 -13
- package/src/SchemaError.ts +64 -0
- package/src/SchemaGetter.ts +22 -16
- package/src/SchemaRepresentation.ts +165 -202
- package/src/SchemaTransformation.ts +42 -2
- package/src/Stream.ts +1 -1
- package/src/index.ts +10 -0
- package/src/internal/effect.ts +39 -22
- package/src/internal/schema/equivalence.ts +1 -2
- package/src/internal/schema/representation.ts +4 -4
- package/src/internal/schema/schema.ts +4 -37
- package/src/unstable/cli/CliError.ts +24 -16
- package/src/unstable/cli/Command.ts +8 -8
- package/src/unstable/cli/GlobalFlag.ts +22 -33
- package/src/unstable/cluster/ClusterCron.ts +4 -3
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +4 -3
- package/src/unstable/cluster/EntityProxyServer.ts +15 -17
- package/src/unstable/cluster/Sharding.ts +4 -4
- package/src/unstable/cluster/Snowflake.ts +2 -2
- package/src/unstable/cluster/internal/entityManager.ts +61 -47
- package/src/unstable/eventlog/EventLog.ts +4 -3
- package/src/unstable/httpapi/HttpApi.ts +72 -47
- package/src/unstable/httpapi/HttpApiBuilder.ts +320 -217
- package/src/unstable/httpapi/HttpApiClient.ts +196 -151
- package/src/unstable/httpapi/HttpApiEndpoint.ts +251 -447
- package/src/unstable/httpapi/HttpApiError.ts +33 -0
- package/src/unstable/httpapi/HttpApiGroup.ts +95 -74
- package/src/unstable/httpapi/HttpApiMiddleware.ts +10 -7
- package/src/unstable/httpapi/HttpApiScalar.ts +15 -12
- package/src/unstable/httpapi/HttpApiSchema.ts +8 -0
- package/src/unstable/httpapi/HttpApiSwagger.ts +2 -2
- package/src/unstable/httpapi/HttpApiTest.ts +15 -14
- package/src/unstable/httpapi/OpenApi.ts +74 -36
- package/src/unstable/httpapi/internal/html.ts +9 -2
- package/src/unstable/httpapi/internal/mediaType.ts +6 -0
- package/src/unstable/observability/OtlpExporter.ts +1 -1
- package/src/unstable/persistence/PersistedQueue.ts +16 -14
- package/src/unstable/reactivity/Atom.ts +1 -1
- package/src/unstable/reactivity/AtomHttpApi.ts +164 -162
- package/src/unstable/reactivity/AtomRegistry.ts +35 -44
- package/src/unstable/rpc/RpcClient.ts +10 -9
- package/src/unstable/rpc/RpcMessage.ts +8 -9
- package/src/unstable/rpc/RpcSerialization.ts +16 -16
- package/src/unstable/rpc/RpcServer.ts +15 -9
- package/src/unstable/workflow/Activity.ts +6 -5
- package/src/unstable/workflow/DurableDeferred.ts +1 -1
- package/src/unstable/workflow/DurableQueue.ts +4 -3
- package/src/unstable/workflow/WorkflowEngine.ts +4 -3
- package/src/unstable/workflow/WorkflowProxyServer.ts +11 -12
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Defines endpoint declarations used inside an HTTP API group.
|
|
3
3
|
*
|
|
4
|
-
* An endpoint records a stable
|
|
4
|
+
* An endpoint records a stable identifier, HTTP method, router path, request schemas,
|
|
5
5
|
* response schemas, declared errors, middleware, and annotations. Endpoint
|
|
6
6
|
* values are declarations, not handlers: builders use them to decode requests,
|
|
7
7
|
* type handler input, encode responses, generate OpenAPI metadata, and derive
|
|
@@ -21,6 +21,7 @@ import * as Predicate from "../../Predicate.ts"
|
|
|
21
21
|
import * as Schema from "../../Schema.ts"
|
|
22
22
|
import * as AST from "../../SchemaAST.ts"
|
|
23
23
|
import type * as Stream from "../../Stream.ts"
|
|
24
|
+
import type { Simplify } from "../../Struct.ts"
|
|
24
25
|
import type * as Types from "../../Types.ts"
|
|
25
26
|
import type { HttpMethod } from "../http/HttpMethod.ts"
|
|
26
27
|
import * as HttpRouter from "../http/HttpRouter.ts"
|
|
@@ -30,6 +31,7 @@ import type * as Multipart from "../http/Multipart.ts"
|
|
|
30
31
|
import type * as HttpApiGroup from "./HttpApiGroup.ts"
|
|
31
32
|
import type * as HttpApiMiddleware from "./HttpApiMiddleware.ts"
|
|
32
33
|
import * as HttpApiSchema from "./HttpApiSchema.ts"
|
|
34
|
+
import * as MediaType from "./internal/mediaType.ts"
|
|
33
35
|
|
|
34
36
|
const TypeId = "~effect/httpapi/HttpApiEndpoint"
|
|
35
37
|
|
|
@@ -40,19 +42,7 @@ const TypeId = "~effect/httpapi/HttpApiEndpoint"
|
|
|
40
42
|
* @category guards
|
|
41
43
|
* @since 4.0.0
|
|
42
44
|
*/
|
|
43
|
-
export const isHttpApiEndpoint = (u: unknown): u is
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Maps content types to the payload encoding strategy and one or more schemas that
|
|
47
|
-
* can decode or encode payloads for that content type.
|
|
48
|
-
*
|
|
49
|
-
* @category models
|
|
50
|
-
* @since 4.0.0
|
|
51
|
-
*/
|
|
52
|
-
export type PayloadMap = ReadonlyMap<string, {
|
|
53
|
-
readonly encoding: HttpApiSchema.PayloadEncoding
|
|
54
|
-
readonly schemas: [Schema.Top, ...Array<Schema.Top>]
|
|
55
|
-
}>
|
|
45
|
+
export const isHttpApiEndpoint = (u: unknown): u is Top => Predicate.hasProperty(u, TypeId)
|
|
56
46
|
|
|
57
47
|
type SuccessType<S> = S extends HttpApiSchema.StreamSse<
|
|
58
48
|
infer _Events,
|
|
@@ -81,20 +71,64 @@ type SuccessDecodingServices<S> = S extends HttpApiSchema.StreamSse<
|
|
|
81
71
|
: S extends Schema.Constraint ? S["DecodingServices"]
|
|
82
72
|
: never
|
|
83
73
|
|
|
84
|
-
type
|
|
74
|
+
type UnwrapReadonlyArray<S> = S extends ReadonlyArray<infer A> ? A : S
|
|
85
75
|
|
|
86
76
|
type ExtractBufferedSuccess<S extends SuccessConstraint> = Exclude<
|
|
87
|
-
Extract<
|
|
77
|
+
Extract<UnwrapReadonlyArray<S>, Schema.Top>,
|
|
88
78
|
HttpApiSchema.StreamSchema
|
|
89
79
|
>
|
|
90
80
|
|
|
91
|
-
type ExtractStreamSuccess<S extends SuccessConstraint> =
|
|
81
|
+
type ExtractStreamSuccess<S extends SuccessConstraint> = UnwrapReadonlyArray<S> extends infer Success ?
|
|
92
82
|
Success extends HttpApiSchema.StreamSchema ? Success : never
|
|
93
83
|
: never
|
|
94
84
|
|
|
95
|
-
type
|
|
96
|
-
ExtractStreamSuccess<S>
|
|
97
|
-
|
|
85
|
+
type ToSuccessCodec<S extends SuccessConstraint> = [ExtractBufferedSuccess<S>] extends [never] ? ExtractStreamSuccess<S>
|
|
86
|
+
: Schema.toCodecJson<ExtractBufferedSuccess<S>> | ExtractStreamSuccess<S>
|
|
87
|
+
|
|
88
|
+
type ToJsonCodec<S> = [S] extends [never] ? never
|
|
89
|
+
: [S] extends [Schema.Constraint] ? Schema.toCodecJson<S>
|
|
90
|
+
: never
|
|
91
|
+
|
|
92
|
+
type ToStringTreeCodec<S> = [S] extends [never] ? never
|
|
93
|
+
: [S] extends [Schema.Struct.Fields] ? Schema.toCodecStringTree<Schema.Struct<S>>
|
|
94
|
+
: [S] extends [Schema.Constraint] ? Schema.toCodecStringTree<S>
|
|
95
|
+
: never
|
|
96
|
+
|
|
97
|
+
type RequestFromParts<Endpoint, ParamsType, QueryType, PayloadType, HeadersType> =
|
|
98
|
+
& ([ParamsType] extends [never] ? {} : { readonly params: Simplify<ParamsType> })
|
|
99
|
+
& ([QueryType] extends [never] ? {} : { readonly query: Simplify<QueryType> })
|
|
100
|
+
& ([PayloadType] extends [never] ? {}
|
|
101
|
+
: PayloadType extends Brand<HttpApiSchema.MultipartStreamTypeId> ?
|
|
102
|
+
{ readonly payload: Stream.Stream<Multipart.Part, Multipart.MultipartError> }
|
|
103
|
+
: { readonly payload: Simplify<PayloadType> })
|
|
104
|
+
& ([HeadersType] extends [never] ? {} : { readonly headers: Simplify<HeadersType> })
|
|
105
|
+
& {
|
|
106
|
+
readonly request: HttpServerRequest
|
|
107
|
+
readonly endpoint: Endpoint
|
|
108
|
+
readonly group: HttpApiGroup.Top
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
type RequestRawFromParts<Endpoint, ParamsType, QueryType, HeadersType> =
|
|
112
|
+
& ([ParamsType] extends [never] ? {} : { readonly params: Simplify<ParamsType> })
|
|
113
|
+
& ([QueryType] extends [never] ? {} : { readonly query: Simplify<QueryType> })
|
|
114
|
+
& ([HeadersType] extends [never] ? {} : { readonly headers: Simplify<HeadersType> })
|
|
115
|
+
& {
|
|
116
|
+
readonly request: HttpServerRequest
|
|
117
|
+
readonly endpoint: Endpoint
|
|
118
|
+
readonly group: HttpApiGroup.Top
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Maps normalized media types to a payload encoding strategy and one or more
|
|
123
|
+
* schemas. Each schema retains its declared content type in its encoding annotation.
|
|
124
|
+
*
|
|
125
|
+
* @category models
|
|
126
|
+
* @since 4.0.0
|
|
127
|
+
*/
|
|
128
|
+
export type PayloadMap = ReadonlyMap<string, {
|
|
129
|
+
readonly encoding: HttpApiSchema.PayloadEncoding
|
|
130
|
+
readonly schemas: readonly [Schema.Top, ...Array<Schema.Top>]
|
|
131
|
+
}>
|
|
98
132
|
|
|
99
133
|
/**
|
|
100
134
|
* Represents an API endpoint. An API endpoint is mapped to a single route on
|
|
@@ -104,7 +138,7 @@ type JsonSuccessOrArray<S extends SuccessConstraint> = [ExtractBufferedSuccess<S
|
|
|
104
138
|
* @since 4.0.0
|
|
105
139
|
*/
|
|
106
140
|
export interface HttpApiEndpoint<
|
|
107
|
-
out
|
|
141
|
+
out Identifier extends string,
|
|
108
142
|
out Method extends HttpMethod,
|
|
109
143
|
out Path extends string,
|
|
110
144
|
out Params extends Schema.Top = never,
|
|
@@ -114,19 +148,22 @@ export interface HttpApiEndpoint<
|
|
|
114
148
|
out Success extends Schema.Top = typeof HttpApiSchema.NoContent,
|
|
115
149
|
out Error extends Schema.Top = never,
|
|
116
150
|
in out Middleware = never,
|
|
117
|
-
out
|
|
151
|
+
out MiddlewareServices = never
|
|
118
152
|
> extends Pipeable {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
153
|
+
new(_: never): {}
|
|
154
|
+
readonly [TypeId]: typeof TypeId
|
|
122
155
|
readonly "~Params": Params
|
|
123
156
|
readonly "~Query": Query
|
|
124
157
|
readonly "~Headers": Headers
|
|
125
158
|
readonly "~Payload": Payload
|
|
126
159
|
readonly "~Success": Success
|
|
127
160
|
readonly "~Error": Error
|
|
161
|
+
readonly "~Middleware": Middleware
|
|
162
|
+
readonly "~MiddlewareServices": MiddlewareServices
|
|
163
|
+
readonly "~Request": RequestFromParts<this, Params["Type"], Query["Type"], Payload["Type"], Headers["Type"]>
|
|
164
|
+
readonly "~RequestRaw": RequestRawFromParts<this, Params["Type"], Query["Type"], Headers["Type"]>
|
|
128
165
|
|
|
129
|
-
readonly
|
|
166
|
+
readonly identifier: Identifier
|
|
130
167
|
readonly path: Path
|
|
131
168
|
readonly method: Method
|
|
132
169
|
readonly params: Schema.Top | undefined
|
|
@@ -144,7 +181,7 @@ export interface HttpApiEndpoint<
|
|
|
144
181
|
prefix<const Prefix extends HttpRouter.PathInput>(
|
|
145
182
|
prefix: Prefix
|
|
146
183
|
): HttpApiEndpoint<
|
|
147
|
-
|
|
184
|
+
Identifier,
|
|
148
185
|
Method,
|
|
149
186
|
`${Prefix}${Path}`,
|
|
150
187
|
Params,
|
|
@@ -154,14 +191,14 @@ export interface HttpApiEndpoint<
|
|
|
154
191
|
Success,
|
|
155
192
|
Error,
|
|
156
193
|
Middleware,
|
|
157
|
-
|
|
194
|
+
MiddlewareServices
|
|
158
195
|
>
|
|
159
196
|
|
|
160
197
|
/**
|
|
161
198
|
* Add an `HttpApiMiddleware` to the endpoint.
|
|
162
199
|
*/
|
|
163
200
|
middleware<I extends HttpApiMiddleware.AnyId, S>(middleware: Context.Key<I, S>): HttpApiEndpoint<
|
|
164
|
-
|
|
201
|
+
Identifier,
|
|
165
202
|
Method,
|
|
166
203
|
Path,
|
|
167
204
|
Params,
|
|
@@ -171,7 +208,7 @@ export interface HttpApiEndpoint<
|
|
|
171
208
|
Success,
|
|
172
209
|
Error,
|
|
173
210
|
Middleware | I,
|
|
174
|
-
HttpApiMiddleware.ApplyServices<I,
|
|
211
|
+
HttpApiMiddleware.ApplyServices<I, MiddlewareServices>
|
|
175
212
|
>
|
|
176
213
|
|
|
177
214
|
/**
|
|
@@ -181,7 +218,7 @@ export interface HttpApiEndpoint<
|
|
|
181
218
|
key: Context.Key<I, S>,
|
|
182
219
|
value: Types.NoInfer<S>
|
|
183
220
|
): HttpApiEndpoint<
|
|
184
|
-
|
|
221
|
+
Identifier,
|
|
185
222
|
Method,
|
|
186
223
|
Path,
|
|
187
224
|
Params,
|
|
@@ -191,7 +228,7 @@ export interface HttpApiEndpoint<
|
|
|
191
228
|
Success,
|
|
192
229
|
Error,
|
|
193
230
|
Middleware,
|
|
194
|
-
|
|
231
|
+
MiddlewareServices
|
|
195
232
|
>
|
|
196
233
|
|
|
197
234
|
/**
|
|
@@ -200,7 +237,7 @@ export interface HttpApiEndpoint<
|
|
|
200
237
|
annotateMerge<I>(
|
|
201
238
|
annotations: Context.Context<I>
|
|
202
239
|
): HttpApiEndpoint<
|
|
203
|
-
|
|
240
|
+
Identifier,
|
|
204
241
|
Method,
|
|
205
242
|
Path,
|
|
206
243
|
Params,
|
|
@@ -210,12 +247,12 @@ export interface HttpApiEndpoint<
|
|
|
210
247
|
Success,
|
|
211
248
|
Error,
|
|
212
249
|
Middleware,
|
|
213
|
-
|
|
250
|
+
MiddlewareServices
|
|
214
251
|
>
|
|
215
252
|
}
|
|
216
253
|
|
|
217
254
|
/** @internal */
|
|
218
|
-
export function getPayloadSchemas(endpoint:
|
|
255
|
+
export function getPayloadSchemas(endpoint: Top): Array<Schema.Top> {
|
|
219
256
|
const result: Array<Schema.Top> = []
|
|
220
257
|
for (const { schemas } of endpoint.payload.values()) {
|
|
221
258
|
result.push(...schemas)
|
|
@@ -224,13 +261,13 @@ export function getPayloadSchemas(endpoint: AnyWithProps): Array<Schema.Top> {
|
|
|
224
261
|
}
|
|
225
262
|
|
|
226
263
|
/** @internal */
|
|
227
|
-
export function getSuccessSchemas(endpoint:
|
|
264
|
+
export function getSuccessSchemas(endpoint: Top): [Schema.Top, ...Array<Schema.Top>] {
|
|
228
265
|
const schemas = Array.from(endpoint.success)
|
|
229
266
|
return Arr.isArrayNonEmpty(schemas) ? schemas : [HttpApiSchema.NoContent]
|
|
230
267
|
}
|
|
231
268
|
|
|
232
269
|
/** @internal */
|
|
233
|
-
export function getErrorSchemas(endpoint:
|
|
270
|
+
export function getErrorSchemas(endpoint: Top): Array<Schema.Top> {
|
|
234
271
|
const schemas = new Set<Schema.Top>(endpoint.error)
|
|
235
272
|
for (const middleware of endpoint.middlewares) {
|
|
236
273
|
const key = middleware as any as HttpApiMiddleware.AnyService
|
|
@@ -248,11 +285,27 @@ export function getErrorSchemas(endpoint: AnyWithProps): Array<Schema.Top> {
|
|
|
248
285
|
* @category models
|
|
249
286
|
* @since 4.0.0
|
|
250
287
|
*/
|
|
251
|
-
export interface
|
|
252
|
-
readonly [TypeId]:
|
|
253
|
-
readonly
|
|
254
|
-
readonly ["~Success"]: Schema.
|
|
255
|
-
readonly ["~Error"]: Schema.
|
|
288
|
+
export interface Constraint {
|
|
289
|
+
readonly [TypeId]: typeof TypeId
|
|
290
|
+
readonly identifier: string
|
|
291
|
+
readonly ["~Success"]: Schema.Constraint
|
|
292
|
+
readonly ["~Error"]: Schema.Constraint
|
|
293
|
+
readonly ["~Request"]: unknown
|
|
294
|
+
readonly ["~RequestRaw"]: unknown
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* A widened endpoint type that preserves request and middleware pipeline phantom fields.
|
|
299
|
+
*
|
|
300
|
+
* @category models
|
|
301
|
+
* @since 4.0.0
|
|
302
|
+
*/
|
|
303
|
+
export interface ConstraintRequest extends Constraint {
|
|
304
|
+
readonly ["~Params"]: Schema.Constraint
|
|
305
|
+
readonly ["~Query"]: Schema.Constraint
|
|
306
|
+
readonly ["~Payload"]: Schema.Constraint
|
|
307
|
+
readonly ["~Headers"]: Schema.Constraint
|
|
308
|
+
readonly ["~Middleware"]: unknown
|
|
256
309
|
}
|
|
257
310
|
|
|
258
311
|
/**
|
|
@@ -262,7 +315,7 @@ export interface Any extends Pipeable {
|
|
|
262
315
|
* @category models
|
|
263
316
|
* @since 4.0.0
|
|
264
317
|
*/
|
|
265
|
-
export interface
|
|
318
|
+
export interface Top extends
|
|
266
319
|
HttpApiEndpoint<
|
|
267
320
|
string,
|
|
268
321
|
HttpMethod,
|
|
@@ -271,31 +324,20 @@ export interface AnyWithProps extends
|
|
|
271
324
|
Schema.Top,
|
|
272
325
|
Schema.Top,
|
|
273
326
|
Schema.Top,
|
|
327
|
+
Schema.Top,
|
|
328
|
+
Schema.Top,
|
|
274
329
|
any,
|
|
275
|
-
|
|
330
|
+
unknown
|
|
276
331
|
>
|
|
277
332
|
{}
|
|
278
333
|
|
|
279
334
|
/**
|
|
280
|
-
* Extracts the
|
|
335
|
+
* Extracts the endpoint identifier literal from an `HttpApiEndpoint`.
|
|
281
336
|
*
|
|
282
337
|
* @category models
|
|
283
338
|
* @since 4.0.0
|
|
284
339
|
*/
|
|
285
|
-
export type
|
|
286
|
-
infer _Name,
|
|
287
|
-
infer _Method,
|
|
288
|
-
infer _Path,
|
|
289
|
-
infer _Params,
|
|
290
|
-
infer _Query,
|
|
291
|
-
infer _Payload,
|
|
292
|
-
infer _Headers,
|
|
293
|
-
infer _Success,
|
|
294
|
-
infer _Error,
|
|
295
|
-
infer _M,
|
|
296
|
-
infer _MR
|
|
297
|
-
> ? _Name
|
|
298
|
-
: never
|
|
340
|
+
export type Identifier<Endpoint> = Endpoint extends Constraint ? Endpoint["identifier"] : never
|
|
299
341
|
|
|
300
342
|
/**
|
|
301
343
|
* Extracts the success schema associated with an endpoint.
|
|
@@ -303,20 +345,7 @@ export type Name<Endpoint> = Endpoint extends HttpApiEndpoint<
|
|
|
303
345
|
* @category models
|
|
304
346
|
* @since 4.0.0
|
|
305
347
|
*/
|
|
306
|
-
export type Success<Endpoint
|
|
307
|
-
infer _Name,
|
|
308
|
-
infer _Method,
|
|
309
|
-
infer _Path,
|
|
310
|
-
infer _Params,
|
|
311
|
-
infer _Query,
|
|
312
|
-
infer _Payload,
|
|
313
|
-
infer _Headers,
|
|
314
|
-
infer _Success,
|
|
315
|
-
infer _Error,
|
|
316
|
-
infer _M,
|
|
317
|
-
infer _MR
|
|
318
|
-
> ? _Success
|
|
319
|
-
: never
|
|
348
|
+
export type Success<Endpoint> = Endpoint extends Constraint ? Endpoint["~Success"] : never
|
|
320
349
|
|
|
321
350
|
/**
|
|
322
351
|
* Extracts the error schema associated with an endpoint.
|
|
@@ -324,20 +353,7 @@ export type Success<Endpoint extends Any> = Endpoint extends HttpApiEndpoint<
|
|
|
324
353
|
* @category models
|
|
325
354
|
* @since 4.0.0
|
|
326
355
|
*/
|
|
327
|
-
export type Error<Endpoint
|
|
328
|
-
infer _Name,
|
|
329
|
-
infer _Method,
|
|
330
|
-
infer _Path,
|
|
331
|
-
infer _Params,
|
|
332
|
-
infer _Query,
|
|
333
|
-
infer _Payload,
|
|
334
|
-
infer _Headers,
|
|
335
|
-
infer _Success,
|
|
336
|
-
infer _Error,
|
|
337
|
-
infer _M,
|
|
338
|
-
infer _MR
|
|
339
|
-
> ? _Error
|
|
340
|
-
: never
|
|
356
|
+
export type Error<Endpoint> = Endpoint extends Constraint ? Endpoint["~Error"] : never
|
|
341
357
|
|
|
342
358
|
/**
|
|
343
359
|
* Extracts the schema used for an endpoint's path parameters.
|
|
@@ -345,19 +361,7 @@ export type Error<Endpoint extends Any> = Endpoint extends HttpApiEndpoint<
|
|
|
345
361
|
* @category models
|
|
346
362
|
* @since 4.0.0
|
|
347
363
|
*/
|
|
348
|
-
export type Params<Endpoint
|
|
349
|
-
infer _Name,
|
|
350
|
-
infer _Method,
|
|
351
|
-
infer _Path,
|
|
352
|
-
infer _Params,
|
|
353
|
-
infer _Query,
|
|
354
|
-
infer _Payload,
|
|
355
|
-
infer _Headers,
|
|
356
|
-
infer _Success,
|
|
357
|
-
infer _Error,
|
|
358
|
-
infer _M,
|
|
359
|
-
infer _MR
|
|
360
|
-
> ? _Params
|
|
364
|
+
export type Params<Endpoint> = Endpoint extends ConstraintRequest ? Endpoint["~Params"]
|
|
361
365
|
: never
|
|
362
366
|
|
|
363
367
|
/**
|
|
@@ -366,19 +370,7 @@ export type Params<Endpoint extends Any> = Endpoint extends HttpApiEndpoint<
|
|
|
366
370
|
* @category models
|
|
367
371
|
* @since 4.0.0
|
|
368
372
|
*/
|
|
369
|
-
export type Query<Endpoint
|
|
370
|
-
infer _Name,
|
|
371
|
-
infer _Method,
|
|
372
|
-
infer _Path,
|
|
373
|
-
infer _Params,
|
|
374
|
-
infer _Query,
|
|
375
|
-
infer _Payload,
|
|
376
|
-
infer _Headers,
|
|
377
|
-
infer _Success,
|
|
378
|
-
infer _Error,
|
|
379
|
-
infer _M,
|
|
380
|
-
infer _MR
|
|
381
|
-
> ? _Query
|
|
373
|
+
export type Query<Endpoint> = Endpoint extends ConstraintRequest ? Endpoint["~Query"]
|
|
382
374
|
: never
|
|
383
375
|
|
|
384
376
|
/**
|
|
@@ -387,19 +379,7 @@ export type Query<Endpoint extends Any> = Endpoint extends HttpApiEndpoint<
|
|
|
387
379
|
* @category models
|
|
388
380
|
* @since 4.0.0
|
|
389
381
|
*/
|
|
390
|
-
export type Payload<Endpoint
|
|
391
|
-
infer _Name,
|
|
392
|
-
infer _Method,
|
|
393
|
-
infer _Path,
|
|
394
|
-
infer _Params,
|
|
395
|
-
infer _Query,
|
|
396
|
-
infer _Payload,
|
|
397
|
-
infer _Headers,
|
|
398
|
-
infer _Success,
|
|
399
|
-
infer _Error,
|
|
400
|
-
infer _M,
|
|
401
|
-
infer _MR
|
|
402
|
-
> ? _Payload
|
|
382
|
+
export type Payload<Endpoint> = Endpoint extends ConstraintRequest ? Endpoint["~Payload"]
|
|
403
383
|
: never
|
|
404
384
|
|
|
405
385
|
/**
|
|
@@ -408,19 +388,7 @@ export type Payload<Endpoint extends Any> = Endpoint extends HttpApiEndpoint<
|
|
|
408
388
|
* @category models
|
|
409
389
|
* @since 4.0.0
|
|
410
390
|
*/
|
|
411
|
-
export type Headers<Endpoint
|
|
412
|
-
infer _Name,
|
|
413
|
-
infer _Method,
|
|
414
|
-
infer _Path,
|
|
415
|
-
infer _Params,
|
|
416
|
-
infer _Query,
|
|
417
|
-
infer _Payload,
|
|
418
|
-
infer _Headers,
|
|
419
|
-
infer _Success,
|
|
420
|
-
infer _Error,
|
|
421
|
-
infer _M,
|
|
422
|
-
infer _MR
|
|
423
|
-
> ? _Headers
|
|
391
|
+
export type Headers<Endpoint> = Endpoint extends ConstraintRequest ? Endpoint["~Headers"]
|
|
424
392
|
: never
|
|
425
393
|
|
|
426
394
|
/**
|
|
@@ -429,19 +397,7 @@ export type Headers<Endpoint extends Any> = Endpoint extends HttpApiEndpoint<
|
|
|
429
397
|
* @category models
|
|
430
398
|
* @since 4.0.0
|
|
431
399
|
*/
|
|
432
|
-
export type Middleware<Endpoint
|
|
433
|
-
infer _Name,
|
|
434
|
-
infer _Method,
|
|
435
|
-
infer _Path,
|
|
436
|
-
infer _Params,
|
|
437
|
-
infer _Query,
|
|
438
|
-
infer _Payload,
|
|
439
|
-
infer _Headers,
|
|
440
|
-
infer _Success,
|
|
441
|
-
infer _Error,
|
|
442
|
-
infer _M,
|
|
443
|
-
infer _MR
|
|
444
|
-
> ? _M
|
|
400
|
+
export type Middleware<Endpoint> = Endpoint extends { readonly "~Middleware": infer M } ? M
|
|
445
401
|
: never
|
|
446
402
|
|
|
447
403
|
/**
|
|
@@ -450,7 +406,7 @@ export type Middleware<Endpoint extends Any> = Endpoint extends HttpApiEndpoint<
|
|
|
450
406
|
* @category models
|
|
451
407
|
* @since 4.0.0
|
|
452
408
|
*/
|
|
453
|
-
export type MiddlewareProvides<Endpoint
|
|
409
|
+
export type MiddlewareProvides<Endpoint> = HttpApiMiddleware.Provides<Middleware<Endpoint>>
|
|
454
410
|
|
|
455
411
|
/**
|
|
456
412
|
* Computes the client-side middleware services required by an endpoint.
|
|
@@ -458,7 +414,7 @@ export type MiddlewareProvides<Endpoint extends Any> = HttpApiMiddleware.Provide
|
|
|
458
414
|
* @category models
|
|
459
415
|
* @since 4.0.0
|
|
460
416
|
*/
|
|
461
|
-
export type MiddlewareClient<Endpoint
|
|
417
|
+
export type MiddlewareClient<Endpoint> = HttpApiMiddleware.MiddlewareClient<Middleware<Endpoint>>
|
|
462
418
|
|
|
463
419
|
/**
|
|
464
420
|
* Computes the error types that can be produced by the middleware attached to an
|
|
@@ -467,7 +423,7 @@ export type MiddlewareClient<Endpoint extends Any> = HttpApiMiddleware.Middlewar
|
|
|
467
423
|
* @category models
|
|
468
424
|
* @since 4.0.0
|
|
469
425
|
*/
|
|
470
|
-
export type MiddlewareError<Endpoint
|
|
426
|
+
export type MiddlewareError<Endpoint> = HttpApiMiddleware.Error<Middleware<Endpoint>>
|
|
471
427
|
|
|
472
428
|
/**
|
|
473
429
|
* Computes the full error value union for an endpoint, including the endpoint
|
|
@@ -476,19 +432,8 @@ export type MiddlewareError<Endpoint extends Any> = HttpApiMiddleware.Error<Midd
|
|
|
476
432
|
* @category models
|
|
477
433
|
* @since 4.0.0
|
|
478
434
|
*/
|
|
479
|
-
export type Errors<Endpoint
|
|
480
|
-
|
|
481
|
-
infer _Method,
|
|
482
|
-
infer _Path,
|
|
483
|
-
infer _Params,
|
|
484
|
-
infer _Query,
|
|
485
|
-
infer _Payload,
|
|
486
|
-
infer _Headers,
|
|
487
|
-
infer _Success,
|
|
488
|
-
infer _Error,
|
|
489
|
-
infer _M,
|
|
490
|
-
infer _MR
|
|
491
|
-
> ? _Error["Type"] | HttpApiMiddleware.Error<Middleware<Endpoint>>
|
|
435
|
+
export type Errors<Endpoint> = Endpoint extends ConstraintRequest ?
|
|
436
|
+
Endpoint["~Error"]["Type"] | HttpApiMiddleware.Error<Endpoint["~Middleware"]>
|
|
492
437
|
: never
|
|
493
438
|
|
|
494
439
|
/**
|
|
@@ -498,19 +443,9 @@ export type Errors<Endpoint extends Any> = Endpoint extends HttpApiEndpoint<
|
|
|
498
443
|
* @category models
|
|
499
444
|
* @since 4.0.0
|
|
500
445
|
*/
|
|
501
|
-
export type ErrorServicesEncode<Endpoint
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
infer _Path,
|
|
505
|
-
infer _Params,
|
|
506
|
-
infer _Query,
|
|
507
|
-
infer _Payload,
|
|
508
|
-
infer _Headers,
|
|
509
|
-
infer _Success,
|
|
510
|
-
infer _Error,
|
|
511
|
-
infer _M,
|
|
512
|
-
infer _MR
|
|
513
|
-
> ? _Error["EncodingServices"] | HttpApiMiddleware.ErrorServicesEncode<Middleware<Endpoint>>
|
|
446
|
+
export type ErrorServicesEncode<Endpoint> = Endpoint extends ConstraintRequest ?
|
|
447
|
+
| Endpoint["~Error"]["EncodingServices"]
|
|
448
|
+
| HttpApiMiddleware.ErrorServicesEncode<Endpoint["~Middleware"]>
|
|
514
449
|
: never
|
|
515
450
|
|
|
516
451
|
/**
|
|
@@ -521,31 +456,7 @@ export type ErrorServicesEncode<Endpoint extends Any> = Endpoint extends HttpApi
|
|
|
521
456
|
* @category models
|
|
522
457
|
* @since 4.0.0
|
|
523
458
|
*/
|
|
524
|
-
export type Request<Endpoint
|
|
525
|
-
infer _Name,
|
|
526
|
-
infer _Method,
|
|
527
|
-
infer _Path,
|
|
528
|
-
infer _Params,
|
|
529
|
-
infer _Query,
|
|
530
|
-
infer _Payload,
|
|
531
|
-
infer _Headers,
|
|
532
|
-
infer _Success,
|
|
533
|
-
infer _Error,
|
|
534
|
-
infer _M,
|
|
535
|
-
infer _MR
|
|
536
|
-
> ?
|
|
537
|
-
& ([_Params["Type"]] extends [never] ? {} : { readonly params: _Params["Type"] })
|
|
538
|
-
& ([_Query["Type"]] extends [never] ? {} : { readonly query: _Query["Type"] })
|
|
539
|
-
& ([_Payload["Type"]] extends [never] ? {}
|
|
540
|
-
: _Payload["Type"] extends Brand<HttpApiSchema.MultipartStreamTypeId> ?
|
|
541
|
-
{ readonly payload: Stream.Stream<Multipart.Part, Multipart.MultipartError> }
|
|
542
|
-
: { readonly payload: _Payload["Type"] })
|
|
543
|
-
& ([_Headers] extends [never] ? {} : { readonly headers: _Headers["Type"] })
|
|
544
|
-
& {
|
|
545
|
-
readonly request: HttpServerRequest
|
|
546
|
-
readonly endpoint: Endpoint
|
|
547
|
-
readonly group: HttpApiGroup.AnyWithProps
|
|
548
|
-
}
|
|
459
|
+
export type Request<Endpoint> = Endpoint extends ConstraintRequest ? Endpoint["~Request"]
|
|
549
460
|
: {}
|
|
550
461
|
|
|
551
462
|
/**
|
|
@@ -556,27 +467,7 @@ export type Request<Endpoint extends Any> = Endpoint extends HttpApiEndpoint<
|
|
|
556
467
|
* @category models
|
|
557
468
|
* @since 4.0.0
|
|
558
469
|
*/
|
|
559
|
-
export type RequestRaw<Endpoint
|
|
560
|
-
infer _Name,
|
|
561
|
-
infer _Method,
|
|
562
|
-
infer _Path,
|
|
563
|
-
infer _Params,
|
|
564
|
-
infer _Query,
|
|
565
|
-
infer _Payload,
|
|
566
|
-
infer _Headers,
|
|
567
|
-
infer _Success,
|
|
568
|
-
infer _Error,
|
|
569
|
-
infer _M,
|
|
570
|
-
infer _MR
|
|
571
|
-
> ?
|
|
572
|
-
& ([_Params["Type"]] extends [never] ? {} : { readonly params: _Params["Type"] })
|
|
573
|
-
& ([_Query["Type"]] extends [never] ? {} : { readonly query: _Query["Type"] })
|
|
574
|
-
& ([_Headers["Type"]] extends [never] ? {} : { readonly headers: _Headers["Type"] })
|
|
575
|
-
& {
|
|
576
|
-
readonly request: HttpServerRequest
|
|
577
|
-
readonly endpoint: Endpoint
|
|
578
|
-
readonly group: HttpApiGroup.AnyWithProps
|
|
579
|
-
}
|
|
470
|
+
export type RequestRaw<Endpoint> = Endpoint extends ConstraintRequest ? Endpoint["~RequestRaw"]
|
|
580
471
|
: {}
|
|
581
472
|
|
|
582
473
|
/**
|
|
@@ -623,26 +514,14 @@ export type ClientResponseMode = "decoded-only" | "decoded-and-response" | "resp
|
|
|
623
514
|
* @category models
|
|
624
515
|
* @since 4.0.0
|
|
625
516
|
*/
|
|
626
|
-
export type ServerServices<Endpoint> = Endpoint extends
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
infer _Success,
|
|
635
|
-
infer _Error,
|
|
636
|
-
infer _M,
|
|
637
|
-
infer _MR
|
|
638
|
-
> ?
|
|
639
|
-
| _Params["DecodingServices"]
|
|
640
|
-
| _Query["DecodingServices"]
|
|
641
|
-
| _Payload["DecodingServices"]
|
|
642
|
-
| _Headers["DecodingServices"]
|
|
643
|
-
| SuccessEncodingServices<_Success>
|
|
644
|
-
| _Error["EncodingServices"]
|
|
645
|
-
| HttpApiMiddleware.ErrorServicesEncode<_M>
|
|
517
|
+
export type ServerServices<Endpoint> = Endpoint extends ConstraintRequest ?
|
|
518
|
+
| Endpoint["~Params"]["DecodingServices"]
|
|
519
|
+
| Endpoint["~Query"]["DecodingServices"]
|
|
520
|
+
| Endpoint["~Payload"]["DecodingServices"]
|
|
521
|
+
| Endpoint["~Headers"]["DecodingServices"]
|
|
522
|
+
| SuccessEncodingServices<Endpoint["~Success"]>
|
|
523
|
+
| Endpoint["~Error"]["EncodingServices"]
|
|
524
|
+
| HttpApiMiddleware.ErrorServicesEncode<Endpoint["~Middleware"]>
|
|
646
525
|
: never
|
|
647
526
|
|
|
648
527
|
/**
|
|
@@ -652,25 +531,13 @@ export type ServerServices<Endpoint> = Endpoint extends HttpApiEndpoint<
|
|
|
652
531
|
* @category models
|
|
653
532
|
* @since 4.0.0
|
|
654
533
|
*/
|
|
655
|
-
export type ClientServices<Endpoint> = Endpoint extends
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
infer _Headers,
|
|
663
|
-
infer _Success,
|
|
664
|
-
infer _Error,
|
|
665
|
-
infer _M,
|
|
666
|
-
infer _MR
|
|
667
|
-
> ?
|
|
668
|
-
| _Params["EncodingServices"]
|
|
669
|
-
| _Query["EncodingServices"]
|
|
670
|
-
| _Payload["EncodingServices"]
|
|
671
|
-
| _Headers["EncodingServices"]
|
|
672
|
-
| SuccessDecodingServices<_Success>
|
|
673
|
-
| _Error["DecodingServices"]
|
|
534
|
+
export type ClientServices<Endpoint> = Endpoint extends ConstraintRequest ?
|
|
535
|
+
| Endpoint["~Params"]["EncodingServices"]
|
|
536
|
+
| Endpoint["~Query"]["EncodingServices"]
|
|
537
|
+
| Endpoint["~Payload"]["EncodingServices"]
|
|
538
|
+
| Endpoint["~Headers"]["EncodingServices"]
|
|
539
|
+
| SuccessDecodingServices<Endpoint["~Success"]>
|
|
540
|
+
| Endpoint["~Error"]["DecodingServices"]
|
|
674
541
|
: never
|
|
675
542
|
|
|
676
543
|
/**
|
|
@@ -679,19 +546,7 @@ export type ClientServices<Endpoint> = Endpoint extends HttpApiEndpoint<
|
|
|
679
546
|
* @category models
|
|
680
547
|
* @since 4.0.0
|
|
681
548
|
*/
|
|
682
|
-
export type MiddlewareServices<Endpoint> = Endpoint extends
|
|
683
|
-
infer _Name,
|
|
684
|
-
infer _Method,
|
|
685
|
-
infer _Path,
|
|
686
|
-
infer _Params,
|
|
687
|
-
infer _Query,
|
|
688
|
-
infer _Payload,
|
|
689
|
-
infer _Headers,
|
|
690
|
-
infer _Success,
|
|
691
|
-
infer _Error,
|
|
692
|
-
infer _M,
|
|
693
|
-
infer _MR
|
|
694
|
-
> ? _MR
|
|
549
|
+
export type MiddlewareServices<Endpoint> = Endpoint extends { readonly "~MiddlewareServices": infer R } ? R
|
|
695
550
|
: never
|
|
696
551
|
|
|
697
552
|
/**
|
|
@@ -701,19 +556,9 @@ export type MiddlewareServices<Endpoint> = Endpoint extends HttpApiEndpoint<
|
|
|
701
556
|
* @category models
|
|
702
557
|
* @since 4.0.0
|
|
703
558
|
*/
|
|
704
|
-
export type ErrorServicesDecode<Endpoint> = Endpoint extends
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
infer _Path,
|
|
708
|
-
infer _Params,
|
|
709
|
-
infer _Query,
|
|
710
|
-
infer _Payload,
|
|
711
|
-
infer _Headers,
|
|
712
|
-
infer _Success,
|
|
713
|
-
infer _Error,
|
|
714
|
-
infer _M,
|
|
715
|
-
infer _MR
|
|
716
|
-
> ? _Error["DecodingServices"] | HttpApiMiddleware.ErrorServicesDecode<Middleware<Endpoint>>
|
|
559
|
+
export type ErrorServicesDecode<Endpoint> = Endpoint extends ConstraintRequest ?
|
|
560
|
+
| Endpoint["~Error"]["DecodingServices"]
|
|
561
|
+
| HttpApiMiddleware.ErrorServicesDecode<Endpoint["~Middleware"]>
|
|
717
562
|
: never
|
|
718
563
|
|
|
719
564
|
/**
|
|
@@ -723,8 +568,8 @@ export type ErrorServicesDecode<Endpoint> = Endpoint extends HttpApiEndpoint<
|
|
|
723
568
|
* @category models
|
|
724
569
|
* @since 4.0.0
|
|
725
570
|
*/
|
|
726
|
-
export type Handler<Endpoint extends
|
|
727
|
-
request:
|
|
571
|
+
export type Handler<Endpoint extends Constraint, E, R> = (
|
|
572
|
+
request: Simplify<Endpoint["~Request"]>
|
|
728
573
|
) => Effect<SuccessType<Endpoint["~Success"]> | HttpServerResponse, Endpoint["~Error"]["Type"] | E, R>
|
|
729
574
|
|
|
730
575
|
/**
|
|
@@ -734,112 +579,121 @@ export type Handler<Endpoint extends Any, E, R> = (
|
|
|
734
579
|
* @category models
|
|
735
580
|
* @since 4.0.0
|
|
736
581
|
*/
|
|
737
|
-
export type HandlerRaw<Endpoint extends
|
|
738
|
-
request:
|
|
582
|
+
export type HandlerRaw<Endpoint extends Constraint, E, R> = (
|
|
583
|
+
request: Simplify<Endpoint["~RequestRaw"]>
|
|
739
584
|
) => Effect<SuccessType<Endpoint["~Success"]> | HttpServerResponse, Endpoint["~Error"]["Type"] | E, R>
|
|
740
585
|
|
|
741
586
|
/**
|
|
742
|
-
* Selects the endpoint with the specified
|
|
587
|
+
* Selects the endpoint with the specified identifier from a union of endpoints.
|
|
743
588
|
*
|
|
744
589
|
* @category models
|
|
745
590
|
* @since 4.0.0
|
|
746
591
|
*/
|
|
747
|
-
export type
|
|
592
|
+
export type WithIdentifier<Endpoints, Identifier extends string> = Extract<
|
|
593
|
+
Endpoints,
|
|
594
|
+
{ readonly identifier: Identifier }
|
|
595
|
+
>
|
|
748
596
|
|
|
749
597
|
/**
|
|
750
|
-
* Removes endpoints with the specified
|
|
598
|
+
* Removes endpoints with the specified identifier from a union of endpoints.
|
|
751
599
|
*
|
|
752
600
|
* @category models
|
|
753
601
|
* @since 4.0.0
|
|
754
602
|
*/
|
|
755
|
-
export type
|
|
603
|
+
export type ExcludeIdentifier<Endpoints, Identifier extends string> = Exclude<
|
|
604
|
+
Endpoints,
|
|
605
|
+
{ readonly identifier: Identifier }
|
|
606
|
+
>
|
|
756
607
|
|
|
757
608
|
/**
|
|
758
|
-
* Derives the normal handler type for the endpoint with the specified
|
|
759
|
-
* endpoint union.
|
|
609
|
+
* Derives the normal handler type for the endpoint with the specified identifier
|
|
610
|
+
* in an endpoint union.
|
|
760
611
|
*
|
|
761
612
|
* @category models
|
|
762
613
|
* @since 4.0.0
|
|
763
614
|
*/
|
|
764
|
-
export type
|
|
765
|
-
|
|
615
|
+
export type HandlerWithIdentifier<Endpoints extends Constraint, Identifier extends string, E, R> = Handler<
|
|
616
|
+
WithIdentifier<Endpoints, Identifier>,
|
|
766
617
|
E,
|
|
767
618
|
R
|
|
768
619
|
>
|
|
769
620
|
|
|
770
621
|
/**
|
|
771
|
-
* Derives the raw handler type for the endpoint with the specified
|
|
772
|
-
* endpoint union.
|
|
622
|
+
* Derives the raw handler type for the endpoint with the specified identifier in
|
|
623
|
+
* an endpoint union.
|
|
773
624
|
*
|
|
774
625
|
* @category models
|
|
775
626
|
* @since 4.0.0
|
|
776
627
|
*/
|
|
777
|
-
export type
|
|
778
|
-
|
|
628
|
+
export type HandlerRawWithIdentifier<Endpoints extends Constraint, Identifier extends string, E, R> = HandlerRaw<
|
|
629
|
+
WithIdentifier<Endpoints, Identifier>,
|
|
779
630
|
E,
|
|
780
631
|
R
|
|
781
632
|
>
|
|
782
633
|
|
|
783
634
|
/**
|
|
784
|
-
* Extracts the decoded success value type for the endpoint with the specified
|
|
785
|
-
* in an endpoint union.
|
|
635
|
+
* Extracts the decoded success value type for the endpoint with the specified
|
|
636
|
+
* identifier in an endpoint union.
|
|
786
637
|
*
|
|
787
638
|
* @category models
|
|
788
639
|
* @since 4.0.0
|
|
789
640
|
*/
|
|
790
|
-
export type
|
|
791
|
-
|
|
641
|
+
export type SuccessWithIdentifier<Endpoints extends Constraint, Identifier extends string> = Success<
|
|
642
|
+
WithIdentifier<Endpoints, Identifier>
|
|
792
643
|
> extends infer S ? SuccessType<S> : never
|
|
793
644
|
|
|
794
645
|
/**
|
|
795
|
-
* Computes the full error value union for the endpoint with the specified
|
|
796
|
-
* an endpoint union.
|
|
646
|
+
* Computes the full error value union for the endpoint with the specified
|
|
647
|
+
* identifier in an endpoint union.
|
|
797
648
|
*
|
|
798
649
|
* @category models
|
|
799
650
|
* @since 4.0.0
|
|
800
651
|
*/
|
|
801
|
-
export type
|
|
652
|
+
export type ErrorsWithIdentifier<Endpoints extends Constraint, Identifier extends string> = Errors<
|
|
653
|
+
WithIdentifier<Endpoints, Identifier>
|
|
654
|
+
>
|
|
802
655
|
|
|
803
656
|
/**
|
|
804
657
|
* Computes the server-side service requirements for the endpoint with the
|
|
805
|
-
* specified
|
|
658
|
+
* specified identifier in an endpoint union.
|
|
806
659
|
*
|
|
807
660
|
* @category models
|
|
808
661
|
* @since 4.0.0
|
|
809
662
|
*/
|
|
810
|
-
export type
|
|
811
|
-
|
|
663
|
+
export type ServerServicesWithIdentifier<Endpoints extends Constraint, Identifier extends string> = ServerServices<
|
|
664
|
+
WithIdentifier<Endpoints, Identifier>
|
|
812
665
|
>
|
|
813
666
|
|
|
814
667
|
/**
|
|
815
|
-
* Extracts the middleware identifiers for the endpoint with the specified
|
|
816
|
-
* an endpoint union.
|
|
668
|
+
* Extracts the middleware identifiers for the endpoint with the specified
|
|
669
|
+
* identifier in an endpoint union.
|
|
817
670
|
*
|
|
818
671
|
* @category models
|
|
819
672
|
* @since 4.0.0
|
|
820
673
|
*/
|
|
821
|
-
export type
|
|
674
|
+
export type MiddlewareWithIdentifier<Endpoints extends Constraint, Identifier extends string> = Middleware<
|
|
675
|
+
WithIdentifier<Endpoints, Identifier>
|
|
676
|
+
>
|
|
822
677
|
|
|
823
678
|
/**
|
|
824
|
-
* Extracts the middleware service requirements for the endpoint with the
|
|
825
|
-
*
|
|
679
|
+
* Extracts the middleware service requirements for the endpoint with the
|
|
680
|
+
* specified identifier in an endpoint union.
|
|
826
681
|
*
|
|
827
682
|
* @category models
|
|
828
683
|
* @since 4.0.0
|
|
829
684
|
*/
|
|
830
|
-
export type
|
|
831
|
-
|
|
832
|
-
>
|
|
685
|
+
export type MiddlewareServicesWithIdentifier<Endpoints extends Constraint, Identifier extends string> =
|
|
686
|
+
MiddlewareServices<WithIdentifier<Endpoints, Identifier>>
|
|
833
687
|
|
|
834
688
|
/**
|
|
835
|
-
* Removes services provided by the HTTP router and the
|
|
836
|
-
* from a service requirement union.
|
|
689
|
+
* Removes services provided by the HTTP router and the selected endpoint's
|
|
690
|
+
* middleware from a service requirement union.
|
|
837
691
|
*
|
|
838
692
|
* @category models
|
|
839
693
|
* @since 4.0.0
|
|
840
694
|
*/
|
|
841
|
-
export type
|
|
842
|
-
|
|
695
|
+
export type ExcludeProvidedWithIdentifier<Endpoints extends Constraint, Identifier extends string, R> = ExcludeProvided<
|
|
696
|
+
WithIdentifier<Endpoints, Identifier>,
|
|
843
697
|
R
|
|
844
698
|
>
|
|
845
699
|
|
|
@@ -850,7 +704,7 @@ export type ExcludeProvidedWithName<Endpoints extends Any, Name extends string,
|
|
|
850
704
|
* @category models
|
|
851
705
|
* @since 4.0.0
|
|
852
706
|
*/
|
|
853
|
-
export type ExcludeProvided<Endpoint extends
|
|
707
|
+
export type ExcludeProvided<Endpoint extends Constraint, R> = Exclude<
|
|
854
708
|
R,
|
|
855
709
|
| HttpRouter.Provided
|
|
856
710
|
| HttpApiMiddleware.Provides<Middleware<Endpoint>>
|
|
@@ -863,8 +717,8 @@ export type ExcludeProvided<Endpoint extends Any, R> = Exclude<
|
|
|
863
717
|
* @category models
|
|
864
718
|
* @since 4.0.0
|
|
865
719
|
*/
|
|
866
|
-
export type AddPrefix<Endpoint
|
|
867
|
-
infer
|
|
720
|
+
export type AddPrefix<Endpoint, Prefix extends HttpRouter.PathInput> = Endpoint extends HttpApiEndpoint<
|
|
721
|
+
infer _Identifier,
|
|
868
722
|
infer _Method,
|
|
869
723
|
infer _Path,
|
|
870
724
|
infer _Params,
|
|
@@ -876,7 +730,7 @@ export type AddPrefix<Endpoint extends Any, Prefix extends HttpRouter.PathInput>
|
|
|
876
730
|
infer _M,
|
|
877
731
|
infer _MR
|
|
878
732
|
> ? HttpApiEndpoint<
|
|
879
|
-
|
|
733
|
+
_Identifier,
|
|
880
734
|
_Method,
|
|
881
735
|
`${Prefix}${_Path}`,
|
|
882
736
|
_Params,
|
|
@@ -890,40 +744,6 @@ export type AddPrefix<Endpoint extends Any, Prefix extends HttpRouter.PathInput>
|
|
|
890
744
|
> :
|
|
891
745
|
never
|
|
892
746
|
|
|
893
|
-
/**
|
|
894
|
-
* Returns an endpoint type with an additional error schema added to the endpoint's
|
|
895
|
-
* existing error schema union.
|
|
896
|
-
*
|
|
897
|
-
* @category models
|
|
898
|
-
* @since 4.0.0
|
|
899
|
-
*/
|
|
900
|
-
export type AddError<Endpoint extends Any, E extends Schema.Top> = Endpoint extends HttpApiEndpoint<
|
|
901
|
-
infer _Name,
|
|
902
|
-
infer _Method,
|
|
903
|
-
infer _Path,
|
|
904
|
-
infer _Params,
|
|
905
|
-
infer _Query,
|
|
906
|
-
infer _Payload,
|
|
907
|
-
infer _Headers,
|
|
908
|
-
infer _Success,
|
|
909
|
-
infer _Error,
|
|
910
|
-
infer _M,
|
|
911
|
-
infer _MR
|
|
912
|
-
> ? HttpApiEndpoint<
|
|
913
|
-
_Name,
|
|
914
|
-
_Method,
|
|
915
|
-
_Path,
|
|
916
|
-
_Params,
|
|
917
|
-
_Query,
|
|
918
|
-
_Payload,
|
|
919
|
-
_Headers,
|
|
920
|
-
_Success,
|
|
921
|
-
_Error | E,
|
|
922
|
-
_M,
|
|
923
|
-
_MR
|
|
924
|
-
> :
|
|
925
|
-
never
|
|
926
|
-
|
|
927
747
|
/**
|
|
928
748
|
* Returns an endpoint type with additional middleware applied and the endpoint's
|
|
929
749
|
* middleware service requirements updated accordingly.
|
|
@@ -931,8 +751,8 @@ export type AddError<Endpoint extends Any, E extends Schema.Top> = Endpoint exte
|
|
|
931
751
|
* @category models
|
|
932
752
|
* @since 4.0.0
|
|
933
753
|
*/
|
|
934
|
-
export type AddMiddleware<Endpoint
|
|
935
|
-
infer
|
|
754
|
+
export type AddMiddleware<Endpoint, M extends HttpApiMiddleware.AnyId> = Endpoint extends HttpApiEndpoint<
|
|
755
|
+
infer _Identifier,
|
|
936
756
|
infer _Method,
|
|
937
757
|
infer _Path,
|
|
938
758
|
infer _Params,
|
|
@@ -944,7 +764,7 @@ export type AddMiddleware<Endpoint extends Any, M extends HttpApiMiddleware.AnyI
|
|
|
944
764
|
infer _M,
|
|
945
765
|
infer _MR
|
|
946
766
|
> ? HttpApiEndpoint<
|
|
947
|
-
|
|
767
|
+
_Identifier,
|
|
948
768
|
_Method,
|
|
949
769
|
_Path,
|
|
950
770
|
_Params,
|
|
@@ -963,34 +783,48 @@ const Proto = {
|
|
|
963
783
|
pipe() {
|
|
964
784
|
return pipeArguments(this, arguments)
|
|
965
785
|
},
|
|
966
|
-
prefix(this:
|
|
786
|
+
prefix(this: Top, prefix: HttpRouter.PathInput) {
|
|
967
787
|
return makeProto({
|
|
968
|
-
...this,
|
|
788
|
+
...optionsFromEndpoint(this),
|
|
969
789
|
path: HttpRouter.prefixPath(this.path, prefix)
|
|
970
790
|
})
|
|
971
791
|
},
|
|
972
|
-
middleware(this:
|
|
792
|
+
middleware(this: Top, middleware: HttpApiMiddleware.AnyService) {
|
|
973
793
|
return makeProto({
|
|
974
|
-
...this,
|
|
794
|
+
...optionsFromEndpoint(this),
|
|
975
795
|
middlewares: new Set([...this.middlewares, middleware as any])
|
|
976
796
|
})
|
|
977
797
|
},
|
|
978
|
-
annotate(this:
|
|
798
|
+
annotate(this: Top, key: Context.Key<any, any>, value: any) {
|
|
979
799
|
return makeProto({
|
|
980
|
-
...this,
|
|
800
|
+
...optionsFromEndpoint(this),
|
|
981
801
|
annotations: Context.add(this.annotations, key, value)
|
|
982
802
|
})
|
|
983
803
|
},
|
|
984
|
-
annotateMerge(this:
|
|
804
|
+
annotateMerge(this: Top, annotations: Context.Context<any>) {
|
|
985
805
|
return makeProto({
|
|
986
|
-
...this,
|
|
806
|
+
...optionsFromEndpoint(this),
|
|
987
807
|
annotations: Context.merge(this.annotations, annotations)
|
|
988
808
|
})
|
|
989
809
|
}
|
|
990
810
|
}
|
|
991
811
|
|
|
812
|
+
const optionsFromEndpoint = (endpoint: Top) => ({
|
|
813
|
+
identifier: endpoint.identifier,
|
|
814
|
+
path: endpoint.path,
|
|
815
|
+
method: endpoint.method,
|
|
816
|
+
params: endpoint.params,
|
|
817
|
+
query: endpoint.query,
|
|
818
|
+
headers: endpoint.headers,
|
|
819
|
+
payload: endpoint.payload,
|
|
820
|
+
success: endpoint.success,
|
|
821
|
+
error: endpoint.error,
|
|
822
|
+
annotations: endpoint.annotations,
|
|
823
|
+
middlewares: endpoint.middlewares
|
|
824
|
+
})
|
|
825
|
+
|
|
992
826
|
function makeProto<
|
|
993
|
-
|
|
827
|
+
Identifier extends string,
|
|
994
828
|
Method extends HttpMethod,
|
|
995
829
|
const Path extends string,
|
|
996
830
|
Params extends Schema.Top,
|
|
@@ -1002,7 +836,7 @@ function makeProto<
|
|
|
1002
836
|
Middleware,
|
|
1003
837
|
MiddlewareR
|
|
1004
838
|
>(options: {
|
|
1005
|
-
readonly
|
|
839
|
+
readonly identifier: Identifier
|
|
1006
840
|
readonly path: Path
|
|
1007
841
|
readonly method: Method
|
|
1008
842
|
readonly params: Schema.Top | undefined
|
|
@@ -1014,7 +848,7 @@ function makeProto<
|
|
|
1014
848
|
readonly annotations: Context.Context<never>
|
|
1015
849
|
readonly middlewares: ReadonlySet<Context.Key<Middleware, any>>
|
|
1016
850
|
}): HttpApiEndpoint<
|
|
1017
|
-
|
|
851
|
+
Identifier,
|
|
1018
852
|
Method,
|
|
1019
853
|
Path,
|
|
1020
854
|
Params,
|
|
@@ -1026,7 +860,9 @@ function makeProto<
|
|
|
1026
860
|
Middleware,
|
|
1027
861
|
MiddlewareR
|
|
1028
862
|
> {
|
|
1029
|
-
|
|
863
|
+
function HttpApiEndpoint() {}
|
|
864
|
+
Object.setPrototypeOf(HttpApiEndpoint, Proto)
|
|
865
|
+
return Object.assign(HttpApiEndpoint, options) as any
|
|
1030
866
|
}
|
|
1031
867
|
|
|
1032
868
|
/**
|
|
@@ -1118,7 +954,7 @@ type ErrorNoStream<S extends ErrorConstraint> = [
|
|
|
1118
954
|
|
|
1119
955
|
/**
|
|
1120
956
|
* Creates endpoint constructors for a specific HTTP method. The resulting
|
|
1121
|
-
* constructor builds an `HttpApiEndpoint` from
|
|
957
|
+
* constructor builds an `HttpApiEndpoint` from an identifier, path, and optional request
|
|
1122
958
|
* and response schemas, applying automatic JSON or string-tree codecs unless
|
|
1123
959
|
* `disableCodecs` is enabled.
|
|
1124
960
|
*
|
|
@@ -1127,7 +963,7 @@ type ErrorNoStream<S extends ErrorConstraint> = [
|
|
|
1127
963
|
*/
|
|
1128
964
|
export const make = <Method extends HttpMethod>(method: Method): {
|
|
1129
965
|
<
|
|
1130
|
-
const
|
|
966
|
+
const Identifier extends string,
|
|
1131
967
|
const Path extends HttpRouter.PathInput,
|
|
1132
968
|
Params extends Schema.Top | Schema.Struct.Fields = never,
|
|
1133
969
|
Query extends Schema.Top | Schema.Struct.Fields = never,
|
|
@@ -1136,7 +972,7 @@ export const make = <Method extends HttpMethod>(method: Method): {
|
|
|
1136
972
|
const Success extends SuccessConstraint = HttpApiSchema.NoContent,
|
|
1137
973
|
const Error extends Schema.Top | ReadonlyArray<Schema.Top> = never
|
|
1138
974
|
>(
|
|
1139
|
-
|
|
975
|
+
identifier: Identifier,
|
|
1140
976
|
path: Path,
|
|
1141
977
|
options?: {
|
|
1142
978
|
readonly disableCodecs?: false | undefined
|
|
@@ -1148,19 +984,19 @@ export const make = <Method extends HttpMethod>(method: Method): {
|
|
|
1148
984
|
readonly error?: (Error & ErrorNoStream<Types.NoInfer<Error>>) | undefined
|
|
1149
985
|
}
|
|
1150
986
|
): HttpApiEndpoint<
|
|
1151
|
-
|
|
987
|
+
Identifier,
|
|
1152
988
|
Method,
|
|
1153
989
|
Path,
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
Method extends HttpMethod.WithBody ?
|
|
1157
|
-
:
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
990
|
+
ToStringTreeCodec<Params>,
|
|
991
|
+
ToStringTreeCodec<Query>,
|
|
992
|
+
Method extends HttpMethod.WithBody ? ToJsonCodec<ToSchema<Payload>>
|
|
993
|
+
: ToStringTreeCodec<ToSchema<Payload>>,
|
|
994
|
+
ToStringTreeCodec<Headers>,
|
|
995
|
+
ToSuccessCodec<Success>,
|
|
996
|
+
ToJsonCodec<Error extends ReadonlyArray<Schema.Constraint> ? Error[number] : Error>
|
|
1161
997
|
>
|
|
1162
998
|
<
|
|
1163
|
-
const
|
|
999
|
+
const Identifier extends string,
|
|
1164
1000
|
const Path extends HttpRouter.PathInput,
|
|
1165
1001
|
Params extends ParamsConstraint = never,
|
|
1166
1002
|
Query extends QueryConstraint = never,
|
|
@@ -1169,7 +1005,7 @@ export const make = <Method extends HttpMethod>(method: Method): {
|
|
|
1169
1005
|
const Success extends SuccessConstraint = HttpApiSchema.NoContent,
|
|
1170
1006
|
const Error extends ErrorConstraint = never
|
|
1171
1007
|
>(
|
|
1172
|
-
|
|
1008
|
+
identifier: Identifier,
|
|
1173
1009
|
path: Path,
|
|
1174
1010
|
options?: {
|
|
1175
1011
|
readonly disableCodecs: true
|
|
@@ -1181,19 +1017,19 @@ export const make = <Method extends HttpMethod>(method: Method): {
|
|
|
1181
1017
|
readonly error?: (Error & ErrorNoStream<Types.NoInfer<Error>>) | undefined
|
|
1182
1018
|
}
|
|
1183
1019
|
): HttpApiEndpoint<
|
|
1184
|
-
|
|
1020
|
+
Identifier,
|
|
1185
1021
|
Method,
|
|
1186
1022
|
Path,
|
|
1187
1023
|
Params extends Schema.Struct.Fields ? Schema.Struct<Params> : Params,
|
|
1188
1024
|
Query extends Schema.Struct.Fields ? Schema.Struct<Query> : Query,
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1025
|
+
ToSchema<Payload>,
|
|
1026
|
+
ToSchema<Headers>,
|
|
1027
|
+
UnwrapReadonlyArray<Success>,
|
|
1192
1028
|
Error extends ReadonlyArray<Schema.Constraint> ? Error[number] : Error
|
|
1193
1029
|
>
|
|
1194
1030
|
} =>
|
|
1195
1031
|
<
|
|
1196
|
-
const
|
|
1032
|
+
const Identifier extends string,
|
|
1197
1033
|
const Path extends HttpRouter.PathInput,
|
|
1198
1034
|
Params extends ParamsConstraint = never,
|
|
1199
1035
|
Query extends QueryConstraint = never,
|
|
@@ -1202,7 +1038,7 @@ export const make = <Method extends HttpMethod>(method: Method): {
|
|
|
1202
1038
|
const Success extends SuccessConstraint = HttpApiSchema.NoContent,
|
|
1203
1039
|
const Error extends ErrorConstraint = never
|
|
1204
1040
|
>(
|
|
1205
|
-
|
|
1041
|
+
identifier: Identifier,
|
|
1206
1042
|
path: Path,
|
|
1207
1043
|
options?: {
|
|
1208
1044
|
readonly disableCodecs?: boolean | undefined
|
|
@@ -1214,7 +1050,7 @@ export const make = <Method extends HttpMethod>(method: Method): {
|
|
|
1214
1050
|
readonly error?: (Error & ErrorNoStream<Types.NoInfer<Error>>) | undefined
|
|
1215
1051
|
}
|
|
1216
1052
|
): HttpApiEndpoint<
|
|
1217
|
-
|
|
1053
|
+
Identifier,
|
|
1218
1054
|
Method,
|
|
1219
1055
|
Path,
|
|
1220
1056
|
Params extends Schema.Struct.Fields ? Schema.Struct<Params> : Params,
|
|
@@ -1223,13 +1059,13 @@ export const make = <Method extends HttpMethod>(method: Method): {
|
|
|
1223
1059
|
: Payload extends ReadonlyArray<Schema.Constraint> ? Payload[number]
|
|
1224
1060
|
: Payload,
|
|
1225
1061
|
Headers extends Schema.Struct.Fields ? Schema.Struct<Headers> : Headers,
|
|
1226
|
-
|
|
1062
|
+
UnwrapReadonlyArray<Success>,
|
|
1227
1063
|
Error extends ReadonlyArray<Schema.Constraint> ? Error[number] : Error
|
|
1228
1064
|
> => {
|
|
1229
1065
|
const disableCodecs = options?.disableCodecs ?? false
|
|
1230
1066
|
const transformStringTree = disableCodecs ? identity : Schema.toCodecStringTree
|
|
1231
1067
|
return makeProto({
|
|
1232
|
-
|
|
1068
|
+
identifier,
|
|
1233
1069
|
path,
|
|
1234
1070
|
method,
|
|
1235
1071
|
params: ensureStruct(options?.params, transformStringTree),
|
|
@@ -1243,37 +1079,10 @@ export const make = <Method extends HttpMethod>(method: Method): {
|
|
|
1243
1079
|
})
|
|
1244
1080
|
}
|
|
1245
1081
|
|
|
1246
|
-
type
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
/**
|
|
1252
|
-
* A schema codec that decodes and encodes the schema's value type through JSON
|
|
1253
|
-
* transport values.
|
|
1254
|
-
*
|
|
1255
|
-
* @category Codecs
|
|
1256
|
-
* @since 4.0.0
|
|
1257
|
-
*/
|
|
1258
|
-
export interface Json<S extends Schema.Constraint>
|
|
1259
|
-
extends Schema.Codec<S["Type"], Schema.Json, S["DecodingServices"], S["EncodingServices"]>
|
|
1260
|
-
{}
|
|
1261
|
-
|
|
1262
|
-
/**
|
|
1263
|
-
* A schema codec that decodes and encodes the schema's value type through
|
|
1264
|
-
* `Schema.StringTree` transport values.
|
|
1265
|
-
*
|
|
1266
|
-
* @category Codecs
|
|
1267
|
-
* @since 4.0.0
|
|
1268
|
-
*/
|
|
1269
|
-
export interface StringTree<S extends Schema.Constraint> extends
|
|
1270
|
-
Schema.Codec<
|
|
1271
|
-
S["Type"],
|
|
1272
|
-
Schema.StringTree,
|
|
1273
|
-
S["DecodingServices"],
|
|
1274
|
-
S["EncodingServices"]
|
|
1275
|
-
>
|
|
1276
|
-
{}
|
|
1082
|
+
type ToSchema<S extends Schema.Struct.Fields | Schema.Constraint | ReadonlyArray<Schema.Constraint>> = S extends
|
|
1083
|
+
Schema.Struct.Fields ? Schema.Struct<S>
|
|
1084
|
+
: S extends ReadonlyArray<Schema.Constraint> ? S[number]
|
|
1085
|
+
: S
|
|
1277
1086
|
|
|
1278
1087
|
function ensureStruct(
|
|
1279
1088
|
params: Schema.Struct.Fields | Schema.Top | undefined,
|
|
@@ -1303,7 +1112,8 @@ function getPayload(
|
|
|
1303
1112
|
|
|
1304
1113
|
for (const schema of schemas) {
|
|
1305
1114
|
const encoding = HttpApiSchema.getPayloadEncoding(schema.ast, method)
|
|
1306
|
-
const
|
|
1115
|
+
const contentType = MediaType.normalize(encoding.contentType)
|
|
1116
|
+
const existing = result.get(contentType)
|
|
1307
1117
|
if (existing) {
|
|
1308
1118
|
if (existing.encoding._tag !== encoding._tag) {
|
|
1309
1119
|
throw new Error(`Multiple payload encodings for content-type: ${encoding.contentType}`)
|
|
@@ -1313,7 +1123,7 @@ function getPayload(
|
|
|
1313
1123
|
}
|
|
1314
1124
|
existing.schemas.push(transform(schema, method))
|
|
1315
1125
|
} else {
|
|
1316
|
-
result.set(
|
|
1126
|
+
result.set(contentType, { encoding, schemas: [transform(schema, method)] })
|
|
1317
1127
|
}
|
|
1318
1128
|
}
|
|
1319
1129
|
return result
|
|
@@ -1368,7 +1178,7 @@ function validateSuccessResponse(schemas: ReadonlyArray<Schema.Constraint>, meth
|
|
|
1368
1178
|
if (entry.noContent) {
|
|
1369
1179
|
throw new Error(`Cannot combine no-content and streaming success responses for status: ${status}`)
|
|
1370
1180
|
}
|
|
1371
|
-
if (entry.bufferedContentTypes.has(
|
|
1181
|
+
if (entry.bufferedContentTypes.has(MediaType.normalize(schema.contentType))) {
|
|
1372
1182
|
throw new Error(
|
|
1373
1183
|
`Cannot combine buffered and streaming success responses for status ${status} and content-type: ${schema.contentType}`
|
|
1374
1184
|
)
|
|
@@ -1384,7 +1194,7 @@ function validateSuccessResponse(schemas: ReadonlyArray<Schema.Constraint>, meth
|
|
|
1384
1194
|
}
|
|
1385
1195
|
const encoding = HttpApiSchema.getResponseEncoding(schema.ast)
|
|
1386
1196
|
if (
|
|
1387
|
-
|
|
1197
|
+
MediaType.normalize(encoding.contentType) === MediaType.normalize(entry.stream.contentType)
|
|
1388
1198
|
) {
|
|
1389
1199
|
throw new Error(
|
|
1390
1200
|
`Cannot combine buffered and streaming success responses for status ${status} and content-type: ${encoding.contentType}`
|
|
@@ -1393,7 +1203,7 @@ function validateSuccessResponse(schemas: ReadonlyArray<Schema.Constraint>, meth
|
|
|
1393
1203
|
}
|
|
1394
1204
|
if (!noContent) {
|
|
1395
1205
|
entry.bufferedContentTypes.add(
|
|
1396
|
-
|
|
1206
|
+
MediaType.normalize(HttpApiSchema.getResponseEncoding(schema.ast).contentType)
|
|
1397
1207
|
)
|
|
1398
1208
|
}
|
|
1399
1209
|
entry.noContent = entry.noContent || noContent
|
|
@@ -1401,12 +1211,6 @@ function validateSuccessResponse(schemas: ReadonlyArray<Schema.Constraint>, meth
|
|
|
1401
1211
|
}
|
|
1402
1212
|
}
|
|
1403
1213
|
|
|
1404
|
-
function normalizeResponseContentType(contentType: string): string {
|
|
1405
|
-
const normalized = contentType.toLowerCase().trim()
|
|
1406
|
-
const index = normalized.indexOf(";")
|
|
1407
|
-
return index === -1 ? normalized : normalized.slice(0, index).trim()
|
|
1408
|
-
}
|
|
1409
|
-
|
|
1410
1214
|
function getStatusEntry(
|
|
1411
1215
|
statuses: Map<number, {
|
|
1412
1216
|
readonly stream?: HttpApiSchema.StreamSchema | undefined
|