@globalscoutme/api-client 1.1.10 → 1.1.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/README.md CHANGED
@@ -261,10 +261,9 @@ const portal = await Subscriptions.createPortal({
261
261
  // redirect user to portal.url
262
262
 
263
263
  // Storage — get a signed upload URL, then PUT the file directly to Supabase Storage
264
- const { uploadUrl, token, path, bucket, expiresIn } =
265
- await Storage.createUploadUrl({
266
- body: { bucket: 'avatars', contentType: 'image/jpeg', sizeBytes: 204800 },
267
- });
264
+ const { uploadUrl, token, path, bucket, expiresIn } = await Storage.createUploadUrl({
265
+ body: { bucket: 'avatars', contentType: 'image/jpeg', sizeBytes: 204800 },
266
+ });
268
267
  await fetch(uploadUrl, {
269
268
  method: 'PUT',
270
269
  body: fileBlob,
@@ -3,12 +3,7 @@
3
3
  import { createSseClient } from '../core/serverSentEvents.gen.js';
4
4
  import type { HttpMethod } from '../core/types.gen.js';
5
5
  import { getValidRequestBody } from '../core/utils.gen.js';
6
- import type {
7
- Client,
8
- Config,
9
- RequestOptions,
10
- ResolvedRequestOptions,
11
- } from './types.gen.js';
6
+ import type { Client, Config, RequestOptions, ResolvedRequestOptions } from './types.gen.js';
12
7
  import {
13
8
  buildUrl,
14
9
  createConfig,
@@ -34,12 +29,7 @@ export const createClient = (config: Config = {}): Client => {
34
29
  return getConfig();
35
30
  };
36
31
 
37
- const interceptors = createInterceptors<
38
- Request,
39
- Response,
40
- unknown,
41
- ResolvedRequestOptions
42
- >();
32
+ const interceptors = createInterceptors<Request, Response, unknown, ResolvedRequestOptions>();
43
33
 
44
34
  const beforeRequest = async (options: RequestOptions) => {
45
35
  const opts = {
@@ -105,12 +95,7 @@ export const createClient = (config: Config = {}): Client => {
105
95
 
106
96
  for (const fn of interceptors.error.fns) {
107
97
  if (fn) {
108
- finalError = (await fn(
109
- error,
110
- undefined as any,
111
- request,
112
- opts,
113
- )) as unknown;
98
+ finalError = (await fn(error, undefined as any, request, opts)) as unknown;
114
99
  }
115
100
  }
116
101
 
@@ -147,10 +132,7 @@ export const createClient = (config: Config = {}): Client => {
147
132
  ? getParseAs(response.headers.get('Content-Type'))
148
133
  : opts.parseAs) ?? 'json';
149
134
 
150
- if (
151
- response.status === 204 ||
152
- response.headers.get('Content-Length') === '0'
153
- ) {
135
+ if (response.status === 204 || response.headers.get('Content-Length') === '0') {
154
136
  let emptyData: any;
155
137
  switch (parseAs) {
156
138
  case 'arrayBuffer':
@@ -252,34 +234,29 @@ export const createClient = (config: Config = {}): Client => {
252
234
  };
253
235
  };
254
236
 
255
- const makeMethodFn =
256
- (method: Uppercase<HttpMethod>) => (options: RequestOptions) =>
257
- request({ ...options, method });
237
+ const makeMethodFn = (method: Uppercase<HttpMethod>) => (options: RequestOptions) =>
238
+ request({ ...options, method });
258
239
 
259
- const makeSseFn =
260
- (method: Uppercase<HttpMethod>) => async (options: RequestOptions) => {
261
- const { opts, url } = await beforeRequest(options);
262
- return createSseClient({
263
- ...opts,
264
- body: opts.body as BodyInit | null | undefined,
265
- headers: opts.headers as unknown as Record<string, string>,
266
- method,
267
- onRequest: async (url, init) => {
268
- let request = new Request(url, init);
269
- for (const fn of interceptors.request.fns) {
270
- if (fn) {
271
- request = await fn(request, opts);
272
- }
240
+ const makeSseFn = (method: Uppercase<HttpMethod>) => async (options: RequestOptions) => {
241
+ const { opts, url } = await beforeRequest(options);
242
+ return createSseClient({
243
+ ...opts,
244
+ body: opts.body as BodyInit | null | undefined,
245
+ headers: opts.headers as unknown as Record<string, string>,
246
+ method,
247
+ onRequest: async (url, init) => {
248
+ let request = new Request(url, init);
249
+ for (const fn of interceptors.request.fns) {
250
+ if (fn) {
251
+ request = await fn(request, opts);
273
252
  }
274
- return request;
275
- },
276
- serializedBody: getValidRequestBody(opts) as
277
- | BodyInit
278
- | null
279
- | undefined,
280
- url,
281
- });
282
- };
253
+ }
254
+ return request;
255
+ },
256
+ serializedBody: getValidRequestBody(opts) as BodyInit | null | undefined,
257
+ url,
258
+ });
259
+ };
283
260
 
284
261
  return {
285
262
  buildUrl,
@@ -5,10 +5,7 @@ import type {
5
5
  ServerSentEventsOptions,
6
6
  ServerSentEventsResult,
7
7
  } from '../core/serverSentEvents.gen.js';
8
- import type {
9
- Client as CoreClient,
10
- Config as CoreConfig,
11
- } from '../core/types.gen.js';
8
+ import type { Client as CoreClient, Config as CoreConfig } from '../core/types.gen.js';
12
9
  import type { Middleware } from './utils.gen.js';
13
10
 
14
11
  export type ResponseStyle = 'data' | 'fields';
@@ -41,14 +38,7 @@ export interface Config<T extends ClientOptions = ClientOptions>
41
38
  *
42
39
  * @default 'auto'
43
40
  */
44
- parseAs?:
45
- | 'arrayBuffer'
46
- | 'auto'
47
- | 'blob'
48
- | 'formData'
49
- | 'json'
50
- | 'stream'
51
- | 'text';
41
+ parseAs?: 'arrayBuffer' | 'auto' | 'blob' | 'formData' | 'json' | 'stream' | 'text';
52
42
  /**
53
43
  * Should we return only data or multiple fields (data, error, response, etc.)?
54
44
  *
@@ -117,32 +107,22 @@ export type RequestResult<
117
107
  ? TData[keyof TData]
118
108
  : TData
119
109
  : {
120
- data: TData extends Record<string, unknown>
121
- ? TData[keyof TData]
122
- : TData;
110
+ data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
123
111
  request: Request;
124
112
  response: Response;
125
113
  }
126
114
  >
127
115
  : Promise<
128
116
  TResponseStyle extends 'data'
129
- ?
130
- | (TData extends Record<string, unknown>
131
- ? TData[keyof TData]
132
- : TData)
133
- | undefined
117
+ ? (TData extends Record<string, unknown> ? TData[keyof TData] : TData) | undefined
134
118
  : (
135
119
  | {
136
- data: TData extends Record<string, unknown>
137
- ? TData[keyof TData]
138
- : TData;
120
+ data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
139
121
  error: undefined;
140
122
  }
141
123
  | {
142
124
  data: undefined;
143
- error: TError extends Record<string, unknown>
144
- ? TError[keyof TError]
145
- : TError;
125
+ error: TError extends Record<string, unknown> ? TError[keyof TError] : TError;
146
126
  }
147
127
  ) & {
148
128
  request: Request;
@@ -162,7 +142,7 @@ type MethodFn = <
162
142
  ThrowOnError extends boolean = false,
163
143
  TResponseStyle extends ResponseStyle = 'fields',
164
144
  >(
165
- options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>,
145
+ options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>
166
146
  ) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
167
147
 
168
148
  type SseFn = <
@@ -171,7 +151,7 @@ type SseFn = <
171
151
  ThrowOnError extends boolean = false,
172
152
  TResponseStyle extends ResponseStyle = 'fields',
173
153
  >(
174
- options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>,
154
+ options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>
175
155
  ) => Promise<ServerSentEventsResult<TData, TError>>;
176
156
 
177
157
  type RequestFn = <
@@ -181,10 +161,7 @@ type RequestFn = <
181
161
  TResponseStyle extends ResponseStyle = 'fields',
182
162
  >(
183
163
  options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'> &
184
- Pick<
185
- Required<RequestOptions<TData, TResponseStyle, ThrowOnError>>,
186
- 'method'
187
- >,
164
+ Pick<Required<RequestOptions<TData, TResponseStyle, ThrowOnError>>, 'method'>
188
165
  ) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
189
166
 
190
167
  type BuildUrlFn = <
@@ -195,16 +172,10 @@ type BuildUrlFn = <
195
172
  url: string;
196
173
  },
197
174
  >(
198
- options: TData & Options<TData>,
175
+ options: TData & Options<TData>
199
176
  ) => string;
200
177
 
201
- export type Client = CoreClient<
202
- RequestFn,
203
- Config,
204
- MethodFn,
205
- BuildUrlFn,
206
- SseFn
207
- > & {
178
+ export type Client = CoreClient<RequestFn, Config, MethodFn, BuildUrlFn, SseFn> & {
208
179
  interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>;
209
180
  };
210
181
 
@@ -217,7 +188,7 @@ export type Client = CoreClient<
217
188
  * to ensure your client always has the correct values.
218
189
  */
219
190
  export type CreateClientConfig<T extends ClientOptions = ClientOptions> = (
220
- override?: Config<ClientOptions & T>,
191
+ override?: Config<ClientOptions & T>
221
192
  ) => Config<Required<ClientOptions> & T>;
222
193
 
223
194
  export interface TDataShape {
@@ -9,12 +9,7 @@ import {
9
9
  serializePrimitiveParam,
10
10
  } from '../core/pathSerializer.gen.js';
11
11
  import { getUrl } from '../core/utils.gen.js';
12
- import type {
13
- Client,
14
- ClientOptions,
15
- Config,
16
- RequestOptions,
17
- } from './types.gen.js';
12
+ import type { Client, ClientOptions, Config, RequestOptions } from './types.gen.js';
18
13
 
19
14
  export const createQuerySerializer = <T = unknown>({
20
15
  parameters = {},
@@ -70,9 +65,7 @@ export const createQuerySerializer = <T = unknown>({
70
65
  /**
71
66
  * Infers parseAs value from provided Content-Type header.
72
67
  */
73
- export const getParseAs = (
74
- contentType: string | null,
75
- ): Exclude<Config['parseAs'], 'auto'> => {
68
+ export const getParseAs = (contentType: string | null): Exclude<Config['parseAs'], 'auto'> => {
76
69
  if (!contentType) {
77
70
  // If no Content-Type header is provided, the best we can do is return the raw response body,
78
71
  // which is effectively the same as the 'stream' option.
@@ -85,10 +78,7 @@ export const getParseAs = (
85
78
  return;
86
79
  }
87
80
 
88
- if (
89
- cleanContent.startsWith('application/json') ||
90
- cleanContent.endsWith('+json')
91
- ) {
81
+ if (cleanContent.startsWith('application/json') || cleanContent.endsWith('+json')) {
92
82
  return 'json';
93
83
  }
94
84
 
@@ -97,9 +87,7 @@ export const getParseAs = (
97
87
  }
98
88
 
99
89
  if (
100
- ['application/', 'audio/', 'image/', 'video/'].some((type) =>
101
- cleanContent.startsWith(type),
102
- )
90
+ ['application/', 'audio/', 'image/', 'video/'].some((type) => cleanContent.startsWith(type))
103
91
  ) {
104
92
  return 'blob';
105
93
  }
@@ -115,7 +103,7 @@ const checkForExistence = (
115
103
  options: Pick<RequestOptions, 'auth' | 'query'> & {
116
104
  headers: Headers;
117
105
  },
118
- name?: string,
106
+ name?: string
119
107
  ): boolean => {
120
108
  if (!name) {
121
109
  return false;
@@ -206,10 +194,7 @@ export const mergeHeaders = (
206
194
  continue;
207
195
  }
208
196
 
209
- const iterator =
210
- header instanceof Headers
211
- ? headersEntries(header)
212
- : Object.entries(header);
197
+ const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
213
198
 
214
199
  for (const [key, value] of iterator) {
215
200
  if (value === null) {
@@ -223,7 +208,7 @@ export const mergeHeaders = (
223
208
  // content value in OpenAPI specification is 'application/json'
224
209
  mergedHeaders.set(
225
210
  key,
226
- typeof value === 'object' ? JSON.stringify(value) : (value as string),
211
+ typeof value === 'object' ? JSON.stringify(value) : (value as string)
227
212
  );
228
213
  }
229
214
  }
@@ -235,18 +220,15 @@ type ErrInterceptor<Err, Res, Req, Options> = (
235
220
  error: Err,
236
221
  response: Res,
237
222
  request: Req,
238
- options: Options,
223
+ options: Options
239
224
  ) => Err | Promise<Err>;
240
225
 
241
- type ReqInterceptor<Req, Options> = (
242
- request: Req,
243
- options: Options,
244
- ) => Req | Promise<Req>;
226
+ type ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;
245
227
 
246
228
  type ResInterceptor<Res, Req, Options> = (
247
229
  response: Res,
248
230
  request: Req,
249
- options: Options,
231
+ options: Options
250
232
  ) => Res | Promise<Res>;
251
233
 
252
234
  class Interceptors<Interceptor> {
@@ -275,10 +257,7 @@ class Interceptors<Interceptor> {
275
257
  return this.fns.indexOf(id);
276
258
  }
277
259
 
278
- update(
279
- id: number | Interceptor,
280
- fn: Interceptor,
281
- ): number | Interceptor | false {
260
+ update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false {
282
261
  const index = this.getInterceptorIndex(id);
283
262
  if (this.fns[index]) {
284
263
  this.fns[index] = fn;
@@ -327,7 +306,7 @@ const defaultHeaders = {
327
306
  };
328
307
 
329
308
  export const createConfig = <T extends ClientOptions = ClientOptions>(
330
- override: Config<Omit<ClientOptions, keyof T> & T> = {},
309
+ override: Config<Omit<ClientOptions, keyof T> & T> = {}
331
310
  ): Config<Omit<ClientOptions, keyof T> & T> => ({
332
311
  ...jsonBodySerializer,
333
312
  headers: defaultHeaders,
package/client.gen.ts CHANGED
@@ -1,11 +1,6 @@
1
1
  // This file is auto-generated by @hey-api/openapi-ts
2
2
 
3
- import {
4
- type ClientOptions,
5
- type Config,
6
- createClient,
7
- createConfig,
8
- } from './client/index.js';
3
+ import { type ClientOptions, type Config, createClient, createConfig } from './client/index.js';
9
4
  import type { ClientOptions as ClientOptions2 } from './types.gen.js';
10
5
 
11
6
  /**
@@ -17,7 +12,7 @@ import type { ClientOptions as ClientOptions2 } from './types.gen.js';
17
12
  * to ensure your client always has the correct values.
18
13
  */
19
14
  export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (
20
- override?: Config<ClientOptions & T>,
15
+ override?: Config<ClientOptions & T>
21
16
  ) => Config<Required<ClientOptions> & T>;
22
17
 
23
18
  export const client = createClient(createConfig<ClientOptions2>());
package/core/auth.gen.ts CHANGED
@@ -21,10 +21,9 @@ export interface Auth {
21
21
 
22
22
  export const getAuthToken = async (
23
23
  auth: Auth,
24
- callback: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken,
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,10 +1,6 @@
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.js';
3
+ import type { ArrayStyle, ObjectStyle, SerializerOptions } from './pathSerializer.gen.js';
8
4
 
9
5
  export type QuerySerializer = (query: Record<string, unknown>) => string;
10
6
 
@@ -24,11 +20,7 @@ export type QuerySerializerOptions = QuerySerializerOptionsObject & {
24
20
  parameters?: Record<string, QuerySerializerOptionsObject>;
25
21
  };
26
22
 
27
- const serializeFormDataPair = (
28
- data: FormData,
29
- key: string,
30
- value: unknown,
31
- ): void => {
23
+ const serializeFormDataPair = (data: FormData, key: string, value: unknown): void => {
32
24
  if (typeof value === 'string' || value instanceof Blob) {
33
25
  data.append(key, value);
34
26
  } else if (value instanceof Date) {
@@ -38,11 +30,7 @@ const serializeFormDataPair = (
38
30
  }
39
31
  };
40
32
 
41
- const serializeUrlSearchParamsPair = (
42
- data: URLSearchParams,
43
- key: string,
44
- value: unknown,
45
- ): void => {
33
+ const serializeUrlSearchParamsPair = (data: URLSearchParams, key: string, value: unknown): void => {
46
34
  if (typeof value === 'string') {
47
35
  data.append(key, value);
48
36
  } else {
@@ -52,7 +40,7 @@ const serializeUrlSearchParamsPair = (
52
40
 
53
41
  export const formDataBodySerializer = {
54
42
  bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(
55
- body: T,
43
+ body: T
56
44
  ): FormData => {
57
45
  const data = new FormData();
58
46
 
@@ -73,15 +61,11 @@ export const formDataBodySerializer = {
73
61
 
74
62
  export const jsonBodySerializer = {
75
63
  bodySerializer: <T>(body: T): string =>
76
- JSON.stringify(body, (_key, value) =>
77
- typeof value === 'bigint' ? value.toString() : value,
78
- ),
64
+ JSON.stringify(body, (_key, value) => (typeof value === 'bigint' ? value.toString() : value)),
79
65
  };
80
66
 
81
67
  export const urlSearchParamsBodySerializer = {
82
- bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(
83
- body: T,
84
- ): string => {
68
+ bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(body: T): string => {
85
69
  const data = new URLSearchParams();
86
70
 
87
71
  Object.entries(body).forEach(([key, value]) => {
@@ -102,10 +102,7 @@ const stripEmptySlots = (params: Params) => {
102
102
  }
103
103
  };
104
104
 
105
- export const buildClientParams = (
106
- args: ReadonlyArray<unknown>,
107
- fields: FieldsConfig,
108
- ) => {
105
+ export const buildClientParams = (args: ReadonlyArray<unknown>, fields: FieldsConfig) => {
109
106
  const params: Params = {
110
107
  body: {},
111
108
  headers: {},
@@ -148,15 +145,11 @@ export const buildClientParams = (
148
145
  params[field.map] = value;
149
146
  }
150
147
  } else {
151
- const extra = extraPrefixes.find(([prefix]) =>
152
- key.startsWith(prefix),
153
- );
148
+ const extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix));
154
149
 
155
150
  if (extra) {
156
151
  const [prefix, slot] = extra;
157
- (params[slot] as Record<string, unknown>)[
158
- key.slice(prefix.length)
159
- ] = value;
152
+ (params[slot] as Record<string, unknown>)[key.slice(prefix.length)] = value;
160
153
  } else if ('allowExtra' in config && config.allowExtra) {
161
154
  for (const [slot, allowed] of Object.entries(config.allowExtra)) {
162
155
  if (allowed) {
@@ -1,7 +1,6 @@
1
1
  // This file is auto-generated by @hey-api/openapi-ts
2
2
 
3
- interface SerializeOptions<T>
4
- extends SerializePrimitiveOptions, SerializerOptions<T> {}
3
+ interface SerializeOptions<T> extends SerializePrimitiveOptions, SerializerOptions<T> {}
5
4
 
6
5
  interface SerializePrimitiveOptions {
7
6
  allowReserved?: boolean;
@@ -104,9 +103,7 @@ export const serializeArrayParam = ({
104
103
  });
105
104
  })
106
105
  .join(separator);
107
- return style === 'label' || style === 'matrix'
108
- ? separator + joinedValues
109
- : joinedValues;
106
+ return style === 'label' || style === 'matrix' ? separator + joinedValues : joinedValues;
110
107
  };
111
108
 
112
109
  export const serializePrimitiveParam = ({
@@ -120,7 +117,7 @@ export const serializePrimitiveParam = ({
120
117
 
121
118
  if (typeof value === 'object') {
122
119
  throw new Error(
123
- 'Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.',
120
+ 'Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.'
124
121
  );
125
122
  }
126
123
 
@@ -145,11 +142,7 @@ export const serializeObjectParam = ({
145
142
  if (style !== 'deepObject' && !explode) {
146
143
  let values: string[] = [];
147
144
  Object.entries(value).forEach(([key, v]) => {
148
- values = [
149
- ...values,
150
- key,
151
- allowReserved ? (v as string) : encodeURIComponent(v as string),
152
- ];
145
+ values = [...values, key, allowReserved ? (v as string) : encodeURIComponent(v as string)];
153
146
  });
154
147
  const joinedValues = values.join(',');
155
148
  switch (style) {
@@ -171,10 +164,8 @@ export const serializeObjectParam = ({
171
164
  allowReserved,
172
165
  name: style === 'deepObject' ? `${name}[${key}]` : key,
173
166
  value: v as string,
174
- }),
167
+ })
175
168
  )
176
169
  .join(separator);
177
- return style === 'label' || style === 'matrix'
178
- ? separator + joinedValues
179
- : joinedValues;
170
+ return style === 'label' || style === 'matrix' ? separator + joinedValues : joinedValues;
180
171
  };
@@ -15,11 +15,7 @@ export type JsonValue =
15
15
  * Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes.
16
16
  */
17
17
  export const queryKeyJsonReplacer = (_key: string, value: unknown) => {
18
- if (
19
- value === undefined ||
20
- typeof value === 'function' ||
21
- typeof value === 'symbol'
22
- ) {
18
+ if (value === undefined || typeof value === 'function' || typeof value === 'symbol') {
23
19
  return undefined;
24
20
  }
25
21
  if (typeof value === 'bigint') {
@@ -61,9 +57,7 @@ const isPlainObject = (value: unknown): value is Record<string, unknown> => {
61
57
  * Turns URLSearchParams into a sorted JSON object for deterministic keys.
62
58
  */
63
59
  const serializeSearchParams = (params: URLSearchParams): JsonValue => {
64
- const entries = Array.from(params.entries()).sort(([a], [b]) =>
65
- a.localeCompare(b),
66
- );
60
+ const entries = Array.from(params.entries()).sort(([a], [b]) => a.localeCompare(b));
67
61
  const result: Record<string, JsonValue> = {};
68
62
 
69
63
  for (const [key, value] of entries) {
@@ -86,26 +80,16 @@ const serializeSearchParams = (params: URLSearchParams): JsonValue => {
86
80
  /**
87
81
  * Normalizes any accepted value into a JSON-friendly shape for query keys.
88
82
  */
89
- export const serializeQueryKeyValue = (
90
- value: unknown,
91
- ): JsonValue | undefined => {
83
+ export const serializeQueryKeyValue = (value: unknown): JsonValue | undefined => {
92
84
  if (value === null) {
93
85
  return null;
94
86
  }
95
87
 
96
- if (
97
- typeof value === 'string' ||
98
- typeof value === 'number' ||
99
- typeof value === 'boolean'
100
- ) {
88
+ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
101
89
  return value;
102
90
  }
103
91
 
104
- if (
105
- value === undefined ||
106
- typeof value === 'function' ||
107
- typeof value === 'symbol'
108
- ) {
92
+ if (value === undefined || typeof value === 'function' || typeof value === 'symbol') {
109
93
  return undefined;
110
94
  }
111
95
 
@@ -121,10 +105,7 @@ export const serializeQueryKeyValue = (
121
105
  return stringifyToJsonValue(value);
122
106
  }
123
107
 
124
- if (
125
- typeof URLSearchParams !== 'undefined' &&
126
- value instanceof URLSearchParams
127
- ) {
108
+ if (typeof URLSearchParams !== 'undefined' && value instanceof URLSearchParams) {
128
109
  return serializeSearchParams(value);
129
110
  }
130
111