@orpc/openapi 2.0.0-beta.17 → 2.0.0-beta.19
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 +8 -2
- package/dist/extensions/route.d.mts +2 -2
- package/dist/extensions/route.d.ts +2 -2
- package/dist/index.d.mts +13 -13
- package/dist/index.d.ts +13 -13
- package/dist/index.mjs +22 -22
- package/dist/plugins/index.d.mts +1 -1
- package/dist/plugins/index.d.ts +1 -1
- package/dist/shared/{openapi.CYgMBSUF.d.mts → openapi.ByT4oUeY.d.mts} +2 -2
- package/dist/shared/{openapi.CYgMBSUF.d.ts → openapi.ByT4oUeY.d.ts} +2 -2
- package/dist/shared/{openapi.C8pX5sBa.d.mts → openapi.gqZ1aCD4.d.mts} +4 -3
- package/dist/shared/{openapi.zFD75jdI.d.ts → openapi.ztgj01W5.d.ts} +4 -3
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
<a href="https://www.npmjs.com/package/@orpc/openapi">
|
|
8
8
|
<img alt="weekly downloads" src="https://img.shields.io/npm/dw/%40orpc%2Fopenapi?logo=npm" />
|
|
9
9
|
</a>
|
|
10
|
+
<a href="https://app.codspeed.io/middleapi/orpc?utm_source=badge">
|
|
11
|
+
<img alt="CodSpeed" src="https://img.shields.io/endpoint?url=https://codspeed.io/badge.json" />
|
|
12
|
+
</a>
|
|
10
13
|
<a href="https://github.com/middleapi/orpc/blob/main/LICENSE">
|
|
11
14
|
<img alt="MIT License" src="https://img.shields.io/github/license/middleapi/orpc?logo=open-source-initiative" />
|
|
12
15
|
</a>
|
|
@@ -46,11 +49,14 @@ You can read the documentation [here](https://orpc.dev).
|
|
|
46
49
|
**Framework & ecosystem integrations**
|
|
47
50
|
|
|
48
51
|
- [@orpc/next](https://www.npmjs.com/package/@orpc/next): Integrate with [Next.js Server Functions](https://nextjs.org/docs/app/getting-started/mutating-data).
|
|
52
|
+
- [@orpc/ai-sdk](https://www.npmjs.com/package/@orpc/ai-sdk): Turn contracts and procedures into [AI SDK](https://ai-sdk.dev/) tools.
|
|
49
53
|
- [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query): Integrate with [TanStack Query](https://tanstack.com/query/latest).
|
|
54
|
+
- [@orpc/pinia-colada](https://www.npmjs.com/package/@orpc/pinia-colada): Integrate with [Pinia Colada](https://pinia-colada.esm.dev/).
|
|
50
55
|
- [@orpc/experimental-effect](https://www.npmjs.com/package/@orpc/experimental-effect): Integrate with [Effect](https://effect.website/).
|
|
51
56
|
- [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Implement your contract with [NestJS](https://nestjs.com/).
|
|
52
57
|
- [@orpc/bun](https://www.npmjs.com/package/@orpc/bun): Adapters for [Bun's Redis](https://bun.sh/).
|
|
53
58
|
- [@orpc/cloudflare](https://www.npmjs.com/package/@orpc/cloudflare): Adapters for [Cloudflare's RateLimit and Durable Objects](https://developers.cloudflare.com/workers/).
|
|
59
|
+
- [@orpc/trpc](https://www.npmjs.com/package/@orpc/trpc): Reuse existing [tRPC](https://trpc.io/) routers within oRPC.
|
|
54
60
|
|
|
55
61
|
**Observability**
|
|
56
62
|
|
|
@@ -102,11 +108,10 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
|
|
|
102
108
|
<td align="center"><a href="https://github.com/valerii15298?ref=orpc" target="_blank" rel="noopener" title="Valerii Petryniak"><img src="https://avatars.githubusercontent.com/u/44531564?u=88ac74d9bacd20401518441907acad21063cd397&v=4" width="139" alt="Valerii Petryniak"/><br />Valerii Petryniak</a></td>
|
|
103
109
|
<td align="center"><a href="https://github.com/letstri?ref=orpc" target="_blank" rel="noopener" title="Valerii Strilets"><img src="https://avatars.githubusercontent.com/u/13253748?u=c7b10399ccc8f8081e24db94ec32cd9858e86ac3&v=4" width="139" alt="Valerii Strilets"/><br />Valerii Strilets</a></td>
|
|
104
110
|
<td align="center"><a href="https://github.com/K-Mistele?ref=orpc" target="_blank" rel="noopener" title="Kyle Mistele"><img src="https://avatars.githubusercontent.com/u/18430555?u=3afebeb81de666e35aaac3ed46f14159d7603ffb&v=4" width="139" alt="Kyle Mistele"/><br />Kyle Mistele</a></td>
|
|
105
|
-
<td align="center"><a href="https://github.com/andrewpeters9?ref=orpc" target="_blank" rel="noopener" title="Andrew Peters"><img src="https://avatars.githubusercontent.com/u/36251325?v=4" width="139" alt="Andrew Peters"/><br />Andrew Peters</a></td>
|
|
106
111
|
<td align="center"><a href="https://github.com/R44VC0RP?ref=orpc" target="_blank" rel="noopener" title="Ryan Vogel"><img src="https://avatars.githubusercontent.com/u/89211796?u=1857347b9787d8d8a7ea5bfc333f96be92d5a683&v=4" width="139" alt="Ryan Vogel"/><br />Ryan Vogel</a></td>
|
|
112
|
+
<td align="center"><a href="https://github.com/christ12938?ref=orpc" target="_blank" rel="noopener" title="christ12938"><img src="https://avatars.githubusercontent.com/u/25758598?v=4" width="139" alt="christ12938"/><br />christ12938</a></td>
|
|
107
113
|
</tr>
|
|
108
114
|
<tr>
|
|
109
|
-
<td align="center"><a href="https://github.com/christ12938?ref=orpc" target="_blank" rel="noopener" title="christ12938"><img src="https://avatars.githubusercontent.com/u/25758598?v=4" width="139" alt="christ12938"/><br />christ12938</a></td>
|
|
110
115
|
<td align="center"><a href="https://github.com/Ryanjso?ref=orpc" target="_blank" rel="noopener" title="Ryan Soderberg"><img src="https://avatars.githubusercontent.com/u/39172778?u=5ed913c31d57e7221b75784abcad48c7ebddde27&v=4" width="139" alt="Ryan Soderberg"/><br />Ryan Soderberg</a></td>
|
|
111
116
|
<td align="center"><a href="https://github.com/itigoore01?ref=orpc" target="_blank" rel="noopener" title="shota"><img src="https://avatars.githubusercontent.com/u/11831107?u=c976a6dc7e055eb026304c46c99100ed22b0c8e0&v=4" width="139" alt="shota"/><br />shota</a></td>
|
|
112
117
|
</tr>
|
|
@@ -166,6 +171,7 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
|
|
|
166
171
|
<a href="https://github.com/nelsonlaidev?ref=orpc" target="_blank" rel="noopener" title="Nelson Lai"><img src="https://avatars.githubusercontent.com/u/75498339?u=2fc0e0b95dd184c5ffb744df977cb15a18b60672&v=4" width="32" height="32" alt="Nelson Lai" /></a>
|
|
167
172
|
<a href="https://github.com/nguyenlc1993?ref=orpc" target="_blank" rel="noopener" title="Lê Cao Nguyên"><img src="https://avatars.githubusercontent.com/u/13871971?u=83c8b69d9e35b589c4e1f066cc113b1d9461386f&v=4" width="32" height="32" alt="Lê Cao Nguyên" /></a>
|
|
168
173
|
<a href="https://github.com/wobsoriano?ref=orpc" target="_blank" rel="noopener" title="Robert Soriano"><img src="https://avatars.githubusercontent.com/u/13049130?u=6d72104182e7c9ed25934815313fb69107332111&v=4" width="32" height="32" alt="Robert Soriano" /></a>
|
|
174
|
+
<a href="https://github.com/andrewpeters9?ref=orpc" target="_blank" rel="noopener" title="Andrew Peters"><img src="https://avatars.githubusercontent.com/u/36251325?v=4" width="32" height="32" alt="Andrew Peters" /></a>
|
|
169
175
|
<a href="https://github.com/SKostyukovich?ref=orpc" target="_blank" rel="noopener" title="SKostyukovich"><img src="https://avatars.githubusercontent.com/u/10700067?v=4" width="32" height="32" alt="SKostyukovich" /></a>
|
|
170
176
|
<a href="https://github.com/peter-adam-dy?ref=orpc" target="_blank" rel="noopener" title="Peter Adam"><img src="https://avatars.githubusercontent.com/u/132129459?u=4f3dbbb3b443990b56acb7d6a5d11ed2c555f6db&v=4" width="32" height="32" alt="Peter Adam" /></a>
|
|
171
177
|
<a href="https://github.com/FabworksHQ?ref=orpc" target="_blank" rel="noopener" title="Fabworks"><img src="https://avatars.githubusercontent.com/u/160179500?v=4" width="32" height="32" alt="Fabworks" /></a>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AnyORPCError } from '@orpc/client';
|
|
2
2
|
import { ErrorMap, AnySchema } from '@orpc/contract';
|
|
3
3
|
import { Context } from '@orpc/server';
|
|
4
|
-
import { O as OpenAPIMeta } from '../shared/openapi.
|
|
4
|
+
import { O as OpenAPIMeta } from '../shared/openapi.gqZ1aCD4.mjs';
|
|
5
5
|
import '@orpc/shared';
|
|
6
6
|
import '@standardserver/core';
|
|
7
|
-
import '../shared/openapi.
|
|
7
|
+
import '../shared/openapi.ByT4oUeY.mjs';
|
|
8
8
|
import '@hey-api/spec-types';
|
|
9
9
|
|
|
10
10
|
declare module '@orpc/contract' {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AnyORPCError } from '@orpc/client';
|
|
2
2
|
import { ErrorMap, AnySchema } from '@orpc/contract';
|
|
3
3
|
import { Context } from '@orpc/server';
|
|
4
|
-
import { O as OpenAPIMeta } from '../shared/openapi.
|
|
4
|
+
import { O as OpenAPIMeta } from '../shared/openapi.ztgj01W5.js';
|
|
5
5
|
import '@orpc/shared';
|
|
6
6
|
import '@standardserver/core';
|
|
7
|
-
import '../shared/openapi.
|
|
7
|
+
import '../shared/openapi.ByT4oUeY.js';
|
|
8
8
|
import '@hey-api/spec-types';
|
|
9
9
|
|
|
10
10
|
declare module '@orpc/contract' {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { O as OpenAPISerializer } from './shared/openapi.BOOA-bde.mjs';
|
|
2
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.BOOA-bde.mjs';
|
|
3
|
-
import { ClientContext,
|
|
3
|
+
import { ClientContext, ORPCClientOptions, ClientLink } from '@orpc/client';
|
|
4
4
|
export { COMMON_ERROR_STATUS_MAP } from '@orpc/client';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
export {
|
|
9
|
-
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.C8pX5sBa.mjs';
|
|
5
|
+
import { RouterContract, RouterContractClient, AnyProcedureContract, ProcedureContract } from '@orpc/contract';
|
|
6
|
+
import { J as JsonifiedClient, a as OpenAPIDocument } from './shared/openapi.ByT4oUeY.mjs';
|
|
7
|
+
export { b as JsonifiedArray, c as JsonifiedClientError, d as JsonifiedValue, O as OpenAPIOperationObject } from './shared/openapi.ByT4oUeY.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.gqZ1aCD4.mjs';
|
|
10
9
|
import { JsonSchemaConverter, JsonSchema } from '@orpc/json-schema';
|
|
11
10
|
import { AnyRouter, AnyProcedure } from '@orpc/server';
|
|
11
|
+
import { Value } from '@orpc/shared';
|
|
12
12
|
export { StandardBodyHint } from '@standardserver/core';
|
|
13
13
|
import '@hey-api/spec-types';
|
|
14
14
|
|
|
15
|
-
interface
|
|
16
|
-
<
|
|
15
|
+
interface ContractJsonifiedClientFactory<TClientContext extends ClientContext> {
|
|
16
|
+
<T extends RouterContract>(contract: T): JsonifiedClient<RouterContractClient<T, TClientContext>>;
|
|
17
17
|
}
|
|
18
|
-
interface
|
|
18
|
+
interface ContractJsonifiedClientFactoryOptions<TClientContext extends ClientContext> extends Pick<ORPCClientOptions<JsonifiedClient<RouterContractClient<RouterContract, TClientContext>>>, 'interceptors' | 'scoped'> {
|
|
19
19
|
/**
|
|
20
20
|
* An optional reference to the root router-contract.
|
|
21
|
-
* When provided, the
|
|
21
|
+
* When provided, the client factory will automatically register the passed contract
|
|
22
22
|
* into the router at the path defined by `meta.path`.
|
|
23
23
|
*/
|
|
24
24
|
contractRef?: undefined | RouterContract;
|
|
25
25
|
}
|
|
26
|
-
declare function
|
|
26
|
+
declare function createContractJsonifiedClientFactory<TClientContext extends ClientContext>(link: ClientLink<TClientContext>, options?: ContractJsonifiedClientFactoryOptions<TClientContext>): ContractJsonifiedClientFactory<TClientContext>;
|
|
27
27
|
|
|
28
28
|
declare const DEFAULT_OPENAPI_METHOD = "POST";
|
|
29
29
|
declare const DEFAULT_OPENAPI_SUCCESS_DESCRIPTION = "OK";
|
|
@@ -116,5 +116,5 @@ declare function getDynamicPathParams(path: `/${string}`): {
|
|
|
116
116
|
allowsSlash: boolean;
|
|
117
117
|
}[] | undefined;
|
|
118
118
|
|
|
119
|
-
export { DEFAULT_OPENAPI_INPUT_STRUCTURE, DEFAULT_OPENAPI_METHOD, DEFAULT_OPENAPI_OUTPUT_STRUCTURE, DEFAULT_OPENAPI_SUCCESS_DESCRIPTION, JsonifiedClient,
|
|
120
|
-
export type {
|
|
119
|
+
export { DEFAULT_OPENAPI_INPUT_STRUCTURE, DEFAULT_OPENAPI_METHOD, DEFAULT_OPENAPI_OUTPUT_STRUCTURE, DEFAULT_OPENAPI_SUCCESS_DESCRIPTION, JsonifiedClient, OpenAPIDocument, OpenAPIGenerator, OpenAPIGeneratorError, OpenAPISerializer, createContractJsonifiedClientFactory, getDynamicPathParams, populateRouterContractOpenAPIPaths };
|
|
120
|
+
export type { ContractJsonifiedClientFactory, ContractJsonifiedClientFactoryOptions, OpenAPIGeneratorGenerateOptions, OpenAPIGeneratorOptions, PopulateRouterContractOpenAPIPathsOptions, PopulatedContractRouterOpenAPIPaths };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { O as OpenAPISerializer } from './shared/openapi.BOOA-bde.js';
|
|
2
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.BOOA-bde.js';
|
|
3
|
-
import { ClientContext,
|
|
3
|
+
import { ClientContext, ORPCClientOptions, ClientLink } from '@orpc/client';
|
|
4
4
|
export { COMMON_ERROR_STATUS_MAP } from '@orpc/client';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
export {
|
|
9
|
-
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.zFD75jdI.js';
|
|
5
|
+
import { RouterContract, RouterContractClient, AnyProcedureContract, ProcedureContract } from '@orpc/contract';
|
|
6
|
+
import { J as JsonifiedClient, a as OpenAPIDocument } from './shared/openapi.ByT4oUeY.js';
|
|
7
|
+
export { b as JsonifiedArray, c as JsonifiedClientError, d as JsonifiedValue, O as OpenAPIOperationObject } from './shared/openapi.ByT4oUeY.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.ztgj01W5.js';
|
|
10
9
|
import { JsonSchemaConverter, JsonSchema } from '@orpc/json-schema';
|
|
11
10
|
import { AnyRouter, AnyProcedure } from '@orpc/server';
|
|
11
|
+
import { Value } from '@orpc/shared';
|
|
12
12
|
export { StandardBodyHint } from '@standardserver/core';
|
|
13
13
|
import '@hey-api/spec-types';
|
|
14
14
|
|
|
15
|
-
interface
|
|
16
|
-
<
|
|
15
|
+
interface ContractJsonifiedClientFactory<TClientContext extends ClientContext> {
|
|
16
|
+
<T extends RouterContract>(contract: T): JsonifiedClient<RouterContractClient<T, TClientContext>>;
|
|
17
17
|
}
|
|
18
|
-
interface
|
|
18
|
+
interface ContractJsonifiedClientFactoryOptions<TClientContext extends ClientContext> extends Pick<ORPCClientOptions<JsonifiedClient<RouterContractClient<RouterContract, TClientContext>>>, 'interceptors' | 'scoped'> {
|
|
19
19
|
/**
|
|
20
20
|
* An optional reference to the root router-contract.
|
|
21
|
-
* When provided, the
|
|
21
|
+
* When provided, the client factory will automatically register the passed contract
|
|
22
22
|
* into the router at the path defined by `meta.path`.
|
|
23
23
|
*/
|
|
24
24
|
contractRef?: undefined | RouterContract;
|
|
25
25
|
}
|
|
26
|
-
declare function
|
|
26
|
+
declare function createContractJsonifiedClientFactory<TClientContext extends ClientContext>(link: ClientLink<TClientContext>, options?: ContractJsonifiedClientFactoryOptions<TClientContext>): ContractJsonifiedClientFactory<TClientContext>;
|
|
27
27
|
|
|
28
28
|
declare const DEFAULT_OPENAPI_METHOD = "POST";
|
|
29
29
|
declare const DEFAULT_OPENAPI_SUCCESS_DESCRIPTION = "OK";
|
|
@@ -116,5 +116,5 @@ declare function getDynamicPathParams(path: `/${string}`): {
|
|
|
116
116
|
allowsSlash: boolean;
|
|
117
117
|
}[] | undefined;
|
|
118
118
|
|
|
119
|
-
export { DEFAULT_OPENAPI_INPUT_STRUCTURE, DEFAULT_OPENAPI_METHOD, DEFAULT_OPENAPI_OUTPUT_STRUCTURE, DEFAULT_OPENAPI_SUCCESS_DESCRIPTION, JsonifiedClient,
|
|
120
|
-
export type {
|
|
119
|
+
export { DEFAULT_OPENAPI_INPUT_STRUCTURE, DEFAULT_OPENAPI_METHOD, DEFAULT_OPENAPI_OUTPUT_STRUCTURE, DEFAULT_OPENAPI_SUCCESS_DESCRIPTION, JsonifiedClient, OpenAPIDocument, OpenAPIGenerator, OpenAPIGeneratorError, OpenAPISerializer, createContractJsonifiedClientFactory, getDynamicPathParams, populateRouterContractOpenAPIPaths };
|
|
120
|
+
export type { ContractJsonifiedClientFactory, ContractJsonifiedClientFactoryOptions, OpenAPIGeneratorGenerateOptions, OpenAPIGeneratorOptions, PopulateRouterContractOpenAPIPathsOptions, PopulatedContractRouterOpenAPIPaths };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { B as BracketNotationSerializer } from './shared/openapi.Bt87OzTt.mjs';
|
|
2
|
-
import {
|
|
2
|
+
import { createContractClientFactory, getAsyncIteratorObjectSchemaDetails, ProcedureContract, resolveMetaPlugins } from '@orpc/contract';
|
|
3
3
|
import { O as OpenAPISerializer, D as DEFAULT_OPENAPI_METHOD, g as getDynamicPathParams, a as DEFAULT_OPENAPI_INPUT_STRUCTURE, c as DEFAULT_OPENAPI_SUCCESS_DESCRIPTION, b as DEFAULT_OPENAPI_OUTPUT_STRUCTURE } from './shared/openapi.Be9y-FmY.mjs';
|
|
4
4
|
export { d as OpenAPIJsonSerializer } from './shared/openapi.Be9y-FmY.mjs';
|
|
5
5
|
import { g as getOpenAPIMeta, o as openapi } from './shared/openapi.B9PQzqBn.mjs';
|
|
@@ -10,8 +10,8 @@ import { walkProcedureContractsAsync, DEFAULT_SUCCESS_STATUS, DEFAULT_ERROR_STAT
|
|
|
10
10
|
import { toArray, clone, value, pathToHttpPath, mergeHttpPath, stringifyJSON, findDeepMatches, isPlainObject, isDeepEqual, isTypescriptObject } from '@orpc/shared';
|
|
11
11
|
import '@standardserver/core';
|
|
12
12
|
|
|
13
|
-
function
|
|
14
|
-
return
|
|
13
|
+
function createContractJsonifiedClientFactory(link, options = {}) {
|
|
14
|
+
return createContractClientFactory(link, options);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
class OpenAPIGeneratorError extends TypeError {
|
|
@@ -33,7 +33,7 @@ class OpenAPIGenerator {
|
|
|
33
33
|
info: options.base?.info ?? { title: "API Reference", version: "0.0.0" }
|
|
34
34
|
};
|
|
35
35
|
const errors = [];
|
|
36
|
-
await walkProcedureContractsAsync(router,
|
|
36
|
+
await walkProcedureContractsAsync(router, (contract, path) => {
|
|
37
37
|
if (value(options.filter, contract, path) === false) {
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
@@ -56,9 +56,9 @@ class OpenAPIGenerator {
|
|
|
56
56
|
deprecated: meta?.deprecated,
|
|
57
57
|
tags: meta?.tags?.map((tag) => tag)
|
|
58
58
|
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
this.request(doc, operationRef, def, meta, dynamicPathParams, options, path);
|
|
60
|
+
this.successResponse(doc, operationRef, def, meta, options, path);
|
|
61
|
+
this.errorResponse(doc, operationRef, def, meta, options);
|
|
62
62
|
}
|
|
63
63
|
if (typeof meta?.spec === "function") {
|
|
64
64
|
operationRef = meta.spec(operationRef);
|
|
@@ -85,15 +85,15 @@ ${errors.join("\n\n")}`
|
|
|
85
85
|
}
|
|
86
86
|
return this.serializer.serialize(doc, { asFormData: false, useFormDataForBlobFields: false });
|
|
87
87
|
}
|
|
88
|
-
|
|
89
|
-
const [jsonSchema, optional] =
|
|
88
|
+
convertSchema(schema, direction) {
|
|
89
|
+
const [jsonSchema, optional] = this.converter.convert(schema, direction);
|
|
90
90
|
return [strip$schemaField(jsonSchema), optional];
|
|
91
91
|
}
|
|
92
|
-
|
|
92
|
+
convertSchemas(schemas, direction) {
|
|
93
93
|
if (!schemas || schemas.length <= 1) {
|
|
94
94
|
return this.convertSchema(schemas?.[0], direction);
|
|
95
95
|
}
|
|
96
|
-
const results =
|
|
96
|
+
const results = schemas.map((s) => this.convertSchema(s, direction));
|
|
97
97
|
const allOfSchemas = [];
|
|
98
98
|
let optional = true;
|
|
99
99
|
for (const [jsonSchema, opt] of results) {
|
|
@@ -104,7 +104,7 @@ ${errors.join("\n\n")}`
|
|
|
104
104
|
}
|
|
105
105
|
return [combineJsonSchemasWithComposition("allOf", allOfSchemas), optional];
|
|
106
106
|
}
|
|
107
|
-
|
|
107
|
+
request(doc, ref, def, meta, dynamicPathParams, options, path) {
|
|
108
108
|
const method = meta?.method ?? DEFAULT_OPENAPI_METHOD;
|
|
109
109
|
const inputStructure = meta?.inputStructure ?? DEFAULT_OPENAPI_INPUT_STRUCTURE;
|
|
110
110
|
const inputSchemas = def.inputSchemas;
|
|
@@ -112,8 +112,8 @@ ${errors.join("\n\n")}`
|
|
|
112
112
|
const asyncIteratorObjectDetails = getAsyncIteratorObjectDetails(inputSchemas);
|
|
113
113
|
if (asyncIteratorObjectDetails) {
|
|
114
114
|
const [yieldSchemas, returnSchemas] = asyncIteratorObjectDetails;
|
|
115
|
-
const yieldResult =
|
|
116
|
-
const returnResult =
|
|
115
|
+
const yieldResult = this.convertSchemas(yieldSchemas, "input");
|
|
116
|
+
const returnResult = this.convertSchemas(returnSchemas, "input");
|
|
117
117
|
ref.requestBody = {
|
|
118
118
|
required: true,
|
|
119
119
|
content: toAsyncIteratorObjectContent(yieldResult, returnResult, doc, options)
|
|
@@ -122,7 +122,7 @@ ${errors.join("\n\n")}`
|
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
const dynamicParams = dynamicPathParams?.map((v) => v.parameterName);
|
|
125
|
-
const [schema, optional] =
|
|
125
|
+
const [schema, optional] = this.convertSchemas(inputSchemas, "input");
|
|
126
126
|
if (isUnconstrainedSchema(schema) && !dynamicParams?.length) {
|
|
127
127
|
return;
|
|
128
128
|
}
|
|
@@ -232,7 +232,7 @@ ${errors.join("\n\n")}`
|
|
|
232
232
|
};
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
|
-
|
|
235
|
+
successResponse(doc, ref, def, meta, options, path) {
|
|
236
236
|
const outputSchemas = def.outputSchemas;
|
|
237
237
|
const status = meta?.successStatus ?? DEFAULT_SUCCESS_STATUS;
|
|
238
238
|
const description = meta?.successDescription ?? DEFAULT_OPENAPI_SUCCESS_DESCRIPTION;
|
|
@@ -241,8 +241,8 @@ ${errors.join("\n\n")}`
|
|
|
241
241
|
const iteratorDetails = getAsyncIteratorObjectDetails(outputSchemas);
|
|
242
242
|
if (iteratorDetails) {
|
|
243
243
|
const [yieldSchemas, returnSchemas] = iteratorDetails;
|
|
244
|
-
const yieldResult =
|
|
245
|
-
const returnResult =
|
|
244
|
+
const yieldResult = this.convertSchemas(yieldSchemas, "output");
|
|
245
|
+
const returnResult = this.convertSchemas(returnSchemas, "output");
|
|
246
246
|
ref.responses ??= {};
|
|
247
247
|
ref.responses[status] = {
|
|
248
248
|
description,
|
|
@@ -251,7 +251,7 @@ ${errors.join("\n\n")}`
|
|
|
251
251
|
return;
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
|
-
const [schema] =
|
|
254
|
+
const [schema] = this.convertSchemas(outputSchemas, "output");
|
|
255
255
|
if (isUnconstrainedSchema(schema) || outputStructure === "compact") {
|
|
256
256
|
ref.responses ??= {};
|
|
257
257
|
ref.responses[status] = {
|
|
@@ -312,7 +312,7 @@ ${errors.join("\n\n")}`
|
|
|
312
312
|
ref.responses[status2] = responseObject;
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
|
-
|
|
315
|
+
errorResponse(doc, ref, def, meta, options) {
|
|
316
316
|
const errorStatusMap = options.errorStatusMap ?? COMMON_ERROR_STATUS_MAP;
|
|
317
317
|
const errorMap = def.errorMap;
|
|
318
318
|
const errorDefinitionsByStatus = /* @__PURE__ */ new Map();
|
|
@@ -323,7 +323,7 @@ ${errors.join("\n\n")}`
|
|
|
323
323
|
}
|
|
324
324
|
const status = errorStatusMap[code] ?? DEFAULT_ERROR_STATUS;
|
|
325
325
|
const defaultMessage = config.message;
|
|
326
|
-
const [dataJsonSchema, dataOptional] =
|
|
326
|
+
const [dataJsonSchema, dataOptional] = this.convertSchema(config.data, "output");
|
|
327
327
|
const definitions = errorDefinitionsByStatus.get(status);
|
|
328
328
|
if (definitions) {
|
|
329
329
|
definitions.push({ code, dataJsonSchema, dataOptional, defaultMessage });
|
|
@@ -927,4 +927,4 @@ function populateRouterContractOpenAPIPaths(router, options = {}) {
|
|
|
927
927
|
return populated;
|
|
928
928
|
}
|
|
929
929
|
|
|
930
|
-
export { DEFAULT_OPENAPI_INPUT_STRUCTURE, DEFAULT_OPENAPI_METHOD, DEFAULT_OPENAPI_OUTPUT_STRUCTURE, DEFAULT_OPENAPI_SUCCESS_DESCRIPTION, OpenAPIGenerator, OpenAPIGeneratorError, OpenAPISerializer,
|
|
930
|
+
export { DEFAULT_OPENAPI_INPUT_STRUCTURE, DEFAULT_OPENAPI_METHOD, DEFAULT_OPENAPI_OUTPUT_STRUCTURE, DEFAULT_OPENAPI_SUCCESS_DESCRIPTION, OpenAPIGenerator, OpenAPIGeneratorError, OpenAPISerializer, createContractJsonifiedClientFactory, getDynamicPathParams, getOpenAPIMeta, openapi, populateRouterContractOpenAPIPaths };
|
package/dist/plugins/index.d.mts
CHANGED
|
@@ -4,7 +4,7 @@ import { Value, Promisable } from '@orpc/shared';
|
|
|
4
4
|
import { ApiReferenceConfiguration } from '@scalar/api-reference';
|
|
5
5
|
import { StandardUrl } from '@standardserver/core';
|
|
6
6
|
import { SwaggerUIOptions } from 'swagger-ui';
|
|
7
|
-
import { a as OpenAPIDocument } from '../shared/openapi.
|
|
7
|
+
import { a as OpenAPIDocument } from '../shared/openapi.ByT4oUeY.mjs';
|
|
8
8
|
import '@hey-api/spec-types';
|
|
9
9
|
import '@orpc/client';
|
|
10
10
|
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Value, Promisable } from '@orpc/shared';
|
|
|
4
4
|
import { ApiReferenceConfiguration } from '@scalar/api-reference';
|
|
5
5
|
import { StandardUrl } from '@standardserver/core';
|
|
6
6
|
import { SwaggerUIOptions } from 'swagger-ui';
|
|
7
|
-
import { a as OpenAPIDocument } from '../shared/openapi.
|
|
7
|
+
import { a as OpenAPIDocument } from '../shared/openapi.ByT4oUeY.js';
|
|
8
8
|
import '@hey-api/spec-types';
|
|
9
9
|
import '@orpc/client';
|
|
10
10
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OpenAPIV3_1 } from '@hey-api/spec-types';
|
|
2
|
-
import {
|
|
2
|
+
import { AnyNestedClient, Client, ORPCError } from '@orpc/client';
|
|
3
3
|
|
|
4
4
|
type OpenAPIDocument = OpenAPIV3_1.Document;
|
|
5
5
|
type OpenAPIOperationObject = OpenAPIV3_1.OperationObject;
|
|
@@ -15,4 +15,4 @@ type JsonifiedClient<T extends AnyNestedClient> = T extends Client<infer UClient
|
|
|
15
15
|
[K in keyof T]: T[K] extends AnyNestedClient ? JsonifiedClient<T[K]> : T[K];
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
export type {
|
|
18
|
+
export type { JsonifiedClient as J, OpenAPIOperationObject as O, OpenAPIDocument as a, JsonifiedArray as b, JsonifiedClientError as c, JsonifiedValue as d };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OpenAPIV3_1 } from '@hey-api/spec-types';
|
|
2
|
-
import {
|
|
2
|
+
import { AnyNestedClient, Client, ORPCError } from '@orpc/client';
|
|
3
3
|
|
|
4
4
|
type OpenAPIDocument = OpenAPIV3_1.Document;
|
|
5
5
|
type OpenAPIOperationObject = OpenAPIV3_1.OperationObject;
|
|
@@ -15,4 +15,4 @@ type JsonifiedClient<T extends AnyNestedClient> = T extends Client<infer UClient
|
|
|
15
15
|
[K in keyof T]: T[K] extends AnyNestedClient ? JsonifiedClient<T[K]> : T[K];
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
export type {
|
|
18
|
+
export type { JsonifiedClient as J, OpenAPIOperationObject as O, OpenAPIDocument as a, JsonifiedArray as b, JsonifiedClientError as c, JsonifiedValue as d };
|
|
@@ -2,7 +2,7 @@ import { AnySchema, ErrorMap, MetaPlugin, AnyProcedureContract } from '@orpc/con
|
|
|
2
2
|
import { Lazy } from '@orpc/server';
|
|
3
3
|
import { Value } from '@orpc/shared';
|
|
4
4
|
import { StandardBodyHint } from '@standardserver/core';
|
|
5
|
-
import { O as OpenAPIOperationObject } from './openapi.
|
|
5
|
+
import { O as OpenAPIOperationObject } from './openapi.ByT4oUeY.mjs';
|
|
6
6
|
|
|
7
7
|
interface OpenAPIMeta {
|
|
8
8
|
/**
|
|
@@ -12,9 +12,10 @@ interface OpenAPIMeta {
|
|
|
12
12
|
*/
|
|
13
13
|
method?: 'HEAD' | 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | undefined;
|
|
14
14
|
/**
|
|
15
|
-
* URL path for this procedure. Supports dynamic
|
|
15
|
+
* URL path for this procedure. Supports dynamic parameters via `{param}` syntax,
|
|
16
|
+
* and `{+param}` to allow slashes in the matched value.
|
|
16
17
|
*
|
|
17
|
-
* @example `/users`, `/users
|
|
18
|
+
* @example `/users`, `/users/{id}`, `/files/{+path}`
|
|
18
19
|
* @default Router segments joined by `'/`
|
|
19
20
|
*/
|
|
20
21
|
path?: `/${string}` | undefined;
|
|
@@ -2,7 +2,7 @@ import { AnySchema, ErrorMap, MetaPlugin, AnyProcedureContract } from '@orpc/con
|
|
|
2
2
|
import { Lazy } from '@orpc/server';
|
|
3
3
|
import { Value } from '@orpc/shared';
|
|
4
4
|
import { StandardBodyHint } from '@standardserver/core';
|
|
5
|
-
import { O as OpenAPIOperationObject } from './openapi.
|
|
5
|
+
import { O as OpenAPIOperationObject } from './openapi.ByT4oUeY.js';
|
|
6
6
|
|
|
7
7
|
interface OpenAPIMeta {
|
|
8
8
|
/**
|
|
@@ -12,9 +12,10 @@ interface OpenAPIMeta {
|
|
|
12
12
|
*/
|
|
13
13
|
method?: 'HEAD' | 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | undefined;
|
|
14
14
|
/**
|
|
15
|
-
* URL path for this procedure. Supports dynamic
|
|
15
|
+
* URL path for this procedure. Supports dynamic parameters via `{param}` syntax,
|
|
16
|
+
* and `{+param}` to allow slashes in the matched value.
|
|
16
17
|
*
|
|
17
|
-
* @example `/users`, `/users
|
|
18
|
+
* @example `/users`, `/users/{id}`, `/files/{+path}`
|
|
18
19
|
* @default Router segments joined by `'/`
|
|
19
20
|
*/
|
|
20
21
|
path?: `/${string}` | undefined;
|
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.19",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.dev",
|
|
7
7
|
"repository": {
|
|
@@ -75,14 +75,14 @@
|
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
77
|
"@hey-api/spec-types": "0.0.0-next-20260408030107",
|
|
78
|
-
"@standardserver/core": "^0.
|
|
79
|
-
"@standardserver/fetch": "^0.
|
|
78
|
+
"@standardserver/core": "^0.5.0",
|
|
79
|
+
"@standardserver/fetch": "^0.5.0",
|
|
80
80
|
"rou3": "^0.9.1",
|
|
81
|
-
"@orpc/
|
|
82
|
-
"@orpc/json-schema": "2.0.0-beta.
|
|
83
|
-
"@orpc/server": "2.0.0-beta.
|
|
84
|
-
"@orpc/
|
|
85
|
-
"@orpc/
|
|
81
|
+
"@orpc/contract": "2.0.0-beta.19",
|
|
82
|
+
"@orpc/json-schema": "2.0.0-beta.19",
|
|
83
|
+
"@orpc/server": "2.0.0-beta.19",
|
|
84
|
+
"@orpc/client": "2.0.0-beta.19",
|
|
85
|
+
"@orpc/shared": "2.0.0-beta.19"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
88
|
"@scalar/api-reference": "^1.57.2",
|