@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.
Files changed (65) hide show
  1. package/dist/adapters/aws-lambda/index.d.ts +3 -15
  2. package/dist/adapters/aws-lambda/index.js +1 -1
  3. package/dist/adapters/aws-lambda/openapi-handler.d.ts +8 -9
  4. package/dist/adapters/aws-lambda/openapi-handler.js +19 -17
  5. package/dist/adapters/fastify/index.d.ts +2 -1
  6. package/dist/adapters/fastify/index.js +1 -1
  7. package/dist/adapters/fastify/openapi-handler.d.ts +8 -9
  8. package/dist/adapters/fastify/openapi-handler.js +16 -14
  9. package/dist/adapters/fetch/index.d.ts +3 -2
  10. package/dist/adapters/fetch/index.js +2 -2
  11. package/dist/adapters/fetch/openapi-handler.d.ts +8 -9
  12. package/dist/adapters/fetch/openapi-handler.js +16 -14
  13. package/dist/adapters/fetch/openapi-link.d.ts +9 -10
  14. package/dist/adapters/fetch/openapi-link.js +21 -19
  15. package/dist/adapters/node/index.d.ts +2 -1
  16. package/dist/adapters/node/index.js +1 -1
  17. package/dist/adapters/node/openapi-handler.d.ts +8 -9
  18. package/dist/adapters/node/openapi-handler.js +16 -14
  19. package/dist/adapters/standard/index.d.ts +4 -3
  20. package/dist/adapters/standard/index.js +3 -3
  21. package/dist/adapters/standard/openapi-handler-codec.d.ts +56 -57
  22. package/dist/adapters/standard/openapi-handler-codec.js +143 -205
  23. package/dist/adapters/standard/openapi-link-codec.d.ts +55 -59
  24. package/dist/adapters/standard/openapi-link-codec.js +262 -377
  25. package/dist/adapters/standard/openapi-matcher.d.ts +26 -26
  26. package/dist/adapters/standard/openapi-matcher.js +78 -108
  27. package/dist/adapters/standard/utils.js +28 -44
  28. package/dist/bracket-notation.d.ts +22 -22
  29. package/dist/bracket-notation.js +123 -173
  30. package/dist/client-factory.d.ts +12 -12
  31. package/dist/client-factory.js +13 -11
  32. package/dist/constants.d.ts +1 -4
  33. package/dist/constants.js +5 -4
  34. package/dist/extensions/route.d.ts +36 -36
  35. package/dist/extensions/route.js +7 -6
  36. package/dist/helpers/form-data.d.ts +1 -1
  37. package/dist/helpers/form-data.js +74 -86
  38. package/dist/helpers/index.d.ts +2 -1
  39. package/dist/helpers/index.js +1 -1
  40. package/dist/index.d.ts +15 -13
  41. package/dist/index.js +11 -11
  42. package/dist/meta.d.ts +298 -298
  43. package/dist/meta.js +54 -72
  44. package/dist/openapi-generator-components.d.ts +2 -31
  45. package/dist/openapi-generator-components.js +200 -248
  46. package/dist/openapi-generator-operation.d.ts +12 -33
  47. package/dist/openapi-generator-operation.js +369 -437
  48. package/dist/openapi-generator.d.ts +75 -80
  49. package/dist/openapi-generator.js +114 -142
  50. package/dist/openapi-json-serializer.d.ts +65 -65
  51. package/dist/openapi-json-serializer.js +218 -257
  52. package/dist/openapi-serializer.d.ts +31 -32
  53. package/dist/openapi-serializer.js +68 -92
  54. package/dist/plugins/index.d.ts +2 -1
  55. package/dist/plugins/index.js +1 -1
  56. package/dist/plugins/openapi-reference.d.ts +99 -102
  57. package/dist/plugins/openapi-reference.js +109 -132
  58. package/dist/router-utils.d.ts +7 -10
  59. package/dist/router-utils.js +30 -34
  60. package/dist/types.d.ts +8 -12
  61. package/dist/utils.d.ts +5 -10
  62. package/dist/utils.js +39 -42
  63. package/package.json +12 -12
  64. package/dist/adapters/standard/utils.d.ts +0 -4
  65. package/dist/types.js +0 -1
