@hey-api/client-fetch
Advanced tools
Comparing version 0.7.2 to 0.7.3
type AuthToken = string | undefined; | ||
interface Auth { | ||
/** | ||
* Which part of the request do we use to send the auth? | ||
* | ||
* @default 'header' | ||
*/ | ||
in?: 'header' | 'query'; | ||
/** | ||
* Header or query parameter name. | ||
* | ||
* @default 'Authorization' | ||
*/ | ||
name?: string; | ||
@@ -156,8 +166,2 @@ scheme?: 'basic' | 'bearer'; | ||
body?: RequestInit['body'] | Record<string, unknown> | Array<Record<string, unknown>> | Array<unknown> | number; | ||
/** | ||
* You can provide a client instance returned by `createClient()` instead of | ||
* individual options. This might be also useful if you want to implement a | ||
* custom client. | ||
*/ | ||
client?: Client; | ||
path?: Record<string, unknown>; | ||
@@ -205,3 +209,3 @@ query?: Record<string, unknown>; | ||
type CreateClientConfig = (override?: Config) => Config; | ||
interface DataShape { | ||
interface TDataShape { | ||
body?: unknown; | ||
@@ -214,3 +218,3 @@ headers?: unknown; | ||
type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>; | ||
type Options<TData extends DataShape = DataShape, ThrowOnError extends boolean = boolean> = OmitKeys<RequestOptions<ThrowOnError>, 'body' | 'path' | 'query' | 'url'> & Omit<TData, 'url'>; | ||
type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = OmitKeys<RequestOptions<ThrowOnError>, 'body' | 'path' | 'query' | 'url'> & Omit<TData, 'url'>; | ||
type OptionsLegacyParser<TData = unknown, ThrowOnError extends boolean = boolean> = TData extends { | ||
@@ -226,2 +230,2 @@ body?: any; | ||
export { type Auth, type Client, type Config, type CreateClientConfig, type Options, type OptionsLegacyParser, type QuerySerializerOptions, type RequestOptions, type RequestResult, createClient, createConfig, formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer }; | ||
export { type Auth, type Client, type Config, type CreateClientConfig, type Options, type OptionsLegacyParser, type QuerySerializerOptions, type RequestOptions, type RequestResult, type TDataShape, createClient, createConfig, formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer }; |
@@ -1,2 +0,2 @@ | ||
var A=async(t,r)=>{let e=typeof r=="function"?await r(t):r;if(e)return t.scheme==="bearer"?`Bearer ${e}`:t.scheme==="basic"?`Basic ${btoa(e)}`:e},j=(t,r,e)=>{typeof e=="string"||e instanceof Blob?t.append(r,e):t.append(r,JSON.stringify(e));},z=(t,r,e)=>{typeof e=="string"?t.append(r,e):t.append(r,JSON.stringify(e));},U={bodySerializer:t=>{let r=new FormData;return Object.entries(t).forEach(([e,i])=>{i!=null&&(Array.isArray(i)?i.forEach(a=>j(r,e,a)):j(r,e,i));}),r}},b={bodySerializer:t=>JSON.stringify(t)},k={bodySerializer:t=>{let r=new URLSearchParams;return Object.entries(t).forEach(([e,i])=>{i!=null&&(Array.isArray(i)?i.forEach(a=>z(r,e,a)):z(r,e,i));}),r}},T=t=>{switch(t){case "label":return ".";case "matrix":return ";";case "simple":return ",";default:return "&"}},_=t=>{switch(t){case "form":return ",";case "pipeDelimited":return "|";case "spaceDelimited":return "%20";default:return ","}},D=t=>{switch(t){case "label":return ".";case "matrix":return ";";case "simple":return ",";default:return "&"}},q=({allowReserved:t,explode:r,name:e,style:i,value:a})=>{if(!r){let s=(t?a:a.map(l=>encodeURIComponent(l))).join(_(i));switch(i){case "label":return `.${s}`;case "matrix":return `;${e}=${s}`;case "simple":return s;default:return `${e}=${s}`}}let o=T(i),n=a.map(s=>i==="label"||i==="simple"?t?s:encodeURIComponent(s):y({allowReserved:t,name:e,value:s})).join(o);return i==="label"||i==="matrix"?o+n:n},y=({allowReserved:t,name:r,value:e})=>{if(e==null)return "";if(typeof e=="object")throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return `${r}=${t?e:encodeURIComponent(e)}`},O=({allowReserved:t,explode:r,name:e,style:i,value:a})=>{if(a instanceof Date)return `${e}=${a.toISOString()}`;if(i!=="deepObject"&&!r){let s=[];Object.entries(a).forEach(([f,u])=>{s=[...s,f,t?u:encodeURIComponent(u)];});let l=s.join(",");switch(i){case "form":return `${e}=${l}`;case "label":return `.${l}`;case "matrix":return `;${e}=${l}`;default:return l}}let o=D(i),n=Object.entries(a).map(([s,l])=>y({allowReserved:t,name:i==="deepObject"?`${e}[${s}]`:s,value:l})).join(o);return i==="label"||i==="matrix"?o+n:n};var H=/\{[^{}]+\}/g,B=({path:t,url:r})=>{let e=r,i=r.match(H);if(i)for(let a of i){let o=false,n=a.substring(1,a.length-1),s="simple";n.endsWith("*")&&(o=true,n=n.substring(0,n.length-1)),n.startsWith(".")?(n=n.substring(1),s="label"):n.startsWith(";")&&(n=n.substring(1),s="matrix");let l=t[n];if(l==null)continue;if(Array.isArray(l)){e=e.replace(a,q({explode:o,name:n,style:s,value:l}));continue}if(typeof l=="object"){e=e.replace(a,O({explode:o,name:n,style:s,value:l}));continue}if(s==="matrix"){e=e.replace(a,`;${y({name:n,value:l})}`);continue}let f=encodeURIComponent(s==="label"?`.${l}`:l);e=e.replace(a,f);}return e},E=({allowReserved:t,array:r,object:e}={})=>a=>{let o=[];if(a&&typeof a=="object")for(let n in a){let s=a[n];if(s!=null){if(Array.isArray(s)){o=[...o,q({allowReserved:t,explode:true,name:n,style:"form",value:s,...r})];continue}if(typeof s=="object"){o=[...o,O({allowReserved:t,explode:true,name:n,style:"deepObject",value:s,...e})];continue}o=[...o,y({allowReserved:t,name:n,value:s})];}}return o.join("&")},P=t=>{if(!t)return "stream";let r=t.split(";")[0]?.trim();if(r){if(r.startsWith("application/json")||r.endsWith("+json"))return "json";if(r==="multipart/form-data")return "formData";if(["application/","audio/","image/","video/"].some(e=>r.startsWith(e)))return "blob";if(r.startsWith("text/"))return "text"}},I=async({security:t,...r})=>{for(let e of t){let i=await A(e,r.auth);if(!i)continue;let a=e.name??"Authorization";switch(e.in){case "query":r.query||(r.query={}),r.query[a]=i;break;case "header":default:r.headers.set(a,i);break}return}},S=t=>W({baseUrl:t.baseUrl??"",path:t.path,query:t.query,querySerializer:typeof t.querySerializer=="function"?t.querySerializer:E(t.querySerializer),url:t.url}),W=({baseUrl:t,path:r,query:e,querySerializer:i,url:a})=>{let o=a.startsWith("/")?a:`/${a}`,n=t+o;r&&(n=B({path:r,url:n}));let s=e?i(e):"";return s.startsWith("?")&&(s=s.substring(1)),s&&(n+=`?${s}`),n},C=(t,r)=>{let e={...t,...r};return e.baseUrl?.endsWith("/")&&(e.baseUrl=e.baseUrl.substring(0,e.baseUrl.length-1)),e.headers=x(t.headers,r.headers),e},x=(...t)=>{let r=new Headers;for(let e of t){if(!e||typeof e!="object")continue;let i=e instanceof Headers?e.entries():Object.entries(e);for(let[a,o]of i)if(o===null)r.delete(a);else if(Array.isArray(o))for(let n of o)r.append(a,n);else o!==undefined&&r.set(a,typeof o=="object"?JSON.stringify(o):o);}return r},h=class{_fns;constructor(){this._fns=[];}clear(){this._fns=[];}exists(r){return this._fns.indexOf(r)!==-1}eject(r){let e=this._fns.indexOf(r);e!==-1&&(this._fns=[...this._fns.slice(0,e),...this._fns.slice(e+1)]);}use(r){this._fns=[...this._fns,r];}},v=()=>({error:new h,request:new h,response:new h}),N=E({allowReserved:false,array:{explode:true,style:"form"},object:{explode:true,style:"deepObject"}}),Q={"Content-Type":"application/json"},w=(t={})=>({...b,baseUrl:"",headers:Q,parseAs:"auto",querySerializer:N,...t});var F=(t={})=>{let r=C(w(),t),e=()=>({...r}),i=n=>(r=C(r,n),e()),a=v(),o=async n=>{let s={...r,...n,fetch:n.fetch??r.fetch??globalThis.fetch,headers:x(r.headers,n.headers)};s.security&&await I({...s,security:s.security}),s.body&&s.bodySerializer&&(s.body=s.bodySerializer(s.body)),s.body||s.headers.delete("Content-Type");let l=S(s),f={redirect:"follow",...s},u=new Request(l,f);for(let p of a.request._fns)u=await p(u,s);let $=s.fetch,c=await $(u);for(let p of a.response._fns)c=await p(c,u,s);let m={request:u,response:c};if(c.ok){if(c.status===204||c.headers.get("Content-Length")==="0")return {data:{},...m};let p=(s.parseAs==="auto"?P(c.headers.get("Content-Type")):s.parseAs)??"json";if(p==="stream")return {data:c.body,...m};let R=await c[p]();return p==="json"&&(s.responseValidator&&await s.responseValidator(R),s.responseTransformer&&(R=await s.responseTransformer(R))),{data:R,...m}}let g=await c.text();try{g=JSON.parse(g);}catch{}let d=g;for(let p of a.error._fns)d=await p(g,c,u,s);if(d=d||{},s.throwOnError)throw d;return {error:d,...m}};return {buildUrl:S,connect:n=>o({...n,method:"CONNECT"}),delete:n=>o({...n,method:"DELETE"}),get:n=>o({...n,method:"GET"}),getConfig:e,head:n=>o({...n,method:"HEAD"}),interceptors:a,options:n=>o({...n,method:"OPTIONS"}),patch:n=>o({...n,method:"PATCH"}),post:n=>o({...n,method:"POST"}),put:n=>o({...n,method:"PUT"}),request:o,setConfig:i,trace:n=>o({...n,method:"TRACE"})}};export{F as createClient,w as createConfig,U as formDataBodySerializer,b as jsonBodySerializer,k as urlSearchParamsBodySerializer};//# sourceMappingURL=index.js.map | ||
var A=async(t,r)=>{let e=typeof r=="function"?await r(t):r;if(e)return t.scheme==="bearer"?`Bearer ${e}`:t.scheme==="basic"?`Basic ${btoa(e)}`:e},z=(t,r,e)=>{typeof e=="string"||e instanceof Blob?t.append(r,e):t.append(r,JSON.stringify(e));},j=(t,r,e)=>{typeof e=="string"?t.append(r,e):t.append(r,JSON.stringify(e));},T={bodySerializer:t=>{let r=new FormData;return Object.entries(t).forEach(([e,i])=>{i!=null&&(Array.isArray(i)?i.forEach(a=>z(r,e,a)):z(r,e,i));}),r}},R={bodySerializer:t=>JSON.stringify(t,(r,e)=>typeof e=="bigint"?e.toString():e)},U={bodySerializer:t=>{let r=new URLSearchParams;return Object.entries(t).forEach(([e,i])=>{i!=null&&(Array.isArray(i)?i.forEach(a=>j(r,e,a)):j(r,e,i));}),r}},k=t=>{switch(t){case "label":return ".";case "matrix":return ";";case "simple":return ",";default:return "&"}},_=t=>{switch(t){case "form":return ",";case "pipeDelimited":return "|";case "spaceDelimited":return "%20";default:return ","}},D=t=>{switch(t){case "label":return ".";case "matrix":return ";";case "simple":return ",";default:return "&"}},q=({allowReserved:t,explode:r,name:e,style:i,value:a})=>{if(!r){let s=(t?a:a.map(l=>encodeURIComponent(l))).join(_(i));switch(i){case "label":return `.${s}`;case "matrix":return `;${e}=${s}`;case "simple":return s;default:return `${e}=${s}`}}let o=k(i),n=a.map(s=>i==="label"||i==="simple"?t?s:encodeURIComponent(s):y({allowReserved:t,name:e,value:s})).join(o);return i==="label"||i==="matrix"?o+n:n},y=({allowReserved:t,name:r,value:e})=>{if(e==null)return "";if(typeof e=="object")throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return `${r}=${t?e:encodeURIComponent(e)}`},S=({allowReserved:t,explode:r,name:e,style:i,value:a})=>{if(a instanceof Date)return `${e}=${a.toISOString()}`;if(i!=="deepObject"&&!r){let s=[];Object.entries(a).forEach(([f,u])=>{s=[...s,f,t?u:encodeURIComponent(u)];});let l=s.join(",");switch(i){case "form":return `${e}=${l}`;case "label":return `.${l}`;case "matrix":return `;${e}=${l}`;default:return l}}let o=D(i),n=Object.entries(a).map(([s,l])=>y({allowReserved:t,name:i==="deepObject"?`${e}[${s}]`:s,value:l})).join(o);return i==="label"||i==="matrix"?o+n:n};var H=/\{[^{}]+\}/g,B=({path:t,url:r})=>{let e=r,i=r.match(H);if(i)for(let a of i){let o=false,n=a.substring(1,a.length-1),s="simple";n.endsWith("*")&&(o=true,n=n.substring(0,n.length-1)),n.startsWith(".")?(n=n.substring(1),s="label"):n.startsWith(";")&&(n=n.substring(1),s="matrix");let l=t[n];if(l==null)continue;if(Array.isArray(l)){e=e.replace(a,q({explode:o,name:n,style:s,value:l}));continue}if(typeof l=="object"){e=e.replace(a,S({explode:o,name:n,style:s,value:l}));continue}if(s==="matrix"){e=e.replace(a,`;${y({name:n,value:l})}`);continue}let f=encodeURIComponent(s==="label"?`.${l}`:l);e=e.replace(a,f);}return e},E=({allowReserved:t,array:r,object:e}={})=>a=>{let o=[];if(a&&typeof a=="object")for(let n in a){let s=a[n];if(s!=null){if(Array.isArray(s)){o=[...o,q({allowReserved:t,explode:true,name:n,style:"form",value:s,...r})];continue}if(typeof s=="object"){o=[...o,S({allowReserved:t,explode:true,name:n,style:"deepObject",value:s,...e})];continue}o=[...o,y({allowReserved:t,name:n,value:s})];}}return o.join("&")},P=t=>{if(!t)return "stream";let r=t.split(";")[0]?.trim();if(r){if(r.startsWith("application/json")||r.endsWith("+json"))return "json";if(r==="multipart/form-data")return "formData";if(["application/","audio/","image/","video/"].some(e=>r.startsWith(e)))return "blob";if(r.startsWith("text/"))return "text"}},I=async({security:t,...r})=>{for(let e of t){let i=await A(e,r.auth);if(!i)continue;let a=e.name??"Authorization";switch(e.in){case "query":r.query||(r.query={}),r.query[a]=i;break;case "header":default:r.headers.set(a,i);break}return}},O=t=>W({baseUrl:t.baseUrl??"",path:t.path,query:t.query,querySerializer:typeof t.querySerializer=="function"?t.querySerializer:E(t.querySerializer),url:t.url}),W=({baseUrl:t,path:r,query:e,querySerializer:i,url:a})=>{let o=a.startsWith("/")?a:`/${a}`,n=t+o;r&&(n=B({path:r,url:n}));let s=e?i(e):"";return s.startsWith("?")&&(s=s.substring(1)),s&&(n+=`?${s}`),n},C=(t,r)=>{let e={...t,...r};return e.baseUrl?.endsWith("/")&&(e.baseUrl=e.baseUrl.substring(0,e.baseUrl.length-1)),e.headers=x(t.headers,r.headers),e},x=(...t)=>{let r=new Headers;for(let e of t){if(!e||typeof e!="object")continue;let i=e instanceof Headers?e.entries():Object.entries(e);for(let[a,o]of i)if(o===null)r.delete(a);else if(Array.isArray(o))for(let n of o)r.append(a,n);else o!==undefined&&r.set(a,typeof o=="object"?JSON.stringify(o):o);}return r},h=class{_fns;constructor(){this._fns=[];}clear(){this._fns=[];}exists(r){return this._fns.indexOf(r)!==-1}eject(r){let e=this._fns.indexOf(r);e!==-1&&(this._fns=[...this._fns.slice(0,e),...this._fns.slice(e+1)]);}use(r){this._fns=[...this._fns,r];}},v=()=>({error:new h,request:new h,response:new h}),N=E({allowReserved:false,array:{explode:true,style:"form"},object:{explode:true,style:"deepObject"}}),Q={"Content-Type":"application/json"},w=(t={})=>({...R,baseUrl:"",headers:Q,parseAs:"auto",querySerializer:N,...t});var J=(t={})=>{let r=C(w(),t),e=()=>({...r}),i=n=>(r=C(r,n),e()),a=v(),o=async n=>{let s={...r,...n,fetch:n.fetch??r.fetch??globalThis.fetch,headers:x(r.headers,n.headers)};s.security&&await I({...s,security:s.security}),s.body&&s.bodySerializer&&(s.body=s.bodySerializer(s.body)),s.body||s.headers.delete("Content-Type");let l=O(s),f={redirect:"follow",...s},u=new Request(l,f);for(let p of a.request._fns)u=await p(u,s);let $=s.fetch,c=await $(u);for(let p of a.response._fns)c=await p(c,u,s);let m={request:u,response:c};if(c.ok){if(c.status===204||c.headers.get("Content-Length")==="0")return {data:{},...m};let p=(s.parseAs==="auto"?P(c.headers.get("Content-Type")):s.parseAs)??"json";if(p==="stream")return {data:c.body,...m};let b=await c[p]();return p==="json"&&(s.responseValidator&&await s.responseValidator(b),s.responseTransformer&&(b=await s.responseTransformer(b))),{data:b,...m}}let g=await c.text();try{g=JSON.parse(g);}catch{}let d=g;for(let p of a.error._fns)d=await p(g,c,u,s);if(d=d||{},s.throwOnError)throw d;return {error:d,...m}};return {buildUrl:O,connect:n=>o({...n,method:"CONNECT"}),delete:n=>o({...n,method:"DELETE"}),get:n=>o({...n,method:"GET"}),getConfig:e,head:n=>o({...n,method:"HEAD"}),interceptors:a,options:n=>o({...n,method:"OPTIONS"}),patch:n=>o({...n,method:"PATCH"}),post:n=>o({...n,method:"POST"}),put:n=>o({...n,method:"PUT"}),request:o,setConfig:i,trace:n=>o({...n,method:"TRACE"})}};export{J as createClient,w as createConfig,T as formDataBodySerializer,R as jsonBodySerializer,U as urlSearchParamsBodySerializer};//# sourceMappingURL=index.js.map | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@hey-api/client-fetch", | ||
"version": "0.7.2", | ||
"version": "0.7.3", | ||
"description": "🚀 Fetch API client for `@hey-api/openapi-ts` codegen.", | ||
@@ -22,2 +22,3 @@ "homepage": "https://heyapi.dev/", | ||
"client", | ||
"codegen", | ||
"fetch", | ||
@@ -24,0 +25,0 @@ "http", |
170
src/index.ts
@@ -1,169 +0,2 @@ | ||
import type { Client, Config, RequestOptions } from './types'; | ||
import { | ||
buildUrl, | ||
createConfig, | ||
createInterceptors, | ||
getParseAs, | ||
mergeConfigs, | ||
mergeHeaders, | ||
setAuthParams, | ||
} from './utils'; | ||
type ReqInit = Omit<RequestInit, 'body' | 'headers'> & { | ||
body?: any; | ||
headers: ReturnType<typeof mergeHeaders>; | ||
}; | ||
export const createClient = (config: Config = {}): Client => { | ||
let _config = mergeConfigs(createConfig(), config); | ||
const getConfig = (): Config => ({ ..._config }); | ||
const setConfig = (config: Config): Config => { | ||
_config = mergeConfigs(_config, config); | ||
return getConfig(); | ||
}; | ||
const interceptors = createInterceptors< | ||
Request, | ||
Response, | ||
unknown, | ||
RequestOptions | ||
>(); | ||
// @ts-expect-error | ||
const request: Client['request'] = async (options) => { | ||
const opts = { | ||
..._config, | ||
...options, | ||
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch, | ||
headers: mergeHeaders(_config.headers, options.headers), | ||
}; | ||
if (opts.security) { | ||
await setAuthParams({ | ||
...opts, | ||
security: opts.security, | ||
}); | ||
} | ||
if (opts.body && opts.bodySerializer) { | ||
opts.body = opts.bodySerializer(opts.body); | ||
} | ||
// remove Content-Type header if body is empty to avoid sending invalid requests | ||
if (!opts.body) { | ||
opts.headers.delete('Content-Type'); | ||
} | ||
const url = buildUrl(opts); | ||
const requestInit: ReqInit = { | ||
redirect: 'follow', | ||
...opts, | ||
}; | ||
let request = new Request(url, requestInit); | ||
for (const fn of interceptors.request._fns) { | ||
request = await fn(request, opts); | ||
} | ||
// fetch must be assigned here, otherwise it would throw the error: | ||
// TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation | ||
const _fetch = opts.fetch!; | ||
let response = await _fetch(request); | ||
for (const fn of interceptors.response._fns) { | ||
response = await fn(response, request, opts); | ||
} | ||
const result = { | ||
request, | ||
response, | ||
}; | ||
if (response.ok) { | ||
if ( | ||
response.status === 204 || | ||
response.headers.get('Content-Length') === '0' | ||
) { | ||
return { | ||
data: {}, | ||
...result, | ||
}; | ||
} | ||
const parseAs = | ||
(opts.parseAs === 'auto' | ||
? getParseAs(response.headers.get('Content-Type')) | ||
: opts.parseAs) ?? 'json'; | ||
if (parseAs === 'stream') { | ||
return { | ||
data: response.body, | ||
...result, | ||
}; | ||
} | ||
let data = await response[parseAs](); | ||
if (parseAs === 'json') { | ||
if (opts.responseValidator) { | ||
await opts.responseValidator(data); | ||
} | ||
if (opts.responseTransformer) { | ||
data = await opts.responseTransformer(data); | ||
} | ||
} | ||
return { | ||
data, | ||
...result, | ||
}; | ||
} | ||
let error = await response.text(); | ||
try { | ||
error = JSON.parse(error); | ||
} catch { | ||
// noop | ||
} | ||
let finalError = error; | ||
for (const fn of interceptors.error._fns) { | ||
finalError = (await fn(error, response, request, opts)) as string; | ||
} | ||
finalError = finalError || ({} as string); | ||
if (opts.throwOnError) { | ||
throw finalError; | ||
} | ||
return { | ||
error: finalError, | ||
...result, | ||
}; | ||
}; | ||
return { | ||
buildUrl, | ||
connect: (options) => request({ ...options, method: 'CONNECT' }), | ||
delete: (options) => request({ ...options, method: 'DELETE' }), | ||
get: (options) => request({ ...options, method: 'GET' }), | ||
getConfig, | ||
head: (options) => request({ ...options, method: 'HEAD' }), | ||
interceptors, | ||
options: (options) => request({ ...options, method: 'OPTIONS' }), | ||
patch: (options) => request({ ...options, method: 'PATCH' }), | ||
post: (options) => request({ ...options, method: 'POST' }), | ||
put: (options) => request({ ...options, method: 'PUT' }), | ||
request, | ||
setConfig, | ||
trace: (options) => request({ ...options, method: 'TRACE' }), | ||
}; | ||
}; | ||
export { createClient } from './client'; | ||
export type { | ||
@@ -177,2 +10,3 @@ Client, | ||
RequestResult, | ||
TDataShape, | ||
} from './types'; | ||
@@ -179,0 +13,0 @@ export { createConfig } from './utils'; |
@@ -57,8 +57,2 @@ import type { | ||
| number; | ||
/** | ||
* You can provide a client instance returned by `createClient()` instead of | ||
* individual options. This might be also useful if you want to implement a | ||
* custom client. | ||
*/ | ||
client?: Client; | ||
path?: Record<string, unknown>; | ||
@@ -135,3 +129,3 @@ query?: Record<string, unknown>; | ||
interface DataShape { | ||
export interface TDataShape { | ||
body?: unknown; | ||
@@ -147,3 +141,3 @@ headers?: unknown; | ||
export type Options< | ||
TData extends DataShape = DataShape, | ||
TData extends TDataShape = TDataShape, | ||
ThrowOnError extends boolean = boolean, | ||
@@ -150,0 +144,0 @@ > = OmitKeys<RequestOptions<ThrowOnError>, 'body' | 'path' | 'query' | 'url'> & |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
132748
15