Socket
Socket
Sign inDemoInstall

remote.it

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remote.it - npm Package Compare versions

Comparing version 0.42.0 to 0.42.2-alpha.0

53

lib/remote.it.js

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

var utils_1 = require("./utils");
var auth_1 = __importDefault(require("@aws-amplify/auth"));
var defaults = {

@@ -913,16 +914,42 @@ apiURL: 'https://api.remot3.it/apv/v27',

return __awaiter(this, void 0, void 0, function () {
var currentSession, token, error_1;
return __generator(this, function (_a) {
return [2 /*return*/, r3.axios
.request({
url: url,
method: method,
data: data,
headers: __assign({}, extraHeaders, utils_1.pickBy({
accessKey: r3.accessKey,
apiKey: r3.apiKey,
developerKey: r3.developerKey,
token: r3.token,
})),
})
.then(r3.processData, r3.processError)];
switch (_a.label) {
case 0:
_a.trys.push([0, 2, , 3]);
return [4 /*yield*/, auth_1.default.currentSession()];
case 1:
currentSession = _a.sent();
token = 'Bearer ' + currentSession.getAccessToken().getJwtToken();
return [2 /*return*/, r3.axios
.request({
url: url,
method: method,
data: data,
headers: __assign({}, extraHeaders, utils_1.pickBy({
Authorization: token,
developerKey: r3.developerKey,
})),
})
.then(r3.processData, r3.processError)];
case 2:
error_1 = _a.sent();
//console.error(error)
//alert('ERROR: ' + error.message)
//No AWS Auth, use legacy
return [2 /*return*/, r3.axios
.request({
url: url,
method: method,
data: data,
headers: __assign({}, extraHeaders, utils_1.pickBy({
accessKey: r3.accessKey,
apiKey: r3.apiKey,
developerKey: r3.developerKey,
token: r3.token,
})),
})
.then(r3.processData, r3.processError)];
case 3: return [2 /*return*/];
}
});

@@ -929,0 +956,0 @@ });

{
"name": "remote.it",
"version": "0.42.0",
"version": "0.42.2-alpha.0",
"description": "remote.it JavaScript/node client library",

@@ -21,3 +21,3 @@ "main": "lib/remote.it.js",

"test": "jest",
"watch-compile": "tsc -w",
"watch-compile": "tsc -w --preserveWatchOutput",
"watch-tests": "jest --watch"

@@ -42,3 +42,3 @@ },

"path": "lib/*.js",
"limit": "30 kB"
"limit": "130 kB"
}

@@ -48,2 +48,3 @@ ],

"dependencies": {
"@aws-amplify/auth": "1.3.3",
"axios": "0.18.0",

@@ -53,3 +54,5 @@ "luxon": "1.13.2"

"devDependencies": {
"@types/jest": "24.0.18",
"@types/jsdom": "12.2.4",
"@types/luxon": "1.15.2",
"eslint": "5.5.0",

@@ -81,3 +84,4 @@ "eslint-config-standard": "12.0.0",

},
"homepage": "https://github.com/remoteit/remote.it.js#readme"
"homepage": "https://github.com/remoteit/remote.it.js#readme",
"gitHead": "b9d89f622bdda332c8ec931c699f21377c4d49da"
}
import axios, { AxiosError, AxiosResponse } from 'axios'
import { groupBy, parseLegacyDate, pickBy, toNumber } from './utils'
import Auth from '@aws-amplify/auth'

@@ -695,18 +696,42 @@ const defaults = {

async request(method: string, url: string, data = {}, extraHeaders = {}) {
return r3.axios
.request({
url,
method,
data,
headers: {
...extraHeaders,
...pickBy({
accessKey: r3.accessKey,
apiKey: r3.apiKey,
developerKey: r3.developerKey,
token: r3.token,
}),
},
})
.then(r3.processData, r3.processError)
try {
let currentSession = await Auth.currentSession()
let token = 'Bearer ' + currentSession.getAccessToken().getJwtToken()
return r3.axios
.request({
url,
method,
data,
headers: {
...extraHeaders,
...pickBy({
Authorization: token,
developerKey: r3.developerKey,
}),
},
})
.then(r3.processData, r3.processError)
} catch (error) {
//console.error(error)
//alert('ERROR: ' + error.message)
//No AWS Auth, use legacy
return r3.axios
.request({
url,
method,
data,
headers: {
...extraHeaders,
...pickBy({
accessKey: r3.accessKey,
apiKey: r3.apiKey,
developerKey: r3.developerKey,
token: r3.token,
}),
},
})
.then(r3.processData, r3.processError)
}
},

@@ -713,0 +738,0 @@ async get(url: string, data = {}) {

Sorry, the diff of this file is not supported yet

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