@udecode/zustood
Advanced tools
Comparing version 0.4.0 to 0.4.1
# @udecode/zustood | ||
## 0.4.1 | ||
### Patch Changes | ||
- [#20](https://github.com/udecode/zustood/pull/20) [`e7ce19a`](https://github.com/udecode/zustood/commit/e7ce19a98567eb71bc60ed0c968324c11c07dbc3) Thanks [@zbeyens](https://github.com/zbeyens)! - support zustand 3.6 `PersistOptions` | ||
## 0.4.0 | ||
@@ -4,0 +10,0 @@ |
import { StateCreator } from 'zustand'; | ||
import { SetImmerState } from '../types'; | ||
export declare const immerMiddleware: <T extends object>(config: StateCreator<T, import("zustand").SetState<T>>) => StateCreator<T, SetImmerState<T>>; | ||
export declare const immerMiddleware: <T extends object>(config: StateCreator<T, import("zustand").SetState<T>, import("zustand").GetState<T>, import("zustand").StoreApi<T>>) => StateCreator<T, SetImmerState<T>, import("zustand").GetState<T>, import("zustand").StoreApi<T>>; | ||
//# sourceMappingURL=immer.middleware.d.ts.map |
@@ -0,1 +1,2 @@ | ||
import { PersistOptions as _PersistOptions } from 'zustand/middleware'; | ||
export declare type StateStorage = { | ||
@@ -9,51 +10,5 @@ getItem: (name: string) => string | null | Promise<string | null>; | ||
}; | ||
export declare type PersistOptions<S> = { | ||
export declare type PersistOptions<S> = _PersistOptions<S> & { | ||
enabled?: boolean; | ||
/** | ||
* A function returning a storage. | ||
* The storage must fit `window.localStorage`'s api (or an async version of it). | ||
* For example the storage could be `AsyncStorage` from React Native. | ||
* | ||
* @default () => localStorage | ||
*/ | ||
getStorage?: () => StateStorage; | ||
/** | ||
* Use a custom serializer. | ||
* The returned string will be stored in the storage. | ||
* | ||
* @default JSON.stringify | ||
*/ | ||
serialize?: (state: StorageValue<S>) => string | Promise<string>; | ||
/** | ||
* Use a custom deserializer. | ||
* | ||
* @param str The storage's current value. | ||
* @default JSON.parse | ||
*/ | ||
deserialize?: (str: string) => StorageValue<S> | Promise<StorageValue<S>>; | ||
/** | ||
* Prevent some items from being stored. | ||
*/ | ||
blacklist?: (keyof S)[]; | ||
/** | ||
* Only store the listed properties. | ||
*/ | ||
whitelist?: (keyof S)[]; | ||
/** | ||
* A function returning another (optional) function. | ||
* The main function will be called before the state rehydration. | ||
* The returned function will be called after the state rehydration or when an error occurred. | ||
*/ | ||
onRehydrateStorage?: (state: S) => ((state?: S, error?: Error) => void) | void; | ||
/** | ||
* If the stored state's version mismatch the one specified here, the storage will not be used. | ||
* This is useful when adding a breaking change to your store. | ||
*/ | ||
version?: number; | ||
/** | ||
* A function to perform persisted state migration. | ||
* This function will be called when persisted state versions mismatch with the one specified here. | ||
*/ | ||
migrate?: (persistedState: any, version: number) => S | Promise<S>; | ||
}; | ||
//# sourceMappingURL=PersistOptions.d.ts.map |
{ | ||
"name": "@udecode/zustood", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "A modular store factory using zustand", | ||
@@ -36,3 +36,3 @@ "keywords": [ | ||
"peerDependencies": { | ||
"zustand": "3.5.10" | ||
"zustand": ">=3.5.10" | ||
}, | ||
@@ -39,0 +39,0 @@ "publishConfig": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
853339
5957