@zayne-labs/callapi 1.7.6 → 1.7.10

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,4 +1,20 @@
1
+ type AnyString = string & {
2
+ z_placeholder?: never;
3
+ };
4
+ type AnyFunction<TResult = unknown> = (...args: any) => TResult;
5
+ type Prettify<TObject> = NonNullable<unknown> & {
6
+ [Key in keyof TObject]: TObject[Key];
7
+ };
8
+ type UnmaskType<TValue> = {
9
+ _: TValue;
10
+ }["_"];
11
+ type Awaitable<TValue> = Promise<TValue> | TValue;
12
+ 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;
13
+ type CommonAuthorizationHeaders = `${"Basic" | "Bearer" | "Token"} ${string}`;
14
+ type CommonContentTypes = "application/epub+zip" | "application/gzip" | "application/json" | "application/ld+json" | "application/octet-stream" | "application/ogg" | "application/pdf" | "application/rtf" | "application/vnd.ms-fontobject" | "application/wasm" | "application/xhtml+xml" | "application/xml" | "application/zip" | "audio/aac" | "audio/mpeg" | "audio/ogg" | "audio/opus" | "audio/webm" | "audio/x-midi" | "font/otf" | "font/ttf" | "font/woff" | "font/woff2" | "image/avif" | "image/bmp" | "image/gif" | "image/jpeg" | "image/png" | "image/svg+xml" | "image/tiff" | "image/webp" | "image/x-icon" | "model/gltf-binary" | "model/gltf+json" | "text/calendar" | "text/css" | "text/csv" | "text/html" | "text/javascript" | "text/plain" | "video/3gpp" | "video/3gpp2" | "video/av1" | "video/mp2t" | "video/mp4" | "video/mpeg" | "video/ogg" | "video/webm" | "video/x-msvideo" | AnyString;
15
+
1
16
  type ValueOrFunctionResult<TValue> = TValue | (() => TValue);
17
+ type ValidAuthValue = ValueOrFunctionResult<Awaitable<string | null | undefined>>;
2
18
  /**
3
19
  * Bearer Or Token authentication
4
20
  *
@@ -10,20 +26,20 @@ type ValueOrFunctionResult<TValue> = TValue | (() => TValue);
10
26
  */
11
27
  type BearerOrTokenAuth = {
12
28
  type?: "Bearer";
13
- bearer?: ValueOrFunctionResult<string | null>;
29
+ bearer?: ValidAuthValue;
14
30
  token?: never;
15
31
  } | {
16
32
  type?: "Token";
17
33
  bearer?: never;
18
- token?: ValueOrFunctionResult<string | null>;
34
+ token?: ValidAuthValue;
19
35
  };
20
36
  /**
21
37
  * Basic auth
22
38
  */
23
39
  type BasicAuth = {
24
40
  type: "Basic";
25
- username: ValueOrFunctionResult<string | null | undefined>;
26
- password: ValueOrFunctionResult<string | null | undefined>;
41
+ username: ValidAuthValue;
42
+ password: ValidAuthValue;
27
43
  };
28
44
  /**
29
45
  * Custom auth
@@ -42,83 +58,13 @@ type BasicAuth = {
42
58
  */
43
59
  type CustomAuth = {
44
60
  type: "Custom";
45
- prefix: ValueOrFunctionResult<string | null | undefined>;
46
- value: ValueOrFunctionResult<string | null | undefined>;
61
+ prefix: ValidAuthValue;
62
+ value: ValidAuthValue;
47
63
  };
48
64
  type Auth = BearerOrTokenAuth | BasicAuth | CustomAuth;
49
65
 
50
66
  declare const fetchSpecificKeys: (keyof RequestInit | "duplex")[];
51
67
 
