@react-native-firebase/database 21.7.4 → 21.8.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 +7 -0
- package/lib/index.js +14 -4
- package/lib/version.js +1 -1
- package/package.json +3 -3
- package/__tests__/database.test.ts +0 -266
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,13 @@
|
|
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.8.0](https://github.com/invertase/react-native-firebase/compare/v21.7.4...v21.8.0) (2025-02-10)
|
7
|
+
|
8
|
+
### Bug Fixes
|
9
|
+
|
10
|
+
- **database:** database emulator config respects android_bypass_emulator_url_remap flag ([7bac573](https://github.com/invertase/react-native-firebase/commit/7bac5732d51e11f2d5c466f3064719e6b4f7a267))
|
11
|
+
- do not ship unit tests in released packages ([e71dadf](https://github.com/invertase/react-native-firebase/commit/e71dadfc1c0cad2e89c94100913af31ddf7d9c91))
|
12
|
+
|
6
13
|
## [21.7.4](https://github.com/invertase/react-native-firebase/compare/v21.7.3...v21.7.4) (2025-02-08)
|
7
14
|
|
8
15
|
### Bug Fixes
|
package/lib/index.js
CHANGED
@@ -188,12 +188,22 @@ class FirebaseDatabaseModule extends FirebaseModule {
|
|
188
188
|
throw new Error('firebase.database().useEmulator() takes a non-empty host and port');
|
189
189
|
}
|
190
190
|
let _host = host;
|
191
|
-
|
192
|
-
|
193
|
-
|
191
|
+
const androidBypassEmulatorUrlRemap =
|
192
|
+
typeof this.firebaseJson.android_bypass_emulator_url_remap === 'boolean' &&
|
193
|
+
this.firebaseJson.android_bypass_emulator_url_remap;
|
194
|
+
if (!androidBypassEmulatorUrlRemap && isAndroid && _host) {
|
195
|
+
if (_host.startsWith('localhost')) {
|
196
|
+
_host = _host.replace('localhost', '10.0.2.2');
|
194
197
|
// eslint-disable-next-line no-console
|
195
198
|
console.log(
|
196
|
-
'Mapping database host to "10.0.2.2" for android emulators. Use real IP on real devices.',
|
199
|
+
'Mapping database host "localhost" to "10.0.2.2" for android emulators. Use real IP on real devices. You can bypass this behaviour with "android_bypass_emulator_url_remap" flag.',
|
200
|
+
);
|
201
|
+
}
|
202
|
+
if (_host.startsWith('127.0.0.1')) {
|
203
|
+
_host = _host.replace('127.0.0.1', '10.0.2.2');
|
204
|
+
// eslint-disable-next-line no-console
|
205
|
+
console.log(
|
206
|
+
'Mapping database host "127.0.0.1" to "10.0.2.2" for android emulators. Use real IP on real devices. You can bypass this behaviour with "android_bypass_emulator_url_remap" flag.',
|
197
207
|
);
|
198
208
|
}
|
199
209
|
}
|
package/lib/version.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
// Generated by genversion.
|
2
|
-
module.exports = '21.
|
2
|
+
module.exports = '21.8.0';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@react-native-firebase/database",
|
3
|
-
"version": "21.
|
3
|
+
"version": "21.8.0",
|
4
4
|
"author": "Invertase <oss@invertase.io> (http://invertase.io)",
|
5
5
|
"description": "React Native Firebase - The Firebase Realtime Database is a cloud-hosted database. Data is stored as JSON and synchronized in realtime to every connected client. React Native Firebase provides native integration with the Android & iOS Firebase SDKs, supporting both realtime data sync and offline capabilities.",
|
6
6
|
"main": "lib/index.js",
|
@@ -25,10 +25,10 @@
|
|
25
25
|
"realtome database"
|
26
26
|
],
|
27
27
|
"peerDependencies": {
|
28
|
-
"@react-native-firebase/app": "21.
|
28
|
+
"@react-native-firebase/app": "21.8.0"
|
29
29
|
},
|
30
30
|
"publishConfig": {
|
31
31
|
"access": "public"
|
32
32
|
},
|
33
|
-
"gitHead": "
|
33
|
+
"gitHead": "14ebd5c2d2e0f284397c331f909e533c47f2ec62"
|
34
34
|
}
|
@@ -1,266 +0,0 @@
|
|
1
|
-
import { describe, expect, it } from '@jest/globals';
|
2
|
-
|
3
|
-
import database, {
|
4
|
-
firebase,
|
5
|
-
runTransaction,
|
6
|
-
getDatabase,
|
7
|
-
connectDatabaseEmulator,
|
8
|
-
goOffline,
|
9
|
-
goOnline,
|
10
|
-
ref,
|
11
|
-
refFromURL,
|
12
|
-
setPersistenceEnabled,
|
13
|
-
setLoggingEnabled,
|
14
|
-
setPersistenceCacheSizeBytes,
|
15
|
-
forceLongPolling,
|
16
|
-
forceWebSockets,
|
17
|
-
getServerTime,
|
18
|
-
serverTimestamp,
|
19
|
-
increment,
|
20
|
-
endAt,
|
21
|
-
endBefore,
|
22
|
-
startAt,
|
23
|
-
startAfter,
|
24
|
-
limitToFirst,
|
25
|
-
limitToLast,
|
26
|
-
orderByChild,
|
27
|
-
orderByKey,
|
28
|
-
orderByPriority,
|
29
|
-
orderByValue,
|
30
|
-
equalTo,
|
31
|
-
query,
|
32
|
-
onValue,
|
33
|
-
onChildAdded,
|
34
|
-
onChildChanged,
|
35
|
-
onChildMoved,
|
36
|
-
onChildRemoved,
|
37
|
-
set,
|
38
|
-
setPriority,
|
39
|
-
setWithPriority,
|
40
|
-
get,
|
41
|
-
child,
|
42
|
-
onDisconnect,
|
43
|
-
keepSynced,
|
44
|
-
push,
|
45
|
-
remove,
|
46
|
-
update,
|
47
|
-
} from '../lib';
|
48
|
-
|
49
|
-
describe('Database', function () {
|
50
|
-
describe('namespace', function () {
|
51
|
-
it('accessible from firebase.app()', function () {
|
52
|
-
const app = firebase.app();
|
53
|
-
expect(app.database).toBeDefined();
|
54
|
-
expect(app.database().useEmulator).toBeDefined();
|
55
|
-
});
|
56
|
-
});
|
57
|
-
|
58
|
-
describe('useEmulator()', function () {
|
59
|
-
it('useEmulator requires a string host', function () {
|
60
|
-
// @ts-ignore because we pass an invalid argument...
|
61
|
-
expect(() => database().useEmulator()).toThrow(
|
62
|
-
'firebase.database().useEmulator() takes a non-empty host',
|
63
|
-
);
|
64
|
-
expect(() => database().useEmulator('', -1)).toThrow(
|
65
|
-
'firebase.database().useEmulator() takes a non-empty host',
|
66
|
-
);
|
67
|
-
// @ts-ignore because we pass an invalid argument...
|
68
|
-
expect(() => database().useEmulator(123)).toThrow(
|
69
|
-
'firebase.database().useEmulator() takes a non-empty host',
|
70
|
-
);
|
71
|
-
});
|
72
|
-
|
73
|
-
it('useEmulator requires a host and port', function () {
|
74
|
-
expect(() => database().useEmulator('', 9000)).toThrow(
|
75
|
-
'firebase.database().useEmulator() takes a non-empty host and port',
|
76
|
-
);
|
77
|
-
// No port
|
78
|
-
// @ts-ignore because we pass an invalid argument...
|
79
|
-
expect(() => database().useEmulator('localhost')).toThrow(
|
80
|
-
'firebase.database().useEmulator() takes a non-empty host and port',
|
81
|
-
);
|
82
|
-
});
|
83
|
-
|
84
|
-
it('useEmulator -> remaps Android loopback to host', function () {
|
85
|
-
const foo = database().useEmulator('localhost', 9000);
|
86
|
-
expect(foo).toEqual(['10.0.2.2', 9000]);
|
87
|
-
|
88
|
-
const bar = database().useEmulator('127.0.0.1', 9000);
|
89
|
-
expect(bar).toEqual(['10.0.2.2', 9000]);
|
90
|
-
});
|
91
|
-
});
|
92
|
-
|
93
|
-
describe('modular', function () {
|
94
|
-
it('`onValue` query method is properly exposed to end user', function () {
|
95
|
-
expect(onValue).toBeDefined();
|
96
|
-
});
|
97
|
-
|
98
|
-
it('`runTransaction` transaction method is properly exposed to end user', function () {
|
99
|
-
expect(runTransaction).toBeDefined();
|
100
|
-
});
|
101
|
-
|
102
|
-
it('`getDatabase` function is properly exposed to end user', function () {
|
103
|
-
expect(getDatabase).toBeDefined();
|
104
|
-
});
|
105
|
-
|
106
|
-
it('`connectDatabaseEmulator` function is properly exposed to end user', function () {
|
107
|
-
expect(connectDatabaseEmulator).toBeDefined();
|
108
|
-
});
|
109
|
-
|
110
|
-
it('`goOffline` function is properly exposed to end user', function () {
|
111
|
-
expect(goOffline).toBeDefined();
|
112
|
-
});
|
113
|
-
|
114
|
-
it('`goOnline` function is properly exposed to end user', function () {
|
115
|
-
expect(goOnline).toBeDefined();
|
116
|
-
});
|
117
|
-
|
118
|
-
it('`ref` function is properly exposed to end user', function () {
|
119
|
-
expect(ref).toBeDefined();
|
120
|
-
});
|
121
|
-
|
122
|
-
it('`refFromURL` function is properly exposed to end user', function () {
|
123
|
-
expect(refFromURL).toBeDefined();
|
124
|
-
});
|
125
|
-
|
126
|
-
it('`setPersistenceEnabled` function is properly exposed to end user', function () {
|
127
|
-
expect(setPersistenceEnabled).toBeDefined();
|
128
|
-
});
|
129
|
-
|
130
|
-
it('`setLoggingEnabled` function is properly exposed to end user', function () {
|
131
|
-
expect(setLoggingEnabled).toBeDefined();
|
132
|
-
});
|
133
|
-
|
134
|
-
it('`setPersistenceCacheSizeBytes` function is properly exposed to end user', function () {
|
135
|
-
expect(setPersistenceCacheSizeBytes).toBeDefined();
|
136
|
-
});
|
137
|
-
|
138
|
-
it('`forceLongPolling` function is properly exposed to end user', function () {
|
139
|
-
expect(forceLongPolling).toBeDefined();
|
140
|
-
});
|
141
|
-
|
142
|
-
it('`forceWebSockets` function is properly exposed to end user', function () {
|
143
|
-
expect(forceWebSockets).toBeDefined();
|
144
|
-
});
|
145
|
-
|
146
|
-
it('`getServerTime` function is properly exposed to end user', function () {
|
147
|
-
expect(getServerTime).toBeDefined();
|
148
|
-
});
|
149
|
-
|
150
|
-
it('`serverTimestamp` function is properly exposed to end user', function () {
|
151
|
-
expect(serverTimestamp).toBeDefined();
|
152
|
-
});
|
153
|
-
|
154
|
-
it('`increment` function is properly exposed to end user', function () {
|
155
|
-
expect(increment).toBeDefined();
|
156
|
-
});
|
157
|
-
|
158
|
-
it('`endAt` function is properly exposed to end user', function () {
|
159
|
-
expect(endAt).toBeDefined();
|
160
|
-
});
|
161
|
-
|
162
|
-
it('`endBefore` function is properly exposed to end user', function () {
|
163
|
-
expect(endBefore).toBeDefined();
|
164
|
-
});
|
165
|
-
|
166
|
-
it('`startAt` function is properly exposed to end user', function () {
|
167
|
-
expect(startAt).toBeDefined();
|
168
|
-
});
|
169
|
-
|
170
|
-
it('`startAfter` function is properly exposed to end user', function () {
|
171
|
-
expect(startAfter).toBeDefined();
|
172
|
-
});
|
173
|
-
|
174
|
-
it('`limitToFirst` function is properly exposed to end user', function () {
|
175
|
-
expect(limitToFirst).toBeDefined();
|
176
|
-
});
|
177
|
-
|
178
|
-
it('`limitToLast` function is properly exposed to end user', function () {
|
179
|
-
expect(limitToLast).toBeDefined();
|
180
|
-
});
|
181
|
-
|
182
|
-
it('`orderByChild` function is properly exposed to end user', function () {
|
183
|
-
expect(orderByChild).toBeDefined();
|
184
|
-
});
|
185
|
-
|
186
|
-
it('`orderByKey` function is properly exposed to end user', function () {
|
187
|
-
expect(orderByKey).toBeDefined();
|
188
|
-
});
|
189
|
-
|
190
|
-
it('`orderByPriority` function is properly exposed to end user', function () {
|
191
|
-
expect(orderByPriority).toBeDefined();
|
192
|
-
});
|
193
|
-
|
194
|
-
it('`orderByValue` function is properly exposed to end user', function () {
|
195
|
-
expect(orderByValue).toBeDefined();
|
196
|
-
});
|
197
|
-
|
198
|
-
it('`equalTo` function is properly exposed to end user', function () {
|
199
|
-
expect(equalTo).toBeDefined();
|
200
|
-
});
|
201
|
-
|
202
|
-
it('`query` function is properly exposed to end user', function () {
|
203
|
-
expect(query).toBeDefined();
|
204
|
-
});
|
205
|
-
|
206
|
-
it('`onValue` function is properly exposed to end user', function () {
|
207
|
-
expect(onValue).toBeDefined();
|
208
|
-
});
|
209
|
-
|
210
|
-
it('`onChildAdded` function is properly exposed to end user', function () {
|
211
|
-
expect(onChildAdded).toBeDefined();
|
212
|
-
});
|
213
|
-
|
214
|
-
it('`onChildChanged` function is properly exposed to end user', function () {
|
215
|
-
expect(onChildChanged).toBeDefined();
|
216
|
-
});
|
217
|
-
|
218
|
-
it('`onChildMoved` function is properly exposed to end user', function () {
|
219
|
-
expect(onChildMoved).toBeDefined();
|
220
|
-
});
|
221
|
-
|
222
|
-
it('`onChildRemoved` function is properly exposed to end user', function () {
|
223
|
-
expect(onChildRemoved).toBeDefined();
|
224
|
-
});
|
225
|
-
|
226
|
-
it('`set` function is properly exposed to end user', function () {
|
227
|
-
expect(set).toBeDefined();
|
228
|
-
});
|
229
|
-
|
230
|
-
it('`setPriority` function is properly exposed to end user', function () {
|
231
|
-
expect(setPriority).toBeDefined();
|
232
|
-
});
|
233
|
-
|
234
|
-
it('`setWithPriority` function is properly exposed to end user', function () {
|
235
|
-
expect(setWithPriority).toBeDefined();
|
236
|
-
});
|
237
|
-
|
238
|
-
it('`get` function is properly exposed to end user', function () {
|
239
|
-
expect(get).toBeDefined();
|
240
|
-
});
|
241
|
-
|
242
|
-
it('`child` function is properly exposed to end user', function () {
|
243
|
-
expect(child).toBeDefined();
|
244
|
-
});
|
245
|
-
|
246
|
-
it('`onDisconnect` function is properly exposed to end user', function () {
|
247
|
-
expect(onDisconnect).toBeDefined();
|
248
|
-
});
|
249
|
-
|
250
|
-
it('`keepSynced` function is properly exposed to end user', function () {
|
251
|
-
expect(keepSynced).toBeDefined();
|
252
|
-
});
|
253
|
-
|
254
|
-
it('`push` function is properly exposed to end user', function () {
|
255
|
-
expect(push).toBeDefined();
|
256
|
-
});
|
257
|
-
|
258
|
-
it('`remove` function is properly exposed to end user', function () {
|
259
|
-
expect(remove).toBeDefined();
|
260
|
-
});
|
261
|
-
|
262
|
-
it('`update` function is properly exposed to end user', function () {
|
263
|
-
expect(update).toBeDefined();
|
264
|
-
});
|
265
|
-
});
|
266
|
-
});
|