@zayne-labs/callapi 1.14.0 → 1.14.1

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.
@@ -0,0 +1,186 @@
1
+ import { At as BaseCallApiSchemaAndConfig, Dt as ResultModeType, Et as ResponseTypeType, Gt as NoInferUnMasked, Ht as CommonContentTypes, It as InferSchemaOutput, Kt as Writeable, Lt as InferSchemaResult, Nt as CallApiSchema, O as GlobalMeta, Pt as CallApiSchemaConfig, S as CallApiResult, T as GetBaseSchemaRoutes, Tt as ResponseTypeMap, Ut as CommonRequestHeaders, Vt as AnyString, Wt as DistributiveOmit, _ as CallApiConfig, a as GetCurrentRouteSchemaKey, b as CallApiParameters, bt as GetResponseType, ct as DefaultDataType, d as SerializableArray, f as SerializableObject, h as BaseCallApiConfig, i as GetCurrentRouteSchema, jt as BaseCallApiSchemaRoutes, l as InferInitURL, lt as DefaultPluginArray, m as AuthOption, n as ApplyURLBasedConfig, o as HeadersOption, p as ThrowOnErrorBoolean, r as Body, st as DefaultCallApiContext, t as ApplyStrictConfig, u as InferParamsFromRoute, ut as CallApiPlugin, v as CallApiContext, vt as CallApiResultSuccessOrErrorVariant, w as GetBaseSchemaConfig, xt as InferCallApiResult, yt as CallApiResultSuccessVariant } from "./conditional-types-BFeM4YSg.js";
2
+ //#region src/createFetchClient.d.ts
3
+ declare const createFetchClientWithContext: <TOuterCallApiContext extends CallApiContext = DefaultCallApiContext>() => <TBaseCallApiContext extends CallApiContext = TOuterCallApiContext, TBaseData = TBaseCallApiContext["Data"], TBaseErrorData = TBaseCallApiContext["ErrorData"], TBaseResultMode extends ResultModeType = TBaseCallApiContext["ResultMode"] extends ResultModeType ? TBaseCallApiContext["ResultMode"] : ResultModeType, TBaseThrowOnError extends ThrowOnErrorBoolean = boolean, TBaseResponseType extends ResponseTypeType = ResponseTypeType, const TBaseSchemaAndConfig extends BaseCallApiSchemaAndConfig = BaseCallApiSchemaAndConfig, const TBasePluginArray extends CallApiPlugin[] = DefaultPluginArray, TComputedBaseSchemaConfig extends CallApiSchemaConfig = GetBaseSchemaConfig<TBaseSchemaAndConfig>, TComputedBaseSchemaRoutes extends BaseCallApiSchemaRoutes = GetBaseSchemaRoutes<TBaseSchemaAndConfig>>(initBaseConfig?: BaseCallApiConfig<TBaseCallApiContext, TBaseData, TBaseErrorData, TBaseResultMode, TBaseThrowOnError, TBaseResponseType, TBaseSchemaAndConfig, TBasePluginArray>) => <TData = TBaseData, TErrorData = TBaseErrorData, TResultMode extends ResultModeType = TBaseResultMode, TCallApiContext extends CallApiContext = TBaseCallApiContext, TThrowOnError extends ThrowOnErrorBoolean = TBaseThrowOnError, TResponseType extends ResponseTypeType = TBaseResponseType, const TSchemaConfig extends CallApiSchemaConfig = TComputedBaseSchemaConfig, TInitURL extends InferInitURL<TComputedBaseSchemaRoutes, TSchemaConfig> = InferInitURL<TComputedBaseSchemaRoutes, TSchemaConfig>, TCurrentRouteSchemaKey extends GetCurrentRouteSchemaKey<TSchemaConfig, TInitURL> = GetCurrentRouteSchemaKey<TSchemaConfig, TInitURL>, const TSchema extends CallApiSchema = GetCurrentRouteSchema<TComputedBaseSchemaRoutes, TCurrentRouteSchemaKey>, TBody extends InferSchemaOutput<TSchema["body"], Body> = InferSchemaOutput<TSchema["body"], SerializableObject | BodyInit | SerializableArray | null>, const TPluginArray extends CallApiPlugin[] = TBasePluginArray, TComputedData = InferSchemaOutput<TSchema["data"], GetResponseType<TData, TResponseType>>, TComputedErrorData = InferSchemaOutput<TSchema["errorData"], GetResponseType<TErrorData, TResponseType>>, TComputedResult = CallApiResult<TComputedData, TComputedErrorData, TResultMode, TThrowOnError>>(...[initURL, initConfig]: CallApiParameters<TComputedData, TComputedErrorData, TResultMode, TCallApiContext, TThrowOnError, TResponseType, TComputedBaseSchemaRoutes, TSchema, TComputedBaseSchemaConfig, TSchemaConfig, TInitURL, TCurrentRouteSchemaKey, TBody, TBasePluginArray, TPluginArray>) => Promise<TComputedResult>;
4
+ declare const createFetchClient: <TBaseCallApiContext extends CallApiContext = {
5
+ InferredExtraOptions: unknown;
6
+ Data: DefaultDataType;
7
+ ErrorData: DefaultDataType;
8
+ ResultMode: ResultModeType;
9
+ Meta: GlobalMeta;
10
+ }, TBaseData = TBaseCallApiContext["Data"], TBaseErrorData = TBaseCallApiContext["ErrorData"], TBaseResultMode extends ResultModeType = TBaseCallApiContext["ResultMode"] extends ResultModeType ? TBaseCallApiContext["ResultMode"] : ResultModeType, TBaseThrowOnError extends ThrowOnErrorBoolean = boolean, TBaseResponseType extends ResponseTypeType = ResponseTypeType, const TBaseSchemaAndConfig extends BaseCallApiSchemaAndConfig = BaseCallApiSchemaAndConfig, const TBasePluginArray extends CallApiPlugin[] = DefaultPluginArray, TComputedBaseSchemaConfig extends CallApiSchemaConfig = Writeable<NonNullable<TBaseSchemaAndConfig["config"]>, "deep">, TComputedBaseSchemaRoutes extends BaseCallApiSchemaRoutes = Writeable<TBaseSchemaAndConfig["routes"], "deep">>(initBaseConfig?: BaseCallApiConfig<TBaseCallApiContext, TBaseData, TBaseErrorData, TBaseResultMode, TBaseThrowOnError, TBaseResponseType, TBaseSchemaAndConfig, TBasePluginArray>) => <TData = TBaseData, TErrorData = TBaseErrorData, TResultMode extends ResultModeType = TBaseResultMode, TCallApiContext extends CallApiContext = TBaseCallApiContext, TThrowOnError extends ThrowOnErrorBoolean = TBaseThrowOnError, TResponseType extends ResponseTypeType = TBaseResponseType, const TSchemaConfig extends CallApiSchemaConfig = TComputedBaseSchemaConfig, TInitURL extends InferInitURL<TComputedBaseSchemaRoutes, TSchemaConfig> = InferInitURL<TComputedBaseSchemaRoutes, TSchemaConfig>, TCurrentRouteSchemaKey extends GetCurrentRouteSchemaKey<TSchemaConfig, TInitURL> = GetCurrentRouteSchemaKey<TSchemaConfig, TInitURL>, const TSchema extends CallApiSchema = GetCurrentRouteSchema<TComputedBaseSchemaRoutes, TCurrentRouteSchemaKey, TComputedBaseSchemaRoutes["@default"], TComputedBaseSchemaRoutes[TCurrentRouteSchemaKey], NonNullable<Omit<TComputedBaseSchemaRoutes["@default"], keyof TComputedBaseSchemaRoutes[TCurrentRouteSchemaKey]> & TComputedBaseSchemaRoutes[TCurrentRouteSchemaKey]>>, TBody extends InferSchemaResult<TSchema["body"], SerializableObject | BodyInit | SerializableArray | null, "infer-output"> = InferSchemaResult<TSchema["body"], SerializableObject | BodyInit | SerializableArray | null, "infer-output">, const TPluginArray extends CallApiPlugin[] = TBasePluginArray, TComputedData = InferSchemaResult<TSchema["data"], GetResponseType<TData, TResponseType, ResponseTypeMap<TData>>, "infer-output">, TComputedErrorData = InferSchemaResult<TSchema["errorData"], GetResponseType<TErrorData, TResponseType, ResponseTypeMap<TErrorData>>, "infer-output">, TComputedResult = InferCallApiResult<TComputedData, TComputedErrorData, TResultMode, TThrowOnError, {
11
+ all: CallApiResultSuccessVariant<TComputedData>;
12
+ fetchApi: Response;
13
+ onlyData: NoInferUnMasked<TComputedData>;
14
+ onlyResponse: Response;
15
+ withoutResponse: {
16
+ data: NoInferUnMasked<TComputedData>;
17
+ error: null;
18
+ };
19
+ }, {
20
+ all: TThrowOnError extends true ? CallApiResultSuccessVariant<TComputedData> : CallApiResultSuccessOrErrorVariant<TComputedData, TComputedErrorData>;
21
+ fetchApi: (TThrowOnError extends true ? CallApiResultSuccessVariant<TComputedData> : CallApiResultSuccessOrErrorVariant<TComputedData, TComputedErrorData>)["response"];
22
+ onlyData: (TThrowOnError extends true ? CallApiResultSuccessVariant<TComputedData> : CallApiResultSuccessOrErrorVariant<TComputedData, TComputedErrorData>)["data"];
23
+ onlyResponse: (TThrowOnError extends true ? CallApiResultSuccessVariant<TComputedData> : CallApiResultSuccessOrErrorVariant<TComputedData, TComputedErrorData>)["response"];
24
+ withoutResponse: DistributiveOmit<TThrowOnError extends true ? CallApiResultSuccessVariant<TComputedData> : CallApiResultSuccessOrErrorVariant<TComputedData, TComputedErrorData>, "response"> extends (infer T) ? { [Key in keyof T]: T[Key]; } : never;
25
+ }>>(...[initURL, initConfig]: CallApiParameters<TComputedData, TComputedErrorData, TResultMode, TCallApiContext, TThrowOnError, TResponseType, TComputedBaseSchemaRoutes, TSchema, TComputedBaseSchemaConfig, TSchemaConfig, TInitURL, TCurrentRouteSchemaKey, TBody, TBasePluginArray, TPluginArray, CallApiConfig<TCallApiContext, TComputedData, TComputedErrorData, TResultMode, TThrowOnError, TResponseType, TComputedBaseSchemaRoutes, TSchema, TComputedBaseSchemaConfig, TSchemaConfig, TInitURL, TCurrentRouteSchemaKey, TBody, TBasePluginArray, TPluginArray>, (undefined extends InferSchemaResult<TSchema["auth"], undefined, "infer-output"> ? {
26
+ auth?: InferSchemaResult<TSchema["auth"], AuthOption, "infer-output"> | undefined;
27
+ } : Required<{
28
+ auth?: InferSchemaResult<TSchema["auth"], AuthOption, "infer-output"> | undefined;
29
+ }>) & (undefined extends InferSchemaResult<TSchema["meta"], undefined, "infer-output"> ? {
30
+ meta?: InferSchemaResult<TSchema["meta"], TCallApiContext["Meta"], "infer-output"> | undefined;
31
+ } : Required<{
32
+ meta?: InferSchemaResult<TSchema["meta"], TCallApiContext["Meta"], "infer-output"> | undefined;
33
+ }>) & (undefined extends InferSchemaResult<TSchema["params"], undefined, "infer-output"> ? Record<string, string | number | boolean> | (string | number | boolean)[] extends InferParamsFromRoute<TCurrentRouteSchemaKey> ? {
34
+ params?: InferSchemaResult<TSchema["params"], InferParamsFromRoute<TCurrentRouteSchemaKey>, "infer-output"> | undefined;
35
+ } : TCurrentRouteSchemaKey extends Extract<keyof TComputedBaseSchemaRoutes, TCurrentRouteSchemaKey> ? undefined extends InferSchemaResult<TSchema["params"], null, "infer-output"> ? {
36
+ params?: InferSchemaResult<TSchema["params"], InferParamsFromRoute<TCurrentRouteSchemaKey>, "infer-output"> | undefined;
37
+ } : Required<{
38
+ params?: InferSchemaResult<TSchema["params"], InferParamsFromRoute<TCurrentRouteSchemaKey>, "infer-output"> | undefined;
39
+ }> : {
40
+ params?: InferSchemaResult<TSchema["params"], InferParamsFromRoute<TCurrentRouteSchemaKey>, "infer-output"> | undefined;
41
+ } : Required<Record<string, string | number | boolean> | (string | number | boolean)[] extends InferParamsFromRoute<TCurrentRouteSchemaKey> ? {
42
+ params?: InferSchemaResult<TSchema["params"], InferParamsFromRoute<TCurrentRouteSchemaKey>, "infer-output"> | undefined;
43
+ } : TCurrentRouteSchemaKey extends Extract<keyof TComputedBaseSchemaRoutes, TCurrentRouteSchemaKey> ? undefined extends InferSchemaResult<TSchema["params"], null, "infer-output"> ? {
44
+ params?: InferSchemaResult<TSchema["params"], InferParamsFromRoute<TCurrentRouteSchemaKey>, "infer-output"> | undefined;
45
+ } : Required<{
46
+ params?: InferSchemaResult<TSchema["params"], InferParamsFromRoute<TCurrentRouteSchemaKey>, "infer-output"> | undefined;
47
+ }> : {
48
+ params?: InferSchemaResult<TSchema["params"], InferParamsFromRoute<TCurrentRouteSchemaKey>, "infer-output"> | undefined;
49
+ }>) & (undefined extends InferSchemaResult<TSchema["query"], undefined, "infer-output"> ? {
50
+ query?: InferSchemaResult<TSchema["query"], URLSearchParams | Record<string, string | number | boolean>, "infer-output"> | undefined;
51
+ } : Required<{
52
+ query?: InferSchemaResult<TSchema["query"], URLSearchParams | Record<string, string | number | boolean>, "infer-output"> | undefined;
53
+ }>) & (undefined extends InferSchemaResult<TSchema["body"], undefined, "infer-output"> ? {
54
+ body?: TBody | undefined;
55
+ } : Required<{
56
+ body?: TBody | undefined;
57
+ }>) & (undefined extends InferSchemaResult<TSchema["headers"], undefined, "infer-output"> ? {
58
+ headers?: InferSchemaResult<TSchema["headers"], Headers | Record<"Authorization", `Basic ${string}` | `Bearer ${string}` | `Token ${string}` | undefined> | Record<"Content-Type", CommonContentTypes | undefined> | Record<CommonRequestHeaders, string | undefined> | Record<string, string | undefined> | [string, string][], "infer-output"> | ((context: {
59
+ baseHeaders: Extract<HeadersOption, Record<string, unknown>>;
60
+ }) => InferSchemaResult<TSchema["headers"], Headers | Record<"Authorization", `Basic ${string}` | `Bearer ${string}` | `Token ${string}` | undefined> | Record<"Content-Type", CommonContentTypes | undefined> | Record<CommonRequestHeaders, string | undefined> | Record<string, string | undefined> | [string, string][], "infer-output">) | undefined;
61
+ } : Required<{
62
+ headers?: InferSchemaResult<TSchema["headers"], Headers | Record<"Authorization", `Basic ${string}` | `Bearer ${string}` | `Token ${string}` | undefined> | Record<"Content-Type", CommonContentTypes | undefined> | Record<CommonRequestHeaders, string | undefined> | Record<string, string | undefined> | [string, string][], "infer-output"> | ((context: {
63
+ baseHeaders: Extract<HeadersOption, Record<string, unknown>>;
64
+ }) => InferSchemaResult<TSchema["headers"], Headers | Record<"Authorization", `Basic ${string}` | `Bearer ${string}` | `Token ${string}` | undefined> | Record<"Content-Type", CommonContentTypes | undefined> | Record<CommonRequestHeaders, string | undefined> | Record<string, string | undefined> | [string, string][], "infer-output">) | undefined;
65
+ }>) & (undefined extends InferSchemaResult<TSchema["method"], undefined, "infer-output"> ? {
66
+ method?: InferSchemaResult<TSchema["method"], string extends TInitURL ? AnyString | "CONNECT" | "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT" | "TRACE" : TInitURL extends `@${infer TMethod extends "delete" | "get" | "patch" | "post" | "put"}/${string}` ? Uppercase<TMethod> : AnyString | "CONNECT" | "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT" | "TRACE", "infer-output"> | undefined;
67
+ } : Required<{
68
+ method?: InferSchemaResult<TSchema["method"], string extends TInitURL ? AnyString | "CONNECT" | "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT" | "TRACE" : TInitURL extends `@${infer TMethod extends "delete" | "get" | "patch" | "post" | "put"}/${string}` ? Uppercase<TMethod> : AnyString | "CONNECT" | "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT" | "TRACE", "infer-output"> | undefined;
69
+ }>)>) => Promise<TComputedResult>;
70
+ declare const callApi: <TData = unknown, TErrorData = unknown, TResultMode extends ResultModeType = ResultModeType, TCallApiContext extends CallApiContext = {
71
+ InferredExtraOptions: unknown;
72
+ Data: DefaultDataType;
73
+ ErrorData: DefaultDataType;
74
+ ResultMode: ResultModeType;
75
+ Meta: GlobalMeta;
76
+ }, TThrowOnError extends ThrowOnErrorBoolean = boolean, TResponseType extends ResponseTypeType = ResponseTypeType, const TSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TInitURL extends ApplyStrictConfig<TSchemaConfig, ApplyURLBasedConfig<TSchemaConfig, AnyString | "@delete/" | "@get/" | "@patch/" | "@post/" | "@put/">> = ApplyStrictConfig<TSchemaConfig, ApplyURLBasedConfig<TSchemaConfig, AnyString | "@delete/" | "@get/" | "@patch/" | "@post/" | "@put/">>, TCurrentRouteSchemaKey extends GetCurrentRouteSchemaKey<TSchemaConfig, TInitURL> = GetCurrentRouteSchemaKey<TSchemaConfig, TInitURL>, const TSchema extends CallApiSchema = GetCurrentRouteSchema<{
77
+ [x: AnyString]: CallApiSchema | undefined;
78
+ "@default"?: CallApiSchema | undefined;
79
+ "@delete/"?: CallApiSchema | undefined;
80
+ "@get/"?: CallApiSchema | undefined;
81
+ "@patch/"?: CallApiSchema | undefined;
82
+ "@post/"?: CallApiSchema | undefined;
83
+ "@put/"?: CallApiSchema | undefined;
84
+ }, TCurrentRouteSchemaKey, CallApiSchema | undefined, {
85
+ [x: AnyString]: CallApiSchema | undefined;
86
+ "@default"?: CallApiSchema | undefined;
87
+ "@delete/"?: CallApiSchema | undefined;
88
+ "@get/"?: CallApiSchema | undefined;
89
+ "@patch/"?: CallApiSchema | undefined;
90
+ "@post/"?: CallApiSchema | undefined;
91
+ "@put/"?: CallApiSchema | undefined;
92
+ }[TCurrentRouteSchemaKey], NonNullable<Omit<CallApiSchema | undefined, keyof {
93
+ [x: AnyString]: CallApiSchema | undefined;
94
+ "@default"?: CallApiSchema | undefined;
95
+ "@delete/"?: CallApiSchema | undefined;
96
+ "@get/"?: CallApiSchema | undefined;
97
+ "@patch/"?: CallApiSchema | undefined;
98
+ "@post/"?: CallApiSchema | undefined;
99
+ "@put/"?: CallApiSchema | undefined;
100
+ }[TCurrentRouteSchemaKey]> & {
101
+ [x: AnyString]: CallApiSchema | undefined;
102
+ "@default"?: CallApiSchema | undefined;
103
+ "@delete/"?: CallApiSchema | undefined;
104
+ "@get/"?: CallApiSchema | undefined;
105
+ "@patch/"?: CallApiSchema | undefined;
106
+ "@post/"?: CallApiSchema | undefined;
107
+ "@put/"?: CallApiSchema | undefined;
108
+ }[TCurrentRouteSchemaKey]>>, TBody extends InferSchemaResult<TSchema["body"], SerializableObject | BodyInit | SerializableArray | null, "infer-output"> = InferSchemaResult<TSchema["body"], SerializableObject | BodyInit | SerializableArray | null, "infer-output">, const TPluginArray extends CallApiPlugin[] = DefaultPluginArray, TComputedData = InferSchemaResult<TSchema["data"], GetResponseType<TData, TResponseType, ResponseTypeMap<TData>>, "infer-output">, TComputedErrorData = InferSchemaResult<TSchema["errorData"], GetResponseType<TErrorData, TResponseType, ResponseTypeMap<TErrorData>>, "infer-output">, TComputedResult = InferCallApiResult<TComputedData, TComputedErrorData, TResultMode, TThrowOnError, {
109
+ all: CallApiResultSuccessVariant<TComputedData>;
110
+ fetchApi: Response;
111
+ onlyData: NoInferUnMasked<TComputedData>;
112
+ onlyResponse: Response;
113
+ withoutResponse: {
114
+ data: NoInferUnMasked<TComputedData>;
115
+ error: null;
116
+ };
117
+ }, {
118
+ all: TThrowOnError extends true ? CallApiResultSuccessVariant<TComputedData> : CallApiResultSuccessOrErrorVariant<TComputedData, TComputedErrorData>;
119
+ fetchApi: (TThrowOnError extends true ? CallApiResultSuccessVariant<TComputedData> : CallApiResultSuccessOrErrorVariant<TComputedData, TComputedErrorData>)["response"];
120
+ onlyData: (TThrowOnError extends true ? CallApiResultSuccessVariant<TComputedData> : CallApiResultSuccessOrErrorVariant<TComputedData, TComputedErrorData>)["data"];
121
+ onlyResponse: (TThrowOnError extends true ? CallApiResultSuccessVariant<TComputedData> : CallApiResultSuccessOrErrorVariant<TComputedData, TComputedErrorData>)["response"];
122
+ withoutResponse: DistributiveOmit<TThrowOnError extends true ? CallApiResultSuccessVariant<TComputedData> : CallApiResultSuccessOrErrorVariant<TComputedData, TComputedErrorData>, "response"> extends (infer T) ? { [Key in keyof T]: T[Key]; } : never;
123
+ }>>(...[initURL, initConfig]: CallApiParameters<TComputedData, TComputedErrorData, TResultMode, TCallApiContext, TThrowOnError, TResponseType, {
124
+ [x: AnyString]: CallApiSchema | undefined;
125
+ "@default"?: CallApiSchema | undefined;
126
+ "@delete/"?: CallApiSchema | undefined;
127
+ "@get/"?: CallApiSchema | undefined;
128
+ "@patch/"?: CallApiSchema | undefined;
129
+ "@post/"?: CallApiSchema | undefined;
130
+ "@put/"?: CallApiSchema | undefined;
131
+ }, TSchema, CallApiSchemaConfig, TSchemaConfig, TInitURL, TCurrentRouteSchemaKey, TBody, DefaultPluginArray, TPluginArray, CallApiConfig<TCallApiContext, TComputedData, TComputedErrorData, TResultMode, TThrowOnError, TResponseType, {
132
+ [x: AnyString]: CallApiSchema | undefined;
133
+ "@default"?: CallApiSchema | undefined;
134
+ "@delete/"?: CallApiSchema | undefined;
135
+ "@get/"?: CallApiSchema | undefined;
136
+ "@patch/"?: CallApiSchema | undefined;
137
+ "@post/"?: CallApiSchema | undefined;
138
+ "@put/"?: CallApiSchema | undefined;
139
+ }, TSchema, CallApiSchemaConfig, TSchemaConfig, TInitURL, TCurrentRouteSchemaKey, TBody, DefaultPluginArray, TPluginArray>, (undefined extends InferSchemaResult<TSchema["auth"], undefined, "infer-output"> ? {
140
+ auth?: InferSchemaResult<TSchema["auth"], AuthOption, "infer-output"> | undefined;
141
+ } : Required<{
142
+ auth?: InferSchemaResult<TSchema["auth"], AuthOption, "infer-output"> | undefined;
143
+ }>) & (undefined extends InferSchemaResult<TSchema["meta"], undefined, "infer-output"> ? {
144
+ meta?: InferSchemaResult<TSchema["meta"], TCallApiContext["Meta"], "infer-output"> | undefined;
145
+ } : Required<{
146
+ meta?: InferSchemaResult<TSchema["meta"], TCallApiContext["Meta"], "infer-output"> | undefined;
147
+ }>) & (undefined extends InferSchemaResult<TSchema["params"], undefined, "infer-output"> ? Record<string, string | number | boolean> | (string | number | boolean)[] extends InferParamsFromRoute<TCurrentRouteSchemaKey> ? {
148
+ params?: InferSchemaResult<TSchema["params"], InferParamsFromRoute<TCurrentRouteSchemaKey>, "infer-output"> | undefined;
149
+ } : TCurrentRouteSchemaKey extends Extract<AnyString, TCurrentRouteSchemaKey> | Extract<"@default", TCurrentRouteSchemaKey> | Extract<"@delete/", TCurrentRouteSchemaKey> | Extract<"@get/", TCurrentRouteSchemaKey> | Extract<"@patch/", TCurrentRouteSchemaKey> | Extract<"@post/", TCurrentRouteSchemaKey> | Extract<"@put/", TCurrentRouteSchemaKey> ? undefined extends InferSchemaResult<TSchema["params"], null, "infer-output"> ? {
150
+ params?: InferSchemaResult<TSchema["params"], InferParamsFromRoute<TCurrentRouteSchemaKey>, "infer-output"> | undefined;
151
+ } : Required<{
152
+ params?: InferSchemaResult<TSchema["params"], InferParamsFromRoute<TCurrentRouteSchemaKey>, "infer-output"> | undefined;
153
+ }> : {
154
+ params?: InferSchemaResult<TSchema["params"], InferParamsFromRoute<TCurrentRouteSchemaKey>, "infer-output"> | undefined;
155
+ } : Required<Record<string, string | number | boolean> | (string | number | boolean)[] extends InferParamsFromRoute<TCurrentRouteSchemaKey> ? {
156
+ params?: InferSchemaResult<TSchema["params"], InferParamsFromRoute<TCurrentRouteSchemaKey>, "infer-output"> | undefined;
157
+ } : TCurrentRouteSchemaKey extends Extract<AnyString, TCurrentRouteSchemaKey> | Extract<"@default", TCurrentRouteSchemaKey> | Extract<"@delete/", TCurrentRouteSchemaKey> | Extract<"@get/", TCurrentRouteSchemaKey> | Extract<"@patch/", TCurrentRouteSchemaKey> | Extract<"@post/", TCurrentRouteSchemaKey> | Extract<"@put/", TCurrentRouteSchemaKey> ? undefined extends InferSchemaResult<TSchema["params"], null, "infer-output"> ? {
158
+ params?: InferSchemaResult<TSchema["params"], InferParamsFromRoute<TCurrentRouteSchemaKey>, "infer-output"> | undefined;
159
+ } : Required<{
160
+ params?: InferSchemaResult<TSchema["params"], InferParamsFromRoute<TCurrentRouteSchemaKey>, "infer-output"> | undefined;
161
+ }> : {
162
+ params?: InferSchemaResult<TSchema["params"], InferParamsFromRoute<TCurrentRouteSchemaKey>, "infer-output"> | undefined;
163
+ }>) & (undefined extends InferSchemaResult<TSchema["query"], undefined, "infer-output"> ? {
164
+ query?: InferSchemaResult<TSchema["query"], URLSearchParams | Record<string, string | number | boolean>, "infer-output"> | undefined;
165
+ } : Required<{
166
+ query?: InferSchemaResult<TSchema["query"], URLSearchParams | Record<string, string | number | boolean>, "infer-output"> | undefined;
167
+ }>) & (undefined extends InferSchemaResult<TSchema["body"], undefined, "infer-output"> ? {
168
+ body?: TBody | undefined;
169
+ } : Required<{
170
+ body?: TBody | undefined;
171
+ }>) & (undefined extends InferSchemaResult<TSchema["headers"], undefined, "infer-output"> ? {
172
+ headers?: InferSchemaResult<TSchema["headers"], Headers | Record<"Authorization", `Basic ${string}` | `Bearer ${string}` | `Token ${string}` | undefined> | Record<"Content-Type", CommonContentTypes | undefined> | Record<CommonRequestHeaders, string | undefined> | Record<string, string | undefined> | [string, string][], "infer-output"> | ((context: {
173
+ baseHeaders: Extract<HeadersOption, Record<string, unknown>>;
174
+ }) => InferSchemaResult<TSchema["headers"], Headers | Record<"Authorization", `Basic ${string}` | `Bearer ${string}` | `Token ${string}` | undefined> | Record<"Content-Type", CommonContentTypes | undefined> | Record<CommonRequestHeaders, string | undefined> | Record<string, string | undefined> | [string, string][], "infer-output">) | undefined;
175
+ } : Required<{
176
+ headers?: InferSchemaResult<TSchema["headers"], Headers | Record<"Authorization", `Basic ${string}` | `Bearer ${string}` | `Token ${string}` | undefined> | Record<"Content-Type", CommonContentTypes | undefined> | Record<CommonRequestHeaders, string | undefined> | Record<string, string | undefined> | [string, string][], "infer-output"> | ((context: {
177
+ baseHeaders: Extract<HeadersOption, Record<string, unknown>>;
178
+ }) => InferSchemaResult<TSchema["headers"], Headers | Record<"Authorization", `Basic ${string}` | `Bearer ${string}` | `Token ${string}` | undefined> | Record<"Content-Type", CommonContentTypes | undefined> | Record<CommonRequestHeaders, string | undefined> | Record<string, string | undefined> | [string, string][], "infer-output">) | undefined;
179
+ }>) & (undefined extends InferSchemaResult<TSchema["method"], undefined, "infer-output"> ? {
180
+ method?: InferSchemaResult<TSchema["method"], string extends TInitURL ? AnyString | "CONNECT" | "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT" | "TRACE" : TInitURL extends `@${infer TMethod extends "delete" | "get" | "patch" | "post" | "put"}/${string}` ? Uppercase<TMethod> : AnyString | "CONNECT" | "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT" | "TRACE", "infer-output"> | undefined;
181
+ } : Required<{
182
+ method?: InferSchemaResult<TSchema["method"], string extends TInitURL ? AnyString | "CONNECT" | "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT" | "TRACE" : TInitURL extends `@${infer TMethod extends "delete" | "get" | "patch" | "post" | "put"}/${string}` ? Uppercase<TMethod> : AnyString | "CONNECT" | "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT" | "TRACE", "infer-output"> | undefined;
183
+ }>)>) => Promise<TComputedResult>;
184
+ //#endregion
185
+ export { createFetchClient as n, createFetchClientWithContext as r, callApi as t };
186
+ //# sourceMappingURL=index-DuBaw9km.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { A as CallApiExtraOptionsForHooks, At as BaseSchemaRouteKeyPrefixes, B as SuccessContext, D as InstanceContext, F as RequestContext, H as RetryOptions, I as RequestStreamContext, It as URLOptions, L as ResponseContext, M as ErrorContext, Mt as CallApiSchemaConfig, N as Hooks, Nt as InferSchemaInput, O as Register, P as HooksOrHooksArray, Pt as InferSchemaOutput, R as ResponseErrorContext, St as PossibleValidationError, T as GetCallApiContextRequired, Tt as ResultModeType, V as RefetchOptions, _ as CallApiExtraOptions, _t as CallApiResultSuccessVariant, a as GetCurrentRouteSchemaKey, at as DefaultCallApiContext, bt as PossibleHTTPError, c as InferInitURL, ct as CallApiPlugin, dt as PluginSetupContext, ft as FetchImpl, gt as CallApiResultSuccessOrErrorVariant, h as CallApiConfig, ht as CallApiResultErrorVariant, j as CallApiRequestOptionsForHooks, jt as CallApiSchema, k as DedupeOptions, kt as BaseCallApiSchemaRoutes, l as InferParamsFromRoute, lt as PluginHooks, m as BaseCallApiExtraOptions, mt as Middlewares, o as InferAllMainRouteKeys, p as BaseCallApiConfig, pt as FetchMiddlewareContext, s as InferAllMainRoutes, ut as PluginMiddlewares, v as CallApiParameters, w as GetCallApiContext, wt as ResponseTypeType, x as CallApiResultLoose, xt as PossibleJavaScriptError, y as CallApiRequestOptions, z as ResponseStreamContext } from "./conditional-types-BXgYQJ5q.js";
2
- import { n as createFetchClient, r as createFetchClientWithContext, t as callApi } from "./index-D-LyaiZE.js";
1
+ import { A as Register, B as ResponseErrorContext, C as CallApiResultLoose, Ct as PossibleJavaScriptError, D as GetCallApiContextRequired, Dt as ResultModeType, E as GetCallApiContext, Et as ResponseTypeType, F as Hooks, Ft as InferSchemaInput, H as SuccessContext, I as HooksOrHooksArray, It as InferSchemaOutput, L as RequestContext, M as CallApiExtraOptionsForHooks, Mt as BaseSchemaRouteKeyPrefixes, N as CallApiRequestOptionsForHooks, Nt as CallApiSchema, P as ErrorContext, Pt as CallApiSchemaConfig, R as RequestStreamContext, Rt as URLOptions, St as PossibleHTTPError, U as RefetchOptions, V as ResponseStreamContext, W as RetryOptions, _ as CallApiConfig, _t as CallApiResultErrorVariant, a as GetCurrentRouteSchemaKey, b as CallApiParameters, c as InferAllMainRoutes, dt as PluginHooks, ft as PluginMiddlewares, g as BaseCallApiExtraOptions, gt as Middlewares, h as BaseCallApiConfig, ht as FetchMiddlewareContext, j as DedupeOptions, jt as BaseCallApiSchemaRoutes, k as InstanceContext, l as InferInitURL, mt as FetchImpl, pt as PluginSetupContext, s as InferAllMainRouteKeys, st as DefaultCallApiContext, u as InferParamsFromRoute, ut as CallApiPlugin, vt as CallApiResultSuccessOrErrorVariant, wt as PossibleValidationError, x as CallApiRequestOptions, y as CallApiExtraOptions, yt as CallApiResultSuccessVariant, z as ResponseContext } from "./conditional-types-BFeM4YSg.js";
2
+ import { n as createFetchClient, r as createFetchClientWithContext, t as callApi } from "./index-DuBaw9km.js";
3
3
  export { type BaseCallApiConfig, type BaseCallApiExtraOptions, type BaseCallApiSchemaRoutes, type BaseSchemaRouteKeyPrefixes, type CallApiConfig, type CallApiExtraOptions, type CallApiExtraOptionsForHooks, type CallApiParameters, type CallApiPlugin, type CallApiRequestOptions, type CallApiRequestOptionsForHooks, type CallApiResultLoose as CallApiResult, type CallApiResultErrorVariant, type CallApiResultSuccessOrErrorVariant, type CallApiResultSuccessVariant, type CallApiSchema, type CallApiSchemaConfig, type DedupeOptions, type DefaultCallApiContext, type ErrorContext, type FetchImpl, type FetchMiddlewareContext, type GetCallApiContext, type GetCallApiContextRequired, type GetCurrentRouteSchemaKey, type Hooks, type HooksOrHooksArray, type InferAllMainRouteKeys, type InferAllMainRoutes, type InferInitURL, type InferParamsFromRoute, type InferSchemaInput, type InferSchemaOutput, type InstanceContext, type Middlewares, type PluginHooks, type PluginMiddlewares, type PluginSetupContext, type PossibleHTTPError, type PossibleJavaScriptError, type PossibleValidationError, type RefetchOptions, type Register, type RequestContext, type RequestStreamContext, type ResponseContext, type ResponseErrorContext, type ResponseStreamContext, type ResponseTypeType, type ResultModeType, type RetryOptions, type SuccessContext, type URLOptions, callApi, createFetchClient, createFetchClientWithContext };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as getCurrentRouteSchemaKeyAndMainInitURL, I as isArray, L as isFunction, M as handleSchemaValidation, N as HTTPError, R as isString, a as getBody, c as getMethod, d as splitConfig, f as waitFor, h as isHTTPErrorInstance, i as createTimeoutSignal, j as handleConfigValidation, k as getFullAndNormalizedURL, l as getResolvedHeaders, o as getFetchImpl, r as createCombinedSignal, s as getHeaders, t as extraOptionDefaults, u as omitKeys, v as isValidationErrorInstance } from "./constants-CQmUuQDT.js";
