@zilfu/sdk 0.0.1 → 0.1.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.
@@ -12,9 +12,8 @@ import { getUrl } from '../core/utils.gen';
12
12
  import type { Client, ClientOptions, Config, RequestOptions } from './types.gen';
13
13
 
14
14
  export const createQuerySerializer = <T = unknown>({
15
- allowReserved,
16
- array,
17
- object,
15
+ parameters = {},
16
+ ...args
18
17
  }: QuerySerializerOptions = {}) => {
19
18
  const querySerializer = (queryParams: T) => {
20
19
  const search: string[] = [];
@@ -26,29 +25,31 @@ export const createQuerySerializer = <T = unknown>({
26
25
  continue;
27
26
  }
28
27
 
28
+ const options = parameters[name] || args;
29
+
29
30
  if (Array.isArray(value)) {
30
31
  const serializedArray = serializeArrayParam({
31
- allowReserved,
32
+ allowReserved: options.allowReserved,
32
33
  explode: true,
33
34
  name,
34
35
  style: 'form',
35
36
  value,
36
- ...array,
37
+ ...options.array,
37
38
  });
38
39
  if (serializedArray) search.push(serializedArray);
39
40
  } else if (typeof value === 'object') {
40
41
  const serializedObject = serializeObjectParam({
41
- allowReserved,
42
+ allowReserved: options.allowReserved,
42
43
  explode: true,
43
44
  name,
44
45
  style: 'deepObject',
45
46
  value: value as Record<string, unknown>,
46
- ...object,
47
+ ...options.object,
47
48
  });
48
49
  if (serializedObject) search.push(serializedObject);
49
50
  } else {
50
51
  const serializedPrimitive = serializePrimitiveParam({
51
- allowReserved,
52
+ allowReserved: options.allowReserved,
52
53
  name,
53
54
  value: value as string,
54
55
  });
@@ -64,9 +65,7 @@ export const createQuerySerializer = <T = unknown>({
64
65
  /**
65
66
  * Infers parseAs value from provided Content-Type header.
66
67
  */
67
- export const getParseAs = (
68
- contentType: string | null,
69
- ): Exclude<Config['parseAs'], 'auto'> => {
68
+ export const getParseAs = (contentType: string | null): Exclude<Config['parseAs'], 'auto'> => {
70
69
  if (!contentType) {
71
70
  // If no Content-Type header is provided, the best we can do is return the raw response body,
72
71
  // which is effectively the same as the 'stream' option.
@@ -79,10 +78,7 @@ export const getParseAs = (
79
78
  return;
80
79
  }
81
80
 
82
- if (
83
- cleanContent.startsWith('application/json') ||
84
- cleanContent.endsWith('+json')
85
- ) {
81
+ if (cleanContent.startsWith('application/json') || cleanContent.endsWith('+json')) {
86
82
  return 'json';
87
83
  }
88
84
 
@@ -91,9 +87,7 @@ export const getParseAs = (
91
87
  }
92
88
 
93
89
  if (
94
- ['application/', 'audio/', 'image/', 'video/'].some((type) =>
95
- cleanContent.startsWith(type),
96
- )
90
+ ['application/', 'audio/', 'image/', 'video/'].some((type) => cleanContent.startsWith(type))
97
91
  ) {
98
92
  return 'blob';
99
93
  }
@@ -200,10 +194,7 @@ export const mergeHeaders = (
200
194
  continue;
201
195
  }
202
196
 
203
- const iterator =
204
- header instanceof Headers
205
- ? headersEntries(header)
206
- : Object.entries(header);
197
+ const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
207
198
 
208
199
  for (const [key, value] of iterator) {
209
200
  if (value === null) {
@@ -213,7 +204,7 @@ export const mergeHeaders = (
213
204
  mergedHeaders.append(key, v as string);
214
205
  }
215
206
  } else if (value !== undefined) {
216
- // assume object headers are meant to be JSON stringified, i.e. their
207
+ // assume object headers are meant to be JSON stringified, i.e., their
217
208
  // content value in OpenAPI specification is 'application/json'
218
209
  mergedHeaders.set(
219
210
  key,
@@ -227,15 +218,14 @@ export const mergeHeaders = (
227
218
 
228
219
  type ErrInterceptor<Err, Res, Req, Options> = (
229
220
  error: Err,
230
- response: Res,
231
- request: Req,
221
+ /** response may be undefined due to a network error where no response object is produced */
222
+ response: Res | undefined,
223
+ /** request may be undefined, because error may be from building the request object itself */
224
+ request: Req | undefined,
232
225
  options: Options,
233
226
  ) => Err | Promise<Err>;
234
227
 
235
- type ReqInterceptor<Req, Options> = (
236
- request: Req,
237
- options: Options,
238
- ) => Req | Promise<Req>;
228
+ type ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;
239
229
 
240
230
  type ResInterceptor<Res, Req, Options> = (
241
231
  response: Res,
@@ -269,10 +259,7 @@ class Interceptors<Interceptor> {
269
259
  return this.fns.indexOf(id);
270
260
  }
271
261
 
272
- update(
273
- id: number | Interceptor,
274
- fn: Interceptor,
275
- ): number | Interceptor | false {
262
+ update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false {
276
263
  const index = this.getInterceptorIndex(id);
277
264
  if (this.fns[index]) {
278
265
  this.fns[index] = fn;
@@ -13,6 +13,4 @@ import type { ClientOptions as ClientOptions2 } from './types.gen';
13
13
  */
14
14
  export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>;
15
15
 
16
- export const client = createClient(createConfig<ClientOptions2>({
17
- baseUrl: 'https://zilfu.app/api'
18
- }));
16
+ export const client = createClient(createConfig<ClientOptions2>({ baseUrl: 'https://zilfu.app/api' }));
@@ -23,8 +23,7 @@ export const getAuthToken = async (
23
23
  auth: Auth,
24
24
  callback: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken,
25
25
  ): Promise<string | undefined> => {
26
- const token =
27
- typeof callback === 'function' ? await callback(auth) : callback;
26
+ const token = typeof callback === 'function' ? await callback(auth) : callback;
28
27
 
29
28
  if (!token) {
30
29
  return;
@@ -1,26 +1,26 @@
1
1
  // This file is auto-generated by @hey-api/openapi-ts
2
2
 
3
- import type {
4
- ArrayStyle,
5
- ObjectStyle,
6
- SerializerOptions,
7
- } from './pathSerializer.gen';
3
+ import type { ArrayStyle, ObjectStyle, SerializerOptions } from './pathSerializer.gen';
8
4
 
9
5
  export type QuerySerializer = (query: Record<string, unknown>) => string;
10
6
 
11
- export type BodySerializer = (body: any) => any;
7
+ export type BodySerializer = (body: unknown) => unknown;
12
8
 
13
- export interface QuerySerializerOptions {
9
+ type QuerySerializerOptionsObject = {
14
10
  allowReserved?: boolean;
15
- array?: SerializerOptions<ArrayStyle>;
16
- object?: SerializerOptions<ObjectStyle>;
17
- }
11
+ array?: Partial<SerializerOptions<ArrayStyle>>;
12
+ object?: Partial<SerializerOptions<ObjectStyle>>;
13
+ };
14
+
15
+ export type QuerySerializerOptions = QuerySerializerOptionsObject & {
16
+ /**
17
+ * Per-parameter serialization overrides. When provided, these settings
18
+ * override the global array/object settings for specific parameter names.
19
+ */
20
+ parameters?: Record<string, QuerySerializerOptionsObject>;
21
+ };
18
22
 
19
- const serializeFormDataPair = (
20
- data: FormData,
21
- key: string,
22
- value: unknown,
23
- ): void => {
23
+ const serializeFormDataPair = (data: FormData, key: string, value: unknown): void => {
24
24
  if (typeof value === 'string' || value instanceof Blob) {
25
25
  data.append(key, value);
26
26
  } else if (value instanceof Date) {
@@ -30,11 +30,7 @@ const serializeFormDataPair = (
30
30
  }
31
31
  };
32
32
 
33
- const serializeUrlSearchParamsPair = (
34
- data: URLSearchParams,
35
- key: string,
36
- value: unknown,
37
- ): void => {
33
+ const serializeUrlSearchParamsPair = (data: URLSearchParams, key: string, value: unknown): void => {
38
34
  if (typeof value === 'string') {
39
35
  data.append(key, value);
40
36
  } else {
@@ -43,12 +39,10 @@ const serializeUrlSearchParamsPair = (
43
39
  };
44
40
 
45
41
  export const formDataBodySerializer = {
46
- bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(
47
- body: T,
48
- ): FormData => {
42
+ bodySerializer: (body: unknown): FormData => {
49
43
  const data = new FormData();
50
44
 
51
- Object.entries(body).forEach(([key, value]) => {
45
+ Object.entries(body as Record<string, unknown>).forEach(([key, value]) => {
52
46
  if (value === undefined || value === null) {
53
47
  return;
54
48
  }
@@ -64,19 +58,15 @@ export const formDataBodySerializer = {
64
58
  };
65
59
 
66
60
  export const jsonBodySerializer = {
67
- bodySerializer: <T>(body: T): string =>
68
- JSON.stringify(body, (_key, value) =>
69
- typeof value === 'bigint' ? value.toString() : value,
70
- ),
61
+ bodySerializer: (body: unknown): string =>
62
+ JSON.stringify(body, (_key, value) => (typeof value === 'bigint' ? value.toString() : value)),
71
63
  };
72
64
 
73
65
  export const urlSearchParamsBodySerializer = {
74
- bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(
75
- body: T,
76
- ): string => {
66
+ bodySerializer: (body: unknown): string => {
77
67
  const data = new URLSearchParams();
78
68
 
79
- Object.entries(body).forEach(([key, value]) => {
69
+ Object.entries(body as Record<string, unknown>).forEach(([key, value]) => {
80
70
  if (value === undefined || value === null) {
81
71
  return;
82
72
  }
@@ -22,6 +22,17 @@ export type Field =
22
22
  */
23
23
  key?: string;
24
24
  map?: string;
25
+ }
26
+ | {
27
+ /**
28
+ * Field name. This is the name we want the user to see and use.
29
+ */
30
+ key: string;
31
+ /**
32
+ * Field mapped name. This is the name we want to use in the request.
33
+ * If `in` is omitted, `map` aliases `key` to the transport layer.
34
+ */
35
+ map: Slot;
25
36
  };
26
37
 
27
38
  export interface Fields {
@@ -41,10 +52,14 @@ const extraPrefixes = Object.entries(extraPrefixesMap);
41
52
 
42
53
  type KeyMap = Map<
43
54
  string,
44
- {
45
- in: Slot;
46
- map?: string;
47
- }
55
+ | {
56
+ in: Slot;
57
+ map?: string;
58
+ }
59
+ | {
60
+ in?: never;
61
+ map: Slot;
62
+ }
48
63
  >;
49
64
 
50
65
  const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => {
@@ -60,6 +75,10 @@ const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => {
60
75
  map: config.map,
61
76
  });
62
77
  }
78
+ } else if ('key' in config) {
79
+ map.set(config.key, {
80
+ map: config.map,
81
+ });
63
82
  } else if (config.args) {
64
83
  buildKeyMap(config.args, map);
65
84
  }
@@ -77,16 +96,13 @@ interface Params {
77
96
 
78
97
  const stripEmptySlots = (params: Params) => {
79
98
  for (const [slot, value] of Object.entries(params)) {
80
- if (value && typeof value === 'object' && !Object.keys(value).length) {
99
+ if (value && typeof value === 'object' && !Array.isArray(value) && !Object.keys(value).length) {
81
100
  delete params[slot as Slot];
82
101
  }
83
102
  }
84
103
  };
85
104
 
86
- export const buildClientParams = (
87
- args: ReadonlyArray<unknown>,
88
- fields: FieldsConfig,
89
- ) => {
105
+ export const buildClientParams = (args: ReadonlyArray<unknown>, fields: FieldsConfig) => {
90
106
  const params: Params = {
91
107
  body: {},
92
108
  headers: {},
@@ -111,7 +127,9 @@ export const buildClientParams = (
111
127
  if (config.key) {
112
128
  const field = map.get(config.key)!;
113
129
  const name = field.map || config.key;
114
- (params[field.in] as Record<string, unknown>)[name] = arg;
130
+ if (field.in) {
131
+ (params[field.in] as Record<string, unknown>)[name] = arg;
132
+ }
115
133
  } else {
116
134
  params.body = arg;
117
135
  }
@@ -120,22 +138,20 @@ export const buildClientParams = (
120
138
  const field = map.get(key);
121
139
 
122
140
  if (field) {
123
- const name = field.map || key;
124
- (params[field.in] as Record<string, unknown>)[name] = value;
141
+ if (field.in) {
142
+ const name = field.map || key;
143
+ (params[field.in] as Record<string, unknown>)[name] = value;
144
+ } else {
145
+ params[field.map] = value;
146
+ }
125
147
  } else {
126
- const extra = extraPrefixes.find(([prefix]) =>
127
- key.startsWith(prefix),
128
- );
148
+ const extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix));
129
149
 
130
150
  if (extra) {
131
151
  const [prefix, slot] = extra;
132
- (params[slot] as Record<string, unknown>)[
133
- key.slice(prefix.length)
134
- ] = value;
135
- } else {
136
- for (const [slot, allowed] of Object.entries(
137
- config.allowExtra ?? {},
138
- )) {
152
+ (params[slot] as Record<string, unknown>)[key.slice(prefix.length)] = value;
153
+ } else if ('allowExtra' in config && config.allowExtra) {
154
+ for (const [slot, allowed] of Object.entries(config.allowExtra)) {
139
155
  if (allowed) {
140
156
  (params[slot as Slot] as Record<string, unknown>)[key] = value;
141
157
  break;
@@ -1,8 +1,6 @@
1
1
  // This file is auto-generated by @hey-api/openapi-ts
2
2
 
3
- interface SerializeOptions<T>
4
- extends SerializePrimitiveOptions,
5
- SerializerOptions<T> {}
3
+ interface SerializeOptions<T> extends SerializePrimitiveOptions, SerializerOptions<T> {}
6
4
 
7
5
  interface SerializePrimitiveOptions {
8
6
  allowReserved?: boolean;
@@ -105,9 +103,7 @@ export const serializeArrayParam = ({
105
103
  });
106
104
  })
107
105
  .join(separator);
108
- return style === 'label' || style === 'matrix'
109
- ? separator + joinedValues
110
- : joinedValues;
106
+ return style === 'label' || style === 'matrix' ? separator + joinedValues : joinedValues;
111
107
  };
112
108
 
113
109
  export const serializePrimitiveParam = ({
@@ -146,11 +142,7 @@ export const serializeObjectParam = ({
146
142
  if (style !== 'deepObject' && !explode) {
147
143
  let values: string[] = [];
148
144
  Object.entries(value).forEach(([key, v]) => {
149
- values = [
150
- ...values,
151
- key,
152
- allowReserved ? (v as string) : encodeURIComponent(v as string),
153
- ];
145
+ values = [...values, key, allowReserved ? (v as string) : encodeURIComponent(v as string)];
154
146
  });
155
147
  const joinedValues = values.join(',');
156
148
  switch (style) {
@@ -175,7 +167,5 @@ export const serializeObjectParam = ({
175
167
  }),
176
168
  )
177
169
  .join(separator);
178
- return style === 'label' || style === 'matrix'
179
- ? separator + joinedValues
180
- : joinedValues;
170
+ return style === 'label' || style === 'matrix' ? separator + joinedValues : joinedValues;
181
171
  };
@@ -0,0 +1,117 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+
3
+ /**
4
+ * JSON-friendly union that mirrors what Pinia Colada can hash.
5
+ */
6
+ export type JsonValue =
7
+ | null
8
+ | string
9
+ | number
10
+ | boolean
11
+ | JsonValue[]
12
+ | { [key: string]: JsonValue };
13
+
14
+ /**
15
+ * Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes.
16
+ */
17
+ export const queryKeyJsonReplacer = (_key: string, value: unknown) => {
18
+ if (value === undefined || typeof value === 'function' || typeof value === 'symbol') {
19
+ return undefined;
20
+ }
21
+ if (typeof value === 'bigint') {
22
+ return value.toString();
23
+ }
24
+ if (value instanceof Date) {
25
+ return value.toISOString();
26
+ }
27
+ return value;
28
+ };
29
+
30
+ /**
31
+ * Safely stringifies a value and parses it back into a JsonValue.
32
+ */
33
+ export const stringifyToJsonValue = (input: unknown): JsonValue | undefined => {
34
+ try {
35
+ const json = JSON.stringify(input, queryKeyJsonReplacer);
36
+ if (json === undefined) {
37
+ return undefined;
38
+ }
39
+ return JSON.parse(json) as JsonValue;
40
+ } catch {
41
+ return undefined;
42
+ }
43
+ };
44
+
45
+ /**
46
+ * Detects plain objects (including objects with a null prototype).
47
+ */
48
+ const isPlainObject = (value: unknown): value is Record<string, unknown> => {
49
+ if (value === null || typeof value !== 'object') {
50
+ return false;
51
+ }
52
+ const prototype = Object.getPrototypeOf(value as object);
53
+ return prototype === Object.prototype || prototype === null;
54
+ };
55
+
56
+ /**
57
+ * Turns URLSearchParams into a sorted JSON object for deterministic keys.
58
+ */
59
+ const serializeSearchParams = (params: URLSearchParams): JsonValue => {
60
+ const entries = Array.from(params.entries()).sort(([a], [b]) => a.localeCompare(b));
61
+ const result: Record<string, JsonValue> = {};
62
+
63
+ for (const [key, value] of entries) {
64
+ const existing = result[key];
65
+ if (existing === undefined) {
66
+ result[key] = value;
67
+ continue;
68
+ }
69
+
70
+ if (Array.isArray(existing)) {
71
+ (existing as string[]).push(value);
72
+ } else {
73
+ result[key] = [existing, value];
74
+ }
75
+ }
76
+
77
+ return result;
78
+ };
79
+
80
+ /**
81
+ * Normalizes any accepted value into a JSON-friendly shape for query keys.
82
+ */
83
+ export const serializeQueryKeyValue = (value: unknown): JsonValue | undefined => {
84
+ if (value === null) {
85
+ return null;
86
+ }
87
+
88
+ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
89
+ return value;
90
+ }
91
+
92
+ if (value === undefined || typeof value === 'function' || typeof value === 'symbol') {
93
+ return undefined;
94
+ }
95
+
96
+ if (typeof value === 'bigint') {
97
+ return value.toString();
98
+ }
99
+
100
+ if (value instanceof Date) {
101
+ return value.toISOString();
102
+ }
103
+
104
+ if (Array.isArray(value)) {
105
+ return stringifyToJsonValue(value);
106
+ }
107
+
108
+ if (typeof URLSearchParams !== 'undefined' && value instanceof URLSearchParams) {
109
+ return serializeSearchParams(value);
110
+ }
111
+
112
+ if (isPlainObject(value)) {
113
+ return stringifyToJsonValue(value);
114
+ }
115
+
116
+ return undefined;
117
+ };
@@ -2,10 +2,7 @@
2
2
 
3
3
  import type { Config } from './types.gen';
4
4
 
5
- export type ServerSentEventsOptions<TData = unknown> = Omit<
6
- RequestInit,
7
- 'method'
8
- > &
5
+ export type ServerSentEventsOptions<TData = unknown> = Omit<RequestInit, 'method'> &
9
6
  Pick<Config, 'method' | 'responseTransformer' | 'responseValidator'> & {
10
7
  /**
11
8
  * Fetch API implementation. You can use this option to provide a custom
@@ -74,11 +71,7 @@ export interface StreamEvent<TData = unknown> {
74
71
  retry?: number;
75
72
  }
76
73
 
77
- export type ServerSentEventsResult<
78
- TData = unknown,
79
- TReturn = void,
80
- TNext = unknown,
81
- > = {
74
+ export type ServerSentEventsResult<TData = unknown, TReturn = void, TNext = unknown> = {
82
75
  stream: AsyncGenerator<
83
76
  TData extends Record<string, unknown> ? TData[keyof TData] : TData,
84
77
  TReturn,
@@ -86,7 +79,7 @@ export type ServerSentEventsResult<
86
79
  >;
87
80
  };
88
81
 
89
- export const createSseClient = <TData = unknown>({
82
+ export function createSseClient<TData = unknown>({
90
83
  onRequest,
91
84
  onSseError,
92
85
  onSseEvent,
@@ -98,12 +91,10 @@ export const createSseClient = <TData = unknown>({
98
91
  sseSleepFn,
99
92
  url,
100
93
  ...options
101
- }: ServerSentEventsOptions): ServerSentEventsResult<TData> => {
94
+ }: ServerSentEventsOptions): ServerSentEventsResult<TData> {
102
95
  let lastEventId: string | undefined;
103
96
 
104
- const sleep =
105
- sseSleepFn ??
106
- ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms)));
97
+ const sleep = sseSleepFn ?? ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms)));
107
98
 
108
99
  const createStream = async function* () {
109
100
  let retryDelay: number = sseDefaultRetryDelay ?? 3000;
@@ -141,16 +132,11 @@ export const createSseClient = <TData = unknown>({
141
132
  const _fetch = options.fetch ?? globalThis.fetch;
142
133
  const response = await _fetch(request);
143
134
 
144
- if (!response.ok)
145
- throw new Error(
146
- `SSE failed: ${response.status} ${response.statusText}`,
147
- );
135
+ if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
148
136
 
149
137
  if (!response.body) throw new Error('No body in SSE response');
150
138
 
151
- const reader = response.body
152
- .pipeThrough(new TextDecoderStream())
153
- .getReader();
139
+ const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
154
140
 
155
141
  let buffer = '';
156
142
 
@@ -169,6 +155,7 @@ export const createSseClient = <TData = unknown>({
169
155
  const { done, value } = await reader.read();
170
156
  if (done) break;
171
157
  buffer += value;
158
+ buffer = buffer.replace(/\r\n?/g, '\n'); // normalize line endings
172
159
 
173
160
  const chunks = buffer.split('\n\n');
174
161
  buffer = chunks.pop() ?? '';
@@ -186,10 +173,7 @@ export const createSseClient = <TData = unknown>({
186
173
  } else if (line.startsWith('id:')) {
187
174
  lastEventId = line.replace(/^id:\s*/, '');
188
175
  } else if (line.startsWith('retry:')) {
189
- const parsed = Number.parseInt(
190
- line.replace(/^retry:\s*/, ''),
191
- 10,
192
- );
176
+ const parsed = Number.parseInt(line.replace(/^retry:\s*/, ''), 10);
193
177
  if (!Number.isNaN(parsed)) {
194
178
  retryDelay = parsed;
195
179
  }
@@ -241,18 +225,12 @@ export const createSseClient = <TData = unknown>({
241
225
  // connection failed or aborted; retry after delay
242
226
  onSseError?.(error);
243
227
 
244
- if (
245
- sseMaxRetryAttempts !== undefined &&
246
- attempt >= sseMaxRetryAttempts
247
- ) {
228
+ if (sseMaxRetryAttempts !== undefined && attempt >= sseMaxRetryAttempts) {
248
229
  break; // stop after firing error
249
230
  }
250
231
 
251
232
  // exponential backoff: double retry each attempt, cap at 30s
252
- const backoff = Math.min(
253
- retryDelay * 2 ** (attempt - 1),
254
- sseMaxRetryDelay ?? 30000,
255
- );
233
+ const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 30000);
256
234
  await sleep(backoff);
257
235
  }
258
236
  }
@@ -261,4 +239,4 @@ export const createSseClient = <TData = unknown>({
261
239
  const stream = createStream();
262
240
 
263
241
  return { stream };
264
- };
242
+ }
@@ -1,11 +1,7 @@
1
1
  // This file is auto-generated by @hey-api/openapi-ts
2
2
 
3
3
  import type { Auth, AuthToken } from './auth.gen';
4
- import type {
5
- BodySerializer,
6
- QuerySerializer,
7
- QuerySerializerOptions,
8
- } from './bodySerializer.gen';
4
+ import type { BodySerializer, QuerySerializer, QuerySerializerOptions } from './bodySerializer.gen';
9
5
 
10
6
  export type HttpMethod =
11
7
  | 'connect'
@@ -34,9 +30,7 @@ export type Client<
34
30
  setConfig: (config: Config) => Config;
35
31
  } & {
36
32
  [K in HttpMethod]: MethodFn;
37
- } & ([SseFn] extends [never]
38
- ? { sse?: never }
39
- : { sse: { [K in HttpMethod]: SseFn } });
33
+ } & ([SseFn] extends [never] ? { sse?: never } : { sse: { [K in HttpMethod]: SseFn } });
40
34
 
41
35
  export interface Config {
42
36
  /**
@@ -59,13 +53,7 @@ export interface Config {
59
53
  | RequestInit['headers']
60
54
  | Record<
61
55
  string,
62
- | string
63
- | number
64
- | boolean
65
- | (string | number | boolean)[]
66
- | null
67
- | undefined
68
- | unknown
56
+ string | number | boolean | (string | number | boolean)[] | null | undefined | unknown
69
57
  >;
70
58
  /**
71
59
  * The request method.
@@ -92,7 +80,7 @@ export interface Config {
92
80
  requestValidator?: (data: unknown) => Promise<unknown>;
93
81
  /**
94
82
  * A function transforming response data before it's returned. This is useful
95
- * for post-processing data, e.g. converting ISO strings into Date objects.
83
+ * for post-processing data, e.g., converting ISO strings into Date objects.
96
84
  */
97
85
  responseTransformer?: (data: unknown) => Promise<unknown>;
98
86
  /**
@@ -112,7 +100,5 @@ type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never]
112
100
  : false;
113
101
 
114
102
  export type OmitNever<T extends Record<string, unknown>> = {
115
- [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true
116
- ? never
117
- : K]: T[K];
103
+ [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true ? never : K]: T[K];
118
104
  };