@umituz/react-native-firebase 1.13.58 β†’ 1.13.60

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 (43) hide show
  1. package/README.md +277 -0
  2. package/package.json +10 -5
  3. package/scripts/README.md +513 -0
  4. package/src/auth/README.md +339 -0
  5. package/src/auth/domain/README.md +264 -0
  6. package/src/auth/domain/errors/README.md +291 -0
  7. package/src/auth/infrastructure/config/README.md +239 -0
  8. package/src/auth/infrastructure/config/initializers/FirebaseAuthInitializer.ts +1 -1
  9. package/src/auth/infrastructure/services/README.md +346 -0
  10. package/src/auth/infrastructure/stores/README.md +407 -0
  11. package/src/auth/infrastructure/stores/auth.store.ts +1 -1
  12. package/src/auth/presentation/hooks/README.md +442 -0
  13. package/src/auth/presentation/hooks/useAnonymousAuth.ts +4 -4
  14. package/src/auth/presentation/hooks/utils/auth-state-change.handler.ts +1 -1
  15. package/src/domain/README.md +628 -0
  16. package/src/firestore/README.md +566 -0
  17. package/src/firestore/domain/README.md +325 -0
  18. package/src/firestore/domain/constants/README.md +332 -0
  19. package/src/firestore/domain/entities/README.md +286 -0
  20. package/src/firestore/domain/errors/README.md +389 -0
  21. package/src/firestore/infrastructure/config/FirestoreClient.ts +1 -1
  22. package/src/firestore/infrastructure/config/README.md +239 -0
  23. package/src/firestore/infrastructure/middleware/README.md +316 -0
  24. package/src/firestore/infrastructure/repositories/BaseRepository.ts +1 -1
  25. package/src/firestore/infrastructure/repositories/README.md +425 -0
  26. package/src/firestore/infrastructure/services/README.md +332 -0
  27. package/src/firestore/infrastructure/services/RequestLoggerService.ts +4 -4
  28. package/src/firestore/types/pagination/README.md +332 -0
  29. package/src/firestore/utils/README.md +574 -0
  30. package/src/firestore/utils/dateUtils/README.md +171 -0
  31. package/src/firestore/utils/document-mapper.helper/README.md +309 -0
  32. package/src/firestore/utils/pagination.helper/README.md +298 -0
  33. package/src/firestore/utils/path-resolver/README.md +277 -0
  34. package/src/firestore/utils/query-builder/README.md +291 -0
  35. package/src/firestore/utils/quota-error-detector/README.md +355 -0
  36. package/src/infrastructure/README.md +408 -0
  37. package/src/infrastructure/config/FirebaseClient.ts +1 -1
  38. package/src/infrastructure/config/README.md +262 -0
  39. package/src/presentation/README.md +556 -0
  40. package/src/storage/README.md +493 -0
  41. package/src/storage/deleter/README.md +370 -0
  42. package/src/storage/types/README.md +313 -0
  43. package/src/storage/uploader/README.md +409 -0
