@umituz/react-native-firebase 1.13.58 β 1.13.59
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/README.md +277 -0
- package/package.json +1 -1
- package/scripts/README.md +513 -0
- package/src/auth/README.md +339 -0
- package/src/auth/domain/README.md +264 -0
- package/src/auth/domain/errors/README.md +291 -0
- package/src/auth/infrastructure/config/README.md +239 -0
- package/src/auth/infrastructure/services/README.md +346 -0
- package/src/auth/infrastructure/stores/README.md +407 -0
- package/src/auth/presentation/hooks/README.md +442 -0
- package/src/domain/README.md +628 -0
- package/src/firestore/README.md +566 -0
- package/src/firestore/domain/README.md +325 -0
- package/src/firestore/domain/constants/README.md +332 -0
- package/src/firestore/domain/entities/README.md +286 -0
- package/src/firestore/domain/errors/README.md +389 -0
- package/src/firestore/infrastructure/config/README.md +239 -0
- package/src/firestore/infrastructure/middleware/README.md +316 -0
- package/src/firestore/infrastructure/repositories/README.md +425 -0
- package/src/firestore/infrastructure/services/README.md +332 -0
- package/src/firestore/types/pagination/README.md +332 -0
- package/src/firestore/utils/README.md +574 -0
- package/src/firestore/utils/dateUtils/README.md +171 -0
- package/src/firestore/utils/document-mapper.helper/README.md +309 -0
- package/src/firestore/utils/pagination.helper/README.md +298 -0
- package/src/firestore/utils/path-resolver/README.md +277 -0
- package/src/firestore/utils/query-builder/README.md +291 -0
- package/src/firestore/utils/quota-error-detector/README.md +355 -0
- package/src/infrastructure/README.md +408 -0
- package/src/infrastructure/config/README.md +262 -0
- package/src/presentation/README.md +556 -0
- package/src/storage/README.md +493 -0
- package/src/storage/deleter/README.md +370 -0
- package/src/storage/types/README.md +313 -0
- package/src/storage/uploader/README.md +409 -0
package/README.md
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
# @umituz/react-native-firebase
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/%40umituz%2Freact-native-firebase)
|
|
4
|
+
[](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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-firebase",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.59",
|
|
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",
|