@orpc/openapi 0.0.0-next.ff68fdb → 0.0.0-next.ff7ad2e
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 +30 -22
- package/dist/adapters/aws-lambda/index.d.mts +19 -0
- package/dist/adapters/aws-lambda/index.d.ts +19 -0
- package/dist/adapters/aws-lambda/index.mjs +18 -0
- package/dist/adapters/fetch/index.d.mts +14 -8
- package/dist/adapters/fetch/index.d.ts +14 -8
- package/dist/adapters/fetch/index.mjs +14 -7
- package/dist/adapters/node/index.d.mts +14 -8
- package/dist/adapters/node/index.d.ts +14 -8
- package/dist/adapters/node/index.mjs +9 -24
- package/dist/adapters/standard/index.d.mts +10 -15
- package/dist/adapters/standard/index.d.ts +10 -15
- package/dist/adapters/standard/index.mjs +5 -3
- package/dist/index.d.mts +38 -47
- package/dist/index.d.ts +38 -47
- package/dist/index.mjs +30 -292
- package/dist/plugins/index.d.mts +69 -0
- package/dist/plugins/index.d.ts +69 -0
- package/dist/plugins/index.mjs +108 -0
- package/dist/shared/openapi.1iT1iSZi.mjs +750 -0
- package/dist/shared/{openapi.CJTe38Ya.mjs → openapi.BVXcB0u4.mjs} +56 -14
- package/dist/shared/openapi.CQmjvnb0.d.mts +31 -0
- package/dist/shared/openapi.CQmjvnb0.d.ts +31 -0
- package/dist/shared/openapi.CfjfVeBJ.d.mts +108 -0
- package/dist/shared/openapi.CfjfVeBJ.d.ts +108 -0
- package/package.json +20 -23
- package/dist/adapters/hono/index.d.mts +0 -6
- package/dist/adapters/hono/index.d.ts +0 -6
- package/dist/adapters/hono/index.mjs +0 -11
- package/dist/adapters/next/index.d.mts +0 -6
- package/dist/adapters/next/index.d.ts +0 -6
- package/dist/adapters/next/index.mjs +0 -11
- package/dist/shared/openapi.CbzTVvGL.mjs +0 -31
- package/dist/shared/openapi.DZzpQAb-.mjs +0 -231
package/README.md
CHANGED
|
@@ -21,28 +21,24 @@
|
|
|
21
21
|
|
|
22
22
|
<h3 align="center">Typesafe APIs Made Simple 🪄</h3>
|
|
23
23
|
|
|
24
|
-
**oRPC is a powerful combination of RPC and OpenAPI**, makes it easy to build APIs that are end-to-end type-safe and adhere to OpenAPI standards
|
|
24
|
+
**oRPC is a powerful combination of RPC and OpenAPI**, makes it easy to build APIs that are end-to-end type-safe and adhere to OpenAPI standards
|
|
25
25
|
|
|
26
26
|
---
|
|
27
27
|
|
|
28
28
|
## Highlights
|
|
29
29
|
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
- **Reusability 🔄**: Write once and reuse your code across multiple purposes effortlessly.
|
|
43
|
-
- **Extendability 🔌**: Easily enhance oRPC with plugins, middleware, and interceptors.
|
|
44
|
-
- **Reliability 🛡️**: Well-tested, fully TypeScript, production-ready, and MIT licensed for peace of mind.
|
|
45
|
-
- **Simplicity 💡**: Enjoy straightforward, clean code with no hidden magic.
|
|
30
|
+
- **🔗 End-to-End Type Safety**: Ensure type-safe inputs, outputs, and errors from client to server.
|
|
31
|
+
- **📘 First-Class OpenAPI**: Built-in support that fully adheres to the OpenAPI standard.
|
|
32
|
+
- **📝 Contract-First Development**: Optionally define your API contract before implementation.
|
|
33
|
+
- **🔍 First-Class OpenTelemetry**: Seamlessly integrate with OpenTelemetry for observability.
|
|
34
|
+
- **⚙️ Framework Integrations**: Seamlessly integrate with TanStack Query (React, Vue, Solid, Svelte, Angular), SWR, Pinia Colada, and more.
|
|
35
|
+
- **🚀 Server Actions**: Fully compatible with React Server Actions on Next.js, TanStack Start, and other platforms.
|
|
36
|
+
- **🔠 Standard Schema Support**: Works out of the box with Zod, Valibot, ArkType, and other schema validators.
|
|
37
|
+
- **🗃️ Native Types**: Supports native types like Date, File, Blob, BigInt, URL, and more.
|
|
38
|
+
- **⏱️ Lazy Router**: Enhance cold start times with our lazy routing feature.
|
|
39
|
+
- **📡 SSE & Streaming**: Enjoy full type-safe support for SSE and streaming.
|
|
40
|
+
- **🌍 Multi-Runtime Support**: Fast and lightweight on Cloudflare, Deno, Bun, Node.js, and beyond.
|
|
41
|
+
- **🔌 Extendability**: Easily extend functionality with plugins, middleware, and interceptors.
|
|
46
42
|
|
|
47
43
|
## Documentation
|
|
48
44
|
|
|
@@ -53,13 +49,17 @@ You can find the full documentation [here](https://orpc.unnoq.com).
|
|
|
53
49
|
- [@orpc/contract](https://www.npmjs.com/package/@orpc/contract): Build your API contract.
|
|
54
50
|
- [@orpc/server](https://www.npmjs.com/package/@orpc/server): Build your API or implement API contract.
|
|
55
51
|
- [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
|
|
56
|
-
- [@orpc/react-query](https://www.npmjs.com/package/@orpc/react-query): Integration with [React Query](https://tanstack.com/query/latest/docs/framework/react/overview).
|
|
57
|
-
- [@orpc/vue-query](https://www.npmjs.com/package/@orpc/vue-query): Integration with [Vue Query](https://tanstack.com/query/latest/docs/framework/vue/overview).
|
|
58
|
-
- [@orpc/solid-query](https://www.npmjs.com/package/@orpc/solid-query): Integration with [Solid Query](https://tanstack.com/query/latest/docs/framework/solid/overview).
|
|
59
|
-
- [@orpc/svelte-query](https://www.npmjs.com/package/@orpc/svelte-query): Integration with [Svelte Query](https://tanstack.com/query/latest/docs/framework/svelte/overview).
|
|
60
|
-
- [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
|
|
61
52
|
- [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
|
|
53
|
+
- [@orpc/otel](https://www.npmjs.com/package/@orpc/otel): [OpenTelemetry](https://opentelemetry.io/) integration for observability.
|
|
54
|
+
- [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Deeply integrate oRPC with [NestJS](https://nestjs.com/).
|
|
55
|
+
- [@orpc/react](https://www.npmjs.com/package/@orpc/react): Utilities for integrating oRPC with React and React Server Actions.
|
|
56
|
+
- [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query): [TanStack Query](https://tanstack.com/query/latest) integration.
|
|
57
|
+
- [@orpc/experimental-react-swr](https://www.npmjs.com/package/@orpc/experimental-react-swr): [SWR](https://swr.vercel.app/) integration.
|
|
58
|
+
- [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
|
|
59
|
+
- [@orpc/hey-api](https://www.npmjs.com/package/@orpc/hey-api): [Hey API](https://heyapi.dev/) integration.
|
|
62
60
|
- [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
|
|
61
|
+
- [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot): OpenAPI spec generation from [Valibot](https://valibot.dev/).
|
|
62
|
+
- [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype): OpenAPI spec generation from [ArkType](https://arktype.io/).
|
|
63
63
|
|
|
64
64
|
## `@orpc/openapi`
|
|
65
65
|
|
|
@@ -88,6 +88,14 @@ const server = createServer(async (req, res) => {
|
|
|
88
88
|
server.listen(3000, '127.0.0.1', () => console.log('Listening on 127.0.0.1:3000'))
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
+
## Sponsors
|
|
92
|
+
|
|
93
|
+
<p align="center">
|
|
94
|
+
<a href="https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg">
|
|
95
|
+
<img src='https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg'/>
|
|
96
|
+
</a>
|
|
97
|
+
</p>
|
|
98
|
+
|
|
91
99
|
## License
|
|
92
100
|
|
|
93
101
|
Distributed under the MIT License. See [LICENSE](https://github.com/unnoq/orpc/blob/main/LICENSE) for more information.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Context, Router } from '@orpc/server';
|
|
2
|
+
import { AwsLambdaHandler, AwsLambdaHandlerOptions } from '@orpc/server/aws-lambda';
|
|
3
|
+
import { S as StandardOpenAPIHandlerOptions } from '../../shared/openapi.CQmjvnb0.mjs';
|
|
4
|
+
import '@orpc/openapi-client/standard';
|
|
5
|
+
import '@orpc/server/standard';
|
|
6
|
+
import '@orpc/client';
|
|
7
|
+
import '@orpc/shared';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* OpenAPI Handler for AWS Lambda.
|
|
11
|
+
*
|
|
12
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-handler OpenAPI Handler Docs}
|
|
13
|
+
* @see {@link https://orpc.unnoq.com/docs/adapters/http HTTP Adapter Docs}
|
|
14
|
+
*/
|
|
15
|
+
declare class OpenAPIHandler<T extends Context> extends AwsLambdaHandler<T> {
|
|
16
|
+
constructor(router: Router<any, T>, options?: NoInfer<StandardOpenAPIHandlerOptions<T> & AwsLambdaHandlerOptions>);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { OpenAPIHandler };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Context, Router } from '@orpc/server';
|
|
2
|
+
import { AwsLambdaHandler, AwsLambdaHandlerOptions } from '@orpc/server/aws-lambda';
|
|
3
|
+
import { S as StandardOpenAPIHandlerOptions } from '../../shared/openapi.CQmjvnb0.js';
|
|
4
|
+
import '@orpc/openapi-client/standard';
|
|
5
|
+
import '@orpc/server/standard';
|
|
6
|
+
import '@orpc/client';
|
|
7
|
+
import '@orpc/shared';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* OpenAPI Handler for AWS Lambda.
|
|
11
|
+
*
|
|
12
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-handler OpenAPI Handler Docs}
|
|
13
|
+
* @see {@link https://orpc.unnoq.com/docs/adapters/http HTTP Adapter Docs}
|
|
14
|
+
*/
|
|
15
|
+
declare class OpenAPIHandler<T extends Context> extends AwsLambdaHandler<T> {
|
|
16
|
+
constructor(router: Router<any, T>, options?: NoInfer<StandardOpenAPIHandlerOptions<T> & AwsLambdaHandlerOptions>);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { OpenAPIHandler };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AwsLambdaHandler } from '@orpc/server/aws-lambda';
|
|
2
|
+
import '@orpc/client';
|
|
3
|
+
import '@orpc/contract';
|
|
4
|
+
import '@orpc/shared';
|
|
5
|
+
import { a as StandardOpenAPIHandler } from '../../shared/openapi.BVXcB0u4.mjs';
|
|
6
|
+
import '@orpc/client/standard';
|
|
7
|
+
import '@orpc/server';
|
|
8
|
+
import 'rou3';
|
|
9
|
+
import '@orpc/openapi-client/standard';
|
|
10
|
+
import '@orpc/server/standard';
|
|
11
|
+
|
|
12
|
+
class OpenAPIHandler extends AwsLambdaHandler {
|
|
13
|
+
constructor(router, options = {}) {
|
|
14
|
+
super(new StandardOpenAPIHandler(router, options), options);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { OpenAPIHandler };
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import { Context, Router } from '@orpc/server';
|
|
2
|
-
import { FetchHandler,
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
2
|
+
import { FetchHandler, FetchHandlerOptions } from '@orpc/server/fetch';
|
|
3
|
+
import { S as StandardOpenAPIHandlerOptions } from '../../shared/openapi.CQmjvnb0.mjs';
|
|
4
|
+
import '@orpc/openapi-client/standard';
|
|
5
|
+
import '@orpc/server/standard';
|
|
6
|
+
import '@orpc/client';
|
|
7
|
+
import '@orpc/shared';
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
/**
|
|
10
|
+
* OpenAPI Handler for Fetch Server
|
|
11
|
+
*
|
|
12
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-handler OpenAPI Handler Docs}
|
|
13
|
+
* @see {@link https://orpc.unnoq.com/docs/adapters/http HTTP Adapter Docs}
|
|
14
|
+
*/
|
|
15
|
+
declare class OpenAPIHandler<T extends Context> extends FetchHandler<T> {
|
|
16
|
+
constructor(router: Router<any, T>, options?: NoInfer<StandardOpenAPIHandlerOptions<T> & FetchHandlerOptions<T>>);
|
|
11
17
|
}
|
|
12
18
|
|
|
13
19
|
export { OpenAPIHandler };
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import { Context, Router } from '@orpc/server';
|
|
2
|
-
import { FetchHandler,
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
2
|
+
import { FetchHandler, FetchHandlerOptions } from '@orpc/server/fetch';
|
|
3
|
+
import { S as StandardOpenAPIHandlerOptions } from '../../shared/openapi.CQmjvnb0.js';
|
|
4
|
+
import '@orpc/openapi-client/standard';
|
|
5
|
+
import '@orpc/server/standard';
|
|
6
|
+
import '@orpc/client';
|
|
7
|
+
import '@orpc/shared';
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
/**
|
|
10
|
+
* OpenAPI Handler for Fetch Server
|
|
11
|
+
*
|
|
12
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-handler OpenAPI Handler Docs}
|
|
13
|
+
* @see {@link https://orpc.unnoq.com/docs/adapters/http HTTP Adapter Docs}
|
|
14
|
+
*/
|
|
15
|
+
declare class OpenAPIHandler<T extends Context> extends FetchHandler<T> {
|
|
16
|
+
constructor(router: Router<any, T>, options?: NoInfer<StandardOpenAPIHandlerOptions<T> & FetchHandlerOptions<T>>);
|
|
11
17
|
}
|
|
12
18
|
|
|
13
19
|
export { OpenAPIHandler };
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
import '@orpc/
|
|
3
|
-
import '@orpc/server/standard';
|
|
4
|
-
import '@orpc/standard-server-fetch';
|
|
5
|
-
import '../../shared/openapi.CJTe38Ya.mjs';
|
|
1
|
+
import { FetchHandler } from '@orpc/server/fetch';
|
|
2
|
+
import '@orpc/client';
|
|
6
3
|
import '@orpc/contract';
|
|
7
4
|
import '@orpc/shared';
|
|
5
|
+
import { a as StandardOpenAPIHandler } from '../../shared/openapi.BVXcB0u4.mjs';
|
|
6
|
+
import '@orpc/client/standard';
|
|
8
7
|
import '@orpc/server';
|
|
9
8
|
import 'rou3';
|
|
10
|
-
import '
|
|
11
|
-
import '
|
|
9
|
+
import '@orpc/openapi-client/standard';
|
|
10
|
+
import '@orpc/server/standard';
|
|
11
|
+
|
|
12
|
+
class OpenAPIHandler extends FetchHandler {
|
|
13
|
+
constructor(router, options = {}) {
|
|
14
|
+
super(new StandardOpenAPIHandler(router, options), options);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { OpenAPIHandler };
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import { Context, Router } from '@orpc/server';
|
|
2
|
-
import { NodeHttpHandler,
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
2
|
+
import { NodeHttpHandler, NodeHttpHandlerOptions } from '@orpc/server/node';
|
|
3
|
+
import { S as StandardOpenAPIHandlerOptions } from '../../shared/openapi.CQmjvnb0.mjs';
|
|
4
|
+
import '@orpc/openapi-client/standard';
|
|
5
|
+
import '@orpc/server/standard';
|
|
6
|
+
import '@orpc/client';
|
|
7
|
+
import '@orpc/shared';
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
/**
|
|
10
|
+
* OpenAPI Handler for Node Server
|
|
11
|
+
*
|
|
12
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-handler OpenAPI Handler Docs}
|
|
13
|
+
* @see {@link https://orpc.unnoq.com/docs/adapters/http HTTP Adapter Docs}
|
|
14
|
+
*/
|
|
15
|
+
declare class OpenAPIHandler<T extends Context> extends NodeHttpHandler<T> {
|
|
16
|
+
constructor(router: Router<any, T>, options?: NoInfer<StandardOpenAPIHandlerOptions<T> & NodeHttpHandlerOptions<T>>);
|
|
11
17
|
}
|
|
12
18
|
|
|
13
19
|
export { OpenAPIHandler };
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import { Context, Router } from '@orpc/server';
|
|
2
|
-
import { NodeHttpHandler,
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
2
|
+
import { NodeHttpHandler, NodeHttpHandlerOptions } from '@orpc/server/node';
|
|
3
|
+
import { S as StandardOpenAPIHandlerOptions } from '../../shared/openapi.CQmjvnb0.js';
|
|
4
|
+
import '@orpc/openapi-client/standard';
|
|
5
|
+
import '@orpc/server/standard';
|
|
6
|
+
import '@orpc/client';
|
|
7
|
+
import '@orpc/shared';
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
/**
|
|
10
|
+
* OpenAPI Handler for Node Server
|
|
11
|
+
*
|
|
12
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-handler OpenAPI Handler Docs}
|
|
13
|
+
* @see {@link https://orpc.unnoq.com/docs/adapters/http HTTP Adapter Docs}
|
|
14
|
+
*/
|
|
15
|
+
declare class OpenAPIHandler<T extends Context> extends NodeHttpHandler<T> {
|
|
16
|
+
constructor(router: Router<any, T>, options?: NoInfer<StandardOpenAPIHandlerOptions<T> & NodeHttpHandlerOptions<T>>);
|
|
11
17
|
}
|
|
12
18
|
|
|
13
19
|
export { OpenAPIHandler };
|
|
@@ -1,32 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { toStandardLazyRequest, sendStandardResponse } from '@orpc/standard-server-node';
|
|
4
|
-
import { a as OpenAPIMatcher, O as OpenAPICodec } from '../../shared/openapi.CJTe38Ya.mjs';
|
|
5
|
-
import '@orpc/shared';
|
|
6
|
-
import 'json-schema-typed/draft-2020-12';
|
|
1
|
+
import { NodeHttpHandler } from '@orpc/server/node';
|
|
2
|
+
import '@orpc/client';
|
|
7
3
|
import '@orpc/contract';
|
|
4
|
+
import '@orpc/shared';
|
|
5
|
+
import { a as StandardOpenAPIHandler } from '../../shared/openapi.BVXcB0u4.mjs';
|
|
6
|
+
import '@orpc/client/standard';
|
|
8
7
|
import '@orpc/server';
|
|
9
8
|
import 'rou3';
|
|
10
|
-
import '
|
|
9
|
+
import '@orpc/openapi-client/standard';
|
|
10
|
+
import '@orpc/server/standard';
|
|
11
11
|
|
|
12
|
-
class OpenAPIHandler {
|
|
13
|
-
standardHandler;
|
|
12
|
+
class OpenAPIHandler extends NodeHttpHandler {
|
|
14
13
|
constructor(router, options = {}) {
|
|
15
|
-
|
|
16
|
-
const matcher = new OpenAPIMatcher();
|
|
17
|
-
const codec = new OpenAPICodec(serializer);
|
|
18
|
-
this.standardHandler = new StandardHandler(router, matcher, codec, options);
|
|
19
|
-
}
|
|
20
|
-
async handle(req, res, ...[
|
|
21
|
-
options = {}
|
|
22
|
-
]) {
|
|
23
|
-
const standardRequest = toStandardLazyRequest(req, res);
|
|
24
|
-
const result = await this.standardHandler.handle(standardRequest, options);
|
|
25
|
-
if (!result.matched) {
|
|
26
|
-
return { matched: false };
|
|
27
|
-
}
|
|
28
|
-
await sendStandardResponse(res, result.response, options);
|
|
29
|
-
return { matched: true };
|
|
14
|
+
super(new StandardOpenAPIHandler(router, options), options);
|
|
30
15
|
}
|
|
31
16
|
}
|
|
32
17
|
|
|
@@ -1,25 +1,20 @@
|
|
|
1
|
-
import { ORPCError } from '@orpc/client';
|
|
2
|
-
import {
|
|
3
|
-
import { AnyProcedure
|
|
4
|
-
import { StandardCodec, StandardParams
|
|
1
|
+
import { ORPCError, HTTPPath } from '@orpc/client';
|
|
2
|
+
import { StandardOpenAPISerializer } from '@orpc/openapi-client/standard';
|
|
3
|
+
import { AnyProcedure } from '@orpc/server';
|
|
4
|
+
import { StandardCodec, StandardParams } from '@orpc/server/standard';
|
|
5
5
|
import { StandardLazyRequest, StandardResponse } from '@orpc/standard-server';
|
|
6
|
-
|
|
6
|
+
export { a as StandardOpenAPIHandler, S as StandardOpenAPIHandlerOptions, c as StandardOpenAPIMatcher, b as StandardOpenAPIMatcherOptions } from '../../shared/openapi.CQmjvnb0.mjs';
|
|
7
|
+
import '@orpc/shared';
|
|
7
8
|
|
|
8
|
-
declare class
|
|
9
|
+
declare class StandardOpenAPICodec implements StandardCodec {
|
|
10
|
+
#private;
|
|
9
11
|
private readonly serializer;
|
|
10
|
-
constructor(serializer:
|
|
12
|
+
constructor(serializer: StandardOpenAPISerializer);
|
|
11
13
|
decode(request: StandardLazyRequest, params: StandardParams | undefined, procedure: AnyProcedure): Promise<unknown>;
|
|
12
14
|
encode(output: unknown, procedure: AnyProcedure): StandardResponse;
|
|
13
15
|
encodeError(error: ORPCError<any, any>): StandardResponse;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
|
-
declare class OpenAPIMatcher implements StandardMatcher {
|
|
17
|
-
private readonly tree;
|
|
18
|
-
private pendingRouters;
|
|
19
|
-
init(router: AnyRouter, path?: readonly string[]): void;
|
|
20
|
-
match(method: string, pathname: HTTPPath): Promise<StandardMatchResult>;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
18
|
/**
|
|
24
19
|
* {@link https://github.com/unjs/rou3}
|
|
25
20
|
*
|
|
@@ -31,4 +26,4 @@ declare function toRou3Pattern(path: HTTPPath): string;
|
|
|
31
26
|
*/
|
|
32
27
|
declare function decodeParams(params: Record<string, string>): Record<string, string>;
|
|
33
28
|
|
|
34
|
-
export {
|
|
29
|
+
export { StandardOpenAPICodec, decodeParams, toRou3Pattern };
|
|
@@ -1,25 +1,20 @@
|
|
|
1
|
-
import { ORPCError } from '@orpc/client';
|
|
2
|
-
import {
|
|
3
|
-
import { AnyProcedure
|
|
4
|
-
import { StandardCodec, StandardParams
|
|
1
|
+
import { ORPCError, HTTPPath } from '@orpc/client';
|
|
2
|
+
import { StandardOpenAPISerializer } from '@orpc/openapi-client/standard';
|
|
3
|
+
import { AnyProcedure } from '@orpc/server';
|
|
4
|
+
import { StandardCodec, StandardParams } from '@orpc/server/standard';
|
|
5
5
|
import { StandardLazyRequest, StandardResponse } from '@orpc/standard-server';
|
|
6
|
-
|
|
6
|
+
export { a as StandardOpenAPIHandler, S as StandardOpenAPIHandlerOptions, c as StandardOpenAPIMatcher, b as StandardOpenAPIMatcherOptions } from '../../shared/openapi.CQmjvnb0.js';
|
|
7
|
+
import '@orpc/shared';
|
|
7
8
|
|
|
8
|
-
declare class
|
|
9
|
+
declare class StandardOpenAPICodec implements StandardCodec {
|
|
10
|
+
#private;
|
|
9
11
|
private readonly serializer;
|
|
10
|
-
constructor(serializer:
|
|
12
|
+
constructor(serializer: StandardOpenAPISerializer);
|
|
11
13
|
decode(request: StandardLazyRequest, params: StandardParams | undefined, procedure: AnyProcedure): Promise<unknown>;
|
|
12
14
|
encode(output: unknown, procedure: AnyProcedure): StandardResponse;
|
|
13
15
|
encodeError(error: ORPCError<any, any>): StandardResponse;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
|
-
declare class OpenAPIMatcher implements StandardMatcher {
|
|
17
|
-
private readonly tree;
|
|
18
|
-
private pendingRouters;
|
|
19
|
-
init(router: AnyRouter, path?: readonly string[]): void;
|
|
20
|
-
match(method: string, pathname: HTTPPath): Promise<StandardMatchResult>;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
18
|
/**
|
|
24
19
|
* {@link https://github.com/unjs/rou3}
|
|
25
20
|
*
|
|
@@ -31,4 +26,4 @@ declare function toRou3Pattern(path: HTTPPath): string;
|
|
|
31
26
|
*/
|
|
32
27
|
declare function decodeParams(params: Record<string, string>): Record<string, string>;
|
|
33
28
|
|
|
34
|
-
export {
|
|
29
|
+
export { StandardOpenAPICodec, decodeParams, toRou3Pattern };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { S as StandardOpenAPICodec, a as StandardOpenAPIHandler, b as StandardOpenAPIMatcher, d as decodeParams, t as toRou3Pattern } from '../../shared/openapi.BVXcB0u4.mjs';
|
|
2
|
+
import '@orpc/openapi-client/standard';
|
|
3
|
+
import '@orpc/server/standard';
|
|
4
|
+
import '@orpc/client';
|
|
2
5
|
import '@orpc/contract';
|
|
3
6
|
import '@orpc/shared';
|
|
7
|
+
import '@orpc/client/standard';
|
|
4
8
|
import '@orpc/server';
|
|
5
9
|
import 'rou3';
|
|
6
|
-
import '../../shared/openapi.DZzpQAb-.mjs';
|
|
7
|
-
import 'json-schema-typed/draft-2020-12';
|
package/dist/index.d.mts
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
import {
|
|
5
|
-
import { JSONSchema } from 'json-schema-typed/draft-2020-12';
|
|
6
|
-
export { JSONSchema, Format as JSONSchemaFormat } from 'json-schema-typed/draft-2020-12';
|
|
1
|
+
import { OpenAPI, AnyContractProcedure } from '@orpc/contract';
|
|
2
|
+
export { OpenAPI } from '@orpc/contract';
|
|
3
|
+
export { e as CompositeSchemaConverter, C as ConditionalSchemaConverter, b as OpenAPIGenerator, a as OpenAPIGeneratorGenerateOptions, O as OpenAPIGeneratorOptions, c as SchemaConvertOptions, d as SchemaConverter, S as SchemaConverterComponent } from './shared/openapi.CfjfVeBJ.mjs';
|
|
4
|
+
import { HTTPPath, HTTPMethod } from '@orpc/client';
|
|
5
|
+
import { JSONSchema } from '@orpc/interop/json-schema-typed/draft-2020-12';
|
|
6
|
+
export { JSONSchema, ContentEncoding as JSONSchemaContentEncoding, Format as JSONSchemaFormat, TypeName as JSONSchemaTypeName } from '@orpc/interop/json-schema-typed/draft-2020-12';
|
|
7
|
+
import { JsonifiedClient } from '@orpc/openapi-client';
|
|
8
|
+
import { AnyRouter, ClientContext, Lazyable, CreateProcedureClientOptions, InferRouterInitialContext, Schema, ErrorMap, Meta, RouterClient } from '@orpc/server';
|
|
9
|
+
import { MaybeOptionalOptions } from '@orpc/shared';
|
|
10
|
+
import '@orpc/openapi-client/standard';
|
|
7
11
|
|
|
8
|
-
type OverrideOperationValue = Partial<
|
|
12
|
+
type OverrideOperationValue = Partial<OpenAPI.OperationObject> | ((current: OpenAPI.OperationObject, procedure: AnyContractProcedure) => OpenAPI.OperationObject);
|
|
13
|
+
/**
|
|
14
|
+
* Customize The Operation Object by proxy an error map item or a middleware.
|
|
15
|
+
*
|
|
16
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-specification#customizing-operation-objects Customizing Operation Objects Docs}
|
|
17
|
+
*/
|
|
9
18
|
declare function customOpenAPIOperation<T extends object>(o: T, extend: OverrideOperationValue): T;
|
|
10
19
|
declare function getCustomOpenAPIOperation(o: object): OverrideOperationValue | undefined;
|
|
11
|
-
declare function applyCustomOpenAPIOperation(operation:
|
|
20
|
+
declare function applyCustomOpenAPIOperation(operation: OpenAPI.OperationObject, contract: AnyContractProcedure): OpenAPI.OperationObject;
|
|
12
21
|
|
|
13
22
|
/**
|
|
14
23
|
* @internal
|
|
@@ -28,36 +37,6 @@ type FileSchema = JSONSchema & {
|
|
|
28
37
|
*/
|
|
29
38
|
declare const LOGIC_KEYWORDS: string[];
|
|
30
39
|
|
|
31
|
-
interface SchemaConvertOptions {
|
|
32
|
-
strategy: 'input' | 'output';
|
|
33
|
-
}
|
|
34
|
-
interface SchemaConverter {
|
|
35
|
-
convert(schema: AnySchema | undefined, options: SchemaConvertOptions): [required: boolean, jsonSchema: JSONSchema];
|
|
36
|
-
}
|
|
37
|
-
interface ConditionalSchemaConverter extends SchemaConverter {
|
|
38
|
-
condition(schema: AnySchema | undefined, options: SchemaConvertOptions): boolean;
|
|
39
|
-
}
|
|
40
|
-
declare class CompositeSchemaConverter implements SchemaConverter {
|
|
41
|
-
private readonly converters;
|
|
42
|
-
constructor(converters: ConditionalSchemaConverter[]);
|
|
43
|
-
convert(schema: AnySchema | undefined, options: SchemaConvertOptions): [required: boolean, jsonSchema: JSONSchema];
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
interface OpenAPIGeneratorOptions {
|
|
47
|
-
schemaConverters?: ConditionalSchemaConverter[];
|
|
48
|
-
}
|
|
49
|
-
declare class OpenAPIGenerator {
|
|
50
|
-
#private;
|
|
51
|
-
private readonly serializer;
|
|
52
|
-
private readonly converter;
|
|
53
|
-
constructor(options?: OpenAPIGeneratorOptions);
|
|
54
|
-
generate(router: AnyContractRouter | AnyRouter, base: Omit<OpenAPIV3_1.Document, 'openapi'>): Promise<OpenAPIV3_1.Document>;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* @internal
|
|
59
|
-
*/
|
|
60
|
-
declare function standardizeHTTPPath(path: HTTPPath): HTTPPath;
|
|
61
40
|
/**
|
|
62
41
|
* @internal
|
|
63
42
|
*/
|
|
@@ -69,19 +48,15 @@ declare function toOpenAPIMethod(method: HTTPMethod): Lowercase<HTTPMethod>;
|
|
|
69
48
|
/**
|
|
70
49
|
* @internal
|
|
71
50
|
*/
|
|
72
|
-
declare function
|
|
51
|
+
declare function toOpenAPIContent(schema: JSONSchema): Record<string, OpenAPI.MediaTypeObject>;
|
|
73
52
|
/**
|
|
74
53
|
* @internal
|
|
75
54
|
*/
|
|
76
|
-
declare function
|
|
55
|
+
declare function toOpenAPIEventIteratorContent([yieldsRequired, yieldsSchema]: [boolean, JSONSchema], [returnsRequired, returnsSchema]: [boolean, JSONSchema]): Record<string, OpenAPI.MediaTypeObject>;
|
|
77
56
|
/**
|
|
78
57
|
* @internal
|
|
79
58
|
*/
|
|
80
|
-
declare function
|
|
81
|
-
/**
|
|
82
|
-
* @internal
|
|
83
|
-
*/
|
|
84
|
-
declare function toOpenAPIParameters(schema: ObjectSchema, parameterIn: 'path' | 'query' | 'header' | 'cookie'): OpenAPIV3_1.ParameterObject[];
|
|
59
|
+
declare function toOpenAPIParameters(schema: ObjectSchema, parameterIn: 'path' | 'query' | 'header' | 'cookie'): OpenAPI.ParameterObject[];
|
|
85
60
|
/**
|
|
86
61
|
* @internal
|
|
87
62
|
*/
|
|
@@ -89,7 +64,10 @@ declare function checkParamsSchema(schema: ObjectSchema, params: string[]): bool
|
|
|
89
64
|
/**
|
|
90
65
|
* @internal
|
|
91
66
|
*/
|
|
92
|
-
declare function toOpenAPISchema(schema: JSONSchema):
|
|
67
|
+
declare function toOpenAPISchema(schema: JSONSchema): OpenAPI.SchemaObject & object;
|
|
68
|
+
declare function resolveOpenAPIJsonSchemaRef(doc: OpenAPI.Document, schema: JSONSchema): JSONSchema;
|
|
69
|
+
|
|
70
|
+
declare function createJsonifiedRouterClient<T extends AnyRouter, TClientContext extends ClientContext>(router: Lazyable<T | undefined>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<InferRouterInitialContext<T>, Schema<unknown, unknown>, ErrorMap, Meta, TClientContext>>): JsonifiedClient<RouterClient<T, TClientContext>>;
|
|
93
71
|
|
|
94
72
|
/**
|
|
95
73
|
*@internal
|
|
@@ -111,9 +89,22 @@ declare function separateObjectSchema(schema: ObjectSchema, separatedProperties:
|
|
|
111
89
|
* @internal
|
|
112
90
|
*/
|
|
113
91
|
declare function filterSchemaBranches(schema: JSONSchema, check: (schema: JSONSchema) => boolean, matches?: JSONSchema[]): [matches: JSONSchema[], rest: JSONSchema | undefined];
|
|
92
|
+
declare function applySchemaOptionality(required: boolean, schema: JSONSchema): JSONSchema;
|
|
93
|
+
/**
|
|
94
|
+
* Takes a JSON schema and, if it's primarily a union type (anyOf, oneOf),
|
|
95
|
+
* recursively expands it into an array of its constituent, non-union base schemas.
|
|
96
|
+
* If the schema is not a simple union or is a base type, it's returned as a single-element array.
|
|
97
|
+
*/
|
|
98
|
+
declare function expandUnionSchema(schema: JSONSchema): JSONSchema[];
|
|
99
|
+
declare function expandArrayableSchema(schema: JSONSchema): undefined | [items: JSONSchema, array: JSONSchema & {
|
|
100
|
+
type: 'array';
|
|
101
|
+
items?: JSONSchema;
|
|
102
|
+
}];
|
|
103
|
+
declare function isPrimitiveSchema(schema: JSONSchema): boolean;
|
|
114
104
|
|
|
115
105
|
declare const oo: {
|
|
116
106
|
spec: typeof customOpenAPIOperation;
|
|
117
107
|
};
|
|
118
108
|
|
|
119
|
-
export {
|
|
109
|
+
export { LOGIC_KEYWORDS, applyCustomOpenAPIOperation, applySchemaOptionality, checkParamsSchema, createJsonifiedRouterClient, customOpenAPIOperation, expandArrayableSchema, expandUnionSchema, filterSchemaBranches, getCustomOpenAPIOperation, isAnySchema, isFileSchema, isObjectSchema, isPrimitiveSchema, oo, resolveOpenAPIJsonSchemaRef, separateObjectSchema, toOpenAPIContent, toOpenAPIEventIteratorContent, toOpenAPIMethod, toOpenAPIParameters, toOpenAPIPath, toOpenAPISchema };
|
|
110
|
+
export type { FileSchema, ObjectSchema, OverrideOperationValue };
|