@zayne-labs/callapi-plugins 4.0.10 → 4.0.12

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.
Files changed (2) hide show
  1. package/dist/esm/index.d.ts +224 -126
  2. package/package.json +3 -3
@@ -1,6 +1,15 @@
1
+ import * as _zayne_labs_callapi_utils0 from "@zayne-labs/callapi/utils";
1
2
  import { AnyFunction } from "@zayne-labs/toolkit-type-helpers";
2
3
 
3
- //#region ../callapi/dist/esm/common-DvPxUh-h.d.ts
4
+ //#region ../callapi/dist/esm/validation-uPnlxhfx.d.ts
5
+ //#region src/constants/common.d.ts
6
+ declare const fetchSpecificKeys: readonly (keyof RequestInit | "duplex")[];
7
+ //#endregion
8
+ //#region src/constants/validation.d.ts
9
+ declare const fallBackRouteSchemaKey = ".";
10
+ //#endregion
11
+ //#endregion
12
+ //#region ../callapi/dist/esm/common-Clx7i8bR.d.ts
4
13
  //#region src/types/type-helpers.d.ts
5
14
  type AnyString = string & NonNullable<unknown>;
6
15
  type AnyNumber = number & NonNullable<unknown>;
@@ -64,8 +73,13 @@ type CustomAuth = {
64
73
  };
65
74
  type Auth = PossibleAuthValueOrGetter | BearerOrTokenAuth | BasicAuth | CustomAuth;
66
75
  //#endregion
67
- //#region src/constants/common.d.ts
68
- declare const fetchSpecificKeys: readonly (keyof RequestInit | "duplex")[];
76
+ //#region src/utils/external/body.d.ts
77
+
78
+ //#endregion
79
+ //#region src/types/default-types.d.ts
80
+ type DefaultDataType = unknown;
81
+ type DefaultPluginArray = CallApiPlugin[];
82
+ type DefaultThrowOnError = boolean;
69
83
  //#endregion
70
84
  //#region src/types/standard-schema.d.ts
71
85
  /**
@@ -288,7 +302,9 @@ interface URLOptions {
288
302
  }
289
303
  //#endregion
290
304
  //#region src/validation.d.ts
291
- type InferSchemaOutputResult<TSchema$1, TFallbackResult = unknown> = undefined extends TSchema$1 ? TFallbackResult : TSchema$1 extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<TSchema$1> : TSchema$1 extends AnyFunction$1<infer TResult> ? Awaited<TResult> : TFallbackResult;
305
+ type ResultVariant = "infer-input" | "infer-output";
306
+ type InferSchemaResult<TSchema$1, TFallbackResult, TResultVariant extends ResultVariant> = undefined extends TSchema$1 ? TFallbackResult : TSchema$1 extends StandardSchemaV1 ? TResultVariant extends "infer-input" ? StandardSchemaV1.InferInput<TSchema$1> : StandardSchemaV1.InferOutput<TSchema$1> : TSchema$1 extends AnyFunction$1<infer TResult> ? Awaited<TResult> : TFallbackResult;
307
+ type InferSchemaInput<TSchema$1, TFallbackResult = unknown> = InferSchemaResult<TSchema$1, TFallbackResult, "infer-input">;
292
308
  interface CallApiSchemaConfig {
293
309
  /**
294
310
  * The base url of the schema. By default it's the baseURL of the callApi instance.
@@ -367,26 +383,25 @@ type BaseCallApiSchemaAndConfig = {
367
383
  config?: CallApiSchemaConfig;
368
384
  routes: BaseCallApiSchemaRoutes;
369
385
  };
370
- declare const fallBackRouteSchemaKey = ".";
371
386
  type FallBackRouteSchemaKey = typeof fallBackRouteSchemaKey;
372
387
  //#endregion
373
- //#region src/error.d.ts
374
- type HTTPErrorDetails<TErrorData> = Pick<CallApiExtraOptions, "defaultHTTPErrorMessage"> & {
375
- errorData: TErrorData;
388
+ //#region src/utils/external/error.d.ts
389
+ type HTTPErrorDetails<TErrorData$1> = Pick<CallApiExtraOptions, "defaultHTTPErrorMessage"> & {
390
+ errorData: TErrorData$1;
376
391
  response: Response;
377
392
  };
378
- declare class HTTPError<TErrorData = Record<string, unknown>> extends Error {
379
- errorData: HTTPErrorDetails<TErrorData>["errorData"];
393
+ declare class HTTPError<TErrorData$1 = Record<string, unknown>> extends Error {
394
+ errorData: HTTPErrorDetails<TErrorData$1>["errorData"];
380
395
  readonly httpErrorSymbol: symbol;
381
396
  name: "HTTPError";
382
- response: HTTPErrorDetails<TErrorData>["response"];
383
- constructor(errorDetails: HTTPErrorDetails<TErrorData>, errorOptions?: ErrorOptions);
397
+ response: HTTPErrorDetails<TErrorData$1>["response"];
398
+ constructor(errorDetails: HTTPErrorDetails<TErrorData$1>, errorOptions?: ErrorOptions);
384
399
  /**
385
400
  * @description Checks if the given error is an instance of HTTPError
386
401
  * @param error - The error to check
387
402
  * @returns true if the error is an instance of HTTPError, false otherwise
388
403
  */
389
- static isError<TErrorData>(error: unknown): error is HTTPError<TErrorData>;
404
+ static isError<TErrorData>(error: unknown): error is HTTPError<TErrorData$1>;
390
405
  }
391
406
  type SafeExtract<TUnion, TKey extends TUnion> = Extract<TUnion, TKey>;
