@umituz/react-native-firebase 2.4.33 → 2.4.34
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-firebase",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.34",
|
|
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",
|
|
@@ -61,12 +61,21 @@ export abstract class BaseRepository implements IPathResolver {
|
|
|
61
61
|
getUserCollection(userId: string): CollectionReference<DocumentData> | null {
|
|
62
62
|
const db = this.getDb();
|
|
63
63
|
if (!db) return null;
|
|
64
|
+
if (!userId || userId.trim() === '') {
|
|
65
|
+
throw new Error('userId must be a non-empty string');
|
|
66
|
+
}
|
|
64
67
|
return collection(db, 'users', userId, this.collectionName);
|
|
65
68
|
}
|
|
66
69
|
|
|
67
70
|
getDocRef(userId: string, documentId: string): DocumentReference<DocumentData> | null {
|
|
68
71
|
const db = this.getDb();
|
|
69
72
|
if (!db) return null;
|
|
73
|
+
if (!userId || userId.trim() === '') {
|
|
74
|
+
throw new Error('userId must be a non-empty string');
|
|
75
|
+
}
|
|
76
|
+
if (!documentId || documentId.trim() === '') {
|
|
77
|
+
throw new Error('documentId must be a non-empty string');
|
|
78
|
+
}
|
|
70
79
|
return doc(db, 'users', userId, this.collectionName, documentId);
|
|
71
80
|
}
|
|
72
81
|
|
|
@@ -41,15 +41,12 @@ export class PendingQueryManager {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
|
-
* Add query to pending list
|
|
44
|
+
* Add query to pending list.
|
|
45
|
+
* Cleanup is handled by the caller's finally block in deduplicate().
|
|
45
46
|
*/
|
|
46
47
|
add(key: string, promise: Promise<unknown>): void {
|
|
47
|
-
const wrappedPromise = promise.finally(() => {
|
|
48
|
-
this.pendingQueries.delete(key);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
48
|
this.pendingQueries.set(key, {
|
|
52
|
-
promise
|
|
49
|
+
promise,
|
|
53
50
|
timestamp: Date.now(),
|
|
54
51
|
});
|
|
55
52
|
}
|