@orpc/openapi 2.0.0-beta.3 → 2.0.0-beta.4
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 -7
- package/dist/adapters/fetch/index.d.mts +1 -1
- package/dist/adapters/fetch/index.d.ts +1 -1
- package/dist/adapters/fetch/index.mjs +1 -1
- package/dist/adapters/node/index.d.mts +1 -1
- package/dist/adapters/node/index.d.ts +1 -1
- package/dist/adapters/node/index.mjs +1 -1
- package/dist/adapters/standard/index.d.mts +1 -1
- package/dist/adapters/standard/index.d.ts +1 -1
- package/dist/adapters/standard/index.mjs +1 -1
- package/dist/index.d.mts +19 -2
- package/dist/index.d.ts +19 -2
- package/dist/index.mjs +34 -5
- package/dist/shared/{openapi.DBYxUpK8.d.ts → openapi.7vgmPxca.d.ts} +3 -3
- package/dist/shared/{openapi.B3H7yHQa.mjs → openapi.CTlpLuKN.mjs} +2 -2
- package/dist/shared/{openapi.DuDd2iQz.d.mts → openapi.CX6Ri5dP.d.mts} +3 -3
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -37,18 +37,19 @@ You can read the documentation [here](https://orpc.dev).
|
|
|
37
37
|
- [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot): Integrate with [Valibot](https://valibot.dev/).
|
|
38
38
|
- [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype): Integrate with [ArkType](https://arktype.io/).
|
|
39
39
|
|
|
40
|
-
**Framework & ecosystem integrations**
|
|
41
|
-
|
|
42
|
-
- [@orpc/next](https://www.npmjs.com/package/@orpc/react): Use oRPC with [Next.js Server Functions](https://nextjs.org/docs/app/getting-started/mutating-data).
|
|
43
|
-
- [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query): Integrate with [TanStack Query](https://tanstack.com/query/latest).
|
|
44
|
-
- [@orpc/experimental-effect](https://www.npmjs.com/package/@orpc/experimental-effect): Integrate with [Effect](https://effect.website/).
|
|
45
|
-
|
|
46
40
|
**Built-in features**
|
|
47
41
|
|
|
48
42
|
- [@orpc/publisher](https://www.npmjs.com/package/@orpc/publisher): Pub/Sub.
|
|
49
43
|
- [@orpc/ratelimit](https://www.npmjs.com/package/@orpc/ratelimit): Rate limiting.
|
|
50
44
|
- [@orpc/json-schema](https://www.npmjs.com/package/@orpc/json-schema): Smart coercion for OpenAPI requests.
|
|
51
45
|
|
|
46
|
+
**Framework & ecosystem integrations**
|
|
47
|
+
|
|
48
|
+
- [@orpc/next](https://www.npmjs.com/package/@orpc/react): Use oRPC with [Next.js Server Functions](https://nextjs.org/docs/app/getting-started/mutating-data).
|
|
49
|
+
- [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query): Integrate with [TanStack Query](https://tanstack.com/query/latest).
|
|
50
|
+
- [@orpc/experimental-effect](https://www.npmjs.com/package/@orpc/experimental-effect): Integrate with [Effect](https://effect.website/).
|
|
51
|
+
- [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Implement your contract with [NestJS](https://nestjs.com/).
|
|
52
|
+
|
|
52
53
|
**Observability**
|
|
53
54
|
|
|
54
55
|
- [@orpc/opentelemetry](https://www.npmjs.com/package/@orpc/opentelemetry): Instrument your API with [OpenTelemetry](https://opentelemetry.io/).
|
|
@@ -150,7 +151,7 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
|
|
|
150
151
|
<a href="https://github.com/theoludwig?ref=orpc" target="_blank" rel="noopener" title="Théo LUDWIG"><img src="https://avatars.githubusercontent.com/u/25207499?u=a6a9653725a2f574c07893748806668e0598cdbe&v=4" width="32" height="32" alt="Théo LUDWIG" /></a>
|
|
151
152
|
<a href="https://github.com/abhay-ramesh?ref=orpc" target="_blank" rel="noopener" title="Abhay Ramesh"><img src="https://avatars.githubusercontent.com/u/66196314?u=c5c2b0327b26606c2efcfaf17046ab18c3d25c57&v=4" width="32" height="32" alt="Abhay Ramesh" /></a>
|
|
152
153
|
<a href="https://github.com/shr-ink?ref=orpc" target="_blank" rel="noopener" title="shr.ink oü"><img src="https://avatars.githubusercontent.com/u/139700438?v=4" width="32" height="32" alt="shr.ink oü" /></a>
|
|
153
|
-
<a href="https://github.com/johngerome?ref=orpc" target="_blank" rel="noopener" title="0x4e32"><img src="https://avatars.githubusercontent.com/u/2002000?u=
|
|
154
|
+
<a href="https://github.com/johngerome?ref=orpc" target="_blank" rel="noopener" title="0x4e32"><img src="https://avatars.githubusercontent.com/u/2002000?u=505e54608466ab53754f702973687b04c6424c1f&v=4" width="32" height="32" alt="0x4e32" /></a>
|
|
154
155
|
<a href="https://github.com/yzuyr?ref=orpc" target="_blank" rel="noopener" title="Ryuz"><img src="https://avatars.githubusercontent.com/u/196539378?u=d38374588d219b6748b16406982f6559411466d4&v=4" width="32" height="32" alt="Ryuz" /></a>
|
|
155
156
|
<a href="https://github.com/happyboy2022?ref=orpc" target="_blank" rel="noopener" title="happyboy"><img src="https://avatars.githubusercontent.com/u/103669586?u=65b49c4b893ed3703909fbb3a7a22313f3f9c121&v=4" width="32" height="32" alt="happyboy" /></a>
|
|
156
157
|
<a href="https://github.com/YiCChi?ref=orpc" target="_blank" rel="noopener" title="yicchi"><img src="https://avatars.githubusercontent.com/u/86967274?u=6c2756f09fe15dd94d572f560e979cd157982852&v=4" width="32" height="32" alt="yicchi" /></a>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Context, Router } from '@orpc/server';
|
|
2
2
|
import { FetchHandler, FetchHandlerOptions } from '@orpc/server/fetch';
|
|
3
3
|
import { StandardHandlerOptions } from '@orpc/server/standard';
|
|
4
|
-
import { O as OpenAPIHandlerCodecOptions } from '../../shared/openapi.
|
|
4
|
+
import { O as OpenAPIHandlerCodecOptions } from '../../shared/openapi.CX6Ri5dP.mjs';
|
|
5
5
|
import { ClientContext } from '@orpc/client';
|
|
6
6
|
import { FetchLinkTransportOptions } from '@orpc/client/fetch';
|
|
7
7
|
import { StandardLink, StandardLinkOptions } from '@orpc/client/standard';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Context, Router } from '@orpc/server';
|
|
2
2
|
import { FetchHandler, FetchHandlerOptions } from '@orpc/server/fetch';
|
|
3
3
|
import { StandardHandlerOptions } from '@orpc/server/standard';
|
|
4
|
-
import { O as OpenAPIHandlerCodecOptions } from '../../shared/openapi.
|
|
4
|
+
import { O as OpenAPIHandlerCodecOptions } from '../../shared/openapi.7vgmPxca.js';
|
|
5
5
|
import { ClientContext } from '@orpc/client';
|
|
6
6
|
import { FetchLinkTransportOptions } from '@orpc/client/fetch';
|
|
7
7
|
import { StandardLink, StandardLinkOptions } from '@orpc/client/standard';
|
|
@@ -1,6 +1,6 @@
|
|
|
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.CTlpLuKN.mjs';
|
|
4
4
|
import { FetchLinkTransport } from '@orpc/client/fetch';
|
|
5
5
|
import { StandardLink } from '@orpc/client/standard';
|
|
6
6
|
import { O as OpenAPILinkCodec } from '../../shared/openapi.B2SK0ZAr.mjs';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Context, Router } from '@orpc/server';
|
|
2
2
|
import { NodeHttpHandler, NodeHttpHandlerOptions } from '@orpc/server/node';
|
|
3
3
|
import { StandardHandlerOptions } from '@orpc/server/standard';
|
|
4
|
-
import { O as OpenAPIHandlerCodecOptions } from '../../shared/openapi.
|
|
4
|
+
import { O as OpenAPIHandlerCodecOptions } from '../../shared/openapi.CX6Ri5dP.mjs';
|
|
5
5
|
import '@orpc/client';
|
|
6
6
|
import '@orpc/shared';
|
|
7
7
|
import '@standardserver/core';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Context, Router } from '@orpc/server';
|
|
2
2
|
import { NodeHttpHandler, NodeHttpHandlerOptions } from '@orpc/server/node';
|
|
3
3
|
import { StandardHandlerOptions } from '@orpc/server/standard';
|
|
4
|
-
import { O as OpenAPIHandlerCodecOptions } from '../../shared/openapi.
|
|
4
|
+
import { O as OpenAPIHandlerCodecOptions } from '../../shared/openapi.7vgmPxca.js';
|
|
5
5
|
import '@orpc/client';
|
|
6
6
|
import '@orpc/shared';
|
|
7
7
|
import '@standardserver/core';
|
|
@@ -1,6 +1,6 @@
|
|
|
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.CTlpLuKN.mjs';
|
|
4
4
|
import '@orpc/client';
|
|
5
5
|
import '@orpc/server';
|
|
6
6
|
import '@orpc/shared';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { a as OpenAPIHandlerCodec, b as OpenAPIHandlerCodecCore, c as OpenAPIHandlerCodecCoreOptions, O as OpenAPIHandlerCodecOptions, d as OpenAPIMatcher, e as OpenAPIMatcherOptions } 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.CX6Ri5dP.mjs';
|
|
2
2
|
import { ClientContext, ClientOptions, AnyORPCError } from '@orpc/client';
|
|
3
3
|
import { StandardLinkCodec, StandardLinkCodecDecodedResponse } from '@orpc/client/standard';
|
|
4
4
|
import { RouterContract } from '@orpc/contract';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { a as OpenAPIHandlerCodec, b as OpenAPIHandlerCodecCore, c as OpenAPIHandlerCodecCoreOptions, O as OpenAPIHandlerCodecOptions, d as OpenAPIMatcher, e as OpenAPIMatcherOptions } 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.7vgmPxca.js';
|
|
2
2
|
import { ClientContext, ClientOptions, AnyORPCError } from '@orpc/client';
|
|
3
3
|
import { StandardLinkCodec, StandardLinkCodecDecodedResponse } from '@orpc/client/standard';
|
|
4
4
|
import { RouterContract } from '@orpc/contract';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { O as OpenAPIHandlerCodec, a as OpenAPIHandlerCodecCore, b as OpenAPIMatcher } from '../../shared/openapi.
|
|
1
|
+
export { O as OpenAPIHandlerCodec, a as OpenAPIHandlerCodecCore, b as OpenAPIMatcher } from '../../shared/openapi.CTlpLuKN.mjs';
|
|
2
2
|
export { O as OpenAPILinkCodec, a as OpenAPILinkCodecError } from '../../shared/openapi.B2SK0ZAr.mjs';
|
|
3
3
|
import '@orpc/client';
|
|
4
4
|
import '@orpc/server';
|
package/dist/index.d.mts
CHANGED
|
@@ -89,6 +89,23 @@ declare class OpenAPIGenerator {
|
|
|
89
89
|
private errorResponse;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
type PopulatedContractRouterOpenAPIPaths<T extends RouterContract> = T extends ProcedureContract<infer UInputSchema, infer UOutputSchema, infer UErrors> ? ProcedureContract<UInputSchema, UOutputSchema, UErrors> : {
|
|
93
|
+
[K in keyof T]: T[K] extends RouterContract ? PopulatedContractRouterOpenAPIPaths<T[K]> : never;
|
|
94
|
+
};
|
|
95
|
+
interface PopulateRouterContractOpenAPIPathsOptions {
|
|
96
|
+
/**
|
|
97
|
+
* Base path segments.
|
|
98
|
+
*/
|
|
99
|
+
path?: undefined | string[];
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Automatically populates missing openapi.path using router structure.
|
|
103
|
+
*
|
|
104
|
+
* Builds paths by joining router keys with `/`.
|
|
105
|
+
* Useful when you want to ensure all contracts define openapi.path, such as for NestJS integration requirements.
|
|
106
|
+
*/
|
|
107
|
+
declare function populateRouterContractOpenAPIPaths<T extends RouterContract>(router: T, options?: PopulateRouterContractOpenAPIPathsOptions): PopulatedContractRouterOpenAPIPaths<T>;
|
|
108
|
+
|
|
92
109
|
/**
|
|
93
110
|
* Dynamic parameters are always returned in path order.
|
|
94
111
|
*/
|
|
@@ -99,5 +116,5 @@ declare function getDynamicPathParams(path: `/${string}`): {
|
|
|
99
116
|
allowsSlash: boolean;
|
|
100
117
|
}[] | undefined;
|
|
101
118
|
|
|
102
|
-
export { DEFAULT_OPENAPI_INPUT_STRUCTURE, DEFAULT_OPENAPI_METHOD, DEFAULT_OPENAPI_OUTPUT_STRUCTURE, DEFAULT_OPENAPI_SUCCESS_DESCRIPTION, JsonifiedClient, JsonifiedClientError, JsonifiedValue, OpenAPIDocument, OpenAPIGenerator, OpenAPIGeneratorError, OpenAPISerializer, createContractJsonifiedCaller, getDynamicPathParams };
|
|
103
|
-
export type { ContractJsonifiedCaller, ContractJsonifiedCallerOptions, OpenAPIGeneratorGenerateOptions, OpenAPIGeneratorOptions };
|
|
119
|
+
export { DEFAULT_OPENAPI_INPUT_STRUCTURE, DEFAULT_OPENAPI_METHOD, DEFAULT_OPENAPI_OUTPUT_STRUCTURE, DEFAULT_OPENAPI_SUCCESS_DESCRIPTION, JsonifiedClient, JsonifiedClientError, JsonifiedValue, OpenAPIDocument, OpenAPIGenerator, OpenAPIGeneratorError, OpenAPISerializer, createContractJsonifiedCaller, getDynamicPathParams, populateRouterContractOpenAPIPaths };
|
|
120
|
+
export type { ContractJsonifiedCaller, ContractJsonifiedCallerOptions, OpenAPIGeneratorGenerateOptions, OpenAPIGeneratorOptions, PopulateRouterContractOpenAPIPathsOptions, PopulatedContractRouterOpenAPIPaths };
|
package/dist/index.d.ts
CHANGED
|
@@ -89,6 +89,23 @@ declare class OpenAPIGenerator {
|
|
|
89
89
|
private errorResponse;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
type PopulatedContractRouterOpenAPIPaths<T extends RouterContract> = T extends ProcedureContract<infer UInputSchema, infer UOutputSchema, infer UErrors> ? ProcedureContract<UInputSchema, UOutputSchema, UErrors> : {
|
|
93
|
+
[K in keyof T]: T[K] extends RouterContract ? PopulatedContractRouterOpenAPIPaths<T[K]> : never;
|
|
94
|
+
};
|
|
95
|
+
interface PopulateRouterContractOpenAPIPathsOptions {
|
|
96
|
+
/**
|
|
97
|
+
* Base path segments.
|
|
98
|
+
*/
|
|
99
|
+
path?: undefined | string[];
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Automatically populates missing openapi.path using router structure.
|
|
103
|
+
*
|
|
104
|
+
* Builds paths by joining router keys with `/`.
|
|
105
|
+
* Useful when you want to ensure all contracts define openapi.path, such as for NestJS integration requirements.
|
|
106
|
+
*/
|
|
107
|
+
declare function populateRouterContractOpenAPIPaths<T extends RouterContract>(router: T, options?: PopulateRouterContractOpenAPIPathsOptions): PopulatedContractRouterOpenAPIPaths<T>;
|
|
108
|
+
|
|
92
109
|
/**
|
|
93
110
|
* Dynamic parameters are always returned in path order.
|
|
94
111
|
*/
|
|
@@ -99,5 +116,5 @@ declare function getDynamicPathParams(path: `/${string}`): {
|
|
|
99
116
|
allowsSlash: boolean;
|
|
100
117
|
}[] | undefined;
|
|
101
118
|
|
|
102
|
-
export { DEFAULT_OPENAPI_INPUT_STRUCTURE, DEFAULT_OPENAPI_METHOD, DEFAULT_OPENAPI_OUTPUT_STRUCTURE, DEFAULT_OPENAPI_SUCCESS_DESCRIPTION, JsonifiedClient, JsonifiedClientError, JsonifiedValue, OpenAPIDocument, OpenAPIGenerator, OpenAPIGeneratorError, OpenAPISerializer, createContractJsonifiedCaller, getDynamicPathParams };
|
|
103
|
-
export type { ContractJsonifiedCaller, ContractJsonifiedCallerOptions, OpenAPIGeneratorGenerateOptions, OpenAPIGeneratorOptions };
|
|
119
|
+
export { DEFAULT_OPENAPI_INPUT_STRUCTURE, DEFAULT_OPENAPI_METHOD, DEFAULT_OPENAPI_OUTPUT_STRUCTURE, DEFAULT_OPENAPI_SUCCESS_DESCRIPTION, JsonifiedClient, JsonifiedClientError, JsonifiedValue, OpenAPIDocument, OpenAPIGenerator, OpenAPIGeneratorError, OpenAPISerializer, createContractJsonifiedCaller, getDynamicPathParams, populateRouterContractOpenAPIPaths };
|
|
120
|
+
export type { ContractJsonifiedCaller, ContractJsonifiedCallerOptions, OpenAPIGeneratorGenerateOptions, OpenAPIGeneratorOptions, PopulateRouterContractOpenAPIPathsOptions, PopulatedContractRouterOpenAPIPaths };
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
export { B as BracketNotationSerializer } from './shared/openapi.Bt87OzTt.mjs';
|
|
2
|
-
import { createContractCaller, getEventIteratorSchemaDetails } from '@orpc/contract';
|
|
2
|
+
import { createContractCaller, getEventIteratorSchemaDetails, 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.DmAa7YPO.mjs';
|
|
4
4
|
export { d as OpenAPIJsonSerializer } from './shared/openapi.DmAa7YPO.mjs';
|
|
5
|
-
import { g as getOpenAPIMeta } from './shared/openapi.B9PQzqBn.mjs';
|
|
6
|
-
export { o as openapi } from './shared/openapi.B9PQzqBn.mjs';
|
|
5
|
+
import { g as getOpenAPIMeta, o as openapi } from './shared/openapi.B9PQzqBn.mjs';
|
|
7
6
|
import { COMMON_ERROR_STATUS_MAP } from '@orpc/client';
|
|
8
7
|
export { COMMON_ERROR_STATUS_MAP } from '@orpc/client';
|
|
9
8
|
import { DelegatingJsonSchemaConverter, StandardJsonSchemaConverter, combineJsonSchemasWithComposition, isUnconstrainedSchema, extractJsonObjectSchemaEntries, combineJsonObjectSchemaEntries, flattenJsonUnionSchema, isJsonPrimitiveSchema, matchArrayableJsonSchema, ensureJsonSchemaObject, isJsonFileSchema, mapJsonSchemaRefs, encodeJsonPointerSegment, decodeJsonPointerSegment } from '@orpc/json-schema';
|
|
10
9
|
import { walkProcedureContractsAsync, DEFAULT_SUCCESS_STATUS, DEFAULT_ERROR_STATUS } from '@orpc/server';
|
|
11
|
-
import { toArray, clone, value, pathToHttpPath, mergeHttpPath, stringifyJSON, findDeepMatches, isPlainObject, isDeepEqual } from '@orpc/shared';
|
|
10
|
+
import { toArray, clone, value, pathToHttpPath, mergeHttpPath, stringifyJSON, findDeepMatches, isPlainObject, isDeepEqual, isTypescriptObject } from '@orpc/shared';
|
|
12
11
|
import '@standardserver/core';
|
|
13
12
|
|
|
14
13
|
function createContractJsonifiedCaller(link, options = {}) {
|
|
@@ -898,4 +897,34 @@ function rewriteComponentSchemaRefs(schema, renameMap) {
|
|
|
898
897
|
});
|
|
899
898
|
}
|
|
900
899
|
|
|
901
|
-
|
|
900
|
+
function populateRouterContractOpenAPIPaths(router, options = {}) {
|
|
901
|
+
const path = toArray(options.path);
|
|
902
|
+
if (router instanceof ProcedureContract) {
|
|
903
|
+
if (getOpenAPIMeta(router)?.path !== void 0) {
|
|
904
|
+
return router;
|
|
905
|
+
}
|
|
906
|
+
const [meta, metaPlugins] = resolveMetaPlugins(
|
|
907
|
+
router["~orpc"].meta,
|
|
908
|
+
router["~orpc"].metaPlugins,
|
|
909
|
+
[openapi({ path: pathToHttpPath(path) })]
|
|
910
|
+
);
|
|
911
|
+
return new ProcedureContract({
|
|
912
|
+
...router["~orpc"],
|
|
913
|
+
meta,
|
|
914
|
+
metaPlugins
|
|
915
|
+
});
|
|
916
|
+
}
|
|
917
|
+
if (!isTypescriptObject(router)) {
|
|
918
|
+
return router;
|
|
919
|
+
}
|
|
920
|
+
const populated = {};
|
|
921
|
+
for (const key in router) {
|
|
922
|
+
populated[key] = populateRouterContractOpenAPIPaths(
|
|
923
|
+
router[key],
|
|
924
|
+
{ ...options, path: [...path, key] }
|
|
925
|
+
);
|
|
926
|
+
}
|
|
927
|
+
return populated;
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
export { DEFAULT_OPENAPI_INPUT_STRUCTURE, DEFAULT_OPENAPI_METHOD, DEFAULT_OPENAPI_OUTPUT_STRUCTURE, DEFAULT_OPENAPI_SUCCESS_DESCRIPTION, OpenAPIGenerator, OpenAPIGeneratorError, OpenAPISerializer, createContractJsonifiedCaller, getDynamicPathParams, getOpenAPIMeta, openapi, populateRouterContractOpenAPIPaths };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnyORPCError } from '@orpc/client';
|
|
2
2
|
import { AnyProcedure, AnyRouter, Context } from '@orpc/server';
|
|
3
|
-
import {
|
|
3
|
+
import { StandardHandlerCodec, StandardHandlerHandleOptions, StandardHandlerCodecResolvedProcedure } from '@orpc/server/standard';
|
|
4
4
|
import { Value, Promisable } from '@orpc/shared';
|
|
5
5
|
import { StandardLazyRequest, StandardResponse } from '@standardserver/core';
|
|
6
6
|
import { AnyProcedureContract } from '@orpc/contract';
|
|
@@ -65,8 +65,8 @@ declare class OpenAPIHandlerCodecCore<T extends Context> {
|
|
|
65
65
|
/**
|
|
66
66
|
* @throws {TypeError} If `outputStructure` is "detailed" and the output doesn't match the expected structure.
|
|
67
67
|
*/
|
|
68
|
-
encodeOutput(output: unknown, procedure: AnyProcedure, path: string[]
|
|
69
|
-
encodeError(error: AnyORPCError
|
|
68
|
+
encodeOutput(output: unknown, procedure: AnyProcedure, path: string[]): Promisable<StandardResponse>;
|
|
69
|
+
encodeError(error: AnyORPCError): Promisable<StandardResponse>;
|
|
70
70
|
private deserializeQuery;
|
|
71
71
|
private deserializeParams;
|
|
72
72
|
}
|
|
@@ -165,7 +165,7 @@ class OpenAPIHandlerCodecCore {
|
|
|
165
165
|
/**
|
|
166
166
|
* @throws {TypeError} If `outputStructure` is "detailed" and the output doesn't match the expected structure.
|
|
167
167
|
*/
|
|
168
|
-
encodeOutput(output, procedure, path
|
|
168
|
+
encodeOutput(output, procedure, path) {
|
|
169
169
|
const meta = getOpenAPIMeta(procedure);
|
|
170
170
|
const successStatus = meta?.successStatus ?? DEFAULT_SUCCESS_STATUS;
|
|
171
171
|
const outputStructure = meta?.outputStructure ?? DEFAULT_OPENAPI_OUTPUT_STRUCTURE;
|
|
@@ -195,7 +195,7 @@ class OpenAPIHandlerCodecCore {
|
|
|
195
195
|
body: this.serializer.serialize(output.body)
|
|
196
196
|
};
|
|
197
197
|
}
|
|
198
|
-
encodeError(error
|
|
198
|
+
encodeError(error) {
|
|
199
199
|
const status = this.errorStatusMap[error.code] ?? DEFAULT_ERROR_STATUS;
|
|
200
200
|
return {
|
|
201
201
|
status,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnyORPCError } from '@orpc/client';
|
|
2
2
|
import { AnyProcedure, AnyRouter, Context } from '@orpc/server';
|
|
3
|
-
import {
|
|
3
|
+
import { StandardHandlerCodec, StandardHandlerHandleOptions, StandardHandlerCodecResolvedProcedure } from '@orpc/server/standard';
|
|
4
4
|
import { Value, Promisable } from '@orpc/shared';
|
|
5
5
|
import { StandardLazyRequest, StandardResponse } from '@standardserver/core';
|
|
6
6
|
import { AnyProcedureContract } from '@orpc/contract';
|
|
@@ -65,8 +65,8 @@ declare class OpenAPIHandlerCodecCore<T extends Context> {
|
|
|
65
65
|
/**
|
|
66
66
|
* @throws {TypeError} If `outputStructure` is "detailed" and the output doesn't match the expected structure.
|
|
67
67
|
*/
|
|
68
|
-
encodeOutput(output: unknown, procedure: AnyProcedure, path: string[]
|
|
69
|
-
encodeError(error: AnyORPCError
|
|
68
|
+
encodeOutput(output: unknown, procedure: AnyProcedure, path: string[]): Promisable<StandardResponse>;
|
|
69
|
+
encodeError(error: AnyORPCError): Promisable<StandardResponse>;
|
|
70
70
|
private deserializeQuery;
|
|
71
71
|
private deserializeParams;
|
|
72
72
|
}
|
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.4",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.dev",
|
|
7
7
|
"repository": {
|
|
@@ -65,11 +65,11 @@
|
|
|
65
65
|
"@types/swagger-ui": "^5.32.0",
|
|
66
66
|
"rou3": "^0.8.1",
|
|
67
67
|
"swagger-ui": "^5.32.6",
|
|
68
|
-
"@orpc/
|
|
69
|
-
"@orpc/
|
|
70
|
-
"@orpc/
|
|
71
|
-
"@orpc/
|
|
72
|
-
"@orpc/
|
|
68
|
+
"@orpc/client": "2.0.0-beta.4",
|
|
69
|
+
"@orpc/contract": "2.0.0-beta.4",
|
|
70
|
+
"@orpc/server": "2.0.0-beta.4",
|
|
71
|
+
"@orpc/json-schema": "2.0.0-beta.4",
|
|
72
|
+
"@orpc/shared": "2.0.0-beta.4"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"fastify": "^5.6.2",
|