@cloudfleet/sdk 0.0.1-ed50a15 → 0.0.1-ef41cb3
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/client/client.gen.d.ts +3 -0
- package/dist/client/client.gen.d.ts.map +1 -0
- package/dist/client/{client.js → client.gen.js} +82 -23
- package/dist/client/client.gen.js.map +1 -0
- package/dist/client/index.d.ts +8 -7
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +6 -4
- package/dist/client/index.js.map +1 -1
- package/dist/client/{types.d.ts → types.gen.d.ts} +19 -14
- package/dist/client/types.gen.d.ts.map +1 -0
- package/dist/client/types.gen.js +3 -0
- package/dist/client/types.gen.js.map +1 -0
- package/dist/client/{utils.d.ts → utils.gen.d.ts} +9 -21
- package/dist/client/utils.gen.d.ts.map +1 -0
- package/dist/client/{utils.js → utils.gen.js} +56 -110
- package/dist/client/utils.gen.js.map +1 -0
- package/dist/client.gen.d.ts +3 -3
- package/dist/client.gen.d.ts.map +1 -1
- package/dist/client.gen.js.map +1 -1
- package/dist/core/{auth.d.ts → auth.gen.d.ts} +1 -1
- package/dist/core/auth.gen.d.ts.map +1 -0
- package/dist/core/{auth.js → auth.gen.js} +2 -1
- package/dist/core/auth.gen.js.map +1 -0
- package/dist/core/{bodySerializer.d.ts → bodySerializer.gen.d.ts} +2 -2
- package/dist/core/bodySerializer.gen.d.ts.map +1 -0
- package/dist/core/{bodySerializer.js → bodySerializer.gen.js} +5 -1
- package/dist/core/bodySerializer.gen.js.map +1 -0
- package/dist/core/{params.d.ts → params.gen.d.ts} +1 -1
- package/dist/core/params.gen.d.ts.map +1 -0
- package/dist/core/{params.js → params.gen.js} +2 -1
- package/dist/core/params.gen.js.map +1 -0
- package/dist/core/{pathSerializer.d.ts → pathSerializer.gen.d.ts} +1 -1
- package/dist/core/pathSerializer.gen.d.ts.map +1 -0
- package/dist/core/{pathSerializer.js → pathSerializer.gen.js} +2 -1
- package/dist/core/pathSerializer.gen.js.map +1 -0
- package/dist/core/queryKeySerializer.gen.d.ts +19 -0
- package/dist/core/queryKeySerializer.gen.d.ts.map +1 -0
- package/dist/core/queryKeySerializer.gen.js +100 -0
- package/dist/core/queryKeySerializer.gen.js.map +1 -0
- package/dist/core/serverSentEvents.gen.d.ts +72 -0
- package/dist/core/serverSentEvents.gen.d.ts.map +1 -0
- package/dist/core/serverSentEvents.gen.js +136 -0
- package/dist/core/serverSentEvents.gen.js.map +1 -0
- package/dist/core/{types.d.ts → types.gen.d.ts} +15 -15
- package/dist/core/types.gen.d.ts.map +1 -0
- package/dist/core/types.gen.js +3 -0
- package/dist/core/types.gen.js.map +1 -0
- package/dist/core/utils.gen.d.ts +20 -0
- package/dist/core/utils.gen.d.ts.map +1 -0
- package/dist/core/utils.gen.js +88 -0
- package/dist/core/utils.gen.js.map +1 -0
- package/dist/schemas.gen.d.ts +48 -352
- package/dist/schemas.gen.d.ts.map +1 -1
- package/dist/schemas.gen.js +50 -366
- package/dist/schemas.gen.js.map +1 -1
- package/dist/sdk.gen.d.ts +48 -16
- package/dist/sdk.gen.d.ts.map +1 -1
- package/dist/sdk.gen.js +90 -68
- package/dist/sdk.gen.js.map +1 -1
- package/dist/services/kubernetes/api.d.ts +12 -12
- package/dist/types.gen.d.ts +35 -285
- package/dist/types.gen.d.ts.map +1 -1
- package/dist/zod.gen.d.ts +41 -1208
- package/dist/zod.gen.d.ts.map +1 -1
- package/dist/zod.gen.js +20 -629
- package/dist/zod.gen.js.map +1 -1
- package/package.json +4 -4
- package/dist/client/client.d.ts +0 -3
- package/dist/client/client.d.ts.map +0 -1
- package/dist/client/client.js.map +0 -1
- package/dist/client/types.d.ts.map +0 -1
- package/dist/client/types.js +0 -2
- package/dist/client/types.js.map +0 -1
- package/dist/client/utils.d.ts.map +0 -1
- package/dist/client/utils.js.map +0 -1
- package/dist/core/auth.d.ts.map +0 -1
- package/dist/core/auth.js.map +0 -1
- package/dist/core/bodySerializer.d.ts.map +0 -1
- package/dist/core/bodySerializer.js.map +0 -1
- package/dist/core/params.d.ts.map +0 -1
- package/dist/core/params.js.map +0 -1
- package/dist/core/pathSerializer.d.ts.map +0 -1
- package/dist/core/pathSerializer.js.map +0 -1
- package/dist/core/types.d.ts.map +0 -1
- package/dist/core/types.js +0 -2
- package/dist/core/types.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.gen.d.ts","sourceRoot":"","sources":["../../src/client/client.gen.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,MAAM,EACN,MAAM,EAGP,MAAM,aAAa,CAAC;AAgBrB,eAAO,MAAM,YAAY,GAAI,SAAQ,MAAW,KAAG,MAiPlD,CAAC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
+
import { createSseClient } from '../core/serverSentEvents.gen';
|
|
3
|
+
import { getValidRequestBody } from '../core/utils.gen';
|
|
4
|
+
import { buildUrl, createConfig, createInterceptors, getParseAs, mergeConfigs, mergeHeaders, setAuthParams, } from './utils.gen';
|
|
2
5
|
export const createClient = (config = {}) => {
|
|
3
6
|
let _config = mergeConfigs(createConfig(), config);
|
|
4
7
|
const getConfig = () => ({ ..._config });
|
|
@@ -7,12 +10,13 @@ export const createClient = (config = {}) => {
|
|
|
7
10
|
return getConfig();
|
|
8
11
|
};
|
|
9
12
|
const interceptors = createInterceptors();
|
|
10
|
-
const
|
|
13
|
+
const beforeRequest = async (options) => {
|
|
11
14
|
const opts = {
|
|
12
15
|
..._config,
|
|
13
16
|
...options,
|
|
14
17
|
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
15
18
|
headers: mergeHeaders(_config.headers, options.headers),
|
|
19
|
+
serializedBody: undefined,
|
|
16
20
|
};
|
|
17
21
|
if (opts.security) {
|
|
18
22
|
await setAuthParams({
|
|
@@ -23,20 +27,26 @@ export const createClient = (config = {}) => {
|
|
|
23
27
|
if (opts.requestValidator) {
|
|
24
28
|
await opts.requestValidator(opts);
|
|
25
29
|
}
|
|
26
|
-
if (opts.body && opts.bodySerializer) {
|
|
27
|
-
opts.
|
|
30
|
+
if (opts.body !== undefined && opts.bodySerializer) {
|
|
31
|
+
opts.serializedBody = opts.bodySerializer(opts.body);
|
|
28
32
|
}
|
|
29
33
|
// remove Content-Type header if body is empty to avoid sending invalid requests
|
|
30
|
-
if (opts.body === undefined || opts.
|
|
34
|
+
if (opts.body === undefined || opts.serializedBody === '') {
|
|
31
35
|
opts.headers.delete('Content-Type');
|
|
32
36
|
}
|
|
33
37
|
const url = buildUrl(opts);
|
|
38
|
+
return { opts, url };
|
|
39
|
+
};
|
|
40
|
+
const request = async (options) => {
|
|
41
|
+
// @ts-expect-error
|
|
42
|
+
const { opts, url } = await beforeRequest(options);
|
|
34
43
|
const requestInit = {
|
|
35
44
|
redirect: 'follow',
|
|
36
45
|
...opts,
|
|
46
|
+
body: getValidRequestBody(opts),
|
|
37
47
|
};
|
|
38
48
|
let request = new Request(url, requestInit);
|
|
39
|
-
for (const fn of interceptors.request.
|
|
49
|
+
for (const fn of interceptors.request.fns) {
|
|
40
50
|
if (fn) {
|
|
41
51
|
request = await fn(request, opts);
|
|
42
52
|
}
|
|
@@ -45,7 +55,7 @@ export const createClient = (config = {}) => {
|
|
|
45
55
|
// TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation
|
|
46
56
|
const _fetch = opts.fetch;
|
|
47
57
|
let response = await _fetch(request);
|
|
48
|
-
for (const fn of interceptors.response.
|
|
58
|
+
for (const fn of interceptors.response.fns) {
|
|
49
59
|
if (fn) {
|
|
50
60
|
response = await fn(response, request, opts);
|
|
51
61
|
}
|
|
@@ -55,18 +65,36 @@ export const createClient = (config = {}) => {
|
|
|
55
65
|
response,
|
|
56
66
|
};
|
|
57
67
|
if (response.ok) {
|
|
68
|
+
const parseAs = (opts.parseAs === 'auto'
|
|
69
|
+
? getParseAs(response.headers.get('Content-Type'))
|
|
70
|
+
: opts.parseAs) ?? 'json';
|
|
58
71
|
if (response.status === 204 ||
|
|
59
72
|
response.headers.get('Content-Length') === '0') {
|
|
73
|
+
let emptyData;
|
|
74
|
+
switch (parseAs) {
|
|
75
|
+
case 'arrayBuffer':
|
|
76
|
+
case 'blob':
|
|
77
|
+
case 'text':
|
|
78
|
+
emptyData = await response[parseAs]();
|
|
79
|
+
break;
|
|
80
|
+
case 'formData':
|
|
81
|
+
emptyData = new FormData();
|
|
82
|
+
break;
|
|
83
|
+
case 'stream':
|
|
84
|
+
emptyData = response.body;
|
|
85
|
+
break;
|
|
86
|
+
case 'json':
|
|
87
|
+
default:
|
|
88
|
+
emptyData = {};
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
60
91
|
return opts.responseStyle === 'data'
|
|
61
|
-
?
|
|
92
|
+
? emptyData
|
|
62
93
|
: {
|
|
63
|
-
data:
|
|
94
|
+
data: emptyData,
|
|
64
95
|
...result,
|
|
65
96
|
};
|
|
66
97
|
}
|
|
67
|
-
const parseAs = (opts.parseAs === 'auto'
|
|
68
|
-
? getParseAs(response.headers.get('Content-Type'))
|
|
69
|
-
: opts.parseAs) ?? 'json';
|
|
70
98
|
let data;
|
|
71
99
|
switch (parseAs) {
|
|
72
100
|
case 'arrayBuffer':
|
|
@@ -109,7 +137,7 @@ export const createClient = (config = {}) => {
|
|
|
109
137
|
}
|
|
110
138
|
const error = jsonError ?? textError;
|
|
111
139
|
let finalError = error;
|
|
112
|
-
for (const fn of interceptors.error.
|
|
140
|
+
for (const fn of interceptors.error.fns) {
|
|
113
141
|
if (fn) {
|
|
114
142
|
finalError = (await fn(error, response, request, opts));
|
|
115
143
|
}
|
|
@@ -126,21 +154,52 @@ export const createClient = (config = {}) => {
|
|
|
126
154
|
...result,
|
|
127
155
|
};
|
|
128
156
|
};
|
|
157
|
+
const makeMethodFn = (method) => (options) => request({ ...options, method });
|
|
158
|
+
const makeSseFn = (method) => async (options) => {
|
|
159
|
+
const { opts, url } = await beforeRequest(options);
|
|
160
|
+
return createSseClient({
|
|
161
|
+
...opts,
|
|
162
|
+
body: opts.body,
|
|
163
|
+
headers: opts.headers,
|
|
164
|
+
method,
|
|
165
|
+
onRequest: async (url, init) => {
|
|
166
|
+
let request = new Request(url, init);
|
|
167
|
+
for (const fn of interceptors.request.fns) {
|
|
168
|
+
if (fn) {
|
|
169
|
+
request = await fn(request, opts);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return request;
|
|
173
|
+
},
|
|
174
|
+
url,
|
|
175
|
+
});
|
|
176
|
+
};
|
|
129
177
|
return {
|
|
130
178
|
buildUrl,
|
|
131
|
-
connect: (
|
|
132
|
-
delete: (
|
|
133
|
-
get: (
|
|
179
|
+
connect: makeMethodFn('CONNECT'),
|
|
180
|
+
delete: makeMethodFn('DELETE'),
|
|
181
|
+
get: makeMethodFn('GET'),
|
|
134
182
|
getConfig,
|
|
135
|
-
head: (
|
|
183
|
+
head: makeMethodFn('HEAD'),
|
|
136
184
|
interceptors,
|
|
137
|
-
options: (
|
|
138
|
-
patch: (
|
|
139
|
-
post: (
|
|
140
|
-
put: (
|
|
185
|
+
options: makeMethodFn('OPTIONS'),
|
|
186
|
+
patch: makeMethodFn('PATCH'),
|
|
187
|
+
post: makeMethodFn('POST'),
|
|
188
|
+
put: makeMethodFn('PUT'),
|
|
141
189
|
request,
|
|
142
190
|
setConfig,
|
|
143
|
-
|
|
191
|
+
sse: {
|
|
192
|
+
connect: makeSseFn('CONNECT'),
|
|
193
|
+
delete: makeSseFn('DELETE'),
|
|
194
|
+
get: makeSseFn('GET'),
|
|
195
|
+
head: makeSseFn('HEAD'),
|
|
196
|
+
options: makeSseFn('OPTIONS'),
|
|
197
|
+
patch: makeSseFn('PATCH'),
|
|
198
|
+
post: makeSseFn('POST'),
|
|
199
|
+
put: makeSseFn('PUT'),
|
|
200
|
+
trace: makeSseFn('TRACE'),
|
|
201
|
+
},
|
|
202
|
+
trace: makeMethodFn('TRACE'),
|
|
144
203
|
};
|
|
145
204
|
};
|
|
146
|
-
//# sourceMappingURL=client.js.map
|
|
205
|
+
//# sourceMappingURL=client.gen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.gen.js","sourceRoot":"","sources":["../../src/client/client.gen.ts"],"names":[],"mappings":"AAAA,qDAAqD;AAErD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAOxD,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,aAAa,GACd,MAAM,aAAa,CAAC;AAOrB,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,SAAiB,EAAE,EAAU,EAAE;IAC1D,IAAI,OAAO,GAAG,YAAY,CAAC,YAAY,EAAE,EAAE,MAAM,CAAC,CAAC;IAEnD,MAAM,SAAS,GAAG,GAAW,EAAE,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAEjD,MAAM,SAAS,GAAG,CAAC,MAAc,EAAU,EAAE;QAC3C,OAAO,GAAG,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACxC,OAAO,SAAS,EAAE,CAAC;IACrB,CAAC,CAAC;IAEF,MAAM,YAAY,GAAG,kBAAkB,EAKpC,CAAC;IAEJ,MAAM,aAAa,GAAG,KAAK,EAAE,OAAuB,EAAE,EAAE;QACtD,MAAM,IAAI,GAAG;YACX,GAAG,OAAO;YACV,GAAG,OAAO;YACV,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK;YACzD,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC;YACvD,cAAc,EAAE,SAAS;SAC1B,CAAC;QAEF,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,MAAM,aAAa,CAA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bodySerializer';
|
|
3
|
-
export { formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer, } from '../core/bodySerializer';
|
|
4
|
-
export { buildClientParams } from '../core/params';
|
|
5
|
-
export {
|
|
6
|
-
export
|
|
7
|
-
export {
|
|
1
|
+
export type { Auth } from '../core/auth.gen';
|
|
2
|
+
export type { QuerySerializerOptions } from '../core/bodySerializer.gen';
|
|
3
|
+
export { formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer, } from '../core/bodySerializer.gen';
|
|
4
|
+
export { buildClientParams } from '../core/params.gen';
|
|
5
|
+
export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen';
|
|
6
|
+
export { createClient } from './client.gen';
|
|
7
|
+
export type { Client, ClientOptions, Config, CreateClientConfig, Options, OptionsLegacyParser, RequestOptions, RequestResult, ResolvedRequestOptions, ResponseStyle, TDataShape, } from './types.gen';
|
|
8
|
+
export { createConfig, mergeHeaders } from './utils.gen';
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,YAAY,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,6BAA6B,GAC9B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,YAAY,EACV,MAAM,EACN,aAAa,EACb,MAAM,EACN,kBAAkB,EAClB,OAAO,EACP,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,sBAAsB,EACtB,aAAa,EACb,UAAU,GACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/client/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
1
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
+
export { formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer, } from '../core/bodySerializer.gen';
|
|
3
|
+
export { buildClientParams } from '../core/params.gen';
|
|
4
|
+
export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen';
|
|
5
|
+
export { createClient } from './client.gen';
|
|
6
|
+
export { createConfig, mergeHeaders } from './utils.gen';
|
|
5
7
|
//# sourceMappingURL=index.js.map
|
package/dist/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;AAIrD,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,6BAA6B,GAC9B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAc5C,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { Auth } from '../core/auth';
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
1
|
+
import type { Auth } from '../core/auth.gen';
|
|
2
|
+
import type { ServerSentEventsOptions, ServerSentEventsResult } from '../core/serverSentEvents.gen';
|
|
3
|
+
import type { Client as CoreClient, Config as CoreConfig } from '../core/types.gen';
|
|
4
|
+
import type { Middleware } from './utils.gen';
|
|
4
5
|
export type ResponseStyle = 'data' | 'fields';
|
|
5
6
|
export interface Config<T extends ClientOptions = ClientOptions> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, CoreConfig {
|
|
6
7
|
/**
|
|
@@ -13,7 +14,7 @@ export interface Config<T extends ClientOptions = ClientOptions> extends Omit<Re
|
|
|
13
14
|
*
|
|
14
15
|
* @default globalThis.fetch
|
|
15
16
|
*/
|
|
16
|
-
fetch?:
|
|
17
|
+
fetch?: typeof fetch;
|
|
17
18
|
/**
|
|
18
19
|
* Please don't use the Fetch client for Next.js applications. The `next`
|
|
19
20
|
* options won't have any effect.
|
|
@@ -43,10 +44,10 @@ export interface Config<T extends ClientOptions = ClientOptions> extends Omit<Re
|
|
|
43
44
|
*/
|
|
44
45
|
throwOnError?: T['throwOnError'];
|
|
45
46
|
}
|
|
46
|
-
export interface RequestOptions<TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<{
|
|
47
|
+
export interface RequestOptions<TData = unknown, TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<{
|
|
47
48
|
responseStyle: TResponseStyle;
|
|
48
49
|
throwOnError: ThrowOnError;
|
|
49
|
-
}> {
|
|
50
|
+
}>, Pick<ServerSentEventsOptions<TData>, 'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'> {
|
|
50
51
|
/**
|
|
51
52
|
* Any body that you want to add to your request.
|
|
52
53
|
*
|
|
@@ -61,6 +62,9 @@ export interface RequestOptions<TResponseStyle extends ResponseStyle = 'fields',
|
|
|
61
62
|
security?: ReadonlyArray<Auth>;
|
|
62
63
|
url: Url;
|
|
63
64
|
}
|
|
65
|
+
export interface ResolvedRequestOptions<TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends RequestOptions<unknown, TResponseStyle, ThrowOnError, Url> {
|
|
66
|
+
serializedBody?: string;
|
|
67
|
+
}
|
|
64
68
|
export type RequestResult<TData = unknown, TError = unknown, ThrowOnError extends boolean = boolean, TResponseStyle extends ResponseStyle = 'fields'> = ThrowOnError extends true ? Promise<TResponseStyle extends 'data' ? TData extends Record<string, unknown> ? TData[keyof TData] : TData : {
|
|
65
69
|
data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
|
|
66
70
|
request: Request;
|
|
@@ -80,16 +84,17 @@ export interface ClientOptions {
|
|
|
80
84
|
responseStyle?: ResponseStyle;
|
|
81
85
|
throwOnError?: boolean;
|
|
82
86
|
}
|
|
83
|
-
type MethodFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TResponseStyle, ThrowOnError>, 'method'>) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
|
|
84
|
-
type
|
|
87
|
+
type MethodFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
|
|
88
|
+
type SseFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>) => Promise<ServerSentEventsResult<TData, TError>>;
|
|
89
|
+
type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'> & Pick<Required<RequestOptions<TData, TResponseStyle, ThrowOnError>>, 'method'>) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
|
|
85
90
|
type BuildUrlFn = <TData extends {
|
|
86
91
|
body?: unknown;
|
|
87
92
|
path?: Record<string, unknown>;
|
|
88
93
|
query?: Record<string, unknown>;
|
|
89
94
|
url: string;
|
|
90
95
|
}>(options: Pick<TData, 'url'> & Options<TData>) => string;
|
|
91
|
-
export type Client = CoreClient<RequestFn, Config, MethodFn, BuildUrlFn> & {
|
|
92
|
-
interceptors: Middleware<Request, Response, unknown,
|
|
96
|
+
export type Client = CoreClient<RequestFn, Config, MethodFn, BuildUrlFn, SseFn> & {
|
|
97
|
+
interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>;
|
|
93
98
|
};
|
|
94
99
|
/**
|
|
95
100
|
* The `createClientConfig()` function will be called on client initialization
|
|
@@ -108,13 +113,13 @@ export interface TDataShape {
|
|
|
108
113
|
url: string;
|
|
109
114
|
}
|
|
110
115
|
type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
|
|
111
|
-
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponseStyle extends ResponseStyle = 'fields'> = OmitKeys<RequestOptions<TResponseStyle, ThrowOnError>, 'body' | 'path' | 'query' | 'url'> & Omit<TData, 'url'>;
|
|
116
|
+
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown, TResponseStyle extends ResponseStyle = 'fields'> = OmitKeys<RequestOptions<TResponse, TResponseStyle, ThrowOnError>, 'body' | 'path' | 'query' | 'url'> & Omit<TData, 'url'>;
|
|
112
117
|
export type OptionsLegacyParser<TData = unknown, ThrowOnError extends boolean = boolean, TResponseStyle extends ResponseStyle = 'fields'> = TData extends {
|
|
113
118
|
body?: any;
|
|
114
119
|
} ? TData extends {
|
|
115
120
|
headers?: any;
|
|
116
|
-
} ? OmitKeys<RequestOptions<TResponseStyle, ThrowOnError>, 'body' | 'headers' | 'url'> & TData : OmitKeys<RequestOptions<TResponseStyle, ThrowOnError>, 'body' | 'url'> & TData & Pick<RequestOptions<TResponseStyle, ThrowOnError>, 'headers'> : TData extends {
|
|
121
|
+
} ? OmitKeys<RequestOptions<unknown, TResponseStyle, ThrowOnError>, 'body' | 'headers' | 'url'> & TData : OmitKeys<RequestOptions<unknown, TResponseStyle, ThrowOnError>, 'body' | 'url'> & TData & Pick<RequestOptions<unknown, TResponseStyle, ThrowOnError>, 'headers'> : TData extends {
|
|
117
122
|
headers?: any;
|
|
118
|
-
} ? OmitKeys<RequestOptions<TResponseStyle, ThrowOnError>, 'headers' | 'url'> & TData & Pick<RequestOptions<TResponseStyle, ThrowOnError>, 'body'> : OmitKeys<RequestOptions<TResponseStyle, ThrowOnError>, 'url'> & TData;
|
|
123
|
+
} ? OmitKeys<RequestOptions<unknown, TResponseStyle, ThrowOnError>, 'headers' | 'url'> & TData & Pick<RequestOptions<unknown, TResponseStyle, ThrowOnError>, 'body'> : OmitKeys<RequestOptions<unknown, TResponseStyle, ThrowOnError>, 'url'> & TData;
|
|
119
124
|
export {};
|
|
120
|
-
//# sourceMappingURL=types.d.ts.map
|
|
125
|
+
//# sourceMappingURL=types.gen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.gen.d.ts","sourceRoot":"","sources":["../../src/client/types.gen.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EACV,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EACV,MAAM,IAAI,UAAU,EACpB,MAAM,IAAI,UAAU,EACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE9C,MAAM,WAAW,MAAM,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa,CAC7D,SAAQ,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC,EACtD,UAAU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GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAClC,GACC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAErB,MAAM,MAAM,mBAAmB,CAC7B,KAAK,GAAG,OAAO,EACf,YAAY,SAAS,OAAO,GAAG,OAAO,EACtC,cAAc,SAAS,aAAa,GAAG,QAAQ,IAC7C,KAAK,SAAS;IAAE,IAAI,CAAC,EAAE,GAAG,CAAA;CAAE,GAC5B,KAAK,SAAS;IAAE,OAAO,CAAC,EAAE,GAAG,CAAA;CAAE,GAC7B,QAAQ,CACN,cAAc,CAAC,OAAO,EAAE,cAAc,EAAE,YAAY,CAAC,EACrD,MAAM,GAAG,SAAS,GAAG,KAAK,CAC3B,GACC,KAAK,GACP,QAAQ,CACN,cAAc,CAAC,OAAO,EAAE,cAAc,EAAE,YAAY,CAAC,EACrD,MAAM,GAAG,KAAK,CACf,GACC,KAAK,GACL,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,cAAc,EAAE,YAAY,CAAC,EAAE,SAAS,CAAC,GAC1E,KAAK,SAAS;IAAE,OAAO,CAAC,EAAE,GAAG,CAAA;CAAE,GAC7B,QAAQ,CACN,cAAc,CAAC,OAAO,EAAE,cAAc,EAAE,YAAY,CAAC,EACrD,SAAS,GAAG,KAAK,CAClB,GACC,KAAK,GACL,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,cAAc,EAAE,YAAY,CAAC,EAAE,MAAM,CAAC,GACrE,QAAQ,CAAC,cAAc,CAAC,OAAO,EAAE,cAAc,EAAE,YAAY,CAAC,EAAE,KAAK,CAAC,GACpE,KAAK,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.gen.js","sourceRoot":"","sources":["../../src/client/types.gen.ts"],"names":[],"mappings":"AAAA,qDAAqD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { Client, ClientOptions, Config, RequestOptions } from './types';
|
|
1
|
+
import type { QuerySerializerOptions } from '../core/bodySerializer.gen';
|
|
2
|
+
import type { Client, ClientOptions, Config, RequestOptions } from './types.gen';
|
|
3
3
|
export declare const createQuerySerializer: <T = unknown>({ allowReserved, array, object, }?: QuerySerializerOptions) => (queryParams: T) => string;
|
|
4
4
|
/**
|
|
5
5
|
* Infers parseAs value from provided Content-Type header.
|
|
@@ -9,38 +9,26 @@ export declare const setAuthParams: ({ security, ...options }: Pick<Required<Req
|
|
|
9
9
|
headers: Headers;
|
|
10
10
|
}) => Promise<void>;
|
|
11
11
|
export declare const buildUrl: Client['buildUrl'];
|
|
12
|
-
export declare const getUrl: ({ baseUrl, path, query, querySerializer, url: _url, }: {
|
|
13
|
-
baseUrl?: string;
|
|
14
|
-
path?: Record<string, unknown>;
|
|
15
|
-
query?: Record<string, unknown>;
|
|
16
|
-
querySerializer: QuerySerializer;
|
|
17
|
-
url: string;
|
|
18
|
-
}) => string;
|
|
19
12
|
export declare const mergeConfigs: (a: Config, b: Config) => Config;
|
|
20
13
|
export declare const mergeHeaders: (...headers: Array<Required<Config>["headers"] | undefined>) => Headers;
|
|
21
14
|
type ErrInterceptor<Err, Res, Req, Options> = (error: Err, response: Res, request: Req, options: Options) => Err | Promise<Err>;
|
|
22
15
|
type ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;
|
|
23
16
|
type ResInterceptor<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>;
|
|
24
17
|
declare class Interceptors<Interceptor> {
|
|
25
|
-
|
|
26
|
-
constructor();
|
|
18
|
+
fns: Array<Interceptor | null>;
|
|
27
19
|
clear(): void;
|
|
28
|
-
getInterceptorIndex(id: number | Interceptor): number;
|
|
29
|
-
exists(id: number | Interceptor): boolean;
|
|
30
20
|
eject(id: number | Interceptor): void;
|
|
31
|
-
|
|
21
|
+
exists(id: number | Interceptor): boolean;
|
|
22
|
+
getInterceptorIndex(id: number | Interceptor): number;
|
|
23
|
+
update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false;
|
|
32
24
|
use(fn: Interceptor): number;
|
|
33
25
|
}
|
|
34
26
|
export interface Middleware<Req, Res, Err, Options> {
|
|
35
|
-
error: Pick<Interceptors<ErrInterceptor<Err, Res, Req, Options>>, 'eject' | 'use'>;
|
|
36
|
-
request: Pick<Interceptors<ReqInterceptor<Req, Options>>, 'eject' | 'use'>;
|
|
37
|
-
response: Pick<Interceptors<ResInterceptor<Res, Req, Options>>, 'eject' | 'use'>;
|
|
38
|
-
}
|
|
39
|
-
export declare const createInterceptors: <Req, Res, Err, Options>() => {
|
|
40
27
|
error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>;
|
|
41
28
|
request: Interceptors<ReqInterceptor<Req, Options>>;
|
|
42
29
|
response: Interceptors<ResInterceptor<Res, Req, Options>>;
|
|
43
|
-
}
|
|
30
|
+
}
|
|
31
|
+
export declare const createInterceptors: <Req, Res, Err, Options>() => Middleware<Req, Res, Err, Options>;
|
|
44
32
|
export declare const createConfig: <T extends ClientOptions = ClientOptions>(override?: Config<Omit<ClientOptions, keyof T> & T>) => Config<Omit<ClientOptions, keyof T> & T>;
|
|
45
33
|
export {};
|
|
46
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
34
|
+
//# sourceMappingURL=utils.gen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.gen.d.ts","sourceRoot":"","sources":["../../src/client/utils.gen.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAQzE,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEjF,eAAO,MAAM,qBAAqB,GAAI,CAAC,GAAG,OAAO,EAAE,oCAIhD,sBAA2B,mBACU,CAAC,WA2CxC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,GACrB,aAAa,MAAM,GAAG,IAAI,KACzB,OAAO,CAAC,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
|
10
|
-
let explode = false;
|
|
11
|
-
let name = match.substring(1, match.length - 1);
|
|
12
|
-
let style = 'simple';
|
|
13
|
-
if (name.endsWith('*')) {
|
|
14
|
-
explode = true;
|
|
15
|
-
name = name.substring(0, name.length - 1);
|
|
16
|
-
}
|
|
17
|
-
if (name.startsWith('.')) {
|
|
18
|
-
name = name.substring(1);
|
|
19
|
-
style = 'label';
|
|
20
|
-
}
|
|
21
|
-
else if (name.startsWith(';')) {
|
|
22
|
-
name = name.substring(1);
|
|
23
|
-
style = 'matrix';
|
|
24
|
-
}
|
|
25
|
-
const value = path[name];
|
|
26
|
-
if (value === undefined || value === null) {
|
|
27
|
-
continue;
|
|
28
|
-
}
|
|
29
|
-
if (Array.isArray(value)) {
|
|
30
|
-
url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
|
|
31
|
-
continue;
|
|
32
|
-
}
|
|
33
|
-
if (typeof value === 'object') {
|
|
34
|
-
url = url.replace(match, serializeObjectParam({
|
|
35
|
-
explode,
|
|
36
|
-
name,
|
|
37
|
-
style,
|
|
38
|
-
value: value,
|
|
39
|
-
valueOnly: true,
|
|
40
|
-
}));
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
if (style === 'matrix') {
|
|
44
|
-
url = url.replace(match, `;${serializePrimitiveParam({
|
|
45
|
-
name,
|
|
46
|
-
value: value,
|
|
47
|
-
})}`);
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
const replaceValue = encodeURIComponent(style === 'label' ? `.${value}` : value);
|
|
51
|
-
url = url.replace(match, replaceValue);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return url;
|
|
55
|
-
};
|
|
1
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
+
import { getAuthToken } from '../core/auth.gen';
|
|
3
|
+
import { jsonBodySerializer } from '../core/bodySerializer.gen';
|
|
4
|
+
import { serializeArrayParam, serializeObjectParam, serializePrimitiveParam, } from '../core/pathSerializer.gen';
|
|
5
|
+
import { getUrl } from '../core/utils.gen';
|
|
56
6
|
export const createQuerySerializer = ({ allowReserved, array, object, } = {}) => {
|
|
57
7
|
const querySerializer = (queryParams) => {
|
|
58
8
|
const search = [];
|
|
@@ -129,8 +79,22 @@ export const getParseAs = (contentType) => {
|
|
|
129
79
|
}
|
|
130
80
|
return;
|
|
131
81
|
};
|
|
82
|
+
const checkForExistence = (options, name) => {
|
|
83
|
+
if (!name) {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
if (options.headers.has(name) ||
|
|
87
|
+
options.query?.[name] ||
|
|
88
|
+
options.headers.get('Cookie')?.includes(`${name}=`)) {
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
return false;
|
|
92
|
+
};
|
|
132
93
|
export const setAuthParams = async ({ security, ...options }) => {
|
|
133
94
|
for (const auth of security) {
|
|
95
|
+
if (checkForExistence(options, auth.name)) {
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
134
98
|
const token = await getAuthToken(auth, options.auth);
|
|
135
99
|
if (!token) {
|
|
136
100
|
continue;
|
|
@@ -151,36 +115,17 @@ export const setAuthParams = async ({ security, ...options }) => {
|
|
|
151
115
|
options.headers.set(name, token);
|
|
152
116
|
break;
|
|
153
117
|
}
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
export const buildUrl = (options) => {
|
|
158
|
-
const url = getUrl({
|
|
159
|
-
baseUrl: options.baseUrl,
|
|
160
|
-
path: options.path,
|
|
161
|
-
query: options.query,
|
|
162
|
-
querySerializer: typeof options.querySerializer === 'function'
|
|
163
|
-
? options.querySerializer
|
|
164
|
-
: createQuerySerializer(options.querySerializer),
|
|
165
|
-
url: options.url,
|
|
166
|
-
});
|
|
167
|
-
return url;
|
|
168
|
-
};
|
|
169
|
-
export const getUrl = ({ baseUrl, path, query, querySerializer, url: _url, }) => {
|
|
170
|
-
const pathUrl = _url.startsWith('/') ? _url : `/${_url}`;
|
|
171
|
-
let url = (baseUrl ?? '') + pathUrl;
|
|
172
|
-
if (path) {
|
|
173
|
-
url = defaultPathSerializer({ path, url });
|
|
174
|
-
}
|
|
175
|
-
let search = query ? querySerializer(query) : '';
|
|
176
|
-
if (search.startsWith('?')) {
|
|
177
|
-
search = search.substring(1);
|
|
178
118
|
}
|
|
179
|
-
if (search) {
|
|
180
|
-
url += `?${search}`;
|
|
181
|
-
}
|
|
182
|
-
return url;
|
|
183
119
|
};
|
|
120
|
+
export const buildUrl = (options) => getUrl({
|
|
121
|
+
baseUrl: options.baseUrl,
|
|
122
|
+
path: options.path,
|
|
123
|
+
query: options.query,
|
|
124
|
+
querySerializer: typeof options.querySerializer === 'function'
|
|
125
|
+
? options.querySerializer
|
|
126
|
+
: createQuerySerializer(options.querySerializer),
|
|
127
|
+
url: options.url,
|
|
128
|
+
});
|
|
184
129
|
export const mergeConfigs = (a, b) => {
|
|
185
130
|
const config = { ...a, ...b };
|
|
186
131
|
if (config.baseUrl?.endsWith('/')) {
|
|
@@ -189,13 +134,22 @@ export const mergeConfigs = (a, b) => {
|
|
|
189
134
|
config.headers = mergeHeaders(a.headers, b.headers);
|
|
190
135
|
return config;
|
|
191
136
|
};
|
|
137
|
+
const headersEntries = (headers) => {
|
|
138
|
+
const entries = [];
|
|
139
|
+
headers.forEach((value, key) => {
|
|
140
|
+
entries.push([key, value]);
|
|
141
|
+
});
|
|
142
|
+
return entries;
|
|
143
|
+
};
|
|
192
144
|
export const mergeHeaders = (...headers) => {
|
|
193
145
|
const mergedHeaders = new Headers();
|
|
194
146
|
for (const header of headers) {
|
|
195
|
-
if (!header
|
|
147
|
+
if (!header) {
|
|
196
148
|
continue;
|
|
197
149
|
}
|
|
198
|
-
const iterator = header instanceof Headers
|
|
150
|
+
const iterator = header instanceof Headers
|
|
151
|
+
? headersEntries(header)
|
|
152
|
+
: Object.entries(header);
|
|
199
153
|
for (const [key, value] of iterator) {
|
|
200
154
|
if (value === null) {
|
|
201
155
|
mergedHeaders.delete(key);
|
|
@@ -215,47 +169,39 @@ export const mergeHeaders = (...headers) => {
|
|
|
215
169
|
return mergedHeaders;
|
|
216
170
|
};
|
|
217
171
|
class Interceptors {
|
|
218
|
-
|
|
219
|
-
constructor() {
|
|
220
|
-
this._fns = [];
|
|
221
|
-
}
|
|
172
|
+
fns = [];
|
|
222
173
|
clear() {
|
|
223
|
-
this.
|
|
174
|
+
this.fns = [];
|
|
224
175
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
else {
|
|
230
|
-
return this._fns.indexOf(id);
|
|
176
|
+
eject(id) {
|
|
177
|
+
const index = this.getInterceptorIndex(id);
|
|
178
|
+
if (this.fns[index]) {
|
|
179
|
+
this.fns[index] = null;
|
|
231
180
|
}
|
|
232
181
|
}
|
|
233
182
|
exists(id) {
|
|
234
183
|
const index = this.getInterceptorIndex(id);
|
|
235
|
-
return
|
|
184
|
+
return Boolean(this.fns[index]);
|
|
236
185
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
this._fns[index] = null;
|
|
186
|
+
getInterceptorIndex(id) {
|
|
187
|
+
if (typeof id === 'number') {
|
|
188
|
+
return this.fns[id] ? id : -1;
|
|
241
189
|
}
|
|
190
|
+
return this.fns.indexOf(id);
|
|
242
191
|
}
|
|
243
192
|
update(id, fn) {
|
|
244
193
|
const index = this.getInterceptorIndex(id);
|
|
245
|
-
if (this.
|
|
246
|
-
this.
|
|
194
|
+
if (this.fns[index]) {
|
|
195
|
+
this.fns[index] = fn;
|
|
247
196
|
return id;
|
|
248
197
|
}
|
|
249
|
-
|
|
250
|
-
return false;
|
|
251
|
-
}
|
|
198
|
+
return false;
|
|
252
199
|
}
|
|
253
200
|
use(fn) {
|
|
254
|
-
this.
|
|
255
|
-
return this.
|
|
201
|
+
this.fns.push(fn);
|
|
202
|
+
return this.fns.length - 1;
|
|
256
203
|
}
|
|
257
204
|
}
|
|
258
|
-
// do not add `Middleware` as return type so we can use _fns internally
|
|
259
205
|
export const createInterceptors = () => ({
|
|
260
206
|
error: new Interceptors(),
|
|
261
207
|
request: new Interceptors(),
|
|
@@ -282,4 +228,4 @@ export const createConfig = (override = {}) => ({
|
|
|
282
228
|
querySerializer: defaultQuerySerializer,
|
|
283
229
|
...override,
|
|
284
230
|
});
|
|
285
|
-
//# sourceMappingURL=utils.js.map
|
|
231
|
+
//# sourceMappingURL=utils.gen.js.map
|