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

@accordproject/concerto-util

Package Overview
Dependencies
Maintainers
0
Versions
511
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@accordproject/concerto-util - npm Package Compare versions

Comparing version 3.19.2-20240924185024 to 3.19.2-20240926173500

43

lib/loaders/httpfileloader.js

@@ -17,7 +17,4 @@ /*

const axios = require('axios');
const url = require('url');
/**
* Loads Files from an HTTP(S) URL using the axios library.
* Loads Files from an HTTP(S) URL using fetch.
* @class

@@ -47,3 +44,3 @@ * @private

/**
* Load a File from a URL and return it
* Load a text File from a URL and return it
* @param {string} requestUrl - the url to get

@@ -53,21 +50,23 @@ * @param {object} options - additional options

*/
load(requestUrl, options) {
async load(requestUrl, options) {
if (!options) {
options = {
method: 'GET',
headers: {
'Content-Type': 'text/plain',
}
};
}
if(!options) {
options = {};
console.log(requestUrl);
const response = await fetch(requestUrl, options);
if (!response.ok) {
throw new Error(`HTTP request failed with status: ${response.status}`);
}
const request = JSON.parse(JSON.stringify(options));
request.url = requestUrl;
request.method = 'get';
request.responseType = 'text';
return axios(request)
.then((response) => {
let parsedUrl = url.parse(requestUrl);
// external Files have a name that starts with '@'
// (so that they are identified as external when an archive is read back in)
const name = '@' + (parsedUrl.host + parsedUrl.pathname).replace(/\//g, '.');
return this.processFile(name, response.data);
});
const text = await response.text();
const url = new URL(requestUrl);
// external Files have a name that starts with '@'
// (so that they are identified as external when an archive is read back in)
const name = '@' + (url.host + url.pathname).replace(/\//g, '.');
return this.processFile(name, text);
}

@@ -74,0 +73,0 @@ }

@@ -20,5 +20,2 @@ /*

const colors = require('colors/safe');
const jsonColorize = require('json-colorizer');
/**

@@ -38,34 +35,6 @@ * Default levels for the npm configuration.

/**
* Default levels for the npm configuration.
* @type {Object}
*/
const colorMap = {
error: 'red',
warn: 'yellow',
info: 'green',
verbose: 'cyan',
debug: 'blue',
silly: 'magenta'
};
const timestamp = () => (new Date()).toLocaleTimeString();
const colorize = level => colors[colorMap[level]](level.toUpperCase());
/**
* Helper function to test if a string is a stringified version of a JSON object
* @param {string} str - the input string to test
* @returns {boolean} - true iff the string can be parsed as JSON
* @private
*/
const isJson = (str) => {
try {
return (JSON.parse(str) && !!str);
} catch (e) {
return false;
}
};
/**
* Helper function to color and format JSON objects
* Helper function to format JSON objects
* @param {any} obj - the input obj to prettify

@@ -76,5 +45,2 @@ * @returns {any} - the prettified object

const prettifyJson = (obj) => {
if(typeof obj === 'object' || isJson(obj)) {
return jsonColorize(obj, { pretty: true, colors });
}
return obj;

@@ -113,3 +79,3 @@ };

stream(
`${timestamp()} - ${colorize(mutatedLevel)}:`,
`${timestamp()} - ${mutatedLevel}:`,
...data

@@ -116,0 +82,0 @@ .map(obj => obj instanceof Error ? `${obj.message}\n${obj.stack}`: obj)

{
"name": "@accordproject/concerto-util",
"version": "3.19.2-20240924185024",
"version": "3.19.2-20240926173500",
"description": "Utilities for Concerto Modeling Language",
"homepage": "https://github.com/accordproject/concerto",
"engines": {
"node": ">=16",
"npm": ">=8"
"node": ">=18",
"npm": ">=10"
},
"main": "index.js",
"browser": "dist/concerto-util.js",
"browser": {
"main": "dist/concerto-util.js",
"fs": false,
"path": false
},
"typings": "types/index.d.ts",

@@ -50,14 +54,11 @@ "scripts": {

"mocha": "10.0.0",
"moxios": "0.4.0",
"node-polyfill-webpack-plugin": "2.0.1",
"nyc": "15.1.0",
"tmp-promise": "3.0.2",
"typescript": "4.6.3"
"typescript": "4.6.3",
"undici": "^6.19.8"
},
"dependencies": {
"@supercharge/promise-pool": "1.7.0",
"axios": "1.7.4",
"colors": "1.4.0",
"debug": "4.3.4",
"json-colorizer": "2.2.2",
"slash": "3.0.0"

@@ -64,0 +65,0 @@ },

export = HTTPFileLoader;
/**
* Loads Files from an HTTP(S) URL using the axios library.
* Loads Files from an HTTP(S) URL using fetch.
* @class

@@ -23,3 +23,3 @@ * @private

/**
* Load a File from a URL and return it
* Load a text File from a URL and return it
* @param {string} requestUrl - the url to get

@@ -26,0 +26,0 @@ * @param {object} options - additional options

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