@como/como-client 0.7.94 → 0.7.95
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.
- package/lib/como.js +40 -36
- package/package.json +1 -1
- package/src/como.js +6 -2
package/lib/como.js
CHANGED
|
@@ -201,7 +201,7 @@ var Como = function () {
|
|
|
201
201
|
refreshFailed = false;
|
|
202
202
|
|
|
203
203
|
if (!isExpired) {
|
|
204
|
-
_context2.next =
|
|
204
|
+
_context2.next = 30;
|
|
205
205
|
break;
|
|
206
206
|
}
|
|
207
207
|
|
|
@@ -213,7 +213,7 @@ var Como = function () {
|
|
|
213
213
|
data = _context2.sent;
|
|
214
214
|
|
|
215
215
|
updateCredentials(data, true);
|
|
216
|
-
_context2.next =
|
|
216
|
+
_context2.next = 30;
|
|
217
217
|
break;
|
|
218
218
|
|
|
219
219
|
case 24:
|
|
@@ -224,74 +224,75 @@ var Como = function () {
|
|
|
224
224
|
//refresh failed - need to revoke and signOn again
|
|
225
225
|
initService.logError({ method: 'refreshToken', installationId: installationId, locationId: locationId, source: source, refreshToken: refreshToken, error: _context2.t0.message });
|
|
226
226
|
refreshFailed = true;
|
|
227
|
+
credExist = false;
|
|
227
228
|
|
|
228
|
-
case
|
|
229
|
+
case 30:
|
|
229
230
|
interval = 0;
|
|
230
231
|
|
|
231
|
-
if (
|
|
232
|
-
_context2.next =
|
|
232
|
+
if (credExist) {
|
|
233
|
+
_context2.next = 52;
|
|
233
234
|
break;
|
|
234
235
|
}
|
|
235
236
|
|
|
236
|
-
case
|
|
237
|
+
case 32:
|
|
237
238
|
if (!(!credExist && interval < 3000)) {
|
|
238
|
-
_context2.next =
|
|
239
|
+
_context2.next = 50;
|
|
239
240
|
break;
|
|
240
241
|
}
|
|
241
242
|
|
|
242
|
-
_context2.prev =
|
|
243
|
-
_context2.next =
|
|
243
|
+
_context2.prev = 33;
|
|
244
|
+
_context2.next = 36;
|
|
244
245
|
return this.comoData.initApi.signOn(installationId, locationId, source);
|
|
245
246
|
|
|
246
|
-
case
|
|
247
|
+
case 36:
|
|
247
248
|
_data = _context2.sent;
|
|
248
249
|
|
|
249
250
|
updateCredentials(_data, true);
|
|
250
251
|
credExist = true;
|
|
251
|
-
_context2.next =
|
|
252
|
+
_context2.next = 48;
|
|
252
253
|
break;
|
|
253
254
|
|
|
254
|
-
case
|
|
255
|
-
_context2.prev =
|
|
256
|
-
_context2.t1 = _context2['catch'](
|
|
255
|
+
case 41:
|
|
256
|
+
_context2.prev = 41;
|
|
257
|
+
_context2.t1 = _context2['catch'](33);
|
|
257
258
|
|
|
258
259
|
console.error('Failed to signOn, installationId:' + installationId + ', locationId:' + locationId + ', source:' + source + ',interval:' + interval + ', error:' + _context2.t1);
|
|
259
260
|
interval += 1000;
|
|
260
261
|
initService.logError({ method: 'signOn no accessToken', accessToken: accessToken, isExpired: isExpired, refreshFailed: refreshFailed, credExist: credExist, installationId: installationId, locationId: locationId, source: source, refreshToken: refreshToken, interval: interval, error: _context2.t1.message });
|
|
261
|
-
_context2.next =
|
|
262
|
+
_context2.next = 48;
|
|
262
263
|
return new _promise2.default(function (r) {
|
|
263
264
|
return setTimeout(r, interval);
|
|
264
265
|
});
|
|
265
266
|
|
|
266
|
-
case
|
|
267
|
-
_context2.next =
|
|
267
|
+
case 48:
|
|
268
|
+
_context2.next = 32;
|
|
268
269
|
break;
|
|
269
270
|
|
|
270
|
-
case
|
|
271
|
-
_context2.next =
|
|
271
|
+
case 50:
|
|
272
|
+
_context2.next = 75;
|
|
272
273
|
break;
|
|
273
274
|
|
|
274
|
-
case
|
|
275
|
+
case 52:
|
|
275
276
|
if (isExpired) {
|
|
276
|
-
_context2.next =
|
|
277
|
+
_context2.next = 75;
|
|
277
278
|
break;
|
|
278
279
|
}
|
|
279
280
|
|
|
280
281
|
signOnSuccessfully = false;
|
|
281
282
|
|
|
282
|
-
case
|
|
283
|
+
case 54:
|
|
283
284
|
if (!(!signOnSuccessfully && interval < 3000)) {
|
|
284
|
-
_context2.next =
|
|
285
|
+
_context2.next = 75;
|
|
285
286
|
break;
|
|
286
287
|
}
|
|
287
288
|
|
|
288
|
-
_context2.prev =
|
|
289
|
+
_context2.prev = 55;
|
|
289
290
|
|
|
290
291
|
console.log('signOn with installationId:' + installationId + ', locationId:' + locationId + ', source:' + source + ',accessToken:' + accessToken);
|
|
291
|
-
_context2.next =
|
|
292
|
+
_context2.next = 59;
|
|
292
293
|
return this.comoData.initApi.signOn(installationId, locationId, source, accessToken);
|
|
293
294
|
|
|
294
|
-
case
|
|
295
|
+
case 59:
|
|
295
296
|
_data2 = _context2.sent;
|
|
296
297
|
|
|
297
298
|
console.log('signOn with result " ' + (0, _stringify2.default)(_data2));
|
|
@@ -303,37 +304,37 @@ var Como = function () {
|
|
|
303
304
|
this.comoData.reCaptchaSiteKey = _data2.config.recaptchaSiteKey;
|
|
304
305
|
}
|
|
305
306
|
signOnSuccessfully = true;
|
|
306
|
-
_context2.next =
|
|
307
|
+
_context2.next = 73;
|
|
307
308
|
break;
|
|
308
309
|
|
|
309
|
-
case
|
|
310
|
-
_context2.prev =
|
|
311
|
-
_context2.t2 = _context2['catch'](
|
|
310
|
+
case 66:
|
|
311
|
+
_context2.prev = 66;
|
|
312
|
+
_context2.t2 = _context2['catch'](55);
|
|
312
313
|
|
|
313
314
|
console.error('Failed signOn with accessToken, installationId:' + installationId + ', locationId:' + locationId + ', source:' + source + ',accessToken:' + accessToken + ', error:' + _context2.t2.message);
|
|
314
315
|
interval += 1000;
|
|
315
316
|
initService.logError({ method: 'signOn with credentials', accessToken: accessToken, isExpired: isExpired, refreshFailed: refreshFailed, credExist: credExist, installationId: installationId, locationId: locationId, source: source, refreshToken: refreshToken, interval: interval, error: _context2.t2.message });
|
|
316
|
-
_context2.next =
|
|
317
|
+
_context2.next = 73;
|
|
317
318
|
return new _promise2.default(function (r) {
|
|
318
319
|
return setTimeout(r, interval);
|
|
319
320
|
});
|
|
320
321
|
|
|
321
|
-
case
|
|
322
|
-
_context2.next =
|
|
322
|
+
case 73:
|
|
323
|
+
_context2.next = 54;
|
|
323
324
|
break;
|
|
324
325
|
|
|
325
|
-
case
|
|
326
|
+
case 75:
|
|
326
327
|
if (!this.comoData.token) {
|
|
327
328
|
this.comoData.token = this.comoData.accessToken;
|
|
328
329
|
}
|
|
329
330
|
return _context2.abrupt('return', this.getCredentials());
|
|
330
331
|
|
|
331
|
-
case
|
|
332
|
+
case 77:
|
|
332
333
|
case 'end':
|
|
333
334
|
return _context2.stop();
|
|
334
335
|
}
|
|
335
336
|
}
|
|
336
|
-
}, _callee2, this, [[17, 24], [
|
|
337
|
+
}, _callee2, this, [[17, 24], [33, 41], [55, 66]]);
|
|
337
338
|
}));
|
|
338
339
|
|
|
339
340
|
function init(_x, _x2, _x3) {
|
|
@@ -364,6 +365,9 @@ var Como = function () {
|
|
|
364
365
|
this.comoData.expiresIn = credentials.expiresIn;
|
|
365
366
|
if (credentials.config) {
|
|
366
367
|
this.comoData.reCaptchaSiteKey = credentials.config.recaptchaSiteKey;
|
|
368
|
+
if (credentials.config.recaptcha) {
|
|
369
|
+
this.comoData.recaptchaConfig = credentials.config.recaptcha;
|
|
370
|
+
}
|
|
367
371
|
}
|
|
368
372
|
}
|
|
369
373
|
}, {
|
package/package.json
CHANGED
package/src/como.js
CHANGED
|
@@ -115,10 +115,11 @@ class Como {
|
|
|
115
115
|
//refresh failed - need to revoke and signOn again
|
|
116
116
|
initService.logError({method: 'refreshToken', installationId, locationId, source, refreshToken, error : e.message});
|
|
117
117
|
refreshFailed = true;
|
|
118
|
+
credExist = false;
|
|
118
119
|
}
|
|
119
120
|
}
|
|
120
121
|
let interval = 0;
|
|
121
|
-
if(
|
|
122
|
+
if(!credExist){
|
|
122
123
|
while(!credExist && interval < 3000){
|
|
123
124
|
try{
|
|
124
125
|
const data = await this.comoData.initApi.signOn(installationId, locationId, source);
|
|
@@ -134,7 +135,7 @@ class Como {
|
|
|
134
135
|
}
|
|
135
136
|
else if(!isExpired){
|
|
136
137
|
let signOnSuccessfully = false;
|
|
137
|
-
while(!signOnSuccessfully && interval < 3000){
|
|
138
|
+
while (!signOnSuccessfully && interval < 3000) {
|
|
138
139
|
try{
|
|
139
140
|
console.log(`signOn with installationId:${installationId}, locationId:${locationId}, source:${source},accessToken:${accessToken}`);
|
|
140
141
|
const data = await this.comoData.initApi.signOn(installationId, locationId, source, accessToken);
|
|
@@ -177,6 +178,9 @@ class Como {
|
|
|
177
178
|
this.comoData.expiresIn = credentials.expiresIn;
|
|
178
179
|
if(credentials.config){
|
|
179
180
|
this.comoData.reCaptchaSiteKey = credentials.config.recaptchaSiteKey;
|
|
181
|
+
if (credentials.config.recaptcha) {
|
|
182
|
+
this.comoData.recaptchaConfig = credentials.config.recaptcha;
|
|
183
|
+
}
|
|
180
184
|
}
|
|
181
185
|
}
|
|
182
186
|
|