@zayne-labs/callapi 1.11.1 → 1.11.3

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.
@@ -1,8 +1,8 @@
1
- import { AnyFunction, AnyString, ApplyStrictConfig, ApplyURLBasedConfig, BaseCallApiConfig, BaseCallApiExtraOptions, BaseCallApiSchemaAndConfig, BaseCallApiSchemaRoutes, CallApiConfig, CallApiExtraOptions, CallApiExtraOptionsForHooks, CallApiParameters, CallApiPlugin, CallApiRequestOptions, CallApiRequestOptionsForHooks, CallApiResult, CallApiResultErrorVariant, CallApiResultSuccessVariant, CallApiSchema, CallApiSchemaConfig, DedupeOptions, DefaultDataType, DefaultPluginArray, DefaultThrowOnError, ErrorContext, GetCurrentRouteSchema, GetCurrentRouteSchemaKey, GetResponseType, HTTPError, Hooks, HooksOrHooksArray, InferInitURL, InferParamsFromRoute, InferSchemaOutputResult, PluginExtraOptions, PluginHooks, PluginHooksWithMoreOptions, PluginSetupContext, PossibleHTTPError, PossibleJavaScriptError, PossibleJavaScriptOrValidationError, PossibleValidationError, Register, RequestContext, RequestStreamContext, ResponseContext, ResponseErrorContext, ResponseStreamContext, ResponseTypeMap, ResponseTypeUnion, ResultModeUnion, RetryOptions, SuccessContext, ThrowOnErrorUnion, URLOptions, ValidationError, Writeable, fallBackRouteSchemaKey } from "./common-BMWVqV15.js";
1
+ import { AnyFunction, AnyString, ApplyStrictConfig, ApplyURLBasedConfig, BaseCallApiConfig, BaseCallApiExtraOptions, BaseCallApiSchemaAndConfig, BaseCallApiSchemaRoutes, CallApiConfig, CallApiExtraOptions, CallApiExtraOptionsForHooks, CallApiParameters, CallApiPlugin, CallApiRequestOptions, CallApiRequestOptionsForHooks, CallApiResult, CallApiResultErrorVariant, CallApiResultSuccessVariant, CallApiSchema, CallApiSchemaConfig, CallApiSuccessOrErrorVariant, DedupeOptions, DefaultDataType, DefaultPluginArray, DefaultThrowOnError, ErrorContext, GetCallApiResult, GetCurrentRouteSchema, GetCurrentRouteSchemaKey, GetResponseType, HTTPError, Hooks, HooksOrHooksArray, InferInitURL, InferParamsFromRoute, InferSchemaOutputResult, PluginExtraOptions, PluginHooks, PluginHooksWithMoreOptions, PluginSetupContext, PossibleHTTPError, PossibleJavaScriptError, PossibleJavaScriptOrValidationError, PossibleValidationError, Register, RequestContext, RequestStreamContext, ResponseContext, ResponseErrorContext, ResponseStreamContext, ResponseTypeMap, ResponseTypeUnion, ResultModeMap, ResultModeUnion, RetryOptions, SuccessContext, ThrowOnErrorUnion, URLOptions, ValidationError, Writeable, fallBackRouteSchemaKey } from "./common-B-TYbBQa.js";
2
2
 
3
3
  //#region src/createFetchClient.d.ts
4
4
 
