@orpc/openapi 0.0.0-next.1d55ec0 → 0.0.0-next.2f8ca7f
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/chunk-KZIT2WCV.js +49 -0
- package/dist/fetch.js +708 -0
- package/dist/index.js +363 -213
- package/dist/src/fetch/base-handler.d.ts +15 -0
- package/dist/src/fetch/index.d.ts +4 -0
- package/dist/src/fetch/server-handler.d.ts +3 -0
- package/dist/src/fetch/serverless-handler.d.ts +3 -0
- package/dist/src/generator.d.ts +2 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/utils.d.ts +16 -0
- package/dist/src/zod-to-json-schema.d.ts +1 -0
- package/package.json +15 -8
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { HTTPPath } from '@orpc/contract';
|
|
2
|
+
import type { ANY_LAZY_PROCEDURE, ANY_PROCEDURE, Router } from '@orpc/server';
|
|
3
|
+
import type { FetchHandler } from '@orpc/server/fetch';
|
|
4
|
+
import type { Router as HonoRouter } from 'hono/router';
|
|
5
|
+
export type ResolveRouter = (router: Router<any>, method: string, pathname: string) => Promise<{
|
|
6
|
+
path: string[];
|
|
7
|
+
procedure: ANY_PROCEDURE | ANY_LAZY_PROCEDURE;
|
|
8
|
+
params: Record<string, string>;
|
|
9
|
+
} | undefined>;
|
|
10
|
+
type Routing = HonoRouter<string[]>;
|
|
11
|
+
export declare function createOpenAPIHandler(createHonoRouter: () => Routing): FetchHandler;
|
|
12
|
+
export declare function createResolveRouter(createHonoRouter: () => Routing): ResolveRouter;
|
|
13
|
+
export declare function openAPIPathToRouterPath(path: HTTPPath): string;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=base-handler.d.ts.map
|
package/dist/src/generator.d.ts
CHANGED
|
@@ -20,4 +20,5 @@ export interface GenerateOpenAPIOptions {
|
|
|
20
20
|
}
|
|
21
21
|
export declare function generateOpenAPI(opts: {
|
|
22
22
|
router: ContractRouter | Router<any>;
|
|
23
|
-
} & Omit<OpenAPIObject, 'openapi'>, options?: GenerateOpenAPIOptions): OpenAPIObject
|
|
23
|
+
} & Omit<OpenAPIObject, 'openapi'>, options?: GenerateOpenAPIOptions): Promise<OpenAPIObject>;
|
|
24
|
+
//# sourceMappingURL=generator.d.ts.map
|
package/dist/src/index.d.ts
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ContractProcedure, ContractRouter, WELL_CONTRACT_PROCEDURE } from '@orpc/contract';
|
|
2
|
+
import type { ANY_LAZY_PROCEDURE, ANY_PROCEDURE, Lazy, Router } from '@orpc/server';
|
|
3
|
+
export interface EachLeafOptions {
|
|
4
|
+
router: ANY_PROCEDURE | Router<any> | ContractRouter | ContractProcedure<any, any>;
|
|
5
|
+
path: string[];
|
|
6
|
+
}
|
|
7
|
+
export interface EachLeafCallbackOptions {
|
|
8
|
+
contract: WELL_CONTRACT_PROCEDURE;
|
|
9
|
+
path: string[];
|
|
10
|
+
}
|
|
11
|
+
export interface EachContractLeafResultItem {
|
|
12
|
+
lazy: ANY_LAZY_PROCEDURE | Lazy<Router<any>>;
|
|
13
|
+
path: string[];
|
|
14
|
+
}
|
|
15
|
+
export declare function eachContractProcedureLeaf(options: EachLeafOptions, callback: (options: EachLeafCallbackOptions) => void, result?: EachContractLeafResultItem[], isCurrentRouterContract?: boolean): EachContractLeafResultItem[];
|
|
16
|
+
//# sourceMappingURL=utils.d.ts.map
|
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.2f8ca7f",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
|
7
7
|
"repository": {
|
|
@@ -19,30 +19,37 @@
|
|
|
19
19
|
"import": "./dist/index.js",
|
|
20
20
|
"default": "./dist/index.js"
|
|
21
21
|
},
|
|
22
|
+
"./fetch": {
|
|
23
|
+
"types": "./dist/src/fetch/index.d.ts",
|
|
24
|
+
"import": "./dist/fetch.js",
|
|
25
|
+
"default": "./dist/fetch.js"
|
|
26
|
+
},
|
|
22
27
|
"./🔒/*": {
|
|
23
28
|
"types": "./dist/src/*.d.ts"
|
|
24
29
|
}
|
|
25
30
|
},
|
|
26
31
|
"files": [
|
|
27
|
-
"
|
|
32
|
+
"!**/*.map",
|
|
33
|
+
"!**/*.tsbuildinfo",
|
|
28
34
|
"dist"
|
|
29
35
|
],
|
|
30
36
|
"dependencies": {
|
|
31
37
|
"escape-string-regexp": "^5.0.0",
|
|
32
38
|
"json-schema-typed": "^8.0.1",
|
|
33
39
|
"openapi3-ts": "^4.4.0",
|
|
34
|
-
"@orpc/contract": "0.0.0-next.
|
|
35
|
-
"@orpc/shared": "0.0.0-next.
|
|
36
|
-
"@orpc/
|
|
37
|
-
"@orpc/transformer": "0.0.0-next.
|
|
38
|
-
"@orpc/
|
|
40
|
+
"@orpc/contract": "0.0.0-next.2f8ca7f",
|
|
41
|
+
"@orpc/shared": "0.0.0-next.2f8ca7f",
|
|
42
|
+
"@orpc/server": "0.0.0-next.2f8ca7f",
|
|
43
|
+
"@orpc/transformer": "0.0.0-next.2f8ca7f",
|
|
44
|
+
"@orpc/zod": "0.0.0-next.2f8ca7f"
|
|
39
45
|
},
|
|
40
46
|
"devDependencies": {
|
|
41
47
|
"@readme/openapi-parser": "^2.6.0",
|
|
48
|
+
"hono": "^4.6.12",
|
|
42
49
|
"zod": "^3.23.8"
|
|
43
50
|
},
|
|
44
51
|
"scripts": {
|
|
45
|
-
"build": "tsup --clean --entry.index=src/index.ts --format=esm --onSuccess='tsc -b --noCheck'",
|
|
52
|
+
"build": "tsup --clean --sourcemap --entry.index=src/index.ts --entry.fetch=src/fetch/index.ts --format=esm --onSuccess='tsc -b --noCheck'",
|
|
46
53
|
"build:watch": "pnpm run build --watch",
|
|
47
54
|
"type:check": "tsc -b"
|
|
48
55
|
}
|