reactjrx 4.0.7 → 4.0.9

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.
@@ -14,4 +14,4 @@ export type ObservableQueryFn<TQueryFnData = unknown, TQueryKey extends QueryKey
14
14
  * fetch in progress (a refetch replacing it, the last observer unmounting,
15
15
  * `cancelQueries`, the query leaving the cache) stops the stream.
16
16
  */
17
- export declare function createObservableQueryFn<TQueryFnData = unknown, TQueryKey extends QueryKey = QueryKey>(queryFn: ObservableQueryFn<TQueryFnData, TQueryKey> | undefined): typeof skipToken | ((context: QueryFunctionContext<TQueryKey>) => Promise<TQueryFnData>) | undefined;
17
+ export declare function createObservableQueryFn<TQueryFnData = unknown, TQueryKey extends QueryKey = QueryKey>(queryFn: ObservableQueryFn<TQueryFnData, TQueryKey>): typeof skipToken | ((context: QueryFunctionContext<TQueryKey>) => Promise<TQueryFnData>);
@@ -1 +1,5 @@
1
1
  export declare const IDENTIFIER_PERSISTENCE_KEY = "__reactjrx";
2
+ /**
3
+ * What hydration emits when the adapter holds nothing usable for a signal.
4
+ */
5
+ export declare const NOTHING_STORED: unique symbol;
@@ -1,9 +1,14 @@
1
+ import { Observable } from 'rxjs';
1
2
  import { Adapter } from './adapters/Adapter';
2
3
  import { SignalPersistenceConfig } from './types';
3
4
  export declare const persistValue: ({ adapter, config, }: {
4
5
  adapter: Adapter;
5
6
  config: SignalPersistenceConfig<any>;
6
- }) => import('rxjs').Observable<unknown>;
7
+ }) => Observable<unknown>;
8
+ /**
9
+ * Emits the value the signal was hydrated with, or `NOTHING_STORED` when
10
+ * nothing usable is stored.
11
+ */
7
12
  export declare function hydrateValueToSignal({ adapter, config, resetToDefault, }: {
8
13
  adapter: Adapter;
9
14
  config: SignalPersistenceConfig<any>;
@@ -12,4 +17,4 @@ export declare function hydrateValueToSignal({ adapter, config, resetToDefault,
12
17
  * leaving its current value in place.
13
18
  */
14
19
  resetToDefault?: boolean;
15
- }): import('rxjs').Observable<unknown>;
20
+ }): Observable<unknown>;
@@ -1,7 +1,13 @@
1
1
  import { Signal, SignalValue } from '../Signal';
2
2
  import { IDENTIFIER_PERSISTENCE_KEY } from './constants';
3
3
  export interface PersistenceEntry {
4
- value: unknown;
4
+ value?: unknown;
5
+ /**
6
+ * Set when the signal held `undefined`, which JSON drops from `value`. An
7
+ * entry with neither stores nothing, as entries written before this flag
8
+ * do.
9
+ */
10
+ isUndefined?: true;
5
11
  migrationVersion?: number;
6
12
  [IDENTIFIER_PERSISTENCE_KEY]: typeof IDENTIFIER_PERSISTENCE_KEY;
7
13
  }
@@ -9,7 +15,8 @@ export interface SignalPersistenceConfig<S extends Signal<any, string>> {
9
15
  version: number;
10
16
  signal: S;
11
17
  /**
12
- * Only called if there is a value to hydrate
18
+ * Called with the stored value when the signal is hydrated from it. The
19
+ * value is `undefined` when the signal was saved holding `undefined`.
13
20
  */
14
21
  hydrate?: (params: {
15
22
  version: number;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "reactjrx",
3
3
  "private": false,
4
- "version": "4.0.7",
4
+ "version": "4.0.9",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"