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

@plattar/plattar-api

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@plattar/plattar-api - npm Package Compare versions

Comparing version 1.90.11 to 1.90.12-dev

4

package.json
{
"name": "@plattar/plattar-api",
"version": "1.90.11",
"version": "1.90.12-dev",
"description": "Module for interfacing with the Plattar API (https://www.plattar.com)",

@@ -32,4 +32,4 @@ "main": "index.js",

"dependencies": {
"got": "^11.5.2"
"node-fetch": "^2.6.0"
}
}

@@ -1,2 +0,2 @@

const got = require('got');
const fetch = require('node-fetch');

@@ -90,2 +90,3 @@ 'use strict';

const reqopts = {
method: 'GET',
headers: auth

@@ -102,22 +103,27 @@ };

got.get(endpoint, reqopts).then((response) => {
const body = response.body;
const json = JSON.parse(body);
fetch(endpoint, reqopts)
.then((res) => {
if (res.ok) {
try {
return res.json();
}
catch (err) {
return new Error('PlattarQuery.' + target.type() + '.get(' + target.id + ') - critical error occured, cannot proceed');
}
}
const PlattarUtil = require('../util/plattar-util.js');
return new Error('PlattarQuery.' + target.type() + '.get(' + target.id + ') - unexpected error occured, cannot proceed. error message is ' + res.statusText);
})
.then((json) => {
if (json instanceof Error) {
reject(json);
}
else {
const PlattarUtil = require('../util/plattar-util.js');
PlattarUtil.reconstruct(target, json, options);
PlattarUtil.reconstruct(target, json, options);
resolve(target);
}).catch((error) => {
if (!error || !error.response || !error.response.body) {
reject(new Error('PlattarQuery.' + target.type() + '.get(' + target.id + ') - critical error occured, cannot proceed. error was ' + error));
return;
}
const body = error.response.body;
const json = JSON.parse(body);
reject(new Error('PlattarQuery.' + target.type() + '.get(' + target.id + ') - ' + json.errors[0].detail));
});
resolve(target);
}
});
});

@@ -124,0 +130,0 @@ }

@@ -1,2 +0,2 @@

const got = require('got');
const fetch = require('node-fetch');

@@ -85,2 +85,3 @@ 'use strict';

const options = {
methid: 'GET',
headers: {

@@ -91,10 +92,13 @@ 'plattar-auth-token': token

got.get(endpoint, options).then((response) => {
this._authToken = {
'plattar-auth-token': token
};
fetch(endpoint, options).then((res) => {
if (res.ok) {
this._authToken = {
'plattar-auth-token': token
};
resolve(this);
}).catch((error) => {
reject(new Error('Plattar.auth(token) - failed to validate authentication token at ' + endpoint));
resolve(this);
}
else {
reject(new Error('Plattar.auth(token) - failed to validate authentication token at ' + endpoint));
}
});

@@ -122,8 +126,15 @@ });

got.get(endpoint).then((response) => {
this._serverLocation = server;
const options = {
methid: 'GET'
};
resolve(this);
}).catch((error) => {
reject(new Error('Plattar.origin(server) - failed to ping server at ' + endpoint));
fetch(endpoint, options).then((res) => {
if (res.ok) {
this._serverLocation = server;
resolve(this);
}
else {
reject(new Error('Plattar.origin(server) - failed to ping server at ' + endpoint));
}
});

@@ -130,0 +141,0 @@ });

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