reactjrx 2.1.0 → 2.1.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/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/queries/useQueries$.live.test.d.ts +1 -0
- package/dist/lib/queries/useQuery$.efficiency.test.d.ts +1 -0
- package/dist/lib/queries/useQuery$.offline.test.d.ts +1 -0
- package/dist/lib/queries/useQuery$.options.test.d.ts +1 -0
- package/dist/lib/queries/useQuery$.persist.test.d.ts +1 -0
- package/dist/tests/liveQuery.d.ts +18 -3
- package/package.json +1 -1
|
@@ -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: () =>
|
|
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;
|