@zayne-labs/callapi 1.12.4 → 1.12.6

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
@@ -11,11 +11,10 @@
11
11
  <a href="https://www.npmjs.com/package/@zayne-labs/callapi"><img src="https://img.shields.io/npm/dm/@zayne-labs/callapi?style=flat&color=EFBA5F" alt="downloads per month"></a>
12
12
  <a href="https://github.com/zayne-labs/callapi/graphs/commit-activity"><img src="https://img.shields.io/github/commit-activity/m/zayne-labs/callapi?style=flat&color=EFBA5F" alt="commit activity"></a>
13
13
  <a href="https://deepwiki.com/zayne-labs/callapi"><img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki"></a>
14
- <a href="https://code2tutorial.com/tutorial/f77cfbd0-3c37-4c37-9608-b3c977e46f00/index.md"><img src="https://img.shields.io/badge/Code2Tutorial-blue?color=blue&logo=victoriametrics" alt="Code2Tutorial"></a>
15
14
  </p>
16
15
 
17
16
  <p align="center">
18
- <b>An advanced fetch library that actually solves real problems.</b>
17
+ <b>An advanced fetch library that solves real problems.</b>
19
18
  </p>
20
19
 
21
20
  <p align="center">
@@ -1,4 +1,4 @@
1
- import { Dt as fetchSpecificKeys, K as RequestContext, bt as fallBackRouteSchemaKey, yt as FallBackRouteSchemaKey } from "../default-types-CF53Uvuq.js";
1
+ import { Dt as fetchSpecificKeys, bt as fallBackRouteSchemaKey, tt as RequestContext, yt as FallBackRouteSchemaKey } from "../default-types-CyPF_5eh.js";
2
2
 
3
3
  //#region src/constants/defaults.d.ts
