@umituz/react-native-firebase 1.13.108 → 1.13.109

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": "1.13.108",
3
+ "version": "1.13.109",
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",
@@ -5,13 +5,13 @@
5
5
  * Defines the contract for Firebase client operations
6
6
  */
7
7
 
8
- export type FirebaseApp = any;
8
+ import type { FirebaseApp } from 'firebase/app';
9
9
 
10
10
  /**
11
11
  * Firebase Client Interface
12
12
  * Defines the contract for Firebase client operations
13
- *
14
- * Note:
13
+ *
14
+ * Note:
15
15
  * - Firebase Auth is now handled by @umituz/react-native-firebase-auth
16
16
  * - Firestore is now handled by @umituz/react-native-firestore
17
17
  */
@@ -40,7 +40,3 @@ export interface IFirebaseClient {
40
40
  reset(): void;
41
41
  }
42
42
 
43
-
44
-
45
-
46
-
package/src/auth/index.ts CHANGED
@@ -120,13 +120,13 @@ export {
120
120
  export type {
121
121
  GoogleAuthConfig,
122
122
  GoogleAuthResult,
123
- } from './infrastructure/services/google-auth.service';
123
+ } from './infrastructure/services/google-auth.types';
124
124
 
125
125
  export {
126
126
  AppleAuthService,
127
127
  appleAuthService,
128
128
  } from './infrastructure/services/apple-auth.service';
129
- export type { AppleAuthResult } from './infrastructure/services/apple-auth.service';
129
+ export type { AppleAuthResult } from './infrastructure/services/apple-auth.types';
130
130
 
131
131
  // =============================================================================
132
132
  // PRESENTATION LAYER - Hooks
@@ -7,18 +7,11 @@ import {
7
7
  OAuthProvider,
8
8
  signInWithCredential,
9
9
  type Auth,
10
- type UserCredential,
11
10
  } from "firebase/auth";
12
11
  import * as AppleAuthentication from "expo-apple-authentication";
13
12
  import { Platform } from "react-native";
14
13
  import { generateNonce, hashNonce } from "./crypto.util";
15
-
16
- export interface AppleAuthResult {
17
- success: boolean;
18
- userCredential?: UserCredential;
19
- error?: string;
20
- isNewUser?: boolean;
21
- }
14
+ import type { AppleAuthResult } from "./apple-auth.types";
22
15
 
