@orpc/openapi 0.0.0-next.fd1db03 → 0.0.0-next.fd6982a
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 +105 -0
- package/dist/index.d.ts +105 -0
- package/dist/index.mjs +41 -0
- package/dist/plugins/index.d.mts +70 -0
- package/dist/plugins/index.d.ts +70 -0
- package/dist/plugins/index.mjs +108 -0
- package/dist/shared/openapi.C_UtQ8Us.mjs +179 -0
- package/dist/shared/openapi.CwdCLgSU.d.mts +53 -0
- package/dist/shared/openapi.CwdCLgSU.d.ts +53 -0
- package/dist/shared/openapi.D3j94c9n.d.mts +12 -0
- package/dist/shared/openapi.D3j94c9n.d.ts +12 -0
- package/dist/shared/openapi.PDTdnRIU.mjs +595 -0
- package/package.json +36 -25
- package/dist/chunk-KNYXLM77.js +0 -107
- package/dist/fetch.js +0 -661
- package/dist/index.js +0 -481
- package/dist/src/fetch/bracket-notation.d.ts +0 -84
- package/dist/src/fetch/index.d.ts +0 -10
- package/dist/src/fetch/input-structure-compact.d.ts +0 -6
- package/dist/src/fetch/input-structure-detailed.d.ts +0 -11
- package/dist/src/fetch/openapi-handler-server.d.ts +0 -7
- package/dist/src/fetch/openapi-handler-serverless.d.ts +0 -7
- package/dist/src/fetch/openapi-handler.d.ts +0 -33
- package/dist/src/fetch/openapi-payload-codec.d.ts +0 -15
- package/dist/src/fetch/openapi-procedure-matcher.d.ts +0 -19
- package/dist/src/fetch/schema-coercer.d.ts +0 -10
- package/dist/src/index.d.ts +0 -12
- package/dist/src/json-serializer.d.ts +0 -5
- 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 -56
- package/dist/src/openapi-input-structure-parser.d.ts +0 -22
- 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 -18
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Schema } from '@orpc/contract';
|
|
2
|
-
export interface SchemaCoercer {
|
|
3
|
-
coerce: (schema: Schema, value: unknown) => unknown;
|
|
4
|
-
}
|
|
5
|
-
export declare class CompositeSchemaCoercer implements SchemaCoercer {
|
|
6
|
-
private readonly coercers;
|
|
7
|
-
constructor(coercers: SchemaCoercer[]);
|
|
8
|
-
coerce(schema: Schema, value: unknown): unknown;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=schema-coercer.d.ts.map
|
package/dist/src/index.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/** unnoq */
|
|
2
|
-
export * from './json-serializer';
|
|
3
|
-
export * from './openapi';
|
|
4
|
-
export * from './openapi-content-builder';
|
|
5
|
-
export * from './openapi-generator';
|
|
6
|
-
export * from './openapi-parameters-builder';
|
|
7
|
-
export * from './openapi-path-parser';
|
|
8
|
-
export * from './schema';
|
|
9
|
-
export * from './schema-converter';
|
|
10
|
-
export * from './schema-utils';
|
|
11
|
-
export * from './utils';
|
|
12
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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,56 +0,0 @@
|
|
|
1
|
-
import type { ContractRouter } from '@orpc/contract';
|
|
2
|
-
import type { ANY_ROUTER } from '@orpc/server';
|
|
3
|
-
import type { PublicOpenAPIInputStructureParser } from './openapi-input-structure-parser';
|
|
4
|
-
import type { PublicOpenAPIOutputStructureParser } from './openapi-output-structure-parser';
|
|
5
|
-
import type { PublicOpenAPIPathParser } from './openapi-path-parser';
|
|
6
|
-
import type { SchemaConverter } from './schema-converter';
|
|
7
|
-
import { type PublicJSONSerializer } from './json-serializer';
|
|
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
|
-
export interface OpenAPIGeneratorOptions {
|
|
13
|
-
contentBuilder?: PublicOpenAPIContentBuilder;
|
|
14
|
-
parametersBuilder?: PublicOpenAPIParametersBuilder;
|
|
15
|
-
schemaConverters?: SchemaConverter[];
|
|
16
|
-
schemaUtils?: PublicSchemaUtils;
|
|
17
|
-
jsonSerializer?: PublicJSONSerializer;
|
|
18
|
-
pathParser?: PublicOpenAPIPathParser;
|
|
19
|
-
inputStructureParser?: PublicOpenAPIInputStructureParser;
|
|
20
|
-
outputStructureParser?: PublicOpenAPIOutputStructureParser;
|
|
21
|
-
/**
|
|
22
|
-
* Throw error when you missing define tag definition on OpenAPI root tags
|
|
23
|
-
*
|
|
24
|
-
* Example: if procedure has tags ['foo', 'bar'], and OpenAPI root tags is ['foo'], then error will be thrown
|
|
25
|
-
* Because OpenAPI root tags is missing 'bar' tag
|
|
26
|
-
*
|
|
27
|
-
* @default false
|
|
28
|
-
*/
|
|
29
|
-
considerMissingTagDefinitionAsError?: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Weather ignore procedures that has no path defined.
|
|
32
|
-
*
|
|
33
|
-
* @default false
|
|
34
|
-
*/
|
|
35
|
-
ignoreUndefinedPathProcedures?: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Throw error when you have error in OpenAPI generator
|
|
38
|
-
*
|
|
39
|
-
* @default false
|
|
40
|
-
*/
|
|
41
|
-
throwOnError?: boolean;
|
|
42
|
-
}
|
|
43
|
-
export declare class OpenAPIGenerator {
|
|
44
|
-
private readonly options?;
|
|
45
|
-
private readonly contentBuilder;
|
|
46
|
-
private readonly parametersBuilder;
|
|
47
|
-
private readonly schemaConverter;
|
|
48
|
-
private readonly schemaUtils;
|
|
49
|
-
private readonly jsonSerializer;
|
|
50
|
-
private readonly pathParser;
|
|
51
|
-
private readonly inputStructureParser;
|
|
52
|
-
private readonly outputStructureParser;
|
|
53
|
-
constructor(options?: OpenAPIGeneratorOptions | undefined);
|
|
54
|
-
generate(router: ContractRouter | ANY_ROUTER, doc: Omit<OpenAPI.OpenAPIObject, 'openapi'>): Promise<OpenAPI.OpenAPIObject>;
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=openapi-generator.d.ts.map
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { ANY_CONTRACT_PROCEDURE } 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: ANY_CONTRACT_PROCEDURE, 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,18 +0,0 @@
|
|
|
1
|
-
import type { ANY_CONTRACT_PROCEDURE } 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: ANY_CONTRACT_PROCEDURE, 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: ("$anchor" | "$comment" | "$defs" | "$dynamicAnchor" | "$dynamicRef" | "$id" | "$schema" | "$vocabulary" | "contentEncoding" | "contentMediaType" | "default" | "definitions" | "deprecated" | "description" | "examples" | "format" | "readOnly" | "title" | "writeOnly")[];
|
|
12
|
-
//# sourceMappingURL=schema.d.ts.map
|
package/dist/src/utils.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { ContractRouter, HTTPPath, WELL_CONTRACT_PROCEDURE } from '@orpc/contract';
|
|
2
|
-
import type { ANY_PROCEDURE, ANY_ROUTER, Lazy } from '@orpc/server';
|
|
3
|
-
export interface EachLeafOptions {
|
|
4
|
-
router: ContractRouter | ANY_ROUTER;
|
|
5
|
-
path: string[];
|
|
6
|
-
}
|
|
7
|
-
export interface EachLeafCallbackOptions {
|
|
8
|
-
contract: WELL_CONTRACT_PROCEDURE;
|
|
9
|
-
path: string[];
|
|
10
|
-
}
|
|
11
|
-
export interface EachContractLeafResultItem {
|
|
12
|
-
router: Lazy<ANY_PROCEDURE> | Lazy<Record<string, ANY_ROUTER> | ANY_PROCEDURE>;
|
|
13
|
-
path: string[];
|
|
14
|
-
}
|
|
15
|
-
export declare function forEachContractProcedure(options: EachLeafOptions, callback: (options: EachLeafCallbackOptions) => void, result?: EachContractLeafResultItem[], isCurrentRouterContract?: boolean): EachContractLeafResultItem[];
|
|
16
|
-
export declare function forEachAllContractProcedure(router: ContractRouter | ANY_ROUTER, callback: (options: EachLeafCallbackOptions) => void): Promise<void>;
|
|
17
|
-
export declare function standardizeHTTPPath(path: HTTPPath): HTTPPath;
|
|
18
|
-
//# sourceMappingURL=utils.d.ts.map
|