@hey-api/openapi-ts 0.86.11 → 0.86.12
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/dist/clients/angular/types.ts +2 -2
- package/dist/clients/axios/types.ts +2 -2
- package/dist/clients/core/params.ts +34 -11
- package/dist/clients/fetch/types.ts +2 -2
- package/dist/clients/next/types.ts +2 -2
- package/dist/clients/nuxt/types.ts +1 -1
- package/dist/clients/ofetch/types.ts +2 -2
- package/dist/getSpec-1BMHZkPH.js +25 -0
- package/dist/getSpec-1BMHZkPH.js.map +1 -0
- package/dist/getSpec-xn4as4li.cjs +25 -0
- package/dist/getSpec-xn4as4li.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +134 -130
- package/dist/index.d.ts +9 -877
- package/dist/index.js +1 -1
- package/dist/internal.cjs +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -1
- package/dist/run.cjs +1 -1
- package/dist/run.cjs.map +1 -1
- package/dist/run.js +1 -1
- package/dist/run.js.map +1 -1
- package/dist/{src-C4Q2-7Ic.js → src-CQ_69Vcm.js} +2 -2
- package/dist/src-CQ_69Vcm.js.map +1 -0
- package/dist/{src-Cu5Xi-FZ.cjs → src-DptUs1Ky.cjs} +2 -2
- package/dist/src-DptUs1Ky.cjs.map +1 -0
- package/dist/{types-CFT9BYmF.d.ts → types-BRmx9r9T.d.ts} +2709 -1819
- package/dist/{types-Bxdq98WE.d.cts → types-Dh80P1tV.d.cts} +8252 -8232
- package/package.json +2 -2
- package/dist/getSpec-NJ6vig64.js +0 -25
- package/dist/getSpec-NJ6vig64.js.map +0 -1
- package/dist/getSpec-ekNG3x72.cjs +0 -25
- package/dist/getSpec-ekNG3x72.cjs.map +0 -1
- package/dist/src-C4Q2-7Ic.js.map +0 -1
- package/dist/src-Cu5Xi-FZ.cjs.map +0 -1
|
@@ -201,7 +201,7 @@ type BuildUrlFn = <
|
|
|
201
201
|
url: string;
|
|
202
202
|
},
|
|
203
203
|
>(
|
|
204
|
-
options:
|
|
204
|
+
options: TData & Options<TData>,
|
|
205
205
|
) => string;
|
|
206
206
|
|
|
207
207
|
export type Client = CoreClient<
|
|
@@ -251,7 +251,7 @@ export type Options<
|
|
|
251
251
|
RequestOptions<TResponse, TResponseStyle, ThrowOnError>,
|
|
252
252
|
'body' | 'path' | 'query' | 'url'
|
|
253
253
|
> &
|
|
254
|
-
Omit<TData, 'url'
|
|
254
|
+
([TData] extends [never] ? unknown : Omit<TData, 'url'>);
|
|
255
255
|
|
|
256
256
|
export type OptionsLegacyParser<
|
|
257
257
|
TData = unknown,
|
|
@@ -149,7 +149,7 @@ type BuildUrlFn = <
|
|
|
149
149
|
url: string;
|
|
150
150
|
},
|
|
151
151
|
>(
|
|
152
|
-
options:
|
|
152
|
+
options: TData & Options<TData>,
|
|
153
153
|
) => string;
|
|
154
154
|
|
|
155
155
|
export type Client = CoreClient<
|
|
@@ -192,7 +192,7 @@ export type Options<
|
|
|
192
192
|
RequestOptions<TResponse, ThrowOnError>,
|
|
193
193
|
'body' | 'path' | 'query' | 'url'
|
|
194
194
|
> &
|
|
195
|
-
Omit<TData, 'url'
|
|
195
|
+
([TData] extends [never] ? unknown : Omit<TData, 'url'>);
|
|
196
196
|
|
|
197
197
|
export type OptionsLegacyParser<
|
|
198
198
|
TData = unknown,
|
|
@@ -20,6 +20,17 @@ export type Field =
|
|
|
20
20
|
*/
|
|
21
21
|
key?: string;
|
|
22
22
|
map?: string;
|
|
23
|
+
}
|
|
24
|
+
| {
|
|
25
|
+
/**
|
|
26
|
+
* Field name. This is the name we want the user to see and use.
|
|
27
|
+
*/
|
|
28
|
+
key: string;
|
|
29
|
+
/**
|
|
30
|
+
* Field mapped name. This is the name we want to use in the request.
|
|
31
|
+
* If `in` is omitted, `map` aliases `key` to the transport layer.
|
|
32
|
+
*/
|
|
33
|
+
map: Slot;
|
|
23
34
|
};
|
|
24
35
|
|
|
25
36
|
export interface Fields {
|
|
@@ -39,10 +50,14 @@ const extraPrefixes = Object.entries(extraPrefixesMap);
|
|
|
39
50
|
|
|
40
51
|
type KeyMap = Map<
|
|
41
52
|
string,
|
|
42
|
-
{
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
53
|
+
| {
|
|
54
|
+
in: Slot;
|
|
55
|
+
map?: string;
|
|
56
|
+
}
|
|
57
|
+
| {
|
|
58
|
+
in?: never;
|
|
59
|
+
map: Slot;
|
|
60
|
+
}
|
|
46
61
|
>;
|
|
47
62
|
|
|
48
63
|
const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => {
|
|
@@ -58,6 +73,10 @@ const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => {
|
|
|
58
73
|
map: config.map,
|
|
59
74
|
});
|
|
60
75
|
}
|
|
76
|
+
} else if ('key' in config) {
|
|
77
|
+
map.set(config.key, {
|
|
78
|
+
map: config.map,
|
|
79
|
+
});
|
|
61
80
|
} else if (config.args) {
|
|
62
81
|
buildKeyMap(config.args, map);
|
|
63
82
|
}
|
|
@@ -109,7 +128,9 @@ export const buildClientParams = (
|
|
|
109
128
|
if (config.key) {
|
|
110
129
|
const field = map.get(config.key)!;
|
|
111
130
|
const name = field.map || config.key;
|
|
112
|
-
(
|
|
131
|
+
if (field.in) {
|
|
132
|
+
(params[field.in] as Record<string, unknown>)[name] = arg;
|
|
133
|
+
}
|
|
113
134
|
} else {
|
|
114
135
|
params.body = arg;
|
|
115
136
|
}
|
|
@@ -118,8 +139,12 @@ export const buildClientParams = (
|
|
|
118
139
|
const field = map.get(key);
|
|
119
140
|
|
|
120
141
|
if (field) {
|
|
121
|
-
|
|
122
|
-
|
|
142
|
+
if (field.in) {
|
|
143
|
+
const name = field.map || key;
|
|
144
|
+
(params[field.in] as Record<string, unknown>)[name] = value;
|
|
145
|
+
} else {
|
|
146
|
+
params[field.map] = value;
|
|
147
|
+
}
|
|
123
148
|
} else {
|
|
124
149
|
const extra = extraPrefixes.find(([prefix]) =>
|
|
125
150
|
key.startsWith(prefix),
|
|
@@ -130,10 +155,8 @@ export const buildClientParams = (
|
|
|
130
155
|
(params[slot] as Record<string, unknown>)[
|
|
131
156
|
key.slice(prefix.length)
|
|
132
157
|
] = value;
|
|
133
|
-
} else {
|
|
134
|
-
for (const [slot, allowed] of Object.entries(
|
|
135
|
-
config.allowExtra ?? {},
|
|
136
|
-
)) {
|
|
158
|
+
} else if ('allowExtra' in config && config.allowExtra) {
|
|
159
|
+
for (const [slot, allowed] of Object.entries(config.allowExtra)) {
|
|
137
160
|
if (allowed) {
|
|
138
161
|
(params[slot as Slot] as Record<string, unknown>)[key] = value;
|
|
139
162
|
break;
|
|
@@ -192,7 +192,7 @@ type BuildUrlFn = <
|
|
|
192
192
|
url: string;
|
|
193
193
|
},
|
|
194
194
|
>(
|
|
195
|
-
options:
|
|
195
|
+
options: TData & Options<TData>,
|
|
196
196
|
) => string;
|
|
197
197
|
|
|
198
198
|
export type Client = CoreClient<
|
|
@@ -236,7 +236,7 @@ export type Options<
|
|
|
236
236
|
RequestOptions<TResponse, TResponseStyle, ThrowOnError>,
|
|
237
237
|
'body' | 'path' | 'query' | 'url'
|
|
238
238
|
> &
|
|
239
|
-
Omit<TData, 'url'
|
|
239
|
+
([TData] extends [never] ? unknown : Omit<TData, 'url'>);
|
|
240
240
|
|
|
241
241
|
export type OptionsLegacyParser<
|
|
242
242
|
TData = unknown,
|
|
@@ -150,7 +150,7 @@ type BuildUrlFn = <
|
|
|
150
150
|
url: string;
|
|
151
151
|
},
|
|
152
152
|
>(
|
|
153
|
-
options:
|
|
153
|
+
options: TData & Options<TData>,
|
|
154
154
|
) => string;
|
|
155
155
|
|
|
156
156
|
export type Client = CoreClient<
|
|
@@ -193,7 +193,7 @@ export type Options<
|
|
|
193
193
|
RequestOptions<TResponse, ThrowOnError>,
|
|
194
194
|
'body' | 'path' | 'query' | 'url'
|
|
195
195
|
> &
|
|
196
|
-
Omit<TData, 'url'
|
|
196
|
+
([TData] extends [never] ? unknown : Omit<TData, 'url'>);
|
|
197
197
|
|
|
198
198
|
export type OptionsLegacyParser<
|
|
199
199
|
TData = unknown,
|
|
@@ -187,7 +187,7 @@ export type Options<
|
|
|
187
187
|
RequestOptions<TComposable, ResT, DefaultT>,
|
|
188
188
|
'body' | 'path' | 'query' | 'url'
|
|
189
189
|
> &
|
|
190
|
-
WithRefs<Omit<TData, 'url'
|
|
190
|
+
([TData] extends [never] ? unknown : WithRefs<Omit<TData, 'url'>>);
|
|
191
191
|
|
|
192
192
|
export type OptionsLegacyParser<TData = unknown> = TData extends { body?: any }
|
|
193
193
|
? TData extends { headers?: any }
|
|
@@ -259,7 +259,7 @@ type BuildUrlFn = <
|
|
|
259
259
|
url: string;
|
|
260
260
|
},
|
|
261
261
|
>(
|
|
262
|
-
options:
|
|
262
|
+
options: TData & Options<TData>,
|
|
263
263
|
) => string;
|
|
264
264
|
|
|
265
265
|
export type Client = CoreClient<
|
|
@@ -303,7 +303,7 @@ export type Options<
|
|
|
303
303
|
RequestOptions<TResponse, TResponseStyle, ThrowOnError>,
|
|
304
304
|
'body' | 'path' | 'query' | 'url'
|
|
305
305
|
> &
|
|
306
|
-
Omit<TData, 'url'
|
|
306
|
+
([TData] extends [never] ? unknown : Omit<TData, 'url'>);
|
|
307
307
|
|
|
308
308
|
export type OptionsLegacyParser<
|
|
309
309
|
TData = unknown,
|