@orpc/openapi 0.0.0-next.ef3ba82 → 0.0.0-next.f107a0e
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 +101 -0
- package/dist/adapters/aws-lambda/index.d.mts +17 -0
- package/dist/adapters/aws-lambda/index.d.ts +17 -0
- package/dist/adapters/aws-lambda/index.mjs +18 -0
- package/dist/adapters/fetch/index.d.mts +17 -0
- package/dist/adapters/fetch/index.d.ts +17 -0
- package/dist/adapters/fetch/index.mjs +18 -0
- package/dist/adapters/node/index.d.mts +17 -0
- package/dist/adapters/node/index.d.ts +17 -0
- package/dist/adapters/node/index.mjs +18 -0
- package/dist/adapters/standard/index.d.mts +35 -0
- package/dist/adapters/standard/index.d.ts +35 -0
- package/dist/adapters/standard/index.mjs +9 -0
- package/dist/index.d.mts +109 -0
- package/dist/index.d.ts +109 -0
- package/dist/index.mjs +41 -0
- package/dist/plugins/index.d.mts +69 -0
- package/dist/plugins/index.d.ts +69 -0
- package/dist/plugins/index.mjs +108 -0
- package/dist/shared/openapi.C_UtQ8Us.mjs +179 -0
- package/dist/shared/openapi.D3j94c9n.d.mts +12 -0
- package/dist/shared/openapi.D3j94c9n.d.ts +12 -0
- package/dist/shared/openapi.DaYgbD_w.mjs +652 -0
- package/dist/shared/openapi.qZLdpE0a.d.mts +52 -0
- package/dist/shared/openapi.qZLdpE0a.d.ts +52 -0
- package/package.json +35 -21
- package/dist/fetch.js +0 -668
- package/dist/index.js +0 -4421
- package/dist/src/fetch/base-handler.d.ts +0 -14
- package/dist/src/fetch/index.d.ts +0 -3
- package/dist/src/fetch/server-handler.d.ts +0 -2
- package/dist/src/fetch/serverless-handler.d.ts +0 -2
- package/dist/src/generator.d.ts +0 -23
- package/dist/src/index.d.ts +0 -2
- package/dist/src/zod-to-json-schema.d.ts +0 -42
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { AnySchema, OpenAPI, AnyContractProcedure, AnyContractRouter } from '@orpc/contract';
|
|
2
|
+
import { StandardOpenAPIJsonSerializerOptions } from '@orpc/openapi-client/standard';
|
|
3
|
+
import { AnyProcedure, AnyRouter } from '@orpc/server';
|
|
4
|
+
import { Promisable } from '@orpc/shared';
|
|
5
|
+
import { JSONSchema } from 'json-schema-typed/draft-2020-12';
|
|
6
|
+
|
|
7
|
+
interface SchemaConvertOptions {
|
|
8
|
+
strategy: 'input' | 'output';
|
|
9
|
+
}
|
|
10
|
+
interface SchemaConverter {
|
|
11
|
+
convert(schema: AnySchema | undefined, options: SchemaConvertOptions): Promisable<[required: boolean, jsonSchema: JSONSchema]>;
|
|
12
|
+
}
|
|
13
|
+
interface ConditionalSchemaConverter extends SchemaConverter {
|
|
14
|
+
condition(schema: AnySchema | undefined, options: SchemaConvertOptions): Promisable<boolean>;
|
|
15
|
+
}
|
|
16
|
+
declare class CompositeSchemaConverter implements SchemaConverter {
|
|
17
|
+
private readonly converters;
|
|
18
|
+
constructor(converters: ConditionalSchemaConverter[]);
|
|
19
|
+
convert(schema: AnySchema | undefined, options: SchemaConvertOptions): Promise<[required: boolean, jsonSchema: JSONSchema]>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface OpenAPIGeneratorOptions extends StandardOpenAPIJsonSerializerOptions {
|
|
23
|
+
schemaConverters?: ConditionalSchemaConverter[];
|
|
24
|
+
}
|
|
25
|
+
interface OpenAPIGeneratorGenerateOptions extends Partial<Omit<OpenAPI.Document, 'openapi'>> {
|
|
26
|
+
/**
|
|
27
|
+
* Exclude procedures from the OpenAPI specification.
|
|
28
|
+
*
|
|
29
|
+
* @default () => false
|
|
30
|
+
*/
|
|
31
|
+
exclude?: (procedure: AnyProcedure | AnyContractProcedure, path: readonly string[]) => boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The generator that converts oRPC routers/contracts to OpenAPI specifications.
|
|
35
|
+
*
|
|
36
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-specification OpenAPI Specification Docs}
|
|
37
|
+
*/
|
|
38
|
+
declare class OpenAPIGenerator {
|
|
39
|
+
#private;
|
|
40
|
+
private readonly serializer;
|
|
41
|
+
private readonly converter;
|
|
42
|
+
constructor(options?: OpenAPIGeneratorOptions);
|
|
43
|
+
/**
|
|
44
|
+
* Generates OpenAPI specifications from oRPC routers/contracts.
|
|
45
|
+
*
|
|
46
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-specification OpenAPI Specification Docs}
|
|
47
|
+
*/
|
|
48
|
+
generate(router: AnyContractRouter | AnyRouter, options?: OpenAPIGeneratorGenerateOptions): Promise<OpenAPI.Document>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { OpenAPIGenerator as b, CompositeSchemaConverter as d };
|
|
52
|
+
export type { ConditionalSchemaConverter as C, OpenAPIGeneratorOptions as O, SchemaConvertOptions as S, OpenAPIGeneratorGenerateOptions as a, SchemaConverter as c };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/openapi",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-next.
|
|
4
|
+
"version": "0.0.0-next.f107a0e",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
|
7
7
|
"repository": {
|
|
@@ -15,40 +15,54 @@
|
|
|
15
15
|
],
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
18
|
-
"types": "./dist/
|
|
19
|
-
"import": "./dist/index.
|
|
20
|
-
"default": "./dist/index.
|
|
18
|
+
"types": "./dist/index.d.mts",
|
|
19
|
+
"import": "./dist/index.mjs",
|
|
20
|
+
"default": "./dist/index.mjs"
|
|
21
|
+
},
|
|
22
|
+
"./plugins": {
|
|
23
|
+
"types": "./dist/plugins/index.d.mts",
|
|
24
|
+
"import": "./dist/plugins/index.mjs",
|
|
25
|
+
"default": "./dist/plugins/index.mjs"
|
|
26
|
+
},
|
|
27
|
+
"./standard": {
|
|
28
|
+
"types": "./dist/adapters/standard/index.d.mts",
|
|
29
|
+
"import": "./dist/adapters/standard/index.mjs",
|
|
30
|
+
"default": "./dist/adapters/standard/index.mjs"
|
|
21
31
|
},
|
|
22
32
|
"./fetch": {
|
|
23
|
-
"types": "./dist/
|
|
24
|
-
"import": "./dist/fetch.
|
|
25
|
-
"default": "./dist/fetch.
|
|
33
|
+
"types": "./dist/adapters/fetch/index.d.mts",
|
|
34
|
+
"import": "./dist/adapters/fetch/index.mjs",
|
|
35
|
+
"default": "./dist/adapters/fetch/index.mjs"
|
|
36
|
+
},
|
|
37
|
+
"./node": {
|
|
38
|
+
"types": "./dist/adapters/node/index.d.mts",
|
|
39
|
+
"import": "./dist/adapters/node/index.mjs",
|
|
40
|
+
"default": "./dist/adapters/node/index.mjs"
|
|
26
41
|
},
|
|
27
|
-
"
|
|
28
|
-
"types": "./dist/
|
|
42
|
+
"./aws-lambda": {
|
|
43
|
+
"types": "./dist/adapters/aws-lambda/index.d.mts",
|
|
44
|
+
"import": "./dist/adapters/aws-lambda/index.mjs",
|
|
45
|
+
"default": "./dist/adapters/aws-lambda/index.mjs"
|
|
29
46
|
}
|
|
30
47
|
},
|
|
31
48
|
"files": [
|
|
32
|
-
"!dist/*.tsbuildinfo",
|
|
33
49
|
"dist"
|
|
34
50
|
],
|
|
35
51
|
"dependencies": {
|
|
36
|
-
"escape-string-regexp": "^5.0.0",
|
|
37
52
|
"json-schema-typed": "^8.0.1",
|
|
38
|
-
"
|
|
39
|
-
"@orpc/
|
|
40
|
-
"@orpc/
|
|
41
|
-
"@orpc/
|
|
42
|
-
"@orpc/
|
|
43
|
-
"@orpc/
|
|
53
|
+
"rou3": "^0.6.0",
|
|
54
|
+
"@orpc/client": "0.0.0-next.f107a0e",
|
|
55
|
+
"@orpc/openapi-client": "0.0.0-next.f107a0e",
|
|
56
|
+
"@orpc/standard-server": "0.0.0-next.f107a0e",
|
|
57
|
+
"@orpc/contract": "0.0.0-next.f107a0e",
|
|
58
|
+
"@orpc/server": "0.0.0-next.f107a0e",
|
|
59
|
+
"@orpc/shared": "0.0.0-next.f107a0e"
|
|
44
60
|
},
|
|
45
61
|
"devDependencies": {
|
|
46
|
-
"
|
|
47
|
-
"hono": "^4.6.12",
|
|
48
|
-
"zod": "^3.23.8"
|
|
62
|
+
"zod": "^3.25.11"
|
|
49
63
|
},
|
|
50
64
|
"scripts": {
|
|
51
|
-
"build": "
|
|
65
|
+
"build": "unbuild",
|
|
52
66
|
"build:watch": "pnpm run build --watch",
|
|
53
67
|
"type:check": "tsc -b"
|
|
54
68
|
}
|