@ethlete/query 6.0.0-next.13 → 6.0.0-next.15

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,19 @@
1
1
  # @ethlete/query
2
2
 
3
+ ## 6.0.0-next.15
4
+
5
+ ### Patch Changes
6
+
7
+ - [#3022](https://github.com/ethlete-io/ethdk/pull/3022) [`9431073`](https://github.com/ethlete-io/ethdk/commit/9431073bb693aa10bbb84d5196597cb2c4b7463f) Thanks [@github-actions](https://github.com/apps/github-actions)! - Overlays and menus now open on insecure origins (plain-HTTP pages on a LAN IP, not just `localhost`/HTTPS). Id generation used `crypto.randomUUID()`, which is `undefined` outside a secure context, so opening any dialog, sheet, anchored overlay or menu threw and only the backdrop appeared. A new `randomId()` helper in `@ethlete/core` uses `crypto.randomUUID()` when available and falls back to `getRandomValues` otherwise.
8
+
9
+ ## 6.0.0-next.14
10
+
11
+ ### Patch Changes
12
+
13
+ - [#3019](https://github.com/ethlete-io/ethdk/pull/3019) [`b5655a9`](https://github.com/ethlete-io/ethdk/commit/b5655a9124b2ffc4d6982ca20be360b227a37107) Thanks [@github-actions](https://github.com/apps/github-actions)! - Query cache: a cached request now correctly becomes stale once its freshness
14
+ window (from `cache-control` / `expires`) elapses, so `execute({ allowCache: true })`
15
+ refetches instead of serving the cached response forever.
16
+
3
17
  ## 6.0.0-next.13
4
18
 
5
19
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { isDevMode, DestroyRef, InjectionToken, inject, Injector, EnvironmentInjector, ErrorHandler, createEnvironmentInjector, effect, untracked, signal, linkedSignal, computed, runInInjectionContext, assertInInjectionContext, ChangeDetectorRef, ViewContainerRef, TemplateRef, Input, Directive, ElementRef, input, Pipe, ViewEncapsulation, Component, DOCUMENT, NgZone } from '@angular/core';
3
- import { createStaticProvider, RuntimeError, clamp, createDestroy, computedTillTruthy, getCookie, setCookie, deleteCookie, createProvider, nextFrame, createRootProvider, isObject, injectRoute, getDomain, injectQueryParamChanges, injectQueryParams, clone, equal, ET_PROPERTY_REMOVED, previousSignalValue } from '@ethlete/core';
3
+ import { createStaticProvider, RuntimeError, clamp, createDestroy, computedTillTruthy, getCookie, setCookie, deleteCookie, createProvider, nextFrame, randomId, createRootProvider, isObject, injectRoute, getDomain, injectQueryParamChanges, injectQueryParams, clone, equal, ET_PROPERTY_REMOVED, previousSignalValue } from '@ethlete/core';
4
4
  import { filter, Subject, Subscription, Observable, tap, retry, throwError, timer, catchError, takeUntil, startWith, pairwise, switchMap, of, BehaviorSubject, fromEvent, take, ReplaySubject, map, shareReplay, interval, skip, takeWhile, combineLatest, EMPTY, withLatestFrom, debounceTime, merge, throttleTime } from 'rxjs';
5
5
  import { toObservable, takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
6
6
  import { HttpClient, HttpEventType, HttpErrorResponse, HttpHeaders, HttpStatusCode } from '@angular/common/http';
@@ -1576,11 +1576,14 @@ const createHttpRequest = (options) => {
1576
1576
  ...(ngDevMode ? [{ debugName: "lastExecuteTime" }] : /* istanbul ignore next */ []));
1577
1577
  const expiresIn = signal(null, /* @ts-ignore */
1578
1578
  ...(ngDevMode ? [{ debugName: "expiresIn" }] : /* istanbul ignore next */ []));
1579
- const isStale = computed(() => {
1579
+ // NOTE: This must be a plain function, not a `computed`. The freshness check compares against
1580
+ // `Date.now()`, which is not reactive, so a memoized computed would only ever recompute when
1581
+ // `expiresIn` changes — once it evaluated to `false` (fresh) it would stay `false` forever, even
1582
+ // after the window elapsed, turning every `allowCache` execute into a permanent cache hit.
1583
+ const isStale = () => {
1580
1584
  const expiresInTs = expiresIn();
1581
1585
  return expiresInTs === null || expiresInTs < Date.now();
1582
- }, /* @ts-ignore */
1583
- ...(ngDevMode ? [{ debugName: "isStale" }] : /* istanbul ignore next */ []));
1586
+ };
1584
1587
  const createStream = () => {
1585
1588
  const headers = typeof args?.headers === 'function' ? args.headers() : args?.headers;
1586
1589
  return dependencies.httpClient
@@ -5057,7 +5060,7 @@ const removeFrom = (store, { where, id }) => {
5057
5060
  .subscribe();
5058
5061
  };
5059
5062
 
5060
- const generateUuid = () => crypto.randomUUID();
5063
+ const generateUuid = () => randomId();
5061
5064
  const createQueryRepository = (config) => {
5062
5065
  const cache = new Map();
5063
5066
  const eventsSubject = new Subject();