@aloma.io/integration-sdk 3.5.0 → 3.5.2

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.
@@ -173,9 +173,11 @@ class OAuthFetcher extends Fetcher {
173
173
  }
174
174
  async periodicRefresh() {
175
175
  const local = this, oauth = local.oauth;
176
+ console.log('refreshing oauth token, have token', !!oauth.refreshToken());
176
177
  if (!oauth.refreshToken())
177
178
  return;
178
179
  await local.getToken(true);
180
+ console.log('refreshed oauth token');
179
181
  }
180
182
  async customize(options, args = {}) {
181
183
  const local = this;
@@ -500,12 +502,13 @@ ${text}
500
502
  if (!(this._oauth.noPeriodicTokenRefresh === false)) {
501
503
  this._refreshOAuthToken = setInterval(async () => {
502
504
  try {
505
+ console.log('refreshing oauth token');
503
506
  await theOAuth.periodicRefresh();
504
507
  }
505
508
  catch (e) {
506
509
  console.log("periodic refresh", e);
507
510
  }
508
- }, 4 * 60 * 60 * 15000);
511
+ }, this._oauth.tokenRefreshPeriod || (4 * 60 * 60 * 15000));
509
512
  }
510
513
  }
511
514
  const getBlob = (id) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aloma.io/integration-sdk",
3
- "version": "3.5.0",
3
+ "version": "3.5.2",
4
4
  "description": "",
5
5
  "author": "aloma.io",
6
6
  "license": "Apache-2.0",
@@ -28,7 +28,7 @@
28
28
  "@paralleldrive/cuid2": "^2",
29
29
  "@ts-ast-parser/core": "^0.5",
30
30
  "@types/node": "^18",
31
- "commander": "^11",
31
+ "commander": "^12",
32
32
  "dotenv": "*",
33
33
  "express": "^4",
34
34
  "jose": "^5",
@@ -29,11 +29,13 @@ const transform = (meta: any) => {
29
29
  .getSignatures()
30
30
  .map((sig: any) => {
31
31
  const docs = sig.getJSDoc().serialize() || [];
32
- const desc = docs.find((what: any) => what.kind === "description")
33
- ?.value;
32
+ const desc = docs.find(
33
+ (what: any) => what.kind === "description",
34
+ )?.value;
34
35
 
35
- const example = docs.find((what: any) => what.kind === "example")
36
- ?.value;
36
+ const example = docs.find(
37
+ (what: any) => what.kind === "example",
38
+ )?.value;
37
39
 
38
40
  let eg;
39
41
  if (example) {
@@ -123,7 +123,10 @@ class Fetcher {
123
123
  options.body = JSON.stringify(options.body);
124
124
  }
125
125
 
126
- const ret = await fetch(theURL, {...options, signal: AbortSignal.timeout(30 * 60 * 1000)});
126
+ const ret = await fetch(theURL, {
127
+ ...options,
128
+ signal: AbortSignal.timeout(30 * 60 * 1000),
129
+ });
127
130
  const status = await ret.status;
128
131
 
129
132
  if (status > 399) {
@@ -225,9 +228,12 @@ class OAuthFetcher extends Fetcher {
225
228
  const local = this,
226
229
  oauth = local.oauth;
227
230
 
231
+ console.log("refreshing oauth token, have token", !!oauth.refreshToken());
228
232
  if (!oauth.refreshToken()) return;
229
233
 
230
234
  await local.getToken(true);
235
+
236
+ console.log("refreshed oauth token");
231
237
  }
232
238
 
233
239
  async customize(options, args = {}) {
@@ -507,7 +513,7 @@ ${text}
507
513
  method: "POST",
508
514
  body: new URLSearchParams(body),
509
515
  headers,
510
- signal: AbortSignal.timeout(60 * 1000)
516
+ signal: AbortSignal.timeout(60 * 1000),
511
517
  });
512
518
 
513
519
  const status = await response.status;
@@ -600,7 +606,7 @@ ${text}
600
606
  Accept: "application/json",
601
607
  ...headers,
602
608
  },
603
- signal: AbortSignal.timeout(60 * 1000)
609
+ signal: AbortSignal.timeout(60 * 1000),
604
610
  });
605
611
 
606
612
  const status = await response.status;
@@ -626,12 +632,13 @@ ${text}
626
632
  this._refreshOAuthToken = setInterval(
627
633
  async () => {
628
634
  try {
635
+ console.log("refreshing oauth token");
629
636
  await theOAuth.periodicRefresh();
630
637
  } catch (e) {
631
638
  console.log("periodic refresh", e);
632
639
  }
633
640
  },
634
- 4 * 60 * 60 * 15000,
641
+ this._oauth.tokenRefreshPeriod || 4 * 60 * 60 * 15000,
635
642
  );
636
643
  }
637
644
  }
@@ -1,4 +1,3 @@
1
-
2
1
  import { Registration } from "./registration.mjs";
3
2
  import C from "./constants.mjs";
4
3
 
@@ -20,10 +19,9 @@ class Connection {
20
19
  method: "POST",
21
20
  body: JSON.stringify({}),
22
21
  headers: { "Content-Type": "application/json" },
23
- signal: AbortSignal.timeout(60 * 1000)
22
+ signal: AbortSignal.timeout(60 * 1000),
24
23
  },
25
24
  config,
26
-
27
25
  ),
28
26
  );
29
27
 
@@ -59,7 +57,7 @@ class Connection {
59
57
  method: "POST",
60
58
  body: JSON.stringify({}),
61
59
  headers: { "Content-Type": "application/json" },
62
- signal: AbortSignal.timeout(60 * 1000)
60
+ signal: AbortSignal.timeout(60 * 1000),
63
61
  },
64
62
  this.config,
65
63
  ),
@@ -27,7 +27,7 @@ class Registration {
27
27
  icon,
28
28
  }),
29
29
  headers: { "Content-Type": "application/json" },
30
- signal: AbortSignal.timeout(60 * 1000)
30
+ signal: AbortSignal.timeout(60 * 1000),
31
31
  },
32
32
  config,
33
33
  ),