@storesjs/stores 0.8.7 → 0.10.0

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.
Files changed (141) hide show
  1. package/README.md +55 -29
  2. package/dist/createBaseStore.d.ts +6 -6
  3. package/dist/createDerivedStore.d.ts +9 -17
  4. package/dist/createQueryStore.d.ts +6 -21
  5. package/dist/createVirtualStore.d.ts +5 -5
  6. package/dist/env.native.d.ts +0 -2
  7. package/dist/env.web.d.ts +0 -1
  8. package/dist/hooks/useListen.d.ts +2 -2
  9. package/dist/hooks/useSyncExternalStoreWithSelector.d.ts +5 -0
  10. package/dist/index.d.ts +1 -14
  11. package/dist/index.shared.d.ts +14 -0
  12. package/dist/index.vanilla.d.ts +2 -0
  13. package/dist/internal/baseStore.d.ts +2 -0
  14. package/dist/internal/config.d.ts +64 -0
  15. package/dist/{utils → internal}/createStoreActions.d.ts +5 -6
  16. package/dist/internal/derivedStore/cascadeScheduler.d.ts +31 -0
  17. package/dist/internal/derivedStore/deriveProxy.d.ts +15 -0
  18. package/dist/internal/derivedStore/pathFinder.d.ts +26 -0
  19. package/dist/internal/derivedStore.d.ts +2 -0
  20. package/dist/internal/errors.d.ts +10 -0
  21. package/dist/{logger.d.ts → internal/logger.d.ts} +0 -7
  22. package/dist/internal/middleware/createHydrationGate.d.ts +20 -0
  23. package/dist/internal/queryStore/queryStoreDefaults.d.ts +8 -0
  24. package/dist/internal/queryStore.d.ts +2 -0
  25. package/dist/internal/runtime.d.ts +13 -0
  26. package/dist/internal/signal.d.ts +12 -0
  27. package/dist/internal/storage/storageCreators.d.ts +12 -0
  28. package/dist/{utils → internal}/storeUtils.d.ts +4 -22
  29. package/dist/internal/sync/browserSyncEngine.d.ts +3 -0
  30. package/dist/internal/sync/noopSyncEngine.d.ts +3 -0
  31. package/dist/internal/sync/syncEnhancer.d.ts +26 -0
  32. package/dist/{sync → internal/sync}/syncUtils.d.ts +1 -1
  33. package/dist/internal/utils/persistUtils.d.ts +9 -0
  34. package/dist/internal/virtualStore.d.ts +2 -0
  35. package/dist/native/index.js +1 -1
  36. package/dist/native/index.mjs +1 -1
  37. package/dist/plugins/chrome/chromeExtensionSyncEngine.d.ts +3 -1
  38. package/dist/queryStore/queryKey.d.ts +3 -0
  39. package/dist/queryStore/signalTypes.d.ts +14 -0
  40. package/dist/queryStore/types.d.ts +39 -33
  41. package/dist/store/attachStoreHook.react.d.ts +5 -0
  42. package/dist/store/attachStoreHook.vanilla.d.ts +6 -0
  43. package/dist/store/batchStoreNotifications.native.d.ts +3 -0
  44. package/dist/store/batchStoreNotifications.web.d.ts +2 -0
  45. package/dist/store/createStore.d.ts +6 -0
  46. package/dist/store/persist.d.ts +14 -0
  47. package/dist/store/stateUpdate.d.ts +10 -0
  48. package/dist/store/types.d.ts +108 -0
  49. package/dist/sync/types.d.ts +53 -128
  50. package/dist/types/functions.d.ts +19 -2
  51. package/dist/types/objects.d.ts +10 -3
  52. package/dist/types/setState.d.ts +22 -0
  53. package/dist/types/subscribe.d.ts +28 -0
  54. package/dist/types/useStoreCallSignatures.d.ts +2 -0
  55. package/dist/types/useStoreCallSignatures.react.d.ts +6 -0
  56. package/dist/types/useStoreCallSignatures.vanilla.d.ts +2 -0
  57. package/dist/types/utils.d.ts +4 -0
  58. package/dist/types.d.ts +59 -110
  59. package/dist/utils/core.d.ts +23 -4
  60. package/dist/utils/time.d.ts +0 -10
  61. package/dist/vanilla/createBaseStore.d.ts +35 -0
  62. package/dist/vanilla/createDerivedStore.d.ts +62 -0
  63. package/dist/vanilla/createQueryStore.d.ts +116 -0
  64. package/dist/vanilla/createVirtualStore.d.ts +39 -0
  65. package/dist/vanilla/env.web.d.ts +6 -0
  66. package/dist/vanilla/index.d.ts +1 -0
  67. package/dist/vanilla/index.js +1 -0
  68. package/dist/vanilla/index.mjs +1 -0
  69. package/dist/vanilla/index.shared.d.ts +13 -0
  70. package/dist/vanilla/index.vanilla.d.ts +1 -0
  71. package/dist/vanilla/internal/baseStore.d.ts +1 -0
  72. package/dist/vanilla/internal/config.d.ts +63 -0
  73. package/dist/vanilla/internal/createStoreActions.d.ts +23 -0
  74. package/dist/{derivedStore → vanilla/internal/derivedStore}/cascadeScheduler.d.ts +8 -1
  75. package/dist/vanilla/internal/derivedStore/deriveProxy.d.ts +14 -0
  76. package/dist/vanilla/internal/derivedStore/pathFinder.d.ts +25 -0
  77. package/dist/vanilla/internal/derivedStore.d.ts +1 -0
  78. package/dist/vanilla/internal/errors.d.ts +9 -0
  79. package/dist/vanilla/internal/logger.d.ts +9 -0
  80. package/dist/{middleware → vanilla/internal/middleware}/createHydrationGate.d.ts +1 -2
  81. package/dist/vanilla/internal/queryStore/queryStoreDefaults.d.ts +7 -0
  82. package/dist/vanilla/internal/queryStore.d.ts +1 -0
  83. package/dist/vanilla/internal/runtime.d.ts +12 -0
  84. package/dist/vanilla/internal/signal.d.ts +11 -0
  85. package/dist/vanilla/internal/storage/storageCreators.d.ts +11 -0
  86. package/dist/vanilla/internal/storeUtils.d.ts +45 -0
  87. package/dist/vanilla/internal/sync/browserSyncEngine.d.ts +2 -0
  88. package/dist/vanilla/internal/sync/noopSyncEngine.d.ts +2 -0
  89. package/dist/{sync → vanilla/internal/sync}/syncEnhancer.d.ts +6 -3
  90. package/dist/{utils → vanilla/internal/utils}/persistUtils.d.ts +2 -3
  91. package/dist/vanilla/internal/virtualStore.d.ts +1 -0
  92. package/dist/vanilla/queryStore/classes/SubscriptionManager.d.ts +66 -0
  93. package/dist/vanilla/queryStore/queryKey.d.ts +2 -0
  94. package/dist/vanilla/queryStore/signalTypes.d.ts +13 -0
  95. package/dist/vanilla/queryStore/types.d.ts +402 -0
  96. package/dist/vanilla/storage/storageTypes.d.ts +12 -0
  97. package/dist/vanilla/store/attachStoreHook.d.ts +5 -0
  98. package/dist/vanilla/store/attachStoreHook.vanilla.d.ts +5 -0
  99. package/dist/vanilla/store/batchStoreNotifications.web.d.ts +1 -0
  100. package/dist/vanilla/store/createStore.d.ts +5 -0
  101. package/dist/vanilla/store/persist.d.ts +13 -0
  102. package/dist/vanilla/store/stateUpdate.d.ts +9 -0
  103. package/dist/vanilla/store/types.d.ts +107 -0
  104. package/dist/vanilla/storesStorage.web.d.ts +2 -0
  105. package/dist/vanilla/sync/types.d.ts +114 -0
  106. package/dist/vanilla/types/functions.d.ts +23 -0
  107. package/dist/vanilla/types/objects.d.ts +10 -0
  108. package/dist/vanilla/types/setState.d.ts +21 -0
  109. package/dist/vanilla/types/subscribe.d.ts +27 -0
  110. package/dist/vanilla/types/useStoreCallSignatures.d.ts +1 -0
  111. package/dist/vanilla/types/useStoreCallSignatures.vanilla.d.ts +1 -0
  112. package/dist/vanilla/types/utils.d.ts +12 -0
  113. package/dist/vanilla/types.d.ts +285 -0
  114. package/dist/vanilla/utils/core.d.ts +25 -0
  115. package/dist/vanilla/utils/createAsyncMicrotaskScheduler.d.ts +34 -0
  116. package/dist/vanilla/utils/createMicrotaskScheduler.d.ts +27 -0
  117. package/dist/vanilla/utils/debounce.d.ts +21 -0
  118. package/dist/vanilla/utils/equality.d.ts +37 -0
  119. package/dist/vanilla/utils/hydrationCoordinator.d.ts +12 -0
  120. package/dist/vanilla/utils/promiseUtils.d.ts +1 -0
  121. package/dist/vanilla/utils/serialization.d.ts +13 -0
  122. package/dist/vanilla/utils/stringUtils.d.ts +6 -0
  123. package/dist/vanilla/utils/time.d.ts +36 -0
  124. package/dist/web/chrome.js +1 -1
  125. package/dist/web/chrome.mjs +1 -1
  126. package/dist/web/chunk-QJLWBD7M.mjs +1 -0
  127. package/dist/web/chunk-V4LHP7LR.mjs +1 -0
  128. package/dist/web/index.js +1 -1
  129. package/dist/web/index.mjs +1 -1
  130. package/dist/web/internal/runtime.js +1 -0
  131. package/dist/web/internal/runtime.mjs +1 -0
  132. package/package.json +21 -15
  133. package/dist/config.d.ts +0 -40
  134. package/dist/derivedStore/deriveProxy.d.ts +0 -25
  135. package/dist/hooks/compareHooks.d.ts +0 -50
  136. package/dist/signal.d.ts +0 -20
  137. package/dist/storage/storageCreators.d.ts +0 -22
  138. package/dist/sync/browserSyncEngine.d.ts +0 -3
  139. package/dist/sync/noopSyncEngine.d.ts +0 -3
  140. package/dist/sync/transport.d.ts +0 -113
  141. package/dist/web/chunk-MMPMCVRC.mjs +0 -1
