@aloma.io/integration-sdk 3.3.54 → 3.3.56

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.
@@ -162,6 +162,7 @@ class OAuth {
162
162
  this._data = data || {};
163
163
  this.saveOAuthResult = saveOAuthResult;
164
164
  this.obtainViaRefreshToken = getRefreshToken;
165
+ this.clients = {};
165
166
  }
166
167
  data() {
167
168
  return this._data;
@@ -443,6 +444,20 @@ ${text}
443
444
  const theOAuth = decrypted.oauthResult
444
445
  ? new OAuth(decrypted.oauthResult, saveOAuthResult, getRefreshToken)
445
446
  : null;
447
+ console.log('restarting');
448
+ if (theOAuth) {
449
+ clearInterval(this._refreshOAuthToken);
450
+ if (!(this._oauth.noPeriodicTokenRefresh === false)) {
451
+ this._refreshOAuthToken = setInterval(async () => {
452
+ try {
453
+ await theOAuth.periodicRefresh();
454
+ }
455
+ catch (e) {
456
+ console.log('periodic refresh', e);
457
+ }
458
+ }, /*4 * 60 * 60 **/ 1000);
459
+ }
460
+ }
446
461
  start({
447
462
  config: decrypted,
448
463
  oauth: theOAuth,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aloma.io/integration-sdk",
3
- "version": "3.3.54",
3
+ "version": "3.3.56",
4
4
  "description": "",
5
5
  "author": "aloma.io",
6
6
  "license": "Apache-2.0",
@@ -205,6 +205,7 @@ class OAuth {
205
205
  this._data = data || {};
206
206
  this.saveOAuthResult = saveOAuthResult;
207
207
  this.obtainViaRefreshToken = getRefreshToken;
208
+ this.clients = {};
208
209
  }
209
210
 
210
211
  data() {
@@ -546,6 +547,24 @@ ${text}
546
547
  const theOAuth = decrypted.oauthResult
547
548
  ? new OAuth(decrypted.oauthResult, saveOAuthResult, getRefreshToken)
548
549
  : null;
550
+
551
+ console.log('restarting')
552
+ if (theOAuth) {
553
+ clearInterval(this._refreshOAuthToken);
554
+
555
+ if (!(this._oauth.noPeriodicTokenRefresh === false)) {
556
+ this._refreshOAuthToken = setInterval(async () => {
557
+ try
558
+ {
559
+ await theOAuth.periodicRefresh();
560
+ } catch(e) {
561
+ console.log('periodic refresh', e);
562
+ }
563
+ }, /*4 * 60 * 60 **/ 1000);
564
+ }
565
+
566
+ }
567
+
549
568
  start({
550
569
  config: decrypted,
551
570
  oauth: theOAuth,