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

myob

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

myob - npm Package Compare versions

Comparing version 0.3.5 to 0.3.6

16

lib/client.js

@@ -27,2 +27,4 @@ 'use strict';

function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -34,2 +36,4 @@

function Client(_ref) {
var _this = this;
var clientId = _ref.clientId,

@@ -41,3 +45,13 @@ secret = _ref.secret,

_ref$callback = _ref.callback,
callback = _ref$callback === undefined ? function () {} : _ref$callback,
callback = _ref$callback === undefined ? _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
case 'end':
return _context.stop();
}
}
}, _callee, _this);
})) : _ref$callback,
username = _ref.username,

@@ -44,0 +58,0 @@ password = _ref.password,

@@ -7,3 +7,8 @@ 'use strict';

exports.default = expiredToken;
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
function expiredToken(instance, client) {
var _this = this;
var retries = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 5;

@@ -25,7 +30,27 @@

return client.authentication.refresh(client.token).then(function (token) {
config.headers.Authorization = 'Bearer ' + token.access_token;
client.callback(token);
return instance(config);
}).catch(function (e) {
return client.authentication.refresh(client.token).then(function () {
var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(token) {
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
config.headers.Authorization = 'Bearer ' + token.access_token;
_context.next = 3;
return client.callback(token);
case 3:
return _context.abrupt('return', instance(config));
case 4:
case 'end':
return _context.stop();
}
}
}, _callee, _this);
}));
return function (_x2) {
return _ref.apply(this, arguments);
};
}()).catch(function (e) {
client.logger.error('could not refresh token', e);

@@ -32,0 +57,0 @@ throw error;

2

package.json
{
"name": "myob",
"version": "0.3.5",
"version": "0.3.6",
"main": "lib/index.js",

@@ -5,0 +5,0 @@ "repository": "git@github.com:ordermentum/myob-javascript-sdk.git",

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