@tstdl/base 0.93.186 → 0.93.187

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.
@@ -204,7 +204,7 @@ let AuthenticationClientService = class AuthenticationClientService {
204
204
  this.loadToken();
205
205
  this.tokenUpdateBus.messages$
206
206
  .pipe(takeUntil(this.disposeSignal))
207
- .subscribe((token) => this.token.set(token));
207
+ .subscribe(() => this.loadToken());
208
208
  this.refreshLoopPromise ??= this.refreshLoop();
209
209
  }
210
210
  /** @internal */
@@ -504,10 +504,10 @@ let AuthenticationClientService = class AuthenticationClientService {
504
504
  await this.syncClock();
505
505
  }
506
506
  // Helper to sleep until the delay passes OR a vital state change occurs
507
- const waitForNextAction = async (delayMs, referenceExp) => await firstValueFrom(race([
507
+ const waitForNextAction = async (delayMs) => await firstValueFrom(race([
508
508
  timer(Math.max(10, delayMs)),
509
509
  from(this.disposeSignal),
510
- this.token$.pipe(filter((t) => t?.exp !== referenceExp)),
510
+ this.tokenUpdateBus.allMessages$,
511
511
  this.forceRefreshSubject,
512
512
  ]), { defaultValue: undefined });
513
513
  while (this.disposeSignal.isUnset) {
@@ -540,7 +540,7 @@ let AuthenticationClientService = class AuthenticationClientService {
540
540
  });
541
541
  // If lock is held by another instance/tab, wait briefly for it to finish (passive sync)
542
542
  if (!lockResult.success) {
543
- await waitForNextAction(5000, token.exp);
543
+ await waitForNextAction(5000);
544
544
  // If another tab successfully refreshed, the expiration will have changed
545
545
  if (this.token()?.exp !== token.exp) {
546
546
  this.forceRefreshRequested.set(false);
@@ -554,10 +554,10 @@ let AuthenticationClientService = class AuthenticationClientService {
554
554
  const stillNeedsRefresh = this.forceRefreshRequested() || (newNow >= newToken.exp - newBuffer);
555
555
  if (stillNeedsRefresh) {
556
556
  this.logger.warn('Token still needs refresh after attempt. Waiting briefly to avoid tight loop.');
557
- await waitForNextAction(refreshLoopTightLoopDelay, newToken.exp);
557
+ await waitForNextAction(refreshLoopTightLoopDelay);
558
558
  }
559
559
  }
560
- await waitForNextAction(100, newToken?.exp);
560
+ await waitForNextAction(100);
561
561
  continue; // Re-evaluate the loop with the newly refreshed (or synced) token
562
562
  }
563
563
  // 3. Calculate delay and sleep until the next scheduled refresh window
@@ -566,11 +566,11 @@ let AuthenticationClientService = class AuthenticationClientService {
566
566
  if (Number.isNaN(delay)) {
567
567
  delay = minRefreshDelay;
568
568
  }
569
- await waitForNextAction(delay, token.exp);
569
+ await waitForNextAction(delay);
570
570
  }
571
571
  catch (error) {
572
572
  this.logger.error(error);
573
- await waitForNextAction(refreshLoopTightLoopDelay, token.exp);
573
+ await waitForNextAction(refreshLoopTightLoopDelay);
574
574
  }
575
575
  }
576
576
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tstdl/base",
3
- "version": "0.93.186",
3
+ "version": "0.93.187",
4
4
  "author": "Patrick Hein",
5
5
  "publishConfig": {
6
6
  "access": "public"