@orpc/openapi 0.0.0-next.cc4cb21 → 0.0.0-next.cc8802c

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 (55) hide show
  1. package/README.md +1 -1
  2. package/dist/adapters/fetch/index.d.mts +13 -0
  3. package/dist/adapters/fetch/index.d.ts +13 -0
  4. package/dist/adapters/fetch/index.mjs +11 -0
  5. package/dist/adapters/hono/index.d.mts +6 -0
  6. package/dist/adapters/hono/index.d.ts +6 -0
  7. package/dist/adapters/hono/index.mjs +11 -0
  8. package/dist/adapters/next/index.d.mts +6 -0
  9. package/dist/adapters/next/index.d.ts +6 -0
  10. package/dist/adapters/next/index.mjs +11 -0
  11. package/dist/adapters/node/index.d.mts +13 -0
  12. package/dist/adapters/node/index.d.ts +13 -0
  13. package/dist/adapters/node/index.mjs +33 -0
  14. package/dist/adapters/standard/index.d.mts +34 -0
  15. package/dist/adapters/standard/index.d.ts +34 -0
  16. package/dist/adapters/standard/index.mjs +7 -0
  17. package/dist/index.d.mts +119 -0
  18. package/dist/index.d.ts +119 -0
  19. package/dist/index.mjs +303 -0
  20. package/dist/{chunk-LTTK3H5J.js → shared/openapi.CJTe38Ya.mjs} +26 -38
  21. package/dist/shared/openapi.CbzTVvGL.mjs +31 -0
  22. package/dist/shared/openapi.DZzpQAb-.mjs +231 -0
  23. package/package.json +30 -34
  24. package/dist/chunk-PW7RAFQQ.js +0 -32
  25. package/dist/chunk-XGHV4TH3.js +0 -13
  26. package/dist/fetch.js +0 -9
  27. package/dist/hono.js +0 -9
  28. package/dist/index.js +0 -701
  29. package/dist/next.js +0 -9
  30. package/dist/node.js +0 -30
  31. package/dist/src/adapters/fetch/index.d.ts +0 -2
  32. package/dist/src/adapters/fetch/openapi-handler.d.ts +0 -11
  33. package/dist/src/adapters/hono/index.d.ts +0 -2
  34. package/dist/src/adapters/next/index.d.ts +0 -2
  35. package/dist/src/adapters/node/index.d.ts +0 -2
  36. package/dist/src/adapters/node/openapi-handler.d.ts +0 -11
  37. package/dist/src/adapters/standard/index.d.ts +0 -4
  38. package/dist/src/adapters/standard/openapi-codec.d.ts +0 -13
  39. package/dist/src/adapters/standard/openapi-handler.d.ts +0 -5
  40. package/dist/src/adapters/standard/openapi-matcher.d.ts +0 -10
  41. package/dist/src/index.d.ts +0 -16
  42. package/dist/src/openapi-content-builder.d.ts +0 -10
  43. package/dist/src/openapi-error.d.ts +0 -3
  44. package/dist/src/openapi-generator.d.ts +0 -67
  45. package/dist/src/openapi-input-structure-parser.d.ts +0 -22
  46. package/dist/src/openapi-operation-extender.d.ts +0 -7
  47. package/dist/src/openapi-output-structure-parser.d.ts +0 -18
  48. package/dist/src/openapi-parameters-builder.d.ts +0 -12
  49. package/dist/src/openapi-path-parser.d.ts +0 -8
  50. package/dist/src/openapi.d.ts +0 -3
  51. package/dist/src/schema-converter.d.ts +0 -16
  52. package/dist/src/schema-utils.d.ts +0 -11
  53. package/dist/src/schema.d.ts +0 -12
  54. package/dist/src/utils.d.ts +0 -4
  55. 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>
@@ -0,0 +1,13 @@
1
+ import { Context, Router } from '@orpc/server';
2
+ import { FetchHandler, FetchHandleResult } from '@orpc/server/fetch';
3
+ import { StandardHandlerOptions, StandardHandleOptions } from '@orpc/server/standard';
4
+ import { MaybeOptionalOptions } from '@orpc/shared';
5
+ import { ToFetchResponseOptions } from '@orpc/standard-server-fetch';
6
+
7
+ declare class OpenAPIHandler<T extends Context> implements FetchHandler<T> {
8
+ private readonly standardHandler;
9
+ constructor(router: Router<any, T>, options?: NoInfer<StandardHandlerOptions<T>>);
10
+ handle(request: Request, ...[options,]: MaybeOptionalOptions<StandardHandleOptions<T> & ToFetchResponseOptions>): Promise<FetchHandleResult>;
11
+ }
12
+
13
+ export { OpenAPIHandler };
@@ -0,0 +1,13 @@
1
+ import { Context, Router } from '@orpc/server';
2
+ import { FetchHandler, FetchHandleResult } from '@orpc/server/fetch';
3
+ import { StandardHandlerOptions, StandardHandleOptions } from '@orpc/server/standard';
4
+ import { MaybeOptionalOptions } from '@orpc/shared';
5
+ import { ToFetchResponseOptions } from '@orpc/standard-server-fetch';
6
+
7
+ declare class OpenAPIHandler<T extends Context> implements FetchHandler<T> {
8
+ private readonly standardHandler;
9
+ constructor(router: Router<any, T>, options?: NoInfer<StandardHandlerOptions<T>>);
10
+ handle(request: Request, ...[options,]: MaybeOptionalOptions<StandardHandleOptions<T> & ToFetchResponseOptions>): Promise<FetchHandleResult>;
11
+ }
12
+
13
+ export { OpenAPIHandler };
@@ -0,0 +1,11 @@
1
+ export { O as OpenAPIHandler } from '../../shared/openapi.CbzTVvGL.mjs';
2
+ import '@orpc/openapi-client/standard';
3
+ import '@orpc/server/standard';
4
+ import '@orpc/standard-server-fetch';
5
+ import '../../shared/openapi.CJTe38Ya.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,6 @@
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';
@@ -0,0 +1,6 @@
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';
@@ -0,0 +1,11 @@
1
+ export { O as OpenAPIHandler } from '../../shared/openapi.CbzTVvGL.mjs';
2
+ import '@orpc/openapi-client/standard';
3
+ import '@orpc/server/standard';
4
+ import '@orpc/standard-server-fetch';
5
+ import '../../shared/openapi.CJTe38Ya.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,6 @@
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';
@@ -0,0 +1,6 @@
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';
@@ -0,0 +1,11 @@
1
+ export { O as OpenAPIHandler } from '../../shared/openapi.CbzTVvGL.mjs';
2
+ import '@orpc/openapi-client/standard';
3
+ import '@orpc/server/standard';
4
+ import '@orpc/standard-server-fetch';
5
+ import '../../shared/openapi.CJTe38Ya.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,13 @@
1
+ import { Context, Router } from '@orpc/server';
2
+ import { NodeHttpHandler, NodeHttpRequest, NodeHttpResponse, NodeHttpHandleResult } from '@orpc/server/node';
3
+ import { StandardHandlerOptions, StandardHandleOptions } from '@orpc/server/standard';
4
+ import { MaybeOptionalOptions } from '@orpc/shared';
5
+ import { SendStandardResponseOptions } from '@orpc/standard-server-node';
6
+
7
+ declare class OpenAPIHandler<T extends Context> implements NodeHttpHandler<T> {
8
+ private readonly standardHandler;
9
+ constructor(router: Router<any, T>, options?: NoInfer<StandardHandlerOptions<T>>);
10
+ handle(req: NodeHttpRequest, res: NodeHttpResponse, ...[options,]: MaybeOptionalOptions<StandardHandleOptions<T> & SendStandardResponseOptions>): Promise<NodeHttpHandleResult>;
11
+ }
12
+
13
+ export { OpenAPIHandler };
@@ -0,0 +1,13 @@
1
+ import { Context, Router } from '@orpc/server';
2
+ import { NodeHttpHandler, NodeHttpRequest, NodeHttpResponse, NodeHttpHandleResult } from '@orpc/server/node';
3
+ import { StandardHandlerOptions, StandardHandleOptions } from '@orpc/server/standard';
4
+ import { MaybeOptionalOptions } from '@orpc/shared';
5
+ import { SendStandardResponseOptions } from '@orpc/standard-server-node';
6
+
7
+ declare class OpenAPIHandler<T extends Context> implements NodeHttpHandler<T> {
8
+ private readonly standardHandler;
9
+ constructor(router: Router<any, T>, options?: NoInfer<StandardHandlerOptions<T>>);
10
+ handle(req: NodeHttpRequest, res: NodeHttpResponse, ...[options,]: MaybeOptionalOptions<StandardHandleOptions<T> & SendStandardResponseOptions>): Promise<NodeHttpHandleResult>;
11
+ }
12
+
13
+ export { OpenAPIHandler };
@@ -0,0 +1,33 @@
1
+ import { OpenAPISerializer } 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 OpenAPIMatcher, O as OpenAPICodec } from '../../shared/openapi.CJTe38Ya.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 serializer = new OpenAPISerializer();
16
+ const matcher = new OpenAPIMatcher();
17
+ const codec = new OpenAPICodec(serializer);
18
+ this.standardHandler = new StandardHandler(router, matcher, codec, options);
19
+ }
20
+ async handle(req, res, ...[
21
+ options = {}
22
+ ]) {
23
+ const standardRequest = toStandardLazyRequest(req, res);
24
+ const result = await this.standardHandler.handle(standardRequest, options);
25
+ if (!result.matched) {
26
+ return { matched: false };
27
+ }
28
+ await sendStandardResponse(res, result.response, options);
29
+ return { matched: true };
30
+ }
31
+ }
32
+
33
+ export { OpenAPIHandler };
@@ -0,0 +1,34 @@
1
+ import { ORPCError } from '@orpc/client';
2
+ import { OpenAPISerializer } 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
+ import { HTTPPath } from '@orpc/contract';
7
+
8
+ declare class OpenAPICodec implements StandardCodec {
9
+ private readonly serializer;
10
+ constructor(serializer: OpenAPISerializer);
11
+ decode(request: StandardLazyRequest, params: StandardParams | undefined, procedure: AnyProcedure): Promise<unknown>;
12
+ encode(output: unknown, procedure: AnyProcedure): StandardResponse;
13
+ encodeError(error: ORPCError<any, any>): StandardResponse;
14
+ }
15
+
16
+ declare class OpenAPIMatcher implements StandardMatcher {
17
+ private readonly tree;
18
+ private pendingRouters;
19
+ init(router: AnyRouter, path?: readonly string[]): void;
20
+ match(method: string, pathname: HTTPPath): Promise<StandardMatchResult>;
21
+ }
22
+
23
+ /**
24
+ * {@link https://github.com/unjs/rou3}
25
+ *
26
+ * @internal
27
+ */
28
+ declare function toRou3Pattern(path: HTTPPath): string;
29
+ /**
30
+ * @internal
31
+ */
32
+ declare function decodeParams(params: Record<string, string>): Record<string, string>;
33
+
34
+ export { OpenAPICodec, OpenAPIMatcher, decodeParams, toRou3Pattern };
@@ -0,0 +1,34 @@
1
+ import { ORPCError } from '@orpc/client';
2
+ import { OpenAPISerializer } 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
+ import { HTTPPath } from '@orpc/contract';
7
+
8
+ declare class OpenAPICodec implements StandardCodec {
9
+ private readonly serializer;
10
+ constructor(serializer: OpenAPISerializer);
11
+ decode(request: StandardLazyRequest, params: StandardParams | undefined, procedure: AnyProcedure): Promise<unknown>;
12
+ encode(output: unknown, procedure: AnyProcedure): StandardResponse;
13
+ encodeError(error: ORPCError<any, any>): StandardResponse;
14
+ }
15
+
16
+ declare class OpenAPIMatcher implements StandardMatcher {
17
+ private readonly tree;
18
+ private pendingRouters;
19
+ init(router: AnyRouter, path?: readonly string[]): void;
20
+ match(method: string, pathname: HTTPPath): Promise<StandardMatchResult>;
21
+ }
22
+
23
+ /**
24
+ * {@link https://github.com/unjs/rou3}
25
+ *
26
+ * @internal
27
+ */
28
+ declare function toRou3Pattern(path: HTTPPath): string;
29
+ /**
30
+ * @internal
31
+ */
32
+ declare function decodeParams(params: Record<string, string>): Record<string, string>;
33
+
34
+ export { OpenAPICodec, OpenAPIMatcher, decodeParams, toRou3Pattern };
@@ -0,0 +1,7 @@
1
+ export { O as OpenAPICodec, a as OpenAPIMatcher, d as decodeParams, t as toRou3Pattern } from '../../shared/openapi.CJTe38Ya.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,119 @@
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 { AnyRouter } from '@orpc/server';
5
+ import { JSONSchema } from 'json-schema-typed/draft-2020-12';
6
+ export { JSONSchema, Format as JSONSchemaFormat } from 'json-schema-typed/draft-2020-12';
7
+
8
+ type OverrideOperationValue = Partial<OpenAPIV3_1.OperationObject> | ((current: OpenAPIV3_1.OperationObject, procedure: AnyContractProcedure) => OpenAPIV3_1.OperationObject);
9
+ declare function customOpenAPIOperation<T extends object>(o: T, extend: OverrideOperationValue): T;
10
+ declare function getCustomOpenAPIOperation(o: object): OverrideOperationValue | undefined;
11
+ declare function applyCustomOpenAPIOperation(operation: OpenAPIV3_1.OperationObject, contract: AnyContractProcedure): OpenAPIV3_1.OperationObject;
12
+
13
+ /**
14
+ * @internal
15
+ */
16
+ type ObjectSchema = JSONSchema & {
17
+ type: 'object';
18
+ } & object;
19
+ /**
20
+ * @internal
21
+ */
22
+ type FileSchema = JSONSchema & {
23
+ type: 'string';
24
+ contentMediaType: string;
25
+ } & object;
26
+ /**
27
+ * @internal
28
+ */
29
+ declare const LOGIC_KEYWORDS: string[];
30
+
31
+ interface SchemaConvertOptions {
32
+ strategy: 'input' | 'output';
33
+ }
34
+ interface SchemaConverter {
35
+ convert(schema: AnySchema | undefined, options: SchemaConvertOptions): [required: boolean, jsonSchema: JSONSchema];
36
+ }
37
+ interface ConditionalSchemaConverter extends SchemaConverter {
38
+ condition(schema: AnySchema | undefined, options: SchemaConvertOptions): boolean;
39
+ }
40
+ declare class CompositeSchemaConverter implements SchemaConverter {
41
+ private readonly converters;
42
+ constructor(converters: ConditionalSchemaConverter[]);
43
+ convert(schema: AnySchema | undefined, options: SchemaConvertOptions): [required: boolean, jsonSchema: JSONSchema];
44
+ }
45
+
46
+ interface OpenAPIGeneratorOptions {
47
+ schemaConverters?: ConditionalSchemaConverter[];
48
+ }
49
+ declare class OpenAPIGenerator {
50
+ #private;
51
+ private readonly serializer;
52
+ private readonly converter;
53
+ constructor(options?: OpenAPIGeneratorOptions);
54
+ generate(router: AnyContractRouter | AnyRouter, base: Omit<OpenAPIV3_1.Document, 'openapi'>): Promise<OpenAPIV3_1.Document>;
55
+ }
56
+
57
+ /**
58
+ * @internal
59
+ */
60
+ declare function standardizeHTTPPath(path: HTTPPath): HTTPPath;
61
+ /**
62
+ * @internal
63
+ */
64
+ declare function toOpenAPIPath(path: HTTPPath): string;
65
+ /**
66
+ * @internal
67
+ */
68
+ declare function toOpenAPIMethod(method: HTTPMethod): Lowercase<HTTPMethod>;
69
+ /**
70
+ * @internal
71
+ */
72
+ declare function getDynamicParams(path: HTTPPath | undefined): string[] | undefined;
73
+ /**
74
+ * @internal
75
+ */
76
+ declare function toOpenAPIContent(schema: JSONSchema): Record<string, OpenAPIV3_1.MediaTypeObject>;
77
+ /**
78
+ * @internal
79
+ */
80
+ declare function toOpenAPIEventIteratorContent([yieldsRequired, yieldsSchema]: [boolean, JSONSchema], [returnsRequired, returnsSchema]: [boolean, JSONSchema]): Record<string, OpenAPIV3_1.MediaTypeObject>;
81
+ /**
82
+ * @internal
83
+ */
84
+ declare function toOpenAPIParameters(schema: ObjectSchema, parameterIn: 'path' | 'query' | 'header' | 'cookie'): OpenAPIV3_1.ParameterObject[];
85
+ /**
86
+ * @internal
87
+ */
88
+ declare function checkParamsSchema(schema: ObjectSchema, params: string[]): boolean;
89
+ /**
90
+ * @internal
91
+ */
92
+ declare function toOpenAPISchema(schema: JSONSchema): OpenAPIV3_1.SchemaObject & object;
93
+
94
+ /**
95
+ *@internal
96
+ */
97
+ declare function isFileSchema(schema: JSONSchema): schema is FileSchema;
98
+ /**
99
+ * @internal
100
+ */
101
+ declare function isObjectSchema(schema: JSONSchema): schema is ObjectSchema;
102
+ /**
103
+ * @internal
104
+ */
105
+ declare function isAnySchema(schema: JSONSchema): boolean;
106
+ /**
107
+ * @internal
108
+ */
109
+ declare function separateObjectSchema(schema: ObjectSchema, separatedProperties: string[]): [matched: ObjectSchema, rest: ObjectSchema];
110
+ /**
111
+ * @internal
112
+ */
113
+ declare function filterSchemaBranches(schema: JSONSchema, check: (schema: JSONSchema) => boolean, matches?: JSONSchema[]): [matches: JSONSchema[], rest: JSONSchema | undefined];
114
+
115
+ declare const oo: {
116
+ spec: typeof customOpenAPIOperation;
117
+ };
118
+
119
+ 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,119 @@
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 { AnyRouter } from '@orpc/server';
5
+ import { JSONSchema } from 'json-schema-typed/draft-2020-12';
6
+ export { JSONSchema, Format as JSONSchemaFormat } from 'json-schema-typed/draft-2020-12';
7
+
8
+ type OverrideOperationValue = Partial<OpenAPIV3_1.OperationObject> | ((current: OpenAPIV3_1.OperationObject, procedure: AnyContractProcedure) => OpenAPIV3_1.OperationObject);
9
+ declare function customOpenAPIOperation<T extends object>(o: T, extend: OverrideOperationValue): T;
10
+ declare function getCustomOpenAPIOperation(o: object): OverrideOperationValue | undefined;
11
+ declare function applyCustomOpenAPIOperation(operation: OpenAPIV3_1.OperationObject, contract: AnyContractProcedure): OpenAPIV3_1.OperationObject;
12
+
13
+ /**
14
+ * @internal
15
+ */
16
+ type ObjectSchema = JSONSchema & {
17
+ type: 'object';
18
+ } & object;
19
+ /**
20
+ * @internal
21
+ */
22
+ type FileSchema = JSONSchema & {
23
+ type: 'string';
24
+ contentMediaType: string;
25
+ } & object;
26
+ /**
27
+ * @internal
28
+ */
29
+ declare const LOGIC_KEYWORDS: string[];
30
+
31
+ interface SchemaConvertOptions {
32
+ strategy: 'input' | 'output';
33
+ }
34
+ interface SchemaConverter {
35
+ convert(schema: AnySchema | undefined, options: SchemaConvertOptions): [required: boolean, jsonSchema: JSONSchema];
36
+ }
37
+ interface ConditionalSchemaConverter extends SchemaConverter {
38
+ condition(schema: AnySchema | undefined, options: SchemaConvertOptions): boolean;
39
+ }
40
+ declare class CompositeSchemaConverter implements SchemaConverter {
41
+ private readonly converters;
42
+ constructor(converters: ConditionalSchemaConverter[]);
43
+ convert(schema: AnySchema | undefined, options: SchemaConvertOptions): [required: boolean, jsonSchema: JSONSchema];
44
+ }
45
+
46
+ interface OpenAPIGeneratorOptions {
47
+ schemaConverters?: ConditionalSchemaConverter[];
48
+ }
49
+ declare class OpenAPIGenerator {
50
+ #private;
51
+ private readonly serializer;
52
+ private readonly converter;
53
+ constructor(options?: OpenAPIGeneratorOptions);
54
+ generate(router: AnyContractRouter | AnyRouter, base: Omit<OpenAPIV3_1.Document, 'openapi'>): Promise<OpenAPIV3_1.Document>;
55
+ }
56
+
57
+ /**
58
+ * @internal
59
+ */
60
+ declare function standardizeHTTPPath(path: HTTPPath): HTTPPath;
61
+ /**
62
+ * @internal
63
+ */
64
+ declare function toOpenAPIPath(path: HTTPPath): string;
65
+ /**
66
+ * @internal
67
+ */
68
+ declare function toOpenAPIMethod(method: HTTPMethod): Lowercase<HTTPMethod>;
69
+ /**
70
+ * @internal
71
+ */
72
+ declare function getDynamicParams(path: HTTPPath | undefined): string[] | undefined;
73
+ /**
74
+ * @internal
75
+ */
76
+ declare function toOpenAPIContent(schema: JSONSchema): Record<string, OpenAPIV3_1.MediaTypeObject>;
77
+ /**
78
+ * @internal
79
+ */
80
+ declare function toOpenAPIEventIteratorContent([yieldsRequired, yieldsSchema]: [boolean, JSONSchema], [returnsRequired, returnsSchema]: [boolean, JSONSchema]): Record<string, OpenAPIV3_1.MediaTypeObject>;
81
+ /**
82
+ * @internal
83
+ */
84
+ declare function toOpenAPIParameters(schema: ObjectSchema, parameterIn: 'path' | 'query' | 'header' | 'cookie'): OpenAPIV3_1.ParameterObject[];
85
+ /**
86
+ * @internal
87
+ */
88
+ declare function checkParamsSchema(schema: ObjectSchema, params: string[]): boolean;
89
+ /**
90
+ * @internal
91
+ */
92
+ declare function toOpenAPISchema(schema: JSONSchema): OpenAPIV3_1.SchemaObject & object;
93
+
94
+ /**
95
+ *@internal
96
+ */
97
+ declare function isFileSchema(schema: JSONSchema): schema is FileSchema;
98
+ /**
99
+ * @internal
100
+ */
101
+ declare function isObjectSchema(schema: JSONSchema): schema is ObjectSchema;
102
+ /**
103
+ * @internal
104
+ */
105
+ declare function isAnySchema(schema: JSONSchema): boolean;
106
+ /**
107
+ * @internal
108
+ */
109
+ declare function separateObjectSchema(schema: ObjectSchema, separatedProperties: string[]): [matched: ObjectSchema, rest: ObjectSchema];
110
+ /**
111
+ * @internal
112
+ */
113
+ declare function filterSchemaBranches(schema: JSONSchema, check: (schema: JSONSchema) => boolean, matches?: JSONSchema[]): [matches: JSONSchema[], rest: JSONSchema | undefined];
114
+
115
+ declare const oo: {
116
+ spec: typeof customOpenAPIOperation;
117
+ };
118
+
119
+ 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 };