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

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 (41) hide show
  1. package/README.md +91 -0
  2. package/dist/chunk-ATDLVTJE.js +32 -0
  3. package/dist/chunk-PGCWJMRO.js +157 -0
  4. package/dist/chunk-XGHV4TH3.js +13 -0
  5. package/dist/fetch.js +7 -666
  6. package/dist/hono.js +9 -0
  7. package/dist/index.js +613 -4333
  8. package/dist/next.js +9 -0
  9. package/dist/node.js +30 -0
  10. package/dist/src/adapters/fetch/index.d.ts +2 -0
  11. package/dist/src/adapters/fetch/openapi-handler.d.ts +11 -0
  12. package/dist/src/adapters/hono/index.d.ts +2 -0
  13. package/dist/src/adapters/next/index.d.ts +2 -0
  14. package/dist/src/adapters/node/index.d.ts +2 -0
  15. package/dist/src/adapters/node/openapi-handler.d.ts +11 -0
  16. package/dist/src/adapters/standard/index.d.ts +4 -0
  17. package/dist/src/adapters/standard/openapi-codec.d.ts +13 -0
  18. package/dist/src/adapters/standard/openapi-handler.d.ts +5 -0
  19. package/dist/src/adapters/standard/openapi-matcher.d.ts +10 -0
  20. package/dist/src/index.d.ts +15 -1
  21. package/dist/src/openapi-content-builder.d.ts +10 -0
  22. package/dist/src/openapi-error.d.ts +3 -0
  23. package/dist/src/openapi-generator.d.ts +67 -0
  24. package/dist/src/openapi-input-structure-parser.d.ts +22 -0
  25. package/dist/src/openapi-operation-extender.d.ts +7 -0
  26. package/dist/src/openapi-output-structure-parser.d.ts +18 -0
  27. package/dist/src/openapi-parameters-builder.d.ts +12 -0
  28. package/dist/src/openapi-path-parser.d.ts +8 -0
  29. package/dist/src/openapi.d.ts +3 -0
  30. package/dist/src/schema-converter.d.ts +16 -0
  31. package/dist/src/schema-utils.d.ts +11 -0
  32. package/dist/src/schema.d.ts +12 -0
  33. package/dist/src/utils.d.ts +4 -0
  34. package/dist/standard.js +10 -0
  35. package/package.json +34 -13
  36. package/dist/src/fetch/base-handler.d.ts +0 -14
  37. package/dist/src/fetch/index.d.ts +0 -3
  38. package/dist/src/fetch/server-handler.d.ts +0 -2
  39. package/dist/src/fetch/serverless-handler.d.ts +0 -2
  40. package/dist/src/generator.d.ts +0 -23
  41. package/dist/src/zod-to-json-schema.d.ts +0 -42
