@umituz/react-native-design-system 2.8.7 → 2.8.8

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 (128) hide show
  1. package/package.json +5 -6
  2. package/src/device/infrastructure/repositories/LegacyDeviceIdRepository.ts +1 -1
  3. package/src/device/infrastructure/services/DeviceFeatureService.ts +1 -1
  4. package/src/exception/infrastructure/services/ExceptionLogger.ts +1 -1
  5. package/src/exception/infrastructure/storage/ExceptionStore.ts +1 -1
  6. package/src/exports/filesystem.ts +1 -0
  7. package/src/exports/storage.ts +1 -0
  8. package/src/filesystem/domain/constants/FileConstants.ts +20 -0
  9. package/src/filesystem/domain/entities/File.ts +20 -0
  10. package/src/filesystem/domain/types/FileTypes.ts +43 -0
  11. package/src/filesystem/domain/utils/FileUtils.ts +86 -0
  12. package/src/filesystem/index.ts +23 -0
  13. package/src/filesystem/infrastructure/services/FileSystemService.ts +45 -0
  14. package/src/filesystem/infrastructure/services/cache.service.ts +48 -0
  15. package/src/filesystem/infrastructure/services/directory.service.ts +66 -0
  16. package/src/filesystem/infrastructure/services/download.constants.ts +6 -0
  17. package/src/filesystem/infrastructure/services/download.service.ts +74 -0
  18. package/src/filesystem/infrastructure/services/download.types.ts +7 -0
  19. package/src/filesystem/infrastructure/services/encoding.service.ts +25 -0
  20. package/src/filesystem/infrastructure/services/file-info.service.ts +52 -0
  21. package/src/filesystem/infrastructure/services/file-manager.service.ts +81 -0
  22. package/src/filesystem/infrastructure/services/file-path.service.ts +22 -0
  23. package/src/filesystem/infrastructure/services/file-reader.service.ts +52 -0
  24. package/src/filesystem/infrastructure/services/file-writer.service.ts +32 -0
  25. package/src/filesystem/infrastructure/utils/blob.utils.ts +20 -0
  26. package/src/image/infrastructure/services/ImageStorageService.ts +1 -1
  27. package/src/index.ts +9 -0
  28. package/src/molecules/alerts/AlertStore.ts +1 -1
  29. package/src/molecules/calendar/infrastructure/storage/EventActions.ts +1 -1
  30. package/src/molecules/calendar/infrastructure/stores/storageAdapter.ts +1 -1
  31. package/src/offline/infrastructure/storage/OfflineStore.ts +1 -1
  32. package/src/onboarding/infrastructure/storage/OnboardingStore.ts +2 -2
  33. package/src/onboarding/infrastructure/storage/__tests__/OnboardingStore.test.ts +1 -1
  34. package/src/onboarding/infrastructure/storage/actions/answerActions.ts +1 -1
  35. package/src/onboarding/infrastructure/storage/actions/storageHelpers.ts +1 -1
  36. package/src/storage/README.md +185 -0
  37. package/src/storage/__tests__/integration.test.ts +391 -0
  38. package/src/storage/__tests__/mocks/asyncStorage.mock.ts +52 -0
  39. package/src/storage/__tests__/performance.test.tsx +352 -0
  40. package/src/storage/__tests__/setup.ts +63 -0
  41. package/src/storage/application/README.md +158 -0
  42. package/src/storage/application/ports/IStorageRepository.ts +61 -0
  43. package/src/storage/application/ports/README.md +127 -0
  44. package/src/storage/cache/README.md +154 -0
  45. package/src/storage/cache/__tests__/PerformanceAndMemory.test.ts +387 -0
  46. package/src/storage/cache/__tests__/setup.ts +19 -0
  47. package/src/storage/cache/domain/Cache.ts +146 -0
  48. package/src/storage/cache/domain/CacheManager.md +83 -0
  49. package/src/storage/cache/domain/CacheManager.ts +48 -0
  50. package/src/storage/cache/domain/CacheStatsTracker.md +169 -0
  51. package/src/storage/cache/domain/CacheStatsTracker.ts +49 -0
  52. package/src/storage/cache/domain/CachedValue.md +97 -0
  53. package/src/storage/cache/domain/ErrorHandler.md +99 -0
  54. package/src/storage/cache/domain/ErrorHandler.ts +42 -0
  55. package/src/storage/cache/domain/PatternMatcher.md +122 -0
  56. package/src/storage/cache/domain/PatternMatcher.ts +30 -0
  57. package/src/storage/cache/domain/README.md +118 -0
  58. package/src/storage/cache/domain/__tests__/Cache.test.ts +293 -0
  59. package/src/storage/cache/domain/__tests__/CacheManager.test.ts +276 -0
  60. package/src/storage/cache/domain/__tests__/ErrorHandler.test.ts +303 -0
  61. package/src/storage/cache/domain/__tests__/PatternMatcher.test.ts +261 -0
  62. package/src/storage/cache/domain/strategies/EvictionStrategy.ts +9 -0
  63. package/src/storage/cache/domain/strategies/FIFOStrategy.ts +12 -0
  64. package/src/storage/cache/domain/strategies/LFUStrategy.ts +22 -0
  65. package/src/storage/cache/domain/strategies/LRUStrategy.ts +22 -0
  66. package/src/storage/cache/domain/strategies/README.md +117 -0
  67. package/src/storage/cache/domain/strategies/TTLStrategy.ts +23 -0
  68. package/src/storage/cache/domain/strategies/__tests__/EvictionStrategies.test.ts +293 -0
  69. package/src/storage/cache/domain/types/Cache.ts +28 -0
  70. package/src/storage/cache/domain/types/README.md +107 -0
  71. package/src/storage/cache/index.ts +28 -0
  72. package/src/storage/cache/infrastructure/README.md +126 -0
  73. package/src/storage/cache/infrastructure/TTLCache.ts +103 -0
  74. package/src/storage/cache/infrastructure/__tests__/TTLCache.test.ts +303 -0
  75. package/src/storage/cache/presentation/README.md +123 -0
  76. package/src/storage/cache/presentation/__tests__/ReactHooks.test.ts +514 -0
  77. package/src/storage/cache/presentation/useCache.ts +76 -0
  78. package/src/storage/cache/presentation/useCachedValue.ts +88 -0
  79. package/src/storage/cache/types.d.ts +3 -0
  80. package/src/storage/domain/README.md +128 -0
  81. package/src/storage/domain/constants/CacheDefaults.ts +64 -0
  82. package/src/storage/domain/constants/README.md +105 -0
  83. package/src/storage/domain/entities/CachedValue.ts +86 -0
  84. package/src/storage/domain/entities/README.md +109 -0
  85. package/src/storage/domain/entities/StorageResult.ts +75 -0
  86. package/src/storage/domain/entities/__tests__/CachedValue.test.ts +149 -0
  87. package/src/storage/domain/entities/__tests__/StorageResult.test.ts +122 -0
  88. package/src/storage/domain/errors/README.md +126 -0
  89. package/src/storage/domain/errors/StorageError.ts +81 -0
  90. package/src/storage/domain/errors/__tests__/StorageError.test.ts +127 -0
  91. package/src/storage/domain/factories/README.md +138 -0
  92. package/src/storage/domain/factories/StoreFactory.ts +59 -0
  93. package/src/storage/domain/types/README.md +522 -0
  94. package/src/storage/domain/types/Store.ts +44 -0
  95. package/src/storage/domain/utils/CacheKeyGenerator.ts +66 -0
  96. package/src/storage/domain/utils/README.md +127 -0
  97. package/src/storage/domain/utils/__tests__/devUtils.test.ts +97 -0
  98. package/src/storage/domain/utils/devUtils.ts +37 -0
  99. package/src/storage/domain/value-objects/README.md +120 -0
  100. package/src/storage/domain/value-objects/StorageKey.ts +60 -0
  101. package/src/storage/index.ts +175 -0
  102. package/src/storage/infrastructure/README.md +165 -0
  103. package/src/storage/infrastructure/adapters/README.md +175 -0
  104. package/src/storage/infrastructure/adapters/StorageService.md +103 -0
  105. package/src/storage/infrastructure/adapters/StorageService.ts +49 -0
  106. package/src/storage/infrastructure/repositories/AsyncStorageRepository.ts +98 -0
  107. package/src/storage/infrastructure/repositories/BaseStorageOperations.ts +100 -0
  108. package/src/storage/infrastructure/repositories/BatchStorageOperations.ts +42 -0
  109. package/src/storage/infrastructure/repositories/README.md +121 -0
  110. package/src/storage/infrastructure/repositories/StringStorageOperations.ts +44 -0
  111. package/src/storage/infrastructure/repositories/__tests__/AsyncStorageRepository.test.ts +170 -0
  112. package/src/storage/infrastructure/repositories/__tests__/BaseStorageOperations.test.ts +201 -0
  113. package/src/storage/presentation/README.md +181 -0
  114. package/src/storage/presentation/hooks/CacheStorageOperations.ts +94 -0
  115. package/src/storage/presentation/hooks/README.md +128 -0
  116. package/src/storage/presentation/hooks/__tests__/usePersistentCache.test.ts +405 -0
  117. package/src/storage/presentation/hooks/__tests__/useStorage.test.ts +247 -0
  118. package/src/storage/presentation/hooks/__tests__/useStorageState.test.ts +293 -0
  119. package/src/storage/presentation/hooks/useCacheState.ts +53 -0
  120. package/src/storage/presentation/hooks/usePersistentCache.ts +154 -0
  121. package/src/storage/presentation/hooks/useStorage.ts +102 -0
  122. package/src/storage/presentation/hooks/useStorageState.ts +71 -0
  123. package/src/storage/presentation/hooks/useStore.ts +15 -0
  124. package/src/storage/types/README.md +103 -0
  125. package/src/theme/infrastructure/globalThemeStore.ts +1 -1
  126. package/src/theme/infrastructure/storage/ThemeStorage.ts +1 -1
  127. package/src/theme/infrastructure/stores/themeStore.ts +1 -1
  128. package/src/utilities/sharing/infrastructure/services/SharingService.ts +1 -1
