From 2f61be89b2cd431cdf9ffd9ba535e939f54d48cd Mon Sep 17 00:00:00 2001 From: kristjanAha Date: Mon, 18 Sep 2023 17:08:50 +0000 Subject: [PATCH] Fix crash in retrying _xcall --- lib/magento.js | 23 ++++++++++------------- package.json | 2 +- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/lib/magento.js b/lib/magento.js index 4a6f012..f082c35 100644 --- a/lib/magento.js +++ b/lib/magento.js @@ -12,14 +12,14 @@ var MagentoConnector = function(config) { var next = function() { MagentoClient.methodCall('call', [ MagentoClient.sessionId, api, args ], function(err,res) { if (err) { - // try logging in again - if (err.faultCode == 5 && MagentoClient.sessionId) { - MagentoClient.sessionId = undefined; - return this._xcall(self,api,apiargs); - } - } - callback(err,res); - }); + // try logging in again + if (err.faultCode == 5 && MagentoClient.sessionId) { + MagentoClient.sessionId = undefined; + return __privateMethods._xcall(self, api, apiargs); + } + } + callback(err,res); + }); } if (MagentoClient.sessionId == undefined) @@ -28,7 +28,6 @@ var MagentoConnector = function(config) { next(); }, - _call: function(self,apiargs) { var args = Array.prototype.slice.call(apiargs); var callback = args.pop(); @@ -64,7 +63,7 @@ var MagentoConnector = function(config) { self.login(next); else next(); - }, + } } return { @@ -113,7 +112,7 @@ var MagentoConnector = function(config) { define: function(apiname) { var obj = this; - apis = apiname.split('.'); + var apis = apiname.split('.'); if (obj[apis[0]] == undefined) obj[apis[0]] = {}; obj[apis[0]][apis[1]] = function() { @@ -125,5 +124,3 @@ var MagentoConnector = function(config) { } module.exports = MagentoConnector; - - diff --git a/package.json b/package.json index 5ddae1f..91584c6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "magentojs", - "version": "0.0.1", + "version": "0.0.2", "description": "A Magento's connector for Node.js applications \n\n\n\n Credits to Alan Kay", "main": "index.js", "scripts": {