package/dist/next.js ADDED
@@ -0,0 +1,9 @@
1
+ import {
2
+ OpenAPIHandler
3
+ } from "./chunk-ATDLVTJE.js";
4
+ import "./chunk-PGCWJMRO.js";
5
+ import "./chunk-XGHV4TH3.js";
6
+ export {
7
+ OpenAPIHandler
8
+ };
9
+ //# sourceMappingURL=next.js.map
package/dist/node.js ADDED
@@ -0,0 +1,30 @@
1
+ import {
2
+ OpenAPICodec,
3
+ OpenAPIMatcher
4
+ } from "./chunk-PGCWJMRO.js";
5
+ import "./chunk-XGHV4TH3.js";
6
+
7
+ // src/adapters/node/openapi-handler.ts
8
+ import { sendStandardResponse, toStandardRequest } from "@orpc/server-standard-node";
9
+ import { StandardHandler } from "@orpc/server/standard";
10
+ var OpenAPIHandler = class {
11
+ standardHandler;
12
+ constructor(router, options) {
13
+ const matcher = options?.matcher ?? new OpenAPIMatcher();
14
+ const codec = options?.codec ?? new OpenAPICodec();
15
+ this.standardHandler = new StandardHandler(router, matcher, codec, { ...options });
16
+ }
17
+ async handle(req, res, ...rest) {
18
+ const standardRequest = toStandardRequest(req, res);
19
+ const result = await this.standardHandler.handle(standardRequest, ...rest);
20
+ if (!result.matched) {
21
+ return { matched: false };
22
+ }
23
+ await sendStandardResponse(res, result.response);
24
+ return { matched: true };
25
+ }
26
+ };
27
+ export {
28
+ OpenAPIHandler
29
+ };
30
+ //# sourceMappingURL=node.js.map
@@ -0,0 +1,2 @@
1
+ export * from './openapi-handler';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,11 @@
1
+ import type { Context, Router } from '@orpc/server';
2
+ import type { FetchHandler, FetchHandleResult } from '@orpc/server/fetch';
3
+ import type { StandardHandleOptions } from '@orpc/server/standard';
4
+ import type { MaybeOptionalOptions } from '@orpc/shared';
5
+ import type { OpenAPIHandlerOptions } from '../standard';
6
+ export declare class OpenAPIHandler<T extends Context> implements FetchHandler<T> {
7
+ private readonly standardHandler;
8
+ constructor(router: Router<T, any>, options?: NoInfer<OpenAPIHandlerOptions<T>>);
9
+ handle(request: Request, ...rest: MaybeOptionalOptions<StandardHandleOptions<T>>): Promise<FetchHandleResult>;
10
+ }
11
+ //# sourceMappingURL=openapi-handler.d.ts.map
@@ -0,0 +1,2 @@
1
+ export * from '../fetch';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,2 @@
1
+ export * from '../fetch';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,2 @@
1
+ export * from './openapi-handler';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,11 @@
1
+ import type { Context, Router } from '@orpc/server';
2
+ import type { NodeHttpHandler, NodeHttpHandleResult, NodeHttpRequest, NodeHttpResponse } from '@orpc/server/node';
3
+ import type { StandardHandleOptions } from '@orpc/server/standard';
4
+ import type { MaybeOptionalOptions } from '@orpc/shared';
5
+ import type { OpenAPIHandlerOptions } from '../standard';
6
+ export declare class OpenAPIHandler<T extends Context> implements NodeHttpHandler<T> {
7
+ private readonly standardHandler;
8
+ constructor(router: Router<T, any>, options?: NoInfer<OpenAPIHandlerOptions<T>>);
9
+ handle(req: NodeHttpRequest, res: NodeHttpResponse, ...rest: MaybeOptionalOptions<StandardHandleOptions<T>>): Promise<NodeHttpHandleResult>;
10
+ }
11
+ //# sourceMappingURL=openapi-handler.d.ts.map
@@ -0,0 +1,4 @@
1
+ export * from './openapi-codec';
2
+ export * from './openapi-handler';
3
+ export * from './openapi-matcher';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,13 @@
1
+ import type { ORPCError } from '@orpc/client';
2
+ import type { AnyProcedure } from '@orpc/server';
3
+ import type { StandardRequest, StandardResponse } from '@orpc/server-standard';
4
+ import type { StandardCodec, StandardParams } from '@orpc/server/standard';
5
+ import { OpenAPISerializer } from '@orpc/client/openapi';
6
+ export declare class OpenAPICodec implements StandardCodec {
7
+ private readonly serializer;
8
+ constructor(serializer?: OpenAPISerializer);
9
+ decode(request: StandardRequest, params: StandardParams | undefined, procedure: AnyProcedure): Promise<unknown>;
10
+ encode(output: unknown, procedure: AnyProcedure): StandardResponse;
11
+ encodeError(error: ORPCError<any, any>): StandardResponse;
12
+ }
13
+ //# sourceMappingURL=openapi-codec.d.ts.map
@@ -0,0 +1,5 @@
1
+ import type { Context } from '@orpc/server';
2
+ import type { RPCHandlerOptions } from '@orpc/server/standard';
3
+ export interface OpenAPIHandlerOptions<T extends Context> extends RPCHandlerOptions<T> {
4
+ }
5
+ //# sourceMappingURL=openapi-handler.d.ts.map
@@ -0,0 +1,10 @@
1
+ import type { AnyRouter } from '@orpc/server';
2
+ import type { StandardMatcher, StandardMatchResult } from '@orpc/server/standard';
3
+ import { type HTTPPath } from '@orpc/contract';
4
+ export declare class OpenAPIMatcher implements StandardMatcher {
5
+ private readonly tree;
6
+ private pendingRouters;
7
+ init(router: AnyRouter, path?: string[]): void;
8
+ match(method: string, pathname: HTTPPath): Promise<StandardMatchResult>;
9
+ }
10
+ //# sourceMappingURL=openapi-matcher.d.ts.map
@@ -1,2 +1,16 @@
1
1
  /** unnoq */
