@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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"namespaced.d.ts","sourceRoot":"","sources":["../../../../lib/types/namespaced.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH;;;GAGG;AAEH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AC,OAAO,CAC9B,CAAC;SACH;QAED,UAAU,WAAW;YACnB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,qBAAqB,CAAC,MAAM,CAAC;SAC9D;KACF;CACF"}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this library except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
#import <Firebase/Firebase.h>
|
|
19
|
-
#import <React/RCTUtils.h>
|
|
20
|
-
|
|
21
|
-
#import "RNFBDatabaseCommon.h"
|
|
22
|
-
#import "RNFBDatabaseModule.h"
|
|
23
|
-
#import "RNFBPreferences.h"
|
|
24
|
-
|
|
25
|
-
static __strong NSMutableDictionary *emulatorSettings;
|
|
26
|
-
|
|
27
|
-
@implementation RNFBDatabaseModule
|
|
28
|
-
#pragma mark -
|
|
29
|
-
#pragma mark Module Setup
|
|
30
|
-
|
|
31
|
-
RCT_EXPORT_MODULE();
|
|
32
|
-
|
|
33
|
-
- (dispatch_queue_t)methodQueue {
|
|
34
|
-
return [RNFBDatabaseCommon getDispatchQueue];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
#pragma mark -
|
|
38
|
-
#pragma mark Firebase Database
|
|
39
|
-
|
|
40
|
-
RCT_EXPORT_METHOD(goOnline
|
|
41
|
-
: (FIRApp *)firebaseApp
|
|
42
|
-
: (NSString *)dbURL
|
|
43
|
-
: (RCTPromiseResolveBlock)resolve
|
|
44
|
-
: (RCTPromiseRejectBlock)reject) {
|
|
45
|
-
[[RNFBDatabaseCommon getDatabaseForApp:firebaseApp dbURL:dbURL] goOnline];
|
|
46
|
-
resolve([NSNull null]);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
RCT_EXPORT_METHOD(goOffline
|
|
50
|
-
: (FIRApp *)firebaseApp
|
|
51
|
-
: (NSString *)dbURL
|
|
52
|
-
: (RCTPromiseResolveBlock)resolve
|
|
53
|
-
: (RCTPromiseRejectBlock)reject) {
|
|
54
|
-
[[RNFBDatabaseCommon getDatabaseForApp:firebaseApp dbURL:dbURL] goOffline];
|
|
55
|
-
resolve([NSNull null]);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
RCT_EXPORT_METHOD(useEmulator
|
|
59
|
-
: (FIRApp *)firebaseApp
|
|
60
|
-
: (NSString *)dbURL
|
|
61
|
-
: (nonnull NSString *)host
|
|
62
|
-
: (NSInteger)port) {
|
|
63
|
-
// javascript may hot reload, losing state, and native throws an error if you double-request
|
|
64
|
-
// so we keep track of useEmulator calls here to avoid calling native twice
|
|
65
|
-
if (emulatorSettings == nil) {
|
|
66
|
-
emulatorSettings = [NSMutableDictionary dictionary];
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
NSMutableString *configKey = [firebaseApp.name mutableCopy];
|
|
70
|
-
if (dbURL != nil && dbURL.length > 0) {
|
|
71
|
-
[configKey appendString:dbURL];
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (!emulatorSettings[configKey]) {
|
|
75
|
-
[[RNFBDatabaseCommon getDatabaseForApp:firebaseApp dbURL:dbURL] useEmulatorWithHost:host
|
|
76
|
-
port:port];
|
|
77
|
-
emulatorSettings[configKey] = @YES;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
RCT_EXPORT_METHOD(setPersistenceEnabled
|
|
82
|
-
: (FIRApp *)firebaseApp
|
|
83
|
-
: (NSString *)dbURL
|
|
84
|
-
: (BOOL)enabled) {
|
|
85
|
-
[[RNFBPreferences shared] setBooleanValue:DATABASE_PERSISTENCE_ENABLED boolValue:enabled];
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
RCT_EXPORT_METHOD(setLoggingEnabled : (FIRApp *)firebaseApp : (NSString *)dbURL : (BOOL)enabled) {
|
|
89
|
-
[[RNFBPreferences shared] setBooleanValue:DATABASE_LOGGING_ENABLED boolValue:enabled];
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
RCT_EXPORT_METHOD(setPersistenceCacheSizeBytes
|
|
93
|
-
: (FIRApp *)firebaseApp
|
|
94
|
-
: (NSString *)dbURL
|
|
95
|
-
: (NSNumber *_Nonnull)bytes) {
|
|
96
|
-
[[RNFBPreferences shared] setIntegerValue:DATABASE_PERSISTENCE_CACHE_SIZE
|
|
97
|
-
integerValue:[bytes intValue]];
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
@end
|
package/lib/modular.ts
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this library except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
import { getApp } from '@react-native-firebase/app';
|
|
19
|
-
import { MODULAR_DEPRECATION_ARG } from '@react-native-firebase/app/dist/module/common';
|
|
20
|
-
import type { ReactNativeFirebase } from '@react-native-firebase/app';
|
|
21
|
-
import DatabaseStatics from './DatabaseStatics';
|
|
22
|
-
import type { Database, DatabaseReference, EmulatorMockTokenOptions } from './types/database';
|
|
23
|
-
import type {
|
|
24
|
-
AppWithDatabaseInternal,
|
|
25
|
-
DatabaseWithMethodsInternal,
|
|
26
|
-
ServerValueStaticInternal,
|
|
27
|
-
} from './types/internal';
|
|
28
|
-
|
|
29
|
-
const { ServerValue } = DatabaseStatics;
|
|
30
|
-
|
|
31
|
-
type FirebaseApp = ReactNativeFirebase.FirebaseApp;
|
|
32
|
-
|
|
33
|
-
export function getDatabase(app?: FirebaseApp, url?: string): Database {
|
|
34
|
-
if (app) {
|
|
35
|
-
return (getApp(app.name) as unknown as AppWithDatabaseInternal).database(
|
|
36
|
-
url,
|
|
37
|
-
) as unknown as Database;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return (getApp() as unknown as AppWithDatabaseInternal).database(url) as unknown as Database;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export function connectDatabaseEmulator(
|
|
44
|
-
db: Database,
|
|
45
|
-
host: string,
|
|
46
|
-
port: number,
|
|
47
|
-
options?: {
|
|
48
|
-
mockUserToken?: EmulatorMockTokenOptions | string;
|
|
49
|
-
},
|
|
50
|
-
): void {
|
|
51
|
-
(db as DatabaseWithMethodsInternal).useEmulator.call(
|
|
52
|
-
db,
|
|
53
|
-
host,
|
|
54
|
-
port,
|
|
55
|
-
options,
|
|
56
|
-
MODULAR_DEPRECATION_ARG,
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export function goOffline(db: Database): void {
|
|
61
|
-
(db as DatabaseWithMethodsInternal).goOffline.call(db, MODULAR_DEPRECATION_ARG);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export function goOnline(db: Database): void {
|
|
65
|
-
(db as DatabaseWithMethodsInternal).goOnline.call(db, MODULAR_DEPRECATION_ARG);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export function ref(db: Database, path?: string): DatabaseReference {
|
|
69
|
-
return (db as DatabaseWithMethodsInternal).ref.call(db, path, MODULAR_DEPRECATION_ARG);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export function refFromURL(db: Database, url: string): DatabaseReference {
|
|
73
|
-
return (db as DatabaseWithMethodsInternal).refFromURL.call(db, url, MODULAR_DEPRECATION_ARG);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export function setPersistenceEnabled(db: Database, enabled: boolean): Promise<void> {
|
|
77
|
-
return (db as DatabaseWithMethodsInternal).setPersistenceEnabled.call(
|
|
78
|
-
db,
|
|
79
|
-
enabled,
|
|
80
|
-
MODULAR_DEPRECATION_ARG,
|
|
81
|
-
) as Promise<void>;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export function setLoggingEnabled(db: Database, enabled: boolean): Promise<void> {
|
|
85
|
-
return (db as DatabaseWithMethodsInternal).setLoggingEnabled.call(
|
|
86
|
-
db,
|
|
87
|
-
enabled,
|
|
88
|
-
MODULAR_DEPRECATION_ARG,
|
|
89
|
-
) as Promise<void>;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export function setPersistenceCacheSizeBytes(db: Database, bytes: number): Promise<void> {
|
|
93
|
-
return (db as DatabaseWithMethodsInternal).setPersistenceCacheSizeBytes.call(
|
|
94
|
-
db,
|
|
95
|
-
bytes,
|
|
96
|
-
MODULAR_DEPRECATION_ARG,
|
|
97
|
-
) as Promise<void>;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export function forceLongPolling(): void {
|
|
101
|
-
throw new Error('forceLongPolling() is not implemented');
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export function forceWebSockets(): void {
|
|
105
|
-
throw new Error('forceWebSockets() is not implemented');
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export function serverTimestamp(): object {
|
|
109
|
-
return ServerValue.TIMESTAMP;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export function getServerTime(db: Database): Date {
|
|
113
|
-
return (db as DatabaseWithMethodsInternal).getServerTime.call(db, MODULAR_DEPRECATION_ARG);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export function increment(delta: number): object {
|
|
117
|
-
return (ServerValue as ServerValueStaticInternal).increment.call(
|
|
118
|
-
ServerValue,
|
|
119
|
-
delta,
|
|
120
|
-
MODULAR_DEPRECATION_ARG,
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export function enableLogging(enabled: boolean, persistent?: boolean): any;
|
|
125
|
-
export function enableLogging(logger: (message: string) => unknown): any;
|
|
126
|
-
export function enableLogging(
|
|
127
|
-
_enabledOrLogger: boolean | ((message: string) => unknown),
|
|
128
|
-
_persistent?: boolean,
|
|
129
|
-
): any {
|
|
130
|
-
throw new Error('enableLogging() is not implemented');
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export * from './modular/query';
|
|
134
|
-
export * from './modular/transaction';
|
package/lib/namespaced.ts
DELETED
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this library except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
import {
|
|
19
|
-
isAndroid,
|
|
20
|
-
isBoolean,
|
|
21
|
-
isNumber,
|
|
22
|
-
isString,
|
|
23
|
-
MODULAR_DEPRECATION_ARG,
|
|
24
|
-
createDeprecationProxy,
|
|
25
|
-
} from '@react-native-firebase/app/dist/module/common';
|
|
26
|
-
import {
|
|
27
|
-
createModuleNamespace,
|
|
28
|
-
FirebaseModule,
|
|
29
|
-
getFirebaseRoot,
|
|
30
|
-
type ModuleConfig,
|
|
31
|
-
} from '@react-native-firebase/app/dist/module/internal';
|
|
32
|
-
import { setReactNativeModule } from '@react-native-firebase/app/dist/module/internal/nativeModule';
|
|
33
|
-
import type { ReactNativeFirebase } from '@react-native-firebase/app';
|
|
34
|
-
import type {
|
|
35
|
-
DatabaseInternal,
|
|
36
|
-
DatabaseReferenceInternal,
|
|
37
|
-
DatabaseTransactionInternal,
|
|
38
|
-
RNFBDatabaseModule,
|
|
39
|
-
} from './types/internal';
|
|
40
|
-
import type { FirebaseDatabaseTypes } from './types/namespaced';
|
|
41
|
-
import './types/internal';
|
|
42
|
-
import DatabaseReference from './DatabaseReference';
|
|
43
|
-
import DatabaseStatics from './DatabaseStatics';
|
|
44
|
-
import DatabaseTransaction from './DatabaseTransaction';
|
|
45
|
-
import { version } from './version';
|
|
46
|
-
import fallBackModule from './web/RNFBDatabaseModule';
|
|
47
|
-
|
|
48
|
-
const namespace = 'database';
|
|
49
|
-
|
|
50
|
-
const nativeModuleName = 'RNFBDatabaseModule';
|
|
51
|
-
|
|
52
|
-
const nativeModuleNames = [
|
|
53
|
-
nativeModuleName,
|
|
54
|
-
'RNFBDatabaseReferenceModule',
|
|
55
|
-
'RNFBDatabaseQueryModule',
|
|
56
|
-
'RNFBDatabaseOnDisconnectModule',
|
|
57
|
-
'RNFBDatabaseTransactionModule',
|
|
58
|
-
] as const;
|
|
59
|
-
|
|
60
|
-
function ap(reference: DatabaseReference): DatabaseReferenceInternal {
|
|
61
|
-
return reference as DatabaseReferenceInternal;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
class FirebaseDatabaseModule extends FirebaseModule<typeof nativeModuleName> {
|
|
65
|
-
readonly type = 'database' as const;
|
|
66
|
-
_serverTimeOffset: number;
|
|
67
|
-
_customUrlOrRegion: string | null;
|
|
68
|
-
_transaction: DatabaseTransactionInternal;
|
|
69
|
-
|
|
70
|
-
private get nativeModule(): RNFBDatabaseModule {
|
|
71
|
-
return this.native as RNFBDatabaseModule;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
constructor(
|
|
75
|
-
app: ReactNativeFirebase.FirebaseAppBase,
|
|
76
|
-
config: ModuleConfig,
|
|
77
|
-
databaseUrl?: string | null,
|
|
78
|
-
) {
|
|
79
|
-
super(app, config, databaseUrl);
|
|
80
|
-
this._serverTimeOffset = 0;
|
|
81
|
-
this._customUrlOrRegion = databaseUrl || this.app.options.databaseURL || null;
|
|
82
|
-
this._transaction = new DatabaseTransaction(this as unknown as DatabaseInternal);
|
|
83
|
-
setTimeout(() => {
|
|
84
|
-
this._syncServerTimeOffset();
|
|
85
|
-
}, 100);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
_syncServerTimeOffset(): void {
|
|
89
|
-
ap(this.ref('.info/serverTimeOffset')).on(
|
|
90
|
-
'value',
|
|
91
|
-
(snapshot: { val(): number }) => {
|
|
92
|
-
this._serverTimeOffset = snapshot.val();
|
|
93
|
-
},
|
|
94
|
-
MODULAR_DEPRECATION_ARG,
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
getServerTime(): Date {
|
|
99
|
-
return new Date(Date.now() + this._serverTimeOffset);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
ref(path = '/'): DatabaseReference {
|
|
103
|
-
if (!isString(path)) {
|
|
104
|
-
throw new Error("firebase.app().database().ref(*) 'path' must be a string value.");
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (/[#$\[\]'?]/g.test(path)) {
|
|
108
|
-
throw new Error(
|
|
109
|
-
`Paths must be non-empty strings and can't contain #, $, [, ], ' or ? | path: ${path}`,
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
return createDeprecationProxy(new DatabaseReference(this, path));
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
refFromURL(url: string): DatabaseReference {
|
|
117
|
-
if (!isString(url) || !url.startsWith('https://')) {
|
|
118
|
-
throw new Error(
|
|
119
|
-
"firebase.app().database().refFromURL(*) 'url' must be a valid database URL.",
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
if (!url.includes(this._customUrlOrRegion as string)) {
|
|
124
|
-
throw new Error(
|
|
125
|
-
`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.`,
|
|
126
|
-
);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
let path = url.replace(this._customUrlOrRegion as string, '');
|
|
130
|
-
if (path.includes('?')) {
|
|
131
|
-
path = path.slice(0, path.indexOf('?'));
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return createDeprecationProxy(new DatabaseReference(this, path || '/'));
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
goOnline(): Promise<void> {
|
|
138
|
-
return this.nativeModule.goOnline();
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
goOffline(): Promise<void> {
|
|
142
|
-
return this.nativeModule.goOffline();
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
setPersistenceEnabled(enabled: boolean): Promise<void> {
|
|
146
|
-
if (!isBoolean(enabled)) {
|
|
147
|
-
throw new Error(
|
|
148
|
-
"firebase.app().database().setPersistenceEnabled(*) 'enabled' must be a boolean value.",
|
|
149
|
-
);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
return this.nativeModule.setPersistenceEnabled(enabled);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
setLoggingEnabled(enabled: boolean): Promise<void> {
|
|
156
|
-
if (!isBoolean(enabled)) {
|
|
157
|
-
throw new Error(
|
|
158
|
-
"firebase.app().database().setLoggingEnabled(*) 'enabled' must be a boolean value.",
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
return this.nativeModule.setLoggingEnabled(enabled);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
setPersistenceCacheSizeBytes(bytes: number): Promise<void> {
|
|
166
|
-
if (!isNumber(bytes)) {
|
|
167
|
-
throw new Error(
|
|
168
|
-
"firebase.app().database().setPersistenceCacheSizeBytes(*) 'bytes' must be a number value.",
|
|
169
|
-
);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
if (bytes < 1048576) {
|
|
173
|
-
throw new Error(
|
|
174
|
-
"firebase.app().database().setPersistenceCacheSizeBytes(*) 'bytes' must be greater than 1048576 bytes (1MB).",
|
|
175
|
-
);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
if (bytes > 104857600) {
|
|
179
|
-
throw new Error(
|
|
180
|
-
"firebase.app().database().setPersistenceCacheSizeBytes(*) 'bytes' must be less than 104857600 bytes (100MB).",
|
|
181
|
-
);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
return this.nativeModule.setPersistenceCacheSizeBytes(bytes);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
useEmulator(host: string, port: number): [string, number] {
|
|
188
|
-
if (!host || !isString(host) || !port || !isNumber(port)) {
|
|
189
|
-
throw new Error('firebase.database().useEmulator() takes a non-empty host and port');
|
|
190
|
-
}
|
|
191
|
-
let remappedHost = host;
|
|
192
|
-
const androidBypassEmulatorUrlRemap =
|
|
193
|
-
typeof this.firebaseJson.android_bypass_emulator_url_remap === 'boolean' &&
|
|
194
|
-
this.firebaseJson.android_bypass_emulator_url_remap;
|
|
195
|
-
if (!androidBypassEmulatorUrlRemap && isAndroid && remappedHost) {
|
|
196
|
-
if (remappedHost.startsWith('localhost')) {
|
|
197
|
-
remappedHost = remappedHost.replace('localhost', '10.0.2.2');
|
|
198
|
-
// eslint-disable-next-line no-console
|
|
199
|
-
console.log(
|
|
200
|
-
'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.',
|
|
201
|
-
);
|
|
202
|
-
}
|
|
203
|
-
if (remappedHost.startsWith('127.0.0.1')) {
|
|
204
|
-
remappedHost = remappedHost.replace('127.0.0.1', '10.0.2.2');
|
|
205
|
-
// eslint-disable-next-line no-console
|
|
206
|
-
console.log(
|
|
207
|
-
'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.',
|
|
208
|
-
);
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
this.nativeModule.useEmulator(remappedHost, port);
|
|
212
|
-
return [remappedHost, port];
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
export const SDK_VERSION = version;
|
|
217
|
-
|
|
218
|
-
const databaseNamespace = createModuleNamespace({
|
|
219
|
-
statics: DatabaseStatics,
|
|
220
|
-
version,
|
|
221
|
-
namespace,
|
|
222
|
-
nativeModuleName: [...nativeModuleNames],
|
|
223
|
-
nativeEvents: ['database_transaction_event', 'database_sync_event'],
|
|
224
|
-
hasMultiAppSupport: true,
|
|
225
|
-
hasCustomUrlOrRegionSupport: true,
|
|
226
|
-
ModuleClass: FirebaseDatabaseModule,
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
type DatabaseNamespace = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp<
|
|
230
|
-
FirebaseDatabaseTypes.Module,
|
|
231
|
-
FirebaseDatabaseTypes.Statics
|
|
232
|
-
> & {
|
|
233
|
-
database: ReactNativeFirebase.FirebaseModuleWithStaticsAndApp<
|
|
234
|
-
FirebaseDatabaseTypes.Module,
|
|
235
|
-
FirebaseDatabaseTypes.Statics
|
|
236
|
-
>;
|
|
237
|
-
firebase: ReactNativeFirebase.Module;
|
|
238
|
-
app(name?: string): ReactNativeFirebase.FirebaseApp;
|
|
239
|
-
};
|
|
240
|
-
|
|
241
|
-
export default databaseNamespace as unknown as DatabaseNamespace;
|
|
242
|
-
|
|
243
|
-
export const firebase =
|
|
244
|
-
getFirebaseRoot() as unknown as ReactNativeFirebase.FirebaseNamespacedExport<
|
|
245
|
-
'database',
|
|
246
|
-
FirebaseDatabaseTypes.Module,
|
|
247
|
-
FirebaseDatabaseTypes.Statics,
|
|
248
|
-
true
|
|
249
|
-
>;
|
|
250
|
-
|
|
251
|
-
for (const moduleName of nativeModuleNames) {
|
|
252
|
-
setReactNativeModule(moduleName, fallBackModule as unknown as Record<string, unknown>);
|
|
253
|
-
}
|