@aloma.io/integration-sdk 3.3.58 → 3.3.60
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 +21 -21
- package/package.json +1 -1
- package/src/internal/index.mjs +22 -19
package/build/internal/index.mjs
CHANGED
@@ -151,7 +151,6 @@ class OAuthFetcher extends Fetcher {
|
|
151
151
|
const local = this, oauth = local.oauth;
|
152
152
|
if (!oauth.refreshToken())
|
153
153
|
return;
|
154
|
-
console.log('refreshing');
|
155
154
|
await local.getToken(true);
|
156
155
|
}
|
157
156
|
async customize(options, args = {}) {
|
@@ -189,7 +188,7 @@ class OAuth {
|
|
189
188
|
}
|
190
189
|
async periodicRefresh() {
|
191
190
|
const clients = this.clients;
|
192
|
-
console.log('refreshing clients', clients.length);
|
191
|
+
console.log('refreshing oauth clients', clients.length);
|
193
192
|
for (let i = 0; i < clients.length; ++i) {
|
194
193
|
const client = clients[0];
|
195
194
|
await client.periodicRefresh();
|
@@ -305,14 +304,14 @@ ${text}
|
|
305
304
|
this.startOAuth = async function (args) {
|
306
305
|
if (!this._oauth)
|
307
306
|
throw new Error("oauth not configured");
|
308
|
-
const clientId =
|
309
|
-
|
310
|
-
|
307
|
+
const clientId = process.env.OAUTH_CLIENT_ID ||
|
308
|
+
decrypted.clientId ||
|
309
|
+
this._oauth.clientId;
|
311
310
|
if (!clientId)
|
312
311
|
throw new Error("clientId not configured");
|
313
|
-
const scopes =
|
314
|
-
process.env.OAUTH_SCOPE ||
|
312
|
+
const scopes = process.env.OAUTH_SCOPE ||
|
315
313
|
decrypted.scope ||
|
314
|
+
this._oauth.scope ||
|
316
315
|
"";
|
317
316
|
const useCodeChallenge = !!that._oauth.useCodeChallenge;
|
318
317
|
return {
|
@@ -332,14 +331,15 @@ ${text}
|
|
332
331
|
const doFinish = async () => {
|
333
332
|
if (!arg.code || !arg.redirectURI)
|
334
333
|
throw new Error("need code and redirectUri");
|
335
|
-
const clientId =
|
336
|
-
|
337
|
-
|
334
|
+
const clientId = process.env.OAUTH_CLIENT_ID ||
|
335
|
+
decrypted.clientId ||
|
336
|
+
that._oauth.clientId;
|
337
|
+
;
|
338
338
|
if (!clientId)
|
339
339
|
throw new Error("clientId not configured");
|
340
|
-
const clientSecret =
|
341
|
-
|
342
|
-
|
340
|
+
const clientSecret = process.env.OAUTH_CLIENT_SECRET ||
|
341
|
+
decrypted.clientSecret ||
|
342
|
+
that._oauth.clientSecret;
|
343
343
|
if (!clientSecret)
|
344
344
|
throw new Error("clientSecret not configured");
|
345
345
|
const additionalTokenArgs = that._oauth.additionalTokenArgs || {};
|
@@ -417,14 +417,14 @@ ${text}
|
|
417
417
|
};
|
418
418
|
const that = this;
|
419
419
|
const getRefreshToken = async (refreshToken) => {
|
420
|
-
const clientId =
|
421
|
-
|
422
|
-
|
420
|
+
const clientId = process.env.OAUTH_CLIENT_ID ||
|
421
|
+
decrypted.clientId ||
|
422
|
+
that._oauth.clientId;
|
423
423
|
if (!clientId)
|
424
424
|
throw new Error("clientId not configured");
|
425
|
-
const clientSecret =
|
426
|
-
|
427
|
-
|
425
|
+
const clientSecret = process.env.OAUTH_CLIENT_SECRET ||
|
426
|
+
decrypted.clientSecret ||
|
427
|
+
that._oauth.clientSecret;
|
428
428
|
if (!clientSecret)
|
429
429
|
throw new Error("clientSecret not configured");
|
430
430
|
const useAuthHeader = !!that._oauth.useAuthHeader;
|
@@ -464,14 +464,14 @@ ${text}
|
|
464
464
|
if (theOAuth) {
|
465
465
|
clearInterval(this._refreshOAuthToken);
|
466
466
|
if (!(this._oauth.noPeriodicTokenRefresh === false)) {
|
467
|
-
this._refreshOAuthToken =
|
467
|
+
this._refreshOAuthToken = setInterval(async () => {
|
468
468
|
try {
|
469
469
|
await theOAuth.periodicRefresh();
|
470
470
|
}
|
471
471
|
catch (e) {
|
472
472
|
console.log('periodic refresh', e);
|
473
473
|
}
|
474
|
-
},
|
474
|
+
}, 4 * 60 * 60 * 15000);
|
475
475
|
}
|
476
476
|
}
|
477
477
|
start({
|
package/package.json
CHANGED
package/src/internal/index.mjs
CHANGED
@@ -192,7 +192,6 @@ class OAuthFetcher extends Fetcher {
|
|
192
192
|
const local = this, oauth = local.oauth;
|
193
193
|
if (!oauth.refreshToken()) return;
|
194
194
|
|
195
|
-
console.log('refreshing')
|
196
195
|
await local.getToken(true);
|
197
196
|
}
|
198
197
|
|
@@ -241,7 +240,7 @@ class OAuth {
|
|
241
240
|
async periodicRefresh() {
|
242
241
|
const clients = this.clients;
|
243
242
|
|
244
|
-
console.log('refreshing clients', clients.length)
|
243
|
+
console.log('refreshing oauth clients', clients.length)
|
245
244
|
|
246
245
|
for (let i = 0; i < clients.length; ++i) {
|
247
246
|
const client = clients[0];
|
@@ -379,16 +378,16 @@ ${text}
|
|
379
378
|
this.startOAuth = async function (args) {
|
380
379
|
if (!this._oauth) throw new Error("oauth not configured");
|
381
380
|
|
382
|
-
const clientId =
|
383
|
-
|
384
|
-
|
385
|
-
|
381
|
+
const clientId = process.env.OAUTH_CLIENT_ID ||
|
382
|
+
decrypted.clientId ||
|
383
|
+
this._oauth.clientId;
|
384
|
+
|
386
385
|
if (!clientId) throw new Error("clientId not configured");
|
387
386
|
|
388
387
|
const scopes =
|
389
|
-
this._oauth.scope ||
|
390
388
|
process.env.OAUTH_SCOPE ||
|
391
389
|
decrypted.scope ||
|
390
|
+
this._oauth.scope ||
|
392
391
|
"";
|
393
392
|
const useCodeChallenge = !!that._oauth.useCodeChallenge;
|
394
393
|
|
@@ -413,16 +412,18 @@ ${text}
|
|
413
412
|
if (!arg.code || !arg.redirectURI)
|
414
413
|
throw new Error("need code and redirectUri");
|
415
414
|
|
416
|
-
const clientId =
|
417
|
-
|
418
|
-
|
419
|
-
|
415
|
+
const clientId = process.env.OAUTH_CLIENT_ID ||
|
416
|
+
decrypted.clientId ||
|
417
|
+
|
418
|
+
that._oauth.clientId;
|
419
|
+
|
420
|
+
;
|
420
421
|
if (!clientId) throw new Error("clientId not configured");
|
421
422
|
|
422
423
|
const clientSecret =
|
423
|
-
that._oauth.clientSecret ||
|
424
424
|
process.env.OAUTH_CLIENT_SECRET ||
|
425
|
-
decrypted.clientSecret
|
425
|
+
decrypted.clientSecret ||
|
426
|
+
that._oauth.clientSecret;
|
426
427
|
if (!clientSecret) throw new Error("clientSecret not configured");
|
427
428
|
|
428
429
|
const additionalTokenArgs = that._oauth.additionalTokenArgs || {};
|
@@ -516,15 +517,17 @@ ${text}
|
|
516
517
|
|
517
518
|
const getRefreshToken = async (refreshToken) => {
|
518
519
|
const clientId =
|
519
|
-
|
520
|
+
|
520
521
|
process.env.OAUTH_CLIENT_ID ||
|
521
|
-
decrypted.clientId
|
522
|
+
decrypted.clientId ||
|
523
|
+
that._oauth.clientId;
|
522
524
|
if (!clientId) throw new Error("clientId not configured");
|
523
525
|
|
524
526
|
const clientSecret =
|
525
|
-
|
527
|
+
|
526
528
|
process.env.OAUTH_CLIENT_SECRET ||
|
527
|
-
decrypted.clientSecret
|
529
|
+
decrypted.clientSecret ||
|
530
|
+
that._oauth.clientSecret;
|
528
531
|
if (!clientSecret) throw new Error("clientSecret not configured");
|
529
532
|
|
530
533
|
const useAuthHeader = !!that._oauth.useAuthHeader;
|
@@ -574,7 +577,7 @@ ${text}
|
|
574
577
|
clearInterval(this._refreshOAuthToken);
|
575
578
|
|
576
579
|
if (!(this._oauth.noPeriodicTokenRefresh === false)) {
|
577
|
-
this._refreshOAuthToken =
|
580
|
+
this._refreshOAuthToken = setInterval(async () => {
|
578
581
|
|
579
582
|
try
|
580
583
|
{
|
@@ -582,7 +585,7 @@ ${text}
|
|
582
585
|
} catch(e) {
|
583
586
|
console.log('periodic refresh', e);
|
584
587
|
}
|
585
|
-
},
|
588
|
+
}, 4 * 60 * 60 * 15000);
|
586
589
|
}
|
587
590
|
|
588
591
|
}
|