@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.
- package/package.json +5 -6
- package/src/device/infrastructure/repositories/LegacyDeviceIdRepository.ts +1 -1
- package/src/device/infrastructure/services/DeviceFeatureService.ts +1 -1
- package/src/exception/infrastructure/services/ExceptionLogger.ts +1 -1
- package/src/exception/infrastructure/storage/ExceptionStore.ts +1 -1
- package/src/exports/filesystem.ts +1 -0
- package/src/exports/storage.ts +1 -0
- package/src/filesystem/domain/constants/FileConstants.ts +20 -0
- package/src/filesystem/domain/entities/File.ts +20 -0
- package/src/filesystem/domain/types/FileTypes.ts +43 -0
- package/src/filesystem/domain/utils/FileUtils.ts +86 -0
- package/src/filesystem/index.ts +23 -0
- package/src/filesystem/infrastructure/services/FileSystemService.ts +45 -0
- package/src/filesystem/infrastructure/services/cache.service.ts +48 -0
- package/src/filesystem/infrastructure/services/directory.service.ts +66 -0
- package/src/filesystem/infrastructure/services/download.constants.ts +6 -0
- package/src/filesystem/infrastructure/services/download.service.ts +74 -0
- package/src/filesystem/infrastructure/services/download.types.ts +7 -0
- package/src/filesystem/infrastructure/services/encoding.service.ts +25 -0
- package/src/filesystem/infrastructure/services/file-info.service.ts +52 -0
- package/src/filesystem/infrastructure/services/file-manager.service.ts +81 -0
- package/src/filesystem/infrastructure/services/file-path.service.ts +22 -0
- package/src/filesystem/infrastructure/services/file-reader.service.ts +52 -0
- package/src/filesystem/infrastructure/services/file-writer.service.ts +32 -0
- package/src/filesystem/infrastructure/utils/blob.utils.ts +20 -0
- package/src/image/infrastructure/services/ImageStorageService.ts +1 -1
- package/src/index.ts +9 -0
- package/src/molecules/alerts/AlertStore.ts +1 -1
- package/src/molecules/calendar/infrastructure/storage/EventActions.ts +1 -1
- package/src/molecules/calendar/infrastructure/stores/storageAdapter.ts +1 -1
- package/src/offline/infrastructure/storage/OfflineStore.ts +1 -1
- package/src/onboarding/infrastructure/storage/OnboardingStore.ts +2 -2
- package/src/onboarding/infrastructure/storage/__tests__/OnboardingStore.test.ts +1 -1
- package/src/onboarding/infrastructure/storage/actions/answerActions.ts +1 -1
- package/src/onboarding/infrastructure/storage/actions/storageHelpers.ts +1 -1
- package/src/storage/README.md +185 -0
- package/src/storage/__tests__/integration.test.ts +391 -0
- package/src/storage/__tests__/mocks/asyncStorage.mock.ts +52 -0
- package/src/storage/__tests__/performance.test.tsx +352 -0
- package/src/storage/__tests__/setup.ts +63 -0
- package/src/storage/application/README.md +158 -0
- package/src/storage/application/ports/IStorageRepository.ts +61 -0
- package/src/storage/application/ports/README.md +127 -0
- package/src/storage/cache/README.md +154 -0
- package/src/storage/cache/__tests__/PerformanceAndMemory.test.ts +387 -0
- package/src/storage/cache/__tests__/setup.ts +19 -0
- package/src/storage/cache/domain/Cache.ts +146 -0
- package/src/storage/cache/domain/CacheManager.md +83 -0
- package/src/storage/cache/domain/CacheManager.ts +48 -0
- package/src/storage/cache/domain/CacheStatsTracker.md +169 -0
- package/src/storage/cache/domain/CacheStatsTracker.ts +49 -0
- package/src/storage/cache/domain/CachedValue.md +97 -0
- package/src/storage/cache/domain/ErrorHandler.md +99 -0
- package/src/storage/cache/domain/ErrorHandler.ts +42 -0
- package/src/storage/cache/domain/PatternMatcher.md +122 -0
- package/src/storage/cache/domain/PatternMatcher.ts +30 -0
- package/src/storage/cache/domain/README.md +118 -0
- package/src/storage/cache/domain/__tests__/Cache.test.ts +293 -0
- package/src/storage/cache/domain/__tests__/CacheManager.test.ts +276 -0
- package/src/storage/cache/domain/__tests__/ErrorHandler.test.ts +303 -0
- package/src/storage/cache/domain/__tests__/PatternMatcher.test.ts +261 -0
- package/src/storage/cache/domain/strategies/EvictionStrategy.ts +9 -0
- package/src/storage/cache/domain/strategies/FIFOStrategy.ts +12 -0
- package/src/storage/cache/domain/strategies/LFUStrategy.ts +22 -0
- package/src/storage/cache/domain/strategies/LRUStrategy.ts +22 -0
- package/src/storage/cache/domain/strategies/README.md +117 -0
- package/src/storage/cache/domain/strategies/TTLStrategy.ts +23 -0
- package/src/storage/cache/domain/strategies/__tests__/EvictionStrategies.test.ts +293 -0
- package/src/storage/cache/domain/types/Cache.ts +28 -0
- package/src/storage/cache/domain/types/README.md +107 -0
- package/src/storage/cache/index.ts +28 -0
- package/src/storage/cache/infrastructure/README.md +126 -0
- package/src/storage/cache/infrastructure/TTLCache.ts +103 -0
- package/src/storage/cache/infrastructure/__tests__/TTLCache.test.ts +303 -0
- package/src/storage/cache/presentation/README.md +123 -0
- package/src/storage/cache/presentation/__tests__/ReactHooks.test.ts +514 -0
- package/src/storage/cache/presentation/useCache.ts +76 -0
- package/src/storage/cache/presentation/useCachedValue.ts +88 -0
- package/src/storage/cache/types.d.ts +3 -0
- package/src/storage/domain/README.md +128 -0
- package/src/storage/domain/constants/CacheDefaults.ts +64 -0
- package/src/storage/domain/constants/README.md +105 -0
- package/src/storage/domain/entities/CachedValue.ts +86 -0
- package/src/storage/domain/entities/README.md +109 -0
- package/src/storage/domain/entities/StorageResult.ts +75 -0
- package/src/storage/domain/entities/__tests__/CachedValue.test.ts +149 -0
- package/src/storage/domain/entities/__tests__/StorageResult.test.ts +122 -0
- package/src/storage/domain/errors/README.md +126 -0
- package/src/storage/domain/errors/StorageError.ts +81 -0
- package/src/storage/domain/errors/__tests__/StorageError.test.ts +127 -0
- package/src/storage/domain/factories/README.md +138 -0
- package/src/storage/domain/factories/StoreFactory.ts +59 -0
- package/src/storage/domain/types/README.md +522 -0
- package/src/storage/domain/types/Store.ts +44 -0
- package/src/storage/domain/utils/CacheKeyGenerator.ts +66 -0
- package/src/storage/domain/utils/README.md +127 -0
- package/src/storage/domain/utils/__tests__/devUtils.test.ts +97 -0
- package/src/storage/domain/utils/devUtils.ts +37 -0
- package/src/storage/domain/value-objects/README.md +120 -0
- package/src/storage/domain/value-objects/StorageKey.ts +60 -0
- package/src/storage/index.ts +175 -0
- package/src/storage/infrastructure/README.md +165 -0
- package/src/storage/infrastructure/adapters/README.md +175 -0
- package/src/storage/infrastructure/adapters/StorageService.md +103 -0
- package/src/storage/infrastructure/adapters/StorageService.ts +49 -0
- package/src/storage/infrastructure/repositories/AsyncStorageRepository.ts +98 -0
- package/src/storage/infrastructure/repositories/BaseStorageOperations.ts +100 -0
- package/src/storage/infrastructure/repositories/BatchStorageOperations.ts +42 -0
- package/src/storage/infrastructure/repositories/README.md +121 -0
- package/src/storage/infrastructure/repositories/StringStorageOperations.ts +44 -0
- package/src/storage/infrastructure/repositories/__tests__/AsyncStorageRepository.test.ts +170 -0
- package/src/storage/infrastructure/repositories/__tests__/BaseStorageOperations.test.ts +201 -0
- package/src/storage/presentation/README.md +181 -0
- package/src/storage/presentation/hooks/CacheStorageOperations.ts +94 -0
- package/src/storage/presentation/hooks/README.md +128 -0
- package/src/storage/presentation/hooks/__tests__/usePersistentCache.test.ts +405 -0
- package/src/storage/presentation/hooks/__tests__/useStorage.test.ts +247 -0
- package/src/storage/presentation/hooks/__tests__/useStorageState.test.ts +293 -0
- package/src/storage/presentation/hooks/useCacheState.ts +53 -0
- package/src/storage/presentation/hooks/usePersistentCache.ts +154 -0
- package/src/storage/presentation/hooks/useStorage.ts +102 -0
- package/src/storage/presentation/hooks/useStorageState.ts +71 -0
- package/src/storage/presentation/hooks/useStore.ts +15 -0
- package/src/storage/types/README.md +103 -0
- package/src/theme/infrastructure/globalThemeStore.ts +1 -1
- package/src/theme/infrastructure/storage/ThemeStorage.ts +1 -1
- package/src/theme/infrastructure/stores/themeStore.ts +1 -1
- 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
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Apps should use this for theme persistence.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { storageRepository, unwrap } from '@
|
|
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 '@
|
|
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 '@
|
|
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
|
|