reactjrx 1.142.0 → 1.142.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.
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,4 @@
1
1
  import { Observable } from 'rxjs';
2
- export type SubscribeSourceFactory<Data> = (() => Observable<Data>) | (() => Observable<Data> | undefined) | (() => Promise<Data>) | (() => Data);
2
+ type SubscribeSourceFactory<Data> = (() => Observable<Data>) | (() => Observable<Data> | undefined) | (() => Promise<Data>) | (() => Data);
3
3
  export type SubscribeSource<Data> = SubscribeSourceFactory<Data> | Promise<Data> | Observable<Data> | Data;
4
+ export {};
@@ -1,20 +1,30 @@
1
+ import { Observable } from 'rxjs';
1
2
  import { Signal } from '../Signal';
2
3
  import { Adapter } from './adapters/Adapter';
3
4
  import { SignalPersistenceConfig } from './types';
4
- export declare function persistSignals({ entries, onHydrated, adapter, }: {
5
- entries: Array<SignalPersistenceConfig<Signal<any, string>>>;
5
+ type AnySignal = Signal<any, string>;
6
+ type Entry = SignalPersistenceConfig<AnySignal>;
7
+ /**
8
+ * Hydrates the signals of the latest `entries$` list from the adapter, then
9
+ * persists their updates to it. Entries are matched by signal, so a new array
10
+ * holding the same signals changes nothing:
11
+ * - an added signal is hydrated, then persisted;
12
+ * - a signal still in the list keeps running untouched;
13
+ * - a removed signal stops being persisted, after its pending value is saved.
14
+ *
15
+ * Emits `{ type: "hydrated" }` once, the first time every entry added so far
16
+ * has been hydrated (right away for an empty list). An entry that fails to
17
+ * hydrate is logged and never persisted, and holds back that emission until
18
+ * it is removed.
19
+ */
20
+ export declare function persistSignals({ entries$, onHydrated, adapter, }: {
21
+ entries$: Observable<Entry[]>;
6
22
  /**
7
- * Triggered after first successful hydrate
23
+ * Called when `{ type: "hydrated" }` is emitted.
8
24
  */
9
25
  onHydrated?: () => void;
10
- /**
11
- * Requires a stable instance otherwise the hydration
12
- * process will start again. This is useful when you
13
- * need to change adapter during runtime.
14
- */
15
26
  adapter: Adapter;
16
- }): import('rxjs').Observable<{
27
+ }): Observable<{
17
28
  type: "hydrated";
18
- } | {
19
- type: "persisted";
20
29
  }>;
30
+ export {};
@@ -1,27 +1,29 @@
1
1
  import { Adapter } from '../persistence/adapters/Adapter';
2
2
  import { SignalPersistenceConfig } from '../persistence/types';
3
3
  /**
4
- * Make sure to pass stable reference of entries and adapter if you don't
5
- * intentionally want to start over the process.
4
+ * Hydrates the signals of `entries` from `adapter`, then persists their
5
+ * updates to it.
6
6
  *
7
- * `isHydrated` will be `true` after the first successful hydration. This value
8
- * will be reset as soon as the adapter reference changes.
7
+ * `isHydrated` becomes `true` once the entries have been hydrated for the
8
+ * first time. Entries added later do not change it. It is reset when the
9
+ * adapter changes.
9
10
  */
10
11
  export declare function usePersistSignals({ entries, onHydrated, adapter, }: {
11
12
  /**
12
- * Passing a new list of entries will start over the process
13
- * once the current one is finished. Use a stable reference to avoid
14
- * infinite loop.
13
+ * Entries are matched by signal, so the array does not need a stable
14
+ * reference. A signal is hydrated when it is added, then persisted while it
15
+ * stays in the list. When it is removed, its pending value is saved and it
16
+ * stops being persisted.
15
17
  */
16
18
  entries?: Array<SignalPersistenceConfig<any>>;
17
19
  /**
18
- * Triggered after first successful hydrate
20
+ * Called once per adapter, when `isHydrated` becomes `true`.
19
21
  */
20
22
  onHydrated?: () => void;
21
23
  /**
22
- * Passing a new adapter reference will start over the process
23
- * once the current one is finished. Use a stable reference to avoid
24
- * infinite loop.
24
+ * Passing a new adapter reference starts over: pending values are saved to
25
+ * the previous adapter, then every entry is hydrated from the new one. Use a
26
+ * stable reference to avoid infinite loop.
25
27
  */
26
28
  adapter?: Adapter;
27
29
  }): {
@@ -0,0 +1 @@
1
+ export {};
@@ -6,7 +6,6 @@ export interface RetryBackoffConfig<T, TError> {
6
6
  retry?: (attempt: number, error: TError) => boolean;
7
7
  retryAfterDelay?: (attempt: number, error: TError) => boolean;
8
8
  retryAfter?: () => Observable<any>;
9
- retryDelay?: number | ((attempt: number, error: TError) => number);
10
9
  backoffDelay?: (iteration: number, initialInterval: number) => number;
11
10
  caughtError?: (attempt: number, error: any) => undefined | Observable<T>;
12
11
  catchError?: (attempt: number, error: any) => Observable<T>;
@@ -18,9 +17,8 @@ export declare function exponentialBackoffDelay(iteration: number, initialInterv
18
17
  /**
19
18
  * Returns an Observable that mirrors the source Observable with the exception
20
19
  * of an error. If the source Observable calls error, rather than propagating
21
- * the error call this method will resubscribe to the source Observable with
22
- * exponentially increasing interval and up to a maximum of count
23
- * re-subscriptions (if provided). Retrying can be cancelled at any point if
24
- * shouldRetry returns false.
20
+ * the error this operator resubscribes to the source Observable after a
21
+ * backoff delay (exponentially increasing by default). Retrying stops as soon
22
+ * as `retry` returns false.
25
23
  */
26
24
  export declare function retryBackoff<T, TError>(config: RetryBackoffConfig<T, TError>): <T_1>(source: Observable<T_1>) => Observable<T | T_1>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "reactjrx",
3
3
  "private": false,
4
- "version": "1.142.0",
4
+ "version": "1.142.2",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"
@@ -42,23 +42,23 @@
42
42
  "@biomejs/biome": "2.4.15",
43
43
  "@rolldown/plugin-babel": "^0.2.3",
44
44
  "@tanstack/react-query-persist-client": "^5.96.2",
45
- "@testing-library/jest-dom": "^6.2.0",
45
+ "@testing-library/jest-dom": "^7.0.0",
46
46
  "@testing-library/react": "^16.1.0",
47
47
  "@types/node": "^25.9.5",
48
48
  "@types/react": "^19.0.2",
49
49
  "@types/react-dom": "^19.0.2",
50
- "@vitejs/plugin-react": "^6.0.2",
50
+ "@vitejs/plugin-react": "^6.0.4",
51
51
  "babel-plugin-react-compiler": "^1.0.0",
52
52
  "husky": "^9.1.7",
53
53
  "jsdom": "^29.1.1",
54
- "lint-staged": "^17.0.5",
54
+ "lint-staged": "^17.2.0",
55
55
  "react": "^19.0.0",
56
- "react-dom": "^19.0.0",
56
+ "react-dom": "^19.2.8",
57
57
  "rxjs": "^7.8.0",
58
58
  "semantic-release": "^25.0.8",
59
59
  "terser": "^5.46.0",
60
60
  "typescript": "^6.0.2",
61
- "vite": "^8.1.4",
61
+ "vite": "^8.1.5",
62
62
  "vite-plugin-dts": "^5.0.1",
63
63
  "vitest": "^4.1.10"
64
64
  },