@hey-api/openapi-ts 0.74.0 → 0.76.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/bin/index.cjs +7 -1
- package/dist/chunk-W3E6ZK5Y.js +39 -0
- package/dist/chunk-W3E6ZK5Y.js.map +1 -0
- package/dist/clients/core/bodySerializer.ts +1 -1
- package/dist/clients/fetch/client.ts +16 -8
- package/dist/clients/fetch/types.ts +8 -1
- package/dist/clients/fetch/utils.ts +2 -0
- package/dist/clients/next/client.ts +14 -6
- package/dist/clients/next/types.ts +8 -1
- package/dist/clients/next/utils.ts +2 -0
- package/dist/index.cjs +59 -59
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +10 -10
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +2 -2
- package/dist/internal.d.ts +2 -2
- package/dist/internal.js +1 -1
- package/dist/{types.d-jQzOw4mx.d.cts → types.d-CMe37_rr.d.cts} +739 -190
- package/dist/{types.d-jQzOw4mx.d.ts → types.d-CMe37_rr.d.ts} +739 -190
- package/package.json +1 -1
- package/dist/chunk-WELTPW5K.js +0 -39
- package/dist/chunk-WELTPW5K.js.map +0 -1
|
@@ -57,7 +57,7 @@ export const formDataBodySerializer = {
|
|
|
57
57
|
|
|
58
58
|
export const jsonBodySerializer = {
|
|
59
59
|
bodySerializer: <T>(body: T) =>
|
|
60
|
-
JSON.stringify(body, (
|
|
60
|
+
JSON.stringify(body, (_key, value) =>
|
|
61
61
|
typeof value === 'bigint' ? value.toString() : value,
|
|
62
62
|
),
|
|
63
63
|
};
|
|
@@ -103,16 +103,24 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
103
103
|
? getParseAs(response.headers.get('Content-Type'))
|
|
104
104
|
: opts.parseAs) ?? 'json';
|
|
105
105
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
106
|
+
let data: any;
|
|
107
|
+
switch (parseAs) {
|
|
108
|
+
case 'arrayBuffer':
|
|
109
|
+
case 'blob':
|
|
110
|
+
case 'formData':
|
|
111
|
+
case 'json':
|
|
112
|
+
case 'text':
|
|
113
|
+
data = await response[parseAs]();
|
|
114
|
+
break;
|
|
115
|
+
case 'stream':
|
|
116
|
+
return opts.responseStyle === 'data'
|
|
117
|
+
? response.body
|
|
118
|
+
: {
|
|
119
|
+
data: response.body,
|
|
120
|
+
...result,
|
|
121
|
+
};
|
|
113
122
|
}
|
|
114
123
|
|
|
115
|
-
let data = await response[parseAs]();
|
|
116
124
|
if (parseAs === 'json') {
|
|
117
125
|
if (opts.responseValidator) {
|
|
118
126
|
await opts.responseValidator(data);
|
|
@@ -36,7 +36,14 @@ export interface Config<T extends ClientOptions = ClientOptions>
|
|
|
36
36
|
*
|
|
37
37
|
* @default 'auto'
|
|
38
38
|
*/
|
|
39
|
-
parseAs?:
|
|
39
|
+
parseAs?:
|
|
40
|
+
| 'arrayBuffer'
|
|
41
|
+
| 'auto'
|
|
42
|
+
| 'blob'
|
|
43
|
+
| 'formData'
|
|
44
|
+
| 'json'
|
|
45
|
+
| 'stream'
|
|
46
|
+
| 'text';
|
|
40
47
|
/**
|
|
41
48
|
* Should we return only data or multiple fields (data, error, response, etc.)?
|
|
42
49
|
*
|
|
@@ -92,14 +92,22 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
92
92
|
? getParseAs(response.headers.get('Content-Type'))
|
|
93
93
|
: opts.parseAs) ?? 'json';
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
95
|
+
let data: any;
|
|
96
|
+
switch (parseAs) {
|
|
97
|
+
case 'arrayBuffer':
|
|
98
|
+
case 'blob':
|
|
99
|
+
case 'formData':
|
|
100
|
+
case 'json':
|
|
101
|
+
case 'text':
|
|
102
|
+
data = await response[parseAs]();
|
|
103
|
+
break;
|
|
104
|
+
case 'stream':
|
|
105
|
+
return {
|
|
106
|
+
data: response.body,
|
|
107
|
+
...result,
|
|
108
|
+
};
|
|
100
109
|
}
|
|
101
110
|
|
|
102
|
-
let data = await response[parseAs]();
|
|
103
111
|
if (parseAs === 'json') {
|
|
104
112
|
if (opts.responseValidator) {
|
|
105
113
|
await opts.responseValidator(data);
|
|
@@ -27,7 +27,14 @@ export interface Config<T extends ClientOptions = ClientOptions>
|
|
|
27
27
|
*
|
|
28
28
|
* @default 'auto'
|
|
29
29
|
*/
|
|
30
|
-
parseAs?:
|
|
30
|
+
parseAs?:
|
|
31
|
+
| 'arrayBuffer'
|
|
32
|
+
| 'auto'
|
|
33
|
+
| 'blob'
|
|
34
|
+
| 'formData'
|
|
35
|
+
| 'json'
|
|
36
|
+
| 'stream'
|
|
37
|
+
| 'text';
|
|
31
38
|
/**
|
|
32
39
|
* Throw an error instead of returning it in the response?
|
|
33
40
|
*
|