5
- declare const createFetchClient: <TBaseData = DefaultDataType, TBaseErrorData = DefaultDataType, TBaseResultMode extends ResultModeUnion = ResultModeUnion, TBaseThrowOnError extends ThrowOnErrorUnion = DefaultThrowOnError, TBaseResponseType extends ResponseTypeUnion = ResponseTypeUnion, const TBaseSchemaAndConfig extends BaseCallApiSchemaAndConfig = BaseCallApiSchemaAndConfig, const TBasePluginArray extends CallApiPlugin[] = DefaultPluginArray, TComputedBaseSchemaConfig extends CallApiSchemaConfig = NonNullable<Writeable<TBaseSchemaAndConfig["config"], "deep">>, TComputedBaseSchemaRoutes extends BaseCallApiSchemaRoutes = Writeable<TBaseSchemaAndConfig["routes"], "deep">>(initBaseConfig?: BaseCallApiConfig<TBaseData, TBaseErrorData, TBaseResultMode, TBaseThrowOnError, TBaseResponseType, TBaseSchemaAndConfig, TBasePluginArray>) => <TData = TBaseData, TErrorData = TBaseErrorData, TResultMode extends ResultModeUnion = TBaseResultMode, TThrowOnError extends ThrowOnErrorUnion = TBaseThrowOnError, TResponseType extends ResponseTypeUnion = 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>, const TPluginArray extends CallApiPlugin[] = TBasePluginArray>(initURL: TInitURL, config?: CallApiConfig<InferSchemaOutputResult<TSchema["data"], GetResponseType<TData, TResponseType>>, InferSchemaOutputResult<TSchema["errorData"], GetResponseType<TErrorData, TResponseType>>, TResultMode, TThrowOnError, TResponseType, TComputedBaseSchemaRoutes, TSchema, TComputedBaseSchemaConfig, TSchemaConfig, TInitURL, TCurrentRouteSchemaKey, TBasePluginArray, TPluginArray> | undefined) => CallApiResult<InferSchemaOutputResult<TSchema["data"], TData>, InferSchemaOutputResult<TSchema["errorData"], TErrorData>, TResultMode, TThrowOnError, TResponseType>;
5
+ declare const createFetchClient: <TBaseData = DefaultDataType, TBaseErrorData = DefaultDataType, TBaseResultMode extends ResultModeUnion = ResultModeUnion, TBaseThrowOnError extends ThrowOnErrorUnion = DefaultThrowOnError, TBaseResponseType extends ResponseTypeUnion = ResponseTypeUnion, const TBaseSchemaAndConfig extends BaseCallApiSchemaAndConfig = BaseCallApiSchemaAndConfig, const TBasePluginArray extends CallApiPlugin[] = DefaultPluginArray, TComputedBaseSchemaConfig extends CallApiSchemaConfig = NonNullable<Writeable<TBaseSchemaAndConfig["config"], "deep">>, TComputedBaseSchemaRoutes extends BaseCallApiSchemaRoutes = Writeable<TBaseSchemaAndConfig["routes"], "deep">>(initBaseConfig?: BaseCallApiConfig<TBaseData, TBaseErrorData, TBaseResultMode, TBaseThrowOnError, TBaseResponseType, TBaseSchemaAndConfig, TBasePluginArray>) => <TData = TBaseData, TErrorData = TBaseErrorData, TResultMode extends ResultModeUnion = TBaseResultMode, TThrowOnError extends ThrowOnErrorUnion = TBaseThrowOnError, TResponseType extends ResponseTypeUnion = 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>, const TPluginArray extends CallApiPlugin[] = TBasePluginArray, TComputedResult = CallApiResult<InferSchemaOutputResult<TSchema["data"], TData>, InferSchemaOutputResult<TSchema["errorData"], TErrorData>, TResultMode, TThrowOnError, TResponseType>>(initURL: TInitURL, config?: CallApiConfig<InferSchemaOutputResult<TSchema["data"], GetResponseType<TData, TResponseType>>, InferSchemaOutputResult<TSchema["errorData"], GetResponseType<TErrorData, TResponseType>>, TResultMode, TThrowOnError, TResponseType, TComputedBaseSchemaRoutes, TSchema, TComputedBaseSchemaConfig, TSchemaConfig, TInitURL, TCurrentRouteSchemaKey, TBasePluginArray, TPluginArray> | undefined) => Promise<TComputedResult>;
6
6
  declare const callApi: <TData = unknown, TErrorData = unknown, TResultMode extends ResultModeUnion = ResultModeUnion, TThrowOnError extends ThrowOnErrorUnion = boolean, TResponseType extends ResponseTypeUnion = ResponseTypeUnion, const TSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TInitURL extends ApplyStrictConfig<TSchemaConfig, ApplyURLBasedConfig<TSchemaConfig, AnyString | "@delete/" | "@get/" | "@patch/" | "@post/" | "@put/">> = ApplyStrictConfig<TSchemaConfig, ApplyURLBasedConfig<TSchemaConfig, AnyString | "@delete/" | "@get/" | "@patch/" | "@post/" | "@put/">>, TCurrentRouteSchemaKey extends GetCurrentRouteSchemaKey<TSchemaConfig, TInitURL> = GetCurrentRouteSchemaKey<TSchemaConfig, TInitURL>, const TSchema extends CallApiSchema = GetCurrentRouteSchema<{
7
7
  [x: AnyString]: CallApiSchema | undefined;
8
8
  "@delete/"?: CallApiSchema | undefined;
@@ -38,14 +38,18 @@ declare const callApi: <TData = unknown, TErrorData = unknown, TResultMode exten
38
38
  "@patch/"?: CallApiSchema | undefined;
39
39
  "@post/"?: CallApiSchema | undefined;
40
40
  "@put/"?: CallApiSchema | undefined;
41
- }[TCurrentRouteSchemaKey], "deep">>>, const TPluginArray extends CallApiPlugin[] = DefaultPluginArray>(initURL: TInitURL, config?: CallApiConfig<InferSchemaOutputResult<TSchema["data"], GetResponseType<TData, TResponseType, ResponseTypeMap<TData>>>, InferSchemaOutputResult<TSchema["errorData"], GetResponseType<TErrorData, TResponseType, ResponseTypeMap<TErrorData>>>, TResultMode, TThrowOnError, TResponseType, {
41
+ }[TCurrentRouteSchemaKey], "deep">>>, const TPluginArray extends CallApiPlugin[] = DefaultPluginArray, TComputedResult = GetCallApiResult<InferSchemaOutputResult<TSchema["data"], TData>, InferSchemaOutputResult<TSchema["errorData"], TErrorData>, TResultMode, TThrowOnError, TResponseType, {
42
+ all: CallApiResultSuccessVariant<GetResponseType<InferSchemaOutputResult<TSchema["data"], TData>, TResponseType, ResponseTypeMap<InferSchemaOutputResult<TSchema["data"], TData>>>>;
43
+ onlyData: NoInfer<GetResponseType<InferSchemaOutputResult<TSchema["data"], TData>, TResponseType, ResponseTypeMap<InferSchemaOutputResult<TSchema["data"], TData>>>>;
44
+ onlyResponse: Response;
45
+ }, ResultModeMap<InferSchemaOutputResult<TSchema["data"], TData>, InferSchemaOutputResult<TSchema["errorData"], TErrorData>, TResponseType, TThrowOnError>>>(initURL: TInitURL, config?: CallApiConfig<InferSchemaOutputResult<TSchema["data"], GetResponseType<TData, TResponseType, ResponseTypeMap<TData>>>, InferSchemaOutputResult<TSchema["errorData"], GetResponseType<TErrorData, TResponseType, ResponseTypeMap<TErrorData>>>, TResultMode, TThrowOnError, TResponseType, {
42
46
  [x: AnyString]: CallApiSchema | undefined;
43
47
  "@delete/"?: CallApiSchema | undefined;
44
48
  "@get/"?: CallApiSchema | undefined;
45
49
  "@patch/"?: CallApiSchema | undefined;
46
50
  "@post/"?: CallApiSchema | undefined;
47
51
  "@put/"?: CallApiSchema | undefined;
48
- }, TSchema, CallApiSchemaConfig, TSchemaConfig, TInitURL, TCurrentRouteSchemaKey, DefaultPluginArray, TPluginArray> | undefined) => CallApiResult<InferSchemaOutputResult<TSchema["data"], TData>, InferSchemaOutputResult<TSchema["errorData"], TErrorData>, TResultMode, TThrowOnError, TResponseType>;
52
+ }, TSchema, CallApiSchemaConfig, TSchemaConfig, TInitURL, TCurrentRouteSchemaKey, DefaultPluginArray, TPluginArray> | undefined) => Promise<TComputedResult>;
49
53
  //#endregion
