@umituz/react-native-storage 1.1.1 → 1.1.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.
package/package.json
CHANGED
|
@@ -54,6 +54,11 @@ export interface IStorageRepository {
|
|
|
54
54
|
*/
|
|
55
55
|
getMultiple(keys: string[]): Promise<StorageResult<Record<string, string | null>>>;
|
|
56
56
|
|
|
57
|
+
/**
|
|
58
|
+
* Get all keys from storage
|
|
59
|
+
*/
|
|
60
|
+
getAllKeys(): Promise<StorageResult<string[]>>;
|
|
61
|
+
|
|
57
62
|
/**
|
|
58
63
|
* Get object from storage (alias for getItem for backward compatibility)
|
|
59
64
|
* @deprecated Use getItem instead
|
|
@@ -144,6 +144,18 @@ export class AsyncStorageRepository implements IStorageRepository {
|
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
+
/**
|
|
148
|
+
* Get all keys from storage
|
|
149
|
+
*/
|
|
150
|
+
async getAllKeys(): Promise<StorageResult<string[]>> {
|
|
151
|
+
try {
|
|
152
|
+
const keys = await AsyncStorage.getAllKeys();
|
|
153
|
+
return success([...keys]);
|
|
154
|
+
} catch (error) {
|
|
155
|
+
return failure(new StorageReadError('ALL_KEYS', error));
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
147
159
|
/**
|
|
148
160
|
* Get object from storage (alias for getItem for backward compatibility)
|
|
149
161
|
* @deprecated Use getItem instead
|