2
- export * from './generator';
2
+ import { setOperationExtender } from './openapi-operation-extender';
3
+ export * from './openapi';
4
+ export * from './openapi-content-builder';
5
+ export * from './openapi-generator';
6
+ export * from './openapi-operation-extender';
7
+ export * from './openapi-parameters-builder';
8
+ export * from './openapi-path-parser';
9
+ export * from './schema';
10
+ export * from './schema-converter';
11
+ export * from './schema-utils';
12
+ export * from './utils';
13
+ export declare const oo: {
14
+ spec: typeof setOperationExtender;
15
+ };
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,10 @@
1
+ import type { OpenAPI } from './openapi';
2
+ import type { JSONSchema } from './schema';
3
+ import type { PublicSchemaUtils } from './schema-utils';
4
+ export declare class OpenAPIContentBuilder {
5
+ private readonly schemaUtils;
6
+ constructor(schemaUtils: PublicSchemaUtils);
7
+ build(jsonSchema: JSONSchema.JSONSchema, options?: Partial<OpenAPI.MediaTypeObject>): OpenAPI.ContentObject;
8
+ }
9
+ export type PublicOpenAPIContentBuilder = Pick<OpenAPIContentBuilder, keyof OpenAPIContentBuilder>;
10
+ //# sourceMappingURL=openapi-content-builder.d.ts.map
@@ -0,0 +1,3 @@
1
+ export declare class OpenAPIError extends Error {
2
+ }
3
+ //# sourceMappingURL=openapi-error.d.ts.map
@@ -0,0 +1,67 @@
1
+ import type { PublicOpenAPIInputStructureParser } from './openapi-input-structure-parser';
2
+ import type { PublicOpenAPIOutputStructureParser } from './openapi-output-structure-parser';
3
+ import type { PublicOpenAPIPathParser } from './openapi-path-parser';
4
+ import type { SchemaConverter } from './schema-converter';
5
+ import { OpenAPIJsonSerializer } from '@orpc/client/openapi';
6
+ import { type ContractRouter } from '@orpc/contract';
7
+ import { type AnyRouter } from '@orpc/server';
8
+ import { type OpenAPI } from './openapi';
9
+ import { type PublicOpenAPIContentBuilder } from './openapi-content-builder';
10
+ import { type PublicOpenAPIParametersBuilder } from './openapi-parameters-builder';
11
+ import { type PublicSchemaUtils } from './schema-utils';
12
+ type ErrorHandlerStrategy = 'throw' | 'log' | 'ignore';
13
+ export interface OpenAPIGeneratorOptions {
14
+ contentBuilder?: PublicOpenAPIContentBuilder;
15
+ parametersBuilder?: PublicOpenAPIParametersBuilder;
16
+ schemaConverters?: SchemaConverter[];
17
+ schemaUtils?: PublicSchemaUtils;
18
+ jsonSerializer?: OpenAPIJsonSerializer;
19
+ pathParser?: PublicOpenAPIPathParser;
20
+ inputStructureParser?: PublicOpenAPIInputStructureParser;
21
+ outputStructureParser?: PublicOpenAPIOutputStructureParser;
22
+ /**
23
+ * Throw error when you missing define tag definition on OpenAPI root tags
24
+ *
25
+ * Example: if procedure has tags ['foo', 'bar'], and OpenAPI root tags is ['foo'], then error will be thrown
26
+ * Because OpenAPI root tags is missing 'bar' tag
27
+ *
28
+ * @default false
29
+ */
30
+ considerMissingTagDefinitionAsError?: boolean;
31
+ /**
32
+ * Weather ignore procedures that has no path defined.
33
+ *
34
+ * @default false
35
+ */
36
+ ignoreUndefinedPathProcedures?: boolean;
37
+ /**
38
+ * What to do when we found an error with our router
39
+ *
40
+ * @default 'throw'
41
+ */
42
+ errorHandlerStrategy?: ErrorHandlerStrategy;
43
+ /**
44
+ * Strict error response
45
+ *
46
+ * @default true
47
+ */
48
+ strictErrorResponses?: boolean;
49
+ }
50
+ export declare class OpenAPIGenerator {
51
+ private readonly contentBuilder;
52
+ private readonly parametersBuilder;
53
+ private readonly schemaConverter;
54
+ private readonly schemaUtils;
55
+ private readonly jsonSerializer;
56
+ private readonly pathParser;
57
+ private readonly inputStructureParser;
58
+ private readonly outputStructureParser;
59
+ private readonly errorHandlerStrategy;
60
+ private readonly ignoreUndefinedPathProcedures;
61
+ private readonly considerMissingTagDefinitionAsError;
62
+ private readonly strictErrorResponses;
63
+ constructor(options?: OpenAPIGeneratorOptions);
64
+ generate(router: ContractRouter<any> | AnyRouter, doc: Omit<OpenAPI.OpenAPIObject, 'openapi'>): Promise<OpenAPI.OpenAPIObject>;
65
+ }
66
+ export {};
67
+ //# sourceMappingURL=openapi-generator.d.ts.map
@@ -0,0 +1,22 @@
1
+ import type { AnyContractProcedure } from '@orpc/contract';
2
+ import type { PublicOpenAPIPathParser } from './openapi-path-parser';
3
+ import type { JSONSchema, ObjectSchema } from './schema';
4
+ import type { SchemaConverter } from './schema-converter';
5
+ import type { PublicSchemaUtils } from './schema-utils';
6
+ export interface OpenAPIInputStructureParseResult {
7
+ paramsSchema: ObjectSchema | undefined;
8
+ querySchema: ObjectSchema | undefined;
9
+ headersSchema: ObjectSchema | undefined;
10
+ bodySchema: JSONSchema.JSONSchema | undefined;
11
+ }
12
+ export declare class OpenAPIInputStructureParser {
13
+ private readonly schemaConverter;
14
+ private readonly schemaUtils;
15
+ private readonly pathParser;
16
+ constructor(schemaConverter: SchemaConverter, schemaUtils: PublicSchemaUtils, pathParser: PublicOpenAPIPathParser);
17
+ parse(contract: AnyContractProcedure, structure: 'compact' | 'detailed'): OpenAPIInputStructureParseResult;
18
+ private parseDetailedSchema;
19
+ private parseCompactSchema;
20
+ }
21
+ export type PublicOpenAPIInputStructureParser = Pick<OpenAPIInputStructureParser, keyof OpenAPIInputStructureParser>;
22
+ //# sourceMappingURL=openapi-input-structure-parser.d.ts.map
@@ -0,0 +1,7 @@
1
+ import type { AnyContractProcedure } from '@orpc/contract';
2
+ import type { OpenAPI } from './openapi';
3
+ export type OverrideOperationValue = OpenAPI.OperationObject | ((current: OpenAPI.OperationObject, procedure: AnyContractProcedure) => OpenAPI.OperationObject);
4
+ export declare function setOperationExtender<T extends object>(o: T, extend: OverrideOperationValue): T;
5
+ export declare function getOperationExtender(o: object): OverrideOperationValue | undefined;
6
+ export declare function extendOperation(operation: OpenAPI.OperationObject, procedure: AnyContractProcedure): OpenAPI.OperationObject;
7
+ //# sourceMappingURL=openapi-operation-extender.d.ts.map
@@ -0,0 +1,18 @@
1
+ import type { AnyContractProcedure } from '@orpc/contract';
2
+ import type { JSONSchema, ObjectSchema } from './schema';
3
+ import type { SchemaConverter } from './schema-converter';
4
+ import type { PublicSchemaUtils } from './schema-utils';
5
+ export interface OpenAPIOutputStructureParseResult {
6
+ headersSchema: ObjectSchema | undefined;
7
+ bodySchema: JSONSchema.JSONSchema | undefined;
8
+ }
9
+ export declare class OpenAPIOutputStructureParser {
10
+ private readonly schemaConverter;
11
+ private readonly schemaUtils;
12
+ constructor(schemaConverter: SchemaConverter, schemaUtils: PublicSchemaUtils);
13
+ parse(contract: AnyContractProcedure, structure: 'compact' | 'detailed'): OpenAPIOutputStructureParseResult;
14
+ private parseDetailedSchema;
15
+ private parseCompactSchema;
16
+ }
17
+ export type PublicOpenAPIOutputStructureParser = Pick<OpenAPIOutputStructureParser, keyof OpenAPIOutputStructureParser>;
18
+ //# sourceMappingURL=openapi-output-structure-parser.d.ts.map
@@ -0,0 +1,12 @@
1
+ import type { OpenAPI } from './openapi';
2
+ import type { JSONSchema } from './schema';
3
+ export declare class OpenAPIParametersBuilder {
4
+ build(paramIn: OpenAPI.ParameterObject['in'], jsonSchema: JSONSchema.JSONSchema & {
5
+ type: 'object';
6
+ } & object, options?: Pick<OpenAPI.ParameterObject, 'example' | 'style' | 'required'>): OpenAPI.ParameterObject[];
7
+ buildHeadersObject(jsonSchema: JSONSchema.JSONSchema & {
8
+ type: 'object';
9
+ } & object, options?: Pick<OpenAPI.ParameterObject, 'example' | 'style' | 'required'>): OpenAPI.HeadersObject;
10
+ }
11
+ export type PublicOpenAPIParametersBuilder = Pick<OpenAPIParametersBuilder, keyof OpenAPIParametersBuilder>;
12
+ //# sourceMappingURL=openapi-parameters-builder.d.ts.map
@@ -0,0 +1,8 @@
1
+ export declare class OpenAPIPathParser {
2
+ parseDynamicParams(path: string): {
3
+ name: string;
4
+ raw: string;
5
+ }[];
6
+ }
7
+ export type PublicOpenAPIPathParser = Pick<OpenAPIPathParser, keyof OpenAPIPathParser>;
8
+ //# sourceMappingURL=openapi-path-parser.d.ts.map
@@ -0,0 +1,3 @@
1
+ export { OpenApiBuilder } from 'openapi3-ts/oas31';
2
+ export type * as OpenAPI from 'openapi3-ts/oas31';
3
+ //# sourceMappingURL=openapi.d.ts.map
@@ -0,0 +1,16 @@
1
+ import type { Schema } from '@orpc/contract';
2
+ import type { JSONSchema } from './schema';
3
+ export interface SchemaConvertOptions {
4
+ strategy: 'input' | 'output';
5
+ }
6
+ export interface SchemaConverter {
7
+ condition(schema: Schema, options: SchemaConvertOptions): boolean;
8
+ convert(schema: Schema, options: SchemaConvertOptions): JSONSchema.JSONSchema;
9
+ }
10
+ export declare class CompositeSchemaConverter implements SchemaConverter {
11
+ private readonly converters;
12
+ constructor(converters: SchemaConverter[]);
13
+ condition(): boolean;
14
+ convert(schema: Schema, options: SchemaConvertOptions): JSONSchema.JSONSchema;
15
+ }
16
+ //# sourceMappingURL=schema-converter.d.ts.map
@@ -0,0 +1,11 @@
1
+ import { type FileSchema, type JSONSchema, type ObjectSchema } from './schema';
2
+ export declare class SchemaUtils {
3
+ isFileSchema(schema: JSONSchema.JSONSchema): schema is FileSchema;
4
+ isObjectSchema(schema: JSONSchema.JSONSchema): schema is ObjectSchema;
5
+ isAnySchema(schema: JSONSchema.JSONSchema): boolean;
6
+ isUndefinableSchema(schema: JSONSchema.JSONSchema): boolean;
7
+ separateObjectSchema(schema: ObjectSchema, separatedProperties: string[]): [matched: ObjectSchema, rest: ObjectSchema];
8
+ filterSchemaBranches(schema: JSONSchema.JSONSchema, check: (schema: JSONSchema.JSONSchema) => boolean, matches?: JSONSchema.JSONSchema[]): [matches: JSONSchema.JSONSchema[], rest: JSONSchema.JSONSchema | undefined];
9
+ }
10
+ export type PublicSchemaUtils = Pick<SchemaUtils, keyof SchemaUtils>;
11
+ //# sourceMappingURL=schema-utils.d.ts.map
@@ -0,0 +1,12 @@
1
+ import * as JSONSchema from 'json-schema-typed/draft-2020-12';
2
+ export { Format as JSONSchemaFormat } from 'json-schema-typed/draft-2020-12';
3
+ export { JSONSchema };
4
+ export type ObjectSchema = JSONSchema.JSONSchema & {
5
+ type: 'object';
6
+ } & object;
7
+ export type FileSchema = JSONSchema.JSONSchema & {
8
+ type: 'string';
9
+ contentMediaType: string;
10
+ } & object;
11
+ export declare const NON_LOGIC_KEYWORDS: string[];
12
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1,4 @@
1
+ import type { HTTPPath } from '@orpc/contract';
2
+ export declare function standardizeHTTPPath(path: HTTPPath): HTTPPath;
3
+ export declare function toOpenAPI31RoutePattern(path: HTTPPath): string;
4
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1,10 @@
1
+ import {
2
+ OpenAPICodec,
3
+ OpenAPIMatcher
4
+ } from "./chunk-PGCWJMRO.js";
5
+ import "./chunk-XGHV4TH3.js";
6
+ export {
7
+ OpenAPICodec,
8
+ OpenAPIMatcher
9
+ };
10
+ //# sourceMappingURL=standard.js.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.ef3ba82",
4
+ "version": "0.0.0-next.f17a1a0",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.unnoq.com",
7
7
  "repository": {
@@ -19,36 +19,57 @@
19
19
  "import": "./dist/index.js",
20
20
  "default": "./dist/index.js"
21
21
  },
