@aloma.io/integration-sdk 3.3.68 → 3.3.70

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.
@@ -140,7 +140,7 @@ class OAuthFetcher extends Fetcher {
140
140
  }
141
141
  catch (e) {
142
142
  oauth.invalidate(e);
143
- throw (e);
143
+ throw e;
144
144
  }
145
145
  }
146
146
  async onError(e, url, options, retries, args, rateLimit) {
@@ -206,10 +206,12 @@ class OAuth {
206
206
  }
207
207
  }
208
208
  async invalidate(err) {
209
- if (this._data.access_token === 'invalid')
209
+ if (true)
210
210
  return;
211
- console.log('could not obtain access token, marking connector as disconnected', err);
212
- await this.update('invalid', null);
211
+ if (this._data.access_token === "invalid")
212
+ return;
213
+ console.log("could not obtain access token, marking connector as disconnected", err);
214
+ await this.update("invalid", null);
213
215
  }
214
216
  getClient(arg = {}) {
215
217
  const client = new OAuthFetcher({ ...arg, oauth: this });
@@ -428,7 +430,7 @@ ${text}
428
430
  const packet = transport.newPacket({});
429
431
  packet.method("connector.config-update");
430
432
  packet.args({
431
- value
433
+ value,
432
434
  });
433
435
  transport.send(packet);
434
436
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aloma.io/integration-sdk",
3
- "version": "3.3.68",
3
+ "version": "3.3.70",
4
4
  "description": "",
5
5
  "author": "aloma.io",
6
6
  "license": "Apache-2.0",
@@ -63,13 +63,16 @@ class Fetcher {
63
63
  var local = this;
64
64
 
65
65
  return new Promise((resolve, reject) => {
66
- setTimeout(async () => {
67
- try {
68
- resolve(await local.fetch(url, options, retries, args));
69
- } catch (e) {
70
- reject(e);
71
- }
72
- }, rateLimit?10000:500);
66
+ setTimeout(
67
+ async () => {
68
+ try {
69
+ resolve(await local.fetch(url, options, retries, args));
70
+ } catch (e) {
71
+ reject(e);
72
+ }
73
+ },
74
+ rateLimit ? 10000 : 500,
75
+ );
73
76
  });
74
77
  }
75
78
 
@@ -159,9 +162,8 @@ class OAuthFetcher extends Fetcher {
159
162
  if (!force && oauth.accessToken()) return oauth.accessToken();
160
163
 
161
164
  const refreshToken = oauth.refreshToken();
162
-
163
- try
164
- {
165
+
166
+ try {
165
167
  if (!refreshToken) {
166
168
  throw new Error("have no access_token and no refresh_token");
167
169
  }
@@ -175,10 +177,10 @@ class OAuthFetcher extends Fetcher {
175
177
  } else {
176
178
  throw new Error("could not obtain access token via refresh token");
177
179
  }
178
- } catch(e) {
180
+ } catch (e) {
179
181
  oauth.invalidate(e);
180
-
181
- throw(e);
182
+
183
+ throw e;
182
184
  }
183
185
  }
184
186
 
@@ -206,7 +208,7 @@ class OAuthFetcher extends Fetcher {
206
208
  async periodicRefresh() {
207
209
  const local = this,
208
210
  oauth = local.oauth;
209
-
211
+
210
212
  if (!oauth.refreshToken()) return;
211
213
 
212
214
  await local.getToken(true);
@@ -265,13 +267,17 @@ class OAuth {
265
267
  await client.periodicRefresh();
266
268
  }
267
269
  }
268
-
270
+
269
271
  async invalidate(err) {
270
- if (this._data.access_token === 'invalid') return;
271
-
272
- console.log('could not obtain access token, marking connector as disconnected', err);
273
-
274
- await this.update('invalid', null);
272
+ if (true) return;
273
+ if (this._data.access_token === "invalid") return;
274
+
275
+ console.log(
276
+ "could not obtain access token, marking connector as disconnected",
277
+ err,
278
+ );
279
+
280
+ await this.update("invalid", null);
275
281
  }
276
282
 
277
283
  getClient(arg = {}) {
@@ -528,13 +534,13 @@ ${text}
528
534
 
529
535
  const saveOAuthResult = async (what) => {
530
536
  const jwe = await config.validateKeys("RSA-OAEP-256");
531
- const value = await jwe.encrypt(what, "none", config.id())
532
-
537
+ const value = await jwe.encrypt(what, "none", config.id());
538
+
533
539
  const packet = transport.newPacket({});
534
540
 
535
541
  packet.method("connector.config-update");
536
542
  packet.args({
537
- value
543
+ value,
538
544
  });
539
545
 
540
546
  transport.send(packet);