Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rjgf/http-client

Package Overview
Dependencies
Maintainers
7
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rjgf/http-client - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

79

dist/index.d.ts
import { AxiosRequestConfig } from 'axios';
export interface Dispatchable {
dispatch(event: string): void | Promise<void>
dispatch(event: string): void | Promise<void>;
}
export interface ApiResult<T = unknown> {
msg: string
code: number
data: T
msg: string;
code: number;
data: T;
}
export interface Listify<T = any> {
list: T[]
page: number
pageSize: number
totalCount: number
list: T[];
page: number;
pageSize: number;
totalCount: number;
}

@@ -29,31 +28,31 @@ export declare class HTTPClient {

get defaults(): {
url?: string | undefined
method?: "link" | "head" | "get" | "GET" | "delete" | "DELETE" | "HEAD" | "options" | "OPTIONS" | "post" | "POST" | "put" | "PUT" | "patch" | "PATCH" | "purge" | "PURGE" | "LINK" | "unlink" | "UNLINK" | undefined
baseURL?: string | undefined
transformRequest?: import("axios").AxiosTransformer | import("axios").AxiosTransformer[] | undefined
transformResponse?: import("axios").AxiosTransformer | import("axios").AxiosTransformer[] | undefined
headers?: any
params?: any
paramsSerializer?: ((params: any) => string) | undefined
data?: any
timeout?: number | undefined
timeoutErrorMessage?: string | undefined
withCredentials?: boolean | undefined
adapter?: import("axios").AxiosAdapter | undefined
auth?: import("axios").AxiosBasicCredentials | undefined
responseType?: "text" | "document" | "arraybuffer" | "blob" | "json" | "stream" | undefined
xsrfCookieName?: string | undefined
xsrfHeaderName?: string | undefined
onUploadProgress?: ((progressEvent: any) => void) | undefined
onDownloadProgress?: ((progressEvent: any) => void) | undefined
maxContentLength?: number | undefined
validateStatus?: ((status: number) => boolean) | null | undefined
maxBodyLength?: number | undefined
maxRedirects?: number | undefined
socketPath?: string | null | undefined
httpAgent?: any
httpsAgent?: any
proxy?: false | import("axios").AxiosProxyConfig | undefined
cancelToken?: import("axios").CancelToken | undefined
decompress?: boolean | undefined
url?: string | undefined;
method?: "link" | "head" | "get" | "GET" | "delete" | "DELETE" | "HEAD" | "options" | "OPTIONS" | "post" | "POST" | "put" | "PUT" | "patch" | "PATCH" | "purge" | "PURGE" | "LINK" | "unlink" | "UNLINK" | undefined;
baseURL?: string | undefined;
transformRequest?: import("axios").AxiosTransformer | import("axios").AxiosTransformer[] | undefined;
transformResponse?: import("axios").AxiosTransformer | import("axios").AxiosTransformer[] | undefined;
headers?: any;
params?: any;
paramsSerializer?: ((params: any) => string) | undefined;
data?: any;
timeout?: number | undefined;
timeoutErrorMessage?: string | undefined;
withCredentials?: boolean | undefined;
adapter?: import("axios").AxiosAdapter | undefined;
auth?: import("axios").AxiosBasicCredentials | undefined;
responseType?: "text" | "document" | "arraybuffer" | "blob" | "json" | "stream" | undefined;
xsrfCookieName?: string | undefined;
xsrfHeaderName?: string | undefined;
onUploadProgress?: ((progressEvent: any) => void) | undefined;
onDownloadProgress?: ((progressEvent: any) => void) | undefined;
maxContentLength?: number | undefined;
validateStatus?: ((status: number) => boolean) | null | undefined;
maxBodyLength?: number | undefined;
maxRedirects?: number | undefined;
socketPath?: string | null | undefined;
httpAgent?: any;
httpsAgent?: any;
proxy?: false | import("axios").AxiosProxyConfig | undefined;
cancelToken?: import("axios").CancelToken | undefined;
decompress?: boolean | undefined;
};

@@ -68,3 +67,3 @@ /**

get(url: string, params?: {
[key: string]: unknown
[key: string]: unknown;
}, config?: AxiosRequestConfig): Promise<ApiResult<unknown> | undefined>;

@@ -74,3 +73,3 @@ post(url: string, body?: unknown, config?: AxiosRequestConfig): Promise<ApiResult<unknown> | undefined>;

delete(url: string, params?: {
[key: string]: unknown
[key: string]: unknown;
}, config?: AxiosRequestConfig): Promise<ApiResult<unknown> | undefined>;

@@ -77,0 +76,0 @@ /**

"use strict";
let __importDefault = (this && this.__importDefault) || function (mod) {
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };

@@ -8,3 +8,2 @@ };

const axios_1 = __importDefault(require("axios"));
class HTTPClient {

@@ -39,3 +38,3 @@ constructor(baseURL, store) {

async request(conf) {
let _a;
var _a;
try {

@@ -51,3 +50,4 @@ const res = await this.client.request(conf);

throw new Error(res.data.msg);
} catch (err) {
}
catch (err) {
const { response } = err;

@@ -76,3 +76,4 @@ // eslint-disable-next-line no-console

});
} else if (arguments.length === 2) {
}
else if (arguments.length === 2) {
return this.request({

@@ -84,3 +85,4 @@ method: 'GET',

});
} else if (arguments.length === 1) {
}
else if (arguments.length === 1) {
return this.request({

@@ -100,3 +102,4 @@ method: 'GET',

});
} else if (arguments.length === 2) {
}
else if (arguments.length === 2) {
return this.request({

@@ -109,3 +112,4 @@ method: 'POST',

});
} else if (arguments.length === 1) {
}
else if (arguments.length === 1) {
return this.request({

@@ -125,3 +129,4 @@ method: 'POST',

});
} else if (arguments.length === 2) {
}
else if (arguments.length === 2) {
return this.request({

@@ -134,3 +139,4 @@ method: 'PUT',

});
} else if (arguments.length === 1) {
}
else if (arguments.length === 1) {
return this.request({

@@ -150,3 +156,4 @@ method: 'PUT',

});
} else if (arguments.length === 2) {
}
else if (arguments.length === 2) {
return this.request({

@@ -158,3 +165,4 @@ method: 'DELETE',

});
} else if (arguments.length === 1) {
}
else if (arguments.length === 1) {
return this.request({

@@ -161,0 +169,0 @@ method: 'DELETE',

{
"author": "@rjgf/http-client",
"author": "rjgh",
"dependencies": {

@@ -10,2 +10,5 @@ "axios": "^0.21.1"

},
"engines": {
"node": ">=14.0.0 <15"
},
"files": [

@@ -16,3 +19,3 @@ "README.md",

],
"gitHead": "3090e02250c105ddd172b4221ec9b0735b19c0a3",
"gitHead": "a664b84e7e47b3ac18c437fc8cba2764f6948b15",
"license": "Apache-2.0",

@@ -30,5 +33,3 @@ "main": "./dist/index.js",

},
"types": "./dist/index.d.ts",
"typings": "./dist/index.d.ts",
"version": "0.1.3"
"version": "0.1.4"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc