@zayne-labs/callapi 1.13.0 → 1.14.0
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/{default-types-Cn2QRN13.d.ts → conditional-types-BXgYQJ5q.d.ts} +311 -295
- package/dist/constants/index.d.ts +1 -1
- package/dist/constants/index.js +1 -1
- package/dist/{constants-Cj_bGg18.js → constants-CQmUuQDT.js} +8 -3
- package/dist/constants-CQmUuQDT.js.map +1 -0
- package/dist/{index-WSyoCGJi.d.ts → index-D-LyaiZE.d.ts} +7 -7
- package/dist/index.d.ts +3 -3
- package/dist/index.js +9 -7
- package/dist/index.js.map +1 -1
- package/dist/utils/external/index.d.ts +1 -1
- package/dist/utils/external/index.js +1 -1
- package/package.json +12 -12
- package/dist/constants-Cj_bGg18.js.map +0 -1
|
@@ -1,9 +1,41 @@
|
|
|
1
1
|
//#region src/constants/common.d.ts
|
|
2
2
|
declare const fetchSpecificKeys: readonly (keyof RequestInit | "duplex" | "extraFetchOptions")[];
|
|
3
3
|
//#endregion
|
|
4
|
-
//#region src/
|
|
5
|
-
|
|
6
|
-
type
|
|
4
|
+
//#region src/types/type-helpers.d.ts
|
|
5
|
+
type AnyString = string & NonNullable<unknown>;
|
|
6
|
+
type AnyNumber = number & NonNullable<unknown>;
|
|
7
|
+
type AnyFunction<TResult = unknown> = (...args: any[]) => TResult;
|
|
8
|
+
type Prettify<TObject> = NonNullable<unknown> & { [Key in keyof TObject]: TObject[Key] };
|
|
9
|
+
type WriteableLevel = "deep" | "shallow";
|
|
10
|
+
/**
|
|
11
|
+
* Makes all properties in an object type writeable (removes readonly modifiers).
|
|
12
|
+
* Supports both shallow and deep modes, and handles special cases like arrays, tuples, and unions.
|
|
13
|
+
* @template TObject - The object type to make writeable
|
|
14
|
+
* @template TVariant - The level of writeable transformation ("shallow" | "deep")
|
|
15
|
+
*/
|
|
16
|
+
type ArrayOrObject = Record<number | string | symbol, unknown> | unknown[] | readonly unknown[];
|
|
17
|
+
type Writeable<TObject, TLevel extends WriteableLevel = "shallow"> = TObject extends ArrayOrObject ? { -readonly [Key in keyof TObject]: TLevel extends "deep" ? NonNullable<TObject[Key]> extends ArrayOrObject ? Writeable<TObject[Key], "deep"> : TObject[Key] : TObject[Key] } : TObject;
|
|
18
|
+
type UnionToIntersection<TUnion> = (TUnion extends unknown ? (param: TUnion) => void : never) extends ((param: infer TParam) => void) ? TParam : never;
|
|
19
|
+
type UnmaskType<TValue> = {
|
|
20
|
+
value: TValue;
|
|
21
|
+
}["value"];
|
|
22
|
+
/**
|
|
23
|
+
* @description Userland implementation of NoInfer intrinsic type, but this one doesn't show up on hover like the intrinsic one
|
|
24
|
+
*
|
|
25
|
+
* Prevents TypeScript from inferring `TGeneric` at this position by creating a circular dependency.
|
|
26
|
+
* The tuple index `[TGeneric extends unknown ? 0 : never]` depends on `TGeneric`, forcing TS to
|
|
27
|
+
* skip this site for inference and use other arguments or defaults instead.
|
|
28
|
+
*/
|
|
29
|
+
type NoInferUnMasked<TGeneric> = [TGeneric][TGeneric extends unknown ? 0 : never];
|
|
30
|
+
type RemoveSlashImpl<TUrl extends string, TDirection extends "leading" | "trailing"> = TDirection extends "leading" ? TUrl extends `/${infer TWithoutLeadingSlash}` ? TWithoutLeadingSlash : TUrl : TDirection extends "trailing" ? TUrl extends `${infer TWithoutTailingSlash}/` ? TWithoutTailingSlash : TUrl : never;
|
|
31
|
+
type RemoveTrailingSlash<TUrl extends string> = RemoveSlashImpl<TUrl, "trailing">;
|
|
32
|
+
type RemoveLeadingSlash<TUrl extends string> = RemoveSlashImpl<TUrl, "leading">;
|
|
33
|
+
type Awaitable<TValue> = Promise<TValue> | TValue;
|
|
34
|
+
type Satisfies<TActualType extends TExpectedTypeShape, TExpectedTypeShape> = { [Key in keyof TActualType]: Key extends keyof TExpectedTypeShape ? TActualType[Key] : never };
|
|
35
|
+
type DistributiveOmit<TObject, TKeysToOmit extends keyof TObject> = TObject extends unknown ? Omit<TObject, TKeysToOmit> : never;
|
|
36
|
+
type CommonRequestHeaders = "Access-Control-Allow-Credentials" | "Access-Control-Allow-Headers" | "Access-Control-Allow-Methods" | "Access-Control-Allow-Origin" | "Access-Control-Expose-Headers" | "Access-Control-Max-Age" | "Age" | "Allow" | "Cache-Control" | "Clear-Site-Data" | "Content-Disposition" | "Content-Encoding" | "Content-Language" | "Content-Length" | "Content-Location" | "Content-Range" | "Content-Security-Policy-Report-Only" | "Content-Security-Policy" | "Cookie" | "Cross-Origin-Embedder-Policy" | "Cross-Origin-Opener-Policy" | "Cross-Origin-Resource-Policy" | "Date" | "ETag" | "Expires" | "Last-Modified" | "Location" | "Permissions-Policy" | "Pragma" | "Retry-After" | "Save-Data" | "Sec-CH-Prefers-Color-Scheme" | "Sec-CH-Prefers-Reduced-Motion" | "Sec-CH-UA-Arch" | "Sec-CH-UA-Bitness" | "Sec-CH-UA-Form-Factor" | "Sec-CH-UA-Full-Version-List" | "Sec-CH-UA-Full-Version" | "Sec-CH-UA-Mobile" | "Sec-CH-UA-Model" | "Sec-CH-UA-Platform-Version" | "Sec-CH-UA-Platform" | "Sec-CH-UA-WoW64" | "Sec-CH-UA" | "Sec-Fetch-Dest" | "Sec-Fetch-Mode" | "Sec-Fetch-Site" | "Sec-Fetch-User" | "Sec-GPC" | "Server-Timing" | "Server" | "Service-Worker-Navigation-Preload" | "Set-Cookie" | "Strict-Transport-Security" | "Timing-Allow-Origin" | "Trailer" | "Transfer-Encoding" | "Upgrade" | "Vary" | "Warning" | "WWW-Authenticate" | "X-Content-Type-Options" | "X-DNS-Prefetch-Control" | "X-Frame-Options" | "X-Permitted-Cross-Domain-Policies" | "X-Powered-By" | "X-Robots-Tag" | "X-XSS-Protection" | AnyString;
|
|
37
|
+
type CommonAuthorizationHeaders = `${"Basic" | "Bearer" | "Token"} ${string}`;
|
|
38
|
+
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;
|
|
7
39
|
//#endregion
|
|
8
40
|
//#region src/types/standard-schema.d.ts
|
|
9
41
|
/** The Standard Typed interface. This is a base type extended by other specs. */
|
|
@@ -82,41 +114,9 @@ declare namespace StandardSchemaV1 {
|
|
|
82
114
|
type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
|
|
83
115
|
}
|
|
84
116
|
//#endregion
|
|
85
|
-
//#region src/
|
|
86
|
-
|
|
87
|
-
type
|
|
88
|
-
type AnyFunction<TResult = unknown> = (...args: any[]) => TResult;
|
|
89
|
-
type Prettify<TObject> = NonNullable<unknown> & { [Key in keyof TObject]: TObject[Key] };
|
|
90
|
-
type WriteableLevel = "deep" | "shallow";
|
|
91
|
-
/**
|
|
92
|
-
* Makes all properties in an object type writeable (removes readonly modifiers).
|
|
93
|
-
* Supports both shallow and deep modes, and handles special cases like arrays, tuples, and unions.
|
|
94
|
-
* @template TObject - The object type to make writeable
|
|
95
|
-
* @template TVariant - The level of writeable transformation ("shallow" | "deep")
|
|
96
|
-
*/
|
|
97
|
-
type ArrayOrObject = Record<number | string | symbol, unknown> | unknown[] | readonly unknown[];
|
|
98
|
-
type Writeable<TObject, TLevel extends WriteableLevel = "shallow"> = TObject extends ArrayOrObject ? { -readonly [Key in keyof TObject]: TLevel extends "deep" ? NonNullable<TObject[Key]> extends ArrayOrObject ? Writeable<TObject[Key], "deep"> : TObject[Key] : TObject[Key] } : TObject;
|
|
99
|
-
type UnionToIntersection<TUnion> = (TUnion extends unknown ? (param: TUnion) => void : never) extends ((param: infer TParam) => void) ? TParam : never;
|
|
100
|
-
type UnmaskType<TValue> = {
|
|
101
|
-
value: TValue;
|
|
102
|
-
}["value"];
|
|
103
|
-
/**
|
|
104
|
-
* @description Userland implementation of NoInfer intrinsic type, but this one doesn't show up on hover like the intrinsic one
|
|
105
|
-
*
|
|
106
|
-
* Prevents TypeScript from inferring `TGeneric` at this position by creating a circular dependency.
|
|
107
|
-
* The tuple index `[TGeneric extends unknown ? 0 : never]` depends on `TGeneric`, forcing TS to
|
|
108
|
-
* skip this site for inference and use other arguments or defaults instead.
|
|
109
|
-
*/
|
|
110
|
-
type NoInferUnMasked<TGeneric> = [TGeneric][TGeneric extends unknown ? 0 : never];
|
|
111
|
-
type RemoveSlashImpl<TUrl extends string, TDirection extends "leading" | "trailing"> = TDirection extends "leading" ? TUrl extends `/${infer TWithoutLeadingSlash}` ? TWithoutLeadingSlash : TUrl : TDirection extends "trailing" ? TUrl extends `${infer TWithoutTailingSlash}/` ? TWithoutTailingSlash : TUrl : never;
|
|
112
|
-
type RemoveTrailingSlash<TUrl extends string> = RemoveSlashImpl<TUrl, "trailing">;
|
|
113
|
-
type RemoveLeadingSlash<TUrl extends string> = RemoveSlashImpl<TUrl, "leading">;
|
|
114
|
-
type Awaitable<TValue> = Promise<TValue> | TValue;
|
|
115
|
-
type Satisfies<TActualType extends TExpectedTypeShape, TExpectedTypeShape> = { [Key in keyof TActualType]: Key extends keyof TExpectedTypeShape ? TActualType[Key] : never };
|
|
116
|
-
type DistributiveOmit<TObject, TKeysToOmit extends keyof TObject> = TObject extends unknown ? Omit<TObject, TKeysToOmit> : never;
|
|
117
|
-
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;
|
|
118
|
-
type CommonAuthorizationHeaders = `${"Basic" | "Bearer" | "Token"} ${string}`;
|
|
119
|
-
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;
|
|
117
|
+
//#region src/constants/validation.d.ts
|
|
118
|
+
declare const fallBackRouteSchemaKey = "@default";
|
|
119
|
+
type FallBackRouteSchemaKey = typeof fallBackRouteSchemaKey;
|
|
120
120
|
//#endregion
|
|
121
121
|
//#region src/url.d.ts
|
|
122
122
|
declare const atSymbol = "@";
|
|
@@ -341,6 +341,238 @@ declare const getCurrentRouteSchemaKeyAndMainInitURL: (context: Pick<GetResolved
|
|
|
341
341
|
mainInitURL: string;
|
|
342
342
|
};
|
|
343
343
|
//#endregion
|
|
344
|
+
//#region src/utils/external/error.d.ts
|
|
345
|
+
type HTTPErrorDetails<TErrorData> = Pick<CallApiExtraOptions, "defaultHTTPErrorMessage"> & {
|
|
346
|
+
errorData: TErrorData;
|
|
347
|
+
response: Response;
|
|
348
|
+
};
|
|
349
|
+
declare class HTTPError<TErrorData = Record<string, unknown>> extends Error {
|
|
350
|
+
errorData: HTTPErrorDetails<TErrorData>["errorData"];
|
|
351
|
+
readonly httpErrorSymbol: symbol;
|
|
352
|
+
name: "HTTPError";
|
|
353
|
+
response: HTTPErrorDetails<TErrorData>["response"];
|
|
354
|
+
constructor(errorDetails: HTTPErrorDetails<TErrorData>, errorOptions?: ErrorOptions);
|
|
355
|
+
/**
|
|
356
|
+
* @description Checks if the given error is an instance of HTTPError
|
|
357
|
+
* @param error - The error to check
|
|
358
|
+
* @returns true if the error is an instance of HTTPError, false otherwise
|
|
359
|
+
*/
|
|
360
|
+
static isError<TErrorData>(error: unknown): error is HTTPError<TErrorData>;
|
|
361
|
+
}
|
|
362
|
+
type SafeExtract<TUnion, TKey extends TUnion> = Extract<TUnion, TKey>;
|
|
363
|
+
type ValidationErrorDetails = {
|
|
364
|
+
/**
|
|
365
|
+
* The cause of the validation error.
|
|
366
|
+
*
|
|
367
|
+
* It's either the name the schema for which validation failed, or the name of the schema config option that led to the validation error.
|
|
368
|
+
*/
|
|
369
|
+
issueCause: "toFormData" | "toQueryString" | "unknown" | `schemaConfig-(${SafeExtract<keyof CallApiSchemaConfig, "strict">})` | keyof CallApiSchema;
|
|
370
|
+
/**
|
|
371
|
+
* The issues that caused the validation error.
|
|
372
|
+
*/
|
|
373
|
+
issues: readonly StandardSchemaV1.Issue[];
|
|
374
|
+
/**
|
|
375
|
+
* The response from server, if any.
|
|
376
|
+
*/
|
|
377
|
+
response: Response | null;
|
|
378
|
+
};
|
|
379
|
+
declare class ValidationError extends Error {
|
|
380
|
+
errorData: ValidationErrorDetails["issues"];
|
|
381
|
+
issueCause: ValidationErrorDetails["issueCause"];
|
|
382
|
+
name: "ValidationError";
|
|
383
|
+
response: ValidationErrorDetails["response"];
|
|
384
|
+
readonly validationErrorSymbol: symbol;
|
|
385
|
+
constructor(details: ValidationErrorDetails, errorOptions?: ErrorOptions);
|
|
386
|
+
/**
|
|
387
|
+
* @description Checks if the given error is an instance of ValidationError
|
|
388
|
+
* @param error - The error to check
|
|
389
|
+
* @returns true if the error is an instance of ValidationError, false otherwise
|
|
390
|
+
*/
|
|
391
|
+
static isError(error: unknown): error is ValidationError;
|
|
392
|
+
}
|
|
393
|
+
//#endregion
|
|
394
|
+
//#region src/result.d.ts
|
|
395
|
+
type ResponseParser<TData> = (text: string) => Awaitable<TData>;
|
|
396
|
+
declare const getResponseType: <TData>(response: Response, responseParser: ResponseParser<TData>) => {
|
|
397
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
398
|
+
blob: () => Promise<Blob>;
|
|
399
|
+
formData: () => Promise<FormData>;
|
|
400
|
+
json: () => Promise<TData>;
|
|
401
|
+
stream: () => ReadableStream<Uint8Array<ArrayBuffer>> | null;
|
|
402
|
+
text: () => Promise<string>;
|
|
403
|
+
};
|
|
404
|
+
type InitResponseTypeMap<TData = unknown> = ReturnType<typeof getResponseType<TData>>;
|
|
405
|
+
type ResponseTypeUnion = keyof InitResponseTypeMap;
|
|
406
|
+
type ResponseTypePlaceholder = null;
|
|
407
|
+
type ResponseTypeType = ResponseTypePlaceholder | ResponseTypeUnion;
|
|
408
|
+
type ResponseTypeMap<TData> = { [Key in keyof InitResponseTypeMap<TData>]: Awaited<ReturnType<InitResponseTypeMap<TData>[Key]>> };
|
|
409
|
+
type GetResponseType<TData, TResponseType extends ResponseTypeType, TComputedResponseTypeMap extends ResponseTypeMap<TData> = ResponseTypeMap<TData>> = null extends TResponseType ? TComputedResponseTypeMap["json"] : TResponseType extends NonNullable<ResponseTypeType> ? TComputedResponseTypeMap[TResponseType] : never;
|
|
410
|
+
type CallApiResultSuccessVariant<TData> = {
|
|
411
|
+
data: NoInferUnMasked<TData>;
|
|
412
|
+
error: null;
|
|
413
|
+
response: Response;
|
|
414
|
+
};
|
|
415
|
+
type PossibleJavaScriptError = UnmaskType<{
|
|
416
|
+
errorData: false;
|
|
417
|
+
message: string;
|
|
418
|
+
name: "AbortError" | "Error" | "SyntaxError" | "TimeoutError" | "TypeError" | AnyString;
|
|
419
|
+
originalError: DOMException | Error | SyntaxError | TypeError;
|
|
420
|
+
}>;
|
|
421
|
+
type PossibleHTTPError<TErrorData> = UnmaskType<{
|
|
422
|
+
errorData: NoInferUnMasked<TErrorData>;
|
|
423
|
+
message: string;
|
|
424
|
+
name: "HTTPError";
|
|
425
|
+
originalError: HTTPError;
|
|
426
|
+
}>;
|
|
427
|
+
type PossibleValidationError = UnmaskType<{
|
|
428
|
+
errorData: ValidationError["errorData"];
|
|
429
|
+
issueCause: ValidationError["issueCause"];
|
|
430
|
+
message: string;
|
|
431
|
+
name: "ValidationError";
|
|
432
|
+
originalError: ValidationError;
|
|
433
|
+
}>;
|
|
434
|
+
type CallApiResultErrorVariant<TErrorData> = {
|
|
435
|
+
data: null;
|
|
436
|
+
error: PossibleHTTPError<TErrorData>;
|
|
437
|
+
response: Response;
|
|
438
|
+
} | {
|
|
439
|
+
data: null;
|
|
440
|
+
error: PossibleJavaScriptError;
|
|
441
|
+
response: Response | null;
|
|
442
|
+
} | {
|
|
443
|
+
data: null;
|
|
444
|
+
error: PossibleValidationError;
|
|
445
|
+
response: Response | null;
|
|
446
|
+
};
|
|
447
|
+
type CallApiResultSuccessOrErrorVariant<TData, TError> = CallApiResultErrorVariant<TError> | CallApiResultSuccessVariant<TData>;
|
|
448
|
+
type GetCallApiResult<TThrowOnError extends ThrowOnErrorBoolean, TResultWithException extends CallApiResultSuccessVariant<unknown>, TResultWithoutException extends CallApiResultSuccessOrErrorVariant<unknown, unknown>> = TThrowOnError extends true ? TResultWithException : TResultWithoutException;
|
|
449
|
+
type ResultModeMap<TData = DefaultDataType, TErrorData = DefaultDataType, TThrowOnError extends ThrowOnErrorBoolean = DefaultThrowOnError, TComputedResult extends GetCallApiResult<TThrowOnError, CallApiResultSuccessVariant<TData>, CallApiResultSuccessOrErrorVariant<TData, TErrorData>> = GetCallApiResult<TThrowOnError, CallApiResultSuccessVariant<TData>, CallApiResultSuccessOrErrorVariant<TData, TErrorData>>> = UnmaskType<{
|
|
450
|
+
all: TComputedResult;
|
|
451
|
+
fetchApi: TComputedResult["response"];
|
|
452
|
+
onlyData: TComputedResult["data"];
|
|
453
|
+
onlyResponse: TComputedResult["response"];
|
|
454
|
+
withoutResponse: Prettify<DistributiveOmit<TComputedResult, "response">>;
|
|
455
|
+
}>;
|
|
456
|
+
type ResultModePlaceholder = null;
|
|
457
|
+
type ResultModeUnion = keyof ResultModeMap;
|
|
458
|
+
type ResultModeType = ResultModePlaceholder | ResultModeUnion;
|
|
459
|
+
type InferCallApiResult<TData, TErrorData, TResultMode extends ResultModeType, TThrowOnError extends ThrowOnErrorBoolean, TComputedResultModeMapWithException extends ResultModeMap<TData, TErrorData, true> = ResultModeMap<TData, TErrorData, true>, TComputedResultModeMapWithoutException extends ResultModeMap<TData, TErrorData, TThrowOnError> = ResultModeMap<TData, TErrorData, TThrowOnError>> = TErrorData extends false ? TComputedResultModeMapWithException["onlyData"] : TErrorData extends false | undefined ? TComputedResultModeMapWithException["onlyData"] : ResultModePlaceholder extends TResultMode ? TComputedResultModeMapWithoutException["all"] : TResultMode extends ResultModeUnion ? TComputedResultModeMapWithoutException[TResultMode] : never;
|
|
460
|
+
type ErrorInfoOptions = Pick<CallApiExtraOptions, "cloneResponse" | "resultMode"> & {
|
|
461
|
+
message?: string;
|
|
462
|
+
};
|
|
463
|
+
//#endregion
|
|
464
|
+
//#region src/middlewares.d.ts
|
|
465
|
+
type FetchImpl = UnmaskType<(input: string | Request | URL, init?: RequestInit) => Awaitable<Response>>;
|
|
466
|
+
type FetchMiddlewareContext<TCallApiContext extends CallApiContext> = RequestContext<TCallApiContext> & {
|
|
467
|
+
fetchImpl: FetchImpl;
|
|
468
|
+
};
|
|
469
|
+
interface Middlewares<TCallApiContext extends NoInfer<CallApiContext> = DefaultCallApiContext> {
|
|
470
|
+
/**
|
|
471
|
+
* Wraps the fetch implementation to intercept requests at the network layer.
|
|
472
|
+
*
|
|
473
|
+
* Takes a context object containing the current fetch function and returns a new fetch function.
|
|
474
|
+
* Use it to cache responses, add logging, handle offline mode, or short-circuit requests etc.
|
|
475
|
+
* Multiple middleware compose in order: plugins → base config → per-request.
|
|
476
|
+
*
|
|
477
|
+
* Unlike `customFetchImpl`, middleware can call through to the original fetch.
|
|
478
|
+
*
|
|
479
|
+
* @example
|
|
480
|
+
* ```ts
|
|
481
|
+
* // Cache responses
|
|
482
|
+
* const cache = new Map();
|
|
483
|
+
*
|
|
484
|
+
* fetchMiddleware: (ctx) => async (input, init) => {
|
|
485
|
+
* const key = input.toString();
|
|
486
|
+
*
|
|
487
|
+
* const cachedResponse = cache.get(key);
|
|
488
|
+
*
|
|
489
|
+
* if (cachedResponse) {
|
|
490
|
+
* return cachedResponse.clone();
|
|
491
|
+
* }
|
|
492
|
+
*
|
|
493
|
+
* const response = await ctx.fetchImpl(input, init);
|
|
494
|
+
* cache.set(key, response.clone());
|
|
495
|
+
*
|
|
496
|
+
* return response;
|
|
497
|
+
* }
|
|
498
|
+
*
|
|
499
|
+
* // Handle offline
|
|
500
|
+
* fetchMiddleware: (ctx) => async (...parameters) => {
|
|
501
|
+
* if (!navigator.onLine) {
|
|
502
|
+
* return new Response('{"error": "offline"}', { status: 503 });
|
|
503
|
+
* }
|
|
504
|
+
*
|
|
505
|
+
* return ctx.fetchImpl(...parameters);
|
|
506
|
+
* }
|
|
507
|
+
* ```
|
|
508
|
+
*/
|
|
509
|
+
fetchMiddleware?: (context: FetchMiddlewareContext<TCallApiContext>) => FetchImpl;
|
|
510
|
+
}
|
|
511
|
+
//#endregion
|
|
512
|
+
//#region src/plugins.d.ts
|
|
513
|
+
type PluginSetupContext<TCallApiContext extends CallApiContext = DefaultCallApiContext> = RequestContext<TCallApiContext> & ReturnType<typeof getCurrentRouteSchemaKeyAndMainInitURL>;
|
|
514
|
+
type PluginInitResult<TCallApiContext extends CallApiContext = DefaultCallApiContext> = Partial<Omit<PluginSetupContext<TCallApiContext>, "initURL" | "request"> & {
|
|
515
|
+
initURL: InitURLOrURLObject;
|
|
516
|
+
request: CallApiRequestOptions;
|
|
517
|
+
}>;
|
|
518
|
+
type GetDefaultDataTypeForPlugins<TData> = DefaultDataType extends TData ? never : TData;
|
|
519
|
+
type PluginHooks<TCallApiContext extends CallApiContext = DefaultCallApiContext> = HooksOrHooksArray<OverrideCallApiContext<TCallApiContext, {
|
|
520
|
+
Data: GetDefaultDataTypeForPlugins<TCallApiContext["Data"]>;
|
|
521
|
+
ErrorData: GetDefaultDataTypeForPlugins<TCallApiContext["ErrorData"]>;
|
|
522
|
+
}>>;
|
|
523
|
+
type PluginMiddlewares<TCallApiContext extends CallApiContext = DefaultCallApiContext> = Middlewares<OverrideCallApiContext<TCallApiContext, {
|
|
524
|
+
Data: GetDefaultDataTypeForPlugins<TCallApiContext["Data"]>;
|
|
525
|
+
ErrorData: GetDefaultDataTypeForPlugins<TCallApiContext["ErrorData"]>;
|
|
526
|
+
}>>;
|
|
527
|
+
interface CallApiPlugin<TCallApiContext extends CallApiContext = DefaultCallApiContext> {
|
|
528
|
+
/**
|
|
529
|
+
* Defines additional options that can be passed to callApi
|
|
530
|
+
*/
|
|
531
|
+
defineExtraOptions?: () => TCallApiContext["InferredExtraOptions"];
|
|
532
|
+
/**
|
|
533
|
+
* A description for the plugin
|
|
534
|
+
*/
|
|
535
|
+
description?: string;
|
|
536
|
+
/**
|
|
537
|
+
* Hooks for the plugin
|
|
538
|
+
*/
|
|
539
|
+
hooks?: PluginHooks<TCallApiContext> | ((context: PluginSetupContext<TCallApiContext>) => Awaitable<PluginHooks<TCallApiContext>> | Awaitable<void>);
|
|
540
|
+
/**
|
|
541
|
+
* A unique id for the plugin
|
|
542
|
+
*/
|
|
543
|
+
id: string;
|
|
544
|
+
/**
|
|
545
|
+
* Middlewares that for the plugin
|
|
546
|
+
*/
|
|
547
|
+
middlewares?: PluginMiddlewares<TCallApiContext> | ((context: PluginSetupContext<TCallApiContext>) => Awaitable<PluginMiddlewares<TCallApiContext>> | Awaitable<void>);
|
|
548
|
+
/**
|
|
549
|
+
* A name for the plugin
|
|
550
|
+
*/
|
|
551
|
+
name: string;
|
|
552
|
+
/**
|
|
553
|
+
* Base schema for the client.
|
|
554
|
+
*/
|
|
555
|
+
schema?: BaseCallApiSchemaAndConfig;
|
|
556
|
+
/**
|
|
557
|
+
* A function that will be called when the plugin is initialized. This will be called before the any of the other internal functions.
|
|
558
|
+
*/
|
|
559
|
+
setup?: (context: PluginSetupContext<TCallApiContext>) => Awaitable<PluginInitResult<TCallApiContext>> | Awaitable<void>;
|
|
560
|
+
/**
|
|
561
|
+
* A version for the plugin
|
|
562
|
+
*/
|
|
563
|
+
version?: string;
|
|
564
|
+
}
|
|
565
|
+
type InferPluginExtraOptions<TPluginArray extends CallApiPlugin[]> = UnionToIntersection<TPluginArray extends Array<infer TPlugin> ? TPlugin extends CallApiPlugin ? TPlugin["defineExtraOptions"] extends AnyFunction<infer TResult> ? InferSchemaOutput<TResult, TResult> : never : never : never>;
|
|
566
|
+
//#endregion
|
|
567
|
+
//#region src/types/default-types.d.ts
|
|
568
|
+
type DefaultDataType = unknown;
|
|
569
|
+
type DefaultPluginArray = CallApiPlugin[];
|
|
570
|
+
type DefaultThrowOnError = boolean;
|
|
571
|
+
type DefaultMetaObject = Record<string, unknown>;
|
|
572
|
+
type DefaultCallApiContext = Prettify<OverrideCallApiContext<Required<CallApiContext>, {
|
|
573
|
+
Meta: GlobalMeta;
|
|
574
|
+
}>>;
|
|
575
|
+
//#endregion
|
|
344
576
|
//#region src/utils/external/body.d.ts
|
|
345
577
|
type BodyType = NonNullable<CallApiRequestOptions["body"]>;
|
|
346
578
|
declare const toSearchParams: <TSchema extends CallApiSchemaType<BodyType>>(data: InferSchemaOutput<TSchema>, schema?: TSchema) => URLSearchParams;
|
|
@@ -401,56 +633,6 @@ type DefineBaseConfig = {
|
|
|
401
633
|
declare const defineBaseConfig: DefineBaseConfig;
|
|
402
634
|
declare const defineInstanceConfig: <const TInstanceConfig extends CallApiConfig>(config: TInstanceConfig) => Writeable<typeof config, "deep">;
|
|
403
635
|
//#endregion
|
|
404
|
-
//#region src/utils/external/error.d.ts
|
|
405
|
-
type HTTPErrorDetails<TErrorData> = Pick<CallApiExtraOptions, "defaultHTTPErrorMessage"> & {
|
|
406
|
-
errorData: TErrorData;
|
|
407
|
-
response: Response;
|
|
408
|
-
};
|
|
409
|
-
declare class HTTPError<TErrorData = Record<string, unknown>> extends Error {
|
|
410
|
-
errorData: HTTPErrorDetails<TErrorData>["errorData"];
|
|
411
|
-
readonly httpErrorSymbol: symbol;
|
|
412
|
-
name: "HTTPError";
|
|
413
|
-
response: HTTPErrorDetails<TErrorData>["response"];
|
|
414
|
-
constructor(errorDetails: HTTPErrorDetails<TErrorData>, errorOptions?: ErrorOptions);
|
|
415
|
-
/**
|
|
416
|
-
* @description Checks if the given error is an instance of HTTPError
|
|
417
|
-
* @param error - The error to check
|
|
418
|
-
* @returns true if the error is an instance of HTTPError, false otherwise
|
|
419
|
-
*/
|
|
420
|
-
static isError<TErrorData>(error: unknown): error is HTTPError<TErrorData>;
|
|
421
|
-
}
|
|
422
|
-
type SafeExtract<TUnion, TKey extends TUnion> = Extract<TUnion, TKey>;
|
|
423
|
-
type ValidationErrorDetails = {
|
|
424
|
-
/**
|
|
425
|
-
* The cause of the validation error.
|
|
426
|
-
*
|
|
427
|
-
* It's either the name the schema for which validation failed, or the name of the schema config option that led to the validation error.
|
|
428
|
-
*/
|
|
429
|
-
issueCause: "toFormData" | "toQueryString" | "unknown" | `schemaConfig-(${SafeExtract<keyof CallApiSchemaConfig, "strict">})` | keyof CallApiSchema;
|
|
430
|
-
/**
|
|
431
|
-
* The issues that caused the validation error.
|
|
432
|
-
*/
|
|
433
|
-
issues: readonly StandardSchemaV1.Issue[];
|
|
434
|
-
/**
|
|
435
|
-
* The response from server, if any.
|
|
436
|
-
*/
|
|
437
|
-
response: Response | null;
|
|
438
|
-
};
|
|
439
|
-
declare class ValidationError extends Error {
|
|
440
|
-
errorData: ValidationErrorDetails["issues"];
|
|
441
|
-
issueCause: ValidationErrorDetails["issueCause"];
|
|
442
|
-
name: "ValidationError";
|
|
443
|
-
response: ValidationErrorDetails["response"];
|
|
444
|
-
readonly validationErrorSymbol: symbol;
|
|
445
|
-
constructor(details: ValidationErrorDetails, errorOptions?: ErrorOptions);
|
|
446
|
-
/**
|
|
447
|
-
* @description Checks if the given error is an instance of ValidationError
|
|
448
|
-
* @param error - The error to check
|
|
449
|
-
* @returns true if the error is an instance of ValidationError, false otherwise
|
|
450
|
-
*/
|
|
451
|
-
static isError(error: unknown): error is ValidationError;
|
|
452
|
-
}
|
|
453
|
-
//#endregion
|
|
454
636
|
//#region src/utils/external/guards.d.ts
|
|
455
637
|
declare const isHTTPError: <TErrorData>(error: CallApiResultErrorVariant<TErrorData>["error"] | null) => error is PossibleHTTPError<TErrorData>;
|
|
456
638
|
declare const isHTTPErrorInstance: <TErrorData>(error: unknown) => error is HTTPError<TErrorData>;
|
|
@@ -987,54 +1169,6 @@ type DedupeOptions = {
|
|
|
987
1169
|
dedupeStrategy?: DedupeStrategyUnion | ((context: RequestContext) => DedupeStrategyUnion);
|
|
988
1170
|
};
|
|
989
1171
|
//#endregion
|
|
990
|
-
//#region src/middlewares.d.ts
|
|
991
|
-
type FetchImpl = UnmaskType<(input: string | Request | URL, init?: RequestInit) => Awaitable<Response>>;
|
|
992
|
-
type FetchMiddlewareContext<TCallApiContext extends CallApiContext> = RequestContext<TCallApiContext> & {
|
|
993
|
-
fetchImpl: FetchImpl;
|
|
994
|
-
};
|
|
995
|
-
interface Middlewares<TCallApiContext extends NoInfer<CallApiContext> = DefaultCallApiContext> {
|
|
996
|
-
/**
|
|
997
|
-
* Wraps the fetch implementation to intercept requests at the network layer.
|
|
998
|
-
*
|
|
999
|
-
* Takes a context object containing the current fetch function and returns a new fetch function.
|
|
1000
|
-
* Use it to cache responses, add logging, handle offline mode, or short-circuit requests etc.
|
|
1001
|
-
* Multiple middleware compose in order: plugins → base config → per-request.
|
|
1002
|
-
*
|
|
1003
|
-
* Unlike `customFetchImpl`, middleware can call through to the original fetch.
|
|
1004
|
-
*
|
|
1005
|
-
* @example
|
|
1006
|
-
* ```ts
|
|
1007
|
-
* // Cache responses
|
|
1008
|
-
* const cache = new Map();
|
|
1009
|
-
*
|
|
1010
|
-
* fetchMiddleware: (ctx) => async (input, init) => {
|
|
1011
|
-
* const key = input.toString();
|
|
1012
|
-
*
|
|
1013
|
-
* const cachedResponse = cache.get(key);
|
|
1014
|
-
*
|
|
1015
|
-
* if (cachedResponse) {
|
|
1016
|
-
* return cachedResponse.clone();
|
|
1017
|
-
* }
|
|
1018
|
-
*
|
|
1019
|
-
* const response = await ctx.fetchImpl(input, init);
|
|
1020
|
-
* cache.set(key, response.clone());
|
|
1021
|
-
*
|
|
1022
|
-
* return response;
|
|
1023
|
-
* }
|
|
1024
|
-
*
|
|
1025
|
-
* // Handle offline
|
|
1026
|
-
* fetchMiddleware: (ctx) => async (...parameters) => {
|
|
1027
|
-
* if (!navigator.onLine) {
|
|
1028
|
-
* return new Response('{"error": "offline"}', { status: 503 });
|
|
1029
|
-
* }
|
|
1030
|
-
*
|
|
1031
|
-
* return ctx.fetchImpl(...parameters);
|
|
1032
|
-
* }
|
|
1033
|
-
* ```
|
|
1034
|
-
*/
|
|
1035
|
-
fetchMiddleware?: (context: FetchMiddlewareContext<TCallApiContext>) => FetchImpl;
|
|
1036
|
-
}
|
|
1037
|
-
//#endregion
|
|
1038
1172
|
//#region src/types/options-types.d.ts
|
|
1039
1173
|
interface Register {}
|
|
1040
1174
|
type GlobalMeta = Register extends {
|
|
@@ -1060,11 +1194,11 @@ type ModifiedRequestInit = RequestInit & {
|
|
|
1060
1194
|
*/
|
|
1061
1195
|
extraFetchOptions?: RequestInit;
|
|
1062
1196
|
};
|
|
1063
|
-
type CallApiRequestOptions = {
|
|
1197
|
+
type CallApiRequestOptions<TBody = Body> = {
|
|
1064
1198
|
/**
|
|
1065
1199
|
* Body of the request, can be a object or any other supported body type.
|
|
1066
1200
|
*/
|
|
1067
|
-
body?:
|
|
1201
|
+
body?: TBody;
|
|
1068
1202
|
/**
|
|
1069
1203
|
* Headers to be used in the request.
|
|
1070
1204
|
*/
|
|
@@ -1075,7 +1209,7 @@ type CallApiRequestOptions = {
|
|
|
1075
1209
|
*/
|
|
1076
1210
|
method?: MethodUnion;
|
|
1077
1211
|
} & Pick<ModifiedRequestInit, FetchSpecificKeysUnion>;
|
|
1078
|
-
type SharedExtraOptions<TCallApiContext extends CallApiContext = DefaultCallApiContext, TData = DefaultDataType, TErrorData = DefaultDataType, TResultMode extends ResultModeType = ResultModeType, TThrowOnError extends ThrowOnErrorBoolean = DefaultThrowOnError, TResponseType extends ResponseTypeType = ResponseTypeType, TPluginArray extends CallApiPlugin[] = DefaultPluginArray, TComputedMergedPluginExtraOptions = Partial<InferPluginExtraOptions<TPluginArray> & InferSchemaOutput<TCallApiContext["InferredExtraOptions"], TCallApiContext["InferredExtraOptions"]>>, TComputedCallApiContext extends CallApiContext = OverrideCallApiContext<TCallApiContext, {
|
|
1212
|
+
type SharedExtraOptions<TCallApiContext extends CallApiContext = DefaultCallApiContext, TData = DefaultDataType, TErrorData = DefaultDataType, TResultMode extends ResultModeType = ResultModeType, TThrowOnError extends ThrowOnErrorBoolean = DefaultThrowOnError, TResponseType extends ResponseTypeType = ResponseTypeType, TPluginArray extends CallApiPlugin[] = DefaultPluginArray, TBody = Body, TComputedMergedPluginExtraOptions = Partial<InferPluginExtraOptions<TPluginArray> & InferSchemaOutput<TCallApiContext["InferredExtraOptions"], TCallApiContext["InferredExtraOptions"]>>, TComputedCallApiContext extends CallApiContext = OverrideCallApiContext<TCallApiContext, {
|
|
1079
1213
|
Data: TData;
|
|
1080
1214
|
ErrorData: TErrorData;
|
|
1081
1215
|
InferredExtraOptions: TComputedMergedPluginExtraOptions;
|
|
@@ -1094,32 +1228,48 @@ type SharedExtraOptions<TCallApiContext extends CallApiContext = DefaultCallApiC
|
|
|
1094
1228
|
/**
|
|
1095
1229
|
* Custom function to serialize request body objects into strings.
|
|
1096
1230
|
*
|
|
1097
|
-
* Useful for custom serialization formats or when the default JSON
|
|
1231
|
+
* Useful for custom string serialization formats or when the default JSON
|
|
1098
1232
|
* serialization doesn't meet your needs.
|
|
1099
1233
|
*
|
|
1100
1234
|
* @example
|
|
1101
1235
|
* ```ts
|
|
1102
|
-
* // Custom form data serialization
|
|
1103
|
-
* bodySerializer: (data) => {
|
|
1104
|
-
* const formData = new FormData();
|
|
1105
|
-
* Object.entries(data).forEach(([key, value]) => {
|
|
1106
|
-
* formData.append(key, String(value));
|
|
1107
|
-
* });
|
|
1108
|
-
* return formData.toString();
|
|
1109
|
-
* }
|
|
1110
|
-
*
|
|
1111
1236
|
* // XML serialization
|
|
1112
|
-
* bodySerializer: (
|
|
1113
|
-
* return `<request>${Object.entries(
|
|
1237
|
+
* bodySerializer: (body) => {
|
|
1238
|
+
* return `<request>${Object.entries(body)
|
|
1114
1239
|
* .map(([key, value]) => `<${key}>${value}</${key}>`)
|
|
1115
1240
|
* .join('')}</request>`;
|
|
1116
1241
|
* }
|
|
1117
1242
|
*
|
|
1118
1243
|
* // Custom JSON with specific formatting
|
|
1119
|
-
* bodySerializer: (
|
|
1244
|
+
* bodySerializer: (body) => JSON.stringify(body, null, 2)
|
|
1245
|
+
* ```
|
|
1246
|
+
*/
|
|
1247
|
+
bodySerializer?: (body: TBody extends SerializableObject ? TBody : SerializableObject) => string;
|
|
1248
|
+
/**
|
|
1249
|
+
* Custom function to transform the request body before it is passed to fetch.
|
|
1250
|
+
*
|
|
1251
|
+
* Useful for converting plain objects into formats like `FormData`,
|
|
1252
|
+
* `URLSearchParams`, `Blob`, or other Fetch-compatible body values.
|
|
1253
|
+
*
|
|
1254
|
+
* Takes precedence over `bodySerializer`.
|
|
1255
|
+
*
|
|
1256
|
+
* @example
|
|
1257
|
+
* ```ts
|
|
1258
|
+
* bodyTransformer: ({ body }) => {
|
|
1259
|
+
* const formData = new FormData();
|
|
1260
|
+
*
|
|
1261
|
+
* Object.entries(body).forEach(([key, value]) => {
|
|
1262
|
+
* formData.append(key, String(value));
|
|
1263
|
+
* });
|
|
1264
|
+
*
|
|
1265
|
+
* return formData;
|
|
1266
|
+
* }
|
|
1120
1267
|
* ```
|
|
1121
1268
|
*/
|
|
1122
|
-
|
|
1269
|
+
bodyTransformer?: (context: {
|
|
1270
|
+
body: TBody;
|
|
1271
|
+
headers: Headers;
|
|
1272
|
+
}) => Body;
|
|
1123
1273
|
/**
|
|
1124
1274
|
* Whether to clone the response so it can be read multiple times.
|
|
1125
1275
|
*
|
|
@@ -1525,7 +1675,7 @@ type GetExtendSchemaConfigContext<TBaseSchemaConfig extends CallApiSchemaConfig>
|
|
|
1525
1675
|
type InferExtendPluginContext<TBasePluginArray extends CallApiPlugin[]> = {
|
|
1526
1676
|
basePlugins: TBasePluginArray;
|
|
1527
1677
|
};
|
|
1528
|
-
type CallApiExtraOptions<TCallApiContext extends CallApiContext = DefaultCallApiContext, TData = DefaultDataType, TErrorData = DefaultDataType, TResultMode extends ResultModeType = ResultModeType, TThrowOnError extends ThrowOnErrorBoolean = DefaultThrowOnError, TResponseType extends ResponseTypeType = ResponseTypeType, TBasePluginArray extends CallApiPlugin[] = DefaultPluginArray, TPluginArray extends CallApiPlugin[] = DefaultPluginArray, TBaseSchemaRoutes extends BaseCallApiSchemaRoutes = BaseCallApiSchemaRoutes, TSchema extends CallApiSchema = CallApiSchema, TBaseSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TCurrentRouteSchemaKey extends string = string> = SharedExtraOptions<TCallApiContext, TData, TErrorData, TResultMode, TThrowOnError, TResponseType, TPluginArray> & {
|
|
1678
|
+
type CallApiExtraOptions<TCallApiContext extends CallApiContext = DefaultCallApiContext, TData = DefaultDataType, TErrorData = DefaultDataType, TResultMode extends ResultModeType = ResultModeType, TThrowOnError extends ThrowOnErrorBoolean = DefaultThrowOnError, TResponseType extends ResponseTypeType = ResponseTypeType, TBasePluginArray extends CallApiPlugin[] = DefaultPluginArray, TPluginArray extends CallApiPlugin[] = DefaultPluginArray, TBaseSchemaRoutes extends BaseCallApiSchemaRoutes = BaseCallApiSchemaRoutes, TSchema extends CallApiSchema = CallApiSchema, TBaseSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TCurrentRouteSchemaKey extends string = string, TBody extends InferSchemaOutput<TSchema["body"], Body> = InferSchemaOutput<TSchema["body"], Body>> = SharedExtraOptions<TCallApiContext, TData, TErrorData, TResultMode, TThrowOnError, TResponseType, TPluginArray, TBody> & {
|
|
1529
1679
|
/**
|
|
1530
1680
|
* Array of instance-specific CallApi plugins or a function to configure plugins.
|
|
1531
1681
|
*
|
|
@@ -1559,8 +1709,8 @@ type InstanceContext = {
|
|
|
1559
1709
|
request: CallApiRequestOptions;
|
|
1560
1710
|
};
|
|
1561
1711
|
type BaseCallApiConfig<TBaseCallApiContext extends CallApiContext = DefaultCallApiContext, TBaseData = DefaultDataType, TBaseErrorData = DefaultDataType, TBaseResultMode extends ResultModeType = ResultModeType, TBaseThrowOnError extends ThrowOnErrorBoolean = DefaultThrowOnError, TBaseResponseType extends ResponseTypeType = ResponseTypeType, TBaseSchemaAndConfig extends BaseCallApiSchemaAndConfig = BaseCallApiSchemaAndConfig, TBasePluginArray extends CallApiPlugin[] = DefaultPluginArray, TComputedBaseConfig = BaseCallApiExtraOptions<TBaseCallApiContext, TBaseData, TBaseErrorData, TBaseResultMode, TBaseThrowOnError, TBaseResponseType, TBasePluginArray, TBaseSchemaAndConfig>> = (CallApiRequestOptions & TComputedBaseConfig) | ((context: InstanceContext) => CallApiRequestOptions & TComputedBaseConfig);
|
|
1562
|
-
type CallApiConfig<TCallApiContext extends CallApiContext = DefaultCallApiContext, TData = DefaultDataType, TErrorData = DefaultDataType, TResultMode extends ResultModeType = ResultModeType, TThrowOnError extends ThrowOnErrorBoolean = DefaultThrowOnError, TResponseType extends ResponseTypeType = ResponseTypeType, TBaseSchemaRoutes extends BaseCallApiSchemaRoutes = BaseCallApiSchemaRoutes, TSchema extends CallApiSchema = CallApiSchema, TBaseSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TInitURL extends InitURLOrURLObject = InitURLOrURLObject, TCurrentRouteSchemaKey extends string = string, TBasePluginArray extends CallApiPlugin[] = DefaultPluginArray, TPluginArray extends CallApiPlugin[] = DefaultPluginArray> = InferExtraOptions<TSchema, TBaseSchemaRoutes, TCurrentRouteSchemaKey, TCallApiContext> & InferRequestOptions<TSchema, TInitURL> & Omit<CallApiExtraOptions<TCallApiContext, TData, TErrorData, TResultMode, TThrowOnError, TResponseType, TBasePluginArray, TPluginArray, TBaseSchemaRoutes, TSchema, TBaseSchemaConfig, TSchemaConfig, TCurrentRouteSchemaKey>, keyof InferExtraOptions<CallApiSchema, BaseCallApiSchemaRoutes, string, CallApiContext>> & Omit<CallApiRequestOptions
|
|
1563
|
-
type CallApiParameters<TData = DefaultDataType, TErrorData = DefaultDataType, TResultMode extends ResultModeType = ResultModeType, TCallApiContext extends CallApiContext = DefaultCallApiContext, TThrowOnError extends ThrowOnErrorBoolean = DefaultThrowOnError, TResponseType extends ResponseTypeType = ResponseTypeType, TBaseSchemaRoutes extends BaseCallApiSchemaRoutes = BaseCallApiSchemaRoutes, TSchema extends CallApiSchema = CallApiSchema, TBaseSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TInitURL extends InitURLOrURLObject = InitURLOrURLObject, TCurrentRouteSchemaKey extends string = string, TBasePluginArray extends CallApiPlugin[] = DefaultPluginArray, TPluginArray extends CallApiPlugin[] = DefaultPluginArray> = [initURL: TInitURL, config?: CallApiConfig<TCallApiContext, TData, TErrorData, TResultMode, TThrowOnError, TResponseType, TBaseSchemaRoutes, TSchema, TBaseSchemaConfig, TSchemaConfig, TInitURL, TCurrentRouteSchemaKey, TBasePluginArray, TPluginArray>];
|
|
1712
|
+
type CallApiConfig<TCallApiContext extends CallApiContext = DefaultCallApiContext, TData = DefaultDataType, TErrorData = DefaultDataType, TResultMode extends ResultModeType = ResultModeType, TThrowOnError extends ThrowOnErrorBoolean = DefaultThrowOnError, TResponseType extends ResponseTypeType = ResponseTypeType, TBaseSchemaRoutes extends BaseCallApiSchemaRoutes = BaseCallApiSchemaRoutes, TSchema extends CallApiSchema = CallApiSchema, TBaseSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TInitURL extends InitURLOrURLObject = InitURLOrURLObject, TCurrentRouteSchemaKey extends string = string, TBody extends InferSchemaOutput<TSchema["body"], Body> = InferSchemaOutput<TSchema["body"], Body>, TBasePluginArray extends CallApiPlugin[] = DefaultPluginArray, TPluginArray extends CallApiPlugin[] = DefaultPluginArray> = InferExtraOptions<TSchema, TBaseSchemaRoutes, TCurrentRouteSchemaKey, TCallApiContext> & InferRequestOptions<TSchema, TInitURL, TBody> & Omit<CallApiExtraOptions<TCallApiContext, TData, TErrorData, TResultMode, TThrowOnError, TResponseType, TBasePluginArray, TPluginArray, TBaseSchemaRoutes, TSchema, TBaseSchemaConfig, TSchemaConfig, TCurrentRouteSchemaKey, TBody>, keyof InferExtraOptions<CallApiSchema, BaseCallApiSchemaRoutes, string, CallApiContext>> & Omit<CallApiRequestOptions<TBody>, keyof InferRequestOptions<CallApiSchema, string, TBody>>;
|
|
1713
|
+
type CallApiParameters<TData = DefaultDataType, TErrorData = DefaultDataType, TResultMode extends ResultModeType = ResultModeType, TCallApiContext extends CallApiContext = DefaultCallApiContext, TThrowOnError extends ThrowOnErrorBoolean = DefaultThrowOnError, TResponseType extends ResponseTypeType = ResponseTypeType, TBaseSchemaRoutes extends BaseCallApiSchemaRoutes = BaseCallApiSchemaRoutes, TSchema extends CallApiSchema = CallApiSchema, TBaseSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TInitURL extends InitURLOrURLObject = InitURLOrURLObject, TCurrentRouteSchemaKey extends string = string, TBasePluginArray extends CallApiPlugin[] = DefaultPluginArray, TPluginArray extends CallApiPlugin[] = DefaultPluginArray, TBody extends InferSchemaOutput<TSchema["body"], Body> = InferSchemaOutput<TSchema["body"], Body>> = [initURL: TInitURL, config?: CallApiConfig<TCallApiContext, TData, TErrorData, TResultMode, TThrowOnError, TResponseType, TBaseSchemaRoutes, TSchema, TBaseSchemaConfig, TSchemaConfig, TInitURL, TCurrentRouteSchemaKey, TBody, TBasePluginArray, TPluginArray>];
|
|
1564
1714
|
type CallApiResult<TData, TErrorData, TResultMode extends ResultModeType, TThrowOnError extends ThrowOnErrorBoolean> = InferCallApiResult<TData, TErrorData, TResultMode, TThrowOnError>;
|
|
1565
1715
|
type CallApiResultLoose<TData, TErrorData, TResultMode extends ResultModeType = ResultModeType, TThrowOnError extends ThrowOnErrorBoolean = ThrowOnErrorBoolean> = InferCallApiResult<TData, TErrorData, TResultMode, TThrowOnError>;
|
|
1566
1716
|
//#endregion
|
|
@@ -1621,11 +1771,11 @@ type JsonPrimitive = boolean | number | string | null | undefined;
|
|
|
1621
1771
|
type SerializableObject = Record<PropertyKey, unknown>;
|
|
1622
1772
|
type SerializableArray = Array<JsonPrimitive | SerializableObject> | ReadonlyArray<JsonPrimitive | SerializableObject>;
|
|
1623
1773
|
type Body = UnmaskType<Exclude<RequestInit["body"], undefined> | SerializableArray | SerializableObject>;
|
|
1624
|
-
type InferBodyOption<TSchema extends CallApiSchema
|
|
1774
|
+
type InferBodyOption<TSchema extends CallApiSchema, TBody = InferSchemaOutput<TSchema["body"], Body>> = MakeSchemaOptionRequiredIfDefined<TSchema["body"], {
|
|
1625
1775
|
/**
|
|
1626
1776
|
* Body of the request, can be a object or any other supported body type.
|
|
1627
1777
|
*/
|
|
1628
|
-
body?:
|
|
1778
|
+
body?: TBody;
|
|
1629
1779
|
}>;
|
|
1630
1780
|
type MethodUnion = UnmaskType<"CONNECT" | "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT" | "TRACE" | AnyString>;
|
|
1631
1781
|
type ExtractMethodFromURL<TInitURL> = string extends TInitURL ? MethodUnion : TInitURL extends `${AtSymbol}${infer TMethod extends RouteKeyMethods}/${string}` ? Uppercase<TMethod> : MethodUnion;
|
|
@@ -1645,7 +1795,7 @@ type InferHeadersOption<TSchema extends CallApiSchema> = MakeSchemaOptionRequire
|
|
|
1645
1795
|
baseHeaders: Extract<HeadersOption, Record<string, unknown>>;
|
|
1646
1796
|
}) => InferSchemaOutput<TSchema["headers"], HeadersOption>);
|
|
1647
1797
|
}>;
|
|
1648
|
-
type InferRequestOptions<TSchema extends CallApiSchema, TInitURL extends InferInitURL<BaseCallApiSchemaRoutes, CallApiSchemaConfig>> = InferBodyOption<TSchema> & InferHeadersOption<TSchema> & InferMethodOption<TSchema, TInitURL>;
|
|
1798
|
+
type InferRequestOptions<TSchema extends CallApiSchema, TInitURL extends InferInitURL<BaseCallApiSchemaRoutes, CallApiSchemaConfig>, TBody = InferSchemaOutput<TSchema["body"], Body>> = InferBodyOption<TSchema, TBody> & InferHeadersOption<TSchema> & InferMethodOption<TSchema, TInitURL>;
|
|
1649
1799
|
type InferMetaOption<TSchema extends CallApiSchema, TCallApiContext extends CallApiContext> = MakeSchemaOptionRequiredIfDefined<TSchema["meta"], {
|
|
1650
1800
|
/**
|
|
1651
1801
|
* - An optional field you can fill with additional information,
|
|
@@ -1761,139 +1911,5 @@ type ThrowOnErrorOption<TErrorData, TThrowOnError extends ThrowOnErrorBoolean> =
|
|
|
1761
1911
|
throwOnError?: ThrowOnErrorType<TErrorData, TThrowOnError>;
|
|
1762
1912
|
};
|
|
1763
1913
|
//#endregion
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
declare const getResponseType: <TData>(response: Response, responseParser: ResponseParser<TData>) => {
|
|
1767
|
-
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
1768
|
-
blob: () => Promise<Blob>;
|
|
1769
|
-
formData: () => Promise<FormData>;
|
|
1770
|
-
json: () => Promise<TData>;
|
|
1771
|
-
stream: () => ReadableStream<Uint8Array<ArrayBuffer>> | null;
|
|
1772
|
-
text: () => Promise<string>;
|
|
1773
|
-
};
|
|
1774
|
-
type InitResponseTypeMap<TData = unknown> = ReturnType<typeof getResponseType<TData>>;
|
|
1775
|
-
type ResponseTypeUnion = keyof InitResponseTypeMap;
|
|
1776
|
-
type ResponseTypePlaceholder = null;
|
|
1777
|
-
type ResponseTypeType = ResponseTypePlaceholder | ResponseTypeUnion;
|
|
1778
|
-
type ResponseTypeMap<TData> = { [Key in keyof InitResponseTypeMap<TData>]: Awaited<ReturnType<InitResponseTypeMap<TData>[Key]>> };
|
|
1779
|
-
type GetResponseType<TData, TResponseType extends ResponseTypeType, TComputedResponseTypeMap extends ResponseTypeMap<TData> = ResponseTypeMap<TData>> = null extends TResponseType ? TComputedResponseTypeMap["json"] : TResponseType extends NonNullable<ResponseTypeType> ? TComputedResponseTypeMap[TResponseType] : never;
|
|
1780
|
-
type CallApiResultSuccessVariant<TData> = {
|
|
1781
|
-
data: NoInferUnMasked<TData>;
|
|
1782
|
-
error: null;
|
|
1783
|
-
response: Response;
|
|
1784
|
-
};
|
|
1785
|
-
type PossibleJavaScriptError = UnmaskType<{
|
|
1786
|
-
errorData: false;
|
|
1787
|
-
message: string;
|
|
1788
|
-
name: "AbortError" | "Error" | "SyntaxError" | "TimeoutError" | "TypeError" | AnyString;
|
|
1789
|
-
originalError: DOMException | Error | SyntaxError | TypeError;
|
|
1790
|
-
}>;
|
|
1791
|
-
type PossibleHTTPError<TErrorData> = UnmaskType<{
|
|
1792
|
-
errorData: NoInferUnMasked<TErrorData>;
|
|
1793
|
-
message: string;
|
|
1794
|
-
name: "HTTPError";
|
|
1795
|
-
originalError: HTTPError;
|
|
1796
|
-
}>;
|
|
1797
|
-
type PossibleValidationError = UnmaskType<{
|
|
1798
|
-
errorData: ValidationError["errorData"];
|
|
1799
|
-
issueCause: ValidationError["issueCause"];
|
|
1800
|
-
message: string;
|
|
1801
|
-
name: "ValidationError";
|
|
1802
|
-
originalError: ValidationError;
|
|
1803
|
-
}>;
|
|
1804
|
-
type CallApiResultErrorVariant<TErrorData> = {
|
|
1805
|
-
data: null;
|
|
1806
|
-
error: PossibleHTTPError<TErrorData>;
|
|
1807
|
-
response: Response;
|
|
1808
|
-
} | {
|
|
1809
|
-
data: null;
|
|
1810
|
-
error: PossibleJavaScriptError;
|
|
1811
|
-
response: Response | null;
|
|
1812
|
-
} | {
|
|
1813
|
-
data: null;
|
|
1814
|
-
error: PossibleValidationError;
|
|
1815
|
-
response: Response | null;
|
|
1816
|
-
};
|
|
1817
|
-
type CallApiResultSuccessOrErrorVariant<TData, TError> = CallApiResultErrorVariant<TError> | CallApiResultSuccessVariant<TData>;
|
|
1818
|
-
type GetCallApiResult<TThrowOnError extends ThrowOnErrorBoolean, TResultWithException extends CallApiResultSuccessVariant<unknown>, TResultWithoutException extends CallApiResultSuccessOrErrorVariant<unknown, unknown>> = TThrowOnError extends true ? TResultWithException : TResultWithoutException;
|
|
1819
|
-
type ResultModeMap<TData = DefaultDataType, TErrorData = DefaultDataType, TThrowOnError extends ThrowOnErrorBoolean = DefaultThrowOnError, TComputedResult extends GetCallApiResult<TThrowOnError, CallApiResultSuccessVariant<TData>, CallApiResultSuccessOrErrorVariant<TData, TErrorData>> = GetCallApiResult<TThrowOnError, CallApiResultSuccessVariant<TData>, CallApiResultSuccessOrErrorVariant<TData, TErrorData>>> = UnmaskType<{
|
|
1820
|
-
all: TComputedResult;
|
|
1821
|
-
fetchApi: TComputedResult["response"];
|
|
1822
|
-
onlyData: TComputedResult["data"];
|
|
1823
|
-
onlyResponse: TComputedResult["response"];
|
|
1824
|
-
withoutResponse: Prettify<DistributiveOmit<TComputedResult, "response">>;
|
|
1825
|
-
}>;
|
|
1826
|
-
type ResultModePlaceholder = null;
|
|
1827
|
-
type ResultModeUnion = keyof ResultModeMap;
|
|
1828
|
-
type ResultModeType = ResultModePlaceholder | ResultModeUnion;
|
|
1829
|
-
type InferCallApiResult<TData, TErrorData, TResultMode extends ResultModeType, TThrowOnError extends ThrowOnErrorBoolean, TComputedResultModeMapWithException extends ResultModeMap<TData, TErrorData, true> = ResultModeMap<TData, TErrorData, true>, TComputedResultModeMapWithoutException extends ResultModeMap<TData, TErrorData, TThrowOnError> = ResultModeMap<TData, TErrorData, TThrowOnError>> = TErrorData extends false ? TComputedResultModeMapWithException["onlyData"] : TErrorData extends false | undefined ? TComputedResultModeMapWithException["onlyData"] : ResultModePlaceholder extends TResultMode ? TComputedResultModeMapWithoutException["all"] : TResultMode extends ResultModeUnion ? TComputedResultModeMapWithoutException[TResultMode] : never;
|
|
1830
|
-
type ErrorInfoOptions = Pick<CallApiExtraOptions, "cloneResponse" | "resultMode"> & {
|
|
1831
|
-
message?: string;
|
|
1832
|
-
};
|
|
1833
|
-
//#endregion
|
|
1834
|
-
//#region src/plugins.d.ts
|
|
1835
|
-
type PluginSetupContext<TCallApiContext extends CallApiContext = DefaultCallApiContext> = RequestContext<TCallApiContext> & ReturnType<typeof getCurrentRouteSchemaKeyAndMainInitURL>;
|
|
1836
|
-
type PluginInitResult<TCallApiContext extends CallApiContext = DefaultCallApiContext> = Partial<Omit<PluginSetupContext<TCallApiContext>, "initURL" | "request"> & {
|
|
1837
|
-
initURL: InitURLOrURLObject;
|
|
1838
|
-
request: CallApiRequestOptions;
|
|
1839
|
-
}>;
|
|
1840
|
-
type GetDefaultDataTypeForPlugins<TData> = DefaultDataType extends TData ? never : TData;
|
|
1841
|
-
type PluginHooks<TCallApiContext extends CallApiContext = DefaultCallApiContext> = HooksOrHooksArray<OverrideCallApiContext<TCallApiContext, {
|
|
1842
|
-
Data: GetDefaultDataTypeForPlugins<TCallApiContext["Data"]>;
|
|
1843
|
-
ErrorData: GetDefaultDataTypeForPlugins<TCallApiContext["ErrorData"]>;
|
|
1844
|
-
}>>;
|
|
1845
|
-
type PluginMiddlewares<TCallApiContext extends CallApiContext = DefaultCallApiContext> = Middlewares<OverrideCallApiContext<TCallApiContext, {
|
|
1846
|
-
Data: GetDefaultDataTypeForPlugins<TCallApiContext["Data"]>;
|
|
1847
|
-
ErrorData: GetDefaultDataTypeForPlugins<TCallApiContext["ErrorData"]>;
|
|
1848
|
-
}>>;
|
|
1849
|
-
interface CallApiPlugin<TCallApiContext extends CallApiContext = DefaultCallApiContext> {
|
|
1850
|
-
/**
|
|
1851
|
-
* Defines additional options that can be passed to callApi
|
|
1852
|
-
*/
|
|
1853
|
-
defineExtraOptions?: () => TCallApiContext["InferredExtraOptions"];
|
|
1854
|
-
/**
|
|
1855
|
-
* A description for the plugin
|
|
1856
|
-
*/
|
|
1857
|
-
description?: string;
|
|
1858
|
-
/**
|
|
1859
|
-
* Hooks for the plugin
|
|
1860
|
-
*/
|
|
1861
|
-
hooks?: PluginHooks<TCallApiContext> | ((context: PluginSetupContext<TCallApiContext>) => Awaitable<PluginHooks<TCallApiContext>> | Awaitable<void>);
|
|
1862
|
-
/**
|
|
1863
|
-
* A unique id for the plugin
|
|
1864
|
-
*/
|
|
1865
|
-
id: string;
|
|
1866
|
-
/**
|
|
1867
|
-
* Middlewares that for the plugin
|
|
1868
|
-
*/
|
|
1869
|
-
middlewares?: PluginMiddlewares<TCallApiContext> | ((context: PluginSetupContext<TCallApiContext>) => Awaitable<PluginMiddlewares<TCallApiContext>> | Awaitable<void>);
|
|
1870
|
-
/**
|
|
1871
|
-
* A name for the plugin
|
|
1872
|
-
*/
|
|
1873
|
-
name: string;
|
|
1874
|
-
/**
|
|
1875
|
-
* Base schema for the client.
|
|
1876
|
-
*/
|
|
1877
|
-
schema?: BaseCallApiSchemaAndConfig;
|
|
1878
|
-
/**
|
|
1879
|
-
* A function that will be called when the plugin is initialized. This will be called before the any of the other internal functions.
|
|
1880
|
-
*/
|
|
1881
|
-
setup?: (context: PluginSetupContext<TCallApiContext>) => Awaitable<PluginInitResult<TCallApiContext>> | Awaitable<void>;
|
|
1882
|
-
/**
|
|
1883
|
-
* A version for the plugin
|
|
1884
|
-
*/
|
|
1885
|
-
version?: string;
|
|
1886
|
-
}
|
|
1887
|
-
type InferPluginExtraOptions<TPluginArray extends CallApiPlugin[]> = UnionToIntersection<TPluginArray extends Array<infer TPlugin> ? TPlugin extends CallApiPlugin ? TPlugin["defineExtraOptions"] extends AnyFunction<infer TResult> ? InferSchemaOutput<TResult, TResult> : never : never : never>;
|
|
1888
|
-
//#endregion
|
|
1889
|
-
//#region src/types/default-types.d.ts
|
|
1890
|
-
type DefaultDataType = unknown;
|
|
1891
|
-
type DefaultPluginArray = CallApiPlugin[];
|
|
1892
|
-
type DefaultThrowOnError = boolean;
|
|
1893
|
-
type DefaultMetaObject = Record<string, unknown>;
|
|
1894
|
-
type DefaultCallApiContext = Prettify<OverrideCallApiContext<Required<CallApiContext>, {
|
|
1895
|
-
Meta: GlobalMeta;
|
|
1896
|
-
}>>;
|
|
1897
|
-
//#endregion
|
|
1898
|
-
export { RequestContext as $, CallApiConfig as A, InferSchemaInput as At, GetCallApiContextRequired as B, fetchSpecificKeys as Bt, InferAllMainRouteKeys as C, toQueryString as Ct, ThrowOnErrorBoolean as D, BaseSchemaRouteKeyPrefixes as Dt, InferParamsFromRoute as E, BaseCallApiSchemaRoutes as Et, CallApiResult as F, DistributiveOmit as Ft, FetchMiddlewareContext as G, InstanceContext as H, CallApiResultLoose as I, NoInferUnMasked as It, CallApiExtraOptionsForHooks as J, Middlewares as K, GetBaseSchemaConfig as L, Writeable as Lt, CallApiExtraOptions as M, InferSchemaResult as Mt, CallApiParameters as N, URLOptions as Nt, BaseCallApiConfig as O, CallApiSchema as Ot, CallApiRequestOptions as P, AnyString as Pt, HooksOrHooksArray as Q, GetBaseSchemaRoutes as R, FallBackRouteSchemaKey as Rt, GetCurrentRouteSchemaKey as S, toFormData as St, InferInitURL as T, BaseCallApiSchemaAndConfig as Tt, Register as U, GlobalMeta as V, FetchImpl as W, ErrorContext as X, CallApiRequestOptionsForHooks as Y, Hooks as Z, ResponseTypeType as _, defineMainSchema as _t, PluginHooks as a, RefetchOptions as at, ApplyURLBasedConfig as b, defineSchemaConfig as bt, CallApiResultErrorVariant as c, isHTTPError as ct, GetResponseType as d, isValidationError as dt, RequestStreamContext as et, InferCallApiResult as f, isValidationErrorInstance as ft, ResponseTypeMap as g, defineInstanceConfig as gt, PossibleValidationError as h, defineBaseConfig as ht, CallApiPlugin as i, SuccessContext as it, CallApiContext as j, InferSchemaOutput as jt, BaseCallApiExtraOptions as k, CallApiSchemaConfig as kt, CallApiResultSuccessOrErrorVariant as l, isHTTPErrorInstance as lt, PossibleJavaScriptError as m, ValidationError as mt, DefaultDataType as n, ResponseErrorContext as nt, PluginMiddlewares as o, RetryOptions as ot, PossibleHTTPError as p, HTTPError as pt, DedupeOptions as q, DefaultPluginArray as r, ResponseStreamContext as rt, PluginSetupContext as s, objectifyHeaders as st, DefaultCallApiContext as t, ResponseContext as tt, CallApiResultSuccessVariant as u, isJavascriptError as ut, ResultModeType as v, definePlugin as vt, InferAllMainRoutes as w, toSearchParams as wt, GetCurrentRouteSchema as x, defineSchemaRoutes as xt, ApplyStrictConfig as y, defineSchema as yt, GetCallApiContext as z, fallBackRouteSchemaKey as zt };
|
|
1899
|
-
//# sourceMappingURL=default-types-Cn2QRN13.d.ts.map
|
|
1914
|
+
export { defineSchema as $, CallApiExtraOptionsForHooks as A, BaseSchemaRouteKeyPrefixes as At, SuccessContext as B, DistributiveOmit as Bt, GetBaseSchemaRoutes as C, ResponseTypeMap as Ct, InstanceContext as D, ValidationError as Dt, GlobalMeta as E, HTTPError as Et, RequestContext as F, InferSchemaResult as Ft, isHTTPErrorInstance as G, RetryOptions as H, Writeable as Ht, RequestStreamContext as I, URLOptions as It, isValidationErrorInstance as J, isJavascriptError as K, ResponseContext as L, FallBackRouteSchemaKey as Lt, ErrorContext as M, CallApiSchemaConfig as Mt, Hooks as N, InferSchemaInput as Nt, Register as O, BaseCallApiSchemaAndConfig as Ot, HooksOrHooksArray as P, InferSchemaOutput as Pt, definePlugin as Q, ResponseErrorContext as R, fallBackRouteSchemaKey as Rt, GetBaseSchemaConfig as S, PossibleValidationError as St, GetCallApiContextRequired as T, ResultModeType as Tt, objectifyHeaders as U, fetchSpecificKeys as Ut, RefetchOptions as V, NoInferUnMasked as Vt, isHTTPError as W, defineInstanceConfig as X, defineBaseConfig as Y, defineMainSchema as Z, CallApiExtraOptions as _, CallApiResultSuccessVariant as _t, GetCurrentRouteSchemaKey as a, DefaultCallApiContext as at, CallApiResult as b, PossibleHTTPError as bt, InferInitURL as c, CallApiPlugin as ct, SerializableObject as d, PluginSetupContext as dt, defineSchemaConfig as et, ThrowOnErrorBoolean as f, FetchImpl as ft, CallApiContext as g, CallApiResultSuccessOrErrorVariant as gt, CallApiConfig as h, CallApiResultErrorVariant as ht, GetCurrentRouteSchema as i, toSearchParams as it, CallApiRequestOptionsForHooks as j, CallApiSchema as jt, DedupeOptions as k, BaseCallApiSchemaRoutes as kt, InferParamsFromRoute as l, PluginHooks as lt, BaseCallApiExtraOptions as m, Middlewares as mt, ApplyURLBasedConfig as n, toFormData as nt, InferAllMainRouteKeys as o, DefaultDataType as ot, BaseCallApiConfig as p, FetchMiddlewareContext as pt, isValidationError as q, Body as r, toQueryString as rt, InferAllMainRoutes as s, DefaultPluginArray as st, ApplyStrictConfig as t, defineSchemaRoutes as tt, SerializableArray as u, PluginMiddlewares as ut, CallApiParameters as v, GetResponseType as vt, GetCallApiContext as w, ResponseTypeType as wt, CallApiResultLoose as x, PossibleJavaScriptError as xt, CallApiRequestOptions as y, InferCallApiResult as yt, ResponseStreamContext as z, AnyString as zt };
|
|
1915
|
+
//# sourceMappingURL=conditional-types-BXgYQJ5q.d.ts.map
|