22
+ "./standard": {
23
+ "types": "./dist/src/adapters/standard/index.d.ts",
24
+ "import": "./dist/standard.js",
25
+ "default": "./dist/standard.js"
26
+ },
22
27
  "./fetch": {
23
- "types": "./dist/src/fetch/index.d.ts",
28
+ "types": "./dist/src/adapters/fetch/index.d.ts",
24
29
  "import": "./dist/fetch.js",
25
30
  "default": "./dist/fetch.js"
26
31
  },
32
+ "./hono": {
33
+ "types": "./dist/src/adapters/hono/index.d.ts",
34
+ "import": "./dist/hono.js",
35
+ "default": "./dist/hono.js"
36
+ },
37
+ "./next": {
38
+ "types": "./dist/src/adapters/next/index.d.ts",
39
+ "import": "./dist/next.js",
40
+ "default": "./dist/next.js"
41
+ },
42
+ "./node": {
43
+ "types": "./dist/src/adapters/node/index.d.ts",
44
+ "import": "./dist/node.js",
45
+ "default": "./dist/node.js"
46
+ },
27
47
  "./🔒/*": {
28
48
  "types": "./dist/src/*.d.ts"
29
49
  }
30
50
  },
31
51
  "files": [
32
- "!dist/*.tsbuildinfo",
52
+ "!**/*.map",
53
+ "!**/*.tsbuildinfo",
33
54
  "dist"
34
55
  ],
