@aloma.io/integration-sdk 3.5.1 → 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.
package/build/internal/index.mjs
CHANGED
@@ -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;
|
package/package.json
CHANGED
@@ -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(
|
33
|
-
|
32
|
+
const desc = docs.find(
|
33
|
+
(what: any) => what.kind === "description",
|
34
|
+
)?.value;
|
34
35
|
|
35
|
-
const example = docs.find(
|
36
|
-
|
36
|
+
const example = docs.find(
|
37
|
+
(what: any) => what.kind === "example",
|
38
|
+
)?.value;
|
37
39
|
|
38
40
|
let eg;
|
39
41
|
if (example) {
|
package/src/internal/index.mjs
CHANGED
@@ -123,7 +123,10 @@ class Fetcher {
|
|
123
123
|
options.body = JSON.stringify(options.body);
|
124
124
|
}
|
125
125
|
|
126
|
-
const ret = await fetch(theURL, {
|
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,13 +632,13 @@ ${text}
|
|
626
632
|
this._refreshOAuthToken = setInterval(
|
627
633
|
async () => {
|
628
634
|
try {
|
629
|
-
console.log(
|
635
|
+
console.log("refreshing oauth token");
|
630
636
|
await theOAuth.periodicRefresh();
|
631
637
|
} catch (e) {
|
632
638
|
console.log("periodic refresh", e);
|
633
639
|
}
|
634
640
|
},
|
635
|
-
this._oauth.tokenRefreshPeriod ||
|
641
|
+
this._oauth.tokenRefreshPeriod || 4 * 60 * 60 * 15000,
|
636
642
|
);
|
637
643
|
}
|
638
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
|
),
|