@@ -1,15 +1,3 @@
1
- export * from './openapi-handler.ts';
2
- export type { AnyAPIGatewayProxyEvent, APIGatewayProxyEvent,
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 * from './openapi-handler.js';
1
+ export { OpenAPIHandler } from "./openapi-handler.js";
@@ -1,10 +1,9 @@
1
- import type { Context, Router } from '@orpc/server';
2
- import type { AwsLambdaHandlerOptions } from '@orpc/server/aws-lambda';
3
- import { AwsLambdaHandler } from '@orpc/server/aws-lambda';
4
- import type { StandardHandlerOptions } from '@orpc/server/standard';
5
- import type { OpenAPIHandlerCodecOptions } from '../standard/index.ts';
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
- constructor(router: Router<T>, options?: NoInfer<OpenAPIHandlerOptions<T>>);
18
- }
16
+ constructor(router: Router<T>, options?: NoInfer<OpenAPIHandlerOptions<T>>);
17
+ }
@@ -1,18 +1,20 @@
1
- import { AwsLambdaHandler } from '@orpc/server/aws-lambda';
2
- import { StandardHandler } from '@orpc/server/standard';
3
- import { OpenAPIHandlerCodec } from '../standard/index.js';
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
- * Serves oRPC procedures over the OpenAPI (RESTful) protocol on AWS Lambda.
6
- *
7
- * @remarks
8
- * **Warning**: Requires the AWS Lambda Node.js runtime with response streaming enabled — handlers should be wrapped with `awslambda.streamifyResponse`.
9
- *
10
- * @see {@link https://orpc.dev/docs/adapters/aws-lambda | AWS Lambda Adapter}
11
- */
12
- export class OpenAPIHandler extends AwsLambdaHandler {
13
- constructor(router, options = {}) {
14
- const codec = new OpenAPIHandlerCodec(router, options);
15
- const handler = new StandardHandler(codec, options);
16
- super(handler, options);
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
- export * from './openapi-handler.ts';
1
+ import { OpenAPIHandler, OpenAPIHandlerOptions } from "./openapi-handler.js";
2
+ export { OpenAPIHandler, OpenAPIHandlerOptions };
@@ -1 +1 @@
1
- export * from './openapi-handler.js';
1
+ export { OpenAPIHandler } from "./openapi-handler.js";
@@ -1,15 +1,14 @@
1
- import type { Context, Router } from '@orpc/server';
2
- import type { FastifyHandlerOptions } from '@orpc/server/fastify';
3
- import { FastifyHandler } from '@orpc/server/fastify';
4
- import type { StandardHandlerOptions } from '@orpc/server/standard';
5
- import type { OpenAPIHandlerCodecOptions } from '../standard/index.ts';
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
- constructor(router: Router<T>, options?: NoInfer<OpenAPIHandlerOptions<T>>);
15
- }
13
+ constructor(router: Router<T>, options?: NoInfer<OpenAPIHandlerOptions<T>>);
14
+ }
@@ -1,15 +1,17 @@
1
- import { FastifyHandler } from '@orpc/server/fastify';
2
- import { StandardHandler } from '@orpc/server/standard';
3
- import { OpenAPIHandlerCodec } from '../standard/index.js';
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
- * Serves oRPC procedures over the OpenAPI (RESTful) protocol as part of a Fastify server.
6
- *
7
- * @see {@link https://orpc.dev/docs/adapters/fastify | Fastify Adapter}
8
- */
9
- export class OpenAPIHandler extends FastifyHandler {
10
- constructor(router, options = {}) {
11
- const codec = new OpenAPIHandlerCodec(router, options);
12
- const handler = new StandardHandler(codec, options);
13
- super(handler, options);
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
- export * from './openapi-handler.ts';
2
- export * from './openapi-link.ts';
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 * from './openapi-handler.js';
2
- export * from './openapi-link.js';
1
+ export { OpenAPIHandler } from "./openapi-handler.js";
2
+ export { OpenAPILink } from "./openapi-link.js";
@@ -1,15 +1,14 @@
1
- import type { Context, Router } from '@orpc/server';
2
- import type { FetchHandlerOptions } from '@orpc/server/fetch';
3
- import { FetchHandler } from '@orpc/server/fetch';
4
- import type { StandardHandlerOptions } from '@orpc/server/standard';
5
- import type { OpenAPIHandlerCodecOptions } from '../standard/index.ts';
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
- constructor(router: Router<T>, options?: NoInfer<OpenAPIHandlerOptions<T>>);
15
- }
13
+ constructor(router: Router<T>, options?: NoInfer<OpenAPIHandlerOptions<T>>);
14
+ }
@@ -1,15 +1,17 @@
1
- import { FetchHandler } from '@orpc/server/fetch';
2
- import { StandardHandler } from '@orpc/server/standard';
3
- import { OpenAPIHandlerCodec } from '../standard/index.js';
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
- * Serves oRPC procedures over the OpenAPI (RESTful) protocol using the Fetch API `Request`/`Response`.
6
- *
7
- * @see {@link https://orpc.dev/docs/adapters/fetch-api | Fetch API Adapter}
8
- */
9
- export class OpenAPIHandler extends FetchHandler {
10
- constructor(router, options = {}) {
11
- const codec = new OpenAPIHandlerCodec(router, options);
12
- const handler = new StandardHandler(codec, options);
13
- super(handler, options);
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 type { ClientContext } from '@orpc/client';
2
- import type { FetchLinkTransportOptions } from '@orpc/client/fetch';
3
- import type { StandardLinkOptions } from '@orpc/client/standard';
4
- import { StandardLink } from '@orpc/client/standard';
5
- import type { RouterContract } from '@orpc/contract';
6
- import type { OpenAPILinkCodecOptions } from '../standard/index.ts';
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
- constructor(router: RouterContract, options?: OpenAPILinkOptions<T>);
21
- }
19
+ constructor(router: RouterContract, options?: OpenAPILinkOptions<T>);
20
+ }
@@ -1,20 +1,22 @@
1
- import { FetchLinkTransport } from '@orpc/client/fetch';
2
- import { StandardLink } from '@orpc/client/standard';
3
- import { OpenAPILinkCodec } from '../standard/index.js';
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
- * Client link that calls an OpenAPI (RESTful) oRPC server over HTTP using the Fetch API.
6
- *
7
- * @remarks
8
- * **Warning**: `fetch` follows redirects by default, so `3xx` responses are never returned.
9
- * Use a custom `fetch` with `redirect: 'manual'` to get them (server runtimes only).
10
- *
11
- * @see {@link https://orpc.dev/docs/openapi/link | OpenAPI Link}
12
- * @see {@link https://orpc.dev/docs/openapi/link#redirect-responses | OpenAPI Link - Redirect Responses}
13
- */
14
- export class OpenAPILink extends StandardLink {
15
- constructor(router, options = {}) {
16
- const codec = new OpenAPILinkCodec(router, options);
17
- const transport = new FetchLinkTransport(options);
18
- super(codec, transport, options);
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
- export * from './openapi-handler.ts';
1
+ import { OpenAPIHandler, OpenAPIHandlerOptions } from "./openapi-handler.js";
2
+ export { OpenAPIHandler, OpenAPIHandlerOptions };
@@ -1 +1 @@
1
- export * from './openapi-handler.js';
1
+ export { OpenAPIHandler } from "./openapi-handler.js";
@@ -1,15 +1,14 @@
1
- import type { Context, Router } from '@orpc/server';
2
- import type { NodeHttpHandlerOptions } from '@orpc/server/node';
3
- import { NodeHttpHandler } from '@orpc/server/node';
4
- import type { StandardHandlerOptions } from '@orpc/server/standard';
5
- import type { OpenAPIHandlerCodecOptions } from '../standard/index.ts';
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
- constructor(router: Router<T>, options?: NoInfer<OpenAPIHandlerOptions<T>>);
15
- }
13
+ constructor(router: Router<T>, options?: NoInfer<OpenAPIHandlerOptions<T>>);
14
+ }
@@ -1,15 +1,17 @@
1
- import { NodeHttpHandler } from '@orpc/server/node';
2
- import { StandardHandler } from '@orpc/server/standard';
3
- import { OpenAPIHandlerCodec } from '../standard/index.js';
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
- * Serves oRPC procedures over the OpenAPI (RESTful) protocol using Node.js built-in HTTP request/response.
6
- *
7
- * @see {@link https://orpc.dev/docs/adapters/node-http | Node HTTP Adapter}
8
- */
9
- export class OpenAPIHandler extends NodeHttpHandler {
10
- constructor(router, options = {}) {
11
- const codec = new OpenAPIHandlerCodec(router, options);
12
- const handler = new StandardHandler(codec, options);
13
- super(handler, options);
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
- export * from './openapi-handler-codec.ts';
2
- export * from './openapi-link-codec.ts';
3
- export * from './openapi-matcher.ts';
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 * from './openapi-handler-codec.js';
2
- export * from './openapi-link-codec.js';
3
- export * from './openapi-matcher.js';
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 type { AnyORPCError } from '@orpc/client';
2
- import type { AnyProcedure, AnyRouter, Context } from '@orpc/server';
3
- import type { ResolvedStandardHandlerHandleOptions, StandardHandlerCodec, StandardHandlerCodecResolvedProcedure } from '@orpc/server/standard';
4
- import type { Promisable, Public } from '@orpc/shared';
5
- import type { StandardLazyRequest, StandardResponse } from '@standard-server/core';
6
- import { OpenAPISerializer } from '../../openapi-serializer.ts';
7
- import type { OpenAPIMatcherOptions } from './openapi-matcher.ts';
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
- * 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;
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
- 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;
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
- private readonly matcher;
60
- constructor(router: AnyRouter, options?: OpenAPIHandlerCodecOptions<T>);
61
- resolveProcedure(request: StandardLazyRequest, options: ResolvedStandardHandlerHandleOptions<T>): Promise<StandardHandlerCodecResolvedProcedure | undefined>;
62
- }
58
+ private readonly matcher;
59
+ constructor(router: AnyRouter, options?: OpenAPIHandlerCodecOptions<T>);
60
+ resolveProcedure(request: StandardLazyRequest, options: ResolvedStandardHandlerHandleOptions<T>): Promise<StandardHandlerCodecResolvedProcedure | undefined>;
61
+ }