@ethlete/query 5.43.0 → 5.43.1
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 +8 -0
- package/fesm2022/ethlete-query.mjs +24 -15
- package/fesm2022/ethlete-query.mjs.map +1 -1
- package/index.d.ts +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @ethlete/query
|
|
2
2
|
|
|
3
|
+
## 5.43.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`f40e8a2`](https://github.com/ethlete-io/ethdk/commit/f40e8a224a6f0c527f4204e696966a1416da0f43) Thanks [@TomTomB](https://github.com/TomTomB)! - Fix query state observable not getting properly memorized
|
|
8
|
+
|
|
9
|
+
- [`f40e8a2`](https://github.com/ethlete-io/ethdk/commit/f40e8a224a6f0c527f4204e696966a1416da0f43) Thanks [@TomTomB](https://github.com/TomTomB)! - Fix bearer auth provider causing maximum callstack exceeded errors in certain edge cases
|
|
10
|
+
|
|
3
11
|
## 5.43.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i1 from '@ethlete/core';
|
|
2
2
|
import { createDestroy, computedTillTruthy, syncSignal, RuntimeError, isObject, injectRoute, getDomain, getCookie, setCookie, deleteCookie, clamp, previousSignalValue, DelayableDirective, nextFrame, injectQueryParamChanges, injectQueryParams, clone, equal, ET_PROPERTY_REMOVED } from '@ethlete/core';
|
|
3
|
-
import { Observable, takeUntil, startWith, pairwise, tap, switchMap, of, BehaviorSubject, Subject, fromEvent, timer, take, Subscription, retry, throwError, catchError, ReplaySubject, map, shareReplay, interval, skip, takeWhile, filter, combineLatest, withLatestFrom, debounceTime, merge } from 'rxjs';
|
|
3
|
+
import { Observable, takeUntil, startWith, pairwise, tap, switchMap, of, BehaviorSubject, Subject, fromEvent, timer, take, Subscription, retry, throwError, catchError, ReplaySubject, map, shareReplay, interval, skip, takeWhile, filter, combineLatest, EMPTY, withLatestFrom, debounceTime, merge } from 'rxjs';
|
|
4
4
|
import { HttpStatusCode, HttpErrorResponse, HttpEventType, HttpClient, HttpHeaders } from '@angular/common/http';
|
|
5
5
|
import * as i0 from '@angular/core';
|
|
6
6
|
import { assertInInjectionContext, inject, Injector, runInInjectionContext, signal, effect, untracked, computed, isDevMode, InjectionToken, EnvironmentInjector, createEnvironmentInjector, DestroyRef, ɵEffectScheduler as _EffectScheduler, ErrorHandler, Pipe, ChangeDetectorRef, input, ViewContainerRef, TemplateRef, Directive, Input, ElementRef, ViewEncapsulation, ChangeDetectionStrategy, Component, NgZone } from '@angular/core';
|
|
@@ -4342,13 +4342,16 @@ class Query {
|
|
|
4342
4342
|
return ++this._currentLocalId;
|
|
4343
4343
|
}
|
|
4344
4344
|
get state$() {
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4345
|
+
if (!this._memoizedState$) {
|
|
4346
|
+
this._memoizedState$ = this._state$.pipe(tap((s) => {
|
|
4347
|
+
if (!this._client.config.logging?.preparedQuerySubscriptions)
|
|
4348
|
+
return;
|
|
4349
|
+
if (isQueryStatePrepared(s)) {
|
|
4350
|
+
console.warn(`Query ${this._routeWithParams} was subscribed to in the prepared state. Did you forget to call .execute()?`);
|
|
4351
|
+
}
|
|
4352
|
+
}), switchMap((s) => this._transformState(s)), shareReplay({ bufferSize: 1, refCount: true }));
|
|
4353
|
+
}
|
|
4354
|
+
return this._memoizedState$;
|
|
4352
4355
|
}
|
|
4353
4356
|
/**
|
|
4354
4357
|
* The current state of the query.
|
|
@@ -4452,6 +4455,7 @@ class Query {
|
|
|
4452
4455
|
* @internal
|
|
4453
4456
|
*/
|
|
4454
4457
|
this._isPollingPaused = false;
|
|
4458
|
+
this._memoizedState$ = null;
|
|
4455
4459
|
this._state$ = new BehaviorSubject({
|
|
4456
4460
|
type: "PREPARED" /* QueryStateType.Prepared */,
|
|
4457
4461
|
meta: { id: this._currentLocalId, triggeredVia: 'program' },
|
|
@@ -4493,16 +4497,19 @@ class Query {
|
|
|
4493
4497
|
// The tokens might get set without a refresh query being created (e.g.) directly after login.
|
|
4494
4498
|
authProvider.currentRefreshQuery$.pipe(switchQueryState(), takeUntilResponse()),
|
|
4495
4499
|
authProvider.tokens$.pipe(take(1)),
|
|
4496
|
-
]).pipe(takeUntil(this._onAbort$),
|
|
4497
|
-
if (state) {
|
|
4498
|
-
return
|
|
4500
|
+
]).pipe(takeUntil(this._onAbort$), switchMap(([state, tokens]) => {
|
|
4501
|
+
if (state && isQueryStateLoading(state)) {
|
|
4502
|
+
return EMPTY;
|
|
4499
4503
|
}
|
|
4500
|
-
return !!tokens;
|
|
4501
|
-
}), tap(([state]) => {
|
|
4502
4504
|
if (isQueryStateFailure(state)) {
|
|
4503
4505
|
this._updateEntityState({ type: 'failure', error: state.error, headers: {} }, meta, options);
|
|
4506
|
+
return EMPTY;
|
|
4507
|
+
}
|
|
4508
|
+
if (!state && !(tokens?.token || tokens?.refreshToken)) {
|
|
4509
|
+
return EMPTY;
|
|
4504
4510
|
}
|
|
4505
|
-
|
|
4511
|
+
return of(true);
|
|
4512
|
+
}), take(1));
|
|
4506
4513
|
}
|
|
4507
4514
|
goSignal
|
|
4508
4515
|
.pipe(switchMap(() => {
|
|
@@ -4915,7 +4922,9 @@ class BearerAuthProvider {
|
|
|
4915
4922
|
}) ?? {
|
|
4916
4923
|
body: { refreshToken: currentRefreshToken },
|
|
4917
4924
|
};
|
|
4918
|
-
const query = this._config.refreshConfig.queryCreator
|
|
4925
|
+
const query = this._config.refreshConfig.queryCreator
|
|
4926
|
+
.prepare(args)
|
|
4927
|
+
.execute({ skipCache: true, _isUnauthorizedRetry: true });
|
|
4919
4928
|
this._currentRefreshQuery$.next(query);
|
|
4920
4929
|
this._currentRefreshQuery$
|
|
4921
4930
|
.pipe(switchQueryState(), tap((state) => {
|