New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

http-react

Package Overview
Dependencies
Maintainers
1
Versions
113
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http-react - npm Package Compare versions

Comparing version

to
2.4.7

214

index.d.ts

@@ -110,2 +110,3 @@ /**

};
suspense?: any[];
resolver?: (r: Response) => any;

@@ -298,30 +299,3 @@ children?: any;

*/
export declare function useFetcherConfig(id?: string): FetcherContextType | ({
/**
* Override base url
*/
baseUrl?: string | undefined;
/**
* Request method
*/
method?: "GET" | "DELETE" | "HEAD" | "OPTIONS" | "POST" | "PUT" | "PATCH" | "PURGE" | "LINK" | "UNLINK" | undefined;
headers?: object | Headers | undefined;
query?: any;
/**
* URL params
*/
params?: any;
body?: any;
/**
* Customize how body is formated for the request. By default it will be sent in JSON format
* but you can set it to false if for example, you are sending a `FormData`
* body, or to `b => JSON.stringify(b)` for example, if you want to send JSON data
* (the last one is the default behaviour so in that case you can ignore it)
*/
formatBody?: boolean | ((b: any) => any) | undefined;
} & {
baseUrl: string;
url: string;
rawUrl: string;
});
export declare function useFetcherConfig(id?: string): any;
/**

@@ -331,8 +305,10 @@ * Get the data state of a request using its id

export declare function useFetcherData<ResponseType = any, VT = any>(id: ResponseType extends {
variables: any;
} ? string | number | object : {
value: ResponseType;
variables: VT;
errors?: any[];
}, onResolve?: (data: typeof id extends {
} ? {
value: ResponseType;
variables: VT;
errors?: any[];
} : string | number | object, onResolve?: (data: typeof id extends {
variables: any;

@@ -348,9 +324,3 @@ } ? {

})['variables'];
} : ResponseType) => void): ResponseType extends {
variables: any;
} ? string | number | object : {
value: ResponseType;
variables: VT;
errors?: any[] | undefined;
};
} : ResponseType) => void): ResponseType;
export declare function useFetcherCode(id: any): number;

@@ -1288,68 +1258,2 @@ /**

unlink: RequestWithBody;
/**
* @deprecated Everything with `extend` can be achieved with `useFetch` alone
*
*
* Extend the useFetcher hook
*/
extend(props?: FetcherContextType): {
<T, BodyType_1 = any>(init: string | FetcherConfigType<T, BodyType_1>, options?: FetcherConfigTypeNoUrl<T, BodyType_1> | undefined): {
data: T;
loading: boolean;
error: Error | null;
online: boolean;
code: number;
reFetch: () => Promise<void>;
mutate: (update: T | ((prev: T) => T), callback?: ((data: T, fetcher: ImperativeFetcher) => void) | undefined) => T;
fetcher: ImperativeFetcher;
abort: () => void;
config: {
/**
* Override base url
*/
baseUrl?: string | undefined;
/**
* Request method
*/
method?: "GET" | "DELETE" | "HEAD" | "OPTIONS" | "POST" | "PUT" | "PATCH" | "PURGE" | "LINK" | "UNLINK" | undefined;
headers?: object | Headers | undefined;
query?: any;
/**
* URL params
*/
params?: any;
body?: BodyType_1 | undefined;
/**
* Customize how body is formated for the request. By default it will be sent in JSON format
* but you can set it to false if for example, you are sending a `FormData`
* body, or to `b => JSON.stringify(b)` for example, if you want to send JSON data
* (the last one is the default behaviour so in that case you can ignore it)
*/
formatBody?: boolean | ((b: BodyType_1) => any) | undefined;
} & {
baseUrl: string;
url: string;
rawUrl: string;
};
response: CustomResponse<T>;
id: any;
key: string;
};
config: {
baseUrl: any;
headers: any;
query: any;
};
get: RequestWithBody;
delete: RequestWithBody;
head: RequestWithBody;
options: RequestWithBody;
post: RequestWithBody;
put: RequestWithBody;
patch: RequestWithBody;
purge: RequestWithBody;
link: RequestWithBody;
unlink: RequestWithBody;
Config: typeof FetcherConfig;
};
};

