@zayne-labs/callapi 1.11.45 → 1.11.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { G as FallBackRouteSchemaKey, K as fallBackRouteSchemaKey, et as RequestContext, lt as fetchSpecificKeys } from "../index-CDDc6484.js";
1
+ import { K as FallBackRouteSchemaKey, q as fallBackRouteSchemaKey, tt as RequestContext, ut as fetchSpecificKeys } from "../index-JYbaY_l-.js";
2
2
 
3
3
  //#region src/constants/defaults.d.ts
4
4
  declare const extraOptionDefaults: Readonly<Readonly<{
@@ -856,7 +856,8 @@ type ApplyURLBasedConfig<TSchemaConfig extends CallApiSchemaConfig, TSchemaRoute
856
856
  type ApplyStrictConfig<TSchemaConfig extends CallApiSchemaConfig, TSchemaRouteKeys extends string> = TSchemaConfig["strict"] extends true ? TSchemaRouteKeys : // eslint-disable-next-line perfectionist/sort-union-types -- Don't sort union types
857
857
  TSchemaRouteKeys | Exclude<InitURLOrURLObject, RouteKeyMethodsURLUnion>;
858
858
  type ApplySchemaConfiguration<TSchemaConfig extends CallApiSchemaConfig, TSchemaRouteKeys extends string> = ApplyStrictConfig<TSchemaConfig, ApplyURLBasedConfig<TSchemaConfig, TSchemaRouteKeys>>;
859
- type InferAllMainRouteKeys<TBaseSchemaRoutes extends BaseCallApiSchemaRoutes, TSchemaConfig extends CallApiSchemaConfig> = ApplySchemaConfiguration<TSchemaConfig, Exclude<Extract<keyof TBaseSchemaRoutes, string>, FallBackRouteSchemaKey>>;
859
+ type InferAllMainRoutes<TBaseSchemaRoutes extends BaseCallApiSchemaRoutes> = Omit<TBaseSchemaRoutes, FallBackRouteSchemaKey>;
860
+ type InferAllMainRouteKeys<TBaseSchemaRoutes extends BaseCallApiSchemaRoutes, TSchemaConfig extends CallApiSchemaConfig> = ApplySchemaConfiguration<TSchemaConfig, Extract<keyof InferAllMainRoutes<TBaseSchemaRoutes>, string>>;
860
861
  type InferInitURL<TBaseSchemaRoutes extends BaseCallApiSchemaRoutes, TSchemaConfig extends CallApiSchemaConfig> = keyof TBaseSchemaRoutes extends never ? InitURLOrURLObject : InferAllMainRouteKeys<TBaseSchemaRoutes, TSchemaConfig>;
861
862
  type GetCurrentRouteSchemaKey<TSchemaConfig extends CallApiSchemaConfig, TPath> = TPath extends URL ? string : TSchemaConfig["prefix"] extends string ? TPath extends (`${AtSymbol}${infer TMethod extends RouteKeyMethods}/${RemoveLeadingSlash<TSchemaConfig["prefix"]>}${infer TCurrentRoute}`) ? `${AtSymbol}${TMethod}/${RemoveLeadingSlash<TCurrentRoute>}` : TPath extends `${TSchemaConfig["prefix"]}${infer TCurrentRoute}` ? TCurrentRoute : string : TSchemaConfig["baseURL"] extends string ? TPath extends (`${AtSymbol}${infer TMethod extends RouteKeyMethods}/${TSchemaConfig["baseURL"]}${infer TCurrentRoute}`) ? `${AtSymbol}${TMethod}/${RemoveLeadingSlash<TCurrentRoute>}` : TPath extends `${TSchemaConfig["baseURL"]}${infer TCurrentRoute}` ? TCurrentRoute : string : TPath;
862
863
  type GetCurrentRouteSchema<TBaseSchemaRoutes extends BaseCallApiSchemaRoutes, TCurrentRouteSchemaKey extends string, TComputedFallBackRouteSchema = TBaseSchemaRoutes[FallBackRouteSchemaKey], TComputedCurrentRouteSchema = TBaseSchemaRoutes[TCurrentRouteSchemaKey], TComputedRouteSchema extends CallApiSchema = NonNullable<Omit<TComputedFallBackRouteSchema, keyof TComputedCurrentRouteSchema> & TComputedCurrentRouteSchema>> = TComputedRouteSchema extends CallApiSchema ? Writeable<TComputedRouteSchema, "deep"> : CallApiSchema;
@@ -871,13 +872,13 @@ type InferBodyOption<TSchema extends CallApiSchema> = MakeSchemaOptionRequiredIf
871
872
  body?: InferSchemaOutput<TSchema["body"], Body>;
872
873
  }>;
