@aloma.io/integration-sdk 3.5.2 → 3.6.0
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.
@@ -22,10 +22,8 @@ const transform = (meta) => {
|
|
22
22
|
.getSignatures()
|
23
23
|
.map((sig) => {
|
24
24
|
const docs = sig.getJSDoc().serialize() || [];
|
25
|
-
const desc = docs.find((what) => what.kind === "description")
|
26
|
-
|
27
|
-
const example = docs.find((what) => what.kind === "example")
|
28
|
-
?.value;
|
25
|
+
const desc = docs.find((what) => what.kind === "description")?.value;
|
26
|
+
const example = docs.find((what) => what.kind === "example")?.value;
|
29
27
|
let eg;
|
30
28
|
if (example) {
|
31
29
|
const parts = example.split(/```/);
|
package/build/internal/index.mjs
CHANGED
@@ -31,8 +31,10 @@ const unwrap0 = (ret, body, options) => {
|
|
31
31
|
const unwrap = async (ret, options) => {
|
32
32
|
if (options?.text)
|
33
33
|
return unwrap0(ret, await ret.text(), options);
|
34
|
-
if (options?.base64)
|
35
|
-
|
34
|
+
if (options?.base64) {
|
35
|
+
const base64 = Buffer.from(await ret.arrayBuffer()).toString('base64');
|
36
|
+
return unwrap0(ret, base64, options);
|
37
|
+
}
|
36
38
|
const text = await ret.text();
|
37
39
|
try {
|
38
40
|
return unwrap0(ret, JSON.parse(text), options);
|
@@ -95,7 +97,10 @@ class Fetcher {
|
|
95
97
|
options?.headers?.["Content-type"] === "application/json") {
|
96
98
|
options.body = JSON.stringify(options.body);
|
97
99
|
}
|
98
|
-
const ret = await fetch(theURL, {
|
100
|
+
const ret = await fetch(theURL, {
|
101
|
+
...options,
|
102
|
+
signal: AbortSignal.timeout(30 * 60 * 1000),
|
103
|
+
});
|
99
104
|
const status = await ret.status;
|
100
105
|
if (status > 399) {
|
101
106
|
const text = await ret.text();
|
@@ -173,11 +178,11 @@ class OAuthFetcher extends Fetcher {
|
|
173
178
|
}
|
174
179
|
async periodicRefresh() {
|
175
180
|
const local = this, oauth = local.oauth;
|
176
|
-
console.log(
|
181
|
+
console.log("refreshing oauth token, have token", !!oauth.refreshToken());
|
177
182
|
if (!oauth.refreshToken())
|
178
183
|
return;
|
179
184
|
await local.getToken(true);
|
180
|
-
console.log(
|
185
|
+
console.log("refreshed oauth token");
|
181
186
|
}
|
182
187
|
async customize(options, args = {}) {
|
183
188
|
const local = this;
|
@@ -407,7 +412,7 @@ ${text}
|
|
407
412
|
method: "POST",
|
408
413
|
body: new URLSearchParams(body),
|
409
414
|
headers,
|
410
|
-
signal: AbortSignal.timeout(60 * 1000)
|
415
|
+
signal: AbortSignal.timeout(60 * 1000),
|
411
416
|
});
|
412
417
|
const status = await response.status;
|
413
418
|
const text = await response.text();
|
@@ -483,7 +488,7 @@ ${text}
|
|
483
488
|
Accept: "application/json",
|
484
489
|
...headers,
|
485
490
|
},
|
486
|
-
signal: AbortSignal.timeout(60 * 1000)
|
491
|
+
signal: AbortSignal.timeout(60 * 1000),
|
487
492
|
});
|
488
493
|
const status = await response.status;
|
489
494
|
const text = await response.text();
|
@@ -502,13 +507,13 @@ ${text}
|
|
502
507
|
if (!(this._oauth.noPeriodicTokenRefresh === false)) {
|
503
508
|
this._refreshOAuthToken = setInterval(async () => {
|
504
509
|
try {
|
505
|
-
console.log(
|
510
|
+
console.log("refreshing oauth token");
|
506
511
|
await theOAuth.periodicRefresh();
|
507
512
|
}
|
508
513
|
catch (e) {
|
509
514
|
console.log("periodic refresh", e);
|
510
515
|
}
|
511
|
-
}, this._oauth.tokenRefreshPeriod ||
|
516
|
+
}, this._oauth.tokenRefreshPeriod || 4 * 60 * 60 * 15000);
|
512
517
|
}
|
513
518
|
}
|
514
519
|
const getBlob = (id) => {
|
@@ -12,7 +12,7 @@ class Connection {
|
|
12
12
|
method: "POST",
|
13
13
|
body: JSON.stringify({}),
|
14
14
|
headers: { "Content-Type": "application/json" },
|
15
|
-
signal: AbortSignal.timeout(60 * 1000)
|
15
|
+
signal: AbortSignal.timeout(60 * 1000),
|
16
16
|
}, config));
|
17
17
|
if (response.status === 401) {
|
18
18
|
config.setToken(await new Registration(local.config).run());
|
@@ -41,7 +41,7 @@ class Connection {
|
|
41
41
|
method: "POST",
|
42
42
|
body: JSON.stringify({}),
|
43
43
|
headers: { "Content-Type": "application/json" },
|
44
|
-
signal: AbortSignal.timeout(60 * 1000)
|
44
|
+
signal: AbortSignal.timeout(60 * 1000),
|
45
45
|
}, this.config));
|
46
46
|
}
|
47
47
|
catch (e) {
|
@@ -21,7 +21,7 @@ class Registration {
|
|
21
21
|
icon,
|
22
22
|
}),
|
23
23
|
headers: { "Content-Type": "application/json" },
|
24
|
-
signal: AbortSignal.timeout(60 * 1000)
|
24
|
+
signal: AbortSignal.timeout(60 * 1000),
|
25
25
|
}, config));
|
26
26
|
if (response.status === 200)
|
27
27
|
return (await response.json()).key;
|
package/package.json
CHANGED
package/src/internal/index.mjs
CHANGED
@@ -39,7 +39,11 @@ const unwrap0 = (ret, body, options) => {
|
|
39
39
|
const unwrap = async (ret, options) => {
|
40
40
|
if (options?.text) return unwrap0(ret, await ret.text(), options);
|
41
41
|
if (options?.base64)
|
42
|
-
|
42
|
+
{
|
43
|
+
const base64 = Buffer.from(await ret.arrayBuffer()).toString('base64');
|
44
|
+
|
45
|
+
return unwrap0(ret, base64, options);
|
46
|
+
}
|
43
47
|
|
44
48
|
const text = await ret.text();
|
45
49
|
|