reactjrx 2.1.0 → 2.1.2

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.
@@ -5,14 +5,13 @@ export type ObservableQueryFn<TQueryFnData = unknown, TQueryKey extends QueryKey
5
5
  * Bridges an Observable-based `queryFn` to the Promise-based `queryFn`
6
6
  * expected by TanStack Query. Shared by `useQuery$` and `useQueries$`.
7
7
  *
8
- * Every value is written into the query as soon as the stream emits it. A
9
- * fetch TanStack starts (mount, `refetch()`, `invalidateQueries()`...) ends
10
- * once the stream has a value in the cache, like a regular query, so awaiting
11
- * it settles. Right after it, the bridge starts a fetch that follows the
12
- * stream: it keeps the query `fetching` while the stream runs and ends when
13
- * the stream completes or errors. A refetch takes over a running stream and
14
- * settles with its current value. Cancelling the fetch in progress (the last
15
- * observer unmounting, `cancelQueries`, the query leaving the cache) stops
16
- * the stream.
8
+ * Every value is written into the query as soon as the stream emits it. Each
9
+ * fetch TanStack starts (mount, `refetch()`, `invalidateQueries()`...) runs
10
+ * the `queryFn` and ends once the stream has a value in the cache, like a
11
+ * regular query, so awaiting it settles. Right after it, the bridge starts a
12
+ * fetch that follows the stream: it keeps the query `fetching` while the
13
+ * stream runs and ends when the stream completes or errors. Cancelling the
14
+ * fetch in progress (a refetch replacing it, the last observer unmounting,
15
+ * `cancelQueries`, the query leaving the cache) stops the stream.
17
16
  */
18
17
  export declare function createObservableQueryFn<TQueryFnData = unknown, TQueryKey extends QueryKey = QueryKey>(queryFn: ObservableQueryFn<TQueryFnData, TQueryKey> | undefined): typeof skipToken | ((context: QueryFunctionContext<TQueryKey>) => Promise<TQueryFnData>) | undefined;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,11 +1,15 @@
1
1
  import { QueryClient } from '@tanstack/react-query';
2
2
  import { default as React } from 'react';
3
- import { BehaviorSubject } from 'rxjs';
3
+ import { BehaviorSubject, Observable } from 'rxjs';
4
4
  export declare function createQueryClient(): QueryClient;
5
+ /**
6
+ * Options for a live query. It keeps the default `staleTime`: automatic
7
+ * refetches join a running stream anyway, and a longer one would keep a
8
+ * stopped or restored query from reopening its stream.
9
+ */
5
10
  export declare const liveQueryOptions: {
6
11
  networkMode: "always";
7
12
  gcTime: number;
8
- staleTime: number;
9
13
  };
10
14
  /**
11
15
  * Emulates a live database query: `queryFn` emits a fresh copy of the current
@@ -13,7 +17,18 @@ export declare const liveQueryOptions: {
13
17
  */
14
18
  export declare function createLiveQuerySource(initialItems: string[]): {
15
19
  liveQuery$: BehaviorSubject<string[]>;
16
- queryFn: () => import('rxjs').Observable<string[]>;
20
+ queryFn: () => Observable<string[]>;
21
+ };
22
+ /**
23
+ * Wraps `source` to count its subscriptions: how many were made, and how
24
+ * many are still open.
25
+ */
26
+ export declare function countSubscriptions<T>(source: Observable<T>): {
27
+ counted$: Observable<T>;
28
+ subscriptions: {
29
+ made: number;
30
+ open: number;
31
+ };
17
32
  };
18
33
  export declare function createWrapper(queryClient: QueryClient): ({ children }: {
19
34
  children: React.ReactNode;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "reactjrx",
3
3
  "private": false,
4
- "version": "2.1.0",
4
+ "version": "2.1.2",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"