@zayne-labs/callapi 1.3.2 → 1.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{index-ERam9OPy.d.cts → index-DnZtIr3r.d.cts} +86 -83
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +8 -8
- package/dist/cjs/options/index.cjs.map +1 -1
- package/dist/cjs/options/index.d.cts +10 -10
- package/dist/cjs/utils/index.cjs.map +1 -1
- package/dist/cjs/utils/index.d.cts +1 -1
- package/dist/esm/{chunk-YMYY7IIH.js → chunk-62WNJ6T4.js} +1 -1
- package/dist/esm/chunk-62WNJ6T4.js.map +1 -0
- package/dist/esm/{chunk-L7XLLBDP.js → chunk-OCGFLXP6.js} +1 -1
- package/dist/esm/chunk-OCGFLXP6.js.map +1 -0
- package/dist/esm/{index-ERam9OPy.d.ts → index-DnZtIr3r.d.ts} +86 -83
- package/dist/esm/index.d.ts +8 -8
- package/dist/esm/index.js +1 -1
- package/dist/esm/options/index.d.ts +10 -10
- package/dist/esm/options/index.js +1 -1
- package/dist/esm/options/index.js.map +1 -1
- package/dist/esm/utils/index.d.ts +1 -1
- package/dist/esm/utils/index.js +1 -1
- package/package.json +1 -1
- package/dist/esm/chunk-L7XLLBDP.js.map +0 -1
- package/dist/esm/chunk-YMYY7IIH.js.map +0 -1
|
@@ -59,41 +59,52 @@ type UnmaskType<TValue> = {
|
|
|
59
59
|
_: TValue;
|
|
60
60
|
}["_"];
|
|
61
61
|
type Awaitable<TValue> = Promise<TValue> | TValue;
|
|
62
|
-
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";
|
|
63
|
-
type CommonAuthorizationHeaders = "Basic" | "Bearer" | "Token"
|
|
64
|
-
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";
|
|
62
|
+
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;
|
|
63
|
+
type CommonAuthorizationHeaders = `${"Basic" | "Bearer" | "Token" | AnyString} ${string}`;
|
|
64
|
+
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;
|
|
65
65
|
|
|
66
|
-
type
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
declare const toQueryString: ToQueryStringFn;
|
|
71
|
-
declare const getResponseType: <TResponse>(response: Response, parser?: Required<CallApiExtraOptions>["responseParser"]) => {
|
|
72
|
-
arrayBuffer: () => Promise<TResponse>;
|
|
73
|
-
blob: () => Promise<TResponse>;
|
|
74
|
-
formData: () => Promise<TResponse>;
|
|
75
|
-
json: () => Promise<Record<string, unknown> | TResponse>;
|
|
76
|
-
stream: () => ReadableStream<Uint8Array<ArrayBufferLike>> | null;
|
|
77
|
-
text: () => Promise<TResponse>;
|
|
78
|
-
};
|
|
79
|
-
type ErrorObjectUnion<TErrorData = unknown> = PossibleHTTPError<TErrorData> | PossibleJavaScriptError;
|
|
80
|
-
declare const isHTTPError: <TErrorData>(error: ErrorObjectUnion<TErrorData> | null) => error is PossibleHTTPError<TErrorData>;
|
|
81
|
-
type ErrorDetails<TErrorResponse> = {
|
|
82
|
-
defaultErrorMessage: string;
|
|
83
|
-
errorData: TErrorResponse;
|
|
84
|
-
response: Response;
|
|
66
|
+
type PluginInitContext<TMoreOptions extends AnyObject = DefaultMoreOptions> = {
|
|
67
|
+
initURL: string;
|
|
68
|
+
options: CombinedCallApiExtraOptions<DefaultDataType, DefaultDataType, ResultModeUnion, TMoreOptions>;
|
|
69
|
+
request: CallApiRequestOptionsForHooks;
|
|
85
70
|
};
|
|
86
|
-
type
|
|
87
|
-
|
|
71
|
+
type PluginInitResult = Partial<Omit<PluginInitContext, "request"> & {
|
|
72
|
+
request: CallApiRequestOptions;
|
|
73
|
+
}>;
|
|
74
|
+
type CreateExtraOptions<TMoreOptions> = (...params: never[]) => TMoreOptions;
|
|
75
|
+
type CallApiPlugin<TMoreOptions extends AnyObject = DefaultMoreOptions> = {
|
|
76
|
+
/**
|
|
77
|
+
* @description Defines additional options that can be passed to callApi
|
|
78
|
+
*/
|
|
79
|
+
createExtraOptions?: CreateExtraOptions<TMoreOptions>;
|
|
80
|
+
/**
|
|
81
|
+
* @description A description for the plugin
|
|
82
|
+
*/
|
|
83
|
+
description?: string;
|
|
84
|
+
/**
|
|
85
|
+
* Hooks / Interceptors for the plugin
|
|
86
|
+
*/
|
|
87
|
+
hooks?: InterceptorsOrInterceptorArray;
|
|
88
|
+
/**
|
|
89
|
+
* @description A unique id for the plugin
|
|
90
|
+
*/
|
|
91
|
+
id: string;
|
|
92
|
+
/**
|
|
93
|
+
* @description A function that will be called when the plugin is
|
|
94
|
+
* initialized. This will be called before the any
|
|
95
|
+
* of the other internal functions.
|
|
96
|
+
*/
|
|
97
|
+
init?: (context: PluginInitContext) => Awaitable<PluginInitResult> | Awaitable<void>;
|
|
98
|
+
/**
|
|
99
|
+
* @description A name for the plugin
|
|
100
|
+
*/
|
|
101
|
+
name: string;
|
|
102
|
+
/**
|
|
103
|
+
* @description A version for the plugin
|
|
104
|
+
*/
|
|
105
|
+
version?: string;
|
|
88
106
|
};
|
|
89
|
-
declare
|
|
90
|
-
errorData: ErrorDetails<TErrorResponse>["errorData"];
|
|
91
|
-
isHTTPError: boolean;
|
|
92
|
-
name: "HTTPError";
|
|
93
|
-
response: ErrorDetails<TErrorResponse>["response"];
|
|
94
|
-
constructor(errorDetails: ErrorDetails<TErrorResponse>, errorOptions?: ErrorOptions);
|
|
95
|
-
}
|
|
96
|
-
declare const isHTTPErrorInstance: <TErrorResponse>(error: unknown) => error is HTTPError<TErrorResponse>;
|
|
107
|
+
declare const definePlugin: <TMoreOptions extends AnyObject = {}, TPlugin extends AnyFunction<CallApiPlugin<TMoreOptions>> | CallApiPlugin<TMoreOptions> = CallApiPlugin<TMoreOptions>>(plugin: TPlugin) => TPlugin;
|
|
97
108
|
|
|
98
109
|
type RetryCondition<TErrorData> = (context: ErrorContext<TErrorData>) => boolean | Promise<boolean>;
|
|
99
110
|
interface RetryOptions<TErrorData> {
|
|
@@ -137,47 +148,39 @@ interface RetryOptions<TErrorData> {
|
|
|
137
148
|
retryStrategy?: "exponential" | "linear";
|
|
138
149
|
}
|
|
139
150
|
|
|
140
|
-
type
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
request: CallApiRequestOptionsForHooks;
|
|
151
|
+
type ToQueryStringFn = {
|
|
152
|
+
(params: CallApiConfig["query"]): string | null;
|
|
153
|
+
(params: Required<CallApiConfig>["query"]): string;
|
|
144
154
|
};
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
*/
|
|
154
|
-
description?: string;
|
|
155
|
-
/**
|
|
156
|
-
* Hooks / Interceptors for the plugin
|
|
157
|
-
*/
|
|
158
|
-
hooks?: InterceptorsOrInterceptorArray;
|
|
159
|
-
/**
|
|
160
|
-
* @description A unique id for the plugin
|
|
161
|
-
*/
|
|
162
|
-
id: string;
|
|
163
|
-
/**
|
|
164
|
-
* @description A function that will be called when the plugin is
|
|
165
|
-
* initialized. This will be called before the any
|
|
166
|
-
* of the other internal functions.
|
|
167
|
-
*/
|
|
168
|
-
init?: (context: PluginInitContext) => Awaitable<Partial<PluginInitContext>> | Awaitable<void>;
|
|
169
|
-
/**
|
|
170
|
-
* @description A name for the plugin
|
|
171
|
-
*/
|
|
172
|
-
name: string;
|
|
173
|
-
/**
|
|
174
|
-
* @description A version for the plugin
|
|
175
|
-
*/
|
|
176
|
-
version?: string;
|
|
155
|
+
declare const toQueryString: ToQueryStringFn;
|
|
156
|
+
declare const getResponseType: <TResponse>(response: Response, parser?: Required<CallApiExtraOptions>["responseParser"]) => {
|
|
157
|
+
arrayBuffer: () => Promise<TResponse>;
|
|
158
|
+
blob: () => Promise<TResponse>;
|
|
159
|
+
formData: () => Promise<TResponse>;
|
|
160
|
+
json: () => Promise<Record<string, unknown> | TResponse>;
|
|
161
|
+
stream: () => ReadableStream<Uint8Array<ArrayBufferLike>> | null;
|
|
162
|
+
text: () => Promise<TResponse>;
|
|
177
163
|
};
|
|
178
|
-
|
|
164
|
+
type ErrorObjectUnion<TErrorData = unknown> = PossibleHTTPError<TErrorData> | PossibleJavaScriptError;
|
|
165
|
+
declare const isHTTPError: <TErrorData>(error: ErrorObjectUnion<TErrorData> | null) => error is PossibleHTTPError<TErrorData>;
|
|
166
|
+
type ErrorDetails<TErrorResponse> = {
|
|
167
|
+
defaultErrorMessage: string;
|
|
168
|
+
errorData: TErrorResponse;
|
|
169
|
+
response: Response;
|
|
170
|
+
};
|
|
171
|
+
type ErrorOptions = {
|
|
172
|
+
cause?: unknown;
|
|
173
|
+
};
|
|
174
|
+
declare class HTTPError<TErrorResponse = Record<string, unknown>> extends Error {
|
|
175
|
+
errorData: ErrorDetails<TErrorResponse>["errorData"];
|
|
176
|
+
isHTTPError: boolean;
|
|
177
|
+
name: "HTTPError";
|
|
178
|
+
response: ErrorDetails<TErrorResponse>["response"];
|
|
179
|
+
constructor(errorDetails: ErrorDetails<TErrorResponse>, errorOptions?: ErrorOptions);
|
|
180
|
+
}
|
|
181
|
+
declare const isHTTPErrorInstance: <TErrorResponse>(error: unknown) => error is HTTPError<TErrorResponse>;
|
|
179
182
|
|
|
180
|
-
declare const fetchSpecificKeys: ("
|
|
183
|
+
declare const fetchSpecificKeys: ("headers" | "body" | "cache" | "credentials" | "integrity" | "keepalive" | "method" | "mode" | "priority" | "redirect" | "referrer" | "referrerPolicy" | "signal" | "window")[];
|
|
181
184
|
|
|
182
185
|
type FetchSpecificKeysUnion = Exclude<(typeof fetchSpecificKeys)[number], "body" | "headers" | "method">;
|
|
183
186
|
interface CallApiRequestOptions extends Pick<RequestInit, FetchSpecificKeysUnion> {
|
|
@@ -188,15 +191,15 @@ interface CallApiRequestOptions extends Pick<RequestInit, FetchSpecificKeysUnion
|
|
|
188
191
|
/**
|
|
189
192
|
* @description Headers to be used in the request.
|
|
190
193
|
*/
|
|
191
|
-
headers?: Record<"Authorization", CommonAuthorizationHeaders> | Record<"Content-Type", CommonContentTypes> | Record<CommonRequestHeaders |
|
|
194
|
+
headers?: Record<"Authorization", CommonAuthorizationHeaders> | Record<"Content-Type", CommonContentTypes> | Record<CommonRequestHeaders, string | undefined> | Record<string, string | undefined> | RequestInit["headers"];
|
|
192
195
|
/**
|
|
193
196
|
* @description HTTP method for the request.
|
|
194
197
|
* @default "GET"
|
|
195
198
|
*/
|
|
196
199
|
method?: "DELETE" | "GET" | "PATCH" | "POST" | "PUT" | AnyString;
|
|
197
200
|
}
|
|
198
|
-
interface CallApiRequestOptionsForHooks extends CallApiRequestOptions {
|
|
199
|
-
headers?: Record<
|
|
201
|
+
interface CallApiRequestOptionsForHooks extends Omit<CallApiRequestOptions, "headers"> {
|
|
202
|
+
headers?: Record<string, string | undefined>;
|
|
200
203
|
}
|
|
201
204
|
interface Register {
|
|
202
205
|
}
|
|
@@ -241,7 +244,7 @@ type DefaultMoreOptions = NonNullable<unknown>;
|
|
|
241
244
|
type Meta = Register extends {
|
|
242
245
|
meta?: infer TMeta extends Record<string, unknown>;
|
|
243
246
|
} ? TMeta : never;
|
|
244
|
-
type ExtraOptions<TData = DefaultDataType, TErrorData = DefaultDataType, TResultMode extends
|
|
247
|
+
type ExtraOptions<TData = DefaultDataType, TErrorData = DefaultDataType, TResultMode extends ResultModeUnion = ResultModeUnion, TMoreOptions extends AnyObject = DefaultMoreOptions> = InterceptorsOrInterceptorArray<TData, TErrorData> & Partial<TMoreOptions> & RetryOptions<TErrorData> & {
|
|
245
248
|
/**
|
|
246
249
|
* @description Authorization header value.
|
|
247
250
|
*/
|
|
@@ -374,18 +377,18 @@ type ExtraOptions<TData = DefaultDataType, TErrorData = DefaultDataType, TResult
|
|
|
374
377
|
timeout?: number;
|
|
375
378
|
};
|
|
376
379
|
declare const optionsEnumToExtendFromBase: "plugins"[];
|
|
377
|
-
type CallApiExtraOptions<TData = DefaultDataType, TErrorData = DefaultDataType, TResultMode extends
|
|
380
|
+
type CallApiExtraOptions<TData = DefaultDataType, TErrorData = DefaultDataType, TResultMode extends ResultModeUnion = ResultModeUnion, TMoreOptions extends AnyObject = DefaultMoreOptions> = ExtraOptions<TData, TErrorData, TResultMode, TMoreOptions> & {
|
|
378
381
|
/**
|
|
379
382
|
* @description Options that should extend the base options.
|
|
380
383
|
*/
|
|
381
384
|
extend?: Pick<ExtraOptions<TData, TErrorData, TResultMode, TMoreOptions>, (typeof optionsEnumToExtendFromBase)[number]>;
|
|
382
385
|
};
|
|
383
386
|
declare const optionsEnumToOmitFromBase: ("dedupeKey" | "extend")[];
|
|
384
|
-
type BaseCallApiExtraOptions<TBaseData = DefaultDataType, TBaseErrorData = DefaultDataType, TBaseResultMode extends
|
|
385
|
-
type CombinedCallApiExtraOptions<TData = DefaultDataType, TErrorData = DefaultDataType, TResultMode extends
|
|
386
|
-
type CallApiConfig<TData = DefaultDataType, TErrorData = DefaultDataType, TResultMode extends
|
|
387
|
-
type BaseCallApiConfig<TBaseData = DefaultDataType, TBaseErrorData = DefaultDataType, TBaseResultMode extends
|
|
388
|
-
type CallApiParameters<TData = DefaultDataType, TErrorData = DefaultDataType, TResultMode extends
|
|
387
|
+
type BaseCallApiExtraOptions<TBaseData = DefaultDataType, TBaseErrorData = DefaultDataType, TBaseResultMode extends ResultModeUnion = ResultModeUnion, TMoreOptions extends AnyObject = DefaultMoreOptions> = Omit<CallApiExtraOptions<TBaseData, TBaseErrorData, TBaseResultMode, TMoreOptions>, (typeof optionsEnumToOmitFromBase)[number]>;
|
|
388
|
+
type CombinedCallApiExtraOptions<TData = DefaultDataType, TErrorData = DefaultDataType, TResultMode extends ResultModeUnion = ResultModeUnion, TMoreOptions extends AnyObject = DefaultMoreOptions> = BaseCallApiExtraOptions<TData, TErrorData, TResultMode, TMoreOptions> & CallApiExtraOptions<TData, TErrorData, TResultMode, TMoreOptions>;
|
|
389
|
+
type CallApiConfig<TData = DefaultDataType, TErrorData = DefaultDataType, TResultMode extends ResultModeUnion = ResultModeUnion, TMoreOptions extends AnyObject = DefaultMoreOptions> = CallApiExtraOptions<TData, TErrorData, TResultMode, TMoreOptions> & CallApiRequestOptions;
|
|
390
|
+
type BaseCallApiConfig<TBaseData = DefaultDataType, TBaseErrorData = DefaultDataType, TBaseResultMode extends ResultModeUnion = ResultModeUnion, TBaseMoreOptions extends AnyObject = DefaultMoreOptions> = BaseCallApiExtraOptions<TBaseData, TBaseErrorData, TBaseResultMode, TBaseMoreOptions> & CallApiRequestOptions;
|
|
391
|
+
type CallApiParameters<TData = DefaultDataType, TErrorData = DefaultDataType, TResultMode extends ResultModeUnion = ResultModeUnion, TMoreOptions extends AnyObject = DefaultMoreOptions> = [initURL: string, config?: CallApiConfig<TData, TErrorData, TResultMode, TMoreOptions>];
|
|
389
392
|
type RequestContext = UnmaskType<{
|
|
390
393
|
options: CombinedCallApiExtraOptions;
|
|
391
394
|
request: CallApiRequestOptionsForHooks;
|
|
@@ -463,9 +466,9 @@ type ResultModeMap<TData = DefaultDataType, TErrorData = DefaultDataType> = {
|
|
|
463
466
|
onlySuccess: CallApiResultErrorVariant<TErrorData>["data"] | CallApiResultSuccessVariant<TData>["data"];
|
|
464
467
|
onlySuccessWithException: CallApiResultSuccessVariant<TData>["data"];
|
|
465
468
|
};
|
|
466
|
-
type
|
|
469
|
+
type ResultModeUnion = {
|
|
467
470
|
[Key in keyof ResultModeMap]: Key;
|
|
468
471
|
}[keyof ResultModeMap] | undefined;
|
|
469
|
-
type GetCallApiResult<TData, TErrorData, TResultMode> = TErrorData extends false ? ResultModeMap<TData, TErrorData>["onlySuccessWithException"] : undefined extends TResultMode ? ResultModeMap<TData, TErrorData>["all"] : TResultMode extends NonNullable<
|
|
472
|
+
type GetCallApiResult<TData, TErrorData, TResultMode> = TErrorData extends false ? ResultModeMap<TData, TErrorData>["onlySuccessWithException"] : undefined extends TResultMode ? ResultModeMap<TData, TErrorData>["all"] : TResultMode extends NonNullable<ResultModeUnion> ? ResultModeMap<TData, TErrorData>[TResultMode] : never;
|
|
470
473
|
|
|
471
|
-
export { type AnyObject as A, type BaseCallApiConfig as B, type
|
|
474
|
+
export { type AnyObject as A, type BaseCallApiConfig as B, type CallApiConfig as C, type DefaultDataType as D, type ErrorContext as E, type GetCallApiResult as G, HTTPError as H, type Interceptors as I, type PluginInitContext as P, type ResultModeUnion as R, type SuccessContext as S, type CallApiPlugin as a, type BaseCallApiExtraOptions as b, type CallApiExtraOptions as c, definePlugin as d, type PossibleJavaScriptError as e, type PossibleHTTPError as f, type CallApiParameters as g, type CallApiRequestOptions as h, type CallApiRequestOptionsForHooks as i, type CallApiResultErrorVariant as j, type CallApiResultSuccessVariant as k, type CombinedCallApiExtraOptions as l, type InterceptorsOrInterceptorArray as m, type PossibleJavascriptErrorNames as n, type Register as o, type RequestContext as p, type RequestErrorContext as q, type ResponseContext as r, type ResponseErrorContext as s, type DefaultMoreOptions as t, isHTTPError as u, isHTTPErrorInstance as v, toQueryString as w };
|