@orpc/openapi 2.0.0-beta.49 → 2.0.0-beta.50
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/adapters/aws-lambda/index.d.ts +3 -15
- package/dist/adapters/aws-lambda/index.js +1 -1
- package/dist/adapters/aws-lambda/openapi-handler.d.ts +8 -9
- package/dist/adapters/aws-lambda/openapi-handler.js +19 -17
- package/dist/adapters/fastify/index.d.ts +2 -1
- package/dist/adapters/fastify/index.js +1 -1
- package/dist/adapters/fastify/openapi-handler.d.ts +8 -9
- package/dist/adapters/fastify/openapi-handler.js +16 -14
- package/dist/adapters/fetch/index.d.ts +3 -2
- package/dist/adapters/fetch/index.js +2 -2
- package/dist/adapters/fetch/openapi-handler.d.ts +8 -9
- package/dist/adapters/fetch/openapi-handler.js +16 -14
- package/dist/adapters/fetch/openapi-link.d.ts +9 -10
- package/dist/adapters/fetch/openapi-link.js +21 -19
- package/dist/adapters/node/index.d.ts +2 -1
- package/dist/adapters/node/index.js +1 -1
- package/dist/adapters/node/openapi-handler.d.ts +8 -9
- package/dist/adapters/node/openapi-handler.js +16 -14
- package/dist/adapters/standard/index.d.ts +4 -3
- package/dist/adapters/standard/index.js +3 -3
- package/dist/adapters/standard/openapi-handler-codec.d.ts +56 -57
- package/dist/adapters/standard/openapi-handler-codec.js +143 -205
- package/dist/adapters/standard/openapi-link-codec.d.ts +55 -59
- package/dist/adapters/standard/openapi-link-codec.js +262 -377
- package/dist/adapters/standard/openapi-matcher.d.ts +26 -26
- package/dist/adapters/standard/openapi-matcher.js +78 -108
- package/dist/adapters/standard/utils.js +28 -44
- package/dist/bracket-notation.d.ts +22 -22
- package/dist/bracket-notation.js +123 -173
- package/dist/client-factory.d.ts +12 -12
- package/dist/client-factory.js +13 -11
- package/dist/constants.d.ts +1 -4
- package/dist/constants.js +5 -4
- package/dist/extensions/route.d.ts +36 -36
- package/dist/extensions/route.js +7 -6
- package/dist/helpers/form-data.d.ts +1 -1
- package/dist/helpers/form-data.js +74 -86
- package/dist/helpers/index.d.ts +2 -1
- package/dist/helpers/index.js +1 -1
- package/dist/index.d.ts +15 -13
- package/dist/index.js +11 -11
- package/dist/meta.d.ts +298 -298
- package/dist/meta.js +54 -72
- package/dist/openapi-generator-components.d.ts +2 -31
- package/dist/openapi-generator-components.js +200 -248
- package/dist/openapi-generator-operation.d.ts +12 -33
- package/dist/openapi-generator-operation.js +369 -437
- package/dist/openapi-generator.d.ts +75 -80
- package/dist/openapi-generator.js +114 -142
- package/dist/openapi-json-serializer.d.ts +65 -65
- package/dist/openapi-json-serializer.js +218 -257
- package/dist/openapi-serializer.d.ts +31 -32
- package/dist/openapi-serializer.js +68 -92
- package/dist/plugins/index.d.ts +2 -1
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/openapi-reference.d.ts +99 -102
- package/dist/plugins/openapi-reference.js +109 -132
- package/dist/router-utils.d.ts +7 -10
- package/dist/router-utils.js +30 -34
- package/dist/types.d.ts +8 -12
- package/dist/utils.d.ts +5 -10
- package/dist/utils.js +39 -42
- package/package.json +12 -12
- package/dist/adapters/standard/utils.d.ts +0 -4
- package/dist/types.js +0 -1
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* AWS API Gateway proxy event, payload format 2.0, also used by Lambda Function URLs.
|
|
5
|
-
*
|
|
6
|
-
* @see {@link https://orpc.dev/docs/adapters/aws-lambda | AWS Lambda Adapter}
|
|
7
|
-
*/
|
|
8
|
-
APIGatewayProxyEventV2,
|
|
9
|
-
/**
|
|
10
|
-
* Shape of the `awslambda` global the Lambda Node.js runtime injects when response streaming is enabled.
|
|
11
|
-
* Declare it yourself: `declare const awslambda: AwsLambdaGlobal`.
|
|
12
|
-
*
|
|
13
|
-
* @see {@link https://orpc.dev/docs/adapters/aws-lambda | AWS Lambda Adapter}
|
|
14
|
-
*/
|
|
15
|
-
AwsLambdaGlobal, HttpResponseStream, } from '@orpc/server/aws-lambda';
|
|
1
|
+
import { OpenAPIHandler, OpenAPIHandlerOptions } from "./openapi-handler.js";
|
|
2
|
+
import { APIGatewayProxyEvent, APIGatewayProxyEventV2, AnyAPIGatewayProxyEvent, AwsLambdaGlobal, HttpResponseStream } from "@orpc/server/aws-lambda";
|
|
3
|
+
export { type APIGatewayProxyEvent, type APIGatewayProxyEventV2, type AnyAPIGatewayProxyEvent, type AwsLambdaGlobal, type HttpResponseStream, OpenAPIHandler, OpenAPIHandlerOptions };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { OpenAPIHandler } from "./openapi-handler.js";
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
export interface OpenAPIHandlerOptions<T extends Context> extends AwsLambdaHandlerOptions<T>, StandardHandlerOptions<T>, OpenAPIHandlerCodecOptions<T> {
|
|
7
|
-
}
|
|
1
|
+
import { OpenAPIHandlerCodecOptions } from "../standard/openapi-handler-codec.js";
|
|
2
|
+
import "../standard/index.js";
|
|
3
|
+
import { Context, Router } from "@orpc/server";
|
|
4
|
+
import { StandardHandlerOptions } from "@orpc/server/standard";
|
|
5
|
+
import { AwsLambdaHandler, AwsLambdaHandlerOptions } from "@orpc/server/aws-lambda";
|
|
6
|
+
export interface OpenAPIHandlerOptions<T extends Context> extends AwsLambdaHandlerOptions<T>, StandardHandlerOptions<T>, OpenAPIHandlerCodecOptions<T> {}
|
|
8
7
|
/**
|
|
9
8
|
* Serves oRPC procedures over the OpenAPI (RESTful) protocol on AWS Lambda.
|
|
10
9
|
*
|
|
@@ -14,5 +13,5 @@ export interface OpenAPIHandlerOptions<T extends Context> extends AwsLambdaHandl
|
|
|
14
13
|
* @see {@link https://orpc.dev/docs/adapters/aws-lambda | AWS Lambda Adapter}
|
|
15
14
|
*/
|
|
16
15
|
export declare class OpenAPIHandler<T extends Context> extends AwsLambdaHandler<T> {
|
|
17
|
-
|
|
18
|
-
}
|
|
16
|
+
constructor(router: Router<T>, options?: NoInfer<OpenAPIHandlerOptions<T>>);
|
|
17
|
+
}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { StandardHandler } from
|
|
3
|
-
import {
|
|
1
|
+
import { OpenAPIHandlerCodec } from "../standard/openapi-handler-codec.js";
|
|
2
|
+
import { StandardHandler } from "@orpc/server/standard";
|
|
3
|
+
import { AwsLambdaHandler } from "@orpc/server/aws-lambda";
|
|
4
|
+
// src/adapters/aws-lambda/openapi-handler.ts
|
|
4
5
|
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
6
|
+
* Serves oRPC procedures over the OpenAPI (RESTful) protocol on AWS Lambda.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* **Warning**: Requires the AWS Lambda Node.js runtime with response streaming enabled — handlers should be wrapped with `awslambda.streamifyResponse`.
|
|
10
|
+
*
|
|
11
|
+
* @see {@link https://orpc.dev/docs/adapters/aws-lambda | AWS Lambda Adapter}
|
|
12
|
+
*/
|
|
13
|
+
var OpenAPIHandler = class extends AwsLambdaHandler {
|
|
14
|
+
constructor(router, options = {}) {
|
|
15
|
+
const codec = new OpenAPIHandlerCodec(router, options);
|
|
16
|
+
const handler = new StandardHandler(codec, options);
|
|
17
|
+
super(handler, options);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
export { OpenAPIHandler };
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { OpenAPIHandler, OpenAPIHandlerOptions } from "./openapi-handler.js";
|
|
2
|
+
export { OpenAPIHandler, OpenAPIHandlerOptions };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { OpenAPIHandler } from "./openapi-handler.js";
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
export interface OpenAPIHandlerOptions<T extends Context> extends FastifyHandlerOptions<T>, StandardHandlerOptions<T>, OpenAPIHandlerCodecOptions<T> {
|
|
7
|
-
}
|
|
1
|
+
import { OpenAPIHandlerCodecOptions } from "../standard/openapi-handler-codec.js";
|
|
2
|
+
import "../standard/index.js";
|
|
3
|
+
import { Context, Router } from "@orpc/server";
|
|
4
|
+
import { StandardHandlerOptions } from "@orpc/server/standard";
|
|
5
|
+
import { FastifyHandler, FastifyHandlerOptions } from "@orpc/server/fastify";
|
|
6
|
+
export interface OpenAPIHandlerOptions<T extends Context> extends FastifyHandlerOptions<T>, StandardHandlerOptions<T>, OpenAPIHandlerCodecOptions<T> {}
|
|
8
7
|
/**
|
|
9
8
|
* Serves oRPC procedures over the OpenAPI (RESTful) protocol as part of a Fastify server.
|
|
10
9
|
*
|
|
11
10
|
* @see {@link https://orpc.dev/docs/adapters/fastify | Fastify Adapter}
|
|
12
11
|
*/
|
|
13
12
|
export declare class OpenAPIHandler<T extends Context> extends FastifyHandler<T> {
|
|
14
|
-
|
|
15
|
-
}
|
|
13
|
+
constructor(router: Router<T>, options?: NoInfer<OpenAPIHandlerOptions<T>>);
|
|
14
|
+
}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { StandardHandler } from
|
|
3
|
-
import {
|
|
1
|
+
import { OpenAPIHandlerCodec } from "../standard/openapi-handler-codec.js";
|
|
2
|
+
import { StandardHandler } from "@orpc/server/standard";
|
|
3
|
+
import { FastifyHandler } from "@orpc/server/fastify";
|
|
4
|
+
// src/adapters/fastify/openapi-handler.ts
|
|
4
5
|
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
6
|
+
* Serves oRPC procedures over the OpenAPI (RESTful) protocol as part of a Fastify server.
|
|
7
|
+
*
|
|
8
|
+
* @see {@link https://orpc.dev/docs/adapters/fastify | Fastify Adapter}
|
|
9
|
+
*/
|
|
10
|
+
var OpenAPIHandler = class extends FastifyHandler {
|
|
11
|
+
constructor(router, options = {}) {
|
|
12
|
+
const codec = new OpenAPIHandlerCodec(router, options);
|
|
13
|
+
const handler = new StandardHandler(codec, options);
|
|
14
|
+
super(handler, options);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
export { OpenAPIHandler };
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { OpenAPIHandler, OpenAPIHandlerOptions } from "./openapi-handler.js";
|
|
2
|
+
import { OpenAPILink, OpenAPILinkOptions } from "./openapi-link.js";
|
|
3
|
+
export { OpenAPIHandler, OpenAPIHandlerOptions, OpenAPILink, OpenAPILinkOptions };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export { OpenAPIHandler } from "./openapi-handler.js";
|
|
2
|
+
export { OpenAPILink } from "./openapi-link.js";
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
export interface OpenAPIHandlerOptions<T extends Context> extends FetchHandlerOptions<T>, StandardHandlerOptions<T>, OpenAPIHandlerCodecOptions<T> {
|
|
7
|
-
}
|
|
1
|
+
import { OpenAPIHandlerCodecOptions } from "../standard/openapi-handler-codec.js";
|
|
2
|
+
import "../standard/index.js";
|
|
3
|
+
import { Context, Router } from "@orpc/server";
|
|
4
|
+
import { FetchHandler, FetchHandlerOptions } from "@orpc/server/fetch";
|
|
5
|
+
import { StandardHandlerOptions } from "@orpc/server/standard";
|
|
6
|
+
export interface OpenAPIHandlerOptions<T extends Context> extends FetchHandlerOptions<T>, StandardHandlerOptions<T>, OpenAPIHandlerCodecOptions<T> {}
|
|
8
7
|
/**
|
|
9
8
|
* Serves oRPC procedures over the OpenAPI (RESTful) protocol using the Fetch API `Request`/`Response`.
|
|
10
9
|
*
|
|
11
10
|
* @see {@link https://orpc.dev/docs/adapters/fetch-api | Fetch API Adapter}
|
|
12
11
|
*/
|
|
13
12
|
export declare class OpenAPIHandler<T extends Context> extends FetchHandler<T> {
|
|
14
|
-
|
|
15
|
-
}
|
|
13
|
+
constructor(router: Router<T>, options?: NoInfer<OpenAPIHandlerOptions<T>>);
|
|
14
|
+
}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { OpenAPIHandlerCodec } from "../standard/openapi-handler-codec.js";
|
|
2
|
+
import { FetchHandler } from "@orpc/server/fetch";
|
|
3
|
+
import { StandardHandler } from "@orpc/server/standard";
|
|
4
|
+
// src/adapters/fetch/openapi-handler.ts
|
|
4
5
|
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
6
|
+
* Serves oRPC procedures over the OpenAPI (RESTful) protocol using the Fetch API `Request`/`Response`.
|
|
7
|
+
*
|
|
8
|
+
* @see {@link https://orpc.dev/docs/adapters/fetch-api | Fetch API Adapter}
|
|
9
|
+
*/
|
|
10
|
+
var OpenAPIHandler = class extends FetchHandler {
|
|
11
|
+
constructor(router, options = {}) {
|
|
12
|
+
const codec = new OpenAPIHandlerCodec(router, options);
|
|
13
|
+
const handler = new StandardHandler(codec, options);
|
|
14
|
+
super(handler, options);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
export { OpenAPIHandler };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
export interface OpenAPILinkOptions<T extends ClientContext> extends StandardLinkOptions<T>, FetchLinkTransportOptions<T>, OpenAPILinkCodecOptions<T> {
|
|
8
|
-
}
|
|
1
|
+
import { OpenAPILinkCodecOptions } from "../standard/openapi-link-codec.js";
|
|
2
|
+
import "../standard/index.js";
|
|
3
|
+
import { RouterContract } from "@orpc/contract";
|
|
4
|
+
import { ClientContext } from "@orpc/client";
|
|
5
|
+
import { FetchLinkTransportOptions } from "@orpc/client/fetch";
|
|
6
|
+
import { StandardLink, StandardLinkOptions } from "@orpc/client/standard";
|
|
7
|
+
export interface OpenAPILinkOptions<T extends ClientContext> extends StandardLinkOptions<T>, FetchLinkTransportOptions<T>, OpenAPILinkCodecOptions<T> {}
|
|
9
8
|
/**
|
|
10
9
|
* Client link that calls an OpenAPI (RESTful) oRPC server over HTTP using the Fetch API.
|
|
11
10
|
*
|
|
@@ -17,5 +16,5 @@ export interface OpenAPILinkOptions<T extends ClientContext> extends StandardLin
|
|
|
17
16
|
* @see {@link https://orpc.dev/docs/openapi/link#redirect-responses | OpenAPI Link - Redirect Responses}
|
|
18
17
|
*/
|
|
19
18
|
export declare class OpenAPILink<T extends ClientContext> extends StandardLink<T> {
|
|
20
|
-
|
|
21
|
-
}
|
|
19
|
+
constructor(router: RouterContract, options?: OpenAPILinkOptions<T>);
|
|
20
|
+
}
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { OpenAPILinkCodec } from "../standard/openapi-link-codec.js";
|
|
2
|
+
import { FetchLinkTransport } from "@orpc/client/fetch";
|
|
3
|
+
import { StandardLink } from "@orpc/client/standard";
|
|
4
|
+
// src/adapters/fetch/openapi-link.ts
|
|
4
5
|
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
6
|
+
* Client link that calls an OpenAPI (RESTful) oRPC server over HTTP using the Fetch API.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* **Warning**: `fetch` follows redirects by default, so `3xx` responses are never returned.
|
|
10
|
+
* Use a custom `fetch` with `redirect: 'manual'` to get them (server runtimes only).
|
|
11
|
+
*
|
|
12
|
+
* @see {@link https://orpc.dev/docs/openapi/link | OpenAPI Link}
|
|
13
|
+
* @see {@link https://orpc.dev/docs/openapi/link#redirect-responses | OpenAPI Link - Redirect Responses}
|
|
14
|
+
*/
|
|
15
|
+
var OpenAPILink = class extends StandardLink {
|
|
16
|
+
constructor(router, options = {}) {
|
|
17
|
+
const codec = new OpenAPILinkCodec(router, options);
|
|
18
|
+
const transport = new FetchLinkTransport(options);
|
|
19
|
+
super(codec, transport, options);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
export { OpenAPILink };
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { OpenAPIHandler, OpenAPIHandlerOptions } from "./openapi-handler.js";
|
|
2
|
+
export { OpenAPIHandler, OpenAPIHandlerOptions };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { OpenAPIHandler } from "./openapi-handler.js";
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
export interface OpenAPIHandlerOptions<T extends Context> extends NodeHttpHandlerOptions<T>, StandardHandlerOptions<T>, OpenAPIHandlerCodecOptions<T> {
|
|
7
|
-
}
|
|
1
|
+
import { OpenAPIHandlerCodecOptions } from "../standard/openapi-handler-codec.js";
|
|
2
|
+
import "../standard/index.js";
|
|
3
|
+
import { Context, Router } from "@orpc/server";
|
|
4
|
+
import { StandardHandlerOptions } from "@orpc/server/standard";
|
|
5
|
+
import { NodeHttpHandler, NodeHttpHandlerOptions } from "@orpc/server/node";
|
|
6
|
+
export interface OpenAPIHandlerOptions<T extends Context> extends NodeHttpHandlerOptions<T>, StandardHandlerOptions<T>, OpenAPIHandlerCodecOptions<T> {}
|
|
8
7
|
/**
|
|
9
8
|
* Serves oRPC procedures over the OpenAPI (RESTful) protocol using Node.js built-in HTTP request/response.
|
|
10
9
|
*
|
|
11
10
|
* @see {@link https://orpc.dev/docs/adapters/node-http | Node HTTP Adapter}
|
|
12
11
|
*/
|
|
13
12
|
export declare class OpenAPIHandler<T extends Context> extends NodeHttpHandler<T> {
|
|
14
|
-
|
|
15
|
-
}
|
|
13
|
+
constructor(router: Router<T>, options?: NoInfer<OpenAPIHandlerOptions<T>>);
|
|
14
|
+
}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { StandardHandler } from
|
|
3
|
-
import {
|
|
1
|
+
import { OpenAPIHandlerCodec } from "../standard/openapi-handler-codec.js";
|
|
2
|
+
import { StandardHandler } from "@orpc/server/standard";
|
|
3
|
+
import { NodeHttpHandler } from "@orpc/server/node";
|
|
4
|
+
// src/adapters/node/openapi-handler.ts
|
|
4
5
|
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
6
|
+
* Serves oRPC procedures over the OpenAPI (RESTful) protocol using Node.js built-in HTTP request/response.
|
|
7
|
+
*
|
|
8
|
+
* @see {@link https://orpc.dev/docs/adapters/node-http | Node HTTP Adapter}
|
|
9
|
+
*/
|
|
10
|
+
var OpenAPIHandler = class extends NodeHttpHandler {
|
|
11
|
+
constructor(router, options = {}) {
|
|
12
|
+
const codec = new OpenAPIHandlerCodec(router, options);
|
|
13
|
+
const handler = new StandardHandler(codec, options);
|
|
14
|
+
super(handler, options);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
export { OpenAPIHandler };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { OpenAPIHandlerCodec, OpenAPIHandlerCodecCore, OpenAPIHandlerCodecCoreOptions, OpenAPIHandlerCodecOptions } from "./openapi-handler-codec.js";
|
|
2
|
+
import { OpenAPILinkCodec, OpenAPILinkCodecOptions } from "./openapi-link-codec.js";
|
|
3
|
+
import { OpenAPIMatcher, OpenAPIMatcherOptions } from "./openapi-matcher.js";
|
|
4
|
+
export { OpenAPIHandlerCodec, OpenAPIHandlerCodecCore, OpenAPIHandlerCodecCoreOptions, OpenAPIHandlerCodecOptions, OpenAPILinkCodec, OpenAPILinkCodecOptions, OpenAPIMatcher, OpenAPIMatcherOptions };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
1
|
+
export { OpenAPIHandlerCodec, OpenAPIHandlerCodecCore } from "./openapi-handler-codec.js";
|
|
2
|
+
export { OpenAPILinkCodec } from "./openapi-link-codec.js";
|
|
3
|
+
export { OpenAPIMatcher } from "./openapi-matcher.js";
|
|
@@ -1,62 +1,61 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
1
|
+
import { OpenAPISerializer } from "../../openapi-serializer.js";
|
|
2
|
+
import { OpenAPIMatcherOptions } from "./openapi-matcher.js";
|
|
3
|
+
import { Promisable, Public } from "@orpc/shared";
|
|
4
|
+
import { AnyORPCError } from "@orpc/client";
|
|
5
|
+
import { AnyProcedure, AnyRouter, Context } from "@orpc/server";
|
|
6
|
+
import { StandardLazyRequest, StandardResponse } from "@standard-server/core";
|
|
7
|
+
import { ResolvedStandardHandlerHandleOptions, StandardHandlerCodec, StandardHandlerCodecResolvedProcedure } from "@orpc/server/standard";
|
|
8
8
|
export interface OpenAPIHandlerCodecCoreOptions<_T extends Context> {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Override the default OpenAPI serializer.
|
|
11
|
+
*/
|
|
12
|
+
serializer?: Public<OpenAPISerializer> | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Mapping ORPCError Code -> HTTP Status Code
|
|
15
|
+
* The status code should be in the `4xx` or `5xx` range (must be greater than or equal to `400`).
|
|
16
|
+
* Codes missing from the map fall back to `DEFAULT_ERROR_STATUS` (400).
|
|
17
|
+
*
|
|
18
|
+
* @default COMMON_ERROR_STATUS_MAP
|
|
19
|
+
*/
|
|
20
|
+
errorStatusMap?: Record<string, number> | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Customize how an ORPC error is serialized into a response body.
|
|
23
|
+
* Use this if your API needs a different error output structure.
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* - Return `error.toJSON()` to keep the default body, or `undefined` to send an empty body
|
|
27
|
+
*
|
|
28
|
+
* @default ((e) => e.toJSON())
|
|
29
|
+
*/
|
|
30
|
+
errorResponseBodyEncoder?: ((error: AnyORPCError) => unknown) | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* The `content-type` of error responses, e.g. `application/problem+json` for RFC 9457 Problem Details.
|
|
33
|
+
*
|
|
34
|
+
* @default 'application/json'
|
|
35
|
+
*/
|
|
36
|
+
errorResponseContentType?: string | undefined;
|
|
37
37
|
}
|
|
38
38
|
export declare class OpenAPIHandlerCodecCore<T extends Context> {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
export interface OpenAPIHandlerCodecOptions<T extends Context> extends OpenAPIHandlerCodecCoreOptions<T>, OpenAPIMatcherOptions {
|
|
39
|
+
private readonly serializer;
|
|
40
|
+
private readonly errorStatusMap;
|
|
41
|
+
private readonly errorResponseBodyEncoder;
|
|
42
|
+
private readonly errorResponseContentType;
|
|
43
|
+
constructor(options?: OpenAPIHandlerCodecCoreOptions<T>);
|
|
44
|
+
decodeInput(matched: {
|
|
45
|
+
procedure: AnyProcedure;
|
|
46
|
+
params?: Record<string, string> | undefined;
|
|
47
|
+
}, request: StandardLazyRequest): Promise<unknown>;
|
|
48
|
+
/**
|
|
49
|
+
* @throws {TypeError} If `outputStructure` is "detailed" and the output doesn't match the expected structure.
|
|
50
|
+
*/
|
|
51
|
+
encodeOutput(output: unknown, procedure: AnyProcedure, path: string[]): Promisable<StandardResponse>;
|
|
52
|
+
encodeError(error: AnyORPCError): Promisable<StandardResponse>;
|
|
53
|
+
private deserializeQuery;
|
|
54
|
+
private deserializeParams;
|
|
57
55
|
}
|
|
56
|
+
export interface OpenAPIHandlerCodecOptions<T extends Context> extends OpenAPIHandlerCodecCoreOptions<T>, OpenAPIMatcherOptions {}
|
|
58
57
|
export declare class OpenAPIHandlerCodec<T extends Context> extends OpenAPIHandlerCodecCore<T> implements StandardHandlerCodec<T> {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
58
|
+
private readonly matcher;
|
|
59
|
+
constructor(router: AnyRouter, options?: OpenAPIHandlerCodecOptions<T>);
|
|
60
|
+
resolveProcedure(request: StandardLazyRequest, options: ResolvedStandardHandlerHandleOptions<T>): Promise<StandardHandlerCodecResolvedProcedure | undefined>;
|
|
61
|
+
}
|