4
4
  declare const extraOptionDefaults: Readonly<Readonly<{
@@ -6,6 +6,7 @@ declare const extraOptionDefaults: Readonly<Readonly<{
6
6
  (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
7
7
  (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
8
8
  };
9
+ debugMode: true;
9
10
  defaultHTTPErrorMessage: string;
10
11
  dedupeCacheScope: "local";
11
12
  dedupeKey: (ctx: RequestContext) => string;
@@ -1,2 +1,2 @@
1
- import { F as fallBackRouteSchemaKey, I as fetchSpecificKeys, n as requestOptionDefaults, t as extraOptionDefaults } from "../defaults-WfRTxvn6.js";
1
+ import { F as fallBackRouteSchemaKey, I as fetchSpecificKeys, n as requestOptionDefaults, t as extraOptionDefaults } from "../defaults-IsBgvt90.js";
2
2
  export { extraOptionDefaults, fallBackRouteSchemaKey, fetchSpecificKeys, requestOptionDefaults };
@@ -37,44 +37,6 @@ 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/auth.d.ts
41
- type PossibleAuthValue = Awaitable<string | null | undefined>;
42
- type PossibleAuthValueOrGetter = PossibleAuthValue | (() => PossibleAuthValue);
43
- type BearerAuth = {
44
- type: "Bearer";
45
- value: PossibleAuthValueOrGetter;
46
- };
47
- type TokenAuth = {
48
- type: "Token";
49
- value: PossibleAuthValueOrGetter;
50
- };
51
- type BasicAuth = {
52
- type: "Basic";
53
- username: PossibleAuthValueOrGetter;
54
- password: PossibleAuthValueOrGetter;
55
- };
56
- /**
57
- * Custom auth
58
- *
59
- * @param prefix - prefix of the header
60
- * @param authValue - value of the header
61
- *
62
- * @example
63
- * ```ts
64
- * {
65
- * type: "Custom",
66
- * prefix: "Token",
67
- * authValue: "token"
68
- * }
69
- * ```
70
- */
71
- type CustomAuth = {
72
- type: "Custom";
73
- prefix: PossibleAuthValueOrGetter;
74
- value: PossibleAuthValueOrGetter;
75
- };
76
- type AuthOption = PossibleAuthValueOrGetter | BearerAuth | TokenAuth | BasicAuth | CustomAuth;
77
- //#endregion
78
40
  //#region src/constants/validation.d.ts
79
41
  declare const fallBackRouteSchemaKey = "@default";
80
42
  type FallBackRouteSchemaKey = typeof fallBackRouteSchemaKey;
@@ -383,165 +345,6 @@ interface URLOptions {
383
345
  query?: Query;
384
346
  }
385
347
  //#endregion
386
- //#region src/types/conditional-types.d.ts
387
- /**
388
- * @description Makes a type partial if the output type of TSchema is not provided or has undefined in the union, otherwise makes it required
389
- */
390
- type MakeSchemaOptionRequiredIfDefined<TSchemaOption extends CallApiSchema[keyof CallApiSchema], TObject> = undefined extends InferSchemaOutput<TSchemaOption, undefined> ? TObject : Required<TObject>;
391
- type MergeBaseWithRouteKey<TBaseURLOrPrefix extends string | undefined, TRouteKey extends string> = TBaseURLOrPrefix extends string ? TRouteKey extends `${AtSymbol}${infer TMethod extends RouteKeyMethods}/${infer TRestOfRoutKey}` ? `${AtSymbol}${TMethod}/${RemoveLeadingSlash<RemoveTrailingSlash<TBaseURLOrPrefix>>}/${RemoveLeadingSlash<TRestOfRoutKey>}` : `${TBaseURLOrPrefix}${TRouteKey}` : TRouteKey;
392
- type ApplyURLBasedConfig<TSchemaConfig extends CallApiSchemaConfig, TSchemaRouteKeys extends string> = TSchemaConfig["prefix"] extends string ? MergeBaseWithRouteKey<TSchemaConfig["prefix"], TSchemaRouteKeys> : TSchemaConfig["baseURL"] extends string ? MergeBaseWithRouteKey<TSchemaConfig["baseURL"], TSchemaRouteKeys> : TSchemaRouteKeys;
393
- type ApplyStrictConfig<TSchemaConfig extends CallApiSchemaConfig, TSchemaRouteKeys extends string> = TSchemaConfig["strict"] extends true ? TSchemaRouteKeys : // eslint-disable-next-line perfectionist/sort-union-types -- Don't sort union types
394
- TSchemaRouteKeys | Exclude<InitURLOrURLObject, RouteKeyMethodsURLUnion>;
395
- type ApplySchemaConfiguration<TSchemaConfig extends CallApiSchemaConfig, TSchemaRouteKeys extends string> = ApplyStrictConfig<TSchemaConfig, ApplyURLBasedConfig<TSchemaConfig, TSchemaRouteKeys>>;
396
- type InferAllMainRoutes<TBaseSchemaRoutes extends BaseCallApiSchemaRoutes> = Omit<TBaseSchemaRoutes, FallBackRouteSchemaKey>;
397
- type InferAllMainRouteKeys<TBaseSchemaRoutes extends BaseCallApiSchemaRoutes, TSchemaConfig extends CallApiSchemaConfig> = ApplySchemaConfiguration<TSchemaConfig, Extract<keyof InferAllMainRoutes<TBaseSchemaRoutes>, string>>;
398
- type InferInitURL<TBaseSchemaRoutes extends BaseCallApiSchemaRoutes, TSchemaConfig extends CallApiSchemaConfig> = keyof TBaseSchemaRoutes extends never ? InitURLOrURLObject : InferAllMainRouteKeys<TBaseSchemaRoutes, TSchemaConfig>;
399
- type GetCurrentRouteSchemaKey<TSchemaConfig extends CallApiSchemaConfig, TPath> = TPath extends URL ? string : TSchemaConfig["prefix"] extends string ? TPath extends (`${AtSymbol}${infer TMethod extends RouteKeyMethods}/${RemoveLeadingSlash<TSchemaConfig["prefix"]>}${infer TCurrentRoute}`) ? `${AtSymbol}${TMethod}/${RemoveLeadingSlash<TCurrentRoute>}` : TPath extends `${TSchemaConfig["prefix"]}${infer TCurrentRoute}` ? TCurrentRoute : string : TSchemaConfig["baseURL"] extends string ? TPath extends (`${AtSymbol}${infer TMethod extends RouteKeyMethods}/${TSchemaConfig["baseURL"]}${infer TCurrentRoute}`) ? `${AtSymbol}${TMethod}/${RemoveLeadingSlash<TCurrentRoute>}` : TPath extends `${TSchemaConfig["baseURL"]}${infer TCurrentRoute}` ? TCurrentRoute : string : TPath;
400
- type GetCurrentRouteSchema<TBaseSchemaRoutes extends BaseCallApiSchemaRoutes, TCurrentRouteSchemaKey extends string, TComputedFallBackRouteSchema = TBaseSchemaRoutes[FallBackRouteSchemaKey], TComputedCurrentRouteSchema = TBaseSchemaRoutes[TCurrentRouteSchemaKey], TComputedRouteSchema extends CallApiSchema = NonNullable<Omit<TComputedFallBackRouteSchema, keyof TComputedCurrentRouteSchema> & TComputedCurrentRouteSchema>> = TComputedRouteSchema extends CallApiSchema ? Writeable<TComputedRouteSchema, "deep"> : CallApiSchema;
401
- type JsonPrimitive = boolean | number | string | null | undefined;
402
- type SerializableObject = Record<PropertyKey, unknown>;
403
- type SerializableArray = Array<JsonPrimitive | SerializableObject> | ReadonlyArray<JsonPrimitive | SerializableObject>;
404
- type Body = UnmaskType<Exclude<RequestInit["body"], undefined> | SerializableArray | SerializableObject>;
405
- type InferBodyOption<TSchema extends CallApiSchema> = MakeSchemaOptionRequiredIfDefined<TSchema["body"], {
406
- /**
407
- * Body of the request, can be a object or any other supported body type.
408
- */
409
- body?: InferSchemaOutput<TSchema["body"], Body>;
410
- }>;
411
- type MethodUnion = UnmaskType<"CONNECT" | "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT" | "TRACE" | AnyString>;
412
- type ExtractMethodFromURL<TInitURL> = string extends TInitURL ? MethodUnion : TInitURL extends `${AtSymbol}${infer TMethod extends RouteKeyMethods}/${string}` ? Uppercase<TMethod> : MethodUnion;
413
- type InferMethodOption<TSchema extends CallApiSchema, TInitURL extends InitURLOrURLObject> = MakeSchemaOptionRequiredIfDefined<TSchema["method"], {
414
- /**
415
- * HTTP method for the request.
416
- * @default "GET"
417
- */
418
- method?: InferSchemaOutput<TSchema["method"], ExtractMethodFromURL<TInitURL>>;
419
- }>;
420
- type HeadersOption = UnmaskType<Headers | Record<"Authorization", CommonAuthorizationHeaders | undefined> | Record<"Content-Type", CommonContentTypes | undefined> | Record<CommonRequestHeaders, string | undefined> | Record<string, string | undefined> | Array<[string, string]>>;
421
- type InferHeadersOption<TSchema extends CallApiSchema> = MakeSchemaOptionRequiredIfDefined<TSchema["headers"], {
422
- /**
423
- * Headers to be used in the request.
424
- */
425
- headers?: InferSchemaOutput<TSchema["headers"], HeadersOption> | ((context: {
426
- baseHeaders: Extract<HeadersOption, Record<string, unknown>>;
427
- }) => InferSchemaOutput<TSchema["headers"], HeadersOption>);
428
- }>;
429
- type InferRequestOptions<TSchema extends CallApiSchema, TInitURL extends InferInitURL<BaseCallApiSchemaRoutes, CallApiSchemaConfig>> = InferBodyOption<TSchema> & InferHeadersOption<TSchema> & InferMethodOption<TSchema, TInitURL>;
430
- type InferMetaOption<TSchema extends CallApiSchema, TCallApiContext extends CallApiContext> = MakeSchemaOptionRequiredIfDefined<TSchema["meta"], {
431
- /**
432
- * - An optional field you can fill with additional information,
433
- * to associate with the request, typically used for logging or tracing.
434
- *
435
- * - A good use case for this, would be to use the info to handle specific cases in any of the shared interceptors.
436
- *
437
- * @example
438
- * ```ts
439
- * const callMainApi = callApi.create({
440
- * baseURL: "https://main-api.com",
441
- * onResponseError: ({ response, options }) => {
442
- * if (options.meta?.userId) {
443
- * console.error(`User ${options.meta.userId} made an error`);
444
- * }
445
- * },
446
- * });
447
- *
448
- * const response = await callMainApi({
449
- * url: "https://example.com/api/data",
450
- * meta: { userId: "123" },
451
- * });
452
- * ```
453
- */
454
- meta?: InferSchemaOutput<TSchema["meta"], TCallApiContext["Meta"]>;
455
- }>;
456
- type InferAuthOption<TSchema extends CallApiSchema> = MakeSchemaOptionRequiredIfDefined<TSchema["auth"], {
457
- /**
458
- * Automatically add an Authorization header value.
459
- *
460
- * Supports multiple authentication patterns:
461
- * - String: Direct authorization header value
462
- * - Auth object: Structured authentication configuration
463
- *
464
- * @example
465
- * ```ts
466
- * // Bearer auth
467
- * const response = await callMainApi({
468
- * url: "https://example.com/api/data",
469
- * auth: "123456",
470
- * });
471
- *
472
- * // Bearer auth
473
- * const response = await callMainApi({
474
- * url: "https://example.com/api/data",
475
- * auth: {
476
- * type: "Bearer",
477
- * value: "123456",
478
- * },
479
- })
480
- *
481
- * // Token auth
482
- * const response = await callMainApi({
483
- * url: "https://example.com/api/data",
484
- * auth: {
485
- * type: "Token",
486
- * value: "123456",
487
- * },
488
- * });
489
- *
490
- * // Basic auth
491
- * const response = await callMainApi({
492
- * url: "https://example.com/api/data",
493
- * auth: {
494
- * type: "Basic",
495
- * username: "username",
496
- * password: "password",
497
- * },
498
- * });
499
- *
500
- * ```
501
- */
502
- auth?: InferSchemaOutput<TSchema["auth"], AuthOption>;
503
- }>;
504
- type InferQueryOption<TSchema extends CallApiSchema> = MakeSchemaOptionRequiredIfDefined<TSchema["query"], {
505
- /**
506
- * Parameters to be appended to the URL (i.e: /:id)
507
- */
508
- query?: InferSchemaOutput<TSchema["query"], Query>;
509
- }>;
510
- type EmptyString = "";
511
- type EmptyTuple = readonly [];
512
- type StringTuple = readonly string[];
513
- type PossibleParamNamePatterns = `${string}:${string}` | `${string}{${string}}${"" | AnyString}`;
514
- type ExtractRouteParamNames<TCurrentRoute, TParamNamesAccumulator extends StringTuple = EmptyTuple> = TCurrentRoute extends PossibleParamNamePatterns ? TCurrentRoute extends `${infer TRoutePrefix}:${infer TParamAndRemainingRoute}` ? TParamAndRemainingRoute extends `${infer TCurrentParam}/${infer TRemainingRoute}` ? TCurrentParam extends EmptyString ? ExtractRouteParamNames<`${TRoutePrefix}/${TRemainingRoute}`, TParamNamesAccumulator> : ExtractRouteParamNames<`${TRoutePrefix}/${TRemainingRoute}`, [...TParamNamesAccumulator, TCurrentParam]> : TParamAndRemainingRoute extends `${infer TCurrentParam}` ? TCurrentParam extends EmptyString ? ExtractRouteParamNames<TRoutePrefix, TParamNamesAccumulator> : ExtractRouteParamNames<TRoutePrefix, [...TParamNamesAccumulator, TCurrentParam]> : ExtractRouteParamNames<TRoutePrefix, TParamNamesAccumulator> : TCurrentRoute extends `${infer TRoutePrefix}{${infer TCurrentParam}}${infer TRemainingRoute}` ? TCurrentParam extends EmptyString ? ExtractRouteParamNames<`${TRoutePrefix}${TRemainingRoute}`, TParamNamesAccumulator> : ExtractRouteParamNames<`${TRoutePrefix}${TRemainingRoute}`, [...TParamNamesAccumulator, TCurrentParam]> : TParamNamesAccumulator : TParamNamesAccumulator;
515
- type ConvertParamNamesToRecord<TParamNames extends StringTuple> = Prettify<TParamNames extends (readonly [infer TFirstParamName extends string, ...infer TRemainingParamNames extends StringTuple]) ? Record<TFirstParamName, AllowedQueryParamValues> & ConvertParamNamesToRecord<TRemainingParamNames> : NonNullable<unknown>>;
516
- type ConvertParamNamesToTuple<TParamNames extends StringTuple> = TParamNames extends readonly [string, ...infer TRemainingParamNames extends StringTuple] ? [AllowedQueryParamValues, ...ConvertParamNamesToTuple<TRemainingParamNames>] : [];
517
- type InferParamsFromRoute<TCurrentRoute> = ExtractRouteParamNames<TCurrentRoute> extends StringTuple ? ExtractRouteParamNames<TCurrentRoute> extends EmptyTuple ? Params : ConvertParamNamesToRecord<ExtractRouteParamNames<TCurrentRoute>> | ConvertParamNamesToTuple<ExtractRouteParamNames<TCurrentRoute>> : Params;
518
- type MakeParamsOptionRequired<TParamsSchemaOption extends CallApiSchema["params"], TBaseSchemaRoutes extends BaseCallApiSchemaRoutes, TCurrentRouteSchemaKey extends string, TObject> = MakeSchemaOptionRequiredIfDefined<TParamsSchemaOption, Params extends InferParamsFromRoute<TCurrentRouteSchemaKey> ? TObject : TCurrentRouteSchemaKey extends Extract<keyof TBaseSchemaRoutes, TCurrentRouteSchemaKey> ? undefined extends InferSchemaOutput<TParamsSchemaOption, null> ? TObject : Required<TObject> : TObject>;
519
- type InferParamsOption<TSchema extends CallApiSchema, TBaseSchemaRoutes extends BaseCallApiSchemaRoutes, TCurrentRouteSchemaKey extends string> = MakeParamsOptionRequired<TSchema["params"], TBaseSchemaRoutes, TCurrentRouteSchemaKey, {
520
- /**
521
- * Parameters to be appended to the URL (i.e: /:id)
522
- */
523
- params?: InferSchemaOutput<TSchema["params"], InferParamsFromRoute<TCurrentRouteSchemaKey>>;
524
- }>;
525
- type InferExtraOptions<TSchema extends CallApiSchema, TBaseSchemaRoutes extends BaseCallApiSchemaRoutes, TCurrentRouteSchemaKey extends string, TCallApiContext extends CallApiContext> = InferAuthOption<TSchema> & InferMetaOption<TSchema, TCallApiContext> & InferParamsOption<TSchema, TBaseSchemaRoutes, TCurrentRouteSchemaKey> & InferQueryOption<TSchema>;
526
- type ResultModeOption<TErrorData, TResultMode extends ResultModeType> = TErrorData extends false ? {
527
- resultMode: "onlyData";
528
- } : TErrorData extends false | undefined ? {
529
- resultMode?: "onlyData";
530
- } : {
531
- resultMode?: TResultMode;
532
- };
533
- type ThrowOnErrorBoolean = boolean;
534
- type ThrowOnErrorType<TErrorData, TThrowOnError extends ThrowOnErrorBoolean> = TThrowOnError | ((context: ErrorContext<{
535
- ErrorData: TErrorData;
536
- }>) => TThrowOnError);
537
- type ThrowOnErrorOption<TErrorData, TThrowOnError extends ThrowOnErrorBoolean> = TErrorData extends false ? {
538
- throwOnError: true;
539
- } : TErrorData extends false | undefined ? {
540
- throwOnError?: true;
541
- } : {
542
- throwOnError?: ThrowOnErrorType<TErrorData, TThrowOnError>;
543
- };
544
- //#endregion
545
348
  //#region src/retry.d.ts
546
349
  declare const defaultRetryStatusCodesLookup: () => Readonly<{
547
350
  408: "Request Timeout";
@@ -559,9 +362,9 @@ type RetryCondition<TErrorData> = (context: ErrorContext<{
559
362
  }>) => Awaitable<boolean>;
560
363
  interface RetryOptions<TErrorData> {
561
364
  /**
562
- * Keeps track of the number of times the request has already been retried
365
+ * Keeps track of the number of times the request has already been retried internally
563
366
  * @internal
564
- * @deprecated **NOTE**: This property is used internally to track retries. Please abstain from modifying it.
367
+ * @deprecated **WARNING**: This property is used internally to track retries. Please abstain from reading or modifying it.
565
368
  */
566
369
  readonly ["~retryAttemptCount"]?: number;
567
370
  /**
@@ -602,9 +405,9 @@ interface RetryOptions<TErrorData> {
602
405
  //#region src/refetch.d.ts
603
406
  interface RefetchOptions {
604
407
  /**
605
- * Tracks the number of times refetch has been called
408
+ * Tracks the number of times the request has been refetched internally
606
409
  * @internal
607
- * @deprecated **NOTE**: This property is used internally to track refetch calls. Please abstain from modifying it.
410
+ * @deprecated **WARNING**: This property is used internally to track refetch calls. Please abstain from reading or modifying it.
608
411
  */
609
412
  readonly ["~refetchCount"]?: number;
610
413
  /**
@@ -637,9 +440,11 @@ interface RefetchFnOption {
637
440
  //#region src/stream.d.ts
638
441
  type StreamProgressEvent = {
639
442
  /**
640
- * Current chunk of data being streamed
443
+ * Current chunk of data being streamed.
444
+ *
445
+ * Will be `null` on the final completion tick (when progress reaches 100%).
641
446
  */
642
- chunk: Uint8Array;
447
+ chunk: Uint8Array | null;
643
448
  /**
644
449
  * Progress in percentage
645
450
  */
@@ -1163,7 +968,7 @@ declare class ValidationError extends Error {
1163
968
  static isError(error: unknown): error is ValidationError;
1164
969
  }
1165
970
  //#endregion
1166
- //#region src/types/common.d.ts
971
+ //#region src/types/options-types.d.ts
1167
972
  interface Register {}
1168
973
  type GlobalMeta = Register extends {
1169
974
  meta?: infer TMeta extends DefaultMetaObject;
@@ -1298,6 +1103,12 @@ type SharedExtraOptions<TCallApiContext extends CallApiContext = DefaultCallApiC
1298
1103
  * ```
1299
1104
  */
1300
1105
  customFetchImpl?: FetchImpl;
1106
+ /**
1107
+ * Enable debug mode for the request.
1108
+ *
1109
+ * @default true
1110
+ */
1111
+ debugMode?: boolean;
1301
1112
  /**
1302
1113
  * Default HTTP error message when server doesn't provide one.
1303
1114
  *
@@ -1331,16 +1142,6 @@ type SharedExtraOptions<TCallApiContext extends CallApiContext = DefaultCallApiC
1331
1142
  * ```
1332
1143
  */
1333
1144
  defaultHTTPErrorMessage?: string | ((context: Pick<HTTPError<TErrorData>, "errorData" | "response">) => string);
1334
- /**
1335
- * Forces calculation of total byte size from request body streams.
1336
- *
1337
- * Useful when the Content-Length header is missing or incorrect, and you need
1338
- * accurate size information for progress tracking.
1339
- *
1340
- * @default false
1341
- *
1342
- */
1343
- forcefullyCalculateRequestStreamSize?: boolean;
1344
1145
  /**
1345
1146
  * Optional metadata field for associating additional information with requests.
1346
1147
  *
@@ -1696,6 +1497,203 @@ type CallApiParameters<TData = DefaultDataType, TErrorData = DefaultDataType, TR
1696
1497
  type CallApiResult<TData, TErrorData, TResultMode extends ResultModeType, TThrowOnError extends ThrowOnErrorBoolean> = InferCallApiResult<TData, TErrorData, TResultMode, TThrowOnError>;
1697
1498
  type CallApiResultLoose<TData, TErrorData, TResultMode extends ResultModeType = ResultModeType, TThrowOnError extends ThrowOnErrorBoolean = ThrowOnErrorBoolean> = InferCallApiResult<TData, TErrorData, TResultMode, TThrowOnError>;
1698
1499
  //#endregion
1500
+ //#region src/auth.d.ts
1501
+ type PossibleAuthValue = Awaitable<string | null | undefined>;
1502
+ type PossibleAuthValueOrGetter = PossibleAuthValue | (() => PossibleAuthValue);
1503
+ type BearerAuth = {
1504
+ type: "Bearer";
1505
+ value: PossibleAuthValueOrGetter;
1506
+ };
1507
+ type TokenAuth = {
1508
+ type: "Token";
1509
+ value: PossibleAuthValueOrGetter;
1510
+ };
1511
+ type BasicAuth = {
1512
+ type: "Basic";
1513
+ username: PossibleAuthValueOrGetter;
1514
+ password: PossibleAuthValueOrGetter;
1515
+ };
1516
+ /**
1517
+ * Custom auth
1518
+ *
1519
+ * @param prefix - prefix of the header
1520
+ * @param authValue - value of the header
1521
+ *
1522
+ * @example
1523
+ * ```ts
1524
+ * {
1525
+ * type: "Custom",
1526
+ * prefix: "Token",
1527
+ * authValue: "token"
1528
+ * }
1529
+ * ```
1530
+ */
1531
+ type CustomAuth = {
1532
+ type: "Custom";
1533
+ prefix: PossibleAuthValueOrGetter;
1534
+ value: PossibleAuthValueOrGetter;
1535
+ };
1536
+ type AuthOption = PossibleAuthValueOrGetter | BearerAuth | TokenAuth | BasicAuth | CustomAuth;
1537
+ //#endregion
1538
+ //#region src/types/conditional-types.d.ts
1539
+ /**
1540
+ * @description Makes a type partial if the output type of TSchema is not provided or has undefined in the union, otherwise makes it required
1541
+ */
1542
+ type MakeSchemaOptionRequiredIfDefined<TSchemaOption extends CallApiSchema[keyof CallApiSchema], TObject> = undefined extends InferSchemaOutput<TSchemaOption, undefined> ? TObject : Required<TObject>;
1543
+ type MergeBaseWithRouteKey<TBaseURLOrPrefix extends string | undefined, TRouteKey extends string> = TBaseURLOrPrefix extends string ? TRouteKey extends `${AtSymbol}${infer TMethod extends RouteKeyMethods}/${infer TRestOfRoutKey}` ? `${AtSymbol}${TMethod}/${RemoveLeadingSlash<RemoveTrailingSlash<TBaseURLOrPrefix>>}/${RemoveLeadingSlash<TRestOfRoutKey>}` : `${TBaseURLOrPrefix}${TRouteKey}` : TRouteKey;
1544
+ type ApplyURLBasedConfig<TSchemaConfig extends CallApiSchemaConfig, TSchemaRouteKeys extends string> = TSchemaConfig["prefix"] extends string ? MergeBaseWithRouteKey<TSchemaConfig["prefix"], TSchemaRouteKeys> : TSchemaConfig["baseURL"] extends string ? MergeBaseWithRouteKey<TSchemaConfig["baseURL"], TSchemaRouteKeys> : TSchemaRouteKeys;
1545
+ type ApplyStrictConfig<TSchemaConfig extends CallApiSchemaConfig, TSchemaRouteKeys extends string> = TSchemaConfig["strict"] extends true ? TSchemaRouteKeys : // eslint-disable-next-line perfectionist/sort-union-types -- Don't sort union types
1546
+ TSchemaRouteKeys | Exclude<InitURLOrURLObject, RouteKeyMethodsURLUnion>;
1547
+ type ApplySchemaConfiguration<TSchemaConfig extends CallApiSchemaConfig, TSchemaRouteKeys extends string> = ApplyStrictConfig<TSchemaConfig, ApplyURLBasedConfig<TSchemaConfig, TSchemaRouteKeys>>;
1548
+ type InferAllMainRoutes<TBaseSchemaRoutes extends BaseCallApiSchemaRoutes> = Omit<TBaseSchemaRoutes, FallBackRouteSchemaKey>;
1549
+ type InferAllMainRouteKeys<TBaseSchemaRoutes extends BaseCallApiSchemaRoutes, TSchemaConfig extends CallApiSchemaConfig> = ApplySchemaConfiguration<TSchemaConfig, Extract<keyof InferAllMainRoutes<TBaseSchemaRoutes>, string>>;
1550
+ type InferInitURL<TBaseSchemaRoutes extends BaseCallApiSchemaRoutes, TSchemaConfig extends CallApiSchemaConfig> = keyof TBaseSchemaRoutes extends never ? InitURLOrURLObject : InferAllMainRouteKeys<TBaseSchemaRoutes, TSchemaConfig>;
1551
+ type GetCurrentRouteSchemaKey<TSchemaConfig extends CallApiSchemaConfig, TPath> = TPath extends URL ? string : TSchemaConfig["prefix"] extends string ? TPath extends (`${AtSymbol}${infer TMethod extends RouteKeyMethods}/${RemoveLeadingSlash<TSchemaConfig["prefix"]>}${infer TCurrentRoute}`) ? `${AtSymbol}${TMethod}/${RemoveLeadingSlash<TCurrentRoute>}` : TPath extends `${TSchemaConfig["prefix"]}${infer TCurrentRoute}` ? TCurrentRoute : string : TSchemaConfig["baseURL"] extends string ? TPath extends (`${AtSymbol}${infer TMethod extends RouteKeyMethods}/${TSchemaConfig["baseURL"]}${infer TCurrentRoute}`) ? `${AtSymbol}${TMethod}/${RemoveLeadingSlash<TCurrentRoute>}` : TPath extends `${TSchemaConfig["baseURL"]}${infer TCurrentRoute}` ? TCurrentRoute : string : TPath;
1552
+ type GetCurrentRouteSchema<TBaseSchemaRoutes extends BaseCallApiSchemaRoutes, TCurrentRouteSchemaKey extends string, TComputedFallBackRouteSchema = TBaseSchemaRoutes[FallBackRouteSchemaKey], TComputedCurrentRouteSchema = TBaseSchemaRoutes[TCurrentRouteSchemaKey], TComputedRouteSchema extends CallApiSchema = NonNullable<Omit<TComputedFallBackRouteSchema, keyof TComputedCurrentRouteSchema> & TComputedCurrentRouteSchema>> = TComputedRouteSchema extends CallApiSchema ? Writeable<TComputedRouteSchema, "deep"> : CallApiSchema;
1553
+ type JsonPrimitive = boolean | number | string | null | undefined;
1554
+ type SerializableObject = Record<PropertyKey, unknown>;
1555
+ type SerializableArray = Array<JsonPrimitive | SerializableObject> | ReadonlyArray<JsonPrimitive | SerializableObject>;
1556
+ type Body = UnmaskType<Exclude<RequestInit["body"], undefined> | SerializableArray | SerializableObject>;
1557
+ type InferBodyOption<TSchema extends CallApiSchema> = MakeSchemaOptionRequiredIfDefined<TSchema["body"], {
1558
+ /**
1559
+ * Body of the request, can be a object or any other supported body type.
1560
+ */
1561
+ body?: InferSchemaOutput<TSchema["body"], Body>;
1562
+ }>;
1563
+ type MethodUnion = UnmaskType<"CONNECT" | "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT" | "TRACE" | AnyString>;
1564
+ type ExtractMethodFromURL<TInitURL> = string extends TInitURL ? MethodUnion : TInitURL extends `${AtSymbol}${infer TMethod extends RouteKeyMethods}/${string}` ? Uppercase<TMethod> : MethodUnion;
1565
+ type InferMethodOption<TSchema extends CallApiSchema, TInitURL extends InitURLOrURLObject> = MakeSchemaOptionRequiredIfDefined<TSchema["method"], {
1566
+ /**
1567
+ * HTTP method for the request.
1568
+ * @default "GET"
1569
+ */
1570
+ method?: InferSchemaOutput<TSchema["method"], ExtractMethodFromURL<TInitURL>>;
1571
+ }>;
1572
+ type HeadersOption = UnmaskType<Headers | Record<"Authorization", CommonAuthorizationHeaders | undefined> | Record<"Content-Type", CommonContentTypes | undefined> | Record<CommonRequestHeaders, string | undefined> | Record<string, string | undefined> | Array<[string, string]>>;
1573
+ type InferHeadersOption<TSchema extends CallApiSchema> = MakeSchemaOptionRequiredIfDefined<TSchema["headers"], {
1574
+ /**
1575
+ * Headers to be used in the request.
1576
+ */
1577
+ headers?: InferSchemaOutput<TSchema["headers"], HeadersOption> | ((context: {
1578
+ baseHeaders: Extract<HeadersOption, Record<string, unknown>>;
1579
+ }) => InferSchemaOutput<TSchema["headers"], HeadersOption>);
1580
+ }>;
1581
+ type InferRequestOptions<TSchema extends CallApiSchema, TInitURL extends InferInitURL<BaseCallApiSchemaRoutes, CallApiSchemaConfig>> = InferBodyOption<TSchema> & InferHeadersOption<TSchema> & InferMethodOption<TSchema, TInitURL>;
1582
+ type InferMetaOption<TSchema extends CallApiSchema, TCallApiContext extends CallApiContext> = MakeSchemaOptionRequiredIfDefined<TSchema["meta"], {
1583
+ /**
1584
+ * - An optional field you can fill with additional information,
1585
+ * to associate with the request, typically used for logging or tracing.
1586
+ *
1587
+ * - A good use case for this, would be to use the info to handle specific cases in any of the shared interceptors.
1588
+ *
1589
+ * @example
1590
+ * ```ts
1591
+ * const callMainApi = callApi.create({
1592
+ * baseURL: "https://main-api.com",
1593
+ * onResponseError: ({ response, options }) => {
1594
+ * if (options.meta?.userId) {
1595
+ * console.error(`User ${options.meta.userId} made an error`);
1596
+ * }
1597
+ * },
1598
+ * });
1599
+ *
1600
+ * const response = await callMainApi({
1601
+ * url: "https://example.com/api/data",
1602
+ * meta: { userId: "123" },
1603
+ * });
1604
+ * ```
1605
+ */
1606
+ meta?: InferSchemaOutput<TSchema["meta"], TCallApiContext["Meta"]>;
1607
+ }>;
1608
+ type InferAuthOption<TSchema extends CallApiSchema> = MakeSchemaOptionRequiredIfDefined<TSchema["auth"], {
1609
+ /**
1610
+ * Automatically add an Authorization header value.
1611
+ *
1612
+ * Supports multiple authentication patterns:
1613
+ * - String: Direct authorization header value
1614
+ * - Auth object: Structured authentication configuration
1615
+ *
1616
+ * @example
1617
+ * ```ts
1618
+ * // Bearer auth
1619
+ * const response = await callMainApi({
1620
+ * url: "https://example.com/api/data",
1621
+ * auth: "123456",
1622
+ * });
1623
+ *
1624
+ * // Bearer auth
1625
+ * const response = await callMainApi({
1626
+ * url: "https://example.com/api/data",
1627
+ * auth: {
1628
+ * type: "Bearer",
1629
+ * value: "123456",
1630
+ * },
1631
+ })
1632
+ *
1633
+ * // Token auth
1634
+ * const response = await callMainApi({
1635
+ * url: "https://example.com/api/data",
1636
+ * auth: {
1637
+ * type: "Token",
1638
+ * value: "123456",
1639
+ * },
1640
+ * });
1641
+ *
1642
+ * // Basic auth
1643
+ * const response = await callMainApi({
1644
+ * url: "https://example.com/api/data",
1645
+ * auth: {
1646
+ * type: "Basic",
1647
+ * username: "username",
1648
+ * password: "password",
1649
+ * },
1650
+ * });
1651
+ *
1652
+ * ```
1653
+ */
1654
+ auth?: InferSchemaOutput<TSchema["auth"], AuthOption>;
1655
+ }>;
1656
+ type InferQueryOption<TSchema extends CallApiSchema> = MakeSchemaOptionRequiredIfDefined<TSchema["query"], {
1657
+ /**
1658
+ * Parameters to be appended to the URL (i.e: /:id)
1659
+ */
1660
+ query?: InferSchemaOutput<TSchema["query"], Query>;
1661
+ }>;
1662
+ type EmptyString = "";
1663
+ type EmptyTuple = readonly [];
1664
+ type StringTuple = readonly string[];
1665
+ type PossibleParamNamePatterns = `${string}:${string}` | `${string}{${string}}${"" | AnyString}`;
1666
+ type ExtractRouteParamNames<TCurrentRoute, TParamNamesAccumulator extends StringTuple = EmptyTuple> = TCurrentRoute extends PossibleParamNamePatterns ? TCurrentRoute extends `${infer TRoutePrefix}:${infer TParamAndRemainingRoute}` ? TParamAndRemainingRoute extends `${infer TCurrentParam}/${infer TRemainingRoute}` ? TCurrentParam extends EmptyString ? ExtractRouteParamNames<`${TRoutePrefix}/${TRemainingRoute}`, TParamNamesAccumulator> : ExtractRouteParamNames<`${TRoutePrefix}/${TRemainingRoute}`, [...TParamNamesAccumulator, TCurrentParam]> : TParamAndRemainingRoute extends `${infer TCurrentParam}` ? TCurrentParam extends EmptyString ? ExtractRouteParamNames<TRoutePrefix, TParamNamesAccumulator> : ExtractRouteParamNames<TRoutePrefix, [...TParamNamesAccumulator, TCurrentParam]> : ExtractRouteParamNames<TRoutePrefix, TParamNamesAccumulator> : TCurrentRoute extends `${infer TRoutePrefix}{${infer TCurrentParam}}${infer TRemainingRoute}` ? TCurrentParam extends EmptyString ? ExtractRouteParamNames<`${TRoutePrefix}${TRemainingRoute}`, TParamNamesAccumulator> : ExtractRouteParamNames<`${TRoutePrefix}${TRemainingRoute}`, [...TParamNamesAccumulator, TCurrentParam]> : TParamNamesAccumulator : TParamNamesAccumulator;
1667
+ type ConvertParamNamesToRecord<TParamNames extends StringTuple> = Prettify<TParamNames extends (readonly [infer TFirstParamName extends string, ...infer TRemainingParamNames extends StringTuple]) ? Record<TFirstParamName, AllowedQueryParamValues> & ConvertParamNamesToRecord<TRemainingParamNames> : NonNullable<unknown>>;
1668
+ type ConvertParamNamesToTuple<TParamNames extends StringTuple> = TParamNames extends readonly [string, ...infer TRemainingParamNames extends StringTuple] ? [AllowedQueryParamValues, ...ConvertParamNamesToTuple<TRemainingParamNames>] : [];
1669
+ type InferParamsFromRoute<TCurrentRoute> = ExtractRouteParamNames<TCurrentRoute> extends StringTuple ? ExtractRouteParamNames<TCurrentRoute> extends EmptyTuple ? Params : ConvertParamNamesToRecord<ExtractRouteParamNames<TCurrentRoute>> | ConvertParamNamesToTuple<ExtractRouteParamNames<TCurrentRoute>> : Params;
1670
+ type MakeParamsOptionRequired<TParamsSchemaOption extends CallApiSchema["params"], TBaseSchemaRoutes extends BaseCallApiSchemaRoutes, TCurrentRouteSchemaKey extends string, TObject> = MakeSchemaOptionRequiredIfDefined<TParamsSchemaOption, Params extends InferParamsFromRoute<TCurrentRouteSchemaKey> ? TObject : TCurrentRouteSchemaKey extends Extract<keyof TBaseSchemaRoutes, TCurrentRouteSchemaKey> ? undefined extends InferSchemaOutput<TParamsSchemaOption, null> ? TObject : Required<TObject> : TObject>;
1671
+ type InferParamsOption<TSchema extends CallApiSchema, TBaseSchemaRoutes extends BaseCallApiSchemaRoutes, TCurrentRouteSchemaKey extends string> = MakeParamsOptionRequired<TSchema["params"], TBaseSchemaRoutes, TCurrentRouteSchemaKey, {
1672
+ /**
1673
+ * Parameters to be appended to the URL (i.e: /:id)
1674
+ */
1675
+ params?: InferSchemaOutput<TSchema["params"], InferParamsFromRoute<TCurrentRouteSchemaKey>>;
1676
+ }>;
1677
+ type InferExtraOptions<TSchema extends CallApiSchema, TBaseSchemaRoutes extends BaseCallApiSchemaRoutes, TCurrentRouteSchemaKey extends string, TCallApiContext extends CallApiContext> = InferAuthOption<TSchema> & InferMetaOption<TSchema, TCallApiContext> & InferParamsOption<TSchema, TBaseSchemaRoutes, TCurrentRouteSchemaKey> & InferQueryOption<TSchema>;
1678
+ type ResultModeOption<TErrorData, TResultMode extends ResultModeType> = TErrorData extends false ? {
1679
+ resultMode: "onlyData";
1680
+ } : TErrorData extends false | undefined ? {
1681
+ resultMode?: "onlyData";
1682
+ } : {
1683
+ resultMode?: TResultMode;
1684
+ };
1685
+ type ThrowOnErrorBoolean = boolean;
1686
+ type ThrowOnErrorType<TErrorData, TThrowOnError extends ThrowOnErrorBoolean> = TThrowOnError | ((context: ErrorContext<{
1687
+ ErrorData: TErrorData;
1688
+ }>) => TThrowOnError);
1689
+ type ThrowOnErrorOption<TErrorData, TThrowOnError extends ThrowOnErrorBoolean> = TErrorData extends false ? {
1690
+ throwOnError: true;
1691
+ } : TErrorData extends false | undefined ? {
1692
+ throwOnError?: true;
1693
+ } : {
1694
+ throwOnError?: ThrowOnErrorType<TErrorData, TThrowOnError>;
1695
+ };
1696
+ //#endregion
1699
1697
  //#region src/result.d.ts
1700
1698
  type ResponseParser<TData> = (text: string) => Awaitable<TData>;
1701
1699
  declare const getResponseType: <TData>(response: Response, responseParser: ResponseParser<TData>) => {
@@ -1827,5 +1825,5 @@ type DefaultCallApiContext = Prettify<OverrideCallApiContext<Required<CallApiCon
1827
1825
  Meta: GlobalMeta;
1828
1826
  }>>;
1829
1827
  //#endregion
1830
- export { RetryOptions as $, GetCallApiContext as A, DedupeOptions as B, CallApiExtraOptions as C, DistributiveOmit as Ct, CallApiResultLoose as D, fetchSpecificKeys as Dt, CallApiResult as E, Writeable as Et, HTTPError as F, HooksOrHooksArray as G, CallApiRequestOptionsForHooks as H, ValidationError as I, ResponseContext as J, RequestContext as K, FetchImpl as L, GlobalMeta as M, InstanceContext as N, GetBaseSchemaConfig as O, Register as P, RefetchOptions as Q, FetchMiddlewareContext as R, CallApiContext as S, AnyString as St, CallApiRequestOptions as T, Satisfies as Tt, ErrorContext as U, CallApiExtraOptionsForHooks as V, Hooks as W, ResponseStreamContext as X, ResponseErrorContext as Y, SuccessContext as Z, ResponseTypeType as _, InferSchemaOutput as _t, PluginHooks as a, InferAllMainRoutes as at, BaseCallApiExtraOptions as b, fallBackRouteSchemaKey as bt, CallApiResultErrorVariant as c, ThrowOnErrorBoolean as ct, GetResponseType as d, BaseCallApiSchemaRoutes as dt, ApplyStrictConfig as et, InferCallApiResult as f, BaseSchemaRouteKeyPrefixes as ft, ResponseTypeMap as g, InferSchemaInput as gt, PossibleValidationError as h, CallApiSchemaType as ht, CallApiPlugin as i, InferAllMainRouteKeys as it, GetCallApiContextRequired as j, GetBaseSchemaRoutes as k, CallApiResultSuccessOrErrorVariant as l, URLOptions as lt, PossibleJavaScriptError as m, CallApiSchemaConfig as mt, DefaultDataType as n, GetCurrentRouteSchema as nt, PluginMiddlewares as o, InferInitURL as ot, PossibleHTTPError as p, CallApiSchema as pt, RequestStreamContext as q, DefaultPluginArray as r, GetCurrentRouteSchemaKey as rt, PluginSetupContext as s, InferParamsFromRoute as st, DefaultCallApiContext as t, ApplyURLBasedConfig as tt, CallApiResultSuccessVariant as u, BaseCallApiSchemaAndConfig as ut, ResultModeType as v, InferSchemaResult as vt, CallApiParameters as w, NoInferUnMasked as wt, CallApiConfig as x, AnyFunction as xt, BaseCallApiConfig as y, FallBackRouteSchemaKey as yt, Middlewares as z };
1831
- //# sourceMappingURL=default-types-CF53Uvuq.d.ts.map
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
@@ -37,13 +37,12 @@ const isValidJsonString = (value) => {
37
37
  const isSerializableObject = (value) => {
38
38
  return isPlainObject(value) || isArray(value) || typeof value?.toJSON === "function";
39
39
  };
40
- const isFunction = (value) => typeof value === "function";
40
+ const isFunction = (value) => {
41
+ return typeof value === "function";
42
+ };
41
43
  const isQueryString = (value) => isString(value) && value.includes("=");
42
44
  const isString = (value) => typeof value === "string";
43
45
  const isPromise = (value) => value instanceof Promise;
44
- const isReadableStream = (value) => {
45
- return value instanceof ReadableStream;
46
- };
47
46
  //#endregion
48
47
  //#region src/auth.ts
49
48
  const resolveAuthValue = (value) => isFunction(value) ? value() : value;
@@ -260,6 +259,12 @@ const handleConfigValidation = async (validationOptions) => {
260
259
  issues: [{ message: `Strict Mode - No schema found for route '${currentRouteSchemaKey}' ` }],
261
260
  response: null
262
261
  });
262
+ if (!resolvedSchema) return {
263
+ extraOptionsValidationResult: {},
264
+ requestOptionsValidationResult: {},
265
+ resolvedSchema,
266
+ resolvedSchemaConfig
267
+ };
263
268
  const [extraOptionsValidationResult, requestOptionsValidationResult] = await Promise.all([handleOptionsValidation({
264
269
  options,
265
270
  schema: resolvedSchema,
@@ -410,10 +415,10 @@ const getFullURL = (initURL, baseURL) => {
410
415
  return initURL.length > 0 && !initURL.startsWith("/") && !baseURL.endsWith("/") ? `${baseURL}/${initURL}` : `${baseURL}${initURL}`;
411
416
  };
412
417
  const getFullAndNormalizedURL = (options) => {
413
- const { baseURL, initURL, params, query } = options;
418
+ const { baseURL, debugMode, initURL, params, query } = options;
414
419
  const normalizedInitURL = normalizeURL(initURL);
415
420
  const fullURL = getFullURL(mergeUrlWithQuery(mergeUrlWithParams(normalizedInitURL, params), query), baseURL);
416
- if (!URL.canParse(fullURL)) {
421
+ if ((debugMode ?? extraOptionDefaults.debugMode) && !URL.canParse(fullURL)) {
417
422
  const errorMessage = !baseURL ? `Invalid URL '${initURL}'. Are you passing a relative url to CallApi without setting the 'baseURL' option?` : `Invalid URL '${fullURL}'. Please validate that you are passing the correct url.`;
418
423
  console.error(errorMessage);
419
424
  }
@@ -644,6 +649,7 @@ const deterministicHashFn = (value) => {
644
649
  //#region src/constants/defaults.ts
645
650
  const extraOptionDefaults = Object.freeze(defineEnum({
646
651
  bodySerializer: JSON.stringify,
652
+ debugMode: true,
647
653
  defaultHTTPErrorMessage: "Request failed unexpectedly",
648
654
  dedupeCacheScope: "local",
649
655
  dedupeKey: (ctx) => `${ctx.options.fullURL}-${deterministicHashFn({
@@ -667,6 +673,6 @@ const extraOptionDefaults = Object.freeze(defineEnum({
667
673
  }));
668
674
  const requestOptionDefaults = Object.freeze(defineEnum({ method: "GET" }));
669
675
  //#endregion
670
- export { getCurrentRouteSchemaKeyAndMainInitURL as A, isReadableStream as B, defineSchema as C, toQueryString as D, toFormData as E, fallBackRouteSchemaKey as F, fetchSpecificKeys as I, isArray as L, handleSchemaValidation as M, HTTPError as N, toSearchParams as O, ValidationError as P, isBoolean as R, definePlugin as S, defineSchemaRoutes as T, isString as V, isValidationError as _, getBody as a, defineInstanceConfig as b, getMethod as c, splitConfig as d, waitFor as f, isJavascriptError as g, isHTTPErrorInstance as h, createTimeoutSignal as i, handleConfigValidation as j, getFullAndNormalizedURL as k, getResolvedHeaders as l, isHTTPError as m, requestOptionDefaults as n, getFetchImpl as o, objectifyHeaders as p, createCombinedSignal as r, getHeaders as s, extraOptionDefaults as t, omitKeys as u, isValidationErrorInstance as v, defineSchemaConfig as w, defineMainSchema as x, defineBaseConfig as y, isFunction as z };
676
+ export { getCurrentRouteSchemaKeyAndMainInitURL as A, isString as B, defineSchema as C, toQueryString as D, toFormData as E, fallBackRouteSchemaKey as F, fetchSpecificKeys as I, isArray as L, handleSchemaValidation as M, HTTPError as N, toSearchParams as O, ValidationError as P, isBoolean as R, definePlugin as S, defineSchemaRoutes as T, isValidationError as _, getBody as a, defineInstanceConfig as b, getMethod as c, splitConfig as d, waitFor as f, isJavascriptError as g, isHTTPErrorInstance as h, createTimeoutSignal as i, handleConfigValidation as j, getFullAndNormalizedURL as k, getResolvedHeaders as l, isHTTPError as m, requestOptionDefaults as n, getFetchImpl as o, objectifyHeaders as p, createCombinedSignal as r, getHeaders as s, extraOptionDefaults as t, omitKeys as u, isValidationErrorInstance as v, defineSchemaConfig as w, defineMainSchema as x, defineBaseConfig as y, isFunction as z };
671
677
 
672
- //# sourceMappingURL=defaults-WfRTxvn6.js.map
678
+ //# sourceMappingURL=defaults-IsBgvt90.js.map