@orpc/openapi 0.0.0-next.ee0aeaf → 0.0.0-next.f22c7ec

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 (47) hide show
  1. package/dist/chunk-N7JLIFHD.js +25 -0
  2. package/dist/chunk-TW72MGM2.js +651 -0
  3. package/dist/chunk-V4HFPIEN.js +107 -0
  4. package/dist/fetch.js +30 -703
  5. package/dist/hono.js +34 -0
  6. package/dist/index.js +447 -4482
  7. package/dist/next.js +34 -0
  8. package/dist/node.js +46 -0
  9. package/dist/src/adapters/fetch/bracket-notation.d.ts +84 -0
  10. package/dist/src/adapters/fetch/index.d.ts +10 -0
  11. package/dist/src/adapters/fetch/input-structure-compact.d.ts +6 -0
  12. package/dist/src/adapters/fetch/input-structure-detailed.d.ts +11 -0
  13. package/dist/src/adapters/fetch/openapi-handler-server.d.ts +7 -0
  14. package/dist/src/adapters/fetch/openapi-handler-serverless.d.ts +7 -0
  15. package/dist/src/adapters/fetch/openapi-handler.d.ts +32 -0
  16. package/dist/src/adapters/fetch/openapi-payload-codec.d.ts +15 -0
  17. package/dist/src/adapters/fetch/openapi-procedure-matcher.d.ts +19 -0
  18. package/dist/src/adapters/fetch/schema-coercer.d.ts +10 -0
  19. package/dist/src/adapters/hono/index.d.ts +2 -0
  20. package/dist/src/adapters/next/index.d.ts +2 -0
  21. package/dist/src/adapters/node/index.d.ts +5 -0
  22. package/dist/src/adapters/node/openapi-handler-server.d.ts +7 -0
  23. package/dist/src/adapters/node/openapi-handler-serverless.d.ts +7 -0
  24. package/dist/src/adapters/node/openapi-handler.d.ts +11 -0
  25. package/dist/src/adapters/node/types.d.ts +2 -0
  26. package/dist/src/index.d.ts +10 -1
  27. package/dist/src/json-serializer.d.ts +5 -0
  28. package/dist/src/openapi-content-builder.d.ts +10 -0
  29. package/dist/src/openapi-error.d.ts +3 -0
  30. package/dist/src/openapi-generator.d.ts +67 -0
  31. package/dist/src/openapi-input-structure-parser.d.ts +22 -0
  32. package/dist/src/openapi-output-structure-parser.d.ts +18 -0
  33. package/dist/src/openapi-parameters-builder.d.ts +12 -0
  34. package/dist/src/openapi-path-parser.d.ts +8 -0
  35. package/dist/src/openapi.d.ts +3 -0
  36. package/dist/src/schema-converter.d.ts +16 -0
  37. package/dist/src/schema-utils.d.ts +11 -0
  38. package/dist/src/schema.d.ts +12 -0
  39. package/dist/src/utils.d.ts +6 -5
  40. package/package.json +26 -9
  41. package/dist/chunk-7HD5IZWG.js +0 -53
  42. package/dist/src/fetch/base-handler.d.ts +0 -13
  43. package/dist/src/fetch/index.d.ts +0 -4
  44. package/dist/src/fetch/server-handler.d.ts +0 -3
  45. package/dist/src/fetch/serverless-handler.d.ts +0 -3
  46. package/dist/src/generator.d.ts +0 -24
  47. package/dist/src/zod-to-json-schema.d.ts +0 -43
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.ee0aeaf",
4
+ "version": "0.0.0-next.f22c7ec",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.unnoq.com",
7
7
  "repository": {
@@ -20,10 +20,25 @@
20
20
  "default": "./dist/index.js"
21
21
  },
22
22
  "./fetch": {
23
- "types": "./dist/src/fetch/index.d.ts",
23
+ "types": "./dist/src/adapters/fetch/index.d.ts",
24
24
  "import": "./dist/fetch.js",
25
25
  "default": "./dist/fetch.js"
26
26
  },
27
+ "./hono": {
28
+ "types": "./dist/src/adapters/hono/index.d.ts",
29
+ "import": "./dist/hono.js",
30
+ "default": "./dist/hono.js"
31
+ },
32
+ "./next": {
33
+ "types": "./dist/src/adapters/next/index.d.ts",
34
+ "import": "./dist/next.js",
35
+ "default": "./dist/next.js"
36
+ },
37
+ "./node": {
38
+ "types": "./dist/src/adapters/node/index.d.ts",
39
+ "import": "./dist/node.js",
40
+ "default": "./dist/node.js"
41
+ },
27
42
  "./🔒/*": {
28
43
  "types": "./dist/src/*.d.ts"
29
44
  }
