@zayne-labs/callapi 1.11.23 → 1.11.24
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.
|
@@ -20,7 +20,7 @@ type UnmaskType<TValue$1> = {
|
|
|
20
20
|
}["_"];
|
|
21
21
|
type RemovePrefix<TPrefix extends "dedupe" | "retry", TKey extends string> = TKey extends `${TPrefix}${infer TRest}` ? Uncapitalize<TRest> : TKey;
|
|
22
22
|
type Awaitable<TValue$1> = Promise<TValue$1> | TValue$1;
|
|
23
|
-
type Satisfies<TActualObject extends TExpectedObject, TExpectedObject> = { [Key in keyof TActualObject
|
|
23
|
+
type Satisfies<TActualObject extends TExpectedObject, TExpectedObject> = { [Key in keyof TActualObject]: Key extends keyof TExpectedObject ? TActualObject[Key] : never };
|
|
24
24
|
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;
|
|
25
25
|
type CommonAuthorizationHeaders = `${"Basic" | "Bearer" | "Token"} ${string}`;
|
|
26
26
|
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;
|
|
@@ -665,7 +665,7 @@ type BaseConfigObject = Exclude<BaseCallApiConfig, AnyFunction>;
|
|
|
665
665
|
type BaseConfigFn = Extract<BaseCallApiConfig, AnyFunction>;
|
|
666
666
|
type DefineBaseConfig = {
|
|
667
667
|
<const TBaseConfig extends BaseConfigObject>(baseConfig: Satisfies<TBaseConfig, BaseConfigObject>): Writeable<typeof baseConfig, "deep">;
|
|
668
|
-
<
|
|
668
|
+
<TBaseConfigFn extends BaseConfigFn>(baseConfig: TBaseConfigFn): TBaseConfigFn;
|
|
669
669
|
};
|
|
670
670
|
declare const defineBaseConfig: DefineBaseConfig;
|
|
671
671
|
//#endregion
|
|
@@ -1907,4 +1907,4 @@ type CallApiResult<TData$1, TErrorData$1, TResultMode extends ResultModeType, TT
|
|
|
1907
1907
|
type CallApiResultLoose<TData$1, TErrorData$1, TResultMode extends ResultModeType = ResultModeType, TThrowOnError extends ThrowOnErrorUnion = ThrowOnErrorUnion, TResponseType extends ResponseTypeType = ResponseTypeType> = GetCallApiResult<TData$1, TErrorData$1, TResultMode, TThrowOnError, TResponseType>;
|
|
1908
1908
|
//#endregion
|
|
1909
1909
|
export { CallApiResultSuccessVariantWithoutResponse as $, RequestContext as A, isValidationErrorInstance as B, ThrowOnErrorUnion as C, DefaultPluginArray as Ct, Hooks as D, AnyString as Dt, ErrorContext as E, toQueryString as Et, SuccessContext as F, defineSchemaConfig as G, defineMainSchema as H, isHTTPError as I, PluginHooks as J, defineSchemaRoutes as K, isHTTPErrorInstance as L, ResponseContext as M, ResponseErrorContext as N, HooksOrHooksArray as O, ResponseStreamContext as P, CallApiResultSuccessVariant as Q, isJavascriptError as R, Register as S, DefaultDataType as St, DedupeOptions as T, toFormData as Tt, definePlugin as U, defineBaseConfig as V, defineSchema as W, PluginSetupContext as X, PluginHooksWithMoreOptions as Y, CallApiResultErrorVariant as Z, ApplyURLBasedConfig as _, CallApiSchemaConfig as _t, CallApiExtraOptionsForHooks as a, PossibleJavaScriptOrValidationError as at, InferInitURL as b, InferSchemaResult as bt, CallApiRequestOptionsForHooks as c, ResponseTypeType as ct, GetBaseSchemaConfig as d, HTTPError as dt, CallApiSuccessOrErrorVariant as et, GetBaseSchemaRoutes as f, ValidationError as ft, ApplyStrictConfig as g, CallApiSchema as gt, InstanceContext as h, BaseSchemaRouteKeyPrefixes as ht, CallApiExtraOptions as i, PossibleJavaScriptError as it, RequestStreamContext as j, PluginExtraOptions as k, CallApiResult as l, ResultModeMap as lt, InferExtendSchemaContext as m, BaseCallApiSchemaRoutes as mt, BaseCallApiExtraOptions as n, GetResponseType as nt, CallApiParameters as o, PossibleValidationError as ot, InferExtendSchemaConfigContext as p, BaseCallApiSchemaAndConfig as pt, CallApiPlugin as q, CallApiConfig as r, PossibleHTTPError as rt, CallApiRequestOptions as s, ResponseTypeMap as st, BaseCallApiConfig as t, GetCallApiResult as tt, CallApiResultLoose as u, ResultModeType as ut, GetCurrentRouteSchema as v, InferSchemaInput as vt, RetryOptions as w, DefaultThrowOnError as wt, InferParamsFromRoute as x, URLOptions as xt, GetCurrentRouteSchemaKey as y, InferSchemaOutput as yt, isValidationError as z };
|
|
1910
|
-
//# sourceMappingURL=common-
|
|
1910
|
+
//# sourceMappingURL=common-Bkz3oogl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults-C6WKIXsf.js","names":[],"sources":["../src/types/type-helpers.ts","../src/constants/defaults.ts"],"sourcesContent":["// == These two types allows for adding arbitrary literal types, while still provided autocomplete for defaults.\n\n// == Usually intersection with \"{}\" or \"NonNullable<unknown>\" would make it work fine, but the placeholder with never type is added to make the AnyWhatever type appear last in a given union.\nexport type AnyString = string & NonNullable<unknown>;\nexport type AnyNumber = number & NonNullable<unknown>;\n\n// eslint-disable-next-line ts-eslint/no-explicit-any -- Any is fine here\nexport type AnyObject = Record<keyof any, any>;\n\n// eslint-disable-next-line ts-eslint/no-explicit-any -- Any is required here so that one can pass custom function type without type errors\nexport type AnyFunction<TResult = unknown> = (...args: any[]) => TResult;\n\nexport type Prettify<TObject> = NonNullable<unknown> & { [Key in keyof TObject]: TObject[Key] };\n\ntype WriteableLevel = \"deep\" | \"shallow\";\n\n/**\n * Makes all properties in an object type writeable (removes readonly modifiers).\n * Supports both shallow and deep modes, and handles special cases like arrays, tuples, and unions.\n * @template TObject - The object type to make writeable\n * @template TVariant - The level of writeable transformation (\"shallow\" | \"deep\")\n */\n\ntype ArrayOrObject = Record<number | string | symbol, unknown> | unknown[] | readonly unknown[];\n\nexport type Writeable<TObject, TLevel extends WriteableLevel = \"shallow\"> =\n\tTObject extends ArrayOrObject ?\n\t\t{\n\t\t\t-readonly [Key in keyof TObject]: TLevel extends \"deep\" ?\n\t\t\t\tNonNullable<TObject[Key]> extends ArrayOrObject ?\n\t\t\t\t\tWriteable<TObject[Key], \"deep\">\n\t\t\t\t:\tTObject[Key]\n\t\t\t:\tTObject[Key];\n\t\t}\n\t:\tTObject;\n\nexport const defineEnum = <const TValue extends object>(value: TValue) =>\n\tObject.freeze(value) as Readonly<Writeable<TValue>>;\n\nexport type UnionToIntersection<TUnion> =\n\t(TUnion extends unknown ? (param: TUnion) => void : never) extends (param: infer TParam) => void ?\n\t\tTParam\n\t:\tnever;\n\n// == Using this Immediately Indexed Mapped type helper to help show computed type of anything passed to it instead of just the type name\nexport type UnmaskType<TValue> = { _: TValue }[\"_\"];\n\nexport type RemovePrefix<TPrefix extends \"dedupe\" | \"retry\", TKey extends string> =\n\tTKey extends `${TPrefix}${infer TRest}` ? Uncapitalize<TRest> : TKey;\n\nexport type Awaitable<TValue> = Promise<TValue> | TValue;\n\n// export type MatchExactObjectType<TActualObject extends TExpectedObject, TExpectedObject> = {\n// \t[Key in keyof TActualObject]: Key extends keyof TExpectedObject ? TActualObject[Key] : never;\n// };\n\
|
|
1
|
+
{"version":3,"file":"defaults-C6WKIXsf.js","names":[],"sources":["../src/types/type-helpers.ts","../src/constants/defaults.ts"],"sourcesContent":["// == These two types allows for adding arbitrary literal types, while still provided autocomplete for defaults.\n\n// == Usually intersection with \"{}\" or \"NonNullable<unknown>\" would make it work fine, but the placeholder with never type is added to make the AnyWhatever type appear last in a given union.\nexport type AnyString = string & NonNullable<unknown>;\nexport type AnyNumber = number & NonNullable<unknown>;\n\n// eslint-disable-next-line ts-eslint/no-explicit-any -- Any is fine here\nexport type AnyObject = Record<keyof any, any>;\n\n// eslint-disable-next-line ts-eslint/no-explicit-any -- Any is required here so that one can pass custom function type without type errors\nexport type AnyFunction<TResult = unknown> = (...args: any[]) => TResult;\n\nexport type Prettify<TObject> = NonNullable<unknown> & { [Key in keyof TObject]: TObject[Key] };\n\ntype WriteableLevel = \"deep\" | \"shallow\";\n\n/**\n * Makes all properties in an object type writeable (removes readonly modifiers).\n * Supports both shallow and deep modes, and handles special cases like arrays, tuples, and unions.\n * @template TObject - The object type to make writeable\n * @template TVariant - The level of writeable transformation (\"shallow\" | \"deep\")\n */\n\ntype ArrayOrObject = Record<number | string | symbol, unknown> | unknown[] | readonly unknown[];\n\nexport type Writeable<TObject, TLevel extends WriteableLevel = \"shallow\"> =\n\tTObject extends ArrayOrObject ?\n\t\t{\n\t\t\t-readonly [Key in keyof TObject]: TLevel extends \"deep\" ?\n\t\t\t\tNonNullable<TObject[Key]> extends ArrayOrObject ?\n\t\t\t\t\tWriteable<TObject[Key], \"deep\">\n\t\t\t\t:\tTObject[Key]\n\t\t\t:\tTObject[Key];\n\t\t}\n\t:\tTObject;\n\nexport const defineEnum = <const TValue extends object>(value: TValue) =>\n\tObject.freeze(value) as Readonly<Writeable<TValue>>;\n\nexport type UnionToIntersection<TUnion> =\n\t(TUnion extends unknown ? (param: TUnion) => void : never) extends (param: infer TParam) => void ?\n\t\tTParam\n\t:\tnever;\n\n// == Using this Immediately Indexed Mapped type helper to help show computed type of anything passed to it instead of just the type name\nexport type UnmaskType<TValue> = { _: TValue }[\"_\"];\n\nexport type RemovePrefix<TPrefix extends \"dedupe\" | \"retry\", TKey extends string> =\n\tTKey extends `${TPrefix}${infer TRest}` ? Uncapitalize<TRest> : TKey;\n\nexport type Awaitable<TValue> = Promise<TValue> | TValue;\n\n// export type MatchExactObjectType<TActualObject extends TExpectedObject, TExpectedObject> = {\n// \t[Key in keyof TActualObject]: Key extends keyof TExpectedObject ? TActualObject[Key] : never;\n// };\n\nexport type Satisfies<TActualObject extends TExpectedObject, TExpectedObject> = {\n\t[Key in keyof TActualObject]: Key extends keyof TExpectedObject ? TActualObject[Key] : never;\n};\n// export type Satisfies<TActualObject extends TExpectedObject, TExpectedObject> = {\n// \t[Key in keyof TActualObject & keyof TExpectedObject]: TActualObject[Key];\n// };\n\nexport type CommonRequestHeaders =\n\t| \"Access-Control-Allow-Credentials\"\n\t| \"Access-Control-Allow-Headers\"\n\t| \"Access-Control-Allow-Methods\"\n\t| \"Access-Control-Allow-Origin\"\n\t| \"Access-Control-Expose-Headers\"\n\t| \"Access-Control-Max-Age\"\n\t| \"Age\"\n\t| \"Allow\"\n\t| \"Cache-Control\"\n\t| \"Clear-Site-Data\"\n\t| \"Content-Disposition\"\n\t| \"Content-Encoding\"\n\t| \"Content-Language\"\n\t| \"Content-Length\"\n\t| \"Content-Location\"\n\t| \"Content-Range\"\n\t| \"Content-Security-Policy-Report-Only\"\n\t| \"Content-Security-Policy\"\n\t| \"Cookie\"\n\t| \"Cross-Origin-Embedder-Policy\"\n\t| \"Cross-Origin-Opener-Policy\"\n\t| \"Cross-Origin-Resource-Policy\"\n\t| \"Date\"\n\t| \"ETag\"\n\t| \"Expires\"\n\t| \"Last-Modified\"\n\t| \"Location\"\n\t| \"Permissions-Policy\"\n\t| \"Pragma\"\n\t| \"Retry-After\"\n\t| \"Save-Data\"\n\t| \"Sec-CH-Prefers-Color-Scheme\"\n\t| \"Sec-CH-Prefers-Reduced-Motion\"\n\t| \"Sec-CH-UA-Arch\"\n\t| \"Sec-CH-UA-Bitness\"\n\t| \"Sec-CH-UA-Form-Factor\"\n\t| \"Sec-CH-UA-Full-Version-List\"\n\t| \"Sec-CH-UA-Full-Version\"\n\t| \"Sec-CH-UA-Mobile\"\n\t| \"Sec-CH-UA-Model\"\n\t| \"Sec-CH-UA-Platform-Version\"\n\t| \"Sec-CH-UA-Platform\"\n\t| \"Sec-CH-UA-WoW64\"\n\t| \"Sec-CH-UA\"\n\t| \"Sec-Fetch-Dest\"\n\t| \"Sec-Fetch-Mode\"\n\t| \"Sec-Fetch-Site\"\n\t| \"Sec-Fetch-User\"\n\t| \"Sec-GPC\"\n\t| \"Server-Timing\"\n\t| \"Server\"\n\t| \"Service-Worker-Navigation-Preload\"\n\t| \"Set-Cookie\"\n\t| \"Strict-Transport-Security\"\n\t| \"Timing-Allow-Origin\"\n\t| \"Trailer\"\n\t| \"Transfer-Encoding\"\n\t| \"Upgrade\"\n\t| \"Vary\"\n\t| \"Warning\"\n\t| \"WWW-Authenticate\"\n\t| \"X-Content-Type-Options\"\n\t| \"X-DNS-Prefetch-Control\"\n\t| \"X-Frame-Options\"\n\t| \"X-Permitted-Cross-Domain-Policies\"\n\t| \"X-Powered-By\"\n\t| \"X-Robots-Tag\"\n\t| \"X-XSS-Protection\"\n\t| AnyString;\n\nexport type CommonAuthorizationHeaders = `${\"Basic\" | \"Bearer\" | \"Token\"} ${string}`;\n\nexport type CommonContentTypes =\n\t| \"application/epub+zip\"\n\t| \"application/gzip\"\n\t| \"application/json\"\n\t| \"application/ld+json\"\n\t| \"application/octet-stream\"\n\t| \"application/ogg\"\n\t| \"application/pdf\"\n\t| \"application/rtf\"\n\t| \"application/vnd.ms-fontobject\"\n\t| \"application/wasm\"\n\t| \"application/xhtml+xml\"\n\t| \"application/xml\"\n\t| \"application/zip\"\n\t| \"audio/aac\"\n\t| \"audio/mpeg\"\n\t| \"audio/ogg\"\n\t| \"audio/opus\"\n\t| \"audio/webm\"\n\t| \"audio/x-midi\"\n\t| \"font/otf\"\n\t| \"font/ttf\"\n\t| \"font/woff\"\n\t| \"font/woff2\"\n\t| \"image/avif\"\n\t| \"image/bmp\"\n\t| \"image/gif\"\n\t| \"image/jpeg\"\n\t| \"image/png\"\n\t| \"image/svg+xml\"\n\t| \"image/tiff\"\n\t| \"image/webp\"\n\t| \"image/x-icon\"\n\t| \"model/gltf-binary\"\n\t| \"model/gltf+json\"\n\t| \"text/calendar\"\n\t| \"text/css\"\n\t| \"text/csv\"\n\t| \"text/html\"\n\t| \"text/javascript\"\n\t| \"text/plain\"\n\t| \"video/3gpp\"\n\t| \"video/3gpp2\"\n\t| \"video/av1\"\n\t| \"video/mp2t\"\n\t| \"video/mp4\"\n\t| \"video/mpeg\"\n\t| \"video/ogg\"\n\t| \"video/webm\"\n\t| \"video/x-msvideo\"\n\t| AnyString;\n","import type { CallApiConfig, CallApiExtraOptions } from \"../types/common\";\nimport { defineEnum } from \"../types/type-helpers\";\n\nexport const extraOptionDefaults = Object.freeze(\n\tdefineEnum({\n\t\t// Common defaults\n\t\tbodySerializer: JSON.stringify,\n\t\tdefaultHTTPErrorMessage: \"Request failed unexpectedly\",\n\n\t\t// Dedupe defaults\n\t\t/* eslint-disable perfectionist/sort-objects -- Allow */\n\t\tdedupeCacheScope: \"local\",\n\t\tdedupeCacheScopeKey: \"default\",\n\t\tdedupeStrategy: \"cancel\",\n\t\t/* eslint-enable perfectionist/sort-objects -- Allow */\n\n\t\t// Hook defaults\n\t\thooksExecutionMode: \"parallel\",\n\n\t\t// Response defaults\n\t\tresponseParser: JSON.parse,\n\t\tresponseType: \"json\",\n\t\tresultMode: \"all\",\n\n\t\t// Retry Defaults\n\t\tretryAttempts: 0,\n\t\tretryCondition: () => true,\n\t\tretryDelay: 1000,\n\t\tretryMaxDelay: 10000,\n\t\tretryMethods: [\"GET\", \"POST\"],\n\t\tretryStatusCodes: [],\n\t\tretryStrategy: \"linear\",\n\t} satisfies CallApiExtraOptions)\n);\n\nexport const requestOptionDefaults = defineEnum({\n\tmethod: \"GET\",\n} satisfies CallApiConfig);\n"],"mappings":";AAoCA,MAAa,cAA2C,UACvD,OAAO,OAAO,MAAM;;;;AClCrB,MAAa,sBAAsB,OAAO,OACzC,WAAW;CAEV,gBAAgB,KAAK;CACrB,yBAAyB;CAIzB,kBAAkB;CAClB,qBAAqB;CACrB,gBAAgB;CAIhB,oBAAoB;CAGpB,gBAAgB,KAAK;CACrB,cAAc;CACd,YAAY;CAGZ,eAAe;CACf,sBAAsB;CACtB,YAAY;CACZ,eAAe;CACf,cAAc,CAAC,OAAO,OAAO;CAC7B,kBAAkB,EAAE;CACpB,eAAe;CACf,CAA+B,CAChC;AAED,MAAa,wBAAwB,WAAW,EAC/C,QAAQ,OACR,CAAyB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./validation-Dq--Q5zC.js";
|
|
2
|
-
import { $ as CallApiResultSuccessVariantWithoutResponse, A as RequestContext, C as ThrowOnErrorUnion, Ct as DefaultPluginArray, D as Hooks, Dt as AnyString, E as ErrorContext, F as SuccessContext, J as PluginHooks, M as ResponseContext, N as ResponseErrorContext, O as HooksOrHooksArray, P as ResponseStreamContext, Q as CallApiResultSuccessVariant, S as Register, St as DefaultDataType, T as DedupeOptions, X as PluginSetupContext, Y as PluginHooksWithMoreOptions, Z as CallApiResultErrorVariant, _ as ApplyURLBasedConfig, _t as CallApiSchemaConfig, a as CallApiExtraOptionsForHooks, at as PossibleJavaScriptOrValidationError, b as InferInitURL, bt as InferSchemaResult, c as CallApiRequestOptionsForHooks, ct as ResponseTypeType, d as GetBaseSchemaConfig, et as CallApiSuccessOrErrorVariant, f as GetBaseSchemaRoutes, g as ApplyStrictConfig, gt as CallApiSchema, h as InstanceContext, ht as BaseSchemaRouteKeyPrefixes, i as CallApiExtraOptions, it as PossibleJavaScriptError, j as RequestStreamContext, k as PluginExtraOptions, l as CallApiResult, lt as ResultModeMap, m as InferExtendSchemaContext, mt as BaseCallApiSchemaRoutes, n as BaseCallApiExtraOptions, nt as GetResponseType, o as CallApiParameters, ot as PossibleValidationError, p as InferExtendSchemaConfigContext, pt as BaseCallApiSchemaAndConfig, q as CallApiPlugin, r as CallApiConfig, rt as PossibleHTTPError, s as CallApiRequestOptions, st as ResponseTypeMap, t as BaseCallApiConfig, tt as GetCallApiResult, u as CallApiResultLoose, ut as ResultModeType, v as GetCurrentRouteSchema, vt as InferSchemaInput, w as RetryOptions, wt as DefaultThrowOnError, x as InferParamsFromRoute, xt as URLOptions, y as GetCurrentRouteSchemaKey, yt as InferSchemaOutput } from "./common-
|
|
2
|
+
import { $ as CallApiResultSuccessVariantWithoutResponse, A as RequestContext, C as ThrowOnErrorUnion, Ct as DefaultPluginArray, D as Hooks, Dt as AnyString, E as ErrorContext, F as SuccessContext, J as PluginHooks, M as ResponseContext, N as ResponseErrorContext, O as HooksOrHooksArray, P as ResponseStreamContext, Q as CallApiResultSuccessVariant, S as Register, St as DefaultDataType, T as DedupeOptions, X as PluginSetupContext, Y as PluginHooksWithMoreOptions, Z as CallApiResultErrorVariant, _ as ApplyURLBasedConfig, _t as CallApiSchemaConfig, a as CallApiExtraOptionsForHooks, at as PossibleJavaScriptOrValidationError, b as InferInitURL, bt as InferSchemaResult, c as CallApiRequestOptionsForHooks, ct as ResponseTypeType, d as GetBaseSchemaConfig, et as CallApiSuccessOrErrorVariant, f as GetBaseSchemaRoutes, g as ApplyStrictConfig, gt as CallApiSchema, h as InstanceContext, ht as BaseSchemaRouteKeyPrefixes, i as CallApiExtraOptions, it as PossibleJavaScriptError, j as RequestStreamContext, k as PluginExtraOptions, l as CallApiResult, lt as ResultModeMap, m as InferExtendSchemaContext, mt as BaseCallApiSchemaRoutes, n as BaseCallApiExtraOptions, nt as GetResponseType, o as CallApiParameters, ot as PossibleValidationError, p as InferExtendSchemaConfigContext, pt as BaseCallApiSchemaAndConfig, q as CallApiPlugin, r as CallApiConfig, rt as PossibleHTTPError, s as CallApiRequestOptions, st as ResponseTypeMap, t as BaseCallApiConfig, tt as GetCallApiResult, u as CallApiResultLoose, ut as ResultModeType, v as GetCurrentRouteSchema, vt as InferSchemaInput, w as RetryOptions, wt as DefaultThrowOnError, x as InferParamsFromRoute, xt as URLOptions, y as GetCurrentRouteSchemaKey, yt as InferSchemaOutput } from "./common-Bkz3oogl.js";
|
|
3
3
|
|
|
4
4
|
//#region src/createFetchClient.d.ts
|
|
5
5
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import "../../validation-Dq--Q5zC.js";
|
|
2
|
-
import { B as isValidationErrorInstance, Et as toQueryString, G as defineSchemaConfig, H as defineMainSchema, I as isHTTPError, K as defineSchemaRoutes, L as isHTTPErrorInstance, R as isJavascriptError, Tt as toFormData, U as definePlugin, V as defineBaseConfig, W as defineSchema, dt as HTTPError, ft as ValidationError, z as isValidationError } from "../../common-
|
|
2
|
+
import { B as isValidationErrorInstance, Et as toQueryString, G as defineSchemaConfig, H as defineMainSchema, I as isHTTPError, K as defineSchemaRoutes, L as isHTTPErrorInstance, R as isJavascriptError, Tt as toFormData, U as definePlugin, V as defineBaseConfig, W as defineSchema, dt as HTTPError, ft as ValidationError, z as isValidationError } from "../../common-Bkz3oogl.js";
|
|
3
3
|
export { HTTPError, ValidationError, defineBaseConfig, defineMainSchema, definePlugin, defineSchema, defineSchemaConfig, defineSchemaRoutes, isHTTPError, isHTTPErrorInstance, isJavascriptError, isValidationError, isValidationErrorInstance, toFormData, toQueryString };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["defineBaseConfig: DefineBaseConfig"],"sources":["../../../src/utils/external/define.ts"],"sourcesContent":["import type { CallApiPlugin } from \"../../plugins\";\nimport type { BaseCallApiConfig } from \"../../types\";\nimport type { AnyFunction, Satisfies, Writeable } from \"../../types/type-helpers\";\nimport type {\n\tBaseCallApiSchemaAndConfig,\n\tBaseCallApiSchemaRoutes,\n\tCallApiSchema,\n\tCallApiSchemaConfig,\n} from \"../../validation\";\n\nexport const defineSchema = <\n\tconst TBaseSchemaRoutes extends BaseCallApiSchemaRoutes,\n\tconst TSchemaConfig extends CallApiSchemaConfig,\n>(\n\troutes: TBaseSchemaRoutes,\n\tconfig?: Satisfies<TSchemaConfig, CallApiSchemaConfig>\n) => {\n\treturn {\n\t\tconfig: defineSchemaConfig(config as NonNullable<typeof config>),\n\t\troutes: defineSchemaRoutes(routes),\n\t} satisfies BaseCallApiSchemaAndConfig;\n};\n\nexport const defineSchemaRoutes = <const TSchemaRoutes extends BaseCallApiSchemaRoutes>(\n\troutes: TSchemaRoutes\n) => {\n\treturn routes as Writeable<typeof routes, \"deep\">;\n};\n\nexport const defineMainSchema = <const TSchema extends CallApiSchema>(\n\tmainSchema: Satisfies<TSchema, CallApiSchema>\n) => {\n\treturn mainSchema as Writeable<typeof mainSchema, \"deep\">;\n};\n\nexport const defineSchemaConfig = <const TSchemaConfig extends CallApiSchemaConfig>(\n\tconfig: Satisfies<TSchemaConfig, CallApiSchemaConfig>\n) => {\n\treturn config as Writeable<typeof config, \"deep\">;\n};\n\nexport const definePlugin = <const TPlugin extends CallApiPlugin>(plugin: TPlugin) => {\n\treturn plugin as Writeable<typeof plugin, \"deep\">;\n};\n\ntype BaseConfigObject = Exclude<BaseCallApiConfig, AnyFunction>;\n\ntype BaseConfigFn = Extract<BaseCallApiConfig, AnyFunction>;\n\ntype DefineBaseConfig = {\n\t<const TBaseConfig extends BaseConfigObject>(\n\t\tbaseConfig: Satisfies<TBaseConfig, BaseConfigObject>\n\t): Writeable<typeof baseConfig, \"deep\">;\n\t<
|
|
1
|
+
{"version":3,"file":"index.js","names":["defineBaseConfig: DefineBaseConfig"],"sources":["../../../src/utils/external/define.ts"],"sourcesContent":["import type { CallApiPlugin } from \"../../plugins\";\nimport type { BaseCallApiConfig } from \"../../types\";\nimport type { AnyFunction, Satisfies, Writeable } from \"../../types/type-helpers\";\nimport type {\n\tBaseCallApiSchemaAndConfig,\n\tBaseCallApiSchemaRoutes,\n\tCallApiSchema,\n\tCallApiSchemaConfig,\n} from \"../../validation\";\n\nexport const defineSchema = <\n\tconst TBaseSchemaRoutes extends BaseCallApiSchemaRoutes,\n\tconst TSchemaConfig extends CallApiSchemaConfig,\n>(\n\troutes: TBaseSchemaRoutes,\n\tconfig?: Satisfies<TSchemaConfig, CallApiSchemaConfig>\n) => {\n\treturn {\n\t\tconfig: defineSchemaConfig(config as NonNullable<typeof config>),\n\t\troutes: defineSchemaRoutes(routes),\n\t} satisfies BaseCallApiSchemaAndConfig;\n};\n\nexport const defineSchemaRoutes = <const TSchemaRoutes extends BaseCallApiSchemaRoutes>(\n\troutes: TSchemaRoutes\n) => {\n\treturn routes as Writeable<typeof routes, \"deep\">;\n};\n\nexport const defineMainSchema = <const TSchema extends CallApiSchema>(\n\tmainSchema: Satisfies<TSchema, CallApiSchema>\n) => {\n\treturn mainSchema as Writeable<typeof mainSchema, \"deep\">;\n};\n\nexport const defineSchemaConfig = <const TSchemaConfig extends CallApiSchemaConfig>(\n\tconfig: Satisfies<TSchemaConfig, CallApiSchemaConfig>\n) => {\n\treturn config as Writeable<typeof config, \"deep\">;\n};\n\nexport const definePlugin = <const TPlugin extends CallApiPlugin>(plugin: TPlugin) => {\n\treturn plugin as Writeable<typeof plugin, \"deep\">;\n};\n\ntype BaseConfigObject = Exclude<BaseCallApiConfig, AnyFunction>;\n\ntype BaseConfigFn = Extract<BaseCallApiConfig, AnyFunction>;\n\ntype DefineBaseConfig = {\n\t<const TBaseConfig extends BaseConfigObject>(\n\t\tbaseConfig: Satisfies<TBaseConfig, BaseConfigObject>\n\t): Writeable<typeof baseConfig, \"deep\">;\n\t<TBaseConfigFn extends BaseConfigFn>(baseConfig: TBaseConfigFn): TBaseConfigFn;\n};\n\nexport const defineBaseConfig: DefineBaseConfig = <const TBaseConfig extends BaseCallApiConfig>(\n\tbaseConfig: TBaseConfig\n) => {\n\treturn baseConfig;\n};\n"],"mappings":";;;;AAUA,MAAa,gBAIZ,QACA,WACI;AACJ,QAAO;EACN,QAAQ,mBAAmB,OAAqC;EAChE,QAAQ,mBAAmB,OAAO;EAClC;;AAGF,MAAa,sBACZ,WACI;AACJ,QAAO;;AAGR,MAAa,oBACZ,eACI;AACJ,QAAO;;AAGR,MAAa,sBACZ,WACI;AACJ,QAAO;;AAGR,MAAa,gBAAqD,WAAoB;AACrF,QAAO;;AAcR,MAAaA,oBACZ,eACI;AACJ,QAAO"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zayne-labs/callapi",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.11.
|
|
4
|
+
"version": "1.11.24",
|
|
5
5
|
"description": "A lightweight wrapper over fetch with quality of life improvements like built-in request cancellation, retries, interceptors and more",
|
|
6
6
|
"author": "Ryan Zayne",
|
|
7
7
|
"license": "MIT",
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"@size-limit/esbuild-why": "11.2.0",
|
|
40
40
|
"@size-limit/preset-small-lib": "11.2.0",
|
|
41
41
|
"@total-typescript/ts-reset": "0.6.1",
|
|
42
|
-
"@vitest/browser": "4.0.
|
|
43
|
-
"@vitest/browser-playwright": "4.0.
|
|
44
|
-
"@vitest/coverage-v8": "4.0.
|
|
42
|
+
"@vitest/browser": "4.0.12",
|
|
43
|
+
"@vitest/browser-playwright": "4.0.12",
|
|
44
|
+
"@vitest/coverage-v8": "4.0.12",
|
|
45
45
|
"@zayne-labs/prettier-config": "^0.11.5",
|
|
46
46
|
"@zayne-labs/tsconfig": "0.11.5",
|
|
47
47
|
"concurrently": "^9.2.1",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"size-limit": "11.2.0",
|
|
52
52
|
"tsdown": "0.15.9",
|
|
53
53
|
"typescript": "5.9.3",
|
|
54
|
-
"vitest": "^4.0.
|
|
54
|
+
"vitest": "^4.0.12",
|
|
55
55
|
"zod": "^4.1.12"
|
|
56
56
|
},
|
|
57
57
|
"publishConfig": {
|