@rg-dev/stdlib
Advanced tools
| "use strict"; | ||
| var __create = Object.create; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __getProtoOf = Object.getPrototypeOf; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
| // If the importer is in node compatibility mode or this is not an ESM | ||
| // file that has been converted to a CommonJS file using a Babel- | ||
| // compatible transform (i.e. "__esModule" has not been set), then set | ||
| // "default" to the CommonJS "module.exports" for node compatibility. | ||
| isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
| mod | ||
| )); | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/axios-helpers.ts | ||
| var axios_helpers_exports = {}; | ||
| __export(axios_helpers_exports, { | ||
| VERSION: () => VERSION, | ||
| handleAxiosError: () => handleAxiosError | ||
| }); | ||
| module.exports = __toCommonJS(axios_helpers_exports); | ||
| var import_axios = __toESM(require("axios"), 1); | ||
| // src/index.ts | ||
| var VERSION = "1"; | ||
| // src/axios-helpers.ts | ||
| import_axios.default.defaults.validateStatus = (status) => status < 400; | ||
| function handleAxiosError(fnName, e) { | ||
| var _a, _b; | ||
| if (e instanceof import_axios.default.AxiosError) { | ||
| fnName || (fnName = "Axios Request"); | ||
| let errorData = ((_a = e == null ? void 0 : e.response) == null ? void 0 : _a.data) || ""; | ||
| if (typeof errorData != "string") { | ||
| errorData = JSON.stringify(errorData); | ||
| } | ||
| const errorDetails = errorData.trim().slice(0, 300); | ||
| const msg = (e == null ? void 0 : e.message) || JSON.stringify(e); | ||
| const errorString = JSON.stringify({ error: msg, data: errorDetails, url: ((_b = e.config) == null ? void 0 : _b.url) || "" }, null, 2); | ||
| const err = new Error(`${fnName} failed: ${errorString}`); | ||
| err.stack = e.stack; | ||
| return err; | ||
| } | ||
| fnName || (fnName = "Function Error"); | ||
| const nonAxiosError = String((e == null ? void 0 : e.message) || JSON.stringify(e)) || "Unknown Error"; | ||
| const error = Error(`${fnName} failed: ${String(nonAxiosError)}`); | ||
| error.stack = e.stack; | ||
| return error; | ||
| } |
| export { VERSION } from './index.cjs'; | ||
| declare function handleAxiosError(fnName: string, e: any): Error; | ||
| export { handleAxiosError }; |
| export { VERSION } from './index.js'; | ||
| declare function handleAxiosError(fnName: string, e: any): Error; | ||
| export { handleAxiosError }; |
| // src/axios-helpers.ts | ||
| import axios from "axios"; | ||
| // src/index.ts | ||
| var VERSION = "1"; | ||
| // src/axios-helpers.ts | ||
| axios.defaults.validateStatus = (status) => status < 400; | ||
| function handleAxiosError(fnName, e) { | ||
| var _a, _b; | ||
| if (e instanceof axios.AxiosError) { | ||
| fnName || (fnName = "Axios Request"); | ||
| let errorData = ((_a = e == null ? void 0 : e.response) == null ? void 0 : _a.data) || ""; | ||
| if (typeof errorData != "string") { | ||
| errorData = JSON.stringify(errorData); | ||
| } | ||
| const errorDetails = errorData.trim().slice(0, 300); | ||
| const msg = (e == null ? void 0 : e.message) || JSON.stringify(e); | ||
| const errorString = JSON.stringify({ error: msg, data: errorDetails, url: ((_b = e.config) == null ? void 0 : _b.url) || "" }, null, 2); | ||
| const err = new Error(`${fnName} failed: ${errorString}`); | ||
| err.stack = e.stack; | ||
| return err; | ||
| } | ||
| fnName || (fnName = "Function Error"); | ||
| const nonAxiosError = String((e == null ? void 0 : e.message) || JSON.stringify(e)) || "Unknown Error"; | ||
| const error = Error(`${fnName} failed: ${String(nonAxiosError)}`); | ||
| error.stack = e.stack; | ||
| return error; | ||
| } | ||
| export { | ||
| VERSION, | ||
| handleAxiosError | ||
| }; |
+1
-0
@@ -6,3 +6,4 @@ import './browser-env'; | ||
| import './trpc-helpers' | ||
| import './axios-helpers' | ||
| export declare const VERSION:string |
+1
-0
@@ -6,3 +6,4 @@ import './browser-env'; | ||
| import './trpc-helpers' | ||
| import './axios-helpers' | ||
| export declare const VERSION:string |
+9
-1
| { | ||
| "name": "@rg-dev/stdlib", | ||
| "version": "1.0.56", | ||
| "version": "1.0.57", | ||
| "description": "", | ||
@@ -31,2 +31,5 @@ "scripts": { | ||
| "lib/node-download.d.ts" | ||
| ], | ||
| "lib/axios-helpers": [ | ||
| "lib/axios-helpers.d.ts" | ||
| ] | ||
@@ -43,2 +46,7 @@ } | ||
| }, | ||
| "./lib/axios-helpers": { | ||
| "import": "./lib/axios-helpers.js", | ||
| "require": "./lib/axios-helpers.cjs", | ||
| "types": "./lib/axios-helpers.d.ts" | ||
| }, | ||
| "./lib/trpc-helpers": { | ||
@@ -45,0 +53,0 @@ "import": "./lib/trpc-helpers.js", |
Network access
Supply chain riskThis module accesses the network.
Found 4 instances in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 4 instances in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
589453
0.77%29
16%14659
0.66%