873
874
  type MethodUnion = UnmaskType<"CONNECT" | "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT" | "TRACE" | AnyString>;
874
- type InferMethodFromURL<TInitURL> = string extends TInitURL ? MethodUnion : TInitURL extends `${AtSymbol}${infer TMethod extends RouteKeyMethods}/${string}` ? Uppercase<TMethod> : MethodUnion;
875
- type InferMethodOption<TSchema extends CallApiSchema, TInitURL> = MakeSchemaOptionRequiredIfDefined<TSchema["method"], {
875
+ type ExtractMethodFromURL<TInitURL> = string extends TInitURL ? MethodUnion : TInitURL extends `${AtSymbol}${infer TMethod extends RouteKeyMethods}/${string}` ? Uppercase<TMethod> : MethodUnion;
876
+ type InferMethodOption<TSchema extends CallApiSchema, TInitURL extends InitURLOrURLObject> = MakeSchemaOptionRequiredIfDefined<TSchema["method"], {
876
877
  /**
877
878
  * HTTP method for the request.
878
879
  * @default "GET"
879
880
  */
880
- method?: InferSchemaOutput<TSchema["method"], InferMethodFromURL<TInitURL>>;
881
+ method?: InferSchemaOutput<TSchema["method"], ExtractMethodFromURL<TInitURL>>;
881
882
  }>;
882
883
  type HeadersOption = UnmaskType<Headers | Record<"Authorization", CommonAuthorizationHeaders | undefined> | Record<"Content-Type", CommonContentTypes | undefined> | Record<CommonRequestHeaders, string | undefined> | Record<string, string | undefined> | Array<[string, string]>>;
883
884
  type InferHeadersOption<TSchema extends CallApiSchema> = MakeSchemaOptionRequiredIfDefined<TSchema["headers"], {
@@ -1862,5 +1863,5 @@ declare const callApi: <TData = unknown, TErrorData = unknown, TResultMode exten
1862
1863
  "@put/"?: CallApiSchema | undefined;
1863
1864
  }, TSchema, CallApiSchemaConfig, TSchemaConfig, TInitURL, TCurrentRouteSchemaKey, DefaultPluginArray, TPluginArray>) => Promise<TComputedResult>;
1864
1865
  //#endregion
