@react-native-async-storage/async-storage
Advanced tools
Comparing version 1.15.11 to 1.15.12
{ | ||
"name": "@react-native-async-storage/async-storage", | ||
"version": "1.15.11", | ||
"version": "1.15.12", | ||
"description": "Asynchronous, persistent, key-value storage system for React Native.", | ||
@@ -77,2 +77,4 @@ "main": "lib/commonjs/index.js", | ||
"@react-native-community/eslint-config": "^3.0.0", | ||
"@semantic-release/changelog": "^5.0.1", | ||
"@semantic-release/git": "9.0.0", | ||
"detox": "17.10.6", | ||
@@ -96,3 +98,3 @@ "eslint": "^7.0.0", | ||
"react-test-renderer": "16.13.1", | ||
"semantic-release": "^17.2.1" | ||
"semantic-release": "^17.4.6" | ||
}, | ||
@@ -99,0 +101,0 @@ "jest": { |
// CREDITS: This types are based on the original work made by all the people who contributed to @types/react-native | ||
interface AsyncStorage { | ||
/** | ||
* Fetches key and passes the result to callback, along with an Error if there is any. | ||
*/ | ||
getItem(key: string, callback?: (error?: Error, result?: string) => void): Promise<string | null>; | ||
/** | ||
* Sets value for key and calls callback on completion, along with an Error if there is any | ||
*/ | ||
setItem(key: string, value: string, callback?: (error?: Error) => void): Promise<void>; | ||
removeItem(key: string, callback?: (error?: Error) => void): Promise<void>; | ||
/** | ||
* Merges existing value with input value, assuming they are stringified json. Returns a Promise object. | ||
* Not supported by all native implementation | ||
*/ | ||
mergeItem(key: string, value: string, callback?: (error?: Error) => void): Promise<void>; | ||
/** | ||
* Erases all AsyncStorage for all clients, libraries, etc. You probably don't want to call this. | ||
* Use removeItem or multiRemove to clear only your own keys instead. | ||
*/ | ||
clear(callback?: (error?: Error) => void): Promise<void>; | ||
/** | ||
* Gets all keys known to the app, for all callers, libraries, etc | ||
*/ | ||
getAllKeys(callback?: (error?: Error, keys?: string[]) => void): Promise<string[]>; | ||
/** | ||
* multiGet invokes callback with an array of key-value pair arrays that matches the input format of multiSet | ||
*/ | ||
multiGet( | ||
keys: string[], | ||
callback?: (errors?: Error[], result?: [string, string | null][]) => void | ||
): Promise<[string, string | null][]>; | ||
/** | ||
* multiSet and multiMerge take arrays of key-value array pairs that match the output of multiGet, | ||
* | ||
* multiSet([['k1', 'val1'], ['k2', 'val2']], cb); | ||
*/ | ||
multiSet(keyValuePairs: string[][], callback?: (errors?: Error[]) => void): Promise<void>; | ||
/** | ||
* Delete all the keys in the keys array. | ||
*/ | ||
multiRemove(keys: string[], callback?: (errors?: Error[]) => void): Promise<void>; | ||
/** | ||
* Merges existing values with input values, assuming they are stringified json. | ||
* Returns a Promise object. | ||
* | ||
* Not supported by all native implementations. | ||
*/ | ||
multiMerge(keyValuePairs: string[][], callback?: (errors?: Error[]) => void): Promise<void>; | ||
} | ||
type AsyncStorageHook = { | ||
getItem(callback?: (error?: Error, result?: string) => void): Promise<string | null>; | ||
setItem(value: string, callback?: (error?: Error) => void): Promise<void>; | ||
mergeItem(value: string, callback?: (error?: Error) => void): Promise<void>; | ||
removeItem(callback?: (error?: Error) => void): Promise<void>; | ||
} | ||
declare module '@react-native-async-storage/async-storage' { | ||
@@ -19,71 +85,11 @@ /** | ||
*/ | ||
export interface AsyncStorageStatic { | ||
/** | ||
* Fetches key and passes the result to callback, along with an Error if there is any. | ||
*/ | ||
getItem(key: string, callback?: (error?: Error, result?: string) => void): Promise<string | null>; | ||
export function useAsyncStorage(key: string): AsyncStorageHook | ||
const AsyncStorageLib: AsyncStorage; | ||
export default AsyncStorageLib; | ||
} | ||
/** | ||
* Sets value for key and calls callback on completion, along with an Error if there is any | ||
*/ | ||
setItem(key: string, value: string, callback?: (error?: Error) => void): Promise<void>; | ||
removeItem(key: string, callback?: (error?: Error) => void): Promise<void>; | ||
/** | ||
* Merges existing value with input value, assuming they are stringified json. Returns a Promise object. | ||
* Not supported by all native implementation | ||
*/ | ||
mergeItem(key: string, value: string, callback?: (error?: Error) => void): Promise<void>; | ||
/** | ||
* Erases all AsyncStorage for all clients, libraries, etc. You probably don't want to call this. | ||
* Use removeItem or multiRemove to clear only your own keys instead. | ||
*/ | ||
clear(callback?: (error?: Error) => void): Promise<void>; | ||
/** | ||
* Gets all keys known to the app, for all callers, libraries, etc | ||
*/ | ||
getAllKeys(callback?: (error?: Error, keys?: string[]) => void): Promise<string[]>; | ||
/** | ||
* multiGet invokes callback with an array of key-value pair arrays that matches the input format of multiSet | ||
*/ | ||
multiGet( | ||
keys: string[], | ||
callback?: (errors?: Error[], result?: [string, string | null][]) => void | ||
): Promise<[string, string | null][]>; | ||
/** | ||
* multiSet and multiMerge take arrays of key-value array pairs that match the output of multiGet, | ||
* | ||
* multiSet([['k1', 'val1'], ['k2', 'val2']], cb); | ||
*/ | ||
multiSet(keyValuePairs: string[][], callback?: (errors?: Error[]) => void): Promise<void>; | ||
/** | ||
* Delete all the keys in the keys array. | ||
*/ | ||
multiRemove(keys: string[], callback?: (errors?: Error[]) => void): Promise<void>; | ||
/** | ||
* Merges existing values with input values, assuming they are stringified json. | ||
* Returns a Promise object. | ||
* | ||
* Not supported by all native implementations. | ||
*/ | ||
multiMerge(keyValuePairs: string[][], callback?: (errors?: Error[]) => void): Promise<void>; | ||
} | ||
export function useAsyncStorage(key: string): { | ||
getItem(callback?: (error?: Error, result?: string) => void): Promise<string | null>; | ||
setItem(value: string, callback?: (error?: Error) => void): Promise<void>; | ||
mergeItem(value: string, callback?: (error?: Error) => void): Promise<void>; | ||
removeItem(callback?: (error?: Error) => void): Promise<void>; | ||
} | ||
const AsyncStorage: AsyncStorageStatic; | ||
export default AsyncStorage; | ||
declare module '@react-native-async-storage/async-storage/jest/async-storage-mock' { | ||
export function useAsyncStorage(key: string): AsyncStorageHook | ||
const AsyncStorageLib: AsyncStorage; | ||
export default AsyncStorageLib; | ||
} |
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
401653
1963
28