@orpc/openapi 2.0.0-beta.45 → 2.0.0-beta.46
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/README.md +47 -16
- package/dist/adapters/aws-lambda/index.d.mts +2 -1
- package/dist/adapters/aws-lambda/index.d.ts +2 -1
- package/dist/adapters/fastify/index.d.mts +1 -1
- package/dist/adapters/fastify/index.d.ts +1 -1
- package/dist/adapters/fetch/index.d.mts +1 -1
- package/dist/adapters/fetch/index.d.ts +1 -1
- package/dist/adapters/node/index.d.mts +1 -1
- package/dist/adapters/node/index.d.ts +1 -1
- package/dist/adapters/standard/index.d.mts +44 -10
- package/dist/adapters/standard/index.d.ts +44 -10
- package/dist/adapters/standard/index.mjs +1 -1
- package/dist/index.d.mts +15 -13
- package/dist/index.d.ts +15 -13
- package/dist/index.mjs +1 -1
- package/dist/shared/{openapi.B8v9IrIK.d.mts → openapi.BCrrWRbv.d.mts} +1 -1
- package/dist/shared/{openapi.C_r_fZl2.d.ts → openapi.BkjX_6hE.d.ts} +1 -1
- package/dist/shared/{openapi.BTq9wym2.d.mts → openapi.Covi8zVE.d.mts} +1 -1
- package/dist/shared/{openapi.BTq9wym2.d.ts → openapi.Covi8zVE.d.ts} +1 -1
- package/dist/shared/{openapi.D42Ps1fQ.d.mts → openapi.YMRD3b4R.d.mts} +7 -1
- package/dist/shared/{openapi.D42Ps1fQ.d.ts → openapi.YMRD3b4R.d.ts} +7 -1
- package/package.json +6 -6
- package/dist/shared/openapi.C1MLxqih.d.ts +0 -45
- package/dist/shared/openapi.CCZPbgOq.d.mts +0 -45
package/README.md
CHANGED
|
@@ -21,9 +21,40 @@
|
|
|
21
21
|
</a>
|
|
22
22
|
</div>
|
|
23
23
|
|
|
24
|
+
**oRPC** is a TypeScript framework for building end-to-end typesafe APIs. Write your API once as plain TypeScript functions, and oRPC gives you a fully typed client, a REST API with an OpenAPI document, and MCP tools for AI agents, with no code generation. It runs on Node.js, Bun, Deno, Cloudflare Workers, and more.
|
|
25
|
+
|
|
26
|
+
Define procedures on the server and serve them with an [RPC handler](https://orpc.dev/docs/rpc/handler):
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
import { os } from '@orpc/server'
|
|
30
|
+
import * as z from 'zod'
|
|
31
|
+
|
|
32
|
+
export const router = {
|
|
33
|
+
planet: {
|
|
34
|
+
find: os
|
|
35
|
+
.input(z.object({ id: z.number() }))
|
|
36
|
+
.handler(({ input }) => ({ id: input.id, name: 'Earth' })),
|
|
37
|
+
},
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Then call them from a client that knows every input and output, without generating anything:
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import type { RouterClient } from '@orpc/server'
|
|
45
|
+
import type { router } from './router'
|
|
46
|
+
import { createORPCClient } from '@orpc/client'
|
|
47
|
+
import { RPCLink } from '@orpc/client/fetch'
|
|
48
|
+
|
|
49
|
+
const link = new RPCLink({ origin: 'http://localhost:3000', url: '/rpc' })
|
|
50
|
+
const client: RouterClient<typeof router> = createORPCClient(link)
|
|
51
|
+
|
|
52
|
+
const planet = await client.planet.find({ id: 1 }) // { id: number, name: string }
|
|
53
|
+
```
|
|
54
|
+
|
|
24
55
|
## Documentation
|
|
25
56
|
|
|
26
|
-
|
|
57
|
+
Read the full documentation at [orpc.dev](https://orpc.dev), starting with the [Getting Started guide](https://orpc.dev/docs/getting-started).
|
|
27
58
|
|
|
28
59
|
## Packages
|
|
29
60
|
|
|
@@ -56,21 +87,21 @@ You can read the documentation [here](https://orpc.dev).
|
|
|
56
87
|
|
|
57
88
|
**Framework & ecosystem integrations**
|
|
58
89
|
|
|
59
|
-
| Package
|
|
60
|
-
|
|
|
61
|
-
| [@orpc/next](https://www.npmjs.com/package/@orpc/next)
|
|
62
|
-
| [@orpc/ai-sdk](https://www.npmjs.com/package/@orpc/ai-sdk)
|
|
63
|
-
| [@orpc/mcp](https://www.npmjs.com/package/@orpc/mcp)
|
|
64
|
-
| [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query)
|
|
65
|
-
| [@orpc/pinia-colada](https://www.npmjs.com/package/@orpc/pinia-colada)
|
|
66
|
-
| [@orpc/swr](https://www.npmjs.com/package/@orpc/swr)
|
|
67
|
-
| [@orpc/msw](https://www.npmjs.com/package/@orpc/msw)
|
|
68
|
-
| [@orpc/
|
|
69
|
-
| [@orpc/nest](https://www.npmjs.com/package/@orpc/nest)
|
|
70
|
-
| [@orpc/node](https://www.npmjs.com/package/@orpc/node)
|
|
71
|
-
| [@orpc/bun](https://www.npmjs.com/package/@orpc/bun)
|
|
72
|
-
| [@orpc/cloudflare](https://www.npmjs.com/package/@orpc/cloudflare)
|
|
73
|
-
| [@orpc/trpc](https://www.npmjs.com/package/@orpc/trpc)
|
|
90
|
+
| Package | Purpose | Docs |
|
|
91
|
+
| -------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
92
|
+
| [@orpc/next](https://www.npmjs.com/package/@orpc/next) | Integrate with [Next.js Server Functions](https://nextjs.org/docs/app/getting-started/mutating-data). | [Next.js](https://orpc.dev/docs/integrations/next) |
|
|
93
|
+
| [@orpc/ai-sdk](https://www.npmjs.com/package/@orpc/ai-sdk) | Turn contracts and procedures into [AI SDK](https://ai-sdk.dev/) tools. | [AI SDK](https://orpc.dev/docs/integrations/ai-sdk) |
|
|
94
|
+
| [@orpc/mcp](https://www.npmjs.com/package/@orpc/mcp) | Expose procedures as [MCP](https://modelcontextprotocol.io/) tools. | [MCP](https://orpc.dev/docs/integrations/mcp) |
|
|
95
|
+
| [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query) | Integrate with [TanStack Query](https://tanstack.com/query/latest). | [TanStack Query](https://orpc.dev/docs/integrations/tanstack-query) |
|
|
96
|
+
| [@orpc/pinia-colada](https://www.npmjs.com/package/@orpc/pinia-colada) | Integrate with [Pinia Colada](https://pinia-colada.esm.dev/). | [Pinia Colada](https://orpc.dev/docs/integrations/pinia-colada) |
|
|
97
|
+
| [@orpc/swr](https://www.npmjs.com/package/@orpc/swr) | Integrate with [SWR](https://swr.vercel.app/). | [SWR](https://orpc.dev/docs/integrations/swr) |
|
|
98
|
+
| [@orpc/msw](https://www.npmjs.com/package/@orpc/msw) | Mock procedures with [Mock Service Worker](https://mswjs.io/). | [MSW](https://orpc.dev/docs/integrations/msw) |
|
|
99
|
+
| [@orpc/effect](https://www.npmjs.com/package/@orpc/effect) | Integrate with [Effect](https://effect.website/). | [Effect](https://orpc.dev/docs/integrations/effect) |
|
|
100
|
+
| [@orpc/nest](https://www.npmjs.com/package/@orpc/nest) | Implement your contract with [NestJS](https://nestjs.com/). | [NestJS](https://orpc.dev/docs/integrations/nest) |
|
|
101
|
+
| [@orpc/node](https://www.npmjs.com/package/@orpc/node) | [Node.js](https://nodejs.org/) plugins for static file serving and large uploads. | [Static File](https://orpc.dev/docs/plugins/static-file), [Tmp File Upload](https://orpc.dev/docs/plugins/tmp-file-upload), [Batch Response Compression](https://orpc.dev/docs/plugins/batch-response-compression) |
|
|
102
|
+
| [@orpc/bun](https://www.npmjs.com/package/@orpc/bun) | Adapters for [Bun's Redis](https://bun.sh/). | [Publisher](https://orpc.dev/docs/helpers/publisher), [Rate Limit](https://orpc.dev/docs/helpers/ratelimit), [Lock](https://orpc.dev/docs/helpers/lock) |
|
|
103
|
+
| [@orpc/cloudflare](https://www.npmjs.com/package/@orpc/cloudflare) | Adapters for [Cloudflare Workers](https://developers.cloudflare.com/workers/). | [Publisher](https://orpc.dev/docs/helpers/publisher), [Rate Limit](https://orpc.dev/docs/helpers/ratelimit), [Lock](https://orpc.dev/docs/helpers/lock), [Traces](https://orpc.dev/docs/integrations/cloudflare-traces) |
|
|
104
|
+
| [@orpc/trpc](https://www.npmjs.com/package/@orpc/trpc) | Reuse existing [tRPC](https://trpc.io/) routers within oRPC. | [tRPC](https://orpc.dev/docs/integrations/trpc) |
|
|
74
105
|
|
|
75
106
|
**Observability**
|
|
76
107
|
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Context, Router } from '@orpc/server';
|
|
2
2
|
import { AwsLambdaHandler, AwsLambdaHandlerOptions } from '@orpc/server/aws-lambda';
|
|
3
|
+
export { APIGatewayProxyEvent, APIGatewayProxyEventV2, AnyAPIGatewayProxyEvent, AwsLambdaGlobal, HttpResponseStream } from '@orpc/server/aws-lambda';
|
|
3
4
|
import { StandardHandlerOptions } from '@orpc/server/standard';
|
|
4
5
|
import { OpenAPIHandlerCodecOptions } from '../standard/index.mjs';
|
|
5
6
|
import '@orpc/client';
|
|
6
7
|
import '@orpc/shared';
|
|
7
8
|
import '@standard-server/core';
|
|
8
9
|
import '@orpc/contract';
|
|
9
|
-
import '../../shared/openapi.
|
|
10
|
+
import '../../shared/openapi.YMRD3b4R.mjs';
|
|
10
11
|
|
|
11
12
|
interface OpenAPIHandlerOptions<T extends Context> extends AwsLambdaHandlerOptions<T>, StandardHandlerOptions<T>, OpenAPIHandlerCodecOptions<T> {
|
|
12
13
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Context, Router } from '@orpc/server';
|
|
2
2
|
import { AwsLambdaHandler, AwsLambdaHandlerOptions } from '@orpc/server/aws-lambda';
|
|
3
|
+
export { APIGatewayProxyEvent, APIGatewayProxyEventV2, AnyAPIGatewayProxyEvent, AwsLambdaGlobal, HttpResponseStream } from '@orpc/server/aws-lambda';
|
|
3
4
|
import { StandardHandlerOptions } from '@orpc/server/standard';
|
|
4
5
|
import { OpenAPIHandlerCodecOptions } from '../standard/index.js';
|
|
5
6
|
import '@orpc/client';
|
|
6
7
|
import '@orpc/shared';
|
|
7
8
|
import '@standard-server/core';
|
|
8
9
|
import '@orpc/contract';
|
|
9
|
-
import '../../shared/openapi.
|
|
10
|
+
import '../../shared/openapi.YMRD3b4R.js';
|
|
10
11
|
|
|
11
12
|
interface OpenAPIHandlerOptions<T extends Context> extends AwsLambdaHandlerOptions<T>, StandardHandlerOptions<T>, OpenAPIHandlerCodecOptions<T> {
|
|
12
13
|
}
|
|
@@ -6,7 +6,7 @@ import '@orpc/client';
|
|
|
6
6
|
import '@orpc/shared';
|
|
7
7
|
import '@standard-server/core';
|
|
8
8
|
import '@orpc/contract';
|
|
9
|
-
import '../../shared/openapi.
|
|
9
|
+
import '../../shared/openapi.YMRD3b4R.mjs';
|
|
10
10
|
|
|
11
11
|
interface OpenAPIHandlerOptions<T extends Context> extends FastifyHandlerOptions<T>, StandardHandlerOptions<T>, OpenAPIHandlerCodecOptions<T> {
|
|
12
12
|
}
|
|
@@ -6,7 +6,7 @@ import '@orpc/client';
|
|
|
6
6
|
import '@orpc/shared';
|
|
7
7
|
import '@standard-server/core';
|
|
8
8
|
import '@orpc/contract';
|
|
9
|
-
import '../../shared/openapi.
|
|
9
|
+
import '../../shared/openapi.YMRD3b4R.js';
|
|
10
10
|
|
|
11
11
|
interface OpenAPIHandlerOptions<T extends Context> extends FastifyHandlerOptions<T>, StandardHandlerOptions<T>, OpenAPIHandlerCodecOptions<T> {
|
|
12
12
|
}
|
|
@@ -9,7 +9,7 @@ import { RouterContract } from '@orpc/contract';
|
|
|
9
9
|
import { OpenAPILinkCodecOptions } from '../standard/index.mjs';
|
|
10
10
|
import '@orpc/shared';
|
|
11
11
|
import '@standard-server/core';
|
|
12
|
-
import '../../shared/openapi.
|
|
12
|
+
import '../../shared/openapi.YMRD3b4R.mjs';
|
|
13
13
|
|
|
14
14
|
interface OpenAPIHandlerOptions<T extends Context> extends FetchHandlerOptions<T>, StandardHandlerOptions<T>, OpenAPIHandlerCodecOptions<T> {
|
|
15
15
|
}
|
|
@@ -9,7 +9,7 @@ import { RouterContract } from '@orpc/contract';
|
|
|
9
9
|
import { OpenAPILinkCodecOptions } from '../standard/index.js';
|
|
10
10
|
import '@orpc/shared';
|
|
11
11
|
import '@standard-server/core';
|
|
12
|
-
import '../../shared/openapi.
|
|
12
|
+
import '../../shared/openapi.YMRD3b4R.js';
|
|
13
13
|
|
|
14
14
|
interface OpenAPIHandlerOptions<T extends Context> extends FetchHandlerOptions<T>, StandardHandlerOptions<T>, OpenAPIHandlerCodecOptions<T> {
|
|
15
15
|
}
|
|
@@ -6,7 +6,7 @@ import '@orpc/client';
|
|
|
6
6
|
import '@orpc/shared';
|
|
7
7
|
import '@standard-server/core';
|
|
8
8
|
import '@orpc/contract';
|
|
9
|
-
import '../../shared/openapi.
|
|
9
|
+
import '../../shared/openapi.YMRD3b4R.mjs';
|
|
10
10
|
|
|
11
11
|
interface OpenAPIHandlerOptions<T extends Context> extends NodeHttpHandlerOptions<T>, StandardHandlerOptions<T>, OpenAPIHandlerCodecOptions<T> {
|
|
12
12
|
}
|
|
@@ -6,7 +6,7 @@ import '@orpc/client';
|
|
|
6
6
|
import '@orpc/shared';
|
|
7
7
|
import '@standard-server/core';
|
|
8
8
|
import '@orpc/contract';
|
|
9
|
-
import '../../shared/openapi.
|
|
9
|
+
import '../../shared/openapi.YMRD3b4R.js';
|
|
10
10
|
|
|
11
11
|
interface OpenAPIHandlerOptions<T extends Context> extends NodeHttpHandlerOptions<T>, StandardHandlerOptions<T>, OpenAPIHandlerCodecOptions<T> {
|
|
12
12
|
}
|
|
@@ -1,14 +1,48 @@
|
|
|
1
|
-
export { a as OpenAPIHandlerCodec, b as OpenAPIHandlerCodecCore, c as OpenAPIHandlerCodecCoreOptions, O as OpenAPIHandlerCodecOptions, d as OpenAPIMatcher, e as OpenAPIMatcherOptions } from '../../shared/openapi.
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import '@
|
|
1
|
+
export { a as OpenAPIHandlerCodec, b as OpenAPIHandlerCodecCore, c as OpenAPIHandlerCodecCoreOptions, O as OpenAPIHandlerCodecOptions, d as OpenAPIMatcher, e as OpenAPIMatcherOptions } from '../../shared/openapi.BCrrWRbv.mjs';
|
|
2
|
+
import { ClientContext, ClientOptions, AnyORPCError } from '@orpc/client';
|
|
3
|
+
import { StandardLinkCodec, StandardLinkCodecDecodedResponse } from '@orpc/client/standard';
|
|
4
|
+
import { RouterContract } from '@orpc/contract';
|
|
5
|
+
import { Value, Promisable, Public } from '@orpc/shared';
|
|
6
|
+
import { StandardUrl, StandardHeaders, StandardLazyResponse, StandardRequest } from '@standard-server/core';
|
|
7
|
+
import { OpenAPISerializer } from '../../index.mjs';
|
|
7
8
|
import '@orpc/server';
|
|
8
9
|
import '@orpc/server/standard';
|
|
9
|
-
import '@orpc/contract';
|
|
10
|
-
import '@orpc/client/standard';
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
interface OpenAPILinkCodecOptions<T extends ClientContext> {
|
|
12
|
+
/**
|
|
13
|
+
* Base URL for all requests, without origin. Should match the OpenAPI handler mount path.
|
|
14
|
+
*
|
|
15
|
+
* @example '/api'
|
|
16
|
+
* @default '/'
|
|
17
|
+
*/
|
|
18
|
+
url?: Value<Promisable<StandardUrl>, [options: ClientOptions<T>, path: string[], input: unknown]> | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Inject headers into the request.
|
|
21
|
+
*/
|
|
22
|
+
headers?: Value<Promisable<StandardHeaders | Headers>, [options: ClientOptions<T>, path: string[], input: unknown]> | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Override the default OpenAPI serializer.
|
|
25
|
+
*/
|
|
26
|
+
serializer?: Public<OpenAPISerializer> | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Customize how an error response body is converted into an ORPC error.
|
|
29
|
+
* Return `null` or `undefined` to fall back to the default decoding behavior.
|
|
30
|
+
*/
|
|
31
|
+
customErrorResponseBodyDecoder?: ((deserializedBody: unknown, response: StandardLazyResponse) => AnyORPCError | null | undefined) | undefined;
|
|
32
|
+
}
|
|
33
|
+
declare class OpenAPILinkCodec<T extends ClientContext> implements StandardLinkCodec<T> {
|
|
34
|
+
private readonly router;
|
|
35
|
+
private readonly baseUrl;
|
|
36
|
+
private readonly headers;
|
|
37
|
+
private readonly serializer;
|
|
38
|
+
private readonly customErrorResponseBodyDecoder;
|
|
39
|
+
constructor(router: RouterContract, options?: OpenAPILinkCodecOptions<T>);
|
|
40
|
+
encodeInput(input: unknown, path: string[], options: ClientOptions<T>): Promise<StandardRequest>;
|
|
41
|
+
private encodePathParam;
|
|
42
|
+
private serializeQueryString;
|
|
43
|
+
decodeResponse(response: StandardLazyResponse, path: string[], _options: ClientOptions<T>): Promise<StandardLinkCodecDecodedResponse>;
|
|
44
|
+
private resolveProcedure;
|
|
45
|
+
}
|
|
13
46
|
|
|
14
|
-
export {
|
|
47
|
+
export { OpenAPILinkCodec };
|
|
48
|
+
export type { OpenAPILinkCodecOptions };
|
|
@@ -1,14 +1,48 @@
|
|
|
1
|
-
export { a as OpenAPIHandlerCodec, b as OpenAPIHandlerCodecCore, c as OpenAPIHandlerCodecCoreOptions, O as OpenAPIHandlerCodecOptions, d as OpenAPIMatcher, e as OpenAPIMatcherOptions } from '../../shared/openapi.
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import '@
|
|
1
|
+
export { a as OpenAPIHandlerCodec, b as OpenAPIHandlerCodecCore, c as OpenAPIHandlerCodecCoreOptions, O as OpenAPIHandlerCodecOptions, d as OpenAPIMatcher, e as OpenAPIMatcherOptions } from '../../shared/openapi.BkjX_6hE.js';
|
|
2
|
+
import { ClientContext, ClientOptions, AnyORPCError } from '@orpc/client';
|
|
3
|
+
import { StandardLinkCodec, StandardLinkCodecDecodedResponse } from '@orpc/client/standard';
|
|
4
|
+
import { RouterContract } from '@orpc/contract';
|
|
5
|
+
import { Value, Promisable, Public } from '@orpc/shared';
|
|
6
|
+
import { StandardUrl, StandardHeaders, StandardLazyResponse, StandardRequest } from '@standard-server/core';
|
|
7
|
+
import { OpenAPISerializer } from '../../index.js';
|
|
7
8
|
import '@orpc/server';
|
|
8
9
|
import '@orpc/server/standard';
|
|
9
|
-
import '@orpc/contract';
|
|
10
|
-
import '@orpc/client/standard';
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
interface OpenAPILinkCodecOptions<T extends ClientContext> {
|
|
12
|
+
/**
|
|
13
|
+
* Base URL for all requests, without origin. Should match the OpenAPI handler mount path.
|
|
14
|
+
*
|
|
15
|
+
* @example '/api'
|
|
16
|
+
* @default '/'
|
|
17
|
+
*/
|
|
18
|
+
url?: Value<Promisable<StandardUrl>, [options: ClientOptions<T>, path: string[], input: unknown]> | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Inject headers into the request.
|
|
21
|
+
*/
|
|
22
|
+
headers?: Value<Promisable<StandardHeaders | Headers>, [options: ClientOptions<T>, path: string[], input: unknown]> | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Override the default OpenAPI serializer.
|
|
25
|
+
*/
|
|
26
|
+
serializer?: Public<OpenAPISerializer> | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Customize how an error response body is converted into an ORPC error.
|
|
29
|
+
* Return `null` or `undefined` to fall back to the default decoding behavior.
|
|
30
|
+
*/
|
|
31
|
+
customErrorResponseBodyDecoder?: ((deserializedBody: unknown, response: StandardLazyResponse) => AnyORPCError | null | undefined) | undefined;
|
|
32
|
+
}
|
|
33
|
+
declare class OpenAPILinkCodec<T extends ClientContext> implements StandardLinkCodec<T> {
|
|
34
|
+
private readonly router;
|
|
35
|
+
private readonly baseUrl;
|
|
36
|
+
private readonly headers;
|
|
37
|
+
private readonly serializer;
|
|
38
|
+
private readonly customErrorResponseBodyDecoder;
|
|
39
|
+
constructor(router: RouterContract, options?: OpenAPILinkCodecOptions<T>);
|
|
40
|
+
encodeInput(input: unknown, path: string[], options: ClientOptions<T>): Promise<StandardRequest>;
|
|
41
|
+
private encodePathParam;
|
|
42
|
+
private serializeQueryString;
|
|
43
|
+
decodeResponse(response: StandardLazyResponse, path: string[], _options: ClientOptions<T>): Promise<StandardLinkCodecDecodedResponse>;
|
|
44
|
+
private resolveProcedure;
|
|
45
|
+
}
|
|
13
46
|
|
|
14
|
-
export {
|
|
47
|
+
export { OpenAPILinkCodec };
|
|
48
|
+
export type { OpenAPILinkCodecOptions };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { O as OpenAPIHandlerCodec, a as OpenAPIHandlerCodecCore, b as OpenAPIMatcher
|
|
1
|
+
export { O as OpenAPIHandlerCodec, a as OpenAPIHandlerCodecCore, b as OpenAPIMatcher } from '../../shared/openapi.DXqJL3gB.mjs';
|
|
2
2
|
export { O as OpenAPILinkCodec } from '../../shared/openapi.BNe1y1cD.mjs';
|
|
3
3
|
import '@orpc/client';
|
|
4
4
|
import '@orpc/server';
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { B as BracketNotationSerializeResult, b as BracketNotationSerializer, c as BracketNotationSerializerOptions, d as OpenAPIJsonSerialization, e as OpenAPIJsonSerializerHandler, f as OpenAPIJsonSerializerOptions,
|
|
1
|
+
import { a as OpenAPIJsonSerializer } from './shared/openapi.YMRD3b4R.mjs';
|
|
2
|
+
export { B as BracketNotationSerializeResult, b as BracketNotationSerializer, c as BracketNotationSerializerOptions, d as OpenAPIJsonSerialization, e as OpenAPIJsonSerializerHandler, f as OpenAPIJsonSerializerOptions, O as OpenAPISerializer, g as OpenAPISerializerOptions, h as OpenAPISerializerSerializeOptions } from './shared/openapi.YMRD3b4R.mjs';
|
|
3
3
|
import { ClientContext, ORPCClientOptions, ClientLink } from '@orpc/client';
|
|
4
4
|
export { COMMON_ERROR_STATUS_MAP } from '@orpc/client';
|
|
5
5
|
import { RouterContract, RouterContractClient, AnyProcedureContract, ProcedureContract } from '@orpc/contract';
|
|
6
|
-
import { J as JsonifiedClient,
|
|
7
|
-
export { b as JsonifiedArray, c as JsonifiedClientError, d as JsonifiedValue } from './shared/openapi.
|
|
6
|
+
import { J as JsonifiedClient, a as OpenAPIVersion, O as OpenAPIDocument } from './shared/openapi.Covi8zVE.mjs';
|
|
7
|
+
export { b as JsonifiedArray, c as JsonifiedClientError, d as JsonifiedValue } from './shared/openapi.Covi8zVE.mjs';
|
|
8
8
|
export { a as OpenAPIFunction, O as OpenAPIMeta, b as OpenAPIMetaPlugin, c as OpenAPIMethodMetaPlugin, d as OpenAPIPathMetaPlugin, e as OpenAPIPrefixMetaPlugin, f as OpenAPISpecMetaPlugin, g as getOpenAPIMeta, o as openapi } from './shared/openapi.B_SoJfYz.mjs';
|
|
9
9
|
import { JsonSchema, JsonSchemaConverter } from '@orpc/json-schema';
|
|
10
|
+
export { JsonSchema } from '@orpc/json-schema';
|
|
10
11
|
import { AnyRouter, AnyProcedure } from '@orpc/server';
|
|
11
12
|
import { Public, Value } from '@orpc/shared';
|
|
12
13
|
import * as OpenAPIV3_2 from '@openapi-spec/types/v3.2';
|
|
@@ -28,18 +29,19 @@ interface ContractJsonifiedClientFactoryOptions<TClientContext extends ClientCon
|
|
|
28
29
|
*/
|
|
29
30
|
contractRef?: RouterContract | undefined;
|
|
30
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Like `createContractClientFactory`, but the clients it builds are typed as `JsonifiedClient`,
|
|
34
|
+
* for links that require it, such as OpenAPI Link.
|
|
35
|
+
*
|
|
36
|
+
* @remarks
|
|
37
|
+
* **Warning**: Every procedure contract passed to the factory must define `meta.path` matching its location in the root contract.
|
|
38
|
+
*
|
|
39
|
+
* @see {@link https://orpc.dev/docs/contract/client-factory | Contract Client Factory}
|
|
40
|
+
*/
|
|
31
41
|
declare function createContractJsonifiedClientFactory<TClientContext extends ClientContext>(link: ClientLink<TClientContext>, options?: ContractJsonifiedClientFactoryOptions<TClientContext>): ContractJsonifiedClientFactory<TClientContext>;
|
|
32
42
|
|
|
33
43
|
declare const DEFAULT_OPENAPI_METHOD = "POST";
|
|
34
|
-
declare const DEFAULT_OPENAPI_SUCCESS_DESCRIPTION = "OK";
|
|
35
|
-
declare const DEFAULT_OPENAPI_INPUT_STRUCTURE = "compact";
|
|
36
|
-
declare const DEFAULT_OPENAPI_OUTPUT_STRUCTURE = "compact";
|
|
37
44
|
|
|
38
|
-
/**
|
|
39
|
-
* GET and HEAD requests cannot carry a request body,
|
|
40
|
-
* so their compact input maps to query parameters instead.
|
|
41
|
-
*/
|
|
42
|
-
declare function isBodylessMethod(method: string): boolean;
|
|
43
45
|
/**
|
|
44
46
|
* Dynamic parameters are always returned in path order.
|
|
45
47
|
*/
|
|
@@ -153,5 +155,5 @@ interface PopulateRouterContractOpenAPIPathsOptions {
|
|
|
153
155
|
*/
|
|
154
156
|
declare function populateRouterContractOpenAPIPaths<T extends RouterContract>(router: T, options?: PopulateRouterContractOpenAPIPathsOptions): PopulatedContractRouterOpenAPIPaths<T>;
|
|
155
157
|
|
|
156
|
-
export {
|
|
158
|
+
export { DEFAULT_OPENAPI_METHOD, JsonifiedClient, OpenAPIDocument, OpenAPIGenerator, OpenAPIGeneratorError, OpenAPIJsonSerializer, OpenAPIVersion, createContractJsonifiedClientFactory, getDynamicPathParams, populateRouterContractOpenAPIPaths };
|
|
157
159
|
export type { ContractJsonifiedClientFactory, ContractJsonifiedClientFactoryOptions, OpenAPIErrorBodyDefinition, OpenAPIGeneratorGenerateOptions, OpenAPIGeneratorOptions, PopulateRouterContractOpenAPIPathsOptions, PopulatedContractRouterOpenAPIPaths };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { B as BracketNotationSerializeResult, b as BracketNotationSerializer, c as BracketNotationSerializerOptions, d as OpenAPIJsonSerialization, e as OpenAPIJsonSerializerHandler, f as OpenAPIJsonSerializerOptions,
|
|
1
|
+
import { a as OpenAPIJsonSerializer } from './shared/openapi.YMRD3b4R.js';
|
|
2
|
+
export { B as BracketNotationSerializeResult, b as BracketNotationSerializer, c as BracketNotationSerializerOptions, d as OpenAPIJsonSerialization, e as OpenAPIJsonSerializerHandler, f as OpenAPIJsonSerializerOptions, O as OpenAPISerializer, g as OpenAPISerializerOptions, h as OpenAPISerializerSerializeOptions } from './shared/openapi.YMRD3b4R.js';
|
|
3
3
|
import { ClientContext, ORPCClientOptions, ClientLink } from '@orpc/client';
|
|
4
4
|
export { COMMON_ERROR_STATUS_MAP } from '@orpc/client';
|
|
5
5
|
import { RouterContract, RouterContractClient, AnyProcedureContract, ProcedureContract } from '@orpc/contract';
|
|
6
|
-
import { J as JsonifiedClient,
|
|
7
|
-
export { b as JsonifiedArray, c as JsonifiedClientError, d as JsonifiedValue } from './shared/openapi.
|
|
6
|
+
import { J as JsonifiedClient, a as OpenAPIVersion, O as OpenAPIDocument } from './shared/openapi.Covi8zVE.js';
|
|
7
|
+
export { b as JsonifiedArray, c as JsonifiedClientError, d as JsonifiedValue } from './shared/openapi.Covi8zVE.js';
|
|
8
8
|
export { a as OpenAPIFunction, O as OpenAPIMeta, b as OpenAPIMetaPlugin, c as OpenAPIMethodMetaPlugin, d as OpenAPIPathMetaPlugin, e as OpenAPIPrefixMetaPlugin, f as OpenAPISpecMetaPlugin, g as getOpenAPIMeta, o as openapi } from './shared/openapi.B_SoJfYz.js';
|
|
9
9
|
import { JsonSchema, JsonSchemaConverter } from '@orpc/json-schema';
|
|
10
|
+
export { JsonSchema } from '@orpc/json-schema';
|
|
10
11
|
import { AnyRouter, AnyProcedure } from '@orpc/server';
|
|
11
12
|
import { Public, Value } from '@orpc/shared';
|
|
12
13
|
import * as OpenAPIV3_2 from '@openapi-spec/types/v3.2';
|
|
@@ -28,18 +29,19 @@ interface ContractJsonifiedClientFactoryOptions<TClientContext extends ClientCon
|
|
|
28
29
|
*/
|
|
29
30
|
contractRef?: RouterContract | undefined;
|
|
30
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Like `createContractClientFactory`, but the clients it builds are typed as `JsonifiedClient`,
|
|
34
|
+
* for links that require it, such as OpenAPI Link.
|
|
35
|
+
*
|
|
36
|
+
* @remarks
|
|
37
|
+
* **Warning**: Every procedure contract passed to the factory must define `meta.path` matching its location in the root contract.
|
|
38
|
+
*
|
|
39
|
+
* @see {@link https://orpc.dev/docs/contract/client-factory | Contract Client Factory}
|
|
40
|
+
*/
|
|
31
41
|
declare function createContractJsonifiedClientFactory<TClientContext extends ClientContext>(link: ClientLink<TClientContext>, options?: ContractJsonifiedClientFactoryOptions<TClientContext>): ContractJsonifiedClientFactory<TClientContext>;
|
|
32
42
|
|
|
33
43
|
declare const DEFAULT_OPENAPI_METHOD = "POST";
|
|
34
|
-
declare const DEFAULT_OPENAPI_SUCCESS_DESCRIPTION = "OK";
|
|
35
|
-
declare const DEFAULT_OPENAPI_INPUT_STRUCTURE = "compact";
|
|
36
|
-
declare const DEFAULT_OPENAPI_OUTPUT_STRUCTURE = "compact";
|
|
37
44
|
|
|
38
|
-
/**
|
|
39
|
-
* GET and HEAD requests cannot carry a request body,
|
|
40
|
-
* so their compact input maps to query parameters instead.
|
|
41
|
-
*/
|
|
42
|
-
declare function isBodylessMethod(method: string): boolean;
|
|
43
45
|
/**
|
|
44
46
|
* Dynamic parameters are always returned in path order.
|
|
45
47
|
*/
|
|
@@ -153,5 +155,5 @@ interface PopulateRouterContractOpenAPIPathsOptions {
|
|
|
153
155
|
*/
|
|
154
156
|
declare function populateRouterContractOpenAPIPaths<T extends RouterContract>(router: T, options?: PopulateRouterContractOpenAPIPathsOptions): PopulatedContractRouterOpenAPIPaths<T>;
|
|
155
157
|
|
|
156
|
-
export {
|
|
158
|
+
export { DEFAULT_OPENAPI_METHOD, JsonifiedClient, OpenAPIDocument, OpenAPIGenerator, OpenAPIGeneratorError, OpenAPIJsonSerializer, OpenAPIVersion, createContractJsonifiedClientFactory, getDynamicPathParams, populateRouterContractOpenAPIPaths };
|
|
157
159
|
export type { ContractJsonifiedClientFactory, ContractJsonifiedClientFactoryOptions, OpenAPIErrorBodyDefinition, OpenAPIGeneratorGenerateOptions, OpenAPIGeneratorOptions, PopulateRouterContractOpenAPIPathsOptions, PopulatedContractRouterOpenAPIPaths };
|
package/dist/index.mjs
CHANGED
|
@@ -775,4 +775,4 @@ function populateRouterContractOpenAPIPaths(router, options = {}) {
|
|
|
775
775
|
return populated;
|
|
776
776
|
}
|
|
777
777
|
|
|
778
|
-
export {
|
|
778
|
+
export { DEFAULT_OPENAPI_METHOD, OpenAPIGenerator, OpenAPIGeneratorError, OpenAPIJsonSerializer, createContractJsonifiedClientFactory, getDynamicPathParams, getOpenAPIMeta, openapi, populateRouterContractOpenAPIPaths };
|
|
@@ -4,7 +4,7 @@ import { StandardHandlerCodec, ResolvedStandardHandlerHandleOptions, StandardHan
|
|
|
4
4
|
import { Value, Public, Promisable } from '@orpc/shared';
|
|
5
5
|
import { StandardLazyRequest, StandardResponse } from '@standard-server/core';
|
|
6
6
|
import { AnyProcedureContract } from '@orpc/contract';
|
|
7
|
-
import {
|
|
7
|
+
import { O as OpenAPISerializer } from './openapi.YMRD3b4R.mjs';
|
|
8
8
|
|
|
9
9
|
interface OpenAPIMatcherOptions {
|
|
10
10
|
/**
|
|
@@ -4,7 +4,7 @@ import { StandardHandlerCodec, ResolvedStandardHandlerHandleOptions, StandardHan
|
|
|
4
4
|
import { Value, Public, Promisable } from '@orpc/shared';
|
|
5
5
|
import { StandardLazyRequest, StandardResponse } from '@standard-server/core';
|
|
6
6
|
import { AnyProcedureContract } from '@orpc/contract';
|
|
7
|
-
import {
|
|
7
|
+
import { O as OpenAPISerializer } from './openapi.YMRD3b4R.js';
|
|
8
8
|
|
|
9
9
|
interface OpenAPIMatcherOptions {
|
|
10
10
|
/**
|
|
@@ -30,4 +30,4 @@ type JsonifiedClient<T extends AnyNestedClient> = T extends Client<infer UClient
|
|
|
30
30
|
[K in keyof T]: T[K] extends AnyNestedClient ? JsonifiedClient<T[K]> : T[K];
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
export type { JsonifiedClient as J,
|
|
33
|
+
export type { JsonifiedClient as J, OpenAPIDocument as O, OpenAPIVersion as a, JsonifiedArray as b, JsonifiedClientError as c, JsonifiedValue as d };
|
|
@@ -30,4 +30,4 @@ type JsonifiedClient<T extends AnyNestedClient> = T extends Client<infer UClient
|
|
|
30
30
|
[K in keyof T]: T[K] extends AnyNestedClient ? JsonifiedClient<T[K]> : T[K];
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
export type { JsonifiedClient as J,
|
|
33
|
+
export type { JsonifiedClient as J, OpenAPIDocument as O, OpenAPIVersion as a, JsonifiedArray as b, JsonifiedClientError as c, JsonifiedValue as d };
|
|
@@ -93,6 +93,12 @@ interface OpenAPIJsonSerializerOptions {
|
|
|
93
93
|
*/
|
|
94
94
|
omitUndefinedProperties?: boolean | undefined;
|
|
95
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* The JSON layer behind `OpenAPISerializer`: one-way serialization of types like `Date`, `BigInt`,
|
|
98
|
+
* and `Set` into JSON-friendly values, for places that only accept JSON.
|
|
99
|
+
*
|
|
100
|
+
* @see {@link https://orpc.dev/docs/openapi/serializer#openapi-json-serializer | OpenAPI Serializer - OpenAPI JSON Serializer}
|
|
101
|
+
*/
|
|
96
102
|
declare class OpenAPIJsonSerializer {
|
|
97
103
|
private readonly inlineBuiltInHandlers;
|
|
98
104
|
private readonly handlerEntries;
|
|
@@ -147,5 +153,5 @@ declare class OpenAPISerializer extends OpenAPIJsonSerializer {
|
|
|
147
153
|
deserialize(data: StandardBody): unknown;
|
|
148
154
|
}
|
|
149
155
|
|
|
150
|
-
export {
|
|
156
|
+
export { OpenAPISerializer as O, OpenAPIJsonSerializer as a, BracketNotationSerializer as b };
|
|
151
157
|
export type { BracketNotationSerializeResult as B, BracketNotationSerializerOptions as c, OpenAPIJsonSerialization as d, OpenAPIJsonSerializerHandler as e, OpenAPIJsonSerializerOptions as f, OpenAPISerializerOptions as g, OpenAPISerializerSerializeOptions as h };
|
|
@@ -93,6 +93,12 @@ interface OpenAPIJsonSerializerOptions {
|
|
|
93
93
|
*/
|
|
94
94
|
omitUndefinedProperties?: boolean | undefined;
|
|
95
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* The JSON layer behind `OpenAPISerializer`: one-way serialization of types like `Date`, `BigInt`,
|
|
98
|
+
* and `Set` into JSON-friendly values, for places that only accept JSON.
|
|
99
|
+
*
|
|
100
|
+
* @see {@link https://orpc.dev/docs/openapi/serializer#openapi-json-serializer | OpenAPI Serializer - OpenAPI JSON Serializer}
|
|
101
|
+
*/
|
|
96
102
|
declare class OpenAPIJsonSerializer {
|
|
97
103
|
private readonly inlineBuiltInHandlers;
|
|
98
104
|
private readonly handlerEntries;
|
|
@@ -147,5 +153,5 @@ declare class OpenAPISerializer extends OpenAPIJsonSerializer {
|
|
|
147
153
|
deserialize(data: StandardBody): unknown;
|
|
148
154
|
}
|
|
149
155
|
|
|
150
|
-
export {
|
|
156
|
+
export { OpenAPISerializer as O, OpenAPIJsonSerializer as a, BracketNotationSerializer as b };
|
|
151
157
|
export type { BracketNotationSerializeResult as B, BracketNotationSerializerOptions as c, OpenAPIJsonSerialization as d, OpenAPIJsonSerializerHandler as e, OpenAPIJsonSerializerOptions as f, OpenAPISerializerOptions as g, OpenAPISerializerSerializeOptions as h };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/openapi",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.46",
|
|
5
5
|
"description": "Generate OpenAPI specs from oRPC routers and serve OpenAPI-compliant APIs with end-to-end type safety",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": [
|
|
@@ -99,11 +99,11 @@
|
|
|
99
99
|
"dependencies": {
|
|
100
100
|
"@openapi-spec/downgrader": "~0.3.0",
|
|
101
101
|
"@openapi-spec/types": "~0.3.0",
|
|
102
|
-
"@orpc/client": "2.0.0-beta.
|
|
103
|
-
"@orpc/contract": "2.0.0-beta.
|
|
104
|
-
"@orpc/json-schema": "2.0.0-beta.
|
|
105
|
-
"@orpc/server": "2.0.0-beta.
|
|
106
|
-
"@orpc/shared": "2.0.0-beta.
|
|
102
|
+
"@orpc/client": "2.0.0-beta.46",
|
|
103
|
+
"@orpc/contract": "2.0.0-beta.46",
|
|
104
|
+
"@orpc/json-schema": "2.0.0-beta.46",
|
|
105
|
+
"@orpc/server": "2.0.0-beta.46",
|
|
106
|
+
"@orpc/shared": "2.0.0-beta.46",
|
|
107
107
|
"@standard-server/core": "~0.11.0",
|
|
108
108
|
"@standard-server/fetch": "~0.11.0",
|
|
109
109
|
"rou3": "^1.0.0"
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { ClientContext, ClientOptions, AnyORPCError } from '@orpc/client';
|
|
2
|
-
import { StandardLinkCodec, StandardLinkCodecDecodedResponse } from '@orpc/client/standard';
|
|
3
|
-
import { RouterContract } from '@orpc/contract';
|
|
4
|
-
import { Value, Promisable, Public } from '@orpc/shared';
|
|
5
|
-
import { StandardUrl, StandardHeaders, StandardLazyResponse, StandardRequest } from '@standard-server/core';
|
|
6
|
-
import { a as OpenAPISerializer } from './openapi.D42Ps1fQ.js';
|
|
7
|
-
|
|
8
|
-
interface OpenAPILinkCodecOptions<T extends ClientContext> {
|
|
9
|
-
/**
|
|
10
|
-
* Base URL for all requests, without origin. Should match the OpenAPI handler mount path.
|
|
11
|
-
*
|
|
12
|
-
* @example '/api'
|
|
13
|
-
* @default '/'
|
|
14
|
-
*/
|
|
15
|
-
url?: Value<Promisable<StandardUrl>, [options: ClientOptions<T>, path: string[], input: unknown]> | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* Inject headers into the request.
|
|
18
|
-
*/
|
|
19
|
-
headers?: Value<Promisable<StandardHeaders | Headers>, [options: ClientOptions<T>, path: string[], input: unknown]> | undefined;
|
|
20
|
-
/**
|
|
21
|
-
* Override the default OpenAPI serializer.
|
|
22
|
-
*/
|
|
23
|
-
serializer?: Public<OpenAPISerializer> | undefined;
|
|
24
|
-
/**
|
|
25
|
-
* Customize how an error response body is converted into an ORPC error.
|
|
26
|
-
* Return `null` or `undefined` to fall back to the default decoding behavior.
|
|
27
|
-
*/
|
|
28
|
-
customErrorResponseBodyDecoder?: ((deserializedBody: unknown, response: StandardLazyResponse) => AnyORPCError | null | undefined) | undefined;
|
|
29
|
-
}
|
|
30
|
-
declare class OpenAPILinkCodec<T extends ClientContext> implements StandardLinkCodec<T> {
|
|
31
|
-
private readonly router;
|
|
32
|
-
private readonly baseUrl;
|
|
33
|
-
private readonly headers;
|
|
34
|
-
private readonly serializer;
|
|
35
|
-
private readonly customErrorResponseBodyDecoder;
|
|
36
|
-
constructor(router: RouterContract, options?: OpenAPILinkCodecOptions<T>);
|
|
37
|
-
encodeInput(input: unknown, path: string[], options: ClientOptions<T>): Promise<StandardRequest>;
|
|
38
|
-
private encodePathParam;
|
|
39
|
-
private serializeQueryString;
|
|
40
|
-
decodeResponse(response: StandardLazyResponse, path: string[], _options: ClientOptions<T>): Promise<StandardLinkCodecDecodedResponse>;
|
|
41
|
-
private resolveProcedure;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export { OpenAPILinkCodec as a };
|
|
45
|
-
export type { OpenAPILinkCodecOptions as O };
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { ClientContext, ClientOptions, AnyORPCError } from '@orpc/client';
|
|
2
|
-
import { StandardLinkCodec, StandardLinkCodecDecodedResponse } from '@orpc/client/standard';
|
|
3
|
-
import { RouterContract } from '@orpc/contract';
|
|
4
|
-
import { Value, Promisable, Public } from '@orpc/shared';
|
|
5
|
-
import { StandardUrl, StandardHeaders, StandardLazyResponse, StandardRequest } from '@standard-server/core';
|
|
6
|
-
import { a as OpenAPISerializer } from './openapi.D42Ps1fQ.mjs';
|
|
7
|
-
|
|
8
|
-
interface OpenAPILinkCodecOptions<T extends ClientContext> {
|
|
9
|
-
/**
|
|
10
|
-
* Base URL for all requests, without origin. Should match the OpenAPI handler mount path.
|
|
11
|
-
*
|
|
12
|
-
* @example '/api'
|
|
13
|
-
* @default '/'
|
|
14
|
-
*/
|
|
15
|
-
url?: Value<Promisable<StandardUrl>, [options: ClientOptions<T>, path: string[], input: unknown]> | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* Inject headers into the request.
|
|
18
|
-
*/
|
|
19
|
-
headers?: Value<Promisable<StandardHeaders | Headers>, [options: ClientOptions<T>, path: string[], input: unknown]> | undefined;
|
|
20
|
-
/**
|
|
21
|
-
* Override the default OpenAPI serializer.
|
|
22
|
-
*/
|
|
23
|
-
serializer?: Public<OpenAPISerializer> | undefined;
|
|
24
|
-
/**
|
|
25
|
-
* Customize how an error response body is converted into an ORPC error.
|
|
26
|
-
* Return `null` or `undefined` to fall back to the default decoding behavior.
|
|
27
|
-
*/
|
|
28
|
-
customErrorResponseBodyDecoder?: ((deserializedBody: unknown, response: StandardLazyResponse) => AnyORPCError | null | undefined) | undefined;
|
|
29
|
-
}
|
|
30
|
-
declare class OpenAPILinkCodec<T extends ClientContext> implements StandardLinkCodec<T> {
|
|
31
|
-
private readonly router;
|
|
32
|
-
private readonly baseUrl;
|
|
33
|
-
private readonly headers;
|
|
34
|
-
private readonly serializer;
|
|
35
|
-
private readonly customErrorResponseBodyDecoder;
|
|
36
|
-
constructor(router: RouterContract, options?: OpenAPILinkCodecOptions<T>);
|
|
37
|
-
encodeInput(input: unknown, path: string[], options: ClientOptions<T>): Promise<StandardRequest>;
|
|
38
|
-
private encodePathParam;
|
|
39
|
-
private serializeQueryString;
|
|
40
|
-
decodeResponse(response: StandardLazyResponse, path: string[], _options: ClientOptions<T>): Promise<StandardLinkCodecDecodedResponse>;
|
|
41
|
-
private resolveProcedure;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export { OpenAPILinkCodec as a };
|
|
45
|
-
export type { OpenAPILinkCodecOptions as O };
|