23
16
  export class AppleAuthService {
24
17
  async isAvailable(): Promise<boolean> {
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Apple Auth Types
3
+ */
4
+
5
+ import type { UserCredential } from "firebase/auth";
6
+
7
+ export interface AppleAuthResult {
8
+ success: boolean;
9
+ userCredential?: UserCredential;
10
+ error?: string;
11
+ isNewUser?: boolean;
12
+ }
@@ -7,27 +7,8 @@ import {
7
7
  GoogleAuthProvider,
8
8
  signInWithCredential,
9
9
  type Auth,
10
- type UserCredential,
11
10
  } from "firebase/auth";
12
-
13
- /**
14
- * Google Auth configuration
15
- */
16
- export interface GoogleAuthConfig {
17
- webClientId?: string;
18
- iosClientId?: string;
19
- androidClientId?: string;
20
- }
21
-
22
- /**
23
- * Google Auth result
24
- */
25
- export interface GoogleAuthResult {
26
- success: boolean;
27
- userCredential?: UserCredential;
28
- error?: string;
29
- isNewUser?: boolean;
30
- }
11
+ import type { GoogleAuthConfig, GoogleAuthResult } from "./google-auth.types";
31
12
 
32
13
  /**
33
14
  * Google Auth Service
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Google Auth Types
3
+ */
4
+
5
+ import type { UserCredential } from "firebase/auth";
6
+
7
+ /**
8
+ * Google Auth configuration
9
+ */
10
+ export interface GoogleAuthConfig {
11
+ webClientId?: string;
12
+ iosClientId?: string;
13
+ androidClientId?: string;
14
+ }
15
+
16
+ /**
17
+ * Google Auth result
18
+ */
19
+ export interface GoogleAuthResult {
20
+ success: boolean;
21
+ userCredential?: UserCredential;
22
+ error?: string;
23
+ isNewUser?: boolean;
24
+ }
@@ -5,10 +5,8 @@
5
5
 
6
6
  import { useState, useCallback, useEffect } from "react";
7
7
  import { getFirebaseAuth } from "../../infrastructure/config/FirebaseAuthClient";
8
- import {
9
- googleAuthService,
10
- type GoogleAuthConfig,
11
- } from "../../infrastructure/services/google-auth.service";
8
+ import { googleAuthService } from "../../infrastructure/services/google-auth.service";
9
+ import type { GoogleAuthConfig } from "../../infrastructure/services/google-auth.types";
12
10
  import { appleAuthService } from "../../infrastructure/services/apple-auth.service";
13
11
 
14
12
  export interface SocialAuthConfig {
@@ -60,7 +60,7 @@ export class QuotaTrackingMiddleware {
60
60
  /**
61
61
  * Track write operation
62
62
  */
63
- trackWrite(collection: string, _documentId?: string, count: number = 1): void {
63
+ trackWrite(collection: string, count: number = 1): void {
64
64
  this.writeCount += count;
65
65
  if (__DEV__) {
66
66
  console.log(`[QuotaTracking] write: ${collection} (${count})`);
@@ -70,7 +70,7 @@ export class QuotaTrackingMiddleware {
70
70
  /**
71
71
  * Track delete operation
72
72
  */
73
- trackDelete(collection: string, _documentId?: string, count: number = 1): void {
73
+ trackDelete(collection: string, count: number = 1): void {
74
74
  this.deleteCount += count;
75
75
  if (__DEV__) {
76
76
  console.log(`[QuotaTracking] delete: ${collection} (${count})`);
@@ -54,7 +54,7 @@ export abstract class BaseQueryRepository extends BaseRepository {
54
54
  * @param count - Number of documents read
55
55
  * @param cached - Whether the result is from cache
56
56
  */
57
- protected override trackRead(
57
+ protected trackRead(
58
58
  collection: string,
59
59
  count: number = 1,
60
60
  cached: boolean = false,
@@ -62,19 +62,17 @@ export abstract class BaseQueryRepository extends BaseRepository {
62
62
  quotaTrackingMiddleware.trackRead(collection, count, cached);
63
63
  }
64
64
 
65
- protected override trackWrite(
65
+ protected trackWrite(
66
66
  collection: string,
67
- documentId?: string,
68
67
  count: number = 1,
69
68
  ): void {
70
- quotaTrackingMiddleware.trackWrite(collection, documentId, count);
69
+ quotaTrackingMiddleware.trackWrite(collection, count);
71
70
  }
72
71
 
73
- protected override trackDelete(
72
+ protected trackDelete(
74
73
  collection: string,
75
- documentId?: string,
76
74
  count: number = 1,
77
75
  ): void {
78
- quotaTrackingMiddleware.trackDelete(collection, documentId, count);
76
+ quotaTrackingMiddleware.trackDelete(collection, count);
79
77
  }
80
78
  }
@@ -120,24 +120,6 @@ export class BaseRepository {
120
120
  }
121
121
  }
122
122
 
123
- /**
124
- * Track read operations (stub for analytics)
125
- * @param collection - Collection name
126
- * @param count - Number of reads
127
- * @param cached - Whether read was from cache
128
- */
129
- protected trackRead(_collection: string, _count: number, _cached: boolean): void {
130
- // Stub for future analytics implementation
131
- }
132
-
133
- protected trackWrite(_collection: string, _docId: string, _count: number): void {
134
- // Stub for future analytics implementation
135
- }
136
-
137
- protected trackDelete(_collection: string, _docId: string, _count: number): void {
138
- // Stub for future analytics implementation
139
- }
140
-
141
123
  /**
142
124
  * Destroy repository and cleanup resources
143
125
  */
@@ -9,17 +9,19 @@ export function isoToTimestamp(isoString: string): Timestamp {
9
9
 
10
10
  /**
11
11
  * Convert Firestore Timestamp to ISO string
12
+ * Returns null if timestamp is null or undefined
12
13
  */
13
- export function timestampToISO(timestamp: Timestamp | null | undefined): string {
14
- if (!timestamp) return new Date().toISOString();
14
+ export function timestampToISO(timestamp: Timestamp | null | undefined): string | null {
15
+ if (!timestamp) return null;
15
16
  return timestamp.toDate().toISOString();
16
17
  }
17
18
 
18
19
  /**
19
20
  * Convert Firestore Timestamp to Date
21
+ * Returns null if timestamp is null or undefined
20
22
  */
21
- export function timestampToDate(timestamp: Timestamp | null | undefined): Date {
22
- if (!timestamp) return new Date();
23
+ export function timestampToDate(timestamp: Timestamp | null | undefined): Date | null {
24
+ if (!timestamp) return null;
23
25
  return timestamp.toDate();
24
26
  }
25
27
 
package/src/index.ts CHANGED
@@ -73,7 +73,7 @@ export { anonymousAuthService } from "./auth/infrastructure/services/anonymous-a
73
73
  export { deleteCurrentUser } from "./auth/infrastructure/services/account-deletion.service";
74
74
  export { appleAuthService } from "./auth/infrastructure/services/apple-auth.service";
75
75
  export { googleAuthService } from "./auth/infrastructure/services/google-auth.service";
76
- export type { GoogleAuthConfig } from "./auth/infrastructure/services/google-auth.service";
76
+ export type { GoogleAuthConfig } from "./auth/infrastructure/services/google-auth.types";
77
77
  export { useAnonymousAuth } from "./auth/presentation/hooks/useAnonymousAuth";
78
78
  export type { UseAnonymousAuthResult } from "./auth/presentation/hooks/useAnonymousAuth";
79
79
 
@@ -89,7 +89,3 @@ export class FirebaseConfigValidator {
89
89
 
90
90
 
91
91
 
92
-
93
-
94
-
95
-
@@ -17,5 +17,3 @@ export interface DeleteResult {
17
17
  success: boolean;
18
18
  storagePath: string;
19
19
  }
20
-
21
- export { Directory as FileSystemDirectory } from "expo-file-system";
@@ -19,6 +19,9 @@ export function getMimeType(base64: string): string {
19
19
  if (base64.startsWith("data:image/png")) return "image/png";
20
20
  if (base64.startsWith("data:image/webp")) return "image/webp";
21
21
  if (base64.startsWith("data:image/gif")) return "image/gif";
22
+ if (__DEV__) {
23
+ console.warn("[StorageUploader] Could not detect MIME type from base64 prefix, falling back to image/jpeg");
24
+ }
22
25
  return "image/jpeg";
23
26
  }
24
27
 
@@ -104,8 +107,12 @@ export async function uploadFile(
104
107
  const response = await fetch(uri);
105
108
  const blob = await response.blob();
106
109
 
110
+ const contentType = options?.mimeType ?? "image/jpeg";
111
+ if (!options?.mimeType && __DEV__) {
112
+ console.warn("[StorageUploader] No MIME type provided for file upload, falling back to image/jpeg");
113
+ }
107
114
  const metadata: UploadMetadata = {
108
- contentType: options?.mimeType ?? "image/jpeg",
115
+ contentType,
109
116
  customMetadata: options?.customMetadata,
110
117
  };
111
118