35
56
  "dependencies": {
36
- "escape-string-regexp": "^5.0.0",
57
+ "@orpc/server-standard": "^0.4.0",
58
+ "@orpc/server-standard-fetch": "^0.4.0",
59
+ "@orpc/server-standard-node": "^0.4.0",
37
60
  "json-schema-typed": "^8.0.1",
38
61
  "openapi3-ts": "^4.4.0",
39
- "@orpc/contract": "0.0.0-next.ef3ba82",
40
- "@orpc/server": "0.0.0-next.ef3ba82",
41
- "@orpc/shared": "0.0.0-next.ef3ba82",
42
- "@orpc/zod": "0.0.0-next.ef3ba82",
43
- "@orpc/transformer": "0.0.0-next.ef3ba82"
62
+ "rou3": "^0.5.1",
63
+ "@orpc/client": "0.0.0-next.f17a1a0",
64
+ "@orpc/contract": "0.0.0-next.f17a1a0",
65
+ "@orpc/server": "0.0.0-next.f17a1a0",
66
+ "@orpc/shared": "0.0.0-next.f17a1a0"
44
67
  },
45
68
  "devDependencies": {
46
- "@readme/openapi-parser": "^2.6.0",
47
- "hono": "^4.6.12",
48
- "zod": "^3.23.8"
69
+ "zod": "^3.24.1"
49
70
  },
