@react-native-firebase/database 24.1.1 → 25.0.1
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 +36 -0
- package/dist/module/DatabaseDataSnapshot.js +144 -0
- package/dist/module/DatabaseDataSnapshot.js.map +1 -0
- package/dist/module/DatabaseOnDisconnect.js +84 -0
- package/dist/module/DatabaseOnDisconnect.js.map +1 -0
- package/dist/module/DatabaseQuery.js +298 -0
- package/dist/module/DatabaseQuery.js.map +1 -0
- package/{lib → dist/module}/DatabaseQueryModifiers.js +49 -98
- package/dist/module/DatabaseQueryModifiers.js.map +1 -0
- package/dist/module/DatabaseReference.js +169 -0
- package/dist/module/DatabaseReference.js.map +1 -0
- package/dist/module/DatabaseStatics.js +35 -0
- package/dist/module/DatabaseStatics.js.map +1 -0
- package/{lib → dist/module}/DatabaseSyncTree.js +74 -156
- package/dist/module/DatabaseSyncTree.js.map +1 -0
- package/{lib → dist/module}/DatabaseThenableReference.js +12 -12
- package/dist/module/DatabaseThenableReference.js.map +1 -0
- package/{lib → dist/module}/DatabaseTransaction.js +26 -89
- package/dist/module/DatabaseTransaction.js.map +1 -0
- package/dist/module/index.js +27 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/modular/query.js +138 -0
- package/dist/module/modular/query.js.map +1 -0
- package/dist/module/modular/transaction.js +24 -0
- package/dist/module/modular/transaction.js.map +1 -0
- package/dist/module/modular.js +76 -0
- package/dist/module/modular.js.map +1 -0
- package/dist/module/namespaced.js +147 -0
- package/dist/module/namespaced.js.map +1 -0
- package/dist/module/package.json +1 -0
- package/dist/module/types/database.js +21 -0
- package/dist/module/types/database.js.map +1 -0
- package/dist/module/types/internal.js +4 -0
- package/dist/module/types/internal.js.map +1 -0
- package/dist/module/types/namespaced.js +67 -0
- package/dist/module/types/namespaced.js.map +1 -0
- package/dist/module/version.js +5 -0
- package/dist/module/version.js.map +1 -0
- package/dist/module/web/RNFBDatabaseModule.android.js +6 -0
- package/dist/module/web/RNFBDatabaseModule.android.js.map +1 -0
- package/dist/module/web/RNFBDatabaseModule.ios.js +6 -0
- package/dist/module/web/RNFBDatabaseModule.ios.js.map +1 -0
- package/dist/module/web/RNFBDatabaseModule.js +375 -0
- package/dist/module/web/RNFBDatabaseModule.js.map +1 -0
- package/{lib → dist/module}/web/query.js +19 -24
- package/dist/module/web/query.js.map +1 -0
- package/dist/typescript/lib/DatabaseDataSnapshot.d.ts +20 -0
- package/dist/typescript/lib/DatabaseDataSnapshot.d.ts.map +1 -0
- package/dist/typescript/lib/DatabaseOnDisconnect.d.ts +19 -0
- package/dist/typescript/lib/DatabaseOnDisconnect.d.ts.map +1 -0
- package/dist/typescript/lib/DatabaseQuery.d.ts +32 -0
- package/dist/typescript/lib/DatabaseQuery.d.ts.map +1 -0
- package/dist/typescript/lib/DatabaseQueryModifiers.d.ts +55 -0
- package/dist/typescript/lib/DatabaseQueryModifiers.d.ts.map +1 -0
- package/dist/typescript/lib/DatabaseReference.d.ts +21 -0
- package/dist/typescript/lib/DatabaseReference.d.ts.map +1 -0
- package/dist/typescript/lib/DatabaseStatics.d.ts +10 -0
- package/dist/typescript/lib/DatabaseStatics.d.ts.map +1 -0
- package/dist/typescript/lib/DatabaseSyncTree.d.ts +72 -0
- package/dist/typescript/lib/DatabaseSyncTree.d.ts.map +1 -0
- package/dist/typescript/lib/DatabaseThenableReference.d.ts +13 -0
- package/dist/typescript/lib/DatabaseThenableReference.d.ts.map +1 -0
- package/dist/typescript/lib/DatabaseTransaction.d.ts +15 -0
- package/dist/typescript/lib/DatabaseTransaction.d.ts.map +1 -0
- package/dist/typescript/lib/index.d.ts +6 -0
- package/dist/typescript/lib/index.d.ts.map +1 -0
- package/dist/typescript/lib/modular/query.d.ts +41 -0
- package/dist/typescript/lib/modular/query.d.ts.map +1 -0
- package/dist/typescript/lib/modular/transaction.d.ts +3 -0
- package/dist/typescript/lib/modular/transaction.d.ts.map +1 -0
- package/dist/typescript/lib/modular.d.ts +24 -0
- package/dist/typescript/lib/modular.d.ts.map +1 -0
- package/dist/typescript/lib/namespaced.d.ts +13 -0
- package/dist/typescript/lib/namespaced.d.ts.map +1 -0
- package/dist/typescript/lib/types/database.d.ts +93 -0
- package/dist/typescript/lib/types/database.d.ts.map +1 -0
- package/dist/typescript/lib/types/internal.d.ts +189 -0
- package/dist/typescript/lib/types/internal.d.ts.map +1 -0
- package/dist/typescript/lib/types/namespaced.d.ts +1230 -0
- package/dist/typescript/lib/types/namespaced.d.ts.map +1 -0
- package/dist/typescript/lib/version.d.ts +2 -0
- package/dist/typescript/lib/version.d.ts.map +1 -0
- package/dist/typescript/lib/web/RNFBDatabaseModule.android.d.ts +3 -0
- package/dist/typescript/lib/web/RNFBDatabaseModule.android.d.ts.map +1 -0
- package/dist/typescript/lib/web/RNFBDatabaseModule.d.ts +3 -0
- package/dist/typescript/lib/web/RNFBDatabaseModule.d.ts.map +1 -0
- package/dist/typescript/lib/web/RNFBDatabaseModule.ios.d.ts +3 -0
- package/dist/typescript/lib/web/RNFBDatabaseModule.ios.d.ts.map +1 -0
- package/dist/typescript/lib/web/query.d.ts +13 -0
- package/dist/typescript/lib/web/query.d.ts.map +1 -0
- package/dist/typescript/package.json +1 -0
- package/lib/{DatabaseDataSnapshot.js → DatabaseDataSnapshot.ts} +62 -88
- package/lib/{DatabaseOnDisconnect.js → DatabaseOnDisconnect.ts} +25 -23
- package/lib/{DatabaseQuery.js → DatabaseQuery.ts} +130 -144
- package/lib/DatabaseQueryModifiers.ts +283 -0
- package/lib/{DatabaseReference.js → DatabaseReference.ts} +103 -85
- package/lib/{DatabaseStatics.js → DatabaseStatics.ts} +4 -2
- package/lib/DatabaseSyncTree.ts +390 -0
- package/lib/DatabaseThenableReference.ts +73 -0
- package/lib/DatabaseTransaction.ts +172 -0
- package/lib/index.ts +25 -0
- package/lib/modular/query.ts +410 -0
- package/lib/modular/transaction.ts +34 -0
- package/lib/modular.ts +134 -0
- package/lib/{index.js → namespaced.ts} +91 -90
- package/lib/types/database.ts +144 -0
- package/lib/types/internal.ts +317 -0
- package/lib/{index.d.ts → types/namespaced.ts} +48 -9
- package/lib/version.ts +2 -0
- package/lib/web/RNFBDatabaseModule.android.ts +4 -0
- package/lib/web/RNFBDatabaseModule.ios.ts +4 -0
- package/lib/web/RNFBDatabaseModule.ts +534 -0
- package/lib/web/query.ts +97 -0
- package/package.json +42 -7
- package/tsconfig.json +21 -0
- package/typedoc.json +3 -3
- package/lib/modular/index.d.ts +0 -246
- package/lib/modular/index.js +0 -134
- package/lib/modular/query.d.ts +0 -972
- package/lib/modular/query.js +0 -305
- package/lib/modular/transaction.d.ts +0 -54
- package/lib/modular/transaction.js +0 -24
- package/lib/version.js +0 -2
- package/lib/web/RNFBDatabaseModule.android.js +0 -2
- package/lib/web/RNFBDatabaseModule.ios.js +0 -2
- package/lib/web/RNFBDatabaseModule.js +0 -558
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
/*
|
|
2
4
|
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
5
|
*
|
|
@@ -16,33 +18,23 @@
|
|
|
16
18
|
*/
|
|
17
19
|
|
|
18
20
|
import { createDeprecationProxy, isString } from '@react-native-firebase/app/dist/module/common';
|
|
19
|
-
import { getReactNativeModule } from '@react-native-firebase/app/dist/module/internal/nativeModule';
|
|
20
21
|
import NativeError from '@react-native-firebase/app/dist/module/internal/NativeFirebaseError';
|
|
21
22
|
import SharedEventEmitter from '@react-native-firebase/app/dist/module/internal/SharedEventEmitter';
|
|
22
|
-
import
|
|
23
|
-
|
|
23
|
+
import { getReactNativeModule } from '@react-native-firebase/app/dist/module/internal/nativeModule';
|
|
24
|
+
import DatabaseDataSnapshot from "./DatabaseDataSnapshot.js";
|
|
24
25
|
class DatabaseSyncTree {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
this._reverseLookup = {};
|
|
28
|
-
|
|
29
|
-
// we need to be able to register multiple listeners for a single event,
|
|
30
|
-
// *then delete a specific single listener for that event*, so we have to
|
|
31
|
-
// be able to identify specific listeners for removal which means we need
|
|
32
|
-
// to mirror the private registration accounting from upstream EventEmitter
|
|
33
|
-
// so we have access here and can do our single emitter removal
|
|
34
|
-
// This is a map of emitter-key <-> set of listener registrations
|
|
35
|
-
// The listener registrations have { context, listener, remove() }
|
|
36
|
-
this._registry = {};
|
|
26
|
+
_tree = {};
|
|
27
|
+
_reverseLookup = {};
|
|
37
28
|
|
|
29
|
+
// We need to track individual emitter subscriptions so one callback can be removed
|
|
30
|
+
// without clearing every listener bound to the same registration key.
|
|
31
|
+
_registry = {};
|
|
32
|
+
constructor() {
|
|
38
33
|
SharedEventEmitter.addListener('database_sync_event', this._handleSyncEvent.bind(this));
|
|
39
34
|
}
|
|
40
|
-
|
|
41
35
|
get native() {
|
|
42
36
|
return getReactNativeModule('RNFBDatabaseQueryModule');
|
|
43
37
|
}
|
|
44
|
-
|
|
45
|
-
// from upstream EventEmitter: initialize registrations for an emitter key
|
|
46
38
|
_allocate(registry, eventType) {
|
|
47
39
|
let registrations = registry[eventType];
|
|
48
40
|
if (registrations == null) {
|
|
@@ -53,12 +45,12 @@ class DatabaseSyncTree {
|
|
|
53
45
|
}
|
|
54
46
|
|
|
55
47
|
/**
|
|
56
|
-
* Handles an incoming event from native
|
|
57
|
-
* @param event
|
|
58
|
-
* @private
|
|
48
|
+
* Handles an incoming event from native.
|
|
59
49
|
*/
|
|
60
50
|
_handleSyncEvent(event) {
|
|
61
|
-
const {
|
|
51
|
+
const {
|
|
52
|
+
body
|
|
53
|
+
} = event;
|
|
62
54
|
if (body.error) {
|
|
63
55
|
this._handleErrorEvent(body);
|
|
64
56
|
} else {
|
|
@@ -67,149 +59,104 @@ class DatabaseSyncTree {
|
|
|
67
59
|
}
|
|
68
60
|
|
|
69
61
|
/**
|
|
70
|
-
* Routes native database query listener cancellation events to their
|
|
71
|
-
*
|
|
72
|
-
* @param event
|
|
73
|
-
* @private
|
|
62
|
+
* Routes native database query listener cancellation events to their JS counterparts.
|
|
74
63
|
*/
|
|
75
64
|
_handleErrorEvent(event) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
65
|
+
const {
|
|
66
|
+
eventRegistrationKey,
|
|
67
|
+
registrationCancellationKey
|
|
68
|
+
} = event.registration;
|
|
69
|
+
if (!registrationCancellationKey) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
79
72
|
const registration = this.getRegistration(registrationCancellationKey);
|
|
80
|
-
|
|
81
73
|
if (registration) {
|
|
82
|
-
// build a new js error - we additionally attach
|
|
83
|
-
// the ref as a property for easier debugging
|
|
84
74
|
const error = NativeError.fromEvent(event.error, 'database');
|
|
85
|
-
|
|
86
|
-
// forward on to users .on(successCallback, cancellationCallback <-- listener
|
|
87
75
|
SharedEventEmitter.emit(registrationCancellationKey, error);
|
|
88
76
|
|
|
89
|
-
//
|
|
90
|
-
//
|
|
77
|
+
// If native cancelled the listener, value events for the paired registration
|
|
78
|
+
// are finished as well, so clean up the JS-side bookkeeping.
|
|
91
79
|
this.removeRegistration(eventRegistrationKey);
|
|
92
80
|
}
|
|
93
81
|
}
|
|
94
82
|
|
|
95
83
|
/**
|
|
96
|
-
* Routes native database
|
|
97
|
-
* If
|
|
98
|
-
* call the native unsub method to prevent further events coming through.
|
|
99
|
-
*
|
|
100
|
-
* @param event
|
|
101
|
-
* @private
|
|
84
|
+
* Routes native database `on` events to their JS equivalents.
|
|
85
|
+
* If there are no listeners left for the event, native is told to unsubscribe.
|
|
102
86
|
*/
|
|
103
87
|
_handleValueEvent(event) {
|
|
104
|
-
|
|
105
|
-
|
|
88
|
+
const {
|
|
89
|
+
key,
|
|
90
|
+
eventRegistrationKey
|
|
91
|
+
} = event.registration;
|
|
106
92
|
const registration = this.getRegistration(eventRegistrationKey);
|
|
107
|
-
// console.log('SyncTree.registration >>>', registration);
|
|
108
|
-
|
|
109
93
|
if (!registration) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
// no longer exists so it can remove
|
|
113
|
-
// the native listeners
|
|
114
|
-
return this.native.off(key, eventRegistrationKey);
|
|
94
|
+
this.native.off(key, eventRegistrationKey);
|
|
95
|
+
return;
|
|
115
96
|
}
|
|
116
|
-
|
|
117
97
|
let snapshot;
|
|
118
98
|
let previousChildName;
|
|
119
|
-
|
|
120
|
-
|
|
99
|
+
if (!event.data) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
121
102
|
if (event.eventType === 'value') {
|
|
122
103
|
snapshot = createDeprecationProxy(new DatabaseDataSnapshot(registration.ref, event.data));
|
|
123
104
|
} else {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
previousChildName = event.data.previousChildName;
|
|
105
|
+
const childData = event.data;
|
|
106
|
+
snapshot = createDeprecationProxy(new DatabaseDataSnapshot(registration.ref, childData.snapshot));
|
|
107
|
+
previousChildName = childData.previousChildName;
|
|
128
108
|
}
|
|
129
|
-
|
|
130
|
-
// forward on to users .on(successCallback <-- listener
|
|
131
|
-
return SharedEventEmitter.emit(eventRegistrationKey, snapshot, previousChildName);
|
|
109
|
+
SharedEventEmitter.emit(eventRegistrationKey, snapshot, previousChildName);
|
|
132
110
|
}
|
|
133
111
|
|
|
134
112
|
/**
|
|
135
113
|
* Returns registration information such as appName, ref, path and registration keys.
|
|
136
|
-
*
|
|
137
|
-
* @param registration
|
|
138
|
-
* @return {null}
|
|
139
114
|
*/
|
|
140
115
|
getRegistration(registration) {
|
|
141
|
-
return this._reverseLookup[registration]
|
|
142
|
-
? Object.assign({}, this._reverseLookup[registration])
|
|
143
|
-
: null;
|
|
116
|
+
return this._reverseLookup[registration] ? Object.assign({}, this._reverseLookup[registration]) : null;
|
|
144
117
|
}
|
|
145
118
|
|
|
146
119
|
/**
|
|
147
120
|
* Removes all listeners for the specified registration keys.
|
|
148
|
-
*
|
|
149
|
-
* @param registrations
|
|
150
|
-
* @return {number}
|
|
151
121
|
*/
|
|
152
122
|
removeListenersForRegistrations(registrations) {
|
|
153
123
|
if (isString(registrations)) {
|
|
154
124
|
this.removeRegistration(registrations);
|
|
155
125
|
SharedEventEmitter.removeAllListeners(registrations);
|
|
156
|
-
|
|
157
|
-
// mirror upstream accounting - clear out all registrations for this key
|
|
158
|
-
if (registrations == null) {
|
|
159
|
-
this._registry = {};
|
|
160
|
-
} else {
|
|
161
|
-
delete this._registry[registrations];
|
|
162
|
-
}
|
|
126
|
+
delete this._registry[registrations];
|
|
163
127
|
return 1;
|
|
164
128
|
}
|
|
165
|
-
|
|
166
129
|
if (!Array.isArray(registrations)) {
|
|
167
130
|
return 0;
|
|
168
131
|
}
|
|
169
132
|
for (let i = 0, len = registrations.length; i < len; i++) {
|
|
170
133
|
this.removeRegistration(registrations[i]);
|
|
171
134
|
SharedEventEmitter.removeAllListeners(registrations[i]);
|
|
172
|
-
|
|
173
|
-
if (registrations[i] == null) {
|
|
174
|
-
this._registry = {};
|
|
175
|
-
} else {
|
|
176
|
-
delete this._registry[registrations[i]];
|
|
177
|
-
}
|
|
135
|
+
delete this._registry[registrations[i]];
|
|
178
136
|
}
|
|
179
|
-
|
|
180
137
|
return registrations.length;
|
|
181
138
|
}
|
|
182
139
|
|
|
183
140
|
/**
|
|
184
141
|
* Removes a specific listener from the specified registrations.
|
|
185
|
-
*
|
|
186
|
-
* @param listener
|
|
187
|
-
* @param registrations
|
|
188
|
-
* @return {Array} array of registrations removed
|
|
189
142
|
*/
|
|
190
143
|
removeListenerRegistrations(listener, registrations) {
|
|
191
144
|
if (!Array.isArray(registrations)) {
|
|
192
145
|
return [];
|
|
193
146
|
}
|
|
194
147
|
const removed = [];
|
|
195
|
-
|
|
196
148
|
for (let i = 0, len = registrations.length; i < len; i++) {
|
|
197
149
|
const registration = registrations[i];
|
|
198
150
|
let subscriptions;
|
|
199
|
-
|
|
200
|
-
// get all registrations for this key so we can find our specific listener
|
|
201
151
|
const registrySubscriptionsSet = this._registry[registration];
|
|
202
152
|
if (registrySubscriptionsSet) {
|
|
203
153
|
subscriptions = Array.from(registrySubscriptionsSet);
|
|
204
154
|
}
|
|
205
|
-
|
|
206
155
|
if (subscriptions) {
|
|
207
156
|
for (let j = 0, l = subscriptions.length; j < l; j++) {
|
|
208
157
|
const subscription = subscriptions[j];
|
|
209
|
-
// The subscription may have been removed during this event loop.
|
|
210
|
-
// its listener matches the listener in method parameters
|
|
211
158
|
if (subscription && subscription.listener === listener) {
|
|
212
|
-
this._registry[registration]
|
|
159
|
+
this._registry[registration]?.delete(subscription);
|
|
213
160
|
subscription.remove();
|
|
214
161
|
removed.push(registration);
|
|
215
162
|
this.removeRegistration(registration);
|
|
@@ -217,52 +164,39 @@ class DatabaseSyncTree {
|
|
|
217
164
|
}
|
|
218
165
|
}
|
|
219
166
|
}
|
|
220
|
-
|
|
221
167
|
return removed;
|
|
222
168
|
}
|
|
223
169
|
|
|
224
170
|
/**
|
|
225
|
-
* Returns
|
|
226
|
-
*
|
|
227
|
-
* @param path
|
|
228
|
-
* @return {Array}
|
|
171
|
+
* Returns all registration keys for the specified path.
|
|
229
172
|
*/
|
|
230
173
|
getRegistrationsByPath(path) {
|
|
231
174
|
const out = [];
|
|
232
175
|
const eventKeys = Object.keys(this._tree[path] || {});
|
|
233
|
-
|
|
234
176
|
for (let i = 0, len = eventKeys.length; i < len; i++) {
|
|
235
|
-
Array.prototype.push.apply(out, Object.keys(this._tree[path][eventKeys[i]]));
|
|
177
|
+
Array.prototype.push.apply(out, Object.keys(this._tree[path]?.[eventKeys[i]] || {}));
|
|
236
178
|
}
|
|
237
|
-
|
|
238
179
|
return out;
|
|
239
180
|
}
|
|
240
181
|
|
|
241
182
|
/**
|
|
242
|
-
* Returns
|
|
243
|
-
*
|
|
244
|
-
* @param path
|
|
245
|
-
* @param eventType
|
|
246
|
-
* @return {Array}
|
|
183
|
+
* Returns all registration keys for the specified path and event type.
|
|
247
184
|
*/
|
|
248
185
|
getRegistrationsByPathEvent(path, eventType) {
|
|
186
|
+
if (!eventType) {
|
|
187
|
+
return [];
|
|
188
|
+
}
|
|
249
189
|
if (!this._tree[path]) {
|
|
250
190
|
return [];
|
|
251
191
|
}
|
|
252
192
|
if (!this._tree[path][eventType]) {
|
|
253
193
|
return [];
|
|
254
194
|
}
|
|
255
|
-
|
|
256
195
|
return Object.keys(this._tree[path][eventType]);
|
|
257
196
|
}
|
|
258
197
|
|
|
259
198
|
/**
|
|
260
|
-
* Returns a single registration key for the specified path,
|
|
261
|
-
*
|
|
262
|
-
* @param path
|
|
263
|
-
* @param eventType
|
|
264
|
-
* @param listener
|
|
265
|
-
* @return {Array}
|
|
199
|
+
* Returns a single registration key for the specified path, event type, and listener.
|
|
266
200
|
*/
|
|
267
201
|
getOneByPathEventListener(path, eventType, listener) {
|
|
268
202
|
if (!this._tree[path]) {
|
|
@@ -271,97 +205,81 @@ class DatabaseSyncTree {
|
|
|
271
205
|
if (!this._tree[path][eventType]) {
|
|
272
206
|
return null;
|
|
273
207
|
}
|
|
274
|
-
|
|
275
208
|
const registrationsForPathEvent = Object.entries(this._tree[path][eventType]);
|
|
276
|
-
|
|
277
209
|
for (let i = 0; i < registrationsForPathEvent.length; i++) {
|
|
278
210
|
const registration = registrationsForPathEvent[i];
|
|
279
|
-
if (registration[1] === listener) {
|
|
211
|
+
if (registration?.[1] === listener) {
|
|
280
212
|
return registration[0];
|
|
281
213
|
}
|
|
282
214
|
}
|
|
283
|
-
|
|
284
215
|
return null;
|
|
285
216
|
}
|
|
286
217
|
|
|
287
218
|
/**
|
|
288
219
|
* Register a new listener.
|
|
289
|
-
*
|
|
290
|
-
* @param registration
|
|
291
220
|
*/
|
|
292
221
|
addRegistration(registration) {
|
|
293
|
-
const {
|
|
294
|
-
|
|
222
|
+
const {
|
|
223
|
+
eventRegistrationKey,
|
|
224
|
+
eventType,
|
|
225
|
+
listener,
|
|
226
|
+
once,
|
|
227
|
+
path
|
|
228
|
+
} = registration;
|
|
295
229
|
if (!this._tree[path]) {
|
|
296
230
|
this._tree[path] = {};
|
|
297
231
|
}
|
|
298
232
|
if (!this._tree[path][eventType]) {
|
|
299
233
|
this._tree[path][eventType] = {};
|
|
300
234
|
}
|
|
301
|
-
|
|
302
235
|
this._tree[path][eventType][eventRegistrationKey] = listener;
|
|
303
236
|
this._reverseLookup[eventRegistrationKey] = registration;
|
|
304
|
-
|
|
305
237
|
if (once) {
|
|
306
238
|
const subscription = SharedEventEmitter.addListener(eventRegistrationKey, event => {
|
|
307
239
|
this._onOnceRemoveRegistration(eventRegistrationKey, listener)(event);
|
|
308
240
|
subscription.remove();
|
|
309
241
|
});
|
|
310
|
-
|
|
311
|
-
const registration = SharedEventEmitter.addListener(eventRegistrationKey, listener);
|
|
312
|
-
|
|
313
|
-
// add this listener registration info to our emitter-key map
|
|
314
|
-
// in case we need to identify and remove a specific listener later
|
|
315
|
-
const registrations = this._allocate(this._registry, eventRegistrationKey);
|
|
316
|
-
registrations.add(registration);
|
|
242
|
+
return eventRegistrationKey;
|
|
317
243
|
}
|
|
318
|
-
|
|
244
|
+
const emitterSubscription = SharedEventEmitter.addListener(eventRegistrationKey, listener);
|
|
245
|
+
const registrations = this._allocate(this._registry, eventRegistrationKey);
|
|
246
|
+
registrations.add(emitterSubscription);
|
|
319
247
|
return eventRegistrationKey;
|
|
320
248
|
}
|
|
321
249
|
|
|
322
250
|
/**
|
|
323
|
-
* Remove a registration
|
|
324
|
-
* to also remove the underlying database query listener.
|
|
325
|
-
*
|
|
326
|
-
* @param registration
|
|
327
|
-
* @return {boolean}
|
|
251
|
+
* Remove a registration and unsubscribe the paired native listener when needed.
|
|
328
252
|
*/
|
|
329
253
|
removeRegistration(registration) {
|
|
330
254
|
if (!this._reverseLookup[registration]) {
|
|
331
255
|
return false;
|
|
332
256
|
}
|
|
333
|
-
const
|
|
334
|
-
|
|
257
|
+
const registrationObj = this._reverseLookup[registration];
|
|
258
|
+
const {
|
|
259
|
+
path,
|
|
260
|
+
eventType,
|
|
261
|
+
once
|
|
262
|
+
} = registrationObj;
|
|
335
263
|
if (!this._tree[path]) {
|
|
336
264
|
delete this._reverseLookup[registration];
|
|
337
265
|
return false;
|
|
338
266
|
}
|
|
339
|
-
|
|
340
267
|
if (!this._tree[path][eventType]) {
|
|
341
268
|
delete this._reverseLookup[registration];
|
|
342
269
|
return false;
|
|
343
270
|
}
|
|
344
271
|
|
|
345
|
-
//
|
|
346
|
-
|
|
347
|
-
const registrationObj = this._reverseLookup[registration];
|
|
348
|
-
if (registrationObj && !once) {
|
|
272
|
+
// `once` registrations are already unsubscribed by native after the first event.
|
|
273
|
+
if (!once) {
|
|
349
274
|
this.native.off(registrationObj.key, registration);
|
|
350
275
|
}
|
|
351
|
-
|
|
352
276
|
delete this._tree[path][eventType][registration];
|
|
353
277
|
delete this._reverseLookup[registration];
|
|
354
|
-
|
|
355
|
-
return !!registrationObj;
|
|
278
|
+
return true;
|
|
356
279
|
}
|
|
357
280
|
|
|
358
281
|
/**
|
|
359
|
-
* Wraps a `once` listener with a
|
|
360
|
-
*
|
|
361
|
-
* @param registration
|
|
362
|
-
* @param listener
|
|
363
|
-
* @return {function(...[*])}
|
|
364
|
-
* @private
|
|
282
|
+
* Wraps a `once` listener with a function that self-deregisters.
|
|
365
283
|
*/
|
|
366
284
|
_onOnceRemoveRegistration(registration, listener) {
|
|
367
285
|
return (...args) => {
|
|
@@ -370,5 +288,5 @@ class DatabaseSyncTree {
|
|
|
370
288
|
};
|
|
371
289
|
}
|
|
372
290
|
}
|
|
373
|
-
|
|
374
291
|
export default new DatabaseSyncTree();
|
|
292
|
+
//# sourceMappingURL=DatabaseSyncTree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createDeprecationProxy","isString","NativeError","SharedEventEmitter","getReactNativeModule","DatabaseDataSnapshot","DatabaseSyncTree","_tree","_reverseLookup","_registry","constructor","addListener","_handleSyncEvent","bind","native","_allocate","registry","eventType","registrations","Set","event","body","error","_handleErrorEvent","_handleValueEvent","eventRegistrationKey","registrationCancellationKey","registration","getRegistration","fromEvent","emit","removeRegistration","key","off","snapshot","previousChildName","data","ref","childData","Object","assign","removeListenersForRegistrations","removeAllListeners","Array","isArray","i","len","length","removeListenerRegistrations","listener","removed","subscriptions","registrySubscriptionsSet","from","j","l","subscription","delete","remove","push","getRegistrationsByPath","path","out","eventKeys","keys","prototype","apply","getRegistrationsByPathEvent","getOneByPathEventListener","registrationsForPathEvent","entries","addRegistration","once","_onOnceRemoveRegistration","emitterSubscription","add","registrationObj","args"],"sourceRoot":"../../lib","sources":["DatabaseSyncTree.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,sBAAsB,EAAEC,QAAQ,QAAQ,+CAA+C;AAChG,OAAOC,WAAW,MAAM,qEAAqE;AAC7F,OAAOC,kBAAkB,MAAM,oEAAoE;AACnG,SAASC,oBAAoB,QAAQ,8DAA8D;AACnG,OAAOC,oBAAoB,MAAM,2BAAwB;AA4CzD,MAAMC,gBAAgB,CAAC;EACbC,KAAK,GAA4B,CAAC,CAAC;EACnCC,cAAc,GAAiD,CAAC,CAAC;;EAEzE;EACA;EACQC,SAAS,GAA6B,CAAC,CAAC;EAEhDC,WAAWA,CAAA,EAAG;IACZP,kBAAkB,CAACQ,WAAW,CAC5B,qBAAqB,EACrB,IAAI,CAACC,gBAAgB,CAACC,IAAI,CAAC,IAAI,CACjC,CAAC;EACH;EAEA,IAAYC,MAAMA,CAAA,EAAuB;IACvC,OAAOV,oBAAoB,CAAC,yBAAyB,CAAC;EACxD;EAEQW,SAASA,CACfC,QAAkC,EAClCC,SAAiB,EACqB;IACtC,IAAIC,aAAa,GAAGF,QAAQ,CAACC,SAAS,CAAC;IACvC,IAAIC,aAAa,IAAI,IAAI,EAAE;MACzBA,aAAa,GAAG,IAAIC,GAAG,CAAkC,CAAC;MAC1DH,QAAQ,CAACC,SAAS,CAAC,GAAGC,aAAa;IACrC;IACA,OAAOA,aAAa;EACtB;;EAEA;AACF;AACA;EACU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yBAAyBA,CAC/B9C,YAAoB,EACpBsB,QAAkC,EACR;IAC1B,OAAO,CAAC,GAAG4B,IAAW,KAAK;MACzB,IAAI,CAAC9C,kBAAkB,CAACJ,YAAY,CAAC;MACrCsB,QAAQ,CAAC,GAAG4B,IAAI,CAAC;IACnB,CAAC;EACH;AACF;AAEA,eAAe,IAAIvE,gBAAgB,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
/*
|
|
2
4
|
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
5
|
*
|
|
@@ -16,33 +18,31 @@
|
|
|
16
18
|
*/
|
|
17
19
|
|
|
18
20
|
import { createDeprecationProxy } from '@react-native-firebase/app/dist/module/common';
|
|
19
|
-
|
|
20
|
-
let DatabaseReference = null;
|
|
21
|
+
let DatabaseReferenceClass = null;
|
|
21
22
|
export function provideReferenceClass(databaseReference) {
|
|
22
|
-
|
|
23
|
+
DatabaseReferenceClass = databaseReference;
|
|
23
24
|
}
|
|
24
|
-
|
|
25
25
|
export default class DatabaseThenableReference {
|
|
26
26
|
constructor(database, path, promise) {
|
|
27
|
-
|
|
27
|
+
if (!DatabaseReferenceClass) {
|
|
28
|
+
throw new Error('DatabaseReference class has not been provided.');
|
|
29
|
+
}
|
|
30
|
+
this._ref = createDeprecationProxy(new DatabaseReferenceClass(database, path));
|
|
28
31
|
this._promise = promise;
|
|
29
|
-
|
|
30
32
|
return new Proxy(this, {
|
|
31
33
|
get(target, prop) {
|
|
32
34
|
if (prop === 'then' || prop === 'catch') {
|
|
33
|
-
return target
|
|
35
|
+
return Reflect.get(target, prop, target);
|
|
34
36
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
},
|
|
37
|
+
return Reflect.get(target._ref, prop);
|
|
38
|
+
}
|
|
38
39
|
});
|
|
39
40
|
}
|
|
40
|
-
|
|
41
41
|
get then() {
|
|
42
42
|
return this._promise.then.bind(this._promise);
|
|
43
43
|
}
|
|
44
|
-
|
|
45
44
|
get catch() {
|
|
46
45
|
return this._promise.catch.bind(this._promise);
|
|
47
46
|
}
|
|
48
47
|
}
|
|
48
|
+
//# sourceMappingURL=DatabaseThenableReference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createDeprecationProxy","DatabaseReferenceClass","provideReferenceClass","databaseReference","DatabaseThenableReference","constructor","database","path","promise","Error","_ref","_promise","Proxy","get","target","prop","Reflect","then","bind","catch"],"sourceRoot":"../../lib","sources":["DatabaseThenableReference.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,sBAAsB,QAAQ,+CAA+C;AAUtF,IAAIC,sBAA2D,GAAG,IAAI;AAEtE,OAAO,SAASC,qBAAqBA,CAACC,iBAA+C,EAAQ;EAC3FF,sBAAsB,GAAGE,iBAAiB;AAC5C;AAEA,eAAe,MAAMC,yBAAyB,CAG5C;EAIAC,WAAWA,CACTC,QAA0B,EAC1BC,IAAY,EACZC,OAAiD,EACjD;IACA,IAAI,CAACP,sBAAsB,EAAE;MAC3B,MAAM,IAAIQ,KAAK,CAAC,gDAAgD,CAAC;IACnE;IAEA,IAAI,CAACC,IAAI,GAAGV,sBAAsB,CAChC,IAAIC,sBAAsB,CAACK,QAAQ,EAAEC,IAAI,CAC3C,CAAoC;IACpC,IAAI,CAACI,QAAQ,GAAGH,OAAO;IAEvB,OAAO,IAAII,KAAK,CAAC,IAAI,EAAE;MACrBC,GAAGA,CAACC,MAAM,EAAEC,IAAI,EAAE;QAChB,IAAIA,IAAI,KAAK,MAAM,IAAIA,IAAI,KAAK,OAAO,EAAE;UACvC,OAAOC,OAAO,CAACH,GAAG,CAACC,MAAM,EAAEC,IAAI,EAAED,MAAM,CAAC;QAC1C;QAEA,OAAOE,OAAO,CAACH,GAAG,CAACC,MAAM,CAACJ,IAAI,EAAYK,IAAI,CAA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