@orpc/openapi 2.0.0-beta.44 → 2.0.0-beta.46
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 +100 -62
- package/dist/adapters/aws-lambda/index.d.mts +2 -1
- package/dist/adapters/aws-lambda/index.d.ts +2 -1
- package/dist/adapters/aws-lambda/index.mjs +2 -2
- package/dist/adapters/fastify/index.d.mts +1 -1
- package/dist/adapters/fastify/index.d.ts +1 -1
- package/dist/adapters/fastify/index.mjs +2 -2
- package/dist/adapters/fetch/index.d.mts +1 -1
- package/dist/adapters/fetch/index.d.ts +1 -1
- package/dist/adapters/fetch/index.mjs +3 -3
- package/dist/adapters/node/index.d.mts +1 -1
- package/dist/adapters/node/index.d.ts +1 -1
- package/dist/adapters/node/index.mjs +2 -2
- package/dist/adapters/standard/index.d.mts +43 -9
- package/dist/adapters/standard/index.d.ts +43 -9
- package/dist/adapters/standard/index.mjs +3 -3
- package/dist/index.d.mts +23 -20
- package/dist/index.d.ts +23 -20
- package/dist/index.mjs +15 -36
- package/dist/plugins/index.d.mts +12 -12
- package/dist/plugins/index.d.ts +12 -12
- package/dist/shared/{openapi.BSLqRCwO.d.mts → openapi.BCrrWRbv.d.mts} +6 -5
- package/dist/shared/{openapi.DdjvA5Xo.mjs → openapi.BNe1y1cD.mjs} +9 -4
- package/dist/shared/{openapi.r98bZ3Ig.d.ts → openapi.B_SoJfYz.d.mts} +1 -1
- package/dist/shared/{openapi.r98bZ3Ig.d.mts → openapi.B_SoJfYz.d.ts} +1 -1
- package/dist/shared/{openapi.1UQkZGBs.d.ts → openapi.BkjX_6hE.d.ts} +6 -5
- package/dist/shared/{openapi.BTq9wym2.d.mts → openapi.Covi8zVE.d.mts} +1 -1
- package/dist/shared/{openapi.BTq9wym2.d.ts → openapi.Covi8zVE.d.ts} +1 -1
- package/dist/shared/{openapi.DjMM672U.mjs → openapi.DXqJL3gB.mjs} +4 -10
- package/dist/shared/{openapi.PXVenYpE.mjs → openapi.E3ZBiweM.mjs} +12 -13
- package/dist/shared/{openapi.DjGhiceP.d.mts → openapi.YMRD3b4R.d.mts} +15 -10
- package/dist/shared/{openapi.DjGhiceP.d.ts → openapi.YMRD3b4R.d.ts} +15 -10
- package/package.json +13 -13
- package/dist/shared/openapi.BVt3NPfo.d.mts +0 -45
- package/dist/shared/openapi.aoP0G_Bv.d.ts +0 -45
|
@@ -4,7 +4,7 @@ import { StandardHandlerCodec, ResolvedStandardHandlerHandleOptions, StandardHan
|
|
|
4
4
|
import { Value, Public, Promisable } from '@orpc/shared';
|
|
5
5
|
import { StandardLazyRequest, StandardResponse } from '@standard-server/core';
|
|
6
6
|
import { AnyProcedureContract } from '@orpc/contract';
|
|
7
|
-
import { O as OpenAPISerializer } from './openapi.
|
|
7
|
+
import { O as OpenAPISerializer } from './openapi.YMRD3b4R.js';
|
|
8
8
|
|
|
9
9
|
interface OpenAPIMatcherOptions {
|
|
10
10
|
/**
|
|
@@ -12,7 +12,7 @@ interface OpenAPIMatcherOptions {
|
|
|
12
12
|
*
|
|
13
13
|
* @default true
|
|
14
14
|
*/
|
|
15
|
-
filter?: Value<boolean, [contract: AnyProcedureContract | AnyProcedure, path: string[]]
|
|
15
|
+
filter?: Value<boolean, [contract: AnyProcedureContract | AnyProcedure, path: string[]]> | undefined;
|
|
16
16
|
}
|
|
17
17
|
declare class OpenAPIMatcher {
|
|
18
18
|
private readonly filter;
|
|
@@ -38,10 +38,11 @@ interface OpenAPIHandlerCodecCoreOptions<_T extends Context> {
|
|
|
38
38
|
/**
|
|
39
39
|
* Override the default OpenAPI serializer.
|
|
40
40
|
*/
|
|
41
|
-
serializer?: Public<OpenAPISerializer
|
|
41
|
+
serializer?: Public<OpenAPISerializer> | undefined;
|
|
42
42
|
/**
|
|
43
43
|
* Mapping ORPCError Code -> HTTP Status Code
|
|
44
44
|
* The status code should be in the `4xx` or `5xx` range (must be greater than or equal to `400`).
|
|
45
|
+
* Codes missing from the map fall back to `DEFAULT_ERROR_STATUS` (400).
|
|
45
46
|
*
|
|
46
47
|
* @default COMMON_ERROR_STATUS_MAP
|
|
47
48
|
*/
|
|
@@ -55,7 +56,7 @@ interface OpenAPIHandlerCodecCoreOptions<_T extends Context> {
|
|
|
55
56
|
*
|
|
56
57
|
* @default ((e) => e.toJSON())
|
|
57
58
|
*/
|
|
58
|
-
customErrorResponseBodyEncoder?: (error: AnyORPCError) => unknown;
|
|
59
|
+
customErrorResponseBodyEncoder?: ((error: AnyORPCError) => unknown) | undefined;
|
|
59
60
|
}
|
|
60
61
|
declare class OpenAPIHandlerCodecCore<T extends Context> {
|
|
61
62
|
private readonly serializer;
|
|
@@ -64,7 +65,7 @@ declare class OpenAPIHandlerCodecCore<T extends Context> {
|
|
|
64
65
|
constructor(options?: OpenAPIHandlerCodecCoreOptions<T>);
|
|
65
66
|
decodeInput(matched: {
|
|
66
67
|
procedure: AnyProcedure;
|
|
67
|
-
params?:
|
|
68
|
+
params?: Record<string, string> | undefined;
|
|
68
69
|
}, request: StandardLazyRequest): Promise<unknown>;
|
|
69
70
|
/**
|
|
70
71
|
* @throws {TypeError} If `outputStructure` is "detailed" and the output doesn't match the expected structure.
|
|
@@ -30,4 +30,4 @@ type JsonifiedClient<T extends AnyNestedClient> = T extends Client<infer UClient
|
|
|
30
30
|
[K in keyof T]: T[K] extends AnyNestedClient ? JsonifiedClient<T[K]> : T[K];
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
export type { JsonifiedClient as J,
|
|
33
|
+
export type { JsonifiedClient as J, OpenAPIDocument as O, OpenAPIVersion as a, JsonifiedArray as b, JsonifiedClientError as c, JsonifiedValue as d };
|
|
@@ -30,4 +30,4 @@ type JsonifiedClient<T extends AnyNestedClient> = T extends Client<infer UClient
|
|
|
30
30
|
[K in keyof T]: T[K] extends AnyNestedClient ? JsonifiedClient<T[K]> : T[K];
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
export type { JsonifiedClient as J,
|
|
33
|
+
export type { JsonifiedClient as J, OpenAPIDocument as O, OpenAPIVersion as a, JsonifiedArray as b, JsonifiedClientError as c, JsonifiedValue as d };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { COMMON_ERROR_STATUS_MAP } from '@orpc/client';
|
|
2
|
-
import { walkProcedureContractsSync, unlazy,
|
|
2
|
+
import { walkProcedureContractsSync, unlazy, resolveContractProcedure, Procedure, DEFAULT_SUCCESS_STATUS, DEFAULT_ERROR_STATUS } from '@orpc/server';
|
|
3
3
|
import { value, pathToHttpPath, mergeHttpPath, safeDecodeURIComponent, safeEncodeURIComponent, setOwn, NullProtoObj, isTypescriptObject, isPlainObject, stringifyJSON, getOwn, parseEmptyableJSON } from '@orpc/shared';
|
|
4
4
|
import { parseStandardUrl } from '@standard-server/core';
|
|
5
|
-
import { D as DEFAULT_OPENAPI_METHOD, g as getDynamicPathParams, O as OpenAPISerializer, a as DEFAULT_OPENAPI_INPUT_STRUCTURE, i as isBodylessMethod, b as DEFAULT_OPENAPI_OUTPUT_STRUCTURE } from './openapi.
|
|
5
|
+
import { D as DEFAULT_OPENAPI_METHOD, g as getDynamicPathParams, O as OpenAPISerializer, a as DEFAULT_OPENAPI_INPUT_STRUCTURE, i as isBodylessMethod, b as DEFAULT_OPENAPI_OUTPUT_STRUCTURE } from './openapi.E3ZBiweM.mjs';
|
|
6
6
|
import { g as getOpenAPIMeta } from './openapi.B9PQzqBn.mjs';
|
|
7
7
|
import { createRouter, addRoute, findRoute, findAllRoutes, routeToRegExp } from 'rou3';
|
|
8
8
|
|
|
@@ -123,13 +123,7 @@ class OpenAPIMatcher {
|
|
|
123
123
|
this.pendingLazyRouters.delete(pending);
|
|
124
124
|
}
|
|
125
125
|
async resolveProcedure(entry) {
|
|
126
|
-
|
|
127
|
-
if (!(maybeProcedure instanceof Procedure)) {
|
|
128
|
-
throw new TypeError(
|
|
129
|
-
`[Contract-First] Missing or invalid implementation for procedure at path: "${entry.path.join(".")}". Ensure the procedure is correctly implemented and matches its contract.`
|
|
130
|
-
);
|
|
131
|
-
}
|
|
132
|
-
entry.procedure = createContractProcedure(maybeProcedure, entry.contract);
|
|
126
|
+
entry.procedure = await resolveContractProcedure(this.rootRouter, entry.contract, entry.path);
|
|
133
127
|
return entry.procedure;
|
|
134
128
|
}
|
|
135
129
|
}
|
|
@@ -208,7 +202,7 @@ function serializeHeaders(headers, serializer) {
|
|
|
208
202
|
return result;
|
|
209
203
|
}
|
|
210
204
|
function serializeHeaderValue(value, serializer) {
|
|
211
|
-
const serialized = serializer.
|
|
205
|
+
const serialized = serializer.serializeJson(value).json;
|
|
212
206
|
if (Array.isArray(serialized)) {
|
|
213
207
|
return serialized.filter((item) => item !== void 0 && item !== null).map(String).join(",");
|
|
214
208
|
}
|
|
@@ -117,7 +117,7 @@ class OpenAPIJsonSerializer {
|
|
|
117
117
|
this.inlineBuiltInHandlers = inlineBuiltInHandlers;
|
|
118
118
|
this.handlerEntries = handlerEntries;
|
|
119
119
|
}
|
|
120
|
-
|
|
120
|
+
serializeJson(data) {
|
|
121
121
|
const maps = [];
|
|
122
122
|
const blobs = [];
|
|
123
123
|
const json = this.serializeValue(data, [], maps, blobs);
|
|
@@ -207,7 +207,7 @@ class OpenAPIJsonSerializer {
|
|
|
207
207
|
}
|
|
208
208
|
return data;
|
|
209
209
|
}
|
|
210
|
-
|
|
210
|
+
deserializeJson(serialized) {
|
|
211
211
|
const ref = { json: serialized.json };
|
|
212
212
|
if (serialized.blobs?.length) {
|
|
213
213
|
for (let i = 0; i < serialized.maps.length; i++) {
|
|
@@ -234,12 +234,11 @@ class OpenAPIJsonSerializer {
|
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
-
class OpenAPISerializer {
|
|
238
|
-
jsonSerializer;
|
|
237
|
+
class OpenAPISerializer extends OpenAPIJsonSerializer {
|
|
239
238
|
bracketNotation;
|
|
240
239
|
defaultSerializeOptions;
|
|
241
240
|
constructor({ bracketNotation, serialize, ...options } = {}) {
|
|
242
|
-
|
|
241
|
+
super(options);
|
|
243
242
|
this.bracketNotation = new BracketNotationSerializer(bracketNotation);
|
|
244
243
|
this.defaultSerializeOptions = serialize;
|
|
245
244
|
}
|
|
@@ -254,10 +253,10 @@ class OpenAPISerializer {
|
|
|
254
253
|
if (result.value === void 0) {
|
|
255
254
|
return result;
|
|
256
255
|
}
|
|
257
|
-
return { done: result.done, value: this.
|
|
256
|
+
return { done: result.done, value: this.serializePayload(result.value, false, false) };
|
|
258
257
|
},
|
|
259
258
|
mapError: (e) => new ErrorEvent(
|
|
260
|
-
this.
|
|
259
|
+
this.serializePayload(toORPCError(e).toJSON(), false, false),
|
|
261
260
|
{ cause: e }
|
|
262
261
|
)
|
|
263
262
|
});
|
|
@@ -265,10 +264,10 @@ class OpenAPISerializer {
|
|
|
265
264
|
}
|
|
266
265
|
const useFormDataForBlobFields = options.useFormDataForBlobFields ?? this.defaultSerializeOptions?.useFormDataForBlobFields ?? true;
|
|
267
266
|
const asFormData = options.asFormData ?? this.defaultSerializeOptions?.asFormData ?? false;
|
|
268
|
-
return this.
|
|
267
|
+
return this.serializePayload(data, useFormDataForBlobFields, asFormData);
|
|
269
268
|
}
|
|
270
|
-
|
|
271
|
-
const { json, blobs } = this.
|
|
269
|
+
serializePayload(value, useFormDataForBlobFields, asFormData) {
|
|
270
|
+
const { json, blobs } = this.serializeJson(value);
|
|
272
271
|
if (!asFormData && (json instanceof Blob || json === void 0 || !blobs?.length || !useFormDataForBlobFields)) {
|
|
273
272
|
return json;
|
|
274
273
|
}
|
|
@@ -292,11 +291,11 @@ class OpenAPISerializer {
|
|
|
292
291
|
if (result.value === void 0) {
|
|
293
292
|
return result;
|
|
294
293
|
}
|
|
295
|
-
return { done: result.done, value: this.
|
|
294
|
+
return { done: result.done, value: this.deserializeJson({ json: result.value }) };
|
|
296
295
|
},
|
|
297
296
|
mapError: (e) => {
|
|
298
297
|
if (e instanceof ErrorEvent) {
|
|
299
|
-
const deserialized = this.
|
|
298
|
+
const deserialized = this.deserializeJson({ json: e.data });
|
|
300
299
|
if (isORPCErrorJson(deserialized)) {
|
|
301
300
|
return createORPCErrorFromJson(deserialized, { cause: e });
|
|
302
301
|
}
|
|
@@ -308,7 +307,7 @@ class OpenAPISerializer {
|
|
|
308
307
|
if (data instanceof URLSearchParams || data instanceof FormData) {
|
|
309
308
|
data = this.bracketNotation.deserialize(Array.from(data.entries()));
|
|
310
309
|
}
|
|
311
|
-
return this.
|
|
310
|
+
return this.deserializeJson({ json: data });
|
|
312
311
|
}
|
|
313
312
|
}
|
|
314
313
|
|
|
@@ -15,7 +15,7 @@ interface BracketNotationSerializerOptions {
|
|
|
15
15
|
*
|
|
16
16
|
* @default 1_000
|
|
17
17
|
*/
|
|
18
|
-
maxDeserializingEmptySlots?: number;
|
|
18
|
+
maxDeserializingEmptySlots?: number | undefined;
|
|
19
19
|
}
|
|
20
20
|
declare class BracketNotationSerializer {
|
|
21
21
|
private readonly maxDeserializingEmptySlots;
|
|
@@ -47,7 +47,7 @@ interface OpenAPIJsonSerializerHandler {
|
|
|
47
47
|
*
|
|
48
48
|
* @default false
|
|
49
49
|
*/
|
|
50
|
-
isTerminal?: boolean;
|
|
50
|
+
isTerminal?: boolean | undefined;
|
|
51
51
|
}
|
|
52
52
|
interface OpenAPIJsonSerializerOptions {
|
|
53
53
|
/**
|
|
@@ -93,18 +93,24 @@ interface OpenAPIJsonSerializerOptions {
|
|
|
93
93
|
*/
|
|
94
94
|
omitUndefinedProperties?: boolean | undefined;
|
|
95
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* The JSON layer behind `OpenAPISerializer`: one-way serialization of types like `Date`, `BigInt`,
|
|
98
|
+
* and `Set` into JSON-friendly values, for places that only accept JSON.
|
|
99
|
+
*
|
|
100
|
+
* @see {@link https://orpc.dev/docs/openapi/serializer#openapi-json-serializer | OpenAPI Serializer - OpenAPI JSON Serializer}
|
|
101
|
+
*/
|
|
96
102
|
declare class OpenAPIJsonSerializer {
|
|
97
103
|
private readonly inlineBuiltInHandlers;
|
|
98
104
|
private readonly handlerEntries;
|
|
99
105
|
private readonly omitUndefinedProperties;
|
|
100
106
|
constructor(options?: OpenAPIJsonSerializerOptions);
|
|
101
|
-
|
|
107
|
+
serializeJson(data: unknown): OpenAPIJsonSerialization;
|
|
102
108
|
/**
|
|
103
109
|
* `segments` is a shared mutable stack (push/pop while walking),
|
|
104
110
|
* so it must be copied before being stored in `maps`.
|
|
105
111
|
*/
|
|
106
112
|
private serializeValue;
|
|
107
|
-
|
|
113
|
+
deserializeJson(serialized: OpenAPIJsonSerialization): unknown;
|
|
108
114
|
}
|
|
109
115
|
|
|
110
116
|
interface OpenAPISerializerSerializeOptions {
|
|
@@ -114,7 +120,7 @@ interface OpenAPISerializerSerializeOptions {
|
|
|
114
120
|
*
|
|
115
121
|
* @default true
|
|
116
122
|
*/
|
|
117
|
-
useFormDataForBlobFields?: boolean;
|
|
123
|
+
useFormDataForBlobFields?: boolean | undefined;
|
|
118
124
|
/**
|
|
119
125
|
* When enabled, the serialized output is always returned as a FormData instance using bracket notation.
|
|
120
126
|
*
|
|
@@ -138,15 +144,14 @@ interface OpenAPISerializerOptions extends OpenAPIJsonSerializerOptions {
|
|
|
138
144
|
*
|
|
139
145
|
* @see {@link https://orpc.dev/docs/openapi/serializer | OpenAPI Serializer}
|
|
140
146
|
*/
|
|
141
|
-
declare class OpenAPISerializer {
|
|
142
|
-
private readonly jsonSerializer;
|
|
147
|
+
declare class OpenAPISerializer extends OpenAPIJsonSerializer {
|
|
143
148
|
private readonly bracketNotation;
|
|
144
149
|
private readonly defaultSerializeOptions;
|
|
145
150
|
constructor({ bracketNotation, serialize, ...options }?: OpenAPISerializerOptions);
|
|
146
151
|
serialize(data: unknown, options?: OpenAPISerializerSerializeOptions): StandardBody;
|
|
147
|
-
private
|
|
152
|
+
private serializePayload;
|
|
148
153
|
deserialize(data: StandardBody): unknown;
|
|
149
154
|
}
|
|
150
155
|
|
|
151
|
-
export { OpenAPISerializer as O,
|
|
152
|
-
export type { BracketNotationSerializeResult as B, BracketNotationSerializerOptions as
|
|
156
|
+
export { OpenAPISerializer as O, OpenAPIJsonSerializer as a, BracketNotationSerializer as b };
|
|
157
|
+
export type { BracketNotationSerializeResult as B, BracketNotationSerializerOptions as c, OpenAPIJsonSerialization as d, OpenAPIJsonSerializerHandler as e, OpenAPIJsonSerializerOptions as f, OpenAPISerializerOptions as g, OpenAPISerializerSerializeOptions as h };
|
|
@@ -15,7 +15,7 @@ interface BracketNotationSerializerOptions {
|
|
|
15
15
|
*
|
|
16
16
|
* @default 1_000
|
|
17
17
|
*/
|
|
18
|
-
maxDeserializingEmptySlots?: number;
|
|
18
|
+
maxDeserializingEmptySlots?: number | undefined;
|
|
19
19
|
}
|
|
20
20
|
declare class BracketNotationSerializer {
|
|
21
21
|
private readonly maxDeserializingEmptySlots;
|
|
@@ -47,7 +47,7 @@ interface OpenAPIJsonSerializerHandler {
|
|
|
47
47
|
*
|
|
48
48
|
* @default false
|
|
49
49
|
*/
|
|
50
|
-
isTerminal?: boolean;
|
|
50
|
+
isTerminal?: boolean | undefined;
|
|
51
51
|
}
|
|
52
52
|
interface OpenAPIJsonSerializerOptions {
|
|
53
53
|
/**
|
|
@@ -93,18 +93,24 @@ interface OpenAPIJsonSerializerOptions {
|
|
|
93
93
|
*/
|
|
94
94
|
omitUndefinedProperties?: boolean | undefined;
|
|
95
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* The JSON layer behind `OpenAPISerializer`: one-way serialization of types like `Date`, `BigInt`,
|
|
98
|
+
* and `Set` into JSON-friendly values, for places that only accept JSON.
|
|
99
|
+
*
|
|
100
|
+
* @see {@link https://orpc.dev/docs/openapi/serializer#openapi-json-serializer | OpenAPI Serializer - OpenAPI JSON Serializer}
|
|
101
|
+
*/
|
|
96
102
|
declare class OpenAPIJsonSerializer {
|
|
97
103
|
private readonly inlineBuiltInHandlers;
|
|
98
104
|
private readonly handlerEntries;
|
|
99
105
|
private readonly omitUndefinedProperties;
|
|
100
106
|
constructor(options?: OpenAPIJsonSerializerOptions);
|
|
101
|
-
|
|
107
|
+
serializeJson(data: unknown): OpenAPIJsonSerialization;
|
|
102
108
|
/**
|
|
103
109
|
* `segments` is a shared mutable stack (push/pop while walking),
|
|
104
110
|
* so it must be copied before being stored in `maps`.
|
|
105
111
|
*/
|
|
106
112
|
private serializeValue;
|
|
107
|
-
|
|
113
|
+
deserializeJson(serialized: OpenAPIJsonSerialization): unknown;
|
|
108
114
|
}
|
|
109
115
|
|
|
110
116
|
interface OpenAPISerializerSerializeOptions {
|
|
@@ -114,7 +120,7 @@ interface OpenAPISerializerSerializeOptions {
|
|
|
114
120
|
*
|
|
115
121
|
* @default true
|
|
116
122
|
*/
|
|
117
|
-
useFormDataForBlobFields?: boolean;
|
|
123
|
+
useFormDataForBlobFields?: boolean | undefined;
|
|
118
124
|
/**
|
|
119
125
|
* When enabled, the serialized output is always returned as a FormData instance using bracket notation.
|
|
120
126
|
*
|
|
@@ -138,15 +144,14 @@ interface OpenAPISerializerOptions extends OpenAPIJsonSerializerOptions {
|
|
|
138
144
|
*
|
|
139
145
|
* @see {@link https://orpc.dev/docs/openapi/serializer | OpenAPI Serializer}
|
|
140
146
|
*/
|
|
141
|
-
declare class OpenAPISerializer {
|
|
142
|
-
private readonly jsonSerializer;
|
|
147
|
+
declare class OpenAPISerializer extends OpenAPIJsonSerializer {
|
|
143
148
|
private readonly bracketNotation;
|
|
144
149
|
private readonly defaultSerializeOptions;
|
|
145
150
|
constructor({ bracketNotation, serialize, ...options }?: OpenAPISerializerOptions);
|
|
146
151
|
serialize(data: unknown, options?: OpenAPISerializerSerializeOptions): StandardBody;
|
|
147
|
-
private
|
|
152
|
+
private serializePayload;
|
|
148
153
|
deserialize(data: StandardBody): unknown;
|
|
149
154
|
}
|
|
150
155
|
|
|
151
|
-
export { OpenAPISerializer as O,
|
|
152
|
-
export type { BracketNotationSerializeResult as B, BracketNotationSerializerOptions as
|
|
156
|
+
export { OpenAPISerializer as O, OpenAPIJsonSerializer as a, BracketNotationSerializer as b };
|
|
157
|
+
export type { BracketNotationSerializeResult as B, BracketNotationSerializerOptions as c, OpenAPIJsonSerialization as d, OpenAPIJsonSerializerHandler as e, OpenAPIJsonSerializerOptions as f, OpenAPISerializerOptions as g, OpenAPISerializerSerializeOptions as h };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/openapi",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.46",
|
|
5
5
|
"description": "Generate OpenAPI specs from oRPC routers and serve OpenAPI-compliant APIs with end-to-end type safety",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": [
|
|
@@ -99,22 +99,22 @@
|
|
|
99
99
|
"dependencies": {
|
|
100
100
|
"@openapi-spec/downgrader": "~0.3.0",
|
|
101
101
|
"@openapi-spec/types": "~0.3.0",
|
|
102
|
-
"@orpc/client": "2.0.0-beta.
|
|
103
|
-
"@orpc/contract": "2.0.0-beta.
|
|
104
|
-
"@orpc/json-schema": "2.0.0-beta.
|
|
105
|
-
"@orpc/server": "2.0.0-beta.
|
|
106
|
-
"@orpc/shared": "2.0.0-beta.
|
|
107
|
-
"@standard-server/core": "~0.
|
|
108
|
-
"@standard-server/fetch": "~0.
|
|
102
|
+
"@orpc/client": "2.0.0-beta.46",
|
|
103
|
+
"@orpc/contract": "2.0.0-beta.46",
|
|
104
|
+
"@orpc/json-schema": "2.0.0-beta.46",
|
|
105
|
+
"@orpc/server": "2.0.0-beta.46",
|
|
106
|
+
"@orpc/shared": "2.0.0-beta.46",
|
|
107
|
+
"@standard-server/core": "~0.11.0",
|
|
108
|
+
"@standard-server/fetch": "~0.11.0",
|
|
109
109
|
"rou3": "^1.0.0"
|
|
110
110
|
},
|
|
111
111
|
"devDependencies": {
|
|
112
|
-
"@scalar/api-reference": "^1.
|
|
113
|
-
"@standard-server/aws-lambda": "~0.
|
|
112
|
+
"@scalar/api-reference": "^1.74.0",
|
|
113
|
+
"@standard-server/aws-lambda": "~0.11.0",
|
|
114
114
|
"@types/swagger-ui": "^5.32.0",
|
|
115
|
-
"fastify": "^5.12.
|
|
116
|
-
"swagger-ui": "^5.33.
|
|
117
|
-
"zod": "^4.6.
|
|
115
|
+
"fastify": "^5.12.7",
|
|
116
|
+
"swagger-ui": "^5.33.2",
|
|
117
|
+
"zod": "^4.6.7"
|
|
118
118
|
},
|
|
119
119
|
"scripts": {
|
|
120
120
|
"type:check": "tsc -b"
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { ClientContext, ClientOptions, AnyORPCError } from '@orpc/client';
|
|
2
|
-
import { StandardLinkCodec, StandardLinkCodecDecodedResponse } from '@orpc/client/standard';
|
|
3
|
-
import { RouterContract } from '@orpc/contract';
|
|
4
|
-
import { Value, Promisable, Public } from '@orpc/shared';
|
|
5
|
-
import { StandardUrl, StandardHeaders, StandardLazyResponse, StandardRequest } from '@standard-server/core';
|
|
6
|
-
import { O as OpenAPISerializer } from './openapi.DjGhiceP.mjs';
|
|
7
|
-
|
|
8
|
-
interface OpenAPILinkCodecOptions<T extends ClientContext> {
|
|
9
|
-
/**
|
|
10
|
-
* Base URL for all requests, without origin. Should match the OpenAPI handler mount path.
|
|
11
|
-
*
|
|
12
|
-
* @example '/api'
|
|
13
|
-
* @default '/'
|
|
14
|
-
*/
|
|
15
|
-
url?: Value<Promisable<StandardUrl>, [options: ClientOptions<T>, path: string[], input: unknown]>;
|
|
16
|
-
/**
|
|
17
|
-
* Inject headers into the request.
|
|
18
|
-
*/
|
|
19
|
-
headers?: Value<Promisable<StandardHeaders | Headers>, [options: ClientOptions<T>, path: string[], input: unknown]>;
|
|
20
|
-
/**
|
|
21
|
-
* Override the default OpenAPI serializer.
|
|
22
|
-
*/
|
|
23
|
-
serializer?: Public<OpenAPISerializer>;
|
|
24
|
-
/**
|
|
25
|
-
* Customize how an error response body is converted into an ORPC error.
|
|
26
|
-
* Return `null` or `undefined` to fall back to the default decoding behavior.
|
|
27
|
-
*/
|
|
28
|
-
customErrorResponseBodyDecoder?: (deserializedBody: unknown, response: StandardLazyResponse) => AnyORPCError | null | undefined;
|
|
29
|
-
}
|
|
30
|
-
declare class OpenAPILinkCodec<T extends ClientContext> implements StandardLinkCodec<T> {
|
|
31
|
-
private readonly router;
|
|
32
|
-
private readonly baseUrl;
|
|
33
|
-
private readonly headers;
|
|
34
|
-
private readonly serializer;
|
|
35
|
-
private readonly customErrorResponseBodyDecoder;
|
|
36
|
-
constructor(router: RouterContract, options?: OpenAPILinkCodecOptions<T>);
|
|
37
|
-
encodeInput(input: unknown, path: string[], options: ClientOptions<T>): Promise<StandardRequest>;
|
|
38
|
-
private encodePathParam;
|
|
39
|
-
private serializeQueryString;
|
|
40
|
-
decodeResponse(response: StandardLazyResponse, path: string[], _options: ClientOptions<T>): Promise<StandardLinkCodecDecodedResponse>;
|
|
41
|
-
private resolveProcedure;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export { OpenAPILinkCodec as a };
|
|
45
|
-
export type { OpenAPILinkCodecOptions as O };
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { ClientContext, ClientOptions, AnyORPCError } from '@orpc/client';
|
|
2
|
-
import { StandardLinkCodec, StandardLinkCodecDecodedResponse } from '@orpc/client/standard';
|
|
3
|
-
import { RouterContract } from '@orpc/contract';
|
|
4
|
-
import { Value, Promisable, Public } from '@orpc/shared';
|
|
5
|
-
import { StandardUrl, StandardHeaders, StandardLazyResponse, StandardRequest } from '@standard-server/core';
|
|
6
|
-
import { O as OpenAPISerializer } from './openapi.DjGhiceP.js';
|
|
7
|
-
|
|
8
|
-
interface OpenAPILinkCodecOptions<T extends ClientContext> {
|
|
9
|
-
/**
|
|
10
|
-
* Base URL for all requests, without origin. Should match the OpenAPI handler mount path.
|
|
11
|
-
*
|
|
12
|
-
* @example '/api'
|
|
13
|
-
* @default '/'
|
|
14
|
-
*/
|
|
15
|
-
url?: Value<Promisable<StandardUrl>, [options: ClientOptions<T>, path: string[], input: unknown]>;
|
|
16
|
-
/**
|
|
17
|
-
* Inject headers into the request.
|
|
18
|
-
*/
|
|
19
|
-
headers?: Value<Promisable<StandardHeaders | Headers>, [options: ClientOptions<T>, path: string[], input: unknown]>;
|
|
20
|
-
/**
|
|
21
|
-
* Override the default OpenAPI serializer.
|
|
22
|
-
*/
|
|
23
|
-
serializer?: Public<OpenAPISerializer>;
|
|
24
|
-
/**
|
|
25
|
-
* Customize how an error response body is converted into an ORPC error.
|
|
26
|
-
* Return `null` or `undefined` to fall back to the default decoding behavior.
|
|
27
|
-
*/
|
|
28
|
-
customErrorResponseBodyDecoder?: (deserializedBody: unknown, response: StandardLazyResponse) => AnyORPCError | null | undefined;
|
|
29
|
-
}
|
|
30
|
-
declare class OpenAPILinkCodec<T extends ClientContext> implements StandardLinkCodec<T> {
|
|
31
|
-
private readonly router;
|
|
32
|
-
private readonly baseUrl;
|
|
33
|
-
private readonly headers;
|
|
34
|
-
private readonly serializer;
|
|
35
|
-
private readonly customErrorResponseBodyDecoder;
|
|
36
|
-
constructor(router: RouterContract, options?: OpenAPILinkCodecOptions<T>);
|
|
37
|
-
encodeInput(input: unknown, path: string[], options: ClientOptions<T>): Promise<StandardRequest>;
|
|
38
|
-
private encodePathParam;
|
|
39
|
-
private serializeQueryString;
|
|
40
|
-
decodeResponse(response: StandardLazyResponse, path: string[], _options: ClientOptions<T>): Promise<StandardLinkCodecDecodedResponse>;
|
|
41
|
-
private resolveProcedure;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export { OpenAPILinkCodec as a };
|
|
45
|
-
export type { OpenAPILinkCodecOptions as O };
|