@zayne-labs/callapi 1.11.7 → 1.11.9
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.
|
@@ -1795,14 +1795,15 @@ type CallApiExtraOptions<TData = DefaultDataType, TErrorData = DefaultDataType,
|
|
|
1795
1795
|
schemaConfig?: TSchemaConfig | ((context: TComputedSchemaConfigContext) => TSchemaConfig);
|
|
1796
1796
|
};
|
|
1797
1797
|
type CallApiExtraOptionsForHooks = Hooks & Omit<CallApiExtraOptions, keyof Hooks>;
|
|
1798
|
-
type
|
|
1798
|
+
type BaseInstanceContext = {
|
|
1799
1799
|
initURL: string;
|
|
1800
1800
|
options: CallApiExtraOptions;
|
|
1801
1801
|
request: CallApiRequestOptions;
|
|
1802
|
-
}
|
|
1802
|
+
};
|
|
1803
|
+
type BaseCallApiConfig<TBaseData = DefaultDataType, TBaseErrorData = DefaultDataType, TBaseResultMode extends ResultModeUnion = ResultModeUnion, TBaseThrowOnError extends ThrowOnErrorUnion = DefaultThrowOnError, TBaseResponseType extends ResponseTypeUnion = ResponseTypeUnion, TBaseSchemaAndConfig extends BaseCallApiSchemaAndConfig = BaseCallApiSchemaAndConfig, TBasePluginArray extends CallApiPlugin[] = DefaultPluginArray, TComputedBaseConfig = BaseCallApiExtraOptions<TBaseData, TBaseErrorData, TBaseResultMode, TBaseThrowOnError, TBaseResponseType, TBasePluginArray, TBaseSchemaAndConfig>> = (CallApiRequestOptions & TComputedBaseConfig) | ((context: BaseInstanceContext) => CallApiRequestOptions & TComputedBaseConfig);
|
|
1803
1804
|
type CallApiConfig<TData = DefaultDataType, TErrorData = DefaultDataType, TResultMode extends ResultModeUnion = ResultModeUnion, TThrowOnError extends ThrowOnErrorUnion = DefaultThrowOnError, TResponseType extends ResponseTypeUnion = ResponseTypeUnion, TBaseSchemaRoutes extends BaseCallApiSchemaRoutes = BaseCallApiSchemaRoutes, TSchema$1 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$1, TBaseSchemaRoutes, TCurrentRouteSchemaKey> & InferRequestOptions<TSchema$1, TInitURL> & Omit<CallApiExtraOptions<TData, TErrorData, TResultMode, TThrowOnError, TResponseType, TBasePluginArray, TPluginArray, TBaseSchemaRoutes, TSchema$1, TBaseSchemaConfig, TSchemaConfig, TCurrentRouteSchemaKey>, keyof InferExtraOptions<CallApiSchema, BaseCallApiSchemaRoutes, string>> & Omit<CallApiRequestOptions, keyof InferRequestOptions<CallApiSchema, string>>;
|
|
1804
1805
|
type CallApiParameters<TData = DefaultDataType, TErrorData = DefaultDataType, TResultMode extends ResultModeUnion = ResultModeUnion, TThrowOnError extends ThrowOnErrorUnion = DefaultThrowOnError, TResponseType extends ResponseTypeUnion = ResponseTypeUnion, TBaseSchemaRoutes extends BaseCallApiSchemaRoutes = BaseCallApiSchemaRoutes, TSchema$1 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<TData, TErrorData, TResultMode, TThrowOnError, TResponseType, TBaseSchemaRoutes, TSchema$1, TBaseSchemaConfig, TSchemaConfig, TInitURL, TCurrentRouteSchemaKey, TBasePluginArray, TPluginArray>];
|
|
1805
1806
|
type CallApiResult<TData, TErrorData, TResultMode extends ResultModeUnion, TThrowOnError extends ThrowOnErrorUnion, TResponseType extends ResponseTypeUnion> = GetCallApiResult<TData, TErrorData, TResultMode, TThrowOnError, TResponseType>;
|
|
1806
1807
|
//#endregion
|
|
1807
|
-
export {
|
|
1808
|
-
//# sourceMappingURL=common-
|
|
1808
|
+
export { PluginHooksWithMoreOptions as $, RequestStreamContext as A, PossibleHTTPError as B, RetryOptions as C, HooksOrHooksArray as D, Hooks as E, CallApiResultErrorVariant as F, ResponseTypeUnion as G, PossibleJavaScriptOrValidationError as H, CallApiResultSuccessVariant as I, DefaultDataType as J, ResultModeMap as K, CallApiSuccessOrErrorVariant as L, ResponseErrorContext as M, ResponseStreamContext as N, PluginExtraOptions as O, SuccessContext as P, PluginHooks as Q, GetCallApiResult as R, ThrowOnErrorUnion as S, ErrorContext as T, PossibleValidationError as U, PossibleJavaScriptError as V, ResponseTypeMap as W, DefaultThrowOnError as X, DefaultPluginArray as Y, CallApiPlugin as Z, GetCurrentRouteSchema as _, CallApiExtraOptions as a, CallApiSchema as at, InferParamsFromRoute as b, CallApiRequestOptions as c, fallBackRouteSchemaKey as ct, GetBaseSchemaConfig as d, MatchExactObjectType as dt, PluginSetupContext as et, GetBaseSchemaRoutes as f, Writeable as ft, ApplyURLBasedConfig as g, ApplyStrictConfig as h, CallApiConfig as i, BaseCallApiSchemaRoutes as it, ResponseContext as j, RequestContext as k, CallApiRequestOptionsForHooks as l, URLOptions as lt, InferExtendSchemaContext as m, BaseCallApiExtraOptions as n, ValidationError as nt, CallApiExtraOptionsForHooks as o, CallApiSchemaConfig as ot, InferExtendSchemaConfigContext as p, ResultModeUnion as q, BaseInstanceContext as r, BaseCallApiSchemaAndConfig as rt, CallApiParameters as s, InferSchemaOutputResult as st, BaseCallApiConfig as t, HTTPError as tt, CallApiResult as u, AnyString as ut, GetCurrentRouteSchemaKey as v, DedupeOptions as w, Register as x, InferInitURL as y, GetResponseType as z };
|
|
1809
|
+
//# sourceMappingURL=common-DvPxUh-h.d.ts.map
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as PluginHooksWithMoreOptions, A as RequestStreamContext, B as PossibleHTTPError, C as RetryOptions, D as HooksOrHooksArray, E as Hooks, F as CallApiResultErrorVariant, G as ResponseTypeUnion, H as PossibleJavaScriptOrValidationError, I as CallApiResultSuccessVariant, J as DefaultDataType, K as ResultModeMap, L as CallApiSuccessOrErrorVariant, M as ResponseErrorContext, N as ResponseStreamContext, O as PluginExtraOptions, P as SuccessContext, Q as PluginHooks, R as GetCallApiResult, S as ThrowOnErrorUnion, T as ErrorContext, U as PossibleValidationError, V as PossibleJavaScriptError, W as ResponseTypeMap, X as DefaultThrowOnError, Y as DefaultPluginArray, Z as CallApiPlugin, _ as GetCurrentRouteSchema, a as CallApiExtraOptions, at as CallApiSchema, b as InferParamsFromRoute, c as CallApiRequestOptions, ct as fallBackRouteSchemaKey, d as GetBaseSchemaConfig, et as PluginSetupContext, f as GetBaseSchemaRoutes, g as ApplyURLBasedConfig, h as ApplyStrictConfig, i as CallApiConfig, it as BaseCallApiSchemaRoutes, j as ResponseContext, k as RequestContext, l as CallApiRequestOptionsForHooks, lt as URLOptions, m as InferExtendSchemaContext, n as BaseCallApiExtraOptions, nt as ValidationError, o as CallApiExtraOptionsForHooks, ot as CallApiSchemaConfig, p as InferExtendSchemaConfigContext, q as ResultModeUnion, r as BaseInstanceContext, rt as BaseCallApiSchemaAndConfig, s as CallApiParameters, st as InferSchemaOutputResult, t as BaseCallApiConfig, tt as HTTPError, u as CallApiResult, ut as AnyString, v as GetCurrentRouteSchemaKey, w as DedupeOptions, x as Register, y as InferInitURL, z as GetResponseType } from "./common-DvPxUh-h.js";
|
|
2
2
|
|
|
3
3
|
//#region src/createFetchClient.d.ts
|
|
4
4
|
|
|
@@ -44,5 +44,5 @@ declare const callApi: <TData = unknown, TErrorData = unknown, TResultMode exten
|
|
|
44
44
|
"@put/"?: CallApiSchema | undefined;
|
|
45
45
|
}, TSchema, CallApiSchemaConfig, TSchemaConfig, TInitURL, TCurrentRouteSchemaKey, DefaultPluginArray, TPluginArray>) => Promise<TComputedResult>;
|
|
46
46
|
//#endregion
|
|
47
|
-
export { type BaseCallApiConfig, type BaseCallApiExtraOptions, type BaseCallApiSchemaRoutes, type CallApiConfig, type CallApiExtraOptions, type CallApiExtraOptionsForHooks, type CallApiParameters, type CallApiPlugin, type CallApiRequestOptions, type CallApiRequestOptionsForHooks, type CallApiResult, type CallApiResultErrorVariant, type CallApiResultSuccessVariant, type CallApiSchema, type CallApiSchemaConfig, type CallApiSuccessOrErrorVariant, type DedupeOptions, type ErrorContext, HTTPError, type Hooks, type HooksOrHooksArray, type InferParamsFromRoute, type InferSchemaOutputResult, type PluginExtraOptions, type PluginHooks, type PluginHooksWithMoreOptions, type PluginSetupContext, type PossibleHTTPError, type PossibleJavaScriptError, type PossibleJavaScriptOrValidationError, type PossibleValidationError, type Register, type RequestContext, type RequestStreamContext, type ResponseContext, type ResponseErrorContext, type ResponseStreamContext, type ResponseTypeUnion, type ResultModeUnion, type RetryOptions, type SuccessContext, type URLOptions, ValidationError, callApi, createFetchClient, fallBackRouteSchemaKey };
|
|
47
|
+
export { type BaseCallApiConfig, type BaseCallApiExtraOptions, type BaseCallApiSchemaRoutes, type BaseInstanceContext, type CallApiConfig, type CallApiExtraOptions, type CallApiExtraOptionsForHooks, type CallApiParameters, type CallApiPlugin, type CallApiRequestOptions, type CallApiRequestOptionsForHooks, type CallApiResult, type CallApiResultErrorVariant, type CallApiResultSuccessVariant, type CallApiSchema, type CallApiSchemaConfig, type CallApiSuccessOrErrorVariant, type DedupeOptions, type ErrorContext, HTTPError, type Hooks, type HooksOrHooksArray, type InferExtendSchemaConfigContext, type InferExtendSchemaContext, type InferParamsFromRoute, type InferSchemaOutputResult, type PluginExtraOptions, type PluginHooks, type PluginHooksWithMoreOptions, type PluginSetupContext, type PossibleHTTPError, type PossibleJavaScriptError, type PossibleJavaScriptOrValidationError, type PossibleValidationError, type Register, type RequestContext, type RequestStreamContext, type ResponseContext, type ResponseErrorContext, type ResponseStreamContext, type ResponseTypeUnion, type ResultModeUnion, type RetryOptions, type SuccessContext, type URLOptions, ValidationError, callApi, createFetchClient, fallBackRouteSchemaKey };
|
|
48
48
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { B as PossibleHTTPError, F as CallApiResultErrorVariant, U as PossibleValidationError, V as PossibleJavaScriptError, Z as CallApiPlugin, a as CallApiExtraOptions, at as CallApiSchema, dt as MatchExactObjectType, ft as Writeable, it as BaseCallApiSchemaRoutes, nt as ValidationError, ot as CallApiSchemaConfig, t as BaseCallApiConfig, tt as HTTPError } from "../../common-DvPxUh-h.js";
|
|
2
2
|
|
|
3
3
|
//#region src/utils/external/body.d.ts
|
|
4
4
|
type ToQueryStringFn = {
|
|
@@ -66,8 +66,8 @@ declare const defineSchema: <const TBaseSchemaRoutes extends BaseCallApiSchemaRo
|
|
|
66
66
|
};
|
|
67
67
|
declare const defineSchemaRoutes: <const TSchemaRoutes extends CallApiSchema>(routes: MatchExactObjectType<TSchemaRoutes, CallApiSchema>) => Writeable<typeof routes, "deep">;
|
|
68
68
|
declare const defineSchemaConfig: <const TSchemaConfig extends CallApiSchemaConfig>(config: MatchExactObjectType<TSchemaConfig, CallApiSchemaConfig>) => Writeable<typeof config, "deep">;
|
|
69
|
-
declare const definePlugin: <const TPlugin extends CallApiPlugin>(plugin:
|
|
70
|
-
declare const defineBaseConfig: <const TBaseConfig extends BaseCallApiConfig>(baseConfig:
|
|
69
|
+
declare const definePlugin: <const TPlugin extends CallApiPlugin>(plugin: TPlugin) => Writeable<typeof plugin, "deep">;
|
|
70
|
+
declare const defineBaseConfig: <const TBaseConfig extends BaseCallApiConfig>(baseConfig: TBaseConfig) => Writeable<typeof baseConfig, "deep">;
|
|
71
71
|
//#endregion
|
|
72
72
|
//#region src/utils/external/guards.d.ts
|
|
73
73
|
declare const isHTTPError: <TErrorData>(error: CallApiResultErrorVariant<TErrorData>["error"] | null) => error is PossibleHTTPError<TErrorData>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/utils/external/define.ts"],"sourcesContent":["import type { CallApiPlugin } from \"../../plugins\";\nimport type { BaseCallApiConfig } from \"../../types\";\nimport type { MatchExactObjectType, 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?: MatchExactObjectType<TSchemaConfig, CallApiSchemaConfig>\n) => {\n\treturn {\n\t\tconfig: config as NonNullable<Writeable<typeof config, \"deep\">>,\n\t\troutes: routes as Writeable<typeof routes, \"deep\">,\n\t} satisfies BaseCallApiSchemaAndConfig;\n};\n\nexport const defineSchemaRoutes = <const TSchemaRoutes extends CallApiSchema>(\n\troutes: MatchExactObjectType<TSchemaRoutes, CallApiSchema>\n) => {\n\treturn routes as Writeable<typeof routes, \"deep\">;\n};\n\nexport const defineSchemaConfig = <const TSchemaConfig extends CallApiSchemaConfig>(\n\tconfig: MatchExactObjectType<TSchemaConfig, CallApiSchemaConfig>\n) => {\n\treturn config as Writeable<typeof config, \"deep\">;\n};\n\nexport const definePlugin = <const TPlugin extends CallApiPlugin>(
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/utils/external/define.ts"],"sourcesContent":["import type { CallApiPlugin } from \"../../plugins\";\nimport type { BaseCallApiConfig } from \"../../types\";\nimport type { MatchExactObjectType, 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?: MatchExactObjectType<TSchemaConfig, CallApiSchemaConfig>\n) => {\n\treturn {\n\t\tconfig: config as NonNullable<Writeable<typeof config, \"deep\">>,\n\t\troutes: routes as Writeable<typeof routes, \"deep\">,\n\t} satisfies BaseCallApiSchemaAndConfig;\n};\n\nexport const defineSchemaRoutes = <const TSchemaRoutes extends CallApiSchema>(\n\troutes: MatchExactObjectType<TSchemaRoutes, CallApiSchema>\n) => {\n\treturn routes as Writeable<typeof routes, \"deep\">;\n};\n\nexport const defineSchemaConfig = <const TSchemaConfig extends CallApiSchemaConfig>(\n\tconfig: MatchExactObjectType<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\nexport const defineBaseConfig = <const TBaseConfig extends BaseCallApiConfig>(baseConfig: TBaseConfig) => {\n\treturn baseConfig as Writeable<typeof baseConfig, \"deep\">;\n};\n"],"mappings":";;;AAUA,MAAa,gBAIZ,QACA,WACI;AACJ,QAAO;EACE;EACA;EACR;;AAGF,MAAa,sBACZ,WACI;AACJ,QAAO;;AAGR,MAAa,sBACZ,WACI;AACJ,QAAO;;AAGR,MAAa,gBAAqD,WAAoB;AACrF,QAAO;;AAGR,MAAa,oBAAiE,eAA4B;AACzG,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.9",
|
|
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",
|