@react-native-firebase/firestore 13.1.1 → 14.2.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 +20 -0
- package/android/src/reactnative/java/io/invertase/firebase/firestore/ReactNativeFirebaseFirestoreSerialize.java +13 -13
- package/ios/RNFBFirestore/RNFBFirestoreSerialize.m +9 -3
- package/lib/utils/serialize.js +11 -5
- package/lib/utils/typemap.js +3 -1
- package/lib/version.js +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,26 @@
|
|
|
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
|
+
# [14.2.0](https://github.com/invertase/react-native-firebase/compare/v14.1.0...v14.2.0) (2021-12-31)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @react-native-firebase/firestore
|
|
9
|
+
|
|
10
|
+
# [14.1.0](https://github.com/invertase/react-native-firebase/compare/v14.0.1...v14.1.0) (2021-12-18)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @react-native-firebase/firestore
|
|
13
|
+
|
|
14
|
+
## [14.0.1](https://github.com/invertase/react-native-firebase/compare/v14.0.0...v14.0.1) (2021-12-15)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @react-native-firebase/firestore
|
|
17
|
+
|
|
18
|
+
# [14.0.0](https://github.com/invertase/react-native-firebase/compare/v13.1.1...v14.0.0) (2021-12-14)
|
|
19
|
+
|
|
20
|
+
- fix(firestore)!: fix Long/Double conversion issues #3004 (#5840) ([910d4e4](https://github.com/invertase/react-native-firebase/commit/910d4e420b62b5bcc67bbb1b77b9485ae2662119)), closes [#3004](https://github.com/invertase/react-native-firebase/issues/3004) [#5840](https://github.com/invertase/react-native-firebase/issues/5840) [#3004](https://github.com/invertase/react-native-firebase/issues/3004)
|
|
21
|
+
|
|
22
|
+
### BREAKING CHANGES
|
|
23
|
+
|
|
24
|
+
- Previous versions of firestore here incorrectly saved integers as doubles on iOS, so they did not show up in `where`/`in` queries. You had to save numbers as strings if you wanted `where`/`in` queries to work cross-platform. Number types will now be handled correctly. However, If you have integers saved (incorrectly!) as double (from previous versions) and you use where / in style queries on numbers, then the same document will no longer be found via .where. Mitigation could be to go through your whole DB and load and re-save the integers correctly, or alter queries. Please test your where / in queries that use number types if this affects you.
|
|
25
|
+
|
|
6
26
|
## [13.1.1](https://github.com/invertase/react-native-firebase/compare/v13.1.0...v13.1.1) (2021-12-14)
|
|
7
27
|
|
|
8
28
|
### Bug Fixes
|
|
@@ -60,7 +60,7 @@ public class ReactNativeFirebaseFirestoreSerialize {
|
|
|
60
60
|
private static final int INT_DOCUMENTID = 4;
|
|
61
61
|
private static final int INT_BOOLEAN_TRUE = 5;
|
|
62
62
|
private static final int INT_BOOLEAN_FALSE = 6;
|
|
63
|
-
private static final int
|
|
63
|
+
private static final int INT_DOUBLE = 7;
|
|
64
64
|
private static final int INT_STRING = 8;
|
|
65
65
|
private static final int INT_STRING_EMPTY = 9;
|
|
66
66
|
private static final int INT_ARRAY = 10;
|
|
@@ -70,6 +70,8 @@ public class ReactNativeFirebaseFirestoreSerialize {
|
|
|
70
70
|
private static final int INT_BLOB = 14;
|
|
71
71
|
private static final int INT_FIELDVALUE = 15;
|
|
72
72
|
private static final int INT_OBJECT = 16;
|
|
73
|
+
private static final int INT_INTEGER = 17;
|
|
74
|
+
private static final int INT_NEGATIVE_ZERO = 18;
|
|
73
75
|
private static final int INT_UNKNOWN = -999;
|
|
74
76
|
|
|
75
77
|
// Keys
|
|
@@ -300,7 +302,7 @@ public class ReactNativeFirebaseFirestoreSerialize {
|
|
|
300
302
|
}
|
|
301
303
|
|
|
302
304
|
if (value instanceof Integer) {
|
|
303
|
-
typeArray.pushInt(
|
|
305
|
+
typeArray.pushInt(INT_DOUBLE);
|
|
304
306
|
typeArray.pushDouble(((Integer) value).doubleValue());
|
|
305
307
|
return typeArray;
|
|
306
308
|
}
|
|
@@ -325,19 +327,19 @@ public class ReactNativeFirebaseFirestoreSerialize {
|
|
|
325
327
|
return typeArray;
|
|
326
328
|
}
|
|
327
329
|
|
|
328
|
-
typeArray.pushInt(
|
|
330
|
+
typeArray.pushInt(INT_DOUBLE);
|
|
329
331
|
typeArray.pushDouble(doubleValue);
|
|
330
332
|
return typeArray;
|
|
331
333
|
}
|
|
332
334
|
|
|
333
335
|
if (value instanceof Float) {
|
|
334
|
-
typeArray.pushInt(
|
|
336
|
+
typeArray.pushInt(INT_DOUBLE);
|
|
335
337
|
typeArray.pushDouble(((Float) value).doubleValue());
|
|
336
338
|
return typeArray;
|
|
337
339
|
}
|
|
338
340
|
|
|
339
341
|
if (value instanceof Long) {
|
|
340
|
-
typeArray.pushInt(
|
|
342
|
+
typeArray.pushInt(INT_DOUBLE);
|
|
341
343
|
typeArray.pushDouble(((Long) value).doubleValue());
|
|
342
344
|
return typeArray;
|
|
343
345
|
}
|
|
@@ -461,14 +463,12 @@ public class ReactNativeFirebaseFirestoreSerialize {
|
|
|
461
463
|
return true;
|
|
462
464
|
case INT_BOOLEAN_FALSE:
|
|
463
465
|
return false;
|
|
464
|
-
case
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
}
|
|
471
|
-
return Long.valueOf(numberStringValue, 10);
|
|
466
|
+
case INT_NEGATIVE_ZERO:
|
|
467
|
+
return -0.0;
|
|
468
|
+
case INT_INTEGER:
|
|
469
|
+
return (long) typeArray.getDouble(1);
|
|
470
|
+
case INT_DOUBLE:
|
|
471
|
+
return typeArray.getDouble(1);
|
|
472
472
|
case INT_STRING:
|
|
473
473
|
return typeArray.getString(1);
|
|
474
474
|
case INT_STRING_EMPTY:
|
|
@@ -46,7 +46,7 @@ enum TYPE_MAP {
|
|
|
46
46
|
INT_DOCUMENTID,
|
|
47
47
|
INT_BOOLEAN_TRUE,
|
|
48
48
|
INT_BOOLEAN_FALSE,
|
|
49
|
-
|
|
49
|
+
INT_DOUBLE,
|
|
50
50
|
INT_STRING,
|
|
51
51
|
INT_STRING_EMPTY,
|
|
52
52
|
INT_ARRAY,
|
|
@@ -56,6 +56,8 @@ enum TYPE_MAP {
|
|
|
56
56
|
INT_BLOB,
|
|
57
57
|
INT_FIELDVALUE,
|
|
58
58
|
INT_OBJECT,
|
|
59
|
+
INT_INTEGER,
|
|
60
|
+
INT_NEGATIVE_ZERO,
|
|
59
61
|
INT_UNKNOWN = -999,
|
|
60
62
|
};
|
|
61
63
|
|
|
@@ -336,7 +338,7 @@ enum TYPE_MAP {
|
|
|
336
338
|
}
|
|
337
339
|
|
|
338
340
|
// Number
|
|
339
|
-
typeArray[0] = @(
|
|
341
|
+
typeArray[0] = @(INT_DOUBLE);
|
|
340
342
|
typeArray[1] = value;
|
|
341
343
|
return typeArray;
|
|
342
344
|
}
|
|
@@ -400,7 +402,11 @@ enum TYPE_MAP {
|
|
|
400
402
|
return @(YES);
|
|
401
403
|
case INT_BOOLEAN_FALSE:
|
|
402
404
|
return @(NO);
|
|
403
|
-
case
|
|
405
|
+
case INT_NEGATIVE_ZERO:
|
|
406
|
+
return @(-0.0);
|
|
407
|
+
case INT_INTEGER:
|
|
408
|
+
return @([typeMap[1] longLongValue]);
|
|
409
|
+
case INT_DOUBLE:
|
|
404
410
|
return @([typeMap[1] doubleValue]);
|
|
405
411
|
case INT_STRING:
|
|
406
412
|
return typeMap[1];
|
package/lib/utils/serialize.js
CHANGED
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
import {
|
|
19
|
-
isAndroid,
|
|
20
19
|
isArray,
|
|
21
20
|
isBoolean,
|
|
22
21
|
isDate,
|
|
@@ -139,10 +138,15 @@ export function generateNativeData(value, ignoreUndefined) {
|
|
|
139
138
|
}
|
|
140
139
|
|
|
141
140
|
if (isNumber(value)) {
|
|
142
|
-
|
|
143
|
-
|
|
141
|
+
// mirror the JS SDK's integer detection algorithm
|
|
142
|
+
// https://github.com/firebase/firebase-js-sdk/blob/086df7c7e0299cedd9f3cff9080f46ca25cab7cd/packages/firestore/src/remote/number_serializer.ts#L56
|
|
143
|
+
if (value === 0 && 1 / value === -Infinity) {
|
|
144
|
+
return getTypeMapInt('negativeZero');
|
|
144
145
|
}
|
|
145
|
-
|
|
146
|
+
if (Number.isSafeInteger(value)) {
|
|
147
|
+
return getTypeMapInt('integer', value);
|
|
148
|
+
}
|
|
149
|
+
return getTypeMapInt('double', value);
|
|
146
150
|
}
|
|
147
151
|
|
|
148
152
|
if (isString(value)) {
|
|
@@ -254,7 +258,9 @@ export function parseNativeData(firestore, nativeArray) {
|
|
|
254
258
|
return true;
|
|
255
259
|
case 'booleanFalse':
|
|
256
260
|
return false;
|
|
257
|
-
case '
|
|
261
|
+
case 'double':
|
|
262
|
+
case 'integer':
|
|
263
|
+
case 'negativeZero':
|
|
258
264
|
case 'string':
|
|
259
265
|
return value;
|
|
260
266
|
case 'stringEmpty':
|
package/lib/utils/typemap.js
CHANGED
|
@@ -25,7 +25,7 @@ const MAP = {
|
|
|
25
25
|
documentid: 4, // to native only
|
|
26
26
|
booleanTrue: 5,
|
|
27
27
|
booleanFalse: 6,
|
|
28
|
-
|
|
28
|
+
double: 7,
|
|
29
29
|
string: 8,
|
|
30
30
|
stringEmpty: 9,
|
|
31
31
|
array: 10,
|
|
@@ -35,6 +35,8 @@ const MAP = {
|
|
|
35
35
|
blob: 14,
|
|
36
36
|
fieldvalue: 15,
|
|
37
37
|
object: 16,
|
|
38
|
+
integer: 17,
|
|
39
|
+
negativeZero: 18,
|
|
38
40
|
unknown: -999,
|
|
39
41
|
};
|
|
40
42
|
|
package/lib/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// generated by genversion
|
|
2
|
-
module.exports = '
|
|
2
|
+
module.exports = '14.2.0';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-firebase/firestore",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.2.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": "
|
|
30
|
+
"@react-native-firebase/app": "14.2.0"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "4557fbd914b3496e166318affa95ec4222515e9e"
|
|
36
36
|
}
|