@orpc/openapi 1.10.1 → 1.10.2
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/dist/adapters/aws-lambda/index.d.mts +2 -1
- package/dist/adapters/aws-lambda/index.d.ts +2 -1
- package/dist/adapters/aws-lambda/index.mjs +1 -1
- package/dist/adapters/fastify/index.d.mts +23 -0
- package/dist/adapters/fastify/index.d.ts +23 -0
- package/dist/adapters/fastify/index.mjs +18 -0
- package/dist/adapters/fetch/index.d.mts +2 -1
- package/dist/adapters/fetch/index.d.ts +2 -1
- package/dist/adapters/fetch/index.mjs +1 -1
- package/dist/adapters/node/index.d.mts +2 -1
- package/dist/adapters/node/index.d.ts +2 -1
- package/dist/adapters/node/index.mjs +1 -1
- package/dist/adapters/standard/index.d.mts +7 -16
- package/dist/adapters/standard/index.d.ts +7 -16
- package/dist/adapters/standard/index.mjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +2 -2
- package/dist/plugins/index.d.mts +1 -1
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.mjs +1 -1
- package/dist/shared/{openapi.CfjfVeBJ.d.mts → openapi.BfNjg7j9.d.mts} +13 -1
- package/dist/shared/{openapi.CfjfVeBJ.d.ts → openapi.BfNjg7j9.d.ts} +13 -1
- package/dist/shared/{openapi.BVXcB0u4.mjs → openapi.DIt-Z9W1.mjs} +6 -3
- package/dist/shared/{openapi.BlSv9FKY.mjs → openapi.DrTcell5.mjs} +22 -23
- package/dist/shared/openapi.DwaweYRb.d.mts +54 -0
- package/dist/shared/openapi.DwaweYRb.d.ts +54 -0
- package/package.json +15 -9
- package/dist/shared/openapi.CQmjvnb0.d.mts +0 -31
- package/dist/shared/openapi.CQmjvnb0.d.ts +0 -31
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Context, Router } from '@orpc/server';
|
|
2
2
|
import { AwsLambdaHandler, AwsLambdaHandlerOptions } from '@orpc/server/aws-lambda';
|
|
3
|
-
import {
|
|
3
|
+
import { b as StandardOpenAPIHandlerOptions } from '../../shared/openapi.DwaweYRb.mjs';
|
|
4
4
|
import '@orpc/openapi-client/standard';
|
|
5
5
|
import '@orpc/server/standard';
|
|
6
6
|
import '@orpc/client';
|
|
7
|
+
import '@orpc/standard-server';
|
|
7
8
|
import '@orpc/shared';
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Context, Router } from '@orpc/server';
|
|
2
2
|
import { AwsLambdaHandler, AwsLambdaHandlerOptions } from '@orpc/server/aws-lambda';
|
|
3
|
-
import {
|
|
3
|
+
import { b as StandardOpenAPIHandlerOptions } from '../../shared/openapi.DwaweYRb.js';
|
|
4
4
|
import '@orpc/openapi-client/standard';
|
|
5
5
|
import '@orpc/server/standard';
|
|
6
6
|
import '@orpc/client';
|
|
7
|
+
import '@orpc/standard-server';
|
|
7
8
|
import '@orpc/shared';
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -2,7 +2,7 @@ import { AwsLambdaHandler } from '@orpc/server/aws-lambda';
|
|
|
2
2
|
import '@orpc/client';
|
|
3
3
|
import '@orpc/contract';
|
|
4
4
|
import '@orpc/shared';
|
|
5
|
-
import { a as StandardOpenAPIHandler } from '../../shared/openapi.
|
|
5
|
+
import { a as StandardOpenAPIHandler } from '../../shared/openapi.DIt-Z9W1.mjs';
|
|
6
6
|
import '@orpc/client/standard';
|
|
7
7
|
import '@orpc/server';
|
|
8
8
|
import 'rou3';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Context, Router } from '@orpc/server';
|
|
2
|
+
import { FastifyHandlerOptions, FastifyHandler } from '@orpc/server/fastify';
|
|
3
|
+
import { b as StandardOpenAPIHandlerOptions } from '../../shared/openapi.DwaweYRb.mjs';
|
|
4
|
+
import '@orpc/openapi-client/standard';
|
|
5
|
+
import '@orpc/server/standard';
|
|
6
|
+
import '@orpc/client';
|
|
7
|
+
import '@orpc/standard-server';
|
|
8
|
+
import '@orpc/shared';
|
|
9
|
+
|
|
10
|
+
interface OpenAPIHandlerOptions<T extends Context> extends FastifyHandlerOptions<T>, StandardOpenAPIHandlerOptions<T> {
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* OpenAPI Handler for Fastify Server
|
|
14
|
+
*
|
|
15
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-handler OpenAPI Handler Docs}
|
|
16
|
+
* @see {@link https://orpc.unnoq.com/docs/adapters/http HTTP Adapter Docs}
|
|
17
|
+
*/
|
|
18
|
+
declare class OpenAPIHandler<T extends Context> extends FastifyHandler<T> {
|
|
19
|
+
constructor(router: Router<any, T>, options?: NoInfer<OpenAPIHandlerOptions<T>>);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { OpenAPIHandler };
|
|
23
|
+
export type { OpenAPIHandlerOptions };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Context, Router } from '@orpc/server';
|
|
2
|
+
import { FastifyHandlerOptions, FastifyHandler } from '@orpc/server/fastify';
|
|
3
|
+
import { b as StandardOpenAPIHandlerOptions } from '../../shared/openapi.DwaweYRb.js';
|
|
4
|
+
import '@orpc/openapi-client/standard';
|
|
5
|
+
import '@orpc/server/standard';
|
|
6
|
+
import '@orpc/client';
|
|
7
|
+
import '@orpc/standard-server';
|
|
8
|
+
import '@orpc/shared';
|
|
9
|
+
|
|
10
|
+
interface OpenAPIHandlerOptions<T extends Context> extends FastifyHandlerOptions<T>, StandardOpenAPIHandlerOptions<T> {
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* OpenAPI Handler for Fastify Server
|
|
14
|
+
*
|
|
15
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-handler OpenAPI Handler Docs}
|
|
16
|
+
* @see {@link https://orpc.unnoq.com/docs/adapters/http HTTP Adapter Docs}
|
|
17
|
+
*/
|
|
18
|
+
declare class OpenAPIHandler<T extends Context> extends FastifyHandler<T> {
|
|
19
|
+
constructor(router: Router<any, T>, options?: NoInfer<OpenAPIHandlerOptions<T>>);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { OpenAPIHandler };
|
|
23
|
+
export type { OpenAPIHandlerOptions };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FastifyHandler } from '@orpc/server/fastify';
|
|
2
|
+
import '@orpc/client';
|
|
3
|
+
import '@orpc/contract';
|
|
4
|
+
import '@orpc/shared';
|
|
5
|
+
import { a as StandardOpenAPIHandler } from '../../shared/openapi.DIt-Z9W1.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 FastifyHandler {
|
|
13
|
+
constructor(router, options = {}) {
|
|
14
|
+
super(new StandardOpenAPIHandler(router, options), options);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { OpenAPIHandler };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Context, Router } from '@orpc/server';
|
|
2
2
|
import { FetchHandlerOptions, FetchHandler } from '@orpc/server/fetch';
|
|
3
|
-
import {
|
|
3
|
+
import { b as StandardOpenAPIHandlerOptions } from '../../shared/openapi.DwaweYRb.mjs';
|
|
4
4
|
import '@orpc/openapi-client/standard';
|
|
5
5
|
import '@orpc/server/standard';
|
|
6
6
|
import '@orpc/client';
|
|
7
|
+
import '@orpc/standard-server';
|
|
7
8
|
import '@orpc/shared';
|
|
8
9
|
|
|
9
10
|
interface OpenAPIHandlerOptions<T extends Context> extends FetchHandlerOptions<T>, Omit<StandardOpenAPIHandlerOptions<T>, 'plugins'> {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Context, Router } from '@orpc/server';
|
|
2
2
|
import { FetchHandlerOptions, FetchHandler } from '@orpc/server/fetch';
|
|
3
|
-
import {
|
|
3
|
+
import { b as StandardOpenAPIHandlerOptions } from '../../shared/openapi.DwaweYRb.js';
|
|
4
4
|
import '@orpc/openapi-client/standard';
|
|
5
5
|
import '@orpc/server/standard';
|
|
6
6
|
import '@orpc/client';
|
|
7
|
+
import '@orpc/standard-server';
|
|
7
8
|
import '@orpc/shared';
|
|
8
9
|
|
|
9
10
|
interface OpenAPIHandlerOptions<T extends Context> extends FetchHandlerOptions<T>, Omit<StandardOpenAPIHandlerOptions<T>, 'plugins'> {
|
|
@@ -2,7 +2,7 @@ import { FetchHandler } from '@orpc/server/fetch';
|
|
|
2
2
|
import '@orpc/client';
|
|
3
3
|
import '@orpc/contract';
|
|
4
4
|
import '@orpc/shared';
|
|
5
|
-
import { a as StandardOpenAPIHandler } from '../../shared/openapi.
|
|
5
|
+
import { a as StandardOpenAPIHandler } from '../../shared/openapi.DIt-Z9W1.mjs';
|
|
6
6
|
import '@orpc/client/standard';
|
|
7
7
|
import '@orpc/server';
|
|
8
8
|
import 'rou3';
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Context, Router } from '@orpc/server';
|
|
2
2
|
import { NodeHttpHandlerOptions, NodeHttpHandler } from '@orpc/server/node';
|
|
3
|
-
import {
|
|
3
|
+
import { b as StandardOpenAPIHandlerOptions } from '../../shared/openapi.DwaweYRb.mjs';
|
|
4
4
|
import '@orpc/openapi-client/standard';
|
|
5
5
|
import '@orpc/server/standard';
|
|
6
6
|
import '@orpc/client';
|
|
7
|
+
import '@orpc/standard-server';
|
|
7
8
|
import '@orpc/shared';
|
|
8
9
|
|
|
9
10
|
interface OpenAPIHandlerOptions<T extends Context> extends NodeHttpHandlerOptions<T>, Omit<StandardOpenAPIHandlerOptions<T>, 'plugins'> {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Context, Router } from '@orpc/server';
|
|
2
2
|
import { NodeHttpHandlerOptions, NodeHttpHandler } from '@orpc/server/node';
|
|
3
|
-
import {
|
|
3
|
+
import { b as StandardOpenAPIHandlerOptions } from '../../shared/openapi.DwaweYRb.js';
|
|
4
4
|
import '@orpc/openapi-client/standard';
|
|
5
5
|
import '@orpc/server/standard';
|
|
6
6
|
import '@orpc/client';
|
|
7
|
+
import '@orpc/standard-server';
|
|
7
8
|
import '@orpc/shared';
|
|
8
9
|
|
|
9
10
|
interface OpenAPIHandlerOptions<T extends Context> extends NodeHttpHandlerOptions<T>, Omit<StandardOpenAPIHandlerOptions<T>, 'plugins'> {
|
|
@@ -2,7 +2,7 @@ import { NodeHttpHandler } from '@orpc/server/node';
|
|
|
2
2
|
import '@orpc/client';
|
|
3
3
|
import '@orpc/contract';
|
|
4
4
|
import '@orpc/shared';
|
|
5
|
-
import { a as StandardOpenAPIHandler } from '../../shared/openapi.
|
|
5
|
+
import { a as StandardOpenAPIHandler } from '../../shared/openapi.DIt-Z9W1.mjs';
|
|
6
6
|
import '@orpc/client/standard';
|
|
7
7
|
import '@orpc/server';
|
|
8
8
|
import 'rou3';
|
|
@@ -1,20 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
1
|
+
export { a as StandardOpenAPICodec, S as StandardOpenAPICodecOptions, c as StandardOpenAPIHandler, b as StandardOpenAPIHandlerOptions, e as StandardOpenAPIMatcher, d as StandardOpenAPIMatcherOptions } from '../../shared/openapi.DwaweYRb.mjs';
|
|
2
|
+
import { HTTPPath } from '@orpc/client';
|
|
3
|
+
import '@orpc/openapi-client/standard';
|
|
4
|
+
import '@orpc/server';
|
|
5
|
+
import '@orpc/server/standard';
|
|
6
|
+
import '@orpc/standard-server';
|
|
7
7
|
import '@orpc/shared';
|
|
8
8
|
|
|
9
|
-
declare class StandardOpenAPICodec implements StandardCodec {
|
|
10
|
-
#private;
|
|
11
|
-
private readonly serializer;
|
|
12
|
-
constructor(serializer: StandardOpenAPISerializer);
|
|
13
|
-
decode(request: StandardLazyRequest, params: StandardParams | undefined, procedure: AnyProcedure): Promise<unknown>;
|
|
14
|
-
encode(output: unknown, procedure: AnyProcedure): StandardResponse;
|
|
15
|
-
encodeError(error: ORPCError<any, any>): StandardResponse;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
9
|
/**
|
|
19
10
|
* {@link https://github.com/unjs/rou3}
|
|
20
11
|
*
|
|
@@ -26,4 +17,4 @@ declare function toRou3Pattern(path: HTTPPath): string;
|
|
|
26
17
|
*/
|
|
27
18
|
declare function decodeParams(params: Record<string, string>): Record<string, string>;
|
|
28
19
|
|
|
29
|
-
export {
|
|
20
|
+
export { decodeParams, toRou3Pattern };
|
|
@@ -1,20 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
1
|
+
export { a as StandardOpenAPICodec, S as StandardOpenAPICodecOptions, c as StandardOpenAPIHandler, b as StandardOpenAPIHandlerOptions, e as StandardOpenAPIMatcher, d as StandardOpenAPIMatcherOptions } from '../../shared/openapi.DwaweYRb.js';
|
|
2
|
+
import { HTTPPath } from '@orpc/client';
|
|
3
|
+
import '@orpc/openapi-client/standard';
|
|
4
|
+
import '@orpc/server';
|
|
5
|
+
import '@orpc/server/standard';
|
|
6
|
+
import '@orpc/standard-server';
|
|
7
7
|
import '@orpc/shared';
|
|
8
8
|
|
|
9
|
-
declare class StandardOpenAPICodec implements StandardCodec {
|
|
10
|
-
#private;
|
|
11
|
-
private readonly serializer;
|
|
12
|
-
constructor(serializer: StandardOpenAPISerializer);
|
|
13
|
-
decode(request: StandardLazyRequest, params: StandardParams | undefined, procedure: AnyProcedure): Promise<unknown>;
|
|
14
|
-
encode(output: unknown, procedure: AnyProcedure): StandardResponse;
|
|
15
|
-
encodeError(error: ORPCError<any, any>): StandardResponse;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
9
|
/**
|
|
19
10
|
* {@link https://github.com/unjs/rou3}
|
|
20
11
|
*
|
|
@@ -26,4 +17,4 @@ declare function toRou3Pattern(path: HTTPPath): string;
|
|
|
26
17
|
*/
|
|
27
18
|
declare function decodeParams(params: Record<string, string>): Record<string, string>;
|
|
28
19
|
|
|
29
|
-
export {
|
|
20
|
+
export { decodeParams, toRou3Pattern };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { S as StandardOpenAPICodec, a as StandardOpenAPIHandler, b as StandardOpenAPIMatcher, d as decodeParams, t as toRou3Pattern } from '../../shared/openapi.
|
|
1
|
+
export { S as StandardOpenAPICodec, a as StandardOpenAPIHandler, b as StandardOpenAPIMatcher, d as decodeParams, t as toRou3Pattern } from '../../shared/openapi.DIt-Z9W1.mjs';
|
|
2
2
|
import '@orpc/openapi-client/standard';
|
|
3
3
|
import '@orpc/server/standard';
|
|
4
4
|
import '@orpc/client';
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OpenAPI, AnyContractProcedure } from '@orpc/contract';
|
|
2
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.
|
|
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.BfNjg7j9.mjs';
|
|
4
4
|
import { HTTPPath, HTTPMethod } from '@orpc/client';
|
|
5
5
|
import { JSONSchema } from '@orpc/interop/json-schema-typed/draft-2020-12';
|
|
6
6
|
export { JSONSchema, ContentEncoding as JSONSchemaContentEncoding, Format as JSONSchemaFormat, TypeName as JSONSchemaTypeName } from '@orpc/interop/json-schema-typed/draft-2020-12';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OpenAPI, AnyContractProcedure } from '@orpc/contract';
|
|
2
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.
|
|
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.BfNjg7j9.js';
|
|
4
4
|
import { HTTPPath, HTTPMethod } from '@orpc/client';
|
|
5
5
|
import { JSONSchema } from '@orpc/interop/json-schema-typed/draft-2020-12';
|
|
6
6
|
export { JSONSchema, ContentEncoding as JSONSchemaContentEncoding, Format as JSONSchemaFormat, TypeName as JSONSchemaTypeName } from '@orpc/interop/json-schema-typed/draft-2020-12';
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as customOpenAPIOperation } from './shared/openapi.
|
|
2
|
-
export { C as CompositeSchemaConverter, L as LOGIC_KEYWORDS, O as OpenAPIGenerator, a as applyCustomOpenAPIOperation, n as applySchemaOptionality, h as checkParamsSchema, p as expandArrayableSchema, o as expandUnionSchema, m as filterSchemaBranches, g as getCustomOpenAPIOperation, l as isAnySchema, j as isFileSchema, k as isObjectSchema, q as isPrimitiveSchema, r as resolveOpenAPIJsonSchemaRef, s as separateObjectSchema, d as toOpenAPIContent, e as toOpenAPIEventIteratorContent, b as toOpenAPIMethod, f as toOpenAPIParameters, t as toOpenAPIPath, i as toOpenAPISchema } from './shared/openapi.
|
|
1
|
+
import { c as customOpenAPIOperation } from './shared/openapi.DrTcell5.mjs';
|
|
2
|
+
export { C as CompositeSchemaConverter, L as LOGIC_KEYWORDS, O as OpenAPIGenerator, a as applyCustomOpenAPIOperation, n as applySchemaOptionality, h as checkParamsSchema, p as expandArrayableSchema, o as expandUnionSchema, m as filterSchemaBranches, g as getCustomOpenAPIOperation, l as isAnySchema, j as isFileSchema, k as isObjectSchema, q as isPrimitiveSchema, r as resolveOpenAPIJsonSchemaRef, s as separateObjectSchema, d as toOpenAPIContent, e as toOpenAPIEventIteratorContent, b as toOpenAPIMethod, f as toOpenAPIParameters, t as toOpenAPIPath, i as toOpenAPISchema } from './shared/openapi.DrTcell5.mjs';
|
|
3
3
|
import { createORPCErrorFromJson } from '@orpc/client';
|
|
4
4
|
import { StandardOpenAPISerializer, StandardOpenAPIJsonSerializer, StandardBracketNotationSerializer } from '@orpc/openapi-client/standard';
|
|
5
5
|
import { ORPCError, createRouterClient } from '@orpc/server';
|
package/dist/plugins/index.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import { OpenAPI } from '@orpc/contract';
|
|
|
2
2
|
import { Context, HTTPPath, Router } from '@orpc/server';
|
|
3
3
|
import { StandardHandlerInterceptorOptions, StandardHandlerPlugin, StandardHandlerOptions } from '@orpc/server/standard';
|
|
4
4
|
import { Value, Promisable } from '@orpc/shared';
|
|
5
|
-
import { O as OpenAPIGeneratorOptions, a as OpenAPIGeneratorGenerateOptions } from '../shared/openapi.
|
|
5
|
+
import { O as OpenAPIGeneratorOptions, a as OpenAPIGeneratorGenerateOptions } from '../shared/openapi.BfNjg7j9.mjs';
|
|
6
6
|
import '@orpc/openapi-client/standard';
|
|
7
7
|
import '@orpc/interop/json-schema-typed/draft-2020-12';
|
|
8
8
|
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { OpenAPI } from '@orpc/contract';
|
|
|
2
2
|
import { Context, HTTPPath, Router } from '@orpc/server';
|
|
3
3
|
import { StandardHandlerInterceptorOptions, StandardHandlerPlugin, StandardHandlerOptions } from '@orpc/server/standard';
|
|
4
4
|
import { Value, Promisable } from '@orpc/shared';
|
|
5
|
-
import { O as OpenAPIGeneratorOptions, a as OpenAPIGeneratorGenerateOptions } from '../shared/openapi.
|
|
5
|
+
import { O as OpenAPIGeneratorOptions, a as OpenAPIGeneratorGenerateOptions } from '../shared/openapi.BfNjg7j9.js';
|
|
6
6
|
import '@orpc/openapi-client/standard';
|
|
7
7
|
import '@orpc/interop/json-schema-typed/draft-2020-12';
|
|
8
8
|
|
package/dist/plugins/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { stringifyJSON, once, value } from '@orpc/shared';
|
|
2
|
-
import { O as OpenAPIGenerator } from '../shared/openapi.
|
|
2
|
+
import { O as OpenAPIGenerator } from '../shared/openapi.DrTcell5.mjs';
|
|
3
3
|
import '@orpc/client';
|
|
4
4
|
import '@orpc/client/standard';
|
|
5
5
|
import '@orpc/contract';
|
|
@@ -85,6 +85,18 @@ interface OpenAPIGeneratorGenerateOptions extends Partial<Omit<OpenAPI.Document,
|
|
|
85
85
|
error: 'UndefinedError';
|
|
86
86
|
schema?: never;
|
|
87
87
|
}>;
|
|
88
|
+
/**
|
|
89
|
+
* Define a custom JSON schema for the error response body when using
|
|
90
|
+
* type-safe errors. Helps align ORPC error formatting with existing API
|
|
91
|
+
* response standards or conventions.
|
|
92
|
+
*
|
|
93
|
+
* @remarks
|
|
94
|
+
* - Return `null | undefined` to use the default error response body shaper.
|
|
95
|
+
*/
|
|
96
|
+
customErrorResponseBodySchema?: Value<JSONSchema | undefined | null, [
|
|
97
|
+
definedErrors: [code: string, defaultMessage: string, dataRequired: boolean, dataSchema: JSONSchema][],
|
|
98
|
+
status: number
|
|
99
|
+
]>;
|
|
88
100
|
}
|
|
89
101
|
/**
|
|
90
102
|
* The generator that converts oRPC routers/contracts to OpenAPI specifications.
|
|
@@ -101,7 +113,7 @@ declare class OpenAPIGenerator {
|
|
|
101
113
|
*
|
|
102
114
|
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-specification OpenAPI Specification Docs}
|
|
103
115
|
*/
|
|
104
|
-
generate(router: AnyContractRouter | AnyRouter,
|
|
116
|
+
generate(router: AnyContractRouter | AnyRouter, { customErrorResponseBodySchema, commonSchemas, filter: baseFilter, exclude, ...baseDoc }?: OpenAPIGeneratorGenerateOptions): Promise<OpenAPI.Document>;
|
|
105
117
|
}
|
|
106
118
|
|
|
107
119
|
export { OpenAPIGenerator as b, CompositeSchemaConverter as e };
|
|
@@ -85,6 +85,18 @@ interface OpenAPIGeneratorGenerateOptions extends Partial<Omit<OpenAPI.Document,
|
|
|
85
85
|
error: 'UndefinedError';
|
|
86
86
|
schema?: never;
|
|
87
87
|
}>;
|
|
88
|
+
/**
|
|
89
|
+
* Define a custom JSON schema for the error response body when using
|
|
90
|
+
* type-safe errors. Helps align ORPC error formatting with existing API
|
|
91
|
+
* response standards or conventions.
|
|
92
|
+
*
|
|
93
|
+
* @remarks
|
|
94
|
+
* - Return `null | undefined` to use the default error response body shaper.
|
|
95
|
+
*/
|
|
96
|
+
customErrorResponseBodySchema?: Value<JSONSchema | undefined | null, [
|
|
97
|
+
definedErrors: [code: string, defaultMessage: string, dataRequired: boolean, dataSchema: JSONSchema][],
|
|
98
|
+
status: number
|
|
99
|
+
]>;
|
|
88
100
|
}
|
|
89
101
|
/**
|
|
90
102
|
* The generator that converts oRPC routers/contracts to OpenAPI specifications.
|
|
@@ -101,7 +113,7 @@ declare class OpenAPIGenerator {
|
|
|
101
113
|
*
|
|
102
114
|
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-specification OpenAPI Specification Docs}
|
|
103
115
|
*/
|
|
104
|
-
generate(router: AnyContractRouter | AnyRouter,
|
|
116
|
+
generate(router: AnyContractRouter | AnyRouter, { customErrorResponseBodySchema, commonSchemas, filter: baseFilter, exclude, ...baseDoc }?: OpenAPIGeneratorGenerateOptions): Promise<OpenAPI.Document>;
|
|
105
117
|
}
|
|
106
118
|
|
|
107
119
|
export { OpenAPIGenerator as b, CompositeSchemaConverter as e };
|
|
@@ -8,9 +8,11 @@ import { traverseContractProcedures, isProcedure, getLazyMeta, unlazy, getRouter
|
|
|
8
8
|
import { createRouter, addRoute, findRoute } from 'rou3';
|
|
9
9
|
|
|
10
10
|
class StandardOpenAPICodec {
|
|
11
|
-
constructor(serializer) {
|
|
11
|
+
constructor(serializer, options = {}) {
|
|
12
12
|
this.serializer = serializer;
|
|
13
|
+
this.customErrorResponseBodyEncoder = options.customErrorResponseBodyEncoder;
|
|
13
14
|
}
|
|
15
|
+
customErrorResponseBodyEncoder;
|
|
14
16
|
async decode(request, params, procedure) {
|
|
15
17
|
const inputStructure = fallbackContractConfig("defaultInputStructure", procedure["~orpc"].route.inputStructure);
|
|
16
18
|
if (inputStructure === "compact") {
|
|
@@ -73,10 +75,11 @@ class StandardOpenAPICodec {
|
|
|
73
75
|
};
|
|
74
76
|
}
|
|
75
77
|
encodeError(error) {
|
|
78
|
+
const body = this.customErrorResponseBodyEncoder?.(error) ?? error.toJSON();
|
|
76
79
|
return {
|
|
77
80
|
status: error.status,
|
|
78
81
|
headers: {},
|
|
79
|
-
body: this.serializer.serialize(
|
|
82
|
+
body: this.serializer.serialize(body, { outputFormat: "plain" })
|
|
80
83
|
};
|
|
81
84
|
}
|
|
82
85
|
#isDetailedOutput(output) {
|
|
@@ -179,7 +182,7 @@ class StandardOpenAPIHandler extends StandardHandler {
|
|
|
179
182
|
const bracketNotationSerializer = new StandardBracketNotationSerializer(options);
|
|
180
183
|
const serializer = new StandardOpenAPISerializer(jsonSerializer, bracketNotationSerializer);
|
|
181
184
|
const matcher = new StandardOpenAPIMatcher(options);
|
|
182
|
-
const codec = new StandardOpenAPICodec(serializer);
|
|
185
|
+
const codec = new StandardOpenAPICodec(serializer, options);
|
|
183
186
|
super(router, matcher, codec, options);
|
|
184
187
|
}
|
|
185
188
|
}
|
|
@@ -389,19 +389,16 @@ class OpenAPIGenerator {
|
|
|
389
389
|
*
|
|
390
390
|
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-specification OpenAPI Specification Docs}
|
|
391
391
|
*/
|
|
392
|
-
async generate(router,
|
|
393
|
-
const filter =
|
|
394
|
-
return !(
|
|
392
|
+
async generate(router, { customErrorResponseBodySchema, commonSchemas, filter: baseFilter, exclude, ...baseDoc } = {}) {
|
|
393
|
+
const filter = baseFilter ?? (({ contract, path }) => {
|
|
394
|
+
return !(exclude?.(contract, path) ?? false);
|
|
395
395
|
});
|
|
396
396
|
const doc = {
|
|
397
|
-
...clone(
|
|
398
|
-
info:
|
|
399
|
-
openapi: "3.1.1"
|
|
400
|
-
exclude: void 0,
|
|
401
|
-
filter: void 0,
|
|
402
|
-
commonSchemas: void 0
|
|
397
|
+
...clone(baseDoc),
|
|
398
|
+
info: baseDoc.info ?? { title: "API Reference", version: "0.0.0" },
|
|
399
|
+
openapi: "3.1.1"
|
|
403
400
|
};
|
|
404
|
-
const { baseSchemaConvertOptions, undefinedErrorJsonSchema } = await this.#resolveCommonSchemas(doc,
|
|
401
|
+
const { baseSchemaConvertOptions, undefinedErrorJsonSchema } = await this.#resolveCommonSchemas(doc, commonSchemas);
|
|
405
402
|
const contracts = [];
|
|
406
403
|
await resolveContractProcedures({ path: [], router }, (traverseOptions) => {
|
|
407
404
|
if (!value(filter, traverseOptions)) {
|
|
@@ -429,7 +426,7 @@ class OpenAPIGenerator {
|
|
|
429
426
|
};
|
|
430
427
|
await this.#request(doc, operationObjectRef, def, baseSchemaConvertOptions);
|
|
431
428
|
await this.#successResponse(doc, operationObjectRef, def, baseSchemaConvertOptions);
|
|
432
|
-
await this.#errorResponse(operationObjectRef, def, baseSchemaConvertOptions, undefinedErrorJsonSchema);
|
|
429
|
+
await this.#errorResponse(operationObjectRef, def, baseSchemaConvertOptions, undefinedErrorJsonSchema, customErrorResponseBodySchema);
|
|
433
430
|
}
|
|
434
431
|
if (typeof def.route.spec === "function") {
|
|
435
432
|
operationObjectRef = def.route.spec(operationObjectRef);
|
|
@@ -708,38 +705,40 @@ ${errors.join("\n\n")}`
|
|
|
708
705
|
}
|
|
709
706
|
}
|
|
710
707
|
}
|
|
711
|
-
async #errorResponse(ref, def, baseSchemaConvertOptions, undefinedErrorSchema) {
|
|
708
|
+
async #errorResponse(ref, def, baseSchemaConvertOptions, undefinedErrorSchema, customErrorResponseBodySchema) {
|
|
712
709
|
const errorMap = def.errorMap;
|
|
713
|
-
const
|
|
710
|
+
const errorResponsesByStatus = {};
|
|
714
711
|
for (const code in errorMap) {
|
|
715
712
|
const config = errorMap[code];
|
|
716
713
|
if (!config) {
|
|
717
714
|
continue;
|
|
718
715
|
}
|
|
719
716
|
const status = fallbackORPCErrorStatus(code, config.status);
|
|
720
|
-
const
|
|
717
|
+
const defaultMessage = fallbackORPCErrorMessage(code, config.message);
|
|
718
|
+
errorResponsesByStatus[status] ??= { status, definedErrorDefinitions: [], errorSchemaVariants: [] };
|
|
721
719
|
const [dataRequired, dataSchema] = await this.converter.convert(config.data, { ...baseSchemaConvertOptions, strategy: "output" });
|
|
722
|
-
|
|
723
|
-
|
|
720
|
+
errorResponsesByStatus[status].definedErrorDefinitions.push([code, defaultMessage, dataRequired, dataSchema]);
|
|
721
|
+
errorResponsesByStatus[status].errorSchemaVariants.push({
|
|
724
722
|
type: "object",
|
|
725
723
|
properties: {
|
|
726
724
|
defined: { const: true },
|
|
727
725
|
code: { const: code },
|
|
728
726
|
status: { const: status },
|
|
729
|
-
message: { type: "string", default:
|
|
727
|
+
message: { type: "string", default: defaultMessage },
|
|
730
728
|
data: dataSchema
|
|
731
729
|
},
|
|
732
730
|
required: dataRequired ? ["defined", "code", "status", "message", "data"] : ["defined", "code", "status", "message"]
|
|
733
731
|
});
|
|
734
732
|
}
|
|
735
733
|
ref.responses ??= {};
|
|
736
|
-
for (const
|
|
737
|
-
const
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
734
|
+
for (const statusString in errorResponsesByStatus) {
|
|
735
|
+
const errorResponse = errorResponsesByStatus[statusString];
|
|
736
|
+
const customBodySchema = value(customErrorResponseBodySchema, errorResponse.definedErrorDefinitions, errorResponse.status);
|
|
737
|
+
ref.responses[statusString] = {
|
|
738
|
+
description: statusString,
|
|
739
|
+
content: toOpenAPIContent(customBodySchema ?? {
|
|
741
740
|
oneOf: [
|
|
742
|
-
...
|
|
741
|
+
...errorResponse.errorSchemaVariants,
|
|
743
742
|
undefinedErrorSchema
|
|
744
743
|
]
|
|
745
744
|
})
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { StandardOpenAPISerializer, StandardOpenAPIJsonSerializerOptions, StandardBracketNotationSerializerOptions } from '@orpc/openapi-client/standard';
|
|
2
|
+
import { AnyProcedure, TraverseContractProcedureCallbackOptions, AnyRouter, Context, Router } from '@orpc/server';
|
|
3
|
+
import { StandardCodec, StandardParams, StandardMatcher, StandardMatchResult, StandardHandlerOptions, StandardHandler } from '@orpc/server/standard';
|
|
4
|
+
import { ORPCError, HTTPPath } from '@orpc/client';
|
|
5
|
+
import { StandardLazyRequest, StandardResponse } from '@orpc/standard-server';
|
|
6
|
+
import { Value } from '@orpc/shared';
|
|
7
|
+
|
|
8
|
+
interface StandardOpenAPICodecOptions {
|
|
9
|
+
/**
|
|
10
|
+
* Customize how an ORPC error is encoded into a response body.
|
|
11
|
+
* Use this if your API needs a different error output structure.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* - Return `null | undefined` to fallback to default behavior
|
|
15
|
+
*
|
|
16
|
+
* @default ((e) => e.toJSON())
|
|
17
|
+
*/
|
|
18
|
+
customErrorResponseBodyEncoder?: (error: ORPCError<any, any>) => unknown;
|
|
19
|
+
}
|
|
20
|
+
declare class StandardOpenAPICodec implements StandardCodec {
|
|
21
|
+
#private;
|
|
22
|
+
private readonly serializer;
|
|
23
|
+
private readonly customErrorResponseBodyEncoder;
|
|
24
|
+
constructor(serializer: StandardOpenAPISerializer, options?: StandardOpenAPICodecOptions);
|
|
25
|
+
decode(request: StandardLazyRequest, params: StandardParams | undefined, procedure: AnyProcedure): Promise<unknown>;
|
|
26
|
+
encode(output: unknown, procedure: AnyProcedure): StandardResponse;
|
|
27
|
+
encodeError(error: ORPCError<any, any>): StandardResponse;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface StandardOpenAPIMatcherOptions {
|
|
31
|
+
/**
|
|
32
|
+
* Filter procedures. Return `false` to exclude a procedure from matching.
|
|
33
|
+
*
|
|
34
|
+
* @default true
|
|
35
|
+
*/
|
|
36
|
+
filter?: Value<boolean, [options: TraverseContractProcedureCallbackOptions]>;
|
|
37
|
+
}
|
|
38
|
+
declare class StandardOpenAPIMatcher implements StandardMatcher {
|
|
39
|
+
private readonly filter;
|
|
40
|
+
private readonly tree;
|
|
41
|
+
private pendingRouters;
|
|
42
|
+
constructor(options?: StandardOpenAPIMatcherOptions);
|
|
43
|
+
init(router: AnyRouter, path?: readonly string[]): void;
|
|
44
|
+
match(method: string, pathname: HTTPPath): Promise<StandardMatchResult>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface StandardOpenAPIHandlerOptions<T extends Context> extends StandardHandlerOptions<T>, StandardOpenAPIJsonSerializerOptions, StandardBracketNotationSerializerOptions, StandardOpenAPIMatcherOptions, StandardOpenAPICodecOptions {
|
|
48
|
+
}
|
|
49
|
+
declare class StandardOpenAPIHandler<T extends Context> extends StandardHandler<T> {
|
|
50
|
+
constructor(router: Router<any, T>, options: NoInfer<StandardOpenAPIHandlerOptions<T>>);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { StandardOpenAPICodec as a, StandardOpenAPIHandler as c, StandardOpenAPIMatcher as e };
|
|
54
|
+
export type { StandardOpenAPICodecOptions as S, StandardOpenAPIHandlerOptions as b, StandardOpenAPIMatcherOptions as d };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { StandardOpenAPISerializer, StandardOpenAPIJsonSerializerOptions, StandardBracketNotationSerializerOptions } from '@orpc/openapi-client/standard';
|
|
2
|
+
import { AnyProcedure, TraverseContractProcedureCallbackOptions, AnyRouter, Context, Router } from '@orpc/server';
|
|
3
|
+
import { StandardCodec, StandardParams, StandardMatcher, StandardMatchResult, StandardHandlerOptions, StandardHandler } from '@orpc/server/standard';
|
|
4
|
+
import { ORPCError, HTTPPath } from '@orpc/client';
|
|
5
|
+
import { StandardLazyRequest, StandardResponse } from '@orpc/standard-server';
|
|
6
|
+
import { Value } from '@orpc/shared';
|
|
7
|
+
|
|
8
|
+
interface StandardOpenAPICodecOptions {
|
|
9
|
+
/**
|
|
10
|
+
* Customize how an ORPC error is encoded into a response body.
|
|
11
|
+
* Use this if your API needs a different error output structure.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* - Return `null | undefined` to fallback to default behavior
|
|
15
|
+
*
|
|
16
|
+
* @default ((e) => e.toJSON())
|
|
17
|
+
*/
|
|
18
|
+
customErrorResponseBodyEncoder?: (error: ORPCError<any, any>) => unknown;
|
|
19
|
+
}
|
|
20
|
+
declare class StandardOpenAPICodec implements StandardCodec {
|
|
21
|
+
#private;
|
|
22
|
+
private readonly serializer;
|
|
23
|
+
private readonly customErrorResponseBodyEncoder;
|
|
24
|
+
constructor(serializer: StandardOpenAPISerializer, options?: StandardOpenAPICodecOptions);
|
|
25
|
+
decode(request: StandardLazyRequest, params: StandardParams | undefined, procedure: AnyProcedure): Promise<unknown>;
|
|
26
|
+
encode(output: unknown, procedure: AnyProcedure): StandardResponse;
|
|
27
|
+
encodeError(error: ORPCError<any, any>): StandardResponse;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface StandardOpenAPIMatcherOptions {
|
|
31
|
+
/**
|
|
32
|
+
* Filter procedures. Return `false` to exclude a procedure from matching.
|
|
33
|
+
*
|
|
34
|
+
* @default true
|
|
35
|
+
*/
|
|
36
|
+
filter?: Value<boolean, [options: TraverseContractProcedureCallbackOptions]>;
|
|
37
|
+
}
|
|
38
|
+
declare class StandardOpenAPIMatcher implements StandardMatcher {
|
|
39
|
+
private readonly filter;
|
|
40
|
+
private readonly tree;
|
|
41
|
+
private pendingRouters;
|
|
42
|
+
constructor(options?: StandardOpenAPIMatcherOptions);
|
|
43
|
+
init(router: AnyRouter, path?: readonly string[]): void;
|
|
44
|
+
match(method: string, pathname: HTTPPath): Promise<StandardMatchResult>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface StandardOpenAPIHandlerOptions<T extends Context> extends StandardHandlerOptions<T>, StandardOpenAPIJsonSerializerOptions, StandardBracketNotationSerializerOptions, StandardOpenAPIMatcherOptions, StandardOpenAPICodecOptions {
|
|
48
|
+
}
|
|
49
|
+
declare class StandardOpenAPIHandler<T extends Context> extends StandardHandler<T> {
|
|
50
|
+
constructor(router: Router<any, T>, options: NoInfer<StandardOpenAPIHandlerOptions<T>>);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { StandardOpenAPICodec as a, StandardOpenAPIHandler as c, StandardOpenAPIMatcher as e };
|
|
54
|
+
export type { StandardOpenAPICodecOptions as S, StandardOpenAPIHandlerOptions as b, StandardOpenAPIMatcherOptions as d };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/openapi",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.10.
|
|
4
|
+
"version": "1.10.2",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
|
7
7
|
"repository": {
|
|
@@ -39,6 +39,11 @@
|
|
|
39
39
|
"import": "./dist/adapters/node/index.mjs",
|
|
40
40
|
"default": "./dist/adapters/node/index.mjs"
|
|
41
41
|
},
|
|
42
|
+
"./fastify": {
|
|
43
|
+
"types": "./dist/adapters/fastify/index.d.mts",
|
|
44
|
+
"import": "./dist/adapters/fastify/index.mjs",
|
|
45
|
+
"default": "./dist/adapters/fastify/index.mjs"
|
|
46
|
+
},
|
|
42
47
|
"./aws-lambda": {
|
|
43
48
|
"types": "./dist/adapters/aws-lambda/index.d.mts",
|
|
44
49
|
"import": "./dist/adapters/aws-lambda/index.mjs",
|
|
@@ -49,16 +54,17 @@
|
|
|
49
54
|
"dist"
|
|
50
55
|
],
|
|
51
56
|
"dependencies": {
|
|
52
|
-
"rou3": "^0.7.
|
|
53
|
-
"@orpc/client": "1.10.
|
|
54
|
-
"@orpc/
|
|
55
|
-
"@orpc/
|
|
56
|
-
"@orpc/
|
|
57
|
-
"@orpc/
|
|
58
|
-
"@orpc/
|
|
59
|
-
"@orpc/
|
|
57
|
+
"rou3": "^0.7.8",
|
|
58
|
+
"@orpc/client": "1.10.2",
|
|
59
|
+
"@orpc/interop": "1.10.2",
|
|
60
|
+
"@orpc/contract": "1.10.2",
|
|
61
|
+
"@orpc/server": "1.10.2",
|
|
62
|
+
"@orpc/openapi-client": "1.10.2",
|
|
63
|
+
"@orpc/standard-server": "1.10.2",
|
|
64
|
+
"@orpc/shared": "1.10.2"
|
|
60
65
|
},
|
|
61
66
|
"devDependencies": {
|
|
67
|
+
"fastify": "^5.6.1",
|
|
62
68
|
"zod": "^4.1.12"
|
|
63
69
|
},
|
|
64
70
|
"scripts": {
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { StandardOpenAPIJsonSerializerOptions, StandardBracketNotationSerializerOptions } from '@orpc/openapi-client/standard';
|
|
2
|
-
import { TraverseContractProcedureCallbackOptions, AnyRouter, Context, Router } from '@orpc/server';
|
|
3
|
-
import { StandardMatcher, StandardMatchResult, StandardHandlerOptions, StandardHandler } from '@orpc/server/standard';
|
|
4
|
-
import { HTTPPath } from '@orpc/client';
|
|
5
|
-
import { Value } from '@orpc/shared';
|
|
6
|
-
|
|
7
|
-
interface StandardOpenAPIMatcherOptions {
|
|
8
|
-
/**
|
|
9
|
-
* Filter procedures. Return `false` to exclude a procedure from matching.
|
|
10
|
-
*
|
|
11
|
-
* @default true
|
|
12
|
-
*/
|
|
13
|
-
filter?: Value<boolean, [options: TraverseContractProcedureCallbackOptions]>;
|
|
14
|
-
}
|
|
15
|
-
declare class StandardOpenAPIMatcher implements StandardMatcher {
|
|
16
|
-
private readonly filter;
|
|
17
|
-
private readonly tree;
|
|
18
|
-
private pendingRouters;
|
|
19
|
-
constructor(options?: StandardOpenAPIMatcherOptions);
|
|
20
|
-
init(router: AnyRouter, path?: readonly string[]): void;
|
|
21
|
-
match(method: string, pathname: HTTPPath): Promise<StandardMatchResult>;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
interface StandardOpenAPIHandlerOptions<T extends Context> extends StandardHandlerOptions<T>, StandardOpenAPIJsonSerializerOptions, StandardBracketNotationSerializerOptions, StandardOpenAPIMatcherOptions {
|
|
25
|
-
}
|
|
26
|
-
declare class StandardOpenAPIHandler<T extends Context> extends StandardHandler<T> {
|
|
27
|
-
constructor(router: Router<any, T>, options: NoInfer<StandardOpenAPIHandlerOptions<T>>);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export { StandardOpenAPIHandler as a, StandardOpenAPIMatcher as c };
|
|
31
|
-
export type { StandardOpenAPIHandlerOptions as S, StandardOpenAPIMatcherOptions as b };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { StandardOpenAPIJsonSerializerOptions, StandardBracketNotationSerializerOptions } from '@orpc/openapi-client/standard';
|
|
2
|
-
import { TraverseContractProcedureCallbackOptions, AnyRouter, Context, Router } from '@orpc/server';
|
|
3
|
-
import { StandardMatcher, StandardMatchResult, StandardHandlerOptions, StandardHandler } from '@orpc/server/standard';
|
|
4
|
-
import { HTTPPath } from '@orpc/client';
|
|
5
|
-
import { Value } from '@orpc/shared';
|
|
6
|
-
|
|
7
|
-
interface StandardOpenAPIMatcherOptions {
|
|
8
|
-
/**
|
|
9
|
-
* Filter procedures. Return `false` to exclude a procedure from matching.
|
|
10
|
-
*
|
|
11
|
-
* @default true
|
|
12
|
-
*/
|
|
13
|
-
filter?: Value<boolean, [options: TraverseContractProcedureCallbackOptions]>;
|
|
14
|
-
}
|
|
15
|
-
declare class StandardOpenAPIMatcher implements StandardMatcher {
|
|
16
|
-
private readonly filter;
|
|
17
|
-
private readonly tree;
|
|
18
|
-
private pendingRouters;
|
|
19
|
-
constructor(options?: StandardOpenAPIMatcherOptions);
|
|
20
|
-
init(router: AnyRouter, path?: readonly string[]): void;
|
|
21
|
-
match(method: string, pathname: HTTPPath): Promise<StandardMatchResult>;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
interface StandardOpenAPIHandlerOptions<T extends Context> extends StandardHandlerOptions<T>, StandardOpenAPIJsonSerializerOptions, StandardBracketNotationSerializerOptions, StandardOpenAPIMatcherOptions {
|
|
25
|
-
}
|
|
26
|
-
declare class StandardOpenAPIHandler<T extends Context> extends StandardHandler<T> {
|
|
27
|
-
constructor(router: Router<any, T>, options: NoInfer<StandardOpenAPIHandlerOptions<T>>);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export { StandardOpenAPIHandler as a, StandardOpenAPIMatcher as c };
|
|
31
|
-
export type { StandardOpenAPIHandlerOptions as S, StandardOpenAPIMatcherOptions as b };
|