@@ -1,7 +1,26 @@
1
1
  /**
2
- * Returns the first argument provided to it.
3
- * @param value - Any value.
4
- * @returns `value`.
2
+ * Returns the argument provided.
5
3
  */
6
- export declare const identity: (value: any) => any;
4
+ export declare function identity<T>(value: T): T;
5
+ export declare function identity<T, _>(value: T): T;
6
+ /**
7
+ * Creates a null-prototype object using the runtime-optimal path:
8
+ * - React Native: direct literal `{ __proto__: null }`
9
+ * - Web/Node: `Object.create` with a shared, frozen null prototype
10
+ */
11
+ export declare function nullObject<T extends Record<string, unknown> | object = Record<string, unknown>>(): T;
12
+ /**
13
+ * Builds null-prototype objects. Provided arguments are
14
+ * shallow-merged into a newly created null-prototype object:
15
+ *
16
+ * ```ts
17
+ * Object.assign(nullObject(), a, b?)
18
+ * ```
19
+ */
20
+ export declare function buildNullObject<A extends Record<string, unknown>>(a: A): A;
21
+ export declare function buildNullObject<A extends object, B>(a: object, b?: object): [undefined] extends B ? A : A & B;
22
+ /**
23
+ * Does nothing.
24
+ */
25
+ export declare function noop(): void;
7
26
  //# sourceMappingURL=core.d.ts.map
