@orpc/openapi 0.0.0-next.f17a1a0 → 0.0.0-next.f4d410a

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.
Files changed (57) hide show
  1. package/README.md +4 -2
  2. package/dist/adapters/fetch/index.d.mts +15 -0
  3. package/dist/adapters/fetch/index.d.ts +15 -0
  4. package/dist/adapters/fetch/index.mjs +11 -0
  5. package/dist/adapters/hono/index.d.mts +8 -0
  6. package/dist/adapters/hono/index.d.ts +8 -0
  7. package/dist/adapters/hono/index.mjs +11 -0
  8. package/dist/adapters/next/index.d.mts +8 -0
  9. package/dist/adapters/next/index.d.ts +8 -0
  10. package/dist/adapters/next/index.mjs +11 -0
  11. package/dist/adapters/node/index.d.mts +15 -0
  12. package/dist/adapters/node/index.d.ts +15 -0
  13. package/dist/adapters/node/index.mjs +35 -0
  14. package/dist/adapters/standard/index.d.mts +35 -0
  15. package/dist/adapters/standard/index.d.ts +35 -0
  16. package/dist/adapters/standard/index.mjs +7 -0
  17. package/dist/index.d.mts +120 -0
  18. package/dist/index.d.ts +120 -0
  19. package/dist/index.mjs +303 -0
  20. package/dist/{chunk-PGCWJMRO.js → shared/openapi.BNHmrMe2.mjs} +26 -38
  21. package/dist/shared/openapi.DZzpQAb-.mjs +231 -0
  22. package/dist/shared/openapi.Dv-KT_Bx.mjs +33 -0
  23. package/dist/shared/openapi.IfmmOyba.d.mts +8 -0
  24. package/dist/shared/openapi.IfmmOyba.d.ts +8 -0
  25. package/package.json +30 -34
  26. package/dist/chunk-ATDLVTJE.js +0 -32
  27. package/dist/chunk-XGHV4TH3.js +0 -13
  28. package/dist/fetch.js +0 -9
  29. package/dist/hono.js +0 -9
  30. package/dist/index.js +0 -701
  31. package/dist/next.js +0 -9
  32. package/dist/node.js +0 -30
  33. package/dist/src/adapters/fetch/index.d.ts +0 -2
  34. package/dist/src/adapters/fetch/openapi-handler.d.ts +0 -11
  35. package/dist/src/adapters/hono/index.d.ts +0 -2
  36. package/dist/src/adapters/next/index.d.ts +0 -2
  37. package/dist/src/adapters/node/index.d.ts +0 -2
  38. package/dist/src/adapters/node/openapi-handler.d.ts +0 -11
  39. package/dist/src/adapters/standard/index.d.ts +0 -4
  40. package/dist/src/adapters/standard/openapi-codec.d.ts +0 -13
  41. package/dist/src/adapters/standard/openapi-handler.d.ts +0 -5
  42. package/dist/src/adapters/standard/openapi-matcher.d.ts +0 -10
  43. package/dist/src/index.d.ts +0 -16
  44. package/dist/src/openapi-content-builder.d.ts +0 -10
  45. package/dist/src/openapi-error.d.ts +0 -3
  46. package/dist/src/openapi-generator.d.ts +0 -67
  47. package/dist/src/openapi-input-structure-parser.d.ts +0 -22
  48. package/dist/src/openapi-operation-extender.d.ts +0 -7
  49. package/dist/src/openapi-output-structure-parser.d.ts +0 -18
  50. package/dist/src/openapi-parameters-builder.d.ts +0 -12
  51. package/dist/src/openapi-path-parser.d.ts +0 -8
  52. package/dist/src/openapi.d.ts +0 -3
  53. package/dist/src/schema-converter.d.ts +0 -16
  54. package/dist/src/schema-utils.d.ts +0 -11
  55. package/dist/src/schema.d.ts +0 -12
  56. package/dist/src/utils.d.ts +0 -4
  57. package/dist/standard.js +0 -10
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <div align="center">
2
- <image align="center" src="https://orpc.unnoq.com/logo.webp" width=280 />
2
+ <image align="center" src="https://orpc.unnoq.com/logo.webp" width=280 alt="oRPC logo" />
3
3
  </div>
4
4
 
5
5
  <h1></h1>