1865
- export { HooksOrHooksArray as $, HTTPError as A, CallApiSchema as B, CallApiRequestOptions as C, GetCallApiContextRequired as D, GetCallApiContext as E, InferInitURL as F, FallBackRouteSchemaKey as G, CallApiSchemaType as H, InferParamsFromRoute as I, FetchMiddlewareContext as J, fallBackRouteSchemaKey as K, URLOptions as L, RetryOptions as M, GetCurrentRouteSchemaKey as N, InstanceContext as O, InferAllMainRouteKeys as P, Hooks as Q, BaseCallApiSchemaRoutes as R, CallApiParameters as S, CallApiResultLoose as T, InferSchemaInput as U, CallApiSchemaConfig as V, InferSchemaOutput as W, DedupeOptions as X, Middlewares as Y, ErrorContext as Z, BaseCallApiConfig as _, CallApiPlugin as a, SuccessContext as at, CallApiExtraOptions as b, PluginSetupContext as c, Writeable as ct, CallApiResultSuccessVariant as d, RequestContext as et, PossibleHTTPError as f, ResultModeType as g, ResponseTypeType as h, DefaultCallApiContext as i, ResponseStreamContext as it, ValidationError as j, Register as k, CallApiResultErrorVariant as l, fetchSpecificKeys as lt, PossibleValidationError as m, createFetchClient as n, ResponseContext as nt, PluginHooks as o, AnyFunction as ot, PossibleJavaScriptError as p, FetchImpl as q, createFetchClientWithContext as r, ResponseErrorContext as rt, PluginMiddlewares as s, Satisfies as st, callApi as t, RequestStreamContext as tt, CallApiResultSuccessOrErrorVariant as u, BaseCallApiExtraOptions as v, CallApiRequestOptionsForHooks as w, CallApiExtraOptionsForHooks as x, CallApiConfig as y, BaseSchemaRouteKeyPrefixes as z };
1866
- //# sourceMappingURL=index-CDDc6484.d.ts.map
1866
+ export { Hooks as $, HTTPError as A, BaseSchemaRouteKeyPrefixes as B, CallApiRequestOptions as C, GetCallApiContextRequired as D, GetCallApiContext as E, InferAllMainRoutes as F, InferSchemaOutput as G, CallApiSchemaConfig as H, InferInitURL as I, FetchImpl as J, FallBackRouteSchemaKey as K, InferParamsFromRoute as L, RetryOptions as M, GetCurrentRouteSchemaKey as N, InstanceContext as O, InferAllMainRouteKeys as P, ErrorContext as Q, URLOptions as R, CallApiParameters as S, CallApiResultLoose as T, CallApiSchemaType as U, CallApiSchema as V, InferSchemaInput as W, Middlewares as X, FetchMiddlewareContext as Y, DedupeOptions as Z, BaseCallApiConfig as _, CallApiPlugin as a, ResponseStreamContext as at, CallApiExtraOptions as b, PluginSetupContext as c, Satisfies as ct, CallApiResultSuccessVariant as d, HooksOrHooksArray as et, PossibleHTTPError as f, ResultModeType as g, ResponseTypeType as h, DefaultCallApiContext as i, ResponseErrorContext as it, ValidationError as j, Register as k, CallApiResultErrorVariant as l, Writeable as lt, PossibleValidationError as m, createFetchClient as n, RequestStreamContext as nt, PluginHooks as o, SuccessContext as ot, PossibleJavaScriptError as p, fallBackRouteSchemaKey as q, createFetchClientWithContext as r, ResponseContext as rt, PluginMiddlewares as s, AnyFunction as st, callApi as t, RequestContext as tt, CallApiResultSuccessOrErrorVariant as u, fetchSpecificKeys as ut, BaseCallApiExtraOptions as v, CallApiRequestOptionsForHooks as w, CallApiExtraOptionsForHooks as x, CallApiConfig as y, BaseCallApiSchemaRoutes as z };
1867
+ //# sourceMappingURL=index-JYbaY_l-.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as HooksOrHooksArray, B as CallApiSchema, C as CallApiRequestOptions, D as GetCallApiContextRequired, E as GetCallApiContext, F as InferInitURL, I as InferParamsFromRoute, J as FetchMiddlewareContext, L as URLOptions, M as RetryOptions, N as GetCurrentRouteSchemaKey, O as InstanceContext, P as InferAllMainRouteKeys, Q as Hooks, R as BaseCallApiSchemaRoutes, S as CallApiParameters, T as CallApiResultLoose, U as InferSchemaInput, V as CallApiSchemaConfig, W as InferSchemaOutput, X as DedupeOptions, Y as Middlewares, Z as ErrorContext, _ as BaseCallApiConfig, a as CallApiPlugin, at as SuccessContext, b as CallApiExtraOptions, c as PluginSetupContext, d as CallApiResultSuccessVariant, et as RequestContext, f as PossibleHTTPError, g as ResultModeType, h as ResponseTypeType, i as DefaultCallApiContext, it as ResponseStreamContext, k as Register, l as CallApiResultErrorVariant, m as PossibleValidationError, n as createFetchClient, nt as ResponseContext, o as PluginHooks, p as PossibleJavaScriptError, q as FetchImpl, r as createFetchClientWithContext, rt as ResponseErrorContext, s as PluginMiddlewares, t as callApi, tt as RequestStreamContext, u as CallApiResultSuccessOrErrorVariant, v as BaseCallApiExtraOptions, w as CallApiRequestOptionsForHooks, x as CallApiExtraOptionsForHooks, y as CallApiConfig, z as BaseSchemaRouteKeyPrefixes } from "./index-CDDc6484.js";
2
- export { BaseCallApiConfig, BaseCallApiExtraOptions, BaseCallApiSchemaRoutes, BaseSchemaRouteKeyPrefixes, CallApiConfig, CallApiExtraOptions, CallApiExtraOptionsForHooks, CallApiParameters, CallApiPlugin, CallApiRequestOptions, CallApiRequestOptionsForHooks, CallApiResultLoose as CallApiResult, CallApiResultErrorVariant, CallApiResultSuccessOrErrorVariant, CallApiResultSuccessVariant, CallApiSchema, CallApiSchemaConfig, DedupeOptions, DefaultCallApiContext, ErrorContext, FetchImpl, FetchMiddlewareContext, GetCallApiContext, GetCallApiContextRequired, GetCurrentRouteSchemaKey, Hooks, HooksOrHooksArray, InferAllMainRouteKeys, InferInitURL, InferParamsFromRoute, InferSchemaInput, InferSchemaOutput, InstanceContext, Middlewares, PluginHooks, PluginMiddlewares, PluginSetupContext, PossibleHTTPError, PossibleJavaScriptError, PossibleValidationError, Register, RequestContext, RequestStreamContext, ResponseContext, ResponseErrorContext, ResponseStreamContext, ResponseTypeType, ResultModeType, RetryOptions, SuccessContext, URLOptions, callApi, createFetchClient, createFetchClientWithContext };
1
+ import { $ as Hooks, B as BaseSchemaRouteKeyPrefixes, C as CallApiRequestOptions, D as GetCallApiContextRequired, E as GetCallApiContext, F as InferAllMainRoutes, G as InferSchemaOutput, H as CallApiSchemaConfig, I as InferInitURL, J as FetchImpl, L as InferParamsFromRoute, M as RetryOptions, N as GetCurrentRouteSchemaKey, O as InstanceContext, P as InferAllMainRouteKeys, Q as ErrorContext, R as URLOptions, S as CallApiParameters, T as CallApiResultLoose, V as CallApiSchema, W as InferSchemaInput, X as Middlewares, Y as FetchMiddlewareContext, Z as DedupeOptions, _ as BaseCallApiConfig, a as CallApiPlugin, at as ResponseStreamContext, b as CallApiExtraOptions, c as PluginSetupContext, d as CallApiResultSuccessVariant, et as HooksOrHooksArray, f as PossibleHTTPError, g as ResultModeType, h as ResponseTypeType, i as DefaultCallApiContext, it as ResponseErrorContext, k as Register, l as CallApiResultErrorVariant, m as PossibleValidationError, n as createFetchClient, nt as RequestStreamContext, o as PluginHooks, ot as SuccessContext, p as PossibleJavaScriptError, r as createFetchClientWithContext, rt as ResponseContext, s as PluginMiddlewares, t as callApi, tt as RequestContext, u as CallApiResultSuccessOrErrorVariant, v as BaseCallApiExtraOptions, w as CallApiRequestOptionsForHooks, x as CallApiExtraOptionsForHooks, y as CallApiConfig, z as BaseCallApiSchemaRoutes } from "./index-JYbaY_l-.js";
2
+ export { BaseCallApiConfig, BaseCallApiExtraOptions, BaseCallApiSchemaRoutes, BaseSchemaRouteKeyPrefixes, CallApiConfig, CallApiExtraOptions, CallApiExtraOptionsForHooks, CallApiParameters, CallApiPlugin, CallApiRequestOptions, CallApiRequestOptionsForHooks, CallApiResultLoose as CallApiResult, CallApiResultErrorVariant, CallApiResultSuccessOrErrorVariant, CallApiResultSuccessVariant, CallApiSchema, CallApiSchemaConfig, DedupeOptions, DefaultCallApiContext, ErrorContext, FetchImpl, FetchMiddlewareContext, GetCallApiContext, GetCallApiContextRequired, GetCurrentRouteSchemaKey, Hooks, HooksOrHooksArray, InferAllMainRouteKeys, InferAllMainRoutes, InferInitURL, InferParamsFromRoute, InferSchemaInput, InferSchemaOutput, InstanceContext, Middlewares, PluginHooks, PluginMiddlewares, PluginSetupContext, PossibleHTTPError, PossibleJavaScriptError, PossibleValidationError, Register, RequestContext, RequestStreamContext, ResponseContext, ResponseErrorContext, ResponseStreamContext, ResponseTypeType, ResultModeType, RetryOptions, SuccessContext, URLOptions, callApi, createFetchClient, createFetchClientWithContext };
@@ -1,4 +1,4 @@
1
- import { A as HTTPError, B as CallApiSchema, C as CallApiRequestOptions, H as CallApiSchemaType, R as BaseCallApiSchemaRoutes, V as CallApiSchemaConfig, W as InferSchemaOutput, _ as BaseCallApiConfig, a as CallApiPlugin, ct as Writeable, f as PossibleHTTPError, j as ValidationError, l as CallApiResultErrorVariant, m as PossibleValidationError, ot as AnyFunction, p as PossibleJavaScriptError, st as Satisfies, y as CallApiConfig } from "../../index-CDDc6484.js";
1
+ import { A as HTTPError, C as CallApiRequestOptions, G as InferSchemaOutput, H as CallApiSchemaConfig, U as CallApiSchemaType, V as CallApiSchema, _ as BaseCallApiConfig, a as CallApiPlugin, ct as Satisfies, f as PossibleHTTPError, j as ValidationError, l as CallApiResultErrorVariant, lt as Writeable, m as PossibleValidationError, p as PossibleJavaScriptError, st as AnyFunction, y as CallApiConfig, z as BaseCallApiSchemaRoutes } from "../../index-JYbaY_l-.js";
2
2
 
3
3
  //#region src/utils/external/body.d.ts
4
4
  type BodyType = NonNullable<CallApiRequestOptions["body"]>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zayne-labs/callapi",
3
3
  "type": "module",
4
- "version": "1.11.45",
4
+ "version": "1.11.46",
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",