@react-native-firebase/firestore 21.10.1 → 21.11.0

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/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [21.11.0](https://github.com/invertase/react-native-firebase/compare/v21.10.1...v21.11.0) (2025-02-20)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **firestore, bytes:** return Bytes for modular API usage, fix deprecation ([5a29425](https://github.com/invertase/react-native-firebase/commit/5a2942517b071141306d675a8501f7d23d87af55))
11
+
6
12
  ## [21.10.1](https://github.com/invertase/react-native-firebase/compare/v21.10.0...v21.10.1) (2025-02-18)
7
13
 
8
14
  ### Bug Fixes
@@ -18,7 +18,7 @@
18
18
  import { Base64, isString } from '@react-native-firebase/app/lib/common';
19
19
 
20
20
  export default class FirestoreBlob {
21
- constructor(internal = false, binaryString) {
21
+ constructor(internal = false, binaryString = undefined) {
22
22
  if (internal === false) {
23
23
  throw new Error(
24
24
  'firebase.firestore.Blob constructor is private, use Blob.<field>() instead.',
@@ -1,4 +1,4 @@
1
- export declare class Bytes {
1
+ export declare class Bytes extends FirestoreBlob {
2
2
  static fromBase64String(base64: string): Bytes;
3
3
 
4
4
  static fromUint8Array(array: Uint8Array): Bytes;
@@ -1,15 +1,18 @@
1
- import { firebase } from '../index';
1
+ import FirestoreBlob from '../FirestoreBlob';
2
2
 
3
3
  /**
4
4
  * An immutable object representing an array of bytes.
5
5
  */
6
- export class Bytes {
6
+ export class Bytes extends FirestoreBlob {
7
7
  /**
8
8
  * @hideconstructor
9
9
  * @param {firebase.firestore.Blob} blob
10
10
  */
11
11
  constructor(blob) {
12
- this._blob = blob;
12
+ super(true);
13
+ // binary string was already parsed and created, potentially expensive
14
+ // don't parse it again, just set it into the new FirebaseBlob
15
+ this._binaryString = blob._binaryString;
13
16
  }
14
17
 
15
18
  /**
@@ -17,7 +20,7 @@ export class Bytes {
17
20
  * @returns {Bytes}
18
21
  */
19
22
  static fromBase64String(base64) {
20
- return new Bytes(firebase.firestore.Blob.fromBase64String(base64));
23
+ return new Bytes(FirestoreBlob.fromBase64String(base64));
21
24
  }
22
25
 
23
26
  /**
@@ -25,21 +28,21 @@ export class Bytes {
25
28
  * @returns {Bytes}
26
29
  */
27
30
  static fromUint8Array(array) {
28
- return new Bytes(firebase.firestore.Blob.fromUint8Array(array));
31
+ return new Bytes(FirestoreBlob.fromUint8Array(array));
29
32
  }
30
33
 
31
34
  /**
32
35
  * @returns {string}
33
36
  */
34
37
  toBase64() {
35
- return this._blob.toBase64();
38
+ return super.toBase64();
36
39
  }
37
40
 
38
41
  /**
39
42
  * @returns {Uint8Array}
40
43
  */
41
44
  toUint8Array() {
42
- return this._blob.toUint8Array();
45
+ return super.toUint8Array();
43
46
  }
44
47
 
45
48
  /**
@@ -54,6 +57,6 @@ export class Bytes {
54
57
  * @returns {boolean}
55
58
  */
56
59
  isEqual(other) {
57
- return this._blob.isEqual(other._blob);
60
+ return super.isEqual(other);
58
61
  }
59
62
  }
@@ -31,6 +31,7 @@ import FirestoreGeoPoint from '../FirestoreGeoPoint';
31
31
  import FirestorePath from '../FirestorePath';
32
32
  import FirestoreTimestamp from '../FirestoreTimestamp';
33
33
  import { getTypeMapInt, getTypeMapName } from './typemap';
34
+ import { Bytes } from '../modular/Bytes';
34
35
 
35
36
  // To avoid React Native require cycle warnings
36
37
  let FirestoreDocumentReference = null;
@@ -179,7 +180,8 @@ export function generateNativeData(value, ignoreUndefined) {
179
180
  return getTypeMapInt('timestamp', [value.seconds, value.nanoseconds]);
180
181
  }
181
182
 
182
- if (value instanceof FirestoreBlob) {
183
+ // Modular API uses Bytes instead of Blob
184
+ if (value instanceof FirestoreBlob || value instanceof Bytes) {
183
185
  return getTypeMapInt('blob', value.toBase64());
184
186
  }
185
187
 
@@ -276,7 +278,7 @@ export function parseNativeData(firestore, nativeArray) {
276
278
  case 'timestamp':
277
279
  return new FirestoreTimestamp(value[0], value[1]);
278
280
  case 'blob':
279
- return FirestoreBlob.fromBase64String(value);
281
+ return Bytes.fromBase64String(value);
280
282
  default:
281
283
  // eslint-disable-next-line no-console
282
284
  console.warn(`Unknown data type received from native channel: ${type}`);
package/lib/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- module.exports = '21.10.1';
2
+ module.exports = '21.11.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-firebase/firestore",
3
- "version": "21.10.1",
3
+ "version": "21.11.0",
4
4
  "author": "Invertase <oss@invertase.io> (http://invertase.io)",
5
5
  "description": "React Native Firebase - Cloud Firestore is a NoSQL cloud database to store and sync data between your React Native application and Firebase's database. The API matches the Firebase Web SDK whilst taking advantage of the native SDKs performance and offline capabilities.",
6
6
  "main": "lib/index.js",
@@ -27,10 +27,10 @@
27
27
  "firestore"
28
28
  ],
29
29
  "peerDependencies": {
30
- "@react-native-firebase/app": "21.10.1"
30
+ "@react-native-firebase/app": "21.11.0"
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
35
- "gitHead": "153637d27bb98b1f44a4b27fe1f8ec133bdbfb6d"
35
+ "gitHead": "082a1e496cb1f8496f53869d9ab9e6f88ecbdc00"
36
36
  }