@umituz/react-native-firebase 1.13.124 → 1.13.126
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 +1 -1
- package/src/firestore/index.ts +0 -2
- package/src/firestore/infrastructure/middleware/QueryDeduplicationMiddleware.ts +2 -16
- package/src/firestore/utils/firestore-helper.ts +0 -4
- package/src/firestore/utils/operation/operation-executor.util.ts +4 -4
- package/src/firestore/utils/query-builder.ts +0 -6
- package/src/firestore/utils/transaction/transaction.util.ts +2 -2
- package/src/index.ts +0 -1
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.126",
|
|
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",
|
package/src/firestore/index.ts
CHANGED
|
@@ -114,7 +114,6 @@ export {
|
|
|
114
114
|
|
|
115
115
|
// Firestore Helper Utilities
|
|
116
116
|
export {
|
|
117
|
-
getDb,
|
|
118
117
|
withFirestore,
|
|
119
118
|
withFirestoreVoid,
|
|
120
119
|
withFirestoreBool,
|
|
@@ -125,5 +124,4 @@ export {
|
|
|
125
124
|
} from './utils/firestore-helper';
|
|
126
125
|
export type { FirestoreResult, NoDbResult } from './utils/firestore-helper';
|
|
127
126
|
|
|
128
|
-
// Re-export Firestore types
|
|
129
127
|
export type { Timestamp } from 'firebase/firestore';
|
|
@@ -8,8 +8,8 @@ import { generateQueryKey } from '../../utils/deduplication/query-key-generator.
|
|
|
8
8
|
import { PendingQueryManager } from '../../utils/deduplication/pending-query-manager.util';
|
|
9
9
|
import { TimerManager } from '../../utils/deduplication/timer-manager.util';
|
|
10
10
|
|
|
11
|
-
const DEDUPLICATION_WINDOW_MS = 1000;
|
|
12
|
-
const CLEANUP_INTERVAL_MS = 5000;
|
|
11
|
+
const DEDUPLICATION_WINDOW_MS = 1000;
|
|
12
|
+
const CLEANUP_INTERVAL_MS = 5000;
|
|
13
13
|
|
|
14
14
|
export class QueryDeduplicationMiddleware {
|
|
15
15
|
private readonly queryManager: PendingQueryManager;
|
|
@@ -24,9 +24,6 @@ export class QueryDeduplicationMiddleware {
|
|
|
24
24
|
this.timerManager.start();
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
/**
|
|
28
|
-
* Deduplicate a query
|
|
29
|
-
*/
|
|
30
27
|
async deduplicate<T>(
|
|
31
28
|
queryKey: QueryKey,
|
|
32
29
|
queryFn: () => Promise<T>,
|
|
@@ -46,31 +43,20 @@ export class QueryDeduplicationMiddleware {
|
|
|
46
43
|
return promise;
|
|
47
44
|
}
|
|
48
45
|
|
|
49
|
-
/**
|
|
50
|
-
* Clear all pending queries
|
|
51
|
-
*/
|
|
52
46
|
clear(): void {
|
|
53
47
|
this.queryManager.clear();
|
|
54
48
|
}
|
|
55
49
|
|
|
56
|
-
/**
|
|
57
|
-
* Destroy middleware and cleanup resources
|
|
58
|
-
*/
|
|
59
50
|
destroy(): void {
|
|
60
51
|
this.timerManager.destroy();
|
|
61
52
|
this.queryManager.clear();
|
|
62
53
|
}
|
|
63
54
|
|
|
64
|
-
/**
|
|
65
|
-
* Get pending queries count
|
|
66
|
-
*/
|
|
67
55
|
getPendingCount(): number {
|
|
68
56
|
return this.queryManager.size();
|
|
69
57
|
}
|
|
70
58
|
}
|
|
71
59
|
|
|
72
60
|
export const queryDeduplicationMiddleware = new QueryDeduplicationMiddleware();
|
|
73
|
-
|
|
74
|
-
// Re-export types for convenience
|
|
75
61
|
export type { QueryKey };
|
|
76
62
|
|
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
* Provides common patterns for Firestore operations with error handling
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
export { getFirestore } from "../infrastructure/config/FirestoreClient";
|
|
7
6
|
export type { Firestore } from "../infrastructure/config/FirestoreClient";
|
|
8
7
|
|
|
9
|
-
// Re-export result utilities
|
|
10
8
|
export {
|
|
11
9
|
createErrorResult,
|
|
12
10
|
createSuccessResult,
|
|
@@ -17,12 +15,10 @@ export {
|
|
|
17
15
|
NO_DB_ERROR,
|
|
18
16
|
} from "./result/result.util";
|
|
19
17
|
|
|
20
|
-
// Re-export operation utilities
|
|
21
18
|
export {
|
|
22
19
|
withFirestore,
|
|
23
20
|
withFirestoreVoid,
|
|
24
21
|
withFirestoreBool,
|
|
25
22
|
} from "./operation/operation-executor.util";
|
|
26
23
|
|
|
27
|
-
// Re-export transaction utilities
|
|
28
24
|
export { runTransaction, serverTimestamp } from "./transaction/transaction.util";
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { Firestore } from "../../infrastructure/config/FirestoreClient";
|
|
7
|
-
import {
|
|
7
|
+
import { getFirestore } from "../../infrastructure/config/FirestoreClient";
|
|
8
8
|
import type { FirestoreResult } from "../result/result.util";
|
|
9
9
|
import { NO_DB_ERROR } from "../result/result.util";
|
|
10
10
|
|
|
@@ -15,7 +15,7 @@ import { NO_DB_ERROR } from "../result/result.util";
|
|
|
15
15
|
export async function withFirestore<T>(
|
|
16
16
|
operation: (db: Firestore) => Promise<FirestoreResult<T>>,
|
|
17
17
|
): Promise<FirestoreResult<T>> {
|
|
18
|
-
const db =
|
|
18
|
+
const db = getFirestore();
|
|
19
19
|
if (!db) {
|
|
20
20
|
return NO_DB_ERROR as FirestoreResult<T>;
|
|
21
21
|
}
|
|
@@ -28,7 +28,7 @@ export async function withFirestore<T>(
|
|
|
28
28
|
export async function withFirestoreVoid(
|
|
29
29
|
operation: (db: Firestore) => Promise<void>,
|
|
30
30
|
): Promise<void> {
|
|
31
|
-
const db =
|
|
31
|
+
const db = getFirestore();
|
|
32
32
|
if (!db) {
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
@@ -41,7 +41,7 @@ export async function withFirestoreVoid(
|
|
|
41
41
|
export async function withFirestoreBool(
|
|
42
42
|
operation: (db: Firestore) => Promise<boolean>,
|
|
43
43
|
): Promise<boolean> {
|
|
44
|
-
const db =
|
|
44
|
+
const db = getFirestore();
|
|
45
45
|
if (!db) {
|
|
46
46
|
return false;
|
|
47
47
|
}
|
|
@@ -20,9 +20,6 @@ export interface QueryBuilderOptions {
|
|
|
20
20
|
cursorValue?: number;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
/**
|
|
24
|
-
* Build Firestore query with advanced filtering support
|
|
25
|
-
*/
|
|
26
23
|
export function buildQuery(
|
|
27
24
|
db: Firestore,
|
|
28
25
|
options: QueryBuilderOptions,
|
|
@@ -39,12 +36,10 @@ export function buildQuery(
|
|
|
39
36
|
const collectionRef = collection(db, collectionName);
|
|
40
37
|
let q: Query = collectionRef;
|
|
41
38
|
|
|
42
|
-
// Apply base filters
|
|
43
39
|
for (const filter of baseFilters) {
|
|
44
40
|
q = applyFieldFilter(q, filter);
|
|
45
41
|
}
|
|
46
42
|
|
|
47
|
-
// Apply modifiers in correct order
|
|
48
43
|
q = applyDateRange(q, dateRange);
|
|
49
44
|
q = applySort(q, sort);
|
|
50
45
|
q = applyCursor(q, cursorValue);
|
|
@@ -53,6 +48,5 @@ export function buildQuery(
|
|
|
53
48
|
return q;
|
|
54
49
|
}
|
|
55
50
|
|
|
56
|
-
// Re-export filter utilities for convenience
|
|
57
51
|
export { createInFilter, createEqualFilter, createFieldFilter };
|
|
58
52
|
export type { FieldFilter, SortOptions, DateRangeOptions };
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
serverTimestamp as fbServerTimestamp,
|
|
9
9
|
type Transaction,
|
|
10
10
|
} from "firebase/firestore";
|
|
11
|
-
import {
|
|
11
|
+
import { getFirestore } from "../../infrastructure/config/FirestoreClient";
|
|
12
12
|
import type { Firestore } from "../../infrastructure/config/FirestoreClient";
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -18,7 +18,7 @@ import type { Firestore } from "../../infrastructure/config/FirestoreClient";
|
|
|
18
18
|
export async function runTransaction<T>(
|
|
19
19
|
updateFunction: (transaction: Transaction) => Promise<T>
|
|
20
20
|
): Promise<T> {
|
|
21
|
-
const db =
|
|
21
|
+
const db = getFirestore();
|
|
22
22
|
if (!db) {
|
|
23
23
|
throw new Error("[runTransaction] Firestore database is not initialized. Please ensure Firebase is properly initialized before running transactions.");
|
|
24
24
|
}
|