@zayne-labs/callapi 1.14.0 → 1.14.1

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.
@@ -5,7 +5,7 @@ declare const fetchSpecificKeys: readonly (keyof RequestInit | "duplex" | "extra
5
5
  type AnyString = string & NonNullable<unknown>;
6
6
  type AnyNumber = number & NonNullable<unknown>;
7
7
  type AnyFunction<TResult = unknown> = (...args: any[]) => TResult;
8
- type Prettify<TObject> = NonNullable<unknown> & { [Key in keyof TObject]: TObject[Key] };
8
+ type Prettify<TObject> = NonNullable<unknown> & { [Key in keyof TObject]: TObject[Key]; };
9
9
  type WriteableLevel = "deep" | "shallow";
10
10
  /**
11
11
  * Makes all properties in an object type writeable (removes readonly modifiers).
@@ -14,7 +14,7 @@ type WriteableLevel = "deep" | "shallow";
14
14
  * @template TVariant - The level of writeable transformation ("shallow" | "deep")
15
15
  */
16
16
  type ArrayOrObject = Record<number | string | symbol, unknown> | unknown[] | readonly unknown[];
17
- type Writeable<TObject, TLevel extends WriteableLevel = "shallow"> = TObject extends ArrayOrObject ? { -readonly [Key in keyof TObject]: TLevel extends "deep" ? NonNullable<TObject[Key]> extends ArrayOrObject ? Writeable<TObject[Key], "deep"> : TObject[Key] : TObject[Key] } : TObject;
17
+ type Writeable<TObject, TLevel extends WriteableLevel = "shallow"> = TObject extends ArrayOrObject ? { -readonly [Key in keyof TObject]: TLevel extends "deep" ? NonNullable<TObject[Key]> extends ArrayOrObject ? Writeable<TObject[Key], "deep"> : TObject[Key] : TObject[Key]; } : TObject;
18
18
  type UnionToIntersection<TUnion> = (TUnion extends unknown ? (param: TUnion) => void : never) extends ((param: infer TParam) => void) ? TParam : never;
19
19
  type UnmaskType<TValue> = {
20
20
  value: TValue;
@@ -31,7 +31,7 @@ type RemoveSlashImpl<TUrl extends string, TDirection extends "leading" | "traili
31
31
  type RemoveTrailingSlash<TUrl extends string> = RemoveSlashImpl<TUrl, "trailing">;
32
32
  type RemoveLeadingSlash<TUrl extends string> = RemoveSlashImpl<TUrl, "leading">;
33
33
  type Awaitable<TValue> = Promise<TValue> | TValue;
34
- type Satisfies<TActualType extends TExpectedTypeShape, TExpectedTypeShape> = { [Key in keyof TActualType]: Key extends keyof TExpectedTypeShape ? TActualType[Key] : never };
34
+ type Satisfies<TActualType extends TExpectedTypeShape, TExpectedTypeShape> = { [Key in keyof TActualType]: Key extends keyof TExpectedTypeShape ? TActualType[Key] : never; };
35
35
  type DistributiveOmit<TObject, TKeysToOmit extends keyof TObject> = TObject extends unknown ? Omit<TObject, TKeysToOmit> : never;
36
36
  type CommonRequestHeaders = "Access-Control-Allow-Credentials" | "Access-Control-Allow-Headers" | "Access-Control-Allow-Methods" | "Access-Control-Allow-Origin" | "Access-Control-Expose-Headers" | "Access-Control-Max-Age" | "Age" | "Allow" | "Cache-Control" | "Clear-Site-Data" | "Content-Disposition" | "Content-Encoding" | "Content-Language" | "Content-Length" | "Content-Location" | "Content-Range" | "Content-Security-Policy-Report-Only" | "Content-Security-Policy" | "Cookie" | "Cross-Origin-Embedder-Policy" | "Cross-Origin-Opener-Policy" | "Cross-Origin-Resource-Policy" | "Date" | "ETag" | "Expires" | "Last-Modified" | "Location" | "Permissions-Policy" | "Pragma" | "Retry-After" | "Save-Data" | "Sec-CH-Prefers-Color-Scheme" | "Sec-CH-Prefers-Reduced-Motion" | "Sec-CH-UA-Arch" | "Sec-CH-UA-Bitness" | "Sec-CH-UA-Form-Factor" | "Sec-CH-UA-Full-Version-List" | "Sec-CH-UA-Full-Version" | "Sec-CH-UA-Mobile" | "Sec-CH-UA-Model" | "Sec-CH-UA-Platform-Version" | "Sec-CH-UA-Platform" | "Sec-CH-UA-WoW64" | "Sec-CH-UA" | "Sec-Fetch-Dest" | "Sec-Fetch-Mode" | "Sec-Fetch-Site" | "Sec-Fetch-User" | "Sec-GPC" | "Server-Timing" | "Server" | "Service-Worker-Navigation-Preload" | "Set-Cookie" | "Strict-Transport-Security" | "Timing-Allow-Origin" | "Trailer" | "Transfer-Encoding" | "Upgrade" | "Vary" | "Warning" | "WWW-Authenticate" | "X-Content-Type-Options" | "X-DNS-Prefetch-Control" | "X-Frame-Options" | "X-Permitted-Cross-Domain-Policies" | "X-Powered-By" | "X-Robots-Tag" | "X-XSS-Protection" | AnyString;
37
37
  type CommonAuthorizationHeaders = `${"Basic" | "Bearer" | "Token"} ${string}`;
@@ -245,7 +245,7 @@ type ResultVariant = "infer-input" | "infer-output";
245
245
  type InferSchemaResult<TSchema, TFallbackResult, TResultVariant extends ResultVariant> = undefined extends TSchema ? TFallbackResult : TSchema extends StandardSchemaV1 ? TResultVariant extends "infer-input" ? StandardSchemaV1.InferInput<TSchema> : StandardSchemaV1.InferOutput<TSchema> : TSchema extends AnyFunction<infer TResult> ? Awaited<TResult> : TFallbackResult;
246
246
  type InferSchemaOutput<TSchema, TFallbackResult = unknown> = InferSchemaResult<TSchema, TFallbackResult, "infer-output">;
247
247
  type InferSchemaInput<TSchema, TFallbackResult = unknown> = InferSchemaResult<TSchema, TFallbackResult, "infer-input">;
248
- type BooleanObject = { [Key in keyof CallApiSchema]: boolean };
248
+ type BooleanObject = { [Key in keyof CallApiSchema]: boolean; };
249
249
  interface CallApiSchemaConfig {
250
250
  /**
251
251
  * The base url of the schema. By default it's the baseURL of the callApi instance.
@@ -405,7 +405,7 @@ type InitResponseTypeMap<TData = unknown> = ReturnType<typeof getResponseType<TD
405
405
  type ResponseTypeUnion = keyof InitResponseTypeMap;
406
406
  type ResponseTypePlaceholder = null;
407
407
  type ResponseTypeType = ResponseTypePlaceholder | ResponseTypeUnion;
408
- type ResponseTypeMap<TData> = { [Key in keyof InitResponseTypeMap<TData>]: Awaited<ReturnType<InitResponseTypeMap<TData>[Key]>> };
408
+ type ResponseTypeMap<TData> = { [Key in keyof InitResponseTypeMap<TData>]: Awaited<ReturnType<InitResponseTypeMap<TData>[Key]>>; };
409
409
  type GetResponseType<TData, TResponseType extends ResponseTypeType, TComputedResponseTypeMap extends ResponseTypeMap<TData> = ResponseTypeMap<TData>> = null extends TResponseType ? TComputedResponseTypeMap["json"] : TResponseType extends NonNullable<ResponseTypeType> ? TComputedResponseTypeMap[TResponseType] : never;
410
410
  type CallApiResultSuccessVariant<TData> = {
411
411
  data: NoInferUnMasked<TData>;
@@ -883,7 +883,7 @@ interface Hooks<TCallApiContext extends CallApiContext = DefaultCallApiContext>
883
883
  */
884
884
  onValidationError?: (context: ValidationErrorContext<TCallApiContext>) => Awaitable<unknown>;
885
885
  }
886
- type HooksOrHooksArray<TCallApiContext extends NoInfer<CallApiContext> = DefaultCallApiContext> = { [Key in keyof Hooks<TCallApiContext>]: Hooks<TCallApiContext>[Key] | Array<Hooks<TCallApiContext>[Key]> };
886
+ type HooksOrHooksArray<TCallApiContext extends NoInfer<CallApiContext> = DefaultCallApiContext> = { [Key in keyof Hooks<TCallApiContext>]: Hooks<TCallApiContext>[Key] | Array<Hooks<TCallApiContext>[Key]>; };
887
887
  interface HookConfigOptions {
888
888
  /**
889
889
  * Controls the execution mode of all composed hooks (main + plugin hooks).
@@ -1473,24 +1473,24 @@ type SharedExtraOptions<TCallApiContext extends CallApiContext = DefaultCallApiC
1473
1473
  */
1474
1474
  responseType?: TResponseType;
1475
1475
  /**
1476
- * Dictates how CallApi processes and returns the final result
1477
- *
1478
- - **"all"** (default): Returns `{ data, error, response }`. Standard lifecycle.
1479
- - **"onlyData"**: Returns only the data from the response.
1480
- - **"onlyResponse"**: Returns only the `Response` object.
1481
- - **"fetchApi"**: Also returns only the `Response` object, but also skips parsing of the response body internally and data/errorData schema validation.
1482
- - **"withoutResponse"**: Returns `{ data, error }`. Standard lifecycle, but omits the `response` property.
1483
- *
1484
- *
1485
- * **Note:**
1486
- * By default, simplified modes (`"onlyData"`, `"onlyResponse"`, `"fetchApi"`) do not throw errors.
1487
- * Success/failure should be handled via hooks or by checking the return value (e.g., `if (data)` or `if (response?.ok)`).
1488
- * To force an exception instead, set `throwOnError: true`.
1489
- *
1490
- *
1491
- * @default "all"
1492
- *
1493
- */
1476
+ * Dictates how CallApi processes and returns the final result
1477
+ *
1478
+ - **"all"** (default): Returns `{ data, error, response }`. Standard lifecycle.
1479
+ - **"onlyData"**: Returns only the data from the response.
1480
+ - **"onlyResponse"**: Returns only the `Response` object.
1481
+ - **"fetchApi"**: Also returns only the `Response` object, but also skips parsing of the response body internally and data/errorData schema validation.
1482
+ - **"withoutResponse"**: Returns `{ data, error }`. Standard lifecycle, but omits the `response` property.
1483
+ *
1484
+ *
1485
+ * **Note:**
1486
+ * By default, simplified modes (`"onlyData"`, `"onlyResponse"`, `"fetchApi"`) do not throw errors.
1487
+ * Success/failure should be handled via hooks or by checking the return value (e.g., `if (data)` or `if (response?.ok)`).
1488
+ * To force an exception instead, set `throwOnError: true`.
1489
+ *
1490
+ *
1491
+ * @default "all"
1492
+ *
1493
+ */
1494
1494
  resultMode?: TResultMode;
1495
1495
  /**
1496
1496
  * Controls whether errors are thrown as exceptions or returned in the result.
@@ -1710,7 +1710,7 @@ type InstanceContext = {
1710
1710
  };
1711
1711
  type BaseCallApiConfig<TBaseCallApiContext extends CallApiContext = DefaultCallApiContext, TBaseData = DefaultDataType, TBaseErrorData = DefaultDataType, TBaseResultMode extends ResultModeType = ResultModeType, TBaseThrowOnError extends ThrowOnErrorBoolean = DefaultThrowOnError, TBaseResponseType extends ResponseTypeType = ResponseTypeType, TBaseSchemaAndConfig extends BaseCallApiSchemaAndConfig = BaseCallApiSchemaAndConfig, TBasePluginArray extends CallApiPlugin[] = DefaultPluginArray, TComputedBaseConfig = BaseCallApiExtraOptions<TBaseCallApiContext, TBaseData, TBaseErrorData, TBaseResultMode, TBaseThrowOnError, TBaseResponseType, TBasePluginArray, TBaseSchemaAndConfig>> = (CallApiRequestOptions & TComputedBaseConfig) | ((context: InstanceContext) => CallApiRequestOptions & TComputedBaseConfig);
1712
1712
  type CallApiConfig<TCallApiContext extends CallApiContext = DefaultCallApiContext, TData = DefaultDataType, TErrorData = DefaultDataType, TResultMode extends ResultModeType = ResultModeType, TThrowOnError extends ThrowOnErrorBoolean = DefaultThrowOnError, TResponseType extends ResponseTypeType = ResponseTypeType, TBaseSchemaRoutes extends BaseCallApiSchemaRoutes = BaseCallApiSchemaRoutes, TSchema extends CallApiSchema = CallApiSchema, TBaseSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TInitURL extends InitURLOrURLObject = InitURLOrURLObject, TCurrentRouteSchemaKey extends string = string, TBody extends InferSchemaOutput<TSchema["body"], Body> = InferSchemaOutput<TSchema["body"], Body>, TBasePluginArray extends CallApiPlugin[] = DefaultPluginArray, TPluginArray extends CallApiPlugin[] = DefaultPluginArray> = InferExtraOptions<TSchema, TBaseSchemaRoutes, TCurrentRouteSchemaKey, TCallApiContext> & InferRequestOptions<TSchema, TInitURL, TBody> & Omit<CallApiExtraOptions<TCallApiContext, TData, TErrorData, TResultMode, TThrowOnError, TResponseType, TBasePluginArray, TPluginArray, TBaseSchemaRoutes, TSchema, TBaseSchemaConfig, TSchemaConfig, TCurrentRouteSchemaKey, TBody>, keyof InferExtraOptions<CallApiSchema, BaseCallApiSchemaRoutes, string, CallApiContext>> & Omit<CallApiRequestOptions<TBody>, keyof InferRequestOptions<CallApiSchema, string, TBody>>;
1713
- type CallApiParameters<TData = DefaultDataType, TErrorData = DefaultDataType, TResultMode extends ResultModeType = ResultModeType, TCallApiContext extends CallApiContext = DefaultCallApiContext, TThrowOnError extends ThrowOnErrorBoolean = DefaultThrowOnError, TResponseType extends ResponseTypeType = ResponseTypeType, TBaseSchemaRoutes extends BaseCallApiSchemaRoutes = BaseCallApiSchemaRoutes, TSchema extends CallApiSchema = CallApiSchema, TBaseSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TInitURL extends InitURLOrURLObject = InitURLOrURLObject, TCurrentRouteSchemaKey extends string = string, TBasePluginArray extends CallApiPlugin[] = DefaultPluginArray, TPluginArray extends CallApiPlugin[] = DefaultPluginArray, TBody extends InferSchemaOutput<TSchema["body"], Body> = InferSchemaOutput<TSchema["body"], Body>> = [initURL: TInitURL, config?: CallApiConfig<TCallApiContext, TData, TErrorData, TResultMode, TThrowOnError, TResponseType, TBaseSchemaRoutes, TSchema, TBaseSchemaConfig, TSchemaConfig, TInitURL, TCurrentRouteSchemaKey, TBody, TBasePluginArray, TPluginArray>];
1713
+ type CallApiParameters<TData = DefaultDataType, TErrorData = DefaultDataType, TResultMode extends ResultModeType = ResultModeType, TCallApiContext extends CallApiContext = DefaultCallApiContext, TThrowOnError extends ThrowOnErrorBoolean = DefaultThrowOnError, TResponseType extends ResponseTypeType = ResponseTypeType, TBaseSchemaRoutes extends BaseCallApiSchemaRoutes = BaseCallApiSchemaRoutes, TSchema extends CallApiSchema = CallApiSchema, TBaseSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TInitURL extends InitURLOrURLObject = InitURLOrURLObject, TCurrentRouteSchemaKey extends string = string, TBody extends InferSchemaOutput<TSchema["body"], Body> = InferSchemaOutput<TSchema["body"], Body>, TBasePluginArray extends CallApiPlugin[] = DefaultPluginArray, TPluginArray extends CallApiPlugin[] = DefaultPluginArray, TComputedConfig = CallApiConfig<TCallApiContext, TData, TErrorData, TResultMode, TThrowOnError, TResponseType, TBaseSchemaRoutes, TSchema, TBaseSchemaConfig, TSchemaConfig, TInitURL, TCurrentRouteSchemaKey, TBody, TBasePluginArray, TPluginArray>, TComputedRequiredOptions = InferExtraOptions<TSchema, TBaseSchemaRoutes, TCurrentRouteSchemaKey, TCallApiContext> & InferRequestOptions<TSchema, TInitURL, TBody>> = NonNullable<unknown> extends TComputedRequiredOptions ? [initURL: TInitURL, config?: TComputedConfig] : [initURL: TInitURL, config: TComputedConfig];
1714
1714
  type CallApiResult<TData, TErrorData, TResultMode extends ResultModeType, TThrowOnError extends ThrowOnErrorBoolean> = InferCallApiResult<TData, TErrorData, TResultMode, TThrowOnError>;
1715
1715
  type CallApiResultLoose<TData, TErrorData, TResultMode extends ResultModeType = ResultModeType, TThrowOnError extends ThrowOnErrorBoolean = ThrowOnErrorBoolean> = InferCallApiResult<TData, TErrorData, TResultMode, TThrowOnError>;
1716
1716
  //#endregion
@@ -1759,8 +1759,8 @@ type AuthOption = PossibleAuthValueOrGetter | BearerAuth | TokenAuth | BasicAuth
1759
1759
  type MakeSchemaOptionRequiredIfDefined<TSchemaOption extends CallApiSchema[keyof CallApiSchema], TObject> = undefined extends InferSchemaOutput<TSchemaOption, undefined> ? TObject : Required<TObject>;
1760
1760
  type MergeBaseWithRouteKey<TBaseURLOrPrefix extends string | undefined, TRouteKey extends string> = TBaseURLOrPrefix extends string ? TRouteKey extends `${AtSymbol}${infer TMethod extends RouteKeyMethods}/${infer TRestOfRoutKey}` ? `${AtSymbol}${TMethod}/${RemoveLeadingSlash<RemoveTrailingSlash<TBaseURLOrPrefix>>}/${RemoveLeadingSlash<TRestOfRoutKey>}` : `${TBaseURLOrPrefix}${TRouteKey}` : TRouteKey;
1761
1761
  type ApplyURLBasedConfig<TSchemaConfig extends CallApiSchemaConfig, TSchemaRouteKeys extends string> = TSchemaConfig["prefix"] extends string ? MergeBaseWithRouteKey<TSchemaConfig["prefix"], TSchemaRouteKeys> : TSchemaConfig["baseURL"] extends string ? MergeBaseWithRouteKey<TSchemaConfig["baseURL"], TSchemaRouteKeys> : TSchemaRouteKeys;
1762
- type ApplyStrictConfig<TSchemaConfig extends CallApiSchemaConfig, TSchemaRouteKeys extends string> = TSchemaConfig["strict"] extends true ? TSchemaRouteKeys : // eslint-disable-next-line perfectionist/sort-union-types -- Don't sort union types
1763
- TSchemaRouteKeys | Exclude<InitURLOrURLObject, RouteKeyMethodsURLUnion>;
1762
+ type ApplyStrictConfig<TSchemaConfig extends CallApiSchemaConfig, TSchemaRouteKeys extends string> = TSchemaConfig["strict"] extends true ? TSchemaRouteKeys // eslint-disable-next-line perfectionist/sort-union-types -- Don't sort union types
1763
+ : TSchemaRouteKeys | Exclude<InitURLOrURLObject, RouteKeyMethodsURLUnion>;
1764
1764
  type ApplySchemaConfiguration<TSchemaConfig extends CallApiSchemaConfig, TSchemaRouteKeys extends string> = ApplyStrictConfig<TSchemaConfig, ApplyURLBasedConfig<TSchemaConfig, TSchemaRouteKeys>>;
1765
1765
  type InferAllMainRoutes<TBaseSchemaRoutes extends BaseCallApiSchemaRoutes> = Omit<TBaseSchemaRoutes, FallBackRouteSchemaKey>;
1766
1766
  type InferAllMainRouteKeys<TBaseSchemaRoutes extends BaseCallApiSchemaRoutes, TSchemaConfig extends CallApiSchemaConfig> = ApplySchemaConfiguration<TSchemaConfig, Extract<keyof InferAllMainRoutes<TBaseSchemaRoutes>, string>>;
@@ -1824,50 +1824,50 @@ type InferMetaOption<TSchema extends CallApiSchema, TCallApiContext extends Call
1824
1824
  }>;
1825
1825
  type InferAuthOption<TSchema extends CallApiSchema> = MakeSchemaOptionRequiredIfDefined<TSchema["auth"], {
1826
1826
  /**
1827
- * Automatically add an Authorization header value.
1828
- *
1829
- * Supports multiple authentication patterns:
1830
- * - String: Direct authorization header value
1831
- * - Auth object: Structured authentication configuration
1832
- *
1833
- * @example
1834
- * ```ts
1835
- * // Bearer auth
1836
- * const response = await callMainApi({
1837
- * url: "https://example.com/api/data",
1838
- * auth: "123456",
1839
- * });
1840
- *
1841
- * // Bearer auth
1842
- * const response = await callMainApi({
1843
- * url: "https://example.com/api/data",
1844
- * auth: {
1845
- * type: "Bearer",
1846
- * value: "123456",
1847
- * },
1848
- })
1849
- *
1850
- * // Token auth
1851
- * const response = await callMainApi({
1852
- * url: "https://example.com/api/data",
1853
- * auth: {
1854
- * type: "Token",
1855
- * value: "123456",
1856
- * },
1857
- * });
1858
- *
1859
- * // Basic auth
1860
- * const response = await callMainApi({
1861
- * url: "https://example.com/api/data",
1862
- * auth: {
1863
- * type: "Basic",
1864
- * username: "username",
1865
- * password: "password",
1866
- * },
1867
- * });
1868
- *
1869
- * ```
1870
- */
1827
+ * Automatically add an Authorization header value.
1828
+ *
1829
+ * Supports multiple authentication patterns:
1830
+ * - String: Direct authorization header value
1831
+ * - Auth object: Structured authentication configuration
1832
+ *
1833
+ * @example
1834
+ * ```ts
1835
+ * // Bearer auth
1836
+ * const response = await callMainApi({
1837
+ * url: "https://example.com/api/data",
1838
+ * auth: "123456",
1839
+ * });
1840
+ *
1841
+ * // Bearer auth
1842
+ * const response = await callMainApi({
1843
+ * url: "https://example.com/api/data",
1844
+ * auth: {
1845
+ * type: "Bearer",
1846
+ * value: "123456",
1847
+ * },
1848
+ })
1849
+ *
1850
+ * // Token auth
1851
+ * const response = await callMainApi({
1852
+ * url: "https://example.com/api/data",
1853
+ * auth: {
1854
+ * type: "Token",
1855
+ * value: "123456",
1856
+ * },
1857
+ * });
1858
+ *
1859
+ * // Basic auth
1860
+ * const response = await callMainApi({
1861
+ * url: "https://example.com/api/data",
1862
+ * auth: {
1863
+ * type: "Basic",
1864
+ * username: "username",
1865
+ * password: "password",
1866
+ * },
1867
+ * });
1868
+ *
1869
+ * ```
1870
+ */
1871
1871
  auth?: InferSchemaOutput<TSchema["auth"], AuthOption>;
1872
1872
  }>;
1873
1873
  type InferQueryOption<TSchema extends CallApiSchema> = MakeSchemaOptionRequiredIfDefined<TSchema["query"], {
@@ -1911,5 +1911,5 @@ type ThrowOnErrorOption<TErrorData, TThrowOnError extends ThrowOnErrorBoolean> =
1911
1911
  throwOnError?: ThrowOnErrorType<TErrorData, TThrowOnError>;
1912
1912
  };
1913
1913
  //#endregion
1914
- export { defineSchema as $, CallApiExtraOptionsForHooks as A, BaseSchemaRouteKeyPrefixes as At, SuccessContext as B, DistributiveOmit as Bt, GetBaseSchemaRoutes as C, ResponseTypeMap as Ct, InstanceContext as D, ValidationError as Dt, GlobalMeta as E, HTTPError as Et, RequestContext as F, InferSchemaResult as Ft, isHTTPErrorInstance as G, RetryOptions as H, Writeable as Ht, RequestStreamContext as I, URLOptions as It, isValidationErrorInstance as J, isJavascriptError as K, ResponseContext as L, FallBackRouteSchemaKey as Lt, ErrorContext as M, CallApiSchemaConfig as Mt, Hooks as N, InferSchemaInput as Nt, Register as O, BaseCallApiSchemaAndConfig as Ot, HooksOrHooksArray as P, InferSchemaOutput as Pt, definePlugin as Q, ResponseErrorContext as R, fallBackRouteSchemaKey as Rt, GetBaseSchemaConfig as S, PossibleValidationError as St, GetCallApiContextRequired as T, ResultModeType as Tt, objectifyHeaders as U, fetchSpecificKeys as Ut, RefetchOptions as V, NoInferUnMasked as Vt, isHTTPError as W, defineInstanceConfig as X, defineBaseConfig as Y, defineMainSchema as Z, CallApiExtraOptions as _, CallApiResultSuccessVariant as _t, GetCurrentRouteSchemaKey as a, DefaultCallApiContext as at, CallApiResult as b, PossibleHTTPError as bt, InferInitURL as c, CallApiPlugin as ct, SerializableObject as d, PluginSetupContext as dt, defineSchemaConfig as et, ThrowOnErrorBoolean as f, FetchImpl as ft, CallApiContext as g, CallApiResultSuccessOrErrorVariant as gt, CallApiConfig as h, CallApiResultErrorVariant as ht, GetCurrentRouteSchema as i, toSearchParams as it, CallApiRequestOptionsForHooks as j, CallApiSchema as jt, DedupeOptions as k, BaseCallApiSchemaRoutes as kt, InferParamsFromRoute as l, PluginHooks as lt, BaseCallApiExtraOptions as m, Middlewares as mt, ApplyURLBasedConfig as n, toFormData as nt, InferAllMainRouteKeys as o, DefaultDataType as ot, BaseCallApiConfig as p, FetchMiddlewareContext as pt, isValidationError as q, Body as r, toQueryString as rt, InferAllMainRoutes as s, DefaultPluginArray as st, ApplyStrictConfig as t, defineSchemaRoutes as tt, SerializableArray as u, PluginMiddlewares as ut, CallApiParameters as v, GetResponseType as vt, GetCallApiContext as w, ResponseTypeType as wt, CallApiResultLoose as x, PossibleJavaScriptError as xt, CallApiRequestOptions as y, InferCallApiResult as yt, ResponseStreamContext as z, AnyString as zt };
1915
- //# sourceMappingURL=conditional-types-BXgYQJ5q.d.ts.map
1914
+ 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-BFeM4YSg.d.ts.map
@@ -1,5 +1,4 @@
1
- import { F as RequestContext, Lt as FallBackRouteSchemaKey, Rt as fallBackRouteSchemaKey, Ut as fetchSpecificKeys } from "../conditional-types-BXgYQJ5q.js";
2
-
1
+ import { Bt as fallBackRouteSchemaKey, L as RequestContext, qt as fetchSpecificKeys, zt as FallBackRouteSchemaKey } from "../conditional-types-BFeM4YSg.js";
3
2
  //#region src/constants/defaults.d.ts
4
3
  declare const extraOptionDefaults: Readonly<Readonly<{
5
4
  bodySerializer: {
@@ -1,2 +1,2 @@
1
- import { F as fallBackRouteSchemaKey, n as requestOptionDefaults, t as extraOptionDefaults, z as fetchSpecificKeys } from "../constants-CQmUuQDT.js";
1
+ import { F as fallBackRouteSchemaKey, n as requestOptionDefaults, t as extraOptionDefaults, z as fetchSpecificKeys } from "../constants-DB6Z7gFB.js";
2
2
  export { extraOptionDefaults, fallBackRouteSchemaKey, fetchSpecificKeys, requestOptionDefaults };
@@ -323,19 +323,24 @@ const getCurrentRouteSchemaKeyAndMainInitURL = (context) => {
323
323
  const { methodFromURL, pathWithoutMethod } = extractURLParts(initURL);
324
324
  const prefixWithoutLeadingSlash = schemaConfig?.prefix && removeLeadingSlash(schemaConfig.prefix);
325
325
  if (prefixWithoutLeadingSlash && pathWithoutMethod.startsWith(prefixWithoutLeadingSlash)) {
326
+ const restOfPathWithoutPrefix = pathWithoutMethod.slice(prefixWithoutLeadingSlash.length);
326
327
  currentRouteSchemaKey = mergeURLParts({
327
328
  method: methodFromURL,
328
- path: pathWithoutMethod.slice(prefixWithoutLeadingSlash.length)
329
+ path: restOfPathWithoutPrefix
329
330
  });
331
+ const pathWithReplacedPrefix = pathWithoutMethod.replace(prefixWithoutLeadingSlash, schemaConfig.baseURL ?? "");
330
332
  mainInitURL = mergeURLParts({
331
333
  method: methodFromURL,
332
- path: pathWithoutMethod.replace(prefixWithoutLeadingSlash, schemaConfig.baseURL ?? "")
334
+ path: pathWithReplacedPrefix
335
+ });
336
+ }
337
+ if (schemaConfig?.baseURL && pathWithoutMethod.startsWith(schemaConfig.baseURL)) {
338
+ const restOfPathWithoutBaseURL = pathWithoutMethod.slice(schemaConfig.baseURL.length);
339
+ currentRouteSchemaKey = mergeURLParts({
340
+ method: methodFromURL,
341
+ path: restOfPathWithoutBaseURL
333
342
  });
334
343
  }
335
- if (schemaConfig?.baseURL && pathWithoutMethod.startsWith(schemaConfig.baseURL)) currentRouteSchemaKey = mergeURLParts({
336
- method: methodFromURL,
337
- path: pathWithoutMethod.slice(schemaConfig.baseURL.length)
338
- });
339
344
  return {
340
345
  currentRouteSchemaKey,
341
346
  initURL,
@@ -681,4 +686,4 @@ const requestOptionDefaults = Object.freeze(defineEnum({ method: "GET" }));
681
686
  //#endregion
682
687
  export { getCurrentRouteSchemaKeyAndMainInitURL as A, defineSchema as C, toQueryString as D, toFormData as E, fallBackRouteSchemaKey as F, isArray as I, isFunction as L, handleSchemaValidation as M, HTTPError as N, toSearchParams as O, ValidationError as P, isString as R, definePlugin as S, defineSchemaRoutes as T, isValidationError as _, getBody as a, defineInstanceConfig as b, getMethod as c, splitConfig as d, waitFor as f, isJavascriptError as g, isHTTPErrorInstance as h, createTimeoutSignal as i, handleConfigValidation as j, getFullAndNormalizedURL as k, getResolvedHeaders as l, isHTTPError as m, requestOptionDefaults as n, getFetchImpl as o, objectifyHeaders as p, createCombinedSignal as r, getHeaders as s, extraOptionDefaults as t, omitKeys as u, isValidationErrorInstance as v, defineSchemaConfig as w, defineMainSchema as x, defineBaseConfig as y, fetchSpecificKeys as z };
683
688
 
684
- //# sourceMappingURL=constants-CQmUuQDT.js.map
689
+ //# sourceMappingURL=constants-DB6Z7gFB.js.map