@orpc/openapi 2.0.0-beta.33 → 2.0.0-beta.35
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 +15 -14
- package/dist/adapters/aws-lambda/index.d.mts +2 -2
- package/dist/adapters/aws-lambda/index.d.ts +2 -2
- package/dist/adapters/aws-lambda/index.mjs +3 -3
- package/dist/adapters/fastify/index.d.mts +2 -2
- package/dist/adapters/fastify/index.d.ts +2 -2
- package/dist/adapters/fastify/index.mjs +3 -3
- package/dist/adapters/fetch/index.d.mts +2 -2
- package/dist/adapters/fetch/index.d.ts +2 -2
- package/dist/adapters/fetch/index.mjs +5 -5
- package/dist/adapters/node/index.d.mts +2 -2
- package/dist/adapters/node/index.d.ts +2 -2
- package/dist/adapters/node/index.mjs +3 -3
- package/dist/adapters/standard/index.d.mts +3 -3
- package/dist/adapters/standard/index.d.ts +3 -3
- package/dist/adapters/standard/index.mjs +5 -5
- package/dist/extensions/route.d.mts +4 -6
- package/dist/extensions/route.d.ts +4 -6
- package/dist/index.d.mts +28 -13
- package/dist/index.d.ts +28 -13
- package/dist/index.mjs +40 -22
- package/dist/plugins/index.d.mts +4 -4
- package/dist/plugins/index.d.ts +4 -4
- package/dist/plugins/index.mjs +2 -2
- package/dist/shared/{openapi.BPD9gS3x.mjs → openapi.0Vlm07ar.mjs} +4 -4
- package/dist/shared/{openapi.9smDzQwj.d.mts → openapi.BO2OB-Y9.d.mts} +4 -4
- package/dist/shared/{openapi.DfTTLtn5.d.ts → openapi.CXSHZ431.d.mts} +12 -13
- package/dist/shared/{openapi.DfTTLtn5.d.mts → openapi.CXSHZ431.d.ts} +12 -13
- package/dist/shared/{openapi.Drcd0PuL.d.mts → openapi.Cem81Zhm.d.mts} +6 -3
- package/dist/shared/{openapi.DTYZZ6Ph.d.ts → openapi.Cem81Zhm.d.ts} +6 -3
- package/dist/shared/{openapi.0yE-t1W-.mjs → openapi.Cz2PauNH.mjs} +1 -1
- package/dist/shared/{openapi.Bd9icEUa.d.mts → openapi.D3yXvICd.d.mts} +4 -4
- package/dist/shared/{openapi.D1CqEIRy.d.ts → openapi.DOy27J9v.d.ts} +4 -4
- package/dist/shared/{openapi.Dz-JaXHo.d.mts → openapi.DXWj9fY8.d.mts} +1 -1
- package/dist/shared/{openapi.Dz-JaXHo.d.ts → openapi.DXWj9fY8.d.ts} +1 -1
- package/dist/shared/{openapi.YCiBHaJ-.d.ts → openapi.DsnjJWwQ.d.ts} +4 -4
- package/dist/shared/{openapi.BITX91Fj.mjs → openapi.Dxn8HAW0.mjs} +2 -2
- package/package.json +11 -10
package/README.md
CHANGED
|
@@ -55,20 +55,20 @@ You can read the documentation [here](https://orpc.dev).
|
|
|
55
55
|
|
|
56
56
|
**Framework & ecosystem integrations**
|
|
57
57
|
|
|
58
|
-
| Package | Purpose
|
|
59
|
-
| ------------------------------------------------------------------------------------ |
|
|
60
|
-
| [@orpc/next](https://www.npmjs.com/package/@orpc/next) | Integrate with [Next.js Server Functions](https://nextjs.org/docs/app/getting-started/mutating-data).
|
|
61
|
-
| [@orpc/ai-sdk](https://www.npmjs.com/package/@orpc/ai-sdk) | Turn contracts and procedures into [AI SDK](https://ai-sdk.dev/) tools.
|
|
62
|
-
| [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query) | Integrate with [TanStack Query](https://tanstack.com/query/latest).
|
|
63
|
-
| [@orpc/pinia-colada](https://www.npmjs.com/package/@orpc/pinia-colada) | Integrate with [Pinia Colada](https://pinia-colada.esm.dev/).
|
|
64
|
-
| [@orpc/swr](https://www.npmjs.com/package/@orpc/swr) | Integrate with [SWR](https://swr.vercel.app/).
|
|
65
|
-
| [@orpc/experimental-msw](https://www.npmjs.com/package/@orpc/experimental-msw) | Mock procedures with [Mock Service Worker](https://mswjs.io/).
|
|
66
|
-
| [@orpc/experimental-effect](https://www.npmjs.com/package/@orpc/experimental-effect) | Integrate with [Effect](https://effect.website/).
|
|
67
|
-
| [@orpc/nest](https://www.npmjs.com/package/@orpc/nest) | Implement your contract with [NestJS](https://nestjs.com/).
|
|
68
|
-
| [@orpc/node](https://www.npmjs.com/package/@orpc/node) | [Node.js](https://nodejs.org/) plugins for static file serving and large uploads.
|
|
69
|
-
| [@orpc/bun](https://www.npmjs.com/package/@orpc/bun) | Adapters for [Bun's Redis](https://bun.sh/).
|
|
70
|
-
| [@orpc/cloudflare](https://www.npmjs.com/package/@orpc/cloudflare) | Adapters for [Cloudflare
|
|
71
|
-
| [@orpc/trpc](https://www.npmjs.com/package/@orpc/trpc) | Reuse existing [tRPC](https://trpc.io/) routers within oRPC.
|
|
58
|
+
| Package | Purpose | Docs |
|
|
59
|
+
| ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
60
|
+
| [@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) |
|
|
61
|
+
| [@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) |
|
|
62
|
+
| [@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) |
|
|
63
|
+
| [@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) |
|
|
64
|
+
| [@orpc/swr](https://www.npmjs.com/package/@orpc/swr) | Integrate with [SWR](https://swr.vercel.app/). | [SWR](https://orpc.dev/docs/integrations/swr) |
|
|
65
|
+
| [@orpc/experimental-msw](https://www.npmjs.com/package/@orpc/experimental-msw) | Mock procedures with [Mock Service Worker](https://mswjs.io/). | [MSW](https://orpc.dev/docs/integrations/msw) |
|
|
66
|
+
| [@orpc/experimental-effect](https://www.npmjs.com/package/@orpc/experimental-effect) | Integrate with [Effect](https://effect.website/). | [Effect](https://orpc.dev/docs/integrations/effect) |
|
|
67
|
+
| [@orpc/nest](https://www.npmjs.com/package/@orpc/nest) | Implement your contract with [NestJS](https://nestjs.com/). | [NestJS](https://orpc.dev/docs/integrations/nest) |
|
|
68
|
+
| [@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) |
|
|
69
|
+
| [@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) |
|
|
70
|
+
| [@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), [Traces](https://orpc.dev/docs/integrations/cloudflare-traces) |
|
|
71
|
+
| [@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) |
|
|
72
72
|
|
|
73
73
|
**Observability**
|
|
74
74
|
|
|
@@ -127,6 +127,7 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
|
|
|
127
127
|
<td align="center"><a href="https://github.com/ellis-driscoll?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Ellis Driscoll"><img src="https://avatars.githubusercontent.com/u/70685966?u=c5f95bc33b5991d9744abe00052542e4a2ed3cb9&v=4" width="139" alt="Ellis Driscoll"/><br />Ellis Driscoll</a></td>
|
|
128
128
|
<td align="center"><a href="https://github.com/hoangbn?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Hoang Nguyen"><img src="https://avatars.githubusercontent.com/u/38968280?u=c90084c6de65c56facabab7ba13a72a49ddbc3e4&v=4" width="139" alt="Hoang Nguyen"/><br />Hoang Nguyen</a></td>
|
|
129
129
|
<td align="center"><a href="https://opencollective.com/guest-ac41de3b?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Orestis Ioannou"><img src="https://images.opencollective.com/guest-ac41de3b/avatar/460.png" width="139" alt="Orestis Ioannou"/><br />Orestis Ioannou</a></td>
|
|
130
|
+
<td align="center"><a href="https://automatio.ai/?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Stefan Smiljkovic"><img src="https://avatars.githubusercontent.com/u/1984909?u=b7bf5bc40ed49df3c22f69d2da7b8d78709c49ed&v=4" width="139" alt="Stefan Smiljkovic"/><br />Stefan Smiljkovic</a></td>
|
|
130
131
|
</tr>
|
|
131
132
|
</table>
|
|
132
133
|
|
|
@@ -4,9 +4,9 @@ import { StandardHandlerOptions } from '@orpc/server/standard';
|
|
|
4
4
|
import { OpenAPIHandlerCodecOptions } from '../standard/index.mjs';
|
|
5
5
|
import '@orpc/client';
|
|
6
6
|
import '@orpc/shared';
|
|
7
|
-
import '@
|
|
7
|
+
import '@standard-server/core';
|
|
8
8
|
import '@orpc/contract';
|
|
9
|
-
import '../../shared/openapi.
|
|
9
|
+
import '../../shared/openapi.DXWj9fY8.mjs';
|
|
10
10
|
|
|
11
11
|
interface OpenAPIHandlerOptions<T extends Context> extends AwsLambdaHandlerOptions<T>, Omit<StandardHandlerOptions<T>, 'plugins'>, OpenAPIHandlerCodecOptions<T> {
|
|
12
12
|
}
|
|
@@ -4,9 +4,9 @@ import { StandardHandlerOptions } from '@orpc/server/standard';
|
|
|
4
4
|
import { OpenAPIHandlerCodecOptions } from '../standard/index.js';
|
|
5
5
|
import '@orpc/client';
|
|
6
6
|
import '@orpc/shared';
|
|
7
|
-
import '@
|
|
7
|
+
import '@standard-server/core';
|
|
8
8
|
import '@orpc/contract';
|
|
9
|
-
import '../../shared/openapi.
|
|
9
|
+
import '../../shared/openapi.DXWj9fY8.js';
|
|
10
10
|
|
|
11
11
|
interface OpenAPIHandlerOptions<T extends Context> extends AwsLambdaHandlerOptions<T>, Omit<StandardHandlerOptions<T>, 'plugins'>, OpenAPIHandlerCodecOptions<T> {
|
|
12
12
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { AwsLambdaHandler } from '@orpc/server/aws-lambda';
|
|
2
2
|
import { StandardHandler } from '@orpc/server/standard';
|
|
3
|
-
import { O as OpenAPIHandlerCodec } from '../../shared/openapi.
|
|
3
|
+
import { O as OpenAPIHandlerCodec } from '../../shared/openapi.Dxn8HAW0.mjs';
|
|
4
4
|
import '@orpc/client';
|
|
5
5
|
import '@orpc/server';
|
|
6
6
|
import '@orpc/shared';
|
|
7
|
-
import '@
|
|
8
|
-
import '../../shared/openapi.
|
|
7
|
+
import '@standard-server/core';
|
|
8
|
+
import '../../shared/openapi.Cz2PauNH.mjs';
|
|
9
9
|
import '../../shared/openapi.s_p5sN-P.mjs';
|
|
10
10
|
import '../../shared/openapi.B9PQzqBn.mjs';
|
|
11
11
|
import 'rou3';
|
|
@@ -4,9 +4,9 @@ import { StandardHandlerOptions } from '@orpc/server/standard';
|
|
|
4
4
|
import { OpenAPIHandlerCodecOptions } from '../standard/index.mjs';
|
|
5
5
|
import '@orpc/client';
|
|
6
6
|
import '@orpc/shared';
|
|
7
|
-
import '@
|
|
7
|
+
import '@standard-server/core';
|
|
8
8
|
import '@orpc/contract';
|
|
9
|
-
import '../../shared/openapi.
|
|
9
|
+
import '../../shared/openapi.DXWj9fY8.mjs';
|
|
10
10
|
|
|
11
11
|
interface OpenAPIHandlerOptions<T extends Context> extends FastifyHandlerOptions<T>, Omit<StandardHandlerOptions<T>, 'plugins'>, OpenAPIHandlerCodecOptions<T> {
|
|
12
12
|
}
|
|
@@ -4,9 +4,9 @@ import { StandardHandlerOptions } from '@orpc/server/standard';
|
|
|
4
4
|
import { OpenAPIHandlerCodecOptions } from '../standard/index.js';
|
|
5
5
|
import '@orpc/client';
|
|
6
6
|
import '@orpc/shared';
|
|
7
|
-
import '@
|
|
7
|
+
import '@standard-server/core';
|
|
8
8
|
import '@orpc/contract';
|
|
9
|
-
import '../../shared/openapi.
|
|
9
|
+
import '../../shared/openapi.DXWj9fY8.js';
|
|
10
10
|
|
|
11
11
|
interface OpenAPIHandlerOptions<T extends Context> extends FastifyHandlerOptions<T>, Omit<StandardHandlerOptions<T>, 'plugins'>, OpenAPIHandlerCodecOptions<T> {
|
|
12
12
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { FastifyHandler } from '@orpc/server/fastify';
|
|
2
2
|
import { StandardHandler } from '@orpc/server/standard';
|
|
3
|
-
import { O as OpenAPIHandlerCodec } from '../../shared/openapi.
|
|
3
|
+
import { O as OpenAPIHandlerCodec } from '../../shared/openapi.Dxn8HAW0.mjs';
|
|
4
4
|
import '@orpc/client';
|
|
5
5
|
import '@orpc/server';
|
|
6
6
|
import '@orpc/shared';
|
|
7
|
-
import '@
|
|
8
|
-
import '../../shared/openapi.
|
|
7
|
+
import '@standard-server/core';
|
|
8
|
+
import '../../shared/openapi.Cz2PauNH.mjs';
|
|
9
9
|
import '../../shared/openapi.s_p5sN-P.mjs';
|
|
10
10
|
import '../../shared/openapi.B9PQzqBn.mjs';
|
|
11
11
|
import 'rou3';
|
|
@@ -8,8 +8,8 @@ import { StandardLink, StandardLinkOptions } from '@orpc/client/standard';
|
|
|
8
8
|
import { RouterContract } from '@orpc/contract';
|
|
9
9
|
import { OpenAPILinkCodecOptions } from '../standard/index.mjs';
|
|
10
10
|
import '@orpc/shared';
|
|
11
|
-
import '@
|
|
12
|
-
import '../../shared/openapi.
|
|
11
|
+
import '@standard-server/core';
|
|
12
|
+
import '../../shared/openapi.DXWj9fY8.mjs';
|
|
13
13
|
|
|
14
14
|
interface OpenAPIHandlerOptions<T extends Context> extends FetchHandlerOptions<T>, Omit<StandardHandlerOptions<T>, 'plugins'>, OpenAPIHandlerCodecOptions<T> {
|
|
15
15
|
}
|
|
@@ -8,8 +8,8 @@ import { StandardLink, StandardLinkOptions } from '@orpc/client/standard';
|
|
|
8
8
|
import { RouterContract } from '@orpc/contract';
|
|
9
9
|
import { OpenAPILinkCodecOptions } from '../standard/index.js';
|
|
10
10
|
import '@orpc/shared';
|
|
11
|
-
import '@
|
|
12
|
-
import '../../shared/openapi.
|
|
11
|
+
import '@standard-server/core';
|
|
12
|
+
import '../../shared/openapi.DXWj9fY8.js';
|
|
13
13
|
|
|
14
14
|
interface OpenAPIHandlerOptions<T extends Context> extends FetchHandlerOptions<T>, Omit<StandardHandlerOptions<T>, 'plugins'>, OpenAPIHandlerCodecOptions<T> {
|
|
15
15
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { FetchHandler } from '@orpc/server/fetch';
|
|
2
2
|
import { StandardHandler } from '@orpc/server/standard';
|
|
3
|
-
import { O as OpenAPIHandlerCodec } from '../../shared/openapi.
|
|
3
|
+
import { O as OpenAPIHandlerCodec } from '../../shared/openapi.Dxn8HAW0.mjs';
|
|
4
4
|
import { FetchLinkTransport } from '@orpc/client/fetch';
|
|
5
5
|
import { StandardLink } from '@orpc/client/standard';
|
|
6
|
-
import { O as OpenAPILinkCodec } from '../../shared/openapi.
|
|
6
|
+
import { O as OpenAPILinkCodec } from '../../shared/openapi.0Vlm07ar.mjs';
|
|
7
7
|
import '@orpc/client';
|
|
8
8
|
import '@orpc/server';
|
|
9
9
|
import '@orpc/shared';
|
|
10
|
-
import '@
|
|
11
|
-
import '../../shared/openapi.
|
|
10
|
+
import '@standard-server/core';
|
|
11
|
+
import '../../shared/openapi.Cz2PauNH.mjs';
|
|
12
12
|
import '../../shared/openapi.s_p5sN-P.mjs';
|
|
13
13
|
import '../../shared/openapi.B9PQzqBn.mjs';
|
|
14
14
|
import 'rou3';
|
|
15
15
|
import '@orpc/contract';
|
|
16
|
-
import '@
|
|
16
|
+
import '@standard-server/fetch';
|
|
17
17
|
|
|
18
18
|
class OpenAPIHandler extends FetchHandler {
|
|
19
19
|
constructor(router, options = {}) {
|
|
@@ -4,9 +4,9 @@ import { StandardHandlerOptions } from '@orpc/server/standard';
|
|
|
4
4
|
import { OpenAPIHandlerCodecOptions } from '../standard/index.mjs';
|
|
5
5
|
import '@orpc/client';
|
|
6
6
|
import '@orpc/shared';
|
|
7
|
-
import '@
|
|
7
|
+
import '@standard-server/core';
|
|
8
8
|
import '@orpc/contract';
|
|
9
|
-
import '../../shared/openapi.
|
|
9
|
+
import '../../shared/openapi.DXWj9fY8.mjs';
|
|
10
10
|
|
|
11
11
|
interface OpenAPIHandlerOptions<T extends Context> extends NodeHttpHandlerOptions<T>, Omit<StandardHandlerOptions<T>, 'plugins'>, OpenAPIHandlerCodecOptions<T> {
|
|
12
12
|
}
|
|
@@ -4,9 +4,9 @@ import { StandardHandlerOptions } from '@orpc/server/standard';
|
|
|
4
4
|
import { OpenAPIHandlerCodecOptions } from '../standard/index.js';
|
|
5
5
|
import '@orpc/client';
|
|
6
6
|
import '@orpc/shared';
|
|
7
|
-
import '@
|
|
7
|
+
import '@standard-server/core';
|
|
8
8
|
import '@orpc/contract';
|
|
9
|
-
import '../../shared/openapi.
|
|
9
|
+
import '../../shared/openapi.DXWj9fY8.js';
|
|
10
10
|
|
|
11
11
|
interface OpenAPIHandlerOptions<T extends Context> extends NodeHttpHandlerOptions<T>, Omit<StandardHandlerOptions<T>, 'plugins'>, OpenAPIHandlerCodecOptions<T> {
|
|
12
12
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { NodeHttpHandler } from '@orpc/server/node';
|
|
2
2
|
import { StandardHandler } from '@orpc/server/standard';
|
|
3
|
-
import { O as OpenAPIHandlerCodec } from '../../shared/openapi.
|
|
3
|
+
import { O as OpenAPIHandlerCodec } from '../../shared/openapi.Dxn8HAW0.mjs';
|
|
4
4
|
import '@orpc/client';
|
|
5
5
|
import '@orpc/server';
|
|
6
6
|
import '@orpc/shared';
|
|
7
|
-
import '@
|
|
8
|
-
import '../../shared/openapi.
|
|
7
|
+
import '@standard-server/core';
|
|
8
|
+
import '../../shared/openapi.Cz2PauNH.mjs';
|
|
9
9
|
import '../../shared/openapi.s_p5sN-P.mjs';
|
|
10
10
|
import '../../shared/openapi.B9PQzqBn.mjs';
|
|
11
11
|
import 'rou3';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { a as OpenAPIHandlerCodec, b as OpenAPIHandlerCodecCore, c as OpenAPIHandlerCodecCoreOptions, O as OpenAPIHandlerCodecOptions, d as OpenAPIMatcher, e as OpenAPIMatcherOptions } from '../../shared/openapi.
|
|
2
|
-
export { a as OpenAPILinkCodec, O as OpenAPILinkCodecOptions } from '../../shared/openapi.
|
|
3
|
-
import { StandardHeaders } from '@
|
|
1
|
+
export { a as OpenAPIHandlerCodec, b as OpenAPIHandlerCodecCore, c as OpenAPIHandlerCodecCoreOptions, O as OpenAPIHandlerCodecOptions, d as OpenAPIMatcher, e as OpenAPIMatcherOptions } from '../../shared/openapi.BO2OB-Y9.mjs';
|
|
2
|
+
export { a as OpenAPILinkCodec, O as OpenAPILinkCodecOptions } from '../../shared/openapi.D3yXvICd.mjs';
|
|
3
|
+
import { StandardHeaders } from '@standard-server/core';
|
|
4
4
|
import { OpenAPISerializer } from '../../index.mjs';
|
|
5
5
|
import '@orpc/client';
|
|
6
6
|
import '@orpc/server';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { a as OpenAPIHandlerCodec, b as OpenAPIHandlerCodecCore, c as OpenAPIHandlerCodecCoreOptions, O as OpenAPIHandlerCodecOptions, d as OpenAPIMatcher, e as OpenAPIMatcherOptions } from '../../shared/openapi.
|
|
2
|
-
export { a as OpenAPILinkCodec, O as OpenAPILinkCodecOptions } from '../../shared/openapi.
|
|
3
|
-
import { StandardHeaders } from '@
|
|
1
|
+
export { a as OpenAPIHandlerCodec, b as OpenAPIHandlerCodecCore, c as OpenAPIHandlerCodecCoreOptions, O as OpenAPIHandlerCodecOptions, d as OpenAPIMatcher, e as OpenAPIMatcherOptions } from '../../shared/openapi.DsnjJWwQ.js';
|
|
2
|
+
export { a as OpenAPILinkCodec, O as OpenAPILinkCodecOptions } from '../../shared/openapi.DOy27J9v.js';
|
|
3
|
+
import { StandardHeaders } from '@standard-server/core';
|
|
4
4
|
import { OpenAPISerializer } from '../../index.js';
|
|
5
5
|
import '@orpc/client';
|
|
6
6
|
import '@orpc/server';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { O as OpenAPIHandlerCodec, a as OpenAPIHandlerCodecCore, b as OpenAPIMatcher, s as serializeHeaders } from '../../shared/openapi.
|
|
2
|
-
export { O as OpenAPILinkCodec } from '../../shared/openapi.
|
|
1
|
+
export { O as OpenAPIHandlerCodec, a as OpenAPIHandlerCodecCore, b as OpenAPIMatcher, s as serializeHeaders } from '../../shared/openapi.Dxn8HAW0.mjs';
|
|
2
|
+
export { O as OpenAPILinkCodec } from '../../shared/openapi.0Vlm07ar.mjs';
|
|
3
3
|
import '@orpc/client';
|
|
4
4
|
import '@orpc/server';
|
|
5
5
|
import '@orpc/shared';
|
|
6
|
-
import '@
|
|
7
|
-
import '../../shared/openapi.
|
|
6
|
+
import '@standard-server/core';
|
|
7
|
+
import '../../shared/openapi.Cz2PauNH.mjs';
|
|
8
8
|
import '../../shared/openapi.s_p5sN-P.mjs';
|
|
9
9
|
import '../../shared/openapi.B9PQzqBn.mjs';
|
|
10
10
|
import 'rou3';
|
|
11
11
|
import '@orpc/contract';
|
|
12
|
-
import '@
|
|
12
|
+
import '@standard-server/fetch';
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { AnyORPCError } from '@orpc/client';
|
|
2
1
|
import { ErrorMap, AnySchema } from '@orpc/contract';
|
|
3
2
|
import { Context } from '@orpc/server';
|
|
4
3
|
import { OpenAPIMeta } from '../index.mjs';
|
|
5
4
|
import '@orpc/shared';
|
|
6
|
-
import '@
|
|
7
|
-
import '
|
|
8
|
-
import '@hey-api/spec-types';
|
|
5
|
+
import '@standard-server/core';
|
|
6
|
+
import '@openapi-spec/types';
|
|
9
7
|
|
|
10
8
|
declare module '@orpc/contract' {
|
|
11
9
|
interface ContractBuilder<TErrorMap extends ErrorMap> {
|
|
@@ -37,7 +35,7 @@ declare module '@orpc/server' {
|
|
|
37
35
|
interface BuilderWithInputOutput<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> {
|
|
38
36
|
route(meta: OpenAPIMeta): BuilderWithInputOutput<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap>;
|
|
39
37
|
}
|
|
40
|
-
interface DecoratedProcedure<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap
|
|
41
|
-
route(meta: OpenAPIMeta): DecoratedProcedure<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap
|
|
38
|
+
interface DecoratedProcedure<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> {
|
|
39
|
+
route(meta: OpenAPIMeta): DecoratedProcedure<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap>;
|
|
42
40
|
}
|
|
43
41
|
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { AnyORPCError } from '@orpc/client';
|
|
2
1
|
import { ErrorMap, AnySchema } from '@orpc/contract';
|
|
3
2
|
import { Context } from '@orpc/server';
|
|
4
3
|
import { OpenAPIMeta } from '../index.js';
|
|
5
4
|
import '@orpc/shared';
|
|
6
|
-
import '@
|
|
7
|
-
import '
|
|
8
|
-
import '@hey-api/spec-types';
|
|
5
|
+
import '@standard-server/core';
|
|
6
|
+
import '@openapi-spec/types';
|
|
9
7
|
|
|
10
8
|
declare module '@orpc/contract' {
|
|
11
9
|
interface ContractBuilder<TErrorMap extends ErrorMap> {
|
|
@@ -37,7 +35,7 @@ declare module '@orpc/server' {
|
|
|
37
35
|
interface BuilderWithInputOutput<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> {
|
|
38
36
|
route(meta: OpenAPIMeta): BuilderWithInputOutput<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap>;
|
|
39
37
|
}
|
|
40
|
-
interface DecoratedProcedure<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap
|
|
41
|
-
route(meta: OpenAPIMeta): DecoratedProcedure<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap
|
|
38
|
+
interface DecoratedProcedure<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> {
|
|
39
|
+
route(meta: OpenAPIMeta): DecoratedProcedure<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap>;
|
|
42
40
|
}
|
|
43
41
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { O as OpenAPISerializer } from './shared/openapi.
|
|
2
|
-
export { B as BracketNotationSerializeResult, a as BracketNotationSerializer, b as BracketNotationSerializerOptions, c as OpenAPIJsonSerialization, d as OpenAPIJsonSerializer, e as OpenAPIJsonSerializerHandler, f as OpenAPIJsonSerializerOptions, g as OpenAPISerializerOptions, h as OpenAPISerializerSerializeOptions } from './shared/openapi.
|
|
1
|
+
import { O as OpenAPISerializer } from './shared/openapi.DXWj9fY8.mjs';
|
|
2
|
+
export { B as BracketNotationSerializeResult, a as BracketNotationSerializer, b as BracketNotationSerializerOptions, c as OpenAPIJsonSerialization, d as OpenAPIJsonSerializer, e as OpenAPIJsonSerializerHandler, f as OpenAPIJsonSerializerOptions, g as OpenAPISerializerOptions, h as OpenAPISerializerSerializeOptions } from './shared/openapi.DXWj9fY8.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, O as OpenAPIDocument } from './shared/openapi.
|
|
7
|
-
export {
|
|
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.
|
|
6
|
+
import { J as JsonifiedClient, O as OpenAPIVersion, a as OpenAPIDocument } from './shared/openapi.CXSHZ431.mjs';
|
|
7
|
+
export { b as JsonifiedArray, c as JsonifiedClientError, d as JsonifiedValue } from './shared/openapi.CXSHZ431.mjs';
|
|
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.Cem81Zhm.mjs';
|
|
9
9
|
import { JsonSchema, JsonSchemaConverter } from '@orpc/json-schema';
|
|
10
10
|
import { AnyRouter, AnyProcedure } from '@orpc/server';
|
|
11
|
-
import { Value } from '@orpc/shared';
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
import { Public, Value } from '@orpc/shared';
|
|
12
|
+
import { OpenAPIV3_2 } from '@openapi-spec/types';
|
|
13
|
+
export { OpenAPIV3_0, OpenAPIV3_1, OpenAPIV3_2 } from '@openapi-spec/types';
|
|
14
|
+
export { StandardBodyHint } from '@standard-server/core';
|
|
14
15
|
|
|
15
16
|
interface ContractJsonifiedClientFactory<TClientContext extends ClientContext> {
|
|
16
17
|
<T extends RouterContract>(contract: T): JsonifiedClient<RouterContractClient<T, TClientContext>>;
|
|
@@ -59,10 +60,23 @@ interface OpenAPIGeneratorOptions {
|
|
|
59
60
|
/**
|
|
60
61
|
* The serializer used to serialize the generated OpenAPI documentation
|
|
61
62
|
*/
|
|
62
|
-
serializer?:
|
|
63
|
+
serializer?: Public<OpenAPISerializer> | undefined;
|
|
63
64
|
}
|
|
64
|
-
interface OpenAPIGeneratorGenerateOptions {
|
|
65
|
-
|
|
65
|
+
interface OpenAPIGeneratorGenerateOptions<TVersion extends OpenAPIVersion> {
|
|
66
|
+
/**
|
|
67
|
+
* The OpenAPI version of the generated document.
|
|
68
|
+
* The document is generated as OpenAPI 3.2 and downgraded when an older version is requested.
|
|
69
|
+
* The minor version selects the conversion, the document carries the exact value, such as `3.1.0`.
|
|
70
|
+
*
|
|
71
|
+
* @default '3.2.0'
|
|
72
|
+
*/
|
|
73
|
+
version?: TVersion | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* OpenAPI 3.2 document fields to start from, such as `info`, `servers`, or `components`.
|
|
76
|
+
* They are downgraded with the rest of the document when an older `version` is requested.
|
|
77
|
+
* The `openapi` field is derived from `version`.
|
|
78
|
+
*/
|
|
79
|
+
base?: Partial<Omit<OpenAPIV3_2.OpenAPIObject, 'openapi'>> | undefined;
|
|
66
80
|
/**
|
|
67
81
|
* Root-level `$defs` are always moved into `components.schemas`.
|
|
68
82
|
* Use this to customize the component name of a hoisted def.
|
|
@@ -87,6 +101,7 @@ interface OpenAPIGeneratorGenerateOptions {
|
|
|
87
101
|
*
|
|
88
102
|
* @remarks
|
|
89
103
|
* - Return `null | undefined` to use the default error response body shaper.
|
|
104
|
+
* - The schema is an OpenAPI 3.2 Schema Object, it is downgraded with the rest of the document when an older `version` is requested.
|
|
90
105
|
*/
|
|
91
106
|
customErrorResponseBodySchema?: Value<JsonSchema | undefined | null, [
|
|
92
107
|
definedErrors: OpenAPIErrorBodyDefinition[],
|
|
@@ -109,7 +124,7 @@ declare class OpenAPIGenerator {
|
|
|
109
124
|
private readonly serializer;
|
|
110
125
|
private readonly converter;
|
|
111
126
|
constructor(options?: OpenAPIGeneratorOptions);
|
|
112
|
-
generate(router: RouterContract | AnyRouter, options?: OpenAPIGeneratorGenerateOptions): Promise<OpenAPIDocument
|
|
127
|
+
generate<TVersion extends OpenAPIVersion = '3.2.0'>(router: RouterContract | AnyRouter, options?: OpenAPIGeneratorGenerateOptions<TVersion>): Promise<OpenAPIDocument<TVersion>>;
|
|
113
128
|
private convertSchema;
|
|
114
129
|
private convertSchemas;
|
|
115
130
|
}
|
|
@@ -133,5 +148,5 @@ interface PopulateRouterContractOpenAPIPathsOptions {
|
|
|
133
148
|
*/
|
|
134
149
|
declare function populateRouterContractOpenAPIPaths<T extends RouterContract>(router: T, options?: PopulateRouterContractOpenAPIPathsOptions): PopulatedContractRouterOpenAPIPaths<T>;
|
|
135
150
|
|
|
136
|
-
export { DEFAULT_OPENAPI_INPUT_STRUCTURE, DEFAULT_OPENAPI_METHOD, DEFAULT_OPENAPI_OUTPUT_STRUCTURE, DEFAULT_OPENAPI_SUCCESS_DESCRIPTION, JsonifiedClient, OpenAPIDocument, OpenAPIGenerator, OpenAPIGeneratorError, OpenAPISerializer, createContractJsonifiedClientFactory, getDynamicPathParams, isBodylessMethod, populateRouterContractOpenAPIPaths };
|
|
151
|
+
export { DEFAULT_OPENAPI_INPUT_STRUCTURE, DEFAULT_OPENAPI_METHOD, DEFAULT_OPENAPI_OUTPUT_STRUCTURE, DEFAULT_OPENAPI_SUCCESS_DESCRIPTION, JsonifiedClient, OpenAPIDocument, OpenAPIGenerator, OpenAPIGeneratorError, OpenAPISerializer, OpenAPIVersion, createContractJsonifiedClientFactory, getDynamicPathParams, isBodylessMethod, populateRouterContractOpenAPIPaths };
|
|
137
152
|
export type { ContractJsonifiedClientFactory, ContractJsonifiedClientFactoryOptions, OpenAPIErrorBodyDefinition, OpenAPIGeneratorGenerateOptions, OpenAPIGeneratorOptions, PopulateRouterContractOpenAPIPathsOptions, PopulatedContractRouterOpenAPIPaths };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { O as OpenAPISerializer } from './shared/openapi.
|
|
2
|
-
export { B as BracketNotationSerializeResult, a as BracketNotationSerializer, b as BracketNotationSerializerOptions, c as OpenAPIJsonSerialization, d as OpenAPIJsonSerializer, e as OpenAPIJsonSerializerHandler, f as OpenAPIJsonSerializerOptions, g as OpenAPISerializerOptions, h as OpenAPISerializerSerializeOptions } from './shared/openapi.
|
|
1
|
+
import { O as OpenAPISerializer } from './shared/openapi.DXWj9fY8.js';
|
|
2
|
+
export { B as BracketNotationSerializeResult, a as BracketNotationSerializer, b as BracketNotationSerializerOptions, c as OpenAPIJsonSerialization, d as OpenAPIJsonSerializer, e as OpenAPIJsonSerializerHandler, f as OpenAPIJsonSerializerOptions, g as OpenAPISerializerOptions, h as OpenAPISerializerSerializeOptions } from './shared/openapi.DXWj9fY8.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, O as OpenAPIDocument } from './shared/openapi.
|
|
7
|
-
export {
|
|
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.
|
|
6
|
+
import { J as JsonifiedClient, O as OpenAPIVersion, a as OpenAPIDocument } from './shared/openapi.CXSHZ431.js';
|
|
7
|
+
export { b as JsonifiedArray, c as JsonifiedClientError, d as JsonifiedValue } from './shared/openapi.CXSHZ431.js';
|
|
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.Cem81Zhm.js';
|
|
9
9
|
import { JsonSchema, JsonSchemaConverter } from '@orpc/json-schema';
|
|
10
10
|
import { AnyRouter, AnyProcedure } from '@orpc/server';
|
|
11
|
-
import { Value } from '@orpc/shared';
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
import { Public, Value } from '@orpc/shared';
|
|
12
|
+
import { OpenAPIV3_2 } from '@openapi-spec/types';
|
|
13
|
+
export { OpenAPIV3_0, OpenAPIV3_1, OpenAPIV3_2 } from '@openapi-spec/types';
|
|
14
|
+
export { StandardBodyHint } from '@standard-server/core';
|
|
14
15
|
|
|
15
16
|
interface ContractJsonifiedClientFactory<TClientContext extends ClientContext> {
|
|
16
17
|
<T extends RouterContract>(contract: T): JsonifiedClient<RouterContractClient<T, TClientContext>>;
|
|
@@ -59,10 +60,23 @@ interface OpenAPIGeneratorOptions {
|
|
|
59
60
|
/**
|
|
60
61
|
* The serializer used to serialize the generated OpenAPI documentation
|
|
61
62
|
*/
|
|
62
|
-
serializer?:
|
|
63
|
+
serializer?: Public<OpenAPISerializer> | undefined;
|
|
63
64
|
}
|
|
64
|
-
interface OpenAPIGeneratorGenerateOptions {
|
|
65
|
-
|
|
65
|
+
interface OpenAPIGeneratorGenerateOptions<TVersion extends OpenAPIVersion> {
|
|
66
|
+
/**
|
|
67
|
+
* The OpenAPI version of the generated document.
|
|
68
|
+
* The document is generated as OpenAPI 3.2 and downgraded when an older version is requested.
|
|
69
|
+
* The minor version selects the conversion, the document carries the exact value, such as `3.1.0`.
|
|
70
|
+
*
|
|
71
|
+
* @default '3.2.0'
|
|
72
|
+
*/
|
|
73
|
+
version?: TVersion | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* OpenAPI 3.2 document fields to start from, such as `info`, `servers`, or `components`.
|
|
76
|
+
* They are downgraded with the rest of the document when an older `version` is requested.
|
|
77
|
+
* The `openapi` field is derived from `version`.
|
|
78
|
+
*/
|
|
79
|
+
base?: Partial<Omit<OpenAPIV3_2.OpenAPIObject, 'openapi'>> | undefined;
|
|
66
80
|
/**
|
|
67
81
|
* Root-level `$defs` are always moved into `components.schemas`.
|
|
68
82
|
* Use this to customize the component name of a hoisted def.
|
|
@@ -87,6 +101,7 @@ interface OpenAPIGeneratorGenerateOptions {
|
|
|
87
101
|
*
|
|
88
102
|
* @remarks
|
|
89
103
|
* - Return `null | undefined` to use the default error response body shaper.
|
|
104
|
+
* - The schema is an OpenAPI 3.2 Schema Object, it is downgraded with the rest of the document when an older `version` is requested.
|
|
90
105
|
*/
|
|
91
106
|
customErrorResponseBodySchema?: Value<JsonSchema | undefined | null, [
|
|
92
107
|
definedErrors: OpenAPIErrorBodyDefinition[],
|
|
@@ -109,7 +124,7 @@ declare class OpenAPIGenerator {
|
|
|
109
124
|
private readonly serializer;
|
|
110
125
|
private readonly converter;
|
|
111
126
|
constructor(options?: OpenAPIGeneratorOptions);
|
|
112
|
-
generate(router: RouterContract | AnyRouter, options?: OpenAPIGeneratorGenerateOptions): Promise<OpenAPIDocument
|
|
127
|
+
generate<TVersion extends OpenAPIVersion = '3.2.0'>(router: RouterContract | AnyRouter, options?: OpenAPIGeneratorGenerateOptions<TVersion>): Promise<OpenAPIDocument<TVersion>>;
|
|
113
128
|
private convertSchema;
|
|
114
129
|
private convertSchemas;
|
|
115
130
|
}
|
|
@@ -133,5 +148,5 @@ interface PopulateRouterContractOpenAPIPathsOptions {
|
|
|
133
148
|
*/
|
|
134
149
|
declare function populateRouterContractOpenAPIPaths<T extends RouterContract>(router: T, options?: PopulateRouterContractOpenAPIPathsOptions): PopulatedContractRouterOpenAPIPaths<T>;
|
|
135
150
|
|
|
136
|
-
export { DEFAULT_OPENAPI_INPUT_STRUCTURE, DEFAULT_OPENAPI_METHOD, DEFAULT_OPENAPI_OUTPUT_STRUCTURE, DEFAULT_OPENAPI_SUCCESS_DESCRIPTION, JsonifiedClient, OpenAPIDocument, OpenAPIGenerator, OpenAPIGeneratorError, OpenAPISerializer, createContractJsonifiedClientFactory, getDynamicPathParams, isBodylessMethod, populateRouterContractOpenAPIPaths };
|
|
151
|
+
export { DEFAULT_OPENAPI_INPUT_STRUCTURE, DEFAULT_OPENAPI_METHOD, DEFAULT_OPENAPI_OUTPUT_STRUCTURE, DEFAULT_OPENAPI_SUCCESS_DESCRIPTION, JsonifiedClient, OpenAPIDocument, OpenAPIGenerator, OpenAPIGeneratorError, OpenAPISerializer, OpenAPIVersion, createContractJsonifiedClientFactory, getDynamicPathParams, isBodylessMethod, populateRouterContractOpenAPIPaths };
|
|
137
152
|
export type { ContractJsonifiedClientFactory, ContractJsonifiedClientFactoryOptions, OpenAPIErrorBodyDefinition, OpenAPIGeneratorGenerateOptions, OpenAPIGeneratorOptions, PopulateRouterContractOpenAPIPathsOptions, PopulatedContractRouterOpenAPIPaths };
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
export { B as BracketNotationSerializer } from './shared/openapi.s_p5sN-P.mjs';
|
|
2
2
|
import { createContractClientFactory, getAsyncIteratorObjectSchemaDetails, ProcedureContract, resolveMetaPlugins } from '@orpc/contract';
|
|
3
|
-
import { D as DEFAULT_OPENAPI_METHOD, a as DEFAULT_OPENAPI_INPUT_STRUCTURE, c as DEFAULT_OPENAPI_SUCCESS_DESCRIPTION, b as DEFAULT_OPENAPI_OUTPUT_STRUCTURE, i as isBodylessMethod, O as OpenAPISerializer, g as getDynamicPathParams } from './shared/openapi.
|
|
4
|
-
export { d as OpenAPIJsonSerializer } from './shared/openapi.
|
|
3
|
+
import { D as DEFAULT_OPENAPI_METHOD, a as DEFAULT_OPENAPI_INPUT_STRUCTURE, c as DEFAULT_OPENAPI_SUCCESS_DESCRIPTION, b as DEFAULT_OPENAPI_OUTPUT_STRUCTURE, i as isBodylessMethod, O as OpenAPISerializer, g as getDynamicPathParams } from './shared/openapi.Cz2PauNH.mjs';
|
|
4
|
+
export { d as OpenAPIJsonSerializer } from './shared/openapi.Cz2PauNH.mjs';
|
|
5
5
|
import { g as getOpenAPIMeta, o as openapi } from './shared/openapi.B9PQzqBn.mjs';
|
|
6
|
+
import { downgradeSpecV32ToV31, downgradeSpecV31ToV30 } from '@openapi-spec/downgrader';
|
|
6
7
|
import { COMMON_ERROR_STATUS_MAP } from '@orpc/client';
|
|
7
8
|
export { COMMON_ERROR_STATUS_MAP } from '@orpc/client';
|
|
8
9
|
import { encodeJsonPointerSegment, ensureJsonSchemaObject, mapJsonSchemaRefs, decodeJsonPointerSegment, isUnconstrainedSchema, combineJsonSchemasWithComposition, extractJsonObjectSchemaEntries, combineJsonObjectSchemaEntries, flattenJsonUnionSchema, isJsonPrimitiveSchema, matchArrayableJsonSchema, isJsonFileSchema, DelegatingJsonSchemaConverter, StandardJsonSchemaConverter } from '@orpc/json-schema';
|
|
9
10
|
import { DEFAULT_SUCCESS_STATUS, DEFAULT_ERROR_STATUS, walkProcedureContractsAsync } from '@orpc/server';
|
|
10
11
|
import { isDeepEqual, value, findDeepMatches, isPlainObject, stringifyJSON, toArray, clone, pathToHttpPath, mergeHttpPath, isTypescriptObject } from '@orpc/shared';
|
|
11
|
-
import '@
|
|
12
|
+
import '@standard-server/core';
|
|
12
13
|
|
|
13
14
|
function createContractJsonifiedClientFactory(link, options = {}) {
|
|
14
15
|
return createContractClientFactory(link, options);
|
|
@@ -418,6 +419,12 @@ function renderPathParameters(ctx, operation, dynamicParams, paramsEntries, para
|
|
|
418
419
|
Schema keys: ${paramsEntries.map(([n]) => n).join(", ") || "(none)"}`
|
|
419
420
|
);
|
|
420
421
|
}
|
|
422
|
+
if (entry[2]) {
|
|
423
|
+
throw new OpenAPIGeneratorError(
|
|
424
|
+
`dynamic param "${name}" is optional in the input schema.
|
|
425
|
+
OpenAPI requires path params to be required. Make "${name}" required.`
|
|
426
|
+
);
|
|
427
|
+
}
|
|
421
428
|
const style = paramsStyles?.[name];
|
|
422
429
|
const parameter = {
|
|
423
430
|
in: "path",
|
|
@@ -489,7 +496,7 @@ function buildSuccessResponse(ctx, operation, def, meta) {
|
|
|
489
496
|
const iteratorDetails = getAsyncIteratorObjectDetails(def.outputSchemas);
|
|
490
497
|
if (iteratorDetails) {
|
|
491
498
|
operation.responses ??= {};
|
|
492
|
-
operation.responses[status] = {
|
|
499
|
+
operation.responses[toResponseStatusKey(status)] = {
|
|
493
500
|
description,
|
|
494
501
|
content: toAsyncIteratorObjectContent(
|
|
495
502
|
ctx,
|
|
@@ -504,7 +511,7 @@ function buildSuccessResponse(ctx, operation, def, meta) {
|
|
|
504
511
|
const [schema] = ctx.convertSchemas(def.outputSchemas, "output");
|
|
505
512
|
if (isUnconstrainedSchema(schema) || outputStructure === "compact") {
|
|
506
513
|
operation.responses ??= {};
|
|
507
|
-
operation.responses[status] = {
|
|
514
|
+
operation.responses[toResponseStatusKey(status)] = {
|
|
508
515
|
description,
|
|
509
516
|
content: toBodyContent(ctx, "output", schema)
|
|
510
517
|
};
|
|
@@ -528,9 +535,12 @@ function buildSuccessResponse(ctx, operation, def, meta) {
|
|
|
528
535
|
});
|
|
529
536
|
}
|
|
530
537
|
operation.responses ??= {};
|
|
531
|
-
operation.responses[responseStatus] = responseObject;
|
|
538
|
+
operation.responses[toResponseStatusKey(responseStatus)] = responseObject;
|
|
532
539
|
}
|
|
533
540
|
}
|
|
541
|
+
function toResponseStatusKey(status) {
|
|
542
|
+
return String(status);
|
|
543
|
+
}
|
|
534
544
|
function extractDetailedResponseParts(schema, defaultStatus) {
|
|
535
545
|
const partsByStatus = /* @__PURE__ */ new Map();
|
|
536
546
|
for (const item of flattenJsonUnionSchema(schema)) {
|
|
@@ -589,16 +599,16 @@ function buildErrorResponse(ctx, operation, def) {
|
|
|
589
599
|
return;
|
|
590
600
|
}
|
|
591
601
|
const undefinedErrorSchema = ctx.registry.register("UndefinedError", {
|
|
602
|
+
title: "UndefinedError",
|
|
592
603
|
type: "object",
|
|
593
604
|
properties: {
|
|
594
605
|
defined: { const: false },
|
|
595
|
-
inferable: { type: "boolean" },
|
|
596
606
|
code: { type: "string" },
|
|
597
607
|
status: { type: "number" },
|
|
598
608
|
message: { type: "string" },
|
|
599
609
|
data: {}
|
|
600
610
|
},
|
|
601
|
-
required: ["defined", "
|
|
611
|
+
required: ["defined", "code", "status", "message"]
|
|
602
612
|
});
|
|
603
613
|
for (const [status, definitions] of definitionsByStatus.entries()) {
|
|
604
614
|
const descriptions = definitions.map(({ defaultMessage }) => defaultMessage).filter((m) => m !== void 0);
|
|
@@ -609,20 +619,22 @@ function buildErrorResponse(ctx, operation, def) {
|
|
|
609
619
|
);
|
|
610
620
|
const responseSchema = customBodySchema ?? combineJsonSchemasWithComposition("oneOf", [
|
|
611
621
|
...definitions.map(({ code, dataJsonSchema, dataOptional }) => {
|
|
612
|
-
return ctx.registry.register(toErrorComponentName(code),
|
|
613
|
-
|
|
614
|
-
[
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
622
|
+
return ctx.registry.register(toErrorComponentName(code), {
|
|
623
|
+
title: code,
|
|
624
|
+
...combineJsonObjectSchemaEntries([
|
|
625
|
+
["defined", { const: true }, false],
|
|
626
|
+
["code", { const: code }, false],
|
|
627
|
+
["status", { const: status }, false],
|
|
628
|
+
// avoid using the defaultMessage here to improve component reusability
|
|
629
|
+
["message", { type: "string" }, false],
|
|
630
|
+
["data", ctx.registry.hoistDefs(dataJsonSchema, "output"), dataOptional]
|
|
631
|
+
])
|
|
632
|
+
});
|
|
621
633
|
}),
|
|
622
634
|
undefinedErrorSchema
|
|
623
635
|
]);
|
|
624
636
|
operation.responses ??= {};
|
|
625
|
-
operation.responses[status] = {
|
|
637
|
+
operation.responses[toResponseStatusKey(status)] = {
|
|
626
638
|
description: descriptions.length ? descriptions.join(", ") : status.toString(),
|
|
627
639
|
content: {
|
|
628
640
|
"application/json": {
|
|
@@ -736,9 +748,10 @@ class OpenAPIGenerator {
|
|
|
736
748
|
]);
|
|
737
749
|
}
|
|
738
750
|
async generate(router, options = {}) {
|
|
751
|
+
const version = options.version ?? "3.2.0";
|
|
739
752
|
const doc = {
|
|
740
753
|
...clone(options.base),
|
|
741
|
-
openapi:
|
|
754
|
+
openapi: "3.2.0",
|
|
742
755
|
info: options.base?.info ?? { title: "API Reference", version: "0.0.0" }
|
|
743
756
|
};
|
|
744
757
|
const ctx = {
|
|
@@ -756,9 +769,9 @@ class OpenAPIGenerator {
|
|
|
756
769
|
const def = contract["~orpc"];
|
|
757
770
|
const meta = getOpenAPIMeta(contract);
|
|
758
771
|
const method = (meta?.method ?? DEFAULT_OPENAPI_METHOD).toLowerCase();
|
|
759
|
-
if (method === "query" &&
|
|
772
|
+
if (method === "query" && !version.startsWith("3.2.")) {
|
|
760
773
|
throw new OpenAPIGeneratorError(
|
|
761
|
-
`QUERY operations require OpenAPI 3.2
|
|
774
|
+
`QUERY operations require OpenAPI 3.2, but version "${version}" was requested.`
|
|
762
775
|
);
|
|
763
776
|
}
|
|
764
777
|
const postPath = meta?.path ?? pathToHttpPath(path);
|
|
@@ -800,7 +813,8 @@ class OpenAPIGenerator {
|
|
|
800
813
|
${errors.join("\n\n")}`
|
|
801
814
|
);
|
|
802
815
|
}
|
|
803
|
-
|
|
816
|
+
const versioned = toVersionedOpenAPIDocument(doc, version);
|
|
817
|
+
return this.serializer.serialize(versioned, { asFormData: false, useFormDataForBlobFields: false });
|
|
804
818
|
}
|
|
805
819
|
convertSchema(schema, direction) {
|
|
806
820
|
const [jsonSchema, optional] = this.converter.convert(schema, direction);
|
|
@@ -817,6 +831,10 @@ ${errors.join("\n\n")}`
|
|
|
817
831
|
];
|
|
818
832
|
}
|
|
819
833
|
}
|
|
834
|
+
function toVersionedOpenAPIDocument(doc, version) {
|
|
835
|
+
const downgraded = version.startsWith("3.2.") ? doc : version.startsWith("3.1.") ? downgradeSpecV32ToV31(doc) : downgradeSpecV31ToV30(downgradeSpecV32ToV31(doc));
|
|
836
|
+
return { ...downgraded, openapi: version };
|
|
837
|
+
}
|
|
820
838
|
function strip$schemaField(schema) {
|
|
821
839
|
if (typeof schema !== "object") {
|
|
822
840
|
return schema;
|
package/dist/plugins/index.d.mts
CHANGED
|
@@ -2,10 +2,10 @@ import { Context } from '@orpc/server';
|
|
|
2
2
|
import { StandardHandlerPlugin, StandardHandlerRoutingInterceptorOptions, StandardHandlerOptions } from '@orpc/server/standard';
|
|
3
3
|
import { Value, Promisable } from '@orpc/shared';
|
|
4
4
|
import { ApiReferenceConfiguration } from '@scalar/api-reference';
|
|
5
|
-
import { StandardUrl } from '@
|
|
5
|
+
import { StandardUrl } from '@standard-server/core';
|
|
6
6
|
import { SwaggerUIOptions } from 'swagger-ui';
|
|
7
|
-
import { OpenAPIDocument } from '../index.mjs';
|
|
8
|
-
import '@
|
|
7
|
+
import { OpenAPIDocument, OpenAPIVersion } from '../index.mjs';
|
|
8
|
+
import '@openapi-spec/types';
|
|
9
9
|
import '@orpc/client';
|
|
10
10
|
|
|
11
11
|
type OpenAPIReferenceHandlerPluginProvider = 'scalar' | 'swagger';
|
|
@@ -21,7 +21,7 @@ interface OpenAPIReferenceHandlerPluginOptions<T extends Context, TProvider exte
|
|
|
21
21
|
* A static or dynamic OpenAPI document to serve.
|
|
22
22
|
* Receives routing interceptor options when provided as a function.
|
|
23
23
|
*/
|
|
24
|
-
spec: Value<Promisable<OpenAPIDocument
|
|
24
|
+
spec: Value<Promisable<OpenAPIDocument<OpenAPIVersion>>, [StandardHandlerRoutingInterceptorOptions<T>]>;
|
|
25
25
|
/**
|
|
26
26
|
* Determines whether the docs UI and OpenAPI JSON are allowed to be served for a request.
|
|
27
27
|
* When it resolves to `false`, the request falls through as unmatched,
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ import { Context } from '@orpc/server';
|
|
|
2
2
|
import { StandardHandlerPlugin, StandardHandlerRoutingInterceptorOptions, StandardHandlerOptions } from '@orpc/server/standard';
|
|
3
3
|
import { Value, Promisable } from '@orpc/shared';
|
|
4
4
|
import { ApiReferenceConfiguration } from '@scalar/api-reference';
|
|
5
|
-
import { StandardUrl } from '@
|
|
5
|
+
import { StandardUrl } from '@standard-server/core';
|
|
6
6
|
import { SwaggerUIOptions } from 'swagger-ui';
|
|
7
|
-
import { OpenAPIDocument } from '../index.js';
|
|
8
|
-
import '@
|
|
7
|
+
import { OpenAPIDocument, OpenAPIVersion } from '../index.js';
|
|
8
|
+
import '@openapi-spec/types';
|
|
9
9
|
import '@orpc/client';
|
|
10
10
|
|
|
11
11
|
type OpenAPIReferenceHandlerPluginProvider = 'scalar' | 'swagger';
|
|
@@ -21,7 +21,7 @@ interface OpenAPIReferenceHandlerPluginOptions<T extends Context, TProvider exte
|
|
|
21
21
|
* A static or dynamic OpenAPI document to serve.
|
|
22
22
|
* Receives routing interceptor options when provided as a function.
|
|
23
23
|
*/
|
|
24
|
-
spec: Value<Promisable<OpenAPIDocument
|
|
24
|
+
spec: Value<Promisable<OpenAPIDocument<OpenAPIVersion>>, [StandardHandlerRoutingInterceptorOptions<T>]>;
|
|
25
25
|
/**
|
|
26
26
|
* Determines whether the docs UI and OpenAPI JSON are allowed to be served for a request.
|
|
27
27
|
* When it resolves to `false`, the request falls through as unmatched,
|
package/dist/plugins/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toArray, matchesHttpPath, mergeHttpPath, value,
|
|
1
|
+
import { toArray, matchesHttpPath, mergeHttpPath, value, getTracer, stringifyJSON } from '@orpc/shared';
|
|
2
2
|
|
|
3
3
|
class OpenAPIReferenceHandlerPlugin {
|
|
4
4
|
name = "~openapi-reference";
|
|
@@ -49,7 +49,7 @@ class OpenAPIReferenceHandlerPlugin {
|
|
|
49
49
|
if (await value(this.allow, routingInterceptorOptions) === false) {
|
|
50
50
|
return result;
|
|
51
51
|
}
|
|
52
|
-
const span =
|
|
52
|
+
const span = getTracer()?.getActiveSpan();
|
|
53
53
|
const spec = await value(this.spec, routingInterceptorOptions);
|
|
54
54
|
if (isSpecPath) {
|
|
55
55
|
span?.updateName(`${routingInterceptorOptions.request.method} ${routingInterceptorOptions.request.url} (openapi spec)`);
|
|
@@ -2,11 +2,11 @@ import { createORPCErrorFromMalformedResponse, isORPCErrorJson, createORPCErrorF
|
|
|
2
2
|
import { getRouterContract, ProcedureContract } from '@orpc/contract';
|
|
3
3
|
import { unlazy } from '@orpc/server';
|
|
4
4
|
import { value, pathToHttpPath, mergeHttpPath, isTypescriptObject, stringifyJSON } from '@orpc/shared';
|
|
5
|
-
import { mergeStandardHeaders, parseStandardUrl } from '@
|
|
6
|
-
import { toStandardHeaders } from '@
|
|
7
|
-
import { O as OpenAPISerializer, D as DEFAULT_OPENAPI_METHOD, a as DEFAULT_OPENAPI_INPUT_STRUCTURE, g as getDynamicPathParams, i as isBodylessMethod, b as DEFAULT_OPENAPI_OUTPUT_STRUCTURE } from './openapi.
|
|
5
|
+
import { mergeStandardHeaders, parseStandardUrl } from '@standard-server/core';
|
|
6
|
+
import { toStandardHeaders } from '@standard-server/fetch';
|
|
7
|
+
import { O as OpenAPISerializer, D as DEFAULT_OPENAPI_METHOD, a as DEFAULT_OPENAPI_INPUT_STRUCTURE, g as getDynamicPathParams, i as isBodylessMethod, b as DEFAULT_OPENAPI_OUTPUT_STRUCTURE } from './openapi.Cz2PauNH.mjs';
|
|
8
8
|
import { g as getOpenAPIMeta } from './openapi.B9PQzqBn.mjs';
|
|
9
|
-
import { s as serializeHeaders } from './openapi.
|
|
9
|
+
import { s as serializeHeaders } from './openapi.Dxn8HAW0.mjs';
|
|
10
10
|
|
|
11
11
|
const END_SLASH_REGEX = /\/$/;
|
|
12
12
|
class OpenAPILinkCodec {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AnyORPCError } from '@orpc/client';
|
|
2
2
|
import { AnyProcedure, AnyRouter, Context } from '@orpc/server';
|
|
3
3
|
import { StandardHandlerCodec, StandardHandlerHandleOptions, StandardHandlerCodecResolvedProcedure } from '@orpc/server/standard';
|
|
4
|
-
import { Value, Promisable } from '@orpc/shared';
|
|
5
|
-
import { StandardLazyRequest, StandardResponse } from '@
|
|
4
|
+
import { Value, Public, Promisable } from '@orpc/shared';
|
|
5
|
+
import { StandardLazyRequest, StandardResponse } from '@standard-server/core';
|
|
6
6
|
import { AnyProcedureContract } from '@orpc/contract';
|
|
7
|
-
import { O as OpenAPISerializer } from './openapi.
|
|
7
|
+
import { O as OpenAPISerializer } from './openapi.DXWj9fY8.mjs';
|
|
8
8
|
|
|
9
9
|
interface OpenAPIMatcherOptions {
|
|
10
10
|
/**
|
|
@@ -37,7 +37,7 @@ interface OpenAPIHandlerCodecCoreOptions<_T extends Context> {
|
|
|
37
37
|
/**
|
|
38
38
|
* Override the default OpenAPI serializer.
|
|
39
39
|
*/
|
|
40
|
-
serializer?:
|
|
40
|
+
serializer?: Public<OpenAPISerializer>;
|
|
41
41
|
/**
|
|
42
42
|
* Mapping ORPCError Code -> HTTP Status Code
|
|
43
43
|
* The status code should be in the `4xx` or `5xx` range (must be greater than or equal to `400`).
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import { OpenAPIV3_1 } from '@
|
|
1
|
+
import { OpenAPIV3_0, OpenAPIV3_1, OpenAPIV3_2 } from '@openapi-spec/types';
|
|
2
2
|
import { AnyNestedClient, Client, ORPCError } from '@orpc/client';
|
|
3
3
|
import { AsyncIteratorClass } from '@orpc/shared';
|
|
4
4
|
|
|
5
|
-
type OpenAPIOperationObject = OpenAPIV3_1.OperationObject;
|
|
6
5
|
/**
|
|
7
|
-
* An OpenAPI
|
|
8
|
-
*
|
|
6
|
+
* An OpenAPI version `OpenAPIGenerator` can target: any `3.0.x`, `3.1.x`, or `3.2.x` value.
|
|
7
|
+
*
|
|
8
|
+
* @see {@link https://orpc.dev/docs/openapi/specification#openapi-version | OpenAPI Specification - OpenAPI Version}
|
|
9
9
|
*/
|
|
10
|
-
type
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
10
|
+
type OpenAPIVersion = `3.0.${number}` | `3.1.${number}` | `3.2.${number}`;
|
|
11
|
+
/**
|
|
12
|
+
* The OpenAPI document of the given version.
|
|
13
|
+
*
|
|
14
|
+
* @see {@link https://orpc.dev/docs/openapi/specification#openapi-version | OpenAPI Specification - OpenAPI Version}
|
|
15
|
+
*/
|
|
16
|
+
type OpenAPIDocument<TVersion extends OpenAPIVersion> = TVersion extends `3.0.${string}` ? OpenAPIV3_0.OpenAPIObject : TVersion extends `3.1.${string}` ? OpenAPIV3_1.OpenAPIObject : OpenAPIV3_2.OpenAPIObject;
|
|
18
17
|
type JsonifiedValue<T> = T extends string ? T : T extends number ? T : T extends boolean ? T : T extends null ? T : T extends undefined ? T : T extends Array<unknown> ? JsonifiedArray<T> : T extends Record<string, unknown> ? {
|
|
19
18
|
[K in keyof T]: JsonifiedValue<T[K]>;
|
|
20
19
|
} : T extends Date ? string : T extends bigint ? string : T extends File ? File : T extends Blob ? Blob : T extends RegExp ? string : T extends URL ? string : T extends Map<infer K, infer V> ? JsonifiedArray<[K, V][]> : T extends Set<infer U> ? JsonifiedArray<U[]> : T extends AsyncIteratorClass<infer U, infer V> ? AsyncIteratorClass<JsonifiedValue<U>, JsonifiedValue<V>> : T extends AsyncGenerator<infer U, infer V> ? AsyncGenerator<JsonifiedValue<U>, JsonifiedValue<V>> : T extends AsyncIteratorObject<infer U, infer V> ? AsyncIteratorObject<JsonifiedValue<U>, JsonifiedValue<V>> : unknown;
|
|
@@ -29,4 +28,4 @@ type JsonifiedClient<T extends AnyNestedClient> = T extends Client<infer UClient
|
|
|
29
28
|
[K in keyof T]: T[K] extends AnyNestedClient ? JsonifiedClient<T[K]> : T[K];
|
|
30
29
|
};
|
|
31
30
|
|
|
32
|
-
export type { JsonifiedClient as J,
|
|
31
|
+
export type { JsonifiedClient as J, OpenAPIVersion as O, OpenAPIDocument as a, JsonifiedArray as b, JsonifiedClientError as c, JsonifiedValue as d };
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import { OpenAPIV3_1 } from '@
|
|
1
|
+
import { OpenAPIV3_0, OpenAPIV3_1, OpenAPIV3_2 } from '@openapi-spec/types';
|
|
2
2
|
import { AnyNestedClient, Client, ORPCError } from '@orpc/client';
|
|
3
3
|
import { AsyncIteratorClass } from '@orpc/shared';
|
|
4
4
|
|
|
5
|
-
type OpenAPIOperationObject = OpenAPIV3_1.OperationObject;
|
|
6
5
|
/**
|
|
7
|
-
* An OpenAPI
|
|
8
|
-
*
|
|
6
|
+
* An OpenAPI version `OpenAPIGenerator` can target: any `3.0.x`, `3.1.x`, or `3.2.x` value.
|
|
7
|
+
*
|
|
8
|
+
* @see {@link https://orpc.dev/docs/openapi/specification#openapi-version | OpenAPI Specification - OpenAPI Version}
|
|
9
9
|
*/
|
|
10
|
-
type
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
10
|
+
type OpenAPIVersion = `3.0.${number}` | `3.1.${number}` | `3.2.${number}`;
|
|
11
|
+
/**
|
|
12
|
+
* The OpenAPI document of the given version.
|
|
13
|
+
*
|
|
14
|
+
* @see {@link https://orpc.dev/docs/openapi/specification#openapi-version | OpenAPI Specification - OpenAPI Version}
|
|
15
|
+
*/
|
|
16
|
+
type OpenAPIDocument<TVersion extends OpenAPIVersion> = TVersion extends `3.0.${string}` ? OpenAPIV3_0.OpenAPIObject : TVersion extends `3.1.${string}` ? OpenAPIV3_1.OpenAPIObject : OpenAPIV3_2.OpenAPIObject;
|
|
18
17
|
type JsonifiedValue<T> = T extends string ? T : T extends number ? T : T extends boolean ? T : T extends null ? T : T extends undefined ? T : T extends Array<unknown> ? JsonifiedArray<T> : T extends Record<string, unknown> ? {
|
|
19
18
|
[K in keyof T]: JsonifiedValue<T[K]>;
|
|
20
19
|
} : T extends Date ? string : T extends bigint ? string : T extends File ? File : T extends Blob ? Blob : T extends RegExp ? string : T extends URL ? string : T extends Map<infer K, infer V> ? JsonifiedArray<[K, V][]> : T extends Set<infer U> ? JsonifiedArray<U[]> : T extends AsyncIteratorClass<infer U, infer V> ? AsyncIteratorClass<JsonifiedValue<U>, JsonifiedValue<V>> : T extends AsyncGenerator<infer U, infer V> ? AsyncGenerator<JsonifiedValue<U>, JsonifiedValue<V>> : T extends AsyncIteratorObject<infer U, infer V> ? AsyncIteratorObject<JsonifiedValue<U>, JsonifiedValue<V>> : unknown;
|
|
@@ -29,4 +28,4 @@ type JsonifiedClient<T extends AnyNestedClient> = T extends Client<infer UClient
|
|
|
29
28
|
[K in keyof T]: T[K] extends AnyNestedClient ? JsonifiedClient<T[K]> : T[K];
|
|
30
29
|
};
|
|
31
30
|
|
|
32
|
-
export type { JsonifiedClient as J,
|
|
31
|
+
export type { JsonifiedClient as J, OpenAPIVersion as O, OpenAPIDocument as a, JsonifiedArray as b, JsonifiedClientError as c, JsonifiedValue as d };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AnySchema, ErrorMap, MetaPlugin, AnyProcedureContract } from '@orpc/contract';
|
|
2
2
|
import { Lazy } from '@orpc/server';
|
|
3
3
|
import { Value } from '@orpc/shared';
|
|
4
|
-
import { StandardBodyHint } from '@
|
|
5
|
-
import {
|
|
4
|
+
import { StandardBodyHint } from '@standard-server/core';
|
|
5
|
+
import { OpenAPIV3_2 } from '@openapi-spec/types';
|
|
6
6
|
|
|
7
7
|
interface OpenAPIMeta {
|
|
8
8
|
/**
|
|
@@ -267,6 +267,9 @@ interface OpenAPIMeta {
|
|
|
267
267
|
* Pass a plain object to replace entire operation object, or a function that receives the current
|
|
268
268
|
* operation object and returns the modified version.
|
|
269
269
|
*
|
|
270
|
+
* The operation object always follows OpenAPI 3.2, `OpenAPIGenerator` downgrades it with the
|
|
271
|
+
* rest of the document when an older version is requested.
|
|
272
|
+
*
|
|
270
273
|
* **Merging**: When defined multiple times:
|
|
271
274
|
*
|
|
272
275
|
* - Two functions are chained: the most recent function receives the result of the previous one.
|
|
@@ -275,7 +278,7 @@ interface OpenAPIMeta {
|
|
|
275
278
|
*
|
|
276
279
|
* Explicitly setting `undefined` resets the spec instead of merging.
|
|
277
280
|
*/
|
|
278
|
-
spec?: Value<
|
|
281
|
+
spec?: Value<OpenAPIV3_2.OperationObject, [current: OpenAPIV3_2.OperationObject]>;
|
|
279
282
|
/**
|
|
280
283
|
* Prefix for the path. Useful when you want to apply a common path prefix across multiple procedures.
|
|
281
284
|
*
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AnySchema, ErrorMap, MetaPlugin, AnyProcedureContract } from '@orpc/contract';
|
|
2
2
|
import { Lazy } from '@orpc/server';
|
|
3
3
|
import { Value } from '@orpc/shared';
|
|
4
|
-
import { StandardBodyHint } from '@
|
|
5
|
-
import {
|
|
4
|
+
import { StandardBodyHint } from '@standard-server/core';
|
|
5
|
+
import { OpenAPIV3_2 } from '@openapi-spec/types';
|
|
6
6
|
|
|
7
7
|
interface OpenAPIMeta {
|
|
8
8
|
/**
|
|
@@ -267,6 +267,9 @@ interface OpenAPIMeta {
|
|
|
267
267
|
* Pass a plain object to replace entire operation object, or a function that receives the current
|
|
268
268
|
* operation object and returns the modified version.
|
|
269
269
|
*
|
|
270
|
+
* The operation object always follows OpenAPI 3.2, `OpenAPIGenerator` downgrades it with the
|
|
271
|
+
* rest of the document when an older version is requested.
|
|
272
|
+
*
|
|
270
273
|
* **Merging**: When defined multiple times:
|
|
271
274
|
*
|
|
272
275
|
* - Two functions are chained: the most recent function receives the result of the previous one.
|
|
@@ -275,7 +278,7 @@ interface OpenAPIMeta {
|
|
|
275
278
|
*
|
|
276
279
|
* Explicitly setting `undefined` resets the spec instead of merging.
|
|
277
280
|
*/
|
|
278
|
-
spec?: Value<
|
|
281
|
+
spec?: Value<OpenAPIV3_2.OperationObject, [current: OpenAPIV3_2.OperationObject]>;
|
|
279
282
|
/**
|
|
280
283
|
* Prefix for the path. Useful when you want to apply a common path prefix across multiple procedures.
|
|
281
284
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { wrapAsyncIteratorPreservingEventMeta, toORPCError, isORPCErrorJson, createORPCErrorFromJson } from '@orpc/client';
|
|
2
2
|
import { isPlainObject, NullProtoObj, isAsyncIteratorObject } from '@orpc/shared';
|
|
3
|
-
import { ErrorEvent } from '@
|
|
3
|
+
import { ErrorEvent } from '@standard-server/core';
|
|
4
4
|
import { B as BracketNotationSerializer } from './openapi.s_p5sN-P.mjs';
|
|
5
5
|
|
|
6
6
|
const DEFAULT_OPENAPI_METHOD = "POST";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ClientContext, ClientOptions, AnyORPCError } from '@orpc/client';
|
|
2
2
|
import { StandardLinkCodec, StandardLinkCodecDecodedResponse } from '@orpc/client/standard';
|
|
3
3
|
import { RouterContract } from '@orpc/contract';
|
|
4
|
-
import { Value, Promisable } from '@orpc/shared';
|
|
5
|
-
import { StandardUrl, StandardHeaders, StandardLazyResponse, StandardRequest } from '@
|
|
6
|
-
import { O as OpenAPISerializer } from './openapi.
|
|
4
|
+
import { Value, Promisable, Public } from '@orpc/shared';
|
|
5
|
+
import { StandardUrl, StandardHeaders, StandardLazyResponse, StandardRequest } from '@standard-server/core';
|
|
6
|
+
import { O as OpenAPISerializer } from './openapi.DXWj9fY8.mjs';
|
|
7
7
|
|
|
8
8
|
interface OpenAPILinkCodecOptions<T extends ClientContext> {
|
|
9
9
|
/**
|
|
@@ -20,7 +20,7 @@ interface OpenAPILinkCodecOptions<T extends ClientContext> {
|
|
|
20
20
|
/**
|
|
21
21
|
* Override the default OpenAPI serializer.
|
|
22
22
|
*/
|
|
23
|
-
serializer?:
|
|
23
|
+
serializer?: Public<OpenAPISerializer>;
|
|
24
24
|
/**
|
|
25
25
|
* Customize how an error response body is converted into an ORPC error.
|
|
26
26
|
* Return `null` or `undefined` to fall back to the default decoding behavior.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ClientContext, ClientOptions, AnyORPCError } from '@orpc/client';
|
|
2
2
|
import { StandardLinkCodec, StandardLinkCodecDecodedResponse } from '@orpc/client/standard';
|
|
3
3
|
import { RouterContract } from '@orpc/contract';
|
|
4
|
-
import { Value, Promisable } from '@orpc/shared';
|
|
5
|
-
import { StandardUrl, StandardHeaders, StandardLazyResponse, StandardRequest } from '@
|
|
6
|
-
import { O as OpenAPISerializer } from './openapi.
|
|
4
|
+
import { Value, Promisable, Public } from '@orpc/shared';
|
|
5
|
+
import { StandardUrl, StandardHeaders, StandardLazyResponse, StandardRequest } from '@standard-server/core';
|
|
6
|
+
import { O as OpenAPISerializer } from './openapi.DXWj9fY8.js';
|
|
7
7
|
|
|
8
8
|
interface OpenAPILinkCodecOptions<T extends ClientContext> {
|
|
9
9
|
/**
|
|
@@ -20,7 +20,7 @@ interface OpenAPILinkCodecOptions<T extends ClientContext> {
|
|
|
20
20
|
/**
|
|
21
21
|
* Override the default OpenAPI serializer.
|
|
22
22
|
*/
|
|
23
|
-
serializer?:
|
|
23
|
+
serializer?: Public<OpenAPISerializer>;
|
|
24
24
|
/**
|
|
25
25
|
* Customize how an error response body is converted into an ORPC error.
|
|
26
26
|
* Return `null` or `undefined` to fall back to the default decoding behavior.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AnyORPCError } from '@orpc/client';
|
|
2
2
|
import { AnyProcedure, AnyRouter, Context } from '@orpc/server';
|
|
3
3
|
import { StandardHandlerCodec, StandardHandlerHandleOptions, StandardHandlerCodecResolvedProcedure } from '@orpc/server/standard';
|
|
4
|
-
import { Value, Promisable } from '@orpc/shared';
|
|
5
|
-
import { StandardLazyRequest, StandardResponse } from '@
|
|
4
|
+
import { Value, Public, Promisable } from '@orpc/shared';
|
|
5
|
+
import { StandardLazyRequest, StandardResponse } from '@standard-server/core';
|
|
6
6
|
import { AnyProcedureContract } from '@orpc/contract';
|
|
7
|
-
import { O as OpenAPISerializer } from './openapi.
|
|
7
|
+
import { O as OpenAPISerializer } from './openapi.DXWj9fY8.js';
|
|
8
8
|
|
|
9
9
|
interface OpenAPIMatcherOptions {
|
|
10
10
|
/**
|
|
@@ -37,7 +37,7 @@ interface OpenAPIHandlerCodecCoreOptions<_T extends Context> {
|
|
|
37
37
|
/**
|
|
38
38
|
* Override the default OpenAPI serializer.
|
|
39
39
|
*/
|
|
40
|
-
serializer?:
|
|
40
|
+
serializer?: Public<OpenAPISerializer>;
|
|
41
41
|
/**
|
|
42
42
|
* Mapping ORPCError Code -> HTTP Status Code
|
|
43
43
|
* The status code should be in the `4xx` or `5xx` range (must be greater than or equal to `400`).
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { COMMON_ERROR_STATUS_MAP } from '@orpc/client';
|
|
2
2
|
import { walkProcedureContractsSync, Procedure, unlazy, getRouter, createContractProcedure, DEFAULT_SUCCESS_STATUS, DEFAULT_ERROR_STATUS } from '@orpc/server';
|
|
3
3
|
import { value, pathToHttpPath, mergeHttpPath, normalizeHttpPath, tryDecodeURIComponent, NullProtoObj, isTypescriptObject, isPlainObject, stringifyJSON, getOwn, parseEmptyableJSON } from '@orpc/shared';
|
|
4
|
-
import { parseStandardUrl } from '@
|
|
5
|
-
import { D as DEFAULT_OPENAPI_METHOD, g as getDynamicPathParams, O as OpenAPISerializer, a as DEFAULT_OPENAPI_INPUT_STRUCTURE, i as isBodylessMethod, b as DEFAULT_OPENAPI_OUTPUT_STRUCTURE } from './openapi.
|
|
4
|
+
import { parseStandardUrl } from '@standard-server/core';
|
|
5
|
+
import { D as DEFAULT_OPENAPI_METHOD, g as getDynamicPathParams, O as OpenAPISerializer, a as DEFAULT_OPENAPI_INPUT_STRUCTURE, i as isBodylessMethod, b as DEFAULT_OPENAPI_OUTPUT_STRUCTURE } from './openapi.Cz2PauNH.mjs';
|
|
6
6
|
import { g as getOpenAPIMeta } from './openapi.B9PQzqBn.mjs';
|
|
7
7
|
import { createRouter, addRoute, findRoute, routeToRegExp } from 'rou3';
|
|
8
8
|
|
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.35",
|
|
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": [
|
|
@@ -97,19 +97,20 @@
|
|
|
97
97
|
}
|
|
98
98
|
},
|
|
99
99
|
"dependencies": {
|
|
100
|
-
"@
|
|
101
|
-
"@
|
|
102
|
-
"@orpc/
|
|
103
|
-
"@orpc/
|
|
104
|
-
"@orpc/
|
|
105
|
-
"@orpc/
|
|
106
|
-
"@
|
|
107
|
-
"@
|
|
100
|
+
"@openapi-spec/downgrader": "~0.1.0",
|
|
101
|
+
"@openapi-spec/types": "~0.1.0",
|
|
102
|
+
"@orpc/client": "2.0.0-beta.35",
|
|
103
|
+
"@orpc/contract": "2.0.0-beta.35",
|
|
104
|
+
"@orpc/json-schema": "2.0.0-beta.35",
|
|
105
|
+
"@orpc/server": "2.0.0-beta.35",
|
|
106
|
+
"@orpc/shared": "2.0.0-beta.35",
|
|
107
|
+
"@standard-server/core": "~0.9.0",
|
|
108
|
+
"@standard-server/fetch": "~0.9.0",
|
|
108
109
|
"rou3": "^0.9.1"
|
|
109
110
|
},
|
|
110
111
|
"devDependencies": {
|
|
111
112
|
"@scalar/api-reference": "^1.65.1",
|
|
112
|
-
"@
|
|
113
|
+
"@standard-server/aws-lambda": "~0.9.0",
|
|
113
114
|
"@types/swagger-ui": "^5.32.0",
|
|
114
115
|
"fastify": "^5.12.1",
|
|
115
116
|
"swagger-ui": "^5.32.14",
|