@zayne-labs/callapi 1.14.1 → 1.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{conditional-types-BFeM4YSg.d.ts → conditional-types-C9cMfJMZ.d.ts} +3 -2
- package/dist/constants/index.d.ts +1 -1
- package/dist/constants/index.js +1 -1
- package/dist/{constants-DB6Z7gFB.js → constants-C8dGbmdY.js} +119 -93
- package/dist/constants-C8dGbmdY.js.map +1 -0
- package/dist/{index-DuBaw9km.d.ts → index-Dcg43451.d.ts} +6 -6
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/utils/external/index.d.ts +1 -1
- package/dist/utils/external/index.js +1 -1
- package/package.json +4 -4
- package/dist/constants-DB6Z7gFB.js.map +0 -1
|
@@ -125,7 +125,8 @@ type AllowedQueryParamValues = UnmaskType<boolean | number | string>;
|
|
|
125
125
|
type RecordStyleParams = UnmaskType<Record<string, AllowedQueryParamValues>>;
|
|
126
126
|
type TupleStyleParams = UnmaskType<AllowedQueryParamValues[]>;
|
|
127
127
|
type Params = UnmaskType<RecordStyleParams | TupleStyleParams>;
|
|
128
|
-
type
|
|
128
|
+
type StructuredQueryValues = Record<string, unknown> | unknown[] | null | undefined;
|
|
129
|
+
type Query = UnmaskType<Record<string, AllowedQueryParamValues | StructuredQueryValues> | URLSearchParams>;
|
|
129
130
|
type InitURLOrURLObject = AnyString | RouteKeyMethodsURLUnion | URL;
|
|
130
131
|
interface URLOptions {
|
|
131
132
|
/**
|
|
@@ -1912,4 +1913,4 @@ type ThrowOnErrorOption<TErrorData, TThrowOnError extends ThrowOnErrorBoolean> =
|
|
|
1912
1913
|
};
|
|
1913
1914
|
//#endregion
|
|
1914
1915
|
export { defineMainSchema as $, Register as A, BaseCallApiSchemaAndConfig as At, ResponseErrorContext as B, fallBackRouteSchemaKey as Bt, CallApiResultLoose as C, PossibleJavaScriptError as Ct, GetCallApiContextRequired as D, ResultModeType as Dt, GetCallApiContext as E, ResponseTypeType as Et, Hooks as F, InferSchemaInput as Ft, objectifyHeaders as G, NoInferUnMasked as Gt, SuccessContext as H, CommonContentTypes as Ht, HooksOrHooksArray as I, InferSchemaOutput as It, isJavascriptError as J, isHTTPError as K, Writeable as Kt, RequestContext as L, InferSchemaResult as Lt, CallApiExtraOptionsForHooks as M, BaseSchemaRouteKeyPrefixes as Mt, CallApiRequestOptionsForHooks as N, CallApiSchema as Nt, GlobalMeta as O, HTTPError as Ot, ErrorContext as P, CallApiSchemaConfig as Pt, defineInstanceConfig as Q, RequestStreamContext as R, URLOptions as Rt, CallApiResult as S, PossibleHTTPError as St, GetBaseSchemaRoutes as T, ResponseTypeMap as Tt, RefetchOptions as U, CommonRequestHeaders as Ut, ResponseStreamContext as V, AnyString as Vt, RetryOptions as W, DistributiveOmit as Wt, isValidationErrorInstance as X, isValidationError as Y, defineBaseConfig as Z, CallApiConfig as _, CallApiResultErrorVariant as _t, GetCurrentRouteSchemaKey as a, toQueryString as at, CallApiParameters as b, GetResponseType as bt, InferAllMainRoutes as c, DefaultDataType as ct, SerializableArray as d, PluginHooks as dt, definePlugin as et, SerializableObject as f, PluginMiddlewares as ft, BaseCallApiExtraOptions as g, Middlewares as gt, BaseCallApiConfig as h, FetchMiddlewareContext as ht, GetCurrentRouteSchema as i, toFormData as it, DedupeOptions as j, BaseCallApiSchemaRoutes as jt, InstanceContext as k, ValidationError as kt, InferInitURL as l, DefaultPluginArray as lt, AuthOption as m, FetchImpl as mt, ApplyURLBasedConfig as n, defineSchemaConfig as nt, HeadersOption as o, toSearchParams as ot, ThrowOnErrorBoolean as p, PluginSetupContext as pt, isHTTPErrorInstance as q, fetchSpecificKeys as qt, Body as r, defineSchemaRoutes as rt, InferAllMainRouteKeys as s, DefaultCallApiContext as st, ApplyStrictConfig as t, defineSchema as tt, InferParamsFromRoute as u, CallApiPlugin as ut, CallApiContext as v, CallApiResultSuccessOrErrorVariant as vt, GetBaseSchemaConfig as w, PossibleValidationError as wt, CallApiRequestOptions as x, InferCallApiResult as xt, CallApiExtraOptions as y, CallApiResultSuccessVariant as yt, ResponseContext as z, FallBackRouteSchemaKey as zt };
|
|
1915
|
-
//# sourceMappingURL=conditional-types-
|
|
1916
|
+
//# sourceMappingURL=conditional-types-C9cMfJMZ.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Bt as fallBackRouteSchemaKey, L as RequestContext, qt as fetchSpecificKeys, zt as FallBackRouteSchemaKey } from "../conditional-types-
|
|
1
|
+
import { Bt as fallBackRouteSchemaKey, L as RequestContext, qt as fetchSpecificKeys, zt as FallBackRouteSchemaKey } from "../conditional-types-C9cMfJMZ.js";
|
|
2
2
|
//#region src/constants/defaults.d.ts
|
|
3
3
|
declare const extraOptionDefaults: Readonly<Readonly<{
|
|
4
4
|
bodySerializer: {
|
package/dist/constants/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { F as fallBackRouteSchemaKey, n as requestOptionDefaults, t as extraOptionDefaults, z as fetchSpecificKeys } from "../constants-
|
|
1
|
+
import { F as fallBackRouteSchemaKey, n as requestOptionDefaults, t as extraOptionDefaults, z as fetchSpecificKeys } from "../constants-C8dGbmdY.js";
|
|
2
2
|
export { extraOptionDefaults, fallBackRouteSchemaKey, fetchSpecificKeys, requestOptionDefaults };
|
|
@@ -348,90 +348,6 @@ const getCurrentRouteSchemaKeyAndMainInitURL = (context) => {
|
|
|
348
348
|
};
|
|
349
349
|
};
|
|
350
350
|
//#endregion
|
|
351
|
-
//#region src/url.ts
|
|
352
|
-
const handleArrayParams = (url, params) => {
|
|
353
|
-
let newUrl = url;
|
|
354
|
-
const urlParts = newUrl.split("/");
|
|
355
|
-
const matchedParamsArray = [];
|
|
356
|
-
for (const part of urlParts) {
|
|
357
|
-
if (!(part.startsWith(":") || part.startsWith("{") && part.endsWith("}"))) continue;
|
|
358
|
-
matchedParamsArray.push(part);
|
|
359
|
-
}
|
|
360
|
-
for (const [paramIndex, matchedParam] of matchedParamsArray.entries()) {
|
|
361
|
-
const stringParamValue = String(params[paramIndex]);
|
|
362
|
-
newUrl = newUrl.replace(matchedParam, stringParamValue);
|
|
363
|
-
}
|
|
364
|
-
return newUrl;
|
|
365
|
-
};
|
|
366
|
-
const handleObjectParams = (url, params) => {
|
|
367
|
-
let newUrl = url;
|
|
368
|
-
for (const [paramKey, paramValue] of Object.entries(params)) {
|
|
369
|
-
const colonPattern = `:${paramKey}`;
|
|
370
|
-
const bracePattern = `{${paramKey}}`;
|
|
371
|
-
const stringValue = String(paramValue);
|
|
372
|
-
newUrl = newUrl.replace(colonPattern, stringValue);
|
|
373
|
-
newUrl = newUrl.replace(bracePattern, stringValue);
|
|
374
|
-
}
|
|
375
|
-
return newUrl;
|
|
376
|
-
};
|
|
377
|
-
const mergeUrlWithParams = (url, params) => {
|
|
378
|
-
if (!params) return url;
|
|
379
|
-
return isArray(params) ? handleArrayParams(url, params) : handleObjectParams(url, params);
|
|
380
|
-
};
|
|
381
|
-
const mergeUrlWithQuery = (url, query) => {
|
|
382
|
-
if (!query) return url;
|
|
383
|
-
const queryString = new URLSearchParams(query).toString();
|
|
384
|
-
if (queryString.length === 0) return url;
|
|
385
|
-
if (url.endsWith("?")) return `${url}${queryString}`;
|
|
386
|
-
if (url.includes("?")) return `${url}&${queryString}`;
|
|
387
|
-
return `${url}?${queryString}`;
|
|
388
|
-
};
|
|
389
|
-
/**
|
|
390
|
-
* @description Extracts the HTTP method from method-prefixed route patterns.
|
|
391
|
-
*
|
|
392
|
-
* Analyzes URLs that start with method modifiers (e.g., "@get/", "@post/") and extracts
|
|
393
|
-
* the HTTP method for use in API requests. This enables method specification directly
|
|
394
|
-
* in route definitions.
|
|
395
|
-
*
|
|
396
|
-
* @param initURL - The URL string to analyze for method modifiers
|
|
397
|
-
* @returns The extracted HTTP method (lowercase) if found, otherwise undefined
|
|
398
|
-
*
|
|
399
|
-
* @example
|
|
400
|
-
* ```typescript
|
|
401
|
-
* extractMethodFromURL("@get/users"); // Returns: "get"
|
|
402
|
-
* extractMethodFromURL("@post/users"); // Returns: "post"
|
|
403
|
-
* ```
|
|
404
|
-
*/
|
|
405
|
-
const extractMethodFromURL = (initURL) => {
|
|
406
|
-
if (!initURL?.startsWith("@")) return;
|
|
407
|
-
const methodFromURL = routeKeyMethods.find((method) => initURL.startsWith(`@${method}/`));
|
|
408
|
-
if (!methodFromURL) return;
|
|
409
|
-
return methodFromURL;
|
|
410
|
-
};
|
|
411
|
-
const normalizeURL = (initURL, options = {}) => {
|
|
412
|
-
const { retainLeadingSlashForRelativeURLs = true } = options;
|
|
413
|
-
const methodFromURL = extractMethodFromURL(initURL);
|
|
414
|
-
if (!methodFromURL) return initURL;
|
|
415
|
-
return retainLeadingSlashForRelativeURLs && !initURL.includes("http") ? initURL.replace(`@${methodFromURL}`, "") : initURL.replace(`@${methodFromURL}/`, "");
|
|
416
|
-
};
|
|
417
|
-
const getFullURL = (initURL, baseURL) => {
|
|
418
|
-
if (!baseURL || initURL.startsWith("http")) return initURL;
|
|
419
|
-
return initURL.length > 0 && !initURL.startsWith("/") && !baseURL.endsWith("/") ? `${baseURL}/${initURL}` : `${baseURL}${initURL}`;
|
|
420
|
-
};
|
|
421
|
-
const getFullAndNormalizedURL = (options) => {
|
|
422
|
-
const { baseURL, debugMode, initURL, params, query } = options;
|
|
423
|
-
const normalizedInitURL = normalizeURL(initURL);
|
|
424
|
-
const fullURL = getFullURL(mergeUrlWithQuery(mergeUrlWithParams(normalizedInitURL, params), query), baseURL);
|
|
425
|
-
if ((debugMode ?? extraOptionDefaults.debugMode) && !URL.canParse(fullURL)) {
|
|
426
|
-
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.`;
|
|
427
|
-
console.error(errorMessage);
|
|
428
|
-
}
|
|
429
|
-
return {
|
|
430
|
-
fullURL,
|
|
431
|
-
normalizedInitURL
|
|
432
|
-
};
|
|
433
|
-
};
|
|
434
|
-
//#endregion
|
|
435
351
|
//#region src/utils/external/body.ts
|
|
436
352
|
const toStringOrStringify = (value) => {
|
|
437
353
|
return isString(value) ? value : JSON.stringify(value);
|
|
@@ -443,6 +359,7 @@ const toSearchParams = (data, schema) => {
|
|
|
443
359
|
issues: result.issues,
|
|
444
360
|
response: null
|
|
445
361
|
});
|
|
362
|
+
if (result.value instanceof URLSearchParams) return new URLSearchParams(result.value);
|
|
446
363
|
const searchParams = new URLSearchParams();
|
|
447
364
|
for (const [key, value] of Object.entries(result.value)) {
|
|
448
365
|
if (value == null) continue;
|
|
@@ -568,6 +485,115 @@ const objectifyHeaders = (headers) => {
|
|
|
568
485
|
return Object.fromEntries(headers);
|
|
569
486
|
};
|
|
570
487
|
//#endregion
|
|
488
|
+
//#region src/url.ts
|
|
489
|
+
const isReservedPathSegment = (value) => value === "." || value === "..";
|
|
490
|
+
const encodeParamValue = (value) => {
|
|
491
|
+
const stringValue = String(value);
|
|
492
|
+
if (isReservedPathSegment(stringValue)) throw new TypeError("Path parameters cannot be reserved path segments");
|
|
493
|
+
return encodeURIComponent(stringValue);
|
|
494
|
+
};
|
|
495
|
+
const isColonPathParam = (segment) => Boolean(segment?.startsWith(":"));
|
|
496
|
+
const isBracePathParam = (segment) => {
|
|
497
|
+
return Boolean(segment?.startsWith("{") && segment.endsWith("}"));
|
|
498
|
+
};
|
|
499
|
+
const handleArrayParams = (url, params) => {
|
|
500
|
+
const placeholders = [];
|
|
501
|
+
const urlSegments = url.split("/");
|
|
502
|
+
for (const segment of urlSegments) {
|
|
503
|
+
if (!isColonPathParam(segment) && !isBracePathParam(segment)) continue;
|
|
504
|
+
placeholders.push(segment);
|
|
505
|
+
}
|
|
506
|
+
let resolvedURL = url;
|
|
507
|
+
for (const index of placeholders.keys()) {
|
|
508
|
+
const placeholder = placeholders[index];
|
|
509
|
+
if (placeholder === void 0) continue;
|
|
510
|
+
const paramValue = params[index];
|
|
511
|
+
resolvedURL = resolvedURL.replace(placeholder, encodeParamValue(paramValue));
|
|
512
|
+
}
|
|
513
|
+
return resolvedURL;
|
|
514
|
+
};
|
|
515
|
+
const getPathParamKey = (segment) => {
|
|
516
|
+
if (isColonPathParam(segment)) return segment.slice(1);
|
|
517
|
+
if (isBracePathParam(segment)) return segment.slice(1, -1);
|
|
518
|
+
return null;
|
|
519
|
+
};
|
|
520
|
+
const handleObjectParams = (url, params) => {
|
|
521
|
+
const urlSegments = url.split("/");
|
|
522
|
+
for (const segmentIndex of urlSegments.keys()) {
|
|
523
|
+
const segment = urlSegments[segmentIndex];
|
|
524
|
+
if (segment === void 0) continue;
|
|
525
|
+
const paramKey = getPathParamKey(segment);
|
|
526
|
+
if (paramKey === null || !Object.hasOwn(params, paramKey)) continue;
|
|
527
|
+
const paramValue = params[paramKey];
|
|
528
|
+
urlSegments[segmentIndex] = encodeParamValue(paramValue);
|
|
529
|
+
}
|
|
530
|
+
return urlSegments.join("/");
|
|
531
|
+
};
|
|
532
|
+
const mergeUrlWithParams = (url, params) => {
|
|
533
|
+
if (!params) return url;
|
|
534
|
+
return isArray(params) ? handleArrayParams(url, params) : handleObjectParams(url, params);
|
|
535
|
+
};
|
|
536
|
+
const mergeUrlWithQuery = (url, query) => {
|
|
537
|
+
if (!query) return url;
|
|
538
|
+
const incomingSearchParams = toSearchParams(query);
|
|
539
|
+
if (incomingSearchParams.size === 0) return url;
|
|
540
|
+
if (!url.includes("?")) return `${url}?${incomingSearchParams}`;
|
|
541
|
+
if (url.endsWith("?")) return `${url}${incomingSearchParams}`;
|
|
542
|
+
const [mainUrl, existingQueryString] = url.split("?");
|
|
543
|
+
const searchParams = new URLSearchParams(existingQueryString);
|
|
544
|
+
for (const key of incomingSearchParams.keys()) searchParams.delete(key);
|
|
545
|
+
for (const entry of incomingSearchParams) searchParams.append(...entry);
|
|
546
|
+
return `${mainUrl}?${searchParams}`;
|
|
547
|
+
};
|
|
548
|
+
/**
|
|
549
|
+
* @description Extracts the HTTP method from method-prefixed route patterns.
|
|
550
|
+
*
|
|
551
|
+
* Analyzes URLs that start with method modifiers (e.g., "@get/", "@post/") and extracts
|
|
552
|
+
* the HTTP method for use in API requests. This enables method specification directly
|
|
553
|
+
* in route definitions.
|
|
554
|
+
*
|
|
555
|
+
* @param initURL - The URL string to analyze for method modifiers
|
|
556
|
+
* @returns The extracted HTTP method (lowercase) if found, otherwise undefined
|
|
557
|
+
*
|
|
558
|
+
* @example
|
|
559
|
+
* ```typescript
|
|
560
|
+
* extractMethodFromURL("@get/users"); // Returns: "get"
|
|
561
|
+
* extractMethodFromURL("@post/users"); // Returns: "post"
|
|
562
|
+
* ```
|
|
563
|
+
*/
|
|
564
|
+
const extractMethodFromURL = (initURL) => {
|
|
565
|
+
if (!initURL?.startsWith("@")) return;
|
|
566
|
+
const methodFromURL = routeKeyMethods.find((method) => initURL.startsWith(`@${method}/`));
|
|
567
|
+
if (!methodFromURL) return;
|
|
568
|
+
return methodFromURL;
|
|
569
|
+
};
|
|
570
|
+
const isAbsoluteHTTPURL = (value) => {
|
|
571
|
+
return value.startsWith("http://") || value.startsWith("https://");
|
|
572
|
+
};
|
|
573
|
+
const normalizeURL = (initURL, options = {}) => {
|
|
574
|
+
const { retainLeadingSlashForRelativeURLs = true } = options;
|
|
575
|
+
const methodFromURL = extractMethodFromURL(initURL);
|
|
576
|
+
if (!methodFromURL) return initURL;
|
|
577
|
+
const initURLWithoutMethod = initURL.replace(`@${methodFromURL}/`, "");
|
|
578
|
+
return retainLeadingSlashForRelativeURLs && !isAbsoluteHTTPURL(initURLWithoutMethod) ? `/${initURLWithoutMethod}` : initURLWithoutMethod;
|
|
579
|
+
};
|
|
580
|
+
const getFullURL = (initURL, baseURL) => {
|
|
581
|
+
if (!baseURL || isAbsoluteHTTPURL(initURL)) return initURL;
|
|
582
|
+
const normalizedBaseURL = baseURL.replace(/\/+$/, "");
|
|
583
|
+
const normalizedInitURL = initURL.replace(/^\/+/, "");
|
|
584
|
+
return normalizedInitURL ? `${normalizedBaseURL}/${normalizedInitURL}` : normalizedBaseURL;
|
|
585
|
+
};
|
|
586
|
+
const getFullAndNormalizedURL = (options) => {
|
|
587
|
+
const { baseURL, debugMode, initURL, params, query } = options;
|
|
588
|
+
const normalizedInitURL = normalizeURL(initURL);
|
|
589
|
+
const fullURL = getFullURL(mergeUrlWithQuery(mergeUrlWithParams(normalizedInitURL, params), query), baseURL);
|
|
590
|
+
if ((debugMode ?? extraOptionDefaults.debugMode) && !isAbsoluteHTTPURL(fullURL) && !URL.canParse(fullURL)) console.error(`Relative URL '${fullURL}' may fail during SSR. Set an absolute 'baseURL' for server-side requests.`);
|
|
591
|
+
return {
|
|
592
|
+
fullURL,
|
|
593
|
+
normalizedInitURL
|
|
594
|
+
};
|
|
595
|
+
};
|
|
596
|
+
//#endregion
|
|
571
597
|
//#region src/utils/common.ts
|
|
572
598
|
const omitKeys = (initialObject, keysToOmit) => {
|
|
573
599
|
const updatedObject = {};
|
|
@@ -594,16 +620,16 @@ const detectContentTypeHeader = (body) => {
|
|
|
594
620
|
};
|
|
595
621
|
const getHeaders = async (options) => {
|
|
596
622
|
const { auth, body, resolvedHeaders } = options;
|
|
597
|
-
const authHeaderObject = await getAuthHeader(auth);
|
|
598
623
|
const resolvedHeadersObject = objectifyHeaders(resolvedHeaders);
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
contentTypeHeader && Object.assign(resolvedHeadersObject, contentTypeHeader);
|
|
602
|
-
}
|
|
603
|
-
return {
|
|
604
|
-
...authHeaderObject,
|
|
624
|
+
const headersObject = {
|
|
625
|
+
...await getAuthHeader(auth),
|
|
605
626
|
...resolvedHeadersObject
|
|
606
627
|
};
|
|
628
|
+
if (!new Headers(headersObject).has("Content-Type")) {
|
|
629
|
+
const contentTypeHeader = detectContentTypeHeader(body);
|
|
630
|
+
contentTypeHeader && Object.assign(headersObject, contentTypeHeader);
|
|
631
|
+
}
|
|
632
|
+
return headersObject;
|
|
607
633
|
};
|
|
608
634
|
const getMethod = (ctx) => {
|
|
609
635
|
const { initURL, method } = ctx;
|
|
@@ -684,6 +710,6 @@ const extraOptionDefaults = Object.freeze(defineEnum({
|
|
|
684
710
|
}));
|
|
685
711
|
const requestOptionDefaults = Object.freeze(defineEnum({ method: "GET" }));
|
|
686
712
|
//#endregion
|
|
687
|
-
export { getCurrentRouteSchemaKeyAndMainInitURL as A,
|
|
713
|
+
export { getCurrentRouteSchemaKeyAndMainInitURL as A, definePlugin as C, toFormData as D, defineSchemaRoutes as E, fallBackRouteSchemaKey as F, isArray as I, isFunction as L, handleSchemaValidation as M, HTTPError as N, toQueryString as O, ValidationError as P, isString as R, defineMainSchema as S, defineSchemaConfig as T, isJavascriptError as _, getBody as a, defineBaseConfig as b, getMethod as c, splitConfig as d, waitFor as f, isHTTPErrorInstance as g, isHTTPError as h, createTimeoutSignal as i, handleConfigValidation as j, toSearchParams as k, getResolvedHeaders as l, objectifyHeaders as m, requestOptionDefaults as n, getFetchImpl as o, getFullAndNormalizedURL as p, createCombinedSignal as r, getHeaders as s, extraOptionDefaults as t, omitKeys as u, isValidationError as v, defineSchema as w, defineInstanceConfig as x, isValidationErrorInstance as y, fetchSpecificKeys as z };
|
|
688
714
|
|
|
689
|
-
//# sourceMappingURL=constants-
|
|
715
|
+
//# sourceMappingURL=constants-C8dGbmdY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants-C8dGbmdY.js","names":[],"sources":["../src/types/type-helpers.ts","../src/constants/common.ts","../src/utils/guards.ts","../src/auth.ts","../src/constants/validation.ts","../src/utils/external/error.ts","../src/validation.ts","../src/utils/external/body.ts","../src/utils/external/define.ts","../src/utils/external/guards.ts","../src/utils/external/headers.ts","../src/url.ts","../src/utils/common.ts","../src/constants/defaults.ts"],"sourcesContent":["// == These two types allows for adding arbitrary literal types, while still provided autocomplete for defaults.\n// == Usually intersection with \"{}\" or \"NonNullable<unknown>\" would make it work fine, but the placeholder with never type is added to make the AnyWhatever type appear last in a given union.\nexport type AnyString = string & NonNullable<unknown>;\nexport type AnyNumber = number & NonNullable<unknown>;\n\n// eslint-disable-next-line ts-eslint/no-explicit-any -- Any is fine here\nexport type AnyObject = Record<keyof any, any>;\n\n// eslint-disable-next-line ts-eslint/no-explicit-any -- Any is required here so that one can pass custom function type without type errors\nexport type AnyFunction<TResult = unknown> = (...args: any[]) => TResult;\n\nexport type Prettify<TObject> = NonNullable<unknown> & { [Key in keyof TObject]: TObject[Key] };\n\ntype WriteableLevel = \"deep\" | \"shallow\";\n\n/**\n * Makes all properties in an object type writeable (removes readonly modifiers).\n * Supports both shallow and deep modes, and handles special cases like arrays, tuples, and unions.\n * @template TObject - The object type to make writeable\n * @template TVariant - The level of writeable transformation (\"shallow\" | \"deep\")\n */\n\ntype ArrayOrObject = Record<number | string | symbol, unknown> | unknown[] | readonly unknown[];\n\nexport type Writeable<TObject, TLevel extends WriteableLevel = \"shallow\"> =\n\tTObject extends ArrayOrObject ?\n\t\t{\n\t\t\t-readonly [Key in keyof TObject]: TLevel extends \"deep\" ?\n\t\t\t\tNonNullable<TObject[Key]> extends ArrayOrObject ?\n\t\t\t\t\tWriteable<TObject[Key], \"deep\">\n\t\t\t\t:\tTObject[Key]\n\t\t\t:\tTObject[Key];\n\t\t}\n\t:\tTObject;\n\nexport const defineEnum = <const TValue extends object>(value: TValue) =>\n\tObject.freeze(value) as Readonly<Writeable<TValue>>;\n\nexport type UnionToIntersection<TUnion> =\n\t(TUnion extends unknown ? (param: TUnion) => void : never) extends (param: infer TParam) => void ?\n\t\tTParam\n\t:\tnever;\n\n// == Using this Immediately Indexed Mapped type helper to help show computed type of anything passed to it instead of just the type name\nexport type UnmaskType<TValue> = { value: TValue }[\"value\"];\n\n/**\n * @description Userland implementation of NoInfer intrinsic type, but this one doesn't show up on hover like the intrinsic one\n *\n * Prevents TypeScript from inferring `TGeneric` at this position by creating a circular dependency.\n * The tuple index `[TGeneric extends unknown ? 0 : never]` depends on `TGeneric`, forcing TS to\n * skip this site for inference and use other arguments or defaults instead.\n */\nexport type NoInferUnMasked<TGeneric> = [TGeneric][TGeneric extends unknown ? 0 : never];\n\ntype RemoveSlashImpl<TUrl extends string, TDirection extends \"leading\" | \"trailing\"> =\n\tTDirection extends \"leading\" ?\n\t\tTUrl extends `/${infer TWithoutLeadingSlash}` ?\n\t\t\tTWithoutLeadingSlash\n\t\t:\tTUrl\n\t: TDirection extends \"trailing\" ?\n\t\tTUrl extends `${infer TWithoutTailingSlash}/` ?\n\t\t\tTWithoutTailingSlash\n\t\t:\tTUrl\n\t:\tnever;\n\nexport type RemoveTrailingSlash<TUrl extends string> = RemoveSlashImpl<TUrl, \"trailing\">;\nexport type RemoveLeadingSlash<TUrl extends string> = RemoveSlashImpl<TUrl, \"leading\">;\n\nexport type Awaitable<TValue> = Promise<TValue> | TValue;\n\n// export type MatchExactObjectType<TActualObject extends TExpectedObject, TExpectedObject> = {\n// \t[Key in keyof TActualObject]: Key extends keyof TExpectedObject ? TActualObject[Key] : never;\n// };\n\nexport type Satisfies<TActualType extends TExpectedTypeShape, TExpectedTypeShape> = {\n\t[Key in keyof TActualType]: Key extends keyof TExpectedTypeShape ? TActualType[Key] : never;\n};\n\n// export type Satisfies<TActualObject extends TExpectedObject, TExpectedObject> = {\n// \t[Key in keyof TActualObject & keyof TExpectedObject]: TActualObject[Key];\n// };\n\nexport type DistributiveOmit<TObject, TKeysToOmit extends keyof TObject> =\n\tTObject extends unknown ? Omit<TObject, TKeysToOmit> : never;\n\nexport type DistributivePick<TObject, TKeysToPick extends keyof TObject> =\n\tTObject extends unknown ? Pick<TObject, TKeysToPick> : never;\n\ntype ErrorMessages<TType extends number | string | symbol = never> = Partial<\n\tRecord<\"$all\" | number | symbol | (AnyString | TType), unknown>\n> | null;\n\n/**\n * Type utility that takes two types and allows only the properties of the first type. The properties of the second will be disallowed (typed as `never` by default or a custom message).\n *\n * @template TFirstType The first type. Properties of this type will be required.\n * @template TSecondType The second type. Properties of this type will be disallowed.\n * @template TErrorMessages An object of custom messages to display on the properties of the second type that are disallowed.\n */\ntype AllowOnlyFirst<TFirstType, TSecondType, TErrorMessages extends ErrorMessages = never> = Prettify<\n\tTFirstType & {\n\t\t[Key in keyof Omit<TSecondType, keyof TFirstType>]?: Key extends keyof TErrorMessages ?\n\t\t\tTErrorMessages[Key]\n\t\t: \"$all\" extends keyof TErrorMessages ? TErrorMessages[\"$all\"]\n\t\t: TErrorMessages extends null ? TErrorMessages\n\t\t: never;\n\t}\n>;\n\n/**\n * Merges all types in an array of types into one type.\n *\n * @template TArrayOfTypes Array of types to merge\n * @template TAccumulator Accumulator for the resulting merged type\n */\ntype MergeTypes<TArrayOfTypes extends unknown[], TAccumulator = NonNullable<unknown>> =\n\tTArrayOfTypes extends [infer TFirstType, ...infer TRestOfTypes] ?\n\t\tMergeTypes<\n\t\t\tTRestOfTypes,\n\t\t\t{ [Key in keyof TAccumulator | keyof TFirstType]: (TAccumulator & TFirstType)[Key] }\n\t\t>\n\t:\tTAccumulator;\n\n/**\n * Type utility that extracts discriminated properties from a union of types.\n * Takes an array of types and returns a union of types where each type has unique properties.\n *\n * @template TArrayOfTypes Array of types to process\n * @template TErrorMessages An object of custom messages to display on the properties that are disallowed.\n * @template TAccumulator Accumulator for the resulting union\n * @template TMergedProperties Merged properties from all types\n */\n\nexport type UnionDiscriminator<\n\tTArrayOfTypes extends unknown[],\n\tTErrorMessages extends ErrorMessages<keyof MergeTypes<TArrayOfTypes>> = never,\n\tTAccumulator = never,\n\tTMergedProperties = MergeTypes<TArrayOfTypes>,\n> =\n\tTArrayOfTypes extends [infer TFirstType, ...infer TRestOfTypes] ?\n\t\tUnionDiscriminator<\n\t\t\tTRestOfTypes,\n\t\t\tTErrorMessages,\n\t\t\t// eslint-disable-next-line perfectionist/sort-union-types -- Let TAccumulator be first\n\t\t\tTAccumulator | AllowOnlyFirst<TFirstType, TMergedProperties, TErrorMessages>,\n\t\t\tTMergedProperties\n\t\t>\n\t:\tTAccumulator;\n\nexport type CommonRequestHeaders =\n\t| \"Access-Control-Allow-Credentials\"\n\t| \"Access-Control-Allow-Headers\"\n\t| \"Access-Control-Allow-Methods\"\n\t| \"Access-Control-Allow-Origin\"\n\t| \"Access-Control-Expose-Headers\"\n\t| \"Access-Control-Max-Age\"\n\t| \"Age\"\n\t| \"Allow\"\n\t| \"Cache-Control\"\n\t| \"Clear-Site-Data\"\n\t| \"Content-Disposition\"\n\t| \"Content-Encoding\"\n\t| \"Content-Language\"\n\t| \"Content-Length\"\n\t| \"Content-Location\"\n\t| \"Content-Range\"\n\t| \"Content-Security-Policy-Report-Only\"\n\t| \"Content-Security-Policy\"\n\t| \"Cookie\"\n\t| \"Cross-Origin-Embedder-Policy\"\n\t| \"Cross-Origin-Opener-Policy\"\n\t| \"Cross-Origin-Resource-Policy\"\n\t| \"Date\"\n\t| \"ETag\"\n\t| \"Expires\"\n\t| \"Last-Modified\"\n\t| \"Location\"\n\t| \"Permissions-Policy\"\n\t| \"Pragma\"\n\t| \"Retry-After\"\n\t| \"Save-Data\"\n\t| \"Sec-CH-Prefers-Color-Scheme\"\n\t| \"Sec-CH-Prefers-Reduced-Motion\"\n\t| \"Sec-CH-UA-Arch\"\n\t| \"Sec-CH-UA-Bitness\"\n\t| \"Sec-CH-UA-Form-Factor\"\n\t| \"Sec-CH-UA-Full-Version-List\"\n\t| \"Sec-CH-UA-Full-Version\"\n\t| \"Sec-CH-UA-Mobile\"\n\t| \"Sec-CH-UA-Model\"\n\t| \"Sec-CH-UA-Platform-Version\"\n\t| \"Sec-CH-UA-Platform\"\n\t| \"Sec-CH-UA-WoW64\"\n\t| \"Sec-CH-UA\"\n\t| \"Sec-Fetch-Dest\"\n\t| \"Sec-Fetch-Mode\"\n\t| \"Sec-Fetch-Site\"\n\t| \"Sec-Fetch-User\"\n\t| \"Sec-GPC\"\n\t| \"Server-Timing\"\n\t| \"Server\"\n\t| \"Service-Worker-Navigation-Preload\"\n\t| \"Set-Cookie\"\n\t| \"Strict-Transport-Security\"\n\t| \"Timing-Allow-Origin\"\n\t| \"Trailer\"\n\t| \"Transfer-Encoding\"\n\t| \"Upgrade\"\n\t| \"Vary\"\n\t| \"Warning\"\n\t| \"WWW-Authenticate\"\n\t| \"X-Content-Type-Options\"\n\t| \"X-DNS-Prefetch-Control\"\n\t| \"X-Frame-Options\"\n\t| \"X-Permitted-Cross-Domain-Policies\"\n\t| \"X-Powered-By\"\n\t| \"X-Robots-Tag\"\n\t| \"X-XSS-Protection\"\n\t| AnyString;\n\nexport type CommonAuthorizationHeaders = `${\"Basic\" | \"Bearer\" | \"Token\"} ${string}`;\n\nexport type CommonContentTypes =\n\t| \"application/epub+zip\"\n\t| \"application/gzip\"\n\t| \"application/json\"\n\t| \"application/ld+json\"\n\t| \"application/octet-stream\"\n\t| \"application/ogg\"\n\t| \"application/pdf\"\n\t| \"application/rtf\"\n\t| \"application/vnd.ms-fontobject\"\n\t| \"application/wasm\"\n\t| \"application/xhtml+xml\"\n\t| \"application/xml\"\n\t| \"application/zip\"\n\t| \"audio/aac\"\n\t| \"audio/mpeg\"\n\t| \"audio/ogg\"\n\t| \"audio/opus\"\n\t| \"audio/webm\"\n\t| \"audio/x-midi\"\n\t| \"font/otf\"\n\t| \"font/ttf\"\n\t| \"font/woff\"\n\t| \"font/woff2\"\n\t| \"image/avif\"\n\t| \"image/bmp\"\n\t| \"image/gif\"\n\t| \"image/jpeg\"\n\t| \"image/png\"\n\t| \"image/svg+xml\"\n\t| \"image/tiff\"\n\t| \"image/webp\"\n\t| \"image/x-icon\"\n\t| \"model/gltf-binary\"\n\t| \"model/gltf+json\"\n\t| \"text/calendar\"\n\t| \"text/css\"\n\t| \"text/csv\"\n\t| \"text/html\"\n\t| \"text/javascript\"\n\t| \"text/plain\"\n\t| \"video/3gpp\"\n\t| \"video/3gpp2\"\n\t| \"video/av1\"\n\t| \"video/mp2t\"\n\t| \"video/mp4\"\n\t| \"video/mpeg\"\n\t| \"video/ogg\"\n\t| \"video/webm\"\n\t| \"video/x-msvideo\"\n\t| AnyString;\n","import type { ModifiedRequestInit } from \"../types/options-types\";\nimport { defineEnum } from \"../types/type-helpers\";\n\nexport const fetchSpecificKeys = defineEnum([\n\t\"body\",\n\t\"integrity\",\n\t\"duplex\",\n\t\"method\",\n\t\"headers\",\n\t\"signal\",\n\t\"cache\",\n\t\"redirect\",\n\t\"window\",\n\t\"credentials\",\n\t\"keepalive\",\n\t\"referrer\",\n\t\"priority\",\n\t\"mode\",\n\t\"referrerPolicy\",\n\t\"extraFetchOptions\",\n] satisfies Array<keyof ModifiedRequestInit> as Array<keyof ModifiedRequestInit>);\n","import type { AnyFunction } from \"../types/type-helpers\";\n\nexport const isArray = <TArrayItem>(value: unknown): value is TArrayItem[] => Array.isArray(value);\n\nexport const isBoolean = (value: unknown): value is boolean => typeof value === \"boolean\";\n\nexport const isBlob = (value: unknown): value is Blob => value instanceof Blob;\n\nexport const isObject = <TObject extends object>(value: unknown): value is TObject => {\n\treturn typeof value === \"object\" && value !== null;\n};\n\nconst hasObjectPrototype = (value: unknown) => {\n\treturn Object.prototype.toString.call(value) === \"[object Object]\";\n};\n\n/**\n * @description Copied from TanStack Query's isPlainObject\n * @see https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L321\n */\nexport const isPlainObject = <TPlainObject extends Record<string, unknown>>(\n\tvalue: unknown\n): value is TPlainObject => {\n\tif (!hasObjectPrototype(value)) {\n\t\treturn false;\n\t}\n\n\t// If has no constructor\n\tconst constructor = (value as object | undefined)?.constructor;\n\tif (constructor === undefined) {\n\t\treturn true;\n\t}\n\n\t// If has modified prototype\n\tconst prototype = constructor.prototype as object;\n\tif (!hasObjectPrototype(prototype)) {\n\t\treturn false;\n\t}\n\n\t// If constructor does not have an Object-specific method\n\tif (!Object.hasOwn(prototype, \"isPrototypeOf\")) {\n\t\treturn false;\n\t}\n\n\t// Handles Objects created by Object.create(<arbitrary prototype>)\n\tif (Object.getPrototypeOf(value) !== Object.prototype) {\n\t\treturn false;\n\t}\n\n\t// It's probably a plain object at this point\n\treturn true;\n};\n\nexport const isValidJsonString = (value: unknown): value is string => {\n\tif (!isString(value)) {\n\t\treturn false;\n\t}\n\n\ttry {\n\t\tJSON.parse(value);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n};\n\nexport const isSerializableObject = (value: unknown) => {\n\treturn (\n\t\tisPlainObject(value)\n\t\t|| isArray(value)\n\t\t|| typeof (value as { toJSON: unknown } | undefined)?.toJSON === \"function\"\n\t);\n};\n\nexport const isFunction = <TFunction extends AnyFunction>(value: unknown): value is TFunction => {\n\treturn typeof value === \"function\";\n};\n\nexport const isQueryString = (value: unknown): value is string => isString(value) && value.includes(\"=\");\n\nexport const isString = (value: unknown) => typeof value === \"string\";\n\nexport const isPromise = (value: unknown) => value instanceof Promise;\n\n// https://github.com/unjs/ofetch/blob/main/src/utils.ts\nexport const isJSONSerializable = (value: unknown) => {\n\tif (value === undefined) {\n\t\treturn false;\n\t}\n\tconst t = typeof value;\n\t// eslint-disable-next-line ts-eslint/no-unnecessary-condition -- No time to make this more type-safe\n\tif (t === \"string\" || t === \"number\" || t === \"boolean\" || t === null) {\n\t\treturn true;\n\t}\n\tif (t !== \"object\") {\n\t\treturn false;\n\t}\n\tif (isArray(value)) {\n\t\treturn true;\n\t}\n\tif ((value as Buffer | null)?.buffer) {\n\t\treturn false;\n\t}\n\n\treturn (\n\t\tvalue?.constructor.name === \"Object\"\n\t\t|| typeof (value as { toJSON: () => unknown } | null)?.toJSON === \"function\"\n\t);\n};\n","/* eslint-disable perfectionist/sort-object-types -- Avoid Sorting for now */\n\nimport type { CallApiExtraOptions } from \"./types/options-types\";\nimport type { Awaitable } from \"./types/type-helpers\";\nimport { isFunction, isObject, isPromise } from \"./utils/guards\";\n\ntype PossibleAuthValue = Awaitable<string | null | undefined>;\n\ntype PossibleAuthValueOrGetter = PossibleAuthValue | (() => PossibleAuthValue);\n\n// export type BearerOrTokenAuth =\n// \t| {\n// \t\t\ttype?: \"Bearer\" | undefined;\n// \t\t\tbearer?: PossibleAuthValueOrGetter;\n// \t\t\ttoken?: never;\n// \t }\n// \t| {\n// \t\t\ttype?: \"Token\";\n// \t\t\tbearer?: never;\n// \t\t\ttoken?: PossibleAuthValueOrGetter;\n// \t };\n\nexport type BearerAuth = {\n\ttype: \"Bearer\";\n\tvalue: PossibleAuthValueOrGetter;\n};\n\nexport type TokenAuth = {\n\ttype: \"Token\";\n\tvalue: PossibleAuthValueOrGetter;\n};\n\nexport type BasicAuth = {\n\ttype: \"Basic\";\n\tusername: PossibleAuthValueOrGetter;\n\tpassword: PossibleAuthValueOrGetter;\n};\n\n/**\n * Custom auth\n *\n * @param prefix - prefix of the header\n * @param authValue - value of the header\n *\n * @example\n * ```ts\n * {\n * type: \"Custom\",\n * prefix: \"Token\",\n * authValue: \"token\"\n * }\n * ```\n */\nexport type CustomAuth = {\n\ttype: \"Custom\";\n\tprefix: PossibleAuthValueOrGetter;\n\tvalue: PossibleAuthValueOrGetter;\n};\n\n// eslint-disable-next-line perfectionist/sort-union-types -- Let the first one be first\nexport type AuthOption = PossibleAuthValueOrGetter | BearerAuth | TokenAuth | BasicAuth | CustomAuth;\n\nconst resolveAuthValue = (value: PossibleAuthValueOrGetter) => (isFunction(value) ? value() : value);\n\ntype AuthHeaderObject = { Authorization: string };\n\nexport const getAuthHeader = async (\n\tauth: CallApiExtraOptions[\"auth\"]\n): Promise<AuthHeaderObject | undefined> => {\n\tif (auth === undefined) return;\n\n\tif (isPromise(auth) || isFunction(auth) || !isObject(auth)) {\n\t\tconst authValue = await resolveAuthValue(auth);\n\n\t\tif (authValue === undefined) return;\n\n\t\treturn {\n\t\t\tAuthorization: `Bearer ${authValue}`,\n\t\t};\n\t}\n\n\tswitch (auth.type) {\n\t\tcase \"Basic\": {\n\t\t\tconst [username, password] = await Promise.all([\n\t\t\t\tresolveAuthValue(auth.username),\n\t\t\t\tresolveAuthValue(auth.password),\n\t\t\t]);\n\n\t\t\tif (username === undefined || password === undefined) return;\n\n\t\t\treturn {\n\t\t\t\tAuthorization: `Basic ${globalThis.btoa(`${username}:${password}`)}`,\n\t\t\t};\n\t\t}\n\t\tcase \"Bearer\": {\n\t\t\tconst value = await resolveAuthValue(auth.value);\n\n\t\t\tif (value === undefined) return;\n\n\t\t\treturn {\n\t\t\t\tAuthorization: `Bearer ${value}`,\n\t\t\t};\n\t\t}\n\t\tcase \"Custom\": {\n\t\t\tconst [prefix, value] = await Promise.all([\n\t\t\t\tresolveAuthValue(auth.prefix),\n\t\t\t\tresolveAuthValue(auth.value),\n\t\t\t]);\n\n\t\t\tif (value === undefined) return;\n\n\t\t\treturn {\n\t\t\t\tAuthorization: `${prefix} ${value}`,\n\t\t\t};\n\t\t}\n\n\t\tcase \"Token\": {\n\t\t\tconst value = await resolveAuthValue(auth.value);\n\n\t\t\tif (value === undefined) return;\n\n\t\t\treturn {\n\t\t\t\tAuthorization: `Token ${value}`,\n\t\t\t};\n\t\t}\n\n\t\tdefault: {\n\t\t\tauth satisfies never;\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// default: {\n\t\t// \tconst [bearer, token] = await Promise.all([\n\t\t// \t\tresolveAuthValue(auth.bearer),\n\t\t// \t\tresolveAuthValue(auth.token),\n\t\t// \t]);\n\n\t\t// \tif (bearer !== undefined) {\n\t\t// \t\treturn { Authorization: `Bearer ${bearer}` };\n\t\t// \t}\n\n\t\t// \tif (token === undefined) return;\n\n\t\t// \treturn { Authorization: `Token ${token}` };\n\t\t// }\n\t}\n};\n","export const fallBackRouteSchemaKey = \"@default\";\n\nexport type FallBackRouteSchemaKey = typeof fallBackRouteSchemaKey;\n","import { extraOptionDefaults } from \"../../constants/defaults\";\nimport type { CallApiExtraOptions } from \"../../types/options-types\";\nimport type { StandardSchemaV1 } from \"../../types/standard-schema\";\nimport type { CallApiSchema, CallApiSchemaConfig } from \"../../validation\";\nimport { isObject, isString } from \"../guards\";\n\ntype HTTPErrorDetails<TErrorData> = Pick<CallApiExtraOptions, \"defaultHTTPErrorMessage\"> & {\n\terrorData: TErrorData;\n\tresponse: Response;\n};\n\nconst httpErrorSymbol = Symbol(\"HTTPError\");\n\nexport class HTTPError<TErrorData = Record<string, unknown>> extends Error {\n\terrorData: HTTPErrorDetails<TErrorData>[\"errorData\"];\n\n\treadonly httpErrorSymbol = httpErrorSymbol;\n\n\toverride name = \"HTTPError\" as const;\n\n\tresponse: HTTPErrorDetails<TErrorData>[\"response\"];\n\n\tconstructor(errorDetails: HTTPErrorDetails<TErrorData>, errorOptions?: ErrorOptions) {\n\t\tconst { defaultHTTPErrorMessage, errorData, response } = errorDetails;\n\n\t\tconst resolvedDefaultHTTPErrorMessage =\n\t\t\tisString(defaultHTTPErrorMessage) ? defaultHTTPErrorMessage : (\n\t\t\t\tdefaultHTTPErrorMessage?.({ errorData, response })\n\t\t\t);\n\n\t\tconst selectedDefaultErrorMessage =\n\t\t\tresolvedDefaultHTTPErrorMessage\n\t\t\t?? (response.statusText || extraOptionDefaults.defaultHTTPErrorMessage);\n\n\t\tconst message =\n\t\t\t(errorData as { message?: string } | undefined)?.message ?? selectedDefaultErrorMessage;\n\n\t\tsuper(message, errorOptions);\n\n\t\tthis.errorData = errorData;\n\t\tthis.response = response;\n\t}\n\n\t/**\n\t * @description Checks if the given error is an instance of HTTPError\n\t * @param error - The error to check\n\t * @returns true if the error is an instance of HTTPError, false otherwise\n\t */\n\tstatic override isError<TErrorData>(error: unknown): error is HTTPError<TErrorData> {\n\t\tif (!isObject<HTTPError>(error)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (error instanceof HTTPError) {\n\t\t\treturn true;\n\t\t}\n\n\t\tconst actualError = error as HTTPError;\n\n\t\treturn (\n\t\t\tactualError.httpErrorSymbol === httpErrorSymbol\n\t\t\t// eslint-disable-next-line ts-eslint/no-unnecessary-condition -- Allow\n\t\t\t&& actualError.name === \"HTTPError\"\n\t\t);\n\t}\n}\n\nconst prettifyPath = (path: ValidationError[\"errorData\"][number][\"path\"]) => {\n\tif (!path || path.length === 0) {\n\t\treturn \"\";\n\t}\n\n\tconst pathString = path.map((segment) => (isObject(segment) ? segment.key : segment)).join(\".\");\n\n\treturn ` → at ${pathString}`;\n};\n\nconst prettifyValidationIssues = (issues: ValidationError[\"errorData\"]) => {\n\tconst issuesString = issues.map((issue) => `✖ ${issue.message}${prettifyPath(issue.path)}`).join(\" | \");\n\n\treturn issuesString;\n};\n\ntype SafeExtract<TUnion, TKey extends TUnion> = Extract<TUnion, TKey>;\n\ntype ValidationErrorDetails = {\n\t/**\n\t * The cause of the validation error.\n\t *\n\t * 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.\n\t */\n\tissueCause:\n\t\t| \"toFormData\"\n\t\t| \"toQueryString\"\n\t\t| \"unknown\"\n\t\t| `schemaConfig-(${SafeExtract<keyof CallApiSchemaConfig, \"strict\">})`\n\t\t| keyof CallApiSchema;\n\n\t/**\n\t * The issues that caused the validation error.\n\t */\n\tissues: readonly StandardSchemaV1.Issue[];\n\n\t/**\n\t * The response from server, if any.\n\t */\n\tresponse: Response | null;\n};\n\nconst validationErrorSymbol = Symbol(\"ValidationErrorSymbol\");\n\nexport class ValidationError extends Error {\n\terrorData: ValidationErrorDetails[\"issues\"];\n\n\tissueCause: ValidationErrorDetails[\"issueCause\"];\n\n\toverride name = \"ValidationError\" as const;\n\n\tresponse: ValidationErrorDetails[\"response\"];\n\n\treadonly validationErrorSymbol = validationErrorSymbol;\n\n\tconstructor(details: ValidationErrorDetails, errorOptions?: ErrorOptions) {\n\t\tconst { issueCause, issues, response } = details;\n\n\t\tconst prettyMessage = prettifyValidationIssues(issues);\n\n\t\tconst message = `(${issueCause.toUpperCase()}) - ${prettyMessage}`;\n\n\t\tsuper(message, errorOptions);\n\n\t\tthis.errorData = issues;\n\t\tthis.response = response;\n\t\tthis.issueCause = issueCause;\n\t}\n\n\t/**\n\t * @description Checks if the given error is an instance of ValidationError\n\t * @param error - The error to check\n\t * @returns true if the error is an instance of ValidationError, false otherwise\n\t */\n\tstatic override isError(error: unknown): error is ValidationError {\n\t\tif (!isObject<ValidationError>(error)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (error instanceof ValidationError) {\n\t\t\treturn true;\n\t\t}\n\n\t\tconst actualError = error as ValidationError;\n\n\t\treturn (\n\t\t\tactualError.validationErrorSymbol === validationErrorSymbol\n\t\t\t// eslint-disable-next-line ts-eslint/no-unnecessary-condition -- Allow\n\t\t\t&& actualError.name === \"ValidationError\"\n\t\t);\n\t}\n}\n","import type { AuthOption } from \"./auth\";\nimport { fallBackRouteSchemaKey, type FallBackRouteSchemaKey } from \"./constants/validation\";\nimport type { Body, HeadersOption, MethodUnion } from \"./types/conditional-types\";\nimport type {\n\tBaseCallApiExtraOptions,\n\tCallApiExtraOptions,\n\tCallApiRequestOptions,\n\tGlobalMeta,\n} from \"./types/options-types\";\nimport type { StandardSchemaV1 } from \"./types/standard-schema\";\nimport {\n\tdefineEnum,\n\ttype AnyFunction,\n\ttype AnyString,\n\ttype Awaitable,\n\ttype UnionDiscriminator,\n\ttype UnionToIntersection,\n} from \"./types/type-helpers\";\nimport {\n\tatSymbol,\n\textractMethodFromURL,\n\tnormalizeURL,\n\ttype AtSymbol,\n\ttype Params,\n\ttype Query,\n} from \"./url\";\nimport { ValidationError } from \"./utils/external/error\";\nimport { isArray, isFunction, isObject } from \"./utils/guards\";\n\ntype ResultVariant = \"infer-input\" | \"infer-output\";\n\nexport type InferSchemaResult<TSchema, TFallbackResult, TResultVariant extends ResultVariant> =\n\t// == Checking for undefined first and returning fallback to avoid type errors when passing the config around (weird tbh)\n\tundefined extends TSchema ? TFallbackResult\n\t: TSchema extends StandardSchemaV1 ?\n\t\tTResultVariant extends \"infer-input\" ?\n\t\t\tStandardSchemaV1.InferInput<TSchema>\n\t\t:\tStandardSchemaV1.InferOutput<TSchema>\n\t: TSchema extends AnyFunction<infer TResult> ? Awaited<TResult>\n\t: TFallbackResult;\n\nexport type InferSchemaOutput<TSchema, TFallbackResult = unknown> = InferSchemaResult<\n\tTSchema,\n\tTFallbackResult,\n\t\"infer-output\"\n>;\n\nexport type InferSchemaInput<TSchema, TFallbackResult = unknown> = InferSchemaResult<\n\tTSchema,\n\tTFallbackResult,\n\t\"infer-input\"\n>;\n\nconst handleValidatorFunction = <TInput>(\n\tvalidator: AnyFunction,\n\tinputData: TInput\n): Promise<StandardSchemaV1.Result<TInput>> => {\n\tconst result = new Promise((resolve) => resolve(validator(inputData as never)))\n\t\t.then((value) => ({ issues: undefined, value: value as never }))\n\t\t.catch((error) => ({ issues: (isArray(error) ? error : [error]) as never, value: undefined }));\n\n\treturn result;\n};\n\nexport const getValidatedValue = <\n\tTSchema extends AnyFunction | StandardSchemaV1,\n\tTVariant extends \"async\" | \"sync\",\n>(\n\tinputValue: InferSchemaOutput<TSchema>,\n\tschema?: TSchema,\n\t_ignoredOptions?: { variant: TVariant }\n): TVariant extends \"async\" ? Promise<StandardSchemaV1.Result<typeof inputValue>>\n:\tStandardSchemaV1.Result<typeof inputValue> => {\n\tif (!schema) {\n\t\treturn { issues: undefined, value: inputValue } as never;\n\t}\n\n\tconst result =\n\t\tisFunction(schema) ?\n\t\t\thandleValidatorFunction(schema, inputValue)\n\t\t:\tschema[\"~standard\"].validate(inputValue);\n\n\treturn result as never;\n};\n\nconst callApiSchemaParser = async <\n\tTFullSchema extends CallApiSchema,\n\tTSchemaName extends keyof CallApiSchema,\n\tTSchema extends NonNullable<TFullSchema[TSchemaName]>,\n>(\n\tfullSchema: TFullSchema | undefined,\n\tschemaName: TSchemaName,\n\toptions: { inputValue: InferSchemaInput<TSchema>; response?: Response | null }\n): Promise<InferSchemaOutput<TSchema>> => {\n\tconst { inputValue, response } = options;\n\n\tconst schema = fullSchema?.[schemaName];\n\n\tconst result = await getValidatedValue(inputValue, schema);\n\n\tif (result.issues) {\n\t\tthrow new ValidationError({\n\t\t\tissueCause: schemaName,\n\t\t\tissues: result.issues,\n\t\t\tresponse: response ?? null,\n\t\t});\n\t}\n\n\treturn result.value as never;\n};\n\ntype BooleanObject = {\n\t[Key in keyof CallApiSchema]: boolean;\n};\n\nexport interface CallApiSchemaConfig {\n\t/**\n\t * The base url of the schema. By default it's the baseURL of the callApi instance.\n\t */\n\tbaseURL?: \"\" | AnyString;\n\n\t/**\n\t * Disables runtime validation for the schema.\n\t */\n\tdisableRuntimeValidation?: boolean | BooleanObject;\n\n\t/**\n\t * If `true`, the original input value will be used instead of the transformed/validated output.\n\t *\n\t * When true, the original input is returned unchanged after validation, ignoring any schema-level\n\t * transformations such as type coercion, default values, or field mapping. Only the validation\n\t * step is executed; the resulting value is discarded in favor of the raw input.\n\t */\n\tdisableRuntimeValidationTransform?: boolean | BooleanObject;\n\n\t/**\n\t * Optional url prefix that will be substituted for the `baseURL` of the schemaConfig at runtime.\n\t *\n\t * Enables a short, stable prefix for routes while keeping the full `baseURL` centralized in config.\n\t * Keeps route definitions concise and shields them from changes to the underlying base URL.\n\t */\n\tprefix?: \"\" | AnyString;\n\n\t/**\n\t * Controls the strictness of API route validation.\n\t *\n\t * When true:\n\t * - Only routes explicitly defined in the schema will be considered valid to typescript and the runtime.\n\t * - Attempting to call routes not defined in the schema will result in both type errors and runtime validation errors.\n\t * - Useful for ensuring API calls conform exactly to your schema definition\n\t *\n\t * When false or undefined (default):\n\t * - All routes will be allowed, whether they are defined in the schema or not\n\t */\n\tstrict?: boolean;\n}\n\nexport type CallApiSchemaType<TInput> =\n\tStandardSchemaV1<TInput | undefined> | ((value: TInput) => Awaitable<TInput | undefined>);\n\nexport interface CallApiSchema {\n\tauth?: CallApiSchemaType<AuthOption>;\n\n\t/**\n\t * The schema to use for validating the request body.\n\t */\n\tbody?: CallApiSchemaType<Body>;\n\n\t/**\n\t * The schema to use for validating the response data.\n\t */\n\tdata?: CallApiSchemaType<unknown>;\n\n\t/**\n\t * The schema to use for validating the response error data.\n\t */\n\terrorData?: CallApiSchemaType<unknown>;\n\n\t/**\n\t * The schema to use for validating the request headers.\n\t */\n\theaders?: CallApiSchemaType<HeadersOption>;\n\n\t/**\n\t * The schema to use for validating the meta option.\n\t */\n\tmeta?: CallApiSchemaType<GlobalMeta>;\n\n\t/**\n\t * The schema to use for validating the request method.\n\t */\n\tmethod?: CallApiSchemaType<MethodUnion>;\n\n\t/**\n\t * The schema to use for validating the request url parameters.\n\t */\n\tparams?: CallApiSchemaType<Params>;\n\n\t/**\n\t * The schema to use for validating the request url queries.\n\t */\n\tquery?: CallApiSchemaType<Query>;\n}\n\nexport const routeKeyMethods = defineEnum([\"delete\", \"get\", \"patch\", \"post\", \"put\"]);\n\nexport type RouteKeyMethods = (typeof routeKeyMethods)[number];\n\nexport type RouteKeyMethodsURLUnion = `${AtSymbol}${RouteKeyMethods}/`;\n\nexport type BaseSchemaRouteKeyPrefixes = FallBackRouteSchemaKey | RouteKeyMethodsURLUnion;\n\nexport type BaseCallApiSchemaRoutes = Partial<\n\tRecord<AnyString | BaseSchemaRouteKeyPrefixes, CallApiSchema>\n>;\n\nexport type BaseCallApiSchemaAndConfig = {\n\tconfig?: CallApiSchemaConfig;\n\troutes: BaseCallApiSchemaRoutes;\n};\n\ntype ValidationOptions<\n\tTSchema extends CallApiSchema[keyof CallApiSchema] = CallApiSchema[keyof CallApiSchema],\n> = {\n\tinputValue: InferSchemaInput<TSchema>;\n\tresponse?: Response | null;\n\tresultMode: CallApiExtraOptions[\"resultMode\"];\n\tschemaConfig: CallApiSchemaConfig | undefined;\n};\n\nexport const handleSchemaValidation = async <\n\tTFullSchema extends CallApiSchema,\n\tTSchemaName extends keyof CallApiSchema,\n\tTSchema extends NonNullable<TFullSchema[TSchemaName]>,\n>(\n\tfullSchema: TFullSchema | undefined,\n\tschemaName: TSchemaName,\n\tvalidationOptions: ValidationOptions<TSchema>\n): Promise<InferSchemaOutput<TSchema>> => {\n\tconst { inputValue, response, resultMode, schemaConfig } = validationOptions;\n\n\t// == If resultMode is set to `fetchApi`, return the input value as is (which is going to be `null` in this)\n\tif (resultMode === \"fetchApi\" && (schemaName === \"data\" || schemaName === \"errorData\")) {\n\t\treturn inputValue;\n\t}\n\n\tconst disableRuntimeValidationBooleanObject =\n\t\tisObject(schemaConfig?.disableRuntimeValidation) ? schemaConfig.disableRuntimeValidation : {};\n\n\tconst shouldDisableRuntimeValidation =\n\t\tschemaConfig?.disableRuntimeValidation === true\n\t\t|| disableRuntimeValidationBooleanObject[schemaName] === true;\n\n\tif (shouldDisableRuntimeValidation) {\n\t\treturn inputValue;\n\t}\n\n\tconst validResult = await callApiSchemaParser(fullSchema, schemaName, { inputValue, response });\n\n\tconst disableResultApplicationBooleanObject =\n\t\tisObject(schemaConfig?.disableRuntimeValidationTransform) ?\n\t\t\tschemaConfig.disableRuntimeValidationTransform\n\t\t:\t{};\n\n\tconst shouldDisableResultApplication =\n\t\tschemaConfig?.disableRuntimeValidationTransform === true\n\t\t|| disableResultApplicationBooleanObject[schemaName] === true;\n\n\tif (shouldDisableResultApplication) {\n\t\treturn inputValue;\n\t}\n\n\treturn validResult;\n};\n\ntype LastOf<TValue> =\n\tUnionToIntersection<TValue extends unknown ? () => TValue : never> extends () => infer R ? R : never;\n\ntype Push<TArray extends unknown[], TArrayItem> = [...TArray, TArrayItem];\n\ntype UnionToTupleImpl<\n\tTUnion,\n\tTComputedLastUnion = LastOf<TUnion>,\n\tTComputedIsUnionEqualToNever = [TUnion] extends [never] ? true : false,\n> =\n\ttrue extends TComputedIsUnionEqualToNever ? []\n\t:\tPush<UnionToTupleImpl<Exclude<TUnion, TComputedLastUnion>>, TComputedLastUnion>;\n\nexport type UnionToTuple<TUnion, TArray extends TUnion[] = []> =\n\tUnionToTupleImpl<TUnion>[\"length\"] extends TArray[\"length\"] ? [...TArray]\n\t:\tUnionToTuple<TUnion, [TUnion, ...TArray]>;\n\ntype ExtraOptionsValidationOptions = {\n\toptions: CallApiExtraOptions;\n};\n\nconst extraOptionsToBeValidated = [\"meta\", \"params\", \"query\", \"auth\"] satisfies UnionToTuple<\n\tExtract<keyof CallApiSchema, keyof CallApiExtraOptions>\n>;\n\ntype RequestOptionsValidationOptions = {\n\trequest: CallApiRequestOptions;\n};\n\nconst requestOptionsToBeValidated = [\"body\", \"headers\", \"method\"] satisfies UnionToTuple<\n\tExtract<keyof CallApiSchema, keyof CallApiRequestOptions>\n>;\n\ntype OptionValidationOptions = UnionDiscriminator<\n\t[ExtraOptionsValidationOptions, RequestOptionsValidationOptions]\n> & {\n\tschema: CallApiSchema | undefined;\n\tschemaConfig: CallApiSchemaConfig | undefined;\n};\n\nconst handleOptionsValidation = async <TValidationOptions extends OptionValidationOptions>(\n\tvalidationOptions: TValidationOptions\n): Promise<\n\tundefined extends TValidationOptions[\"options\"] ?\n\t\tPick<CallApiRequestOptions, (typeof requestOptionsToBeValidated)[number]>\n\t:\tPick<CallApiExtraOptions, (typeof extraOptionsToBeValidated)[number]>\n> => {\n\tconst { options, request, schema, schemaConfig } = validationOptions;\n\n\tconst resolvedOptionsToBeValidated = options ? extraOptionsToBeValidated : requestOptionsToBeValidated;\n\n\tconst resolvedOptions = options ?? request;\n\n\tconst validationResultArray = await Promise.all(\n\t\tresolvedOptionsToBeValidated.map((schemaName) =>\n\t\t\thandleSchemaValidation(schema, schemaName, {\n\t\t\t\tinputValue: resolvedOptions[schemaName as keyof typeof resolvedOptions],\n\t\t\t\tresultMode: options?.resultMode,\n\t\t\t\tschemaConfig,\n\t\t\t})\n\t\t)\n\t);\n\n\tconst validatedResultObject: Record<string, unknown> = {};\n\n\tfor (const [index, schemaName] of resolvedOptionsToBeValidated.entries()) {\n\t\tconst validationResult = validationResultArray[index];\n\n\t\tif (validationResult === undefined) continue;\n\n\t\tvalidatedResultObject[schemaName] = validationResult;\n\t}\n\n\treturn validatedResultObject;\n};\n\nexport const handleConfigValidation = async (\n\tvalidationOptions: ExtraOptionsValidationOptions\n\t\t& GetResolvedSchemaContext\n\t\t& RequestOptionsValidationOptions\n) => {\n\tconst { baseExtraOptions, currentRouteSchemaKey, extraOptions, options, request } = validationOptions;\n\n\tconst { currentRouteSchema, resolvedSchema } = getResolvedSchema({\n\t\tbaseExtraOptions,\n\t\tcurrentRouteSchemaKey,\n\t\textraOptions,\n\t});\n\n\tconst resolvedSchemaConfig = getResolvedSchemaConfig({ baseExtraOptions, extraOptions });\n\n\tif (resolvedSchemaConfig?.strict === true && !currentRouteSchema) {\n\t\tthrow new ValidationError({\n\t\t\tissueCause: \"schemaConfig-(strict)\",\n\t\t\tissues: [{ message: `Strict Mode - No schema found for route '${currentRouteSchemaKey}' ` }],\n\t\t\tresponse: null,\n\t\t});\n\t}\n\n\tif (!resolvedSchema) {\n\t\treturn {\n\t\t\textraOptionsValidationResult: {} as Awaited<ReturnType<typeof handleOptionsValidation>>,\n\t\t\trequestOptionsValidationResult: {} as Awaited<ReturnType<typeof handleOptionsValidation>>,\n\t\t\tresolvedSchema,\n\t\t\tresolvedSchemaConfig,\n\t\t};\n\t}\n\n\tconst [extraOptionsValidationResult, requestOptionsValidationResult] = await Promise.all([\n\t\thandleOptionsValidation({\n\t\t\toptions,\n\t\t\tschema: resolvedSchema,\n\t\t\tschemaConfig: resolvedSchemaConfig,\n\t\t}),\n\t\thandleOptionsValidation({\n\t\t\trequest,\n\t\t\tschema: resolvedSchema,\n\t\t\tschemaConfig: resolvedSchemaConfig,\n\t\t}),\n\t]);\n\n\treturn {\n\t\textraOptionsValidationResult,\n\t\trequestOptionsValidationResult,\n\t\tresolvedSchema,\n\t\tresolvedSchemaConfig,\n\t};\n};\n\ntype GetResolvedSchemaContext = {\n\tbaseExtraOptions: BaseCallApiExtraOptions;\n\tcurrentRouteSchemaKey: string;\n\textraOptions: CallApiExtraOptions;\n};\n\nexport const getResolvedSchema = (context: GetResolvedSchemaContext) => {\n\tconst { baseExtraOptions, currentRouteSchemaKey, extraOptions } = context;\n\n\tconst fallbackRouteSchema = baseExtraOptions.schema?.routes[fallBackRouteSchemaKey];\n\tconst currentRouteSchema = baseExtraOptions.schema?.routes[currentRouteSchemaKey];\n\n\tconst resolvedRouteSchema = {\n\t\t...fallbackRouteSchema,\n\t\t// == Current route schema takes precedence over fallback route schema\n\t\t...currentRouteSchema,\n\t} satisfies CallApiSchema as CallApiSchema | undefined;\n\n\tconst resolvedSchema =\n\t\tisFunction(extraOptions.schema) ?\n\t\t\textraOptions.schema({\n\t\t\t\tbaseSchemaRoutes: baseExtraOptions.schema?.routes ?? {},\n\t\t\t\tcurrentRouteSchema: resolvedRouteSchema ?? {},\n\t\t\t\tcurrentRouteSchemaKey,\n\t\t\t})\n\t\t:\t(extraOptions.schema ?? resolvedRouteSchema);\n\n\treturn { currentRouteSchema, resolvedSchema };\n};\n\nexport const getResolvedSchemaConfig = (\n\tcontext: Omit<GetResolvedSchemaContext, \"currentRouteSchemaKey\">\n) => {\n\tconst { baseExtraOptions, extraOptions } = context;\n\n\tconst resolvedSchemaConfig =\n\t\tisFunction(extraOptions.schemaConfig) ?\n\t\t\textraOptions.schemaConfig({ baseSchemaConfig: baseExtraOptions.schema?.config ?? {} })\n\t\t:\t(extraOptions.schemaConfig ?? baseExtraOptions.schema?.config);\n\n\treturn resolvedSchemaConfig;\n};\n\nconst removeLeadingSlash = (value: string) => (value.startsWith(\"/\") ? value.slice(1) : value);\n\nconst extractURLParts = (initURL: string) => {\n\treturn {\n\t\tmethodFromURL: extractMethodFromURL(initURL),\n\t\tpathWithoutMethod: normalizeURL(initURL, { retainLeadingSlashForRelativeURLs: false }),\n\t};\n};\n\nconst mergeURLParts = (options: { method: string | undefined; path: string }): string => {\n\tconst { method, path } = options;\n\n\treturn method ? `${atSymbol}${method}/${removeLeadingSlash(path)}` : path;\n};\n\nexport const getCurrentRouteSchemaKeyAndMainInitURL = (\n\tcontext: Pick<GetResolvedSchemaContext, \"baseExtraOptions\" | \"extraOptions\"> & { initURL: string }\n) => {\n\tconst { baseExtraOptions, extraOptions, initURL } = context;\n\n\tconst schemaConfig = getResolvedSchemaConfig({ baseExtraOptions, extraOptions });\n\n\tlet currentRouteSchemaKey = initURL;\n\tlet mainInitURL = initURL;\n\n\tconst { methodFromURL, pathWithoutMethod } = extractURLParts(initURL);\n\n\tconst prefixWithoutLeadingSlash = schemaConfig?.prefix && removeLeadingSlash(schemaConfig.prefix);\n\n\tif (prefixWithoutLeadingSlash && pathWithoutMethod.startsWith(prefixWithoutLeadingSlash)) {\n\t\tconst restOfPathWithoutPrefix = pathWithoutMethod.slice(prefixWithoutLeadingSlash.length);\n\n\t\tcurrentRouteSchemaKey = mergeURLParts({ method: methodFromURL, path: restOfPathWithoutPrefix });\n\n\t\tconst pathWithReplacedPrefix = pathWithoutMethod.replace(\n\t\t\tprefixWithoutLeadingSlash,\n\t\t\tschemaConfig.baseURL ?? \"\"\n\t\t);\n\n\t\tmainInitURL = mergeURLParts({ method: methodFromURL, path: pathWithReplacedPrefix });\n\t}\n\n\tif (schemaConfig?.baseURL && pathWithoutMethod.startsWith(schemaConfig.baseURL)) {\n\t\tconst restOfPathWithoutBaseURL = pathWithoutMethod.slice(schemaConfig.baseURL.length);\n\n\t\tcurrentRouteSchemaKey = mergeURLParts({ method: methodFromURL, path: restOfPathWithoutBaseURL });\n\t}\n\n\treturn { currentRouteSchemaKey, initURL, mainInitURL };\n};\n","import type { CallApiRequestOptions } from \"../../types/options-types\";\nimport { getValidatedValue, type CallApiSchemaType, type InferSchemaOutput } from \"../../validation\";\nimport { isArray, isBlob, isObject, isString } from \"../guards\";\nimport { ValidationError } from \"./error\";\n\nconst toStringOrStringify = (value: unknown): string => {\n\treturn isString(value) ? value : JSON.stringify(value);\n};\n\ntype BodyType = NonNullable<CallApiRequestOptions[\"body\"]>;\n\nexport const toSearchParams = <TSchema extends CallApiSchemaType<BodyType>>(\n\tdata: InferSchemaOutput<TSchema>,\n\tschema?: TSchema\n) => {\n\tconst result = getValidatedValue(data, schema, { variant: \"sync\" });\n\n\tif (result.issues) {\n\t\tthrow new ValidationError({\n\t\t\tissueCause: \"toQueryString\",\n\t\t\tissues: result.issues,\n\t\t\tresponse: null,\n\t\t});\n\t}\n\n\tif (result.value instanceof URLSearchParams) {\n\t\treturn new URLSearchParams(result.value);\n\t}\n\n\tconst searchParams = new URLSearchParams();\n\n\tfor (const [key, value] of Object.entries(result.value as Record<string, unknown>)) {\n\t\tif (value == null) continue;\n\n\t\tif (isArray(value)) {\n\t\t\t// eslint-disable-next-line max-depth -- Allow\n\t\t\tfor (const innerValue of value) {\n\t\t\t\tsearchParams.append(key, toStringOrStringify(innerValue));\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tsearchParams.set(key, toStringOrStringify(value));\n\t}\n\n\treturn searchParams;\n};\n\nexport const toQueryString = <TSchema extends CallApiSchemaType<BodyType>>(\n\t...parameters: Parameters<typeof toSearchParams<TSchema>>\n) => {\n\tconst searchParams = toSearchParams(...parameters);\n\n\treturn searchParams.toString();\n};\n\nconst toBlobOrString = (value: unknown): string | Blob => {\n\treturn isBlob(value) ? value : String(value);\n};\n\n/**\n * @description Converts a plain object to FormData.\n *\n * Handles various data types:\n * - **Primitives** (string, number, boolean): Converted to strings\n * - **Blobs/Files**: Added directly to FormData\n * - **Arrays**: Each item is appended (allows multiple values for same key)\n * - **Objects**: JSON stringified before adding to FormData\n *\n * @example\n * ```ts\n * // Basic usage\n * const formData = toFormData({\n * name: \"John\",\n * age: 30,\n * active: true\n * });\n *\n * // With arrays\n * const formData = toFormData({\n * tags: [\"javascript\", \"typescript\"],\n * name: \"John\"\n * });\n *\n * // With files\n * const formData = toFormData({\n * avatar: fileBlob,\n * name: \"John\"\n * });\n *\n * // With nested objects (one level only)\n * const formData = toFormData({\n * user: { name: \"John\", age: 30 },\n * settings: { theme: \"dark\" }\n * });\n */\nexport const toFormData = <TSchema extends CallApiSchemaType<BodyType>>(\n\tdata: InferSchemaOutput<TSchema>,\n\tschema?: TSchema\n) => {\n\tconst formData = new FormData();\n\n\tconst result = getValidatedValue(data, schema, { variant: \"sync\" });\n\n\tif (result.issues) {\n\t\tthrow new ValidationError({\n\t\t\tissueCause: \"toFormData\",\n\t\t\tissues: result.issues,\n\t\t\tresponse: null,\n\t\t});\n\t}\n\n\tfor (const [key, value] of Object.entries(result.value as Record<string, unknown>)) {\n\t\tif (isArray(value)) {\n\t\t\t// eslint-disable-next-line max-depth -- Allow for now\n\t\t\tfor (const innerValue of value) {\n\t\t\t\tformData.append(key, toBlobOrString(innerValue));\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (isObject(value) && !isBlob(value)) {\n\t\t\tformData.set(key, JSON.stringify(value));\n\t\t\tcontinue;\n\t\t}\n\n\t\tformData.set(key, toBlobOrString(value));\n\t}\n\n\treturn formData;\n};\n","import type { CallApiPlugin } from \"../../plugins\";\nimport type { BaseCallApiConfig, CallApiConfig } from \"../../types/options-types\";\nimport type { AnyFunction, Satisfies, Writeable } from \"../../types/type-helpers\";\nimport type {\n\tBaseCallApiSchemaAndConfig,\n\tBaseCallApiSchemaRoutes,\n\tCallApiSchema,\n\tCallApiSchemaConfig,\n} from \"../../validation\";\n\nexport const defineSchema = <\n\tconst TBaseSchemaRoutes extends BaseCallApiSchemaRoutes,\n\tconst TSchemaConfig extends CallApiSchemaConfig,\n>(\n\troutes: TBaseSchemaRoutes,\n\tconfig?: Satisfies<TSchemaConfig, CallApiSchemaConfig>\n) => {\n\treturn {\n\t\tconfig: defineSchemaConfig(config as NonNullable<typeof config>),\n\t\troutes: defineSchemaRoutes(routes),\n\t} satisfies BaseCallApiSchemaAndConfig;\n};\n\nexport const defineSchemaRoutes = <const TSchemaRoutes extends BaseCallApiSchemaRoutes>(\n\troutes: TSchemaRoutes\n) => {\n\treturn routes as Writeable<typeof routes, \"deep\">;\n};\n\nexport const defineMainSchema = <const TSchema extends CallApiSchema>(\n\tmainSchema: Satisfies<TSchema, CallApiSchema>\n) => {\n\treturn mainSchema as Writeable<typeof mainSchema, \"deep\">;\n};\n\nexport const defineSchemaConfig = <const TSchemaConfig extends CallApiSchemaConfig>(\n\tconfig: Satisfies<TSchemaConfig, CallApiSchemaConfig>\n) => {\n\treturn config as Writeable<typeof config, \"deep\">;\n};\n\nexport const definePlugin = <const TPlugin extends CallApiPlugin>(plugin: TPlugin) => {\n\treturn plugin as Writeable<typeof plugin, \"deep\">;\n};\n\ntype BaseConfigObject = Exclude<BaseCallApiConfig, AnyFunction>;\n\ntype BaseConfigFn = Extract<BaseCallApiConfig, AnyFunction>;\n\ntype DefineBaseConfig = {\n\t<const TBaseConfig extends BaseConfigObject>(\n\t\tbaseConfig: Satisfies<TBaseConfig, BaseConfigObject>\n\t): Writeable<typeof baseConfig, \"deep\">;\n\t<const TBaseConfig extends BaseConfigObject>(\n\t\tbaseConfig: (...parameters: Parameters<BaseConfigFn>) => Writeable<TBaseConfig, \"deep\">\n\t): typeof baseConfig;\n};\n\nexport const defineBaseConfig: DefineBaseConfig = <const TBaseConfig extends BaseCallApiConfig>(\n\tbaseConfig: TBaseConfig\n) => {\n\treturn baseConfig;\n};\n\nexport const defineInstanceConfig = <const TInstanceConfig extends CallApiConfig>(\n\tconfig: TInstanceConfig\n) => {\n\treturn config as Writeable<typeof config, \"deep\">;\n};\n","import type {\n\tCallApiResultErrorVariant,\n\tPossibleHTTPError,\n\tPossibleJavaScriptError,\n\tPossibleValidationError,\n} from \"../../result\";\nimport { isObject } from \"../guards\";\nimport { HTTPError, ValidationError } from \"./error\";\n\nexport const isHTTPError = <TErrorData>(\n\terror: CallApiResultErrorVariant<TErrorData>[\"error\"] | null\n): error is PossibleHTTPError<TErrorData> => {\n\treturn isObject(error) && error.name === \"HTTPError\";\n};\n\nexport const isHTTPErrorInstance = <TErrorData>(error: unknown) => {\n\treturn HTTPError.isError<TErrorData>(error);\n};\n\nexport const isValidationError = (\n\terror: CallApiResultErrorVariant<unknown>[\"error\"] | null\n): error is PossibleValidationError => {\n\treturn isObject(error) && error.name === \"ValidationError\";\n};\n\nexport const isValidationErrorInstance = (error: unknown): error is ValidationError => {\n\treturn ValidationError.isError(error);\n};\n\nexport const isJavascriptError = (\n\terror: CallApiResultErrorVariant<unknown>[\"error\"] | null\n): error is PossibleJavaScriptError => {\n\treturn isObject(error) && !isHTTPError(error) && !isValidationError(error);\n};\n","import type { CallApiRequestOptions } from \"../../types/options-types\";\nimport { isPlainObject } from \"../guards\";\n\nexport const objectifyHeaders = (headers: CallApiRequestOptions[\"headers\"]) => {\n\tif (!headers) {\n\t\treturn {};\n\t}\n\n\tif (isPlainObject(headers)) {\n\t\treturn headers as Record<string, string>;\n\t}\n\n\treturn Object.fromEntries(headers);\n};\n","import { extraOptionDefaults } from \"./constants\";\nimport type { CallApiExtraOptions } from \"./types/options-types\";\nimport type { AnyString, UnmaskType } from \"./types/type-helpers\";\nimport { toSearchParams } from \"./utils/external\";\nimport { isArray } from \"./utils/guards\";\nimport { routeKeyMethods, type RouteKeyMethodsURLUnion } from \"./validation\";\n\nconst isReservedPathSegment = (value: string) => value === \".\" || value === \"..\";\n\nconst encodeParamValue = (value: unknown) => {\n\tconst stringValue = String(value);\n\n\tif (isReservedPathSegment(stringValue)) {\n\t\tthrow new TypeError(\"Path parameters cannot be reserved path segments\");\n\t}\n\n\treturn encodeURIComponent(stringValue);\n};\n\nconst isColonPathParam = (segment: string | undefined) => Boolean(segment?.startsWith(\":\"));\n\nconst isBracePathParam = (segment: string | undefined) => {\n\treturn Boolean(segment?.startsWith(\"{\") && segment.endsWith(\"}\"));\n};\n\nconst handleArrayParams = (url: string, params: Extract<CallApiExtraOptions[\"params\"], unknown[]>) => {\n\tconst placeholders: string[] = [];\n\n\tconst urlSegments = url.split(\"/\");\n\n\tfor (const segment of urlSegments) {\n\t\tif (!isColonPathParam(segment) && !isBracePathParam(segment)) continue;\n\n\t\tplaceholders.push(segment);\n\t}\n\n\tlet resolvedURL = url;\n\n\tfor (const index of placeholders.keys()) {\n\t\tconst placeholder = placeholders[index];\n\n\t\tif (placeholder === undefined) continue;\n\n\t\tconst paramValue = params[index];\n\n\t\tresolvedURL = resolvedURL.replace(placeholder, encodeParamValue(paramValue));\n\t}\n\n\treturn resolvedURL;\n};\n\nconst getPathParamKey = (segment: string) => {\n\tif (isColonPathParam(segment)) {\n\t\treturn segment.slice(1);\n\t}\n\n\tif (isBracePathParam(segment)) {\n\t\treturn segment.slice(1, -1);\n\t}\n\n\treturn null;\n};\n\nconst handleObjectParams = (\n\turl: string,\n\tparams: Extract<CallApiExtraOptions[\"params\"], Record<string, unknown>>\n) => {\n\tconst urlSegments = url.split(\"/\");\n\n\tfor (const segmentIndex of urlSegments.keys()) {\n\t\tconst segment = urlSegments[segmentIndex];\n\n\t\tif (segment === undefined) continue;\n\n\t\tconst paramKey = getPathParamKey(segment);\n\n\t\tif (paramKey === null || !Object.hasOwn(params, paramKey)) continue;\n\n\t\tconst paramValue = params[paramKey];\n\n\t\turlSegments[segmentIndex] = encodeParamValue(paramValue);\n\t}\n\n\treturn urlSegments.join(\"/\");\n};\n\nconst mergeUrlWithParams = (url: string, params: CallApiExtraOptions[\"params\"]) => {\n\tif (!params) {\n\t\treturn url;\n\t}\n\n\tconst newUrl = isArray(params) ? handleArrayParams(url, params) : handleObjectParams(url, params);\n\n\treturn newUrl;\n};\n\nconst mergeUrlWithQuery = (url: string, query: CallApiExtraOptions[\"query\"]): string => {\n\tif (!query) {\n\t\treturn url;\n\t}\n\n\tconst incomingSearchParams = toSearchParams(query);\n\n\tif (incomingSearchParams.size === 0) {\n\t\treturn url;\n\t}\n\n\tif (!url.includes(\"?\")) {\n\t\treturn `${url}?${incomingSearchParams}`;\n\t}\n\n\tif (url.endsWith(\"?\")) {\n\t\treturn `${url}${incomingSearchParams}`;\n\t}\n\n\tconst [mainUrl, existingQueryString] = url.split(\"?\");\n\n\tconst searchParams = new URLSearchParams(existingQueryString);\n\n\tfor (const key of incomingSearchParams.keys()) {\n\t\tsearchParams.delete(key);\n\t}\n\n\tfor (const entry of incomingSearchParams) {\n\t\tsearchParams.append(...entry);\n\t}\n\n\treturn `${mainUrl}?${searchParams}`;\n};\n\n/**\n * @description Extracts the HTTP method from method-prefixed route patterns.\n *\n * Analyzes URLs that start with method modifiers (e.g., \"@get/\", \"@post/\") and extracts\n * the HTTP method for use in API requests. This enables method specification directly\n * in route definitions.\n *\n * @param initURL - The URL string to analyze for method modifiers\n * @returns The extracted HTTP method (lowercase) if found, otherwise undefined\n *\n * @example\n * ```typescript\n * extractMethodFromURL(\"@get/users\"); // Returns: \"get\"\n * extractMethodFromURL(\"@post/users\"); // Returns: \"post\"\n * ```\n */\nexport const extractMethodFromURL = (initURL: string | undefined) => {\n\tif (!initURL?.startsWith(\"@\")) return;\n\n\tconst methodFromURL = routeKeyMethods.find((method) => initURL.startsWith(`@${method}/`));\n\n\tif (!methodFromURL) return;\n\n\treturn methodFromURL;\n};\n\nconst isAbsoluteHTTPURL = (value: string) => {\n\treturn value.startsWith(\"http://\") || value.startsWith(\"https://\");\n};\n\ntype NormalizeURLOptions = {\n\tretainLeadingSlashForRelativeURLs?: boolean;\n};\n\nexport const atSymbol = \"@\";\nexport type AtSymbol = typeof atSymbol;\n\nexport const normalizeURL = (initURL: string, options: NormalizeURLOptions = {}) => {\n\tconst { retainLeadingSlashForRelativeURLs = true } = options;\n\n\tconst methodFromURL = extractMethodFromURL(initURL);\n\n\tif (!methodFromURL) {\n\t\treturn initURL;\n\t}\n\n\tconst initURLWithoutMethod = initURL.replace(`@${methodFromURL}/`, \"\");\n\n\tconst normalizedURL =\n\t\tretainLeadingSlashForRelativeURLs && !isAbsoluteHTTPURL(initURLWithoutMethod) ?\n\t\t\t`/${initURLWithoutMethod}`\n\t\t:\tinitURLWithoutMethod;\n\n\treturn normalizedURL;\n};\n\ntype GetFullURLOptions = {\n\tbaseURL: string | undefined;\n\tinitURL: string;\n\tparams: CallApiExtraOptions[\"params\"];\n\tquery: CallApiExtraOptions[\"query\"];\n};\n\nconst getFullURL = (initURL: string, baseURL: string | undefined) => {\n\tif (!baseURL || isAbsoluteHTTPURL(initURL)) {\n\t\treturn initURL;\n\t}\n\n\t// Remove all trailing slashes from the base URL.\n\tconst normalizedBaseURL = baseURL.replace(/\\/+$/, \"\");\n\t// Remove all leading slashes from the request URL.\n\tconst normalizedInitURL = initURL.replace(/^\\/+/, \"\");\n\n\treturn normalizedInitURL ? `${normalizedBaseURL}/${normalizedInitURL}` : normalizedBaseURL;\n};\n\nexport const getFullAndNormalizedURL = (\n\toptions: GetFullURLOptions & {\n\t\tdebugMode: CallApiExtraOptions[\"debugMode\"];\n\t}\n) => {\n\tconst { baseURL, debugMode, initURL, params, query } = options;\n\n\tconst normalizedInitURL = normalizeURL(initURL);\n\n\tconst fullURL = getFullURL(\n\t\tmergeUrlWithQuery(mergeUrlWithParams(normalizedInitURL, params), query),\n\t\tbaseURL\n\t);\n\n\tif (\n\t\t(debugMode ?? extraOptionDefaults.debugMode)\n\t\t&& !isAbsoluteHTTPURL(fullURL)\n\t\t&& !URL.canParse(fullURL)\n\t) {\n\t\tconsole.error(\n\t\t\t`Relative URL '${fullURL}' may fail during SSR. Set an absolute 'baseURL' for server-side requests.`\n\t\t);\n\t}\n\n\treturn {\n\t\tfullURL,\n\t\tnormalizedInitURL,\n\t};\n};\n\nexport type AllowedQueryParamValues = UnmaskType<boolean | number | string>;\n\nexport type RecordStyleParams = UnmaskType<Record<string, AllowedQueryParamValues>>;\n\nexport type TupleStyleParams = UnmaskType<AllowedQueryParamValues[]>;\n\nexport type Params = UnmaskType<RecordStyleParams | TupleStyleParams>;\n\ntype StructuredQueryValues = Record<string, unknown> | unknown[] | null | undefined;\n\nexport type Query = UnmaskType<\n\tRecord<string, AllowedQueryParamValues | StructuredQueryValues> | URLSearchParams\n>;\n\nexport type InitURLOrURLObject = AnyString | RouteKeyMethodsURLUnion | URL;\n\nexport interface URLOptions {\n\t/**\n\t * Base URL for all API requests. Will only be prepended to relative URLs.\n\t *\n\t * Absolute URLs (starting with http/https) will not be prepended by the baseURL.\n\t *\n\t * @example\n\t * ```ts\n\t * // Set base URL for all requests\n\t * baseURL: \"https://api.example.com/v1\"\n\t *\n\t * // Then use relative URLs in requests\n\t * callApi(\"/users\") // → https://api.example.com/v1/users\n\t * callApi(\"/posts/123\") // → https://api.example.com/v1/posts/123\n\t *\n\t * // Environment-specific base URLs\n\t * baseURL: process.env.NODE_ENV === \"production\"\n\t * ? \"https://api.example.com\"\n\t * : \"http://localhost:3000/api\"\n\t * ```\n\t */\n\tbaseURL?: string;\n\n\t/**\n\t * Resolved request URL after processing baseURL, parameters, and query strings (readonly)\n\t *\n\t * This is the final URL that will be used for the HTTP request, computed from\n\t * baseURL, initURL, params, and query parameters.\n\t *\n\t */\n\treadonly fullURL?: string;\n\n\t/**\n\t * The original URL string passed to the callApi instance (readonly)\n\t *\n\t * This preserves the original URL as provided, including any method modifiers like \"@get/\" or \"@post/\".\n\t *\n\t */\n\treadonly initURL?: string;\n\n\t/**\n\t * The URL string after normalization, with method modifiers removed(readonly)\n\t *\n\t * Method modifiers like \"@get/\", \"@post/\" are stripped to create a clean URL\n\t * for parameter substitution and final URL construction.\n\t *\n\t */\n\treadonly initURLNormalized?: string;\n\n\t/**\n\t * Parameters to be substituted into URL path segments.\n\t *\n\t * Supports both object-style (named parameters) and array-style (positional parameters)\n\t * for flexible URL parameter substitution.\n\t *\n\t * @example\n\t * ```typescript\n\t * // Object-style parameters (recommended)\n\t * const namedParams: URLOptions = {\n\t * initURL: \"/users/:userId/posts/:postId\",\n\t * params: { userId: \"123\", postId: \"456\" }\n\t * };\n\t * // Results in: /users/123/posts/456\n\t *\n\t * // Array-style parameters (positional)\n\t * const positionalParams: URLOptions = {\n\t * initURL: \"/users/:userId/posts/:postId\",\n\t * params: [\"123\", \"456\"] // Maps in order: userId=123, postId=456\n\t * };\n\t * // Results in: /users/123/posts/456\n\t *\n\t * // Single parameter\n\t * const singleParam: URLOptions = {\n\t * initURL: \"/users/:id\",\n\t * params: { id: \"user-123\" }\n\t * };\n\t * // Results in: /users/user-123\n\t * ```\n\t */\n\tparams?: Params;\n\n\t/**\n\t * Query parameters to append to the URL as search parameters.\n\t *\n\t * These will be serialized into the URL query string using standard\n\t * URL encoding practices.\n\t *\n\t * @example\n\t * ```typescript\n\t * // Basic query parameters\n\t * const queryOptions: URLOptions = {\n\t * initURL: \"/users\",\n\t * query: {\n\t * page: 1,\n\t * limit: 10,\n\t * search: \"john doe\",\n\t * active: true\n\t * }\n\t * };\n\t * // Results in: /users?page=1&limit=10&search=john%20doe&active=true\n\t *\n\t * // Filtering and sorting\n\t * const filterOptions: URLOptions = {\n\t * initURL: \"/products\",\n\t * query: {\n\t * category: \"electronics\",\n\t * minPrice: 100,\n\t * maxPrice: 500,\n\t * sortBy: \"price\",\n\t * order: \"asc\"\n\t * }\n\t * };\n\t * // Results in: /products?category=electronics&minPrice=100&maxPrice=500&sortBy=price&order=asc\n\t * ```\n\t */\n\tquery?: Query;\n}\n","import { getAuthHeader } from \"../auth\";\nimport { fetchSpecificKeys } from \"../constants/common\";\nimport { extraOptionDefaults, requestOptionDefaults } from \"../constants/defaults\";\nimport type { RequestContext } from \"../hooks\";\nimport type { Middlewares } from \"../middlewares\";\nimport type { InferHeadersOption } from \"../types/conditional-types\";\nimport type {\n\tCallApiExtraOptions,\n\tCallApiRequestOptions,\n\tSharedExtraOptions,\n} from \"../types/options-types\";\nimport type { DistributiveOmit } from \"../types/type-helpers\";\nimport { extractMethodFromURL } from \"../url\";\nimport type { CallApiSchema } from \"../validation\";\nimport { objectifyHeaders } from \"./external\";\nimport {\n\tisFunction,\n\tisPlainObject,\n\tisQueryString,\n\tisSerializableObject,\n\tisValidJsonString,\n} from \"./guards\";\n\nexport const omitKeys = <\n\tTObject extends Record<string, unknown>,\n\tconst TOmitArray extends Array<keyof TObject> | ReadonlyArray<keyof TObject>,\n>(\n\tinitialObject: TObject,\n\tkeysToOmit: TOmitArray\n) => {\n\tconst updatedObject = {} as Record<string, unknown>;\n\n\tfor (const [key, value] of Object.entries(initialObject)) {\n\t\tif (!keysToOmit.includes(key)) {\n\t\t\tupdatedObject[key] = value;\n\t\t}\n\t}\n\n\treturn updatedObject as DistributiveOmit<TObject, TOmitArray[number]>;\n};\n\nexport const pickKeys = <\n\tTObject extends Record<string, unknown>,\n\tconst TPickArray extends Array<keyof TObject> | ReadonlyArray<keyof TObject>,\n>(\n\tinitialObject: TObject,\n\tkeysToPick: TPickArray\n) => {\n\tconst updatedObject = {} as Record<string, unknown>;\n\n\tfor (const [key, value] of Object.entries(initialObject)) {\n\t\tif (keysToPick.includes(key)) {\n\t\t\tupdatedObject[key] = value;\n\t\t}\n\t}\n\n\treturn updatedObject as Pick<TObject, TPickArray[number]>;\n};\n\n// eslint-disable-next-line ts-eslint/no-explicit-any -- Any is required here so that one can pass custom function type without type errors\nexport const splitConfig = <TExtraOptions extends SharedExtraOptions>(config: Record<string, any>) =>\n\t[\n\t\tpickKeys(config, fetchSpecificKeys) as CallApiRequestOptions,\n\t\tomitKeys(config, fetchSpecificKeys) as TExtraOptions,\n\t] as const;\n\nexport type GetResolvedHeadersOptions = {\n\tbaseHeaders: CallApiRequestOptions[\"headers\"];\n\theaders: InferHeadersOption<CallApiSchema>[\"headers\"];\n};\n\nexport const getResolvedHeaders = (options: GetResolvedHeadersOptions) => {\n\tconst { baseHeaders, headers } = options;\n\n\tconst resolvedHeaders =\n\t\tisFunction(headers) ?\n\t\t\theaders({ baseHeaders: objectifyHeaders(baseHeaders) })\n\t\t:\t(headers ?? baseHeaders);\n\n\treturn objectifyHeaders(resolvedHeaders);\n};\n\nconst detectContentTypeHeader = (body: CallApiRequestOptions[\"body\"]) => {\n\tif (isQueryString(body)) {\n\t\treturn {\n\t\t\t\"Content-Type\": \"application/x-www-form-urlencoded\",\n\t\t};\n\t}\n\n\tif (isSerializableObject(body) || isValidJsonString(body)) {\n\t\treturn {\n\t\t\tAccept: \"application/json\",\n\t\t\t\"Content-Type\": \"application/json\",\n\t\t};\n\t}\n\n\treturn null;\n};\n\nexport type GetHeadersOptions = {\n\tauth: CallApiExtraOptions[\"auth\"];\n\tbody: CallApiRequestOptions[\"body\"];\n\tresolvedHeaders: CallApiRequestOptions[\"headers\"];\n};\n\nexport const getHeaders = async (options: GetHeadersOptions) => {\n\tconst { auth, body, resolvedHeaders } = options;\n\n\tconst resolvedHeadersObject = objectifyHeaders(resolvedHeaders);\n\n\tconst headersObject: Record<string, string> = {\n\t\t...(await getAuthHeader(auth)),\n\t\t...resolvedHeadersObject,\n\t};\n\n\tconst hasExistingContentType = new Headers(headersObject).has(\"Content-Type\");\n\n\tif (!hasExistingContentType) {\n\t\tconst contentTypeHeader = detectContentTypeHeader(body);\n\t\tcontentTypeHeader && Object.assign(headersObject, contentTypeHeader);\n\t}\n\n\treturn headersObject;\n};\n\nexport type GetMethodContext = {\n\t/** The URL string that may contain method modifiers like \"@get/\" or \"@post/\" */\n\tinitURL: string | undefined;\n\t/** Explicitly specified HTTP method */\n\tmethod: CallApiRequestOptions[\"method\"];\n};\n\nexport const getMethod = (ctx: GetMethodContext) => {\n\tconst { initURL, method } = ctx;\n\n\treturn (\n\t\tmethod?.toUpperCase() ?? extractMethodFromURL(initURL)?.toUpperCase() ?? requestOptionDefaults.method\n\t);\n};\n\nexport type GetBodyOptions = Pick<GetHeadersOptions, \"body\" | \"resolvedHeaders\"> & {\n\tbodySerializer: CallApiExtraOptions[\"bodySerializer\"];\n\tbodyTransformer: CallApiExtraOptions[\"bodyTransformer\"];\n};\n\nexport const getBody = (options: GetBodyOptions) => {\n\tconst { body, bodySerializer, bodyTransformer, resolvedHeaders } = options;\n\n\tconst headers = new Headers(resolvedHeaders as Record<string, string>);\n\n\tif (body !== undefined && bodyTransformer) {\n\t\treturn bodyTransformer({ body, headers });\n\t}\n\n\tconst existingContentType = headers.get(\"content-type\");\n\n\tif (!existingContentType && isSerializableObject(body)) {\n\t\tconst selectedBodySerializer = bodySerializer ?? extraOptionDefaults.bodySerializer;\n\n\t\treturn selectedBodySerializer(body);\n\t}\n\n\tif (existingContentType === \"application/x-www-form-urlencoded\" && isSerializableObject(body)) {\n\t\treturn new URLSearchParams(body as Record<string, string>).toString();\n\t}\n\n\treturn body;\n};\n\nexport const getInitFetchImpl = (customFetchImpl: CallApiExtraOptions[\"customFetchImpl\"]) => {\n\tif (customFetchImpl) {\n\t\treturn customFetchImpl;\n\t}\n\n\tif (typeof globalThis !== \"undefined\" && isFunction(globalThis.fetch)) {\n\t\treturn globalThis.fetch;\n\t}\n\n\tthrow new Error(\"No fetch implementation found\");\n};\n\nexport const getFetchImpl = (context: {\n\tcustomFetchImpl: CallApiExtraOptions[\"customFetchImpl\"];\n\tfetchMiddleware: Middlewares[\"fetchMiddleware\"];\n\trequestContext: RequestContext;\n}) => {\n\tconst { customFetchImpl, fetchMiddleware, requestContext } = context;\n\n\tconst initFetchImpl = getInitFetchImpl(customFetchImpl);\n\n\tconst resolvedFetchImpl =\n\t\tfetchMiddleware ? fetchMiddleware({ ...requestContext, fetchImpl: initFetchImpl }) : initFetchImpl;\n\n\treturn resolvedFetchImpl;\n};\n\nexport const waitFor = (ms: number) => {\n\tif (ms === 0) return;\n\n\tconst promise = new Promise((resolve) => setTimeout(resolve, ms));\n\n\treturn promise;\n};\n\nexport const createCombinedSignal = (...signals: Array<AbortSignal | null | undefined>) => {\n\tconst validSignals = signals.filter((signal) => signal != null);\n\n\tif (validSignals.length === 0) return;\n\tif (validSignals.length === 1) {\n\t\treturn validSignals[0];\n\t}\n\n\treturn AbortSignal.any(validSignals);\n};\n\nexport const createTimeoutSignal = (ms: number | undefined) => {\n\tif (ms === undefined || ms === Infinity) return;\n\n\treturn AbortSignal.timeout(ms);\n};\n\nexport const deterministicHashFn = (value: unknown): string => {\n\treturn JSON.stringify(value, (_, innerValue: unknown) => {\n\t\tif (!isPlainObject(innerValue)) {\n\t\t\treturn innerValue;\n\t\t}\n\n\t\tconst result: Record<string, unknown> = {};\n\n\t\t// eslint-disable-next-line unicorn/no-array-sort -- Not necessary here\n\t\tconst sortedKeys = Object.keys(innerValue).sort();\n\n\t\tfor (const key of sortedKeys) {\n\t\t\tresult[key] = innerValue[key];\n\t\t}\n\n\t\treturn result;\n\t});\n};\n","import type { CallApiConfig, CallApiExtraOptions } from \"../types/options-types\";\nimport { defineEnum } from \"../types/type-helpers\";\nimport { deterministicHashFn } from \"../utils/common\";\n\nexport const extraOptionDefaults = Object.freeze(\n\tdefineEnum({\n\t\t// Common defaults\n\t\tbodySerializer: JSON.stringify,\n\t\tdebugMode: true,\n\t\tdefaultHTTPErrorMessage: \"Request failed unexpectedly\",\n\n\t\t// Dedupe defaults\n\t\t/* eslint-disable perfectionist/sort-objects -- Allow */\n\t\tdedupeCacheScope: \"local\",\n\t\tdedupeKey: (ctx) =>\n\t\t\t`${ctx.options.fullURL}-${deterministicHashFn({ options: ctx.options, request: ctx.request })}`,\n\t\tdedupeCacheScopeKey: \"default\",\n\t\tdedupeStrategy: \"cancel\",\n\t\t/* eslint-enable perfectionist/sort-objects -- Allow */\n\n\t\t// Hook defaults\n\t\thooksExecutionMode: \"parallel\",\n\n\t\t// Response defaults\n\t\tresponseParser: JSON.parse,\n\t\tresponseType: \"json\",\n\t\tresultMode: \"all\",\n\n\t\t// Retry Defaults\n\t\tretryAttempts: 0,\n\t\tretryCondition: () => true,\n\t\tretryDelay: 1000,\n\t\tretryMaxDelay: 10000,\n\t\tretryMethods: [\"GET\", \"POST\"],\n\t\tretryStatusCodes: [],\n\t\tretryStrategy: \"linear\",\n\t} as const satisfies CallApiExtraOptions)\n);\n\nexport const requestOptionDefaults = Object.freeze(\n\tdefineEnum({\n\t\tmethod: \"GET\",\n\t} satisfies CallApiConfig)\n);\n"],"mappings":";AAmCA,MAAa,cAA2C,UACvD,OAAO,OAAO,KAAK;;;ACjCpB,MAAa,oBAAoB,WAAW;CAC3C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAgF;;;AClBhF,MAAa,WAAuB,UAA0C,MAAM,QAAQ,KAAK;AAIjG,MAAa,UAAU,UAAkC,iBAAiB;AAE1E,MAAa,YAAoC,UAAqC;CACrF,OAAO,OAAO,UAAU,YAAY,UAAU;AAC/C;AAEA,MAAM,sBAAsB,UAAmB;CAC9C,OAAO,OAAO,UAAU,SAAS,K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rB,WAAW;CACX,yBAAyB;CAIzB,kBAAkB;CAClB,YAAY,QACX,GAAG,IAAI,QAAQ,QAAQ,GAAG,oBAAoB;EAAE,SAAS,IAAI;EAAS,SAAS,IAAI;CAAQ,CAAC;CAC7F,qBAAqB;CACrB,gBAAgB;CAIhB,oBAAoB;CAGpB,gBAAgB,KAAK;CACrB,cAAc;CACd,YAAY;CAGZ,eAAe;CACf,sBAAsB;CACtB,YAAY;CACZ,eAAe;CACf,cAAc,CAAC,OAAO,MAAM;CAC5B,kBAAkB,CAAC;CACnB,eAAe;AAChB,CAAwC,CACzC;AAEA,MAAa,wBAAwB,OAAO,OAC3C,WAAW,EACV,QAAQ,MACT,CAAyB,CAC1B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { At as BaseCallApiSchemaAndConfig, Dt as ResultModeType, Et as ResponseTypeType, Gt as NoInferUnMasked, Ht as CommonContentTypes, It as InferSchemaOutput, Kt as Writeable, Lt as InferSchemaResult, Nt as CallApiSchema, O as GlobalMeta, Pt as CallApiSchemaConfig, S as CallApiResult, T as GetBaseSchemaRoutes, Tt as ResponseTypeMap, Ut as CommonRequestHeaders, Vt as AnyString, Wt as DistributiveOmit, _ as CallApiConfig, a as GetCurrentRouteSchemaKey, b as CallApiParameters, bt as GetResponseType, ct as DefaultDataType, d as SerializableArray, f as SerializableObject, h as BaseCallApiConfig, i as GetCurrentRouteSchema, jt as BaseCallApiSchemaRoutes, l as InferInitURL, lt as DefaultPluginArray, m as AuthOption, n as ApplyURLBasedConfig, o as HeadersOption, p as ThrowOnErrorBoolean, r as Body, st as DefaultCallApiContext, t as ApplyStrictConfig, u as InferParamsFromRoute, ut as CallApiPlugin, v as CallApiContext, vt as CallApiResultSuccessOrErrorVariant, w as GetBaseSchemaConfig, xt as InferCallApiResult, yt as CallApiResultSuccessVariant } from "./conditional-types-
|
|
1
|
+
import { At as BaseCallApiSchemaAndConfig, Dt as ResultModeType, Et as ResponseTypeType, Gt as NoInferUnMasked, Ht as CommonContentTypes, It as InferSchemaOutput, Kt as Writeable, Lt as InferSchemaResult, Nt as CallApiSchema, O as GlobalMeta, Pt as CallApiSchemaConfig, S as CallApiResult, T as GetBaseSchemaRoutes, Tt as ResponseTypeMap, Ut as CommonRequestHeaders, Vt as AnyString, Wt as DistributiveOmit, _ as CallApiConfig, a as GetCurrentRouteSchemaKey, b as CallApiParameters, bt as GetResponseType, ct as DefaultDataType, d as SerializableArray, f as SerializableObject, h as BaseCallApiConfig, i as GetCurrentRouteSchema, jt as BaseCallApiSchemaRoutes, l as InferInitURL, lt as DefaultPluginArray, m as AuthOption, n as ApplyURLBasedConfig, o as HeadersOption, p as ThrowOnErrorBoolean, r as Body, st as DefaultCallApiContext, t as ApplyStrictConfig, u as InferParamsFromRoute, ut as CallApiPlugin, v as CallApiContext, vt as CallApiResultSuccessOrErrorVariant, w as GetBaseSchemaConfig, xt as InferCallApiResult, yt as CallApiResultSuccessVariant } from "./conditional-types-C9cMfJMZ.js";
|
|
2
2
|
//#region src/createFetchClient.d.ts
|
|
3
3
|
declare const createFetchClientWithContext: <TOuterCallApiContext extends CallApiContext = DefaultCallApiContext>() => <TBaseCallApiContext extends CallApiContext = TOuterCallApiContext, TBaseData = TBaseCallApiContext["Data"], TBaseErrorData = TBaseCallApiContext["ErrorData"], TBaseResultMode extends ResultModeType = TBaseCallApiContext["ResultMode"] extends ResultModeType ? TBaseCallApiContext["ResultMode"] : ResultModeType, TBaseThrowOnError extends ThrowOnErrorBoolean = boolean, TBaseResponseType extends ResponseTypeType = ResponseTypeType, const TBaseSchemaAndConfig extends BaseCallApiSchemaAndConfig = BaseCallApiSchemaAndConfig, const TBasePluginArray extends CallApiPlugin[] = DefaultPluginArray, TComputedBaseSchemaConfig extends CallApiSchemaConfig = GetBaseSchemaConfig<TBaseSchemaAndConfig>, TComputedBaseSchemaRoutes extends BaseCallApiSchemaRoutes = GetBaseSchemaRoutes<TBaseSchemaAndConfig>>(initBaseConfig?: BaseCallApiConfig<TBaseCallApiContext, TBaseData, TBaseErrorData, TBaseResultMode, TBaseThrowOnError, TBaseResponseType, TBaseSchemaAndConfig, TBasePluginArray>) => <TData = TBaseData, TErrorData = TBaseErrorData, TResultMode extends ResultModeType = TBaseResultMode, TCallApiContext extends CallApiContext = TBaseCallApiContext, TThrowOnError extends ThrowOnErrorBoolean = TBaseThrowOnError, TResponseType extends ResponseTypeType = TBaseResponseType, const TSchemaConfig extends CallApiSchemaConfig = TComputedBaseSchemaConfig, TInitURL extends InferInitURL<TComputedBaseSchemaRoutes, TSchemaConfig> = InferInitURL<TComputedBaseSchemaRoutes, TSchemaConfig>, TCurrentRouteSchemaKey extends GetCurrentRouteSchemaKey<TSchemaConfig, TInitURL> = GetCurrentRouteSchemaKey<TSchemaConfig, TInitURL>, const TSchema extends CallApiSchema = GetCurrentRouteSchema<TComputedBaseSchemaRoutes, TCurrentRouteSchemaKey>, TBody extends InferSchemaOutput<TSchema["body"], Body> = InferSchemaOutput<TSchema["body"], SerializableObject | BodyInit | SerializableArray | null>, const TPluginArray extends CallApiPlugin[] = TBasePluginArray, TComputedData = InferSchemaOutput<TSchema["data"], GetResponseType<TData, TResponseType>>, TComputedErrorData = InferSchemaOutput<TSchema["errorData"], GetResponseType<TErrorData, TResponseType>>, TComputedResult = CallApiResult<TComputedData, TComputedErrorData, TResultMode, TThrowOnError>>(...[initURL, initConfig]: CallApiParameters<TComputedData, TComputedErrorData, TResultMode, TCallApiContext, TThrowOnError, TResponseType, TComputedBaseSchemaRoutes, TSchema, TComputedBaseSchemaConfig, TSchemaConfig, TInitURL, TCurrentRouteSchemaKey, TBody, TBasePluginArray, TPluginArray>) => Promise<TComputedResult>;
|
|
4
4
|
declare const createFetchClient: <TBaseCallApiContext extends CallApiContext = {
|
|
@@ -47,9 +47,9 @@ declare const createFetchClient: <TBaseCallApiContext extends CallApiContext = {
|
|
|
47
47
|
}> : {
|
|
48
48
|
params?: InferSchemaResult<TSchema["params"], InferParamsFromRoute<TCurrentRouteSchemaKey>, "infer-output"> | undefined;
|
|
49
49
|
}>) & (undefined extends InferSchemaResult<TSchema["query"], undefined, "infer-output"> ? {
|
|
50
|
-
query?: InferSchemaResult<TSchema["query"], URLSearchParams | Record<string, string | number | boolean>, "infer-output"> | undefined;
|
|
50
|
+
query?: InferSchemaResult<TSchema["query"], URLSearchParams | Record<string, string | number | boolean | (unknown[] | Record<string, unknown> | null | undefined)>, "infer-output"> | undefined;
|
|
51
51
|
} : Required<{
|
|
52
|
-
query?: InferSchemaResult<TSchema["query"], URLSearchParams | Record<string, string | number | boolean>, "infer-output"> | undefined;
|
|
52
|
+
query?: InferSchemaResult<TSchema["query"], URLSearchParams | Record<string, string | number | boolean | (unknown[] | Record<string, unknown> | null | undefined)>, "infer-output"> | undefined;
|
|
53
53
|
}>) & (undefined extends InferSchemaResult<TSchema["body"], undefined, "infer-output"> ? {
|
|
54
54
|
body?: TBody | undefined;
|
|
55
55
|
} : Required<{
|
|
@@ -161,9 +161,9 @@ declare const callApi: <TData = unknown, TErrorData = unknown, TResultMode exten
|
|
|
161
161
|
}> : {
|
|
162
162
|
params?: InferSchemaResult<TSchema["params"], InferParamsFromRoute<TCurrentRouteSchemaKey>, "infer-output"> | undefined;
|
|
163
163
|
}>) & (undefined extends InferSchemaResult<TSchema["query"], undefined, "infer-output"> ? {
|
|
164
|
-
query?: InferSchemaResult<TSchema["query"], URLSearchParams | Record<string, string | number | boolean>, "infer-output"> | undefined;
|
|
164
|
+
query?: InferSchemaResult<TSchema["query"], URLSearchParams | Record<string, string | number | boolean | (unknown[] | Record<string, unknown> | null | undefined)>, "infer-output"> | undefined;
|
|
165
165
|
} : Required<{
|
|
166
|
-
query?: InferSchemaResult<TSchema["query"], URLSearchParams | Record<string, string | number | boolean>, "infer-output"> | undefined;
|
|
166
|
+
query?: InferSchemaResult<TSchema["query"], URLSearchParams | Record<string, string | number | boolean | (unknown[] | Record<string, unknown> | null | undefined)>, "infer-output"> | undefined;
|
|
167
167
|
}>) & (undefined extends InferSchemaResult<TSchema["body"], undefined, "infer-output"> ? {
|
|
168
168
|
body?: TBody | undefined;
|
|
169
169
|
} : Required<{
|
|
@@ -183,4 +183,4 @@ declare const callApi: <TData = unknown, TErrorData = unknown, TResultMode exten
|
|
|
183
183
|
}>)>) => Promise<TComputedResult>;
|
|
184
184
|
//#endregion
|
|
185
185
|
export { createFetchClient as n, createFetchClientWithContext as r, callApi as t };
|
|
186
|
-
//# sourceMappingURL=index-
|
|
186
|
+
//# sourceMappingURL=index-Dcg43451.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as Register, B as ResponseErrorContext, C as CallApiResultLoose, Ct as PossibleJavaScriptError, D as GetCallApiContextRequired, Dt as ResultModeType, E as GetCallApiContext, Et as ResponseTypeType, F as Hooks, Ft as InferSchemaInput, H as SuccessContext, I as HooksOrHooksArray, It as InferSchemaOutput, L as RequestContext, M as CallApiExtraOptionsForHooks, Mt as BaseSchemaRouteKeyPrefixes, N as CallApiRequestOptionsForHooks, Nt as CallApiSchema, P as ErrorContext, Pt as CallApiSchemaConfig, R as RequestStreamContext, Rt as URLOptions, St as PossibleHTTPError, U as RefetchOptions, V as ResponseStreamContext, W as RetryOptions, _ as CallApiConfig, _t as CallApiResultErrorVariant, a as GetCurrentRouteSchemaKey, b as CallApiParameters, c as InferAllMainRoutes, dt as PluginHooks, ft as PluginMiddlewares, g as BaseCallApiExtraOptions, gt as Middlewares, h as BaseCallApiConfig, ht as FetchMiddlewareContext, j as DedupeOptions, jt as BaseCallApiSchemaRoutes, k as InstanceContext, l as InferInitURL, mt as FetchImpl, pt as PluginSetupContext, s as InferAllMainRouteKeys, st as DefaultCallApiContext, u as InferParamsFromRoute, ut as CallApiPlugin, vt as CallApiResultSuccessOrErrorVariant, wt as PossibleValidationError, x as CallApiRequestOptions, y as CallApiExtraOptions, yt as CallApiResultSuccessVariant, z as ResponseContext } from "./conditional-types-
|
|
2
|
-
import { n as createFetchClient, r as createFetchClientWithContext, t as callApi } from "./index-
|
|
1
|
+
import { A as Register, B as ResponseErrorContext, C as CallApiResultLoose, Ct as PossibleJavaScriptError, D as GetCallApiContextRequired, Dt as ResultModeType, E as GetCallApiContext, Et as ResponseTypeType, F as Hooks, Ft as InferSchemaInput, H as SuccessContext, I as HooksOrHooksArray, It as InferSchemaOutput, L as RequestContext, M as CallApiExtraOptionsForHooks, Mt as BaseSchemaRouteKeyPrefixes, N as CallApiRequestOptionsForHooks, Nt as CallApiSchema, P as ErrorContext, Pt as CallApiSchemaConfig, R as RequestStreamContext, Rt as URLOptions, St as PossibleHTTPError, U as RefetchOptions, V as ResponseStreamContext, W as RetryOptions, _ as CallApiConfig, _t as CallApiResultErrorVariant, a as GetCurrentRouteSchemaKey, b as CallApiParameters, c as InferAllMainRoutes, dt as PluginHooks, ft as PluginMiddlewares, g as BaseCallApiExtraOptions, gt as Middlewares, h as BaseCallApiConfig, ht as FetchMiddlewareContext, j as DedupeOptions, jt as BaseCallApiSchemaRoutes, k as InstanceContext, l as InferInitURL, mt as FetchImpl, pt as PluginSetupContext, s as InferAllMainRouteKeys, st as DefaultCallApiContext, u as InferParamsFromRoute, ut as CallApiPlugin, vt as CallApiResultSuccessOrErrorVariant, wt as PossibleValidationError, x as CallApiRequestOptions, y as CallApiExtraOptions, yt as CallApiResultSuccessVariant, z as ResponseContext } from "./conditional-types-C9cMfJMZ.js";
|
|
2
|
+
import { n as createFetchClient, r as createFetchClientWithContext, t as callApi } from "./index-Dcg43451.js";
|
|
3
3
|
export { type BaseCallApiConfig, type BaseCallApiExtraOptions, type BaseCallApiSchemaRoutes, type BaseSchemaRouteKeyPrefixes, type CallApiConfig, type CallApiExtraOptions, type CallApiExtraOptionsForHooks, type CallApiParameters, type CallApiPlugin, type CallApiRequestOptions, type CallApiRequestOptionsForHooks, type CallApiResultLoose as CallApiResult, type CallApiResultErrorVariant, type CallApiResultSuccessOrErrorVariant, type CallApiResultSuccessVariant, type CallApiSchema, type CallApiSchemaConfig, type DedupeOptions, type DefaultCallApiContext, type ErrorContext, type FetchImpl, type FetchMiddlewareContext, type GetCallApiContext, type GetCallApiContextRequired, type GetCurrentRouteSchemaKey, type Hooks, type HooksOrHooksArray, type InferAllMainRouteKeys, type InferAllMainRoutes, type InferInitURL, type InferParamsFromRoute, type InferSchemaInput, type InferSchemaOutput, type InstanceContext, type Middlewares, type PluginHooks, type PluginMiddlewares, type PluginSetupContext, type PossibleHTTPError, type PossibleJavaScriptError, type PossibleValidationError, type RefetchOptions, type Register, type RequestContext, type RequestStreamContext, type ResponseContext, type ResponseErrorContext, type ResponseStreamContext, type ResponseTypeType, type ResultModeType, type RetryOptions, type SuccessContext, type URLOptions, callApi, createFetchClient, createFetchClientWithContext };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as getCurrentRouteSchemaKeyAndMainInitURL, I as isArray, L as isFunction, M as handleSchemaValidation, N as HTTPError, R as isString, a as getBody, c as getMethod, d as splitConfig, f as waitFor,
|
|
1
|
+
import { A as getCurrentRouteSchemaKeyAndMainInitURL, I as isArray, L as isFunction, M as handleSchemaValidation, N as HTTPError, R as isString, a as getBody, c as getMethod, d as splitConfig, f as waitFor, g as isHTTPErrorInstance, i as createTimeoutSignal, j as handleConfigValidation, l as getResolvedHeaders, o as getFetchImpl, p as getFullAndNormalizedURL, r as createCombinedSignal, s as getHeaders, t as extraOptionDefaults, u as omitKeys, y as isValidationErrorInstance } from "./constants-C8dGbmdY.js";
|
|
2
2
|
//#region src/result.ts
|
|
3
3
|
const getResponseType = (response, responseParser) => ({
|
|
4
4
|
arrayBuffer: () => response.arrayBuffer(),
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as defineMainSchema, G as objectifyHeaders, J as isJavascriptError, K as isHTTPError, Ot as HTTPError, Q as defineInstanceConfig, X as isValidationErrorInstance, Y as isValidationError, Z as defineBaseConfig, at as toQueryString, et as definePlugin, it as toFormData, kt as ValidationError, nt as defineSchemaConfig, ot as toSearchParams, q as isHTTPErrorInstance, rt as defineSchemaRoutes, tt as defineSchema } from "../../conditional-types-
|
|
1
|
+
import { $ as defineMainSchema, G as objectifyHeaders, J as isJavascriptError, K as isHTTPError, Ot as HTTPError, Q as defineInstanceConfig, X as isValidationErrorInstance, Y as isValidationError, Z as defineBaseConfig, at as toQueryString, et as definePlugin, it as toFormData, kt as ValidationError, nt as defineSchemaConfig, ot as toSearchParams, q as isHTTPErrorInstance, rt as defineSchemaRoutes, tt as defineSchema } from "../../conditional-types-C9cMfJMZ.js";
|
|
2
2
|
export { HTTPError, ValidationError, defineBaseConfig, defineInstanceConfig, defineMainSchema, definePlugin, defineSchema, defineSchemaConfig, defineSchemaRoutes, isHTTPError, isHTTPErrorInstance, isJavascriptError, isValidationError, isValidationErrorInstance, objectifyHeaders, toFormData, toQueryString, toSearchParams };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { C as definePlugin, D as toFormData, E as defineSchemaRoutes, N as HTTPError, O as toQueryString, P as ValidationError, S as defineMainSchema, T as defineSchemaConfig, _ as isJavascriptError, b as defineBaseConfig, g as isHTTPErrorInstance, h as isHTTPError, k as toSearchParams, m as objectifyHeaders, v as isValidationError, w as defineSchema, x as defineInstanceConfig, y as isValidationErrorInstance } from "../../constants-C8dGbmdY.js";
|
|
2
2
|
export { HTTPError, ValidationError, defineBaseConfig, defineInstanceConfig, defineMainSchema, definePlugin, defineSchema, defineSchemaConfig, defineSchemaRoutes, isHTTPError, isHTTPErrorInstance, isJavascriptError, isValidationError, isValidationErrorInstance, objectifyHeaders, toFormData, toQueryString, toSearchParams };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zayne-labs/callapi",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.14.
|
|
4
|
+
"version": "1.14.2",
|
|
5
5
|
"description": "A lightweight wrapper over fetch with quality of life improvements like built-in request cancellation, retries, interceptors and more",
|
|
6
6
|
"author": "Ryan Zayne",
|
|
7
7
|
"license": "MIT",
|
|
@@ -65,15 +65,15 @@
|
|
|
65
65
|
"size-limit": [
|
|
66
66
|
{
|
|
67
67
|
"path": "./src/index.ts",
|
|
68
|
-
"limit": "
|
|
68
|
+
"limit": "8 kb"
|
|
69
69
|
},
|
|
70
70
|
{
|
|
71
71
|
"path": "./src/utils/external/index.ts",
|
|
72
|
-
"limit": "
|
|
72
|
+
"limit": "2 kb"
|
|
73
73
|
},
|
|
74
74
|
{
|
|
75
75
|
"path": "./src/constants/index.ts",
|
|
76
|
-
"limit": "1 kb"
|
|
76
|
+
"limit": "1.5 kb"
|
|
77
77
|
}
|
|
78
78
|
],
|
|
79
79
|
"scripts": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants-DB6Z7gFB.js","names":[],"sources":["../src/types/type-helpers.ts","../src/constants/common.ts","../src/utils/guards.ts","../src/auth.ts","../src/constants/validation.ts","../src/utils/external/error.ts","../src/validation.ts","../src/url.ts","../src/utils/external/body.ts","../src/utils/external/define.ts","../src/utils/external/guards.ts","../src/utils/external/headers.ts","../src/utils/common.ts","../src/constants/defaults.ts"],"sourcesContent":["// == These two types allows for adding arbitrary literal types, while still provided autocomplete for defaults.\n// == Usually intersection with \"{}\" or \"NonNullable<unknown>\" would make it work fine, but the placeholder with never type is added to make the AnyWhatever type appear last in a given union.\nexport type AnyString = string & NonNullable<unknown>;\nexport type AnyNumber = number & NonNullable<unknown>;\n\n// eslint-disable-next-line ts-eslint/no-explicit-any -- Any is fine here\nexport type AnyObject = Record<keyof any, any>;\n\n// eslint-disable-next-line ts-eslint/no-explicit-any -- Any is required here so that one can pass custom function type without type errors\nexport type AnyFunction<TResult = unknown> = (...args: any[]) => TResult;\n\nexport type Prettify<TObject> = NonNullable<unknown> & { [Key in keyof TObject]: TObject[Key] };\n\ntype WriteableLevel = \"deep\" | \"shallow\";\n\n/**\n * Makes all properties in an object type writeable (removes readonly modifiers).\n * Supports both shallow and deep modes, and handles special cases like arrays, tuples, and unions.\n * @template TObject - The object type to make writeable\n * @template TVariant - The level of writeable transformation (\"shallow\" | \"deep\")\n */\n\ntype ArrayOrObject = Record<number | string | symbol, unknown> | unknown[] | readonly unknown[];\n\nexport type Writeable<TObject, TLevel extends WriteableLevel = \"shallow\"> =\n\tTObject extends ArrayOrObject ?\n\t\t{\n\t\t\t-readonly [Key in keyof TObject]: TLevel extends \"deep\" ?\n\t\t\t\tNonNullable<TObject[Key]> extends ArrayOrObject ?\n\t\t\t\t\tWriteable<TObject[Key], \"deep\">\n\t\t\t\t:\tTObject[Key]\n\t\t\t:\tTObject[Key];\n\t\t}\n\t:\tTObject;\n\nexport const defineEnum = <const TValue extends object>(value: TValue) =>\n\tObject.freeze(value) as Readonly<Writeable<TValue>>;\n\nexport type UnionToIntersection<TUnion> =\n\t(TUnion extends unknown ? (param: TUnion) => void : never) extends (param: infer TParam) => void ?\n\t\tTParam\n\t:\tnever;\n\n// == Using this Immediately Indexed Mapped type helper to help show computed type of anything passed to it instead of just the type name\nexport type UnmaskType<TValue> = { value: TValue }[\"value\"];\n\n/**\n * @description Userland implementation of NoInfer intrinsic type, but this one doesn't show up on hover like the intrinsic one\n *\n * Prevents TypeScript from inferring `TGeneric` at this position by creating a circular dependency.\n * The tuple index `[TGeneric extends unknown ? 0 : never]` depends on `TGeneric`, forcing TS to\n * skip this site for inference and use other arguments or defaults instead.\n */\nexport type NoInferUnMasked<TGeneric> = [TGeneric][TGeneric extends unknown ? 0 : never];\n\ntype RemoveSlashImpl<TUrl extends string, TDirection extends \"leading\" | \"trailing\"> =\n\tTDirection extends \"leading\" ?\n\t\tTUrl extends `/${infer TWithoutLeadingSlash}` ?\n\t\t\tTWithoutLeadingSlash\n\t\t:\tTUrl\n\t: TDirection extends \"trailing\" ?\n\t\tTUrl extends `${infer TWithoutTailingSlash}/` ?\n\t\t\tTWithoutTailingSlash\n\t\t:\tTUrl\n\t:\tnever;\n\nexport type RemoveTrailingSlash<TUrl extends string> = RemoveSlashImpl<TUrl, \"trailing\">;\nexport type RemoveLeadingSlash<TUrl extends string> = RemoveSlashImpl<TUrl, \"leading\">;\n\nexport type Awaitable<TValue> = Promise<TValue> | TValue;\n\n// export type MatchExactObjectType<TActualObject extends TExpectedObject, TExpectedObject> = {\n// \t[Key in keyof TActualObject]: Key extends keyof TExpectedObject ? TActualObject[Key] : never;\n// };\n\nexport type Satisfies<TActualType extends TExpectedTypeShape, TExpectedTypeShape> = {\n\t[Key in keyof TActualType]: Key extends keyof TExpectedTypeShape ? TActualType[Key] : never;\n};\n\n// export type Satisfies<TActualObject extends TExpectedObject, TExpectedObject> = {\n// \t[Key in keyof TActualObject & keyof TExpectedObject]: TActualObject[Key];\n// };\n\nexport type DistributiveOmit<TObject, TKeysToOmit extends keyof TObject> =\n\tTObject extends unknown ? Omit<TObject, TKeysToOmit> : never;\n\nexport type DistributivePick<TObject, TKeysToPick extends keyof TObject> =\n\tTObject extends unknown ? Pick<TObject, TKeysToPick> : never;\n\ntype ErrorMessages<TType extends number | string | symbol = never> = Partial<\n\tRecord<\"$all\" | number | symbol | (AnyString | TType), unknown>\n> | null;\n\n/**\n * Type utility that takes two types and allows only the properties of the first type. The properties of the second will be disallowed (typed as `never` by default or a custom message).\n *\n * @template TFirstType The first type. Properties of this type will be required.\n * @template TSecondType The second type. Properties of this type will be disallowed.\n * @template TErrorMessages An object of custom messages to display on the properties of the second type that are disallowed.\n */\ntype AllowOnlyFirst<TFirstType, TSecondType, TErrorMessages extends ErrorMessages = never> = Prettify<\n\tTFirstType & {\n\t\t[Key in keyof Omit<TSecondType, keyof TFirstType>]?: Key extends keyof TErrorMessages ?\n\t\t\tTErrorMessages[Key]\n\t\t: \"$all\" extends keyof TErrorMessages ? TErrorMessages[\"$all\"]\n\t\t: TErrorMessages extends null ? TErrorMessages\n\t\t: never;\n\t}\n>;\n\n/**\n * Merges all types in an array of types into one type.\n *\n * @template TArrayOfTypes Array of types to merge\n * @template TAccumulator Accumulator for the resulting merged type\n */\ntype MergeTypes<TArrayOfTypes extends unknown[], TAccumulator = NonNullable<unknown>> =\n\tTArrayOfTypes extends [infer TFirstType, ...infer TRestOfTypes] ?\n\t\tMergeTypes<\n\t\t\tTRestOfTypes,\n\t\t\t{ [Key in keyof TAccumulator | keyof TFirstType]: (TAccumulator & TFirstType)[Key] }\n\t\t>\n\t:\tTAccumulator;\n\n/**\n * Type utility that extracts discriminated properties from a union of types.\n * Takes an array of types and returns a union of types where each type has unique properties.\n *\n * @template TArrayOfTypes Array of types to process\n * @template TErrorMessages An object of custom messages to display on the properties that are disallowed.\n * @template TAccumulator Accumulator for the resulting union\n * @template TMergedProperties Merged properties from all types\n */\n\nexport type UnionDiscriminator<\n\tTArrayOfTypes extends unknown[],\n\tTErrorMessages extends ErrorMessages<keyof MergeTypes<TArrayOfTypes>> = never,\n\tTAccumulator = never,\n\tTMergedProperties = MergeTypes<TArrayOfTypes>,\n> =\n\tTArrayOfTypes extends [infer TFirstType, ...infer TRestOfTypes] ?\n\t\tUnionDiscriminator<\n\t\t\tTRestOfTypes,\n\t\t\tTErrorMessages,\n\t\t\t// eslint-disable-next-line perfectionist/sort-union-types -- Let TAccumulator be first\n\t\t\tTAccumulator | AllowOnlyFirst<TFirstType, TMergedProperties, TErrorMessages>,\n\t\t\tTMergedProperties\n\t\t>\n\t:\tTAccumulator;\n\nexport type CommonRequestHeaders =\n\t| \"Access-Control-Allow-Credentials\"\n\t| \"Access-Control-Allow-Headers\"\n\t| \"Access-Control-Allow-Methods\"\n\t| \"Access-Control-Allow-Origin\"\n\t| \"Access-Control-Expose-Headers\"\n\t| \"Access-Control-Max-Age\"\n\t| \"Age\"\n\t| \"Allow\"\n\t| \"Cache-Control\"\n\t| \"Clear-Site-Data\"\n\t| \"Content-Disposition\"\n\t| \"Content-Encoding\"\n\t| \"Content-Language\"\n\t| \"Content-Length\"\n\t| \"Content-Location\"\n\t| \"Content-Range\"\n\t| \"Content-Security-Policy-Report-Only\"\n\t| \"Content-Security-Policy\"\n\t| \"Cookie\"\n\t| \"Cross-Origin-Embedder-Policy\"\n\t| \"Cross-Origin-Opener-Policy\"\n\t| \"Cross-Origin-Resource-Policy\"\n\t| \"Date\"\n\t| \"ETag\"\n\t| \"Expires\"\n\t| \"Last-Modified\"\n\t| \"Location\"\n\t| \"Permissions-Policy\"\n\t| \"Pragma\"\n\t| \"Retry-After\"\n\t| \"Save-Data\"\n\t| \"Sec-CH-Prefers-Color-Scheme\"\n\t| \"Sec-CH-Prefers-Reduced-Motion\"\n\t| \"Sec-CH-UA-Arch\"\n\t| \"Sec-CH-UA-Bitness\"\n\t| \"Sec-CH-UA-Form-Factor\"\n\t| \"Sec-CH-UA-Full-Version-List\"\n\t| \"Sec-CH-UA-Full-Version\"\n\t| \"Sec-CH-UA-Mobile\"\n\t| \"Sec-CH-UA-Model\"\n\t| \"Sec-CH-UA-Platform-Version\"\n\t| \"Sec-CH-UA-Platform\"\n\t| \"Sec-CH-UA-WoW64\"\n\t| \"Sec-CH-UA\"\n\t| \"Sec-Fetch-Dest\"\n\t| \"Sec-Fetch-Mode\"\n\t| \"Sec-Fetch-Site\"\n\t| \"Sec-Fetch-User\"\n\t| \"Sec-GPC\"\n\t| \"Server-Timing\"\n\t| \"Server\"\n\t| \"Service-Worker-Navigation-Preload\"\n\t| \"Set-Cookie\"\n\t| \"Strict-Transport-Security\"\n\t| \"Timing-Allow-Origin\"\n\t| \"Trailer\"\n\t| \"Transfer-Encoding\"\n\t| \"Upgrade\"\n\t| \"Vary\"\n\t| \"Warning\"\n\t| \"WWW-Authenticate\"\n\t| \"X-Content-Type-Options\"\n\t| \"X-DNS-Prefetch-Control\"\n\t| \"X-Frame-Options\"\n\t| \"X-Permitted-Cross-Domain-Policies\"\n\t| \"X-Powered-By\"\n\t| \"X-Robots-Tag\"\n\t| \"X-XSS-Protection\"\n\t| AnyString;\n\nexport type CommonAuthorizationHeaders = `${\"Basic\" | \"Bearer\" | \"Token\"} ${string}`;\n\nexport type CommonContentTypes =\n\t| \"application/epub+zip\"\n\t| \"application/gzip\"\n\t| \"application/json\"\n\t| \"application/ld+json\"\n\t| \"application/octet-stream\"\n\t| \"application/ogg\"\n\t| \"application/pdf\"\n\t| \"application/rtf\"\n\t| \"application/vnd.ms-fontobject\"\n\t| \"application/wasm\"\n\t| \"application/xhtml+xml\"\n\t| \"application/xml\"\n\t| \"application/zip\"\n\t| \"audio/aac\"\n\t| \"audio/mpeg\"\n\t| \"audio/ogg\"\n\t| \"audio/opus\"\n\t| \"audio/webm\"\n\t| \"audio/x-midi\"\n\t| \"font/otf\"\n\t| \"font/ttf\"\n\t| \"font/woff\"\n\t| \"font/woff2\"\n\t| \"image/avif\"\n\t| \"image/bmp\"\n\t| \"image/gif\"\n\t| \"image/jpeg\"\n\t| \"image/png\"\n\t| \"image/svg+xml\"\n\t| \"image/tiff\"\n\t| \"image/webp\"\n\t| \"image/x-icon\"\n\t| \"model/gltf-binary\"\n\t| \"model/gltf+json\"\n\t| \"text/calendar\"\n\t| \"text/css\"\n\t| \"text/csv\"\n\t| \"text/html\"\n\t| \"text/javascript\"\n\t| \"text/plain\"\n\t| \"video/3gpp\"\n\t| \"video/3gpp2\"\n\t| \"video/av1\"\n\t| \"video/mp2t\"\n\t| \"video/mp4\"\n\t| \"video/mpeg\"\n\t| \"video/ogg\"\n\t| \"video/webm\"\n\t| \"video/x-msvideo\"\n\t| AnyString;\n","import type { ModifiedRequestInit } from \"../types/options-types\";\nimport { defineEnum } from \"../types/type-helpers\";\n\nexport const fetchSpecificKeys = defineEnum([\n\t\"body\",\n\t\"integrity\",\n\t\"duplex\",\n\t\"method\",\n\t\"headers\",\n\t\"signal\",\n\t\"cache\",\n\t\"redirect\",\n\t\"window\",\n\t\"credentials\",\n\t\"keepalive\",\n\t\"referrer\",\n\t\"priority\",\n\t\"mode\",\n\t\"referrerPolicy\",\n\t\"extraFetchOptions\",\n] satisfies Array<keyof ModifiedRequestInit> as Array<keyof ModifiedRequestInit>);\n","import type { AnyFunction } from \"../types/type-helpers\";\n\nexport const isArray = <TArrayItem>(value: unknown): value is TArrayItem[] => Array.isArray(value);\n\nexport const isBoolean = (value: unknown): value is boolean => typeof value === \"boolean\";\n\nexport const isBlob = (value: unknown): value is Blob => value instanceof Blob;\n\nexport const isObject = <TObject extends object>(value: unknown): value is TObject => {\n\treturn typeof value === \"object\" && value !== null;\n};\n\nconst hasObjectPrototype = (value: unknown) => {\n\treturn Object.prototype.toString.call(value) === \"[object Object]\";\n};\n\n/**\n * @description Copied from TanStack Query's isPlainObject\n * @see https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L321\n */\nexport const isPlainObject = <TPlainObject extends Record<string, unknown>>(\n\tvalue: unknown\n): value is TPlainObject => {\n\tif (!hasObjectPrototype(value)) {\n\t\treturn false;\n\t}\n\n\t// If has no constructor\n\tconst constructor = (value as object | undefined)?.constructor;\n\tif (constructor === undefined) {\n\t\treturn true;\n\t}\n\n\t// If has modified prototype\n\tconst prototype = constructor.prototype as object;\n\tif (!hasObjectPrototype(prototype)) {\n\t\treturn false;\n\t}\n\n\t// If constructor does not have an Object-specific method\n\tif (!Object.hasOwn(prototype, \"isPrototypeOf\")) {\n\t\treturn false;\n\t}\n\n\t// Handles Objects created by Object.create(<arbitrary prototype>)\n\tif (Object.getPrototypeOf(value) !== Object.prototype) {\n\t\treturn false;\n\t}\n\n\t// It's probably a plain object at this point\n\treturn true;\n};\n\nexport const isValidJsonString = (value: unknown): value is string => {\n\tif (!isString(value)) {\n\t\treturn false;\n\t}\n\n\ttry {\n\t\tJSON.parse(value);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n};\n\nexport const isSerializableObject = (value: unknown) => {\n\treturn (\n\t\tisPlainObject(value)\n\t\t|| isArray(value)\n\t\t|| typeof (value as { toJSON: unknown } | undefined)?.toJSON === \"function\"\n\t);\n};\n\nexport const isFunction = <TFunction extends AnyFunction>(value: unknown): value is TFunction => {\n\treturn typeof value === \"function\";\n};\n\nexport const isQueryString = (value: unknown): value is string => isString(value) && value.includes(\"=\");\n\nexport const isString = (value: unknown) => typeof value === \"string\";\n\nexport const isPromise = (value: unknown) => value instanceof Promise;\n\n// https://github.com/unjs/ofetch/blob/main/src/utils.ts\nexport const isJSONSerializable = (value: unknown) => {\n\tif (value === undefined) {\n\t\treturn false;\n\t}\n\tconst t = typeof value;\n\t// eslint-disable-next-line ts-eslint/no-unnecessary-condition -- No time to make this more type-safe\n\tif (t === \"string\" || t === \"number\" || t === \"boolean\" || t === null) {\n\t\treturn true;\n\t}\n\tif (t !== \"object\") {\n\t\treturn false;\n\t}\n\tif (isArray(value)) {\n\t\treturn true;\n\t}\n\tif ((value as Buffer | null)?.buffer) {\n\t\treturn false;\n\t}\n\n\treturn (\n\t\tvalue?.constructor.name === \"Object\"\n\t\t|| typeof (value as { toJSON: () => unknown } | null)?.toJSON === \"function\"\n\t);\n};\n","/* eslint-disable perfectionist/sort-object-types -- Avoid Sorting for now */\n\nimport type { CallApiExtraOptions } from \"./types/options-types\";\nimport type { Awaitable } from \"./types/type-helpers\";\nimport { isFunction, isObject, isPromise } from \"./utils/guards\";\n\ntype PossibleAuthValue = Awaitable<string | null | undefined>;\n\ntype PossibleAuthValueOrGetter = PossibleAuthValue | (() => PossibleAuthValue);\n\n// export type BearerOrTokenAuth =\n// \t| {\n// \t\t\ttype?: \"Bearer\" | undefined;\n// \t\t\tbearer?: PossibleAuthValueOrGetter;\n// \t\t\ttoken?: never;\n// \t }\n// \t| {\n// \t\t\ttype?: \"Token\";\n// \t\t\tbearer?: never;\n// \t\t\ttoken?: PossibleAuthValueOrGetter;\n// \t };\n\nexport type BearerAuth = {\n\ttype: \"Bearer\";\n\tvalue: PossibleAuthValueOrGetter;\n};\n\nexport type TokenAuth = {\n\ttype: \"Token\";\n\tvalue: PossibleAuthValueOrGetter;\n};\n\nexport type BasicAuth = {\n\ttype: \"Basic\";\n\tusername: PossibleAuthValueOrGetter;\n\tpassword: PossibleAuthValueOrGetter;\n};\n\n/**\n * Custom auth\n *\n * @param prefix - prefix of the header\n * @param authValue - value of the header\n *\n * @example\n * ```ts\n * {\n * type: \"Custom\",\n * prefix: \"Token\",\n * authValue: \"token\"\n * }\n * ```\n */\nexport type CustomAuth = {\n\ttype: \"Custom\";\n\tprefix: PossibleAuthValueOrGetter;\n\tvalue: PossibleAuthValueOrGetter;\n};\n\n// eslint-disable-next-line perfectionist/sort-union-types -- Let the first one be first\nexport type AuthOption = PossibleAuthValueOrGetter | BearerAuth | TokenAuth | BasicAuth | CustomAuth;\n\nconst resolveAuthValue = (value: PossibleAuthValueOrGetter) => (isFunction(value) ? value() : value);\n\ntype AuthHeaderObject = { Authorization: string };\n\nexport const getAuthHeader = async (\n\tauth: CallApiExtraOptions[\"auth\"]\n): Promise<AuthHeaderObject | undefined> => {\n\tif (auth === undefined) return;\n\n\tif (isPromise(auth) || isFunction(auth) || !isObject(auth)) {\n\t\tconst authValue = await resolveAuthValue(auth);\n\n\t\tif (authValue === undefined) return;\n\n\t\treturn {\n\t\t\tAuthorization: `Bearer ${authValue}`,\n\t\t};\n\t}\n\n\tswitch (auth.type) {\n\t\tcase \"Basic\": {\n\t\t\tconst [username, password] = await Promise.all([\n\t\t\t\tresolveAuthValue(auth.username),\n\t\t\t\tresolveAuthValue(auth.password),\n\t\t\t]);\n\n\t\t\tif (username === undefined || password === undefined) return;\n\n\t\t\treturn {\n\t\t\t\tAuthorization: `Basic ${globalThis.btoa(`${username}:${password}`)}`,\n\t\t\t};\n\t\t}\n\t\tcase \"Bearer\": {\n\t\t\tconst value = await resolveAuthValue(auth.value);\n\n\t\t\tif (value === undefined) return;\n\n\t\t\treturn {\n\t\t\t\tAuthorization: `Bearer ${value}`,\n\t\t\t};\n\t\t}\n\t\tcase \"Custom\": {\n\t\t\tconst [prefix, value] = await Promise.all([\n\t\t\t\tresolveAuthValue(auth.prefix),\n\t\t\t\tresolveAuthValue(auth.value),\n\t\t\t]);\n\n\t\t\tif (value === undefined) return;\n\n\t\t\treturn {\n\t\t\t\tAuthorization: `${prefix} ${value}`,\n\t\t\t};\n\t\t}\n\n\t\tcase \"Token\": {\n\t\t\tconst value = await resolveAuthValue(auth.value);\n\n\t\t\tif (value === undefined) return;\n\n\t\t\treturn {\n\t\t\t\tAuthorization: `Token ${value}`,\n\t\t\t};\n\t\t}\n\n\t\tdefault: {\n\t\t\tauth satisfies never;\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// default: {\n\t\t// \tconst [bearer, token] = await Promise.all([\n\t\t// \t\tresolveAuthValue(auth.bearer),\n\t\t// \t\tresolveAuthValue(auth.token),\n\t\t// \t]);\n\n\t\t// \tif (bearer !== undefined) {\n\t\t// \t\treturn { Authorization: `Bearer ${bearer}` };\n\t\t// \t}\n\n\t\t// \tif (token === undefined) return;\n\n\t\t// \treturn { Authorization: `Token ${token}` };\n\t\t// }\n\t}\n};\n","export const fallBackRouteSchemaKey = \"@default\";\n\nexport type FallBackRouteSchemaKey = typeof fallBackRouteSchemaKey;\n","import { extraOptionDefaults } from \"../../constants/defaults\";\nimport type { CallApiExtraOptions } from \"../../types/options-types\";\nimport type { StandardSchemaV1 } from \"../../types/standard-schema\";\nimport type { CallApiSchema, CallApiSchemaConfig } from \"../../validation\";\nimport { isObject, isString } from \"../guards\";\n\ntype HTTPErrorDetails<TErrorData> = Pick<CallApiExtraOptions, \"defaultHTTPErrorMessage\"> & {\n\terrorData: TErrorData;\n\tresponse: Response;\n};\n\nconst httpErrorSymbol = Symbol(\"HTTPError\");\n\nexport class HTTPError<TErrorData = Record<string, unknown>> extends Error {\n\terrorData: HTTPErrorDetails<TErrorData>[\"errorData\"];\n\n\treadonly httpErrorSymbol = httpErrorSymbol;\n\n\toverride name = \"HTTPError\" as const;\n\n\tresponse: HTTPErrorDetails<TErrorData>[\"response\"];\n\n\tconstructor(errorDetails: HTTPErrorDetails<TErrorData>, errorOptions?: ErrorOptions) {\n\t\tconst { defaultHTTPErrorMessage, errorData, response } = errorDetails;\n\n\t\tconst resolvedDefaultHTTPErrorMessage =\n\t\t\tisString(defaultHTTPErrorMessage) ? defaultHTTPErrorMessage : (\n\t\t\t\tdefaultHTTPErrorMessage?.({ errorData, response })\n\t\t\t);\n\n\t\tconst selectedDefaultErrorMessage =\n\t\t\tresolvedDefaultHTTPErrorMessage\n\t\t\t?? (response.statusText || extraOptionDefaults.defaultHTTPErrorMessage);\n\n\t\tconst message =\n\t\t\t(errorData as { message?: string } | undefined)?.message ?? selectedDefaultErrorMessage;\n\n\t\tsuper(message, errorOptions);\n\n\t\tthis.errorData = errorData;\n\t\tthis.response = response;\n\t}\n\n\t/**\n\t * @description Checks if the given error is an instance of HTTPError\n\t * @param error - The error to check\n\t * @returns true if the error is an instance of HTTPError, false otherwise\n\t */\n\tstatic override isError<TErrorData>(error: unknown): error is HTTPError<TErrorData> {\n\t\tif (!isObject<HTTPError>(error)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (error instanceof HTTPError) {\n\t\t\treturn true;\n\t\t}\n\n\t\tconst actualError = error as HTTPError;\n\n\t\treturn (\n\t\t\tactualError.httpErrorSymbol === httpErrorSymbol\n\t\t\t// eslint-disable-next-line ts-eslint/no-unnecessary-condition -- Allow\n\t\t\t&& actualError.name === \"HTTPError\"\n\t\t);\n\t}\n}\n\nconst prettifyPath = (path: ValidationError[\"errorData\"][number][\"path\"]) => {\n\tif (!path || path.length === 0) {\n\t\treturn \"\";\n\t}\n\n\tconst pathString = path.map((segment) => (isObject(segment) ? segment.key : segment)).join(\".\");\n\n\treturn ` → at ${pathString}`;\n};\n\nconst prettifyValidationIssues = (issues: ValidationError[\"errorData\"]) => {\n\tconst issuesString = issues.map((issue) => `✖ ${issue.message}${prettifyPath(issue.path)}`).join(\" | \");\n\n\treturn issuesString;\n};\n\ntype SafeExtract<TUnion, TKey extends TUnion> = Extract<TUnion, TKey>;\n\ntype ValidationErrorDetails = {\n\t/**\n\t * The cause of the validation error.\n\t *\n\t * 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.\n\t */\n\tissueCause:\n\t\t| \"toFormData\"\n\t\t| \"toQueryString\"\n\t\t| \"unknown\"\n\t\t| `schemaConfig-(${SafeExtract<keyof CallApiSchemaConfig, \"strict\">})`\n\t\t| keyof CallApiSchema;\n\n\t/**\n\t * The issues that caused the validation error.\n\t */\n\tissues: readonly StandardSchemaV1.Issue[];\n\n\t/**\n\t * The response from server, if any.\n\t */\n\tresponse: Response | null;\n};\n\nconst validationErrorSymbol = Symbol(\"ValidationErrorSymbol\");\n\nexport class ValidationError extends Error {\n\terrorData: ValidationErrorDetails[\"issues\"];\n\n\tissueCause: ValidationErrorDetails[\"issueCause\"];\n\n\toverride name = \"ValidationError\" as const;\n\n\tresponse: ValidationErrorDetails[\"response\"];\n\n\treadonly validationErrorSymbol = validationErrorSymbol;\n\n\tconstructor(details: ValidationErrorDetails, errorOptions?: ErrorOptions) {\n\t\tconst { issueCause, issues, response } = details;\n\n\t\tconst prettyMessage = prettifyValidationIssues(issues);\n\n\t\tconst message = `(${issueCause.toUpperCase()}) - ${prettyMessage}`;\n\n\t\tsuper(message, errorOptions);\n\n\t\tthis.errorData = issues;\n\t\tthis.response = response;\n\t\tthis.issueCause = issueCause;\n\t}\n\n\t/**\n\t * @description Checks if the given error is an instance of ValidationError\n\t * @param error - The error to check\n\t * @returns true if the error is an instance of ValidationError, false otherwise\n\t */\n\tstatic override isError(error: unknown): error is ValidationError {\n\t\tif (!isObject<ValidationError>(error)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (error instanceof ValidationError) {\n\t\t\treturn true;\n\t\t}\n\n\t\tconst actualError = error as ValidationError;\n\n\t\treturn (\n\t\t\tactualError.validationErrorSymbol === validationErrorSymbol\n\t\t\t// eslint-disable-next-line ts-eslint/no-unnecessary-condition -- Allow\n\t\t\t&& actualError.name === \"ValidationError\"\n\t\t);\n\t}\n}\n","import type { AuthOption } from \"./auth\";\nimport { fallBackRouteSchemaKey, type FallBackRouteSchemaKey } from \"./constants/validation\";\nimport type { Body, HeadersOption, MethodUnion } from \"./types/conditional-types\";\nimport type {\n\tBaseCallApiExtraOptions,\n\tCallApiExtraOptions,\n\tCallApiRequestOptions,\n\tGlobalMeta,\n} from \"./types/options-types\";\nimport type { StandardSchemaV1 } from \"./types/standard-schema\";\nimport {\n\tdefineEnum,\n\ttype AnyFunction,\n\ttype AnyString,\n\ttype Awaitable,\n\ttype UnionDiscriminator,\n\ttype UnionToIntersection,\n} from \"./types/type-helpers\";\nimport {\n\tatSymbol,\n\textractMethodFromURL,\n\tnormalizeURL,\n\ttype AtSymbol,\n\ttype Params,\n\ttype Query,\n} from \"./url\";\nimport { ValidationError } from \"./utils/external/error\";\nimport { isArray, isFunction, isObject } from \"./utils/guards\";\n\ntype ResultVariant = \"infer-input\" | \"infer-output\";\n\nexport type InferSchemaResult<TSchema, TFallbackResult, TResultVariant extends ResultVariant> =\n\t// == Checking for undefined first and returning fallback to avoid type errors when passing the config around (weird tbh)\n\tundefined extends TSchema ? TFallbackResult\n\t: TSchema extends StandardSchemaV1 ?\n\t\tTResultVariant extends \"infer-input\" ?\n\t\t\tStandardSchemaV1.InferInput<TSchema>\n\t\t:\tStandardSchemaV1.InferOutput<TSchema>\n\t: TSchema extends AnyFunction<infer TResult> ? Awaited<TResult>\n\t: TFallbackResult;\n\nexport type InferSchemaOutput<TSchema, TFallbackResult = unknown> = InferSchemaResult<\n\tTSchema,\n\tTFallbackResult,\n\t\"infer-output\"\n>;\n\nexport type InferSchemaInput<TSchema, TFallbackResult = unknown> = InferSchemaResult<\n\tTSchema,\n\tTFallbackResult,\n\t\"infer-input\"\n>;\n\nconst handleValidatorFunction = <TInput>(\n\tvalidator: AnyFunction,\n\tinputData: TInput\n): Promise<StandardSchemaV1.Result<TInput>> => {\n\tconst result = new Promise((resolve) => resolve(validator(inputData as never)))\n\t\t.then((value) => ({ issues: undefined, value: value as never }))\n\t\t.catch((error) => ({ issues: (isArray(error) ? error : [error]) as never, value: undefined }));\n\n\treturn result;\n};\n\nexport const getValidatedValue = <\n\tTSchema extends AnyFunction | StandardSchemaV1,\n\tTVariant extends \"async\" | \"sync\",\n>(\n\tinputValue: InferSchemaOutput<TSchema>,\n\tschema?: TSchema,\n\t_ignoredOptions?: { variant: TVariant }\n): TVariant extends \"async\" ? Promise<StandardSchemaV1.Result<typeof inputValue>>\n:\tStandardSchemaV1.Result<typeof inputValue> => {\n\tif (!schema) {\n\t\treturn { issues: undefined, value: inputValue } as never;\n\t}\n\n\tconst result =\n\t\tisFunction(schema) ?\n\t\t\thandleValidatorFunction(schema, inputValue)\n\t\t:\tschema[\"~standard\"].validate(inputValue);\n\n\treturn result as never;\n};\n\nconst callApiSchemaParser = async <\n\tTFullSchema extends CallApiSchema,\n\tTSchemaName extends keyof CallApiSchema,\n\tTSchema extends NonNullable<TFullSchema[TSchemaName]>,\n>(\n\tfullSchema: TFullSchema | undefined,\n\tschemaName: TSchemaName,\n\toptions: { inputValue: InferSchemaInput<TSchema>; response?: Response | null }\n): Promise<InferSchemaOutput<TSchema>> => {\n\tconst { inputValue, response } = options;\n\n\tconst schema = fullSchema?.[schemaName];\n\n\tconst result = await getValidatedValue(inputValue, schema);\n\n\tif (result.issues) {\n\t\tthrow new ValidationError({\n\t\t\tissueCause: schemaName,\n\t\t\tissues: result.issues,\n\t\t\tresponse: response ?? null,\n\t\t});\n\t}\n\n\treturn result.value as never;\n};\n\ntype BooleanObject = {\n\t[Key in keyof CallApiSchema]: boolean;\n};\n\nexport interface CallApiSchemaConfig {\n\t/**\n\t * The base url of the schema. By default it's the baseURL of the callApi instance.\n\t */\n\tbaseURL?: \"\" | AnyString;\n\n\t/**\n\t * Disables runtime validation for the schema.\n\t */\n\tdisableRuntimeValidation?: boolean | BooleanObject;\n\n\t/**\n\t * If `true`, the original input value will be used instead of the transformed/validated output.\n\t *\n\t * When true, the original input is returned unchanged after validation, ignoring any schema-level\n\t * transformations such as type coercion, default values, or field mapping. Only the validation\n\t * step is executed; the resulting value is discarded in favor of the raw input.\n\t */\n\tdisableRuntimeValidationTransform?: boolean | BooleanObject;\n\n\t/**\n\t * Optional url prefix that will be substituted for the `baseURL` of the schemaConfig at runtime.\n\t *\n\t * Enables a short, stable prefix for routes while keeping the full `baseURL` centralized in config.\n\t * Keeps route definitions concise and shields them from changes to the underlying base URL.\n\t */\n\tprefix?: \"\" | AnyString;\n\n\t/**\n\t * Controls the strictness of API route validation.\n\t *\n\t * When true:\n\t * - Only routes explicitly defined in the schema will be considered valid to typescript and the runtime.\n\t * - Attempting to call routes not defined in the schema will result in both type errors and runtime validation errors.\n\t * - Useful for ensuring API calls conform exactly to your schema definition\n\t *\n\t * When false or undefined (default):\n\t * - All routes will be allowed, whether they are defined in the schema or not\n\t */\n\tstrict?: boolean;\n}\n\nexport type CallApiSchemaType<TInput> =\n\tStandardSchemaV1<TInput | undefined> | ((value: TInput) => Awaitable<TInput | undefined>);\n\nexport interface CallApiSchema {\n\tauth?: CallApiSchemaType<AuthOption>;\n\n\t/**\n\t * The schema to use for validating the request body.\n\t */\n\tbody?: CallApiSchemaType<Body>;\n\n\t/**\n\t * The schema to use for validating the response data.\n\t */\n\tdata?: CallApiSchemaType<unknown>;\n\n\t/**\n\t * The schema to use for validating the response error data.\n\t */\n\terrorData?: CallApiSchemaType<unknown>;\n\n\t/**\n\t * The schema to use for validating the request headers.\n\t */\n\theaders?: CallApiSchemaType<HeadersOption>;\n\n\t/**\n\t * The schema to use for validating the meta option.\n\t */\n\tmeta?: CallApiSchemaType<GlobalMeta>;\n\n\t/**\n\t * The schema to use for validating the request method.\n\t */\n\tmethod?: CallApiSchemaType<MethodUnion>;\n\n\t/**\n\t * The schema to use for validating the request url parameters.\n\t */\n\tparams?: CallApiSchemaType<Params>;\n\n\t/**\n\t * The schema to use for validating the request url queries.\n\t */\n\tquery?: CallApiSchemaType<Query>;\n}\n\nexport const routeKeyMethods = defineEnum([\"delete\", \"get\", \"patch\", \"post\", \"put\"]);\n\nexport type RouteKeyMethods = (typeof routeKeyMethods)[number];\n\nexport type RouteKeyMethodsURLUnion = `${AtSymbol}${RouteKeyMethods}/`;\n\nexport type BaseSchemaRouteKeyPrefixes = FallBackRouteSchemaKey | RouteKeyMethodsURLUnion;\n\nexport type BaseCallApiSchemaRoutes = Partial<\n\tRecord<AnyString | BaseSchemaRouteKeyPrefixes, CallApiSchema>\n>;\n\nexport type BaseCallApiSchemaAndConfig = {\n\tconfig?: CallApiSchemaConfig;\n\troutes: BaseCallApiSchemaRoutes;\n};\n\ntype ValidationOptions<\n\tTSchema extends CallApiSchema[keyof CallApiSchema] = CallApiSchema[keyof CallApiSchema],\n> = {\n\tinputValue: InferSchemaInput<TSchema>;\n\tresponse?: Response | null;\n\tresultMode: CallApiExtraOptions[\"resultMode\"];\n\tschemaConfig: CallApiSchemaConfig | undefined;\n};\n\nexport const handleSchemaValidation = async <\n\tTFullSchema extends CallApiSchema,\n\tTSchemaName extends keyof CallApiSchema,\n\tTSchema extends NonNullable<TFullSchema[TSchemaName]>,\n>(\n\tfullSchema: TFullSchema | undefined,\n\tschemaName: TSchemaName,\n\tvalidationOptions: ValidationOptions<TSchema>\n): Promise<InferSchemaOutput<TSchema>> => {\n\tconst { inputValue, response, resultMode, schemaConfig } = validationOptions;\n\n\t// == If resultMode is set to `fetchApi`, return the input value as is (which is going to be `null` in this)\n\tif (resultMode === \"fetchApi\" && (schemaName === \"data\" || schemaName === \"errorData\")) {\n\t\treturn inputValue;\n\t}\n\n\tconst disableRuntimeValidationBooleanObject =\n\t\tisObject(schemaConfig?.disableRuntimeValidation) ? schemaConfig.disableRuntimeValidation : {};\n\n\tconst shouldDisableRuntimeValidation =\n\t\tschemaConfig?.disableRuntimeValidation === true\n\t\t|| disableRuntimeValidationBooleanObject[schemaName] === true;\n\n\tif (shouldDisableRuntimeValidation) {\n\t\treturn inputValue;\n\t}\n\n\tconst validResult = await callApiSchemaParser(fullSchema, schemaName, { inputValue, response });\n\n\tconst disableResultApplicationBooleanObject =\n\t\tisObject(schemaConfig?.disableRuntimeValidationTransform) ?\n\t\t\tschemaConfig.disableRuntimeValidationTransform\n\t\t:\t{};\n\n\tconst shouldDisableResultApplication =\n\t\tschemaConfig?.disableRuntimeValidationTransform === true\n\t\t|| disableResultApplicationBooleanObject[schemaName] === true;\n\n\tif (shouldDisableResultApplication) {\n\t\treturn inputValue;\n\t}\n\n\treturn validResult;\n};\n\ntype LastOf<TValue> =\n\tUnionToIntersection<TValue extends unknown ? () => TValue : never> extends () => infer R ? R : never;\n\ntype Push<TArray extends unknown[], TArrayItem> = [...TArray, TArrayItem];\n\ntype UnionToTupleImpl<\n\tTUnion,\n\tTComputedLastUnion = LastOf<TUnion>,\n\tTComputedIsUnionEqualToNever = [TUnion] extends [never] ? true : false,\n> =\n\ttrue extends TComputedIsUnionEqualToNever ? []\n\t:\tPush<UnionToTupleImpl<Exclude<TUnion, TComputedLastUnion>>, TComputedLastUnion>;\n\nexport type UnionToTuple<TUnion, TArray extends TUnion[] = []> =\n\tUnionToTupleImpl<TUnion>[\"length\"] extends TArray[\"length\"] ? [...TArray]\n\t:\tUnionToTuple<TUnion, [TUnion, ...TArray]>;\n\ntype ExtraOptionsValidationOptions = {\n\toptions: CallApiExtraOptions;\n};\n\nconst extraOptionsToBeValidated = [\"meta\", \"params\", \"query\", \"auth\"] satisfies UnionToTuple<\n\tExtract<keyof CallApiSchema, keyof CallApiExtraOptions>\n>;\n\ntype RequestOptionsValidationOptions = {\n\trequest: CallApiRequestOptions;\n};\n\nconst requestOptionsToBeValidated = [\"body\", \"headers\", \"method\"] satisfies UnionToTuple<\n\tExtract<keyof CallApiSchema, keyof CallApiRequestOptions>\n>;\n\ntype OptionValidationOptions = UnionDiscriminator<\n\t[ExtraOptionsValidationOptions, RequestOptionsValidationOptions]\n> & {\n\tschema: CallApiSchema | undefined;\n\tschemaConfig: CallApiSchemaConfig | undefined;\n};\n\nconst handleOptionsValidation = async <TValidationOptions extends OptionValidationOptions>(\n\tvalidationOptions: TValidationOptions\n): Promise<\n\tundefined extends TValidationOptions[\"options\"] ?\n\t\tPick<CallApiRequestOptions, (typeof requestOptionsToBeValidated)[number]>\n\t:\tPick<CallApiExtraOptions, (typeof extraOptionsToBeValidated)[number]>\n> => {\n\tconst { options, request, schema, schemaConfig } = validationOptions;\n\n\tconst resolvedOptionsToBeValidated = options ? extraOptionsToBeValidated : requestOptionsToBeValidated;\n\n\tconst resolvedOptions = options ?? request;\n\n\tconst validationResultArray = await Promise.all(\n\t\tresolvedOptionsToBeValidated.map((schemaName) =>\n\t\t\thandleSchemaValidation(schema, schemaName, {\n\t\t\t\tinputValue: resolvedOptions[schemaName as keyof typeof resolvedOptions],\n\t\t\t\tresultMode: options?.resultMode,\n\t\t\t\tschemaConfig,\n\t\t\t})\n\t\t)\n\t);\n\n\tconst validatedResultObject: Record<string, unknown> = {};\n\n\tfor (const [index, schemaName] of resolvedOptionsToBeValidated.entries()) {\n\t\tconst validationResult = validationResultArray[index];\n\n\t\tif (validationResult === undefined) continue;\n\n\t\tvalidatedResultObject[schemaName] = validationResult;\n\t}\n\n\treturn validatedResultObject;\n};\n\nexport const handleConfigValidation = async (\n\tvalidationOptions: ExtraOptionsValidationOptions\n\t\t& GetResolvedSchemaContext\n\t\t& RequestOptionsValidationOptions\n) => {\n\tconst { baseExtraOptions, currentRouteSchemaKey, extraOptions, options, request } = validationOptions;\n\n\tconst { currentRouteSchema, resolvedSchema } = getResolvedSchema({\n\t\tbaseExtraOptions,\n\t\tcurrentRouteSchemaKey,\n\t\textraOptions,\n\t});\n\n\tconst resolvedSchemaConfig = getResolvedSchemaConfig({ baseExtraOptions, extraOptions });\n\n\tif (resolvedSchemaConfig?.strict === true && !currentRouteSchema) {\n\t\tthrow new ValidationError({\n\t\t\tissueCause: \"schemaConfig-(strict)\",\n\t\t\tissues: [{ message: `Strict Mode - No schema found for route '${currentRouteSchemaKey}' ` }],\n\t\t\tresponse: null,\n\t\t});\n\t}\n\n\tif (!resolvedSchema) {\n\t\treturn {\n\t\t\textraOptionsValidationResult: {} as Awaited<ReturnType<typeof handleOptionsValidation>>,\n\t\t\trequestOptionsValidationResult: {} as Awaited<ReturnType<typeof handleOptionsValidation>>,\n\t\t\tresolvedSchema,\n\t\t\tresolvedSchemaConfig,\n\t\t};\n\t}\n\n\tconst [extraOptionsValidationResult, requestOptionsValidationResult] = await Promise.all([\n\t\thandleOptionsValidation({\n\t\t\toptions,\n\t\t\tschema: resolvedSchema,\n\t\t\tschemaConfig: resolvedSchemaConfig,\n\t\t}),\n\t\thandleOptionsValidation({\n\t\t\trequest,\n\t\t\tschema: resolvedSchema,\n\t\t\tschemaConfig: resolvedSchemaConfig,\n\t\t}),\n\t]);\n\n\treturn {\n\t\textraOptionsValidationResult,\n\t\trequestOptionsValidationResult,\n\t\tresolvedSchema,\n\t\tresolvedSchemaConfig,\n\t};\n};\n\ntype GetResolvedSchemaContext = {\n\tbaseExtraOptions: BaseCallApiExtraOptions;\n\tcurrentRouteSchemaKey: string;\n\textraOptions: CallApiExtraOptions;\n};\n\nexport const getResolvedSchema = (context: GetResolvedSchemaContext) => {\n\tconst { baseExtraOptions, currentRouteSchemaKey, extraOptions } = context;\n\n\tconst fallbackRouteSchema = baseExtraOptions.schema?.routes[fallBackRouteSchemaKey];\n\tconst currentRouteSchema = baseExtraOptions.schema?.routes[currentRouteSchemaKey];\n\n\tconst resolvedRouteSchema = {\n\t\t...fallbackRouteSchema,\n\t\t// == Current route schema takes precedence over fallback route schema\n\t\t...currentRouteSchema,\n\t} satisfies CallApiSchema as CallApiSchema | undefined;\n\n\tconst resolvedSchema =\n\t\tisFunction(extraOptions.schema) ?\n\t\t\textraOptions.schema({\n\t\t\t\tbaseSchemaRoutes: baseExtraOptions.schema?.routes ?? {},\n\t\t\t\tcurrentRouteSchema: resolvedRouteSchema ?? {},\n\t\t\t\tcurrentRouteSchemaKey,\n\t\t\t})\n\t\t:\t(extraOptions.schema ?? resolvedRouteSchema);\n\n\treturn { currentRouteSchema, resolvedSchema };\n};\n\nexport const getResolvedSchemaConfig = (\n\tcontext: Omit<GetResolvedSchemaContext, \"currentRouteSchemaKey\">\n) => {\n\tconst { baseExtraOptions, extraOptions } = context;\n\n\tconst resolvedSchemaConfig =\n\t\tisFunction(extraOptions.schemaConfig) ?\n\t\t\textraOptions.schemaConfig({ baseSchemaConfig: baseExtraOptions.schema?.config ?? {} })\n\t\t:\t(extraOptions.schemaConfig ?? baseExtraOptions.schema?.config);\n\n\treturn resolvedSchemaConfig;\n};\n\nconst removeLeadingSlash = (value: string) => (value.startsWith(\"/\") ? value.slice(1) : value);\n\nconst extractURLParts = (initURL: string) => {\n\treturn {\n\t\tmethodFromURL: extractMethodFromURL(initURL),\n\t\tpathWithoutMethod: normalizeURL(initURL, { retainLeadingSlashForRelativeURLs: false }),\n\t};\n};\n\nconst mergeURLParts = (options: { method: string | undefined; path: string }): string => {\n\tconst { method, path } = options;\n\n\treturn method ? `${atSymbol}${method}/${removeLeadingSlash(path)}` : path;\n};\n\nexport const getCurrentRouteSchemaKeyAndMainInitURL = (\n\tcontext: Pick<GetResolvedSchemaContext, \"baseExtraOptions\" | \"extraOptions\"> & { initURL: string }\n) => {\n\tconst { baseExtraOptions, extraOptions, initURL } = context;\n\n\tconst schemaConfig = getResolvedSchemaConfig({ baseExtraOptions, extraOptions });\n\n\tlet currentRouteSchemaKey = initURL;\n\tlet mainInitURL = initURL;\n\n\tconst { methodFromURL, pathWithoutMethod } = extractURLParts(initURL);\n\n\tconst prefixWithoutLeadingSlash = schemaConfig?.prefix && removeLeadingSlash(schemaConfig.prefix);\n\n\tif (prefixWithoutLeadingSlash && pathWithoutMethod.startsWith(prefixWithoutLeadingSlash)) {\n\t\tconst restOfPathWithoutPrefix = pathWithoutMethod.slice(prefixWithoutLeadingSlash.length);\n\n\t\tcurrentRouteSchemaKey = mergeURLParts({ method: methodFromURL, path: restOfPathWithoutPrefix });\n\n\t\tconst pathWithReplacedPrefix = pathWithoutMethod.replace(\n\t\t\tprefixWithoutLeadingSlash,\n\t\t\tschemaConfig.baseURL ?? \"\"\n\t\t);\n\n\t\tmainInitURL = mergeURLParts({ method: methodFromURL, path: pathWithReplacedPrefix });\n\t}\n\n\tif (schemaConfig?.baseURL && pathWithoutMethod.startsWith(schemaConfig.baseURL)) {\n\t\tconst restOfPathWithoutBaseURL = pathWithoutMethod.slice(schemaConfig.baseURL.length);\n\n\t\tcurrentRouteSchemaKey = mergeURLParts({ method: methodFromURL, path: restOfPathWithoutBaseURL });\n\t}\n\n\treturn { currentRouteSchemaKey, initURL, mainInitURL };\n};\n","import { extraOptionDefaults } from \"./constants\";\nimport type { CallApiExtraOptions } from \"./types/options-types\";\nimport type { AnyString, UnmaskType } from \"./types/type-helpers\";\nimport { isArray } from \"./utils/guards\";\nimport { routeKeyMethods, type RouteKeyMethodsURLUnion } from \"./validation\";\n\nconst handleArrayParams = (url: string, params: Extract<CallApiExtraOptions[\"params\"], unknown[]>) => {\n\tlet newUrl = url;\n\n\tconst urlParts = newUrl.split(\"/\");\n\n\t// == Find all parameters in order (both :param and {param} patterns)\n\tconst matchedParamsArray: string[] = [];\n\n\tfor (const part of urlParts) {\n\t\tconst isMatch = part.startsWith(\":\") || (part.startsWith(\"{\") && part.endsWith(\"}\"));\n\n\t\tif (!isMatch) continue;\n\n\t\tmatchedParamsArray.push(part);\n\t}\n\n\tfor (const [paramIndex, matchedParam] of matchedParamsArray.entries()) {\n\t\tconst stringParamValue = String(params[paramIndex]);\n\t\tnewUrl = newUrl.replace(matchedParam, stringParamValue);\n\t}\n\n\treturn newUrl;\n};\n\nconst handleObjectParams = (\n\turl: string,\n\tparams: Extract<CallApiExtraOptions[\"params\"], Record<string, unknown>>\n) => {\n\tlet newUrl = url;\n\n\tfor (const [paramKey, paramValue] of Object.entries(params)) {\n\t\t// == Replace both :param and {param} patterns\n\t\tconst colonPattern = `:${paramKey}` as const;\n\t\tconst bracePattern = `{${paramKey}}` as const;\n\n\t\tconst stringValue = String(paramValue);\n\n\t\tnewUrl = newUrl.replace(colonPattern, stringValue);\n\t\tnewUrl = newUrl.replace(bracePattern, stringValue);\n\t}\n\n\treturn newUrl;\n};\n\nconst mergeUrlWithParams = (url: string, params: CallApiExtraOptions[\"params\"]) => {\n\tif (!params) {\n\t\treturn url;\n\t}\n\n\tconst newUrl = isArray(params) ? handleArrayParams(url, params) : handleObjectParams(url, params);\n\n\treturn newUrl;\n};\n\nconst mergeUrlWithQuery = (url: string, query: CallApiExtraOptions[\"query\"]): string => {\n\tif (!query) {\n\t\treturn url;\n\t}\n\n\tconst queryString = new URLSearchParams(query as Record<string, string> | URLSearchParams).toString();\n\n\tif (queryString.length === 0) {\n\t\treturn url;\n\t}\n\n\tif (url.endsWith(\"?\")) {\n\t\treturn `${url}${queryString}`;\n\t}\n\n\tif (url.includes(\"?\")) {\n\t\treturn `${url}&${queryString}`;\n\t}\n\n\treturn `${url}?${queryString}`;\n};\n\n/**\n * @description Extracts the HTTP method from method-prefixed route patterns.\n *\n * Analyzes URLs that start with method modifiers (e.g., \"@get/\", \"@post/\") and extracts\n * the HTTP method for use in API requests. This enables method specification directly\n * in route definitions.\n *\n * @param initURL - The URL string to analyze for method modifiers\n * @returns The extracted HTTP method (lowercase) if found, otherwise undefined\n *\n * @example\n * ```typescript\n * extractMethodFromURL(\"@get/users\"); // Returns: \"get\"\n * extractMethodFromURL(\"@post/users\"); // Returns: \"post\"\n * ```\n */\nexport const extractMethodFromURL = (initURL: string | undefined) => {\n\tif (!initURL?.startsWith(\"@\")) return;\n\n\tconst methodFromURL = routeKeyMethods.find((method) => initURL.startsWith(`@${method}/`));\n\n\tif (!methodFromURL) return;\n\n\treturn methodFromURL;\n};\n\ntype NormalizeURLOptions = {\n\tretainLeadingSlashForRelativeURLs?: boolean;\n};\n\nexport const atSymbol = \"@\";\nexport type AtSymbol = typeof atSymbol;\n\nexport const normalizeURL = (initURL: string, options: NormalizeURLOptions = {}) => {\n\tconst { retainLeadingSlashForRelativeURLs = true } = options;\n\n\tconst methodFromURL = extractMethodFromURL(initURL);\n\n\tif (!methodFromURL) {\n\t\treturn initURL;\n\t}\n\n\tconst normalizedURL =\n\t\tretainLeadingSlashForRelativeURLs && !initURL.includes(\"http\") ?\n\t\t\tinitURL.replace(`@${methodFromURL}`, \"\")\n\t\t:\tinitURL.replace(`@${methodFromURL}/`, \"\");\n\n\treturn normalizedURL;\n};\n\ntype GetFullURLOptions = {\n\tbaseURL: string | undefined;\n\tinitURL: string;\n\tparams: CallApiExtraOptions[\"params\"];\n\tquery: CallApiExtraOptions[\"query\"];\n};\n\nconst getFullURL = (initURL: string, baseURL: string | undefined) => {\n\tif (!baseURL || initURL.startsWith(\"http\")) {\n\t\treturn initURL;\n\t}\n\n\tconst shouldAddSlash = initURL.length > 0 && !initURL.startsWith(\"/\") && !baseURL.endsWith(\"/\");\n\n\treturn shouldAddSlash ? `${baseURL}/${initURL}` : `${baseURL}${initURL}`;\n};\n\nexport const getFullAndNormalizedURL = (\n\toptions: GetFullURLOptions & {\n\t\tdebugMode: CallApiExtraOptions[\"debugMode\"];\n\t}\n) => {\n\tconst { baseURL, debugMode, initURL, params, query } = options;\n\n\tconst normalizedInitURL = normalizeURL(initURL);\n\n\tconst fullURL = getFullURL(\n\t\tmergeUrlWithQuery(mergeUrlWithParams(normalizedInitURL, params), query),\n\t\tbaseURL\n\t);\n\n\tif ((debugMode ?? extraOptionDefaults.debugMode) && !URL.canParse(fullURL)) {\n\t\tconst errorMessage =\n\t\t\t!baseURL ?\n\t\t\t\t`Invalid URL '${initURL}'. Are you passing a relative url to CallApi without setting the 'baseURL' option?`\n\t\t\t:\t`Invalid URL '${fullURL}'. Please validate that you are passing the correct url.`;\n\n\t\tconsole.error(errorMessage);\n\t}\n\n\treturn {\n\t\tfullURL,\n\t\tnormalizedInitURL,\n\t};\n};\n\nexport type AllowedQueryParamValues = UnmaskType<boolean | number | string>;\n\nexport type RecordStyleParams = UnmaskType<Record<string, AllowedQueryParamValues>>;\n\nexport type TupleStyleParams = UnmaskType<AllowedQueryParamValues[]>;\n\nexport type Params = UnmaskType<RecordStyleParams | TupleStyleParams>;\n\nexport type Query = UnmaskType<Record<string, AllowedQueryParamValues> | URLSearchParams>;\n\nexport type InitURLOrURLObject = AnyString | RouteKeyMethodsURLUnion | URL;\n\nexport interface URLOptions {\n\t/**\n\t * Base URL for all API requests. Will only be prepended to relative URLs.\n\t *\n\t * Absolute URLs (starting with http/https) will not be prepended by the baseURL.\n\t *\n\t * @example\n\t * ```ts\n\t * // Set base URL for all requests\n\t * baseURL: \"https://api.example.com/v1\"\n\t *\n\t * // Then use relative URLs in requests\n\t * callApi(\"/users\") // → https://api.example.com/v1/users\n\t * callApi(\"/posts/123\") // → https://api.example.com/v1/posts/123\n\t *\n\t * // Environment-specific base URLs\n\t * baseURL: process.env.NODE_ENV === \"production\"\n\t * ? \"https://api.example.com\"\n\t * : \"http://localhost:3000/api\"\n\t * ```\n\t */\n\tbaseURL?: string;\n\n\t/**\n\t * Resolved request URL after processing baseURL, parameters, and query strings (readonly)\n\t *\n\t * This is the final URL that will be used for the HTTP request, computed from\n\t * baseURL, initURL, params, and query parameters.\n\t *\n\t */\n\treadonly fullURL?: string;\n\n\t/**\n\t * The original URL string passed to the callApi instance (readonly)\n\t *\n\t * This preserves the original URL as provided, including any method modifiers like \"@get/\" or \"@post/\".\n\t *\n\t */\n\treadonly initURL?: string;\n\n\t/**\n\t * The URL string after normalization, with method modifiers removed(readonly)\n\t *\n\t * Method modifiers like \"@get/\", \"@post/\" are stripped to create a clean URL\n\t * for parameter substitution and final URL construction.\n\t *\n\t */\n\treadonly initURLNormalized?: string;\n\n\t/**\n\t * Parameters to be substituted into URL path segments.\n\t *\n\t * Supports both object-style (named parameters) and array-style (positional parameters)\n\t * for flexible URL parameter substitution.\n\t *\n\t * @example\n\t * ```typescript\n\t * // Object-style parameters (recommended)\n\t * const namedParams: URLOptions = {\n\t * initURL: \"/users/:userId/posts/:postId\",\n\t * params: { userId: \"123\", postId: \"456\" }\n\t * };\n\t * // Results in: /users/123/posts/456\n\t *\n\t * // Array-style parameters (positional)\n\t * const positionalParams: URLOptions = {\n\t * initURL: \"/users/:userId/posts/:postId\",\n\t * params: [\"123\", \"456\"] // Maps in order: userId=123, postId=456\n\t * };\n\t * // Results in: /users/123/posts/456\n\t *\n\t * // Single parameter\n\t * const singleParam: URLOptions = {\n\t * initURL: \"/users/:id\",\n\t * params: { id: \"user-123\" }\n\t * };\n\t * // Results in: /users/user-123\n\t * ```\n\t */\n\tparams?: Params;\n\n\t/**\n\t * Query parameters to append to the URL as search parameters.\n\t *\n\t * These will be serialized into the URL query string using standard\n\t * URL encoding practices.\n\t *\n\t * @example\n\t * ```typescript\n\t * // Basic query parameters\n\t * const queryOptions: URLOptions = {\n\t * initURL: \"/users\",\n\t * query: {\n\t * page: 1,\n\t * limit: 10,\n\t * search: \"john doe\",\n\t * active: true\n\t * }\n\t * };\n\t * // Results in: /users?page=1&limit=10&search=john%20doe&active=true\n\t *\n\t * // Filtering and sorting\n\t * const filterOptions: URLOptions = {\n\t * initURL: \"/products\",\n\t * query: {\n\t * category: \"electronics\",\n\t * minPrice: 100,\n\t * maxPrice: 500,\n\t * sortBy: \"price\",\n\t * order: \"asc\"\n\t * }\n\t * };\n\t * // Results in: /products?category=electronics&minPrice=100&maxPrice=500&sortBy=price&order=asc\n\t * ```\n\t */\n\tquery?: Query;\n}\n","import type { CallApiRequestOptions } from \"../../types/options-types\";\nimport { getValidatedValue, type CallApiSchemaType, type InferSchemaOutput } from \"../../validation\";\nimport { isArray, isBlob, isObject, isString } from \"../guards\";\nimport { ValidationError } from \"./error\";\n\nconst toStringOrStringify = (value: unknown): string => {\n\treturn isString(value) ? value : JSON.stringify(value);\n};\n\ntype BodyType = NonNullable<CallApiRequestOptions[\"body\"]>;\n\nexport const toSearchParams = <TSchema extends CallApiSchemaType<BodyType>>(\n\tdata: InferSchemaOutput<TSchema>,\n\tschema?: TSchema\n) => {\n\tconst result = getValidatedValue(data, schema, { variant: \"sync\" });\n\n\tif (result.issues) {\n\t\tthrow new ValidationError({\n\t\t\tissueCause: \"toQueryString\",\n\t\t\tissues: result.issues,\n\t\t\tresponse: null,\n\t\t});\n\t}\n\n\tconst searchParams = new URLSearchParams();\n\n\tfor (const [key, value] of Object.entries(result.value as Record<string, unknown>)) {\n\t\tif (value == null) continue;\n\n\t\tif (isArray(value)) {\n\t\t\t// eslint-disable-next-line max-depth -- Allow\n\t\t\tfor (const innerValue of value) {\n\t\t\t\tsearchParams.append(key, toStringOrStringify(innerValue));\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tsearchParams.set(key, toStringOrStringify(value));\n\t}\n\n\treturn searchParams;\n};\n\nexport const toQueryString = <TSchema extends CallApiSchemaType<BodyType>>(\n\t...parameters: Parameters<typeof toSearchParams<TSchema>>\n) => {\n\tconst searchParams = toSearchParams(...parameters);\n\n\treturn searchParams.toString();\n};\n\nconst toBlobOrString = (value: unknown): string | Blob => {\n\treturn isBlob(value) ? value : String(value);\n};\n\n/**\n * @description Converts a plain object to FormData.\n *\n * Handles various data types:\n * - **Primitives** (string, number, boolean): Converted to strings\n * - **Blobs/Files**: Added directly to FormData\n * - **Arrays**: Each item is appended (allows multiple values for same key)\n * - **Objects**: JSON stringified before adding to FormData\n *\n * @example\n * ```ts\n * // Basic usage\n * const formData = toFormData({\n * name: \"John\",\n * age: 30,\n * active: true\n * });\n *\n * // With arrays\n * const formData = toFormData({\n * tags: [\"javascript\", \"typescript\"],\n * name: \"John\"\n * });\n *\n * // With files\n * const formData = toFormData({\n * avatar: fileBlob,\n * name: \"John\"\n * });\n *\n * // With nested objects (one level only)\n * const formData = toFormData({\n * user: { name: \"John\", age: 30 },\n * settings: { theme: \"dark\" }\n * });\n */\nexport const toFormData = <TSchema extends CallApiSchemaType<BodyType>>(\n\tdata: InferSchemaOutput<TSchema>,\n\tschema?: TSchema\n) => {\n\tconst formData = new FormData();\n\n\tconst result = getValidatedValue(data, schema, { variant: \"sync\" });\n\n\tif (result.issues) {\n\t\tthrow new ValidationError({\n\t\t\tissueCause: \"toFormData\",\n\t\t\tissues: result.issues,\n\t\t\tresponse: null,\n\t\t});\n\t}\n\n\tfor (const [key, value] of Object.entries(result.value as Record<string, unknown>)) {\n\t\tif (isArray(value)) {\n\t\t\t// eslint-disable-next-line max-depth -- Allow for now\n\t\t\tfor (const innerValue of value) {\n\t\t\t\tformData.append(key, toBlobOrString(innerValue));\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (isObject(value) && !isBlob(value)) {\n\t\t\tformData.set(key, JSON.stringify(value));\n\t\t\tcontinue;\n\t\t}\n\n\t\tformData.set(key, toBlobOrString(value));\n\t}\n\n\treturn formData;\n};\n","import type { CallApiPlugin } from \"../../plugins\";\nimport type { BaseCallApiConfig, CallApiConfig } from \"../../types/options-types\";\nimport type { AnyFunction, Satisfies, Writeable } from \"../../types/type-helpers\";\nimport type {\n\tBaseCallApiSchemaAndConfig,\n\tBaseCallApiSchemaRoutes,\n\tCallApiSchema,\n\tCallApiSchemaConfig,\n} from \"../../validation\";\n\nexport const defineSchema = <\n\tconst TBaseSchemaRoutes extends BaseCallApiSchemaRoutes,\n\tconst TSchemaConfig extends CallApiSchemaConfig,\n>(\n\troutes: TBaseSchemaRoutes,\n\tconfig?: Satisfies<TSchemaConfig, CallApiSchemaConfig>\n) => {\n\treturn {\n\t\tconfig: defineSchemaConfig(config as NonNullable<typeof config>),\n\t\troutes: defineSchemaRoutes(routes),\n\t} satisfies BaseCallApiSchemaAndConfig;\n};\n\nexport const defineSchemaRoutes = <const TSchemaRoutes extends BaseCallApiSchemaRoutes>(\n\troutes: TSchemaRoutes\n) => {\n\treturn routes as Writeable<typeof routes, \"deep\">;\n};\n\nexport const defineMainSchema = <const TSchema extends CallApiSchema>(\n\tmainSchema: Satisfies<TSchema, CallApiSchema>\n) => {\n\treturn mainSchema as Writeable<typeof mainSchema, \"deep\">;\n};\n\nexport const defineSchemaConfig = <const TSchemaConfig extends CallApiSchemaConfig>(\n\tconfig: Satisfies<TSchemaConfig, CallApiSchemaConfig>\n) => {\n\treturn config as Writeable<typeof config, \"deep\">;\n};\n\nexport const definePlugin = <const TPlugin extends CallApiPlugin>(plugin: TPlugin) => {\n\treturn plugin as Writeable<typeof plugin, \"deep\">;\n};\n\ntype BaseConfigObject = Exclude<BaseCallApiConfig, AnyFunction>;\n\ntype BaseConfigFn = Extract<BaseCallApiConfig, AnyFunction>;\n\ntype DefineBaseConfig = {\n\t<const TBaseConfig extends BaseConfigObject>(\n\t\tbaseConfig: Satisfies<TBaseConfig, BaseConfigObject>\n\t): Writeable<typeof baseConfig, \"deep\">;\n\t<const TBaseConfig extends BaseConfigObject>(\n\t\tbaseConfig: (...parameters: Parameters<BaseConfigFn>) => Writeable<TBaseConfig, \"deep\">\n\t): typeof baseConfig;\n};\n\nexport const defineBaseConfig: DefineBaseConfig = <const TBaseConfig extends BaseCallApiConfig>(\n\tbaseConfig: TBaseConfig\n) => {\n\treturn baseConfig;\n};\n\nexport const defineInstanceConfig = <const TInstanceConfig extends CallApiConfig>(\n\tconfig: TInstanceConfig\n) => {\n\treturn config as Writeable<typeof config, \"deep\">;\n};\n","import type {\n\tCallApiResultErrorVariant,\n\tPossibleHTTPError,\n\tPossibleJavaScriptError,\n\tPossibleValidationError,\n} from \"../../result\";\nimport { isObject } from \"../guards\";\nimport { HTTPError, ValidationError } from \"./error\";\n\nexport const isHTTPError = <TErrorData>(\n\terror: CallApiResultErrorVariant<TErrorData>[\"error\"] | null\n): error is PossibleHTTPError<TErrorData> => {\n\treturn isObject(error) && error.name === \"HTTPError\";\n};\n\nexport const isHTTPErrorInstance = <TErrorData>(error: unknown) => {\n\treturn HTTPError.isError<TErrorData>(error);\n};\n\nexport const isValidationError = (\n\terror: CallApiResultErrorVariant<unknown>[\"error\"] | null\n): error is PossibleValidationError => {\n\treturn isObject(error) && error.name === \"ValidationError\";\n};\n\nexport const isValidationErrorInstance = (error: unknown): error is ValidationError => {\n\treturn ValidationError.isError(error);\n};\n\nexport const isJavascriptError = (\n\terror: CallApiResultErrorVariant<unknown>[\"error\"] | null\n): error is PossibleJavaScriptError => {\n\treturn isObject(error) && !isHTTPError(error) && !isValidationError(error);\n};\n","import type { CallApiRequestOptions } from \"../../types/options-types\";\nimport { isPlainObject } from \"../guards\";\n\nexport const objectifyHeaders = (headers: CallApiRequestOptions[\"headers\"]) => {\n\tif (!headers) {\n\t\treturn {};\n\t}\n\n\tif (isPlainObject(headers)) {\n\t\treturn headers as Record<string, string>;\n\t}\n\n\treturn Object.fromEntries(headers);\n};\n","import { getAuthHeader } from \"../auth\";\nimport { fetchSpecificKeys } from \"../constants/common\";\nimport { extraOptionDefaults, requestOptionDefaults } from \"../constants/defaults\";\nimport type { RequestContext } from \"../hooks\";\nimport type { Middlewares } from \"../middlewares\";\nimport type { InferHeadersOption } from \"../types/conditional-types\";\nimport type {\n\tCallApiExtraOptions,\n\tCallApiRequestOptions,\n\tSharedExtraOptions,\n} from \"../types/options-types\";\nimport type { DistributiveOmit } from \"../types/type-helpers\";\nimport { extractMethodFromURL } from \"../url\";\nimport type { CallApiSchema } from \"../validation\";\nimport { objectifyHeaders } from \"./external\";\nimport {\n\tisFunction,\n\tisPlainObject,\n\tisQueryString,\n\tisSerializableObject,\n\tisValidJsonString,\n} from \"./guards\";\n\nexport const omitKeys = <\n\tTObject extends Record<string, unknown>,\n\tconst TOmitArray extends Array<keyof TObject> | ReadonlyArray<keyof TObject>,\n>(\n\tinitialObject: TObject,\n\tkeysToOmit: TOmitArray\n) => {\n\tconst updatedObject = {} as Record<string, unknown>;\n\n\tfor (const [key, value] of Object.entries(initialObject)) {\n\t\tif (!keysToOmit.includes(key)) {\n\t\t\tupdatedObject[key] = value;\n\t\t}\n\t}\n\n\treturn updatedObject as DistributiveOmit<TObject, TOmitArray[number]>;\n};\n\nexport const pickKeys = <\n\tTObject extends Record<string, unknown>,\n\tconst TPickArray extends Array<keyof TObject> | ReadonlyArray<keyof TObject>,\n>(\n\tinitialObject: TObject,\n\tkeysToPick: TPickArray\n) => {\n\tconst updatedObject = {} as Record<string, unknown>;\n\n\tfor (const [key, value] of Object.entries(initialObject)) {\n\t\tif (keysToPick.includes(key)) {\n\t\t\tupdatedObject[key] = value;\n\t\t}\n\t}\n\n\treturn updatedObject as Pick<TObject, TPickArray[number]>;\n};\n\n// eslint-disable-next-line ts-eslint/no-explicit-any -- Any is required here so that one can pass custom function type without type errors\nexport const splitConfig = <TExtraOptions extends SharedExtraOptions>(config: Record<string, any>) =>\n\t[\n\t\tpickKeys(config, fetchSpecificKeys) as CallApiRequestOptions,\n\t\tomitKeys(config, fetchSpecificKeys) as TExtraOptions,\n\t] as const;\n\nexport type GetResolvedHeadersOptions = {\n\tbaseHeaders: CallApiRequestOptions[\"headers\"];\n\theaders: InferHeadersOption<CallApiSchema>[\"headers\"];\n};\n\nexport const getResolvedHeaders = (options: GetResolvedHeadersOptions) => {\n\tconst { baseHeaders, headers } = options;\n\n\tconst resolvedHeaders =\n\t\tisFunction(headers) ?\n\t\t\theaders({ baseHeaders: objectifyHeaders(baseHeaders) })\n\t\t:\t(headers ?? baseHeaders);\n\n\treturn objectifyHeaders(resolvedHeaders);\n};\n\nconst detectContentTypeHeader = (body: CallApiRequestOptions[\"body\"]) => {\n\tif (isQueryString(body)) {\n\t\treturn { \"Content-Type\": \"application/x-www-form-urlencoded\" };\n\t}\n\n\tif (isSerializableObject(body) || isValidJsonString(body)) {\n\t\treturn { Accept: \"application/json\", \"Content-Type\": \"application/json\" };\n\t}\n\n\treturn null;\n};\n\nexport type GetHeadersOptions = {\n\tauth: CallApiExtraOptions[\"auth\"];\n\tbody: CallApiRequestOptions[\"body\"];\n\tresolvedHeaders: CallApiRequestOptions[\"headers\"];\n};\n\nexport const getHeaders = async (options: GetHeadersOptions) => {\n\tconst { auth, body, resolvedHeaders } = options;\n\n\tconst authHeaderObject = await getAuthHeader(auth);\n\n\tconst resolvedHeadersObject = objectifyHeaders(resolvedHeaders);\n\n\tconst hasExistingContentType =\n\t\tObject.hasOwn(resolvedHeadersObject, \"Content-Type\")\n\t\t|| Object.hasOwn(resolvedHeadersObject, \"content-type\");\n\n\tif (!hasExistingContentType) {\n\t\tconst contentTypeHeader = detectContentTypeHeader(body);\n\t\tcontentTypeHeader && Object.assign(resolvedHeadersObject, contentTypeHeader);\n\t}\n\n\tconst headersObject: Record<string, string> = {\n\t\t...authHeaderObject,\n\t\t...resolvedHeadersObject,\n\t};\n\n\treturn headersObject;\n};\n\nexport type GetMethodContext = {\n\t/** The URL string that may contain method modifiers like \"@get/\" or \"@post/\" */\n\tinitURL: string | undefined;\n\t/** Explicitly specified HTTP method */\n\tmethod: CallApiRequestOptions[\"method\"];\n};\n\nexport const getMethod = (ctx: GetMethodContext) => {\n\tconst { initURL, method } = ctx;\n\n\treturn (\n\t\tmethod?.toUpperCase() ?? extractMethodFromURL(initURL)?.toUpperCase() ?? requestOptionDefaults.method\n\t);\n};\n\nexport type GetBodyOptions = Pick<GetHeadersOptions, \"body\" | \"resolvedHeaders\"> & {\n\tbodySerializer: CallApiExtraOptions[\"bodySerializer\"];\n\tbodyTransformer: CallApiExtraOptions[\"bodyTransformer\"];\n};\n\nexport const getBody = (options: GetBodyOptions) => {\n\tconst { body, bodySerializer, bodyTransformer, resolvedHeaders } = options;\n\n\tconst headers = new Headers(resolvedHeaders as Record<string, string>);\n\n\tif (body !== undefined && bodyTransformer) {\n\t\treturn bodyTransformer({ body, headers });\n\t}\n\n\tconst existingContentType = headers.get(\"content-type\");\n\n\tif (!existingContentType && isSerializableObject(body)) {\n\t\tconst selectedBodySerializer = bodySerializer ?? extraOptionDefaults.bodySerializer;\n\n\t\treturn selectedBodySerializer(body);\n\t}\n\n\tif (existingContentType === \"application/x-www-form-urlencoded\" && isSerializableObject(body)) {\n\t\treturn new URLSearchParams(body as Record<string, string>).toString();\n\t}\n\n\treturn body;\n};\n\nexport const getInitFetchImpl = (customFetchImpl: CallApiExtraOptions[\"customFetchImpl\"]) => {\n\tif (customFetchImpl) {\n\t\treturn customFetchImpl;\n\t}\n\n\tif (typeof globalThis !== \"undefined\" && isFunction(globalThis.fetch)) {\n\t\treturn globalThis.fetch;\n\t}\n\n\tthrow new Error(\"No fetch implementation found\");\n};\n\nexport const getFetchImpl = (context: {\n\tcustomFetchImpl: CallApiExtraOptions[\"customFetchImpl\"];\n\tfetchMiddleware: Middlewares[\"fetchMiddleware\"];\n\trequestContext: RequestContext;\n}) => {\n\tconst { customFetchImpl, fetchMiddleware, requestContext } = context;\n\n\tconst initFetchImpl = getInitFetchImpl(customFetchImpl);\n\n\tconst resolvedFetchImpl =\n\t\tfetchMiddleware ? fetchMiddleware({ ...requestContext, fetchImpl: initFetchImpl }) : initFetchImpl;\n\n\treturn resolvedFetchImpl;\n};\n\nexport const waitFor = (ms: number) => {\n\tif (ms === 0) return;\n\n\tconst promise = new Promise((resolve) => setTimeout(resolve, ms));\n\n\treturn promise;\n};\n\nexport const createCombinedSignal = (...signals: Array<AbortSignal | null | undefined>) => {\n\tconst validSignals = signals.filter((signal) => signal != null);\n\n\tif (validSignals.length === 0) return;\n\tif (validSignals.length === 1) {\n\t\treturn validSignals[0];\n\t}\n\n\treturn AbortSignal.any(validSignals);\n};\n\nexport const createTimeoutSignal = (ms: number | undefined) => {\n\tif (ms === undefined || ms === Infinity) return;\n\n\treturn AbortSignal.timeout(ms);\n};\n\nexport const deterministicHashFn = (value: unknown): string => {\n\treturn JSON.stringify(value, (_, innerValue: unknown) => {\n\t\tif (!isPlainObject(innerValue)) {\n\t\t\treturn innerValue;\n\t\t}\n\n\t\tconst result: Record<string, unknown> = {};\n\n\t\t// eslint-disable-next-line unicorn/no-array-sort -- Not necessary here\n\t\tconst sortedKeys = Object.keys(innerValue).sort();\n\n\t\tfor (const key of sortedKeys) {\n\t\t\tresult[key] = innerValue[key];\n\t\t}\n\n\t\treturn result;\n\t});\n};\n","import type { CallApiConfig, CallApiExtraOptions } from \"../types/options-types\";\nimport { defineEnum } from \"../types/type-helpers\";\nimport { deterministicHashFn } from \"../utils/common\";\n\nexport const extraOptionDefaults = Object.freeze(\n\tdefineEnum({\n\t\t// Common defaults\n\t\tbodySerializer: JSON.stringify,\n\t\tdebugMode: true,\n\t\tdefaultHTTPErrorMessage: \"Request failed unexpectedly\",\n\n\t\t// Dedupe defaults\n\t\t/* eslint-disable perfectionist/sort-objects -- Allow */\n\t\tdedupeCacheScope: \"local\",\n\t\tdedupeKey: (ctx) =>\n\t\t\t`${ctx.options.fullURL}-${deterministicHashFn({ options: ctx.options, request: ctx.request })}`,\n\t\tdedupeCacheScopeKey: \"default\",\n\t\tdedupeStrategy: \"cancel\",\n\t\t/* eslint-enable perfectionist/sort-objects -- Allow */\n\n\t\t// Hook defaults\n\t\thooksExecutionMode: \"parallel\",\n\n\t\t// Response defaults\n\t\tresponseParser: JSON.parse,\n\t\tresponseType: \"json\",\n\t\tresultMode: \"all\",\n\n\t\t// Retry Defaults\n\t\tretryAttempts: 0,\n\t\tretryCondition: () => true,\n\t\tretryDelay: 1000,\n\t\tretryMaxDelay: 10000,\n\t\tretryMethods: [\"GET\", \"POST\"],\n\t\tretryStatusCodes: [],\n\t\tretryStrategy: \"linear\",\n\t} as const satisfies CallApiExtraOptions)\n);\n\nexport const requestOptionDefaults = Object.freeze(\n\tdefineEnum({\n\t\tmethod: \"GET\",\n\t} satisfies CallApiConfig)\n);\n"],"mappings":";AAmCA,MAAa,cAA2C,UACvD,OAAO,OAAO,KAAK;;;ACjCpB,MAAa,oBAAoB,WAAW;CAC3C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAgF;;;AClBhF,MAAa,WAAuB,UAA0C,MAAM,QAAQ,KAAK;AAIjG,MAAa,UAAU,UAAkC,iBAAiB;AAE1E,MAAa,YAAoC,UAAqC;CACrF,OAAO,OAAO,UAAU,YAAY,UAAU;AAC/C;AAEA,MAAM,sBAAsB,UAAmB;CAC9C,OAAO,OAAO,UAAU,SAAS,KAAK,KAAK,MAAM;A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