@orpc/openapi 2.0.0-beta.47 → 2.0.0-beta.49
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 +6 -7
- package/dist/adapters/aws-lambda/index.d.ts +10 -22
- package/dist/adapters/aws-lambda/index.js +1 -0
- package/dist/adapters/aws-lambda/openapi-handler.d.ts +18 -0
- package/dist/adapters/aws-lambda/openapi-handler.js +18 -0
- package/dist/adapters/fastify/index.d.ts +1 -23
- package/dist/adapters/fastify/index.js +1 -0
- package/dist/adapters/fastify/openapi-handler.d.ts +15 -0
- package/dist/adapters/fastify/openapi-handler.js +15 -0
- package/dist/adapters/fetch/index.d.ts +2 -37
- package/dist/adapters/fetch/index.js +2 -0
- package/dist/adapters/fetch/openapi-handler.d.ts +15 -0
- package/dist/adapters/fetch/openapi-handler.js +15 -0
- package/dist/adapters/fetch/openapi-link.d.ts +21 -0
- package/dist/adapters/fetch/openapi-link.js +20 -0
- package/dist/adapters/node/index.d.ts +1 -23
- package/dist/adapters/node/index.js +1 -0
- package/dist/adapters/node/openapi-handler.d.ts +15 -0
- package/dist/adapters/node/openapi-handler.js +15 -0
- package/dist/adapters/standard/index.d.ts +3 -56
- package/dist/adapters/standard/index.js +3 -0
- package/dist/adapters/standard/openapi-handler-codec.d.ts +62 -0
- package/dist/adapters/standard/openapi-handler-codec.js +220 -0
- package/dist/adapters/standard/{index.d.mts → openapi-link-codec.d.ts} +25 -19
- package/dist/adapters/standard/openapi-link-codec.js +405 -0
- package/dist/adapters/standard/openapi-matcher.d.ts +29 -0
- package/dist/adapters/standard/openapi-matcher.js +108 -0
- package/dist/adapters/standard/utils.d.ts +4 -0
- package/dist/adapters/standard/utils.js +47 -0
- package/dist/bracket-notation.d.ts +26 -0
- package/dist/bracket-notation.js +185 -0
- package/dist/client-factory.d.ts +24 -0
- package/dist/client-factory.js +13 -0
- package/dist/constants.d.ts +4 -0
- package/dist/constants.js +4 -0
- package/dist/extensions/route.d.ts +3 -7
- package/dist/extensions/route.js +12 -0
- package/dist/helpers/{index.d.mts → form-data.d.ts} +2 -4
- package/dist/helpers/form-data.js +90 -0
- package/dist/helpers/index.d.ts +1 -59
- package/dist/helpers/index.js +1 -0
- package/dist/index.d.ts +12 -165
- package/dist/index.js +11 -0
- package/dist/{shared/openapi.zGZlCOwp.d.mts → meta.d.ts} +14 -18
- package/dist/meta.js +84 -0
- package/dist/openapi-generator-components.d.ts +31 -0
- package/dist/openapi-generator-components.js +275 -0
- package/dist/openapi-generator-operation.d.ts +34 -0
- package/dist/openapi-generator-operation.js +469 -0
- package/dist/openapi-generator.d.ts +92 -0
- package/dist/openapi-generator.js +147 -0
- package/dist/openapi-json-serializer.d.ts +79 -0
- package/dist/openapi-json-serializer.js +260 -0
- package/dist/openapi-serializer.d.ts +43 -0
- package/dist/openapi-serializer.js +93 -0
- package/dist/plugins/index.d.ts +1 -121
- package/dist/plugins/index.js +1 -0
- package/dist/plugins/{index.d.mts → openapi-reference.d.ts} +15 -21
- package/dist/plugins/openapi-reference.js +187 -0
- package/dist/router-utils.d.ts +20 -0
- package/dist/router-utils.js +36 -0
- package/dist/types.d.ts +31 -0
- package/dist/types.js +1 -0
- package/dist/utils.d.ts +14 -0
- package/dist/utils.js +47 -0
- package/package.json +69 -71
- package/dist/adapters/aws-lambda/index.d.mts +0 -27
- package/dist/adapters/aws-lambda/index.mjs +0 -21
- package/dist/adapters/fastify/index.d.mts +0 -23
- package/dist/adapters/fastify/index.mjs +0 -21
- package/dist/adapters/fetch/index.d.mts +0 -37
- package/dist/adapters/fetch/index.mjs +0 -34
- package/dist/adapters/node/index.d.mts +0 -23
- package/dist/adapters/node/index.mjs +0 -21
- package/dist/adapters/standard/index.mjs +0 -12
- package/dist/extensions/route.d.mts +0 -41
- package/dist/extensions/route.mjs +0 -14
- package/dist/helpers/index.mjs +0 -39
- package/dist/index.d.mts +0 -166
- package/dist/index.mjs +0 -780
- package/dist/plugins/index.mjs +0 -167
- package/dist/shared/openapi.B9PQzqBn.mjs +0 -49
- package/dist/shared/openapi.CQkXu1nY.mjs +0 -366
- package/dist/shared/openapi.Covi8zVE.d.mts +0 -33
- package/dist/shared/openapi.Covi8zVE.d.ts +0 -33
- package/dist/shared/openapi.DfmCR1pB.d.mts +0 -94
- package/dist/shared/openapi.DtEVcxuW.mjs +0 -149
- package/dist/shared/openapi.E3ZBiweM.mjs +0 -353
- package/dist/shared/openapi.Y4K_-I5W.d.ts +0 -94
- package/dist/shared/openapi.YMRD3b4R.d.mts +0 -157
- package/dist/shared/openapi.YMRD3b4R.d.ts +0 -157
- package/dist/shared/openapi.g7ucL05o.mjs +0 -410
- package/dist/shared/openapi.zGZlCOwp.d.ts +0 -329
package/dist/index.d.mts
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import { a as OpenAPIJsonSerializer } from './shared/openapi.YMRD3b4R.mjs';
|
|
2
|
-
export { B as BracketNotationSerializeResult, b as BracketNotationSerializer, c as BracketNotationSerializerOptions, d as OpenAPIJsonSerialization, e as OpenAPIJsonSerializerHandler, f as OpenAPIJsonSerializerOptions, O as OpenAPISerializer, g as OpenAPISerializerOptions, h as OpenAPISerializerSerializeOptions } from './shared/openapi.YMRD3b4R.mjs';
|
|
3
|
-
import { ClientContext, ORPCClientOptions, ClientLink } from '@orpc/client';
|
|
4
|
-
export { COMMON_ERROR_STATUS_MAP } from '@orpc/client';
|
|
5
|
-
import { RouterContract, RouterContractClient, AnyProcedureContract, ProcedureContract } from '@orpc/contract';
|
|
6
|
-
import { J as JsonifiedClient, a as OpenAPIVersion, O as OpenAPIDocument } from './shared/openapi.Covi8zVE.mjs';
|
|
7
|
-
export { b as JsonifiedArray, c as JsonifiedClientError, d as JsonifiedValue } from './shared/openapi.Covi8zVE.mjs';
|
|
8
|
-
export { a as OpenAPIFunction, O as OpenAPIMeta, b as OpenAPIMetaPlugin, c as OpenAPIMethodMetaPlugin, d as OpenAPIPathMetaPlugin, e as OpenAPIPrefixMetaPlugin, f as OpenAPISpecMetaPlugin, g as getOpenAPIMeta, o as openapi } from './shared/openapi.zGZlCOwp.mjs';
|
|
9
|
-
import { JsonSchema, JsonSchemaConverter } from '@orpc/json-schema';
|
|
10
|
-
export { JsonSchema } from '@orpc/json-schema';
|
|
11
|
-
import { AnyRouter, AnyProcedure } from '@orpc/server';
|
|
12
|
-
import { Public, Value } from '@orpc/shared';
|
|
13
|
-
import * as OpenAPIV3_2 from '@openapi-spec/types/v3.2';
|
|
14
|
-
export { OpenAPIV3_2 };
|
|
15
|
-
export { StandardBodyHint } from '@standard-server/core';
|
|
16
|
-
import * as OpenAPIV3_0 from '@openapi-spec/types/v3.0';
|
|
17
|
-
export { OpenAPIV3_0 };
|
|
18
|
-
import * as OpenAPIV3_1 from '@openapi-spec/types/v3.1';
|
|
19
|
-
export { OpenAPIV3_1 };
|
|
20
|
-
|
|
21
|
-
interface ContractJsonifiedClientFactory<TClientContext extends ClientContext> {
|
|
22
|
-
<T extends RouterContract>(contract: T): JsonifiedClient<RouterContractClient<T, TClientContext>>;
|
|
23
|
-
}
|
|
24
|
-
interface ContractJsonifiedClientFactoryOptions<TClientContext extends ClientContext> extends Pick<ORPCClientOptions<JsonifiedClient<RouterContractClient<RouterContract, TClientContext>>>, 'interceptors' | 'scoped'> {
|
|
25
|
-
/**
|
|
26
|
-
* An optional reference to the root router-contract.
|
|
27
|
-
* When provided, the client factory will automatically register the passed contract
|
|
28
|
-
* into the router at the path defined by `meta.path`.
|
|
29
|
-
*/
|
|
30
|
-
contractRef?: RouterContract | undefined;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Like `createContractClientFactory`, but the clients it builds are typed as `JsonifiedClient`,
|
|
34
|
-
* for links that require it, such as OpenAPI Link.
|
|
35
|
-
*
|
|
36
|
-
* @remarks
|
|
37
|
-
* **Warning**: Every procedure contract passed to the factory must define `meta.path` matching its location in the root contract.
|
|
38
|
-
*
|
|
39
|
-
* @see {@link https://orpc.dev/docs/contract/client-factory | Contract Client Factory}
|
|
40
|
-
*/
|
|
41
|
-
declare function createContractJsonifiedClientFactory<TClientContext extends ClientContext>(link: ClientLink<TClientContext>, options?: ContractJsonifiedClientFactoryOptions<TClientContext>): ContractJsonifiedClientFactory<TClientContext>;
|
|
42
|
-
|
|
43
|
-
declare const DEFAULT_OPENAPI_METHOD = "POST";
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Dynamic parameters are always returned in path order.
|
|
47
|
-
*/
|
|
48
|
-
declare function getDynamicPathParams(path: `/${string}`): {
|
|
49
|
-
segment: string;
|
|
50
|
-
startIndex: number;
|
|
51
|
-
parameterName: string;
|
|
52
|
-
allowsSlash: boolean;
|
|
53
|
-
}[] | undefined;
|
|
54
|
-
|
|
55
|
-
declare class OpenAPIGeneratorError extends TypeError {
|
|
56
|
-
}
|
|
57
|
-
interface OpenAPIErrorBodyDefinition {
|
|
58
|
-
code: string;
|
|
59
|
-
defaultMessage: string | undefined;
|
|
60
|
-
dataOptional: boolean;
|
|
61
|
-
dataJsonSchema: JsonSchema;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
interface OpenAPIGeneratorOptions {
|
|
65
|
-
converters?: JsonSchemaConverter[] | undefined;
|
|
66
|
-
/**
|
|
67
|
-
* The serializer used to serialize the generated OpenAPI documentation
|
|
68
|
-
*/
|
|
69
|
-
serializer?: Public<OpenAPIJsonSerializer> | undefined;
|
|
70
|
-
}
|
|
71
|
-
interface OpenAPIGeneratorGenerateOptions<TVersion extends OpenAPIVersion> {
|
|
72
|
-
/**
|
|
73
|
-
* The OpenAPI version of the generated document.
|
|
74
|
-
* The document is generated as OpenAPI 3.2 and downgraded when an older version is requested.
|
|
75
|
-
* The minor version selects the conversion, the document carries the exact value, such as `3.1.0`.
|
|
76
|
-
*
|
|
77
|
-
* @default '3.2.0'
|
|
78
|
-
*/
|
|
79
|
-
version?: TVersion | undefined;
|
|
80
|
-
/**
|
|
81
|
-
* OpenAPI 3.2 document fields to start from, such as `info`, `servers`, or `components`.
|
|
82
|
-
* They are downgraded with the rest of the document when an older `version` is requested.
|
|
83
|
-
* The `openapi` field is derived from `version`.
|
|
84
|
-
*/
|
|
85
|
-
base?: Partial<Omit<OpenAPIV3_2.OpenAPIObject, 'openapi'>> | undefined;
|
|
86
|
-
/**
|
|
87
|
-
* Root-level `$defs` are always moved into `components.schemas`.
|
|
88
|
-
* Use this to customize the component name of a hoisted def.
|
|
89
|
-
*
|
|
90
|
-
* @remarks
|
|
91
|
-
* - The returned name is a preference, conflicting names are still postfixed (`Planet`, `PlanetInput`, `Planet2`, ...).
|
|
92
|
-
* - Return `undefined` to keep the original def name.
|
|
93
|
-
*
|
|
94
|
-
* @default defName => defName
|
|
95
|
-
*/
|
|
96
|
-
componentName?: ((defName: string, defSchema: JsonSchema) => string | undefined) | undefined;
|
|
97
|
-
/**
|
|
98
|
-
* Filter procedures. Return `false` to exclude a procedure from the OpenAPI specification.
|
|
99
|
-
*
|
|
100
|
-
* @default true
|
|
101
|
-
*/
|
|
102
|
-
filter?: Value<boolean, [contract: AnyProcedureContract | AnyProcedure, path: string[]]> | undefined;
|
|
103
|
-
/**
|
|
104
|
-
* Define a custom JSON schema for the error response body when using
|
|
105
|
-
* type-safe errors. Helps align ORPC error formatting with existing API
|
|
106
|
-
* response standards or conventions.
|
|
107
|
-
*
|
|
108
|
-
* @remarks
|
|
109
|
-
* - Return `null | undefined` to use the default error response body shaper.
|
|
110
|
-
* - The schema is an OpenAPI 3.2 Schema Object, it is downgraded with the rest of the document when an older `version` is requested.
|
|
111
|
-
*/
|
|
112
|
-
errorResponseBodySchema?: Value<JsonSchema | undefined | null, [
|
|
113
|
-
definedErrors: OpenAPIErrorBodyDefinition[],
|
|
114
|
-
status: number
|
|
115
|
-
]> | undefined;
|
|
116
|
-
/**
|
|
117
|
-
* Media type of error responses in the generated document, e.g. `application/problem+json`.
|
|
118
|
-
* Should match the handler's `errorResponseContentType`.
|
|
119
|
-
*
|
|
120
|
-
* @default 'application/json'
|
|
121
|
-
*/
|
|
122
|
-
errorResponseContentType?: string | undefined;
|
|
123
|
-
/**
|
|
124
|
-
* Mapping ORPCError Code -> HTTP Status Code
|
|
125
|
-
* Codes missing from the map fall back to `DEFAULT_ERROR_STATUS` (400).
|
|
126
|
-
*
|
|
127
|
-
* @default COMMON_ERROR_STATUS_MAP
|
|
128
|
-
*/
|
|
129
|
-
errorStatusMap?: Record<string, number> | undefined;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Generates an OpenAPI document from a contract or router.
|
|
133
|
-
* Relies on JSON schema converters to translate input, output, and error schemas into JSON Schemas.
|
|
134
|
-
*
|
|
135
|
-
* @see {@link https://orpc.dev/docs/openapi/specification#openapi-generator | OpenAPI Specification - OpenAPI Generator}
|
|
136
|
-
*/
|
|
137
|
-
declare class OpenAPIGenerator {
|
|
138
|
-
private readonly serializer;
|
|
139
|
-
private readonly converter;
|
|
140
|
-
constructor(options?: OpenAPIGeneratorOptions);
|
|
141
|
-
generate<TVersion extends OpenAPIVersion = '3.2.0'>(router: RouterContract | AnyRouter, options?: OpenAPIGeneratorGenerateOptions<TVersion>): Promise<OpenAPIDocument<TVersion>>;
|
|
142
|
-
private convertSchema;
|
|
143
|
-
private convertSchemas;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
type PopulatedContractRouterOpenAPIPaths<T extends RouterContract> = T extends ProcedureContract<infer UInputSchema, infer UOutputSchema, infer UErrors> ? ProcedureContract<UInputSchema, UOutputSchema, UErrors> : {
|
|
147
|
-
[K in keyof T]: T[K] extends RouterContract ? PopulatedContractRouterOpenAPIPaths<T[K]> : never;
|
|
148
|
-
};
|
|
149
|
-
interface PopulateRouterContractOpenAPIPathsOptions {
|
|
150
|
-
/**
|
|
151
|
-
* Base path segments.
|
|
152
|
-
*/
|
|
153
|
-
path?: string[] | undefined;
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Automatically populates missing openapi.path using router structure.
|
|
157
|
-
*
|
|
158
|
-
* Builds paths by joining router keys with `/`.
|
|
159
|
-
* Useful when you want to ensure all contracts define openapi.path, such as for NestJS integration requirements.
|
|
160
|
-
*
|
|
161
|
-
* @see {@link https://orpc.dev/docs/integrations/nest | Implement oRPC contract with NestJS}
|
|
162
|
-
*/
|
|
163
|
-
declare function populateRouterContractOpenAPIPaths<T extends RouterContract>(router: T, options?: PopulateRouterContractOpenAPIPathsOptions): PopulatedContractRouterOpenAPIPaths<T>;
|
|
164
|
-
|
|
165
|
-
export { DEFAULT_OPENAPI_METHOD, JsonifiedClient, OpenAPIDocument, OpenAPIGenerator, OpenAPIGeneratorError, OpenAPIJsonSerializer, OpenAPIVersion, createContractJsonifiedClientFactory, getDynamicPathParams, populateRouterContractOpenAPIPaths };
|
|
166
|
-
export type { ContractJsonifiedClientFactory, ContractJsonifiedClientFactoryOptions, OpenAPIErrorBodyDefinition, OpenAPIGeneratorGenerateOptions, OpenAPIGeneratorOptions, PopulateRouterContractOpenAPIPathsOptions, PopulatedContractRouterOpenAPIPaths };
|