@@ -0,0 +1,103 @@
1
+ # Shared Types
2
+
3
+ TypeScript type definitions used across the storage package.
4
+
5
+ ## Overview
6
+
7
+ This directory contains shared type definitions for storage operations, Result pattern, and utility types. Located at `src/types/`.
8
+
9
+ ## Strategies
10
+
11
+ ### Type Organization
12
+ - Define StorageResult for all storage operations
13
+ - Use DynamicStorageKey for type-safe key generation
14
+ - Create utility types for common transformations
15
+ - Export types for external package use
16
+
17
+ ### Result Pattern
18
+ - Use discriminated union for success/failure states
19
+ - Include success flag for type narrowing
20
+ - Preserve error context in failure state
21
+ - Provide type guards for type safety
22
+
23
+ ### Type Safety
24
+ - Use generic type parameters for flexibility
25
+ - Provide type inference where possible
26
+ - Use branded types for distinct primitives
27
+ - Implement conditional types for complex scenarios
28
+
29
+ ### Type Guards
30
+ - Create type guards for runtime validation
31
+ - Use predicate functions for type narrowing
32
+ - Implement instanceof checks for error types
33
+ - Validate structure before type assertions
34
+
35
+ ## Restrictions
36
+
37
+ ### Type Definitions
38
+ - DO NOT use `any` type without compelling reason
39
+ - DO NOT create circular type dependencies
40
+ - DO NOT mix success/failure in same type
41
+ - DO NOT omit error context from Result types
42
+
43
+ ### Type Safety
44
+ - DO NOT use type assertions without validation
45
+ - DO NOT assume optional properties exist
46
+ - DO NOT cast values without type guards
47
+ - DO NOT disable TypeScript rules
48
+
49
+ ### Utility Types
50
+ - DO NOT create overly complex conditional types
51
+ - DO NOT use utility types where simple types suffice
52
+ - DO NOT create recursive types without clear purpose
53
+ - DO NOT mix different type utilities unnecessarily
54
+
55
+ ## Rules
56
+
57
+ ### StorageResult Type
58
+ - MUST use discriminated union with success flag
59
+ - MUST include data in success state
60
+ - MUST include error in failure state
61
+ - MUST provide type parameter for data
62
+
63
+ ### Type Guards
64
+ - MUST return boolean for type predicates
65
+ - MUST use `is` keyword for type narrowing
66
+ - MUST validate all required properties
67
+ - MUST handle edge cases (null, undefined)
68
+
69
+ ### Generic Types
70
+ - MUST provide descriptive type parameter names
71
+ - MUST constrain generics with extends where appropriate
72
+ - MUST provide default values for common cases
73
+ - MUST document generic constraints
74
+
75
+ ### Utility Types
76
+ - MUST follow TypeScript conventions
77
+ - MUST use built-in utility types when possible
78
+ - MUST document custom utility types
79
+ - MUST test utility type behavior
80
+
81
+ ### Import/Export
82
+ - MUST export types used by external packages
83
+ - MUST use `type` keyword for type-only imports
84
+ - MUST avoid value/type ambiguity
85
+ - MUST organize exports logically
86
+
87
+ ### Type Inference
88
+ - MUST enable TypeScript strict mode
89
+ - MUST provide type annotations for public APIs
90
+ - MUST let TypeScript infer where possible
91
+ - MUST use `typeof` for capturing inferred types
92
+
93
+ ### Documentation
94
+ - MUST document complex type transformations
95
+ - MUST provide examples for non-obvious types
96
+ - MUST explain generic constraints
97
+ - MUST warn about type limitations
98
+
99
+ ### Testing
100
+ - MUST test type guards with various inputs
101
+ - MUST verify utility type behavior
102
+ - MUST test conditional type branches
103
+ - MUST validate type inference results
@@ -25,7 +25,7 @@
25
25
  * ```
26
26
  */
27
27
 
28
- import { createStore } from '@umituz/react-native-storage';
28
+ import { createStore } from '@storage';
29
29
  import type { ThemeMode } from '../core/ColorPalette';
30
30
  import type { CustomThemeColors } from '../core/CustomColors';
31
31
 
@@ -6,7 +6,7 @@
6
6
  * Apps should use this for theme persistence.
7
7
  */
8
8
 
9
- import { storageRepository, unwrap } from '@umituz/react-native-storage';
9
+ import { storageRepository, unwrap } from '@storage';
10
10
  import type { ThemeMode } from '../../core/ColorPalette';
11
11
  import { DESIGN_CONSTANTS } from '../../core/constants/DesignConstants';
12
12
 
@@ -10,7 +10,7 @@
10
10
  * - Syncs with design system global theme store
11
11
  */
12
12
 
13
- import { createStore } from '@umituz/react-native-storage';
13
+ import { createStore } from '@storage';
14
14
  import { lightTheme, darkTheme, type Theme } from '../../core/themes';
15
15
  import { ThemeStorage } from '../storage/ThemeStorage';
16
16
  import { useDesignSystemTheme } from '../globalThemeStore';
@@ -9,7 +9,7 @@
9
9
  */
10
10
 
11
11
  import * as Sharing from 'expo-sharing';
12
- import { FileSystemService } from '@umituz/react-native-filesystem';
12
+ import { FileSystemService } from '@filesystem';
13
13
  import type { ShareOptions, ShareResult } from '../../domain/entities/Share';
14
14
  import { SharingUtils } from '../../domain/entities/SharingUtils';
15
15