50
71
  "scripts": {
51
- "build": "tsup --clean --entry.index=src/index.ts --entry.fetch=src/fetch/index.ts --format=esm --onSuccess='tsc -b --noCheck'",
72
+ "build": "tsup --onSuccess='tsc -b --noCheck'",
52
73
  "build:watch": "pnpm run build --watch",
53
74
  "type:check": "tsc -b"
54
75
  }
@@ -1,14 +0,0 @@
1
- import type { HTTPPath } from '@orpc/contract';
2
- import type { FetchHandler } from '@orpc/server/fetch';
3
- import type { Router as HonoRouter } from 'hono/router';
4
- import { type Procedure, type Router } from '@orpc/server';
5
- export type ResolveRouter = (router: Router<any>, method: string, pathname: string) => {
6
- path: string[];
7
- procedure: Procedure<any, any, any, any, any>;
8
- params: Record<string, string>;
9
- } | undefined;
10
- type Routing = HonoRouter<[string[], Procedure<any, any, any, any, any>]>;
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 {};
@@ -1,3 +0,0 @@
1
- export * from './base-handler';
2
- export * from './server-handler';
3
- export * from './serverless-handler';
@@ -1,2 +0,0 @@
1
- import type { FetchHandler } from '@orpc/server/fetch';
2
- export declare function createOpenAPIServerHandler(): FetchHandler;
@@ -1,2 +0,0 @@
1
- import type { FetchHandler } from '@orpc/server/fetch';
2
- export declare function createOpenAPIServerlessHandler(): FetchHandler;
@@ -1,23 +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): OpenAPIObject;
@@ -1,42 +0,0 @@
1
- import { type JSONSchema } from 'json-schema-typed/draft-2020-12';
2
- import { type ZodTypeAny } from 'zod';
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: ZodTypeAny, 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
- };