@orpc/openapi 2.0.0-beta.35 → 2.0.0-beta.37
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 +29 -20
- 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 +3 -3
- package/dist/adapters/fetch/index.d.ts +3 -3
- package/dist/adapters/fetch/index.mjs +4 -4
- 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 +2 -2
- package/dist/adapters/standard/index.d.ts +2 -2
- package/dist/adapters/standard/index.mjs +4 -4
- package/dist/helpers/index.mjs +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +5 -5
- package/dist/shared/{openapi.s_p5sN-P.mjs → openapi.B2G-HeFn.mjs} +28 -41
- package/dist/shared/{openapi.DOy27J9v.d.ts → openapi.BwNINoeN.d.ts} +1 -1
- package/dist/shared/{openapi.Cz2PauNH.mjs → openapi.DAmA59tr.mjs} +8 -22
- package/dist/shared/{openapi.D3yXvICd.d.mts → openapi.DE5kXinS.d.mts} +1 -1
- package/dist/shared/{openapi.CXSHZ431.d.mts → openapi.DI21x5Yo.d.mts} +1 -1
- package/dist/shared/{openapi.CXSHZ431.d.ts → openapi.DI21x5Yo.d.ts} +1 -1
- package/dist/shared/{openapi.Dxn8HAW0.mjs → openapi.DI39r-Ta.mjs} +3 -3
- package/dist/shared/{openapi.0Vlm07ar.mjs → openapi.DPmbXebg.mjs} +7 -7
- package/dist/shared/{openapi.DXWj9fY8.d.mts → openapi.Dl3gew1x.d.mts} +2 -2
- package/dist/shared/{openapi.DXWj9fY8.d.ts → openapi.Dl3gew1x.d.ts} +2 -2
- package/dist/shared/{openapi.DsnjJWwQ.d.ts → openapi.EM8eC1Xn.d.ts} +3 -3
- package/dist/shared/{openapi.BO2OB-Y9.d.mts → openapi.fnBK1ELE.d.mts} +3 -3
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -46,29 +46,30 @@ You can read the documentation [here](https://orpc.dev).
|
|
|
46
46
|
|
|
47
47
|
**Built-in features**
|
|
48
48
|
|
|
49
|
-
| Package
|
|
50
|
-
|
|
|
51
|
-
| [@orpc/publisher](https://www.npmjs.com/package/@orpc/publisher)
|
|
52
|
-
| [@orpc/ratelimit](https://www.npmjs.com/package/@orpc/ratelimit)
|
|
53
|
-
| [@orpc/
|
|
54
|
-
| [@orpc/
|
|
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/experimental-lock](https://www.npmjs.com/package/@orpc/experimental-lock) | Locking with memory, Redis, and Upstash adapters. | [Lock](https://orpc.dev/docs/helpers/lock) |
|
|
54
|
+
| [@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) |
|
|
55
|
+
| [@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) |
|
|
55
56
|
|
|
56
57
|
**Framework & ecosystem integrations**
|
|
57
58
|
|
|
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)
|
|
59
|
+
| Package | Purpose | Docs |
|
|
60
|
+
| ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
61
|
+
| [@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) |
|
|
62
|
+
| [@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) |
|
|
63
|
+
| [@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) |
|
|
64
|
+
| [@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) |
|
|
65
|
+
| [@orpc/swr](https://www.npmjs.com/package/@orpc/swr) | Integrate with [SWR](https://swr.vercel.app/). | [SWR](https://orpc.dev/docs/integrations/swr) |
|
|
66
|
+
| [@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) |
|
|
67
|
+
| [@orpc/experimental-effect](https://www.npmjs.com/package/@orpc/experimental-effect) | Integrate with [Effect](https://effect.website/). | [Effect](https://orpc.dev/docs/integrations/effect) |
|
|
68
|
+
| [@orpc/nest](https://www.npmjs.com/package/@orpc/nest) | Implement your contract with [NestJS](https://nestjs.com/). | [NestJS](https://orpc.dev/docs/integrations/nest) |
|
|
69
|
+
| [@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) |
|
|
70
|
+
| [@orpc/bun](https://www.npmjs.com/package/@orpc/bun) | Adapters for [Bun's Redis](https://bun.sh/). | [Publisher](https://orpc.dev/docs/helpers/publisher), [Rate Limit](https://orpc.dev/docs/helpers/ratelimit), [Lock](https://orpc.dev/docs/helpers/lock) |
|
|
71
|
+
| [@orpc/cloudflare](https://www.npmjs.com/package/@orpc/cloudflare) | Adapters for [Cloudflare Workers](https://developers.cloudflare.com/workers/). | [Publisher](https://orpc.dev/docs/helpers/publisher), [Rate Limit](https://orpc.dev/docs/helpers/ratelimit), [Lock](https://orpc.dev/docs/helpers/lock), [Traces](https://orpc.dev/docs/integrations/cloudflare-traces) |
|
|
72
|
+
| [@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
73
|
|
|
73
74
|
**Observability**
|
|
74
75
|
|
|
@@ -94,6 +95,14 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
|
|
|
94
95
|
</tr>
|
|
95
96
|
</table>
|
|
96
97
|
|
|
98
|
+
### Special Sponsors
|
|
99
|
+
|
|
100
|
+
<table>
|
|
101
|
+
<tr>
|
|
102
|
+
<td align="center"><a href="http://twitter.com/rauchg?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Guillermo Rauch"><img src="https://avatars.githubusercontent.com/u/13041?u=1ee8d111657cdd02ff6d253df00978d17ee6d722&v=4" width="279" alt="Guillermo Rauch"/><br />Guillermo Rauch</a></td>
|
|
103
|
+
</tr>
|
|
104
|
+
</table>
|
|
105
|
+
|
|
97
106
|
### Organization Sponsors
|
|
98
107
|
|
|
99
108
|
<table>
|
|
@@ -6,9 +6,9 @@ import '@orpc/client';
|
|
|
6
6
|
import '@orpc/shared';
|
|
7
7
|
import '@standard-server/core';
|
|
8
8
|
import '@orpc/contract';
|
|
9
|
-
import '../../shared/openapi.
|
|
9
|
+
import '../../shared/openapi.Dl3gew1x.mjs';
|
|
10
10
|
|
|
11
|
-
interface OpenAPIHandlerOptions<T extends Context> extends AwsLambdaHandlerOptions<T>,
|
|
11
|
+
interface OpenAPIHandlerOptions<T extends Context> extends AwsLambdaHandlerOptions<T>, StandardHandlerOptions<T>, OpenAPIHandlerCodecOptions<T> {
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* Serves oRPC procedures over the OpenAPI (RESTful) protocol on AWS Lambda.
|
|
@@ -6,9 +6,9 @@ import '@orpc/client';
|
|
|
6
6
|
import '@orpc/shared';
|
|
7
7
|
import '@standard-server/core';
|
|
8
8
|
import '@orpc/contract';
|
|
9
|
-
import '../../shared/openapi.
|
|
9
|
+
import '../../shared/openapi.Dl3gew1x.js';
|
|
10
10
|
|
|
11
|
-
interface OpenAPIHandlerOptions<T extends Context> extends AwsLambdaHandlerOptions<T>,
|
|
11
|
+
interface OpenAPIHandlerOptions<T extends Context> extends AwsLambdaHandlerOptions<T>, StandardHandlerOptions<T>, OpenAPIHandlerCodecOptions<T> {
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* Serves oRPC procedures over the OpenAPI (RESTful) protocol on AWS Lambda.
|
|
@@ -1,12 +1,12 @@
|
|
|
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.DI39r-Ta.mjs';
|
|
4
4
|
import '@orpc/client';
|
|
5
5
|
import '@orpc/server';
|
|
6
6
|
import '@orpc/shared';
|
|
7
7
|
import '@standard-server/core';
|
|
8
|
-
import '../../shared/openapi.
|
|
9
|
-
import '../../shared/openapi.
|
|
8
|
+
import '../../shared/openapi.DAmA59tr.mjs';
|
|
9
|
+
import '../../shared/openapi.B2G-HeFn.mjs';
|
|
10
10
|
import '../../shared/openapi.B9PQzqBn.mjs';
|
|
11
11
|
import 'rou3';
|
|
12
12
|
|
|
@@ -6,9 +6,9 @@ import '@orpc/client';
|
|
|
6
6
|
import '@orpc/shared';
|
|
7
7
|
import '@standard-server/core';
|
|
8
8
|
import '@orpc/contract';
|
|
9
|
-
import '../../shared/openapi.
|
|
9
|
+
import '../../shared/openapi.Dl3gew1x.mjs';
|
|
10
10
|
|
|
11
|
-
interface OpenAPIHandlerOptions<T extends Context> extends FastifyHandlerOptions<T>,
|
|
11
|
+
interface OpenAPIHandlerOptions<T extends Context> extends FastifyHandlerOptions<T>, StandardHandlerOptions<T>, OpenAPIHandlerCodecOptions<T> {
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* Serves oRPC procedures over the OpenAPI (RESTful) protocol as part of a Fastify server.
|
|
@@ -6,9 +6,9 @@ import '@orpc/client';
|
|
|
6
6
|
import '@orpc/shared';
|
|
7
7
|
import '@standard-server/core';
|
|
8
8
|
import '@orpc/contract';
|
|
9
|
-
import '../../shared/openapi.
|
|
9
|
+
import '../../shared/openapi.Dl3gew1x.js';
|
|
10
10
|
|
|
11
|
-
interface OpenAPIHandlerOptions<T extends Context> extends FastifyHandlerOptions<T>,
|
|
11
|
+
interface OpenAPIHandlerOptions<T extends Context> extends FastifyHandlerOptions<T>, StandardHandlerOptions<T>, OpenAPIHandlerCodecOptions<T> {
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* Serves oRPC procedures over the OpenAPI (RESTful) protocol as part of a Fastify server.
|
|
@@ -1,12 +1,12 @@
|
|
|
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.DI39r-Ta.mjs';
|
|
4
4
|
import '@orpc/client';
|
|
5
5
|
import '@orpc/server';
|
|
6
6
|
import '@orpc/shared';
|
|
7
7
|
import '@standard-server/core';
|
|
8
|
-
import '../../shared/openapi.
|
|
9
|
-
import '../../shared/openapi.
|
|
8
|
+
import '../../shared/openapi.DAmA59tr.mjs';
|
|
9
|
+
import '../../shared/openapi.B2G-HeFn.mjs';
|
|
10
10
|
import '../../shared/openapi.B9PQzqBn.mjs';
|
|
11
11
|
import 'rou3';
|
|
12
12
|
|
|
@@ -9,9 +9,9 @@ import { RouterContract } from '@orpc/contract';
|
|
|
9
9
|
import { OpenAPILinkCodecOptions } from '../standard/index.mjs';
|
|
10
10
|
import '@orpc/shared';
|
|
11
11
|
import '@standard-server/core';
|
|
12
|
-
import '../../shared/openapi.
|
|
12
|
+
import '../../shared/openapi.Dl3gew1x.mjs';
|
|
13
13
|
|
|
14
|
-
interface OpenAPIHandlerOptions<T extends Context> extends FetchHandlerOptions<T>,
|
|
14
|
+
interface OpenAPIHandlerOptions<T extends Context> extends FetchHandlerOptions<T>, StandardHandlerOptions<T>, OpenAPIHandlerCodecOptions<T> {
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Serves oRPC procedures over the OpenAPI (RESTful) protocol using the Fetch API `Request`/`Response`.
|
|
@@ -22,7 +22,7 @@ declare class OpenAPIHandler<T extends Context> extends FetchHandler<T> {
|
|
|
22
22
|
constructor(router: Router<T>, options?: NoInfer<OpenAPIHandlerOptions<T>>);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
interface OpenAPILinkOptions<T extends ClientContext> extends
|
|
25
|
+
interface OpenAPILinkOptions<T extends ClientContext> extends StandardLinkOptions<T>, FetchLinkTransportOptions<T>, OpenAPILinkCodecOptions<T> {
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* Client link that calls an OpenAPI (RESTful) oRPC server over HTTP using the Fetch API.
|
|
@@ -9,9 +9,9 @@ import { RouterContract } from '@orpc/contract';
|
|
|
9
9
|
import { OpenAPILinkCodecOptions } from '../standard/index.js';
|
|
10
10
|
import '@orpc/shared';
|
|
11
11
|
import '@standard-server/core';
|
|
12
|
-
import '../../shared/openapi.
|
|
12
|
+
import '../../shared/openapi.Dl3gew1x.js';
|
|
13
13
|
|
|
14
|
-
interface OpenAPIHandlerOptions<T extends Context> extends FetchHandlerOptions<T>,
|
|
14
|
+
interface OpenAPIHandlerOptions<T extends Context> extends FetchHandlerOptions<T>, StandardHandlerOptions<T>, OpenAPIHandlerCodecOptions<T> {
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Serves oRPC procedures over the OpenAPI (RESTful) protocol using the Fetch API `Request`/`Response`.
|
|
@@ -22,7 +22,7 @@ declare class OpenAPIHandler<T extends Context> extends FetchHandler<T> {
|
|
|
22
22
|
constructor(router: Router<T>, options?: NoInfer<OpenAPIHandlerOptions<T>>);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
interface OpenAPILinkOptions<T extends ClientContext> extends
|
|
25
|
+
interface OpenAPILinkOptions<T extends ClientContext> extends StandardLinkOptions<T>, FetchLinkTransportOptions<T>, OpenAPILinkCodecOptions<T> {
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* Client link that calls an OpenAPI (RESTful) oRPC server over HTTP using the Fetch API.
|
|
@@ -1,15 +1,15 @@
|
|
|
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.DI39r-Ta.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.DPmbXebg.mjs';
|
|
7
7
|
import '@orpc/client';
|
|
8
8
|
import '@orpc/server';
|
|
9
9
|
import '@orpc/shared';
|
|
10
10
|
import '@standard-server/core';
|
|
11
|
-
import '../../shared/openapi.
|
|
12
|
-
import '../../shared/openapi.
|
|
11
|
+
import '../../shared/openapi.DAmA59tr.mjs';
|
|
12
|
+
import '../../shared/openapi.B2G-HeFn.mjs';
|
|
13
13
|
import '../../shared/openapi.B9PQzqBn.mjs';
|
|
14
14
|
import 'rou3';
|
|
15
15
|
import '@orpc/contract';
|
|
@@ -6,9 +6,9 @@ import '@orpc/client';
|
|
|
6
6
|
import '@orpc/shared';
|
|
7
7
|
import '@standard-server/core';
|
|
8
8
|
import '@orpc/contract';
|
|
9
|
-
import '../../shared/openapi.
|
|
9
|
+
import '../../shared/openapi.Dl3gew1x.mjs';
|
|
10
10
|
|
|
11
|
-
interface OpenAPIHandlerOptions<T extends Context> extends NodeHttpHandlerOptions<T>,
|
|
11
|
+
interface OpenAPIHandlerOptions<T extends Context> extends NodeHttpHandlerOptions<T>, StandardHandlerOptions<T>, OpenAPIHandlerCodecOptions<T> {
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* Serves oRPC procedures over the OpenAPI (RESTful) protocol using Node.js built-in HTTP request/response.
|
|
@@ -6,9 +6,9 @@ import '@orpc/client';
|
|
|
6
6
|
import '@orpc/shared';
|
|
7
7
|
import '@standard-server/core';
|
|
8
8
|
import '@orpc/contract';
|
|
9
|
-
import '../../shared/openapi.
|
|
9
|
+
import '../../shared/openapi.Dl3gew1x.js';
|
|
10
10
|
|
|
11
|
-
interface OpenAPIHandlerOptions<T extends Context> extends NodeHttpHandlerOptions<T>,
|
|
11
|
+
interface OpenAPIHandlerOptions<T extends Context> extends NodeHttpHandlerOptions<T>, StandardHandlerOptions<T>, OpenAPIHandlerCodecOptions<T> {
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* Serves oRPC procedures over the OpenAPI (RESTful) protocol using Node.js built-in HTTP request/response.
|
|
@@ -1,12 +1,12 @@
|
|
|
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.DI39r-Ta.mjs';
|
|
4
4
|
import '@orpc/client';
|
|
5
5
|
import '@orpc/server';
|
|
6
6
|
import '@orpc/shared';
|
|
7
7
|
import '@standard-server/core';
|
|
8
|
-
import '../../shared/openapi.
|
|
9
|
-
import '../../shared/openapi.
|
|
8
|
+
import '../../shared/openapi.DAmA59tr.mjs';
|
|
9
|
+
import '../../shared/openapi.B2G-HeFn.mjs';
|
|
10
10
|
import '../../shared/openapi.B9PQzqBn.mjs';
|
|
11
11
|
import 'rou3';
|
|
12
12
|
|
|
@@ -1,5 +1,5 @@
|
|
|
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.
|
|
1
|
+
export { a as OpenAPIHandlerCodec, b as OpenAPIHandlerCodecCore, c as OpenAPIHandlerCodecCoreOptions, O as OpenAPIHandlerCodecOptions, d as OpenAPIMatcher, e as OpenAPIMatcherOptions } from '../../shared/openapi.fnBK1ELE.mjs';
|
|
2
|
+
export { a as OpenAPILinkCodec, O as OpenAPILinkCodecOptions } from '../../shared/openapi.DE5kXinS.mjs';
|
|
3
3
|
import { StandardHeaders } from '@standard-server/core';
|
|
4
4
|
import { OpenAPISerializer } from '../../index.mjs';
|
|
5
5
|
import '@orpc/client';
|
|
@@ -1,5 +1,5 @@
|
|
|
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.
|
|
1
|
+
export { a as OpenAPIHandlerCodec, b as OpenAPIHandlerCodecCore, c as OpenAPIHandlerCodecCoreOptions, O as OpenAPIHandlerCodecOptions, d as OpenAPIMatcher, e as OpenAPIMatcherOptions } from '../../shared/openapi.EM8eC1Xn.js';
|
|
2
|
+
export { a as OpenAPILinkCodec, O as OpenAPILinkCodecOptions } from '../../shared/openapi.BwNINoeN.js';
|
|
3
3
|
import { StandardHeaders } from '@standard-server/core';
|
|
4
4
|
import { OpenAPISerializer } from '../../index.js';
|
|
5
5
|
import '@orpc/client';
|
|
@@ -1,11 +1,11 @@
|
|
|
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.DI39r-Ta.mjs';
|
|
2
|
+
export { O as OpenAPILinkCodec } from '../../shared/openapi.DPmbXebg.mjs';
|
|
3
3
|
import '@orpc/client';
|
|
4
4
|
import '@orpc/server';
|
|
5
5
|
import '@orpc/shared';
|
|
6
6
|
import '@standard-server/core';
|
|
7
|
-
import '../../shared/openapi.
|
|
8
|
-
import '../../shared/openapi.
|
|
7
|
+
import '../../shared/openapi.DAmA59tr.mjs';
|
|
8
|
+
import '../../shared/openapi.B2G-HeFn.mjs';
|
|
9
9
|
import '../../shared/openapi.B9PQzqBn.mjs';
|
|
10
10
|
import 'rou3';
|
|
11
11
|
import '@orpc/contract';
|
package/dist/helpers/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isSchemaIssue } from '@orpc/contract';
|
|
2
2
|
import { isTypescriptObject } from '@orpc/shared';
|
|
3
|
-
import { B as BracketNotationSerializer } from '../shared/openapi.
|
|
3
|
+
import { B as BracketNotationSerializer } from '../shared/openapi.B2G-HeFn.mjs';
|
|
4
4
|
|
|
5
5
|
function parseFormData(form) {
|
|
6
6
|
const serializer = new BracketNotationSerializer();
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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.Dl3gew1x.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.Dl3gew1x.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 OpenAPIVersion, a as OpenAPIDocument } from './shared/openapi.
|
|
7
|
-
export { b as JsonifiedArray, c as JsonifiedClientError, d as JsonifiedValue } from './shared/openapi.
|
|
6
|
+
import { J as JsonifiedClient, O as OpenAPIVersion, a as OpenAPIDocument } from './shared/openapi.DI21x5Yo.mjs';
|
|
7
|
+
export { b as JsonifiedArray, c as JsonifiedClientError, d as JsonifiedValue } from './shared/openapi.DI21x5Yo.mjs';
|
|
8
8
|
export { a as OpenAPIFunction, O as OpenAPIMeta, b as OpenAPIMetaPlugin, c as OpenAPIMethodMetaPlugin, d as OpenAPIPathMetaPlugin, e as OpenAPIPrefixMetaPlugin, f as OpenAPISpecMetaPlugin, g as getOpenAPIMeta, o as openapi } from './shared/openapi.Cem81Zhm.mjs';
|
|
9
9
|
import { JsonSchema, JsonSchemaConverter } from '@orpc/json-schema';
|
|
10
10
|
import { AnyRouter, AnyProcedure } from '@orpc/server';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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.Dl3gew1x.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.Dl3gew1x.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 OpenAPIVersion, a as OpenAPIDocument } from './shared/openapi.
|
|
7
|
-
export { b as JsonifiedArray, c as JsonifiedClientError, d as JsonifiedValue } from './shared/openapi.
|
|
6
|
+
import { J as JsonifiedClient, O as OpenAPIVersion, a as OpenAPIDocument } from './shared/openapi.DI21x5Yo.js';
|
|
7
|
+
export { b as JsonifiedArray, c as JsonifiedClientError, d as JsonifiedValue } from './shared/openapi.DI21x5Yo.js';
|
|
8
8
|
export { a as OpenAPIFunction, O as OpenAPIMeta, b as OpenAPIMetaPlugin, c as OpenAPIMethodMetaPlugin, d as OpenAPIPathMetaPlugin, e as OpenAPIPrefixMetaPlugin, f as OpenAPISpecMetaPlugin, g as getOpenAPIMeta, o as openapi } from './shared/openapi.Cem81Zhm.js';
|
|
9
9
|
import { JsonSchema, JsonSchemaConverter } from '@orpc/json-schema';
|
|
10
10
|
import { AnyRouter, AnyProcedure } from '@orpc/server';
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { B as BracketNotationSerializer } from './shared/openapi.
|
|
1
|
+
export { B as BracketNotationSerializer } from './shared/openapi.B2G-HeFn.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.DAmA59tr.mjs';
|
|
4
|
+
export { d as OpenAPIJsonSerializer } from './shared/openapi.DAmA59tr.mjs';
|
|
5
5
|
import { g as getOpenAPIMeta, o as openapi } from './shared/openapi.B9PQzqBn.mjs';
|
|
6
6
|
import { downgradeSpecV32ToV31, downgradeSpecV31ToV30 } from '@openapi-spec/downgrader';
|
|
7
7
|
import { COMMON_ERROR_STATUS_MAP } from '@orpc/client';
|
|
@@ -581,7 +581,7 @@ function extractDetailedResponseParts(schema, defaultStatus) {
|
|
|
581
581
|
}
|
|
582
582
|
function buildErrorResponse(ctx, operation, def) {
|
|
583
583
|
const definitionsByStatus = /* @__PURE__ */ new Map();
|
|
584
|
-
for (const code
|
|
584
|
+
for (const code of Object.keys(def.errorMap)) {
|
|
585
585
|
const config = def.errorMap[code];
|
|
586
586
|
if (!config) {
|
|
587
587
|
continue;
|
|
@@ -864,7 +864,7 @@ function populateRouterContractOpenAPIPaths(router, options = {}) {
|
|
|
864
864
|
return router;
|
|
865
865
|
}
|
|
866
866
|
const populated = {};
|
|
867
|
-
for (const key
|
|
867
|
+
for (const key of Object.keys(router)) {
|
|
868
868
|
populated[key] = populateRouterContractOpenAPIPaths(
|
|
869
869
|
router[key],
|
|
870
870
|
{ ...options, path: [...path, key] }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isPlainObject, NullProtoObj } from '@orpc/shared';
|
|
1
|
+
import { isPlainObject, NullProtoObj, getOwn, setOwn } from '@orpc/shared';
|
|
2
2
|
|
|
3
3
|
class BracketNotationSerializer {
|
|
4
4
|
maxExplicitDeserializingArrayIndex;
|
|
@@ -16,7 +16,7 @@ class BracketNotationSerializer {
|
|
|
16
16
|
this.internalSerialize(item, isRoot ? i.toString() : `${path}[${i}]`, false, result);
|
|
17
17
|
});
|
|
18
18
|
} else if (isPlainObject(data)) {
|
|
19
|
-
for (const key
|
|
19
|
+
for (const key of Object.keys(data)) {
|
|
20
20
|
this.internalSerialize(data[key], isRoot ? key : `${path}[${key}]`, false, result);
|
|
21
21
|
}
|
|
22
22
|
} else {
|
|
@@ -24,62 +24,49 @@ class BracketNotationSerializer {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
deserialize(serialized) {
|
|
27
|
-
if (serialized.length === 0) {
|
|
28
|
-
return new NullProtoObj();
|
|
29
|
-
}
|
|
30
27
|
const arrayPushStyles = /* @__PURE__ */ new WeakSet();
|
|
31
|
-
const
|
|
28
|
+
const root = new NullProtoObj();
|
|
32
29
|
for (const [path, value] of serialized) {
|
|
33
30
|
const segments = this.parsePath(path);
|
|
34
|
-
let currentRef =
|
|
35
|
-
let nextSegment =
|
|
36
|
-
for (let i =
|
|
31
|
+
let currentRef = root;
|
|
32
|
+
let nextSegment = segments[0];
|
|
33
|
+
for (let i = 1; i < segments.length; i++) {
|
|
37
34
|
const segment = segments[i];
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
const isLast = i === segments.length - 1;
|
|
36
|
+
const existing = getOwn(currentRef, nextSegment);
|
|
37
|
+
let child = existing;
|
|
38
|
+
if (!Array.isArray(child) && !isPlainObject(child)) {
|
|
39
|
+
child = [];
|
|
40
40
|
}
|
|
41
|
-
if (
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
currentRef[nextSegment] = internalArrayToObject(currentRef[nextSegment]);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
} else {
|
|
51
|
-
if (Array.isArray(currentRef[nextSegment])) {
|
|
52
|
-
if (segment === "") {
|
|
53
|
-
if (currentRef[nextSegment].length && !arrayPushStyles.has(currentRef[nextSegment])) {
|
|
54
|
-
currentRef[nextSegment] = internalArrayToObject(currentRef[nextSegment]);
|
|
55
|
-
}
|
|
56
|
-
} else {
|
|
57
|
-
if (arrayPushStyles.has(currentRef[nextSegment])) {
|
|
58
|
-
arrayPushStyles.delete(currentRef[nextSegment]);
|
|
59
|
-
currentRef[nextSegment] = internalPushStyleArrayToObject(currentRef[nextSegment]);
|
|
60
|
-
} else if (!internalIsValidArrayIndex(segment, this.maxExplicitDeserializingArrayIndex)) {
|
|
61
|
-
currentRef[nextSegment] = internalArrayToObject(currentRef[nextSegment]);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
41
|
+
if (Array.isArray(child)) {
|
|
42
|
+
const isPushStyle = arrayPushStyles.has(child);
|
|
43
|
+
const canStayArray = segment === "" ? isLast && (isPushStyle || child.length === 0) : internalIsValidArrayIndex(segment, this.maxExplicitDeserializingArrayIndex) && !(isLast && isPushStyle);
|
|
44
|
+
if (!canStayArray) {
|
|
45
|
+
arrayPushStyles.delete(child);
|
|
46
|
+
child = isPushStyle ? internalPushStyleArrayToObject(child) : internalArrayToObject(child);
|
|
64
47
|
}
|
|
65
48
|
}
|
|
66
|
-
|
|
49
|
+
if (child !== existing) {
|
|
50
|
+
setOwn(currentRef, nextSegment, child);
|
|
51
|
+
}
|
|
52
|
+
currentRef = child;
|
|
67
53
|
nextSegment = segment;
|
|
68
54
|
}
|
|
69
55
|
if (Array.isArray(currentRef) && nextSegment === "") {
|
|
70
56
|
arrayPushStyles.add(currentRef);
|
|
71
57
|
currentRef.push(value);
|
|
72
|
-
} else if (nextSegment
|
|
73
|
-
|
|
74
|
-
|
|
58
|
+
} else if (Object.hasOwn(currentRef, nextSegment)) {
|
|
59
|
+
const current = currentRef[nextSegment];
|
|
60
|
+
if (Array.isArray(current)) {
|
|
61
|
+
current.push(value);
|
|
75
62
|
} else {
|
|
76
|
-
currentRef
|
|
63
|
+
setOwn(currentRef, nextSegment, [current, value]);
|
|
77
64
|
}
|
|
78
65
|
} else {
|
|
79
|
-
currentRef
|
|
66
|
+
setOwn(currentRef, nextSegment, value);
|
|
80
67
|
}
|
|
81
68
|
}
|
|
82
|
-
return
|
|
69
|
+
return root;
|
|
83
70
|
}
|
|
84
71
|
stringifyPath(segments) {
|
|
85
72
|
if (segments.length === 0) {
|
|
@@ -3,7 +3,7 @@ import { StandardLinkCodec, StandardLinkCodecDecodedResponse } from '@orpc/clien
|
|
|
3
3
|
import { RouterContract } from '@orpc/contract';
|
|
4
4
|
import { Value, Promisable, Public } from '@orpc/shared';
|
|
5
5
|
import { StandardUrl, StandardHeaders, StandardLazyResponse, StandardRequest } from '@standard-server/core';
|
|
6
|
-
import { O as OpenAPISerializer } from './openapi.
|
|
6
|
+
import { O as OpenAPISerializer } from './openapi.Dl3gew1x.js';
|
|
7
7
|
|
|
8
8
|
interface OpenAPILinkCodecOptions<T extends ClientContext> {
|
|
9
9
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { wrapAsyncIteratorPreservingEventMeta, toORPCError, isORPCErrorJson, createORPCErrorFromJson } from '@orpc/client';
|
|
2
2
|
import { isPlainObject, NullProtoObj, isAsyncIteratorObject } from '@orpc/shared';
|
|
3
3
|
import { ErrorEvent } from '@standard-server/core';
|
|
4
|
-
import { B as BracketNotationSerializer } from './openapi.
|
|
4
|
+
import { B as BracketNotationSerializer } from './openapi.B2G-HeFn.mjs';
|
|
5
5
|
|
|
6
6
|
const DEFAULT_OPENAPI_METHOD = "POST";
|
|
7
7
|
const DEFAULT_OPENAPI_SUCCESS_DESCRIPTION = "OK";
|
|
@@ -57,15 +57,6 @@ const DEFAULT_OPEN_API_JSON_SERIALIZER_HANDLERS = {
|
|
|
57
57
|
},
|
|
58
58
|
isTerminal: true
|
|
59
59
|
},
|
|
60
|
-
regexp: {
|
|
61
|
-
condition(data) {
|
|
62
|
-
return data instanceof RegExp;
|
|
63
|
-
},
|
|
64
|
-
serialize(data) {
|
|
65
|
-
return data.toString();
|
|
66
|
-
},
|
|
67
|
-
isTerminal: true
|
|
68
|
-
},
|
|
69
60
|
set: {
|
|
70
61
|
condition(data) {
|
|
71
62
|
return data instanceof Set;
|
|
@@ -96,7 +87,7 @@ class OpenAPIJsonSerializer {
|
|
|
96
87
|
}
|
|
97
88
|
let inlineBuiltInHandlers = true;
|
|
98
89
|
let handlerEntries = [];
|
|
99
|
-
for (const key
|
|
90
|
+
for (const key of Object.keys(customHandlers)) {
|
|
100
91
|
const handler = customHandlers[key];
|
|
101
92
|
if (inlineBuiltInHandlers && key in DEFAULT_OPEN_API_JSON_SERIALIZER_HANDLERS) {
|
|
102
93
|
inlineBuiltInHandlers = false;
|
|
@@ -149,9 +140,6 @@ class OpenAPIJsonSerializer {
|
|
|
149
140
|
if (data instanceof URL) {
|
|
150
141
|
return data.toString();
|
|
151
142
|
}
|
|
152
|
-
if (data instanceof RegExp) {
|
|
153
|
-
return data.toString();
|
|
154
|
-
}
|
|
155
143
|
if (data instanceof Set) {
|
|
156
144
|
return this.serializeValue(Array.from(data), segments, maps, blobs);
|
|
157
145
|
}
|
|
@@ -194,7 +182,7 @@ class OpenAPIJsonSerializer {
|
|
|
194
182
|
}
|
|
195
183
|
if (isPlainObject(data)) {
|
|
196
184
|
const json = new NullProtoObj();
|
|
197
|
-
for (const k
|
|
185
|
+
for (const k of Object.keys(data)) {
|
|
198
186
|
const v = data[k];
|
|
199
187
|
if (k === "toJSON" && typeof v === "function") {
|
|
200
188
|
continue;
|
|
@@ -221,7 +209,7 @@ class OpenAPIJsonSerializer {
|
|
|
221
209
|
currentRef = currentRef[preSegment];
|
|
222
210
|
preSegment = segments[j];
|
|
223
211
|
if (!Object.hasOwn(currentRef, preSegment)) {
|
|
224
|
-
throw new
|
|
212
|
+
throw new TypeError(`Invalid OpenAPI serialized data: segment "${preSegment}" does not exist.`);
|
|
225
213
|
}
|
|
226
214
|
}
|
|
227
215
|
currentRef[preSegment] = serialized.blobs[i];
|
|
@@ -253,12 +241,10 @@ class OpenAPISerializer {
|
|
|
253
241
|
}
|
|
254
242
|
return { done: result.done, value: this.serializeValue(result.value, false, false) };
|
|
255
243
|
},
|
|
256
|
-
mapError: (e) =>
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
});
|
|
261
|
-
}
|
|
244
|
+
mapError: (e) => new ErrorEvent(
|
|
245
|
+
this.serializeValue(toORPCError(e).toJSON(), false, false),
|
|
246
|
+
{ cause: e }
|
|
247
|
+
)
|
|
262
248
|
});
|
|
263
249
|
}
|
|
264
250
|
}
|
|
@@ -3,7 +3,7 @@ import { StandardLinkCodec, StandardLinkCodecDecodedResponse } from '@orpc/clien
|
|
|
3
3
|
import { RouterContract } from '@orpc/contract';
|
|
4
4
|
import { Value, Promisable, Public } from '@orpc/shared';
|
|
5
5
|
import { StandardUrl, StandardHeaders, StandardLazyResponse, StandardRequest } from '@standard-server/core';
|
|
6
|
-
import { O as OpenAPISerializer } from './openapi.
|
|
6
|
+
import { O as OpenAPISerializer } from './openapi.Dl3gew1x.mjs';
|
|
7
7
|
|
|
8
8
|
interface OpenAPILinkCodecOptions<T extends ClientContext> {
|
|
9
9
|
/**
|
|
@@ -16,7 +16,7 @@ type OpenAPIVersion = `3.0.${number}` | `3.1.${number}` | `3.2.${number}`;
|
|
|
16
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;
|
|
17
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> ? {
|
|
18
18
|
[K in keyof T]: JsonifiedValue<T[K]>;
|
|
19
|
-
} : T extends Date ? string : T extends bigint ? string : T extends File ? File : T extends Blob ? Blob : T extends
|
|
19
|
+
} : T extends Date ? string : T extends bigint ? string : T extends File ? File : T extends Blob ? Blob : 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;
|
|
20
20
|
type JsonifiedArray<T extends Array<unknown>> = T extends readonly [] ? [] : T extends readonly [infer U, ...infer V] ? [U extends undefined ? null : JsonifiedValue<U>, ...JsonifiedArray<V>] : T extends Array<infer U> ? Array<JsonifiedValue<U>> : unknown;
|
|
21
21
|
type JsonifiedClientError<T> = T extends ORPCError<infer UCode, infer UData> ? ORPCError<UCode, JsonifiedValue<UData>> : T;
|
|
22
22
|
/**
|
|
@@ -16,7 +16,7 @@ type OpenAPIVersion = `3.0.${number}` | `3.1.${number}` | `3.2.${number}`;
|
|
|
16
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;
|
|
17
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> ? {
|
|
18
18
|
[K in keyof T]: JsonifiedValue<T[K]>;
|
|
19
|
-
} : T extends Date ? string : T extends bigint ? string : T extends File ? File : T extends Blob ? Blob : T extends
|
|
19
|
+
} : T extends Date ? string : T extends bigint ? string : T extends File ? File : T extends Blob ? Blob : 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;
|
|
20
20
|
type JsonifiedArray<T extends Array<unknown>> = T extends readonly [] ? [] : T extends readonly [infer U, ...infer V] ? [U extends undefined ? null : JsonifiedValue<U>, ...JsonifiedArray<V>] : T extends Array<infer U> ? Array<JsonifiedValue<U>> : unknown;
|
|
21
21
|
type JsonifiedClientError<T> = T extends ORPCError<infer UCode, infer UData> ? ORPCError<UCode, JsonifiedValue<UData>> : T;
|
|
22
22
|
/**
|
|
@@ -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
|
-
import { value, pathToHttpPath, mergeHttpPath, normalizeHttpPath,
|
|
3
|
+
import { value, pathToHttpPath, mergeHttpPath, normalizeHttpPath, safeDecodeURIComponent, NullProtoObj, isTypescriptObject, isPlainObject, stringifyJSON, getOwn, parseEmptyableJSON } from '@orpc/shared';
|
|
4
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.
|
|
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.DAmA59tr.mjs';
|
|
6
6
|
import { g as getOpenAPIMeta } from './openapi.B9PQzqBn.mjs';
|
|
7
7
|
import { createRouter, addRoute, findRoute, routeToRegExp } from 'rou3';
|
|
8
8
|
|
|
@@ -135,7 +135,7 @@ function toRou3PrefixMatcher(path) {
|
|
|
135
135
|
return routeToRegExp(pattern === "/" ? "/**" : `${pattern}/**`);
|
|
136
136
|
}
|
|
137
137
|
function decodeParams(params) {
|
|
138
|
-
return Object.fromEntries(Object.entries(params).map(([key, val]) => [key,
|
|
138
|
+
return Object.fromEntries(Object.entries(params).map(([key, val]) => [key, safeDecodeURIComponent(val)]));
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
function serializeHeaders(headers, serializer) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createORPCErrorFromMalformedResponse, isORPCErrorJson, createORPCErrorFromJson } from '@orpc/client';
|
|
2
2
|
import { getRouterContract, ProcedureContract } from '@orpc/contract';
|
|
3
3
|
import { unlazy } from '@orpc/server';
|
|
4
|
-
import { value, pathToHttpPath, mergeHttpPath, isTypescriptObject, stringifyJSON } from '@orpc/shared';
|
|
4
|
+
import { value, pathToHttpPath, mergeHttpPath, isTypescriptObject, stringifyJSON, safeEncodeURIComponent } from '@orpc/shared';
|
|
5
5
|
import { mergeStandardHeaders, parseStandardUrl } from '@standard-server/core';
|
|
6
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.
|
|
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.DAmA59tr.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.DI39r-Ta.mjs';
|
|
10
10
|
|
|
11
11
|
const END_SLASH_REGEX = /\/$/;
|
|
12
12
|
class OpenAPILinkCodec {
|
|
@@ -129,16 +129,16 @@ class OpenAPILinkCodec {
|
|
|
129
129
|
encodePathParam(val, param, style, path) {
|
|
130
130
|
let encoded;
|
|
131
131
|
if (style === "comma-delimited-array" && Array.isArray(val)) {
|
|
132
|
-
encoded = val.map((val2) => this.serializer.serialize(val2)).filter((val2) => val2 !== void 0 && val2 !== null).map((val2) =>
|
|
132
|
+
encoded = val.map((val2) => this.serializer.serialize(val2)).filter((val2) => val2 !== void 0 && val2 !== null).map((val2) => safeEncodeURIComponent(String(val2))).join(",");
|
|
133
133
|
} else if (style === "comma-delimited-object" && isTypescriptObject(val)) {
|
|
134
|
-
encoded = Object.entries(val).map(([key, val2]) => [key, this.serializer.serialize(val2)]).filter(([, val2]) => val2 !== void 0 && val2 !== null).map(([key, val2]) => `${
|
|
134
|
+
encoded = Object.entries(val).map(([key, val2]) => [key, this.serializer.serialize(val2)]).filter(([, val2]) => val2 !== void 0 && val2 !== null).map(([key, val2]) => `${safeEncodeURIComponent(String(key))},${safeEncodeURIComponent(String(val2))}`).join(",");
|
|
135
135
|
} else {
|
|
136
136
|
const serialized = this.serializer.serialize(val);
|
|
137
137
|
if (serialized !== void 0 && serialized !== null) {
|
|
138
138
|
if (param.allowsSlash) {
|
|
139
|
-
encoded = String(serialized).split("/").map(
|
|
139
|
+
encoded = String(serialized).split("/").map(safeEncodeURIComponent).join("/");
|
|
140
140
|
} else {
|
|
141
|
-
encoded =
|
|
141
|
+
encoded = safeEncodeURIComponent(String(serialized));
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
}
|
|
@@ -81,10 +81,10 @@ interface OpenAPIJsonSerializerOptions {
|
|
|
81
81
|
*
|
|
82
82
|
* **Disabling:** Set a key to `undefined` to remove a built-in handler:
|
|
83
83
|
* ```ts
|
|
84
|
-
* handlers: {
|
|
84
|
+
* handlers: { url: undefined }
|
|
85
85
|
* ```
|
|
86
86
|
*
|
|
87
|
-
* Built-in type keys: `undefined`, `bigint`, `date`, `nan`, `url`, `
|
|
87
|
+
* Built-in type keys: `undefined`, `bigint`, `date`, `nan`, `url`, `set`, `map`.
|
|
88
88
|
*/
|
|
89
89
|
handlers?: Record<string, undefined | OpenAPIJsonSerializerHandler> | undefined;
|
|
90
90
|
/**
|
|
@@ -81,10 +81,10 @@ interface OpenAPIJsonSerializerOptions {
|
|
|
81
81
|
*
|
|
82
82
|
* **Disabling:** Set a key to `undefined` to remove a built-in handler:
|
|
83
83
|
* ```ts
|
|
84
|
-
* handlers: {
|
|
84
|
+
* handlers: { url: undefined }
|
|
85
85
|
* ```
|
|
86
86
|
*
|
|
87
|
-
* Built-in type keys: `undefined`, `bigint`, `date`, `nan`, `url`, `
|
|
87
|
+
* Built-in type keys: `undefined`, `bigint`, `date`, `nan`, `url`, `set`, `map`.
|
|
88
88
|
*/
|
|
89
89
|
handlers?: Record<string, undefined | OpenAPIJsonSerializerHandler> | undefined;
|
|
90
90
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AnyORPCError } from '@orpc/client';
|
|
2
2
|
import { AnyProcedure, AnyRouter, Context } from '@orpc/server';
|
|
3
|
-
import { StandardHandlerCodec,
|
|
3
|
+
import { StandardHandlerCodec, ResolvedStandardHandlerHandleOptions, StandardHandlerCodecResolvedProcedure } from '@orpc/server/standard';
|
|
4
4
|
import { Value, Public, Promisable } from '@orpc/shared';
|
|
5
5
|
import { StandardLazyRequest, StandardResponse } from '@standard-server/core';
|
|
6
6
|
import { AnyProcedureContract } from '@orpc/contract';
|
|
7
|
-
import { O as OpenAPISerializer } from './openapi.
|
|
7
|
+
import { O as OpenAPISerializer } from './openapi.Dl3gew1x.js';
|
|
8
8
|
|
|
9
9
|
interface OpenAPIMatcherOptions {
|
|
10
10
|
/**
|
|
@@ -78,7 +78,7 @@ interface OpenAPIHandlerCodecOptions<T extends Context> extends OpenAPIHandlerCo
|
|
|
78
78
|
declare class OpenAPIHandlerCodec<T extends Context> extends OpenAPIHandlerCodecCore<T> implements StandardHandlerCodec<T> {
|
|
79
79
|
private readonly matcher;
|
|
80
80
|
constructor(router: AnyRouter, options?: OpenAPIHandlerCodecOptions<T>);
|
|
81
|
-
resolveProcedure(request: StandardLazyRequest, options:
|
|
81
|
+
resolveProcedure(request: StandardLazyRequest, options: ResolvedStandardHandlerHandleOptions<T>): Promise<StandardHandlerCodecResolvedProcedure | undefined>;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
export { OpenAPIHandlerCodec as a, OpenAPIHandlerCodecCore as b, OpenAPIMatcher as d };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AnyORPCError } from '@orpc/client';
|
|
2
2
|
import { AnyProcedure, AnyRouter, Context } from '@orpc/server';
|
|
3
|
-
import { StandardHandlerCodec,
|
|
3
|
+
import { StandardHandlerCodec, ResolvedStandardHandlerHandleOptions, StandardHandlerCodecResolvedProcedure } from '@orpc/server/standard';
|
|
4
4
|
import { Value, Public, Promisable } from '@orpc/shared';
|
|
5
5
|
import { StandardLazyRequest, StandardResponse } from '@standard-server/core';
|
|
6
6
|
import { AnyProcedureContract } from '@orpc/contract';
|
|
7
|
-
import { O as OpenAPISerializer } from './openapi.
|
|
7
|
+
import { O as OpenAPISerializer } from './openapi.Dl3gew1x.mjs';
|
|
8
8
|
|
|
9
9
|
interface OpenAPIMatcherOptions {
|
|
10
10
|
/**
|
|
@@ -78,7 +78,7 @@ interface OpenAPIHandlerCodecOptions<T extends Context> extends OpenAPIHandlerCo
|
|
|
78
78
|
declare class OpenAPIHandlerCodec<T extends Context> extends OpenAPIHandlerCodecCore<T> implements StandardHandlerCodec<T> {
|
|
79
79
|
private readonly matcher;
|
|
80
80
|
constructor(router: AnyRouter, options?: OpenAPIHandlerCodecOptions<T>);
|
|
81
|
-
resolveProcedure(request: StandardLazyRequest, options:
|
|
81
|
+
resolveProcedure(request: StandardLazyRequest, options: ResolvedStandardHandlerHandleOptions<T>): Promise<StandardHandlerCodecResolvedProcedure | undefined>;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
export { OpenAPIHandlerCodec as a, OpenAPIHandlerCodecCore as b, OpenAPIMatcher as d };
|
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.37",
|
|
5
5
|
"description": "Generate OpenAPI specs from oRPC routers and serve OpenAPI-compliant APIs with end-to-end type safety",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": [
|
|
@@ -99,18 +99,18 @@
|
|
|
99
99
|
"dependencies": {
|
|
100
100
|
"@openapi-spec/downgrader": "~0.1.0",
|
|
101
101
|
"@openapi-spec/types": "~0.1.0",
|
|
102
|
-
"@orpc/client": "2.0.0-beta.
|
|
103
|
-
"@orpc/contract": "2.0.0-beta.
|
|
104
|
-
"@orpc/json-schema": "2.0.0-beta.
|
|
105
|
-
"@orpc/server": "2.0.0-beta.
|
|
106
|
-
"@orpc/shared": "2.0.0-beta.
|
|
107
|
-
"@standard-server/core": "~0.9.
|
|
108
|
-
"@standard-server/fetch": "~0.9.
|
|
102
|
+
"@orpc/client": "2.0.0-beta.37",
|
|
103
|
+
"@orpc/contract": "2.0.0-beta.37",
|
|
104
|
+
"@orpc/json-schema": "2.0.0-beta.37",
|
|
105
|
+
"@orpc/server": "2.0.0-beta.37",
|
|
106
|
+
"@orpc/shared": "2.0.0-beta.37",
|
|
107
|
+
"@standard-server/core": "~0.9.2",
|
|
108
|
+
"@standard-server/fetch": "~0.9.2",
|
|
109
109
|
"rou3": "^0.9.1"
|
|
110
110
|
},
|
|
111
111
|
"devDependencies": {
|
|
112
112
|
"@scalar/api-reference": "^1.65.1",
|
|
113
|
-
"@standard-server/aws-lambda": "~0.9.
|
|
113
|
+
"@standard-server/aws-lambda": "~0.9.2",
|
|
114
114
|
"@types/swagger-ui": "^5.32.0",
|
|
115
115
|
"fastify": "^5.12.1",
|
|
116
116
|
"swagger-ui": "^5.32.14",
|