@@ -32,7 +32,7 @@
32
32
  - **Contract-First Development 📜**: (Optional) Define your API contract upfront and implement it with confidence.
33
33
  - **Exceptional Developer Experience ✨**: Enjoy a streamlined workflow with robust typing and clear, in-code documentation.
34
34
  - **Multi-Runtime Support 🌍**: Run your code seamlessly on Cloudflare, Deno, Bun, Node.js, and more.
35
- - **Framework Integrations 🧩**: Supports Tanstack Query (React, Vue), Pinia Colada, and more.
35
+ - **Framework Integrations 🧩**: Supports Tanstack Query (React, Vue, Solid, Svelte), Pinia Colada, and more.
36
36
  - **Server Actions ⚡️**: Fully compatible with React Server Actions on Next.js, TanStack Start, and more.
37
37
  - **Standard Schema Support 🗂️**: Effortlessly work with Zod, Valibot, ArkType, and others right out of the box.
38
38
  - **Fast & Lightweight 💨**: Built on native APIs across all runtimes – optimized for speed and efficiency.
@@ -55,6 +55,8 @@ You can find the full documentation [here](https://orpc.unnoq.com).
55
55
  - [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
56
56
  - [@orpc/react-query](https://www.npmjs.com/package/@orpc/react-query): Integration with [React Query](https://tanstack.com/query/latest/docs/framework/react/overview).
57
57
  - [@orpc/vue-query](https://www.npmjs.com/package/@orpc/vue-query): Integration with [Vue Query](https://tanstack.com/query/latest/docs/framework/vue/overview).
58
+ - [@orpc/solid-query](https://www.npmjs.com/package/@orpc/solid-query): Integration with [Solid Query](https://tanstack.com/query/latest/docs/framework/solid/overview).
59
+ - [@orpc/svelte-query](https://www.npmjs.com/package/@orpc/svelte-query): Integration with [Svelte Query](https://tanstack.com/query/latest/docs/framework/svelte/overview).
58
60
  - [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
59
61
  - [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
60
62
  - [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
@@ -0,0 +1,15 @@
1
+ import { Context, Router } from '@orpc/server';
2
+ import { FetchHandler, FetchHandleResult } from '@orpc/server/fetch';
3
+ import { StandardHandleOptions } from '@orpc/server/standard';
4
+ import { MaybeOptionalOptions } from '@orpc/shared';
5
+ import { ToFetchResponseOptions } from '@orpc/standard-server-fetch';
6
+ import { S as StandardOpenAPIHandlerOptions } from '../../shared/openapi.IfmmOyba.mjs';
7
+ import '@orpc/openapi-client/standard';
8
+
9
+ declare class OpenAPIHandler<T extends Context> implements FetchHandler<T> {
10
+ private readonly standardHandler;
11
+ constructor(router: Router<any, T>, options?: NoInfer<StandardOpenAPIHandlerOptions<T>>);
12
+ handle(request: Request, ...[options,]: MaybeOptionalOptions<StandardHandleOptions<T> & ToFetchResponseOptions>): Promise<FetchHandleResult>;
13
+ }
14
+
15
+ export { OpenAPIHandler };
@@ -0,0 +1,15 @@
1
+ import { Context, Router } from '@orpc/server';
2
+ import { FetchHandler, FetchHandleResult } from '@orpc/server/fetch';
3
+ import { StandardHandleOptions } from '@orpc/server/standard';
4
+ import { MaybeOptionalOptions } from '@orpc/shared';
5
+ import { ToFetchResponseOptions } from '@orpc/standard-server-fetch';
6
+ import { S as StandardOpenAPIHandlerOptions } from '../../shared/openapi.IfmmOyba.js';
7
+ import '@orpc/openapi-client/standard';
8
+
9
+ declare class OpenAPIHandler<T extends Context> implements FetchHandler<T> {
10
+ private readonly standardHandler;
11
+ constructor(router: Router<any, T>, options?: NoInfer<StandardOpenAPIHandlerOptions<T>>);
12
+ handle(request: Request, ...[options,]: MaybeOptionalOptions<StandardHandleOptions<T> & ToFetchResponseOptions>): Promise<FetchHandleResult>;
13
+ }
14
+
15
+ export { OpenAPIHandler };
@@ -0,0 +1,11 @@
1
+ export { O as OpenAPIHandler } from '../../shared/openapi.Dv-KT_Bx.mjs';
2
+ import '@orpc/openapi-client/standard';
3
+ import '@orpc/server/standard';
4
+ import '@orpc/standard-server-fetch';
5
+ import '../../shared/openapi.BNHmrMe2.mjs';
6
+ import '@orpc/contract';
7
+ import '@orpc/shared';
8
+ import '@orpc/server';
9
+ import 'rou3';
10
+ import '../../shared/openapi.DZzpQAb-.mjs';
11
+ import 'json-schema-typed/draft-2020-12';
@@ -0,0 +1,8 @@
1
+ export { OpenAPIHandler } from '../fetch/index.mjs';
2
+ import '@orpc/server';
3
+ import '@orpc/server/fetch';
4
+ import '@orpc/server/standard';
5
+ import '@orpc/shared';
6
+ import '@orpc/standard-server-fetch';
7
+ import '../../shared/openapi.IfmmOyba.mjs';
8
+ import '@orpc/openapi-client/standard';
@@ -0,0 +1,8 @@
1
+ export { OpenAPIHandler } from '../fetch/index.js';
2
+ import '@orpc/server';
3
+ import '@orpc/server/fetch';
4
+ import '@orpc/server/standard';
5
+ import '@orpc/shared';
6
+ import '@orpc/standard-server-fetch';
7
+ import '../../shared/openapi.IfmmOyba.js';
8
+ import '@orpc/openapi-client/standard';
@@ -0,0 +1,11 @@
1
+ export { O as OpenAPIHandler } from '../../shared/openapi.Dv-KT_Bx.mjs';
2
+ import '@orpc/openapi-client/standard';
3
+ import '@orpc/server/standard';
4
+ import '@orpc/standard-server-fetch';
5
+ import '../../shared/openapi.BNHmrMe2.mjs';
6
+ import '@orpc/contract';
7
+ import '@orpc/shared';
8
+ import '@orpc/server';
9
+ import 'rou3';
10
+ import '../../shared/openapi.DZzpQAb-.mjs';
11
+ import 'json-schema-typed/draft-2020-12';
@@ -0,0 +1,8 @@
1
+ export { OpenAPIHandler } from '../fetch/index.mjs';
2
+ import '@orpc/server';
3
+ import '@orpc/server/fetch';
4
+ import '@orpc/server/standard';
5
+ import '@orpc/shared';
6
+ import '@orpc/standard-server-fetch';
7
+ import '../../shared/openapi.IfmmOyba.mjs';
8
+ import '@orpc/openapi-client/standard';
@@ -0,0 +1,8 @@
1
+ export { OpenAPIHandler } from '../fetch/index.js';
2
+ import '@orpc/server';
3
+ import '@orpc/server/fetch';
4
+ import '@orpc/server/standard';
5
+ import '@orpc/shared';
6
+ import '@orpc/standard-server-fetch';
7
+ import '../../shared/openapi.IfmmOyba.js';
8
+ import '@orpc/openapi-client/standard';
@@ -0,0 +1,11 @@
1
+ export { O as OpenAPIHandler } from '../../shared/openapi.Dv-KT_Bx.mjs';
2
+ import '@orpc/openapi-client/standard';
3
+ import '@orpc/server/standard';
4
+ import '@orpc/standard-server-fetch';
5
+ import '../../shared/openapi.BNHmrMe2.mjs';
6
+ import '@orpc/contract';
7
+ import '@orpc/shared';
8
+ import '@orpc/server';
9
+ import 'rou3';
10
+ import '../../shared/openapi.DZzpQAb-.mjs';
11
+ import 'json-schema-typed/draft-2020-12';
@@ -0,0 +1,15 @@
1
+ import { Context, Router } from '@orpc/server';
2
+ import { NodeHttpHandler, NodeHttpRequest, NodeHttpResponse, NodeHttpHandleResult } from '@orpc/server/node';
3
+ import { StandardHandleOptions } from '@orpc/server/standard';
4
+ import { MaybeOptionalOptions } from '@orpc/shared';
5
+ import { SendStandardResponseOptions } from '@orpc/standard-server-node';
6
+ import { S as StandardOpenAPIHandlerOptions } from '../../shared/openapi.IfmmOyba.mjs';
7
+ import '@orpc/openapi-client/standard';
8
+
9
+ declare class OpenAPIHandler<T extends Context> implements NodeHttpHandler<T> {
10
+ private readonly standardHandler;
11
+ constructor(router: Router<any, T>, options?: NoInfer<StandardOpenAPIHandlerOptions<T>>);
12
+ handle(req: NodeHttpRequest, res: NodeHttpResponse, ...[options,]: MaybeOptionalOptions<StandardHandleOptions<T> & SendStandardResponseOptions>): Promise<NodeHttpHandleResult>;
13
+ }
14
+
15
+ export { OpenAPIHandler };
@@ -0,0 +1,15 @@
1
+ import { Context, Router } from '@orpc/server';
2
+ import { NodeHttpHandler, NodeHttpRequest, NodeHttpResponse, NodeHttpHandleResult } from '@orpc/server/node';
3
+ import { StandardHandleOptions } from '@orpc/server/standard';
4
+ import { MaybeOptionalOptions } from '@orpc/shared';
5
+ import { SendStandardResponseOptions } from '@orpc/standard-server-node';
6
+ import { S as StandardOpenAPIHandlerOptions } from '../../shared/openapi.IfmmOyba.js';
7
+ import '@orpc/openapi-client/standard';
8
+
9
+ declare class OpenAPIHandler<T extends Context> implements NodeHttpHandler<T> {
10
+ private readonly standardHandler;
11
+ constructor(router: Router<any, T>, options?: NoInfer<StandardOpenAPIHandlerOptions<T>>);
12
+ handle(req: NodeHttpRequest, res: NodeHttpResponse, ...[options,]: MaybeOptionalOptions<StandardHandleOptions<T> & SendStandardResponseOptions>): Promise<NodeHttpHandleResult>;
13
+ }
14
+
15
+ export { OpenAPIHandler };
@@ -0,0 +1,35 @@
1
+ import { StandardOpenAPIJsonSerializer, StandardBracketNotationSerializer, StandardOpenAPISerializer } from '@orpc/openapi-client/standard';
2
+ import { StandardHandler } from '@orpc/server/standard';
3
+ import { toStandardLazyRequest, sendStandardResponse } from '@orpc/standard-server-node';
4
+ import { a as StandardOpenAPIMatcher, S as StandardOpenAPICodec } from '../../shared/openapi.BNHmrMe2.mjs';
5
+ import '@orpc/shared';
6
+ import 'json-schema-typed/draft-2020-12';
7
+ import '@orpc/contract';
8
+ import '@orpc/server';
9
+ import 'rou3';
10
+ import '../../shared/openapi.DZzpQAb-.mjs';
11
+
12
+ class OpenAPIHandler {
13
+ standardHandler;
14
+ constructor(router, options = {}) {
15
+ const jsonSerializer = new StandardOpenAPIJsonSerializer(options);
16
+ const bracketNotationSerializer = new StandardBracketNotationSerializer();
17
+ const serializer = new StandardOpenAPISerializer(jsonSerializer, bracketNotationSerializer);
18
+ const matcher = new StandardOpenAPIMatcher();
19
+ const codec = new StandardOpenAPICodec(serializer);
20
+ this.standardHandler = new StandardHandler(router, matcher, codec, options);
21
+ }
22
+ async handle(req, res, ...[
23
+ options = {}
24
+ ]) {
25
+ const standardRequest = toStandardLazyRequest(req, res);
26
+ const result = await this.standardHandler.handle(standardRequest, options);
27
+ if (!result.matched) {
28
+ return { matched: false };
29
+ }
30
+ await sendStandardResponse(res, result.response, options);
31
+ return { matched: true };
32
+ }
33
+ }
34
+
35
+ export { OpenAPIHandler };
@@ -0,0 +1,35 @@
1
+ import { ORPCError } from '@orpc/client';
2
+ import { StandardOpenAPISerializer } from '@orpc/openapi-client/standard';
3
+ import { AnyProcedure, AnyRouter } from '@orpc/server';
4
+ import { StandardCodec, StandardParams, StandardMatcher, StandardMatchResult } from '@orpc/server/standard';
5
+ import { StandardLazyRequest, StandardResponse } from '@orpc/standard-server';
6
+ export { S as StandardOpenAPIHandlerOptions } from '../../shared/openapi.IfmmOyba.mjs';
7
+ import { HTTPPath } from '@orpc/contract';
8
+
9
+ declare class StandardOpenAPICodec implements StandardCodec {
10
+ private readonly serializer;
11
+ constructor(serializer: StandardOpenAPISerializer);
12
+ decode(request: StandardLazyRequest, params: StandardParams | undefined, procedure: AnyProcedure): Promise<unknown>;
13
+ encode(output: unknown, procedure: AnyProcedure): StandardResponse;
14
+ encodeError(error: ORPCError<any, any>): StandardResponse;
15
+ }
16
+
17
+ declare class StandardOpenAPIMatcher implements StandardMatcher {
18
+ private readonly tree;
19
+ private pendingRouters;
20
+ init(router: AnyRouter, path?: readonly string[]): void;
21
+ match(method: string, pathname: HTTPPath): Promise<StandardMatchResult>;
22
+ }
23
+
24
+ /**
25
+ * {@link https://github.com/unjs/rou3}
26
+ *
27
+ * @internal
28
+ */
29
+ declare function toRou3Pattern(path: HTTPPath): string;
30
+ /**
31
+ * @internal
32
+ */
33
+ declare function decodeParams(params: Record<string, string>): Record<string, string>;
34
+
35
+ export { StandardOpenAPICodec, StandardOpenAPIMatcher, decodeParams, toRou3Pattern };
@@ -0,0 +1,35 @@
1
+ import { ORPCError } from '@orpc/client';
2
+ import { StandardOpenAPISerializer } from '@orpc/openapi-client/standard';
3
+ import { AnyProcedure, AnyRouter } from '@orpc/server';
4
+ import { StandardCodec, StandardParams, StandardMatcher, StandardMatchResult } from '@orpc/server/standard';
5
+ import { StandardLazyRequest, StandardResponse } from '@orpc/standard-server';
6
+ export { S as StandardOpenAPIHandlerOptions } from '../../shared/openapi.IfmmOyba.js';
7
+ import { HTTPPath } from '@orpc/contract';
8
+
9
+ declare class StandardOpenAPICodec implements StandardCodec {
10
+ private readonly serializer;
11
+ constructor(serializer: StandardOpenAPISerializer);
12
+ decode(request: StandardLazyRequest, params: StandardParams | undefined, procedure: AnyProcedure): Promise<unknown>;
13
+ encode(output: unknown, procedure: AnyProcedure): StandardResponse;
14
+ encodeError(error: ORPCError<any, any>): StandardResponse;
15
+ }
16
+
17
+ declare class StandardOpenAPIMatcher implements StandardMatcher {
18
+ private readonly tree;
19
+ private pendingRouters;
20
+ init(router: AnyRouter, path?: readonly string[]): void;
21
+ match(method: string, pathname: HTTPPath): Promise<StandardMatchResult>;
22
+ }
23
+
24
+ /**
25
+ * {@link https://github.com/unjs/rou3}
26
+ *
27
+ * @internal
28
+ */
29
+ declare function toRou3Pattern(path: HTTPPath): string;
30
+ /**
31
+ * @internal
32
+ */
33
+ declare function decodeParams(params: Record<string, string>): Record<string, string>;
34
+
35
+ export { StandardOpenAPICodec, StandardOpenAPIMatcher, decodeParams, toRou3Pattern };
@@ -0,0 +1,7 @@
1
+ export { S as StandardOpenAPICodec, a as StandardOpenAPIMatcher, d as decodeParams, t as toRou3Pattern } from '../../shared/openapi.BNHmrMe2.mjs';
2
+ import '@orpc/contract';
3
+ import '@orpc/shared';
4
+ import '@orpc/server';
5
+ import 'rou3';
6
+ import '../../shared/openapi.DZzpQAb-.mjs';
7
+ import 'json-schema-typed/draft-2020-12';
@@ -0,0 +1,120 @@
1
+ import { AnyContractProcedure, AnySchema, AnyContractRouter, HTTPPath, HTTPMethod } from '@orpc/contract';
2
+ import { OpenAPIV3_1 } from 'openapi-types';
3
+ export { OpenAPIV3_1 as OpenAPI } from 'openapi-types';
4
+ import { StandardOpenAPIJsonSerializerOptions } from '@orpc/openapi-client/standard';
5
+ import { AnyRouter } from '@orpc/server';
6
+ import { JSONSchema } from 'json-schema-typed/draft-2020-12';
7
+ export { JSONSchema, Format as JSONSchemaFormat } from 'json-schema-typed/draft-2020-12';
8
+
9
+ type OverrideOperationValue = Partial<OpenAPIV3_1.OperationObject> | ((current: OpenAPIV3_1.OperationObject, procedure: AnyContractProcedure) => OpenAPIV3_1.OperationObject);
10
+ declare function customOpenAPIOperation<T extends object>(o: T, extend: OverrideOperationValue): T;
11
+ declare function getCustomOpenAPIOperation(o: object): OverrideOperationValue | undefined;
12
+ declare function applyCustomOpenAPIOperation(operation: OpenAPIV3_1.OperationObject, contract: AnyContractProcedure): OpenAPIV3_1.OperationObject;
13
+
14
+ /**
15
+ * @internal
16
+ */
17
+ type ObjectSchema = JSONSchema & {
18
+ type: 'object';
19
+ } & object;
20
+ /**
21
+ * @internal
22
+ */
23
+ type FileSchema = JSONSchema & {
24
+ type: 'string';
25
+ contentMediaType: string;
26
+ } & object;
27
+ /**
28
+ * @internal
29
+ */
30
+ declare const LOGIC_KEYWORDS: string[];
31
+
32
+ interface SchemaConvertOptions {
33
+ strategy: 'input' | 'output';
34
+ }
35
+ interface SchemaConverter {
36
+ convert(schema: AnySchema | undefined, options: SchemaConvertOptions): [required: boolean, jsonSchema: JSONSchema];
37
+ }
38
+ interface ConditionalSchemaConverter extends SchemaConverter {
39
+ condition(schema: AnySchema | undefined, options: SchemaConvertOptions): boolean;
40
+ }
41
+ declare class CompositeSchemaConverter implements SchemaConverter {
42
+ private readonly converters;
43
+ constructor(converters: ConditionalSchemaConverter[]);
44
+ convert(schema: AnySchema | undefined, options: SchemaConvertOptions): [required: boolean, jsonSchema: JSONSchema];
45
+ }
46
+
47
+ interface OpenAPIGeneratorOptions extends StandardOpenAPIJsonSerializerOptions {
48
+ schemaConverters?: ConditionalSchemaConverter[];
49
+ }
50
+ declare class OpenAPIGenerator {
51
+ #private;
52
+ private readonly serializer;
53
+ private readonly converter;
54
+ constructor(options?: OpenAPIGeneratorOptions);
55
+ generate(router: AnyContractRouter | AnyRouter, base: Omit<OpenAPIV3_1.Document, 'openapi'>): Promise<OpenAPIV3_1.Document>;
56
+ }
57
+
58
+ /**
59
+ * @internal
60
+ */
61
+ declare function standardizeHTTPPath(path: HTTPPath): HTTPPath;
62
+ /**
63
+ * @internal
64
+ */
65
+ declare function toOpenAPIPath(path: HTTPPath): string;
66
+ /**
67
+ * @internal
68
+ */
69
+ declare function toOpenAPIMethod(method: HTTPMethod): Lowercase<HTTPMethod>;
70
+ /**
71
+ * @internal
72
+ */
73
+ declare function getDynamicParams(path: HTTPPath | undefined): string[] | undefined;
74
+ /**
75
+ * @internal
76
+ */
77
+ declare function toOpenAPIContent(schema: JSONSchema): Record<string, OpenAPIV3_1.MediaTypeObject>;
78
+ /**
79
+ * @internal
80
+ */
81
+ declare function toOpenAPIEventIteratorContent([yieldsRequired, yieldsSchema]: [boolean, JSONSchema], [returnsRequired, returnsSchema]: [boolean, JSONSchema]): Record<string, OpenAPIV3_1.MediaTypeObject>;
82
+ /**
83
+ * @internal
84
+ */
85
+ declare function toOpenAPIParameters(schema: ObjectSchema, parameterIn: 'path' | 'query' | 'header' | 'cookie'): OpenAPIV3_1.ParameterObject[];
86
+ /**
87
+ * @internal
88
+ */
89
+ declare function checkParamsSchema(schema: ObjectSchema, params: string[]): boolean;
90
+ /**
91
+ * @internal
92
+ */
93
+ declare function toOpenAPISchema(schema: JSONSchema): OpenAPIV3_1.SchemaObject & object;
94
+
95
+ /**
96
+ *@internal
97
+ */
98
+ declare function isFileSchema(schema: JSONSchema): schema is FileSchema;
99
+ /**
100
+ * @internal
101
+ */
102
+ declare function isObjectSchema(schema: JSONSchema): schema is ObjectSchema;
103
+ /**
104
+ * @internal
105
+ */
106
+ declare function isAnySchema(schema: JSONSchema): boolean;
107
+ /**
108
+ * @internal
109
+ */
110
+ declare function separateObjectSchema(schema: ObjectSchema, separatedProperties: string[]): [matched: ObjectSchema, rest: ObjectSchema];
111
+ /**
112
+ * @internal
113
+ */
114
+ declare function filterSchemaBranches(schema: JSONSchema, check: (schema: JSONSchema) => boolean, matches?: JSONSchema[]): [matches: JSONSchema[], rest: JSONSchema | undefined];
115
+
116
+ declare const oo: {
117
+ spec: typeof customOpenAPIOperation;
118
+ };
119
+
120
+ export { CompositeSchemaConverter, type ConditionalSchemaConverter, type FileSchema, LOGIC_KEYWORDS, type ObjectSchema, OpenAPIGenerator, type OpenAPIGeneratorOptions, type OverrideOperationValue, type SchemaConvertOptions, type SchemaConverter, applyCustomOpenAPIOperation, checkParamsSchema, customOpenAPIOperation, filterSchemaBranches, getCustomOpenAPIOperation, getDynamicParams, isAnySchema, isFileSchema, isObjectSchema, oo, separateObjectSchema, standardizeHTTPPath, toOpenAPIContent, toOpenAPIEventIteratorContent, toOpenAPIMethod, toOpenAPIParameters, toOpenAPIPath, toOpenAPISchema };
@@ -0,0 +1,120 @@
1
+ import { AnyContractProcedure, AnySchema, AnyContractRouter, HTTPPath, HTTPMethod } from '@orpc/contract';
2
+ import { OpenAPIV3_1 } from 'openapi-types';
3
+ export { OpenAPIV3_1 as OpenAPI } from 'openapi-types';
4
+ import { StandardOpenAPIJsonSerializerOptions } from '@orpc/openapi-client/standard';
5
+ import { AnyRouter } from '@orpc/server';
6
+ import { JSONSchema } from 'json-schema-typed/draft-2020-12';
7
+ export { JSONSchema, Format as JSONSchemaFormat } from 'json-schema-typed/draft-2020-12';
8
+
9
+ type OverrideOperationValue = Partial<OpenAPIV3_1.OperationObject> | ((current: OpenAPIV3_1.OperationObject, procedure: AnyContractProcedure) => OpenAPIV3_1.OperationObject);
10
+ declare function customOpenAPIOperation<T extends object>(o: T, extend: OverrideOperationValue): T;
11
+ declare function getCustomOpenAPIOperation(o: object): OverrideOperationValue | undefined;
12
+ declare function applyCustomOpenAPIOperation(operation: OpenAPIV3_1.OperationObject, contract: AnyContractProcedure): OpenAPIV3_1.OperationObject;
13
+
14
+ /**
15
+ * @internal
16
+ */
17
+ type ObjectSchema = JSONSchema & {
18
+ type: 'object';
19
+ } & object;
20
+ /**
21
+ * @internal
22
+ */
23
+ type FileSchema = JSONSchema & {
24
+ type: 'string';
25
+ contentMediaType: string;
26
+ } & object;
27
+ /**
28
+ * @internal
29
+ */
30
+ declare const LOGIC_KEYWORDS: string[];
31
+
32
+ interface SchemaConvertOptions {
33
+ strategy: 'input' | 'output';
34
+ }
35
+ interface SchemaConverter {
36
+ convert(schema: AnySchema | undefined, options: SchemaConvertOptions): [required: boolean, jsonSchema: JSONSchema];
37
+ }
38
+ interface ConditionalSchemaConverter extends SchemaConverter {
39
+ condition(schema: AnySchema | undefined, options: SchemaConvertOptions): boolean;
40
+ }
41
+ declare class CompositeSchemaConverter implements SchemaConverter {
42
+ private readonly converters;
43
+ constructor(converters: ConditionalSchemaConverter[]);
44
+ convert(schema: AnySchema | undefined, options: SchemaConvertOptions): [required: boolean, jsonSchema: JSONSchema];
45
+ }
46
+
47
+ interface OpenAPIGeneratorOptions extends StandardOpenAPIJsonSerializerOptions {
48
+ schemaConverters?: ConditionalSchemaConverter[];
49
+ }
50
+ declare class OpenAPIGenerator {
51
+ #private;
52
+ private readonly serializer;
53
+ private readonly converter;
54
+ constructor(options?: OpenAPIGeneratorOptions);
55
+ generate(router: AnyContractRouter | AnyRouter, base: Omit<OpenAPIV3_1.Document, 'openapi'>): Promise<OpenAPIV3_1.Document>;
56
+ }
57
+
58
+ /**
59
+ * @internal
60
+ */
61
+ declare function standardizeHTTPPath(path: HTTPPath): HTTPPath;
62
+ /**
63
+ * @internal
64
+ */
65
+ declare function toOpenAPIPath(path: HTTPPath): string;
66
+ /**
67
+ * @internal
68
+ */
69
+ declare function toOpenAPIMethod(method: HTTPMethod): Lowercase<HTTPMethod>;
70
+ /**
71
+ * @internal
72
+ */
73
+ declare function getDynamicParams(path: HTTPPath | undefined): string[] | undefined;
74
+ /**
75
+ * @internal
76
+ */
77
+ declare function toOpenAPIContent(schema: JSONSchema): Record<string, OpenAPIV3_1.MediaTypeObject>;
78
+ /**
79
+ * @internal
80
+ */
81
+ declare function toOpenAPIEventIteratorContent([yieldsRequired, yieldsSchema]: [boolean, JSONSchema], [returnsRequired, returnsSchema]: [boolean, JSONSchema]): Record<string, OpenAPIV3_1.MediaTypeObject>;
82
+ /**
83
+ * @internal
84
+ */
85
+ declare function toOpenAPIParameters(schema: ObjectSchema, parameterIn: 'path' | 'query' | 'header' | 'cookie'): OpenAPIV3_1.ParameterObject[];
86
+ /**
87
+ * @internal
88
+ */
89
+ declare function checkParamsSchema(schema: ObjectSchema, params: string[]): boolean;
90
+ /**
91
+ * @internal
92
+ */
93
+ declare function toOpenAPISchema(schema: JSONSchema): OpenAPIV3_1.SchemaObject & object;
94
+
95
+ /**
96
+ *@internal
97
+ */
98
+ declare function isFileSchema(schema: JSONSchema): schema is FileSchema;
99
+ /**
100
+ * @internal
101
+ */
102
+ declare function isObjectSchema(schema: JSONSchema): schema is ObjectSchema;
103
+ /**
104
+ * @internal
105
+ */
106
+ declare function isAnySchema(schema: JSONSchema): boolean;
107
+ /**
108
+ * @internal
109
+ */
110
+ declare function separateObjectSchema(schema: ObjectSchema, separatedProperties: string[]): [matched: ObjectSchema, rest: ObjectSchema];
111
+ /**
112
+ * @internal
113
+ */
114
+ declare function filterSchemaBranches(schema: JSONSchema, check: (schema: JSONSchema) => boolean, matches?: JSONSchema[]): [matches: JSONSchema[], rest: JSONSchema | undefined];
115
+
116
+ declare const oo: {
117
+ spec: typeof customOpenAPIOperation;
118
+ };
119
+
120
+ export { CompositeSchemaConverter, type ConditionalSchemaConverter, type FileSchema, LOGIC_KEYWORDS, type ObjectSchema, OpenAPIGenerator, type OpenAPIGeneratorOptions, type OverrideOperationValue, type SchemaConvertOptions, type SchemaConverter, applyCustomOpenAPIOperation, checkParamsSchema, customOpenAPIOperation, filterSchemaBranches, getCustomOpenAPIOperation, getDynamicParams, isAnySchema, isFileSchema, isObjectSchema, oo, separateObjectSchema, standardizeHTTPPath, toOpenAPIContent, toOpenAPIEventIteratorContent, toOpenAPIMethod, toOpenAPIParameters, toOpenAPIPath, toOpenAPISchema };