@@ -1410,105 +1314,3 @@ export { useFetcher };

unlink: RequestWithBody;
/**
* @deprecated Everything with `extend` can be achieved with `useFetch` alone
*
*
* Extend the useFetcher hook
*/
extend(props?: FetcherContextType): {
<T, BodyType_1 = any>(init: string | FetcherConfigType<T, BodyType_1>, options?: FetcherConfigTypeNoUrl<T, BodyType_1> | undefined): {
data: T;
loading: boolean;
error: Error | null;
online: boolean;
code: number;
reFetch: () => Promise<void>;
mutate: (update: T | ((prev: T) => T), callback?: ((data: T, fetcher: ImperativeFetcher) => void) | undefined) => T;
fetcher: ImperativeFetcher;
abort: () => void;
config: {
/**
* Override base url
*/
baseUrl?: string | undefined;
/**
* Request method
*/
method?: "GET" | "DELETE" | "HEAD" | "OPTIONS" | "POST" | "PUT" | "PATCH" | "PURGE" | "LINK" | "UNLINK" | undefined;
headers?: object | Headers | undefined;
query?: any;
/**
* URL params
*/
params?: any;
body?: BodyType_1 | undefined;
/**
* Customize how body is formated for the request. By default it will be sent in JSON format
* but you can set it to false if for example, you are sending a `FormData`
* body, or to `b => JSON.stringify(b)` for example, if you want to send JSON data
* (the last one is the default behaviour so in that case you can ignore it)
*/
formatBody?: boolean | ((b: BodyType_1) => any) | undefined;
} & {
baseUrl: string;
url: string;
rawUrl: string;
};
response: CustomResponse<T>;
id: any;
key: string;
};
config: {
baseUrl: any;
headers: any;
query: any;
};
get: RequestWithBody;
delete: RequestWithBody;
head: RequestWithBody;
options: RequestWithBody;
post: RequestWithBody;
put: RequestWithBody;
patch: RequestWithBody;
purge: RequestWithBody;
link: RequestWithBody;
unlink: RequestWithBody;
Config: typeof FetcherConfig;
};
};
interface IRequestParam {
headers?: any;
body?: any;
/**
* Customize how body is formated for the request. By default it will be sent in JSON format
* but you can set it to false if for example, you are sending a `FormData`
* body, or to `b => JSON.stringify(b)` for example, if you want to send JSON data
* (the last one is the default behaviour so in that case you can ignore it)
*/
formatBody?: boolean | ((b: any) => any);
}
export declare const isFormData: (target: any) => boolean;
declare type requestType = <T>(path: string, data: IRequestParam) => Promise<T>;
interface IHttpClient {
baseUrl: string;
get: requestType;
post: requestType;
put: requestType;
delete: requestType;
}
/**
* Basic HttpClient
*/
declare class HttpClient implements IHttpClient {
baseUrl: string;
get<T>(path: string, { headers, body }?: IRequestParam, method?: string): Promise<T>;
post<T>(path: string, props?: IRequestParam): Promise<T>;
put<T>(path: string, props?: IRequestParam): Promise<T>;
delete<T>(path: string, props?: IRequestParam): Promise<T>;
constructor(url: string);
}
/**
* @deprecated - Use the fetcher instead
*
* Basic HttpClient
*/
export declare function createHttpClient(url: string): HttpClient;

2

package.json
{
"name": "http-react",
"version": "2.4.6",
"version": "2.4.7",
"description": "React hooks for data fetching",

@@ -5,0 +5,0 @@ "main": "index.js",

Sorry, the diff of this file is too big to display