392
407
  type ValidationErrorDetails = {
@@ -420,6 +435,69 @@ declare class ValidationError extends Error {
420
435
  static isError(error: unknown): error is ValidationError;
421
436
  }
422
437
  //#endregion
438
+ //#region src/result.d.ts
439
+ type Parser<TData$1> = (responseString: string) => Awaitable<TData$1>;
440
+ declare const getResponseType: <TResponse>(response: Response, parser: Parser<TResponse>) => {
441
+ arrayBuffer: () => Promise<ArrayBuffer>;
442
+ blob: () => Promise<Blob>;
443
+ formData: () => Promise<FormData>;
444
+ json: () => Promise<TResponse>;
445
+ stream: () => ReadableStream<Uint8Array<ArrayBuffer>> | null;
446
+ text: () => Promise<string>;
447
+ };
448
+ type InitResponseTypeMap<TResponse$1 = unknown> = ReturnType<typeof getResponseType<TResponse$1>>;
449
+ type ResponseTypeUnion = keyof InitResponseTypeMap | null;
450
+ type ResponseTypeMap<TResponse$1> = { [Key in keyof InitResponseTypeMap<TResponse$1>]: Awaited<ReturnType<InitResponseTypeMap<TResponse$1>[Key]>> };
451
+ type GetResponseType<TResponse$1, TResponseType extends ResponseTypeUnion, TComputedResponseTypeMap extends ResponseTypeMap<TResponse$1> = ResponseTypeMap<TResponse$1>> = null extends TResponseType ? TComputedResponseTypeMap["json"] : TResponseType extends NonNullable<ResponseTypeUnion> ? TComputedResponseTypeMap[TResponseType] : never;
452
+ type CallApiResultSuccessVariant<TData$1> = {
453
+ data: NoInfer<TData$1>;
454
+ error: null;
455
+ response: Response;
456
+ };
457
+ type PossibleJavaScriptError = UnmaskType<{
458
+ errorData: false;
459
+ message: string;
460
+ name: "AbortError" | "Error" | "SyntaxError" | "TimeoutError" | "TypeError" | AnyString;
461
+ originalError: DOMException | Error | SyntaxError | TypeError;
462
+ }>;
463
+ type PossibleHTTPError<TErrorData$1> = UnmaskType<{
464
+ errorData: NoInfer<TErrorData$1>;
465
+ message: string;
466
+ name: "HTTPError";
467
+ originalError: HTTPError;
468
+ }>;
469
+ type PossibleValidationError = UnmaskType<{
470
+ errorData: ValidationError["errorData"];
471
+ issueCause: ValidationError["issueCause"];
472
+ message: string;
473
+ name: "ValidationError";
474
+ originalError: ValidationError;
475
+ }>;
476
+ type PossibleJavaScriptOrValidationError = UnmaskType<PossibleJavaScriptError | PossibleValidationError>;
477
+ type CallApiResultErrorVariant<TErrorData$1> = {
478
+ data: null;
479
+ error: PossibleHTTPError<TErrorData$1>;
480
+ response: Response;
481
+ } | {
482
+ data: null;
483
+ error: PossibleJavaScriptOrValidationError;
484
+ response: Response | null;
485
+ };
486
+ type CallApiSuccessOrErrorVariant<TData$1, TError> = CallApiResultErrorVariant<TError> | CallApiResultSuccessVariant<TData$1>;
487
+ type ResultModeMapWithoutException<TData$1, TErrorData$1, TResponseType extends ResponseTypeUnion, TComputedData = GetResponseType<TData$1, TResponseType>, TComputedErrorData = GetResponseType<TErrorData$1, TResponseType>, TComputedResult extends CallApiSuccessOrErrorVariant<TComputedData, TComputedErrorData> = CallApiSuccessOrErrorVariant<TComputedData, TComputedErrorData>> = UnmaskType<{
488
+ all: TComputedResult;
489
+ onlyData: TComputedResult["data"];
490
+ onlyResponse: TComputedResult["response"];
491
+ }>;
492
+ type ResultModeMapWithException<TData$1, TResponseType extends ResponseTypeUnion, TComputedData = GetResponseType<TData$1, TResponseType>, TComputedResult extends CallApiResultSuccessVariant<TComputedData> = CallApiResultSuccessVariant<TComputedData>> = {
493
+ all: TComputedResult;
494
+ onlyData: TComputedResult["data"];
495
+ onlyResponse: TComputedResult["response"];
496
+ };
497
+ type ResultModeMap<TData$1 = DefaultDataType, TErrorData$1 = DefaultDataType, TResponseType extends ResponseTypeUnion = ResponseTypeUnion, TThrowOnError extends ThrowOnErrorUnion = DefaultThrowOnError> = TThrowOnError extends true ? ResultModeMapWithException<TData$1, TResponseType> : ResultModeMapWithoutException<TData$1, TErrorData$1, TResponseType>;
498
+ type ResultModePlaceholder = null;
499
+ type ResultModeUnion = keyof ResultModeMap | ResultModePlaceholder;
500
+ //#endregion
423
501
  //#region src/middlewares.d.ts
424
502
  type FetchImpl = UnmaskType<(input: string | Request | URL, init?: RequestInit) => Promise<Response>>;
425
503
  interface Middlewares {
@@ -467,7 +545,7 @@ type PluginInitResult = Partial<Omit<PluginSetupContext, "initURL" | "request">
467
545
  initURL: InitURLOrURLObject;
468
546
  request: CallApiRequestOptions;
469
547
  }>;
470
- type PluginHooks<TData = never, TErrorData = never, TMoreOptions = unknown> = HooksOrHooksArray<TData, TErrorData, TMoreOptions>;
548
+ type PluginHooks<TData$1 = never, TErrorData$1 = never, TMoreOptions = unknown> = HooksOrHooksArray<TData$1, TErrorData$1, TMoreOptions>;
471
549
  interface CallApiPlugin {
472
550
  /**
473
551
  * Defines additional options that can be passed to callApi
@@ -507,73 +585,8 @@ interface CallApiPlugin {
507
585
  version?: string;
508
586
  }
509
587
  //#endregion
510
- //#region src/types/default-types.d.ts
511
- type DefaultDataType = unknown;
512
- type DefaultPluginArray = CallApiPlugin[];
513
- type DefaultThrowOnError = boolean;
514
- //#endregion
515
- //#region src/result.d.ts
516
- type Parser<TData> = (responseString: string) => Awaitable<TData>;
517
- declare const getResponseType: <TResponse>(response: Response, parser: Parser<TResponse>) => {
518
- arrayBuffer: () => Promise<ArrayBuffer>;
519
- blob: () => Promise<Blob>;
520
- formData: () => Promise<FormData>;
521
- json: () => Promise<TResponse>;
522
- stream: () => ReadableStream<Uint8Array<ArrayBuffer>> | null;
523
- text: () => Promise<string>;
524
- };
525
- type InitResponseTypeMap<TResponse$1 = unknown> = ReturnType<typeof getResponseType<TResponse$1>>;
526
- type ResponseTypeUnion = keyof InitResponseTypeMap | null;
527
- type ResponseTypeMap<TResponse$1> = { [Key in keyof InitResponseTypeMap<TResponse$1>]: Awaited<ReturnType<InitResponseTypeMap<TResponse$1>[Key]>> };
528
- type GetResponseType<TResponse$1, TResponseType extends ResponseTypeUnion, TComputedResponseTypeMap extends ResponseTypeMap<TResponse$1> = ResponseTypeMap<TResponse$1>> = null extends TResponseType ? TComputedResponseTypeMap["json"] : TResponseType extends NonNullable<ResponseTypeUnion> ? TComputedResponseTypeMap[TResponseType] : never;
529
- type CallApiResultSuccessVariant<TData> = {
530
- data: NoInfer<TData>;
531
- error: null;
532
- response: Response;
533
- };
534
- type PossibleJavaScriptError = UnmaskType<{
535
- errorData: false;
536
- message: string;
537
- name: "AbortError" | "Error" | "SyntaxError" | "TimeoutError" | "TypeError" | AnyString;
538
- originalError: DOMException | Error | SyntaxError | TypeError;
539
- }>;
540
- type PossibleHTTPError<TErrorData> = UnmaskType<{
541
- errorData: NoInfer<TErrorData>;
542
- message: string;
543
- name: "HTTPError";
544
- originalError: HTTPError;
545
- }>;
546
- type PossibleValidationError = UnmaskType<{
547
- errorData: ValidationError["errorData"];
548
- issueCause: ValidationError["issueCause"];
549
- message: string;
550
- name: "ValidationError";
551
- originalError: ValidationError;
552
- }>;
553
- type PossibleJavaScriptOrValidationError = UnmaskType<PossibleJavaScriptError | PossibleValidationError>;
554
- type CallApiResultErrorVariant<TErrorData> = {
555
- data: null;
556
- error: PossibleHTTPError<TErrorData>;
557
- response: Response;
558
- } | {
559
- data: null;
560
- error: PossibleJavaScriptOrValidationError;
561
- response: Response | null;
562
- };
563
- type CallApiSuccessOrErrorVariant<TData, TError> = CallApiResultErrorVariant<TError> | CallApiResultSuccessVariant<TData>;
564
- type ResultModeMapWithoutException<TData, TErrorData, TResponseType extends ResponseTypeUnion, TComputedData = GetResponseType<TData, TResponseType>, TComputedErrorData = GetResponseType<TErrorData, TResponseType>, TComputedResult extends CallApiSuccessOrErrorVariant<TComputedData, TComputedErrorData> = CallApiSuccessOrErrorVariant<TComputedData, TComputedErrorData>> = UnmaskType<{
565
- all: TComputedResult;
566
- onlyData: TComputedResult["data"];
567
- onlyResponse: TComputedResult["response"];
568
- }>;
569
- type ResultModeMapWithException<TData, TResponseType extends ResponseTypeUnion, TComputedData = GetResponseType<TData, TResponseType>, TComputedResult extends CallApiResultSuccessVariant<TComputedData> = CallApiResultSuccessVariant<TComputedData>> = {
570
- all: TComputedResult;
571
- onlyData: TComputedResult["data"];
572
- onlyResponse: TComputedResult["response"];
573
- };
574
- type ResultModeMap<TData = DefaultDataType, TErrorData = DefaultDataType, TResponseType extends ResponseTypeUnion = ResponseTypeUnion, TThrowOnError extends ThrowOnErrorUnion = DefaultThrowOnError> = TThrowOnError extends true ? ResultModeMapWithException<TData, TResponseType> : ResultModeMapWithoutException<TData, TErrorData, TResponseType>;
575
- type ResultModePlaceholder = null;
576
- type ResultModeUnion = keyof ResultModeMap | ResultModePlaceholder;
588
+ //#region src/utils/external/define.d.ts
589
+
577
590
  //#endregion
578
591
  //#region src/stream.d.ts
579
592
  type StreamProgressEvent = {
@@ -605,7 +618,7 @@ type PluginExtraOptions<TPluginOptions = unknown> = {
605
618
  /** Plugin-specific options passed to the plugin configuration */
606
619
  options: Partial<TPluginOptions>;
607
620
  };
608
- interface Hooks<TData = DefaultDataType, TErrorData = DefaultDataType, TPluginOptions = unknown> {
621
+ interface Hooks<TData$1 = DefaultDataType, TErrorData$1 = DefaultDataType, TPluginOptions = unknown> {
609
622
  /**
610
623
  * Hook called when any error occurs within the request/response lifecycle.
611
624
  *
@@ -616,7 +629,7 @@ interface Hooks<TData = DefaultDataType, TErrorData = DefaultDataType, TPluginOp
616
629
  * @param context - Error context containing error details, request info, and response (if available)
617
630
  * @returns Promise or void - Hook can be async or sync
618
631
  */
619
- onError?: (context: ErrorContext<TErrorData> & PluginExtraOptions<TPluginOptions>) => Awaitable<unknown>;
632
+ onError?: (context: ErrorContext<TErrorData$1> & PluginExtraOptions<TPluginOptions>) => Awaitable<unknown>;
620
633
  /**
621
634
  * Hook called before the HTTP request is sent and before any internal processing of the request object begins.
622
635
  *
@@ -668,7 +681,7 @@ interface Hooks<TData = DefaultDataType, TErrorData = DefaultDataType, TPluginOp
668
681
  * @returns Promise or void - Hook can be async or sync
669
682
  *
670
683
  */
671
- onResponse?: (context: ResponseContext<TData, TErrorData> & PluginExtraOptions<TPluginOptions>) => Awaitable<unknown>;
684
+ onResponse?: (context: ResponseContext<TData$1, TErrorData$1> & PluginExtraOptions<TPluginOptions>) => Awaitable<unknown>;
672
685
  /**
673
686
  * Hook called when an HTTP error response (4xx, 5xx) is received from the API.
674
687
  *
@@ -679,7 +692,7 @@ interface Hooks<TData = DefaultDataType, TErrorData = DefaultDataType, TPluginOp
679
692
  * @param context - Response error context with HTTP error details and response
680
693
  * @returns Promise or void - Hook can be async or sync
681
694
  */
682
- onResponseError?: (context: ResponseErrorContext<TErrorData> & PluginExtraOptions<TPluginOptions>) => Awaitable<unknown>;
695
+ onResponseError?: (context: ResponseErrorContext<TErrorData$1> & PluginExtraOptions<TPluginOptions>) => Awaitable<unknown>;
683
696
  /**
684
697
  * Hook called during download stream progress tracking.
685
698
  *
@@ -703,7 +716,7 @@ interface Hooks<TData = DefaultDataType, TErrorData = DefaultDataType, TPluginOp
703
716
  * @returns Promise or void - Hook can be async or sync
704
717
  *
705
718
  */
706
- onRetry?: (response: RetryContext<TErrorData> & PluginExtraOptions<TPluginOptions>) => Awaitable<unknown>;
719
+ onRetry?: (response: RetryContext<TErrorData$1> & PluginExtraOptions<TPluginOptions>) => Awaitable<unknown>;
707
720
  /**
708
721
  * Hook called when a successful response (2xx status) is received from the API.
709
722
  *
@@ -715,7 +728,7 @@ interface Hooks<TData = DefaultDataType, TErrorData = DefaultDataType, TPluginOp
715
728
  * @returns Promise or void - Hook can be async or sync
716
729
  *
717
730
  */
718
- onSuccess?: (context: SuccessContext<TData> & PluginExtraOptions<TPluginOptions>) => Awaitable<unknown>;
731
+ onSuccess?: (context: SuccessContext<TData$1> & PluginExtraOptions<TPluginOptions>) => Awaitable<unknown>;
719
732
  /**
720
733
  * Hook called when a validation error occurs.
721
734
  *
@@ -729,7 +742,7 @@ interface Hooks<TData = DefaultDataType, TErrorData = DefaultDataType, TPluginOp
729
742
  */
730
743
  onValidationError?: (context: ValidationErrorContext & PluginExtraOptions<TPluginOptions>) => Awaitable<unknown>;
731
744
  }
732
- type HooksOrHooksArray<TData = DefaultDataType, TErrorData = DefaultDataType, TMoreOptions = unknown> = { [Key in keyof Hooks<TData, TErrorData, TMoreOptions>]: Hooks<TData, TErrorData, TMoreOptions>[Key] | Array<Hooks<TData, TErrorData, TMoreOptions>[Key]> };
745
+ type HooksOrHooksArray<TData$1 = DefaultDataType, TErrorData$1 = DefaultDataType, TMoreOptions = unknown> = { [Key in keyof Hooks<TData$1, TErrorData$1, TMoreOptions>]: Hooks<TData$1, TErrorData$1, TMoreOptions>[Key] | Array<Hooks<TData$1, TErrorData$1, TMoreOptions>[Key]> };
733
746
  interface HookConfigOptions {
734
747
  /**
735
748
  * Controls the execution mode of all composed hooks (main + plugin hooks).
@@ -790,14 +803,14 @@ type RequestContext = {
790
803
  * made by this client instance, such as baseURL, default headers, and
791
804
  * global options.
792
805
  */
793
- baseConfig: BaseCallApiExtraOptions & CallApiRequestOptions;
806
+ baseConfig: Exclude<BaseCallApiConfig, AnyFunction$1>;
794
807
  /**
795
808
  * Instance-specific configuration object passed to the callApi instance.
796
809
  *
797
810
  * Contains configuration specific to this particular API call, which
798
811
  * can override or extend the base configuration.
799
812
  */
800
- config: CallApiExtraOptions & CallApiRequestOptions;
813
+ config: CallApiConfig;
801
814
  /**
802
815
  * Merged options combining base config, instance config, and default options.
803
816
  *
@@ -820,14 +833,14 @@ type ValidationErrorContext = UnmaskType<RequestContext & {
820
833
  /** HTTP response object if validation failed on response, null if on request */
821
834
  response: Response | null;
822
835
  }>;
823
- type SuccessContext<TData> = UnmaskType<RequestContext & {
836
+ type SuccessContext<TData$1> = UnmaskType<RequestContext & {
824
837
  /** Parsed response data with the expected success type */
825
- data: TData;
838
+ data: TData$1;
826
839
  /** HTTP response object for the successful request */
827
840
  response: Response;
828
841
  }>;
829
- type ResponseContext<TData, TErrorData> = UnmaskType<RequestContext & (Prettify<CallApiResultSuccessVariant<TData>> | Prettify<Extract<CallApiResultErrorVariant<TErrorData>, {
830
- error: PossibleHTTPError<TErrorData>;
842
+ type ResponseContext<TData$1, TErrorData$1> = UnmaskType<RequestContext & (Prettify<CallApiResultSuccessVariant<TData$1>> | Prettify<Extract<CallApiResultErrorVariant<TErrorData$1>, {
843
+ error: PossibleHTTPError<TErrorData$1>;
831
844
  }>>)>;
832
845
  type RequestErrorContext = RequestContext & {
833
846
  /** Error that occurred during the request (network, timeout, etc.) */
@@ -835,9 +848,9 @@ type RequestErrorContext = RequestContext & {
835
848
  /** Always null for request errors since no response was received */
836
849
  response: null;
837
850
  };
838
- type ErrorContext<TErrorData> = UnmaskType<RequestContext & ({
851
+ type ErrorContext<TErrorData$1> = UnmaskType<RequestContext & ({
839
852
  /** HTTP error with response data */
840
- error: PossibleHTTPError<TErrorData>;
853
+ error: PossibleHTTPError<TErrorData$1>;
841
854
  /** HTTP response object containing error status */
842
855
  response: Response;
843
856
  } | {
@@ -846,10 +859,10 @@ type ErrorContext<TErrorData> = UnmaskType<RequestContext & ({
846
859
  /** Response object if available, null for request errors */
847
860
  response: Response | null;
848
861
  })>;
849
- type ResponseErrorContext<TErrorData> = UnmaskType<Extract<ErrorContext<TErrorData>, {
850
- error: PossibleHTTPError<TErrorData>;
862
+ type ResponseErrorContext<TErrorData$1> = UnmaskType<Extract<ErrorContext<TErrorData$1>, {
863
+ error: PossibleHTTPError<TErrorData$1>;
851
864
  }> & RequestContext>;
852
- type RetryContext<TErrorData> = UnmaskType<ErrorContext<TErrorData> & {
865
+ type RetryContext<TErrorData$1> = UnmaskType<ErrorContext<TErrorData$1> & {
853
866
  /** Current retry attempt number (1-based, so 1 = first retry) */
854
867
  retryAttemptCount: number;
855
868
  }>;
@@ -1094,10 +1107,10 @@ declare const defaultRetryStatusCodesLookup: () => Readonly<{
1094
1107
  504: "Gateway Timeout";
1095
1108
  }>;
1096
1109
  type RetryStatusCodes = UnmaskType<AnyNumber | keyof ReturnType<typeof defaultRetryStatusCodesLookup>>;
1097
- type RetryCondition<TErrorData> = (context: ErrorContext<TErrorData>) => Awaitable<boolean>;
1098
- type RetryOptionKeys<TErrorData> = Exclude<keyof RetryOptions<TErrorData>, "~retryAttemptCount" | "retry">;
1099
- type InnerRetryOptions<TErrorData> = { [Key in RetryOptionKeys<TErrorData> as RemovePrefix<"retry", Key>]?: RetryOptions<TErrorData>[Key] };
1100
- interface RetryOptions<TErrorData> {
1110
+ type RetryCondition<TErrorData$1> = (context: ErrorContext<TErrorData$1>) => Awaitable<boolean>;
1111
+ type RetryOptionKeys<TErrorData$1> = Exclude<keyof RetryOptions<TErrorData$1>, "~retryAttemptCount" | "retry">;
1112
+ type InnerRetryOptions<TErrorData$1> = { [Key in RetryOptionKeys<TErrorData$1> as RemovePrefix<"retry", Key>]?: RetryOptions<TErrorData$1>[Key] };
1113
+ interface RetryOptions<TErrorData$1> {
1101
1114
  /**
1102
1115
  * Keeps track of the number of times the request has already been retried
1103
1116
  * @internal
@@ -1107,7 +1120,7 @@ interface RetryOptions<TErrorData> {
1107
1120
  /**
1108
1121
  * All retry options in a single object instead of separate properties
1109
1122
  */
1110
- retry?: InnerRetryOptions<TErrorData>;
1123
+ retry?: InnerRetryOptions<TErrorData$1>;
1111
1124
  /**
1112
1125
  * Number of allowed retry attempts on HTTP errors
1113
1126
  * @default 0
@@ -1116,7 +1129,7 @@ interface RetryOptions<TErrorData> {
1116
1129
  /**
1117
1130
  * Callback whose return value determines if a request should be retried or not
1118
1131
  */
1119
- retryCondition?: RetryCondition<TErrorData>;
1132
+ retryCondition?: RetryCondition<TErrorData$1>;
1120
1133
  /**
1121
1134
  * Delay between retries in milliseconds
1122
1135
  * @default 1000
@@ -1147,34 +1160,112 @@ interface RetryOptions<TErrorData> {
1147
1160
  /**
1148
1161
  * @description Makes a type partial if the output type of TSchema is not provided or has undefined in the union, otherwise makes it required
1149
1162
  */
1150
-
1151
- type GetCurrentRouteSchema<TBaseSchemaRoutes extends BaseCallApiSchemaRoutes, TCurrentRouteSchemaKey extends string, TComputedFallBackRouteSchema = TBaseSchemaRoutes[FallBackRouteSchemaKey], TComputedCurrentRouteSchema = TBaseSchemaRoutes[TCurrentRouteSchemaKey], TComputedRouteSchema extends CallApiSchema = NonNullable<Omit<TComputedFallBackRouteSchema, keyof TComputedCurrentRouteSchema> & TComputedCurrentRouteSchema>> = TComputedRouteSchema extends CallApiSchema ? Writeable<TComputedRouteSchema, "deep"> : CallApiSchema;
1163
+ type MakeSchemaOptionRequiredIfDefined<TSchemaOption extends CallApiSchema[keyof CallApiSchema], TObject> = undefined extends InferSchemaInput<TSchemaOption, undefined> ? TObject : Required<TObject>;
1164
+ type ApplyURLBasedConfig<TSchemaConfig$1 extends CallApiSchemaConfig, TSchemaRouteKeys extends string> = TSchemaConfig$1["prefix"] extends string ? `${TSchemaConfig$1["prefix"]}${TSchemaRouteKeys}` : TSchemaConfig$1["baseURL"] extends string ? `${TSchemaConfig$1["baseURL"]}${TSchemaRouteKeys}` : TSchemaRouteKeys;
1165
+ type ApplyStrictConfig<TSchemaConfig$1 extends CallApiSchemaConfig, TSchemaRouteKeys extends string> = TSchemaConfig$1["strict"] extends true ? TSchemaRouteKeys :
1166
+ // eslint-disable-next-line perfectionist/sort-union-types -- Don't sort union types
1167
+ TSchemaRouteKeys | Exclude<InitURLOrURLObject, RouteKeyMethodsURLUnion>;
1168
+ type ApplySchemaConfiguration<TSchemaConfig$1 extends CallApiSchemaConfig, TSchemaRouteKeys extends string> = ApplyStrictConfig<TSchemaConfig$1, ApplyURLBasedConfig<TSchemaConfig$1, TSchemaRouteKeys>>;
1169
+ type InferAllRouteKeys<TBaseSchemaRoutes$1 extends BaseCallApiSchemaRoutes, TSchemaConfig$1 extends CallApiSchemaConfig> = ApplySchemaConfiguration<TSchemaConfig$1, Exclude<Extract<keyof TBaseSchemaRoutes$1, string>, FallBackRouteSchemaKey>>;
1170
+ type InferInitURL<TBaseSchemaRoutes$1 extends BaseCallApiSchemaRoutes, TSchemaConfig$1 extends CallApiSchemaConfig> = keyof TBaseSchemaRoutes$1 extends never ? InitURLOrURLObject : InferAllRouteKeys<TBaseSchemaRoutes$1, TSchemaConfig$1>;
1171
+ type GetCurrentRouteSchema<TBaseSchemaRoutes$1 extends BaseCallApiSchemaRoutes, TCurrentRouteSchemaKey extends string, TComputedFallBackRouteSchema = TBaseSchemaRoutes$1[FallBackRouteSchemaKey], TComputedCurrentRouteSchema = TBaseSchemaRoutes$1[TCurrentRouteSchemaKey], TComputedRouteSchema extends CallApiSchema = NonNullable<Omit<TComputedFallBackRouteSchema, keyof TComputedCurrentRouteSchema> & TComputedCurrentRouteSchema>> = TComputedRouteSchema extends CallApiSchema ? Writeable<TComputedRouteSchema, "deep"> : CallApiSchema;
1152
1172
  type JsonPrimitive = boolean | number | string | null | undefined;
1153
1173
  type SerializableObject = Record<keyof object, unknown>;
1154
- type SerializableArray = Array<JsonPrimitive | SerializableArray | SerializableObject> | ReadonlyArray<JsonPrimitive | SerializableArray | SerializableObject>;
1174
+ type SerializableArray = Array<JsonPrimitive | SerializableObject> | ReadonlyArray<JsonPrimitive | SerializableObject>;
1155
1175
  type Body = UnmaskType<RequestInit["body"] | SerializableArray | SerializableObject>;
1176
+ type InferBodyOption<TSchema$1 extends CallApiSchema> = MakeSchemaOptionRequiredIfDefined<TSchema$1["body"], {
1177
+ /**
1178
+ * Body of the request, can be a object or any other supported body type.
1179
+ */
1180
+ body?: InferSchemaInput<TSchema$1["body"], Body>;
1181
+ }>;
1156
1182
  type MethodUnion = UnmaskType<"CONNECT" | "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT" | "TRACE" | AnyString>;
1183
+ type InferMethodFromURL<TInitURL> = string extends TInitURL ? MethodUnion : TInitURL extends `@${infer TMethod extends RouteKeyMethods}/${string}` ? Uppercase<TMethod> : MethodUnion;
1184
+ type InferMethodOption<TSchema$1 extends CallApiSchema, TInitURL> = MakeSchemaOptionRequiredIfDefined<TSchema$1["method"], {
1185
+ /**
1186
+ * HTTP method for the request.
1187
+ * @default "GET"
1188
+ */
1189
+ method?: InferSchemaInput<TSchema$1["method"], InferMethodFromURL<TInitURL>>;
1190
+ }>;
1157
1191
  type HeadersOption = UnmaskType<Record<"Authorization", CommonAuthorizationHeaders | undefined> | Record<"Content-Type", CommonContentTypes | undefined> | Record<CommonRequestHeaders, string | undefined> | Record<string, string | undefined> | Array<[string, string]>>;
1192
+ type InferHeadersOption<TSchema$1 extends CallApiSchema> = MakeSchemaOptionRequiredIfDefined<TSchema$1["headers"], {
1193
+ /**
1194
+ * Headers to be used in the request.
1195
+ */
1196
+ headers?: InferSchemaInput<TSchema$1["headers"], HeadersOption> | ((context: {
1197
+ baseHeaders: NonNullable<HeadersOption>;
1198
+ }) => InferSchemaInput<TSchema$1["headers"], HeadersOption>);
1199
+ }>;
1200
+ type InferRequestOptions<TSchema$1 extends CallApiSchema, TInitURL extends InferInitURL<BaseCallApiSchemaRoutes, CallApiSchemaConfig>> = InferBodyOption<TSchema$1> & InferHeadersOption<TSchema$1> & InferMethodOption<TSchema$1, TInitURL>;
1158
1201
  interface Register {}
1159
1202
  type GlobalMeta = Register extends {
1160
1203
  meta?: infer TMeta extends Record<string, unknown>;
1161
1204
  } ? TMeta : never;
1162
- type InferPluginOptions<TPluginArray extends CallApiPlugin[]> = UnionToIntersection<TPluginArray extends Array<infer TPlugin> ? TPlugin extends CallApiPlugin ? TPlugin["defineExtraOptions"] extends AnyFunction$1<infer TReturnedSchema> ? InferSchemaOutputResult<TReturnedSchema> : never : never : never>;
1163
- type ResultModeOption<TErrorData, TResultMode extends ResultModeUnion> = TErrorData extends false ? {
1205
+ type InferMetaOption<TSchema$1 extends CallApiSchema> = MakeSchemaOptionRequiredIfDefined<TSchema$1["meta"], {
1206
+ /**
1207
+ * - An optional field you can fill with additional information,
1208
+ * to associate with the request, typically used for logging or tracing.
1209
+ *
1210
+ * - A good use case for this, would be to use the info to handle specific cases in any of the shared interceptors.
1211
+ *
1212
+ * @example
1213
+ * ```ts
1214
+ * const callMainApi = callApi.create({
1215
+ * baseURL: "https://main-api.com",
1216
+ * onResponseError: ({ response, options }) => {
1217
+ * if (options.meta?.userId) {
1218
+ * console.error(`User ${options.meta.userId} made an error`);
1219
+ * }
1220
+ * },
1221
+ * });
1222
+ *
1223
+ * const response = await callMainApi({
1224
+ * url: "https://example.com/api/data",
1225
+ * meta: { userId: "123" },
1226
+ * });
1227
+ * ```
1228
+ */
1229
+ meta?: InferSchemaInput<TSchema$1["meta"], GlobalMeta>;
1230
+ }>;
1231
+ type InferQueryOption<TSchema$1 extends CallApiSchema> = MakeSchemaOptionRequiredIfDefined<TSchema$1["query"], {
1232
+ /**
1233
+ * Parameters to be appended to the URL (i.e: /:id)
1234
+ */
1235
+ query?: InferSchemaInput<TSchema$1["query"], Query>;
1236
+ }>;
1237
+ type EmptyString = "";
1238
+ type EmptyTuple = readonly [];
1239
+ type StringTuple = readonly string[];
1240
+ type PossibleParamNamePatterns = `${string}:${string}` | `${string}{${string}}${"" | AnyString}`;
1241
+ type ExtractRouteParamNames<TCurrentRoute$1, TParamNamesAccumulator extends StringTuple = EmptyTuple> = TCurrentRoute$1 extends PossibleParamNamePatterns ? TCurrentRoute$1 extends `${infer TRoutePrefix}:${infer TParamAndRemainingRoute}` ? TParamAndRemainingRoute extends `${infer TCurrentParam}/${infer TRemainingRoute}` ? TCurrentParam extends EmptyString ? ExtractRouteParamNames<`${TRoutePrefix}/${TRemainingRoute}`, TParamNamesAccumulator> : ExtractRouteParamNames<`${TRoutePrefix}/${TRemainingRoute}`, [...TParamNamesAccumulator, TCurrentParam]> : TParamAndRemainingRoute extends `${infer TCurrentParam}` ? TCurrentParam extends EmptyString ? ExtractRouteParamNames<TRoutePrefix, TParamNamesAccumulator> : ExtractRouteParamNames<TRoutePrefix, [...TParamNamesAccumulator, TCurrentParam]> : ExtractRouteParamNames<TRoutePrefix, TParamNamesAccumulator> : TCurrentRoute$1 extends `${infer TRoutePrefix}{${infer TCurrentParam}}${infer TRemainingRoute}` ? TCurrentParam extends EmptyString ? ExtractRouteParamNames<`${TRoutePrefix}${TRemainingRoute}`, TParamNamesAccumulator> : ExtractRouteParamNames<`${TRoutePrefix}${TRemainingRoute}`, [...TParamNamesAccumulator, TCurrentParam]> : TParamNamesAccumulator : TParamNamesAccumulator;
1242
+ type ConvertParamNamesToRecord<TParamNames extends StringTuple> = Prettify<TParamNames extends (readonly [infer TFirstParamName extends string, ...infer TRemainingParamNames extends StringTuple]) ? Record<TFirstParamName, AllowedQueryParamValues> & ConvertParamNamesToRecord<TRemainingParamNames> : NonNullable<unknown>>;
1243
+ type ConvertParamNamesToTuple<TParamNames extends StringTuple> = TParamNames extends readonly [string, ...infer TRemainingParamNames extends StringTuple] ? [AllowedQueryParamValues, ...ConvertParamNamesToTuple<TRemainingParamNames>] : [];
1244
+ type InferParamsFromRoute<TCurrentRoute$1> = ExtractRouteParamNames<TCurrentRoute$1> extends StringTuple ? ExtractRouteParamNames<TCurrentRoute$1> extends EmptyTuple ? Params : ConvertParamNamesToRecord<ExtractRouteParamNames<TCurrentRoute$1>> | ConvertParamNamesToTuple<ExtractRouteParamNames<TCurrentRoute$1>> : Params;
1245
+ type MakeParamsOptionRequired<TParamsSchemaOption extends CallApiSchema["params"], TBaseSchemaRoutes$1 extends BaseCallApiSchemaRoutes, TCurrentRouteSchemaKey extends string, TObject> = MakeSchemaOptionRequiredIfDefined<TParamsSchemaOption, Params extends InferParamsFromRoute<TCurrentRouteSchemaKey> ? TObject : TCurrentRouteSchemaKey extends Extract<keyof TBaseSchemaRoutes$1, TCurrentRouteSchemaKey> ? undefined extends InferSchemaInput<TParamsSchemaOption, null> ? TObject : Required<TObject> : TObject>;
1246
+ type InferParamsOption<TSchema$1 extends CallApiSchema, TBaseSchemaRoutes$1 extends BaseCallApiSchemaRoutes, TCurrentRouteSchemaKey extends string> = MakeParamsOptionRequired<TSchema$1["params"], TBaseSchemaRoutes$1, TCurrentRouteSchemaKey, {
1247
+ /**
1248
+ * Parameters to be appended to the URL (i.e: /:id)
1249
+ */
1250
+ params?: InferSchemaInput<TSchema$1["params"], InferParamsFromRoute<TCurrentRouteSchemaKey>>;
1251
+ }>;
1252
+ type InferExtraOptions<TSchema$1 extends CallApiSchema, TBaseSchemaRoutes$1 extends BaseCallApiSchemaRoutes, TCurrentRouteSchemaKey extends string> = InferMetaOption<TSchema$1> & InferParamsOption<TSchema$1, TBaseSchemaRoutes$1, TCurrentRouteSchemaKey> & InferQueryOption<TSchema$1>;
1253
+ type InferPluginOptions<TPluginArray extends CallApiPlugin[]> = UnionToIntersection<TPluginArray extends Array<infer TPlugin> ? TPlugin extends CallApiPlugin ? TPlugin["defineExtraOptions"] extends AnyFunction$1<infer TReturnedSchema> ? InferSchemaInput<TReturnedSchema> : never : never : never>;
1254
+ type ResultModeOption<TErrorData$1, TResultMode extends ResultModeUnion> = TErrorData$1 extends false ? {
1164
1255
  resultMode: "onlyData";
1165
- } : TErrorData extends false | undefined ? {
1256
+ } : TErrorData$1 extends false | undefined ? {
1166
1257
  resultMode?: "onlyData";
1167
1258
  } : {
1168
1259
  resultMode?: TResultMode;
1169
1260
  };
1170
1261
  type ThrowOnErrorUnion = boolean;
1171
- type ThrowOnErrorType<TErrorData, TThrowOnError extends ThrowOnErrorUnion> = TThrowOnError | ((context: ErrorContext<TErrorData>) => TThrowOnError);
1172
- type ThrowOnErrorOption<TErrorData, TThrowOnError extends ThrowOnErrorUnion> = TErrorData extends false ? {
1262
+ type ThrowOnErrorType<TErrorData$1, TThrowOnError extends ThrowOnErrorUnion> = TThrowOnError | ((context: ErrorContext<TErrorData$1>) => TThrowOnError);
1263
+ type ThrowOnErrorOption<TErrorData$1, TThrowOnError extends ThrowOnErrorUnion> = TErrorData$1 extends false ? {
1173
1264
  throwOnError: true;
1174
- } : TErrorData extends false | undefined ? {
1265
+ } : TErrorData$1 extends false | undefined ? {
1175
1266
  throwOnError?: true;
1176
1267
  } : {
1177
- throwOnError?: ThrowOnErrorType<TErrorData, TThrowOnError>;
1268
+ throwOnError?: ThrowOnErrorType<TErrorData$1, TThrowOnError>;
1178
1269
  };
1179
1270
  //#endregion
1180
1271
  //#region src/types/common.d.ts
@@ -1200,7 +1291,7 @@ type CallApiRequestOptions = Prettify<{
1200
1291
  type CallApiRequestOptionsForHooks = Omit<CallApiRequestOptions, "headers"> & {
1201
1292
  headers: Record<string, string | undefined>;
1202
1293
  };
1203
- type SharedExtraOptions<TData = DefaultDataType, TErrorData = DefaultDataType, TResultMode extends ResultModeUnion = ResultModeUnion, TThrowOnError extends ThrowOnErrorUnion = DefaultThrowOnError, TResponseType extends ResponseTypeUnion = ResponseTypeUnion, TPluginArray extends CallApiPlugin[] = DefaultPluginArray> = DedupeOptions & HookConfigOptions & HooksOrHooksArray<TData, TErrorData, Partial<InferPluginOptions<TPluginArray>>> & Middlewares & Partial<InferPluginOptions<TPluginArray>> & ResultModeOption<TErrorData, TResultMode> & RetryOptions<TErrorData> & ThrowOnErrorOption<TErrorData, TThrowOnError> & URLOptions & {
1294
+ type SharedExtraOptions<TData$1 = DefaultDataType, TErrorData$1 = DefaultDataType, TResultMode extends ResultModeUnion = ResultModeUnion, TThrowOnError extends ThrowOnErrorUnion = DefaultThrowOnError, TResponseType extends ResponseTypeUnion = ResponseTypeUnion, TPluginArray extends CallApiPlugin[] = DefaultPluginArray> = DedupeOptions & HookConfigOptions & HooksOrHooksArray<TData$1, TErrorData$1, Partial<InferPluginOptions<TPluginArray>>> & Middlewares & Partial<InferPluginOptions<TPluginArray>> & ResultModeOption<TErrorData$1, TResultMode> & RetryOptions<TErrorData$1> & ThrowOnErrorOption<TErrorData$1, TThrowOnError> & URLOptions & {
1204
1295
  /**
1205
1296
  * Automatically add an Authorization header value.
1206
1297
  *
@@ -1322,7 +1413,7 @@ type SharedExtraOptions<TData = DefaultDataType, TErrorData = DefaultDataType, T
1322
1413
  * }
1323
1414
  * ```
1324
1415
  */
1325
- defaultHTTPErrorMessage?: string | ((context: Pick<HTTPError<TErrorData>, "errorData" | "response">) => string);
1416
+ defaultHTTPErrorMessage?: string | ((context: Pick<HTTPError<TErrorData$1>, "errorData" | "response">) => string);
1326
1417
  /**
1327
1418
  * Forces calculation of total byte size from request/response body streams.
1328
1419
  *
@@ -1413,7 +1504,7 @@ type SharedExtraOptions<TData = DefaultDataType, TErrorData = DefaultDataType, T
1413
1504
  *
1414
1505
  * ```
1415
1506
  */
1416
- responseParser?: (responseString: string) => Awaitable<TData>;
1507
+ responseParser?: (responseString: string) => Awaitable<TData$1>;
1417
1508
  /**
1418
1509
  * Expected response type, determines how the response body is parsed.
1419
1510
  *
@@ -1548,7 +1639,7 @@ type SharedExtraOptions<TData = DefaultDataType, TErrorData = DefaultDataType, T
1548
1639
  * }
1549
1640
  * ```
1550
1641
  */
1551
- throwOnError?: ThrowOnErrorType<TErrorData, TThrowOnError>;
1642
+ throwOnError?: ThrowOnErrorType<TErrorData$1, TThrowOnError>;
1552
1643
  /**
1553
1644
  * Request timeout in milliseconds. Request will be aborted if it takes longer.
1554
1645
  *
@@ -1674,9 +1765,9 @@ type BaseCallApiExtraOptions<TBaseData = DefaultDataType, TBaseErrorData = Defau
1674
1765
  */
1675
1766
  skipAutoMergeFor?: "all" | "options" | "request";
1676
1767
  };
1677
- type InferExtendSchemaContext<TBaseSchemaRoutes extends BaseCallApiSchemaRoutes, TCurrentRouteSchemaKey extends string> = {
1678
- baseSchemaRoutes: TBaseSchemaRoutes;
1679
- currentRouteSchema: GetCurrentRouteSchema<TBaseSchemaRoutes, TCurrentRouteSchemaKey>;
1768
+ type InferExtendSchemaContext<TBaseSchemaRoutes$1 extends BaseCallApiSchemaRoutes, TCurrentRouteSchemaKey extends string> = {
1769
+ baseSchemaRoutes: TBaseSchemaRoutes$1;
1770
+ currentRouteSchema: GetCurrentRouteSchema<TBaseSchemaRoutes$1, TCurrentRouteSchemaKey>;
1680
1771
  };
1681
1772
  type InferExtendSchemaConfigContext<TBaseSchemaConfig extends CallApiSchemaConfig> = {
1682
1773
  baseSchemaConfig: TBaseSchemaConfig;
@@ -1684,7 +1775,7 @@ type InferExtendSchemaConfigContext<TBaseSchemaConfig extends CallApiSchemaConfi
1684
1775
  type InferExtendPluginContext<TBasePluginArray extends CallApiPlugin[]> = {
1685
1776
  basePlugins: TBasePluginArray;
1686
1777
  };
1687
- type CallApiExtraOptions<TData = DefaultDataType, TErrorData = DefaultDataType, TResultMode extends ResultModeUnion = ResultModeUnion, TThrowOnError extends ThrowOnErrorUnion = DefaultThrowOnError, TResponseType extends ResponseTypeUnion = ResponseTypeUnion, TBasePluginArray extends CallApiPlugin[] = DefaultPluginArray, TPluginArray extends CallApiPlugin[] = DefaultPluginArray, TBaseSchemaRoutes extends BaseCallApiSchemaRoutes = BaseCallApiSchemaRoutes, TSchema$1 extends CallApiSchema = CallApiSchema, TBaseSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TCurrentRouteSchemaKey extends string = string, TComputedPluginContext = InferExtendPluginContext<TBasePluginArray>, TComputedSchemaContext = InferExtendSchemaContext<TBaseSchemaRoutes, TCurrentRouteSchemaKey>, TComputedSchemaConfigContext = InferExtendSchemaConfigContext<TBaseSchemaConfig>> = SharedExtraOptions<TData, TErrorData, TResultMode, TThrowOnError, TResponseType, TPluginArray> & {
1778
+ type CallApiExtraOptions<TData$1 = DefaultDataType, TErrorData$1 = DefaultDataType, TResultMode extends ResultModeUnion = ResultModeUnion, TThrowOnError extends ThrowOnErrorUnion = DefaultThrowOnError, TResponseType extends ResponseTypeUnion = ResponseTypeUnion, TBasePluginArray extends CallApiPlugin[] = DefaultPluginArray, TPluginArray extends CallApiPlugin[] = DefaultPluginArray, TBaseSchemaRoutes$1 extends BaseCallApiSchemaRoutes = BaseCallApiSchemaRoutes, TSchema$1 extends CallApiSchema = CallApiSchema, TBaseSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TSchemaConfig$1 extends CallApiSchemaConfig = CallApiSchemaConfig, TCurrentRouteSchemaKey extends string = string, TComputedPluginContext = InferExtendPluginContext<TBasePluginArray>, TComputedSchemaContext = InferExtendSchemaContext<TBaseSchemaRoutes$1, TCurrentRouteSchemaKey>, TComputedSchemaConfigContext = InferExtendSchemaConfigContext<TBaseSchemaConfig>> = SharedExtraOptions<TData$1, TErrorData$1, TResultMode, TThrowOnError, TResponseType, TPluginArray> & {
1688
1779
  /**
1689
1780
  * Array of instance-specific CallApi plugins or a function to configure plugins.
1690
1781
  *
@@ -1710,9 +1801,16 @@ type CallApiExtraOptions<TData = DefaultDataType, TErrorData = DefaultDataType,
1710
1801
  * Can override base schema configuration or extend it with instance-specific validation rules.
1711
1802
  *
1712
1803
  */
1713
- schemaConfig?: TSchemaConfig | ((context: TComputedSchemaConfigContext) => TSchemaConfig);
1804
+ schemaConfig?: TSchemaConfig$1 | ((context: TComputedSchemaConfigContext) => TSchemaConfig$1);
1714
1805
  };
1715
1806
  type CallApiExtraOptionsForHooks = Hooks & Omit<CallApiExtraOptions, keyof Hooks>;
1807
+ type BaseInstanceContext = {
1808
+ initURL: string;
1809
+ options: CallApiExtraOptions;
1810
+ request: CallApiRequestOptions;
1811
+ };
1812
+ type BaseCallApiConfig<TBaseData = DefaultDataType, TBaseErrorData = DefaultDataType, TBaseResultMode extends ResultModeUnion = ResultModeUnion, TBaseThrowOnError extends ThrowOnErrorUnion = DefaultThrowOnError, TBaseResponseType extends ResponseTypeUnion = ResponseTypeUnion, TBaseSchemaAndConfig extends BaseCallApiSchemaAndConfig = BaseCallApiSchemaAndConfig, TBasePluginArray extends CallApiPlugin[] = DefaultPluginArray, TComputedBaseConfig = BaseCallApiExtraOptions<TBaseData, TBaseErrorData, TBaseResultMode, TBaseThrowOnError, TBaseResponseType, TBasePluginArray, TBaseSchemaAndConfig>> = (CallApiRequestOptions & TComputedBaseConfig) | ((context: BaseInstanceContext) => CallApiRequestOptions & TComputedBaseConfig);
1813
+ type CallApiConfig<TData$1 = DefaultDataType, TErrorData$1 = DefaultDataType, TResultMode extends ResultModeUnion = ResultModeUnion, TThrowOnError extends ThrowOnErrorUnion = DefaultThrowOnError, TResponseType extends ResponseTypeUnion = ResponseTypeUnion, TBaseSchemaRoutes$1 extends BaseCallApiSchemaRoutes = BaseCallApiSchemaRoutes, TSchema$1 extends CallApiSchema = CallApiSchema, TBaseSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TSchemaConfig$1 extends CallApiSchemaConfig = CallApiSchemaConfig, TInitURL extends InitURLOrURLObject = InitURLOrURLObject, TCurrentRouteSchemaKey extends string = string, TBasePluginArray extends CallApiPlugin[] = DefaultPluginArray, TPluginArray extends CallApiPlugin[] = DefaultPluginArray> = InferExtraOptions<TSchema$1, TBaseSchemaRoutes$1, TCurrentRouteSchemaKey> & InferRequestOptions<TSchema$1, TInitURL> & Omit<CallApiExtraOptions<TData$1, TErrorData$1, TResultMode, TThrowOnError, TResponseType, TBasePluginArray, TPluginArray, TBaseSchemaRoutes$1, TSchema$1, TBaseSchemaConfig, TSchemaConfig$1, TCurrentRouteSchemaKey>, keyof InferExtraOptions<CallApiSchema, BaseCallApiSchemaRoutes, string>> & Omit<CallApiRequestOptions, keyof InferRequestOptions<CallApiSchema, string>>;
1716
1814
  //#endregion
1717
1815
  //#region src/logger/logger.d.ts
1718
1816
  type ConsoleLikeObject = {
@@ -1762,7 +1860,7 @@ declare const loggerPlugin: (options?: LoggerOptions) => {
1762
1860
  errorData: never;
1763
1861
  message: string;
1764
1862
  name: "HTTPError";
1765
- originalError: HTTPError;
1863
+ originalError: _zayne_labs_callapi_utils0.HTTPError;
1766
1864
  };
1767
1865
  response: Response;
1768
1866
  } & PluginExtraOptions<unknown>) => void;
@@ -1774,7 +1872,7 @@ declare const loggerPlugin: (options?: LoggerOptions) => {
1774
1872
  errorData: never;
1775
1873
  message: string;
1776
1874
  name: "HTTPError";
1777
- originalError: HTTPError;
1875
+ originalError: _zayne_labs_callapi_utils0.HTTPError;
1778
1876
  };
1779
1877
  response: Response;
1780
1878
  })) & {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zayne-labs/callapi-plugins",
3
3
  "type": "module",
4
- "version": "4.0.10",
4
+ "version": "4.0.12",
5
5
  "description": "A collection of plugins for callapi",
6
6
  "author": "Ryan Zayne",
7
7
  "license": "MIT",
@@ -21,7 +21,7 @@
21
21
  "peerDependencies": {
22
22
  "@zayne-labs/toolkit-type-helpers": ">=0.11.17",
23
23
  "consola": "3.x.x",
24
- "@zayne-labs/callapi": "1.11.10"
24
+ "@zayne-labs/callapi": "1.11.12"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@arethetypeswrong/cli": "0.18.2",
@@ -38,7 +38,7 @@
38
38
  "tsdown": "^0.15.9",
39
39
  "typescript": "5.9.3",
40
40
  "vitest": "^4.0.1",
41
- "@zayne-labs/callapi": "1.11.10"
41
+ "@zayne-labs/callapi": "1.11.12"
42
42
  },
43
43
  "publishConfig": {
44
44
  "access": "public",