@orbis-systems/orbis-api-clients 0.5.0 → 0.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.
@@ -427,8 +427,8 @@ class $538ed1203bac2e79$export$f280b732bbc5934b extends (0, $3621850f1f570615$ex
427
427
  }
428
428
  if (this.config.autoRenewToken !== false && this.isTokenExpired(accessToken)) try {
429
429
  await this.lock.runExclusive(async ()=>{
430
- (0, $ixKlR$consola.consola).info("Token expired. Renewing\u2026");
431
- await this.renewToken();
430
+ if (this.config.debug) (0, $ixKlR$consola.consola).debug("Token expired. Renewing\u2026");
431
+ accessToken = (await this.renewToken()).accessToken;
432
432
  this.lock.cancel();
433
433
  });
434
434
  } catch (error) {
@@ -447,9 +447,11 @@ class $538ed1203bac2e79$export$f280b732bbc5934b extends (0, $3621850f1f570615$ex
447
447
  return (0, $ixKlR$datefns.isBefore)((0, $ixKlR$datefns.subMinutes)(payload.exp * 1000, 5), Date.now());
448
448
  }
449
449
  async renewToken() {
450
- if (!this.renewTokenCallback) throw new Error('No renew token callback provided');
451
- const authData = await this.renewTokenCallback();
450
+ const callback = this.config.onRenewToken ?? this.renewTokenCallback;
451
+ if (!callback) throw new Error('No renew token callback provided');
452
+ const authData = await callback();
452
453
  this.setAuthData(authData);
454
+ return authData;
453
455
  }
454
456
  }
455
457
 
@@ -464,7 +466,7 @@ class $4d6a8fd4875e2166$export$c3b634545cedfd73 extends (0, $538ed1203bac2e79$ex
464
466
  const errorCode = matched[1]?.toString() || '';
465
467
  return {
466
468
  orbisErrorCode: errorCode,
467
- orbisErrorMessage: this.config.onErrorTranslate?.(errorCode) || (0, $ixKlR$lodash.startCase)((0, $ixKlR$lodash.camelCase)(errorCode.replace('ERR_', '')))
469
+ orbisErrorMessage: this.config.onErrorTranslate?.(errorCode) ?? (0, $ixKlR$lodash.startCase)((0, $ixKlR$lodash.camelCase)(errorCode.replace('ERR_', '')))
468
470
  };
469
471
  }
470
472
  }
@@ -5577,6 +5579,38 @@ class $2117554f67927a83$export$68997731bcbd545c {
5577
5579
  contentType: (0, $3621850f1f570615$export$e2e108cbe2e4f865).Json
5578
5580
  });
5579
5581
  }
5582
+ /**
5583
+ * @tags Transfers
5584
+ * @name CryptoWithdrawalEstimate
5585
+ * @summary Crypto Withdrawal Estimate
5586
+ * @request POST:/transfer/crypto/withdrawal/estimate
5587
+ * @secure
5588
+ */ cryptoWithdrawalEstimate(data, config) {
5589
+ return this.apiClient.request({
5590
+ ...config,
5591
+ url: `/transfer/crypto/withdrawal/estimate`,
5592
+ method: 'POST',
5593
+ data: data,
5594
+ secure: true,
5595
+ contentType: (0, $3621850f1f570615$export$e2e108cbe2e4f865).Json
5596
+ });
5597
+ }
5598
+ /**
5599
+ * @tags Transfers
5600
+ * @name CryptoWithdrawal
5601
+ * @summary Crypto Withdrawal
5602
+ * @request POST:/transfer/crypto/withdraw
5603
+ * @secure
5604
+ */ cryptoWithdrawal(data, config) {
5605
+ return this.apiClient.request({
5606
+ ...config,
5607
+ url: `/transfer/crypto/withdraw`,
5608
+ method: 'POST',
5609
+ data: data,
5610
+ secure: true,
5611
+ contentType: (0, $3621850f1f570615$export$e2e108cbe2e4f865).Json
5612
+ });
5613
+ }
5580
5614
  }
5581
5615
 
5582
5616
 
@@ -6935,7 +6969,7 @@ class $a2bb19832837fbd4$export$9c691b12c2ddd3aa extends (0, $780091c10287ceed$ex
6935
6969
  ...config,
6936
6970
  authSchema: 'SessionId',
6937
6971
  defaultSecure: true
6938
- }));
6972
+ })), this.config = config;
6939
6973
  this.advisory = new (0, $4a7999c6f9764642$export$422b120052f6cfe8)(this.apiClient);
6940
6974
  this.authentication = new (0, $bb03ab235021c56e$export$d9e3c9dc7eaad0c3)(this.apiClient);
6941
6975
  this.blacklist = new (0, $06f8f19ecf792c6e$export$5c19a9452db0f3f6)(this.apiClient);