@como/como-client 0.7.51 → 0.7.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/lib/como.js +19 -14
  2. package/package.json +1 -1
  3. package/src/como.js +4 -4
package/lib/como.js CHANGED
@@ -220,7 +220,7 @@ var Como = function () {
220
220
 
221
221
  console.error('Failed to refresh token, installationId:' + installationId + ', refreshToken:' + this.comoData.refreshToken + ', locationId:' + locationId + ', source:' + source);
222
222
  //refresh failed - need to revoke and signOn again
223
- initService.logError({ method: 'refreshToken', installationId: installationId, locationId: locationId, source: source, refreshToken: refreshToken });
223
+ initService.logError({ method: 'refreshToken', installationId: installationId, locationId: locationId, source: source, refreshToken: refreshToken, error: _context2.t0.message });
224
224
  refreshFailed = true;
225
225
 
226
226
  case 29:
@@ -255,7 +255,7 @@ var Como = function () {
255
255
 
256
256
  console.error('Failed to signOn, installationId:' + installationId + ', locationId:' + locationId + ', source:' + source + ',interval:' + interval + ', error:' + _context2.t1);
257
257
  interval += 1000;
258
- initService.logError({ method: 'signOn', installationId: installationId, locationId: locationId, source: source, refreshToken: refreshToken, interval: interval });
258
+ initService.logError({ method: 'signOn', installationId: installationId, locationId: locationId, source: source, refreshToken: refreshToken, interval: interval, error: _context2.t1.message });
259
259
  _context2.next = 47;
260
260
  return new _promise2.default(function (r) {
261
261
  return setTimeout(r, interval);
@@ -266,17 +266,22 @@ var Como = function () {
266
266
  break;
267
267
 
268
268
  case 49:
269
- _context2.next = 63;
269
+ _context2.next = 64;
270
270
  break;
271
271
 
272
272
  case 51:
273
- _context2.prev = 51;
273
+ if (isExpired) {
274
+ _context2.next = 64;
275
+ break;
276
+ }
277
+
278
+ _context2.prev = 52;
274
279
 
275
280
  console.log('signOn with installationId:' + installationId + ', locationId:' + locationId + ', source:' + source + ',accessToken:' + accessToken);
276
- _context2.next = 55;
281
+ _context2.next = 56;
277
282
  return this.comoData.initApi.signOn(installationId, locationId, source, accessToken);
278
283
 
279
- case 55:
284
+ case 56:
280
285
  _data2 = _context2.sent;
281
286
 
282
287
  console.log('signOn with result " ' + (0, _stringify2.default)(_data2));
@@ -284,27 +289,27 @@ var Como = function () {
284
289
  console.log('signOn- updating credentials');
285
290
  updateCredentials(_data2, true);
286
291
  }
287
- _context2.next = 63;
292
+ _context2.next = 64;
288
293
  break;
289
294
 
290
- case 60:
291
- _context2.prev = 60;
292
- _context2.t2 = _context2['catch'](51);
295
+ case 61:
296
+ _context2.prev = 61;
297
+ _context2.t2 = _context2['catch'](52);
293
298
 
294
- console.error('Failed signOn with accessToken, installationId:' + installationId + ', locationId:' + locationId + ', source:' + source + ',accessToken:' + accessToken + ', error:' + _context2.t2);
299
+ console.error('Failed signOn with accessToken, installationId:' + installationId + ', locationId:' + locationId + ', source:' + source + ',accessToken:' + accessToken + ', error:' + _context2.t2.message);
295
300
 
296
- case 63:
301
+ case 64:
297
302
  if (!this.comoData.token) {
298
303
  this.comoData.token = this.comoData.accessToken;
299
304
  }
300
305
  return _context2.abrupt('return', this.getCredentials());
301
306
 
302
- case 65:
307
+ case 66:
303
308
  case 'end':
304
309
  return _context2.stop();
305
310
  }
306
311
  }
307
- }, _callee2, this, [[17, 24], [32, 40], [51, 60]]);
312
+ }, _callee2, this, [[17, 24], [32, 40], [52, 61]]);
308
313
  }));
309
314
 
310
315
  function init(_x, _x2, _x3) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@como/como-client",
3
- "version": "0.7.51",
3
+ "version": "0.7.52",
4
4
  "description": "Client module for Como's loaylty API",
5
5
  "main": "src/como.js",
6
6
  "scripts": {
package/src/como.js CHANGED
@@ -111,7 +111,7 @@ class Como {
111
111
  }catch(e){
112
112
  console.error(`Failed to refresh token, installationId:${installationId}, refreshToken:${this.comoData.refreshToken}, locationId:${locationId}, source:${source}`);
113
113
  //refresh failed - need to revoke and signOn again
114
- initService.logError({method: 'refreshToken', installationId, locationId, source, refreshToken});
114
+ initService.logError({method: 'refreshToken', installationId, locationId, source, refreshToken, error : e.message});
115
115
  refreshFailed = true;
116
116
  }
117
117
  }
@@ -125,12 +125,12 @@ class Como {
125
125
  }catch(e){
126
126
  console.error(`Failed to signOn, installationId:${installationId}, locationId:${locationId}, source:${source},interval:${interval}, error:${e}`);
127
127
  interval += 1000;
128
- initService.logError({method: 'signOn', installationId, locationId, source, refreshToken, interval});
128
+ initService.logError({method: 'signOn', installationId, locationId, source, refreshToken, interval, error : e.message});
129
129
  await new Promise(r => setTimeout(r, interval));
130
130
  }
131
131
  }
132
132
  }
133
- else{
133
+ else if(!isExpired){
134
134
  try{
135
135
  console.log(`signOn with installationId:${installationId}, locationId:${locationId}, source:${source},accessToken:${accessToken}`);
136
136
  const data = await this.comoData.initApi.signOn(installationId, locationId, source, accessToken);
@@ -140,7 +140,7 @@ class Como {
140
140
  updateCredentials(data, true);
141
141
  }
142
142
  }catch(e){
143
- console.error(`Failed signOn with accessToken, installationId:${installationId}, locationId:${locationId}, source:${source},accessToken:${accessToken}, error:${e}`);
143
+ console.error(`Failed signOn with accessToken, installationId:${installationId}, locationId:${locationId}, source:${source},accessToken:${accessToken}, error:${e.message}`);
144
144
  }
145
145
  }
146
146
  if(!this.comoData.token){