@orpc/openapi 2.0.0-beta.32 → 2.0.0-beta.34
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 +44 -29
- 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 +26 -11
- package/dist/index.d.ts +26 -11
- package/dist/index.mjs +22 -14
- package/dist/plugins/index.d.mts +4 -4
- package/dist/plugins/index.d.ts +4 -4
- package/dist/shared/{openapi.CEQ2t0ev.mjs → openapi.0Vlm07ar.mjs} +4 -4
- package/dist/shared/{openapi.9smDzQwj.d.mts → openapi.1dpot5Co.d.ts} +2 -2
- package/dist/shared/{openapi.Bd9icEUa.d.mts → openapi.BV8YPh6e.d.mts} +2 -2
- package/dist/shared/{openapi.D1CqEIRy.d.ts → openapi.BbwbMAMG.d.ts} +2 -2
- package/dist/shared/{openapi.YCiBHaJ-.d.ts → openapi.C1cJ95us.d.mts} +2 -2
- 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.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.BT-cS6Sl.mjs → openapi.Dxn8HAW0.mjs} +8 -8
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -29,44 +29,54 @@ You can read the documentation [here](https://orpc.dev).
|
|
|
29
29
|
|
|
30
30
|
**Core**
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
| Package | Purpose | Docs |
|
|
33
|
+
| -------------------------------------------------------------- | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
34
|
+
| [@orpc/contract](https://www.npmjs.com/package/@orpc/contract) | Define API contract as the single source of truth. | [Procedure Contract](https://orpc.dev/docs/contract/procedure), [Contract Router](https://orpc.dev/docs/contract/router), [Implementation](https://orpc.dev/docs/contract/implementation), [Generate from OpenAPI](https://orpc.dev/docs/contract/generate-from-openapi) |
|
|
35
|
+
| [@orpc/server](https://www.npmjs.com/package/@orpc/server) | Build APIs or implement contracts. | [Procedure](https://orpc.dev/docs/procedure), [Router](https://orpc.dev/docs/router), [Middleware](https://orpc.dev/docs/middleware), [Context](https://orpc.dev/docs/context), [RPC Handler](https://orpc.dev/docs/rpc/handler) |
|
|
36
|
+
| [@orpc/client](https://www.npmjs.com/package/@orpc/client) | Consume APIs with end-to-end type safety. | [Client-Side Clients](https://orpc.dev/docs/client/client-side), [Server-Side Clients](https://orpc.dev/docs/client/server-side), [RPC Link](https://orpc.dev/docs/rpc/link), [Error Handling](https://orpc.dev/docs/client/error-handling) |
|
|
37
|
+
| [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi) | Add OpenAPI compatibility to APIs. | [OpenAPI Handler](https://orpc.dev/docs/openapi/handler), [OpenAPI Link](https://orpc.dev/docs/openapi/link), [Specification](https://orpc.dev/docs/openapi/specification), [Scalar](https://orpc.dev/docs/openapi/scalar) |
|
|
36
38
|
|
|
37
39
|
**Schema validation**
|
|
38
40
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
| Package | Purpose | Docs |
|
|
42
|
+
| ------------------------------------------------------------ | ----------------------------------------------- | ----------------------------------------------------- |
|
|
43
|
+
| [@orpc/zod](https://www.npmjs.com/package/@orpc/zod) | Integrate with [Zod](https://zod.dev/). | [Zod](https://orpc.dev/docs/integrations/zod) |
|
|
44
|
+
| [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot) | Integrate with [Valibot](https://valibot.dev/). | [Valibot](https://orpc.dev/docs/integrations/valibot) |
|
|
45
|
+
| [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype) | Integrate with [ArkType](https://arktype.io/). | [ArkType](https://orpc.dev/docs/integrations/arktype) |
|
|
42
46
|
|
|
43
47
|
**Built-in features**
|
|
44
48
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
| Package | Purpose | Docs |
|
|
50
|
+
| -------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
|
|
51
|
+
| [@orpc/publisher](https://www.npmjs.com/package/@orpc/publisher) | Pub/Sub with memory, Redis, and Upstash adapters. | [Publisher](https://orpc.dev/docs/helpers/publisher) |
|
|
52
|
+
| [@orpc/ratelimit](https://www.npmjs.com/package/@orpc/ratelimit) | Rate limiting with memory, Redis, and Upstash adapters. | [Rate Limit](https://orpc.dev/docs/helpers/ratelimit) |
|
|
53
|
+
| [@orpc/hibernation](https://www.npmjs.com/package/@orpc/hibernation) | Leverage Hibernation APIs like [Cloudflare's Hibernation WebSocket](https://developers.cloudflare.com/durable-objects/best-practices/websockets/#durable-objects-hibernation-websocket-api). | [Hibernation](https://orpc.dev/docs/integrations/hibernation) |
|
|
54
|
+
| [@orpc/json-schema](https://www.npmjs.com/package/@orpc/json-schema) | Smart coercion for OpenAPI requests. | [Smart Coercion](https://orpc.dev/docs/plugins/smart-coercion) |
|
|
49
55
|
|
|
50
56
|
**Framework & ecosystem integrations**
|
|
51
57
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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's RateLimit and Durable Objects](https://developers.cloudflare.com/workers/). | [Publisher](https://orpc.dev/docs/helpers/publisher), [Rate Limit](https://orpc.dev/docs/helpers/ratelimit) |
|
|
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) |
|
|
64
72
|
|
|
65
73
|
**Observability**
|
|
66
74
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
75
|
+
| Package | Purpose | Docs |
|
|
76
|
+
| ------------------------------------------------------------------------ | ---------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
|
|
77
|
+
| [@orpc/opentelemetry](https://www.npmjs.com/package/@orpc/opentelemetry) | Integrate with [OpenTelemetry](https://opentelemetry.io/) for distributed tracing. | [OpenTelemetry](https://orpc.dev/docs/integrations/opentelemetry) |
|
|
78
|
+
| [@orpc/pino](https://www.npmjs.com/package/@orpc/pino) | Integrate with [Pino](https://getpino.io/) for logging. | [Pino](https://orpc.dev/docs/integrations/pino) |
|
|
79
|
+
| [@orpc/evlog](https://www.npmjs.com/package/@orpc/evlog) | Integrate with [Evlog](https://evlog.dev/) for logging. | [Evlog](https://orpc.dev/docs/integrations/evlog) |
|
|
70
80
|
|
|
71
81
|
## Sponsors
|
|
72
82
|
|
|
@@ -76,6 +86,9 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
|
|
|
76
86
|
<tr>
|
|
77
87
|
<td width="2000"><a href="https://screenshotone.com/?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener" title="The screenshot API for developers"><img src="https://avatars.githubusercontent.com/u/97035603?v=4" width="64" align="left" hspace="12" alt="ScreenshotOne.com"/><b>ScreenshotOne.com</b></a><br /><sub>The screenshot API for developers</sub></td>
|
|
78
88
|
</tr>
|
|
89
|
+
<tr>
|
|
90
|
+
<td width="2000"><a href="https://yuzu.health/careers?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="We're hiring NYC based engineers"><img src="https://avatars.githubusercontent.com/u/102488956?v=4" width="64" align="left" hspace="12" alt="Yuzu"/><b>Yuzu</b></a><br /><sub>We're hiring NYC based engineers</sub></td>
|
|
91
|
+
</tr>
|
|
79
92
|
<tr>
|
|
80
93
|
<td width="2000"><a href="https://misskey.io/?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Decentralized microblogging SNS born on Earth"><img src="https://github.com/MisskeyIO.png" width="64" align="left" hspace="12" alt="MisskeyHQ"/><b>MisskeyHQ</b></a><br /><sub>Decentralized microblogging SNS born on Earth</sub></td>
|
|
81
94
|
</tr>
|
|
@@ -122,30 +135,32 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
|
|
|
122
135
|
<table>
|
|
123
136
|
<tr>
|
|
124
137
|
<td align="center"><a href="https://github.com/rhinodavid?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="David Walsh"><img src="https://avatars.githubusercontent.com/u/5778036?u=b5521f07d2f88c3db2a0dae62b5f2f8357214af0&v=4" width="119" alt="David Walsh"/><br />David Walsh</a></td>
|
|
138
|
+
<td align="center"><a href="https://github.com/IPv4Addr?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="IPv4Addr"><img src="https://avatars.githubusercontent.com/u/100147665?u=59996b72f69bb53063cb7e9ff8b8f898616cd94d&v=4" width="119" alt="IPv4Addr"/><br />IPv4Addr</a></td>
|
|
125
139
|
<td align="center"><a href="https://robbevaes.be/?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Robbe Vaes"><img src="https://avatars.githubusercontent.com/u/44748019?u=e0232402c045ad4eac7cbd217f1f47e083103b89&v=4" width="119" alt="Robbe Vaes"/><br />Robbe Vaes</a></td>
|
|
126
140
|
<td align="center"><a href="https://github.com/aidansunbury?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Aidan Sunbury"><img src="https://avatars.githubusercontent.com/u/64103161?v=4" width="119" alt="Aidan Sunbury"/><br />Aidan Sunbury</a></td>
|
|
127
141
|
<td align="center"><a href="https://github.com/soonoo?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="soonoo"><img src="https://avatars.githubusercontent.com/u/5436405?u=5d0b4aa955c87e30e6bda7f0cccae5402da99528&v=4" width="119" alt="soonoo"/><br />soonoo</a></td>
|
|
128
142
|
<td align="center"><a href="https://kevinporten.dev/?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Kevin Porten"><img src="https://avatars.githubusercontent.com/u/1839345?u=dc2263d5cfe0d927ce1a0be04a1d55dd6b55405c&v=4" width="119" alt="Kevin Porten"/><br />Kevin Porten</a></td>
|
|
129
143
|
<td align="center"><a href="https://github.com/pumpkinlink?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Denis"><img src="https://avatars.githubusercontent.com/u/11864620?u=5f47bbe6c65d0f6f5cf011021490238e4b0593d0&v=4" width="119" alt="Denis"/><br />Denis</a></td>
|
|
130
|
-
<td align="center"><a href="https://github.com/christopher-kapic?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Christopher Kapic"><img src="https://avatars.githubusercontent.com/u/59740769?u=e7ad4b72b5bf6c9eb1644c26dbf3332a8f987377&v=4" width="119" alt="Christopher Kapic"/><br />Christopher Kapic</a></td>
|
|
131
144
|
</tr>
|
|
132
145
|
<tr>
|
|
146
|
+
<td align="center"><a href="https://github.com/christopher-kapic?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Christopher Kapic"><img src="https://avatars.githubusercontent.com/u/59740769?u=e7ad4b72b5bf6c9eb1644c26dbf3332a8f987377&v=4" width="119" alt="Christopher Kapic"/><br />Christopher Kapic</a></td>
|
|
133
147
|
<td align="center"><a href="http://ballingt.com/?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Tom Ballinger"><img src="https://avatars.githubusercontent.com/u/458879?u=4b045ac75d721b6ac2b42a74d7d37f61f0414031&v=4" width="119" alt="Tom Ballinger"/><br />Tom Ballinger</a></td>
|
|
134
148
|
<td align="center"><a href="https://lee-sam.com/?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Sam"><img src="https://avatars.githubusercontent.com/u/102863520?u=3c89611f549d5070be232eb4532f690c8f2e7a65&v=4" width="119" alt="Sam"/><br />Sam</a></td>
|
|
135
149
|
<td align="center"><a href="https://github.com/Titoine?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Titoine"><img src="https://avatars.githubusercontent.com/u/3514286?u=1bb1e86b0c99c8a1121372e56d51a177eea12191&v=4" width="119" alt="Titoine"/><br />Titoine</a></td>
|
|
136
150
|
<td align="center"><a href="https://rigtch.fm/?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Igor Makowski"><img src="https://avatars.githubusercontent.com/u/56691628?u=ee8c879478f7c151b9156aef6c74243fa3e247a8&v=4" width="119" alt="Igor Makowski"/><br />Igor Makowski</a></td>
|
|
137
151
|
<td align="center"><a href="https://blog.cwang.io/?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="hanayashiki"><img src="https://avatars.githubusercontent.com/u/26056783?u=06c3b9205a16fd41a871e82da1cc2a09306d53f5&v=4" width="119" alt="hanayashiki"/><br />hanayashiki</a></td>
|
|
138
152
|
<td align="center"><a href="https://dubinets.io/?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Lev Dubinets"><img src="https://avatars.githubusercontent.com/u/3114081?u=f547f5d5012cab54851f1b1ad72d10e537f78fc2&v=4" width="119" alt="Lev Dubinets"/><br />Lev Dubinets</a></td>
|
|
139
|
-
<td align="center"><a href="https://kellychan.im/?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Kelly Peilin Chan"><img src="https://avatars.githubusercontent.com/u/520852?u=6b0f7105f694e7b5cacf410a3f04c7044b469dc8&v=4" width="119" alt="Kelly Peilin Chan"/><br />Kelly Peilin Chan</a></td>
|
|
140
153
|
</tr>
|
|
141
154
|
<tr>
|
|
155
|
+
<td align="center"><a href="https://kellychan.im/?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Kelly Peilin Chan"><img src="https://avatars.githubusercontent.com/u/520852?u=6b0f7105f694e7b5cacf410a3f04c7044b469dc8&v=4" width="119" alt="Kelly Peilin Chan"/><br />Kelly Peilin Chan</a></td>
|
|
142
156
|
<td align="center"><a href="https://guyariely.com/?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Guy Ariely"><img src="https://avatars.githubusercontent.com/u/42813496?u=edb6b7f563bf28e160a290832e7da57c0506f8ca&v=4" width="119" alt="Guy Ariely"/><br />Guy Ariely</a></td>
|
|
157
|
+
<td align="center"><a href="https://paulsenon.com/?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="PaulSenon"><img src="https://avatars.githubusercontent.com/u/19531087?u=6385741eb91d200b8c513ec6045482e301767ca6&v=4" width="119" alt="PaulSenon"/><br />PaulSenon</a></td>
|
|
143
158
|
<td align="center"><a href="https://piscis.dev/?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Alex"><img src="https://avatars.githubusercontent.com/u/326163?u=b245f368bd940cf51d08c0b6bf55f8257f359437&v=4" width="119" alt="Alex"/><br />Alex</a></td>
|
|
144
159
|
<td align="center"><a href="https://opensource.gubanov.eu/?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Andrey Gubanov"><img src="https://avatars.githubusercontent.com/u/1082083?u=c5f2daf7ebece498e85c83367bb37b4e10e2649d&v=4" width="119" alt="Andrey Gubanov"/><br />Andrey Gubanov</a></td>
|
|
145
160
|
</tr>
|
|
146
161
|
</table>
|
|
147
162
|
|
|
148
|
-
With thanks to [
|
|
163
|
+
With thanks to [36 past sponsors](https://htmlpreview.github.io/?https://github.com/middleapi/static/blob/main/sponsors.svg) who helped get oRPC here.
|
|
149
164
|
|
|
150
165
|
## References
|
|
151
166
|
|
|
@@ -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.C1cJ95us.mjs';
|
|
2
|
+
export { a as OpenAPILinkCodec, O as OpenAPILinkCodecOptions } from '../../shared/openapi.BV8YPh6e.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.1dpot5Co.js';
|
|
2
|
+
export { a as OpenAPILinkCodec, O as OpenAPILinkCodecOptions } from '../../shared/openapi.BbwbMAMG.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
11
|
import { Value } from '@orpc/shared';
|
|
12
|
-
|
|
13
|
-
|
|
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>>;
|
|
@@ -61,8 +62,21 @@ interface OpenAPIGeneratorOptions {
|
|
|
61
62
|
*/
|
|
62
63
|
serializer?: Pick<OpenAPISerializer, keyof 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
11
|
import { Value } from '@orpc/shared';
|
|
12
|
-
|
|
13
|
-
|
|
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>>;
|
|
@@ -61,8 +62,21 @@ interface OpenAPIGeneratorOptions {
|
|
|
61
62
|
*/
|
|
62
63
|
serializer?: Pick<OpenAPISerializer, keyof 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);
|
|
@@ -495,7 +496,7 @@ function buildSuccessResponse(ctx, operation, def, meta) {
|
|
|
495
496
|
const iteratorDetails = getAsyncIteratorObjectDetails(def.outputSchemas);
|
|
496
497
|
if (iteratorDetails) {
|
|
497
498
|
operation.responses ??= {};
|
|
498
|
-
operation.responses[status] = {
|
|
499
|
+
operation.responses[toResponseStatusKey(status)] = {
|
|
499
500
|
description,
|
|
500
501
|
content: toAsyncIteratorObjectContent(
|
|
501
502
|
ctx,
|
|
@@ -510,7 +511,7 @@ function buildSuccessResponse(ctx, operation, def, meta) {
|
|
|
510
511
|
const [schema] = ctx.convertSchemas(def.outputSchemas, "output");
|
|
511
512
|
if (isUnconstrainedSchema(schema) || outputStructure === "compact") {
|
|
512
513
|
operation.responses ??= {};
|
|
513
|
-
operation.responses[status] = {
|
|
514
|
+
operation.responses[toResponseStatusKey(status)] = {
|
|
514
515
|
description,
|
|
515
516
|
content: toBodyContent(ctx, "output", schema)
|
|
516
517
|
};
|
|
@@ -534,9 +535,12 @@ function buildSuccessResponse(ctx, operation, def, meta) {
|
|
|
534
535
|
});
|
|
535
536
|
}
|
|
536
537
|
operation.responses ??= {};
|
|
537
|
-
operation.responses[responseStatus] = responseObject;
|
|
538
|
+
operation.responses[toResponseStatusKey(responseStatus)] = responseObject;
|
|
538
539
|
}
|
|
539
540
|
}
|
|
541
|
+
function toResponseStatusKey(status) {
|
|
542
|
+
return String(status);
|
|
543
|
+
}
|
|
540
544
|
function extractDetailedResponseParts(schema, defaultStatus) {
|
|
541
545
|
const partsByStatus = /* @__PURE__ */ new Map();
|
|
542
546
|
for (const item of flattenJsonUnionSchema(schema)) {
|
|
@@ -598,13 +602,12 @@ function buildErrorResponse(ctx, operation, def) {
|
|
|
598
602
|
type: "object",
|
|
599
603
|
properties: {
|
|
600
604
|
defined: { const: false },
|
|
601
|
-
inferable: { type: "boolean" },
|
|
602
605
|
code: { type: "string" },
|
|
603
606
|
status: { type: "number" },
|
|
604
607
|
message: { type: "string" },
|
|
605
608
|
data: {}
|
|
606
609
|
},
|
|
607
|
-
required: ["defined", "
|
|
610
|
+
required: ["defined", "code", "status", "message"]
|
|
608
611
|
});
|
|
609
612
|
for (const [status, definitions] of definitionsByStatus.entries()) {
|
|
610
613
|
const descriptions = definitions.map(({ defaultMessage }) => defaultMessage).filter((m) => m !== void 0);
|
|
@@ -617,7 +620,6 @@ function buildErrorResponse(ctx, operation, def) {
|
|
|
617
620
|
...definitions.map(({ code, dataJsonSchema, dataOptional }) => {
|
|
618
621
|
return ctx.registry.register(toErrorComponentName(code), combineJsonObjectSchemaEntries([
|
|
619
622
|
["defined", { const: true }, false],
|
|
620
|
-
["inferable", { type: "boolean" }, false],
|
|
621
623
|
["code", { const: code }, false],
|
|
622
624
|
["status", { const: status }, false],
|
|
623
625
|
// avoid using the defaultMessage here to improve component reusability
|
|
@@ -628,7 +630,7 @@ function buildErrorResponse(ctx, operation, def) {
|
|
|
628
630
|
undefinedErrorSchema
|
|
629
631
|
]);
|
|
630
632
|
operation.responses ??= {};
|
|
631
|
-
operation.responses[status] = {
|
|
633
|
+
operation.responses[toResponseStatusKey(status)] = {
|
|
632
634
|
description: descriptions.length ? descriptions.join(", ") : status.toString(),
|
|
633
635
|
content: {
|
|
634
636
|
"application/json": {
|
|
@@ -742,9 +744,10 @@ class OpenAPIGenerator {
|
|
|
742
744
|
]);
|
|
743
745
|
}
|
|
744
746
|
async generate(router, options = {}) {
|
|
747
|
+
const version = options.version ?? "3.2.0";
|
|
745
748
|
const doc = {
|
|
746
749
|
...clone(options.base),
|
|
747
|
-
openapi:
|
|
750
|
+
openapi: "3.2.0",
|
|
748
751
|
info: options.base?.info ?? { title: "API Reference", version: "0.0.0" }
|
|
749
752
|
};
|
|
750
753
|
const ctx = {
|
|
@@ -762,9 +765,9 @@ class OpenAPIGenerator {
|
|
|
762
765
|
const def = contract["~orpc"];
|
|
763
766
|
const meta = getOpenAPIMeta(contract);
|
|
764
767
|
const method = (meta?.method ?? DEFAULT_OPENAPI_METHOD).toLowerCase();
|
|
765
|
-
if (method === "query" &&
|
|
768
|
+
if (method === "query" && !version.startsWith("3.2.")) {
|
|
766
769
|
throw new OpenAPIGeneratorError(
|
|
767
|
-
`QUERY operations require OpenAPI 3.2
|
|
770
|
+
`QUERY operations require OpenAPI 3.2, but version "${version}" was requested.`
|
|
768
771
|
);
|
|
769
772
|
}
|
|
770
773
|
const postPath = meta?.path ?? pathToHttpPath(path);
|
|
@@ -806,7 +809,8 @@ class OpenAPIGenerator {
|
|
|
806
809
|
${errors.join("\n\n")}`
|
|
807
810
|
);
|
|
808
811
|
}
|
|
809
|
-
|
|
812
|
+
const versioned = toVersionedOpenAPIDocument(doc, version);
|
|
813
|
+
return this.serializer.serialize(versioned, { asFormData: false, useFormDataForBlobFields: false });
|
|
810
814
|
}
|
|
811
815
|
convertSchema(schema, direction) {
|
|
812
816
|
const [jsonSchema, optional] = this.converter.convert(schema, direction);
|
|
@@ -823,6 +827,10 @@ ${errors.join("\n\n")}`
|
|
|
823
827
|
];
|
|
824
828
|
}
|
|
825
829
|
}
|
|
830
|
+
function toVersionedOpenAPIDocument(doc, version) {
|
|
831
|
+
const downgraded = version.startsWith("3.2.") ? doc : version.startsWith("3.1.") ? downgradeSpecV32ToV31(doc) : downgradeSpecV31ToV30(downgradeSpecV32ToV31(doc));
|
|
832
|
+
return { ...downgraded, openapi: version };
|
|
833
|
+
}
|
|
826
834
|
function strip$schemaField(schema) {
|
|
827
835
|
if (typeof schema !== "object") {
|
|
828
836
|
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,
|
|
@@ -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 {
|
|
@@ -2,9 +2,9 @@ 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
4
|
import { Value, Promisable } from '@orpc/shared';
|
|
5
|
-
import { StandardLazyRequest, StandardResponse } from '@
|
|
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
|
/**
|
|
@@ -2,8 +2,8 @@ import { ClientContext, ClientOptions, AnyORPCError } from '@orpc/client';
|
|
|
2
2
|
import { StandardLinkCodec, StandardLinkCodecDecodedResponse } from '@orpc/client/standard';
|
|
3
3
|
import { RouterContract } from '@orpc/contract';
|
|
4
4
|
import { Value, Promisable } from '@orpc/shared';
|
|
5
|
-
import { StandardUrl, StandardHeaders, StandardLazyResponse, StandardRequest } from '@
|
|
6
|
-
import { O as OpenAPISerializer } from './openapi.
|
|
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
|
/**
|
|
@@ -2,8 +2,8 @@ import { ClientContext, ClientOptions, AnyORPCError } from '@orpc/client';
|
|
|
2
2
|
import { StandardLinkCodec, StandardLinkCodecDecodedResponse } from '@orpc/client/standard';
|
|
3
3
|
import { RouterContract } from '@orpc/contract';
|
|
4
4
|
import { Value, Promisable } from '@orpc/shared';
|
|
5
|
-
import { StandardUrl, StandardHeaders, StandardLazyResponse, StandardRequest } from '@
|
|
6
|
-
import { O as OpenAPISerializer } from './openapi.
|
|
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
|
/**
|
|
@@ -2,9 +2,9 @@ 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
4
|
import { Value, Promisable } from '@orpc/shared';
|
|
5
|
-
import { StandardLazyRequest, StandardResponse } from '@
|
|
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
|
/**
|
|
@@ -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,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
|
|
|
@@ -196,13 +196,13 @@ class OpenAPIHandlerCodecCore {
|
|
|
196
196
|
if (!params || Object.keys(params).length < 1) {
|
|
197
197
|
return data;
|
|
198
198
|
}
|
|
199
|
-
if (isPlainObject(data)) {
|
|
200
|
-
return
|
|
201
|
-
...data,
|
|
202
|
-
...params
|
|
203
|
-
};
|
|
199
|
+
if (!isPlainObject(data)) {
|
|
200
|
+
return params;
|
|
204
201
|
}
|
|
205
|
-
return
|
|
202
|
+
return {
|
|
203
|
+
...data,
|
|
204
|
+
...params
|
|
205
|
+
};
|
|
206
206
|
}
|
|
207
207
|
return {
|
|
208
208
|
params,
|
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.34",
|
|
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,26 +97,26 @@
|
|
|
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.34",
|
|
103
|
+
"@orpc/contract": "2.0.0-beta.34",
|
|
104
|
+
"@orpc/json-schema": "2.0.0-beta.34",
|
|
105
|
+
"@orpc/server": "2.0.0-beta.34",
|
|
106
|
+
"@orpc/shared": "2.0.0-beta.34",
|
|
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",
|
|
116
|
-
"zod": "^4.4
|
|
117
|
+
"zod": "^4.5.4"
|
|
117
118
|
},
|
|
118
119
|
"scripts": {
|
|
119
|
-
"build": "unbuild",
|
|
120
120
|
"type:check": "tsc -b"
|
|
121
121
|
}
|
|
122
122
|
}
|