@ethlete/query 6.0.0-next.44 → 6.0.0-next.45
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
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @ethlete/query
|
|
2
2
|
|
|
3
|
+
## 6.0.0-next.45
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`cd8956e`](https://github.com/ethlete-io/ethdk/commit/cd8956ed2303074e4de564e6a2763e385acb17ee) Thanks [@TomTomB](https://github.com/TomTomB)! - Query: `withPersistentAuth` no longer leaves a second auth cookie behind on a subdomain, and logout removes the one it wrote.
|
|
8
|
+
|
|
3
9
|
## 6.0.0-next.44
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { inject, Injector, effect, DestroyRef, InjectionToken, EnvironmentInjector, ElementRef, ErrorHandler, createEnvironmentInjector, untracked, signal, linkedSignal, computed, runInInjectionContext, isDevMode, PLATFORM_ID, resource, DOCUMENT, VERSION, makeEnvironmentProviders, provideEnvironmentInitializer, ApplicationRef, assertInInjectionContext, ChangeDetectorRef, ViewContainerRef, TemplateRef, Input, Directive, input, Pipe, ViewEncapsulation, Component, NgZone } from '@angular/core';
|
|
3
3
|
import { UrlTree, Router, RedirectCommand, ActivatedRoute } from '@angular/router';
|
|
4
4
|
import { Observable, defer, from, filter, Subject, Subscription, throwError, of, timer, switchMap, tap, retry, catchError, EMPTY as EMPTY$1, take, takeUntil, finalize, mergeMap, toArray, map, race, NEVER, merge, takeWhile, firstValueFrom, concatMap, fromEvent, throttleTime, interval, startWith, pairwise, BehaviorSubject, combineLatest, ReplaySubject, shareReplay, skip, withLatestFrom, debounceTime } from 'rxjs';
|
|
5
|
-
import { defineStaticProvider, RuntimeError, clamp, randomId, defineRootProvider, isObject, injectUnsavedChangesCoordinator, injectRoute, getCookie, deleteCookie,
|
|
5
|
+
import { defineStaticProvider, RuntimeError, clamp, randomId, defineRootProvider, isObject, injectUnsavedChangesCoordinator, injectRoute, getCookie, setCookie, deleteCookie, getDomain, CORE_VERSION, createDestroy, computedTillTruthy, defineProvider, toProvideFn, toInjectFn, nextFrame, injectQueryParams, injectQueryParamChanges, clone, equal, ET_PROPERTY_REMOVED, previousSignalValue } from '@ethlete/core';
|
|
6
6
|
import { HttpClient, HttpEventType, HttpErrorResponse, HttpResponse, HttpHeaders, HttpStatusCode } from '@angular/common/http';
|
|
7
7
|
import { toObservable, takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
|
|
8
8
|
import { getActiveConsumer, setActiveConsumer } from '@angular/core/primitives/signals';
|
|
@@ -6755,7 +6755,41 @@ const createPersistentAuthFeature = (config, context) => {
|
|
|
6755
6755
|
...(ngDevMode ? [{ debugName: "rememberMeSignal" }] : /* istanbul ignore next */ []));
|
|
6756
6756
|
const cookieDomain = () => config.cookie?.domain ?? null;
|
|
6757
6757
|
const cookiePath = () => config.cookie?.path ?? '/';
|
|
6758
|
-
const
|
|
6758
|
+
const cookieExpiry = (rememberMe) => (rememberMe ? (config.cookie?.expiresInDays ?? 30) : null);
|
|
6759
|
+
const writeCookie = (encryptedToken, expiresInDays) => setCookie(cookieName, encryptedToken, expiresInDays, cookieDomain(), cookiePath(), config.cookie?.sameSite ?? 'lax');
|
|
6760
|
+
// A browser keeps one cookie per name and scope, and `document.cookie` names no scope: a host-only
|
|
6761
|
+
// cookie and one on the registrable domain both show up, oldest first. Only this config's scope may
|
|
6762
|
+
// survive, or a cookie written under the other domain default shadows ours on every read and
|
|
6763
|
+
// outlives logout.
|
|
6764
|
+
const removeOtherScopeCookie = () => {
|
|
6765
|
+
const configuredDomain = cookieDomain();
|
|
6766
|
+
if (configuredDomain) {
|
|
6767
|
+
deleteCookie(cookieName, cookiePath(), null);
|
|
6768
|
+
return;
|
|
6769
|
+
}
|
|
6770
|
+
const registrableDomain = getDomain();
|
|
6771
|
+
if (registrableDomain) {
|
|
6772
|
+
deleteCookie(cookieName, cookiePath(), registrableDomain);
|
|
6773
|
+
}
|
|
6774
|
+
};
|
|
6775
|
+
const removeCookie = () => {
|
|
6776
|
+
deleteCookie(cookieName, cookiePath(), cookieDomain());
|
|
6777
|
+
removeOtherScopeCookie();
|
|
6778
|
+
};
|
|
6779
|
+
// Runs before `tryLogin` reads the cookie, so the token an older version left in the other scope
|
|
6780
|
+
// still starts a session instead of being dropped.
|
|
6781
|
+
const adoptOtherScopeCookie = () => {
|
|
6782
|
+
if (context.isTabLocalSession())
|
|
6783
|
+
return;
|
|
6784
|
+
const carriedToken = getCookie(cookieName);
|
|
6785
|
+
if (!carriedToken)
|
|
6786
|
+
return;
|
|
6787
|
+
removeOtherScopeCookie();
|
|
6788
|
+
if (getCookie(cookieName))
|
|
6789
|
+
return;
|
|
6790
|
+
writeCookie(carriedToken, cookieExpiry(rememberMeSignal()));
|
|
6791
|
+
};
|
|
6792
|
+
adoptOtherScopeCookie();
|
|
6759
6793
|
effect(() => {
|
|
6760
6794
|
const token = refreshToken();
|
|
6761
6795
|
const rememberMe = rememberMeSignal();
|
|
@@ -6770,8 +6804,8 @@ const createPersistentAuthFeature = (config, context) => {
|
|
|
6770
6804
|
// that actually end a session instead, below.
|
|
6771
6805
|
if (!token)
|
|
6772
6806
|
return;
|
|
6773
|
-
|
|
6774
|
-
|
|
6807
|
+
removeOtherScopeCookie();
|
|
6808
|
+
writeCookie(encryptToken(token), cookieExpiry(rememberMe));
|
|
6775
6809
|
});
|
|
6776
6810
|
effect(() => {
|
|
6777
6811
|
const endCause = context.sessionEndCause();
|
|
@@ -9662,7 +9696,7 @@ const armQueryDevtoolsOverrideTransfer = (recorder, ops) => {
|
|
|
9662
9696
|
|
|
9663
9697
|
// Generated from package.json by tools/scripts/generate-version.js - do not edit.
|
|
9664
9698
|
/** The version of `@ethlete/query` this build was cut from. */
|
|
9665
|
-
const QUERY_VERSION = '6.0.0-next.
|
|
9699
|
+
const QUERY_VERSION = '6.0.0-next.45';
|
|
9666
9700
|
|
|
9667
9701
|
/** How deep a schema is expanded before a nested branch is given up on. */
|
|
9668
9702
|
const MAX_DEPTH = 12;
|