@buka/nestjs-kit 4.1.2 → 4.1.4
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/CHANGELOG.md +14 -0
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3530,7 +3530,8 @@ let OpenBaoTokenManager = _OpenBaoTokenManager = class OpenBaoTokenManager {
|
|
|
3530
3530
|
return;
|
|
3531
3531
|
}
|
|
3532
3532
|
const renewBuffer = this.config.renewBufferSeconds ?? 30;
|
|
3533
|
-
const
|
|
3533
|
+
const maxCheckInterval = Math.min(10080 * 60 * 1e3, this.leaseDuration * .7 * 1e3);
|
|
3534
|
+
const renewInMs = Math.min(Math.max((this.leaseDuration - renewBuffer) * 1e3, 1e3), maxCheckInterval);
|
|
3534
3535
|
this.renewalTimer = setTimeout(() => {
|
|
3535
3536
|
this.renewToken();
|
|
3536
3537
|
}, renewInMs);
|
|
@@ -8120,10 +8121,10 @@ const KEQ_REQUEST_PROVIDER = {
|
|
|
8120
8121
|
provide: OPEN_BAO_KEQ_REQUEST,
|
|
8121
8122
|
useFactory: (options, tokenManager) => {
|
|
8122
8123
|
const request = new KeqRequest();
|
|
8124
|
+
request.use(formatError());
|
|
8123
8125
|
request.use(setBaseUrl(options.address + "/v1/"));
|
|
8124
8126
|
request.use(setOpenBaoToken(() => tokenManager.getToken()));
|
|
8125
8127
|
request.use(validateStatusCode());
|
|
8126
|
-
request.use(formatError());
|
|
8127
8128
|
return request;
|
|
8128
8129
|
},
|
|
8129
8130
|
inject: [MODULE_OPTIONS_TOKEN$3, OpenBaoTokenManager]
|