@@ -35,22 +50,24 @@
35
50
  ],
36
51
  "dependencies": {
37
52
  "@standard-schema/spec": "1.0.0-beta.4",
53
+ "@types/content-disposition": "^0.5.8",
54
+ "content-disposition": "^0.5.4",
38
55
  "escape-string-regexp": "^5.0.0",
56
+ "fast-content-type-parse": "^2.0.0",
57
+ "hono": "^4.6.12",
39
58
  "json-schema-typed": "^8.0.1",
40
59
  "openapi3-ts": "^4.4.0",
41
- "@orpc/contract": "0.0.0-next.ee0aeaf",
42
- "@orpc/server": "0.0.0-next.ee0aeaf",
43
- "@orpc/transformer": "0.0.0-next.ee0aeaf",
44
- "@orpc/zod": "0.0.0-next.ee0aeaf",
45
- "@orpc/shared": "0.0.0-next.ee0aeaf"
60
+ "wildcard-match": "^5.1.3",
61
+ "@orpc/contract": "0.0.0-next.f22c7ec",
62
+ "@orpc/shared": "0.0.0-next.f22c7ec",
63
+ "@orpc/server": "0.0.0-next.f22c7ec"
46
64
  },
47
65
  "devDependencies": {
48
66
  "@readme/openapi-parser": "^2.6.0",
49
- "hono": "^4.6.12",
50
67
  "zod": "^3.24.1"
51
68
  },
52
69
  "scripts": {
53
- "build": "tsup --clean --sourcemap --entry.index=src/index.ts --entry.fetch=src/fetch/index.ts --format=esm --onSuccess='tsc -b --noCheck'",
70
+ "build": "tsup --onSuccess='tsc -b --noCheck'",
54
71
  "build:watch": "pnpm run build --watch",
55
72
  "type:check": "tsc -b"
56
73
  }