1
+ import { A as getCurrentRouteSchemaKeyAndMainInitURL, I as isArray, L as isFunction, M as handleSchemaValidation, N as HTTPError, R as isString, a as getBody, c as getMethod, d as splitConfig, f as waitFor, h as isHTTPErrorInstance, i as createTimeoutSignal, j as handleConfigValidation, k as getFullAndNormalizedURL, l as getResolvedHeaders, o as getFetchImpl, r as createCombinedSignal, s as getHeaders, t as extraOptionDefaults, u as omitKeys, v as isValidationErrorInstance } from "./constants-DB6Z7gFB.js";
2
2
  //#region src/result.ts
3
3
  const getResponseType = (response, responseParser) => ({
4
4
  arrayBuffer: () => response.arrayBuffer(),
@@ -10,7 +10,7 @@ const getResponseType = (response, responseParser) => ({
10
10
  stream: () => response.body,
11
11
  text: () => response.text()
12
12
  });
13
- const textTypes = new Set([
13
+ const textTypes = /* @__PURE__ */ new Set([
14
14
  "image/svg",
15
15
  "application/xml",
16
16
  "application/xhtml",
@@ -209,7 +209,7 @@ const createTrackedStream = (streamOptions) => {
209
209
  });
210
210
  },
211
211
  start: async () => {
212
- await reportProgress({ chunk: new Uint8Array() });
212
+ await reportProgress({ chunk: /* @__PURE__ */ new Uint8Array() });
213
213
  },
214
214
  transform: async (chunk, controller) => {
215
215
  controller.enqueue(chunk);
@@ -602,7 +602,7 @@ const $GlobalRequestInfoCache = /* @__PURE__ */ new Map();
602
602
  const createFetchClientWithContext = () => {
603
603
  const createFetchClient = (initBaseConfig = {}) => {
604
604
  const $LocalRequestInfoCache = /* @__PURE__ */ new Map();
605
- const callApi = async (initURL, initConfig = {}) => {
605
+ const callApi = async (...[initURL, initConfig = {}]) => {
606
606
  const [fetchOptions, extraOptions] = splitConfig(initConfig);
607
607
  const initURLString = initURL.toString();
608
608
  const baseConfig = isFunction(initBaseConfig) ? initBaseConfig({