@react-native-firebase/database 25.1.0 → 26.1.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 +21 -0
- package/RNFBDatabase.podspec +20 -7
- package/android/build.gradle +19 -0
- package/android/src/main/java/io/invertase/firebase/database/UniversalFirebaseDatabaseModule.java +4 -14
- package/android/src/reactnative/java/io/invertase/firebase/database/DatabaseTurboModuleSupport.java +56 -0
- package/android/src/reactnative/java/io/invertase/firebase/database/{ReactNativeFirebaseDatabaseModule.java → NativeRNFBTurboDatabase.java} +16 -36
- package/android/src/reactnative/java/io/invertase/firebase/database/{ReactNativeFirebaseDatabaseOnDisconnectModule.java → NativeRNFBTurboDatabaseOnDisconnect.java} +19 -14
- package/android/src/reactnative/java/io/invertase/firebase/database/{ReactNativeFirebaseDatabaseQueryModule.java → NativeRNFBTurboDatabaseQuery.java} +41 -105
- package/android/src/reactnative/java/io/invertase/firebase/database/{ReactNativeFirebaseDatabaseReferenceModule.java → NativeRNFBTurboDatabaseReference.java} +27 -20
- package/android/src/reactnative/java/io/invertase/firebase/database/{ReactNativeFirebaseDatabaseTransactionModule.java → NativeRNFBTurboDatabaseTransaction.java} +41 -19
- package/android/src/reactnative/java/io/invertase/firebase/database/ReactNativeFirebaseDatabasePackage.java +5 -5
- package/android/src/reactnative/java/io/invertase/firebase/database/ReactNativeFirebaseDatabaseTransactionHandler.java +11 -0
- package/android/src/reactnative/java/io/invertase/firebase/database/generated/java/com/facebook/fbreact/specs/NativeRNFBTurboDatabaseOnDisconnectSpec.java +55 -0
- package/android/src/reactnative/java/io/invertase/firebase/database/generated/java/com/facebook/fbreact/specs/NativeRNFBTurboDatabaseQuerySpec.java +52 -0
- package/android/src/reactnative/java/io/invertase/firebase/database/generated/java/com/facebook/fbreact/specs/NativeRNFBTurboDatabaseReferenceSpec.java +55 -0
- package/android/src/reactnative/java/io/invertase/firebase/database/generated/java/com/facebook/fbreact/specs/NativeRNFBTurboDatabaseSpec.java +57 -0
- package/android/src/reactnative/java/io/invertase/firebase/database/generated/java/com/facebook/fbreact/specs/NativeRNFBTurboDatabaseTransactionSpec.java +42 -0
- package/android/src/reactnative/java/io/invertase/firebase/database/generated/jni/CMakeLists.txt +36 -0
- package/android/src/reactnative/java/io/invertase/firebase/database/generated/jni/RNFBDatabaseTurboModules-generated.cpp +182 -0
- package/android/src/reactnative/java/io/invertase/firebase/database/generated/jni/RNFBDatabaseTurboModules.h +63 -0
- package/android/src/reactnative/java/io/invertase/firebase/database/generated/jni/react/renderer/components/RNFBDatabaseTurboModules/RNFBDatabaseTurboModulesJSI-generated.cpp +257 -0
- package/android/src/reactnative/java/io/invertase/firebase/database/generated/jni/react/renderer/components/RNFBDatabaseTurboModules/RNFBDatabaseTurboModulesJSI.h +440 -0
- package/dist/module/DatabaseDataSnapshot.js +20 -6
- package/dist/module/DatabaseDataSnapshot.js.map +1 -1
- package/dist/module/DatabaseOnDisconnect.js.map +1 -1
- package/dist/module/DatabaseQuery.js +13 -16
- package/dist/module/DatabaseQuery.js.map +1 -1
- package/dist/module/DatabaseReference.js +16 -15
- package/dist/module/DatabaseReference.js.map +1 -1
- package/dist/module/DatabaseSyncTree.js +5 -4
- package/dist/module/DatabaseSyncTree.js.map +1 -1
- package/dist/module/DatabaseThenableReference.js +1 -2
- package/dist/module/DatabaseThenableReference.js.map +1 -1
- package/dist/module/index.js +210 -5
- package/dist/module/index.js.map +1 -1
- package/dist/module/modular/query.js +14 -15
- package/dist/module/modular/query.js.map +1 -1
- package/dist/module/modular/transaction.js +1 -2
- package/dist/module/modular/transaction.js.map +1 -1
- package/dist/module/version.js +1 -1
- package/dist/module/web/RNFBDatabaseModule.js +4 -8
- package/dist/module/web/RNFBDatabaseModule.js.map +1 -1
- package/dist/typescript/lib/DatabaseDataSnapshot.d.ts +9 -7
- package/dist/typescript/lib/DatabaseDataSnapshot.d.ts.map +1 -1
- package/dist/typescript/lib/DatabaseOnDisconnect.d.ts +3 -3
- package/dist/typescript/lib/DatabaseOnDisconnect.d.ts.map +1 -1
- package/dist/typescript/lib/DatabaseQuery.d.ts +18 -18
- package/dist/typescript/lib/DatabaseQuery.d.ts.map +1 -1
- package/dist/typescript/lib/DatabaseReference.d.ts +8 -8
- package/dist/typescript/lib/DatabaseReference.d.ts.map +1 -1
- package/dist/typescript/lib/DatabaseSyncTree.d.ts +2 -2
- package/dist/typescript/lib/DatabaseSyncTree.d.ts.map +1 -1
- package/dist/typescript/lib/DatabaseThenableReference.d.ts +8 -8
- package/dist/typescript/lib/DatabaseThenableReference.d.ts.map +1 -1
- package/dist/typescript/lib/index.d.ts +57 -4
- package/dist/typescript/lib/index.d.ts.map +1 -1
- package/dist/typescript/lib/modular/query.d.ts.map +1 -1
- package/dist/typescript/lib/modular/transaction.d.ts.map +1 -1
- package/dist/typescript/lib/types/database.d.ts +5 -5
- package/dist/typescript/lib/types/database.d.ts.map +1 -1
- package/dist/typescript/lib/types/internal.d.ts +32 -31
- package/dist/typescript/lib/types/internal.d.ts.map +1 -1
- package/dist/typescript/lib/version.d.ts +1 -1
- package/dist/typescript/lib/web/RNFBDatabaseModule.d.ts.map +1 -1
- package/ios/RNFBDatabase/RNFBDatabaseCommon.h +13 -6
- package/ios/RNFBDatabase/RNFBDatabaseCommon.m +2 -10
- package/ios/RNFBDatabase/RNFBDatabaseConstants.h +25 -0
- package/ios/RNFBDatabase/RNFBDatabaseModule.mm +90 -0
- package/ios/RNFBDatabase/RNFBDatabaseModuleHelper.h +39 -0
- package/ios/RNFBDatabase/RNFBDatabaseModuleHelper.m +64 -0
- package/ios/RNFBDatabase/RNFBDatabaseOnDisconnectHelper.h +59 -0
- package/ios/RNFBDatabase/{RNFBDatabaseOnDisconnectModule.m → RNFBDatabaseOnDisconnectHelper.m} +41 -47
- package/ios/RNFBDatabase/RNFBDatabaseOnDisconnectModule.mm +121 -0
- package/ios/RNFBDatabase/RNFBDatabaseQuery.h +11 -0
- package/ios/RNFBDatabase/RNFBDatabaseQueryHelper.h +49 -0
- package/ios/RNFBDatabase/{RNFBDatabaseQueryModule.m → RNFBDatabaseQueryHelper.m} +77 -91
- package/ios/RNFBDatabase/RNFBDatabaseQueryModule.h +5 -1
- package/ios/RNFBDatabase/RNFBDatabaseQueryModule.mm +105 -0
- package/ios/RNFBDatabase/RNFBDatabaseQueue.h +29 -0
- package/ios/RNFBDatabase/RNFBDatabaseQueue.m +31 -0
- package/ios/RNFBDatabase/RNFBDatabaseReferenceHelper.h +59 -0
- package/ios/RNFBDatabase/{RNFBDatabaseReferenceModule.m → RNFBDatabaseReferenceHelper.m} +42 -48
- package/ios/RNFBDatabase/RNFBDatabaseReferenceModule.mm +125 -0
- package/ios/RNFBDatabase/RNFBDatabaseTransactionHelper.h +38 -0
- package/ios/RNFBDatabase/{RNFBDatabaseTransactionModule.m → RNFBDatabaseTransactionHelper.m} +52 -51
- package/ios/RNFBDatabase/RNFBDatabaseTransactionModule.h +0 -1
- package/ios/RNFBDatabase/RNFBDatabaseTransactionModule.mm +86 -0
- package/ios/RNFBDatabase.xcodeproj/project.pbxproj +24 -24
- package/ios/generated/RCTAppDependencyProvider.h +25 -0
- package/ios/generated/RCTAppDependencyProvider.mm +55 -0
- package/ios/generated/RCTModulesConformingToProtocolsProvider.h +18 -0
- package/ios/generated/RCTModulesConformingToProtocolsProvider.mm +33 -0
- package/ios/generated/RCTThirdPartyComponentsProvider.h +16 -0
- package/ios/generated/RCTThirdPartyComponentsProvider.mm +23 -0
- package/ios/generated/RNFBDatabaseTurboModules/RNFBDatabaseTurboModules-generated.mm +254 -0
- package/ios/generated/RNFBDatabaseTurboModules/RNFBDatabaseTurboModules.h +264 -0
- package/ios/generated/RNFBDatabaseTurboModulesJSI-generated.cpp +257 -0
- package/ios/generated/RNFBDatabaseTurboModulesJSI.h +440 -0
- package/ios/generated/ReactAppDependencyProvider.podspec +34 -0
- package/lib/DatabaseDataSnapshot.ts +43 -38
- package/lib/DatabaseOnDisconnect.ts +3 -3
- package/lib/DatabaseQuery.ts +45 -77
- package/lib/DatabaseReference.ts +37 -66
- package/lib/DatabaseSyncTree.ts +8 -11
- package/lib/DatabaseThenableReference.ts +9 -17
- package/lib/index.ts +325 -6
- package/lib/modular/query.ts +14 -70
- package/lib/modular/transaction.ts +1 -4
- package/lib/types/database.ts +5 -5
- package/lib/types/internal.ts +31 -56
- package/lib/version.ts +1 -1
- package/lib/web/RNFBDatabaseModule.ts +6 -10
- package/package.json +26 -4
- package/react-native.config.js +10 -0
- package/specs/NativeRNFBTurboDatabase.ts +13 -0
- package/specs/NativeRNFBTurboDatabaseOnDisconnect.ts +18 -0
- package/specs/NativeRNFBTurboDatabaseQuery.ts +25 -0
- package/specs/NativeRNFBTurboDatabaseReference.ts +13 -0
- package/specs/NativeRNFBTurboDatabaseTransaction.ts +16 -0
- package/typedoc.json +1 -1
- package/dist/module/modular.js +0 -76
- package/dist/module/modular.js.map +0 -1
- package/dist/module/namespaced.js +0 -147
- package/dist/module/namespaced.js.map +0 -1
- package/dist/module/types/namespaced.js +0 -67
- package/dist/module/types/namespaced.js.map +0 -1
- package/dist/typescript/lib/modular.d.ts +0 -24
- package/dist/typescript/lib/modular.d.ts.map +0 -1
- package/dist/typescript/lib/namespaced.d.ts +0 -13
- package/dist/typescript/lib/namespaced.d.ts.map +0 -1
- package/dist/typescript/lib/types/namespaced.d.ts +0 -1230
- package/dist/typescript/lib/types/namespaced.d.ts.map +0 -1
- package/ios/RNFBDatabase/RNFBDatabaseModule.m +0 -100
- package/lib/modular.ts +0 -134
- package/lib/namespaced.ts +0 -253
- package/lib/types/namespaced.ts +0 -1366
package/lib/types/internal.ts
CHANGED
|
@@ -30,12 +30,8 @@ import type {
|
|
|
30
30
|
ThenableReference,
|
|
31
31
|
TransactionResult,
|
|
32
32
|
} from './database';
|
|
33
|
-
import type { FirebaseDatabaseTypes } from './namespaced';
|
|
34
33
|
import type { DatabaseQueryModifier } from '../DatabaseQueryModifiers';
|
|
35
34
|
|
|
36
|
-
/** Optional final argument passed by modular API wrappers (MODULAR_DEPRECATION_ARG). */
|
|
37
|
-
export type DatabaseModularDeprecationArg = string;
|
|
38
|
-
|
|
39
35
|
/** App instance with database() method (e.g. from getApp() when used for getDatabase()). */
|
|
40
36
|
export interface AppWithDatabaseInternal {
|
|
41
37
|
database(url?: string): Database;
|
|
@@ -47,19 +43,15 @@ export interface DatabaseWithMethodsInternal extends Database {
|
|
|
47
43
|
host: string,
|
|
48
44
|
port: number,
|
|
49
45
|
options?: { mockUserToken?: EmulatorMockTokenOptions | string },
|
|
50
|
-
deprecationArg?: DatabaseModularDeprecationArg,
|
|
51
|
-
): unknown;
|
|
52
|
-
goOffline(deprecationArg?: DatabaseModularDeprecationArg): unknown;
|
|
53
|
-
goOnline(deprecationArg?: DatabaseModularDeprecationArg): unknown;
|
|
54
|
-
ref(path?: string, deprecationArg?: DatabaseModularDeprecationArg): DatabaseReference;
|
|
55
|
-
refFromURL(url: string, deprecationArg?: DatabaseModularDeprecationArg): DatabaseReference;
|
|
56
|
-
setPersistenceEnabled(enabled: boolean, deprecationArg?: DatabaseModularDeprecationArg): unknown;
|
|
57
|
-
setLoggingEnabled(enabled: boolean, deprecationArg?: DatabaseModularDeprecationArg): unknown;
|
|
58
|
-
setPersistenceCacheSizeBytes(
|
|
59
|
-
bytes: number,
|
|
60
|
-
deprecationArg?: DatabaseModularDeprecationArg,
|
|
61
46
|
): unknown;
|
|
62
|
-
|
|
47
|
+
goOffline(): unknown;
|
|
48
|
+
goOnline(): unknown;
|
|
49
|
+
ref(path?: string): DatabaseReference;
|
|
50
|
+
refFromURL(url: string): DatabaseReference;
|
|
51
|
+
setPersistenceEnabled(enabled: boolean): unknown;
|
|
52
|
+
setLoggingEnabled(enabled: boolean): unknown;
|
|
53
|
+
setPersistenceCacheSizeBytes(bytes: number): unknown;
|
|
54
|
+
getServerTime(): Date;
|
|
63
55
|
}
|
|
64
56
|
|
|
65
57
|
/** Native emitter subscription returned by addListener. */
|
|
@@ -140,8 +132,8 @@ export interface DatabaseEventEmitterInternal {
|
|
|
140
132
|
|
|
141
133
|
/** Wrapped native module interface for database. */
|
|
142
134
|
export interface RNFBDatabaseModule {
|
|
143
|
-
goOnline():
|
|
144
|
-
goOffline():
|
|
135
|
+
goOnline(): void;
|
|
136
|
+
goOffline(): void;
|
|
145
137
|
setPersistenceEnabled(enabled: boolean): Promise<void>;
|
|
146
138
|
setLoggingEnabled(enabled: boolean): Promise<void>;
|
|
147
139
|
setPersistenceCacheSizeBytes(bytes: number): Promise<void>;
|
|
@@ -157,7 +149,7 @@ export interface RNFBDatabaseModule {
|
|
|
157
149
|
once(
|
|
158
150
|
path: string,
|
|
159
151
|
modifiers: DatabaseQueryModifier[],
|
|
160
|
-
eventType:
|
|
152
|
+
eventType: EventType,
|
|
161
153
|
): Promise<DatabaseSnapshotInternal | DatabaseChildSnapshotResultInternal>;
|
|
162
154
|
on(props: DatabaseListenPropsInternal): void;
|
|
163
155
|
off(queryKey: string, eventRegistrationKey: string): void | Promise<void>;
|
|
@@ -189,7 +181,11 @@ export interface RNFBDatabaseModule {
|
|
|
189
181
|
|
|
190
182
|
declare module '@react-native-firebase/app/dist/module/internal/NativeModules' {
|
|
191
183
|
interface ReactNativeFirebaseNativeModules {
|
|
192
|
-
|
|
184
|
+
NativeRNFBTurboDatabase: RNFBDatabaseModule;
|
|
185
|
+
NativeRNFBTurboDatabaseReference: RNFBDatabaseModule;
|
|
186
|
+
NativeRNFBTurboDatabaseQuery: RNFBDatabaseModule;
|
|
187
|
+
NativeRNFBTurboDatabaseOnDisconnect: RNFBDatabaseModule;
|
|
188
|
+
NativeRNFBTurboDatabaseTransaction: RNFBDatabaseModule;
|
|
193
189
|
}
|
|
194
190
|
}
|
|
195
191
|
|
|
@@ -197,15 +193,11 @@ declare module '@react-native-firebase/app/dist/module/internal/NativeModules' {
|
|
|
197
193
|
export interface DatabaseReferenceInternal {
|
|
198
194
|
readonly path: string;
|
|
199
195
|
on(
|
|
200
|
-
eventType:
|
|
201
|
-
callback: (data:
|
|
202
|
-
cancelCallbackOrContext?:
|
|
203
|
-
| ((a: Error) => void)
|
|
204
|
-
| Record<string, any>
|
|
205
|
-
| DatabaseModularDeprecationArg
|
|
206
|
-
| null,
|
|
196
|
+
eventType: EventType,
|
|
197
|
+
callback: (data: DataSnapshot, previousChildKey?: string | null) => void,
|
|
198
|
+
cancelCallbackOrContext?: ((a: Error) => void) | Record<string, any> | null,
|
|
207
199
|
context?: Record<string, any> | null,
|
|
208
|
-
): (a:
|
|
200
|
+
): (a: DataSnapshot | null, b?: string | null) => void;
|
|
209
201
|
}
|
|
210
202
|
|
|
211
203
|
/** Query instance viewed through the chainable query modifier methods. */
|
|
@@ -217,25 +209,19 @@ export interface QueryWithSubscriptionMethodsInternal extends Query {
|
|
|
217
209
|
on(
|
|
218
210
|
eventType: EventType,
|
|
219
211
|
callback: (snapshot: DataSnapshot, previousChildName?: string | null) => unknown,
|
|
220
|
-
cancelCallbackOrContext?:
|
|
221
|
-
| ((error: Error) => unknown)
|
|
222
|
-
| ListenOptions
|
|
223
|
-
| DatabaseModularDeprecationArg,
|
|
212
|
+
cancelCallbackOrContext?: ((error: Error) => unknown) | ListenOptions,
|
|
224
213
|
context?: ListenOptions | null,
|
|
225
|
-
deprecationArg?: DatabaseModularDeprecationArg,
|
|
226
214
|
): unknown;
|
|
227
215
|
off(
|
|
228
216
|
eventType?: EventType,
|
|
229
217
|
callback?: (snapshot: DataSnapshot, previousChildName?: string | null) => unknown,
|
|
230
218
|
context?: null,
|
|
231
|
-
deprecationArg?: DatabaseModularDeprecationArg,
|
|
232
219
|
): void;
|
|
233
220
|
once(
|
|
234
221
|
eventType: EventType,
|
|
235
222
|
successCallback?: (snapshot: DataSnapshot, previousChildName?: string | null) => unknown,
|
|
236
223
|
failureCallbackContext?: ((error: Error) => void) | null,
|
|
237
224
|
context?: ListenOptions,
|
|
238
|
-
deprecationArg?: DatabaseModularDeprecationArg,
|
|
239
225
|
): Promise<DataSnapshot>;
|
|
240
226
|
}
|
|
241
227
|
|
|
@@ -246,32 +232,22 @@ export interface QueryConstraintWithApplyInternal extends QueryConstraint {
|
|
|
246
232
|
|
|
247
233
|
/** Database reference viewed through the mutating modular helpers. */
|
|
248
234
|
export interface DatabaseReferenceWithMethodsInternal extends DatabaseReference {
|
|
249
|
-
set(
|
|
250
|
-
value: unknown,
|
|
251
|
-
onComplete?: () => void,
|
|
252
|
-
deprecationArg?: DatabaseModularDeprecationArg,
|
|
253
|
-
): Promise<void>;
|
|
235
|
+
set(value: unknown, onComplete?: (error: Error | null) => void): Promise<void>;
|
|
254
236
|
setPriority(
|
|
255
237
|
priority: string | number | null,
|
|
256
|
-
onComplete?: () => void,
|
|
257
|
-
deprecationArg?: DatabaseModularDeprecationArg,
|
|
238
|
+
onComplete?: (error: Error | null) => void,
|
|
258
239
|
): Promise<void>;
|
|
259
240
|
setWithPriority(
|
|
260
241
|
value: unknown,
|
|
261
242
|
priority: string | number | null,
|
|
262
|
-
onComplete?: () => void,
|
|
263
|
-
deprecationArg?: DatabaseModularDeprecationArg,
|
|
243
|
+
onComplete?: (error: Error | null) => void,
|
|
264
244
|
): Promise<void>;
|
|
265
|
-
child(path: string
|
|
266
|
-
onDisconnect(
|
|
267
|
-
keepSynced(value: boolean
|
|
268
|
-
push(
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
deprecationArg?: DatabaseModularDeprecationArg,
|
|
272
|
-
): ThenableReference;
|
|
273
|
-
remove(deprecationArg?: DatabaseModularDeprecationArg): Promise<void>;
|
|
274
|
-
update(values: object, deprecationArg?: DatabaseModularDeprecationArg): Promise<void>;
|
|
245
|
+
child(path: string): DatabaseReference;
|
|
246
|
+
onDisconnect(): OnDisconnect;
|
|
247
|
+
keepSynced(value: boolean): Promise<void>;
|
|
248
|
+
push(value?: unknown, onComplete?: undefined): ThenableReference;
|
|
249
|
+
remove(): Promise<void>;
|
|
250
|
+
update(values: object): Promise<void>;
|
|
275
251
|
}
|
|
276
252
|
|
|
277
253
|
/** Minimal transaction handler contract used by DatabaseReference and namespaced module. */
|
|
@@ -306,12 +282,11 @@ export interface DatabaseReferenceWithTransactionInternal extends DatabaseRefere
|
|
|
306
282
|
transactionUpdate: (currentData: any) => unknown,
|
|
307
283
|
onComplete?: undefined,
|
|
308
284
|
applyLocally?: boolean,
|
|
309
|
-
deprecationArg?: DatabaseModularDeprecationArg,
|
|
310
285
|
): Promise<TransactionResult>;
|
|
311
286
|
}
|
|
312
287
|
|
|
313
288
|
/** Runtime ServerValue object shape used by modular wrappers. */
|
|
314
289
|
export interface ServerValueStaticInternal {
|
|
315
290
|
TIMESTAMP: object;
|
|
316
|
-
increment(delta: number
|
|
291
|
+
increment(delta: number): object;
|
|
317
292
|
}
|
package/lib/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '
|
|
2
|
+
export const version = '26.1.0';
|
|
@@ -126,18 +126,14 @@ function getCachedOnDisconnectInstance(refValue: WebDatabaseReference): WebOnDis
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
const databaseFallbackModule: Record<string, unknown> = {
|
|
129
|
-
goOnline(appName: string, dbURL: string):
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
goOnline(db);
|
|
133
|
-
});
|
|
129
|
+
goOnline(appName: string, dbURL: string): void {
|
|
130
|
+
const db = getCachedDatabaseInstance(appName, dbURL);
|
|
131
|
+
goOnline(db);
|
|
134
132
|
},
|
|
135
133
|
|
|
136
|
-
goOffline(appName: string, dbURL: string):
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
goOffline(db);
|
|
140
|
-
});
|
|
134
|
+
goOffline(appName: string, dbURL: string): void {
|
|
135
|
+
const db = getCachedDatabaseInstance(appName, dbURL);
|
|
136
|
+
goOffline(db);
|
|
141
137
|
},
|
|
142
138
|
|
|
143
139
|
setPersistenceEnabled(): Promise<void> {
|
package/package.json
CHANGED
|
@@ -1,15 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-firebase/database",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "26.1.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": "./dist/module/index.js",
|
|
7
7
|
"types": "./dist/typescript/lib/index.d.ts",
|
|
8
|
+
"codegenConfig": {
|
|
9
|
+
"name": "RNFBDatabaseTurboModules",
|
|
10
|
+
"type": "modules",
|
|
11
|
+
"jsSrcsDir": "specs",
|
|
12
|
+
"includesGeneratedCode": true,
|
|
13
|
+
"android": {
|
|
14
|
+
"javaPackageName": "io.invertase.firebase.database"
|
|
15
|
+
},
|
|
16
|
+
"ios": {
|
|
17
|
+
"modulesProvider": {
|
|
18
|
+
"NativeRNFBTurboDatabase": "RNFBDatabaseModule",
|
|
19
|
+
"NativeRNFBTurboDatabaseReference": "RNFBDatabaseReferenceModule",
|
|
20
|
+
"NativeRNFBTurboDatabaseQuery": "RNFBDatabaseQueryModule",
|
|
21
|
+
"NativeRNFBTurboDatabaseOnDisconnect": "RNFBDatabaseOnDisconnectModule",
|
|
22
|
+
"NativeRNFBTurboDatabaseTransaction": "RNFBDatabaseTransactionModule"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
8
26
|
"scripts": {
|
|
9
27
|
"build": "genversion --esm --semi lib/version.ts",
|
|
10
28
|
"build:clean": "rimraf android/build && rimraf ios/build",
|
|
11
29
|
"compile": "bob build",
|
|
12
|
-
"prepare": "yarn run build && yarn compile"
|
|
30
|
+
"prepare": "yarn run build && yarn compile",
|
|
31
|
+
"codegen": "yarn android:codegen && yarn ios:codegen",
|
|
32
|
+
"android:codegen": "npx @react-native-community/cli codegen --platform android --outputPath=./android/src/reactnative/java/io/invertase/firebase/database/generated",
|
|
33
|
+
"ios:codegen": "npx @react-native-community/cli codegen --platform ios --outputPath=./ios/generated"
|
|
13
34
|
},
|
|
14
35
|
"repository": {
|
|
15
36
|
"type": "git",
|
|
@@ -26,9 +47,10 @@
|
|
|
26
47
|
"realtome database"
|
|
27
48
|
],
|
|
28
49
|
"peerDependencies": {
|
|
29
|
-
"@react-native-firebase/app": "
|
|
50
|
+
"@react-native-firebase/app": "26.1.0"
|
|
30
51
|
},
|
|
31
52
|
"devDependencies": {
|
|
53
|
+
"@react-native-firebase/app": "26.1.0",
|
|
32
54
|
"react-native-builder-bob": "^0.41.0"
|
|
33
55
|
},
|
|
34
56
|
"publishConfig": {
|
|
@@ -66,5 +88,5 @@
|
|
|
66
88
|
"node_modules/",
|
|
67
89
|
"dist/"
|
|
68
90
|
],
|
|
69
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "59d053eca14ab8aa80e5ac76887014925c67e52b"
|
|
70
92
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export interface Spec extends TurboModule {
|
|
5
|
+
goOnline(app: string, dbURL: string): void;
|
|
6
|
+
goOffline(app: string, dbURL: string): void;
|
|
7
|
+
setPersistenceEnabled(app: string, dbURL: string, enabled: boolean): void;
|
|
8
|
+
setLoggingEnabled(app: string, dbURL: string, enabled: boolean): void;
|
|
9
|
+
setPersistenceCacheSizeBytes(app: string, dbURL: string, cacheSizeBytes: number): void;
|
|
10
|
+
useEmulator(app: string, dbURL: string, host: string, port: number): void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('NativeRNFBTurboDatabase');
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-wrapper-object-types */
|
|
2
|
+
import type { TurboModule } from 'react-native';
|
|
3
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
4
|
+
|
|
5
|
+
export interface Spec extends TurboModule {
|
|
6
|
+
onDisconnectCancel(app: string, dbURL: string, path: string): Promise<void>;
|
|
7
|
+
onDisconnectRemove(app: string, dbURL: string, path: string): Promise<void>;
|
|
8
|
+
onDisconnectSet(app: string, dbURL: string, path: string, props: Object): Promise<void>;
|
|
9
|
+
onDisconnectSetWithPriority(
|
|
10
|
+
app: string,
|
|
11
|
+
dbURL: string,
|
|
12
|
+
path: string,
|
|
13
|
+
props: Object,
|
|
14
|
+
): Promise<void>;
|
|
15
|
+
onDisconnectUpdate(app: string, dbURL: string, path: string, props: Object): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('NativeRNFBTurboDatabaseOnDisconnect');
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-wrapper-object-types */
|
|
2
|
+
import type { TurboModule } from 'react-native';
|
|
3
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
4
|
+
|
|
5
|
+
export interface Spec extends TurboModule {
|
|
6
|
+
once(
|
|
7
|
+
app: string,
|
|
8
|
+
dbURL: string,
|
|
9
|
+
path: string,
|
|
10
|
+
modifiers: ReadonlyArray<Object>,
|
|
11
|
+
eventType: string,
|
|
12
|
+
): Promise<Object>;
|
|
13
|
+
on(app: string, dbURL: string, props: Object): void;
|
|
14
|
+
off(queryKey: string, eventRegistrationKey: string): void;
|
|
15
|
+
keepSynced(
|
|
16
|
+
app: string,
|
|
17
|
+
dbURL: string,
|
|
18
|
+
key: string,
|
|
19
|
+
path: string,
|
|
20
|
+
modifiers: ReadonlyArray<Object>,
|
|
21
|
+
enabled: boolean,
|
|
22
|
+
): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('NativeRNFBTurboDatabaseQuery');
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-wrapper-object-types */
|
|
2
|
+
import type { TurboModule } from 'react-native';
|
|
3
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
4
|
+
|
|
5
|
+
export interface Spec extends TurboModule {
|
|
6
|
+
set(app: string, dbURL: string, path: string, props: Object): Promise<void>;
|
|
7
|
+
update(app: string, dbURL: string, path: string, props: Object): Promise<void>;
|
|
8
|
+
setWithPriority(app: string, dbURL: string, path: string, props: Object): Promise<void>;
|
|
9
|
+
remove(app: string, dbURL: string, path: string): Promise<void>;
|
|
10
|
+
setPriority(app: string, dbURL: string, path: string, props: Object): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('NativeRNFBTurboDatabaseReference');
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-wrapper-object-types */
|
|
2
|
+
import type { TurboModule } from 'react-native';
|
|
3
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
4
|
+
|
|
5
|
+
export interface Spec extends TurboModule {
|
|
6
|
+
transactionStart(
|
|
7
|
+
app: string,
|
|
8
|
+
dbURL: string,
|
|
9
|
+
path: string,
|
|
10
|
+
transactionId: number,
|
|
11
|
+
applyLocally: boolean,
|
|
12
|
+
): void;
|
|
13
|
+
transactionTryCommit(app: string, dbURL: string, transactionId: number, updates: Object): void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('NativeRNFBTurboDatabaseTransaction');
|
package/typedoc.json
CHANGED
package/dist/module/modular.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this library except in compliance with the License.
|
|
8
|
-
* You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
import { getApp } from '@react-native-firebase/app';
|
|
21
|
-
import { MODULAR_DEPRECATION_ARG } from '@react-native-firebase/app/dist/module/common';
|
|
22
|
-
import DatabaseStatics from "./DatabaseStatics.js";
|
|
23
|
-
const {
|
|
24
|
-
ServerValue
|
|
25
|
-
} = DatabaseStatics;
|
|
26
|
-
export function getDatabase(app, url) {
|
|
27
|
-
if (app) {
|
|
28
|
-
return getApp(app.name).database(url);
|
|
29
|
-
}
|
|
30
|
-
return getApp().database(url);
|
|
31
|
-
}
|
|
32
|
-
export function connectDatabaseEmulator(db, host, port, options) {
|
|
33
|
-
db.useEmulator.call(db, host, port, options, MODULAR_DEPRECATION_ARG);
|
|
34
|
-
}
|
|
35
|
-
export function goOffline(db) {
|
|
36
|
-
db.goOffline.call(db, MODULAR_DEPRECATION_ARG);
|
|
37
|
-
}
|
|
38
|
-
export function goOnline(db) {
|
|
39
|
-
db.goOnline.call(db, MODULAR_DEPRECATION_ARG);
|
|
40
|
-
}
|
|
41
|
-
export function ref(db, path) {
|
|
42
|
-
return db.ref.call(db, path, MODULAR_DEPRECATION_ARG);
|
|
43
|
-
}
|
|
44
|
-
export function refFromURL(db, url) {
|
|
45
|
-
return db.refFromURL.call(db, url, MODULAR_DEPRECATION_ARG);
|
|
46
|
-
}
|
|
47
|
-
export function setPersistenceEnabled(db, enabled) {
|
|
48
|
-
return db.setPersistenceEnabled.call(db, enabled, MODULAR_DEPRECATION_ARG);
|
|
49
|
-
}
|
|
50
|
-
export function setLoggingEnabled(db, enabled) {
|
|
51
|
-
return db.setLoggingEnabled.call(db, enabled, MODULAR_DEPRECATION_ARG);
|
|
52
|
-
}
|
|
53
|
-
export function setPersistenceCacheSizeBytes(db, bytes) {
|
|
54
|
-
return db.setPersistenceCacheSizeBytes.call(db, bytes, MODULAR_DEPRECATION_ARG);
|
|
55
|
-
}
|
|
56
|
-
export function forceLongPolling() {
|
|
57
|
-
throw new Error('forceLongPolling() is not implemented');
|
|
58
|
-
}
|
|
59
|
-
export function forceWebSockets() {
|
|
60
|
-
throw new Error('forceWebSockets() is not implemented');
|
|
61
|
-
}
|
|
62
|
-
export function serverTimestamp() {
|
|
63
|
-
return ServerValue.TIMESTAMP;
|
|
64
|
-
}
|
|
65
|
-
export function getServerTime(db) {
|
|
66
|
-
return db.getServerTime.call(db, MODULAR_DEPRECATION_ARG);
|
|
67
|
-
}
|
|
68
|
-
export function increment(delta) {
|
|
69
|
-
return ServerValue.increment.call(ServerValue, delta, MODULAR_DEPRECATION_ARG);
|
|
70
|
-
}
|
|
71
|
-
export function enableLogging(_enabledOrLogger, _persistent) {
|
|
72
|
-
throw new Error('enableLogging() is not implemented');
|
|
73
|
-
}
|
|
74
|
-
export * from "./modular/query.js";
|
|
75
|
-
export * from "./modular/transaction.js";
|
|
76
|
-
//# sourceMappingURL=modular.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["getApp","MODULAR_DEPRECATION_ARG","DatabaseStatics","ServerValue","getDatabase","app","url","name","database","connectDatabaseEmulator","db","host","port","options","useEmulator","call","goOffline","goOnline","ref","path","refFromURL","setPersistenceEnabled","enabled","setLoggingEnabled","setPersistenceCacheSizeBytes","bytes","forceLongPolling","Error","forceWebSockets","serverTimestamp","TIMESTAMP","getServerTime","increment","delta","enableLogging","_enabledOrLogger","_persistent"],"sourceRoot":"../../lib","sources":["modular.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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present Invertase Limited & Contributors
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this library except in compliance with the License.
|
|
8
|
-
* You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
import { isAndroid, isBoolean, isNumber, isString, MODULAR_DEPRECATION_ARG, createDeprecationProxy } from '@react-native-firebase/app/dist/module/common';
|
|
21
|
-
import { createModuleNamespace, FirebaseModule, getFirebaseRoot } from '@react-native-firebase/app/dist/module/internal';
|
|
22
|
-
import { setReactNativeModule } from '@react-native-firebase/app/dist/module/internal/nativeModule';
|
|
23
|
-
import "./types/internal.js";
|
|
24
|
-
import DatabaseReference from "./DatabaseReference.js";
|
|
25
|
-
import DatabaseStatics from "./DatabaseStatics.js";
|
|
26
|
-
import DatabaseTransaction from "./DatabaseTransaction.js";
|
|
27
|
-
import { version } from "./version.js";
|
|
28
|
-
import fallBackModule from './web/RNFBDatabaseModule';
|
|
29
|
-
const namespace = 'database';
|
|
30
|
-
const nativeModuleName = 'RNFBDatabaseModule';
|
|
31
|
-
const nativeModuleNames = [nativeModuleName, 'RNFBDatabaseReferenceModule', 'RNFBDatabaseQueryModule', 'RNFBDatabaseOnDisconnectModule', 'RNFBDatabaseTransactionModule'];
|
|
32
|
-
function ap(reference) {
|
|
33
|
-
return reference;
|
|
34
|
-
}
|
|
35
|
-
class FirebaseDatabaseModule extends FirebaseModule {
|
|
36
|
-
type = 'database';
|
|
37
|
-
get nativeModule() {
|
|
38
|
-
return this.native;
|
|
39
|
-
}
|
|
40
|
-
constructor(app, config, databaseUrl) {
|
|
41
|
-
super(app, config, databaseUrl);
|
|
42
|
-
this._serverTimeOffset = 0;
|
|
43
|
-
this._customUrlOrRegion = databaseUrl || this.app.options.databaseURL || null;
|
|
44
|
-
this._transaction = new DatabaseTransaction(this);
|
|
45
|
-
setTimeout(() => {
|
|
46
|
-
this._syncServerTimeOffset();
|
|
47
|
-
}, 100);
|
|
48
|
-
}
|
|
49
|
-
_syncServerTimeOffset() {
|
|
50
|
-
ap(this.ref('.info/serverTimeOffset')).on('value', snapshot => {
|
|
51
|
-
this._serverTimeOffset = snapshot.val();
|
|
52
|
-
}, MODULAR_DEPRECATION_ARG);
|
|
53
|
-
}
|
|
54
|
-
getServerTime() {
|
|
55
|
-
return new Date(Date.now() + this._serverTimeOffset);
|
|
56
|
-
}
|
|
57
|
-
ref(path = '/') {
|
|
58
|
-
if (!isString(path)) {
|
|
59
|
-
throw new Error("firebase.app().database().ref(*) 'path' must be a string value.");
|
|
60
|
-
}
|
|
61
|
-
if (/[#$\[\]'?]/g.test(path)) {
|
|
62
|
-
throw new Error(`Paths must be non-empty strings and can't contain #, $, [, ], ' or ? | path: ${path}`);
|
|
63
|
-
}
|
|
64
|
-
return createDeprecationProxy(new DatabaseReference(this, path));
|
|
65
|
-
}
|
|
66
|
-
refFromURL(url) {
|
|
67
|
-
if (!isString(url) || !url.startsWith('https://')) {
|
|
68
|
-
throw new Error("firebase.app().database().refFromURL(*) 'url' must be a valid database URL.");
|
|
69
|
-
}
|
|
70
|
-
if (!url.includes(this._customUrlOrRegion)) {
|
|
71
|
-
throw new Error(`firebase.app().database().refFromURL(*) 'url' must be the same domain as the current instance (${this._customUrlOrRegion}). To use a different database domain, create a new Firebase instance.`);
|
|
72
|
-
}
|
|
73
|
-
let path = url.replace(this._customUrlOrRegion, '');
|
|
74
|
-
if (path.includes('?')) {
|
|
75
|
-
path = path.slice(0, path.indexOf('?'));
|
|
76
|
-
}
|
|
77
|
-
return createDeprecationProxy(new DatabaseReference(this, path || '/'));
|
|
78
|
-
}
|
|
79
|
-
goOnline() {
|
|
80
|
-
return this.nativeModule.goOnline();
|
|
81
|
-
}
|
|
82
|
-
goOffline() {
|
|
83
|
-
return this.nativeModule.goOffline();
|
|
84
|
-
}
|
|
85
|
-
setPersistenceEnabled(enabled) {
|
|
86
|
-
if (!isBoolean(enabled)) {
|
|
87
|
-
throw new Error("firebase.app().database().setPersistenceEnabled(*) 'enabled' must be a boolean value.");
|
|
88
|
-
}
|
|
89
|
-
return this.nativeModule.setPersistenceEnabled(enabled);
|
|
90
|
-
}
|
|
91
|
-
setLoggingEnabled(enabled) {
|
|
92
|
-
if (!isBoolean(enabled)) {
|
|
93
|
-
throw new Error("firebase.app().database().setLoggingEnabled(*) 'enabled' must be a boolean value.");
|
|
94
|
-
}
|
|
95
|
-
return this.nativeModule.setLoggingEnabled(enabled);
|
|
96
|
-
}
|
|
97
|
-
setPersistenceCacheSizeBytes(bytes) {
|
|
98
|
-
if (!isNumber(bytes)) {
|
|
99
|
-
throw new Error("firebase.app().database().setPersistenceCacheSizeBytes(*) 'bytes' must be a number value.");
|
|
100
|
-
}
|
|
101
|
-
if (bytes < 1048576) {
|
|
102
|
-
throw new Error("firebase.app().database().setPersistenceCacheSizeBytes(*) 'bytes' must be greater than 1048576 bytes (1MB).");
|
|
103
|
-
}
|
|
104
|
-
if (bytes > 104857600) {
|
|
105
|
-
throw new Error("firebase.app().database().setPersistenceCacheSizeBytes(*) 'bytes' must be less than 104857600 bytes (100MB).");
|
|
106
|
-
}
|
|
107
|
-
return this.nativeModule.setPersistenceCacheSizeBytes(bytes);
|
|
108
|
-
}
|
|
109
|
-
useEmulator(host, port) {
|
|
110
|
-
if (!host || !isString(host) || !port || !isNumber(port)) {
|
|
111
|
-
throw new Error('firebase.database().useEmulator() takes a non-empty host and port');
|
|
112
|
-
}
|
|
113
|
-
let remappedHost = host;
|
|
114
|
-
const androidBypassEmulatorUrlRemap = typeof this.firebaseJson.android_bypass_emulator_url_remap === 'boolean' && this.firebaseJson.android_bypass_emulator_url_remap;
|
|
115
|
-
if (!androidBypassEmulatorUrlRemap && isAndroid && remappedHost) {
|
|
116
|
-
if (remappedHost.startsWith('localhost')) {
|
|
117
|
-
remappedHost = remappedHost.replace('localhost', '10.0.2.2');
|
|
118
|
-
// eslint-disable-next-line no-console
|
|
119
|
-
console.log('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.');
|
|
120
|
-
}
|
|
121
|
-
if (remappedHost.startsWith('127.0.0.1')) {
|
|
122
|
-
remappedHost = remappedHost.replace('127.0.0.1', '10.0.2.2');
|
|
123
|
-
// eslint-disable-next-line no-console
|
|
124
|
-
console.log('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.');
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
this.nativeModule.useEmulator(remappedHost, port);
|
|
128
|
-
return [remappedHost, port];
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
export const SDK_VERSION = version;
|
|
132
|
-
const databaseNamespace = createModuleNamespace({
|
|
133
|
-
statics: DatabaseStatics,
|
|
134
|
-
version,
|
|
135
|
-
namespace,
|
|
136
|
-
nativeModuleName: [...nativeModuleNames],
|
|
137
|
-
nativeEvents: ['database_transaction_event', 'database_sync_event'],
|
|
138
|
-
hasMultiAppSupport: true,
|
|
139
|
-
hasCustomUrlOrRegionSupport: true,
|
|
140
|
-
ModuleClass: FirebaseDatabaseModule
|
|
141
|
-
});
|
|
142
|
-
export default databaseNamespace;
|
|
143
|
-
export const firebase = getFirebaseRoot();
|
|
144
|
-
for (const moduleName of nativeModuleNames) {
|
|
145
|
-
setReactNativeModule(moduleName, fallBackModule);
|
|
146
|
-
}
|
|
147
|
-
//# sourceMappingURL=namespaced.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["isAndroid","isBoolean","isNumber","isString","MODULAR_DEPRECATION_ARG","createDeprecationProxy","createModuleNamespace","FirebaseModule","getFirebaseRoot","setReactNativeModule","DatabaseReference","DatabaseStatics","DatabaseTransaction","version","fallBackModule","namespace","nativeModuleName","nativeModuleNames","ap","reference","FirebaseDatabaseModule","type","nativeModule","native","constructor","app","config","databaseUrl","_serverTimeOffset","_customUrlOrRegion","options","databaseURL","_transaction","setTimeout","_syncServerTimeOffset","ref","on","snapshot","val","getServerTime","Date","now","path","Error","test","refFromURL","url","startsWith","includes","replace","slice","indexOf","goOnline","goOffline","setPersistenceEnabled","enabled","setLoggingEnabled","setPersistenceCacheSizeBytes","bytes","useEmulator","host","port","remappedHost","androidBypassEmulatorUrlRemap","firebaseJson","android_bypass_emulator_url_remap","console","log","SDK_VERSION","databaseNamespace","statics","nativeEvents","hasMultiAppSupport","hasCustomUrlOrRegionSupport","ModuleClass","firebase","moduleName"],"sourceRoot":"../../lib","sources":["namespaced.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,SAAS,EACTC,SAAS,EACTC,QAAQ,EACRC,QAAQ,EACRC,uBAAuB,EACvBC,sBAAsB,QACjB,+CAA+C;AACtD,SACEC,qBAAqB,EACrBC,cAAc,EACdC,eAAe,QAEV,iDAAiD;AACxD,SAASC,oBAAoB,QAAQ,8DAA8D;AASnG,OAAO,qBAAkB;AACzB,OAAOC,iBAAiB,MAAM,wBAAqB;AACnD,OAAOC,eAAe,MAAM,sBAAmB;AAC/C,OAAOC,mBAAmB,MAAM,0BAAuB;AACvD,SAASC,OAAO,QAAQ,cAAW;AACnC,OAAOC,cAAc,MAAM,0BAA0B;AAErD,MAAMC,SAAS,GAAG,UAAU;AAE5B,MAAMC,gBAAgB,GAAG,oBAAoB;AAE7C,MAAMC,iBAAiB,GAAG,CACxBD,gBAAgB,EAChB,6BAA6B,E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