52
- type AnyString = string & {
53
- z_placeholder?: never;
54
- };
55
- type AnyNumber = number & {
56
- z_placeholder?: never;
57
- };
58
- type AnyFunction<TResult = unknown> = (...args: any) => TResult;
59
- type Prettify<TObject> = NonNullable<unknown> & {
60
- [Key in keyof TObject]: TObject[Key];
61
- };
62
- type UnmaskType<TValue> = {
63
- _: TValue;
64
- }["_"];
65
- type Awaitable<TValue> = Promise<TValue> | TValue;
66
- 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;
67
- type CommonAuthorizationHeaders = `${"Basic" | "Bearer" | "Token"} ${string}`;
68
- type CommonContentTypes = "application/epub+zip" | "application/gzip" | "application/json" | "application/ld+json" | "application/octet-stream" | "application/ogg" | "application/pdf" | "application/rtf" | "application/vnd.ms-fontobject" | "application/wasm" | "application/xhtml+xml" | "application/xml" | "application/zip" | "audio/aac" | "audio/mpeg" | "audio/ogg" | "audio/opus" | "audio/webm" | "audio/x-midi" | "font/otf" | "font/ttf" | "font/woff" | "font/woff2" | "image/avif" | "image/bmp" | "image/gif" | "image/jpeg" | "image/png" | "image/svg+xml" | "image/tiff" | "image/webp" | "image/x-icon" | "model/gltf-binary" | "model/gltf+json" | "text/calendar" | "text/css" | "text/csv" | "text/html" | "text/javascript" | "text/plain" | "video/3gpp" | "video/3gpp2" | "video/av1" | "video/mp2t" | "video/mp4" | "video/mpeg" | "video/ogg" | "video/webm" | "video/x-msvideo" | AnyString;
69
-
70
- type ErrorDetails<TErrorResponse> = {
71
- defaultErrorMessage: CallApiExtraOptions["defaultErrorMessage"];
72
- errorData: TErrorResponse;
73
- response: Response;
74
- };
75
- type ErrorOptions = {
76
- cause?: unknown;
77
- };
78
- declare class HTTPError<TErrorResponse = Record<string, unknown>> {
79
- cause: ErrorOptions["cause"];
80
- errorData: ErrorDetails<TErrorResponse>["errorData"];
81
- isHTTPError: boolean;
82
- message: string;
83
- name: "HTTPError";
84
- response: ErrorDetails<TErrorResponse>["response"];
85
- constructor(errorDetails: ErrorDetails<TErrorResponse>, errorOptions?: ErrorOptions);
86
- }
87
- type PossibleJavaScriptError = UnmaskType<{
88
- errorData: DOMException | Error | SyntaxError | TypeError;
89
- message: string;
90
- name: "AbortError" | "Error" | "SyntaxError" | "TimeoutError" | "TypeError" | (`${string}Error` & {});
91
- }>;
92
- type PossibleHTTPError<TErrorData> = UnmaskType<{
93
- errorData: TErrorData;
94
- message: string;
95
- name: "HTTPError";
96
- }>;
97
-
98
- type StreamProgressEvent = {
99
- /**
100
- * Current chunk of data being streamed
101
- */
102
- chunk: Uint8Array;
103
- /**
104
- * Progress in percentage
105
- */
106
- progress: number;
107
- /**
108
- * Total size of data in bytes
109
- */
110
- totalBytes: number;
111
- /**
112
- * Amount of data transferred so far
113
- */
114
- transferredBytes: number;
115
- };
116
- declare global {
117
- interface ReadableStream<R> {
118
- [Symbol.asyncIterator]: () => AsyncIterableIterator<R>;
119
- }
120
- }
121
-
122
68
  /**
123
69
  * The Standard Schema interface.
124
70
  * @see https://github.com/standard-schema/standard-schema
@@ -336,6 +282,90 @@ type DefaultMoreOptions = NonNullable<unknown>;
336
282
  type DefaultPluginArray = CallApiPlugin[];
337
283
  type DefaultThrowOnError = boolean;
338
284
 
285
+ type Parser = (responseString: string) => Awaitable<Record<string, unknown>>;
286
+ declare const getResponseType: <TResponse>(response: Response, parser: Parser) => {
287
+ arrayBuffer: () => Promise<ArrayBuffer>;
288
+ blob: () => Promise<Blob>;
289
+ formData: () => Promise<FormData>;
290
+ json: () => Promise<TResponse>;
291
+ stream: () => ReadableStream<Uint8Array<ArrayBufferLike>> | null;
292
+ text: () => Promise<string>;
293
+ };
294
+ type InitResponseTypeMap<TResponse = unknown> = ReturnType<typeof getResponseType<TResponse>>;
295
+ type ResponseTypeUnion = keyof InitResponseTypeMap | null;
296
+ type ResponseTypeMap<TResponse> = {
297
+ [Key in keyof InitResponseTypeMap<TResponse>]: Awaited<ReturnType<InitResponseTypeMap<TResponse>[Key]>>;
298
+ };
299
+ type GetResponseType<TResponse, TResponseType extends ResponseTypeUnion, TComputedResponseTypeMap extends ResponseTypeMap<TResponse> = ResponseTypeMap<TResponse>> = null extends TResponseType ? TComputedResponseTypeMap["json"] : TResponseType extends NonNullable<ResponseTypeUnion> ? TComputedResponseTypeMap[TResponseType] : never;
300
+ type CallApiResultSuccessVariant<TData> = {
301
+ data: TData;
302
+ error: null;
303
+ response: Response;
304
+ };
305
+ type CallApiResultErrorVariant<TErrorData> = {
306
+ data: null;
307
+ error: PossibleHTTPError<TErrorData>;
308
+ response: Response;
309
+ } | {
310
+ data: null;
311
+ error: PossibleJavaScriptError;
312
+ response: null;
313
+ };
314
+ type ResultModeMap<TData = DefaultDataType, TErrorData = DefaultDataType, TResponseType extends ResponseTypeUnion = ResponseTypeUnion, TComputedData = GetResponseType<TData, TResponseType>, TComputedErrorData = GetResponseType<TErrorData, TResponseType>> = UnmaskType<{
315
+ all: CallApiResultSuccessVariant<TComputedData> | CallApiResultErrorVariant<TComputedErrorData>;
316
+ allWithException: CallApiResultSuccessVariant<TComputedData>;
317
+ onlySuccess: CallApiResultErrorVariant<TComputedErrorData>["data"] | CallApiResultSuccessVariant<TComputedData>["data"];
318
+ onlySuccessWithException: CallApiResultSuccessVariant<TComputedData>["data"];
319
+ }>;
320
+ type ResultModeUnion = keyof ResultModeMap | null;
321
+ type GetCallApiResult<TData, TErrorData, TResultMode extends ResultModeUnion, TThrowOnError extends boolean, TResponseType extends ResponseTypeUnion> = TErrorData extends false | undefined ? ResultModeMap<TData, TErrorData, TResponseType>["onlySuccessWithException"] : null extends TResultMode ? TThrowOnError extends true ? ResultModeMap<TData, TErrorData, TResponseType>["allWithException"] : ResultModeMap<TData, TErrorData, TResponseType>["all"] : TResultMode extends NonNullable<ResultModeUnion> ? ResultModeMap<TData, TErrorData, TResponseType>[TResultMode] : never;
322
+ type ErrorDetails<TErrorResponse> = {
323
+ defaultErrorMessage: CallApiExtraOptions["defaultErrorMessage"];
324
+ errorData: TErrorResponse;
325
+ response: Response;
326
+ };
327
+ declare class HTTPError<TErrorResponse = Record<string, unknown>> extends Error {
328
+ errorData: ErrorDetails<TErrorResponse>["errorData"];
329
+ isHTTPError: boolean;
330
+ name: "HTTPError";
331
+ response: ErrorDetails<TErrorResponse>["response"];
332
+ constructor(errorDetails: ErrorDetails<TErrorResponse>, errorOptions?: ErrorOptions);
333
+ }
334
+ type PossibleJavaScriptError = UnmaskType<{
335
+ errorData: DOMException | Error | SyntaxError | TypeError;
336
+ message: string;
337
+ name: "AbortError" | "Error" | "SyntaxError" | "TimeoutError" | "TypeError" | (`${string}Error` & {});
338
+ }>;
339
+ type PossibleHTTPError<TErrorData> = Prettify<UnmaskType<{
340
+ errorData: TErrorData;
341
+ message: string;
342
+ name: "HTTPError";
343
+ }>>;
344
+
345
+ type StreamProgressEvent = {
346
+ /**
347
+ * Current chunk of data being streamed
348
+ */
349
+ chunk: Uint8Array;
350
+ /**
351
+ * Progress in percentage
352
+ */
353
+ progress: number;
354
+ /**
355
+ * Total size of data in bytes
356
+ */
357
+ totalBytes: number;
358
+ /**
359
+ * Amount of data transferred so far
360
+ */
361
+ transferredBytes: number;
362
+ };
363
+ declare global {
364
+ interface ReadableStream<R> {
365
+ [Symbol.asyncIterator]: () => AsyncIterableIterator<R>;
366
+ }
367
+ }
368
+
339
369
  type WithMoreOptions<TMoreOptions = DefaultMoreOptions> = {
340
370
  options: CombinedCallApiExtraOptions & Partial<TMoreOptions>;
341
371
  };
