Socket
Socket
Sign inDemoInstall

@vitrical/utils

Package Overview
Dependencies
6
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.4.1 to 1.4.2

12

api.d.ts

@@ -12,5 +12,5 @@ import { AxiosError } from 'axios';

export declare const handleApiError: (url: string, newStack: string, err: AxiosError) => ApiError | Error | unknown;
export type CustomRequestResponse = {
export type CustomRequestResponse<R = any> = {
status: number;
body: any;
body: R;
headers: {

@@ -20,6 +20,6 @@ [key: string]: any;

};
export type CustomRequestOptions = {
method: 'get' | 'post' | 'put' | 'delete';
export type CustomRequestOptions<B = any> = {
method: 'get' | 'post' | 'put' | 'delete' | 'patch' | 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
url: string;
body?: any;
body?: B;
query?: {

@@ -33,3 +33,3 @@ [key: string]: any;

export declare const removeUndefined: (obj: any) => any;
export declare const request: ({ method, url, body, query, headers, }: CustomRequestOptions) => Promise<CustomRequestResponse>;
export declare const request: <B = any, R = any>({ method, url, body, query, headers, }: CustomRequestOptions<B>) => Promise<CustomRequestResponse<R>>;
export declare const makeMicroserviceRequest: (baseURL: string, key: string) => <T extends unknown>(method: 'get' | 'post' | 'put' | 'delete', url: string, options?: {

@@ -36,0 +36,0 @@ body?: any;

@@ -91,2 +91,3 @@ "use strict";

const request = ({ method, url, body, query, headers, }) => new Promise((resolve, reject) => {
const lcaseMethod = method.toLowerCase();
const newStack = new Error().stack;

@@ -97,3 +98,3 @@ if (isFetchAvailable() && !isXMLHttpRequestAvailable()) {

: url + '?' + new URLSearchParams((0, exports.removeUndefined)(query)), {
method,
method: lcaseMethod,
body: body && typeof body === 'string' ? body : JSON.stringify(body),

@@ -133,3 +134,3 @@ headers: {

const request = axios_1.default.request({
method,
method: lcaseMethod,
url,

@@ -136,0 +137,0 @@ data: body,

{
"name": "@vitrical/utils",
"version": "1.4.1",
"version": "1.4.2",
"description": "Collection of useful functions and typings",

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc