@orpc/openapi 0.42.0 → 0.44.0
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 +1 -1
- package/dist/adapters/fetch/index.d.mts +14 -0
- package/dist/adapters/fetch/index.d.ts +14 -0
- package/dist/adapters/fetch/index.mjs +10 -0
- package/dist/adapters/hono/index.d.mts +7 -0
- package/dist/adapters/hono/index.d.ts +7 -0
- package/dist/adapters/hono/index.mjs +10 -0
- package/dist/adapters/next/index.d.mts +7 -0
- package/dist/adapters/next/index.d.ts +7 -0
- package/dist/adapters/next/index.mjs +10 -0
- package/dist/adapters/node/index.d.mts +14 -0
- package/dist/adapters/node/index.d.ts +14 -0
- package/dist/adapters/node/index.mjs +29 -0
- package/dist/adapters/standard/index.d.mts +24 -0
- package/dist/adapters/standard/index.d.ts +24 -0
- package/dist/adapters/standard/index.mjs +7 -0
- package/dist/index.d.mts +169 -0
- package/dist/index.d.ts +169 -0
- package/dist/{index.js → index.mjs} +46 -86
- package/dist/{chunk-XGHV4TH3.js → shared/openapi.BHG_gu5Z.mjs} +1 -6
- package/dist/{chunk-PGCWJMRO.js → shared/openapi.CDsfPHgw.mjs} +12 -21
- package/dist/{chunk-ATDLVTJE.js → shared/openapi.D0VMNR6V.mjs} +9 -16
- package/dist/shared/openapi.Dz_6xooR.d.mts +7 -0
- package/dist/shared/openapi.Dz_6xooR.d.ts +7 -0
- package/package.json +28 -32
- package/dist/fetch.js +0 -9
- package/dist/hono.js +0 -9
- package/dist/next.js +0 -9
- package/dist/node.js +0 -30
- package/dist/src/adapters/fetch/index.d.ts +0 -2
- package/dist/src/adapters/fetch/openapi-handler.d.ts +0 -11
- package/dist/src/adapters/hono/index.d.ts +0 -2
- package/dist/src/adapters/next/index.d.ts +0 -2
- package/dist/src/adapters/node/index.d.ts +0 -2
- package/dist/src/adapters/node/openapi-handler.d.ts +0 -11
- package/dist/src/adapters/standard/index.d.ts +0 -4
- package/dist/src/adapters/standard/openapi-codec.d.ts +0 -13
- package/dist/src/adapters/standard/openapi-handler.d.ts +0 -5
- package/dist/src/adapters/standard/openapi-matcher.d.ts +0 -10
- package/dist/src/index.d.ts +0 -16
- package/dist/src/openapi-content-builder.d.ts +0 -10
- package/dist/src/openapi-error.d.ts +0 -3
- package/dist/src/openapi-generator.d.ts +0 -67
- package/dist/src/openapi-input-structure-parser.d.ts +0 -22
- package/dist/src/openapi-operation-extender.d.ts +0 -7
- package/dist/src/openapi-output-structure-parser.d.ts +0 -18
- package/dist/src/openapi-parameters-builder.d.ts +0 -12
- package/dist/src/openapi-path-parser.d.ts +0 -8
- package/dist/src/openapi.d.ts +0 -3
- package/dist/src/schema-converter.d.ts +0 -16
- package/dist/src/schema-utils.d.ts +0 -11
- package/dist/src/schema.d.ts +0 -12
- package/dist/src/utils.d.ts +0 -4
- package/dist/standard.js +0 -10
@@ -1,10 +0,0 @@
|
|
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
|
@@ -1,67 +0,0 @@
|
|
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
|
@@ -1,22 +0,0 @@
|
|
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
|
@@ -1,7 +0,0 @@
|
|
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
|
@@ -1,18 +0,0 @@
|
|
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
|
@@ -1,12 +0,0 @@
|
|
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
|
package/dist/src/openapi.d.ts
DELETED
@@ -1,16 +0,0 @@
|
|
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
|
@@ -1,11 +0,0 @@
|
|
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
|
package/dist/src/schema.d.ts
DELETED
@@ -1,12 +0,0 @@
|
|
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
|
package/dist/src/utils.d.ts
DELETED