@@ -33,15 +33,5 @@ type TimeUtils = {
33
33
  * time.zero // 0
34
34
  */
35
35
  export declare const time: TimeUtils;
36
- /**
37
- * Waits for microtasks to complete.
38
- * Uses setTimeout(0) to allow microtasks scheduled via queueMicrotask to execute.
39
- *
40
- * Useful in tests when waiting for async operations scheduled via microtasks.
41
- *
42
- * @example
43
- * await waitForMicrotask();
44
- */
45
- export declare function waitForMicrotask(): Promise<void>;
46
36
  export {};
47
37
  //# sourceMappingURL=time.d.ts.map
@@ -0,0 +1,35 @@
1
+ import type { BaseStoreOptions, OptionallyPersistedStore, Store, StateCreator } from './types';
2
+ /**
3
+ * Creates a base store without persistence.
4
+ * @param createState - The state creator function for the base store.
5
+ * @returns A store with the specified state.
6
+ */
7
+ export declare function createBaseStore<S>(createState: StateCreator<S>): Store<S>;
8
+ /**
9
+ * Creates a base store with persistence.
10
+ * @param createState - The state creator function for the base store.
11
+ * @param options - The configuration options for persistence and sync.
12
+ * @returns A store with the specified state and persistence.
13
+ */
14
+ export declare function createBaseStore<S, PersistedState extends Partial<S> = Partial<S>, PersistReturn extends void = void>(createState: StateCreator<S>, options: BaseStoreOptions<S, PersistedState, PersistReturn>): Store<S, PersistedState, PersistReturn, false>;
15
+ /**
16
+ * Creates a base store with async persistence.
17
+ * @param createState - The state creator function for the base store.
18
+ * @param options - The configuration options for persistence and sync.
19
+ * @returns A store with the specified state and persistence.
20
+ */
21
+ export declare function createBaseStore<S, PersistedState extends Partial<S> = Partial<S>, PersistReturn extends Promise<void> = Promise<void>>(createState: StateCreator<S>, options: BaseStoreOptions<S, PersistedState, PersistReturn>): Store<S, PersistedState, PersistReturn, false>;
22
+ /**
23
+ * Creates a base store with optional persistence.
24
+ * @param createState - The state creator function for the base store.
25
+ * @param options - The configuration options for persistence and sync.
26
+ * @returns A store with the specified state and optional persistence.
27
+ */
28
+ export declare function createBaseStore<S, PersistedState extends Partial<S> = Partial<S>, PersistReturn extends void = void>(createState: StateCreator<S>, options?: BaseStoreOptions<S, PersistedState, PersistReturn>): OptionallyPersistedStore<S, PersistedState, PersistReturn>;
29
+ /**
30
+ * Creates a base store with optional async persistence.
31
+ * @param createState - The state creator function for the base store.
32
+ * @param options - The configuration options for persistence and sync.
33
+ * @returns A store with the specified state and optional persistence.
34
+ */
35
+ export declare function createBaseStore<S, PersistedState extends Partial<S> = Partial<S>, PersistReturn extends Promise<void> = Promise<void>>(createState: StateCreator<S>, options?: BaseStoreOptions<S, PersistedState, PersistReturn>): OptionallyPersistedStore<S, PersistedState, PersistReturn>;
@@ -0,0 +1,62 @@
1
+ import type { DeriveGetter, DeriveOptions, DerivedStore } from './types';
2
+ /**
3
+ * ### `createDerivedStore`
4
+ *
5
+ * Creates a **read-only** store derived from one or more source stores.
6
+ *
7
+ * ---
8
+ * The `deriveFunction` is called whenever its dependencies change, producing a new derived state.
9
+ * Dependencies are automatically tracked through a special `$` helper, which supports:
10
+ *
11
+ * 1) **Selector-based** usage:
12
+ * ```ts
13
+ * $ => {
14
+ * const user = $(useUserStore, s => s.user, shallowEqual);
15
+ * const theme = $(useSettingsStore, s => s.appearance.theme);
16
+ * return { user, theme, isAdmin: user?.roles.includes('admin') };
17
+ * }
18
+ * ```
19
+ *
20
+ * 2) **Proxy-based** usage (auto-built selectors for nested properties):
21
+ * ```ts
22
+ * $ => {
23
+ * const { user } = $(useUserStore); // Subscribe to `user`
24
+ * const theme = $(useSettingsStore).appearance.theme; // Subscribe to `theme`
25
+ * return { isAdmin: user?.roles.includes('admin'), theme, user };
26
+ * }
27
+ * ```
28
+ *
29
+ * ---
30
+ * Derived stores automatically unsubscribe from all dependencies when no consumers remain, and
31
+ * resubscribe when new consumers appear. The returned store exposes:
32
+ *
33
+ * - A **store object** with `getState()`, `subscribe()`, and `destroy()`
34
+ * - In the React build, a **React hook** (`const state = derivedStore(selector, equalityFn?)`)
35
+ *
36
+ * ---
37
+ * You can optionally pass a second parameter (either an equality function or a config object)
38
+ * to enable debouncing, customize the equality function, or set `lockDependencies: true`.
39
+ *
40
+ * (When dependencies are locked, subscriptions created via `$` are established once and are
41
+ * not rebuilt on subsequent re-derives, which can be a performance win for certain workloads.)
42
+ *
43
+ * ---
44
+ * @example
45
+ * ```ts
46
+ * // Create a derived store
47
+ * const searchResultsStore = createDerivedStore($ => {
48
+ * const query = $(searchStore).query.trim().toLowerCase();
49
+ * const items = $(itemsStore).items;
50
+ * return findResults(query, items);
51
+ * }, shallowEqual);
52
+ *
53
+ * const results = searchResultsStore.getState();
54
+ * ```
55
+ *
56
+ * ---
57
+ * @param deriveFunction - Function that reads from other stores via `$` to produce derived state.
58
+ * @param optionsOrEqualityFn - Either an equality function or a config object (see `DeriveOptions`).
59
+ *
60
+ * @returns A read-only derived store. In the React build, it is also callable as a hook.
61
+ */
62
+ export declare function createDerivedStore<Derived>(deriveFunction: ($: DeriveGetter) => Derived, optionsOrEqualityFn?: DeriveOptions<Derived>): DerivedStore<Derived>;
@@ -0,0 +1,116 @@
1
+ import { defaultRetryDelay } from './internal/runtime';
2
+ import type { QueryStoreConfig, QueryStoreState } from './queryStore/types';
3
+ import type { BaseStoreOptions, OptionallyPersistedStore, PersistedStore, StateCreator, Store } from './types';
4
+ export { defaultRetryDelay };
5
+ /**
6
+ * Creates a persisted, query-enabled store with data fetching capabilities (sync storage).
7
+ *
8
+ * @template TQueryFnData - The raw data type returned by the fetcher
9
+ * @template TParams - Parameters passed to the fetcher function
10
+ * @template TData - The transformed data type, if applicable (defaults to `TQueryFnData`)
11
+ * @template PersistedState - The persisted state type, if a stricter type than `Partial<CustomState>` is desired
12
+ */
13
+ export declare function createQueryStore<TQueryFnData, TParams extends Record<string, unknown> = Record<string, never>, TData = TQueryFnData, PersistedState extends Partial<QueryStoreState<TData, TParams>> = Partial<QueryStoreState<TData, TParams>>, PersistReturn extends void = void>(config: QueryStoreConfig<TQueryFnData, TParams, TData>, options: BaseStoreOptions<QueryStoreState<TData, TParams>, PersistedState, PersistReturn>): PersistedStore<QueryStoreState<TData, TParams>, PersistedState, PersistReturn, false>;
14
+ /**
15
+ * Creates a persisted, query-enabled store with data fetching capabilities (async storage).
16
+ *
17
+ * @template TQueryFnData - The raw data type returned by the fetcher
18
+ * @template TParams - Parameters passed to the fetcher function
19
+ * @template TData - The transformed data type, if applicable (defaults to `TQueryFnData`)
20
+ * @template PersistedState - The persisted state type, if a stricter type than `Partial<CustomState>` is desired
21
+ */
22
+ export declare function createQueryStore<TQueryFnData, TParams extends Record<string, unknown> = Record<string, never>, TData = TQueryFnData, PersistedState extends Partial<QueryStoreState<TData, TParams>> = Partial<QueryStoreState<TData, TParams>>, PersistReturn extends Promise<void> = Promise<void>>(config: QueryStoreConfig<TQueryFnData, TParams, TData>, options: BaseStoreOptions<QueryStoreState<TData, TParams>, PersistedState, PersistReturn>): PersistedStore<QueryStoreState<TData, TParams>, PersistedState, PersistReturn, false>;
23
+ /**
24
+ * Creates a persisted, query-enabled store with data fetching capabilities (sync storage).
25
+ *
26
+ * @template TQueryFnData - The raw data type returned by the fetcher
27
+ * @template TParams - Parameters passed to the fetcher function
28
+ * @template CustomState - User-defined custom store state
29
+ * @template TData - The transformed data type, if applicable (defaults to `TQueryFnData`)
30
+ * @template PersistedState - The persisted state type, if a stricter type than `Partial<CustomState>` is desired
31
+ */
32
+ export declare function createQueryStore<TQueryFnData, TParams extends Record<string, unknown> = Record<string, never>, CustomState = unknown, TData = TQueryFnData, PersistedState extends Partial<QueryStoreState<TData, TParams, CustomState>> = Partial<QueryStoreState<TData, TParams, CustomState>>, PersistReturn extends void = void>(config: QueryStoreConfig<TQueryFnData, TParams, TData, CustomState>, stateCreator: StateCreator<QueryStoreState<TData, TParams, CustomState>, CustomState>, options: BaseStoreOptions<QueryStoreState<TData, TParams, CustomState>, PersistedState, PersistReturn>): PersistedStore<QueryStoreState<TData, TParams, CustomState>, PersistedState, PersistReturn, false>;
33
+ /**
34
+ * Creates a persisted, query-enabled store with data fetching capabilities (async storage).
35
+ *
36
+ * @template TQueryFnData - The raw data type returned by the fetcher
37
+ * @template TParams - Parameters passed to the fetcher function
38
+ * @template CustomState - User-defined custom store state
39
+ * @template TData - The transformed data type, if applicable (defaults to `TQueryFnData`)
40
+ * @template PersistedState - The persisted state type, if a stricter type than `Partial<CustomState>` is desired
41
+ */
42
+ export declare function createQueryStore<TQueryFnData, TParams extends Record<string, unknown> = Record<string, never>, CustomState = unknown, TData = TQueryFnData, PersistedState extends Partial<QueryStoreState<TData, TParams, CustomState>> = Partial<QueryStoreState<TData, TParams, CustomState>>, PersistReturn extends Promise<void> = Promise<void>>(config: QueryStoreConfig<TQueryFnData, TParams, TData, CustomState>, stateCreator: StateCreator<QueryStoreState<TData, TParams, CustomState>, CustomState>, options: BaseStoreOptions<QueryStoreState<TData, TParams, CustomState>, PersistedState, PersistReturn>): PersistedStore<QueryStoreState<TData, TParams, CustomState>, PersistedState, PersistReturn, false>;
43
+ /**
44
+ * Creates a query-enabled store with data fetching capabilities.
45
+ *
46
+ * @template TQueryFnData - The raw data type returned by the fetcher
47
+ * @template TParams - Parameters passed to the fetcher function
48
+ * @template CustomState - User-defined custom store state
49
+ * @template TData - The transformed data type, if applicable (defaults to `TQueryFnData`)
50
+ */
51
+ export declare function createQueryStore<TQueryFnData, TParams extends Record<string, unknown> = Record<string, never>, CustomState = unknown, TData = TQueryFnData>(config: QueryStoreConfig<TQueryFnData, TParams, TData, CustomState>, stateCreator: StateCreator<QueryStoreState<TData, TParams, CustomState>, CustomState>, options?: BaseStoreOptions<QueryStoreState<TData, TParams, CustomState>>): Store<QueryStoreState<TData, TParams, CustomState>>;
52
+ /**
53
+ * Creates a query-enabled store with data fetching capabilities.
54
+ *
55
+ * @template TQueryFnData - The raw data type returned by the fetcher
56
+ * @template TParams - Parameters passed to the fetcher function
57
+ * @template TData - The transformed data type, if applicable (defaults to `TQueryFnData`)
58
+ */
59
+ export declare function createQueryStore<TQueryFnData, TParams extends Record<string, unknown> = Record<string, never>, TData = TQueryFnData>(config: QueryStoreConfig<TQueryFnData, TParams, TData>, options?: BaseStoreOptions<QueryStoreState<TData, TParams>>): Store<QueryStoreState<TData, TParams>>;
60
+ /**
61
+ * Creates a conditionally persisted, query-enabled store with data-fetching capabilities
62
+ * and custom state (sync storage).
63
+ *
64
+ * `options.persist` may be `undefined` – the returned store exposes `persist?`.
65
+ *
66
+ * @template TQueryFnData - The raw data type returned by the fetcher
67
+ * @template TParams - Parameters passed to the fetcher function
68
+ * @template CustomState - User-defined custom store state
69
+ * @template TData - The transformed data type, if applicable (defaults to `TQueryFnData`)
70
+ * @template PersistedState - The persisted state type, if a stricter type than `Partial<CustomState>` is desired
71
+ */
72
+ export declare function createQueryStore<TQueryFnData, TParams extends Record<string, unknown> = Record<string, never>, CustomState = unknown, TData = TQueryFnData, PersistedState extends Partial<QueryStoreState<TData, TParams, CustomState>> = Partial<QueryStoreState<TData, TParams, CustomState>>, PersistReturn extends void = void>(config: QueryStoreConfig<TQueryFnData, TParams, TData, CustomState>, stateCreator: StateCreator<QueryStoreState<TData, TParams, CustomState>, CustomState>, options?: BaseStoreOptions<QueryStoreState<TData, TParams, CustomState>, PersistedState, PersistReturn>): OptionallyPersistedStore<QueryStoreState<TData, TParams, CustomState>, PersistedState, PersistReturn>;
73
+ /**
74
+ * Creates a conditionally persisted, query-enabled store with data-fetching capabilities
75
+ * and custom state (async storage).
76
+ *
77
+ * `options.persist` may be `undefined` – the returned store exposes `persist?`.
78
+ *
79
+ * @template TQueryFnData - The raw data type returned by the fetcher
80
+ * @template TParams - Parameters passed to the fetcher function
81
+ * @template CustomState - User-defined custom store state
82
+ * @template TData - The transformed data type, if applicable (defaults to `TQueryFnData`)
83
+ * @template PersistedState - The persisted state type, if a stricter type than `Partial<CustomState>` is desired
84
+ */
85
+ export declare function createQueryStore<TQueryFnData, TParams extends Record<string, unknown> = Record<string, never>, CustomState = unknown, TData = TQueryFnData, PersistedState extends Partial<QueryStoreState<TData, TParams, CustomState>> = Partial<QueryStoreState<TData, TParams, CustomState>>, PersistReturn extends Promise<void> = Promise<void>>(config: QueryStoreConfig<TQueryFnData, TParams, TData, CustomState>, stateCreator: StateCreator<QueryStoreState<TData, TParams, CustomState>, CustomState>, options?: BaseStoreOptions<QueryStoreState<TData, TParams, CustomState>, PersistedState, PersistReturn>): OptionallyPersistedStore<QueryStoreState<TData, TParams, CustomState>, PersistedState, PersistReturn>;
86
+ /**
87
+ * Creates a conditionally persisted, query-enabled store with data fetching capabilities (sync storage).
88
+ *
89
+ * `options.persist` may be `undefined` – the returned store exposes `persist?`.
90
+ *
91
+ * @template TQueryFnData - The raw data type returned by the fetcher
92
+ * @template TParams - Parameters passed to the fetcher function
93
+ * @template TData - The transformed data type, if applicable (defaults to `TQueryFnData`)
94
+ * @template PersistedState - The persisted state type, if a stricter type than `Partial<CustomState>` is desired
95
+ */
96
+ export declare function createQueryStore<TQueryFnData, TParams extends Record<string, unknown> = Record<string, never>, TData = TQueryFnData, PersistedState extends Partial<QueryStoreState<TData, TParams>> = Partial<QueryStoreState<TData, TParams>>, PersistReturn extends void = void>(config: QueryStoreConfig<TQueryFnData, TParams, TData>, options: BaseStoreOptions<QueryStoreState<TData, TParams>, PersistedState, PersistReturn> | undefined): OptionallyPersistedStore<QueryStoreState<TData, TParams>, PersistedState, PersistReturn>;
97
+ /**
98
+ * Creates a conditionally persisted, query-enabled store with data fetching capabilities (async storage).
99
+ *
100
+ * `options.persist` may be `undefined` – the returned store exposes `persist?`.
101
+ *
102
+ * @template TQueryFnData - The raw data type returned by the fetcher
103
+ * @template TParams - Parameters passed to the fetcher function
104
+ * @template TData - The transformed data type, if applicable (defaults to `TQueryFnData`)
105
+ * @template PersistedState - The persisted state type, if a stricter type than `Partial<CustomState>` is desired
106
+ */
107
+ export declare function createQueryStore<TQueryFnData, TParams extends Record<string, unknown> = Record<string, never>, TData = TQueryFnData, PersistedState extends Partial<QueryStoreState<TData, TParams>> = Partial<QueryStoreState<TData, TParams>>, PersistReturn extends Promise<void> = Promise<void>>(config: QueryStoreConfig<TQueryFnData, TParams, TData>, options: BaseStoreOptions<QueryStoreState<TData, TParams>, PersistedState, PersistReturn> | undefined): OptionallyPersistedStore<QueryStoreState<TData, TParams>, PersistedState, PersistReturn>;
108
+ /**
109
+ * Generates a deterministic query store `queryKey` from the given parameters,
110
+ * consistent with internally generated keys.
111
+ */
112
+ export declare function getQueryKey<TParams extends Record<string, unknown>>(params: TParams): string;
113
+ /**
114
+ * Parses a query store `queryKey` into the corresponding parameters.
115
+ */
116
+ export declare function parseQueryKey<TParams extends Record<string, unknown>>(queryKey: string): TParams;
@@ -0,0 +1,39 @@
1
+ import type { BaseStore, DeriveGetter, InferPersistedState, InferSetStateReturn, InferStoreState, OptionallyPersistedStore } from './types';
2
+ type MethodOverrides<Store extends BaseStore<unknown>> = Partial<Pick<Store, 'getState' | 'setState'>>;
3
+ type VirtualStore<Store extends BaseStore<unknown>> = OptionallyPersistedStore<InferStoreState<Store>, InferPersistedState<Store>, InferSetStateReturn<Store>>;
4
+ type VirtualStoreOptions = {
5
+ debugMode?: boolean;
6
+ /**
7
+ * Whether to lock dependencies (see: {@link DeriveOptions}) for the virtual store.
8
+ * @default true
9
+ */
10
+ lockDependencies?: boolean;
11
+ };
12
+ /**
13
+ * ### `createVirtualStore`
14
+ *
15
+ * Returns a stable store interface backed by different store instances over time.
16
+ * When dependencies change, the derive function runs and creates a new store, then
17
+ * all subscriptions rebind automatically. Only depend on state that should trigger
18
+ * new store creation.
19
+ *
20
+ * ---
21
+ * 💡 **Note:** `lockDependencies` (see: {@link DeriveOptions}) is enabled by default.
22
+ * Ensure that any `$` dependencies in your `createStore` function are called
23
+ * consistently. If they are not, set `lockDependencies` to `false`.
24
+ *
25
+ * ---
26
+ * @param createStore - Derive function that returns a store instance
27
+ * @param overrides - Optional method overrides (e.g., `getState(id?: string)`)
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * const useUserAssetsStore = createVirtualStore($ => {
32
+ * const address = $(useWalletsStore).accountAddress;
33
+ * return createUserAssetsStore(address);
34
+ * });
35
+ * ```
36
+ */
37
+ export declare function createVirtualStore<Store extends BaseStore<InferStoreState<Store>>>(createStore: ($: DeriveGetter) => Store, options?: VirtualStoreOptions): VirtualStore<Store>;
38
+ export declare function createVirtualStore<Store extends BaseStore<InferStoreState<Store>>, Overrides extends MethodOverrides<Store>>(createStore: ($: DeriveGetter) => Store, overrides: (getStore: () => Store) => Overrides, options?: VirtualStoreOptions): VirtualStore<Store> & Overrides;
39
+ export {};
@@ -0,0 +1,6 @@
1
+ export declare const IS_REACT_NATIVE = false;
2
+ export declare const IS_BROWSER: boolean;
3
+ export declare const IS_IOS = false;
4
+ export declare const IS_ANDROID = false;
5
+ export declare const IS_DEV: boolean;
6
+ export declare const IS_TEST: boolean;
@@ -0,0 +1 @@
1
+ export * from './index.shared';
@@ -0,0 +1 @@
1
+ var e=require("../web/internal/runtime.js");function t(e,t,r,n){return e}Object.defineProperty(exports,"QueryStatuses",{enumerable:!0,get:function(){return e.QueryStatuses}}),Object.defineProperty(exports,"StoresError",{enumerable:!0,get:function(){return e.StoresError}}),Object.defineProperty(exports,"applyStateUpdate",{enumerable:!0,get:function(){return e.applyStateUpdate}}),Object.defineProperty(exports,"configureStores",{enumerable:!0,get:function(){return e.configureStores}}),Object.defineProperty(exports,"createStoreActions",{enumerable:!0,get:function(){return e.createStoreActions}}),Object.defineProperty(exports,"deepEqual",{enumerable:!0,get:function(){return e.deepEqual}}),Object.defineProperty(exports,"defaultRetryDelay",{enumerable:!0,get:function(){return e.defaultRetryDelay}}),Object.defineProperty(exports,"destroyStore",{enumerable:!0,get:function(){return e.destroyStore}}),Object.defineProperty(exports,"destroyStores",{enumerable:!0,get:function(){return e.destroyStores}}),Object.defineProperty(exports,"getStoreName",{enumerable:!0,get:function(){return e.getStoreName}}),Object.defineProperty(exports,"hasGetSnapshot",{enumerable:!0,get:function(){return e.hasGetSnapshot}}),Object.defineProperty(exports,"identity",{enumerable:!0,get:function(){return e.identity}}),Object.defineProperty(exports,"isDerivedStore",{enumerable:!0,get:function(){return e.isDerivedStore}}),Object.defineProperty(exports,"isPersistedStore",{enumerable:!0,get:function(){return e.isPersistedStore}}),Object.defineProperty(exports,"isQueryStore",{enumerable:!0,get:function(){return e.isQueryStore}}),Object.defineProperty(exports,"isVirtualStore",{enumerable:!0,get:function(){return e.isVirtualStore}}),Object.defineProperty(exports,"nullObject",{enumerable:!0,get:function(){return e.nullObject}}),Object.defineProperty(exports,"replacer",{enumerable:!0,get:function(){return e.replacer}}),Object.defineProperty(exports,"reviver",{enumerable:!0,get:function(){return e.reviver}}),Object.defineProperty(exports,"shallowEqual",{enumerable:!0,get:function(){return e.shallowEqual}}),Object.defineProperty(exports,"time",{enumerable:!0,get:function(){return e.time}}),exports.createBaseStore=function(r,n){const o=e.baseStore(r,n);return t(o,o.getState,o.getInitialState)},exports.createDerivedStore=function(r,n=Object.is){const o=e.derivedStore(r,n);return t(o,o.getSnapshot)},exports.createQueryStore=function(r,n,o){const u=e.queryStore(r,n,o);return t(u,u.getState,u.getInitialState)},exports.createVirtualStore=function(r,n,o){const u=e.virtualStore(r,n,o);return t(u,u.getState,u.getInitialState)},exports.getQueryKey=function(t){return e.getQueryKey(t)},exports.parseQueryKey=function(t){return e.parseQueryKey(t)};
@@ -0,0 +1 @@
1
+ import{baseStore as t,derivedStore as e,queryStore as r,getQueryKey as n,parseQueryKey as o,virtualStore as i}from"../web/internal/runtime.mjs";export{QueryStatuses,StoresError,applyStateUpdate,configureStores,createStoreActions,deepEqual,defaultRetryDelay,destroyStore,destroyStores,getStoreName,hasGetSnapshot,identity,isDerivedStore,isPersistedStore,isQueryStore,isVirtualStore,nullObject,replacer,reviver,shallowEqual,time}from"../web/internal/runtime.mjs";function a(t,e,r,n){return t}function s(e,r){const n=t(e,r);return a(n,n.getState,n.getInitialState)}function u(t,r=Object.is){const n=e(t,r);return a(n,n.getSnapshot)}function S(t,e,n){const o=r(t,e,n);return a(o,o.getState,o.getInitialState)}function c(t){return n(t)}function l(t){return o(t)}function y(t,e,r){const n=i(t,e,r);return a(n,n.getState,n.getInitialState)}export{s as createBaseStore,u as createDerivedStore,S as createQueryStore,y as createVirtualStore,c as getQueryKey,l as parseQueryKey};
@@ -0,0 +1,13 @@
1
+ export * from './createBaseStore';
2
+ export * from './createDerivedStore';
3
+ export * from './createQueryStore';
4
+ export * from './createVirtualStore';
5
+ export { configureStores, StoresError } from './internal/runtime';
6
+ export { applyStateUpdate, replacer, reviver } from './internal/runtime';
7
+ export { destroyStore, destroyStores, getStoreName, hasGetSnapshot, isDerivedStore, isPersistedStore, isQueryStore, isVirtualStore, } from './internal/runtime';
8
+ export type * from './sync/types';
9
+ export { QueryStatuses } from './internal/runtime';
10
+ export type * from './queryStore/types';
11
+ export type * from './storage/storageTypes';
12
+ export type * from './types';
13
+ export { createStoreActions, deepEqual, identity, nullObject, shallowEqual, time } from './internal/runtime';
@@ -0,0 +1 @@
1
+ export * from './index.shared';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,63 @@
1
+ import { QueryStoreConfig } from '../queryStore/types';
2
+ import { SyncEngine } from '../sync/types';
3
+ import { AsyncStorageInterface, SyncStorageInterface } from '../types';
4
+ import { NonFunction } from '../types/functions';
5
+ import { Prettify } from '../types/objects';
6
+ import { Logger } from './logger';
7
+ /**
8
+ * Global configuration for all stores.
9
+ */
10
+ export type StoresConfig = {
11
+ /**
12
+ * Custom logger for debug output. Defaults to a no-op logger in production.
13
+ */
14
+ logger: Logger;
15
+ /**
16
+ * Default options used by all query stores.
17
+ */
18
+ queryStoreDefaults: QueryStoreDefaults;
19
+ /**
20
+ * Storage backend for persisted stores. Defaults to `localStorage` in browsers,
21
+ * MMKV in React Native.
22
+ */
23
+ storage: AsyncStorageInterface | SyncStorageInterface;
24
+ /**
25
+ * Prefix for storage keys built by the default storage adapter.
26
+ * Should include a delimiter, e.g., `'myapp:'`.
27
+ * @default 'stores:'
28
+ */
29
+ storageKeyPrefix: string;
30
+ /**
31
+ * Sync engine for cross-client state synchronization. Defaults to cross-tab sync
32
+ * in browsers, no-op in other environments.
33
+ */
34
+ syncEngine: SyncEngine;
35
+ };
36
+ export type QueryStoreDefaults = Prettify<ConfigDefaults<QueryStoreConfig<unknown, Record<string, unknown>>, 'disableCache' | 'enabled' | 'params', 'retryDelay'>> & {
37
+ /**
38
+ * Minimum stale time for auto-refetching query stores under which to log warnings in development.
39
+ * `false` disables warnings.
40
+ * @default false
41
+ */
42
+ minStaleTime?: number | false;
43
+ };
44
+ type ConfigDefaults<C, Excluded extends keyof C = never, AllowedFunctions extends keyof C = never> = Omit<{
45
+ [K in keyof C as K extends AllowedFunctions ? K : NonFunction<C[K]> extends undefined ? never : K]?: K extends AllowedFunctions ? C[K] : NonFunction<C[K]>;
46
+ }, Excluded>;
47
+ /**
48
+ * Configures global defaults for all stores.
49
+ *
50
+ * If used, must be called before creating any stores.
51
+ *
52
+ * @see {@link StoresConfig}
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * configureStores({
57
+ * logger: { debug: console.debug, error: console.error },
58
+ * storageKeyPrefix: 'myapp:',
59
+ * });
60
+ * ```
61
+ */
62
+ export declare function configureStores(config: Partial<StoresConfig>): void;
63
+ export {};
@@ -0,0 +1,23 @@
1
+ import type { StoreApi } from '../store/types';
2
+ import type { InferStoreState, StoreActions } from '../types';
3
+ import type { FunctionRecord } from '../types/functions';
4
+ import type { NoOverlap } from '../types/objects';
5
+ /**
6
+ * Given a store instance, produces a new object containing only its actions.
7
+ *
8
+ * Intended for export alongside the associated store.
9
+ *
10
+ * @param store - The store to create actions for.
11
+ * @param bundledMethods - Optional extra methods to bundle into the actions object.
12
+ *
13
+ * @example
14
+ * export const useCounterStore = createRainbowStore(set => ({
15
+ * count: 0,
16
+ * increment: () => set(state => ({ count: state.count + 1 })),
17
+ * }));
18
+ *
19
+ * export const exampleActions = createStoreActions(useExampleStore);
20
+ * exampleActions.increment();
21
+ */
22
+ export declare function createStoreActions<Store extends StoreApi<unknown>>(store: Store): StoreActions<Store>;
23
+ export declare function createStoreActions<Store extends StoreApi<unknown>, Bundled extends FunctionRecord>(store: Store, bundledMethods: NoOverlap<InferStoreState<Store>, Bundled>): StoreActions<Store> & Bundled;
@@ -1,3 +1,11 @@
1
+ /**
2
+ * Cascade Scheduler
3
+ *
4
+ * - Coalesces derivations into a single microtask.
5
+ * - Tasks run once at their maximum rank via a ranked dirty queue.
6
+ * - Doesn't retain snapshots or dependency graphs.
7
+ * - Component listeners get notified after all derivations have settled.
8
+ */
1
9
  type Rank = number;
2
10
  type StoreId = string;
3
11
  type Task = () => void;
@@ -20,4 +28,3 @@ export declare function joinCascade(storeId: StoreId, task: Task): void;
20
28
  */
21
29
  export declare function enqueueDerive(task: Task, rank: Rank): void;
22
30
  export {};
23
- //# sourceMappingURL=cascadeScheduler.d.ts.map
@@ -0,0 +1,14 @@
1
+ import { BaseStore } from '../../types';
2
+ import { TrackPathFn } from './pathFinder';
3
+ /**
4
+ * Gets or creates a lightweight tracking proxy that records path access and store
5
+ * method invocations via proxy traps. Used to auto-generate selectors that point
6
+ * to either the accessed path or the value returned by an invoked store method.
7
+ */
8
+ export declare function getOrCreateProxy<S>(store: BaseStore<S>, rootProxyCache: WeakMap<object, unknown>, trackPath: TrackPathFn): S;
9
+ /**
10
+ * Strips tracking proxies from published values to ensure
11
+ * proxies remain confined to internal tracking contexts.
12
+ */
13
+ export declare function stripProxies<T>(value: T): T;
14
+ export declare function stripProxies(value: unknown, seen?: WeakSet<object>): unknown;
@@ -0,0 +1,25 @@
1
+ import { Selector, SubscribableStore } from '../../types';
2
+ type TrackedInvocation = {
3
+ args: unknown[] | undefined;
4
+ };
5
+ type PathEntry = {
6
+ path: string[];
7
+ store: SubscribableStore;
8
+ invocation?: TrackedInvocation;
9
+ isLeaf: boolean;
10
+ };
11
+ type SubscriptionBuilder = (store: SubscribableStore, selector: Selector<unknown, unknown>, path: string[]) => void;
12
+ export type PathFinder = {
13
+ buildProxySubscriptions(createSubscription: SubscriptionBuilder, shouldLog: boolean, minConsolidationDepth?: number, shouldBuild?: (paths: Set<PathEntry>) => boolean): void;
14
+ reset(): void;
15
+ trackPath: TrackPathFn;
16
+ };
17
+ export type TrackPathFn = (store: SubscribableStore, path: string[], isLeaf: boolean, invocation?: TrackedInvocation) => void;
18
+ /**
19
+ * A factory that returns a proxy path-tracking object with three methods:
20
+ * - `buildProxySubscriptions()`: builds subscriptions to the final paths
21
+ * - `reset()`: clears all tracked paths
22
+ * - `trackPath()`: records usage of a store path
23
+ */
24
+ export declare function createPathFinder(): PathFinder;
25
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Error reported or thrown by the stores package itself.
3
+ *
4
+ * If an underlying thrown value caused the failure, it is available as `cause`.
5
+ */
6
+ export declare class StoresError extends Error {
7
+ cause?: unknown;
8
+ constructor(message: string, cause?: unknown);
9
+ }
@@ -0,0 +1,9 @@
1
+ export interface Logger {
2
+ debug: (message: string, context?: Record<string, unknown>) => void;
3
+ error: {
4
+ <T extends Error>(error: T, context?: Record<string, unknown>): void;
5
+ <T extends string>(error: T, context?: Record<string, unknown>): void;
6
+ };
7
+ info: (message: string, context?: Record<string, unknown>) => void;
8
+ warn: (message: string, context?: Record<string, unknown>) => void;
9
+ }
@@ -1,5 +1,5 @@
1
+ import { StateCreator } from '../../types';
1
2
  import { SyncContext } from '../sync/syncEnhancer';
2
- import { StateCreator } from '../types';
3
3
  type WrappedOnRehydrateStorage<S> = (userCallback: ((state: S) => ((finalState?: S, error?: unknown) => void) | void) | undefined, syncContext: SyncContext | undefined) => (state: S) => (finalState?: S, error?: unknown) => void;
4
4
  /**
5
5
  * Creates hydration-gating middleware that queues state updates until rehydration completes.
@@ -17,4 +17,3 @@ export declare function createHydrationGate<S>(stateCreator: StateCreator<S>): {
17
17
  wrapOnRehydrateStorage: WrappedOnRehydrateStorage<S>;
18
18
  };
19
19
  export {};
20
- //# sourceMappingURL=createHydrationGate.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { Prettify } from '../../types/objects';
2
+ import { QueryStoreDefaults } from '../config';
3
+ export declare function getQueryStoreDefaults(): Prettify<Required<QueryStoreDefaults>>;
4
+ /**
5
+ * Exponential backoff: starts at `baseDelay` (5s), doubles each retry, capped at `maxDelay` (5m).
6
+ */
7
+ export declare function defaultRetryDelay(retryCount: number): number;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ export { configureStores } from './config';
2
+ export { StoresError } from './errors';
3
+ export { QueryStatuses } from '../queryStore/types';
4
+ export { defaultRetryDelay } from './queryStore/queryStoreDefaults';
5
+ export { getQueryKey, parseQueryKey } from '../queryStore/queryKey';
6
+ export { applyStateUpdate } from '../store/stateUpdate';
7
+ export { replacer, reviver } from '../utils/serialization';
8
+ export { destroyStore, destroyStores, getStoreName, hasGetSnapshot, isDerivedStore, isPersistedStore, isQueryStore, isVirtualStore, } from './storeUtils';
9
+ export { identity, nullObject } from '../utils/core';
10
+ export { createStoreActions } from './createStoreActions';
11
+ export { deepEqual, shallowEqual } from '../utils/equality';
12
+ export { time } from '../utils/time';
@@ -0,0 +1,11 @@
1
+ import type { AttachValue } from '../queryStore/signalTypes';
2
+ import type { StoreApi } from '../store/types';
3
+ import type { EqualityFn, Selector, UnsubscribeFn } from '../types/subscribe';
4
+ export declare const attachValueSubscriptionMap: WeakMap<AttachValue<unknown>, Subscribe>;
5
+ export type Subscribe = (callback: () => void) => UnsubscribeFn;
6
+ export type GetValue = () => unknown;
7
+ export type SetValue = (path: unknown[], value: unknown) => void;
8
+ export declare function $<T>(store: StoreApi<T>): AttachValue<T>;
9
+ export declare function $<T, S>(store: StoreApi<T>, selector: Selector<T, S>, equalityFn?: EqualityFn<S>): AttachValue<S>;
10
+ export declare const createSignal: <T, S>(store: StoreApi<T>, selector: Selector<T, S>, equalityFn: EqualityFn<S>) => [Subscribe, GetValue, SetValue];
11
+ export declare function getAttachValueSubscribeFn<AttachVal extends AttachValue<unknown>>(attachVal: AttachVal): Subscribe | undefined;
@@ -0,0 +1,11 @@
1
+ import type { AsyncPersistStorage, PersistStorageConfig } from '../../store/types';
2
+ import type { AsyncStorageInterface, BaseStoreOptions, EnforceStorageKey, SyncStorageInterface } from '../../types';
3
+ import type { SyncContext } from '../sync/syncEnhancer';
4
+ /**
5
+ * Creates a persist storage object for the base store.
6
+ */
7
+ export declare function createPersistStorage<S, PersistedState extends Partial<S>, PersistReturn>(options: EnforceStorageKey<BaseStoreOptions<S, PersistedState, PersistReturn>>, storage: AsyncStorageInterface | SyncStorageInterface | undefined, syncContext: SyncContext | undefined): PersistStorageConfig<S, PersistedState>;
8
+ /**
9
+ * Creates an asynchronous persist storage adapter.
10
+ */
11
+ export declare function createAsyncPersistStorage<S, PersistedState extends Partial<S>, PersistReturn>(storage: AsyncStorageInterface, options: EnforceStorageKey<BaseStoreOptions<S, PersistedState, PersistReturn>>, persistThrottleMs: number | undefined, syncContext?: SyncContext): AsyncPersistStorage<S, PersistedState>;