@umituz/react-native-storage 1.2.0 → 1.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-storage",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Domain-Driven Design storage system for React Native apps with type-safe AsyncStorage operations",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -41,7 +41,7 @@ export const unwrap = <T>(result: StorageResult<T>, defaultValue: T): T => {
41
41
  if (result.success) {
42
42
  return result.data;
43
43
  }
44
- return result.fallback ?? defaultValue;
44
+ return result.fallback !== undefined ? result.fallback : defaultValue;
45
45
  };
46
46
 
47
47
  /**
@@ -54,5 +54,5 @@ export const map = <T, U>(
54
54
  if (result.success) {
55
55
  return success(fn(result.data));
56
56
  }
57
- return result as StorageResult<U>;
57
+ return failure(result.error, result.fallback !== undefined ? fn(result.fallback) : undefined);
58
58
  };
package/src/index.ts CHANGED
@@ -62,9 +62,9 @@ export {
62
62
  } from './infrastructure/repositories/AsyncStorageRepository';
63
63
 
64
64
  export {
65
- zustandStorage,
65
+ storageService,
66
66
  type StateStorage,
67
- } from './infrastructure/adapters/ZustandAdapter';
67
+ } from './infrastructure/adapters/StorageService';
68
68
 
69
69
  // =============================================================================
70
70
  // PRESENTATION LAYER - Hooks
@@ -1,15 +1,14 @@
1
1
  /**
2
- * Zustand Storage Adapter
2
+ * Storage Service
3
3
  *
4
- * Provides Zustand persist middleware compatible StateStorage interface.
4
+ * Zustand persist middleware compatible StateStorage implementation.
5
5
  * Uses AsyncStorage under the hood for React Native persistence.
6
6
  */
7
7
 
8
8
  import AsyncStorage from '@react-native-async-storage/async-storage';
9
9
 
10
10
  /**
11
- * Zustand StateStorage interface
12
- * Compatible with zustand/middleware persist
11
+ * StateStorage interface for Zustand persist middleware
13
12
  */
14
13
  export interface StateStorage {
15
14
  getItem: (name: string) => string | null | Promise<string | null>;
@@ -18,10 +17,10 @@ export interface StateStorage {
18
17
  }
19
18
 
20
19
  /**
21
- * Zustand-compatible storage adapter
22
- * Direct AsyncStorage implementation for Zustand persist middleware
20
+ * Storage service for Zustand persist middleware
21
+ * Direct AsyncStorage implementation
23
22
  */
24
- export const zustandStorage: StateStorage = {
23
+ export const storageService: StateStorage = {
25
24
  getItem: async (name: string): Promise<string | null> => {
26
25
  try {
27
26
  return await AsyncStorage.getItem(name);
@@ -34,7 +33,7 @@ export const zustandStorage: StateStorage = {
34
33
  try {
35
34
  await AsyncStorage.setItem(name, value);
36
35
  } catch {
37
- // Silent fail - Zustand handles retry
36
+ // Silent fail
38
37
  }
39
38
  },
40
39