@@ -1,53 +0,0 @@
1
- // src/utils.ts
2
- import { isContractProcedure } from "@orpc/contract";
3
- import { isLazy, isProcedure, ROUTER_CONTRACT_SYMBOL } from "@orpc/server";
4
- function eachContractProcedureLeaf(options, callback, result = [], isCurrentRouterContract = false) {
5
- if (!isCurrentRouterContract && ROUTER_CONTRACT_SYMBOL in options.router && options.router[ROUTER_CONTRACT_SYMBOL]) {
6
- return eachContractProcedureLeaf(
7
- {
8
- path: options.path,
9
- router: options.router[ROUTER_CONTRACT_SYMBOL]
10
- },
11
- callback,
12
- result,
13
- true
14
- );
15
- }
16
- if (isLazy(options.router)) {
17
- result.push({
18
- lazy: options.router,
19
- path: options.path
20
- });
21
- } else if (isProcedure(options.router)) {
22
- callback({
23
- contract: options.router.zz$p.contract,
24
- path: options.path
25
- });
26
- } else if (isContractProcedure(options.router)) {
27
- callback({
28
- contract: options.router,
29
- path: options.path
30
- });
31
- } else {
32
- for (const key in options.router) {
33
- eachContractProcedureLeaf(
34
- {
35
- router: options.router[key],
36
- path: [...options.path, key]
37
- },
38
- callback,
39
- result
40
- );
41
- }
42
- }
43
- return result;
44
- }
45
- function standardizeHTTPPath(path) {
46
- return `/${path.replace(/\/{2,}/g, "/").replace(/^\/|\/$/g, "")}`;
47
- }
48
-
49
- export {
50
- eachContractProcedureLeaf,
51
- standardizeHTTPPath
52
- };
53
- //# sourceMappingURL=chunk-7HD5IZWG.js.map
@@ -1,13 +0,0 @@
1
- import type { ANY_LAZY_PROCEDURE, ANY_PROCEDURE, Router } from '@orpc/server';
2
- import type { FetchHandler } from '@orpc/server/fetch';
3
- import type { Router as HonoRouter } from 'hono/router';
4
- export type ResolveRouter = (router: Router<any>, method: string, pathname: string) => Promise<{
5
- path: string[];
6
- procedure: ANY_PROCEDURE | ANY_LAZY_PROCEDURE;
7
- params: Record<string, string>;
8
- } | undefined>;
9
- type Routing = HonoRouter<string[]>;
10
- export declare function createOpenAPIHandler(createHonoRouter: () => Routing): FetchHandler;
11
- export declare function createResolveRouter(createHonoRouter: () => Routing): ResolveRouter;
12
- export {};
13
- //# sourceMappingURL=base-handler.d.ts.map
@@ -1,4 +0,0 @@
1
- export * from './base-handler';
2
- export * from './server-handler';
3
- export * from './serverless-handler';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1,3 +0,0 @@
1
- import type { FetchHandler } from '@orpc/server/fetch';
2
- export declare function createOpenAPIServerHandler(): FetchHandler;
3
- //# sourceMappingURL=server-handler.d.ts.map
@@ -1,3 +0,0 @@
1
- import type { FetchHandler } from '@orpc/server/fetch';
2
- export declare function createOpenAPIServerlessHandler(): FetchHandler;
3
- //# sourceMappingURL=serverless-handler.d.ts.map
@@ -1,24 +0,0 @@
1
- import { type ContractRouter } from '@orpc/contract';
2
- import { type Router } from '@orpc/server';
3
- import { type OpenAPIObject } from 'openapi3-ts/oas31';
4
- export interface GenerateOpenAPIOptions {
5
- /**
6
- * Throw error when you missing define tag definition on OpenAPI root tags
7
- *
8
- * Example: if procedure has tags ['foo', 'bar'], and OpenAPI root tags is ['foo'], then error will be thrown
9
- * Because OpenAPI root tags is missing 'bar' tag
10
- *
11
- * @default false
12
- */
13
- throwOnMissingTagDefinition?: boolean;
14
- /**
15
- * Weather ignore procedures that has no path defined.
16
- *
17
- * @default false
18
- */
19
- ignoreUndefinedPathProcedures?: boolean;
20
- }
21
- export declare function generateOpenAPI(opts: {
22
- router: ContractRouter | Router<any>;
23
- } & Omit<OpenAPIObject, 'openapi'>, options?: GenerateOpenAPIOptions): Promise<OpenAPIObject>;
24
- //# sourceMappingURL=generator.d.ts.map
@@ -1,43 +0,0 @@
1
- import type { StandardSchemaV1 } from '@standard-schema/spec';
2
- import { type JSONSchema } from 'json-schema-typed/draft-2020-12';
3
- export declare const NON_LOGIC_KEYWORDS: ("$anchor" | "$comment" | "$defs" | "$dynamicAnchor" | "$dynamicRef" | "$id" | "$schema" | "$vocabulary" | "contentEncoding" | "contentMediaType" | "default" | "definitions" | "deprecated" | "description" | "examples" | "format" | "readOnly" | "title" | "writeOnly")[];
4
- export declare const UNSUPPORTED_JSON_SCHEMA: {
5
- not: {};
6
- };
7
- export declare const UNDEFINED_JSON_SCHEMA: {
8
- const: string;
9
- };
10
- export interface ZodToJsonSchemaOptions {
11
- /**
12
- * Max depth of lazy type, if it exceeds.
13
- *
14
- * Used `{}` when reach max depth
15
- *
16
- * @default 5
17
- */
18
- maxLazyDepth?: number;
19
- /**
20
- * The length used to track the depth of lazy type
21
- *
22
- * @internal
23
- */
24
- lazyDepth?: number;
25
- /**
26
- * The expected json schema for input or output zod schema
27
- *
28
- * @default input
29
- */
30
- mode?: 'input' | 'output';
31
- /**
32
- * Track if current level schema is handled custom json schema to prevent recursive
33
- *
34
- * @internal
35
- */
36
- isHandledCustomJSONSchema?: boolean;
37
- }
38
- export declare function zodToJsonSchema(schema: StandardSchemaV1, options?: ZodToJsonSchemaOptions): Exclude<JSONSchema, boolean>;
39
- export declare function extractJSONSchema(schema: JSONSchema, check: (schema: JSONSchema) => boolean, matches?: JSONSchema[]): {
40
- schema: JSONSchema | undefined;
41
- matches: JSONSchema[];
42
- };
43
- //# sourceMappingURL=zod-to-json-schema.d.ts.map