@zayne-labs/callapi 1.12.6 → 1.14.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.
@@ -37,15 +37,7 @@ type CommonRequestHeaders = "Access-Control-Allow-Credentials" | "Access-Control
37
37
  type CommonAuthorizationHeaders = `${"Basic" | "Bearer" | "Token"} ${string}`;
38
38
  type CommonContentTypes = "application/epub+zip" | "application/gzip" | "application/json" | "application/ld+json" | "application/octet-stream" | "application/ogg" | "application/pdf" | "application/rtf" | "application/vnd.ms-fontobject" | "application/wasm" | "application/xhtml+xml" | "application/xml" | "application/zip" | "audio/aac" | "audio/mpeg" | "audio/ogg" | "audio/opus" | "audio/webm" | "audio/x-midi" | "font/otf" | "font/ttf" | "font/woff" | "font/woff2" | "image/avif" | "image/bmp" | "image/gif" | "image/jpeg" | "image/png" | "image/svg+xml" | "image/tiff" | "image/webp" | "image/x-icon" | "model/gltf-binary" | "model/gltf+json" | "text/calendar" | "text/css" | "text/csv" | "text/html" | "text/javascript" | "text/plain" | "video/3gpp" | "video/3gpp2" | "video/av1" | "video/mp2t" | "video/mp4" | "video/mpeg" | "video/ogg" | "video/webm" | "video/x-msvideo" | AnyString;
39
39
  //#endregion
40
- //#region src/constants/validation.d.ts
41
- declare const fallBackRouteSchemaKey = "@default";
42
- type FallBackRouteSchemaKey = typeof fallBackRouteSchemaKey;
43
- //#endregion
44
40
  //#region src/types/standard-schema.d.ts
45
- /**
46
- * The Standard Schema interface.
47
- * @see https://github.com/standard-schema/standard-schema
48
- */
49
41
  /** The Standard Typed interface. This is a base type extended by other specs. */
50
42
  interface StandardTypedV1<Input = unknown, Output = Input> {
51
43
  /** The Standard properties. */
@@ -115,13 +107,139 @@ declare namespace StandardSchemaV1 {
115
107
  readonly key: PropertyKey;
116
108
  }
117
109
  /** The Standard types interface. */
118
- type Types<Input = unknown, Output = Input> = StandardTypedV1.Types<Input, Output>;
110
+ interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {}
119
111
  /** Infers the input type of a Standard. */
120
112
  type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
121
113
  /** Infers the output type of a Standard. */
122
114
  type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
123
115
  }
124
116
  //#endregion
117
+ //#region src/constants/validation.d.ts
118
+ declare const fallBackRouteSchemaKey = "@default";
119
+ type FallBackRouteSchemaKey = typeof fallBackRouteSchemaKey;
120
+ //#endregion
121
+ //#region src/url.d.ts
122
+ declare const atSymbol = "@";
123
+ type AtSymbol = typeof atSymbol;
124
+ type AllowedQueryParamValues = UnmaskType<boolean | number | string>;
125
+ type RecordStyleParams = UnmaskType<Record<string, AllowedQueryParamValues>>;
126
+ type TupleStyleParams = UnmaskType<AllowedQueryParamValues[]>;
127
+ type Params = UnmaskType<RecordStyleParams | TupleStyleParams>;
128
+ type Query = UnmaskType<Record<string, AllowedQueryParamValues> | URLSearchParams>;
129
+ type InitURLOrURLObject = AnyString | RouteKeyMethodsURLUnion | URL;
130
+ interface URLOptions {
131
+ /**
132
+ * Base URL for all API requests. Will only be prepended to relative URLs.
133
+ *
134
+ * Absolute URLs (starting with http/https) will not be prepended by the baseURL.
135
+ *
136
+ * @example
137
+ * ```ts
138
+ * // Set base URL for all requests
139
+ * baseURL: "https://api.example.com/v1"
140
+ *
141
+ * // Then use relative URLs in requests
142
+ * callApi("/users") // → https://api.example.com/v1/users
143
+ * callApi("/posts/123") // → https://api.example.com/v1/posts/123
144
+ *
145
+ * // Environment-specific base URLs
146
+ * baseURL: process.env.NODE_ENV === "production"
147
+ * ? "https://api.example.com"
148
+ * : "http://localhost:3000/api"
149
+ * ```
150
+ */
151
+ baseURL?: string;
152
+ /**
153
+ * Resolved request URL after processing baseURL, parameters, and query strings (readonly)
154
+ *
155
+ * This is the final URL that will be used for the HTTP request, computed from
156
+ * baseURL, initURL, params, and query parameters.
157
+ *
158
+ */
159
+ readonly fullURL?: string;
160
+ /**
161
+ * The original URL string passed to the callApi instance (readonly)
162
+ *
163
+ * This preserves the original URL as provided, including any method modifiers like "@get/" or "@post/".
164
+ *
165
+ */
166
+ readonly initURL?: string;
167
+ /**
168
+ * The URL string after normalization, with method modifiers removed(readonly)
169
+ *
170
+ * Method modifiers like "@get/", "@post/" are stripped to create a clean URL
171
+ * for parameter substitution and final URL construction.
172
+ *
173
+ */
174
+ readonly initURLNormalized?: string;
175
+ /**
176
+ * Parameters to be substituted into URL path segments.
177
+ *
178
+ * Supports both object-style (named parameters) and array-style (positional parameters)
179
+ * for flexible URL parameter substitution.
180
+ *
181
+ * @example
182
+ * ```typescript
183
+ * // Object-style parameters (recommended)
184
+ * const namedParams: URLOptions = {
185
+ * initURL: "/users/:userId/posts/:postId",
186
+ * params: { userId: "123", postId: "456" }
187
+ * };
188
+ * // Results in: /users/123/posts/456
189
+ *
190
+ * // Array-style parameters (positional)
191
+ * const positionalParams: URLOptions = {
192
+ * initURL: "/users/:userId/posts/:postId",
193
+ * params: ["123", "456"] // Maps in order: userId=123, postId=456
194
+ * };
195
+ * // Results in: /users/123/posts/456
196
+ *
197
+ * // Single parameter
198
+ * const singleParam: URLOptions = {
199
+ * initURL: "/users/:id",
200
+ * params: { id: "user-123" }
201
+ * };
202
+ * // Results in: /users/user-123
203
+ * ```
204
+ */
205
+ params?: Params;
206
+ /**
207
+ * Query parameters to append to the URL as search parameters.
208
+ *
209
+ * These will be serialized into the URL query string using standard
210
+ * URL encoding practices.
211
+ *
212
+ * @example
213
+ * ```typescript
214
+ * // Basic query parameters
215
+ * const queryOptions: URLOptions = {
216
+ * initURL: "/users",
217
+ * query: {
218
+ * page: 1,
219
+ * limit: 10,
220
+ * search: "john doe",
221
+ * active: true
222
+ * }
223
+ * };
224
+ * // Results in: /users?page=1&limit=10&search=john%20doe&active=true
225
+ *
226
+ * // Filtering and sorting
227
+ * const filterOptions: URLOptions = {
228
+ * initURL: "/products",
229
+ * query: {
230
+ * category: "electronics",
231
+ * minPrice: 100,
232
+ * maxPrice: 500,
233
+ * sortBy: "price",
234
+ * order: "asc"
235
+ * }
236
+ * };
237
+ * // Results in: /products?category=electronics&minPrice=100&maxPrice=500&sortBy=price&order=asc
238
+ * ```
239
+ */
240
+ query?: Query;
241
+ }
242
+ //#endregion
125
243
  //#region src/validation.d.ts
126
244
  type ResultVariant = "infer-input" | "infer-output";
127
245
  type InferSchemaResult<TSchema, TFallbackResult, TResultVariant extends ResultVariant> = undefined extends TSchema ? TFallbackResult : TSchema extends StandardSchemaV1 ? TResultVariant extends "infer-input" ? StandardSchemaV1.InferInput<TSchema> : StandardSchemaV1.InferOutput<TSchema> : TSchema extends AnyFunction<infer TResult> ? Awaited<TResult> : TFallbackResult;
@@ -223,127 +341,307 @@ declare const getCurrentRouteSchemaKeyAndMainInitURL: (context: Pick<GetResolved
223
341
  mainInitURL: string;
224
342
  };
225
343
  //#endregion
226
- //#region src/url.d.ts
227
- declare const atSymbol = "@";
228
- type AtSymbol = typeof atSymbol;
229
- type AllowedQueryParamValues = UnmaskType<boolean | number | string>;
230
- type RecordStyleParams = UnmaskType<Record<string, AllowedQueryParamValues>>;
231
- type TupleStyleParams = UnmaskType<AllowedQueryParamValues[]>;
232
- type Params = UnmaskType<RecordStyleParams | TupleStyleParams>;
233
- type Query = UnmaskType<Record<string, AllowedQueryParamValues> | URLSearchParams>;
234
- type InitURLOrURLObject = AnyString | RouteKeyMethodsURLUnion | URL;
235
- interface URLOptions {
344
+ //#region src/utils/external/error.d.ts
345
+ type HTTPErrorDetails<TErrorData> = Pick<CallApiExtraOptions, "defaultHTTPErrorMessage"> & {
346
+ errorData: TErrorData;
347
+ response: Response;
348
+ };
349
+ declare class HTTPError<TErrorData = Record<string, unknown>> extends Error {
350
+ errorData: HTTPErrorDetails<TErrorData>["errorData"];
351
+ readonly httpErrorSymbol: symbol;
352
+ name: "HTTPError";
353
+ response: HTTPErrorDetails<TErrorData>["response"];
354
+ constructor(errorDetails: HTTPErrorDetails<TErrorData>, errorOptions?: ErrorOptions);
236
355
  /**
237
- * Base URL for all API requests. Will only be prepended to relative URLs.
238
- *
239
- * Absolute URLs (starting with http/https) will not be prepended by the baseURL.
240
- *
241
- * @example
242
- * ```ts
243
- * // Set base URL for all requests
244
- * baseURL: "https://api.example.com/v1"
245
- *
246
- * // Then use relative URLs in requests
247
- * callApi("/users") // → https://api.example.com/v1/users
248
- * callApi("/posts/123") // → https://api.example.com/v1/posts/123
249
- *
250
- * // Environment-specific base URLs
251
- * baseURL: process.env.NODE_ENV === "production"
252
- * ? "https://api.example.com"
253
- * : "http://localhost:3000/api"
254
- * ```
356
+ * @description Checks if the given error is an instance of HTTPError
357
+ * @param error - The error to check
358
+ * @returns true if the error is an instance of HTTPError, false otherwise
255
359
  */
256
- baseURL?: string;
360
+ static isError<TErrorData>(error: unknown): error is HTTPError<TErrorData>;
361
+ }
362
+ type SafeExtract<TUnion, TKey extends TUnion> = Extract<TUnion, TKey>;
363
+ type ValidationErrorDetails = {
257
364
  /**
258
- * Resolved request URL after processing baseURL, parameters, and query strings (readonly)
259
- *
260
- * This is the final URL that will be used for the HTTP request, computed from
261
- * baseURL, initURL, params, and query parameters.
365
+ * The cause of the validation error.
262
366
  *
367
+ * It's either the name the schema for which validation failed, or the name of the schema config option that led to the validation error.
263
368
  */
264
- readonly fullURL?: string;
369
+ issueCause: "toFormData" | "toQueryString" | "unknown" | `schemaConfig-(${SafeExtract<keyof CallApiSchemaConfig, "strict">})` | keyof CallApiSchema;
265
370
  /**
266
- * The original URL string passed to the callApi instance (readonly)
267
- *
268
- * This preserves the original URL as provided, including any method modifiers like "@get/" or "@post/".
269
- *
371
+ * The issues that caused the validation error.
270
372
  */
271
- readonly initURL?: string;
373
+ issues: readonly StandardSchemaV1.Issue[];
272
374
  /**
273
- * The URL string after normalization, with method modifiers removed(readonly)
274
- *
275
- * Method modifiers like "@get/", "@post/" are stripped to create a clean URL
276
- * for parameter substitution and final URL construction.
277
- *
375
+ * The response from server, if any.
278
376
  */
279
- readonly initURLNormalized?: string;
377
+ response: Response | null;
378
+ };
379
+ declare class ValidationError extends Error {
380
+ errorData: ValidationErrorDetails["issues"];
381
+ issueCause: ValidationErrorDetails["issueCause"];
382
+ name: "ValidationError";
383
+ response: ValidationErrorDetails["response"];
384
+ readonly validationErrorSymbol: symbol;
385
+ constructor(details: ValidationErrorDetails, errorOptions?: ErrorOptions);
280
386
  /**
281
- * Parameters to be substituted into URL path segments.
387
+ * @description Checks if the given error is an instance of ValidationError
388
+ * @param error - The error to check
389
+ * @returns true if the error is an instance of ValidationError, false otherwise
390
+ */
391
+ static isError(error: unknown): error is ValidationError;
392
+ }
393
+ //#endregion
394
+ //#region src/result.d.ts
395
+ type ResponseParser<TData> = (text: string) => Awaitable<TData>;
396
+ declare const getResponseType: <TData>(response: Response, responseParser: ResponseParser<TData>) => {
397
+ arrayBuffer: () => Promise<ArrayBuffer>;
398
+ blob: () => Promise<Blob>;
399
+ formData: () => Promise<FormData>;
400
+ json: () => Promise<TData>;
401
+ stream: () => ReadableStream<Uint8Array<ArrayBuffer>> | null;
402
+ text: () => Promise<string>;
403
+ };
404
+ type InitResponseTypeMap<TData = unknown> = ReturnType<typeof getResponseType<TData>>;
405
+ type ResponseTypeUnion = keyof InitResponseTypeMap;
406
+ type ResponseTypePlaceholder = null;
407
+ type ResponseTypeType = ResponseTypePlaceholder | ResponseTypeUnion;
408
+ type ResponseTypeMap<TData> = { [Key in keyof InitResponseTypeMap<TData>]: Awaited<ReturnType<InitResponseTypeMap<TData>[Key]>> };
409
+ type GetResponseType<TData, TResponseType extends ResponseTypeType, TComputedResponseTypeMap extends ResponseTypeMap<TData> = ResponseTypeMap<TData>> = null extends TResponseType ? TComputedResponseTypeMap["json"] : TResponseType extends NonNullable<ResponseTypeType> ? TComputedResponseTypeMap[TResponseType] : never;
410
+ type CallApiResultSuccessVariant<TData> = {
411
+ data: NoInferUnMasked<TData>;
412
+ error: null;
413
+ response: Response;
414
+ };
415
+ type PossibleJavaScriptError = UnmaskType<{
416
+ errorData: false;
417
+ message: string;
418
+ name: "AbortError" | "Error" | "SyntaxError" | "TimeoutError" | "TypeError" | AnyString;
419
+ originalError: DOMException | Error | SyntaxError | TypeError;
420
+ }>;
421
+ type PossibleHTTPError<TErrorData> = UnmaskType<{
422
+ errorData: NoInferUnMasked<TErrorData>;
423
+ message: string;
424
+ name: "HTTPError";
425
+ originalError: HTTPError;
426
+ }>;
427
+ type PossibleValidationError = UnmaskType<{
428
+ errorData: ValidationError["errorData"];
429
+ issueCause: ValidationError["issueCause"];
430
+ message: string;
431
+ name: "ValidationError";
432
+ originalError: ValidationError;
433
+ }>;
434
+ type CallApiResultErrorVariant<TErrorData> = {
435
+ data: null;
436
+ error: PossibleHTTPError<TErrorData>;
437
+ response: Response;
438
+ } | {
439
+ data: null;
440
+ error: PossibleJavaScriptError;
441
+ response: Response | null;
442
+ } | {
443
+ data: null;
444
+ error: PossibleValidationError;
445
+ response: Response | null;
446
+ };
447
+ type CallApiResultSuccessOrErrorVariant<TData, TError> = CallApiResultErrorVariant<TError> | CallApiResultSuccessVariant<TData>;
448
+ type GetCallApiResult<TThrowOnError extends ThrowOnErrorBoolean, TResultWithException extends CallApiResultSuccessVariant<unknown>, TResultWithoutException extends CallApiResultSuccessOrErrorVariant<unknown, unknown>> = TThrowOnError extends true ? TResultWithException : TResultWithoutException;
449
+ type ResultModeMap<TData = DefaultDataType, TErrorData = DefaultDataType, TThrowOnError extends ThrowOnErrorBoolean = DefaultThrowOnError, TComputedResult extends GetCallApiResult<TThrowOnError, CallApiResultSuccessVariant<TData>, CallApiResultSuccessOrErrorVariant<TData, TErrorData>> = GetCallApiResult<TThrowOnError, CallApiResultSuccessVariant<TData>, CallApiResultSuccessOrErrorVariant<TData, TErrorData>>> = UnmaskType<{
450
+ all: TComputedResult;
451
+ fetchApi: TComputedResult["response"];
452
+ onlyData: TComputedResult["data"];
453
+ onlyResponse: TComputedResult["response"];
454
+ withoutResponse: Prettify<DistributiveOmit<TComputedResult, "response">>;
455
+ }>;
456
+ type ResultModePlaceholder = null;
457
+ type ResultModeUnion = keyof ResultModeMap;
458
+ type ResultModeType = ResultModePlaceholder | ResultModeUnion;
459
+ type InferCallApiResult<TData, TErrorData, TResultMode extends ResultModeType, TThrowOnError extends ThrowOnErrorBoolean, TComputedResultModeMapWithException extends ResultModeMap<TData, TErrorData, true> = ResultModeMap<TData, TErrorData, true>, TComputedResultModeMapWithoutException extends ResultModeMap<TData, TErrorData, TThrowOnError> = ResultModeMap<TData, TErrorData, TThrowOnError>> = TErrorData extends false ? TComputedResultModeMapWithException["onlyData"] : TErrorData extends false | undefined ? TComputedResultModeMapWithException["onlyData"] : ResultModePlaceholder extends TResultMode ? TComputedResultModeMapWithoutException["all"] : TResultMode extends ResultModeUnion ? TComputedResultModeMapWithoutException[TResultMode] : never;
460
+ type ErrorInfoOptions = Pick<CallApiExtraOptions, "cloneResponse" | "resultMode"> & {
461
+ message?: string;
462
+ };
463
+ //#endregion
464
+ //#region src/middlewares.d.ts
465
+ type FetchImpl = UnmaskType<(input: string | Request | URL, init?: RequestInit) => Awaitable<Response>>;
466
+ type FetchMiddlewareContext<TCallApiContext extends CallApiContext> = RequestContext<TCallApiContext> & {
467
+ fetchImpl: FetchImpl;
468
+ };
469
+ interface Middlewares<TCallApiContext extends NoInfer<CallApiContext> = DefaultCallApiContext> {
470
+ /**
471
+ * Wraps the fetch implementation to intercept requests at the network layer.
282
472
  *
283
- * Supports both object-style (named parameters) and array-style (positional parameters)
284
- * for flexible URL parameter substitution.
473
+ * Takes a context object containing the current fetch function and returns a new fetch function.
474
+ * Use it to cache responses, add logging, handle offline mode, or short-circuit requests etc.
475
+ * Multiple middleware compose in order: plugins → base config → per-request.
285
476
  *
286
- * @example
287
- * ```typescript
288
- * // Object-style parameters (recommended)
289
- * const namedParams: URLOptions = {
290
- * initURL: "/users/:userId/posts/:postId",
291
- * params: { userId: "123", postId: "456" }
292
- * };
293
- * // Results in: /users/123/posts/456
477
+ * Unlike `customFetchImpl`, middleware can call through to the original fetch.
294
478
  *
295
- * // Array-style parameters (positional)
296
- * const positionalParams: URLOptions = {
297
- * initURL: "/users/:userId/posts/:postId",
298
- * params: ["123", "456"] // Maps in order: userId=123, postId=456
299
- * };
300
- * // Results in: /users/123/posts/456
479
+ * @example
480
+ * ```ts
481
+ * // Cache responses
482
+ * const cache = new Map();
301
483
  *
302
- * // Single parameter
303
- * const singleParam: URLOptions = {
304
- * initURL: "/users/:id",
305
- * params: { id: "user-123" }
306
- * };
307
- * // Results in: /users/user-123
308
- * ```
309
- */
310
- params?: Params;
311
- /**
312
- * Query parameters to append to the URL as search parameters.
484
+ * fetchMiddleware: (ctx) => async (input, init) => {
485
+ * const key = input.toString();
313
486
  *
314
- * These will be serialized into the URL query string using standard
315
- * URL encoding practices.
487
+ * const cachedResponse = cache.get(key);
316
488
  *
317
- * @example
318
- * ```typescript
319
- * // Basic query parameters
320
- * const queryOptions: URLOptions = {
321
- * initURL: "/users",
322
- * query: {
323
- * page: 1,
324
- * limit: 10,
325
- * search: "john doe",
326
- * active: true
489
+ * if (cachedResponse) {
490
+ * return cachedResponse.clone();
327
491
  * }
328
- * };
329
- * // Results in: /users?page=1&limit=10&search=john%20doe&active=true
330
492
  *
331
- * // Filtering and sorting
332
- * const filterOptions: URLOptions = {
333
- * initURL: "/products",
334
- * query: {
335
- * category: "electronics",
336
- * minPrice: 100,
337
- * maxPrice: 500,
338
- * sortBy: "price",
339
- * order: "asc"
493
+ * const response = await ctx.fetchImpl(input, init);
494
+ * cache.set(key, response.clone());
495
+ *
496
+ * return response;
497
+ * }
498
+ *
499
+ * // Handle offline
500
+ * fetchMiddleware: (ctx) => async (...parameters) => {
501
+ * if (!navigator.onLine) {
502
+ * return new Response('{"error": "offline"}', { status: 503 });
340
503
  * }
341
- * };
342
- * // Results in: /products?category=electronics&minPrice=100&maxPrice=500&sortBy=price&order=asc
504
+ *
505
+ * return ctx.fetchImpl(...parameters);
506
+ * }
343
507
  * ```
344
508
  */
345
- query?: Query;
509
+ fetchMiddleware?: (context: FetchMiddlewareContext<TCallApiContext>) => FetchImpl;
510
+ }
511
+ //#endregion
512
+ //#region src/plugins.d.ts
513
+ type PluginSetupContext<TCallApiContext extends CallApiContext = DefaultCallApiContext> = RequestContext<TCallApiContext> & ReturnType<typeof getCurrentRouteSchemaKeyAndMainInitURL>;
514
+ type PluginInitResult<TCallApiContext extends CallApiContext = DefaultCallApiContext> = Partial<Omit<PluginSetupContext<TCallApiContext>, "initURL" | "request"> & {
515
+ initURL: InitURLOrURLObject;
516
+ request: CallApiRequestOptions;
517
+ }>;
518
+ type GetDefaultDataTypeForPlugins<TData> = DefaultDataType extends TData ? never : TData;
519
+ type PluginHooks<TCallApiContext extends CallApiContext = DefaultCallApiContext> = HooksOrHooksArray<OverrideCallApiContext<TCallApiContext, {
520
+ Data: GetDefaultDataTypeForPlugins<TCallApiContext["Data"]>;
521
+ ErrorData: GetDefaultDataTypeForPlugins<TCallApiContext["ErrorData"]>;
522
+ }>>;
523
+ type PluginMiddlewares<TCallApiContext extends CallApiContext = DefaultCallApiContext> = Middlewares<OverrideCallApiContext<TCallApiContext, {
524
+ Data: GetDefaultDataTypeForPlugins<TCallApiContext["Data"]>;
525
+ ErrorData: GetDefaultDataTypeForPlugins<TCallApiContext["ErrorData"]>;
526
+ }>>;
527
+ interface CallApiPlugin<TCallApiContext extends CallApiContext = DefaultCallApiContext> {
528
+ /**
529
+ * Defines additional options that can be passed to callApi
530
+ */
531
+ defineExtraOptions?: () => TCallApiContext["InferredExtraOptions"];
532
+ /**
533
+ * A description for the plugin
534
+ */
535
+ description?: string;
536
+ /**
537
+ * Hooks for the plugin
538
+ */
539
+ hooks?: PluginHooks<TCallApiContext> | ((context: PluginSetupContext<TCallApiContext>) => Awaitable<PluginHooks<TCallApiContext>> | Awaitable<void>);
540
+ /**
541
+ * A unique id for the plugin
542
+ */
543
+ id: string;
544
+ /**
545
+ * Middlewares that for the plugin
546
+ */
547
+ middlewares?: PluginMiddlewares<TCallApiContext> | ((context: PluginSetupContext<TCallApiContext>) => Awaitable<PluginMiddlewares<TCallApiContext>> | Awaitable<void>);
548
+ /**
549
+ * A name for the plugin
550
+ */
551
+ name: string;
552
+ /**
553
+ * Base schema for the client.
554
+ */
555
+ schema?: BaseCallApiSchemaAndConfig;
556
+ /**
557
+ * A function that will be called when the plugin is initialized. This will be called before the any of the other internal functions.
558
+ */
559
+ setup?: (context: PluginSetupContext<TCallApiContext>) => Awaitable<PluginInitResult<TCallApiContext>> | Awaitable<void>;
560
+ /**
561
+ * A version for the plugin
562
+ */
563
+ version?: string;
346
564
  }
565
+ type InferPluginExtraOptions<TPluginArray extends CallApiPlugin[]> = UnionToIntersection<TPluginArray extends Array<infer TPlugin> ? TPlugin extends CallApiPlugin ? TPlugin["defineExtraOptions"] extends AnyFunction<infer TResult> ? InferSchemaOutput<TResult, TResult> : never : never : never>;
566
+ //#endregion
567
+ //#region src/types/default-types.d.ts
568
+ type DefaultDataType = unknown;
569
+ type DefaultPluginArray = CallApiPlugin[];
570
+ type DefaultThrowOnError = boolean;
571
+ type DefaultMetaObject = Record<string, unknown>;
572
+ type DefaultCallApiContext = Prettify<OverrideCallApiContext<Required<CallApiContext>, {
573
+ Meta: GlobalMeta;
574
+ }>>;
575
+ //#endregion
576
+ //#region src/utils/external/body.d.ts
577
+ type BodyType = NonNullable<CallApiRequestOptions["body"]>;
578
+ declare const toSearchParams: <TSchema extends CallApiSchemaType<BodyType>>(data: InferSchemaOutput<TSchema>, schema?: TSchema) => URLSearchParams;
579
+ declare const toQueryString: <TSchema extends CallApiSchemaType<BodyType>>(...parameters: Parameters<typeof toSearchParams<TSchema>>) => string;
580
+ /**
581
+ * @description Converts a plain object to FormData.
582
+ *
583
+ * Handles various data types:
584
+ * - **Primitives** (string, number, boolean): Converted to strings
585
+ * - **Blobs/Files**: Added directly to FormData
586
+ * - **Arrays**: Each item is appended (allows multiple values for same key)
587
+ * - **Objects**: JSON stringified before adding to FormData
588
+ *
589
+ * @example
590
+ * ```ts
591
+ * // Basic usage
592
+ * const formData = toFormData({
593
+ * name: "John",
594
+ * age: 30,
595
+ * active: true
596
+ * });
597
+ *
598
+ * // With arrays
599
+ * const formData = toFormData({
600
+ * tags: ["javascript", "typescript"],
601
+ * name: "John"
602
+ * });
603
+ *
604
+ * // With files
605
+ * const formData = toFormData({
606
+ * avatar: fileBlob,
607
+ * name: "John"
608
+ * });
609
+ *
610
+ * // With nested objects (one level only)
611
+ * const formData = toFormData({
612
+ * user: { name: "John", age: 30 },
613
+ * settings: { theme: "dark" }
614
+ * });
615
+ */
616
+ declare const toFormData: <TSchema extends CallApiSchemaType<BodyType>>(data: InferSchemaOutput<TSchema>, schema?: TSchema) => FormData;
617
+ //#endregion
618
+ //#region src/utils/external/define.d.ts
619
+ declare const defineSchema: <const TBaseSchemaRoutes extends BaseCallApiSchemaRoutes, const TSchemaConfig extends CallApiSchemaConfig>(routes: TBaseSchemaRoutes, config?: Satisfies<TSchemaConfig, CallApiSchemaConfig>) => {
620
+ config: Writeable<Satisfies<TSchemaConfig, CallApiSchemaConfig>, "deep">;
621
+ routes: Writeable<TBaseSchemaRoutes, "deep">;
622
+ };
623
+ declare const defineSchemaRoutes: <const TSchemaRoutes extends BaseCallApiSchemaRoutes>(routes: TSchemaRoutes) => Writeable<typeof routes, "deep">;
624
+ declare const defineMainSchema: <const TSchema extends CallApiSchema>(mainSchema: Satisfies<TSchema, CallApiSchema>) => Writeable<typeof mainSchema, "deep">;
625
+ declare const defineSchemaConfig: <const TSchemaConfig extends CallApiSchemaConfig>(config: Satisfies<TSchemaConfig, CallApiSchemaConfig>) => Writeable<typeof config, "deep">;
626
+ declare const definePlugin: <const TPlugin extends CallApiPlugin>(plugin: TPlugin) => Writeable<typeof plugin, "deep">;
627
+ type BaseConfigObject = Exclude<BaseCallApiConfig, AnyFunction>;
628
+ type BaseConfigFn = Extract<BaseCallApiConfig, AnyFunction>;
629
+ type DefineBaseConfig = {
630
+ <const TBaseConfig extends BaseConfigObject>(baseConfig: Satisfies<TBaseConfig, BaseConfigObject>): Writeable<typeof baseConfig, "deep">;
631
+ <const TBaseConfig extends BaseConfigObject>(baseConfig: (...parameters: Parameters<BaseConfigFn>) => Writeable<TBaseConfig, "deep">): typeof baseConfig;
632
+ };
633
+ declare const defineBaseConfig: DefineBaseConfig;
634
+ declare const defineInstanceConfig: <const TInstanceConfig extends CallApiConfig>(config: TInstanceConfig) => Writeable<typeof config, "deep">;
635
+ //#endregion
636
+ //#region src/utils/external/guards.d.ts
637
+ declare const isHTTPError: <TErrorData>(error: CallApiResultErrorVariant<TErrorData>["error"] | null) => error is PossibleHTTPError<TErrorData>;
638
+ declare const isHTTPErrorInstance: <TErrorData>(error: unknown) => error is HTTPError<TErrorData>;
639
+ declare const isValidationError: (error: CallApiResultErrorVariant<unknown>["error"] | null) => error is PossibleValidationError;
640
+ declare const isValidationErrorInstance: (error: unknown) => error is ValidationError;
641
+ declare const isJavascriptError: (error: CallApiResultErrorVariant<unknown>["error"] | null) => error is PossibleJavaScriptError;
642
+ //#endregion
643
+ //#region src/utils/external/headers.d.ts
644
+ declare const objectifyHeaders: (headers: CallApiRequestOptions["headers"]) => Record<string, string>;
347
645
  //#endregion
348
646
  //#region src/retry.d.ts
349
647
  declare const defaultRetryStatusCodesLookup: () => Readonly<{
@@ -360,9 +658,10 @@ type RetryStatusCodes = UnmaskType<AnyNumber | keyof ReturnType<typeof defaultRe
360
658
  type RetryCondition<TErrorData> = (context: ErrorContext<{
361
659
  ErrorData: TErrorData;
362
660
  }>) => Awaitable<boolean>;
661
+ type CallApiLooseImpl = (initURL: InitURLOrURLObject, init?: CallApiConfig) => Promise<CallApiResultLoose<unknown, unknown>>;
363
662
  interface RetryOptions<TErrorData> {
364
663
  /**
365
- * Keeps track of the number of times the request has already been retried internally
664
+ * Tracks the number of times the request has already been retried internally
366
665
  * @internal
367
666
  * @deprecated **WARNING**: This property is used internally to track retries. Please abstain from reading or modifying it.
368
667
  */
@@ -401,41 +700,37 @@ interface RetryOptions<TErrorData> {
401
700
  */
402
701
  retryStrategy?: "exponential" | "linear";
403
702
  }
703
+ type RetryManagerContext = {
704
+ callApi: CallApiLooseImpl;
705
+ callApiArgs: {
706
+ config: CallApiConfig;
707
+ initURL: InitURLOrURLObject;
708
+ };
709
+ error: unknown;
710
+ errorContext: ErrorContext;
711
+ hookInfo: ExecuteHookInfo;
712
+ removeDedupeCacheEntry: () => void;
713
+ };
404
714
  //#endregion
405
715
  //#region src/refetch.d.ts
406
- interface RefetchOptions {
407
- /**
408
- * Tracks the number of times the request has been refetched internally
409
- * @internal
410
- * @deprecated **WARNING**: This property is used internally to track refetch calls. Please abstain from reading or modifying it.
411
- */
412
- readonly ["~refetchCount"]?: number;
413
- /**
414
- * Maximum number of times refetch can be called from error hooks.
415
- *
416
- * Prevents infinite loops when refetch is called repeatedly in error hooks.
417
- * When the limit is reached, refetch will throw an error instead of retrying.
418
- *
419
- * @default 1
420
- *
421
- * @example
422
- * ```ts
423
- * // Allow up to 5 refetch attempts
424
- * refetchAttempts: 5
425
- *
426
- * // Disable refetch limit
427
- * refetchAttempts: Infinity
428
- *
429
- * // Strict limit of 1 refetch
430
- * refetchAttempts: 1
431
- * ```
716
+ declare const shouldAttemptRefetchSymbol: unique symbol;
717
+ interface RefetchOptions {
718
+ /**
719
+ * Tracks if the refetching of the request should be attempted
720
+ * @internal
721
+ * @deprecated **WARNING**: This property is used internally to track retries. Please abstain from reading or modifying it.
432
722
  */
433
- refetchAttempts?: number;
723
+ [shouldAttemptRefetchSymbol]?: boolean;
434
724
  }
435
- type RefetchFn = (overrides?: Pick<RefetchOptions, "refetchAttempts">) => Promise<CallApiResultLoose<unknown, unknown> | null>;
436
- interface RefetchFnOption {
725
+ type RefetchFn = () => void;
726
+ type RefetchManagerResult = {
727
+ handleRefetch: () => Promise<CallApiResultLoose<unknown, unknown>> | null;
437
728
  refetch: RefetchFn;
438
- }
729
+ };
730
+ declare const createRefetchManager: (ctx: Pick<RetryManagerContext, "callApi" | "callApiArgs" | "removeDedupeCacheEntry"> & {
731
+ options: CallApiExtraOptions;
732
+ }) => RefetchManagerResult;
733
+ type RefetchFnOption = Pick<ReturnType<typeof createRefetchManager>, "refetch">;
439
734
  //#endregion
440
735
  //#region src/stream.d.ts
441
736
  type StreamProgressEvent = {
@@ -463,7 +758,7 @@ type StreamProgressEvent = {
463
758
  type CallApiRequestOptionsForHooks = Omit<CallApiRequestOptions, "headers"> & {
464
759
  headers: Partial<Record<"Authorization" | "Content-Type" | CommonRequestHeaders, string>>;
465
760
  };
466
- type CallApiExtraOptionsForHooks<TCallApiContext extends CallApiContext = DefaultCallApiContext> = Hooks & Omit<CallApiExtraOptions<TCallApiContext>, keyof Hooks> & RefetchFnOption;
761
+ type CallApiExtraOptionsForHooks<TCallApiContext extends CallApiContext = DefaultCallApiContext> = Hooks & Omit<CallApiExtraOptions<TCallApiContext>, keyof Hooks> & Pick<RefetchFnOption, "refetch">;
467
762
  interface Hooks<TCallApiContext extends CallApiContext = DefaultCallApiContext> {
468
763
  /**
469
764
  * Hook called when any error occurs within the request/response lifecycle.
@@ -659,6 +954,10 @@ type ResponseErrorContext<TCallApiContext extends Pick<CallApiContext, "ErrorDat
659
954
  type RetryContext<TCallApiContext extends Pick<CallApiContext, "ErrorData" | "InferredExtraOptions" | "Meta"> = DefaultCallApiContext> = ErrorContext<TCallApiContext> & {
660
955
  retryAttemptCount: number;
661
956
  };
957
+ type ExecuteHookInfo = {
958
+ errorInfoOptions: ErrorInfoOptions;
959
+ shouldThrowOnError: boolean | undefined;
960
+ };
662
961
  //#endregion
663
962
  //#region src/dedupe.d.ts
664
963
  type DedupeStrategyUnion = UnmaskType<"cancel" | "defer" | "none">;
@@ -870,104 +1169,6 @@ type DedupeOptions = {
870
1169
  dedupeStrategy?: DedupeStrategyUnion | ((context: RequestContext) => DedupeStrategyUnion);
871
1170
  };
872
1171
  //#endregion
873
- //#region src/middlewares.d.ts
874
- type FetchImpl = UnmaskType<(input: string | Request | URL, init?: RequestInit) => Awaitable<Response>>;
875
- type FetchMiddlewareContext<TCallApiContext extends CallApiContext> = RequestContext<TCallApiContext> & {
876
- fetchImpl: FetchImpl;
877
- };
878
- interface Middlewares<TCallApiContext extends NoInfer<CallApiContext> = DefaultCallApiContext> {
879
- /**
880
- * Wraps the fetch implementation to intercept requests at the network layer.
881
- *
882
- * Takes a context object containing the current fetch function and returns a new fetch function.
883
- * Use it to cache responses, add logging, handle offline mode, or short-circuit requests etc.
884
- * Multiple middleware compose in order: plugins → base config → per-request.
885
- *
886
- * Unlike `customFetchImpl`, middleware can call through to the original fetch.
887
- *
888
- * @example
889
- * ```ts
890
- * // Cache responses
891
- * const cache = new Map();
892
- *
893
- * fetchMiddleware: (ctx) => async (input, init) => {
894
- * const key = input.toString();
895
- *
896
- * const cachedResponse = cache.get(key);
897
- *
898
- * if (cachedResponse) {
899
- * return cachedResponse.clone();
900
- * }
901
- *
902
- * const response = await ctx.fetchImpl(input, init);
903
- * cache.set(key, response.clone());
904
- *
905
- * return response;
906
- * }
907
- *
908
- * // Handle offline
909
- * fetchMiddleware: (ctx) => async (...parameters) => {
910
- * if (!navigator.onLine) {
911
- * return new Response('{"error": "offline"}', { status: 503 });
912
- * }
913
- *
914
- * return ctx.fetchImpl(...parameters);
915
- * }
916
- * ```
917
- */
918
- fetchMiddleware?: (context: FetchMiddlewareContext<TCallApiContext>) => FetchImpl;
919
- }
920
- //#endregion
921
- //#region src/utils/external/error.d.ts
922
- type HTTPErrorDetails<TErrorData> = Pick<CallApiExtraOptions, "defaultHTTPErrorMessage"> & {
923
- errorData: TErrorData;
924
- response: Response;
925
- };
926
- declare class HTTPError<TErrorData = Record<string, unknown>> extends Error {
927
- errorData: HTTPErrorDetails<TErrorData>["errorData"];
928
- readonly httpErrorSymbol: symbol;
929
- name: "HTTPError";
930
- response: HTTPErrorDetails<TErrorData>["response"];
931
- constructor(errorDetails: HTTPErrorDetails<TErrorData>, errorOptions?: ErrorOptions);
932
- /**
933
- * @description Checks if the given error is an instance of HTTPError
934
- * @param error - The error to check
935
- * @returns true if the error is an instance of HTTPError, false otherwise
936
- */
937
- static isError<TErrorData>(error: unknown): error is HTTPError<TErrorData>;
938
- }
939
- type SafeExtract<TUnion, TKey extends TUnion> = Extract<TUnion, TKey>;
940
- type ValidationErrorDetails = {
941
- /**
942
- * The cause of the validation error.
943
- *
944
- * It's either the name the schema for which validation failed, or the name of the schema config option that led to the validation error.
945
- */
946
- issueCause: "toFormData" | "toQueryString" | "unknown" | `schemaConfig-(${SafeExtract<keyof CallApiSchemaConfig, "strict">})` | keyof CallApiSchema;
947
- /**
948
- * The issues that caused the validation error.
949
- */
950
- issues: readonly StandardSchemaV1.Issue[];
951
- /**
952
- * The response from server, if any.
953
- */
954
- response: Response | null;
955
- };
956
- declare class ValidationError extends Error {
957
- errorData: ValidationErrorDetails["issues"];
958
- issueCause: ValidationErrorDetails["issueCause"];
959
- name: "ValidationError";
960
- response: ValidationErrorDetails["response"];
961
- readonly validationErrorSymbol: symbol;
962
- constructor(details: ValidationErrorDetails, errorOptions?: ErrorOptions);
963
- /**
964
- * @description Checks if the given error is an instance of ValidationError
965
- * @param error - The error to check
966
- * @returns true if the error is an instance of ValidationError, false otherwise
967
- */
968
- static isError(error: unknown): error is ValidationError;
969
- }
970
- //#endregion
971
1172
  //#region src/types/options-types.d.ts
972
1173
  interface Register {}
973
1174
  type GlobalMeta = Register extends {
@@ -993,11 +1194,11 @@ type ModifiedRequestInit = RequestInit & {
993
1194
  */
994
1195
  extraFetchOptions?: RequestInit;
995
1196
  };
996
- type CallApiRequestOptions = {
1197
+ type CallApiRequestOptions<TBody = Body> = {
997
1198
  /**
998
1199
  * Body of the request, can be a object or any other supported body type.
999
1200
  */
1000
- body?: Body;
1201
+ body?: TBody;
1001
1202
  /**
1002
1203
  * Headers to be used in the request.
1003
1204
  */
@@ -1008,7 +1209,7 @@ type CallApiRequestOptions = {
1008
1209
  */
1009
1210
  method?: MethodUnion;
1010
1211
  } & Pick<ModifiedRequestInit, FetchSpecificKeysUnion>;
1011
- type SharedExtraOptions<TCallApiContext extends CallApiContext = DefaultCallApiContext, TData = DefaultDataType, TErrorData = DefaultDataType, TResultMode extends ResultModeType = ResultModeType, TThrowOnError extends ThrowOnErrorBoolean = DefaultThrowOnError, TResponseType extends ResponseTypeType = ResponseTypeType, TPluginArray extends CallApiPlugin[] = DefaultPluginArray, TComputedMergedPluginExtraOptions = Partial<InferPluginExtraOptions<TPluginArray> & InferSchemaOutput<TCallApiContext["InferredExtraOptions"], TCallApiContext["InferredExtraOptions"]>>, TComputedCallApiContext extends CallApiContext = OverrideCallApiContext<TCallApiContext, {
1212
+ type SharedExtraOptions<TCallApiContext extends CallApiContext = DefaultCallApiContext, TData = DefaultDataType, TErrorData = DefaultDataType, TResultMode extends ResultModeType = ResultModeType, TThrowOnError extends ThrowOnErrorBoolean = DefaultThrowOnError, TResponseType extends ResponseTypeType = ResponseTypeType, TPluginArray extends CallApiPlugin[] = DefaultPluginArray, TBody = Body, TComputedMergedPluginExtraOptions = Partial<InferPluginExtraOptions<TPluginArray> & InferSchemaOutput<TCallApiContext["InferredExtraOptions"], TCallApiContext["InferredExtraOptions"]>>, TComputedCallApiContext extends CallApiContext = OverrideCallApiContext<TCallApiContext, {
1012
1213
  Data: TData;
1013
1214
  ErrorData: TErrorData;
1014
1215
  InferredExtraOptions: TComputedMergedPluginExtraOptions;
@@ -1027,32 +1228,48 @@ type SharedExtraOptions<TCallApiContext extends CallApiContext = DefaultCallApiC
1027
1228
  /**
1028
1229
  * Custom function to serialize request body objects into strings.
1029
1230
  *
1030
- * Useful for custom serialization formats or when the default JSON
1231
+ * Useful for custom string serialization formats or when the default JSON
1031
1232
  * serialization doesn't meet your needs.
1032
1233
  *
1033
1234
  * @example
1034
1235
  * ```ts
1035
- * // Custom form data serialization
1036
- * bodySerializer: (data) => {
1037
- * const formData = new FormData();
1038
- * Object.entries(data).forEach(([key, value]) => {
1039
- * formData.append(key, String(value));
1040
- * });
1041
- * return formData.toString();
1042
- * }
1043
- *
1044
1236
  * // XML serialization
1045
- * bodySerializer: (data) => {
1046
- * return `<request>${Object.entries(data)
1237
+ * bodySerializer: (body) => {
1238
+ * return `<request>${Object.entries(body)
1047
1239
  * .map(([key, value]) => `<${key}>${value}</${key}>`)
1048
1240
  * .join('')}</request>`;
1049
1241
  * }
1050
1242
  *
1051
1243
  * // Custom JSON with specific formatting
1052
- * bodySerializer: (data) => JSON.stringify(data, null, 2)
1244
+ * bodySerializer: (body) => JSON.stringify(body, null, 2)
1245
+ * ```
1246
+ */
1247
+ bodySerializer?: (body: TBody extends SerializableObject ? TBody : SerializableObject) => string;
1248
+ /**
1249
+ * Custom function to transform the request body before it is passed to fetch.
1250
+ *
1251
+ * Useful for converting plain objects into formats like `FormData`,
1252
+ * `URLSearchParams`, `Blob`, or other Fetch-compatible body values.
1253
+ *
1254
+ * Takes precedence over `bodySerializer`.
1255
+ *
1256
+ * @example
1257
+ * ```ts
1258
+ * bodyTransformer: ({ body }) => {
1259
+ * const formData = new FormData();
1260
+ *
1261
+ * Object.entries(body).forEach(([key, value]) => {
1262
+ * formData.append(key, String(value));
1263
+ * });
1264
+ *
1265
+ * return formData;
1266
+ * }
1053
1267
  * ```
1054
1268
  */
1055
- bodySerializer?: (bodyData: SerializableObject) => string;
1269
+ bodyTransformer?: (context: {
1270
+ body: TBody;
1271
+ headers: Headers;
1272
+ }) => Body;
1056
1273
  /**
1057
1274
  * Whether to clone the response so it can be read multiple times.
1058
1275
  *
@@ -1458,7 +1675,7 @@ type GetExtendSchemaConfigContext<TBaseSchemaConfig extends CallApiSchemaConfig>
1458
1675
  type InferExtendPluginContext<TBasePluginArray extends CallApiPlugin[]> = {
1459
1676
  basePlugins: TBasePluginArray;
1460
1677
  };
1461
- type CallApiExtraOptions<TCallApiContext extends CallApiContext = DefaultCallApiContext, TData = DefaultDataType, TErrorData = DefaultDataType, TResultMode extends ResultModeType = ResultModeType, TThrowOnError extends ThrowOnErrorBoolean = DefaultThrowOnError, TResponseType extends ResponseTypeType = ResponseTypeType, TBasePluginArray extends CallApiPlugin[] = DefaultPluginArray, TPluginArray extends CallApiPlugin[] = DefaultPluginArray, TBaseSchemaRoutes extends BaseCallApiSchemaRoutes = BaseCallApiSchemaRoutes, TSchema extends CallApiSchema = CallApiSchema, TBaseSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TCurrentRouteSchemaKey extends string = string> = SharedExtraOptions<TCallApiContext, TData, TErrorData, TResultMode, TThrowOnError, TResponseType, TPluginArray> & {
1678
+ type CallApiExtraOptions<TCallApiContext extends CallApiContext = DefaultCallApiContext, TData = DefaultDataType, TErrorData = DefaultDataType, TResultMode extends ResultModeType = ResultModeType, TThrowOnError extends ThrowOnErrorBoolean = DefaultThrowOnError, TResponseType extends ResponseTypeType = ResponseTypeType, TBasePluginArray extends CallApiPlugin[] = DefaultPluginArray, TPluginArray extends CallApiPlugin[] = DefaultPluginArray, TBaseSchemaRoutes extends BaseCallApiSchemaRoutes = BaseCallApiSchemaRoutes, TSchema extends CallApiSchema = CallApiSchema, TBaseSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TCurrentRouteSchemaKey extends string = string, TBody extends InferSchemaOutput<TSchema["body"], Body> = InferSchemaOutput<TSchema["body"], Body>> = SharedExtraOptions<TCallApiContext, TData, TErrorData, TResultMode, TThrowOnError, TResponseType, TPluginArray, TBody> & {
1462
1679
  /**
1463
1680
  * Array of instance-specific CallApi plugins or a function to configure plugins.
1464
1681
  *
@@ -1492,8 +1709,8 @@ type InstanceContext = {
1492
1709
  request: CallApiRequestOptions;
1493
1710
  };
1494
1711
  type BaseCallApiConfig<TBaseCallApiContext extends CallApiContext = DefaultCallApiContext, TBaseData = DefaultDataType, TBaseErrorData = DefaultDataType, TBaseResultMode extends ResultModeType = ResultModeType, TBaseThrowOnError extends ThrowOnErrorBoolean = DefaultThrowOnError, TBaseResponseType extends ResponseTypeType = ResponseTypeType, TBaseSchemaAndConfig extends BaseCallApiSchemaAndConfig = BaseCallApiSchemaAndConfig, TBasePluginArray extends CallApiPlugin[] = DefaultPluginArray, TComputedBaseConfig = BaseCallApiExtraOptions<TBaseCallApiContext, TBaseData, TBaseErrorData, TBaseResultMode, TBaseThrowOnError, TBaseResponseType, TBasePluginArray, TBaseSchemaAndConfig>> = (CallApiRequestOptions & TComputedBaseConfig) | ((context: InstanceContext) => CallApiRequestOptions & TComputedBaseConfig);
1495
- type CallApiConfig<TCallApiContext extends CallApiContext = DefaultCallApiContext, TData = DefaultDataType, TErrorData = DefaultDataType, TResultMode extends ResultModeType = ResultModeType, TThrowOnError extends ThrowOnErrorBoolean = DefaultThrowOnError, TResponseType extends ResponseTypeType = ResponseTypeType, TBaseSchemaRoutes extends BaseCallApiSchemaRoutes = BaseCallApiSchemaRoutes, TSchema extends CallApiSchema = CallApiSchema, TBaseSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TInitURL extends InitURLOrURLObject = InitURLOrURLObject, TCurrentRouteSchemaKey extends string = string, TBasePluginArray extends CallApiPlugin[] = DefaultPluginArray, TPluginArray extends CallApiPlugin[] = DefaultPluginArray> = InferExtraOptions<TSchema, TBaseSchemaRoutes, TCurrentRouteSchemaKey, TCallApiContext> & InferRequestOptions<TSchema, TInitURL> & Omit<CallApiExtraOptions<TCallApiContext, TData, TErrorData, TResultMode, TThrowOnError, TResponseType, TBasePluginArray, TPluginArray, TBaseSchemaRoutes, TSchema, TBaseSchemaConfig, TSchemaConfig, TCurrentRouteSchemaKey>, keyof InferExtraOptions<CallApiSchema, BaseCallApiSchemaRoutes, string, CallApiContext>> & Omit<CallApiRequestOptions, keyof InferRequestOptions<CallApiSchema, string>>;
1496
- type CallApiParameters<TData = DefaultDataType, TErrorData = DefaultDataType, TResultMode extends ResultModeType = ResultModeType, TCallApiContext extends CallApiContext = DefaultCallApiContext, TThrowOnError extends ThrowOnErrorBoolean = DefaultThrowOnError, TResponseType extends ResponseTypeType = ResponseTypeType, TBaseSchemaRoutes extends BaseCallApiSchemaRoutes = BaseCallApiSchemaRoutes, TSchema extends CallApiSchema = CallApiSchema, TBaseSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TInitURL extends InitURLOrURLObject = InitURLOrURLObject, TCurrentRouteSchemaKey extends string = string, TBasePluginArray extends CallApiPlugin[] = DefaultPluginArray, TPluginArray extends CallApiPlugin[] = DefaultPluginArray> = [initURL: TInitURL, config?: CallApiConfig<TCallApiContext, TData, TErrorData, TResultMode, TThrowOnError, TResponseType, TBaseSchemaRoutes, TSchema, TBaseSchemaConfig, TSchemaConfig, TInitURL, TCurrentRouteSchemaKey, TBasePluginArray, TPluginArray>];
1712
+ type CallApiConfig<TCallApiContext extends CallApiContext = DefaultCallApiContext, TData = DefaultDataType, TErrorData = DefaultDataType, TResultMode extends ResultModeType = ResultModeType, TThrowOnError extends ThrowOnErrorBoolean = DefaultThrowOnError, TResponseType extends ResponseTypeType = ResponseTypeType, TBaseSchemaRoutes extends BaseCallApiSchemaRoutes = BaseCallApiSchemaRoutes, TSchema extends CallApiSchema = CallApiSchema, TBaseSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TInitURL extends InitURLOrURLObject = InitURLOrURLObject, TCurrentRouteSchemaKey extends string = string, TBody extends InferSchemaOutput<TSchema["body"], Body> = InferSchemaOutput<TSchema["body"], Body>, TBasePluginArray extends CallApiPlugin[] = DefaultPluginArray, TPluginArray extends CallApiPlugin[] = DefaultPluginArray> = InferExtraOptions<TSchema, TBaseSchemaRoutes, TCurrentRouteSchemaKey, TCallApiContext> & InferRequestOptions<TSchema, TInitURL, TBody> & Omit<CallApiExtraOptions<TCallApiContext, TData, TErrorData, TResultMode, TThrowOnError, TResponseType, TBasePluginArray, TPluginArray, TBaseSchemaRoutes, TSchema, TBaseSchemaConfig, TSchemaConfig, TCurrentRouteSchemaKey, TBody>, keyof InferExtraOptions<CallApiSchema, BaseCallApiSchemaRoutes, string, CallApiContext>> & Omit<CallApiRequestOptions<TBody>, keyof InferRequestOptions<CallApiSchema, string, TBody>>;
1713
+ type CallApiParameters<TData = DefaultDataType, TErrorData = DefaultDataType, TResultMode extends ResultModeType = ResultModeType, TCallApiContext extends CallApiContext = DefaultCallApiContext, TThrowOnError extends ThrowOnErrorBoolean = DefaultThrowOnError, TResponseType extends ResponseTypeType = ResponseTypeType, TBaseSchemaRoutes extends BaseCallApiSchemaRoutes = BaseCallApiSchemaRoutes, TSchema extends CallApiSchema = CallApiSchema, TBaseSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TInitURL extends InitURLOrURLObject = InitURLOrURLObject, TCurrentRouteSchemaKey extends string = string, TBasePluginArray extends CallApiPlugin[] = DefaultPluginArray, TPluginArray extends CallApiPlugin[] = DefaultPluginArray, TBody extends InferSchemaOutput<TSchema["body"], Body> = InferSchemaOutput<TSchema["body"], Body>> = [initURL: TInitURL, config?: CallApiConfig<TCallApiContext, TData, TErrorData, TResultMode, TThrowOnError, TResponseType, TBaseSchemaRoutes, TSchema, TBaseSchemaConfig, TSchemaConfig, TInitURL, TCurrentRouteSchemaKey, TBody, TBasePluginArray, TPluginArray>];
1497
1714
  type CallApiResult<TData, TErrorData, TResultMode extends ResultModeType, TThrowOnError extends ThrowOnErrorBoolean> = InferCallApiResult<TData, TErrorData, TResultMode, TThrowOnError>;
1498
1715
  type CallApiResultLoose<TData, TErrorData, TResultMode extends ResultModeType = ResultModeType, TThrowOnError extends ThrowOnErrorBoolean = ThrowOnErrorBoolean> = InferCallApiResult<TData, TErrorData, TResultMode, TThrowOnError>;
1499
1716
  //#endregion
@@ -1554,11 +1771,11 @@ type JsonPrimitive = boolean | number | string | null | undefined;
1554
1771
  type SerializableObject = Record<PropertyKey, unknown>;
1555
1772
  type SerializableArray = Array<JsonPrimitive | SerializableObject> | ReadonlyArray<JsonPrimitive | SerializableObject>;
1556
1773
  type Body = UnmaskType<Exclude<RequestInit["body"], undefined> | SerializableArray | SerializableObject>;
1557
- type InferBodyOption<TSchema extends CallApiSchema> = MakeSchemaOptionRequiredIfDefined<TSchema["body"], {
1774
+ type InferBodyOption<TSchema extends CallApiSchema, TBody = InferSchemaOutput<TSchema["body"], Body>> = MakeSchemaOptionRequiredIfDefined<TSchema["body"], {
1558
1775
  /**
1559
1776
  * Body of the request, can be a object or any other supported body type.
1560
1777
  */
1561
- body?: InferSchemaOutput<TSchema["body"], Body>;
1778
+ body?: TBody;
1562
1779
  }>;
1563
1780
  type MethodUnion = UnmaskType<"CONNECT" | "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT" | "TRACE" | AnyString>;
1564
1781
  type ExtractMethodFromURL<TInitURL> = string extends TInitURL ? MethodUnion : TInitURL extends `${AtSymbol}${infer TMethod extends RouteKeyMethods}/${string}` ? Uppercase<TMethod> : MethodUnion;
@@ -1578,7 +1795,7 @@ type InferHeadersOption<TSchema extends CallApiSchema> = MakeSchemaOptionRequire
1578
1795
  baseHeaders: Extract<HeadersOption, Record<string, unknown>>;
1579
1796
  }) => InferSchemaOutput<TSchema["headers"], HeadersOption>);
1580
1797
  }>;
1581
- type InferRequestOptions<TSchema extends CallApiSchema, TInitURL extends InferInitURL<BaseCallApiSchemaRoutes, CallApiSchemaConfig>> = InferBodyOption<TSchema> & InferHeadersOption<TSchema> & InferMethodOption<TSchema, TInitURL>;
1798
+ type InferRequestOptions<TSchema extends CallApiSchema, TInitURL extends InferInitURL<BaseCallApiSchemaRoutes, CallApiSchemaConfig>, TBody = InferSchemaOutput<TSchema["body"], Body>> = InferBodyOption<TSchema, TBody> & InferHeadersOption<TSchema> & InferMethodOption<TSchema, TInitURL>;
1582
1799
  type InferMetaOption<TSchema extends CallApiSchema, TCallApiContext extends CallApiContext> = MakeSchemaOptionRequiredIfDefined<TSchema["meta"], {
1583
1800
  /**
1584
1801
  * - An optional field you can fill with additional information,
@@ -1694,136 +1911,5 @@ type ThrowOnErrorOption<TErrorData, TThrowOnError extends ThrowOnErrorBoolean> =
1694
1911
  throwOnError?: ThrowOnErrorType<TErrorData, TThrowOnError>;
1695
1912
  };
1696
1913
  //#endregion
1697
- //#region src/result.d.ts
1698
- type ResponseParser<TData> = (text: string) => Awaitable<TData>;
1699
- declare const getResponseType: <TData>(response: Response, responseParser: ResponseParser<TData>) => {
1700
- arrayBuffer: () => Promise<ArrayBuffer>;
1701
- blob: () => Promise<Blob>;
1702
- formData: () => Promise<FormData>;
1703
- json: () => Promise<TData>;
1704
- stream: () => ReadableStream<Uint8Array<ArrayBuffer>> | null;
1705
- text: () => Promise<string>;
1706
- };
1707
- type InitResponseTypeMap<TData = unknown> = ReturnType<typeof getResponseType<TData>>;
1708
- type ResponseTypeUnion = keyof InitResponseTypeMap;
1709
- type ResponseTypePlaceholder = null;
1710
- type ResponseTypeType = ResponseTypePlaceholder | ResponseTypeUnion;
1711
- type ResponseTypeMap<TData> = { [Key in keyof InitResponseTypeMap<TData>]: Awaited<ReturnType<InitResponseTypeMap<TData>[Key]>> };
1712
- type GetResponseType<TData, TResponseType extends ResponseTypeType, TComputedResponseTypeMap extends ResponseTypeMap<TData> = ResponseTypeMap<TData>> = null extends TResponseType ? TComputedResponseTypeMap["json"] : TResponseType extends NonNullable<ResponseTypeType> ? TComputedResponseTypeMap[TResponseType] : never;
1713
- type CallApiResultSuccessVariant<TData> = {
1714
- data: NoInferUnMasked<TData>;
1715
- error: null;
1716
- response: Response;
1717
- };
1718
- type PossibleJavaScriptError = UnmaskType<{
1719
- errorData: false;
1720
- message: string;
1721
- name: "AbortError" | "Error" | "SyntaxError" | "TimeoutError" | "TypeError" | AnyString;
1722
- originalError: DOMException | Error | SyntaxError | TypeError;
1723
- }>;
1724
- type PossibleHTTPError<TErrorData> = UnmaskType<{
1725
- errorData: NoInferUnMasked<TErrorData>;
1726
- message: string;
1727
- name: "HTTPError";
1728
- originalError: HTTPError;
1729
- }>;
1730
- type PossibleValidationError = UnmaskType<{
1731
- errorData: ValidationError["errorData"];
1732
- issueCause: ValidationError["issueCause"];
1733
- message: string;
1734
- name: "ValidationError";
1735
- originalError: ValidationError;
1736
- }>;
1737
- type CallApiResultErrorVariant<TErrorData> = {
1738
- data: null;
1739
- error: PossibleHTTPError<TErrorData>;
1740
- response: Response;
1741
- } | {
1742
- data: null;
1743
- error: PossibleJavaScriptError;
1744
- response: Response | null;
1745
- } | {
1746
- data: null;
1747
- error: PossibleValidationError;
1748
- response: Response | null;
1749
- };
1750
- type CallApiResultSuccessOrErrorVariant<TData, TError> = CallApiResultErrorVariant<TError> | CallApiResultSuccessVariant<TData>;
1751
- type GetCallApiResult<TThrowOnError extends ThrowOnErrorBoolean, TResultWithException extends CallApiResultSuccessVariant<unknown>, TResultWithoutException extends CallApiResultSuccessOrErrorVariant<unknown, unknown>> = TThrowOnError extends true ? TResultWithException : TResultWithoutException;
1752
- type ResultModeMap<TData = DefaultDataType, TErrorData = DefaultDataType, TThrowOnError extends ThrowOnErrorBoolean = DefaultThrowOnError, TComputedResult extends GetCallApiResult<TThrowOnError, CallApiResultSuccessVariant<TData>, CallApiResultSuccessOrErrorVariant<TData, TErrorData>> = GetCallApiResult<TThrowOnError, CallApiResultSuccessVariant<TData>, CallApiResultSuccessOrErrorVariant<TData, TErrorData>>> = UnmaskType<{
1753
- all: TComputedResult;
1754
- fetchApi: TComputedResult["response"];
1755
- onlyData: TComputedResult["data"];
1756
- onlyResponse: TComputedResult["response"];
1757
- withoutResponse: Prettify<DistributiveOmit<TComputedResult, "response">>;
1758
- }>;
1759
- type ResultModePlaceholder = null;
1760
- type ResultModeUnion = keyof ResultModeMap;
1761
- type ResultModeType = ResultModePlaceholder | ResultModeUnion;
1762
- type InferCallApiResult<TData, TErrorData, TResultMode extends ResultModeType, TThrowOnError extends ThrowOnErrorBoolean, TComputedResultModeMapWithException extends ResultModeMap<TData, TErrorData, true> = ResultModeMap<TData, TErrorData, true>, TComputedResultModeMapWithoutException extends ResultModeMap<TData, TErrorData, TThrowOnError> = ResultModeMap<TData, TErrorData, TThrowOnError>> = TErrorData extends false ? TComputedResultModeMapWithException["onlyData"] : TErrorData extends false | undefined ? TComputedResultModeMapWithException["onlyData"] : ResultModePlaceholder extends TResultMode ? TComputedResultModeMapWithoutException["all"] : TResultMode extends ResultModeUnion ? TComputedResultModeMapWithoutException[TResultMode] : never;
1763
- //#endregion
1764
- //#region src/plugins.d.ts
1765
- type PluginSetupContext<TCallApiContext extends CallApiContext = DefaultCallApiContext> = RequestContext<TCallApiContext> & ReturnType<typeof getCurrentRouteSchemaKeyAndMainInitURL>;
1766
- type PluginInitResult<TCallApiContext extends CallApiContext = DefaultCallApiContext> = Partial<Omit<PluginSetupContext<TCallApiContext>, "initURL" | "request"> & {
1767
- initURL: InitURLOrURLObject;
1768
- request: CallApiRequestOptions;
1769
- }>;
1770
- type GetDefaultDataTypeForPlugins<TData> = DefaultDataType extends TData ? never : TData;
1771
- type PluginHooks<TCallApiContext extends CallApiContext = DefaultCallApiContext> = HooksOrHooksArray<OverrideCallApiContext<TCallApiContext, {
1772
- Data: GetDefaultDataTypeForPlugins<TCallApiContext["Data"]>;
1773
- ErrorData: GetDefaultDataTypeForPlugins<TCallApiContext["ErrorData"]>;
1774
- }>>;
1775
- type PluginMiddlewares<TCallApiContext extends CallApiContext = DefaultCallApiContext> = Middlewares<OverrideCallApiContext<TCallApiContext, {
1776
- Data: GetDefaultDataTypeForPlugins<TCallApiContext["Data"]>;
1777
- ErrorData: GetDefaultDataTypeForPlugins<TCallApiContext["ErrorData"]>;
1778
- }>>;
1779
- interface CallApiPlugin<TCallApiContext extends CallApiContext = DefaultCallApiContext> {
1780
- /**
1781
- * Defines additional options that can be passed to callApi
1782
- */
1783
- defineExtraOptions?: () => TCallApiContext["InferredExtraOptions"];
1784
- /**
1785
- * A description for the plugin
1786
- */
1787
- description?: string;
1788
- /**
1789
- * Hooks for the plugin
1790
- */
1791
- hooks?: PluginHooks<TCallApiContext> | ((context: PluginSetupContext<TCallApiContext>) => Awaitable<PluginHooks<TCallApiContext>> | Awaitable<void>);
1792
- /**
1793
- * A unique id for the plugin
1794
- */
1795
- id: string;
1796
- /**
1797
- * Middlewares that for the plugin
1798
- */
1799
- middlewares?: PluginMiddlewares<TCallApiContext> | ((context: PluginSetupContext<TCallApiContext>) => Awaitable<PluginMiddlewares<TCallApiContext>> | Awaitable<void>);
1800
- /**
1801
- * A name for the plugin
1802
- */
1803
- name: string;
1804
- /**
1805
- * Base schema for the client.
1806
- */
1807
- schema?: BaseCallApiSchemaAndConfig;
1808
- /**
1809
- * A function that will be called when the plugin is initialized. This will be called before the any of the other internal functions.
1810
- */
1811
- setup?: (context: PluginSetupContext<TCallApiContext>) => Awaitable<PluginInitResult<TCallApiContext>> | Awaitable<void>;
1812
- /**
1813
- * A version for the plugin
1814
- */
1815
- version?: string;
1816
- }
1817
- type InferPluginExtraOptions<TPluginArray extends CallApiPlugin[]> = UnionToIntersection<TPluginArray extends Array<infer TPlugin> ? TPlugin extends CallApiPlugin ? TPlugin["defineExtraOptions"] extends AnyFunction<infer TResult> ? InferSchemaOutput<TResult, TResult> : never : never : never>;
1818
- //#endregion
1819
- //#region src/types/default-types.d.ts
1820
- type DefaultDataType = unknown;
1821
- type DefaultPluginArray = CallApiPlugin[];
1822
- type DefaultThrowOnError = boolean;
1823
- type DefaultMetaObject = Record<string, unknown>;
1824
- type DefaultCallApiContext = Prettify<OverrideCallApiContext<Required<CallApiContext>, {
1825
- Meta: GlobalMeta;
1826
- }>>;
1827
- //#endregion
1828
- export { Hooks as $, CallApiConfig as A, GetCallApiContextRequired as B, InferAllMainRouteKeys as C, DistributiveOmit as Ct, ThrowOnErrorBoolean as D, fetchSpecificKeys as Dt, InferParamsFromRoute as E, Writeable as Et, CallApiResult as F, ValidationError as G, InstanceContext as H, CallApiResultLoose as I, Middlewares as J, FetchImpl as K, GetBaseSchemaConfig as L, CallApiExtraOptions as M, CallApiParameters as N, BaseCallApiConfig as O, CallApiRequestOptions as P, ErrorContext as Q, GetBaseSchemaRoutes as R, GetCurrentRouteSchemaKey as S, AnyString as St, InferInitURL as T, Satisfies as Tt, Register as U, GlobalMeta as V, HTTPError as W, CallApiExtraOptionsForHooks as X, DedupeOptions as Y, CallApiRequestOptionsForHooks as Z, ResponseTypeType as _, InferSchemaOutput as _t, PluginHooks as a, ResponseStreamContext as at, ApplyURLBasedConfig as b, fallBackRouteSchemaKey as bt, CallApiResultErrorVariant as c, RetryOptions as ct, GetResponseType as d, BaseCallApiSchemaRoutes as dt, HooksOrHooksArray as et, InferCallApiResult as f, BaseSchemaRouteKeyPrefixes as ft, ResponseTypeMap as g, InferSchemaInput as gt, PossibleValidationError as h, CallApiSchemaType as ht, CallApiPlugin as i, ResponseErrorContext as it, CallApiContext as j, BaseCallApiExtraOptions as k, CallApiResultSuccessOrErrorVariant as l, URLOptions as lt, PossibleJavaScriptError as m, CallApiSchemaConfig as mt, DefaultDataType as n, RequestStreamContext as nt, PluginMiddlewares as o, SuccessContext as ot, PossibleHTTPError as p, CallApiSchema as pt, FetchMiddlewareContext as q, DefaultPluginArray as r, ResponseContext as rt, PluginSetupContext as s, RefetchOptions as st, DefaultCallApiContext as t, RequestContext as tt, CallApiResultSuccessVariant as u, BaseCallApiSchemaAndConfig as ut, ResultModeType as v, InferSchemaResult as vt, InferAllMainRoutes as w, NoInferUnMasked as wt, GetCurrentRouteSchema as x, AnyFunction as xt, ApplyStrictConfig as y, FallBackRouteSchemaKey as yt, GetCallApiContext as z };
1829
- //# sourceMappingURL=default-types-CyPF_5eh.d.ts.map
1914
+ export { defineSchema as $, CallApiExtraOptionsForHooks as A, BaseSchemaRouteKeyPrefixes as At, SuccessContext as B, DistributiveOmit as Bt, GetBaseSchemaRoutes as C, ResponseTypeMap as Ct, InstanceContext as D, ValidationError as Dt, GlobalMeta as E, HTTPError as Et, RequestContext as F, InferSchemaResult as Ft, isHTTPErrorInstance as G, RetryOptions as H, Writeable as Ht, RequestStreamContext as I, URLOptions as It, isValidationErrorInstance as J, isJavascriptError as K, ResponseContext as L, FallBackRouteSchemaKey as Lt, ErrorContext as M, CallApiSchemaConfig as Mt, Hooks as N, InferSchemaInput as Nt, Register as O, BaseCallApiSchemaAndConfig as Ot, HooksOrHooksArray as P, InferSchemaOutput as Pt, definePlugin as Q, ResponseErrorContext as R, fallBackRouteSchemaKey as Rt, GetBaseSchemaConfig as S, PossibleValidationError as St, GetCallApiContextRequired as T, ResultModeType as Tt, objectifyHeaders as U, fetchSpecificKeys as Ut, RefetchOptions as V, NoInferUnMasked as Vt, isHTTPError as W, defineInstanceConfig as X, defineBaseConfig as Y, defineMainSchema as Z, CallApiExtraOptions as _, CallApiResultSuccessVariant as _t, GetCurrentRouteSchemaKey as a, DefaultCallApiContext as at, CallApiResult as b, PossibleHTTPError as bt, InferInitURL as c, CallApiPlugin as ct, SerializableObject as d, PluginSetupContext as dt, defineSchemaConfig as et, ThrowOnErrorBoolean as f, FetchImpl as ft, CallApiContext as g, CallApiResultSuccessOrErrorVariant as gt, CallApiConfig as h, CallApiResultErrorVariant as ht, GetCurrentRouteSchema as i, toSearchParams as it, CallApiRequestOptionsForHooks as j, CallApiSchema as jt, DedupeOptions as k, BaseCallApiSchemaRoutes as kt, InferParamsFromRoute as l, PluginHooks as lt, BaseCallApiExtraOptions as m, Middlewares as mt, ApplyURLBasedConfig as n, toFormData as nt, InferAllMainRouteKeys as o, DefaultDataType as ot, BaseCallApiConfig as p, FetchMiddlewareContext as pt, isValidationError as q, Body as r, toQueryString as rt, InferAllMainRoutes as s, DefaultPluginArray as st, ApplyStrictConfig as t, defineSchemaRoutes as tt, SerializableArray as u, PluginMiddlewares as ut, CallApiParameters as v, GetResponseType as vt, GetCallApiContext as w, ResponseTypeType as wt, CallApiResultLoose as x, PossibleJavaScriptError as xt, CallApiRequestOptions as y, InferCallApiResult as yt, ResponseStreamContext as z, AnyString as zt };
1915
+ //# sourceMappingURL=conditional-types-BXgYQJ5q.d.ts.map