package/README.md ADDED
@@ -0,0 +1,277 @@
1
+ # @umituz/react-native-firebase
2
+
3
+ [![npm version](https://badge.fury.io/js/%40umituz%2Freact-native-firebase.svg)](https://www.npmjs.com/package/%40umituz%2Freact-native-firebase)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ Comprehensive Firebase package for React Native applications using Firebase JS SDK (no native modules required). Built with Domain-Driven Design (DDD) architecture.
7
+
8
+ ## πŸš€ Quick Start
9
+
10
+ **Read First:** Before using this package, read the [CONTRIBUTING.md](./CONTRIBUTING.md) for development guidelines and AI instructions.
11
+
12
+ ### Installation
13
+
14
+ ```bash
15
+ npm install @umituz/react-native-firebase firebase
16
+
17
+ # Required peer dependencies
18
+ npm install expo-apple-authentication expo-crypto @umituz/react-native-storage
19
+ ```
20
+
21
+ ### Basic Usage Strategy
22
+
23
+ 1. **Initialize Firebase** once at app startup
24
+ 2. **Use hooks** for authentication state
25
+ 3. **Use repositories** for database operations
26
+ 4. **Follow module-specific guidelines** in each README
27
+
28
+ ## πŸ“¦ Modules
29
+
30
+ ### Auth Module
31
+ **Location:** [src/auth/README.md](./src/auth/README.md)
32
+
33
+ Provides authentication functionality:
34
+ - Anonymous, Google, Apple, Email/Password authentication
35
+ - Auth state management with React hooks
36
+ - Account deletion and reauthentication
37
+ - Auth guards for protected routes
38
+
39
+ **Key Strategy:** Never use Firebase Auth SDK directly in UI. Always use the provided hooks and services.
40
+
41
+ ### Firestore Module
42
+ **Location:** [src/firestore/README.md](./src/firestore/README.md)
43
+
44
+ Database operations with repository pattern:
45
+ - Base, Query, and Paginated repositories
46
+ - Quota management and tracking
47
+ - Middleware for caching and monitoring
48
+ - Request logging and analytics
49
+
50
+ **Key Strategy:** Always access Firestore through repositories. Never bypass the repository layer.
51
+
52
+ ### Storage Module
53
+ **Location:** [src/storage/README.md](./src/storage/README.md)
54
+
55
+ File storage operations:
56
+ - Base64 and file uploads
57
+ - Single and batch deletion
58
+ - Metadata management
59
+
60
+ **Key Strategy:** Always clean up old files. Use organized path structures.
61
+
62
+ ### Admin Scripts
63
+ **Location:** [scripts/README.md](./scripts/README.md)
64
+
65
+ Backend utilities:
66
+ - User management and cleanup
67
+ - Firestore collection operations
68
+ - Storage file management
69
+
70
+ **Key Strategy:** Use for admin operations, not in client apps.
71
+
72
+ ## πŸ—οΈ Architecture
73
+
74
+ This package follows **Domain-Driven Design (DDD)** principles.
75
+
76
+ ### Layer Structure
77
+
78
+ ```
79
+ β”œβ”€β”€ domain/ # Business logic (entities, errors, value objects)
80
+ β”œβ”€β”€ infrastructure/ # External dependencies (Firebase, APIs)
81
+ └── presentation/ # UI integration (React hooks, components)
82
+ ```
83
+
84
+ ### Key Design Patterns
85
+
86
+ - **Repository Pattern** - Data access through repository abstractions
87
+ - **Middleware Pattern** - Cross-cutting concerns (logging, caching)
88
+ - **Service Layer** - Business logic encapsulation
89
+ - **Factory Pattern** - Object creation and initialization
90
+
91
+ ## βœ… Required Practices
92
+
93
+ ### For All Modules
94
+
95
+ 1. **Type Safety:** Use TypeScript strict mode
96
+ 2. **Error Handling:** Handle all errors appropriately
97
+ 3. **Documentation:** Keep README files in sync with code
98
+ 4. **Testing:** Write tests for new functionality
99
+ 5. **File Size:** Keep files under 200 lines
100
+
101
+ ### For Authentication
102
+
103
+ 1. Use hooks (never Firebase SDK directly in UI)
104
+ 2. Protect routes with auth guards
105
+ 3. Handle auth state changes properly
106
+ 4. Clean up auth listeners on unmount
107
+
108
+ ### For Firestore
109
+
110
+ 1. Always use repositories for data access
111
+ 2. Use pagination for large datasets
112
+ 3. Track quota usage with middleware
113
+ 4. Create appropriate indexes in Firebase Console
114
+ 5. Use query builders for complex queries
115
+
116
+ ### For Storage
117
+
118
+ 1. Clean up old files before uploading new ones
119
+ 2. Use organized path structures
120
+ 3. Add metadata to files for tracking
121
+ 4. Handle deletion errors gracefully
122
+
123
+ ## 🚫 Forbidden Practices
124
+
125
+ ### Architecture Violations
126
+
127
+ - ❌ Mixing architectural layers (e.g., infrastructure importing from domain)
128
+ - ❌ Bypassing repositories to access Firestore directly
129
+ - ❌ Using Firebase SDK directly in UI components
130
+ - ❌ Creating circular dependencies between modules
131
+ - ❌ Putting business logic in presentation layer
132
+
133
+ ### Code Quality Issues
134
+
135
+ - ❌ Files larger than 200 lines
136
+ - ❌ Duplicated code
137
+ - ❌ Using `any` type
138
+ - ❌ Magic numbers or strings (use constants)
139
+ - ❌ Hardcoded configuration values
140
+
141
+ ### Anti-Patterns
142
+
143
+ - ❌ Hardcoded credentials or API keys
144
+ - ❌ Console.log in production code
145
+ - ❌ Swallowing errors silently
146
+ - ❌ Ignoring TypeScript errors
147
+
148
+ ## πŸ€– For AI Agents
149
+
150
+ ### When Writing Code
151
+
152
+ 1. **READ** the module-specific README first
153
+ 2. **FOLLOW** existing patterns in the codebase
154
+ 3. **RESPECT** architectural boundaries
155
+ 4. **CHECK** file size limits (max 200 lines)
156
+ 5. **USE** established utilities and services
157
+
158
+ ### Before Generating Code
159
+
160
+ 1. Search for similar existing functionality
161
+ 2. Check if a utility already exists
162
+ 3. Read the relevant module README
163
+ 4. Understand the architectural layer
164
+
165
+ ### Code Generation Rules
166
+
167
+ 1. Keep files under 200 lines
168
+ 2. Follow TypeScript strict mode
169
+ 3. Use proper naming conventions
170
+ 4. Handle all errors
171
+ 5. Add JSDoc comments for public APIs
172
+
173
+ ## πŸ“š Documentation
174
+
175
+ - **[Development Guidelines](./CONTRIBUTING.md)** - Must read before contributing
176
+ - **[Auth Module](./src/auth/README.md)** - Authentication strategies and rules
177
+ - **[Firestore Module](./src/firestore/README.md)** - Database operations and patterns
178
+ - **[Storage Module](./src/storage/README.md)** - File storage guidelines
179
+ - **[Infrastructure](./src/infrastructure/README.md)** - Core setup and configuration
180
+
181
+ ## 🎯 Usage Strategies
182
+
183
+ ### Authentication Strategy
184
+
185
+ 1. Initialize Firebase once at app startup
186
+ 2. Use `useFirebaseAuth` hook for auth state
187
+ 3. Use specific auth hooks for different providers
188
+ 4. Protect routes with auth guards
189
+ 5. Handle auth errors with user-friendly messages
190
+
191
+ ### Database Strategy
192
+
193
+ 1. Create repositories extending base repository classes
194
+ 2. Use pagination for large datasets
195
+ 3. Register middleware for quota tracking
196
+ 4. Use query builders for complex queries
197
+ 5. Monitor quota usage regularly
198
+
199
+ ### File Storage Strategy
200
+
201
+ 1. Use organized path structures (e.g., `users/{userId}/avatar.jpg`)
202
+ 2. Delete old files before uploading new ones
203
+ 3. Add metadata for tracking
204
+ 4. Handle upload/deletion errors appropriately
205
+
206
+ ## πŸ”§ Environment Setup
207
+
208
+ ### Required Environment Variables
209
+
210
+ ```bash
211
+ EXPO_PUBLIC_FIREBASE_API_KEY=your-api-key
212
+ EXPO_PUBLIC_FIREBASE_PROJECT_ID=your-project-id
213
+ EXPO_PUBLIC_FIREBASE_STORAGE_BUCKET=your-bucket
214
+ ```
215
+
216
+ ### Firebase Console Setup
217
+
218
+ 1. Create Firebase project
219
+ 2. Enable required services (Auth, Firestore, Storage)
220
+ 3. Configure authentication providers
221
+ 4. Set security rules for Firestore and Storage
222
+
223
+ ## πŸ“‹ Module Documentation
224
+
225
+ Each module has comprehensive documentation including:
226
+ - Purpose and responsibilities
227
+ - Architecture overview
228
+ - Usage strategies
229
+ - Required practices
230
+ - Forbidden practices
231
+ - AI agent instructions
232
+
233
+ **Read the module-specific README before working on that module.**
234
+
235
+ ## πŸ› οΈ Development
236
+
237
+ ### Type Checking
238
+
239
+ ```bash
240
+ npm run typecheck
241
+ ```
242
+
243
+ ### Linting
244
+
245
+ ```bash
246
+ npm run lint
247
+ ```
248
+
249
+ ### Building
250
+
251
+ ```bash
252
+ npm run build:scripts
253
+ ```
254
+
255
+ ## πŸ“ Contributing
256
+
257
+ 1. Read [CONTRIBUTING.md](./CONTRIBUTING.md)
258
+ 2. Read module-specific README
259
+ 3. Follow architectural patterns
260
+ 4. Keep files under 200 lines
261
+ 5. Update documentation if behavior changes
262
+ 6. Ensure all tests pass
263
+
264
+ ## πŸ“„ License
265
+
266
+ MIT License - see [LICENSE](./LICENSE) for details.
267
+
268
+ ## πŸ†˜ Support
269
+
270
+ - **Issues:** [GitHub Issues](https://github.com/umituz/react-native-firebase/issues)
271
+ - **Email:** umit@umituz.com
272
+
273
+ ---
274
+
275
+ **Last Updated:** 2025-01-08
276
+ **Version:** 1.13.58
277
+ **Maintainer:** Ümit UZ <umit@umituz.com>
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@umituz/react-native-firebase",
3
- "version": "1.13.58",
3
+ "version": "1.13.60",
4
4
  "description": "Unified Firebase package for React Native apps - Auth and Firestore services using Firebase JS SDK (no native modules).",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
7
7
  "scripts": {
8
8
  "build:scripts": "tsc -p tsconfig.scripts.json",
9
9
  "prepublishOnly": "npm run build:scripts",
10
- "typecheck": "echo 'TypeScript validation passed'",
11
- "lint": "echo 'Lint passed'",
10
+ "typecheck": "tsc --noEmit",
11
+ "lint": "eslint src --ext .ts,.tsx --max-warnings 0",
12
12
  "version:patch": "npm version patch -m 'chore: release v%s'",
13
13
  "version:minor": "npm version minor -m 'chore: release v%s'",
14
14
  "version:major": "npm version major -m 'chore: release v%s'"
@@ -32,7 +32,7 @@
32
32
  "url": "https://github.com/umituz/react-native-firebase"
33
33
  },
34
34
  "peerDependencies": {
35
- "@umituz/react-native-storage": "latest",
35
+ "@umituz/react-native-storage": "*",
36
36
  "expo-apple-authentication": ">=6.0.0",
37
37
  "expo-crypto": ">=13.0.0",
38
38
  "firebase": ">=10.0.0",
@@ -43,7 +43,12 @@
43
43
  "@react-native-async-storage/async-storage": "^2.2.0",
44
44
  "@types/jest": "^30.0.0",
45
45
  "@types/react": "~19.1.10",
46
- "@umituz/react-native-storage": "latest",
46
+ "@typescript-eslint/eslint-plugin": "^8.52.0",
47
+ "@typescript-eslint/parser": "^8.52.0",
48
+ "@umituz/react-native-storage": "*",
49
+ "eslint": "^9.39.2",
50
+ "eslint-plugin-react": "^7.37.5",
51
+ "eslint-plugin-react-native": "^5.0.0",
47
52
  "expo-apple-authentication": "^8.0.8",
48
53
  "expo-crypto": "^15.0.8",
49
54
  "firebase": "^12.6.0",