@@ -372,7 +402,7 @@ type Hooks<TData = DefaultDataType, TErrorData = DefaultDataType, TMoreOptions =
372
402
  /**
373
403
  * Hook that will be called when a request is retried.
374
404
  */
375
- onRetry?: (response: ErrorContext<TErrorData> & WithMoreOptions<TMoreOptions>) => Awaitable<unknown>;
405
+ onRetry?: (response: RetryContext<TErrorData> & WithMoreOptions<TMoreOptions>) => Awaitable<unknown>;
376
406
  /**
377
407
  * Hook that will be called when a successful response is received from the api.
378
408
  */
@@ -422,6 +452,9 @@ type ResponseErrorContext<TErrorData> = UnmaskType<Prettify<SharedHookContext &
422
452
  error: PossibleHTTPError<TErrorData>;
423
453
  response: Response;
424
454
  }>>;
455
+ type RetryContext<TErrorData> = UnmaskType<Prettify<ErrorContext<TErrorData> & {
456
+ retryAttemptCount: number;
457
+ }>>;
425
458
  type ErrorContext<TErrorData> = UnmaskType<Prettify<SharedHookContext & {
426
459
  error: PossibleHTTPError<TErrorData>;
427
460
  response: Response;
@@ -438,59 +471,22 @@ type ResponseStreamContext = UnmaskType<Prettify<SharedHookContext & {
438
471
  response: Response;
439
472
  }>>;
440
473
 
441
- type Parser = (responseString: string) => Awaitable<Record<string, unknown>>;
442
- declare const getResponseType: <TResponse>(response: Response, parser: Parser) => {
443
- arrayBuffer: () => Promise<ArrayBuffer>;
444
- blob: () => Promise<Blob>;
445
- formData: () => Promise<FormData>;
446
- json: () => Promise<TResponse>;
447
- stream: () => ReadableStream<Uint8Array<ArrayBufferLike>> | null;
448
- text: () => Promise<string>;
449
- };
450
- type InitResponseTypeMap<TResponse = unknown> = ReturnType<typeof getResponseType<TResponse>>;
451
- type ResponseTypeUnion = keyof InitResponseTypeMap | null;
452
- type ResponseTypeMap<TResponse> = {
453
- [Key in keyof InitResponseTypeMap<TResponse>]: Awaited<ReturnType<InitResponseTypeMap<TResponse>[Key]>>;
454
- };
455
- type GetResponseType<TResponse, TResponseType extends ResponseTypeUnion, TComputedResponseTypeMap extends ResponseTypeMap<TResponse> = ResponseTypeMap<TResponse>> = null extends TResponseType ? TComputedResponseTypeMap["json"] : TResponseType extends NonNullable<ResponseTypeUnion> ? TComputedResponseTypeMap[TResponseType] : never;
456
- type ResultModeMap<TData = DefaultDataType, TErrorData = DefaultDataType, TResponseType extends ResponseTypeUnion = ResponseTypeUnion, TComputedData = GetResponseType<TData, TResponseType>, TComputedErrorData = GetResponseType<TErrorData, TResponseType>> = UnmaskType<{
457
- all: CallApiResultSuccessVariant<TComputedData> | CallApiResultErrorVariant<TComputedErrorData>;
458
- allWithException: CallApiResultSuccessVariant<TComputedData>;
459
- allWithoutResponse: CallApiResultSuccessVariant<TComputedData>["data" | "error"] | CallApiResultErrorVariant<TComputedErrorData>["data" | "error"];
460
- onlyError: CallApiResultSuccessVariant<TComputedData>["error"] | CallApiResultErrorVariant<TComputedErrorData>["error"];
461
- onlyResponse: CallApiResultErrorVariant<TComputedErrorData>["response"] | CallApiResultSuccessVariant<TComputedData>["response"];
462
- onlyResponseWithException: CallApiResultSuccessVariant<TComputedData>["response"];
463
- onlySuccess: CallApiResultErrorVariant<TComputedErrorData>["data"] | CallApiResultSuccessVariant<TComputedData>["data"];
464
- onlySuccessWithException: CallApiResultSuccessVariant<TComputedData>["data"];
465
- }>;
466
- type ResultModeUnion = keyof ResultModeMap | null;
467
- type GetCallApiResult<TData, TErrorData, TResultMode extends ResultModeUnion, TThrowOnError extends boolean, TResponseType extends ResponseTypeUnion> = TErrorData extends false | undefined ? ResultModeMap<TData, TErrorData, TResponseType>["onlySuccessWithException"] : null extends TResultMode ? TThrowOnError extends true ? ResultModeMap<TData, TErrorData, TResponseType>["allWithException"] : ResultModeMap<TData, TErrorData, TResponseType>["all"] : TResultMode extends NonNullable<ResultModeUnion> ? TResultMode extends "onlySuccess" ? ResultModeMap<TData, TErrorData, TResponseType>["onlySuccessWithException"] : TResultMode extends "onlyResponse" ? ResultModeMap<TData, TErrorData, TResponseType>["onlyResponseWithException"] : ResultModeMap<TData, TErrorData, TResponseType>[TResultMode] : never;
468
-
469
- declare const defaultRetryStatusCodesLookup: {
470
- 408: "Request Timeout";
471
- 409: "Conflict";
472
- 425: "Too Early";
473
- 429: "Too Many Requests";
474
- 500: "Internal Server Error";
475
- 502: "Bad Gateway";
476
- 503: "Service Unavailable";
477
- 504: "Gateway Timeout";
478
- };
479
-
480
474
  type RetryCondition<TErrorData> = (context: ErrorContext<TErrorData>) => Awaitable<boolean>;
481
- type InnerRetryKeys<TErrorData> = Exclude<keyof RetryOptions<TErrorData>, "~retryCount" | "retry">;
482
- type InnerRetryOptions<TErrorData> = UnmaskType<{
475
+ type InnerRetryKeys<TErrorData> = Exclude<keyof RetryOptions<TErrorData>, "~retryAttemptCount" | "retry">;
476
+ type InnerRetryOptions<TErrorData> = {
483
477
  [Key in InnerRetryKeys<TErrorData> as Key extends `retry${infer TRest}` ? Uncapitalize<TRest> extends "attempts" ? never : Uncapitalize<TRest> : Key]?: RetryOptions<TErrorData>[Key];
484
478
  } & {
485
479
  attempts: NonNullable<RetryOptions<TErrorData>["retryAttempts"]>;
486
- }>;
487
- type RetryStatusCodes = UnmaskType<Array<keyof typeof defaultRetryStatusCodesLookup | AnyNumber>>;
480
+ };
488
481
  interface RetryOptions<TErrorData> {
489
482
  /**
490
483
  * Keeps track of the number of times the request has already been retried
491
484
  * @deprecated This property is used internally to track retries. Please abstain from modifying it.
492
485
  */
493
486
  readonly ["~retryAttemptCount"]?: number;
487
+ /**
488
+ * All retry options in a single object instead of separate properties
489
+ */
494
490
  retry?: InnerRetryOptions<TErrorData>;
495
491
  /**
496
492
  * Number of allowed retry attempts on HTTP errors
@@ -519,7 +515,7 @@ interface RetryOptions<TErrorData> {
519
515
  /**
520
516
  * HTTP status codes that trigger a retry
521
517
  */
522
- retryStatusCodes?: RetryStatusCodes;
518
+ retryStatusCodes?: number[];
523
519
  /**
524
520
  * Strategy to use when retrying
525
521
  * @default "linear"
@@ -714,10 +710,10 @@ type CallApiExtraOptions<TData = DefaultDataType, TErrorData = DefaultDataType,
714
710
  basePlugins: Plugins<TPluginArray>;
715
711
  }) => Plugins<TPluginArray>);
716
712
  schemas?: TSchemas | ((context: {
717
- baseSchemas: TSchemas;
713
+ baseSchemas: TSchemas | undefined;
718
714
  }) => TSchemas);
719
715
  validators?: CallApiValidators<TData, TErrorData> | ((context: {
720
- baseValidators: CallApiValidators<TData, TErrorData>;
716
+ baseValidators: CallApiValidators<TData, TErrorData> | undefined;
721
717
  }) => CallApiValidators<TData, TErrorData>);
722
718
  };
723
719
  declare const optionsEnumToOmitFromBase: "dedupeKey"[];
@@ -756,20 +752,6 @@ type CallApiParameters<TData = DefaultDataType, TErrorData = DefaultDataType, TR
756
752
  initURL: InferSchemaResult<TSchemas["initURL"], InitURL>,
757
753
  config?: CallApiConfig<TData, TErrorData, TResultMode, TThrowOnError, TResponseType, TPluginArray, TSchemas>
758
754
  ];
759
- type CallApiResultSuccessVariant<TData> = {
760
- data: TData;
761
- error: null;
762
- response: Response;
763
- };
764
- type CallApiResultErrorVariant<TErrorData> = {
765
- data: null;
766
- error: PossibleHTTPError<TErrorData>;
767
- response: Response;
768
- } | {
769
- data: null;
770
- error: PossibleJavaScriptError;
771
- response: null;
772
- };
773
755
  type CallApiResult<TData, TErrorData, TResultMode extends ResultModeUnion, TThrowOnError extends boolean, TResponseType extends ResponseTypeUnion> = Promise<GetCallApiResult<TData, TErrorData, TResultMode, TThrowOnError, TResponseType>>;
774
756
 
775
- export { type CallApiRequestOptionsForHooks as A, type BaseCallApiConfig as B, type CallApiPlugin as C, type DefaultPluginArray as D, type ErrorContext as E, type CallApiResultErrorVariant as F, type CallApiResultSuccessVariant as G, HTTPError as H, type InferSchemaResult as I, type CombinedCallApiExtraOptions as J, type Register as K, type PluginInitContext as P, type ResultModeUnion as R, type SharedHookContext as S, type ResponseTypeUnion as a, type CallApiSchemas as b, type CallApiConfig as c, type CallApiResult as d, type DefaultDataType as e, type DefaultThrowOnError as f, type DefaultMoreOptions as g, type CallApiParameters as h, definePlugin as i, type PluginHooks as j, type PluginHooksWithMoreOptions as k, type RetryOptions as l, type PossibleHTTPError as m, type PossibleJavaScriptError as n, type Hooks as o, type HooksOrHooksArray as p, type RequestContext as q, type RequestErrorContext as r, type RequestStreamContext as s, type ResponseContext as t, type ResponseErrorContext as u, type ResponseStreamContext as v, type SuccessContext as w, type BaseCallApiExtraOptions as x, type CallApiExtraOptions as y, type CallApiRequestOptions as z };
757
+ export { type CallApiExtraOptions as A, type BaseCallApiConfig as B, type CallApiPlugin as C, type DefaultPluginArray as D, type ErrorContext as E, type CallApiRequestOptions as F, type CallApiRequestOptionsForHooks as G, HTTPError as H, type InferSchemaResult as I, type CombinedCallApiExtraOptions as J, type Register as K, type PluginInitContext as P, type ResultModeUnion as R, type SharedHookContext as S, type ResponseTypeUnion as a, type CallApiSchemas as b, type CallApiConfig as c, type CallApiResult as d, type DefaultDataType as e, type DefaultThrowOnError as f, type DefaultMoreOptions as g, type CallApiParameters as h, definePlugin as i, type PluginHooks as j, type PluginHooksWithMoreOptions as k, type RetryOptions as l, type PossibleHTTPError as m, type PossibleJavaScriptError as n, type CallApiResultErrorVariant as o, type CallApiResultSuccessVariant as p, type Hooks as q, type HooksOrHooksArray as r, type RequestContext as s, type RequestErrorContext as t, type RequestStreamContext as u, type ResponseContext as v, type ResponseErrorContext as w, type ResponseStreamContext as x, type SuccessContext as y, type BaseCallApiExtraOptions as z };
@@ -1,5 +1,5 @@
1
- import { R as ResultModeUnion, a as ResponseTypeUnion, C as CallApiPlugin, D as DefaultPluginArray, b as CallApiSchemas, I as InferSchemaResult, c as CallApiConfig, d as CallApiResult, e as DefaultDataType, f as DefaultThrowOnError, g as DefaultMoreOptions, B as BaseCallApiConfig, h as CallApiParameters } from './common-BwOrtpui.js';
2
- export { x as BaseCallApiExtraOptions, y as CallApiExtraOptions, z as CallApiRequestOptions, A as CallApiRequestOptionsForHooks, F as CallApiResultErrorVariant, G as CallApiResultSuccessVariant, J as CombinedCallApiExtraOptions, E as ErrorContext, H as HTTPError, o as Hooks, p as HooksOrHooksArray, j as PluginHooks, k as PluginHooksWithMoreOptions, P as PluginInitContext, m as PossibleHTTPError, n as PossibleJavaScriptError, K as Register, q as RequestContext, r as RequestErrorContext, s as RequestStreamContext, t as ResponseContext, u as ResponseErrorContext, v as ResponseStreamContext, l as RetryOptions, S as SharedHookContext, w as SuccessContext, i as definePlugin } from './common-BwOrtpui.js';
1
+ import { R as ResultModeUnion, a as ResponseTypeUnion, C as CallApiPlugin, D as DefaultPluginArray, b as CallApiSchemas, I as InferSchemaResult, c as CallApiConfig, d as CallApiResult, e as DefaultDataType, f as DefaultThrowOnError, g as DefaultMoreOptions, B as BaseCallApiConfig, h as CallApiParameters } from './common-CUR8HxVd.js';
2
+ export { z as BaseCallApiExtraOptions, A as CallApiExtraOptions, F as CallApiRequestOptions, G as CallApiRequestOptionsForHooks, o as CallApiResultErrorVariant, p as CallApiResultSuccessVariant, J as CombinedCallApiExtraOptions, E as ErrorContext, H as HTTPError, q as Hooks, r as HooksOrHooksArray, j as PluginHooks, k as PluginHooksWithMoreOptions, P as PluginInitContext, m as PossibleHTTPError, n as PossibleJavaScriptError, K as Register, s as RequestContext, t as RequestErrorContext, u as RequestStreamContext, v as ResponseContext, w as ResponseErrorContext, x as ResponseStreamContext, l as RetryOptions, S as SharedHookContext, y as SuccessContext, i as definePlugin } from './common-CUR8HxVd.js';
3
3
 
4
4
  declare const createFetchClient: <TBaseData = DefaultDataType, TBaseErrorData = DefaultDataType, TBaseResultMode extends ResultModeUnion = ResultModeUnion, TBaseThrowOnError extends boolean = DefaultThrowOnError, TBaseResponseType extends ResponseTypeUnion = ResponseTypeUnion, TBasePluginArray extends CallApiPlugin[] = DefaultPluginArray, TBaseSchemas extends CallApiSchemas = DefaultMoreOptions>(initBaseConfig?: BaseCallApiConfig<TBaseData, TBaseErrorData, TBaseResultMode, TBaseThrowOnError, TBaseResponseType, TBasePluginArray, TBaseSchemas>) => <TData = InferSchemaResult<TBaseSchemas["data"], TBaseData>, TErrorData = InferSchemaResult<TBaseSchemas["errorData"], TBaseErrorData>, TResultMode extends ResultModeUnion = TBaseResultMode, TThrowOnError extends boolean = TBaseThrowOnError, TResponseType extends ResponseTypeUnion = TBaseResponseType, TPluginArray extends CallApiPlugin[] = TBasePluginArray, TSchemas extends CallApiSchemas = TBaseSchemas>(initURL: InferSchemaResult<TSchemas["initURL"], string | URL>, config?: CallApiConfig<TData, TErrorData, TResultMode, TThrowOnError, TResponseType, TPluginArray, TSchemas> | undefined) => CallApiResult<InferSchemaResult<TSchemas["data"], TData>, InferSchemaResult<TSchemas["errorData"], TErrorData>, TResultMode, TThrowOnError, TResponseType>;
5
5
  declare const callApi: <TData = unknown, TErrorData = unknown, TResultMode extends ResultModeUnion = ResultModeUnion, TThrowOnError extends boolean = boolean, TResponseType extends ResponseTypeUnion = ResponseTypeUnion, TPluginArray extends CallApiPlugin[] = DefaultPluginArray, TSchemas extends CallApiSchemas = {}>(initURL: InferSchemaResult<TSchemas["initURL"], string | URL>, config?: CallApiConfig<TData, TErrorData, TResultMode, TThrowOnError, TResponseType, TPluginArray, TSchemas> | undefined) => CallApiResult<InferSchemaResult<TSchemas["data"], TData>, InferSchemaResult<TSchemas["errorData"], TErrorData>, TResultMode, TThrowOnError, TResponseType>;