50
54
  //#region src/defineHelpers.d.ts
51
55
  declare const defineSchema: <const TBaseSchemaRoutes extends BaseCallApiSchemaRoutes, const TSchemaConfig extends CallApiSchemaConfig>(routes: TBaseSchemaRoutes, config?: TSchemaConfig) => {
@@ -58,5 +62,5 @@ declare const definePlugin: <const TPlugin extends CallApiPlugin | AnyFunction<C
58
62
  declare const defineBaseConfig: <const TBaseConfig extends BaseCallApiConfig>(baseConfig: TBaseConfig) => Writeable<typeof baseConfig, "deep">;
59
63
  declare const defineParameters: <TData = DefaultDataType, TErrorData = DefaultDataType, TResultMode extends ResultModeUnion = ResultModeUnion, TThrowOnError extends ThrowOnErrorUnion = DefaultThrowOnError, TResponseType extends ResponseTypeUnion = ResponseTypeUnion, TBaseSchemaRoutes extends BaseCallApiSchemaRoutes = BaseCallApiSchemaRoutes, TSchema extends CallApiSchema = CallApiSchema, TBaseSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TInitURL extends InferInitURL<BaseCallApiSchemaRoutes, TSchemaConfig> = InferInitURL<BaseCallApiSchemaRoutes, TSchemaConfig>, TCurrentRouteSchemaKey extends string = string, TBasePluginArray extends CallApiPlugin[] = DefaultPluginArray, TPluginArray extends CallApiPlugin[] = DefaultPluginArray>(...parameters: CallApiParameters<TData, TErrorData, TResultMode, TThrowOnError, TResponseType, TBaseSchemaRoutes, TSchema, TBaseSchemaConfig, TSchemaConfig, TInitURL, TCurrentRouteSchemaKey, TBasePluginArray, TPluginArray>) => CallApiParameters<TData, TErrorData, TResultMode, TThrowOnError, TResponseType, TBaseSchemaRoutes, TSchema, TBaseSchemaConfig, TSchemaConfig, TInitURL, TCurrentRouteSchemaKey, TBasePluginArray, TPluginArray>;
60
64
  //#endregion
61
- export { type BaseCallApiConfig, type BaseCallApiExtraOptions, type BaseCallApiSchemaRoutes, type CallApiConfig, type CallApiExtraOptions, type CallApiExtraOptionsForHooks, type CallApiParameters, type CallApiPlugin, type CallApiRequestOptions, type CallApiRequestOptionsForHooks, type CallApiResult, type CallApiResultErrorVariant, type CallApiResultSuccessVariant, type CallApiSchema, type CallApiSchemaConfig, type DedupeOptions, type ErrorContext, HTTPError, type Hooks, type HooksOrHooksArray, type InferParamsFromRoute, type InferSchemaOutputResult, type PluginExtraOptions, type PluginHooks, type PluginHooksWithMoreOptions, type PluginSetupContext, type PossibleHTTPError, type PossibleJavaScriptError, type PossibleJavaScriptOrValidationError, type PossibleValidationError, type Register, type RequestContext, type RequestStreamContext, type ResponseContext, type ResponseErrorContext, type ResponseStreamContext, type ResponseTypeUnion, type ResultModeUnion, type RetryOptions, type SuccessContext, type URLOptions, ValidationError, callApi, createFetchClient, defineBaseConfig, defineParameters, definePlugin, defineSchema, defineSchemaConfig, defineSchemaRoutes, fallBackRouteSchemaKey };
65
+ export { type BaseCallApiConfig, type BaseCallApiExtraOptions, type BaseCallApiSchemaRoutes, type CallApiConfig, type CallApiExtraOptions, type CallApiExtraOptionsForHooks, type CallApiParameters, type CallApiPlugin, type CallApiRequestOptions, type CallApiRequestOptionsForHooks, type CallApiResult, type CallApiResultErrorVariant, type CallApiResultSuccessVariant, type CallApiSchema, type CallApiSchemaConfig, type CallApiSuccessOrErrorVariant, type DedupeOptions, type ErrorContext, HTTPError, type Hooks, type HooksOrHooksArray, type InferParamsFromRoute, type InferSchemaOutputResult, type PluginExtraOptions, type PluginHooks, type PluginHooksWithMoreOptions, type PluginSetupContext, type PossibleHTTPError, type PossibleJavaScriptError, type PossibleJavaScriptOrValidationError, type PossibleValidationError, type Register, type RequestContext, type RequestStreamContext, type ResponseContext, type ResponseErrorContext, type ResponseStreamContext, type ResponseTypeUnion, type ResultModeUnion, type RetryOptions, type SuccessContext, type URLOptions, ValidationError, callApi, createFetchClient, defineBaseConfig, defineParameters, definePlugin, defineSchema, defineSchemaConfig, defineSchemaRoutes, fallBackRouteSchemaKey };
62
66
  //# sourceMappingURL=index.d.ts.map
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { HTTPError, ValidationError, createCombinedSignal, createTimeoutSignal, deterministicHashFn, extraOptionDefaults, fallBackRouteSchemaKey, getBody, getCurrentRouteSchemaKeyAndMainInitURL, getFetchImpl, getFullAndNormalizedURL, getHeaders, getMethod, handleConfigValidation, handleSchemaValidation, isArray, isBoolean, isFunction, isHTTPErrorInstance, isObject, isPlainObject, isReadableStream, isString, isValidationErrorInstance, splitBaseConfig, splitConfig, waitFor } from "./common-B2rPuIEQ.js";
1
+ import { HTTPError, ValidationError, createCombinedSignal, createTimeoutSignal, deterministicHashFn, extraOptionDefaults, fallBackRouteSchemaKey, getBody, getCurrentRouteSchemaKeyAndMainInitURL, getFetchImpl, getFullAndNormalizedURL, getHeaders, getMethod, handleConfigValidation, handleSchemaValidation, isArray, isBoolean, isFunction, isHTTPErrorInstance, isObject, isPlainObject, isReadableStream, isString, isValidationErrorInstance, splitBaseConfig, splitConfig, waitFor } from "./common-CfCB_X1k.js";
2
2
 
3
3
  //#region src/result.ts
4
4
  const getResponseType = (response, parser) => ({
@@ -36,7 +36,8 @@ const resolveResponseData = (response, responseType, parser) => {
36
36
  const getResultModeMap = (details) => {
37
37
  return {
38
38
  all: () => details,
39
- onlyData: () => details.data
39
+ onlyData: () => details.data,
40
+ onlyResponse: () => details.response
40
41
  };
41
42
  };
42
43
  const resolveSuccessResult = (data, info) => {
@@ -86,10 +87,10 @@ const resolveErrorResult = (error, info) => {
86
87
  response: cloneResponse ? response.clone() : response
87
88
  };
88
89
  }
89
- const generalErrorResult = getResultModeMap(errorDetails)[resultMode ?? "all"]();
90
+ const errorResult = getResultModeMap(errorDetails)[resultMode ?? "all"]();
90
91
  return {
91
92
  errorDetails,
92
- generalErrorResult
93
+ errorResult
93
94
  };
94
95
  };
95
96
  const getCustomizedErrorResult = (errorResult, customErrorInfo) => {
@@ -125,7 +126,7 @@ const getHookRegistriesAndKeys = () => {
125
126
  hookRegistryKeys: Object.keys(hookRegistries)
126
127
  };
127
128
  };
128
- const composeAllHooks = (hooksArray, hooksExecutionMode) => {
129
+ const composeHooksFromArray = (hooksArray, hooksExecutionMode) => {
129
130
  const composedHook = async (ctx) => {
130
131
  switch (hooksExecutionMode) {
131
132
  case "parallel":
@@ -148,7 +149,7 @@ const executeHooksInCatchBlock = async (hookResultsOrPromise, hookInfo) => {
148
149
  await Promise.all(hookResultsOrPromise);
149
150
  return null;
150
151
  } catch (hookError) {
151
- const { generalErrorResult: hookErrorResult } = resolveErrorResult(hookError, errorInfo);
152
+ const { errorResult: hookErrorResult } = resolveErrorResult(hookError, errorInfo);
152
153
  if (shouldThrowOnError) throw hookError;
153
154
  return hookErrorResult;
154
155
  }
@@ -340,12 +341,22 @@ const getMiddlewareRegistriesAndKeys = () => {
340
341
  middlewareRegistryKeys: Object.keys(middlewareRegistries)
341
342
  };
342
343
  };
343
- const composeAllMiddlewares = (middlewareArray) => {
344
+ const composeMiddlewaresFromArray = (middlewareArray) => {
344
345
  let composedMiddleware;
345
346
  for (const currentMiddleware of middlewareArray) {
346
347
  if (!currentMiddleware) continue;
347
348
  const previousMiddleware = composedMiddleware;
348
- composedMiddleware = previousMiddleware ? (fetchImpl) => currentMiddleware(previousMiddleware(fetchImpl)) : currentMiddleware;
349
+ if (!previousMiddleware) {
350
+ composedMiddleware = currentMiddleware;
351
+ continue;
352
+ }
353
+ composedMiddleware = (context) => {
354
+ const prevFetchImpl = previousMiddleware(context);
355
+ return currentMiddleware({
356
+ ...context,
357
+ fetchImpl: prevFetchImpl
358
+ });
359
+ };
349
360
  }
350
361
  return composedMiddleware;
351
362
  };
@@ -461,7 +472,7 @@ const setupHooksAndMiddlewares = (context) => {
461
472
  if (hookRegistry.size === 0) continue;
462
473
  const flattenedHookArray = [...hookRegistry].flat();
463
474
  if (flattenedHookArray.length === 0) continue;
464
- resolvedHooks[hookName] = composeAllHooks(flattenedHookArray, options.hooksExecutionMode ?? extraOptionDefaults.hooksExecutionMode);
475
+ resolvedHooks[hookName] = composeHooksFromArray(flattenedHookArray, options.hooksExecutionMode ?? extraOptionDefaults.hooksExecutionMode);
465
476
  }
466
477
  return resolvedHooks;
467
478
  };
@@ -471,7 +482,7 @@ const setupHooksAndMiddlewares = (context) => {
471
482
  if (middlewareRegistry.size === 0) continue;
472
483
  const middlewareArray = [...middlewareRegistry];
473
484
  if (middlewareArray.length === 0) continue;
474
- resolvedMiddlewares[middlewareName] = composeAllMiddlewares(middlewareArray);
485
+ resolvedMiddlewares[middlewareName] = composeMiddlewaresFromArray(middlewareArray);
475
486
  }
476
487
  return resolvedMiddlewares;
477
488
  };
@@ -631,14 +642,19 @@ const createFetchClient = (initBaseConfig = {}) => {
631
642
  ...validHeaders && { headers: validHeaders },
632
643
  ...validMethod && { method: validMethod }
633
644
  });
634
- await executeHooks(options.onRequestReady?.({
645
+ const readyRequestContext = {
635
646
  baseConfig,
636
647
  config,
637
648
  options,
638
649
  request
639
- }));
650
+ };
651
+ await executeHooks(options.onRequestReady?.(readyRequestContext));
640
652
  const response = await handleRequestDeferStrategy({
641
- fetchApi: getFetchImpl(options.customFetchImpl, options.fetchMiddleware),
653
+ fetchApi: getFetchImpl({
654
+ customFetchImpl: options.customFetchImpl,
655
+ fetchMiddleware: options.fetchMiddleware,
656
+ requestContext: readyRequestContext
657
+ }),
642
658
  options,
643
659
  request
644
660
  });
@@ -680,7 +696,7 @@ const createFetchClient = (initBaseConfig = {}) => {
680
696
  cloneResponse: options.cloneResponse,
681
697
  resultMode: options.resultMode
682
698
  };
683
- const { errorDetails, generalErrorResult } = resolveErrorResult(error, errorInfo);
699
+ const { errorDetails, errorResult } = resolveErrorResult(error, errorInfo);
684
700
  const errorContext = {
685
701
  baseConfig,
686
702
  config,
@@ -710,7 +726,7 @@ const createFetchClient = (initBaseConfig = {}) => {
710
726
  });
711
727
  }
712
728
  if (shouldThrowOnError) throw error;
713
- return generalErrorResult;
729
+ return errorResult;
714
730
  };
715
731
  if (isValidationErrorInstance(error)) return await executeHooksInCatchBlock([options.onValidationError?.(errorContext), options.onError?.(errorContext)], hookInfo) ?? await handleRetryOrGetErrorResult();
716
732
  if (isHTTPErrorInstance(error)) return await executeHooksInCatchBlock([